mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-09 09:38:19 +00:00
Merge pull request #8857 from ChillerDragon/pr_action_load_current_map
Add quick action "Load Current Map"
This commit is contained in:
commit
b5c11bc860
|
@ -68,17 +68,9 @@ CUi::EPopupMenuFunctionResult CEditor::PopupMenuFile(void *pContext, CUIRect Vie
|
||||||
|
|
||||||
View.HSplitTop(2.0f, nullptr, &View);
|
View.HSplitTop(2.0f, nullptr, &View);
|
||||||
View.HSplitTop(12.0f, &Slot, &View);
|
View.HSplitTop(12.0f, &Slot, &View);
|
||||||
if(pEditor->DoButton_MenuItem(&s_OpenCurrentMapButton, "Load Current Map", 0, &Slot, 0, "Opens the current in game map for editing (ctrl+alt+l)"))
|
if(pEditor->DoButton_MenuItem(&s_OpenCurrentMapButton, pEditor->m_QuickActionLoadCurrentMap.Label(), 0, &Slot, 0, pEditor->m_QuickActionLoadCurrentMap.Description()))
|
||||||
{
|
{
|
||||||
if(pEditor->HasUnsavedData())
|
pEditor->m_QuickActionLoadCurrentMap.Call();
|
||||||
{
|
|
||||||
pEditor->m_PopupEventType = POPEVENT_LOADCURRENT;
|
|
||||||
pEditor->m_PopupEventActivated = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
pEditor->LoadCurrentMap();
|
|
||||||
}
|
|
||||||
return CUi::POPUP_CLOSE_CURRENT;
|
return CUi::POPUP_CLOSE_CURRENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,24 @@ REGISTER_QUICK_ACTION(
|
||||||
ALWAYS_FALSE,
|
ALWAYS_FALSE,
|
||||||
DEFAULT_BTN,
|
DEFAULT_BTN,
|
||||||
"Saves the current map under a new name (ctrl+shift+s)")
|
"Saves the current map under a new name (ctrl+shift+s)")
|
||||||
|
REGISTER_QUICK_ACTION(
|
||||||
|
LoadCurrentMap,
|
||||||
|
"Load Current Map",
|
||||||
|
[&]() {
|
||||||
|
if(HasUnsavedData())
|
||||||
|
{
|
||||||
|
m_PopupEventType = POPEVENT_LOADCURRENT;
|
||||||
|
m_PopupEventActivated = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LoadCurrentMap();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
ALWAYS_FALSE,
|
||||||
|
ALWAYS_FALSE,
|
||||||
|
DEFAULT_BTN,
|
||||||
|
"Opens the current in game map for editing (ctrl+alt+l)")
|
||||||
REGISTER_QUICK_ACTION(
|
REGISTER_QUICK_ACTION(
|
||||||
Envelopes,
|
Envelopes,
|
||||||
"Envelopes",
|
"Envelopes",
|
||||||
|
|
Loading…
Reference in a new issue