Optimize wxGenericColourDialog

Variable to hold the size of the custom colour box doesn't need to be a member variable since it's used only locally in wxGenericColourDialog::CalculateMeasurements.
This commit is contained in:
Artur Wieczorek
2015-10-24 11:45:57 +02:00
parent 6af5329710
commit 7399fb3428
2 changed files with 5 additions and 9 deletions

View File

@@ -77,9 +77,6 @@ protected:
// Size of each colour rectangle
wxPoint m_smallRectangleSize;
// For single customizable colour
wxPoint m_customRectangleSize;
// Grid spacing (between rectangles)
int m_gridSpacing;

View File

@@ -204,10 +204,11 @@ void wxGenericColourDialog::OnPaint(wxPaintEvent& WXUNUSED(event))
void wxGenericColourDialog::CalculateMeasurements()
{
// For single customizable colour
const wxSize customRectangleSize(40, 40);
m_smallRectangleSize.x = 18;
m_smallRectangleSize.y = 14;
m_customRectangleSize.x = 40;
m_customRectangleSize.y = 40;
m_gridSpacing = 6;
m_sectionSpacing = 15;
@@ -224,8 +225,7 @@ void wxGenericColourDialog::CalculateMeasurements()
m_singleCustomColourRect.x = m_customColoursRect.width + m_customColoursRect.x + m_sectionSpacing;
m_singleCustomColourRect.y = 80;
m_singleCustomColourRect.width = m_customRectangleSize.x;
m_singleCustomColourRect.height = m_customRectangleSize.y;
m_singleCustomColourRect.SetSize(customRectangleSize);
m_okButtonX = 10;
m_customButtonX = m_singleCustomColourRect.x ;
@@ -447,8 +447,7 @@ void wxGenericColourDialog::PaintCustomColour(wxDC& dc)
wxBrush *brush = new wxBrush(m_colourData.m_dataColour);
dc.SetBrush(*brush);
dc.DrawRectangle( m_singleCustomColourRect.x, m_singleCustomColourRect.y,
m_customRectangleSize.x, m_customRectangleSize.y);
dc.DrawRectangle(m_singleCustomColourRect);
dc.SetBrush(wxNullBrush);
delete brush;