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

« back to all changes in this revision

Viewing changes to 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.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;
37
 
 
38
 
/**
39
 
 * @author julian
40
 
 *
41
 
 * TODO To change the template for this generated type comment go to
42
 
 * Window - Preferences - Java - Code Style - Code Templates
43
 
 */
44
 
public class NoteEffectsMenuItem implements MenuItems{
45
 
    private TablatureEditor tablatureEditor;
46
 
    private MenuItem noteEffectsMenuItem;
47
 
    private Menu menu; 
48
 
    private MenuItem vibrato;
49
 
    private MenuItem bend;
50
 
    private MenuItem tremoloBar;
51
 
    private MenuItem deadNote;
52
 
    private MenuItem slide;
53
 
    private MenuItem hammer;
54
 
    
55
 
    private MenuItem ghostNote;
56
 
    private MenuItem accentuatedNote;
57
 
    private MenuItem heavyAccentuatedNote;
58
 
    
59
 
    private MenuItem harmonicNote;
60
 
    private MenuItem graceNote;
61
 
    private MenuItem trill;
62
 
    private MenuItem tremoloPicking;
63
 
    private MenuItem palmMute;
64
 
    
65
 
    private MenuItem staccato;    
66
 
    private MenuItem tapping;
67
 
    private MenuItem slapping;
68
 
    private MenuItem popping;
69
 
    
70
 
    private MenuItem fadeIn;
71
 
    
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);
76
 
    }    
77
 
    
78
 
    public void showItems(){                        
79
 
        //--VIBRATO--
80
 
        this.vibrato = new MenuItem(this.menu, SWT.CHECK);        
81
 
        this.vibrato.addSelectionListener(TuxGuitar.instance().getAction(ChangeVibratoNoteAction.NAME));
82
 
 
83
 
        //--BEND--
84
 
        this.bend = new MenuItem(this.menu, SWT.CHECK);        
85
 
        this.bend.addSelectionListener(TuxGuitar.instance().getAction(ChangeBendNoteAction.NAME));        
86
 
 
87
 
        //--BEND--
88
 
        this.tremoloBar = new MenuItem(this.menu, SWT.CHECK);        
89
 
        this.tremoloBar.addSelectionListener(TuxGuitar.instance().getAction(ChangeTremoloBarAction.NAME));        
90
 
        
91
 
        //--SLIDE--
92
 
        this.slide = new MenuItem(this.menu, SWT.CHECK);        
93
 
        this.slide.addSelectionListener(TuxGuitar.instance().getAction(ChangeSlideNoteAction.NAME));  
94
 
 
95
 
        //--SLIDE--
96
 
        this.deadNote = new MenuItem(this.menu, SWT.CHECK);        
97
 
        this.deadNote.addSelectionListener(TuxGuitar.instance().getAction(ChangeDeadNoteAction.NAME));        
98
 
        
99
 
        //--HAMMER--
100
 
        this.hammer = new MenuItem(this.menu, SWT.CHECK);                           
101
 
        this.hammer.addSelectionListener(TuxGuitar.instance().getAction(ChangeHammerNoteAction.NAME));          
102
 
        
103
 
        //--SEPARATOR--
104
 
        new MenuItem(this.menu, SWT.SEPARATOR);     
105
 
        
106
 
        //--GHOST NOTE--
107
 
        this.ghostNote = new MenuItem(this.menu, SWT.CHECK);                           
108
 
        this.ghostNote.addSelectionListener(TuxGuitar.instance().getAction(ChangeGhostNoteAction.NAME));        
109
 
        
110
 
        //--ACCENTUATED NOTE--
111
 
        this.accentuatedNote = new MenuItem(this.menu, SWT.CHECK);                           
112
 
        this.accentuatedNote.addSelectionListener(TuxGuitar.instance().getAction(ChangeAccentuatedNoteAction.NAME));    
113
 
        
114
 
        //--HEAVY ACCENTUATED NOTE--
115
 
        this.heavyAccentuatedNote = new MenuItem(this.menu, SWT.CHECK);                           
116
 
        this.heavyAccentuatedNote.addSelectionListener(TuxGuitar.instance().getAction(ChangeHeavyAccentuatedNoteAction.NAME));            
117
 
        
118
 
        //--HARMONIC NOTE--
119
 
        this.harmonicNote = new MenuItem(this.menu, SWT.CHECK);                           
120
 
        this.harmonicNote.addSelectionListener(TuxGuitar.instance().getAction(ChangeHarmonicNoteAction.NAME));           
121
 
                
122
 
        //--GRACE NOTE--
123
 
        this.graceNote = new MenuItem(this.menu, SWT.CHECK);                           
124
 
        this.graceNote.addSelectionListener(TuxGuitar.instance().getAction(ChangeGraceNoteAction.NAME));           
125
 
        
126
 
        
127
 
        //--SEPARATOR--
128
 
        new MenuItem(this.menu, SWT.SEPARATOR);          
129
 
        
130
 
        //--TRILL--
131
 
        this.trill = new MenuItem(this.menu, SWT.CHECK);                           
132
 
        this.trill.addSelectionListener(TuxGuitar.instance().getAction(ChangeTrillNoteAction.NAME));         
133
 
                
134
 
        //--TREMOLO PICKING--
135
 
        this.tremoloPicking = new MenuItem(this.menu, SWT.CHECK);                           
136
 
        this.tremoloPicking.addSelectionListener(TuxGuitar.instance().getAction(ChangeTremoloPickingAction.NAME));                        
137
 
        
138
 
        //--PALM MUTE--
139
 
        this.palmMute = new MenuItem(this.menu, SWT.CHECK);
140
 
        this.palmMute.addSelectionListener(TuxGuitar.instance().getAction(ChangePalmMuteAction.NAME));           
141
 
        
142
 
        //--STACCATO
143
 
        this.staccato = new MenuItem(this.menu, SWT.CHECK);
144
 
        this.staccato.addSelectionListener(TuxGuitar.instance().getAction(ChangeStaccatoAction.NAME));         
145
 
        
146
 
        
147
 
        //--SEPARATOR--
148
 
        new MenuItem(this.menu, SWT.SEPARATOR);  
149
 
        
150
 
        //--TAPPING
151
 
        this.tapping = new MenuItem(this.menu, SWT.CHECK);
152
 
        this.tapping.addSelectionListener(TuxGuitar.instance().getAction(ChangeTappingAction.NAME));         
153
 
 
154
 
        //--SLAPPING
155
 
        this.slapping = new MenuItem(this.menu, SWT.CHECK);
156
 
        this.slapping.addSelectionListener(TuxGuitar.instance().getAction(ChangeSlappingAction.NAME));        
157
 
 
158
 
        //--POPPING
159
 
        this.popping = new MenuItem(this.menu, SWT.CHECK);
160
 
        this.popping.addSelectionListener(TuxGuitar.instance().getAction(ChangePoppingAction.NAME));        
161
 
        
162
 
        
163
 
        //--SEPARATOR--
164
 
        new MenuItem(this.menu, SWT.SEPARATOR);  
165
 
        
166
 
        //--FADE IN
167
 
        this.fadeIn = new MenuItem(this.menu, SWT.CHECK);
168
 
        this.fadeIn.addSelectionListener(TuxGuitar.instance().getAction(ChangeFadeInAction.NAME));           
169
 
        
170
 
        this.noteEffectsMenuItem.setMenu(menu);
171
 
        
172
 
        this.loadProperties();
173
 
    }    
174
 
    
175
 
    public void update(){       
176
 
        Note note = tablatureEditor.getTablature().getCaret().getSelectedNote();
177
 
        NoteEffect effect = ((note != null)?note.getEffect():new NoteEffect());
178
 
        
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());
198
 
    }
199
 
    
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"));    
221
 
    }       
222
 
}