Merge branch 'master' into 1.5
Conflicts: src/ai/ai_gui.cpp src/build_vehicle_gui.cpp src/cheat_gui.cpp src/company_gui.cpp src/depot_gui.cpp src/dock_gui.cpp src/genworld_gui.cpp src/misc_gui.cpp src/network/network_content_gui.cpp src/network/network_gui.cpp src/newgrf_gui.cpp src/news_gui.cpp src/rail_gui.cpp src/road_gui.cpp src/settings_gui.cpp src/settings_gui.h src/station_gui.cpp src/table/settings.ini src/toolbar_gui.cpp src/toolbar_gui.h src/vehicle_gui.cpp src/video/sdl_v.cpp src/widget.cpp src/widgets/settings_widget.h
This commit is contained in:
@@ -70,7 +70,7 @@ static const NWidgetPart _nested_group_widgets[] = {
|
||||
/* right part */
|
||||
NWidget(NWID_VERTICAL),
|
||||
NWidget(NWID_HORIZONTAL),
|
||||
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_GL_SORT_BY_ORDER), SetMinimalSize(81, 12), SetDataTip(STR_BUTTON_SORT_BY, STR_TOOLTIP_SORT_ORDER),
|
||||
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_GL_SORT_BY_ORDER), SetSizingType(NWST_STEP), SetMinimalSize(81, 12), SetDataTip(STR_BUTTON_SORT_BY, STR_TOOLTIP_SORT_ORDER),
|
||||
NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_GL_SORT_BY_DROPDOWN), SetMinimalSize(167, 12), SetDataTip(0x0, STR_TOOLTIP_SORT_CRITERIA),
|
||||
NWidget(WWT_PANEL, COLOUR_GREY), SetMinimalSize(12, 12), SetResize(1, 0), EndContainer(),
|
||||
EndContainer(),
|
||||
@@ -78,7 +78,7 @@ static const NWidgetPart _nested_group_widgets[] = {
|
||||
NWidget(WWT_MATRIX, COLOUR_GREY, WID_GL_LIST_VEHICLE), SetMinimalSize(248, 0), SetMatrixDataTip(1, 0, STR_NULL), SetResize(1, 1), SetFill(1, 0), SetScrollbar(WID_GL_LIST_VEHICLE_SCROLLBAR),
|
||||
NWidget(NWID_VSCROLLBAR, COLOUR_GREY, WID_GL_LIST_VEHICLE_SCROLLBAR),
|
||||
EndContainer(),
|
||||
NWidget(WWT_PANEL, COLOUR_GREY), SetMinimalSize(1, 0), SetFill(1, 1), SetResize(1, 0), EndContainer(),
|
||||
NWidget(WWT_PANEL, COLOUR_GREY), SetFill(1, 1), SetResize(1, 0), EndContainer(),
|
||||
NWidget(NWID_HORIZONTAL),
|
||||
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_GL_AVAILABLE_VEHICLES), SetMinimalSize(106, 12), SetFill(0, 1),
|
||||
SetDataTip(STR_BLACK_STRING, STR_VEHICLE_LIST_AVAILABLE_ENGINES_TOOLTIP),
|
||||
@@ -192,8 +192,9 @@ private:
|
||||
uint ComputeGroupInfoSize()
|
||||
{
|
||||
this->column_size[VGC_NAME] = maxdim(GetStringBoundingBox(STR_GROUP_DEFAULT_TRAINS + this->vli.vtype), GetStringBoundingBox(STR_GROUP_ALL_TRAINS + this->vli.vtype));
|
||||
this->column_size[VGC_NAME].width = max(170u, this->column_size[VGC_NAME].width);
|
||||
this->tiny_step_height = this->column_size[VGC_NAME].height;
|
||||
/* We consider the max average length of characters to be the one of "a" */
|
||||
this->column_size[VGC_NAME].width = max(GetCharacterWidth(FS_NORMAL, 97) * (MAX_LENGTH_GROUP_NAME_CHARS - 4), this->column_size[VGC_NAME].width);
|
||||
this->tiny_step_height = max(11U, this->column_size[VGC_NAME].height);
|
||||
|
||||
this->column_size[VGC_PROTECT] = GetSpriteSize(SPR_GROUP_REPLACE_PROTECT);
|
||||
this->tiny_step_height = max(this->tiny_step_height, this->column_size[VGC_PROTECT].height);
|
||||
@@ -215,9 +216,10 @@ private:
|
||||
this->tiny_step_height = max(this->tiny_step_height, this->column_size[VGC_NUMBER].height);
|
||||
|
||||
this->tiny_step_height += WD_MATRIX_TOP;
|
||||
this->tiny_step_height = GetMinSizing(NWST_STEP, this->tiny_step_height);
|
||||
|
||||
return WD_FRAMERECT_LEFT + 8 +
|
||||
this->column_size[VGC_NAME].width + 8 +
|
||||
this->column_size[VGC_NAME].width + 2 +
|
||||
this->column_size[VGC_PROTECT].width + 2 +
|
||||
this->column_size[VGC_AUTOREPLACE].width + 2 +
|
||||
this->column_size[VGC_PROFIT].width + 2 +
|
||||
@@ -238,7 +240,7 @@ private:
|
||||
{
|
||||
/* Highlight the group if a vehicle is dragged over it */
|
||||
if (g_id == this->group_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 + WD_FRAMERECT_LEFT, y + WD_FRAMERECT_TOP + WD_MATRIX_TOP, right - WD_FRAMERECT_RIGHT, y + this->tiny_step_height - WD_FRAMERECT_BOTTOM - WD_MATRIX_TOP, _colour_gradient[COLOUR_GREY][7]);
|
||||
}
|
||||
|
||||
if (g_id == NEW_GROUP) return;
|
||||
@@ -249,6 +251,7 @@ private:
|
||||
bool rtl = _current_text_dir == TD_RTL;
|
||||
|
||||
/* draw group name */
|
||||
int longer_name = 0;
|
||||
StringID str;
|
||||
if (IsAllGroupID(g_id)) {
|
||||
str = STR_GROUP_ALL_TRAINS + this->vli.vtype;
|
||||
@@ -257,12 +260,16 @@ private:
|
||||
} else {
|
||||
SetDParam(0, g_id);
|
||||
str = STR_GROUP_NAME;
|
||||
if (!protection) {
|
||||
longer_name += this->column_size[VGC_PROTECT].width + 2;
|
||||
if (!stats.autoreplace_defined) longer_name += this->column_size[VGC_AUTOREPLACE].width + 2;
|
||||
}
|
||||
}
|
||||
int x = rtl ? right - WD_FRAMERECT_RIGHT - 8 - this->column_size[VGC_NAME].width + 1 : left + WD_FRAMERECT_LEFT + 8;
|
||||
DrawString(x + indent * LEVEL_WIDTH, x + this->column_size[VGC_NAME].width - 1, y + (this->tiny_step_height - this->column_size[VGC_NAME].height) / 2, str, colour);
|
||||
int x = rtl ? right - WD_FRAMERECT_RIGHT - 8 - this->column_size[VGC_NAME].width - longer_name + 1 : left + WD_FRAMERECT_LEFT + 8;
|
||||
DrawString(x + indent * LEVEL_WIDTH, x + this->column_size[VGC_NAME].width + longer_name - 1, y + (this->tiny_step_height - this->column_size[VGC_NAME].height) / 2, str, colour);
|
||||
|
||||
/* draw autoreplace protection */
|
||||
x = rtl ? x - 8 - this->column_size[VGC_PROTECT].width : x + 8 + this->column_size[VGC_NAME].width;
|
||||
x = rtl ? x - 2 - this->column_size[VGC_PROTECT].width : x + 2 + this->column_size[VGC_NAME].width;
|
||||
if (protection) DrawSprite(SPR_GROUP_REPLACE_PROTECT, PAL_NONE, x, y + (this->tiny_step_height - this->column_size[VGC_PROTECT].height) / 2);
|
||||
|
||||
/* draw autoreplace status */
|
||||
@@ -363,16 +370,10 @@ public:
|
||||
resize->height = this->tiny_step_height;
|
||||
|
||||
/* Minimum height is the height of the list widget minus all and default vehicles... */
|
||||
size->height = 4 * GetVehicleListHeight(this->vli.vtype, this->tiny_step_height) - 2 * this->tiny_step_height;
|
||||
|
||||
/* ... minus the buttons at the bottom ... */
|
||||
uint max_icon_height = GetSpriteSize(this->GetWidget<NWidgetCore>(WID_GL_CREATE_GROUP)->widget_data).height;
|
||||
max_icon_height = max(max_icon_height, GetSpriteSize(this->GetWidget<NWidgetCore>(WID_GL_RENAME_GROUP)->widget_data).height);
|
||||
max_icon_height = max(max_icon_height, GetSpriteSize(this->GetWidget<NWidgetCore>(WID_GL_DELETE_GROUP)->widget_data).height);
|
||||
max_icon_height = max(max_icon_height, GetSpriteSize(this->GetWidget<NWidgetCore>(WID_GL_REPLACE_PROTECTION)->widget_data).height);
|
||||
size->height = (this->vli.vtype >= VEH_SHIP ? 3 : 6) * GetVehicleListHeight(this->vli.vtype, this->tiny_step_height) - 2 * this->tiny_step_height;
|
||||
|
||||
/* Get a multiple of tiny_step_height of that amount */
|
||||
size->height = Ceil(size->height - max_icon_height, tiny_step_height);
|
||||
size->height = Ceil(size->height, tiny_step_height);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -393,7 +394,7 @@ public:
|
||||
case WID_GL_LIST_VEHICLE:
|
||||
this->ComputeGroupInfoSize();
|
||||
resize->height = GetVehicleListHeight(this->vli.vtype, this->tiny_step_height);
|
||||
size->height = 4 * resize->height;
|
||||
size->height = (this->vli.vtype >= VEH_SHIP ? 3 : 6) * resize->height;
|
||||
break;
|
||||
|
||||
case WID_GL_MANAGE_VEHICLES_DROPDOWN: {
|
||||
@@ -520,15 +521,15 @@ public:
|
||||
{
|
||||
switch (widget) {
|
||||
case WID_GL_ALL_VEHICLES:
|
||||
DrawGroupInfo(r.top + WD_FRAMERECT_TOP, r.left, r.right, ALL_GROUP);
|
||||
DrawGroupInfo(r.top, r.left, r.right, ALL_GROUP);
|
||||
break;
|
||||
|
||||
case WID_GL_DEFAULT_VEHICLES:
|
||||
DrawGroupInfo(r.top + WD_FRAMERECT_TOP, r.left, r.right, DEFAULT_GROUP);
|
||||
DrawGroupInfo(r.top, r.left, r.right, DEFAULT_GROUP);
|
||||
break;
|
||||
|
||||
case WID_GL_LIST_GROUP: {
|
||||
int y1 = r.top + WD_FRAMERECT_TOP;
|
||||
int y1 = r.top;
|
||||
int max = min(this->group_sb->GetPosition() + this->group_sb->GetCapacity(), this->groups.Length());
|
||||
for (int i = this->group_sb->GetPosition(); i < max; ++i) {
|
||||
const Group *g = this->groups[i];
|
||||
|
||||
Reference in New Issue
Block a user