]> git.tdb.fi Git - r2c2.git/blobdiff - source/engineer/trainproperties.cpp
Add graphics for toggle widget
[r2c2.git] / source / engineer / trainproperties.cpp
index 36f932523ff627517732a0455573c164ed8691dd..d26cec08b649524606f23c232bf2e98d28a10fc7 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 <msp/strings/formatter.h>
 #include <msp/strings/lexicalcast.h>
@@ -21,7 +28,7 @@ TrainProperties::TrainProperties(Engineer &e, GLtk::Resources &r, Train *t):
        add(*(drp_type=new GLtk::Dropdown(res)));
        drp_type->set_geometry(GLtk::Geometry(60, geom.h-30, geom.w-70, 20));
 
-       const map<unsigned, LocoType *> &locos=engineer.get_catalogue().get_locomotives();
+       const map<unsigned, LocoType *> &locos = engineer.get_catalogue().get_locomotives();
        for(map<unsigned, LocoType *>::const_iterator i=locos.begin(); i!=locos.end(); ++i)
                drp_type->append(format("%d %s", i->second->get_article_number(), i->second->get_name()));
 
@@ -45,10 +52,10 @@ void TrainProperties::ok_clicked()
 {
        if(!train)
        {
-               const map<unsigned, LocoType *> &locos=engineer.get_catalogue().get_locomotives();
-               map<unsigned, LocoType *>::const_iterator i=locos.begin();
+               const map<unsigned, LocoType *> &locos = engineer.get_catalogue().get_locomotives();
+               map<unsigned, LocoType *>::const_iterator i = locos.begin();
                advance(i, drp_type->get_selected_index());
-               train=engineer.add_train(*i->second, lexical_cast<unsigned>(ent_addr->get_text()));
+               train = engineer.add_train(*i->second, lexical_cast<unsigned>(ent_addr->get_text()));
        }
 
        train->set_name(ent_name->get_text());
@@ -57,4 +64,5 @@ void TrainProperties::ok_clicked()
 
 void TrainProperties::cancel_clicked()
 {
+       signal_cancel.emit();
 }