From: Mikko Rasa Date: Fri, 3 Apr 2015 16:37:46 +0000 (+0300) Subject: Minor adjustments to UI code X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=d6213fa0f35a06182a7d3e88959c67ff019713b6;p=r2c2.git Minor adjustments to UI code --- diff --git a/source/engineer/userinterface.cpp b/source/engineer/userinterface.cpp index 95f064a..aec54ad 100644 --- a/source/engineer/userinterface.cpp +++ b/source/engineer/userinterface.cpp @@ -40,7 +40,7 @@ UserInterface::UserInterface(Engineer &e, Graphics::Window &window, Input::Keybo UserInterface::~UserInterface() { while(!dyn_dialogs.empty()) - delete dyn_dialogs.front(); + delete *dyn_dialogs.begin(); delete root_arrangement; } @@ -52,19 +52,18 @@ void UserInterface::set_status(const string &text) void UserInterface::add_dynamic_dialog(DynamicDialog &dd) { - dyn_dialogs.push_back(&dd); + dyn_dialogs.insert(&dd); } void UserInterface::remove_dynamic_dialog(DynamicDialog &dd) { - dyn_dialogs.erase(remove(dyn_dialogs.begin(), dyn_dialogs.end(), &dd), dyn_dialogs.end()); + dyn_dialogs.erase(&dd); } void UserInterface::show_train(Train &train) { TrainDialog *dlg = new TrainDialog(engineer, train); root.add(*dlg); - dlg->autosize(); } void UserInterface::show_zone(Zone &zone) @@ -99,7 +98,7 @@ void UserInterface::tick() status_timeout = Time::TimeStamp(); } - for(list::iterator i=dyn_dialogs.begin(); i!=dyn_dialogs.end(); ++i) + for(set::iterator i=dyn_dialogs.begin(); i!=dyn_dialogs.end(); ++i) (*i)->update(); } diff --git a/source/engineer/userinterface.h b/source/engineer/userinterface.h index 9dd4d42..1df5388 100644 --- a/source/engineer/userinterface.h +++ b/source/engineer/userinterface.h @@ -19,7 +19,7 @@ private: Msp::GLtk::Arrangement *root_arrangement; MainWindow main_wnd; - std::list dyn_dialogs; + std::set dyn_dialogs; bool import_active; Msp::Time::TimeStamp status_timeout;