Add a simple check for valid duration in 'Insert/Remove Time'
This commit is contained in:
parent
3b1d1675de
commit
b9a3e33bf7
@ -96,7 +96,9 @@ InsertRemoveTimeDialog::InsertRemoveTimeDialog (PublicEditor& e, bool remove)
|
||||
get_vbox()->pack_start (*tempo_box);
|
||||
|
||||
add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
|
||||
add_button (remove ? _("Remove time") : _("Insert time"), Gtk::RESPONSE_OK);
|
||||
Gtk::Button *btn = manage (new Gtk::Button (remove ? _("Remove time") : _("Insert time")));
|
||||
btn->signal_clicked().connect (sigc::mem_fun(*this, &InsertRemoveTimeDialog::doit));
|
||||
get_action_area()->pack_start (*btn);
|
||||
show_all ();
|
||||
|
||||
move_markers_toggled ();
|
||||
@ -165,6 +167,17 @@ InsertRemoveTimeDialog::distance () const
|
||||
return _clock.current_duration (_editor.get_preferred_edit_position ());
|
||||
}
|
||||
|
||||
void
|
||||
InsertRemoveTimeDialog::doit ()
|
||||
{
|
||||
if (distance () == 0) {
|
||||
Gtk::MessageDialog msg (*this, _("Invalid or zero duration entered. Please enter a valid duration"));
|
||||
msg.run ();
|
||||
return;
|
||||
}
|
||||
response (RESPONSE_OK);
|
||||
}
|
||||
|
||||
void
|
||||
InsertRemoveTimeDialog::move_markers_toggled ()
|
||||
{
|
||||
|
@ -38,6 +38,7 @@ public:
|
||||
|
||||
private:
|
||||
void move_markers_toggled ();
|
||||
void doit ();
|
||||
|
||||
PublicEditor& _editor;
|
||||
Gtk::ComboBoxText _intersected_combo;
|
||||
|
Loading…
Reference in New Issue
Block a user