removing cross-platform export

This commit is contained in:
Ben Fry
2013-10-20 09:54:03 -04:00
parent 093bc6cde6
commit a8ff4db245
3 changed files with 43 additions and 66 deletions

View File

@@ -1090,6 +1090,7 @@ public class JavaBuild {
return false;
}
/*
File folder = null;
for (String platformName : PConstants.platformNames) {
int platform = Base.getPlatformIndex(platformName);
@@ -1113,17 +1114,31 @@ public class JavaBuild {
}
}
}
*/
File folder = null;
String platformName = Base.getPlatformName();
if (Library.hasMultipleArch(PApplet.platform, importedLibraries)) {
// export the 32-bit version
folder = new File(sketch.getFolder(), "application." + platformName + "32");
if (!exportApplication(folder, PApplet.platform, 32)) {
return false;
}
// export the 64-bit version
folder = new File(sketch.getFolder(), "application." + platformName + "64");
if (!exportApplication(folder, PApplet.platform, 64)) {
return false;
}
} else { // just make a single one for this platform
folder = new File(sketch.getFolder(), "application." + platformName);
if (!exportApplication(folder, PApplet.platform, 0)) {
return false;
}
}
return true; // all good
}
// public boolean exportApplication(String destPath,
// String platformName,
// int exportBits) throws IOException, RunnerException {
// return exportApplication(destPath, Base.getPlatformIndex(platformName), exportBits);
// }
/**
* Export to application without GUI. Also called by the Commander.
*/

View File

@@ -257,27 +257,19 @@ public class JavaEditor extends Editor {
panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
panel.add(Box.createVerticalStrut(6));
//Box panel = Box.createVerticalBox();
//Box labelBox = Box.createHorizontalBox();
// String msg = "<html>Click Export to Application to create a standalone, " +
// "double-clickable application for the selected plaforms.";
// String msg = "Export to Application creates a standalone, \n" +
// "double-clickable application for the selected plaforms.";
String line1 = "Export to Application creates double-clickable,";
String line2 = "standalone applications for the selected plaforms.";
//String line2 = "standalone applications for the selected plaforms.";
String line2 = "standalone application for the current plaform.";
JLabel label1 = new JLabel(line1, SwingConstants.CENTER);
JLabel label2 = new JLabel(line2, SwingConstants.CENTER);
label1.setAlignmentX(Component.LEFT_ALIGNMENT);
label2.setAlignmentX(Component.LEFT_ALIGNMENT);
// label1.setAlignmentX();
// label2.setAlignmentX(0);
panel.add(label1);
panel.add(label2);
int wide = label2.getPreferredSize().width;
int wide = label1.getPreferredSize().width;
panel.add(Box.createVerticalStrut(12));
/*
final JCheckBox windowsButton = new JCheckBox("Windows");
//windowsButton.setMnemonic(KeyEvent.VK_W);
windowsButton.setSelected(Preferences.getBoolean("export.application.platform.windows"));
@@ -318,11 +310,9 @@ public class JavaEditor extends Editor {
wide = Math.max(wide, platformPanel.getPreferredSize().width);
platformPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
panel.add(platformPanel);
*/
// Box indentPanel = Box.createHorizontalBox();
// indentPanel.add(Box.createHorizontalStrut(new JCheckBox().getPreferredSize().width));
final JCheckBox showStopButton = new JCheckBox("Show a Stop button");
//showStopButton.setMnemonic(KeyEvent.VK_S);
showStopButton.setSelected(Preferences.getBoolean("export.application.stop"));
showStopButton.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
@@ -331,11 +321,8 @@ public class JavaEditor extends Editor {
});
showStopButton.setEnabled(Preferences.getBoolean("export.application.fullscreen"));
showStopButton.setBorder(new EmptyBorder(3, 13, 6, 13));
// indentPanel.add(showStopButton);
// indentPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
final JCheckBox fullScreenButton = new JCheckBox("Full Screen (Present mode)");
//fullscreenButton.setMnemonic(KeyEvent.VK_F);
fullScreenButton.setSelected(Preferences.getBoolean("export.application.fullscreen"));
fullScreenButton.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
@@ -350,12 +337,9 @@ public class JavaEditor extends Editor {
optionPanel.setLayout(new BoxLayout(optionPanel, BoxLayout.Y_AXIS));
optionPanel.add(fullScreenButton);
optionPanel.add(showStopButton);
// optionPanel.add(indentPanel);
optionPanel.setBorder(new TitledBorder("Options"));
wide = Math.max(wide, platformPanel.getPreferredSize().width);
//goodIdea = new Dimension(wide, optionPanel.getPreferredSize().height);
// wide = Math.max(wide, platformPanel.getPreferredSize().width);
optionPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
//optionPanel.setMaximumSize(goodIdea);
panel.add(optionPanel);
Dimension good;
@@ -364,43 +348,20 @@ public class JavaEditor extends Editor {
label1.setMaximumSize(good);
good = new Dimension(wide, label2.getPreferredSize().height);
label2.setMaximumSize(good);
good = new Dimension(wide, platformPanel.getPreferredSize().height);
platformPanel.setMaximumSize(good);
// good = new Dimension(wide, platformPanel.getPreferredSize().height);
// platformPanel.setMaximumSize(good);
good = new Dimension(wide, optionPanel.getPreferredSize().height);
optionPanel.setMaximumSize(good);
// JPanel actionPanel = new JPanel();
// optionPanel.setLayout(new BoxLayout(optionPanel, BoxLayout.X_AXIS));
// optionPanel.add(Box.createHorizontalGlue());
// final JDialog frame = new JDialog(editor, "Export to Application");
// JButton cancelButton = new JButton("Cancel");
// cancelButton.addActionListener(new ActionListener() {
// public void actionPerformed(ActionEvent e) {
// frame.dispose();
// return false;
// }
// });
// Add the buttons in platform-specific order
// if (PApplet.platform == PConstants.MACOSX) {
// optionPanel.add(cancelButton);
// optionPanel.add(exportButton);
// } else {
// optionPanel.add(exportButton);
// optionPanel.add(cancelButton);
// }
String[] options = { "Export", "Cancel" };
final JOptionPane optionPane = new JOptionPane(panel,
JOptionPane.PLAIN_MESSAGE,
//JOptionPane.QUESTION_MESSAGE,
JOptionPane.YES_NO_OPTION,
null,
options,
options[0]);
final JDialog dialog = new JDialog(this, "Export Options", true);
final JDialog dialog = new JDialog(this, "Export Application", true);
dialog.setContentPane(optionPane);
optionPane.addPropertyChangeListener(new PropertyChangeListener() {
@@ -410,9 +371,8 @@ public class JavaEditor extends Editor {
if (dialog.isVisible() &&
(e.getSource() == optionPane) &&
(prop.equals(JOptionPane.VALUE_PROPERTY))) {
//If you were going to check something
//before closing the window, you'd do
//it here.
// If you were going to check something before
// closing the window, you'd do it here.
dialog.setVisible(false);
}
}