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 24... Line 24...
24
import java.awt.event.ActionListener;
24
import java.awt.event.ActionListener;
25
import java.awt.event.KeyEvent;
25
import java.awt.event.KeyEvent;
26
import java.awt.event.WindowAdapter;
26
import java.awt.event.WindowAdapter;
27
import java.awt.event.WindowEvent;
27
import java.awt.event.WindowEvent;
28
import java.io.File;
28
import java.io.File;
29
import java.util.Enumeration;
-
 
30
import java.util.Hashtable;
-
 
31
import java.util.prefs.Preferences;
-
 
32
29
33
import javax.swing.JApplet;
30
import javax.swing.JApplet;
34
import javax.swing.JDialog;
-
 
35
import javax.swing.JFrame;
31
import javax.swing.JFrame;
36
import javax.swing.JInternalFrame;
-
 
37
import javax.swing.JMenuItem;
32
import javax.swing.JMenuItem;
38
import javax.swing.UIManager;
-
 
39
33
40
import org.midibox.apps.miosstudio.gui.MIOSStudioGUI;
34
import org.midibox.apps.miosstudio.gui.MIOSStudioGUI;
41
import org.midibox.apps.miosstudio.gui.xml.MIOSStudioGUIXML;
35
import org.midibox.apps.miosstudio.gui.xml.MIOSStudioGUIXML;
42
import org.midibox.apps.miosstudiosid.gui.MIOSStudioSIDGUI;
-
 
43
import org.midibox.midi.gui.MidiFilterGUI;
-
 
44
import org.midibox.mios.gui.HexFileUploadGUI;
-
 
45
import org.midibox.utils.gui.DialogOwner;
36
import org.midibox.utils.gui.DialogOwner;
46
import org.midibox.utils.gui.ImageLoader;
37
import org.midibox.utils.gui.ImageLoader;
47
import org.midibox.utils.gui.SplashScreen;
38
import org.midibox.utils.gui.SplashScreen;
48
39
49
/**
40
/**
Line 55... Line 46...
55
 * @author Adam King (adamjking@optusnet.com.au)
46
 * @author Adam King (adamjking@optusnet.com.au)
56
 */
47
 */
57
48
58
public class MIOSStudio extends JApplet {
49
public class MIOSStudio extends JApplet {
59
50
60
    protected static String configFileName = ".miosstudio";
51
    protected static String oldConfigFileName = ".miosstudio";
-
 
52
-
 
53
    protected static String configDirectoryName = ".midibox";
-
 
54
-
 
55
    protected static String configFileName = "miosstudio.xml";
61
56
62
    protected static String frameTitle = "MIOS Studio";
57
    protected static String frameTitle = "MIOS Studio";
63
58
64
    protected static String splashTitle = "MIOS Studio beta 9.2";
59
    protected static String splashTitle = "MIOS Studio beta 9.2";
65
60
Line 73... Line 68...
73
68
74
    public MIOSStudio() {
69
    public MIOSStudio() {
75
70
76
        this.miosStudio = new org.midibox.apps.miosstudio.MIOSStudio();
71
        this.miosStudio = new org.midibox.apps.miosstudio.MIOSStudio();
77
       
72
78
        File configFile = new File(System.getProperty("user.home"),
73
        File configDirectory = new File(System.getProperty("user.home"),
79
                configFileName);
74
                configDirectoryName);
-
 
75
-
 
76
        File configFile = new File(configDirectory, configFileName);
80
77
81
        if (configFile.exists()) {
78
        if (configFile.exists()) {
82
79
83
            MIOSStudioGUIXML miosStudioGUIXML = new MIOSStudioGUIXML(
80
            MIOSStudioGUIXML miosStudioGUIXML = new MIOSStudioGUIXML(
84
                    miosStudio, MIOSStudioGUIXML.TAG_ROOT_ELEMENT, true, true, true, true, true);
81
                    miosStudio, MIOSStudioGUIXML.TAG_ROOT_ELEMENT, true, true,
-
 
82
                    true, true, true);
85
83
86
            miosStudioGUIXML.loadXML(configFile);
84
            miosStudioGUIXML.loadXML(configFile);
87
85
88
            this.miosStudioGUI = miosStudioGUIXML.getMiosStudioGUI();
86
            this.miosStudioGUI = miosStudioGUIXML.getMiosStudioGUI();
89
           
87
-
 
88
        } else {
-
 
89
-
 
90
            // check for old config file
-
 
91
-
 
92
            configFile = new File(System.getProperty("user.home"),
-
 
93
                    oldConfigFileName);
-
 
94
-
 
95
            if (configFile.exists()) {
-
 
96
-
 
97
                MIOSStudioGUIXML miosStudioGUIXML = new MIOSStudioGUIXML(
-
 
98
                        miosStudio, MIOSStudioGUIXML.TAG_ROOT_ELEMENT, true,
-
 
99
                        true, true, true, true);
-
 
100
-
 
101
                miosStudioGUIXML.loadXML(configFile);
-
 
102
-
 
103
                this.miosStudioGUI = miosStudioGUIXML.getMiosStudioGUI();
-
 
104
-
 
105
                configFile.delete();
-
 
106
            }
90
        }
107
        }
91
108
92
        if (miosStudioGUI == null) {
109
        if (miosStudioGUI == null) {
93
110
94
            this.miosStudioGUI = new MIOSStudioGUI(miosStudio);
111
            this.miosStudioGUI = new MIOSStudioGUI(miosStudio);
Line 105... Line 122...
105
       
122
106
    }
123
    }
107
124
108
    public void destroy() {
125
    public void destroy() {
109
126
110
        File configFile = new File(System.getProperty("user.home"),
127
        File configDirectory = new File(System.getProperty("user.home"),
111
                configFileName);
128
                configDirectoryName);
-
 
129
-
 
130
        File configFile = new File(configDirectory, configFileName);
-
 
131
-
 
132
        if (!configDirectory.exists()) {
-
 
133
-
 
134
            try {
-
 
135
-
 
136
                configDirectory.mkdir();
-
 
137
-
 
138
            } catch (Exception e) {
-
 
139
-
 
140
                e.printStackTrace();
-
 
141
            }
-
 
142
        }
112
143
113
        if (!configFile.exists()) {
144
        if (!configFile.exists()) {
114
145
115
            try {
146
            try {
116
147
Line 150... Line 181...
150
181
151
        DialogOwner.setFrame(frame);
182
        DialogOwner.setFrame(frame);
152
183
153
        frame.setIconImage(ImageLoader.getImageIcon("ucIcon.png").getImage());
184
        frame.setIconImage(ImageLoader.getImageIcon("ucIcon.png").getImage());
154
185
155
        frame.setBounds(50, 50, (screenSize.width - 100), (screenSize.height - 100));
186
        frame.setBounds(50, 50, (screenSize.width - 100),
-
 
187
                (screenSize.height - 100));
156
       
188
157
        final MIOSStudio miosStudio = new MIOSStudio();
189
        final MIOSStudio miosStudio = new MIOSStudio();
158
190
159
        miosStudio.init();
191
        miosStudio.init();
160
192