add spacing and group unused selector code

This commit is contained in:
marmare314 2023-04-29 15:07:25 +02:00
parent ae63ea5f9e
commit ab20e897a8
2 changed files with 24 additions and 19 deletions

View file

@ -5999,7 +5999,7 @@ void CEditor::RenderMenubar(CUIRect MenuBar)
if(DoButton_Menu(&s_ToolsButton, "Tools", 0, &ToolsButton, 0, nullptr)) if(DoButton_Menu(&s_ToolsButton, "Tools", 0, &ToolsButton, 0, nullptr))
{ {
static SPopupMenuId s_PopupMenuToolsId; static SPopupMenuId s_PopupMenuToolsId;
UI()->DoPopupMenu(&s_PopupMenuToolsId, ToolsButton.x, ToolsButton.y + ToolsButton.h - 1.0f, 200.0f, 46.0f, this, PopupMenuTools, IGraphics::CORNER_R | IGraphics::CORNER_B); UI()->DoPopupMenu(&s_PopupMenuToolsId, ToolsButton.x, ToolsButton.y + ToolsButton.h - 1.0f, 200.0f, 50.0f, this, PopupMenuTools, IGraphics::CORNER_R | IGraphics::CORNER_B);
} }
MenuBar.VSplitLeft(5.0f, nullptr, &MenuBar); MenuBar.VSplitLeft(5.0f, nullptr, &MenuBar);
@ -6010,7 +6010,7 @@ void CEditor::RenderMenubar(CUIRect MenuBar)
if(DoButton_Menu(&s_SettingsButton, "Settings", 0, &SettingsButton, 0, nullptr)) if(DoButton_Menu(&s_SettingsButton, "Settings", 0, &SettingsButton, 0, nullptr))
{ {
static SPopupMenuId s_PopupMenuEntitiesId; static SPopupMenuId s_PopupMenuEntitiesId;
UI()->DoPopupMenu(&s_PopupMenuEntitiesId, SettingsButton.x, SettingsButton.y + SettingsButton.h - 1.0f, 200.0f, 34.0f, this, PopupMenuSettings, IGraphics::CORNER_R | IGraphics::CORNER_B); UI()->DoPopupMenu(&s_PopupMenuEntitiesId, SettingsButton.x, SettingsButton.y + SettingsButton.h - 1.0f, 200.0f, 36.0f, this, PopupMenuSettings, IGraphics::CORNER_R | IGraphics::CORNER_B);
} }
CUIRect Info, Close; CUIRect Info, Close;

View file

@ -170,6 +170,7 @@ CUI::EPopupMenuFunctionResult CEditor::PopupMenuTools(void *pContext, CUIRect Vi
} }
static int s_BorderButton = 0; static int s_BorderButton = 0;
View.HSplitTop(2.0f, nullptr, &View);
View.HSplitTop(12.0f, &Slot, &View); View.HSplitTop(12.0f, &Slot, &View);
if(pEditor->DoButton_MenuItem(&s_BorderButton, "Border", 0, &Slot, 0, "Place tiles in a 2-tile wide border at the edges of the layer")) if(pEditor->DoButton_MenuItem(&s_BorderButton, "Border", 0, &Slot, 0, "Place tiles in a 2-tile wide border at the edges of the layer"))
{ {
@ -189,6 +190,7 @@ CUI::EPopupMenuFunctionResult CEditor::PopupMenuTools(void *pContext, CUIRect Vi
} }
static int s_GotoButton = 0; static int s_GotoButton = 0;
View.HSplitTop(2.0f, nullptr, &View);
View.HSplitTop(12.0f, &Slot, &View); View.HSplitTop(12.0f, &Slot, &View);
if(pEditor->DoButton_MenuItem(&s_GotoButton, "Goto XY", 0, &Slot, 0, "Go to a specified coordinate point on the map")) if(pEditor->DoButton_MenuItem(&s_GotoButton, "Goto XY", 0, &Slot, 0, "Go to a specified coordinate point on the map"))
{ {
@ -228,25 +230,28 @@ CUI::EPopupMenuFunctionResult CEditor::PopupMenuSettings(void *pContext, CUIRect
pEditor->UI()->DoPopupMenu(&s_PopupEntitiesId, Slot.x, Slot.y + Slot.h, 250, pEditor->m_vSelectEntitiesFiles.size() * 14.0f + 10.0f, pEditor, PopupEntities); pEditor->UI()->DoPopupMenu(&s_PopupEntitiesId, Slot.x, Slot.y + Slot.h, 250, pEditor->m_vSelectEntitiesFiles.size() * 14.0f + 10.0f, pEditor, PopupEntities);
} }
View.HSplitTop(2.0f, nullptr, &View);
View.HSplitTop(12.0f, &Slot, &View); View.HSplitTop(12.0f, &Slot, &View);
Slot.VMargin(5.0f, &Slot);
Slot.VSplitRight(5.0f, &Slot, nullptr); // right margin
CUIRect Label, Selector;
Slot.VSplitMid(&Label, &Selector);
CUIRect No, Yes;
Selector.VSplitMid(&No, &Yes);
pEditor->UI()->DoLabel(&Label, "Allow unused", 10.0f, TEXTALIGN_ML);
static int s_ButtonNo = 0;
static int s_ButtonYes = 0;
if(pEditor->DoButton_ButtonDec(&s_ButtonNo, "No", !pEditor->m_AllowPlaceUnusedTiles, &No, 0, "[ctrl+u] Disallow placing unused tiles"))
{ {
pEditor->m_AllowPlaceUnusedTiles = false; Slot.VMargin(5.0f, &Slot);
} Slot.VSplitRight(5.0f, &Slot, nullptr); // right margin
if(pEditor->DoButton_ButtonInc(&s_ButtonYes, "Yes", pEditor->m_AllowPlaceUnusedTiles, &Yes, 0, "[ctrl+u] Allow placing unused tiles"))
{ CUIRect Label, Selector;
pEditor->m_AllowPlaceUnusedTiles = true; Slot.VSplitMid(&Label, &Selector);
CUIRect No, Yes;
Selector.VSplitMid(&No, &Yes);
pEditor->UI()->DoLabel(&Label, "Allow unused", 10.0f, TEXTALIGN_ML);
static int s_ButtonNo = 0;
static int s_ButtonYes = 0;
if(pEditor->DoButton_ButtonDec(&s_ButtonNo, "No", !pEditor->m_AllowPlaceUnusedTiles, &No, 0, "[ctrl+u] Disallow placing unused tiles"))
{
pEditor->m_AllowPlaceUnusedTiles = false;
}
if(pEditor->DoButton_ButtonInc(&s_ButtonYes, "Yes", pEditor->m_AllowPlaceUnusedTiles, &Yes, 0, "[ctrl+u] Allow placing unused tiles"))
{
pEditor->m_AllowPlaceUnusedTiles = true;
}
} }
return CUI::POPUP_KEEP_OPEN; return CUI::POPUP_KEEP_OPEN;