- make tabula rasa on re-init
- check /sim/current-gui for where to get gui colors (default "/sim/gui[0]") - call getFont() with gui font address (default "/sim/gui[0]/font")
This commit is contained in:
parent
4ac0776e97
commit
591001a24e
2 changed files with 21 additions and 17 deletions
|
@ -32,15 +32,6 @@ NewGUI::NewGUI ()
|
||||||
_menubar(new FGMenuBar),
|
_menubar(new FGMenuBar),
|
||||||
_active_dialog(0)
|
_active_dialog(0)
|
||||||
{
|
{
|
||||||
// set up the traditional colors as default
|
|
||||||
_colors["background"] = FGColor(0.8f, 0.8f, 0.9f, 0.85f);
|
|
||||||
_colors["foreground"] = FGColor(0.0f, 0.0f, 0.0f, 1.0f);
|
|
||||||
_colors["highlight"] = FGColor(0.7f, 0.7f, 0.7f, 1.0f);
|
|
||||||
_colors["label"] = FGColor(0.0f, 0.0f, 0.0f, 1.0f);
|
|
||||||
_colors["legend"] = FGColor(0.0f, 0.0f, 0.0f, 1.0f);
|
|
||||||
_colors["misc"] = FGColor(0.0f, 0.0f, 0.0f, 1.0f);
|
|
||||||
|
|
||||||
setStyle();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NewGUI::~NewGUI ()
|
NewGUI::~NewGUI ()
|
||||||
|
@ -51,6 +42,7 @@ NewGUI::~NewGUI ()
|
||||||
void
|
void
|
||||||
NewGUI::init ()
|
NewGUI::init ()
|
||||||
{
|
{
|
||||||
|
setStyle();
|
||||||
char path1[1024];
|
char path1[1024];
|
||||||
char path2[1024];
|
char path2[1024];
|
||||||
ulMakePath(path1, globals->get_fg_root().c_str(), "gui");
|
ulMakePath(path1, globals->get_fg_root().c_str(), "gui");
|
||||||
|
@ -274,13 +266,26 @@ NewGUI::readDir (const char * path)
|
||||||
void
|
void
|
||||||
NewGUI::setStyle (void)
|
NewGUI::setStyle (void)
|
||||||
{
|
{
|
||||||
setupFont();
|
_colors.clear();
|
||||||
|
|
||||||
|
// set up the traditional colors as default
|
||||||
|
_colors["background"] = FGColor(0.8f, 0.8f, 0.9f, 0.85f);
|
||||||
|
_colors["foreground"] = FGColor(0.0f, 0.0f, 0.0f, 1.0f);
|
||||||
|
_colors["highlight"] = FGColor(0.7f, 0.7f, 0.7f, 1.0f);
|
||||||
|
_colors["label"] = FGColor(0.0f, 0.0f, 0.0f, 1.0f);
|
||||||
|
_colors["legend"] = FGColor(0.0f, 0.0f, 0.0f, 1.0f);
|
||||||
|
_colors["misc"] = FGColor(0.0f, 0.0f, 0.0f, 1.0f);
|
||||||
|
|
||||||
//puSetDefaultStyle();
|
//puSetDefaultStyle();
|
||||||
|
|
||||||
SGPropertyNode *n = fgGetNode("/sim/gui/colors");
|
string path = fgGetString("/sim/current-gui", "/sim/gui");
|
||||||
if (!n)
|
string p;
|
||||||
return;
|
|
||||||
|
p = path + "/font";
|
||||||
|
setupFont(fgGetNode(p.c_str(), true));
|
||||||
|
|
||||||
|
p = path + "/colors";
|
||||||
|
SGPropertyNode *n = fgGetNode(p.c_str(), true);
|
||||||
|
|
||||||
for (int i = 0; i < n->nChildren(); i++) {
|
for (int i = 0; i < n->nChildren(); i++) {
|
||||||
SGPropertyNode *child = n->getChild(i);
|
SGPropertyNode *child = n->getChild(i);
|
||||||
|
@ -312,9 +317,8 @@ static const struct {
|
||||||
};
|
};
|
||||||
|
|
||||||
void
|
void
|
||||||
NewGUI::setupFont ()
|
NewGUI::setupFont (SGPropertyNode *node)
|
||||||
{
|
{
|
||||||
SGPropertyNode *node = fgGetNode("/sim/gui/font", true);
|
|
||||||
string fontname = node->getStringValue("name", "Helvetica.txf");
|
string fontname = node->getStringValue("name", "Helvetica.txf");
|
||||||
float size = node->getFloatValue("size", 15.0);
|
float size = node->getFloatValue("size", 15.0);
|
||||||
float slant = node->getFloatValue("slant", 0.0);
|
float slant = node->getFloatValue("slant", 0.0);
|
||||||
|
@ -346,7 +350,7 @@ NewGUI::setupFont ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
puSetDefaultFonts(_font, _font);
|
puSetDefaultFonts(_font, _font);
|
||||||
fgSetString("/sim/gui/font", fontname.c_str());
|
node->setStringValue("name", fontname.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -173,7 +173,7 @@ protected:
|
||||||
virtual void setMenuBarVisible (bool visible);
|
virtual void setMenuBarVisible (bool visible);
|
||||||
|
|
||||||
virtual void setStyle ();
|
virtual void setStyle ();
|
||||||
virtual void setupFont ();
|
virtual void setupFont (SGPropertyNode *);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
fntTexFont _tex_font;
|
fntTexFont _tex_font;
|
||||||
|
|
Loading…
Reference in a new issue