From: Mikko Rasa Date: Fri, 12 Nov 2010 21:53:42 +0000 (+0000) Subject: Match the API change in GLtk X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=62ce775d9af8f3321dbdebd6243b551fbbb0b976;p=r2c2.git Match the API change in GLtk Adjust vslider style so that the slider is at top wit zero range --- diff --git a/marklin.res b/marklin.res index 5397092..b40871e 100644 --- a/marklin.res +++ b/marklin.res @@ -542,5 +542,6 @@ style "vslider" { graphic NORMAL "vertical_knob"; fill 0.0 0.0; + align 0.0 1.0; }; }; diff --git a/source/designer/designer.cpp b/source/designer/designer.cpp index d393233..23185cf 100644 --- a/source/designer/designer.cpp +++ b/source/designer/designer.cpp @@ -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)); diff --git a/source/designer/input.cpp b/source/designer/input.cpp index e2b0ae0..26bf9f2 100644 --- a/source/designer/input.cpp +++ b/source/designer/input.cpp @@ -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"); diff --git a/source/designer/toolbar.cpp b/source/designer/toolbar.cpp index 629205c..56a5d6d 100644 --- a/source/designer/toolbar.cpp +++ b/source/designer/toolbar.cpp @@ -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)); diff --git a/source/engineer/dialog.cpp b/source/engineer/dialog.cpp index c6389c9..e71c1ce 100644 --- a/source/engineer/dialog.cpp +++ b/source/engineer/dialog.cpp @@ -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); diff --git a/source/engineer/dialog.h b/source/engineer/dialog.h index f923bb8..5fb694f 100644 --- a/source/engineer/dialog.h +++ b/source/engineer/dialog.h @@ -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(); diff --git a/source/engineer/engineer.cpp b/source/engineer/engineer.cpp index e7b047d..7e13f7b 100644 --- a/source/engineer/engineer.cpp +++ b/source/engineer/engineer.cpp @@ -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(); diff --git a/source/engineer/mainpanel.cpp b/source/engineer/mainpanel.cpp index 2083e7c..8a292b4 100644 --- a/source/engineer/mainpanel.cpp +++ b/source/engineer/mainpanel.cpp @@ -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); diff --git a/source/engineer/mainpanel.h b/source/engineer/mainpanel.h index a24ef49..17e95db 100644 --- a/source/engineer/mainpanel.h +++ b/source/engineer/mainpanel.h @@ -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: diff --git a/source/engineer/routeselect.cpp b/source/engineer/routeselect.cpp index cd1e704..0e19149 100644 --- a/source/engineer/routeselect.cpp +++ b/source/engineer/routeselect.cpp @@ -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); diff --git a/source/engineer/routeselect.h b/source/engineer/routeselect.h index 53bf2fb..f6110c5 100644 --- a/source/engineer/routeselect.h +++ b/source/engineer/routeselect.h @@ -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(); }; diff --git a/source/engineer/timetabledialog.cpp b/source/engineer/timetabledialog.cpp index 1c7c907..52f391c 100644 --- a/source/engineer/timetabledialog.cpp +++ b/source/engineer/timetabledialog.cpp @@ -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); diff --git a/source/engineer/timetabledialog.h b/source/engineer/timetabledialog.h index a75a091..a1f611d 100644 --- a/source/engineer/timetabledialog.h +++ b/source/engineer/timetabledialog.h @@ -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); diff --git a/source/engineer/trainpanel.cpp b/source/engineer/trainpanel.cpp index cc53499..23e26ee 100644 --- a/source/engineer/trainpanel.cpp +++ b/source/engineer/trainpanel.cpp @@ -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); } diff --git a/source/engineer/trainpanel.h b/source/engineer/trainpanel.h index d15462e..9a38ca4 100644 --- a/source/engineer/trainpanel.h +++ b/source/engineer/trainpanel.h @@ -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: diff --git a/source/engineer/trainproperties.cpp b/source/engineer/trainproperties.cpp index bb8860b..bf0b270 100644 --- a/source/engineer/trainproperties.cpp +++ b/source/engineer/trainproperties.cpp @@ -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); diff --git a/source/engineer/trainproperties.h b/source/engineer/trainproperties.h index b69569f..99a0e99 100644 --- a/source/engineer/trainproperties.h +++ b/source/engineer/trainproperties.h @@ -30,7 +30,7 @@ private: std::set 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 &); diff --git a/source/engineer/trainview.cpp b/source/engineer/trainview.cpp index af2243c..df336d5 100644 --- a/source/engineer/trainview.cpp +++ b/source/engineer/trainview.cpp @@ -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));