Fix toggling behaviour of glue region to bars & beats option. Fixes #2588.

git-svn-id: svn://localhost/ardour2/branches/3.0@7040 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2010-05-02 14:08:37 +00:00
parent 614514dad3
commit 7fc2e8da30
4 changed files with 6 additions and 5 deletions

View File

@ -1739,7 +1739,7 @@ Editor::add_region_context_items (StreamView* sv, boost::shared_ptr<Region> regi
break;
}
bbt_glue_item->signal_activate().connect (sigc::bind (sigc::mem_fun (*this, &Editor::set_region_lock_style), Region::MusicTime));
bbt_glue_item->signal_activate().connect (sigc::mem_fun (*this, &Editor::toggle_region_lock_style));
items.push_back (CheckMenuElem (_("Mute")));
CheckMenuItem* region_mute_item = static_cast<CheckMenuItem*>(&items.back());

View File

@ -1040,7 +1040,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
void toggle_region_lock ();
void toggle_region_opaque ();
void toggle_record_enable ();
void set_region_lock_style (ARDOUR::Region::PositionLockStyle);
void toggle_region_lock_style ();
void raise_region ();
void raise_region_to_top ();
void lower_region ();

View File

@ -458,7 +458,7 @@ Editor::register_actions ()
act = ActionManager::register_toggle_action (editor_actions, "lock-region", _("Lock Region"), sigc::mem_fun(*this, &Editor::toggle_region_lock));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::region_selection_sensitive_actions.push_back (act);
act = ActionManager::register_toggle_action (editor_actions, "glue-region", _("Glue Region to Bars and Beats"), sigc::bind (sigc::mem_fun (*this, &Editor::set_region_lock_style), Region::MusicTime));
act = ActionManager::register_toggle_action (editor_actions, "glue-region", _("Glue Region to Bars and Beats"), sigc::mem_fun (*this, &Editor::toggle_region_lock_style));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::region_selection_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "naturalize-region", _("Move to Original Position"), sigc::mem_fun (*this, &Editor::naturalize));

View File

@ -4884,7 +4884,7 @@ Editor::toggle_region_lock ()
}
void
Editor::set_region_lock_style (Region::PositionLockStyle ps)
Editor::toggle_region_lock_style ()
{
RegionSelection rs = get_equivalent_regions (selection->regions, ARDOUR::Properties::edit.property_id);
@ -4896,7 +4896,8 @@ Editor::set_region_lock_style (Region::PositionLockStyle ps)
for (RegionSelection::iterator i = rs.begin(); i != rs.end(); ++i) {
(*i)->region()->clear_history ();
(*i)->region()->set_position_lock_style (ps);
Region::PositionLockStyle const ns = (*i)->region()->positional_lock_style() == Region::AudioTime ? Region::MusicTime : Region::AudioTime;
(*i)->region()->set_position_lock_style (ns);
_session->add_command (new StatefulDiffCommand ((*i)->region()));
}