2
* Created on 17-dic-2005
4
* TODO To change the template for this generated file go to
5
* Window - Preferences - Java - Code Style - Code Templates
7
package org.herac.tuxguitar.gui.actions.duration;
9
import org.eclipse.swt.events.TypedEvent;
10
import org.herac.tuxguitar.gui.actions.Action;
11
import org.herac.tuxguitar.gui.editors.TablatureEditor;
12
import org.herac.tuxguitar.gui.editors.tab.Caret;
13
import org.herac.tuxguitar.gui.undo.undoables.measure.UndoableMeasureGeneric;
14
import org.herac.tuxguitar.song.models.Duration;
19
* TODO To change the template for this generated type comment go to
20
* Window - Preferences - Java - Code Style - Code Templates
22
public class SetEighthDurationAction extends Action{
23
public static final String NAME = "action.note.duration.set-eighth";
24
public static final int VALUE = Duration.EIGHTH;
26
public SetEighthDurationAction(TablatureEditor tablatureEditor) {
27
super(NAME,tablatureEditor);
30
public boolean doAction(TypedEvent e) {
31
if(getSelectedDuration().getValue() != VALUE){
33
//comienza el undoable
34
UndoableMeasureGeneric undoable = UndoableMeasureGeneric.startUndo();
36
getSelectedDuration().setValue(VALUE);
37
getSelectedDuration().setDotted(false);
38
getSelectedDuration().setDoubleDotted(false);
39
//getSelectedDuration().getTupleto().setEnters(1);
40
//getSelectedDuration().getTupleto().setTimes(1);
44
getEditor().getUndoManager().addEdit(undoable.endUndo());
49
private void setDurations() {
50
Caret caret = getEditor().getTablature().getCaret();
51
caret.changeDuration((Duration)getSelectedDuration().clone());
52
fireUpdate(getEditor().getTablature().getCaret().getMeasureCoords().getMeasure().getNumber());
56
public Duration getSelectedDuration(){
57
return getEditor().getTablature().getCaret().getDuration();