Ticket #10812: patch10812-v2.patch
File patch10812-v2.patch, 4.0 KB (added by , 9 years ago) |
---|
-
src/org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayer.java
15 15 import java.awt.event.MouseAdapter; 16 16 import java.awt.event.MouseEvent; 17 17 import java.awt.image.BufferedImage; 18 import java.awt.datatransfer.Clipboard; 19 import java.awt.datatransfer.StringSelection; 20 import java.awt.Toolkit; 18 21 import java.beans.PropertyChangeEvent; 19 22 import java.beans.PropertyChangeListener; 20 23 import java.io.File; … … 755 758 } 756 759 } 757 760 761 public void copyCurrentPhotoPath() { 762 ImageEntry toCopy = null; 763 if (data != null && data.size() > 0 && currentPhoto >= 0 && currentPhoto < data.size()) { 764 toCopy = data.get(currentPhoto); 765 String copyString = toCopy.getFile().toString(); 766 StringSelection stringSelection = new StringSelection(copyString); 767 Clipboard clpbrd = Toolkit.getDefaultToolkit().getSystemClipboard (); 768 clpbrd.setContents (stringSelection, null); 769 } 770 } 771 758 772 /** 759 773 * Removes a photo from the list of images by index. 760 774 * @param idx Image index -
src/org/openstreetmap/josm/gui/layer/geoimage/ImageViewerDialog.java
42 42 private static final String COMMAND_COLLAPSE = "collapse"; 43 43 private static final String COMMAND_FIRST = "first"; 44 44 private static final String COMMAND_LAST = "last"; 45 private static final String COMMAND_COPY_PATH = "copypath"; 45 46 46 47 private ImageDisplay imgDisplay = new ImageDisplay(); 47 48 private boolean centerView = false; … … 111 112 btnDeleteFromDisk.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(scDeleteFromDisk.getKeyStroke(), ADELFROMDISK); 112 113 btnDeleteFromDisk.getActionMap().put(ADELFROMDISK, delFromDiskAction); 113 114 115 ImageAction copyPathAction = new ImageAction(COMMAND_COPY_PATH, ImageProvider.get("", "copy"), tr("Copy image path")); 116 JButton btnCopyPath = new JButton(copyPathAction); 117 btnCopyPath.setPreferredSize(buttonDim); 118 Shortcut scCopyPath = Shortcut.registerShortcut( 119 "geoimage:copypath", tr("Geoimage: {0}", tr("Copy image path")), KeyEvent.VK_C, Shortcut.ALT_CTRL_SHIFT); 120 final String ACOPYPATH = "Copy image path"; 121 Main.registerActionShortcut(copyPathAction, scCopyPath); 122 btnCopyPath.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(scCopyPath.getKeyStroke(), ACOPYPATH); 123 btnCopyPath.getActionMap().put(ACOPYPATH, copyPathAction); 124 114 125 ImageAction nextAction = new ImageAction(COMMAND_NEXT, ImageProvider.get("dialogs", "next"), tr("Next")); 115 126 btnNext = new JButton(nextAction); 116 127 btnNext.setPreferredSize(buttonDim); … … 152 163 buttons.add(Box.createRigidArea(new Dimension(14, 0))); 153 164 buttons.add(btnDelete); 154 165 buttons.add(btnDeleteFromDisk); 166 buttons.add(Box.createRigidArea(new Dimension(14, 0))); 167 buttons.add(btnCopyPath); 155 168 156 169 JPanel bottomPane = new JPanel(); 157 170 bottomPane.setLayout(new GridBagLayout()); … … 221 234 if (currentLayer != null) { 222 235 currentLayer.removeCurrentPhotoFromDisk(); 223 236 } 237 } else if (COMMAND_COPY_PATH.equals(action)) { 238 if (currentLayer != null) { 239 currentLayer.copyCurrentPhotoPath(); 240 } 224 241 } else if (COMMAND_COLLAPSE.equals(action)) { 225 242 collapseButtonClicked = true; 226 243 detachedDialog.getToolkit().getSystemEventQueue().postEvent(new WindowEvent(detachedDialog, WindowEvent.WINDOW_CLOSING));