X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fengineer%2Ftraindialog.cpp;h=985d4c94ea09eca8bb358e516c19b5641b58619e;hb=abed4a255060d5a233ec0ac2dd60af9132e29201;hp=6aa469a37bc7edc85403c694c2b321f9c2e51186;hpb=9e96d36a21c24befc88c7bf9c1014c22169e3a6a;p=r2c2.git diff --git a/source/engineer/traindialog.cpp b/source/engineer/traindialog.cpp index 6aa469a..985d4c9 100644 --- a/source/engineer/traindialog.cpp +++ b/source/engineer/traindialog.cpp @@ -9,6 +9,7 @@ #include "libr2c2/layout.h" #include "libr2c2/trainstatus.h" #include "controlpanel.h" +#include "engineer.h" #include "routerpanel.h" #include "timetablepanel.h" #include "traindialog.h" @@ -19,6 +20,7 @@ using namespace Msp; using namespace R2C2; TrainDialog::TrainDialog(Engineer &e, R2C2::Train &t): + DynamicDialog(e.get_user_interface()), engineer(e), train(t), updating(false) @@ -149,3 +151,25 @@ void TrainDialog::toggle_panel(bool show, GLtk::Panel *panel) { panel->set_visible(show); } + +bool TrainDialog::save_state(DataFile::Statement &st) const +{ + st.keyword = "traindialog"; + st.append(train.get_address()); + st.sub.push_back((DataFile::Statement("expanded"), pnl_expander->is_visible())); + save_position(st.sub); + + return true; +} + + +TrainDialog::StateLoader::StateLoader(TrainDialog &td): + DataFile::DerivedObjectLoader(td) +{ + add("expanded", &StateLoader::expanded); +} + +void TrainDialog::StateLoader::expanded(bool e) +{ + obj.set_expanded(e); +}