Changeset 7788 in josm for trunk/src/org


Ignore:
Timestamp:
2014-12-11T14:43:25+01:00 (10 years ago)
Author:
bastiK
Message:

applied #10812 - new copy path feature for geotagged image dialog (patch by alex.menk, slighly modified)

Location:
trunk/src/org/openstreetmap/josm/gui/layer/geoimage
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayer.java

    r7784 r7788  
    1616import java.awt.event.MouseEvent;
    1717import java.awt.image.BufferedImage;
     18import java.awt.datatransfer.Clipboard;
     19import java.awt.datatransfer.StringSelection;
     20import java.awt.Toolkit;
    1821import java.beans.PropertyChangeEvent;
    1922import java.beans.PropertyChangeListener;
     
    757760    }
    758761
     762    public void copyCurrentPhotoPath() {
     763        ImageEntry toCopy = null;
     764        if (data != null && data.size() > 0 && currentPhoto >= 0 && currentPhoto < data.size()) {
     765            toCopy = data.get(currentPhoto);
     766            String copyString = toCopy.getFile().toString();
     767            Utils.copyToClipboard(copyString);
     768        }
     769    }
     770
    759771    /**
    760772     * Removes a photo from the list of images by index.
  • trunk/src/org/openstreetmap/josm/gui/layer/geoimage/ImageViewerDialog.java

    r7660 r7788  
    4343    private static final String COMMAND_FIRST = "first";
    4444    private static final String COMMAND_LAST = "last";
     45    private static final String COMMAND_COPY_PATH = "copypath";
    4546
    4647    private ImageDisplay imgDisplay = new ImageDisplay();
     
    112113        btnDeleteFromDisk.getActionMap().put(ADELFROMDISK, delFromDiskAction);
    113114
     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        final String ACOPYPATH = "Copy image path";
     119        btnCopyPath.getActionMap().put(ACOPYPATH, copyPathAction);
     120
    114121        ImageAction nextAction = new ImageAction(COMMAND_NEXT, ImageProvider.get("dialogs", "next"), tr("Next"));
    115122        btnNext = new JButton(nextAction);
     
    147154        buttons.add(btnPrevious);
    148155        buttons.add(btnNext);
    149         buttons.add(Box.createRigidArea(new Dimension(14, 0)));
     156        buttons.add(Box.createRigidArea(new Dimension(7, 0)));
    150157        buttons.add(tbCentre);
    151158        buttons.add(btnZoomBestFit);
    152         buttons.add(Box.createRigidArea(new Dimension(14, 0)));
     159        buttons.add(Box.createRigidArea(new Dimension(7, 0)));
    153160        buttons.add(btnDelete);
    154161        buttons.add(btnDeleteFromDisk);
     162        buttons.add(Box.createRigidArea(new Dimension(7, 0)));
     163        buttons.add(btnCopyPath);
    155164
    156165        JPanel bottomPane = new JPanel();
     
    222231                    currentLayer.removeCurrentPhotoFromDisk();
    223232                }
     233            } else if (COMMAND_COPY_PATH.equals(action)) {
     234                if (currentLayer != null) {
     235                    currentLayer.copyCurrentPhotoPath();
     236                }
    224237            } else if (COMMAND_COLLAPSE.equals(action)) {
    225238                collapseButtonClicked = true;
Note: See TracChangeset for help on using the changeset viewer.