1
0
Fork 0

newgui.[ch]xx: implement FGDialog *NewGUI::getDialog(cont string&)

fg_command.cxx: add possibility to "dialog-apply" or "dialog-update"
                an arbitrary active (= open) dialog or widget
This commit is contained in:
mfranz 2006-04-28 10:27:54 +00:00
parent ca46e8d5d5
commit eb19c2650d
3 changed files with 32 additions and 3 deletions

View file

@ -171,7 +171,17 @@ NewGUI::getDialogProperties (const string &name)
if(_dialog_props.find(name) != _dialog_props.end())
return _dialog_props[name];
SG_LOG(SG_GENERAL, SG_ALERT, "dialog '" << name << "' missing");
SG_LOG(SG_GENERAL, SG_DEBUG, "dialog '" << name << "' missing");
return 0;
}
FGDialog *
NewGUI::getDialog (const string &name)
{
if(_active_dialogs.find(name) != _active_dialogs.end())
return _active_dialogs[name];
SG_LOG(SG_GENERAL, SG_DEBUG, "dialog '" << name << "' missing");
return 0;
}

View file

@ -165,6 +165,15 @@ public:
*/
virtual FGDialog * getActiveDialog ();
/**
* Get the named dialog if active.
*
* @return The named dialog, or 0 if it isn't active.
*/
virtual FGDialog * getDialog (const string &name);
virtual FGColor *getColor (const char * name) const {
_citt_t it = _colors.find(name);
return (it != _colors.end()) ? it->second : NULL;

View file

@ -1097,7 +1097,12 @@ static bool
do_dialog_update (const SGPropertyNode * arg)
{
NewGUI * gui = (NewGUI *)globals->get_subsystem("gui");
FGDialog * dialog = gui->getActiveDialog();
FGDialog * dialog;
if (arg->hasValue("dialog-name"))
dialog = gui->getDialog(arg->getStringValue("dialog-name"));
else
dialog = gui->getActiveDialog();
if (dialog != 0) {
if (arg->hasValue("object-name")) {
dialog->updateValue(arg->getStringValue("object-name"));
@ -1120,7 +1125,12 @@ static bool
do_dialog_apply (const SGPropertyNode * arg)
{
NewGUI * gui = (NewGUI *)globals->get_subsystem("gui");
FGDialog * dialog = gui->getActiveDialog();
FGDialog * dialog;
if (arg->hasValue("dialog-name"))
dialog = gui->getDialog(arg->getStringValue("dialog-name"));
else
dialog = gui->getActiveDialog();
if (dialog != 0) {
if (arg->hasValue("object-name")) {
const char * name = arg->getStringValue("object-name");