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

« back to all changes in this revision

Viewing changes to src/org/herac/tuxguitar/gui/system/config/ConfigDefaults.java

  • Committer: Bazaar Package Importer
  • Author(s): Philippe Coval
  • Date: 2007-02-04 01:41:23 UTC
  • Revision ID: james.westby@ubuntu.com-20070204014123-9pv7okph0iaiqkvw
Tags: upstream-0.9.1
ImportĀ upstreamĀ versionĀ 0.9.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Created on 27-ene-2006
 
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.system.config;
 
8
 
 
9
import java.io.InputStream;
 
10
import java.util.Properties;
 
11
 
 
12
import org.herac.tuxguitar.gui.editors.tab.Tablature;
 
13
import org.herac.tuxguitar.gui.editors.tab.edit.EditorKit;
 
14
import org.herac.tuxguitar.gui.util.TuxGuitarFileUtils;
 
15
 
 
16
/**
 
17
 * @author julian
 
18
 *
 
19
 * TODO To change the template for this generated type comment go to
 
20
 * Window - Preferences - Java - Code Style - Code Templates
 
21
 */
 
22
public class ConfigDefaults{
 
23
    private Properties properties;
 
24
    
 
25
    public ConfigDefaults(){
 
26
        this.properties = new Properties();
 
27
        this.loadDefaults();
 
28
        this.loadDefaultFile();   
 
29
    }
 
30
    
 
31
    public void loadDefaultFile() {       
 
32
        try {        
 
33
                InputStream is = TuxGuitarFileUtils.getResourceAsStream("defaults.properties");
 
34
                if(is != null){
 
35
                        this.properties.load(is);
 
36
                }
 
37
        } catch (Exception e) {
 
38
            e.printStackTrace();
 
39
        }
 
40
    }    
 
41
    
 
42
    private void loadDefaults(){
 
43
        this.loadProperty(ConfigKeys.WINDOW_TITLE,"${appname} - ${filename}");
 
44
        this.loadProperty(ConfigKeys.SHOW_SPLASH,true);         
 
45
        this.loadProperty(ConfigKeys.MAXIMIZED,false);
 
46
        this.loadProperty(ConfigKeys.WIDTH,800);
 
47
        this.loadProperty(ConfigKeys.HEIGHT,600);               
 
48
        this.loadProperty(ConfigKeys.SHOW_MIXER,false);
 
49
        this.loadProperty(ConfigKeys.SHOW_TRANSPORT,false);
 
50
        this.loadProperty(ConfigKeys.SHOW_FRETBOARD,false);
 
51
        this.loadProperty(ConfigKeys.SHOW_PIANO,false);
 
52
        this.loadProperty(ConfigKeys.LAYOUT_MODE,2);
 
53
        this.loadProperty(ConfigKeys.SHOW_MULTITRACK,true);
 
54
        this.loadProperty(ConfigKeys.SHOW_SCORE,true);        
 
55
        this.loadProperty(ConfigKeys.SHOW_TABLATURE,true);
 
56
        this.loadProperty(ConfigKeys.EDITOR_MOUSE_MODE,EditorKit.MOUSE_MODE_EDITION);
 
57
        this.loadProperty(ConfigKeys.EDITOR_NATURAL_KEY_MODE,true);
 
58
        this.loadProperty(ConfigKeys.FONT_DEFAULT,"Sans,6,2");
 
59
        this.loadProperty(ConfigKeys.FONT_NOTE,"Sans,7,1");        
 
60
        this.loadProperty(ConfigKeys.FONT_TIME_SIGNATURE,"Sans,13,3");                   
 
61
        this.loadProperty(ConfigKeys.FONT_PRINTER_DEFAULT,"Sans,6,2");                 
 
62
        this.loadProperty(ConfigKeys.FONT_PRINTER_NOTE,"Sans,6,0");
 
63
        this.loadProperty(ConfigKeys.FONT_PRINTER_TIME_SIGNATURE,"Sans,12,3");
 
64
        this.loadProperty(ConfigKeys.FONT_LYRIC,"Sans,7,2");
 
65
        this.loadProperty(ConfigKeys.FONT_GRACE,"Sans,6,0");        
 
66
        this.loadProperty(ConfigKeys.FONT_ABOUT_DIALOG_TITLE,"Serif,36,3");          
 
67
        this.loadProperty(ConfigKeys.COLOR_LINE,"150,150,150");
 
68
        this.loadProperty(ConfigKeys.COLOR_SCORE_NOTE,"0,0,0");       
 
69
        this.loadProperty(ConfigKeys.COLOR_TAB_NOTE,"0,0,0");       
 
70
        this.loadProperty(ConfigKeys.COLOR_PLAY_NOTE,"255,0,0");             
 
71
        this.loadProperty(ConfigKeys.MAX_HISTORY_FILES,10);
 
72
        this.loadProperty(ConfigKeys.AUTO_SPACING_ENABLE,true);
 
73
        this.loadProperty(ConfigKeys.MIN_SCORE_TABLATURE_SPAN,20);    
 
74
        this.loadProperty(ConfigKeys.SCORE_LINE_SPAN,8);
 
75
        this.loadProperty(ConfigKeys.TAB_LINE_SPAN,10);    
 
76
        this.loadProperty(ConfigKeys.FIRST_TRACK_SPAN,25);
 
77
        this.loadProperty(ConfigKeys.TRACK_SPAN,10);        
 
78
        this.loadProperty(ConfigKeys.FRETBOARD_STRING_SPAN,20);        
 
79
        this.loadProperty(ConfigKeys.LANGUAGE,"");
 
80
        this.loadProperty(ConfigKeys.SOUNDBANK_CUSTOM,false);                            
 
81
        this.loadProperty(ConfigKeys.SYSTEM_PLAYER,"org.herac.tuxguitar.player.impl.MidiPlayerImpl");        
 
82
        this.loadProperty(ConfigKeys.TABLATURE_FLAGS,Tablature.ALLOW_PLAY_CACHE);
 
83
    }
 
84
    
 
85
    public Properties getProperties() {      
 
86
        return this.properties;        
 
87
    }        
 
88
 
 
89
    private void loadProperty(String key,String value){
 
90
        this.properties.setProperty(key,value);
 
91
    }
 
92
    
 
93
    private void loadProperty(String key,int value){
 
94
        this.properties.setProperty(key,Integer.toString(value));
 
95
    }
 
96
    
 
97
    private void loadProperty(String key,boolean value){        
 
98
        this.properties.setProperty(key,Boolean.toString(value));
 
99
    }
 
100
 
 
101
}