|
@@ -44,14 +44,12 @@ import com.dmdirc.interfaces.config.ConfigChangeListener;
|
44
|
44
|
import com.dmdirc.ui.Colour;
|
45
|
45
|
import com.dmdirc.ui.CoreUIUtils;
|
46
|
46
|
import com.dmdirc.ui.IconManager;
|
47
|
|
-import com.dmdirc.ui.WindowManager;
|
48
|
47
|
import com.dmdirc.util.collections.ListenerList;
|
49
|
48
|
import com.dmdirc.util.collections.QueuedLinkedHashSet;
|
50
|
49
|
|
51
|
50
|
import com.google.common.eventbus.EventBus;
|
52
|
51
|
|
53
|
52
|
import java.awt.Dimension;
|
54
|
|
-import java.awt.Font;
|
55
|
53
|
import java.awt.event.WindowEvent;
|
56
|
54
|
import java.awt.event.WindowFocusListener;
|
57
|
55
|
import java.awt.event.WindowListener;
|
|
@@ -88,8 +86,6 @@ public class MainFrame extends JFrame implements WindowListener,
|
88
|
86
|
private final QueuedLinkedHashSet<TextFrame> focusOrder;
|
89
|
87
|
/** Apple instance. */
|
90
|
88
|
private final Apple apple;
|
91
|
|
- /** Swing Controller. */
|
92
|
|
- private final SwingController controller;
|
93
|
89
|
/** Controller to use to end the program. */
|
94
|
90
|
private final LifecycleController lifecycleController;
|
95
|
91
|
/** The window factory to use to create and listen for windows. */
|
|
@@ -106,8 +102,6 @@ public class MainFrame extends JFrame implements WindowListener,
|
106
|
102
|
private CtrlTabWindowManager frameManager;
|
107
|
103
|
/** The listeners registered with this class. */
|
108
|
104
|
private final ListenerList listeners = new ListenerList();
|
109
|
|
- /** Window management. */
|
110
|
|
- private final WindowManager windowManager;
|
111
|
105
|
/** Provider of frame managers. */
|
112
|
106
|
private final Provider<FrameManager> frameManagerProvider;
|
113
|
107
|
/** The bus to despatch events on. */
|
|
@@ -138,37 +132,31 @@ public class MainFrame extends JFrame implements WindowListener,
|
138
|
132
|
/**
|
139
|
133
|
* Creates new form MainFrame.
|
140
|
134
|
*
|
141
|
|
- * @param controller Swing controller
|
142
|
135
|
* @param apple Apple instance
|
143
|
136
|
* @param windowFactory The window factory to use to create and listen for windows.
|
144
|
137
|
* @param lifecycleController Controller to use to end the application.
|
145
|
138
|
* @param globalConfig The config to read settings from.
|
146
|
139
|
* @param quitWorker The quit worker to use when quitting the app.
|
147
|
140
|
* @param iconManager The icon manager to use to get icons.
|
148
|
|
- * @param windowManager Window management
|
149
|
141
|
* @param frameManagerProvider Provider to use to retrieve frame managers.
|
150
|
142
|
* @param eventBus The event bus to post events to.
|
151
|
143
|
*/
|
152
|
144
|
public MainFrame(
|
153
|
145
|
final Apple apple,
|
154
|
|
- final SwingController controller,
|
155
|
146
|
final SwingWindowFactory windowFactory,
|
156
|
147
|
final LifecycleController lifecycleController,
|
157
|
148
|
final AggregateConfigProvider globalConfig,
|
158
|
149
|
final Provider<QuitWorker> quitWorker,
|
159
|
150
|
final IconManager iconManager,
|
160
|
|
- final WindowManager windowManager,
|
161
|
151
|
final Provider<FrameManager> frameManagerProvider,
|
162
|
152
|
final EventBus eventBus) {
|
163
|
153
|
checkOnEDT();
|
164
|
154
|
this.apple = apple;
|
165
|
|
- this.controller = controller;
|
166
|
155
|
this.windowFactory = windowFactory;
|
167
|
156
|
this.lifecycleController = lifecycleController;
|
168
|
157
|
this.globalConfig = globalConfig;
|
169
|
158
|
this.quitWorker = quitWorker;
|
170
|
159
|
this.iconManager = iconManager;
|
171
|
|
- this.windowManager = windowManager;
|
172
|
160
|
this.frameManagerProvider = frameManagerProvider;
|
173
|
161
|
this.eventBus = eventBus;
|
174
|
162
|
|
|
@@ -182,11 +170,9 @@ public class MainFrame extends JFrame implements WindowListener,
|
182
|
170
|
|
183
|
171
|
showVersion = globalConfig.getOptionBool("ui", "showversion");
|
184
|
172
|
version = globalConfig.getOption("version", "version");
|
185
|
|
- globalConfig.addChangeListener("ui", "lookandfeel", this);
|
186
|
173
|
globalConfig.addChangeListener("ui", "showversion", this);
|
187
|
174
|
globalConfig.addChangeListener("ui", "framemanager", this);
|
188
|
175
|
globalConfig.addChangeListener("ui", "framemanagerPosition", this);
|
189
|
|
- globalConfig.addChangeListener("ui", "textPaneFontName", this);
|
190
|
176
|
globalConfig.addChangeListener("icon", "icon", this);
|
191
|
177
|
|
192
|
178
|
addWindowFocusListener(new WindowFocusListener() {
|
|
@@ -546,9 +532,6 @@ public class MainFrame extends JFrame implements WindowListener,
|
546
|
532
|
public void configChanged(final String domain, final String key) {
|
547
|
533
|
if ("ui".equals(domain)) {
|
548
|
534
|
switch (key) {
|
549
|
|
- case "lookandfeel":
|
550
|
|
- controller.updateLookAndFeel();
|
551
|
|
- break;
|
552
|
535
|
case "framemanager":
|
553
|
536
|
case "framemanagerPosition":
|
554
|
537
|
UIUtilities.invokeAndWait(new Runnable() {
|
|
@@ -564,12 +547,6 @@ public class MainFrame extends JFrame implements WindowListener,
|
564
|
547
|
}
|
565
|
548
|
});
|
566
|
549
|
break;
|
567
|
|
- case "textPaneFontName":
|
568
|
|
- final String font = globalConfig.getOptionString("ui", "textPaneFontName");
|
569
|
|
- log.debug("Changing textpane font: {}", font);
|
570
|
|
- UIUtilities.setUIFont(new Font(font, Font.PLAIN, 12));
|
571
|
|
- controller.updateComponentTrees();
|
572
|
|
- break;
|
573
|
550
|
default:
|
574
|
551
|
showVersion = globalConfig.getOptionBool("ui", "showversion");
|
575
|
552
|
break;
|