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

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

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

revision 1328 by iliev, Fri Aug 10 20:24:23 2007 UTC revision 1329 by iliev, Sat Sep 8 18:33:05 2007 UTC
# Line 29  import java.awt.GridBagConstraints; Line 29  import java.awt.GridBagConstraints;
29  import java.awt.GridBagLayout;  import java.awt.GridBagLayout;
30  import java.awt.Insets;  import java.awt.Insets;
31    
32    import java.awt.event.ActionEvent;
33    import java.awt.event.ActionListener;
34    
35  import javax.swing.JComboBox;  import javax.swing.JComboBox;
36  import javax.swing.JLabel;  import javax.swing.JLabel;
37  import javax.swing.JPanel;  import javax.swing.JPanel;
# Line 42  import javax.swing.event.DocumentListene Line 45  import javax.swing.event.DocumentListene
45    
46  import net.sf.juife.OkCancelDialog;  import net.sf.juife.OkCancelDialog;
47    
48    import org.jsampler.CC;
49    import org.jsampler.JSPrefs;
50    
51  import org.linuxsampler.lscp.MidiInstrumentInfo;  import org.linuxsampler.lscp.MidiInstrumentInfo;
52    
53  import static org.jsampler.view.std.StdI18n.i18n;  import static org.jsampler.view.std.StdI18n.i18n;
# Line 163  public class JSAddMidiInstrumentDlg exte Line 169  public class JSAddMidiInstrumentDlg exte
169                  cbLoadMode.addItem(MidiInstrumentInfo.LoadMode.ON_DEMAND_HOLD);                  cbLoadMode.addItem(MidiInstrumentInfo.LoadMode.ON_DEMAND_HOLD);
170                  cbLoadMode.addItem(MidiInstrumentInfo.LoadMode.PERSISTENT);                  cbLoadMode.addItem(MidiInstrumentInfo.LoadMode.PERSISTENT);
171                                    
172                    int i = preferences().getIntProperty("std.midiInstrument.loadMode", 0);
173                    if(cbLoadMode.getItemCount() > i) cbLoadMode.setSelectedIndex(i);
174                    
175                    cbLoadMode.addActionListener(new ActionListener() {
176                            public void
177                            actionPerformed(ActionEvent e) {
178                                    int j = cbLoadMode.getSelectedIndex();
179                                    if(j < 0) return;
180                                    preferences().setIntProperty("std.midiInstrument.loadMode", j);
181                            }
182                    });
183                    
184                  tfName.getDocument().addDocumentListener(getHandler());                  tfName.getDocument().addDocumentListener(getHandler());
185          }/**          }
186            
187            protected JSPrefs
188            preferences() { return CC.getViewConfig().preferences(); }
189            
190            /**
191           * Gets the selected MIDI bank.           * Gets the selected MIDI bank.
192           */           */
193          public int          public int
194          getMidiBank() { return Integer.parseInt(spinnerBank.getValue().toString()); }          getMidiBank() { return Integer.parseInt(spinnerBank.getValue().toString()); }
195                    
196          /**          /**
197             * Sets the selected MIDI bank.
198             */
199            public void
200            setMidiBank(int bank) { spinnerBank.setValue(bank); }
201            
202            /**
203           * Gets the selected MIDI program.           * Gets the selected MIDI program.
204           */           */
205          public int          public int
206          getMidiProgram() { return cbProgram.getSelectedIndex(); }          getMidiProgram() { return cbProgram.getSelectedIndex(); }
207                    
208          /**          /**
209             * Sets the selected MIDI program.
210             */
211            public void
212            setMidiProgram(int program) { cbProgram.setSelectedIndex(program); }
213            
214            /**
215           * Gets the chosen name for the new MIDI instrument.           * Gets the chosen name for the new MIDI instrument.
216           * @return The chosen name for the new MIDI instrument.           * @return The chosen name for the new MIDI instrument.
217           */           */
# Line 208  public class JSAddMidiInstrumentDlg exte Line 243  public class JSAddMidiInstrumentDlg exte
243          protected void          protected void
244          onOk() {          onOk() {
245                  if(!btnOk.isEnabled()) return;                  if(!btnOk.isEnabled()) return;
246                    preferences().setIntProperty("lastUsedMidiBank", getMidiBank());
247                  setCancelled(false);                  setCancelled(false);
248                  setVisible(false);                  setVisible(false);
249          }          }

Legend:
Removed from v.1328  
changed lines
  Added in v.1329

  ViewVC Help
Powered by ViewVC