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.note.ChangeTiedNoteAction;
16
import org.herac.tuxguitar.gui.actions.note.CleanBeatAction;
17
import org.herac.tuxguitar.gui.actions.note.DecrementNoteSemitoneAction;
18
import org.herac.tuxguitar.gui.actions.note.IncrementNoteSemitoneAction;
19
import org.herac.tuxguitar.gui.actions.note.ShiftNoteDownAction;
20
import org.herac.tuxguitar.gui.actions.note.ShiftNoteUpAction;
21
import org.herac.tuxguitar.gui.editors.TablatureEditor;
22
import org.herac.tuxguitar.gui.items.MenuItems;
27
* TODO To change the template for this generated type comment go to
28
* Window - Preferences - Java - Code Style - Code Templates
30
public class NoteMenuItem implements MenuItems{
31
private TablatureEditor tablatureEditor;
32
private MenuItem noteMenuItem;
34
private MenuItem tiedNote;
35
private MenuItem cleanBeat;
36
private MenuItem shiftUp;
37
private MenuItem shiftDown;
38
private MenuItem semitoneUp;
39
private MenuItem semitoneDown;
40
private DurationMenuItem durationMenuItem;
41
private ChordMenuItem chordMenuItem;
42
private NoteEffectsMenuItem effectMenuItem;
43
private DynamicMenuItem dynamicMenuItem;
45
public NoteMenuItem(Shell shell,Menu parent, int style,TablatureEditor tablatureEditor) {
46
this.noteMenuItem = new MenuItem(parent, style);
47
this.tablatureEditor = tablatureEditor;
48
this.menu = new Menu(shell, SWT.DROP_DOWN);
51
public void showItems(){
53
this.tiedNote = new MenuItem(this.menu, SWT.PUSH);
54
this.tiedNote.setImage(SystemImages.TIED_NOTE_IMAGE);
55
this.tiedNote.addSelectionListener(TuxGuitar.instance().getAction(ChangeTiedNoteAction.NAME));
58
this.cleanBeat = new MenuItem(this.menu, SWT.PUSH);
59
this.cleanBeat.addSelectionListener(TuxGuitar.instance().getAction(CleanBeatAction.NAME));
62
this.durationMenuItem = new DurationMenuItem(menu.getShell(),menu,SWT.CASCADE,tablatureEditor);
63
this.durationMenuItem.showItems();
66
this.chordMenuItem = new ChordMenuItem(menu.getShell(),menu,SWT.CASCADE,tablatureEditor);
67
this.chordMenuItem.showItems();
70
this.effectMenuItem = new NoteEffectsMenuItem(menu.getShell(),menu,SWT.CASCADE,tablatureEditor);
71
this.effectMenuItem.showItems();
74
this.dynamicMenuItem = new DynamicMenuItem(menu.getShell(),menu,SWT.CASCADE,tablatureEditor);
75
this.dynamicMenuItem.showItems();
78
new MenuItem(this.menu, SWT.SEPARATOR);
81
this.semitoneUp = new MenuItem(this.menu, SWT.PUSH);
82
this.semitoneUp.addSelectionListener(TuxGuitar.instance().getAction(IncrementNoteSemitoneAction.NAME));
85
this.semitoneDown = new MenuItem(this.menu, SWT.PUSH);
86
this.semitoneDown.addSelectionListener(TuxGuitar.instance().getAction(DecrementNoteSemitoneAction.NAME));
89
new MenuItem(this.menu, SWT.SEPARATOR);
92
this.shiftUp = new MenuItem(this.menu, SWT.PUSH);
93
this.shiftUp.addSelectionListener(TuxGuitar.instance().getAction(ShiftNoteUpAction.NAME));
96
this.shiftDown = new MenuItem(this.menu, SWT.PUSH);
97
this.shiftDown.addSelectionListener(TuxGuitar.instance().getAction(ShiftNoteDownAction.NAME));
99
this.noteMenuItem.setMenu(menu);
100
this.loadProperties();
103
public void update(){
104
this.durationMenuItem.update();
105
this.chordMenuItem.update();
106
this.effectMenuItem.update();
107
this.dynamicMenuItem.update();
110
public void loadProperties(){
111
this.noteMenuItem.setText(TuxGuitar.getProperty("note"));
112
this.tiedNote.setText(TuxGuitar.getProperty("note.tiednote"));
113
this.cleanBeat.setText(TuxGuitar.getProperty("note.clean-beat"));
114
this.semitoneUp.setText(TuxGuitar.getProperty("note.semitone-up"));
115
this.semitoneDown.setText(TuxGuitar.getProperty("note.semitone-down"));
116
this.shiftUp.setText(TuxGuitar.getProperty("note.shift-up"));
117
this.shiftDown.setText(TuxGuitar.getProperty("note.shift-down"));
118
this.durationMenuItem.loadProperties();
119
this.chordMenuItem.loadProperties();
120
this.effectMenuItem.loadProperties();
121
this.dynamicMenuItem.loadProperties();