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.layout.SetChordDiagramEnabledAction;
15
import org.herac.tuxguitar.gui.actions.layout.SetChordNameEnabledAction;
16
import org.herac.tuxguitar.gui.actions.layout.SetCompactViewAction;
17
import org.herac.tuxguitar.gui.actions.layout.SetLinearLayoutAction;
18
import org.herac.tuxguitar.gui.actions.layout.SetMultitrackViewAction;
19
import org.herac.tuxguitar.gui.actions.layout.SetPageLayoutAction;
20
import org.herac.tuxguitar.gui.actions.layout.SetScoreEnabledAction;
21
import org.herac.tuxguitar.gui.actions.layout.SetTablatureEnabledAction;
22
import org.herac.tuxguitar.gui.actions.view.ShowFretBoardAction;
23
import org.herac.tuxguitar.gui.actions.view.ShowMatrixAction;
24
import org.herac.tuxguitar.gui.actions.view.ShowMixerAction;
25
import org.herac.tuxguitar.gui.actions.view.ShowPianoAction;
26
import org.herac.tuxguitar.gui.actions.view.ShowTransportAction;
27
import org.herac.tuxguitar.gui.editors.tab.layout.LinearViewLayout;
28
import org.herac.tuxguitar.gui.editors.tab.layout.PageViewLayout;
29
import org.herac.tuxguitar.gui.editors.tab.layout.ViewLayout;
30
import org.herac.tuxguitar.gui.items.MenuItems;
35
* TODO To change the template for this generated type comment go to
36
* Window - Preferences - Java - Code Style - Code Templates
38
public class ViewMenuItem implements MenuItems{
41
private Menu chordMenu;
42
private MenuItem layoutMenuItem;
43
private MenuItem showMixer;
44
private MenuItem showTransport;
45
private MenuItem showFretBoard;
46
private MenuItem showPiano;
47
private MenuItem showMatrix;
48
private MenuItem pageLayout;
49
private MenuItem linearLayout;
50
private MenuItem multitrack;
51
private MenuItem scoreEnabled;
52
private MenuItem tablatureEnabled;
53
private MenuItem compact;
55
private MenuItem chordMenuItem;
56
private MenuItem chordName;
57
private MenuItem chordDiagram;
59
public ViewMenuItem(Shell shell,Menu parent, int style) {
60
this.layoutMenuItem = new MenuItem(parent, style);
61
this.menu = new Menu(shell, SWT.DROP_DOWN);
64
public void showItems(){
66
this.showMixer = new MenuItem(this.menu, SWT.CHECK);
67
this.showMixer.addSelectionListener(TuxGuitar.instance().getAction(ShowMixerAction.NAME));
70
this.showTransport = new MenuItem(this.menu, SWT.CHECK);
71
this.showTransport.addSelectionListener(TuxGuitar.instance().getAction(ShowTransportAction.NAME));
74
this.showFretBoard = new MenuItem(this.menu, SWT.CHECK);
75
this.showFretBoard.addSelectionListener(TuxGuitar.instance().getAction(ShowFretBoardAction.NAME));
78
this.showPiano = new MenuItem(this.menu, SWT.CHECK);
79
this.showPiano.addSelectionListener(TuxGuitar.instance().getAction(ShowPianoAction.NAME));
82
this.showMatrix = new MenuItem(this.menu, SWT.CHECK);
83
this.showMatrix.addSelectionListener(TuxGuitar.instance().getAction(ShowMatrixAction.NAME));
85
new MenuItem(this.menu, SWT.SEPARATOR);
88
this.pageLayout = new MenuItem(this.menu, SWT.RADIO);
89
this.pageLayout.addSelectionListener(TuxGuitar.instance().getAction(SetPageLayoutAction.NAME));
92
this.linearLayout = new MenuItem(this.menu, SWT.RADIO);
93
this.linearLayout.addSelectionListener(TuxGuitar.instance().getAction(SetLinearLayoutAction.NAME));
96
this.multitrack = new MenuItem(this.menu, SWT.CHECK);
97
this.multitrack.addSelectionListener(TuxGuitar.instance().getAction(SetMultitrackViewAction.NAME));
100
this.scoreEnabled = new MenuItem(this.menu, SWT.CHECK);
101
this.scoreEnabled.addSelectionListener(TuxGuitar.instance().getAction(SetScoreEnabledAction.NAME));
104
this.tablatureEnabled = new MenuItem(this.menu, SWT.CHECK);
105
this.tablatureEnabled.addSelectionListener(TuxGuitar.instance().getAction(SetTablatureEnabledAction.NAME));
108
this.compact = new MenuItem(this.menu, SWT.CHECK);
109
this.compact.addSelectionListener(TuxGuitar.instance().getAction(SetCompactViewAction.NAME));
111
new MenuItem(this.menu, SWT.SEPARATOR);
114
this.chordMenuItem = new MenuItem(this.menu,SWT.CASCADE);
115
this.chordMenu = new Menu(this.menu.getShell(), SWT.DROP_DOWN);
117
this.chordName = new MenuItem(this.chordMenu, SWT.CHECK);
118
this.chordName.addSelectionListener(TuxGuitar.instance().getAction(SetChordNameEnabledAction.NAME));
120
this.chordDiagram = new MenuItem(this.chordMenu, SWT.CHECK);
121
this.chordDiagram.addSelectionListener(TuxGuitar.instance().getAction(SetChordDiagramEnabledAction.NAME));
123
this.chordMenuItem.setMenu(this.chordMenu);
124
this.layoutMenuItem.setMenu(this.menu);
127
this.loadProperties();
130
public void update(){
131
ViewLayout layout = TuxGuitar.instance().getTablatureEditor().getTablature().getViewLayout();
132
int style = layout.getStyle();
133
this.showMixer.setSelection(!TuxGuitar.instance().getMixer().isDisposed());
134
this.showTransport.setSelection(!TuxGuitar.instance().getTransport().isDisposed());
135
this.showFretBoard.setSelection(TuxGuitar.instance().getFretBoardEditor().isVisible());
136
this.showPiano.setSelection(!TuxGuitar.instance().getPianoEditor().isDisposed());
137
this.showMatrix.setSelection(!TuxGuitar.instance().getMatrixEditor().isDisposed());
138
this.pageLayout.setSelection(layout instanceof PageViewLayout);
139
this.linearLayout.setSelection(layout instanceof LinearViewLayout);
140
this.multitrack.setSelection( (style & ViewLayout.DISPLAY_MULTITRACK) != 0 );
141
this.scoreEnabled.setSelection( (style & ViewLayout.DISPLAY_SCORE) != 0 );
142
this.tablatureEnabled.setSelection( (style & ViewLayout.DISPLAY_TABLATURE) != 0 );
143
this.compact.setSelection( (style & ViewLayout.DISPLAY_COMPACT) != 0 );
144
this.compact.setEnabled((style & ViewLayout.DISPLAY_MULTITRACK) == 0 || layout.getSongManager().getSong().countTracks() == 1);
145
this.chordName.setSelection( (style & ViewLayout.DISPLAY_CHORD_NAME) != 0 );
146
this.chordDiagram.setSelection( (style & ViewLayout.DISPLAY_CHORD_DIAGRAM) != 0 );
149
public void loadProperties(){
150
this.layoutMenuItem.setText(TuxGuitar.getProperty("view"));
151
this.showMixer.setText(TuxGuitar.getProperty("view.show-mixer"));
152
this.showTransport.setText(TuxGuitar.getProperty("view.show-transport"));
153
this.showFretBoard.setText(TuxGuitar.getProperty("view.show-fretboard"));
154
this.showPiano.setText(TuxGuitar.getProperty("view.show-piano"));
155
this.showMatrix.setText(TuxGuitar.getProperty("view.show-matrix"));
156
this.pageLayout.setText(TuxGuitar.getProperty("view.layout.page"));
157
this.linearLayout.setText(TuxGuitar.getProperty("view.layout.linear"));
158
this.multitrack.setText(TuxGuitar.getProperty("view.layout.multitrack"));
159
this.scoreEnabled.setText(TuxGuitar.getProperty("view.layout.score-enabled"));
160
this.tablatureEnabled.setText(TuxGuitar.getProperty("view.layout.tablature-enabled"));
161
this.compact.setText(TuxGuitar.getProperty("view.layout.compact"));
162
this.chordMenuItem.setText(TuxGuitar.getProperty("view.layout.chord-style"));
163
this.chordName.setText(TuxGuitar.getProperty("view.layout.chord-name"));
164
this.chordDiagram.setText(TuxGuitar.getProperty("view.layout.chord-diagram"));
167
public void loadIcons(){