fix region action sensitivity issues.
authorPaul Davis <paul@linuxaudiosystems.com>
Fri, 8 Jul 2016 12:43:52 +0000 (08:43 -0400)
committerPaul Davis <paul@linuxaudiosystems.com>
Fri, 8 Jul 2016 12:44:21 +0000 (08:44 -0400)
Desensitize all region actions initially, and toggle that state
appropriately when region selection changes

gtk2_ardour/editor_actions.cc
gtk2_ardour/editor_selection.cc

index c5ad6205680b3cefa098a4a40ad710f5ef422daa..1bfad8c7b3080f624221cb1653a729b6332100d8 100644 (file)
@@ -2049,6 +2049,6 @@ Editor::register_region_actions ()
        reg_sens (_region_actions, "choose-top-region", _("Choose Top..."), sigc::bind (sigc::mem_fun (*this, &Editor::change_region_layering_order), false));
        reg_sens (_region_actions, "choose-top-region-context-menu", _("Choose Top..."), sigc::bind (sigc::mem_fun (*this, &Editor::change_region_layering_order), true));
 
-       _all_region_actions_sensitized = true;
-
+       /* desensitize them all by default. region selection will change this */
+       sensitize_all_region_actions (false);
 }
index 639e87a848023b565fdafa3942e60ec00cfa0b79..ea6c40f1b29a7a8a3bf9bb96a42fd0db55e2c142 100644 (file)
@@ -1088,7 +1088,6 @@ Editor::sensitize_all_region_actions (bool s)
 void
 Editor::sensitize_the_right_region_actions ()
 {
-
        RegionSelection rs = get_regions_from_selection_and_entered ();
        sensitize_all_region_actions (!rs.empty ());
 
@@ -1373,11 +1372,15 @@ Editor::region_selection_changed ()
        _regions->block_change_connection (false);
        editor_regions_selection_changed_connection.block(false);
 
-       if (!_all_region_actions_sensitized) {
-               /* This selection change might have changed what region actions
-                  are allowed, so sensitize them all in case a key is pressed.
-               */
-               sensitize_all_region_actions (true);
+       if (selection->regions.empty()) {
+               sensitize_all_region_actions (false);
+       } else {
+               if (!_all_region_actions_sensitized) {
+                       /* This selection change might have changed what region actions
+                          are allowed, so sensitize them all in case a key is pressed.
+                       */
+                       sensitize_all_region_actions (true);
+               }
        }
 
        if (_session && !_session->transport_rolling() && !selection->regions.empty()) {