Add newline to DEBUG::Soundcloud so that it's readable & flushed
[ardour.git] / gtk2_ardour / editor_ops.cc
index 581326e278278ba60a08f5740bf88d43415a1e33..4eef1058af6a0f693e45f2d0a320231f09f97558 100644 (file)
@@ -5217,6 +5217,38 @@ Editor::adjust_region_gain (bool up)
        }
 }
 
+void
+Editor::reset_region_gain ()
+{
+       RegionSelection rs = get_regions_from_selection_and_entered ();
+
+       if (!_session || rs.empty()) {
+               return;
+       }
+
+       bool in_command = false;
+
+       for (RegionSelection::iterator r = rs.begin(); r != rs.end(); ++r) {
+               AudioRegionView* const arv = dynamic_cast<AudioRegionView*>(*r);
+               if (!arv) {
+                       continue;
+               }
+
+               arv->region()->clear_changes ();
+
+               arv->audio_region()->set_scale_amplitude (1.0f);
+
+               if (!in_command) {
+                               begin_reversible_command ("reset region gain");
+                               in_command = true;
+               }
+               _session->add_command (new StatefulDiffCommand (arv->region()));
+       }
+
+       if (in_command) {
+               commit_reversible_command ();
+       }
+}
 
 void
 Editor::reverse_region ()
@@ -7624,16 +7656,17 @@ Editor::remove_time (framepos_t pos, framecnt_t frames, InsertTimeOption opt,
 
                        XMLNode &before = pl->get_state();
 
+                       if (!in_command) {
+                               begin_reversible_command (_("remove time"));
+                               in_command = true;
+                       }
+
                        std::list<AudioRange> rl;
                        AudioRange ar(pos, pos+frames, 0);
                        rl.push_back(ar);
                        pl->cut (rl);
                        pl->shift (pos, -frames, true, ignore_music_glue);
 
-                       if (!in_command) {
-                               begin_reversible_command (_("remove time"));
-                               in_command = true;
-                       }
                        XMLNode &after = pl->get_state();
 
                        _session->add_command (new MementoCommand<Playlist> (*pl, &before, &after));