src/Viewer/FGEventHandler.cxx: NewGUI::setStyle(): added code to rescan style files.
Changing style will reload style from filesystem, so one can edit styles and see results without restarting fg. Note that this duplicates initial populating of /gui/styles/ from defaults.xml's <sim><gui>...</gui></sim> section, so it's a bit of a hack.
This commit is contained in:
parent
43468727ad
commit
4ec80297bf
1 changed files with 17 additions and 0 deletions
|
@ -440,6 +440,23 @@ NewGUI::setStyle (void)
|
|||
|
||||
//puSetDefaultStyle();
|
||||
|
||||
|
||||
if (1) {
|
||||
// Re-read gui/style/*.xml files so that one can edit them and see the
|
||||
// results without restarting flightgear.
|
||||
SGPath p(globals->get_fg_root(), "gui/styles");
|
||||
SGPropertyNode* sim_gui = globals->get_props()->getNode("sim/gui/", true);
|
||||
simgear::Dir dir(p);
|
||||
int i = 0;
|
||||
for (SGPath xml: dir.children(simgear::Dir::TYPE_FILE, ".xml")) {
|
||||
SGPropertyNode_ptr node = sim_gui->getChild("style", i, true);
|
||||
node->removeAllChildren();
|
||||
SG_LOG(SG_GENERAL, SG_WARN, "reading from " << xml << " into " << node->getPath());
|
||||
readProperties(xml, node);
|
||||
i += 1;
|
||||
}
|
||||
}
|
||||
|
||||
int which = fgGetInt("/sim/gui/current-style", 0);
|
||||
SGPropertyNode *sim = globals->get_props()->getNode("sim/gui", true);
|
||||
SGPropertyNode *n = sim->getChild("style", which);
|
||||
|
|
Loading…
Add table
Reference in a new issue