Changeset 943 for trunk/src/org/expeditee/gui/FrameKeyboardActions.java
- Timestamp:
- 12/16/14 15:03:11 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/gui/FrameKeyboardActions.java
r941 r943 37 37 import org.expeditee.actions.Navigation; 38 38 import org.expeditee.actions.Simple; 39 import org.expeditee.gui.indirect.keyboard.IndirectKeyboardActions; 40 import org.expeditee.gui.indirect.keyboard.KeyboardAction; 41 import org.expeditee.gui.indirect.keyboard.KeyboardAction.KeyboardInfo; 39 42 import org.expeditee.io.ItemSelection; 40 43 import org.expeditee.items.Circle; … … 60 63 61 64 protected FrameKeyboardActions() { 65 IndirectKeyboardActions.getInstance().setDropDownAction(new KeyboardAction() { 66 @Override 67 public void exec(KeyboardInfo info) { 68 // Get the last text item and drop from in 69 Item lastText = null; 70 for (Item i : info.enclosed) { 71 if (i instanceof Text) { 72 lastText = i; 73 } 74 } 75 // Drop from the item if there was a text item in the box 76 if (lastText != null) { 77 Drop(lastText, false); 78 } else { 79 // Move to the top of the box 80 Rectangle rect = info.firstConnected.getEnclosedShape() 81 .getBounds(); 82 int newX = rect.x + Text.MARGIN_LEFT; 83 int newY = Text.MARGIN_LEFT 84 + rect.y 85 + DisplayIO.getCurrentFrame().getItemTemplate() 86 .getBoundsHeight(); 87 moveCursorAndFreeItems(newX, newY); 88 // TODO can resetOffset be put inside 89 // moveCursorAndFreeItems 90 FrameMouseActions.resetOffset(); 91 } 92 } 93 }); 94 IndirectKeyboardActions.getInstance().setSizeUpAction(new KeyboardAction() { 95 @Override 96 public void exec(final KeyboardInfo info) { 97 SetSize(info.firstConnected, info.repeat, false, true, info.isControlDown); 98 } 99 }); 100 IndirectKeyboardActions.getInstance().setSizeDownAction(new KeyboardAction() { 101 @Override 102 public void exec(final KeyboardInfo info) { 103 SetSize(info.firstConnected, -info.repeat, false, true, info.isControlDown); 104 } 105 }); 106 IndirectKeyboardActions.getInstance().setChangeColorAction(new KeyboardAction() { 107 @Override 108 public void exec(final KeyboardInfo info) { 109 if (info.connected.size() > 0) { 110 for (Item d : info.lineEnds) { 111 if (info.isControlDown) 112 SetGradientColor(d, info.isShiftDown); 113 else 114 SetFillColor(d, info.isShiftDown); 115 break; 116 } 117 } 118 } 119 }); 62 120 } 63 121 … … 987 1045 switch (key) { 988 1046 case DropDown: 989 // Get the last text item and drop from in 990 Item lastText = null; 991 for (Item i : enclosed) { 992 if (i instanceof Text) { 993 lastText = i; 994 } 995 } 996 // Drop from the item if there was a text item in the box 997 if (lastText != null) { 998 Drop(lastText, false); 999 } else { 1000 // Move to the top of the box 1001 Rectangle rect = firstConnected.getEnclosedShape() 1002 .getBounds(); 1003 int newX = rect.x + Text.MARGIN_LEFT; 1004 int newY = Text.MARGIN_LEFT 1005 + rect.y 1006 + DisplayIO.getCurrentFrame().getItemTemplate() 1007 .getBoundsHeight(); 1008 moveCursorAndFreeItems(newX, newY); 1009 // TODO can resetOffset be put inside 1010 // moveCursorAndFreeItems 1011 FrameMouseActions.resetOffset(); 1012 } 1047 IndirectKeyboardActions.getInstance().getDropDownAction().exec( 1048 new KeyboardInfo(key, repeat, isShiftDown, isControlDown, enclosed, firstConnected, connected, lineEnds)); 1013 1049 break; 1014 1050 case SizeUp: 1015 SetSize(firstConnected, repeat, false, true, isControlDown); 1051 IndirectKeyboardActions.getInstance().getSizeUpAction().exec( 1052 new KeyboardInfo(key, repeat, isShiftDown, isControlDown, enclosed, firstConnected, connected, lineEnds)); 1016 1053 break; 1017 1054 case SizeDown: 1018 SetSize(firstConnected, -repeat, false, true, isControlDown); 1055 IndirectKeyboardActions.getInstance().getSizeDownAction().exec( 1056 new KeyboardInfo(key, repeat, isShiftDown, isControlDown, enclosed, firstConnected, connected, lineEnds)); 1019 1057 break; 1020 1058 case ChangeColor: 1021 if (connected.size() > 0) { 1022 for (Item d : lineEnds) { 1023 if (isControlDown) 1024 SetGradientColor(d, isShiftDown); 1025 else 1026 SetFillColor(d, isShiftDown); 1027 break; 1028 } 1029 } 1059 IndirectKeyboardActions.getInstance().getChangeColorAction().exec( 1060 new KeyboardInfo(key, repeat, isShiftDown, isControlDown, enclosed, firstConnected, connected, lineEnds)); 1030 1061 break; 1031 1062 case ToggleAnnotation:
Note:
See TracChangeset
for help on using the changeset viewer.