diff --git a/gtk2_ardour/editor_selection.cc b/gtk2_ardour/editor_selection.cc index a80d762554..eeabc7ada4 100644 --- a/gtk2_ardour/editor_selection.cc +++ b/gtk2_ardour/editor_selection.cc @@ -1512,8 +1512,11 @@ Editor::sensitize_the_right_region_actions (bool because_canvas_crossing) have_inactive_fade_out = true; } - have_inverted_polarity = ar->scale_amplitude () < 0; - have_non_inverted_polarity = ar->scale_amplitude () >= 0; + if (ar->scale_amplitude () < 0) { + have_inverted_polarity = true; + } else { + have_non_inverted_polarity = true; + } } } @@ -1564,14 +1567,18 @@ Editor::sensitize_the_right_region_actions (bool because_canvas_crossing) if (have_audio) { - if (have_envelope_active && !have_envelope_inactive) { - Glib::RefPtr::cast_dynamic (_region_actions->get_action("toggle-region-gain-envelope-active"))->set_active (); + if (have_envelope_active != have_envelope_inactive) { + Glib::RefPtr::cast_dynamic (_region_actions->get_action("toggle-region-gain-envelope-active"))->set_active (have_envelope_active); } else if (have_envelope_active && have_envelope_inactive) { - // Glib::RefPtr::cast_dynamic (_region_actions->get_action("toggle-region-gain-envelope-active"))->set_inconsistent (); + // Glib::RefPtr::cast_dynamic (_region_actions->get_action("toggle-region-gain-envelope-active"))->set_inconsistent (); // N/A + Glib::RefPtr::cast_dynamic (_region_actions->get_action("toggle-region-gain-envelope-active"))->set_sensitive (false); } - if (have_inverted_polarity && !have_non_inverted_polarity) { - Glib::RefPtr::cast_dynamic (_region_actions->get_action("toggle-region-polarity"))->set_active (); + if (have_inverted_polarity != have_non_inverted_polarity) { + Glib::RefPtr::cast_dynamic (_region_actions->get_action("toggle-region-polarity"))->set_active (have_inverted_polarity); + } else if (have_inverted_polarity && have_non_inverted_polarity) { + // Glib::RefPtr::cast_dynamic (_region_actions->get_action("toggle-region-polarity"))->set_inconsistent (); // N/A + Glib::RefPtr::cast_dynamic (_region_actions->get_action("toggle-region-polarity"))->set_sensitive (false); } } else {