// dialog.cxx: implementation of an XML-configurable dialog box.
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
#include <stdlib.h> // atof()
#include <Input/input.hxx>
FGDialog::FGDialog (SGPropertyNode * props)
: _object(0),
- _gui((NewGUI *)globals->get_subsystem("gui"))
+ _gui((NewGUI *)globals->get_subsystem("gui")),
+ _props(props)
{
display(props);
}
FGDialog::~FGDialog ()
{
+ int x, y;
+ _object->getAbsolutePosition(&x, &y);
+ _props->setIntValue("lastx", x);
+ _props->setIntValue("lasty", y);
puDeleteObject(_object);
unsigned int i;
// Let the layout widget work in the same property subtree.
LayoutWidget wid(props);
- puFont *fnt = _gui->getDefaultFont();
- wid.setDefaultFont(fnt, int(fnt->getPointSize()));
+ SGPropertyNode *fontnode = props->getNode("font");
+ if (fontnode) {
+ FGFontCache *fc = _gui->get_fontcache();
+ _font = fc->get(fontnode);
+ } else {
+ _font = _gui->getDefaultFont();
+ }
+ wid.setDefaultFont(_font, int(_font->getPointSize()));
int pw=0, ph=0;
int px, py, savex, savey;
// Negative x/y coordinates are interpreted as distance from the top/right
// corner rather than bottom/left.
- if (px < 0)
+ if (userx && px < 0)
px = screenw - pw + px;
- if (py < 0)
+ if (usery && py < 0)
py = screenh - ph + py;
// Define "x", "y", "width" and/or "height" in the property tree if they
FGFontCache *fc = _gui->get_fontcache();
puFont *lfnt = fc->get(nft);
object->setLabelFont(*lfnt);
+ } else {
+ object->setLabelFont(*_font);
}
if (props->hasValue("property")) {