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:
@@ -69,12 +69,14 @@ struct GraphLegendWindow : Window {
|
||||
|
||||
bool rtl = _current_text_dir == TD_RTL;
|
||||
|
||||
const Rect ir = r.Shrink(WD_FRAMERECT_LEFT, WD_FRAMERECT_TOP, WD_FRAMERECT_RIGHT, WD_FRAMERECT_BOTTOM);
|
||||
Dimension d = GetSpriteSize(SPR_COMPANY_ICON);
|
||||
DrawCompanyIcon(cid, rtl ? r.right - d.width - ScaleGUITrad(2) : r.left + ScaleGUITrad(2), CenterBounds(r.top, r.bottom, d.height));
|
||||
DrawCompanyIcon(cid, rtl ? ir.right - d.width : ir.left, CenterBounds(ir.top, ir.bottom, d.height));
|
||||
|
||||
const Rect tr = ir.Indent(d.width + ScaleGUITrad(2), rtl);
|
||||
SetDParam(0, cid);
|
||||
SetDParam(1, cid);
|
||||
DrawString(r.left + (rtl ? (uint)WD_FRAMERECT_LEFT : (d.width + ScaleGUITrad(4))), r.right - (rtl ? (d.width + ScaleGUITrad(4)) : (uint)WD_FRAMERECT_RIGHT), CenterBounds(r.top, r.bottom, FONT_HEIGHT_NORMAL), STR_COMPANY_NAME_COMPANY_NUM, HasBit(_legend_excluded_companies, cid) ? TC_BLACK : TC_WHITE);
|
||||
DrawString(tr.left, tr.right, CenterBounds(tr.top, tr.bottom, FONT_HEIGHT_NORMAL), STR_COMPANY_NAME_COMPANY_NUM, HasBit(_legend_excluded_companies, cid) ? TC_BLACK : TC_WHITE);
|
||||
}
|
||||
|
||||
void OnClick(Point pt, int widget, int click_count) override
|
||||
@@ -968,32 +970,31 @@ struct PaymentRatesGraphWindow : BaseGraphWindow {
|
||||
|
||||
bool rtl = _current_text_dir == TD_RTL;
|
||||
|
||||
int x = r.left + WD_FRAMERECT_LEFT;
|
||||
int y = r.top;
|
||||
uint row_height = FONT_HEIGHT_SMALL;
|
||||
int padding = ScaleFontTrad(1);
|
||||
|
||||
int pos = this->vscroll->GetPosition();
|
||||
int max = pos + this->vscroll->GetCapacity();
|
||||
|
||||
Rect line = r.WithHeight(this->line_height);
|
||||
for (const CargoSpec *cs : _sorted_standard_cargo_specs) {
|
||||
if (pos-- > 0) continue;
|
||||
if (--max < 0) break;
|
||||
|
||||
bool lowered = !HasBit(_legend_excluded_cargo, cs->Index());
|
||||
|
||||
/* Redraw box if lowered */
|
||||
if (lowered) DrawFrameRect(r.left, y, r.right, y + this->line_height - 1, COLOUR_BROWN, FR_LOWERED);
|
||||
/* Redraw frame if lowered */
|
||||
if (lowered) DrawFrameRect(line, COLOUR_BROWN, FR_LOWERED);
|
||||
|
||||
byte clk_dif = lowered ? 1 : 0;
|
||||
int rect_x = clk_dif + (rtl ? r.right - this->legend_width - WD_FRAMERECT_RIGHT : r.left + WD_FRAMERECT_LEFT);
|
||||
const Rect text = line.Shrink(WD_FRAMERECT_LEFT, WD_FRAMERECT_TOP, WD_FRAMERECT_RIGHT, WD_FRAMERECT_BOTTOM).Translate(lowered ? 1 : 0, lowered ? 1 : 0);
|
||||
|
||||
GfxFillRect(rect_x, y + padding + clk_dif, rect_x + this->legend_width, y + row_height - 1 + clk_dif, PC_BLACK);
|
||||
GfxFillRect(rect_x + 1, y + padding + 1 + clk_dif, rect_x + this->legend_width - 1, y + row_height - 2 + clk_dif, cs->legend_colour);
|
||||
/* Cargo-colour box with outline */
|
||||
const Rect cargo = text.WithWidth(this->legend_width, rtl);
|
||||
GfxFillRect(cargo, PC_BLACK);
|
||||
GfxFillRect(cargo.Shrink(WD_BEVEL_LEFT, WD_BEVEL_TOP, WD_BEVEL_RIGHT, WD_BEVEL_BOTTOM), cs->legend_colour);
|
||||
|
||||
/* Cargo name */
|
||||
SetDParam(0, cs->name);
|
||||
DrawString(rtl ? r.left : x + this->legend_width + 4 + clk_dif, (rtl ? r.right - this->legend_width - 4 + clk_dif : r.right), y + clk_dif, STR_GRAPH_CARGO_PAYMENT_CARGO);
|
||||
DrawString(text.Indent(this->legend_width + 4, rtl), STR_GRAPH_CARGO_PAYMENT_CARGO);
|
||||
|
||||
y += this->line_height;
|
||||
line = line.Translate(0, this->line_height);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user