summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/airport_gui.cpp2
-rw-r--r--src/bridge_gui.cpp1
-rw-r--r--src/build_vehicle_gui.cpp1
-rw-r--r--src/command.cpp1
-rw-r--r--src/console.cpp2
-rw-r--r--src/depot_gui.cpp1
-rw-r--r--src/dock_gui.cpp2
-rw-r--r--src/engine_gui.cpp1
-rw-r--r--src/genworld.cpp2
-rw-r--r--src/genworld_gui.cpp3
-rw-r--r--src/graph_gui.cpp1
-rw-r--r--src/group_gui.cpp2
-rw-r--r--src/gui.h31
-rw-r--r--src/industry_gui.cpp2
-rw-r--r--src/intro_gui.cpp2
-rw-r--r--src/main_gui.cpp3
-rw-r--r--src/misc_cmd.cpp2
-rw-r--r--src/misc_gui.cpp3
-rw-r--r--src/network/network_gui.cpp7
-rw-r--r--src/newgrf_gui.cpp2
-rw-r--r--src/news_gui.cpp1
-rw-r--r--src/openttd.cpp1
-rw-r--r--src/order_gui.cpp1
-rw-r--r--src/player_gui.cpp2
-rw-r--r--src/rail_gui.cpp2
-rw-r--r--src/road_gui.cpp2
-rw-r--r--src/roadveh_gui.cpp1
-rw-r--r--src/saveload.cpp1
-rw-r--r--src/settings.cpp1
-rw-r--r--src/settings_gui.cpp2
-rw-r--r--src/ship_gui.cpp1
-rw-r--r--src/signs_gui.cpp2
-rw-r--r--src/smallmap_gui.cpp1
-rw-r--r--src/station_gui.cpp2
-rw-r--r--src/station_gui.h9
-rw-r--r--src/terraform_gui.cpp1
-rw-r--r--src/textbuf_gui.h45
-rw-r--r--src/timetable_gui.cpp2
-rw-r--r--src/town_gui.cpp2
-rw-r--r--src/train_gui.cpp1
-rw-r--r--src/transparency_gui.cpp1
-rw-r--r--src/unix.cpp2
-rw-r--r--src/vehicle_gui.cpp2
-rw-r--r--src/win32.cpp1
-rw-r--r--src/window_func.h2
-rw-r--r--src/window_gui.h30
-rw-r--r--src/window_type.h8
47 files changed, 138 insertions, 59 deletions
diff --git a/src/airport_gui.cpp b/src/airport_gui.cpp
index f70ee4582..f5c099dc4 100644
--- a/src/airport_gui.cpp
+++ b/src/airport_gui.cpp
@@ -8,7 +8,9 @@
#include "table/strings.h"
#include "functions.h"
#include "map.h"
+#include "window_gui.h"
#include "gui.h"
+#include "station_gui.h"
#include "viewport.h"
#include "gfx.h"
#include "sound.h"
diff --git a/src/bridge_gui.cpp b/src/bridge_gui.cpp
index e1f4036c2..8affc28d2 100644
--- a/src/bridge_gui.cpp
+++ b/src/bridge_gui.cpp
@@ -9,6 +9,7 @@
#include "functions.h"
#include "map.h"
#include "gui.h"
+#include "window_gui.h"
#include "viewport.h"
#include "gfx.h"
#include "command.h"
diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp
index b6e546877..185ddd53d 100644
--- a/src/build_vehicle_gui.cpp
+++ b/src/build_vehicle_gui.cpp
@@ -16,6 +16,7 @@
#include "vehicle.h"
#include "articulated_vehicles.h"
#include "gfx.h"
+#include "textbuf_gui.h"
#include "station.h"
#include "command.h"
#include "engine.h"
diff --git a/src/command.cpp b/src/command.cpp
index e65b8a4b2..00f7b4614 100644
--- a/src/command.cpp
+++ b/src/command.cpp
@@ -16,6 +16,7 @@
#include "variables.h"
#include "genworld.h"
#include "newgrf_storage.h"
+#include "tile.h"
const char *_cmd_text = NULL;
diff --git a/src/console.cpp b/src/console.cpp
index fca19fbc5..5e4db8965 100644
--- a/src/console.cpp
+++ b/src/console.cpp
@@ -7,6 +7,8 @@
#include "table/strings.h"
#include "functions.h"
#include "gui.h"
+#include "textbuf_gui.h"
+#include "window_gui.h"
#include "gfx.h"
#include "player.h"
#include "variables.h"
diff --git a/src/depot_gui.cpp b/src/depot_gui.cpp
index bb222baf2..c6a9b6e3b 100644
--- a/src/depot_gui.cpp
+++ b/src/depot_gui.cpp
@@ -13,6 +13,7 @@
#include "strings.h"
#include "table/sprites.h"
#include "gui.h"
+#include "textbuf_gui.h"
#include "gfx.h"
#include "vehicle.h"
#include "viewport.h"
diff --git a/src/dock_gui.cpp b/src/dock_gui.cpp
index 8aa11a551..0423cab14 100644
--- a/src/dock_gui.cpp
+++ b/src/dock_gui.cpp
@@ -10,6 +10,8 @@
#include "map.h"
#include "station.h"
#include "gui.h"
+#include "window_gui.h"
+#include "station_gui.h"
#include "viewport.h"
#include "gfx.h"
#include "sound.h"
diff --git a/src/engine_gui.cpp b/src/engine_gui.cpp
index 288fc54e0..cfe9f8609 100644
--- a/src/engine_gui.cpp
+++ b/src/engine_gui.cpp
@@ -9,6 +9,7 @@
#include "table/sprites.h"
#include "functions.h"
#include "gui.h"
+#include "window_gui.h"
#include "viewport.h"
#include "gfx.h"
#include "engine.h"
diff --git a/src/genworld.cpp b/src/genworld.cpp
index 46dce7dd7..24e7cf38d 100644
--- a/src/genworld.cpp
+++ b/src/genworld.cpp
@@ -14,7 +14,7 @@
#include "genworld.h"
#include "gfx.h"
#include "gfxinit.h"
-#include "gui.h"
+#include "window_func.h"
#include "network/network.h"
#include "debug.h"
#include "settings.h"
diff --git a/src/genworld_gui.cpp b/src/genworld_gui.cpp
index 3380e0373..ad01dea8f 100644
--- a/src/genworld_gui.cpp
+++ b/src/genworld_gui.cpp
@@ -9,7 +9,10 @@
#include "table/strings.h"
#include "table/sprites.h"
#include "gui.h"
+#include "window_gui.h"
+#include "textbuf_gui.h"
#include "gfx.h"
+#include "tile.h"
#include "strings.h"
#include "gfxinit.h"
#include "player.h"
diff --git a/src/graph_gui.cpp b/src/graph_gui.cpp
index 1f9d0e8fe..8c9c7ffeb 100644
--- a/src/graph_gui.cpp
+++ b/src/graph_gui.cpp
@@ -9,6 +9,7 @@
#include "table/sprites.h"
#include "functions.h"
#include "gui.h"
+#include "window_gui.h"
#include "gfx.h"
#include "player.h"
#include "economy.h"
diff --git a/src/group_gui.cpp b/src/group_gui.cpp
index a665b99d8..39ca8a2c4 100644
--- a/src/group_gui.cpp
+++ b/src/group_gui.cpp
@@ -8,6 +8,8 @@
#include "table/strings.h"
#include "table/sprites.h"
#include "gui.h"
+#include "window_gui.h"
+#include "textbuf_gui.h"
#include "gfx.h"
#include "vehicle.h"
#include "command.h"
diff --git a/src/gui.h b/src/gui.h
index 8e6531931..2c8c6d83b 100644
--- a/src/gui.h
+++ b/src/gui.h
@@ -5,12 +5,13 @@
#ifndef GUI_H
#define GUI_H
-#include "station.h"
-#include "window_gui.h"
#include "string.h"
+#include "window_type.h"
+#include "rail_type.h"
+#include "road_type.h"
+#include "vehicle.h"
/* main_gui.cpp */
-void SetupColorsAndInitialWindow();
void CcPlaySound10(bool success, TileIndex tile, uint32 p1, uint32 p2);
void CcBuildCanal(bool success, TileIndex tile, uint32 p1, uint32 p2);
void CcTerraform(bool success, TileIndex tile, uint32 p1, uint32 p2);
@@ -106,15 +107,6 @@ void ShowPlayerCompany(PlayerID player);
void ShowEstimatedCostOrIncome(Money cost, int x, int y);
void ShowErrorMessage(StringID msg_1, StringID msg_2, int x, int y);
-enum StationCoverageType {
- SCT_PASSENGERS_ONLY,
- SCT_NON_PASSENGERS_ONLY,
- SCT_ALL
-};
-
-void DrawStationCoverageAreaText(int sx, int sy, StationCoverageType sct, int rad);
-void CheckRedrawStationCoverage(const Window *w);
-
void ShowSmallMap();
void ShowExtraViewPortWindow();
void SetVScrollCount(Window *w, int num);
@@ -123,19 +115,6 @@ void SetHScrollCount(Window *w, int num);
void ShowCheatWindow();
-void DrawEditBox(Window *w, querystr_d *string, int wid);
-void HandleEditBox(Window *w, querystr_d *string, int wid);
-int HandleEditBoxKey(Window *w, querystr_d *string, int wid, WindowEvent *we);
-bool HandleCaret(Textbuf *tb);
-
-void DeleteTextBufferAll(Textbuf *tb);
-bool DeleteTextBufferChar(Textbuf *tb, int delmode);
-bool InsertTextBufferChar(Textbuf *tb, uint32 key);
-bool InsertTextBufferClipboard(Textbuf *tb);
-bool MoveTextBufferPos(Textbuf *tb, int navmode);
-void InitializeTextBuffer(Textbuf *tb, const char *buf, uint16 maxlength, uint16 maxwidth);
-void UpdateTextBufferSize(Textbuf *tb);
-
void BuildFileList();
void SetFiosType(const byte fiostype);
@@ -146,8 +125,6 @@ extern const TextColour _fios_colors[];
void ShowBuildBridgeWindow(uint start, uint end, byte type);
void ShowBuildIndustryWindow();
-void ShowQueryString(StringID str, StringID caption, uint maxlen, uint maxwidth, Window *parent, CharSetFilter afilter);
-void ShowQuery(StringID caption, StringID message, Window *w, void (*callback)(Window*, bool));
void ShowMusicWindow();
/* main_gui.cpp */
diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp
index 727a52f5c..3dab823fd 100644
--- a/src/industry_gui.cpp
+++ b/src/industry_gui.cpp
@@ -11,6 +11,8 @@
#include "table/sprites.h"
#include "map.h"
#include "gui.h"
+#include "window_gui.h"
+#include "textbuf_gui.h"
#include "gfx.h"
#include "command.h"
#include "viewport.h"
diff --git a/src/intro_gui.cpp b/src/intro_gui.cpp
index 802783fd2..af577e394 100644
--- a/src/intro_gui.cpp
+++ b/src/intro_gui.cpp
@@ -9,6 +9,8 @@
#include "table/sprites.h"
#include "functions.h"
#include "gui.h"
+#include "window_gui.h"
+#include "textbuf_gui.h"
#include "gfx.h"
#include "player.h"
#include "network/network.h"
diff --git a/src/main_gui.cpp b/src/main_gui.cpp
index 5e0f61998..26ea19ead 100644
--- a/src/main_gui.cpp
+++ b/src/main_gui.cpp
@@ -15,6 +15,9 @@
#include "map.h"
#include "tile.h"
#include "gui.h"
+#include "window_gui.h"
+#include "window_func.h"
+#include "textbuf_gui.h"
#include "viewport.h"
#include "gfx.h"
#include "player.h"
diff --git a/src/misc_cmd.cpp b/src/misc_cmd.cpp
index 74fb31302..318f00cdb 100644
--- a/src/misc_cmd.cpp
+++ b/src/misc_cmd.cpp
@@ -11,6 +11,8 @@
#include "player.h"
#include "gfx.h"
#include "gui.h"
+#include "window_func.h"
+#include "textbuf_gui.h"
#include "economy.h"
#include "network/network.h"
#include "variables.h"
diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp
index 812f7e1ac..a00eb8e1c 100644
--- a/src/misc_gui.cpp
+++ b/src/misc_gui.cpp
@@ -18,6 +18,9 @@
#include "table/tree_land.h"
#include "map.h"
#include "gui.h"
+#include "window_gui.h"
+#include "station_gui.h"
+#include "textbuf_gui.h"
#include "viewport.h"
#include "gfx.h"
#include "station.h"
diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp
index 70372d8bc..c9b6c5211 100644
--- a/src/network/network_gui.cpp
+++ b/src/network/network_gui.cpp
@@ -17,6 +17,8 @@
#include "network_gui.h"
#include "network_gamelist.h"
#include "../gui.h"
+#include "../window_gui.h"
+#include "../textbuf_gui.h"
#include "../gfx.h"
#include "../command.h"
#include "../variables.h"
@@ -31,6 +33,11 @@
#define BGC 5
#define BTC 15
+struct chatquerystr_d : public querystr_d {
+ int dest;
+};
+assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(chatquerystr_d));
+
struct network_d {
PlayerID company; // select company in network lobby
byte field; // select text-field in start-server and game-listing
diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp
index 710d9e5ac..43df068e3 100644
--- a/src/newgrf_gui.cpp
+++ b/src/newgrf_gui.cpp
@@ -8,6 +8,8 @@
#include "variables.h"
#include "gfx.h"
#include "gui.h"
+#include "window_gui.h"
+#include "textbuf_gui.h"
#include "table/strings.h"
#include "table/sprites.h"
#include "newgrf.h"
diff --git a/src/news_gui.cpp b/src/news_gui.cpp
index 28d34238f..44a9934ba 100644
--- a/src/news_gui.cpp
+++ b/src/news_gui.cpp
@@ -8,6 +8,7 @@
#include "table/sprites.h"
#include "table/strings.h"
#include "gui.h"
+#include "window_gui.h"
#include "viewport.h"
#include "gfx.h"
#include "news.h"
diff --git a/src/openttd.cpp b/src/openttd.cpp
index 2f5250999..0d88448c9 100644
--- a/src/openttd.cpp
+++ b/src/openttd.cpp
@@ -31,6 +31,7 @@
#include "tunnel_map.h"
#include "vehicle.h"
#include "viewport.h"
+#include "window_func.h"
#include "window_gui.h"
#include "player.h"
#include "command.h"
diff --git a/src/order_gui.cpp b/src/order_gui.cpp
index 80438ef7d..f1f7ee122 100644
--- a/src/order_gui.cpp
+++ b/src/order_gui.cpp
@@ -13,6 +13,7 @@
#include "map.h"
#include "tile.h"
#include "gui.h"
+#include "window_gui.h"
#include "gfx.h"
#include "vehicle.h"
#include "station.h"
diff --git a/src/player_gui.cpp b/src/player_gui.cpp
index bec52e1a0..38a4bb9b5 100644
--- a/src/player_gui.cpp
+++ b/src/player_gui.cpp
@@ -9,6 +9,8 @@
#include "strings.h"
#include "functions.h"
#include "gui.h"
+#include "window_gui.h"
+#include "textbuf_gui.h"
#include "viewport.h"
#include "gfx.h"
#include "player.h"
diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp
index 3dde487de..7791bf7c5 100644
--- a/src/rail_gui.cpp
+++ b/src/rail_gui.cpp
@@ -13,6 +13,8 @@
#include "map.h"
#include "tile.h"
#include "gui.h"
+#include "window_gui.h"
+#include "station_gui.h"
#include "viewport.h"
#include "gfx.h"
#include "sound.h"
diff --git a/src/road_gui.cpp b/src/road_gui.cpp
index 1204bf314..e32b8b591 100644
--- a/src/road_gui.cpp
+++ b/src/road_gui.cpp
@@ -11,6 +11,8 @@
#include "map.h"
#include "tile.h"
#include "gui.h"
+#include "window_gui.h"
+#include "station_gui.h"
#include "viewport.h"
#include "gfx.h"
#include "sound.h"
diff --git a/src/roadveh_gui.cpp b/src/roadveh_gui.cpp
index 86ca4e142..658bdae64 100644
--- a/src/roadveh_gui.cpp
+++ b/src/roadveh_gui.cpp
@@ -10,6 +10,7 @@
#include "table/sprites.h"
#include "table/strings.h"
#include "gui.h"
+#include "window_gui.h"
#include "strings.h"
#include "vehicle.h"
#include "viewport.h"
diff --git a/src/saveload.cpp b/src/saveload.cpp
index 43ce745db..165d26802 100644
--- a/src/saveload.cpp
+++ b/src/saveload.cpp
@@ -27,6 +27,7 @@
#include "variables.h"
#include "table/strings.h"
#include "strings.h"
+#include "window_func.h"
#include <list>
extern const uint16 SAVEGAME_VERSION = 83;
diff --git a/src/settings.cpp b/src/settings.cpp
index 98be97da0..bc813af85 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -44,6 +44,7 @@
#include "train.h"
#include "helpers.hpp"
#include "news.h"
+#include "window_func.h"
#ifdef WITH_FREETYPE
#include "gfx.h"
#include "fontcache.h"
diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp
index 14f82c59d..697628769 100644
--- a/src/settings_gui.cpp
+++ b/src/settings_gui.cpp
@@ -11,6 +11,8 @@
#include "table/sprites.h"
#include "table/strings.h"
#include "gui.h"
+#include "window_gui.h"
+#include "textbuf_gui.h"
#include "gfx.h"
#include "command.h"
#include "engine.h"
diff --git a/src/ship_gui.cpp b/src/ship_gui.cpp
index d2d2f1a90..a28910a44 100644
--- a/src/ship_gui.cpp
+++ b/src/ship_gui.cpp
@@ -11,6 +11,7 @@
#include "strings.h"
#include "table/sprites.h"
#include "gui.h"
+#include "window_gui.h"
#include "vehicle.h"
#include "viewport.h"
#include "command.h"
diff --git a/src/signs_gui.cpp b/src/signs_gui.cpp
index d8d9a12ae..cd56352d8 100644
--- a/src/signs_gui.cpp
+++ b/src/signs_gui.cpp
@@ -8,6 +8,8 @@
#include "table/sprites.h"
#include "functions.h"
#include "gui.h"
+#include "textbuf_gui.h"
+#include "window_gui.h"
#include "gfx.h"
#include "player.h"
#include "signs.h"
diff --git a/src/smallmap_gui.cpp b/src/smallmap_gui.cpp
index 3b6d46972..59c1992db 100644
--- a/src/smallmap_gui.cpp
+++ b/src/smallmap_gui.cpp
@@ -17,6 +17,7 @@
#include "map.h"
#include "tile.h"
#include "gui.h"
+#include "window_gui.h"
#include "tree_map.h"
#include "tunnel_map.h"
#include "gfx.h"
diff --git a/src/station_gui.cpp b/src/station_gui.cpp
index 36c9948d7..f7fa0cf23 100644
--- a/src/station_gui.cpp
+++ b/src/station_gui.cpp
@@ -9,6 +9,8 @@
#include "strings.h"
#include "table/strings.h"
#include "gui.h"
+#include "window_gui.h"
+#include "textbuf_gui.h"
#include "station.h"
#include "gfx.h"
#include "player.h"
diff --git a/src/station_gui.h b/src/station_gui.h
index 27252932d..2911266ca 100644
--- a/src/station_gui.h
+++ b/src/station_gui.h
@@ -52,4 +52,13 @@ enum StationViewWidgets {
void RebuildStationLists();
void ResortStationLists();
+enum StationCoverageType {
+ SCT_PASSENGERS_ONLY,
+ SCT_NON_PASSENGERS_ONLY,
+ SCT_ALL
+};
+
+void DrawStationCoverageAreaText(int sx, int sy, StationCoverageType sct, int rad);
+void CheckRedrawStationCoverage(const Window *w);
+
#endif /* STATION_GUI_H */
diff --git a/src/terraform_gui.cpp b/src/terraform_gui.cpp
index 42f289e28..5b0af2050 100644
--- a/src/terraform_gui.cpp
+++ b/src/terraform_gui.cpp
@@ -12,6 +12,7 @@
#include "player.h"
#include "tile.h"
#include "gui.h"
+#include "window_gui.h"
#include "viewport.h"
#include "gfx.h"
#include "sound.h"
diff --git a/src/textbuf_gui.h b/src/textbuf_gui.h
new file mode 100644
index 000000000..8dc1c6fc2
--- /dev/null
+++ b/src/textbuf_gui.h
@@ -0,0 +1,45 @@
+/* $Id$ */
+
+/** @file textbuf_gui.h Stuff related to the text buffer GUI. */
+
+#ifndef TEXTBUF_GUI_H
+#define TEXTBUF_GUI_H
+
+#include "window_type.h"
+
+struct Textbuf {
+ char *buf; ///< buffer in which text is saved
+ uint16 maxlength, maxwidth; ///< the maximum size of the buffer. Maxwidth specifies screensize in pixels, maxlength is in bytes
+ uint16 length, width; ///< the current size of the string. Width specifies screensize in pixels, length is in bytes
+ bool caret; ///< is the caret ("_") visible or not
+ uint16 caretpos; ///< the current position of the caret in the buffer, in bytes
+ uint16 caretxoffs; ///< the current position of the caret in pixels
+};
+
+struct querystr_d {
+ StringID caption;
+ Textbuf text;
+ const char *orig;
+ CharSetFilter afilter;
+ bool handled;
+};
+assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(querystr_d));
+
+
+void DrawEditBox(Window *w, querystr_d *string, int wid);
+void HandleEditBox(Window *w, querystr_d *string, int wid);
+int HandleEditBoxKey(Window *w, querystr_d *string, int wid, WindowEvent *we);
+bool HandleCaret(Textbuf *tb);
+
+void DeleteTextBufferAll(Textbuf *tb);
+bool DeleteTextBufferChar(Textbuf *tb, int delmode);
+bool InsertTextBufferChar(Textbuf *tb, uint32 key);
+bool InsertTextBufferClipboard(Textbuf *tb);
+bool MoveTextBufferPos(Textbuf *tb, int navmode);
+void InitializeTextBuffer(Textbuf *tb, const char *buf, uint16 maxlength, uint16 maxwidth);
+void UpdateTextBufferSize(Textbuf *tb);
+
+void ShowQueryString(StringID str, StringID caption, uint maxlen, uint maxwidth, Window *parent, CharSetFilter afilter);
+void ShowQuery(StringID caption, StringID message, Window *w, void (*callback)(Window*, bool));
+
+#endif /* TEXTBUF_GUI_H */
diff --git a/src/timetable_gui.cpp b/src/timetable_gui.cpp
index d18e88194..a71810b17 100644
--- a/src/timetable_gui.cpp
+++ b/src/timetable_gui.cpp
@@ -12,6 +12,8 @@
#include "date.h"
#include "engine.h"
#include "gui.h"
+#include "window_gui.h"
+#include "textbuf_gui.h"
#include "string.h"
#include "vehicle.h"
#include "cargotype.h"
diff --git a/src/town_gui.cpp b/src/town_gui.cpp
index cdf6da858..9ec3d07ab 100644
--- a/src/town_gui.cpp
+++ b/src/town_gui.cpp
@@ -13,6 +13,8 @@
#include "gfx.h"
#include "viewport.h"
#include "gui.h"
+#include "window_gui.h"
+#include "textbuf_gui.h"
#include "command.h"
#include "player.h"
#include "network/network.h"
diff --git a/src/train_gui.cpp b/src/train_gui.cpp
index 7692b1e24..7e6f511a2 100644
--- a/src/train_gui.cpp
+++ b/src/train_gui.cpp
@@ -10,6 +10,7 @@
#include "table/strings.h"
#include "strings.h"
#include "gui.h"
+#include "window_gui.h"
#include "vehicle.h"
#include "viewport.h"
#include "command.h"
diff --git a/src/transparency_gui.cpp b/src/transparency_gui.cpp
index 5b0fe21b1..ddbe4cde1 100644
--- a/src/transparency_gui.cpp
+++ b/src/transparency_gui.cpp
@@ -6,6 +6,7 @@
#include "table/strings.h"
#include "functions.h"
#include "gui.h"
+#include "window_gui.h"
#include "viewport.h"
#include "gfx.h"
#include "sound.h"
diff --git a/src/unix.cpp b/src/unix.cpp
index 521f51368..f35b50b93 100644
--- a/src/unix.cpp
+++ b/src/unix.cpp
@@ -8,7 +8,7 @@
#include "string.h"
#include "table/strings.h"
#include "variables.h"
-#include "gui.h"
+#include "textbuf_gui.h"
#include <dirent.h>
#include <unistd.h>
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp
index 629827d98..89d8592d2 100644
--- a/src/vehicle_gui.cpp
+++ b/src/vehicle_gui.cpp
@@ -14,6 +14,8 @@
#include "vehicle.h"
#include "engine.h"
#include "gui.h"
+#include "window_gui.h"
+#include "textbuf_gui.h"
#include "command.h"
#include "gfx.h"
#include "variables.h"
diff --git a/src/win32.cpp b/src/win32.cpp
index 98452773a..36cd42910 100644
--- a/src/win32.cpp
+++ b/src/win32.cpp
@@ -11,6 +11,7 @@
#include "saveload.h"
#include "string.h"
#include "gfx.h"
+#include "textbuf_gui.h"
#include "fileio.h"
#include <windows.h>
#include <winnt.h>
diff --git a/src/window_func.h b/src/window_func.h
index 8f3e5ff1d..8d2049b2c 100644
--- a/src/window_func.h
+++ b/src/window_func.h
@@ -22,10 +22,12 @@ void DeletePlayerWindows(PlayerID pi);
void ChangeWindowOwner(PlayerID old_player, PlayerID new_player);
void ResizeWindow(Window *w, int x, int y);
+int PositionMainToolbar(Window *w);
void InitWindowSystem();
void UnInitWindowSystem();
void ResetWindowSystem();
+void SetupColorsAndInitialWindow();
void InputLoop();
void InvalidateThisWindowData(Window *w);
void InvalidateWindowData(WindowClass cls, WindowNumber number);
diff --git a/src/window_gui.h b/src/window_gui.h
index b4f87661c..ef2b8a77c 100644
--- a/src/window_gui.h
+++ b/src/window_gui.h
@@ -19,8 +19,6 @@
*/
static const int MAX_NUMBER_OF_WINDOWS = 25;
-struct WindowEvent;
-
typedef void WindowProc(Window *w, WindowEvent *e);
/* How the resize system works:
@@ -228,20 +226,7 @@ enum WindowDefaultPosition {
WDP_ALIGN_TBL = -4, ///< Align the left side of the window with the left side of the main toolbar
};
-struct Textbuf {
- char *buf; ///< buffer in which text is saved
- uint16 maxlength, maxwidth; ///< the maximum size of the buffer. Maxwidth specifies screensize in pixels, maxlength is in bytes
- uint16 length, width; ///< the current size of the string. Width specifies screensize in pixels, length is in bytes
- bool caret; ///< is the caret ("_") visible or not
- uint16 caretpos; ///< the current position of the caret in the buffer, in bytes
- uint16 caretxoffs; ///< the current position of the caret in pixels
-};
-
#define WP(ptr, str) (*(str*)(ptr)->custom)
-/* You cannot 100% reliably calculate the biggest custom struct as
- * the number of pointers in it and alignment will have a huge impact.
- * 96 is the largest window-size for 64-bit machines currently */
-#define WINDOW_CUSTOM_SIZE 96
struct Scrollbar {
uint16 count, cap, pos;
@@ -307,20 +292,6 @@ struct Window {
void InvalidateWidget(byte widget_index) const;
};
-struct querystr_d {
- StringID caption;
- Textbuf text;
- const char *orig;
- CharSetFilter afilter;
- bool handled;
-};
-assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(querystr_d));
-
-struct chatquerystr_d : public querystr_d {
- int dest;
-};
-assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(chatquerystr_d));
-
struct menu_d {
byte item_count; ///< follow_vehicle
byte sel_index; ///< scrollpos_x
@@ -637,7 +608,6 @@ void InputLoop();
void InvalidateThisWindowData(Window *w);
void InvalidateWindowData(WindowClass cls, WindowNumber number);
void RelocateAllWindows(int neww, int newh);
-int PositionMainToolbar(Window *w);
/* misc_gui.cpp */
void GuiShowTooltipsWithArgs(StringID str, uint paramcount, const uint64 params[]);
diff --git a/src/window_type.h b/src/window_type.h
index bc8ee42b7..9ff8997d5 100644
--- a/src/window_type.h
+++ b/src/window_type.h
@@ -93,6 +93,14 @@ enum WindowClass {
};
struct Window;
+struct WindowEvent;
typedef int32 WindowNumber;
+/**
+ * You cannot 100% reliably calculate the biggest custom struct as
+ * the number of pointers in it and alignment will have a huge impact.
+ * 96 is the largest window-size for 64-bit machines currently.
+ */
+#define WINDOW_CUSTOM_SIZE 96
+
#endif /* WINDOW_TYPE_H */