~ubuntu-branches/ubuntu/oneiric/tuxguitar/oneiric

« back to all changes in this revision

Viewing changes to TuxGuitar/src/org/herac/tuxguitar/gui/items/menu/NoteEffectsMenuItem.java

  • Committer: Bazaar Package Importer
  • Author(s): Philippe Coval
  • Date: 2008-06-19 00:30:30 UTC
  • mfrom: (1.1.1 upstream) (2.1.3 hardy)
  • Revision ID: james.westby@ubuntu.com-20080619003030-agens2gvd5m4dacu
New upstream release (Closes: #481728) also (LP: #176979, #212207)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Created on 02-dic-2005
 
3
 *
 
4
 * TODO To change the template for this generated file go to
 
5
 * Window - Preferences - Java - Code Style - Code Templates
 
6
 */
 
7
package org.herac.tuxguitar.gui.items.menu;
 
8
 
 
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;
 
35
 
 
36
/**
 
37
 * @author julian
 
38
 *
 
39
 * TODO To change the template for this generated type comment go to
 
40
 * Window - Preferences - Java - Code Style - Code Templates
 
41
 */
 
42
public class NoteEffectsMenuItem implements MenuItems{
 
43
        
 
44
        private MenuItem noteEffectsMenuItem;
 
45
        private Menu menu; 
 
46
        private MenuItem vibrato;
 
47
        private MenuItem bend;
 
48
        private MenuItem tremoloBar;
 
49
        private MenuItem deadNote;
 
50
        private MenuItem slide;
 
51
        private MenuItem hammer;
 
52
        
 
53
        private MenuItem ghostNote;
 
54
        private MenuItem accentuatedNote;
 
55
        private MenuItem heavyAccentuatedNote;
 
56
        
 
57
        private MenuItem harmonicNote;
 
58
        private MenuItem graceNote;
 
59
        private MenuItem trill;
 
60
        private MenuItem tremoloPicking;
 
61
        private MenuItem palmMute;
 
62
        
 
63
        private MenuItem staccato;
 
64
        private MenuItem tapping;
 
65
        private MenuItem slapping;
 
66
        private MenuItem popping;
 
67
        
 
68
        private MenuItem fadeIn;
 
69
        
 
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);
 
73
        }
 
74
        
 
75
        public void showItems(){
 
76
                //--VIBRATO--
 
77
                this.vibrato = new MenuItem(this.menu, SWT.CHECK);
 
78
                this.vibrato.addSelectionListener(TuxGuitar.instance().getAction(ChangeVibratoNoteAction.NAME));
 
79
                
 
80
                //--BEND--
 
81
                this.bend = new MenuItem(this.menu, SWT.CHECK);
 
82
                this.bend.addSelectionListener(TuxGuitar.instance().getAction(ChangeBendNoteAction.NAME));
 
83
                
 
84
                //--BEND--
 
85
                this.tremoloBar = new MenuItem(this.menu, SWT.CHECK);
 
86
                this.tremoloBar.addSelectionListener(TuxGuitar.instance().getAction(ChangeTremoloBarAction.NAME));
 
87
                
 
88
                //--SLIDE--
 
89
                this.slide = new MenuItem(this.menu, SWT.CHECK);
 
90
                this.slide.addSelectionListener(TuxGuitar.instance().getAction(ChangeSlideNoteAction.NAME));
 
91
                
 
92
                //--SLIDE--
 
93
                this.deadNote = new MenuItem(this.menu, SWT.CHECK);
 
94
                this.deadNote.addSelectionListener(TuxGuitar.instance().getAction(ChangeDeadNoteAction.NAME));
 
95
                
 
96
                //--HAMMER--
 
97
                this.hammer = new MenuItem(this.menu, SWT.CHECK);
 
98
                this.hammer.addSelectionListener(TuxGuitar.instance().getAction(ChangeHammerNoteAction.NAME));
 
99
                
 
100
                //--SEPARATOR--
 
101
                new MenuItem(this.menu, SWT.SEPARATOR);
 
102
                
 
103
                //--GHOST NOTE--
 
104
                this.ghostNote = new MenuItem(this.menu, SWT.CHECK);
 
105
                this.ghostNote.addSelectionListener(TuxGuitar.instance().getAction(ChangeGhostNoteAction.NAME));
 
106
                
 
107
                //--ACCENTUATED NOTE--
 
108
                this.accentuatedNote = new MenuItem(this.menu, SWT.CHECK);
 
109
                this.accentuatedNote.addSelectionListener(TuxGuitar.instance().getAction(ChangeAccentuatedNoteAction.NAME));
 
110
                
 
111
                //--HEAVY ACCENTUATED NOTE--
 
112
                this.heavyAccentuatedNote = new MenuItem(this.menu, SWT.CHECK);
 
113
                this.heavyAccentuatedNote.addSelectionListener(TuxGuitar.instance().getAction(ChangeHeavyAccentuatedNoteAction.NAME));
 
114
                
 
115
                //--HARMONIC NOTE--
 
116
                this.harmonicNote = new MenuItem(this.menu, SWT.CHECK);
 
117
                this.harmonicNote.addSelectionListener(TuxGuitar.instance().getAction(ChangeHarmonicNoteAction.NAME));
 
118
                
 
119
                //--GRACE NOTE--
 
120
                this.graceNote = new MenuItem(this.menu, SWT.CHECK);
 
121
                this.graceNote.addSelectionListener(TuxGuitar.instance().getAction(ChangeGraceNoteAction.NAME));
 
122
                
 
123
                //--SEPARATOR--
 
124
                new MenuItem(this.menu, SWT.SEPARATOR);
 
125
                
 
126
                //--TRILL--
 
127
                this.trill = new MenuItem(this.menu, SWT.CHECK);
 
128
                this.trill.addSelectionListener(TuxGuitar.instance().getAction(ChangeTrillNoteAction.NAME));
 
129
                
 
130
                //--TREMOLO PICKING--
 
131
                this.tremoloPicking = new MenuItem(this.menu, SWT.CHECK);
 
132
                this.tremoloPicking.addSelectionListener(TuxGuitar.instance().getAction(ChangeTremoloPickingAction.NAME));
 
133
                
 
134
                //--PALM MUTE--
 
135
                this.palmMute = new MenuItem(this.menu, SWT.CHECK);
 
136
                this.palmMute.addSelectionListener(TuxGuitar.instance().getAction(ChangePalmMuteAction.NAME));
 
137
                
 
138
                //--STACCATO
 
139
                this.staccato = new MenuItem(this.menu, SWT.CHECK);
 
140
                this.staccato.addSelectionListener(TuxGuitar.instance().getAction(ChangeStaccatoAction.NAME));
 
141
                
 
142
                //--SEPARATOR--
 
143
                new MenuItem(this.menu, SWT.SEPARATOR);
 
144
                
 
145
                //--TAPPING
 
146
                this.tapping = new MenuItem(this.menu, SWT.CHECK);
 
147
                this.tapping.addSelectionListener(TuxGuitar.instance().getAction(ChangeTappingAction.NAME));
 
148
                
 
149
                //--SLAPPING
 
150
                this.slapping = new MenuItem(this.menu, SWT.CHECK);
 
151
                this.slapping.addSelectionListener(TuxGuitar.instance().getAction(ChangeSlappingAction.NAME));
 
152
                
 
153
                //--POPPING
 
154
                this.popping = new MenuItem(this.menu, SWT.CHECK);
 
155
                this.popping.addSelectionListener(TuxGuitar.instance().getAction(ChangePoppingAction.NAME));
 
156
                
 
157
                //--SEPARATOR--
 
158
                new MenuItem(this.menu, SWT.SEPARATOR);
 
159
                
 
160
                //--FADE IN
 
161
                this.fadeIn = new MenuItem(this.menu, SWT.CHECK);
 
162
                this.fadeIn.addSelectionListener(TuxGuitar.instance().getAction(ChangeFadeInAction.NAME));
 
163
                
 
164
                this.noteEffectsMenuItem.setMenu(this.menu);
 
165
                
 
166
                this.loadIcons();
 
167
                this.loadProperties();
 
168
        }
 
169
        
 
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);
 
211
        }
 
212
        
 
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"));
 
234
        }
 
235
        
 
236
        public void loadIcons(){
 
237
                //Nothing to do
 
238
        }
 
239
}