mirror of
https://github.com/processing/processing4.git
synced 2026-02-04 06:09:17 +01:00
licensing and tabs
This commit is contained in:
@@ -27,6 +27,9 @@ import java.io.*;
|
||||
|
||||
|
||||
public class PdeCompiler implements PdeMessageConsumer{
|
||||
static final String SUPER_BADNESS =
|
||||
"Strange error while compiling, " +
|
||||
"please send this code to processing@media.mit.edu";
|
||||
|
||||
String buildPath;
|
||||
String className;
|
||||
@@ -82,8 +85,7 @@ public class PdeCompiler implements PdeMessageConsumer{
|
||||
// fairly wrong, one possibility is that jikes has crashed.
|
||||
//
|
||||
if (result != 0 && result != 1 ) {
|
||||
exception = new PdeException("Error while compiling, " +
|
||||
"please send code to bugs@proce55ing.net");
|
||||
exception = new PdeException(SUPER_BADNESS);
|
||||
editor.error(exception);
|
||||
}
|
||||
|
||||
|
||||
@@ -87,8 +87,7 @@ public class PdeCompilerKjc extends PdeCompiler {
|
||||
|
||||
} else {
|
||||
//System.err.println("don't understand: " + s);
|
||||
exception = new PdeException("Error while compiling, " +
|
||||
"please send code to bugs@proce55ing.net");
|
||||
exception = new PdeException(SUPER_BADNESS);
|
||||
editor.error(exception);
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -112,13 +112,13 @@ public class PdeEditorButtons extends JPanel implements MouseInputListener {
|
||||
setLayout(null);
|
||||
status = new Label();
|
||||
status.setFont(PdeBase.getFont("editor.buttons.status.font",
|
||||
new Font("SansSerif", Font.PLAIN, 10)));
|
||||
new Font("SansSerif", Font.PLAIN, 10)));
|
||||
status.setForeground(PdeBase.getColor("editor.buttons.status.color",
|
||||
Color.black));
|
||||
Color.black));
|
||||
add(status);
|
||||
|
||||
status.setBounds(-5, BUTTON_COUNT*BUTTON_HEIGHT,
|
||||
BUTTON_WIDTH + 15, BUTTON_HEIGHT);
|
||||
BUTTON_WIDTH + 15, BUTTON_HEIGHT);
|
||||
status.setAlignment(Label.CENTER);
|
||||
|
||||
addMouseListener(this);
|
||||
@@ -142,28 +142,28 @@ public class PdeEditorButtons extends JPanel implements MouseInputListener {
|
||||
state = new int[BUTTON_COUNT];
|
||||
|
||||
for (int i = 0; i < BUTTON_COUNT; i++) {
|
||||
inactive[i] = createImage(BUTTON_WIDTH, BUTTON_HEIGHT);
|
||||
Graphics g = inactive[i].getGraphics();
|
||||
g.drawImage(buttons, -(i*BUTTON_WIDTH), -2*BUTTON_HEIGHT, null);
|
||||
inactive[i] = createImage(BUTTON_WIDTH, BUTTON_HEIGHT);
|
||||
Graphics g = inactive[i].getGraphics();
|
||||
g.drawImage(buttons, -(i*BUTTON_WIDTH), -2*BUTTON_HEIGHT, null);
|
||||
|
||||
rollover[i] = createImage(BUTTON_WIDTH, BUTTON_HEIGHT);
|
||||
g = rollover[i].getGraphics();
|
||||
g.drawImage(buttons, -(i*BUTTON_WIDTH), -1*BUTTON_HEIGHT, null);
|
||||
rollover[i] = createImage(BUTTON_WIDTH, BUTTON_HEIGHT);
|
||||
g = rollover[i].getGraphics();
|
||||
g.drawImage(buttons, -(i*BUTTON_WIDTH), -1*BUTTON_HEIGHT, null);
|
||||
|
||||
active[i] = createImage(BUTTON_WIDTH, BUTTON_HEIGHT);
|
||||
g = active[i].getGraphics();
|
||||
g.drawImage(buttons, -(i*BUTTON_WIDTH), -0*BUTTON_HEIGHT, null);
|
||||
active[i] = createImage(BUTTON_WIDTH, BUTTON_HEIGHT);
|
||||
g = active[i].getGraphics();
|
||||
g.drawImage(buttons, -(i*BUTTON_WIDTH), -0*BUTTON_HEIGHT, null);
|
||||
}
|
||||
|
||||
state = new int[buttonCount];
|
||||
stateImage = new Image[buttonCount];
|
||||
for (int i = 0; i < buttonCount; i++) {
|
||||
setState(i, INACTIVE, false);
|
||||
setState(i, INACTIVE, false);
|
||||
}
|
||||
}
|
||||
Dimension size = size();
|
||||
if ((offscreen == null) ||
|
||||
(size.width != width) || (size.height != height)) {
|
||||
(size.width != width) || (size.height != height)) {
|
||||
offscreen = createImage(size.width, size.height);
|
||||
width = size.width;
|
||||
height = size.height;
|
||||
@@ -176,13 +176,13 @@ public class PdeEditorButtons extends JPanel implements MouseInputListener {
|
||||
|
||||
int offsetY = 0;
|
||||
for (int i = 0; i < buttonCount; i++) {
|
||||
y1[i] = offsetY;
|
||||
y2[i] = offsetY + BUTTON_HEIGHT;
|
||||
offsetY = y2[i];
|
||||
y1[i] = offsetY;
|
||||
y2[i] = offsetY + BUTTON_HEIGHT;
|
||||
offsetY = y2[i];
|
||||
}
|
||||
|
||||
/*
|
||||
// horizontal alignment
|
||||
// horizontal alignment
|
||||
x1 = new int[buttonCount];
|
||||
x2 = new int[buttonCount];
|
||||
|
||||
@@ -192,12 +192,12 @@ public class PdeEditorButtons extends JPanel implements MouseInputListener {
|
||||
int offsetX = 8;
|
||||
//for (int i = 0; i < 2; i++) {
|
||||
for (int i = 0; i < buttonCount; i++) {
|
||||
//g.drawImage(stateImage[i], offsetX, offsetY, null);
|
||||
x1[i] = offsetX;
|
||||
x2[i] = offsetX + BUTTON_WIDTH;
|
||||
offsetX += BUTTON_WIDTH + 4;
|
||||
// extra space after play/stop/close
|
||||
if (i == GAP_POSITION) offsetX += 8;
|
||||
//g.drawImage(stateImage[i], offsetX, offsetY, null);
|
||||
x1[i] = offsetX;
|
||||
x2[i] = offsetX + BUTTON_WIDTH;
|
||||
offsetX += BUTTON_WIDTH + 4;
|
||||
// extra space after play/stop/close
|
||||
if (i == GAP_POSITION) offsetX += 8;
|
||||
}
|
||||
*/
|
||||
|
||||
@@ -205,10 +205,10 @@ public class PdeEditorButtons extends JPanel implements MouseInputListener {
|
||||
// start from righthand side and move left
|
||||
offsetX = width - 8 - BUTTON_WIDTH;
|
||||
for (int i = buttonCount-1; i >= 2; --i) {
|
||||
//g.drawImage(stateImage[i], offsetX, offsetY, null);
|
||||
x1[i] = offsetX;
|
||||
x2[i] = offsetX + BUTTON_WIDTH;
|
||||
offsetX -= BUTTON_WIDTH + 4;
|
||||
//g.drawImage(stateImage[i], offsetX, offsetY, null);
|
||||
x1[i] = offsetX;
|
||||
x2[i] = offsetX + BUTTON_WIDTH;
|
||||
offsetX -= BUTTON_WIDTH + 4;
|
||||
}
|
||||
*/
|
||||
}
|
||||
@@ -257,20 +257,20 @@ public class PdeEditorButtons extends JPanel implements MouseInputListener {
|
||||
//System.out.println(x + ", " + y);
|
||||
if (currentRollover != -1) {
|
||||
if ((y > y1[currentRollover]) && (x > x1) &&
|
||||
(y < y2[currentRollover]) && (x < x2)) {
|
||||
(y < y2[currentRollover]) && (x < x2)) {
|
||||
//if ((x > x1[currentRollover]) && (y > y1) &&
|
||||
// (x < x2[currentRollover]) && (y < y2)) {
|
||||
//System.out.println("same");
|
||||
///return true; // no change
|
||||
return;
|
||||
//System.out.println("same");
|
||||
///return true; // no change
|
||||
return;
|
||||
|
||||
} else {
|
||||
//state[currentRollover] = INACTIVE_STATE;
|
||||
//stateImage[currentRollover] = inactive[currentRollover];
|
||||
setState(currentRollover, INACTIVE, true);
|
||||
messageClear(title[currentRollover]);
|
||||
currentRollover = -1;
|
||||
//update();
|
||||
//state[currentRollover] = INACTIVE_STATE;
|
||||
//stateImage[currentRollover] = inactive[currentRollover];
|
||||
setState(currentRollover, INACTIVE, true);
|
||||
messageClear(title[currentRollover]);
|
||||
currentRollover = -1;
|
||||
//update();
|
||||
}
|
||||
}
|
||||
int sel = findSelection(x, y);
|
||||
@@ -286,15 +286,15 @@ public class PdeEditorButtons extends JPanel implements MouseInputListener {
|
||||
/*
|
||||
for (int i = 0; i < buttonCount; i++) {
|
||||
if ((x > x1[i]) && (y > y1) &&
|
||||
(x < x2[i]) && (y < y2)) {
|
||||
//System.out.println(i);
|
||||
if (state[i] != ACTIVE_STATE) {
|
||||
state[i] = ROLLOVER_STATE;
|
||||
stateImage[i] = rollover[i];
|
||||
currentRollover = i;
|
||||
}
|
||||
update();
|
||||
return true;
|
||||
(x < x2[i]) && (y < y2)) {
|
||||
//System.out.println(i);
|
||||
if (state[i] != ACTIVE_STATE) {
|
||||
state[i] = ROLLOVER_STATE;
|
||||
stateImage[i] = rollover[i];
|
||||
currentRollover = i;
|
||||
}
|
||||
update();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
*/
|
||||
@@ -309,10 +309,10 @@ public class PdeEditorButtons extends JPanel implements MouseInputListener {
|
||||
|
||||
for (int i = 0; i < buttonCount; i++) {
|
||||
if ((x > x1) && (y > y1[i]) &&
|
||||
(x < x2) && (y < y2[i])) {
|
||||
//if ((x > x1[i]) && (y > y1) &&
|
||||
//(x < x2[i]) && (y < y2)) {
|
||||
return i;
|
||||
(x < x2) && (y < y2[i])) {
|
||||
//if ((x > x1[i]) && (y > y1) &&
|
||||
//(x < x2[i]) && (y < y2)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
@@ -364,9 +364,9 @@ public class PdeEditorButtons extends JPanel implements MouseInputListener {
|
||||
|
||||
if (currentSelection == OPEN) {
|
||||
if (popup == null) {
|
||||
//popup = new JPopupMenu();
|
||||
popup = new PopupMenu();
|
||||
add(popup);
|
||||
//popup = new JPopupMenu();
|
||||
popup = new PopupMenu();
|
||||
add(popup);
|
||||
}
|
||||
//popup.addActionListener(this);
|
||||
editor.base.rebuildSketchbookMenu(popup);
|
||||
@@ -406,9 +406,9 @@ public class PdeEditorButtons extends JPanel implements MouseInputListener {
|
||||
case STOP:
|
||||
setState(RUN, INACTIVE, true);
|
||||
if (editor.presenting) {
|
||||
editor.doClose();
|
||||
editor.doClose();
|
||||
} else {
|
||||
editor.doStop();
|
||||
editor.doStop();
|
||||
}
|
||||
break;
|
||||
//case CLOSE: editor.doClose(); break;
|
||||
@@ -416,7 +416,7 @@ public class PdeEditorButtons extends JPanel implements MouseInputListener {
|
||||
//case OPEN: editor.doOpen(); break;
|
||||
/*
|
||||
case OPEN:
|
||||
System.err.println("popup mouseup");
|
||||
System.err.println("popup mouseup");
|
||||
//popup.setVisible(false);
|
||||
remove(popup);
|
||||
// kill the popup?
|
||||
|
||||
@@ -121,36 +121,36 @@ public class PdeEditorConsole extends JScrollPane {
|
||||
|
||||
// no text thing on macos
|
||||
boolean tod = ((PdeBase.platform != PdeBase.MACOSX) &&
|
||||
(PdeBase.platform != PdeBase.MACOS9));
|
||||
(PdeBase.platform != PdeBase.MACOS9));
|
||||
|
||||
if (PdeBase.getBoolean("editor.console.out.enabled", tod)) {
|
||||
String outFileName =
|
||||
PdeBase.get("editor.console.out.file", "lib/stdout.txt");
|
||||
try {
|
||||
stdoutFile = new FileOutputStream(outFileName);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
String outFileName =
|
||||
PdeBase.get("editor.console.out.file", "lib/stdout.txt");
|
||||
try {
|
||||
stdoutFile = new FileOutputStream(outFileName);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
if (PdeBase.getBoolean("editor.console.err.enabled", tod)) {
|
||||
String errFileName =
|
||||
PdeBase.get("editor.console.err.file", "lib/stderr.txt");
|
||||
try {
|
||||
stderrFile = new FileOutputStream(errFileName);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
String errFileName =
|
||||
PdeBase.get("editor.console.err.file", "lib/stderr.txt");
|
||||
try {
|
||||
stderrFile = new FileOutputStream(errFileName);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
consoleOut =
|
||||
new PrintStream(new PdeEditorConsoleStream(this, false, stdoutFile));
|
||||
new PrintStream(new PdeEditorConsoleStream(this, false, stdoutFile));
|
||||
consoleErr =
|
||||
new PrintStream(new PdeEditorConsoleStream(this, true, stderrFile));
|
||||
new PrintStream(new PdeEditorConsoleStream(this, true, stderrFile));
|
||||
|
||||
if (PdeBase.getBoolean("editor.console.enabled", true)) {
|
||||
System.setOut(consoleOut);
|
||||
System.setErr(consoleErr);
|
||||
System.setOut(consoleOut);
|
||||
System.setErr(consoleErr);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -160,8 +160,8 @@ public class PdeEditorConsole extends JScrollPane {
|
||||
|
||||
// synchronized (cerror) { // has to be an object...
|
||||
if (err != cerror) {
|
||||
// advance the line because switching between err/out streams
|
||||
// potentially, could check whether we're already on a new line
|
||||
// advance the line because switching between err/out streams
|
||||
// potentially, could check whether we're already on a new line
|
||||
message("", cerror, true);
|
||||
}
|
||||
|
||||
@@ -195,9 +195,9 @@ public class PdeEditorConsole extends JScrollPane {
|
||||
if (advance) {
|
||||
appendText("\n", err);
|
||||
if (err) {
|
||||
systemErr.println();
|
||||
systemErr.println();
|
||||
} else {
|
||||
systemOut.println();
|
||||
systemOut.println();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -235,7 +235,7 @@ class PdeEditorConsoleStream extends OutputStream {
|
||||
OutputStream echo;
|
||||
|
||||
public PdeEditorConsoleStream(PdeEditorConsole parent,
|
||||
boolean err, OutputStream echo) {
|
||||
boolean err, OutputStream echo) {
|
||||
this.parent = parent;
|
||||
this.err = err;
|
||||
this.echo = echo;
|
||||
@@ -249,11 +249,11 @@ class PdeEditorConsoleStream extends OutputStream {
|
||||
parent.write(b, 0, b.length, err);
|
||||
if (echo != null) {
|
||||
try {
|
||||
echo.write(b); //, 0, b.length);
|
||||
echo.flush();
|
||||
echo.write(b); //, 0, b.length);
|
||||
echo.flush();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
echo = null;
|
||||
e.printStackTrace();
|
||||
echo = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -262,11 +262,11 @@ class PdeEditorConsoleStream extends OutputStream {
|
||||
parent.write(b, offset, length, err);
|
||||
if (echo != null) {
|
||||
try {
|
||||
echo.write(b, offset, length);
|
||||
echo.flush();
|
||||
echo.write(b, offset, length);
|
||||
echo.flush();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
echo = null;
|
||||
e.printStackTrace();
|
||||
echo = null;
|
||||
}
|
||||
}
|
||||
/*
|
||||
@@ -274,18 +274,18 @@ class PdeEditorConsoleStream extends OutputStream {
|
||||
if (length >= 1) {
|
||||
int lastchar = b[offset + length - 1];
|
||||
if (lastchar == '\r') {
|
||||
length--;
|
||||
length--;
|
||||
} else if (lastchar == '\n') {
|
||||
if (length >= 2) {
|
||||
int secondtolastchar = b[offset + length - 2];
|
||||
if (secondtolastchar == '\r') {
|
||||
length -= 2;
|
||||
} else {
|
||||
length--;
|
||||
}
|
||||
} else {
|
||||
length--;
|
||||
}
|
||||
if (length >= 2) {
|
||||
int secondtolastchar = b[offset + length - 2];
|
||||
if (secondtolastchar == '\r') {
|
||||
length -= 2;
|
||||
} else {
|
||||
length--;
|
||||
}
|
||||
} else {
|
||||
length--;
|
||||
}
|
||||
}
|
||||
//if ((lastchar = '\r') || (lastchar == '\n')) length--;
|
||||
}
|
||||
@@ -299,11 +299,11 @@ class PdeEditorConsoleStream extends OutputStream {
|
||||
parent.write(single, 0, 1, err);
|
||||
if (echo != null) {
|
||||
try {
|
||||
echo.write(b);
|
||||
echo.flush();
|
||||
echo.write(b);
|
||||
echo.flush();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
echo = null;
|
||||
e.printStackTrace();
|
||||
echo = null;
|
||||
}
|
||||
}
|
||||
//parent.message(String.valueOf((char)b), err);
|
||||
|
||||
@@ -68,21 +68,21 @@ public class PdeEditorHeader extends Panel /* implements ActionListener*/ {
|
||||
|
||||
if (primaryColor == null) {
|
||||
backgroundColor = PdeBase.getColor("editor.header.bgcolor",
|
||||
new Color(51, 51, 51));
|
||||
new Color(51, 51, 51));
|
||||
primaryColor = PdeBase.getColor("editor.header.fgcolor.primary",
|
||||
new Color(255, 255, 255));
|
||||
new Color(255, 255, 255));
|
||||
secondaryColor = PdeBase.getColor("editor.header.fgcolor.secondary",
|
||||
new Color(153, 153, 153));
|
||||
new Color(153, 153, 153));
|
||||
}
|
||||
|
||||
addMouseListener(new MouseAdapter() {
|
||||
public void mousePressed(MouseEvent e) {
|
||||
//System.out.println("got mouse");
|
||||
if ((sketchRight != 0) &&
|
||||
(e.getX() > sketchLeft) && (e.getX() < sketchRight)) {
|
||||
editor.skSaveAs(true);
|
||||
}
|
||||
}
|
||||
public void mousePressed(MouseEvent e) {
|
||||
//System.out.println("got mouse");
|
||||
if ((sketchRight != 0) &&
|
||||
(e.getX() > sketchLeft) && (e.getX() < sketchRight)) {
|
||||
editor.skSaveAs(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -125,14 +125,14 @@ public class PdeEditorHeader extends Panel /* implements ActionListener*/ {
|
||||
// component has been resized
|
||||
|
||||
if ((size.width > imageW) || (size.height > imageH)) {
|
||||
// nix the image and recreate, it's too small
|
||||
offscreen = null;
|
||||
// nix the image and recreate, it's too small
|
||||
offscreen = null;
|
||||
|
||||
} else {
|
||||
// who cares, just resize
|
||||
sizeW = size.width;
|
||||
sizeH = size.height;
|
||||
userLeft = 0; // reset
|
||||
// who cares, just resize
|
||||
sizeW = size.width;
|
||||
sizeH = size.height;
|
||||
userLeft = 0; // reset
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,7 +148,7 @@ public class PdeEditorHeader extends Panel /* implements ActionListener*/ {
|
||||
Graphics g = offscreen.getGraphics();
|
||||
if (font == null) {
|
||||
font = PdeBase.getFont("editor.header.font",
|
||||
new Font("SansSerif", Font.PLAIN, 12));
|
||||
new Font("SansSerif", Font.PLAIN, 12));
|
||||
g.setFont(font);
|
||||
metrics = g.getFontMetrics();
|
||||
fontAscent = metrics.getAscent();
|
||||
|
||||
@@ -81,22 +81,22 @@ public class PdeEditorStatus extends Panel
|
||||
if (bgcolor == null) {
|
||||
bgcolor = new Color[4];
|
||||
bgcolor[0] = PdeBase.getColor("editor.status.notice.bgcolor",
|
||||
new Color(102, 102, 102));
|
||||
new Color(102, 102, 102));
|
||||
bgcolor[1] = PdeBase.getColor("editor.status.error.bgcolor",
|
||||
new Color(102, 26, 0));
|
||||
new Color(102, 26, 0));
|
||||
bgcolor[2] = PdeBase.getColor("editor.status.prompt.bgcolor",
|
||||
new Color(204, 153, 0));
|
||||
new Color(204, 153, 0));
|
||||
bgcolor[3] = PdeBase.getColor("editor.status.prompt.bgcolor",
|
||||
new Color(204, 153, 0));
|
||||
new Color(204, 153, 0));
|
||||
fgcolor = new Color[4];
|
||||
fgcolor[0] = PdeBase.getColor("editor.status.notice.fgcolor",
|
||||
new Color(255, 255, 255));
|
||||
new Color(255, 255, 255));
|
||||
fgcolor[1] = PdeBase.getColor("editor.status.error.fgcolor",
|
||||
new Color(255, 255, 255));
|
||||
new Color(255, 255, 255));
|
||||
fgcolor[2] = PdeBase.getColor("editor.status.prompt.fgcolor",
|
||||
new Color(0, 0, 0));
|
||||
new Color(0, 0, 0));
|
||||
fgcolor[3] = PdeBase.getColor("editor.status.prompt.fgcolor",
|
||||
new Color(0, 0, 0));
|
||||
new Color(0, 0, 0));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,18 +130,18 @@ public class PdeEditorStatus extends Panel
|
||||
public void run() {
|
||||
while (Thread.currentThread() == promptThread) {
|
||||
if (response != 0) {
|
||||
//System.out.println("stopping prompt thread");
|
||||
//promptThread.stop();
|
||||
//System.out.println("exiting prompt loop");
|
||||
unprompt();
|
||||
break;
|
||||
//System.out.println("stopping prompt thread");
|
||||
//promptThread.stop();
|
||||
//System.out.println("exiting prompt loop");
|
||||
unprompt();
|
||||
break;
|
||||
|
||||
} else {
|
||||
try {
|
||||
//System.out.println("inside prompt thread " +
|
||||
//System.currentTimeMillis());
|
||||
Thread.sleep(100);
|
||||
} catch (InterruptedException e) { }
|
||||
try {
|
||||
//System.out.println("inside prompt thread " +
|
||||
//System.currentTimeMillis());
|
||||
Thread.sleep(100);
|
||||
} catch (InterruptedException e) { }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -219,10 +219,10 @@ public class PdeEditorStatus extends Panel
|
||||
// !@#(* aqua ui #($*(( that turtle-neck wearing #(** (#$@)(
|
||||
// os9 seems to work if bg of component is set, but x still a bastard
|
||||
if (PdeBase.platform == PdeBase.MACOSX) {
|
||||
yesButton.setBackground(bgcolor[PROMPT]);
|
||||
noButton.setBackground(bgcolor[PROMPT]);
|
||||
cancelButton.setBackground(bgcolor[PROMPT]);
|
||||
okButton.setBackground(bgcolor[PROMPT]);
|
||||
yesButton.setBackground(bgcolor[PROMPT]);
|
||||
noButton.setBackground(bgcolor[PROMPT]);
|
||||
cancelButton.setBackground(bgcolor[PROMPT]);
|
||||
okButton.setBackground(bgcolor[PROMPT]);
|
||||
}
|
||||
setLayout(null);
|
||||
|
||||
@@ -245,87 +245,87 @@ public class PdeEditorStatus extends Panel
|
||||
editField.addActionListener(this);
|
||||
|
||||
if (PdeBase.platform != PdeBase.MACOSX) {
|
||||
editField.addKeyListener(new KeyAdapter() {
|
||||
protected void noop() { }
|
||||
editField.addKeyListener(new KeyAdapter() {
|
||||
protected void noop() { }
|
||||
|
||||
public void keyPressed(KeyEvent event) {
|
||||
//System.out.println("got event " + event + " " + KeyEvent.VK_SPACE);
|
||||
int c = event.getKeyChar();
|
||||
int code = event.getKeyCode();
|
||||
|
||||
if (code == KeyEvent.VK_ENTER) {
|
||||
// accept the input
|
||||
//editor.skDuplicateRename2(editField.getText(), editRename);
|
||||
editor.skSaveAs2(editField.getText());
|
||||
unedit();
|
||||
event.consume();
|
||||
public void keyPressed(KeyEvent event) {
|
||||
//System.out.println("got event " + event + " " + KeyEvent.VK_SPACE);
|
||||
int c = event.getKeyChar();
|
||||
int code = event.getKeyCode();
|
||||
|
||||
if (code == KeyEvent.VK_ENTER) {
|
||||
// accept the input
|
||||
//editor.skDuplicateRename2(editField.getText(), editRename);
|
||||
editor.skSaveAs2(editField.getText());
|
||||
unedit();
|
||||
event.consume();
|
||||
|
||||
} else if ((code == KeyEvent.VK_BACK_SPACE) ||
|
||||
(code == KeyEvent.VK_DELETE) ||
|
||||
(code == KeyEvent.VK_RIGHT) ||
|
||||
(code == KeyEvent.VK_LEFT) ||
|
||||
(code == KeyEvent.VK_UP) ||
|
||||
(code == KeyEvent.VK_DOWN) ||
|
||||
(code == KeyEvent.VK_HOME) ||
|
||||
(code == KeyEvent.VK_END) ||
|
||||
(code == KeyEvent.VK_SHIFT)) {
|
||||
//System.out.println("nothing to see here");
|
||||
noop();
|
||||
} else if ((code == KeyEvent.VK_BACK_SPACE) ||
|
||||
(code == KeyEvent.VK_DELETE) ||
|
||||
(code == KeyEvent.VK_RIGHT) ||
|
||||
(code == KeyEvent.VK_LEFT) ||
|
||||
(code == KeyEvent.VK_UP) ||
|
||||
(code == KeyEvent.VK_DOWN) ||
|
||||
(code == KeyEvent.VK_HOME) ||
|
||||
(code == KeyEvent.VK_END) ||
|
||||
(code == KeyEvent.VK_SHIFT)) {
|
||||
//System.out.println("nothing to see here");
|
||||
noop();
|
||||
|
||||
} else if (code == KeyEvent.VK_ESCAPE) {
|
||||
unedit();
|
||||
editor.buttons.clear();
|
||||
event.consume();
|
||||
} else if (code == KeyEvent.VK_ESCAPE) {
|
||||
unedit();
|
||||
editor.buttons.clear();
|
||||
event.consume();
|
||||
|
||||
//} else if (c == ' ') {
|
||||
} else if (code == KeyEvent.VK_SPACE) {
|
||||
//System.out.println("got a space");
|
||||
// if a space, insert an underscore
|
||||
//editField.insert("_", editField.getCaretPosition());
|
||||
/* tried to play nice and see where it got me
|
||||
editField.dispatchEvent(new KeyEvent(editField,
|
||||
KeyEvent.KEY_PRESSED,
|
||||
System.currentTimeMillis(),
|
||||
0, 45, '_'));
|
||||
*/
|
||||
//System.out.println("start/end = " +
|
||||
// editField.getSelectionStart() + " " +
|
||||
// editField.getSelectionEnd());
|
||||
String t = editField.getText();
|
||||
//int p = editField.getCaretPosition();
|
||||
//editField.setText(t.substring(0, p) + "_" + t.substring(p));
|
||||
//editField.setCaretPosition(p+1);
|
||||
int start = editField.getSelectionStart();
|
||||
int end = editField.getSelectionEnd();
|
||||
editField.setText(t.substring(0, start) + "_" +
|
||||
t.substring(end));
|
||||
editField.setCaretPosition(start+1);
|
||||
//System.out.println("consuming event");
|
||||
event.consume();
|
||||
//} else if (c == ' ') {
|
||||
} else if (code == KeyEvent.VK_SPACE) {
|
||||
//System.out.println("got a space");
|
||||
// if a space, insert an underscore
|
||||
//editField.insert("_", editField.getCaretPosition());
|
||||
/* tried to play nice and see where it got me
|
||||
editField.dispatchEvent(new KeyEvent(editField,
|
||||
KeyEvent.KEY_PRESSED,
|
||||
System.currentTimeMillis(),
|
||||
0, 45, '_'));
|
||||
*/
|
||||
//System.out.println("start/end = " +
|
||||
// editField.getSelectionStart() + " " +
|
||||
// editField.getSelectionEnd());
|
||||
String t = editField.getText();
|
||||
//int p = editField.getCaretPosition();
|
||||
//editField.setText(t.substring(0, p) + "_" + t.substring(p));
|
||||
//editField.setCaretPosition(p+1);
|
||||
int start = editField.getSelectionStart();
|
||||
int end = editField.getSelectionEnd();
|
||||
editField.setText(t.substring(0, start) + "_" +
|
||||
t.substring(end));
|
||||
editField.setCaretPosition(start+1);
|
||||
//System.out.println("consuming event");
|
||||
event.consume();
|
||||
|
||||
} else if (c == '_') {
|
||||
noop();
|
||||
// everything fine
|
||||
} else if (c == '_') {
|
||||
noop();
|
||||
// everything fine
|
||||
|
||||
} else if (((code >= 'A') && (code <= 'Z')) &&
|
||||
(((c >= 'A') && (c <= 'Z')) ||
|
||||
((c >= 'a') && (c <= 'z')))) {
|
||||
// everything fine, catches upper and lower
|
||||
noop();
|
||||
} else if (((code >= 'A') && (code <= 'Z')) &&
|
||||
(((c >= 'A') && (c <= 'Z')) ||
|
||||
((c >= 'a') && (c <= 'z')))) {
|
||||
// everything fine, catches upper and lower
|
||||
noop();
|
||||
|
||||
} else if ((c >= '0') && (c <= '9')) {
|
||||
if (editField.getCaretPosition() == 0) {
|
||||
// number not allowed as first digit
|
||||
//System.out.println("bad number bad");
|
||||
event.consume();
|
||||
}
|
||||
} else {
|
||||
event.consume();
|
||||
//System.out.println("code is " + code + " char = " + c);
|
||||
}
|
||||
//System.out.println("code is " + code + " char = " + c);
|
||||
}
|
||||
});
|
||||
} else if ((c >= '0') && (c <= '9')) {
|
||||
if (editField.getCaretPosition() == 0) {
|
||||
// number not allowed as first digit
|
||||
//System.out.println("bad number bad");
|
||||
event.consume();
|
||||
}
|
||||
} else {
|
||||
event.consume();
|
||||
//System.out.println("code is " + code + " char = " + c);
|
||||
}
|
||||
//System.out.println("code is " + code + " char = " + c);
|
||||
}
|
||||
});
|
||||
}
|
||||
add(editField);
|
||||
editField.setVisible(false);
|
||||
@@ -336,14 +336,14 @@ public class PdeEditorStatus extends Panel
|
||||
// component has been resized
|
||||
|
||||
if ((size.width > imageW) || (size.height > imageH)) {
|
||||
// nix the image and recreate, it's too small
|
||||
offscreen = null;
|
||||
// nix the image and recreate, it's too small
|
||||
offscreen = null;
|
||||
|
||||
} else {
|
||||
// who cares, just resize
|
||||
sizeW = size.width;
|
||||
sizeH = size.height;
|
||||
setButtonBounds();
|
||||
// who cares, just resize
|
||||
sizeW = size.width;
|
||||
sizeH = size.height;
|
||||
setButtonBounds();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -359,7 +359,7 @@ public class PdeEditorStatus extends Panel
|
||||
Graphics g = offscreen.getGraphics();
|
||||
if (font == null) {
|
||||
font = PdeBase.getFont("editor.status.font",
|
||||
new Font("SansSerif", Font.PLAIN, 12));
|
||||
new Font("SansSerif", Font.PLAIN, 12));
|
||||
g.setFont(font);
|
||||
metrics = g.getFontMetrics();
|
||||
ascent = metrics.getAscent();
|
||||
@@ -388,7 +388,7 @@ public class PdeEditorStatus extends Panel
|
||||
cancelButton.setBounds(cancelLeft, top, BUTTON_WIDTH, BUTTON_HEIGHT);
|
||||
|
||||
editField.setBounds(yesLeft-BUTTON_WIDTH, top,
|
||||
BUTTON_WIDTH*2, BUTTON_HEIGHT);
|
||||
BUTTON_WIDTH*2, BUTTON_HEIGHT);
|
||||
okButton.setBounds(noLeft, top, BUTTON_WIDTH, BUTTON_HEIGHT);
|
||||
}
|
||||
|
||||
@@ -432,15 +432,15 @@ public class PdeEditorStatus extends Panel
|
||||
String answer = editField.getText();
|
||||
|
||||
if (PdeBase.platform == PdeBase.MACOSX) {
|
||||
char unscrubbed[] = editField.getText().toCharArray();
|
||||
for (int i = 0; i < unscrubbed.length; i++) {
|
||||
if (!(((unscrubbed[i] >= '0') && (unscrubbed[i] <= '9')) ||
|
||||
((unscrubbed[i] >= 'A') && (unscrubbed[i] <= 'Z')) ||
|
||||
((unscrubbed[i] >= 'a') && (unscrubbed[i] <= 'z')))) {
|
||||
unscrubbed[i] = '_';
|
||||
}
|
||||
}
|
||||
answer = new String(unscrubbed);
|
||||
char unscrubbed[] = editField.getText().toCharArray();
|
||||
for (int i = 0; i < unscrubbed.length; i++) {
|
||||
if (!(((unscrubbed[i] >= '0') && (unscrubbed[i] <= '9')) ||
|
||||
((unscrubbed[i] >= 'A') && (unscrubbed[i] <= 'Z')) ||
|
||||
((unscrubbed[i] >= 'a') && (unscrubbed[i] <= 'z')))) {
|
||||
unscrubbed[i] = '_';
|
||||
}
|
||||
}
|
||||
answer = new String(unscrubbed);
|
||||
}
|
||||
editor.skSaveAs2(answer);
|
||||
//editor.skDuplicateRename2(editField.getText(), editRename);
|
||||
|
||||
@@ -1,3 +1,29 @@
|
||||
/* -*- mode: jde; c-basic-offset: 2; indent-tabs-mode: nil -*- */
|
||||
|
||||
/*
|
||||
PdeException - an exception with a line number attached
|
||||
Part of the Processing project - http://Proce55ing.net
|
||||
|
||||
Copyright (c) 2001-03
|
||||
Ben Fry, Massachusetts Institute of Technology and
|
||||
Casey Reas, Interaction Design Institute Ivrea
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
public class PdeException extends Exception {
|
||||
int line = -1;
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ public class PdeRuntime implements PdeMessageConsumer {
|
||||
Frame frame = PdeBase.frame;
|
||||
Point parentLoc = frame.getLocation();
|
||||
Insets parentInsets = frame.getInsets();
|
||||
|
||||
|
||||
int x1 = parentLoc.x - 20;
|
||||
int y1 = parentLoc.y;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user