diff --git a/src/game/editor/editor.cpp b/src/game/editor/editor.cpp index 86398b422..52a522a0b 100644 --- a/src/game/editor/editor.cpp +++ b/src/game/editor/editor.cpp @@ -886,6 +886,37 @@ void CEditor::DoToolbar(CUIRect ToolBar) const bool ModPressed = Input()->ModifierIsPressed(); const bool ShiftPressed = Input()->ShiftIsPressed(); + // handle shortcut for info button + if(m_Dialog == DIALOG_NONE && m_EditBoxActive == 0 && Input()->KeyPress(KEY_I) && ModPressed && !ShiftPressed) + { + if(m_ShowTileInfo && m_ShowTileHexInfo) + m_ShowTileHexInfo = false; + else if(m_ShowTileInfo) + m_ShowTileInfo = false; + else + m_ShowTileInfo = true; + m_ShowEnvelopePreview = SHOWENV_NONE; + } + + // handle shortcut for hex button + if(m_Dialog == DIALOG_NONE && m_EditBoxActive == 0 && Input()->KeyPress(KEY_I) && ModPressed && ShiftPressed) + { + if(m_ShowTileInfo && m_ShowTileHexInfo) + m_ShowTileInfo = false; + else if(m_ShowTileInfo) + m_ShowTileHexInfo = true; + else + { + m_ShowTileInfo = true; + m_ShowTileHexInfo = true; + } + m_ShowEnvelopePreview = SHOWENV_NONE; + } + + // handle shortcut for unused button + if(m_Dialog == DIALOG_NONE && m_EditBoxActive == 0 && Input()->KeyPress(KEY_U) && ModPressed) + m_AllowPlaceUnusedTiles = !m_AllowPlaceUnusedTiles; + CUIRect TB_Top, TB_Bottom; CUIRect Button; @@ -958,31 +989,6 @@ void CEditor::DoToolbar(CUIRect ToolBar) TB_Top.VSplitLeft(5.0f, nullptr, &TB_Top); - // tile info button - TB_Top.VSplitLeft(40.0f, &Button, &TB_Top); - static int s_TileInfoButton = 0; - if(DoButton_Editor(&s_TileInfoButton, "Info", m_ShowTileInfo, &Button, 0, "[ctrl+i] Show tile information") || - (m_Dialog == DIALOG_NONE && m_EditBoxActive == 0 && Input()->KeyPress(KEY_I) && ModPressed && !ShiftPressed)) - { - m_ShowTileInfo = !m_ShowTileInfo; - m_ShowEnvelopePreview = SHOWENV_NONE; - } - - // handle shortcut for unused button - if(m_Dialog == DIALOG_NONE && m_EditBoxActive == 0 && Input()->KeyPress(KEY_U) && ModPressed) - m_AllowPlaceUnusedTiles = !m_AllowPlaceUnusedTiles; - - TB_Top.VSplitLeft(5.0f, nullptr, &TB_Top); - - TB_Top.VSplitLeft(40.0f, &Button, &TB_Top); - static int s_ColorBrushButton = 0; - if(DoButton_Editor(&s_ColorBrushButton, "Color", m_BrushColorEnabled, &Button, 0, "Toggle brush coloring")) - { - m_BrushColorEnabled = !m_BrushColorEnabled; - } - - TB_Top.VSplitLeft(5.0f, nullptr, &TB_Top); - // zoom group TB_Top.VSplitLeft(20.0f, &Button, &TB_Top); static int s_ZoomOutButton = 0; @@ -1275,16 +1281,6 @@ void CEditor::DoToolbar(CUIRect ToolBar) m_BrushDrawDestructive = !m_BrushDrawDestructive; TB_Bottom.VSplitLeft(5.0f, &Button, &TB_Bottom); } - - // Hex values button - if(m_ShowTileInfo) - { - TB_Bottom.VSplitLeft(65.0f, &Button, &TB_Bottom); - static int s_TileInfoHexButton = 0; - if(DoButton_Editor(&s_TileInfoHexButton, "Hex Values", m_ShowTileHexInfo, &Button, 0, "[ctrl+shift+i] Show a tile's hex value") || - (m_Dialog == DIALOG_NONE && m_EditBoxActive == 0 && Input()->KeyPress(KEY_I) && ModPressed && ShiftPressed)) - m_ShowTileHexInfo = !m_ShowTileHexInfo; - } } } @@ -6010,7 +6006,7 @@ void CEditor::RenderMenubar(CUIRect MenuBar) if(DoButton_Menu(&s_SettingsButton, "Settings", 0, &SettingsButton, 0, nullptr)) { static SPopupMenuId s_PopupMenuEntitiesId; - UI()->DoPopupMenu(&s_PopupMenuEntitiesId, SettingsButton.x, SettingsButton.y + SettingsButton.h - 1.0f, 200.0f, 36.0f, this, PopupMenuSettings, IGraphics::CORNER_R | IGraphics::CORNER_B); + UI()->DoPopupMenu(&s_PopupMenuEntitiesId, SettingsButton.x, SettingsButton.y + SettingsButton.h - 1.0f, 200.0f, 64.0f, this, PopupMenuSettings, IGraphics::CORNER_R | IGraphics::CORNER_B); } CUIRect Info, Close; diff --git a/src/game/editor/popups.cpp b/src/game/editor/popups.cpp index 36ac30dac..c41f441df 100644 --- a/src/game/editor/popups.cpp +++ b/src/game/editor/popups.cpp @@ -232,6 +232,30 @@ 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); } + View.HSplitTop(2.0f, nullptr, &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, "Enable brush coloring", 10.0f, TEXTALIGN_ML); + static int s_ButtonNo = 0; + static int s_ButtonYes = 0; + if(pEditor->DoButton_ButtonDec(&s_ButtonNo, "No", !pEditor->m_BrushColorEnabled, &No, 0, "Disable brush coloring")) + { + pEditor->m_BrushColorEnabled = false; + } + if(pEditor->DoButton_ButtonInc(&s_ButtonYes, "Yes", pEditor->m_BrushColorEnabled, &Yes, 0, "Enable brush coloring")) + { + pEditor->m_BrushColorEnabled = true; + } + } + View.HSplitTop(2.0f, nullptr, &View); View.HSplitTop(12.0f, &Slot, &View); { @@ -256,6 +280,41 @@ CUI::EPopupMenuFunctionResult CEditor::PopupMenuSettings(void *pContext, CUIRect } } + View.HSplitTop(2.0f, nullptr, &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 Off, Dec, Hex; + Selector.VSplitLeft(Selector.w / 3.0f, &Off, &Selector); + Selector.VSplitMid(&Dec, &Hex); + + pEditor->UI()->DoLabel(&Label, "Show Info", 10.0f, TEXTALIGN_ML); + static int s_ButtonOff = 0; + static int s_ButtonDec = 0; + static int s_ButtonHex = 0; + if(pEditor->DoButton_ButtonDec(&s_ButtonOff, "Off", !pEditor->m_ShowTileInfo, &Off, 0, "Do not show tile information")) + { + pEditor->m_ShowTileInfo = false; + pEditor->m_ShowEnvelopePreview = SHOWENV_NONE; + } + if(pEditor->DoButton_Ex(&s_ButtonDec, "Dec", pEditor->m_ShowTileInfo && !pEditor->m_ShowTileHexInfo, &Dec, 0, "[ctrl+i] Show tile information", IGraphics::CORNER_NONE)) + { + pEditor->m_ShowTileInfo = true; + pEditor->m_ShowTileHexInfo = false; + pEditor->m_ShowEnvelopePreview = SHOWENV_NONE; + } + if(pEditor->DoButton_ButtonInc(&s_ButtonHex, "Hex", pEditor->m_ShowTileInfo && pEditor->m_ShowTileHexInfo, &Hex, 0, "[ctrl+shift+i] Show tile information in hexadecimal")) + { + pEditor->m_ShowTileInfo = true; + pEditor->m_ShowTileHexInfo = true; + pEditor->m_ShowEnvelopePreview = SHOWENV_NONE; + } + } + return CUI::POPUP_KEEP_OPEN; } @@ -1538,7 +1597,7 @@ CUI::EPopupMenuFunctionResult CEditor::PopupEvent(void *pContext, CUIRect View, else if(pEditor->m_PopupEventType == POPEVENT_PREVENTUNUSEDTILES) { pTitle = "Unused tiles disabled"; - pMessage = "Unused tiles can't be placed by default because they could get a use later and then destroy your map.\n\nActivate the 'Unused' switch to be able to place every tile."; + pMessage = "Unused tiles can't be placed by default because they could get a use later and then destroy your map.\n\nActivate the 'Allow Unused' setting to be able to place every tile."; } else if(pEditor->m_PopupEventType == POPEVENT_IMAGEDIV16) {