|
From: <ox-...@us...> - 2002-07-09 19:03:56
|
Update of /cvsroot/sheets/sheets
In directory usw-pr-cvs1:/tmp/cvs-serv16299
Modified Files:
.sheetsrc Sheets.sheets
Log Message:
Added a quick-and-dirty first implementation of code folding. It adds little plus and minus signs to the code which you can use to hide chunks of the code. Useful for editing very large methods. (However, there is still quite a bit of work left to do before this is complete)
Also fixed the javac pattern to pick up the new ANT output. For some reason ANT started emitting the absolute path name, which caused sheets to not display error results. Anyway, it is fixed now.
Index: .sheetsrc
===================================================================
RCS file: /cvsroot/sheets/sheets/.sheetsrc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** .sheetsrc 18 Jun 2002 21:27:58 -0000 1.2
--- .sheetsrc 9 Jul 2002 19:03:47 -0000 1.3
***************
*** 3,13 ****
##########################################
- # This matches JVC's error format
- #set error-pattern "([A-Za-z]?:?[-a-zA-Z0-9_\$./\\\\]+)\\(([0-9]+),[0-9]+\\) :(.*)"
- # This matches JAVAC's error format
- #set error-pattern "([-a-zA-Z_\$./\\\\]+):([0-9]+): (.*)"
- # This matches JIKE's error format
- set error-pattern "([A-Za-z]?:?[-a-zA-Z0-9_\$./\\\\]+):([0-9]+):[0-9]+:[0-9]+:[0-9]+: (.*)"
-
set compile-command "ant.bat compile"
set recompile-command "ant.bat clean"
--- 3,6 ----
Index: Sheets.sheets
===================================================================
RCS file: /cvsroot/sheets/sheets/Sheets.sheets,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** Sheets.sheets 9 Jul 2002 00:51:07 -0000 1.11
--- Sheets.sheets 9 Jul 2002 19:03:47 -0000 1.12
***************
*** 1272,1276 ****
rgs:247
schin:498
- schin:497
rgs:5941
nkramer:133
--- 1272,1275 ----
***************
*** 1343,1346 ****
--- 1342,1346 ----
rgs:13395
rgs:13397
+ schin:522
object nkramer:123
pkg=org.browsecode.sheets
***************
*** 5870,5873 ****
--- 5870,5874 ----
rgs2:139
rgs2:153
+ schin:523
rgs:6148
rgs:577
***************
*** 9036,9041 ****
// Return value is null if no errors are found.
private static Sheet CompileDialog.parseErrors(String outString) {
! // Out current regexp library seems to get confused when given big inputs
! // so we'll cut it's food into tiny bite-sized chunks.
String[] lines = StringSplitter.splitLines(outString);
if (lines.length > 0 && errorSheet == null) {
--- 9037,9042 ----
// Return value is null if no errors are found.
private static Sheet CompileDialog.parseErrors(String outString) {
! // Out former regexp library seemed to get confused when given big inputs
! // so we cut it's food into tiny bite-sized chunks -- this should be revisited.
String[] lines = StringSplitter.splitLines(outString);
if (lines.length > 0 && errorSheet == null) {
***************
*** 9050,9054 ****
for (int j = 0; j < Profile.errorPatterns.size(); j++) {
Pattern pat = (Pattern)Profile.errorPatterns.elementAt(j);
! Matcher matcher = pat.matcher(lines[i]);
if (matcher.matches()) {
String file = matcher.group(1);
--- 9051,9055 ----
for (int j = 0; j < Profile.errorPatterns.size(); j++) {
Pattern pat = (Pattern)Profile.errorPatterns.elementAt(j);
! Matcher matcher = pat.matcher(line);
if (matcher.matches()) {
String file = matcher.group(1);
***************
*** 10614,10618 ****
errorPatterns.addElement(Pattern.compile("([A-Za-z]?:?[-a-zA-Z0-9.$_/\\\\\\\\]+)\\\\(([0-9]+),[0-9]+\\\\) :(.*)"));
// JAVAC error format
! errorPatterns.addElement(Pattern.compile("([-a-zA-Z0-9.$_/\\\\\\\\]+):([0-9]+): (.*)"));
// JIKE's error format
errorPatterns.addElement(Pattern.compile("([A-Za-z]?:?[-a-zA-Z0-9_$./\\\\\\\\]+):([0-9]+):[0-9]+:[0-9]+:[0-9]+: (.*)"));
--- 10615,10619 ----
errorPatterns.addElement(Pattern.compile("([A-Za-z]?:?[-a-zA-Z0-9.$_/\\\\\\\\]+)\\\\(([0-9]+),[0-9]+\\\\) :(.*)"));
// JAVAC error format
! errorPatterns.addElement(Pattern.compile("([A-Za-z]?:?[-a-zA-Z0-9.$_/\\\\\\\\]+):([0-9]+): (.*)"));
// JIKE's error format
errorPatterns.addElement(Pattern.compile("([A-Za-z]?:?[-a-zA-Z0-9_$./\\\\\\\\]+):([0-9]+):[0-9]+:[0-9]+:[0-9]+: (.*)"));
***************
*** 54693,54698 ****
type=java
section text rgs:6148
! public void JavaViewer.middleClick
! (ViewerSelection sel, int selectionKind, int absY)
{
LinePosition range = selectionCursor(sel);
--- 54694,54698 ----
type=java
section text rgs:6148
! public void JavaViewer.middleClick (ViewerSelection sel, int selectionKind, int absY)
{
LinePosition range = selectionCursor(sel);
***************
*** 71601,71606 ****
// They did. So we need to adjust each of them accordingly.
for (int line = at + count; line < dispLines.length; line++)
! if (formattedLines[line] != null)
formattedLines[line].adjustY(delta);
if (oldHeight != -1) {
// And we also need to adjust the total height and invalidate the
--- 71601,71607 ----
// They did. So we need to adjust each of them accordingly.
for (int line = at + count; line < dispLines.length; line++)
! if (formattedLines[line] != null) {
formattedLines[line].adjustY(delta);
+ }
if (oldHeight != -1) {
// And we also need to adjust the total height and invalidate the
***************
*** 80467,80476 ****
return -1;
}
- object schin:497
- pkg=org.browsecode.sheets
- type=java
- section text schin:497
- // True if the corresponding display line is visible, false if it is hidden
- public boolean[] TextualViewer.dispLineVisibility;
object schin:498
pkg=org.browsecode.sheets
--- 80468,80471 ----
***************
*** 80479,80489 ****
public void TextualViewer.setDispLines(String[] dispLines) {
this.dispLines = dispLines;
- if (dispLines == null)
- dispLineVisibility = null;
- else {
- dispLineVisibility = new boolean[dispLines.length];
- for (int i=0; i<dispLines.length; i++)
- dispLineVisibility[i] = true;
- }
}
object schin:500
--- 80474,80477 ----
***************
*** 80694,80697 ****
--- 80682,80774 ----
return paintGraphics.getFontMetrics();
}
+ object schin:519
+ pkg=org.browsecode.sheets
+ type=java
+ section text schin:519
+ // True if the corresponding display line is visible, false if it is hidden
+ public boolean[] RichTextViewer.dispLineVisibility;
+ object schin:520
+ pkg=org.browsecode.sheets
+ type=java
+ section text schin:520
+ // Makes sure that dispLineVisibility is properly updated when dispLines is set
+ public void RichTextViewer.setDispLines(String[] dispLines) {
+ super.setDispLines(dispLines);
+ if (dispLines == null)
+ dispLineVisibility = null;
+ else {
+ dispLineVisibility = new boolean[dispLines.length];
+ for (int i=0; i<dispLines.length; i++) {
+ dispLineVisibility[i] = true;
+ }
+ }
+ }
+ object schin:521
+ pkg=org.browsecode.sheets
+ type=java
+ section text schin:521
+ // collapses the lines referred to by index
+ public void RichTextViewer.collapseLines(int start, int end) {
+ for (int i=start; i<=end; i++) {
+ dispLineVisibility[i] = false;
+ if (formattedLines != null) {
+ formattedLines[i] = null;
+ }
+ }
+ if (formattedLines != null) {
+ invalidFormatting(start, end + 1);
+ }
+ }
+ object schin:522
+ pkg=org.browsecode.sheets
+ type=java
+ section text schin:522
+ public void TextualViewer.paintTreeWidget (Graphics g, int line, int tabWidth, boolean collapse) {
+ int height = lineHeight();
+ int startX = tabWidth - 5;
+ int startY = lineBase(line, 0) + descent();
+ g.drawLine(startX, startY - height / 2, startX + 4, startY - height / 2);
+ if (collapse) g.drawLine(startX + 2, startY - ((height / 2) + 2),
+ startX + 2, startY - ((height / 2) - 2));
+ }
+ object schin:523
+ pkg=org.browsecode.javaStuff
+ type=java
+ section text schin:523
+ public void JavaViewer.leftClick (ViewerSelection loc, int selectionKind, int absX, int absY)
+ {
+ int line = mapXY(loc.getStartPoint().x, loc.getStartPoint().y).line;
+ int openBrace = dispLines[line].indexOf('{');
+ int closeBrace = dispLines[line].indexOf('}');
+ int tabPosition = StringSplitter.skipChars(dispLines[line], ' ') * getViewPainter().getMetrics().charWidth(' ');
+ if (line + 1 < dispLines.length && openBrace != -1 && closeBrace == -1 && loc.getStartPoint().x < tabPosition) {
+ if (!dispLineVisibility[line + 1])
+ expandLines(line + 1);
+ else {
+ int beginIndex = getTokenMgr().tokenIndex(line, openBrace + 1);
+ int endIndex = getTokenMgr().balanceLBrace(beginIndex + 1);
+ Token token = getTokenMgr().tokenAt(endIndex);
+ collapseLines(line + 1, token.beginLine);
+ }
+ } else {
+ super.leftClick(loc, selectionKind, absX, absY);
+ }
+ }
+ object schin:524
+ pkg=org.browsecode.sheets
+ type=java
+ section text schin:524
+ // collapses the lines referred to by index
+ public void RichTextViewer.expandLines(int start) {
+ int end = start;
+ for (; end<=dispLines.length; end++) {
+ if (dispLineVisibility[end] == true)
+ break;
+ dispLineVisibility[end] = true;
+ }
+ if (formattedLines != null) {
+ invalidFormatting(start, end);
+ }
+ }
object sjc:1
pkg=org.browsecode.sheets.dicer
***************
*** 90275,90278 ****
--- 90352,90359 ----
rgs:13360
rgs:13446
+ schin:519
+ schin:520
+ schin:521
+ schin:524
object wlott:3017
pkg=org.browsecode.sheets
***************
*** 90511,90515 ****
if (formattedLines == null) {
! if (textHeight != -1) Console.internalError("bad textHeight");
formattedLines = new FormattedLine[dispLines.length];
reformatLines(0, dispLines.length);
--- 90592,90596 ----
if (formattedLines == null) {
! if (textHeight != -1) Console.internalError("bad textHeight");
formattedLines = new FormattedLine[dispLines.length];
reformatLines(0, dispLines.length);
***************
*** 90559,90563 ****
break;
ScreenLine screenLine = formattedLine.screenLines;
! while (screenLine.baseline + screenLine.descent <= top)
screenLine = screenLine.next;
while (screenLine != null
--- 90640,90644 ----
break;
ScreenLine screenLine = formattedLine.screenLines;
! while (screenLine != null && screenLine.baseline + screenLine.descent <= top)
screenLine = screenLine.next;
while (screenLine != null
***************
*** 91392,91396 ****
// past the beginning or end of the selected line.
protected LinePosition RichTextViewer.mapXY
! (int x, int y, boolean adjustX)
{
if (formattedLines == null)
--- 91473,91477 ----
// past the beginning or end of the selected line.
protected LinePosition RichTextViewer.mapXY
! (int x, int y)
{
if (formattedLines == null)
***************
*** 92367,92371 ****
break;
ScreenLine screenLine = formattedLine.screenLines;
! while (screenLine.baseline + screenLine.descent <= top)
screenLine = screenLine.next;
while (screenLine != null
--- 92448,92452 ----
break;
ScreenLine screenLine = formattedLine.screenLines;
! while (screenLine != null && screenLine.baseline + screenLine.descent <= top)
screenLine = screenLine.next;
while (screenLine != null
***************
*** 92431,92434 ****
--- 92512,92531 ----
paintArrow(g, i, Color.blue);
}
+ boolean firstBrace = true;
+ for (int i = 0; i < dispLines.length; i++) {
+ if (dispLineVisibility[i] == false)
+ continue;
+ int openBrace = dispLines[i].indexOf('{');
+ int closeBrace = dispLines[i].indexOf('}');
+ if (openBrace != -1 && closeBrace == -1) {
+ if (firstBrace) {
+ firstBrace = false;
+ continue;
+ }
+ int tabWidth = StringSplitter.skipChars(dispLines[i], ' ') * g.getFontMetrics().charWidth(' ');
+ boolean nextLineHidden = i + 1 < dispLines.length && !dispLineVisibility[i + 1];
+ paintTreeWidget(g, i, tabWidth, nextLineHidden);
+ }
+ }
}
object wlott:3374
***************
*** 95621,95629 ****
rgs:153
rgs:247
- schin:497
schin:498
rgs:5941
nkramer:133
wlott:3213
nkramer:27628
nkramer:134
--- 95718,95726 ----
rgs:153
rgs:247
schin:498
rgs:5941
nkramer:133
wlott:3213
+ schin:522
nkramer:27628
nkramer:134
***************
*** 101816,101819 ****
--- 101913,101917 ----
rgs2:153
rgs:13390
+ schin:523
rgs:6148
rgs:577
***************
*** 105261,105264 ****
--- 105359,105366 ----
wlott:3217
wlott:3017
+ schin:519
+ schin:520
+ schin:521
+ schin:524
wlott:3090
schin:495
|