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.composition.ChangeClefAction;
15
import org.herac.tuxguitar.gui.actions.composition.ChangeInfoAction;
16
import org.herac.tuxguitar.gui.actions.composition.ChangeKeySignatureAction;
17
import org.herac.tuxguitar.gui.actions.composition.ChangeTempoAction;
18
import org.herac.tuxguitar.gui.actions.composition.ChangeTimeSignatureAction;
19
import org.herac.tuxguitar.gui.actions.composition.ChangeTripletFeelAction;
20
import org.herac.tuxguitar.gui.actions.insert.RepeatAlternativeAction;
21
import org.herac.tuxguitar.gui.actions.insert.RepeatCloseAction;
22
import org.herac.tuxguitar.gui.actions.insert.RepeatOpenAction;
23
import org.herac.tuxguitar.gui.items.MenuItems;
28
* TODO To change the template for this generated type comment go to
29
* Window - Preferences - Java - Code Style - Code Templates
31
public class CompositionMenuItem implements MenuItems{
32
private MenuItem compositionMenuItem;
34
private MenuItem timeSignature;
35
private MenuItem tempo;
36
private MenuItem clef;
37
private MenuItem keySignature;
38
private MenuItem repeatOpen;
39
private MenuItem repeatClose;
40
private MenuItem repeatAlternative;
41
private MenuItem tripletFeel;
43
private MenuItem properties;
45
public CompositionMenuItem(Shell shell,Menu parent, int style) {
46
this.compositionMenuItem = new MenuItem(parent, style);
47
this.menu = new Menu(shell, SWT.DROP_DOWN);
50
public void showItems(){
52
this.timeSignature = new MenuItem(this.menu, SWT.PUSH);
53
this.timeSignature.addSelectionListener(TuxGuitar.instance().getAction(ChangeTimeSignatureAction.NAME));
55
this.tempo = new MenuItem(this.menu, SWT.PUSH);
56
this.tempo.addSelectionListener(TuxGuitar.instance().getAction(ChangeTempoAction.NAME));
58
this.clef = new MenuItem(this.menu, SWT.PUSH);
59
this.clef.addSelectionListener(TuxGuitar.instance().getAction(ChangeClefAction.NAME));
61
this.keySignature = new MenuItem(this.menu, SWT.PUSH);
62
this.keySignature.addSelectionListener(TuxGuitar.instance().getAction(ChangeKeySignatureAction.NAME));
64
this.tripletFeel = new MenuItem(this.menu, SWT.PUSH);
65
this.tripletFeel.addSelectionListener(TuxGuitar.instance().getAction(ChangeTripletFeelAction.NAME));
67
new MenuItem(this.menu, SWT.SEPARATOR);
69
this.repeatOpen = new MenuItem(this.menu, SWT.PUSH);
70
this.repeatOpen.addSelectionListener(TuxGuitar.instance().getAction(RepeatOpenAction.NAME));
72
this.repeatClose = new MenuItem(this.menu, SWT.PUSH);
73
this.repeatClose.addSelectionListener(TuxGuitar.instance().getAction(RepeatCloseAction.NAME));
74
//--REPEAT ALTERNATIVE--
75
this.repeatAlternative = new MenuItem(this.menu, SWT.PUSH);
76
this.repeatAlternative.addSelectionListener(TuxGuitar.instance().getAction(RepeatAlternativeAction.NAME));
79
new MenuItem(this.menu, SWT.SEPARATOR);
81
this.properties = new MenuItem(this.menu, SWT.PUSH);
82
this.properties.addSelectionListener(TuxGuitar.instance().getAction(ChangeInfoAction.NAME));
84
this.compositionMenuItem.setMenu(this.menu);
87
this.loadProperties();
91
boolean running = TuxGuitar.instance().getPlayer().isRunning();
92
this.timeSignature.setEnabled(!running);
93
this.tempo.setEnabled(!running);
94
this.clef.setEnabled(!running);
95
this.keySignature.setEnabled(!running);
96
this.tripletFeel.setEnabled(!running);
97
this.repeatOpen.setEnabled(!running);
98
this.repeatClose.setEnabled(!running);
99
this.repeatAlternative.setEnabled(!running);
102
public void loadProperties(){
103
this.compositionMenuItem.setText(TuxGuitar.getProperty("composition"));
104
this.timeSignature.setText(TuxGuitar.getProperty("composition.timesignature"));
105
this.tempo.setText(TuxGuitar.getProperty("composition.tempo"));
106
this.clef.setText(TuxGuitar.getProperty("composition.clef"));
107
this.keySignature.setText(TuxGuitar.getProperty("composition.keysignature"));
108
this.tripletFeel.setText(TuxGuitar.getProperty("composition.tripletfeel"));
109
this.repeatOpen.setText(TuxGuitar.getProperty("repeat.open"));
110
this.repeatClose.setText(TuxGuitar.getProperty("repeat.close"));
111
this.repeatAlternative.setText(TuxGuitar.getProperty("repeat.alternative"));
112
this.properties.setText(TuxGuitar.getProperty("composition.properties"));
115
public void loadIcons() {
116
this.timeSignature.setImage(TuxGuitar.instance().getIconManager().getCompositionTimeSignature());
117
this.tempo.setImage(TuxGuitar.instance().getIconManager().getCompositionTempo());
118
this.repeatOpen.setImage(TuxGuitar.instance().getIconManager().getCompositionRepeatOpen());
119
this.repeatClose.setImage(TuxGuitar.instance().getIconManager().getCompositionRepeatClose());
120
this.repeatAlternative.setImage(TuxGuitar.instance().getIconManager().getCompositionRepeatAlternative());
121
this.properties.setImage(TuxGuitar.instance().getIconManager().getSongProperties());