diff --git a/app/src/processing/app/Editor.java b/app/src/processing/app/Editor.java index 9445b0ef7..88cecee04 100644 --- a/app/src/processing/app/Editor.java +++ b/app/src/processing/app/Editor.java @@ -30,6 +30,7 @@ import processing.core.*; import java.awt.BorderLayout; import java.awt.Component; +import java.awt.Container; import java.awt.Dimension; import java.awt.EventQueue; import java.awt.Frame; @@ -95,9 +96,9 @@ public abstract class Editor extends JFrame implements RunnerListener { protected JEditTextArea textarea; protected EditorStatus status; protected JSplitPane splitPane; - protected JPanel consolePanel; + protected Container consolePanel; protected EditorConsole console; - protected EditorLineStatus lineStatus; +// protected EditorLineStatus lineStatus; // currently opened program protected Sketch sketch; @@ -245,20 +246,7 @@ public abstract class Editor extends JFrame implements RunnerListener { textarea.setRightClickPopup(new TextAreaPopup()); textarea.setHorizontalOffset(JEditTextArea.leftHandGutter); - // assemble console panel, consisting of status area and the console itself - consolePanel = new JPanel(); - consolePanel.setLayout(new BorderLayout()); - -// status = new EditorStatus(this); -// consolePanel.add(status, BorderLayout.NORTH); - - console = new EditorConsole(this); - // windows puts an ugly border on this guy - console.setBorder(null); - consolePanel.add(console, BorderLayout.CENTER); - - lineStatus = new EditorLineStatus(this); - consolePanel.add(lineStatus, BorderLayout.SOUTH); + consolePanel = createConsolePanel(); upper.add(textarea); @@ -429,6 +417,25 @@ public abstract class Editor extends JFrame implements RunnerListener { } + public Container createConsolePanel() { + // assemble console panel, consisting of status area and the console itself + JPanel panel = new JPanel(); + panel.setLayout(new BorderLayout()); + +// status = new EditorStatus(this); +// consolePanel.add(status, BorderLayout.NORTH); + + console = new EditorConsole(this); + // windows puts an ugly border on this guy + console.setBorder(null); + panel.add(console, BorderLayout.CENTER); + +// lineStatus = new EditorLineStatus(this); +// consolePanel.add(lineStatus, BorderLayout.SOUTH); + return panel; + } + + public EditorState getEditorState() { return state; } diff --git a/java/src/processing/mode/java/JavaEditor.java b/java/src/processing/mode/java/JavaEditor.java index 46a9df704..efbb35608 100644 --- a/java/src/processing/mode/java/JavaEditor.java +++ b/java/src/processing/mode/java/JavaEditor.java @@ -156,53 +156,23 @@ public class JavaEditor extends Editor { errorCheckerService = new ErrorCheckerService(this); new Thread(errorCheckerService).start(); - getJavaTextArea().setECSandThemeforTextArea(errorCheckerService, jmode); - - // Adding ErrorBar + // hack to add a JPanel to the right-hand side of the text area JPanel textAndError = new JPanel(); -// Box box = (Box) textarea.getParent(); -// box.remove(2); // Remove textArea from it's container, i.e Box + // parent is a vertical box with the toolbar, the header, and the text area + Box box = (Box) textarea.getParent(); + // remove the text area temporarily + box.remove(2); textAndError.setLayout(new BorderLayout()); errorBar = new ErrorBar(this, textarea.getMinimumSize().height, jmode); textAndError.add(errorBar, BorderLayout.EAST); textarea.setBounds(0, 0, errorBar.getX() - 1, textarea.getHeight()); textAndError.add(textarea); -// box.add(textAndError); + // add our hacked version back to the editor + box.add(textAndError); - // Adding Error Table in a scroll pane - errorTableScrollPane = new JScrollPane(); - errorTable = new XQErrorTable(errorCheckerService); - // errorTableScrollPane.setBorder(new EmptyBorder(2, 2, 2, 2)); - errorTableScrollPane.setBorder(new EtchedBorder()); - errorTableScrollPane.setViewportView(errorTable); + getJavaTextArea().setECSandThemeforTextArea(errorCheckerService, jmode); - // Adding toggle console button -// consolePanel.remove(2); - JPanel lineStatusPanel = new JPanel(); - lineStatusPanel.setLayout(new BorderLayout()); - btnShowConsole = new XQConsoleToggle(this, Language.text("editor.footer.console"), lineStatus.getHeight()); - btnShowErrors = new XQConsoleToggle(this, Language.text("editor.footer.errors"), lineStatus.getHeight()); - btnShowConsole.addMouseListener(btnShowConsole); - btnShowErrors.addMouseListener(btnShowErrors); - - JPanel toggleButtonPanel = new JPanel(new BorderLayout()); - toggleButtonPanel.add(btnShowConsole, BorderLayout.EAST); - toggleButtonPanel.add(btnShowErrors, BorderLayout.WEST); - lineStatusPanel.add(toggleButtonPanel, BorderLayout.EAST); - lineStatus.setBounds(0, 0, toggleButtonPanel.getX() - 1, - toggleButtonPanel.getHeight()); - lineStatusPanel.add(lineStatus); -// consolePanel.add(lineStatusPanel, BorderLayout.SOUTH); - lineStatusPanel.repaint(); - - // Adding JPanel with CardLayout for Console/Problems Toggle -// consolePanel.remove(1); - consoleProblemsPane = new JPanel(new CardLayout()); - consoleProblemsPane.add(errorTableScrollPane, Language.text("editor.footer.errors")); - consoleProblemsPane.add(console, Language.text("editor.footer.console")); -// consolePanel.add(consoleProblemsPane, BorderLayout.CENTER); - - // ensure completion gets hidden on editor losing focus + // ensure completion is hidden when editor loses focus addWindowFocusListener(new WindowFocusListener() { public void windowLostFocus(WindowEvent e) { getJavaTextArea().hideSuggestion(); @@ -236,6 +206,45 @@ public class JavaEditor extends Editor { } + @Override + public Container createConsolePanel() { + // Adding Error Table in a scroll pane + errorTableScrollPane = new JScrollPane(); + errorTable = new XQErrorTable(errorCheckerService); + // errorTableScrollPane.setBorder(new EmptyBorder(2, 2, 2, 2)); + errorTableScrollPane.setBorder(new EtchedBorder()); + errorTableScrollPane.setViewportView(errorTable); + + // Adding toggle console button +// consolePanel.remove(2); // removes the line status + JPanel lineStatusPanel = new JPanel(); + lineStatusPanel.setLayout(new BorderLayout()); + btnShowConsole = new XQConsoleToggle(this, Language.text("editor.footer.console"), mode.getInteger("linestatus.height")); + btnShowErrors = new XQConsoleToggle(this, Language.text("editor.footer.errors"), mode.getInteger("linestatus.height")); + btnShowConsole.addMouseListener(btnShowConsole); + btnShowErrors.addMouseListener(btnShowErrors); + + JPanel toggleButtonPanel = new JPanel(new BorderLayout()); + toggleButtonPanel.add(btnShowConsole, BorderLayout.EAST); + toggleButtonPanel.add(btnShowErrors, BorderLayout.WEST); + lineStatusPanel.add(toggleButtonPanel, BorderLayout.EAST); +// lineStatus.setBounds(0, 0, toggleButtonPanel.getX() - 1, +// toggleButtonPanel.getHeight()); +// lineStatusPanel.add(lineStatus); +// consolePanel.add(lineStatusPanel, BorderLayout.SOUTH); + lineStatusPanel.repaint(); + + // Adding JPanel with CardLayout for Console/Problems Toggle +// consolePanel.remove(1); + consoleProblemsPane = new JPanel(new CardLayout()); + consoleProblemsPane.add(errorTableScrollPane, Language.text("editor.footer.errors")); + consoleProblemsPane.add(super.createConsolePanel(), Language.text("editor.footer.console")); +// consolePanel.add(consoleProblemsPane, BorderLayout.CENTER); + + return consoleProblemsPane; + } + + public Formatter createFormatter() { return new AutoFormat(); } diff --git a/todo.txt b/todo.txt index a4787c551..84336d20c 100644 --- a/todo.txt +++ b/todo.txt @@ -24,6 +24,7 @@ o fix hasJavaTabs() function o almost always used as a negative, or tied to a 'return' from fxn o name isn't tied to its function, but the symptom X update hasJavaTabs on editor header rebuild +X remove focus border from the Variables window in alpha 8 (but not confirmed in time) X "step" not working properly @@ -50,6 +51,7 @@ _ move Library to LibraryContribution and into contrib? gui +_ automatically show the variables window when debugging, hide when not _ need active state for the butterfly _ finish the gui _ https://github.com/processing/processing/issues/3072 @@ -57,7 +59,7 @@ _ 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 promote features in 3? +_ add a "what's new" window to explain features in 3 gui (lower, not blocking for beta) @@ -65,7 +67,6 @@ _ need 'actively pressed' version of 'play' and 'stop' _ could do rollover as well, but do other apps use them? _ iTunes has no rollover state but has a 'down' state _ swaps to stop after release -_ remove focus border from the Variables window _ fonts are still really ugly (on non-retina) _ may need to drop use of Source Sans _ what do these do, and are we doing it already?