#include <gtkmm/alignment.h>
#include "insert_remove_time_dialog.h"
#include "audio_clock.h"
-#include "i18n.h"
+#include "pbd/i18n.h"
using namespace Gtk;
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 ());
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 ();
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 ()
{