Skip to content

Commit

Permalink
Issue #603 made changes for ino vs pde.
Browse files Browse the repository at this point in the history
  • Loading branch information
ricklon committed Sep 3, 2015
1 parent 012aa70 commit a3c0995
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 56 deletions.
10 changes: 5 additions & 5 deletions app/src/processing/app/Base.java
Original file line number Diff line number Diff line change
Expand Up @@ -548,8 +548,8 @@ protected String createNewUntitled() throws IOException {
// Make the directory for the new sketch
newbieDir.mkdirs();

// Make an empty pde file
File newbieFile = new File(newbieDir, newbieName + ".pde");
// Make an empty ino file
File newbieFile = new File(newbieDir, newbieName + ".ino");
new FileOutputStream(newbieFile); // create the file
return newbieFile.getAbsolutePath();
}
Expand Down Expand Up @@ -1185,11 +1185,11 @@ public void actionPerformed(ActionEvent e) {
if (!subfolder.isDirectory()) continue;

File entry = new File(subfolder, list[i] + ".ino");
if (!entry.exists() && (new File(subfolder, list[i] + ".pde")).exists()) {
entry = new File(subfolder, list[i] + ".pde");
if (!entry.exists() && (new File(subfolder, list[i] + ".ino")).exists()) {
entry = new File(subfolder, list[i] + ".ino");
}

// if a .pde file of the same prefix as the folder exists..
// if a .ino file of the same prefix as the folder exists..
if (entry.exists()) {
//String sanityCheck = sanitizedName(list[i]);
//if (!sanityCheck.equals(list[i])) {
Expand Down
26 changes: 13 additions & 13 deletions app/src/processing/app/Preferences.java
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ static protected void init(String commandLinePrefs) {
" and restart MPIDE.", ex);
}
}
}
}
}


Expand Down Expand Up @@ -310,11 +310,11 @@ public void actionPerformed(ActionEvent e) {
top += d.height + GUI_BETWEEN;


// [ ] Automatically associate .pde files with Processing
// [ ] Automatically associate .ino files with Processing

if (Base.isWindows()) {
autoAssociateBox =
new JCheckBox("Automatically associate .pde files with MPIDE");
new JCheckBox("Automatically associate .ino files with MPIDE");
pain.add(autoAssociateBox);
d = autoAssociateBox.getPreferredSize();
autoAssociateBox.setBounds(left, top, d.width + 10, d.height);
Expand All @@ -339,7 +339,7 @@ public void actionPerformed(ActionEvent e) {
public void mousePressed(MouseEvent e) {
Base.openFolder(Base.getSettingsFolder());
}

public void mouseEntered(MouseEvent e) {
clickable.setForeground(new Color(0, 0, 140));
}
Expand Down Expand Up @@ -548,8 +548,8 @@ protected void showFrame(Editor editor) {
static protected void load(InputStream input) throws IOException {
load(input, table);
}
static public void load(InputStream input, Map table) throws IOException {

static public void load(InputStream input, Map table) throws IOException {
String[] lines = PApplet.loadStrings(input); // Reads as UTF-8
for (String line : lines) {
if ((line.length() == 0) ||
Expand Down Expand Up @@ -602,7 +602,7 @@ static protected void save() {
//static public String get(String attribute) {
//return get(attribute, null);
//}

static public String get(String attribute /*, String defaultValue */) {
return (String) table.get(attribute);
/*
Expand Down Expand Up @@ -735,7 +735,7 @@ static public Font getFont(String attr) {
return font;
}


// ROA: current getStyle: from Arduino 1.0
static public SyntaxStyle getStyle(String what /*, String dflt*/) {
String str = get("editor." + what + ".style"); //, dflt);
Expand All @@ -760,20 +760,20 @@ static public SyntaxStyle getStyle(String what /*, String dflt*/) {


//get a Map of the Preferences
static public Map<String, String> getMap()
static public Map<String, String> getMap()
{
Map globalpreferences = new LinkedHashMap();
Enumeration e = table.keys();

while (e.hasMoreElements())
while (e.hasMoreElements())
{
String key = (String) e.nextElement();
//System.out.println("Key: " + key + "Val: " + table.get(key));
String value = (String) table.get(key);
globalpreferences.put(key, value );
globalpreferences.put(key, value );
}

return globalpreferences;
return globalpreferences;
}

}
64 changes: 32 additions & 32 deletions app/src/processing/app/Sketch.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@
* Stores information about files in the current sketch
*/
public class Sketch {

static Logger logger = Logger.getLogger(Base.class.getName());

static private File tempBuildFolder;

private Editor editor;
Expand Down Expand Up @@ -105,7 +105,7 @@ public class Sketch {
*/
private String libraryPath;
/**
* List of library folders.
* List of library folders.
*/
private ArrayList<File> importedLibraries;

Expand Down Expand Up @@ -410,16 +410,16 @@ protected void nameCode(String newName) {
return;
}
}

// In Arduino, don't allow a .cpp file with the same name as the sketch,
// because the sketch is concatenated into a file with that name as part
// of the build process.
// of the build process.
if (newName.equals(getName() + ".cpp")) {
Base.showMessage("Nope",
"You can't have a .cpp file with the same name as the sketch.");
return;
}

if (renamingCode && currentIndex == 0) {
for (int i = 1; i < codeCount; i++) {
if (sanitaryName.equalsIgnoreCase(code[i].getPrettyName()) &&
Expand Down Expand Up @@ -726,7 +726,7 @@ public boolean accept(File dir, String name) {
return name.toLowerCase().endsWith(".pde");
}
});

if (pdeFiles != null && pdeFiles.length > 0) {/*
if (Preferences.get("editor.update_extension") == null) {
Object[] options = { "OK", "Cancel" };
Expand All @@ -744,12 +744,12 @@ public boolean accept(File dir, String name) {
null,
options,
options[0]);
if (result != JOptionPane.OK_OPTION) return false; // save cancelled
Preferences.setBoolean("editor.update_extension", true);
}
if (Preferences.getBoolean("editor.update_extension")) {
// Do rename of all .pde files to new .ino extension
for (File pdeFile : pdeFiles)
Expand Down Expand Up @@ -922,7 +922,7 @@ protected boolean saveAs() throws IOException {
}

// save the main tab with its new name
File newFile = new File(newFolder, newName + ".pde");
File newFile = new File(newFolder, newName + ".ino");
code[0].saveAs(newFile);

editor.handleOpenUnchecked(newFile.getPath(),
Expand Down Expand Up @@ -1234,8 +1234,8 @@ protected void cleanup() {


/**
* When running from the editor, take care of preparations before running
* the build.
* When running from the editor, take care of preparations before running
* the build.
*/
public void prepare() {
// make sure the user didn't hide the sketch folder
Expand Down Expand Up @@ -1323,7 +1323,7 @@ public String preprocess(String buildPath, PdePreprocessor preprocessor) throws
StringBuffer bigCode = new StringBuffer();
int bigCount = 0;
for (SketchCode sc : code) {
if (sc.isExtension("ino") || sc.isExtension("pde")) {
if (sc.isExtension("ino") || sc.isExtension("pde")) {
sc.setPreprocOffset(bigCount);
bigCode.append(sc.getProgram());
bigCode.append('\n');
Expand Down Expand Up @@ -1395,7 +1395,7 @@ public String preprocess(String buildPath, PdePreprocessor preprocessor) throws
logger.debug("preprocessor.getExtraImports()" + preprocessor.getExtraImports());
logger.debug("Base.importToLibraryTable: " + Base.importToLibraryTable);
for (String item : preprocessor.getExtraImports()) {
//Debug print library filename
//Debug print library filename
logger.debug("Library filename item: " + item);
logger.debug("Base.importToLibraryTable.get(item): " + Base.importToLibraryTable.get(item));

Expand Down Expand Up @@ -1441,7 +1441,7 @@ public ArrayList<File> getImportedLibraries() {
return importedLibraries;
}


/**
* Map an error from a set of processed .java files back to its location
* in the actual sketch.
Expand All @@ -1451,7 +1451,7 @@ public ArrayList<File> getImportedLibraries() {
* @return A RunnerException to be sent to the editor, or null if it wasn't
* possible to place the exception to the sketch code.
*/
// public RunnerException placeExceptionAlt(String message,
// public RunnerException placeExceptionAlt(String message,
// String filename, int line) {
// String appletJavaFile = appletClassName + ".java";
// SketchCode errorCode = null;
Expand Down Expand Up @@ -1483,14 +1483,14 @@ public ArrayList<File> getImportedLibraries() {
// line--;
//
// // getMessage() will be what's shown in the editor
// RunnerException exception =
// RunnerException exception =
// new RunnerException(message, codeIndex, line, -1);
// exception.hideStackTrace();
// return exception;
// }
// return null;
// }


/**
* Map an error from a set of processed .java files back to its location
Expand All @@ -1501,8 +1501,8 @@ public ArrayList<File> getImportedLibraries() {
* @return A RunnerException to be sent to the editor, or null if it wasn't
* possible to place the exception to the sketch code.
*/
public RunnerException placeException(String message,
String dotJavaFilename,
public RunnerException placeException(String message,
String dotJavaFilename,
int dotJavaLine) {
int codeIndex = 0; //-1;
int codeLine = -1;
Expand Down Expand Up @@ -1545,7 +1545,7 @@ public RunnerException placeException(String message,
}
}
// could not find a proper line number, so deal with this differently.
// but if it was in fact the .java file we're looking for, though,
// but if it was in fact the .java file we're looking for, though,
// send the error message through.
// this is necessary because 'import' statements will be at a line
// that has a lower number than the preproc offset, for instance.
Expand Down Expand Up @@ -1577,7 +1577,7 @@ public String build(boolean verbose) throws RunnerException {
*/
public String build(String buildPath, boolean verbose)
throws RunnerException {

// run the preprocessor
editor.status.progressUpdate(20);
String primaryClassName = preprocess(buildPath);
Expand All @@ -1591,8 +1591,8 @@ public String build(String buildPath, boolean verbose)
}
return null;
}


protected boolean exportApplet(boolean verbose) throws Exception {
return exportApplet(tempBuildFolder.getAbsolutePath(), verbose);
}
Expand All @@ -1603,7 +1603,7 @@ protected boolean exportApplet(boolean verbose) throws Exception {
*/
public boolean exportApplet(String appletPath, boolean verbose)
throws RunnerException, IOException, SerialException {

// Make sure the user didn't hide the sketch folder
ensureExistence();

Expand Down Expand Up @@ -1639,7 +1639,7 @@ public boolean exportApplet(String appletPath, boolean verbose)
// }
editor.status.progressNotice("Uploading...");
upload(appletFolder.getPath(), foundName, verbose);
editor.status.progressUpdate(100);
editor.status.progressUpdate(100);
return true;
}

Expand All @@ -1659,7 +1659,7 @@ protected void size(String buildPath, String suggestedClassName)
try {
size = sizer.computeSize();
System.out.println("Binary sketch size: " + size + " bytes (of a " +
maxsize + " byte maximum)");
maxsize + " byte maximum)");
} catch (RunnerException e) {
System.err.println("Couldn't determine program size: " + e.getMessage());
}
Expand All @@ -1677,7 +1677,7 @@ protected String upload(String buildPath, String suggestedClassName, boolean ver

// download the program
//

uploader = new AvrdudeUploader();
boolean success = uploader.uploadUsingPreferences(buildPath,
suggestedClassName,
Expand Down Expand Up @@ -1742,9 +1742,9 @@ public boolean exportApplicationPrompt() throws IOException, RunnerException {
return false;
}


/**
* Export to application via GUI.
* Export to application via GUI.
*/
protected boolean exportApplication() throws IOException, RunnerException {
return false;
Expand Down Expand Up @@ -1870,7 +1870,7 @@ public boolean validExtension(String what) {
* Returns the default extension for this editor setup.
*/
public String getDefaultExtension() {
return "pde";
return "ino";
}

static private List<String> hiddenExtensions = Arrays.asList("ino", "pde");
Expand Down
12 changes: 6 additions & 6 deletions app/src/processing/app/windows/Platform.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public void init(Base base) {


/**
* Make sure that .pde files are associated with processing.exe.
* Make sure that .ino files are associated with processing.exe.
*/
protected void checkAssociations() {
try {
Expand All @@ -82,13 +82,13 @@ protected void checkAssociations() {


/**
* Associate .pde files with this version of Processing.
* Associate .ino files with this version of Processing.
*/
protected void setAssociations() throws UnsupportedEncodingException {
if (Registry.createKey(REGISTRY_ROOT_KEY.CLASSES_ROOT,
"", ".pde") &&
"", ".ino") &&
Registry.setStringValue(REGISTRY_ROOT_KEY.CLASSES_ROOT,
".pde", "", DOC) &&
".ino", "", DOC) &&

Registry.createKey(REGISTRY_ROOT_KEY.CLASSES_ROOT, "", DOC) &&
Registry.setStringValue(REGISTRY_ROOT_KEY.CLASSES_ROOT, DOC, "",
Expand Down Expand Up @@ -136,8 +136,8 @@ protected void checkQuickTime() {
e.printStackTrace();
}
}


/**
* Remove extra quotes, slashes, and garbage from the Windows PATH.
*/
Expand Down

0 comments on commit a3c0995

Please sign in to comment.