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

« back to all changes in this revision

Viewing changes to src/org/herac/tuxguitar/gui/items/menu/CompositionMenuItem.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.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.SystemImages;
14
 
import org.herac.tuxguitar.gui.TuxGuitar;
15
 
import org.herac.tuxguitar.gui.actions.composition.ChangeClefAction;
16
 
import org.herac.tuxguitar.gui.actions.composition.ChangeInfoAction;
17
 
import org.herac.tuxguitar.gui.actions.composition.ChangeKeySignatureAction;
18
 
import org.herac.tuxguitar.gui.actions.composition.ChangeTempoAction;
19
 
import org.herac.tuxguitar.gui.actions.composition.ChangeTimeSignatureAction;
20
 
import org.herac.tuxguitar.gui.actions.composition.ChangeTripletFeelAction;
21
 
import org.herac.tuxguitar.gui.actions.insert.CloseRepeatAction;
22
 
import org.herac.tuxguitar.gui.actions.insert.OpenRepeatAction;
23
 
import org.herac.tuxguitar.gui.editors.TablatureEditor;
24
 
import org.herac.tuxguitar.gui.items.MenuItems;
25
 
 
26
 
/**
27
 
 * @author julian
28
 
 *
29
 
 * TODO To change the template for this generated type comment go to
30
 
 * Window - Preferences - Java - Code Style - Code Templates
31
 
 */
32
 
public class CompositionMenuItem implements MenuItems{
33
 
    private TablatureEditor tablatureEditor;
34
 
    private MenuItem compositionMenuItem;
35
 
    private Menu menu; 
36
 
    private MenuItem timeSignature;
37
 
    private MenuItem tempo;
38
 
    private MenuItem clef;
39
 
    private MenuItem keySignature;    
40
 
    private MenuItem openRepeat;
41
 
    private MenuItem closeRepeat;
42
 
    private MenuItem tripletFeel;
43
 
    
44
 
    private MenuItem properties;
45
 
    
46
 
    public CompositionMenuItem(Shell shell,Menu parent, int style,TablatureEditor tablatureEditor) {
47
 
        this.compositionMenuItem = new MenuItem(parent, style);
48
 
        this.tablatureEditor = tablatureEditor;
49
 
        this.menu = new Menu(shell, SWT.DROP_DOWN);
50
 
    }    
51
 
    
52
 
    public void showItems(){                        
53
 
        //--TIME SIGNATURE--
54
 
        this.timeSignature = new MenuItem(this.menu, SWT.PUSH); 
55
 
        this.timeSignature.setImage(SystemImages.TIME_SIGNATURE_IMAGE);
56
 
        this.timeSignature.addSelectionListener(TuxGuitar.instance().getAction(ChangeTimeSignatureAction.NAME));
57
 
        //--TEMPO--
58
 
        this.tempo = new MenuItem(this.menu, SWT.PUSH);
59
 
        this.tempo.setImage(SystemImages.TEMPO_ICON_IMAGE);
60
 
        this.tempo.addSelectionListener(TuxGuitar.instance().getAction(ChangeTempoAction.NAME));
61
 
        //--CLEF--
62
 
        this.clef = new MenuItem(this.menu, SWT.PUSH); 
63
 
        this.clef.addSelectionListener(TuxGuitar.instance().getAction(ChangeClefAction.NAME));
64
 
        //--KEY SIGNATURE--
65
 
        this.keySignature = new MenuItem(this.menu, SWT.PUSH); 
66
 
        this.keySignature.addSelectionListener(TuxGuitar.instance().getAction(ChangeKeySignatureAction.NAME));
67
 
        //--TRIPLET FEEL--
68
 
        this.tripletFeel = new MenuItem(this.menu, SWT.PUSH); 
69
 
        this.tripletFeel.addSelectionListener(TuxGuitar.instance().getAction(ChangeTripletFeelAction.NAME));        
70
 
        //--SEPARATOR--
71
 
        new MenuItem(this.menu, SWT.SEPARATOR);
72
 
        //--REPEAT OPEN--
73
 
        this.openRepeat = new MenuItem(this.menu, SWT.PUSH);
74
 
        this.openRepeat.setImage(SystemImages.OPEN_REPEAT_IMAGE);
75
 
        this.openRepeat.addSelectionListener(TuxGuitar.instance().getAction(OpenRepeatAction.NAME));            
76
 
        //--REPEAT CLOSE--        
77
 
        this.closeRepeat = new MenuItem(this.menu, SWT.PUSH);
78
 
        this.closeRepeat.setImage(SystemImages.CLOSE_REPEAT_IMAGE);
79
 
        this.closeRepeat.addSelectionListener(TuxGuitar.instance().getAction(CloseRepeatAction.NAME));                
80
 
        //--SEPARATOR--
81
 
        new MenuItem(this.menu, SWT.SEPARATOR);        
82
 
        //--INFO--
83
 
        this.properties = new MenuItem(this.menu, SWT.PUSH);
84
 
        this.properties.setImage(SystemImages.SONG_PROPERTIES);
85
 
        this.properties.addSelectionListener(TuxGuitar.instance().getAction(ChangeInfoAction.NAME));
86
 
        
87
 
        this.compositionMenuItem.setMenu(menu);
88
 
        
89
 
        this.loadProperties();
90
 
    }    
91
 
    
92
 
    public void update(){
93
 
        
94
 
    }
95
 
    
96
 
 
97
 
    public void loadProperties(){
98
 
        this.compositionMenuItem.setText(TuxGuitar.getProperty("composition"));
99
 
        this.timeSignature.setText(TuxGuitar.getProperty("composition.timesignature"));
100
 
        this.tempo.setText(TuxGuitar.getProperty("composition.tempo"));
101
 
        this.clef.setText(TuxGuitar.getProperty("composition.clef"));
102
 
        this.keySignature.setText(TuxGuitar.getProperty("composition.keysignature"));
103
 
        this.tripletFeel.setText(TuxGuitar.getProperty("composition.tripletfeel"));
104
 
        this.openRepeat.setText(TuxGuitar.getProperty("repeat.open"));
105
 
        this.closeRepeat.setText(TuxGuitar.getProperty("repeat.close"));           
106
 
        this.properties.setText(TuxGuitar.getProperty("composition.properties"));
107
 
    }    
108
 
}