1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-02-26 20:54:22 +01:00

Removed color theme selection: we currently support only one theme

This commit is contained in:
Federico Fissore 2015-04-24 17:30:11 +02:00
parent 330aeb0ba1
commit 2ec7a02532
4 changed files with 10 additions and 43 deletions

View File

@ -451,9 +451,7 @@ public class Editor extends JFrame implements RunnerListener {
saveAsMenuItem.setEnabled(!external); saveAsMenuItem.setEnabled(!external);
scrollPane.setLineNumbersEnabled(PreferencesData.getBoolean("editor.linenumbers")); scrollPane.setLineNumbersEnabled(PreferencesData.getBoolean("editor.linenumbers"));
textarea.setTheme(PreferencesData.get("editor.syntax_theme"));
textarea.setCodeFoldingEnabled(PreferencesData.getBoolean("editor.code_folding")); textarea.setCodeFoldingEnabled(PreferencesData.getBoolean("editor.code_folding"));
if (external) { if (external) {
@ -957,7 +955,7 @@ public class Editor extends JFrame implements RunnerListener {
} }
protected SketchTextArea createTextArea(){ protected SketchTextArea createTextArea() throws IOException {
SketchTextArea textArea = new SketchTextArea(); SketchTextArea textArea = new SketchTextArea();
textArea.requestFocusInWindow(); textArea.requestFocusInWindow();
textArea.setMarkOccurrences(true); textArea.setMarkOccurrences(true);

View File

@ -231,7 +231,6 @@ public class Preferences {
JCheckBox autoAssociateBox; JCheckBox autoAssociateBox;
JComboBox comboLanguage; JComboBox comboLanguage;
JComboBox comboWarnings; JComboBox comboWarnings;
JComboBox comboSyntaxThemes;
JCheckBox saveVerifyUploadBox; JCheckBox saveVerifyUploadBox;
JTextField proxyHTTPServer; JTextField proxyHTTPServer;
JTextField proxyHTTPPort; JTextField proxyHTTPPort;
@ -359,27 +358,6 @@ public class Preferences {
fontSizeField.setText(String.valueOf(editorFont.getSize())); fontSizeField.setText(String.valueOf(editorFont.getSize()));
top += d.height + GUI_BETWEEN; top += d.height + GUI_BETWEEN;
// Syntax Coloring [ ]
box = Box.createHorizontalBox();
label = new JLabel(_("Syntax Coloring: "));
box.add(label);
String[] syntaxThemes = new String[]{"default","dark"};
comboSyntaxThemes = new JComboBox(syntaxThemes);
String currentTheme = PreferencesData.get("editor.syntax_theme", "default");
for (String item : syntaxThemes) {
if (currentTheme.equals(item)) {
comboSyntaxThemes.setSelectedItem(item);
}
}
box.add(comboSyntaxThemes);
pane.add(box);
d = box.getPreferredSize();
box.setForeground(Color.gray);
box.setBounds(left, top, d.width, d.height);
right = Math.max(right, left + d.width);
top += d.height + GUI_BETWEEN;
// Show verbose output during: [ ] compilation [ ] upload // Show verbose output during: [ ] compilation [ ] upload
box = Box.createHorizontalBox(); box = Box.createHorizontalBox();
@ -778,7 +756,6 @@ public class Preferences {
PreferencesData.set("sketchbook.path", newPath); PreferencesData.set("sketchbook.path", newPath);
} }
PreferencesData.set("editor.syntax_theme", comboSyntaxThemes.getSelectedItem().toString());
PreferencesData.setBoolean("editor.external", externalEditorBox.isSelected()); PreferencesData.setBoolean("editor.external", externalEditorBox.isSelected());
PreferencesData.setBoolean("update.check", checkUpdatesBox.isSelected()); PreferencesData.setBoolean("update.check", checkUpdatesBox.isSelected());
PreferencesData.setBoolean("editor.save_on_verify", saveVerifyUploadBox.isSelected()); PreferencesData.setBoolean("editor.save_on_verify", saveVerifyUploadBox.isSelected());

View File

@ -75,13 +75,14 @@ public class SketchTextArea extends RSyntaxTextArea {
private EditorListener editorListener; private EditorListener editorListener;
public SketchTextArea() { public SketchTextArea() throws IOException {
super(); super();
installFeatures(); installFeatures();
} }
protected void installFeatures(){ protected void installFeatures() throws IOException {
setTheme(PreferencesData.get("editor.syntax_theme", "default")); setTheme(PreferencesData.get("editor.syntax_theme", "default"));
setLinkGenerator(new DocLinkGenerator()); setLinkGenerator(new DocLinkGenerator());
@ -89,26 +90,20 @@ public class SketchTextArea extends RSyntaxTextArea {
fixControlTab(); fixControlTab();
installTokenMaker(); installTokenMaker();
} }
public void setTheme(String name){ public void setTheme(String name) throws IOException {
FileInputStream defaultXmlInputStream = null; FileInputStream defaultXmlInputStream = null;
try { try {
defaultXmlInputStream = new FileInputStream(new File(BaseNoGui.getContentFile("lib"), "theme/syntax/"+name+".xml")); defaultXmlInputStream = new FileInputStream(new File(BaseNoGui.getContentFile("lib"), "theme/syntax/" + name + ".xml"));
Theme theme = Theme.load(defaultXmlInputStream); Theme theme = Theme.load(defaultXmlInputStream);
theme.apply(this); theme.apply(this);
} catch (IOException e) {
e.printStackTrace();
} finally { } finally {
if (defaultXmlInputStream != null) { if (defaultXmlInputStream != null) {
try { defaultXmlInputStream.close();
defaultXmlInputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
} }
} }
} }
// Removing the default focus traversal keys // Removing the default focus traversal keys
// This is because the DefaultKeyboardFocusManager handles the keypress and consumes the event // This is because the DefaultKeyboardFocusManager handles the keypress and consumes the event
protected void fixControlTab(){ protected void fixControlTab(){

View File

@ -86,9 +86,6 @@ editor.window.height.min = 290
# tested to be 515 on Windows XP, this leaves some room # tested to be 515 on Windows XP, this leaves some room
#editor.window.height.min.windows = 530 #editor.window.height.min.windows = 530
# Syntax coloring ( on lib/theme/syntax )
editor.syntax_theme=default
# Enable code folding # Enable code folding
editor.code_folding=true editor.code_folding=true