Ignore:
Timestamp:
05/10/18 16:04:51 (6 years ago)
Author:
davidb
Message:

Reworking of the code-base to separate logic from graphics. This version of Expeditee now supports a JFX graphics as an alternative to SWING

File:
1 edited

Legend:

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

    r919 r1102  
    2525import java.util.List;
    2626
    27 import org.expeditee.gui.DisplayIO;
     27import org.expeditee.core.Point;
     28import org.expeditee.gui.DisplayController;
    2829import org.expeditee.gui.Frame;
    2930import org.expeditee.gui.FrameGraphics;
     
    3738import org.expeditee.items.Line;
    3839import org.expeditee.items.Text;
    39 import org.expeditee.items.widgets.InteractiveWidget;
     40import org.expeditee.items.widgets.Widget;
    4041
    4142/**
     
    5253        private int dX, dY;
    5354       
     55        public ExpClipReader(Point p)
     56        {
     57                this(p.x, p.y);
     58        }
     59       
    5460        public ExpClipReader(int dX, int dY) {
    5561                super("");
     
    6369         */
    6470        public static void updateItems(List<Item> items) {
    65                 if(FrameGraphics.isXRayMode()) {
     71                if(DisplayController.isXRayMode()) {
    6672                        return;
    6773                }
     
    7278                                continue;
    7379                        }
    74                         if (ItemUtils.startsWithTag(item,
    75                                         ItemUtils.TAG_IMAGE, true)) {
     80                        if (ItemUtils.startsWithTag(item, ItemUtils.TAG_IMAGE, true)) {
    7681                                if (!item.hasEnclosures()) {
    77                                         items.add(ItemUtils.CreatePicture((Text) item, DisplayIO.getCurrentFrame()));
     82                                        items.add(ItemUtils.CreatePicture((Text) item));
    7883                                }
    7984                                // check for frame images
     
    8388                                        && !item.getAbsoluteLink()
    8489                                                        .equalsIgnoreCase(
    85                                                                         DisplayIO.getCurrentFrame().getName())) {
     90                                                                        DisplayController.getCurrentFrame().getName())) {
    8691                                if (item.hasEnclosures()) {
    8792                                        // item.setHidden(true);
     
    9095                                        // image.refresh();
    9196                                } else {
    92                                         items.add(new FrameImage((Text) item, DisplayIO.getCurrentFrame(), null));
     97                                        items.add(new FrameImage((Text) item, null));
    9398                                }
    9499                        } else if (ItemUtils.startsWithTag(item,
     
    97102                                        && !item.getAbsoluteLink()
    98103                                                        .equalsIgnoreCase(
    99                                                                         DisplayIO.getCurrentFrame().getName())) {
     104                                                                        DisplayController.getCurrentFrame().getName())) {
    100105                                if (item.hasEnclosures()) {
    101106                                        // image =
     
    107112                                        // frame which already has a bitmap dont
    108113                                        // recreate the bitmap
    109                                         items.add(new FrameBitmap((Text) item, DisplayIO.getCurrentFrame(), null));
     114                                        items.add(new FrameBitmap((Text) item, null));
    110115                                }
    111116                        } else if (ItemUtils.startsWithTag(item, "@c")) {
     
    116121                                }
    117122                                // Check for interactive widgets
    118                         } else if (ItemUtils.startsWithTag(item,
    119                                         ItemUtils.TAG_IWIDGET)) {
     123                        } else if (ItemUtils.startsWithTag(item, ItemUtils.TAG_IWIDGET)) {
    120124                                items.remove(item);
    121                                 item.setParent(DisplayIO.getCurrentFrame());
     125                                item.setParent(DisplayController.getCurrentFrame());
    122126                                try {
    123                                         items.addAll(InteractiveWidget.createWidget((Text) item).getItems());
     127                                        items.addAll(Widget.createWidget((Text) item).getItems());
    124128                                } catch (Exception e) {
    125129                                        System.err.println("Failed to create widget");
     
    176180                        while(index < lines.length && !(lines[++index].equals("Z"))) {
    177181                                if (isValidLine(lines[index])) {
    178                                         java.awt.Point idtype = separateValues(lines[index].substring(2));
     182                                        Point idtype = separateValues(lines[index].substring(2));
    179183                                        // The next line must be the endpoints
    180184                                        if (index >= lines.length)
    181185                                                throw new Exception("Unexpected end of file");
    182186                                        ++index;
    183                                         java.awt.Point startend = separateValues(lines[index].substring(2));
     187                                        Point startend = separateValues(lines[index].substring(2));
    184188                                        int start = startend.x;
    185189                                        int end = startend.y;
     
    199203                        while(index < lines.length && !(lines[++index].equals("Z"))) {
    200204                                if (isValidLine(lines[index])) {
    201                                         java.awt.Point idtype = separateValues(lines[index].substring(2));
     205                                        Point idtype = separateValues(lines[index].substring(2));
    202206                                        // The next line must be the endpoints
    203207                                        if (index >= lines.length)
    204208                                                throw new Exception("Unexpected end of file");
    205209                                        ++index;
    206                                         java.awt.Point startend = separateValues(lines[index].substring(2));
     210                                        Point startend = separateValues(lines[index].substring(2));
    207211       
    208212                                        Item a = _linePoints.get(startend.x);
Note: See TracChangeset for help on using the changeset viewer.