16
16
* along with this program. If not, see <http://www.gnu.org/licenses/>.
20
#include "common/mathfuncs.h"
21
#include "common/assertion.h"
22
#include "gl/drawables.h"
19
24
#include "select.h"
27
SelectionDevice::SelectionDevice(const Filter *p) : target(p)
31
void SelectionDevice::addBinding(SelectionBinding b)
33
bindingVec.push_back(b);
36
bool SelectionDevice::getBinding(const DrawableObj *d,unsigned int mouseFlags,
37
unsigned int keyFlags,SelectionBinding* &b)
40
unsigned int keyMask=0;
45
for(unsigned int ui=0;ui<bindingVec.size();ui++)
47
if(bindingVec[ui].matchesDrawable(d,mouseFlags,keyFlags))
54
keyMask=b->getKeyFlags();
58
//OK, we already have one, but we can be "trumped"
59
//by a more complex keymask.
60
if( (keyMask & bindingVec[ui].getKeyFlags() )== keyMask)
63
keyMask=b->getKeyFlags();
69
//This selection device does not match
70
//the targeted object.
74
void SelectionDevice::getModifiedBindings(vector<std::pair<const Filter *,SelectionBinding> > &bindings)
77
for(unsigned int ui=0;ui<bindingVec.size();ui++)
79
if(bindingVec[ui].modified())
80
bindings.push_back(std::make_pair(target,bindingVec[ui]));
84
bool SelectionDevice::getAvailBindings(const DrawableObj *d,vector<const SelectionBinding*> &b) const
87
for(unsigned int ui=0;ui<bindingVec.size();ui++)
89
if(bindingVec[ui].matchesDrawable(d))
90
b.push_back(&(bindingVec[ui]));
22
98
SelectionBinding::SelectionBinding()