window.set_title("Railway Designer");
window.signal_close.connect(sigc::bind(sigc::mem_fun(this, &Designer::exit), 0));
+ selection.signal_changed.connect(sigc::mem_fun(this, &Designer::selection_changed));
manipulator.signal_status.connect(sigc::mem_fun(this, &Designer::manipulation_status));
manipulator.signal_done.connect(sigc::mem_fun(this, &Designer::manipulation_done));
measure.signal_changed.connect(sigc::mem_fun(this, &Designer::measure_changed));
else if(key==Msp::Input::KEY_PLUS)
selection.select_more();
else if(key==Msp::Input::KEY_L && (mod&Input::MOD_SHIFT))
- {
- const set<Track *> &tracks = layout->get_tracks();
- float len = 0;
- for(set<Track *>::const_iterator i=tracks.begin(); i!=tracks.end(); ++i)
- len += (*i)->get_type().get_total_length();
- IO::print("Total length: %.1fm\n", len);
- }
+ selection.select_blocks();
else if(key==Msp::Input::KEY_L)
selection.select_linked();
else if(key==Msp::Input::KEY_M)
}
}
+void Designer::selection_changed()
+{
+ const set<Track *> &tracks = selection.get_tracks();
+ if(tracks.empty())
+ lbl_status->set_text(string());
+ else
+ {
+ float len = 0;
+ for(set<Track *>::const_iterator i=tracks.begin(); i!=tracks.end(); ++i)
+ len += (*i)->get_type().get_total_length();
+ lbl_status->set_text(format("%.2fm of track selected\n", len));
+ }
+}
+
void Designer::manipulation_status(const string &status)
{
lbl_status->set_text(status);
void Designer::manipulation_done(bool)
{
- lbl_status->set_text(string());
mode = SELECT;
+ selection_changed();
}
void Designer::measure_changed()
void Designer::measure_done()
{
- lbl_status->set_text(string());
mode = SELECT;
+ selection_changed();
}
void Designer::turnout_id_accept(const string &text)