Merge branch 'master' into jgrpp
# Conflicts: # src/build_vehicle_gui.cpp # src/cheat_gui.cpp # src/company_gui.cpp # src/error_gui.cpp # src/fios_gui.cpp # src/gfx_func.h # src/graph_gui.cpp # src/group_gui.cpp # src/misc_gui.cpp # src/newgrf_debug_gui.cpp # src/order_gui.cpp # src/road_gui.cpp # src/roadveh_gui.cpp # src/settings_gui.cpp # src/ship_gui.cpp # src/station_gui.cpp # src/statusbar_gui.cpp # src/subsidy_gui.cpp # src/timetable_gui.cpp # src/town_gui.cpp # src/train_gui.cpp # src/tree_gui.cpp # src/vehicle_gui.cpp # src/widget.cpp # src/widgets/dropdown.cpp # src/window_gui.h
This commit is contained in:
@@ -157,16 +157,15 @@ static uint GetMaxCategoriesWidth()
|
||||
*/
|
||||
static void DrawCategory(const Rect &r, int start_y, ExpensesList list)
|
||||
{
|
||||
int offs_left = _current_text_dir == TD_LTR ? EXP_INDENT : 0;
|
||||
int offs_right = _current_text_dir == TD_LTR ? 0 : EXP_INDENT;
|
||||
Rect tr = r.Indent(EXP_INDENT, _current_text_dir == TD_RTL);
|
||||
|
||||
int y = start_y;
|
||||
tr.top = start_y;
|
||||
ExpensesType et;
|
||||
|
||||
for (uint i = 0; i < list.length; i++) {
|
||||
et = list.et[i];
|
||||
DrawString(r.left + offs_left, r.right - offs_right, y, STR_FINANCES_SECTION_CONSTRUCTION + et);
|
||||
y += FONT_HEIGHT_NORMAL;
|
||||
DrawString(tr, STR_FINANCES_SECTION_CONSTRUCTION + et);
|
||||
tr.top += FONT_HEIGHT_NORMAL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -656,11 +655,12 @@ public:
|
||||
bool rtl = _current_text_dir == TD_RTL;
|
||||
int icon_y = CenterBounds(r.top, r.bottom, 0);
|
||||
int text_y = CenterBounds(r.top, r.bottom, FONT_HEIGHT_NORMAL);
|
||||
Rect tr = r.Shrink(WD_DROPDOWNTEXT_LEFT, WD_DROPDOWNTEXT_TOP, WD_DROPDOWNTEXT_RIGHT, WD_DROPDOWNTEXT_BOTTOM);
|
||||
DrawSprite(SPR_VEH_BUS_SIDE_VIEW, PALETTE_RECOLOUR_START + (this->result % COLOUR_END),
|
||||
rtl ? r.right - 2 - ScaleGUITrad(14) : r.left + ScaleGUITrad(14) + 2,
|
||||
icon_y);
|
||||
DrawString(rtl ? r.left + 2 : r.left + ScaleGUITrad(28) + 4,
|
||||
rtl ? r.right - ScaleGUITrad(28) - 4 : r.right - 2,
|
||||
rtl ? tr.right - ScaleGUITrad(14) : tr.left + ScaleGUITrad(14),
|
||||
icon_y);
|
||||
DrawString(rtl ? tr.left : tr.left + ScaleGUITrad(28) + 2,
|
||||
rtl ? tr.right - ScaleGUITrad(28) - 2 : tr.right,
|
||||
text_y, this->String(), sel ? TC_WHITE : TC_BLACK);
|
||||
}
|
||||
};
|
||||
@@ -973,40 +973,41 @@ public:
|
||||
|
||||
bool rtl = _current_text_dir == TD_RTL;
|
||||
|
||||
/* Horizontal coordinates of scheme name column. */
|
||||
/* Coordinates of scheme name column. */
|
||||
const NWidgetBase *nwi = this->GetWidget<NWidgetBase>(WID_SCL_SPACER_DROPDOWN);
|
||||
int sch_left = nwi->pos_x;
|
||||
int sch_right = sch_left + nwi->current_x - 1;
|
||||
/* Horizontal coordinates of first dropdown. */
|
||||
Rect sch = nwi->GetCurrentRect().Shrink(WD_FRAMERECT_LEFT, WD_FRAMERECT_TOP, WD_FRAMERECT_RIGHT, WD_FRAMERECT_BOTTOM);
|
||||
/* Coordinates of first dropdown. */
|
||||
nwi = this->GetWidget<NWidgetBase>(WID_SCL_PRI_COL_DROPDOWN);
|
||||
int pri_left = nwi->pos_x;
|
||||
int pri_right = pri_left + nwi->current_x - 1;
|
||||
/* Horizontal coordinates of second dropdown. */
|
||||
Rect pri = nwi->GetCurrentRect().Shrink(WD_FRAMERECT_LEFT, WD_FRAMERECT_TOP, WD_FRAMERECT_RIGHT, WD_FRAMERECT_BOTTOM);
|
||||
/* Coordinates of second dropdown. */
|
||||
nwi = this->GetWidget<NWidgetBase>(WID_SCL_SEC_COL_DROPDOWN);
|
||||
int sec_left = nwi->pos_x;
|
||||
int sec_right = sec_left + nwi->current_x - 1;
|
||||
Rect sec = nwi->GetCurrentRect().Shrink(WD_FRAMERECT_LEFT, WD_FRAMERECT_TOP, WD_FRAMERECT_RIGHT, WD_FRAMERECT_BOTTOM);
|
||||
|
||||
int text_left = (rtl ? (uint)WD_FRAMERECT_LEFT : (this->square.width + 5));
|
||||
int text_right = (rtl ? (this->square.width + 5) : (uint)WD_FRAMERECT_RIGHT);
|
||||
Rect pri_squ = pri.WithWidth(this->square.width, rtl);
|
||||
Rect sec_squ = sec.WithWidth(this->square.width, rtl);
|
||||
|
||||
int square_offs = (this->line_height - this->square.height) / 2 + 1;
|
||||
int text_offs = (this->line_height - FONT_HEIGHT_NORMAL) / 2 + 1;
|
||||
pri = pri.Indent(this->square.width + ScaleGUITrad(2), rtl);
|
||||
sec = sec.Indent(this->square.width + ScaleGUITrad(2), rtl);
|
||||
|
||||
int y = r.top;
|
||||
Rect ir = r.WithHeight(this->resize.step_height).Shrink(WD_MATRIX_LEFT, WD_MATRIX_TOP, WD_MATRIX_RIGHT, WD_MATRIX_BOTTOM);
|
||||
int square_offs = (ir.Height() - this->square.height) / 2;
|
||||
int text_offs = (ir.Height() - FONT_HEIGHT_NORMAL) / 2;
|
||||
|
||||
int y = ir.top;
|
||||
|
||||
/* Helper function to draw livery info. */
|
||||
auto draw_livery = [&](StringID str, const Livery &liv, bool sel, bool def, int indent) {
|
||||
/* Livery Label. */
|
||||
DrawString(sch_left + WD_FRAMERECT_LEFT + (rtl ? 0 : indent), sch_right - WD_FRAMERECT_RIGHT - (rtl ? indent : 0), y + text_offs, str, sel ? TC_WHITE : TC_BLACK);
|
||||
DrawString(sch.left + (rtl ? 0 : indent), sch.right - (rtl ? indent : 0), y + text_offs, str, sel ? TC_WHITE : TC_BLACK);
|
||||
|
||||
/* Text below the first dropdown. */
|
||||
DrawSprite(SPR_SQUARE, GENERAL_SPRITE_COLOUR(liv.colour1), (rtl ? pri_right - (this->square.width + 5) + WD_FRAMERECT_RIGHT : pri_left) + WD_FRAMERECT_LEFT, y + square_offs);
|
||||
DrawString(pri_left + text_left, pri_right - text_right, y + text_offs, (def || HasBit(liv.in_use, 0)) ? STR_COLOUR_DARK_BLUE + liv.colour1 : STR_COLOUR_DEFAULT, sel ? TC_WHITE : TC_GOLD);
|
||||
DrawSprite(SPR_SQUARE, GENERAL_SPRITE_COLOUR(liv.colour1), pri_squ.left, y + square_offs);
|
||||
DrawString(pri.left, pri.right, y + text_offs, (def || HasBit(liv.in_use, 0)) ? STR_COLOUR_DARK_BLUE + liv.colour1 : STR_COLOUR_DEFAULT, sel ? TC_WHITE : TC_GOLD);
|
||||
|
||||
/* Text below the second dropdown. */
|
||||
if (sec_right > sec_left) { // Second dropdown has non-zero size.
|
||||
DrawSprite(SPR_SQUARE, GENERAL_SPRITE_COLOUR(liv.colour2), (rtl ? sec_right - (this->square.width + 5) + WD_FRAMERECT_RIGHT : sec_left) + WD_FRAMERECT_LEFT, y + square_offs);
|
||||
DrawString(sec_left + text_left, sec_right - text_right, y + text_offs, (def || HasBit(liv.in_use, 1)) ? STR_COLOUR_DARK_BLUE + liv.colour2 : STR_COLOUR_DEFAULT, sel ? TC_WHITE : TC_GOLD);
|
||||
if (sec.right > sec.left) { // Second dropdown has non-zero size.
|
||||
DrawSprite(SPR_SQUARE, GENERAL_SPRITE_COLOUR(liv.colour2), sec_squ.left, y + square_offs);
|
||||
DrawString(sec.left, sec.right, y + text_offs, (def || HasBit(liv.in_use, 1)) ? STR_COLOUR_DARK_BLUE + liv.colour2 : STR_COLOUR_DEFAULT, sel ? TC_WHITE : TC_GOLD);
|
||||
}
|
||||
|
||||
y += this->line_height;
|
||||
|
Reference in New Issue
Block a user