Files
commandergenius/project/jni/application/openttd/0220-Amend-gui-s-to-work-with-touchscreen-controls.patch

121 lines
2.9 KiB
Diff

From 69eec94d6f79ffc1fc2a3bdb11f50d7c42172135 Mon Sep 17 00:00:00 2001
From: Juanjo <juanjo.ng.83@gmail.com>
Date: Mon, 24 Jun 2013 20:32:29 +0200
Subject: [PATCH 220/249] Amend gui's to work with touchscreen controls.
---
src/airport_gui.cpp | 3 +++
src/industry_gui.cpp | 4 ++++
src/terraform_gui.cpp | 2 ++
src/town_gui.cpp | 4 ++++
src/tree_gui.cpp | 8 ++++++++
5 files changed, 21 insertions(+)
diff --git a/src/airport_gui.cpp b/src/airport_gui.cpp
index 77a71d4..61c9f2d 100644
--- a/src/airport_gui.cpp
+++ b/src/airport_gui.cpp
@@ -77,6 +77,7 @@ struct BuildAirToolbarWindow : Window {
~BuildAirToolbarWindow()
{
+ if (_thd.GetCallbackWnd() == this) this->OnPlaceObjectAbort();
if (_settings_client.gui.link_terraform_toolbar) DeleteWindowById(WC_SCEN_LAND_GEN, 0, false);
}
@@ -141,6 +142,8 @@ struct BuildAirToolbarWindow : Window {
DeleteWindowById(WC_BUILD_STATION, TRANSPORT_AIR);
DeleteWindowById(WC_SELECT_STATION, 0);
+
+ ResetObjectToPlace();
}
static HotkeyList hotkeys;
diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp
index 8c8245b..3ddb3c5 100644
--- a/src/industry_gui.cpp
+++ b/src/industry_gui.cpp
@@ -281,6 +281,10 @@ public:
this->SetButtons();
}
+ ~BuildIndustryWindow() {
+ if (_thd.GetCallbackWnd() == this) this->OnPlaceObjectAbort();
+ }
+
virtual void OnInit()
{
this->SetupArrays();
diff --git a/src/terraform_gui.cpp b/src/terraform_gui.cpp
index 95ad6da..c2d697a 100644
--- a/src/terraform_gui.cpp
+++ b/src/terraform_gui.cpp
@@ -158,6 +158,7 @@ struct TerraformToolbarWindow : Window {
~TerraformToolbarWindow()
{
+ if (_thd.GetCallbackWnd() == this) this->OnPlaceObjectAbort();
}
virtual void OnInit()
@@ -287,6 +288,7 @@ struct TerraformToolbarWindow : Window {
{
DeleteWindowById(WC_BUILD_OBJECT, 0);
this->RaiseButtons();
+ ResetObjectToPlace();
}
static HotkeyList hotkeys;
diff --git a/src/town_gui.cpp b/src/town_gui.cpp
index 841c70e..d1f9847 100644
--- a/src/town_gui.cpp
+++ b/src/town_gui.cpp
@@ -1072,6 +1072,10 @@ public:
this->UpdateButtons(true);
}
+ ~FoundTownWindow() {
+ if (_thd.GetCallbackWnd() == this) this->OnPlaceObjectAbort();
+ }
+
void RandomTownName()
{
this->townnamevalid = GenerateTownName(&this->townnameparts);
diff --git a/src/tree_gui.cpp b/src/tree_gui.cpp
index 784f454..34c3862 100644
--- a/src/tree_gui.cpp
+++ b/src/tree_gui.cpp
@@ -18,6 +18,7 @@
#include "command_func.h"
#include "sound_func.h"
#include "tree_map.h"
+#include "window_func.h"
#include "widgets/tree_widget.h"
@@ -58,6 +59,11 @@ public:
ResetObjectToPlace();
}
+ ~BuildTreesWindow()
+ {
+ if (_thd.GetCallbackWnd() == this) this->OnPlaceObjectAbort();
+ }
+
/**
* Calculate the maximum size of all tree sprites
* @return Dimension of the largest tree sprite
@@ -166,6 +172,8 @@ public:
virtual void OnPlaceObjectAbort()
{
this->RaiseButtons();
+
+ ResetObjectToPlace();
}
};
--
1.8.1.2