mark loop button insensitive when there's no loop-range
authorRobin Gareus <robin@gareus.org>
Sat, 28 Jan 2017 11:04:31 +0000 (12:04 +0100)
committerRobin Gareus <robin@gareus.org>
Sat, 28 Jan 2017 11:05:50 +0000 (12:05 +0100)
gtk2_ardour/ardour_ui.h
gtk2_ardour/ardour_ui2.cc
gtk2_ardour/ardour_ui_dialogs.cc
gtk2_ardour/ardour_ui_options.cc

index 5ca28bf3734952934ecdd78c55ee140928f45c64..64423657b0aa27c1a15a06f089096a7b528030c2 100644 (file)
@@ -657,6 +657,7 @@ private:
        void edit_metadata ();
        void import_metadata ();
 
+       void set_loop_sensitivity ();
        void set_transport_sensitivity (bool);
 
        //stuff for ProTools-style numpad
index a5b1a93e93a9b121c5b82c641b68bf63b1a1d94a..c264c2c1c6fa2fa25fe1b6c4ab82abfd082046bd 100644 (file)
@@ -848,7 +848,15 @@ ARDOUR_UI::error_blink (bool onoff)
        }
 }
 
-
+void
+ARDOUR_UI::set_loop_sensitivity ()
+{
+       if (!_session || _session->config.get_external_sync()) {
+               auto_loop_button.set_sensitive (false);
+       } else {
+               auto_loop_button.set_sensitive (_session && _session->locations()->auto_loop_location());
+       }
+}
 
 void
 ARDOUR_UI::set_transport_sensitivity (bool yn)
index 6b206fed052732506e0815e7d3bc028e9b790882..561fac9c158c6b458e10eca69b39640e9ab73690 100644 (file)
@@ -170,6 +170,7 @@ ARDOUR_UI::set_session (Session *s)
        _session->locations()->added.connect (_session_connections, MISSING_INVALIDATOR, boost::bind (&ARDOUR_UI::handle_locations_change, this, _1), gui_context());
        _session->locations()->removed.connect (_session_connections, MISSING_INVALIDATOR, boost::bind (&ARDOUR_UI::handle_locations_change, this, _1), gui_context());
        _session->config.ParameterChanged.connect (_session_connections, MISSING_INVALIDATOR, boost::bind (&ARDOUR_UI::session_parameter_changed, this, _1), gui_context ());
+       _session->auto_loop_location_changed.connect (_session_connections, MISSING_INVALIDATOR, boost::bind (&ARDOUR_UI::set_loop_sensitivity, this), gui_context ());
 
        /* Clocks are on by default after we are connected to a session, so show that here.
        */
index 1c475df2052e03fce31b3206a33ad52fbcb6d6b8..5205354881110c9da9951fbbe5c2a269a83f0c89 100644 (file)
@@ -353,7 +353,6 @@ ARDOUR_UI::parameter_changed (std::string p)
 
                if (!_session->config.get_external_sync()) {
                        sync_button.set_text (S_("SyncSource|Int."));
-                       auto_loop_button.set_sensitive (true);
                        ActionManager::get_action ("Transport", "ToggleAutoPlay")->set_sensitive (true);
                        ActionManager::get_action ("Transport", "ToggleAutoReturn")->set_sensitive (true);
                        ActionManager::get_action ("Transport", "ToggleFollowEdits")->set_sensitive (true);
@@ -365,12 +364,12 @@ ARDOUR_UI::parameter_changed (std::string p)
                                // but makes it clear to the user that it's disabled.
                                _session->request_play_loop (false, false);
                        }
-                       auto_loop_button.set_sensitive (false);
                        /* XXX we need to make sure that auto-play is off as well as insensitive */
                        ActionManager::get_action ("Transport", "ToggleAutoPlay")->set_sensitive (false);
                        ActionManager::get_action ("Transport", "ToggleAutoReturn")->set_sensitive (false);
                        ActionManager::get_action ("Transport", "ToggleFollowEdits")->set_sensitive (false);
                }
+               set_loop_sensitivity ();
 
        } else if (p == "follow-edits") {