2
* Created on 02-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.items.menu;
9
import org.eclipse.swt.SWT;
10
import org.eclipse.swt.widgets.Menu;
11
import org.eclipse.swt.widgets.MenuItem;
12
import org.eclipse.swt.widgets.Shell;
13
import org.herac.tuxguitar.gui.SystemImages;
14
import org.herac.tuxguitar.gui.TuxGuitar;
15
import org.herac.tuxguitar.gui.actions.duration.ChangeDottedDurationAction;
16
import org.herac.tuxguitar.gui.actions.duration.ChangeDoubleDottedDurationAction;
17
import org.herac.tuxguitar.gui.actions.duration.ChangeTupletoDurationAction;
18
import org.herac.tuxguitar.gui.actions.duration.SetEighthDurationAction;
19
import org.herac.tuxguitar.gui.actions.duration.SetHalfDurationAction;
20
import org.herac.tuxguitar.gui.actions.duration.SetQuarterDurationAction;
21
import org.herac.tuxguitar.gui.actions.duration.SetSixteenthDurationAction;
22
import org.herac.tuxguitar.gui.actions.duration.SetSixtyFourthDurationAction;
23
import org.herac.tuxguitar.gui.actions.duration.SetThirtySecondDurationAction;
24
import org.herac.tuxguitar.gui.actions.duration.SetWholeDurationAction;
25
import org.herac.tuxguitar.gui.editors.TablatureEditor;
26
import org.herac.tuxguitar.gui.items.MenuItems;
27
import org.herac.tuxguitar.song.models.Duration;
31
* TODO To change the template for this generated type comment go to
32
* Window - Preferences - Java - Code Style - Code Templates
34
public class DurationMenuItem implements MenuItems{
35
private TablatureEditor tablatureEditor;
37
private MenuItem durationMenuItem;
39
private MenuItem whole;
40
private MenuItem half;
41
private MenuItem quarter;
42
private MenuItem eighth;
43
private MenuItem sixteenth;
44
private MenuItem thirtySecond;
45
private MenuItem sixtyFourth;
46
private MenuItem dotted;
47
private MenuItem doubleDotted;
48
private MenuItem tupleto;
50
public DurationMenuItem(Shell shell,Menu parent, int style,TablatureEditor tablatureEditor) {
51
this.durationMenuItem = new MenuItem(parent, style);
52
this.tablatureEditor = tablatureEditor;
54
this.menu = new Menu(shell, SWT.DROP_DOWN);
58
public void showItems(){
60
this.whole = new MenuItem(this.menu, SWT.PUSH);
61
this.whole.setImage(SystemImages.getDuration(Duration.WHOLE));
62
this.whole.addSelectionListener(TuxGuitar.instance().getAction(SetWholeDurationAction.NAME));
64
this.half = new MenuItem(this.menu, SWT.PUSH);
65
this.half.setImage(SystemImages.getDuration(Duration.HALF));
66
this.half.addSelectionListener(TuxGuitar.instance().getAction(SetHalfDurationAction.NAME));
68
this.quarter = new MenuItem(this.menu, SWT.PUSH);
69
this.quarter.setImage(SystemImages.getDuration(Duration.QUARTER));
70
this.quarter.addSelectionListener(TuxGuitar.instance().getAction(SetQuarterDurationAction.NAME));
72
this.eighth = new MenuItem(this.menu, SWT.PUSH);
73
this.eighth.setImage(SystemImages.getDuration(Duration.EIGHTH));
74
this.eighth.addSelectionListener(TuxGuitar.instance().getAction(SetEighthDurationAction.NAME));
76
this.sixteenth = new MenuItem(this.menu, SWT.PUSH);
77
this.sixteenth.setImage(SystemImages.getDuration(Duration.SIXTEENTH));
78
this.sixteenth.addSelectionListener(TuxGuitar.instance().getAction(SetSixteenthDurationAction.NAME));
80
this.thirtySecond = new MenuItem(this.menu, SWT.PUSH);
81
this.thirtySecond.setImage(SystemImages.getDuration(Duration.THIRTY_SECOND));
82
this.thirtySecond.addSelectionListener(TuxGuitar.instance().getAction(SetThirtySecondDurationAction.NAME));
84
this.sixtyFourth = new MenuItem(this.menu, SWT.PUSH);
85
this.sixtyFourth.setImage(SystemImages.getDuration(Duration.SIXTY_FOURTH));
86
this.sixtyFourth.addSelectionListener(TuxGuitar.instance().getAction(SetSixtyFourthDurationAction.NAME));
89
new MenuItem(this.menu, SWT.SEPARATOR);
92
this.dotted = new MenuItem(this.menu, SWT.PUSH);
93
this.dotted.setImage(SystemImages.DOTTED_IMAGE);
94
this.dotted.addSelectionListener(TuxGuitar.instance().getAction(ChangeDottedDurationAction.NAME));
96
this.doubleDotted = new MenuItem(this.menu, SWT.PUSH);
97
this.doubleDotted.setImage(SystemImages.DOUBLE_DOTTED_IMAGE);
98
this.doubleDotted.addSelectionListener(TuxGuitar.instance().getAction(ChangeDoubleDottedDurationAction.NAME));
101
this.tupleto = new MenuItem(this.menu, SWT.PUSH);
102
this.tupleto.setImage(SystemImages.TUPLETO_IMAGE);
103
this.tupleto.addSelectionListener(TuxGuitar.instance().getAction(ChangeTupletoDurationAction.NAME));
105
this.durationMenuItem.setMenu(menu);
107
this.loadProperties();
110
public void update(){
113
public void loadProperties(){
114
this.durationMenuItem.setText(TuxGuitar.getProperty("duration"));
115
this.whole.setText(TuxGuitar.getProperty("duration.whole"));
116
this.half.setText(TuxGuitar.getProperty("duration.half"));
117
this.quarter.setText(TuxGuitar.getProperty("duration.quarter"));
118
this.eighth.setText(TuxGuitar.getProperty("duration.eighth"));
119
this.sixteenth.setText(TuxGuitar.getProperty("duration.sixteenth"));
120
this.thirtySecond.setText(TuxGuitar.getProperty("duration.thirtysecond"));
121
this.sixtyFourth.setText(TuxGuitar.getProperty("duration.sixtyfourth"));
122
this.dotted.setText(TuxGuitar.getProperty("duration.dotted"));
123
this.doubleDotted.setText(TuxGuitar.getProperty("duration.doubledotted"));
124
this.tupleto.setText(TuxGuitar.getProperty("duration.tupleto"));