Ignore:
Timestamp:
09/21/15 13:23:43 (9 years ago)
Author:
bln4
Message:

Made changes to what happens when pasting plan text. Because the code was using the method Frame.createNewText(String) it was being assigned a parent and actually getting added to the frame. However the goal was to attach it to the FreeItems list (cursor).

It now instead uses the constructor of Text to create the item and sets its font by the item template and its position by the mouse cursor.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/io/ItemSelection.java

    r919 r964  
    235235                                String[] items = clip.split("\n\n");
    236236                                Item item, prevItem = null;
     237                                final int x = DisplayIO.getMouseX();
     238                                final int y = DisplayIO.getMouseY();
     239                                final Text template = DisplayIO.getCurrentFrame().getItemTemplate();
    237240                                for(int i = 0; i < items.length; i++) {
    238241                                        // System.out.println(items[i]);
    239242                                        // System.out.println("Created item from string");
    240                                         item = DisplayIO.getCurrentFrame().createNewText(items[i]);
     243//                                      item = DisplayIO.getCurrentFrame().createNewText(items[i]);
     244                                        item = new Text(items[i]);
     245                                        ((Text)item).setFont(template.getFont());
     246                                        item.setX(x);
    241247                                        if(prevItem != null){
    242248                                                item.setY(prevItem.getY() + prevItem.getBoundsHeight());
    243                                         }
     249                                        } else item.setY(y);
    244250                                        f.add(item);
    245251                                        prevItem = item;
Note: See TracChangeset for help on using the changeset viewer.