mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-23 19:21:59 +03:00
Removing unused preferences. Fixing upload when not deleting applet/ directory. Treating examples in the sketchbook/libraries folder as read-only.
This commit is contained in:
@ -1446,6 +1446,11 @@ public class Base {
|
||||
static public File getSketchbookLibrariesFolder() {
|
||||
return new File(getSketchbookFolder(), "libraries");
|
||||
}
|
||||
|
||||
|
||||
static public String getSketchbookLibrariesPath() {
|
||||
return getSketchbookLibrariesFolder().getAbsolutePath();
|
||||
}
|
||||
|
||||
|
||||
protected File getDefaultSketchbookFolder() {
|
||||
|
@ -158,7 +158,7 @@ public class Preferences {
|
||||
load(Base.getLibStream("preferences.txt"));
|
||||
} catch (Exception e) {
|
||||
Base.showError(null, "Could not read default settings.\n" +
|
||||
"You'll need to reinstall Processing.", e);
|
||||
"You'll need to reinstall Arduino.", e);
|
||||
}
|
||||
|
||||
// check for platform-specific properties in the defaults
|
||||
@ -210,7 +210,7 @@ public class Preferences {
|
||||
"Error reading the preferences file. " +
|
||||
"Please delete (or move)\n" +
|
||||
preferencesFile.getAbsolutePath() +
|
||||
" and restart Processing.", ex);
|
||||
" and restart Arduino.", ex);
|
||||
}
|
||||
}
|
||||
|
||||
@ -364,7 +364,7 @@ public class Preferences {
|
||||
box.add(label);
|
||||
fontSizeField = new JTextField(4);
|
||||
box.add(fontSizeField);
|
||||
label = new JLabel(" (requires restart of Processing)");
|
||||
label = new JLabel(" (requires restart of Arduino)");
|
||||
box.add(label);
|
||||
pain.add(box);
|
||||
d = box.getPreferredSize();
|
||||
@ -374,33 +374,6 @@ public class Preferences {
|
||||
top += d.height + GUI_BETWEEN;
|
||||
|
||||
|
||||
// [ ] Increase maximum available memory to [______] MB
|
||||
|
||||
Container memoryBox = Box.createHorizontalBox();
|
||||
memoryOverrideBox = new JCheckBox("Increase maximum available memory to ");
|
||||
memoryBox.add(memoryOverrideBox);
|
||||
memoryField = new JTextField(4);
|
||||
memoryBox.add(memoryField);
|
||||
memoryBox.add(new JLabel(" MB"));
|
||||
pain.add(memoryBox);
|
||||
d = memoryBox.getPreferredSize();
|
||||
memoryBox.setBounds(left, top, d.width, d.height);
|
||||
top += d.height + GUI_BETWEEN;
|
||||
|
||||
|
||||
// [ ] Use multiple .jar files when exporting applets
|
||||
|
||||
exportSeparateBox =
|
||||
new JCheckBox("Use multiple .jar files when exporting applets " +
|
||||
"(ignored when using libraries)");
|
||||
pain.add(exportSeparateBox);
|
||||
d = exportSeparateBox.getPreferredSize();
|
||||
// adding +10 because ubuntu + jre 1.5 truncating items
|
||||
exportSeparateBox.setBounds(left, top, d.width + 10, d.height);
|
||||
right = Math.max(right, left + d.width);
|
||||
top += d.height + GUI_BETWEEN;
|
||||
|
||||
|
||||
// [ ] Delete previous applet or application folder on export
|
||||
|
||||
deletePreviousBox =
|
||||
@ -436,7 +409,7 @@ public class Preferences {
|
||||
|
||||
if (Base.isWindows()) {
|
||||
autoAssociateBox =
|
||||
new JCheckBox("Automatically associate .pde files with Processing");
|
||||
new JCheckBox("Automatically associate .pde files with Arduino");
|
||||
pain.add(autoAssociateBox);
|
||||
d = autoAssociateBox.getPreferredSize();
|
||||
autoAssociateBox.setBounds(left, top, d.width + 10, d.height);
|
||||
@ -478,7 +451,7 @@ public class Preferences {
|
||||
right = Math.max(right, left + d.width);
|
||||
top += d.height;
|
||||
|
||||
label = new JLabel("(edit only when Processing is not running)");
|
||||
label = new JLabel("(edit only when Arduino is not running)");
|
||||
pain.add(label);
|
||||
d = label.getPreferredSize();
|
||||
label.setForeground(Color.gray);
|
||||
@ -606,8 +579,6 @@ public class Preferences {
|
||||
*/
|
||||
protected void applyFrame() {
|
||||
// put each of the settings into the table
|
||||
setBoolean("export.applet.separate_jar_files",
|
||||
exportSeparateBox.isSelected());
|
||||
setBoolean("export.delete_target_folder",
|
||||
deletePreviousBox.isSelected());
|
||||
|
||||
@ -627,18 +598,6 @@ public class Preferences {
|
||||
setBoolean("editor.external", externalEditorBox.isSelected());
|
||||
setBoolean("update.check", checkUpdatesBox.isSelected());
|
||||
|
||||
setBoolean("run.options.memory", memoryOverrideBox.isSelected());
|
||||
int memoryMin = Preferences.getInteger("run.options.memory.initial");
|
||||
int memoryMax = Preferences.getInteger("run.options.memory.maximum");
|
||||
try {
|
||||
memoryMax = Integer.parseInt(memoryField.getText().trim());
|
||||
// make sure memory setting isn't too small
|
||||
if (memoryMax < memoryMin) memoryMax = memoryMin;
|
||||
setInteger("run.options.memory.maximum", memoryMax);
|
||||
} catch (NumberFormatException e) {
|
||||
System.err.println("Ignoring bad memory setting");
|
||||
}
|
||||
|
||||
/*
|
||||
// was gonna use this to check memory settings,
|
||||
// but it quickly gets much too messy
|
||||
@ -680,8 +639,6 @@ public class Preferences {
|
||||
this.editor = editor;
|
||||
|
||||
// set all settings entry boxes to their actual status
|
||||
exportSeparateBox.
|
||||
setSelected(getBoolean("export.applet.separate_jar_files"));
|
||||
deletePreviousBox.
|
||||
setSelected(getBoolean("export.delete_target_folder"));
|
||||
|
||||
@ -698,10 +655,6 @@ public class Preferences {
|
||||
setSelected(getBoolean("editor.external"));
|
||||
checkUpdatesBox.
|
||||
setSelected(getBoolean("update.check"));
|
||||
memoryOverrideBox.
|
||||
setSelected(getBoolean("run.options.memory"));
|
||||
memoryField.
|
||||
setText(get("run.options.memory.maximum"));
|
||||
|
||||
if (autoAssociateBox != null) {
|
||||
autoAssociateBox.
|
||||
|
@ -1723,7 +1723,8 @@ public class Sketch {
|
||||
public boolean isReadOnly() {
|
||||
String apath = folder.getAbsolutePath();
|
||||
if (apath.startsWith(Base.getExamplesPath()) ||
|
||||
apath.startsWith(Base.getLibrariesPath())) {
|
||||
apath.startsWith(Base.getLibrariesPath()) ||
|
||||
apath.startsWith(Base.getSketchbookLibrariesPath())) {
|
||||
return true;
|
||||
|
||||
// canWrite() doesn't work on directories
|
||||
|
@ -482,6 +482,7 @@ public class Compiler implements MessageConsumer {
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static private void createFolder(File folder) throws RunnerException {
|
||||
if (folder.isDirectory()) return;
|
||||
if (!folder.mkdir())
|
||||
throw new RunnerException("Couldn't create: " + folder);
|
||||
}
|
||||
|
Reference in New Issue
Block a user