Add option to insert time to move glued / locked markers. Fixes #3393.

git-svn-id: svn://localhost/ardour2/branches/3.0@7604 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2010-08-11 23:41:26 +00:00
parent 636efaabc4
commit 1e2fc9dcc0
4 changed files with 62 additions and 8 deletions

View file

@ -1102,7 +1102,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
void fork_region (); void fork_region ();
void do_insert_time (); void do_insert_time ();
void insert_time (nframes64_t, nframes64_t, Editing::InsertTimeOption, bool, bool, bool); void insert_time (nframes64_t, nframes64_t, Editing::InsertTimeOption, bool, bool, bool, bool, bool);
void tab_to_transient (bool forward); void tab_to_transient (bool forward);

View file

@ -6500,12 +6500,21 @@ Editor::do_insert_time ()
InsertTimeOption opt = d.intersected_region_action (); InsertTimeOption opt = d.intersected_region_action ();
insert_time (get_preferred_edit_position(), d.distance(), opt, d.move_glued(), d.move_markers(), d.move_tempos()); insert_time (
get_preferred_edit_position(),
d.distance(),
opt,
d.move_glued(),
d.move_markers(),
d.move_glued_markers(),
d.move_locked_markers(),
d.move_tempos()
);
} }
void void
Editor::insert_time (nframes64_t pos, nframes64_t frames, InsertTimeOption opt, Editor::insert_time (nframes64_t pos, nframes64_t frames, InsertTimeOption opt,
bool ignore_music_glue, bool markers_too, bool tempo_too) bool ignore_music_glue, bool markers_too, bool glued_markers_too, bool locked_markers_too, bool tempo_too)
{ {
bool commit = false; bool commit = false;
@ -6560,12 +6569,25 @@ Editor::insert_time (nframes64_t pos, nframes64_t frames, InsertTimeOption opt,
Locations::LocationList::const_iterator tmp; Locations::LocationList::const_iterator tmp;
if ((*i)->start() >= pos) { bool const was_locked = (*i)->locked ();
(*i)->set_start ((*i)->start() + frames); if (locked_markers_too) {
if (!(*i)->is_mark()) { (*i)->unlock ();
(*i)->set_end ((*i)->end() + frames); }
if ((*i)->position_lock_style() == AudioTime || glued_markers_too) {
if ((*i)->start() >= pos) {
(*i)->set_start ((*i)->start() + frames);
if (!(*i)->is_mark()) {
(*i)->set_end ((*i)->end() + frames);
}
moved = true;
} }
moved = true;
}
if (was_locked) {
(*i)->lock ();
} }
} }

View file

@ -65,12 +65,19 @@ InsertTimeDialog::InsertTimeDialog (PublicEditor& e)
get_vbox()->pack_start (_move_glued); get_vbox()->pack_start (_move_glued);
_move_markers.set_label (_("Move markers")); _move_markers.set_label (_("Move markers"));
get_vbox()->pack_start (_move_markers); get_vbox()->pack_start (_move_markers);
_move_markers.signal_toggled().connect (sigc::mem_fun (*this, &InsertTimeDialog::move_markers_toggled));
_move_glued_markers.set_label (_("Move glued markers"));
get_vbox()->pack_start (_move_glued_markers);
_move_locked_markers.set_label (_("Move locked markers"));
get_vbox()->pack_start (_move_locked_markers);
_move_tempos.set_label (_("Move tempo and meter changes")); _move_tempos.set_label (_("Move tempo and meter changes"));
get_vbox()->pack_start (_move_tempos); get_vbox()->pack_start (_move_tempos);
add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
add_button (_("Insert time"), Gtk::RESPONSE_OK); add_button (_("Insert time"), Gtk::RESPONSE_OK);
show_all (); show_all ();
move_markers_toggled ();
} }
InsertTimeOption InsertTimeOption
@ -112,8 +119,27 @@ InsertTimeDialog::move_markers () const
return _move_markers.get_active (); return _move_markers.get_active ();
} }
bool
InsertTimeDialog::move_glued_markers () const
{
return _move_glued_markers.get_active ();
}
bool
InsertTimeDialog::move_locked_markers () const
{
return _move_locked_markers.get_active ();
}
nframes64_t nframes64_t
InsertTimeDialog::distance () const InsertTimeDialog::distance () const
{ {
return _clock.current_duration (_editor.get_preferred_edit_position ()); return _clock.current_duration (_editor.get_preferred_edit_position ());
} }
void
InsertTimeDialog::move_markers_toggled ()
{
_move_glued_markers.set_sensitive (_move_markers.get_active ());
_move_locked_markers.set_sensitive (_move_markers.get_active ());
}

View file

@ -30,14 +30,20 @@ public:
Editing::InsertTimeOption intersected_region_action (); Editing::InsertTimeOption intersected_region_action ();
bool move_glued () const; bool move_glued () const;
bool move_markers () const; bool move_markers () const;
bool move_glued_markers () const;
bool move_locked_markers () const;
bool move_tempos () const; bool move_tempos () const;
nframes64_t distance () const; nframes64_t distance () const;
private: private:
void move_markers_toggled ();
PublicEditor& _editor; PublicEditor& _editor;
Gtk::ComboBoxText _intersected_combo; Gtk::ComboBoxText _intersected_combo;
Gtk::CheckButton _move_glued; Gtk::CheckButton _move_glued;
Gtk::CheckButton _move_markers; Gtk::CheckButton _move_markers;
Gtk::CheckButton _move_glued_markers;
Gtk::CheckButton _move_locked_markers;
Gtk::CheckButton _move_tempos; Gtk::CheckButton _move_tempos;
AudioClock _clock; AudioClock _clock;
}; };