Ignore:
Timestamp:
11/05/19 16:16:11 (5 years ago)
Author:
bnemhaus
Message:

Added the ability to copy/paste recognised files (mostly images) into Expeditee. This functionality already existed when drag n dropping, but now also works when using copy/paste.

At this stage, recognised files get imported as a approapriate Text Item. For example, a image will create a @i Text Item and attach it to your cursor. Ideally this would be the image directly. Unfortunately, items attached to the cursor (FreeItems) are not currently parsed. This is something I will discuss with David as there are confounding issues to consider. For example: surrogates...

Attached to the bottom of this commit message are my current thoughts.

Also made it so when creating a @i through DND or Copy/Paste, that @i is as relative as possible. The users image directories setting is used to achieve this.


  • FreeItems need to be parsed...we would need to deal with primaries/surrogates in them...
  • Do we want FreeItems to be parsed? If I attach an item to my cursor and then enter surrogate mode, should it change?
  • My gut says no. Both because it would be work, and also because it kind of feels like a free win if we do not.
  • But we do want to replace @i with images etc. Therefore, we want an old style parse for FreeItems?
Location:
trunk/src/org/expeditee/gio/swing
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/gio/swing/SwingClipboardManager.java

    r1097 r1436  
    55import java.awt.datatransfer.Transferable;
    66import java.awt.datatransfer.UnsupportedFlavorException;
     7import java.io.File;
    78import java.io.IOException;
    89import java.util.LinkedList;
     
    1011
    1112import org.expeditee.core.Image;
     13import org.expeditee.core.Point;
    1214import org.expeditee.gio.ClipboardManager;
     15import org.expeditee.gio.DragAndDropManager;
     16import org.expeditee.gio.EcosystemManager;
     17import org.expeditee.gui.DisplayController;
    1318
    1419/** TODO: Comment. cts16 */
     
    2126                        SwingClipboardManager.expediteeDataFlavour,
    2227                        DataFlavor.imageFlavor,
    23                         DataFlavor.stringFlavor
     28                        DataFlavor.stringFlavor,
     29                        DataFlavor.javaFileListFlavor
    2430        };
    2531       
     
    8288                } else if (DataFlavor.stringFlavor.equals(flavour)) {
    8389                        out.stringRepresentation = (String) content.getTransferData(flavour);
     90                } else if (DataFlavor.javaFileListFlavor.equals(flavour)) {
     91                        @SuppressWarnings("unchecked")
     92                        List<File> transferData = (List<File>) content.getTransferData(flavour);
     93                        out.fileRepresentation = transferData;
    8494                }
    85         }
     95        }
    8696       
    8797        private Image handleGetImage(Transferable content) throws IOException, UnsupportedFlavorException
  • trunk/src/org/expeditee/gio/swing/SwingDragAndDropManager.java

    r1097 r1436  
    115115
    116116                                                if (str != null && str.length() > 0) {
    117                                                         importString(str, expediteeDropPoint);
     117                                                        importString(str, expediteeDropPoint, false);
    118118                                                        return true;
    119119                                                }
     
    125125                                                List<? extends File> files = (List<? extends File>) support.getTransferable().getTransferData(DataFlavor.javaFileListFlavor);
    126126
    127                                                 importFileList(files, expediteeDropPoint);
     127                                                importFileList(files, expediteeDropPoint, false);
    128128
    129129                                                return true;
     
    136136                                                List<File> files = textURIListToFileList(data);
    137137
    138                                                 importFileList(files, expediteeDropPoint);
     138                                                importFileList(files, expediteeDropPoint, false);
    139139
    140140                                                return true;
     
    148148                                                List<File> files = textURIListToFileList(uriString);
    149149
    150                                                 importFileList(files, expediteeDropPoint);
     150                                                importFileList(files, expediteeDropPoint, false);
    151151
    152152                                                return true;
Note: See TracChangeset for help on using the changeset viewer.