PrefCheckBox ggCheckBox;
PrefComboBox ggChoice;
JTabbedPane ggTabPane;
JLabel lb;
UIManager.LookAndFeelInfo[] lafInfos;
SpringPanel tab;
Preferences prefs;
String key, key2, title;
int row;
ggTabPane = new JTabbedPane();
setTitle( getResourceString( "framePrefs" ));
// ---------- global pane ----------
tab = createTab();
row = 0;
prefs = IOUtil.getUserPrefs();
key = IOUtil.KEY_TEMPDIR;
key2 = "prefsTmpDir";
lb = new JLabel( getResourceString( key2 ), JLabel.TRAILING );
tab.gridAdd( lb, 0, row );
ggPath = new PrefPathField( PathField.TYPE_FOLDER, getResourceString( key2 ));
ggPath.setPreferences( prefs, key );
// HelpGlassPane.setHelp( ggPath, key2 ); // EEE
tab.gridAdd( ggPath, 1, row );
row++;
prefs = app.getUserPrefs();
key = PrefsUtil.KEY_RECALLFRAMES;
key2 = "prefsRecallFrames";
lb = new JLabel( getResourceString( key2 ), JLabel.TRAILING );
tab.gridAdd( lb, 0, row );
ggCheckBox = new PrefCheckBox();
ggCheckBox.setPreferences( prefs, key );
// HelpGlassPane.setHelp( ggCheckBox, key2 ); // EEE
tab.gridAdd( ggCheckBox, 1, row );
row++;
prefs = app.getUserPrefs();
key = PrefsUtil.KEY_LOOKANDFEEL;
key2 = "prefsLookAndFeel";
title = getResourceString( key2 );
lb = new JLabel( title, TRAILING );
tab.gridAdd( lb, 0, row );
ggChoice = new PrefComboBox();
lafInfos = UIManager.getInstalledLookAndFeels();
for( int i = 0; i < lafInfos.length; i++ ) {
ggChoice.addItem( new StringItem( lafInfos[i].getClassName(), lafInfos[i].getName() ));
}
ggChoice.setPreferences( prefs, key );
ggChoice.addActionListener( new WarnPrefsChange( ggChoice, ggChoice, haveWarned, txtWarnLookAndFeel, title ));
tab.gridAdd( ggChoice, 1, row, -1, 1 );
row++;
key = BasicWindowHandler.KEY_LAFDECORATION;
key2 = "prefsLAFDecoration";
title = getResourceString( key2 );
ggCheckBox = new PrefCheckBox( title );
ggCheckBox.setPreferences( prefs, key );
tab.gridAdd( ggCheckBox, 1, row, -1, 1 );
ggCheckBox.addActionListener( new WarnPrefsChange( ggCheckBox, ggCheckBox, haveWarned, txtWarnLookAndFeel, title ));
row++;
key = BasicWindowHandler.KEY_INTERNALFRAMES;
key2 = "prefsInternalFrames";
title = getResourceString( key2 );
ggCheckBox = new PrefCheckBox( title );
ggCheckBox.setPreferences( prefs, key );
tab.gridAdd( ggCheckBox, 1, row, -1, 1 );
ggCheckBox.addActionListener( new WarnPrefsChange( ggCheckBox, ggCheckBox, haveWarned, txtWarnLookAndFeel, title ));
row++;
key = CoverGrowBox.KEY_INTRUDINGSIZE;
key2 = "prefsIntrudingSize";
ggCheckBox = new PrefCheckBox( getResourceString( key2 ));
ggCheckBox.setPreferences( prefs, key );
tab.gridAdd( ggCheckBox, 1, row, -1, 1 );
row++;
key = BasicWindowHandler.KEY_FLOATINGPALETTES;
key2 = "prefsFloatingPalettes";
ggCheckBox = new PrefCheckBox( getResourceString( key2 ));
ggCheckBox.setPreferences( prefs, key );
tab.gridAdd( ggCheckBox, 1, row, -1, 1 );
ggCheckBox.addActionListener( new WarnPrefsChange( ggCheckBox, ggCheckBox, haveWarned, txtWarnLookAndFeel, title ));
row++;
prefs = GUIUtil.getUserPrefs();
// key = HelpGlassPane.KEY_KEYSTROKE_HELP; // EEE
key2 = "prefsKeyStrokeHelp";
lb = new JLabel( getResourceString( key2 ), JLabel.TRAILING );
tab.gridAdd( lb, 0, row );
ggKeyStroke = new KeyStrokeTextField();
ggKeyStroke.setPreferences( prefs, key );
// HelpGlassPane.setHelp( ggKeyStroke, key2 ); // EEE
tab.gridAdd( ggKeyStroke, 1, row );
addTab( ggTabPane, tab, "prefsGeneral" );
// ---------- plug-ins pane ----------
prefs = app.getUserPrefs().node( PrefsUtil.NODE_PLUGINS );
tab = createTab();
row = 0;
key = PrefsUtil.KEY_LISPREALTIMELIST;
key2 = "prefsLispRealtimeList";
lb = new JLabel( getResourceString( key2 ), JLabel.TRAILING );
tab.gridAdd( lb, 0, row );
ggPath = new PrefPathField( PathField.TYPE_INPUTFILE, getResourceString( key2 ));
ggPath.setPreferences( prefs, key );
// HelpGlassPane.setHelp( ggPath, key2 ); // EEE
tab.gridAdd( ggPath, 1, row );
row++;
key = PrefsUtil.KEY_LISPBOUNCELIST;
key2 = "prefsLispBounceList";
lb = new JLabel( getResourceString( key2 ), JLabel.TRAILING );
tab.gridAdd( lb, 0, row );
ggPath = new PrefPathField( PathField.TYPE_INPUTFILE, getResourceString( key2 ));
ggPath.setPreferences( prefs, key );
// HelpGlassPane.setHelp( ggPath, key2 ); // EEE
tab.gridAdd( ggPath, 1, row );
row++;
key = PrefsUtil.KEY_LISPFILTERLIST;
key2 = "prefsLispFilterList";
lb = new JLabel( getResourceString( key2 ), JLabel.TRAILING );
tab.gridAdd( lb, 0, row );
ggPath = new PrefPathField( PathField.TYPE_INPUTFILE, getResourceString( key2 ));
ggPath.setPreferences( prefs, key );
// HelpGlassPane.setHelp( ggPath, key2 ); // EEE
tab.gridAdd( ggPath, 1, row );
row++;
key = PrefsUtil.KEY_SUPERCOLLIDEROSC;
key2 = "prefsSuperColliderOSC";
lb = new JLabel( getResourceString( key2 ), JLabel.TRAILING );
tab.gridAdd( lb, 0, row );
ggText = new PrefTextField( 32 );
ggText.setPreferences( prefs, key );
// HelpGlassPane.setHelp( ggText, key2 ); // EEE
tab.gridAdd( ggText, 1, row );
row++;
key = PrefsUtil.KEY_SUPERCOLLIDERAPP;
key2 = "prefsSuperColliderApp";
lb = new JLabel( getResourceString( key2 ), JLabel.TRAILING );
tab.gridAdd( lb, 0, row );
ggPath = new PrefPathField( PathField.TYPE_INPUTFILE, getResourceString( key2 ));
ggPath.setPreferences( prefs, key );
// HelpGlassPane.setHelp( ggPath, key2 ); // EEE
tab.gridAdd( ggPath, 1, row );
row++;
key = PrefsUtil.KEY_CSOUNDAPP;
key2 = "prefsCSoundApp";
lb = new JLabel( getResourceString( key2 ), JLabel.TRAILING );
tab.gridAdd( lb, 0, row );
ggPath = new PrefPathField( PathField.TYPE_INPUTFILE, getResourceString( key2 ));
ggPath.setPreferences( prefs, key );
// HelpGlassPane.setHelp( ggPath, key2 ); // EEE
tab.gridAdd( ggPath, 1, row );
row++;
key = PrefsUtil.KEY_AUDIOINPUTS;
key2 = "prefsAudioInputChannels";
lb = new JLabel( getResourceString( key2 ), JLabel.TRAILING );
tab.gridAdd( lb, 0, row );
ggNumber = new PrefNumberField();
ggNumber.setSpace( NumberSpace.createIntSpace( 0, 16384 ));
// ggNumber.setUnit( getResourceString( "labelUnitChannels" )); // EEE
ggNumber.setPreferences( prefs, key );
// HelpGlassPane.setHelp( ggNumber, key2 ); // EEE
tab.gridAdd( ggNumber, 1, row );
row++;
key = PrefsUtil.KEY_AUDIOOUTPUTS;
key2 = "prefsAudioOutputChannels";
lb = new JLabel( getResourceString( key2 ), JLabel.TRAILING );
tab.gridAdd( lb, 0, row );
ggNumber = new PrefNumberField();
ggNumber.setSpace( NumberSpace.createIntSpace( 0, 16384 ));
// ggNumber.setUnit( getResourceString( "labelUnitChannels" )); // EEE
ggNumber.setPreferences( prefs, key );
// HelpGlassPane.setHelp( ggNumber, key2 ); // EEE
tab.gridAdd( ggNumber, 1, row );
row++;
key = PrefsUtil.KEY_AUDIORATE;
key2 = "prefsAudioRate";
lb = new JLabel( getResourceString( key2 ), JLabel.TRAILING );
tab.gridAdd( lb, 0, row );
ggNumber = new PrefNumberField();
ggNumber.setSpace( NumberSpace.createIntSpace( 1, 768000 ));
// ggNumber.setUnit( getResourceString( "labelUnitHertz" )); // EEE
ggNumber.setPreferences( prefs, key );
// HelpGlassPane.setHelp( ggNumber, key2 ); // EEE
tab.gridAdd( ggNumber, 1, row );
row++;
key = PrefsUtil.KEY_RTSENSEBUFSIZE;
key2 = "prefsRTSenseBufSize";
lb = new JLabel( getResourceString( key2 ), JLabel.TRAILING );
tab.gridAdd( lb, 0, row );
ggNumber = new PrefNumberField();
ggNumber.setSpace( NumberSpace.createIntSpace( 1, 60000 ));
// ggNumber.setUnit( getResourceString( "labelUnitMillisec" )); // EEE
ggNumber.setPreferences( prefs, key );
// HelpGlassPane.setHelp( ggNumber, key2 ); // EEE
tab.gridAdd( ggNumber, 1, row );
row++;
key = PrefsUtil.KEY_RTMAXSENSERATE;
key2 = "prefsRTMaxSenseRate";
lb = new JLabel( getResourceString( key2 ), JLabel.TRAILING );
tab.gridAdd( lb, 0, row );
ggNumber = new PrefNumberField();
ggNumber.setSpace( NumberSpace.createIntSpace( 1, 768000 ));
// ggNumber.setUnit( getResourceString( "labelUnitHertz" )); // EEE
ggNumber.setPreferences( prefs, key );
// HelpGlassPane.setHelp( ggNumber, key2 ); // EEE
tab.gridAdd( ggNumber, 1, row );
row++;
key = PrefsUtil.KEY_OLSENSEBUFSIZE;
key2 = "prefsOLSenseBufSize";
lb = new JLabel( getResourceString( key2 ), JLabel.TRAILING );
tab.gridAdd( lb, 0, row );
ggNumber = new PrefNumberField();
ggNumber.setSpace( NumberSpace.createIntSpace( 1, 60000 ));
// ggNumber.setUnit( getResourceString( "labelUnitMillisec" )); // EEE
ggNumber.setPreferences( prefs, key );
// HelpGlassPane.setHelp( ggNumber, key2 ); // EEE
tab.gridAdd( ggNumber, 1, row );
addTab( ggTabPane, tab, "prefsPlugIns" );
// ---------- session pane ----------
prefs = app.getUserPrefs().node( PrefsUtil.NODE_SESSION );
tab = createTab();
row = 0;
key = PrefsUtil.KEY_COMMENT;
key2 = "prefsComment";
lb = new JLabel( getResourceString( key2 ), JLabel.TRAILING );
tab.gridAdd( lb, 0, row );
ggArea = new PrefTextArea( 6, 32 );
ggArea.setPreferences( prefs, key );
// HelpGlassPane.setHelp( ggArea, key2 ); // EEE
tab.gridAdd( ggArea, 1, row );
row++;
key2 = "prefsSenseRate";
lb = new JLabel( getResourceString( key2 ), JLabel.TRAILING );
tab.gridAdd( lb, 0, row );
ggRate = new PrefNumberField();
ggRate.setSpace( NumberSpace.createIntSpace( 1, 768000 ));
// ggRate.setUnit( getResourceString( "labelUnitHertz" )); // EEE
// ggNumber.setPreferences( prefs, key );
tab.gridAdd( ggRate, 1, row );
ggRate.addListener( new NumberListener() {
public void numberChanged( NumberEvent e )
{
if( !doc.bird.attemptExclusive( Session.DOOR_TIME, 250 )) {
ggRate.setNumber( new Double( doc.timeline.getRate() )); // undo
return;
}
try {
// root.transport.stopAndWait();
int newRate = ggRate.getNumber().intValue();
if( newRate != doc.timeline.getRate() ) {
doc.timeline.setRate( ggRate, newRate );
}
} finally {
doc.bird.releaseExclusive( Session.DOOR_TIME );
}
}
});
// HelpGlassPane.setHelp( ggRate, key2 ); // EEE
tab.gridAdd( ggRate, 1, row );
addTab( ggTabPane, tab, "prefsSession" );
// ---------- generic gadgets ----------