/[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 1729 by iliev, Tue Apr 29 22:22:40 2008 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 422  public class JSInstrumentsDbTable extend Line 422  public class JSInstrumentsDbTable extend
422                  actionPerformed(ActionEvent e) {                  actionPerformed(ActionEvent e) {
423                          DbDirectoryTreeNode n = instrumentsDbTree.getSelectedDirectoryNode();                          DbDirectoryTreeNode n = instrumentsDbTree.getSelectedDirectoryNode();
424                          if(n == null) return;                          if(n == null) return;
425                          instrumentsDbTree.refreshDirectoryContent(n.getInfo().getDirectoryPath());                          final String path = n.getInfo().getDirectoryPath();
426                            instrumentsDbTree.refreshDirectoryContent(path);
427                            CC.scheduleInTaskQueue(new Runnable() {
428                                    public void
429                                    run() { instrumentsDbTree.setSelectedDirectory(path); }
430                            });
431                  }                  }
432                                    
433                  public void                  public void
# Line 646  public class JSInstrumentsDbTable extend Line 651  public class JSInstrumentsDbTable extend
651                                    
652                  public void                  public void
653                  actionPerformed(ActionEvent e) {                  actionPerformed(ActionEvent e) {
654                          Object obj = getLeadObject();                          DbInstrumentInfo[] instruments = getSelectedInstruments();
655                          if(obj == null || !(obj instanceof DbInstrumentInfo)) return;                          int l = instruments.length;
656                                                    if(l == 0) return;
657                          DbInstrumentInfo info = (DbInstrumentInfo)obj;                          
658                            if(l > 4) {
659                                    String s = "JSInstrumentsDbTable.confirmAddToMidiMap";
660                                    s = i18n.getMessage(s, l, midiMap.getName());
661                                    if(!HF.showYesNoDialog(JSInstrumentsDbTable.this, s)) return;
662                            }
663                                                    
664                          JSAddMidiInstrumentDlg dlg;                          JSAddMidiInstrumentDlg dlg;
665                          Window w = JuifeUtils.getWindow(JSInstrumentsDbTable.this);                          Window w = JuifeUtils.getWindow(JSInstrumentsDbTable.this);
666                          if(w instanceof Dialog) {                                  
667                                  dlg = new JSAddMidiInstrumentDlg((Dialog)w);                          for(DbInstrumentInfo i : instruments) {
668                          } else if(w instanceof Frame) {                                  if(w instanceof Dialog) {
669                                  dlg = new JSAddMidiInstrumentDlg((Frame)w);                                          dlg = new JSAddMidiInstrumentDlg((Dialog)w, midiMap, i);
670                          } else {                                  } else if(w instanceof Frame) {
671                                  dlg = new JSAddMidiInstrumentDlg((Frame)null);                                          dlg = new JSAddMidiInstrumentDlg((Frame)w, midiMap, i);
672                                    } else {
673                                            dlg = new JSAddMidiInstrumentDlg((Frame)null, midiMap, i);
674                                    }
675                                    
676                                    dlg.setVisible(true);
677                          }                          }
                           
                         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);  
678                  }                  }
679          }          }
680                    
# Line 690  public class JSInstrumentsDbTable extend Line 688  public class JSInstrumentsDbTable extend
688                                    
689                  public void                  public void
690                  actionPerformed(ActionEvent e) {                  actionPerformed(ActionEvent e) {
691                          Object obj = getLeadObject();                          DbInstrumentInfo[] instruments = getSelectedInstruments();
692                          if(obj == null || !(obj instanceof DbInstrumentInfo)) return;                          int l = instruments.length;
693                          DbInstrumentInfo info = (DbInstrumentInfo)obj;                          if(l == 0) return;
694                          Instrument instr = new Instrument();                          
695                          instr.setPath(info.getFilePath());                          if(l > 1) {
696                          instr.setInstrumentIndex(info.getInstrumentIndex());                                  String s = "JSInstrumentsDbTable.confirmAddToOrchestra";
697                          instr.setName(info.getName());                                  s = i18n.getMessage(s, l, orchestraModel.getName());
698                          instr.setDescription(info.getDescription());                                  if(!HF.showYesNoDialog(JSInstrumentsDbTable.this, s)) return;
699                          instr.setEngine(info.getFormatFamily()); // TODO: this should be fixed                          }
700                          orchestraModel.addInstrument(instr);                          
701                            for(DbInstrumentInfo i : instruments) {
702                                    OrchestraInstrument instr = new OrchestraInstrument();
703                                    instr.setFilePath(i.getFilePath());
704                                    instr.setInstrumentIndex(i.getInstrumentIndex());
705                                    instr.setName(i.getName());
706                                    instr.setDescription(i.getDescription());
707                                    instr.setEngine(i.getFormatFamily()); // TODO: this should be fixed
708                                    orchestraModel.addInstrument(instr);
709                            }
710                  }                  }
711          }          }
712                    

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

  ViewVC Help
Powered by ViewVC