size of relative items in toolbar wasn't being calculated properly

This commit is contained in:
markt 2007-03-19 05:03:12 +00:00
parent b3f7488a8d
commit 063468ea66
2 changed files with 12 additions and 15 deletions

View file

@ -1,5 +1,8 @@
(Format: Year/Month/Day)
Changes for 1.0rc3:
*07/03/19:
* Fixed some problems with toolbar sizing (Mark + thanks Julien Trolet)
Toolbar.cc
*07/03/18:
* Changed position remembering so it only remembers position relative to the
current head (Mark)

View file

@ -976,7 +976,6 @@ void Toolbar::rearrangeItems() {
ItemList::iterator item_it_end = m_item_list.end();
int bevel_width = theme().bevelWidth();
int fixed_width = bevel_width; // combined size of all fixed items
int fixed_items = 0; // number of fixed items
int relative_items = 0;
int last_bw = 0; // we show the largest border of adjoining items
bool first = true;
@ -1013,28 +1012,23 @@ void Toolbar::rearrangeItems() {
if ((*item_it)->type() == ToolbarItem::FIXED) {
fixed_width += tmpw;
fixed_items++;
} else if ((*item_it)->type() == ToolbarItem::SQUARE) {
fixed_width += tmph;
//if (bevel_width != 0) fixed_width -= 2*borderW;
fixed_items++;
fixed_width += height;
if (bevel_width)
fixed_width -= 2*(borderW + bevel_width);
} else {
relative_items++;
}
}
// calculate what's going to be le ft over to the relative sized items
// calculate what's going to be left over to the relative sized items
int relative_width = 0;
int rounding_error = 0;
if (fixed_items == 0) // no fixed items, then the rest is the entire width
relative_width = width;
else {
if (relative_items == 0)
relative_width = 0;
else { // size left after fixed items / number of relative items
relative_width = (width - fixed_width)/relative_items;
rounding_error = width - fixed_width - relative_items*(relative_width);
}
if (relative_items == 0)
relative_width = 0;
else { // size left after fixed items / number of relative items
relative_width = (width - fixed_width) / relative_items;
rounding_error = width - fixed_width - relative_items * relative_width;
}
// now move and resize the items