]> git.tdb.fi Git - r2c2.git/blobdiff - source/engineer/mainpanel.cpp
Adapt to a change in gltk
[r2c2.git] / source / engineer / mainpanel.cpp
index c89060a4416b77145337de2f2bffd743493cb6e3..08348d713a91982902c9122067f6d6b017732801 100644 (file)
@@ -1,3 +1,10 @@
+/* $Id$
+
+This file is part of the MSP Märklin suite
+Copyright © 2006-2008 Mikkosoft Productions, Mikko Rasa
+Distributed under the GPL
+*/
+
 #include <msp/gltk/button.h>
 #include "engineer.h"
 #include "mainpanel.h"
@@ -6,6 +13,7 @@ using namespace std;
 using namespace Msp;
 
 MainPanel::MainPanel(Engineer &e, GLtk::Resources &r):
+       Widget(r),
        Panel(r),
        engineer(e)
 {
@@ -48,6 +56,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 +81,16 @@ void MainPanel::power_off()
 
 void MainPanel::new_loc()
 {
-       engineer.add_train(0);
+       engineer.add_train();
 }
 
 void MainPanel::quit()
 {
        engineer.quit();
 }
+
+void MainPanel::power_event(bool p)
+{
+       ind_on->set_active(p);
+       ind_off->set_active(!p);
+}