Changeset 1102 for trunk/src/org/apollo/gui/OverdubbedFrameTimeAxis.java
- Timestamp:
- 05/10/18 16:04:51 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/apollo/gui/OverdubbedFrameTimeAxis.java
r1059 r1102 1 1 package org.apollo.gui; 2 3 import java.awt.BasicStroke;4 import java.awt.Color;5 import java.awt.Graphics;6 import java.awt.Graphics2D;7 import java.awt.Rectangle;8 import java.awt.Stroke;9 import java.awt.event.ComponentEvent;10 import java.awt.event.ComponentListener;11 12 import javax.swing.SwingUtilities;13 2 14 3 import org.apollo.audio.util.Timeline; … … 16 5 import org.apollo.mvc.Subject; 17 6 import org.apollo.mvc.SubjectChangedEvent; 7 import org.expeditee.core.Colour; 8 import org.expeditee.core.Dimension; 9 import org.expeditee.core.Fill; 10 import org.expeditee.core.Point; 11 import org.expeditee.core.Stroke; 12 import org.expeditee.core.bounds.AxisAlignedBoxBounds; 13 import org.expeditee.gio.EcosystemManager; 14 import org.expeditee.gio.GraphicsManager; 15 import org.expeditee.gio.InputManager.WindowEventListener; 16 import org.expeditee.gio.InputManager.WindowEventType; 18 17 import org.expeditee.gui.Browser; 19 import org.expeditee.gui.DisplayIO; 20 import org.expeditee.gui.FrameGraphics; 21 import org.expeditee.gui.MessageBay; 18 import org.expeditee.gui.DisplayController; 22 19 23 20 /** … … 30 27 31 28 private TimeAxis timeAxis = null; 32 private RectanglelastInvalidated;29 private AxisAlignedBoxBounds lastInvalidated; 33 30 private Timeline lastTimeline = null; 34 31 … … 36 33 37 34 private static final int GLOBAL_TIMELINE_HEIGHT = 30; 38 private static final Colo r GLOBAL_TIMELINE_BACKCOLOR = new Color(220, 220, 220, 100);39 private static final Colo r GLOBAL_EMPTY_TIMELINE_BACKCOLOR = new Color(240, 240, 240, 100);35 private static final Colour GLOBAL_TIMELINE_BACKCOLOR = Colour.FromRGBA255(220, 220, 220, 100); 36 private static final Colour GLOBAL_EMPTY_TIMELINE_BACKCOLOR = Colour.FromRGBA255(240, 240, 240, 100); 40 37 41 public static final Stroke TRACK_TIMELINE_STROKE = new BasicStroke( 42 1.0f, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_BEVEL, 0.0f, new float[] { 5.0f, 5.0f }, 0.0f); 38 public static final Stroke TRACK_TIMELINE_STROKE = new Stroke(1.0f, Stroke.CAP.SQUARE, Stroke.JOIN.BEVEL, new float[] { 5.0f, 5.0f }, 0.0f); 43 39 44 private static final Stroke TIMELINE_BORDER_STROKE = new BasicStroke(1.0f);40 private static final Stroke TIMELINE_BORDER_STROKE = new Stroke(1.0f); 45 41 46 42 /** … … 54 50 55 51 // Listen for resize events 56 SwingUtilities.invokeLater(new Runnable() { 57 public void run() { 58 59 // Keep expanded view centered to the browser window 60 if (Browser._theBrowser != null) { 61 Browser._theBrowser.addComponentListener(new ComponentListener() { 62 63 public void componentHidden(ComponentEvent e) { 64 } 65 66 public void componentMoved(ComponentEvent e) { 67 } 68 69 public void componentResized(ComponentEvent e) { 70 updateAxis(); 71 } 72 73 public void componentShown(ComponentEvent e) { 74 } 75 76 }); 77 } 78 52 EcosystemManager.getInputManager().addWindowEventListener(new WindowEventListener() 53 { 54 @Override 55 public void onWindowEvent(WindowEventType type) 56 { 57 if (type == WindowEventType.WINDOW_RESIZED) updateAxis(); 79 58 } 80 59 }); … … 113 92 lastTimeline = FrameLayoutDaemon.getInstance().getLastComputedTimeline(); 114 93 if (lastTimeline == null || 115 FrameLayoutDaemon.getInstance().getTimelineOwner() != Display IO.getCurrentFrame()) {94 FrameLayoutDaemon.getInstance().getTimelineOwner() != DisplayController.getCurrentFrame()) { 116 95 117 96 // The frame layout daemon only lays out frames once - unless the user rearranges tracks 118 97 // on a frame then the daemon we re-calc the timeline... thus a timeline must be infferred 119 98 120 lastTimeline = FrameLayoutDaemon.inferTimeline(Display IO.getCurrentFrame());99 lastTimeline = FrameLayoutDaemon.inferTimeline(DisplayController.getCurrentFrame()); 121 100 122 101 if (lastTimeline == null) { // no widgets 123 102 if (timeAxis != null && lastInvalidated != null) { 124 FrameGraphics.invalidateArea(lastInvalidated); // old position103 DisplayController.invalidateArea(lastInvalidated); // old position 125 104 } 126 105 … … 141 120 142 121 143 RectanglenewBounds = getCurrentTimelineArea();122 AxisAlignedBoxBounds newBounds = getCurrentTimelineArea(); 144 123 if (lastInvalidated != null && !lastInvalidated.equals(newBounds)) { 145 FrameGraphics.invalidateArea(lastInvalidated); // old position124 DisplayController.invalidateArea(lastInvalidated); // old position 146 125 } 147 126 148 FrameGraphics.invalidateArea(newBounds);127 DisplayController.invalidateArea(newBounds); 149 128 150 129 lastInvalidated = newBounds; 151 130 152 FrameGraphics.refresh(true);131 DisplayController.requestRefresh(true); 153 132 154 133 } 155 134 156 public Rectangle getCurrentTimelineArea() { 135 public AxisAlignedBoxBounds getCurrentTimelineArea() 136 { 157 137 assert(Browser._theBrowser != null); 158 int y = Browser._theBrowser.getContentPane().getHeight() - GLOBAL_TIMELINE_HEIGHT;159 if (! FrameGraphics.isAudienceMode()) {160 y -= MessageBay.MESSAGE_BUFFER_HEIGHT;138 int y = EcosystemManager.getGraphicsManager().getWindowSize().getHeight() - GLOBAL_TIMELINE_HEIGHT; 139 if (!DisplayController.isAudienceMode()) { 140 y -= DisplayController.getMessageBayPaintArea().getHeight(); 161 141 } 162 142 163 143 if (y < 0) y = 0; 164 144 165 return new Rectangle(0, y, Browser._theBrowser.getContentPane().getWidth(), GLOBAL_TIMELINE_HEIGHT);145 return new AxisAlignedBoxBounds(0, y, EcosystemManager.getGraphicsManager().getWindowSize().getWidth(), GLOBAL_TIMELINE_HEIGHT); 166 146 } 167 147 168 148 169 public void paint(Graphics g) { 149 public void paint() 150 { 170 151 if (Browser._theBrowser == null) return; 171 152 172 153 if (timeAxis != null && lastTimeline != null) { 173 154 174 Rectangle r = getCurrentTimelineArea(); 175 176 g.setColor(GLOBAL_EMPTY_TIMELINE_BACKCOLOR); 177 g.fillRect(0, r.y, Browser._theBrowser.getContentPane().getWidth(), r.height); 155 GraphicsManager gm = EcosystemManager.getGraphicsManager(); 178 156 179 timeAxis.paint(g, 157 AxisAlignedBoxBounds r = getCurrentTimelineArea(); 158 gm.drawRectangle(new Point(0, r.getMinY()), new Dimension(EcosystemManager.getGraphicsManager().getWindowSize().getWidth(), r.getHeight()), 0.0, new Fill(GLOBAL_EMPTY_TIMELINE_BACKCOLOR), null, null, null); 159 160 timeAxis.paint( 180 161 lastTimeline.getInitiationXPixel(), 181 r. y,182 r. height,162 r.getMinY(), 163 r.getHeight(), 183 164 GLOBAL_TIMELINE_BACKCOLOR); 184 165 185 186 g.setColor(Color.DARK_GRAY); 187 188 ((Graphics2D)g).setStroke(TIMELINE_BORDER_STROKE); 189 g.drawLine(0, r.y, Browser._theBrowser.getContentPane().getWidth(), r.y); 166 gm.drawLine(new Point(0, r.getMinY()), new Point(EcosystemManager.getGraphicsManager().getWindowSize().getWidth(), r.getMinY()), Colour.DARK_GREY, TIMELINE_BORDER_STROKE); 190 167 191 168 }
Note:
See TracChangeset
for help on using the changeset viewer.