Merge remote-tracking branch 'upstream/master' into 13.0
This commit is contained in:
@@ -941,7 +941,7 @@ NWidgetCore::NWidgetCore(WidgetType tp, Colours colour, uint fill_x, uint fill_y
|
||||
this->widget_data = widget_data;
|
||||
this->tool_tip = tool_tip;
|
||||
this->scrollbar_index = -1;
|
||||
this->text_colour = TC_FROMSTRING;
|
||||
this->text_colour = TC_BLACK;
|
||||
this->align = SA_CENTER;
|
||||
}
|
||||
|
||||
@@ -1357,7 +1357,7 @@ void NWidgetHorizontal::AssignSizePosition(SizingType sizing, uint x, uint y, ui
|
||||
for (NWidgetBase *child_wid = this->head; child_wid != nullptr; child_wid = child_wid->next) {
|
||||
uint hor_step = child_wid->GetHorizontalStepSize(sizing);
|
||||
if (hor_step > 0) {
|
||||
num_changing_childs++;
|
||||
if (!(flags & NC_BIGFIRST)) num_changing_childs++;
|
||||
biggest_stepsize = std::max(biggest_stepsize, hor_step);
|
||||
} else {
|
||||
child_wid->current_x = child_wid->smallest_x;
|
||||
@@ -1367,6 +1367,16 @@ void NWidgetHorizontal::AssignSizePosition(SizingType sizing, uint x, uint y, ui
|
||||
child_wid->current_y = ComputeMaxSize(child_wid->smallest_y, given_height - child_wid->padding_top - child_wid->padding_bottom, vert_step);
|
||||
}
|
||||
|
||||
/* First.5 loop: count how many children are of the biggest step size. */
|
||||
if ((flags & NC_BIGFIRST) && biggest_stepsize > 0) {
|
||||
for (NWidgetBase *child_wid = this->head; child_wid != nullptr; child_wid = child_wid->next) {
|
||||
uint hor_step = child_wid->GetHorizontalStepSize(sizing);
|
||||
if (hor_step == biggest_stepsize) {
|
||||
num_changing_childs++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Second loop: Allocate the additional horizontal space over the resizing children, starting with the biggest resize steps. */
|
||||
while (biggest_stepsize > 0) {
|
||||
uint next_biggest_stepsize = 0;
|
||||
@@ -1384,6 +1394,16 @@ void NWidgetHorizontal::AssignSizePosition(SizingType sizing, uint x, uint y, ui
|
||||
next_biggest_stepsize = std::max(next_biggest_stepsize, hor_step);
|
||||
}
|
||||
biggest_stepsize = next_biggest_stepsize;
|
||||
|
||||
if (num_changing_childs == 0 && (flags & NC_BIGFIRST) && biggest_stepsize > 0) {
|
||||
/* Second.5 loop: count how many children are of the updated biggest step size. */
|
||||
for (NWidgetBase *child_wid = this->head; child_wid != nullptr; child_wid = child_wid->next) {
|
||||
uint hor_step = child_wid->GetHorizontalStepSize(sizing);
|
||||
if (hor_step == biggest_stepsize) {
|
||||
num_changing_childs++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
assert(num_changing_childs == 0);
|
||||
|
||||
@@ -1513,7 +1533,7 @@ void NWidgetVertical::AssignSizePosition(SizingType sizing, uint x, uint y, uint
|
||||
for (NWidgetBase *child_wid = this->head; child_wid != nullptr; child_wid = child_wid->next) {
|
||||
uint vert_step = child_wid->GetVerticalStepSize(sizing);
|
||||
if (vert_step > 0) {
|
||||
num_changing_childs++;
|
||||
if (!(flags & NC_BIGFIRST)) num_changing_childs++;
|
||||
biggest_stepsize = std::max(biggest_stepsize, vert_step);
|
||||
} else {
|
||||
child_wid->current_y = child_wid->smallest_y;
|
||||
@@ -1523,6 +1543,16 @@ void NWidgetVertical::AssignSizePosition(SizingType sizing, uint x, uint y, uint
|
||||
child_wid->current_x = ComputeMaxSize(child_wid->smallest_x, given_width - child_wid->padding_left - child_wid->padding_right, hor_step);
|
||||
}
|
||||
|
||||
/* First.5 loop: count how many children are of the biggest step size. */
|
||||
if ((this->flags & NC_BIGFIRST) && biggest_stepsize > 0) {
|
||||
for (NWidgetBase *child_wid = this->head; child_wid != nullptr; child_wid = child_wid->next) {
|
||||
uint vert_step = child_wid->GetVerticalStepSize(sizing);
|
||||
if (vert_step == biggest_stepsize) {
|
||||
num_changing_childs++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Second loop: Allocate the additional vertical space over the resizing children, starting with the biggest resize steps. */
|
||||
while (biggest_stepsize > 0) {
|
||||
uint next_biggest_stepsize = 0;
|
||||
@@ -1540,6 +1570,16 @@ void NWidgetVertical::AssignSizePosition(SizingType sizing, uint x, uint y, uint
|
||||
next_biggest_stepsize = std::max(next_biggest_stepsize, vert_step);
|
||||
}
|
||||
biggest_stepsize = next_biggest_stepsize;
|
||||
|
||||
if (num_changing_childs == 0 && (flags & NC_BIGFIRST) && biggest_stepsize > 0) {
|
||||
/* Second.5 loop: count how many children are of the updated biggest step size. */
|
||||
for (NWidgetBase *child_wid = this->head; child_wid != nullptr; child_wid = child_wid->next) {
|
||||
uint vert_step = child_wid->GetVerticalStepSize(sizing);
|
||||
if (vert_step == biggest_stepsize) {
|
||||
num_changing_childs++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
assert(num_changing_childs == 0);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user