X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Finsert_remove_time_dialog.cc;h=0aeca1e2df37fc42f0b0e6b2b1756dcbfbcd6363;hb=c8c6bca6587450ff64303dbc994a4cd28d6ce7aa;hp=58345aed654f8cdf82593e9bdad259ba6b010186;hpb=b56bb944f6b48e8071f7b54bb60c777f5a66907d;p=ardour.git diff --git a/gtk2_ardour/insert_remove_time_dialog.cc b/gtk2_ardour/insert_remove_time_dialog.cc index 58345aed65..0aeca1e2df 100644 --- a/gtk2_ardour/insert_remove_time_dialog.cc +++ b/gtk2_ardour/insert_remove_time_dialog.cc @@ -23,7 +23,7 @@ #include #include "insert_remove_time_dialog.h" #include "audio_clock.h" -#include "i18n.h" +#include "pbd/i18n.h" using namespace Gtk; using namespace Editing; @@ -31,7 +31,13 @@ using namespace Editing; InsertRemoveTimeDialog::InsertRemoveTimeDialog (PublicEditor& e, bool remove) : ArdourDialog (remove ? _("Remove Time") : _("Insert Time")) , _editor (e) - , _clock ("insertTimeClock", true, "", true, false, true, false) + , _clock ("insertTimeClock", true, "", + true, // editable + false, // follows_playhead + true, // duration + false, // with_info + true // accept_on_focus_out + ) { set_session (_editor.session ()); @@ -90,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 ? _("Cut 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 (); @@ -159,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 () {