]> git.mxchange.org Git - flightgear.git/commitdiff
Show paused message when starting frozen.
authorJames Turner <zakalawe@mac.com>
Sun, 15 Nov 2015 23:56:18 +0000 (23:56 +0000)
committerJames Turner <zakalawe@mac.com>
Mon, 23 Nov 2015 00:48:20 +0000 (00:48 +0000)
src/GUI/gui.cxx
src/GUI/gui.h
src/Main/fg_commands.cxx
src/Viewer/renderer.cxx

index f37b3792d6412ec8b0d2b2dd414a951f436f04d3..2c5ae23459b09da63609cb9e9ed53acca6e2a9b1 100644 (file)
@@ -33,6 +33,8 @@
 #include <string>
 
 #include <simgear/structure/exception.hxx>
+#include <simgear/structure/commands.hxx>
+
 #include <simgear/misc/sg_path.hxx>
 #include <simgear/props/props.hxx>
 #include <simgear/props/props_io.hxx>
@@ -183,3 +185,17 @@ bool guiInit()
         return true;
     }
 }
+
+void syncPausePopupState()
+{
+    bool paused = fgGetBool("/sim/freeze/master",true) | fgGetBool("/sim/freeze/clock",true);
+    SGPropertyNode_ptr args(new SGPropertyNode);
+    args->setStringValue("id", "sim-pause");
+    if (paused && fgGetBool("/sim/view-name-popup")) {
+      args->setStringValue("label", "Simulation is paused");
+      globals->get_commands()->execute("show-message", args);
+    } else {
+      globals->get_commands()->execute("clear-message", args);
+    }
+
+}
index c191c15d91f44673d38e3b099ebfc238936b42f5..aed93b5b5e7fff72094c4a5521d4e55cfbff4455 100644 (file)
@@ -64,6 +64,10 @@ extern void fgHiResDump();
 
 extern void helpCb();
 
+/// synchronize /sim/freeze properties with visiblity
+/// of the popup-dialog which informs the user
+void syncPausePopupState();
+
 typedef struct {
         const char *name;
         void (*fn)();
index f0b8de09b3e73254983c784909f7b4e12172c11b..c4b4932ce36efb828d429c15f9b8d2271531e3e5 100644 (file)
@@ -270,15 +270,7 @@ do_pause (const SGPropertyNode * arg)
         fgSetBool("/sim/freeze/clock",!paused);
     }
   
-    SGPropertyNode_ptr args(new SGPropertyNode);
-    args->setStringValue("id", "sim-pause");
-    if (!paused && fgGetBool("/sim/view-name-popup")) {
-      args->setStringValue("label", "Simulation is paused");
-      globals->get_commands()->execute("show-message", args);
-    } else {
-      globals->get_commands()->execute("clear-message", args);
-    }
-  
+    syncPausePopupState();
     return true;
 }
 
index 2c4d5c7103b102f792ba00f36f32aa4a4ff8f11d..be51ad4d158f398409a2d3bd75cf88abc01c9efc 100644 (file)
@@ -97,6 +97,8 @@
 #include <Scenery/scenery.hxx>
 #include <Scenery/redout.hxx>
 #include <GUI/new_gui.hxx>
+#include <GUI/gui.h>
+
 #include <Instrumentation/HUD/HUD.hxx>
 #include <Environment/precipitation_mgr.hxx>
 #include <Environment/environment_mgr.hxx>
@@ -1588,6 +1590,8 @@ FGRenderer::update( ) {
         sAlpha -= SGMiscd::max(0.0,delay_time/fade_time);
         FGScenerySwitchCallback::scenery_enabled = (sAlpha<1.0);
         _splash_alpha->setDoubleValue((sAlpha < 0) ? 0.0 : sAlpha);
+
+        syncPausePopupState();
     }
 
     FGLight *l = static_cast<FGLight*>(globals->get_subsystem("lighting"));