001package net.kreatious.pianoleopard.painter.layout; 002 003import java.awt.Dimension; 004import java.awt.Rectangle; 005 006import net.kreatious.pianoleopard.midi.event.EventPair; 007import net.kreatious.pianoleopard.midi.event.NoteEvent; 008import net.kreatious.pianoleopard.midi.event.PedalEvent; 009 010/** 011 * Provides the layout coordinates used for drawing events. 012 * 013 * @author Jay-R Studer 014 */ 015public interface EventLayout { 016 /** 017 * Lays out the coordinates for drawing the specified note event. 018 * 019 * @param currentTime 020 * the current song time in microseconds 021 * @param event 022 * the note event pair to layout 023 * @param rect 024 * output parameter storing the resulting on screen location of 025 * the event. 026 */ 027 void layoutNote(long currentTime, EventPair<NoteEvent> event, Rectangle rect); 028 029 /** 030 * Lays out the coordinates for drawing the specified pedal event. 031 * 032 * @param currentTime 033 * the current song time in microseconds 034 * @param event 035 * the pedal event pair to layout 036 * @param rect 037 * output parameter storing the resulting on screen location of 038 * the event. 039 */ 040 void layoutPedal(long currentTime, EventPair<PedalEvent> event, Rectangle rect); 041 042 /** 043 * Resizes the layout to fit the specified component dimensions. 044 * 045 * @param dimension 046 * the new component layout dimensions 047 */ 048 void setComponentDimensions(Dimension dimension); 049 050 /** 051 * Calculates the lowest visible time that can be laid out and still fit 052 * within the current layout. 053 * 054 * @param currentTime 055 * the current song time in microseconds 056 * @return the lowest visible time in microseconds that can be laid out 057 */ 058 long getLowestVisibleTime(long currentTime); 059 060 /** 061 * Calculates the highest visible time that can be laid out and still fit 062 * within the current layout. 063 * 064 * @param currentTime 065 * the current song time in microseconds 066 * @return the highest visible time in microseconds that can be laid out 067 */ 068 long getHighestVisibleTime(long currentTime); 069}