From 02a5261797998841e2c3d8580385e68a5d319929 Mon Sep 17 00:00:00 2001 From: James Turner Date: Sun, 6 Oct 2013 17:34:53 +0100 Subject: [PATCH] Reset: GUI can be shutdown. --- src/GUI/new_gui.cxx | 31 ++++++++++++++++++++----------- src/GUI/new_gui.hxx | 2 ++ 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/src/GUI/new_gui.cxx b/src/GUI/new_gui.cxx index 8ca5c12c5..ca1c2f50d 100644 --- a/src/GUI/new_gui.cxx +++ b/src/GUI/new_gui.cxx @@ -52,18 +52,10 @@ using std::string; NewGUI::NewGUI () : _active_dialog(0) { -#if defined(SG_MAC) - if (fgGetBool("/sim/menubar/native", true)) { - _menubar.reset(new FGCocoaMenuBar); - return; - } -#endif - _menubar.reset(new FGPUIMenuBar); } NewGUI::~NewGUI () { - _dialog_props.clear(); for (_itt_t it = _colors.begin(); it != _colors.end(); ++it) delete it->second; } @@ -71,6 +63,18 @@ NewGUI::~NewGUI () void NewGUI::init () { +#if defined(SG_MAC) + if (fgGetBool("/sim/menubar/native", true)) { + _menubar.reset(new FGCocoaMenuBar); + } +#endif + if (!_menubar.get()) { + _menubar.reset(new FGPUIMenuBar); + } + + fgTie("/sim/menubar/visibility", this, + &NewGUI::getMenuBarVisible, &NewGUI::setMenuBarVisible); + setStyle(); SGPath p(globals->get_fg_root(), "gui/dialogs"); readDir(p); @@ -82,6 +86,14 @@ NewGUI::init () _menubar->init(); } +void +NewGUI::shutdown() +{ + fgUntie("/sim/menubar/visibility"); + _menubar.reset(); + _dialog_props.clear(); +} + void NewGUI::reinit () { @@ -132,14 +144,11 @@ NewGUI::reset (bool reload) void NewGUI::bind () { - fgTie("/sim/menubar/visibility", this, - &NewGUI::getMenuBarVisible, &NewGUI::setMenuBarVisible); } void NewGUI::unbind () { - fgUntie("/sim/menubar/visibility"); } void diff --git a/src/GUI/new_gui.hxx b/src/GUI/new_gui.hxx index d0e095713..d3ee2979e 100644 --- a/src/GUI/new_gui.hxx +++ b/src/GUI/new_gui.hxx @@ -46,6 +46,8 @@ public: */ virtual void init (); + virtual void shutdown (); + /** * Reinitialize the GUI subsystem. Reloads all XML dialogs. */