Update of /cvsroot/javaamp/javaamp/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29551/src Modified Files: EqualizerDialog.java FileInformationDialog.java JavaAmp.java JavaAmpSplash.java PlayDialog.java PreferencesDialog.java Settings.java Log Message: Index: EqualizerDialog.java =================================================================== RCS file: /cvsroot/javaamp/javaamp/src/EqualizerDialog.java,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- EqualizerDialog.java 5 Apr 2006 20:22:05 -0000 1.18 +++ EqualizerDialog.java 10 Apr 2006 17:51:30 -0000 1.19 @@ -151,6 +151,7 @@ pomPresets.addSeparator(); menLoad = new JMenu(Language.get("LOAD")); meiLoadPreset = new JMenuItem(Language.get("PRESET")); + meiLoadPreset.setEnabled(false); menLoad.add(meiLoadPreset); meiLoadEQF = new JMenuItem(Language.get("LOAD_FROM_EQF")); meiLoadEQF.addActionListener(new ActionListener() { @@ -167,6 +168,7 @@ pomPresets.add(menLoad); menSave = new JMenu(Language.get("SAVE")); meiSavePreset = new JMenuItem(Language.get("PRESET")); + meiSavePreset.setEnabled(false); menSave.add(meiSavePreset); meiSaveEQF = new JMenuItem(Language.get("SAVE_TO_EQF")); meiSaveEQF.addActionListener(new ActionListener() { @@ -183,6 +185,7 @@ pomPresets.add(menSave); menDelete = new JMenu(Language.get("DELETE")); meiDeletePreset = new JMenuItem(Language.get("PRESET")); + meiDeletePreset.setEnabled(false); menDelete.add(meiDeletePreset); pomPresets.add(menDelete); btnPresets.addActionListener(new ActionListener() { Index: Settings.java =================================================================== RCS file: /cvsroot/javaamp/javaamp/src/Settings.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- Settings.java 10 Apr 2006 10:03:50 -0000 1.10 +++ Settings.java 10 Apr 2006 17:51:30 -0000 1.11 @@ -33,6 +33,9 @@ "Max" }; + static String[] availableDrivers; + static int[] availableDriversInds; + static String language; static boolean proxyEnabled; static String proxyHost; @@ -70,6 +73,21 @@ static int playlistDialogHeight; static { + try { + int num = FSound.FSOUND_GetNumDrivers(); + availableDrivers = new String[num + 1]; + availableDriversInds = new int[num + 1]; + availableDrivers[0] = "[Default]"; + availableDriversInds[0] = 0; + for(int i = 0; i < num; i++) { + availableDrivers[i + 1] = FSound.FSOUND_GetDriverName(i); + availableDriversInds[i + 1] = i; + } + } + catch(Exception e) { + availableDrivers = new String[] { "[Default]" }; + availableDriversInds = new int[] { 0 }; + } Properties p = new Properties(); try { p.load(new FileInputStream(new File(System.getProperty("user.dir"), @@ -166,6 +184,17 @@ return def; } + public final static int getIndexByValue(int value, int[] values, int def) { + try { + for(int i = 0; i < values.length; i++) + if(values[i] == value) + return i; + } + catch(Exception e) { + } + return def; + } + private final static String getStringByValue(int value, String[] keys, int[] values, String def) { try { Index: PreferencesDialog.java =================================================================== RCS file: /cvsroot/javaamp/javaamp/src/PreferencesDialog.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- PreferencesDialog.java 10 Apr 2006 10:03:50 -0000 1.10 +++ PreferencesDialog.java 10 Apr 2006 17:51:30 -0000 1.11 @@ -77,11 +77,10 @@ JButton btnClose; - public PreferencesDialog(JavaAmp o) throws Exception { - super(o); + public PreferencesDialog(JavaAmp o) { + super(o, Language.get("PREFERENCES"), true); owner = o; - setTitle(Language.get("PREFERENCES")); setSize(585, 450); setResizable(false); setLocation((getToolkit().getScreenSize().width - getWidth()) / 2, @@ -271,18 +270,22 @@ chbSplash.setBounds(10, 145, 370, 20); panGenPref.add(chbSplash); chbUpdate = new JCheckBox(Language.get("CHECK_NEW")); + chbUpdate.setEnabled(false); chbUpdate.setBounds(10, 165, 370, 20); panGenPref.add(chbUpdate); lblShowIn = new JLabel(Language.get("SHOW_JAVAAMP_IN")); lblShowIn.setBounds(10, 185, 370, 20); panGenPref.add(lblShowIn); chbTaskbar = new JCheckBox(Language.get("TASKBAR")); + chbTaskbar.setEnabled(false); chbTaskbar.setBounds(30, 205, 350, 20); panGenPref.add(chbTaskbar); chbSysTray = new JCheckBox(Language.get("SYSTRAY")); + chbSysTray.setEnabled(false); chbSysTray.setBounds(30, 225, 350, 20); panGenPref.add(chbSysTray); chbScroll = new JCheckBox(Language.get("SCROLL_TITLE")); + chbScroll.setEnabled(false); chbScroll.setBounds(10, 245, 370, 20); panGenPref.add(chbScroll); @@ -312,25 +315,7 @@ cmbLookAndFeel.setBounds(100, 15, 280, 20); cmbLookAndFeel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - try { - for(UIManager.LookAndFeelInfo lnf : - UIManager.getInstalledLookAndFeels()) - if(lnf.getName().equalsIgnoreCase( - cmbLookAndFeel.getSelectedItem().toString())) { - UIManager.setLookAndFeel(lnf.getClassName()); - SwingUtilities.updateComponentTreeUI( - owner.playDialog); - SwingUtilities.updateComponentTreeUI( - owner.equalizerDialog); - SwingUtilities.updateComponentTreeUI( - owner.playlistDialog); - SwingUtilities.updateComponentTreeUI( - owner.preferencesDialog); - break; - } - } - catch(Exception ex) { - } + updateLookAndFeel(); } }); panAppearance.add(cmbLookAndFeel); @@ -420,7 +405,7 @@ lblDriver = new JLabel(Language.get("DRIVER")); lblDriver.setBounds(15, 140, 80, 20); panSoundOutput.add(lblDriver); - cmbDriver = new JComboBox(); + cmbDriver = new JComboBox(Settings.availableDrivers); cmbDriver.setBounds(95, 140, 285, 20); panSoundOutput.add(cmbDriver); @@ -443,6 +428,24 @@ makeVisible(panJavaAmp); } + public void updateLookAndFeel() { + try { + for(UIManager.LookAndFeelInfo lnf : + UIManager.getInstalledLookAndFeels()) + if(lnf.getName().equalsIgnoreCase( + cmbLookAndFeel.getSelectedItem().toString())) { + UIManager.setLookAndFeel(lnf.getClassName()); + SwingUtilities.updateComponentTreeUI(owner.playDialog); + SwingUtilities.updateComponentTreeUI(owner.equalizerDialog); + SwingUtilities.updateComponentTreeUI(owner.playlistDialog); + SwingUtilities.updateComponentTreeUI(this); + break; + } + } + catch(Exception e) { + } + } + public void makeVisible(JPanel pan) { panJavaAmp.setVisible(false); panGenPref.setVisible(false); @@ -476,7 +479,11 @@ sliMixRate.setValue(Settings.mixrate); sliMaxChannels.setValue(Settings.maxchannels); sliBufferSize.setValue(Settings.buffersize); - // TODO ... + cmbSpeakerMode.setSelectedIndex(Settings.getIndexByValue( + Settings.speakermode, Settings.SPEAKER_MODES_VALS, 4)); + cmbMixerType.setSelectedIndex(Settings.getIndexByValue( + Settings.mixertype, Settings.MIXER_TYPES_VALS, 0)); + cmbDriver.setSelectedItem(Settings.driver); setVisible(true); } @@ -505,7 +512,14 @@ Settings.mixrate = sliMixRate.getValue(); Settings.maxchannels = sliMaxChannels.getValue(); Settings.buffersize = sliBufferSize.getValue(); - // TODO ... + Settings.speakermode = Settings.SPEAKER_MODES_VALS[ + cmbSpeakerMode.getSelectedIndex()]; + Settings.mixertype = Settings.MIXER_TYPES_VALS[ + cmbMixerType.getSelectedIndex()]; + Settings.driver = Settings.availableDrivers[ + cmbDriver.getSelectedIndex()]; setVisible(false); + removeAll(); + dispose(); } } \ No newline at end of file Index: JavaAmp.java =================================================================== RCS file: /cvsroot/javaamp/javaamp/src/JavaAmp.java,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- JavaAmp.java 10 Apr 2006 10:03:50 -0000 1.22 +++ JavaAmp.java 10 Apr 2006 17:51:30 -0000 1.23 @@ -14,7 +14,6 @@ PlayDialog playDialog; PlaylistDialog playlistDialog; EqualizerDialog equalizerDialog; - PreferencesDialog preferencesDialog; VisualizationBridge vb; @@ -56,7 +55,6 @@ Language.loadLanguage(getClass(), langs[0]); } - FMOD.create(); FSound.FSOUND_SetDriver(Settings.getDriver()); Settings.driver = FSound.FSOUND_GetDriverName( FSound.FSOUND_GetDriver()); @@ -67,6 +65,21 @@ FSound.FSOUND_SetSpeakerMode(Settings.speakermode); FSound.FSOUND_Init(Settings.mixrate, Settings.maxchannels, 0); FSound.FSOUND_DSP_SetActive(FSound.FSOUND_DSP_GetFFTUnit(), true); + if(Settings.proxyEnabled) { + StringBuilder proxy = new StringBuilder(); + if(Settings.proxyUser.length() > 0) { + proxy.append(Settings.proxyUser); + proxy.append(':'); + proxy.append(Settings.proxyPassword); + proxy.append('@'); + } + proxy.append(Settings.proxyHost); + if(Settings.proxyPort >= 0) { + proxy.append(':'); + proxy.append(Settings.proxyPort); + } + FSound.FSOUND_Stream_Net_SetProxy(proxy.toString()); + } fchChooser = new JFileChooser(); oppMessages = new JOptionPane(); @@ -77,12 +90,11 @@ setUndecorated(true); setSize(0, 0); setResizable(false); - setVisible(true); + setIconImage(GraphicsLoader.jaa1); playDialog = new PlayDialog(this); equalizerDialog = new EqualizerDialog(this); playlistDialog = new PlaylistDialog(this); - preferencesDialog = new PreferencesDialog(this); playDialog.setLocation(Settings.playDialogX, Settings.playDialogY); equalizerDialog.setLocation(Settings.equalizerDialogX, @@ -94,6 +106,7 @@ if(!GraphicsLoader.finishLoading()) throw new Exception(Language.get("ERROR_LOADING_GRAPHICS")); + setVisible(true); playDialog.setVisible(Settings.playDialogVisible); equalizerDialog.setVisible(Settings.equalizerDialogVisible); playlistDialog.setVisible(Settings.playlistDialogVisible); @@ -115,6 +128,12 @@ } public final static void main(String[] args) { + try { + FMOD.create(); + } + catch(Exception e) { + error(e); + } Toolkit.getDefaultToolkit().setDynamicLayout(false); System.setProperty("sun.awt.noerasebackground", "true"); JavaAmpSplash jasplash = null; @@ -125,37 +144,20 @@ } catch(Exception e) { } - try { - Class cls = Class.forName( - "com.jgoodies.looks.plastic.Plastic3DLookAndFeel"); - LookAndFeel lnf = (LookAndFeel)cls.newInstance(); - UIManager.installLookAndFeel(lnf.getName(), cls.getName()); - } - catch(Exception e) { - } - try { - Class cls = Class.forName( - "com.jgoodies.looks.plastic.PlasticLookAndFeel"); - LookAndFeel lnf = (LookAndFeel)cls.newInstance(); - UIManager.installLookAndFeel(lnf.getName(), cls.getName()); - } - catch(Exception e) { - } - try { - Class cls = Class.forName( - "com.jgoodies.looks.plastic.PlasticXPLookAndFeel"); - LookAndFeel lnf = (LookAndFeel)cls.newInstance(); - UIManager.installLookAndFeel(lnf.getName(), cls.getName()); - } - catch(Exception e) { - } - try { - Class cls = Class.forName( - "com.jgoodies.looks.windows.WindowsLookAndFeel"); - LookAndFeel lnf = (LookAndFeel)cls.newInstance(); - UIManager.installLookAndFeel(lnf.getName(), cls.getName()); - } - catch(Exception e) { + String[] lnfs = new String[] { + "com.jgoodies.looks.plastic.Plastic3DLookAndFeel", + "com.jgoodies.looks.plastic.PlasticLookAndFeel", + "com.jgoodies.looks.plastic.PlasticXPLookAndFeel", + "com.jgoodies.looks.windows.WindowsLookAndFeel" + }; + for(String str : lnfs) { + try { + Class cls = Class.forName(str); + UIManager.installLookAndFeel( + ((LookAndFeel)cls.newInstance()).getName(), cls.getName()); + } + catch(Exception e) { + } } try { UIManager.setLookAndFeel(Settings.lookAndFeel); Index: JavaAmpSplash.java =================================================================== RCS file: /cvsroot/javaamp/javaamp/src/JavaAmpSplash.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- JavaAmpSplash.java 26 Mar 2006 15:13:13 -0000 1.1 +++ JavaAmpSplash.java 10 Apr 2006 17:51:30 -0000 1.2 @@ -2,7 +2,7 @@ import java.awt.image.*; import java.util.*; -public class JavaAmpSplash extends Frame { +public class JavaAmpSplash extends Dialog { Image splash, offscreen; Graphics ofg; @@ -11,6 +11,7 @@ Timer timer; public JavaAmpSplash() throws Exception { + super(new Frame()); splash = getToolkit().getImage(getClass().getResource("jasplash.png")); MediaTracker mt = new MediaTracker(this); mt.addImage(splash, 0); Index: PlayDialog.java =================================================================== RCS file: /cvsroot/javaamp/javaamp/src/PlayDialog.java,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- PlayDialog.java 8 Apr 2006 15:38:03 -0000 1.17 +++ PlayDialog.java 10 Apr 2006 17:51:30 -0000 1.18 @@ -639,7 +639,8 @@ } public void showPreferences() { - owner.preferencesDialog.open(); + PreferencesDialog pd = new PreferencesDialog(owner); + pd.open(); } public void paint(Graphics g) { Index: FileInformationDialog.java =================================================================== RCS file: /cvsroot/javaamp/javaamp/src/FileInformationDialog.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- FileInformationDialog.java 19 Mar 2006 10:17:39 -0000 1.9 +++ FileInformationDialog.java 10 Apr 2006 17:51:30 -0000 1.10 @@ -40,6 +40,7 @@ setResizable(false); setLocation((getToolkit().getScreenSize().width - getWidth()) / 2, (getToolkit().getScreenSize().height - getHeight()) / 2); + setDefaultCloseOperation(DISPOSE_ON_CLOSE); cntContainer = new Container(); cntContainer.setLayout(null); |