Merge tag '13.0-beta2' into jgrpp
# Conflicts: # src/cheat_gui.cpp # src/company_gui.cpp # src/console_gui.cpp # src/depot_gui.cpp # src/error_gui.cpp # src/gfx.cpp # src/graph_gui.cpp # src/group_gui.cpp # src/lang/english.txt # src/lang/korean.txt # src/lang/polish.txt # src/misc_gui.cpp # src/network/network_content_gui.h # src/newgrf_debug_gui.cpp # src/order_gui.cpp # src/rail_gui.cpp # src/road_gui.cpp # src/settings_gui.cpp # src/settings_type.h # src/station_gui.cpp # src/subsidy_gui.cpp # src/table/settings/gui_settings.ini # src/timetable_gui.cpp # src/town_gui.cpp # src/train_cmd.cpp # src/vehicle_gui.cpp # src/viewport.cpp # src/water_cmd.cpp # src/widgets/dropdown.cpp # src/window_gui.h
This commit is contained in:
@@ -2516,7 +2516,7 @@ public:
|
||||
switch (widget) {
|
||||
case TR_WIDGET_INSTRUCTION_LIST:
|
||||
resize->height = FONT_HEIGHT_NORMAL;
|
||||
size->height = 6 * resize->height + WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM;
|
||||
size->height = 6 * resize->height + WidgetDimensions::scaled.framerect.Vertical();
|
||||
break;
|
||||
|
||||
case TR_WIDGET_GOTO_SIGNAL:
|
||||
@@ -2540,7 +2540,7 @@ public:
|
||||
{
|
||||
if (widget != TR_WIDGET_INSTRUCTION_LIST) return;
|
||||
|
||||
int y = r.top + WD_FRAMERECT_TOP;
|
||||
int y = r.top + WidgetDimensions::scaled.framerect.top;
|
||||
int line_height = this->GetWidget<NWidgetBase>(TR_WIDGET_INSTRUCTION_LIST)->resize_y;
|
||||
int scroll_position = this->vscroll->GetPosition();
|
||||
|
||||
@@ -2566,7 +2566,7 @@ public:
|
||||
}
|
||||
|
||||
if (i >= scroll_position && this->vscroll->IsVisible(i)) {
|
||||
DrawInstructionString(prog, item, i, y, i == this->selected_instruction, this_indent, r.left + WD_FRAMETEXT_LEFT, r.right - WD_FRAMETEXT_RIGHT);
|
||||
DrawInstructionString(prog, item, i, y, i == this->selected_instruction, this_indent, r.left + WidgetDimensions::scaled.framerect.left, r.right - WidgetDimensions::scaled.framerect.right);
|
||||
y += line_height;
|
||||
}
|
||||
}
|
||||
@@ -2744,7 +2744,7 @@ private:
|
||||
int GetItemIndexFromPt(int y)
|
||||
{
|
||||
NWidgetBase *nwid = this->GetWidget<NWidgetBase>(TR_WIDGET_INSTRUCTION_LIST);
|
||||
int sel = (y - nwid->pos_y - WD_FRAMERECT_TOP) / nwid->resize_y; // Selected line
|
||||
int sel = (y - nwid->pos_y - WidgetDimensions::scaled.framerect.top) / nwid->resize_y; // Selected line
|
||||
|
||||
if ((uint)sel >= this->vscroll->GetCapacity()) return -1;
|
||||
|
||||
@@ -3503,7 +3503,7 @@ static const NWidgetPart _nested_slot_widgets[] = {
|
||||
NWidget(NWID_HORIZONTAL),
|
||||
/* left part */
|
||||
NWidget(NWID_VERTICAL),
|
||||
NWidget(WWT_PANEL, COLOUR_GREY), SetMinimalTextLines(1, WD_DROPDOWNTEXT_TOP + WD_DROPDOWNTEXT_BOTTOM), SetFill(1, 0), EndContainer(),
|
||||
NWidget(WWT_PANEL, COLOUR_GREY), SetMinimalTextLines(1, WidgetDimensions::unscaled.dropdowntext.Vertical()), SetFill(1, 0), EndContainer(),
|
||||
NWidget(WWT_PANEL, COLOUR_GREY, WID_TRSL_ALL_VEHICLES), SetFill(1, 0), EndContainer(),
|
||||
NWidget(NWID_HORIZONTAL),
|
||||
NWidget(WWT_MATRIX, COLOUR_GREY, WID_TRSL_LIST_SLOTS), SetMatrixDataTip(1, 0, STR_TRACE_RESTRICT_SLOT_GUI_LIST_TOOLTIP),
|
||||
@@ -3604,12 +3604,11 @@ private:
|
||||
this->column_size[VGC_NUMBER] = GetStringBoundingBox(STR_TRACE_RESTRICT_SLOT_MAX_OCCUPANCY);
|
||||
this->tiny_step_height = std::max(this->tiny_step_height, this->column_size[VGC_NUMBER].height);
|
||||
|
||||
this->tiny_step_height += WD_MATRIX_TOP;
|
||||
this->tiny_step_height += WidgetDimensions::scaled.matrix.top;
|
||||
|
||||
return WD_FRAMERECT_LEFT + 8 +
|
||||
this->column_size[VGC_NAME].width + 8 +
|
||||
this->column_size[VGC_NUMBER].width + 2 +
|
||||
WD_FRAMERECT_RIGHT;
|
||||
return WidgetDimensions::scaled.framerect.Horizontal() + WidgetDimensions::scaled.vsep_wide +
|
||||
this->column_size[VGC_NAME].width + WidgetDimensions::scaled.vsep_wide +
|
||||
this->column_size[VGC_NUMBER].width + WidgetDimensions::scaled.vsep_normal;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3623,7 +3622,8 @@ private:
|
||||
{
|
||||
/* Highlight the group if a vehicle is dragged over it */
|
||||
if (slot_id == this->slot_over) {
|
||||
GfxFillRect(left + WD_FRAMERECT_LEFT, y + WD_FRAMERECT_TOP, right - WD_FRAMERECT_RIGHT, y + this->tiny_step_height - WD_FRAMERECT_BOTTOM - WD_MATRIX_TOP, _colour_gradient[COLOUR_GREY][7]);
|
||||
GfxFillRect(left + WidgetDimensions::scaled.framerect.left, y + WidgetDimensions::scaled.framerect.top, right - WidgetDimensions::scaled.framerect.right,
|
||||
y + this->tiny_step_height - WidgetDimensions::scaled.framerect.bottom - WidgetDimensions::scaled.matrix.top, _colour_gradient[COLOUR_GREY][7]);
|
||||
}
|
||||
|
||||
/* draw the selected group in white, else we draw it in black */
|
||||
@@ -3638,7 +3638,7 @@ private:
|
||||
SetDParam(0, slot_id);
|
||||
str = STR_TRACE_RESTRICT_SLOT_NAME;
|
||||
}
|
||||
int x = rtl ? right - WD_FRAMERECT_RIGHT - 8 - this->column_size[VGC_NAME].width + 1 : left + WD_FRAMERECT_LEFT + 8;
|
||||
int x = rtl ? right - WidgetDimensions::scaled.framerect.right - WidgetDimensions::scaled.vsep_wide - this->column_size[VGC_NAME].width + 1 : left + WidgetDimensions::scaled.framerect.left + WidgetDimensions::scaled.vsep_wide;
|
||||
DrawString(x, x + this->column_size[VGC_NAME].width - 1, y + (this->tiny_step_height - this->column_size[VGC_NAME].height) / 2, str, colour);
|
||||
|
||||
if (slot_id == ALL_TRAINS_TRACE_RESTRICT_SLOT_ID) return;
|
||||
@@ -3646,7 +3646,7 @@ private:
|
||||
const TraceRestrictSlot *slot = TraceRestrictSlot::Get(slot_id);
|
||||
|
||||
/* draw the number of vehicles of the group */
|
||||
x = rtl ? x - 2 - this->column_size[VGC_NUMBER].width : x + 2 + this->column_size[VGC_NAME].width;
|
||||
x = rtl ? x - WidgetDimensions::scaled.vsep_normal - this->column_size[VGC_NUMBER].width : x + WidgetDimensions::scaled.vsep_normal + this->column_size[VGC_NAME].width;
|
||||
SetDParam(0, slot->occupants.size());
|
||||
SetDParam(1, slot->max_occupancy);
|
||||
DrawString(x, x + this->column_size[VGC_NUMBER].width - 1, y + (this->tiny_step_height - this->column_size[VGC_NUMBER].height) / 2, STR_TRACE_RESTRICT_SLOT_MAX_OCCUPANCY, colour, SA_RIGHT | SA_FORCE);
|
||||
@@ -3716,7 +3716,7 @@ public:
|
||||
resize->height = this->tiny_step_height;
|
||||
|
||||
/* Minimum height is the height of the list widget minus all vehicles... */
|
||||
size->height = 4 * GetVehicleListHeight(this->vli.vtype, this->tiny_step_height) - this->tiny_step_height;
|
||||
size->height = 4 * GetVehicleListHeight(this->vli.vtype, this->tiny_step_height) - this->tiny_step_height;
|
||||
|
||||
/* ... minus the buttons at the bottom ... */
|
||||
uint max_icon_height = GetSpriteSize(this->GetWidget<NWidgetCore>(WID_TRSL_CREATE_SLOT)->widget_data).height;
|
||||
@@ -3836,11 +3836,11 @@ public:
|
||||
{
|
||||
switch (widget) {
|
||||
case WID_TRSL_ALL_VEHICLES:
|
||||
DrawSlotInfo(r.top + WD_FRAMERECT_TOP, r.left, r.right, ALL_TRAINS_TRACE_RESTRICT_SLOT_ID);
|
||||
DrawSlotInfo(r.top + WidgetDimensions::scaled.framerect.top, r.left, r.right, ALL_TRAINS_TRACE_RESTRICT_SLOT_ID);
|
||||
break;
|
||||
|
||||
case WID_TRSL_LIST_SLOTS: {
|
||||
int y1 = r.top + WD_FRAMERECT_TOP;
|
||||
int y1 = r.top + WidgetDimensions::scaled.framerect.top;
|
||||
int max = std::min<int>(this->slot_sb->GetPosition() + this->slot_sb->GetCapacity(), (int)this->slots.size());
|
||||
for (int i = this->slot_sb->GetPosition(); i < max; ++i) {
|
||||
const TraceRestrictSlot *slot = this->slots[i];
|
||||
@@ -4187,7 +4187,6 @@ static const NWidgetPart _nested_counter_widgets[] = {
|
||||
NWidget(WWT_STICKYBOX, COLOUR_GREY),
|
||||
EndContainer(),
|
||||
NWidget(NWID_VERTICAL),
|
||||
//NWidget(WWT_PANEL, COLOUR_GREY), SetMinimalTextLines(1, WD_DROPDOWNTEXT_TOP + WD_DROPDOWNTEXT_BOTTOM), SetFill(1, 0), EndContainer(),
|
||||
NWidget(NWID_HORIZONTAL),
|
||||
NWidget(WWT_MATRIX, COLOUR_GREY, WID_TRCL_LIST_COUNTERS), SetMatrixDataTip(1, 0, STR_TRACE_RESTRICT_COUNTER_GUI_LIST_TOOLTIP),
|
||||
SetFill(1, 1), SetResize(1, 1), SetScrollbar(WID_TRCL_LIST_COUNTERS_SCROLLBAR),
|
||||
@@ -4250,13 +4249,13 @@ private:
|
||||
{
|
||||
SetDParamMaxValue(0, 9999, 3);
|
||||
Dimension dim = GetStringBoundingBox(STR_JUST_COMMA);
|
||||
this->tiny_step_height = dim.height + WD_MATRIX_TOP;
|
||||
this->tiny_step_height = dim.height + WidgetDimensions::scaled.matrix.top;
|
||||
this->value_col_width = dim.width;
|
||||
|
||||
return WD_FRAMERECT_LEFT + 8 +
|
||||
170 + 8 +
|
||||
dim.width + 8 +
|
||||
WD_FRAMERECT_RIGHT;
|
||||
return WidgetDimensions::scaled.framerect.Horizontal() + WidgetDimensions::scaled.vsep_wide +
|
||||
170 + WidgetDimensions::scaled.vsep_wide +
|
||||
dim.width + WidgetDimensions::scaled.vsep_wide +
|
||||
WidgetDimensions::scaled.framerect.right;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -4273,13 +4272,13 @@ private:
|
||||
bool rtl = _current_text_dir == TD_RTL;
|
||||
|
||||
SetDParam(0, ctr_id);
|
||||
DrawString(left + WD_FRAMERECT_LEFT + 8 + (rtl ? this->value_col_width + 8 : 0),
|
||||
right - WD_FRAMERECT_RIGHT - 8 - (rtl ? 0 : this->value_col_width + 8),
|
||||
DrawString(left + WidgetDimensions::scaled.vsep_wide + (rtl ? this->value_col_width + WidgetDimensions::scaled.vsep_wide : 0),
|
||||
right - WidgetDimensions::scaled.vsep_wide - (rtl ? 0 : this->value_col_width + WidgetDimensions::scaled.vsep_wide),
|
||||
y, STR_TRACE_RESTRICT_COUNTER_NAME, colour);
|
||||
|
||||
SetDParam(0, TraceRestrictCounter::Get(ctr_id)->value);
|
||||
DrawString(rtl ? left + WD_FRAMERECT_LEFT + 8 : right - WD_FRAMERECT_RIGHT - 8 - this->value_col_width,
|
||||
rtl ? left + WD_FRAMERECT_LEFT + 8 + this->value_col_width : right - WD_FRAMERECT_RIGHT - 8,
|
||||
DrawString(rtl ? left + WidgetDimensions::scaled.vsep_wide : right - WidgetDimensions::scaled.vsep_wide - this->value_col_width,
|
||||
rtl ? left + WidgetDimensions::scaled.vsep_wide + this->value_col_width : right - WidgetDimensions::scaled.vsep_wide,
|
||||
y, STR_JUST_COMMA, colour, SA_RIGHT | SA_FORCE);
|
||||
}
|
||||
|
||||
@@ -4372,14 +4371,15 @@ public:
|
||||
{
|
||||
switch (widget) {
|
||||
case WID_TRCL_LIST_COUNTERS: {
|
||||
int y1 = r.top + WD_FRAMERECT_TOP;
|
||||
Rect ir = r.Shrink(WidgetDimensions::scaled.framerect);
|
||||
int y1 = ir.top;
|
||||
int max = std::min<int>(this->sb->GetPosition() + this->sb->GetCapacity(), (int)this->ctrs.size());
|
||||
for (int i = this->sb->GetPosition(); i < max; ++i) {
|
||||
const TraceRestrictCounter *ctr = this->ctrs[i];
|
||||
|
||||
assert(ctr->owner == this->ctr_company);
|
||||
|
||||
DrawCounterInfo(y1, r.left, r.right, ctr->index);
|
||||
DrawCounterInfo(y1, ir.left, ir.right, ctr->index);
|
||||
|
||||
y1 += this->tiny_step_height;
|
||||
}
|
||||
|
Reference in New Issue
Block a user