/[svn]/jsampler/trunk/src/org/jsampler/view/std/StdA4n.java
ViewVC logotype

Diff of /jsampler/trunk/src/org/jsampler/view/std/StdA4n.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1914 by iliev, Sun Apr 5 09:15:35 2009 UTC revision 1915 by iliev, Thu Jun 11 09:35:29 2009 UTC
# Line 42  import javax.swing.event.ListSelectionLi Line 42  import javax.swing.event.ListSelectionLi
42  import org.jsampler.CC;  import org.jsampler.CC;
43  import org.jsampler.HF;  import org.jsampler.HF;
44  import org.jsampler.JSPrefs;  import org.jsampler.JSPrefs;
45    import org.jsampler.JSUtils;
46  import org.jsampler.SamplerChannelModel;  import org.jsampler.SamplerChannelModel;
47    
48  import org.jsampler.view.JSChannel;  import org.jsampler.view.JSChannel;
# Line 76  public class StdA4n { Line 76  public class StdA4n {
76    
77                  try {                  try {
78                          FileOutputStream fos = new FileOutputStream(f);                          FileOutputStream fos = new FileOutputStream(f);
79                          fos.write(CC.exportSessionToLscpScript().getBytes("US-ASCII"));                          fos.write(JSUtils.exportSessionToLscpScript().getBytes("US-ASCII"));
80                          fos.close();                          fos.close();
81                  } catch(Exception x) {                  } catch(Exception x) {
82                          CC.getLogger().log(Level.FINE, HF.getErrorMessage(x), x);                          CC.getLogger().log(Level.FINE, HF.getErrorMessage(x), x);
# Line 86  public class StdA4n { Line 86  public class StdA4n {
86                    
87          protected void          protected void
88          exportMidiInstrumentMaps() {          exportMidiInstrumentMaps() {
89                  File f = StdUtils.showSaveLscpFileChooser();                  File f = StdUtils.showSaveMidiMapsChooser();
90                  if(f == null) return;                  if(f == null) return;
91    
92                  boolean b = preferences().getBoolProperty("nativeFileChoosers");                  boolean b = preferences().getBoolProperty("nativeFileChoosers");
# Line 95  public class StdA4n { Line 95  public class StdA4n {
95                          String msg = i18n.getMessage("StdA4n.overwriteFile?");                          String msg = i18n.getMessage("StdA4n.overwriteFile?");
96                          if(!HF.showYesNoDialog(CC.getMainFrame(), msg)) return;                          if(!HF.showYesNoDialog(CC.getMainFrame(), msg)) return;
97                  }                  }
98    
99                    String ext = "";
100                    int i = f.getName().lastIndexOf('.');
101                    if(i != -1) {
102                            ext = f.getName().substring(i).toLowerCase();
103                    }
104                                    
105                  try {                  try {
106                          FileOutputStream fos = new FileOutputStream(f);                          FileOutputStream fos;
107                          fos.write(CC.exportInstrMapsToLscpScript().getBytes("US-ASCII"));                          if(ext.equals(".lscp")) {
108                                    fos = new FileOutputStream(f);
109                                    fos.write(JSUtils.exportInstrMapsToLscpScript().getBytes("US-ASCII"));
110                            } else if(ext.equals(".txt")) {
111                                    fos = new FileOutputStream(f);
112                                    fos.write(JSUtils.exportInstrMapsToText().getBytes("US-ASCII"));
113                            } else if(ext.equals(".htm") || ext.equals(".html")) {
114                                    fos = new FileOutputStream(f);
115                                    fos.write(JSUtils.exportInstrMapsToHtml().getBytes("US-ASCII"));
116                            } else {
117                                    f = new File(f.getAbsolutePath() + ".lscp");
118                                    if(f.exists()) {
119                                            String s = i18n.getError("StdA4n.fileExists", f.getAbsolutePath());
120                                            HF.showErrorMessage(s);
121                                            return;
122                                    }
123                                    
124                                    fos = new FileOutputStream(f);
125                                    fos.write(JSUtils.exportInstrMapsToLscpScript().getBytes("US-ASCII"));
126                            }
127    
128                          fos.close();                          fos.close();
129                  } catch(Exception x) {                  } catch(Exception x) {
130                          CC.getLogger().log(Level.FINE, HF.getErrorMessage(x), x);                          CC.getLogger().log(Level.FINE, HF.getErrorMessage(x), x);

Legend:
Removed from v.1914  
changed lines
  Added in v.1915

  ViewVC Help
Powered by ViewVC