Example #1
0
 @Override
 protected void mouseClicked(int x, int y, int button) {
   ControlsBasicItem item = model.getEditingItem();
   if (item != null && item.useMouseButtons()) {
     item.setModifiers(SimpleKeyBindingManager.getPressedModifiers());
     item.setKey(SimpleKeyBindingManager.MOUSE_OFFSET + button);
     model.finishEdit();
   }
 }
Example #2
0
 public void deleteCurrentControl() {
   SimpleKeyBindingManager man =
       (SimpleKeyBindingManager) SpoutClient.getInstance().getKeyBindingManager();
   ControlsBasicItem item = model.getItem(view.getSelectedRow());
   ShortcutBindingItem sh = null;
   if (item != null && item instanceof ShortcutBindingItem) {
     sh = (ShortcutBindingItem) item;
   }
   KeyBindingItem binding = null;
   if (item != null && item instanceof KeyBindingItem) {
     binding = (KeyBindingItem) item;
   }
   if (sh != null) {
     man.unregisterShortcut(sh.getShortcut());
     man.save();
   } else if (binding != null) {
     man.unregisterControl(binding.getBinding());
     man.save();
     model.refresh();
   } else {
     item.setKey(-128);
   }
   model.refresh();
 }
Example #3
0
 protected void keyTyped(char c, int i, boolean pressed) {
   ControlsBasicItem item = model.getEditingItem();
   if (item != null) {
     if (item.useModifiers() && (!SimpleKeyBindingManager.isModifierKey(i) && pressed)
         || (SimpleKeyBindingManager.isModifierKey(i) && !pressed)) {
       item.setModifiers(SimpleKeyBindingManager.getPressedModifiers());
       item.setKey(i);
       model.finishEdit();
     } else if (!item.useModifiers()) {
       item.setKey(i);
       model.finishEdit();
     }
   }
 }
 public boolean conflicts(ControlsBasicItem other) {
   // TODO better handling for modifiers
   return getKey() == other.getKey() && getModifiers() == other.getModifiers();
 }