Freeciv-3.3
Loading...
Searching...
No Matches
menu.c
Go to the documentation of this file.
1/***********************************************************************
2 Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2, or (at your option)
6 any later version.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12***********************************************************************/
13
14#ifdef HAVE_CONFIG_H
15#include <fc_config.h>
16#endif
17
18#include <stdlib.h>
19
20#include <gtk/gtk.h>
21
22/* utility */
23#include "fcintl.h"
24#include "log.h"
25#include "shared.h"
26#include "support.h"
27
28/* common */
29#include "game.h"
30#include "government.h"
31#include "road.h"
32#include "unit.h"
33
34/* client */
35#include "client_main.h"
36#include "clinet.h"
37#include "connectdlg_common.h"
38#include "control.h"
39#include "mapview_common.h"
40#include "options.h"
41#include "tilespec.h"
42
43/* client/gui-gtk-3.22 */
44#include "chatline.h"
45#include "cityrep.h"
46#include "dialogs.h"
47#include "editgui.h"
48#include "editprop.h"
49#include "finddlg.h"
50#include "gamedlgs.h"
51#include "gotodlg.h"
52#include "gui_main.h"
53#include "gui_stuff.h"
54#include "helpdlg.h"
55#include "infradlg.h"
56#include "luaconsole.h"
57#include "mapctrl.h" /* center_on_unit(). */
58#include "messagedlg.h"
59#include "messagewin.h"
60#include "optiondlg.h"
61#include "pages.h"
62#include "plrdlg.h"
63#include "rallypointdlg.h"
64#include "ratesdlg.h"
65#include "repodlgs.h"
66#include "sprite.h"
67#include "spaceshipdlg.h"
68#include "unitselect.h"
69#include "wldlg.h"
70
71#include "menu.h"
72
73#ifndef GTK_STOCK_EDIT
74#define GTK_STOCK_EDIT NULL
75#endif
76
78
79static void menu_entry_set_active(const char *key,
81static void menu_entry_set_sensitive(const char *key,
83#ifndef FREECIV_DEBUG
84static void menu_entry_set_visible(const char *key,
85 gboolean is_visible,
87#endif /* FREECIV_DEBUG */
88
89static void view_menu_update_sensitivity(void);
90
93
96
105
113static void save_game_callback(GtkMenuItem *item, gpointer data);
117static void find_city_callback(GtkMenuItem *item, gpointer data);
118static void worklists_callback(GtkMenuItem *item, gpointer data);
120static void leave_callback(GtkMenuItem *item, gpointer data);
121static void quit_callback(GtkMenuItem *item, gpointer data);
122static void map_view_callback(GtkMenuItem *item, gpointer data);
126static void report_wow_callback(GtkMenuItem *item, gpointer data);
130static void bg_select0_callback(GtkMenuItem *item, gpointer data);
131static void bg_assign0_callback(GtkMenuItem *item, gpointer data);
132static void bg_append0_callback(GtkMenuItem *item, gpointer data);
133static void bg_select1_callback(GtkMenuItem *item, gpointer data);
134static void bg_assign1_callback(GtkMenuItem *item, gpointer data);
135static void bg_append1_callback(GtkMenuItem *item, gpointer data);
136static void bg_select2_callback(GtkMenuItem *item, gpointer data);
137static void bg_assign2_callback(GtkMenuItem *item, gpointer data);
138static void bg_append2_callback(GtkMenuItem *item, gpointer data);
139static void bg_select3_callback(GtkMenuItem *item, gpointer data);
140static void bg_assign3_callback(GtkMenuItem *item, gpointer data);
141static void bg_append3_callback(GtkMenuItem *item, gpointer data);
150static void help_units_callback(GtkMenuItem *item, gpointer data);
152static void help_zoc_callback(GtkMenuItem *item, gpointer data);
155static void help_tech_callback(GtkMenuItem *item, gpointer data);
163static void help_cma_callback(GtkMenuItem *item, gpointer data);
168static void help_about_callback(GtkMenuItem *item, gpointer data);
170 gpointer data);
173 gpointer data);
177 gpointer data);
179 gpointer data);
181 gpointer data);
185 gpointer data);
187 gpointer data);
189 gpointer data);
202 gpointer data);
204 gpointer data);
206 gpointer data);
211static void toggle_fog_callback(GtkMenuItem *item, gpointer data);
217static void multiplier_callback(GtkMenuItem *item, gpointer data);
220static void government_callback(GtkMenuItem *item, gpointer data);
221static void tax_rate_callback(GtkMenuItem *item, gpointer data);
230static void unit_wait_callback(GtkMenuItem *item, gpointer data);
231static void unit_done_callback(GtkMenuItem *item, gpointer data);
232static void unit_goto_callback(GtkMenuItem *item, gpointer data);
239static void unit_board_callback(GtkMenuItem *item, gpointer data);
242 gpointer data);
247static void build_city_callback(GtkMenuItem *item, gpointer data);
248static void auto_work_callback(GtkMenuItem *item, gpointer data);
249static void build_road_callback(GtkMenuItem *item, gpointer data);
251static void cultivate_callback(GtkMenuItem *item, gpointer data);
252static void build_mine_callback(GtkMenuItem *item, gpointer data);
253static void plant_callback(GtkMenuItem *item, gpointer data);
260static void fortify_callback(GtkMenuItem *item, gpointer data);
264static void do_pillage_callback(GtkMenuItem *item, gpointer data);
266
268{
269 { "MENU_GAME", N_("_Game"), 0, 0, NULL, MGROUP_SAFE },
270 { "MENU_OPTIONS", N_("_Options"), 0, 0, NULL, MGROUP_SAFE },
271 { "MENU_EDIT", N_("_Edit"), 0, 0, NULL, MGROUP_SAFE },
272 { "MENU_VIEW", N_("?verb:_View"), 0, 0, NULL, MGROUP_SAFE },
273 { "MENU_IMPROVEMENTS", N_("_Improvements"), 0, 0,
274 NULL, MGROUP_SAFE },
275 { "MENU_CIVILIZATION", N_("C_ivilization"), 0, 0,
276 NULL, MGROUP_SAFE },
277 { "MENU_BATTLE_GROUPS", N_("_Battle Groups"), 0, 0,
279 { "MENU_HELP", N_("_Help"), 0, 0, NULL, MGROUP_SAFE },
280 { "CLEAR_CHAT_LOGS", N_("_Clear Chat Log"), 0, 0,
282 { "SAVE_CHAT_LOGS", N_("Save Chat _Log"), 0, 0,
284 { "LOCAL_OPTIONS", N_("_Local Client"), 0, 0,
286 { "MESSAGE_OPTIONS", N_("_Message"), 0, 0,
288 { "SERVER_OPTIONS", N_("_Remote Server"), 0, 0,
290 { "SAVE_OPTIONS", N_("Save Options _Now"), 0, 0,
292 { "RELOAD_TILESET", N_("_Reload Tileset"),
295 { "GAME_SAVE", N_("_Save Game"), GDK_KEY_s, GDK_CONTROL_MASK,
297 { "GAME_SAVE_AS", N_("Save Game _As..."), 0, 0,
299 { "MAPIMG_SAVE", N_("Save Map _Image"), 0, 0,
301 { "MAPIMG_SAVE_AS", N_("Save _Map Image As..."), 0, 0,
303 { "LEAVE", N_("_Leave"), 0, 0, G_CALLBACK(leave_callback), MGROUP_SAFE },
304 { "QUIT", N_("_Quit"), GDK_KEY_q, GDK_CONTROL_MASK,
306 { "FIND_CITY", N_("_Find City"), GDK_KEY_f, GDK_CONTROL_MASK,
308 { "WORKLISTS", N_("Work_lists"),
311 { "RALLY_DLG", N_("Rally point dialog"),
314 { "INFRA_DLG", N_("Infra dialog"),
317 { "CLIENT_LUA_SCRIPT", N_("Client _Lua Script"), 0, 0,
319 { "MAP_VIEW", N_("?noun:_View"), GDK_KEY_F1, 0,
321 { "REPORT_UNITS", N_("_Units"), GDK_KEY_F2, 0,
323 { "REPORT_NATIONS", N_("_Nations"), GDK_KEY_F3, 0,
325 { "REPORT_CITIES", N_("_Cities"), GDK_KEY_F4, 0,
327 { "REPORT_WOW", N_("_Wonders of the World"), GDK_KEY_F7, 0,
329 { "REPORT_TOP_CITIES", N_("Top Cities"), GDK_KEY_F8, 0,
331 { "REPORT_MESSAGES", N_("_Messages"), GDK_KEY_F9, 0,
333 { "REPORT_DEMOGRAPHIC", N_("_Demographics"), GDK_KEY_F11, 0,
335
336 /* Battle Groups menu */
337 /* Note that user view: 1 - 4, internal: 0 - 3 */
338 { "BATTLE_GROUP_SELECT_0", N_("Select Battle Group 1"),
341 { "BATTLE_GROUP_ASSIGN_0", N_("Assign Battle Group 1"),
344 { "BATTLE_GROUP_APPEND_0", N_("Append to Battle Group 1"),
347 { "BATTLE_GROUP_SELECT_1", N_("Select Battle Group 2"),
350 { "BATTLE_GROUP_ASSIGN_1", N_("Assign Battle Group 2"),
353 { "BATTLE_GROUP_APPEND_1", N_("Append to Battle Group 2"),
356 { "BATTLE_GROUP_SELECT_2", N_("Select Battle Group 3"),
359 { "BATTLE_GROUP_ASSIGN_2", N_("Assign Battle Group 3"),
362 { "BATTLE_GROUP_APPEND_2", N_("Append to Battle Group 3"),
365 { "BATTLE_GROUP_SELECT_3", N_("Select Battle Group 4"),
368 { "BATTLE_GROUP_ASSIGN_3", N_("Assign Battle Group 4"),
371 { "BATTLE_GROUP_APPEND_3", N_("Append to Battle Group 4"),
374
375 { "HELP_OVERVIEW", N_("?help:Overview"), 0, 0,
377 { "HELP_PLAYING", N_("Strategy and Tactics"), 0, 0,
379 { "HELP_POLICIES", N_("Policies"), 0, 0,
381 { "HELP_TERRAIN", N_("Terrain"), 0, 0,
383 { "HELP_ECONOMY", N_("Economy"), 0, 0,
385 { "HELP_CITIES", N_("Cities"), 0, 0,
387 { "HELP_IMPROVEMENTS", N_("City Improvements"), 0, 0,
389 { "HELP_WONDERS", N_("Wonders of the World"), 0, 0,
391 { "HELP_UNITS", N_("Units"), 0, 0,
393 { "HELP_COMBAT", N_("Combat"), 0, 0,
395 { "HELP_ZOC", N_("Zones of Control"), 0, 0,
397 { "HELP_GOVERNMENT", N_("Government"), 0, 0,
399 { "HELP_DIPLOMACY", N_("Diplomacy"), 0, 0,
401 { "HELP_TECH", N_("Technology"), 0, 0,
403 { "HELP_SPACE_RACE", N_("Space Race"), 0, 0,
405 { "HELP_RULESET", N_("About Current Ruleset"), 0, 0,
407 { "HELP_TILESET", N_("About Current Tileset"), 0, 0,
409 { "HELP_MUSICSET", N_("About Current Musicset"), 0, 0,
411 { "HELP_NATIONS", N_("About Nations"), 0, 0,
413 { "HELP_CONNECTING", N_("Connecting"), 0, 0,
415 { "HELP_CONTROLS", N_("Controls"), 0, 0,
417 { "HELP_CMA", N_("Citizen Governor"), 0, 0,
419 { "HELP_CHATLINE", N_("Chatline"), 0, 0,
421 { "HELP_WORKLIST_EDITOR", N_("Worklist Editor"), 0, 0,
423 { "HELP_LANGUAGES", N_("Languages"), 0, 0,
425 { "HELP_COPYING", N_("Copying"), 0, 0,
427 { "HELP_ABOUT", N_("About Freeciv"), 0, 0,
429 { "SAVE_OPTIONS_ON_EXIT", N_("Save Options on _Exit"), 0, 0,
431 { "EDIT_MODE", N_("_Editing Mode"), GDK_KEY_e, GDK_CONTROL_MASK,
433 { "SHOW_CITY_OUTLINES", N_("Cit_y Outlines"), GDK_KEY_y, GDK_CONTROL_MASK,
435 { "SHOW_CITY_OUTPUT", N_("City Output"), GDK_KEY_v, GDK_CONTROL_MASK,
437 { "SHOW_MAP_GRID", N_("Map _Grid"), GDK_KEY_g, GDK_CONTROL_MASK,
439 { "SHOW_NATIONAL_BORDERS", N_("National _Borders"), GDK_KEY_b, GDK_CONTROL_MASK,
441 { "SHOW_NATIVE_TILES", N_("Native Tiles"), GDK_KEY_n, GDK_CONTROL_MASK | GDK_SHIFT_MASK,
443 { "SHOW_CITY_FULL_BAR", N_("City Full Bar"), 0, 0,
445 { "SHOW_CITY_NAMES", N_("City _Names"), GDK_KEY_n, GDK_CONTROL_MASK,
447 { "SHOW_CITY_GROWTH", N_("City G_rowth"), GDK_KEY_o, GDK_CONTROL_MASK,
449 { "SHOW_CITY_PRODUCTIONS", N_("City _Production"), GDK_KEY_p, GDK_CONTROL_MASK,
451 { "SHOW_CITY_BUY_COST", N_("City Buy Cost"), 0, 0,
453 { "SHOW_CITY_TRADE_ROUTES", N_("City Tra_deroutes"), GDK_KEY_d, GDK_CONTROL_MASK,
455 { "SHOW_TERRAIN", N_("_Terrain"), 0, 0,
457 { "SHOW_COASTLINE", N_("C_oastline"), 0, 0,
459 { "SHOW_PATHS", N_("_Paths"), 0, 0,
461 { "SHOW_IRRIGATION", N_("_Irrigation"), 0, 0,
463 { "SHOW_MINES", N_("_Mines"), 0, 0,
465 { "SHOW_BASES", N_("_Bases"), 0, 0,
467 { "SHOW_RESOURCES", N_("_Resources"), 0, 0,
469 { "SHOW_HUTS", N_("_Huts"), 0, 0,
471 { "SHOW_POLLUTION", N_("Po_llution & Fallout"), 0, 0,
473 { "SHOW_CITIES", N_("Citi_es"), 0, 0,
475 { "SHOW_UNITS", N_("_Units"), 0, 0,
477 { "SHOW_UNIT_SOLID_BG", N_("Unit Solid Background"), 0, 0,
479 { "SHOW_UNIT_SHIELDS", N_("Unit shields"), 0, 0,
481 { "SHOW_STACK_SIZE", N_("Unit Stack Size"),
484 { "SHOW_FOCUS_UNIT", N_("Focu_s Unit"), 0, 0,
486 { "SHOW_FOG_OF_WAR", N_("Fog of _War"), 0, 0,
488 { "FULL_SCREEN", N_("_Fullscreen"), GDK_KEY_Return, GDK_MOD1_MASK,
490
491 { "RECALC_BORDERS", N_("Recalculate _Borders"), 0, 0,
493 { "TOGGLE_FOG", N_("Toggle Fog of _War"), GDK_KEY_w,
496 { "SCENARIO_PROPERTIES", N_("Game/Scenario Properties"), 0, 0,
498 { "SAVE_SCENARIO", N_("Save Scenario"), 0, 0,
500
501 { "CENTER_VIEW", N_("_Center View"), GDK_KEY_c, 0,
503 { "REPORT_ECONOMY", N_("_Economy"), GDK_KEY_F5, 0,
505 { "REPORT_RESEARCH", N_("_Research"), GDK_KEY_F6, 0,
507 { "POLICIES", N_("_Policies..."),
510 { "REPORT_SPACESHIP", N_("_Spaceship"), GDK_KEY_F12, 0,
512 { "REPORT_ACHIEVEMENTS", N_("_Achievements"), GDK_KEY_asterisk, 0,
514
515 { "MENU_SELECT", N_("_Select"), 0, 0, NULL, MGROUP_UNIT },
516 { "MENU_UNIT", N_("_Unit"), 0, 0, NULL, MGROUP_UNIT },
517 { "MENU_WORK", N_("_Work"), 0, 0, NULL, MGROUP_UNIT },
518 { "MENU_COMBAT", N_("_Combat"), 0, 0, NULL, MGROUP_UNIT },
519 { "MENU_BUILD_BASE", N_("Build _Base"), 0, 0, NULL, MGROUP_UNIT },
520 { "MENU_BUILD_PATH", N_("Build _Path"), 0, 0, NULL, MGROUP_UNIT },
521 { "MENU_CLEAN", N_("_Clean Nuisance"), 0, 0, NULL, MGROUP_UNIT },
522 { "SELECT_SINGLE", N_("_Single Unit (Unselect Others)"), GDK_KEY_z, 0,
524 { "SELECT_ALL_ON_TILE", N_("_All On Tile"), GDK_KEY_v, 0,
526 { "SELECT_SAME_TYPE_TILE", N_("Same Type on _Tile"),
529 { "SELECT_SAME_TYPE_CONT", N_("Same Type on _Continent"),
532 { "SELECT_SAME_TYPE", N_("Same Type _Everywhere"), GDK_KEY_x, GDK_SHIFT_MASK,
534 { "SELECT_DLG", N_("Unit Selection Dialog"), 0, 0,
536 { "UNIT_WAIT", N_("_Wait"), GDK_KEY_w, 0,
538 { "UNIT_DONE", N_("_Done"), GDK_KEY_space, 0,
540 { "UNIT_GOTO", N_("_Go to"), GDK_KEY_g, 0,
542 { "MENU_GOTO_AND", N_("Go to a_nd..."), 0, 0, NULL, MGROUP_UNIT },
543 { "UNIT_GOTO_CITY", N_("Go _to/Airlift to City..."), GDK_KEY_t, 0,
545 { "UNIT_RETURN", N_("_Return to Nearest City"), GDK_KEY_g, GDK_SHIFT_MASK,
547 { "UNIT_EXPLORE", N_("Auto E_xplore"), GDK_KEY_x, 0,
549 { "UNIT_PATROL", N_("_Patrol"), GDK_KEY_q, 0,
551 { "UNIT_SENTRY", N_("_Sentry"), GDK_KEY_s, 0,
553 { "UNIT_UNSENTRY", N_("Uns_entry All On Tile"), GDK_KEY_s, GDK_SHIFT_MASK,
555 { "UNIT_BOARD", N_("_Load"), GDK_KEY_l, 0,
557 { "UNIT_DEBOARD", N_("_Unload"), GDK_KEY_u, 0,
559 { "UNIT_UNLOAD_TRANSPORTER", N_("U_nload All From Transporter"),
562 { "UNIT_HOMECITY", N_("Set _Home City"), GDK_KEY_h, 0,
564 { "UNIT_UPGRADE", N_("Upgr_ade"), GDK_KEY_u, GDK_SHIFT_MASK,
566 { "UNIT_CONVERT", N_("C_onvert"), GDK_KEY_o, GDK_SHIFT_MASK,
568 { "UNIT_DISBAND", N_("_Disband"), GDK_KEY_d, GDK_SHIFT_MASK,
570 { "BUILD_CITY", N_("_Build City"), GDK_KEY_b, 0,
572 { "AUTO_WORKER", N_("_Auto Worker"), GDK_KEY_a, 0,
574 { "BUILD_ROAD", N_("Build _Road"), GDK_KEY_r, 0,
576 { "BUILD_IRRIGATION", N_("Build _Irrigation"), GDK_KEY_i, 0,
578 { "CULTIVATE", N_("Cultivate"), GDK_KEY_i, GDK_SHIFT_MASK,
580 { "BUILD_MINE", N_("Build _Mine"), GDK_KEY_m, 0,
582 { "PLANT", N_("Plant"), GDK_KEY_m, GDK_SHIFT_MASK,
584 { "CONNECT_ROAD", N_("Connect With Roa_d"), GDK_KEY_r, GDK_CONTROL_MASK,
586 { "CONNECT_RAIL", N_("Connect With Rai_l"), GDK_KEY_l, GDK_CONTROL_MASK,
588 { "CONNECT_MAGLEV", N_("Connect With _Maglev"), GDK_KEY_m, GDK_CONTROL_MASK,
590 { "CONNECT_IRRIGATION", N_("Connect With Irri_gation"),
593 { "TRANSFORM_TERRAIN", N_("Transf_orm Terrain"), GDK_KEY_o, 0,
595 { "CLEAN", N_("_Clean"), GDK_KEY_p, 0,
597 { "FORTIFY", N_("Fortify"), GDK_KEY_f, 0,
599 { "BUILD_FORTRESS", N_("Build Fortress"), GDK_KEY_f, GDK_SHIFT_MASK,
601 { "BUILD_AIRBASE", N_("Build Airbase"), GDK_KEY_e, GDK_SHIFT_MASK,
603 { "DO_PARADROP", N_("P_aradrop"), GDK_KEY_j, 0,
605 { "DO_PILLAGE", N_("_Pillage"), GDK_KEY_p, GDK_SHIFT_MASK,
607 { "DIPLOMAT_ACTION", N_("_Do..."), GDK_KEY_d, 0,
609
610 { "MENU_GOVERNMENT", N_("_Government"), 0, 0,
612 { "TAX_RATE", N_("_Tax Rates..."), GDK_KEY_t, GDK_CONTROL_MASK,
614 { "START_REVOLUTION", N_("_Revolution..."),
617 { NULL }
618};
619
620static struct menu_entry_info *menu_entry_info_find(const char *key);
621
622/************************************************************************/
629
630/************************************************************************/
637
638/************************************************************************/
642{
643 option_dialog_popup(_("Set local options"), client_optset);
644}
645
646/************************************************************************/
653
654/************************************************************************/
658{
659 option_dialog_popup(_("Game Settings"), server_optset);
660}
661
662/************************************************************************/
669
670/************************************************************************/
674{
676}
677
678/************************************************************************/
682{
684}
685
686/************************************************************************/
693
694/************************************************************************/
701
702/************************************************************************/
709
710/************************************************************************/
714static void leave_local_game_response(GtkWidget *dialog, gint response)
715{
716 gtk_widget_destroy(dialog);
717 if (response == GTK_RESPONSE_OK) {
718 /* It might be killed already */
719 if (client.conn.used) {
720 /* It will also kill the server */
722 }
723 }
724}
725
726/************************************************************************/
730{
731 if (is_server_running()) {
732 GtkWidget* dialog =
735 _("Leaving a local game will end it!"));
736 setup_dialog(dialog, toplevel);
738 g_signal_connect(dialog, "response",
741 } else {
743 }
744}
745
746/************************************************************************/
750{
752}
753
754/************************************************************************/
758{
760}
761
762/************************************************************************/
769
770/************************************************************************/
774{
776}
777
778/************************************************************************/
785
786/************************************************************************/
797
798/************************************************************************/
805
806/************************************************************************/
813
814/************************************************************************/
821
822/************************************************************************/
829
830/************************************************************************/
837
838/************************************************************************/
845
846/************************************************************************/
853
854/************************************************************************/
861
862/************************************************************************/
869
870/************************************************************************/
877
878/************************************************************************/
885
886/************************************************************************/
893
894/************************************************************************/
901
902/************************************************************************/
909
910/************************************************************************/
917
918/************************************************************************/
925
926/************************************************************************/
933
934/************************************************************************/
941
942/************************************************************************/
949
950/************************************************************************/
957
958/************************************************************************/
965
966/************************************************************************/
973
974/************************************************************************/
981
982/************************************************************************/
989
990/************************************************************************/
997
998/************************************************************************/
1005
1006/************************************************************************/
1013
1014/************************************************************************/
1021
1022/************************************************************************/
1029
1030/************************************************************************/
1037
1038/************************************************************************/
1045
1046/************************************************************************/
1053
1054/************************************************************************/
1061
1062/************************************************************************/
1069
1070/************************************************************************/
1077
1078/************************************************************************/
1085
1086/************************************************************************/
1093
1094/************************************************************************/
1101
1102/************************************************************************/
1109
1110/************************************************************************/
1117
1118/************************************************************************/
1125
1126/************************************************************************/
1133
1134/************************************************************************/
1141
1142/************************************************************************/
1149
1150/************************************************************************/
1158
1159/************************************************************************/
1163{
1166 /* Unreachable techs in reqtree on/off */
1168 }
1169}
1170
1171/************************************************************************/
1181
1182/************************************************************************/
1192
1193/************************************************************************/
1203
1204/************************************************************************/
1214
1215/************************************************************************/
1225
1226/************************************************************************/
1237
1238/************************************************************************/
1249
1250/************************************************************************/
1260
1261/************************************************************************/
1272
1273/************************************************************************/
1283
1284/************************************************************************/
1294
1295/************************************************************************/
1305
1306/************************************************************************/
1315
1316/************************************************************************/
1325
1326/************************************************************************/
1335
1336/************************************************************************/
1345
1346/************************************************************************/
1355
1356/************************************************************************/
1365
1366/************************************************************************/
1375
1376/************************************************************************/
1385
1386/************************************************************************/
1395
1396/************************************************************************/
1406
1407/************************************************************************/
1417
1418/************************************************************************/
1428
1429/************************************************************************/
1439
1440/************************************************************************/
1450
1451/************************************************************************/
1461
1462/************************************************************************/
1473
1474/************************************************************************/
1481
1482/************************************************************************/
1489
1490/************************************************************************/
1501
1502/************************************************************************/
1509
1510/************************************************************************/
1517
1518/************************************************************************/
1525
1526/************************************************************************/
1533
1534/************************************************************************/
1541
1542/************************************************************************/
1549
1550/************************************************************************/
1557
1558/************************************************************************/
1562{
1564}
1565
1566/************************************************************************/
1570{
1572}
1573
1574/************************************************************************/
1578{
1579 key_unit_wait();
1580}
1581
1582/************************************************************************/
1586{
1587 key_unit_done();
1588}
1589
1590/************************************************************************/
1594{
1595 key_unit_goto();
1596}
1597
1598/************************************************************************/
1602{
1603 int sub_target = NO_TARGET;
1604 struct action *paction = g_object_get_data(G_OBJECT(item), "end_action");
1605
1607
1609 case ASTK_BUILDING:
1610 {
1612 "end_building");
1614 sub_target = improvement_number(pbuilding);
1615 }
1616 break;
1617 case ASTK_TECH:
1618 {
1620 "end_tech");
1622 sub_target = advance_number(ptech);
1623 }
1624 break;
1625 case ASTK_EXTRA:
1627 {
1628 struct extra_type *pextra = g_object_get_data(G_OBJECT(item),
1629 "end_extra");
1630 fc_assert_ret(pextra != NULL);
1631 sub_target = extra_number(pextra);
1632 }
1633 break;
1634 case ASTK_NONE:
1635 sub_target = NO_TARGET;
1636 break;
1637 case ASTK_COUNT:
1638 /* Should not exits */
1640 break;
1641 }
1642
1644}
1645
1646/************************************************************************/
1650{
1651 if (get_num_units_in_focus() > 0) {
1653 }
1654}
1655
1656/************************************************************************/
1665
1666/************************************************************************/
1673
1674/************************************************************************/
1681
1682/************************************************************************/
1689
1690/************************************************************************/
1697
1698/************************************************************************/
1707
1708/************************************************************************/
1717
1718/************************************************************************/
1726
1727/************************************************************************/
1734
1735/************************************************************************/
1742
1743/************************************************************************/
1750
1751/************************************************************************/
1758
1759/************************************************************************/
1763{
1765 /* FIXME: this can provide different items for different units...
1766 * not good! */
1767 /* Enable the button for adding to a city in all cases, so we
1768 get an eventual error message from the server if we try. */
1774 }
1776}
1777
1778/************************************************************************/
1785
1786/************************************************************************/
1790{
1792 /* FIXME: this can provide different actions for different units...
1793 * not good! */
1795 EC_ROAD,
1797 punit);
1798 bool building_road = FALSE;
1799
1800 if (tgt != NULL
1804 }
1805
1808 }
1810}
1811
1812/************************************************************************/
1819
1820/************************************************************************/
1827
1828/************************************************************************/
1835
1836/************************************************************************/
1843
1844/************************************************************************/
1848{
1850
1851 if (proad != NULL) {
1852 struct extra_type *tgt;
1853
1854 tgt = road_extra_get(proad);
1855
1857 }
1858}
1859
1860/************************************************************************/
1864{
1866
1867 if (prail != NULL) {
1868 struct extra_type *tgt;
1869
1870 tgt = road_extra_get(prail);
1871
1873 }
1874}
1875
1876/************************************************************************/
1880{
1882
1883 if (pmaglev != NULL) {
1884 struct extra_type *tgt;
1885
1886 tgt = road_extra_get(pmaglev);
1887
1889 }
1890}
1891
1892/************************************************************************/
1907
1908/************************************************************************/
1915
1916/************************************************************************/
1923
1924/************************************************************************/
1931
1932/************************************************************************/
1941
1942/************************************************************************/
1949
1950/************************************************************************/
1957
1958/************************************************************************/
1965
1966/************************************************************************/
1973
1974/************************************************************************/
1981
1982/************************************************************************/
1989
1990/************************************************************************/
1997
1998/************************************************************************/
2009
2010/************************************************************************/
2022
2023/************************************************************************/
2037
2038/************************************************************************/
2045
2046/************************************************************************/
2053
2054/************************************************************************/
2061
2062/************************************************************************/
2069
2070/************************************************************************/
2077
2078/************************************************************************/
2087
2088/************************************************************************/
2092{
2093 const char *key = gtk_buildable_get_name(item);
2095
2096 if (info != NULL) {
2098 Q_(info->name));
2100 if (info->cb != NULL) {
2101 g_signal_connect(item, "activate", info->cb, NULL);
2102 }
2103
2104 if (info->accel != 0) {
2105 const char *path = gtk_menu_item_get_accel_path(GTK_MENU_ITEM(item));
2106
2107 if (path == NULL) {
2108 char buf[512];
2109
2110 fc_snprintf(buf, sizeof(buf), "<MENU>/%s", key);
2112 path = buf; /* Not NULL, but not usable either outside this block */
2113 }
2114
2115 if (path != NULL) {
2117 info->accel, info->accel_mod);
2118 }
2119 }
2120
2121 return;
2122 }
2123
2124 /* temporary naming solution */
2126}
2127
2128/************************************************************************/
2131static const gchar *get_ui_filename(void)
2132{
2133 static char filename[256];
2134 const char *name;
2135
2136 if ((name = getenv("FREECIV_MENUS"))
2137 || (name = fileinfoname(get_data_dirs(), "gtk3.22_menus.xml"))) {
2138 sz_strlcpy(filename, name);
2139 } else {
2140 log_error("Gtk menus: file definition not found");
2141 filename[0] = '\0';
2142 }
2143
2144 log_verbose("ui menu file is \"%s\".", filename);
2145 return filename;
2146}
2147
2148/************************************************************************/
2152{
2154 GError *error = NULL;
2155
2158 log_error("Gtk menus: %s", error->message);
2159 g_error_free(error);
2160 } else {
2161 GSList *entries;
2162 GSList *next;
2163
2165 next = entries;
2166
2167 while (next != NULL) {
2168 GObject *obj = next->data;
2169
2170 if (GTK_IS_MENU_ITEM(obj)) {
2173 }
2174 } else if (GTK_IS_MENU(obj)) {
2176
2177 if (key[0] == '<') {
2179
2180 if (ac_group == NULL) {
2183 }
2184
2186
2188 }
2189 }
2190
2191 next = next->next;
2192 }
2193
2195
2199 }
2200
2201#ifndef FREECIV_DEBUG
2202 menu_entry_set_visible("RELOAD_TILESET", FALSE, FALSE);
2203#endif /* FREECIV_DEBUG */
2204
2205 return menubar;
2206}
2207
2208/************************************************************************/
2211static struct menu_entry_info *menu_entry_info_find(const char *key)
2212{
2213 int i;
2214
2215 for (i = 0; menu_entries[i].key != NULL; i++) {
2216 if (!strcmp(key, menu_entries[i].key)) {
2217 return &(menu_entries[i]);
2218 }
2219 }
2220
2221 return NULL;
2222}
2223
2224/************************************************************************/
2236
2237/************************************************************************/
2249
2250/************************************************************************/
2255{
2256 int i;
2257
2258 for (i = 0; menu_entries[i].key != NULL; i++) {
2259 if (menu_entries[i].grouping == group || group == MGROUP_ALL) {
2261 }
2262 }
2263}
2264
2265/************************************************************************/
2268#ifndef FREECIV_DEBUG
2269static void menu_entry_set_visible(const char *key,
2270 gboolean is_visible,
2272{
2274
2275 if (item != NULL) {
2276 gtk_widget_set_visible(item, is_visible);
2278 }
2279}
2280#endif /* FREECIV_DEBUG */
2281
2282/************************************************************************/
2285static void menus_rename(const char *key,
2286 const gchar *new_label)
2287{
2289
2290 if (item != NULL) {
2292 }
2293}
2294
2295/************************************************************************/
2298static GtkMenu *find_menu(const char *key)
2299{
2301}
2302
2303/************************************************************************/
2307{
2308 /* The "full" city bar (i.e. the new way of drawing the
2309 * city name), can draw the city growth even without drawing
2310 * the city name. But the old method cannot. */
2312 menu_entry_set_sensitive("SHOW_CITY_GROWTH", TRUE);
2313 menu_entry_set_sensitive("SHOW_CITY_TRADE_ROUTES", TRUE);
2314 } else {
2316 menu_entry_set_sensitive("SHOW_CITY_TRADE_ROUTES",
2318 }
2319
2320 menu_entry_set_sensitive("SHOW_CITY_BUY_COST",
2323 menu_entry_set_sensitive("SHOW_UNIT_SOLID_BG",
2325 menu_entry_set_sensitive("SHOW_UNIT_SHIELDS",
2327 menu_entry_set_sensitive("SHOW_STACK_SIZE",
2329 menu_entry_set_sensitive("SHOW_FOCUS_UNIT", !gui_options.draw_units);
2330}
2331
2332/************************************************************************/
2338static const char *get_tile_change_menu_text(struct tile *ptile,
2339 enum unit_activity activity)
2340{
2341 struct tile *newtile = tile_virtual_new(ptile);
2342 const char *text;
2343
2344 tile_apply_activity(newtile, activity, NULL);
2345 text = tile_get_info_text(newtile, FALSE, 0);
2347 return text;
2348}
2349
2350/************************************************************************/
2354{
2355 struct unit_list *punits = NULL;
2357 GtkMenu *menu;
2358 char acttext[128], irrtext[128], mintext[128], transtext[128];
2359 char cultext[128], plantext[128];
2360 struct terrain *pterrain;
2361 bool conn_possible;
2362 struct road_type *proad;
2363 struct extra_type_list *extras;
2364
2365 if (ui_builder == NULL || !can_client_change_view()) {
2366 return;
2367 }
2368
2369 if (get_num_units_in_focus() > 0) {
2370 const struct tile *ptile = NULL;
2371 const struct unit_type *ptype = NULL;
2372
2375 fc_assert((ptile == NULL) == (ptype == NULL));
2376
2377 if (ptile || ptype) {
2378 if (unit_tile(punit) != ptile) {
2380 }
2381 if (unit_type_get(punit) != ptype) {
2383 }
2384 } else {
2385 ptile = unit_tile(punit);
2387 }
2389 }
2390
2393 && !editor_is_active());
2395 && !editor_is_active() && punits != NULL);
2396
2398 menu_entry_set_sensitive("EDIT_MODE",
2403 menu_entry_set_sensitive("INFRA_DLG", terrain_control.infrapoints);
2404
2405 {
2406 char road_buf[500];
2407
2409 if (proad != NULL) {
2410 /* TRANS: Connect with some road type (Road/Railroad) */
2411 snprintf(road_buf, sizeof(road_buf), _("Connect With %s"),
2413 menus_rename("CONNECT_ROAD", road_buf);
2414 }
2415
2417 if (proad != NULL) {
2418 snprintf(road_buf, sizeof(road_buf), _("Connect With %s"),
2420 menus_rename("CONNECT_RAIL", road_buf);
2421 }
2422
2424 if (proad != NULL) {
2425 snprintf(road_buf, sizeof(road_buf), _("Connect With %s"),
2427 menus_rename("CONNECT_MAGLEV", road_buf);
2428 }
2429 }
2430
2431 {
2432 char top_cities_buf[128];
2433
2434 if (game.info.top_cities_count > 0) {
2436 PL_("Top %d City", "Top %d Cities",
2439 menus_rename("REPORT_TOP_CITIES", top_cities_buf);
2440 } else {
2441 menus_rename("REPORT_TOP_CITIES", _("Top Cities"));
2442 }
2443
2444 menu_entry_set_sensitive("REPORT_TOP_CITIES", game.info.top_cities_count > 0);
2445 }
2446
2447 menu_entry_set_sensitive("REPORT_SPACESHIP",
2448 client_player() != NULL && client_player()->spaceship.state != SSHIP_NONE);
2449
2450 if (!can_client_issue_orders()) {
2451 return;
2452 }
2453
2454 /* Set government sensitivity. */
2455 if ((menu = find_menu("<MENU>/GOVERNMENT"))) {
2456 GList *list, *iter;
2457 struct government *pgov;
2458
2460 for (iter = list; NULL != iter; iter = g_list_next(iter)) {
2461 pgov = g_object_get_data(G_OBJECT(iter->data), "government");
2462 if (NULL != pgov) {
2465 pgov));
2466 } else {
2467 /* Revolution without target government */
2470 }
2471 }
2473 }
2474
2475 if (!punits) {
2476 return;
2477 }
2478
2479 /* Remaining part of this function: Update Unit, Work, and Combat menus */
2480
2481 /* Set base sensitivity. */
2482 if ((menu = find_menu("<MENU>/BUILD_BASE"))) {
2483 GList *list, *iter;
2484 struct extra_type *pextra;
2485
2487 for (iter = list; NULL != iter; iter = g_list_next(iter)) {
2488 pextra = g_object_get_data(G_OBJECT(iter->data), "base");
2489 if (NULL != pextra) {
2493 pextra));
2494 }
2495 }
2497 }
2498
2499 /* Set road sensitivity. */
2500 if ((menu = find_menu("<MENU>/BUILD_PATH"))) {
2501 GList *list, *iter;
2502 struct extra_type *pextra;
2503
2505 for (iter = list; NULL != iter; iter = g_list_next(iter)) {
2506 pextra = g_object_get_data(G_OBJECT(iter->data), "road");
2507 if (NULL != pextra) {
2511 pextra));
2512 }
2513 }
2515 }
2516
2517 /* Set cleaning menu sensitivity. */
2518 if ((menu = find_menu("<MENU>/CLEAN"))) {
2519 GList *list, *iter;
2520 struct extra_type *pextra;
2521
2523 for (iter = list; NULL != iter; iter = g_list_next(iter)) {
2524 pextra = g_object_get_data(G_OBJECT(iter->data), "nuisance");
2525 if (NULL != pextra) {
2529 pextra));
2530 }
2531 }
2533 }
2534
2535 /* Set Go to and... action visibility. */
2536 if ((menu = find_menu("<MENU>/GOTO_AND"))) {
2537 GList *list, *iter;
2538 struct action *paction;
2539
2540 bool can_do_something = FALSE;
2541
2542 /* Enable a menu item if it is theoretically possible that one of the
2543 * selected units can perform it. Checking if the action can be performed
2544 * at the current tile is pointless since it should be performed at the
2545 * target tile. */
2547 for (iter = list; NULL != iter; iter = g_list_next(iter)) {
2548 paction = g_object_get_data(G_OBJECT(iter->data), "end_action");
2549 if (NULL != paction) {
2551 paction->id, TRUE)) {
2555 } else {
2558 }
2559 }
2560 }
2562
2563 /* Only sensitive if an action may be possible. */
2565 }
2566
2567 /* Enable the button for adding to a city in all cases, so we
2568 * get an eventual error message from the server if we try. */
2569 menu_entry_set_sensitive("BUILD_CITY",
2573 menu_entry_set_sensitive("BUILD_ROAD",
2577 menu_entry_set_sensitive("BUILD_IRRIGATION",
2579 menu_entry_set_sensitive("CULTIVATE",
2581 menu_entry_set_sensitive("BUILD_MINE",
2585 menu_entry_set_sensitive("TRANSFORM_TERRAIN",
2587 menu_entry_set_sensitive("FORTIFY",
2590 menu_entry_set_sensitive("BUILD_FORTRESS",
2592 menu_entry_set_sensitive("BUILD_AIRBASE",
2596 menu_entry_set_sensitive("UNIT_SENTRY",
2598 menu_entry_set_sensitive("DO_PARADROP",
2600 /* FIXME: should conditionally rename "Pillage" to "Pillage..." in cases
2601 * where selecting the command results in a dialog box listing options of
2602 * what to pillage */
2603 menu_entry_set_sensitive("DO_PILLAGE",
2605 menu_entry_set_sensitive("UNIT_DISBAND",
2607 TRUE));
2608 menu_entry_set_sensitive("UNIT_UPGRADE",
2610 /* "UNIT_CONVERT" dealt with below */
2611 menu_entry_set_sensitive("UNIT_HOMECITY",
2613 menu_entry_set_sensitive("UNIT_UNLOAD_TRANSPORTER",
2615 menu_entry_set_sensitive("UNIT_BOARD",
2617 menu_entry_set_sensitive("UNIT_DEBOARD",
2619 menu_entry_set_sensitive("UNIT_UNSENTRY",
2622 menu_entry_set_sensitive("AUTO_WORKER",
2624 menu_entry_set_sensitive("UNIT_EXPLORE",
2626
2628 if (proad != NULL) {
2629 struct extra_type *tgt;
2630
2631 tgt = road_extra_get(proad);
2632
2634 } else {
2636 }
2637 menu_entry_set_sensitive("CONNECT_ROAD", conn_possible);
2638
2640 if (proad != NULL) {
2641 struct extra_type *tgt;
2642
2643 tgt = road_extra_get(proad);
2644
2646 } else {
2648 }
2649 menu_entry_set_sensitive("CONNECT_RAIL", conn_possible);
2650
2652 if (proad != NULL) {
2653 struct extra_type *tgt;
2654
2655 tgt = road_extra_get(proad);
2656
2658 } else {
2660 }
2661 menu_entry_set_sensitive("CONNECT_MAGLEV", conn_possible);
2662
2664
2665 if (extra_type_list_size(extras) > 0) {
2666 struct extra_type *tgt;
2667
2668 tgt = extra_type_list_get(extras, 0);
2670 } else {
2672 }
2673 menu_entry_set_sensitive("CONNECT_IRRIGATION", conn_possible);
2674
2675 menu_entry_set_sensitive("DIPLOMAT_ACTION",
2677
2679 menus_rename("BUILD_CITY",
2681 } else {
2682 bool city_on_tile = FALSE;
2683
2684 /* FIXME: this overloading doesn't work well with multiple focus
2685 * units. */
2687 if (tile_city(unit_tile(punit))) {
2689 break;
2690 }
2692
2694 TRUE)) {
2695 menus_rename("BUILD_CITY",
2697 } else {
2698 /* refresh default order */
2699 menus_rename("BUILD_CITY",
2701 }
2702 }
2703
2705 menus_rename("BUILD_ROAD",
2708 char road_item[500];
2709 struct extra_type *pextra = NULL;
2710
2711 /* FIXME: this overloading doesn't work well with multiple focus
2712 * units. */
2716 if (pextra != NULL) {
2717 break;
2718 }
2720
2721 if (pextra != NULL) {
2722 /* TRANS: Build road of specific type (Road/Railroad/Maglev) */
2723 snprintf(road_item, sizeof(road_item), _("Build %s"),
2724 extra_name_translation(pextra));
2725 menus_rename("BUILD_ROAD", road_item);
2726 }
2727 } else {
2728 menus_rename("BUILD_ROAD", _("Build _Road"));
2729 }
2730
2731 if (units_all_same_type) {
2732 struct unit *punit = unit_list_get(punits, 0);
2733 const struct unit_type *to_unittype =
2735 if (to_unittype) {
2736 /* TRANS: %s is a unit type. */
2737 fc_snprintf(acttext, sizeof(acttext), _("Upgr_ade to %s"),
2740 unit_type_get(punit))));
2741 } else {
2742 acttext[0] = '\0';
2743 }
2744 } else {
2745 acttext[0] = '\0';
2746 }
2747 if ('\0' != acttext[0]) {
2748 menus_rename("UNIT_UPGRADE", acttext);
2749 } else {
2750 menus_rename("UNIT_UPGRADE", _("Upgr_ade"));
2751 }
2752
2753 if (units_can_convert(&(wld.map), punits)) {
2754 menu_entry_set_sensitive("UNIT_CONVERT", TRUE);
2755 if (units_all_same_type) {
2756 struct unit *punit = unit_list_get(punits, 0);
2757
2758 /* TRANS: %s is a unit type. */
2759 fc_snprintf(acttext, sizeof(acttext), _("C_onvert to %s"),
2761 } else {
2762 acttext[0] = '\0';
2763 }
2764 } else {
2765 menu_entry_set_sensitive("UNIT_CONVERT", FALSE);
2766 acttext[0] = '\0';
2767 }
2768 if ('\0' != acttext[0]) {
2769 menus_rename("UNIT_CONVERT", acttext);
2770 } else {
2771 menus_rename("UNIT_CONVERT", _("C_onvert"));
2772 }
2773
2774 if (units_all_same_tile) {
2775 struct unit *first = unit_list_get(punits, 0);
2776
2777 pterrain = tile_terrain(unit_tile(first));
2778
2780 struct extra_type *pextra = NULL;
2781
2782 /* FIXME: this overloading doesn't work well with multiple focus
2783 * units. */
2787 if (pextra != NULL) {
2788 break;
2789 }
2791
2792 if (pextra != NULL) {
2793 /* TRANS: Build irrigation of specific type */
2794 snprintf(irrtext, sizeof(irrtext), _("Build %s"),
2795 extra_name_translation(pextra));
2796 } else {
2797 sz_strlcpy(irrtext, _("Build _Irrigation"));
2798 }
2799 } else {
2800 sz_strlcpy(irrtext, _("Build _Irrigation"));
2801 }
2802
2803 if (pterrain->cultivate_result != T_NONE) {
2804 fc_snprintf(cultext, sizeof(cultext), _("Change to %s"),
2807 } else {
2808 sz_strlcpy(cultext, _("_Cultivate"));
2809 }
2810
2812 struct extra_type *pextra = NULL;
2813
2814 /* FIXME: this overloading doesn't work well with multiple focus
2815 * units. */
2819 if (pextra != NULL) {
2820 break;
2821 }
2823
2824 if (pextra != NULL) {
2825 /* TRANS: Build mine of specific type */
2826 snprintf(mintext, sizeof(mintext), _("Build %s"),
2827 extra_name_translation(pextra));
2828 } else {
2829 sz_strlcpy(mintext, _("Build _Mine"));
2830 }
2831 } else {
2832 sz_strlcpy(mintext, _("Build _Mine"));
2833 }
2834
2835 if (pterrain->plant_result != T_NONE) {
2836 fc_snprintf(plantext, sizeof(plantext), _("Change to %s"),
2838 } else {
2839 sz_strlcpy(plantext, _("_Plant"));
2840 }
2841
2842 if (pterrain->transform_result != T_NONE
2843 && pterrain->transform_result != pterrain) {
2844 fc_snprintf(transtext, sizeof(transtext), _("Transf_orm to %s"),
2847 } else {
2848 sz_strlcpy(transtext, _("Transf_orm Terrain"));
2849 }
2850 } else {
2851 sz_strlcpy(irrtext, _("Build _Irrigation"));
2852 sz_strlcpy(cultext, _("_Cultivate"));
2853 sz_strlcpy(mintext, _("Build _Mine"));
2854 sz_strlcpy(plantext, _("_Plant"));
2855 sz_strlcpy(transtext, _("Transf_orm Terrain"));
2856 }
2857
2858 menus_rename("BUILD_IRRIGATION", irrtext);
2859 menus_rename("CULTIVATE", cultext);
2860 menus_rename("BUILD_MINE", mintext);
2861 menus_rename("PLANT", plantext);
2862 menus_rename("TRANSFORM_TERRAIN", transtext);
2863
2864 menus_rename("UNIT_HOMECITY",
2866}
2867
2868/************************************************************************/
2872 const guint accel_key,
2874{
2875 const char *path = gtk_menu_item_get_accel_path(GTK_MENU_ITEM(item));
2876
2877 if (path == NULL) {
2878 char buf[MAX_LEN_NAME + sizeof("<MENU>/GOTO_AND/")];
2879
2880 fc_snprintf(buf, sizeof(buf), "<MENU>/GOTO_AND/%s",
2881 action_id_rule_name(act_id));
2883 path = buf; /* Not NULL, but not usable either outside this block */
2884 }
2885
2886 if (path != NULL) {
2889 }
2890}
2891
2892/************************************************************************/
2910
2911/************************************************************************/
2916{
2917 GtkMenu *menu;
2918
2919 if (ui_builder == NULL) {
2920 return;
2921 }
2922
2923 menu_entry_set_sensitive("GAME_SAVE_AS",
2925 && C_S_RUNNING <= client_state());
2926 menu_entry_set_sensitive("GAME_SAVE",
2928 && C_S_RUNNING <= client_state());
2929
2930 menu_entry_set_active("SAVE_OPTIONS_ON_EXIT",
2933
2936
2937 if (!can_client_change_view()) {
2939
2940 return;
2941 }
2942
2943 menus_rename("BUILD_FORTRESS", Q_(terrain_control.gui_type_base0));
2944 menus_rename("BUILD_AIRBASE", Q_(terrain_control.gui_type_base1));
2945
2946 if ((menu = find_menu("<MENU>/GOVERNMENT"))) {
2947 GList *list, *iter;
2948 GtkWidget *item;
2949 char buf[256];
2950
2951 /* Remove previous government entries. */
2953 for (iter = list; NULL != iter; iter = g_list_next(iter)) {
2954 if (g_object_get_data(G_OBJECT(iter->data), "government") != NULL
2955 || GTK_IS_SEPARATOR_MENU_ITEM(iter->data)) {
2957 }
2958 }
2960
2961 /* Add new government entries. */
2965
2968 /* TRANS: %s is a government name */
2969 fc_snprintf(buf, sizeof(buf), _("%s..."),
2972 g_object_set_data(G_OBJECT(item), "government", g);
2973 g_signal_connect(item, "activate",
2977 }
2979 }
2980
2981 if ((menu = find_menu("<MENU>/BUILD_BASE"))) {
2982 GList *list, *iter;
2983 GtkWidget *item;
2984
2985 /* Remove previous base entries. */
2987 for (iter = list; NULL != iter; iter = g_list_next(iter)) {
2989 }
2991
2992 /* Add new base entries. */
2994 if (pextra->buildable) {
2996 g_object_set_data(G_OBJECT(item), "base", pextra);
2997 g_signal_connect(item, "activate", G_CALLBACK(base_callback), pextra);
3000 }
3002 }
3003
3004 if ((menu = find_menu("<MENU>/BUILD_PATH"))) {
3005 GList *list, *iter;
3006 GtkWidget *item;
3007
3008 /* Remove previous road entries. */
3010 for (iter = list; NULL != iter; iter = g_list_next(iter)) {
3012 }
3014
3015 /* Add new road entries. */
3017 if (pextra->buildable) {
3019 g_object_set_data(G_OBJECT(item), "road", pextra);
3020 g_signal_connect(item, "activate", G_CALLBACK(road_callback), pextra);
3023 }
3025 }
3026
3027 if ((menu = find_menu("<MENU>/CLEAN"))) {
3028 GList *list, *iter;
3029 GtkWidget *item;
3030
3031 /* Remove previous cleaning entries. */
3033 for (iter = list; NULL != iter; iter = g_list_next(iter)) {
3035 }
3037
3038 /* Add new cleaning entries. */
3041 g_object_set_data(G_OBJECT(item), "nuisance", pextra);
3042 g_signal_connect(item, "activate", G_CALLBACK(clean_callback), pextra);
3046 }
3047
3048 /* Initialize the Go to and... actions. */
3049 if ((menu = find_menu("<MENU>/GOTO_AND"))) {
3050 GtkWidget *item;
3051 int tgt_kind_group;
3052
3053 /* Remove previous action entries. */
3055
3056 /* Add the new action entries grouped by target kind. */
3059 struct action *paction = action_by_number(act_id);
3060
3061 if (action_id_get_actor_kind(act_id) != AAK_UNIT) {
3062 /* This action isn't performed by a unit. */
3063 continue;
3064 }
3065
3067 /* Wrong group. */
3068 continue;
3069 }
3070
3071 /* Create and add the menu item. It will be hidden or shown based on
3072 * unit type. */
3074 action_get_ui_name_mnemonic(act_id, "_"));
3075 g_object_set_data(G_OBJECT(item), "end_action", paction);
3076
3077 if (action_id_has_complex_target(act_id)) {
3079
3080#define CREATE_SUB_ITEM(_sub_target_, _sub_target_key_, _sub_target_name_) \
3081 GtkWidget *sub_item = gtk_menu_item_new_with_label(_sub_target_name_); \
3082 g_object_set_data(G_OBJECT(sub_item), "end_action", paction); \
3083 g_object_set_data(G_OBJECT(sub_item), _sub_target_key_, _sub_target_); \
3084 g_signal_connect(sub_item, "activate", \
3085 G_CALLBACK(unit_goto_and_callback), paction); \
3086 gtk_menu_shell_append(GTK_MENU_SHELL(sub_target_menu), sub_item); \
3087 gtk_widget_show(sub_item);
3088
3090 case ASTK_BUILDING:
3092 CREATE_SUB_ITEM(pimpr, "end_building",
3095 break;
3096 case ASTK_TECH:
3098 CREATE_SUB_ITEM(ptech, "end_tech",
3101 break;
3102 case ASTK_EXTRA:
3104 extra_type_iterate(pextra) {
3105 if (!actres_creates_extra(paction->result, pextra)
3106 && !actres_removes_extra(paction->result, pextra)) {
3107 /* Not relevant */
3108 continue;
3109 }
3110 CREATE_SUB_ITEM(pextra, "end_extra",
3111 extra_name_translation(pextra));
3113 break;
3114 case ASTK_NONE:
3115 /* Should not be here. */
3117 break;
3118 case ASTK_COUNT:
3119 /* Should not exits */
3121 break;
3122 }
3123
3124#undef CREATE_SUB_ITEM
3125
3127 } else {
3128 g_signal_connect(item, "activate",
3130
3131#define ADD_OLD_ACCELERATOR(wanted_action_id, accel_key, accel_mods) \
3132 if (act_id == wanted_action_id) { \
3133 menu_unit_goto_and_add_accel(item, act_id, accel_key, accel_mods); \
3134 }
3135
3136 /* Add the keyboard shortcuts for "Go to and..." menu items that
3137 * existed independently before the "Go to and..." menu arrived.
3138 */
3142 }
3143
3147 }
3148 }
3149
3152
3153 menu_entry_set_sensitive("TAX_RATE",
3156 menu_entry_set_sensitive("POLICIES",
3157 multiplier_count() > 0);
3158
3159 menu_entry_set_active("SHOW_CITY_OUTLINES",
3161 menu_entry_set_active("SHOW_CITY_OUTPUT",
3163 menu_entry_set_active("SHOW_MAP_GRID",
3165 menu_entry_set_active("SHOW_NATIONAL_BORDERS",
3167 menu_entry_set_sensitive("SHOW_NATIONAL_BORDERS",
3169 menu_entry_set_active("SHOW_NATIVE_TILES",
3171 menu_entry_set_active("SHOW_CITY_FULL_BAR",
3173 menu_entry_set_active("SHOW_CITY_NAMES",
3175 menu_entry_set_active("SHOW_CITY_GROWTH",
3177 menu_entry_set_active("SHOW_CITY_PRODUCTIONS",
3179 menu_entry_set_active("SHOW_CITY_BUY_COST",
3181 menu_entry_set_active("SHOW_CITY_TRADE_ROUTES",
3183 menu_entry_set_active("SHOW_TERRAIN",
3185 menu_entry_set_active("SHOW_COASTLINE",
3187 menu_entry_set_active("SHOW_PATHS",
3189 menu_entry_set_active("SHOW_IRRIGATION",
3191 menu_entry_set_active("SHOW_MINES",
3193 menu_entry_set_active("SHOW_BASES",
3195 menu_entry_set_active("SHOW_RESOURCES",
3197 menu_entry_set_active("SHOW_HUTS",
3199 menu_entry_set_active("SHOW_POLLUTION",
3201 menu_entry_set_active("SHOW_CITIES",
3203 menu_entry_set_active("SHOW_UNITS",
3205 menu_entry_set_active("SHOW_UNIT_SOLID_BG",
3207 menu_entry_set_active("SHOW_UNIT_SHIELDS",
3209 menu_entry_set_active("SHOW_STACK_SIZE",
3211 menu_entry_set_active("SHOW_FOCUS_UNIT",
3213 menu_entry_set_active("SHOW_FOG_OF_WAR",
3215
3217
3219}
3220
3221/**************************************************************************
3222 Free resources allocated by the menu system.
3223**************************************************************************/
3224void menus_free(void)
3225{
3226 if (ui_builder != NULL) {
3228 ui_builder = NULL;
3229 }
3230}
const char * action_id_rule_name(action_id act_id)
Definition actions.c:1239
enum action_sub_target_kind action_get_sub_target_kind(const struct action *paction)
Definition actions.c:1119
const char * action_get_ui_name_mnemonic(action_id act_id, const char *mnemonic)
Definition actions.c:1258
#define action_noninternal_iterate_end
Definition actions.h:236
static struct action * action_by_number(action_id act_id)
Definition actions.h:396
#define action_id_get_actor_kind(act_id)
Definition actions.h:409
#define ACTION_ANY
Definition actions.h:52
#define action_noninternal_iterate(_act_)
Definition actions.h:231
#define action_id_get_target_kind(act_id)
Definition actions.h:413
#define action_id_has_complex_target(act_id)
Definition actions.h:431
bool actres_removes_extra(enum action_result result, const struct extra_type *pextra)
Definition actres.c:810
bool actres_creates_extra(enum action_result result, const struct extra_type *pextra)
Definition actres.c:789
struct @130::my_agent entries[MAX_AGENTS]
struct civclient client
enum client_states client_state(void)
void send_report_request(enum report_type type)
bool can_client_issue_orders(void)
bool client_has_player(void)
bool can_client_change_view(void)
#define client_player()
@ C_S_RUNNING
Definition client_main.h:47
bool can_units_do_connect(struct unit_list *punits, enum unit_activity activity, struct extra_type *tgt)
Definition climisc.c:1242
static struct fc_sockaddr_list * list
Definition clinet.c:102
void disconnect_from_server(bool leaving_sound)
Definition clinet.c:306
char * incite_cost
Definition comments.c:76
@ REPORT_WONDERS_OF_THE_WORLD
Definition conn_types.h:50
@ REPORT_DEMOGRAPHIC
Definition conn_types.h:53
@ REPORT_WONDERS_OF_THE_WORLD_LONG
Definition conn_types.h:51
@ REPORT_ACHIEVEMENTS
Definition conn_types.h:54
@ REPORT_TOP_CITIES
Definition conn_types.h:52
void send_save_game(const char *filename)
bool is_server_running(void)
bool can_client_access_hack(void)
bool can_conn_enable_editing(const struct connection *pconn)
Definition connection.c:521
void key_coastline_toggle(void)
Definition control.c:3952
void key_irrigation_toggle(void)
Definition control.c:3968
void key_unit_sentry(void)
Definition control.c:3756
void key_city_output_toggle(void)
Definition control.c:3853
void request_unit_return(struct unit *punit)
Definition control.c:1552
void request_unit_fortify(struct unit *punit)
Definition control.c:2353
void key_editor_recalculate_borders(void)
Definition control.c:4072
void request_unit_caravan_action(struct unit *punit, action_id action)
Definition control.c:2223
void key_focus_unit_toggle(void)
Definition control.c:4048
void key_unit_auto_explore(void)
Definition control.c:3577
void key_unit_connect(enum unit_activity activity, struct extra_type *tgt)
Definition control.c:3375
void key_city_full_bar_toggle(void)
Definition control.c:3885
void key_bases_toggle(void)
Definition control.c:3984
void key_map_native_toggle(void)
Definition control.c:3877
void key_resources_toggle(void)
Definition control.c:3992
void request_unit_goto(enum unit_orders last_order, action_id act_id, int sub_tgt_id)
Definition control.c:1130
void key_unit_paradrop(void)
Definition control.c:3479
struct unit_list * get_units_in_focus(void)
Definition control.c:177
void key_unit_shields_toggle(void)
Definition control.c:4040
void key_city_productions_toggle(void)
Definition control.c:3919
void key_unit_plant(void)
Definition control.c:3696
void key_unit_fortress(void)
Definition control.c:3624
void key_unit_mine(void)
Definition control.c:3688
void key_unit_pillage(void)
Definition control.c:3708
void request_unit_unload(struct unit *pcargo)
Definition control.c:2194
void key_editor_toggle_fogofwar(void)
Definition control.c:4081
void request_new_unit_activity_targeted(struct unit *punit, enum unit_activity act, struct extra_type *tgt)
Definition control.c:1938
void key_unit_irrigate(void)
Definition control.c:3668
void request_unit_build_city(struct unit *punit)
Definition control.c:1817
void key_unit_unload_all(void)
Definition control.c:3517
void key_cities_toggle(void)
Definition control.c:4016
void key_city_outlines_toggle(void)
Definition control.c:3845
void key_unit_homecity(void)
Definition control.c:3641
void key_unit_patrol(void)
Definition control.c:3487
void key_unit_solid_bg_toggle(void)
Definition control.c:4032
void key_terrain_toggle(void)
Definition control.c:3944
void key_paths_toggle(void)
Definition control.c:3960
void key_unit_wakeup_others(void)
Definition control.c:3550
void key_unit_stack_size_toggle(void)
Definition control.c:3936
void key_huts_toggle(void)
Definition control.c:4000
void key_fog_of_war_toggle(void)
Definition control.c:4056
void key_unit_wait(void)
Definition control.c:3542
void key_units_toggle(void)
Definition control.c:4024
void key_unit_select_battlegroup(int battlegroup, bool append)
Definition control.c:3819
void key_map_grid_toggle(void)
Definition control.c:3861
void key_pollution_toggle(void)
Definition control.c:4008
void key_city_growth_toggle(void)
Definition control.c:3902
void key_unit_action_select_tgt(void)
Definition control.c:3406
void key_city_buycost_toggle(void)
Definition control.c:3911
int get_num_units_in_focus(void)
Definition control.c:185
void key_unit_transform(void)
Definition control.c:3768
void key_unit_done(void)
Definition control.c:3463
void key_city_trade_routes_toggle(void)
Definition control.c:3928
void key_city_names_toggle(void)
Definition control.c:3893
void request_unit_select(struct unit_list *punits, enum unit_select_type_mode seltype, enum unit_select_location_mode selloc)
Definition control.c:1621
void key_unit_auto_work(void)
Definition control.c:3590
void key_unit_airbase(void)
Definition control.c:3560
void key_unit_goto(void)
Definition control.c:3471
void key_unit_convert(void)
Definition control.c:3602
void key_unit_clean(void)
Definition control.c:3720
void key_editor_toggle(void)
Definition control.c:4064
void key_unit_assign_battlegroup(int battlegroup, bool append)
Definition control.c:3780
void key_unit_cultivate(void)
Definition control.c:3676
void key_mines_toggle(void)
Definition control.c:3976
void key_map_borders_toggle(void)
Definition control.c:3869
#define can_unit_do_activity_targeted_client(_punit_, _act_, _tgt_)
Definition control.h:43
#define can_units_do_activity_targeted_client(_punits_, _act_, _tgt_)
Definition control.h:47
#define can_units_do_activity_client(_punits_, _act_)
Definition control.h:45
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
Definition dialogs_g.h:74
bool editor_is_active(void)
Definition editor.c:346
@ OBJTYPE_GAME
Definition editor.h:31
struct extra_type * next_extra_for_tile(const struct tile *ptile, enum extra_cause cause, const struct player *pplayer, const struct unit *punit)
Definition extras.c:779
int extra_number(const struct extra_type *pextra)
Definition extras.c:161
struct extra_type_list * extra_type_list_by_cause(enum extra_cause cause)
Definition extras.c:249
static struct extra_type extras[MAX_EXTRA_TYPES]
Definition extras.c:31
const char * extra_name_translation(const struct extra_type *pextra)
Definition extras.c:194
#define extra_type_iterate(_p)
Definition extras.h:315
#define extra_type_iterate_end
Definition extras.h:321
#define extra_type_by_rmcause_iterate_end
Definition extras.h:358
#define extra_type_by_rmcause_iterate(_rmcause, _extra)
Definition extras.h:353
#define extra_type_by_cause_iterate_end
Definition extras.h:339
#define extra_type_by_cause_iterate(_cause, _extra)
Definition extras.h:333
#define NO_TARGET
Definition fc_types.h:213
int action_id
Definition fc_types.h:248
#define MAX_LEN_NAME
Definition fc_types.h:66
@ BORDERS_DISABLED
Definition fc_types.h:745
#define Q_(String)
Definition fcintl.h:70
#define PL_(String1, String2, n)
Definition fcintl.h:71
#define _(String)
Definition fcintl.h:67
#define N_(String)
Definition fcintl.h:69
struct civ_game game
Definition game.c:61
struct world wld
Definition game.c:62
const char * government_name_translation(const struct government *pgovern)
Definition government.c:143
bool untargeted_revolution_allowed(void)
Definition government.c:566
bool can_change_to_government(struct player *pplayer, const struct government *gov)
Definition government.c:166
#define governments_iterate(NAME_pgov)
Definition government.h:124
#define governments_iterate_end
Definition government.h:127
void log_output_window(void)
Definition chatline.c:929
void clear_output_window(void)
Definition chatline.c:944
void city_report_dialog_popup(bool raise)
Definition cityrep.c:292
void unit_select_dialog_popup(struct tile *ptile)
Definition dialogs.c:377
void popup_upgrade_dialog(struct unit_list *punits)
Definition dialogs.c:1435
void popup_disband_dialog(struct unit_list *punits)
Definition dialogs.c:1473
void editgui_refresh(void)
Definition editgui.c:1796
void property_editor_popup(struct property_editor *pe, enum editor_object_type objtype)
Definition editprop.c:6292
struct property_editor * editprop_get_property_editor(void)
Definition editprop.c:6245
void property_editor_reload(struct property_editor *pe, enum editor_object_type objtype)
Definition editprop.c:6382
void popup_find_dialog(void)
Definition finddlg.c:58
void popup_multiplier_dialog(void)
Definition gamedlgs.c:383
void popup_rates_dialog(void)
Definition gamedlgs.c:533
void popup_goto_dialog(void)
Definition gotodlg.c:258
void fullscreen_opt_refresh(struct option *poption)
Definition gui_main.c:2434
gboolean map_canvas_focus(void)
Definition gui_main.c:360
GtkWidget * toplevel
Definition gui_main.c:126
void popup_quit_dialog(void)
Definition gui_main.c:2350
#define GUI_GTK_OPTION(optname)
Definition gui_main.h:25
void setup_dialog(GtkWidget *shell, GtkWidget *parent)
Definition gui_stuff.c:287
void popup_help_dialog_string(const char *item)
Definition helpdlg.c:212
void infra_dialog_popup(void)
Definition infradlg.c:85
void luaconsole_dialog_popup(bool raise)
Definition luaconsole.c:126
void center_on_unit(void)
Definition mapctrl.c:496
static void save_mapimg_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:697
static void show_national_borders_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1207
static void show_focus_unit_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1443
GtkWidget * setup_menus(GtkWidget *window)
Definition menu.c:2151
static void help_connecting_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:857
static void menus_rename(const char *key, const gchar *new_label)
Definition menu.c:2285
static void help_combat_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1065
static void menu_entry_group_set_sensitive(enum menu_entry_grouping group, gboolean is_sensitive)
Definition menu.c:2253
static void help_ruleset_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1009
static void select_single_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1513
static void unit_unload_transporter_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1721
static void bg_assign1_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:929
static void bg_append3_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:985
static void help_government_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1105
static void report_achievements_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:833
static void show_fog_of_war_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1454
static void help_zoc_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1073
static void show_city_productions_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1264
static void do_pillage_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1961
static void bg_select0_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:897
static void menu_remove_previous_entries(GtkMenu *menu)
Definition menu.c:2895
static void client_lua_script_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:817
static void bg_select2_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:945
static void show_city_names_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1241
static void help_space_race_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1121
static void help_tileset_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1017
static void help_playing_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1001
static void plant_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1839
static struct menu_entry_info menu_entries[]
Definition menu.c:267
static void base_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:2001
static void help_economy_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1033
static void clean_nuisance_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1919
static void unit_sentry_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1685
static void center_view_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:2041
static void unit_explore_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1669
static void build_mine_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1831
static void quit_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:749
static void unit_return_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1659
static GtkBuilder * ui_builder
Definition menu.c:77
static void show_city_trade_routes_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1287
static void transform_terrain_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1911
static void help_wonders_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1097
static GtkMenu * find_menu(const char *key)
Definition menu.c:2298
static void show_terrain_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1298
static void show_city_growth_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1253
static void show_stack_size_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1432
static const gchar * get_ui_filename(void)
Definition menu.c:2131
static void multiplier_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1985
static void help_terrain_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1089
static void save_game_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:681
static void show_unit_solid_bg_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1410
static void show_coastline_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1309
static void toggle_fog_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1485
static void show_city_full_bar_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1229
static void edit_mode_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1162
static void help_chatline_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:873
static void show_paths_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1319
void menus_free(void)
Definition menu.c:3224
static void connect_road_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1847
static void bg_append2_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:961
static void help_overview_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:993
static void save_game_as_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:689
static void help_diplomacy_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1113
static void show_units_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1399
static void show_irrigation_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1329
static void show_map_grid_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1196
static void help_improvements_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1049
static void bg_append1_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:937
static void recalc_borders_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1477
static void find_city_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:757
static void report_nations_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:781
static void report_demographic_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:825
static void help_worklist_editor_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:881
static void help_cities_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1041
static void leave_local_game_response(GtkWidget *dialog, gint response)
Definition menu.c:714
static void help_language_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:841
static void show_mine_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1339
static void server_options_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:657
static void bg_append0_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:913
static void leave_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:729
static void select_same_type_cont_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1537
static void unit_convert_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1746
static void select_dialog_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1553
static void show_huts_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1369
static void report_wow_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:789
static void menu_entry_set_active(const char *key, gboolean is_active)
Definition menu.c:2227
static void unit_upgrade_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1738
static void menu_unit_goto_and_add_accel(GtkWidget *item, action_id act_id, const guint accel_key, const GdkModifierType accel_mods)
Definition menu.c:2871
static void help_tech_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1081
static void unit_goto_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1593
static void clean_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:2026
static void build_city_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1762
static void bg_select3_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:969
static void unit_patrol_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1677
void real_menus_init(void)
Definition menu.c:2915
menu_entry_grouping
Definition menu.c:91
@ MGROUP_ALL
Definition menu.c:92
@ MGROUP_PLAYING
Definition menu.c:91
@ MGROUP_PLAYER
Definition menu.c:92
@ MGROUP_SAFE
Definition menu.c:91
@ MGROUP_EDIT
Definition menu.c:91
@ MGROUP_UNIT
Definition menu.c:92
static void rally_dialog_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1561
static void help_about_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1145
static void bg_assign0_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:905
static void build_road_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1789
static void local_options_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:641
static void show_cities_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1389
static void unit_homecity_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1730
static void menu_entry_set_sensitive(const char *key, gboolean is_sensitive)
Definition menu.c:2240
static void show_pollution_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1379
static void save_options_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:665
static void save_mapimg_as_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:705
static void worklists_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:765
static void connect_maglev_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1879
static void full_screen_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1465
static void report_top_cities_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:801
static void help_controls_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:865
static void select_same_type_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1545
static void connect_rail_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1863
static void unit_wait_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1577
static const char * get_tile_change_menu_text(struct tile *ptile, enum unit_activity activity)
Definition menu.c:2338
static void build_airbase_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1945
static void report_cities_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:2057
static void help_cma_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:889
static void infra_dialog_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1569
static void message_options_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:649
static void tax_rate_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1977
static void help_musicset_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1025
static void unit_goto_city_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1649
static struct menu_entry_info * menu_entry_info_find(const char *key)
Definition menu.c:2211
static void bg_select1_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:921
static void auto_work_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1781
static void government_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1993
static void report_economy_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:2065
static void report_messages_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:809
static void do_paradrop_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1953
static void show_bases_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1349
static void select_same_type_tile_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1529
static void unit_unsentry_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1693
static void save_options_on_exit_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1153
static void show_native_tiles_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1218
static void menu_entry_init(GtkBuildable *item)
Definition menu.c:2091
static void show_unit_shields_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1421
static void reload_tileset_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:673
static void scenario_properties_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1493
static void clear_chat_logs_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:625
static void unit_deboard_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1711
static void help_policies_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:849
static void unit_done_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1585
static void help_nations_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1129
static void unit_goto_and_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1601
static void show_city_output_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1185
static void show_city_outlines_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1174
static void save_scenario_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1505
#define ADD_OLD_ACCELERATOR(wanted_action_id, accel_key, accel_mods)
static void help_copying_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1137
static void cultivate_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1823
static void save_chat_logs_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:633
void real_menus_update(void)
Definition menu.c:2353
static void report_spaceship_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:2081
static void select_all_on_tile_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1521
static void show_city_buy_cost_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1276
static void build_fortress_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1927
#define CREATE_SUB_ITEM(_sub_target_, _sub_target_key_, _sub_target_name_)
static void view_menu_update_sensitivity(void)
Definition menu.c:2306
static void unit_board_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1701
static void menu_entry_set_visible(const char *key, gboolean is_visible, gboolean is_sensitive)
Definition menu.c:2269
static void fortify_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1935
static void bg_assign3_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:977
static void show_resources_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1359
static void connect_irrigation_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1895
static void build_irrigation_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1815
static void bg_assign2_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:953
static void report_units_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:2049
static void road_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:2013
static void unit_disband_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1754
static void help_units_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1057
static void report_research_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:2073
static void diplomat_action_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1969
static void map_view_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:773
void popup_messageopt_dialog(void)
Definition messagedlg.c:51
void meswin_dialog_popup(bool raise)
Definition messagewin.c:417
void option_dialog_popup(const char *name, const struct option_set *poptset)
Definition optiondlg.c:972
void save_mapimg_dialog_popup(void)
Definition pages.c:3551
void mapimg_client_save(const char *filename)
Definition pages.c:3570
void save_game_dialog_popup(void)
Definition pages.c:3487
void save_scenario_dialog_popup(void)
Definition pages.c:3522
void popup_players_dialog(bool raise)
Definition plrdlg.c:91
void rally_dialog_popup(void)
void science_report_dialog_popup(bool raise)
Definition repodlgs.c:716
void economy_report_dialog_popup(bool raise)
Definition repodlgs.c:1243
void units_report_dialog_popup(bool raise)
Definition repodlgs.c:1768
void science_report_dialog_popdown(void)
Definition repodlgs.c:740
void popup_spaceship_dialog(struct player *pplayer)
bool request_transport(struct unit *cargo, struct tile *ptile)
void popup_worklists_report(void)
Definition wldlg.c:287
menu_entry_grouping
Definition menu.c:80
void popup_revolution_dialog(void)
Definition dialogs.c:112
#define HELP_MUSICSET_ITEM
#define HELP_CITIES_ITEM
#define HELP_TERRAIN_ITEM
#define HELP_LANGUAGES_ITEM
#define HELP_CONNECTING_ITEM
#define HELP_TILESET_ITEM
#define HELP_CHATLINE_ITEM
#define HELP_RULESET_ITEM
#define HELP_GOVERNMENT_ITEM
#define HELP_ABOUT_ITEM
#define HELP_MULTIPLIER_ITEM
#define HELP_PLAYING_ITEM
#define HELP_IMPROVEMENTS_ITEM
#define HELP_UNITS_ITEM
#define HELP_ZOC_ITEM
#define HELP_WORKLIST_EDITOR_ITEM
#define HELP_WONDERS_ITEM
#define HELP_COMBAT_ITEM
#define HELP_SPACE_RACE_ITEM
#define HELP_COPYING_ITEM
#define HELP_OVERVIEW_ITEM
#define HELP_NATIONS_ITEM
#define HELP_TECHS_ITEM
#define HELP_DIPLOMACY_ITEM
#define HELP_ECONOMY_ITEM
#define HELP_CMA_ITEM
#define HELP_CONTROLS_ITEM
Impr_type_id improvement_number(const struct impr_type *pimprove)
const char * improvement_name_translation(const struct impr_type *pimprove)
#define improvement_iterate_end
#define improvement_iterate(_p)
const char * name
Definition inputfile.c:127
#define fc_assert_ret(condition)
Definition log.h:192
#define log_verbose(message,...)
Definition log.h:110
#define fc_assert(condition)
Definition log.h:177
#define log_error(message,...)
Definition log.h:104
struct terrain_misc terrain_control
Definition map.c:68
Multiplier_type_id multiplier_count(void)
Definition multipliers.c:88
const struct option_set * server_optset
Definition options.c:4278
const struct option_set * client_optset
Definition options.c:1316
void options_save(option_save_log_callback log_cb)
Definition options.c:6340
struct client_options gui_options
Definition options.c:71
@ GUI_GTK_MSGCHAT_MERGED
Definition options.h:69
struct extra_type * road_extra_get(const struct road_type *proad)
Definition road.c:42
struct road_type * road_by_gui_type(enum road_gui_type gui_type)
Definition road.c:180
static char * grouping
Definition shared.c:98
const char * fileinfoname(const struct strvec *dirs, const char *filename)
Definition shared.c:1094
const struct strvec * get_data_dirs(void)
Definition shared.c:886
@ SSHIP_NONE
Definition spaceship.h:84
struct civ_game::@32::@35 client
bool fog_of_war
Definition game.h:121
struct packet_game_info info
Definition game.h:89
struct government * government_during_revolution
Definition game.h:94
struct connection conn
Definition client_main.h:96
bool draw_native
Definition options.h:216
bool draw_specials
Definition options.h:208
bool draw_city_output
Definition options.h:195
bool draw_city_names
Definition options.h:197
bool draw_city_productions
Definition options.h:199
bool draw_mines
Definition options.h:206
bool draw_borders
Definition options.h:215
bool draw_fortress_airbase
Definition options.h:207
bool draw_city_buycost
Definition options.h:200
bool draw_unit_stack_size
Definition options.h:219
bool draw_irrigation
Definition options.h:205
bool draw_terrain
Definition options.h:202
bool draw_units
Definition options.h:212
bool draw_fog_of_war
Definition options.h:214
bool draw_city_trade_routes
Definition options.h:201
bool draw_unit_shields
Definition options.h:218
bool draw_cities
Definition options.h:211
bool save_options_on_exit
Definition options.h:125
bool draw_map_grid
Definition options.h:196
bool draw_city_growth
Definition options.h:198
bool draw_focus_unit
Definition options.h:213
bool draw_paths
Definition options.h:204
bool draw_city_outlines
Definition options.h:194
bool draw_coastline
Definition options.h:203
bool draw_full_citybar
Definition options.h:217
bool draw_pollution
Definition options.h:210
bool solid_color_behind_units
Definition options.h:150
bool established
Definition connection.h:140
struct player * playing
Definition connection.h:151
struct extra_type::@26 data
Definition climisc.h:82
Definition menu.c:97
GdkModifierType accel_mod
Definition menu.c:101
guint accel
Definition menu.c:100
const char * key
Definition menu.c:98
enum menu_entry_grouping grouping
Definition menu.c:103
GCallback cb
Definition menu.c:102
const char * name
Definition menu.c:99
enum borders_mode borders
struct terrain * cultivate_result
Definition terrain.h:108
struct terrain * plant_result
Definition terrain.h:111
struct terrain * transform_result
Definition terrain.h:122
Definition tile.h:50
Definition unit.h:140
struct civ_map map
int fc_snprintf(char *str, size_t n, const char *format,...)
Definition support.c:960
#define sz_strlcpy(dest, src)
Definition support.h:195
#define TRUE
Definition support.h:46
#define FALSE
Definition support.h:47
const char * advance_name_translation(const struct advance *padvance)
Definition tech.c:300
Tech_type_id advance_number(const struct advance *padvance)
Definition tech.c:98
#define advance_iterate(_p)
Definition tech.h:271
#define advance_iterate_end
Definition tech.h:272
#define T_NONE
Definition terrain.h:61
void tile_virtual_destroy(struct tile *vtile)
Definition tile.c:1035
bool tile_apply_activity(struct tile *ptile, Activity_type_id act, struct extra_type *tgt)
Definition tile.c:681
struct tile * tile_virtual_new(const struct tile *ptile)
Definition tile.c:981
const char * tile_get_info_text(const struct tile *ptile, bool include_nuisances, int linebreaks)
Definition tile.c:771
struct city * tile_city(const struct tile *ptile)
Definition tile.c:83
#define tile_terrain(_tile)
Definition tile.h:111
bool tilespec_reread(const char *new_tileset_name, bool game_fully_initialized, float scale)
Definition tilespec.c:1401
bool unit_can_est_trade_route_here(const struct unit *punit)
Definition unit.c:284
bool unit_can_add_or_build_city(const struct civ_map *nmap, const struct unit *punit)
Definition unit.c:472
bool can_unit_change_homecity(const struct civ_map *nmap, const struct unit *punit)
Definition unit.c:505
bool can_unit_do_autoworker(const struct unit *punit)
Definition unit.c:630
bool can_unit_paradrop(const struct civ_map *nmap, const struct unit *punit)
Definition unit.c:846
bool unit_can_help_build_wonder_here(const struct civ_map *nmap, const struct unit *punit)
Definition unit.c:258
#define unit_tile(_pu)
Definition unit.h:404
@ ORDER_PERFORM_ACTION
Definition unit.h:48
#define unit_owner(_pu)
Definition unit.h:403
bool units_can_convert(const struct civ_map *nmap, const struct unit_list *punits)
Definition unitlist.c:350
bool units_are_occupied(const struct unit_list *punits)
Definition unitlist.c:273
bool units_can_unload(const struct civ_map *nmap, const struct unit_list *punits)
Definition unitlist.c:301
bool can_units_do_base_gui(const struct unit_list *punits, enum base_gui_type base_gui)
Definition unitlist.c:180
bool can_units_do_any_road(const struct civ_map *nmap, const struct unit_list *punits)
Definition unitlist.c:161
bool units_can_upgrade(const struct civ_map *nmap, const struct unit_list *punits)
Definition unitlist.c:335
bool units_have_activity_on_tile(const struct unit_list *punits, enum unit_activity activity)
Definition unitlist.c:319
bool units_have_type_flag(const struct unit_list *punits, enum unit_type_flag_id flag, bool has_flag)
Definition unitlist.c:202
bool can_units_do(const struct unit_list *punits, bool(can_fn)(const struct unit *punit))
Definition unitlist.c:95
bool units_can_do_action(const struct unit_list *punits, action_id act_id, bool can_do)
Definition unitlist.c:239
bool units_can_load(const struct unit_list *punits)
Definition unitlist.c:287
bool can_units_do_on_map(const struct civ_map *nmap, const struct unit_list *punits, bool(can_fn)(const struct civ_map *nmap, const struct unit *punit))
Definition unitlist.c:111
#define unit_list_iterate(unitlist, punit)
Definition unitlist.h:31
#define unit_list_iterate_end
Definition unitlist.h:33
const struct unit_type * unit_type_get(const struct unit *punit)
Definition unittype.c:123
const struct unit_type * can_upgrade_unittype(const struct player *pplayer, const struct unit_type *punittype)
Definition unittype.c:1709
const char * utype_name_translation(const struct unit_type *punittype)
Definition unittype.c:1566
bool utype_can_do_action(const struct unit_type *putype, const action_id act_id)
Definition unittype.c:377