3 This file is part of libmspgbase
4 Copyright © 2007 Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
8 #include "smoothcontrol.h"
13 SmoothControl::SmoothControl():
18 SmoothControl::SmoothControl(const ControlSource &s):
24 SmoothControl::SmoothControl(Device &d, ControlSrcType t, unsigned i):
30 SmoothControl &SmoothControl::operator=(const SmoothControl &sc)
32 Control::operator=(sc);
37 SmoothControl::~SmoothControl()
42 void SmoothControl::pair(SmoothControl *ctrl)
49 SmoothControl *old_pair=paired_ctrl;
57 paired_ctrl->pair(this);
60 void SmoothControl::on_press()
62 on_motion(1, 1-value);
65 void SmoothControl::on_release()
71 void SmoothControl::on_motion(float v, float)
74 signal_motion.emit(value);
76 if(paired_ctrl && paired_ctrl->get_value()!=-value)
77 paired_ctrl->on_motion(-value, -value-paired_ctrl->get_value());