13
0

more messing about with inconsistent menu state.

This commit is contained in:
nick_m 2017-02-01 22:58:48 +11:00
parent f336f4e6d1
commit 1cfa6bd69f
2 changed files with 15 additions and 18 deletions

View File

@ -5743,15 +5743,18 @@ Editor::toggle_region_lock_style ()
return; return;
} }
bool inconsistent = false; bool have_position_lock_style_audio = false;
CheckMenuItem* cm = dynamic_cast<CheckMenuItem*> ( bool have_position_lock_style_music = false;
ActionManager::get_widget (X_("/Main/RegionMenu/RegionMenuPosition/toggle-region-lock-style"))); for (list<RegionView*>::const_iterator i = rs.begin(); i != rs.end(); ++i) {
if ((*i)->region()->position_lock_style() == MusicTime) {
if (cm && cm->get_inconsistent()) { have_position_lock_style_music = true;
inconsistent = 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) { for (RegionSelection::iterator i = rs.begin(); i != rs.end(); ++i) {
(*i)->region()->clear_changes (); (*i)->region()->clear_changes ();

View File

@ -1301,19 +1301,13 @@ Editor::sensitize_the_right_region_actions ()
} }
a = Glib::RefPtr<ToggleAction>::cast_dynamic (_region_actions->get_action("toggle-region-lock-style")); a = Glib::RefPtr<ToggleAction>::cast_dynamic (_region_actions->get_action("toggle-region-lock-style"));
CheckMenuItem* cm = dynamic_cast<CheckMenuItem*> (
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); a->set_active (have_position_lock_style_music && !have_position_lock_style_audio);
if (have_position_lock_style_music && have_position_lock_style_audio) { vector<Widget*> proxies = a->get_proxies();
if (cm) { for (vector<Widget*>::iterator p = proxies.begin(); p != proxies.end(); ++p) {
cm->set_inconsistent (true); CheckMenuItem* cmi = dynamic_cast<CheckMenuItem*> (*p);
if (cmi) {
cmi->set_inconsistent (have_position_lock_style_music && have_position_lock_style_audio);
} }
} }