replaced second enum

This commit is contained in:
Tarun Samanta 2023-05-22 18:16:25 +05:30
parent 79d8928a03
commit ef78e36c6f
4 changed files with 31 additions and 27 deletions

View file

@ -889,26 +889,26 @@ void CEditor::DoToolbar(CUIRect ToolBar)
// 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;
if(m_ShowTileInfo == SHOW_TILE_HEXADECIMAL)
m_ShowTileInfo = SHOW_TILE_OFF;
else if(m_ShowTileInfo != SHOW_TILE_OFF)
m_ShowTileInfo = SHOW_TILE_OFF;
else
m_ShowTileInfo = true;
m_ShowTileInfo = !SHOW_TILE_OFF;
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;
if(m_ShowTileInfo == SHOW_TILE_HEXADECIMAL)
m_ShowTileInfo = SHOW_TILE_OFF;
else if(m_ShowTileInfo != SHOW_TILE_OFF)
m_ShowTileInfo = !SHOW_TILE_OFF;
else
{
m_ShowTileInfo = true;
m_ShowTileHexInfo = true;
m_ShowTileInfo = !SHOW_TILE_OFF;
m_ShowTileInfo = SHOW_TILE_HEXADECIMAL;
}
m_ShowEnvelopePreview = SHOWENV_NONE;
}
@ -2301,7 +2301,7 @@ void CEditor::DoMapEditor(CUIRect View)
}
CLayerTiles *pT = static_cast<CLayerTiles *>(GetSelectedLayerType(0, LAYERTYPE_TILES));
if(m_ShowTileInfo && pT && pT->m_Visible && m_Zoom <= 300.0f)
if(m_ShowTileInfo != SHOW_TILE_OFF && pT && pT->m_Visible && m_Zoom <= 300.0f)
{
GetSelectedGroup()->MapScreen();
pT->ShowInfo();
@ -2372,7 +2372,7 @@ void CEditor::DoMapEditor(CUIRect View)
m_TilesetPicker.Render(true);
if(m_ShowTileInfo)
if(m_ShowTileInfo != SHOW_TILE_OFF)
m_TilesetPicker.ShowInfo();
}
else
@ -3025,7 +3025,7 @@ void CEditor::DoMapEditor(CUIRect View)
}
}
if(!m_ShowPicker && m_ShowTileInfo && m_ShowEnvelopePreview != SHOWENV_NONE && GetSelectedLayer(0) && GetSelectedLayer(0)->m_Type == LAYERTYPE_QUADS)
if(!m_ShowPicker && m_ShowTileInfo != SHOW_TILE_OFF && m_ShowEnvelopePreview != SHOWENV_NONE && GetSelectedLayer(0) && GetSelectedLayer(0)->m_Type == LAYERTYPE_QUADS)
{
GetSelectedGroup()->MapScreen();

View file

@ -800,7 +800,7 @@ public:
m_CurrentMenuProofIndex = 0;
m_PreviewZoom = false;
m_ShowTileInfo = false;
m_ShowTileInfo = SHOW_TILE_OFF;
m_ShowDetail = true;
m_Animate = false;
m_AnimateStart = 0;
@ -837,7 +837,7 @@ public:
m_PreventUnusedTilesWasWarned = false;
m_AllowPlaceUnusedTiles = 0;
m_BrushDrawDestructive = true;
m_ShowTileHexInfo = false;
m_ShowTileInfo = SHOW_TILE_OFF;
m_Mentions = 0;
}
@ -918,7 +918,6 @@ public:
bool m_PreventUnusedTilesWasWarned;
int m_AllowPlaceUnusedTiles;
bool m_BrushDrawDestructive;
bool m_ShowTileHexInfo;
int m_Mentions;
@ -1060,7 +1059,14 @@ public:
float m_MouseDeltaWx;
float m_MouseDeltaWy;
bool m_ShowTileInfo;
enum EShowTile
{
SHOW_TILE_OFF,
SHOW_TILE_DECIMAL,
SHOW_TILE_HEXADECIMAL
};
EShowTile m_ShowTileInfo;
bool m_ShowDetail;
bool m_Animate;
int64_t m_AnimateStart;

View file

@ -651,7 +651,7 @@ void CLayerTiles::ShowInfo()
if(m_pTiles[c].m_Index)
{
char aBuf[64];
str_format(aBuf, sizeof(aBuf), m_pEditor->m_ShowTileHexInfo ? "%02X" : "%i", m_pTiles[c].m_Index);
str_format(aBuf, sizeof(aBuf), m_pEditor->m_ShowTileInfo == SHOW_TILE_HEXADECIMAL ? "%02X" : "%i", m_pTiles[c].m_Index);
m_pEditor->Graphics()->QuadsText(x * 32, y * 32, 16.0f, aBuf);
char aFlags[4] = {m_pTiles[c].m_Flags & TILEFLAG_XFLIP ? 'X' : ' ',

View file

@ -293,21 +293,19 @@ CUI::EPopupMenuFunctionResult CEditor::PopupMenuSettings(void *pContext, CUIRect
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"))
if(pEditor->DoButton_ButtonDec(&s_ButtonOff, "Off", pEditor->m_ShowTileInfo == SHOW_TILE_DECIMAL, &Off, 0, "Do not show tile information"))
{
pEditor->m_ShowTileInfo = false;
pEditor->m_ShowTileInfo = SHOW_TILE_DECIMAL;
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))
if(pEditor->DoButton_Ex(&s_ButtonDec, "Dec", pEditor->m_ShowTileInfo == SHOW_TILE_DECIMAL , &Dec, 0, "[ctrl+i] Show tile information", IGraphics::CORNER_NONE))
{
pEditor->m_ShowTileInfo = true;
pEditor->m_ShowTileHexInfo = false;
pEditor->m_ShowTileInfo = SHOW_TILE_DECIMAL;
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"))
if(pEditor->DoButton_ButtonInc(&s_ButtonHex, "Hex", pEditor->m_ShowTileInfo == SHOW_TILE_DECIMAL, &Hex, 0, "[ctrl+shift+i] Show tile information in hexadecimal"))
{
pEditor->m_ShowTileInfo = true;
pEditor->m_ShowTileHexInfo = true;
pEditor->m_ShowTileInfo = SHOW_TILE_DECIMAL;
pEditor->m_ShowEnvelopePreview = SHOWENV_NONE;
}
}