diff options
author | frosch <frosch@openttd.org> | 2009-08-15 11:47:11 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2009-08-15 11:47:11 +0000 |
commit | 2ad4bf74a1a0c78138efd450582e91423c282440 (patch) | |
tree | 464a371866dbf971235443fce776f2f06b396555 /src | |
parent | 1f3f53f42171c43726873991bce9bbb3c2e88097 (diff) | |
download | openttd-2ad4bf74a1a0c78138efd450582e91423c282440.tar.xz |
(svn r17185) -Codechange: Tweak depot gui and vehicle lists, so text overlaps less with vehicle images.
Diffstat (limited to 'src')
-rw-r--r-- | src/depot_gui.cpp | 2 | ||||
-rw-r--r-- | src/group_gui.cpp | 3 | ||||
-rw-r--r-- | src/train_gui.cpp | 2 | ||||
-rw-r--r-- | src/vehicle_gui.cpp | 22 | ||||
-rw-r--r-- | src/vehicle_gui_base.h | 8 |
5 files changed, 18 insertions, 19 deletions
diff --git a/src/depot_gui.cpp b/src/depot_gui.cpp index 82e12e2e3..f689107ee 100644 --- a/src/depot_gui.cpp +++ b/src/depot_gui.cpp @@ -271,7 +271,7 @@ struct DepotWindow : Window { free_wagon = u->IsFreeWagon(); uint x_space = free_wagon ? TRAININFO_DEFAULT_VEHICLE_WIDTH : 0; - DrawTrainImage(u, x + 21 + x_space, sprite_y, this->sel, this->hscroll.cap + 4 - x_space, this->hscroll.pos); + DrawTrainImage(u, x + 24 + x_space, sprite_y - 1, this->sel, this->hscroll.cap - x_space, this->hscroll.pos); /* Number of wagons relative to a standard length wagon (rounded up) */ SetDParam(0, (u->tcache.cached_total_length + 7) / 8); diff --git a/src/group_gui.cpp b/src/group_gui.cpp index d4dad4f09..d553076c5 100644 --- a/src/group_gui.cpp +++ b/src/group_gui.cpp @@ -322,7 +322,6 @@ public: virtual void OnPaint() { const Owner owner = (Owner)GB(this->window_number, 0, 8); - int x = this->widget[GRP_WIDGET_LIST_VEHICLE].left + 2; int y1 = PLY_WND_PRC__OFFSET_TOP_WIDGET + 2; int max; int i; @@ -422,7 +421,7 @@ public: this->DrawSortButtonState(GRP_WIDGET_SORT_BY_ORDER, this->vehicles.IsDescSortOrder() ? SBS_DOWN : SBS_UP); - this->DrawVehicleListItems(x, this->vehicle_sel); + this->DrawVehicleListItems(this->vehicle_sel); } virtual void OnClick(Point pt, int widget) diff --git a/src/train_gui.cpp b/src/train_gui.cpp index 1a8209119..062e70667 100644 --- a/src/train_gui.cpp +++ b/src/train_gui.cpp @@ -70,7 +70,7 @@ void DrawTrainImage(const Train *v, int x, int y, VehicleID selection, int max_w int highlight_l = 0; int highlight_r = 0; - if (!FillDrawPixelInfo(&tmp_dpi, x - 2, y - 1, max_width + 1, 14)) return; + if (!FillDrawPixelInfo(&tmp_dpi, x, y, max_width, 14)) return; old_dpi = _cur_dpi; _cur_dpi = &tmp_dpi; diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp index 226aa3265..d8c558068 100644 --- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -793,11 +793,12 @@ static void DrawVehicleImage(const Vehicle *v, int x, int y, VehicleID selection /** * Draw all the vehicle list items. - * @param x the position from where to draw the items. * @param selected_vehicle the vehicle that is to be selected */ -void BaseVehicleListWindow::DrawVehicleListItems(int x, VehicleID selected_vehicle) +void BaseVehicleListWindow::DrawVehicleListItems(VehicleID selected_vehicle) { + int left = this->widget[VLW_WIDGET_LIST].left + WD_MATRIX_LEFT; + int right = this->widget[VLW_WIDGET_LIST].right - WD_MATRIX_RIGHT; int y = PLY_WND_PRC__OFFSET_TOP_WIDGET; uint max = min(this->vscroll.pos + this->vscroll.cap, this->vehicles.Length()); for (uint i = this->vscroll.pos; i < max; ++i) { @@ -807,20 +808,20 @@ void BaseVehicleListWindow::DrawVehicleListItems(int x, VehicleID selected_vehic SetDParam(0, v->GetDisplayProfitThisYear()); SetDParam(1, v->GetDisplayProfitLastYear()); - DrawVehicleImage(v, x + 19, y + 6, selected_vehicle, this->widget[VLW_WIDGET_LIST].right - this->widget[VLW_WIDGET_LIST].left - 20, 0); - DrawString(x + 19, this->widget[VLW_WIDGET_LIST].right, y + this->resize.step_height - 8, STR_VEHICLE_LIST_PROFIT_THIS_YEAR_LAST_YEAR); + DrawVehicleImage(v, left + 19, y + 5, selected_vehicle, right - left + 1 - 19, 0); + DrawString(left + 19, right, y + this->resize.step_height - 8, STR_VEHICLE_LIST_PROFIT_THIS_YEAR_LAST_YEAR); if (v->name != NULL) { /* The vehicle got a name so we will print it */ SetDParam(0, v->index); - DrawString(x + 19, this->widget[VLW_WIDGET_LIST].right, y, STR_TINY_BLACK_VEHICLE); + DrawString(left + 19, right, y, STR_TINY_BLACK_VEHICLE); } else if (v->group_id != DEFAULT_GROUP) { /* The vehicle has no name, but is member of a group, so print group name */ SetDParam(0, v->group_id); - DrawString(x + 19, this->widget[VLW_WIDGET_LIST].right, y, STR_TINT_GROUP, TC_BLACK); + DrawString(left + 19, right, y, STR_TINT_GROUP, TC_BLACK); } - if (this->resize.step_height == PLY_WND_PRC__SIZE_OF_ROW_BIG) DrawSmallOrderList(v, x + 138, this->widget[VLW_WIDGET_LIST].right, y); + if (this->resize.step_height == PLY_WND_PRC__SIZE_OF_ROW_BIG) DrawSmallOrderList(v, left + 138, right, y); if (v->IsInDepot()) { str = STR_BLUE_COMMA; @@ -829,9 +830,9 @@ void BaseVehicleListWindow::DrawVehicleListItems(int x, VehicleID selected_vehic } SetDParam(0, v->unitnumber); - DrawString(x, this->widget[VLW_WIDGET_LIST].right, y + 2, str); + DrawString(left, right, y + 2, str); - DrawVehicleProfitButton(v, x, y + 13); + DrawVehicleProfitButton(v, left, y + 13); y += this->resize.step_height; } @@ -911,7 +912,6 @@ struct VehicleListWindow : public BaseVehicleListWindow { virtual void OnPaint() { - int x = 2; const Owner owner = this->owner; const uint16 window_type = this->window_number & VLW_MASK; const uint16 index = GB(this->window_number, 16, 16); @@ -991,7 +991,7 @@ struct VehicleListWindow : public BaseVehicleListWindow { /* draw arrow pointing up/down for ascending/descending sorting */ this->DrawSortButtonState(VLW_WIDGET_SORT_ORDER, this->vehicles.IsDescSortOrder() ? SBS_DOWN : SBS_UP); - this->DrawVehicleListItems(x, INVALID_VEHICLE); + this->DrawVehicleListItems(INVALID_VEHICLE); } virtual void OnClick(Point pt, int widget) diff --git a/src/vehicle_gui_base.h b/src/vehicle_gui_base.h index 3d78b527b..16846e37a 100644 --- a/src/vehicle_gui_base.h +++ b/src/vehicle_gui_base.h @@ -10,9 +10,9 @@ /** Start of functions regarding vehicle list windows */ enum { PLY_WND_PRC__OFFSET_TOP_WIDGET = 26, - PLY_WND_PRC__SIZE_OF_ROW_TINY = 13, - PLY_WND_PRC__SIZE_OF_ROW_SMALL = 26, - PLY_WND_PRC__SIZE_OF_ROW_BIG = 39, + PLY_WND_PRC__SIZE_OF_ROW_TINY = 13, ///< Height of rows in group list + PLY_WND_PRC__SIZE_OF_ROW_SMALL = 26, ///< Height of rows in train/roadvehicle list + PLY_WND_PRC__SIZE_OF_ROW_BIG = 39, ///< Height of rows in ship/aircraft list }; typedef GUIList<const Vehicle*> GUIVehicleList; @@ -30,7 +30,7 @@ struct BaseVehicleListWindow: public Window { this->vehicles.SetSortFuncs(this->vehicle_sorter_funcs); } - void DrawVehicleListItems(int x, VehicleID selected_vehicle); + void DrawVehicleListItems(VehicleID selected_vehicle); void SortVehicleList(); void BuildVehicleList(Owner owner, uint16 index, uint16 window_type); }; |