Simplify wxGrid best size computations

Remove needless subtraction of row/column label size before adding it
back again, as this seems completely unnecessary.

No real changes, this is just a simplification.
This commit is contained in:
Vadim Zeitlin
2020-05-31 16:09:29 +02:00
parent 789c7cec7b
commit eac58e7f87

View File

@@ -10248,8 +10248,8 @@ void wxGrid::AutoSize()
{ {
wxGridUpdateLocker locker(this); wxGridUpdateLocker locker(this);
wxSize size(SetOrCalcColumnSizes(false) - m_rowLabelWidth + m_extraWidth, wxSize size(SetOrCalcColumnSizes(false) + m_extraWidth,
SetOrCalcRowSizes(false) - m_colLabelHeight + m_extraHeight); SetOrCalcRowSizes(false) + m_extraHeight);
// we know that we're not going to have scrollbars so disable them now to // we know that we're not going to have scrollbars so disable them now to
// avoid trouble in SetClientSize() which can otherwise set the correct // avoid trouble in SetClientSize() which can otherwise set the correct
@@ -10257,7 +10257,7 @@ void wxGrid::AutoSize()
SetScrollbars(m_xScrollPixelsPerLine, m_yScrollPixelsPerLine, SetScrollbars(m_xScrollPixelsPerLine, m_yScrollPixelsPerLine,
0, 0, 0, 0, true); 0, 0, 0, 0, true);
SetClientSize(size.x + m_rowLabelWidth, size.y + m_colLabelHeight); SetClientSize(size);
} }
void wxGrid::AutoSizeRowLabelSize( int row ) void wxGrid::AutoSizeRowLabelSize( int row )
@@ -10298,11 +10298,10 @@ wxSize wxGrid::DoGetBestSize() const
// we do the same as in AutoSize() here with the exception that we don't // we do the same as in AutoSize() here with the exception that we don't
// change the column/row sizes, only calculate them // change the column/row sizes, only calculate them
wxSize size(self->SetOrCalcColumnSizes(true) - m_rowLabelWidth + m_extraWidth, wxSize size(self->SetOrCalcColumnSizes(true) + m_extraWidth,
self->SetOrCalcRowSizes(true) - m_colLabelHeight + m_extraHeight); self->SetOrCalcRowSizes(true) + m_extraHeight);
return wxSize(size.x + m_rowLabelWidth, size.y + m_colLabelHeight) return size + GetWindowBorderSize();
+ GetWindowBorderSize();
} }
void wxGrid::Fit() void wxGrid::Fit()