Skip to content

Commit c548771

Browse files
committed
update the code completion pref here too
1 parent 635fb99 commit c548771

File tree

1 file changed

+64
-64
lines changed

1 file changed

+64
-64
lines changed

app/src/processing/app/PreferencesFrame.java

Lines changed: 64 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,15 @@
4141
* Window for modifying preferences.
4242
* <P>
4343
* This is ugly GUI code that uses exact layout. This was done in frustration
44-
* one evening (and pre-Swing), but that's long since past, and the code
44+
* one evening (and pre-Swing), but that's long since past, and the code
4545
* should instead be ported to a proper Swing layout like Group or BoxLayout.
4646
* <A HREF="https://github.com/processing/processing/issues/67">See here</A>.
4747
*/
4848
public class PreferencesFrame {
4949
JFrame dialog;
5050
int wide, high;
5151

52-
static final Integer[] FONT_SIZES = { 10, 12, 14, 18, 24, 36, 48 };
52+
static final Integer[] FONT_SIZES = { 10, 12, 14, 18, 24, 36, 48 };
5353

5454
JTextField sketchbookLocationField;
5555
JTextField presentColor;
@@ -66,18 +66,18 @@ public class PreferencesFrame {
6666
JCheckBox autoAssociateBox;
6767

6868
ColorChooser selector;
69-
69+
7070
JCheckBox errorCheckerBox;
7171
JCheckBox warningsCheckerBox;
7272
JCheckBox codeCompletionBox;
7373
JCheckBox importSuggestionsBox;
7474
JCheckBox codeCompletionTriggerBox;
75-
75+
7676
JComboBox displaySelectionBox;
7777
JComboBox languageSelectionBox;
7878

7979
int displayCount;
80-
80+
8181
String[] monoFontFamilies;
8282
JComboBox fontSelectionBox;
8383

@@ -98,7 +98,7 @@ public PreferencesFrame(Base base) {
9898
final int GUI_BIG = Preferences.GUI_BIG;
9999
final int GUI_SMALL = Preferences.GUI_SMALL;
100100
final int BUTTON_WIDTH = Preferences.BUTTON_WIDTH;
101-
101+
102102
int top = GUI_BIG;
103103
int left = GUI_BIG;
104104
int right = 0;
@@ -146,14 +146,14 @@ public void actionPerformed(ActionEvent e) {
146146
right = Math.max(right, h + d2.width + GUI_BIG);
147147
top += vmax + GUI_BETWEEN;
148148

149-
149+
150150
// Language: [ English ] (requires restart of Processing)
151-
151+
152152
Container languageBox = Box.createHorizontalBox();
153153
JLabel languageLabel = new JLabel(Language.text("preferences.language")+": ");
154154
languageBox.add(languageLabel);
155155
languageSelectionBox = new JComboBox();
156-
156+
157157
Map<String, String> languages = Language.getLanguages();
158158
String[] languageSelection = new String[languages.size()];
159159
languageSelection[0] = languages.get(Language.getLanguage());
@@ -171,16 +171,16 @@ public void actionPerformed(ActionEvent e) {
171171
d = languageBox.getPreferredSize();
172172
languageBox.setBounds(left, top, d.width, d.height);
173173
top += d.height + GUI_BETWEEN;
174-
174+
175175

176176
// Editor and console font [ Source Code Pro ]
177177

178-
// Nevermind on this for now.. Java doesn't seem to have a method for
179-
// enumerating only the fixed-width (monospaced) fonts. To do this
180-
// properly, we'd need to list the fonts, and compare the metrics of
181-
// i and M for each. When they're identical (and not degenerate),
182-
// we'd call that font fixed width. That's all a very expensive set of
183-
// operations, so it should also probably be cached between runs and
178+
// Nevermind on this for now.. Java doesn't seem to have a method for
179+
// enumerating only the fixed-width (monospaced) fonts. To do this
180+
// properly, we'd need to list the fonts, and compare the metrics of
181+
// i and M for each. When they're identical (and not degenerate),
182+
// we'd call that font fixed width. That's all a very expensive set of
183+
// operations, so it should also probably be cached between runs and
184184
// updated in the background.
185185

186186
Container fontBox = Box.createHorizontalBox();
@@ -192,7 +192,7 @@ public void actionPerformed(ActionEvent e) {
192192
fontSelectionBox = new JComboBox(new Object[] { Toolkit.getMonoFontName() });
193193
fontSelectionBox.setToolTipText(fontTip);
194194
// fontSelectionBox.addItem(Toolkit.getMonoFont(size, style));
195-
//updateDisplayList();
195+
//updateDisplayList();
196196
fontSelectionBox.setEnabled(false); // don't enable until fonts are loaded
197197
fontBox.add(fontSelectionBox);
198198
// fontBox.add(Box.createHorizontalGlue());
@@ -201,8 +201,8 @@ public void actionPerformed(ActionEvent e) {
201201
fontBox.setBounds(left, top, d.width + 150, d.height);
202202
// fontBox.setBounds(left, top, dialog.getWidth() - left*2, d.height);
203203
top += d.height + GUI_BETWEEN;
204-
205-
204+
205+
206206
// Editor font size [ 12 ] Console font size [ 10 ]
207207

208208
Container box = Box.createHorizontalBox();
@@ -215,20 +215,20 @@ public void actionPerformed(ActionEvent e) {
215215
box.add(Box.createHorizontalStrut(GUI_BETWEEN));
216216

217217
label = new JLabel(Language.text("preferences.console_font_size")+": ");
218-
218+
219219
box.add(label);
220220
// consoleSizeField = new JComboBox<Integer>(FONT_SIZES);
221221
consoleSizeField = new JComboBox<Integer>(FONT_SIZES);
222222
consoleSizeField.setEditable(true);
223223
box.add(consoleSizeField);
224-
224+
225225
pain.add(box);
226226
d = box.getPreferredSize();
227227
box.setBounds(left, top, d.width, d.height);
228228
fontSizeField.setSelectedItem(Preferences.getFont("editor.font.size"));
229229
top += d.height + GUI_BETWEEN;
230-
231-
230+
231+
232232
Container colorBox = Box.createHorizontalBox();
233233

234234
label = new JLabel(Language.text("preferences.background_color")+": ");
@@ -319,8 +319,8 @@ public void actionPerformed(ActionEvent e) {
319319
presentColor.addMouseListener(new MouseListener() {
320320
@Override public void mouseReleased(MouseEvent e) {}
321321
@Override public void mousePressed(MouseEvent e) {}
322-
323-
@Override
322+
323+
@Override
324324
public void mouseExited(MouseEvent e) {
325325
dialog.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
326326
}
@@ -341,16 +341,16 @@ public void mouseClicked(MouseEvent e) {
341341
colorBox.add(presentColorHex);
342342
colorBox.add(Box.createHorizontalStrut(GUI_SMALL + 2 / 3 * GUI_SMALL));
343343
colorBox.add(presentColor);
344-
344+
345345
pain.add(colorBox);
346346
d = colorBox.getPreferredSize();
347347
colorBox.setBounds(left, top, d.width, d.height);
348348

349349
top += d.height + GUI_BETWEEN;
350350

351-
351+
352352
// [ ] Use smooth text in editor window
353-
353+
354354
editorAntialiasBox = new JCheckBox(Language.text("preferences.use_smooth_text"));
355355
pain.add(editorAntialiasBox);
356356
d = editorAntialiasBox.getPreferredSize();
@@ -359,7 +359,7 @@ public void mouseClicked(MouseEvent e) {
359359
right = Math.max(right, left + d.width);
360360
top += d.height + GUI_BETWEEN;
361361

362-
362+
363363
// [ ] Enable complex text input (for Japanese et al, requires restart)
364364

365365
inputMethodBox =
@@ -371,21 +371,21 @@ public void mouseClicked(MouseEvent e) {
371371
inputMethodBox.setBounds(left, top, d.width + 10, d.height);
372372
right = Math.max(right, left + d.width);
373373
top += d.height + GUI_BETWEEN;
374-
375-
374+
375+
376376
// [ ] Continuously check for errors - PDE X
377377

378378
errorCheckerBox =
379379
new JCheckBox(Language.text("preferences.continuously_check"));
380-
380+
381381
pain.add(errorCheckerBox);
382382
d = errorCheckerBox.getPreferredSize();
383383
errorCheckerBox.setBounds(left, top, d.width + 10, d.height);
384384
//right = Math.max(right, left + d.width);
385385
//top += d.height + GUI_BETWEEN;
386-
int warningLeft = left + d.width;
386+
int warningLeft = left + d.width;
387+
387388

388-
389389
// [ ] Show Warnings - PDE X
390390

391391
warningsCheckerBox =
@@ -396,7 +396,7 @@ public void mouseClicked(MouseEvent e) {
396396
right = Math.max(right, warningLeft + d.width);
397397
top += d.height + GUI_BETWEEN;
398398

399-
399+
400400
// [ ] Enable Code Completion - PDE X
401401

402402
codeCompletionBox =
@@ -405,16 +405,16 @@ public void mouseClicked(MouseEvent e) {
405405
d = codeCompletionBox.getPreferredSize();
406406
codeCompletionBox.setBounds(left, top, d.width + 10, d.height);
407407
codeCompletionBox.addActionListener(new ActionListener() {
408-
408+
409409
@Override
410410
public void actionPerformed(ActionEvent e) {
411-
// Disble code completion trigger option if CC is disabled
411+
// Disble code completion trigger option if completion is disabled
412412
codeCompletionTriggerBox.setEnabled(codeCompletionBox.isSelected());
413413
}
414414
});
415-
416-
int toggleLeft = left + d.width;
417-
415+
416+
int toggleLeft = left + d.width;
417+
418418
// [ ] Toggle Code Completion Trigger - PDE X
419419

420420
codeCompletionTriggerBox =
@@ -434,7 +434,7 @@ public void actionPerformed(ActionEvent e) {
434434
importSuggestionsBox.setBounds(left, top, d.width + 10, d.height);
435435
right = Math.max(right, left + d.width);
436436
top += d.height + GUI_BETWEEN;
437-
437+
438438
// [ ] Increase maximum available memory to [______] MB
439439

440440
Container memoryBox = Box.createHorizontalBox();
@@ -464,8 +464,8 @@ public void stateChanged(ChangeEvent e) {
464464
deletePreviousBox.setBounds(left, top, d.width + 10, d.height);
465465
right = Math.max(right, left + d.width);
466466
top += d.height + GUI_BETWEEN;
467-
468-
467+
468+
469469
// [ ] Hide tab/toolbar background image
470470

471471
whinyBox = new JCheckBox(Language.text("preferences.hide_toolbar_background_image")+
@@ -501,7 +501,7 @@ public void stateChanged(ChangeEvent e) {
501501
d = displayBox.getPreferredSize();
502502
displayBox.setBounds(left, top, d.width, d.height);
503503
top += d.height + GUI_BETWEEN;
504-
504+
505505

506506
// [ ] Automatically associate .pde files with Processing
507507

@@ -669,7 +669,7 @@ protected void applyFrame() {
669669
boolean wine = whinyBox.isSelected();
670670
Preferences.setBoolean("header.hide.image", wine); //$NON-NLS-1$
671671
Preferences.setBoolean("buttons.hide.image", wine); //$NON-NLS-1$
672-
// Could iterate through editors here and repaint them all, but probably
672+
// Could iterate through editors here and repaint them all, but probably
673673
// requires a doLayout() call, and that may have different effects on
674674
// each platform, and nobody wants to debug/support that.
675675

@@ -682,7 +682,7 @@ protected void applyFrame() {
682682

683683
// setBoolean("editor.external", externalEditorBox.isSelected());
684684
Preferences.setBoolean("update.check", checkUpdatesBox.isSelected()); //$NON-NLS-1$
685-
685+
686686
// Save Language
687687
Map<String, String> languages = Language.getLanguages();
688688
String language = "";
@@ -695,7 +695,7 @@ protected void applyFrame() {
695695
if (!language.equals(Language.getLanguage()) && !language.equals("")) {
696696
Language.saveLanguage(language);
697697
}
698-
698+
699699
int oldDisplayIndex = Preferences.getInteger("run.display"); //$NON-NLS-1$
700700
int displayIndex = 0;
701701
for (int d = 0; d < displaySelectionBox.getItemCount(); d++) {
@@ -740,7 +740,7 @@ protected void applyFrame() {
740740
Base.log("Ignoring invalid font size " + fontSizeField); //$NON-NLS-1$
741741
fontSizeField.setSelectedItem(Preferences.getInteger("editor.font.size"));
742742
}
743-
743+
744744
try {
745745
Object selection = consoleSizeField.getSelectedItem();
746746
if (selection instanceof String) {
@@ -753,22 +753,22 @@ protected void applyFrame() {
753753
Base.log("Ignoring invalid font size " + consoleSizeField); //$NON-NLS-1$
754754
consoleSizeField.setSelectedItem(Preferences.getInteger("console.font.size"));
755755
}
756-
756+
757757
Preferences.setColor("run.present.bgcolor", presentColor.getBackground());
758-
758+
759759
Preferences.setBoolean("editor.input_method_support", inputMethodBox.isSelected()); //$NON-NLS-1$
760760

761761
if (autoAssociateBox != null) {
762762
Preferences.setBoolean("platform.auto_file_type_associations", //$NON-NLS-1$
763763
autoAssociateBox.isSelected());
764764
}
765-
765+
766766
Preferences.setBoolean("pdex.errorCheckEnabled", errorCheckerBox.isSelected());
767767
Preferences.setBoolean("pdex.warningsEnabled", warningsCheckerBox.isSelected());
768-
Preferences.setBoolean("pdex.ccEnabled", codeCompletionBox.isSelected());
769-
Preferences.setBoolean("pdex.ccTriggerEnabled", codeCompletionTriggerBox.isSelected());
768+
Preferences.setBoolean("pdex.completion", codeCompletionBox.isSelected());
769+
Preferences.setBoolean("pdex.completion.trigger", codeCompletionTriggerBox.isSelected());
770770
Preferences.setBoolean("pdex.importSuggestEnabled", importSuggestionsBox.isSelected());
771-
771+
772772
for (Editor editor : base.getEditors()) {
773773
editor.applyPreferences();
774774
}
@@ -780,8 +780,8 @@ protected void showFrame() {
780780
inputMethodBox.setSelected(Preferences.getBoolean("editor.input_method_support")); //$NON-NLS-1$
781781
errorCheckerBox.setSelected(Preferences.getBoolean("pdex.errorCheckEnabled"));
782782
warningsCheckerBox.setSelected(Preferences.getBoolean("pdex.warningsEnabled"));
783-
codeCompletionBox.setSelected(Preferences.getBoolean("pdex.ccEnabled"));
784-
codeCompletionTriggerBox.setSelected(Preferences.getBoolean("pdex.ccTriggerEnabled"));
783+
codeCompletionBox.setSelected(Preferences.getBoolean("pdex.completion"));
784+
codeCompletionTriggerBox.setSelected(Preferences.getBoolean("pdex.completion.trigger"));
785785
codeCompletionTriggerBox.setEnabled(codeCompletionBox.isSelected());
786786
importSuggestionsBox.setSelected(Preferences.getBoolean("pdex.importSuggestEnabled"));
787787
deletePreviousBox.
@@ -798,20 +798,20 @@ protected void showFrame() {
798798
if (displayNum >= 0 && displayNum < displayCount) {
799799
displaySelectionBox.setSelectedIndex(displayNum);
800800
}
801-
801+
802802
// This takes a while to load, so run it from a separate thread
803803
EventQueue.invokeLater(new Runnable() {
804804
public void run() {
805805
initFontList();
806806
}
807807
});
808-
808+
809809
fontSizeField.setSelectedItem(Preferences.getInteger("editor.font.size"));
810810
consoleSizeField.setSelectedItem(Preferences.getInteger("console.font.size"));
811811

812812
presentColor.setBackground(Preferences.getColor("run.present.bgcolor"));
813813
presentColorHex.setText(Preferences.get("run.present.bgcolor").substring(1));
814-
814+
815815
memoryOverrideBox.
816816
setSelected(Preferences.getBoolean("run.options.memory")); //$NON-NLS-1$
817817
memoryField.
@@ -827,7 +827,7 @@ public void run() {
827827
}
828828

829829

830-
/**
830+
/**
831831
* I have some ideas on how we could make Swing even more obtuse for the
832832
* most basic usage scenarios. Is there someone on the team I can contact?
833833
* Oracle, are you listening?
@@ -842,22 +842,22 @@ public Component getListCellRendererComponent(JList<? extends Font> list,
842842
return this;
843843
}
844844
}
845-
845+
846846

847847
void initFontList() {
848848
if (monoFontFamilies == null) {
849849
monoFontFamilies = Toolkit.getMonoFontFamilies();
850850
fontSelectionBox.setModel(new DefaultComboBoxModel(monoFontFamilies));
851851
String family = Preferences.get("editor.font.family");
852852

853-
// Set a reasonable default, in case selecting the family fails
853+
// Set a reasonable default, in case selecting the family fails
854854
fontSelectionBox.setSelectedItem("Monospaced");
855855
fontSelectionBox.setSelectedItem(family);
856856
fontSelectionBox.setEnabled(true);
857857
}
858858
}
859-
860-
859+
860+
861861
void updateDisplayList() {
862862
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
863863
displayCount = ge.getScreenDevices().length;

0 commit comments

Comments
 (0)