diff options
author | Carl Hetherington <carl@carlh.net> | 2009-05-14 00:13:27 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2009-05-14 00:13:27 +0000 |
commit | 015fc7b39fab97cee1875231694adce43155ceb5 (patch) | |
tree | 76dded18cc9441e7325af999358ab3a3235cdb1e /gtk2_ardour/actions.cc | |
parent | 0569107ddc0d2a8df6ca0a2c8cc16ebe8f3dee99 (diff) |
First stage of options rework.
- Split Configuration into RCConfiguration and SessionConfiguration;
the first for options which are saved to .rc files and the second
for options which are saved in a session file.
- Move some options from the old `master' Configuration object into
SessionConfiguration; this needs more refinement.
- Reflect many RCConfiguration options in an expanded Edit->Preferences
dialog; my intention is to remove the corresponding menu items
eventually.
git-svn-id: svn://localhost/ardour2/branches/3.0@5075 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/actions.cc')
-rw-r--r-- | gtk2_ardour/actions.cc | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/gtk2_ardour/actions.cc b/gtk2_ardour/actions.cc index 9059ba2776..74daa23a9a 100644 --- a/gtk2_ardour/actions.cc +++ b/gtk2_ardour/actions.cc @@ -34,6 +34,7 @@ #include "ardour/ardour.h" #include "ardour/filesystem_paths.h" +#include "ardour/rc_configuration.h" #include "actions.h" #include "i18n.h" @@ -359,7 +360,7 @@ ActionManager::uncheck_toggleaction (const char * name) * @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) +ActionManager::toggle_config_state (const char* group, const char* action, bool (RCConfiguration::*set)(bool), bool (RCConfiguration::*get)(void) const) { Glib::RefPtr<Action> act = ActionManager::get_action (group, action); if (act) { @@ -376,13 +377,16 @@ ActionManager::toggle_config_state (const char* group, const char* action, bool } void -ActionManager::toggle_config_state (const char* group, const char* action, sigc::slot<void> theSlot) +ActionManager::toggle_config_state_foo (const char* group, const char* action, sigc::slot<bool, bool> set, sigc::slot<bool> get) { Glib::RefPtr<Action> act = ActionManager::get_action (group, action); if (act) { Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act); if (tact->get_active()) { - theSlot (); + bool const x = get (); + if (x != tact->get_active ()) { + set (x); + } } } } @@ -394,7 +398,7 @@ ActionManager::toggle_config_state (const char* group, const char* action, sigc: * @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) +ActionManager::map_some_state (const char* group, const char* action, bool (RCConfiguration::*get)() const) { Glib::RefPtr<Action> act = ActionManager::get_action (group, action); if (act) { @@ -414,3 +418,21 @@ ActionManager::map_some_state (const char* group, const char* action, bool (Conf cerr << group << ':' << action << " not an action\n"; } } + +void +ActionManager::map_some_state (const char* group, const char* action, sigc::slot<bool> get) +{ + Glib::RefPtr<Action> act = ActionManager::get_action (group, action); + if (act) { + Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act); + + if (tact) { + + bool const x = get (); + + if (tact->get_active() != x) { + tact->set_active (x); + } + } + } +} |