X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fengineer%2Ftimetabledialog.cpp;h=2e50099b01413bf6f5915797af4520922e0f2617;hb=34f8bf04e4bdffefeceea59b186386b51c542b9d;hp=978b14bcb53a9e73d0e82fb913a1862ca05ab540;hpb=cf52013784607dc4d307bd1244c5346ee88336a4;p=r2c2.git diff --git a/source/engineer/timetabledialog.cpp b/source/engineer/timetabledialog.cpp index 978b14b..2e50099 100644 --- a/source/engineer/timetabledialog.cpp +++ b/source/engineer/timetabledialog.cpp @@ -1,6 +1,6 @@ /* $Id$ -This file is part of the MSP Märklin suite +This file is part of R²C² Copyright © 2010 Mikkosoft Productions, Mikko Rasa Distributed under the GPL */ @@ -12,32 +12,31 @@ Distributed under the GPL using namespace std; using namespace Msp; -using namespace Marklin; +using namespace R2C2; -TimetableDialog::TimetableDialog(const GLtk::Resources &r, Timetable &tt): - GLtk::Widget(r), - GLtk::Dialog(r), +TimetableDialog::TimetableDialog(Timetable &tt): timetable(tt) { - set_size(200, 200); + set_size(250, 200); GLtk::Button *btn; - add_button(*(btn = new GLtk::Button(res, "Cncl")), 0); + add_button(*(btn = new GLtk::Button("Cncl")), 0); btn->set_geometry(GLtk::Geometry(geom.w-80, 10, 30, 25)); btn->set_style("red"); - add_button(*(btn = new GLtk::Button(res, "OK")), 1); + add_button(*(btn = new GLtk::Button("OK")), 1); btn->set_geometry(GLtk::Geometry(geom.w-40, 10, 30, 25)); btn->set_style("green"); - add(*(tgl_enabled = new GLtk::Toggle(res, "On"))); + add(*(tgl_enabled = new GLtk::Toggle("On"))); tgl_enabled->set_geometry(GLtk::Geometry(10, 10, 40, 27)); tgl_enabled->set_value(timetable.is_enabled()); tgl_enabled->signal_toggled.connect(sigc::mem_fun(this, &TimetableDialog::enabled_toggled)); - add(*(ent_timetable = new GLtk::Entry(res))); + add(*(ent_timetable = new GLtk::Entry)); ent_timetable->set_geometry(GLtk::Geometry(10, 45, geom.w-20, geom.h-55)); + ent_timetable->set_style("multiline"); ent_timetable->set_multiline(true); string text; @@ -53,13 +52,13 @@ TimetableDialog::TimetableDialog(const GLtk::Resources &r, Timetable &tt): void TimetableDialog::enabled_toggled(bool value) { timetable.set_enabled(value); + timetable.reset(); } void TimetableDialog::on_response(int code) { if(code) { - timetable.clear(); vector lines = split(ent_timetable->get_text(), '\n'); vector rows; rows.reserve(lines.size()); @@ -67,6 +66,7 @@ void TimetableDialog::on_response(int code) { for(vector::const_iterator i=lines.begin(); i!=lines.end(); ++i) rows.push_back(Timetable::Row::parse(*i)); + timetable.clear(); for(vector::const_iterator i=rows.begin(); i!=rows.end(); ++i) timetable.append(*i); }