DDraceNetwork Docs
quick_actions.h
Go to the documentation of this file.
1// This file can be included several times.
2
3#ifndef REGISTER_QUICK_ACTION
4#define REGISTER_QUICK_ACTION(name, text, callback, disabled, active, button_color, description)
5#endif
6
7#define ALWAYS_FALSE []() -> bool { return false; }
8#define DEFAULT_BTN []() -> int { return -1; }
9
11 ToggleGrid,
12 "Toggle Grid",
13 [&]() { MapView()->MapGrid()->Toggle(); },
15 [&]() -> bool { return MapView()->MapGrid()->IsEnabled(); },
17 "[Ctrl+G] Toggle Grid.")
19 GameTilesAir,
20 "Game tiles: Air",
21 [&]() { FillGameTiles(EGameTileOp::AIR); },
22 [&]() -> bool { return !CanFillGameTiles(); },
25 "Constructs game tiles from this layer.")
27 GameTilesHookable,
28 "Game tiles: Hookable",
29 [&]() { FillGameTiles(EGameTileOp::HOOKABLE); },
30 [&]() -> bool { return !CanFillGameTiles(); },
33 "Constructs game tiles from this layer.")
35 GameTilesDeath,
36 "Game tiles: Death",
37 [&]() { FillGameTiles(EGameTileOp::DEATH); },
38 [&]() -> bool { return !CanFillGameTiles(); },
41 "Constructs game tiles from this layer.")
43 GameTilesUnhookable,
44 "Game tiles: Unhookable",
45 [&]() { FillGameTiles(EGameTileOp::UNHOOKABLE); },
46 [&]() -> bool { return !CanFillGameTiles(); },
49 "Constructs game tiles from this layer.")
51 GameTilesHookthrough,
52 "Game tiles: Hookthrough",
53 [&]() { FillGameTiles(EGameTileOp::HOOKTHROUGH); },
54 [&]() -> bool { return !CanFillGameTiles(); },
57 "Constructs game tiles from this layer.")
59 GameTilesFreeze,
60 "Game tiles: Freeze",
61 [&]() { FillGameTiles(EGameTileOp::FREEZE); },
62 [&]() -> bool { return !CanFillGameTiles(); },
65 "Constructs game tiles from this layer.")
67 GameTilesUnfreeze,
68 "Game tiles: Unfreeze",
69 [&]() { FillGameTiles(EGameTileOp::UNFREEZE); },
70 [&]() -> bool { return !CanFillGameTiles(); },
73 "Constructs game tiles from this layer.")
75 GameTilesDeepFreeze,
76 "Game tiles: Deep Freeze",
77 [&]() { FillGameTiles(EGameTileOp::DEEP_FREEZE); },
78 [&]() -> bool { return !CanFillGameTiles(); },
81 "Constructs game tiles from this layer.")
83 GameTilesDeepUnfreeze,
84 "Game tiles: Deep Unfreeze",
85 [&]() { FillGameTiles(EGameTileOp::DEEP_UNFREEZE); },
86 [&]() -> bool { return !CanFillGameTiles(); },
89 "Constructs game tiles from this layer.")
91 GameTilesBlueCheckTele,
92 "Game tiles: Blue Check Tele",
93 [&]() { FillGameTiles(EGameTileOp::BLUE_CHECK_TELE); },
94 [&]() -> bool { return !CanFillGameTiles(); },
97 "Constructs game tiles from this layer.")
99 GameTilesRedCheckTele,
100 "Game tiles: Red Check Tele",
101 [&]() { FillGameTiles(EGameTileOp::RED_CHECK_TELE); },
102 [&]() -> bool { return !CanFillGameTiles(); },
105 "Constructs game tiles from this layer.")
107 GameTilesLiveFreeze,
108 "Game tiles: Live Freeze",
109 [&]() { FillGameTiles(EGameTileOp::LIVE_FREEZE); },
110 [&]() -> bool { return !CanFillGameTiles(); },
113 "Constructs game tiles from this layer.")
115 GameTilesLiveUnfreeze,
116 "Game tiles: Live Unfreeze",
117 [&]() { FillGameTiles(EGameTileOp::LIVE_UNFREEZE); },
118 [&]() -> bool { return !CanFillGameTiles(); },
121 "Constructs game tiles from this layer.")
123 AddGroup,
124 "Add group",
125 [&]() { AddGroup(); },
129 "Adds a new group.")
131 ResetZoom,
132 "Reset Zoom",
133 [&]() { MapView()->ResetZoom(); },
137 "[Numpad*] Zoom to normal and remove editor offset.")
139 ZoomOut,
140 "Zoom Out",
141 [&]() { MapView()->Zoom()->ChangeValue(50.0f); },
145 "[Numpad-] Zoom out.")
147 ZoomIn,
148 "Zoom In",
149 [&]() { MapView()->Zoom()->ChangeValue(-50.0f); },
153 "[Numpad+] Zoom in.")
155 Refocus,
156 "Refocus",
157 [&]() { MapView()->Focus(); },
161 "[Home] Restore map focus.")
163 Proof,
164 "Proof",
165 [&]() { MapView()->ProofMode()->Toggle(); },
167 [&]() -> bool { return MapView()->ProofMode()->IsEnabled(); },
169 "Toggles proof borders. These borders represent the area that a player can see with default zoom.")
171 AddTileLayer, "Add tile layer", [&]() { AddTileLayer(); }, ALWAYS_FALSE, ALWAYS_FALSE, DEFAULT_BTN, "Creates a new tile layer.")
173 AddSwitchLayer,
174 "Add switch layer",
175 [&]() { AddSwitchLayer(); },
176 [&]() -> bool { return !GetSelectedGroup()->m_GameGroup || m_Map.m_pSwitchLayer; },
179 "Creates a new switch layer.")
181 AddTuneLayer,
182 "Add tune layer",
183 [&]() { AddTuneLayer(); },
184 [&]() -> bool { return !GetSelectedGroup()->m_GameGroup || m_Map.m_pTuneLayer; },
187 "Creates a new tuning layer.")
189 AddSpeedupLayer,
190 "Add speedup layer",
191 [&]() { AddSpeedupLayer(); },
192 [&]() -> bool { return !GetSelectedGroup()->m_GameGroup || m_Map.m_pSpeedupLayer; },
195 "Creates a new speedup layer.")
197 AddTeleLayer,
198 "Add tele layer",
199 [&]() { AddTeleLayer(); },
200 [&]() -> bool { return !GetSelectedGroup()->m_GameGroup || m_Map.m_pTeleLayer; },
203 "Creates a new tele layer.")
205 AddFrontLayer,
206 "Add front layer",
207 [&]() { AddFrontLayer(); },
208 [&]() -> bool { return !GetSelectedGroup()->m_GameGroup || m_Map.m_pFrontLayer; },
211 "Creates a new item layer.")
213 AddQuadsLayer, "Add quads layer", [&]() { AddQuadsLayer(); }, ALWAYS_FALSE, ALWAYS_FALSE, DEFAULT_BTN, "Creates a new quads layer.")
215 AddSoundLayer, "Add sound layer", [&]() { AddSoundLayer(); }, ALWAYS_FALSE, ALWAYS_FALSE, DEFAULT_BTN, "Creates a new sound layer.")
217 SaveAs,
218 "Save As",
219 [&]() { InvokeFileDialog(IStorage::TYPE_SAVE, FILETYPE_MAP, "Save map", "Save As", "maps", true, CEditor::CallbackSaveMap, this); },
223 "[Ctrl+Shift+S] Saves the current map under a new name.")
225 LoadCurrentMap,
226 "Load Current Map",
227 [&]() {
228 if(HasUnsavedData())
229 {
230 m_PopupEventType = POPEVENT_LOADCURRENT;
231 m_PopupEventActivated = true;
232 }
233 else
234 {
235 LoadCurrentMap();
236 }
237 },
241 "[Ctrl+Alt+L] Opens the current in game map for editing.")
243 Envelopes,
244 "Envelopes",
245 [&]() { m_ActiveExtraEditor = m_ActiveExtraEditor == EXTRAEDITOR_ENVELOPES ? EXTRAEDITOR_NONE : EXTRAEDITOR_ENVELOPES; },
248 [&]() -> int { return m_ShowPicker ? -1 : m_ActiveExtraEditor == EXTRAEDITOR_ENVELOPES; },
249 "Toggles the envelope editor.")
251 ServerSettings,
252 "Server settings",
253 [&]() { m_ActiveExtraEditor = m_ActiveExtraEditor == EXTRAEDITOR_SERVER_SETTINGS ? EXTRAEDITOR_NONE : EXTRAEDITOR_SERVER_SETTINGS; },
256 [&]() -> int { return m_ShowPicker ? -1 : m_ActiveExtraEditor == EXTRAEDITOR_SERVER_SETTINGS; },
257 "Toggles the server settings editor.")
259 History,
260 "History",
261 [&]() { m_ActiveExtraEditor = m_ActiveExtraEditor == EXTRAEDITOR_HISTORY ? EXTRAEDITOR_NONE : EXTRAEDITOR_HISTORY; },
264 [&]() -> int { return m_ShowPicker ? -1 : m_ActiveExtraEditor == EXTRAEDITOR_HISTORY; },
265 "Toggles the editor history view.")
267 AddImage,
268 "Add Image",
269 [&]() { InvokeFileDialog(IStorage::TYPE_ALL, FILETYPE_IMG, "Add Image", "Add", "mapres", false, AddImage, this); },
273 "Load a new image to use in the map.")
275 LayerPropAddImage,
276 "Layer: Add Image",
277 [&]() { LayerSelectImage(); },
278 [&]() -> bool { return !IsNonGameTileLayerSelected(); },
281 "Pick mapres image for currently selected layer.")
283 ShowInfoOff,
284 "Show Info: Off",
285 [&]() {
286 m_ShowTileInfo = SHOW_TILE_OFF;
287 m_ShowEnvelopePreview = SHOWENV_NONE;
288 },
290 [&]() -> bool { return m_ShowTileInfo == SHOW_TILE_OFF; },
292 "Do not show tile information.")
294 ShowInfoDec,
295 "Show Info: Dec",
296 [&]() {
297 m_ShowTileInfo = SHOW_TILE_DECIMAL;
298 m_ShowEnvelopePreview = SHOWENV_NONE;
299 },
301 [&]() -> bool { return m_ShowTileInfo == SHOW_TILE_DECIMAL; },
303 "[Ctrl+I] Show tile information.")
305 ShowInfoHex,
306 "Show Info: Hex",
307 [&]() {
308 m_ShowTileInfo = SHOW_TILE_HEXADECIMAL;
309 m_ShowEnvelopePreview = SHOWENV_NONE;
310 },
312 [&]() -> bool { return m_ShowTileInfo == SHOW_TILE_HEXADECIMAL; },
314 "[Ctrl+Shift+I] Show tile information in hexadecimal.")
316 DeleteLayer,
317 "Delete layer",
318 [&]() { DeleteSelectedLayer(); },
319 [&]() -> bool {
320 std::shared_ptr<CLayer> pCurrentLayer = GetSelectedLayer(0);
321 if(!pCurrentLayer)
322 return true;
323 return m_Map.m_pGameLayer == pCurrentLayer;
324 },
327 "Deletes the layer.")
329 Pipette,
330 "Pipette",
331 [&]() { m_ColorPipetteActive = !m_ColorPipetteActive; },
333 [&]() -> bool { return m_ColorPipetteActive; },
335 "[Ctrl+Shift+C] Color pipette. Pick a color from the screen by clicking on it.")
337 MapDetails,
338 "Map details",
339 [&]() { MapDetails(); },
343 "Adjust the map details of the current map.")
345 AddQuad,
346 "Add Quad",
347 [&]() { AddQuadOrSound(); },
348 [&]() -> bool {
349 std::shared_ptr<CLayer> pLayer = GetSelectedLayer(0);
350 if(!pLayer)
351 return false;
352 return pLayer->m_Type != LAYERTYPE_QUADS;
353 },
356 "[Ctrl+Q] Add a new quad.")
358 AddSound,
359 "Add Sound",
360 [&]() { AddQuadOrSound(); },
361 [&]() -> bool {
362 std::shared_ptr<CLayer> pLayer = GetSelectedLayer(0);
363 if(!pLayer)
364 return false;
365 return pLayer->m_Type != LAYERTYPE_SOUNDS;
366 },
369 "[Ctrl+Q] Add a new sound source.")
370
371#undef ALWAYS_FALSE
372#undef DEFAULT_BTN
static bool CallbackSaveMap(const char *pFileName, int StorageType, void *pUser)
Definition: editor.cpp:822
@ TYPE_ALL
Definition: storage.h:26
@ TYPE_SAVE
Definition: storage.h:25
@ LAYERTYPE_QUADS
Definition: mapitems.h:14
@ LAYERTYPE_SOUNDS
Definition: mapitems.h:21
#define ALWAYS_FALSE
Definition: quick_actions.h:7
#define REGISTER_QUICK_ACTION(name, text, callback, disabled, active, button_color, description)
Definition: quick_actions.h:4
#define DEFAULT_BTN
Definition: quick_actions.h:8