From 57b94aacccb43a21551161eb89a8aec5e271b23d Mon Sep 17 00:00:00 2001 From: benfry Date: Sat, 16 Aug 2008 01:38:45 +0000 Subject: [PATCH] fix for bug #737 (doubled geometry in 3D), and an indent/outdent comment/uncomment bug --- app/src/processing/app/Editor.java | 14 ++++++++++---- app/src/processing/app/syntax/JEditTextArea.java | 5 +++-- dxf/src/processing/dxf/RawDXF.java | 8 ++++---- opengl/src/processing/opengl/PGraphicsOpenGL.java | 1 + todo.txt | 4 ++++ 5 files changed, 22 insertions(+), 10 deletions(-) diff --git a/app/src/processing/app/Editor.java b/app/src/processing/app/Editor.java index bdca85cd7..405549b42 100644 --- a/app/src/processing/app/Editor.java +++ b/app/src/processing/app/Editor.java @@ -1164,12 +1164,15 @@ public class Editor extends JFrame { int startLine = textarea.getSelectionStartLine(); int stopLine = textarea.getSelectionStopLine(); - // If the selection ends at the beginning of the last line, - // then don't (un)comment that line. int lastLineStart = textarea.getLineStartOffset(stopLine); int selectionStop = textarea.getSelectionStop(); + // If the selection ends at the beginning of the last line, + // then don't (un)comment that line. if (selectionStop == lastLineStart) { - stopLine--; + // Though if there's no selection, don't do that + if (textarea.isSelectionActive()) { + stopLine--; + } } // If the text is empty, ignore the user. @@ -1217,7 +1220,10 @@ public class Editor extends JFrame { int lastLineStart = textarea.getLineStartOffset(stopLine); int selectionStop = textarea.getSelectionStop(); if (selectionStop == lastLineStart) { - stopLine--; + // Though if there's no selection, don't do that + if (textarea.isSelectionActive()) { + stopLine--; + } } for (int line = startLine; line <= stopLine; line++) { diff --git a/app/src/processing/app/syntax/JEditTextArea.java b/app/src/processing/app/syntax/JEditTextArea.java index 75a0479bf..e71071d51 100644 --- a/app/src/processing/app/syntax/JEditTextArea.java +++ b/app/src/processing/app/syntax/JEditTextArea.java @@ -1025,7 +1025,7 @@ public class JEditTextArea extends JComponent * Returns the offset where the selection ends on the specified * line. */ - public int getSelectionEnd(int line) + public int getSelectionStop(int line) { if(line == selectionEndLine) return selectionEnd; @@ -1062,7 +1062,8 @@ public class JEditTextArea extends JComponent { select(selectionStart,selectionEnd); } - + + public final boolean isSelectionActive() { return(selectionStart != selectionEnd); diff --git a/dxf/src/processing/dxf/RawDXF.java b/dxf/src/processing/dxf/RawDXF.java index 82a49f40a..49096ba49 100644 --- a/dxf/src/processing/dxf/RawDXF.java +++ b/dxf/src/processing/dxf/RawDXF.java @@ -387,10 +387,10 @@ public class RawDXF extends PGraphics3D { if (shape == POLYGON) { for (int i = 0; i < vertexCount - 1; i++) { writeLine(i, i+1); - } - if (mode == CLOSE) { - writeLine(vertexCount - 1, 0); - } + } + if (mode == CLOSE) { + writeLine(vertexCount - 1, 0); + } } /* if ((vertexCount != 0) && diff --git a/opengl/src/processing/opengl/PGraphicsOpenGL.java b/opengl/src/processing/opengl/PGraphicsOpenGL.java index d098e4926..684b2f93a 100644 --- a/opengl/src/processing/opengl/PGraphicsOpenGL.java +++ b/opengl/src/processing/opengl/PGraphicsOpenGL.java @@ -777,6 +777,7 @@ public class PGraphicsOpenGL extends PGraphics3D { if (raw != null) { raw.endShape(); } + triangleCount = 0; report("render_triangles out"); } diff --git a/todo.txt b/todo.txt index 1d2edcd29..21b289046 100644 --- a/todo.txt +++ b/todo.txt @@ -1,5 +1,9 @@ 0146 pde +X fix problem with comment/uncomment and indent/outdent +X when no selection, and on the first pos of the line +_ use macosx dialogs for all of the editor stuff +_ see about doing the same on windows, linux? _ getMessage() not sufficient for exceptions coming through _ (it's not including the type of exception)