From 09ee5d9967328c1fabd4aca7766f9613acd8ee5e Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Fri, 29 Sep 2006 21:39:39 +0000 Subject: many important changes to configuration system and specific parameters git-svn-id: svn://localhost/ardour2/trunk@935 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/actions.cc | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) (limited to 'gtk2_ardour/actions.cc') 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 > ActionManager::session_sensitive_actions; vector > 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 act = ActionManager::get_action (group, action); + if (act) { + Glib::RefPtr tact = Glib::RefPtr::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 theSlot) +{ + Glib::RefPtr act = ActionManager::get_action (group, action); + if (act) { + Glib::RefPtr tact = Glib::RefPtr::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 act = ActionManager::get_action (group, action); + if (act) { + Glib::RefPtr tact = Glib::RefPtr::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"; + } +} -- cgit v1.2.3