From: James Turner Date: Sun, 15 Nov 2015 23:56:18 +0000 (+0000) Subject: Show paused message when starting frozen. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=97a5e15aafdfc6b1a2e71bdaa22cffe19d207fb8;p=flightgear.git Show paused message when starting frozen. --- diff --git a/src/GUI/gui.cxx b/src/GUI/gui.cxx index f37b3792d..2c5ae2345 100644 --- a/src/GUI/gui.cxx +++ b/src/GUI/gui.cxx @@ -33,6 +33,8 @@ #include #include +#include + #include #include #include @@ -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); + } + +} diff --git a/src/GUI/gui.h b/src/GUI/gui.h index c191c15d9..aed93b5b5 100644 --- a/src/GUI/gui.h +++ b/src/GUI/gui.h @@ -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)(); diff --git a/src/Main/fg_commands.cxx b/src/Main/fg_commands.cxx index f0b8de09b..c4b4932ce 100644 --- a/src/Main/fg_commands.cxx +++ b/src/Main/fg_commands.cxx @@ -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; } diff --git a/src/Viewer/renderer.cxx b/src/Viewer/renderer.cxx index 2c4d5c710..be51ad4d1 100644 --- a/src/Viewer/renderer.cxx +++ b/src/Viewer/renderer.cxx @@ -97,6 +97,8 @@ #include #include #include +#include + #include #include #include @@ -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(globals->get_subsystem("lighting"));