1
package org.herac.tuxguitar.gui.undo.undoables;
3
import org.herac.tuxguitar.gui.TuxGuitar;
4
import org.herac.tuxguitar.gui.editors.tab.Caret;
5
import org.herac.tuxguitar.song.models.TGDuration;
6
import org.herac.tuxguitar.song.models.TGString;
8
public class UndoableCaretHelper {
13
private TGDuration duration;
15
public UndoableCaretHelper(){
16
Caret caret = getCaret();
17
this.track = caret.getTrack().getNumber();
18
this.position = caret.getPosition();
19
this.velocity = caret.getVelocity();
20
this.duration = caret.getDuration().clone(TuxGuitar.instance().getSongManager().getFactory());
22
TGString instrumentString = caret.getSelectedString();
23
if(instrumentString != null){
24
this.string = instrumentString.getNumber();
29
getCaret().update(this.track,this.position,this.string,this.velocity);
30
getCaret().setSelectedDuration(this.duration.clone(TuxGuitar.instance().getSongManager().getFactory()));
33
private static Caret getCaret(){
34
return TuxGuitar.instance().getTablatureEditor().getTablature().getCaret();