mirror of
https://github.com/processing/processing4.git
synced 2026-01-29 19:31:16 +01:00
ui rework in progress
This commit is contained in:
@@ -37,7 +37,6 @@ import processing.mode.java.debug.LineID;
|
||||
import processing.mode.java.pdex.ErrorCheckerService;
|
||||
import processing.mode.java.pdex.ErrorMarker;
|
||||
import processing.mode.java.pdex.ErrorMessageSimplifier;
|
||||
import processing.mode.java.pdex.ImportStatement;
|
||||
import processing.mode.java.pdex.JavaTextArea;
|
||||
import processing.mode.java.pdex.Problem;
|
||||
import processing.mode.java.pdex.XQConsoleToggle;
|
||||
|
||||
@@ -36,6 +36,7 @@ import javax.swing.DefaultListModel;
|
||||
import javax.swing.SwingWorker;
|
||||
|
||||
import processing.app.Base;
|
||||
import processing.app.Editor;
|
||||
import processing.app.Mode;
|
||||
import processing.app.syntax.JEditTextArea;
|
||||
import processing.app.syntax.PdeTextAreaDefaults;
|
||||
@@ -46,9 +47,9 @@ public class JavaTextArea extends JEditTextArea {
|
||||
protected PdeTextAreaDefaults defaults;
|
||||
protected JavaEditor editor;
|
||||
|
||||
static final int LEFT_GUTTER = 59;
|
||||
static final int RIGHT_GUTTER = 27;
|
||||
static final int GUTTER_MARGIN = 3;
|
||||
// static final int LEFT_GUTTER = Editor.LEFT_GUTTER;
|
||||
// static final int RIGHT_GUTTER = Editor.RIGHT_GUTTER;
|
||||
// static final int GUTTER_MARGIN = 3;
|
||||
|
||||
protected MouseListener[] mouseListeners; // cached mouselisteners, these are wrapped by MouseHandler
|
||||
|
||||
@@ -669,7 +670,7 @@ public class JavaTextArea extends JEditTextArea {
|
||||
*/
|
||||
@Override
|
||||
public int _offsetToX(int line, int offset) {
|
||||
return super._offsetToX(line, offset) + LEFT_GUTTER;
|
||||
return super._offsetToX(line, offset) + Editor.LEFT_GUTTER;
|
||||
}
|
||||
|
||||
|
||||
@@ -685,7 +686,7 @@ public class JavaTextArea extends JEditTextArea {
|
||||
*/
|
||||
@Override
|
||||
public int xToOffset(int line, int x) {
|
||||
return super.xToOffset(line, x - LEFT_GUTTER);
|
||||
return super.xToOffset(line, x - Editor.LEFT_GUTTER);
|
||||
}
|
||||
|
||||
|
||||
@@ -709,7 +710,7 @@ public class JavaTextArea extends JEditTextArea {
|
||||
@Override
|
||||
public void mousePressed(MouseEvent me) {
|
||||
// check if this happened in the gutter area
|
||||
if (me.getX() < LEFT_GUTTER) {
|
||||
if (me.getX() < Editor.LEFT_GUTTER) {
|
||||
if (me.getButton() == MouseEvent.BUTTON1 && me.getClickCount() == 2) {
|
||||
int line = me.getY() / painter.getFontMetrics().getHeight()
|
||||
+ firstLine;
|
||||
@@ -766,12 +767,12 @@ public class JavaTextArea extends JEditTextArea {
|
||||
@Override
|
||||
public void mouseMoved(MouseEvent me) {
|
||||
// No need to forward since the standard MouseMotionListeners are called anyway
|
||||
if (me.getX() < LEFT_GUTTER) {
|
||||
if (lastX >= LEFT_GUTTER) {
|
||||
if (me.getX() < Editor.LEFT_GUTTER) {
|
||||
if (lastX >= Editor.LEFT_GUTTER) {
|
||||
painter.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
|
||||
}
|
||||
} else {
|
||||
if (lastX < LEFT_GUTTER) {
|
||||
if (lastX < Editor.LEFT_GUTTER) {
|
||||
painter.setCursor(new Cursor(Cursor.TEXT_CURSOR));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,11 +43,13 @@ import java.util.List;
|
||||
|
||||
|
||||
|
||||
|
||||
import javax.swing.text.BadLocationException;
|
||||
import javax.swing.text.Segment;
|
||||
import javax.swing.text.Utilities;
|
||||
|
||||
import processing.app.Base;
|
||||
import processing.app.Editor;
|
||||
import processing.app.SketchCode;
|
||||
import processing.app.syntax.SyntaxDocument;
|
||||
import processing.app.syntax.TextAreaDefaults;
|
||||
@@ -182,7 +184,7 @@ public class JavaTextAreaPainter extends TextAreaPainter
|
||||
try {
|
||||
// TODO This line is causing NPEs randomly ever since I added the
|
||||
// toggle for Java Mode/Debugger toolbar. [Manindra]
|
||||
super.paintLine(gfx, line, x + JavaTextArea.LEFT_GUTTER, tokenMarker);
|
||||
super.paintLine(gfx, line, x + Editor.LEFT_GUTTER, tokenMarker);
|
||||
|
||||
} catch (Exception e) {
|
||||
Base.log(e.getMessage());
|
||||
@@ -210,7 +212,7 @@ public class JavaTextAreaPainter extends TextAreaPainter
|
||||
protected void paintGutterBg(Graphics gfx, int line, int x) {
|
||||
gfx.setColor(getTextArea().gutterBgColor);
|
||||
int y = textArea.lineToY(line) + fm.getLeading() + fm.getMaxDescent();
|
||||
gfx.fillRect(0, y, JavaTextArea.LEFT_GUTTER, fm.getHeight());
|
||||
gfx.fillRect(0, y, Editor.LEFT_GUTTER, fm.getHeight());
|
||||
}
|
||||
|
||||
|
||||
@@ -227,8 +229,8 @@ public class JavaTextAreaPainter extends TextAreaPainter
|
||||
protected void paintGutterLine(Graphics gfx, int line, int x) {
|
||||
int y = textArea.lineToY(line) + fm.getLeading() + fm.getMaxDescent();
|
||||
gfx.setColor(getTextArea().gutterLineColor);
|
||||
gfx.drawLine(JavaTextArea.LEFT_GUTTER, y,
|
||||
JavaTextArea.LEFT_GUTTER, y + fm.getHeight());
|
||||
gfx.drawLine(Editor.LEFT_GUTTER, y,
|
||||
Editor.LEFT_GUTTER, y + fm.getHeight());
|
||||
}
|
||||
|
||||
|
||||
@@ -260,13 +262,13 @@ public class JavaTextAreaPainter extends TextAreaPainter
|
||||
// draw 4 times to make it appear bold, displaced 1px to the right, to the bottom and bottom right.
|
||||
//int len = text.length() > ta.gutterChars ? ta.gutterChars : text.length();
|
||||
Utilities.drawTabbedText(new Segment(text.toCharArray(), 0, text.length()),
|
||||
JavaTextArea.GUTTER_MARGIN, y, gfx, this, 0);
|
||||
Editor.GUTTER_MARGIN, y, gfx, this, 0);
|
||||
Utilities.drawTabbedText(new Segment(text.toCharArray(), 0, text.length()),
|
||||
JavaTextArea.GUTTER_MARGIN + 1, y, gfx, this, 0);
|
||||
Editor.GUTTER_MARGIN + 1, y, gfx, this, 0);
|
||||
Utilities.drawTabbedText(new Segment(text.toCharArray(), 0, text.length()),
|
||||
JavaTextArea.GUTTER_MARGIN, y + 1, gfx, this, 0);
|
||||
Editor.GUTTER_MARGIN, y + 1, gfx, this, 0);
|
||||
Utilities.drawTabbedText(new Segment(text.toCharArray(), 0, text.length()),
|
||||
JavaTextArea.GUTTER_MARGIN + 1, y + 1, gfx, this, 0);
|
||||
Editor.GUTTER_MARGIN + 1, y + 1, gfx, this, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -373,8 +375,8 @@ public class JavaTextAreaPainter extends TextAreaPainter
|
||||
int x1 = fm.stringWidth(goodCode) + (aw - rw), y1 = y + fm.getHeight()
|
||||
- 2, x2 = x1 + rw;
|
||||
// Adding offsets for the gutter
|
||||
x1 += JavaTextArea.LEFT_GUTTER;
|
||||
x2 += JavaTextArea.LEFT_GUTTER;
|
||||
x1 += Editor.LEFT_GUTTER;
|
||||
x2 += Editor.LEFT_GUTTER;
|
||||
|
||||
// gfx.fillRect(x1, y, rw, height);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user