From: timoore Date: Sun, 9 Sep 2007 23:21:20 +0000 (+0000) Subject: Add an autohide property for the 2D panel. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=474df2414e90e08d1eeffe57ff543dc4141b0200;p=flightgear.git Add an autohide property for the 2D panel. Author:Csaba Halasz --- diff --git a/src/Cockpit/panel.cxx b/src/Cockpit/panel.cxx index 890b9a39d..86b82903e 100644 --- a/src/Cockpit/panel.cxx +++ b/src/Cockpit/panel.cxx @@ -98,18 +98,18 @@ get_aspect_adjust (int xsize, int ysize) bool fgPanelVisible () { - if (globals->get_current_panel() == 0) + const FGPanel* current = globals->get_current_panel(); + if (current == 0) return false; - if (globals->get_current_panel()->getVisibility() == 0) + if (current->getVisibility() == 0) return false; if (globals->get_viewmgr()->get_current() != 0) return false; - if (globals->get_current_view()->getHeadingOffset_deg() * SGD_DEGREES_TO_RADIANS != 0) + if (current->getAutohide() && globals->get_current_view()->getHeadingOffset_deg() * SGD_DEGREES_TO_RADIANS != 0) return false; return true; } - //////////////////////////////////////////////////////////////////////// // Implementation of FGTextureManager. diff --git a/src/Cockpit/panel.hxx b/src/Cockpit/panel.hxx index 2b04559f4..af113c977 100644 --- a/src/Cockpit/panel.hxx +++ b/src/Cockpit/panel.hxx @@ -191,6 +191,9 @@ public: virtual void setDepthTest (bool enable); + bool getAutohide(void) const { return _autohide; }; + void setAutohide(bool enable) { _autohide = enable; }; + private: void setupVirtualCockpit(); void cleanupVirtualCockpit(); @@ -218,6 +221,7 @@ private: // List of instruments in panel. instrument_list_type _instruments; bool _enable_depth_test; + bool _autohide; }; diff --git a/src/Cockpit/panel_io.cxx b/src/Cockpit/panel_io.cxx index ad33b109d..d017fb93c 100644 --- a/src/Cockpit/panel_io.cxx +++ b/src/Cockpit/panel_io.cxx @@ -680,6 +680,8 @@ readPanel (const SGPropertyNode * root) if (!fgHasNode("/sim/panel/y-offset")) fgSetInt("/sim/panel/y-offset", root->getIntValue("y-offset", 0)); + panel->setAutohide(root->getBoolValue("autohide", true)); + // // Assign the background texture, if any, or a bogus chequerboard. //