]> git.tdb.fi Git - r2c2.git/blobdiff - source/engineer/timetabledialog.cpp
Use maps instead of lists in Layout3D
[r2c2.git] / source / engineer / timetabledialog.cpp
index 978b14bcb53a9e73d0e82fb913a1862ca05ab540..1c7c907d25959904f5dc326a345a058af50f12b9 100644 (file)
@@ -19,7 +19,7 @@ TimetableDialog::TimetableDialog(const GLtk::Resources &r, Timetable &tt):
        GLtk::Dialog(r),
        timetable(tt)
 {
-       set_size(200, 200);
+       set_size(250, 200);
 
        GLtk::Button *btn;
 
@@ -38,6 +38,7 @@ TimetableDialog::TimetableDialog(const GLtk::Resources &r, Timetable &tt):
 
        add(*(ent_timetable = new GLtk::Entry(res)));
        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 +54,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<string> lines = split(ent_timetable->get_text(), '\n');
                vector<Timetable::Row> rows;
                rows.reserve(lines.size());
@@ -67,6 +68,7 @@ void TimetableDialog::on_response(int code)
                {
                        for(vector<string>::const_iterator i=lines.begin(); i!=lines.end(); ++i)
                                rows.push_back(Timetable::Row::parse(*i));
+                       timetable.clear();
                        for(vector<Timetable::Row>::const_iterator i=rows.begin(); i!=rows.end(); ++i)
                                timetable.append(*i);
                }