diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2006-09-29 21:39:39 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2006-09-29 21:39:39 +0000 |
commit | 09ee5d9967328c1fabd4aca7766f9613acd8ee5e (patch) | |
tree | a64a893aa4184475d9799d76daaefd60b8e88eb1 /gtk2_ardour/actions.cc | |
parent | 7adf76bbe61435dcd6859895f4cadd4feb797f18 (diff) |
many important changes to configuration system and specific parameters
git-svn-id: svn://localhost/ardour2/trunk@935 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/actions.cc')
-rw-r--r-- | gtk2_ardour/actions.cc | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/gtk2_ardour/actions.cc b/gtk2_ardour/actions.cc index b2408620a5..8aa8ed0cbb 100644 --- a/gtk2_ardour/actions.cc +++ b/gtk2_ardour/actions.cc @@ -40,6 +40,7 @@ using namespace Gtk; using namespace Glib; using namespace sigc; using namespace PBD; +using namespace ARDOUR; vector<RefPtr<Gtk::Action> > ActionManager::session_sensitive_actions; vector<RefPtr<Gtk::Action> > ActionManager::region_list_selection_sensitive_actions; @@ -283,3 +284,57 @@ ActionManager::uncheck_toggleaction (const char * name) delete [] group_name; } +void +ActionManager::toggle_config_state (const char* group, const char* action, bool (Configuration::*set)(bool), bool (Configuration::*get)(void) const) +{ + Glib::RefPtr<Action> act = ActionManager::get_action (group, action); + if (act) { + Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act); + + if (tact) { + bool x = (Config->*get)(); + + cerr << "\ttoggle config, action = " << tact->get_active() << " config = " << x << endl; + + if (x != tact->get_active()) { + (Config->*set) (!x); + } + } + } +} + +void +ActionManager::toggle_config_state (const char* group, const char* action, sigc::slot<void> theSlot) +{ + 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 (); + } + } +} + +void +ActionManager::map_some_state (const char* group, const char* action, bool (Configuration::*get)() const) +{ + Glib::RefPtr<Action> act = ActionManager::get_action (group, action); + if (act) { + Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act); + + if (tact) { + + bool x = (Config->*get)(); + + cerr << "\tmap state, action = " << tact->get_active() << " config = " << x << endl; + + if (tact->get_active() != x) { + tact->set_active (x); + } + } else { + cerr << "not a toggle\n"; + } + } else { + cerr << group << ':' << action << " not an action\n"; + } +} |