X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fremote%2Fremote.cpp;fp=source%2Fremote%2Fremote.cpp;h=0000000000000000000000000000000000000000;hb=a9bbf8d37a2f94a720897fe4f0ab06a016779c69;hp=dbcb7e4a166de4f252658dc0aad7931b3360d7c0;hpb=df88ff837468c32986c73740b4fc8279bc152e47;p=r2c2.git diff --git a/source/remote/remote.cpp b/source/remote/remote.cpp deleted file mode 100644 index dbcb7e4..0000000 --- a/source/remote/remote.cpp +++ /dev/null @@ -1,63 +0,0 @@ -#include -#include -#include -#include -#include -#include "mainpanel.h" -#include "remote.h" -#include "trainpanel.h" - -using namespace std; -using namespace Msp; - -Remote::Remote(int argc, char **argv): - client(catalogue), - gtk(argc, argv) -{ - if(argc<2) - throw usage_error("No address given"); - - DataFile::load(catalogue, "locos.dat"); - - client.use_event_dispatcher(event_disp); - client.signal_train_added.connect(sigc::mem_fun(this, &Remote::train_added)); - string addr_str = argv[1]; - if(addr_str.find(':')==string::npos) - addr_str += ":8315"; - Net::SockAddr *addr = Net::resolve(addr_str); - client.connect(*addr); - delete addr; - - window.signal_hide().connect(sigc::bind(sigc::mem_fun(this, &Remote::exit), 0)); - window.set_default_size(300, 200); - window.set_border_width(5); - - 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(); -} - -void Remote::tick() -{ - event_disp.tick(Time::zero); - gtk.iteration(false); -} - -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); - panel_box->pack_start(*manage(panel), false, true); - train_panels.push_back(panel); -}