View Issue Details

IDProjectCategoryView StatusLast Update
0006736ardourbugspublic2016-02-18 16:16
Reportercolinf Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status newResolutionopen 
Product Version4.6 
Summary0006736: 'Insert/Remove Tme' gives no indication of what's gone wrong when an invalid time is entered
DescriptionIf an invalid duration is entered into the clock in the insert/remove time dialogue, clicking on the 'insert/remove time' button will dismss the dialogue, but nothing else, with no indication to the user as to why not.
Additional InformationIdeally, the 'Insert/Remove Time' button should be disabled when the clock doesn't contain a valid non-zero duration, but that'd involve adding stuff to AudioClock to signal when the entered time is valid, which seems more complicated than necessary for this problem.
TagsNo tags attached.

Activities

colinf

2016-01-17 01:57

updater  

commit-c7fb668 (2,999 bytes)   
From c7fb668fe90ad85bad8bfeeea0b387336d72214f Mon Sep 17 00:00:00 2001
From: Colin Fletcher <colin.m.fletcher@googlemail.com>
Date: Sun, 17 Jan 2016 01:55:33 +0000
Subject: Add a simple check for valid duration in 'Insert/Remove Time'


diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc
index cb67f1f..6bdf2fb 100644
--- a/gtk2_ardour/editor_ops.cc
+++ b/gtk2_ardour/editor_ops.cc
@@ -7374,7 +7374,7 @@ Editor::remove_time (framepos_t pos, framecnt_t frames, InsertTimeOption opt,
 			pl->shift (pos, -frames, true, ignore_music_glue);
 
 			if (!in_command) {
-				begin_reversible_command (_("cut time"));
+				begin_reversible_command (_("remove time"));
 				in_command = true;
 			}
 			XMLNode &after = pl->get_state();
@@ -7386,7 +7386,7 @@ Editor::remove_time (framepos_t pos, framecnt_t frames, InsertTimeOption opt,
 		RouteTimeAxisView* rtav = dynamic_cast<RouteTimeAxisView*> (*x);
 		if (rtav) {
 			if (!in_command) {
-				begin_reversible_command (_("cut time"));
+				begin_reversible_command (_("remove time"));
 				in_command = true;
 			}
 			rtav->route ()->shift (pos, -frames);
@@ -7459,7 +7459,7 @@ Editor::remove_time (framepos_t pos, framecnt_t frames, InsertTimeOption opt,
 
 		if (moved) {
 			if (!in_command) {
-				begin_reversible_command (_("cut time"));
+				begin_reversible_command (_("remove time"));
 				in_command = true;
 			}
 			XMLNode& after (_session->locations()->get_state());
diff --git a/gtk2_ardour/insert_remove_time_dialog.cc b/gtk2_ardour/insert_remove_time_dialog.cc
index 851f57d..8620ba1 100644
--- a/gtk2_ardour/insert_remove_time_dialog.cc
+++ b/gtk2_ardour/insert_remove_time_dialog.cc
@@ -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 ();
@@ -166,6 +168,17 @@ InsertRemoveTimeDialog::distance () const
 }
 
 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 ()
 {
 	_move_glued_markers.set_sensitive (_move_markers.get_active ());
diff --git a/gtk2_ardour/insert_remove_time_dialog.h b/gtk2_ardour/insert_remove_time_dialog.h
index 6fbb575..ea3b242 100644
--- a/gtk2_ardour/insert_remove_time_dialog.h
+++ b/gtk2_ardour/insert_remove_time_dialog.h
@@ -38,6 +38,7 @@ public:
 
 private:
 	void move_markers_toggled ();
+	void doit ();
 
 	PublicEditor& _editor;
 	Gtk::ComboBoxText _intersected_combo;
commit-c7fb668 (2,999 bytes)   

colinf

2016-01-17 01:59

updater   ~0017802

... and here's a slightly hacky patch to pop up an error if the user tries to insert or remove a zero-length or invalid time.

colinf

2016-02-06 14:50

updater   ~0017887

committed in b9a3e33b - I hope it's an improvement.

timbyr

2016-02-18 04:31

developer   ~0017968

Just did a little bit of testing with nightly version 4.6.383

It is an improvement but I did notice that if I enter for instance the value 44.44.44.44 with the AudioClock set on Timecode mode then although the invalid duration dialog is displayed if I click 'OK' and go back to try and edit the time value(that has been reset to 00:00:00:00) it can no longer be edited.

I have to cancel the dialog and re-launch it.

colinf

2016-02-18 16:16

updater   ~0017971

Oh, yes, I see what you mean: I can reproduce this exactly.

Oddly, it doesn't always do it: if I leave the clock set on 00:00:00:00 and click the 'Insert' button I can go back & edit the clock, likewise if I enter 44:44:44:44 but click on one of the other controls before clicking 'Insert'. I'll look into it: it's very likely I've done something daft.

Issue History

Date Modified Username Field Change
2016-01-17 01:55 colinf New Issue
2016-01-17 01:57 colinf File Added: commit-c7fb668
2016-01-17 01:59 colinf Note Added: 0017802
2016-02-06 14:50 colinf Note Added: 0017887
2016-02-06 14:50 colinf Status new => feedback
2016-02-18 04:31 timbyr Note Added: 0017968
2016-02-18 04:32 timbyr Product Version => 4.6
2016-02-18 16:16 colinf Note Added: 0017971
2016-02-18 16:16 colinf Status feedback => new