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

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

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

revision 1347 by iliev, Thu Sep 13 22:20:38 2007 UTC revision 1540 by iliev, Mon Dec 3 23:22:02 2007 UTC
# Line 66  import net.sf.juife.event.TaskListener; Line 66  import net.sf.juife.event.TaskListener;
66    
67  import org.jsampler.CC;  import org.jsampler.CC;
68  import org.jsampler.HF;  import org.jsampler.HF;
69  import org.jsampler.Instrument;  import org.jsampler.OrchestraInstrument;
70  import org.jsampler.MidiInstrumentMap;  import org.jsampler.MidiInstrumentMap;
71  import org.jsampler.OrchestraModel;  import org.jsampler.OrchestraModel;
72  import org.jsampler.SamplerChannelModel;  import org.jsampler.SamplerChannelModel;
# Line 646  public class JSInstrumentsDbTable extend Line 646  public class JSInstrumentsDbTable extend
646                                    
647                  public void                  public void
648                  actionPerformed(ActionEvent e) {                  actionPerformed(ActionEvent e) {
649                          Object obj = getLeadObject();                          DbInstrumentInfo[] instruments = getSelectedInstruments();
650                          if(obj == null || !(obj instanceof DbInstrumentInfo)) return;                          int l = instruments.length;
651                                                    if(l == 0) return;
652                          DbInstrumentInfo info = (DbInstrumentInfo)obj;                          
653                            if(l > 4) {
654                                    String s = "JSInstrumentsDbTable.confirmAddToMidiMap";
655                                    s = i18n.getMessage(s, l, midiMap.getName());
656                                    if(!HF.showYesNoDialog(JSInstrumentsDbTable.this, s)) return;
657                            }
658                                                    
659                          JSAddMidiInstrumentDlg dlg;                          JSAddMidiInstrumentDlg dlg;
660                          Window w = JuifeUtils.getWindow(JSInstrumentsDbTable.this);                          Window w = JuifeUtils.getWindow(JSInstrumentsDbTable.this);
661                          if(w instanceof Dialog) {                                  
662                                  dlg = new JSAddMidiInstrumentDlg((Dialog)w);                          for(DbInstrumentInfo i : instruments) {
663                          } else if(w instanceof Frame) {                                  if(w instanceof Dialog) {
664                                  dlg = new JSAddMidiInstrumentDlg((Frame)w);                                          dlg = new JSAddMidiInstrumentDlg((Dialog)w, midiMap, i);
665                          } else {                                  } else if(w instanceof Frame) {
666                                  dlg = new JSAddMidiInstrumentDlg((Frame)null);                                          dlg = new JSAddMidiInstrumentDlg((Frame)w, midiMap, i);
667                                    } else {
668                                            dlg = new JSAddMidiInstrumentDlg((Frame)null, midiMap, i);
669                                    }
670                                    
671                                    dlg.setVisible(true);
672                          }                          }
                           
                         dlg.setInstrumentName(info.getName());  
                         dlg.setVisible(true);  
                         if(dlg.isCancelled()) return;  
                           
                         MidiInstrumentInfo instrInfo = new MidiInstrumentInfo();  
                         instrInfo.setName(dlg.getInstrumentName());  
                         instrInfo.setFilePath(info.getFilePath());  
                         instrInfo.setInstrumentIndex(info.getInstrumentIndex());  
                         instrInfo.setEngine(info.getFormatFamily()); // TODO: this should be fixed  
                         instrInfo.setVolume(dlg.getVolume());  
                         instrInfo.setLoadMode(dlg.getLoadMode());  
                           
                         int id = midiMap.getMapId();  
                         int b = dlg.getMidiBank();  
                         int p = dlg.getMidiProgram();  
                         CC.getSamplerModel().mapBackendMidiInstrument(id, b, p, instrInfo);  
673                  }                  }
674          }          }
675                    
# Line 690  public class JSInstrumentsDbTable extend Line 683  public class JSInstrumentsDbTable extend
683                                    
684                  public void                  public void
685                  actionPerformed(ActionEvent e) {                  actionPerformed(ActionEvent e) {
686                          Object obj = getLeadObject();                          DbInstrumentInfo[] instruments = getSelectedInstruments();
687                          if(obj == null || !(obj instanceof DbInstrumentInfo)) return;                          int l = instruments.length;
688                          DbInstrumentInfo info = (DbInstrumentInfo)obj;                          if(l == 0) return;
689                          Instrument instr = new Instrument();                          
690                          instr.setPath(info.getFilePath());                          if(l > 1) {
691                          instr.setInstrumentIndex(info.getInstrumentIndex());                                  String s = "JSInstrumentsDbTable.confirmAddToOrchestra";
692                          instr.setName(info.getName());                                  s = i18n.getMessage(s, l, orchestraModel.getName());
693                          instr.setDescription(info.getDescription());                                  if(!HF.showYesNoDialog(JSInstrumentsDbTable.this, s)) return;
694                          instr.setEngine(info.getFormatFamily()); // TODO: this should be fixed                          }
695                          orchestraModel.addInstrument(instr);                          
696                            for(DbInstrumentInfo i : instruments) {
697                                    OrchestraInstrument instr = new OrchestraInstrument();
698                                    instr.setFilePath(i.getFilePath());
699                                    instr.setInstrumentIndex(i.getInstrumentIndex());
700                                    instr.setName(i.getName());
701                                    instr.setDescription(i.getDescription());
702                                    instr.setEngine(i.getFormatFamily()); // TODO: this should be fixed
703                                    orchestraModel.addInstrument(instr);
704                            }
705                  }                  }
706          }          }
707                    

Legend:
Removed from v.1347  
changed lines
  Added in v.1540

  ViewVC Help
Powered by ViewVC