at.ofai.music.beatroot

Class EditAction

public class EditAction extends Object

Implements undo and redo for most beat editing actions. EditActions make up a doubly linked list containing the sequence of changes made to the beat list in their order of occurrence.
Field Summary
static EditActioncurrent
The EditAction which would be undone by clicking on "Undo".
static booleandebug
A flag indicating whether debugging information should be printed.
static BeatTrackDisplaydisplay
The main panel of BeatRoot's GUI, which is called to perform undo/redo
doublefrom
The original position of a beat, before editing took place.
static EditActionHEAD
The head of the list of edit actions, marked by a dummy EditAction object
EditActionnext
The next edit action in order of occurrence
EditActionprev
The previous edit action in order of occurrence
doubleto
The new position of a beat, after editing took place.
Constructor Summary
EditAction(double f, double t, EditAction n, EditAction p)
Constructor:
Method Summary
static voidadd(double from, double to)
Add a new EditAction to the list
static voidclear()
Clear the list of EditActions
voidprint()
Prints a single EditAction (for debugging)
static voidprintAll()
Prints the queue of EditActions (for debugging)
static voidredo()
Redo the last EditAction which was just undone
static voidsetDisplay(BeatTrackDisplay btd)
Set up a hook to the GUI's data panel for performing undo/redo
static voidundo()
Undo the last EditAction

Field Detail

current

private static EditAction current
The EditAction which would be undone by clicking on "Undo". Usually this is the tail of the list, unless a series of undos (possibly interspersed with a smaller number of redos) has just taken place.

debug

public static boolean debug
A flag indicating whether debugging information should be printed.

display

private static BeatTrackDisplay display
The main panel of BeatRoot's GUI, which is called to perform undo/redo

from

public double from
The original position of a beat, before editing took place. A negative value indicates the addition of a new beat.

HEAD

private static final EditAction HEAD
The head of the list of edit actions, marked by a dummy EditAction object

public EditAction next
The next edit action in order of occurrence

public EditAction prev
The previous edit action in order of occurrence

to

public double to
The new position of a beat, after editing took place. A negative value indicates the deletion of a beat.

Constructor Detail

EditAction

private EditAction(double f, double t, EditAction n, EditAction p)
Constructor:

Parameters: f The original beat time t The new beat time n The next EditAction p The previous EditAction

Method Detail

add

public static void add(double from, double to)
Add a new EditAction to the list

clear

public static void clear()
Clear the list of EditActions

print

private void print()
Prints a single EditAction (for debugging)

printAll

private static void printAll()
Prints the queue of EditActions (for debugging)

redo

public static void redo()
Redo the last EditAction which was just undone

setDisplay

public static void setDisplay(BeatTrackDisplay btd)
Set up a hook to the GUI's data panel for performing undo/redo

undo

public static void undo()
Undo the last EditAction