Add support for fonts from the property tree for PUI dialog.
This permits, for example the following <font> <property>sim/gui/selected-style/fonts/nasal-editor</property> </font>
This commit is contained in:
parent
5af55a1409
commit
9d590feaf3
1 changed files with 16 additions and 3 deletions
|
@ -796,6 +796,9 @@ FGPUIDialog::display (SGPropertyNode *props)
|
||||||
|
|
||||||
SGPropertyNode *fontnode = props->getNode("font");
|
SGPropertyNode *fontnode = props->getNode("font");
|
||||||
if (fontnode) {
|
if (fontnode) {
|
||||||
|
SGPropertyNode *property_node = fontnode->getChild("property");
|
||||||
|
if (property_node)
|
||||||
|
fontnode = globals->get_props()->getNode(property_node->getStringValue());
|
||||||
_font = FGFontCache::instance()->get(fontnode);
|
_font = FGFontCache::instance()->get(fontnode);
|
||||||
} else {
|
} else {
|
||||||
_font = _gui->getDefaultFont();
|
_font = _gui->getDefaultFont();
|
||||||
|
@ -1061,6 +1064,7 @@ FGPUIDialog::makeObject (SGPropertyNode *props, int parentWidth, int parentHeigh
|
||||||
|
|
||||||
setupObject(obj, props);
|
setupObject(obj, props);
|
||||||
_activeWidgets.push_back(obj);
|
_activeWidgets.push_back(obj);
|
||||||
|
setColor(obj, props, FOREGROUND | LABEL);
|
||||||
return obj;
|
return obj;
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1091,6 +1095,15 @@ FGPUIDialog::setupObject (puObject *object, SGPropertyNode *props)
|
||||||
object->setBorderThickness( props->getIntValue("border", 2) );
|
object->setBorderThickness( props->getIntValue("border", 2) );
|
||||||
|
|
||||||
if (SGPropertyNode *nft = props->getNode("font", false)) {
|
if (SGPropertyNode *nft = props->getNode("font", false)) {
|
||||||
|
if (nft) {
|
||||||
|
SGPropertyNode *property_node = nft->getChild("property");
|
||||||
|
if (property_node)
|
||||||
|
nft = globals->get_props()->getNode(property_node->getStringValue());
|
||||||
|
_font = FGFontCache::instance()->get(nft);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
_font = _gui->getDefaultFont();
|
||||||
|
}
|
||||||
puFont *lfnt = FGFontCache::instance()->get(nft);
|
puFont *lfnt = FGFontCache::instance()->get(nft);
|
||||||
object->setLabelFont(*lfnt);
|
object->setLabelFont(*lfnt);
|
||||||
object->setLegendFont(*lfnt);
|
object->setLegendFont(*lfnt);
|
||||||
|
|
Loading…
Add table
Reference in a new issue