3 This file is part of the MSP Märklin suite
4 Copyright © 2009 Mikkosoft Productions, Mikko Rasa
5 Distributed under the GPL
8 #include <msp/net/resolve.h>
9 #include <msp/time/units.h>
11 #include "trainpanel.h"
16 Application::RegApp<Remote> Remote::reg;
18 Remote::Remote(int argc, char **argv):
23 throw UsageError("No address given");
25 DataFile::load(catalogue, "locos.dat");
27 client.use_event_dispatcher(event_disp);
28 client.signal_train_added.connect(sigc::mem_fun(this, &Remote::train_added));
29 string addr_str = argv[1];
30 if(addr_str.find(':')==string::npos)
32 Net::SockAddr *addr = Net::resolve(addr_str);
33 client.connect(*addr);
36 window.signal_hide().connect(sigc::bind(sigc::mem_fun(this, &Remote::exit), 0));
37 window.set_border_width(5);
38 train_box = new Gtk::VBox(false, 5);
39 window.add(*manage(train_box));
45 event_disp.tick(Time::zero);
49 void Remote::train_added(Marklin::NetTrain &t)
51 TrainPanel *panel = new TrainPanel(t);
52 train_box->add(*manage(panel));