]> git.tdb.fi Git - libs/gui.git/blobdiff - source/input/control.cpp
Fix a stray header name
[libs/gui.git] / source / input / control.cpp
index 6ff80883f8d39d8df19892b9fd2cf114aac7cc4a..eee0f1523e98256604ca4e0213669134a555c4d1 100644 (file)
@@ -1,4 +1,3 @@
-#include <msp/core/except.h>
 #include <msp/strings/lexicalcast.h>
 #include "control.h"
 #include "device.h"
@@ -52,7 +51,7 @@ Control::Control(Device &d, ControlSrcType t, unsigned i):
 void Control::capture(Device &d)
 {
        notify_callbacks();
-       capture_dev=&d;
+       capture_dev = &d;
        capture_dev->signal_button_press.connect(sigc::mem_fun(this, &Control::button_press));
        capture_dev->signal_axis_motion.connect(sigc::mem_fun(this, &Control::axis_motion));
 }
@@ -60,7 +59,7 @@ void Control::capture(Device &d)
 void Control::cancel_capture()
 {
        notify_callbacks();
-       capture_dev=0;
+       capture_dev = 0;
        connect_signals();
 }
 
@@ -72,7 +71,7 @@ void Control::set_source(Device &d, ControlSrcType t, unsigned i)
 void Control::set_source(const ControlSource &s)
 {
        notify_callbacks();
-       src=s;
+       src = s;
        connect_signals();
 }
 
@@ -90,8 +89,6 @@ void Control::connect_signals()
        case AXIS_NEG:
                src.dev->signal_axis_motion.connect(sigc::mem_fun(this, &Control::axis_motion));
                break;
-       default:
-               throw Exception("Invalid source in Control");
        }
 }
 
@@ -99,12 +96,12 @@ void Control::button_press(unsigned i)
 {
        if(capture_dev)
        {
-               src.dev=capture_dev;
-               src.type=BUTTON;
-               src.index=i;
+               src.dev = capture_dev;
+               src.type = BUTTON;
+               src.index = i;
 
                notify_callbacks();
-               capture_dev=0;
+               capture_dev = 0;
                connect_signals();
                signal_capture_complete.emit();
        }
@@ -122,20 +119,20 @@ void Control::axis_motion(unsigned i, float v, float r)
 {
        if(capture_dev)
        {
-               ControlSrcType type=NONE;
+               ControlSrcType type = NONE;
                if(v<-0.9)
-                       type=AXIS_NEG;
+                       type = AXIS_NEG;
                else if(v>0.9)
-                       type=AXIS_POS;
+                       type = AXIS_POS;
 
                if(type!=NONE)
                {
-                       src.dev=capture_dev;
-                       src.type=type;
-                       src.index=i;
+                       src.dev = capture_dev;
+                       src.type = type;
+                       src.index = i;
 
                        notify_callbacks();
-                       capture_dev=0;
+                       capture_dev = 0;
                        connect_signals();
                        signal_capture_complete.emit();
                }