moving packages around

This commit is contained in:
benfry
2005-04-16 20:19:23 +00:00
parent ad57106fff
commit 80d66e5fa5
8 changed files with 46 additions and 216 deletions

View File

@@ -236,7 +236,7 @@ public class PdeEmitter implements PdeTokenTypes
* @param ast The AST to print
* @returns true iff anything was printed
*/
private boolean printChildren(AST ast) throws PdeException {
private boolean printChildren(AST ast) throws RunnerException {
boolean ret = false;
AST child = ast.getFirstChild();
while (child != null) {
@@ -326,7 +326,7 @@ public class PdeEmitter implements PdeTokenTypes
/**
* Prints a binary operator
*/
private void printBinaryOperator(AST ast) throws PdeException {
private void printBinaryOperator(AST ast) throws RunnerException {
print(ast.getFirstChild());
out.print(name(ast));
dumpHiddenAfter(ast);
@@ -339,7 +339,7 @@ public class PdeEmitter implements PdeTokenTypes
* It works by making recursive calls to print children.
* So the code below is one big "switch" statement on the passed AST type.
*/
public void print (AST ast) throws PdeException {
public void print (AST ast) throws RunnerException {
if (ast == null) {
return;
}
@@ -755,10 +755,10 @@ public class PdeEmitter implements PdeTokenTypes
case IDENT:
/*
if (ast.getText().equals("Image") &&
PdePreferences.getBoolean("preproc.substitute_image")) { //, true)) {
Preferences.getBoolean("preproc.substitute_image")) { //, true)) {
out.print("BImage");
} else if (ast.getText().equals("Font") &&
PdePreferences.getBoolean("preproc.substitute_font")) { //, true)) {
Preferences.getBoolean("preproc.substitute_font")) { //, true)) {
out.print("BFont");
} else {
*/
@@ -847,7 +847,7 @@ public class PdeEmitter implements PdeTokenTypes
break;
default:
throw new PdeException(PdeCompiler.SUPER_BADNESS);
throw new RunnerException(Compiler.SUPER_BADNESS);
}
// for builtin types, use regular casting syntax
@@ -876,7 +876,7 @@ public class PdeEmitter implements PdeTokenTypes
// making floating point literals default to floats, not doubles
case NUM_DOUBLE:
out.print(ast.getText());
if (PdePreferences.getBoolean("preproc.substitute_floats")) { //, true) ) {
if (Preferences.getBoolean("preproc.substitute_floats")) { //, true) ) {
out.print("f");
}
dumpHiddenAfter(ast);

View File

@@ -76,11 +76,11 @@ public class PdePreprocessor {
*/
public PdePreprocessor() {
defaultImports[JDK11] =
PApplet.split(PdePreferences.get("preproc.imports.jdk11"), ',');
PApplet.split(Preferences.get("preproc.imports.jdk11"), ',');
defaultImports[JDK13] =
PApplet.split(PdePreferences.get("preproc.imports.jdk13"), ',');
PApplet.split(Preferences.get("preproc.imports.jdk13"), ',');
defaultImports[JDK14] =
PApplet.split(PdePreferences.get("preproc.imports.jdk14"), ',');
PApplet.split(Preferences.get("preproc.imports.jdk14"), ',');
}
@@ -106,7 +106,7 @@ public class PdePreprocessor {
program += "\n";
}
if (PdePreferences.getBoolean("preproc.substitute_unicode")) {
if (Preferences.getBoolean("preproc.substitute_unicode")) {
// check for non-ascii chars (these will be/must be in unicode format)
char p[] = program.toCharArray();
int unicodeCount = 0;
@@ -185,7 +185,7 @@ public class PdePreprocessor {
// if using opengl, add it to the special imports
/*
if (PdePreferences.get("renderer").equals("opengl")) {
if (Preferences.get("renderer").equals("opengl")) {
extraImports = new String[imports.size() + 1];
imports.copyInto(extraImports);
extraImports[extraImports.length - 1] = "processing.opengl.*";
@@ -296,7 +296,7 @@ public class PdePreprocessor {
// if desired, serialize the parse tree to an XML file. can
// be viewed usefully with Mozilla or IE
if (PdePreferences.getBoolean("preproc.output_parse_tree")) {
if (Preferences.getBoolean("preproc.output_parse_tree")) {
stream = new PrintStream(new FileOutputStream("parseTree.xml"));
stream.println("<?xml version=\"1.0\"?>");
@@ -341,7 +341,7 @@ public class PdePreprocessor {
// emit standard imports (read from pde.properties)
// for each language level that's being used.
String jdkVersionStr = PdePreferences.get("preproc.jdk_version");
String jdkVersionStr = Preferences.get("preproc.jdk_version");
int jdkVersion = JDK11; // default
if (jdkVersionStr.equals("1.3")) { jdkVersion = JDK13; };
@@ -353,7 +353,7 @@ public class PdePreprocessor {
}
}
//boolean opengl = PdePreferences.get("renderer").equals("opengl");
//boolean opengl = Preferences.get("renderer").equals("opengl");
//if (opengl) {
//out.println("import processing.opengl.*; ");
//}

View File

@@ -73,7 +73,7 @@ constant
// of the form #cc008f in PDE
webcolor_literal
: w:WEBCOLOR_LITERAL
{ PdePreferences.getBoolean("preproc.web_colors") &&
{ Preferences.getBoolean("preproc.web_colors") &&
w.getText().length() == 6 }? // must be exactly 6 hex digits
;
@@ -97,7 +97,7 @@ builtInConsCastType
builtInType
: builtInConsCastType
| "color" // aliased to an int in PDE
{ PdePreferences.getBoolean("preproc.color_datatype") }?
{ Preferences.getBoolean("preproc.color_datatype") }?
;
// constructor style casts.
@@ -170,7 +170,7 @@ colorMethodCall
// alternatives
primaryExpression
: (consCastTypeSpec[false] LPAREN) => constructorCast
{ PdePreferences.getBoolean("preproc.enhanced_casting") }?
{ Preferences.getBoolean("preproc.enhanced_casting") }?
| identPrimary ( options {greedy=true;} : DOT^ "class" )?
| constant
| "true"

View File

@@ -1588,12 +1588,12 @@ public class JEditTextArea extends JComponent
* This is slightly faster than using a KeyListener
* because some Swing overhead is avoided.
*/
public PdeEditorListener editorListener;
public EditorListener editorListener;
/**
* The component that tracks the current line number.
*/
public PdeEditorLineStatus editorLineStatus;
public EditorLineStatus editorLineStatus;
public void processKeyEvent(KeyEvent evt) {

View File

@@ -1,170 +0,0 @@
/* -*- mode: jde; c-basic-offset: 2; indent-tabs-mode: nil -*- */
/*
PdeEditorListener - filter key events for tab expansion/indent/etc
Part of the Processing project - http://processing.org
Except where noted, code is written by Ben Fry and
Copyright (c) 2001-04 Massachusetts Institute of Technology
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.syntax;
import processing.app.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.text.*;
import javax.swing.event.*;
public class PdeEditorListener {
PdeEditor editor;
JEditTextArea textarea;
boolean externalEditor;
boolean expandTabs;
String tabString;
boolean autoIndent;
int selectionStart, selectionEnd;
int position;
public PdeEditorListener(PdeEditor editor, JEditTextArea textarea) {
this.editor = editor;
this.textarea = textarea;
// let him know that i'm leechin'
textarea.editorListener = this;
applyPreferences();
}
public void applyPreferences() {
expandTabs = PdePreferences.getBoolean("editor.tabs.expand");
int tabSize = PdePreferences.getInteger("editor.tabs.size");
tabString = PdeEditor.EMPTY.substring(0, tabSize);
autoIndent = PdePreferences.getBoolean("editor.indent");
externalEditor = PdePreferences.getBoolean("editor.external");
}
//public void setExternalEditor(boolean externalEditor) {
//this.externalEditor = externalEditor;
//}
// called by JEditTextArea inside processKeyEvent
public boolean keyPressed(KeyEvent event) {
// don't do things if the textarea isn't editable
if (externalEditor) return false;
//deselect(); // this is for paren balancing
char c = event.getKeyChar();
int code = event.getKeyCode();
//System.out.println(c + " " + code + " " + event);
//System.out.println();
if ((event.getModifiers() & KeyEvent.META_MASK) != 0) {
//event.consume(); // does nothing
return false;
}
// TODO i don't like these accessors. clean em up later.
if (!editor.sketch.current.modified) {
if ((code == KeyEvent.VK_BACK_SPACE) || (code == KeyEvent.VK_TAB) ||
(code == KeyEvent.VK_ENTER) || ((c >= 32) && (c < 128))) {
editor.sketch.setModified();
}
}
switch ((int) c) {
case 9: // expand tabs
if (expandTabs) {
//tc.replaceSelection(tabString);
textarea.setSelectedText(tabString);
event.consume();
return true;
}
break;
case 10: // auto-indent
case 13:
if (autoIndent) {
char contents[] = textarea.getText().toCharArray();
// this is the position of the caret, if the textarea
// only used a single kind of line ending
int origIndex = textarea.getCaretPosition() - 1;
// walk through the array to the current caret position,
// and count how many weirdo windows line endings there are,
// which would be throwing off the caret position number
int offset = 0;
int realIndex = origIndex;
for (int i = 0; i < realIndex-1; i++) {
if ((contents[i] == 13) && (contents[i+1] == 10)) {
offset++;
realIndex++;
}
}
// back up until \r \r\n or \n.. @#($* cross platform
//System.out.println(origIndex + " offset = " + offset);
origIndex += offset; // ARGH!#(* WINDOWS#@($*
int index = origIndex;
int spaceCount = 0;
boolean finished = false;
while ((index != -1) && (!finished)) {
if ((contents[index] == 10) ||
(contents[index] == 13)) {
finished = true;
index++; // maybe ?
} else {
index--; // new
}
}
while ((index < contents.length) && (index >= 0) &&
(contents[index++] == ' ')) {
spaceCount++;
}
// seems that \r is being inserted anyway
// so no need to insert the platform's line separator
String insertion = "\n" + PdeEditor.EMPTY.substring(0, spaceCount);
//tc.replaceSelection(insertion);
textarea.setSelectedText(insertion);
// microsoft vm version:
//tc.setCaretPosition(oldCarrot + insertion.length() - 1);
// sun vm version:
// tc.setCaretPosition(oldCarrot + insertion.length());
event.consume();
return true;
}
break;
}
return false;
}
}

View File

@@ -59,7 +59,7 @@ public class PdeKeywords extends CTokenMarker {
keywordColoring = new KeywordMap(false);
keywordToReference = new Hashtable();
InputStream input = PdeBase.getStream("keywords.txt");
InputStream input = Base.getStream("keywords.txt");
InputStreamReader isr = new InputStreamReader(input);
BufferedReader reader = new BufferedReader(isr);
@@ -106,7 +106,7 @@ public class PdeKeywords extends CTokenMarker {
reader.close();
} catch (Exception e) {
PdeBase.showError("Problem loading keywords",
Base.showError("Problem loading keywords",
"Could not load keywords.txt,\n" +
"please re-install Processing.", e);
System.exit(1);

View File

@@ -47,60 +47,60 @@ public class PdeTextAreaDefaults extends TextAreaDefaults {
styles = new SyntaxStyle[Token.ID_COUNT];
// comments
styles[Token.COMMENT1] = PdePreferences.getStyle("comment1");
styles[Token.COMMENT2] = PdePreferences.getStyle("comment2");
styles[Token.COMMENT1] = Preferences.getStyle("comment1");
styles[Token.COMMENT2] = Preferences.getStyle("comment2");
// abstract, final, private
styles[Token.KEYWORD1] = PdePreferences.getStyle("keyword1");
styles[Token.KEYWORD1] = Preferences.getStyle("keyword1");
// beginShape, point, line
styles[Token.KEYWORD2] = PdePreferences.getStyle("keyword2");
styles[Token.KEYWORD2] = Preferences.getStyle("keyword2");
// byte, char, short, color
styles[Token.KEYWORD3] = PdePreferences.getStyle("keyword3");
styles[Token.KEYWORD3] = Preferences.getStyle("keyword3");
// constants: null, true, this, RGB, TWO_PI
styles[Token.LITERAL1] = PdePreferences.getStyle("literal1");
styles[Token.LITERAL1] = Preferences.getStyle("literal1");
// p5 built in variables: mouseX, width, pixels
styles[Token.LITERAL2] = PdePreferences.getStyle("literal2");
styles[Token.LITERAL2] = Preferences.getStyle("literal2");
// ??
styles[Token.LABEL] = PdePreferences.getStyle("label");
styles[Token.LABEL] = Preferences.getStyle("label");
// + - = /
styles[Token.OPERATOR] = PdePreferences.getStyle("operator");
styles[Token.OPERATOR] = Preferences.getStyle("operator");
// area that's not in use by the text (replaced with tildes)
styles[Token.INVALID] = PdePreferences.getStyle("invalid");
styles[Token.INVALID] = Preferences.getStyle("invalid");
// moved from TextAreaPainter
font = PdePreferences.getFont("editor.font");
font = Preferences.getFont("editor.font");
fgcolor = PdePreferences.getColor("editor.fgcolor");
bgcolor = PdePreferences.getColor("editor.bgcolor");
fgcolor = Preferences.getColor("editor.fgcolor");
bgcolor = Preferences.getColor("editor.bgcolor");
caretVisible = true;
caretBlinks = PdePreferences.getBoolean("editor.caret.blink");
caretColor = PdePreferences.getColor("editor.caret.color");
caretBlinks = Preferences.getBoolean("editor.caret.blink");
caretColor = Preferences.getColor("editor.caret.color");
selectionColor = PdePreferences.getColor("editor.selection.color");
selectionColor = Preferences.getColor("editor.selection.color");
lineHighlight =
PdePreferences.getBoolean("editor.linehighlight");
Preferences.getBoolean("editor.linehighlight");
lineHighlightColor =
PdePreferences.getColor("editor.linehighlight.color");
Preferences.getColor("editor.linehighlight.color");
bracketHighlight =
PdePreferences.getBoolean("editor.brackethighlight");
Preferences.getBoolean("editor.brackethighlight");
bracketHighlightColor =
PdePreferences.getColor("editor.brackethighlight.color");
Preferences.getColor("editor.brackethighlight.color");
eolMarkers = PdePreferences.getBoolean("editor.eolmarkers");
eolMarkerColor = PdePreferences.getColor("editor.eolmarkers.color");
eolMarkers = Preferences.getBoolean("editor.eolmarkers");
eolMarkerColor = Preferences.getColor("editor.eolmarkers.color");
paintInvalid = PdePreferences.getBoolean("editor.invalid");
paintInvalid = Preferences.getBoolean("editor.invalid");
}
}

View File

@@ -362,7 +362,7 @@ public class TextAreaPainter extends JComponent implements TabExpander
*/
public void paint(Graphics gfx)
{
if (PdeBase.isMacOS()) {
if (Base.isMacOS()) {
Graphics2D g2 = (Graphics2D) gfx;
g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);