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

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

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

revision 1766 by iliev, Tue Aug 12 16:31:35 2008 UTC revision 1767 by iliev, Mon Sep 8 00:19:27 2008 UTC
# Line 731  class InstrumentMappingWizardPage extend Line 731  class InstrumentMappingWizardPage extend
731                    
732          private final JTextField tfName = new JTextField();          private final JTextField tfName = new JTextField();
733          private final JComboBox cbMap = new JComboBox();          private final JComboBox cbMap = new JComboBox();
734          private final JSpinner spinnerBank = new JSpinner(new SpinnerNumberModel(0, 0, 16383, 1));          private final JSpinner spinnerBank;
735          private final JComboBox cbProgram = new JComboBox();          private final JComboBox cbProgram = new JComboBox();
736          private final JSlider slVolume = StdUtils.createVolumeSlider();          private final JSlider slVolume = StdUtils.createVolumeSlider();
737                    
738          private final NewMidiInstrumentWizardModel wizardModel;          private final NewMidiInstrumentWizardModel wizardModel;
739                    
740            private int mbBase;
741            private int mpBase;
742            
743          InstrumentMappingWizardPage(NewMidiInstrumentWizardModel wizardModel) {          InstrumentMappingWizardPage(NewMidiInstrumentWizardModel wizardModel) {
744                  super(i18n.getLabel("InstrumentMappingWizardPage.subtitle"));                  super(i18n.getLabel("InstrumentMappingWizardPage.subtitle"));
745                  this.wizardModel = wizardModel;                  this.wizardModel = wizardModel;
746                                    
747                  setPageType(Type.CONFIRMATION_PAGE);                  setPageType(Type.CONFIRMATION_PAGE);
748                                    
749                    mbBase = CC.getViewConfig().getFirstMidiBankNumber();
750                    mpBase = CC.getViewConfig().getFirstMidiProgramNumber();
751                    
752                    spinnerBank = new JSpinner(new SpinnerNumberModel(mbBase, mbBase, 16383 + mbBase, 1));
753                    
754                  GridBagLayout gridbag = new GridBagLayout();                  GridBagLayout gridbag = new GridBagLayout();
755                  GridBagConstraints c = new GridBagConstraints();                  GridBagConstraints c = new GridBagConstraints();
756                                    
# Line 835  class InstrumentMappingWizardPage extend Line 843  class InstrumentMappingWizardPage extend
843                  cbMap.setEnabled(cbMap.getItemCount() > 0);                  cbMap.setEnabled(cbMap.getItemCount() > 0);
844                                    
845                                    
846                  for(int i = 0; i < 128; i++) cbProgram.addItem(new Integer(i));                  for(int i = 0; i < 128; i++) cbProgram.addItem(new Integer(i) + mpBase);
847                                    
848                  cbMap.addActionListener(new ActionListener() {                  cbMap.addActionListener(new ActionListener() {
849                          public void                          public void
# Line 866  class InstrumentMappingWizardPage extend Line 874  class InstrumentMappingWizardPage extend
874                  MidiInstrumentMap map = (MidiInstrumentMap)cbMap.getSelectedItem();                  MidiInstrumentMap map = (MidiInstrumentMap)cbMap.getSelectedItem();
875                  MidiInstrumentEntry entry = map.getAvailableEntry();                  MidiInstrumentEntry entry = map.getAvailableEntry();
876                  if(entry == null) return;                  if(entry == null) return;
877                  spinnerBank.setValue(entry.getMidiBank());                  setMidiBank(entry.getMidiBank());
878                  cbProgram.setSelectedIndex(entry.getMidiProgram());                  cbProgram.setSelectedIndex(entry.getMidiProgram());
879          }          }
880                    
# Line 901  class InstrumentMappingWizardPage extend Line 909  class InstrumentMappingWizardPage extend
909          getMapId() { return ((MidiInstrumentMap)cbMap.getSelectedItem()).getMapId(); }          getMapId() { return ((MidiInstrumentMap)cbMap.getSelectedItem()).getMapId(); }
910                    
911          /**          /**
912           * Gets the selected MIDI bank.           * Gets the selected MIDI bank (always zero-based).
913           */           */
914          public int          public int
915          getMidiBank() { return Integer.parseInt(spinnerBank.getValue().toString()); }          getMidiBank() { return Integer.parseInt(spinnerBank.getValue().toString()) - mbBase; }
916            
917            /**
918             * Sets the selected MIDI bank (always zero-based).
919             */
920            public void
921            setMidiBank(int bank) { spinnerBank.setValue(mbBase + bank); }
922                    
923          /**          /**
924           * Gets the selected MIDI program.           * Gets the selected MIDI program (always zero-based).
925           */           */
926          public int          public int
927          getMidiProgram() { return cbProgram.getSelectedIndex(); }          getMidiProgram() { return cbProgram.getSelectedIndex(); }

Legend:
Removed from v.1766  
changed lines
  Added in v.1767

  ViewVC Help
Powered by ViewVC