From b4d0c6b336cf4ee6a655256154d2d303f7d8ceab Mon Sep 17 00:00:00 2001 From: benfry Date: Sun, 16 May 2004 20:54:32 +0000 Subject: [PATCH] cleaning up bugs and making more --- processing/app/PdeEditor.java | 24 +++++++++++++++--------- processing/app/PdeEditorButtons.java | 4 ++-- processing/app/PdeEditorConsole.java | 26 +++++++++++++++++++++++--- 3 files changed, 40 insertions(+), 14 deletions(-) diff --git a/processing/app/PdeEditor.java b/processing/app/PdeEditor.java index e3dd3f0b0..31318b06e 100644 --- a/processing/app/PdeEditor.java +++ b/processing/app/PdeEditor.java @@ -182,19 +182,30 @@ public class PdeEditor extends JFrame textarea.setRightClickPopup(new TextAreaPopup()); textarea.setTokenMarker(new PdeKeywords()); + System.out.println("here 1"); + // assemble console panel, consisting of status area and the console itself consolePanel = new JPanel(); //System.out.println(consolePanel.getInsets()); consolePanel.setLayout(new BorderLayout()); + System.out.println("here 1a"); + status = new PdeEditorStatus(this); consolePanel.add(status, BorderLayout.NORTH); + + System.out.println("here 1b"); + console = new PdeEditorConsole(this); consolePanel.add(console, BorderLayout.CENTER); + System.out.println("here 1c"); + splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, textarea, consolePanel); + System.out.println("here 2"); + splitPane.setOneTouchExpandable(true); // repaint child panes while resizing splitPane.setContinuousLayout(true); @@ -213,6 +224,8 @@ public class PdeEditor extends JFrame splitPane.setDividerSize(dividerSize); } + System.out.println("here 3"); + rightPanel.add(splitPane, BorderLayout.CENTER); pain.add("Center", rightPanel); @@ -365,18 +378,11 @@ public class PdeEditor extends JFrame String sketchPath = PdePreferences.get("last.sketch.path"); //PdeSketch sketchTemp = new PdeSketch(sketchPath); - //if (sketchName != null) { if ((sketchPath != null) && (new File(sketchPath)).exists()) { - handleOpen(sketchPath); - //skOpen(new PdeSketch(sketchFile)); - //if (new File(sketchDir + File.separator + sketchName + ".pde").exists()) { - //skOpen(sketchDir, sketchName); + // don't check modified because nothing is open yet + handleOpen2(sketchPath); - //} else { - //skNew2(true); - //} } else { - //skNew2(true); handleNew2(true); } diff --git a/processing/app/PdeEditorButtons.java b/processing/app/PdeEditorButtons.java index 726f476fd..ffa3a04c9 100644 --- a/processing/app/PdeEditorButtons.java +++ b/processing/app/PdeEditorButtons.java @@ -71,7 +71,7 @@ public class PdeEditorButtons extends JComponent implements MouseInputListener { JPopupMenu popup; int buttonCount; - int state[]; + int state[] = new int[BUTTON_COUNT]; Image stateImage[]; int which[]; // mapping indices to implementation @@ -142,7 +142,7 @@ public class PdeEditorButtons extends JComponent implements MouseInputListener { rollover = new Image[BUTTON_COUNT]; active = new Image[BUTTON_COUNT]; - state = new int[BUTTON_COUNT]; + //state = new int[BUTTON_COUNT]; for (int i = 0; i < BUTTON_COUNT; i++) { inactive[i] = createImage(BUTTON_WIDTH, BUTTON_HEIGHT); diff --git a/processing/app/PdeEditorConsole.java b/processing/app/PdeEditorConsole.java index 0a09c38d8..5ebbbd6c8 100644 --- a/processing/app/PdeEditorConsole.java +++ b/processing/app/PdeEditorConsole.java @@ -97,6 +97,8 @@ public class PdeEditorConsole extends JScrollPane { // add the jtextpane to this scrollpane this.setViewportView(consoleTextPane); + System.out.println("BLRHUHG"); + // calculate height of a line of text in pixels // and size window accordingly FontMetrics metrics = this.getFontMetrics(font); @@ -106,6 +108,8 @@ public class PdeEditorConsole extends JScrollPane { setPreferredSize(new Dimension(1024, (height * lines) + sizeFudge)); setMinimumSize(new Dimension(1024, (height * 4) + sizeFudge)); + System.out.println("BLRHUHG 2"); + if (systemOut == null) { systemOut = System.out; systemErr = System.err; @@ -126,22 +130,35 @@ public class PdeEditorConsole extends JScrollPane { "files used to store the console output.", e); } + System.out.println("BLRHUHG 2b "); + consoleOut = new PrintStream(new PdeEditorConsoleStream(this, false, stdoutFile)); + System.out.println("BLRHUHG 2c " + consoleOut); consoleErr = new PrintStream(new PdeEditorConsoleStream(this, true, stderrFile)); - + System.out.println("BLRHUHG 2d " + consoleErr); if (PdePreferences.getBoolean("console")) { - System.setOut(consoleOut); - System.setErr(consoleErr); + System.out.println("BLRHUHG 2e " + consoleOut); + try { + System.setOut(consoleOut); + System.out.println("BLRHUHG 2f " + consoleErr); + System.setErr(consoleErr); + System.out.println("BLRHUHG 2g " + consoleErr); + } catch (Exception e) { + e.printStackTrace(); + } } } + System.out.println("BLRHUHG 3"); + // to fix ugliness.. normally macosx java 1.3 puts an // ugly white border around this object, so turn it off. if (PdeBase.platform == PdeBase.MACOSX) { setBorder(null); } + System.out.println("BLRHUHG 4"); } @@ -194,6 +211,8 @@ public class PdeEditorConsole extends JScrollPane { private void appendText(String text, boolean err) { + if (true) return; + try { // check how many lines have been used so far // if too many, shave off a few lines from the beginning @@ -203,6 +222,7 @@ public class PdeEditorConsole extends JScrollPane { if (overage > 0) { // if 1200 lines, and 1000 lines is max, // find the position of the end of the 200th line + System.out.println("overage is " + overage); Element lineElement = element.getElement(overage); int endOffset = lineElement.getEndOffset(); // remove to the end of the 200th line