Tidy up region gain line drawing slightly so that it doesn't overhang its region...
[ardour.git] / gtk2_ardour / ardour_ui_options.cc
index 7b91410e15e2ee5a50854ff1c7a397d50747314f..92454c32538f8eab2fde01b747765eed26abf5f9 100644 (file)
@@ -436,13 +436,85 @@ ARDOUR_UI::toggle_punch ()
 void
 ARDOUR_UI::toggle_punch_in ()
 {
-       ActionManager::toggle_config_state ("Transport", "TogglePunchIn", &Configuration::set_punch_in, &Configuration::get_punch_in);
+       Glib::RefPtr<Action> act = ActionManager::get_action (X_("Transport"), X_("TogglePunchIn"));
+       if (!act) {
+               return;
+       }
+
+       Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
+       if (!tact) {
+               return;
+       }
+
+       if (tact->get_active() != Config->get_punch_in()) {
+               Config->set_punch_in (tact->get_active ());
+       }
+
+       if (tact->get_active()) {
+               /* if punch-in is turned on, make sure the loop/punch ruler is visible, and stop it being hidden,
+                  to avoid confusing the user */
+               show_loop_punch_ruler_and_disallow_hide ();
+       }
+
+       reenable_hide_loop_punch_ruler_if_appropriate ();
 }
 
 void
 ARDOUR_UI::toggle_punch_out ()
 {
-       ActionManager::toggle_config_state ("Transport", "TogglePunchOut", &Configuration::set_punch_out, &Configuration::get_punch_out);
+       Glib::RefPtr<Action> act = ActionManager::get_action (X_("Transport"), X_("TogglePunchOut"));
+       if (!act) {
+               return;
+       }
+
+       Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
+       if (!tact) {
+               return;
+       }
+
+       if (tact->get_active() != Config->get_punch_out()) {
+               Config->set_punch_out (tact->get_active ());
+       }
+
+       if (tact->get_active()) {
+               /* if punch-out is turned on, make sure the loop/punch ruler is visible, and stop it being hidden,
+                  to avoid confusing the user */
+               show_loop_punch_ruler_and_disallow_hide ();
+       }
+       reenable_hide_loop_punch_ruler_if_appropriate ();
+}
+
+void
+ARDOUR_UI::show_loop_punch_ruler_and_disallow_hide ()
+{
+       Glib::RefPtr<Action> act = ActionManager::get_action (X_("Rulers"), "toggle-loop-punch-ruler");
+       if (!act) {
+               return;
+       }
+
+       act->set_sensitive (false);
+       
+       Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
+       if (!tact) {
+               return;
+       }
+       
+       if (!tact->get_active()) {
+               tact->set_active ();
+       }
+}
+
+/* This is a bit of a silly name for a method */
+void
+ARDOUR_UI::reenable_hide_loop_punch_ruler_if_appropriate ()
+{
+       if (!Config->get_punch_in() && !Config->get_punch_out()) {
+               /* if punch in/out are now both off, reallow hiding of the loop/punch ruler */
+               Glib::RefPtr<Action> act = ActionManager::get_action (X_("Rulers"), "toggle-loop-punch-ruler");
+               if (act) {
+                       act->set_sensitive (true);
+               }
+       }
 }
 
 void
@@ -469,6 +541,12 @@ ARDOUR_UI::toggle_editing_space()
        }
 }
 
+void
+ARDOUR_UI::toggle_new_plugins_active ()
+{
+       ActionManager::toggle_config_state ("options", "NewPluginsActive", &Configuration::set_new_plugins_active, &Configuration::get_new_plugins_active);
+}
+
 void
 ARDOUR_UI::toggle_StopPluginsWithTransport()
 {
@@ -547,6 +625,12 @@ ARDOUR_UI::toggle_ShowSoloMutes()
        ActionManager::toggle_config_state ("options", "ShowSoloMutes", &Configuration::set_show_solo_mutes, &Configuration::get_show_solo_mutes);
 }
 
+void
+ARDOUR_UI::toggle_SoloMuteOverride()
+{
+       ActionManager::toggle_config_state ("options", "SoloMuteOverride", &Configuration::set_solo_mute_override, &Configuration::get_solo_mute_override);
+}
+
 void
 ARDOUR_UI::toggle_PrimaryClockDeltaEditCursor()
 {
@@ -577,6 +661,12 @@ ARDOUR_UI::toggle_use_narrow_ms()
        ActionManager::toggle_config_state ("options", "DefaultNarrowMS", &Configuration::set_default_narrow_ms, &Configuration::get_default_narrow_ms);
 }
 
+void
+ARDOUR_UI::toggle_NameNewMarkers()
+{
+       ActionManager::toggle_config_state ("options", "NameNewMarkers", &Configuration::set_name_new_markers, &Configuration::get_name_new_markers);
+}
+
 void
 ARDOUR_UI::toggle_rubberbanding_snaps_to_grid ()
 {
@@ -1093,6 +1183,8 @@ ARDOUR_UI::parameter_changed (const char* parameter_name)
                ActionManager::map_some_state ("options", "LatchedSolo", &Configuration::get_solo_latched);
        } else if (PARAM_IS ("show-solo-mutes")) {
                ActionManager::map_some_state ("options", "ShowSoloMutes", &Configuration::get_show_solo_mutes);
+       } else if (PARAM_IS ("solo-mute-override")) {
+               ActionManager::map_some_state ("options", "SoloMuteOverride", &Configuration::get_solo_mute_override);
        } else if (PARAM_IS ("solo-model")) {
                map_solo_model ();
        } else if (PARAM_IS ("auto-play")) {
@@ -1119,6 +1211,8 @@ ARDOUR_UI::parameter_changed (const char* parameter_name)
                ActionManager::map_some_state ("Transport",  "ToggleTimeMaster", &Configuration::get_jack_time_master);
        } else if (PARAM_IS ("plugins-stop-with-transport")) {
                ActionManager::map_some_state ("options",  "StopPluginsWithTransport", &Configuration::get_plugins_stop_with_transport);
+       } else if (PARAM_IS ("new-plugins-active")) {
+               ActionManager::map_some_state ("options",  "NewPluginsActive", &Configuration::get_new_plugins_active);
        } else if (PARAM_IS ("latched-record-enable")) {
                ActionManager::map_some_state ("options", "LatchedRecordEnable", &Configuration::get_latched_record_enable);
        } else if (PARAM_IS ("verify-remove-last-capture")) {