From 31174267f861bac32def6f023cfc718fa40a777d Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 30 Oct 2011 19:48:38 +0000 Subject: [PATCH] Remove wxSplitterWindow::m_checkRequestedSashPosition. This variable seemed to be redundant with m_requestedSashPosition being set to INT_MAX so harmonise the code to always check for the latter and get rid of the former. There should be no observable changes in behaviour. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69597 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/generic/splitter.h | 1 - src/generic/splitter.cpp | 30 ++++++++++++++---------------- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/include/wx/generic/splitter.h b/include/wx/generic/splitter.h index 2b75bb1d98..d334922dd2 100644 --- a/include/wx/generic/splitter.h +++ b/include/wx/generic/splitter.h @@ -294,7 +294,6 @@ protected: bool m_needUpdating:1; bool m_permitUnsplitAlways:1; bool m_isHot:1; - bool m_checkRequestedSashPosition:1; private: DECLARE_DYNAMIC_CLASS(wxSplitterWindow) diff --git a/src/generic/splitter.cpp b/src/generic/splitter.cpp index c5833830c8..1b8025182f 100644 --- a/src/generic/splitter.cpp +++ b/src/generic/splitter.cpp @@ -118,10 +118,10 @@ void wxSplitterWindow::Init() m_oldX = 0; m_oldY = 0; m_sashStart = 0; - m_sashPosition = m_requestedSashPosition = 0; + m_sashPosition = 0; + m_requestedSashPosition = INT_MAX; m_sashGravity = 0.0; m_lastSize = wxSize(0,0); - m_checkRequestedSashPosition = false; m_minimumPaneSize = 0; m_sashCursorWE = wxCursor(wxCURSOR_SIZEWE); m_sashCursorNS = wxCursor(wxCURSOR_SIZENS); @@ -193,20 +193,21 @@ void wxSplitterWindow::OnInternalIdle() { wxWindow::OnInternalIdle(); - // if this is the first idle time after a sash position has potentially - // been set, allow SizeWindows to check for a requested size. - if (!m_checkRequestedSashPosition) + // We may need to update the children sizes in two cases: either because + // we're in the middle of a live update as indicated by m_needUpdating or + // because we have a requested but not yet set sash position as indicated + // by m_requestedSashPosition having a valid value. + if ( m_needUpdating ) { - m_checkRequestedSashPosition = true; - SizeWindows(); - return; // it won't needUpdating in this case + m_needUpdating = false; } - - if (m_needUpdating) + else if ( m_requestedSashPosition == INT_MAX ) { - m_needUpdating = false; - SizeWindows(); + // We don't need to resize the children. + return; } + + SizeWindows(); } void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event) @@ -646,7 +647,7 @@ void wxSplitterWindow::SetSashPositionAndNotify(int sashPos) void wxSplitterWindow::SizeWindows() { // check if we have delayed setting the real sash position - if ( m_checkRequestedSashPosition && m_requestedSashPosition != INT_MAX ) + if ( m_requestedSashPosition != INT_MAX ) { int newSashPosition = ConvertSashPosition(m_requestedSashPosition); if ( newSashPosition != m_sashPosition ) @@ -847,7 +848,6 @@ void wxSplitterWindow::SetSashPosition(int position, bool redraw) // remember the sash position we want to set for later if we can't set it // right now (e.g. because the window is too small) m_requestedSashPosition = position; - m_checkRequestedSashPosition = false; DoSetSashPosition(ConvertSashPosition(position)); @@ -862,9 +862,7 @@ void wxSplitterWindow::SetSashPosition(int position, bool redraw) // window is shown, if you know the overall size is correct. void wxSplitterWindow::UpdateSize() { - m_checkRequestedSashPosition = true; SizeWindows(); - m_checkRequestedSashPosition = false; } bool wxSplitterWindow::DoSendEvent(wxSplitterEvent& event) -- 2.45.2