Clear displayed transients on closing the rhythm ferret dialogue. Fixes #3623.
authorCarl Hetherington <carl@carlh.net>
Wed, 29 Dec 2010 01:33:49 +0000 (01:33 +0000)
committerCarl Hetherington <carl@carlh.net>
Wed, 29 Dec 2010 01:33:49 +0000 (01:33 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@8357 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/rhythm_ferret.cc
gtk2_ardour/rhythm_ferret.h

index da31feca3c8fc6f81f3ae3f7489138fbec86301d..5685cb56af766da2c4af86b87650c5119f971cc2 100644 (file)
@@ -183,15 +183,17 @@ RhythmFerret::run_analysis ()
                return;
        }
 
-       RegionSelection& regions (editor.get_selection().regions);
+       clear_transients ();
+
+       regions_with_transients = editor.get_selection().regions;
 
        current_results.clear ();
 
-       if (regions.empty()) {
+       if (regions_with_transients.empty()) {
                return;
        }
 
-       for (RegionSelection::iterator i = regions.begin(); i != regions.end(); ++i) {
+       for (RegionSelection::iterator i = regions_with_transients.begin(); i != regions_with_transients.end(); ++i) {
 
                boost::shared_ptr<Readable> rd = boost::static_pointer_cast<AudioRegion> ((*i)->region());
 
@@ -382,5 +384,17 @@ void
 RhythmFerret::on_hide ()
 {
        ArdourDialog::on_hide ();
+       clear_transients ();
+}
+
+/* Clear any transients that we have added */
+void
+RhythmFerret::clear_transients ()
+{
+       current_results.clear ();
+       for (RegionSelection::iterator i = regions_with_transients.begin(); i != regions_with_transients.end(); ++i) {
+               (*i)->region()->set_transients (current_results);
+       }
+       regions_with_transients.clear ();
 }
 
index 1d846450564f8bd4b00ab0d6c942eb1125fdcc5a..a1a201531b7c35fb12b840f2537a7119adea6a97 100644 (file)
@@ -12,6 +12,7 @@
 #include <gtkmm/button.h>
 
 #include "ardour_dialog.h"
+#include "region_selection.h"
 
 namespace ARDOUR {
        class Readable;
@@ -79,6 +80,10 @@ class RhythmFerret : public ArdourDialog {
 
        ARDOUR::AnalysisFeatureList current_results;
 
+       void clear_transients ();
+       /** Regions that we have added transient marks to */
+       RegionSelection regions_with_transients;
+
        AnalysisMode get_analysis_mode () const;
        Action get_action() const;
        void analysis_mode_changed ();