|
From: <ox-...@us...> - 2002-07-09 00:51:13
|
Update of /cvsroot/sheets/sheets
In directory usw-pr-cvs1:/tmp/cvs-serv19588
Modified Files:
Sheets.sheets
Log Message:
Added preliminary support for code folding (nothing user visible yet). This is also a test of the syncmail cvs reporting...
Index: Sheets.sheets
===================================================================
RCS file: /cvsroot/sheets/sheets/Sheets.sheets,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** Sheets.sheets 5 Jul 2002 23:33:21 -0000 1.10
--- Sheets.sheets 9 Jul 2002 00:51:07 -0000 1.11
***************
*** 1271,1274 ****
--- 1271,1276 ----
rgs:153
rgs:247
+ schin:498
+ schin:497
rgs:5941
nkramer:133
***************
*** 1600,1604 ****
{
super(fragment);
! dispLines = lines;
}
object nkramer:144
--- 1602,1606 ----
{
super(fragment);
! setDispLines(lines);
}
object nkramer:144
***************
*** 62110,62114 ****
public void AbstractSheetViewer.invalidate (String attribute) {
super.invalidate(attribute);
! dispLines = ((Sheet)getActualFragment()).toLines(Fragment.FULL);
}
object rgs:10247
--- 62112,62116 ----
public void AbstractSheetViewer.invalidate (String attribute) {
super.invalidate(attribute);
! setDispLines(((Sheet)getActualFragment()).toLines(Fragment.FULL));
}
object rgs:10247
***************
*** 62118,62122 ****
public void TOCSheetViewer.invalidate (String attribute) {
super.invalidate(attribute);
! dispLines = ((Sheet)getActualFragment()).toLines(Fragment.SHORT_NAME);
}
object rgs:10264
--- 62120,62124 ----
public void TOCSheetViewer.invalidate (String attribute) {
super.invalidate(attribute);
! setDispLines(((Sheet)getActualFragment()).toLines(Fragment.SHORT_NAME));
}
object rgs:10264
***************
*** 68554,68558 ****
section text rgs:12571
public void AttributeViewer.stopEditing (boolean restore) {
! if (buffer != null && restore) dispLines = buffer.oldLines;
super.stopEditing(restore);
}
--- 68556,68560 ----
section text rgs:12571
public void AttributeViewer.stopEditing (boolean restore) {
! if (buffer != null && restore) setDispLines(buffer.oldLines);
super.stopEditing(restore);
}
***************
*** 71580,71590 ****
// Setup the line formatter.
! LineFormatter formatter
! = new LineFormatter(this, at == 0 ? 0 : formattedLines[at-1].bottom);
// Format the lines.
! for (int line = at; line < at + count; line++)
! formattedLines[line]
! = formatter.formatLine(dispLines[line], styleMap.stylesAt(line, 0));
// Are there any pre-formatted lines after the lines we just formatted?
if (at + count < dispLines.length) {
// Yes, see if they moved at all.
--- 71582,71598 ----
// Setup the line formatter.
! int previousLine = at - 1;
! while (previousLine >= 0 && formattedLines[previousLine] == null)
! previousLine--; // find the previous line that is visible
! LineFormatter formatter = new LineFormatter(this, previousLine == -1 ? 0 : formattedLines[previousLine].bottom);
// Format the lines.
! for (int line = at; line < at + count; line++) {
! if (!dispLineVisibility[line])
! continue;
! formattedLines[line] = formatter.formatLine(dispLines[line], styleMap.stylesAt(line, 0));
! }
// Are there any pre-formatted lines after the lines we just formatted?
+ while (at + count < dispLines.length && formattedLines[at+count] == null)
+ count++; // skip over hidden lines
if (at + count < dispLines.length) {
// Yes, see if they moved at all.
***************
*** 71593,71597 ****
// They did. So we need to adjust each of them accordingly.
for (int line = at + count; line < dispLines.length; line++)
! formattedLines[line].adjustY(delta);
if (oldHeight != -1) {
// And we also need to adjust the total height and invalidate the
--- 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
***************
*** 80431,80434 ****
--- 80440,80490 ----
searchText = text;
}
+ object schin:495
+ pkg=org.browsecode.sheets
+ type=java
+ section text schin:495
+ private FormattedLine[] RichTextViewer.getVisibleFormattedLines()
+ {
+ int visible = 0;
+ for (int i=0; i<formattedLines.length; i++)
+ if (formattedLines[i] != null)
+ visible++;
+ FormattedLine[] visibleLines = new FormattedLine[visible];
+ for (int i=0, j=0; i<formattedLines.length; i++)
+ if (formattedLines[i] != null)
+ visibleLines[j++] = formattedLines[i];
+ return visibleLines;
+ }
+ object schin:496
+ pkg=org.browsecode.sheets
+ type=java
+ section text schin:496
+ private int RichTextViewer.getFormattedLineIndex(FormattedLine line)
+ {
+ for (int i=0; i<formattedLines.length; i++)
+ if (formattedLines[i] == line)
+ return i;
+ 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
+ type=java
+ section text schin:498
+ 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
pkg=org.browsecode.antlr
***************
*** 89274,89278 ****
public TOCSheetViewer (Sheet sheet, boolean topLevel) {
super(sheet, "toc", VectorUtils.make("toc"), !topLevel);
! dispLines = ((Sheet)getActualFragment()).toLines(Fragment.SHORT_NAME);
if (topLevel) showWith("sheet contents");
this.topLevel = topLevel;
--- 89330,89334 ----
public TOCSheetViewer (Sheet sheet, boolean topLevel) {
super(sheet, "toc", VectorUtils.make("toc"), !topLevel);
! setDispLines(((Sheet)getActualFragment()).toLines(Fragment.SHORT_NAME));
if (topLevel) showWith("sheet contents");
this.topLevel = topLevel;
***************
*** 90155,90159 ****
(String[] newLines, int at, int replace, int with, boolean restyleToEnd)
{
! dispLines = newLines;
if (replace != with)
invalidate();
--- 90211,90215 ----
(String[] newLines, int at, int replace, int with, boolean restyleToEnd)
{
! setDispLines(newLines);
if (replace != with)
invalidate();
***************
*** 90176,90179 ****
--- 90232,90237 ----
wlott:3017
wlott:3090
+ schin:495
+ schin:496
wlott:3556
rgs:13359
***************
*** 90282,90286 ****
}
// Record the new dispLines.
! dispLines = newLines;
// Make sure the style map exists and has the right number of lines.
if (styleMap != null) {
--- 90340,90344 ----
}
// Record the new dispLines.
! setDispLines(newLines);
// Make sure the style map exists and has the right number of lines.
if (styleMap != null) {
***************
*** 90496,90499 ****
--- 90554,90559 ----
line++) {
FormattedLine formattedLine = formattedLines[line];
+ if (formattedLine == null)
+ continue;
if (formattedLine.top >= bottom)
break;
***************
*** 91247,91251 ****
--- 91307,91315 ----
return 0;
LineItem item = findLineItem(line, posn);
+ if (item == null)
+ return 0;
FormattedLine fline = formattedLines[line];
+ if (fline == null)
+ return 0;
return item.x + item.width(this, fline.chars, fline.bytes,
posn - item.posn + 1);
***************
*** 91261,91265 ****
--- 91325,91333 ----
return 0;
LineItem item = findLineItem(line, posn);
+ if (item == null)
+ return 0;
FormattedLine fline = formattedLines[line];
+ if (fline == null)
+ return 0;
return item.x + item.width(this, fline.chars, fline.bytes, posn - item.posn);
}
***************
*** 91276,91279 ****
--- 91344,91349 ----
return 0;
ScreenLine sline = findScreenLine(line, posn);
+ if (sline == null)
+ return 0;
return sline.baseline - sline.ascent;
}
***************
*** 91290,91293 ****
--- 91360,91365 ----
return 0;
ScreenLine sline = findScreenLine(line, posn);
+ if (sline == null)
+ return 0;
return sline.baseline + sline.descent;
}
***************
*** 91303,91306 ****
--- 91375,91380 ----
if (formattedLines == null) return null;
FormattedLine fline = formattedLines[line];
+ if (fline == null)
+ return null;
ScreenLine sline = fline.screenLines;
while (posn >= sline.length && sline.next != null) {
***************
*** 91328,91331 ****
--- 91402,91407 ----
line = formattedLines.length - 1;
FormattedLine fline = formattedLines[line];
+ if (fline == null)
+ return new LinePosition(0, 0);
ScreenLine sline = fline.screenLines;
while (y >= sline.baseline + sline.descent && sline.next != null)
***************
*** 91424,91428 ****
if (formattedLines == null)
return 0;
! return findScreenLine(line, posn).baseline;
}
object wlott:3186
--- 91500,91507 ----
if (formattedLines == null)
return 0;
! ScreenLine screenLine = findScreenLine(line, posn);
! if (screenLine == null)
! return 0;
! return screenLine.baseline;
}
object wlott:3186
***************
*** 91447,91456 ****
private int RichTextViewer.findLine (int y)
{
if (formattedLines == null) return 0;
int min = 0;
! int max = formattedLines.length;
while (min < max) {
int mid = (min + max) / 2;
! FormattedLine fline = formattedLines[mid];
if (y < fline.top)
max = mid;
--- 91526,91541 ----
private int RichTextViewer.findLine (int y)
{
+ if (y < 0)
+ return -1;
+ else if (y >= textHeight)
+ return formattedLines.length;
+
if (formattedLines == null) return 0;
+ FormattedLine[] visibleLines = getVisibleFormattedLines();
int min = 0;
! int max = visibleLines.length;
while (min < max) {
int mid = (min + max) / 2;
! FormattedLine fline = visibleLines[mid];
if (y < fline.top)
max = mid;
***************
*** 91458,91469 ****
min = mid + 1;
else
! return mid;
}
! if (y < 0)
! return -1;
! else if (y >= textHeight)
! return formattedLines.length;
! else
! throw new Error(y + " is in 0.." + textHeight + " but isn't in a line?");
}
object wlott:3195
--- 91543,91550 ----
min = mid + 1;
else
! return getFormattedLineIndex(fline);
}
!
! throw new Error(y + " is in 0.." + textHeight + " but isn't in a line?");
}
object wlott:3195
***************
*** 91923,91926 ****
--- 92004,92009 ----
private LineItem RichTextViewer.findLineItem (ScreenLine sline, int posn)
{
+ if (sline == null)
+ return null;
LineItem item = sline.firstItem;
while (posn >= item.posn + item.length && item.next != null)
***************
*** 91997,92000 ****
--- 92080,92085 ----
// The full logical lines between the start and end lines.
for (int line = sel.start.line + 1; line < sel.end.line; line++) {
+ if (formattedLines[line] == null)
+ continue; // skip hidden lines
for (ScreenLine sline = formattedLines[line].screenLines;
sline != null;
***************
*** 92009,92015 ****
}
// The screen lines in the end logical line before the end screen line.
! for (ScreenLine sline = formattedLines[sel.end.line].screenLines;
! sline != endLine;
! sline = sline.next) {
int posn = sline.firstItem.posn;
int x1 = charStart(sel.end.line, posn);
--- 92094,92098 ----
}
// The screen lines in the end logical line before the end screen line.
! for (ScreenLine sline = formattedLines[sel.end.line].screenLines; sline != endLine; sline = sline.next) {
int posn = sline.firstItem.posn;
int x1 = charStart(sel.end.line, posn);
***************
*** 92279,92282 ****
--- 92362,92367 ----
line++) {
FormattedLine formattedLine = formattedLines[line];
+ if (formattedLine == null)
+ continue;
if (formattedLine.top >= bottom)
break;
***************
*** 95536,95539 ****
--- 95621,95626 ----
rgs:153
rgs:247
+ schin:497
+ schin:498
rgs:5941
nkramer:133
***************
*** 100091,100095 ****
nkramer:30979
nkramer:30596
! schin:495
lightWeight:separator
ram:2493
--- 100178,100182 ----
nkramer:30979
nkramer:30596
! schin:513
lightWeight:separator
ram:2493
***************
*** 104251,104275 ****
schin:155
schin:156
- object schin:495
- filename=>menu
- title=ANTLR package
- type=sheet
- section text schin:495
- ANTLR package
- section components schin:495
- schin:499
- schin:498
- object schin:498
- filename=>classes
- title=ANTLR Fragments
- type=sheet
- section text schin:498
- ANTLR Fragments
- section components schin:498
- schin:500
- lightWeight:separator
- schin:514
- schin:515
- schin:516
object schin:499
filename=>classes
--- 104338,104341 ----
***************
*** 104293,104296 ****
--- 104359,104383 ----
schin:511
schin:512
+ object schin:513
+ filename=>menu
+ title=ANTLR package
+ type=sheet
+ section text schin:513
+ ANTLR package
+ section components schin:513
+ schin:499
+ schin:518
+ object schin:518
+ filename=>classes
+ title=ANTLR Fragments
+ type=sheet
+ section text schin:518
+ ANTLR Fragments
+ section components schin:518
+ schin:500
+ lightWeight:separator
+ schin:514
+ schin:515
+ schin:516
object sjc:6
filename=>classes
***************
*** 105175,105178 ****
--- 105262,105267 ----
wlott:3017
wlott:3090
+ schin:495
+ schin:496
rgs:13446
wlott:3556
|