diff options
author | alberth <alberth@openttd.org> | 2009-08-01 10:38:25 +0000 |
---|---|---|
committer | alberth <alberth@openttd.org> | 2009-08-01 10:38:25 +0000 |
commit | c0c2e02fb7e0350a64cb2718bfb29ddaac86e0e2 (patch) | |
tree | d2905dd0971c1a8a3f48d52fe3705c9fbea810c1 | |
parent | ebd24adaffb6794754be4693629441a32ef60b30 (diff) | |
download | openttd-c0c2e02fb7e0350a64cb2718bfb29ddaac86e0e2.tar.xz |
(svn r17018) -Fix [FS#1833]: Take width of station type names into account in station builder window.
-rw-r--r-- | src/rail_gui.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp index 21f83de20..649abcd6a 100644 --- a/src/rail_gui.cpp +++ b/src/rail_gui.cpp @@ -1095,8 +1095,17 @@ public: break; } case BRSW_NEWST_LIST: { - this->line_height = FONT_HEIGHT_NORMAL + WD_MATRIX_TOP + WD_MATRIX_BOTTOM; + Dimension d = GetStringBoundingBox(STR_STAT_CLASS_DFLT); + for (StationClassID statclass = STAT_CLASS_BEGIN; statclass < (StationClassID)GetNumStationClasses(); statclass++) { + if (statclass == STAT_CLASS_WAYP) continue; + for (uint16 j = 0; j < GetNumCustomStations(statclass); j++) { + const StationSpec *statspec = GetCustomStationSpec(statclass, j); + if (statspec != NULL && statspec->name != 0) d = maxdim(d, GetStringBoundingBox(statspec->name)); + } + } + size->width = max(size->width, d.width + padding.width); + this->line_height = FONT_HEIGHT_NORMAL + WD_MATRIX_TOP + WD_MATRIX_BOTTOM; size->height = GB(this->nested_array[widget]->widget_data, MAT_ROW_START, MAT_ROW_BITS) * this->line_height; break; } @@ -1398,9 +1407,7 @@ static const NWidgetPart _nested_newstation_builder_widgets[] = { EndContainer(), NWidget(WWT_PANEL, COLOUR_DARK_GREEN, BRSW_BACKGROUND), /* begin newstations gui additions. */ - NWidget(NWID_SPACER), SetMinimalSize(0, 3), - NWidget(WWT_DROPDOWN, COLOUR_GREY, BRSW_NEWST_DROPDOWN), SetMinimalSize(134, 12), SetPadding(0, 7, 0, 7), SetDataTip(STR_BLACK_STRING, STR_SELECT_STATION_CLASS_TIP), - NWidget(NWID_SPACER), SetMinimalSize(0, 3), + NWidget(WWT_DROPDOWN, COLOUR_GREY, BRSW_NEWST_DROPDOWN), SetMinimalSize(134, 12), SetFill(1, 0), SetPadding(3, 7, 3, 7), SetDataTip(STR_BLACK_STRING, STR_SELECT_STATION_CLASS_TIP), NWidget(NWID_HORIZONTAL), SetPIP(7, 0, 7), NWidget(WWT_MATRIX, COLOUR_GREY, BRSW_NEWST_LIST), SetMinimalSize(122, 71), SetFill(1, 0), SetDataTip(0x501, STR_SELECT_STATION_TYPE_TIP), NWidget(WWT_SCROLLBAR, COLOUR_GREY, BRSW_NEWST_SCROLL), |