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/apollo/gui/FramePlaybackBarRenderer.java

    r372 r1102  
    11package org.apollo.gui;
    22
    3 import java.awt.BasicStroke;
    4 import java.awt.Color;
    5 import java.awt.Graphics2D;
    6 import java.awt.Rectangle;
    7 import java.awt.Stroke;
    83import java.util.LinkedList;
    94import java.util.List;
    10 
    11 import javax.swing.SwingUtilities;
    125
    136import org.apollo.audio.ApolloPlaybackMixer;
     
    2316import org.apollo.util.AudioMath;
    2417import org.apollo.widgets.FramePlayer;
     18import org.expeditee.core.Colour;
     19import org.expeditee.core.Stroke;
     20import org.expeditee.core.bounds.AxisAlignedBoxBounds;
     21import org.expeditee.gio.EcosystemManager;
     22import org.expeditee.gio.GraphicsManager;
    2523import org.expeditee.gui.Browser;
    26 import org.expeditee.gui.DisplayIO;
     24import org.expeditee.gui.DisplayController;
    2725import org.expeditee.gui.Frame;
    28 import org.expeditee.gui.FrameGraphics;
    2926
    3027/**
     
    5047       
    5148        private static final int BAR_STROKE_THICKNESS = 2;
    52         private static final Stroke BAR_STROKE = new BasicStroke(BAR_STROKE_THICKNESS);
    53         private static final Color BAR_COLOR = Color.DARK_GRAY;
     49        private static final Stroke BAR_STROKE = new Stroke(BAR_STROKE_THICKNESS);
     50        private static final Colour BAR_COLOR = Colour.DARK_GREY;
    5451       
    5552        private static FramePlaybackBarRenderer instance = new FramePlaybackBarRenderer();
     
    121118                        }
    122119                       
    123                         FrameGraphics.refresh(true);
     120                        DisplayController.requestRefresh(true);
    124121                       
    125122                       
     
    132129                        currentMSPosition = -1;
    133130                        pixelPositions.clear();
    134                         FrameGraphics.refresh(true);
     131                        DisplayController.requestRefresh(true);
    135132                       
    136133                        break;
     
    140137        }
    141138       
    142         private void invalidate() {
     139        private void invalidate()
     140        {
    143141                if (Browser._theBrowser == null) return;
    144142               
    145                 int height = Browser._theBrowser.getHeight();
     143                int height = EcosystemManager.getGraphicsManager().getWindowSize().getHeight();
    146144               
    147145                for (Integer n : pixelPositions) {
    148                         FrameGraphics.invalidateArea(new Rectangle(n - 1, 0, BAR_STROKE_THICKNESS + 2, height));
    149                 }
    150         }
    151        
    152         public void paint(Graphics2D g) {
     146                        DisplayController.invalidateArea(new AxisAlignedBoxBounds(n - 1, 0, BAR_STROKE_THICKNESS + 2, height));
     147                }
     148        }
     149       
     150        public void paint()
     151        {
    153152                if (Browser._theBrowser == null) return;
    154153               
    155                 Frame currentFrame = DisplayIO.getCurrentFrame();
     154                Frame currentFrame = DisplayController.getCurrentFrame();
    156155               
    157156                if (currentFrame == null || currentFrame.getName() == null || pixelPositionsParent == null ||
    158157                                !currentFrame.getName().equals(pixelPositionsParent)) return;
    159158               
    160                 int height = Browser._theBrowser.getHeight();
    161                
    162                 g.setColor(BAR_COLOR);
    163                 g.setStroke(BAR_STROKE);
     159                int height = EcosystemManager.getGraphicsManager().getWindowSize().getHeight();
     160               
     161                GraphicsManager gm = EcosystemManager.getGraphicsManager();
    164162               
    165163                for (Integer n : pixelPositions) {
    166                         g.drawLine(n, 0, n, height);
     164                        gm.drawLine(n, 0, n, height, BAR_COLOR, BAR_STROKE);
    167165                }
    168166        }
     
    193191                // Notes: the clock will queue a refresh for the frame after this
    194192                // event proccesses ...
    195                 SwingUtilities.invokeLater(updator);
     193                EcosystemManager.getMiscManager().runOnGIOThread(updator);
    196194        }
    197195       
     
    201199         * @author Brook Novak
    202200         */
    203         private class PlaybackFrameBarUpdator implements Runnable {
     201        private class PlaybackFrameBarUpdator implements Runnable
     202        {
    204203                public void run() {
    205204                       
    206205                        if (currentMSPosition == -1 || currentTimeline == null) return;
    207206                       
    208                         Frame currentFrame = DisplayIO.getCurrentFrame();
     207                        Frame currentFrame = DisplayController.getCurrentFrame();
    209208                       
    210209                        if (currentFrame == null || currentFrame.getName() == null) return;
Note: See TracChangeset for help on using the changeset viewer.