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.0 */
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 "luaconsole.h"
56#include "mapctrl.h" /* center_on_unit(). */
57#include "messagedlg.h"
58#include "messagewin.h"
59#include "optiondlg.h"
60#include "pages.h"
61#include "plrdlg.h"
62#include "ratesdlg.h"
63#include "repodlgs.h"
64#include "sprite.h"
65#include "spaceshipdlg.h"
66#include "transportdlg.h"
67#include "unitselect.h"
68#include "wldlg.h"
69
70#include "menu.h"
71
72#ifndef GTK_STOCK_EDIT
73#define GTK_STOCK_EDIT NULL
74#endif
75
76static GtkBuilder *ui_builder = NULL;
77
78static void menu_entry_set_active(const char *key,
79 gboolean is_active);
80static void menu_entry_set_sensitive(const char *key,
81 gboolean is_sensitive);
82#ifndef FREECIV_DEBUG
83static void menu_entry_set_visible(const char *key,
84 gboolean is_visible,
85 gboolean is_sensitive);
86#endif /* FREECIV_DEBUG */
87
88static void view_menu_update_sensitivity(void);
89
92
94 gboolean is_sensitive);
95
97 const char *key;
98 const char *name;
99 guint accel;
100 GdkModifierType accel_mod;
101 GCallback cb;
103};
104
105static void clear_chat_logs_callback(GtkMenuItem *item, gpointer data);
106static void save_chat_logs_callback(GtkMenuItem *item, gpointer data);
107static void local_options_callback(GtkMenuItem *item, gpointer data);
108static void message_options_callback(GtkMenuItem *item, gpointer data);
109static void server_options_callback(GtkMenuItem *item, gpointer data);
110static void save_options_callback(GtkMenuItem *item, gpointer data);
111static void reload_tileset_callback(GtkMenuItem *item, gpointer data);
112static void save_game_callback(GtkMenuItem *item, gpointer data);
113static void save_game_as_callback(GtkMenuItem *item, gpointer data);
114static void save_mapimg_callback(GtkMenuItem *item, gpointer data);
115static void save_mapimg_as_callback(GtkMenuItem *item, gpointer data);
116static void find_city_callback(GtkMenuItem *item, gpointer data);
117static void worklists_callback(GtkMenuItem *item, gpointer data);
118static void client_lua_script_callback(GtkMenuItem *item, gpointer data);
119static void leave_callback(GtkMenuItem *item, gpointer data);
120static void quit_callback(GtkMenuItem *item, gpointer data);
121static void map_view_callback(GtkMenuItem *item, gpointer data);
122static void report_units_callback(GtkMenuItem *item, gpointer data);
123static void report_nations_callback(GtkMenuItem *item, gpointer data);
124static void report_cities_callback(GtkMenuItem *item, gpointer data);
125static void report_wow_callback(GtkMenuItem *item, gpointer data);
126static void report_top_cities_callback(GtkMenuItem *item, gpointer data);
127static void report_messages_callback(GtkMenuItem *item, gpointer data);
128static void report_demographic_callback(GtkMenuItem *item, gpointer data);
129static void bg_select0_callback(GtkMenuItem *item, gpointer data);
130static void bg_assign0_callback(GtkMenuItem *item, gpointer data);
131static void bg_append0_callback(GtkMenuItem *item, gpointer data);
132static void bg_select1_callback(GtkMenuItem *item, gpointer data);
133static void bg_assign1_callback(GtkMenuItem *item, gpointer data);
134static void bg_append1_callback(GtkMenuItem *item, gpointer data);
135static void bg_select2_callback(GtkMenuItem *item, gpointer data);
136static void bg_assign2_callback(GtkMenuItem *item, gpointer data);
137static void bg_append2_callback(GtkMenuItem *item, gpointer data);
138static void bg_select3_callback(GtkMenuItem *item, gpointer data);
139static void bg_assign3_callback(GtkMenuItem *item, gpointer data);
140static void bg_append3_callback(GtkMenuItem *item, gpointer data);
141static void help_overview_callback(GtkMenuItem *item, gpointer data);
142static void help_playing_callback(GtkMenuItem *item, gpointer data);
143static void help_policies_callback(GtkMenuItem *item, gpointer data);
144static void help_terrain_callback(GtkMenuItem *item, gpointer data);
145static void help_economy_callback(GtkMenuItem *item, gpointer data);
146static void help_cities_callback(GtkMenuItem *item, gpointer data);
147static void help_improvements_callback(GtkMenuItem *item, gpointer data);
148static void help_wonders_callback(GtkMenuItem *item, gpointer data);
149static void help_units_callback(GtkMenuItem *item, gpointer data);
150static void help_combat_callback(GtkMenuItem *item, gpointer data);
151static void help_zoc_callback(GtkMenuItem *item, gpointer data);
152static void help_government_callback(GtkMenuItem *item, gpointer data);
153static void help_diplomacy_callback(GtkMenuItem *item, gpointer data);
154static void help_tech_callback(GtkMenuItem *item, gpointer data);
155static void help_space_race_callback(GtkMenuItem *item, gpointer data);
156static void help_ruleset_callback(GtkMenuItem *item, gpointer data);
157static void help_tileset_callback(GtkMenuItem *item, gpointer data);
158static void help_nations_callback(GtkMenuItem *item, gpointer data);
159static void help_connecting_callback(GtkMenuItem *item, gpointer data);
160static void help_controls_callback(GtkMenuItem *item, gpointer data);
161static void help_cma_callback(GtkMenuItem *item, gpointer data);
162static void help_chatline_callback(GtkMenuItem *item, gpointer data);
163static void help_worklist_editor_callback(GtkMenuItem *item, gpointer data);
164static void help_language_callback(GtkMenuItem *item, gpointer data);
165static void help_copying_callback(GtkMenuItem *item, gpointer data);
166static void help_about_callback(GtkMenuItem *item, gpointer data);
167static void save_options_on_exit_callback(GtkCheckMenuItem *item,
168 gpointer data);
169static void edit_mode_callback(GtkCheckMenuItem *item, gpointer data);
170static void show_city_outlines_callback(GtkCheckMenuItem *item,
171 gpointer data);
172static void show_city_output_callback(GtkCheckMenuItem *item, gpointer data);
173static void show_map_grid_callback(GtkCheckMenuItem *item, gpointer data);
174static void show_national_borders_callback(GtkCheckMenuItem *item,
175 gpointer data);
176static void show_native_tiles_callback(GtkCheckMenuItem *item,
177 gpointer data);
178static void show_city_full_bar_callback(GtkCheckMenuItem *item,
179 gpointer data);
180static void show_city_names_callback(GtkCheckMenuItem *item, gpointer data);
181static void show_city_growth_callback(GtkCheckMenuItem *item, gpointer data);
182static void show_city_productions_callback(GtkCheckMenuItem *item,
183 gpointer data);
184static void show_city_buy_cost_callback(GtkCheckMenuItem *item,
185 gpointer data);
186static void show_city_trade_routes_callback(GtkCheckMenuItem *item,
187 gpointer data);
188static void show_terrain_callback(GtkCheckMenuItem *item, gpointer data);
189static void show_coastline_callback(GtkCheckMenuItem *item, gpointer data);
190static void show_road_rails_callback(GtkCheckMenuItem *item, gpointer data);
191static void show_irrigation_callback(GtkCheckMenuItem *item, gpointer data);
192static void show_mine_callback(GtkCheckMenuItem *item, gpointer data);
193static void show_bases_callback(GtkCheckMenuItem *item, gpointer data);
194static void show_resources_callback(GtkCheckMenuItem *item, gpointer data);
195static void show_huts_callback(GtkCheckMenuItem *item, gpointer data);
196static void show_pollution_callback(GtkCheckMenuItem *item, gpointer data);
197static void show_cities_callback(GtkCheckMenuItem *item, gpointer data);
198static void show_units_callback(GtkCheckMenuItem *item, gpointer data);
199static void show_unit_solid_bg_callback(GtkCheckMenuItem *item,
200 gpointer data);
201static void show_unit_shields_callback(GtkCheckMenuItem *item,
202 gpointer data);
203static void show_stack_size_callback(GtkCheckMenuItem *item,
204 gpointer data);
205static void show_focus_unit_callback(GtkCheckMenuItem *item, gpointer data);
206static void show_fog_of_war_callback(GtkCheckMenuItem *item, gpointer data);
207static void full_screen_callback(GtkCheckMenuItem *item, gpointer data);
208static void recalc_borders_callback(GtkMenuItem *item, gpointer data);
209static void toggle_fog_callback(GtkMenuItem *item, gpointer data);
210static void scenario_properties_callback(GtkMenuItem *item, gpointer data);
211static void save_scenario_callback(GtkMenuItem *item, gpointer data);
212static void center_view_callback(GtkMenuItem *item, gpointer data);
213static void report_economy_callback(GtkMenuItem *item, gpointer data);
214static void report_research_callback(GtkMenuItem *item, gpointer data);
215static void multiplier_callback(GtkMenuItem *item, gpointer data);
216static void report_spaceship_callback(GtkMenuItem *item, gpointer data);
217static void report_achievements_callback(GtkMenuItem *item, gpointer data);
218static void government_callback(GtkMenuItem *item, gpointer data);
219static void tax_rate_callback(GtkMenuItem *item, gpointer data);
220static void select_single_callback(GtkMenuItem *item, gpointer data);
221static void select_all_on_tile_callback(GtkMenuItem *item, gpointer data);
222static void select_same_type_tile_callback(GtkMenuItem *item, gpointer data);
223static void select_same_type_cont_callback(GtkMenuItem *item, gpointer data);
224static void select_same_type_callback(GtkMenuItem *item, gpointer data);
225static void select_dialog_callback(GtkMenuItem *item, gpointer data);
226static void unit_wait_callback(GtkMenuItem *item, gpointer data);
227static void unit_done_callback(GtkMenuItem *item, gpointer data);
228static void unit_goto_callback(GtkMenuItem *item, gpointer data);
229static void unit_goto_city_callback(GtkMenuItem *item, gpointer data);
230static void unit_return_callback(GtkMenuItem *item, gpointer data);
231static void unit_explore_callback(GtkMenuItem *item, gpointer data);
232static void unit_patrol_callback(GtkMenuItem *item, gpointer data);
233static void unit_sentry_callback(GtkMenuItem *item, gpointer data);
234static void unit_unsentry_callback(GtkMenuItem *item, gpointer data);
235static void unit_board_callback(GtkMenuItem *item, gpointer data);
236static void unit_deboard_callback(GtkMenuItem *item, gpointer data);
237static void unit_unload_transporter_callback(GtkMenuItem *item,
238 gpointer data);
239static void unit_homecity_callback(GtkMenuItem *item, gpointer data);
240static void unit_upgrade_callback(GtkMenuItem *item, gpointer data);
241static void unit_convert_callback(GtkMenuItem *item, gpointer data);
242static void unit_disband_callback(GtkMenuItem *item, gpointer data);
243static void build_city_callback(GtkMenuItem *item, gpointer data);
244static void auto_settle_callback(GtkMenuItem *item, gpointer data);
245static void build_road_callback(GtkMenuItem *item, gpointer data);
246static void build_irrigation_callback(GtkMenuItem *item, gpointer data);
247static void cultivate_callback(GtkMenuItem *item, gpointer data);
248static void build_mine_callback(GtkMenuItem *item, gpointer data);
249static void plant_callback(GtkMenuItem *item, gpointer data);
250static void connect_road_callback(GtkMenuItem *item, gpointer data);
251static void connect_rail_callback(GtkMenuItem *item, gpointer data);
252static void connect_maglev_callback(GtkMenuItem *item, gpointer data);
253static void connect_irrigation_callback(GtkMenuItem *item, gpointer data);
254static void transform_terrain_callback(GtkMenuItem *item, gpointer data);
255static void clean_pollution_callback(GtkMenuItem *item, gpointer data);
256static void clean_fallout_callback(GtkMenuItem *item, gpointer data);
257static void fortify_callback(GtkMenuItem *item, gpointer data);
258static void build_fortress_callback(GtkMenuItem *item, gpointer data);
259static void build_airbase_callback(GtkMenuItem *item, gpointer data);
260static void do_paradrop_callback(GtkMenuItem *item, gpointer data);
261static void do_pillage_callback(GtkMenuItem *item, gpointer data);
262static void diplomat_action_callback(GtkMenuItem *item, gpointer data);
263
265{
266 { "MENU_GAME", N_("_Game"), 0, 0, NULL, MGROUP_SAFE },
267 { "MENU_OPTIONS", N_("_Options"), 0, 0, NULL, MGROUP_SAFE },
268 { "MENU_EDIT", N_("_Edit"), 0, 0, NULL, MGROUP_SAFE },
269 { "MENU_VIEW", N_("?verb:_View"), 0, 0, NULL, MGROUP_SAFE },
270 { "MENU_IMPROVEMENTS", N_("_Improvements"), 0, 0,
271 NULL, MGROUP_SAFE },
272 { "MENU_CIVILIZATION", N_("C_ivilization"), 0, 0,
273 NULL, MGROUP_SAFE },
274 { "MENU_BATTLE_GROUPS", N_("_Battle Groups"), 0, 0,
275 NULL, MGROUP_PLAYING },
276 { "MENU_HELP", N_("_Help"), 0, 0, NULL, MGROUP_SAFE },
277 { "CLEAR_CHAT_LOGS", N_("_Clear Chat Log"), 0, 0,
279 { "SAVE_CHAT_LOGS", N_("Save Chat _Log"), 0, 0,
281 { "LOCAL_OPTIONS", N_("_Local Client"), 0, 0,
282 G_CALLBACK(local_options_callback), MGROUP_SAFE },
283 { "MESSAGE_OPTIONS", N_("_Message"), 0, 0,
285 { "SERVER_OPTIONS", N_("_Remote Server"), 0, 0,
287 { "SAVE_OPTIONS", N_("Save Options _Now"), 0, 0,
288 G_CALLBACK(save_options_callback), MGROUP_SAFE },
289 { "RELOAD_TILESET", N_("_Reload Tileset"),
290 GDK_KEY_r, GDK_MOD1_MASK | GDK_CONTROL_MASK,
292 { "GAME_SAVE", N_("_Save Game"), GDK_KEY_s, GDK_CONTROL_MASK,
293 G_CALLBACK(save_game_callback), MGROUP_SAFE },
294 { "GAME_SAVE_AS", N_("Save Game _As..."), 0, 0,
295 G_CALLBACK(save_game_as_callback), MGROUP_SAFE },
296 { "MAPIMG_SAVE", N_("Save Map _Image"), 0, 0,
297 G_CALLBACK(save_mapimg_callback), MGROUP_SAFE },
298 { "MAPIMG_SAVE_AS", N_("Save _Map Image As..."), 0, 0,
300 { "LEAVE", N_("_Leave"), 0, 0, G_CALLBACK(leave_callback), MGROUP_SAFE },
301 { "QUIT", N_("_Quit"), GDK_KEY_q, GDK_CONTROL_MASK,
302 G_CALLBACK(quit_callback), MGROUP_SAFE },
303 { "FIND_CITY", N_("_Find City"), GDK_KEY_f, GDK_CONTROL_MASK,
304 G_CALLBACK(find_city_callback), MGROUP_SAFE },
305 { "WORKLISTS", N_("Work_lists"),
306 GDK_KEY_l, GDK_CONTROL_MASK | GDK_SHIFT_MASK,
307 G_CALLBACK(worklists_callback), MGROUP_SAFE },
308 { "CLIENT_LUA_SCRIPT", N_("Client _Lua Script"), 0, 0,
310 { "MAP_VIEW", N_("?noun:_View"), GDK_KEY_F1, 0,
311 G_CALLBACK(map_view_callback), MGROUP_SAFE },
312 { "REPORT_UNITS", N_("_Units"), GDK_KEY_F2, 0,
313 G_CALLBACK(report_units_callback), MGROUP_SAFE },
314 { "REPORT_NATIONS", N_("_Nations"), GDK_KEY_F3, 0,
316 { "REPORT_CITIES", N_("_Cities"), GDK_KEY_F4, 0,
317 G_CALLBACK(report_cities_callback), MGROUP_SAFE },
318 { "REPORT_WOW", N_("_Wonders of the World"), GDK_KEY_F7, 0,
319 G_CALLBACK(report_wow_callback), MGROUP_SAFE },
320 { "REPORT_TOP_CITIES", N_("Top _Five Cities"), GDK_KEY_F8, 0,
322 { "REPORT_MESSAGES", N_("_Messages"), GDK_KEY_F9, 0,
324 { "REPORT_DEMOGRAPHIC", N_("_Demographics"), GDK_KEY_F11, 0,
326
327 /* Battle Groups menu */
328 /* Note that user view: 1 - 4, internal: 0 - 3 */
329 { "BATTLE_GROUP_SELECT_0", N_("Select Battle Group 1"),
330 GDK_KEY_F1, GDK_SHIFT_MASK,
331 G_CALLBACK(bg_select0_callback), MGROUP_SAFE },
332 { "BATTLE_GROUP_ASSIGN_0", N_("Assign Battle Group 1"),
333 GDK_KEY_F1, GDK_CONTROL_MASK,
334 G_CALLBACK(bg_assign0_callback), MGROUP_SAFE },
335 { "BATTLE_GROUP_APPEND_0", N_("Append to Battle Group 1"),
336 GDK_KEY_F1, GDK_SHIFT_MASK | GDK_CONTROL_MASK,
337 G_CALLBACK(bg_append0_callback), MGROUP_SAFE },
338 { "BATTLE_GROUP_SELECT_1", N_("Select Battle Group 2"),
339 GDK_KEY_F2, GDK_SHIFT_MASK,
340 G_CALLBACK(bg_select1_callback), MGROUP_SAFE },
341 { "BATTLE_GROUP_ASSIGN_1", N_("Assign Battle Group 2"),
342 GDK_KEY_F2, GDK_CONTROL_MASK,
343 G_CALLBACK(bg_assign1_callback), MGROUP_SAFE },
344 { "BATTLE_GROUP_APPEND_1", N_("Append to Battle Group 2"),
345 GDK_KEY_F2, GDK_SHIFT_MASK | GDK_CONTROL_MASK,
346 G_CALLBACK(bg_append1_callback), MGROUP_SAFE },
347 { "BATTLE_GROUP_SELECT_2", N_("Select Battle Group 3"),
348 GDK_KEY_F3, GDK_SHIFT_MASK,
349 G_CALLBACK(bg_select2_callback), MGROUP_SAFE },
350 { "BATTLE_GROUP_ASSIGN_2", N_("Assign Battle Group 3"),
351 GDK_KEY_F3, GDK_CONTROL_MASK,
352 G_CALLBACK(bg_assign2_callback), MGROUP_SAFE },
353 { "BATTLE_GROUP_APPEND_2", N_("Append to Battle Group 3"),
354 GDK_KEY_F3, GDK_SHIFT_MASK | GDK_CONTROL_MASK,
355 G_CALLBACK(bg_append2_callback), MGROUP_SAFE },
356 { "BATTLE_GROUP_SELECT_3", N_("Select Battle Group 4"),
357 GDK_KEY_F4, GDK_SHIFT_MASK,
358 G_CALLBACK(bg_select3_callback), MGROUP_SAFE },
359 { "BATTLE_GROUP_ASSIGN_3", N_("Assign Battle Group 4"),
360 GDK_KEY_F4, GDK_CONTROL_MASK,
361 G_CALLBACK(bg_assign3_callback), MGROUP_SAFE },
362 { "BATTLE_GROUP_APPEND_3", N_("Append to Battle Group 4"),
363 GDK_KEY_F4, GDK_SHIFT_MASK | GDK_CONTROL_MASK,
364 G_CALLBACK(bg_append3_callback), MGROUP_SAFE },
365
366 { "HELP_OVERVIEW", N_("?help:Overview"), 0, 0,
367 G_CALLBACK(help_overview_callback), MGROUP_SAFE },
368 { "HELP_PLAYING", N_("Strategy and Tactics"), 0, 0,
369 G_CALLBACK(help_playing_callback), MGROUP_SAFE },
370 { "HELP_POLICIES", N_("Policies"), 0, 0,
371 G_CALLBACK(help_policies_callback), MGROUP_SAFE },
372 { "HELP_TERRAIN", N_("Terrain"), 0, 0,
373 G_CALLBACK(help_terrain_callback), MGROUP_SAFE },
374 { "HELP_ECONOMY", N_("Economy"), 0, 0,
375 G_CALLBACK(help_economy_callback), MGROUP_SAFE },
376 { "HELP_CITIES", N_("Cities"), 0, 0,
377 G_CALLBACK(help_cities_callback), MGROUP_SAFE },
378 { "HELP_IMPROVEMENTS", N_("City Improvements"), 0, 0,
380 { "HELP_WONDERS", N_("Wonders of the World"), 0, 0,
381 G_CALLBACK(help_wonders_callback), MGROUP_SAFE },
382 { "HELP_UNITS", N_("Units"), 0, 0,
383 G_CALLBACK(help_units_callback), MGROUP_SAFE },
384 { "HELP_COMBAT", N_("Combat"), 0, 0,
385 G_CALLBACK(help_combat_callback), MGROUP_SAFE },
386 { "HELP_ZOC", N_("Zones of Control"), 0, 0,
387 G_CALLBACK(help_zoc_callback), MGROUP_SAFE },
388 { "HELP_GOVERNMENT", N_("Government"), 0, 0,
390 { "HELP_DIPLOMACY", N_("Diplomacy"), 0, 0,
392 { "HELP_TECH", N_("Technology"), 0, 0,
393 G_CALLBACK(help_tech_callback), MGROUP_SAFE },
394 { "HELP_SPACE_RACE", N_("Space Race"), 0, 0,
396 { "HELP_RULESET", N_("About Current Ruleset"), 0, 0,
397 G_CALLBACK(help_ruleset_callback), MGROUP_SAFE },
398 { "HELP_TILESET", N_("About Current Tileset"), 0, 0,
399 G_CALLBACK(help_tileset_callback), MGROUP_SAFE },
400 { "HELP_NATIONS", N_("About Nations"), 0, 0,
401 G_CALLBACK(help_nations_callback), MGROUP_SAFE },
402 { "HELP_CONNECTING", N_("Connecting"), 0, 0,
404 { "HELP_CONTROLS", N_("Controls"), 0, 0,
405 G_CALLBACK(help_controls_callback), MGROUP_SAFE },
406 { "HELP_CMA", N_("Citizen Governor"), 0, 0,
407 G_CALLBACK(help_cma_callback), MGROUP_SAFE },
408 { "HELP_CHATLINE", N_("Chatline"), 0, 0,
409 G_CALLBACK(help_chatline_callback), MGROUP_SAFE },
410 { "HELP_WORKLIST_EDITOR", N_("Worklist Editor"), 0, 0,
412 { "HELP_LANGUAGES", N_("Languages"), 0, 0,
413 G_CALLBACK(help_language_callback), MGROUP_SAFE },
414 { "HELP_COPYING", N_("Copying"), 0, 0,
415 G_CALLBACK(help_copying_callback), MGROUP_SAFE },
416 { "HELP_ABOUT", N_("About Freeciv"), 0, 0,
417 G_CALLBACK(help_about_callback), MGROUP_SAFE },
418 { "SAVE_OPTIONS_ON_EXIT", N_("Save Options on _Exit"), 0, 0,
420 { "EDIT_MODE", N_("_Editing Mode"), GDK_KEY_e, GDK_CONTROL_MASK,
421 G_CALLBACK(edit_mode_callback), MGROUP_SAFE },
422 { "SHOW_CITY_OUTLINES", N_("Cit_y Outlines"), GDK_KEY_y, GDK_CONTROL_MASK,
424 { "SHOW_CITY_OUTPUT", N_("City Output"), GDK_KEY_v, GDK_CONTROL_MASK,
426 { "SHOW_MAP_GRID", N_("Map _Grid"), GDK_KEY_g, GDK_CONTROL_MASK,
427 G_CALLBACK(show_map_grid_callback), MGROUP_SAFE },
428 { "SHOW_NATIONAL_BORDERS", N_("National _Borders"), GDK_KEY_b, GDK_CONTROL_MASK,
430 { "SHOW_NATIVE_TILES", N_("Native Tiles"), GDK_KEY_n, GDK_CONTROL_MASK | GDK_SHIFT_MASK,
432 { "SHOW_CITY_FULL_BAR", N_("City Full Bar"), 0, 0,
434 { "SHOW_CITY_NAMES", N_("City _Names"), GDK_KEY_n, GDK_CONTROL_MASK,
436 { "SHOW_CITY_GROWTH", N_("City G_rowth"), GDK_KEY_o, GDK_CONTROL_MASK,
438 { "SHOW_CITY_PRODUCTIONS", N_("City _Production"), GDK_KEY_p, GDK_CONTROL_MASK,
440 { "SHOW_CITY_BUY_COST", N_("City Buy Cost"), 0, 0,
442 { "SHOW_CITY_TRADE_ROUTES", N_("City Tra_deroutes"), GDK_KEY_d, GDK_CONTROL_MASK,
444 { "SHOW_TERRAIN", N_("_Terrain"), 0, 0,
445 G_CALLBACK(show_terrain_callback), MGROUP_SAFE },
446 { "SHOW_COASTLINE", N_("C_oastline"), 0, 0,
448 { "SHOW_PATHS", N_("_Paths"), 0, 0,
450 { "SHOW_IRRIGATION", N_("_Irrigation"), 0, 0,
452 { "SHOW_MINES", N_("_Mines"), 0, 0,
453 G_CALLBACK(show_mine_callback), MGROUP_SAFE },
454 { "SHOW_BASES", N_("_Bases"), 0, 0,
455 G_CALLBACK(show_bases_callback), MGROUP_SAFE },
456 { "SHOW_RESOURCES", N_("_Resources"), 0, 0,
458 { "SHOW_HUTS", N_("_Huts"), 0, 0,
459 G_CALLBACK(show_huts_callback), MGROUP_SAFE },
460 { "SHOW_POLLUTION", N_("Po_llution & Fallout"), 0, 0,
462 { "SHOW_CITIES", N_("Citi_es"), 0, 0,
463 G_CALLBACK(show_cities_callback), MGROUP_SAFE },
464 { "SHOW_UNITS", N_("_Units"), 0, 0,
465 G_CALLBACK(show_units_callback), MGROUP_SAFE },
466 { "SHOW_UNIT_SOLID_BG", N_("Unit Solid Background"), 0, 0,
468 { "SHOW_UNIT_SHIELDS", N_("Unit shields"), 0, 0,
470 { "SHOW_STACK_SIZE", N_("Unit Stack Size"),
471 GDK_KEY_plus, GDK_CONTROL_MASK,
473 { "SHOW_FOCUS_UNIT", N_("Focu_s Unit"), 0, 0,
475 { "SHOW_FOG_OF_WAR", N_("Fog of _War"), 0, 0,
477 { "FULL_SCREEN", N_("_Fullscreen"), GDK_KEY_Return, GDK_MOD1_MASK,
478 G_CALLBACK(full_screen_callback), MGROUP_SAFE },
479
480 { "RECALC_BORDERS", N_("Recalculate _Borders"), 0, 0,
482 { "TOGGLE_FOG", N_("Toggle Fog of _War"), GDK_KEY_w,
483 GDK_CONTROL_MASK | GDK_SHIFT_MASK,
484 G_CALLBACK(toggle_fog_callback), MGROUP_EDIT },
485 { "SCENARIO_PROPERTIES", N_("Game/Scenario Properties"), 0, 0,
487 { "SAVE_SCENARIO", N_("Save Scenario"), 0, 0,
488 G_CALLBACK(save_scenario_callback), MGROUP_EDIT },
489
490 { "CENTER_VIEW", N_("_Center View"), GDK_KEY_c, 0,
491 G_CALLBACK(center_view_callback), MGROUP_PLAYER },
492 { "REPORT_ECONOMY", N_("_Economy"), GDK_KEY_F5, 0,
494 { "REPORT_RESEARCH", N_("_Research"), GDK_KEY_F6, 0,
496 { "POLICIES", N_("_Policies..."),
497 GDK_KEY_p, GDK_SHIFT_MASK | GDK_CONTROL_MASK,
498 G_CALLBACK(multiplier_callback), MGROUP_PLAYER },
499 { "REPORT_SPACESHIP", N_("_Spaceship"), GDK_KEY_F12, 0,
501 { "REPORT_ACHIEVEMENTS", N_("_Achievements"), GDK_KEY_asterisk, 0,
503
504 { "MENU_SELECT", N_("_Select"), 0, 0, NULL, MGROUP_UNIT },
505 { "MENU_UNIT", N_("_Unit"), 0, 0, NULL, MGROUP_UNIT },
506 { "MENU_WORK", N_("_Work"), 0, 0, NULL, MGROUP_UNIT },
507 { "MENU_COMBAT", N_("_Combat"), 0, 0, NULL, MGROUP_UNIT },
508 { "MENU_BUILD_BASE", N_("Build _Base"), 0, 0, NULL, MGROUP_UNIT },
509 { "MENU_BUILD_PATH", N_("Build _Path"), 0, 0, NULL, MGROUP_UNIT },
510 { "SELECT_SINGLE", N_("_Single Unit (Unselect Others)"), GDK_KEY_z, 0,
511 G_CALLBACK(select_single_callback), MGROUP_UNIT },
512 { "SELECT_ALL_ON_TILE", N_("_All On Tile"), GDK_KEY_v, 0,
514 { "SELECT_SAME_TYPE_TILE", N_("Same Type on _Tile"),
515 GDK_KEY_v, GDK_SHIFT_MASK,
517 { "SELECT_SAME_TYPE_CONT", N_("Same Type on _Continent"),
518 GDK_KEY_c, GDK_SHIFT_MASK,
520 { "SELECT_SAME_TYPE", N_("Same Type _Everywhere"), GDK_KEY_x, GDK_SHIFT_MASK,
522 { "SELECT_DLG", N_("Unit Selection Dialog"), 0, 0,
523 G_CALLBACK(select_dialog_callback), MGROUP_UNIT },
524 { "UNIT_WAIT", N_("_Wait"), GDK_KEY_w, 0,
525 G_CALLBACK(unit_wait_callback), MGROUP_UNIT },
526 { "UNIT_DONE", N_("_Done"), GDK_KEY_space, 0,
527 G_CALLBACK(unit_done_callback), MGROUP_UNIT },
528 { "UNIT_GOTO", N_("_Go to"), GDK_KEY_g, 0,
529 G_CALLBACK(unit_goto_callback), MGROUP_UNIT },
530 { "MENU_GOTO_AND", N_("Go to a_nd..."), 0, 0, NULL, MGROUP_UNIT },
531 { "UNIT_GOTO_CITY", N_("Go _to/Airlift to City..."), GDK_KEY_t, 0,
533 { "UNIT_RETURN", N_("_Return to Nearest City"), GDK_KEY_g, GDK_SHIFT_MASK,
534 G_CALLBACK(unit_return_callback), MGROUP_UNIT },
535 { "UNIT_EXPLORE", N_("Auto E_xplore"), GDK_KEY_x, 0,
536 G_CALLBACK(unit_explore_callback), MGROUP_UNIT },
537 { "UNIT_PATROL", N_("_Patrol"), GDK_KEY_q, 0,
538 G_CALLBACK(unit_patrol_callback), MGROUP_UNIT },
539 { "UNIT_SENTRY", N_("_Sentry"), GDK_KEY_s, 0,
540 G_CALLBACK(unit_sentry_callback), MGROUP_UNIT },
541 { "UNIT_UNSENTRY", N_("Uns_entry All On Tile"), GDK_KEY_s, GDK_SHIFT_MASK,
542 G_CALLBACK(unit_unsentry_callback), MGROUP_UNIT },
543 { "UNIT_BOARD", N_("_Load"), GDK_KEY_l, 0,
544 G_CALLBACK(unit_board_callback), MGROUP_UNIT },
545 { "UNIT_DEBOARD", N_("_Unload"), GDK_KEY_u, 0,
546 G_CALLBACK(unit_deboard_callback), MGROUP_UNIT },
547 { "UNIT_UNLOAD_TRANSPORTER", N_("U_nload All From Transporter"),
548 GDK_KEY_t, GDK_SHIFT_MASK,
550 { "UNIT_HOMECITY", N_("Set _Home City"), GDK_KEY_h, 0,
551 G_CALLBACK(unit_homecity_callback), MGROUP_UNIT },
552 { "UNIT_UPGRADE", N_("Upgr_ade"), GDK_KEY_u, GDK_SHIFT_MASK,
553 G_CALLBACK(unit_upgrade_callback), MGROUP_UNIT },
554 { "UNIT_CONVERT", N_("C_onvert"), GDK_KEY_o, GDK_SHIFT_MASK,
555 G_CALLBACK(unit_convert_callback), MGROUP_UNIT },
556 { "UNIT_DISBAND", N_("_Disband"), GDK_KEY_d, GDK_SHIFT_MASK,
557 G_CALLBACK(unit_disband_callback), MGROUP_UNIT },
558 { "BUILD_CITY", N_("_Build City"), GDK_KEY_b, 0,
559 G_CALLBACK(build_city_callback), MGROUP_UNIT },
560 { "AUTO_SETTLER", N_("_Auto Settler"), GDK_KEY_a, 0,
561 G_CALLBACK(auto_settle_callback), MGROUP_UNIT },
562 { "BUILD_ROAD", N_("Build _Road"), GDK_KEY_r, 0,
563 G_CALLBACK(build_road_callback), MGROUP_UNIT },
564 { "BUILD_IRRIGATION", N_("Build _Irrigation"), GDK_KEY_i, 0,
566 { "CULTIVATE", N_("Cultivate"), GDK_KEY_i, GDK_SHIFT_MASK,
567 G_CALLBACK(cultivate_callback), MGROUP_UNIT },
568 { "BUILD_MINE", N_("Build _Mine"), GDK_KEY_m, 0,
569 G_CALLBACK(build_mine_callback), MGROUP_UNIT },
570 { "PLANT", N_("Plant"), GDK_KEY_m, GDK_SHIFT_MASK,
571 G_CALLBACK(plant_callback), MGROUP_UNIT },
572 { "CONNECT_ROAD", N_("Connect With Roa_d"), GDK_KEY_r, GDK_CONTROL_MASK,
573 G_CALLBACK(connect_road_callback), MGROUP_UNIT },
574 { "CONNECT_RAIL", N_("Connect With Rai_l"), GDK_KEY_l, GDK_CONTROL_MASK,
575 G_CALLBACK(connect_rail_callback), MGROUP_UNIT },
576 { "CONNECT_MAGLEV", N_("Connect With _Maglev"), GDK_KEY_m, GDK_CONTROL_MASK,
578 { "CONNECT_IRRIGATION", N_("Connect With Irri_gation"),
579 GDK_KEY_i, GDK_CONTROL_MASK,
581 { "TRANSFORM_TERRAIN", N_("Transf_orm Terrain"), GDK_KEY_o, 0,
583 { "CLEAN_POLLUTION", N_("Clean _Pollution"), GDK_KEY_p, 0,
585 { "CLEAN_FALLOUT", N_("Clean _Nuclear Fallout"), GDK_KEY_n, 0,
586 G_CALLBACK(clean_fallout_callback), MGROUP_UNIT },
587 { "FORTIFY", N_("Fortify"), GDK_KEY_f, 0,
588 G_CALLBACK(fortify_callback), MGROUP_UNIT },
589 { "BUILD_FORTRESS", N_("Build Fortress"), GDK_KEY_f, GDK_SHIFT_MASK,
591 { "BUILD_AIRBASE", N_("Build Airbase"), GDK_KEY_e, GDK_SHIFT_MASK,
592 G_CALLBACK(build_airbase_callback), MGROUP_UNIT },
593 { "DO_PARADROP", N_("P_aradrop"), GDK_KEY_j, 0,
594 G_CALLBACK(do_paradrop_callback), MGROUP_UNIT },
595 { "DO_PILLAGE", N_("_Pillage"), GDK_KEY_p, GDK_SHIFT_MASK,
596 G_CALLBACK(do_pillage_callback), MGROUP_UNIT },
597 { "DIPLOMAT_ACTION", N_("_Do..."), GDK_KEY_d, 0,
599
600 { "MENU_GOVERNMENT", N_("_Government"), 0, 0,
601 NULL, MGROUP_PLAYING },
602 { "TAX_RATE", N_("_Tax Rates..."), GDK_KEY_t, GDK_CONTROL_MASK,
603 G_CALLBACK(tax_rate_callback), MGROUP_PLAYING },
604 { "START_REVOLUTION", N_("_Revolution..."),
605 GDK_KEY_g, GDK_SHIFT_MASK | GDK_CONTROL_MASK,
606 G_CALLBACK(government_callback), MGROUP_PLAYING },
607 { NULL }
608};
609
610static struct menu_entry_info *menu_entry_info_find(const char *key);
611
612/************************************************************************/
615static void clear_chat_logs_callback(GtkMenuItem *item, gpointer data)
616{
618}
619
620/************************************************************************/
623static void save_chat_logs_callback(GtkMenuItem *item, gpointer data)
624{
626}
627
628/************************************************************************/
631static void local_options_callback(GtkMenuItem *item, gpointer data)
632{
633 option_dialog_popup(_("Set local options"), client_optset);
634}
635
636/************************************************************************/
639static void message_options_callback(GtkMenuItem *item, gpointer data)
640{
642}
643
644/************************************************************************/
647static void server_options_callback(GtkMenuItem *item, gpointer data)
648{
649 option_dialog_popup(_("Game Settings"), server_optset);
650}
651
652/************************************************************************/
655static void save_options_callback(GtkMenuItem *item, gpointer data)
656{
657 options_save(NULL);
658}
659
660/************************************************************************/
663static void reload_tileset_callback(GtkMenuItem *item, gpointer data)
664{
665 tilespec_reread(NULL, TRUE, 1.0);
666}
667
668/************************************************************************/
671static void save_game_callback(GtkMenuItem *item, gpointer data)
672{
673 send_save_game(NULL);
674}
675
676/************************************************************************/
679static void save_game_as_callback(GtkMenuItem *item, gpointer data)
680{
682}
683
684/************************************************************************/
687static void save_mapimg_callback(GtkMenuItem *item, gpointer data)
688{
689 mapimg_client_save(NULL);
690}
691
692/************************************************************************/
695static void save_mapimg_as_callback(GtkMenuItem *item, gpointer data)
696{
698}
699
700/************************************************************************/
704static void leave_local_game_response(GtkWidget *dialog, gint response)
705{
706 gtk_widget_destroy(dialog);
707 if (response == GTK_RESPONSE_OK) {
708 /* It might be killed already */
709 if (client.conn.used) {
710 /* It will also kill the server */
712 }
713 }
714}
715
716/************************************************************************/
719static void leave_callback(GtkMenuItem *item, gpointer data)
720{
721 if (is_server_running()) {
722 GtkWidget* dialog =
723 gtk_message_dialog_new(NULL, 0, GTK_MESSAGE_WARNING,
724 GTK_BUTTONS_OK_CANCEL,
725 _("Leaving a local game will end it!"));
726 setup_dialog(dialog, toplevel);
727 gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_MOUSE);
728 g_signal_connect(dialog, "response",
729 G_CALLBACK(leave_local_game_response), NULL);
730 gtk_window_present(GTK_WINDOW(dialog));
731 } else {
733 }
734}
735
736/************************************************************************/
739static void quit_callback(GtkMenuItem *item, gpointer data)
740{
742}
743
744/************************************************************************/
747static void find_city_callback(GtkMenuItem *item, gpointer data)
748{
750}
751
752/************************************************************************/
755static void worklists_callback(GtkMenuItem *item, gpointer data)
756{
758}
759
760/************************************************************************/
763static void map_view_callback(GtkMenuItem *item, gpointer data)
764{
766}
767
768/************************************************************************/
771static void report_nations_callback(GtkMenuItem *item, gpointer data)
772{
774}
775
776/************************************************************************/
779static void report_wow_callback(GtkMenuItem *item, gpointer data)
780{
782}
783
784/************************************************************************/
787static void report_top_cities_callback(GtkMenuItem *item, gpointer data)
788{
790}
791
792/************************************************************************/
795static void report_messages_callback(GtkMenuItem *item, gpointer data)
796{
798}
799
800/************************************************************************/
803static void client_lua_script_callback(GtkMenuItem *item, gpointer data)
804{
806}
807
808/************************************************************************/
811static void report_demographic_callback(GtkMenuItem *item, gpointer data)
812{
814}
815
816/************************************************************************/
819static void report_achievements_callback(GtkMenuItem *item, gpointer data)
820{
822}
823
824/************************************************************************/
827static void help_language_callback(GtkMenuItem *item, gpointer data)
828{
830}
831
832/************************************************************************/
835static void help_policies_callback(GtkMenuItem *item, gpointer data)
836{
838}
839
840/************************************************************************/
843static void help_connecting_callback(GtkMenuItem *item, gpointer data)
844{
846}
847
848/************************************************************************/
851static void help_controls_callback(GtkMenuItem *item, gpointer data)
852{
854}
855
856/************************************************************************/
859static void help_chatline_callback(GtkMenuItem *item, gpointer data)
860{
862}
863
864/************************************************************************/
867static void help_worklist_editor_callback(GtkMenuItem *item, gpointer data)
868{
870}
871
872/************************************************************************/
875static void help_cma_callback(GtkMenuItem *item, gpointer data)
876{
878}
879
880/************************************************************************/
883static void bg_select0_callback(GtkMenuItem *item, gpointer data)
884{
886}
887
888/************************************************************************/
891static void bg_assign0_callback(GtkMenuItem *item, gpointer data)
892{
894}
895
896/************************************************************************/
899static void bg_append0_callback(GtkMenuItem *item, gpointer data)
900{
902}
903
904/************************************************************************/
907static void bg_select1_callback(GtkMenuItem *item, gpointer data)
908{
910}
911
912/************************************************************************/
915static void bg_assign1_callback(GtkMenuItem *item, gpointer data)
916{
918}
919
920/************************************************************************/
923static void bg_append1_callback(GtkMenuItem *item, gpointer data)
924{
926}
927
928/************************************************************************/
931static void bg_select2_callback(GtkMenuItem *item, gpointer data)
932{
934}
935
936/************************************************************************/
939static void bg_assign2_callback(GtkMenuItem *item, gpointer data)
940{
942}
943
944/************************************************************************/
947static void bg_append2_callback(GtkMenuItem *item, gpointer data)
948{
950}
951
952/************************************************************************/
955static void bg_select3_callback(GtkMenuItem *item, gpointer data)
956{
958}
959
960/************************************************************************/
963static void bg_assign3_callback(GtkMenuItem *item, gpointer data)
964{
966}
967
968/************************************************************************/
971static void bg_append3_callback(GtkMenuItem *item, gpointer data)
972{
974}
975
976/************************************************************************/
979static void help_overview_callback(GtkMenuItem *item, gpointer data)
980{
982}
983
984/************************************************************************/
987static void help_playing_callback(GtkMenuItem *item, gpointer data)
988{
990}
991
992/************************************************************************/
995static void help_ruleset_callback(GtkMenuItem *item, gpointer data)
996{
998}
999
1000/************************************************************************/
1003static void help_tileset_callback(GtkMenuItem *item, gpointer data)
1004{
1006}
1007
1008/************************************************************************/
1011static void help_economy_callback(GtkMenuItem *item, gpointer data)
1012{
1014}
1015
1016/************************************************************************/
1019static void help_cities_callback(GtkMenuItem *item, gpointer data)
1020{
1022}
1023
1024/************************************************************************/
1027static void help_improvements_callback(GtkMenuItem *item, gpointer data)
1028{
1030}
1031
1032/************************************************************************/
1035static void help_units_callback(GtkMenuItem *item, gpointer data)
1036{
1038}
1039
1040/************************************************************************/
1043static void help_combat_callback(GtkMenuItem *item, gpointer data)
1044{
1046}
1047
1048/************************************************************************/
1051static void help_zoc_callback(GtkMenuItem *item, gpointer data)
1052{
1054}
1055
1056/************************************************************************/
1059static void help_tech_callback(GtkMenuItem *item, gpointer data)
1060{
1062}
1063
1064/************************************************************************/
1067static void help_terrain_callback(GtkMenuItem *item, gpointer data)
1068{
1070}
1071
1072/************************************************************************/
1075static void help_wonders_callback(GtkMenuItem *item, gpointer data)
1076{
1078}
1079
1080/************************************************************************/
1083static void help_government_callback(GtkMenuItem *item, gpointer data)
1084{
1086}
1087
1088/************************************************************************/
1091static void help_diplomacy_callback(GtkMenuItem *item, gpointer data)
1092{
1094}
1095
1096/************************************************************************/
1099static void help_space_race_callback(GtkMenuItem *item, gpointer data)
1100{
1102}
1103
1104/************************************************************************/
1107static void help_nations_callback(GtkMenuItem *item, gpointer data)
1108{
1110}
1111
1112/************************************************************************/
1115static void help_copying_callback(GtkMenuItem *item, gpointer data)
1116{
1118}
1119
1120/************************************************************************/
1123static void help_about_callback(GtkMenuItem *item, gpointer data)
1124{
1126}
1127
1128/************************************************************************/
1131static void save_options_on_exit_callback(GtkCheckMenuItem *item,
1132 gpointer data)
1133{
1134 gui_options.save_options_on_exit = gtk_check_menu_item_get_active(item);
1135}
1136
1137/************************************************************************/
1140static void edit_mode_callback(GtkCheckMenuItem *item, gpointer data)
1141{
1142 if (game.info.is_edit_mode ^ gtk_check_menu_item_get_active(item)) {
1144 /* Unreachable techs in reqtree on/off */
1146 }
1147}
1148
1149/************************************************************************/
1152static void show_city_outlines_callback(GtkCheckMenuItem *item,
1153 gpointer data)
1154{
1155 if (gui_options.draw_city_outlines ^ gtk_check_menu_item_get_active(item)) {
1157 }
1158}
1159
1160/************************************************************************/
1163static void show_city_output_callback(GtkCheckMenuItem *item,
1164 gpointer data)
1165{
1166 if (gui_options.draw_city_output ^ gtk_check_menu_item_get_active(item)) {
1168 }
1169}
1170
1171/************************************************************************/
1174static void show_map_grid_callback(GtkCheckMenuItem *item,
1175 gpointer data)
1176{
1177 if (gui_options.draw_map_grid ^ gtk_check_menu_item_get_active(item)) {
1179 }
1180}
1181
1182/************************************************************************/
1185static void show_national_borders_callback(GtkCheckMenuItem *item,
1186 gpointer data)
1187{
1188 if (gui_options.draw_borders ^ gtk_check_menu_item_get_active(item)) {
1190 }
1191}
1192
1193/************************************************************************/
1196static void show_native_tiles_callback(GtkCheckMenuItem *item,
1197 gpointer data)
1198{
1199 if (gui_options.draw_native ^ gtk_check_menu_item_get_active(item)) {
1201 }
1202}
1203
1204/************************************************************************/
1207static void show_city_full_bar_callback(GtkCheckMenuItem *item,
1208 gpointer data)
1209{
1210 if (gui_options.draw_full_citybar ^ gtk_check_menu_item_get_active(item)) {
1213 }
1214}
1215
1216/************************************************************************/
1219static void show_city_names_callback(GtkCheckMenuItem *item,
1220 gpointer data)
1221{
1222 if (gui_options.draw_city_names ^ gtk_check_menu_item_get_active(item)) {
1225 }
1226}
1227
1228/************************************************************************/
1231static void show_city_growth_callback(GtkCheckMenuItem *item,
1232 gpointer data)
1233{
1234 if (gui_options.draw_city_growth ^ gtk_check_menu_item_get_active(item)) {
1236 }
1237}
1238
1239/************************************************************************/
1242static void show_city_productions_callback(GtkCheckMenuItem *item,
1243 gpointer data)
1244{
1245 if (gui_options.draw_city_productions ^ gtk_check_menu_item_get_active(item)) {
1248 }
1249}
1250
1251/************************************************************************/
1254static void show_city_buy_cost_callback(GtkCheckMenuItem *item,
1255 gpointer data)
1256{
1257 if (gui_options.draw_city_buycost ^ gtk_check_menu_item_get_active(item)) {
1259 }
1260}
1261
1262/************************************************************************/
1265static void show_city_trade_routes_callback(GtkCheckMenuItem *item,
1266 gpointer data)
1267{
1268 if (gui_options.draw_city_trade_routes ^ gtk_check_menu_item_get_active(item)) {
1270 }
1271}
1272
1273/************************************************************************/
1276static void show_terrain_callback(GtkCheckMenuItem *item, gpointer data)
1277{
1278 if (gui_options.draw_terrain ^ gtk_check_menu_item_get_active(item)) {
1281 }
1282}
1283
1284/************************************************************************/
1287static void show_coastline_callback(GtkCheckMenuItem *item, gpointer data)
1288{
1289 if (gui_options.draw_coastline ^ gtk_check_menu_item_get_active(item)) {
1291 }
1292}
1293
1294/************************************************************************/
1297static void show_road_rails_callback(GtkCheckMenuItem *item, gpointer data)
1298{
1299 if (gui_options.draw_roads_rails ^ gtk_check_menu_item_get_active(item)) {
1301 }
1302}
1303
1304/************************************************************************/
1307static void show_irrigation_callback(GtkCheckMenuItem *item, gpointer data)
1308{
1309 if (gui_options.draw_irrigation ^ gtk_check_menu_item_get_active(item)) {
1311 }
1312}
1313
1314/************************************************************************/
1317static void show_mine_callback(GtkCheckMenuItem *item, gpointer data)
1318{
1319 if (gui_options.draw_mines ^ gtk_check_menu_item_get_active(item)) {
1321 }
1322}
1323
1324/************************************************************************/
1327static void show_bases_callback(GtkCheckMenuItem *item, gpointer data)
1328{
1329 if (gui_options.draw_fortress_airbase ^ gtk_check_menu_item_get_active(item)) {
1331 }
1332}
1333
1334/************************************************************************/
1337static void show_resources_callback(GtkCheckMenuItem *item, gpointer data)
1338{
1339 if (gui_options.draw_specials ^ gtk_check_menu_item_get_active(item)) {
1341 }
1342}
1343
1344/************************************************************************/
1347static void show_huts_callback(GtkCheckMenuItem *item, gpointer data)
1348{
1349 if (gui_options.draw_huts ^ gtk_check_menu_item_get_active(item)) {
1351 }
1352}
1353
1354/************************************************************************/
1357static void show_pollution_callback(GtkCheckMenuItem *item, gpointer data)
1358{
1359 if (gui_options.draw_pollution ^ gtk_check_menu_item_get_active(item)) {
1361 }
1362}
1363
1364/************************************************************************/
1367static void show_cities_callback(GtkCheckMenuItem *item, gpointer data)
1368{
1369 if (gui_options.draw_cities ^ gtk_check_menu_item_get_active(item)) {
1371 }
1372}
1373
1374/************************************************************************/
1377static void show_units_callback(GtkCheckMenuItem *item, gpointer data)
1378{
1379 if (gui_options.draw_units ^ gtk_check_menu_item_get_active(item)) {
1382 }
1383}
1384
1385/************************************************************************/
1388static void show_unit_solid_bg_callback(GtkCheckMenuItem *item,
1389 gpointer data)
1390{
1391 if (gui_options.solid_color_behind_units ^ gtk_check_menu_item_get_active(item)) {
1393 }
1394}
1395
1396/************************************************************************/
1399static void show_unit_shields_callback(GtkCheckMenuItem *item,
1400 gpointer data)
1401{
1402 if (gui_options.draw_unit_shields ^ gtk_check_menu_item_get_active(item)) {
1404 }
1405}
1406
1407/************************************************************************/
1410static void show_stack_size_callback(GtkCheckMenuItem *item,
1411 gpointer data)
1412{
1413 if (gui_options.draw_unit_stack_size ^ gtk_check_menu_item_get_active(item)) {
1415 }
1416}
1417
1418/************************************************************************/
1421static void show_focus_unit_callback(GtkCheckMenuItem *item, gpointer data)
1422{
1423 if (gui_options.draw_focus_unit ^ gtk_check_menu_item_get_active(item)) {
1426 }
1427}
1428
1429/************************************************************************/
1432static void show_fog_of_war_callback(GtkCheckMenuItem *item, gpointer data)
1433{
1434 if (gui_options.draw_fog_of_war ^ gtk_check_menu_item_get_active(item)) {
1437 }
1438}
1439
1440/************************************************************************/
1443static void full_screen_callback(GtkCheckMenuItem *item, gpointer data)
1444{
1445 if (GUI_GTK_OPTION(fullscreen) ^ gtk_check_menu_item_get_active(item)) {
1446 GUI_GTK_OPTION(fullscreen) ^= 1;
1447
1449 }
1450}
1451
1452/************************************************************************/
1455static void recalc_borders_callback(GtkMenuItem *item, gpointer data)
1456{
1458}
1459
1460/************************************************************************/
1463static void toggle_fog_callback(GtkMenuItem *item, gpointer data)
1464{
1466}
1467
1468/************************************************************************/
1471static void scenario_properties_callback(GtkMenuItem *item, gpointer data)
1472{
1473 struct property_editor *pe;
1474
1478}
1479
1480/************************************************************************/
1483static void save_scenario_callback(GtkMenuItem *item, gpointer data)
1484{
1486}
1487
1488/************************************************************************/
1491static void select_single_callback(GtkMenuItem *item, gpointer data)
1492{
1493 request_unit_select(get_units_in_focus(), SELTYPE_SINGLE, SELLOC_TILE);
1494}
1495
1496/************************************************************************/
1499static void select_all_on_tile_callback(GtkMenuItem *item, gpointer data)
1500{
1501 request_unit_select(get_units_in_focus(), SELTYPE_ALL, SELLOC_TILE);
1502}
1503
1504/************************************************************************/
1507static void select_same_type_tile_callback(GtkMenuItem *item, gpointer data)
1508{
1509 request_unit_select(get_units_in_focus(), SELTYPE_SAME, SELLOC_TILE);
1510}
1511
1512/************************************************************************/
1515static void select_same_type_cont_callback(GtkMenuItem *item, gpointer data)
1516{
1517 request_unit_select(get_units_in_focus(), SELTYPE_SAME, SELLOC_CONT);
1518}
1519
1520/************************************************************************/
1523static void select_same_type_callback(GtkMenuItem *item, gpointer data)
1524{
1525 request_unit_select(get_units_in_focus(), SELTYPE_SAME, SELLOC_WORLD);
1526}
1527
1528/************************************************************************/
1531static void select_dialog_callback(GtkMenuItem *item, gpointer data)
1532{
1534}
1535
1536/************************************************************************/
1539static void unit_wait_callback(GtkMenuItem *item, gpointer data)
1540{
1541 key_unit_wait();
1542}
1543
1544/************************************************************************/
1547static void unit_done_callback(GtkMenuItem *item, gpointer data)
1548{
1549 key_unit_done();
1550}
1551
1552/************************************************************************/
1555static void unit_goto_callback(GtkMenuItem *item, gpointer data)
1556{
1557 key_unit_goto();
1558}
1559
1560/************************************************************************/
1563static void unit_goto_and_callback(GtkMenuItem *item, gpointer data)
1564{
1565 int sub_target = NO_TARGET;
1566 struct action *paction = g_object_get_data(G_OBJECT(item), "end_action");
1567
1568 fc_assert_ret(paction != NULL);
1569
1570 switch (action_get_sub_target_kind(paction)) {
1571 case ASTK_BUILDING:
1572 {
1573 struct impr_type *pbuilding = g_object_get_data(G_OBJECT(item),
1574 "end_building");
1575 fc_assert_ret(pbuilding != NULL);
1576 sub_target = improvement_number(pbuilding);
1577 }
1578 break;
1579 case ASTK_TECH:
1580 {
1581 struct advance *ptech = g_object_get_data(G_OBJECT(item),
1582 "end_tech");
1583 fc_assert_ret(ptech != NULL);
1584 sub_target = advance_number(ptech);
1585 }
1586 break;
1587 case ASTK_EXTRA:
1588 case ASTK_EXTRA_NOT_THERE:
1589 {
1590 struct extra_type *pextra = g_object_get_data(G_OBJECT(item),
1591 "end_extra");
1592 fc_assert_ret(pextra != NULL);
1593 sub_target = extra_number(pextra);
1594 }
1595 break;
1596 case ASTK_NONE:
1597 sub_target = NO_TARGET;
1598 break;
1599 case ASTK_COUNT:
1600 /* Should not exits */
1601 fc_assert(action_get_sub_target_kind(paction) != ASTK_COUNT);
1602 break;
1603 }
1604
1605 request_unit_goto(ORDER_PERFORM_ACTION, paction->id, sub_target);
1606}
1607
1608/************************************************************************/
1611static void unit_goto_city_callback(GtkMenuItem *item, gpointer data)
1612{
1613 if (get_num_units_in_focus() > 0) {
1615 }
1616}
1617
1618/************************************************************************/
1621static void unit_return_callback(GtkMenuItem *item, gpointer data)
1622{
1626}
1627
1628/************************************************************************/
1631static void unit_explore_callback(GtkMenuItem *item, gpointer data)
1632{
1634}
1635
1636/************************************************************************/
1639static void unit_patrol_callback(GtkMenuItem *item, gpointer data)
1640{
1642}
1643
1644/************************************************************************/
1647static void unit_sentry_callback(GtkMenuItem *item, gpointer data)
1648{
1650}
1651
1652/************************************************************************/
1655static void unit_unsentry_callback(GtkMenuItem *item, gpointer data)
1656{
1658}
1659
1660/************************************************************************/
1663static void unit_board_callback(GtkMenuItem *item, gpointer data)
1664{
1668}
1669
1670/************************************************************************/
1673static void unit_deboard_callback(GtkMenuItem *item, gpointer data)
1674{
1678}
1679
1680/************************************************************************/
1684 gpointer data)
1685{
1687}
1688
1689/************************************************************************/
1692static void unit_homecity_callback(GtkMenuItem *item, gpointer data)
1693{
1695}
1696
1697/************************************************************************/
1700static void unit_upgrade_callback(GtkMenuItem *item, gpointer data)
1701{
1703}
1704
1705/************************************************************************/
1708static void unit_convert_callback(GtkMenuItem *item, gpointer data)
1709{
1711}
1712
1713/************************************************************************/
1716static void unit_disband_callback(GtkMenuItem *item, gpointer data)
1717{
1719}
1720
1721/************************************************************************/
1724static void build_city_callback(GtkMenuItem *item, gpointer data)
1725{
1727 /* FIXME: this can provide different items for different units...
1728 * not good! */
1729 /* Enable the button for adding to a city in all cases, so we
1730 get an eventual error message from the server if we try. */
1734 ACTION_HELP_WONDER)) {
1735 request_unit_caravan_action(punit, ACTION_HELP_WONDER);
1736 }
1738}
1739
1740/************************************************************************/
1743static void auto_settle_callback(GtkMenuItem *action, gpointer data)
1744{
1746}
1747
1748/************************************************************************/
1751static void build_road_callback(GtkMenuItem *action, gpointer data)
1752{
1754 /* FIXME: this can provide different actions for different units...
1755 * not good! */
1757 EC_ROAD,
1759 punit);
1760 bool building_road = FALSE;
1761
1762 if (tgt != NULL
1763 && can_unit_do_activity_targeted_client(punit, ACTIVITY_GEN_ROAD, tgt)) {
1764 request_new_unit_activity_targeted(punit, ACTIVITY_GEN_ROAD, tgt);
1765 building_road = TRUE;
1766 }
1767
1768 if (!building_road && unit_can_est_trade_route_here(punit)) {
1769 request_unit_caravan_action(punit, ACTION_TRADE_ROUTE);
1770 }
1772}
1773
1774/************************************************************************/
1777static void build_irrigation_callback(GtkMenuItem *action, gpointer data)
1778{
1780}
1781
1782/************************************************************************/
1785static void cultivate_callback(GtkMenuItem *action, gpointer data)
1786{
1788}
1789
1790/************************************************************************/
1793static void build_mine_callback(GtkMenuItem *action, gpointer data)
1794{
1795 key_unit_mine();
1796}
1797
1798/************************************************************************/
1801static void plant_callback(GtkMenuItem *action, gpointer data)
1802{
1804}
1805
1806/************************************************************************/
1809static void connect_road_callback(GtkMenuItem *action, gpointer data)
1810{
1811 struct road_type *proad = road_by_gui_type(ROAD_GUI_ROAD);
1812
1813 if (proad != NULL) {
1814 struct extra_type *tgt;
1815
1816 tgt = road_extra_get(proad);
1817
1818 key_unit_connect(ACTIVITY_GEN_ROAD, tgt);
1819 }
1820}
1821
1822/************************************************************************/
1825static void connect_rail_callback(GtkMenuItem *action, gpointer data)
1826{
1827 struct road_type *prail = road_by_gui_type(ROAD_GUI_RAILROAD);
1828
1829 if (prail != NULL) {
1830 struct extra_type *tgt;
1831
1832 tgt = road_extra_get(prail);
1833
1834 key_unit_connect(ACTIVITY_GEN_ROAD, tgt);
1835 }
1836}
1837
1838/************************************************************************/
1841static void connect_maglev_callback(GtkMenuItem *action, gpointer data)
1842{
1843 struct road_type *pmaglev = road_by_gui_type(ROAD_GUI_MAGLEV);
1844
1845 if (pmaglev != NULL) {
1846 struct extra_type *tgt;
1847
1848 tgt = road_extra_get(pmaglev);
1849
1850 key_unit_connect(ACTIVITY_GEN_ROAD, tgt);
1851 }
1852}
1853
1854/************************************************************************/
1857static void connect_irrigation_callback(GtkMenuItem *action, gpointer data)
1858{
1859 struct extra_type_list *extras = extra_type_list_by_cause(EC_IRRIGATION);
1860
1861 if (extra_type_list_size(extras) > 0) {
1862 struct extra_type *pextra;
1863
1864 pextra = extra_type_list_get(extra_type_list_by_cause(EC_IRRIGATION), 0);
1865
1866 key_unit_connect(ACTIVITY_IRRIGATE, pextra);
1867 }
1868}
1869
1870/************************************************************************/
1873static void transform_terrain_callback(GtkMenuItem *action, gpointer data)
1874{
1876}
1877
1878/************************************************************************/
1881static void clean_pollution_callback(GtkMenuItem *action, gpointer data)
1882{
1884 struct extra_type *pextra;
1885
1886 pextra = prev_extra_in_tile(unit_tile(punit), ERM_CLEANPOLLUTION,
1888
1889 if (pextra != NULL) {
1890 request_new_unit_activity_targeted(punit, ACTIVITY_POLLUTION, pextra);
1891 }
1893}
1894
1895/************************************************************************/
1898static void clean_fallout_callback(GtkMenuItem *action, gpointer data)
1899{
1901}
1902
1903/************************************************************************/
1906static void build_fortress_callback(GtkMenuItem *action, gpointer data)
1907{
1909}
1910
1911/************************************************************************/
1914static void fortify_callback(GtkMenuItem *action, gpointer data)
1915{
1919}
1920
1921/************************************************************************/
1924static void build_airbase_callback(GtkMenuItem *action, gpointer data)
1925{
1927}
1928
1929/************************************************************************/
1932static void do_paradrop_callback(GtkMenuItem *action, gpointer data)
1933{
1935}
1936
1937/************************************************************************/
1940static void do_pillage_callback(GtkMenuItem *action, gpointer data)
1941{
1943}
1944
1945/************************************************************************/
1948static void diplomat_action_callback(GtkMenuItem *action, gpointer data)
1949{
1951}
1952
1953/************************************************************************/
1956static void tax_rate_callback(GtkMenuItem *action, gpointer data)
1957{
1959}
1960
1961/************************************************************************/
1964static void multiplier_callback(GtkMenuItem *action, gpointer data)
1965{
1967}
1968
1969/************************************************************************/
1972static void government_callback(GtkMenuItem *item, gpointer data)
1973{
1975}
1976
1977/************************************************************************/
1980static void base_callback(GtkMenuItem *item, gpointer data)
1981{
1982 struct extra_type *pextra = data;
1983
1985 request_new_unit_activity_targeted(punit, ACTIVITY_BASE, pextra);
1987}
1988
1989/************************************************************************/
1992static void road_callback(GtkMenuItem *item, gpointer data)
1993{
1994 struct extra_type *pextra = data;
1995
1997 request_new_unit_activity_targeted(punit, ACTIVITY_GEN_ROAD,
1998 pextra);
2000}
2001
2002/************************************************************************/
2005static void center_view_callback(GtkMenuItem *action, gpointer data)
2006{
2008}
2009
2010/************************************************************************/
2013static void report_units_callback(GtkMenuItem *action, gpointer data)
2014{
2016}
2017
2018/************************************************************************/
2021static void report_cities_callback(GtkMenuItem *action, gpointer data)
2022{
2024}
2025
2026/************************************************************************/
2029static void report_economy_callback(GtkMenuItem *action, gpointer data)
2030{
2032}
2033
2034/************************************************************************/
2037static void report_research_callback(GtkMenuItem *action, gpointer data)
2038{
2040}
2041
2042/************************************************************************/
2045static void report_spaceship_callback(GtkMenuItem *action, gpointer data)
2046{
2047 if (NULL != client.conn.playing) {
2049 }
2050}
2051
2052/************************************************************************/
2055static void menu_entry_init(GtkBuildable *item)
2056{
2057 const char *key = gtk_buildable_get_name(item);
2059
2060 if (info != NULL) {
2061 gtk_menu_item_set_label(GTK_MENU_ITEM(item),
2062 Q_(info->name));
2063 gtk_menu_item_set_use_underline(GTK_MENU_ITEM(item), TRUE);
2064 if (info->cb != NULL) {
2065 g_signal_connect(item, "activate", info->cb, NULL);
2066 }
2067
2068 if (info->accel != 0) {
2069 const char *path = gtk_menu_item_get_accel_path(GTK_MENU_ITEM(item));
2070
2071 if (path == NULL) {
2072 char buf[512];
2073
2074 fc_snprintf(buf, sizeof(buf), "<MENU>/%s", key);
2075 gtk_menu_item_set_accel_path(GTK_MENU_ITEM(item), buf);
2076 path = buf; /* Not NULL, but not usable either outside this block */
2077 }
2078
2079 if (path != NULL) {
2080 gtk_accel_map_add_entry(gtk_menu_item_get_accel_path(GTK_MENU_ITEM(item)),
2081 info->accel, info->accel_mod);
2082 }
2083 }
2084
2085 return;
2086 }
2087
2088 /* temporary naming solution */
2089 gtk_menu_item_set_label(GTK_MENU_ITEM(item), key);
2090}
2091
2092/************************************************************************/
2095static const gchar *get_ui_filename(void)
2096{
2097 static char filename[256];
2098 const char *name;
2099
2100 if ((name = getenv("FREECIV_MENUS"))
2101 || (name = fileinfoname(get_data_dirs(), "gtk3_menus.xml"))) {
2102 sz_strlcpy(filename, name);
2103 } else {
2104 log_error("Gtk menus: file definition not found");
2105 filename[0] = '\0';
2106 }
2107
2108 log_verbose("ui menu file is \"%s\".", filename);
2109 return filename;
2110}
2111
2112/************************************************************************/
2115GtkWidget *setup_menus(GtkWidget *window)
2116{
2117 GtkWidget *menubar = NULL;
2118 GError *error = NULL;
2119
2120 ui_builder = gtk_builder_new();
2121 if (!gtk_builder_add_from_file(ui_builder, get_ui_filename(), &error)) {
2122 log_error("Gtk menus: %s", error->message);
2123 g_error_free(error);
2124 } else {
2125 GSList *entries;
2126 GSList *next;
2127
2128 entries = gtk_builder_get_objects(ui_builder);
2129 next = entries;
2130
2131 while (next != NULL) {
2132 GObject *obj = next->data;
2133
2134 if (GTK_IS_MENU_ITEM(obj)) {
2135 if (!GTK_IS_SEPARATOR_MENU_ITEM(obj)) {
2136 menu_entry_init(GTK_BUILDABLE(obj));
2137 }
2138 } else if (GTK_IS_MENU(obj)) {
2139 const char *key = gtk_buildable_get_name(GTK_BUILDABLE(obj));
2140
2141 if (key[0] == '<') {
2142 GtkAccelGroup *ac_group = gtk_menu_get_accel_group(GTK_MENU(obj));
2143
2144 if (ac_group == NULL) {
2145 ac_group = gtk_accel_group_new();
2146 gtk_menu_set_accel_group(GTK_MENU(obj), ac_group);
2147 }
2148
2149 gtk_window_add_accel_group(GTK_WINDOW(window), ac_group);
2150
2151 gtk_menu_set_accel_path(GTK_MENU(obj), key);
2152 }
2153 }
2154
2155 next = next->next;
2156 }
2157
2158 g_slist_free(entries);
2159
2160 menubar = GTK_WIDGET(gtk_builder_get_object(ui_builder, "MENU"));
2161 gtk_widget_set_visible(menubar, TRUE);
2162 gtk_widget_show_all(menubar);
2163 }
2164
2165#ifndef FREECIV_DEBUG
2166 menu_entry_set_visible("RELOAD_TILESET", FALSE, FALSE);
2167#endif /* FREECIV_DEBUG */
2168
2169 return menubar;
2170}
2171
2172/************************************************************************/
2175static struct menu_entry_info *menu_entry_info_find(const char *key)
2176{
2177 int i;
2178
2179 for (i = 0; menu_entries[i].key != NULL; i++) {
2180 if (!strcmp(key, menu_entries[i].key)) {
2181 return &(menu_entries[i]);
2182 }
2183 }
2184
2185 return NULL;
2186}
2187
2188/************************************************************************/
2191static void menu_entry_set_active(const char *key,
2192 gboolean is_active)
2193{
2194 GtkCheckMenuItem *item = GTK_CHECK_MENU_ITEM(gtk_builder_get_object(ui_builder, key));
2195
2196 if (item != NULL) {
2197 gtk_check_menu_item_set_active(item, is_active);
2198 }
2199}
2200
2201/************************************************************************/
2204static void menu_entry_set_sensitive(const char *key,
2205 gboolean is_sensitive)
2206{
2207 GtkWidget *item = GTK_WIDGET(gtk_builder_get_object(ui_builder, key));
2208
2209 if (item != NULL) {
2210 gtk_widget_set_sensitive(item, is_sensitive);
2211 }
2212}
2213
2214/************************************************************************/
2218 gboolean is_sensitive)
2219{
2220 int i;
2221
2222 for (i = 0; menu_entries[i].key != NULL; i++) {
2223 if (menu_entries[i].grouping == group || group == MGROUP_ALL) {
2224 menu_entry_set_sensitive(menu_entries[i].key, is_sensitive);
2225 }
2226 }
2227}
2228
2229/************************************************************************/
2232#ifndef FREECIV_DEBUG
2233static void menu_entry_set_visible(const char *key,
2234 gboolean is_visible,
2235 gboolean is_sensitive)
2236{
2237 GtkWidget *item = GTK_WIDGET(gtk_builder_get_object(ui_builder, key));
2238
2239 if (item != NULL) {
2240 gtk_widget_set_visible(item, is_visible);
2241 gtk_widget_set_sensitive(item, is_sensitive);
2242 }
2243}
2244#endif /* FREECIV_DEBUG */
2245
2246/************************************************************************/
2249static void menus_rename(const char *key,
2250 const gchar *new_label)
2251{
2252 GtkWidget *item = GTK_WIDGET(gtk_builder_get_object(ui_builder, key));
2253
2254 if (item != NULL) {
2255 gtk_menu_item_set_label(GTK_MENU_ITEM(item), new_label);
2256 }
2257}
2258
2259/************************************************************************/
2262static GtkMenu *find_menu(const char *key)
2263{
2264 return GTK_MENU(gtk_builder_get_object(ui_builder, key));
2265}
2266
2267/************************************************************************/
2271{
2272 /* The "full" city bar (i.e. the new way of drawing the
2273 * city name), can draw the city growth even without drawing
2274 * the city name. But the old method cannot. */
2276 menu_entry_set_sensitive("SHOW_CITY_GROWTH", TRUE);
2277 menu_entry_set_sensitive("SHOW_CITY_TRADE_ROUTES", TRUE);
2278 } else {
2280 menu_entry_set_sensitive("SHOW_CITY_TRADE_ROUTES",
2282 }
2283
2284 menu_entry_set_sensitive("SHOW_CITY_BUY_COST",
2287 menu_entry_set_sensitive("SHOW_UNIT_SOLID_BG",
2289 menu_entry_set_sensitive("SHOW_UNIT_SHIELDS",
2291 menu_entry_set_sensitive("SHOW_STACK_SIZE",
2293 menu_entry_set_sensitive("SHOW_FOCUS_UNIT", !gui_options.draw_units);
2294}
2295
2296/************************************************************************/
2302static const char *get_tile_change_menu_text(struct tile *ptile,
2303 enum unit_activity activity)
2304{
2305 struct tile *newtile = tile_virtual_new(ptile);
2306 const char *text;
2307
2308 tile_apply_activity(newtile, activity, NULL);
2309 text = tile_get_info_text(newtile, FALSE, 0);
2310 tile_virtual_destroy(newtile);
2311 return text;
2312}
2313
2314/************************************************************************/
2318{
2319 struct unit_list *punits = NULL;
2320 bool units_all_same_tile = TRUE, units_all_same_type = TRUE;
2321 GtkMenu *menu;
2322 char acttext[128], irrtext[128], mintext[128], transtext[128];
2323 char cultext[128], plantext[128];
2324 struct terrain *pterrain;
2325 bool conn_possible;
2326 struct road_type *proad;
2327 struct extra_type_list *extras;
2328
2329 if (ui_builder == NULL || !can_client_change_view()) {
2330 return;
2331 }
2332
2333 if (get_num_units_in_focus() > 0) {
2334 const struct tile *ptile = NULL;
2335 const struct unit_type *ptype = NULL;
2336 punits = get_units_in_focus();
2337 unit_list_iterate(punits, punit) {
2338 fc_assert((ptile==NULL) == (ptype==NULL));
2339 if (ptile || ptype) {
2340 if (unit_tile(punit) != ptile) {
2341 units_all_same_tile = FALSE;
2342 }
2343 if (unit_type_get(punit) != ptype) {
2344 units_all_same_type = FALSE;
2345 }
2346 } else {
2347 ptile = unit_tile(punit);
2348 ptype = unit_type_get(punit);
2349 }
2351 }
2352
2355 && !editor_is_active());
2357 && !editor_is_active() && punits != NULL);
2358
2360 menu_entry_set_sensitive("EDIT_MODE",
2363
2364 {
2365 char road_buf[500];
2366
2367 proad = road_by_gui_type(ROAD_GUI_ROAD);
2368 if (proad != NULL) {
2369 /* TRANS: Connect with some road type (Road/Railroad) */
2370 snprintf(road_buf, sizeof(road_buf), _("Connect With %s"),
2372 menus_rename("CONNECT_ROAD", road_buf);
2373 }
2374
2375 proad = road_by_gui_type(ROAD_GUI_RAILROAD);
2376 if (proad != NULL) {
2377 snprintf(road_buf, sizeof(road_buf), _("Connect With %s"),
2379 menus_rename("CONNECT_RAIL", road_buf);
2380 }
2381
2382 proad = road_by_gui_type(ROAD_GUI_MAGLEV);
2383 if (proad != NULL) {
2384 snprintf(road_buf, sizeof(road_buf), _("Connect With %s"),
2386 menus_rename("CONNECT_MAGLEV", road_buf);
2387 }
2388 }
2389
2390 menu_entry_set_sensitive("REPORT_SPACESHIP",
2391 client_player() != NULL && client_player()->spaceship.state != SSHIP_NONE);
2392
2393 if (!can_client_issue_orders()) {
2394 return;
2395 }
2396
2397 /* Set government sensitivity. */
2398 if ((menu = find_menu("<MENU>/GOVERNMENT"))) {
2399 GList *list, *iter;
2400 struct government *pgov;
2401
2402 list = gtk_container_get_children(GTK_CONTAINER(menu));
2403 for (iter = list; NULL != iter; iter = g_list_next(iter)) {
2404 pgov = g_object_get_data(G_OBJECT(iter->data), "government");
2405 if (NULL != pgov) {
2406 gtk_widget_set_sensitive(GTK_WIDGET(iter->data),
2408 pgov));
2409 } else {
2410 /* Revolution without target government */
2411 gtk_widget_set_sensitive(GTK_WIDGET(iter->data),
2413 }
2414 }
2415 g_list_free(list);
2416 }
2417
2418 if (!punits) {
2419 return;
2420 }
2421
2422 /* Remaining part of this function: Update Unit, Work, and Combat menus */
2423
2424 /* Set base sensitivity. */
2425 if ((menu = find_menu("<MENU>/BUILD_BASE"))) {
2426 GList *list, *iter;
2427 struct extra_type *pextra;
2428
2429 list = gtk_container_get_children(GTK_CONTAINER(menu));
2430 for (iter = list; NULL != iter; iter = g_list_next(iter)) {
2431 pextra = g_object_get_data(G_OBJECT(iter->data), "base");
2432 if (NULL != pextra) {
2433 gtk_widget_set_sensitive(GTK_WIDGET(iter->data),
2435 ACTIVITY_BASE,
2436 pextra));
2437 }
2438 }
2439 g_list_free(list);
2440 }
2441
2442 /* Set road sensitivity. */
2443 if ((menu = find_menu("<MENU>/BUILD_PATH"))) {
2444 GList *list, *iter;
2445 struct extra_type *pextra;
2446
2447 list = gtk_container_get_children(GTK_CONTAINER(menu));
2448 for (iter = list; NULL != iter; iter = g_list_next(iter)) {
2449 pextra = g_object_get_data(G_OBJECT(iter->data), "road");
2450 if (NULL != pextra) {
2451 gtk_widget_set_sensitive(GTK_WIDGET(iter->data),
2453 ACTIVITY_GEN_ROAD,
2454 pextra));
2455 }
2456 }
2457 g_list_free(list);
2458 }
2459
2460 /* Set Go to and... action visibility. */
2461 if ((menu = find_menu("<MENU>/GOTO_AND"))) {
2462 GList *list, *iter;
2463 struct action *paction;
2464
2465 bool can_do_something = FALSE;
2466
2467 /* Enable a menu item if it is theoretically possible that one of the
2468 * selected units can perform it. Checking if the action can be performed
2469 * at the current tile is pointless since it should be performed at the
2470 * target tile. */
2471 list = gtk_container_get_children(GTK_CONTAINER(menu));
2472 for (iter = list; NULL != iter; iter = g_list_next(iter)) {
2473 paction = g_object_get_data(G_OBJECT(iter->data), "end_action");
2474 if (NULL != paction) {
2476 paction->id, TRUE)) {
2477 gtk_widget_set_visible(GTK_WIDGET(iter->data), TRUE);
2478 gtk_widget_set_sensitive(GTK_WIDGET(iter->data), TRUE);
2479 can_do_something = TRUE;
2480 } else {
2481 gtk_widget_set_visible(GTK_WIDGET(iter->data), FALSE);
2482 gtk_widget_set_sensitive(GTK_WIDGET(iter->data), FALSE);
2483 }
2484 }
2485 }
2486 g_list_free(list);
2487
2488 /* Only sensitive if an action may be possible. */
2489 menu_entry_set_sensitive("MENU_GOTO_AND", can_do_something);
2490 }
2491
2492 /* Enable the button for adding to a city in all cases, so we
2493 * get an eventual error message from the server if we try. */
2494 menu_entry_set_sensitive("BUILD_CITY",
2495 (can_units_do_on_map(&(wld.map), punits,
2497 || can_units_do_on_map(&(wld.map), punits,
2499 menu_entry_set_sensitive("BUILD_ROAD",
2500 (can_units_do_any_road(&(wld.map), punits)
2501 || can_units_do(punits,
2503 menu_entry_set_sensitive("BUILD_IRRIGATION",
2504 can_units_do_activity_client(punits, ACTIVITY_IRRIGATE));
2505 menu_entry_set_sensitive("CULTIVATE",
2506 can_units_do_activity_client(punits, ACTIVITY_CULTIVATE));
2507 menu_entry_set_sensitive("BUILD_MINE",
2508 can_units_do_activity_client(punits, ACTIVITY_MINE));
2510 can_units_do_activity_client(punits, ACTIVITY_PLANT));
2511 menu_entry_set_sensitive("TRANSFORM_TERRAIN",
2512 can_units_do_activity_client(punits, ACTIVITY_TRANSFORM));
2513 menu_entry_set_sensitive("FORTIFY",
2515 ACTIVITY_FORTIFYING));
2516 menu_entry_set_sensitive("BUILD_FORTRESS",
2517 can_units_do_base_gui(punits, BASE_GUI_FORTRESS));
2518 menu_entry_set_sensitive("BUILD_AIRBASE",
2519 can_units_do_base_gui(punits, BASE_GUI_AIRBASE));
2520 menu_entry_set_sensitive("CLEAN_POLLUTION",
2521 can_units_do_activity_client(punits, ACTIVITY_POLLUTION));
2522 menu_entry_set_sensitive("CLEAN_FALLOUT",
2523 can_units_do_activity_client(punits, ACTIVITY_FALLOUT));
2524 menu_entry_set_sensitive("UNIT_SENTRY",
2525 can_units_do_activity_client(punits, ACTIVITY_SENTRY));
2526 menu_entry_set_sensitive("DO_PARADROP",
2528 /* FIXME: should conditionally rename "Pillage" to "Pillage..." in cases where
2529 * selecting the command results in a dialog box listing options of what to pillage */
2530 menu_entry_set_sensitive("DO_PILLAGE",
2531 can_units_do_activity_client(punits, ACTIVITY_PILLAGE));
2532 menu_entry_set_sensitive("UNIT_DISBAND",
2533 units_can_do_action(punits, ACTION_DISBAND_UNIT,
2534 TRUE));
2535 menu_entry_set_sensitive("UNIT_UPGRADE",
2536 units_can_upgrade(&(wld.map), punits));
2537 /* "UNIT_CONVERT" dealt with below */
2538 menu_entry_set_sensitive("UNIT_HOMECITY",
2540 menu_entry_set_sensitive("UNIT_UNLOAD_TRANSPORTER",
2541 units_are_occupied(punits));
2542 menu_entry_set_sensitive("UNIT_BOARD",
2543 units_can_load(punits));
2544 menu_entry_set_sensitive("UNIT_DEBOARD",
2545 units_can_unload(punits));
2546 menu_entry_set_sensitive("UNIT_UNSENTRY",
2548 ACTIVITY_SENTRY));
2549 menu_entry_set_sensitive("AUTO_SETTLER",
2551 menu_entry_set_sensitive("UNIT_EXPLORE",
2552 can_units_do_activity_client(punits, ACTIVITY_EXPLORE));
2553
2554 proad = road_by_gui_type(ROAD_GUI_ROAD);
2555 if (proad != NULL) {
2556 struct extra_type *tgt;
2557
2558 tgt = road_extra_get(proad);
2559
2560 conn_possible = can_units_do_connect(punits, ACTIVITY_GEN_ROAD, tgt);
2561 } else {
2562 conn_possible = FALSE;
2563 }
2564 menu_entry_set_sensitive("CONNECT_ROAD", conn_possible);
2565
2566 proad = road_by_gui_type(ROAD_GUI_RAILROAD);
2567 if (proad != NULL) {
2568 struct extra_type *tgt;
2569
2570 tgt = road_extra_get(proad);
2571
2572 conn_possible = can_units_do_connect(punits, ACTIVITY_GEN_ROAD, tgt);
2573 } else {
2574 conn_possible = FALSE;
2575 }
2576 menu_entry_set_sensitive("CONNECT_RAIL", conn_possible);
2577
2578 proad = road_by_gui_type(ROAD_GUI_MAGLEV);
2579 if (proad != NULL) {
2580 struct extra_type *tgt;
2581
2582 tgt = road_extra_get(proad);
2583
2584 conn_possible = can_units_do_connect(punits, ACTIVITY_GEN_ROAD, tgt);
2585 } else {
2586 conn_possible = FALSE;
2587 }
2588 menu_entry_set_sensitive("CONNECT_MAGLEV", conn_possible);
2589
2590 extras = extra_type_list_by_cause(EC_IRRIGATION);
2591
2592 if (extra_type_list_size(extras) > 0) {
2593 struct extra_type *tgt;
2594
2595 tgt = extra_type_list_get(extras, 0);
2596 conn_possible = can_units_do_connect(punits, ACTIVITY_IRRIGATE, tgt);
2597 } else {
2598 conn_possible = FALSE;
2599 }
2600 menu_entry_set_sensitive("CONNECT_IRRIGATION", conn_possible);
2601
2602 menu_entry_set_sensitive("DIPLOMAT_ACTION",
2604
2605 if (units_can_do_action(punits, ACTION_HELP_WONDER, TRUE)) {
2606 menus_rename("BUILD_CITY",
2607 action_get_ui_name_mnemonic(ACTION_HELP_WONDER, "_"));
2608 } else {
2609 bool city_on_tile = FALSE;
2610
2611 /* FIXME: this overloading doesn't work well with multiple focus
2612 * units. */
2613 unit_list_iterate(punits, punit) {
2614 if (tile_city(unit_tile(punit))) {
2615 city_on_tile = TRUE;
2616 break;
2617 }
2619
2620 if (city_on_tile && units_can_do_action(punits, ACTION_JOIN_CITY,
2621 TRUE)) {
2622 menus_rename("BUILD_CITY",
2623 action_get_ui_name_mnemonic(ACTION_JOIN_CITY, "_"));
2624 } else {
2625 /* refresh default order */
2626 menus_rename("BUILD_CITY",
2627 action_get_ui_name_mnemonic(ACTION_FOUND_CITY, "_"));
2628 }
2629 }
2630
2631 if (units_can_do_action(punits, ACTION_TRADE_ROUTE, TRUE)) {
2632 menus_rename("BUILD_ROAD",
2633 action_get_ui_name_mnemonic(ACTION_TRADE_ROUTE, "_"));
2634 } else if (units_have_type_flag(punits, UTYF_SETTLERS, TRUE)) {
2635 char road_item[500];
2636 struct extra_type *pextra = NULL;
2637
2638 /* FIXME: this overloading doesn't work well with multiple focus
2639 * units. */
2640 unit_list_iterate(punits, punit) {
2641 pextra = next_extra_for_tile(unit_tile(punit), EC_ROAD,
2643 if (pextra != NULL) {
2644 break;
2645 }
2647
2648 if (pextra != NULL) {
2649 /* TRANS: Build road of specific type (Road/Railroad/Maglev) */
2650 snprintf(road_item, sizeof(road_item), _("Build %s"),
2651 extra_name_translation(pextra));
2652 menus_rename("BUILD_ROAD", road_item);
2653 }
2654 } else {
2655 menus_rename("BUILD_ROAD", _("Build _Road"));
2656 }
2657
2658 if (units_all_same_type) {
2659 struct unit *punit = unit_list_get(punits, 0);
2660 const struct unit_type *to_unittype =
2662 if (to_unittype) {
2663 /* TRANS: %s is a unit type. */
2664 fc_snprintf(acttext, sizeof(acttext), _("Upgr_ade to %s"),
2667 unit_type_get(punit))));
2668 } else {
2669 acttext[0] = '\0';
2670 }
2671 } else {
2672 acttext[0] = '\0';
2673 }
2674 if ('\0' != acttext[0]) {
2675 menus_rename("UNIT_UPGRADE", acttext);
2676 } else {
2677 menus_rename("UNIT_UPGRADE", _("Upgr_ade"));
2678 }
2679
2680 if (units_can_convert(&(wld.map), punits)) {
2681 menu_entry_set_sensitive("UNIT_CONVERT", TRUE);
2682 if (units_all_same_type) {
2683 struct unit *punit = unit_list_get(punits, 0);
2684
2685 /* TRANS: %s is a unit type. */
2686 fc_snprintf(acttext, sizeof(acttext), _("C_onvert to %s"),
2688 } else {
2689 acttext[0] = '\0';
2690 }
2691 } else {
2692 menu_entry_set_sensitive("UNIT_CONVERT", FALSE);
2693 acttext[0] = '\0';
2694 }
2695 if ('\0' != acttext[0]) {
2696 menus_rename("UNIT_CONVERT", acttext);
2697 } else {
2698 menus_rename("UNIT_CONVERT", _("C_onvert"));
2699 }
2700
2701 if (units_all_same_tile) {
2702 struct unit *first = unit_list_get(punits, 0);
2703
2704 pterrain = tile_terrain(unit_tile(first));
2705
2706 if (units_have_type_flag(punits, UTYF_SETTLERS, TRUE)) {
2707 struct extra_type *pextra = NULL;
2708
2709 /* FIXME: this overloading doesn't work well with multiple focus
2710 * units. */
2711 unit_list_iterate(punits, punit) {
2712 pextra = next_extra_for_tile(unit_tile(punit), EC_IRRIGATION,
2714 if (pextra != NULL) {
2715 break;
2716 }
2718
2719 if (pextra != NULL) {
2720 /* TRANS: Build irrigation of specific type */
2721 snprintf(irrtext, sizeof(irrtext), _("Build %s"),
2722 extra_name_translation(pextra));
2723 } else {
2724 sz_strlcpy(irrtext, _("Build _Irrigation"));
2725 }
2726 } else {
2727 sz_strlcpy(irrtext, _("Build _Irrigation"));
2728 }
2729
2730 if (pterrain->cultivate_result != T_NONE) {
2731 fc_snprintf(cultext, sizeof(cultext), _("Change to %s"),
2733 ACTIVITY_CULTIVATE));
2734 } else {
2735 sz_strlcpy(cultext, _("_Cultivate"));
2736 }
2737
2738 if (units_have_type_flag(punits, UTYF_SETTLERS, TRUE)) {
2739 struct extra_type *pextra = NULL;
2740
2741 /* FIXME: this overloading doesn't work well with multiple focus
2742 * units. */
2743 unit_list_iterate(punits, punit) {
2744 pextra = next_extra_for_tile(unit_tile(punit), EC_MINE,
2746 if (pextra != NULL) {
2747 break;
2748 }
2750
2751 if (pextra != NULL) {
2752 /* TRANS: Build mine of specific type */
2753 snprintf(mintext, sizeof(mintext), _("Build %s"),
2754 extra_name_translation(pextra));
2755 } else {
2756 sz_strlcpy(mintext, _("Build _Mine"));
2757 }
2758 } else {
2759 sz_strlcpy(mintext, _("Build _Mine"));
2760 }
2761
2762 if (pterrain->plant_result != T_NONE) {
2763 fc_snprintf(plantext, sizeof(plantext), _("Change to %s"),
2764 get_tile_change_menu_text(unit_tile(first), ACTIVITY_PLANT));
2765 } else {
2766 sz_strlcpy(plantext, _("_Plant"));
2767 }
2768
2769 if (pterrain->transform_result != T_NONE
2770 && pterrain->transform_result != pterrain) {
2771 fc_snprintf(transtext, sizeof(transtext), _("Transf_orm to %s"),
2773 ACTIVITY_TRANSFORM));
2774 } else {
2775 sz_strlcpy(transtext, _("Transf_orm Terrain"));
2776 }
2777 } else {
2778 sz_strlcpy(irrtext, _("Build _Irrigation"));
2779 sz_strlcpy(cultext, _("_Cultivate"));
2780 sz_strlcpy(mintext, _("Build _Mine"));
2781 sz_strlcpy(plantext, _("_Plant"));
2782 sz_strlcpy(transtext, _("Transf_orm Terrain"));
2783 }
2784
2785 menus_rename("BUILD_IRRIGATION", irrtext);
2786 menus_rename("CULTIVATE", cultext);
2787 menus_rename("BUILD_MINE", mintext);
2788 menus_rename("PLANT", plantext);
2789 menus_rename("TRANSFORM_TERRAIN", transtext);
2790 menus_rename("UNIT_HOMECITY",
2791 action_get_ui_name_mnemonic(ACTION_HOME_CITY, "_"));
2792}
2793
2794/************************************************************************/
2797static void menu_unit_goto_and_add_accel(GtkWidget *item, action_id act_id,
2798 const guint accel_key,
2799 const GdkModifierType accel_mods)
2800{
2801 const char *path = gtk_menu_item_get_accel_path(GTK_MENU_ITEM(item));
2802
2803 if (path == NULL) {
2804 char buf[MAX_LEN_NAME + sizeof("<MENU>/GOTO_AND/")];
2805
2806 fc_snprintf(buf, sizeof(buf), "<MENU>/GOTO_AND/%s",
2807 action_id_rule_name(act_id));
2808 gtk_menu_item_set_accel_path(GTK_MENU_ITEM(item), buf);
2809 path = buf; /* Not NULL, but not usable either outside this block */
2810 }
2811
2812 if (path != NULL) {
2813 gtk_accel_map_add_entry(gtk_menu_item_get_accel_path(GTK_MENU_ITEM(item)),
2814 accel_key, accel_mods);
2815 }
2816}
2817
2818/************************************************************************/
2821static void menu_remove_previous_entries(GtkMenu *menu)
2822{
2823 GList *list, *iter;
2824 GtkWidget *sub_menu;
2825
2826 list = gtk_container_get_children(GTK_CONTAINER(menu));
2827 for (iter = list; NULL != iter; iter = g_list_next(iter)) {
2828 if ((sub_menu = gtk_menu_item_get_submenu(iter->data)) != NULL) {
2829 menu_remove_previous_entries(GTK_MENU(sub_menu));
2830 gtk_widget_destroy(sub_menu);
2831 }
2832 gtk_widget_destroy(GTK_WIDGET(iter->data));
2833 }
2834 g_list_free(list);
2835}
2836
2837/************************************************************************/
2842{
2843 GtkMenu *menu;
2844
2845 if (ui_builder == NULL) {
2846 return;
2847 }
2848
2849 menu_entry_set_sensitive("GAME_SAVE_AS",
2851 && C_S_RUNNING <= client_state());
2852 menu_entry_set_sensitive("GAME_SAVE",
2854 && C_S_RUNNING <= client_state());
2855
2856 menu_entry_set_active("SAVE_OPTIONS_ON_EXIT",
2859
2862
2863 if (!can_client_change_view()) {
2865
2866 return;
2867 }
2868
2869 menus_rename("BUILD_FORTRESS", Q_(terrain_control.gui_type_base0));
2870 menus_rename("BUILD_AIRBASE", Q_(terrain_control.gui_type_base1));
2871
2872 if ((menu = find_menu("<MENU>/GOVERNMENT"))) {
2873 GList *list, *iter;
2874 GtkWidget *item;
2875 char buf[256];
2876
2877 /* Remove previous government entries. */
2878 list = gtk_container_get_children(GTK_CONTAINER(menu));
2879 for (iter = list; NULL != iter; iter = g_list_next(iter)) {
2880 if (g_object_get_data(G_OBJECT(iter->data), "government") != NULL
2881 || GTK_IS_SEPARATOR_MENU_ITEM(iter->data)) {
2882 gtk_widget_destroy(GTK_WIDGET(iter->data));
2883 }
2884 }
2885 g_list_free(list);
2886
2887 /* Add new government entries. */
2888 item = gtk_separator_menu_item_new();
2889 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
2890 gtk_widget_show(item);
2891
2894 struct sprite *gsprite;
2895
2896 /* TRANS: %s is a government name */
2897 fc_snprintf(buf, sizeof(buf), _("%s..."),
2899 item = gtk_image_menu_item_new_with_label(buf);
2900 g_object_set_data(G_OBJECT(item), "government", g);
2901
2902 if ((gsprite = get_government_sprite(tileset, g))) {
2903 GtkWidget *image;
2904 GdkPixbuf *pb = sprite_get_pixbuf(gsprite);
2905
2906 image = gtk_image_new_from_pixbuf(pb);
2907 g_object_unref(pb);
2908 gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item), image);
2909 gtk_image_menu_item_set_always_show_image(GTK_IMAGE_MENU_ITEM(item), TRUE);
2910 gtk_widget_show(image);
2911 }
2912
2913 g_signal_connect(item, "activate",
2914 G_CALLBACK(government_callback), g);
2915 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
2916 gtk_widget_show(item);
2917 }
2919 }
2920
2921 if ((menu = find_menu("<MENU>/BUILD_BASE"))) {
2922 GList *list, *iter;
2923 GtkWidget *item;
2924
2925 /* Remove previous base entries. */
2926 list = gtk_container_get_children(GTK_CONTAINER(menu));
2927 for (iter = list; NULL != iter; iter = g_list_next(iter)) {
2928 gtk_widget_destroy(GTK_WIDGET(iter->data));
2929 }
2930 g_list_free(list);
2931
2932 /* Add new base entries. */
2933 extra_type_by_cause_iterate(EC_BASE, pextra) {
2934 if (pextra->buildable) {
2935 item = gtk_menu_item_new_with_label(extra_name_translation(pextra));
2936 g_object_set_data(G_OBJECT(item), "base", pextra);
2937 g_signal_connect(item, "activate", G_CALLBACK(base_callback), pextra);
2938 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
2939 gtk_widget_show(item);
2940 }
2942 }
2943
2944 if ((menu = find_menu("<MENU>/BUILD_PATH"))) {
2945 GList *list, *iter;
2946 GtkWidget *item;
2947
2948 /* Remove previous road entries. */
2949 list = gtk_container_get_children(GTK_CONTAINER(menu));
2950 for (iter = list; NULL != iter; iter = g_list_next(iter)) {
2951 gtk_widget_destroy(GTK_WIDGET(iter->data));
2952 }
2953 g_list_free(list);
2954
2955 /* Add new road entries. */
2956 extra_type_by_cause_iterate(EC_ROAD, pextra) {
2957 if (pextra->buildable) {
2958 item = gtk_menu_item_new_with_label(extra_name_translation(pextra));
2959 g_object_set_data(G_OBJECT(item), "road", pextra);
2960 g_signal_connect(item, "activate", G_CALLBACK(road_callback), pextra);
2961 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
2962 gtk_widget_show(item);
2963 }
2965 }
2966
2967 /* Initialize the Go to and... actions. */
2968 if ((menu = find_menu("<MENU>/GOTO_AND"))) {
2969 GtkWidget *item;
2970 int tgt_kind_group;
2971
2972 /* Remove previous action entries. */
2974
2975 /* Add the new action entries grouped by target kind. */
2976 for (tgt_kind_group = 0; tgt_kind_group < ATK_COUNT; tgt_kind_group++) {
2977 action_iterate(act_id) {
2978 struct action *paction = action_by_number(act_id);
2979
2980 if (action_id_get_actor_kind(act_id) != AAK_UNIT) {
2981 /* This action isn't performed by a unit. */
2982 continue;
2983 }
2984
2985 if (action_id_get_target_kind(act_id) != tgt_kind_group) {
2986 /* Wrong group. */
2987 continue;
2988 }
2989
2990 /* Create and add the menu item. It will be hidden or shown based on
2991 * unit type. */
2992 item = gtk_menu_item_new_with_mnemonic(
2993 action_get_ui_name_mnemonic(act_id, "_"));
2994 g_object_set_data(G_OBJECT(item), "end_action", paction);
2995
2996 if (action_id_has_complex_target(act_id)) {
2997 GtkWidget *sub_target_menu = gtk_menu_new();
2998
2999#define CREATE_SUB_ITEM(_sub_target_, _sub_target_key_, _sub_target_name_) \
3000 GtkWidget *sub_item = gtk_menu_item_new_with_label(_sub_target_name_); \
3001 g_object_set_data(G_OBJECT(sub_item), "end_action", paction); \
3002 g_object_set_data(G_OBJECT(sub_item), _sub_target_key_, _sub_target_); \
3003 g_signal_connect(sub_item, "activate", \
3004 G_CALLBACK(unit_goto_and_callback), paction); \
3005 gtk_menu_shell_append(GTK_MENU_SHELL(sub_target_menu), sub_item); \
3006 gtk_widget_show(sub_item);
3007
3008 switch (action_get_sub_target_kind(paction)) {
3009 case ASTK_BUILDING:
3010 improvement_iterate(pimpr) {
3011 CREATE_SUB_ITEM(pimpr, "end_building",
3014 break;
3015 case ASTK_TECH:
3016 advance_iterate(A_FIRST, ptech) {
3017 CREATE_SUB_ITEM(ptech, "end_tech",
3020 break;
3021 case ASTK_EXTRA:
3022 case ASTK_EXTRA_NOT_THERE:
3023 extra_type_iterate(pextra) {
3024 if (!(action_creates_extra(paction, pextra)
3025 || action_removes_extra(paction, pextra))) {
3026 /* Not relevant */
3027 continue;
3028 }
3029 CREATE_SUB_ITEM(pextra, "end_extra",
3030 extra_name_translation(pextra));
3032 break;
3033 case ASTK_NONE:
3034 /* Should not be here. */
3035 fc_assert(action_get_sub_target_kind(paction) != ASTK_NONE);
3036 break;
3037 case ASTK_COUNT:
3038 /* Should not exits */
3039 fc_assert(action_get_sub_target_kind(paction) != ASTK_COUNT);
3040 break;
3041 }
3042
3043#undef CREATE_SUB_ITEM
3044
3045 gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), sub_target_menu);
3046 } else {
3047 g_signal_connect(item, "activate",
3048 G_CALLBACK(unit_goto_and_callback), paction);
3049
3050#define ADD_OLD_ACCELERATOR(wanted_action_id, accel_key, accel_mods) \
3051 if (act_id == wanted_action_id) { \
3052 menu_unit_goto_and_add_accel(item, act_id, accel_key, accel_mods); \
3053 }
3054
3055 /* Add the keyboard shortcuts for "Go to and..." menu items that
3056 * existed independently before the "Go to and..." menu arrived.
3057 */
3058 ADD_OLD_ACCELERATOR(ACTION_FOUND_CITY, GDK_KEY_b, GDK_SHIFT_MASK);
3059 ADD_OLD_ACCELERATOR(ACTION_JOIN_CITY, GDK_KEY_j, GDK_SHIFT_MASK);
3060 ADD_OLD_ACCELERATOR(ACTION_NUKE, GDK_KEY_n, GDK_SHIFT_MASK);
3061 }
3062
3063 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
3064 gtk_widget_show(item);
3066 }
3067 }
3068
3071
3072 menu_entry_set_sensitive("TAX_RATE",
3075 menu_entry_set_sensitive("POLICIES",
3076 multiplier_count() > 0);
3077
3078 menu_entry_set_active("SHOW_CITY_OUTLINES",
3080 menu_entry_set_active("SHOW_CITY_OUTPUT",
3082 menu_entry_set_active("SHOW_MAP_GRID",
3084 menu_entry_set_active("SHOW_NATIONAL_BORDERS",
3086 menu_entry_set_sensitive("SHOW_NATIONAL_BORDERS",
3088 menu_entry_set_active("SHOW_NATIVE_TILES",
3090 menu_entry_set_active("SHOW_CITY_FULL_BAR",
3092 menu_entry_set_active("SHOW_CITY_NAMES",
3094 menu_entry_set_active("SHOW_CITY_GROWTH",
3096 menu_entry_set_active("SHOW_CITY_PRODUCTIONS",
3098 menu_entry_set_active("SHOW_CITY_BUY_COST",
3100 menu_entry_set_active("SHOW_CITY_TRADE_ROUTES",
3102 menu_entry_set_active("SHOW_TERRAIN",
3104 menu_entry_set_active("SHOW_COASTLINE",
3106 menu_entry_set_active("SHOW_PATHS",
3108 menu_entry_set_active("SHOW_IRRIGATION",
3110 menu_entry_set_active("SHOW_MINES",
3112 menu_entry_set_active("SHOW_BASES",
3114 menu_entry_set_active("SHOW_RESOURCES",
3116 menu_entry_set_active("SHOW_HUTS",
3118 menu_entry_set_active("SHOW_POLLUTION",
3120 menu_entry_set_active("SHOW_CITIES",
3122 menu_entry_set_active("SHOW_UNITS",
3124 menu_entry_set_active("SHOW_UNIT_SOLID_BG",
3126 menu_entry_set_active("SHOW_UNIT_SHIELDS",
3128 menu_entry_set_active("SHOW_STACK_SIZE",
3130 menu_entry_set_active("SHOW_FOCUS_UNIT",
3132 menu_entry_set_active("SHOW_FOG_OF_WAR",
3134
3136
3137 menu_entry_set_active("FULL_SCREEN", GUI_GTK_OPTION(fullscreen));
3138}
3139
3140/**************************************************************************
3141 Free resources allocated by the menu system.
3142**************************************************************************/
3143void menus_free(void)
3144{
3145 if (ui_builder != NULL) {
3146 g_object_unref(ui_builder);
3147 ui_builder = NULL;
3148 }
3149}
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)
GdkPixbuf * sprite_get_pixbuf(struct sprite *sprite)
Definition sprite.c:402
bool request_transport(struct unit *cargo, struct tile *ptile)
void popup_worklists_report(void)
Definition wldlg.c:286
menu_entry_grouping
Definition menu.c:80
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
struct sprite * get_government_sprite(const struct tileset *t, const struct government *gov)
Definition tilespec.c:6504
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