1
0
Fork 0

(svn r13550) -Fix(r13540, r13542): widget_count did not had the same value as 27. So, it has to be lowered by one, so it can be used as a widget "pointer"

release/0.7
belugas 2008-06-17 16:33:55 +00:00
parent 26879ce24a
commit 6d4590ec7c
1 changed files with 10 additions and 8 deletions

View File

@ -715,17 +715,19 @@ static void ResizeToolbar(Window *w)
/* There are 27 buttons plus some spacings if the space allows it */ /* There are 27 buttons plus some spacings if the space allows it */
uint button_width; uint button_width;
uint spacing; uint spacing;
if (w->width >= (int)w->widget_count * 22) { uint widgetcount = w->widget_count - 1;
if (w->width >= (int)widgetcount * 22) {
button_width = 22; button_width = 22;
spacing = w->width - (w->widget_count * button_width); spacing = w->width - (widgetcount * button_width);
} else { } else {
button_width = w->width / w->widget_count; button_width = w->width / widgetcount;
spacing = 0; spacing = 0;
} }
uint extra_spacing_at[] = { 4, 8, 13, 17, 19, 24, 0 }; uint extra_spacing_at[] = { 4, 8, 13, 17, 19, 24, 0 };
uint i = 0; uint i = 0;
for (uint x = 0, j = 0; i < w->widget_count; i++) { for (uint x = 0, j = 0; i < widgetcount; i++) {
if (extra_spacing_at[j] == i) { if (extra_spacing_at[j] == i) {
j++; j++;
uint add = spacing / (lengthof(extra_spacing_at) - j); uint add = spacing / (lengthof(extra_spacing_at) - j);
@ -735,7 +737,7 @@ static void ResizeToolbar(Window *w)
w->widget[i].type = WWT_IMGBTN; w->widget[i].type = WWT_IMGBTN;
w->widget[i].left = x; w->widget[i].left = x;
x += (spacing != 0) ? button_width : (w->width - x) / (w->widget_count - i); x += (spacing != 0) ? button_width : (w->width - x) / (widgetcount - i);
w->widget[i].right = x - 1; w->widget[i].right = x - 1;
} }
@ -780,7 +782,7 @@ static void SplitToolbar(Window *w)
assert(max_icons >= 14 && max_icons <= 19); assert(max_icons >= 14 && max_icons <= 19);
/* first hide all icons */ /* first hide all icons */
for (uint i = 0; i < w->widget_count; i++) { for (uint i = 0; i < w->widget_count - 1; i++) {
w->widget[i].type = WWT_EMPTY; w->widget[i].type = WWT_EMPTY;
} }
@ -940,7 +942,7 @@ struct MainToolbarWindow : Window {
virtual void OnTimeout() virtual void OnTimeout()
{ {
for (uint i = TBN_SETTINGS; i < this->widget_count; i++) { for (uint i = TBN_SETTINGS; i < this->widget_count - 1; i++) {
if (this->IsWidgetLowered(i)) { if (this->IsWidgetLowered(i)) {
this->RaiseWidget(i); this->RaiseWidget(i);
this->InvalidateWidget(i); this->InvalidateWidget(i);
@ -1133,7 +1135,7 @@ public:
} }
uint extra_spacing_at[] = { 3, 4, 7, 8, 10, 16, 0 }; uint extra_spacing_at[] = { 3, 4, 7, 8, 10, 16, 0 };
for (uint i = 0, x = 0, j = 0, b = 0; i < this->widget_count; i++) { for (uint i = 0, x = 0, j = 0, b = 0; i < this->widget_count - 1; i++) {
switch (i) { switch (i) {
case 4: case 4:
this->widget[i].left = x; this->widget[i].left = x;