mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-14 03:58:18 +00:00
Add a small close button in editor for people who happen to accidentally click on the Editor symbol in menu, but are unable to find File -> Exit
This commit is contained in:
parent
ca99f3f518
commit
6ab4c566e9
|
@ -3939,8 +3939,10 @@ void CEditor::RenderMenubar(CUIRect MenuBar)
|
||||||
(void)0;
|
(void)0;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
CUIRect Info;
|
CUIRect Info, Close;
|
||||||
MenuBar.VSplitLeft(40.0f, 0, &MenuBar);
|
MenuBar.VSplitLeft(40.0f, 0, &MenuBar);
|
||||||
|
MenuBar.VSplitRight(20.0f, &MenuBar, &Close);
|
||||||
|
Close.VSplitLeft(5.0f, 0, &Close);
|
||||||
MenuBar.VSplitLeft(MenuBar.w*0.75f, &MenuBar, &Info);
|
MenuBar.VSplitLeft(MenuBar.w*0.75f, &MenuBar, &Info);
|
||||||
char aBuf[128];
|
char aBuf[128];
|
||||||
str_format(aBuf, sizeof(aBuf), "File: %s", m_aFileName);
|
str_format(aBuf, sizeof(aBuf), "File: %s", m_aFileName);
|
||||||
|
@ -3948,6 +3950,18 @@ void CEditor::RenderMenubar(CUIRect MenuBar)
|
||||||
|
|
||||||
str_format(aBuf, sizeof(aBuf), "Z: %i, A: %.1f, G: %i", m_ZoomLevel, m_AnimateSpeed, m_GridFactor);
|
str_format(aBuf, sizeof(aBuf), "Z: %i, A: %.1f, G: %i", m_ZoomLevel, m_AnimateSpeed, m_GridFactor);
|
||||||
UI()->DoLabel(&Info, aBuf, 10.0f, 1, -1);
|
UI()->DoLabel(&Info, aBuf, 10.0f, 1, -1);
|
||||||
|
|
||||||
|
static int s_CloseButton = 0;
|
||||||
|
if(DoButton_Editor(&s_CloseButton, "×", 0, &Close, 0, "Exits from the editor"))
|
||||||
|
{
|
||||||
|
if(HasUnsavedData())
|
||||||
|
{
|
||||||
|
m_PopupEventType = POPEVENT_EXIT;
|
||||||
|
m_PopupEventActivated = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
g_Config.m_ClEditor = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CEditor::Render()
|
void CEditor::Render()
|
||||||
|
|
Loading…
Reference in a new issue