예제 #1
0
InputDeviceFeatureSet RevolverTool::getSourceFeatures(const InputDeviceFeature& forwardedFeature)
	{
	/* Paranoia: Check if the forwarded feature is on the transformed device: */
	if(forwardedFeature.getDevice()!=transformedDevice)
		Misc::throwStdErr("RevolverTool::getSourceFeatures: Forwarded feature is not on transformed device");
	
	/* Create an empty feature set: */
	InputDeviceFeatureSet result;
	
	if(forwardedFeature.isButton())
		{
		/* Find the source button slot index: */
		int buttonSlotIndex=forwardedFeature.getIndex()/factory->numChambers+1;
		
		/* Add the button slot's feature to the result set: */
		result.push_back(input.getButtonSlotFeature(buttonSlotIndex));
		}
	
	if(forwardedFeature.isValuator())
		{
		/* Find the source valuator slot index: */
		int valuatorSlotIndex=forwardedFeature.getIndex()/factory->numChambers;
		
		/* Add the valuator slot's feature to the result set: */
		result.push_back(input.getValuatorSlotFeature(valuatorSlotIndex));
		}
	
	return result;
	}
예제 #2
0
std::string InputDeviceManager::getFeatureName(const InputDeviceFeature& feature) const
	{
	/* Find the input device adapter owning the given device: */
	const InputDeviceAdapter* adapter=0;
	for(int i=0;adapter==0&&i<numInputDeviceAdapters;++i)
		{
		/* Search through all input devices: */
		for(int j=0;j<inputDeviceAdapters[i]->getNumInputDevices();++j)
			if(inputDeviceAdapters[i]->getInputDevice(j)==feature.getDevice())
				{
				adapter=inputDeviceAdapters[i];
				break;
				}
		}
	
	if(adapter!=0)
		{
		/* Return the feature name defined by the input device adapter: */
		return adapter->getFeatureName(feature);
		}
	else
		{
		/* Return a default feature name: */
		return InputDeviceAdapter::getDefaultFeatureName(feature);
		}
	}
예제 #3
0
std::string InputDeviceAdapterPlayback::getFeatureName(const InputDeviceFeature& feature) const
	{
	/* Find the input device owning the given feature: */
	int featureBaseIndex=-1;
	for(int deviceIndex=0;deviceIndex<numInputDevices;++deviceIndex)
		{
		if(inputDevices[deviceIndex]==feature.getDevice())
			{
			featureBaseIndex=deviceFeatureBaseIndices[deviceIndex];
			break;
			}
		}
	if(featureBaseIndex<0)
		Misc::throwStdErr("InputDeviceAdapterPlayback::getFeatureName: Unknown device %s",feature.getDevice()->getDeviceName());
	
	/* Return the feature name: */
	return deviceFeatureNames[featureBaseIndex+feature.getFeatureIndex()];
	}
InputDeviceFeatureSet WandNavigationTool::getSourceFeatures(const InputDeviceFeature& forwardedFeature)
	{
	/* Paranoia: Check if the forwarded feature is on the transformed device: */
	if(forwardedFeature.getDevice()!=buttonDevice)
		Misc::throwStdErr("WandNavigationTool::getSourceFeatures: Forwarded feature is not on transformed device");
	
	/* Return the source feature: */
	InputDeviceFeatureSet result;
	result.push_back(input.getButtonSlotFeature(1));
	return result;
	}
예제 #5
0
InputDeviceFeatureSet ScrollTool::getSourceFeatures(const InputDeviceFeature& forwardedFeature)
	{
	/* Paranoia: Check if the forwarded feature is on the transformed device: */
	if(forwardedFeature.getDevice()!=valuatorDevice)
		Misc::throwStdErr("ScrollTool::getSourceFeatures: Forwarded feature is not on transformed device");
	
	/* Return the source feature: */
	InputDeviceFeatureSet result;
	result.push_back(input.getValuatorSlotFeature(0));
	return result;
	}
예제 #6
0
InputDeviceFeatureSet ValuatorToButtonTool::getSourceFeatures(const InputDeviceFeature& forwardedFeature)
	{
	/* Paranoia: Check if the forwarded feature is on the transformed device: */
	if(forwardedFeature.getDevice()!=transformedDevice)
		Misc::throwStdErr("ValuatorToButtonTool::getSourceFeatures: Forwarded feature is not on transformed device");
	
	/* Return the valuator slot feeding the forwarded button slot: */
	InputDeviceFeatureSet result;
	result.push_back(input.getValuatorSlotFeature(forwardedFeature.getIndex()/2));
	
	return result;
	}
InputDeviceFeatureSet ButtonToValuatorTool::getSourceFeatures(const InputDeviceFeature& forwardedFeature)
	{
	/* Paranoia: Check if the forwarded feature is on the transformed device: */
	if(forwardedFeature.getDevice()!=transformedDevice)
		Misc::throwStdErr("ButtonToValuatorTool::getSourceFeatures: Forwarded feature is not on transformed device");
	
	/* The source features are all button slots: */
	InputDeviceFeatureSet result;
	for(int i=0;i<input.getNumButtonSlots();++i)
		result.push_back(input.getButtonSlotFeature(i));
	
	return result;
	}
std::string InputDeviceAdapterTrackd::getFeatureName(const InputDeviceFeature& feature) const
	{
	/* Find the input device owning the given feature: */
	bool deviceFound=false;
	int buttonIndexBase=0;
	int valuatorIndexBase=0;
	for(int deviceIndex=0;deviceIndex<numInputDevices;++deviceIndex)
		{
		if(inputDevices[deviceIndex]==feature.getDevice())
			{
			deviceFound=true;
			break;
			}
		
		/* Go to the next device: */
		buttonIndexBase+=inputDevices[deviceIndex]->getNumButtons();
		valuatorIndexBase+=inputDevices[deviceIndex]->getNumValuators();
		}
	if(!deviceFound)
		Misc::throwStdErr("InputDeviceAdapterTrackd::getFeatureName: Unknown device %s",feature.getDevice()->getDeviceName());
	
	/* Check whether the feature is a button or a valuator: */
	std::string result;
	if(feature.isButton())
		{
		/* Return the button feature's name: */
		result=buttonNames[buttonIndexBase+feature.getIndex()];
		}
	if(feature.isValuator())
		{
		/* Return the valuator feature's name: */
		result=valuatorNames[valuatorIndexBase+feature.getIndex()];
		}
	
	return result;
	}
예제 #9
0
InputDeviceFeatureSet TransformTool::getSourceFeatures(const InputDeviceFeature& forwardedFeature)
{
    /* Paranoia: Check if the forwarded feature is on the transformed device: */
    if(forwardedFeature.getDevice()!=transformedDevice)
        Misc::throwStdErr("TransformTool::getSourceFeatures: Forwarded feature is not on transformed device");

    /* Create an empty feature set: */
    InputDeviceFeatureSet result;

    if(forwardedFeature.isButton())
    {
        /* Add the slot's feature to the result set: */
        result.push_back(input.getButtonSlotFeature(forwardedFeature.getIndex()+numPrivateButtons));
    }

    if(forwardedFeature.isValuator())
    {
        /* Add the slot's feature to the result set: */
        result.push_back(input.getValuatorSlotFeature(forwardedFeature.getIndex()+numPrivateValuators));
    }

    return result;
}