|
@@ -23,8 +23,8 @@
|
23
|
23
|
package com.dmdirc.addons.ui_swing.textpane;
|
24
|
24
|
|
25
|
25
|
import com.dmdirc.addons.ui_swing.UIUtilities;
|
|
26
|
+import com.dmdirc.interfaces.WindowModel;
|
26
|
27
|
import com.dmdirc.interfaces.config.ConfigChangeListener;
|
27
|
|
-import com.dmdirc.interfaces.ui.Window;
|
28
|
28
|
import com.dmdirc.ui.messages.CachingDocument;
|
29
|
29
|
import com.dmdirc.ui.messages.IRCDocument;
|
30
|
30
|
import com.dmdirc.ui.messages.IRCDocumentListener;
|
|
@@ -73,8 +73,8 @@ public final class TextPane extends JComponent implements MouseWheelListener,
|
73
|
73
|
private final TextPaneCanvas canvas;
|
74
|
74
|
/** IRCDocument. */
|
75
|
75
|
private final IRCDocument document;
|
76
|
|
- /** Parent Frame. */
|
77
|
|
- private final Window frame;
|
|
76
|
+ /** Parent window. */
|
|
77
|
+ private final WindowModel window;
|
78
|
78
|
/** Indicator to show whether new lines have been added. */
|
79
|
79
|
private final JLabel newLineIndicator;
|
80
|
80
|
/** Background painter. */
|
|
@@ -94,18 +94,18 @@ public final class TextPane extends JComponent implements MouseWheelListener,
|
94
|
94
|
* @param configDomain The domain to read configuration from.
|
95
|
95
|
* @param urlBuilder The builder to use to construct URLs for resources.
|
96
|
96
|
* @param clipboard The clipboard to handle copy and paste actions
|
97
|
|
- * @param frame Parent Frame
|
|
97
|
+ * @param window Parent window
|
98
|
98
|
*/
|
99
|
99
|
public TextPane(
|
100
|
100
|
final String configDomain,
|
101
|
101
|
final URLBuilder urlBuilder, final Clipboard clipboard,
|
102
|
|
- final Window frame) {
|
103
|
|
- this.frame = frame;
|
|
102
|
+ final WindowModel window) {
|
|
103
|
+ this.window = window;
|
104
|
104
|
this.configDomain = configDomain;
|
105
|
105
|
this.clipboard = clipboard;
|
106
|
106
|
|
107
|
107
|
setUI(new TextPaneUI());
|
108
|
|
- document = frame.getContainer().getBackBuffer().getDocument();
|
|
108
|
+ document = window.getBackBuffer().getDocument();
|
109
|
109
|
newLineIndicator = new JLabel("", SwingConstants.CENTER);
|
110
|
110
|
newLineIndicator.setBackground(Color.RED);
|
111
|
111
|
newLineIndicator.setForeground(Color.WHITE);
|
|
@@ -113,7 +113,7 @@ public final class TextPane extends JComponent implements MouseWheelListener,
|
113
|
113
|
newLineIndicator.setVisible(false);
|
114
|
114
|
|
115
|
115
|
setLayout(new MigLayout("fill, hidemode 3"));
|
116
|
|
- backgroundPainter = new BackgroundPainter(frame.getContainer().getConfigManager(),
|
|
116
|
+ backgroundPainter = new BackgroundPainter(window.getConfigManager(),
|
117
|
117
|
urlBuilder, configDomain, "textpanebackground",
|
118
|
118
|
"textpanebackgroundoption", "textpanebackgroundopacity");
|
119
|
119
|
canvas = new TextPaneCanvas(this,
|
|
@@ -130,8 +130,7 @@ public final class TextPane extends JComponent implements MouseWheelListener,
|
130
|
130
|
add(scrollBar, "dock east");
|
131
|
131
|
scrollBar.addAdjustmentListener(this);
|
132
|
132
|
scrollBar.addAdjustmentListener(canvas);
|
133
|
|
- frame.getContainer().getConfigManager().addChangeListener(configDomain,
|
134
|
|
- "textpanelinenotification", this);
|
|
133
|
+ window.getConfigManager().addChangeListener(configDomain, "textpanelinenotification", this);
|
135
|
134
|
configChanged("", "textpanelinenotification");
|
136
|
135
|
|
137
|
136
|
addMouseWheelListener(this);
|
|
@@ -497,8 +496,8 @@ public final class TextPane extends JComponent implements MouseWheelListener,
|
497
|
496
|
*
|
498
|
497
|
* @return Parent window
|
499
|
498
|
*/
|
500
|
|
- public Window getWindow() {
|
501
|
|
- return frame;
|
|
499
|
+ public WindowModel getWindow() {
|
|
500
|
+ return window;
|
502
|
501
|
}
|
503
|
502
|
|
504
|
503
|
/**
|
|
@@ -521,8 +520,7 @@ public final class TextPane extends JComponent implements MouseWheelListener,
|
521
|
520
|
|
522
|
521
|
@Override
|
523
|
522
|
public void configChanged(final String domain, final String key) {
|
524
|
|
- showNotification = frame.getContainer().getConfigManager()
|
525
|
|
- .getOptionBool(configDomain, "textpanelinenotification");
|
|
523
|
+ showNotification = window.getConfigManager().getOptionBool(configDomain, "textpanelinenotification");
|
526
|
524
|
if (!showNotification) {
|
527
|
525
|
UIUtilities.invokeLater(() -> newLineIndicator.setVisible(false));
|
528
|
526
|
}
|