mirror of
https://github.com/arduino/Arduino.git
synced 2025-02-21 15:54:39 +01:00
MacOSX: better IDE
This commit is contained in:
parent
4380e2930e
commit
e327bb091a
Binary file not shown.
@ -22,23 +22,11 @@
|
|||||||
|
|
||||||
package processing.app;
|
package processing.app;
|
||||||
|
|
||||||
import java.awt.*;
|
|
||||||
import java.awt.event.*;
|
|
||||||
import java.io.*;
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
|
||||||
|
|
||||||
import cc.arduino.packages.DiscoveryManager;
|
import cc.arduino.packages.DiscoveryManager;
|
||||||
import processing.app.debug.TargetBoard;
|
import processing.app.debug.TargetBoard;
|
||||||
import processing.app.debug.TargetPackage;
|
import processing.app.debug.TargetPackage;
|
||||||
import processing.app.debug.TargetPlatform;
|
import processing.app.debug.TargetPlatform;
|
||||||
import processing.app.helpers.CommandlineParser;
|
import processing.app.helpers.*;
|
||||||
import processing.app.helpers.FileUtils;
|
|
||||||
import processing.app.helpers.GUIUserNotifier;
|
|
||||||
import processing.app.helpers.OSUtils;
|
|
||||||
import processing.app.helpers.PreferencesMap;
|
|
||||||
import processing.app.helpers.filefilters.OnlyDirs;
|
import processing.app.helpers.filefilters.OnlyDirs;
|
||||||
import processing.app.helpers.filefilters.OnlyFilesWithExtension;
|
import processing.app.helpers.filefilters.OnlyFilesWithExtension;
|
||||||
import processing.app.javax.swing.filechooser.FileNameExtensionFilter;
|
import processing.app.javax.swing.filechooser.FileNameExtensionFilter;
|
||||||
@ -48,6 +36,14 @@ import processing.app.packages.Library;
|
|||||||
import processing.app.packages.LibraryList;
|
import processing.app.packages.LibraryList;
|
||||||
import processing.app.tools.MenuScroller;
|
import processing.app.tools.MenuScroller;
|
||||||
import processing.app.tools.ZipDeflater;
|
import processing.app.tools.ZipDeflater;
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
|
import java.awt.*;
|
||||||
|
import java.awt.event.*;
|
||||||
|
import java.io.*;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import static processing.app.I18n._;
|
import static processing.app.I18n._;
|
||||||
|
|
||||||
|
|
||||||
@ -660,21 +656,30 @@ public class Base {
|
|||||||
*/
|
*/
|
||||||
public void handleOpenPrompt() throws Exception {
|
public void handleOpenPrompt() throws Exception {
|
||||||
// get the frontmost window frame for placing file dialog
|
// get the frontmost window frame for placing file dialog
|
||||||
JFileChooser fd = new JFileChooser(Preferences.get("last.folder", getSketchbookFolder().getAbsolutePath()));
|
FileDialog fd = new FileDialog(activeEditor, _("Open an Arduino sketch..."), FileDialog.LOAD);
|
||||||
fd.setDialogTitle(_("Open an Arduino sketch..."));
|
File lastFolder = new File(Preferences.get("last.folder", getSketchbookFolder().getAbsolutePath()));
|
||||||
fd.setFileSelectionMode(JFileChooser.FILES_ONLY);
|
if (lastFolder.exists() && lastFolder.isFile()) {
|
||||||
fd.setFileFilter(new FileNameExtensionFilter(_("Sketches (*.ino, *.pde)"), "ino", "pde"));
|
lastFolder = lastFolder.getParentFile();
|
||||||
|
|
||||||
Dimension preferredSize = fd.getPreferredSize();
|
|
||||||
fd.setPreferredSize(new Dimension(preferredSize.width + 200, preferredSize.height + 200));
|
|
||||||
|
|
||||||
int returnVal = fd.showOpenDialog(activeEditor);
|
|
||||||
|
|
||||||
if (returnVal != JFileChooser.APPROVE_OPTION) {
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
fd.setDirectory(lastFolder.getAbsolutePath());
|
||||||
|
|
||||||
File inputFile = fd.getSelectedFile();
|
// Only show .pde files as eligible bachelors
|
||||||
|
fd.setFilenameFilter(new FilenameFilter() {
|
||||||
|
public boolean accept(File dir, String name) {
|
||||||
|
return name.toLowerCase().endsWith(".ino")
|
||||||
|
|| name.toLowerCase().endsWith(".pde");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
fd.setVisible(true);
|
||||||
|
|
||||||
|
String directory = fd.getDirectory();
|
||||||
|
String filename = fd.getFile();
|
||||||
|
|
||||||
|
// User canceled selection
|
||||||
|
if (filename == null) return;
|
||||||
|
|
||||||
|
File inputFile = new File(directory, filename);
|
||||||
|
|
||||||
Preferences.set("last.folder", inputFile.getAbsolutePath());
|
Preferences.set("last.folder", inputFile.getAbsolutePath());
|
||||||
handleOpen(inputFile);
|
handleOpen(inputFile);
|
||||||
|
@ -31,12 +31,17 @@ import processing.app.forms.PasswordAuthorizationDialog;
|
|||||||
import processing.app.helpers.OSUtils;
|
import processing.app.helpers.OSUtils;
|
||||||
import processing.app.helpers.PreferencesMapException;
|
import processing.app.helpers.PreferencesMapException;
|
||||||
import processing.app.packages.Library;
|
import processing.app.packages.Library;
|
||||||
import static processing.app.I18n._;
|
|
||||||
|
|
||||||
import java.io.*;
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
import java.awt.*;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FilenameFilter;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static processing.app.I18n._;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -632,29 +637,30 @@ public class Sketch {
|
|||||||
* because they can cause trouble.
|
* because they can cause trouble.
|
||||||
*/
|
*/
|
||||||
protected boolean saveAs() throws IOException {
|
protected boolean saveAs() throws IOException {
|
||||||
JFileChooser fd = new JFileChooser();
|
String newParentDir = null;
|
||||||
fd.setDialogTitle(_("Save sketch folder as..."));
|
String newName = null;
|
||||||
fd.setDialogType(JFileChooser.SAVE_DIALOG);
|
|
||||||
|
|
||||||
|
// get new name for folder
|
||||||
|
FileDialog fd = new FileDialog(editor, _("Save sketch folder as..."), FileDialog.SAVE);
|
||||||
if (isReadOnly() || isUntitled()) {
|
if (isReadOnly() || isUntitled()) {
|
||||||
// default to the sketchbook folder
|
// default to the sketchbook folder
|
||||||
fd.setSelectedFile(new File(Base.getSketchbookFolder().getAbsolutePath(), data.getFolder().getName()));
|
fd.setDirectory(Base.getSketchbookFolder().getAbsolutePath());
|
||||||
} else {
|
} else {
|
||||||
// default to the parent folder of where this was
|
// default to the parent folder of where this was
|
||||||
fd.setSelectedFile(data.getFolder());
|
fd.setDirectory(data.getFolder().getParentFile().getAbsolutePath());
|
||||||
}
|
}
|
||||||
|
String oldName = data.getName();
|
||||||
|
fd.setFile(oldName);
|
||||||
|
|
||||||
int returnVal = fd.showSaveDialog(editor);
|
fd.setVisible(true);
|
||||||
|
newParentDir = fd.getDirectory();
|
||||||
|
newName = fd.getFile();
|
||||||
|
|
||||||
if (returnVal != JFileChooser.APPROVE_OPTION) {
|
// user canceled selection
|
||||||
return false;
|
if (newName == null) return false;
|
||||||
}
|
newName = Sketch.checkName(newName);
|
||||||
|
|
||||||
File selectedFile = fd.getSelectedFile();
|
File newFolder = new File(newParentDir, newName);
|
||||||
|
|
||||||
String newName = Sketch.checkName(selectedFile.getName());
|
|
||||||
|
|
||||||
File newFolder = new File(selectedFile.getParentFile(), newName);
|
|
||||||
|
|
||||||
// make sure there doesn't exist a .cpp file with that name already
|
// make sure there doesn't exist a .cpp file with that name already
|
||||||
// but ignore this situation for the first tab, since it's probably being
|
// but ignore this situation for the first tab, since it's probably being
|
||||||
@ -778,20 +784,16 @@ public class Sketch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// get a dialog, select a file to add to the sketch
|
// get a dialog, select a file to add to the sketch
|
||||||
String prompt =
|
FileDialog fd = new FileDialog(editor, _("Select an image or other data file to copy to your sketch"), FileDialog.LOAD);
|
||||||
_("Select an image or other data file to copy to your sketch");
|
fd.setVisible(true);
|
||||||
JFileChooser fd = new JFileChooser(Preferences.get("last.folder"));
|
|
||||||
fd.setDialogTitle(prompt);
|
|
||||||
|
|
||||||
int returnVal = fd.showOpenDialog(editor);
|
String directory = fd.getDirectory();
|
||||||
|
String filename = fd.getFile();
|
||||||
if (returnVal != JFileChooser.APPROVE_OPTION) {
|
if (filename == null) return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// copy the file into the folder. if people would rather
|
// copy the file into the folder. if people would rather
|
||||||
// it move instead of copy, they can do it by hand
|
// it move instead of copy, they can do it by hand
|
||||||
File sourceFile = fd.getSelectedFile();
|
File sourceFile = new File(directory, filename);
|
||||||
|
|
||||||
// now do the work of adding the file
|
// now do the work of adding the file
|
||||||
boolean result = addFile(sourceFile);
|
boolean result = addFile(sourceFile);
|
||||||
|
@ -23,17 +23,22 @@
|
|||||||
|
|
||||||
package processing.app.tools;
|
package processing.app.tools;
|
||||||
|
|
||||||
import processing.app.*;
|
import processing.app.Base;
|
||||||
|
import processing.app.Editor;
|
||||||
|
import processing.app.Sketch;
|
||||||
|
|
||||||
import javax.swing.*;
|
import java.awt.*;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.text.NumberFormat;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.zip.ZipEntry;
|
||||||
|
import java.util.zip.ZipOutputStream;
|
||||||
|
|
||||||
import static processing.app.I18n._;
|
import static processing.app.I18n._;
|
||||||
|
|
||||||
import java.io.*;
|
|
||||||
import java.text.*;
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.zip.*;
|
|
||||||
|
|
||||||
|
|
||||||
public class Archiver implements Tool {
|
public class Archiver implements Tool {
|
||||||
Editor editor;
|
Editor editor;
|
||||||
@ -107,19 +112,17 @@ public class Archiver implements Tool {
|
|||||||
} while (newbie.exists());
|
} while (newbie.exists());
|
||||||
|
|
||||||
// open up a prompt for where to save this fella
|
// open up a prompt for where to save this fella
|
||||||
JFileChooser fd = new JFileChooser();
|
FileDialog fd = new FileDialog(editor, _("Archive sketch as:"), FileDialog.SAVE);
|
||||||
fd.setDialogTitle(_("Archive sketch as:"));
|
fd.setDirectory(parent.getAbsolutePath());
|
||||||
fd.setDialogType(JFileChooser.SAVE_DIALOG);
|
fd.setFile(newbie.getName());
|
||||||
fd.setSelectedFile(newbie);
|
fd.setVisible(true);
|
||||||
|
|
||||||
int returnVal = fd.showSaveDialog(editor);
|
String directory = fd.getDirectory();
|
||||||
|
String filename = fd.getFile();
|
||||||
|
|
||||||
if (returnVal != JFileChooser.APPROVE_OPTION) {
|
// only write the file if not canceled
|
||||||
editor.statusNotice(_("Archive sketch canceled."));
|
if (filename != null) {
|
||||||
return;
|
newbie = new File(directory, filename);
|
||||||
}
|
|
||||||
|
|
||||||
newbie = fd.getSelectedFile();
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
//System.out.println(newbie);
|
//System.out.println(newbie);
|
||||||
@ -138,6 +141,9 @@ public class Archiver implements Tool {
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
editor.statusNotice(_("Archive sketch canceled."));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Binary file not shown.
@ -248,8 +248,8 @@
|
|||||||
|
|
||||||
<target name="macosx-java-latest-build" if="macosx" depends="revision-check, macosx-checkos, subprojects-build" description="Build Mac OS X version">
|
<target name="macosx-java-latest-build" if="macosx" depends="revision-check, macosx-checkos, subprojects-build" description="Build Mac OS X version">
|
||||||
<antcall target="unzip">
|
<antcall target="unzip">
|
||||||
<param name="archive_file" value="${staging_folder}/appbundler-1.0ea.jar.zip" />
|
<param name="archive_file" value="${staging_folder}/appbundler-1.0ea-arduino.jar.zip" />
|
||||||
<param name="archive_url" value="http://arduino.cc/download.php?f=/appbundler-1.0ea.jar.zip" />
|
<param name="archive_url" value="http://arduino.cc/download.php?f=/appbundler-1.0ea-arduino.jar.zip" />
|
||||||
<param name="final_folder" value="${staging_folder}/appbundler" />
|
<param name="final_folder" value="${staging_folder}/appbundler" />
|
||||||
<param name="dest_folder" value="${staging_folder}/appbundler" />
|
<param name="dest_folder" value="${staging_folder}/appbundler" />
|
||||||
</antcall>
|
</antcall>
|
||||||
@ -277,7 +277,6 @@
|
|||||||
<arch name="i386"/>
|
<arch name="i386"/>
|
||||||
|
|
||||||
<classpath refid="runtime.jars"/>
|
<classpath refid="runtime.jars"/>
|
||||||
<classpath file="./macosx/template.app/Contents/Resources/Java/quaqua.jar"/>
|
|
||||||
|
|
||||||
<option value="-Dapple.awt.application.name=Arduino" />
|
<option value="-Dapple.awt.application.name=Arduino" />
|
||||||
<option value="-Dapple.laf.useScreenMenuBar=true"/>
|
<option value="-Dapple.laf.useScreenMenuBar=true"/>
|
||||||
@ -314,8 +313,6 @@
|
|||||||
<copy todir="${staging_folder}/work/${staging_hardware_folder}/../">
|
<copy todir="${staging_folder}/work/${staging_hardware_folder}/../">
|
||||||
<fileset dir="shared" includes="lib/**" />
|
<fileset dir="shared" includes="lib/**" />
|
||||||
<fileset file="shared/revisions.txt" />
|
<fileset file="shared/revisions.txt" />
|
||||||
<file file="macosx/template.app/Contents/Resources/Java/quaqua.jar"/>
|
|
||||||
<fileset file="macosx/template.app/Contents/Resources/Java/libquaqua*" />
|
|
||||||
</copy>
|
</copy>
|
||||||
|
|
||||||
<antcall target="macosx-build-common"/>
|
<antcall target="macosx-build-common"/>
|
||||||
|
1
build/macosx/appbundler-1.0ea-arduino.jar.zip.sha
Normal file
1
build/macosx/appbundler-1.0ea-arduino.jar.zip.sha
Normal file
@ -0,0 +1 @@
|
|||||||
|
20da27cce14b7c60d6ef2e2cac2f60df491c8e21
|
@ -1 +0,0 @@
|
|||||||
28b3ccde1631791575a11f73e5fd0097df566fe2
|
|
@ -17,6 +17,7 @@ ARDUINO 1.6.1
|
|||||||
* Fixed: status board was not changing when using custom menu @PaulStoffregen
|
* Fixed: status board was not changing when using custom menu @PaulStoffregen
|
||||||
* Fixed: better error message when using a busy serial device
|
* Fixed: better error message when using a busy serial device
|
||||||
* Fixed: missing bool operator on EthernetClient
|
* Fixed: missing bool operator on EthernetClient
|
||||||
|
* MacOSX: back to native file dialogs and buttons, when using experimental version
|
||||||
|
|
||||||
ARDUINO 1.6.0 - 2015.02.09
|
ARDUINO 1.6.0 - 2015.02.09
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user