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
162 struct unit_node_vector supported_units;
163 struct unit_node_vector present_units;
173 GtkWidget *production_bar;
174 GtkWidget *buy_command;
191 GtkWidget *new_citizens_radio[3];
304 GtkTreeViewColumn *col, gpointer data);
386 if (pdialog->pcity ==
pcity)
404 cairo_paint_with_alpha(cr, 0.5);
418 GtkWidget *sw, *ebox, *darea;
420 sw = gtk_scrolled_window_new(NULL, NULL);
421 gtk_scrolled_window_set_min_content_width(GTK_SCROLLED_WINDOW(sw),
423 gtk_scrolled_window_set_min_content_height(GTK_SCROLLED_WINDOW(sw),
425 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
426 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
427 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw),
430 ebox = gtk_event_box_new();
431 gtk_widget_set_halign(ebox, GTK_ALIGN_CENTER);
432 gtk_widget_set_valign(ebox, GTK_ALIGN_CENTER);
433 gtk_event_box_set_visible_window(GTK_EVENT_BOX(ebox),
FALSE);
434 gtk_container_add(GTK_CONTAINER(sw), ebox);
436 darea = gtk_drawing_area_new();
437 gtk_widget_add_events(darea, GDK_BUTTON_PRESS_MASK);
439 g_signal_connect(ebox,
"button-press-event",
441 g_signal_connect(darea,
"draw",
443 gtk_container_add(GTK_CONTAINER(ebox), darea);
446 cmap_canvas->
sw = sw;
447 cmap_canvas->
ebox = ebox;
448 cmap_canvas->
darea = darea;
456 GtkAdjustment *adjust = NULL;
461 adjust = gtk_scrolled_window_get_hadjustment(
462 GTK_SCROLLED_WINDOW(map_canvas_sw));
463 value = (gtk_adjustment_get_lower(adjust)
464 + gtk_adjustment_get_upper(adjust)
465 - gtk_adjustment_get_page_size(adjust)) / 2;
466 gtk_adjustment_set_value(adjust, value);
467 gtk_adjustment_value_changed(adjust);
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);
475 gtk_adjustment_value_changed(adjust);
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_device_ungrab(ev->device, ev->time);
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_left(label, 4);
716 gtk_widget_set_margin_right(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_device_grab(ev->device, gtk_widget_get_window(p),
723 GDK_OWNERSHIP_NONE,
TRUE, GDK_BUTTON_RELEASE_MASK, 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_right(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);
827 gtk_widget_show_all(table);
840 frame = gtk_frame_new(
_(
"City map"));
843 gtk_container_add(GTK_CONTAINER(
container), frame);
857 GtkCellRenderer *rend;
862 store = gtk_list_store_new(6, G_TYPE_POINTER, GDK_TYPE_PIXBUF,
863 G_TYPE_STRING, G_TYPE_INT, G_TYPE_BOOLEAN,
866 view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
869 g_object_unref(store);
870 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(
view),
FALSE);
871 gtk_widget_set_name(
view,
"small_font");
874 rend = gtk_cell_renderer_pixbuf_new();
875 gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(
view), -1, NULL,
876 rend,
"pixbuf", 1, NULL);
877 rend = gtk_cell_renderer_text_new();
878 gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(
view), -1, NULL,
880 "strikethrough", 4, NULL);
881 rend = gtk_cell_renderer_text_new();
882 g_object_set(rend,
"xalign", 1.0, NULL);
883 gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(
view), -1, NULL,
885 "strikethrough", 4, NULL);
887 gtk_tree_view_set_tooltip_column(GTK_TREE_VIEW(
view), 5);
913 GtkWidget *
page, *bottom;
914 GtkWidget *hbox, *right, *vbox, *frame, *table;
916 GtkCellRenderer *rend;
917 GtkListStore *production_store;
919 const char *tab_title =
_(
"_Overview");
923 page = gtk_grid_new();
924 gtk_orientable_set_orientation(GTK_ORIENTABLE(
page),
925 GTK_ORIENTATION_VERTICAL);
926 gtk_container_set_border_width(GTK_CONTAINER(
page), 8);
927 label = gtk_label_new_with_mnemonic(tab_title);
928 gtk_notebook_append_page(GTK_NOTEBOOK(pdialog->
notebook),
page, label);
934 middle = gtk_grid_new();
935 gtk_grid_set_column_spacing(GTK_GRID(middle), 6);
936 gtk_container_add(GTK_CONTAINER(
page), middle);
942 vbox = gtk_grid_new();
943 gtk_orientable_set_orientation(GTK_ORIENTABLE(vbox),
944 GTK_ORIENTATION_VERTICAL);
945 gtk_container_add(GTK_CONTAINER(middle), vbox);
949 label = g_object_new(GTK_TYPE_LABEL,
"label",
_(
"Production:"),
950 "xalign", 0.0,
"yalign", 0.5, NULL);
951 gtk_container_add(GTK_CONTAINER(vbox), label);
953 hbox = gtk_grid_new();
954 gtk_grid_set_column_spacing(GTK_GRID(hbox), 10);
955 gtk_container_add(GTK_CONTAINER(vbox), hbox);
957 production_store = gtk_list_store_new(4, GDK_TYPE_PIXBUF, G_TYPE_STRING,
958 G_TYPE_INT, G_TYPE_BOOLEAN);
962 gtk_combo_box_new_with_model(GTK_TREE_MODEL(production_store));
966 g_object_unref(production_store);
971 rend = gtk_cell_renderer_pixbuf_new();
974 rend,
"pixbuf", 0, NULL);
975 g_object_set(rend,
"xalign", 0.0, NULL);
977 rend = gtk_cell_renderer_text_new();
980 rend,
"text", 1,
"strikethrough", 3, NULL);
982 bar = gtk_progress_bar_new();
983 gtk_progress_bar_set_show_text(GTK_PROGRESS_BAR(bar),
TRUE);
988 gtk_progress_bar_set_text(GTK_PROGRESS_BAR(bar),
_(
"%d/%d %d turns"));
996 label = g_object_new(GTK_TYPE_LABEL,
"use-underline",
TRUE,
997 "mnemonic-widget",
view,
998 "label",
_(
"I_mprovements:"),
999 "xalign", 0.0,
"yalign", 0.5, NULL);
1000 gtk_container_add(GTK_CONTAINER(vbox), label);
1002 sw = gtk_scrolled_window_new(NULL, NULL);
1003 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw),
1004 GTK_SHADOW_ETCHED_IN);
1005 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
1006 GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
1007 gtk_container_add(GTK_CONTAINER(vbox), sw);
1009 gtk_container_add(GTK_CONTAINER(sw),
view);
1018 bottom = gtk_grid_new();
1019 gtk_grid_set_column_spacing(GTK_GRID(bottom), 6);
1020 gtk_container_add(GTK_CONTAINER(
page), bottom);
1023 frame = gtk_frame_new(
_(
"Info"));
1024 gtk_container_add(GTK_CONTAINER(bottom), frame);
1029 gtk_widget_set_halign(table, GTK_ALIGN_CENTER);
1030 gtk_widget_set_valign(table, GTK_ALIGN_CENTER);
1031 gtk_container_add(GTK_CONTAINER(frame), table);
1034 right = gtk_grid_new();
1035 gtk_orientable_set_orientation(GTK_ORIENTABLE(right),
1036 GTK_ORIENTATION_VERTICAL);
1037 gtk_container_add(GTK_CONTAINER(bottom), right);
1040 gtk_container_add(GTK_CONTAINER(right),
1043 gtk_container_add(GTK_CONTAINER(right),
1047 sw = gtk_scrolled_window_new(NULL, NULL);
1048 gtk_widget_set_hexpand(sw,
TRUE);
1049 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
1050 GTK_POLICY_AUTOMATIC, GTK_POLICY_NEVER);
1051 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw),
1057 table = gtk_grid_new();
1058 gtk_grid_set_column_spacing(GTK_GRID(table), 2);
1059 gtk_widget_set_size_request(table, -1, unit_height);
1060 gtk_container_add(GTK_CONTAINER(sw), table);
1062 gtk_container_set_focus_hadjustment(GTK_CONTAINER(table),
1063 gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(sw)));
1064 gtk_container_set_focus_vadjustment(GTK_CONTAINER(table),
1065 gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(sw)));
1071 sw = gtk_scrolled_window_new(NULL, NULL);
1072 gtk_widget_set_hexpand(sw,
TRUE);
1073 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
1074 GTK_POLICY_AUTOMATIC, GTK_POLICY_NEVER);
1075 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw),
1079 table = gtk_grid_new();
1080 gtk_grid_set_column_spacing(GTK_GRID(table), 2);
1081 gtk_widget_set_size_request(table, -1, unit_height);
1082 gtk_container_add(GTK_CONTAINER(sw), table);
1084 gtk_container_set_focus_hadjustment(GTK_CONTAINER(table),
1085 gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(sw)));
1086 gtk_container_set_focus_vadjustment(GTK_CONTAINER(table),
1087 gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(sw)));
1093 gtk_widget_show_all(
page);
1104 const char *tab_title =
_(
"Citymap");
1106 page = gtk_grid_new();
1107 gtk_orientable_set_orientation(GTK_ORIENTABLE(
page),
1108 GTK_ORIENTATION_VERTICAL);
1109 gtk_container_set_border_width(GTK_CONTAINER(
page), 8);
1110 label = gtk_label_new_with_mnemonic(tab_title);
1111 gtk_notebook_append_page(GTK_NOTEBOOK(pdialog->
notebook),
page, label);
1115 gtk_widget_show_all(
page);
1123 GdkDragContext *context,
1125 GtkSelectionData *data,
1126 guint info, guint time,
1130 GtkTreeModel *model;
1135 gtk_drag_finish(context,
FALSE,
FALSE, time);
1138 if (gtk_tree_get_row_drag_data(data, &model, &path)) {
1141 if (gtk_tree_model_get_iter(model, &it, path)) {
1145 gtk_tree_model_get(model, &it, 0, &
id, -1);
1148 gtk_drag_finish(context,
TRUE,
FALSE, time);
1150 gtk_tree_path_free(path);
1153 gtk_drag_finish(context,
FALSE,
FALSE, time);
1162 GtkWidget *hbox, *bar;
1164 hbox = gtk_grid_new();
1165 g_object_set(hbox,
"margin", 2, NULL);
1166 gtk_grid_set_column_spacing(GTK_GRID(hbox), 10);
1167 gtk_container_add(contain, hbox);
1170 bar = gtk_progress_bar_new();
1171 gtk_widget_set_hexpand(bar,
TRUE);
1172 gtk_progress_bar_set_show_text(GTK_PROGRESS_BAR(bar),
TRUE);
1174 gtk_container_add(GTK_CONTAINER(hbox), bar);
1175 gtk_progress_bar_set_text(GTK_PROGRESS_BAR(bar),
_(
"%d/%d %d turns"));
1179 g_signal_connect(bar,
"drag_data_received",
1200 const char *tab_title =
_(
"Buildings");
1202 page = gtk_grid_new();
1203 gtk_orientable_set_orientation(GTK_ORIENTABLE(page),
1204 GTK_ORIENTATION_VERTICAL);
1205 gtk_container_set_border_width(GTK_CONTAINER(page), 8);
1206 label = gtk_label_new_with_mnemonic(tab_title);
1209 gtk_notebook_append_page(GTK_NOTEBOOK(pdialog->
notebook), page, label);
1211 vbox = gtk_grid_new();
1212 gtk_orientable_set_orientation(GTK_ORIENTABLE(vbox),
1213 GTK_ORIENTATION_VERTICAL);
1214 gtk_container_add(GTK_CONTAINER(page), vbox);
1218 gtk_container_add(GTK_CONTAINER(vbox),
view);
1220 gtk_widget_show_all(page);
1229 const char *tab_title =
_(
"P_roduction");
1230 GtkWidget *label = gtk_label_new_with_mnemonic(tab_title);
1231 GtkWidget *page, *
editor;
1233 page = gtk_grid_new();
1234 gtk_orientable_set_orientation(GTK_ORIENTABLE(page),
1235 GTK_ORIENTATION_VERTICAL);
1236 gtk_container_set_border_width(GTK_CONTAINER(page), 8);
1237 gtk_notebook_append_page(GTK_NOTEBOOK(pdialog->
notebook), page, label);
1241 label = g_object_new(GTK_TYPE_LABEL,
1242 "label",
_(
"Production:"),
1243 "xalign", 0.0,
"yalign", 0.5, NULL);
1245 gtk_container_add(GTK_CONTAINER(page), label);
1253 g_object_set(
editor,
"margin", 6, NULL);
1255 gtk_container_add(GTK_CONTAINER(page),
editor);
1258 gtk_widget_show_all(page);
1273 GtkWidget *page, *label, *table, *right, *left, *frame;
1274 const char *tab_title =
_(
"Happ_iness");
1277 page = gtk_grid_new();
1278 gtk_grid_set_column_spacing(GTK_GRID(page), 6);
1279 gtk_container_set_border_width(GTK_CONTAINER(page), 8);
1280 label = gtk_label_new_with_mnemonic(tab_title);
1281 gtk_notebook_append_page(GTK_NOTEBOOK(pdialog->
notebook), page, label);
1284 left = gtk_grid_new();
1285 gtk_orientable_set_orientation(GTK_ORIENTABLE(left),
1286 GTK_ORIENTATION_VERTICAL);
1287 gtk_container_add(GTK_CONTAINER(page), left);
1291 frame = gtk_frame_new(
_(
"Info"));
1292 gtk_container_add(GTK_CONTAINER(left), frame);
1297 gtk_widget_set_halign(table, GTK_ALIGN_CENTER);
1298 gtk_container_add(GTK_CONTAINER(frame), table);
1304 gtk_orientable_set_orientation(
1306 GTK_ORIENTATION_VERTICAL);
1313 right = gtk_grid_new();
1314 gtk_orientable_set_orientation(GTK_ORIENTABLE(right),
1315 GTK_ORIENTATION_VERTICAL);
1316 gtk_container_add(GTK_CONTAINER(page), right);
1320 frame = gtk_frame_new(
_(
"City map"));
1323 gtk_container_add(GTK_CONTAINER(right), frame);
1331 gtk_orientable_set_orientation(GTK_ORIENTABLE(pdialog->
happiness.
widget),
1332 GTK_ORIENTATION_VERTICAL);
1338 gtk_widget_show_all(page);
1346 GtkWidget *page, *label;
1347 const char *tab_title =
_(
"_Governor");
1349 page = gtk_grid_new();
1351 label = gtk_label_new_with_mnemonic(tab_title);
1353 gtk_notebook_append_page(GTK_NOTEBOOK(pdialog->
notebook), page, label);
1358 gtk_widget_show(page);
1367 GtkWidget *vbox2, *page, *frame, *label, *button;
1370 const char *tab_title =
_(
"_Settings");
1372 static const char *new_citizens_output_label[] = {
1378 static const char *disband_label
1379 =
N_(
"Allow unit production to disband city");
1381 static const char *misc_whichtab_label[
NUM_PAGES] = {
1382 N_(
"Overview page"),
1383 N_(
"Production page"),
1384 N_(
"Happiness page"),
1385 N_(
"Governor page"),
1386 N_(
"This Settings page"),
1387 N_(
"Last active page")
1390 static bool new_citizens_label_done;
1391 static bool misc_whichtab_label_done;
1397 page = gtk_grid_new();
1398 gtk_grid_set_column_spacing(GTK_GRID(page), 18);
1399 gtk_container_set_border_width(GTK_CONTAINER(page), 8);
1401 size = gtk_size_group_new(GTK_SIZE_GROUP_BOTH);
1403 label = gtk_label_new_with_mnemonic(tab_title);
1405 gtk_notebook_append_page(GTK_NOTEBOOK(pdialog->
notebook), page, label);
1408 frame = gtk_frame_new(
_(
"New citizens produce"));
1409 gtk_grid_attach(GTK_GRID(page), frame, 0, 0, 1, 1);
1410 gtk_size_group_add_widget(
size, frame);
1412 vbox2 = gtk_grid_new();
1413 gtk_orientable_set_orientation(GTK_ORIENTABLE(vbox2),
1414 GTK_ORIENTATION_VERTICAL);
1415 gtk_container_add(GTK_CONTAINER(frame), vbox2);
1418 &new_citizens_label_done);
1421 for (i = 0; i <
ARRAY_SIZE(new_citizens_output_label); i++) {
1422 button = gtk_radio_button_new_with_mnemonic(group, new_citizens_output_label[i]);
1424 gtk_container_add(GTK_CONTAINER(vbox2), button);
1425 g_signal_connect(button,
"toggled",
1427 group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(button));
1431 frame = gtk_frame_new(
_(
"Next time open"));
1432 gtk_grid_attach(GTK_GRID(page), frame, 1, 0, 1, 1);
1433 gtk_size_group_add_widget(
size, frame);
1435 vbox2 = gtk_grid_new();
1436 gtk_orientable_set_orientation(GTK_ORIENTABLE(vbox2),
1437 GTK_ORIENTATION_VERTICAL);
1438 gtk_container_add(GTK_CONTAINER(frame), vbox2);
1441 &misc_whichtab_label_done);
1444 for (i = 0; i <
ARRAY_SIZE(misc_whichtab_label); i++) {
1445 button = gtk_radio_button_new_with_mnemonic(group, misc_whichtab_label[i]);
1447 gtk_container_add(GTK_CONTAINER(vbox2), button);
1448 g_signal_connect(button,
"toggled",
1450 group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(button));
1454 frame = gtk_frame_new(
_(
"City"));
1455 gtk_widget_set_margin_top(frame, 12);
1456 gtk_widget_set_margin_bottom(frame, 12);
1457 gtk_grid_attach(GTK_GRID(page), frame, 0, 1, 1, 1);
1459 vbox2 = gtk_grid_new();
1460 gtk_orientable_set_orientation(GTK_ORIENTABLE(vbox2),
1461 GTK_ORIENTATION_VERTICAL);
1462 gtk_container_add(GTK_CONTAINER(frame), vbox2);
1464 button = gtk_button_new_with_mnemonic(
_(
"R_ename..."));
1466 gtk_container_add(GTK_CONTAINER(vbox2), button);
1467 g_signal_connect(button,
"clicked",
1473 button = gtk_check_button_new_with_mnemonic(
_(disband_label));
1475 gtk_container_add(GTK_CONTAINER(vbox2), button);
1476 g_signal_connect(button,
"toggled",
1480 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON
1487 gtk_widget_show_all(page);
1490 gtk_notebook_set_current_page(GTK_NOTEBOOK(pdialog->
notebook),
1493 gtk_notebook_set_current_page(GTK_NOTEBOOK(pdialog->
notebook),
1511 GtkWidget *close_command;
1512 GtkWidget *vbox, *hbox, *cbox, *ebox;
1513 int citizen_bar_width;
1514 int citizen_bar_height;
1522 pdialog->
pcity = pcity;
1534 = cairo_image_surface_create(CAIRO_FORMAT_ARGB32,
1537 pdialog->
shell = gtk_dialog_new();
1540 gtk_window_set_role(GTK_WINDOW(pdialog->
shell),
"city");
1542 g_signal_connect(pdialog->
shell,
"destroy",
1544 gtk_window_set_position(GTK_WINDOW(pdialog->
shell), GTK_WIN_POS_MOUSE);
1545 gtk_widget_set_name(pdialog->
shell,
"Freeciv");
1547 gtk_widget_realize(pdialog->
shell);
1550#ifndef FREECIV_MSWINDOWS
1555 gtk_window_set_icon(GTK_WINDOW(pdialog->
shell), pixbuf);
1556 g_object_unref(pixbuf);
1561 gtk_window_set_default_size(GTK_WINDOW(pdialog->
shell),
1567 vbox = gtk_dialog_get_content_area(GTK_DIALOG(pdialog->
shell));
1568 hbox = gtk_grid_new();
1569 gtk_grid_set_column_homogeneous(GTK_GRID(hbox),
TRUE);
1570 gtk_container_add(GTK_CONTAINER(vbox), hbox);
1573 cbox = gtk_grid_new();
1574 gtk_container_add(GTK_CONTAINER(hbox), cbox);
1576 ebox = gtk_event_box_new();
1577 gtk_event_box_set_visible_window(GTK_EVENT_BOX(ebox),
FALSE);
1578 gtk_container_add(GTK_CONTAINER(cbox), ebox);
1583 pdialog->
citizen_surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32,
1584 citizen_bar_width, citizen_bar_height);
1587 gtk_widget_add_events(pdialog->
citizen_images, GDK_BUTTON_PRESS_MASK);
1593 gtk_widget_set_valign(pdialog->
citizen_images, GTK_ALIGN_CENTER);
1595 g_signal_connect(G_OBJECT(ebox),
"button-press-event",
1601 gtk_widget_set_halign(pdialog->
name_label, GTK_ALIGN_START);
1602 gtk_widget_set_valign(pdialog->
name_label, GTK_ALIGN_CENTER);
1603 gtk_container_add(GTK_CONTAINER(hbox), pdialog->
name_label);
1607 pdialog->
notebook = gtk_notebook_new();
1608 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(pdialog->
notebook),
1610 gtk_container_add(GTK_CONTAINER(vbox), pdialog->
notebook);
1629 gtk_notebook_set_current_page(GTK_NOTEBOOK(pdialog->
notebook),
1638 gtk_dialog_add_button(GTK_DIALOG(pdialog->
shell),
_(
"_List present units..."),
CDLGR_UNITS);
1640 g_signal_connect(GTK_DIALOG(pdialog->
shell),
"response",
1645 gtk_dialog_add_action_widget(GTK_DIALOG(pdialog->
shell),
1650 gtk_dialog_add_action_widget(GTK_DIALOG(pdialog->
shell),
1658 close_command = gtk_dialog_add_button(GTK_DIALOG(pdialog->
shell),
1659 GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE);
1661 gtk_dialog_set_default_response(GTK_DIALOG(pdialog->
shell),
1662 GTK_RESPONSE_CLOSE);
1664 g_signal_connect(close_command,
"clicked",
1675 g_signal_connect(pdialog->
shell,
"key_press_event",
1685 gtk_widget_show_all(pdialog->
shell);
1687 gtk_window_set_focus(GTK_WINDOW(pdialog->
shell), close_command);
1703 buf = g_strdup_printf(
_(
"<b>%s</b> - %s citizens - DISORDER"),
1708 buf = g_strdup_printf(
_(
"<b>%s</b> - %s citizens - celebrating"),
1713 buf = g_strdup_printf(
_(
"<b>%s</b> - %s citizens - happy"),
1718 buf = g_strdup_printf(
_(
"<b>%s</b> - %s citizens"),
1723 now = gtk_label_get_text(GTK_LABEL(pdialog->
name_label));
1724 if (strcmp(now, buf) != 0) {
1726 gtk_label_set_markup(GTK_LABEL(pdialog->
name_label), buf);
1738 int i,
width, full_width, total_used_width;
1739 int citizen_bar_width, citizen_bar_height;
1750 if (num_citizens > 1) {
1752 / (num_citizens - 1));
1765 for (i = 0; i < num_citizens; i++) {
1766 cairo_set_source_surface(cr,
1769 cairo_rectangle(cr, i *
width, 0,
1771 i + 1 < num_citizens ?
width : full_width,
1772 citizen_bar_height);
1776 total_used_width = (i - 1) *
width + full_width;
1778 if (total_used_width < citizen_bar_width) {
1783 cairo_rectangle(cr, total_used_width, 0,
1784 citizen_bar_width - total_used_width,
1785 citizen_bar_height);
1786 cairo_set_operator(cr, CAIRO_OPERATOR_CLEAR);
1807 GdkRGBA red = {1.0, 0, 0, 1.0};
1814 pcity->
size, non_workers);
1836 if (granaryturns == 0) {
1847 PL_(
"%d turn",
"%d turns", abs(granaryturns)),
1877 gtk_label_set_text(GTK_LABEL(
info_label[i]), buf[i]);
1885 color = (granaryturns > -4 && granaryturns < 0) ? &red : NULL;
1928 char buf[32], buf2[200];
1931 GtkListStore* store;
1935 int targets_used,
item;
1953 if (build_slots > 1) {
1956 PL_(
"Production (up to %d unit per turn):",
1957 "Production (up to %d units per turn):", build_slots),
1972 pct = CLAMP(pct, 0.0, 1.0);
1978 fc_snprintf(buf2,
sizeof(buf2),
"%s%s\n%s", descr,
1980 gtk_progress_bar_set_text(
1982 gtk_progress_bar_set_fraction(
1987 fc_snprintf(buf2,
sizeof(buf2),
"%s%s: %s", descr,
1989 gtk_progress_bar_set_text(
1991 gtk_progress_bar_set_fraction(
2001 if (store != NULL) {
2016 if (VUT_UTYPE == target.
kind) {
2019 direction8_invalid());
2027 gtk_list_store_append(store, &iter);
2028 gtk_list_store_set(store, &iter, 0, pix,
2029 1,
name, 3, useless,
2031 g_object_unref(G_OBJECT(pix));
2050 int item, targets_used;
2053 GtkTreeModel *model;
2054 GtkListStore *store;
2056 const char *tooltip_sellable =
_(
"Press <b>ENTER</b> or double-click to "
2057 "sell an improvement.");
2058 const char *tooltip_great_wonder =
_(
"Great Wonder - cannot be sold.");
2059 const char *tooltip_small_wonder =
_(
"Small Wonder - cannot be sold.");
2063 store = GTK_LIST_STORE(model);
2068 gtk_list_store_clear(store);
2083 gtk_list_store_append(store, &it);
2084 gtk_list_store_set(store, &it,
2094 tooltip_great_wonder :
2096 tooltip_small_wonder : tooltip_sellable),
2098 g_object_unref(G_OBJECT(pix));
2107 struct unit_list *units;
2108 struct unit_node_vector *nodes;
2123 n = unit_list_size(units);
2124 m = unit_node_vector_size(nodes);
2130 gtk_widget_destroy(elt->cmd);
2134 unit_node_vector_reserve(nodes,
n);
2136 for (i = m; i <
n; i++) {
2137 GtkWidget *cmd, *pix;
2140 cmd = gtk_button_new();
2143 gtk_button_set_relief(GTK_BUTTON(
cmd), GTK_RELIEF_NONE);
2144 gtk_widget_add_events(
cmd,
2145 GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK);
2147 pix = gtk_image_new();
2151 gtk_container_add(GTK_CONTAINER(
cmd),
pix);
2155 unit_node_vector_append(nodes, node);
2164 pnode = unit_node_vector_get(nodes, i);
2174 g_signal_handlers_disconnect_matched(
cmd,
2175 G_SIGNAL_MATCH_FUNC,
2178 g_signal_handlers_disconnect_matched(
cmd,
2179 G_SIGNAL_MATCH_FUNC,
2184 g_signal_connect(
cmd,
"button_press_event",
2188 g_signal_connect(
cmd,
"button_release_event",
2193 gtk_widget_set_sensitive(
cmd,
FALSE);
2195 gtk_widget_set_sensitive(
cmd,
TRUE);
2198 gtk_widget_show(
pix);
2199 gtk_widget_show(
cmd);
2204 buf = g_strdup_printf(
_(
"Supported units %d"),
n);
2214 struct unit_list *units;
2215 struct unit_node_vector *nodes;
2228 n = unit_list_size(units);
2229 m = unit_node_vector_size(nodes);
2235 gtk_widget_destroy(elt->cmd);
2239 unit_node_vector_reserve(nodes,
n);
2241 for (i = m; i <
n; i++) {
2242 GtkWidget *cmd, *pix;
2245 cmd = gtk_button_new();
2248 gtk_button_set_relief(GTK_BUTTON(
cmd), GTK_RELIEF_NONE);
2249 gtk_widget_add_events(
cmd,
2250 GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK);
2252 pix = gtk_image_new();
2256 gtk_container_add(GTK_CONTAINER(
cmd),
pix);
2260 unit_node_vector_append(nodes, node);
2268 pnode = unit_node_vector_get(nodes, i);
2277 g_signal_handlers_disconnect_matched(
cmd,
2278 G_SIGNAL_MATCH_FUNC,
2281 g_signal_handlers_disconnect_matched(
cmd,
2282 G_SIGNAL_MATCH_FUNC,
2287 g_signal_connect(
cmd,
"button_press_event",
2291 g_signal_connect(
cmd,
"button_release_event",
2296 gtk_widget_set_sensitive(
cmd,
FALSE);
2298 gtk_widget_set_sensitive(
cmd,
TRUE);
2301 gtk_widget_show(
pix);
2302 gtk_widget_show(
cmd);
2307 buf = g_strdup_printf(
_(
"Present units %d"),
n);
2337 if (count == city_number) {
2339 gtk_widget_set_sensitive(pdialog->prev_command,
FALSE);
2340 gtk_widget_set_sensitive(pdialog->next_command,
FALSE);
2345 gtk_widget_set_sensitive(pdialog->prev_command,
TRUE);
2346 gtk_widget_set_sensitive(pdialog->next_command,
TRUE);
2373 if (unit_list_size(ptile->
units)) {
2382 gboolean *push_in, gpointer data)
2385 GtkAllocation allocation;
2391 widget = GTK_WIDGET(data);
2393 gtk_widget_get_allocation(
widget, &allocation);
2395 gdk_window_get_origin(gtk_widget_get_window(
widget), &xpos, &ypos);
2397 xpos += allocation.x + allocation.width/2;
2398 ypos += allocation.y + allocation.height/2;
2410 gtk_widget_destroy(w);
2419 GtkWidget *menu, *
item;
2429 if (ev->type != GDK_BUTTON_PRESS || ev->button == 2 || ev->button == 3
2436 gtk_menu_popdown(GTK_MENU(menu));
2437 gtk_container_foreach(GTK_CONTAINER(menu),
destroy_func, NULL);
2439 item = gtk_menu_item_new_with_mnemonic(
_(
"Cen_ter"));
2440 g_signal_connect(
item,
"activate",
2443 gtk_menu_shell_append(GTK_MENU_SHELL(menu),
item);
2445 item = gtk_menu_item_new_with_mnemonic(
_(
"_Activate unit"));
2446 g_signal_connect(
item,
"activate",
2449 gtk_menu_shell_append(GTK_MENU_SHELL(menu),
item);
2451 item = gtk_menu_item_new_with_mnemonic(
_(
"Activate unit, _close dialog"));
2452 g_signal_connect(
item,
"activate",
2455 gtk_menu_shell_append(GTK_MENU_SHELL(menu),
item);
2457 item = gtk_menu_item_new_with_mnemonic(
_(
"_Disband unit"));
2458 g_signal_connect(
item,
"activate",
2461 gtk_menu_shell_append(GTK_MENU_SHELL(menu),
item);
2467 gtk_widget_show_all(menu);
2469 gtk_menu_popup(GTK_MENU(menu), NULL, NULL,
2483 GtkWidget *menu, *
item;
2493 if (ev->type != GDK_BUTTON_PRESS || ev->button == 2 || ev->button == 3
2500 gtk_menu_popdown(GTK_MENU(menu));
2501 gtk_container_foreach(GTK_CONTAINER(menu),
destroy_func, NULL);
2503 item = gtk_menu_item_new_with_mnemonic(
_(
"_Activate unit"));
2504 g_signal_connect(
item,
"activate",
2507 gtk_menu_shell_append(GTK_MENU_SHELL(menu),
item);
2509 item = gtk_menu_item_new_with_mnemonic(
_(
"Activate unit, _close dialog"));
2510 g_signal_connect(
item,
"activate",
2513 gtk_menu_shell_append(GTK_MENU_SHELL(menu),
item);
2515 item = gtk_menu_item_new_with_mnemonic(
_(
"_Load unit"));
2516 g_signal_connect(
item,
"activate",
2519 gtk_menu_shell_append(GTK_MENU_SHELL(menu),
item);
2525 item = gtk_menu_item_new_with_mnemonic(
_(
"_Unload unit"));
2526 g_signal_connect(
item,
"activate",
2529 gtk_menu_shell_append(GTK_MENU_SHELL(menu),
item);
2536 item = gtk_menu_item_new_with_mnemonic(
_(
"_Sentry unit"));
2537 g_signal_connect(
item,
"activate",
2540 gtk_menu_shell_append(GTK_MENU_SHELL(menu),
item);
2547 item = gtk_menu_item_new_with_mnemonic(
_(
"_Fortify unit"));
2548 g_signal_connect(
item,
"activate",
2551 gtk_menu_shell_append(GTK_MENU_SHELL(menu),
item);
2558 item = gtk_menu_item_new_with_mnemonic(
_(
"_Disband unit"));
2559 g_signal_connect(
item,
"activate",
2562 gtk_menu_shell_append(GTK_MENU_SHELL(menu),
item);
2568 item = gtk_menu_item_new_with_mnemonic(
2570 g_signal_connect(
item,
"activate",
2573 gtk_menu_shell_append(GTK_MENU_SHELL(menu),
item);
2577 item = gtk_menu_item_new_with_mnemonic(
_(
"U_pgrade unit"));
2579 g_signal_connect(
item,
"activate",
2582 gtk_menu_shell_append(GTK_MENU_SHELL(menu),
item);
2590 gtk_widget_show_all(menu);
2592 gtk_menu_popup(GTK_MENU(menu), NULL, NULL,
2615 if (ev->button == 3) {
2617 }
else if (ev->button == 2) {
2643 if (ev->button == 3) {
2645 }
else if (ev->button == 2) {
2662 if (NULL !=
punit) {
2675 if (NULL !=
punit) {
2690 if (NULL !=
punit) {
2691 struct city *pcity =
2695 if (NULL != pcity) {
2698 if (NULL != pdialog) {
2715 if (NULL !=
punit) {
2719 if (NULL != pcity) {
2722 if (NULL != pdialog) {
2737 if (NULL !=
punit) {
2750 if (NULL !=
punit) {
2763 if (NULL !=
punit) {
2776 if (NULL !=
punit) {
2786 struct unit_list *punits;
2790 if (NULL ==
punit) {
2794 punits = unit_list_new();
2795 unit_list_append(punits,
punit);
2797 unit_list_destroy(punits);
2809 if (NULL !=
punit) {
2819 struct unit_list *punits;
2823 if (NULL ==
punit) {
2827 punits = unit_list_new();
2828 unit_list_append(punits,
punit);
2830 unit_list_destroy(punits);
2843 int citnum, tlen,
len;
2867 enum unit_activity act = (
enum unit_activity)GPOINTER_TO_INT(data);
2875 if (act == ACTIVITY_LAST) {
2894 if ((act != ACTIVITY_TRANSFORM
2897 && (act != ACTIVITY_PLANT || pterr->
plant_result == NULL)) {
2935 .value = { .terrain = pterr }};
2943 _(
"What Action to Request"),
2944 _(
"Select autosettler activity:"));
2946 ptask = worker_task_list_get(pcity->
task_reqs, 0);
2947 if (ptask != NULL) {
2950 GINT_TO_POINTER(ACTIVITY_LAST),
FALSE, NULL);
2956 GINT_TO_POINTER(ACTIVITY_MINE),
FALSE, NULL);
2963 GINT_TO_POINTER(ACTIVITY_PLANT),
FALSE, NULL);
2968 GINT_TO_POINTER(ACTIVITY_IRRIGATE),
FALSE, NULL);
2975 GINT_TO_POINTER(ACTIVITY_CULTIVATE),
FALSE, NULL);
2980 GINT_TO_POINTER(ACTIVITY_GEN_ROAD),
FALSE, NULL);
2987 GINT_TO_POINTER(ACTIVITY_TRANSFORM),
FALSE, NULL);
2993 GINT_TO_POINTER(ACTIVITY_POLLUTION),
FALSE, NULL);
2999 GINT_TO_POINTER(ACTIVITY_FALLOUT),
FALSE, NULL);
3033 if (ev->button == 1) {
3035 }
else if (ev->button == 3) {
3067 if (response == GTK_RESPONSE_YES) {
3070 gtk_widget_destroy(w);
3089 "Treasury contains %d gold.",
3094 shell = gtk_message_dialog_new(NULL,
3095 GTK_DIALOG_DESTROY_WITH_PARENT,
3096 GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO,
3098 PL_(
"Buy %s for %d gold?\n%s",
3099 "Buy %s for %d gold?\n%s", value),
3102 gtk_window_set_title(GTK_WINDOW(
shell),
_(
"Buy It!"));
3103 gtk_dialog_set_default_response(GTK_DIALOG(
shell), GTK_RESPONSE_NO);
3106 gtk_window_present(GTK_WINDOW(
shell));
3108 shell = gtk_message_dialog_new(NULL,
3109 GTK_DIALOG_DESTROY_WITH_PARENT,
3110 GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE,
3112 PL_(
"%s costs %d gold.\n%s",
3113 "%s costs %d gold.\n%s", value),
3116 gtk_window_set_title(GTK_WINDOW(
shell),
_(
"Buy It!"));
3117 g_signal_connect(
shell,
"response", G_CALLBACK(gtk_widget_destroy),
3119 gtk_window_present(GTK_WINDOW(
shell));
3132 && gtk_combo_box_get_active_iter(combo, &iter)) {
3136 gtk_tree_model_get(gtk_combo_box_get_model(combo), &iter, 2, &
id, -1);
3162 shl = gtk_message_dialog_new(NULL,
3163 GTK_DIALOG_DESTROY_WITH_PARENT,
3164 GTK_MESSAGE_QUESTION,
3166 PL_(
"Sell %s for %d gold?",
3167 "Sell %s for %d gold?", price),
3172 gtk_window_set_title(GTK_WINDOW(shl),
_(
"Sell It!"));
3173 gtk_window_set_position(GTK_WINDOW(shl), GTK_WIN_POS_CENTER_ON_PARENT);
3175 g_signal_connect(shl,
"response",
3178 gtk_window_present(GTK_WINDOW(shl));
3188 if (response == GTK_RESPONSE_YES) {
3191 gtk_widget_destroy(w);
3200 GtkTreeViewColumn *col, gpointer data)
3202 GtkTreeModel *model;
3205 GdkDeviceManager *manager;
3206 GdkModifierType mask;
3209 model = gtk_tree_view_get_model(
view);
3211 if (!gtk_tree_model_get_iter(model, &it, path)) {
3215 gtk_tree_model_get(model, &it, 0, &pimprove, -1);
3217 win = gdk_get_default_root_window();
3218 manager = gdk_display_get_device_manager(gdk_window_get_display(win));
3220 gdk_window_get_device_position(win,
3221 gdk_device_manager_get_client_pointer(manager),
3224 if (!(mask & GDK_CONTROL_MASK)) {
3248 _(
"What should we rename the city to?"),
3262 if (response == GTK_RESPONSE_OK) {
3291 bv_city_options new_options;
3297 BV_SET(new_options, CITYO_DISBAND);
3300 BV_SET(new_options, CITYO_SCIENCE_SPECIALISTS);
3303 BV_SET(new_options, CITYO_GOLD_SPECIALISTS);
3324 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON
3327 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON
3330 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON
3354 gtk_widget_hide(pdialog->
shell);
3365 gtk_widget_get_allocated_width(pdialog->
shell),
3369 gtk_widget_get_allocated_height(pdialog->
shell),
3373 = gtk_notebook_get_current_page(GTK_NOTEBOOK(pdialog->
notebook));
3405 gtk_widget_destroy(pdialog->
shell);
3415 int i, j, dir,
size;
3416 struct city *new_pcity = NULL;
3444 for (i = 0; i <
size; i++) {
3452 for (j = 1; j <
size; j++) {
3458 if (!other_pdialog) {
3459 new_pcity = other_pcity;
3475 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 city_menu_position(GtkMenu *menu, gint *x, gint *y, gboolean *push_in, 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)
GtkWidget * gtk_stockbutton_new(const gchar *stock, const gchar *label_text)
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)
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_CITYDLG_MIN_XSIZE
#define GUI_GTK3_CITYDLG_MAX_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)