]> git.saurik.com Git - wxWidgets.git/commitdiff
pane sizes within a dock are not allowed to exceed the dock's entire current pixel...
authorBenjamin Williams <bwilliams@kirix.com>
Fri, 27 Mar 2009 12:47:37 +0000 (12:47 +0000)
committerBenjamin Williams <bwilliams@kirix.com>
Fri, 27 Mar 2009 12:47:37 +0000 (12:47 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59884 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/aui/framemanager.cpp

index af264592a2566dda2eb756c2ea76f19a985a486e..43eedec2525a6b3cc96e6f241e26cab470241e9e 100644 (file)
@@ -4140,6 +4140,11 @@ bool wxAuiManager::DoEndResizeAction(wxMouseEvent& event)
             }
         }
 
+        // new size can never be more than the number of dock pixels
+        if (new_pixsize > dock_pixels)
+            new_pixsize = dock_pixels;
+
+
         // find a pane in our dock to 'steal' space from or to 'give'
         // space to -- this is essentially what is done when a pane is
         // resized; the pane should usually be the first non-fixed pane
@@ -4166,7 +4171,7 @@ bool wxAuiManager::DoEndResizeAction(wxMouseEvent& event)
             m_action = actionNone;
             return false;
         }
-
+        
         // calculate the new proportion of the pane
         int new_proportion = (new_pixsize*total_proportion)/dock_pixels;
 
@@ -4214,10 +4219,26 @@ bool wxAuiManager::DoEndResizeAction(wxMouseEvent& event)
         int prop_diff = new_proportion - pane.dock_proportion;
 
         // borrow the space from our neighbor pane to the
-        // right or bottom (depending on orientation)
-        dock.panes.Item(borrow_pane)->dock_proportion -= prop_diff;
+        // right or bottom (depending on orientation);
+        // also make sure we don't make the neighbor too small
+        int prop_borrow = dock.panes.Item(borrow_pane)->dock_proportion;
+
+        if (prop_borrow - prop_diff < 0)
+        {
+            // borrowing from other pane would make it too small,
+            // so cancel the resize operation
+            prop_borrow = min_proportion;
+        }
+         else
+        {
+            prop_borrow -= prop_diff;
+        }
+
+        
+        dock.panes.Item(borrow_pane)->dock_proportion = prop_borrow;
         pane.dock_proportion = new_proportion;
 
+
         // repaint
         Update();
         Repaint(NULL);