From aec1d580c2c85871076018c0f6b71e1dc410be58 Mon Sep 17 00:00:00 2001 From: mfranz Date: Sun, 29 Jan 2006 21:21:56 +0000 Subject: [PATCH] on closing a dialog write the last position back, so that the caller can open it there again next time --- src/GUI/dialog.cxx | 7 ++++++- src/GUI/dialog.hxx | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/GUI/dialog.cxx b/src/GUI/dialog.cxx index 450b1977f..4982ec33f 100644 --- a/src/GUI/dialog.cxx +++ b/src/GUI/dialog.cxx @@ -317,13 +317,18 @@ copy_from_pui (puObject * object, SGPropertyNode * node) 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; diff --git a/src/GUI/dialog.hxx b/src/GUI/dialog.hxx index ef0cd4e93..f9f51705f 100644 --- a/src/GUI/dialog.hxx +++ b/src/GUI/dialog.hxx @@ -146,6 +146,10 @@ private: // overridden by a top level font definition. puFont * _font; + // The source xml tree, so that we can pass data back, such as the + // last position. + SGPropertyNode *_props; + // PUI provides no way for userdata to be deleted automatically // with a GUI object, so we have to keep track of all the special // data we allocated and then free it manually when the dialog -- 2.39.5