Subversion Repositories svn.mios

Rev

Rev 757 | Rev 808 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 757 Rev 762
Line 29... Line 29...
29
29
30
import javax.swing.JApplet;
30
import javax.swing.JApplet;
31
import javax.swing.JFrame;
31
import javax.swing.JFrame;
32
import javax.swing.JMenuItem;
32
import javax.swing.JMenuItem;
33
33
34
import org.midibox.apps.miosstudio.gui.MIOSStudioGUI;
-
 
35
import org.midibox.apps.miosstudiosid.gui.MIOSStudioSIDGUI;
34
import org.midibox.apps.miosstudiosid.gui.MIOSStudioSIDGUI;
36
import org.midibox.apps.miosstudiosid.gui.xml.MIOSStudioSIDGUIXML;
35
import org.midibox.apps.miosstudiosid.gui.xml.MIOSStudioSIDGUIXML;
37
import org.midibox.utils.gui.DialogOwner;
36
import org.midibox.utils.gui.DialogOwner;
38
import org.midibox.utils.gui.ImageLoader;
37
import org.midibox.utils.gui.ImageLoader;
39
import org.midibox.utils.gui.SplashScreen;
38
import org.midibox.utils.gui.SplashScreen;
Line 47... Line 46...
47
 * @author Adam King (adamjking@optusnet.com.au)
46
 * @author Adam King (adamjking@optusnet.com.au)
48
 */
47
 */
49
48
50
public class MIOSStudioSID extends JApplet {
49
public class MIOSStudioSID extends JApplet {
51
50
52
    protected static String configFileName = ".miosstudiosid";
51
    protected static String oldConfigFileName = ".miosstudiosid";
-
 
52
-
 
53
    protected static String configDirectoryName = ".midibox";
-
 
54
-
 
55
    protected static String configFileName = "miosstudiosid.xml";
53
56
54
    protected static String frameTitle = "MIOS Studio + SID V2 Editor";
57
    protected static String frameTitle = "MIOS Studio + SID V2 Editor";
55
58
56
    protected static String splashTitle = "MIOS Studio beta 9.2 + SID V2 Editor";
59
    protected static String splashTitle = "MIOS Studio beta 9.2 + SID V2 Editor";
57
60
Line 65... Line 68...
65
68
66
    public MIOSStudioSID() {
69
    public MIOSStudioSID() {
67
70
68
        this.miosStudioSID = new org.midibox.apps.miosstudiosid.MIOSStudioSID();
71
        this.miosStudioSID = new org.midibox.apps.miosstudiosid.MIOSStudioSID();
69
72
70
        File configFile = new File(System.getProperty("user.home"),
73
        File configDirectory = new File(System.getProperty("user.home"),
71
                configFileName);
74
                configDirectoryName);
-
 
75
-
 
76
        File configFile = new File(configDirectory, configFileName);
72
77
73
        if (configFile.exists()) {
78
        if (configFile.exists()) {
74
79
75
            MIOSStudioSIDGUIXML miosStudioSIDGUIXML = new MIOSStudioSIDGUIXML(
80
            MIOSStudioSIDGUIXML miosStudioSIDGUIXML = new MIOSStudioSIDGUIXML(
76
                    miosStudioSID, MIOSStudioSIDGUIXML.TAG_ROOT_ELEMENT, true,
81
                    miosStudioSID, MIOSStudioSIDGUIXML.TAG_ROOT_ELEMENT, true,
Line 79... Line 84...
79
            miosStudioSIDGUIXML.loadXML(configFile);
84
            miosStudioSIDGUIXML.loadXML(configFile);
80
85
81
            this.miosStudioSIDGUI = (MIOSStudioSIDGUI) miosStudioSIDGUIXML
86
            this.miosStudioSIDGUI = (MIOSStudioSIDGUI) miosStudioSIDGUIXML
82
                    .getMiosStudioGUI();
87
                    .getMiosStudioGUI();
83
88
-
 
89
        } else {
-
 
90
-
 
91
            // check for old config file
-
 
92
-
 
93
            configFile = new File(System.getProperty("user.home"),
-
 
94
                    oldConfigFileName);
-
 
95
-
 
96
            if (configFile.exists()) {
-
 
97
-
 
98
                MIOSStudioSIDGUIXML miosStudioSIDGUIXML = new MIOSStudioSIDGUIXML(
-
 
99
                        miosStudioSID, MIOSStudioSIDGUIXML.TAG_ROOT_ELEMENT,
-
 
100
                        true, true, true, true, true);
-
 
101
-
 
102
                miosStudioSIDGUIXML.loadXML(configFile);
-
 
103
-
 
104
                this.miosStudioSIDGUI = (MIOSStudioSIDGUI) miosStudioSIDGUIXML
-
 
105
                        .getMiosStudioGUI();
-
 
106
-
 
107
                configFile.delete();
-
 
108
            }
84
        }
109
        }
85
110
86
        if (miosStudioSIDGUI == null) {
111
        if (miosStudioSIDGUI == null) {
87
112
88
            this.miosStudioSIDGUI = new MIOSStudioSIDGUI(miosStudioSID);
113
            this.miosStudioSIDGUI = new MIOSStudioSIDGUI(miosStudioSID);
Line 99... Line 124...
99
124
100
    }
125
    }
101
126
102
    public void destroy() {
127
    public void destroy() {
103
128
104
        File configFile = new File(System.getProperty("user.home"),
129
        File configDirectory = new File(System.getProperty("user.home"),
105
                configFileName);
130
                configDirectoryName);
-
 
131
-
 
132
        File configFile = new File(configDirectory, configFileName);
-
 
133
-
 
134
        if (!configDirectory.exists()) {
-
 
135
-
 
136
            try {
-
 
137
-
 
138
                configDirectory.mkdir();
-
 
139
-
 
140
            } catch (Exception e) {
-
 
141
-
 
142
                e.printStackTrace();
-
 
143
            }
-
 
144
        }
106
145
107
        if (!configFile.exists()) {
146
        if (!configFile.exists()) {
108
147
109
            try {
148
            try {
110
149