Mercurial > hg > svgui
changeset 687:502fe55c2184 tonioni
If any panes have a fixed size, respect that when resizing pane stack sizes
author | Chris Cannam |
---|---|
date | Fri, 29 Nov 2013 14:50:33 +0000 |
parents | f46da276b21c |
children | 212644efa523 |
files | view/PaneStack.cpp |
diffstat | 1 files changed, 24 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- 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); } -