X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fremote%2Fremote.cpp;h=dbcb7e4a166de4f252658dc0aad7931b3360d7c0;hb=ecd7af790bd3ab7c7e768f68968379e1feea56a9;hp=a193b2bf599ef87507fa9aedc037c4572c7a3c10;hpb=9ddcd066e37e4c72685817c042c30897786ece05;p=r2c2.git diff --git a/source/remote/remote.cpp b/source/remote/remote.cpp index a193b2b..dbcb7e4 100644 --- a/source/remote/remote.cpp +++ b/source/remote/remote.cpp @@ -1,27 +1,21 @@ -/* $Id$ - -This file is part of the MSP Märklin suite -Copyright © 2009-2010 Mikkosoft Productions, Mikko Rasa -Distributed under the GPL -*/ - +#include #include +#include #include #include +#include "mainpanel.h" #include "remote.h" #include "trainpanel.h" using namespace std; using namespace Msp; -Application::RegApp Remote::reg; - Remote::Remote(int argc, char **argv): client(catalogue), gtk(argc, argv) { if(argc<2) - throw UsageError("No address given"); + throw usage_error("No address given"); DataFile::load(catalogue, "locos.dat"); @@ -38,8 +32,15 @@ Remote::Remote(int argc, char **argv): window.set_default_size(300, 200); window.set_border_width(5); - train_box = new Gtk::VBox(false, 5); - window.add(*manage(train_box)); + Gtk::ScrolledWindow *scroll = new Gtk::ScrolledWindow; + window.add(*manage(scroll)); + scroll->set_policy(Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC); + + panel_box = new Gtk::VBox(false, 5); + scroll->add(*manage(panel_box)); + + main_panel = new MainPanel(*this, client); + panel_box->pack_start(*manage(main_panel), false, true); window.show_all(); } @@ -50,15 +51,13 @@ void Remote::tick() gtk.iteration(false); } -void Remote::train_added(Marklin::NetTrain &t) +void Remote::train_added(R2C2::NetTrain &t) { + Gtk::HSeparator *sep = new Gtk::HSeparator; + panel_box->pack_start(*manage(sep), false, true); + sep->show(); + TrainPanel *panel = new TrainPanel(*this, client, t); - if(!train_panels.empty()) - { - Gtk::HSeparator *sep = new Gtk::HSeparator; - train_box->pack_start(*manage(sep), false, true); - sep->show(); - } - train_box->pack_start(*manage(panel), false, true); + panel_box->pack_start(*manage(panel), false, true); train_panels.push_back(panel); }