From a4c61028223bad910dac14831f56a4a7c6e2fa4c Mon Sep 17 00:00:00 2001 From: Juanjo Date: Sat, 29 Jun 2013 19:00:13 +0200 Subject: [PATCH] Add settings for touchscreen controls. --- src/lang/english.txt | 4 ++++ src/settings.cpp | 7 +++++++ src/settings_gui.cpp | 1 + src/settings_type.h | 2 ++ src/table/settings.ini | 16 ++++++++++++++++ 5 files changed, 30 insertions(+) diff --git a/src/lang/english.txt b/src/lang/english.txt index 3b7889bd8f..60ea491032 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -1184,6 +1184,10 @@ STR_CONFIG_SETTING_SIGNALSIDE_HELPTEXT :Select on which STR_CONFIG_SETTING_SIGNALSIDE_LEFT :On the left STR_CONFIG_SETTING_SIGNALSIDE_DRIVING_SIDE :On the driving side STR_CONFIG_SETTING_SIGNALSIDE_RIGHT :On the right +STR_CONFIG_SETTING_TOUCHSCREEN_MODE :Control mode for touchscreen devices: {STRING2} +STR_CONFIG_SETTING_TOUCHSCREEN_MODE_HELPTEXT :If playing with a mouse, choose no adaptation. Other modes are for touchscreen devices. Associated hotkey: N +STR_CONFIG_SETTING_TOUCHSCREEN_NONE :no adaptation +STR_CONFIG_SETTING_TOUCHSCREEN_SIMPLE :simple STR_CONFIG_SETTING_SHOWFINANCES :Show finances window at the end of the year: {STRING2} STR_CONFIG_SETTING_SHOWFINANCES_HELPTEXT :If enabled, the finances window pops up at the end of each year to allow easy inspection of the financial status of the company STR_CONFIG_SETTING_NONSTOP_BY_DEFAULT :New orders are 'non-stop' by default: {STRING2} diff --git a/src/settings.cpp b/src/settings.cpp index 970c169b4a..16f8f5d15b 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -64,6 +64,7 @@ #include "roadveh.h" #include "fios.h" #include "strings_func.h" +#include "toolbar_gui.h" #include "void_map.h" #include "station_base.h" @@ -1069,6 +1070,12 @@ static bool ZoomMinMaxChanged(int32 p1) return true; } +static bool TouchscreenModeChanged(int32 p1) +{ + //ResetTabletWindow(); + return true; +} + /** * Update any possible saveload window and delete any newgrf dialogue as * its widget parts might change. Reinit all windows as it allows access to the diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp index a02dc915f0..bf1af26cc0 100644 --- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -1487,6 +1487,7 @@ static SettingEntry _settings_ui[] = { SettingEntry(&_settings_ui_interaction_page, STR_CONFIG_SETTING_INTERACTION), SettingEntry(&_settings_ui_sound_page, STR_CONFIG_SETTING_SOUND), SettingEntry(&_settings_ui_news_page, STR_CONFIG_SETTING_NEWS), + SettingEntry("gui.touchscreen_mode"), SettingEntry("gui.show_finances"), SettingEntry("gui.errmsg_duration"), SettingEntry("gui.hover_delay"), diff --git a/src/settings_type.h b/src/settings_type.h index f87c6bf354..cb9d95bb0f 100644 --- a/src/settings_type.h +++ b/src/settings_type.h @@ -21,6 +21,7 @@ #include "linkgraph/linkgraph_type.h" #include "zoom_type.h" #include "openttd.h" +#include "toolbar_type.h" /** Settings profiles and highscore tables. */ @@ -77,6 +78,7 @@ struct GUISettings { bool lost_vehicle_warn; ///< if a vehicle can't find its destination, show a warning uint8 order_review_system; ///< perform order reviews on vehicles bool vehicle_income_warn; ///< if a vehicle isn't generating income, show a warning + TouchscreenModeByte touchscreen_mode; ///< touchscreen mode for toolbars uint min_button; ///< min size of most button widgets uint min_step; ///< min size of scrollbar/dropdown elements bool manage_min_sizing; ///< automatically set min_button and min_step diff --git a/src/table/settings.ini b/src/table/settings.ini index 7c55ae9ef6..f3cca6dd2b 100644 --- a/src/table/settings.ini +++ b/src/table/settings.ini @@ -40,6 +40,7 @@ static bool RedrawTownAuthority(int32 p1); static bool InvalidateCompanyInfrastructureWindow(int32 p1); static bool InvalidateCompanyWindow(int32 p1); static bool ZoomMinMaxChanged(int32 p1); +static bool TouchscreenModeChanged(int32 p1); #ifdef ENABLE_NETWORK static bool UpdateClientName(int32 p1); @@ -2496,6 +2497,21 @@ str = STR_CONFIG_SETTING_DATE_FORMAT_IN_SAVE_NAMES strhelp = STR_CONFIG_SETTING_DATE_FORMAT_IN_SAVE_NAMES_HELPTEXT strval = STR_CONFIG_SETTING_DATE_FORMAT_IN_SAVE_NAMES_LONG +[SDTC_VAR] +var = gui.touchscreen_mode +flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC +type = SLE_UINT8 +guiflags = SGF_MULTISTRING +def = 0 +min = 0 +max = 1 +interval = 1 +str = STR_CONFIG_SETTING_TOUCHSCREEN_MODE +strval = STR_CONFIG_SETTING_TOUCHSCREEN_NONE +strhelp = STR_CONFIG_SETTING_TOUCHSCREEN_MODE_HELPTEXT +proc = TouchscreenModeChanged +cat = SC_BASIC + [SDTC_BOOL] var = gui.show_finances flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC