|
@@ -26,7 +26,7 @@ import com.dmdirc.addons.ui_swing.UIUtilities;
|
26
|
26
|
import com.dmdirc.addons.ui_swing.textpane.LineRenderer.RenderResult;
|
27
|
27
|
import com.dmdirc.interfaces.config.AggregateConfigProvider;
|
28
|
28
|
import com.dmdirc.interfaces.config.ConfigChangeListener;
|
29
|
|
-import com.dmdirc.ui.messages.IRCDocument;
|
|
29
|
+import com.dmdirc.ui.messages.CachingDocument;
|
30
|
30
|
import com.dmdirc.ui.messages.IRCTextAttribute;
|
31
|
31
|
import com.dmdirc.ui.messages.LinePosition;
|
32
|
32
|
import com.dmdirc.util.StringUtils;
|
|
@@ -48,6 +48,7 @@ import java.awt.font.TextHitInfo;
|
48
|
48
|
import java.awt.font.TextLayout;
|
49
|
49
|
import java.awt.geom.Rectangle2D;
|
50
|
50
|
import java.text.AttributedCharacterIterator;
|
|
51
|
+import java.text.AttributedString;
|
51
|
52
|
import java.util.HashMap;
|
52
|
53
|
import java.util.Map;
|
53
|
54
|
|
|
@@ -69,7 +70,7 @@ class TextPaneCanvas extends JPanel implements MouseInputListener,
|
69
|
70
|
/** Both Side padding for textpane. */
|
70
|
71
|
private static final int DOUBLE_SIDE_PADDING = SINGLE_SIDE_PADDING * 2;
|
71
|
72
|
/** IRCDocument. */
|
72
|
|
- private final IRCDocument document;
|
|
73
|
+ private final CachingDocument<AttributedString> document;
|
73
|
74
|
/** parent textpane. */
|
74
|
75
|
private final TextPane textPane;
|
75
|
76
|
/** Position -> LineInfo. */
|
|
@@ -99,7 +100,7 @@ class TextPaneCanvas extends JPanel implements MouseInputListener,
|
99
|
100
|
* @param parent parent text pane for the canvas
|
100
|
101
|
* @param document IRCDocument to be displayed
|
101
|
102
|
*/
|
102
|
|
- public TextPaneCanvas(final TextPane parent, final IRCDocument document) {
|
|
103
|
+ public TextPaneCanvas(final TextPane parent, final CachingDocument<AttributedString> document) {
|
103
|
104
|
this.document = document;
|
104
|
105
|
textPane = parent;
|
105
|
106
|
this.manager = parent.getWindow().getContainer().getConfigManager();
|
|
@@ -260,7 +261,7 @@ class TextPaneCanvas extends JPanel implements MouseInputListener,
|
260
|
261
|
public ClickTypeValue getClickType(final LineInfo lineInfo) {
|
261
|
262
|
if (lineInfo.getLine() != -1) {
|
262
|
263
|
final AttributedCharacterIterator iterator = document.getStyledLine(
|
263
|
|
- lineInfo.getLine());
|
|
264
|
+ lineInfo.getLine()).getIterator();
|
264
|
265
|
final int index = lineInfo.getIndex();
|
265
|
266
|
if (index >= iterator.getBeginIndex() && index <= iterator.getEndIndex()) {
|
266
|
267
|
iterator.setIndex(lineInfo.getIndex());
|
|
@@ -361,7 +362,8 @@ class TextPaneCanvas extends JPanel implements MouseInputListener,
|
361
|
362
|
|
362
|
363
|
if (lineInfo.getLine() != -1
|
363
|
364
|
&& document.getLine(lineInfo.getLine()) != null) {
|
364
|
|
- final AttributedCharacterIterator iterator = document.getStyledLine(lineInfo.getLine());
|
|
365
|
+ final AttributedCharacterIterator iterator =
|
|
366
|
+ document.getStyledLine(lineInfo.getLine()).getIterator();
|
365
|
367
|
|
366
|
368
|
if (lineInfo.getIndex() < iterator.getBeginIndex()
|
367
|
369
|
|| lineInfo.getIndex() > iterator.getEndIndex()) {
|