Freeciv-3.1
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
77static GtkBuilder *ui_builder = NULL;
78
79static void menu_entry_set_active(const char *key,
80 gboolean is_active);
81static void menu_entry_set_sensitive(const char *key,
82 gboolean is_sensitive);
83#ifndef FREECIV_DEBUG
84static void menu_entry_set_visible(const char *key,
85 gboolean is_visible,
86 gboolean is_sensitive);
87#endif /* FREECIV_DEBUG */
88
89static void view_menu_update_sensitivity(void);
90
93
95 gboolean is_sensitive);
96
97struct menu_entry_info {
98 const char *key;
99 const char *name;
100 guint accel;
101 GdkModifierType accel_mod;
102 GCallback cb;
104};
105
106static void clear_chat_logs_callback(GtkMenuItem *item, gpointer data);
107static void save_chat_logs_callback(GtkMenuItem *item, gpointer data);
108static void local_options_callback(GtkMenuItem *item, gpointer data);
109static void message_options_callback(GtkMenuItem *item, gpointer data);
110static void server_options_callback(GtkMenuItem *item, gpointer data);
111static void save_options_callback(GtkMenuItem *item, gpointer data);
112static void reload_tileset_callback(GtkMenuItem *item, gpointer data);
113static void save_game_callback(GtkMenuItem *item, gpointer data);
114static void save_game_as_callback(GtkMenuItem *item, gpointer data);
115static void save_mapimg_callback(GtkMenuItem *item, gpointer data);
116static void save_mapimg_as_callback(GtkMenuItem *item, gpointer data);
117static void find_city_callback(GtkMenuItem *item, gpointer data);
118static void worklists_callback(GtkMenuItem *item, gpointer data);
119static void client_lua_script_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);
123static void report_units_callback(GtkMenuItem *item, gpointer data);
124static void report_nations_callback(GtkMenuItem *item, gpointer data);
125static void report_cities_callback(GtkMenuItem *item, gpointer data);
126static void report_wow_callback(GtkMenuItem *item, gpointer data);
127static void report_top_cities_callback(GtkMenuItem *item, gpointer data);
128static void report_messages_callback(GtkMenuItem *item, gpointer data);
129static void report_demographic_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);
142static void help_overview_callback(GtkMenuItem *item, gpointer data);
143static void help_playing_callback(GtkMenuItem *item, gpointer data);
144static void help_policies_callback(GtkMenuItem *item, gpointer data);
145static void help_terrain_callback(GtkMenuItem *item, gpointer data);
146static void help_economy_callback(GtkMenuItem *item, gpointer data);
147static void help_cities_callback(GtkMenuItem *item, gpointer data);
148static void help_improvements_callback(GtkMenuItem *item, gpointer data);
149static void help_wonders_callback(GtkMenuItem *item, gpointer data);
150static void help_units_callback(GtkMenuItem *item, gpointer data);
151static void help_combat_callback(GtkMenuItem *item, gpointer data);
152static void help_zoc_callback(GtkMenuItem *item, gpointer data);
153static void help_government_callback(GtkMenuItem *item, gpointer data);
154static void help_diplomacy_callback(GtkMenuItem *item, gpointer data);
155static void help_tech_callback(GtkMenuItem *item, gpointer data);
156static void help_space_race_callback(GtkMenuItem *item, gpointer data);
157static void help_ruleset_callback(GtkMenuItem *item, gpointer data);
158static void help_tileset_callback(GtkMenuItem *item, gpointer data);
159static void help_nations_callback(GtkMenuItem *item, gpointer data);
160static void help_connecting_callback(GtkMenuItem *item, gpointer data);
161static void help_controls_callback(GtkMenuItem *item, gpointer data);
162static void help_cma_callback(GtkMenuItem *item, gpointer data);
163static void help_chatline_callback(GtkMenuItem *item, gpointer data);
164static void help_worklist_editor_callback(GtkMenuItem *item, gpointer data);
165static void help_language_callback(GtkMenuItem *item, gpointer data);
166static void help_copying_callback(GtkMenuItem *item, gpointer data);
167static void help_about_callback(GtkMenuItem *item, gpointer data);
168static void save_options_on_exit_callback(GtkCheckMenuItem *item,
169 gpointer data);
170static void edit_mode_callback(GtkCheckMenuItem *item, gpointer data);
171static void show_city_outlines_callback(GtkCheckMenuItem *item,
172 gpointer data);
173static void show_city_output_callback(GtkCheckMenuItem *item, gpointer data);
174static void show_map_grid_callback(GtkCheckMenuItem *item, gpointer data);
175static void show_national_borders_callback(GtkCheckMenuItem *item,
176 gpointer data);
177static void show_native_tiles_callback(GtkCheckMenuItem *item,
178 gpointer data);
179static void show_city_full_bar_callback(GtkCheckMenuItem *item,
180 gpointer data);
181static void show_city_names_callback(GtkCheckMenuItem *item, gpointer data);
182static void show_city_growth_callback(GtkCheckMenuItem *item, gpointer data);
183static void show_city_productions_callback(GtkCheckMenuItem *item,
184 gpointer data);
185static void show_city_buy_cost_callback(GtkCheckMenuItem *item,
186 gpointer data);
187static void show_city_trade_routes_callback(GtkCheckMenuItem *item,
188 gpointer data);
189static void show_terrain_callback(GtkCheckMenuItem *item, gpointer data);
190static void show_coastline_callback(GtkCheckMenuItem *item, gpointer data);
191static void show_road_rails_callback(GtkCheckMenuItem *item, gpointer data);
192static void show_irrigation_callback(GtkCheckMenuItem *item, gpointer data);
193static void show_mine_callback(GtkCheckMenuItem *item, gpointer data);
194static void show_bases_callback(GtkCheckMenuItem *item, gpointer data);
195static void show_resources_callback(GtkCheckMenuItem *item, gpointer data);
196static void show_huts_callback(GtkCheckMenuItem *item, gpointer data);
197static void show_pollution_callback(GtkCheckMenuItem *item, gpointer data);
198static void show_cities_callback(GtkCheckMenuItem *item, gpointer data);
199static void show_units_callback(GtkCheckMenuItem *item, gpointer data);
200static void show_unit_solid_bg_callback(GtkCheckMenuItem *item,
201 gpointer data);
202static void show_unit_shields_callback(GtkCheckMenuItem *item,
203 gpointer data);
204static void show_stack_size_callback(GtkCheckMenuItem *item,
205 gpointer data);
206static void show_focus_unit_callback(GtkCheckMenuItem *item, gpointer data);
207static void show_fog_of_war_callback(GtkCheckMenuItem *item, gpointer data);
208static void full_screen_callback(GtkCheckMenuItem *item, gpointer data);
209static void recalc_borders_callback(GtkMenuItem *item, gpointer data);
210static void toggle_fog_callback(GtkMenuItem *item, gpointer data);
211static void scenario_properties_callback(GtkMenuItem *item, gpointer data);
212static void save_scenario_callback(GtkMenuItem *item, gpointer data);
213static void center_view_callback(GtkMenuItem *item, gpointer data);
214static void report_economy_callback(GtkMenuItem *item, gpointer data);
215static void report_research_callback(GtkMenuItem *item, gpointer data);
216static void multiplier_callback(GtkMenuItem *item, gpointer data);
217static void report_spaceship_callback(GtkMenuItem *item, gpointer data);
218static void report_achievements_callback(GtkMenuItem *item, gpointer data);
219static void government_callback(GtkMenuItem *item, gpointer data);
220static void tax_rate_callback(GtkMenuItem *item, gpointer data);
221static void select_single_callback(GtkMenuItem *item, gpointer data);
222static void select_all_on_tile_callback(GtkMenuItem *item, gpointer data);
223static void select_same_type_tile_callback(GtkMenuItem *item, gpointer data);
224static void select_same_type_cont_callback(GtkMenuItem *item, gpointer data);
225static void select_same_type_callback(GtkMenuItem *item, gpointer data);
226static void select_dialog_callback(GtkMenuItem *item, gpointer data);
227static void rally_dialog_callback(GtkMenuItem *item, gpointer data);
228static void infra_dialog_callback(GtkMenuItem *item, gpointer data);
229static void unit_wait_callback(GtkMenuItem *item, gpointer data);
230static void unit_done_callback(GtkMenuItem *item, gpointer data);
231static void unit_goto_callback(GtkMenuItem *item, gpointer data);
232static void unit_goto_city_callback(GtkMenuItem *item, gpointer data);
233static void unit_return_callback(GtkMenuItem *item, gpointer data);
234static void unit_explore_callback(GtkMenuItem *item, gpointer data);
235static void unit_patrol_callback(GtkMenuItem *item, gpointer data);
236static void unit_sentry_callback(GtkMenuItem *item, gpointer data);
237static void unit_unsentry_callback(GtkMenuItem *item, gpointer data);
238static void unit_board_callback(GtkMenuItem *item, gpointer data);
239static void unit_deboard_callback(GtkMenuItem *item, gpointer data);
240static void unit_unload_transporter_callback(GtkMenuItem *item,
241 gpointer data);
242static void unit_homecity_callback(GtkMenuItem *item, gpointer data);
243static void unit_upgrade_callback(GtkMenuItem *item, gpointer data);
244static void unit_convert_callback(GtkMenuItem *item, gpointer data);
245static void unit_disband_callback(GtkMenuItem *item, gpointer data);
246static void build_city_callback(GtkMenuItem *item, gpointer data);
247static void auto_settle_callback(GtkMenuItem *item, gpointer data);
248static void build_road_callback(GtkMenuItem *item, gpointer data);
249static void build_irrigation_callback(GtkMenuItem *item, gpointer data);
250static void cultivate_callback(GtkMenuItem *item, gpointer data);
251static void build_mine_callback(GtkMenuItem *item, gpointer data);
252static void plant_callback(GtkMenuItem *item, gpointer data);
253static void connect_road_callback(GtkMenuItem *item, gpointer data);
254static void connect_rail_callback(GtkMenuItem *item, gpointer data);
255static void connect_maglev_callback(GtkMenuItem *item, gpointer data);
256static void connect_irrigation_callback(GtkMenuItem *item, gpointer data);
257static void transform_terrain_callback(GtkMenuItem *item, gpointer data);
258static void clean_pollution_callback(GtkMenuItem *item, gpointer data);
259static void clean_fallout_callback(GtkMenuItem *item, gpointer data);
260static void fortify_callback(GtkMenuItem *item, gpointer data);
261static void build_fortress_callback(GtkMenuItem *item, gpointer data);
262static void build_airbase_callback(GtkMenuItem *item, gpointer data);
263static void do_paradrop_callback(GtkMenuItem *item, gpointer data);
264static void do_pillage_callback(GtkMenuItem *item, gpointer data);
265static void diplomat_action_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,
278 NULL, MGROUP_PLAYING },
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,
285 G_CALLBACK(local_options_callback), MGROUP_SAFE },
286 { "MESSAGE_OPTIONS", N_("_Message"), 0, 0,
288 { "SERVER_OPTIONS", N_("_Remote Server"), 0, 0,
290 { "SAVE_OPTIONS", N_("Save Options _Now"), 0, 0,
291 G_CALLBACK(save_options_callback), MGROUP_SAFE },
292 { "RELOAD_TILESET", N_("_Reload Tileset"),
293 GDK_KEY_r, GDK_MOD1_MASK | GDK_CONTROL_MASK,
295 { "GAME_SAVE", N_("_Save Game"), GDK_KEY_s, GDK_CONTROL_MASK,
296 G_CALLBACK(save_game_callback), MGROUP_SAFE },
297 { "GAME_SAVE_AS", N_("Save Game _As..."), 0, 0,
298 G_CALLBACK(save_game_as_callback), MGROUP_SAFE },
299 { "MAPIMG_SAVE", N_("Save Map _Image"), 0, 0,
300 G_CALLBACK(save_mapimg_callback), MGROUP_SAFE },
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,
305 G_CALLBACK(quit_callback), MGROUP_SAFE },
306 { "FIND_CITY", N_("_Find City"), GDK_KEY_f, GDK_CONTROL_MASK,
307 G_CALLBACK(find_city_callback), MGROUP_SAFE },
308 { "WORKLISTS", N_("Work_lists"),
309 GDK_KEY_l, GDK_CONTROL_MASK | GDK_SHIFT_MASK,
310 G_CALLBACK(worklists_callback), MGROUP_SAFE },
311 { "RALLY_DLG", N_("Rally point dialog"),
312 GDK_KEY_r, GDK_CONTROL_MASK | GDK_SHIFT_MASK,
313 G_CALLBACK(rally_dialog_callback), MGROUP_SAFE },
314 { "INFRA_DLG", N_("Infra dialog"),
315 GDK_KEY_f, GDK_CONTROL_MASK | GDK_SHIFT_MASK,
316 G_CALLBACK(infra_dialog_callback), MGROUP_SAFE },
317 { "CLIENT_LUA_SCRIPT", N_("Client _Lua Script"), 0, 0,
319 { "MAP_VIEW", N_("?noun:_View"), GDK_KEY_F1, 0,
320 G_CALLBACK(map_view_callback), MGROUP_SAFE },
321 { "REPORT_UNITS", N_("_Units"), GDK_KEY_F2, 0,
322 G_CALLBACK(report_units_callback), MGROUP_SAFE },
323 { "REPORT_NATIONS", N_("_Nations"), GDK_KEY_F3, 0,
325 { "REPORT_CITIES", N_("_Cities"), GDK_KEY_F4, 0,
326 G_CALLBACK(report_cities_callback), MGROUP_SAFE },
327 { "REPORT_WOW", N_("_Wonders of the World"), GDK_KEY_F7, 0,
328 G_CALLBACK(report_wow_callback), MGROUP_SAFE },
329 { "REPORT_TOP_CITIES", N_("Top _Five 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"),
339 GDK_KEY_F1, GDK_SHIFT_MASK,
340 G_CALLBACK(bg_select0_callback), MGROUP_SAFE },
341 { "BATTLE_GROUP_ASSIGN_0", N_("Assign Battle Group 1"),
342 GDK_KEY_F1, GDK_CONTROL_MASK,
343 G_CALLBACK(bg_assign0_callback), MGROUP_SAFE },
344 { "BATTLE_GROUP_APPEND_0", N_("Append to Battle Group 1"),
345 GDK_KEY_F1, GDK_SHIFT_MASK | GDK_CONTROL_MASK,
346 G_CALLBACK(bg_append0_callback), MGROUP_SAFE },
347 { "BATTLE_GROUP_SELECT_1", N_("Select Battle Group 2"),
348 GDK_KEY_F2, GDK_SHIFT_MASK,
349 G_CALLBACK(bg_select1_callback), MGROUP_SAFE },
350 { "BATTLE_GROUP_ASSIGN_1", N_("Assign Battle Group 2"),
351 GDK_KEY_F2, GDK_CONTROL_MASK,
352 G_CALLBACK(bg_assign1_callback), MGROUP_SAFE },
353 { "BATTLE_GROUP_APPEND_1", N_("Append to Battle Group 2"),
354 GDK_KEY_F2, GDK_SHIFT_MASK | GDK_CONTROL_MASK,
355 G_CALLBACK(bg_append1_callback), MGROUP_SAFE },
356 { "BATTLE_GROUP_SELECT_2", N_("Select Battle Group 3"),
357 GDK_KEY_F3, GDK_SHIFT_MASK,
358 G_CALLBACK(bg_select2_callback), MGROUP_SAFE },
359 { "BATTLE_GROUP_ASSIGN_2", N_("Assign Battle Group 3"),
360 GDK_KEY_F3, GDK_CONTROL_MASK,
361 G_CALLBACK(bg_assign2_callback), MGROUP_SAFE },
362 { "BATTLE_GROUP_APPEND_2", N_("Append to Battle Group 3"),
363 GDK_KEY_F3, GDK_SHIFT_MASK | GDK_CONTROL_MASK,
364 G_CALLBACK(bg_append2_callback), MGROUP_SAFE },
365 { "BATTLE_GROUP_SELECT_3", N_("Select Battle Group 4"),
366 GDK_KEY_F4, GDK_SHIFT_MASK,
367 G_CALLBACK(bg_select3_callback), MGROUP_SAFE },
368 { "BATTLE_GROUP_ASSIGN_3", N_("Assign Battle Group 4"),
369 GDK_KEY_F4, GDK_CONTROL_MASK,
370 G_CALLBACK(bg_assign3_callback), MGROUP_SAFE },
371 { "BATTLE_GROUP_APPEND_3", N_("Append to Battle Group 4"),
372 GDK_KEY_F4, GDK_SHIFT_MASK | GDK_CONTROL_MASK,
373 G_CALLBACK(bg_append3_callback), MGROUP_SAFE },
374
375 { "HELP_OVERVIEW", N_("?help:Overview"), 0, 0,
376 G_CALLBACK(help_overview_callback), MGROUP_SAFE },
377 { "HELP_PLAYING", N_("Strategy and Tactics"), 0, 0,
378 G_CALLBACK(help_playing_callback), MGROUP_SAFE },
379 { "HELP_POLICIES", N_("Policies"), 0, 0,
380 G_CALLBACK(help_policies_callback), MGROUP_SAFE },
381 { "HELP_TERRAIN", N_("Terrain"), 0, 0,
382 G_CALLBACK(help_terrain_callback), MGROUP_SAFE },
383 { "HELP_ECONOMY", N_("Economy"), 0, 0,
384 G_CALLBACK(help_economy_callback), MGROUP_SAFE },
385 { "HELP_CITIES", N_("Cities"), 0, 0,
386 G_CALLBACK(help_cities_callback), MGROUP_SAFE },
387 { "HELP_IMPROVEMENTS", N_("City Improvements"), 0, 0,
389 { "HELP_WONDERS", N_("Wonders of the World"), 0, 0,
390 G_CALLBACK(help_wonders_callback), MGROUP_SAFE },
391 { "HELP_UNITS", N_("Units"), 0, 0,
392 G_CALLBACK(help_units_callback), MGROUP_SAFE },
393 { "HELP_COMBAT", N_("Combat"), 0, 0,
394 G_CALLBACK(help_combat_callback), MGROUP_SAFE },
395 { "HELP_ZOC", N_("Zones of Control"), 0, 0,
396 G_CALLBACK(help_zoc_callback), MGROUP_SAFE },
397 { "HELP_GOVERNMENT", N_("Government"), 0, 0,
399 { "HELP_DIPLOMACY", N_("Diplomacy"), 0, 0,
401 { "HELP_TECH", N_("Technology"), 0, 0,
402 G_CALLBACK(help_tech_callback), MGROUP_SAFE },
403 { "HELP_SPACE_RACE", N_("Space Race"), 0, 0,
405 { "HELP_RULESET", N_("About Current Ruleset"), 0, 0,
406 G_CALLBACK(help_ruleset_callback), MGROUP_SAFE },
407 { "HELP_TILESET", N_("About Current Tileset"), 0, 0,
408 G_CALLBACK(help_tileset_callback), MGROUP_SAFE },
409 { "HELP_NATIONS", N_("About Nations"), 0, 0,
410 G_CALLBACK(help_nations_callback), MGROUP_SAFE },
411 { "HELP_CONNECTING", N_("Connecting"), 0, 0,
413 { "HELP_CONTROLS", N_("Controls"), 0, 0,
414 G_CALLBACK(help_controls_callback), MGROUP_SAFE },
415 { "HELP_CMA", N_("Citizen Governor"), 0, 0,
416 G_CALLBACK(help_cma_callback), MGROUP_SAFE },
417 { "HELP_CHATLINE", N_("Chatline"), 0, 0,
418 G_CALLBACK(help_chatline_callback), MGROUP_SAFE },
419 { "HELP_WORKLIST_EDITOR", N_("Worklist Editor"), 0, 0,
421 { "HELP_LANGUAGES", N_("Languages"), 0, 0,
422 G_CALLBACK(help_language_callback), MGROUP_SAFE },
423 { "HELP_COPYING", N_("Copying"), 0, 0,
424 G_CALLBACK(help_copying_callback), MGROUP_SAFE },
425 { "HELP_ABOUT", N_("About Freeciv"), 0, 0,
426 G_CALLBACK(help_about_callback), MGROUP_SAFE },
427 { "SAVE_OPTIONS_ON_EXIT", N_("Save Options on _Exit"), 0, 0,
429 { "EDIT_MODE", N_("_Editing Mode"), GDK_KEY_e, GDK_CONTROL_MASK,
430 G_CALLBACK(edit_mode_callback), MGROUP_SAFE },
431 { "SHOW_CITY_OUTLINES", N_("Cit_y Outlines"), GDK_KEY_y, GDK_CONTROL_MASK,
433 { "SHOW_CITY_OUTPUT", N_("City Output"), GDK_KEY_v, GDK_CONTROL_MASK,
435 { "SHOW_MAP_GRID", N_("Map _Grid"), GDK_KEY_g, GDK_CONTROL_MASK,
436 G_CALLBACK(show_map_grid_callback), MGROUP_SAFE },
437 { "SHOW_NATIONAL_BORDERS", N_("National _Borders"), GDK_KEY_b, GDK_CONTROL_MASK,
439 { "SHOW_NATIVE_TILES", N_("Native Tiles"), GDK_KEY_n, GDK_CONTROL_MASK | GDK_SHIFT_MASK,
441 { "SHOW_CITY_FULL_BAR", N_("City Full Bar"), 0, 0,
443 { "SHOW_CITY_NAMES", N_("City _Names"), GDK_KEY_n, GDK_CONTROL_MASK,
445 { "SHOW_CITY_GROWTH", N_("City G_rowth"), GDK_KEY_o, GDK_CONTROL_MASK,
447 { "SHOW_CITY_PRODUCTIONS", N_("City _Production"), GDK_KEY_p, GDK_CONTROL_MASK,
449 { "SHOW_CITY_BUY_COST", N_("City Buy Cost"), 0, 0,
451 { "SHOW_CITY_TRADE_ROUTES", N_("City Tra_deroutes"), GDK_KEY_d, GDK_CONTROL_MASK,
453 { "SHOW_TERRAIN", N_("_Terrain"), 0, 0,
454 G_CALLBACK(show_terrain_callback), MGROUP_SAFE },
455 { "SHOW_COASTLINE", N_("C_oastline"), 0, 0,
457 { "SHOW_PATHS", N_("_Paths"), 0, 0,
459 { "SHOW_IRRIGATION", N_("_Irrigation"), 0, 0,
461 { "SHOW_MINES", N_("_Mines"), 0, 0,
462 G_CALLBACK(show_mine_callback), MGROUP_SAFE },
463 { "SHOW_BASES", N_("_Bases"), 0, 0,
464 G_CALLBACK(show_bases_callback), MGROUP_SAFE },
465 { "SHOW_RESOURCES", N_("_Resources"), 0, 0,
467 { "SHOW_HUTS", N_("_Huts"), 0, 0,
468 G_CALLBACK(show_huts_callback), MGROUP_SAFE },
469 { "SHOW_POLLUTION", N_("Po_llution & Fallout"), 0, 0,
471 { "SHOW_CITIES", N_("Citi_es"), 0, 0,
472 G_CALLBACK(show_cities_callback), MGROUP_SAFE },
473 { "SHOW_UNITS", N_("_Units"), 0, 0,
474 G_CALLBACK(show_units_callback), MGROUP_SAFE },
475 { "SHOW_UNIT_SOLID_BG", N_("Unit Solid Background"), 0, 0,
477 { "SHOW_UNIT_SHIELDS", N_("Unit shields"), 0, 0,
479 { "SHOW_STACK_SIZE", N_("Unit Stack Size"),
480 GDK_KEY_plus, GDK_CONTROL_MASK,
482 { "SHOW_FOCUS_UNIT", N_("Focu_s Unit"), 0, 0,
484 { "SHOW_FOG_OF_WAR", N_("Fog of _War"), 0, 0,
486 { "FULL_SCREEN", N_("_Fullscreen"), GDK_KEY_Return, GDK_MOD1_MASK,
487 G_CALLBACK(full_screen_callback), MGROUP_SAFE },
488
489 { "RECALC_BORDERS", N_("Recalculate _Borders"), 0, 0,
491 { "TOGGLE_FOG", N_("Toggle Fog of _War"), GDK_KEY_w,
492 GDK_CONTROL_MASK | GDK_SHIFT_MASK,
493 G_CALLBACK(toggle_fog_callback), MGROUP_EDIT },
494 { "SCENARIO_PROPERTIES", N_("Game/Scenario Properties"), 0, 0,
496 { "SAVE_SCENARIO", N_("Save Scenario"), 0, 0,
497 G_CALLBACK(save_scenario_callback), MGROUP_EDIT },
498
499 { "CENTER_VIEW", N_("_Center View"), GDK_KEY_c, 0,
500 G_CALLBACK(center_view_callback), MGROUP_PLAYER },
501 { "REPORT_ECONOMY", N_("_Economy"), GDK_KEY_F5, 0,
503 { "REPORT_RESEARCH", N_("_Research"), GDK_KEY_F6, 0,
505 { "POLICIES", N_("_Policies..."),
506 GDK_KEY_p, GDK_SHIFT_MASK | GDK_CONTROL_MASK,
507 G_CALLBACK(multiplier_callback), MGROUP_PLAYER },
508 { "REPORT_SPACESHIP", N_("_Spaceship"), GDK_KEY_F12, 0,
510 { "REPORT_ACHIEVEMENTS", N_("_Achievements"), GDK_KEY_asterisk, 0,
512
513 { "MENU_SELECT", N_("_Select"), 0, 0, NULL, MGROUP_UNIT },
514 { "MENU_UNIT", N_("_Unit"), 0, 0, NULL, MGROUP_UNIT },
515 { "MENU_WORK", N_("_Work"), 0, 0, NULL, MGROUP_UNIT },
516 { "MENU_COMBAT", N_("_Combat"), 0, 0, NULL, MGROUP_UNIT },
517 { "MENU_BUILD_BASE", N_("Build _Base"), 0, 0, NULL, MGROUP_UNIT },
518 { "MENU_BUILD_PATH", N_("Build _Path"), 0, 0, NULL, MGROUP_UNIT },
519 { "SELECT_SINGLE", N_("_Single Unit (Unselect Others)"), GDK_KEY_z, 0,
520 G_CALLBACK(select_single_callback), MGROUP_UNIT },
521 { "SELECT_ALL_ON_TILE", N_("_All On Tile"), GDK_KEY_v, 0,
523 { "SELECT_SAME_TYPE_TILE", N_("Same Type on _Tile"),
524 GDK_KEY_v, GDK_SHIFT_MASK,
526 { "SELECT_SAME_TYPE_CONT", N_("Same Type on _Continent"),
527 GDK_KEY_c, GDK_SHIFT_MASK,
529 { "SELECT_SAME_TYPE", N_("Same Type _Everywhere"), GDK_KEY_x, GDK_SHIFT_MASK,
531 { "SELECT_DLG", N_("Unit Selection Dialog"), 0, 0,
532 G_CALLBACK(select_dialog_callback), MGROUP_UNIT },
533 { "UNIT_WAIT", N_("_Wait"), GDK_KEY_w, 0,
534 G_CALLBACK(unit_wait_callback), MGROUP_UNIT },
535 { "UNIT_DONE", N_("_Done"), GDK_KEY_space, 0,
536 G_CALLBACK(unit_done_callback), MGROUP_UNIT },
537 { "UNIT_GOTO", N_("_Go to"), GDK_KEY_g, 0,
538 G_CALLBACK(unit_goto_callback), MGROUP_UNIT },
539 { "MENU_GOTO_AND", N_("Go to a_nd..."), 0, 0, NULL, MGROUP_UNIT },
540 { "UNIT_GOTO_CITY", N_("Go _to/Airlift to City..."), GDK_KEY_t, 0,
542 { "UNIT_RETURN", N_("_Return to Nearest City"), GDK_KEY_g, GDK_SHIFT_MASK,
543 G_CALLBACK(unit_return_callback), MGROUP_UNIT },
544 { "UNIT_EXPLORE", N_("Auto E_xplore"), GDK_KEY_x, 0,
545 G_CALLBACK(unit_explore_callback), MGROUP_UNIT },
546 { "UNIT_PATROL", N_("_Patrol"), GDK_KEY_q, 0,
547 G_CALLBACK(unit_patrol_callback), MGROUP_UNIT },
548 { "UNIT_SENTRY", N_("_Sentry"), GDK_KEY_s, 0,
549 G_CALLBACK(unit_sentry_callback), MGROUP_UNIT },
550 { "UNIT_UNSENTRY", N_("Uns_entry All On Tile"), GDK_KEY_s, GDK_SHIFT_MASK,
551 G_CALLBACK(unit_unsentry_callback), MGROUP_UNIT },
552 { "UNIT_BOARD", N_("_Load"), GDK_KEY_l, 0,
553 G_CALLBACK(unit_board_callback), MGROUP_UNIT },
554 { "UNIT_DEBOARD", N_("_Unload"), GDK_KEY_u, 0,
555 G_CALLBACK(unit_deboard_callback), MGROUP_UNIT },
556 { "UNIT_UNLOAD_TRANSPORTER", N_("U_nload All From Transporter"),
557 GDK_KEY_t, GDK_SHIFT_MASK,
559 { "UNIT_HOMECITY", N_("Set _Home City"), GDK_KEY_h, 0,
560 G_CALLBACK(unit_homecity_callback), MGROUP_UNIT },
561 { "UNIT_UPGRADE", N_("Upgr_ade"), GDK_KEY_u, GDK_SHIFT_MASK,
562 G_CALLBACK(unit_upgrade_callback), MGROUP_UNIT },
563 { "UNIT_CONVERT", N_("C_onvert"), GDK_KEY_o, GDK_SHIFT_MASK,
564 G_CALLBACK(unit_convert_callback), MGROUP_UNIT },
565 { "UNIT_DISBAND", N_("_Disband"), GDK_KEY_d, GDK_SHIFT_MASK,
566 G_CALLBACK(unit_disband_callback), MGROUP_UNIT },
567 { "BUILD_CITY", N_("_Build City"), GDK_KEY_b, 0,
568 G_CALLBACK(build_city_callback), MGROUP_UNIT },
569 { "AUTO_SETTLER", N_("_Auto Settler"), GDK_KEY_a, 0,
570 G_CALLBACK(auto_settle_callback), MGROUP_UNIT },
571 { "BUILD_ROAD", N_("Build _Road"), GDK_KEY_r, 0,
572 G_CALLBACK(build_road_callback), MGROUP_UNIT },
573 { "BUILD_IRRIGATION", N_("Build _Irrigation"), GDK_KEY_i, 0,
575 { "CULTIVATE", N_("Cultivate"), GDK_KEY_i, GDK_SHIFT_MASK,
576 G_CALLBACK(cultivate_callback), MGROUP_UNIT },
577 { "BUILD_MINE", N_("Build _Mine"), GDK_KEY_m, 0,
578 G_CALLBACK(build_mine_callback), MGROUP_UNIT },
579 { "PLANT", N_("Plant"), GDK_KEY_m, GDK_SHIFT_MASK,
580 G_CALLBACK(plant_callback), MGROUP_UNIT },
581 { "CONNECT_ROAD", N_("Connect With Roa_d"), GDK_KEY_r, GDK_CONTROL_MASK,
582 G_CALLBACK(connect_road_callback), MGROUP_UNIT },
583 { "CONNECT_RAIL", N_("Connect With Rai_l"), GDK_KEY_l, GDK_CONTROL_MASK,
584 G_CALLBACK(connect_rail_callback), MGROUP_UNIT },
585 { "CONNECT_MAGLEV", N_("Connect With _Maglev"), GDK_KEY_m, GDK_CONTROL_MASK,
587 { "CONNECT_IRRIGATION", N_("Connect With Irri_gation"),
588 GDK_KEY_i, GDK_CONTROL_MASK,
590 { "TRANSFORM_TERRAIN", N_("Transf_orm Terrain"), GDK_KEY_o, 0,
592 { "CLEAN_POLLUTION", N_("Clean _Pollution"), GDK_KEY_p, 0,
594 { "CLEAN_FALLOUT", N_("Clean _Nuclear Fallout"), GDK_KEY_n, 0,
595 G_CALLBACK(clean_fallout_callback), MGROUP_UNIT },
596 { "FORTIFY", N_("Fortify"), GDK_KEY_f, 0,
597 G_CALLBACK(fortify_callback), MGROUP_UNIT },
598 { "BUILD_FORTRESS", N_("Build Fortress"), GDK_KEY_f, GDK_SHIFT_MASK,
600 { "BUILD_AIRBASE", N_("Build Airbase"), GDK_KEY_e, GDK_SHIFT_MASK,
601 G_CALLBACK(build_airbase_callback), MGROUP_UNIT },
602 { "DO_PARADROP", N_("P_aradrop"), GDK_KEY_j, 0,
603 G_CALLBACK(do_paradrop_callback), MGROUP_UNIT },
604 { "DO_PILLAGE", N_("_Pillage"), GDK_KEY_p, GDK_SHIFT_MASK,
605 G_CALLBACK(do_pillage_callback), MGROUP_UNIT },
606 { "DIPLOMAT_ACTION", N_("_Do..."), GDK_KEY_d, 0,
608
609 { "MENU_GOVERNMENT", N_("_Government"), 0, 0,
610 NULL, MGROUP_PLAYING },
611 { "TAX_RATE", N_("_Tax Rates..."), GDK_KEY_t, GDK_CONTROL_MASK,
612 G_CALLBACK(tax_rate_callback), MGROUP_PLAYING },
613 { "START_REVOLUTION", N_("_Revolution..."),
614 GDK_KEY_g, GDK_SHIFT_MASK | GDK_CONTROL_MASK,
615 G_CALLBACK(government_callback), MGROUP_PLAYING },
616 { NULL }
617};
618
619static struct menu_entry_info *menu_entry_info_find(const char *key);
620
621/************************************************************************/
624static void clear_chat_logs_callback(GtkMenuItem *item, gpointer data)
625{
627}
628
629/************************************************************************/
632static void save_chat_logs_callback(GtkMenuItem *item, gpointer data)
633{
635}
636
637/************************************************************************/
640static void local_options_callback(GtkMenuItem *item, gpointer data)
641{
642 option_dialog_popup(_("Set local options"), client_optset);
643}
644
645/************************************************************************/
648static void message_options_callback(GtkMenuItem *item, gpointer data)
649{
651}
652
653/************************************************************************/
656static void server_options_callback(GtkMenuItem *item, gpointer data)
657{
658 option_dialog_popup(_("Game Settings"), server_optset);
659}
660
661/************************************************************************/
664static void save_options_callback(GtkMenuItem *item, gpointer data)
665{
666 options_save(NULL);
667}
668
669/************************************************************************/
672static void reload_tileset_callback(GtkMenuItem *item, gpointer data)
673{
674 tilespec_reread(NULL, TRUE, 1.0);
675}
676
677/************************************************************************/
680static void save_game_callback(GtkMenuItem *item, gpointer data)
681{
682 send_save_game(NULL);
683}
684
685/************************************************************************/
688static void save_game_as_callback(GtkMenuItem *item, gpointer data)
689{
691}
692
693/************************************************************************/
696static void save_mapimg_callback(GtkMenuItem *item, gpointer data)
697{
698 mapimg_client_save(NULL);
699}
700
701/************************************************************************/
704static void save_mapimg_as_callback(GtkMenuItem *item, gpointer data)
705{
707}
708
709/************************************************************************/
713static void leave_local_game_response(GtkWidget *dialog, gint response)
714{
715 gtk_widget_destroy(dialog);
716 if (response == GTK_RESPONSE_OK) {
717 /* It might be killed already */
718 if (client.conn.used) {
719 /* It will also kill the server */
721 }
722 }
723}
724
725/************************************************************************/
728static void leave_callback(GtkMenuItem *item, gpointer data)
729{
730 if (is_server_running()) {
731 GtkWidget* dialog =
732 gtk_message_dialog_new(NULL, 0, GTK_MESSAGE_WARNING,
733 GTK_BUTTONS_OK_CANCEL,
734 _("Leaving a local game will end it!"));
735 setup_dialog(dialog, toplevel);
736 gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_MOUSE);
737 g_signal_connect(dialog, "response",
738 G_CALLBACK(leave_local_game_response), NULL);
739 gtk_window_present(GTK_WINDOW(dialog));
740 } else {
742 }
743}
744
745/************************************************************************/
748static void quit_callback(GtkMenuItem *item, gpointer data)
749{
751}
752
753/************************************************************************/
756static void find_city_callback(GtkMenuItem *item, gpointer data)
757{
759}
760
761/************************************************************************/
764static void worklists_callback(GtkMenuItem *item, gpointer data)
765{
767}
768
769/************************************************************************/
772static void map_view_callback(GtkMenuItem *item, gpointer data)
773{
775}
776
777/************************************************************************/
780static void report_nations_callback(GtkMenuItem *item, gpointer data)
781{
783}
784
785/************************************************************************/
788static void report_wow_callback(GtkMenuItem *item, gpointer data)
789{
791}
792
793/************************************************************************/
796static void report_top_cities_callback(GtkMenuItem *item, gpointer data)
797{
799}
800
801/************************************************************************/
804static void report_messages_callback(GtkMenuItem *item, gpointer data)
805{
807}
808
809/************************************************************************/
812static void client_lua_script_callback(GtkMenuItem *item, gpointer data)
813{
815}
816
817/************************************************************************/
820static void report_demographic_callback(GtkMenuItem *item, gpointer data)
821{
823}
824
825/************************************************************************/
828static void report_achievements_callback(GtkMenuItem *item, gpointer data)
829{
831}
832
833/************************************************************************/
836static void help_language_callback(GtkMenuItem *item, gpointer data)
837{
839}
840
841/************************************************************************/
844static void help_policies_callback(GtkMenuItem *item, gpointer data)
845{
847}
848
849/************************************************************************/
852static void help_connecting_callback(GtkMenuItem *item, gpointer data)
853{
855}
856
857/************************************************************************/
860static void help_controls_callback(GtkMenuItem *item, gpointer data)
861{
863}
864
865/************************************************************************/
868static void help_chatline_callback(GtkMenuItem *item, gpointer data)
869{
871}
872
873/************************************************************************/
876static void help_worklist_editor_callback(GtkMenuItem *item, gpointer data)
877{
879}
880
881/************************************************************************/
884static void help_cma_callback(GtkMenuItem *item, gpointer data)
885{
887}
888
889/************************************************************************/
892static void bg_select0_callback(GtkMenuItem *item, gpointer data)
893{
895}
896
897/************************************************************************/
900static void bg_assign0_callback(GtkMenuItem *item, gpointer data)
901{
903}
904
905/************************************************************************/
908static void bg_append0_callback(GtkMenuItem *item, gpointer data)
909{
911}
912
913/************************************************************************/
916static void bg_select1_callback(GtkMenuItem *item, gpointer data)
917{
919}
920
921/************************************************************************/
924static void bg_assign1_callback(GtkMenuItem *item, gpointer data)
925{
927}
928
929/************************************************************************/
932static void bg_append1_callback(GtkMenuItem *item, gpointer data)
933{
935}
936
937/************************************************************************/
940static void bg_select2_callback(GtkMenuItem *item, gpointer data)
941{
943}
944
945/************************************************************************/
948static void bg_assign2_callback(GtkMenuItem *item, gpointer data)
949{
951}
952
953/************************************************************************/
956static void bg_append2_callback(GtkMenuItem *item, gpointer data)
957{
959}
960
961/************************************************************************/
964static void bg_select3_callback(GtkMenuItem *item, gpointer data)
965{
967}
968
969/************************************************************************/
972static void bg_assign3_callback(GtkMenuItem *item, gpointer data)
973{
975}
976
977/************************************************************************/
980static void bg_append3_callback(GtkMenuItem *item, gpointer data)
981{
983}
984
985/************************************************************************/
988static void help_overview_callback(GtkMenuItem *item, gpointer data)
989{
991}
992
993/************************************************************************/
996static void help_playing_callback(GtkMenuItem *item, gpointer data)
997{
999}
1000
1001/************************************************************************/
1004static void help_ruleset_callback(GtkMenuItem *item, gpointer data)
1005{
1007}
1008
1009/************************************************************************/
1012static void help_tileset_callback(GtkMenuItem *item, gpointer data)
1013{
1015}
1016
1017/************************************************************************/
1020static void help_economy_callback(GtkMenuItem *item, gpointer data)
1021{
1023}
1024
1025/************************************************************************/
1028static void help_cities_callback(GtkMenuItem *item, gpointer data)
1029{
1031}
1032
1033/************************************************************************/
1036static void help_improvements_callback(GtkMenuItem *item, gpointer data)
1037{
1039}
1040
1041/************************************************************************/
1044static void help_units_callback(GtkMenuItem *item, gpointer data)
1045{
1047}
1048
1049/************************************************************************/
1052static void help_combat_callback(GtkMenuItem *item, gpointer data)
1053{
1055}
1056
1057/************************************************************************/
1060static void help_zoc_callback(GtkMenuItem *item, gpointer data)
1061{
1063}
1064
1065/************************************************************************/
1068static void help_tech_callback(GtkMenuItem *item, gpointer data)
1069{
1071}
1072
1073/************************************************************************/
1076static void help_terrain_callback(GtkMenuItem *item, gpointer data)
1077{
1079}
1080
1081/************************************************************************/
1084static void help_wonders_callback(GtkMenuItem *item, gpointer data)
1085{
1087}
1088
1089/************************************************************************/
1092static void help_government_callback(GtkMenuItem *item, gpointer data)
1093{
1095}
1096
1097/************************************************************************/
1100static void help_diplomacy_callback(GtkMenuItem *item, gpointer data)
1101{
1103}
1104
1105/************************************************************************/
1108static void help_space_race_callback(GtkMenuItem *item, gpointer data)
1109{
1111}
1112
1113/************************************************************************/
1116static void help_nations_callback(GtkMenuItem *item, gpointer data)
1117{
1119}
1120
1121/************************************************************************/
1124static void help_copying_callback(GtkMenuItem *item, gpointer data)
1125{
1127}
1128
1129/************************************************************************/
1132static void help_about_callback(GtkMenuItem *item, gpointer data)
1133{
1135}
1136
1137/************************************************************************/
1140static void save_options_on_exit_callback(GtkCheckMenuItem *item,
1141 gpointer data)
1142{
1143 gui_options.save_options_on_exit = gtk_check_menu_item_get_active(item);
1144}
1145
1146/************************************************************************/
1149static void edit_mode_callback(GtkCheckMenuItem *item, gpointer data)
1150{
1151 if (game.info.is_edit_mode ^ gtk_check_menu_item_get_active(item)) {
1153 /* Unreachable techs in reqtree on/off */
1155 }
1156}
1157
1158/************************************************************************/
1161static void show_city_outlines_callback(GtkCheckMenuItem *item,
1162 gpointer data)
1163{
1164 if (gui_options.draw_city_outlines ^ gtk_check_menu_item_get_active(item)) {
1166 }
1167}
1168
1169/************************************************************************/
1172static void show_city_output_callback(GtkCheckMenuItem *item,
1173 gpointer data)
1174{
1175 if (gui_options.draw_city_output ^ gtk_check_menu_item_get_active(item)) {
1177 }
1178}
1179
1180/************************************************************************/
1183static void show_map_grid_callback(GtkCheckMenuItem *item,
1184 gpointer data)
1185{
1186 if (gui_options.draw_map_grid ^ gtk_check_menu_item_get_active(item)) {
1188 }
1189}
1190
1191/************************************************************************/
1194static void show_national_borders_callback(GtkCheckMenuItem *item,
1195 gpointer data)
1196{
1197 if (gui_options.draw_borders ^ gtk_check_menu_item_get_active(item)) {
1199 }
1200}
1201
1202/************************************************************************/
1205static void show_native_tiles_callback(GtkCheckMenuItem *item,
1206 gpointer data)
1207{
1208 if (gui_options.draw_native ^ gtk_check_menu_item_get_active(item)) {
1210 }
1211}
1212
1213/************************************************************************/
1216static void show_city_full_bar_callback(GtkCheckMenuItem *item,
1217 gpointer data)
1218{
1219 if (gui_options.draw_full_citybar ^ gtk_check_menu_item_get_active(item)) {
1222 }
1223}
1224
1225/************************************************************************/
1228static void show_city_names_callback(GtkCheckMenuItem *item,
1229 gpointer data)
1230{
1231 if (gui_options.draw_city_names ^ gtk_check_menu_item_get_active(item)) {
1234 }
1235}
1236
1237/************************************************************************/
1240static void show_city_growth_callback(GtkCheckMenuItem *item,
1241 gpointer data)
1242{
1243 if (gui_options.draw_city_growth ^ gtk_check_menu_item_get_active(item)) {
1245 }
1246}
1247
1248/************************************************************************/
1251static void show_city_productions_callback(GtkCheckMenuItem *item,
1252 gpointer data)
1253{
1254 if (gui_options.draw_city_productions ^ gtk_check_menu_item_get_active(item)) {
1257 }
1258}
1259
1260/************************************************************************/
1263static void show_city_buy_cost_callback(GtkCheckMenuItem *item,
1264 gpointer data)
1265{
1266 if (gui_options.draw_city_buycost ^ gtk_check_menu_item_get_active(item)) {
1268 }
1269}
1270
1271/************************************************************************/
1274static void show_city_trade_routes_callback(GtkCheckMenuItem *item,
1275 gpointer data)
1276{
1277 if (gui_options.draw_city_trade_routes ^ gtk_check_menu_item_get_active(item)) {
1279 }
1280}
1281
1282/************************************************************************/
1285static void show_terrain_callback(GtkCheckMenuItem *item, gpointer data)
1286{
1287 if (gui_options.draw_terrain ^ gtk_check_menu_item_get_active(item)) {
1290 }
1291}
1292
1293/************************************************************************/
1296static void show_coastline_callback(GtkCheckMenuItem *item, gpointer data)
1297{
1298 if (gui_options.draw_coastline ^ gtk_check_menu_item_get_active(item)) {
1300 }
1301}
1302
1303/************************************************************************/
1306static void show_road_rails_callback(GtkCheckMenuItem *item, gpointer data)
1307{
1308 if (gui_options.draw_roads_rails ^ gtk_check_menu_item_get_active(item)) {
1310 }
1311}
1312
1313/************************************************************************/
1316static void show_irrigation_callback(GtkCheckMenuItem *item, gpointer data)
1317{
1318 if (gui_options.draw_irrigation ^ gtk_check_menu_item_get_active(item)) {
1320 }
1321}
1322
1323/************************************************************************/
1326static void show_mine_callback(GtkCheckMenuItem *item, gpointer data)
1327{
1328 if (gui_options.draw_mines ^ gtk_check_menu_item_get_active(item)) {
1330 }
1331}
1332
1333/************************************************************************/
1336static void show_bases_callback(GtkCheckMenuItem *item, gpointer data)
1337{
1338 if (gui_options.draw_fortress_airbase ^ gtk_check_menu_item_get_active(item)) {
1340 }
1341}
1342
1343/************************************************************************/
1346static void show_resources_callback(GtkCheckMenuItem *item, gpointer data)
1347{
1348 if (gui_options.draw_specials ^ gtk_check_menu_item_get_active(item)) {
1350 }
1351}
1352
1353/************************************************************************/
1356static void show_huts_callback(GtkCheckMenuItem *item, gpointer data)
1357{
1358 if (gui_options.draw_huts ^ gtk_check_menu_item_get_active(item)) {
1360 }
1361}
1362
1363/************************************************************************/
1366static void show_pollution_callback(GtkCheckMenuItem *item, gpointer data)
1367{
1368 if (gui_options.draw_pollution ^ gtk_check_menu_item_get_active(item)) {
1370 }
1371}
1372
1373/************************************************************************/
1376static void show_cities_callback(GtkCheckMenuItem *item, gpointer data)
1377{
1378 if (gui_options.draw_cities ^ gtk_check_menu_item_get_active(item)) {
1380 }
1381}
1382
1383/************************************************************************/
1386static void show_units_callback(GtkCheckMenuItem *item, gpointer data)
1387{
1388 if (gui_options.draw_units ^ gtk_check_menu_item_get_active(item)) {
1391 }
1392}
1393
1394/************************************************************************/
1397static void show_unit_solid_bg_callback(GtkCheckMenuItem *item,
1398 gpointer data)
1399{
1400 if (gui_options.solid_color_behind_units ^ gtk_check_menu_item_get_active(item)) {
1402 }
1403}
1404
1405/************************************************************************/
1408static void show_unit_shields_callback(GtkCheckMenuItem *item,
1409 gpointer data)
1410{
1411 if (gui_options.draw_unit_shields ^ gtk_check_menu_item_get_active(item)) {
1413 }
1414}
1415
1416/************************************************************************/
1419static void show_stack_size_callback(GtkCheckMenuItem *item,
1420 gpointer data)
1421{
1422 if (gui_options.draw_unit_stack_size ^ gtk_check_menu_item_get_active(item)) {
1424 }
1425}
1426
1427/************************************************************************/
1430static void show_focus_unit_callback(GtkCheckMenuItem *item, gpointer data)
1431{
1432 if (gui_options.draw_focus_unit ^ gtk_check_menu_item_get_active(item)) {
1435 }
1436}
1437
1438/************************************************************************/
1441static void show_fog_of_war_callback(GtkCheckMenuItem *item, gpointer data)
1442{
1443 if (gui_options.draw_fog_of_war ^ gtk_check_menu_item_get_active(item)) {
1446 }
1447}
1448
1449/************************************************************************/
1452static void full_screen_callback(GtkCheckMenuItem *item, gpointer data)
1453{
1454 if (GUI_GTK_OPTION(fullscreen) ^ gtk_check_menu_item_get_active(item)) {
1455 GUI_GTK_OPTION(fullscreen) ^= 1;
1456
1458 }
1459}
1460
1461/************************************************************************/
1464static void recalc_borders_callback(GtkMenuItem *item, gpointer data)
1465{
1467}
1468
1469/************************************************************************/
1472static void toggle_fog_callback(GtkMenuItem *item, gpointer data)
1473{
1475}
1476
1477/************************************************************************/
1480static void scenario_properties_callback(GtkMenuItem *item, gpointer data)
1481{
1482 struct property_editor *pe;
1483
1487}
1488
1489/************************************************************************/
1492static void save_scenario_callback(GtkMenuItem *item, gpointer data)
1493{
1495}
1496
1497/************************************************************************/
1500static void select_single_callback(GtkMenuItem *item, gpointer data)
1501{
1502 request_unit_select(get_units_in_focus(), SELTYPE_SINGLE, SELLOC_TILE);
1503}
1504
1505/************************************************************************/
1508static void select_all_on_tile_callback(GtkMenuItem *item, gpointer data)
1509{
1510 request_unit_select(get_units_in_focus(), SELTYPE_ALL, SELLOC_TILE);
1511}
1512
1513/************************************************************************/
1516static void select_same_type_tile_callback(GtkMenuItem *item, gpointer data)
1517{
1518 request_unit_select(get_units_in_focus(), SELTYPE_SAME, SELLOC_TILE);
1519}
1520
1521/************************************************************************/
1524static void select_same_type_cont_callback(GtkMenuItem *item, gpointer data)
1525{
1526 request_unit_select(get_units_in_focus(), SELTYPE_SAME, SELLOC_CONT);
1527}
1528
1529/************************************************************************/
1532static void select_same_type_callback(GtkMenuItem *item, gpointer data)
1533{
1534 request_unit_select(get_units_in_focus(), SELTYPE_SAME, SELLOC_WORLD);
1535}
1536
1537/************************************************************************/
1540static void select_dialog_callback(GtkMenuItem *item, gpointer data)
1541{
1543}
1544
1545/************************************************************************/
1548static void rally_dialog_callback(GtkMenuItem *item, gpointer data)
1549{
1551}
1552
1553/************************************************************************/
1556static void infra_dialog_callback(GtkMenuItem *item, gpointer data)
1557{
1559}
1560
1561/************************************************************************/
1564static void unit_wait_callback(GtkMenuItem *item, gpointer data)
1565{
1566 key_unit_wait();
1567}
1568
1569/************************************************************************/
1572static void unit_done_callback(GtkMenuItem *item, gpointer data)
1573{
1574 key_unit_done();
1575}
1576
1577/************************************************************************/
1580static void unit_goto_callback(GtkMenuItem *item, gpointer data)
1581{
1582 key_unit_goto();
1583}
1584
1585/************************************************************************/
1588static void unit_goto_and_callback(GtkMenuItem *item, gpointer data)
1589{
1590 int sub_target = NO_TARGET;
1591 struct action *paction = g_object_get_data(G_OBJECT(item), "end_action");
1592
1593 fc_assert_ret(paction != NULL);
1594
1595 switch (action_get_sub_target_kind(paction)) {
1596 case ASTK_BUILDING:
1597 {
1598 struct impr_type *pbuilding = g_object_get_data(G_OBJECT(item),
1599 "end_building");
1600 fc_assert_ret(pbuilding != NULL);
1601 sub_target = improvement_number(pbuilding);
1602 }
1603 break;
1604 case ASTK_TECH:
1605 {
1606 struct advance *ptech = g_object_get_data(G_OBJECT(item),
1607 "end_tech");
1608 fc_assert_ret(ptech != NULL);
1609 sub_target = advance_number(ptech);
1610 }
1611 break;
1612 case ASTK_EXTRA:
1613 case ASTK_EXTRA_NOT_THERE:
1614 {
1615 struct extra_type *pextra = g_object_get_data(G_OBJECT(item),
1616 "end_extra");
1617 fc_assert_ret(pextra != NULL);
1618 sub_target = extra_number(pextra);
1619 }
1620 break;
1621 case ASTK_NONE:
1622 sub_target = NO_TARGET;
1623 break;
1624 case ASTK_COUNT:
1625 /* Should not exits */
1626 fc_assert(action_get_sub_target_kind(paction) != ASTK_COUNT);
1627 break;
1628 }
1629
1630 request_unit_goto(ORDER_PERFORM_ACTION, paction->id, sub_target);
1631}
1632
1633/************************************************************************/
1636static void unit_goto_city_callback(GtkMenuItem *item, gpointer data)
1637{
1638 if (get_num_units_in_focus() > 0) {
1640 }
1641}
1642
1643/************************************************************************/
1646static void unit_return_callback(GtkMenuItem *item, gpointer data)
1647{
1651}
1652
1653/************************************************************************/
1656static void unit_explore_callback(GtkMenuItem *item, gpointer data)
1657{
1659}
1660
1661/************************************************************************/
1664static void unit_patrol_callback(GtkMenuItem *item, gpointer data)
1665{
1667}
1668
1669/************************************************************************/
1672static void unit_sentry_callback(GtkMenuItem *item, gpointer data)
1673{
1675}
1676
1677/************************************************************************/
1680static void unit_unsentry_callback(GtkMenuItem *item, gpointer data)
1681{
1683}
1684
1685/************************************************************************/
1688static void unit_board_callback(GtkMenuItem *item, gpointer data)
1689{
1693}
1694
1695/************************************************************************/
1698static void unit_deboard_callback(GtkMenuItem *item, gpointer data)
1699{
1703}
1704
1705/************************************************************************/
1709 gpointer data)
1710{
1712}
1713
1714/************************************************************************/
1717static void unit_homecity_callback(GtkMenuItem *item, gpointer data)
1718{
1720}
1721
1722/************************************************************************/
1725static void unit_upgrade_callback(GtkMenuItem *item, gpointer data)
1726{
1728}
1729
1730/************************************************************************/
1733static void unit_convert_callback(GtkMenuItem *item, gpointer data)
1734{
1736}
1737
1738/************************************************************************/
1741static void unit_disband_callback(GtkMenuItem *item, gpointer data)
1742{
1744}
1745
1746/************************************************************************/
1749static void build_city_callback(GtkMenuItem *item, gpointer data)
1750{
1752 /* FIXME: this can provide different items for different units...
1753 * not good! */
1754 /* Enable the button for adding to a city in all cases, so we
1755 get an eventual error message from the server if we try. */
1759 ACTION_HELP_WONDER)) {
1760 request_unit_caravan_action(punit, ACTION_HELP_WONDER);
1761 }
1763}
1764
1765/************************************************************************/
1768static void auto_settle_callback(GtkMenuItem *action, gpointer data)
1769{
1771}
1772
1773/************************************************************************/
1776static void build_road_callback(GtkMenuItem *action, gpointer data)
1777{
1779 /* FIXME: this can provide different actions for different units...
1780 * not good! */
1782 EC_ROAD,
1784 punit);
1785 bool building_road = FALSE;
1786
1787 if (tgt != NULL
1788 && can_unit_do_activity_targeted_client(punit, ACTIVITY_GEN_ROAD, tgt)) {
1789 request_new_unit_activity_targeted(punit, ACTIVITY_GEN_ROAD, tgt);
1790 building_road = TRUE;
1791 }
1792
1793 if (!building_road && unit_can_est_trade_route_here(punit)) {
1794 request_unit_caravan_action(punit, ACTION_TRADE_ROUTE);
1795 }
1797}
1798
1799/************************************************************************/
1802static void build_irrigation_callback(GtkMenuItem *action, gpointer data)
1803{
1805}
1806
1807/************************************************************************/
1810static void cultivate_callback(GtkMenuItem *action, gpointer data)
1811{
1813}
1814
1815/************************************************************************/
1818static void build_mine_callback(GtkMenuItem *action, gpointer data)
1819{
1820 key_unit_mine();
1821}
1822
1823/************************************************************************/
1826static void plant_callback(GtkMenuItem *action, gpointer data)
1827{
1829}
1830
1831/************************************************************************/
1834static void connect_road_callback(GtkMenuItem *action, gpointer data)
1835{
1836 struct road_type *proad = road_by_gui_type(ROAD_GUI_ROAD);
1837
1838 if (proad != NULL) {
1839 struct extra_type *tgt;
1840
1841 tgt = road_extra_get(proad);
1842
1843 key_unit_connect(ACTIVITY_GEN_ROAD, tgt);
1844 }
1845}
1846
1847/************************************************************************/
1850static void connect_rail_callback(GtkMenuItem *action, gpointer data)
1851{
1852 struct road_type *prail = road_by_gui_type(ROAD_GUI_RAILROAD);
1853
1854 if (prail != NULL) {
1855 struct extra_type *tgt;
1856
1857 tgt = road_extra_get(prail);
1858
1859 key_unit_connect(ACTIVITY_GEN_ROAD, tgt);
1860 }
1861}
1862
1863/************************************************************************/
1866static void connect_maglev_callback(GtkMenuItem *action, gpointer data)
1867{
1868 struct road_type *pmaglev = road_by_gui_type(ROAD_GUI_MAGLEV);
1869
1870 if (pmaglev != NULL) {
1871 struct extra_type *tgt;
1872
1873 tgt = road_extra_get(pmaglev);
1874
1875 key_unit_connect(ACTIVITY_GEN_ROAD, tgt);
1876 }
1877}
1878
1879/************************************************************************/
1882static void connect_irrigation_callback(GtkMenuItem *action, gpointer data)
1883{
1884 struct extra_type_list *extras = extra_type_list_by_cause(EC_IRRIGATION);
1885
1886 if (extra_type_list_size(extras) > 0) {
1887 struct extra_type *pextra;
1888
1889 pextra = extra_type_list_get(extra_type_list_by_cause(EC_IRRIGATION), 0);
1890
1891 key_unit_connect(ACTIVITY_IRRIGATE, pextra);
1892 }
1893}
1894
1895/************************************************************************/
1898static void transform_terrain_callback(GtkMenuItem *action, gpointer data)
1899{
1901}
1902
1903/************************************************************************/
1906static void clean_pollution_callback(GtkMenuItem *action, gpointer data)
1907{
1909 struct extra_type *pextra;
1910
1911 pextra = prev_extra_in_tile(unit_tile(punit), ERM_CLEANPOLLUTION,
1913
1914 if (pextra != NULL) {
1915 request_new_unit_activity_targeted(punit, ACTIVITY_POLLUTION, pextra);
1916 }
1918}
1919
1920/************************************************************************/
1923static void clean_fallout_callback(GtkMenuItem *action, gpointer data)
1924{
1926}
1927
1928/************************************************************************/
1931static void build_fortress_callback(GtkMenuItem *action, gpointer data)
1932{
1934}
1935
1936/************************************************************************/
1939static void fortify_callback(GtkMenuItem *action, gpointer data)
1940{
1944}
1945
1946/************************************************************************/
1949static void build_airbase_callback(GtkMenuItem *action, gpointer data)
1950{
1952}
1953
1954/************************************************************************/
1957static void do_paradrop_callback(GtkMenuItem *action, gpointer data)
1958{
1960}
1961
1962/************************************************************************/
1965static void do_pillage_callback(GtkMenuItem *action, gpointer data)
1966{
1968}
1969
1970/************************************************************************/
1973static void diplomat_action_callback(GtkMenuItem *action, gpointer data)
1974{
1976}
1977
1978/************************************************************************/
1981static void tax_rate_callback(GtkMenuItem *action, gpointer data)
1982{
1984}
1985
1986/************************************************************************/
1989static void multiplier_callback(GtkMenuItem *action, gpointer data)
1990{
1992}
1993
1994/************************************************************************/
1997static void government_callback(GtkMenuItem *item, gpointer data)
1998{
2000}
2001
2002/************************************************************************/
2005static void base_callback(GtkMenuItem *item, gpointer data)
2006{
2007 struct extra_type *pextra = data;
2008
2010 request_new_unit_activity_targeted(punit, ACTIVITY_BASE, pextra);
2012}
2013
2014/************************************************************************/
2017static void road_callback(GtkMenuItem *item, gpointer data)
2018{
2019 struct extra_type *pextra = data;
2020
2022 request_new_unit_activity_targeted(punit, ACTIVITY_GEN_ROAD,
2023 pextra);
2025}
2026
2027/************************************************************************/
2030static void center_view_callback(GtkMenuItem *action, gpointer data)
2031{
2033}
2034
2035/************************************************************************/
2038static void report_units_callback(GtkMenuItem *action, gpointer data)
2039{
2041}
2042
2043/************************************************************************/
2046static void report_cities_callback(GtkMenuItem *action, gpointer data)
2047{
2049}
2050
2051/************************************************************************/
2054static void report_economy_callback(GtkMenuItem *action, gpointer data)
2055{
2057}
2058
2059/************************************************************************/
2062static void report_research_callback(GtkMenuItem *action, gpointer data)
2063{
2065}
2066
2067/************************************************************************/
2070static void report_spaceship_callback(GtkMenuItem *action, gpointer data)
2071{
2072 if (NULL != client.conn.playing) {
2074 }
2075}
2076
2077/************************************************************************/
2080static void menu_entry_init(GtkBuildable *item)
2081{
2082 const char *key = gtk_buildable_get_name(item);
2084
2085 if (info != NULL) {
2086 gtk_menu_item_set_label(GTK_MENU_ITEM(item),
2087 Q_(info->name));
2088 gtk_menu_item_set_use_underline(GTK_MENU_ITEM(item), TRUE);
2089 if (info->cb != NULL) {
2090 g_signal_connect(item, "activate", info->cb, NULL);
2091 }
2092
2093 if (info->accel != 0) {
2094 const char *path = gtk_menu_item_get_accel_path(GTK_MENU_ITEM(item));
2095
2096 if (path == NULL) {
2097 char buf[512];
2098
2099 fc_snprintf(buf, sizeof(buf), "<MENU>/%s", key);
2100 gtk_menu_item_set_accel_path(GTK_MENU_ITEM(item), buf);
2101 path = buf; /* Not NULL, but not usable either outside this block */
2102 }
2103
2104 if (path != NULL) {
2105 gtk_accel_map_add_entry(gtk_menu_item_get_accel_path(GTK_MENU_ITEM(item)),
2106 info->accel, info->accel_mod);
2107 }
2108 }
2109
2110 return;
2111 }
2112
2113 /* temporary naming solution */
2114 gtk_menu_item_set_label(GTK_MENU_ITEM(item), key);
2115}
2116
2117/************************************************************************/
2120static const gchar *get_ui_filename(void)
2121{
2122 static char filename[256];
2123 const char *name;
2124
2125 if ((name = getenv("FREECIV_MENUS"))
2126 || (name = fileinfoname(get_data_dirs(), "gtk3.22_menus.xml"))) {
2127 sz_strlcpy(filename, name);
2128 } else {
2129 log_error("Gtk menus: file definition not found");
2130 filename[0] = '\0';
2131 }
2132
2133 log_verbose("ui menu file is \"%s\".", filename);
2134 return filename;
2135}
2136
2137/************************************************************************/
2140GtkWidget *setup_menus(GtkWidget *window)
2141{
2142 GtkWidget *menubar = NULL;
2143 GError *error = NULL;
2144
2145 ui_builder = gtk_builder_new();
2146 if (!gtk_builder_add_from_file(ui_builder, get_ui_filename(), &error)) {
2147 log_error("Gtk menus: %s", error->message);
2148 g_error_free(error);
2149 } else {
2150 GSList *entries;
2151 GSList *next;
2152
2153 entries = gtk_builder_get_objects(ui_builder);
2154 next = entries;
2155
2156 while (next != NULL) {
2157 GObject *obj = next->data;
2158
2159 if (GTK_IS_MENU_ITEM(obj)) {
2160 if (!GTK_IS_SEPARATOR_MENU_ITEM(obj)) {
2161 menu_entry_init(GTK_BUILDABLE(obj));
2162 }
2163 } else if (GTK_IS_MENU(obj)) {
2164 const char *key = gtk_buildable_get_name(GTK_BUILDABLE(obj));
2165
2166 if (key[0] == '<') {
2167 GtkAccelGroup *ac_group = gtk_menu_get_accel_group(GTK_MENU(obj));
2168
2169 if (ac_group == NULL) {
2170 ac_group = gtk_accel_group_new();
2171 gtk_menu_set_accel_group(GTK_MENU(obj), ac_group);
2172 }
2173
2174 gtk_window_add_accel_group(GTK_WINDOW(window), ac_group);
2175
2176 gtk_menu_set_accel_path(GTK_MENU(obj), key);
2177 }
2178 }
2179
2180 next = next->next;
2181 }
2182
2183 g_slist_free(entries);
2184
2185 menubar = GTK_WIDGET(gtk_builder_get_object(ui_builder, "MENU"));
2186 gtk_widget_set_visible(menubar, TRUE);
2187 gtk_widget_show_all(menubar);
2188 }
2189
2190#ifndef FREECIV_DEBUG
2191 menu_entry_set_visible("RELOAD_TILESET", FALSE, FALSE);
2192#endif /* FREECIV_DEBUG */
2193
2194 return menubar;
2195}
2196
2197/************************************************************************/
2200static struct menu_entry_info *menu_entry_info_find(const char *key)
2201{
2202 int i;
2203
2204 for (i = 0; menu_entries[i].key != NULL; i++) {
2205 if (!strcmp(key, menu_entries[i].key)) {
2206 return &(menu_entries[i]);
2207 }
2208 }
2209
2210 return NULL;
2211}
2212
2213/************************************************************************/
2216static void menu_entry_set_active(const char *key,
2217 gboolean is_active)
2218{
2219 GtkCheckMenuItem *item = GTK_CHECK_MENU_ITEM(gtk_builder_get_object(ui_builder, key));
2220
2221 if (item != NULL) {
2222 gtk_check_menu_item_set_active(item, is_active);
2223 }
2224}
2225
2226/************************************************************************/
2229static void menu_entry_set_sensitive(const char *key,
2230 gboolean is_sensitive)
2231{
2232 GtkWidget *item = GTK_WIDGET(gtk_builder_get_object(ui_builder, key));
2233
2234 if (item != NULL) {
2235 gtk_widget_set_sensitive(item, is_sensitive);
2236 }
2237}
2238
2239/************************************************************************/
2243 gboolean is_sensitive)
2244{
2245 int i;
2246
2247 for (i = 0; menu_entries[i].key != NULL; i++) {
2248 if (menu_entries[i].grouping == group || group == MGROUP_ALL) {
2249 menu_entry_set_sensitive(menu_entries[i].key, is_sensitive);
2250 }
2251 }
2252}
2253
2254/************************************************************************/
2257#ifndef FREECIV_DEBUG
2258static void menu_entry_set_visible(const char *key,
2259 gboolean is_visible,
2260 gboolean is_sensitive)
2261{
2262 GtkWidget *item = GTK_WIDGET(gtk_builder_get_object(ui_builder, key));
2263
2264 if (item != NULL) {
2265 gtk_widget_set_visible(item, is_visible);
2266 gtk_widget_set_sensitive(item, is_sensitive);
2267 }
2268}
2269#endif /* FREECIV_DEBUG */
2270
2271/************************************************************************/
2274static void menus_rename(const char *key,
2275 const gchar *new_label)
2276{
2277 GtkWidget *item = GTK_WIDGET(gtk_builder_get_object(ui_builder, key));
2278
2279 if (item != NULL) {
2280 gtk_menu_item_set_label(GTK_MENU_ITEM(item), new_label);
2281 }
2282}
2283
2284/************************************************************************/
2287static GtkMenu *find_menu(const char *key)
2288{
2289 return GTK_MENU(gtk_builder_get_object(ui_builder, key));
2290}
2291
2292/************************************************************************/
2296{
2297 /* The "full" city bar (i.e. the new way of drawing the
2298 * city name), can draw the city growth even without drawing
2299 * the city name. But the old method cannot. */
2301 menu_entry_set_sensitive("SHOW_CITY_GROWTH", TRUE);
2302 menu_entry_set_sensitive("SHOW_CITY_TRADE_ROUTES", TRUE);
2303 } else {
2305 menu_entry_set_sensitive("SHOW_CITY_TRADE_ROUTES",
2307 }
2308
2309 menu_entry_set_sensitive("SHOW_CITY_BUY_COST",
2312 menu_entry_set_sensitive("SHOW_UNIT_SOLID_BG",
2314 menu_entry_set_sensitive("SHOW_UNIT_SHIELDS",
2316 menu_entry_set_sensitive("SHOW_STACK_SIZE",
2318 menu_entry_set_sensitive("SHOW_FOCUS_UNIT", !gui_options.draw_units);
2319}
2320
2321/************************************************************************/
2327static const char *get_tile_change_menu_text(struct tile *ptile,
2328 enum unit_activity activity)
2329{
2330 struct tile *newtile = tile_virtual_new(ptile);
2331 const char *text;
2332
2333 tile_apply_activity(newtile, activity, NULL);
2334 text = tile_get_info_text(newtile, FALSE, 0);
2335 tile_virtual_destroy(newtile);
2336 return text;
2337}
2338
2339/************************************************************************/
2343{
2344 struct unit_list *punits = NULL;
2345 bool units_all_same_tile = TRUE, units_all_same_type = TRUE;
2346 GtkMenu *menu;
2347 char acttext[128], irrtext[128], mintext[128], transtext[128];
2348 char cultext[128], plantext[128];
2349 struct terrain *pterrain;
2350 bool conn_possible;
2351 struct road_type *proad;
2352 struct extra_type_list *extras;
2353
2354 if (ui_builder == NULL || !can_client_change_view()) {
2355 return;
2356 }
2357
2358 if (get_num_units_in_focus() > 0) {
2359 const struct tile *ptile = NULL;
2360 const struct unit_type *ptype = NULL;
2361 punits = get_units_in_focus();
2362 unit_list_iterate(punits, punit) {
2363 fc_assert((ptile==NULL) == (ptype==NULL));
2364 if (ptile || ptype) {
2365 if (unit_tile(punit) != ptile) {
2366 units_all_same_tile = FALSE;
2367 }
2368 if (unit_type_get(punit) != ptype) {
2369 units_all_same_type = FALSE;
2370 }
2371 } else {
2372 ptile = unit_tile(punit);
2373 ptype = unit_type_get(punit);
2374 }
2376 }
2377
2380 && !editor_is_active());
2382 && !editor_is_active() && punits != NULL);
2383
2385 menu_entry_set_sensitive("EDIT_MODE",
2389 menu_entry_set_sensitive("INFRA_DLG", terrain_control.infrapoints);
2390
2391 {
2392 char road_buf[500];
2393
2394 proad = road_by_gui_type(ROAD_GUI_ROAD);
2395 if (proad != NULL) {
2396 /* TRANS: Connect with some road type (Road/Railroad) */
2397 snprintf(road_buf, sizeof(road_buf), _("Connect With %s"),
2399 menus_rename("CONNECT_ROAD", road_buf);
2400 }
2401
2402 proad = road_by_gui_type(ROAD_GUI_RAILROAD);
2403 if (proad != NULL) {
2404 snprintf(road_buf, sizeof(road_buf), _("Connect With %s"),
2406 menus_rename("CONNECT_RAIL", road_buf);
2407 }
2408
2409 proad = road_by_gui_type(ROAD_GUI_MAGLEV);
2410 if (proad != NULL) {
2411 snprintf(road_buf, sizeof(road_buf), _("Connect With %s"),
2413 menus_rename("CONNECT_MAGLEV", road_buf);
2414 }
2415 }
2416
2417 menu_entry_set_sensitive("REPORT_SPACESHIP",
2418 client_player() != NULL && client_player()->spaceship.state != SSHIP_NONE);
2419
2420 if (!can_client_issue_orders()) {
2421 return;
2422 }
2423
2424 /* Set government sensitivity. */
2425 if ((menu = find_menu("<MENU>/GOVERNMENT"))) {
2426 GList *list, *iter;
2427 struct government *pgov;
2428
2429 list = gtk_container_get_children(GTK_CONTAINER(menu));
2430 for (iter = list; NULL != iter; iter = g_list_next(iter)) {
2431 pgov = g_object_get_data(G_OBJECT(iter->data), "government");
2432 if (NULL != pgov) {
2433 gtk_widget_set_sensitive(GTK_WIDGET(iter->data),
2435 pgov));
2436 } else {
2437 /* Revolution without target government */
2438 gtk_widget_set_sensitive(GTK_WIDGET(iter->data),
2440 }
2441 }
2442 g_list_free(list);
2443 }
2444
2445 if (!punits) {
2446 return;
2447 }
2448
2449 /* Remaining part of this function: Update Unit, Work, and Combat menus */
2450
2451 /* Set base sensitivity. */
2452 if ((menu = find_menu("<MENU>/BUILD_BASE"))) {
2453 GList *list, *iter;
2454 struct extra_type *pextra;
2455
2456 list = gtk_container_get_children(GTK_CONTAINER(menu));
2457 for (iter = list; NULL != iter; iter = g_list_next(iter)) {
2458 pextra = g_object_get_data(G_OBJECT(iter->data), "base");
2459 if (NULL != pextra) {
2460 gtk_widget_set_sensitive(GTK_WIDGET(iter->data),
2462 ACTIVITY_BASE,
2463 pextra));
2464 }
2465 }
2466 g_list_free(list);
2467 }
2468
2469 /* Set road sensitivity. */
2470 if ((menu = find_menu("<MENU>/BUILD_PATH"))) {
2471 GList *list, *iter;
2472 struct extra_type *pextra;
2473
2474 list = gtk_container_get_children(GTK_CONTAINER(menu));
2475 for (iter = list; NULL != iter; iter = g_list_next(iter)) {
2476 pextra = g_object_get_data(G_OBJECT(iter->data), "road");
2477 if (NULL != pextra) {
2478 gtk_widget_set_sensitive(GTK_WIDGET(iter->data),
2480 ACTIVITY_GEN_ROAD,
2481 pextra));
2482 }
2483 }
2484 g_list_free(list);
2485 }
2486
2487 /* Set Go to and... action visibility. */
2488 if ((menu = find_menu("<MENU>/GOTO_AND"))) {
2489 GList *list, *iter;
2490 struct action *paction;
2491
2492 bool can_do_something = FALSE;
2493
2494 /* Enable a menu item if it is theoretically possible that one of the
2495 * selected units can perform it. Checking if the action can be performed
2496 * at the current tile is pointless since it should be performed at the
2497 * target tile. */
2498 list = gtk_container_get_children(GTK_CONTAINER(menu));
2499 for (iter = list; NULL != iter; iter = g_list_next(iter)) {
2500 paction = g_object_get_data(G_OBJECT(iter->data), "end_action");
2501 if (NULL != paction) {
2503 paction->id, TRUE)) {
2504 gtk_widget_set_visible(GTK_WIDGET(iter->data), TRUE);
2505 gtk_widget_set_sensitive(GTK_WIDGET(iter->data), TRUE);
2506 can_do_something = TRUE;
2507 } else {
2508 gtk_widget_set_visible(GTK_WIDGET(iter->data), FALSE);
2509 gtk_widget_set_sensitive(GTK_WIDGET(iter->data), FALSE);
2510 }
2511 }
2512 }
2513 g_list_free(list);
2514
2515 /* Only sensitive if an action may be possible. */
2516 menu_entry_set_sensitive("MENU_GOTO_AND", can_do_something);
2517 }
2518
2519 /* Enable the button for adding to a city in all cases, so we
2520 * get an eventual error message from the server if we try. */
2521 menu_entry_set_sensitive("BUILD_CITY",
2522 (can_units_do_on_map(&(wld.map), punits,
2525 menu_entry_set_sensitive("BUILD_ROAD",
2526 (can_units_do_any_road(&(wld.map), punits)
2527 || can_units_do(punits,
2529 menu_entry_set_sensitive("BUILD_IRRIGATION",
2530 can_units_do_activity_client(punits, ACTIVITY_IRRIGATE));
2531 menu_entry_set_sensitive("CULTIVATE",
2532 can_units_do_activity_client(punits, ACTIVITY_CULTIVATE));
2533 menu_entry_set_sensitive("BUILD_MINE",
2534 can_units_do_activity_client(punits, ACTIVITY_MINE));
2536 can_units_do_activity_client(punits, ACTIVITY_PLANT));
2537 menu_entry_set_sensitive("TRANSFORM_TERRAIN",
2538 can_units_do_activity_client(punits, ACTIVITY_TRANSFORM));
2539 menu_entry_set_sensitive("FORTIFY",
2541 ACTIVITY_FORTIFYING));
2542 menu_entry_set_sensitive("BUILD_FORTRESS",
2543 can_units_do_base_gui(punits, BASE_GUI_FORTRESS));
2544 menu_entry_set_sensitive("BUILD_AIRBASE",
2545 can_units_do_base_gui(punits, BASE_GUI_AIRBASE));
2546 menu_entry_set_sensitive("CLEAN_POLLUTION",
2547 can_units_do_activity_client(punits, ACTIVITY_POLLUTION));
2548 menu_entry_set_sensitive("CLEAN_FALLOUT",
2549 can_units_do_activity_client(punits, ACTIVITY_FALLOUT));
2550 menu_entry_set_sensitive("UNIT_SENTRY",
2551 can_units_do_activity_client(punits, ACTIVITY_SENTRY));
2552 menu_entry_set_sensitive("DO_PARADROP",
2554 /* FIXME: should conditionally rename "Pillage" to "Pillage..." in cases where
2555 * selecting the command results in a dialog box listing options of what to pillage */
2556 menu_entry_set_sensitive("DO_PILLAGE",
2557 can_units_do_activity_client(punits, ACTIVITY_PILLAGE));
2558 menu_entry_set_sensitive("UNIT_DISBAND",
2559 units_can_do_action(punits, ACTION_DISBAND_UNIT,
2560 TRUE));
2561 menu_entry_set_sensitive("UNIT_UPGRADE",
2562 units_can_upgrade(&(wld.map), punits));
2563 /* "UNIT_CONVERT" dealt with below */
2564 menu_entry_set_sensitive("UNIT_HOMECITY",
2566 menu_entry_set_sensitive("UNIT_UNLOAD_TRANSPORTER",
2567 units_are_occupied(punits));
2568 menu_entry_set_sensitive("UNIT_BOARD",
2569 units_can_load(punits));
2570 menu_entry_set_sensitive("UNIT_DEBOARD",
2571 units_can_unload(punits));
2572 menu_entry_set_sensitive("UNIT_UNSENTRY",
2574 ACTIVITY_SENTRY));
2575 menu_entry_set_sensitive("AUTO_SETTLER",
2577 menu_entry_set_sensitive("UNIT_EXPLORE",
2578 can_units_do_activity_client(punits, ACTIVITY_EXPLORE));
2579
2580 proad = road_by_gui_type(ROAD_GUI_ROAD);
2581 if (proad != NULL) {
2582 struct extra_type *tgt;
2583
2584 tgt = road_extra_get(proad);
2585
2586 conn_possible = can_units_do_connect(punits, ACTIVITY_GEN_ROAD, tgt);
2587 } else {
2588 conn_possible = FALSE;
2589 }
2590 menu_entry_set_sensitive("CONNECT_ROAD", conn_possible);
2591
2592 proad = road_by_gui_type(ROAD_GUI_RAILROAD);
2593 if (proad != NULL) {
2594 struct extra_type *tgt;
2595
2596 tgt = road_extra_get(proad);
2597
2598 conn_possible = can_units_do_connect(punits, ACTIVITY_GEN_ROAD, tgt);
2599 } else {
2600 conn_possible = FALSE;
2601 }
2602 menu_entry_set_sensitive("CONNECT_RAIL", conn_possible);
2603
2604 proad = road_by_gui_type(ROAD_GUI_MAGLEV);
2605 if (proad != NULL) {
2606 struct extra_type *tgt;
2607
2608 tgt = road_extra_get(proad);
2609
2610 conn_possible = can_units_do_connect(punits, ACTIVITY_GEN_ROAD, tgt);
2611 } else {
2612 conn_possible = FALSE;
2613 }
2614 menu_entry_set_sensitive("CONNECT_MAGLEV", conn_possible);
2615
2616 extras = extra_type_list_by_cause(EC_IRRIGATION);
2617
2618 if (extra_type_list_size(extras) > 0) {
2619 struct extra_type *tgt;
2620
2621 tgt = extra_type_list_get(extras, 0);
2622 conn_possible = can_units_do_connect(punits, ACTIVITY_IRRIGATE, tgt);
2623 } else {
2624 conn_possible = FALSE;
2625 }
2626 menu_entry_set_sensitive("CONNECT_IRRIGATION", conn_possible);
2627
2628 menu_entry_set_sensitive("DIPLOMAT_ACTION",
2630
2631 if (units_can_do_action(punits, ACTION_HELP_WONDER, TRUE)) {
2632 menus_rename("BUILD_CITY",
2633 action_get_ui_name_mnemonic(ACTION_HELP_WONDER, "_"));
2634 } else {
2635 bool city_on_tile = FALSE;
2636
2637 /* FIXME: this overloading doesn't work well with multiple focus
2638 * units. */
2639 unit_list_iterate(punits, punit) {
2640 if (tile_city(unit_tile(punit))) {
2641 city_on_tile = TRUE;
2642 break;
2643 }
2645
2646 if (city_on_tile && units_can_do_action(punits, ACTION_JOIN_CITY,
2647 TRUE)) {
2648 menus_rename("BUILD_CITY",
2649 action_get_ui_name_mnemonic(ACTION_JOIN_CITY, "_"));
2650 } else {
2651 /* refresh default order */
2652 menus_rename("BUILD_CITY",
2653 action_get_ui_name_mnemonic(ACTION_FOUND_CITY, "_"));
2654 }
2655 }
2656
2657 if (units_can_do_action(punits, ACTION_TRADE_ROUTE, TRUE)) {
2658 menus_rename("BUILD_ROAD",
2659 action_get_ui_name_mnemonic(ACTION_TRADE_ROUTE, "_"));
2660 } else if (units_have_type_flag(punits, UTYF_SETTLERS, TRUE)) {
2661 char road_item[500];
2662 struct extra_type *pextra = NULL;
2663
2664 /* FIXME: this overloading doesn't work well with multiple focus
2665 * units. */
2666 unit_list_iterate(punits, punit) {
2667 pextra = next_extra_for_tile(unit_tile(punit), EC_ROAD,
2669 if (pextra != NULL) {
2670 break;
2671 }
2673
2674 if (pextra != NULL) {
2675 /* TRANS: Build road of specific type (Road/Railroad/Maglev) */
2676 snprintf(road_item, sizeof(road_item), _("Build %s"),
2677 extra_name_translation(pextra));
2678 menus_rename("BUILD_ROAD", road_item);
2679 }
2680 } else {
2681 menus_rename("BUILD_ROAD", _("Build _Road"));
2682 }
2683
2684 if (units_all_same_type) {
2685 struct unit *punit = unit_list_get(punits, 0);
2686 const struct unit_type *to_unittype =
2688 if (to_unittype) {
2689 /* TRANS: %s is a unit type. */
2690 fc_snprintf(acttext, sizeof(acttext), _("Upgr_ade to %s"),
2693 unit_type_get(punit))));
2694 } else {
2695 acttext[0] = '\0';
2696 }
2697 } else {
2698 acttext[0] = '\0';
2699 }
2700 if ('\0' != acttext[0]) {
2701 menus_rename("UNIT_UPGRADE", acttext);
2702 } else {
2703 menus_rename("UNIT_UPGRADE", _("Upgr_ade"));
2704 }
2705
2706 if (units_can_convert(&(wld.map), punits)) {
2707 menu_entry_set_sensitive("UNIT_CONVERT", TRUE);
2708 if (units_all_same_type) {
2709 struct unit *punit = unit_list_get(punits, 0);
2710
2711 /* TRANS: %s is a unit type. */
2712 fc_snprintf(acttext, sizeof(acttext), _("C_onvert to %s"),
2714 } else {
2715 acttext[0] = '\0';
2716 }
2717 } else {
2718 menu_entry_set_sensitive("UNIT_CONVERT", FALSE);
2719 acttext[0] = '\0';
2720 }
2721 if ('\0' != acttext[0]) {
2722 menus_rename("UNIT_CONVERT", acttext);
2723 } else {
2724 menus_rename("UNIT_CONVERT", _("C_onvert"));
2725 }
2726
2727 if (units_all_same_tile) {
2728 struct unit *first = unit_list_get(punits, 0);
2729
2730 pterrain = tile_terrain(unit_tile(first));
2731
2732 if (units_have_type_flag(punits, UTYF_SETTLERS, TRUE)) {
2733 struct extra_type *pextra = NULL;
2734
2735 /* FIXME: this overloading doesn't work well with multiple focus
2736 * units. */
2737 unit_list_iterate(punits, punit) {
2738 pextra = next_extra_for_tile(unit_tile(punit), EC_IRRIGATION,
2740 if (pextra != NULL) {
2741 break;
2742 }
2744
2745 if (pextra != NULL) {
2746 /* TRANS: Build irrigation of specific type */
2747 snprintf(irrtext, sizeof(irrtext), _("Build %s"),
2748 extra_name_translation(pextra));
2749 } else {
2750 sz_strlcpy(irrtext, _("Build _Irrigation"));
2751 }
2752 } else {
2753 sz_strlcpy(irrtext, _("Build _Irrigation"));
2754 }
2755
2756 if (pterrain->cultivate_result != T_NONE) {
2757 fc_snprintf(cultext, sizeof(cultext), _("Change to %s"),
2759 ACTIVITY_CULTIVATE));
2760 } else {
2761 sz_strlcpy(cultext, _("_Cultivate"));
2762 }
2763
2764 if (units_have_type_flag(punits, UTYF_SETTLERS, TRUE)) {
2765 struct extra_type *pextra = NULL;
2766
2767 /* FIXME: this overloading doesn't work well with multiple focus
2768 * units. */
2769 unit_list_iterate(punits, punit) {
2770 pextra = next_extra_for_tile(unit_tile(punit), EC_MINE,
2772 if (pextra != NULL) {
2773 break;
2774 }
2776
2777 if (pextra != NULL) {
2778 /* TRANS: Build mine of specific type */
2779 snprintf(mintext, sizeof(mintext), _("Build %s"),
2780 extra_name_translation(pextra));
2781 } else {
2782 sz_strlcpy(mintext, _("Build _Mine"));
2783 }
2784 } else {
2785 sz_strlcpy(mintext, _("Build _Mine"));
2786 }
2787
2788 if (pterrain->plant_result != T_NONE) {
2789 fc_snprintf(plantext, sizeof(plantext), _("Change to %s"),
2790 get_tile_change_menu_text(unit_tile(first), ACTIVITY_PLANT));
2791 } else {
2792 sz_strlcpy(plantext, _("_Plant"));
2793 }
2794
2795 if (pterrain->transform_result != T_NONE
2796 && pterrain->transform_result != pterrain) {
2797 fc_snprintf(transtext, sizeof(transtext), _("Transf_orm to %s"),
2799 ACTIVITY_TRANSFORM));
2800 } else {
2801 sz_strlcpy(transtext, _("Transf_orm Terrain"));
2802 }
2803 } else {
2804 sz_strlcpy(irrtext, _("Build _Irrigation"));
2805 sz_strlcpy(cultext, _("_Cultivate"));
2806 sz_strlcpy(mintext, _("Build _Mine"));
2807 sz_strlcpy(plantext, _("_Plant"));
2808 sz_strlcpy(transtext, _("Transf_orm Terrain"));
2809 }
2810
2811 menus_rename("BUILD_IRRIGATION", irrtext);
2812 menus_rename("CULTIVATE", cultext);
2813 menus_rename("BUILD_MINE", mintext);
2814 menus_rename("PLANT", plantext);
2815 menus_rename("TRANSFORM_TERRAIN", transtext);
2816
2817 menus_rename("UNIT_HOMECITY",
2818 action_get_ui_name_mnemonic(ACTION_HOME_CITY, "_"));
2819}
2820
2821/************************************************************************/
2824static void menu_unit_goto_and_add_accel(GtkWidget *item, action_id act_id,
2825 const guint accel_key,
2826 const GdkModifierType accel_mods)
2827{
2828 const char *path = gtk_menu_item_get_accel_path(GTK_MENU_ITEM(item));
2829
2830 if (path == NULL) {
2831 char buf[MAX_LEN_NAME + sizeof("<MENU>/GOTO_AND/")];
2832
2833 fc_snprintf(buf, sizeof(buf), "<MENU>/GOTO_AND/%s",
2834 action_id_rule_name(act_id));
2835 gtk_menu_item_set_accel_path(GTK_MENU_ITEM(item), buf);
2836 path = buf; /* Not NULL, but not usable either outside this block */
2837 }
2838
2839 if (path != NULL) {
2840 gtk_accel_map_add_entry(gtk_menu_item_get_accel_path(GTK_MENU_ITEM(item)),
2841 accel_key, accel_mods);
2842 }
2843}
2844
2845/************************************************************************/
2848static void menu_remove_previous_entries(GtkMenu *menu)
2849{
2850 GList *list, *iter;
2851 GtkWidget *sub_menu;
2852
2853 list = gtk_container_get_children(GTK_CONTAINER(menu));
2854 for (iter = list; NULL != iter; iter = g_list_next(iter)) {
2855 if ((sub_menu = gtk_menu_item_get_submenu(iter->data)) != NULL) {
2856 menu_remove_previous_entries(GTK_MENU(sub_menu));
2857 gtk_widget_destroy(sub_menu);
2858 }
2859 gtk_widget_destroy(GTK_WIDGET(iter->data));
2860 }
2861 g_list_free(list);
2862}
2863
2864/************************************************************************/
2869{
2870 GtkMenu *menu;
2871
2872 if (ui_builder == NULL) {
2873 return;
2874 }
2875
2876 menu_entry_set_sensitive("GAME_SAVE_AS",
2878 && C_S_RUNNING <= client_state());
2879 menu_entry_set_sensitive("GAME_SAVE",
2881 && C_S_RUNNING <= client_state());
2882
2883 menu_entry_set_active("SAVE_OPTIONS_ON_EXIT",
2886
2889
2890 if (!can_client_change_view()) {
2892
2893 return;
2894 }
2895
2896 menus_rename("BUILD_FORTRESS", Q_(terrain_control.gui_type_base0));
2897 menus_rename("BUILD_AIRBASE", Q_(terrain_control.gui_type_base1));
2898
2899 if ((menu = find_menu("<MENU>/GOVERNMENT"))) {
2900 GList *list, *iter;
2901 GtkWidget *item;
2902 char buf[256];
2903
2904 /* Remove previous government entries. */
2905 list = gtk_container_get_children(GTK_CONTAINER(menu));
2906 for (iter = list; NULL != iter; iter = g_list_next(iter)) {
2907 if (g_object_get_data(G_OBJECT(iter->data), "government") != NULL
2908 || GTK_IS_SEPARATOR_MENU_ITEM(iter->data)) {
2909 gtk_widget_destroy(GTK_WIDGET(iter->data));
2910 }
2911 }
2912 g_list_free(list);
2913
2914 /* Add new government entries. */
2915 item = gtk_separator_menu_item_new();
2916 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
2917 gtk_widget_show(item);
2918
2921 /* TRANS: %s is a government name */
2922 fc_snprintf(buf, sizeof(buf), _("%s..."),
2924 item = gtk_menu_item_new_with_label(buf);
2925 g_object_set_data(G_OBJECT(item), "government", g);
2926 g_signal_connect(item, "activate",
2927 G_CALLBACK(government_callback), g);
2928 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
2929 gtk_widget_show(item);
2930 }
2932 }
2933
2934 if ((menu = find_menu("<MENU>/BUILD_BASE"))) {
2935 GList *list, *iter;
2936 GtkWidget *item;
2937
2938 /* Remove previous base entries. */
2939 list = gtk_container_get_children(GTK_CONTAINER(menu));
2940 for (iter = list; NULL != iter; iter = g_list_next(iter)) {
2941 gtk_widget_destroy(GTK_WIDGET(iter->data));
2942 }
2943 g_list_free(list);
2944
2945 /* Add new base entries. */
2946 extra_type_by_cause_iterate(EC_BASE, pextra) {
2947 if (pextra->buildable) {
2948 item = gtk_menu_item_new_with_label(extra_name_translation(pextra));
2949 g_object_set_data(G_OBJECT(item), "base", pextra);
2950 g_signal_connect(item, "activate", G_CALLBACK(base_callback), pextra);
2951 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
2952 gtk_widget_show(item);
2953 }
2955 }
2956
2957 if ((menu = find_menu("<MENU>/BUILD_PATH"))) {
2958 GList *list, *iter;
2959 GtkWidget *item;
2960
2961 /* Remove previous road entries. */
2962 list = gtk_container_get_children(GTK_CONTAINER(menu));
2963 for (iter = list; NULL != iter; iter = g_list_next(iter)) {
2964 gtk_widget_destroy(GTK_WIDGET(iter->data));
2965 }
2966 g_list_free(list);
2967
2968 /* Add new road entries. */
2969 extra_type_by_cause_iterate(EC_ROAD, pextra) {
2970 if (pextra->buildable) {
2971 item = gtk_menu_item_new_with_label(extra_name_translation(pextra));
2972 g_object_set_data(G_OBJECT(item), "road", pextra);
2973 g_signal_connect(item, "activate", G_CALLBACK(road_callback), pextra);
2974 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
2975 gtk_widget_show(item);
2976 }
2978 }
2979
2980 /* Initialize the Go to and... actions. */
2981 if ((menu = find_menu("<MENU>/GOTO_AND"))) {
2982 GtkWidget *item;
2983 int tgt_kind_group;
2984
2985 /* Remove previous action entries. */
2987
2988 /* Add the new action entries grouped by target kind. */
2989 for (tgt_kind_group = 0; tgt_kind_group < ATK_COUNT; tgt_kind_group++) {
2990 action_iterate(act_id) {
2991 struct action *paction = action_by_number(act_id);
2992
2993 if (action_id_get_actor_kind(act_id) != AAK_UNIT) {
2994 /* This action isn't performed by a unit. */
2995 continue;
2996 }
2997
2998 if (action_id_get_target_kind(act_id) != tgt_kind_group) {
2999 /* Wrong group. */
3000 continue;
3001 }
3002
3003 /* Create and add the menu item. It will be hidden or shown based on
3004 * unit type. */
3005 item = gtk_menu_item_new_with_mnemonic(
3006 action_get_ui_name_mnemonic(act_id, "_"));
3007 g_object_set_data(G_OBJECT(item), "end_action", paction);
3008
3009 if (action_id_has_complex_target(act_id)) {
3010 GtkWidget *sub_target_menu = gtk_menu_new();
3011
3012#define CREATE_SUB_ITEM(_sub_target_, _sub_target_key_, _sub_target_name_) \
3013 GtkWidget *sub_item = gtk_menu_item_new_with_label(_sub_target_name_); \
3014 g_object_set_data(G_OBJECT(sub_item), "end_action", paction); \
3015 g_object_set_data(G_OBJECT(sub_item), _sub_target_key_, _sub_target_); \
3016 g_signal_connect(sub_item, "activate", \
3017 G_CALLBACK(unit_goto_and_callback), paction); \
3018 gtk_menu_shell_append(GTK_MENU_SHELL(sub_target_menu), sub_item); \
3019 gtk_widget_show(sub_item);
3020
3021 switch (action_get_sub_target_kind(paction)) {
3022 case ASTK_BUILDING:
3023 improvement_iterate(pimpr) {
3024 CREATE_SUB_ITEM(pimpr, "end_building",
3027 break;
3028 case ASTK_TECH:
3029 advance_iterate(A_FIRST, ptech) {
3030 CREATE_SUB_ITEM(ptech, "end_tech",
3033 break;
3034 case ASTK_EXTRA:
3035 case ASTK_EXTRA_NOT_THERE:
3036 extra_type_iterate(pextra) {
3037 if (!(action_creates_extra(paction, pextra)
3038 || action_removes_extra(paction, pextra))) {
3039 /* Not relevant */
3040 continue;
3041 }
3042 CREATE_SUB_ITEM(pextra, "end_extra",
3043 extra_name_translation(pextra));
3045 break;
3046 case ASTK_NONE:
3047 /* Should not be here. */
3048 fc_assert(action_get_sub_target_kind(paction) != ASTK_NONE);
3049 break;
3050 case ASTK_COUNT:
3051 /* Should not exits */
3052 fc_assert(action_get_sub_target_kind(paction) != ASTK_COUNT);
3053 break;
3054 }
3055
3056#undef CREATE_SUB_ITEM
3057
3058 gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), sub_target_menu);
3059 } else {
3060 g_signal_connect(item, "activate",
3061 G_CALLBACK(unit_goto_and_callback), paction);
3062
3063#define ADD_OLD_ACCELERATOR(wanted_action_id, accel_key, accel_mods) \
3064 if (act_id == wanted_action_id) { \
3065 menu_unit_goto_and_add_accel(item, act_id, accel_key, accel_mods); \
3066 }
3067
3068 /* Add the keyboard shortcuts for "Go to and..." menu items that
3069 * existed independently before the "Go to and..." menu arrived.
3070 */
3071 ADD_OLD_ACCELERATOR(ACTION_FOUND_CITY, GDK_KEY_b, GDK_SHIFT_MASK);
3072 ADD_OLD_ACCELERATOR(ACTION_JOIN_CITY, GDK_KEY_j, GDK_SHIFT_MASK);
3073 ADD_OLD_ACCELERATOR(ACTION_NUKE, GDK_KEY_n, GDK_SHIFT_MASK);
3074 }
3075
3076 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
3077 gtk_widget_show(item);
3079 }
3080 }
3081
3084
3085 menu_entry_set_sensitive("TAX_RATE",
3088 menu_entry_set_sensitive("POLICIES",
3089 multiplier_count() > 0);
3090
3091 menu_entry_set_active("SHOW_CITY_OUTLINES",
3093 menu_entry_set_active("SHOW_CITY_OUTPUT",
3095 menu_entry_set_active("SHOW_MAP_GRID",
3097 menu_entry_set_active("SHOW_NATIONAL_BORDERS",
3099 menu_entry_set_sensitive("SHOW_NATIONAL_BORDERS",
3101 menu_entry_set_active("SHOW_NATIVE_TILES",
3103 menu_entry_set_active("SHOW_CITY_FULL_BAR",
3105 menu_entry_set_active("SHOW_CITY_NAMES",
3107 menu_entry_set_active("SHOW_CITY_GROWTH",
3109 menu_entry_set_active("SHOW_CITY_PRODUCTIONS",
3111 menu_entry_set_active("SHOW_CITY_BUY_COST",
3113 menu_entry_set_active("SHOW_CITY_TRADE_ROUTES",
3115 menu_entry_set_active("SHOW_TERRAIN",
3117 menu_entry_set_active("SHOW_COASTLINE",
3119 menu_entry_set_active("SHOW_PATHS",
3121 menu_entry_set_active("SHOW_IRRIGATION",
3123 menu_entry_set_active("SHOW_MINES",
3125 menu_entry_set_active("SHOW_BASES",
3127 menu_entry_set_active("SHOW_RESOURCES",
3129 menu_entry_set_active("SHOW_HUTS",
3131 menu_entry_set_active("SHOW_POLLUTION",
3133 menu_entry_set_active("SHOW_CITIES",
3135 menu_entry_set_active("SHOW_UNITS",
3137 menu_entry_set_active("SHOW_UNIT_SOLID_BG",
3139 menu_entry_set_active("SHOW_UNIT_SHIELDS",
3141 menu_entry_set_active("SHOW_STACK_SIZE",
3143 menu_entry_set_active("SHOW_FOCUS_UNIT",
3145 menu_entry_set_active("SHOW_FOG_OF_WAR",
3147
3149
3150 menu_entry_set_active("FULL_SCREEN", GUI_GTK_OPTION(fullscreen));
3151}
3152
3153/**************************************************************************
3154 Free resources allocated by the menu system.
3155**************************************************************************/
3156void menus_free(void)
3157{
3158 if (ui_builder != NULL) {
3159 g_object_unref(ui_builder);
3160 ui_builder = NULL;
3161 }
3162}
bool action_removes_extra(const struct action *paction, const struct extra_type *pextra)
Definition actions.c:2312
const char * action_id_rule_name(action_id act_id)
Definition actions.c:1899
enum action_sub_target_kind action_get_sub_target_kind(const struct action *paction)
Definition actions.c:1751
bool action_creates_extra(const struct action *paction, const struct extra_type *pextra)
Definition actions.c:2224
const char * action_get_ui_name_mnemonic(action_id act_id, const char *mnemonic)
Definition actions.c:1918
static struct action * action_by_number(action_id act_id)
Definition actions.h:638
#define action_iterate_end
Definition actions.h:472
#define action_id_get_actor_kind(act_id)
Definition actions.h:651
#define action_iterate(_act_)
Definition actions.h:467
#define ACTION_ANY
Definition actions.h:290
#define action_id_get_target_kind(act_id)
Definition actions.h:655
#define action_id_has_complex_target(act_id)
Definition actions.h:673
struct @124::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:1235
static struct fc_sockaddr_list * list
Definition clinet.c:102
void disconnect_from_server(void)
Definition clinet.c:305
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:520
void key_coastline_toggle(void)
Definition control.c:3830
void key_irrigation_toggle(void)
Definition control.c:3846
void key_unit_sentry(void)
Definition control.c:3634
void key_city_output_toggle(void)
Definition control.c:3731
void request_unit_return(struct unit *punit)
Definition control.c:1547
void request_unit_fortify(struct unit *punit)
Definition control.c:2240
void key_editor_recalculate_borders(void)
Definition control.c:3950
void key_roads_rails_toggle(void)
Definition control.c:3838
void request_unit_caravan_action(struct unit *punit, action_id action)
Definition control.c:2148
void key_focus_unit_toggle(void)
Definition control.c:3926
void key_unit_auto_explore(void)
Definition control.c:3410
void key_unit_auto_settle(void)
Definition control.c:3423
void key_unit_connect(enum unit_activity activity, struct extra_type *tgt)
Definition control.c:3216
void key_city_full_bar_toggle(void)
Definition control.c:3763
void key_bases_toggle(void)
Definition control.c:3862
void key_map_native_toggle(void)
Definition control.c:3755
void key_resources_toggle(void)
Definition control.c:3870
void request_unit_goto(enum unit_orders last_order, action_id act_id, int sub_tgt_id)
Definition control.c:1129
void key_unit_paradrop(void)
Definition control.c:3320
struct unit_list * get_units_in_focus(void)
Definition control.c:177
void key_unit_shields_toggle(void)
Definition control.c:3918
void key_city_productions_toggle(void)
Definition control.c:3797
void key_unit_plant(void)
Definition control.c:3556
void key_unit_fortress(void)
Definition control.c:3465
void key_unit_mine(void)
Definition control.c:3548
void key_unit_pillage(void)
Definition control.c:3568
void request_unit_unload(struct unit *pcargo)
Definition control.c:2119
void key_editor_toggle_fogofwar(void)
Definition control.c:3959
void request_new_unit_activity_targeted(struct unit *punit, enum unit_activity act, struct extra_type *tgt)
Definition control.c:1863
void key_unit_irrigate(void)
Definition control.c:3528
void request_unit_build_city(struct unit *punit)
Definition control.c:1740
void key_unit_unload_all(void)
Definition control.c:3350
void key_cities_toggle(void)
Definition control.c:3894
void key_city_outlines_toggle(void)
Definition control.c:3723
void key_unit_homecity(void)
Definition control.c:3482
void key_unit_patrol(void)
Definition control.c:3328
void key_unit_solid_bg_toggle(void)
Definition control.c:3910
void key_terrain_toggle(void)
Definition control.c:3822
void key_unit_wakeup_others(void)
Definition control.c:3383
void key_unit_stack_size_toggle(void)
Definition control.c:3814
void key_huts_toggle(void)
Definition control.c:3878
void key_fog_of_war_toggle(void)
Definition control.c:3934
void key_unit_wait(void)
Definition control.c:3375
void key_units_toggle(void)
Definition control.c:3902
void key_unit_select_battlegroup(int battlegroup, bool append)
Definition control.c:3697
void key_map_grid_toggle(void)
Definition control.c:3739
void key_pollution_toggle(void)
Definition control.c:3886
void key_city_growth_toggle(void)
Definition control.c:3780
void key_unit_action_select_tgt(void)
Definition control.c:3247
void key_unit_fallout(void)
Definition control.c:3445
void key_city_buycost_toggle(void)
Definition control.c:3789
int get_num_units_in_focus(void)
Definition control.c:185
void key_unit_transform(void)
Definition control.c:3646
void key_unit_done(void)
Definition control.c:3304
void key_city_trade_routes_toggle(void)
Definition control.c:3806
void key_city_names_toggle(void)
Definition control.c:3771
void request_unit_select(struct unit_list *punits, enum unit_select_type_mode seltype, enum unit_select_location_mode selloc)
Definition control.c:1616
void key_unit_airbase(void)
Definition control.c:3393
void key_unit_goto(void)
Definition control.c:3312
void key_unit_convert(void)
Definition control.c:3435
void key_editor_toggle(void)
Definition control.c:3942
void key_unit_assign_battlegroup(int battlegroup, bool append)
Definition control.c:3658
void key_unit_cultivate(void)
Definition control.c:3536
void key_mines_toggle(void)
Definition control.c:3854
void key_map_borders_toggle(void)
Definition control.c:3747
#define can_unit_do_activity_targeted_client(_punit_, _act_, _tgt_)
Definition control.h:42
#define can_units_do_activity_targeted_client(_punits_, _act_, _tgt_)
Definition control.h:46
#define can_units_do_activity_client(_punits_, _act_)
Definition control.h:44
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:73
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:740
int extra_number(const struct extra_type *pextra)
Definition extras.c:153
struct extra_type_list * extra_type_list_by_cause(enum extra_cause cause)
Definition extras.c:241
struct extra_type * prev_extra_in_tile(const struct tile *ptile, enum extra_rmcause rmcause, const struct player *pplayer, const struct unit *punit)
Definition extras.c:765
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:186
#define extra_type_iterate(_p)
Definition extras.h:291
#define extra_type_iterate_end
Definition extras.h:297
#define extra_type_by_cause_iterate_end
Definition extras.h:315
#define extra_type_by_cause_iterate(_cause, _extra)
Definition extras.h:309
#define NO_TARGET
Definition fc_types.h:324
int action_id
Definition fc_types.h:359
#define MAX_LEN_NAME
Definition fc_types.h:66
@ BORDERS_DISABLED
Definition fc_types.h:891
#define Q_(String)
Definition fcintl.h:70
#define _(String)
Definition fcintl.h:67
#define N_(String)
Definition fcintl.h:69
struct civ_game game
Definition game.c:57
struct world wld
Definition game.c:58
const char * government_name_translation(const struct government *pgovern)
Definition government.c:142
bool untargeted_revolution_allowed(void)
Definition government.c:565
bool can_change_to_government(struct player *pplayer, const struct government *gov)
Definition government.c:165
#define governments_iterate(NAME_pgov)
Definition government.h:121
#define governments_iterate_end
Definition government.h:124
void log_output_window(void)
Definition chatline.c:928
void clear_output_window(void)
Definition chatline.c:943
void city_report_dialog_popup(bool raise)
Definition cityrep.c:292
void unit_select_dialog_popup(struct tile *ptile)
Definition dialogs.c:382
void popup_upgrade_dialog(struct unit_list *punits)
Definition dialogs.c:1444
void popup_disband_dialog(struct unit_list *punits)
Definition dialogs.c:1482
void editgui_refresh(void)
Definition editgui.c:1795
void property_editor_popup(struct property_editor *pe, enum editor_object_type objtype)
Definition editprop.c:6254
struct property_editor * editprop_get_property_editor(void)
Definition editprop.c:6207
void property_editor_reload(struct property_editor *pe, enum editor_object_type objtype)
Definition editprop.c:6344
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:257
void fullscreen_opt_refresh(struct option *poption)
Definition gui_main.c:2238
gboolean map_canvas_focus(void)
Definition gui_main.c:366
GtkWidget * toplevel
Definition gui_main.c:124
void popup_quit_dialog(void)
Definition gui_main.c:2154
#define GUI_GTK_OPTION(optname)
Definition gui_main.h:25
void setup_dialog(GtkWidget *shell, GtkWidget *parent)
Definition gui_stuff.c:281
void popup_help_dialog_string(const char *item)
Definition helpdlg.c:211
void luaconsole_dialog_popup(bool raise)
Definition luaconsole.c:126
void center_on_unit(void)
Definition mapctrl.c:490
static void save_mapimg_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:687
static void show_national_borders_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1185
static void show_focus_unit_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1421
GtkWidget * setup_menus(GtkWidget *window)
Definition menu.c:2115
static void auto_settle_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1743
static void help_connecting_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:843
static void menus_rename(const char *key, const gchar *new_label)
Definition menu.c:2249
static void help_combat_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1043
static void menu_entry_group_set_sensitive(enum menu_entry_grouping group, gboolean is_sensitive)
Definition menu.c:2217
static void help_ruleset_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:995
static void select_single_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1491
static void unit_unload_transporter_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1683
static void bg_assign1_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:915
static void bg_append3_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:971
static void help_government_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1083
static void report_achievements_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:819
static void show_fog_of_war_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1432
static void help_zoc_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1051
static void show_city_productions_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1242
static void do_pillage_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1940
static void bg_select0_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:883
static void menu_remove_previous_entries(GtkMenu *menu)
Definition menu.c:2821
static void client_lua_script_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:803
static void bg_select2_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:931
static void show_city_names_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1219
static void help_space_race_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1099
static void help_tileset_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1003
static void help_playing_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:987
static void plant_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1801
static struct menu_entry_info menu_entries[]
Definition menu.c:264
static void base_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1980
static void help_economy_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1011
static void unit_sentry_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1647
static void center_view_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:2005
static void unit_explore_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1631
static void build_mine_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1793
static void quit_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:739
static void unit_return_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1621
static GtkBuilder * ui_builder
Definition menu.c:76
static void show_city_trade_routes_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1265
static void show_road_rails_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1297
static void transform_terrain_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1873
static void help_wonders_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1075
static GtkMenu * find_menu(const char *key)
Definition menu.c:2262
static void show_terrain_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1276
static void show_city_growth_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1231
static void show_stack_size_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1410
static const gchar * get_ui_filename(void)
Definition menu.c:2095
static void multiplier_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1964
static void help_terrain_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1067
static void save_game_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:671
static void show_unit_solid_bg_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1388
static void show_coastline_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1287
static void toggle_fog_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1463
static void show_city_full_bar_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1207
static void edit_mode_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1140
static void help_chatline_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:859
void menus_free(void)
Definition menu.c:3143
static void connect_road_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1809
static void bg_append2_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:947
static void help_overview_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:979
static void save_game_as_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:679
static void help_diplomacy_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1091
static void show_units_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1377
static void show_irrigation_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1307
static void show_map_grid_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1174
static void help_improvements_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1027
static void bg_append1_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:923
static void recalc_borders_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1455
static void find_city_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:747
static void report_nations_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:771
static void report_demographic_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:811
static void help_worklist_editor_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:867
static void help_cities_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1019
static void leave_local_game_response(GtkWidget *dialog, gint response)
Definition menu.c:704
static void help_language_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:827
static void show_mine_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1317
static void server_options_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:647
static void bg_append0_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:899
static void leave_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:719
static void select_same_type_cont_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1515
static void unit_convert_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1708
static void select_dialog_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1531
static void show_huts_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1347
static void report_wow_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:779
static void menu_entry_set_active(const char *key, gboolean is_active)
Definition menu.c:2191
static void unit_upgrade_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1700
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:2797
static void help_tech_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1059
static void unit_goto_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1555
static void build_city_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1724
static void bg_select3_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:955
static void clean_pollution_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1881
static void unit_patrol_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1639
void real_menus_init(void)
Definition menu.c:2841
menu_entry_grouping
Definition menu.c:90
@ MGROUP_ALL
Definition menu.c:91
@ MGROUP_PLAYING
Definition menu.c:90
@ MGROUP_PLAYER
Definition menu.c:91
@ MGROUP_SAFE
Definition menu.c:90
@ MGROUP_EDIT
Definition menu.c:90
@ MGROUP_UNIT
Definition menu.c:91
static void help_about_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1123
static void bg_assign0_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:891
static void build_road_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1751
static void local_options_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:631
static void show_cities_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1367
static void unit_homecity_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1692
static void menu_entry_set_sensitive(const char *key, gboolean is_sensitive)
Definition menu.c:2204
static void show_pollution_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1357
static void save_options_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:655
static void save_mapimg_as_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:695
static void worklists_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:755
static void connect_maglev_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1841
static void full_screen_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1443
static void report_top_cities_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:787
static void help_controls_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:851
static void select_same_type_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1523
static void connect_rail_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1825
static void unit_wait_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1539
static const char * get_tile_change_menu_text(struct tile *ptile, enum unit_activity activity)
Definition menu.c:2302
static void build_airbase_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1924
static void report_cities_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:2021
static void help_cma_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:875
static void message_options_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:639
static void tax_rate_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1956
static void unit_goto_city_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1611
static struct menu_entry_info * menu_entry_info_find(const char *key)
Definition menu.c:2175
static void bg_select1_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:907
static void government_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1972
static void report_economy_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:2029
static void report_messages_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:795
static void do_paradrop_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1932
static void show_bases_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1327
static void select_same_type_tile_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1507
static void unit_unsentry_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1655
static void save_options_on_exit_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1131
static void show_native_tiles_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1196
static void menu_entry_init(GtkBuildable *item)
Definition menu.c:2055
static void show_unit_shields_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1399
static void reload_tileset_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:663
static void scenario_properties_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1471
static void clear_chat_logs_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:615
static void unit_deboard_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1673
static void help_policies_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:835
static void unit_done_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1547
static void help_nations_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1107
static void unit_goto_and_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1563
static void show_city_output_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1163
static void show_city_outlines_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1152
static void save_scenario_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1483
#define ADD_OLD_ACCELERATOR(wanted_action_id, accel_key, accel_mods)
static void help_copying_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1115
static void cultivate_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1785
static void save_chat_logs_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:623
void real_menus_update(void)
Definition menu.c:2317
static void report_spaceship_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:2045
static void select_all_on_tile_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1499
static void show_city_buy_cost_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1254
static void build_fortress_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1906
#define CREATE_SUB_ITEM(_sub_target_, _sub_target_key_, _sub_target_name_)
static void view_menu_update_sensitivity(void)
Definition menu.c:2270
static void clean_fallout_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1898
static void unit_board_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1663
static void menu_entry_set_visible(const char *key, gboolean is_visible, gboolean is_sensitive)
Definition menu.c:2233
static void fortify_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1914
static void bg_assign3_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:963
static void show_resources_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1337
static void connect_irrigation_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1857
static void build_irrigation_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1777
static void bg_assign2_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:939
static void report_units_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:2013
static void road_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1992
static void unit_disband_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1716
static void help_units_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1035
static void report_research_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:2037
static void diplomat_action_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1948
static void map_view_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:763
void popup_messageopt_dialog(void)
Definition messagedlg.c:51
void meswin_dialog_popup(bool raise)
Definition messagewin.c:416
void option_dialog_popup(const char *name, const struct option_set *poptset)
Definition optiondlg.c:979
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 science_report_dialog_popup(bool raise)
Definition repodlgs.c:716
void economy_report_dialog_popup(bool raise)
Definition repodlgs.c:1242
void units_report_dialog_popup(bool raise)
Definition repodlgs.c:1765
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:286
void infra_dialog_popup(void)
Definition infradlg.c:85
static void rally_dialog_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1548
static void infra_dialog_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1556
void rally_dialog_popup(void)
void popup_revolution_dialog(void)
Definition dialogs.c:109
#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:191
#define log_verbose(message,...)
Definition log.h:109
#define fc_assert(condition)
Definition log.h:176
#define log_error(message,...)
Definition log.h:103
struct terrain_misc terrain_control
Definition map.c:69
Multiplier_type_id multiplier_count(void)
Definition multipliers.c:88
const struct option_set * server_optset
Definition options.c:4009
const struct option_set * client_optset
Definition options.c:1255
void options_save(option_save_log_callback log_cb)
Definition options.c:6053
struct client_options gui_options
Definition options.c:71
@ REPORT_WONDERS_OF_THE_WORLD
Definition packets.h:74
@ REPORT_DEMOGRAPHIC
Definition packets.h:76
@ REPORT_TOP_5_CITIES
Definition packets.h:75
@ REPORT_ACHIEVEMENTS
Definition packets.h:77
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
action_id id
Definition actions.h:380
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:207
bool draw_specials
Definition options.h:199
bool draw_city_output
Definition options.h:186
bool draw_city_names
Definition options.h:188
bool draw_city_productions
Definition options.h:190
bool draw_mines
Definition options.h:197
bool draw_borders
Definition options.h:206
bool draw_fortress_airbase
Definition options.h:198
bool draw_city_buycost
Definition options.h:191
bool draw_unit_stack_size
Definition options.h:210
bool draw_irrigation
Definition options.h:196
bool draw_terrain
Definition options.h:193
bool draw_units
Definition options.h:203
bool draw_fog_of_war
Definition options.h:205
bool draw_city_trade_routes
Definition options.h:192
bool draw_unit_shields
Definition options.h:209
bool draw_cities
Definition options.h:202
bool save_options_on_exit
Definition options.h:121
bool draw_map_grid
Definition options.h:187
bool draw_city_growth
Definition options.h:189
bool draw_focus_unit
Definition options.h:204
bool draw_city_outlines
Definition options.h:185
bool draw_coastline
Definition options.h:194
bool draw_full_citybar
Definition options.h:208
bool draw_roads_rails
Definition options.h:195
bool draw_pollution
Definition options.h:201
bool solid_color_behind_units
Definition options.h:142
bool established
Definition connection.h:145
struct player * playing
Definition connection.h:156
struct extra_type::@24 data
Definition climisc.h:82
Definition menu.c:96
GdkModifierType accel_mod
Definition menu.c:100
guint accel
Definition menu.c:99
const char * key
Definition menu.c:97
enum menu_entry_grouping grouping
Definition menu.c:102
GCallback cb
Definition menu.c:101
const char * name
Definition menu.c:98
enum borders_mode borders
struct terrain * cultivate_result
Definition terrain.h:203
struct terrain * plant_result
Definition terrain.h:206
struct terrain * transform_result
Definition terrain.h:217
Definition tile.h:49
Definition unit.h:138
struct civ_map map
int fc_snprintf(char *str, size_t n, const char *format,...)
Definition support.c:969
#define sz_strlcpy(dest, src)
Definition support.h:167
#define TRUE
Definition support.h:46
#define FALSE
Definition support.h:47
const char * advance_name_translation(const struct advance *padvance)
Definition tech.c:290
Tech_type_id advance_number(const struct advance *padvance)
Definition tech.c:98
#define advance_iterate(_start, _p)
Definition tech.h:264
#define A_FIRST
Definition tech.h:44
#define advance_iterate_end
Definition tech.h:270
#define T_NONE
Definition terrain.h:56
void tile_virtual_destroy(struct tile *vtile)
Definition tile.c:1018
bool tile_apply_activity(struct tile *ptile, Activity_type_id act, struct extra_type *tgt)
Definition tile.c:658
struct tile * tile_virtual_new(const struct tile *ptile)
Definition tile.c:966
const char * tile_get_info_text(const struct tile *ptile, bool include_nuisances, int linebreaks)
Definition tile.c:756
struct city * tile_city(const struct tile *ptile)
Definition tile.c:83
#define tile_terrain(_tile)
Definition tile.h:109
bool tilespec_reread(const char *new_tileset_name, bool game_fully_initialized, float scale)
Definition tilespec.c:1299
bool unit_can_est_trade_route_here(const struct unit *punit)
Definition unit.c:286
bool unit_can_add_or_build_city(const struct civ_map *nmap, const struct unit *punit)
Definition unit.c:427
bool can_unit_change_homecity(const struct civ_map *nmap, const struct unit *punit)
Definition unit.c:460
bool can_unit_do_autosettlers(const struct unit *punit)
Definition unit.c:583
bool can_unit_paradrop(const struct civ_map *nmap, const struct unit *punit)
Definition unit.c:826
bool unit_can_help_build_wonder_here(const struct civ_map *nmap, const struct unit *punit)
Definition unit.c:260
#define unit_tile(_pu)
Definition unit.h:395
@ ORDER_PERFORM_ACTION
Definition unit.h:47
#define unit_owner(_pu)
Definition unit.h:394
bool units_can_convert(const struct civ_map *nmap, const struct unit_list *punits)
Definition unitlist.c:353
bool units_are_occupied(const struct unit_list *punits)
Definition unitlist.c:277
bool can_units_do_base_gui(const struct unit_list *punits, enum base_gui_type base_gui)
Definition unitlist.c:184
bool can_units_do_any_road(const struct civ_map *nmap, const struct unit_list *punits)
Definition unitlist.c:165
bool units_can_upgrade(const struct civ_map *nmap, const struct unit_list *punits)
Definition unitlist.c:338
bool units_can_unload(const struct unit_list *punits)
Definition unitlist.c:305
bool units_have_activity_on_tile(const struct unit_list *punits, enum unit_activity activity)
Definition unitlist.c:322
bool units_have_type_flag(const struct unit_list *punits, enum unit_type_flag_id flag, bool has_flag)
Definition unitlist.c:206
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:243
bool units_can_load(const struct unit_list *punits)
Definition unitlist.c:291
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:1755
const char * utype_name_translation(const struct unit_type *punittype)
Definition unittype.c:1612
bool utype_can_do_action(const struct unit_type *putype, const action_id act_id)
Definition unittype.c:443