deweese 2005/03/05 11:31:09
Modified:sources/org/apache/batik/gvt/renderer
StrokingTextPainter.java
sources/org/apache/batik/gvt/text ConcreteTextSelector.java
sources/org/apache/batik/swing/gvt JGVTComponent.java
TextSelectionManager.java
Log:
1) Rationalized Text Selection code. Copy to clipboard is now done
by JGVTComponent only if 'unix style' text selection is requested
(default).
Revision ChangesPath
1.55 +4 -4
xml-batik/sources/org/apache/batik/gvt/renderer/StrokingTextPainter.java
Index: StrokingTextPainter.java
===
RCS file:
/home/cvs/xml-batik/sources/org/apache/batik/gvt/renderer/StrokingTextPainter.java,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -r1.54 -r1.55
--- StrokingTextPainter.java 15 Dec 2004 10:50:30 - 1.54
+++ StrokingTextPainter.java 5 Mar 2005 19:31:09 - 1.55
@@ -1446,7 +1446,7 @@
public Mark selectLast(TextNode node) {
AttributedCharacterIterator aci;
aci = node.getAttributedCharacterIterator();
-TextHit textHit = new TextHit(aci.getEndIndex(), false);
+TextHit textHit = new TextHit(aci.getEndIndex()-1, false);
return new BasicTextPainter.BasicMark(node, textHit);
}
@@ -1469,8 +1469,8 @@
start = (BasicTextPainter.BasicMark) startMark;
finish = (BasicTextPainter.BasicMark) finishMark;
} catch (ClassCastException cce) {
-throw new
-Error("This Mark was not instantiated by this TextPainter
class!");
+throw new Error
+("This Mark was not instantiated by this TextPainter
class!");
}
TextNode textNode = start.getTextNode();
1.21 +1 -44
xml-batik/sources/org/apache/batik/gvt/text/ConcreteTextSelector.java
Index: ConcreteTextSelector.java
===
RCS file:
/home/cvs/xml-batik/sources/org/apache/batik/gvt/text/ConcreteTextSelector.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- ConcreteTextSelector.java 18 Aug 2004 07:14:40 - 1.20
+++ ConcreteTextSelector.java 5 Mar 2005 19:31:09 - 1.21
@@ -121,7 +121,6 @@
Shape shape = node.getHighlightShape();
dispatchSelectionEvent(new SelectionEvent
(selection, SelectionEvent.SELECTION_DONE, shape));
-copyToClipboard(selection);
}
public void clearSelection() {
@@ -129,7 +128,6 @@
return;
dispatchSelectionEvent(new SelectionEvent
(null, SelectionEvent.SELECTION_CLEARED, null));
-// copyToClipboard(null);
selectionNode = null;
}
@@ -207,7 +205,6 @@
new SelectionEvent(oldSelection,
SelectionEvent.SELECTION_DONE,
newShape));
-copyToClipboard(oldSelection);
} else
if (isSelectContinueGesture(evt)) {
@@ -235,7 +232,6 @@
.addTreeGraphicsNodeChangeListener(this);
}
selectionNode = source;
-
((Selectable) source).selectAll(p.getX(), p.getY());
Object oldSelection = getSelection();
Shape newShape =
@@ -244,7 +240,6 @@
new SelectionEvent(oldSelection,
SelectionEvent.SELECTION_DONE,
newShape));
-copyToClipboard(oldSelection);
}
}
}
@@ -341,44 +336,6 @@
}
}
-private void copyToClipboard(final Object o) {
- //
- // HACK: getSystemClipboard sometimes deadlocks on linux when called
- // from the AWT Thread. The Thread creation prevents that.
- //
- new Thread() {
- public void run() {
- // first see if we can access the clipboard
- SecurityManager securityManager = System.getSecurityManager();
- boolean canAccessClipboard = true;
- if (securityManager != null) {
- try {
- securityManager.checkSystemClipboardAccess();
- } catch (SecurityException e) {
- canAccessClipboard = false;
- }
- }
- if (canAccessClipboard) {
- String label = "";
- if (o instanceof CharacterIterator) {
- CharacterIterator iter = (CharacterIterator) o;
- char[] cbuff = new
char[iter.getEndIn