Removed remainder of the 'touchscreen mode' code
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -288,7 +288,6 @@ struct TerraformToolbarWindow : Window {
|
||||
{
|
||||
DeleteWindowById(WC_BUILD_OBJECT, 0);
|
||||
this->RaiseButtons();
|
||||
EraseQueuedTouchCommand();
|
||||
ResetObjectToPlace();
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -174,7 +174,6 @@ public:
|
||||
this->RaiseButtons();
|
||||
|
||||
ResetObjectToPlace();
|
||||
EraseQueuedTouchCommand();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user