# Changeset 1023 in josm for trunk/src/org/openstreetmap/josm

Ignore:
Timestamp:
2008-10-05T17:06:27+02:00 (11 years ago)
Message:

close bug #1622. Keyboard shortcuts and specific OS handling

Location:
trunk/src/org/openstreetmap/josm
Files:
72 edited

Unmodified
Removed

• ## trunk/src/org/openstreetmap/josm/actions/AlignInCircleAction.java

 r749 import org.openstreetmap.josm.data.osm.OsmPrimitive; import org.openstreetmap.josm.data.osm.Way; import org.openstreetmap.josm.tools.ShortCut; /** public AlignInCircleAction() { super(tr("Align Nodes in Circle"), "aligncircle", tr("Move the selected nodes into a circle."), KeyEvent.VK_O, 0, true); super(tr("Align Nodes in Circle"), "aligncircle", tr("Move the selected nodes into a circle."), ShortCut.registerShortCut("tools:aligncircle", tr("Tool: Align in circle"), KeyEvent.VK_O, ShortCut.GROUP_EDIT), true); } nodes.add((Node)osm); // special case if no single nodes are selected and exactly one way is: // special case if no single nodes are selected and exactly one way is: // then use the way's nodes if ((nodes.size() == 0) && (sel.size() == 1)) // Now calculate the average distance to each node from the // centre.  This method is ok as long as distances are short // centre.  This method is ok as long as distances are short // relative to the distance from the N or S poles. double distances[] = new double[nodes.size()];
• ## trunk/src/org/openstreetmap/josm/actions/AlignInLineAction.java

 r627 import org.openstreetmap.josm.data.osm.OsmPrimitive; import org.openstreetmap.josm.data.osm.Way; import org.openstreetmap.josm.tools.ShortCut; /** * roads that should be straight, but have side roads and * therefore need multiple nodes) * * * @author Matthew Newton */ public AlignInLineAction() { super(tr("Align Nodes in Line"), "alignline", tr("Move the selected nodes onto a line."), KeyEvent.VK_L, 0, true); super(tr("Align Nodes in Line"), "alignline", tr("Move the selected nodes onto a line."), ShortCut.registerShortCut("tools:alignline", tr("Tool: Align in line"), KeyEvent.VK_L, ShortCut.GROUP_EDIT), true); } itnodes.add((Node)osm); } // special case if no single nodes are selected and exactly one way is: // special case if no single nodes are selected and exactly one way is: // then use the way's nodes if ((nodes.size() == 0) && (sel.size() == 1))
• ## trunk/src/org/openstreetmap/josm/actions/AlignInRectangleAction.java

 r999 import org.openstreetmap.josm.data.osm.OsmPrimitive; import org.openstreetmap.josm.data.osm.Way; import org.openstreetmap.josm.tools.ShortCut; /** * Aligns all selected nodes within a rectangle. * * Aligns all selected nodes within a rectangle. * * There are many ways this could be done, for example: * - find smallest rectangle to contain all points (rectangular hull) OR * - find largest rectangle to fit inside OR * - find both and compute the average * * * Also, it would be possible to let the user specify more input, e.g. * two nodes that should remain where they are. * * * This method uses the following algorithm: * 1. compute "heading" of all four edges public AlignInRectangleAction() { super(tr("Align Nodes in Rectangle"), "alignrect", tr("Move the selected nodes into a rectangle."), KeyEvent.VK_Q, 0, true); super(tr("Align Nodes in Rectangle"), "alignrect", tr("Move the selected nodes into a rectangle."), ShortCut.registerShortCut("tools:alignrect", tr("Tool: Align in rectangle"), KeyEvent.VK_Q, ShortCut.GROUP_EDIT), true); } Collection sel = Main.ds.getSelected(); Way myWay = null; if (sel.size() == 1) if (sel.size() == 1) for (OsmPrimitive osm : sel) if (osm instanceof Way) myWay = (Way) osm; if ((myWay == null) || (myWay.nodes.size() != 5) || (!myWay.nodes.get(0).equals(myWay.nodes.get(4)))) { JOptionPane.showMessageDialog(Main.parent, tr("Please select one circular way of exactly four nodes.")); } avg_angle /= 4; // select edge that is closest to average, and use it as the base for the following double best_dist = 0; double best_dist = 0; int base = 0; for (int i=0; i<4; i++) EastNorth next = en[(base+2)%4]; // node following the second node of the base seg EastNorth prev= en[(base+3)%4];  // node before the first node of the base seg // find a parallel to the base segment double base_slope = (end.north() - begin.north()) / (end.east() - begin.east()); u = ((prev.east()-begin.east())*(end.east()-begin.east()) + (prev.north()-begin.north())*(end.north()-begin.north()))/end.distanceSq(begin); EastNorth begin2 = new EastNorth(begin.east()+u*(end.east()-begin.east()), begin.north()+u*(end.north()-begin.north())); // new "begin" and "end" points are halfway between their old position and // new "begin" and "end" points are halfway between their old position and // the base points found above end = new EastNorth((end2.east()+end.east())/2, (end2.north()+end.north())/2); begin = new EastNorth((begin2.east()+begin.east())/2, (begin2.north()+begin.north())/2); double other_slope = -1 / base_slope; double next_b = end.north() - other_slope * end.east(); double prev_b = begin.north() - other_slope * begin.east(); double x = (opposite_b-next_b)/(other_slope-base_slope); double y = opposite_b + base_slope * x; next = new EastNorth(x, y); x = (opposite_b-prev_b)/(other_slope-base_slope); y = opposite_b + base_slope * x; prev = new EastNorth(x, y); Collection cmds = new LinkedList(); for (int i=0; i<4; i++) {
• ## trunk/src/org/openstreetmap/josm/actions/AutoScaleAction.java

 r948 import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor; import org.openstreetmap.josm.gui.layer.Layer; import org.openstreetmap.josm.tools.ShortCut; /** public AutoScaleAction(String mode) { super(tr("Zoom to {0}", tr(mode)), "dialogs/autoscale/" + mode, tr("Zoom the view to {0}.", tr(mode)), AutoScaleAction.getModeShortcut(mode), 0, true); ShortCut.registerShortCut("view:zoom"+mode, tr("View: Zoom to {0}", tr(mode)), getModeShortcut(mode), ShortCut.GROUP_EDIT), true); String modeHelp = Character.toUpperCase(mode.charAt(0)) + mode.substring(1); putValue("help", "Action/AutoScale/" + modeHelp); for (OsmPrimitive osm : sel) osm.visit(v); // increase bbox by 0.001 degrees on each side. this is required // especially if the bbox contains one single node, but helpful // increase bbox by 0.001 degrees on each side. this is required // especially if the bbox contains one single node, but helpful // in most other cases as well. v.enlargeBoundingBox();
• ## trunk/src/org/openstreetmap/josm/actions/CombineWayAction.java

 r734 import org.openstreetmap.josm.tools.GBC; import org.openstreetmap.josm.tools.Pair; import org.openstreetmap.josm.tools.ShortCut; /** * Combines multiple ways into one. * * * @author Imi */ public CombineWayAction() { super(tr("Combine Way"), "combineway", tr("Combine several ways into one."), KeyEvent.VK_C, 0, true); super(tr("Combine Way"), "combineway", tr("Combine several ways into one."), ShortCut.registerShortCut("tools:combineway", tr("Tool: Combine ways"), KeyEvent.VK_C, ShortCut.GROUP_EDIT), true); DataSet.selListeners.add(this); }
• ## trunk/src/org/openstreetmap/josm/actions/CopyAction.java

 r627 import org.openstreetmap.josm.data.osm.Way; import org.openstreetmap.josm.data.osm.visitor.Visitor; import org.openstreetmap.josm.tools.ShortCut; public final class CopyAction extends JosmAction implements SelectionChangedListener { private LinkedList listeners; public CopyAction() { super(tr("Copy"), "copy", tr("Copy selected objects to paste buffer."), KeyEvent.VK_C, KeyEvent.CTRL_MASK, true); ShortCut.registerShortCut("system:copy", tr("Edit: Copy"), KeyEvent.VK_C, ShortCut.GROUP_MENU), true); setEnabled(false); DataSet.selListeners.add(this); listeners.add(a); } public void actionPerformed(ActionEvent e) { Collection sel = Main.ds.getSelected(); if (sel.isEmpty()) { if (sel.isEmpty()) { JOptionPane.showMessageDialog(Main.parent, tr("Please select something to copy.")); tr("Please select something to copy.")); return; } /* temporarily maps old nodes to new so we can do a true deep copy */ /* scan the selected objects, mapping them to copies; when copying a way or relation, /* scan the selected objects, mapping them to copies; when copying a way or relation, * the copy references the copies of their child objects */ new Visitor(){ public void visit(Node n) { /* check if already in pasteBuffer - e.g. two ways are selected which share a node; * or a way and a node in that way is selected, we'll see it twice, once via the /* check if already in pasteBuffer - e.g. two ways are selected which share a node; * or a way and a node in that way is selected, we'll see it twice, once via the * way and once directly; and so on. */ if (map.containsKey(n)) { return; } Main.pasteBuffer = pasteBuffer; Main.main.menu.paste.setEnabled(true); /* now we have a paste buffer we can make paste available */ for(JosmAction a : listeners) { a.pasteBufferChanged(Main.pasteBuffer);
• ## trunk/src/org/openstreetmap/josm/actions/CreateCircleAction.java

 r999 import org.openstreetmap.josm.data.osm.OsmPrimitive; import org.openstreetmap.josm.data.osm.Way; import org.openstreetmap.josm.tools.ShortCut; /** * Create a new circle from three selected nodes--or a way with 3 nodes. (Useful for roundabouts) * * Note: If a way is selected, it is changed. If nodes are selected a new way is created. *       So if you've got a way with 3 nodes it makes a difference between running this on the way or the nodes! * * BTW: Someone might want to implement projection corrections for this... * public CreateCircleAction() { super(tr("Create Circle"), "createcircle", tr("Create a circle from three selected nodes."), KeyEvent.VK_O, KeyEvent.CTRL_MASK, true); super(tr("Create Circle"), "createcircle", tr("Create a circle from three selected nodes."), ShortCut.registerShortCut("tools:createcircle", tr("Tool: Create circle"), KeyEvent.VK_O, ShortCut.GROUP_EDIT), true); }
• ## trunk/src/org/openstreetmap/josm/actions/DeleteAction.java

 r770 import org.openstreetmap.josm.Main; import org.openstreetmap.josm.tools.ShortCut; public final class DeleteAction extends JosmAction { public DeleteAction() { super(tr("Delete"), "dialogs/delete", tr("Delete selected objects."), KeyEvent.VK_DELETE, 0, true); ShortCut.registerShortCut("system:delete", tr("Edit: Delete"), KeyEvent.VK_DELETE, ShortCut.GROUP_DIRECT), true); setEnabled(true); }
• ## trunk/src/org/openstreetmap/josm/actions/DiskAccessAction.java

 r693 import org.openstreetmap.josm.Main; import org.openstreetmap.josm.tools.ShortCut; /** abstract public class DiskAccessAction extends JosmAction { public DiskAccessAction(String name, String iconName, String tooltip, ShortCut shortCut) { super(name, iconName, tooltip, shortCut, true); } @Deprecated public DiskAccessAction(String name, String iconName, String tooltip, int shortCut, int modifiers) { super(name, iconName, tooltip, shortCut, modifiers, true); } protected static JFileChooser createAndOpenFileChooser(boolean open, boolean multiple, String title) { String curDir = Main.pref.get("lastDirectory"); fc.addChoosableFileFilter(ExtensionFileFilter.filters[i]); fc.setAcceptAllFileFilterUsed(true); int answer = open ? fc.showOpenDialog(Main.parent) : fc.showSaveDialog(Main.parent); if (answer != JFileChooser.APPROVE_OPTION) return null; if (!fc.getCurrentDirectory().getAbsolutePath().equals(curDir)) Main.pref.put("lastDirectory", fc.getCurrentDirectory().getAbsolutePath()); if (!open) { File file = fc.getSelectedFile(); if (file == null || (file.exists() && JOptionPane.YES_OPTION != if (file == null || (file.exists() && JOptionPane.YES_OPTION != JOptionPane.showConfirmDialog(Main.parent, tr("File exists. Overwrite?"), tr("Overwrite"), JOptionPane.YES_NO_OPTION))) return null; } return fc; }

• ## trunk/src/org/openstreetmap/josm/actions/DuplicateAction.java

 r655 import org.openstreetmap.josm.data.osm.DataSet; import org.openstreetmap.josm.data.osm.OsmPrimitive; import org.openstreetmap.josm.tools.ShortCut; public final class DuplicateAction extends JosmAction implements SelectionChangedListener { super(tr("Duplicate"), "duplicate", tr("Duplicate selection by copy and immediate paste."), KeyEvent.VK_D, KeyEvent.CTRL_MASK, true); ShortCut.registerShortCut("system:duplicate", tr("Edit: Duplicate selection"), KeyEvent.VK_D, ShortCut.GROUP_MENU), true); setEnabled(false); DataSet.selListeners.add(this); DataSet.selListeners.add(this); } Main.main.menu.paste.actionPerformed(e); } public void selectionChanged(Collection newSelection) { setEnabled(! newSelection.isEmpty());
• ## trunk/src/org/openstreetmap/josm/actions/ExitAction.java

 r655 import org.openstreetmap.josm.Main; import org.openstreetmap.josm.tools.ShortCut; /** * Exit the application. May ask for permission first (if something has changed). * * * @author imi */ */ public ExitAction() { super(tr("Exit"), "exit", tr("Exit the application."), KeyEvent.VK_Q, KeyEvent.CTRL_DOWN_MASK, true); super(tr("Exit"), "exit", tr("Exit the application."), ShortCut.registerShortCut("system:menuexit", tr("Quit JOSM"), KeyEvent.VK_Q, ShortCut.GROUP_MENU), true); }

• ## trunk/src/org/openstreetmap/josm/actions/HistoryInfoAction.java

 r999 import org.openstreetmap.josm.data.osm.visitor.Visitor; import org.openstreetmap.josm.tools.OpenBrowser; import org.openstreetmap.josm.tools.ShortCut; public class HistoryInfoAction extends JosmAction { public HistoryInfoAction() { super(tr("OSM History Information"), "about",tr("Display history information about OSM ways or nodes."), KeyEvent.VK_H, KeyEvent.SHIFT_DOWN_MASK, true); super(tr("OSM History Information"), "about",tr("Display history information about OSM ways or nodes."), ShortCut.registerShortCut("core:history", tr("Display history"), KeyEvent.VK_H, ShortCut.GROUP_HOTKEY), true); }
• ## trunk/src/org/openstreetmap/josm/actions/JoinNodeWayAction.java

 r627 import org.openstreetmap.josm.data.osm.Way; import org.openstreetmap.josm.data.osm.WaySegment; import org.openstreetmap.josm.tools.ShortCut; public class JoinNodeWayAction extends JosmAction { public JoinNodeWayAction() { super(tr("Join node to way"), "joinnodeway", tr("Join a node into the nearest way segments"), KeyEvent.VK_J, 0, true); super(tr("Join node to way"), "joinnodeway", tr("Join a node into the nearest way segments"), ShortCut.registerShortCut("tools:joinnodeway", tr("Tool: Join node to way"), KeyEvent.VK_J, ShortCut.GROUP_EDIT), true); }

• ## trunk/src/org/openstreetmap/josm/actions/MergeNodesAction.java

 r734 import org.openstreetmap.josm.tools.GBC; import org.openstreetmap.josm.tools.Pair; import org.openstreetmap.josm.tools.ShortCut; * Merge two or more nodes into one node. * (based on Combine ways) * * * @author Matthew Newton * public MergeNodesAction() { super(tr("Merge Nodes"), "mergenodes", tr("Merge nodes into one."), KeyEvent.VK_M, 0, true); super(tr("Merge Nodes"), "mergenodes", tr("Merge nodes into the oldest one."), ShortCut.registerShortCut("tools:mergenodes", tr("Tool: Merge nodes"), KeyEvent.VK_M, ShortCut.GROUP_EDIT), true); DataSet.selListeners.add(this); }
• ## trunk/src/org/openstreetmap/josm/actions/MoveAction.java

 r627 import org.openstreetmap.josm.data.osm.OsmPrimitive; import org.openstreetmap.josm.data.osm.visitor.AllNodesVisitor; import org.openstreetmap.josm.tools.ShortCut; /** * Moves the selection * * * @author Frederik Ramm */ public enum Direction { UP, LEFT, RIGHT, DOWN } private Direction myDirection; // any better idea? private static Object calltosupermustbefirststatementinconstructor(Direction dir, boolean text) { ShortCut sc; String directiontext; if        (dir == Direction.UP)   { directiontext = tr("up"); sc = ShortCut.registerShortCut("core:moveup",    tr("Move objects {0}", directiontext), KeyEvent.VK_UP,    ShortCut.GROUPS_ALT1+ShortCut.GROUP_DIRECT); } else if (dir == Direction.DOWN)  { directiontext = tr("down"); sc = ShortCut.registerShortCut("core:movedown",  tr("Move objects {0}", directiontext), KeyEvent.VK_DOWN,  ShortCut.GROUPS_ALT1+ShortCut.GROUP_DIRECT); } else if (dir == Direction.LEFT)  { directiontext = tr("left"); sc = ShortCut.registerShortCut("core:moveleft",  tr("Move objects {0}", directiontext), KeyEvent.VK_LEFT,  ShortCut.GROUPS_ALT1+ShortCut.GROUP_DIRECT); } else { //dir == Direction.RIGHT) { directiontext = tr("right"); sc = ShortCut.registerShortCut("core:moveright", tr("Move objects {0}", directiontext), KeyEvent.VK_RIGHT, ShortCut.GROUPS_ALT1+ShortCut.GROUP_DIRECT); } if (text) { return directiontext; } else { return sc; } } public MoveAction(Direction dir) { super(tr("Move"), null, tr("Moves Objects"), (dir == Direction.UP) ? KeyEvent.VK_UP : (dir == Direction.DOWN) ? KeyEvent.VK_DOWN : (dir == Direction.LEFT) ? KeyEvent.VK_LEFT : KeyEvent.VK_RIGHT, 0, true); super(tr("Move {0}", calltosupermustbefirststatementinconstructor(dir, true)), null, tr("Moves Objects {0}", calltosupermustbefirststatementinconstructor(dir, true)), (ShortCut)calltosupermustbefirststatementinconstructor(dir, false), true); myDirection = dir; } public void actionPerformed(ActionEvent event) { // find out how many "real" units the objects have to be moved in order to // achive an 1-pixel movement EastNorth en1 = Main.map.mapView.getEastNorth(100, 100); EastNorth en2 = Main.map.mapView.getEastNorth(101, 101); double distx = en2.east() - en1.east(); double disty = en2.north() - en1.north(); switch (myDirection) { case UP: case UP: distx = 0; disty = -disty; disty = 0; } Collection selection = Main.ds.getSelected(); Collection affectedNodes = AllNodesVisitor.getAllNodes(selection); Command c = !Main.main.undoRedo.commands.isEmpty() ? Main.main.undoRedo.commands.getLast() : null;
• ## trunk/src/org/openstreetmap/josm/actions/NewAction.java

 r627 import org.openstreetmap.josm.data.osm.DataSet; import org.openstreetmap.josm.gui.layer.OsmDataLayer; import org.openstreetmap.josm.tools.ShortCut; public class NewAction extends JosmAction { public NewAction() { super(tr("New"), "new", tr("Create a new map."), KeyEvent.VK_N, InputEvent.CTRL_DOWN_MASK, true); super(tr("New"), "new", tr("Create a new map."), ShortCut.registerShortCut("system:new", tr("File: New"), KeyEvent.VK_N, ShortCut.GROUP_MENU), true); }
• ## trunk/src/org/openstreetmap/josm/actions/OpenAction.java

 r737 import org.openstreetmap.josm.io.OsmReader; import org.xml.sax.SAXException; import org.openstreetmap.josm.tools.ShortCut; /** * Open a file chooser dialog and select an file to import. Then call the gpx-import * driver. Finally open an internal frame into the main window with the gpx data shown. * * * @author imi */ public class OpenAction extends DiskAccessAction { /** * Create an open action. The name is "Open a file". */ public OpenAction() { super(tr("Open ..."), "open", tr("Open a file."), KeyEvent.VK_O, InputEvent.CTRL_DOWN_MASK); super(tr("Open ..."), "open", tr("Open a file."), ShortCut.registerShortCut("system:open", tr("File: Open..."), KeyEvent.VK_O, ShortCut.GROUP_MENU)); }
• ## trunk/src/org/openstreetmap/josm/actions/PasteAction.java

 r999 import org.openstreetmap.josm.data.osm.Way; import org.openstreetmap.josm.data.coor.EastNorth; import org.openstreetmap.josm.tools.ShortCut; public final class PasteAction extends JosmAction { public PasteAction() { super(tr("Paste"), "paste", tr("Paste contents of paste buffer."), KeyEvent.VK_V, KeyEvent.CTRL_MASK, true); setEnabled(false); super(tr("Paste"), "paste", tr("Paste contents of paste buffer."), ShortCut.registerShortCut("system:paste", tr("Edit: Paste"), KeyEvent.VK_V, ShortCut.GROUP_MENU), true); setEnabled(false); } DataSet pasteBuffer = Main.pasteBuffer; /* Find the middle of the pasteBuffer area */ /* Find the middle of the pasteBuffer area */ double maxEast = -1E100, minEast = 1E100, maxNorth = -1E100, minNorth = 1E100; for (Node n : pasteBuffer.nodes) { double east = n.eastNorth.east(); double north = n.eastNorth.north(); if (east > maxEast) { maxEast = east; } if (east < minEast) { minEast = east; } if (north > maxNorth) { maxNorth = north; } if (north < minNorth) { minNorth = north; } if (east > maxEast) { maxEast = east; } if (east < minEast) { minEast = east; } if (north > maxNorth) { maxNorth = north; } if (north < minNorth) { minNorth = north; } } double offsetEast  = mPosition.east() - (maxEast + minEast)/2.0; double offsetNorth = mPosition.north() - (maxNorth + minNorth)/2.0; HashMap map = new HashMap(); HashMap map = new HashMap(); /* temporarily maps old nodes to new so we can do a true deep copy */ /* do the deep copy of the paste buffer contents, leaving the pasteBuffer unchanged */ for (Node n : pasteBuffer.nodes) { map.put(r, rnew); } /* Now execute the commands to add the dupicated contents of the paste buffer to the map */ Collection osms = map.values();
• ## trunk/src/org/openstreetmap/josm/actions/PasteTagsAction.java

 r750 import org.openstreetmap.josm.data.osm.DataSet; import org.openstreetmap.josm.data.osm.OsmPrimitive; import org.openstreetmap.josm.tools.ShortCut; public final class PasteTagsAction extends JosmAction implements SelectionChangedListener { super(tr("Paste Tags"), "pastetags", tr("Apply tags of contents of paste buffer to all selected items."), KeyEvent.VK_V, KeyEvent.CTRL_MASK | KeyEvent.SHIFT_MASK, true); ShortCut.registerShortCut("system:pastestyle", tr("Edit: Paste tags"), KeyEvent.VK_V, ShortCut.GROUP_MENU), true); DataSet.selListeners.add(this); copyAction.addListener(this);
• ## trunk/src/org/openstreetmap/josm/actions/PreferencesAction.java

 r1021 import org.openstreetmap.josm.gui.preferences.PreferenceDialog; import org.openstreetmap.josm.tools.GBC; import org.openstreetmap.josm.tools.ShortCut; /** */ public PreferencesAction() { super(tr("Preferences ..."), "preference", tr("Open a preferences page for global settings."), KeyEvent.VK_F12, 0, true); super(tr("Preferences ..."), "preference", tr("Open a preferences page for global settings."), ShortCut.registerShortCut("system:preferences", tr("Preferences"), KeyEvent.VK_F12, ShortCut.GROUP_DIRECT), true); }
• ## trunk/src/org/openstreetmap/josm/actions/RedoAction.java

 r655 import org.openstreetmap.josm.Main; import org.openstreetmap.josm.tools.ShortCut; /** * Redoes the last command. * * * @author imi */ */ public RedoAction() { super(tr("Redo"), "redo", tr("Redo the last undone action."), KeyEvent.VK_Y, InputEvent.CTRL_DOWN_MASK, true); super(tr("Redo"), "redo", tr("Redo the last undone action."), ShortCut.registerShortCut("system:redo", tr("Edit: Redo"), KeyEvent.VK_Y, ShortCut.GROUP_MENU), true); setEnabled(false); }
• ## trunk/src/org/openstreetmap/josm/actions/ReverseWayAction.java

 r1001 import org.openstreetmap.josm.data.osm.Way; import org.openstreetmap.josm.data.osm.visitor.Visitor; import org.openstreetmap.josm.tools.ShortCut; public final class ReverseWayAction extends JosmAction { public ReverseWayAction() { super(tr("Reverse ways"), "wayflip", tr("Reverse the direction of all selected ways."), KeyEvent.VK_R, 0, true); super(tr("Reverse ways"), "wayflip", tr("Reverse the direction of all selected ways."), ShortCut.registerShortCut("tools:reverse", tr("Tool: Reverse way"), KeyEvent.VK_R, ShortCut.GROUP_EDIT), true); }
• ## trunk/src/org/openstreetmap/josm/actions/SaveAction.java

 r693 import org.openstreetmap.josm.gui.layer.GpxLayer; import org.openstreetmap.josm.gui.layer.OsmDataLayer; import org.openstreetmap.josm.tools.ShortCut; /** * Export the data as an OSM xml file. * * * @author imi */ public class SaveAction extends SaveActionBase { /** * Construct the action with "Save" as label. */ public SaveAction(Layer layer) { super(tr("Save"), "save", tr("Save the current data."), KeyEvent.VK_S, InputEvent.CTRL_DOWN_MASK, layer); super(tr("Save"), "save", tr("Save the current data."), ShortCut.registerShortCut("system:save", tr("File: Save"), KeyEvent.VK_S, ShortCut.GROUP_MENU), layer); } @Override public File getFile(Layer layer) { if (layer instanceof OsmDataLayer) {
• ## trunk/src/org/openstreetmap/josm/actions/SaveActionBase.java

 r872 import org.openstreetmap.josm.io.OsmWriter; import org.openstreetmap.josm.io.GpxWriter; import org.openstreetmap.josm.tools.ShortCut; public abstract class SaveActionBase extends DiskAccessAction { private Layer layer; public SaveActionBase(String name, String iconName, String tooltip, ShortCut shortCut, Layer layer) { super(name, iconName, tooltip, shortCut); this.layer = layer; } @Deprecated public SaveActionBase(String name, String iconName, String tooltip, int shortCut, int modifiers, Layer layer) { super(name, iconName, tooltip, shortCut, modifiers); } if (!Main.map.conflictDialog.conflicts.isEmpty()) { int answer = JOptionPane.showConfirmDialog(Main.parent, int answer = JOptionPane.showConfirmDialog(Main.parent, tr("There are unresolved conflicts. Conflicts will not be saved and handled as if you rejected all. Continue?"),tr("Conflicts"), JOptionPane.YES_NO_OPTION); if (answer != JOptionPane.YES_OPTION) /** * Check the data set if it would be empty on save. It is empty, if it contains * no objects (after all objects that are created and deleted without being * no objects (after all objects that are created and deleted without being * transfered to the server have been removed). * * * @return true, if a save result in an empty data set. */
• ## trunk/src/org/openstreetmap/josm/actions/SaveAsAction.java

 r693 import org.openstreetmap.josm.gui.layer.Layer; import org.openstreetmap.josm.tools.ShortCut; /** * Export the data. * * * @author imi */ public class SaveAsAction extends SaveActionBase { /** * Construct the action with "Save" as label. */ public SaveAsAction(Layer layer) { super(tr("Save as ..."), "save_as", tr("Save the current data to a new file."), KeyEvent.VK_S, InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK, layer); super(tr("Save as ..."), "save_as", tr("Save the current data to a new file."), ShortCut.registerShortCut("system:saveas", tr("File: Save as..."), KeyEvent.VK_S, ShortCut.GROUP_MENU), layer); } @Override protected File getFile(Layer layer) { return openFileDialog(layer);
• ## trunk/src/org/openstreetmap/josm/actions/SelectAllAction.java

 r753 import org.openstreetmap.josm.Main; import org.openstreetmap.josm.tools.ShortCut; public class SelectAllAction extends JosmAction { public SelectAllAction() { super(tr("Select All"),"selectall", tr("Select all undeleted objects in the data layer. This selects incomplete objects too."), KeyEvent.VK_A, KeyEvent.CTRL_DOWN_MASK, true); } super(tr("Select All"),"selectall", tr("Select all undeleted objects in the data layer. This selects incomplete objects too."), ShortCut.registerShortCut("system:selectall", tr("Edit: Select all"), KeyEvent.VK_A, ShortCut.GROUP_MENU), true); } public void actionPerformed(ActionEvent e) {
• ## trunk/src/org/openstreetmap/josm/actions/SplitWayAction.java

 r926 import org.openstreetmap.josm.data.osm.visitor.NameVisitor; import org.openstreetmap.josm.data.osm.visitor.Visitor; import org.openstreetmap.josm.tools.ShortCut; /** * Splits a way into multiple ways (all identical except for their node list). * * * Ways are just split at the selected nodes.  The nodes remain in their * original order.  Selected nodes at the end of a way are ignored. */ public SplitWayAction() { super(tr("Split Way"), "splitway", tr("Split a way at the selected node."), KeyEvent.VK_P, 0, true); super(tr("Split Way"), "splitway", tr("Split a way at the selected node."), ShortCut.registerShortCut("tools:splitway", tr("Tool: Split way"), KeyEvent.VK_P, ShortCut.GROUP_EDIT), true); DataSet.selListeners.add(this); } /** * Called when the action is executed. * * * This method performs an expensive check whether the selection clearly defines one * of the split actions outlined above, and if yes, calls the splitWay method. } }; for (OsmPrimitive p : selection) p.visit(splitVisitor); } if (wayOccurenceCounter.isEmpty()) { JOptionPane.showMessageDialog(Main.parent, JOptionPane.showMessageDialog(Main.parent, trn("The selected node is no inner part of any way.", "The selected nodes are no inner part of any way.", selectedNodes.size())); } if (!nds.isEmpty()) { JOptionPane.showMessageDialog(Main.parent, JOptionPane.showMessageDialog(Main.parent, trn("The selected way does not contain the selected node.", "The selected way does not contain all the selected nodes.", selectedNodes.size())); } /** /** * Checks if the selection consists of something we can work with. * Checks only if the number and type of items selected looks good; * does not check whether the selected items are really a valid * does not check whether the selected items are really a valid * input for splitting (this would be too expensive to be carried * out from the selectionChanged listener). */ */ private boolean checkSelection(Collection selection) { boolean way = false; Collection commandList = new ArrayList(wayChunks.size()); Collection newSelection = new ArrayList(wayChunks.size()); Iterator> chunkIt = wayChunks.iterator(); // First, change the original way Way changedWay = new Way(selectedWay);
• ## trunk/src/org/openstreetmap/josm/actions/UnGlueAction.java

 r1009 import org.openstreetmap.josm.data.osm.RelationMember; import org.openstreetmap.josm.data.osm.Way; import org.openstreetmap.josm.tools.ShortCut; /** */ public UnGlueAction() { super(tr("UnGlue Ways"), "unglueways", tr("Duplicate the selected node so each way using it has its own copy."), KeyEvent.VK_G, 0, true); super(tr("UnGlue Ways"), "unglueways", tr("Duplicate the selected node so each way using it has its own copy."), ShortCut.registerShortCut("tools:unglue", tr("Tool: Unglue"), KeyEvent.VK_G, ShortCut.GROUP_EDIT), true); DataSet.selListeners.add(this); } */ private boolean checkSelection(Collection selection) { int size = selection.size(); if (size < 1 || size > 2) return false; selectedNode = null; selectedWay = null; for (OsmPrimitive p : selection) { if (p instanceof Node) { } else if (p instanceof Way) { selectedWay = (Way) p; if (size == 2 && selectedNode != null) if (size == 2 && selectedNode != null) return selectedWay.nodes.contains(selectedNode); } } return false; } return firstway; } /** * see above if (selectedWay == null) { boolean firstway = true; // modify all ways containing the nodes if (w.deleted || w.incomplete || w.nodes.size() < 1) continue; if (!w.nodes.contains(selectedNode)) continue; firstway = modifyWay(firstway, w, cmds, newNodes); }
• ## trunk/src/org/openstreetmap/josm/actions/UndoAction.java

 r627 import org.openstreetmap.josm.Main; import org.openstreetmap.josm.tools.ShortCut; /** * Undoes the last command. * * * @author imi */ */ public UndoAction() { super(tr("Undo"), "undo", tr("Undo the last action."), KeyEvent.VK_Z, InputEvent.CTRL_DOWN_MASK, true); super(tr("Undo"), "undo", tr("Undo the last action."), ShortCut.registerShortCut("system:undo", tr("Edit: Undo"), KeyEvent.VK_Z, ShortCut.GROUP_MENU), true); setEnabled(false); }
• ## trunk/src/org/openstreetmap/josm/actions/UnselectAllAction.java

 r768 import org.openstreetmap.josm.Main; import org.openstreetmap.josm.tools.ShortCut; public class UnselectAllAction extends JosmAction { public UnselectAllAction() { super(tr("Unselect All"), "unselectall", tr("Unselect all objects."), KeyEvent.VK_U, 0, true); ShortCut.registerShortCut("edit:unselectall", tr("Edit: Unselect all"), KeyEvent.VK_U, ShortCut.GROUP_EDIT), true); // this is not really GROUP_EDIT, but users really would complain if the yhad to reconfigure because we put // the correct group in // Add extra shortcut C-S-a Main.contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put( KeyStroke.getKeyStroke(KeyEvent.VK_A, KeyEvent.CTRL_DOWN_MASK | KeyEvent.SHIFT_DOWN_MASK), tr("Unselect All")); ShortCut.registerShortCut("edit:unselectall2", tr("Edit: Unselect all (2)"), KeyEvent.VK_A, ShortCut.GROUP_MENU).getKeyStroke(), tr("Unselect All")); // Add extra shortcut ESCAPE */ Main.contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put( KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), tr("Unselect All")); ShortCut.registerShortCut("edit:unselectall3", tr("Edit: Unselect all (3)"), KeyEvent.VK_ESCAPE, ShortCut.GROUP_DIRECT).getKeyStroke(), tr("Unselect All")); }

• ## trunk/src/org/openstreetmap/josm/actions/ZoomInAction.java

 r877 import org.openstreetmap.josm.Main; import org.openstreetmap.josm.tools.ShortCut; public final class ZoomInAction extends JosmAction { public ZoomInAction() { super(tr("Zoom in"), "dialogs/zoomin", tr("Zoom in"), KeyEvent.VK_PLUS, 0, true); ShortCut.registerShortCut("view:zoomin", tr("View: Zoom in"), KeyEvent.VK_PLUS, ShortCut.GROUP_DIRECT), true); setEnabled(true); }
• ## trunk/src/org/openstreetmap/josm/actions/ZoomOutAction.java

 r877 import org.openstreetmap.josm.Main; import org.openstreetmap.josm.tools.ShortCut; public final class ZoomOutAction extends JosmAction { public ZoomOutAction() { super(tr("Zoom out"), "dialogs/zoomout", tr("Zoom out"), KeyEvent.VK_MINUS, 0, true); ShortCut.registerShortCut("view:zoomout", tr("View: Zoom out"), KeyEvent.VK_MINUS, ShortCut.GROUP_DIRECT), true); setEnabled(true); }
• ## trunk/src/org/openstreetmap/josm/actions/audio/AudioBackAction.java

 r627 import org.openstreetmap.josm.gui.layer.markerlayer.MarkerLayer; import org.openstreetmap.josm.tools.AudioPlayer; import org.openstreetmap.josm.tools.ShortCut; public class AudioBackAction extends JosmAction { private double amount; // note, normally negative, i.e. jump backwards in time public AudioBackAction() { super(tr("Back"), "audio-back", tr("Jump back."), KeyEvent.VK_F6, 0, true); super(tr("Back"), "audio-back", tr("Jump back."), ShortCut.registerShortCut("audio:back", tr("Audio: Back"), KeyEvent.VK_F6, ShortCut.GROUP_DIRECT), true); try { amount = - Double.parseDouble(Main.pref.get("audio.forwardbackamount","10.0"));
• ## trunk/src/org/openstreetmap/josm/actions/audio/AudioFastSlowAction.java

 r627 import org.openstreetmap.josm.actions.JosmAction; import org.openstreetmap.josm.tools.AudioPlayer; import org.openstreetmap.josm.tools.ShortCut; abstract public class AudioFastSlowAction extends JosmAction { private double multiplier; public AudioFastSlowAction(String name, String iconName, String tooltip, ShortCut shortcut, boolean fast) { super(name, iconName, tooltip, shortcut, true); try { multiplier = Double.parseDouble(Main.pref.get("audio.fastfwdmultiplier","1.3")); } catch (NumberFormatException e) { multiplier = 1.3; } if (! fast) multiplier = 1.0 / multiplier; } @Deprecated public AudioFastSlowAction(String name, String iconName, String tooltip, int shortcut, int modifier, boolean fast) { super(name, iconName, tooltip, shortcut, modifier, true); multiplier = 1.3; } if (! fast) if (! fast) multiplier = 1.0 / multiplier; } public void actionPerformed(ActionEvent e) { double speed = AudioPlayer.speed(); if (speed * multiplier <= 0.1) if (speed * multiplier <= 0.1) return; try {
• ## trunk/src/org/openstreetmap/josm/actions/audio/AudioFasterAction.java

 r627 import static org.openstreetmap.josm.tools.I18n.tr; import org.openstreetmap.josm.tools.ShortCut; import java.awt.event.KeyEvent; public class AudioFasterAction extends AudioFastSlowAction { public AudioFasterAction() { super(tr("Faster"), "audio-faster", tr("Faster Forward"), KeyEvent.VK_F9, 0, true); super(tr("Faster"), "audio-faster", tr("Faster Forward"), ShortCut.registerShortCut("audio:faster", tr("Audio: Faster"), KeyEvent.VK_F9, ShortCut.GROUP_DIRECT), true); } }
• ## trunk/src/org/openstreetmap/josm/actions/audio/AudioFwdAction.java

 r627 import org.openstreetmap.josm.gui.layer.markerlayer.MarkerLayer; import org.openstreetmap.josm.tools.AudioPlayer; import org.openstreetmap.josm.tools.ShortCut; public class AudioFwdAction extends JosmAction { private double amount; public AudioFwdAction() { super(tr("Forward"), "audio-fwd", tr("Jump forward"), KeyEvent.VK_F7, 0, true); super(tr("Forward"), "audio-fwd", tr("Jump forward"), ShortCut.registerShortCut("audio:forward", tr("Audio: Forward"), KeyEvent.VK_F7, ShortCut.GROUP_DIRECT), true); try { amount = Double.parseDouble(Main.pref.get("audio.forwardbackamount","10.0"));
• ## trunk/src/org/openstreetmap/josm/actions/audio/AudioNextAction.java

 r627 import org.openstreetmap.josm.actions.JosmAction; import org.openstreetmap.josm.gui.layer.markerlayer.MarkerLayer; import org.openstreetmap.josm.tools.ShortCut; public class AudioNextAction extends JosmAction { public AudioNextAction() { super(tr("Next Marker"), "audio-next", tr("Play next marker."), KeyEvent.VK_F8, 0, true); super(tr("Next Marker"), "audio-next", tr("Play next marker."), ShortCut.registerShortCut("audio:next", tr("Audio: Next"), KeyEvent.VK_F8, ShortCut.GROUP_DIRECT), true); }
• ## trunk/src/org/openstreetmap/josm/actions/audio/AudioPlayPauseAction.java

 r627 import org.openstreetmap.josm.gui.layer.markerlayer.MarkerLayer; import org.openstreetmap.josm.tools.AudioPlayer; import org.openstreetmap.josm.tools.ShortCut; public class AudioPlayPauseAction extends JosmAction { public AudioPlayPauseAction() { super(tr("Play/pause"), "audio-playpause", tr("Play/pause audio."), KeyEvent.VK_PERIOD, 0, true); super(tr("Play/pause"), "audio-playpause", tr("Play/pause audio."), ShortCut.registerShortCut("audio:pause", tr("Audio: Play/Pause"), KeyEvent.VK_PERIOD, ShortCut.GROUP_DIRECT), true); } AudioPlayer.audioMalfunction(ex); } } } }
• ## trunk/src/org/openstreetmap/josm/actions/audio/AudioPrevAction.java

 r627 import org.openstreetmap.josm.actions.JosmAction; import org.openstreetmap.josm.gui.layer.markerlayer.MarkerLayer; import org.openstreetmap.josm.tools.ShortCut; public class AudioPrevAction extends JosmAction { public AudioPrevAction() { super(tr("Previous Marker"), "audio-prev", tr("Play previous marker."), KeyEvent.VK_F5, 0, true); super(tr("Previous Marker"), "audio-prev", tr("Play previous marker."), ShortCut.registerShortCut("audio:prev", tr("Audio: Previous"), KeyEvent.VK_F5, ShortCut.GROUP_DIRECT), true); }
• ## trunk/src/org/openstreetmap/josm/actions/audio/AudioSlowerAction.java

 r627 import java.awt.event.KeyEvent; import org.openstreetmap.josm.tools.ShortCut; public class AudioSlowerAction extends AudioFastSlowAction { public AudioSlowerAction() { super(tr("Slower"), "audio-slower", tr("Slower Forward"), KeyEvent.VK_F9, KeyEvent.SHIFT_MASK, false); super(tr("Slower"), "audio-slower", tr("Slower Forward"), ShortCut.registerShortCut("audio:slower", tr("Audio: Slower"), KeyEvent.VK_F9, ShortCut.GROUP_DIRECT), true); } }
• ## trunk/src/org/openstreetmap/josm/actions/mapmode/DeleteAction.java

 r988 import org.openstreetmap.josm.gui.MapFrame; import org.openstreetmap.josm.tools.ImageProvider; import org.openstreetmap.josm.tools.ShortCut; /** * An action that enables the user to delete nodes and other objects. * * The user can click on an object, which gets deleted if possible. When Ctrl is * pressed when releasing the button, the objects and all its references are * The user can click on an object, which gets deleted if possible. When Ctrl is * pressed when releasing the button, the objects and all its references are * deleted. The exact definition of "all its references" are in * {@link #deleteWithReferences deleteWithReferences}. * If the user enters the mapmode and any object is selected, all selected * objects that can be deleted will. * * * @author imi */ public DeleteAction(MapFrame mapFrame) { super(tr("Delete Mode"), "delete", tr("Delete nodes or ways."), KeyEvent.VK_D, mapFrame, "delete", tr("Delete nodes or ways."), ShortCut.registerShortCut("mapmode:delete", tr("Delete mode"), KeyEvent.VK_D, ShortCut.GROUP_EDIT), mapFrame, ImageProvider.getCursor("normal", "delete")); } } @Override public void actionPerformed(ActionEvent e) { super.actionPerformed(e); boolean shift = (e.getModifiers() & ActionEvent.SHIFT_MASK) != 0; boolean alt = (e.getModifiers() & ActionEvent.ALT_MASK) != 0; OsmPrimitive sel = Main.map.mapView.getNearestNode(e.getPoint()); Command c = null; if (ws != null) { if (shift) { c = DeleteCommand.deleteWaySegment(ws); c = DeleteCommand.deleteWaySegment(ws); } else if (ctrl) { c = DeleteCommand.deleteWithReferences(Collections.singleton((OsmPrimitive)ws.way)); Main.map.mapView.repaint(); } @Override public String getModeHelpText() { return tr("Click to delete. Shift: delete way segment. Alt: don't delete unused nodes when deleting a way. Ctrl: delete referring objects.");

• ## trunk/src/org/openstreetmap/josm/actions/mapmode/ExtrudeAction.java

 r999 import org.openstreetmap.josm.gui.layer.MapViewPaintable; import org.openstreetmap.josm.tools.ImageProvider; import org.openstreetmap.josm.tools.ShortCut; /** * Makes a rectangle from a line, or modifies a rectangle. * * * This class currently contains some "sleeping" code copied from DrawAction (move and rotate) * which can eventually be removed, but it may also get activated here and removed in DrawAction. double yoff; double distance; /** * The old cursor before the user pressed the mouse button. private Cursor oldCursor; /** * The current position of the mouse * The current position of the mouse */ private Point mousePos; /** /** * The position of the mouse cursor when the drag action was initiated. */ public ExtrudeAction(MapFrame mapFrame) { super(tr("Extrude"), "extrude/extrude", tr("Create areas"), KeyEvent.VK_X, mapFrame, ShortCut.registerShortCut("mapmode:extrude", tr("Extrude mode"), KeyEvent.VK_X, ShortCut.GROUP_EDIT), mapFrame, getCursor("normal", "selection", Cursor.DEFAULT_CURSOR)); putValue("help", "Action/Extrude/Extrude"); } } @Override public void enterMode() { super.enterMode(); @Override public void mouseDragged(MouseEvent e) { if (mode == Mode.select) return; // do not count anything as a move if it lasts less than 100 milliseconds. if ((mode == Mode.EXTRUDE) && (System.currentTimeMillis() - mouseDownTime < initialMoveDelay)) return; return; } Main.map.mapView.repaint(); mousePos = e.getPoint(); Node n1 = selectedSegment.way.nodes.get(selectedSegment.lowerIndex); Node n2 = selectedSegment.way.nodes.get(selectedSegment.lowerIndex+1); EastNorth en1 = n1.eastNorth; EastNorth en2 = n2.eastNorth; if (en1.east() < en2.east()) { en2 = en1; en1 = n2.eastNorth; } EastNorth en3 = mv.getEastNorth(mousePos.x, mousePos.y); double u = ((en3.east()-en1.east())*(en2.east()-en1.east()) + (en3.north()-en1.north())*(en2.north()-en1.north()))/en2.distanceSq(en1); // the point on the segment from which the distance to mouse pos is shortest EastNorth base = new EastNorth(en1.east()+u*(en2.east()-en1.east()), en1.north()+u*(en2.north()-en1.north())); // the distance, in projection units, between the base point and the mouse cursor double len = base.distance(en3); // find out the distance, in metres, between the base point and the mouse cursor distance = Main.proj.eastNorth2latlon(base).greatCircleDistance(Main.proj.eastNorth2latlon(en3)); Main.map.statusLine.setDist(distance); updateStatusLine(); // compute the angle at which the segment is drawn // and use it to compute the x and y offsets for the // corner points. // corner points. double sin_alpha = (en2.north()-en1.north())/en2.distance(en1); // this is a kludge because sometimes extrusion just goes the wrong direction if ((en3.east()>base.east()) ^ (sin_alpha < 0)) len=-len; xoff = sin_alpha * len; yoff = Math.sqrt(1-sin_alpha*sin_alpha) * len; Graphics2D g2 = (Graphics2D) g; g2.setColor(selectedColor); Point p3=mv.getPoint(en1.add(-xoff, -yoff)); Point p4=mv.getPoint(en2.add(-xoff, -yoff)); b.moveTo(p1.x,p1.y); b.lineTo(p3.x, p3.y); b.lineTo(p4.x, p4.y); b.lineTo(p2.x, p2.y); b.lineTo(p1.x,p1.y); g2.draw(b); g2.setStroke(new BasicStroke(1)); } } g2.setStroke(new BasicStroke(1)); } } /** */ // boolean alt = (e.getModifiers() & ActionEvent.ALT_MASK) != 0; // boolean shift = (e.getModifiers() & ActionEvent.SHIFT_MASK) != 0; mouseDownTime = System.currentTimeMillis(); selectedSegment = Main.map.mapView.getNearestWaySegment(e.getPoint()); Main.main.undoRedo.add(c); } Main.map.mapView.removeTemporaryLayer(this); mode = null; updateStatusLine(); Main.map.mapView.repaint(); Main.map.mapView.repaint(); }
• ## trunk/src/org/openstreetmap/josm/actions/mapmode/MapMode.java

 r627 import org.openstreetmap.josm.gui.MapFrame; import org.openstreetmap.josm.tools.ImageProvider; import org.openstreetmap.josm.tools.ShortCut; /** * As example scrolling the map is a MapMode, connecting Nodes to new Ways * is another. * * * MapModes should register/deregister all necessary listeners on the map's view * control. * control. */ abstract public class MapMode extends JosmAction implements MouseListener, MouseMotionListener { * Constructor for mapmodes without an menu */ public MapMode(String name, String iconName, String tooltip, ShortCut shortCut, MapFrame mapFrame, Cursor cursor) { super(name, "mapmode/"+iconName, tooltip, shortCut, false); this.cursor = cursor; putValue("active", false); } /** * Constructor for mapmodes without an menu */ @Deprecated public MapMode(String name, String iconName, String tooltip, int keystroke, MapFrame mapFrame, Cursor cursor) { super(name, "mapmode/"+iconName, tooltip, keystroke, 0, false); Main.map.statusLine.repaint(); } public String getModeHelpText() { return "";

• ## trunk/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java

 r982 import org.openstreetmap.josm.gui.SelectionManager.SelectionEnded; import org.openstreetmap.josm.tools.ImageProvider; import org.openstreetmap.josm.tools.ShortCut; /** * Move is an action that can move all kind of OsmPrimitives (except keys for now). * and will be moved. * If no object is under the mouse, move all selected objects (if any) * * * @author imi */ private Point mousePos; private SelectionManager selectionManager; /** * The time which needs to pass between click and release before something public SelectAction(MapFrame mapFrame) { super(tr("Select"), "move/move", tr("Select, move and rotate objects"), KeyEvent.VK_S, mapFrame, ShortCut.registerShortCut("mapmode:select", tr("Select mode"), KeyEvent.VK_S, ShortCut.GROUP_EDIT), mapFrame, getCursor("normal", "selection", Cursor.DEFAULT_CURSOR)); putValue("help", "Action/Move/Move"); selectionManager = new SelectionManager(this, false, mapFrame.mapView); selectionManager = new SelectionManager(this, false, mapFrame.mapView); try { initialMoveDelay = Integer.parseInt(Main.pref.get("edit.initial-move-delay","200")); } catch (NumberFormatException x) {} try { initialMoveThreshold = Integer.parseInt(Main.pref.get("edit.initial-move-threshold","5")); } catch (NumberFormatException x) {} } } } @Override public void enterMode() { super.enterMode(); return; } if (!initialMoveThresholdExceeded) { int dxp = mousePos.x - e.getX(); initialMoveThresholdExceeded = true; } EastNorth mouseEN = Main.map.mapView.getEastNorth(e.getX(), e.getY()); EastNorth mouseStartEN = Main.map.mapView.getEastNorth(mousePos.x, mousePos.y); Collection selection = Main.ds.getSelected(); Collection affectedNodes = AllNodesVisitor.getAllNodes(selection); // when rotating, having only one node makes no sense - quit silently if (mode == Mode.rotate && affectedNodes.size() < 2) if (mode == Mode.rotate && affectedNodes.size() < 2) return; virtualWay = null; virtualNode = null; if (osm == null) { } } if (osm == null) if (osm == null) return Collections.emptySet(); return Collections.singleton(osm); * Look, whether any object is selected. If not, select the nearest node. * If there are no nodes in the dataset, do nothing. * * * If the user did not press the left mouse button, do nothing. * * Also remember the starting position of the movement and change the mouse * * Also remember the starting position of the movement and change the mouse * cursor to movement. */ // boolean alt = (e.getModifiers() & ActionEvent.ALT_MASK) != 0; boolean shift = (e.getModifiers() & ActionEvent.SHIFT_MASK) != 0; mouseDownTime = System.currentTimeMillis(); didMove = false; Main.map.mapView.repaint(); } @Override public String getModeHelpText() { if (mode == Mode.select) {
• ## trunk/src/org/openstreetmap/josm/actions/mapmode/ZoomAction.java

 r983 import org.openstreetmap.josm.gui.SelectionManager.SelectionEnded; import org.openstreetmap.josm.tools.ImageProvider; import org.openstreetmap.josm.tools.ShortCut; /** * Enable the zoom mode within the MapFrame. * * Holding down the left mouse button select a rectangle with the same aspect * Enable the zoom mode within the MapFrame. * * Holding down the left mouse button select a rectangle with the same aspect * ratio than the current map view. * Holding down left and right let the user move the former selected rectangle. * Releasing the left button zoom to the selection. * * Rectangle selections with either height or width smaller than 3 pixels * * Rectangle selections with either height or width smaller than 3 pixels * are ignored. * * * @author imi */ */ public ZoomAction(MapFrame mapFrame) { super(tr("Zoom"), "zoom", tr("Zoom and move map"), KeyEvent.VK_Z, mapFrame, ImageProvider.getCursor("normal", "zoom")); super(tr("Zoom"), "zoom", tr("Zoom and move map"), ShortCut.registerShortCut("mapmode:zoom", tr("Zoom mode"), KeyEvent.VK_Z, ShortCut.GROUP_EDIT), mapFrame, ImageProvider.getCursor("normal", "zoom")); mv = mapFrame.mapView; selectionManager = new SelectionManager(this, true, mv); selectionManager.unregister(mv); } @Override public String getModeHelpText() { return tr("Zoom by dragging or Ctrl+. or Ctrl+,; move with Ctrl+up,left,down,right; move zoom with right button");
• ## trunk/src/org/openstreetmap/josm/actions/search/SearchAction.java

 r967 import org.openstreetmap.josm.data.osm.OsmPrimitive; import org.openstreetmap.josm.tools.GBC; import org.openstreetmap.josm.tools.ShortCut; public class SearchAction extends JosmAction { public SearchAction() { super(tr("Search ..."), "dialogs/search", tr("Search for objects."), KeyEvent.VK_F, KeyEvent.CTRL_DOWN_MASK, true); super(tr("Search ..."), "dialogs/search", tr("Search for objects."), ShortCut.registerShortCut("system:find", tr("Search..."), KeyEvent.VK_F, ShortCut.GROUP_HOTKEY), true); } /** * Adds the search specified by the settings in s to the * Adds the search specified by the settings in s to the * search history and performs the search. * * * @param s */

• ## trunk/src/org/openstreetmap/josm/gui/MainApplication.java

 r999 */ public class MainApplication extends Main { /** * Allow subclassing (see JOSM.java) */ public MainApplication() {} /** * Construct an main frame, ready sized and operating. Does not Thread.setDefaultUncaughtExceptionHandler(new BugReportExceptionHandler()); // initialize the plaform hook, and Main.determinePlatformHook(); // call the really early hook before we anything else Main.platform.preStartupHook(); // construct argument table List argList = Arrays.asList(argArray); tr("Plugins"), JOptionPane.ERROR_MESSAGE); } // load the early plugins splash.setStatus(tr("Loading early plugins")); if (argList.contains("--help") || argList.contains("-?") || argList.contains("-h")) { // TODO: put in a platformHook for system that have no console by default System.out.println(tr("Java OpenStreetMap Editor")+"\n\n"+ tr("usage")+":\n"+ }); } }

• ## trunk/src/org/openstreetmap/josm/gui/MapMover.java

 r627 import javax.swing.JPanel; import javax.swing.KeyStroke; import org.openstreetmap.josm.tools.ShortCut; import static org.openstreetmap.josm.tools.I18n.tr; import org.openstreetmap.josm.data.coor.EastNorth; nc.addMouseMotionListener(this); nc.addMouseWheelListener(this); String[] n = {",",".","up","right","down","left"}; int[] k = {KeyEvent.VK_COMMA, KeyEvent.VK_PERIOD, KeyEvent.VK_UP, KeyEvent.VK_RIGHT, KeyEvent.VK_DOWN, KeyEvent.VK_LEFT}; if (contentPane != null) { for (int i = 0; i < n.length; ++i) { contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(k[i], KeyEvent.CTRL_DOWN_MASK), "MapMover.Zoomer."+n[i]); contentPane.getActionMap().put("MapMover.Zoomer."+n[i], new ZoomerAction(n[i])); } contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put( ShortCut.registerShortCut("system:movefocusright", tr("Map: Move right"), KeyEvent.VK_RIGHT, ShortCut.GROUP_HOTKEY).getKeyStroke(), "MapMover.Zoomer.right"); contentPane.getActionMap().put("MapMover.Zoomer.right", new ZoomerAction("right")); contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put( ShortCut.registerShortCut("system:movefocusleft", tr("Map: Move left"), KeyEvent.VK_LEFT, ShortCut.GROUP_HOTKEY).getKeyStroke(), "MapMover.Zoomer.left"); contentPane.getActionMap().put("MapMover.Zoomer.left", new ZoomerAction("left")); contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put( ShortCut.registerShortCut("system:movefocusup", tr("Map: Move up"), KeyEvent.VK_UP, ShortCut.GROUP_HOTKEY).getKeyStroke(), "MapMover.Zoomer.up"); contentPane.getActionMap().put("MapMover.Zoomer.up", new ZoomerAction("up")); contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put( ShortCut.registerShortCut("system:movefocusdown", tr("Map: Move down"), KeyEvent.VK_DOWN, ShortCut.GROUP_HOTKEY).getKeyStroke(), "MapMover.Zoomer.down"); contentPane.getActionMap().put("MapMover.Zoomer.down", new ZoomerAction("down")); contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put( ShortCut.registerShortCut("view:zoominalternate", tr("Map: Zoom in"), KeyEvent.VK_COMMA, ShortCut.GROUP_HOTKEY).getKeyStroke(), "MapMover.Zoomer.in"); contentPane.getActionMap().put("MapMover.Zoomer.in", new ZoomerAction(",")); contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put( ShortCut.registerShortCut("view:zoomoutalternate", tr("Map: Zoom out"), KeyEvent.VK_PERIOD, ShortCut.GROUP_HOTKEY).getKeyStroke(), "MapMover.Zoomer.out"); contentPane.getActionMap().put("MapMover.Zoomer.out", new ZoomerAction(".")); } } double centerx = e.getX() - (e.getX()-w/2)*newHalfWidth*2/w; double centery = e.getY() - (e.getY()-h/2)*newHalfHeight*2/h; EastNorth newCenter = nc.getEastNorth((int)centerx, (int)centery); EastNorth newCenter = nc.getEastNorth((int)centerx, (int)centery); nc.zoomTo(newCenter, nc.getScale()*zoom);
• ## trunk/src/org/openstreetmap/josm/gui/MapView.java

 r1022 import org.openstreetmap.josm.Main; import org.openstreetmap.josm.actions.AutoScaleAction; import org.openstreetmap.josm.actions.JosmAction; import org.openstreetmap.josm.actions.MoveAction; import org.openstreetmap.josm.data.Bounds; */ private Layer activeLayer; /** * The last event performed by mouse. private LinkedList temporaryLayers = new LinkedList(); private BufferedImage offscreenBuffer; /** * The listener of the active layer changes. new MapMover(MapView.this, Main.contentPane); Main.contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_UP, java.awt.event.InputEvent.SHIFT_MASK), "UP"); Main.contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, java.awt.event.InputEvent.SHIFT_MASK), "DOWN"); Main.contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, java.awt.event.InputEvent.SHIFT_MASK), "LEFT"); Main.contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, java.awt.event.InputEvent.SHIFT_MASK), "RIGHT"); Main.contentPane.getActionMap().put("UP", new MoveAction(MoveAction.Direction.UP)); Main.contentPane.getActionMap().put("DOWN", new MoveAction(MoveAction.Direction.DOWN)); Main.contentPane.getActionMap().put("LEFT", new MoveAction(MoveAction.Direction.LEFT)); Main.contentPane.getActionMap().put("RIGHT", new MoveAction(MoveAction.Direction.RIGHT)); JosmAction mv; mv = new MoveAction(MoveAction.Direction.UP); if (mv.getShortCut() != null) { Main.contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(mv.getShortCut().getKeyStroke(), "UP"); Main.contentPane.getActionMap().put("UP", mv); } mv = new MoveAction(MoveAction.Direction.DOWN); if (mv.getShortCut() != null) { Main.contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(mv.getShortCut().getKeyStroke(), "DOWN"); Main.contentPane.getActionMap().put("DOWN", mv); } mv = new MoveAction(MoveAction.Direction.LEFT); if (mv.getShortCut() != null) { Main.contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(mv.getShortCut().getKeyStroke(), "LEFT"); Main.contentPane.getActionMap().put("LEFT", mv); } mv = new MoveAction(MoveAction.Direction.RIGHT); if (mv.getShortCut() != null) { Main.contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(mv.getShortCut().getKeyStroke(), "RIGHT"); Main.contentPane.getActionMap().put("RIGHT", mv); } MapSlider zoomSlider = new MapSlider(MapView.this); mvp.paint(tempG, this); } // draw world borders tempG.setColor(Color.WHITE); if (x1 > 0 || y1 > 0 || x2 < getWidth() || y2 < getHeight()) tempG.drawRect(x1, y1, x2-x1+1, y2-y1+1); if (playHeadMarker != null) playHeadMarker.paint(tempG, this); return false; } public boolean addTemporaryLayer(MapViewPaintable mvp) { if (temporaryLayers.contains(mvp)) return false; return temporaryLayers.add(mvp); } public boolean removeTemporaryLayer(MapViewPaintable mvp) { return temporaryLayers.remove(mvp);
• ## trunk/src/org/openstreetmap/josm/gui/dialogs/CommandStackDialog.java

 r627 import org.openstreetmap.josm.gui.MapFrame; import org.openstreetmap.josm.gui.layer.OsmDataLayer.CommandQueueListener; import org.openstreetmap.josm.tools.ShortCut; public class CommandStackDialog extends ToggleDialog implements CommandQueueListener { public CommandStackDialog(final MapFrame mapFrame) { super(tr("Command Stack"), "commandstack", tr("Open a list of all commands (undo buffer)."), KeyEvent.VK_O, 100); super(tr("Command Stack"), "commandstack", tr("Open a list of all commands (undo buffer)."), ShortCut.registerShortCut("subwindow:commandstack", tr("Toggle command stack"), KeyEvent.VK_O, ShortCut.GROUP_LAYER), 100); Main.main.undoRedo.listenerCommands.add(this); tree.setRootVisible(false); tree.setShowsRootHandles(true);
• ## trunk/src/org/openstreetmap/josm/gui/dialogs/ConflictDialog.java

 r999 import org.openstreetmap.josm.gui.OsmPrimitivRenderer; import org.openstreetmap.josm.gui.SideButton; import org.openstreetmap.josm.tools.ShortCut; public final class ConflictDialog extends ToggleDialog { public ConflictDialog() { super(tr("Conflict"), "conflict", tr("Merging conflicts."), KeyEvent.VK_C, 100); super(tr("Conflict"), "conflict", tr("Merging conflicts."), ShortCut.registerShortCut("subwindow:conflict", tr("Toggle conflict window"), KeyEvent.VK_C, ShortCut.GROUP_LAYER), 100); displaylist.setCellRenderer(new OsmPrimitivRenderer()); displaylist.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
• ## trunk/src/org/openstreetmap/josm/gui/dialogs/HistoryDialog.java

 r758 import org.openstreetmap.josm.tools.GBC; import org.openstreetmap.josm.tools.ImageProvider; import org.openstreetmap.josm.tools.ShortCut; /** public HistoryDialog() { super(tr("History"), "history", tr("Display the history of all selected items."), KeyEvent.VK_H, 150); super(tr("History"), "history", tr("Display the history of all selected items."), ShortCut.registerShortCut("subwindow:history", tr("Toggle history window"), KeyEvent.VK_H, ShortCut.GROUP_LAYER), 150); historyPane.setVisible(false); notLoaded.setVisible(true);
• ## trunk/src/org/openstreetmap/josm/gui/dialogs/LayerListDialog.java

 r867 import org.openstreetmap.josm.tools.ImageProvider; import org.openstreetmap.josm.tools.ImageProvider.OverlayPosition; import org.openstreetmap.josm.tools.ShortCut; /** */ public LayerListDialog(MapFrame mapFrame) { super(tr("Layers"), "layerlist", tr("Open a list of all loaded layers."), KeyEvent.VK_L, 100); super(tr("Layers"), "layerlist", tr("Open a list of all loaded layers."), ShortCut.registerShortCut("subwindow:layers", tr("Toggle layer window"), KeyEvent.VK_L, ShortCut.GROUP_LAYER), 100); instance = new JList(model); listScrollPane = new JScrollPane(instance);
• ## trunk/src/org/openstreetmap/josm/gui/dialogs/PropertiesDialog.java

 r810 import org.openstreetmap.josm.tools.AutoCompleteComboBox; import org.openstreetmap.josm.tools.GBC; import org.openstreetmap.josm.tools.ShortCut; /** */ private NameVisitor nameVisitor = new NameVisitor(); /** * Watches for double clicks and from editing or new property, depending on the } String msg = ""+trn("This will change up to {0} object.", "This will change up to {0} objects.", sel.size(), sel.size())+"

• ## trunk/src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java

 r999 import org.openstreetmap.josm.gui.layer.Layer.LayerChangeListener; import org.openstreetmap.josm.tools.GBC; import org.openstreetmap.josm.tools.ShortCut; /** * A dialog showing all known relations, with buttons to add, edit, and * delete them. * * delete them. * * We don't have such dialogs for nodes, segments, and ways, becaus those * objects are visible on the map and can be selected there. Relations are not. public RelationListDialog() { super(tr("Relations"), "relationlist", tr("Open a list of all relations."), KeyEvent.VK_R, 150); super(tr("Relations"), "relationlist", tr("Open a list of all relations."), ShortCut.registerShortCut("subwindow:relations", tr("Toggle relations window"), KeyEvent.VK_R, ShortCut.GROUP_LAYER), 150); displaylist.setCellRenderer(new OsmPrimitivRenderer()); displaylist.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); JPanel buttonPanel = new JPanel(new GridLayout(1,4)); buttonPanel.add(new SideButton(marktr("New"), "addrelation", "Selection", tr("Create a new relation"), new ActionListener() { public void actionPerformed(ActionEvent e) { } }), GBC.std()); buttonPanel.add(new SideButton(marktr("Select"), "select", "Selection", tr("Select this relation"), new ActionListener() { public void actionPerformed(ActionEvent e) { } }), GBC.std()); buttonPanel.add(new SideButton(marktr("Edit"), "edit", "Selection", tr( "Open an editor for the selected relation"), new ActionListener() { public void actionPerformed(ActionEvent e) { Relation toEdit = (Relation) displaylist.getSelectedValue(); if (toEdit != null) new RelationEditor(toEdit).setVisible(true); new RelationEditor(toEdit).setVisible(true); } }), GBC.std()); buttonPanel.add(new SideButton(marktr("Delete"), "delete", "Selection", tr("Delete the selected relation"), new ActionListener() { public void actionPerformed(ActionEvent e) { if (b) updateList(); } public void updateList() { list.setSize(Main.ds.relations.size()); list.setSize(i); } public void activeLayerChange(Layer a, Layer b) { if ((a == null || a instanceof OsmDataLayer) && b instanceof OsmDataLayer) { } } public void layerRemoved(Layer a) { if (a instanceof OsmDataLayer) { ((OsmDataLayer)a).listenerDataChanged.add(this); } } } public void dataChanged(OsmDataLayer l) { updateList(); repaint(); } /** * Returns the currently selected relation, or null. * * * @return the currently selected relation, or null */ /** * Adds a selection listener to the relation list. * * * @param listener the listener to add */ /** * Removes a selection listener from the relation list. * * * @param listener the listener to remove */

• ## trunk/src/org/openstreetmap/josm/gui/dialogs/ToggleDialog.java

 r627 import org.openstreetmap.josm.tools.GBC; import org.openstreetmap.josm.tools.ImageProvider; import org.openstreetmap.josm.tools.ShortCut; /** public AbstractButton button; private ToggleDialogAction(String name, String iconName, String tooltip, int shortCut, int modifier, String prefname) { super(name, iconName, tooltip, shortCut, modifier, false); private ToggleDialogAction(String name, String iconName, String tooltip, ShortCut shortCut, String prefname) { super(name, iconName, tooltip, shortCut, false); this.prefname = prefname; } private final JPanel titleBar = new JPanel(new GridBagLayout()); @Deprecated public ToggleDialog(final String name, String iconName, String tooltip, int shortCut, int preferredHeight) { super(new BorderLayout()); this.prefName = iconName; ToggleDialogInit(name, iconName, tooltip, ShortCut.registerShortCut("auto:"+name, tooltip, shortCut, ShortCut.GROUP_LAYER), preferredHeight); } public ToggleDialog(final String name, String iconName, String tooltip, ShortCut shortCut, int preferredHeight) { super(new BorderLayout()); this.prefName = iconName; ToggleDialogInit(name, iconName, tooltip, shortCut, preferredHeight); } private void ToggleDialogInit(final String name, String iconName, String tooltip, ShortCut shortCut, int preferredHeight) { setPreferredSize(new Dimension(330,preferredHeight)); action = new ToggleDialogAction(name, "dialogs/"+iconName, tooltip, shortCut, KeyEvent.ALT_MASK, iconName); action = new ToggleDialogAction(name, "dialogs/"+iconName, tooltip, shortCut, iconName); String helpId = "Dialog/"+getClass().getName().substring(getClass().getName().lastIndexOf('.')+1); action.putValue("help", helpId.substring(0, helpId.length()-6));
• ## trunk/src/org/openstreetmap/josm/gui/dialogs/UserListDialog.java

 r627 import org.openstreetmap.josm.data.osm.OsmPrimitive; import org.openstreetmap.josm.data.osm.User; import org.openstreetmap.josm.tools.ShortCut; /** * Displays a dialog with all users who have last edited something in the * Displays a dialog with all users who have last edited something in the * selection area, along with the number of objects. * * * @author Frederik Ramm */ private static User anonymousUser = User.get("(anonymous users)"); public UserListDialog() { super(tr("Authors"), "userlist", tr("Open a list of people working on the selected objects."), KeyEvent.VK_A, 150); super(tr("Authors"), "userlist", tr("Open a list of people working on the selected objects."), ShortCut.registerShortCut("subwindow:authors", tr("Toggle authors window"), KeyEvent.VK_A, ShortCut.GROUP_LAYER), 150); data.setColumnIdentifiers(new String[]{tr("Author"),tr("# Objects"),"%"}); userTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); add(new JScrollPane(userTable), BorderLayout.CENTER); selectionChanged(Main.ds.getSelected()); DataSet.selListeners.add(this); } if (!isVisible()) return; class UserCount { User user; UserCount(User user, int count) { this.user=user; this.count=count; } } if (data == null) return; // selection changed may be received in base class constructor before init data.setRowCount(0); HashMap counters = new HashMap(); int all = 0; if (u == null) u = anonymousUser; UserCount uc = counters.get(u); if (uc == null) if (uc == null) counters.put(u, uc = new UserCount(u, 0)); uc.count++; counters.values().toArray(ucArr); Arrays.sort(ucArr, new Comparator() { public int compare(UserCount a, UserCount b) { public int compare(UserCount a, UserCount b) { return (a.countb.count) ? -1 : 0; } }); for (UserCount uc : ucArr) { data.addRow(new Object[] { uc.user.name, uc.count, uc.count * 100 / all });
• ## trunk/src/org/openstreetmap/josm/gui/preferences/LafPreference.java

 r627 import java.awt.Component; import java.lang.reflect.*; import javax.swing.DefaultListCellRenderer; public void addGui(PreferenceDialog gui) { lafCombo = new JComboBox(UIManager.getInstalledLookAndFeels()); // let's try to load additional LookAndFeels and put them into the list try { Class Cquaqua = Class.forName("ch.randelshofer.quaqua.QuaquaLookAndFeel"); Object Oquaqua = Cquaqua.getConstructor((Class[])null).newInstance((Object[])null); // no exception? Then Go! lafCombo.addItem( new UIManager.LookAndFeelInfo(((javax.swing.LookAndFeel)Oquaqua).getName(), "ch.randelshofer.quaqua.QuaquaLookAndFeel") ); } catch (Exception ex) { // just ignore, Quaqua may not even be installed... //System.out.println("Failed to load Quaqua: " + ex); } String laf = Main.pref.get("laf"); for (int i = 0; i < lafCombo.getItemCount(); ++i) {
• ## trunk/src/org/openstreetmap/josm/gui/preferences/PreferenceDialog.java

 r938 public final JPanel map = createPreferenceTab("map", I18n.tr("Map Settings"), I18n.tr("Settings for the map projection and data interpretation.")); public final JPanel audio = createPreferenceTab("audio", I18n.tr("Audio Settings"), I18n.tr("Settings for the audio player and audio markers.")); /** * Construct a JPanel for the preference settings. Layout is GridBagLayout settings.add(Main.toolbar); settings.add(new AudioPreference()); settings.add(new ShortcutPreference()); for (PluginProxy plugin : Main.plugins) { PreferenceSetting p = plugin.getPreferenceSetting();
• ## trunk/src/org/openstreetmap/josm/tools/OpenBrowser.java

 r627 /** * Helper to open platform web browser on different platforms * * This now delegates the real work to a platform specific class. * * @author Imi */ } String os = System.getProperty("os.name"); if (os == null) return "unknown operating system"; try { if (os != null && os.startsWith("Windows")) windows(url); else if (os.equals("Linux") || os.equals("Solaris") || os.equals("SunOS") || os.equals("AIX") || os.equals("FreeBSD")) linux(url); else if (os.equals("Mac OS") || os.equals("Mac OS X")) mac(url); else return "unknown operating system"; Main.platform.openUrl(url); } catch (IOException e) { return e.getMessage(); } private static void windows(String url) throws IOException { Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + url); } private static void linux(String url) { String[] programs = {"gnome-open", "kfmclient openURL", "firefox"}; for (String program : programs) { try { Runtime.getRuntime().exec(program+" "+url); return; } catch (IOException e) { } } } private static void mac(String url) throws IOException { Runtime.getRuntime().exec("open " + url); } }
• ## trunk/src/org/openstreetmap/josm/tools/ShortCutLabel.java

 r627 import java.awt.event.KeyEvent; @Deprecated public class ShortCutLabel { @Deprecated public static String name(int shortCut, int modifiers) { if (shortCut == 0 && modifiers == 0)
Note: See TracChangeset for help on using the changeset viewer.