From eac58e7f874a2cf3b0651257a1dba896b035b442 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 31 May 2020 16:09:29 +0200 Subject: [PATCH] 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. --- src/generic/grid.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index f6ed381ba2..266107031a 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -10248,8 +10248,8 @@ void wxGrid::AutoSize() { wxGridUpdateLocker locker(this); - wxSize size(SetOrCalcColumnSizes(false) - m_rowLabelWidth + m_extraWidth, - SetOrCalcRowSizes(false) - m_colLabelHeight + m_extraHeight); + wxSize size(SetOrCalcColumnSizes(false) + m_extraWidth, + SetOrCalcRowSizes(false) + m_extraHeight); // 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 @@ -10257,7 +10257,7 @@ void wxGrid::AutoSize() SetScrollbars(m_xScrollPixelsPerLine, m_yScrollPixelsPerLine, 0, 0, 0, 0, true); - SetClientSize(size.x + m_rowLabelWidth, size.y + m_colLabelHeight); + SetClientSize(size); } 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 // change the column/row sizes, only calculate them - wxSize size(self->SetOrCalcColumnSizes(true) - m_rowLabelWidth + m_extraWidth, - self->SetOrCalcRowSizes(true) - m_colLabelHeight + m_extraHeight); + wxSize size(self->SetOrCalcColumnSizes(true) + m_extraWidth, + self->SetOrCalcRowSizes(true) + m_extraHeight); - return wxSize(size.x + m_rowLabelWidth, size.y + m_colLabelHeight) - + GetWindowBorderSize(); + return size + GetWindowBorderSize(); } void wxGrid::Fit()