X-Git-Url: http://git.tdb.fi/?p=r2c2.git;a=blobdiff_plain;f=source%2Fdesigner%2Fzoneproperties.cpp;h=38d9cc792bc9e7f37da6943dc808b3e8a7ee10bd;hp=6ea4f2a330fc1a4b115a597933b01ede9813968d;hb=1c15570729bbce44f0518373ca5bf8bf41cfa3b3;hpb=1e6ae9272462ae82093a572f34494b265db7b1a3 diff --git a/source/designer/zoneproperties.cpp b/source/designer/zoneproperties.cpp index 6ea4f2a..38d9cc7 100644 --- a/source/designer/zoneproperties.cpp +++ b/source/designer/zoneproperties.cpp @@ -2,14 +2,25 @@ #include #include #include +#include "libr2c2/block.h" +#include "libr2c2/track.h" #include "zoneproperties.h" using namespace std; using namespace Msp; using namespace R2C2; +string track_block_name(Track *const &track) +{ + if(track) + return track->get_block().get_name(); + else + return "(unspecified)"; +} + ZoneProperties::ZoneProperties(Zone &z): - zone(z) + zone(z), + up_directions(&track_block_name) { set_layout(new GLtk::Layout); GLtk::Column col(*layout); @@ -50,6 +61,27 @@ ZoneProperties::ZoneProperties(Zone &z): ent_number->set_edit_size(4, 1); } + { + GLtk::Row row(*layout); + add(*(lbl2 = new GLtk::Label("Up towards"))); + layout->add_constraint(*lbl1, GLtk::Layout::COPY_WIDTH, *lbl2); + add(*(drp_up_direction = new GLtk::Dropdown(up_directions))); + + up_directions.append(0); + + Track *up = zone.get_end(TrackChain::UP).next().track(); + if(!up) + drp_up_direction->set_selected_index(0); + + for(unsigned i=0; i<2; ++i) + if(TrackIter iter = zone.get_end(i).next()) + { + up_directions.append(iter.track()); + if(iter.track()==up) + drp_up_direction->set_selected_index(up_directions.size()-1); + } + } + GLtk::Button *btn; { @@ -73,5 +105,11 @@ void ZoneProperties::on_response(int code) qualifier = drp_qualifier->get_data().get_string(sel); unsigned number = lexical_cast(ent_number->get_text()); zone.set_name(ent_group->get_text(), qualifier, number); + + sel = drp_up_direction->get_selected_index(); + if(sel==0) + zone.clear_direction(); + else + zone.set_direction_towards(*up_directions.get(sel), TrackChain::UP); } }