mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Merge #5998
5998: Fix Ctrl+F hotkey not checking for Ctrl key, minor improvement to tile details popup layout r=def- a=Robyt3 ## Checklist - [X] Tested the change ingame - [ ] Provided screenshots if it is a visual change - [ ] Tested in combination with possibly related configuration options - [ ] Written a unit test (especially base/) or added coverage to integration test - [ ] Considered possible null pointers and out of bounds array indexing - [ ] Changed no physics that affect existing maps - [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional) Co-authored-by: Robert Müller <robytemueller@gmail.com>
This commit is contained in:
commit
e71ce8fcde
|
@ -1112,15 +1112,10 @@ void CEditor::DoToolbar(CUIRect ToolBar)
|
|||
|
||||
// tile manipulation
|
||||
{
|
||||
static int s_BorderBut = 0;
|
||||
CLayerTiles *pT = (CLayerTiles *)GetSelectedLayerType(0, LAYERTYPE_TILES);
|
||||
|
||||
// no border for tele layer, speedup, front and switch
|
||||
if(pT && (pT->m_Tele || pT->m_Speedup || pT->m_Switch || pT->m_Front || pT->m_Tune))
|
||||
pT = nullptr;
|
||||
|
||||
if(pT)
|
||||
if(pT && !pT->m_Tele && !pT->m_Speedup && !pT->m_Switch && !pT->m_Front && !pT->m_Tune)
|
||||
{
|
||||
static int s_BorderBut = 0;
|
||||
TB_Bottom.VSplitLeft(60.0f, &Button, &TB_Bottom);
|
||||
if(DoButton_Ex(&s_BorderBut, "Border", 0, &Button, 0, "Place tiles in a 2-tile wide border at the edges of the layer", IGraphics::CORNER_ALL))
|
||||
{
|
||||
|
@ -1132,35 +1127,35 @@ void CEditor::DoToolbar(CUIRect ToolBar)
|
|||
|
||||
// do tele/tune/switch/speedup button
|
||||
{
|
||||
int (*pPopupFunc)(CEditor * peditor, CUIRect View, void *pContext) = nullptr;
|
||||
const char *pButtonName = nullptr;
|
||||
float Height = 0.0f;
|
||||
CLayerTiles *pS = (CLayerTiles *)GetSelectedLayerType(0, LAYERTYPE_TILES);
|
||||
if(pS)
|
||||
{
|
||||
const char *pButtonName = nullptr;
|
||||
int (*pfnPopupFunc)(CEditor * pEditor, CUIRect View, void *pContext) = nullptr;
|
||||
int Rows = 0;
|
||||
if(pS == m_Map.m_pSwitchLayer)
|
||||
{
|
||||
pButtonName = "Switch";
|
||||
pPopupFunc = PopupSwitch;
|
||||
Height = 36;
|
||||
pfnPopupFunc = PopupSwitch;
|
||||
Rows = 2;
|
||||
}
|
||||
else if(pS == m_Map.m_pSpeedupLayer)
|
||||
{
|
||||
pButtonName = "Speedup";
|
||||
pPopupFunc = PopupSpeedup;
|
||||
Height = 53;
|
||||
pfnPopupFunc = PopupSpeedup;
|
||||
Rows = 3;
|
||||
}
|
||||
else if(pS == m_Map.m_pTuneLayer)
|
||||
{
|
||||
pButtonName = "Tune";
|
||||
pPopupFunc = PopupTune;
|
||||
Height = 23;
|
||||
pfnPopupFunc = PopupTune;
|
||||
Rows = 1;
|
||||
}
|
||||
else if(pS == m_Map.m_pTeleLayer)
|
||||
{
|
||||
pButtonName = "Tele";
|
||||
pPopupFunc = PopupTele;
|
||||
Height = 23;
|
||||
pfnPopupFunc = PopupTele;
|
||||
Rows = 1;
|
||||
}
|
||||
|
||||
if(pButtonName != nullptr)
|
||||
|
@ -1175,7 +1170,7 @@ void CEditor::DoToolbar(CUIRect ToolBar)
|
|||
static int s_ModifierPopupID = 0;
|
||||
if(!UiPopupExists(&s_ModifierPopupID))
|
||||
{
|
||||
UiInvokePopupMenu(&s_ModifierPopupID, 0, Button.x, Button.y + Button.h, 120, Height, pPopupFunc);
|
||||
UiInvokePopupMenu(&s_ModifierPopupID, 0, Button.x, Button.y + Button.h, 120, 10.0f + Rows * 13.0f, pfnPopupFunc);
|
||||
}
|
||||
}
|
||||
TB_Bottom.VSplitLeft(5.0f, nullptr, &TB_Bottom);
|
||||
|
|
|
@ -1508,11 +1508,13 @@ int CEditor::PopupTele(CEditor *pEditor, CUIRect View, void *pContext)
|
|||
|
||||
View.VSplitRight(15.f, &NumberPicker, &FindEmptySlot);
|
||||
NumberPicker.VSplitRight(2.f, &NumberPicker, nullptr);
|
||||
FindEmptySlot.HSplitTop(13.0f, &FindEmptySlot, nullptr);
|
||||
FindEmptySlot.HMargin(1.0f, &FindEmptySlot);
|
||||
|
||||
// find empty number button
|
||||
{
|
||||
static int s_EmptySlotPid = 0;
|
||||
if(pEditor->DoButton_Editor(&s_EmptySlotPid, "F", 0, &FindEmptySlot, 0, "[ctrl+f] Find empty slot") || pEditor->Input()->KeyPress(KEY_F))
|
||||
if(pEditor->DoButton_Editor(&s_EmptySlotPid, "F", 0, &FindEmptySlot, 0, "[ctrl+f] Find empty slot") || (pEditor->Input()->ModifierIsPressed() && pEditor->Input()->KeyPress(KEY_F)))
|
||||
{
|
||||
int number = -1;
|
||||
for(int i = 1; i <= 255; i++)
|
||||
|
@ -1567,9 +1569,6 @@ int CEditor::PopupTele(CEditor *pEditor, CUIRect View, void *pContext)
|
|||
|
||||
int CEditor::PopupSpeedup(CEditor *pEditor, CUIRect View, void *pContext)
|
||||
{
|
||||
CUIRect Button;
|
||||
View.HSplitBottom(12.0f, &View, &Button);
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_FORCE = 0,
|
||||
|
@ -1606,16 +1605,15 @@ int CEditor::PopupSwitch(CEditor *pEditor, CUIRect View, void *pContext)
|
|||
CUIRect NumberPicker;
|
||||
CUIRect FindEmptySlot;
|
||||
|
||||
CUIRect DelayPicker;
|
||||
|
||||
View.HSplitMid(&NumberPicker, &DelayPicker);
|
||||
NumberPicker.VSplitRight(15.f, &NumberPicker, &FindEmptySlot);
|
||||
View.VSplitRight(15.f, &NumberPicker, &FindEmptySlot);
|
||||
NumberPicker.VSplitRight(2.f, &NumberPicker, nullptr);
|
||||
FindEmptySlot.HSplitTop(13.0f, &FindEmptySlot, nullptr);
|
||||
FindEmptySlot.HMargin(1.0f, &FindEmptySlot);
|
||||
|
||||
// find empty number button
|
||||
{
|
||||
static int s_EmptySlotPid = 0;
|
||||
if(pEditor->DoButton_Editor(&s_EmptySlotPid, "F", 0, &FindEmptySlot, 0, "[ctrl+f] Find empty slot") || pEditor->Input()->KeyPress(KEY_F))
|
||||
if(pEditor->DoButton_Editor(&s_EmptySlotPid, "F", 0, &FindEmptySlot, 0, "[ctrl+f] Find empty slot") || (pEditor->Input()->ModifierIsPressed() && pEditor->Input()->KeyPress(KEY_F)))
|
||||
{
|
||||
int number = -1;
|
||||
for(int i = 1; i <= 255; i++)
|
||||
|
@ -1676,9 +1674,6 @@ int CEditor::PopupSwitch(CEditor *pEditor, CUIRect View, void *pContext)
|
|||
|
||||
int CEditor::PopupTune(CEditor *pEditor, CUIRect View, void *pContext)
|
||||
{
|
||||
CUIRect Button;
|
||||
View.HSplitBottom(12.0f, &View, &Button);
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_TUNE = 0,
|
||||
|
@ -1702,12 +1697,6 @@ int CEditor::PopupTune(CEditor *pEditor, CUIRect View, void *pContext)
|
|||
|
||||
int CEditor::PopupGoto(CEditor *pEditor, CUIRect View, void *pContext)
|
||||
{
|
||||
CUIRect CoordXPicker;
|
||||
CUIRect CoordYPicker;
|
||||
|
||||
View.HSplitMid(&CoordXPicker, &CoordYPicker);
|
||||
CoordXPicker.VSplitRight(2.f, &CoordXPicker, nullptr);
|
||||
|
||||
static ColorRGBA s_Color = ColorRGBA(1, 1, 1, 0.5f);
|
||||
|
||||
enum
|
||||
|
@ -1725,7 +1714,7 @@ int CEditor::PopupGoto(CEditor *pEditor, CUIRect View, void *pContext)
|
|||
|
||||
static int s_aIds[NUM_PROPS] = {0};
|
||||
int NewVal = 0;
|
||||
int Prop = pEditor->DoProperties(&CoordXPicker, aProps, s_aIds, &NewVal, s_Color);
|
||||
int Prop = pEditor->DoProperties(&View, aProps, s_aIds, &NewVal, s_Color);
|
||||
|
||||
if(Prop == PROP_CoordX)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue