|
@@ -30,14 +30,15 @@ import com.dmdirc.addons.ui_swing.UIUtilities;
|
30
|
30
|
import com.dmdirc.addons.ui_swing.actions.ChannelCopyAction;
|
31
|
31
|
import com.dmdirc.addons.ui_swing.actions.CommandAction;
|
32
|
32
|
import com.dmdirc.addons.ui_swing.actions.HyperlinkCopyAction;
|
|
33
|
+import com.dmdirc.addons.ui_swing.actions.InputFieldCopyAction;
|
33
|
34
|
import com.dmdirc.addons.ui_swing.actions.NicknameCopyAction;
|
34
|
35
|
import com.dmdirc.addons.ui_swing.actions.SearchAction;
|
35
|
|
-import com.dmdirc.addons.ui_swing.actions.TextPaneCopyAction;
|
36
|
36
|
import com.dmdirc.addons.ui_swing.components.LoggingSwingWorker;
|
37
|
37
|
import com.dmdirc.addons.ui_swing.components.SwingSearchBar;
|
38
|
38
|
import com.dmdirc.addons.ui_swing.textpane.ClickType;
|
39
|
39
|
import com.dmdirc.addons.ui_swing.textpane.LineInfo;
|
40
|
40
|
import com.dmdirc.addons.ui_swing.textpane.TextPane;
|
|
41
|
+import com.dmdirc.addons.ui_swing.textpane.TextPaneCopyAction;
|
41
|
42
|
import com.dmdirc.addons.ui_swing.textpane.TextPanePageDownAction;
|
42
|
43
|
import com.dmdirc.addons.ui_swing.textpane.TextPanePageUpAction;
|
43
|
44
|
import com.dmdirc.addons.ui_swing.textpane.TextPaneHomeAction;
|
|
@@ -65,7 +66,6 @@ import java.awt.Container;
|
65
|
66
|
import java.awt.Dimension;
|
66
|
67
|
import java.awt.Point;
|
67
|
68
|
import java.awt.event.KeyEvent;
|
68
|
|
-import java.awt.event.KeyListener;
|
69
|
69
|
import java.awt.event.MouseEvent;
|
70
|
70
|
import java.awt.event.MouseListener;
|
71
|
71
|
import java.beans.PropertyChangeEvent;
|
|
@@ -104,8 +104,8 @@ import net.miginfocom.swing.MigLayout;
|
104
|
104
|
* Implements a generic (internal) frame.
|
105
|
105
|
*/
|
106
|
106
|
public abstract class TextFrame extends JInternalFrame implements Window,
|
107
|
|
- PropertyChangeListener, InternalFrameListener,
|
108
|
|
- MouseListener, KeyListener, ConfigChangeListener, FrameInfoListener {
|
|
107
|
+ PropertyChangeListener, InternalFrameListener, MouseListener,
|
|
108
|
+ ConfigChangeListener, FrameInfoListener {
|
109
|
109
|
|
110
|
110
|
/** Logger to use. */
|
111
|
111
|
private static final java.util.logging.Logger LOGGER =
|
|
@@ -126,8 +126,6 @@ public abstract class TextFrame extends JInternalFrame implements Window,
|
126
|
126
|
private StringTranscoder transcoder;
|
127
|
127
|
/** Frame buffer size. */
|
128
|
128
|
private int frameBufferSize;
|
129
|
|
- /** Quick copy? */
|
130
|
|
- private boolean quickCopy;
|
131
|
129
|
/** Are we closing? */
|
132
|
130
|
private boolean closing = false;
|
133
|
131
|
/** Input window for popup commands. */
|
|
@@ -164,7 +162,6 @@ public abstract class TextFrame extends JInternalFrame implements Window,
|
164
|
162
|
|
165
|
163
|
final ConfigManager config = owner.getConfigManager();
|
166
|
164
|
frameBufferSize = config.getOptionInt("ui", "frameBufferSize");
|
167
|
|
- quickCopy = config.getOptionBool("ui", "quickCopy");
|
168
|
165
|
|
169
|
166
|
setFrameIcon(IconManager.getIconManager().getIcon(owner.getIcon()));
|
170
|
167
|
|
|
@@ -206,7 +203,6 @@ public abstract class TextFrame extends JInternalFrame implements Window,
|
206
|
203
|
|
207
|
204
|
config.addChangeListener("ui", "foregroundcolour", this);
|
208
|
205
|
config.addChangeListener("ui", "backgroundcolour", this);
|
209
|
|
- config.addChangeListener("ui", "quickCopy", this);
|
210
|
206
|
config.addChangeListener("ui", "frameBufferSize", this);
|
211
|
207
|
|
212
|
208
|
addPropertyChangeListener("maximum", this);
|
|
@@ -519,11 +515,9 @@ public abstract class TextFrame extends JInternalFrame implements Window,
|
519
|
515
|
setTextPane(new TextPane(this));
|
520
|
516
|
|
521
|
517
|
getTextPane().addMouseListener(this);
|
522
|
|
- getTextPane().addKeyListener(this);
|
523
|
518
|
|
524
|
519
|
searchBar = new SwingSearchBar(this, controller.getMainFrame());
|
525
|
520
|
searchBar.setVisible(false);
|
526
|
|
- searchBar.addKeyListener(this);
|
527
|
521
|
|
528
|
522
|
getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).
|
529
|
523
|
put(KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_UP, 0),
|
|
@@ -548,6 +542,12 @@ public abstract class TextFrame extends JInternalFrame implements Window,
|
548
|
542
|
put(KeyStroke.getKeyStroke(KeyEvent.VK_END,
|
549
|
543
|
UIUtilities.getCtrlDownMask()), "endAction");
|
550
|
544
|
|
|
545
|
+ getSearchBar().getTextField().getInputMap().put(KeyStroke.getKeyStroke(
|
|
546
|
+ KeyEvent.VK_C, UIUtilities.getCtrlMask()), "textpaneCopy");
|
|
547
|
+ getSearchBar().getTextField().getActionMap().put("textpaneCopy",
|
|
548
|
+ new InputFieldCopyAction(getTextPane(),
|
|
549
|
+ getSearchBar().getTextField()));
|
|
550
|
+
|
551
|
551
|
getActionMap().put("pageUpAction",
|
552
|
552
|
new TextPanePageUpAction(getTextPane()));
|
553
|
553
|
getActionMap().put("pageDownAction",
|
|
@@ -856,11 +856,6 @@ public abstract class TextFrame extends JInternalFrame implements Window,
|
856
|
856
|
*/
|
857
|
857
|
@Override
|
858
|
858
|
public void mouseReleased(final MouseEvent mouseEvent) {
|
859
|
|
- if (quickCopy && mouseEvent.getSource() == getTextPane()) {
|
860
|
|
- getTextPane().copy();
|
861
|
|
- getTextPane().clearSelection();
|
862
|
|
- }
|
863
|
|
-
|
864
|
859
|
processMouseClickEvent(mouseEvent, MouseClickType.RELEASED);
|
865
|
860
|
}
|
866
|
861
|
|
|
@@ -1121,41 +1116,6 @@ public abstract class TextFrame extends JInternalFrame implements Window,
|
1121
|
1116
|
return menu;
|
1122
|
1117
|
}
|
1123
|
1118
|
|
1124
|
|
- /**
|
1125
|
|
- * {@inheritDoc}
|
1126
|
|
- *
|
1127
|
|
- * @param event Key event
|
1128
|
|
- */
|
1129
|
|
- @Override
|
1130
|
|
- public void keyTyped(final KeyEvent event) {
|
1131
|
|
- //Ignore.
|
1132
|
|
- }
|
1133
|
|
-
|
1134
|
|
- /**
|
1135
|
|
- * {@inheritDoc}
|
1136
|
|
- *
|
1137
|
|
- * @param event Key event
|
1138
|
|
- */
|
1139
|
|
- @Override
|
1140
|
|
- public void keyPressed(final KeyEvent event) {
|
1141
|
|
- if (!quickCopy && (event.getModifiers() & UIUtilities.getCtrlMask()) !=
|
1142
|
|
- 0 &&
|
1143
|
|
- event.getKeyCode() == KeyEvent.VK_C) {
|
1144
|
|
- getTextPane().copy();
|
1145
|
|
- }
|
1146
|
|
-
|
1147
|
|
- }
|
1148
|
|
-
|
1149
|
|
- /**
|
1150
|
|
- * {@inheritDoc}
|
1151
|
|
- *
|
1152
|
|
- * @param event Key event
|
1153
|
|
- */
|
1154
|
|
- @Override
|
1155
|
|
- public void keyReleased(final KeyEvent event) {
|
1156
|
|
- //Ignore.
|
1157
|
|
- }
|
1158
|
|
-
|
1159
|
1119
|
/**
|
1160
|
1120
|
* Gets the search bar.
|
1161
|
1121
|
*
|
|
@@ -1183,9 +1143,6 @@ public abstract class TextFrame extends JInternalFrame implements Window,
|
1183
|
1143
|
} else if ("frameBufferSize".equals(key)) {
|
1184
|
1144
|
frameBufferSize = getContainer().getConfigManager().
|
1185
|
1145
|
getOptionInt("ui", "frameBufferSize");
|
1186
|
|
- } else if ("quickCopy".equals(key)) {
|
1187
|
|
- quickCopy = getContainer().getConfigManager().
|
1188
|
|
- getOptionBool("ui", "quickCopy");
|
1189
|
1146
|
}
|
1190
|
1147
|
}
|
1191
|
1148
|
}
|