cleaning out use of arrays of ArrayList objects

This commit is contained in:
Ben Fry
2014-11-16 16:02:31 -07:00
parent 3fde590d74
commit 51d2214347
4 changed files with 147 additions and 143 deletions
+63 -61
View File
@@ -6,8 +6,8 @@ import java.util.regex.Pattern;
public class SketchParser {
public ArrayList<ColorControlBox>[] colorBoxes;
public ArrayList<Handle>[] allHandles;
public List<List<ColorControlBox>> colorBoxes;
public List<List<Handle>> allHandles;
int intVarCount;
int floatVarCount;
@@ -17,7 +17,7 @@ public class SketchParser {
boolean requiresComment;
ArrayList<ColorMode> colorModes;
ArrayList<Range>[] scientificNotations;
List<List<Range>> scientificNotations;
public SketchParser(String[] codeTabs, boolean requiresComment) {
@@ -33,7 +33,7 @@ public class SketchParser {
// handle colors
colorModes = findAllColorModes();
colorBoxes = new ArrayList[codeTabs.length];
//colorBoxes = new ArrayList[codeTabs.length];
createColorBoxes();
createColorBoxesForLights();
@@ -47,12 +47,14 @@ public class SketchParser {
public void addAllNumbers() {
allHandles = new ArrayList[codeTabs.length];
//allHandles = new ArrayList[codeTabs.length]; // moved inside addAllDecimalNumbers
addAllDecimalNumbers();
addAllHexNumbers();
addAllWebColorNumbers();
for (int i=0; i<codeTabs.length; i++) {
Collections.sort(allHandles[i], new HandleComparator());
//for (int i=0; i<codeTabs.length; i++) {
for (List<Handle> handle : allHandles) {
//Collections.sort(allHandles[i], new HandleComparator());
Collections.sort(handle, new HandleComparator());
}
}
@@ -63,12 +65,17 @@ public class SketchParser {
* list of all numbers in the sketch (excluding hexadecimals)
*/
private void addAllDecimalNumbers() {
allHandles = new ArrayList<>();
// for every number found:
// save its type (int/float), name, value and position in code.
Pattern p = Pattern.compile("[\\[\\{<>(),\\t\\s\\+\\-\\/\\*^%!|&=?:~]\\d+\\.?\\d*");
for (int i = 0; i < codeTabs.length; i++) {
allHandles[i] = new ArrayList<Handle>();
//allHandles[i] = new ArrayList<Handle>();
List<Handle> handles = new ArrayList<Handle>();
allHandles.add(handles);
String c = codeTabs[i];
Matcher m = p.matcher(c);
@@ -91,7 +98,7 @@ public class SketchParser {
// ignore scientific notation (e.g. 1e-6)
boolean found = false;
for (Range r : scientificNotations[i]) {
for (Range r : scientificNotations.get(i)) {
if (r.contains(start)) {
found=true;
break;
@@ -135,12 +142,12 @@ public class SketchParser {
// consider this as a float
String name = varPrefix + "_float[" + floatVarCount +"]";
int decimalDigits = getNumDigitsAfterPoint(value);
allHandles[i].add(new Handle("float", name, floatVarCount, value, i, line, start, end, decimalDigits));
handles.add(new Handle("float", name, floatVarCount, value, i, line, start, end, decimalDigits));
floatVarCount++;
} else {
// consider this as an int
String name = varPrefix + "_int[" + intVarCount +"]";
allHandles[i].add(new Handle("int", name, intVarCount, value, i, line, start, end, 0));
handles.add(new Handle("int", name, intVarCount, value, i, line, start, end, 0));
intVarCount++;
}
}
@@ -201,7 +208,7 @@ public class SketchParser {
// don't add this number
continue;
}
allHandles[i].add(handle);
allHandles.get(i).add(handle);
intVarCount++;
}
}
@@ -258,18 +265,16 @@ public class SketchParser {
// don't add this number
continue;
}
allHandles[i].add(handle);
allHandles.get(i).add(handle);
intVarCount++;
}
}
}
}
}
}
private ArrayList<ColorMode> findAllColorModes()
{
private ArrayList<ColorMode> findAllColorModes() {
ArrayList<ColorMode> modes = new ArrayList<ColorMode>();
for (String tab : codeTabs)
{
for (String tab : codeTabs) {
int index = -1;
// search for a call to colorMode function
while ((index = tab.indexOf("colorMode", index+1)) > -1) {
@@ -297,22 +302,24 @@ public class SketchParser {
modes.add(ColorMode.fromString(context, modeDesc));
}
}
return modes;
}
private void createColorBoxes()
{
private void createColorBoxes() {
colorBoxes = new ArrayList<>();
// search tab for the functions: 'color', 'fill', 'stroke', 'background', 'tint'
Pattern p = Pattern.compile("color\\(|color\\s\\(|fill[\\(\\s]|stroke[\\(\\s]|background[\\(\\s]|tint[\\(\\s]");
for (int i=0; i<codeTabs.length; i++)
{
colorBoxes[i] = new ArrayList<ColorControlBox>();
for (int i = 0; i < codeTabs.length; i++) {
//colorBoxes[i] = new ArrayList<ColorControlBox>();
List<ColorControlBox> colorBox = new ArrayList<ColorControlBox>();
colorBoxes.add(colorBox);
String tab = codeTabs[i];
Matcher m = p.matcher(tab);
while (m.find())
{
while (m.find()) {
ArrayList<Handle> colorHandles = new ArrayList<Handle>();
// look for the '(' and ')' positions
@@ -329,8 +336,7 @@ public class SketchParser {
}
// look for handles inside the parenthesis
for (Handle handle : allHandles[i])
{
for (Handle handle : allHandles.get(i)) {
if (handle.startChar > openPar &&
handle.endChar <= closePar) {
// we have a match
@@ -370,11 +376,10 @@ public class SketchParser {
if (cmode.unrecognizedMode) {
// the color mode is unrecognizable add only if is a hex or webcolor
if (newCCB.isHex) {
colorBoxes[i].add(newCCB);
colorBox.add(newCCB);
}
}
else {
colorBoxes[i].add(newCCB);
} else {
colorBox.add(newCCB);
}
}
}
@@ -382,19 +387,17 @@ public class SketchParser {
}
}
private void createColorBoxesForLights()
{
private void createColorBoxesForLights() {
// search code for light color and material color functions.
Pattern p = Pattern.compile("ambientLight[\\(\\s]|directionalLight[\\(\\s]"+
"|pointLight[\\(\\s]|spotLight[\\(\\s]|lightSpecular[\\(\\s]"+
"|specular[\\(\\s]|ambient[\\(\\s]|emissive[\\(\\s]");
for (int i=0; i<codeTabs.length; i++)
{
for (int i=0; i<codeTabs.length; i++) {
String tab = codeTabs[i];
Matcher m = p.matcher(tab);
while (m.find())
{
while (m.find()) {
ArrayList<Handle> colorHandles = new ArrayList<Handle>();
// look for the '(' and ')' positions
@@ -422,8 +425,7 @@ public class SketchParser {
}
}
for (Handle handle : allHandles[i])
{
for (Handle handle : allHandles.get(i)) {
if (handle.startChar > openPar &&
handle.endChar <= colorParamsEnd) {
// we have a match
@@ -463,11 +465,10 @@ public class SketchParser {
if (cmode.unrecognizedMode) {
// the color mode is unrecognizable add only if is a hex or webcolor
if (newCCB.isHex) {
colorBoxes[i].add(newCCB);
colorBoxes.get(i).add(newCCB);
}
}
else {
colorBoxes[i].add(newCCB);
} else {
colorBoxes.get(i).add(newCCB);
}
}
}
@@ -475,8 +476,7 @@ public class SketchParser {
}
}
private ColorMode getColorModeForContext(String context)
{
private ColorMode getColorModeForContext(String context) {
for (ColorMode cm: colorModes) {
if (cm.drawContext.equals(context)) {
return cm;
@@ -517,33 +517,35 @@ public class SketchParser {
*/
for (int i=0; i<codeTabs.length; i++) {
ArrayList<ColorControlBox> toDelete = new ArrayList<ColorControlBox>();
for (String context : multipleContexts)
{
for (ColorControlBox ccb : colorBoxes[i])
{
for (String context : multipleContexts) {
for (ColorControlBox ccb : colorBoxes.get(i)) {
if (ccb.drawContext.equals(context) && !ccb.isHex) {
toDelete.add(ccb);
}
}
}
colorBoxes[i].removeAll(toDelete);
colorBoxes.get(i).removeAll(toDelete);
}
}
public ArrayList<Range>[] getAllScientificNotations() {
ArrayList<Range> notations[] = new ArrayList[codeTabs.length];
public List<List<Range>> getAllScientificNotations() {
//ArrayList<Range> notations[] = new ArrayList[codeTabs.length];
List<List<Range>> notations = new ArrayList<>();
Pattern p = Pattern.compile("[+\\-]?(?:0|[1-9]\\d*)(?:\\.\\d*)?[eE][+\\-]?\\d+");
for (int i=0; i<codeTabs.length; i++)
{
notations[i] = new ArrayList<Range>();
Matcher m = p.matcher(codeTabs[i]);
//for (int i = 0; i < codeTabs.length; i++) {
for (String code : codeTabs) {
List<Range> notation = new ArrayList<Range>();
//notations[i] = new ArrayList<Range>();
//Matcher m = p.matcher(codeTabs[i]);
Matcher m = p.matcher(code);
while (m.find()) {
notations[i].add(new Range(m.start(), m.end()));
//notations[i].add(new Range(m.start(), m.end()));
notation.add(new Range(m.start(), m.end()));
}
notations.add(notation);
}
return notations;
}
@@ -1747,8 +1747,8 @@ public class DebugEditor extends JavaEditor implements ActionListener {
ta.startInteractiveMode();
}
public void stopInteractiveMode(ArrayList<Handle> handles[])
{
//public void stopInteractiveMode(ArrayList<Handle> handles[]) {
public void stopInteractiveMode(List<List<Handle>> handles) {
tweakClient.shutdown();
ta.stopInteractiveMode();
@@ -1819,8 +1819,7 @@ public class DebugEditor extends JavaEditor implements ActionListener {
}
}
public void updateInterface(ArrayList<Handle> handles[], ArrayList<ColorControlBox> colorBoxes[])
{
public void updateInterface(List<List<Handle>> handles, List<List<ColorControlBox>> colorBoxes) {
// set OSC port of handles
// for (int i=0; i<handles.length; i++) {
// for (Handle h : handles[i]) {
@@ -1831,12 +1830,12 @@ public class DebugEditor extends JavaEditor implements ActionListener {
ta.updateInterface(handles, colorBoxes);
}
/**
* Deactivate run button
* Do this because when Mode.handleRun returns null the play button stays on.
*/
public void deactivateRun()
{
public void deactivateRun() {
// toolbar.deactivate(TweakToolbar.RUN);
if(toolbar instanceof DebugToolbar){
toolbar.deactivate(DebugToolbar.RUN);
@@ -1845,40 +1844,40 @@ public class DebugEditor extends JavaEditor implements ActionListener {
}
}
private boolean[] getModifiedTabs(ArrayList<Handle> handles[])
{
boolean[] modifiedTabs = new boolean[handles.length];
//private boolean[] getModifiedTabs(ArrayList<Handle> handles[]) {
private boolean[] getModifiedTabs(List<List<Handle>> handles) {
boolean[] modifiedTabs = new boolean[handles.size()];
for (int i=0; i<handles.length; i++) {
for (Handle h : handles[i]) {
for (int i = 0; i < handles.size(); i++) {
for (Handle h : handles.get(i)) {
if (h.valueChanged()) {
modifiedTabs[i] = true;
}
}
}
return modifiedTabs;
}
public void initBaseCode()
{
SketchCode[] code = sketch.getCode();
public void initBaseCode() {
SketchCode[] code = sketch.getCode();
String space = new String();
String space = new String();
for (int i=0; i<SPACE_AMOUNT; i++) {
space += "\n";
}
for (int i=0; i<SPACE_AMOUNT; i++) {
space += "\n";
}
baseCode = new String[code.length];
for (int i=0; i<code.length; i++)
{
baseCode[i] = new String(code[i].getSavedProgram());
baseCode[i] = space + baseCode[i] + space;
}
baseCode = new String[code.length];
for (int i = 0; i < code.length; i++) {
baseCode[i] = new String(code[i].getSavedProgram());
baseCode[i] = space + baseCode[i] + space;
}
}
public void initEditorCode(ArrayList<Handle> handles[], boolean withSpaces)
public void initEditorCode(List<List<Handle>> handles, boolean withSpaces)
{
SketchCode[] sketchCode = sketch.getCode();
for (int tab=0; tab<baseCode.length; tab++) {
@@ -1886,8 +1885,7 @@ public class DebugEditor extends JavaEditor implements ActionListener {
int charInc = 0;
String code = baseCode[tab];
for (Handle n : handles[tab])
{
for (Handle n : handles.get(tab)) {
int s = n.startChar + charInc;
int e = n.endChar + charInc;
String newStr = n.strNewValue;
@@ -1953,14 +1951,14 @@ public class DebugEditor extends JavaEditor implements ActionListener {
* @return
* true on success
*/
public boolean automateSketch(Sketch sketch, ArrayList<Handle> handles[])
{
//public boolean automateSketch(Sketch sketch, ArrayList<Handle> handles[])
public boolean automateSketch(Sketch sketch, List<List<Handle>> handles) {
SketchCode[] code = sketch.getCode();
if (code.length<1)
return false;
if (handles.length == 0)
if (handles.size() == 0)
return false;
int setupStartPos = SketchParser.getSetupStart(baseCode[0]);
@@ -1988,7 +1986,7 @@ public class DebugEditor extends JavaEditor implements ActionListener {
tweakClient = new UDPTweakClient(port);
// update handles with a reference to the client object
for (int tab=0; tab<code.length; tab++) {
for (Handle h : handles[tab]) {
for (Handle h : handles.get(tab)) {
h.setTweakClient(tweakClient);
}
}
@@ -2002,7 +2000,7 @@ public class DebugEditor extends JavaEditor implements ActionListener {
{
int charInc = 0;
String c = baseCode[tab];
for (Handle n : handles[tab])
for (Handle n : handles.get(tab))
{
// replace number value with a variable
c = replaceString(c, n.startChar + charInc, n.endChar + charInc, n.name);
@@ -2043,9 +2041,10 @@ public class DebugEditor extends JavaEditor implements ActionListener {
header += "void tweakmode_initAllVars() {\n";
for (int i=0; i<handles.length; i++) {
for (Handle n : handles[i])
{
//for (int i=0; i<handles.length; i++) {
for (List<Handle> list : handles) {
//for (Handle n : handles[i]) {
for (Handle n : list) {
header += " " + n.name + " = " + n.strValue + ";\n";
}
}
@@ -2087,33 +2086,37 @@ public class DebugEditor extends JavaEditor implements ActionListener {
return true;
}
private String replaceString(String str, int start, int end, String put)
{
private String replaceString(String str, int start, int end, String put) {
return str.substring(0, start) + put + str.substring(end, str.length());
}
private int howManyInts(ArrayList<Handle> handles[])
{
//private int howManyInts(ArrayList<Handle> handles[])
private int howManyInts(List<List<Handle>> handles) {
int count = 0;
for (int i=0; i<handles.length; i++) {
for (Handle n : handles[i]) {
if (n.type == "int" || n.type == "hex" || n.type == "webcolor")
//for (int i=0; i<handles.length; i++) {
for (List<Handle> list : handles) {
//for (Handle n : handles[i]) {
for (Handle n : list) {
if (n.type == "int" || n.type == "hex" || n.type == "webcolor") {
count++;
}
}
}
return count;
}
private int howManyFloats(ArrayList<Handle> handles[])
{
//private int howManyFloats(ArrayList<Handle> handles[])
private int howManyFloats(List<List<Handle>> handles) {
int count = 0;
for (int i=0; i<handles.length; i++) {
for (Handle n : handles[i]) {
if (n.type == "float")
//for (int i=0; i<handles.length; i++) {
for (List<Handle> list : handles) {
//for (Handle n : handles[i]) {
for (Handle n : list) {
if (n.type == "float") {
count++;
}
}
}
return count;
}
}
@@ -31,8 +31,8 @@ import java.awt.event.KeyListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.swing.DefaultListModel;
@@ -954,8 +954,8 @@ public class TextArea extends JEditTextArea {
}
}
public void updateInterface(ArrayList<Handle> handles[], ArrayList<ColorControlBox> colorBoxes[])
{
//public void updateInterface(ArrayList<Handle> handles[], ArrayList<ColorControlBox> colorBoxes[]) {
public void updateInterface(List<List<Handle>> handles, List<List<ColorControlBox>> colorBoxes) {
customPainter.updateInterface(handles, colorBoxes);
}
@@ -36,7 +36,7 @@ import java.awt.event.MouseMotionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.image.BufferedImage;
import java.util.ArrayList;
import java.util.List;
import javax.swing.text.BadLocationException;
import javax.swing.text.Segment;
@@ -46,6 +46,7 @@ import processing.app.SketchCode;
import processing.app.syntax.TextAreaDefaults;
import processing.app.syntax.TokenMarker;
/**
* Customized line painter. Adds support for background colors, left hand gutter
* area with background color and text.
@@ -214,6 +215,7 @@ public class TextAreaPainter extends processing.app.syntax.TextAreaPainter
}
paintErrorLine(gfx, line, x);
}
/**
* Paint the gutter background (solid color).
@@ -231,6 +233,7 @@ public class TextAreaPainter extends processing.app.syntax.TextAreaPainter
gfx.fillRect(0, y, ta.getGutterWidth(), fm.getHeight());
}
/**
* Paint the vertical gutter separator line.
*
@@ -248,6 +251,7 @@ public class TextAreaPainter extends processing.app.syntax.TextAreaPainter
y + fm.getHeight());
}
/**
* Paint the gutter text.
*
@@ -284,6 +288,7 @@ public class TextAreaPainter extends processing.app.syntax.TextAreaPainter
Utilities.drawTabbedText(new Segment(text.toCharArray(), 0, text.length()),
ta.getGutterMargins() + 1, y + 1, gfx, this, 0);
}
/**
* Paint the background color of a line.
@@ -311,6 +316,7 @@ public class TextAreaPainter extends processing.app.syntax.TextAreaPainter
gfx.setColor(col);
gfx.fillRect(0, y, getWidth(), height);
}
/**
* Paints the underline for an error/warning line
@@ -428,6 +434,7 @@ public class TextAreaPainter extends processing.app.syntax.TextAreaPainter
// gfx.fillRect(2, y, 3, height);
}
/**
* Trims out trailing whitespaces (to the right)
*
@@ -445,6 +452,7 @@ public class TextAreaPainter extends processing.app.syntax.TextAreaPainter
return newString;
}
/**
* Sets ErrorCheckerService and loads theme for TextAreaPainter(XQMode)
*
@@ -456,6 +464,7 @@ public class TextAreaPainter extends processing.app.syntax.TextAreaPainter
loadTheme(mode);
}
public String getToolTipText(java.awt.event.MouseEvent evt) {
if (ta.editor.hasJavaTabs) { // disabled for java tabs
setToolTipText(null);
@@ -543,8 +552,10 @@ public class TextAreaPainter extends processing.app.syntax.TextAreaPainter
protected int horizontalAdjustment = 0;
public boolean interactiveMode = false;
public ArrayList<Handle> handles[];
public ArrayList<ColorControlBox> colorBoxes[];
// public ArrayList<Handle> handles[];
// public ArrayList<ColorControlBox> colorBoxes[];
public List<List<Handle>> handles;
public List<List<ColorControlBox>> colorBoxes;
public Handle mouseHandle = null;
public ColorSelector colorSelector;
@@ -574,8 +585,7 @@ public class TextAreaPainter extends processing.app.syntax.TextAreaPainter
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
for (Handle n : handles[currentTab])
{
for (Handle n : handles.get(currentTab)) {
// update n position and width, and draw it
int lineStartChar = ta.getLineStartOffset(n.line);
int x = ta.offsetToX(n.line, n.newStartChar - lineStartChar);
@@ -587,8 +597,7 @@ public class TextAreaPainter extends processing.app.syntax.TextAreaPainter
}
// draw color boxes
for (ColorControlBox cBox: colorBoxes[currentTab])
{
for (ColorControlBox cBox: colorBoxes.get(currentTab)) {
int lineStartChar = ta.getLineStartOffset(cBox.getLine());
int x = ta.offsetToX(cBox.getLine(), cBox.getCharIndex() - lineStartChar);
int y = ta.lineToY(cBox.getLine()) + fm.getDescent();
@@ -618,8 +627,8 @@ public class TextAreaPainter extends processing.app.syntax.TextAreaPainter
}
// Update the interface
public void updateInterface(ArrayList<Handle> handles[], ArrayList<ColorControlBox> colorBoxes[])
{
//public void updateInterface(ArrayList<Handle> handles[], ArrayList<ColorControlBox> colorBoxes[]) {
public void updateInterface(List<List<Handle>> handles, List<List<ColorControlBox>> colorBoxes) {
this.handles = handles;
this.colorBoxes = colorBoxes;
@@ -632,18 +641,15 @@ public class TextAreaPainter extends processing.app.syntax.TextAreaPainter
* synchronize this method to prevent the execution of 'paint' in the middle.
* (don't paint while we make changes to the text of the editor)
*/
public synchronized void initInterfacePositions()
{
public synchronized void initInterfacePositions() {
SketchCode[] code = ta.editor.getSketch().getCode();
int prevScroll = ta.getVerticalScrollPosition();
String prevText = ta.getText();
for (int tab=0; tab<code.length; tab++)
{
for (int tab=0; tab<code.length; tab++) {
String tabCode = ta.editor.baseCode[tab];
ta.setText(tabCode);
for (Handle n : handles[tab])
{
for (Handle n : handles.get(tab)) {
int lineStartChar = ta.getLineStartOffset(n.line);
int x = ta.offsetToX(n.line, n.newStartChar - lineStartChar);
int end = ta.offsetToX(n.line, n.newEndChar - lineStartChar);
@@ -651,8 +657,7 @@ public class TextAreaPainter extends processing.app.syntax.TextAreaPainter
n.initInterface(x, y, end-x, fm.getHeight());
}
for (ColorControlBox cBox : colorBoxes[tab])
{
for (ColorControlBox cBox : colorBoxes.get(tab)) {
int lineStartChar = ta.getLineStartOffset(cBox.getLine());
int x = ta.offsetToX(cBox.getLine(), cBox.getCharIndex() - lineStartChar);
int y = ta.lineToY(cBox.getLine()) + fm.getDescent();
@@ -676,8 +681,7 @@ public class TextAreaPainter extends processing.app.syntax.TextAreaPainter
SketchCode sc = ta.editor.getSketch().getCode(currentTab);
String code = ta.editor.baseCode[currentTab];
for (Handle n : handles[currentTab])
{
for (Handle n : handles.get(currentTab)) {
int s = n.startChar + charInc;
int e = n.endChar + charInc;
code = replaceString(code, s, e, n.strNewValue);
@@ -710,8 +714,7 @@ public class TextAreaPainter extends processing.app.syntax.TextAreaPainter
public void updateCursor(int mouseX, int mouseY)
{
int currentTab = ta.editor.getSketch().getCurrentCodeIndex();
for (Handle n : handles[currentTab])
{
for (Handle n : handles.get(currentTab)) {
if (n.pick(mouseX, mouseY))
{
cursorType = Cursor.W_RESIZE_CURSOR;
@@ -720,8 +723,7 @@ public class TextAreaPainter extends processing.app.syntax.TextAreaPainter
}
}
for (ColorControlBox colorBox : colorBoxes[currentTab])
{
for (ColorControlBox colorBox : colorBoxes.get(currentTab)) {
if (colorBox.pick(mouseX, mouseY))
{
cursorType = Cursor.HAND_CURSOR;
@@ -748,7 +750,7 @@ public class TextAreaPainter extends processing.app.syntax.TextAreaPainter
int currentTab = ta.editor.getSketch().getCurrentCodeIndex();
boolean change = false;
for (ColorControlBox box : colorBoxes[currentTab]) {
for (ColorControlBox box : colorBoxes.get(currentTab)) {
if (box.setMouseY(y)) {
change = true;
}
@@ -788,10 +790,8 @@ public class TextAreaPainter extends processing.app.syntax.TextAreaPainter
public void mousePressed(MouseEvent e) {
int currentTab = ta.editor.getSketch().getCurrentCodeIndex();
// check for clicks on number handles
for (Handle n : handles[currentTab])
{
if (n.pick(e.getX(), e.getY()))
{
for (Handle n : handles.get(currentTab)) {
if (n.pick(e.getX(), e.getY())) {
cursorType = -1;
this.setCursor(blankCursor);
mouseHandle = n;
@@ -802,8 +802,7 @@ public class TextAreaPainter extends processing.app.syntax.TextAreaPainter
}
// check for clicks on color boxes
for (ColorControlBox box : colorBoxes[currentTab])
{
for (ColorControlBox box : colorBoxes.get(currentTab)) {
if (box.pick(e.getX(), e.getY()))
{
if (colorSelector != null) {