Ignore:
Timestamp:
09/28/18 10:16:45 (6 years ago)
Author:
bln4
Message:
 
File:
1 edited

Legend:

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

    r1102 r1172  
    3333import org.expeditee.core.bounds.PolygonBounds;
    3434import org.expeditee.gio.EcosystemManager;
     35import org.expeditee.gio.input.KBMInputEvent.Key;
    3536import org.expeditee.gio.input.StandardInputEventListeners;
    36 import org.expeditee.gio.input.KBMInputEvent.Key;
    3737import org.expeditee.items.Circle;
    3838import org.expeditee.items.Dot;
    3939import org.expeditee.items.Item;
     40import org.expeditee.items.Item.HighlightMode;
    4041import org.expeditee.items.Line;
    4142import org.expeditee.items.UserAppliedPermission;
    4243import org.expeditee.items.XRayable;
    43 import org.expeditee.items.Item.HighlightMode;
    4444import org.expeditee.items.widgets.Widget;
    4545import org.expeditee.items.widgets.WidgetEdge;
     
    7373        public static Image getFrameImage(Frame toPaint, Clip clip, Dimension size, boolean isActualFrame, boolean createVolatile)
    7474        {
    75                 if (toPaint == null) return null;
     75                if (toPaint == null) {
     76                        return null;
     77                }
    7678
    7779                // the buffer is not valid, so it must be recreated
     
    120122                // Nicer looking lines, but may be too jerky while
    121123                // rubber-banding on older machines
    122                 if (UserSettings.AntiAlias.get()) EcosystemManager.getGraphicsManager().setAntialiasing(true);
     124                if (UserSettings.AntiAlias.get()) {
     125                        EcosystemManager.getGraphicsManager().setAntialiasing(true);
     126                }
    123127               
    124128                // If we are doing @f etc... then have a clear background if its the default background color
     
    130134                } else {
    131135                        backgroundColor = toPaint.getBackgroundColor();
    132                         if (backgroundColor == null) backgroundColor = Item.TRANSPARENT;
     136                        if (backgroundColor == null) {
     137                                backgroundColor = Item.TRANSPARENT;
     138                        }
    133139                }
    134140
     
    204210                        // the box that is supposed to be underneath
    205211                        Widget iw = widgetItor.previous();
    206                         if (clip == null || clip.isNotClipped() || clip.getBounds().intersects(iw.getBounds())) {
     212                        if (clip == null || clip.isNotClipped() || clip.getBounds().intersects(iw.getClip().getBounds())) {
    207213                                iw.paint();
    208214                                PaintItem(iw.getItems().get(4));
     
    285291                        }
    286292                       
    287                         if (isActualFrame) PaintLines(lines);
     293                        if (isActualFrame) {
     294                                PaintLines(lines);
     295                        }
    288296                } else {
    289                         if (isActualFrame) PaintLines(freeItemsToPaint);
     297                        if (isActualFrame) {
     298                                PaintLines(freeItemsToPaint);
     299                        }
    290300                }
    291301
     
    310320                if(!FreeItems.hasItemsAttachedToCursor()) {
    311321                        Item current = FrameUtils.getCurrentItem();
    312                         if(current != null) current.paintTooltip();
    313                         if (_lastToolTippedItem != null) _lastToolTippedItem.clearTooltips();
     322                        if(current != null) {
     323                                current.paintTooltip();
     324                        }
     325                        if (_lastToolTippedItem != null) {
     326                                _lastToolTippedItem.clearTooltips();
     327                        }
    314328                        _lastToolTippedItem = current;
    315329                }
     
    347361                                        // When painting a line all connected lines are painted too
    348362                                        done.addAll(l.getAllConnected());
    349                                         if (l.getStartItem().getEnclosedArea() == 0) PaintItem(i);
     363                                        if (l.getStartItem().getEnclosedArea() == 0) {
     364                                                PaintItem(i);
     365                                        }
    350366                                }
    351367                        }
     
    368384                        // Also ignore invisible items..
    369385                        // TODO possibly ignore invisible items before coming to this method?
    370                         if (done.contains(i)) continue;
     386                        if (done.contains(i)) {
     387                                continue;
     388                        }
    371389                       
    372390                        if (i instanceof XRayable) {
     
    375393                        } else if (i.hasEnclosures()) {
    376394                                for (Item enclosure : i.getEnclosures()) {
    377                                         if (!toFill.contains(enclosure)) toFill.add(enclosure);
     395                                        if (!toFill.contains(enclosure)) {
     396                                                toFill.add(enclosure);
     397                                        }
    378398                                }
    379399                                done.addAll(i.getConnected());
     
    397417                // Sort the items to fill
    398418                Collections.sort(toFill, new Comparator<Item>() {
     419                        @Override
    399420                        public int compare(Item a, Item b) {
    400421                                Double aArea = a.getEnclosedArea();
     
    405426                                        PolygonBounds pA = a.getEnclosedShape();
    406427                                        PolygonBounds pB = b.getEnclosedShape();
    407                                         if (pA == null || pB == null) return 0;
     428                                        if (pA == null || pB == null) {
     429                                                return 0;
     430                                        }
    408431                                        return new Integer(pA.getMinX()).compareTo(pB.getMinX());
    409432                                }
     
    419442                                i.paintFill();
    420443                                List<Line> lines = i.getLines();
    421                                 if (lines.size() > 0) PaintItem(lines.get(0));
     444                                if (lines.size() > 0) {
     445                                        PaintItem(lines.get(0));
     446                                }
    422447                        }
    423448                }
     
    427452        static void PaintItem(Item i)
    428453        {
    429                 if (i == null) return;
     454                if (i == null) {
     455                        return;
     456                }
    430457
    431458                // do not paint annotation items in audience mode
     
    456483                        if (toDisconnect != null && !(i instanceof WidgetEdge)) {
    457484                                Item.HighlightMode newMode = toDisconnect.getHighlightMode();
    458                                 if (FreeItems.hasItemsAttachedToCursor())
     485                                if (FreeItems.hasItemsAttachedToCursor()) {
    459486                                        newMode = Item.HighlightMode.Normal;
     487                                }
    460488                                // unhighlight all the other dots
    461489                                for (Item conn : toDisconnect.getAllConnected()) {
     
    551579        public static void changeHighlightMode(Item item, Item.HighlightMode newMode, Item.HighlightMode connectedNewMode)
    552580        {
    553                 if (item == null) return;
     581                if (item == null) {
     582                        return;
     583                }
    554584
    555585                if (item.hasVector()) {
     
    600630         */
    601631        public static void addFrameRenderPass(FrameRenderPass pass) {
    602                 if (pass == null)
     632                if (pass == null) {
    603633                        throw new NullPointerException("pass");
    604 
    605                 if (!_frameRenderPasses.contains(pass))
     634                }
     635
     636                if (!_frameRenderPasses.contains(pass)) {
    606637                        _frameRenderPasses.add(pass);
     638                }
    607639        }
    608640
Note: See TracChangeset for help on using the changeset viewer.