1 #ifndef CORE_HOTKEY_CONFIG_H
2 #define CORE_HOTKEY_CONFIG_H
3 
4 #include "input/keys.h"
5 
6 typedef enum {
7     HOTKEY_ARROW_UP,
8     HOTKEY_ARROW_DOWN,
9     HOTKEY_ARROW_LEFT,
10     HOTKEY_ARROW_RIGHT,
11     HOTKEY_TOGGLE_PAUSE,
12     HOTKEY_TOGGLE_OVERLAY,
13     HOTKEY_CYCLE_LEGION,
14     HOTKEY_INCREASE_GAME_SPEED,
15     HOTKEY_DECREASE_GAME_SPEED,
16     HOTKEY_ROTATE_MAP_LEFT,
17     HOTKEY_ROTATE_MAP_RIGHT,
18     HOTKEY_BUILD_CLEAR_LAND,
19     HOTKEY_BUILD_VACANT_HOUSE,
20     HOTKEY_BUILD_ROAD,
21     HOTKEY_BUILD_PLAZA,
22     HOTKEY_BUILD_GARDENS,
23     HOTKEY_BUILD_PREFECTURE,
24     HOTKEY_BUILD_ENGINEERS_POST,
25     HOTKEY_BUILD_DOCTOR,
26     HOTKEY_BUILD_GRANARY,
27     HOTKEY_BUILD_WAREHOUSE,
28     HOTKEY_BUILD_MARKET,
29     HOTKEY_BUILD_WALL,
30     HOTKEY_BUILD_GATEHOUSE,
31     HOTKEY_BUILD_RESERVOIR,
32     HOTKEY_BUILD_AQUEDUCT,
33     HOTKEY_BUILD_FOUNTAIN,
34     HOTKEY_SHOW_ADVISOR_LABOR,
35     HOTKEY_SHOW_ADVISOR_MILITARY,
36     HOTKEY_SHOW_ADVISOR_IMPERIAL,
37     HOTKEY_SHOW_ADVISOR_RATINGS,
38     HOTKEY_SHOW_ADVISOR_TRADE,
39     HOTKEY_SHOW_ADVISOR_POPULATION,
40     HOTKEY_SHOW_ADVISOR_HEALTH,
41     HOTKEY_SHOW_ADVISOR_EDUCATION,
42     HOTKEY_SHOW_ADVISOR_ENTERTAINMENT,
43     HOTKEY_SHOW_ADVISOR_RELIGION,
44     HOTKEY_SHOW_ADVISOR_FINANCIAL,
45     HOTKEY_SHOW_ADVISOR_CHIEF,
46     HOTKEY_SHOW_OVERLAY_WATER,
47     HOTKEY_SHOW_OVERLAY_FIRE,
48     HOTKEY_SHOW_OVERLAY_DAMAGE,
49     HOTKEY_SHOW_OVERLAY_CRIME,
50     HOTKEY_SHOW_OVERLAY_PROBLEMS,
51     HOTKEY_EDITOR_TOGGLE_BATTLE_INFO,
52     HOTKEY_LOAD_FILE,
53     HOTKEY_SAVE_FILE,
54     HOTKEY_GO_TO_BOOKMARK_1,
55     HOTKEY_GO_TO_BOOKMARK_2,
56     HOTKEY_GO_TO_BOOKMARK_3,
57     HOTKEY_GO_TO_BOOKMARK_4,
58     HOTKEY_SET_BOOKMARK_1,
59     HOTKEY_SET_BOOKMARK_2,
60     HOTKEY_SET_BOOKMARK_3,
61     HOTKEY_SET_BOOKMARK_4,
62     HOTKEY_CENTER_WINDOW,
63     HOTKEY_TOGGLE_FULLSCREEN,
64     HOTKEY_RESIZE_TO_640,
65     HOTKEY_RESIZE_TO_800,
66     HOTKEY_RESIZE_TO_1024,
67     HOTKEY_SAVE_SCREENSHOT,
68     HOTKEY_SAVE_CITY_SCREENSHOT,
69     HOTKEY_BUILD_CLONE,
70     HOTKEY_MAX_ITEMS
71 } hotkey_action;
72 
73 typedef struct {
74     key_type key;
75     key_modifier_type modifiers;
76     hotkey_action action;
77 } hotkey_mapping;
78 
79 /**
80  * Get mapping for action at the specified index
81  * @param action Action
82  * @param index Index
83  * @return Mapping or NULL if not set
84  */
85 const hotkey_mapping *hotkey_for_action(hotkey_action action, int index);
86 
87 /**
88  * Get default mapping for action
89  * @param action Action
90  * @param index Index, can be 0 or 1
91  * @return Mapping, may be an empty mapping. Only returns NULL on invalid input
92  */
93 const hotkey_mapping *hotkey_default_for_action(hotkey_action action, int index);
94 
95 /**
96  * Clear all hotkey mappings
97  */
98 void hotkey_config_clear(void);
99 
100 /**
101  * Add a mapping
102  * @param mapping Mapping to add
103  */
104 void hotkey_config_add_mapping(const hotkey_mapping *mapping);
105 
106 /**
107  * Load hotkey config from file and install hotkeys
108  */
109 void hotkey_config_load(void);
110 
111 /**
112  * Save hotkey config to file and install hotkeys
113  */
114 void hotkey_config_save(void);
115 
116 #endif // CORE_HOTKEY_CONFIG_H
117