mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
finishing up with breaking the build
This commit is contained in:
@@ -1607,65 +1607,7 @@ public class PdeEditor extends JPanel {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PdePreferences.save();
|
||||
// write sketch.properties
|
||||
try {
|
||||
FileOutputStream output = null;
|
||||
|
||||
if (PdeBase.platform == PdeBase.MACOSX) {
|
||||
//String pkg = "Proce55ing.app/Contents/Resources/Java/";
|
||||
//output = new FileOutputStream(pkg + "sketch.properties");
|
||||
output = new FileOutputStream("lib/sketch.properties");
|
||||
|
||||
} else if (PdeBase.platform == PdeBase.MACOS9) {
|
||||
output = new FileOutputStream("lib/sketch.properties");
|
||||
|
||||
} else { // win95/98/ME doesn't set cwd properly
|
||||
URL url = getClass().getResource("buttons.gif");
|
||||
String urlstr = url.getFile();
|
||||
urlstr = urlstr.substring(0, urlstr.lastIndexOf("/") + 1) +
|
||||
"sketch.properties";
|
||||
#ifdef JDK13
|
||||
// the ifdef is weird, but it's set for everything but
|
||||
// macos9, and this will never get hit
|
||||
output = new FileOutputStream(URLDecoder.decode(urlstr));
|
||||
#else
|
||||
System.err.println("bad error while writing sketch.properties");
|
||||
System.err.println("you should never see this message");
|
||||
#endif
|
||||
}
|
||||
|
||||
Properties skprops = new Properties();
|
||||
|
||||
//Rectangle window = PdeBase.frame.getBounds();
|
||||
Rectangle window = base.getBounds();
|
||||
Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
|
||||
|
||||
skprops.put("window.x", String.valueOf(window.x));
|
||||
skprops.put("window.y", String.valueOf(window.y));
|
||||
skprops.put("window.w", String.valueOf(window.width));
|
||||
skprops.put("window.h", String.valueOf(window.height));
|
||||
|
||||
skprops.put("screen.w", String.valueOf(screen.width));
|
||||
skprops.put("screen.h", String.valueOf(screen.height));
|
||||
|
||||
skprops.put("sketch.name", sketchName);
|
||||
skprops.put("sketch.directory", sketchDir.getCanonicalPath());
|
||||
skprops.put("user.name", userName);
|
||||
|
||||
skprops.put("editor.external", externalEditor ? "true" : "false");
|
||||
skprops.put("editor.divider.location",
|
||||
String.valueOf(splitPane.getDividerLocation()));
|
||||
|
||||
//skprops.put("serial.port", PdePreferences.get("serial.port", "unspecified"));
|
||||
|
||||
skprops.save(output, "auto-generated by pde, please don't touch");
|
||||
|
||||
} catch (IOException e) {
|
||||
System.err.println("doQuit: error saving properties");
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
//System.out.println("exiting here");
|
||||
System.exit(0);
|
||||
|
||||
@@ -30,7 +30,7 @@ import java.io.*;
|
||||
|
||||
public class PdeEditorHeader extends Panel /* implements ActionListener*/ {
|
||||
static final String SKETCH_TITLER = "sketch";
|
||||
static final String USER_TITLER = "user";
|
||||
//static final String USER_TITLER = "user";
|
||||
|
||||
//static final Color primaryColor = Color.white;
|
||||
//static final Color secondaryColor = new Color(153, 153, 153);
|
||||
@@ -50,9 +50,9 @@ public class PdeEditorHeader extends Panel /* implements ActionListener*/ {
|
||||
boolean sketchModified;
|
||||
|
||||
//private String user;
|
||||
int userLeft;
|
||||
int userRight;
|
||||
int userTitleLeft;
|
||||
//int userLeft;
|
||||
//int userRight;
|
||||
//int userTitleLeft;
|
||||
|
||||
Font font;
|
||||
FontMetrics metrics;
|
||||
@@ -89,7 +89,7 @@ public class PdeEditorHeader extends Panel /* implements ActionListener*/ {
|
||||
|
||||
public void reset() {
|
||||
sketchLeft = 0;
|
||||
userLeft = 0;
|
||||
//userLeft = 0;
|
||||
update();
|
||||
}
|
||||
|
||||
@@ -132,14 +132,14 @@ public class PdeEditorHeader extends Panel /* implements ActionListener*/ {
|
||||
// who cares, just resize
|
||||
sizeW = size.width;
|
||||
sizeH = size.height;
|
||||
userLeft = 0; // reset
|
||||
//userLeft = 0; // reset
|
||||
}
|
||||
}
|
||||
|
||||
if (offscreen == null) {
|
||||
sizeW = size.width;
|
||||
sizeH = size.height;
|
||||
userLeft = 0; // reset
|
||||
//userLeft = 0; // reset
|
||||
imageW = sizeW;
|
||||
imageH = sizeH;
|
||||
offscreen = createImage(imageW, imageH);
|
||||
@@ -168,9 +168,9 @@ public class PdeEditorHeader extends Panel /* implements ActionListener*/ {
|
||||
//}
|
||||
|
||||
//if (userLeft == 0) {
|
||||
userLeft = sizeW - 20 - metrics.stringWidth(editor.userName);
|
||||
userTitleLeft = userLeft - PdeEditor.INSET_SIZE -
|
||||
metrics.stringWidth(USER_TITLER);
|
||||
//userLeft = sizeW - 20 - metrics.stringWidth(editor.userName);
|
||||
//userTitleLeft = userLeft - PdeEditor.INSET_SIZE -
|
||||
//metrics.stringWidth(USER_TITLER);
|
||||
|
||||
//user = editor.userName;
|
||||
//if (user == null) user = "";
|
||||
@@ -181,13 +181,13 @@ public class PdeEditorHeader extends Panel /* implements ActionListener*/ {
|
||||
g.setColor(backgroundColor);
|
||||
g.fillRect(0, 0, imageW, imageH);
|
||||
|
||||
boolean boringUser = editor.userName.equals("default");
|
||||
//boolean boringUser = editor.userName.equals("default");
|
||||
|
||||
g.setFont(font); // needs to be set each time
|
||||
g.setColor(secondaryColor);
|
||||
g.drawString(SKETCH_TITLER, sketchTitleLeft, baseline);
|
||||
if (sketchModified) g.drawString("\u00A7", modifiedLeft, baseline);
|
||||
if (!boringUser) g.drawString(USER_TITLER, userTitleLeft, baseline);
|
||||
//if (!boringUser) g.drawString(USER_TITLER, userTitleLeft, baseline);
|
||||
|
||||
g.setColor(primaryColor);
|
||||
//g.drawString(sketch, sketchLeft, baseline);
|
||||
@@ -196,8 +196,7 @@ public class PdeEditorHeader extends Panel /* implements ActionListener*/ {
|
||||
//String additional = sketchModified ? " \u2022" : "";
|
||||
g.drawString(editor.sketchName, sketchLeft, baseline);
|
||||
|
||||
//if (!boringUser) g.drawString(user, userLeft, baseline);
|
||||
if (!boringUser) g.drawString(editor.userName, userLeft, baseline);
|
||||
//if (!boringUser) g.drawString(editor.userName, userLeft, baseline);
|
||||
|
||||
//g.setColor(fgColor[mode]);
|
||||
//g.drawString(message, PdeEditor.INSET_SIZE, (sizeH + fontAscent) / 2);
|
||||
|
||||
@@ -136,7 +136,7 @@ public class PdePreferences extends JComponent {
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
System.err.println("Error reading pde.properties");
|
||||
System.err.println("Error reading default settings");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
@@ -238,13 +238,13 @@ public class PdePreferences extends JComponent {
|
||||
|
||||
externalEditorBox = new JCheckBox("Use external editor");
|
||||
pain.add(externalEditorBox);
|
||||
d = newSketchPromptBox.getPreferredSize();
|
||||
newSketchPromptBox.setBounds(left, top, d.width, d.height);
|
||||
d = externalEditorBox.getPreferredSize();
|
||||
externalEditorBox.setBounds(left, top, d.width, d.height);
|
||||
right = Math.max(right, left + d.width);
|
||||
top += d.height + BETWEEN;
|
||||
|
||||
|
||||
//
|
||||
// More preferences are in the ...
|
||||
|
||||
String blather =
|
||||
"More preferences are in the 'lib' folder inside text files\n" +
|
||||
@@ -261,6 +261,9 @@ public class PdePreferences extends JComponent {
|
||||
textarea.setBounds(left, top, d.width, d.height);
|
||||
top += d.height + BETWEEN;
|
||||
|
||||
// OK Cancel
|
||||
|
||||
|
||||
//
|
||||
|
||||
wide = right + BIG;
|
||||
@@ -338,12 +341,6 @@ public class PdePreferences extends JComponent {
|
||||
windowX = -1;
|
||||
}
|
||||
|
||||
String name = skprops.getProperty("sketch.name");
|
||||
String path = skprops.getProperty("sketch.directory");
|
||||
String user = skprops.getProperty("user.name");
|
||||
|
||||
String what = path + File.separator + name + ".pde";
|
||||
|
||||
if (windowX != -1) {
|
||||
String dividerLocation =
|
||||
skprops.getProperty("editor.divider.location");
|
||||
@@ -352,6 +349,14 @@ public class PdePreferences extends JComponent {
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
String name = skprops.getProperty("sketch.name");
|
||||
String path = skprops.getProperty("sketch.directory");
|
||||
//String user = skprops.getProperty("user.name");
|
||||
|
||||
String what = path + File.separator + name + ".pde";
|
||||
|
||||
if (new File(what).exists()) {
|
||||
userName = user;
|
||||
skOpen(path, name);
|
||||
@@ -361,6 +366,8 @@ public class PdePreferences extends JComponent {
|
||||
skNew();
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
String serialPort = skprops.getProperty("serial.port");
|
||||
if (serialPort != null) {
|
||||
properties.put("serial.port", serialPort);
|
||||
|
||||
Reference in New Issue
Block a user