# HG changeset patch # User Chris Cannam # Date 1385736633 0 # Node ID 502fe55c21840e4ecda952c8114ce60050089c65 # Parent f46da276b21cd00116a9004afb4665b30eb58523 If any panes have a fixed size, respect that when resizing pane stack sizes diff -r f46da276b21c -r 502fe55c2184 view/PaneStack.cpp --- a/view/PaneStack.cpp Thu Nov 28 16:49:30 2013 +0000 +++ b/view/PaneStack.cpp Fri Nov 29 14:50:33 2013 +0000 @@ -580,24 +580,44 @@ int count = sizes.size(); - int total = 0; + int fixed = 0, variable = 0, total = 0; + int varicount = 0; + for (int i = 0; i < count; ++i) { total += sizes[i]; } + variable = total; + + for (int i = 0; i < count; ++i) { + int minh = m_panes[i].pane->minimumSize().height(); + if (minh == m_panes[i].pane->maximumSize().height()) { + fixed += minh; + variable -= minh; + } else { + varicount++; + } + } + if (total == 0) return; sizes.clear(); - int each = total / count; + int each = (varicount > 0 ? (variable / varicount) : 0); int remaining = total; for (int i = 0; i < count; ++i) { if (i == count - 1) { sizes.push_back(remaining); } else { - sizes.push_back(each); - remaining -= each; + int minh = m_panes[i].pane->minimumSize().height(); + if (minh == m_panes[i].pane->maximumSize().height()) { + sizes.push_back(minh); + remaining -= minh; + } else { + sizes.push_back(each); + remaining -= each; + } } } @@ -612,4 +632,3 @@ m_splitter->setSizes(sizes); } -