X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;ds=inline;f=source%2Finputhub.cpp;fp=source%2Finputhub.cpp;h=0000000000000000000000000000000000000000;hb=999ca92aa9ee10585c0b2094d84364159253982f;hp=1fa95d0fc3f41a3dfbf5c75b7636881dd4e1239e;hpb=9049aa855a08bb8fdb36f6c7f51658f105d4d474;p=libs%2Fgui.git diff --git a/source/inputhub.cpp b/source/inputhub.cpp deleted file mode 100644 index 1fa95d0..0000000 --- a/source/inputhub.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* $Id$ - -This file is part of libmspgbase -Copyright © 2007 Mikko Rasa, Mikkosoft Productions -Distributed under the LGPL -*/ - -#include -#include -#include "inputhub.h" - -namespace Msp { -namespace Input { - -Hub::Hub() -{ - name="Hub"; -} - -unsigned Hub::attach(Device &dev) -{ - unsigned index=devices.size(); - devices.push_back(&dev); - dev.signal_button_press.connect(sigc::bind(sigc::mem_fun(this, &Hub::button_press), index)); - dev.signal_button_release.connect(sigc::bind(sigc::mem_fun(this, &Hub::button_release), index)); - dev.signal_axis_motion.connect(sigc::bind(sigc::mem_fun(this, &Hub::axis_motion), index)); - return index; -} - -std::string Hub::get_button_name(unsigned btn) const -{ - unsigned dev_index=btn>>12; - if(dev_index>devices.size()) - throw InvalidParameterValue("Button does not exist"); - - const Device &dev=*devices[dev_index]; - return dev.get_name()+": "+dev.get_button_name(btn&0xFFF); -} - -void Hub::button_press(unsigned btn, unsigned index) -{ - set_button_state(index<<12 | btn&0xFFF, true, true); -} - -void Hub::button_release(unsigned btn, unsigned index) -{ - set_button_state(index<<12 | btn&0xFFF, false, true); -} - -void Hub::axis_motion(unsigned axis, float value, float, unsigned index) -{ - set_axis_value(index<<12 | axis&0xFFF, value, true); -} - -} // namespace Input -} // namespace Msp