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.items.MenuItems;
34
import org.herac.tuxguitar.song.models.TGNote;
39
* TODO To change the template for this generated type comment go to
40
* Window - Preferences - Java - Code Style - Code Templates
42
public class NoteEffectsMenuItem implements MenuItems{
44
private MenuItem noteEffectsMenuItem;
46
private MenuItem vibrato;
47
private MenuItem bend;
48
private MenuItem tremoloBar;
49
private MenuItem deadNote;
50
private MenuItem slide;
51
private MenuItem hammer;
53
private MenuItem ghostNote;
54
private MenuItem accentuatedNote;
55
private MenuItem heavyAccentuatedNote;
57
private MenuItem harmonicNote;
58
private MenuItem graceNote;
59
private MenuItem trill;
60
private MenuItem tremoloPicking;
61
private MenuItem palmMute;
63
private MenuItem staccato;
64
private MenuItem tapping;
65
private MenuItem slapping;
66
private MenuItem popping;
68
private MenuItem fadeIn;
70
public NoteEffectsMenuItem(Shell shell,Menu parent, int style) {
71
this.noteEffectsMenuItem = new MenuItem(parent, style);
72
this.menu = new Menu(shell, SWT.DROP_DOWN);
75
public void showItems(){
77
this.vibrato = new MenuItem(this.menu, SWT.CHECK);
78
this.vibrato.addSelectionListener(TuxGuitar.instance().getAction(ChangeVibratoNoteAction.NAME));
81
this.bend = new MenuItem(this.menu, SWT.CHECK);
82
this.bend.addSelectionListener(TuxGuitar.instance().getAction(ChangeBendNoteAction.NAME));
85
this.tremoloBar = new MenuItem(this.menu, SWT.CHECK);
86
this.tremoloBar.addSelectionListener(TuxGuitar.instance().getAction(ChangeTremoloBarAction.NAME));
89
this.slide = new MenuItem(this.menu, SWT.CHECK);
90
this.slide.addSelectionListener(TuxGuitar.instance().getAction(ChangeSlideNoteAction.NAME));
93
this.deadNote = new MenuItem(this.menu, SWT.CHECK);
94
this.deadNote.addSelectionListener(TuxGuitar.instance().getAction(ChangeDeadNoteAction.NAME));
97
this.hammer = new MenuItem(this.menu, SWT.CHECK);
98
this.hammer.addSelectionListener(TuxGuitar.instance().getAction(ChangeHammerNoteAction.NAME));
101
new MenuItem(this.menu, SWT.SEPARATOR);
104
this.ghostNote = new MenuItem(this.menu, SWT.CHECK);
105
this.ghostNote.addSelectionListener(TuxGuitar.instance().getAction(ChangeGhostNoteAction.NAME));
107
//--ACCENTUATED NOTE--
108
this.accentuatedNote = new MenuItem(this.menu, SWT.CHECK);
109
this.accentuatedNote.addSelectionListener(TuxGuitar.instance().getAction(ChangeAccentuatedNoteAction.NAME));
111
//--HEAVY ACCENTUATED NOTE--
112
this.heavyAccentuatedNote = new MenuItem(this.menu, SWT.CHECK);
113
this.heavyAccentuatedNote.addSelectionListener(TuxGuitar.instance().getAction(ChangeHeavyAccentuatedNoteAction.NAME));
116
this.harmonicNote = new MenuItem(this.menu, SWT.CHECK);
117
this.harmonicNote.addSelectionListener(TuxGuitar.instance().getAction(ChangeHarmonicNoteAction.NAME));
120
this.graceNote = new MenuItem(this.menu, SWT.CHECK);
121
this.graceNote.addSelectionListener(TuxGuitar.instance().getAction(ChangeGraceNoteAction.NAME));
124
new MenuItem(this.menu, SWT.SEPARATOR);
127
this.trill = new MenuItem(this.menu, SWT.CHECK);
128
this.trill.addSelectionListener(TuxGuitar.instance().getAction(ChangeTrillNoteAction.NAME));
130
//--TREMOLO PICKING--
131
this.tremoloPicking = new MenuItem(this.menu, SWT.CHECK);
132
this.tremoloPicking.addSelectionListener(TuxGuitar.instance().getAction(ChangeTremoloPickingAction.NAME));
135
this.palmMute = new MenuItem(this.menu, SWT.CHECK);
136
this.palmMute.addSelectionListener(TuxGuitar.instance().getAction(ChangePalmMuteAction.NAME));
139
this.staccato = new MenuItem(this.menu, SWT.CHECK);
140
this.staccato.addSelectionListener(TuxGuitar.instance().getAction(ChangeStaccatoAction.NAME));
143
new MenuItem(this.menu, SWT.SEPARATOR);
146
this.tapping = new MenuItem(this.menu, SWT.CHECK);
147
this.tapping.addSelectionListener(TuxGuitar.instance().getAction(ChangeTappingAction.NAME));
150
this.slapping = new MenuItem(this.menu, SWT.CHECK);
151
this.slapping.addSelectionListener(TuxGuitar.instance().getAction(ChangeSlappingAction.NAME));
154
this.popping = new MenuItem(this.menu, SWT.CHECK);
155
this.popping.addSelectionListener(TuxGuitar.instance().getAction(ChangePoppingAction.NAME));
158
new MenuItem(this.menu, SWT.SEPARATOR);
161
this.fadeIn = new MenuItem(this.menu, SWT.CHECK);
162
this.fadeIn.addSelectionListener(TuxGuitar.instance().getAction(ChangeFadeInAction.NAME));
164
this.noteEffectsMenuItem.setMenu(this.menu);
167
this.loadProperties();
170
public void update(){
171
TGNote note = TuxGuitar.instance().getTablatureEditor().getTablature().getCaret().getSelectedNote();
172
boolean running = TuxGuitar.instance().getPlayer().isRunning();
173
this.vibrato.setSelection(note != null && note.getEffect().isVibrato());
174
this.vibrato.setEnabled(!running && note != null);
175
this.bend.setSelection(note != null && note.getEffect().isBend());
176
this.bend.setEnabled(!running && note != null);
177
this.tremoloBar.setSelection(note != null && note.getEffect().isTremoloBar());
178
this.tremoloBar.setEnabled(!running && note != null);
179
this.deadNote.setSelection(note != null && note.getEffect().isDeadNote());
180
this.deadNote.setEnabled(!running && note != null);
181
this.slide.setSelection(note != null && note.getEffect().isSlide());
182
this.slide.setEnabled(!running && note != null);
183
this.hammer.setSelection(note != null && note.getEffect().isHammer());
184
this.hammer.setEnabled(!running && note != null);
185
this.ghostNote.setSelection(note != null && note.getEffect().isGhostNote());
186
this.ghostNote.setEnabled(!running && note != null);
187
this.accentuatedNote.setSelection(note != null && note.getEffect().isAccentuatedNote());
188
this.accentuatedNote.setEnabled(!running && note != null);
189
this.heavyAccentuatedNote.setSelection(note != null && note.getEffect().isHeavyAccentuatedNote());
190
this.heavyAccentuatedNote.setEnabled(!running && note != null);
191
this.harmonicNote.setSelection(note != null && note.getEffect().isHarmonic());
192
this.harmonicNote.setEnabled(!running && note != null);
193
this.graceNote.setSelection(note != null && note.getEffect().isGrace());
194
this.graceNote.setEnabled(!running && note != null);
195
this.trill.setSelection(note != null && note.getEffect().isTrill());
196
this.trill.setEnabled(!running && note != null);
197
this.tremoloPicking.setSelection(note != null && note.getEffect().isTremoloPicking());
198
this.tremoloPicking.setEnabled(!running && note != null);
199
this.palmMute.setSelection(note != null && note.getEffect().isPalmMute());
200
this.palmMute.setEnabled(!running && note != null);
201
this.staccato.setSelection(note != null && note.getEffect().isStaccato());
202
this.staccato.setEnabled(!running && note != null);
203
this.tapping.setSelection(note != null && note.getEffect().isTapping());
204
this.tapping.setEnabled(!running && note != null);
205
this.slapping.setSelection(note != null && note.getEffect().isSlapping());
206
this.slapping.setEnabled(!running && note != null);
207
this.popping.setSelection(note != null && note.getEffect().isPopping());
208
this.popping.setEnabled(!running && note != null);
209
this.fadeIn.setSelection(note != null && note.getEffect().isFadeIn());
210
this.fadeIn.setEnabled(!running && note != null);
213
public void loadProperties(){
214
this.noteEffectsMenuItem.setText(TuxGuitar.getProperty("effects"));
215
this.vibrato.setText(TuxGuitar.getProperty("effects.vibrato"));
216
this.bend.setText(TuxGuitar.getProperty("effects.bend"));
217
this.tremoloBar.setText(TuxGuitar.getProperty("effects.tremolo-bar"));
218
this.deadNote.setText(TuxGuitar.getProperty("effects.deadnote"));
219
this.slide.setText(TuxGuitar.getProperty("effects.slide"));
220
this.hammer.setText(TuxGuitar.getProperty("effects.hammer"));
221
this.ghostNote.setText(TuxGuitar.getProperty("effects.ghostnote"));
222
this.accentuatedNote.setText(TuxGuitar.getProperty("effects.accentuatednote"));
223
this.heavyAccentuatedNote.setText(TuxGuitar.getProperty("effects.heavyaccentuatednote"));
224
this.harmonicNote.setText(TuxGuitar.getProperty("effects.harmonic"));
225
this.graceNote.setText(TuxGuitar.getProperty("effects.grace"));
226
this.trill.setText(TuxGuitar.getProperty("effects.trill"));
227
this.tremoloPicking.setText(TuxGuitar.getProperty("effects.tremolo-picking"));
228
this.palmMute.setText(TuxGuitar.getProperty("effects.palm-mute"));
229
this.staccato.setText(TuxGuitar.getProperty("effects.staccato"));
230
this.tapping.setText(TuxGuitar.getProperty("effects.tapping"));
231
this.slapping.setText(TuxGuitar.getProperty("effects.slapping"));
232
this.popping.setText(TuxGuitar.getProperty("effects.popping"));
233
this.fadeIn.setText(TuxGuitar.getProperty("effects.fade-in"));
236
public void loadIcons(){