Skip to content

Commit 2ec7a02

Browse files
author
Federico Fissore
committed
Removed color theme selection: we currently support only one theme
1 parent 330aeb0 commit 2ec7a02

File tree

4 files changed

+10
-43
lines changed

4 files changed

+10
-43
lines changed

app/src/processing/app/Editor.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -451,9 +451,7 @@ protected void applyPreferences() {
451451
saveAsMenuItem.setEnabled(!external);
452452

453453
scrollPane.setLineNumbersEnabled(PreferencesData.getBoolean("editor.linenumbers"));
454-
455-
textarea.setTheme(PreferencesData.get("editor.syntax_theme"));
456-
454+
457455
textarea.setCodeFoldingEnabled(PreferencesData.getBoolean("editor.code_folding"));
458456

459457
if (external) {
@@ -957,7 +955,7 @@ protected String findClassInZipFile(String base, File file) {
957955
}
958956

959957

960-
protected SketchTextArea createTextArea(){
958+
protected SketchTextArea createTextArea() throws IOException {
961959
SketchTextArea textArea = new SketchTextArea();
962960
textArea.requestFocusInWindow();
963961
textArea.setMarkOccurrences(true);

app/src/processing/app/Preferences.java

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,6 @@ public String toString() {
231231
JCheckBox autoAssociateBox;
232232
JComboBox comboLanguage;
233233
JComboBox comboWarnings;
234-
JComboBox comboSyntaxThemes;
235234
JCheckBox saveVerifyUploadBox;
236235
JTextField proxyHTTPServer;
237236
JTextField proxyHTTPPort;
@@ -359,27 +358,6 @@ public void actionPerformed(ActionEvent e) {
359358
fontSizeField.setText(String.valueOf(editorFont.getSize()));
360359
top += d.height + GUI_BETWEEN;
361360

362-
// Syntax Coloring [ ]
363-
364-
box = Box.createHorizontalBox();
365-
label = new JLabel(_("Syntax Coloring: "));
366-
box.add(label);
367-
String[] syntaxThemes = new String[]{"default","dark"};
368-
comboSyntaxThemes = new JComboBox(syntaxThemes);
369-
String currentTheme = PreferencesData.get("editor.syntax_theme", "default");
370-
for (String item : syntaxThemes) {
371-
if (currentTheme.equals(item)) {
372-
comboSyntaxThemes.setSelectedItem(item);
373-
}
374-
}
375-
box.add(comboSyntaxThemes);
376-
pane.add(box);
377-
d = box.getPreferredSize();
378-
box.setForeground(Color.gray);
379-
box.setBounds(left, top, d.width, d.height);
380-
right = Math.max(right, left + d.width);
381-
top += d.height + GUI_BETWEEN;
382-
383361
// Show verbose output during: [ ] compilation [ ] upload
384362

385363
box = Box.createHorizontalBox();
@@ -778,7 +756,6 @@ protected void applyFrame() {
778756
PreferencesData.set("sketchbook.path", newPath);
779757
}
780758

781-
PreferencesData.set("editor.syntax_theme", comboSyntaxThemes.getSelectedItem().toString());
782759
PreferencesData.setBoolean("editor.external", externalEditorBox.isSelected());
783760
PreferencesData.setBoolean("update.check", checkUpdatesBox.isSelected());
784761
PreferencesData.setBoolean("editor.save_on_verify", saveVerifyUploadBox.isSelected());

app/src/processing/app/syntax/SketchTextArea.java

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -75,40 +75,35 @@ public class SketchTextArea extends RSyntaxTextArea {
7575

7676
private EditorListener editorListener;
7777

78-
public SketchTextArea() {
78+
public SketchTextArea() throws IOException {
7979
super();
8080
installFeatures();
8181
}
8282

8383

84-
protected void installFeatures(){
84+
protected void installFeatures() throws IOException {
85+
8586
setTheme(PreferencesData.get("editor.syntax_theme", "default"));
8687

8788
setLinkGenerator(new DocLinkGenerator());
8889

8990
fixControlTab();
9091
installTokenMaker();
9192
}
92-
93-
public void setTheme(String name){
93+
94+
public void setTheme(String name) throws IOException {
9495
FileInputStream defaultXmlInputStream = null;
9596
try {
96-
defaultXmlInputStream = new FileInputStream(new File(BaseNoGui.getContentFile("lib"), "theme/syntax/"+name+".xml"));
97+
defaultXmlInputStream = new FileInputStream(new File(BaseNoGui.getContentFile("lib"), "theme/syntax/" + name + ".xml"));
9798
Theme theme = Theme.load(defaultXmlInputStream);
9899
theme.apply(this);
99-
} catch (IOException e) {
100-
e.printStackTrace();
101100
} finally {
102101
if (defaultXmlInputStream != null) {
103-
try {
104-
defaultXmlInputStream.close();
105-
} catch (IOException e) {
106-
e.printStackTrace();
107-
}
102+
defaultXmlInputStream.close();
108103
}
109104
}
110105
}
111-
106+
112107
// Removing the default focus traversal keys
113108
// This is because the DefaultKeyboardFocusManager handles the keypress and consumes the event
114109
protected void fixControlTab(){

build/shared/lib/preferences.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,6 @@ editor.window.height.min = 290
8686
# tested to be 515 on Windows XP, this leaves some room
8787
#editor.window.height.min.windows = 530
8888

89-
# Syntax coloring ( on lib/theme/syntax )
90-
editor.syntax_theme=default
91-
9289
# Enable code folding
9390
editor.code_folding=true
9491

0 commit comments

Comments
 (0)