Add quick actions Server settings and History

This commit is contained in:
ChillerDragon 2024-09-02 09:23:02 +08:00
parent 157498799e
commit 19a888734c
2 changed files with 21 additions and 10 deletions

View file

@ -5739,30 +5739,25 @@ void CEditor::RenderModebar(CUIRect View)
void CEditor::RenderStatusbar(CUIRect View, CUIRect *pTooltipRect) void CEditor::RenderStatusbar(CUIRect View, CUIRect *pTooltipRect)
{ {
const bool ButtonsDisabled = m_ShowPicker;
CUIRect Button; CUIRect Button;
View.VSplitRight(100.0f, &View, &Button); View.VSplitRight(100.0f, &View, &Button);
static int s_EnvelopeButton = 0; if(DoButton_Editor(&m_QuickActionEnvelopes, m_QuickActionEnvelopes.Label(), m_QuickActionEnvelopes.Color(), &Button, 0, m_QuickActionEnvelopes.Description()) == 1)
if(DoButton_Editor(&s_EnvelopeButton, m_QuickActionEnvelopes.Label(), m_QuickActionEnvelopes.Color(), &Button, 0, m_QuickActionEnvelopes.Description()) == 1)
{ {
m_QuickActionEnvelopes.Call(); m_QuickActionEnvelopes.Call();
} }
View.VSplitRight(10.0f, &View, nullptr); View.VSplitRight(10.0f, &View, nullptr);
View.VSplitRight(100.0f, &View, &Button); View.VSplitRight(100.0f, &View, &Button);
static int s_SettingsButton = 0; if(DoButton_Editor(&m_QuickActionServerSettings, m_QuickActionServerSettings.Label(), m_QuickActionServerSettings.Color(), &Button, 0, m_QuickActionServerSettings.Description()) == 1)
if(DoButton_Editor(&s_SettingsButton, "Server settings", ButtonsDisabled ? -1 : m_ActiveExtraEditor == EXTRAEDITOR_SERVER_SETTINGS, &Button, 0, "Toggles the server settings editor.") == 1)
{ {
m_ActiveExtraEditor = m_ActiveExtraEditor == EXTRAEDITOR_SERVER_SETTINGS ? EXTRAEDITOR_NONE : EXTRAEDITOR_SERVER_SETTINGS; m_QuickActionServerSettings.Call();
} }
View.VSplitRight(10.0f, &View, nullptr); View.VSplitRight(10.0f, &View, nullptr);
View.VSplitRight(100.0f, &View, &Button); View.VSplitRight(100.0f, &View, &Button);
static int s_HistoryButton = 0; if(DoButton_Editor(&m_QuickActionHistory, m_QuickActionHistory.Label(), m_QuickActionHistory.Color(), &Button, 0, m_QuickActionHistory.Description()) == 1)
if(DoButton_Editor(&s_HistoryButton, "History", ButtonsDisabled ? -1 : m_ActiveExtraEditor == EXTRAEDITOR_HISTORY, &Button, 0, "Toggles the editor history view.") == 1)
{ {
m_ActiveExtraEditor = m_ActiveExtraEditor == EXTRAEDITOR_HISTORY ? EXTRAEDITOR_NONE : EXTRAEDITOR_HISTORY; m_QuickActionHistory.Call();
} }
View.VSplitRight(10.0f, pTooltipRect, nullptr); View.VSplitRight(10.0f, pTooltipRect, nullptr);

View file

@ -179,6 +179,22 @@ REGISTER_QUICK_ACTION(
ALWAYS_FALSE, ALWAYS_FALSE,
[&]() -> int { return m_ShowPicker ? -1 : m_ActiveExtraEditor == EXTRAEDITOR_ENVELOPES; }, [&]() -> int { return m_ShowPicker ? -1 : m_ActiveExtraEditor == EXTRAEDITOR_ENVELOPES; },
"Toggles the envelope editor.") "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( REGISTER_QUICK_ACTION(
AddImage, AddImage,
"Add Image", "Add Image",