diff --git a/processing/app/PdeEditor.java b/processing/app/PdeEditor.java index b0fbcfd15..ed2c4a8a9 100644 --- a/processing/app/PdeEditor.java +++ b/processing/app/PdeEditor.java @@ -179,30 +179,20 @@ public class PdeEditor extends JFrame textarea.setRightClickPopup(new TextAreaPopup()); textarea.setTokenMarker(new PdeKeywords()); - System.out.println("PdeEditor: 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("PdeEditor: here 1a"); - status = new PdeEditorStatus(this); consolePanel.add(status, BorderLayout.NORTH); - System.out.println("PdeEditor: here 1b"); - console = new PdeEditorConsole(this); consolePanel.add(console, BorderLayout.CENTER); - System.out.println("PdeEditor: here 1c"); - splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, textarea, consolePanel); - System.out.println("PdeEditor: here 2"); - splitPane.setOneTouchExpandable(true); // repaint child panes while resizing splitPane.setContinuousLayout(true); @@ -221,8 +211,6 @@ public class PdeEditor extends JFrame splitPane.setDividerSize(dividerSize); } - System.out.println("PdeEditor: here 3"); - rightPanel.add(splitPane, BorderLayout.CENTER); pain.add("Center", rightPanel); @@ -1219,10 +1207,19 @@ public class PdeEditor extends JFrame } + /** + * Second stage of open, occurs after having checked to + * see if the modifications (if any) to the previous sketch + * need to be saved. + */ protected void handleOpen2(String path) { try { sketch = new PdeSketch(this, path); header.rebuild(); + if (PdePreferences.getBoolean("console.auto_clear")) { + console.clear(); + } + } catch (Exception e) { error(e); } diff --git a/processing/app/PdeEditorConsole.java b/processing/app/PdeEditorConsole.java index 5ebbbd6c8..201c4e9fb 100644 --- a/processing/app/PdeEditorConsole.java +++ b/processing/app/PdeEditorConsole.java @@ -61,6 +61,8 @@ public class PdeEditorConsole extends JScrollPane { public PdeEditorConsole(PdeEditor editor) { this.editor = editor; + maxLineCount = PdePreferences.getInteger("console.length"); + consoleTextPane = new JTextPane(); consoleTextPane.setEditable(false); consoleDoc = consoleTextPane.getStyledDocument(); @@ -97,8 +99,6 @@ 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); @@ -108,8 +108,6 @@ 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; @@ -130,35 +128,26 @@ 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.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(); + e.printStackTrace(systemOut); } } } - 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"); } @@ -211,7 +200,7 @@ public class PdeEditorConsole extends JScrollPane { private void appendText(String text, boolean err) { - if (true) return; + //if (true) return; try { // check how many lines have been used so far @@ -222,8 +211,10 @@ 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); + //systemOut.println("overage is " + overage); Element lineElement = element.getElement(overage); + if (lineElement == null) return; // do nuthin + int endOffset = lineElement.getEndOffset(); // remove to the end of the 200th line consoleDoc.remove(0, endOffset); diff --git a/processing/todo.txt b/processing/todo.txt index c4da77658..586a386f3 100644 --- a/processing/todo.txt +++ b/processing/todo.txt @@ -96,6 +96,13 @@ X the popup from the toolbar needs an "Open..." on it as well X make save() return true/false so it doesn't say "saved" when it hasn't X export is badly broken, fix it.. file names were backwards X if 'applet.html' is in sketch folder, use that as the template +X http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_Software;action=display;num=1083935144 +X http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_Software;action=display;num=1082124454;start=0 +X get the console working again +X appendText is disabled due to NullPointerEx on startup +X empty the console when a new sketch is opened +X if console.auto_clear is set to true, will clear on run and open +X http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_Software;action=display;num=1086972918 _ dashes shouldn't be allowed in filenames for sketches _ actually, lost the naming stuff because now using FileDialog @@ -113,8 +120,7 @@ _ but need to deal with simply, not providing a new exception case _ write sketchbook.clean() _ write 'new text file' _ implement hide/unhide -_ get the console working again -_ appendText is disabled due to NullPointerEx on startup + _ ctrl-5 (at least on xp) is marking the current sketch as modified _ running present mode with a bug in the program hoses things _ make sure the program compiles before starting present mode