Merge pull request #1476 from ddnet/remove-save

Remove save group/layer button (fixes #1475)
This commit is contained in:
Dennis Felsing 2019-03-11 22:58:40 +01:00 committed by GitHub
commit f0cce859ef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 25 deletions

View file

@ -120,7 +120,6 @@ CLayerGroup::CLayerGroup()
{
m_aName[0] = 0;
m_Visible = true;
m_SaveToMap = true;
m_Collapse = false;
m_GameGroup = false;
m_OffsetX = 0;
@ -139,7 +138,6 @@ CLayerGroup::CLayerGroup(const CLayerGroup& rhs)
{
str_copy(m_aName, rhs.m_aName, sizeof m_aName);
m_Visible = rhs.m_Visible;
m_SaveToMap = rhs.m_SaveToMap;
m_Collapse = rhs.m_Collapse;
m_GameGroup = rhs.m_GameGroup;
m_OffsetX = rhs.m_OffsetX;
@ -3264,7 +3262,7 @@ void CEditor::RenderLayers(CUIRect ToolBox, CUIRect View)
continue;
}
CUIRect VisibleToggle, SaveCheck;
CUIRect VisibleToggle;
if(LayerCur >= LayerStartAt)
{
LayersBox.HSplitTop(12.0f, &Slot, &LayersBox);
@ -3272,17 +3270,12 @@ void CEditor::RenderLayers(CUIRect ToolBox, CUIRect View)
if(DoButton_Ex(&m_Map.m_lGroups[g]->m_Visible, m_Map.m_lGroups[g]->m_Visible?"V":"H", m_Map.m_lGroups[g]->m_Collapse ? 1 : 0, &VisibleToggle, 0, "Toggle group visibility", CUI::CORNER_L))
m_Map.m_lGroups[g]->m_Visible = !m_Map.m_lGroups[g]->m_Visible;
Slot.VSplitRight(12.0f, &Slot, &SaveCheck);
if(DoButton_Ex(&m_Map.m_lGroups[g]->m_SaveToMap, "S", m_Map.m_lGroups[g]->m_SaveToMap, &SaveCheck, 0, "Enable/disable group for saving", CUI::CORNER_R))
if(!m_Map.m_lGroups[g]->m_GameGroup)
m_Map.m_lGroups[g]->m_SaveToMap = !m_Map.m_lGroups[g]->m_SaveToMap;
str_format(aBuf, sizeof(aBuf),"#%d %s", g, m_Map.m_lGroups[g]->m_aName);
float FontSize = 10.0f;
while(TextRender()->TextWidth(0, FontSize, aBuf, -1) > Slot.w)
FontSize--;
if(int Result = DoButton_Ex(&m_Map.m_lGroups[g], aBuf, g==m_SelectedGroup, &Slot,
BUTTON_CONTEXT, m_Map.m_lGroups[g]->m_Collapse ? "Select group. Shift click to select all layers. Double click to expand." : "Select group. Shift click to select all layers. Double click to collapse.", 0, FontSize))
BUTTON_CONTEXT, m_Map.m_lGroups[g]->m_Collapse ? "Select group. Shift click to select all layers. Double click to expand." : "Select group. Shift click to select all layers. Double click to collapse.", CUI::CORNER_R, FontSize))
{
m_SelectedGroup = g;
SelectLayer(0);
@ -3326,11 +3319,6 @@ void CEditor::RenderLayers(CUIRect ToolBox, CUIRect View)
if(DoButton_Ex(&m_Map.m_lGroups[g]->m_lLayers[i]->m_Visible, m_Map.m_lGroups[g]->m_lLayers[i]->m_Visible?"V":"H", 0, &VisibleToggle, 0, "Toggle layer visibility", CUI::CORNER_L))
m_Map.m_lGroups[g]->m_lLayers[i]->m_Visible = !m_Map.m_lGroups[g]->m_lLayers[i]->m_Visible;
Button.VSplitRight(12.0f, &Button, &SaveCheck);
if(DoButton_Ex(&m_Map.m_lGroups[g]->m_lLayers[i]->m_SaveToMap, "S", m_Map.m_lGroups[g]->m_lLayers[i]->m_SaveToMap, &SaveCheck, 0, "Enable/disable layer for saving", CUI::CORNER_R))
if(m_Map.m_lGroups[g]->m_lLayers[i] != m_Map.m_pGameLayer)
m_Map.m_lGroups[g]->m_lLayers[i]->m_SaveToMap = !m_Map.m_lGroups[g]->m_lLayers[i]->m_SaveToMap;
if(m_Map.m_lGroups[g]->m_lLayers[i]->m_aName[0])
str_format(aBuf, sizeof(aBuf), "%s", m_Map.m_lGroups[g]->m_lLayers[i]->m_aName);
else if(m_Map.m_lGroups[g]->m_lLayers[i]->m_Type == LAYERTYPE_TILES)
@ -3363,7 +3351,7 @@ void CEditor::RenderLayers(CUIRect ToolBox, CUIRect View)
Checked += 6;
}
if(int Result = DoButton_Ex(m_Map.m_lGroups[g]->m_lLayers[i], aBuf, Checked, &Button,
BUTTON_CONTEXT, "Select layer. Shift click to select multiple.", 0, FontSize))
BUTTON_CONTEXT, "Select layer. Shift click to select multiple.", CUI::CORNER_R, FontSize))
{
if ((Input()->KeyIsPressed(KEY_LSHIFT) || Input()->KeyIsPressed(KEY_RSHIFT)) && m_SelectedGroup == g)
{
@ -3394,7 +3382,7 @@ void CEditor::RenderLayers(CUIRect ToolBox, CUIRect View)
LayersBox.HSplitTop(12.0f, &Slot, &LayersBox);
static int s_NewGroupButton = 0;
if(DoButton_Editor(&s_NewGroupButton, "Add group", 0, &Slot, 0, "Adds a new group"))
if(DoButton_Editor(&s_NewGroupButton, "Add group", 0, &Slot, CUI::CORNER_R, "Adds a new group"))
{
m_Map.NewGroup();
m_SelectedGroup = m_Map.m_lGroups.size()-1;

View file

@ -135,7 +135,6 @@ public:
str_copy(m_aName, "(invalid)", sizeof(m_aName));
m_Visible = true;
m_Readonly = false;
m_SaveToMap = true;
m_Flags = 0;
m_pEditor = 0;
m_BrushRefCount = 0;
@ -170,7 +169,6 @@ public:
bool m_Readonly;
bool m_Visible;
bool m_SaveToMap;
int m_BrushRefCount;
};
@ -197,7 +195,6 @@ public:
char m_aName[12];
bool m_GameGroup;
bool m_Visible;
bool m_SaveToMap;
bool m_Collapse;
CLayerGroup();

View file

@ -357,9 +357,6 @@ int CEditorMap::Save(class IStorage *pStorage, const char *pFileName)
for(int g = 0; g < m_lGroups.size(); g++)
{
CLayerGroup *pGroup = m_lGroups[g];
if(!pGroup->m_SaveToMap)
continue;
CMapItemGroup GItem;
GItem.m_Version = CMapItemGroup::CURRENT_VERSION;
@ -380,9 +377,6 @@ int CEditorMap::Save(class IStorage *pStorage, const char *pFileName)
for(int l = 0; l < pGroup->m_lLayers.size(); l++)
{
if(!pGroup->m_lLayers[l]->m_SaveToMap)
continue;
if(pGroup->m_lLayers[l]->m_Type == LAYERTYPE_TILES)
{
m_pEditor->Console()->Print(IConsole::OUTPUT_LEVEL_ADDINFO, "editor", "saving tiles layer");