[kaffe] CVS kaffe (robilad): resynced with GNU Classpath: swing
fixes
Kaffe CVS
cvs-commits at kaffe.org
Sat Jan 22 11:25:30 PST 2005
PatchSet 5902
Date: 2005/01/22 19:10:50
Author: robilad
Branch: HEAD
Tag: (none)
Log:
resynced with GNU Classpath: swing fixes
2005-01-22 Dalibor Topic <robilad at kaffe.org>
Resynced with GNU Classpath.
2005-01-21 Michael Koch <konqueror at gmx.de>
* javax/swing/text/DefaultEditorKit.java
(read): Added '\n' after each line.
* javax/swing/text/PlainView.java
(modelToView): Update metrics.
(drawLine): Use offsets from element.
(paint): Update metrics. Draw all lines.
Members:
ChangeLog:1.3441->1.3442
libraries/javalib/javax/swing/text/DefaultEditorKit.java:1.8->1.9
libraries/javalib/javax/swing/text/PlainView.java:1.3->1.4
Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.3441 kaffe/ChangeLog:1.3442
--- kaffe/ChangeLog:1.3441 Sat Jan 22 19:08:10 2005
+++ kaffe/ChangeLog Sat Jan 22 19:10:50 2005
@@ -2,6 +2,19 @@
Resynced with GNU Classpath.
+ 2005-01-21 Michael Koch <konqueror at gmx.de>
+
+ * javax/swing/text/DefaultEditorKit.java
+ (read): Added '\n' after each line.
+ * javax/swing/text/PlainView.java
+ (modelToView): Update metrics.
+ (drawLine): Use offsets from element.
+ (paint): Update metrics. Draw all lines.
+
+2005-01-22 Dalibor Topic <robilad at kaffe.org>
+
+ Resynced with GNU Classpath.
+
2005-01-20 Michael Koch <konqueror at gmx.de>
* java/awt/print/PrinterJob.java
Index: kaffe/libraries/javalib/javax/swing/text/DefaultEditorKit.java
diff -u kaffe/libraries/javalib/javax/swing/text/DefaultEditorKit.java:1.8 kaffe/libraries/javalib/javax/swing/text/DefaultEditorKit.java:1.9
--- kaffe/libraries/javalib/javax/swing/text/DefaultEditorKit.java:1.8 Thu Jan 13 07:38:58 2005
+++ kaffe/libraries/javalib/javax/swing/text/DefaultEditorKit.java Sat Jan 22 19:10:56 2005
@@ -375,7 +375,10 @@
StringBuffer content = new StringBuffer();
while ((line = reader.readLine()) != null)
- content.append(line);
+ {
+ content.append(line);
+ content.append("\n");
+ }
document.insertString(offset, content.toString(),
SimpleAttributeSet.EMPTY);
Index: kaffe/libraries/javalib/javax/swing/text/PlainView.java
diff -u kaffe/libraries/javalib/javax/swing/text/PlainView.java:1.3 kaffe/libraries/javalib/javax/swing/text/PlainView.java:1.4
--- kaffe/libraries/javalib/javax/swing/text/PlainView.java:1.3 Tue Sep 28 22:45:33 2004
+++ kaffe/libraries/javalib/javax/swing/text/PlainView.java Sat Jan 22 19:10:56 2005
@@ -1,5 +1,5 @@
/* PlainView.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -46,7 +46,6 @@
import java.awt.Rectangle;
import java.awt.Shape;
-
public class PlainView extends View
implements TabExpander
{
@@ -93,6 +92,9 @@
public Shape modelToView(int position, Shape a, Position.Bias b)
throws BadLocationException
{
+ // Ensure metrics are up-to-date.
+ updateMetrics();
+
Document document = getDocument();
// Get rectangle of the line containing position.
@@ -121,7 +123,8 @@
{
metrics = g.getFontMetrics();
// FIXME: Selected text are not drawn yet.
- drawUnselectedText(g, x, y, 0, getDocument().getLength());
+ Element line = getDocument().getDefaultRootElement().getElement(lineIndex);
+ drawUnselectedText(g, x, y, line.getStartOffset(), line.getEndOffset());
//drawSelectedText(g, , , , );
}
catch (BadLocationException e)
@@ -150,6 +153,9 @@
public void paint(Graphics g, Shape s)
{
+ // Ensure metrics are up-to-date.
+ updateMetrics();
+
JTextComponent textComponent = (JTextComponent) getContainer();
g.setFont(textComponent.getFont());
@@ -159,7 +165,15 @@
Rectangle rect = s.getBounds();
// FIXME: Text may be scrolled.
- drawLine(0, g, rect.x, rect.y);
+ Document document = textComponent.getDocument();
+ Element root = document.getDefaultRootElement();
+ int y = rect.y;
+
+ for (int i = 0; i < root.getElementCount(); i++)
+ {
+ drawLine(i, g, rect.x, y);
+ y += metrics.getHeight();
+ }
}
public int getTabSize()
More information about the kaffe
mailing list