]> git.saurik.com Git - wxWidgets.git/commitdiff
Remove wxSplitterWindow::m_checkRequestedSashPosition.
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 30 Oct 2011 19:48:38 +0000 (19:48 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 30 Oct 2011 19:48:38 +0000 (19:48 +0000)
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
src/generic/splitter.cpp

index 2b75bb1d98356ac514f723e47ea6b716c9283e7e..d334922dd2b69f723c92eb5c2733614328adbf03 100644 (file)
@@ -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)
index c5833830c88af4e8c57ef231d6f8178780c7cc33..1b8025182f3fa9c051ee6a719b09a7f25b5a83d0 100644 (file)
@@ -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)