Changeset 977 for trunk/src/org/expeditee
- Timestamp:
- 12/08/15 11:22:31 (9 years ago)
- Location:
- trunk/src/org/expeditee
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/gui/DisplayIO.java
r927 r977 177 177 .getFloatMouseX(), FrameMouseActions.MouseY, isShiftDown, 178 178 isCtrlDown); 179 180 if(isCtrlDown || DisplayIO.getFloatMouseX() + 1 >= newMouse.x && DisplayIO.getFloatMouseX() <= newMouse.x) { 179 180 if(isCtrlDown 181 || (DisplayIO.getFloatMouseX() + 1 >= newMouse.x && DisplayIO.getFloatMouseX() <= newMouse.x) 182 || (DisplayIO.getFloatMouseX() > newMouse.x && cursorMovement == Text.RIGHT)) { 181 183 if(cursorMovement == Text.RIGHT && !MagneticConstraints.getInstance().rightBorderHit(text)) { 182 184 MagneticConstraints.getInstance().endOfLineHit(text); -
trunk/src/org/expeditee/gui/FrameKeyboardActions.java
r949 r977 249 249 250 250 public synchronized void keyTyped(KeyEvent e) { 251 252 251 if (Simple.isProgramRunning()) { 253 252 if (e.isControlDown() -
trunk/src/org/expeditee/gui/FrameUtils.java
r919 r977 1198 1198 if (possibles.size() == 1) 1199 1199 return possibles.get(0); 1200 1200 1201 1201 // return closest x,y pair to mouse 1202 1202 Item closest = possibles.get(0); -
trunk/src/org/expeditee/items/Item.java
r954 r977 1157 1157 public void setTooltips(final List<String> tooltips) { 1158 1158 if(tooltips == null || tooltips.size() == 0) _tooltip = new Tooltip(); 1159 else for(final String content: tooltips) _tooltip.addTooltip(content );1159 else for(final String content: tooltips) _tooltip.addTooltip(content, this); 1160 1160 } 1161 1161 1162 1162 public void setTooltip(final String tooltip) { 1163 1163 if(tooltip != null && tooltip.trim().length() > 0) { 1164 _tooltip.addTooltip(tooltip );1164 _tooltip.addTooltip(tooltip, this); 1165 1165 } 1166 1166 } … … 1170 1170 } 1171 1171 1172 public List<Text> getTooltipItems() {1172 public Collection<Text> getTooltipItems() { 1173 1173 return _tooltip.getTooltips(); 1174 1174 } -
trunk/src/org/expeditee/items/MagneticConstraint/Actions/LastItemAction.java
r967 r977 2 2 3 3 import org.expeditee.gui.DisplayIO; 4 import org.expeditee.gui.FrameGraphics; 4 5 import org.expeditee.gui.FrameUtils; 5 6 import org.expeditee.items.Item; … … 17 18 final int idTop = item.getMagnetizedItemTop(); 18 19 if(idLeft != -1) { 19 moveCursor(item.getParent().getItemWithID(idLeft) );20 moveCursor(item.getParent().getItemWithID(idLeft), item); 20 21 // 21 22 // System.err.println("#Current item " + FrameUtils.getCurrentItem()); … … 27 28 return true; 28 29 } else if (idTop != -1) { 29 moveCursor(item.getParent().getItemWithID(idTop) );30 moveCursor(item.getParent().getItemWithID(idTop), item); 30 31 MagneticConstraints.Log(this.getClass(), new Item[]{item, item.getParent().getItemWithID(idTop)}, 31 32 Line.getLineContainingToken(item).toArray(new Item[]{}), … … 35 36 } 36 37 37 private boolean moveCursor(final Item toMoveTo ) {38 private boolean moveCursor(final Item toMoveTo, Item toMoveFrom) { 38 39 if(toMoveTo == null) return false; 39 40 if(toMoveTo instanceof Text) { 40 41 //System.err.println("Last item requests move to item with text: " + toMoveTo.getText()); 41 42 // final Text asText = (Text) toMoveTo; 42 // final Point position = toMoveTo.getPosition();43 // final java.awt.Point position = toMoveTo.getPosition(); 43 44 // DisplayIO.setCursorPosition(position.x + asText.getPixelBoundsUnion().width, position.y, false); 44 45 // FrameGraphics.refresh(false); 45 46 DisplayIO.setTextCursor((Text)toMoveTo, Text.END); 47 if(FrameUtils.getCurrentItem() != toMoveTo) { 48 Line.getLineFromToken(toMoveFrom).deltaX(1); 49 moveCursor(toMoveTo, toMoveFrom); 50 } 46 51 } else DisplayIO.setCursorPosition(toMoveTo.getPosition(), false); 47 52 return true; -
trunk/src/org/expeditee/items/Tooltip.java
r952 r977 1 1 package org.expeditee.items; 2 2 3 import java.util.*; 3 import java.util.Collection; 4 import java.util.HashMap; 5 import java.util.LinkedList; 6 import java.util.List; 7 import java.util.Map; 4 8 5 9 import org.expeditee.settings.templates.TemplateSettings; … … 7 11 public class Tooltip { 8 12 9 private List<Text> tooltipItems = new LinkedList<Text>();13 Tooltip() { } 10 14 11 public Text addTooltip(String content) { 15 private Map<Text, Item> tooltipItems = new HashMap<Text, Item>(); 16 17 public Text addTooltip(String content, final Item toItem) { 12 18 if(content.trim().toLowerCase().startsWith("text") && content.contains(":")) 13 19 content = content.substring(content.indexOf(':') + 1); 14 // final Text tooltip = new Text(content);15 20 final Text tooltip = TemplateSettings.TooltipTemplate.get().copy(); 16 21 tooltip.setText(content); 17 // return addTooltip((Text) tooltip.getParentOrCurrentFrame().getTooltipTextItem(content)); 18 return addTooltip(tooltip); 22 return addTooltip(tooltip, toItem); 19 23 } 20 24 21 public Text addTooltip(final Text tooltip ) {22 tooltipItems. add(tooltip);25 public Text addTooltip(final Text tooltip, final Item toItem) { 26 tooltipItems.put(tooltip, toItem); 23 27 return tooltip; 24 28 } 25 29 26 public List<Text> getTooltips() { return tooltipItems; }30 public Collection<Text> getTooltips() { return tooltipItems.keySet(); } 27 31 28 32 public List<String> asStringList() { 29 33 final List<String> ret = new LinkedList<String>(); 30 for(final Text tooltip: tooltipItems ) ret.add(tooltip.getText());34 for(final Text tooltip: tooltipItems.keySet()) ret.add(tooltip.getText()); 31 35 return ret; 32 36 } … … 34 38 public int getWidth() { 35 39 int max = 0; 36 for(final Text tooltip: tooltipItems) if(tooltip.getBoundsWidth() > max) max = tooltip.getBoundsWidth(); 40 for(final Text tooltip: tooltipItems.keySet()) 41 if(tooltip.getBoundsWidth() > max) max = tooltip.getBoundsWidth(); 37 42 return max; 38 43 } … … 40 45 public int getHeight() { 41 46 int max = 0; 42 for(final Text tooltip: tooltipItems) if(tooltip.getBoundsWidth() > max) max = tooltip.getBoundsHeight(); 47 for(final Text tooltip: tooltipItems.keySet()) 48 if(tooltip.getBoundsWidth() > max) max = tooltip.getBoundsHeight(); 43 49 return max; 44 50 } … … 46 52 public int getCollectiveHeight() { 47 53 int height = 0; 48 for(final Text tooltip: tooltipItems ) height += tooltip.getBoundsHeight();54 for(final Text tooltip: tooltipItems.keySet()) height += tooltip.getBoundsHeight(); 49 55 return height; 50 56 }
Note:
See TracChangeset
for help on using the changeset viewer.