X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fengineer%2Ftrainpanel.cpp;h=339f4eca669f7e9d4337dd25ab674c4937a260c7;hb=dcfa1e9503b7e97b61396d7458f0b2e5896779cd;hp=d462b5139c85f192d7bf747523c3b4e40fca1cdd;hpb=7587f018794f53974409a2aad76a0a421cea2d24;p=r2c2.git diff --git a/source/engineer/trainpanel.cpp b/source/engineer/trainpanel.cpp index d462b51..339f4ec 100644 --- a/source/engineer/trainpanel.cpp +++ b/source/engineer/trainpanel.cpp @@ -50,8 +50,10 @@ TrainPanel::TrainPanel(Engineer &e, const GLtk::Resources &r, Train &t): tgl_forward->set_geometry(GLtk::Geometry(geom.w-30, geom.h-59, 20, 27)); tgl_forward->set_value(!train.get_locomotive().get_reverse()); tgl_forward->signal_toggled.connect(sigc::mem_fun(this, &TrainPanel::forward_toggled)); + train.get_locomotive().signal_reverse_changed.connect(sigc::mem_fun(this, &TrainPanel::train_reverse_changed)); - add(*(lbl_route=new GLtk::Label(res, "Free run"))); + const Route *route = train.get_route(); + add(*(lbl_route=new GLtk::Label(res, (route ? route->get_name() : "Free run")))); lbl_route->set_style("digital"); lbl_route->set_geometry(GLtk::Geometry(10, 58, geom.w-20, 24)); train.signal_route_changed.connect(sigc::mem_fun(this, &TrainPanel::train_route_changed)); @@ -63,14 +65,14 @@ TrainPanel::TrainPanel(Engineer &e, const GLtk::Resources &r, Train &t): const map &funcs = train.get_locomotive().get_type().get_functions(); unsigned x = 10; - for(map::const_iterator i=funcs.begin(); i!=funcs.end(); ++i, x+=35) + for(map::const_iterator i=funcs.begin(); i!=funcs.end(); ++i, x+=36) { string fname = i->second; fname[0] = toupper(fname[0]); GLtk::Toggle *tgl; add(*(tgl=new GLtk::Toggle(res))); tgl->set_text(fname); - tgl->set_geometry(GLtk::Geometry(x, geom.h-85, 35, 27)); + tgl->set_geometry(GLtk::Geometry(x, geom.h-85, 36, 27)); tgl->set_value(train.get_locomotive().get_function(i->first)); tgl->signal_toggled.connect(sigc::bind(sigc::mem_fun(this, &TrainPanel::func_toggled), i->first)); @@ -107,6 +109,11 @@ void TrainPanel::train_speed_changed(unsigned speed) sld_speed->set_value(speed); } +void TrainPanel::train_reverse_changed(bool reverse) +{ + tgl_forward->set_value(!reverse); +} + void TrainPanel::loco_function_changed(unsigned func, bool value) { map::iterator i = tgl_funcs.find(func);