Fix mantis bug #1619; de-selecting Options->Crossfades->Show now hides all crossfades, and likewise selecting it shows all crossfades.

git-svn-id: svn://localhost/ardour2/trunk@1733 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2007-04-20 13:41:15 +00:00
parent c46cb59f8d
commit 003c9d6f5e
4 changed files with 37 additions and 1 deletions

View 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)
{

View 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);

View 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")) {

View 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 ();
}
}
}
}