diff --git a/app/src/processing/app/EditorLineStatus.java b/app/src/processing/app/EditorLineStatus.java deleted file mode 100644 index ff7a1bacd..000000000 --- a/app/src/processing/app/EditorLineStatus.java +++ /dev/null @@ -1,118 +0,0 @@ -/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ - -/* - Part of the Processing project - http://processing.org - - Copyright (c) 2005-07 Ben Fry and Casey Reas - - 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 -*/ - -package processing.app; - -import java.awt.*; - -import javax.swing.*; - - -/** - * Li'l status bar fella that shows the line number. - */ -public class EditorLineStatus extends JComponent { - Editor editor; -// JEditTextArea textarea; - int start = -1, stop; - - Color foreground; - Color background; - Font font; - int high; - - String text = ""; - - - public EditorLineStatus(Editor editor) { - this.editor = editor; - -// textarea = editor.getTextArea(); - // not pretty, but it just does one thing... -// textarea.editorLineStatus = this; - editor.getTextArea().editorLineStatus = this; - - updateMode(); - } - - - public void updateMode() { - Mode mode = editor.getMode(); - background = mode.getColor("linestatus.bgcolor"); - font = mode.getFont("linestatus.font"); - foreground = mode.getColor("linestatus.color"); - high = mode.getInteger("linestatus.height"); - } - - - public void set(int newStart, int newStop) { - if ((newStart == start) && (newStop == stop)) return; - - start = newStart; - stop = newStop; - - /* - if (start == stop) { - text = "Line " + (start + 1); - } else { - text = "Lines " + (start + 1) + " to " + (stop + 1); - } - */ - if (start == stop) { - text = String.valueOf(start+1); - } else { - text = (start+1) + " - " + (stop+1); - } - - repaint(); - } - - - public void paintComponent(Graphics g) { - Graphics2D g2 = (Graphics2D) g; - g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, - RenderingHints.VALUE_TEXT_ANTIALIAS_ON); - - g.setColor(background); - Dimension size = getSize(); - g.fillRect(0, 0, size.width, size.height); - - g.setFont(font); - g.setColor(foreground); - int baseline = (high + g.getFontMetrics().getAscent()) / 2; - // With 7u40 (or Source Code Sans?) things seem to be edged up a bit - g.drawString(text, 6, baseline - 1); - } - - - public Dimension getPreferredSize() { - return new Dimension(300, high); - } - - public Dimension getMinimumSize() { - return getPreferredSize(); - } - - public Dimension getMaximumSize() { - return new Dimension(3000, high); - } -} diff --git a/app/src/processing/app/syntax/JEditTextArea.java b/app/src/processing/app/syntax/JEditTextArea.java index 5557cb191..68b9b6c32 100644 --- a/app/src/processing/app/syntax/JEditTextArea.java +++ b/app/src/processing/app/syntax/JEditTextArea.java @@ -216,8 +216,8 @@ public class JEditTextArea extends JComponent public void setScrollPosition(int what) { setVerticalScrollPosition(what); } - - + + /** * Get current position of the vertical scroll bar. */ @@ -232,15 +232,15 @@ public class JEditTextArea extends JComponent public void setVerticalScrollPosition(int what) { vertical.setValue(what); } - - + + /** * Get current position of the horizontal scroll bar. */ public int getHorizontalScrollPosition() { return horizontal.getValue(); } - + /** * Set position of the horizontal scroll bar. @@ -248,7 +248,7 @@ public class JEditTextArea extends JComponent public void setHorizontalScrollPosition(int what) { horizontal.setValue(what); } - + /** * Returns the object responsible for painting this text area. @@ -256,8 +256,8 @@ public class JEditTextArea extends JComponent public final TextAreaPainter getPainter() { return painter; } - - + + public final Printable getPrintable() { return painter.getPrintable(); } @@ -825,7 +825,7 @@ public class JEditTextArea extends JComponent * Set document with a twist, includes the old caret * and scroll positions, added for p5. [fry] */ - public void setDocument(SyntaxDocument document, + public void setDocument(SyntaxDocument document, int start, int stop, int scroll) { if (this.document == document) return; @@ -849,7 +849,7 @@ public class JEditTextArea extends JComponent public final TokenMarker getTokenMarker() { return document.getTokenMarker(); } - + /** * Sets the document's token marker. Equivalent to caling @@ -860,7 +860,7 @@ public class JEditTextArea extends JComponent document.setTokenMarker(tokenMarker); } - + /** * Returns the length of the document. Equivalent to calling * getDocument().getLength(). @@ -869,7 +869,7 @@ public class JEditTextArea extends JComponent return document.getLength(); } - + /** * Returns the number of lines in the document. */ @@ -877,7 +877,7 @@ public class JEditTextArea extends JComponent return document.getDefaultRootElement().getElementCount(); } - + /** * Returns the line containing the specified offset. * @param offset The offset @@ -886,7 +886,7 @@ public class JEditTextArea extends JComponent return document.getDefaultRootElement().getElementIndex(offset); } - + /** * Returns the start offset of the specified line. * @param line The line @@ -898,7 +898,7 @@ public class JEditTextArea extends JComponent return (lineElement == null) ? -1 : lineElement.getStartOffset(); } - + public int getLineStartNonWhiteSpaceOffset(int line) { int offset = getLineStartOffset(line); int length = getLineLength(line); @@ -912,7 +912,7 @@ public class JEditTextArea extends JComponent return offset + length; } - + /** * Returns the end offset of the specified line. * @param line The line @@ -924,7 +924,7 @@ public class JEditTextArea extends JComponent return (lineElement == null) ? -1 : lineElement.getEndOffset(); } - + public int getLineStopNonWhiteSpaceOffset(int line) { int offset = getLineStopOffset(line); int length = getLineLength(line); @@ -938,7 +938,7 @@ public class JEditTextArea extends JComponent return offset - length; } - + /** * Returns the start offset of the line after this line, or the end of * this line if there is no next line. @@ -948,29 +948,29 @@ public class JEditTextArea extends JComponent */ public int getLineSelectionStopOffset(int line) { Element lineElement = document.getDefaultRootElement().getElement(line); - return (lineElement == null) ? -1 : + return (lineElement == null) ? -1 : Math.min(lineElement.getEndOffset(), getDocumentLength()); } - + /** * Returns the length of the specified line. * @param line The line */ public int getLineLength(int line) { Element lineElement = document.getDefaultRootElement().getElement(line); - return (lineElement == null) ? -1 : + return (lineElement == null) ? -1 : lineElement.getEndOffset() - lineElement.getStartOffset() - 1; } - + /** * Returns the entire text of this text area. */ public String getText() { try { return document.getText(0,document.getLength()); - + } catch(BadLocationException bl) { bl.printStackTrace(); return null; @@ -1005,13 +1005,13 @@ public class JEditTextArea extends JComponent public final String getText(int start, int len) { try { return document.getText(start,len); - + } catch(BadLocationException bl) { bl.printStackTrace(); return null; } } - + /** * Copies the specified substring of the document into a segment. @@ -1023,14 +1023,14 @@ public class JEditTextArea extends JComponent public final void getText(int start, int len, Segment segment) { try { document.getText(start,len,segment); - + } catch(BadLocationException bl) { bl.printStackTrace(); segment.offset = segment.count = 0; } } - + /** * Returns the text on the specified line. * @param lineIndex The line @@ -1041,7 +1041,7 @@ public class JEditTextArea extends JComponent return getText(start,getLineStopOffset(lineIndex) - start - 1); } - + /** * Copies the text on the specified line into a segment. If the line * is invalid, the segment will contain a null string. @@ -1051,7 +1051,7 @@ public class JEditTextArea extends JComponent int start = getLineStartOffset(lineIndex); getText(start,getLineStopOffset(lineIndex) - start - 1,segment); } - + /** * Returns the selection start offset. @@ -1060,7 +1060,7 @@ public class JEditTextArea extends JComponent return selectionStart; } - + /** * Returns the offset where the selection starts on the specified * line. @@ -1302,13 +1302,13 @@ public class JEditTextArea extends JComponent scrollToCaret(); - // notify the line number feller - if (editorLineStatus != null) { - editorLineStatus.set(selectionStartLine, selectionEndLine); - //System.out.println("why " + selectionStartLine + " " + selectionEndLine); - //System.out.println(getLineOfOffset(start) + " " + - // getLineOfOffset(end)); - } +// // notify the line number feller +// if (editorLineStatus != null) { +// editorLineStatus.set(selectionStartLine, selectionEndLine); +// //System.out.println("why " + selectionStartLine + " " + selectionEndLine); +// //System.out.println(getLineOfOffset(start) + " " + +// // getLineOfOffset(end)); +// } } private enum CharacterKinds { @@ -1440,9 +1440,9 @@ public class JEditTextArea extends JComponent if (rectSelect) { Element map = document.getDefaultRootElement(); - int start = selectionStart - + int start = selectionStart - map.getElement(selectionStartLine).getStartOffset(); - int end = selectionEnd - + int end = selectionEnd - map.getElement(selectionEndLine).getStartOffset(); // Certain rectangles satisfy this condition... @@ -1488,14 +1488,14 @@ public class JEditTextArea extends JComponent } catch(BadLocationException bl) { bl.printStackTrace(); throw new InternalError("Cannot replace selection"); - + } finally { // No matter what happens... stops us from leaving document in a bad state document.endCompoundEdit(); } setCaretPosition(selectionEnd); } - + /** * Returns true if this text area is editable, false otherwise. @@ -1504,7 +1504,7 @@ public class JEditTextArea extends JComponent return editable; } - + /** * Sets if this component is editable. * @param editable True if this text area should be editable, @@ -1514,7 +1514,7 @@ public class JEditTextArea extends JComponent this.editable = editable; } - + /** * Returns the right click popup menu. */ @@ -1522,7 +1522,7 @@ public class JEditTextArea extends JComponent return popup; } - + /** * Sets the right click popup menu. * @param popup The popup @@ -1539,7 +1539,7 @@ public class JEditTextArea extends JComponent public final int getMagicCaretPosition() { return magicCaret; } - + /** * Sets the 'magic' caret position. This can be used to preserve @@ -1550,7 +1550,7 @@ public class JEditTextArea extends JComponent this.magicCaret = magicCaret; } - + /** * Similar to setSelectedText(), but overstrikes the * appropriate number of characters if overwrite mode is enabled. @@ -1930,10 +1930,10 @@ public class JEditTextArea extends JComponent } } - /** - * The component that tracks the current line number. - */ - public EditorLineStatus editorLineStatus; +// /** +// * The component that tracks the current line number. +// */ +// public EditorLineStatus editorLineStatus; /* @@ -1963,8 +1963,8 @@ public class JEditTextArea extends JComponent } } */ - - + + public void processKeyEvent(KeyEvent event) { // this had to be added in Processing 007X, because the menu key // events weren't making it up to the frame. @@ -1985,7 +1985,7 @@ public class JEditTextArea extends JComponent } } - + // protected members protected static String CENTER = "center"; protected static String RIGHT = "right"; @@ -2394,7 +2394,7 @@ public class JEditTextArea extends JComponent class FocusHandler implements FocusListener { - + public void focusGained(FocusEvent evt) { setCaretVisible(true); } @@ -2406,7 +2406,7 @@ public class JEditTextArea extends JComponent class MouseHandler extends MouseAdapter { - + public void mousePressed(MouseEvent event) { // try { // requestFocus(); @@ -2426,11 +2426,11 @@ public class JEditTextArea extends JComponent return; } - // isPopupTrigger() is handled differently across platforms, - // so it may fire during release, or during the press. + // isPopupTrigger() is handled differently across platforms, + // so it may fire during release, or during the press. // http://docs.oracle.com/javase/7/docs/api/java/awt/event/MouseEvent.html#isPopupTrigger() // However, we have to exit out of this method if it's a right-click - // anyway, because otherwise it'll de-select the current word. + // anyway, because otherwise it'll de-select the current word. // As a result, better to just check for BUTTON3 now, indicating that // isPopupTrigger() is going to fire on the release anyway. boolean windowsRightClick = @@ -2479,7 +2479,7 @@ public class JEditTextArea extends JComponent /* - // Because isPopupTrigger() is handled differently across platforms, + // Because isPopupTrigger() is handled differently across platforms, // it may fire during release, or during the press. // http://docs.oracle.com/javase/7/docs/api/java/awt/event/MouseEvent.html#isPopupTrigger() public void mouseReleased(MouseEvent event) { @@ -2488,8 +2488,8 @@ public class JEditTextArea extends JComponent } } */ - - + + private void doSingleClick(MouseEvent evt, int line, int offset, int dot) { if ((evt.getModifiers() & InputEvent.SHIFT_MASK) != 0) { rectSelect = (evt.getModifiers() & InputEvent.CTRL_MASK) != 0; @@ -2500,7 +2500,7 @@ public class JEditTextArea extends JComponent } - private void doDoubleClick(MouseEvent evt, int line, int offset, + private void doDoubleClick(MouseEvent evt, int line, int offset, int dot) throws BadLocationException { // Ignore empty lines if (getLineLength(line) != 0) { @@ -2539,7 +2539,7 @@ public class JEditTextArea extends JComponent } } - + private void doTripleClick(MouseEvent evt, int line, int offset, int dot) { selectLine = true; select(getLineStartOffset(line),getLineSelectionStopOffset(line)); @@ -2548,7 +2548,7 @@ public class JEditTextArea extends JComponent } } - + class CaretUndo extends AbstractUndoableEdit { private int start; private int end; diff --git a/java/.classpath b/java/.classpath index 839265b88..c54fe36e4 100644 --- a/java/.classpath +++ b/java/.classpath @@ -1,7 +1,7 @@ - + diff --git a/todo.txt b/todo.txt index c8166fe40..fe90f9e3e 100644 --- a/todo.txt +++ b/todo.txt @@ -1,6 +1,14 @@ 0236 (3.0a9) X show screen dimensions in the Preferences window +gui +X implement the bottom half of the editor window +X editor window draws in stages (at least on OS X) on first view +X the console/bottom area stays white until an additional repaint? +X fixed these issues and replaced with footer +X remove EditorLineStatus (we have line numbers) + + pdex/debugger X remove "Experimental Mode: Yikes!" messages o NullPointerException in initiateToolTip() @@ -29,16 +37,8 @@ X remove focus border from the Variables window in alpha 8 (but not confirmed in time) X "step" not working properly X https://github.com/processing/processing/issues/3266 -_ Cmd-click behavior on function/variable is firing when cmd-click not pressed -_ https://github.com/processing/processing/issues/3242 - - -pdex -_ crashed on startup w/ JavaScript mode as default b/c PdeKeyListener not found -_ because it's in the other ClassLoader, can no longer rely on it -_ remove JavaMode.errorLogsEnabled and JavaEditor.writeErrorsToFile() -_ disable the debug toggle menu while running -_ otherwise could run in one mode, then try to stop in another +X Cmd-click behavior on function/variable is firing when cmd-click not pressed +X https://github.com/processing/processing/issues/3242 breakage @@ -58,10 +58,6 @@ _ https://github.com/processing/processing/issues/3298 _ need active state for the butterfly _ finish the gui _ https://github.com/processing/processing/issues/3072 -_ implement the bottom half of the editor window -_ editor window draws in stages (at least on OS X) on first view -_ the console/bottom area stays white until an additional repaint? -_ remove EditorLineStatus (we have line numbers) _ add a "what's new" window to explain features in 3 @@ -81,9 +77,14 @@ _ need a decent sans with with Unicode coverage _ i.e. https://github.com/processing/processing/pull/3025 _ deactivate step, continue, stop when not running? _ update EditorButton rollover label when pressing shift or alt +_ disable the debug toggle menu while running +_ otherwise could run in one mode, then try to stop in another pde/build +_ crashed on startup w/ JavaScript mode as default b/c PdeKeyListener not found +_ because it's in the other ClassLoader, can no longer rely on it +_ remove JavaMode.errorLogsEnabled and JavaEditor.writeErrorsToFile() _ make sure "PDF Export" is showing for the library name _ we've lost arrow keys to expand items in the examples window _ sketchbook window too?