From: Benjamin Williams Date: Fri, 27 Mar 2009 12:47:37 +0000 (+0000) Subject: pane sizes within a dock are not allowed to exceed the dock's entire current pixel... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/cd67553cf4f42ea9a0da95b744fd88174e904dc9 pane sizes within a dock are not allowed to exceed the dock's entire current pixel size git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59884 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/aui/framemanager.cpp b/src/aui/framemanager.cpp index af264592a2..43eedec252 100644 --- a/src/aui/framemanager.cpp +++ b/src/aui/framemanager.cpp @@ -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);