map<string,FGDialog *>::iterator iter;
vector<string> dlg;
// close all open dialogs and remember them ...
- for (iter = _active_dialogs.begin(); iter != _active_dialogs.end(); iter++) {
+ for (iter = _active_dialogs.begin(); iter != _active_dialogs.end(); ++iter)
dlg.push_back(iter->first);
- closeDialog(iter->first);
- }
+
+ unsigned int i;
+ for (i = 0; i < dlg.size(); i++)
+ closeDialog(dlg[i]);
unbind();
clear();
setStyle();
+ delete _menubar;
_menubar = new FGMenuBar;
init();
bind();
// open remembered dialogs again (no nasal generated ones, unfortunately)
-// for (unsigned int i = 0; i < dlg.size(); i++)
-// showDialog(dlg[i]);
+ for (i = 0; i < dlg.size(); i++)
+ showDialog(dlg[i]);
}
void
return false; // dialog wasn't open...
}
+SGPropertyNode_ptr
+NewGUI::getDialog (const string &name)
+{
+ if(_dialog_props.find(name) != _dialog_props.end())
+ return _dialog_props[name];
+
+ SG_LOG(SG_GENERAL, SG_ALERT, "dialog '" << name << "' missing");
+ return 0;
+}
+
void
NewGUI::setActiveDialog (FGDialog * dialog)
{
delete _menubar;
_menubar = 0;
_dialog_props.clear();
+ _itt_t it;
+ for (it = _colors.begin(); it != _colors.end(); ++it)
+ delete it->second;
_colors.clear();
}
return;
}
string name = cname;
- if(!_active_dialogs[name])
+ if(_active_dialogs.find(name) == _active_dialogs.end())
_dialog_props[name] = props;
}
void
NewGUI::setStyle (void)
{
+ _itt_t it;
+ for (it = _colors.begin(); it != _colors.end(); ++it)
+ delete it->second;
_colors.clear();
// set up the traditional colors as default
}
bool
-FGColor::merge(const FGColor& color)
+FGColor::merge(const FGColor *color)
{
bool dirty = false;
- if (color._red >= 0.0)
- _red = color._red, dirty = true;
- if (color._green >= 0.0)
- _green = color._green, dirty = true;
- if (color._blue >= 0.0)
- _blue = color._blue, dirty = true;
- if (color._alpha >= 0.0)
- _alpha = color._alpha, dirty = true;
+ if (color && color->_red >= 0.0)
+ _red = color->_red, dirty = true;
+ if (color && color->_green >= 0.0)
+ _green = color->_green, dirty = true;
+ if (color && color->_blue >= 0.0)
+ _blue = color->_blue, dirty = true;
+ if (color && color->_alpha >= 0.0)
+ _alpha = color->_alpha, dirty = true;
return dirty;
}