enough with umpteen "i18n.h" files. Consolidate on pbd/i18n.h
[ardour.git] / libs / gtkmm2ext / binding_proxy.cc
index c56ab8598246e96115b0ae20a25a575d9089a0da..5ba5f7eba4fde87fb873333cf3e426dff1a948fb 100644 (file)
 
 #include <gtkmm2ext/binding_proxy.h>
 
-#include "i18n.h"
+#include "pbd/i18n.h"
 
 using namespace Gtkmm2ext;
 using namespace std;
 using namespace PBD;
 
+guint BindingProxy::bind_button = 2;
+guint BindingProxy::bind_statemask = Gdk::CONTROL_MASK;
+
 BindingProxy::BindingProxy (boost::shared_ptr<Controllable> c)
        : prompter (0),
-         controllable (c),
-         bind_button (2),
-         bind_statemask (Gdk::CONTROL_MASK)
-
-{                        
+         controllable (c)
+{
 }
 
 BindingProxy::BindingProxy ()
-       : prompter (0),
-         bind_button (2),
-         bind_statemask (Gdk::CONTROL_MASK)
-
-{                        
+       : prompter (0)
+{
 }
 
 BindingProxy::~BindingProxy ()
@@ -69,17 +66,17 @@ BindingProxy::set_bind_button_state (guint button, guint statemask)
        bind_statemask = statemask;
 }
 
-void
-BindingProxy::get_bind_button_state (guint &button, guint &statemask)
+bool
+BindingProxy::is_bind_action (GdkEventButton *ev)
 {
-       button = bind_button;
-       statemask = bind_statemask;
+       return ( (ev->state & bind_statemask) && ev->button == bind_button );
 }
 
+
 bool
 BindingProxy::button_press_handler (GdkEventButton *ev)
 {
-       if (controllable && (ev->state & bind_statemask) && ev->button == bind_button) { 
+       if ( controllable && is_bind_action(ev) ) {
                if (Controllable::StartLearning (controllable.get())) {
                        string prompt = _("operate controller now");
                        if (prompter == 0) {
@@ -92,7 +89,7 @@ BindingProxy::button_press_handler (GdkEventButton *ev)
                }
                return true;
        }
-       
+
        return false;
 }