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

« back to all changes in this revision

Viewing changes to src/org/herac/tuxguitar/gui/system/config/items/MainOption.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
 
package org.herac.tuxguitar.gui.system.config.items;
2
 
 
3
 
import org.eclipse.swt.SWT;
4
 
import org.eclipse.swt.layout.GridData;
5
 
import org.eclipse.swt.layout.GridLayout;
6
 
import org.eclipse.swt.widgets.Button;
7
 
import org.eclipse.swt.widgets.Composite;
8
 
import org.eclipse.swt.widgets.Text;
9
 
import org.eclipse.swt.widgets.ToolBar;
10
 
import org.herac.tuxguitar.gui.SystemImages;
11
 
import org.herac.tuxguitar.gui.TuxGuitar;
12
 
import org.herac.tuxguitar.gui.system.config.ConfigKeys;
13
 
import org.herac.tuxguitar.gui.system.config.ConfigEditor;
14
 
import org.herac.tuxguitar.gui.util.WindowTitleUtil;
15
 
 
16
 
public class MainOption  extends Option{        
17
 
        private Button showSplash;
18
 
        private Text windowTitle;
19
 
    
20
 
    public MainOption(ConfigEditor configEditor,ToolBar toolBar,final Composite parent){
21
 
        super(configEditor,toolBar,parent,TuxGuitar.getProperty("settings.config.main"));            
22
 
    }        
23
 
 
24
 
    public void createOption(){         
25
 
                getToolItem().setText(TuxGuitar.getProperty("settings.config.main"));   
26
 
                getToolItem().setImage(SystemImages.OPTION_VIEW);
27
 
                getToolItem().addSelectionListener(this);
28
 
                
29
 
                showLabel(getComposite(),SWT.TOP | SWT.LEFT | SWT.WRAP,SWT.BOLD,0,TuxGuitar.getProperty("settings.config.main.window-title"));
30
 
                
31
 
                Composite windowTitleComposite = new Composite(getComposite(),SWT.NONE);
32
 
                windowTitleComposite.setLayout(new GridLayout());
33
 
                windowTitleComposite.setLayoutData(getTabbedData());
34
 
        
35
 
                this.windowTitle = new Text(windowTitleComposite,SWT.BORDER);           
36
 
                this.windowTitle.setLayoutData(new GridData(MINIMUN_WIDTH,SWT.DEFAULT));
37
 
                this.windowTitle.setTextLimit(80);
38
 
                this.windowTitle.setText(getConfig().getStringConfigValue(ConfigKeys.WINDOW_TITLE));
39
 
                                
40
 
                Composite infoHeader = new Composite(windowTitleComposite,SWT.NONE);
41
 
                infoHeader.setLayout(new GridLayout(2,false));
42
 
                infoHeader.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true));
43
 
                                
44
 
                showImageLabel(infoHeader,SWT.NONE,infoHeader.getDisplay().getSystemImage(SWT.ICON_INFORMATION));
45
 
                showLabel(infoHeader,SWT.TOP | SWT.LEFT | SWT.WRAP,SWT.NORMAL,0,TuxGuitar.getProperty("settings.config.main.window-title.help"));               
46
 
                
47
 
                Composite infoBody = new Composite(windowTitleComposite,SWT.NONE);
48
 
                infoBody.setLayout(new GridLayout(2,false));
49
 
                infoBody.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true));
50
 
                
51
 
                showLabel(infoBody, SWT.NONE,SWT.BOLD,-1,WindowTitleUtil.getVar(WindowTitleUtil.VAR_APP_NAME));
52
 
                showLabel(infoBody,SWT.TOP | SWT.WRAP,SWT.NORMAL,0,TuxGuitar.getProperty("settings.config.main.window-title.var.description." + WindowTitleUtil.VAR_APP_NAME ));
53
 
                
54
 
                showLabel(infoBody, SWT.NONE,SWT.BOLD,-1,WindowTitleUtil.getVar(WindowTitleUtil.VAR_APP_VERSION));
55
 
                showLabel(infoBody,SWT.TOP | SWT.WRAP,SWT.NORMAL,0,TuxGuitar.getProperty("settings.config.main.window-title.var.description." + WindowTitleUtil.VAR_APP_VERSION ));
56
 
                
57
 
                showLabel(infoBody, SWT.NONE,SWT.BOLD,-1,WindowTitleUtil.getVar(WindowTitleUtil.VAR_FILE_NAME));
58
 
                showLabel(infoBody,SWT.TOP | SWT.WRAP,SWT.NORMAL,0,TuxGuitar.getProperty("settings.config.main.window-title.var.description." + WindowTitleUtil.VAR_FILE_NAME ));
59
 
                
60
 
                showLabel(infoBody, SWT.NONE,SWT.BOLD,-1,WindowTitleUtil.getVar(WindowTitleUtil.VAR_FILE_PATH));
61
 
                showLabel(infoBody,SWT.TOP | SWT.WRAP,SWT.NORMAL,0,TuxGuitar.getProperty("settings.config.main.window-title.var.description." + WindowTitleUtil.VAR_FILE_PATH ));
62
 
                
63
 
                showLabel(infoBody, SWT.NONE,SWT.BOLD,-1,WindowTitleUtil.getVar(WindowTitleUtil.VAR_SONG_NAME));
64
 
                showLabel(infoBody,SWT.TOP | SWT.WRAP,SWT.NORMAL,0,TuxGuitar.getProperty("settings.config.main.window-title.var.description." + WindowTitleUtil.VAR_SONG_NAME ));
65
 
                
66
 
                showLabel(infoBody, SWT.NONE,SWT.BOLD,-1,WindowTitleUtil.getVar(WindowTitleUtil.VAR_SONG_ALBUM));
67
 
                showLabel(infoBody,SWT.TOP | SWT.WRAP,SWT.NORMAL,0,TuxGuitar.getProperty("settings.config.main.window-title.var.description." + WindowTitleUtil.VAR_SONG_ALBUM ));
68
 
                
69
 
                showLabel(infoBody, SWT.NONE,SWT.BOLD,-1,WindowTitleUtil.getVar(WindowTitleUtil.VAR_SONG_INTERPRET));
70
 
                showLabel(infoBody,SWT.TOP | SWT.WRAP,SWT.NORMAL,0,TuxGuitar.getProperty("settings.config.main.window-title.var.description." + WindowTitleUtil.VAR_SONG_INTERPRET ));
71
 
                
72
 
                showLabel(infoBody, SWT.NONE,SWT.BOLD,-1,WindowTitleUtil.getVar(WindowTitleUtil.VAR_SONG_AUTHOR));
73
 
                showLabel(infoBody,SWT.TOP | SWT.WRAP,SWT.NORMAL,0,TuxGuitar.getProperty("settings.config.main.window-title.var.description." + WindowTitleUtil.VAR_SONG_AUTHOR ));     
74
 
                
75
 
                showLabel(getComposite(),SWT.BOTTOM | SWT.LEFT | SWT.WRAP,SWT.BOLD,0,TuxGuitar.getProperty("settings.config.main.options"));
76
 
                
77
 
                Composite options = new Composite(getComposite(),SWT.NONE);
78
 
                options.setLayout(new GridLayout(2,false));
79
 
                options.setLayoutData(getTabbedData());
80
 
        
81
 
                this.showSplash = new Button(options,SWT.CHECK);
82
 
                this.showSplash.setLayoutData(spanData(new GridData(),2));
83
 
                this.showSplash.setText(TuxGuitar.getProperty("settings.config.main.splash-enabled"));
84
 
                this.showSplash.setSelection(getConfig().getBooleanConfigValue(ConfigKeys.SHOW_SPLASH));                                
85
 
    }                  
86
 
    
87
 
    private GridData spanData(GridData data,int horizontalSpan){
88
 
        data.horizontalSpan = horizontalSpan;
89
 
        return data;
90
 
    }
91
 
 
92
 
    public void updateConfig(){
93
 
        getConfig().setProperty(ConfigKeys.WINDOW_TITLE,this.windowTitle.getText());
94
 
        getConfig().setProperty(ConfigKeys.SHOW_SPLASH,this.showSplash.getSelection());
95
 
    }    
96
 
    
97
 
    public void applyConfig(boolean force){
98
 
        TuxGuitar.instance().showTitle();
99
 
    }
100
 
}    
 
 
b'\\ No newline at end of file'