diff --git a/app/src/processing/app/ui/EditorStatus.java b/app/src/processing/app/ui/EditorStatus.java index 45061b139..7271320ec 100644 --- a/app/src/processing/app/ui/EditorStatus.java +++ b/app/src/processing/app/ui/EditorStatus.java @@ -36,7 +36,9 @@ import processing.app.Mode; */ public class EditorStatus extends BasicSplitPaneDivider { //JPanel { static final int HIGH = 28; - static final int GUI_SMALL = 6; + static final int LEFT_MARGIN = Editor.LEFT_GUTTER; + static final int RIGHT_MARGIN = 20; + Color[] bgcolor; Color[] fgcolor; @@ -214,14 +216,14 @@ public class EditorStatus extends BasicSplitPaneDivider { //JPanel { // https://github.com/processing/processing/issues/3265 if (message != null) { g.setFont(font); // needs to be set each time on osx - g.drawString(message, GUI_SMALL, (sizeH + ascent) / 2); + g.drawString(message, LEFT_MARGIN, (sizeH + ascent) / 2); } if (indeterminate) { //int x = cancelButton.getX(); //int w = cancelButton.getWidth(); int w = Toolkit.BUTTON_WIDTH; - int x = getWidth() - GUI_SMALL - w; + int x = getWidth() - RIGHT_MARGIN - w; int y = getHeight() / 3; int h = getHeight() / 3; g.setColor(new Color(0x80000000, true)); diff --git a/build/shared/lib/theme.txt b/build/shared/lib/theme.txt index 4cccf9b42..22c8874ff 100644 --- a/build/shared/lib/theme.txt +++ b/build/shared/lib/theme.txt @@ -3,10 +3,11 @@ status.notice.fgcolor = #000000 status.notice.bgcolor = #818b95 status.error.fgcolor = #ffffff -status.error.bgcolor = #662000 +#status.error.bgcolor = #662000 +status.error.bgcolor = #9e1916 status.edit.fgcolor = #000000 status.edit.bgcolor = #cc9900 -status.font = processing.sans,plain,14 +status.font = processing.sans,plain,13 # TABS # Settings for the tab area at the top. @@ -33,7 +34,11 @@ footer.tab.unselected.color = #2d4251 # The font is handled by preferences, so its size/etc are modifiable. console.color = #000000 console.output.color = #cccccc -console.error.color = #ff3000 +#console.error.color = #ff3000 +# too dark! +#console.error.color = #9e1916 +# brightened version +console.error.color = #d9211e # TOOLBAR BUTTONS buttons.bgcolor = #000000 diff --git a/java/src/processing/mode/java/JavaEditor.java b/java/src/processing/mode/java/JavaEditor.java index 53585cc7a..867a71119 100644 --- a/java/src/processing/mode/java/JavaEditor.java +++ b/java/src/processing/mode/java/JavaEditor.java @@ -234,6 +234,7 @@ public class JavaEditor extends Editor { // errorTableScrollPane.setBorder(new EmptyBorder(2, 2, 2, 2)); // errorTableScrollPane.setBorder(new EtchedBorder()); errorTableScrollPane.setBorder(BorderFactory.createEmptyBorder()); +// errorTableScrollPane.setBorder(new EmptyBorder(0, Editor.LEFT_GUTTER, 0, 0)); errorTableScrollPane.setViewportView(errorTable); // // Adding toggle console button diff --git a/java/src/processing/mode/java/pdex/XQErrorTable.java b/java/src/processing/mode/java/pdex/XQErrorTable.java index 7ecc204df..3ea58bee4 100644 --- a/java/src/processing/mode/java/pdex/XQErrorTable.java +++ b/java/src/processing/mode/java/pdex/XQErrorTable.java @@ -1,26 +1,27 @@ /* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ /* -Part of the Processing project - http://processing.org -Copyright (c) 2012-15 The Processing Foundation + Part of the Processing project - http://processing.org + Copyright (c) 2012-15 The Processing Foundation -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License version 2 -as published by the Free Software Foundation. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 + as published by the Free Software Foundation. -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. + 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. -51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + 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. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package processing.mode.java.pdex; import java.awt.Color; +import java.awt.Font; import java.awt.FontMetrics; import java.awt.event.*; import java.util.List; @@ -29,47 +30,46 @@ import javax.swing.*; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import javax.swing.table.JTableHeader; +import javax.swing.table.TableColumnModel; import javax.swing.table.TableModel; import javax.swing.text.BadLocationException; import processing.app.Base; import processing.app.Language; +import processing.app.ui.Editor; +import processing.app.ui.Toolkit; import processing.mode.java.JavaEditor; -/** - * Custom JTable implementation for XQMode. Minor tweaks and addtions. - * @author Manindra Moharana <me@mkmoharana.com> - */ public class XQErrorTable extends JTable { - JavaEditor editor; + Editor editor; - /** Column Names of JTable */ - public static final String[] columnNames = { + static final String[] columnNames = { Language.text("editor.footer.errors.problem"), Language.text("editor.footer.errors.tab"), Language.text("editor.footer.errors.line") }; - /** Column Widths of JTable. */ - public int[] columnWidths = { 600, 100, 50 }; // Default Values + int[] columnWidths = { 400, 100, 50 }; /** Is the column being resized? */ private boolean columnResizing = false; - /** ErrorCheckerService instance */ -// protected ErrorCheckerService errorCheckerService; - -// public XQErrorTable(final ErrorCheckerService errorCheckerService) { -// this.errorCheckerService = errorCheckerService; public XQErrorTable(final JavaEditor editor) { this.editor = editor; - for (int i = 0; i < this.getColumnModel().getColumnCount(); i++) { - getColumnModel().getColumn(i).setPreferredWidth(columnWidths[i]); - } + JTableHeader header = getTableHeader(); - getTableHeader().setReorderingAllowed(false); + // Try to make things a little less awful until I find time to finish it + Font font = Toolkit.getSansFont(12, Font.PLAIN); + setFont(font); + header.setFont(font); + //setBorder(new EmptyBorder(0, Editor.LEFT_GUTTER, 0, 0)); // no effect + + TableColumnModel columnModel = getColumnModel(); + for (int i = 0; i < columnModel.getColumnCount(); i++) { + columnModel.getColumn(i).setPreferredWidth(columnWidths[i]); + } addMouseListener(new MouseAdapter() { @Override @@ -83,10 +83,7 @@ public class XQErrorTable extends JTable { } }); -// final XQErrorTable thisTable = this; - - this.addMouseMotionListener(new MouseMotionAdapter() { - + addMouseMotionListener(new MouseMotionAdapter() { @Override public void mouseMoved(MouseEvent evt) { int rowIndex = rowAtPoint(evt.getPoint()); @@ -117,11 +114,13 @@ public class XQErrorTable extends JTable { } }); + header.setReorderingAllowed(false); + // Handles the resizing of columns. When mouse press is detected on // table header, Stop updating the table, store new values of column // widths,and resume updating. Updating is disabled as long as // columnResizing is true - this.getTableHeader().addMouseListener(new MouseAdapter() { + header.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { @@ -131,9 +130,10 @@ public class XQErrorTable extends JTable { @Override public void mouseReleased(MouseEvent e) { columnResizing = false; - for (int i = 0; i < ((JTableHeader) e.getSource()).getColumnModel().getColumnCount(); i++) { - columnWidths[i] = ((JTableHeader) e.getSource()).getColumnModel().getColumn(i).getWidth(); - // System.out.println("nw " + columnWidths[i]); + TableColumnModel columnModel = + ((JTableHeader) e.getSource()).getColumnModel(); + for (int i = 0; i < columnModel.getColumnCount(); i++) { + columnWidths[i] = columnModel.getColumn(i).getWidth(); } } }); @@ -144,7 +144,7 @@ public class XQErrorTable extends JTable { @Override public boolean isCellEditable(int rowIndex, int colIndex) { - return false; // Disallow the editing of any cell + return false; // Disallow the editing of any cell } @@ -154,11 +154,7 @@ public class XQErrorTable extends JTable { * @return boolean - If table data was updated */ synchronized public boolean updateTable(final TableModel tableModel) { - - // If problems list is not visible, no need to update - if (!this.isVisible()) { - return false; - } + if (!isVisible()) return false; SwingWorker worker = new SwingWorker() { @@ -172,8 +168,7 @@ public class XQErrorTable extends JTable { // Set column widths to user defined widths for (int i = 0; i < getColumnModel().getColumnCount(); i++) { - getColumnModel().getColumn(i).setPreferredWidth( - columnWidths[i]); + getColumnModel().getColumn(i).setPreferredWidth(columnWidths[i]); } getTableHeader().setReorderingAllowed(false); validate(); @@ -200,7 +195,7 @@ public class XQErrorTable extends JTable { JFrame frmImportSuggest; - private void showImportSuggestion(String list[], int x, int y){ + private void showImportSuggestion(String[] list, int x, int y) { if (frmImportSuggest != null) { // frmImportSuggest.setVisible(false); // frmImportSuggest = null;