Changeset 1144 for trunk/src


Ignore:
Timestamp:
09/18/18 12:02:44 (6 years ago)
Author:
bln4
Message:

Used Eclipse refactoring to encapsulate Point.X and Point.Y

Location:
trunk/src/org/expeditee
Files:
23 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/gio/gesture/ExpediteeKBMGestureTranslator.java

    r1135 r1144  
    406406                                // Calculate the new cursor position
    407407                                Point cursorPosition = EcosystemManager.getInputManager().getCursorPosition();
    408                                 if (kbmEvent.getKeyDown() == Key.UP_ARROW) cursorPosition.y -= distance;
    409                                 if (kbmEvent.getKeyDown() == Key.DOWN_ARROW) cursorPosition.y += distance;
    410                                 if (kbmEvent.getKeyDown() == Key.LEFT_ARROW) cursorPosition.x -= distance;
    411                                 if (kbmEvent.getKeyDown() == Key.RIGHT_ARROW) cursorPosition.x += distance;
     408                                if (kbmEvent.getKeyDown() == Key.UP_ARROW) cursorPosition.setY(cursorPosition.getY() - distance);
     409                                if (kbmEvent.getKeyDown() == Key.DOWN_ARROW) cursorPosition.setY(cursorPosition.getY() + distance);
     410                                if (kbmEvent.getKeyDown() == Key.LEFT_ARROW) cursorPosition.setX(cursorPosition.getX() - distance);
     411                                if (kbmEvent.getKeyDown() == Key.RIGHT_ARROW) cursorPosition.setX(cursorPosition.getX() + distance);
    412412                               
    413413                                // Create the MOVE_CURSOR gesture and return it
  • trunk/src/org/expeditee/gio/gesture/StandardGestureActions.java

    r1136 r1144  
    607607                        public void exec(Gesture gesture) {
    608608                                PanGestureData data = (PanGestureData) gesture.getData();
    609                                 Misc.pan(DisplayController.getCurrentFrame(), data.getPanDelta().x, data.getPanDelta().y);
     609                                Misc.pan(DisplayController.getCurrentFrame(), data.getPanDelta().getX(), data.getPanDelta().getY());
    610610                        }
    611611                });
     
    658658                                                        int width = cropped.getWidth();
    659659                                                        int height = cropped.getHeight();
    660                                                         if(cropped.getSource().getX() + width < data.getPosition().x) {
    661                                                                 cropped.getSource().setX(data.getPosition().x - width);
     660                                                        if(cropped.getSource().getX() + width < data.getPosition().getX()) {
     661                                                                cropped.getSource().setX(data.getPosition().getX() - width);
    662662                                                        }
    663                                                         if(cropped.getSource().getY() + height < data.getPosition().y) {
    664                                                                 cropped.getSource().setY(data.getPosition().y - height);
     663                                                        if(cropped.getSource().getY() + height < data.getPosition().getY()) {
     664                                                                cropped.getSource().setY(data.getPosition().getY() - height);
    665665                                                        }
    666666                                                        pickup(cropped);
     
    10551055                                // class returns 0 for getX
    10561056                                if (!(i instanceof Line) && !(i instanceof XRayable)) {
    1057                                         _offX = DisplayController.getMouseX() - i.getX() + i.getOffset().x;
    1058                                         _offY = DisplayController.getMouseY() - i.getY() + i.getOffset().y;
     1057                                        _offX = DisplayController.getMouseX() - i.getX() + i.getOffset().getX();
     1058                                        _offY = DisplayController.getMouseY() - i.getY() + i.getOffset().getY();
    10591059
    10601060                                        // make the offset item the first item in the list (so
     
    10711071                } else if (toGrab.size() == 1) {
    10721072                        Item soleItem = toGrab.iterator().next();
    1073                         _offX = DisplayController.getMouseX() - soleItem.getX() + soleItem.getOffset().x;
    1074                         _offY = DisplayController.getMouseY() - soleItem.getY() + soleItem.getOffset().y;
     1073                        _offX = DisplayController.getMouseX() - soleItem.getX() + soleItem.getOffset().getX();
     1074                        _offY = DisplayController.getMouseY() - soleItem.getY() + soleItem.getOffset().getY();
    10751075                        // Now call move so that if we are on a message in the message box
    10761076                        // It doesn't appear up the top of the screen!!
     
    12301230               
    12311231                // check if the user hit enter and the cursor is now on another text item
    1232                 if (oldY < newMouse.y) {
     1232                if (oldY < newMouse.getY()) {
    12331233                        AxisAlignedBoxBounds rect = text.getBoundingBox();
    12341234
     
    12451245                }
    12461246
    1247                 DisplayController.setCursorPosition(newMouse.x, newMouse.y, false);
     1247                DisplayController.setCursorPosition(newMouse.getX(), newMouse.getY(), false);
    12481248                return text;
    12491249        }
     
    12631263                Item firstDot = toMove.iterator().next();
    12641264               
    1265                 int deltax = (to.x - (cursor ? 0 : _offX)) - firstDot.getX();
    1266                 int deltay = (to.y - (cursor ? 0 : _offY)) - firstDot.getY();
     1265                int deltax = (to.getX() - (cursor ? 0 : _offX)) - firstDot.getX();
     1266                int deltay = (to.getY() - (cursor ? 0 : _offY)) - firstDot.getY();
    12671267               
    12681268                // Cache the position of all items before moving any as constraints
     
    12751275                for (Item move : toMove) {
    12761276                        Point pos = preMovePositions.get(move);
    1277                         move.setPosition(pos.x + deltax, pos.y + deltay);
     1277                        move.setPosition(pos.getX() + deltax, pos.getY() + deltay);
    12781278
    12791279                        if (!cursor && move instanceof Text) {
     
    13651365        public static void resetOffset() {
    13661366                if (FreeItems.hasItemsAttachedToCursor()) {
    1367                         _offX = DisplayController.getMouseX() - FreeItems.getInstance().get(0).getX() + FreeItems.getInstance().get(0).getOffset().x;
    1368                         _offY = DisplayController.getMouseY() - FreeItems.getInstance().get(0).getY() + FreeItems.getInstance().get(0).getOffset().y;
     1367                        _offX = DisplayController.getMouseX() - FreeItems.getInstance().get(0).getX() + FreeItems.getInstance().get(0).getOffset().getX();
     1368                        _offY = DisplayController.getMouseY() - FreeItems.getInstance().get(0).getY() + FreeItems.getInstance().get(0).getOffset().getY();
    13691369                }
    13701370        }
     
    20162016                if (zoom_active) {
    20172017                       
    2018                         zoomFrame(DisplayController.getCurrentFrame(), scaleFactor, centreOfZoom.x, centreOfZoom.y);
     2018                        zoomFrame(DisplayController.getCurrentFrame(), scaleFactor, centreOfZoom.getX(), centreOfZoom.getY());
    20192019                        DisplayController.getCurrentFrame().refreshSize();
    20202020                        Refresh();
     
    22332233                Point oldMousePosition = DisplayController.getMousePosition();
    22342234
    2235                 if (oldMousePosition.x == x && oldMousePosition.y == y) return;
     2235                if (oldMousePosition.getX() == x && oldMousePosition.getY() == y) return;
    22362236
    22372237                DisplayController.setCursorPosition(x, y);
     
    29862986
    29872987                                // update the offset since the text has changed
    2988                                 _offX = DisplayController.getMouseX() - anchored.getX() + anchored.getOffset().x;
    2989                                 _offY = DisplayController.getMouseY() - anchored.getY() + anchored.getOffset().y;
     2988                                _offX = DisplayController.getMouseX() - anchored.getX() + anchored.getOffset().getX();
     2989                                _offY = DisplayController.getMouseY() - anchored.getY() + anchored.getOffset().getY();
    29902990                        } else {
    29912991                                // if shift is pressed delete the entire shape attached to the dot
     
    42304230                if (clicked == null) {
    42314231                        // Check if the user is nearby another item...
    4232                         int mouseX = position.x;
    4233                         int mouseY = position.y;
     4232                        int mouseX = position.getX();
     4233                        int mouseY = position.getY();
    42344234                        // System.out.println(mouseX + "," + mouseY);
    42354235                        for (Item i : DisplayController.getCurrentFrame().getItems()) {
     
    43034303               
    43044304                if (clicked instanceof Picture) {
    4305                         int mouseX = position.x;
    4306                         int mouseY = position.y;
     4305                        int mouseX = position.getX();
     4306                        int mouseY = position.getY();
    43074307                        Picture clickedOnPicture = (Picture)clicked;
    43084308                        Frame current_frame = DisplayController.getCurrentFrame();
  • trunk/src/org/expeditee/gio/javafx/JavaFXConversions.java

    r1097 r1144  
    4343                CycleMethod cyclic = fill.isAcyclic() ? CycleMethod.NO_CYCLE : CycleMethod.REFLECT;
    4444                return new javafx.scene.paint.LinearGradient(
    45                                         fill.getFromPoint().x,
    46                                         fill.getFromPoint().y,
    47                                         fill.getToPoint().x,
    48                                         fill.getToPoint().y,
     45                                        fill.getFromPoint().getX(),
     46                                        fill.getFromPoint().getY(),
     47                                        fill.getToPoint().getX(),
     48                                        fill.getToPoint().getY(),
    4949                                        false,
    5050                                        cyclic,
  • trunk/src/org/expeditee/gio/javafx/JavaFXGraphicsManager.java

    r1097 r1144  
    171171                Point newStagePos = p.clone().add(delta);
    172172               
    173                 ExpediteeApplication.theStage.setX(newStagePos.x);
    174                 ExpediteeApplication.theStage.setY(newStagePos.y);
     173                ExpediteeApplication.theStage.setX(newStagePos.getX());
     174                ExpediteeApplication.theStage.setY(newStagePos.getY());
    175175        }
    176176
     
    354354                if (cropTopLeft != null && cropSize != null) {
    355355                        croppedImage = manager.createImage(cropSize.width, cropSize.height);
    356                         manager.getInternalImage(croppedImage).getPixelWriter().setPixels(0, 0, cropSize.width, cropSize.height, manager.getInternalImage(image).getPixelReader(), cropTopLeft.x, cropTopLeft.y);
     356                        manager.getInternalImage(croppedImage).getPixelWriter().setPixels(0, 0, cropSize.width, cropSize.height, manager.getInternalImage(image).getPixelReader(), cropTopLeft.getX(), cropTopLeft.getY());
    357357                }
    358358               
     
    362362                if (size != null) g.scale(((double) size.width) / croppedImage.getWidth(), ((double) size.height) / croppedImage.getHeight());
    363363                if (angle != 0.0) g.rotate(angle);
    364                 if (topLeft != null) g.translate(topLeft.x, topLeft.y);
     364                if (topLeft != null) g.translate(topLeft.getX(), topLeft.getY());
    365365                g.drawImage(JavaFXMiscManager.getIfUsingJavaFXImageManager().getInternalImage(croppedImage), 0, 0);
    366366                g.restore();
     
    383383                g.save();
    384384
    385                 Point centre = new Point(topLeft.x + size.width / 2, topLeft.y + size.height / 2);
    386                 g.translate(-centre.x, -centre.y);
     385                Point centre = new Point(topLeft.getX() + size.width / 2, topLeft.getY() + size.height / 2);
     386                g.translate(-centre.getX(), -centre.getY());
    387387                if (angle != 0.0) g.rotate(angle);
    388                 g.translate(centre.x, centre.y);
     388                g.translate(centre.getX(), centre.getY());
    389389               
    390390                if (fill != null) {
     
    396396                       
    397397                        if (cornerRadius == null) {
    398                                 g.fillRect(topLeft.x, topLeft.y, size.width, size.height);
     398                                g.fillRect(topLeft.getX(), topLeft.getY(), size.width, size.height);
    399399                        } else {
    400                                 g.fillRoundRect(topLeft.x, topLeft.y, size.width, size.height, cornerRadius.width, cornerRadius.height);
     400                                g.fillRoundRect(topLeft.getX(), topLeft.getY(), size.width, size.height, cornerRadius.width, cornerRadius.height);
    401401                        }
    402402                }
     
    407407
    408408                        if (cornerRadius == null) {
    409                                 g.strokeRect(topLeft.x, topLeft.y, size.width, size.height);
     409                                g.strokeRect(topLeft.getX(), topLeft.getY(), size.width, size.height);
    410410                        } else {
    411                                 g.strokeRoundRect(topLeft.x, topLeft.y, size.width, size.height, cornerRadius.width, cornerRadius.height);
     411                                g.strokeRoundRect(topLeft.getX(), topLeft.getY(), size.width, size.height, cornerRadius.width, cornerRadius.height);
    412412                        }
    413413                }
     
    433433
    434434                if (angle != 0.0) {
    435                         g.translate(-centre.x, -centre.y);
     435                        g.translate(-centre.getX(), -centre.getY());
    436436                        g.rotate(angle);
    437                         g.translate(centre.x, centre.y);
     437                        g.translate(centre.getX(), centre.getY());
    438438                }
    439439               
     
    445445                        }
    446446                       
    447                         g.fillOval(centre.x - diameters.width / 2, centre.y - diameters.height / 2, diameters.width, diameters.height);
     447                        g.fillOval(centre.getX() - diameters.width / 2, centre.getY() - diameters.height / 2, diameters.width, diameters.height);
    448448                }
    449449               
     
    452452                        setStroke(g, borderStroke);
    453453
    454                         g.strokeOval(centre.x - diameters.width / 2, centre.y - diameters.height / 2, diameters.width, diameters.height);
     454                        g.strokeOval(centre.getX() - diameters.width / 2, centre.getY() - diameters.height / 2, diameters.width, diameters.height);
    455455                }
    456456               
     
    469469
    470470                Point centre = points.getCentre();
    471                 g.translate(-centre.x, -centre.y);
     471                g.translate(-centre.getX(), -centre.getY());
    472472                if (angle != 0.0) g.rotate(angle);
    473473                if (scale != null) {
     
    476476                        g.scale(xScale, yScale);
    477477                }
    478                 g.translate(centre.x, centre.y);
    479                 if (offset != null) g.translate(offset.x, offset.y);
     478                g.translate(centre.getX(), centre.getY());
     479                if (offset != null) g.translate(offset.getX(), offset.getY());
    480480               
    481481                Point[] pointArray = points.toArray();
     
    485485               
    486486                for (int i = 0; i < nPoints; i++) {
    487                         xArray[i] = pointArray[i].x + 0.5;
    488                         yArray[i] = pointArray[i].y + 0.5;
     487                        xArray[i] = pointArray[i].getX() + 0.5;
     488                        yArray[i] = pointArray[i].getY() + 0.5;
    489489                }
    490490               
     
    561561                g.setFill(JavaFXConversions.toJavaFXColor(colour));
    562562               
    563                 g.fillText(text.getText(), position.x, position.y);
     563                g.fillText(text.getText(), position.getX(), position.getY());
    564564               
    565565                g.restore();
  • trunk/src/org/expeditee/gio/javafx/JavaFXInputManager.java

    r1097 r1144  
    241241        {
    242242                Point screenPosition = windowToScreenPosition(position);
    243                 _robot.mouseMove(screenPosition.x, screenPosition.y);
     243                _robot.mouseMove(screenPosition.getX(), screenPosition.getY());
    244244        }
    245245
  • trunk/src/org/expeditee/gio/javafx/JavaFXTextLayoutManager.java

    r1097 r1144  
    250250                       
    251251                        endIndex = startIndex + text.getText().length();
    252                         text.setX(start.x);
    253                         text.setY(start.y);
     252                        text.setX(start.getX());
     253                        text.setY(start.getY());
    254254
    255255                        if (fullJustify && endIndex < string.length()) {
     
    265265                                lineDrop += lineSpacing;
    266266                        }
    267                         start.y += lineDrop;
     267                        start.setY(start.getY() + lineDrop);
    268268                        positions.add(new Point(start));
    269269                }
  • trunk/src/org/expeditee/gio/swing/SwingConversions.java

    r1097 r1144  
    4040                if (point == null) return null;
    4141               
    42                 return new java.awt.Point(point.x, point.y);
     42                return new java.awt.Point(point.getX(), point.getY());
    4343        }
    4444       
     
    170170                java.awt.Color color2 = toSwingColor(fill.getToColour());
    171171               
    172                 return new java.awt.GradientPaint(fill.getFromPoint().x, fill.getFromPoint().y, color1, fill.getToPoint().x, fill.getToPoint().y, color2, !fill.isAcyclic());
     172                return new java.awt.GradientPaint(fill.getFromPoint().getX(), fill.getFromPoint().getY(), color1, fill.getToPoint().getX(), fill.getToPoint().getY(), color2, !fill.isAcyclic());
    173173        }
    174174       
     
    274274                for (int i = 0; i < polygonBounds.getPointCount(); i++) {
    275275                        org.expeditee.core.Point p = polygonBounds.getPoint(i);
    276                         polygon.addPoint(p.x, p.y);
     276                        polygon.addPoint(p.getX(), p.getY());
    277277                }
    278278               
  • trunk/src/org/expeditee/gio/swing/SwingGraphicsManager.java

    r1113 r1144  
    4747// TODO: Make stack thread-safe
    4848public class SwingGraphicsManager extends GraphicsManager {
    49        
     49
    5050        private static SwingGraphicsManager _instance;
    51        
    52         public static SwingGraphicsManager getInstance()
    53         {
     51
     52        public static SwingGraphicsManager getInstance() {
    5453                if (_instance == null) {
    5554                        try {
     
    6564                                System.exit(1);
    6665                        }
    67                        
     66
    6867                        // Block until the window is ready
    69                        
    70                 }
    71                
     68
     69                }
     70
    7271                return _instance;
    7372        }
    74        
     73
    7574        private JFrame _jFrame;
    76        
     75
    7776        private GraphicsSurfaceStack<Graphics2D> _surfaceStack;
    78        
    79         private SwingGraphicsManager()
    80         {
     77
     78        private SwingGraphicsManager() {
    8179                _jFrame = new JFrame() {
    8280                        private static final long serialVersionUID = 5179259234365906415L;
     
    8583                        // when the window refreshes.
    8684                        @Override
    87                         public void paint(Graphics g)
    88                         {
     85                        public void paint(Graphics g) {
    8986                                DisplayController.requestRefresh(false);
    9087                        }
    9188                };
    92                
     89
    9390                setWindowIcon();
    94                
     91
    9592                /*
    96                  * See Java bug ID 4016934. They say that window closed events are
    97                  * called once the JFrame is disposed.
     93                 * See Java bug ID 4016934. They say that window closed events are called once
     94                 * the JFrame is disposed.
    9895                 */
    9996                _jFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    100                
     97
    10198                // Expeditee handles its own repainting of AWT/Swing components
    10299                RepaintManager.setCurrentManager(ExpediteeRepaintManager.getInstance());
    103                
     100
    104101                // required to accept TAB key
    105102                _jFrame.setFocusTraversalKeysEnabled(false);
    106                
     103
    107104                _jFrame.pack();
    108                
     105
    109106                // Moved to here to work with JFXPanel
    110107                // TODO: Is the above comment still relevant? cts16
    111108                _jFrame.getContentPane().setLayout(new AbsoluteLayout());
    112                
    113                 // Set visible must be just after DisplayIO.Init for the message box to be the right size
     109
     110                // Set visible must be just after DisplayIO.Init for the message box to be the
     111                // right size
    114112                // TODO: Is the above comment still relevant? cts16
    115113                _jFrame.setVisible(true);
    116                
     114
    117115                // Create the surface stack
    118116                _surfaceStack = new GraphicsSurfaceStack<Graphics2D>() {
    119117                        @Override
    120                         public Graphics2D getSurfaceFromImage(Image image)
    121                         {
     118                        public Graphics2D getSurfaceFromImage(Image image) {
    122119                                return SwingMiscManager.getIfUsingSwingImageManager().getImageGraphics(image);
    123120                        }
    124                        
     121
    125122                        @Override
    126                         public void setSurfaceClip(Graphics2D surface, Clip clip)
    127                         {
    128                                 if (surface == null) return;
    129                                
     123                        public void setSurfaceClip(Graphics2D surface, Clip clip) {
     124                                if (surface == null)
     125                                        return;
     126
    130127                                if (clip == null) {
    131128                                        surface.setClip(null);
    132129                                        return;
    133130                                }
    134                                
    135                                 if (clip.isFullyClipped()) return;
    136                                
     131
     132                                if (clip.isFullyClipped())
     133                                        return;
     134
    137135                                surface.setClip(SwingConversions.toSwingRectangle(clip.getBounds()));
    138136                        }
     
    140138                refreshRootSurface();
    141139        }
    142        
    143         @Override
    144         protected GraphicsSurfaceStack<?> getGraphicsSurfaceStack()
    145         {
     140
     141        @Override
     142        protected GraphicsSurfaceStack<?> getGraphicsSurfaceStack() {
    146143                return _surfaceStack;
    147144        }
    148        
    149         public Dimension getScreenSize()
    150         {
     145
     146        public Dimension getScreenSize() {
    151147                java.awt.Dimension size = Toolkit.getDefaultToolkit().getScreenSize();
    152                
     148
    153149                return SwingConversions.fromSwingDimension(size);
    154150        }
    155        
    156         public Point getWindowLocation()
    157         {
     151
     152        public Point getWindowLocation() {
    158153                return SwingConversions.fromSwingPoint(_jFrame.getContentPane().getLocationOnScreen());
    159154        }
    160        
    161         public void setWindowLocation(Point p)
    162         {
    163                 _jFrame.setLocation(p.x, p.y);
    164         }
    165        
    166         public Dimension getWindowSize()
    167         {
     155
     156        public void setWindowLocation(Point p) {
     157                _jFrame.setLocation(p.getX(), p.getY());
     158        }
     159
     160        public Dimension getWindowSize() {
    168161                return SwingConversions.fromSwingDimension(_jFrame.getContentPane().getSize());
    169162        }
    170        
    171         public void setWindowSize(Dimension d)
    172         {
     163
     164        public void setWindowSize(Dimension d) {
    173165                _jFrame.setSize(d.width, d.height);
    174166                _jFrame.setPreferredSize(SwingConversions.toSwingDimension(d));
    175                 //Issue a command to graphics so that the JFrame draws itself white.
     167                // Issue a command to graphics so that the JFrame draws itself white.
    176168                _jFrame.getGraphics().clearRect(0, 0, d.width, d.height);
    177169        }
    178        
    179         public void requestFocus()
    180         {
     170
     171        public void requestFocus() {
    181172                _jFrame.requestFocus();
    182173        }
    183        
    184         public void setCompositeAlpha(float alpha)
    185         {
     174
     175        public void setCompositeAlpha(float alpha) {
    186176                _surfaceStack.getCurrentSurface().setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alpha));
    187177        }
    188        
    189         public void setAntialiasing(boolean on)
    190         {
     178
     179        public void setAntialiasing(boolean on) {
    191180                setAntialiasing(_surfaceStack.getCurrentSurface(), on);
    192181        }
    193        
    194         private void setAntialiasing(Graphics2D surface, boolean on)
    195         {
    196                 if (surface == null) return;
    197                
     182
     183        private void setAntialiasing(Graphics2D surface, boolean on) {
     184                if (surface == null)
     185                        return;
     186
    198187                if (on) {
    199188                        surface.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
     
    202191                }
    203192        }
    204        
    205         public void setFont(Font font)
    206         {
     193
     194        public void setFont(Font font) {
    207195                _surfaceStack.getCurrentSurface().setFont(SwingMiscManager.getIfUsingSwingFontManager().getInternalFont(font));
    208196        }
    209        
    210         public void drawImage(Image image, Point topLeft, Dimension size, double angle, Point cropTopLeft, Dimension cropSize)
    211         {
     197
     198        public void drawImage(Image image, Point topLeft, Dimension size, double angle, Point cropTopLeft,
     199                        Dimension cropSize) {
    212200                // Can't draw nothing
    213                 if (image == null) return;
    214                
     201                if (image == null)
     202                        return;
     203
    215204                // Can't draw nowhere
    216                 if (topLeft == null) return;
    217                
     205                if (topLeft == null)
     206                        return;
     207
    218208                // If the cropped area is degenerate, abort
    219                 if (cropSize != null && (cropSize.width <= 0 || cropSize.height <= 0)) return;
    220                
     209                if (cropSize != null && (cropSize.width <= 0 || cropSize.height <= 0))
     210                        return;
     211
    221212                // If the crop area is the entire image, pretend we are not cropping
    222213                if (Point.ORIGIN.equals(cropTopLeft) && image.getSize().equals(cropSize)) {
     
    224215                        cropSize = null;
    225216                }
    226                
     217
    227218                SwingImageManager manager = SwingMiscManager.getIfUsingSwingImageManager();
    228                
     219
    229220                ImageObserver animator = null;
    230221                if (image.isAnimated()) {
    231222                        animator = manager.getAnimator(image);
    232                         if (animator != null) ((SelfAnimatingImageObserver)animator).activate();
     223                        if (animator != null)
     224                                ((SelfAnimatingImageObserver) animator).activate();
    233225                } else {
    234226                        animator = new SwingImageManager.LoadCompletedImageObserver();
    235227                }
    236                
     228
    237229                // Default is the entire image
    238230                Image croppedImage = image;
    239                
     231
    240232                // If we are cropping, do this now into a temporary image
    241233                if (cropTopLeft != null && cropSize != null) {
    242234                        croppedImage = manager.createImage(cropSize.width, cropSize.height);
    243                         manager.getInternalImage(croppedImage).getGraphics().drawImage(manager.getInternalImage(image), 0, 0, cropSize.width - 1, cropSize.height - 1, cropTopLeft.x, cropTopLeft.y, cropTopLeft.x + cropSize.width - 1, cropTopLeft.y + cropSize.height - 1, animator);
     235                        manager.getInternalImage(croppedImage).getGraphics().drawImage(manager.getInternalImage(image), 0, 0,
     236                                        cropSize.width - 1, cropSize.height - 1, cropTopLeft.getX(), cropTopLeft.getY(),
     237                                        cropTopLeft.getX() + cropSize.width - 1, cropTopLeft.getY() + cropSize.height - 1, animator);
    244238                        animator = new BlockingImageObserver();
    245239                }
    246                
     240
    247241                // Transform the image
    248242                AffineTransform tx = new AffineTransform();
    249                 if (size != null) tx.scale(((double) size.width) / croppedImage.getWidth(), ((double) size.height) / croppedImage.getHeight());
    250                 if (angle != 0.0) tx.rotate(angle);
    251                 if (topLeft != null) tx.translate(topLeft.x, topLeft.y);
    252                
     243                if (size != null)
     244                        tx.scale(((double) size.width) / croppedImage.getWidth(),
     245                                        ((double) size.height) / croppedImage.getHeight());
     246                if (angle != 0.0)
     247                        tx.rotate(angle);
     248                if (topLeft != null)
     249                        tx.translate(topLeft.getX(), topLeft.getY());
     250
    253251                // Draw the image to the current surface
    254                 boolean drawn = _surfaceStack.getCurrentSurface().drawImage(manager.getInternalImage(croppedImage), tx, animator);
    255                
     252                boolean drawn = _surfaceStack.getCurrentSurface().drawImage(manager.getInternalImage(croppedImage), tx,
     253                                animator);
     254
    256255                // If the draw didn't succeed, try again after waiting for the image to load
    257256                if (!drawn && animator instanceof BlockingImageObserver) {
     
    260259                }
    261260        }
    262        
    263         public void drawRectangle(Point topLeft, Dimension size, double angle, Fill fill, Colour borderColour, Stroke borderStroke, Dimension cornerRadius)
    264         {
     261
     262        public void drawRectangle(Point topLeft, Dimension size, double angle, Fill fill, Colour borderColour,
     263                        Stroke borderStroke, Dimension cornerRadius) {
    265264                Graphics2D g = (Graphics2D) _surfaceStack.getCurrentSurface().create();
    266                
     265
    267266                if (angle != 0.0) {
    268267                        AffineTransform tx = new AffineTransform();
     
    270269                        g.transform(tx);
    271270                }
    272                
     271
    273272                if (fill != null) {
    274273                        if (fill instanceof GradientFill) {
     
    277276                                g.setColor(SwingConversions.toSwingColor(fill.getColour()));
    278277                        }
    279                        
     278
    280279                        if (cornerRadius != null) {
    281                                 g.fillRoundRect(topLeft.x, topLeft.y, size.width, size.height, cornerRadius.width, cornerRadius.height);
     280                                g.fillRoundRect(topLeft.getX(), topLeft.getY(), size.width, size.height, cornerRadius.width, cornerRadius.height);
    282281                        } else {
    283                                 g.fillRect(topLeft.x, topLeft.y, size.width, size.height);
    284                         }
    285                 }
    286                
     282                                g.fillRect(topLeft.getX(), topLeft.getY(), size.width, size.height);
     283                        }
     284                }
     285
    287286                if (borderColour != null && borderStroke != null) {
    288287                        g.setColor(SwingConversions.toSwingColor(borderColour));
     
    290289
    291290                        if (cornerRadius != null) {
    292                                 g.drawRoundRect(topLeft.x, topLeft.y, size.width, size.height, cornerRadius.width, cornerRadius.height);
     291                                g.drawRoundRect(topLeft.getX(), topLeft.getY(), size.width, size.height, cornerRadius.width, cornerRadius.height);
    293292                        } else {
    294                                 g.drawRect(topLeft.x, topLeft.y, size.width, size.height);
    295                         }
    296                 }
    297                
     293                                g.drawRect(topLeft.getX(), topLeft.getY(), size.width, size.height);
     294                        }
     295                }
     296
    298297                g.dispose();
    299298        }
    300        
    301         public void drawOval(Point centre, Dimension diameters, double angle, Fill fill, Colour borderColour, Stroke borderStroke)
    302         {
     299
     300        public void drawOval(Point centre, Dimension diameters, double angle, Fill fill, Colour borderColour,
     301                        Stroke borderStroke) {
    303302                Graphics2D g = (Graphics2D) _surfaceStack.getCurrentSurface().create();
    304                
     303
    305304                if (angle != 0.0) {
    306305                        AffineTransform tx = new AffineTransform();
     
    308307                        g.transform(tx);
    309308                }
    310                
    311                 Point topLeft = new Point(centre.x - diameters.width / 2, centre.y - diameters.height / 2);
    312                
     309
     310                Point topLeft = new Point(centre.getX() - diameters.width / 2, centre.getY() - diameters.height / 2);
     311
    313312                if (fill != null) {
    314313                        if (fill instanceof GradientFill) {
     
    317316                                g.setColor(SwingConversions.toSwingColor(fill.getColour()));
    318317                        }
    319                        
    320                         g.fillOval(topLeft.x, topLeft.y, diameters.width, diameters.height);
    321                 }
    322                
     318
     319                        g.fillOval(topLeft.getX(), topLeft.getY(), diameters.width, diameters.height);
     320                }
     321
    323322                if (borderColour != null && borderStroke != null) {
    324323                        g.setColor(SwingConversions.toSwingColor(borderColour));
    325324                        g.setStroke(SwingConversions.toSwingStroke(borderStroke));
    326325
    327                         g.drawOval(topLeft.x, topLeft.y, diameters.width, diameters.height);
    328                 }
    329                
     326                        g.drawOval(topLeft.getX(), topLeft.getY(), diameters.width, diameters.height);
     327                }
     328
    330329                g.dispose();
    331330        }
    332        
    333         public void drawPolygon(PolygonBounds points, Point offset, Dimension scale, double angle, Fill fill, Colour borderColour, Stroke borderStroke)
    334         {
    335                 if (points == null || points.getPointCount() < 2) return;
    336                 if (fill == null && (borderColour == null || borderStroke == null)) return;
    337                
     331
     332        public void drawPolygon(PolygonBounds points, Point offset, Dimension scale, double angle, Fill fill,
     333                        Colour borderColour, Stroke borderStroke) {
     334                if (points == null || points.getPointCount() < 2)
     335                        return;
     336                if (fill == null && (borderColour == null || borderStroke == null))
     337                        return;
     338
    338339                Graphics2D g = (Graphics2D) _surfaceStack.getCurrentSurface().create();
    339                
     340
    340341                AffineTransform tx = new AffineTransform();
    341342                Point centre = points.getCentre();
    342                 tx.translate(-centre.x, -centre.y);
    343                 if (angle != 0.0) tx.rotate(angle);
     343                tx.translate(-centre.getX(), -centre.getY());
     344                if (angle != 0.0)
     345                        tx.rotate(angle);
    344346                if (scale != null) {
    345347                        double xScale = ((double) scale.width) / (points.getMaxX() - points.getMinX());
     
    347349                        tx.scale(xScale, yScale);
    348350                }
    349                 tx.translate(centre.x, centre.y);
    350                 if (offset != null) tx.translate(offset.x, offset.y);
     351                tx.translate(centre.getX(), centre.getY());
     352                if (offset != null)
     353                        tx.translate(offset.getX(), offset.getY());
    351354                g.transform(tx);
    352                
     355
    353356                if (fill != null) {
    354357                        if (fill instanceof GradientFill) {
     
    357360                                g.setColor(SwingConversions.toSwingColor(fill.getColour()));
    358361                        }
    359                        
     362
    360363                        g.fillPolygon(SwingConversions.toSwingPolygon(points));
    361364                }
    362                
     365
    363366                if (borderColour != null && borderStroke != null) {
    364367                        g.setColor(SwingConversions.toSwingColor(borderColour));
     
    371374                                int[] xPoints = new int[nPoints];
    372375                                int[] yPoints = new int[nPoints];
    373                                
     376
    374377                                for (int i = 0; i < nPoints; i++) {
    375378                                        Point point = points.getPoint(i);
    376                                         xPoints[i] = point.x;
    377                                         yPoints[i] = point.y;
     379                                        xPoints[i] = point.getX();
     380                                        yPoints[i] = point.getY();
    378381                                }
    379                                
     382
    380383                                g.drawPolyline(xPoints, yPoints, nPoints);
    381384                        }
    382385                }
    383                
     386
    384387                g.dispose();
    385388        }
    386        
    387         @Override
    388         public void drawLine(int x1, int y1, int x2, int y2, Colour colour, Stroke stroke)
    389         {
    390                 if (colour == null || stroke == null) return;
    391                
     389
     390        @Override
     391        public void drawLine(int x1, int y1, int x2, int y2, Colour colour, Stroke stroke) {
     392                if (colour == null || stroke == null)
     393                        return;
     394
    392395                Graphics2D g = (Graphics2D) _surfaceStack.getCurrentSurface().create();
    393396                g.setColor(SwingConversions.toSwingColor(colour));
    394397                g.setStroke(SwingConversions.toSwingStroke(stroke));
    395                
     398
    396399                g.drawLine(x1, y1, x2, y2);
    397                
     400
    398401                g.dispose();
    399402        }
    400403
    401404        @Override
    402         public void drawString(String string, Point position, Font font, Colour colour)
    403         {
    404                 if (string == null || position == null || font == null || colour == null) return;
    405                
     405        public void drawString(String string, Point position, Font font, Colour colour) {
     406                if (string == null || position == null || font == null || colour == null)
     407                        return;
     408
    406409                Graphics2D g = (Graphics2D) _surfaceStack.getCurrentSurface().create();
    407410                g.setColor(SwingConversions.toSwingColor(colour));
    408411                g.setFont(SwingMiscManager.getIfUsingSwingFontManager().getInternalFont(font));
    409                
    410                 g.drawString(string, position.x, position.y);
    411                
     412
     413                g.drawString(string, position.getX(), position.getY());
     414
    412415                g.dispose();
    413416        }
    414        
    415         @Override
    416         public void drawTextLayout(TextLayout layout, Point position, Colour colour)
    417         {
    418                 if (layout == null) return;
    419                
     417
     418        @Override
     419        public void drawTextLayout(TextLayout layout, Point position, Colour colour) {
     420                if (layout == null)
     421                        return;
     422
    420423                SwingTextLayoutManager layoutManager = SwingMiscManager.getIfUsingSwingTextLayoutManager();
    421424                if (layoutManager == null) {
     
    423426                        return;
    424427                }
    425                
     428
    426429                java.awt.font.TextLayout swingLayout = layoutManager.getInternalLayout(layout);
    427                
     430
    428431                Graphics2D g = (Graphics2D) _surfaceStack.getCurrentSurface().create();
    429432                g.setColor(SwingConversions.toSwingColor(colour));
    430                
    431                 swingLayout.draw(g, position.x, position.y);
     433
     434                swingLayout.draw(g, position.getX(), position.getY());
    432435        }
    433436
    434437        private Dimension _preFullscreenSize = null;
    435438        private boolean _fullScreenTransitionPending = false;
    436        
     439
    437440        /**
    438441         * Whether or not we are in the middle of transitioning to/from fullscreen.
    439442         */
    440         public boolean isFullscreenTransitionPending()
    441         {
     443        public boolean isFullscreenTransitionPending() {
    442444                return _fullScreenTransitionPending;
    443445        }
    444        
     446
    445447        /**
    446          * Should be called when the SwingInputManager is notified that the fullscreen transition
    447          * has finished.
     448         * Should be called when the SwingInputManager is notified that the fullscreen
     449         * transition has finished.
    448450         */
    449         public void finishFullscreenTransition()
    450         {
     451        public void finishFullscreenTransition() {
    451452                _fullScreenTransitionPending = false;
    452453        }
    453        
     454
    454455        @Override
    455456        public boolean canGoFullscreen() {
     
    459460        @Override
    460461        public boolean isFullscreen() {
    461                 return GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getFullScreenWindow() == _jFrame;
     462                return GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice()
     463                                .getFullScreenWindow() == _jFrame;
    462464        }
    463465
     
    468470                        return;
    469471                }
    470                
     472
    471473                _preFullscreenSize = getWindowSize();
    472                
     474
    473475                _fullScreenTransitionPending = true;
    474                
     476
    475477                _jFrame.dispose();
    476478                _jFrame.setUndecorated(true);
    477479                _jFrame.pack();
    478480                _jFrame.setVisible(true);
    479                
     481
    480482                GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().setFullScreenWindow(_jFrame);
    481483        }
     
    484486        public void exitFullscreen() {
    485487                _fullScreenTransitionPending = true;
    486                
     488
    487489                _jFrame.dispose();
    488490                _jFrame.setUndecorated(false);
    489491                setWindowSize(_preFullscreenSize);
    490                
     492
    491493                GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().setFullScreenWindow(null);
    492494                _jFrame.pack();
    493495                _jFrame.setVisible(true);
    494                
    495         }
    496 
    497         @Override
    498         public void setCursor(Cursor cursor)
    499         {
    500                 if (cursor == null) return;
    501                
     496
     497        }
     498
     499        @Override
     500        public void setCursor(Cursor cursor) {
     501                if (cursor == null)
     502                        return;
     503
    502504                java.awt.Cursor swingCursor;
    503505                if (cursor.getType() == Cursor.CursorType.CUSTOM) {
    504506                        SwingImageManager imageManager = SwingMiscManager.getIfUsingSwingImageManager();
    505                        
    506                         if (imageManager == null) return;
    507                        
    508                         swingCursor = Toolkit.getDefaultToolkit().createCustomCursor(imageManager.getInternalImage(cursor.getImage()), SwingConversions.toSwingPoint(cursor.getHotspot()), cursor.getName());
     507
     508                        if (imageManager == null)
     509                                return;
     510
     511                        swingCursor = Toolkit.getDefaultToolkit().createCustomCursor(
     512                                        imageManager.getInternalImage(cursor.getImage()),
     513                                        SwingConversions.toSwingPoint(cursor.getHotspot()), cursor.getName());
    509514                } else {
    510515                        swingCursor = new java.awt.Cursor(SwingConversions.toSwingCursorType(cursor.getType()));
    511516                }
    512                
     517
    513518                _jFrame.setCursor(swingCursor);
    514519        }
     
    522527
    523528        @Override
    524         public void setWindowTitle(String title)
    525         {
     529        public void setWindowTitle(String title) {
    526530                _jFrame.setTitle(title);
    527531        }
     
    529533        @Override
    530534        public boolean showDialog(String title, String message) {
    531                 int result = JOptionPane.showConfirmDialog(_jFrame, message, title, JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE);
     535                int result = JOptionPane.showConfirmDialog(_jFrame, message, title, JOptionPane.OK_CANCEL_OPTION,
     536                                JOptionPane.WARNING_MESSAGE);
    532537                return result == JOptionPane.OK_OPTION;
    533538        }
    534539
    535540        @Override
    536         public Dimension getCurrentDrawingSurfaceSize()
    537         {
     541        public Dimension getCurrentDrawingSurfaceSize() {
    538542                Image currentImage = _surfaceStack.getCurrentImage();
    539                
     543
    540544                if (currentImage != null) {
    541545                        return currentImage.getSize();
     
    544548                }
    545549        }
    546        
    547         public void refreshRootSurface()
    548         {
     550
     551        public void refreshRootSurface() {
    549552                Graphics2D rootSurface = (Graphics2D) _jFrame.getContentPane().getGraphics();
    550553                setAntialiasing(rootSurface, true);
     
    552555                _surfaceStack.setRootSurface(rootSurface);
    553556        }
    554        
    555         public JFrame getJFrame()
    556         {
     557
     558        public JFrame getJFrame() {
    557559                return _jFrame;
    558560        }
    559        
    560         public Container getContentPane()
    561         {
     561
     562        public Container getContentPane() {
    562563                return _jFrame.getContentPane();
    563564        }
    564        
    565         public JLayeredPane getLayeredPane()
    566         {
     565
     566        public JLayeredPane getLayeredPane() {
    567567                return _jFrame.getLayeredPane();
    568568        }
    569        
    570         public void setTransferHandler(TransferHandler newHandler)
    571         {
     569
     570        public void setTransferHandler(TransferHandler newHandler) {
    572571                _jFrame.setTransferHandler(newHandler);
    573572        }
    574        
    575         public void addWindowListener(WindowListener l)
    576         {
     573
     574        public void addWindowListener(WindowListener l) {
    577575                _jFrame.addWindowListener(l);
    578576        }
    579        
    580         public void addWindowStateListener(WindowStateListener l)
    581         {
     577
     578        public void addWindowStateListener(WindowStateListener l) {
    582579                _jFrame.addWindowStateListener(l);
    583580        }
    584        
    585         public void addKeyListener(KeyListener l)
    586         {
     581
     582        public void addKeyListener(KeyListener l) {
    587583                _jFrame.addKeyListener(l);
    588584        }
    589        
    590         public void addComponentListener(ComponentListener l)
    591         {
     585
     586        public void addComponentListener(ComponentListener l) {
    592587                _jFrame.addComponentListener(l);
    593588        }
    594        
    595         public void setGlassPane(Component glassPane)
    596         {
     589
     590        public void setGlassPane(Component glassPane) {
    597591                _jFrame.setGlassPane(glassPane);
    598592        }
    599        
    600         public Component getGlassPane()
    601         {
     593
     594        public Component getGlassPane() {
    602595                return _jFrame.getGlassPane();
    603596        }
    604        
    605         public JMenuBar getJMenuBar()
    606         {
     597
     598        public JMenuBar getJMenuBar() {
    607599                return _jFrame.getJMenuBar();
    608600        }
    609        
    610         public FontMetrics getFontMetrics(java.awt.Font font)
    611         {
     601
     602        public FontMetrics getFontMetrics(java.awt.Font font) {
    612603                return _jFrame.getFontMetrics(font);
    613604        }
    614        
    615         public java.awt.Font getFont()
    616         {
     605
     606        public java.awt.Font getFont() {
    617607                return _jFrame.getFont();
    618608        }
    619        
    620         public Graphics2D getCurrentSurface()
    621         {
     609
     610        public Graphics2D getCurrentSurface() {
     611                //System.err.println("Getting image y: " + _surfaceStack.getCurrentImage().getBounds().getMinY());
    622612                return _surfaceStack.getCurrentSurface();
    623613        }
    624        
    625         @Override
    626         public boolean addInteractiveWidget(Widget iw)
    627         {
     614
     615        @Override
     616        public boolean addInteractiveWidget(Widget iw) {
    628617                if (super.addInteractiveWidget(iw)) {
    629618                        _jFrame.add(((SwingWidget) iw).getComponent());
    630619                        return true;
    631620                }
    632                
     621
    633622                return false;
    634623        }
    635        
    636         @Override
    637         public boolean removeInteractiveWidget(Widget iw)
    638         {
     624
     625        @Override
     626        public boolean removeInteractiveWidget(Widget iw) {
    639627                if (super.removeInteractiveWidget(iw)) {
    640628                        _jFrame.remove(((SwingWidget) iw).getComponent());
    641629                        return true;
    642630                }
    643                
     631
    644632                return false;
    645633        }
    646        
    647         @Override
    648         protected void setWindowIcon(Image image)
    649         {
     634
     635        @Override
     636        protected void setWindowIcon(Image image) {
    650637                SwingImageManager imageManager = SwingMiscManager.getIfUsingSwingImageManager();
    651                
     638
    652639                if (imageManager != null) {
    653640                        _jFrame.setIconImage(imageManager.getInternalImage(image));
  • trunk/src/org/expeditee/gio/swing/SwingInputManager.java

    r1138 r1144  
    136136                //_robot.mouseMove(screenPosition.x, screenPosition.y);
    137137                final Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    138                 _robot.MoveMouseControlled(screenPosition.x / screenSize.getWidth(), screenPosition.y / screenSize.getHeight());
    139                 updateCursorPosition(position.x, position.y);
     138                _robot.MoveMouseControlled(screenPosition.getX() / screenSize.getWidth(), screenPosition.getY() / screenSize.getHeight());
     139                updateCursorPosition(position.getX(), position.getY());
    140140        }
    141141
  • trunk/src/org/expeditee/gio/swing/SwingTextLayoutManager.java

    r1097 r1144  
    240240                                lineDrop += layout.getLeading();
    241241                        }
    242                         start.y += lineDrop;
     242                        start.setY(start.getY() + lineDrop);
    243243                        positions.add(new Point(start));
    244244                }
  • trunk/src/org/expeditee/gui/DisplayController.java

    r1140 r1144  
    235235                //System.err.println("setTextCursor DisplayController:: " + DisplayController.getFloatMouseX() + "," + DisplayController.getFloatMouseY());
    236236                //System.err.println("setTextCursor Ecosystem:: " + EcosystemManager.getInputManager().getCursorPosition());
    237                 Point newMouse = text.moveCursor(cursorMovement, DisplayController.getFloatMouseX(), EcosystemManager.getInputManager().getCursorPosition().y, isShiftDown, isCtrlDown);
     237                Point newMouse = text.moveCursor(cursorMovement, DisplayController.getFloatMouseX(), EcosystemManager.getInputManager().getCursorPosition().getY(), isShiftDown, isCtrlDown);
    238238                //System.err.println("setTextCursor New Cursor:: " + newMouse);
    239239                                               
    240240                if(             isCtrlDown ||
    241                                 (DisplayController.getFloatMouseX() <= newMouse.x && newMouse.x <= DisplayController.getFloatMouseX() + 1) ||
    242                                 (DisplayController.getFloatMouseX() > newMouse.x && cursorMovement == Text.RIGHT))
     241                                (DisplayController.getFloatMouseX() <= newMouse.getX() && newMouse.getX() <= DisplayController.getFloatMouseX() + 1) ||
     242                                (DisplayController.getFloatMouseX() > newMouse.getX() && cursorMovement == Text.RIGHT))
    243243                {
    244244                        if(cursorMovement == Text.RIGHT && !MagneticConstraints.getInstance().rightBorderHit(text)) {
     
    249249                                }
    250250                        }
    251                         newMouse.x = (int) DisplayController.getFloatMouseX();
    252                         newMouse.y = (int) DisplayController.getFloatMouseY();
     251                        newMouse.setX((int) DisplayController.getFloatMouseX());
     252                        newMouse.setY((int) DisplayController.getFloatMouseY());
    253253                } else if(cursorMovement == Text.UP && MagneticConstraints.getInstance().topBorderHit(text)) {
    254                         newMouse.x = (int) DisplayController.getFloatMouseX();
    255                         newMouse.y = (int) DisplayController.getFloatMouseY();
     254                        newMouse.setX((int) DisplayController.getFloatMouseX());
     255                        newMouse.setY((int) DisplayController.getFloatMouseY());
    256256                } else if(cursorMovement == Text.DOWN && MagneticConstraints.getInstance().bottomBorderHit(text)) {
    257                         newMouse.x = (int) DisplayController.getFloatMouseX();
    258                         newMouse.y = (int) DisplayController.getFloatMouseY();
     257                        newMouse.setX((int) DisplayController.getFloatMouseX());
     258                        newMouse.setY((int) DisplayController.getFloatMouseY());
    259259                }
    260260
     
    384384                if (FreeItems.hasItemsAttachedToCursor()) {
    385385                        Point mousePos = EcosystemManager.getInputManager().getCursorPosition();
    386                         float deltax = x - mousePos.x;
    387                         float deltay = y - mousePos.y;
     386                        float deltax = x - mousePos.getX();
     387                        float deltay = y - mousePos.getY();
    388388                        List<Item> toMove = FreeItems.getInstance();
    389389                        for (Item move : toMove) {
     
    409409        public static void setCursorPosition(Point pos)
    410410        {
    411                 setCursorPosition(pos.x, pos.y);
     411                setCursorPosition(pos.getX(), pos.getY());
    412412        }
    413413
    414414        public static void setCursorPosition(Point pos, boolean forceArrow)
    415415        {
    416                 setCursorPosition(pos.x, pos.y, forceArrow);
     416                setCursorPosition(pos.getX(), pos.getY(), forceArrow);
    417417        }
    418418
     
    683683                // we are on the right side.
    684684                if(isTwinFramesOn()) {
    685                         int mouseX = EcosystemManager.getInputManager().getCursorPosition().x;
     685                        int mouseX = EcosystemManager.getInputManager().getCursorPosition().getX();
    686686                        if(mouseX >= getTwinFramesSeparatorX() && sideHasFrame(RIGHT)) {
    687687                                return RIGHT;
     
    794794        public static int getMouseX()
    795795        {
    796                 return getMousePosition().x;
     796                return getMousePosition().getX();
    797797        }
    798798
     
    809809               
    810810                if (isTwinFramesOn() && getRightFramePaintArea().contains(mousePos)) {
    811                         mousePos.x -= getRightFramePaintArea().getMinX();
     811                        mousePos.setX(mousePos.getX() - getRightFramePaintArea().getMinX());
    812812                }
    813813
     
    834834        public static int getMouseY()
    835835        {
    836                 return getMousePosition().y;
     836                return getMousePosition().getY();
    837837        }
    838838       
     
    13081308               
    13091309                g.popDrawingSurface();
     1310                //System.err.println("DisplayController refresh.  Point.ORIGIN=" + Point.ORIGIN);
     1311                //System.err.println("DisplayController refresh.  Graphic=" + g);
    13101312                g.drawImage(_refreshBuffer, Point.ORIGIN);
    13111313                return true;
  • trunk/src/org/expeditee/gui/Frame.java

    r1139 r1144  
    19341934                        if (isNormalTextItem(it)) itemsFound++;
    19351935                        if (itemsFound > index) {
    1936                                 DisplayController.setCursorPosition(((Text) it).getParagraphEndPosition().x, it.getY());
     1936                                DisplayController.setCursorPosition(((Text) it).getParagraphEndPosition().getX(), it.getY());
    19371937                                DisplayController.resetCursorOffset();
    19381938                                DisplayController.requestRefresh(true);
  • trunk/src/org/expeditee/gui/FrameTransition.java

    r1098 r1144  
    244244                Point shadowTopLeft = drawTopLeft.clone().add(0, area.getHeight());
    245245                Dimension shadowSize = new Dimension(area.getWidth(), SHADOW_HEIGHT);
    246                 GradientFill shadowFill = new GradientFill(SHADOW_COLOUR, new Point(0, shadowTopLeft.y), Colour.TRANSPARENT, new Point(0, shadowTopLeft.y + SHADOW_HEIGHT));
     246                GradientFill shadowFill = new GradientFill(SHADOW_COLOUR, new Point(0, shadowTopLeft.getY()), Colour.TRANSPARENT, new Point(0, shadowTopLeft.getY() + SHADOW_HEIGHT));
    247247               
    248248                EcosystemManager.getGraphicsManager().drawRectangle(drawTopLeft, area.getSize(), 0.0, new Fill(Item.DEFAULT_BACKGROUND), null, null, null);
  • trunk/src/org/expeditee/gui/FrameUtils.java

    r1102 r1144  
    14231423
    14241424                                        for (int i = 0; i < p1.getPointCount(); i++) {
    1425                                                 int diff = Math.abs(p1.getPoint(i).x - mouseX) + Math.abs(p1.getPoint(i).y - mouseY);
     1425                                                int diff = Math.abs(p1.getPoint(i).getX() - mouseX) + Math.abs(p1.getPoint(i).getY() - mouseY);
    14261426                                                int diff2 = Integer.MAX_VALUE;
    14271427
    14281428                                                if (i < p2.getPointCount())
    1429                                                         diff2 = Math.abs(p2.getPoint(i).x - mouseX)  + Math.abs(p2.getPoint(i).y - mouseY);
     1429                                                        diff2 = Math.abs(p2.getPoint(i).getX() - mouseX)  + Math.abs(p2.getPoint(i).getY() - mouseY);
    14301430
    14311431                                                if (diff < Math.abs(closest)) {
  • trunk/src/org/expeditee/gui/PopupManager.java

    r1102 r1144  
    324324                        if (_initialBounds == null) {
    325325                                setInitialBounds(fullBounds.clone());
    326                                 _initialBounds.getTopLeft().y += _initialBounds.getSize().height;
     326                                _initialBounds.getTopLeft().setY(_initialBounds.getTopLeft().getY() + _initialBounds.getSize().height);
    327327                                _initialBounds.getSize().height = 0;
    328328                        }
  • trunk/src/org/expeditee/gui/Vector.java

    r1102 r1144  
    8686        public float getX(int x)
    8787        {
    88                 return (x - Origin.x) / Scale;
     88                return (x - Origin.getY()) / Scale;
    8989        }
    9090
     
    9292        public float getY(int y)
    9393        {
    94                 return (y - Origin.y) / Scale;
     94                return (y - Origin.getY()) / Scale;
    9595        }
    9696
  • trunk/src/org/expeditee/io/Conversion.java

    r1102 r1144  
    475475
    476476                        if (orig == null) {
    477                                 p.x = Integer.parseInt(xPos.trim());
    478                                 p.y = Integer.parseInt(yPos.trim());
     477                                p.setX(Integer.parseInt(xPos.trim()));
     478                                p.setY(Integer.parseInt(yPos.trim()));
    479479                        } else {
    480480                                assert (orig instanceof Point);
    481481                                Point originalPoint = (Point) orig;
    482                                 p.x = (Integer) Convert(int.class, xPos, originalPoint.x);
    483                                 p.y = (Integer) Convert(int.class, yPos, originalPoint.y);
     482                                p.setX((Integer) Convert(int.class, xPos, originalPoint.getX()));
     483                                p.setY((Integer) Convert(int.class, yPos, originalPoint.getY()));
    484484                        }
    485485                        return p;
     
    693693                // covert points
    694694                if (output instanceof Point)
    695                         return ((Point) output).x + " " + ((Point) output).y;
     695                        return ((Point) output).getX() + " " + ((Point) output).getY();
    696696
    697697                if (output instanceof Boolean)
  • trunk/src/org/expeditee/io/ExpClipReader.java

    r1102 r1144  
    5555        public ExpClipReader(Point p)
    5656        {
    57                 this(p.x, p.y);
     57                this(p.getX(), p.getY());
    5858        }
    5959       
     
    186186                                        ++index;
    187187                                        Point startend = separateValues(lines[index].substring(2));
    188                                         int start = startend.x;
    189                                         int end = startend.y;
     188                                        int start = startend.getX();
     189                                        int end = startend.getY();
    190190       
    191191                                        if (_linePoints.get(start) != null
    192192                                                        && _linePoints.get(end) != null) {
    193193                                                _items.add(new Line(_linePoints.get(start),
    194                                                                 _linePoints.get(end), idtype.x));
     194                                                                _linePoints.get(end), idtype.getX()));
    195195                                        } else {
    196196                                                System.out
     
    210210                                        Point startend = separateValues(lines[index].substring(2));
    211211       
    212                                         Item a = _linePoints.get(startend.x);
    213                                         Item b = _linePoints.get(startend.y);
     212                                        Item a = _linePoints.get(startend.getX());
     213                                        Item b = _linePoints.get(startend.getY());
    214214                                       
    215215                                        // System.out.println("adding  constraint" + a + " " + b + " " + idtype.x + " " + idtype.y);
    216216       
    217                                         new Constraint(a, b, idtype.x, idtype.y);
     217                                        new Constraint(a, b, idtype.getX(), idtype.getY());
    218218                                }
    219219                        }
  • trunk/src/org/expeditee/io/ExpClipWriter.java

    r1102 r1144  
    4444        public ExpClipWriter(Point p)
    4545        {
    46                 this(p.x, p.y);
     46                this(p.getX(), p.getY());
    4747        }
    4848       
  • trunk/src/org/expeditee/io/ExpReader.java

    r1102 r1144  
    137137                                        next = _reader.readLine();
    138138                                        Point startend = separateValues(next.substring(2));
    139                                         int start = startend.x;
    140                                         int end = startend.y;
     139                                        int start = startend.getX();
     140                                        int end = startend.getY();
    141141
    142142                                        if (_linePoints.get(start) != null
    143143                                                        && _linePoints.get(end) != null) {
    144144                                                newFrame.addItem(new Line(_linePoints.get(start),
    145                                                                 _linePoints.get(end), idtype.x));
     145                                                                _linePoints.get(end), idtype.getX()));
    146146                                        } else {
    147147                                                System.out
     
    161161                                        Point startend = separateValues(next.substring(2));
    162162
    163                                         Item a = _linePoints.get(startend.x);
    164                                         Item b = _linePoints.get(startend.y);
    165 
    166                                         new Constraint(a, b, idtype.x, idtype.y);
     163                                        Item a = _linePoints.get(startend.getX());
     164                                        Item b = _linePoints.get(startend.getY());
     165
     166                                        new Constraint(a, b, idtype.getX(), idtype.getY());
    167167                                }
    168168                        }
  • trunk/src/org/expeditee/io/HTMLWriter.java

    r1102 r1144  
    7777                                                0.0,
    7878                                                pic.getStart(),
    79                                                 new Dimension(pic.getEnd().x - pic.getStart().x, pic.getEnd().y - pic.getStart().y));
     79                                                new Dimension(pic.getEnd().getX() - pic.getStart().getX(), pic.getEnd().getY() - pic.getStart().getY()));
    8080                        g.popDrawingSurface();
    8181                        image = bufferedImage;
  • trunk/src/org/expeditee/io/KMSReader.java

    r1102 r1144  
    275275                Point startend = separateValues(s);
    276276
    277                 int start = startend.x;
    278                 int end = startend.y;
     277                int start = startend.getX();
     278                int end = startend.getY();
    279279
    280280                if (_linePoints.get(start) != null && _linePoints.get(end) != null) {
    281281                        Line line = new Line(_linePoints.get(start), _linePoints.get(end),
    282                                         idtype.x);
     282                                        idtype.getX());
    283283                        return line;
    284284                }
     
    302302                Point startend = separateValues(_data.get("s"));
    303303
    304                 Item a = _linePoints.get(startend.x);
    305                 Item b = _linePoints.get(startend.y);
    306 
    307                 new Constraint(a, b, idtype.x, idtype.y);
     304                Item a = _linePoints.get(startend.getX());
     305                Item b = _linePoints.get(startend.getY());
     306
     307                new Constraint(a, b, idtype.getX(), idtype.getY());
    308308        }
    309309
  • trunk/src/org/expeditee/io/PDF2Writer.java

    r1102 r1144  
    243243        private void drawPolygon(PdfContentByte cb, PolygonBounds poly, Colour fill, Colour line, float lineThickness) {
    244244                if(poly != null) {
    245                         cb.moveTo(poly.toArray()[0].x, _height - poly.toArray()[0].y);
     245                        cb.moveTo(poly.toArray()[0].getX(), _height - poly.toArray()[0].getY());
    246246                        for(int i = 1; i < poly.toArray().length; i++) {
    247                                 cb.lineTo(poly.toArray()[i].x, _height - poly.toArray()[i].y);
     247                                cb.lineTo(poly.toArray()[i].getX(), _height - poly.toArray()[i].getY());
    248248                        }
    249249                        cb.closePath();
Note: See TracChangeset for help on using the changeset viewer.