Package org.emrick.project
Class TimelineGUI
java.lang.Object
org.emrick.project.TimelineGUI
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate classA scrub bar component with tick marks for counts Shows tick marks for each count with labels for every 4th countprivate static class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static doubleprivate static doubleprivate ButtonGroupprivate final JPanelprivate static final doubleprivate intprivate static final intprivate static final doubleprivate final List<MouseAdapter> private static final intprivate static final intprivate TimelineGUI.TimelineScrubBarprivate booleanprivate TimelineListenerprivate JPanelprivate JScrollPaneprivate TimeManagerprivate final doubleprivate static final intprivate ButtonGroupprivate static final doubleprivate static doubleprivate JLabelprivate JPanel -
Constructor Summary
ConstructorsConstructorDescriptionTimelineGUI(ArrayList<Effect> effects, HashMap<Integer, RFTrigger> count2RFTrigger, TimeManager timeManager, int maxCount) -
Method Summary
Modifier and TypeMethodDescriptionprivate voidaddDragSupportToEffectWidget(JToggleButton effectWidget, Effect effect) private voidAdds support for zooming with Ctrl+Mouse wheelprivate voidAdds support for panning the timeline using the middle mouse button (scroll wheel) This implementation uses a specialized adapter that ensures smooth, precise panning with the content following exactly under the mouse cursor as you drag.private intcalculateEffectWidth(Effect effect) private intprivate intcalculateXPosition(double ms) private intcalculateXPositionFromCount(double count) Calculate precise X position from decimal count valueprivate longconvertCountToMS(double count) Convert decimal count to milliseconds using precise interpolationprivate voidprivate voidCreates the zoom control panel with buttons and labelprivate intfindAvailableRow(List<List<TimelineGUI.TimeRange>> rows, TimelineGUI.TimeRange newRange) private booleanisRowAvailable(List<TimelineGUI.TimeRange> row, TimelineGUI.TimeRange newRange) static voidprivate voidResets the zoom level to the default (1.0)voidscrubToCount(double count) Scrub to a specific countvoidscrubToMS(double ms) voidsetShowAllEffects(boolean showAll) voidsetTimelineListener(TimelineListener listener) Sets the timeline listener for this timelineprivate voidvoidupdateData(ArrayList<Effect> newEffects, HashMap<Integer, RFTrigger> count2RFTrigger, int newMaxCount) Update the timeline data in-place without recreating the entire GUI.private voidprivate voidUpdates the zoom display and timeline layoutprivate voidzoomIn()Increases the zoom level by one stepprivate voidzoomOut()Decreases the zoom level by one step
-
Field Details
-
mainPanel
-
effects
-
triggers
-
timelineScrollPane
-
timelinePanel
-
showAllEffects
private boolean showAllEffects -
effectsButtonGroup
-
triggersButtonGroup
-
zoomPanel
-
zoomLabel
-
zoomFactor
private static double zoomFactor -
MIN_ZOOM
private static final double MIN_ZOOM- See Also:
-
MAX_ZOOM
private static final double MAX_ZOOM- See Also:
-
ZOOM_STEP
private static final double ZOOM_STEP- See Also:
-
ROW_HEIGHT
private static final int ROW_HEIGHT- See Also:
-
TRIGGER_ROW_HEIGHT
private static final int TRIGGER_ROW_HEIGHT- See Also:
-
PIXELS_PER_COUNT
private static final int PIXELS_PER_COUNT- See Also:
-
MIN_WIDTH_PIXELS
private static final int MIN_WIDTH_PIXELS- See Also:
-
totalDurationMSec
private final double totalDurationMSec -
curMS
private static double curMS -
curCount
private static double curCount -
maxCount
private int maxCount -
scrubBar
-
timeManager
-
timelineListener
-
panAdapters
-
-
Constructor Details
-
TimelineGUI
-
-
Method Details
-
setTimelineListener
Sets the timeline listener for this timeline- Parameters:
listener- The listener to receive timeline events
-
createZoomControls
private void createZoomControls()Creates the zoom control panel with buttons and label -
addMouseWheelZoomSupport
private void addMouseWheelZoomSupport()Adds support for zooming with Ctrl+Mouse wheel -
zoomIn
private void zoomIn()Increases the zoom level by one step -
zoomOut
private void zoomOut()Decreases the zoom level by one step -
resetZoom
private void resetZoom()Resets the zoom level to the default (1.0) -
updateZoom
private void updateZoom()Updates the zoom display and timeline layout -
updateTimelineLayout
private void updateTimelineLayout() -
updateComponentPositions
private void updateComponentPositions() -
updateData
public void updateData(ArrayList<Effect> newEffects, HashMap<Integer, RFTrigger> count2RFTrigger, int newMaxCount) Update the timeline data in-place without recreating the entire GUI. Keeps the same scrollpane and other components so callers can reuse the TimelineGUI instance. -
addDragSupportToEffectWidget
-
createTimelinePane
private void createTimelinePane() -
calculateXPosition
private int calculateXPosition(double ms) -
calculateXPositionFromCount
private int calculateXPositionFromCount(double count) Calculate precise X position from decimal count value -
convertCountToMS
private long convertCountToMS(double count) Convert decimal count to milliseconds using precise interpolation -
calculateEffectWidth
-
calculateTimelineWidth
private int calculateTimelineWidth() -
findAvailableRow
private int findAvailableRow(List<List<TimelineGUI.TimeRange>> rows, TimelineGUI.TimeRange newRange) -
isRowAvailable
-
getTimelineScrollPane
-
scrubToMS
public void scrubToMS(double ms) -
scrubToCount
public void scrubToCount(double count) Scrub to a specific count -
setShowAllEffects
public void setShowAllEffects(boolean showAll) -
addScrollClickPanning
private void addScrollClickPanning()Adds support for panning the timeline using the middle mouse button (scroll wheel) This implementation uses a specialized adapter that ensures smooth, precise panning with the content following exactly under the mouse cursor as you drag. -
main
-