Skip to content

Commit

Permalink
correctly clears selected brush if that brush is deleted
Browse files Browse the repository at this point in the history
  • Loading branch information
cstamford committed Feb 1, 2014
1 parent 0a6941f commit dc44b1e
Showing 1 changed file with 37 additions and 25 deletions.
62 changes: 37 additions & 25 deletions Starstructor/GUI/MainWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -378,31 +378,42 @@ public void UpdateBottomBar(int gridX, int gridY)

public void SetSelectedBrush(EditorBrush brush)
{
m_selectedBrush = brush;
string colour = m_selectedBrush.Colour.ToString();

// Tidy this display up at some point
BottomBarBrushLabel.Text = m_selectedBrush.Comment;

if (m_selectedBrush.FrontAsset != null)
{
BottomBarBrushLabel.Text += " front: " + m_selectedBrush.FrontAsset.ToString();
}

if (m_selectedBrush.BackAsset != null)
{
BottomBarBrushLabel.Text += " back: " + m_selectedBrush.BackAsset.ToString();
}

BottomBarBrushLabel.Text += " " + colour;

// Populate the colour box
VisualRgbaBrushImageBox.Image = EditorHelpers.GetGeneratedRectangle(1, 1,
m_selectedBrush.Colour.R, m_selectedBrush.Colour.G,
m_selectedBrush.Colour.B, m_selectedBrush.Colour.A);

VisualGraphicBrushImageBox.Image = m_selectedBrush.GetAssetPreview();

m_selectedBrush = brush;

if (brush != null)
{
string colour = m_selectedBrush.Colour.ToString();

// Tidy this display up at some point
BottomBarBrushLabel.Text = m_selectedBrush.Comment;

if (m_selectedBrush.FrontAsset != null)
{
BottomBarBrushLabel.Text += " front: " + m_selectedBrush.FrontAsset.ToString();
}

if (m_selectedBrush.BackAsset != null)
{
BottomBarBrushLabel.Text += " back: " + m_selectedBrush.BackAsset.ToString();
}

BottomBarBrushLabel.Text += " " + colour;

// Populate the colour box
VisualRgbaBrushImageBox.Image = EditorHelpers.GetGeneratedRectangle(1, 1,
m_selectedBrush.Colour.R, m_selectedBrush.Colour.G,
m_selectedBrush.Colour.B, m_selectedBrush.Colour.A);

VisualGraphicBrushImageBox.Image = m_selectedBrush.GetAssetPreview();
}
else
{
Image white = EditorHelpers.GetGeneratedRectangle(1, 1, 255, 255, 255, 255);
BottomBarBrushLabel.Text = "";
VisualRgbaBrushImageBox.Image = white;
VisualGraphicBrushImageBox.Image = white;
}

MainPictureBox.SetSelectedBrush(m_selectedBrush);
UpdatePropertiesPanel();
}
Expand Down Expand Up @@ -1175,6 +1186,7 @@ private void deleteBrushToolStripMenuItem_Click(object sender, EventArgs e)
part.UpdateCompositeCollisionMap();
}

SetSelectedBrush(null);
SelectedMap = SelectedMap;
}
}
Expand Down

0 comments on commit dc44b1e

Please sign in to comment.