#include <msp/gltk/column.h>
#include <msp/gltk/label.h>
#include <msp/gltk/row.h>
+#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);
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;
{
qualifier = drp_qualifier->get_data().get_string(sel);
unsigned number = lexical_cast<unsigned>(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);
}
}