1
0
Fork 0

Compare commits

...

3 Commits

Author SHA1 Message Date
Peter Nelson 5fb0eda4ad
Merge 642f4d0ab6 into aaf5d39b15 2025-07-11 07:58:46 +00:00
translators aaf5d39b15 Update: Translations from eints
english (au): 1 change by krysclarke
chinese (traditional): 1 change by KogentaSan
chinese (simplified): 1 change by WenSimEHRP
korean: 1 change by telk5093
greek: 1 change by gh658804
russian: 1 change by Ln-Wolf
finnish: 1 change by hpiirai
portuguese: 1 change by azulcosta
portuguese (brazilian): 1 change by pasantoro
polish: 1 change by pAter-exe
2025-07-11 04:45:38 +00:00
Richard Wheeler 7db135099a
Fix: Scale graph gridlines and axes with GUI scale (#12131) 2025-07-10 00:05:48 +01:00
11 changed files with 25 additions and 13 deletions

View File

@ -418,7 +418,9 @@ protected:
/* Draw the background of the graph itself. */
GfxFillRect(r.left, r.top, r.right, r.bottom, GRAPH_BASE_COLOUR);
/* Draw the vertical grid lines. */
/* Draw the grid lines. */
int gridline_width = WidgetDimensions::scaled.bevel.top;
int grid_colour = GRAPH_GRID_COLOUR;
/* Don't draw the first line, as that's where the axis will be. */
if (rtl) {
@ -428,13 +430,12 @@ protected:
x = r.left + x_sep;
}
int grid_colour = GRAPH_GRID_COLOUR;
for (int i = 1; i < this->num_vert_lines + 1; i++) {
/* If using wallclock units, we separate periods with a lighter line. */
if (TimerGameEconomy::UsingWallclockUnits()) {
grid_colour = (i % 4 == 0) ? GRAPH_YEAR_LINE_COLOUR : GRAPH_GRID_COLOUR;
}
GfxFillRect(x, r.top, x, r.bottom, grid_colour);
GfxFillRect(x, r.top, x + gridline_width - 1, r.bottom, grid_colour);
x += x_sep;
}
@ -443,20 +444,20 @@ protected:
for (int i = 0; i < (num_hori_lines + 1); i++) {
if (rtl) {
GfxFillRect(r.right + 1, y, r.right + ScaleGUITrad(3), y, GRAPH_AXIS_LINE_COLOUR);
GfxFillRect(r.right + 1, y, r.right + ScaleGUITrad(3), y + gridline_width - 1, GRAPH_AXIS_LINE_COLOUR);
} else {
GfxFillRect(r.left - ScaleGUITrad(3), y, r.left - 1, y, GRAPH_AXIS_LINE_COLOUR);
GfxFillRect(r.left - ScaleGUITrad(3), y, r.left - 1, y + gridline_width - 1, GRAPH_AXIS_LINE_COLOUR);
}
GfxFillRect(r.left, y, r.right, y, GRAPH_GRID_COLOUR);
GfxFillRect(r.left, y, r.right + gridline_width - 1, y + gridline_width - 1, GRAPH_GRID_COLOUR);
y -= y_sep;
}
/* Draw the y axis. */
GfxFillRect(r.left, r.top, r.left, r.bottom, GRAPH_AXIS_LINE_COLOUR);
GfxFillRect(r.left, r.top, r.left + gridline_width - 1, r.bottom + gridline_width - 1, GRAPH_AXIS_LINE_COLOUR);
/* Draw the x axis. */
y = x_axis_offset + r.top;
GfxFillRect(r.left, y, r.right, y, GRAPH_ZERO_LINE_COLOUR);
GfxFillRect(r.left, y, r.right + gridline_width - 1, y + gridline_width - 1, GRAPH_ZERO_LINE_COLOUR);
/* Find the largest value that will be drawn. */
if (this->num_on_x_axis == 0) return;
@ -511,7 +512,7 @@ protected:
year++;
/* Draw a lighter grid line between years. Top and bottom adjustments ensure we don't draw over top and bottom horizontal grid lines. */
GfxFillRect(x + x_sep, r.top + 1, x + x_sep, r.bottom - 1, GRAPH_YEAR_LINE_COLOUR);
GfxFillRect(x + x_sep, r.top + gridline_width, x + x_sep + gridline_width - 1, r.bottom - 1, GRAPH_YEAR_LINE_COLOUR);
}
x += x_sep;
}
@ -539,10 +540,11 @@ protected:
}
}
/* draw lines and dots */
uint linewidth = _settings_client.gui.graph_line_thickness;
uint pointoffs1 = (linewidth + 1) / 2;
uint pointoffs2 = linewidth + 1 - pointoffs1;
/* Draw lines and dots. */
uint linewidth = ScaleGUITrad(_settings_client.gui.graph_line_thickness);
uint pointwidth = ScaleGUITrad(_settings_client.gui.graph_line_thickness + 1);
uint pointoffs1 = pointwidth / 2;
uint pointoffs2 = pointwidth - pointoffs1;
auto draw_dataset = [&](const DataSet &dataset, uint8_t colour) {
if (HasBit(this->excluded_data, dataset.exclude_bit)) return;

View File

@ -268,6 +268,7 @@ STR_UNITS_YEARS :{NUM}{NBSP}ano{
STR_UNITS_PERIODS :{NUM}{NBSP}período{P "" s}
STR_LIST_SEPARATOR :,{SPACE}
STR_TRUNCATION_ELLIPSIS :...
# Common window strings
STR_LIST_FILTER_TITLE :{BLACK}Filtro:

View File

@ -267,6 +267,7 @@ STR_UNITS_YEARS :{NUM}{NBSP}year
STR_UNITS_PERIODS :{NUM}{NBSP}period{P "" s}
STR_LIST_SEPARATOR :,{SPACE}
STR_TRUNCATION_ELLIPSIS :...
# Common window strings
STR_LIST_FILTER_TITLE :{BLACK}Filter:

View File

@ -267,6 +267,7 @@ STR_UNITS_YEARS :{NUM}{NBSP}vuo{
STR_UNITS_PERIODS :{NUM}{NBSP}jakso{P "" a}
STR_LIST_SEPARATOR :,{SPACE}
STR_TRUNCATION_ELLIPSIS :…
# Common window strings
STR_LIST_FILTER_TITLE :{BLACK}Suodatin:

View File

@ -329,6 +329,7 @@ STR_UNITS_YEARS :{NUM}{NBSP}έτ
STR_UNITS_PERIODS :{NUM}{NBSP}περίοδ{P 0 ος οι}
STR_LIST_SEPARATOR :,{SPACE}
STR_TRUNCATION_ELLIPSIS :...
# Common window strings
STR_LIST_FILTER_TITLE :{BLACK}Φιλτράρισμα λίστας:

View File

@ -268,6 +268,7 @@ STR_UNITS_YEARS :{NUM}년
STR_UNITS_PERIODS :{NUM}기간
STR_LIST_SEPARATOR :,{SPACE}
STR_TRUNCATION_ELLIPSIS :…
# Common window strings
STR_LIST_FILTER_TITLE :{BLACK}검색:

View File

@ -646,6 +646,7 @@ STR_UNITS_YEARS :{NUM}{NBSP}{P r
STR_UNITS_PERIODS :{NUM}{NBSP}okres{P "" y ów}
STR_LIST_SEPARATOR :,{SPACE}
STR_TRUNCATION_ELLIPSIS :...
# Common window strings
STR_LIST_FILTER_TITLE :{BLACK}Filtr:

View File

@ -268,6 +268,7 @@ STR_UNITS_YEARS :{NUM}{NBSP}ano{
STR_UNITS_PERIODS :{NUM}{NBSP}período{P "" s}
STR_LIST_SEPARATOR :,{SPACE}
STR_TRUNCATION_ELLIPSIS :...
# Common window strings
STR_LIST_FILTER_TITLE :{BLACK}Filtro:

View File

@ -393,6 +393,7 @@ STR_UNITS_YEARS :{NUM}{NBSP}{P
STR_UNITS_PERIODS :{NUM}{NBSP}цикл{P "" а ов}
STR_LIST_SEPARATOR :,{SPACE}
STR_TRUNCATION_ELLIPSIS :...
# Common window strings
STR_LIST_FILTER_TITLE :{BLACK}Фильтр:

View File

@ -267,6 +267,7 @@ STR_UNITS_YEARS :{NUM}{NBSP}年
STR_UNITS_PERIODS :{NUM}{NBSP}个周期
STR_LIST_SEPARATOR :、
STR_TRUNCATION_ELLIPSIS :…
# Common window strings
STR_LIST_FILTER_TITLE :{BLACK}搜索:

View File

@ -267,6 +267,7 @@ STR_UNITS_YEARS :{NUM}{NBSP}年
STR_UNITS_PERIODS :{NUM}{NBSP}個週期
STR_LIST_SEPARATOR :、
STR_TRUNCATION_ELLIPSIS :……
# Common window strings
STR_LIST_FILTER_TITLE :{BLACK}篩選: