+ void set_mode_value(const synfig::String & value)
+ {
+ InputDevice::Mode mode;
+ if (value == "screen")
+ mode = InputDevice::MODE_SCREEN;
+ else if (value == "window")
+ mode = InputDevice::MODE_WINDOW;
+ else
+ mode = InputDevice::MODE_DISABLED;
+
+ input_device->set_mode(mode);
+ }
+
+ void set_axes_value(const synfig::String & value)
+ {
+ std::vector<InputDevice::AxisUse> axes;
+
+ unsigned pos = value.find(' ', 0);
+ if (pos < value.size()) {
+ int num_axes = atoi(value.substr(0, pos).c_str());
+ axes.resize(num_axes);
+
+ for (int axis = 0; axis < num_axes; axis++) {
+ int last = pos;
+ pos = value.find(' ', pos + 1);
+ axes[axis] = InputDevice::AxisUse(atoi(value.substr(last, pos).c_str()));
+ }
+ }
+
+ input_device->set_axes(axes);
+ }
+
+ void set_keys_value(const synfig::String & value)
+ {
+ std::vector<InputDevice::DeviceKey> keys;
+
+ unsigned pos = value.find(' ', 0);
+ if (pos < value.size()) {
+ int num_keys = atoi(value.substr(0, pos).c_str());
+ keys.resize(num_keys);
+
+ for (int key = 0; key < num_keys; key++) {
+ int last = pos;
+ pos = value.find(' ', pos + 1);
+ keys[key].keyval = (unsigned int) atol(value.substr(last, pos).c_str());
+ last = pos;
+ pos = value.find(' ', pos + 1);
+ keys[key].modifiers = (unsigned int) atol(value.substr(last, pos).c_str());
+ }
+ }
+
+ input_device->set_keys(keys);
+ }
+