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

« back to all changes in this revision

Viewing changes to src/org/herac/tuxguitar/gui/items/tool/NoteEffectToolItems.java

  • Committer: Bazaar Package Importer
  • Author(s): Philippe Coval
  • Date: 2008-06-19 00:30:30 UTC
  • mto: (5.1.2 sid)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20080619003030-h719szrhsngou7c6
Tags: upstream-1.0
ImportĀ upstreamĀ versionĀ 1.0

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.tool;
8
 
 
9
 
import org.eclipse.swt.SWT;
10
 
import org.eclipse.swt.widgets.ToolBar;
11
 
import org.eclipse.swt.widgets.ToolItem;
12
 
import org.herac.tuxguitar.gui.SystemImages;
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.ToolItems;
34
 
import org.herac.tuxguitar.song.models.Note;
35
 
import org.herac.tuxguitar.song.models.NoteEffect;
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 NoteEffectToolItems  extends ToolItems{
43
 
    public static final String NAME = "effect.items";
44
 
    
45
 
    private ToolBar toolBar;
46
 
    
47
 
    private ToolItem deadNote;
48
 
    private ToolItem ghostNote;
49
 
    private ToolItem accentuatedNote;
50
 
    private ToolItem heavyAccentuatedNote;    
51
 
    private ToolItem harmonicNote;
52
 
    private ToolItem graceNote;
53
 
    
54
 
    private ToolItem vibrato;
55
 
    private ToolItem bend;    
56
 
    private ToolItem tremoloBar;
57
 
    private ToolItem slide;
58
 
    private ToolItem hammer;
59
 
    
60
 
    private ToolItem trill;
61
 
    private ToolItem tremoloPicking;
62
 
    private ToolItem palmMute;  
63
 
    
64
 
    private ToolItem staccato;    
65
 
    private ToolItem tapping;
66
 
    private ToolItem slapping;
67
 
    private ToolItem popping;
68
 
    
69
 
    private ToolItem fadeIn;
70
 
    
71
 
    public NoteEffectToolItems(){
72
 
        super(NAME);
73
 
    }
74
 
   
75
 
    public void showItems(ToolBar toolBar){
76
 
        this.toolBar = toolBar;         
77
 
        //--DEAD NOTE--
78
 
        this.deadNote = new ToolItem(toolBar, SWT.CHECK);
79
 
        this.deadNote.setImage(SystemImages.EFFECT_DEAD);
80
 
        this.deadNote.addSelectionListener(TuxGuitar.instance().getAction(ChangeDeadNoteAction.NAME));
81
 
 
82
 
        //--GHOST NOTE--
83
 
        this.ghostNote = new ToolItem(toolBar, SWT.CHECK);
84
 
        this.ghostNote.setImage(SystemImages.EFFECT_GHOST);
85
 
        this.ghostNote.addSelectionListener(TuxGuitar.instance().getAction(ChangeGhostNoteAction.NAME));        
86
 
        
87
 
        //--ACCENTUATED NOTE--
88
 
        this.accentuatedNote = new ToolItem(toolBar, SWT.CHECK);
89
 
        this.accentuatedNote.setImage(SystemImages.EFFECT_ACCENTUATED);
90
 
        this.accentuatedNote.addSelectionListener(TuxGuitar.instance().getAction(ChangeAccentuatedNoteAction.NAME));   
91
 
        
92
 
        //--HEAVY ACCENTUATED NOTE--
93
 
        this.heavyAccentuatedNote = new ToolItem(toolBar, SWT.CHECK);
94
 
        this.heavyAccentuatedNote.setImage(SystemImages.EFFECT_HEAVY_ACCENTUATED);
95
 
        this.heavyAccentuatedNote.addSelectionListener(TuxGuitar.instance().getAction(ChangeHeavyAccentuatedNoteAction.NAME));           
96
 
        
97
 
        //--HARMONIC NOTE--
98
 
        this.harmonicNote = new ToolItem(toolBar, SWT.CHECK);
99
 
        this.harmonicNote.setImage(SystemImages.EFFECT_HARMONIC);
100
 
        this.harmonicNote.addSelectionListener(TuxGuitar.instance().getAction(ChangeHarmonicNoteAction.NAME));  
101
 
        
102
 
        //--GRACE NOTE--
103
 
        this.graceNote = new ToolItem(toolBar, SWT.CHECK);
104
 
        this.graceNote.setImage(SystemImages.EFFECT_GRACE);
105
 
        this.graceNote.addSelectionListener(TuxGuitar.instance().getAction(ChangeGraceNoteAction.NAME));          
106
 
        
107
 
        //--SEPARATOR--
108
 
        new ToolItem(toolBar, SWT.SEPARATOR);        
109
 
        
110
 
        //--VIBRATO--
111
 
        this.vibrato = new ToolItem(toolBar, SWT.CHECK);
112
 
        this.vibrato.setImage(SystemImages.EFFECT_VIBRATO);
113
 
        this.vibrato.addSelectionListener(TuxGuitar.instance().getAction(ChangeVibratoNoteAction.NAME));        
114
 
 
115
 
        //--BEND--
116
 
        this.bend = new ToolItem(toolBar, SWT.CHECK);
117
 
        this.bend.setImage(SystemImages.EFFECT_BEND);
118
 
        this.bend.addSelectionListener(TuxGuitar.instance().getAction(ChangeBendNoteAction.NAME));        
119
 
        
120
 
        //--BEND--
121
 
        this.tremoloBar = new ToolItem(toolBar, SWT.CHECK);
122
 
        this.tremoloBar.setImage(SystemImages.EFFECT_TREMOLO_BAR);
123
 
        this.tremoloBar.addSelectionListener(TuxGuitar.instance().getAction(ChangeTremoloBarAction.NAME));   
124
 
        
125
 
        //--SLIDE--
126
 
        this.slide = new ToolItem(toolBar, SWT.CHECK);
127
 
        this.slide.setImage(SystemImages.EFFECT_SLIDE);
128
 
        this.slide.addSelectionListener(TuxGuitar.instance().getAction(ChangeSlideNoteAction.NAME));        
129
 
        
130
 
        //--HAMMER--
131
 
        this.hammer = new ToolItem(toolBar, SWT.CHECK);
132
 
        this.hammer.setImage(SystemImages.EFFECT_HAMMER);
133
 
        this.hammer.addSelectionListener(TuxGuitar.instance().getAction(ChangeHammerNoteAction.NAME));  
134
 
 
135
 
        
136
 
        //--SEPARATOR--
137
 
        new ToolItem(toolBar, SWT.SEPARATOR);        
138
 
        
139
 
        //--TRILL--
140
 
        this.trill = new ToolItem(toolBar, SWT.CHECK);
141
 
        this.trill.setImage(SystemImages.EFFECT_TRILL);
142
 
        this.trill.addSelectionListener(TuxGuitar.instance().getAction(ChangeTrillNoteAction.NAME));          
143
 
 
144
 
        //--TREMOLO PICKING--
145
 
        this.tremoloPicking = new ToolItem(toolBar, SWT.CHECK);
146
 
        this.tremoloPicking.setImage(SystemImages.EFFECT_TREMOLO_PICKING);
147
 
        this.tremoloPicking.addSelectionListener(TuxGuitar.instance().getAction(ChangeTremoloPickingAction.NAME));          
148
 
        
149
 
        
150
 
        
151
 
        //--PALM MUTE--
152
 
        this.palmMute = new ToolItem(toolBar, SWT.CHECK);
153
 
        this.palmMute.setImage(SystemImages.EFFECT_PALM_MUTE);
154
 
        this.palmMute.addSelectionListener(TuxGuitar.instance().getAction(ChangePalmMuteAction.NAME));        
155
 
        
156
 
        //--STACCATO
157
 
        this.staccato = new ToolItem(toolBar, SWT.CHECK);
158
 
        this.staccato.setImage(SystemImages.EFFECT_STACCATO);
159
 
        this.staccato.addSelectionListener(TuxGuitar.instance().getAction(ChangeStaccatoAction.NAME));         
160
 
        
161
 
        
162
 
        //--SEPARATOR--
163
 
        new ToolItem(toolBar, SWT.SEPARATOR);       
164
 
        
165
 
        //--TAPPING
166
 
        this.tapping = new ToolItem(toolBar, SWT.CHECK);
167
 
        this.tapping.setImage(SystemImages.EFFECT_TAPPING);
168
 
        this.tapping.addSelectionListener(TuxGuitar.instance().getAction(ChangeTappingAction.NAME));         
169
 
 
170
 
        //--SLAPPING
171
 
        this.slapping = new ToolItem(toolBar, SWT.CHECK);
172
 
        this.slapping.setImage(SystemImages.EFFECT_SLAPPING);
173
 
        this.slapping.addSelectionListener(TuxGuitar.instance().getAction(ChangeSlappingAction.NAME));        
174
 
 
175
 
        //--POPPING
176
 
        this.popping = new ToolItem(toolBar, SWT.CHECK);
177
 
        this.popping.setImage(SystemImages.EFFECT_POPPING);
178
 
        this.popping.addSelectionListener(TuxGuitar.instance().getAction(ChangePoppingAction.NAME));             
179
 
        
180
 
        //--SEPARATOR--
181
 
        new ToolItem(toolBar, SWT.SEPARATOR);
182
 
        
183
 
        //--FADE IN
184
 
        this.fadeIn = new ToolItem(toolBar, SWT.CHECK);
185
 
        this.fadeIn.setImage(SystemImages.EFFECT_FADE_IN);
186
 
        this.fadeIn.addSelectionListener(TuxGuitar.instance().getAction(ChangeFadeInAction.NAME));        
187
 
        
188
 
        this.loadProperties();
189
 
    }
190
 
 
191
 
    
192
 
    public void update(){       
193
 
        Note note = TuxGuitar.instance().getTablatureEditor().getTablature().getCaret().getSelectedNote();
194
 
        NoteEffect effect = ((note != null)?note.getEffect():new NoteEffect());
195
 
        
196
 
        this.vibrato.setSelection(effect.isVibrato());
197
 
        this.bend.setSelection(effect.isBend());
198
 
        this.tremoloBar.setSelection(effect.isTremoloBar());
199
 
        this.deadNote.setSelection(effect.isDeadNote());
200
 
        this.slide.setSelection(effect.isSlide());
201
 
        this.hammer.setSelection(effect.isHammer());      
202
 
        this.ghostNote.setSelection(effect.isGhostNote());
203
 
        this.accentuatedNote.setSelection(effect.isAccentuatedNote());
204
 
        this.heavyAccentuatedNote.setSelection(effect.isHeavyAccentuatedNote());
205
 
        this.harmonicNote.setSelection(effect.isHarmonic());
206
 
        this.graceNote.setSelection(effect.isGrace());
207
 
        this.trill.setSelection(effect.isTrill());
208
 
        this.tremoloPicking.setSelection(effect.isTremoloPicking());
209
 
        this.palmMute.setSelection(effect.isPalmMute());
210
 
        this.staccato.setSelection(effect.isStaccato());
211
 
        this.tapping.setSelection(effect.isTapping());
212
 
        this.slapping.setSelection(effect.isSlapping());
213
 
        this.popping.setSelection(effect.isPopping()); 
214
 
        this.fadeIn.setSelection(effect.isFadeIn());
215
 
    }
216
 
    
217
 
    public void loadProperties(){        
218
 
        this.vibrato.setToolTipText(TuxGuitar.getProperty("effects.vibrato"));
219
 
        this.bend.setToolTipText(TuxGuitar.getProperty("effects.bend"));
220
 
        this.popping.setToolTipText(TuxGuitar.getProperty("effects.popping")); 
221
 
        this.deadNote.setToolTipText(TuxGuitar.getProperty("effects.deadnote"));
222
 
        this.slide.setToolTipText(TuxGuitar.getProperty("effects.slide"));
223
 
        this.hammer.setToolTipText(TuxGuitar.getProperty("effects.hammer"));        
224
 
        this.ghostNote.setToolTipText(TuxGuitar.getProperty("effects.ghostnote"));
225
 
        this.accentuatedNote.setToolTipText(TuxGuitar.getProperty("effects.accentuatednote"));
226
 
        this.heavyAccentuatedNote.setToolTipText(TuxGuitar.getProperty("effects.heavyaccentuatednote"));
227
 
        this.harmonicNote.setToolTipText(TuxGuitar.getProperty("effects.harmonic"));
228
 
        this.graceNote.setToolTipText(TuxGuitar.getProperty("effects.grace"));
229
 
        this.trill.setToolTipText(TuxGuitar.getProperty("effects.trill"));
230
 
        this.tremoloPicking.setToolTipText(TuxGuitar.getProperty("effects.tremolo-picking"));
231
 
        this.palmMute.setToolTipText(TuxGuitar.getProperty("effects.palm-mute"));        
232
 
        this.staccato.setToolTipText(TuxGuitar.getProperty("effects.staccato"));
233
 
        this.tapping.setToolTipText(TuxGuitar.getProperty("effects.tapping"));
234
 
        this.slapping.setToolTipText(TuxGuitar.getProperty("effects.slapping"));
235
 
        this.popping.setToolTipText(TuxGuitar.getProperty("effects.popping"));  
236
 
        this.fadeIn.setToolTipText(TuxGuitar.getProperty("effects.fade-in")); 
237
 
    }      
238
 
}
239