diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index 376dd3f086..20992d881a 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -5743,15 +5743,18 @@ Editor::toggle_region_lock_style () return; } - bool inconsistent = false; - CheckMenuItem* cm = dynamic_cast ( - ActionManager::get_widget (X_("/Main/RegionMenu/RegionMenuPosition/toggle-region-lock-style"))); - - if (cm && cm->get_inconsistent()) { - inconsistent = true; + bool have_position_lock_style_audio = false; + bool have_position_lock_style_music = false; + for (list::const_iterator i = rs.begin(); i != rs.end(); ++i) { + if ((*i)->region()->position_lock_style() == MusicTime) { + have_position_lock_style_music = true; + } else { + have_position_lock_style_audio = true; + } } + bool const inconsistent = have_position_lock_style_audio && have_position_lock_style_music; - begin_reversible_command (_("region lock style")); + begin_reversible_command (_("toggle region lock style")); for (RegionSelection::iterator i = rs.begin(); i != rs.end(); ++i) { (*i)->region()->clear_changes (); diff --git a/gtk2_ardour/editor_selection.cc b/gtk2_ardour/editor_selection.cc index 56cedd5fa0..b8c4438be8 100644 --- a/gtk2_ardour/editor_selection.cc +++ b/gtk2_ardour/editor_selection.cc @@ -1301,19 +1301,13 @@ Editor::sensitize_the_right_region_actions () } a = Glib::RefPtr::cast_dynamic (_region_actions->get_action("toggle-region-lock-style")); - - CheckMenuItem* cm = dynamic_cast ( - ActionManager::get_widget (X_("/Main/RegionMenu/RegionMenuPosition/toggle-region-lock-style"))); - - if (cm) { - cm->set_inconsistent (false); - } - a->set_active (have_position_lock_style_music && !have_position_lock_style_audio); - if (have_position_lock_style_music && have_position_lock_style_audio) { - if (cm) { - cm->set_inconsistent (true); + vector proxies = a->get_proxies(); + for (vector::iterator p = proxies.begin(); p != proxies.end(); ++p) { + CheckMenuItem* cmi = dynamic_cast (*p); + if (cmi) { + cmi->set_inconsistent (have_position_lock_style_music && have_position_lock_style_audio); } }