+ _all_region_actions_sensitized = s;
+}
+
+/** Sensitize region-based actions based on the selection ONLY, ignoring the entered_regionview.
+ * This method should be called just before displaying a Region menu. When a Region menu is not
+ * currently being shown, all region actions are sensitized so that hotkey-triggered actions
+ * on entered_regionviews work without having to check sensitivity every time the selection or
+ * entered_regionview changes.
+ *
+ * This method also sets up toggle action state as appropriate.
+ */
+void
+Editor::sensitize_the_right_region_actions ()
+{
+
+ RegionSelection rs = get_regions_from_selection_and_entered ();
+ sensitize_all_region_actions (!rs.empty ());
+
+ _ignore_region_action = true;
+
+ /* Look through the regions that are selected and make notes about what we have got */
+
+ bool have_audio = false;
+ bool have_multichannel_audio = false;
+ bool have_midi = false;
+ bool have_locked = false;
+ bool have_unlocked = false;
+ bool have_video_locked = false;
+ bool have_video_unlocked = false;
+ bool have_position_lock_style_audio = false;
+ bool have_position_lock_style_music = false;
+ bool have_muted = false;
+ bool have_unmuted = false;
+ bool have_opaque = false;
+ bool have_non_opaque = false;
+ bool have_not_at_natural_position = false;
+ bool have_envelope_active = false;
+ bool have_envelope_inactive = false;
+ bool have_non_unity_scale_amplitude = false;
+ bool have_compound_regions = false;
+ bool have_inactive_fade_in = false;
+ bool have_inactive_fade_out = false;
+ bool have_active_fade_in = false;
+ bool have_active_fade_out = false;
+
+ for (list<RegionView*>::const_iterator i = rs.begin(); i != rs.end(); ++i) {
+
+ boost::shared_ptr<Region> r = (*i)->region ();
+ boost::shared_ptr<AudioRegion> ar = boost::dynamic_pointer_cast<AudioRegion> (r);
+
+ if (ar) {
+ have_audio = true;
+ if (ar->n_channels() > 1) {
+ have_multichannel_audio = true;
+ }
+ }
+
+ if (boost::dynamic_pointer_cast<MidiRegion> (r)) {
+ have_midi = true;
+ }
+
+ if (r->is_compound()) {
+ have_compound_regions = true;
+ }
+
+ if (r->locked()) {
+ have_locked = true;
+ } else {
+ have_unlocked = true;
+ }
+
+ if (r->video_locked()) {
+ have_video_locked = true;
+ } else {
+ have_video_unlocked = true;
+ }
+
+ if (r->position_lock_style() == MusicTime) {
+ have_position_lock_style_music = true;
+ } else {
+ have_position_lock_style_audio = true;
+ }
+
+ if (r->muted()) {
+ have_muted = true;
+ } else {
+ have_unmuted = true;
+ }
+
+ if (r->opaque()) {
+ have_opaque = true;
+ } else {
+ have_non_opaque = true;
+ }
+
+ if (!r->at_natural_position()) {
+ have_not_at_natural_position = true;
+ }
+
+ if (ar) {
+ if (ar->envelope_active()) {
+ have_envelope_active = true;
+ } else {
+ have_envelope_inactive = true;
+ }
+
+ if (ar->scale_amplitude() != 1) {
+ have_non_unity_scale_amplitude = true;
+ }