23#include <gdk/gdkkeysyms.h>
73#define CITYMAP_WIDTH MIN(512, canvas_width)
74#define CITYMAP_HEIGHT (CITYMAP_WIDTH * canvas_height / canvas_width)
75#define CITYMAP_SCALE ((double)CITYMAP_WIDTH / (double)canvas_width)
77#define TINYSCREEN_MAX_HEIGHT (500 - 1)
86#define SPECLIST_TAG dialog
87#define SPECLIST_TYPE struct city_dialog
90#define dialog_list_iterate(dialoglist, pdialog) \
91 TYPED_LIST_ITERATE(struct city_dialog, dialoglist, pdialog)
92#define dialog_list_iterate_end LIST_ITERATE_END
104#define SPECVEC_TAG unit_node
105#define SPECVEC_TYPE struct unit_node
108#define unit_node_vector_iterate(list, elt) \
109 TYPED_VECTOR_ITERATE(struct unit_node, list, elt)
110#define unit_node_vector_iterate_end VECTOR_ITERATE_END
112#define NUM_CITIZENS_SHOWN 30
130#define CITY_MAP_MIN_SIZE_X 200
131#define CITY_MAP_MIN_SIZE_Y 150
153 GtkWidget *production_bar;
154 GtkWidget *production_combo;
155 GtkWidget *buy_command;
156 GtkWidget *improvement_list;
158 GtkWidget *supported_units_frame;
159 GtkWidget *supported_unit_table;
161 GtkWidget *present_units_frame;
162 GtkWidget *present_unit_table;
164 struct unit_node_vector supported_units;
165 struct unit_node_vector present_units;
169 GtkListStore *change_production_store;
173 GtkWidget *production_label;
174 GtkWidget *production_bar;
175 GtkWidget *buy_command;
190 GtkWidget *rename_command;
191 GtkWidget *new_citizens_radio[3];
192 GtkWidget *disband_on_settler;
237 GdkModifierType state,
268 double x,
double y, gpointer data);
270 double x,
double y, gpointer data);
272 double x,
double y, gpointer data);
274 double x,
double y, gpointer data);
276 double x,
double y, gpointer data);
305 double x,
double y, gpointer data);
307 double x,
double y, gpointer data);
309 double x,
double y, gpointer data);
320 GtkTreeViewColumn *col, gpointer data);
402 if (pdialog->pcity ==
pcity) {
421 cairo_paint_with_alpha(cr, 0.5);
433 GtkWidget *sw, *darea;
435 GtkEventController *controller;
437 sw = gtk_scrolled_window_new();
438 gtk_scrolled_window_set_min_content_width(GTK_SCROLLED_WINDOW(sw),
440 gtk_scrolled_window_set_min_content_height(GTK_SCROLLED_WINDOW(sw),
442 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
443 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
444 gtk_scrolled_window_set_has_frame(GTK_SCROLLED_WINDOW(sw),
FALSE);
446 darea = gtk_drawing_area_new();
448 gtk_drawing_area_set_draw_func(GTK_DRAWING_AREA(darea),
451 controller = GTK_EVENT_CONTROLLER(gtk_gesture_click_new());
452 g_signal_connect(controller,
"pressed",
454 gtk_widget_add_controller(darea, controller);
455 gesture = gtk_gesture_click_new();
456 gtk_gesture_single_set_button(GTK_GESTURE_SINGLE(gesture), 3);
457 controller = GTK_EVENT_CONTROLLER(gesture);
458 g_signal_connect(controller,
"pressed",
460 gtk_widget_add_controller(darea, controller);
461 gtk_scrolled_window_set_child(GTK_SCROLLED_WINDOW(sw), darea);
464 cmap_canvas->
sw = sw;
465 cmap_canvas->
darea = darea;
473 GtkAdjustment *adjust = NULL;
478 adjust = gtk_scrolled_window_get_hadjustment(
479 GTK_SCROLLED_WINDOW(map_canvas_sw));
480 value = (gtk_adjustment_get_lower(adjust)
481 + gtk_adjustment_get_upper(adjust)
482 - gtk_adjustment_get_page_size(adjust)) / 2;
483 gtk_adjustment_set_value(adjust, value);
485 adjust = gtk_scrolled_window_get_vadjustment(
486 GTK_SCROLLED_WINDOW(map_canvas_sw));
487 value = (gtk_adjustment_get_lower(adjust)
488 + gtk_adjustment_get_upper(adjust)
489 - gtk_adjustment_get_page_size(adjust)) / 2;
490 gtk_adjustment_set_value(adjust, value);
523 bool have_present_units = (unit_list_size(
pcity->
tile->
units) > 0);
541 && have_present_units);
554 struct city *pcity_sup, *pcity_pre;
580 gtk_window_present(GTK_WINDOW(pdialog->
shell));
633 GdkModifierType state,
638 if (state & GDK_CONTROL_MASK) {
641 gtk_notebook_prev_page(GTK_NOTEBOOK(pdialog->
notebook));
645 gtk_notebook_next_page(GTK_NOTEBOOK(pdialog->
notebook));
660 double x,
double y, gpointer data)
662 GtkWidget *w = gtk_event_controller_get_widget(GTK_EVENT_CONTROLLER(gesture));
663 struct city_dialog *pdialog = g_object_get_data(G_OBJECT(w),
"pdialog");
664 GtkWidget *p, *label;
667 switch (GPOINTER_TO_UINT(data)) {
669 fc_snprintf(buf,
sizeof(buf),
_(
"Population: %d, Specialists: %d"),
709 p = gtk_popover_new();
711 gtk_widget_set_parent(p, w);
713 label = gtk_label_new(buf);
714 gtk_widget_set_name(label,
"city_label");
715 gtk_widget_set_margin_start(label, 4);
716 gtk_widget_set_margin_end(label, 4);
717 gtk_widget_set_margin_top(label, 4);
718 gtk_widget_set_margin_bottom(label, 4);
720 gtk_popover_set_child(GTK_POPOVER(p), label);
722 gtk_popover_popup(GTK_POPOVER(p));
735 GtkWidget *table, *label;
755 static bool output_label_done;
756 GtkEventController *controller;
758 table = gtk_grid_new();
759 gtk_widget_set_margin_bottom(table, 4);
760 gtk_widget_set_margin_end(table, 4);
761 gtk_widget_set_margin_start(table, 4);
762 gtk_widget_set_margin_top(table, 4);
767 label = gtk_label_new(output_label[i]);
773 gtk_widget_set_margin_bottom(label, 5);
780 gtk_widget_set_margin_top(label, 5);
785 gtk_widget_set_margin_end(label, 5);
786 gtk_widget_set_name(label,
"city_label");
787 gtk_widget_set_halign(label, GTK_ALIGN_START);
788 gtk_widget_set_valign(label, GTK_ALIGN_CENTER);
789 gtk_grid_attach(GTK_GRID(table), label, 0, i, 1, 1);
791 label = gtk_label_new(
"");
796 gtk_widget_set_margin_bottom(label, 5);
802 gtk_widget_set_margin_top(label, 5);
808 g_object_set_data(G_OBJECT(label),
"pdialog", pdialog);
810 controller = GTK_EVENT_CONTROLLER(gtk_gesture_click_new());
811 g_signal_connect(controller,
"pressed",
813 gtk_widget_add_controller(label, controller);
816 gtk_widget_set_name(label,
"city_label");
817 gtk_widget_set_halign(label, GTK_ALIGN_START);
818 gtk_widget_set_valign(label, GTK_ALIGN_CENTER);
820 gtk_grid_attach(GTK_GRID(table), label, 1, i, 1, 1);
830 static GtkCssProvider *emergency_provider = NULL;
832 if (emergency_provider == NULL) {
833 emergency_provider = gtk_css_provider_new();
835 gtk_css_provider_load_from_data(emergency_provider,
837 " color: rgba(255, 0.0, 0.0, 255);\n"
841 gtk_style_context_add_provider_for_display(
843 GTK_STYLE_PROVIDER(emergency_provider),
844 GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
848 gtk_widget_show(table);
859 GtkWidget *grid,
int col,
int row)
863 frame = gtk_frame_new(
_(
"City map"));
866 gtk_grid_attach(GTK_GRID(grid), frame, col, row, 1, 1);
879 GtkCellRenderer *rend;
884 store = gtk_list_store_new(6, G_TYPE_POINTER, GDK_TYPE_PIXBUF,
885 G_TYPE_STRING, G_TYPE_INT, G_TYPE_BOOLEAN,
888 view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
891 g_object_unref(store);
892 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(
view),
FALSE);
893 gtk_widget_set_name(
view,
"small_font");
896 rend = gtk_cell_renderer_pixbuf_new();
897 gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(
view), -1, NULL,
898 rend,
"pixbuf", 1, NULL);
899 rend = gtk_cell_renderer_text_new();
900 gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(
view), -1, NULL,
902 "strikethrough", 4, NULL);
903 rend = gtk_cell_renderer_text_new();
904 g_object_set(rend,
"xalign", 1.0, NULL);
905 gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(
view), -1, NULL,
907 "strikethrough", 4, NULL);
909 gtk_tree_view_set_tooltip_column(GTK_TREE_VIEW(
view), 5);
935 GtkWidget *
page, *bottom;
936 GtkWidget *right, *frame, *table;
938 GtkCellRenderer *rend;
939 GtkListStore *production_store;
941 const char *tab_title =
_(
"_Overview");
948 page = gtk_grid_new();
949 gtk_orientable_set_orientation(GTK_ORIENTABLE(
page),
950 GTK_ORIENTATION_VERTICAL);
951 gtk_widget_set_margin_start(
page, 8);
952 gtk_widget_set_margin_end(
page, 8);
953 gtk_widget_set_margin_top(
page, 8);
954 gtk_widget_set_margin_bottom(
page, 8);
955 label = gtk_label_new_with_mnemonic(tab_title);
956 gtk_notebook_append_page(GTK_NOTEBOOK(pdialog->
notebook),
page, label);
967 middle = gtk_grid_new();
968 gtk_grid_set_column_spacing(GTK_GRID(middle), 6);
969 gtk_grid_attach(GTK_GRID(
page), middle, 0, page_row++, 1, 1);
975 vgrid = gtk_grid_new();
976 gtk_orientable_set_orientation(GTK_ORIENTABLE(vgrid),
977 GTK_ORIENTATION_VERTICAL);
978 gtk_grid_attach(GTK_GRID(middle), vgrid, middle_col++, 0, 1, 1);
982 label = g_object_new(GTK_TYPE_LABEL,
"label",
_(
"Production:"),
983 "xalign", 0.0,
"yalign", 0.5, NULL);
984 gtk_grid_attach(GTK_GRID(vgrid), label, 0, grid_row++, 1, 1);
986 hgrid = gtk_grid_new();
987 gtk_grid_set_column_spacing(GTK_GRID(hgrid), 10);
988 gtk_grid_attach(GTK_GRID(vgrid), hgrid, 0, grid_row++, 1, 1);
990 production_store = gtk_list_store_new(4, GDK_TYPE_PIXBUF, G_TYPE_STRING,
991 G_TYPE_INT, G_TYPE_BOOLEAN);
994 bar = gtk_progress_bar_new();
995 gtk_progress_bar_set_show_text(GTK_PROGRESS_BAR(bar),
TRUE);
997 gtk_grid_attach(GTK_GRID(hgrid), bar, grid_col++, 0, 1, 1);
999 gtk_progress_bar_set_text(GTK_PROGRESS_BAR(bar),
_(
"%d/%d %d turns"));
1002 = gtk_combo_box_new_with_model(GTK_TREE_MODEL(production_store));
1006 g_object_unref(production_store);
1011 rend = gtk_cell_renderer_pixbuf_new();
1014 rend,
"pixbuf", 0, NULL);
1015 g_object_set(rend,
"xalign", 0.0, NULL);
1017 rend = gtk_cell_renderer_text_new();
1020 rend,
"text", 1,
"strikethrough", 3, NULL);
1025 grid_col++, 0, 1, 1);
1029 label = g_object_new(GTK_TYPE_LABEL,
"use-underline",
TRUE,
1030 "mnemonic-widget",
view,
1031 "label",
_(
"I_mprovements:"),
1032 "xalign", 0.0,
"yalign", 0.5, NULL);
1033 gtk_grid_attach(GTK_GRID(vgrid), label, 0, grid_row++, 1, 1);
1035 sw = gtk_scrolled_window_new();
1036 gtk_scrolled_window_set_has_frame(GTK_SCROLLED_WINDOW(sw),
TRUE);
1037 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
1038 GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
1039 gtk_grid_attach(GTK_GRID(vgrid), sw, 0, grid_row++, 1, 1);
1041 gtk_scrolled_window_set_child(GTK_SCROLLED_WINDOW(sw),
view);
1050 bottom = gtk_grid_new();
1051 gtk_grid_set_column_spacing(GTK_GRID(bottom), 6);
1052 gtk_grid_attach(GTK_GRID(
page), bottom, 0, page_row++, 1, 1);
1055 frame = gtk_frame_new(
_(
"Info"));
1056 gtk_grid_attach(GTK_GRID(bottom), frame, bottom_col++, 0, 1, 1);
1060 gtk_widget_set_halign(table, GTK_ALIGN_CENTER);
1061 gtk_widget_set_valign(table, GTK_ALIGN_CENTER);
1062 gtk_frame_set_child(GTK_FRAME(frame), table);
1065 right = gtk_grid_new();
1066 gtk_orientable_set_orientation(GTK_ORIENTABLE(right),
1067 GTK_ORIENTATION_VERTICAL);
1068 gtk_grid_attach(GTK_GRID(bottom), right, bottom_col++, 0, 1, 1);
1072 0, right_row++, 1, 1);
1075 0, right_row++, 1, 1);
1078 sw = gtk_scrolled_window_new();
1079 gtk_widget_set_hexpand(sw,
TRUE);
1080 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
1081 GTK_POLICY_AUTOMATIC, GTK_POLICY_NEVER);
1082 gtk_scrolled_window_set_has_frame(GTK_SCROLLED_WINDOW(sw),
FALSE);
1087 table = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 2);
1088 gtk_widget_set_size_request(table, -1, unit_height);
1089 gtk_scrolled_window_set_child(GTK_SCROLLED_WINDOW(sw), table);
1095 sw = gtk_scrolled_window_new();
1096 gtk_widget_set_hexpand(sw,
TRUE);
1097 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
1098 GTK_POLICY_AUTOMATIC, GTK_POLICY_NEVER);
1099 gtk_scrolled_window_set_has_frame(GTK_SCROLLED_WINDOW(sw),
FALSE);
1102 table = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 2);
1103 gtk_widget_set_size_request(table, -1, unit_height);
1104 gtk_scrolled_window_set_child(GTK_SCROLLED_WINDOW(sw), table);
1110 gtk_widget_show(
page);
1121 const char *tab_title =
_(
"Citymap");
1124 page = gtk_grid_new();
1125 gtk_orientable_set_orientation(GTK_ORIENTABLE(
page),
1126 GTK_ORIENTATION_VERTICAL);
1127 gtk_widget_set_margin_start(
page, 8);
1128 gtk_widget_set_margin_end(
page, 8);
1129 gtk_widget_set_margin_top(
page, 8);
1130 gtk_widget_set_margin_bottom(
page, 8);
1131 label = gtk_label_new_with_mnemonic(tab_title);
1132 gtk_notebook_append_page(GTK_NOTEBOOK(pdialog->
notebook),
page, label);
1136 gtk_widget_show(
page);
1144 const GValue *value,
1145 double x,
double y, gpointer data)
1156 id = g_value_get_int(
value);
1169 GtkWidget *grid,
int row)
1171 GtkWidget *hgrid, *bar;
1174 hgrid = gtk_grid_new();
1175 gtk_widget_set_margin_bottom(hgrid, 2);
1176 gtk_widget_set_margin_end(hgrid, 2);
1177 gtk_widget_set_margin_start(hgrid, 2);
1178 gtk_widget_set_margin_top(hgrid, 2);
1179 gtk_grid_set_column_spacing(GTK_GRID(hgrid), 10);
1180 gtk_grid_attach(GTK_GRID(grid), hgrid, 0, row++, 1, 1);
1183 bar = gtk_progress_bar_new();
1184 gtk_widget_set_hexpand(bar,
TRUE);
1185 gtk_progress_bar_set_show_text(GTK_PROGRESS_BAR(bar),
TRUE);
1187 gtk_grid_attach(GTK_GRID(hgrid), bar, grid_col++, 0, 1, 1);
1188 gtk_progress_bar_set_text(GTK_PROGRESS_BAR(bar),
_(
"%d/%d %d turns"));
1195 grid_col++, 0, 1, 1);
1213 const char *tab_title =
_(
"Buildings");
1217 page = gtk_grid_new();
1218 gtk_orientable_set_orientation(GTK_ORIENTABLE(page),
1219 GTK_ORIENTATION_VERTICAL);
1220 gtk_widget_set_margin_start(page, 8);
1221 gtk_widget_set_margin_end(page, 8);
1222 gtk_widget_set_margin_top(page, 8);
1223 gtk_widget_set_margin_bottom(page, 8);
1224 label = gtk_label_new_with_mnemonic(tab_title);
1227 gtk_notebook_append_page(GTK_NOTEBOOK(pdialog->
notebook), page, label);
1229 vgrid = gtk_grid_new();
1230 gtk_orientable_set_orientation(GTK_ORIENTABLE(vgrid),
1231 GTK_ORIENTATION_VERTICAL);
1232 gtk_grid_attach(GTK_GRID(page), vgrid, 0, page_row++, 1, 1);
1236 gtk_grid_attach(GTK_GRID(vgrid),
view, 0, grid_row++, 1, 1);
1238 gtk_widget_show(page);
1247 const char *tab_title =
_(
"P_roduction");
1248 GtkWidget *label = gtk_label_new_with_mnemonic(tab_title);
1249 GtkWidget *page, *
editor;
1252 page = gtk_grid_new();
1253 gtk_orientable_set_orientation(GTK_ORIENTABLE(page),
1254 GTK_ORIENTATION_VERTICAL);
1255 gtk_widget_set_margin_start(page, 8);
1256 gtk_widget_set_margin_end(page, 8);
1257 gtk_widget_set_margin_top(page, 8);
1258 gtk_widget_set_margin_bottom(page, 8);
1259 gtk_notebook_append_page(GTK_NOTEBOOK(pdialog->
notebook), page, label);
1263 label = g_object_new(GTK_TYPE_LABEL,
1264 "label",
_(
"Production:"),
1265 "xalign", 0.0,
"yalign", 0.5, NULL);
1267 gtk_grid_attach(GTK_GRID(page), label, 0, page_row++, 1, 1);
1275 gtk_widget_set_margin_bottom(
editor, 6);
1276 gtk_widget_set_margin_end(
editor, 6);
1277 gtk_widget_set_margin_start(
editor, 6);
1278 gtk_widget_set_margin_top(
editor, 6);
1280 gtk_grid_attach(GTK_GRID(page),
editor, 0, page_row++, 1, 1);
1283 gtk_widget_show(page);
1298 GtkWidget *page, *label, *table, *right, *left, *frame;
1299 const char *tab_title =
_(
"Happ_iness");
1305 page = gtk_grid_new();
1306 gtk_grid_set_column_spacing(GTK_GRID(page), 6);
1307 gtk_widget_set_margin_start(page, 8);
1308 gtk_widget_set_margin_end(page, 8);
1309 gtk_widget_set_margin_top(page, 8);
1310 gtk_widget_set_margin_bottom(page, 8);
1311 label = gtk_label_new_with_mnemonic(tab_title);
1312 gtk_notebook_append_page(GTK_NOTEBOOK(pdialog->
notebook), page, label);
1315 left = gtk_grid_new();
1316 gtk_orientable_set_orientation(GTK_ORIENTABLE(left),
1317 GTK_ORIENTATION_VERTICAL);
1318 gtk_grid_attach(GTK_GRID(page), left, page_col++, 0, 1, 1);
1322 frame = gtk_frame_new(
_(
"Info"));
1323 gtk_grid_attach(GTK_GRID(left), frame, 0, left_row++, 1, 1);
1327 gtk_widget_set_halign(table, GTK_ALIGN_CENTER);
1328 gtk_frame_set_child(GTK_FRAME(frame), table);
1335 0, left_row++, 1, 1);
1341 right = gtk_grid_new();
1342 gtk_orientable_set_orientation(GTK_ORIENTABLE(right),
1343 GTK_ORIENTATION_VERTICAL);
1344 gtk_grid_attach(GTK_GRID(page), right, page_col++, 0, 1, 1);
1348 frame = gtk_frame_new(
_(
"City map"));
1351 gtk_grid_attach(GTK_GRID(right), frame, 0, right_row++, 1, 1);
1359 gtk_grid_attach(GTK_GRID(right), pdialog->
happiness.
widget, 0, right_row++, 1, 1);
1364 gtk_widget_show(page);
1372 GtkWidget *page, *label;
1373 const char *tab_title =
_(
"_Governor");
1375 page = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
1377 label = gtk_label_new_with_mnemonic(tab_title);
1379 gtk_notebook_append_page(GTK_NOTEBOOK(pdialog->
notebook), page, label);
1384 gtk_widget_show(page);
1393 GtkWidget *vgrid, *page, *frame, *label, *button;
1396 const char *tab_title =
_(
"_Settings");
1399 static const char *new_citizens_output_label[] = {
1405 static const char *disband_label
1406 =
N_(
"Allow unit production to disband city");
1408 static const char *misc_whichtab_label[
NUM_PAGES] = {
1409 N_(
"Overview page"),
1410 N_(
"Production page"),
1411 N_(
"Happiness page"),
1412 N_(
"Governor page"),
1413 N_(
"This Settings page"),
1414 N_(
"Last active page")
1417 static bool new_citizens_label_done;
1418 static bool misc_whichtab_label_done;
1424 page = gtk_grid_new();
1425 gtk_grid_set_column_spacing(GTK_GRID(page), 18);
1426 gtk_widget_set_margin_start(page, 8);
1427 gtk_widget_set_margin_end(page, 8);
1428 gtk_widget_set_margin_top(page, 8);
1429 gtk_widget_set_margin_bottom(page, 8);
1431 size = gtk_size_group_new(GTK_SIZE_GROUP_BOTH);
1433 label = gtk_label_new_with_mnemonic(tab_title);
1435 gtk_notebook_append_page(GTK_NOTEBOOK(pdialog->
notebook), page, label);
1438 frame = gtk_frame_new(
_(
"New citizens produce"));
1439 gtk_grid_attach(GTK_GRID(page), frame, 0, 0, 1, 1);
1440 gtk_size_group_add_widget(
size, frame);
1442 vgrid = gtk_grid_new();
1443 gtk_orientable_set_orientation(GTK_ORIENTABLE(vgrid),
1444 GTK_ORIENTATION_VERTICAL);
1445 gtk_frame_set_child(GTK_FRAME(frame), vgrid);
1448 &new_citizens_label_done);
1451 for (i = 0; i <
ARRAY_SIZE(new_citizens_output_label); i++) {
1452 button = gtk_check_button_new_with_mnemonic(new_citizens_output_label[i]);
1453 gtk_check_button_set_group(GTK_CHECK_BUTTON(button),
1454 GTK_CHECK_BUTTON(group));
1456 gtk_grid_attach(GTK_GRID(vgrid), button, 0, grid_row++, 1, 1);
1457 g_signal_connect(button,
"toggled",
1463 frame = gtk_frame_new(
_(
"Next time open"));
1464 gtk_grid_attach(GTK_GRID(page), frame, 1, 0, 1, 1);
1465 gtk_size_group_add_widget(
size, frame);
1467 vgrid = gtk_grid_new();
1469 gtk_orientable_set_orientation(GTK_ORIENTABLE(vgrid),
1470 GTK_ORIENTATION_VERTICAL);
1471 gtk_frame_set_child(GTK_FRAME(frame), vgrid);
1474 &misc_whichtab_label_done);
1477 for (i = 0; i <
ARRAY_SIZE(misc_whichtab_label); i++) {
1478 button = gtk_check_button_new_with_mnemonic(misc_whichtab_label[i]);
1479 gtk_check_button_set_group(GTK_CHECK_BUTTON(button),
1480 GTK_CHECK_BUTTON(group));
1482 gtk_grid_attach(GTK_GRID(vgrid), button, 0, grid_row++, 1, 1);
1483 g_signal_connect(button,
"toggled",
1489 frame = gtk_frame_new(
_(
"City"));
1490 gtk_widget_set_margin_top(frame, 12);
1491 gtk_widget_set_margin_bottom(frame, 12);
1492 gtk_grid_attach(GTK_GRID(page), frame, 0, 1, 1, 1);
1494 vgrid = gtk_grid_new();
1496 gtk_orientable_set_orientation(GTK_ORIENTABLE(vgrid),
1497 GTK_ORIENTATION_VERTICAL);
1498 gtk_frame_set_child(GTK_FRAME(frame), vgrid);
1500 button = gtk_button_new_with_mnemonic(
_(
"R_ename..."));
1502 gtk_grid_attach(GTK_GRID(vgrid), button, 0, grid_row++, 1, 1);
1503 g_signal_connect(button,
"clicked",
1509 button = gtk_check_button_new_with_mnemonic(
_(disband_label));
1511 gtk_grid_attach(GTK_GRID(vgrid), button, 0, grid_row++, 1, 1);
1512 g_signal_connect(button,
"toggled",
1516 gtk_check_button_set_active(GTK_CHECK_BUTTON
1523 gtk_widget_show(page);
1526 gtk_notebook_set_current_page(GTK_NOTEBOOK(pdialog->
notebook),
1529 gtk_notebook_set_current_page(GTK_NOTEBOOK(pdialog->
notebook),
1545 GtkWidget *close_command;
1546 GtkWidget *vbox, *hbox, *cbox;
1547 int citizen_bar_width;
1548 int citizen_bar_height;
1550 GtkEventController *controller;
1558 pdialog->
pcity = pcity;
1569 = cairo_image_surface_create(CAIRO_FORMAT_ARGB32,
1572 pdialog->
shell = gtk_dialog_new();
1576 g_signal_connect(pdialog->
shell,
"destroy",
1578 gtk_widget_set_name(pdialog->
shell,
"Freeciv");
1580 gtk_widget_realize(pdialog->
shell);
1583#ifndef FREECIV_MSWINDOWS
1585 gtk_window_set_icon_name(GTK_WINDOW(pdialog->
shell),
"citydlg");
1590 gtk_window_set_default_size(GTK_WINDOW(pdialog->
shell),
1596 vbox = gtk_dialog_get_content_area(GTK_DIALOG(pdialog->
shell));
1597 hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 2);
1598 gtk_box_set_homogeneous(GTK_BOX(hbox),
TRUE);
1599 gtk_box_append(GTK_BOX(vbox), hbox);
1602 cbox = gtk_grid_new();
1603 gtk_box_append(GTK_BOX(hbox), cbox);
1608 pdialog->
citizen_surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32,
1610 citizen_bar_height);
1616 gtk_widget_set_margin_bottom(pdialog->
citizen_pics, 2);
1618 citizen_bar_width, citizen_bar_height);
1619 gtk_widget_set_halign(pdialog->
citizen_pics, GTK_ALIGN_START);
1620 gtk_widget_set_valign(pdialog->
citizen_pics, GTK_ALIGN_CENTER);
1621 gtk_grid_attach(GTK_GRID(cbox), pdialog->
citizen_pics, ccol++, 0, 1, 1);
1623 controller = GTK_EVENT_CONTROLLER(gtk_gesture_click_new());
1624 g_signal_connect(controller,
"pressed",
1626 gtk_widget_add_controller(pdialog->
citizen_pics, controller);
1631 gtk_widget_set_halign(pdialog->
name_label, GTK_ALIGN_START);
1632 gtk_widget_set_valign(pdialog->
name_label, GTK_ALIGN_CENTER);
1633 gtk_box_append(GTK_BOX(hbox), pdialog->
name_label);
1637 pdialog->
notebook = gtk_notebook_new();
1638 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(pdialog->
notebook),
1640 gtk_box_append(GTK_BOX(vbox), pdialog->
notebook);
1659 gtk_notebook_set_current_page(GTK_NOTEBOOK(pdialog->
notebook),
1668 gtk_dialog_add_button(GTK_DIALOG(pdialog->
shell),
_(
"_List present units..."),
CDLGR_UNITS);
1670 g_signal_connect(GTK_DIALOG(pdialog->
shell),
"response",
1673 pdialog->
prev_command = gtk_button_new_from_icon_name(
"go-previous");
1674 gtk_dialog_add_action_widget(GTK_DIALOG(pdialog->
shell),
1677 pdialog->
next_command = gtk_button_new_from_icon_name(
"go-next");
1678 gtk_dialog_add_action_widget(GTK_DIALOG(pdialog->
shell),
1686 close_command = gtk_dialog_add_button(GTK_DIALOG(pdialog->
shell),
1687 _(
"_Close"), GTK_RESPONSE_CLOSE);
1689 gtk_dialog_set_default_response(GTK_DIALOG(pdialog->
shell),
1690 GTK_RESPONSE_CLOSE);
1692 g_signal_connect(close_command,
"clicked",
1703 controller = gtk_event_controller_key_new();
1704 g_signal_connect(controller,
"key-pressed",
1706 gtk_widget_add_controller(pdialog->
shell, controller);
1715 gtk_widget_show(pdialog->
shell);
1717 gtk_window_set_focus(GTK_WINDOW(pdialog->
shell), close_command);
1734 buf = g_strdup_printf(
_(
"<b>%s</b> - %s citizens - DISORDER"),
1739 buf = g_strdup_printf(
_(
"<b>%s</b> - %s citizens - celebrating"),
1744 buf = g_strdup_printf(
_(
"<b>%s</b> - %s citizens - happy"),
1749 buf = g_strdup_printf(
_(
"<b>%s</b> - %s citizens"),
1754 now = gtk_label_get_text(GTK_LABEL(pdialog->
name_label));
1755 if (strcmp(now, buf) != 0) {
1757 gtk_label_set_markup(GTK_LABEL(pdialog->
name_label), buf);
1769 int i,
width, full_width, total_used_width;
1770 int citizen_bar_width, citizen_bar_height;
1781 if (num_citizens > 1) {
1783 / (num_citizens - 1));
1796 for (i = 0; i < num_citizens; i++) {
1797 cairo_set_source_surface(cr,
1800 cairo_rectangle(cr, i *
width, 0,
1802 i + 1 < num_citizens ?
width : full_width,
1803 citizen_bar_height);
1807 total_used_width = (i - 1) *
width + full_width;
1809 if (total_used_width < citizen_bar_width) {
1814 cairo_rectangle(cr, total_used_width, 0,
1815 citizen_bar_width - total_used_width,
1816 citizen_bar_height);
1817 cairo_set_operator(cr, CAIRO_OPERATOR_CLEAR);
1844 pcity->
size, non_workers);
1866 if (granaryturns == 0) {
1877 PL_(
"%d turn",
"%d turns", abs(granaryturns)),
1907 gtk_label_set_text(GTK_LABEL(
info_label[i]), buf[i]);
1916 if (granaryturns > -4 && granaryturns < 0) {
1970 char buf[32], buf2[200];
1972 GtkListStore *store;
1976 int targets_used,
item;
1994 if (build_slots > 1) {
1997 PL_(
"Production (up to %d unit per turn):",
1998 "Production (up to %d units per turn):", build_slots),
2013 pct = CLAMP(pct, 0.0, 1.0);
2019 fc_snprintf(buf2,
sizeof(buf2),
"%s%s\n%s", descr,
2021 gtk_progress_bar_set_text(
2023 gtk_progress_bar_set_fraction(
2028 fc_snprintf(buf2,
sizeof(buf2),
"%s%s: %s", descr,
2030 gtk_progress_bar_set_text(
2032 gtk_progress_bar_set_fraction(
2037 if (store != NULL) {
2046 gtk_list_store_clear(store);
2060 if (VUT_UTYPE == target->
kind) {
2063 direction8_invalid());
2071 gtk_list_store_append(store, &iter);
2072 gtk_list_store_set(store, &iter, 0, pix,
2073 1,
name, 3, useless,
2075 g_object_unref(G_OBJECT(pix));
2097 int item, targets_used;
2100 GtkTreeModel *model;
2101 GtkListStore *store;
2103 const char *tooltip_sellable =
_(
"Press <b>ENTER</b> or double-click to "
2104 "sell an improvement.");
2105 const char *tooltip_great_wonder =
_(
"Great Wonder - cannot be sold.");
2106 const char *tooltip_small_wonder =
_(
"Small Wonder - cannot be sold.");
2110 store = GTK_LIST_STORE(model);
2115 gtk_list_store_clear(store);
2130 gtk_list_store_append(store, &it);
2131 gtk_list_store_set(store, &it,
2141 tooltip_great_wonder :
2143 tooltip_small_wonder : tooltip_sellable),
2145 g_object_unref(G_OBJECT(pix));
2154 struct unit_list *units;
2155 struct unit_node_vector *nodes;
2170 n = unit_list_size(units);
2171 m = unit_node_vector_size(nodes);
2182 unit_node_vector_reserve(nodes,
n);
2184 for (i = m; i <
n; i++) {
2185 GtkWidget *cmd, *pix;
2188 cmd = gtk_button_new();
2191 gtk_button_set_has_frame(GTK_BUTTON(
cmd),
FALSE);
2193 pix = gtk_picture_new();
2197 gtk_button_set_child(GTK_BUTTON(
cmd),
pix);
2206 unit_node_vector_append(nodes, node);
2215 pnode = unit_node_vector_get(nodes, i);
2218 GtkGesture *gesture;
2219 GtkEventController *controller;
2227 if (pnode->
left != NULL) {
2228 gtk_widget_remove_controller(
cmd, pnode->
left);
2229 gtk_widget_remove_controller(
cmd, pnode->
middle);
2230 gtk_widget_remove_controller(
cmd, pnode->
right);
2235 controller = GTK_EVENT_CONTROLLER(gtk_gesture_click_new());
2236 g_signal_connect(controller,
"pressed",
2239 gtk_widget_add_controller(
cmd, controller);
2240 pnode->
left = controller;
2241 gesture = gtk_gesture_click_new();
2242 gtk_gesture_single_set_button(GTK_GESTURE_SINGLE(gesture), 2);
2243 controller = GTK_EVENT_CONTROLLER(gesture);
2244 g_signal_connect(controller,
"released",
2247 gtk_widget_add_controller(
cmd, controller);
2248 pnode->
middle = controller;
2249 gesture = gtk_gesture_click_new();
2250 gtk_gesture_single_set_button(GTK_GESTURE_SINGLE(gesture), 3);
2251 controller = GTK_EVENT_CONTROLLER(gesture);
2252 g_signal_connect(controller,
"released",
2255 gtk_widget_add_controller(
cmd, controller);
2256 pnode->
right = controller;
2259 gtk_widget_set_sensitive(
cmd,
FALSE);
2261 gtk_widget_set_sensitive(
cmd,
TRUE);
2264 gtk_widget_show(
pix);
2265 gtk_widget_show(
cmd);
2270 buf = g_strdup_printf(
_(
"Supported units %d"),
n);
2280 struct unit_list *units;
2281 struct unit_node_vector *nodes;
2294 n = unit_list_size(units);
2295 m = unit_node_vector_size(nodes);
2306 unit_node_vector_reserve(nodes,
n);
2308 for (i = m; i <
n; i++) {
2309 GtkWidget *cmd, *pix;
2312 cmd = gtk_button_new();
2315 gtk_button_set_has_frame(GTK_BUTTON(
cmd),
FALSE);
2317 pix = gtk_picture_new();
2321 gtk_button_set_child(GTK_BUTTON(
cmd),
pix);
2330 unit_node_vector_append(nodes, node);
2338 pnode = unit_node_vector_get(nodes, i);
2341 GtkEventController *controller;
2342 GtkGesture *gesture;
2349 if (pnode->
left != NULL) {
2350 gtk_widget_remove_controller(
cmd, pnode->
left);
2351 gtk_widget_remove_controller(
cmd, pnode->
middle);
2352 gtk_widget_remove_controller(
cmd, pnode->
right);
2357 controller = GTK_EVENT_CONTROLLER(gtk_gesture_click_new());
2358 g_signal_connect(controller,
"pressed",
2361 gtk_widget_add_controller(
cmd, controller);
2362 pnode->
left = controller;
2363 gesture = gtk_gesture_click_new();
2364 gtk_gesture_single_set_button(GTK_GESTURE_SINGLE(gesture), 2);
2365 controller = GTK_EVENT_CONTROLLER(gesture);
2366 g_signal_connect(controller,
"released",
2369 gtk_widget_add_controller(
cmd, controller);
2370 pnode->
middle = controller;
2371 gesture = gtk_gesture_click_new();
2372 gtk_gesture_single_set_button(GTK_GESTURE_SINGLE(gesture), 3);
2373 controller = GTK_EVENT_CONTROLLER(gesture);
2374 g_signal_connect(controller,
"released",
2377 gtk_widget_add_controller(
cmd, controller);
2378 pnode->
right = controller;
2381 gtk_widget_set_sensitive(
cmd,
FALSE);
2383 gtk_widget_set_sensitive(
cmd,
TRUE);
2386 gtk_widget_show(
pix);
2387 gtk_widget_show(
cmd);
2392 buf = g_strdup_printf(
_(
"Present units %d"),
n);
2422 if (count == city_number) {
2424 gtk_widget_set_sensitive(GTK_WIDGET(pdialog->prev_command),
FALSE);
2425 gtk_widget_set_sensitive(GTK_WIDGET(pdialog->next_command),
FALSE);
2430 gtk_widget_set_sensitive(GTK_WIDGET(pdialog->prev_command),
TRUE);
2431 gtk_widget_set_sensitive(GTK_WIDGET(pdialog->next_command),
TRUE);
2458 if (unit_list_size(ptile->
units)) {
2474 GtkWidget *wdg,
bool supported)
2477 GActionGroup *group;
2484 if (pdialog->
popover != NULL) {
2488 group = G_ACTION_GROUP(g_simple_action_group_new());
2489 menu = g_menu_new();
2492 act = g_simple_action_new(
"center", NULL);
2493 g_object_set_data(G_OBJECT(act),
"dlg", pdialog);
2494 g_action_map_add_action(G_ACTION_MAP(group), G_ACTION(act));
2500 act = g_simple_action_new(
"activate", NULL);
2501 g_object_set_data(G_OBJECT(act),
"dlg", pdialog);
2502 g_action_map_add_action(G_ACTION_MAP(group), G_ACTION(act));
2508 act = g_simple_action_new(
"activate_close", NULL);
2509 g_object_set_data(G_OBJECT(act),
"dlg", pdialog);
2510 g_action_map_add_action(G_ACTION_MAP(group), G_ACTION(act));
2513 g_signal_connect(act,
"activate",
2517 g_signal_connect(act,
"activate",
2523 g_menu_item_new(
_(
"Activate unit, _close dialog"),
2524 "win.activate_close"));
2527 act = g_simple_action_new(
"load", NULL);
2528 g_object_set_data(G_OBJECT(act),
"dlg", pdialog);
2529 g_action_map_add_action(G_ACTION_MAP(group), G_ACTION(act));
2535 act = g_simple_action_new(
"unload", NULL);
2536 g_object_set_data(G_OBJECT(act),
"dlg", pdialog);
2537 g_action_map_add_action(G_ACTION_MAP(group), G_ACTION(act));
2540 g_simple_action_set_enabled(G_SIMPLE_ACTION(act),
2548 act = g_simple_action_new(
"sentry", NULL);
2549 g_object_set_data(G_OBJECT(act),
"dlg", pdialog);
2550 g_action_map_add_action(G_ACTION_MAP(group), G_ACTION(act));
2553 g_simple_action_set_enabled(G_SIMPLE_ACTION(act),
2560 act = g_simple_action_new(
"fortify", NULL);
2561 g_object_set_data(G_OBJECT(act),
"dlg", pdialog);
2562 g_action_map_add_action(G_ACTION_MAP(group), G_ACTION(act));
2565 g_simple_action_set_enabled(G_SIMPLE_ACTION(act),
2568 ACTIVITY_FORTIFYING));
2573 act = g_simple_action_new(
"disband", NULL);
2574 g_object_set_data(G_OBJECT(act),
"dlg", pdialog);
2575 g_action_map_add_action(G_ACTION_MAP(group), G_ACTION(act));
2578 g_simple_action_set_enabled(G_SIMPLE_ACTION(act),
2584 act = g_simple_action_new(
"rehome", NULL);
2585 g_object_set_data(G_OBJECT(act),
"dlg", pdialog);
2586 g_action_map_add_action(G_ACTION_MAP(group), G_ACTION(act));
2589 g_simple_action_set_enabled(G_SIMPLE_ACTION(act),
2596 act = g_simple_action_new(
"upgrade", NULL);
2597 g_object_set_data(G_OBJECT(act),
"dlg", pdialog);
2598 g_action_map_add_action(G_ACTION_MAP(group), G_ACTION(act));
2601 g_simple_action_set_enabled(G_SIMPLE_ACTION(act),
2611 pdialog->
popover = gtk_popover_menu_new_from_model(G_MENU_MODEL(menu));
2612 g_object_ref(pdialog->
popover);
2613 gtk_widget_insert_action_group(pdialog->
popover,
"win", group);
2614 gtk_widget_set_parent(pdialog->
popover, wdg);
2617 gtk_popover_popup(GTK_POPOVER(pdialog->
popover));
2626 double x,
double y, gpointer data)
2638 gtk_event_controller_get_widget(GTK_EVENT_CONTROLLER(gesture)),
2649 double x,
double y, gpointer data)
2661 gtk_event_controller_get_widget(GTK_EVENT_CONTROLLER(gesture)),
2673 int n_press,
double x,
double y,
2697 double x,
double y, gpointer data)
2719 double x,
double y, gpointer data)
2739 if (pdialog->
popover != NULL) {
2740 gtk_widget_unparent(pdialog->
popover);
2741 g_object_unref(pdialog->
popover);
2755 if (NULL !=
punit) {
2771 if (NULL !=
punit) {
2783 GVariant *parameter,
2789 if (NULL !=
punit) {
2790 struct city *pcity =
2794 if (NULL != pcity) {
2797 if (NULL != pdialog) {
2811 GVariant *parameter,
2817 if (NULL !=
punit) {
2821 if (NULL != pcity) {
2824 if (NULL != pdialog) {
2842 if (NULL !=
punit) {
2858 if (NULL !=
punit) {
2874 if (NULL !=
punit) {
2890 if (NULL !=
punit) {
2903 struct unit_list *punits;
2907 if (NULL ==
punit) {
2911 punits = unit_list_new();
2912 unit_list_append(punits,
punit);
2914 unit_list_destroy(punits);
2929 if (NULL !=
punit) {
2942 struct unit_list *punits;
2946 if (NULL ==
punit) {
2950 punits = unit_list_new();
2951 unit_list_append(punits,
punit);
2953 unit_list_destroy(punits);
2965 double x,
double y, gpointer data)
2969 int citnum, tlen,
len;
2994 enum unit_activity act = (
enum unit_activity)GPOINTER_TO_INT(data);
3002 if (act == ACTIVITY_LAST) {
3021 if ((act != ACTIVITY_TRANSFORM
3024 && (act != ACTIVITY_PLANT || pterr->
plant_result == NULL)) {
3062 .value = { .terrain = pterr }};
3070 _(
"What Action to Request"),
3071 _(
"Select autosettler activity:"));
3073 ptask = worker_task_list_get(pcity->
task_reqs, 0);
3074 if (ptask != NULL) {
3077 GINT_TO_POINTER(ACTIVITY_LAST),
FALSE, NULL);
3083 GINT_TO_POINTER(ACTIVITY_MINE),
FALSE, NULL);
3090 GINT_TO_POINTER(ACTIVITY_PLANT),
FALSE, NULL);
3095 GINT_TO_POINTER(ACTIVITY_IRRIGATE),
FALSE, NULL);
3102 GINT_TO_POINTER(ACTIVITY_CULTIVATE),
FALSE, NULL);
3107 GINT_TO_POINTER(ACTIVITY_GEN_ROAD),
FALSE, NULL);
3114 GINT_TO_POINTER(ACTIVITY_TRANSFORM),
FALSE, NULL);
3120 GINT_TO_POINTER(ACTIVITY_POLLUTION),
FALSE, NULL);
3126 GINT_TO_POINTER(ACTIVITY_FALLOUT),
FALSE, NULL);
3141 double x,
double y, gpointer data)
3170 double x,
double y, gpointer data)
3216 if (response == GTK_RESPONSE_YES) {
3220 gtk_window_destroy(GTK_WINDOW(w));
3239 "Treasury contains %d gold.",
3244 shell = gtk_message_dialog_new(NULL,
3245 GTK_DIALOG_DESTROY_WITH_PARENT,
3246 GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO,
3248 PL_(
"Buy %s for %d gold?\n%s",
3249 "Buy %s for %d gold?\n%s", value),
3252 gtk_window_set_title(GTK_WINDOW(
shell),
_(
"Buy It!"));
3253 gtk_dialog_set_default_response(GTK_DIALOG(
shell), GTK_RESPONSE_NO);
3256 gtk_window_present(GTK_WINDOW(
shell));
3258 shell = gtk_message_dialog_new(NULL,
3259 GTK_DIALOG_DESTROY_WITH_PARENT,
3260 GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE,
3262 PL_(
"%s costs %d gold.\n%s",
3263 "%s costs %d gold.\n%s", value),
3266 gtk_window_set_title(GTK_WINDOW(
shell),
_(
"Buy It!"));
3267 g_signal_connect(
shell,
"response", G_CALLBACK(gtk_window_destroy),
3269 gtk_window_present(GTK_WINDOW(
shell));
3282 && gtk_combo_box_get_active_iter(combo, &iter)) {
3286 gtk_tree_model_get(gtk_combo_box_get_model(combo), &iter, 2, &
id, -1);
3312 shl = gtk_message_dialog_new(NULL,
3313 GTK_DIALOG_DESTROY_WITH_PARENT,
3314 GTK_MESSAGE_QUESTION,
3316 PL_(
"Sell %s for %d gold?",
3317 "Sell %s for %d gold?", price),
3322 gtk_window_set_title(GTK_WINDOW(shl),
_(
"Sell It!"));
3324 g_signal_connect(shl,
"response",
3327 gtk_window_present(GTK_WINDOW(shl));
3337 if (response == GTK_RESPONSE_YES) {
3340 gtk_window_destroy(GTK_WINDOW(w));
3349 GtkTreeViewColumn *col, gpointer data)
3351 GtkTreeModel *model;
3354 GdkModifierType mask;
3357 model = gtk_tree_view_get_model(
view);
3359 if (!gtk_tree_model_get_iter(model, &it, path)) {
3363 gtk_tree_model_get(model, &it, 0, &pimprove, -1);
3365 seat = gdk_display_get_default_seat(gtk_widget_get_display(GTK_WIDGET(
view)));
3366 mask = gdk_device_get_modifier_state(gdk_seat_get_keyboard(seat));
3368 if (!(mask & GDK_CONTROL_MASK)) {
3393 _(
"What should we rename the city to?"),
3407 if (response == GTK_RESPONSE_OK) {
3436 bv_city_options new_options;
3442 BV_SET(new_options, CITYO_DISBAND);
3445 BV_SET(new_options, CITYO_SCIENCE_SPECIALISTS);
3448 BV_SET(new_options, CITYO_GOLD_SPECIALISTS);
3469 gtk_check_button_set_active(GTK_CHECK_BUTTON
3472 gtk_check_button_set_active(GTK_CHECK_BUTTON
3475 gtk_check_button_set_active(GTK_CHECK_BUTTON
3500 gtk_widget_hide(pdialog->
shell);
3511 gtk_widget_get_allocated_width(pdialog->
shell),
3515 gtk_widget_get_allocated_height(pdialog->
shell),
3519 = gtk_notebook_get_current_page(GTK_NOTEBOOK(pdialog->
notebook));
3528 gtk_window_destroy(GTK_WINDOW(pdialog->
sell_shell));
3548 gtk_window_destroy(GTK_WINDOW(pdialog->
shell));
3558 int i, j, dir,
size;
3559 struct city *new_pcity = NULL;
3587 for (i = 0; i <
size; i++) {
3595 for (j = 1; j <
size; j++) {
3601 if (!other_pdialog) {
3602 new_pcity = other_pcity;
3618 pdialog->
pcity = new_pcity;
const char * action_id_name_translation(action_id act_id)
bool action_ever_possible(action_id action)
#define action_id_univs_not_blocking(act_id, act_uni, tgt_uni)
struct canvas int int struct sprite int int int int height
struct canvas int int canvas_y
struct canvas int canvas_x
struct canvas int int struct sprite int int int width
void output_window_append(const struct ft_color color, const char *featured_text)
const char * city_improvement_name_translation(const struct city *pcity, const struct impr_type *pimprove)
int city_production_build_shield_cost(const struct city *pcity)
int city_granary_size(int city_size)
int city_build_slots(const struct city *pcity)
struct tile * city_map_to_tile(const struct civ_map *nmap, const struct tile *city_center, int city_radius_sq, int city_map_x, int city_map_y)
const char * city_name_get(const struct city *pcity)
int city_improvement_upkeep(const struct city *pcity, const struct impr_type *b)
bool is_city_option_set(const struct city *pcity, enum city_options option)
int city_population(const struct city *pcity)
int city_unit_unhappiness(const struct civ_map *nmap, struct unit *punit, int *free_unhappy)
bool city_unhappy(const struct city *pcity)
bool city_celebrating(const struct city *pcity)
int city_illness_calc(const struct city *pcity, int *ill_base, int *ill_size, int *ill_trade, int *ill_pollution)
bool city_happy(const struct city *pcity)
int city_map_radius_sq_get(const struct city *pcity)
citizens city_specialists(const struct city *pcity)
bool can_city_build_now(const struct civ_map *nmap, const struct city *pcity, const struct universal *target)
int city_turns_to_grow(const struct city *pcity)
const char * city_production_name_translation(const struct city *pcity)
static citizens city_size_get(const struct city *pcity)
#define city_owner(_pcity_)
void get_city_dialog_output_text(const struct city *pcity, Output_type_id otype, char *buf, size_t bufsz)
void get_city_dialog_production(struct city *pcity, char *buffer, size_t buffer_len)
int city_rename(struct city *pcity, const char *name)
int get_city_citizen_types(struct city *pcity, enum citizen_feeling idx, enum citizen_category *categories)
int city_buy_production(struct city *pcity)
int city_toggle_worker(struct city *pcity, int city_x, int city_y)
void get_city_dialog_airlift_text(const struct city *pcity, char *buf, size_t bufsz)
int city_change_production(struct city *pcity, struct universal *target)
void city_rotate_specialist(struct city *pcity, int citizen_index)
int get_citydlg_canvas_width(void)
bool canvas_to_city_pos(int *city_x, int *city_y, int city_radius_sq, int canvas_x, int canvas_y)
void get_city_dialog_airlift_value(const struct city *pcity, char *buf, size_t bufsz)
void city_dialog_redraw_map(struct city *pcity, struct canvas *pcanvas)
int city_sell_improvement(struct city *pcity, Impr_type_id sell_id)
void get_city_dialog_pollution_text(const struct city *pcity, char *buf, size_t bufsz)
void get_city_dialog_culture_text(const struct city *pcity, char *buf, size_t bufsz)
bool city_can_buy(const struct city *pcity)
int get_citydlg_canvas_height(void)
void get_city_dialog_illness_text(const struct city *pcity, char *buf, size_t bufsz)
void city_report_dialog_update_city(struct city *pcity)
bool client_is_global_observer(void)
bool client_is_observer(void)
bool can_client_issue_orders(void)
bool client_has_player(void)
int collect_eventually_buildable_targets(struct universal *targets, struct city *pcity, bool advanced_tech)
void name_and_sort_items(struct universal *targets, int num_targets, struct item *items, bool show_cost, struct city *pcity)
cid cid_encode(struct universal target)
int collect_already_built_targets(struct universal *targets, struct city *pcity)
#define MAX_NUM_PRODUCTION_TARGETS
bool cma_is_city_under_agent(const struct city *pcity, struct cm_parameter *parameter)
void request_unit_fortify(struct unit *punit)
void unit_focus_set(struct unit *punit)
void request_unit_change_homecity(struct unit *punit)
void request_unit_unload(struct unit *pcargo)
void request_unit_sentry(struct unit *punit)
#define can_unit_do_activity_client(_punit_, _act_)
struct unit struct city struct unit struct tile struct extra_type const struct act_prob *act_probs int actor_unit_id struct unit struct unit * punit
struct unit struct city struct unit struct tile struct extra_type const struct act_prob *act_probs int actor_unit_id struct unit struct unit int cost
static struct editor_state * editor
int get_city_bonus(const struct city *pcity, enum effect_type effect_type)
#define PL_(String1, String2, n)
const struct ft_color ftc_client
const char * population_to_text(int thousand_citizen)
struct city * game_city_by_number(int id)
#define FC_STATIC_CANVAS_INIT
GtkWidget * choice_dialog_start(GtkWindow *parent, const gchar *name, const gchar *text)
void choice_dialog_end(GtkWidget *dshell)
void choice_dialog_add(GtkWidget *dshell, const gchar *label, GCallback handler, gpointer data, bool meta, const gchar *tool_tip)
GtkWidget * citizens_dialog_display(const struct city *pcity)
void citizens_dialog_refresh(const struct city *pcity)
void citizens_dialog_close(const struct city *pcity)
static void unit_sentry_callback(GtkWidget *w, gpointer data)
static int new_dialog_def_page
static void create_and_append_buildings_page(struct city_dialog *pdialog)
static void unit_upgrade_callback(GtkWidget *w, gpointer data)
static void popup_workertask_dlg(struct city *pcity, struct tile *ptile)
static void city_dialog_update_citizens(struct city_dialog *pdialog)
static void city_destroy_callback(GtkWidget *w, gpointer data)
static void city_dialog_update_title(struct city_dialog *pdialog)
static void init_citydlg_dimensions(void)
static void create_and_append_worklist_page(struct city_dialog *pdialog)
#define CITY_MAP_MIN_SIZE_X
void real_city_dialog_popup(struct city *pcity)
static void misc_whichtab_callback(GtkWidget *w, gpointer data)
bool city_dialog_is_open(struct city *pcity)
static void city_dialog_update_building(struct city_dialog *pdialog)
static void citydlg_response_callback(GtkDialog *dlg, gint response, void *data)
static void buy_callback_response(GtkWidget *w, gint response, gpointer data)
void real_city_dialog_refresh(struct city *pcity)
static void unit_center_callback(GtkWidget *w, gpointer data)
static struct city_dialog * get_city_dialog(struct city *pcity)
#define CITY_MAP_MIN_SIZE_Y
static void city_dialog_update_information(GtkWidget **info_ebox, GtkWidget **info_label, struct city_dialog *pdialog)
static GtkWidget * create_citydlg_improvement_list(struct city_dialog *pdialog, GtkWidget *vbox)
static void create_production_header(struct city_dialog *pdialog, GtkContainer *contain)
static void workertask_dlg_destroy(GtkWidget *w, gpointer data)
static void city_dialog_update_present_units(struct city_dialog *pdialog)
static gboolean citizens_callback(GtkWidget *w, GdkEventButton *ev, gpointer data)
static void change_production_callback(GtkComboBox *combo, struct city_dialog *pdialog)
static void unit_load_callback(GtkWidget *w, gpointer data)
static void set_cityopt_values(struct city_dialog *pdialog)
static void close_city_dialog(struct city_dialog *pdialog)
static gboolean show_info_popup(GtkWidget *w, GdkEventButton *ev, gpointer data)
static void create_and_append_overview_page(struct city_dialog *pdialog)
static void create_and_append_happiness_page(struct city_dialog *pdialog)
void popdown_all_city_dialogs(void)
static void buy_callback(GtkWidget *w, gpointer data)
#define dialog_list_iterate_end
static void impr_callback(GtkTreeView *view, GtkTreePath *path, GtkTreeViewColumn *col, gpointer data)
static void create_and_append_map_page(struct city_dialog *pdialog)
static void city_dialog_map_create(struct city_dialog *pdialog, struct city_map_canvas *cmap_canvas)
void refresh_unit_city_dialogs(struct unit *punit)
void reset_city_dialogs(void)
static void cityopt_callback(GtkWidget *w, gpointer data)
static void city_dialog_map_recenter(GtkWidget *map_canvas_sw)
static void draw_map_canvas(struct city_dialog *pdialog)
static bool is_showing_workertask_dialog
#define unit_node_vector_iterate_end
static void sell_callback(struct impr_type *pimprove, gpointer data)
#define dialog_list_iterate(dialoglist, pdialog)
static void supported_unit_activate_close_callback(GtkWidget *w, gpointer data)
static void city_dialog_update_prev_next(void)
static void create_and_append_settings_page(struct city_dialog *pdialog)
static bool city_dialogs_have_been_initialised
static void close_callback(GtkWidget *w, gpointer data)
static struct dialog_list * dialog_list
static void sell_callback_response(GtkWidget *w, gint response, gpointer data)
static void create_citydlg_main_map(struct city_dialog *pdialog, GtkWidget *container)
#define NUM_CITIZENS_SHOWN
static void unit_homecity_callback(GtkWidget *w, gpointer data)
static void unit_fortify_callback(GtkWidget *w, gpointer data)
static gboolean present_unit_callback(GtkWidget *w, GdkEventButton *ev, gpointer data)
static GtkWidget * create_city_info_table(struct city_dialog *pdialog, GtkWidget **info_ebox, GtkWidget **info_label)
static struct city_dialog * create_city_dialog(struct city *pcity)
static void target_drag_data_received(GtkWidget *w, GdkDragContext *context, gint x, gint y, GtkSelectionData *data, guint info, guint time, gpointer user_data)
static void unit_disband_callback(GtkWidget *w, gpointer data)
#define unit_node_vector_iterate(list, elt)
static void rename_callback(GtkWidget *w, gpointer data)
static void switch_city_callback(GtkWidget *w, gpointer data)
static void city_dialog_update_map(struct city_dialog *pdialog)
static void unit_unload_callback(GtkWidget *w, gpointer data)
static void show_units_response(void *data)
static void initialize_city_dialogs(void)
#define TINYSCREEN_MAX_HEIGHT
static void city_dialog_update_supported_units(struct city_dialog *pdialog)
static void unit_activate_callback(GtkWidget *w, gpointer data)
static void present_unit_activate_close_callback(GtkWidget *w, gpointer data)
static void set_city_workertask(GtkWidget *w, gpointer data)
static void rename_popup_callback(gpointer data, gint response, const char *input)
static void city_dialog_update_improvement_list(struct city_dialog *pdialog)
static void create_and_append_cma_page(struct city_dialog *pdialog)
void popdown_city_dialog(struct city *pcity)
static struct @139 workertask_req
static gboolean supported_unit_callback(GtkWidget *w, GdkEventButton *ev, gpointer data)
void close_cma_dialog(struct city *pcity)
struct cma_dialog * create_cma_dialog(struct city *pcity, bool tiny)
void refresh_cma_dialog(struct city *pcity, enum cma_refresh refresh)
void unit_select_dialog_popup(struct tile *ptile)
void popup_upgrade_dialog(struct unit_list *punits)
void popup_disband_dialog(struct unit_list *punits)
#define GUI_GTK_OPTION(optname)
void setup_dialog(GtkWidget *shell, GtkWidget *parent)
void intl_slist(int n, const char **s, bool *done)
void close_happiness_dialog(struct city *pcity)
void refresh_happiness_dialog(struct city *pcity)
GtkWidget * get_top_happiness_display(struct city *pcity, bool low_dlg, GtkWidget *win)
void popup_help_dialog_typed(const char *item, enum help_page_type htype)
static struct gui_dialog * shell
GdkPixbuf * sprite_get_pixbuf(struct sprite *sprite)
bool request_transport(struct unit *cargo, struct tile *ptile)
void refresh_worklist(GtkWidget *editor)
void add_worklist_dnd_target(GtkWidget *w)
void reset_city_worklist(GtkWidget *editor, struct city *pcity)
GtkWidget * create_worklist(void)
GtkWidget * icon_label_button_new(const gchar *icon_name, const gchar *label_text)
void refresh_all_city_worklists(void)
static void canvas_draw_cb(GtkDrawingArea *w, cairo_t *cr, int width, int height, gpointer data)
static gboolean right_button_down_citymap(GtkGestureClick *gesture, int n_press, double x, double y, gpointer data)
static gboolean middle_present_unit_release(GtkGestureClick *gesture, int n_press, double x, double y, gpointer data)
static bool create_unit_menu(struct city_dialog *pdialog, struct unit *punit, GtkWidget *wdg, bool supported)
static gboolean right_unit_release(GtkGestureClick *gesture, int n_press, double x, double y, gpointer data)
static gboolean left_button_down_citymap(GtkGestureClick *gesture, int n_press, double x, double y, gpointer data)
static void close_citydlg_unit_popover(struct city_dialog *pdialog)
static gboolean middle_supported_unit_release(GtkGestureClick *gesture, int n_press, double x, double y, gpointer data)
static gboolean citydlg_keyboard_handler(GtkEventControllerKey *controller, guint keyval, guint keycode, GdkModifierType state, gpointer data)
#define menu_item_append_unref(menu, item)
void put_unit_picture_city_overlays(struct unit *punit, GtkPicture *p, int height, int *upkeep_cost, int happy_cost)
void put_unit_picture(struct unit *punit, GtkPicture *p, int height)
void picture_set_from_surface(GtkPicture *pic, cairo_surface_t *surf)
int impr_sell_gold(const struct impr_type *pimprove)
enum test_result test_player_sell_building_now(struct player *pplayer, struct city *pcity, const struct impr_type *pimprove)
bool is_improvement_redundant(const struct city *pcity, const struct impr_type *pimprove)
Impr_type_id improvement_number(const struct impr_type *pimprove)
bool is_great_wonder(const struct impr_type *pimprove)
const char * improvement_name_translation(const struct impr_type *pimprove)
bool is_small_wonder(const struct impr_type *pimprove)
#define fc_assert_ret(condition)
#define fc_assert(condition)
#define fc_assert_action(condition, action)
#define log_debug(message,...)
void center_tile_mapcanvas(const struct tile *ptile)
bool can_unit_exist_at_tile(const struct civ_map *nmap, const struct unit *punit, const struct tile *ptile)
bool unit_can_load(const struct unit *punit)
#define GUI_GTK4_CITYDLG_MAX_XSIZE
#define GUI_GTK4_CITYDLG_MIN_XSIZE
int send_packet_worker_task(struct connection *pc, const struct packet_worker_task *packet)
int dsend_packet_city_options_req(struct connection *pc, int city_id16, int city_id32, bv_city_options options)
struct unit * player_unit_by_number(const struct player *pplayer, int unit_id)
struct city * player_city_by_number(const struct player *pplayer, int city_id)
void economy_report_dialog_update(void)
bool are_universals_equal(const struct universal *psource1, const struct universal *psource2)
#define CLIP(lower, current, upper)
cairo_surface_t * surface
GtkWidget * rename_command
GtkWidget * production_bar
GtkWidget * supported_units_frame
GtkWidget * production_label
struct city_dialog::@143 misc
GtkWidget * supported_unit_table
GtkWidget * disband_on_settler
enum city_dialog::@211 page
struct city_map_canvas map_canvas
GtkWidget * improvement_list
GtkWidget * whichtab_radio[NUM_PAGES]
struct unit_node_vector supported_units
cairo_surface_t * map_canvas_store_unscaled
struct unit_node_vector present_units
struct city_dialog::@142 happiness
struct city_dialog::@141 production
GtkWidget * show_units_command
GtkWidget * production_combo
struct city_dialog::@140 overview
struct cma_dialog * cma_editor
cairo_surface_t * citizen_surface
GtkWidget * present_units_frame
GtkWidget * info_label[NUM_INFO_FIELDS]
GtkWidget * new_citizens_radio[3]
GtkListStore * change_production_store
GtkWidget * present_unit_table
GtkTreeSelection * change_selection
struct worker_task_list * task_reqs
struct unit_list * info_units_present
struct unit_list * info_units_supported
struct universal production
struct unit_list * units_supported
struct city::@17::@20 client
struct packet_game_info info
char descr[MAX_LEN_NAME+40]
enum unit_activity activity
struct city_list * cities
struct terrain * cultivate_result
struct terrain * plant_result
struct terrain * transform_result
GtkEventController * middle
GtkEventController * left
GtkEventController * right
enum unit_activity activity
int fc_snprintf(char *str, size_t n, const char *format,...)
const char * unit_description(struct unit *punit)
struct city * tile_city(const struct tile *ptile)
#define tile_terrain(_tile)
struct sprite * get_building_sprite(const struct tileset *t, const struct impr_type *pimprove)
int tileset_small_sprite_width(const struct tileset *t)
struct sprite * get_unittype_sprite(const struct tileset *t, const struct unit_type *punittype, enum direction8 facing)
int tileset_full_tile_height(const struct tileset *t)
int tileset_small_sprite_height(const struct tileset *t)
int tileset_unit_with_upkeep_height(const struct tileset *t)
struct sprite * get_citizen_sprite(const struct tileset *t, enum citizen_category type, int citizen_index, const struct city *pcity)
const struct unit_type * utype
const struct impr_type * building
bool can_unit_change_homecity_to(const struct civ_map *nmap, const struct unit *punit, const struct city *pcity)
struct unit * unit_transport_get(const struct unit *pcargo)
bool unit_can_do_action(const struct unit *punit, const action_id act_id)
bool can_unit_unload(const struct unit *pcargo, const struct unit *ptrans)
#define unit_list_iterate(unitlist, punit)
#define unit_list_iterate_end
const struct unit_type * unit_type_get(const struct unit *punit)
const struct unit_type * can_upgrade_unittype(const struct player *pplayer, const struct unit_type *punittype)
const char * utype_name_translation(const struct unit_type *punittype)
bool worklist_is_empty(const struct worklist *pwl)