summaryrefslogtreecommitdiff
path: root/main_gui.c
diff options
context:
space:
mode:
authordarkvater <darkvater@openttd.org>2004-12-22 01:32:30 +0000
committerdarkvater <darkvater@openttd.org>2004-12-22 01:32:30 +0000
commit46af99b8c0b21cd7bc8f404ba518a268241dfb8b (patch)
tree3c5684f75c1a347d6c3d5074699b344f4fb36c46 /main_gui.c
parentf55303b0a83972df4b16ba9844f4d853a337ced2 (diff)
downloadopenttd-46af99b8c0b21cd7bc8f404ba518a268241dfb8b.tar.xz
(svn r1214) -Feature: Stickified Industries (list & window), Smallmaps (all three), Stations (list & window) and Towns (list & window). I hope I didn't forget to update a widget somewhere :O
-Feature: With the sticky windows on and some unfortunate resizing of your game it the 'close' button might go outside of the playing field, making it impossible to close. Added an option to the Options menu that closes all windows, even if they are stickified ("Close ALL windows")
Diffstat (limited to 'main_gui.c')
-rw-r--r--main_gui.c50
1 files changed, 35 insertions, 15 deletions
diff --git a/main_gui.c b/main_gui.c
index c8fec2574..93577dbc5 100644
--- a/main_gui.c
+++ b/main_gui.c
@@ -152,6 +152,25 @@ static void ToolbarFastForwardClick(Window *w)
SndPlayFx(SND_15_BEEP);
}
+/* It is possible that a stickied window gets to a position where the
+ * 'close' button is outside the gaming area. You cannot close it then; except
+ * with this function. It closes all windows calling the standard function,
+ * then, does a little hacked loop of closing all stickied windows. Note
+ * that standard windows (status bar, etc.) are not stickied, so these aren't affected */
+static void CloseEveryWindow(void)
+{
+ Window *w;
+ // Delete every window except for stickied ones
+ DeleteNonVitalWindows();
+ // Delete all sticked windows
+ for (w = _windows; w != _last_window;) {
+ if (w->flags4 & WF_STICKY) {
+ DeleteWindow(w);
+ w = _windows;
+ } else
+ w++;
+ }
+}
typedef void MenuClickedProc(int index);
@@ -164,13 +183,14 @@ static void MenuClickSettings(int index)
case 2: ShowPatchesSelection(); return;
case 3: ShowNewgrf(); return;
- case 5: _display_opt ^= DO_SHOW_TOWN_NAMES; MarkWholeScreenDirty(); return;
- case 6: _display_opt ^= DO_SHOW_STATION_NAMES; MarkWholeScreenDirty(); return;
- case 7: _display_opt ^= DO_SHOW_SIGNS; MarkWholeScreenDirty(); return;
- case 8: _display_opt ^= DO_WAYPOINTS; MarkWholeScreenDirty(); return;
- case 9: _display_opt ^= DO_FULL_ANIMATION; MarkWholeScreenDirty(); return;
- case 10: _display_opt ^= DO_FULL_DETAIL; MarkWholeScreenDirty(); return;
- case 11: _display_opt ^= DO_TRANS_BUILDINGS; MarkWholeScreenDirty(); return;
+ case 5: CloseEveryWindow(); return;
+ case 6: _display_opt ^= DO_SHOW_TOWN_NAMES; MarkWholeScreenDirty(); return;
+ case 7: _display_opt ^= DO_SHOW_STATION_NAMES; MarkWholeScreenDirty(); return;
+ case 8: _display_opt ^= DO_SHOW_SIGNS; MarkWholeScreenDirty(); return;
+ case 9: _display_opt ^= DO_WAYPOINTS; MarkWholeScreenDirty(); return;
+ case 10: _display_opt ^= DO_FULL_ANIMATION; MarkWholeScreenDirty(); return;
+ case 11: _display_opt ^= DO_FULL_DETAIL; MarkWholeScreenDirty(); return;
+ case 12: _display_opt ^= DO_TRANS_BUILDINGS; MarkWholeScreenDirty(); return;
}
}
@@ -985,16 +1005,16 @@ static void ToolbarOptionsClick(Window *w)
{
uint16 x;
- w = PopupMainToolbMenu(w, 43, 2, STR_02C3_GAME_OPTIONS, 12);
+ w = PopupMainToolbMenu(w, 43, 2, STR_02C3_GAME_OPTIONS, 13);
x = (uint16)-1;
- if (_display_opt & DO_SHOW_TOWN_NAMES) x &= ~(1<<5);
- if (_display_opt & DO_SHOW_STATION_NAMES) x &= ~(1<<6);
- if (_display_opt & DO_SHOW_SIGNS) x &= ~(1<<7);
- if (_display_opt & DO_WAYPOINTS) x &= ~(1<<8);
- if (_display_opt & DO_FULL_ANIMATION) x &= ~(1<<9);
- if (_display_opt & DO_FULL_DETAIL) x &= ~(1<<10);
- if (_display_opt & DO_TRANS_BUILDINGS) x &= ~(1<<11);
+ if (_display_opt & DO_SHOW_TOWN_NAMES) x &= ~(1<<6);
+ if (_display_opt & DO_SHOW_STATION_NAMES) x &= ~(1<<7);
+ if (_display_opt & DO_SHOW_SIGNS) x &= ~(1<<8);
+ if (_display_opt & DO_WAYPOINTS) x &= ~(1<<9);
+ if (_display_opt & DO_FULL_ANIMATION) x &= ~(1<<10);
+ if (_display_opt & DO_FULL_DETAIL) x &= ~(1<<11);
+ if (_display_opt & DO_TRANS_BUILDINGS) x &= ~(1<<12);
WP(w,menu_d).checked_items = x;
}