]> git.tdb.fi Git - r2c2.git/blobdiff - source/remote/remote.cpp
Some other minor UI tweaks
[r2c2.git] / source / remote / remote.cpp
index c53bddda1c2f08c4578b09cca3e05bf93c66ca5f..dbcb7e4a166de4f252658dc0aad7931b3360d7c0 100644 (file)
@@ -1,28 +1,21 @@
-/* $Id$
-
-This file is part of R²C²
-Copyright © 2009-2010  Mikkosoft Productions, Mikko Rasa
-Distributed under the GPL
-*/
-
 #include <gtkmm/scrolledwindow.h>
 #include <gtkmm/separator.h>
+#include <msp/core/getopt.h>
 #include <msp/net/resolve.h>
 #include <msp/time/units.h>
+#include "mainpanel.h"
 #include "remote.h"
 #include "trainpanel.h"
 
 using namespace std;
 using namespace Msp;
 
-Application::RegApp<Remote> 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");
 
@@ -43,8 +36,11 @@ Remote::Remote(int argc, char **argv):
        window.add(*manage(scroll));
        scroll->set_policy(Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
 
-       train_box = new Gtk::VBox(false, 5);
-       scroll->add(*manage(train_box));
+       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();
 }
@@ -57,13 +53,11 @@ void Remote::tick()
 
 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);
 }