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

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

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

revision 1784 by iliev, Mon Jun 2 03:33:11 2008 UTC revision 1785 by iliev, Tue Oct 7 00:07:14 2008 UTC
# Line 61  import org.jsampler.event.SamplerChannel Line 61  import org.jsampler.event.SamplerChannel
61  import org.jsampler.event.SamplerChannelListListener;  import org.jsampler.event.SamplerChannelListListener;
62    
63  import org.jsampler.view.InstrumentTable;  import org.jsampler.view.InstrumentTable;
 import org.jsampler.view.InstrumentTableModel;  
   
 import org.linuxsampler.lscp.MidiInstrumentEntry;  
 import org.linuxsampler.lscp.MidiInstrumentInfo;  
64    
65  import static org.jsampler.view.std.StdI18n.i18n;  import static org.jsampler.view.std.StdI18n.i18n;
66    
# Line 173  public class JSOrchestraPane extends JPa Line 169  public class JSOrchestraPane extends JPa
169          }          }
170                    
171          private class InstrumentSelectionHandler implements ListSelectionListener {          private class InstrumentSelectionHandler implements ListSelectionListener {
172                    @Override
173                  public void                  public void
174                  valueChanged(ListSelectionEvent e) {                  valueChanged(ListSelectionEvent e) {
175                          if(e.getValueIsAdjusting()) return;                          if(e.getValueIsAdjusting()) return;
# Line 202  public class JSOrchestraPane extends JPa Line 199  public class JSOrchestraPane extends JPa
199                          putValue(SHORT_DESCRIPTION, s);                          putValue(SHORT_DESCRIPTION, s);
200                  }                  }
201                                    
202                    @Override
203                  public void                  public void
204                  actionPerformed(ActionEvent e) {                  actionPerformed(ActionEvent e) {
205                          OrchestraInstrument instr = createInstrument();                          OrchestraInstrument instr = createInstrument();
# Line 220  public class JSOrchestraPane extends JPa Line 218  public class JSOrchestraPane extends JPa
218                          setEnabled(false);                          setEnabled(false);
219                  }                  }
220                                    
221                    @Override
222                  public void                  public void
223                  actionPerformed(ActionEvent e) {                  actionPerformed(ActionEvent e) {
224                          editInstrument(instrumentTable.getSelectedInstrument());                          editInstrument(instrumentTable.getSelectedInstrument());
# Line 236  public class JSOrchestraPane extends JPa Line 235  public class JSOrchestraPane extends JPa
235                          setEnabled(false);                          setEnabled(false);
236                  }                  }
237                                    
238                    @Override
239                  public void                  public void
240                  actionPerformed(ActionEvent e) {                  actionPerformed(ActionEvent e) {
241                          OrchestraInstrument instr = instrumentTable.getSelectedInstrument();                          OrchestraInstrument instr = instrumentTable.getSelectedInstrument();
# Line 259  public class JSOrchestraPane extends JPa Line 259  public class JSOrchestraPane extends JPa
259                          setEnabled(false);                          setEnabled(false);
260                  }                  }
261                                    
262                    @Override
263                  public void                  public void
264                  actionPerformed(ActionEvent e) {                  actionPerformed(ActionEvent e) {
265                          OrchestraInstrument instr = instrumentTable.getSelectedInstrument();                          OrchestraInstrument instr = instrumentTable.getSelectedInstrument();
# Line 277  public class JSOrchestraPane extends JPa Line 278  public class JSOrchestraPane extends JPa
278                          setEnabled(false);                          setEnabled(false);
279                  }                  }
280                                    
281                    @Override
282                  public void                  public void
283                  actionPerformed(ActionEvent e) {                  actionPerformed(ActionEvent e) {
284                          OrchestraInstrument instr = instrumentTable.getSelectedInstrument();                          OrchestraInstrument instr = instrumentTable.getSelectedInstrument();
# Line 287  public class JSOrchestraPane extends JPa Line 289  public class JSOrchestraPane extends JPa
289                    
290                    
291                    
292          private class LoadInstrumentAction extends AbstractAction {          private class LoadInstrumentAction extends StdA4n.LoadInstrumentAction {
293                  private final SamplerChannelModel channelModel;                  LoadInstrumentAction(SamplerChannelModel model, boolean onPanel) {
294                                            super(model, onPanel);
                 LoadInstrumentAction(SamplerChannelModel model) {  
                         String s = "instrumentsdb.actions.loadInstrument.onChannel";  
                         int i = CC.getSamplerModel().getChannelIndex(model) + 1;  
                         putValue(Action.NAME, i18n.getMenuLabel(s, i));  
                         channelModel = model;  
295                  }                  }
296                                    
297                    @Override
298                  public void                  public void
299                  actionPerformed(ActionEvent e) {                  actionPerformed(ActionEvent e) {
300                          OrchestraInstrument instr = instrumentTable.getSelectedInstrument();                          OrchestraInstrument instr = instrumentTable.getSelectedInstrument();
# Line 308  public class JSOrchestraPane extends JPa Line 306  public class JSOrchestraPane extends JPa
306                  }                  }
307          }          }
308                    
309            private LoadInstrumentActionFactory loadInstrActionFactory = new LoadInstrumentActionFactory();
310            
311            class LoadInstrumentActionFactory implements StdA4n.LoadInstrumentActionFactory {
312                    public StdA4n.LoadInstrumentAction
313                    createLoadInstrumentAction(SamplerChannelModel model, boolean onPanel) {
314                            return new LoadInstrumentAction(model, onPanel);
315                    }
316            }
317            
318          class AddToMidiMapAction extends AbstractAction {          class AddToMidiMapAction extends AbstractAction {
319                  private final MidiInstrumentMap midiMap;                  private final MidiInstrumentMap midiMap;
320                                    
# Line 316  public class JSOrchestraPane extends JPa Line 323  public class JSOrchestraPane extends JPa
323                          midiMap = map;                          midiMap = map;
324                  }                  }
325                                    
326                    @Override
327                  public void                  public void
328                  actionPerformed(ActionEvent e) {                  actionPerformed(ActionEvent e) {
329                          OrchestraInstrument instr = instrumentTable.getSelectedInstrument();                          OrchestraInstrument instr = instrumentTable.getSelectedInstrument();
# Line 386  public class JSOrchestraPane extends JPa Line 394  public class JSOrchestraPane extends JPa
394                                  }                                  }
395                          };                          };
396                                                    
397                          CC.getSamplerModel().addMidiInstrumentMapListListener(l);                                CC.getSamplerModel().addMidiInstrumentMapListListener(l);
398                            
399                            CC.getMainFrame().addChannelsPaneSelectionListener(new ListSelectionListener() {
400                                    public void
401                                    valueChanged(ListSelectionEvent e) {
402                                            updateLoadInstrumentMenu(mLoadInstrument);
403                                    }
404                            });
405                  }                  }
406                                    
407                  private void                  private void
408                  updateLoadInstrumentMenu(JMenu menu) {                  updateLoadInstrumentMenu(JMenu menu) {
409                          menu.removeAll();                          menu.removeAll();
                         for(SamplerChannelModel m : CC.getSamplerModel().getChannels()) {  
                                 menu.add(new JMenuItem(new LoadInstrumentAction(m)));  
                         }  
410                                                    
411                            StdA4n.updateLoadInstrumentMenu(menu, loadInstrActionFactory);
412                          updateLoadInstrumentMenuState(menu);                          updateLoadInstrumentMenuState(menu);
413                  }                  }
414                                    
# Line 426  public class JSOrchestraPane extends JPa Line 439  public class JSOrchestraPane extends JPa
439                          menu.setEnabled(!b);                          menu.setEnabled(!b);
440                  }                  }
441                                    
442                    @Override
443                  public void                  public void
444                  valueChanged(ListSelectionEvent e) {                  valueChanged(ListSelectionEvent e) {
445                          updateLoadInstrumentMenuState(mLoadInstrument);                          updateLoadInstrumentMenuState(mLoadInstrument);
446                          updateAddToMidiMapMenuState(mMapInstrument);                          updateAddToMidiMapMenuState(mMapInstrument);
447                  }                  }
448                                    
449                    @Override
450                  public void                  public void
451                  channelAdded(SamplerChannelListEvent e) {                  channelAdded(SamplerChannelListEvent e) {
452                          if(CC.getSamplerModel().getChannelListIsAdjusting()) return;                          if(CC.getSamplerModel().getChannelListIsAdjusting()) return;
453                          updateLoadInstrumentMenu(mLoadInstrument);                          updateLoadInstrumentMenu(mLoadInstrument);
454                  }                  }
455                                    
456                    @Override
457                  public void                  public void
458                  channelRemoved(SamplerChannelListEvent e) {                  channelRemoved(SamplerChannelListEvent e) {
459                          updateLoadInstrumentMenu(mLoadInstrument);                          updateLoadInstrumentMenu(mLoadInstrument);
460                  }                  }
461                                    
462                    @Override
463                  public void                  public void
464                  mousePressed(MouseEvent e) {                  mousePressed(MouseEvent e) {
465                          if(e.isPopupTrigger()) show(e);                          if(e.isPopupTrigger()) show(e);
466                  }                  }
467                    
468                    @Override
469                  public void                  public void
470                  mouseReleased(MouseEvent e) {                  mouseReleased(MouseEvent e) {
471                          if(e.isPopupTrigger()) show(e);                          if(e.isPopupTrigger()) show(e);

Legend:
Removed from v.1784  
changed lines
  Added in v.1785

  ViewVC Help
Powered by ViewVC