mirror of
https://github.com/ddnet/ddnet.git
synced 2024-09-19 17:14:18 +00:00
Add confirm to layer deletion quick action
This commit is contained in:
parent
4874f75bc0
commit
485be781ae
|
@ -591,7 +591,8 @@ public:
|
|||
POPEVENT_PLACE_BORDER_TILES,
|
||||
POPEVENT_PIXELART_BIG_IMAGE,
|
||||
POPEVENT_PIXELART_MANY_COLORS,
|
||||
POPEVENT_PIXELART_TOO_MANY_COLORS
|
||||
POPEVENT_PIXELART_TOO_MANY_COLORS,
|
||||
POPEVENT_DELETE_LAYER
|
||||
};
|
||||
|
||||
int m_PopupEventType;
|
||||
|
|
|
@ -2035,6 +2035,11 @@ CUi::EPopupMenuFunctionResult CEditor::PopupEvent(void *pContext, CUIRect View,
|
|||
pTitle = "Too many colors";
|
||||
pMessage = "The client only supports 64 images but more would be needed to add the selected image as tileart.";
|
||||
}
|
||||
else if(pEditor->m_PopupEventType == POPEVENT_DELETE_LAYER)
|
||||
{
|
||||
pTitle = "Delete layer";
|
||||
pMessage = "This action can not be reverted.\n\nContinue anyway?";
|
||||
}
|
||||
else
|
||||
{
|
||||
dbg_assert(false, "m_PopupEventType invalid");
|
||||
|
@ -2141,6 +2146,10 @@ CUi::EPopupMenuFunctionResult CEditor::PopupEvent(void *pContext, CUIRect View,
|
|||
{
|
||||
pEditor->AddTileart();
|
||||
}
|
||||
else if(pEditor->m_PopupEventType == POPEVENT_DELETE_LAYER)
|
||||
{
|
||||
pEditor->DeleteSelectedLayer();
|
||||
}
|
||||
pEditor->m_PopupEventWasActivated = false;
|
||||
return CUi::POPUP_CLOSE_CURRENT;
|
||||
}
|
||||
|
|
|
@ -279,7 +279,13 @@ REGISTER_QUICK_ACTION(
|
|||
REGISTER_QUICK_ACTION(
|
||||
DeleteLayer,
|
||||
"Delete layer",
|
||||
[&]() { DeleteSelectedLayer(); },
|
||||
[&]() {
|
||||
if(!m_PopupEventWasActivated)
|
||||
{
|
||||
m_PopupEventType = POPEVENT_DELETE_LAYER;
|
||||
m_PopupEventActivated = true;
|
||||
}
|
||||
},
|
||||
[&]() -> bool {
|
||||
std::shared_ptr<CLayer> pCurrentLayer = GetSelectedLayer(0);
|
||||
if(!pCurrentLayer)
|
||||
|
|
Loading…
Reference in a new issue