diff --git a/src/game/editor/editor.cpp b/src/game/editor/editor.cpp index 3ba8add6c..f600ca05b 100644 --- a/src/game/editor/editor.cpp +++ b/src/game/editor/editor.cpp @@ -5739,30 +5739,25 @@ void CEditor::RenderModebar(CUIRect View) void CEditor::RenderStatusbar(CUIRect View, CUIRect *pTooltipRect) { - const bool ButtonsDisabled = m_ShowPicker; - CUIRect Button; View.VSplitRight(100.0f, &View, &Button); - static int s_EnvelopeButton = 0; - if(DoButton_Editor(&s_EnvelopeButton, m_QuickActionEnvelopes.Label(), m_QuickActionEnvelopes.Color(), &Button, 0, m_QuickActionEnvelopes.Description()) == 1) + if(DoButton_Editor(&m_QuickActionEnvelopes, m_QuickActionEnvelopes.Label(), m_QuickActionEnvelopes.Color(), &Button, 0, m_QuickActionEnvelopes.Description()) == 1) { m_QuickActionEnvelopes.Call(); } View.VSplitRight(10.0f, &View, nullptr); View.VSplitRight(100.0f, &View, &Button); - static int s_SettingsButton = 0; - if(DoButton_Editor(&s_SettingsButton, "Server settings", ButtonsDisabled ? -1 : m_ActiveExtraEditor == EXTRAEDITOR_SERVER_SETTINGS, &Button, 0, "Toggles the server settings editor.") == 1) + if(DoButton_Editor(&m_QuickActionServerSettings, m_QuickActionServerSettings.Label(), m_QuickActionServerSettings.Color(), &Button, 0, m_QuickActionServerSettings.Description()) == 1) { - m_ActiveExtraEditor = m_ActiveExtraEditor == EXTRAEDITOR_SERVER_SETTINGS ? EXTRAEDITOR_NONE : EXTRAEDITOR_SERVER_SETTINGS; + m_QuickActionServerSettings.Call(); } View.VSplitRight(10.0f, &View, nullptr); View.VSplitRight(100.0f, &View, &Button); - static int s_HistoryButton = 0; - if(DoButton_Editor(&s_HistoryButton, "History", ButtonsDisabled ? -1 : m_ActiveExtraEditor == EXTRAEDITOR_HISTORY, &Button, 0, "Toggles the editor history view.") == 1) + if(DoButton_Editor(&m_QuickActionHistory, m_QuickActionHistory.Label(), m_QuickActionHistory.Color(), &Button, 0, m_QuickActionHistory.Description()) == 1) { - m_ActiveExtraEditor = m_ActiveExtraEditor == EXTRAEDITOR_HISTORY ? EXTRAEDITOR_NONE : EXTRAEDITOR_HISTORY; + m_QuickActionHistory.Call(); } View.VSplitRight(10.0f, pTooltipRect, nullptr); diff --git a/src/game/editor/quick_actions.h b/src/game/editor/quick_actions.h index cfba08e4b..485001c8a 100644 --- a/src/game/editor/quick_actions.h +++ b/src/game/editor/quick_actions.h @@ -179,6 +179,22 @@ REGISTER_QUICK_ACTION( ALWAYS_FALSE, [&]() -> int { return m_ShowPicker ? -1 : m_ActiveExtraEditor == EXTRAEDITOR_ENVELOPES; }, "Toggles the envelope editor.") +REGISTER_QUICK_ACTION( + ServerSettings, + "Server settings", + [&]() { m_ActiveExtraEditor = m_ActiveExtraEditor == EXTRAEDITOR_SERVER_SETTINGS ? EXTRAEDITOR_NONE : EXTRAEDITOR_SERVER_SETTINGS; }, + ALWAYS_FALSE, + ALWAYS_FALSE, + [&]() -> int { return m_ShowPicker ? -1 : m_ActiveExtraEditor == EXTRAEDITOR_SERVER_SETTINGS; }, + "Toggles the server settings editor.") +REGISTER_QUICK_ACTION( + History, + "History", + [&]() { m_ActiveExtraEditor = m_ActiveExtraEditor == EXTRAEDITOR_HISTORY ? EXTRAEDITOR_NONE : EXTRAEDITOR_HISTORY; }, + ALWAYS_FALSE, + ALWAYS_FALSE, + [&]() -> int { return m_ShowPicker ? -1 : m_ActiveExtraEditor == EXTRAEDITOR_HISTORY; }, + "Toggles the editor history view.") REGISTER_QUICK_ACTION( AddImage, "Add Image",