Ignore:
Timestamp:
09/06/18 12:01:26 (6 years ago)
Author:
bln4
Message:

org.expeditee.gio.EcosystemManager ->
org.expeditee.gui.DisplayController ->

A less heavy handed solution to previously fixed exceptions on startup.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/gui/DisplayController.java

    r1106 r1112  
    676676        public static TwinFramesSide getCurrentSide()
    677677        {
     678               
    678679                // If the mouse is over the right side of the window and there's a valid frame,
    679680                // we are on the right side.
    680                 int mouseX = EcosystemManager.getInputManager().getCursorPosition().x;
    681                 if (isTwinFramesOn() && mouseX >= getTwinFramesSeparatorX() && sideHasFrame(RIGHT)) {
    682                         return RIGHT;
     681                if(isTwinFramesOn()) {
     682                        int mouseX = EcosystemManager.getInputManager().getCursorPosition().x;
     683                        if(mouseX >= getTwinFramesSeparatorX() && sideHasFrame(RIGHT)) {
     684                                return RIGHT;
     685                        }
    683686                }
    684687               
     
    12221225        private static void refresh(boolean useInvalidation)
    12231226        {
     1227                Frame currentFrame = getCurrentFrame();
     1228                if(currentFrame == null) {
     1229                        System.err.println("currentFrame == null");
     1230                        return;
     1231                }
     1232               
    12241233                // Always get the clip as it clears at the same time
    12251234                Clip clip = _damagedAreas.getClip();
     
    12601269                       
    12611270                        Image image = null;
    1262                         if (!useInvalidation || !frameClip.isFullyClipped()) {
    1263                                 image = FrameGraphics.getFrameImage(getCurrentFrame(), frameClip, getFramePaintArea().getSize());
     1271                        if (currentFrame != null && (!useInvalidation || !frameClip.isFullyClipped())) {
     1272                                image = FrameGraphics.getFrameImage(currentFrame, frameClip, getFramePaintArea().getSize());
    12641273                        }
    12651274
     
    12711280                        Clip messageBayClip = null;
    12721281                       
     1282                        AxisAlignedBoxBounds messageBayPaintArea = getMessageBayPaintArea();
    12731283                        if (useInvalidation) {
    1274                                 messageBayClip = clip.clone().intersectWith(getMessageBayPaintArea());
    1275                                 if (!messageBayClip.isFullyClipped()) messageBayClip = new Clip(messageBayClip.getBounds().translate(0, -getMessageBayPaintArea().getMinY()));
     1284                                messageBayClip = clip.clone().intersectWith(messageBayPaintArea);
     1285                                if (!messageBayClip.isFullyClipped()) messageBayClip = new Clip(messageBayClip.getBounds().translate(0, -messageBayPaintArea.getMinY()));
    12761286                        }
    12771287                       
    12781288                        Image image = null;
    12791289                        if (!useInvalidation || !messageBayClip.isFullyClipped()) {
    1280                                 image = MessageBay.getImage(messageBayClip, getMessageBayPaintArea().getSize());
     1290                                image = MessageBay.getImage(messageBayClip, messageBayPaintArea.getSize());
    12811291                        }
    12821292                       
    12831293                        if (image != null) {
    1284                                 g.drawImage(image, getMessageBayPaintArea().getTopLeft(), getMessageBayPaintArea().getSize());
     1294                                g.drawImage(image, messageBayPaintArea.getTopLeft(), messageBayPaintArea.getSize());
    12851295                        }
    12861296                }
     
    14051415                {
    14061416                        try {
    1407                                 if(EcosystemManager.IsEcosystemReady()) refresh(_useInvalidation);
     1417                                refresh(_useInvalidation);
    14081418                        } catch (Throwable e) {
    14091419                                e.printStackTrace();
Note: See TracChangeset for help on using the changeset viewer.