1
0
mirror of https://github.com/arduino/Arduino.git synced 2024-11-29 10:24:12 +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);
scrollPane.setLineNumbersEnabled(PreferencesData.getBoolean("editor.linenumbers"));
textarea.setTheme(PreferencesData.get("editor.syntax_theme"));
textarea.setCodeFoldingEnabled(PreferencesData.getBoolean("editor.code_folding"));
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();
textArea.requestFocusInWindow();
textArea.setMarkOccurrences(true);

View File

@ -231,7 +231,6 @@ public class Preferences {
JCheckBox autoAssociateBox;
JComboBox comboLanguage;
JComboBox comboWarnings;
JComboBox comboSyntaxThemes;
JCheckBox saveVerifyUploadBox;
JTextField proxyHTTPServer;
JTextField proxyHTTPPort;
@ -359,27 +358,6 @@ public class Preferences {
fontSizeField.setText(String.valueOf(editorFont.getSize()));
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
box = Box.createHorizontalBox();
@ -778,7 +756,6 @@ public class Preferences {
PreferencesData.set("sketchbook.path", newPath);
}
PreferencesData.set("editor.syntax_theme", comboSyntaxThemes.getSelectedItem().toString());
PreferencesData.setBoolean("editor.external", externalEditorBox.isSelected());
PreferencesData.setBoolean("update.check", checkUpdatesBox.isSelected());
PreferencesData.setBoolean("editor.save_on_verify", saveVerifyUploadBox.isSelected());

View File

@ -75,13 +75,14 @@ public class SketchTextArea extends RSyntaxTextArea {
private EditorListener editorListener;
public SketchTextArea() {
public SketchTextArea() throws IOException {
super();
installFeatures();
}
protected void installFeatures(){
protected void installFeatures() throws IOException {
setTheme(PreferencesData.get("editor.syntax_theme", "default"));
setLinkGenerator(new DocLinkGenerator());
@ -89,26 +90,20 @@ public class SketchTextArea extends RSyntaxTextArea {
fixControlTab();
installTokenMaker();
}
public void setTheme(String name){
public void setTheme(String name) throws IOException {
FileInputStream defaultXmlInputStream = null;
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.apply(this);
} catch (IOException e) {
e.printStackTrace();
} finally {
if (defaultXmlInputStream != null) {
try {
defaultXmlInputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
defaultXmlInputStream.close();
}
}
}
// Removing the default focus traversal keys
// This is because the DefaultKeyboardFocusManager handles the keypress and consumes the event
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
#editor.window.height.min.windows = 530
# Syntax coloring ( on lib/theme/syntax )
editor.syntax_theme=default
# Enable code folding
editor.code_folding=true