]> git.tdb.fi Git - r2c2.git/commitdiff
Match the API change in GLtk
authorMikko Rasa <tdb@tdb.fi>
Fri, 12 Nov 2010 21:53:42 +0000 (21:53 +0000)
committerMikko Rasa <tdb@tdb.fi>
Fri, 12 Nov 2010 21:53:42 +0000 (21:53 +0000)
Adjust vslider style so that the slider is at top wit zero range

18 files changed:
marklin.res
source/designer/designer.cpp
source/designer/input.cpp
source/designer/toolbar.cpp
source/engineer/dialog.cpp
source/engineer/dialog.h
source/engineer/engineer.cpp
source/engineer/mainpanel.cpp
source/engineer/mainpanel.h
source/engineer/routeselect.cpp
source/engineer/routeselect.h
source/engineer/timetabledialog.cpp
source/engineer/timetabledialog.h
source/engineer/trainpanel.cpp
source/engineer/trainpanel.h
source/engineer/trainproperties.cpp
source/engineer/trainproperties.h
source/engineer/trainview.cpp

index 539709259ba7feec6f9a003e3fde90c347f81074..b40871e313810183963b00988b49367cfd878e95 100644 (file)
@@ -542,5 +542,6 @@ style "vslider"
        {
                graphic NORMAL "vertical_knob";
                fill 0.0 0.0;
+               align 0.0 1.0;
        };
 };
index d3932338a9edbbc23681f2afd164b7b0e45530ca..23185cf3252e6d15418a563395795b2de3caf41d 100644 (file)
@@ -129,12 +129,12 @@ Designer::Designer(int argc, char **argv):
        toolbar->set_position(0, window.get_height()-toolbar->get_geometry().h);
        toolbar->set_focusable(false);
 
-       GLtk::Panel *statusbar = new GLtk::Panel(ui_res);
+       GLtk::Panel *statusbar = new GLtk::Panel;
        root.add(*statusbar);
        statusbar->set_size(window.get_width(), 20);
        statusbar->set_focusable(false);
 
-       lbl_status = new GLtk::Label(ui_res);
+       lbl_status = new GLtk::Label;
        statusbar->add(*lbl_status);
        lbl_status->set_geometry(GLtk::Geometry(20, 2, 300, 16));
 
index e2b0ae0e06a175f8215b8299248fd07709ddfd49..26bf9f2bfc521165e24d4ae2c5cb7afd22092e29 100644 (file)
@@ -16,26 +16,24 @@ using namespace std;
 using namespace Msp;
 
 InputDialog::InputDialog(Designer &d, const string &title, const string &text):
-       GLtk::Widget(d.get_ui_resources()),
-       GLtk::Dialog(d.get_ui_resources()),
        designer(d)
 {
        set_size(300, 100);
 
        GLtk::Label *lbl;
-       add(*(lbl=new GLtk::Label(res, title)));
+       add(*(lbl=new GLtk::Label(title)));
        lbl->set_geometry(GLtk::Geometry(10, geom.h-30, geom.w-20, 20));
 
-       add(*(entry=new GLtk::Entry(res, text)));
+       add(*(entry=new GLtk::Entry(text)));
        entry->set_geometry(GLtk::Geometry(10, geom.h-60, geom.w-20, 20));
 
        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-90, 10, 40, 24));
        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-50, 10, 40, 24));
        btn->set_style("green");
 
index 629205c6ce89cba05f2f2b77eaaf1583e6cd99f8..56a5d6de7e3ac09a30396cc5d1c83913d47cc1cc 100644 (file)
@@ -16,8 +16,6 @@ using namespace Msp;
 using namespace Marklin;
 
 Toolbar::Toolbar(Designer &d):
-       GLtk::Widget(d.get_ui_resources()),
-       GLtk::Panel(d.get_ui_resources()),
        designer(d)
 {
        set_size(640, 40);
@@ -25,56 +23,56 @@ Toolbar::Toolbar(Designer &d):
        GLtk::Button *btn;
        GLtk::Label *lbl;
 
-       add(*(btn=new GLtk::Button(res, "Load")));
+       add(*(btn=new GLtk::Button("Load")));
        btn->set_geometry(GLtk::Geometry(5, 10, 40, 24));
        btn->set_tooltip("Load layout (not implemented)");
 
-       add(*(btn=new GLtk::Button(res, "Save")));
+       add(*(btn=new GLtk::Button("Save")));
        btn->set_geometry(GLtk::Geometry(45, 10, 40, 24));
        btn->set_tooltip("Save current layout");
        btn->signal_clicked.connect(sigc::mem_fun(&designer, &Designer::save));
 
-       add(*(btn=new GLtk::Button(res, "Quit")));
+       add(*(btn=new GLtk::Button("Quit")));
        btn->set_geometry(GLtk::Geometry(85, 10, 40, 24));
        btn->set_style("red");
        btn->set_tooltip("Exit Designer");
        btn->signal_clicked.connect(sigc::mem_fun(&designer, &Designer::quit));
 
-       add(*(btn=new GLtk::Button(res, "+Trk")));
+       add(*(btn=new GLtk::Button("+Trk")));
        btn->set_geometry(GLtk::Geometry(135, 10, 40, 24));
        btn->set_tooltip("Add a track piece");
        btn->signal_clicked.connect(sigc::mem_fun(&designer, &Designer::new_track));
 
-       add(*(btn=new GLtk::Button(res, "Trnt")));
+       add(*(btn=new GLtk::Button("Trnt")));
        btn->set_geometry(GLtk::Geometry(175, 10, 40, 24));
        btn->set_tooltip("Set turnout ID of selected track");
        btn->signal_clicked.connect(sigc::mem_fun(&designer, &Designer::set_turnout_id));
 
-       add(*(btn=new GLtk::Button(res, "Sens")));
+       add(*(btn=new GLtk::Button("Sens")));
        btn->set_geometry(GLtk::Geometry(215, 10, 40, 24));
        btn->set_tooltip("Set sensor ID of selected tracks");
        btn->signal_clicked.connect(sigc::mem_fun(&designer, &Designer::set_sensor_id));
 
-       add(*(lbl=new GLtk::Label(res, "Routes:")));
+       add(*(lbl=new GLtk::Label("Routes:")));
        lbl->set_geometry(GLtk::Geometry(265, 22, 40, 13));
 
-       add(*(drp_routes=new GLtk::Dropdown(res)));
+       add(*(drp_routes=new GLtk::Dropdown));
        drp_routes->set_geometry(GLtk::Geometry(265, 5, 250, 17));
        drp_routes->set_tooltip("Select route to edit");
        drp_routes->append("(new route)");
        drp_routes->signal_item_selected.connect(sigc::mem_fun(this, &Toolbar::route_selected));
 
-       add(*(btn=new GLtk::Button(res, "Del")));
+       add(*(btn=new GLtk::Button("Del")));
        btn->set_geometry(GLtk::Geometry(515, 10, 40, 24));
        btn->set_tooltip("Delete the current route");
        btn->signal_clicked.connect(sigc::mem_fun(this, &Toolbar::delete_route_clicked));
 
-       add(*(btn=new GLtk::Button(res, "Name")));
+       add(*(btn=new GLtk::Button("Name")));
        btn->set_geometry(GLtk::Geometry(555, 10, 40, 24));
        btn->set_tooltip("Rename the current route");
        btn->signal_clicked.connect(sigc::mem_fun(&designer, &Designer::rename_route));
 
-       add(*(btn=new GLtk::Button(res, "Add")));
+       add(*(btn=new GLtk::Button("Add")));
        btn->set_geometry(GLtk::Geometry(595, 10, 40, 24));
        btn->set_tooltip("Add selected tracks to current route");
        btn->signal_clicked.connect(sigc::mem_fun(&designer, &Designer::add_selection_to_route));
index c6389c9f017691919532a54b8bdcc62a80418f79..e71c1ce484540487eb22caf68e434fb51a78d56b 100644 (file)
@@ -9,19 +9,17 @@ Distributed under the GPL
 
 using namespace Msp;
 
-Dialog::Dialog(const GLtk::Resources &r):
-       GLtk::Widget(r),
-       GLtk::Panel(r),
+Dialog::Dialog():
        stale(false)
 {
-       add(*(btn_ok=new GLtk::Button(res, "OK")));
+       add(*(btn_ok=new GLtk::Button("OK")));
        btn_ok->set_style("green");
        btn_ok->set_geometry(GLtk::Geometry(geom.w-40, 10, 30, 25));
        btn_ok->signal_clicked.connect(sigc::mem_fun(this, &Dialog::on_ok_clicked));
        btn_ok->signal_clicked.connect(signal_ok);
        btn_ok->signal_clicked.connect(sigc::mem_fun(this, &Dialog::dismiss));
 
-       add(*(btn_cancel=new GLtk::Button(res, "Cncl")));
+       add(*(btn_cancel=new GLtk::Button("Cncl")));
        btn_cancel->set_style("red");
        btn_cancel->set_geometry(GLtk::Geometry(geom.w-80, 10, 30, 25));
        btn_cancel->signal_clicked.connect(signal_cancel);
index f923bb8992ed093aa5c4344760f6f2ffe2436734..5fb694f11ea7a242f75279345d1d6bd3d49e51f6 100644 (file)
@@ -22,7 +22,7 @@ protected:
        Msp::GLtk::Button *btn_cancel;
        bool stale;
 
-       Dialog(const Msp::GLtk::Resources &);
+       Dialog();
 
        virtual void button_release(int, int, unsigned);
        virtual void on_geometry_change();
index e7b047d311b42db72493adfc2d0e290ae95c7343..7e13f7b50471ad61261f43a8cfa7608ede759a9d 100644 (file)
@@ -67,7 +67,7 @@ Engineer::Engineer(int argc, char **argv):
        root->signal_pointer_motion.connect(sigc::mem_fun(this, &Engineer::pointer_motion));
        root->set_visible(true);
 
-       main_panel = new MainPanel(*this, ui_res);
+       main_panel = new MainPanel(*this);
        root->add(*main_panel);
        main_panel->set_position(0, window.get_height()-main_panel->get_geometry().h);
        main_panel->set_visible(true);
@@ -428,7 +428,7 @@ Track3D *Engineer::pick_track(int x, int y)
 
 void Engineer::train_added(Train &train)
 {
-       TrainPanel *tpanel = new TrainPanel(*this, ui_res, train);
+       TrainPanel *tpanel = new TrainPanel(*this, train);
        root->add(*tpanel);
        train_panels.push_back(tpanel);
        rearrange_panels();
index 2083e7c30940abaf225f58aafb38cf083791161a..8a292b44ff851dbb4a02c84eacc04ad2a7a6cd00 100644 (file)
@@ -14,50 +14,48 @@ Distributed under the GPL
 using namespace std;
 using namespace Msp;
 
-MainPanel::MainPanel(Engineer &e, GLtk::Resources &r):
-       Widget(r),
-       Panel(r),
+MainPanel::MainPanel(Engineer &e):
        engineer(e)
 {
        set_size(200, 117);
 
        GLtk::Button *btn;
 
-       add(*(btn=new GLtk::Button(res, "Off")));
+       add(*(btn=new GLtk::Button("Off")));
        btn->set_geometry(GLtk::Geometry(10, 70, 40, 25));
        btn->set_style("red");
        btn->signal_clicked.connect(sigc::mem_fun(this, &MainPanel::power_off));
 
-       add(*(ind_off=new GLtk::Indicator(res)));
+       add(*(ind_off=new GLtk::Indicator));
        ind_off->set_geometry(GLtk::Geometry(10, 95, 40, 12));
        ind_off->set_style("red");
 
-       add(*(btn=new GLtk::Button(res, "On")));
+       add(*(btn=new GLtk::Button("On")));
        btn->set_geometry(GLtk::Geometry(50, 70, 40, 25));
        btn->set_style("green");
        btn->signal_clicked.connect(sigc::mem_fun(this, &MainPanel::power_on));
 
-       add(*(ind_on=new GLtk::Indicator(res)));
+       add(*(ind_on=new GLtk::Indicator));
        ind_on->set_geometry(GLtk::Geometry(50, 95, 40, 12));
        ind_on->set_style("green");
 
-       add(*(btn=new GLtk::Button(res, "Halt")));
+       add(*(btn=new GLtk::Button("Halt")));
        btn->set_geometry(GLtk::Geometry(90, 70, 40, 25));
        btn->signal_clicked.connect(sigc::mem_fun(this, &MainPanel::toggle_halt));
 
-       add(*(ind_halt=new GLtk::Indicator(res)));
+       add(*(ind_halt=new GLtk::Indicator));
        ind_halt->set_geometry(GLtk::Geometry(90, 95, 40, 12));
 
-       add(*(btn=new GLtk::Button(res, "Quit")));
+       add(*(btn=new GLtk::Button("Quit")));
        btn->set_geometry(GLtk::Geometry(150, 70, 40, 25));
        btn->set_style("red");
        btn->signal_clicked.connect(sigc::mem_fun(this, &MainPanel::quit));
 
-       add(*(btn=new GLtk::Button(res, "+Loc")));
+       add(*(btn=new GLtk::Button("+Loc")));
        btn->set_geometry(GLtk::Geometry(10, 40, 40, 25));
        btn->signal_clicked.connect(sigc::mem_fun(this, &MainPanel::new_loc));
 
-       add(*(lbl_status=new GLtk::Label(res)));
+       add(*(lbl_status=new GLtk::Label));
        lbl_status->set_geometry(GLtk::Geometry(10, 10, 180, 20));
        lbl_status->set_style("digital");
 
@@ -94,7 +92,7 @@ void MainPanel::toggle_halt()
 
 void MainPanel::new_loc()
 {
-       TrainProperties *dialog = new TrainProperties(engineer, res, 0);
+       TrainProperties *dialog = new TrainProperties(engineer, 0);
        engineer.get_root().add(*dialog);
        dialog->set_position(geom.x+geom.w, geom.y+geom.h-dialog->get_geometry().h);
        dialog->set_visible(true);
index a24ef4976c59af9a0e6b9b7e7b71277ace13daa4..17e95dbfac7e87682a5f093b5abc0f423435375e 100644 (file)
@@ -25,7 +25,7 @@ private:
        Msp::GLtk::Indicator *ind_halt;
 
 public:
-       MainPanel(Engineer &, Msp::GLtk::Resources &);
+       MainPanel(Engineer &);
 
        void set_status_text(const std::string &);
 private:
index cd1e7042e846b730ca180b71a96efe4ff21e5f29..0e191499a0541d89478de35c94b44e7522329163 100644 (file)
@@ -14,19 +14,17 @@ using namespace std;
 using namespace Msp;
 using namespace Marklin;
 
-RouteSelect::RouteSelect(Engineer &e, const GLtk::Resources &r, Train &t):
-       GLtk::Widget(r),
-       Dialog(r),
+RouteSelect::RouteSelect(Engineer &e, Train &t):
        engineer(e),
        train(t)
 {
        set_size(200, 95);
 
        GLtk::Label *label;
-       add(*(label = new GLtk::Label(res, "Select route")));
+       add(*(label = new GLtk::Label("Select route")));
        label->set_geometry(GLtk::Geometry(10, geom.h-25, geom.w-20, 20));
 
-       add(*(drp_route = new GLtk::Dropdown(res)));
+       add(*(drp_route = new GLtk::Dropdown));
        drp_route->set_geometry(GLtk::Geometry(10, geom.h-50, geom.w-20, 20));
        drp_route->append("(none)");
        drp_route->set_selected_index(0);
index 53bf2fb57f22f050a63447df284818ceae871f3f..f6110c51739a7e28fbea10c3f650f43c30b7bf60 100644 (file)
@@ -22,7 +22,7 @@ private:
        Msp::GLtk::Dropdown *drp_route;
 
 public:
-       RouteSelect(Engineer &, const Msp::GLtk::Resources &, Marklin::Train &);
+       RouteSelect(Engineer &, Marklin::Train &);
 private:
        virtual void on_ok_clicked();
 };
index 1c7c907d25959904f5dc326a345a058af50f12b9..52f391ce0a85f635d6854fdab66b806ad49f458a 100644 (file)
@@ -14,29 +14,27 @@ using namespace std;
 using namespace Msp;
 using namespace Marklin;
 
-TimetableDialog::TimetableDialog(const GLtk::Resources &r, Timetable &tt):
-       GLtk::Widget(r),
-       GLtk::Dialog(r),
+TimetableDialog::TimetableDialog(Timetable &tt):
        timetable(tt)
 {
        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);
index a75a091547ceb11a6e74d3ac419a062bc2634beb..a1f611d10f622461c55dc702c67f16410e64cbe8 100644 (file)
@@ -21,7 +21,7 @@ private:
        Msp::GLtk::Toggle *tgl_enabled;
 
 public:
-       TimetableDialog(const Msp::GLtk::Resources &, Marklin::Timetable &);
+       TimetableDialog(Marklin::Timetable &);
 
 private:
        void enabled_toggled(bool);
index cc53499050a419b7c647b76f36d908516b11ba14..23e26eef713e8c0e37606e25a695ae9e704c07c4 100644 (file)
@@ -21,9 +21,7 @@ using namespace std;
 using namespace Msp;
 using namespace Marklin;
 
-TrainPanel::TrainPanel(Engineer &e, const GLtk::Resources &r, Train &t):
-       Widget(r),
-       Panel(r),
+TrainPanel::TrainPanel(Engineer &e, Train &t):
        engineer(e),
        train(t),
        expanded(false)
@@ -32,52 +30,52 @@ TrainPanel::TrainPanel(Engineer &e, const GLtk::Resources &r, Train &t):
 
        train.signal_control_changed.connect(sigc::mem_fun(this, &TrainPanel::train_control_changed));
 
-       add(*(pnl_basic = new GLtk::Panel(res)));
+       add(*(pnl_basic = new GLtk::Panel));
        pnl_basic->set_style("group");
        pnl_basic->set_geometry(GLtk::Geometry(0, geom.h-58, geom.w, 45));
 
-       pnl_basic->add(*(lbl_addr = new GLtk::Label(res, format("%2d", train.get_address()))));
+       pnl_basic->add(*(lbl_addr = new GLtk::Label(format("%2d", train.get_address()))));
        lbl_addr->set_style("digital");
        lbl_addr->set_geometry(GLtk::Geometry(10, 28, 35, 20));
 
-       pnl_basic->add(*(lbl_name = new GLtk::Label(res, train.get_name())));
+       pnl_basic->add(*(lbl_name = new GLtk::Label(train.get_name())));
        lbl_name->set_style("digital");
        lbl_name->set_geometry(GLtk::Geometry(50, 28, geom.w-77, 20));
        train.signal_name_changed.connect(sigc::mem_fun(lbl_name, &GLtk::Label::set_text));
 
-       pnl_basic->add(*(lbl_speed = new GLtk::Label(res, "  0")));
+       pnl_basic->add(*(lbl_speed = new GLtk::Label("  0")));
        lbl_speed->set_style("digital");
        lbl_speed->set_geometry(GLtk::Geometry(10, 3, 35, 20));
 
-       pnl_basic->add(*(sld_speed = new GLtk::HSlider(res)));
+       pnl_basic->add(*(sld_speed = new GLtk::HSlider));
        sld_speed->set_geometry(GLtk::Geometry(50, 8, geom.w-80, 10));
        sld_speed->set_range(0, 200);
        sld_speed->set_step(5);
        sld_speed->signal_value_changed.connect(sigc::mem_fun(this, &TrainPanel::speed_slider_changed));
 
-       pnl_basic->add(*(tgl_forward = new GLtk::Toggle(res)));
+       pnl_basic->add(*(tgl_forward = new GLtk::Toggle));
        tgl_forward->set_text("Fwd");
        tgl_forward->set_geometry(GLtk::Geometry(geom.w-30, 0, 20, 27));
        tgl_forward->set_value(true);
        tgl_forward->signal_toggled.connect(sigc::mem_fun(this, &TrainPanel::forward_toggled));
 
-       pnl_basic->add(*(btn_expand = new GLtk::Button(res)));
+       pnl_basic->add(*(btn_expand = new GLtk::Button));
        btn_expand->set_style("arrow_down");
        btn_expand->set_geometry(GLtk::Geometry(geom.w-22, 28, 12, 20));
        btn_expand->signal_clicked.connect(sigc::mem_fun(this, &TrainPanel::expand_clicked));
 
-       add(*(pnl_extra = new GLtk::Panel(res)));
+       add(*(pnl_extra = new GLtk::Panel));
        pnl_extra->set_style("group");
        pnl_extra->set_geometry(GLtk::Geometry(0, 10, geom.w, 135));
        pnl_extra->set_visible(false);
 
        const Route *route = train.get_route();
-       pnl_extra->add(*(lbl_route = new GLtk::Label(res, (route ? route->get_name() : "Free run"))));
+       pnl_extra->add(*(lbl_route = new GLtk::Label((route ? route->get_name() : "Free run"))));
        lbl_route->set_style("digital");
        lbl_route->set_geometry(GLtk::Geometry(10, 85, geom.w-20, 20));
        train.signal_route_changed.connect(sigc::mem_fun(this, &TrainPanel::train_route_changed));
 
-       pnl_extra->add(*(lbl_status = new GLtk::Label(res, train.get_status())));
+       pnl_extra->add(*(lbl_status = new GLtk::Label(train.get_status())));
        lbl_status->set_style("digital");
        lbl_status->set_geometry(GLtk::Geometry(10, 60, geom.w-20, 20));
        train.signal_status_changed.connect(sigc::mem_fun(this, &TrainPanel::train_status_changed));
@@ -89,7 +87,7 @@ TrainPanel::TrainPanel(Engineer &e, const GLtk::Resources &r, Train &t):
                string fname = i->second;
                fname[0] = toupper(fname[0]);
                GLtk::Toggle *tgl;
-               pnl_extra->add(*(tgl = new GLtk::Toggle(res)));
+               pnl_extra->add(*(tgl = new GLtk::Toggle));
                tgl->set_text(fname);
                tgl->set_geometry(GLtk::Geometry(x, 108, 36, 27));
                tgl->set_value(train.get_function(i->first));
@@ -101,31 +99,31 @@ TrainPanel::TrainPanel(Engineer &e, const GLtk::Resources &r, Train &t):
 
        GLtk::Button *btn;
 
-       pnl_extra->add(*(btn = new GLtk::Button(res, "Edit")));
+       pnl_extra->add(*(btn = new GLtk::Button("Edit")));
        btn->set_geometry(GLtk::Geometry(10, 30, 36, 25));
        btn->signal_clicked.connect(sigc::mem_fun(this, &TrainPanel::edit_clicked));
 
-       pnl_extra->add(*(btn = new GLtk::Button(res, "Place")));
+       pnl_extra->add(*(btn = new GLtk::Button("Place")));
        btn->set_geometry(GLtk::Geometry(10, 0, 36, 25));
        btn->signal_clicked.connect(sigc::mem_fun(this, &TrainPanel::place_clicked));
 
-       pnl_extra->add(*(btn = new GLtk::Button(res, "Take")));
+       pnl_extra->add(*(btn = new GLtk::Button("Take")));
        btn->set_geometry(GLtk::Geometry(46, 0, 36, 25));
        btn->signal_clicked.connect(sigc::mem_fun(this, &TrainPanel::take_clicked));
 
-       pnl_extra->add(*(btn = new GLtk::Button(res, "GoTo")));
+       pnl_extra->add(*(btn = new GLtk::Button("GoTo")));
        btn->set_geometry(GLtk::Geometry(100, 0, 36, 25));
        btn->signal_clicked.connect(sigc::mem_fun(this, &TrainPanel::goto_clicked));
 
-       pnl_extra->add(*(btn = new GLtk::Button(res, "Route")));
+       pnl_extra->add(*(btn = new GLtk::Button("Route")));
        btn->set_geometry(GLtk::Geometry(100, 30, 36, 25));
        btn->signal_clicked.connect(sigc::mem_fun(this, &TrainPanel::route_clicked));
 
-       pnl_extra->add(*(btn = new GLtk::Button(res, "TTbl")));
+       pnl_extra->add(*(btn = new GLtk::Button("TTbl")));
        btn->set_geometry(GLtk::Geometry(46, 30, 36, 25));
        btn->signal_clicked.connect(sigc::mem_fun(this, &TrainPanel::timetable_clicked));
 
-       pnl_extra->add(*(btn = new GLtk::Button(res, "View")));
+       pnl_extra->add(*(btn = new GLtk::Button("View")));
        btn->set_geometry(GLtk::Geometry(geom.w-46, 30, 36, 25));
        btn->signal_clicked.connect(sigc::mem_fun(this, &TrainPanel::view_clicked));
 }
@@ -193,14 +191,14 @@ void TrainPanel::take_clicked()
 
 void TrainPanel::edit_clicked()
 {
-       TrainProperties *dialog = new TrainProperties(engineer, res, &train);
+       TrainProperties *dialog = new TrainProperties(engineer, &train);
        engineer.get_root().add(*dialog);
        dialog->set_position(geom.x+geom.w, geom.y+geom.h-dialog->get_geometry().h);
 }
 
 void TrainPanel::route_clicked()
 {
-       RouteSelect *dialog = new RouteSelect(engineer, res, train);
+       RouteSelect *dialog = new RouteSelect(engineer, train);
        engineer.get_root().add(*dialog);
        dialog->set_position(geom.x+geom.w, geom.y+geom.h-dialog->get_geometry().h);
 }
@@ -220,7 +218,7 @@ void TrainPanel::timetable_clicked()
                train.set_timetable(timetable);
        }
 
-       TimetableDialog *dialog = new TimetableDialog(res, *timetable);
+       TimetableDialog *dialog = new TimetableDialog(*timetable);
        engineer.get_root().add(*dialog);
        dialog->set_position(geom.x+geom.w, geom.y+geom.h-dialog->get_geometry().h);
 }
index d15462ec61d8855d367dd899d289d58a89363eef..9a38ca49d4ed91200b6ede85e980511c793352fa 100644 (file)
@@ -39,7 +39,7 @@ private:
        bool expanded;
 
 public:
-       TrainPanel(Engineer &, const Msp::GLtk::Resources &, Marklin::Train &);
+       TrainPanel(Engineer &, Marklin::Train &);
        void expand(bool = true);
 
 private:
index bb8860b96ff12ffc8253344a88a168e484a1da35..bf0b270ca3de41556e3219fd81ea3ee73f70dc71 100644 (file)
@@ -17,22 +17,20 @@ using namespace std;
 using namespace Msp;
 using namespace Marklin;
 
-TrainProperties::TrainProperties(Engineer &e, const GLtk::Resources &r, Train *t):
-       Widget(r),
-       Dialog(r),
+TrainProperties::TrainProperties(Engineer &e, Train *t):
        engineer(e),
        train(t)
 {
        set_size(250, 305);
 
        GLtk::Label *label;
-       add(*(label = new GLtk::Label(res, "Train properties")));
+       add(*(label = new GLtk::Label("Train properties")));
        label->set_geometry(GLtk::Geometry(10, geom.h-25, geom.w-20, 20));
 
-       add(*(ent_addr = new GLtk::Entry(res)));
+       add(*(ent_addr = new GLtk::Entry));
        ent_addr->set_geometry(GLtk::Geometry(10, geom.h-50, 40, 20));
 
-       add(*(drp_type = new GLtk::Dropdown(res)));
+       add(*(drp_type = new GLtk::Dropdown));
        drp_type->set_geometry(GLtk::Geometry(60, geom.h-50, geom.w-70, 20));
 
        const Catalogue::VehicleMap &vehs = engineer.get_catalogue().get_vehicles();
@@ -49,10 +47,10 @@ TrainProperties::TrainProperties(Engineer &e, const GLtk::Resources &r, Train *t
                ++n;
        }
 
-       add(*(ent_name = new GLtk::Entry(res)));
+       add(*(ent_name = new GLtk::Entry));
        ent_name->set_geometry(GLtk::Geometry(10, geom.h-75, geom.w-20, 20));
 
-       add(*(drp_priority = new GLtk::Dropdown(res)));
+       add(*(drp_priority = new GLtk::Dropdown));
        drp_priority->set_geometry(GLtk::Geometry(10, geom.h-100, geom.w-20, 20));
        drp_priority->append("Standard freight");
        drp_priority->append("Express freight");
@@ -60,16 +58,16 @@ TrainProperties::TrainProperties(Engineer &e, const GLtk::Resources &r, Train *t
        drp_priority->append("Standard passenger");
        drp_priority->append("Express passenger");
 
-       add(*(lst_vehicles = new GLtk::List(res)));
+       add(*(lst_vehicles = new GLtk::List));
        lst_vehicles->set_geometry(GLtk::Geometry(10, 100, geom.w-20, geom.h-205));
 
        GLtk::Button *btn;
 
-       add(*(btn = new GLtk::Button(res, "Rem")));
+       add(*(btn = new GLtk::Button("Rem")));
        btn->set_geometry(GLtk::Geometry(10, 70, 40, 25));
        btn->signal_clicked.connect(sigc::mem_fun(this, &TrainProperties::remove_vehicle_clicked));
 
-       add(*(drp_new_vehicle = new GLtk::Dropdown(res)));
+       add(*(drp_new_vehicle = new GLtk::Dropdown));
        drp_new_vehicle->set_geometry(GLtk::Geometry(10, 45, geom.w-20, 20));
        drp_new_vehicle->append("(new vehicle)");
        drp_new_vehicle->set_selected_index(0);
index b69569f77dd47eddd2fca0435e3be3a4c8478ec7..99a0e99570f2f12a6cc1d44157be433bbc75d916 100644 (file)
@@ -30,7 +30,7 @@ private:
        std::set<unsigned> rem_vehicles;
 
 public:
-       TrainProperties(Engineer &, const Msp::GLtk::Resources &, Marklin::Train *);
+       TrainProperties(Engineer &, Marklin::Train *);
 private:
        virtual void on_ok_clicked();
        void new_vehicle_selected(unsigned, const std::string &);
index af2243c92fd2a5e41c1669d38a255e3f2a514f29..df336d577197763080a68fca2360f97fc52c6d52 100644 (file)
@@ -17,8 +17,6 @@ using namespace Msp;
 using namespace Marklin;
 
 TrainView::TrainView(Engineer &e, const Train &t):
-       GLtk::Widget(e.get_ui_resources()),
-       GLtk::Panel(e.get_ui_resources()),
        engineer(e),
        train(t),
        mode(SIDE),
@@ -47,29 +45,29 @@ TrainView::TrainView(Engineer &e, const Train &t):
        pass->lighting = &engineer.get_lighting();
 
        GLtk::Image *image;
-       add(*(image = new GLtk::Image(res, &tex)));
+       add(*(image = new GLtk::Image(&tex)));
        image->set_geometry(GLtk::Geometry(10, 40, geom.w-20, geom.h-50));
 
        GLtk::Button *btn;
 
-       add(*(btn = new GLtk::Button(res, "Roof")));
+       add(*(btn = new GLtk::Button("Roof")));
        btn->set_geometry(GLtk::Geometry(10, 10, 36, 25));
        btn->signal_clicked.connect(sigc::bind(sigc::mem_fun(this, &TrainView::set_mode), ROOF));
 
-       add(*(btn = new GLtk::Button(res, "Side")));
+       add(*(btn = new GLtk::Button("Side")));
        btn->set_geometry(GLtk::Geometry(46, 10, 36, 25));
        btn->signal_clicked.connect(sigc::bind(sigc::mem_fun(this, &TrainView::set_mode), SIDE));
 
-       add(*(btn = new GLtk::Button(res, "Head")));
+       add(*(btn = new GLtk::Button("Head")));
        btn->set_geometry(GLtk::Geometry(82, 10, 36, 25));
        btn->signal_clicked.connect(sigc::bind(sigc::mem_fun(this, &TrainView::set_mode), HEAD));
 
-       add(*(tgl_forward = new GLtk::Toggle(res, "Fwd")));
+       add(*(tgl_forward = new GLtk::Toggle("Fwd")));
        tgl_forward->set_geometry(GLtk::Geometry(118, 8, 36, 27));
        tgl_forward->set_value(true);
        tgl_forward->signal_toggled.connect(sigc::mem_fun(this, &TrainView::set_forward));
 
-       add(*(btn = new GLtk::Button(res, "Close")));
+       add(*(btn = new GLtk::Button("Close")));
        btn->set_geometry(GLtk::Geometry(geom.w-46, 10, 36, 25));
        btn->signal_clicked.connect(sigc::mem_fun(this, &TrainView::close_clicked));