summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2011-12-11 15:55:31 +0000
committerfrosch <frosch@openttd.org>2011-12-11 15:55:31 +0000
commit1ea449630d835095d9cab47fd53d035dee9663ed (patch)
tree189b864b55b729a9b232b6cb8fe9453fe081b72f /src
parent8f36e70e354c7af1f82d27f406d02a0bf9528b45 (diff)
downloadopenttd-1ea449630d835095d9cab47fd53d035dee9663ed.tar.xz
(svn r23497) -Add: Advanced display setting to control the linewidth in graphs. (ChillCore)
Diffstat (limited to 'src')
-rw-r--r--src/graph_gui.cpp7
-rw-r--r--src/lang/english.txt1
-rw-r--r--src/settings_gui.cpp1
-rw-r--r--src/settings_type.h1
-rw-r--r--src/table/settings.ini10
5 files changed, 18 insertions, 2 deletions
diff --git a/src/graph_gui.cpp b/src/graph_gui.cpp
index 65f688c5d..44d281a2e 100644
--- a/src/graph_gui.cpp
+++ b/src/graph_gui.cpp
@@ -419,6 +419,9 @@ protected:
}
/* draw lines and dots */
+ uint linewidth = _settings_client.gui.graph_line_thickness;
+ uint pointoffs1 = (linewidth + 1) / 2;
+ uint pointoffs2 = linewidth + 1 - pointoffs1;
for (int i = 0; i < this->num_dataset; i++) {
if (!HasBit(this->excluded_data, i)) {
/* Centre the dot between the grid lines. */
@@ -455,10 +458,10 @@ protected:
y = r.top + x_axis_offset - ((r.bottom - r.top) * datapoint) / (interval_size >> reduce_range);
/* Draw the point. */
- GfxFillRect(x - 2, y - 2, x + 2, y + 2, colour);
+ GfxFillRect(x - pointoffs1, y - pointoffs1, x + pointoffs2, y + pointoffs2, colour);
/* Draw the line connected to the previous point. */
- if (prev_x != INVALID_DATAPOINT_POS) GfxDrawLine(prev_x, prev_y, x, y, colour, 3);
+ if (prev_x != INVALID_DATAPOINT_POS) GfxDrawLine(prev_x, prev_y, x, y, colour, linewidth);
prev_x = x;
prev_y = y;
diff --git a/src/lang/english.txt b/src/lang/english.txt
index 350cd166c..e0a079b91 100644
--- a/src/lang/english.txt
+++ b/src/lang/english.txt
@@ -1174,6 +1174,7 @@ STR_CONFIG_SETTING_ERRMSG_DURATION :{LTBLUE}Duratio
STR_CONFIG_SETTING_HOVER_DELAY :{LTBLUE}Show tooltips: {ORANGE}Hover for {STRING1} second{P 0:1 "" s}
STR_CONFIG_SETTING_HOVER_DELAY_DISABLED :{LTBLUE}Show tooltips: {ORANGE}Right click
STR_CONFIG_SETTING_POPULATION_IN_LABEL :{LTBLUE}Show town population in the town name label: {ORANGE}{STRING1}
+STR_CONFIG_SETTING_GRAPH_LINE_THICKNESS :{LTBLUE}Thickness of lines in graphs: {ORANGE}{STRING1}
STR_CONFIG_SETTING_LAND_GENERATOR :{LTBLUE}Land generator: {ORANGE}{STRING1}
STR_CONFIG_SETTING_LAND_GENERATOR_ORIGINAL :Original
diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp
index 6ea6f0b22..e0fca2afc 100644
--- a/src/settings_gui.cpp
+++ b/src/settings_gui.cpp
@@ -1359,6 +1359,7 @@ static SettingEntry _settings_ui_display[] = {
SettingEntry("gui.smallmap_land_colour"),
SettingEntry("gui.zoom_min"),
SettingEntry("gui.zoom_max"),
+ SettingEntry("gui.graph_line_thickness"),
};
/** Display options sub-page */
static SettingsPage _settings_ui_display_page = {_settings_ui_display, lengthof(_settings_ui_display)};
diff --git a/src/settings_type.h b/src/settings_type.h
index 6562cb365..1d57c1513 100644
--- a/src/settings_type.h
+++ b/src/settings_type.h
@@ -115,6 +115,7 @@ struct GUISettings {
bool expenses_layout; ///< layout of expenses window
uint32 last_newgrf_count; ///< the numbers of NewGRFs we found during the last scan
byte missing_strings_threshold; ///< the number of missing strings before showing the warning
+ uint8 graph_line_thickness; ///< the thickness of the lines in the various graph guis
uint16 console_backlog_timeout; ///< the minimum amount of time items should be in the console backlog before they will be removed in ~3 seconds granularity.
uint16 console_backlog_length; ///< the minimum amount of items in the console backlog before items will be removed.
diff --git a/src/table/settings.ini b/src/table/settings.ini
index 40052828b..3a834336a 100644
--- a/src/table/settings.ini
+++ b/src/table/settings.ini
@@ -2425,6 +2425,16 @@ def = 25
min = 1
max = UINT8_MAX
+[SDTC_VAR]
+var = gui.graph_line_thickness
+type = SLE_UINT8
+flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
+def = 3
+min = 1
+max = 5
+str = STR_CONFIG_SETTING_GRAPH_LINE_THICKNESS
+proc = RedrawScreen
+
; For the dedicated build we'll enable dates in logs by default.
[SDTC_BOOL]
ifdef = DEDICATED