summaryrefslogtreecommitdiff
path: root/gtk2_ardour/actions.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2014-12-22 13:39:41 -0500
committerPaul Davis <paul@linuxaudiosystems.com>2014-12-22 13:39:46 -0500
commit64fa63212f7e79bab16147817211a33a3f7c8fba (patch)
tree54721a2dbd50611e7e5047e818ddfab2b67309dc /gtk2_ardour/actions.cc
parent795c5c16f17867bb55b724abfe99bc9200184305 (diff)
move all (G)UI related configuration parameters into UIConfiguration, not RCConfiguration
Diffstat (limited to 'gtk2_ardour/actions.cc')
-rw-r--r--gtk2_ardour/actions.cc49
1 files changed, 49 insertions, 0 deletions
diff --git a/gtk2_ardour/actions.cc b/gtk2_ardour/actions.cc
index f208c6c8d3..43d2eb83c9 100644
--- a/gtk2_ardour/actions.cc
+++ b/gtk2_ardour/actions.cc
@@ -36,6 +36,7 @@
#include "gtkmm2ext/actions.h"
+#include "ardour_ui.h"
#include "actions.h"
#include "i18n.h"
@@ -122,6 +123,31 @@ ActionManager::toggle_config_state (const char* group, const char* action, bool
}
}
+/** 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 (UIConfiguration::*set)(bool), bool (UIConfiguration::*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 = (ARDOUR_UI::config()->*get)();
+
+ if (x != tact->get_active()) {
+ (ARDOUR_UI::config()->*set) (!x);
+ }
+ }
+ }
+}
+
void
ActionManager::toggle_config_state_foo (const char* group, const char* action, sigc::slot<bool, bool> set, sigc::slot<bool> get)
{
@@ -164,6 +190,29 @@ ActionManager::map_some_state (const char* group, const char* action, bool (RCCo
}
}
+/** 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 (UIConfiguration::*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 = (ARDOUR_UI::config()->*get)();
+
+ if (tact->get_active() != x) {
+ tact->set_active (x);
+ }
+ }
+ }
+}
+
void
ActionManager::map_some_state (const char* group, const char* action, sigc::slot<bool> get)
{