1
0
Fork 0

Show paused message when starting frozen.

This commit is contained in:
James Turner 2015-11-15 23:56:18 +00:00
parent e63a95feb9
commit 97a5e15aaf
4 changed files with 25 additions and 9 deletions

View 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);
}
}

View 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)();

View 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;
}

View 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"));