X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fengineer%2Fmainpanel.cpp;h=8c3718b9176fa025bcda7087633cf8357a10522e;hb=bc8ac89bbe774bb133b758416182aa18e5e0a5a5;hp=c89060a4416b77145337de2f2bffd743493cb6e3;hpb=aead7f2da831199fbb8f6950b067656b2965c2fa;p=r2c2.git diff --git a/source/engineer/mainpanel.cpp b/source/engineer/mainpanel.cpp index c89060a..8c3718b 100644 --- a/source/engineer/mainpanel.cpp +++ b/source/engineer/mainpanel.cpp @@ -1,11 +1,20 @@ +/* $Id$ + +This file is part of the MSP Märklin suite +Copyright © 2006-2009 Mikkosoft Productions, Mikko Rasa +Distributed under the GPL +*/ + #include #include "engineer.h" #include "mainpanel.h" +#include "trainproperties.h" using namespace std; using namespace Msp; MainPanel::MainPanel(Engineer &e, GLtk::Resources &r): + Widget(r), Panel(r), engineer(e) { @@ -48,6 +57,8 @@ MainPanel::MainPanel(Engineer &e, GLtk::Resources &r): ind_on->set_active(true); else ind_off->set_active(true); + + engineer.get_control().signal_power_event.connect(sigc::mem_fun(this, &MainPanel::power_event)); } void MainPanel::set_status_text(const string &txt) @@ -71,10 +82,19 @@ void MainPanel::power_off() void MainPanel::new_loc() { - engineer.add_train(0); + TrainProperties *dialog = new TrainProperties(engineer, res, 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); } void MainPanel::quit() { engineer.quit(); } + +void MainPanel::power_event(bool p) +{ + ind_on->set_active(p); + ind_off->set_active(!p); +}