add(*(drp_qualifier = new GLtk::Dropdown));
GLtk::ListDataStore<string> &data = dynamic_cast<GLtk::ListDataStore<string> &>(drp_qualifier->get_data());
- const char *qualifiers[] = { "track", "platform", "siding", 0 };
+ const char *qualifiers[] = { "(none)", "track", "platform", "siding", 0 };
for(unsigned i=0; qualifiers[i]; ++i)
{
data.append(qualifiers[i]);
if(zone.get_qualifier()==qualifiers[i])
drp_qualifier->set_selected_index(i);
}
+
+ if(zone.get_qualifier().empty())
+ drp_qualifier->set_selected_index(0);
}
{
GLtk::Row row(*layout);
add(*(lbl1 = new GLtk::Label("Number")));
layout->add_constraint(*lbl1, GLtk::Layout::COPY_WIDTH, *lbl2);
- add(*(ent_number = new GLtk::Entry(lexical_cast<string>(zone.get_number()))));
+ unsigned n = zone.get_number();
+ add(*(ent_number = new GLtk::Entry(n ? lexical_cast<string>(zone.get_number()) : string())));
ent_number->set_edit_size(4, 1);
}
{
string qualifier;
int sel = drp_qualifier->get_selected_index();
- if(sel>=0)
+ if(sel>0)
qualifier = drp_qualifier->get_data().get_string(sel);
- unsigned number = lexical_cast<unsigned>(ent_number->get_text());
+
+ unsigned number = 0;
+ string num_str = ent_number->get_text();
+ if(!num_str.empty())
+ number = lexical_cast<unsigned>(ent_number->get_text());
+
zone.set_name(ent_group->get_text(), qualifier, number);
sel = drp_up_direction->get_selected_index();
add("time", &Loader::time);
add("type", &Row::type);
add("zone", &Loader::zone);
+ add("zone", &Loader::zone_numbered);
}
void Timetable::Row::Loader::block(unsigned id)
obj.time = Time::TimeDelta(t);
}
-void Timetable::Row::Loader::zone(const string &name, unsigned number)
+void Timetable::Row::Loader::zone(const string &name)
+{
+ zone_numbered(name, 0);
+}
+
+void Timetable::Row::Loader::zone_numbered(const string &name, unsigned number)
{
obj.target = &layout.get_zone(name, number);
}