diff options
author | Ben Loftis <ben@glw.com> | 2009-06-10 12:51:37 +0000 |
---|---|---|
committer | Ben Loftis <ben@glw.com> | 2009-06-10 12:51:37 +0000 |
commit | adb94a0d9e2d16dd0eb632d89b05cd89a4c24e11 (patch) | |
tree | bfe1e2b33f3fa75e8f37cfd467e373da6c925305 | |
parent | 9c8ecfd3bb241d3a0a00a72f0bb76fce23076a4a (diff) |
Allow Insert Time option to move tempos and time sig changes, as per #1951 (thanks carlh)
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@5150 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r-- | gtk2_ardour/editor.h | 2 | ||||
-rw-r--r-- | gtk2_ardour/editor_ops.cc | 10 | ||||
-rw-r--r-- | libs/ardour/ardour/tempo.h | 2 | ||||
-rw-r--r-- | libs/ardour/tempo.cc | 15 |
4 files changed, 26 insertions, 3 deletions
diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 9d661c8125..f3ed303fc2 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -1098,7 +1098,7 @@ class Editor : public PublicEditor void adjust_region_scale_amplitude (bool up); void do_insert_time (); - void insert_time (nframes64_t pos, nframes64_t distance, Editing::InsertTimeOption opt, bool ignore_music_glue, bool markers_too); + void insert_time (nframes64_t pos, nframes64_t distance, Editing::InsertTimeOption opt, bool ignore_music_glue, bool markers_too, bool tempo_too); void tab_to_transient (bool forward); diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index 40e1b22aed..3c19d69a30 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -6000,6 +6000,7 @@ Editor::do_insert_time () Label intersect_option_label (_("Intersected regions should:")); CheckButton glue_button (_("Move Glued Regions")); CheckButton marker_button (_("Move Markers")); + CheckButton tempo_button (_("Move Tempo & Meters")); AudioClock clock ("insertTimeClock", true, X_("InsertTimeClock"), true, true, true); HBox clock_box; @@ -6014,6 +6015,7 @@ Editor::do_insert_time () option_box.pack_start (button_box, false, false); option_box.pack_start (glue_button, false, false); option_box.pack_start (marker_button, false, false); + option_box.pack_start (tempo_button, false, false); button_box.pack_start (leave_button, false, false); button_box.pack_start (move_button, false, false); @@ -6033,6 +6035,7 @@ Editor::do_insert_time () clock.show_all(); clock_box.show (); marker_button.show (); + tempo_button.show (); d.add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); d.add_button (Gtk::Stock::OK, Gtk::RESPONSE_OK); @@ -6060,12 +6063,12 @@ Editor::do_insert_time () opt = SplitIntersected; } - insert_time (pos, distance, opt, glue_button.get_active(), marker_button.get_active()); + insert_time (pos, distance, opt, glue_button.get_active(), marker_button.get_active(), tempo_button.get_active()); } void Editor::insert_time (nframes64_t pos, nframes64_t frames, InsertTimeOption opt, - bool ignore_music_glue, bool markers_too) + bool ignore_music_glue, bool markers_too, bool tempo_too) { bool commit = false; @@ -6127,6 +6130,9 @@ Editor::insert_time (nframes64_t pos, nframes64_t frames, InsertTimeOption opt, session->add_command (new MementoCommand<Locations>(*session->locations(), &before, &after)); } } + + if (tempo_too) + session->tempo_map().insert_time (pos, frames); if (commit) { commit_reversible_command (); diff --git a/libs/ardour/ardour/tempo.h b/libs/ardour/ardour/tempo.h index c4915072c5..23f18eda57 100644 --- a/libs/ardour/ardour/tempo.h +++ b/libs/ardour/ardour/tempo.h @@ -281,6 +281,8 @@ class TempoMap : public PBD::StatefulDestructible void change_existing_tempo_at (nframes_t, double bpm, double note_type); void change_initial_tempo (double bpm, double note_type); + void insert_time( nframes_t where, nframes_t amount); + int n_tempos () const; int n_meters () const; diff --git a/libs/ardour/tempo.cc b/libs/ardour/tempo.cc index ab7b7c096e..4b9ac61e49 100644 --- a/libs/ardour/tempo.cc +++ b/libs/ardour/tempo.cc @@ -529,6 +529,21 @@ TempoMap::change_initial_tempo (double beats_per_minute, double note_type) } void +TempoMap::insert_time (nframes_t where, nframes_t amount) +{ + for (Metrics::iterator i = metrics->begin(); i != metrics->end(); ++i) { + if ((*i)->frame() >= where) { + (*i)->set_frame ((*i)->frame() + amount); + } + } + + timestamp_metrics (false); + + StateChanged (Change (0)); +} + + +void TempoMap::change_existing_tempo_at (nframes_t where, double beats_per_minute, double note_type) { Tempo newtempo (beats_per_minute, note_type); |