From 41da4be66b919ebaa7a882f61580815c381524e2 Mon Sep 17 00:00:00 2001 From: Sergii Pylypenko Date: Tue, 3 Jun 2014 20:27:45 +0300 Subject: [PATCH] Removed remainder of the 'touchscreen mode' code --- src/airport_gui.cpp | 2 -- src/command.cpp | 70 ------------------------------------------ src/command_func.h | 6 ---- src/console_gui.cpp | 8 ----- src/dock_gui.cpp | 2 -- src/gfx.cpp | 2 -- src/lang/english.txt | 9 ++---- src/rail_gui.cpp | 1 - src/road_gui.cpp | 2 -- src/settings_type.h | 1 - src/table/settings.ini | 15 --------- src/terraform_gui.cpp | 1 - src/toolbar_gui.cpp | 1 - src/tree_gui.cpp | 1 - src/video/sdl_v.cpp | 6 ++-- src/window.cpp | 3 +- 16 files changed, 5 insertions(+), 125 deletions(-) diff --git a/src/airport_gui.cpp b/src/airport_gui.cpp index aa57562241..225a95e5b9 100644 --- a/src/airport_gui.cpp +++ b/src/airport_gui.cpp @@ -143,7 +143,6 @@ struct BuildAirToolbarWindow : Window { DeleteWindowById(WC_BUILD_STATION, TRANSPORT_AIR); DeleteWindowById(WC_SELECT_STATION, 0); - EraseQueuedTouchCommand(); ResetObjectToPlace(); } @@ -244,7 +243,6 @@ public: virtual ~BuildAirportWindow() { - EraseQueuedTouchCommand(); DeleteWindowById(WC_SELECT_STATION, 0); } diff --git a/src/command.cpp b/src/command.cpp index fc827449f3..777eb4107c 100644 --- a/src/command.cpp +++ b/src/command.cpp @@ -527,76 +527,6 @@ bool DoCommandP(const CommandContainer *container, bool my_cmd) return DoCommandP(container->tile, container->p1, container->p2, container->cmd, container->callback, container->text, my_cmd); } -/* Stored data for a command that is waiting for user confirmation. */ -bool _is_queued_command; -bool _my_cmd; -CommandContainer _queued_command; - -/** - * Store a command that needs user confirmation. - * If current mode doesn't need confirmation, execute it immediately via DoCommandP. - * @param tile The tile to perform a command on (see #CommandProc) - * @param p1 Additional data for the command (see #CommandProc) - * @param p2 Additional data for the command (see #CommandProc) - * @param cmd The command to execute (a CMD_* value) - * @param callback A callback function to call after the command is finished - * @param text The text to pass - * @param my_cmd indicator if the command is from a company or server (to display error messages for a user) - * @return \c true if the command succeeded or is stored, else \c false. - */ -bool TouchCommandP(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, CommandCallback *callback, const char *text, bool my_cmd) -{ - if (_settings_client.gui.touchscreen_mode == TSC_CONFIRM && !_shift_pressed) { - _queued_command.tile = tile; - _queued_command.p1 = p1; - _queued_command.p2 = p2; - _queued_command.cmd = cmd; - _queued_command.callback = callback; - if (text != NULL) ttd_strlcpy(_queued_command.text, text, 32 * MAX_CHAR_LENGTH); - _my_cmd = my_cmd; - _is_queued_command = true; - return true; - } else { - return DoCommandP(tile, p1, p2, cmd, callback, text, my_cmd); - } -} - -/** - * Shortcut for the long TouchCommandP when having a container with the data. - * Store a command that needs user confirmation. - * If current mode doesn't need confirmation, execute it immediately via DoCommandP. - * @param container the container with information. - * @param my_cmd indicator if the command is from a company or server (to display error messages for a user) - * @return true if the command succeeded or when it is stored, else false - */ -bool TouchCommandP(const CommandContainer *container, bool my_cmd) -{ - return TouchCommandP(container->tile, container->p1, container->p2, container->cmd, container->callback, container->text, my_cmd); -} - -/** Return whether there is a command stored waiting for confirmation. */ -bool IsQueuedTouchCommand() -{ - return _is_queued_command; -} - -/** Execute a stored command. Keep it when asking for estimated cost. */ -bool DoQueuedTouchCommand() -{ - bool result = DoCommandP(&_queued_command, _my_cmd); - if (!_shift_pressed && result) EraseQueuedTouchCommand(); - return result; -} - -/** Erase a stored command and update viewport and touchscreen bar. */ -void EraseQueuedTouchCommand() -{ - if (!IsQueuedTouchCommand()) return; - _is_queued_command = false; - SetSelectionTilesDirty(); - _thd.Reset(); -} - /*! * Toplevel network safe docommand function for the current company. Must not be called recursively. * The callback is called when the command succeeded or failed. The parameters diff --git a/src/command_func.h b/src/command_func.h index ab9fb05d42..c4cc51e3da 100644 --- a/src/command_func.h +++ b/src/command_func.h @@ -40,12 +40,6 @@ CommandCost DoCommand(const CommandContainer *container, DoCommandFlag flags); bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, CommandCallback *callback = NULL, const char *text = NULL, bool my_cmd = true); bool DoCommandP(const CommandContainer *container, bool my_cmd = true); -bool TouchCommandP(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, CommandCallback *callback = NULL, const char *text = NULL, bool my_cmd = true); -bool TouchCommandP(const CommandContainer *container, bool my_cmd = true); -bool IsQueuedTouchCommand(); -bool DoQueuedTouchCommand(); -void EraseQueuedTouchCommand(); - CommandCost DoCommandPInternal(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, CommandCallback *callback, const char *text, bool my_cmd, bool estimate_only); #ifdef ENABLE_NETWORK diff --git a/src/console_gui.cpp b/src/console_gui.cpp index dbf194d163..3f5fe45302 100644 --- a/src/console_gui.cpp +++ b/src/console_gui.cpp @@ -232,14 +232,6 @@ struct IConsoleWindow : Window } } - virtual void OnClick(Point pt, int widget, int click_count) - { - if (_settings_client.gui.touchscreen_mode == 0) return; - - ShowQueryString(STR_EMPTY, STR_CONSOLE_QUERY_STRING, ICON_CMDLN_SIZE, - this, CS_ALPHANUMERAL, QSF_NONE); - } - virtual void OnQueryTextFinished(char *str) { _focused_window = this; diff --git a/src/dock_gui.cpp b/src/dock_gui.cpp index 1d2b2e8abc..9dcb3c40d8 100644 --- a/src/dock_gui.cpp +++ b/src/dock_gui.cpp @@ -280,7 +280,6 @@ struct BuildDocksToolbarWindow : Window { DeleteWindowById(WC_BUILD_DEPOT, TRANSPORT_WATER); DeleteWindowById(WC_SELECT_STATION, 0); DeleteWindowByClass(WC_BUILD_BRIDGE); - EraseQueuedTouchCommand(); } virtual void OnPlacePresize(Point pt, TileIndex tile_from) @@ -554,7 +553,6 @@ public: this->LowerWidget(_ship_depot_direction + WID_BDD_X); if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); UpdateDocksDirection(); - EraseQueuedTouchCommand(); this->SetDirty(); break; } diff --git a/src/gfx.cpp b/src/gfx.cpp index e489bae363..10af016469 100644 --- a/src/gfx.cpp +++ b/src/gfx.cpp @@ -1187,8 +1187,6 @@ void UndrawMouseCursor() void DrawMouseCursor() { - if (_settings_client.gui.touchscreen_mode != 0) return; - /* Don't draw the mouse cursor if the screen is not ready */ if (_screen.dst_ptr == NULL) return; diff --git a/src/lang/english.txt b/src/lang/english.txt index 601a929e2c..1617b0c538 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -1184,13 +1184,8 @@ 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_VERTICAL_TOOLBAR :Vertical toolbar -STR_CONFIG_SETTING_VERTICAL_TOOLBAR_HELPTEXT :Main toolbar is split into two vertical toolbars on the sides of the screen -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_TOUCHSCREEN_CONFIRM :confirm +STR_CONFIG_SETTING_VERTICAL_TOOLBAR :{BLACK}Vertical toolbar +STR_CONFIG_SETTING_VERTICAL_TOOLBAR_HELPTEXT :{BLACK}Main toolbar is split into two vertical toolbars on the sides of the screen STR_CONFIG_SETTING_BUTTON_SIZE :{BLACK}Button size STR_CONFIG_SETTING_BUTTON_SIZE_TOOLTIP :{BLACK}Size of all user interface elements STR_CONFIG_SETTING_FONT_SIZE :{BLACK}Font size diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp index 7071ccc849..082d169314 100644 --- a/src/rail_gui.cpp +++ b/src/rail_gui.cpp @@ -753,7 +753,6 @@ struct BuildRailToolbarWindow : Window { DeleteWindowById(WC_BUILD_WAYPOINT, TRANSPORT_RAIL); DeleteWindowById(WC_SELECT_STATION, 0); DeleteWindowByClass(WC_BUILD_BRIDGE); - EraseQueuedTouchCommand(); } virtual void OnPlacePresize(Point pt, TileIndex tile_from) diff --git a/src/road_gui.cpp b/src/road_gui.cpp index 890eafed48..8058ed5668 100644 --- a/src/road_gui.cpp +++ b/src/road_gui.cpp @@ -532,7 +532,6 @@ struct BuildRoadToolbarWindow : Window { DeleteWindowById(WC_BUILD_DEPOT, TRANSPORT_ROAD); DeleteWindowById(WC_SELECT_STATION, 0); DeleteWindowByClass(WC_BUILD_BRIDGE); - EraseQueuedTouchCommand(); } virtual void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt) @@ -1019,7 +1018,6 @@ struct BuildRoadStationWindow : public PickerWindowBase { if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); this->SetDirty(); DeleteWindowById(WC_SELECT_STATION, 0); - EraseQueuedTouchCommand(); break; case WID_BROS_LT_OFF: diff --git a/src/settings_type.h b/src/settings_type.h index 84ec1ab559..6a9752c991 100644 --- a/src/settings_type.h +++ b/src/settings_type.h @@ -79,7 +79,6 @@ struct GUISettings { uint8 order_review_system; ///< perform order reviews on vehicles bool vehicle_income_warn; ///< if a vehicle isn't generating income, show a warning bool vertical_toolbar; ///< main toolbar is split into two vertical toolbars - 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 show_finances; ///< show finances at end of year diff --git a/src/table/settings.ini b/src/table/settings.ini index 4d9577b220..4a1036aea4 100644 --- a/src/table/settings.ini +++ b/src/table/settings.ini @@ -2507,21 +2507,6 @@ strhelp = STR_CONFIG_SETTING_VERTICAL_TOOLBAR_HELPTEXT proc = VerticalToolbarChanged cat = SC_BASIC -[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 = 2 -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 diff --git a/src/terraform_gui.cpp b/src/terraform_gui.cpp index 51fb0d773c..f2c56063fd 100644 --- a/src/terraform_gui.cpp +++ b/src/terraform_gui.cpp @@ -288,7 +288,6 @@ struct TerraformToolbarWindow : Window { { DeleteWindowById(WC_BUILD_OBJECT, 0); this->RaiseButtons(); - EraseQueuedTouchCommand(); ResetObjectToPlace(); } diff --git a/src/toolbar_gui.cpp b/src/toolbar_gui.cpp index edacf68c64..96aafb7b79 100644 --- a/src/toolbar_gui.cpp +++ b/src/toolbar_gui.cpp @@ -1180,7 +1180,6 @@ static CallBackFunction ToolbarCtrlClick(Window *w) w->SetWidgetLoweredState(WID_TN_CTRL, _ctrl_pressed); w->SetWidgetDirty(WID_TN_CTRL); HandleCtrlChanged(); - EraseQueuedTouchCommand(); if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); return CBF_NONE; } diff --git a/src/tree_gui.cpp b/src/tree_gui.cpp index e12ec7606b..34c3862da2 100644 --- a/src/tree_gui.cpp +++ b/src/tree_gui.cpp @@ -174,7 +174,6 @@ public: this->RaiseButtons(); ResetObjectToPlace(); - EraseQueuedTouchCommand(); } }; diff --git a/src/video/sdl_v.cpp b/src/video/sdl_v.cpp index c20cac2cfa..42671c1985 100644 --- a/src/video/sdl_v.cpp +++ b/src/video/sdl_v.cpp @@ -775,10 +775,8 @@ void VideoDriver_SDL::MainLoop() bool old_ctrl_pressed = _ctrl_pressed; #ifndef __ANDROID__ - if (_settings_client.gui.touchscreen_mode == TSC_NONE) { - _ctrl_pressed = !!(mod & KMOD_CTRL); - _shift_pressed = !!(mod & KMOD_SHIFT); - } + _ctrl_pressed = !!(mod & KMOD_CTRL); + _shift_pressed = !!(mod & KMOD_SHIFT); #endif /* determine which directional keys are down */ diff --git a/src/window.cpp b/src/window.cpp index f7590fc25b..a037d6d19a 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -2842,13 +2842,12 @@ static void MouseLoop(MouseClick click, int mousewheel) Window *w = FindWindowFromPt(x, y); if (w == NULL) return; ViewPort *vp = IsPtInWindowViewport(w, x, y); - bool confirm = (_settings_client.gui.touchscreen_mode == TSC_CONFIRM); /* Don't allow any action in a viewport if either in menu or when having a modal progress window */ if (vp != NULL && (_game_mode == GM_MENU || HasModalProgress())) return; /* On confirm mode do not update tile selection unless we are clicking on a viewport. */ - if (!confirm || (vp != NULL && _left_button_down && !_move_pressed)) { + if (vp != NULL && _left_button_down && !_move_pressed) { HandlePlacePresize(); UpdateTileSelection(); } else {