DDraceNetwork Documentation
Loading...
Searching...
No Matches
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// This helps IDEs properly syntax highlight the uses of the macro below.
5#define REGISTER_QUICK_ACTION(name, text, callback, disabled, active, button_color, description)
6#endif
7
8#define ALWAYS_FALSE []() -> bool { return false; }
9#define DEFAULT_BTN []() -> int { return -1; }
10
13 "Toggle grid",
14 [&]() { MapView()->MapGrid()->Toggle(); },
16 [&]() -> bool { return MapView()->MapGrid()->IsEnabled(); },
18 "[Ctrl+G] Toggle grid.")
21 "Game tiles: Air",
22 [&]() { FillGameTiles(EGameTileOp::AIR); },
23 [&]() -> bool { return !CanFillGameTiles(); },
26 "Construct game tiles from this layer.")
29 "Game tiles: Hookable",
30 [&]() { FillGameTiles(EGameTileOp::HOOKABLE); },
31 [&]() -> bool { return !CanFillGameTiles(); },
34 "Construct game tiles from this layer.")
37 "Game tiles: Death",
38 [&]() { FillGameTiles(EGameTileOp::DEATH); },
39 [&]() -> bool { return !CanFillGameTiles(); },
42 "Construct game tiles from this layer.")
45 "Game tiles: Unhookable",
46 [&]() { FillGameTiles(EGameTileOp::UNHOOKABLE); },
47 [&]() -> bool { return !CanFillGameTiles(); },
50 "Construct game tiles from this layer.")
53 "Game tiles: Hookthrough",
54 [&]() { FillGameTiles(EGameTileOp::HOOKTHROUGH); },
55 [&]() -> bool { return !CanFillGameTiles(); },
58 "Construct game tiles from this layer.")
61 "Game tiles: Freeze",
62 [&]() { FillGameTiles(EGameTileOp::FREEZE); },
63 [&]() -> bool { return !CanFillGameTiles(); },
66 "Construct game tiles from this layer.")
69 "Game tiles: Unfreeze",
70 [&]() { FillGameTiles(EGameTileOp::UNFREEZE); },
71 [&]() -> bool { return !CanFillGameTiles(); },
74 "Construct game tiles from this layer.")
77 "Game tiles: Deep Freeze",
78 [&]() { FillGameTiles(EGameTileOp::DEEP_FREEZE); },
79 [&]() -> bool { return !CanFillGameTiles(); },
82 "Construct game tiles from this layer.")
85 "Game tiles: Deep Unfreeze",
86 [&]() { FillGameTiles(EGameTileOp::DEEP_UNFREEZE); },
87 [&]() -> bool { return !CanFillGameTiles(); },
90 "Construct game tiles from this layer.")
93 "Game tiles: Blue Check Tele",
94 [&]() { FillGameTiles(EGameTileOp::BLUE_CHECK_TELE); },
95 [&]() -> bool { return !CanFillGameTiles(); },
98 "Construct game tiles from this layer.")
101 "Game tiles: Red Check Tele",
102 [&]() { FillGameTiles(EGameTileOp::RED_CHECK_TELE); },
103 [&]() -> bool { return !CanFillGameTiles(); },
106 "Construct game tiles from this layer.")
109 "Game tiles: Live Freeze",
110 [&]() { FillGameTiles(EGameTileOp::LIVE_FREEZE); },
111 [&]() -> bool { return !CanFillGameTiles(); },
114 "Construct game tiles from this layer.")
117 "Game tiles: Live Unfreeze",
118 [&]() { FillGameTiles(EGameTileOp::LIVE_UNFREEZE); },
119 [&]() -> bool { return !CanFillGameTiles(); },
122 "Construct game tiles from this layer.")
124 AddGroup,
125 "Add group",
126 [&]() { AddGroup(); },
130 "Add a new group.")
132 ResetZoom,
133 "Reset zoom",
134 [&]() { MapView()->ResetZoom(); },
138 "[Numpad*] Zoom to normal and remove editor offset.")
140 ZoomOut,
141 "Zoom out",
142 [&]() { MapView()->Zoom()->ChangeValue(50.0f); },
146 "[Numpad-] Zoom out.")
148 ZoomIn,
149 "Zoom in",
150 [&]() { MapView()->Zoom()->ChangeValue(-50.0f); },
154 "[Numpad+] Zoom in.")
156 Refocus,
157 "Refocus",
158 [&]() { MapView()->Focus(); },
162 "[Home] Restore map focus.")
164 Proof,
165 "Proof",
166 [&]() { MapView()->ProofMode()->Toggle(); },
168 [&]() -> bool { return MapView()->ProofMode()->IsEnabled(); },
170 "Toggle proof borders. These borders represent the area that a player can see with default zoom.")
172 AddTileLayer, "Add tile layer", [&]() { AddTileLayer(); }, ALWAYS_FALSE, ALWAYS_FALSE, DEFAULT_BTN, "Create a new tile layer.")
174 AddSwitchLayer,
175 "Add switch layer",
176 [&]() { AddSwitchLayer(); },
177 [&]() -> bool { return !GetSelectedGroup()->m_GameGroup || m_Map.m_pSwitchLayer; },
180 "Create a new switch layer.")
182 AddTuneLayer,
183 "Add tune layer",
184 [&]() { AddTuneLayer(); },
185 [&]() -> bool { return !GetSelectedGroup()->m_GameGroup || m_Map.m_pTuneLayer; },
188 "Create a new tuning layer.")
190 AddSpeedupLayer,
191 "Add speedup layer",
192 [&]() { AddSpeedupLayer(); },
193 [&]() -> bool { return !GetSelectedGroup()->m_GameGroup || m_Map.m_pSpeedupLayer; },
196 "Create a new speedup layer.")
198 AddTeleLayer,
199 "Add tele layer",
200 [&]() { AddTeleLayer(); },
201 [&]() -> bool { return !GetSelectedGroup()->m_GameGroup || m_Map.m_pTeleLayer; },
204 "Create a new tele layer.")
206 AddFrontLayer,
207 "Add front layer",
208 [&]() { AddFrontLayer(); },
209 [&]() -> bool { return !GetSelectedGroup()->m_GameGroup || m_Map.m_pFrontLayer; },
212 "Create a new item layer.")
214 AddQuadsLayer, "Add quads layer", [&]() { AddQuadsLayer(); }, ALWAYS_FALSE, ALWAYS_FALSE, DEFAULT_BTN, "Create a new quads layer.")
216 AddSoundLayer, "Add sound layer", [&]() { AddSoundLayer(); }, ALWAYS_FALSE, ALWAYS_FALSE, DEFAULT_BTN, "Create a new sound layer.")
218 SaveAs,
219 "Save as",
220 [&]() {
223 m_FileBrowser.ShowFileDialog(IStorage::TYPE_SAVE, CFileBrowser::EFileType::MAP, "Save map", "Save as", "maps", aDefaultName, CallbackSaveMap, this);
224 },
228 "[Ctrl+Shift+S] Save the current map under a new name.")
230 LoadCurrentMap,
231 "Load current map",
232 [&]() {
233 if(HasUnsavedData())
234 {
235 if(!m_PopupEventWasActivated)
236 {
237 m_PopupEventType = POPEVENT_LOADCURRENT;
238 m_PopupEventActivated = true;
239 }
240 }
241 else
242 {
243 LoadCurrentMap();
244 }
245 },
246 [&]() -> bool { return Client()->State() != IClient::STATE_ONLINE && Client()->State() != IClient::STATE_DEMOPLAYBACK; },
249 "[Ctrl+Shift+L] Open the current ingame map for editing.")
251 Envelopes,
252 "Envelopes",
253 [&]() { m_ActiveExtraEditor = m_ActiveExtraEditor == EXTRAEDITOR_ENVELOPES ? EXTRAEDITOR_NONE : EXTRAEDITOR_ENVELOPES; },
256 [&]() -> int { return m_ShowPicker ? -1 : m_ActiveExtraEditor == EXTRAEDITOR_ENVELOPES; },
257 "Toggle the envelope editor.")
260 "Server settings",
261 [&]() { m_ActiveExtraEditor = m_ActiveExtraEditor == EXTRAEDITOR_SERVER_SETTINGS ? EXTRAEDITOR_NONE : EXTRAEDITOR_SERVER_SETTINGS; },
264 [&]() -> int { return m_ShowPicker ? -1 : m_ActiveExtraEditor == EXTRAEDITOR_SERVER_SETTINGS; },
265 "Toggle the server settings editor.")
267 History,
268 "History",
269 [&]() { m_ActiveExtraEditor = m_ActiveExtraEditor == EXTRAEDITOR_HISTORY ? EXTRAEDITOR_NONE : EXTRAEDITOR_HISTORY; },
272 [&]() -> int { return m_ShowPicker ? -1 : m_ActiveExtraEditor == EXTRAEDITOR_HISTORY; },
273 "Toggle the editor history view.")
275 AddImage,
276 "Add image",
277 [&]() { m_FileBrowser.ShowFileDialog(IStorage::TYPE_ALL, CFileBrowser::EFileType::IMAGE, "Add image", "Add", "mapres", "", AddImage, this); },
281 "Load a new image to use in the map.")
284 "Layer: add image",
285 [&]() { LayerSelectImage(); },
286 [&]() -> bool { return !IsNonGameTileLayerSelected(); },
289 "Pick mapres image for currently selected layer.")
292 "Show info: Off",
293 [&]() {
294 m_ShowTileInfo = SHOW_TILE_OFF;
295 m_ShowEnvelopePreview = SHOWENV_NONE;
296 },
298 [&]() -> bool { return m_ShowTileInfo == SHOW_TILE_OFF; },
300 "Do not show tile information.")
303 "Show info: Dec",
304 [&]() {
305 m_ShowTileInfo = SHOW_TILE_DECIMAL;
306 m_ShowEnvelopePreview = SHOWENV_NONE;
307 },
309 [&]() -> bool { return m_ShowTileInfo == SHOW_TILE_DECIMAL; },
311 "[Ctrl+I] Show tile information.")
314 "Show info: Hex",
315 [&]() {
316 m_ShowTileInfo = SHOW_TILE_HEXADECIMAL;
317 m_ShowEnvelopePreview = SHOWENV_NONE;
318 },
320 [&]() -> bool { return m_ShowTileInfo == SHOW_TILE_HEXADECIMAL; },
322 "[Ctrl+Shift+I] Show tile information in hexadecimal.")
324 DeleteLayer,
325 "Delete layer",
326 [&]() { DeleteSelectedLayer(); },
327 [&]() -> bool {
328 std::shared_ptr<CLayer> pCurrentLayer = GetSelectedLayer(0);
329 if(!pCurrentLayer)
330 return true;
331 return m_Map.m_pGameLayer == pCurrentLayer;
332 },
335 "Delete the layer.")
337 Pipette,
338 "Pipette",
339 [&]() { m_ColorPipetteActive = !m_ColorPipetteActive; },
341 [&]() -> bool { return m_ColorPipetteActive; },
343 "[Ctrl+Shift+C] Color pipette. Pick a color from the screen by clicking on it.")
345 MapDetails,
346 "Map details",
347 [&]() { MapDetails(); },
351 "Adjust the map details of the current map.")
353 AddQuad,
354 "Add quad",
355 [&]() { AddQuadOrSound(); },
356 [&]() -> bool {
357 std::shared_ptr<CLayer> pLayer = GetSelectedLayer(0);
358 if(!pLayer)
359 return false;
360 return pLayer->m_Type != LAYERTYPE_QUADS;
361 },
364 "[Ctrl+Q] Add a new quad.")
367 "Add sound source",
368 [&]() { AddQuadOrSound(); },
369 [&]() -> bool {
370 std::shared_ptr<CLayer> pLayer = GetSelectedLayer(0);
371 if(!pLayer)
372 return false;
373 return pLayer->m_Type != LAYERTYPE_SOUNDS;
374 },
377 "[Ctrl+Q] Add a new sound source.")
379 TestMapLocally,
380 "Test map locally",
381 [&]() { TestMapLocally(); },
385 "Run a local server with the current map and connect you to it.")
386
@ STATE_DEMOPLAYBACK
Definition client.h:57
@ STATE_ONLINE
Definition client.h:56
@ TYPE_ALL
Definition storage.h:27
@ TYPE_SAVE
Definition storage.h:26
Definition vmath.h:15
const char * fs_filename(const char *path)
Definition system.cpp:2655
void fs_split_file_extension(const char *filename, char *name, size_t name_size, char *extension, size_t extension_size)
Definition system.cpp:2665
@ LAYERTYPE_QUADS
Definition mapitems.h:15
@ LAYERTYPE_SOUNDS
Definition mapitems.h:22
#define ALWAYS_FALSE
Definition quick_actions.h:8
#define REGISTER_QUICK_ACTION(name, text, callback, disabled, active, button_color, description)
Definition quick_actions.h:5
#define DEFAULT_BTN
Definition quick_actions.h:9
constexpr auto IO_MAX_PATH_LENGTH
Definition types.h:49