- Timestamp:
- 2006-08-15T17:55:31+02:00 (18 years ago)
- Location:
- src/org/openstreetmap/josm
- Files:
-
- 1 deleted
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/org/openstreetmap/josm/actions/GroupAction.java
r101 r135 3 3 import java.awt.event.ActionEvent; 4 4 import java.awt.event.ActionListener; 5 import java.awt.event.KeyEvent; 5 6 import java.beans.PropertyChangeEvent; 6 7 import java.beans.PropertyChangeListener; … … 8 9 import java.util.List; 9 10 11 import javax.swing.AbstractAction; 10 12 import javax.swing.Action; 11 13 import javax.swing.Icon; … … 30 32 private PropertyChangeListener forwardActiveListener = new PropertyChangeListener(){ 31 33 public void propertyChange(PropertyChangeEvent evt) { 32 if (evt.getPropertyName().equals("active")) {34 if (evt.getPropertyName().equals("active")) 33 35 putValue("active", evt.getNewValue()); 34 if (evt.getNewValue() == Boolean.FALSE)35 cycle = false;36 }37 36 } 38 37 }; 39 public boolean cycle;40 38 41 39 protected void setCurrent(int current) { … … 53 51 String idName = getClass().getName(); 54 52 Main.contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(shortCut, modifiers), idName); 55 53 Main.contentPane.getActionMap().put(idName, this); 56 54 shortCutName = ShortCutLabel.name(shortCut, modifiers); 57 addPropertyChangeListener(new PropertyChangeListener(){ 58 public void propertyChange(PropertyChangeEvent evt) { 59 if (evt.getPropertyName().equals("active") && evt.getNewValue() == Boolean.FALSE) 60 cycle = false; 61 } 55 Main.contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(shortCut, KeyEvent.SHIFT_DOWN_MASK), idName+".cycle"); 56 Main.contentPane.getActionMap().put(idName+".cycle", new AbstractAction(){ 57 public void actionPerformed(ActionEvent e) { 58 setCurrent((current+1)%actions.size()); 59 actions.get(current).actionPerformed(e); 60 } 62 61 }); 63 62 } … … 68 67 b.setSelected(!b.isSelected()); 69 68 openPopup(b); 70 } else { 71 if (cycle) 72 setCurrent((current+1)%actions.size()); 73 else 74 cycle = true; 69 } else 75 70 actions.get(current).actionPerformed(e); 76 }77 71 } 78 72 -
src/org/openstreetmap/josm/gui/MapMover.java
r102 r135 32 32 } 33 33 public void actionPerformed(ActionEvent e) { 34 if (action.equals("+") || action.equals("-")) { 34 System.out.println("e="+e.toString()+" action="+e.getActionCommand()); 35 if (action.equals(".") || action.equals(",")) { 35 36 Point mouse = nc.getMousePosition(); 36 37 if (mouse == null) 37 38 mouse = new Point((int)nc.getBounds().getCenterX(), (int)nc.getBounds().getCenterY()); 38 MouseWheelEvent we = new MouseWheelEvent(nc, e.getID(), e.getWhen(), e.getModifiers(), mouse.x, mouse.y, 0, false, MouseWheelEvent.WHEEL_UNIT_SCROLL, 1, action.equals(" +") ? -1 : 1);39 MouseWheelEvent we = new MouseWheelEvent(nc, e.getID(), e.getWhen(), e.getModifiers(), mouse.x, mouse.y, 0, false, MouseWheelEvent.WHEEL_UNIT_SCROLL, 1, action.equals(",") ? -1 : 1); 39 40 mouseWheelMoved(we); 40 41 } else { … … 78 79 nc.addMouseWheelListener(this); 79 80 80 String[] n = {" +","-","up","right","down","left"};81 int[] k = {KeyEvent.VK_ PLUS, KeyEvent.VK_MINUS, KeyEvent.VK_UP, KeyEvent.VK_RIGHT, KeyEvent.VK_DOWN, KeyEvent.VK_LEFT};81 String[] n = {",",".","up","right","down","left"}; 82 int[] k = {KeyEvent.VK_COMMA, KeyEvent.VK_PERIOD, KeyEvent.VK_UP, KeyEvent.VK_RIGHT, KeyEvent.VK_DOWN, KeyEvent.VK_LEFT}; 82 83 83 84 for (int i = 0; i < n.length; ++i) {
Note:
See TracChangeset
for help on using the changeset viewer.