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
101#define SPECVEC_TAG unit_node
102#define SPECVEC_TYPE struct unit_node
105#define unit_node_vector_iterate(list, elt) \
106 TYPED_VECTOR_ITERATE(struct unit_node, list, elt)
107#define unit_node_vector_iterate_end VECTOR_ITERATE_END
109#define NUM_CITIZENS_SHOWN 30
127#define CITY_MAP_MIN_SIZE_X 200
128#define CITY_MAP_MIN_SIZE_Y 150
151 GtkWidget *production_bar;
152 GtkWidget *production_combo;
153 GtkWidget *buy_command;
154 GtkWidget *improvement_list;
156 GtkWidget *supported_units_frame;
157 GtkWidget *supported_unit_table;
159 GtkWidget *present_units_frame;
160 GtkWidget *present_unit_table;
162 struct unit_node_vector supported_units;
163 struct unit_node_vector present_units;
168 GtkListStore* change_production_store;
172 GtkWidget *production_label;
173 GtkWidget *production_bar;
174 GtkWidget *buy_command;
190 GtkWidget *rename_command;
191 GtkWidget *new_citizens_radio[3];
192 GtkWidget *disband_on_settler;
305 GtkTreeViewColumn *col, gpointer data);
387 if (pdialog->pcity ==
pcity)
405 cairo_paint_with_alpha(cr, 0.5);
419 GtkWidget *sw, *ebox, *darea;
421 sw = gtk_scrolled_window_new(NULL, NULL);
422 gtk_scrolled_window_set_min_content_width(GTK_SCROLLED_WINDOW(sw),
424 gtk_scrolled_window_set_min_content_height(GTK_SCROLLED_WINDOW(sw),
426 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
427 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
428 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw),
431 ebox = gtk_event_box_new();
432 gtk_widget_set_halign(ebox, GTK_ALIGN_CENTER);
433 gtk_widget_set_valign(ebox, GTK_ALIGN_CENTER);
434 gtk_event_box_set_visible_window(GTK_EVENT_BOX(ebox),
FALSE);
435 gtk_container_add(GTK_CONTAINER(sw), ebox);
437 darea = gtk_drawing_area_new();
438 gtk_widget_add_events(darea, GDK_BUTTON_PRESS_MASK);
440 g_signal_connect(ebox,
"button-press-event",
442 g_signal_connect(darea,
"draw",
444 gtk_container_add(GTK_CONTAINER(ebox), darea);
447 cmap_canvas->
sw = sw;
448 cmap_canvas->
ebox = ebox;
449 cmap_canvas->
darea = darea;
457 GtkAdjustment *adjust = NULL;
462 adjust = gtk_scrolled_window_get_hadjustment(
463 GTK_SCROLLED_WINDOW(map_canvas_sw));
464 value = (gtk_adjustment_get_lower(adjust)
465 + gtk_adjustment_get_upper(adjust)
466 - gtk_adjustment_get_page_size(adjust)) / 2;
467 gtk_adjustment_set_value(adjust, value);
469 adjust = gtk_scrolled_window_get_vadjustment(
470 GTK_SCROLLED_WINDOW(map_canvas_sw));
471 value = (gtk_adjustment_get_lower(adjust)
472 + gtk_adjustment_get_upper(adjust)
473 - gtk_adjustment_get_page_size(adjust)) / 2;
474 gtk_adjustment_set_value(adjust, value);
508 bool have_present_units = (unit_list_size(
pcity->
tile->
units) > 0);
527 && have_present_units);
540 struct city *pcity_sup, *pcity_pre;
566 gtk_window_present(GTK_WINDOW(pdialog->
shell));
619 if (
event->state & GDK_CONTROL_MASK) {
620 switch (
event->keyval) {
622 gtk_notebook_prev_page(GTK_NOTEBOOK(pdialog->
notebook));
626 gtk_notebook_next_page(GTK_NOTEBOOK(pdialog->
notebook));
644 gdk_seat_ungrab(gdk_device_get_seat(ev->device));
645 gtk_widget_destroy(w);
656 struct city_dialog *pdialog = g_object_get_data(G_OBJECT(w),
"pdialog");
658 if (ev->button == 1) {
659 GtkWidget *p, *label, *frame;
662 switch (GPOINTER_TO_UINT(data)) {
664 fc_snprintf(buf,
sizeof(buf),
_(
"Population: %d, Specialists: %d"),
704 p = gtk_window_new(GTK_WINDOW_POPUP);
705 gtk_widget_set_name(p,
"Freeciv");
706 gtk_container_set_border_width(GTK_CONTAINER(p), 2);
707 gtk_window_set_transient_for(GTK_WINDOW(p), GTK_WINDOW(pdialog->
shell));
708 gtk_window_set_position(GTK_WINDOW(p), GTK_WIN_POS_MOUSE);
710 frame = gtk_frame_new(NULL);
711 gtk_container_add(GTK_CONTAINER(p), frame);
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);
719 gtk_container_add(GTK_CONTAINER(frame), label);
720 gtk_widget_show_all(p);
722 gdk_seat_grab(gdk_device_get_seat(ev->device), gtk_widget_get_window(p),
723 GDK_SEAT_CAPABILITY_ALL_POINTING,
724 TRUE, NULL, (GdkEvent *)ev, NULL, NULL);
727 g_signal_connect_after(p,
"button_release_event",
742 GtkWidget *table, *label, *ebox;
762 static bool output_label_done;
764 table = gtk_grid_new();
765 g_object_set(table,
"margin", 4, NULL);
770 label = gtk_label_new(output_label[i]);
776 gtk_widget_set_margin_bottom(label, 5);
783 gtk_widget_set_margin_top(label, 5);
788 gtk_widget_set_margin_end(label, 5);
789 gtk_widget_set_name(label,
"city_label");
790 gtk_widget_set_halign(label, GTK_ALIGN_START);
791 gtk_widget_set_valign(label, GTK_ALIGN_CENTER);
792 gtk_grid_attach(GTK_GRID(table), label, 0, i, 1, 1);
794 ebox = gtk_event_box_new();
799 gtk_widget_set_margin_bottom(ebox, 5);
805 gtk_widget_set_margin_top(ebox, 5);
810 gtk_event_box_set_visible_window(GTK_EVENT_BOX(ebox),
FALSE);
811 g_object_set_data(G_OBJECT(ebox),
"pdialog", pdialog);
812 g_signal_connect(ebox,
"button_press_event",
816 label = gtk_label_new(
"");
818 gtk_widget_set_name(label,
"city_label");
819 gtk_widget_set_halign(label, GTK_ALIGN_START);
820 gtk_widget_set_valign(label, GTK_ALIGN_CENTER);
822 gtk_container_add(GTK_CONTAINER(ebox), label);
824 gtk_grid_attach(GTK_GRID(table), ebox, 1, i, 1, 1);
834 static GtkCssProvider *emergency_provider = NULL;
836 if (emergency_provider == NULL) {
837 emergency_provider = gtk_css_provider_new();
839 gtk_css_provider_load_from_data(emergency_provider,
841 " color: rgba(255, 0.0, 0.0, 255);\n"
848 GTK_STYLE_PROVIDER(emergency_provider),
849 GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
852 GTK_STYLE_PROVIDER(emergency_provider),
853 GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
856 GTK_STYLE_PROVIDER(emergency_provider),
857 GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
860 GTK_STYLE_PROVIDER(emergency_provider),
861 GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
864 gtk_widget_show_all(table);
877 frame = gtk_frame_new(
_(
"City map"));
880 gtk_container_add(GTK_CONTAINER(
container), frame);
894 GtkCellRenderer *rend;
899 store = gtk_list_store_new(6, G_TYPE_POINTER, GDK_TYPE_PIXBUF,
900 G_TYPE_STRING, G_TYPE_INT, G_TYPE_BOOLEAN,
903 view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
906 g_object_unref(store);
907 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(
view),
FALSE);
908 gtk_widget_set_name(
view,
"small_font");
911 rend = gtk_cell_renderer_pixbuf_new();
912 gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(
view), -1, NULL,
913 rend,
"pixbuf", 1, NULL);
914 rend = gtk_cell_renderer_text_new();
915 gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(
view), -1, NULL,
917 "strikethrough", 4, NULL);
918 rend = gtk_cell_renderer_text_new();
919 g_object_set(rend,
"xalign", 1.0, NULL);
920 gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(
view), -1, NULL,
922 "strikethrough", 4, NULL);
924 gtk_tree_view_set_tooltip_column(GTK_TREE_VIEW(
view), 5);
950 GtkWidget *
page, *bottom;
951 GtkWidget *hbox, *right, *vbox, *frame, *table;
953 GtkCellRenderer *rend;
954 GtkListStore *production_store;
956 const char *tab_title =
_(
"_Overview");
960 page = gtk_grid_new();
961 gtk_orientable_set_orientation(GTK_ORIENTABLE(
page),
962 GTK_ORIENTATION_VERTICAL);
963 gtk_container_set_border_width(GTK_CONTAINER(
page), 8);
964 label = gtk_label_new_with_mnemonic(tab_title);
965 gtk_notebook_append_page(GTK_NOTEBOOK(pdialog->
notebook),
page, label);
971 middle = gtk_grid_new();
972 gtk_grid_set_column_spacing(GTK_GRID(middle), 6);
973 gtk_container_add(GTK_CONTAINER(
page), middle);
979 vbox = gtk_grid_new();
980 gtk_orientable_set_orientation(GTK_ORIENTABLE(vbox),
981 GTK_ORIENTATION_VERTICAL);
982 gtk_container_add(GTK_CONTAINER(middle), vbox);
986 label = g_object_new(GTK_TYPE_LABEL,
"label",
_(
"Production:"),
987 "xalign", 0.0,
"yalign", 0.5, NULL);
988 gtk_container_add(GTK_CONTAINER(vbox), label);
990 hbox = gtk_grid_new();
991 gtk_grid_set_column_spacing(GTK_GRID(hbox), 10);
992 gtk_container_add(GTK_CONTAINER(vbox), hbox);
994 production_store = gtk_list_store_new(4, GDK_TYPE_PIXBUF, G_TYPE_STRING,
995 G_TYPE_INT, G_TYPE_BOOLEAN);
999 gtk_combo_box_new_with_model(GTK_TREE_MODEL(production_store));
1003 g_object_unref(production_store);
1008 rend = gtk_cell_renderer_pixbuf_new();
1011 rend,
"pixbuf", 0, NULL);
1012 g_object_set(rend,
"xalign", 0.0, NULL);
1014 rend = gtk_cell_renderer_text_new();
1017 rend,
"text", 1,
"strikethrough", 3, NULL);
1019 bar = gtk_progress_bar_new();
1020 gtk_progress_bar_set_show_text(GTK_PROGRESS_BAR(bar),
TRUE);
1025 gtk_progress_bar_set_text(GTK_PROGRESS_BAR(bar),
_(
"%d/%d %d turns"));
1033 label = g_object_new(GTK_TYPE_LABEL,
"use-underline",
TRUE,
1034 "mnemonic-widget",
view,
1035 "label",
_(
"I_mprovements:"),
1036 "xalign", 0.0,
"yalign", 0.5, NULL);
1037 gtk_container_add(GTK_CONTAINER(vbox), label);
1039 sw = gtk_scrolled_window_new(NULL, NULL);
1040 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw),
1041 GTK_SHADOW_ETCHED_IN);
1042 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
1043 GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
1044 gtk_container_add(GTK_CONTAINER(vbox), sw);
1046 gtk_container_add(GTK_CONTAINER(sw),
view);
1055 bottom = gtk_grid_new();
1056 gtk_grid_set_column_spacing(GTK_GRID(bottom), 6);
1057 gtk_container_add(GTK_CONTAINER(
page), bottom);
1060 frame = gtk_frame_new(
_(
"Info"));
1061 gtk_container_add(GTK_CONTAINER(bottom), frame);
1066 gtk_widget_set_halign(table, GTK_ALIGN_CENTER);
1067 gtk_widget_set_valign(table, GTK_ALIGN_CENTER);
1068 gtk_container_add(GTK_CONTAINER(frame), table);
1071 right = gtk_grid_new();
1072 gtk_orientable_set_orientation(GTK_ORIENTABLE(right),
1073 GTK_ORIENTATION_VERTICAL);
1074 gtk_container_add(GTK_CONTAINER(bottom), right);
1077 gtk_container_add(GTK_CONTAINER(right),
1080 gtk_container_add(GTK_CONTAINER(right),
1084 sw = gtk_scrolled_window_new(NULL, NULL);
1085 gtk_widget_set_hexpand(sw,
TRUE);
1086 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
1087 GTK_POLICY_AUTOMATIC, GTK_POLICY_NEVER);
1088 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw),
1094 table = gtk_grid_new();
1095 gtk_grid_set_column_spacing(GTK_GRID(table), 2);
1096 gtk_widget_set_size_request(table, -1, unit_height);
1097 gtk_container_add(GTK_CONTAINER(sw), table);
1099 gtk_container_set_focus_hadjustment(GTK_CONTAINER(table),
1100 gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(sw)));
1101 gtk_container_set_focus_vadjustment(GTK_CONTAINER(table),
1102 gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(sw)));
1108 sw = gtk_scrolled_window_new(NULL, NULL);
1109 gtk_widget_set_hexpand(sw,
TRUE);
1110 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
1111 GTK_POLICY_AUTOMATIC, GTK_POLICY_NEVER);
1112 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw),
1116 table = gtk_grid_new();
1117 gtk_grid_set_column_spacing(GTK_GRID(table), 2);
1118 gtk_widget_set_size_request(table, -1, unit_height);
1119 gtk_container_add(GTK_CONTAINER(sw), table);
1121 gtk_container_set_focus_hadjustment(GTK_CONTAINER(table),
1122 gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(sw)));
1123 gtk_container_set_focus_vadjustment(GTK_CONTAINER(table),
1124 gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(sw)));
1130 gtk_widget_show_all(
page);
1141 const char *tab_title =
_(
"Citymap");
1143 page = gtk_grid_new();
1144 gtk_orientable_set_orientation(GTK_ORIENTABLE(
page),
1145 GTK_ORIENTATION_VERTICAL);
1146 gtk_container_set_border_width(GTK_CONTAINER(
page), 8);
1147 label = gtk_label_new_with_mnemonic(tab_title);
1148 gtk_notebook_append_page(GTK_NOTEBOOK(pdialog->
notebook),
page, label);
1152 gtk_widget_show_all(
page);
1160 GdkDragContext *context,
1162 GtkSelectionData *data,
1163 guint info, guint time,
1167 GtkTreeModel *model;
1172 gtk_drag_finish(context,
FALSE,
FALSE, time);
1175 if (gtk_tree_get_row_drag_data(data, &model, &path)) {
1178 if (gtk_tree_model_get_iter(model, &it, path)) {
1182 gtk_tree_model_get(model, &it, 0, &
id, -1);
1185 gtk_drag_finish(context,
TRUE,
FALSE, time);
1187 gtk_tree_path_free(path);
1190 gtk_drag_finish(context,
FALSE,
FALSE, time);
1199 GtkWidget *hbox, *bar;
1201 hbox = gtk_grid_new();
1202 g_object_set(hbox,
"margin", 2, NULL);
1203 gtk_grid_set_column_spacing(GTK_GRID(hbox), 10);
1204 gtk_container_add(contain, hbox);
1207 bar = gtk_progress_bar_new();
1208 gtk_widget_set_hexpand(bar,
TRUE);
1209 gtk_progress_bar_set_show_text(GTK_PROGRESS_BAR(bar),
TRUE);
1211 gtk_container_add(GTK_CONTAINER(hbox), bar);
1212 gtk_progress_bar_set_text(GTK_PROGRESS_BAR(bar),
_(
"%d/%d %d turns"));
1216 g_signal_connect(bar,
"drag_data_received",
1237 const char *tab_title =
_(
"Buildings");
1239 page = gtk_grid_new();
1240 gtk_orientable_set_orientation(GTK_ORIENTABLE(page),
1241 GTK_ORIENTATION_VERTICAL);
1242 gtk_container_set_border_width(GTK_CONTAINER(page), 8);
1243 label = gtk_label_new_with_mnemonic(tab_title);
1246 gtk_notebook_append_page(GTK_NOTEBOOK(pdialog->
notebook), page, label);
1248 vbox = gtk_grid_new();
1249 gtk_orientable_set_orientation(GTK_ORIENTABLE(vbox),
1250 GTK_ORIENTATION_VERTICAL);
1251 gtk_container_add(GTK_CONTAINER(page), vbox);
1255 gtk_container_add(GTK_CONTAINER(vbox),
view);
1257 gtk_widget_show_all(page);
1266 const char *tab_title =
_(
"P_roduction");
1267 GtkWidget *label = gtk_label_new_with_mnemonic(tab_title);
1268 GtkWidget *page, *
editor;
1270 page = gtk_grid_new();
1271 gtk_orientable_set_orientation(GTK_ORIENTABLE(page),
1272 GTK_ORIENTATION_VERTICAL);
1273 gtk_container_set_border_width(GTK_CONTAINER(page), 8);
1274 gtk_notebook_append_page(GTK_NOTEBOOK(pdialog->
notebook), page, label);
1278 label = g_object_new(GTK_TYPE_LABEL,
1279 "label",
_(
"Production:"),
1280 "xalign", 0.0,
"yalign", 0.5, NULL);
1282 gtk_container_add(GTK_CONTAINER(page), label);
1290 g_object_set(
editor,
"margin", 6, NULL);
1292 gtk_container_add(GTK_CONTAINER(page),
editor);
1295 gtk_widget_show_all(page);
1310 GtkWidget *page, *label, *table, *right, *left, *frame;
1311 const char *tab_title =
_(
"Happ_iness");
1314 page = gtk_grid_new();
1315 gtk_grid_set_column_spacing(GTK_GRID(page), 6);
1316 gtk_container_set_border_width(GTK_CONTAINER(page), 8);
1317 label = gtk_label_new_with_mnemonic(tab_title);
1318 gtk_notebook_append_page(GTK_NOTEBOOK(pdialog->
notebook), page, label);
1321 left = gtk_grid_new();
1322 gtk_orientable_set_orientation(GTK_ORIENTABLE(left),
1323 GTK_ORIENTATION_VERTICAL);
1324 gtk_container_add(GTK_CONTAINER(page), left);
1328 frame = gtk_frame_new(
_(
"Info"));
1329 gtk_container_add(GTK_CONTAINER(left), frame);
1334 gtk_widget_set_halign(table, GTK_ALIGN_CENTER);
1335 gtk_container_add(GTK_CONTAINER(frame), table);
1341 gtk_orientable_set_orientation(
1343 GTK_ORIENTATION_VERTICAL);
1350 right = gtk_grid_new();
1351 gtk_orientable_set_orientation(GTK_ORIENTABLE(right),
1352 GTK_ORIENTATION_VERTICAL);
1353 gtk_container_add(GTK_CONTAINER(page), right);
1357 frame = gtk_frame_new(
_(
"City map"));
1360 gtk_container_add(GTK_CONTAINER(right), frame);
1368 gtk_orientable_set_orientation(GTK_ORIENTABLE(pdialog->
happiness.
widget),
1369 GTK_ORIENTATION_VERTICAL);
1375 gtk_widget_show_all(page);
1383 GtkWidget *page, *label;
1384 const char *tab_title =
_(
"_Governor");
1386 page = gtk_grid_new();
1388 label = gtk_label_new_with_mnemonic(tab_title);
1390 gtk_notebook_append_page(GTK_NOTEBOOK(pdialog->
notebook), page, label);
1395 gtk_widget_show(page);
1404 GtkWidget *vbox2, *page, *frame, *label, *button;
1407 const char *tab_title =
_(
"_Settings");
1409 static const char *new_citizens_output_label[] = {
1415 static const char *disband_label
1416 =
N_(
"Allow unit production to disband city");
1418 static const char *misc_whichtab_label[
NUM_PAGES] = {
1419 N_(
"Overview page"),
1420 N_(
"Production page"),
1421 N_(
"Happiness page"),
1422 N_(
"Governor page"),
1423 N_(
"This Settings page"),
1424 N_(
"Last active page")
1427 static bool new_citizens_label_done;
1428 static bool misc_whichtab_label_done;
1434 page = gtk_grid_new();
1435 gtk_grid_set_column_spacing(GTK_GRID(page), 18);
1436 gtk_container_set_border_width(GTK_CONTAINER(page), 8);
1438 size = gtk_size_group_new(GTK_SIZE_GROUP_BOTH);
1440 label = gtk_label_new_with_mnemonic(tab_title);
1442 gtk_notebook_append_page(GTK_NOTEBOOK(pdialog->
notebook), page, label);
1445 frame = gtk_frame_new(
_(
"New citizens produce"));
1446 gtk_grid_attach(GTK_GRID(page), frame, 0, 0, 1, 1);
1447 gtk_size_group_add_widget(
size, frame);
1449 vbox2 = gtk_grid_new();
1450 gtk_orientable_set_orientation(GTK_ORIENTABLE(vbox2),
1451 GTK_ORIENTATION_VERTICAL);
1452 gtk_container_add(GTK_CONTAINER(frame), vbox2);
1455 &new_citizens_label_done);
1458 for (i = 0; i <
ARRAY_SIZE(new_citizens_output_label); i++) {
1459 button = gtk_radio_button_new_with_mnemonic(group, new_citizens_output_label[i]);
1461 gtk_container_add(GTK_CONTAINER(vbox2), button);
1462 g_signal_connect(button,
"toggled",
1464 group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(button));
1468 frame = gtk_frame_new(
_(
"Next time open"));
1469 gtk_grid_attach(GTK_GRID(page), frame, 1, 0, 1, 1);
1470 gtk_size_group_add_widget(
size, frame);
1472 vbox2 = gtk_grid_new();
1473 gtk_orientable_set_orientation(GTK_ORIENTABLE(vbox2),
1474 GTK_ORIENTATION_VERTICAL);
1475 gtk_container_add(GTK_CONTAINER(frame), vbox2);
1478 &misc_whichtab_label_done);
1481 for (i = 0; i <
ARRAY_SIZE(misc_whichtab_label); i++) {
1482 button = gtk_radio_button_new_with_mnemonic(group, misc_whichtab_label[i]);
1484 gtk_container_add(GTK_CONTAINER(vbox2), button);
1485 g_signal_connect(button,
"toggled",
1487 group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(button));
1491 frame = gtk_frame_new(
_(
"City"));
1492 gtk_widget_set_margin_top(frame, 12);
1493 gtk_widget_set_margin_bottom(frame, 12);
1494 gtk_grid_attach(GTK_GRID(page), frame, 0, 1, 1, 1);
1496 vbox2 = gtk_grid_new();
1497 gtk_orientable_set_orientation(GTK_ORIENTABLE(vbox2),
1498 GTK_ORIENTATION_VERTICAL);
1499 gtk_container_add(GTK_CONTAINER(frame), vbox2);
1501 button = gtk_button_new_with_mnemonic(
_(
"R_ename..."));
1503 gtk_container_add(GTK_CONTAINER(vbox2), button);
1504 g_signal_connect(button,
"clicked",
1510 button = gtk_check_button_new_with_mnemonic(
_(disband_label));
1512 gtk_container_add(GTK_CONTAINER(vbox2), button);
1513 g_signal_connect(button,
"toggled",
1517 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON
1524 gtk_widget_show_all(page);
1527 gtk_notebook_set_current_page(GTK_NOTEBOOK(pdialog->
notebook),
1530 gtk_notebook_set_current_page(GTK_NOTEBOOK(pdialog->
notebook),
1546 GtkWidget *close_command;
1547 GtkWidget *vbox, *hbox, *cbox, *ebox;
1548 int citizen_bar_width;
1549 int citizen_bar_height;
1557 pdialog->
pcity = pcity;
1569 = cairo_image_surface_create(CAIRO_FORMAT_ARGB32,
1572 pdialog->
shell = gtk_dialog_new();
1575 gtk_window_set_role(GTK_WINDOW(pdialog->
shell),
"city");
1577 g_signal_connect(pdialog->
shell,
"destroy",
1579 gtk_window_set_position(GTK_WINDOW(pdialog->
shell), GTK_WIN_POS_MOUSE);
1580 gtk_widget_set_name(pdialog->
shell,
"Freeciv");
1582 gtk_widget_realize(pdialog->
shell);
1585#ifndef FREECIV_MSWINDOWS
1590 gtk_window_set_icon(GTK_WINDOW(pdialog->
shell), pixbuf);
1591 g_object_unref(pixbuf);
1596 gtk_window_set_default_size(GTK_WINDOW(pdialog->
shell),
1602 vbox = gtk_dialog_get_content_area(GTK_DIALOG(pdialog->
shell));
1603 hbox = gtk_grid_new();
1604 gtk_grid_set_column_homogeneous(GTK_GRID(hbox),
TRUE);
1605 gtk_container_add(GTK_CONTAINER(vbox), hbox);
1608 cbox = gtk_grid_new();
1609 gtk_container_add(GTK_CONTAINER(hbox), cbox);
1611 ebox = gtk_event_box_new();
1612 gtk_event_box_set_visible_window(GTK_EVENT_BOX(ebox),
FALSE);
1613 gtk_container_add(GTK_CONTAINER(cbox), ebox);
1618 pdialog->
citizen_surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32,
1619 citizen_bar_width, citizen_bar_height);
1622 gtk_widget_add_events(pdialog->
citizen_images, GDK_BUTTON_PRESS_MASK);
1628 gtk_widget_set_valign(pdialog->
citizen_images, GTK_ALIGN_CENTER);
1630 g_signal_connect(G_OBJECT(ebox),
"button-press-event",
1636 gtk_widget_set_halign(pdialog->
name_label, GTK_ALIGN_START);
1637 gtk_widget_set_valign(pdialog->
name_label, GTK_ALIGN_CENTER);
1638 gtk_container_add(GTK_CONTAINER(hbox), pdialog->
name_label);
1642 pdialog->
notebook = gtk_notebook_new();
1643 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(pdialog->
notebook),
1645 gtk_container_add(GTK_CONTAINER(vbox), pdialog->
notebook);
1664 gtk_notebook_set_current_page(GTK_NOTEBOOK(pdialog->
notebook),
1673 gtk_dialog_add_button(GTK_DIALOG(pdialog->
shell),
_(
"_List present units..."),
CDLGR_UNITS);
1675 g_signal_connect(GTK_DIALOG(pdialog->
shell),
"response",
1678 pdialog->
prev_command = gtk_button_new_from_icon_name(
"go-previous", 0);
1679 gtk_dialog_add_action_widget(GTK_DIALOG(pdialog->
shell),
1682 pdialog->
next_command = gtk_button_new_from_icon_name(
"go-next", 0);
1683 gtk_dialog_add_action_widget(GTK_DIALOG(pdialog->
shell),
1691 close_command = gtk_dialog_add_button(GTK_DIALOG(pdialog->
shell),
1692 _(
"_Close"), GTK_RESPONSE_CLOSE);
1694 gtk_dialog_set_default_response(GTK_DIALOG(pdialog->
shell),
1695 GTK_RESPONSE_CLOSE);
1697 g_signal_connect(close_command,
"clicked",
1708 g_signal_connect(pdialog->
shell,
"key_press_event",
1718 gtk_widget_show_all(pdialog->
shell);
1720 gtk_window_set_focus(GTK_WINDOW(pdialog->
shell), close_command);
1736 buf = g_strdup_printf(
_(
"<b>%s</b> - %s citizens - DISORDER"),
1741 buf = g_strdup_printf(
_(
"<b>%s</b> - %s citizens - celebrating"),
1746 buf = g_strdup_printf(
_(
"<b>%s</b> - %s citizens - happy"),
1751 buf = g_strdup_printf(
_(
"<b>%s</b> - %s citizens"),
1756 now = gtk_label_get_text(GTK_LABEL(pdialog->
name_label));
1757 if (strcmp(now, buf) != 0) {
1759 gtk_label_set_markup(GTK_LABEL(pdialog->
name_label), buf);
1771 int i,
width, full_width, total_used_width;
1772 int citizen_bar_width, citizen_bar_height;
1783 if (num_citizens > 1) {
1785 / (num_citizens - 1));
1798 for (i = 0; i < num_citizens; i++) {
1799 cairo_set_source_surface(cr,
1802 cairo_rectangle(cr, i *
width, 0,
1804 i + 1 < num_citizens ?
width : full_width,
1805 citizen_bar_height);
1809 total_used_width = (i - 1) *
width + full_width;
1811 if (total_used_width < citizen_bar_width) {
1816 cairo_rectangle(cr, total_used_width, 0,
1817 citizen_bar_width - total_used_width,
1818 citizen_bar_height);
1819 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];
1973 GtkListStore* store;
1977 int targets_used,
item;
1995 if (build_slots > 1) {
1998 PL_(
"Production (up to %d unit per turn):",
1999 "Production (up to %d units per turn):", build_slots),
2014 pct = CLAMP(pct, 0.0, 1.0);
2020 fc_snprintf(buf2,
sizeof(buf2),
"%s%s\n%s", descr,
2022 gtk_progress_bar_set_text(
2024 gtk_progress_bar_set_fraction(
2029 fc_snprintf(buf2,
sizeof(buf2),
"%s%s: %s", descr,
2031 gtk_progress_bar_set_text(
2033 gtk_progress_bar_set_fraction(
2043 if (store != NULL) {
2058 if (VUT_UTYPE == target.
kind) {
2061 direction8_invalid());
2069 gtk_list_store_append(store, &iter);
2070 gtk_list_store_set(store, &iter, 0, pix,
2071 1,
name, 3, useless,
2073 g_object_unref(G_OBJECT(pix));
2092 int item, targets_used;
2095 GtkTreeModel *model;
2096 GtkListStore *store;
2098 const char *tooltip_sellable =
_(
"Press <b>ENTER</b> or double-click to "
2099 "sell an improvement.");
2100 const char *tooltip_great_wonder =
_(
"Great Wonder - cannot be sold.");
2101 const char *tooltip_small_wonder =
_(
"Small Wonder - cannot be sold.");
2105 store = GTK_LIST_STORE(model);
2110 gtk_list_store_clear(store);
2125 gtk_list_store_append(store, &it);
2126 gtk_list_store_set(store, &it,
2136 tooltip_great_wonder :
2138 tooltip_small_wonder : tooltip_sellable),
2140 g_object_unref(G_OBJECT(pix));
2149 struct unit_list *units;
2150 struct unit_node_vector *nodes;
2165 n = unit_list_size(units);
2166 m = unit_node_vector_size(nodes);
2172 gtk_widget_destroy(elt->cmd);
2176 unit_node_vector_reserve(nodes,
n);
2178 for (i = m; i <
n; i++) {
2179 GtkWidget *cmd, *pix;
2182 cmd = gtk_button_new();
2185 gtk_button_set_relief(GTK_BUTTON(
cmd), GTK_RELIEF_NONE);
2186 gtk_widget_add_events(
cmd,
2187 GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK);
2189 pix = gtk_image_new();
2193 gtk_container_add(GTK_CONTAINER(
cmd),
pix);
2197 unit_node_vector_append(nodes, node);
2206 pnode = unit_node_vector_get(nodes, i);
2216 g_signal_handlers_disconnect_matched(
cmd,
2217 G_SIGNAL_MATCH_FUNC,
2220 g_signal_handlers_disconnect_matched(
cmd,
2221 G_SIGNAL_MATCH_FUNC,
2226 g_signal_connect(
cmd,
"button_press_event",
2230 g_signal_connect(
cmd,
"button_release_event",
2235 gtk_widget_set_sensitive(
cmd,
FALSE);
2237 gtk_widget_set_sensitive(
cmd,
TRUE);
2240 gtk_widget_show(
pix);
2241 gtk_widget_show(
cmd);
2246 buf = g_strdup_printf(
_(
"Supported units %d"),
n);
2256 struct unit_list *units;
2257 struct unit_node_vector *nodes;
2270 n = unit_list_size(units);
2271 m = unit_node_vector_size(nodes);
2277 gtk_widget_destroy(elt->cmd);
2281 unit_node_vector_reserve(nodes,
n);
2283 for (i = m; i <
n; i++) {
2284 GtkWidget *cmd, *pix;
2287 cmd = gtk_button_new();
2290 gtk_button_set_relief(GTK_BUTTON(
cmd), GTK_RELIEF_NONE);
2291 gtk_widget_add_events(
cmd,
2292 GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK);
2294 pix = gtk_image_new();
2298 gtk_container_add(GTK_CONTAINER(
cmd),
pix);
2302 unit_node_vector_append(nodes, node);
2310 pnode = unit_node_vector_get(nodes, i);
2319 g_signal_handlers_disconnect_matched(
cmd,
2320 G_SIGNAL_MATCH_FUNC,
2323 g_signal_handlers_disconnect_matched(
cmd,
2324 G_SIGNAL_MATCH_FUNC,
2329 g_signal_connect(
cmd,
"button_press_event",
2333 g_signal_connect(
cmd,
"button_release_event",
2338 gtk_widget_set_sensitive(
cmd,
FALSE);
2340 gtk_widget_set_sensitive(
cmd,
TRUE);
2343 gtk_widget_show(
pix);
2344 gtk_widget_show(
cmd);
2349 buf = g_strdup_printf(
_(
"Present units %d"),
n);
2380 if (count == city_number) {
2382 gtk_widget_set_sensitive(GTK_WIDGET(pdialog->prev_command),
FALSE);
2383 gtk_widget_set_sensitive(GTK_WIDGET(pdialog->next_command),
FALSE);
2389 gtk_widget_set_sensitive(GTK_WIDGET(pdialog->prev_command),
TRUE);
2390 gtk_widget_set_sensitive(GTK_WIDGET(pdialog->next_command),
TRUE);
2418 if (unit_list_size(ptile->
units)) {
2428 gtk_widget_destroy(w);
2437 GtkWidget *menu, *
item;
2447 if (ev->type != GDK_BUTTON_PRESS || ev->button == 2 || ev->button == 3
2454 gtk_menu_popdown(GTK_MENU(menu));
2455 gtk_container_foreach(GTK_CONTAINER(menu),
destroy_func, NULL);
2457 item = gtk_menu_item_new_with_mnemonic(
_(
"Cen_ter"));
2458 g_signal_connect(
item,
"activate",
2461 gtk_menu_shell_append(GTK_MENU_SHELL(menu),
item);
2463 item = gtk_menu_item_new_with_mnemonic(
_(
"_Activate unit"));
2464 g_signal_connect(
item,
"activate",
2467 gtk_menu_shell_append(GTK_MENU_SHELL(menu),
item);
2469 item = gtk_menu_item_new_with_mnemonic(
_(
"Activate unit, _close dialog"));
2470 g_signal_connect(
item,
"activate",
2473 gtk_menu_shell_append(GTK_MENU_SHELL(menu),
item);
2475 item = gtk_menu_item_new_with_mnemonic(
_(
"_Disband unit"));
2476 g_signal_connect(
item,
"activate",
2479 gtk_menu_shell_append(GTK_MENU_SHELL(menu),
item);
2485 gtk_widget_show_all(menu);
2487 gtk_menu_popup_at_pointer(GTK_MENU(menu), NULL);
2499 GtkWidget *menu, *
item;
2509 if (ev->type != GDK_BUTTON_PRESS || ev->button == 2 || ev->button == 3
2516 gtk_menu_popdown(GTK_MENU(menu));
2517 gtk_container_foreach(GTK_CONTAINER(menu),
destroy_func, NULL);
2519 item = gtk_menu_item_new_with_mnemonic(
_(
"_Activate unit"));
2520 g_signal_connect(
item,
"activate",
2523 gtk_menu_shell_append(GTK_MENU_SHELL(menu),
item);
2525 item = gtk_menu_item_new_with_mnemonic(
_(
"Activate unit, _close dialog"));
2526 g_signal_connect(
item,
"activate",
2529 gtk_menu_shell_append(GTK_MENU_SHELL(menu),
item);
2531 item = gtk_menu_item_new_with_mnemonic(
_(
"_Load unit"));
2532 g_signal_connect(
item,
"activate",
2535 gtk_menu_shell_append(GTK_MENU_SHELL(menu),
item);
2541 item = gtk_menu_item_new_with_mnemonic(
_(
"_Unload unit"));
2542 g_signal_connect(
item,
"activate",
2545 gtk_menu_shell_append(GTK_MENU_SHELL(menu),
item);
2552 item = gtk_menu_item_new_with_mnemonic(
_(
"_Sentry unit"));
2553 g_signal_connect(
item,
"activate",
2556 gtk_menu_shell_append(GTK_MENU_SHELL(menu),
item);
2563 item = gtk_menu_item_new_with_mnemonic(
_(
"_Fortify unit"));
2564 g_signal_connect(
item,
"activate",
2567 gtk_menu_shell_append(GTK_MENU_SHELL(menu),
item);
2574 item = gtk_menu_item_new_with_mnemonic(
_(
"_Disband unit"));
2575 g_signal_connect(
item,
"activate",
2578 gtk_menu_shell_append(GTK_MENU_SHELL(menu),
item);
2584 item = gtk_menu_item_new_with_mnemonic(
2586 g_signal_connect(
item,
"activate",
2589 gtk_menu_shell_append(GTK_MENU_SHELL(menu),
item);
2593 item = gtk_menu_item_new_with_mnemonic(
_(
"U_pgrade unit"));
2595 g_signal_connect(
item,
"activate",
2598 gtk_menu_shell_append(GTK_MENU_SHELL(menu),
item);
2606 gtk_widget_show_all(menu);
2608 gtk_menu_popup_at_pointer(GTK_MENU(menu), NULL);
2631 if (ev->button == 3) {
2633 }
else if (ev->button == 2) {
2659 if (ev->button == 3) {
2661 }
else if (ev->button == 2) {
2678 if (NULL !=
punit) {
2691 if (NULL !=
punit) {
2706 if (NULL !=
punit) {
2707 struct city *pcity =
2711 if (NULL != pcity) {
2714 if (NULL != pdialog) {
2731 if (NULL !=
punit) {
2735 if (NULL != pcity) {
2738 if (NULL != pdialog) {
2753 if (NULL !=
punit) {
2766 if (NULL !=
punit) {
2779 if (NULL !=
punit) {
2792 if (NULL !=
punit) {
2802 struct unit_list *punits;
2806 if (NULL ==
punit) {
2810 punits = unit_list_new();
2811 unit_list_append(punits,
punit);
2813 unit_list_destroy(punits);
2825 if (NULL !=
punit) {
2835 struct unit_list *punits;
2839 if (NULL ==
punit) {
2843 punits = unit_list_new();
2844 unit_list_append(punits,
punit);
2846 unit_list_destroy(punits);
2859 int citnum, tlen,
len;
2883 enum unit_activity act = (
enum unit_activity)GPOINTER_TO_INT(data);
2891 if (act == ACTIVITY_LAST) {
2910 if ((act != ACTIVITY_TRANSFORM
2913 && (act != ACTIVITY_PLANT || pterr->
plant_result == NULL)) {
2951 .value = { .terrain = pterr }};
2959 _(
"What Action to Request"),
2960 _(
"Select autosettler activity:"));
2962 ptask = worker_task_list_get(pcity->
task_reqs, 0);
2963 if (ptask != NULL) {
2966 GINT_TO_POINTER(ACTIVITY_LAST),
FALSE, NULL);
2972 GINT_TO_POINTER(ACTIVITY_MINE),
FALSE, NULL);
2979 GINT_TO_POINTER(ACTIVITY_PLANT),
FALSE, NULL);
2984 GINT_TO_POINTER(ACTIVITY_IRRIGATE),
FALSE, NULL);
2991 GINT_TO_POINTER(ACTIVITY_CULTIVATE),
FALSE, NULL);
2996 GINT_TO_POINTER(ACTIVITY_GEN_ROAD),
FALSE, NULL);
3003 GINT_TO_POINTER(ACTIVITY_TRANSFORM),
FALSE, NULL);
3009 GINT_TO_POINTER(ACTIVITY_POLLUTION),
FALSE, NULL);
3015 GINT_TO_POINTER(ACTIVITY_FALLOUT),
FALSE, NULL);
3049 if (ev->button == 1) {
3051 }
else if (ev->button == 3) {
3083 if (response == GTK_RESPONSE_YES) {
3086 gtk_widget_destroy(w);
3105 "Treasury contains %d gold.",
3110 shell = gtk_message_dialog_new(NULL,
3111 GTK_DIALOG_DESTROY_WITH_PARENT,
3112 GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO,
3114 PL_(
"Buy %s for %d gold?\n%s",
3115 "Buy %s for %d gold?\n%s", value),
3118 gtk_window_set_title(GTK_WINDOW(
shell),
_(
"Buy It!"));
3119 gtk_dialog_set_default_response(GTK_DIALOG(
shell), GTK_RESPONSE_NO);
3122 gtk_window_present(GTK_WINDOW(
shell));
3124 shell = gtk_message_dialog_new(NULL,
3125 GTK_DIALOG_DESTROY_WITH_PARENT,
3126 GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE,
3128 PL_(
"%s costs %d gold.\n%s",
3129 "%s costs %d gold.\n%s", value),
3132 gtk_window_set_title(GTK_WINDOW(
shell),
_(
"Buy It!"));
3133 g_signal_connect(
shell,
"response", G_CALLBACK(gtk_widget_destroy),
3135 gtk_window_present(GTK_WINDOW(
shell));
3148 && gtk_combo_box_get_active_iter(combo, &iter)) {
3152 gtk_tree_model_get(gtk_combo_box_get_model(combo), &iter, 2, &
id, -1);
3178 shl = gtk_message_dialog_new(NULL,
3179 GTK_DIALOG_DESTROY_WITH_PARENT,
3180 GTK_MESSAGE_QUESTION,
3182 PL_(
"Sell %s for %d gold?",
3183 "Sell %s for %d gold?", price),
3188 gtk_window_set_title(GTK_WINDOW(shl),
_(
"Sell It!"));
3189 gtk_window_set_position(GTK_WINDOW(shl), GTK_WIN_POS_CENTER_ON_PARENT);
3191 g_signal_connect(shl,
"response",
3194 gtk_window_present(GTK_WINDOW(shl));
3204 if (response == GTK_RESPONSE_YES) {
3207 gtk_widget_destroy(w);
3216 GtkTreeViewColumn *col, gpointer data)
3218 GtkTreeModel *model;
3222 GdkModifierType mask;
3225 model = gtk_tree_view_get_model(
view);
3227 if (!gtk_tree_model_get_iter(model, &it, path)) {
3231 gtk_tree_model_get(model, &it, 0, &pimprove, -1);
3233 win = gtk_widget_get_parent_window(GTK_WIDGET(
view));
3234 seat = gdk_display_get_default_seat(gdk_window_get_display(win));
3236 gdk_window_get_device_position(win, gdk_seat_get_pointer(seat),
3239 if (!(mask & GDK_CONTROL_MASK)) {
3263 _(
"What should we rename the city to?"),
3277 if (response == GTK_RESPONSE_OK) {
3306 bv_city_options new_options;
3312 BV_SET(new_options, CITYO_DISBAND);
3315 BV_SET(new_options, CITYO_SCIENCE_SPECIALISTS);
3318 BV_SET(new_options, CITYO_GOLD_SPECIALISTS);
3339 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON
3342 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON
3345 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON
3369 gtk_widget_hide(pdialog->
shell);
3380 gtk_widget_get_allocated_width(pdialog->
shell),
3384 gtk_widget_get_allocated_height(pdialog->
shell),
3388 = gtk_notebook_get_current_page(GTK_NOTEBOOK(pdialog->
notebook));
3420 gtk_widget_destroy(pdialog->
shell);
3430 int i, j, dir,
size;
3431 struct city *new_pcity = NULL;
3459 for (i = 0; i <
size; i++) {
3467 for (j = 1; j <
size; j++) {
3473 if (!other_pdialog) {
3474 new_pcity = other_pcity;
3490 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)
static gboolean canvas_exposed_cb(GtkWidget *w, cairo_t *cr, gpointer data)
#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)
static gboolean present_unit_middle_callback(GtkWidget *w, GdkEventButton *ev, 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 keyboard_handler(GtkWidget *widget, GdkEventKey *event, 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 gboolean show_info_button_release(GtkWidget *w, GdkEventButton *ev, gpointer data)
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 destroy_func(GtkWidget *w, gpointer data)
static void unit_homecity_callback(GtkWidget *w, gpointer data)
static void unit_fortify_callback(GtkWidget *w, gpointer data)
static gboolean supported_unit_middle_callback(GtkWidget *w, GdkEventButton *ev, 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 gboolean button_down_citymap(GtkWidget *w, GdkEventButton *ev, 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)
void put_unit_image_city_overlays(struct unit *punit, GtkImage *p, int height, int *upkeep_cost, int happy_cost)
void put_unit_image(struct unit *punit, GtkImage *p, int height)
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)
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_GTK3_22_CITYDLG_MAX_XSIZE
#define GUI_GTK3_22_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)
#define CLIP(lower, current, upper)
cairo_surface_t * surface
GtkWidget * info_ebox[NUM_INFO_FIELDS]
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 * citizen_images
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 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
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)
struct sprite * get_icon_sprite(const struct tileset *t, enum icon_type icon)
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)