X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fdesigner%2Fdesigner.cpp;h=7fbab1fd4cdd705abfdfe877f6de8603ffcf544a;hb=0e691a3893a07dc362c733869760e0d7d1109ea8;hp=396cb074c98b6cd83deae38f4b9df443d4473c7f;hpb=f409cd39a687900724d987c9db629cbff0dd49be;p=r2c2.git diff --git a/source/designer/designer.cpp b/source/designer/designer.cpp index 396cb07..7fbab1f 100644 --- a/source/designer/designer.cpp +++ b/source/designer/designer.cpp @@ -86,6 +86,7 @@ Designer::Designer(int argc, char **argv): pipeline->add_renderable_for_pass(layout_3d->get_scene(), 0); if(base_object) pipeline->add_renderable_for_pass(*base_object, 0); + pipeline->add_renderable_for_pass(layout_3d->get_path_scene(), "unlit"); pipeline->add_renderable_for_pass(layout_3d->get_endpoint_scene(), "unlit"); light.set_position(0, -0.259, 0.966, 0); @@ -129,6 +130,8 @@ Designer::Designer(int argc, char **argv): const list &tracks = layout_3d->get_tracks(); for(list::const_iterator i=tracks.begin(); i!=tracks.end(); ++i) update_track_icon(**i); + + edit_route(0); } Designer::~Designer() @@ -202,12 +205,18 @@ void Designer::set_sensor_id() } } -void Designer::edit_route(Route &r) +void Designer::rename_route() { if(!cur_route) - pipeline->add_renderable_for_pass(layout_3d->get_path_scene(), "unlit"); + return; + + InputDialog *input = new InputDialog(*this, "Route name", cur_route->get_name()); + input->signal_accept.connect(sigc::mem_fun(this, &Designer::route_name_accept)); +} - cur_route = &r; +void Designer::edit_route(Route *r) +{ + cur_route = r; show_route(r); } @@ -227,7 +236,7 @@ void Designer::add_selection_to_route() IO::print("%s\n", e.what()); } - show_route(*cur_route); + show_route(cur_route); } Point Designer::map_pointer_coords(int x, int y) @@ -545,6 +554,12 @@ void Designer::sensor_id_accept(const string &text) } } +void Designer::route_name_accept(const string &text) +{ + if(cur_route) + cur_route->set_name(text); +} + void Designer::view_all() { Point minp; @@ -590,20 +605,19 @@ string Designer::tooltip(int x, int y) return string(); } -void Designer::show_route(const Route &route) +void Designer::show_route(const Route *route) { const set <racks = layout->get_tracks(); - const set &rtracks = route.get_tracks(); for(set::iterator i=ltracks.begin(); i!=ltracks.end(); ++i) { Track3D &t3d = layout_3d->get_track(**i); - if(rtracks.count(*i)) + if(route && route->get_tracks().count(*i)) { t3d.get_path().set_color(GL::Color(0.5, 0.8, 1.0)); if((*i)->get_type().is_turnout()) { unsigned tid = (*i)->get_turnout_id(); - int path = (tid ? route.get_turnout(tid) : -1); + int path = (tid ? route->get_turnout(tid) : -1); if(path>=0) t3d.get_path().set_path(path); else