Fix mantis bug #1619; de-selecting Options->Crossfades->Show now hides all crossfades...
authorCarl Hetherington <carl@carlh.net>
Fri, 20 Apr 2007 13:41:15 +0000 (13:41 +0000)
committerCarl Hetherington <carl@carlh.net>
Fri, 20 Apr 2007 13:41:15 +0000 (13:41 +0000)
git-svn-id: svn://localhost/ardour2/trunk@1733 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/actions.cc
gtk2_ardour/editor.h
gtk2_ardour/editor_actions.cc
gtk2_ardour/editor_ops.cc

index 6e4a525ba7a3f425e6d885f8c326d7af3825abbe..40af880f9cc902591f26c292400708b7a38327f2 100644 (file)
@@ -256,6 +256,13 @@ ActionManager::uncheck_toggleaction (const char * name)
        delete [] group_name;
 }
 
+/** Examine the state of a Configuration setting and a toggle action, and toggle the Configuration
+ * setting if its state doesn't match the toggle action.
+ * @param group Action group.
+ * @param action Action name.
+ * @param Method to set the state of the Configuration setting.
+ * @param Method to get the state of the Configuration setting.
+ */
 void
 ActionManager::toggle_config_state (const char* group, const char* action, bool (Configuration::*set)(bool), bool (Configuration::*get)(void) const)
 {
@@ -285,6 +292,12 @@ ActionManager::toggle_config_state (const char* group, const char* action, sigc:
        }
 }
 
+
+/** Set the state of a ToggleAction using a particular Configuration get() method
+ * @param group Action group.
+ * @param action Action name.
+ * @param get Method to obtain the state that the ToggleAction should have.
+ */
 void
 ActionManager::map_some_state (const char* group, const char* action, bool (Configuration::*get)() const)
 {
index 10880c7b1b285a384093184c4af54ce79e12d720..ae7201dbbd9de502eccf472e0863e16541521ab1 100644 (file)
@@ -305,6 +305,7 @@ class Editor : public PublicEditor
        void toggle_xfades_active ();
        void toggle_xfade_visibility ();
        bool xfade_visibility() const { return _xfade_visibility; }
+       void update_xfade_visibility ();
        void update_crossfade_model ();
        void set_crossfade_model (ARDOUR::CrossfadeModel);
 
index 4ce9be20bd9f2766926e8a56110eb6c5f1bcf1f4..3525910250113f973a123dcae067253ec41add13 100644 (file)
@@ -1065,9 +1065,12 @@ Editor::toggle_xfades_active ()
 void
 Editor::toggle_xfade_visibility ()
 {
-       ActionManager::toggle_config_state ("Editor", "toggle-xfades-visibility", &Configuration::set_xfades_visible, &Configuration::get_xfades_visible);
+       ActionManager::toggle_config_state ("Editor", "toggle-xfades-visible", &Configuration::set_xfades_visible, &Configuration::get_xfades_visible);
 }
 
+/** A Configuration parameter has changed.
+ * @param parameter_name Name of the changed parameter.
+ */
 void
 Editor::parameter_changed (const char* parameter_name)
 {
@@ -1092,6 +1095,7 @@ Editor::parameter_changed (const char* parameter_name)
                ActionManager::map_some_state ("Editor", "toggle-xfades-active", &Configuration::get_xfades_active);
        } else if (PARAM_IS ("xfades-visible")) {
                ActionManager::map_some_state ("Editor", "toggle-xfades-visible", &Configuration::get_xfades_visible);
+               update_xfade_visibility ();
        } else if (PARAM_IS ("auto-xfade")) {
                ActionManager::map_some_state ("Editor", "toggle-auto-xfades", &Configuration::get_auto_xfade);
        } else if (PARAM_IS ("xfade-model")) {
index 9c972d1fa75eb317f8b9d16c9428f3ff833d4305..2267c150bf14afaf6e8589679fb0712c2ce33cca 100644 (file)
@@ -3542,3 +3542,21 @@ Editor::set_fade_out_active (bool yn)
        }
 }
 
+
+/** Update crossfade visibility after its configuration has been changed */
+void
+Editor::update_xfade_visibility ()
+{
+       _xfade_visibility = Config->get_xfades_visible ();
+       
+       for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
+               AudioTimeAxisView* v = dynamic_cast<AudioTimeAxisView*>(*i);
+               if (v) {
+                       if (_xfade_visibility) {
+                               v->show_all_xfades ();
+                       } else {
+                               v->hide_all_xfades ();
+                       }
+               }
+       }
+}