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.TuxGuitar;
14
import org.herac.tuxguitar.gui.actions.effects.ChangeAccentuatedNoteAction;
15
import org.herac.tuxguitar.gui.actions.effects.ChangeBendNoteAction;
16
import org.herac.tuxguitar.gui.actions.effects.ChangeDeadNoteAction;
17
import org.herac.tuxguitar.gui.actions.effects.ChangeFadeInAction;
18
import org.herac.tuxguitar.gui.actions.effects.ChangeGhostNoteAction;
19
import org.herac.tuxguitar.gui.actions.effects.ChangeGraceNoteAction;
20
import org.herac.tuxguitar.gui.actions.effects.ChangeHammerNoteAction;
21
import org.herac.tuxguitar.gui.actions.effects.ChangeHarmonicNoteAction;
22
import org.herac.tuxguitar.gui.actions.effects.ChangeHeavyAccentuatedNoteAction;
23
import org.herac.tuxguitar.gui.actions.effects.ChangePalmMuteAction;
24
import org.herac.tuxguitar.gui.actions.effects.ChangePoppingAction;
25
import org.herac.tuxguitar.gui.actions.effects.ChangeSlappingAction;
26
import org.herac.tuxguitar.gui.actions.effects.ChangeSlideNoteAction;
27
import org.herac.tuxguitar.gui.actions.effects.ChangeStaccatoAction;
28
import org.herac.tuxguitar.gui.actions.effects.ChangeTappingAction;
29
import org.herac.tuxguitar.gui.actions.effects.ChangeTremoloBarAction;
30
import org.herac.tuxguitar.gui.actions.effects.ChangeTremoloPickingAction;
31
import org.herac.tuxguitar.gui.actions.effects.ChangeTrillNoteAction;
32
import org.herac.tuxguitar.gui.actions.effects.ChangeVibratoNoteAction;
33
import org.herac.tuxguitar.gui.editors.TablatureEditor;
34
import org.herac.tuxguitar.gui.items.MenuItems;
35
import org.herac.tuxguitar.song.models.Note;
36
import org.herac.tuxguitar.song.models.NoteEffect;
41
* TODO To change the template for this generated type comment go to
42
* Window - Preferences - Java - Code Style - Code Templates
44
public class NoteEffectsMenuItem implements MenuItems{
45
private TablatureEditor tablatureEditor;
46
private MenuItem noteEffectsMenuItem;
48
private MenuItem vibrato;
49
private MenuItem bend;
50
private MenuItem tremoloBar;
51
private MenuItem deadNote;
52
private MenuItem slide;
53
private MenuItem hammer;
55
private MenuItem ghostNote;
56
private MenuItem accentuatedNote;
57
private MenuItem heavyAccentuatedNote;
59
private MenuItem harmonicNote;
60
private MenuItem graceNote;
61
private MenuItem trill;
62
private MenuItem tremoloPicking;
63
private MenuItem palmMute;
65
private MenuItem staccato;
66
private MenuItem tapping;
67
private MenuItem slapping;
68
private MenuItem popping;
70
private MenuItem fadeIn;
72
public NoteEffectsMenuItem(Shell shell,Menu parent, int style,TablatureEditor tablatureEditor) {
73
this.noteEffectsMenuItem = new MenuItem(parent, style);
74
this.tablatureEditor = tablatureEditor;
75
this.menu = new Menu(shell, SWT.DROP_DOWN);
78
public void showItems(){
80
this.vibrato = new MenuItem(this.menu, SWT.CHECK);
81
this.vibrato.addSelectionListener(TuxGuitar.instance().getAction(ChangeVibratoNoteAction.NAME));
84
this.bend = new MenuItem(this.menu, SWT.CHECK);
85
this.bend.addSelectionListener(TuxGuitar.instance().getAction(ChangeBendNoteAction.NAME));
88
this.tremoloBar = new MenuItem(this.menu, SWT.CHECK);
89
this.tremoloBar.addSelectionListener(TuxGuitar.instance().getAction(ChangeTremoloBarAction.NAME));
92
this.slide = new MenuItem(this.menu, SWT.CHECK);
93
this.slide.addSelectionListener(TuxGuitar.instance().getAction(ChangeSlideNoteAction.NAME));
96
this.deadNote = new MenuItem(this.menu, SWT.CHECK);
97
this.deadNote.addSelectionListener(TuxGuitar.instance().getAction(ChangeDeadNoteAction.NAME));
100
this.hammer = new MenuItem(this.menu, SWT.CHECK);
101
this.hammer.addSelectionListener(TuxGuitar.instance().getAction(ChangeHammerNoteAction.NAME));
104
new MenuItem(this.menu, SWT.SEPARATOR);
107
this.ghostNote = new MenuItem(this.menu, SWT.CHECK);
108
this.ghostNote.addSelectionListener(TuxGuitar.instance().getAction(ChangeGhostNoteAction.NAME));
110
//--ACCENTUATED NOTE--
111
this.accentuatedNote = new MenuItem(this.menu, SWT.CHECK);
112
this.accentuatedNote.addSelectionListener(TuxGuitar.instance().getAction(ChangeAccentuatedNoteAction.NAME));
114
//--HEAVY ACCENTUATED NOTE--
115
this.heavyAccentuatedNote = new MenuItem(this.menu, SWT.CHECK);
116
this.heavyAccentuatedNote.addSelectionListener(TuxGuitar.instance().getAction(ChangeHeavyAccentuatedNoteAction.NAME));
119
this.harmonicNote = new MenuItem(this.menu, SWT.CHECK);
120
this.harmonicNote.addSelectionListener(TuxGuitar.instance().getAction(ChangeHarmonicNoteAction.NAME));
123
this.graceNote = new MenuItem(this.menu, SWT.CHECK);
124
this.graceNote.addSelectionListener(TuxGuitar.instance().getAction(ChangeGraceNoteAction.NAME));
128
new MenuItem(this.menu, SWT.SEPARATOR);
131
this.trill = new MenuItem(this.menu, SWT.CHECK);
132
this.trill.addSelectionListener(TuxGuitar.instance().getAction(ChangeTrillNoteAction.NAME));
134
//--TREMOLO PICKING--
135
this.tremoloPicking = new MenuItem(this.menu, SWT.CHECK);
136
this.tremoloPicking.addSelectionListener(TuxGuitar.instance().getAction(ChangeTremoloPickingAction.NAME));
139
this.palmMute = new MenuItem(this.menu, SWT.CHECK);
140
this.palmMute.addSelectionListener(TuxGuitar.instance().getAction(ChangePalmMuteAction.NAME));
143
this.staccato = new MenuItem(this.menu, SWT.CHECK);
144
this.staccato.addSelectionListener(TuxGuitar.instance().getAction(ChangeStaccatoAction.NAME));
148
new MenuItem(this.menu, SWT.SEPARATOR);
151
this.tapping = new MenuItem(this.menu, SWT.CHECK);
152
this.tapping.addSelectionListener(TuxGuitar.instance().getAction(ChangeTappingAction.NAME));
155
this.slapping = new MenuItem(this.menu, SWT.CHECK);
156
this.slapping.addSelectionListener(TuxGuitar.instance().getAction(ChangeSlappingAction.NAME));
159
this.popping = new MenuItem(this.menu, SWT.CHECK);
160
this.popping.addSelectionListener(TuxGuitar.instance().getAction(ChangePoppingAction.NAME));
164
new MenuItem(this.menu, SWT.SEPARATOR);
167
this.fadeIn = new MenuItem(this.menu, SWT.CHECK);
168
this.fadeIn.addSelectionListener(TuxGuitar.instance().getAction(ChangeFadeInAction.NAME));
170
this.noteEffectsMenuItem.setMenu(menu);
172
this.loadProperties();
175
public void update(){
176
Note note = tablatureEditor.getTablature().getCaret().getSelectedNote();
177
NoteEffect effect = ((note != null)?note.getEffect():new NoteEffect());
179
this.vibrato.setSelection(effect.isVibrato());
180
this.bend.setSelection(effect.isBend());
181
this.tremoloBar.setSelection(effect.isTremoloBar());
182
this.deadNote.setSelection(effect.isDeadNote());
183
this.slide.setSelection(effect.isSlide());
184
this.hammer.setSelection(effect.isHammer());
185
this.ghostNote.setSelection(effect.isGhostNote());
186
this.accentuatedNote.setSelection(effect.isAccentuatedNote());
187
this.heavyAccentuatedNote.setSelection(effect.isHeavyAccentuatedNote());
188
this.harmonicNote.setSelection(effect.isHarmonic());
189
this.graceNote.setSelection(effect.isGrace());
190
this.trill.setSelection(effect.isTrill());
191
this.tremoloPicking.setSelection(effect.isTremoloPicking());
192
this.palmMute.setSelection(effect.isPalmMute());
193
this.staccato.setSelection(effect.isStaccato());
194
this.tapping.setSelection(effect.isTapping());
195
this.slapping.setSelection(effect.isSlapping());
196
this.popping.setSelection(effect.isPopping());
197
this.fadeIn.setSelection(effect.isFadeIn());
200
public void loadProperties(){
201
this.noteEffectsMenuItem.setText(TuxGuitar.getProperty("effects"));
202
this.vibrato.setText(TuxGuitar.getProperty("effects.vibrato"));
203
this.bend.setText(TuxGuitar.getProperty("effects.bend"));
204
this.tremoloBar.setText(TuxGuitar.getProperty("effects.tremolo-bar"));
205
this.deadNote.setText(TuxGuitar.getProperty("effects.deadnote"));
206
this.slide.setText(TuxGuitar.getProperty("effects.slide"));
207
this.hammer.setText(TuxGuitar.getProperty("effects.hammer"));
208
this.ghostNote.setText(TuxGuitar.getProperty("effects.ghostnote"));
209
this.accentuatedNote.setText(TuxGuitar.getProperty("effects.accentuatednote"));
210
this.heavyAccentuatedNote.setText(TuxGuitar.getProperty("effects.heavyaccentuatednote"));
211
this.harmonicNote.setText(TuxGuitar.getProperty("effects.harmonic"));
212
this.graceNote.setText(TuxGuitar.getProperty("effects.grace"));
213
this.trill.setText(TuxGuitar.getProperty("effects.trill"));
214
this.tremoloPicking.setText(TuxGuitar.getProperty("effects.tremolo-picking"));
215
this.palmMute.setText(TuxGuitar.getProperty("effects.palm-mute"));
216
this.staccato.setText(TuxGuitar.getProperty("effects.staccato"));
217
this.tapping.setText(TuxGuitar.getProperty("effects.tapping"));
218
this.slapping.setText(TuxGuitar.getProperty("effects.slapping"));
219
this.popping.setText(TuxGuitar.getProperty("effects.popping"));
220
this.fadeIn.setText(TuxGuitar.getProperty("effects.fade-in"));