OmegaT の背景に画像を表示します。
OmegaT 3.1.3 対応
@@ -2,7 +2,7 @@ | ||
2 | 2 | Main-Class: org.omegat.Main |
3 | 3 | License: GNU Public License version 3 or later |
4 | 4 | Specification-Version: 1.0 |
5 | -Implementation-Version: 0.2 | |
5 | +Implementation-Version: 0.3 | |
6 | 6 | Permissions: all-permissions |
7 | 7 | Class-Path: lib/lib-mnemonics.jar |
8 | 8 | OmegaT-Plugins: |
@@ -0,0 +1,133 @@ | ||
1 | +/************************************************************************** | |
2 | + Moenizer - Allow to set background image for OmegaT. | |
3 | + | |
4 | + Copyright (C) 2014 Yu Tang | |
5 | + Home page: http://sourceforge.jp/users/yu-tang/ | |
6 | + Support center: http://sourceforge.jp/users/yu-tang/pf/Moenizer/ | |
7 | + | |
8 | + This file is part of plugin for OmegaT. | |
9 | + http://www.omegat.org/ | |
10 | + | |
11 | + License: GNU GPL version 3 or (at your option) any later version. | |
12 | + | |
13 | + You should have received a copy of the GNU General Public License | |
14 | + along with this program. If not, see <http://www.gnu.org/licenses/>. | |
15 | + **************************************************************************/ | |
16 | + | |
17 | +package jp.sourceforge.users.yutang.omegat.plugin.moenizer.gui; | |
18 | + | |
19 | +import groovy.util.ConfigObject; | |
20 | +import java.util.Set; | |
21 | +import jp.sourceforge.users.yutang.omegat.plugin.moenizer.L10n; | |
22 | +import jp.sourceforge.users.yutang.omegat.plugin.moenizer.ThemeChanger; | |
23 | +import org.omegat.core.Core; | |
24 | +import org.omegat.util.StaticUtils; | |
25 | + | |
26 | +/** | |
27 | + * | |
28 | + * @author Yu-Tang | |
29 | + */ | |
30 | +public class ConfigEditDialog extends javax.swing.JDialog { | |
31 | + | |
32 | + private final Set<ConfigObject> sortedConfigs; | |
33 | + private final ThemeChanger themeChanger; | |
34 | + | |
35 | + /** | |
36 | + * Creates new form MoeConfigEditDialog | |
37 | + * @param sortedConfigs | |
38 | + * @param themeChanger | |
39 | + */ | |
40 | + public ConfigEditDialog(Set<ConfigObject> sortedConfigs, ThemeChanger themeChanger) { | |
41 | + super(Core.getMainWindow().getApplicationFrame(), true); | |
42 | + this.sortedConfigs = sortedConfigs; | |
43 | + this.themeChanger = themeChanger; | |
44 | + initComponents(); | |
45 | + initUI(); | |
46 | + } | |
47 | + | |
48 | + private void initUI() { | |
49 | + this.setTitle(StaticUtils.format(L10n.get(L10n.Key.DIALOG_TITLE), | |
50 | + L10n.get(L10n.Key.CURRENT_VERSION))); | |
51 | + } | |
52 | + | |
53 | + private void initComponents() { | |
54 | + | |
55 | + jSplitPane1 = new javax.swing.JSplitPane(); | |
56 | + jLabel2 = new javax.swing.JLabel(); | |
57 | + jScrollPane1 = new javax.swing.JScrollPane(); | |
58 | + jTree1 = new javax.swing.JTree(); | |
59 | + jPanel1 = new javax.swing.JPanel(); | |
60 | + jSeparator1 = new javax.swing.JSeparator(); | |
61 | + jLabel1 = new javax.swing.JLabel(); | |
62 | + | |
63 | + setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); | |
64 | + setModal(true); | |
65 | + | |
66 | + jSplitPane1.setName("jSplitPane1"); // NOI18N | |
67 | + | |
68 | + jLabel2.setText("jLabel2"); | |
69 | + jLabel2.setName("jLabel2"); // NOI18N | |
70 | + jSplitPane1.setRightComponent(jLabel2); | |
71 | + | |
72 | + jScrollPane1.setName("jScrollPane1"); // NOI18N | |
73 | + | |
74 | + jTree1.setName("jTree1"); // NOI18N | |
75 | + jScrollPane1.setViewportView(jTree1); | |
76 | + | |
77 | + jSplitPane1.setLeftComponent(jScrollPane1); | |
78 | + | |
79 | + jPanel1.setName("jPanel1"); // NOI18N | |
80 | + | |
81 | + javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); | |
82 | + jPanel1.setLayout(jPanel1Layout); | |
83 | + jPanel1Layout.setHorizontalGroup( | |
84 | + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
85 | + .addGap(0, 316, Short.MAX_VALUE) | |
86 | + ); | |
87 | + jPanel1Layout.setVerticalGroup( | |
88 | + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
89 | + .addGap(0, 196, Short.MAX_VALUE) | |
90 | + ); | |
91 | + | |
92 | + jSplitPane1.setRightComponent(jPanel1); | |
93 | + | |
94 | + jSeparator1.setName("jSeparator1"); // NOI18N | |
95 | + | |
96 | + jLabel1.setText("jLabel1"); | |
97 | + jLabel1.setName("jLabel1"); // NOI18N | |
98 | + | |
99 | + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); | |
100 | + getContentPane().setLayout(layout); | |
101 | + layout.setHorizontalGroup( | |
102 | + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
103 | + .addComponent(jSplitPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE) | |
104 | + .addComponent(jSeparator1, javax.swing.GroupLayout.Alignment.TRAILING) | |
105 | + .addGroup(layout.createSequentialGroup() | |
106 | + .addContainerGap() | |
107 | + .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) | |
108 | + .addContainerGap()) | |
109 | + ); | |
110 | + layout.setVerticalGroup( | |
111 | + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
112 | + .addGroup(layout.createSequentialGroup() | |
113 | + .addComponent(jSplitPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 198, javax.swing.GroupLayout.PREFERRED_SIZE) | |
114 | + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
115 | + .addComponent(jLabel1) | |
116 | + .addGap(6, 6, 6) | |
117 | + .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE) | |
118 | + .addGap(0, 64, Short.MAX_VALUE)) | |
119 | + ); | |
120 | + | |
121 | + pack(); | |
122 | + setLocationRelativeTo(null); | |
123 | + } | |
124 | + | |
125 | + // Variables declaration | |
126 | + private javax.swing.JLabel jLabel1; | |
127 | + private javax.swing.JLabel jLabel2; | |
128 | + private javax.swing.JPanel jPanel1; | |
129 | + private javax.swing.JScrollPane jScrollPane1; | |
130 | + private javax.swing.JSeparator jSeparator1; | |
131 | + private javax.swing.JSplitPane jSplitPane1; | |
132 | + private javax.swing.JTree jTree1; | |
133 | +} |
@@ -21,7 +21,7 @@ | ||
21 | 21 | import com.vlsolutions.swing.docking.DockView; |
22 | 22 | import com.vlsolutions.swing.docking.DockViewTitleBar; |
23 | 23 | import com.vlsolutions.swing.docking.Dockable; |
24 | -import com.vlsolutions.swing.docking.DockableState; | |
24 | +import com.vlsolutions.swing.docking.DockableState.Location; | |
25 | 25 | import com.vlsolutions.swing.docking.DockingDesktop; |
26 | 26 | import com.vlsolutions.swing.docking.SplitContainer; |
27 | 27 | import java.awt.Color; |
@@ -265,8 +265,7 @@ | ||
265 | 265 | } |
266 | 266 | |
267 | 267 | private int getDockViewTitleBarHeight(DockingDesktop desktop) { |
268 | - ArrayList<Dockable> dockables = desktop.getContext() | |
269 | - .getDockablesByState(desktop, DockableState.STATE_DOCKED); | |
268 | + ArrayList<Dockable> dockables = getDockedDockables(desktop); | |
270 | 269 | if (!dockables.isEmpty()) { |
271 | 270 | Dockable dockable = dockables.get(0); |
272 | 271 |
@@ -459,8 +458,7 @@ | ||
459 | 458 | // + splitContainer(VERTICAL) <-- DockView.getParent() |
460 | 459 | // + DockView <-- Dockable.getParent() |
461 | 460 | // + Dockable <-- DockableState.getDockable() |
462 | - ArrayList<Dockable> dockables = desktop.getContext() | |
463 | - .getDockablesByState(desktop, DockableState.STATE_DOCKED); | |
461 | + ArrayList<Dockable> dockables = getDockedDockables(desktop); | |
464 | 462 | for (Dockable d : dockables) { |
465 | 463 | Parts part = Parts.valueOf(d.getDockKey().getKey()); |
466 | 464 | if (!exclude.contains(part)) { |
@@ -469,6 +467,11 @@ | ||
469 | 467 | } |
470 | 468 | } |
471 | 469 | |
470 | + private ArrayList<Dockable> getDockedDockables(DockingDesktop desktop) { | |
471 | + return desktop.getContext(). | |
472 | + getDockablesByState(desktop, Location.DOCKED); | |
473 | + } | |
474 | + | |
472 | 475 | private void transparentRecursive(Dockable dockable) { |
473 | 476 | // DockView |
474 | 477 | Container container = dockable.getComponent().getParent(); |
@@ -19,6 +19,7 @@ | ||
19 | 19 | import groovy.util.ConfigObject; |
20 | 20 | import java.util.Set; |
21 | 21 | import javax.swing.SwingUtilities; |
22 | +import jp.sourceforge.users.yutang.omegat.plugin.moenizer.gui.ConfigEditDialog; | |
22 | 23 | import org.omegat.core.Core; |
23 | 24 | import org.omegat.core.CoreEvents; |
24 | 25 | import org.omegat.core.events.IApplicationEventListener; |
@@ -41,11 +42,15 @@ | ||
41 | 42 | public static void loadPlugins() { |
42 | 43 | try { |
43 | 44 | // Not initialize in console mode |
44 | - if (!instantiated) { | |
45 | + if (instantiated) { | |
46 | + throw new RuntimeException("Moenizer plugin could be instantiated only once."); | |
47 | + } else if (!isSupportedVLDockingFramework()) { | |
48 | + throw new RuntimeException("Moenizer plugin is not compatibled " | |
49 | + + "with current VLDocking framework library.\n" | |
50 | + + "Please update to OmegaT 3.1.2u1 or later."); | |
51 | + } else { | |
45 | 52 | CoreEvents.registerApplicationEventListener(new Moenizer()); |
46 | 53 | instantiated = true; |
47 | - } else { | |
48 | - throw new RuntimeException("Moenizer plugin could be instantiated only once."); | |
49 | 54 | } |
50 | 55 | } catch (Throwable ex) { |
51 | 56 | String msg = ex.getMessage(); |
@@ -54,6 +59,11 @@ | ||
54 | 59 | } |
55 | 60 | } |
56 | 61 | |
62 | + private static boolean isSupportedVLDockingFramework() { | |
63 | + return !"2.1.4".equals(com.vlsolutions.swing.docking.DockingDesktop | |
64 | + .getDockingFrameworkVersion()); | |
65 | + } | |
66 | + | |
57 | 67 | public static void unloadPlugins() { |
58 | 68 | // do nothing |
59 | 69 | } |
@@ -63,6 +73,7 @@ | ||
63 | 73 | try { |
64 | 74 | config = new MoeConfig(MoeUtil.getMoeConfigFile()); |
65 | 75 | ui = MoeUI.getInstance(); |
76 | + /* | |
66 | 77 | menu = new MenuHandler(new Runnable() { |
67 | 78 | @Override |
68 | 79 | public void run() { |
@@ -69,6 +80,7 @@ | ||
69 | 80 | showSettingDialog(); |
70 | 81 | } |
71 | 82 | }); |
83 | + */ | |
72 | 84 | themeChanger = new ThemeChanger(ui); |
73 | 85 | themeChanger.setTheme(config.getCurrentConfig()); |
74 | 86 |
@@ -96,9 +108,10 @@ | ||
96 | 108 | private void showSettingDialog() { |
97 | 109 | //@@TODO 前処理 -- 自動保存中断など |
98 | 110 | Set<ConfigObject> sortedConfigs = config.getSortedConfigs(); |
99 | - MoeConfigEditDialog dialog = new MoeConfigEditDialog(sortedConfigs, themeChanger); | |
100 | - dialog.setSize(400, 200); //@@TODO remain size | |
101 | - dialog.setLocationRelativeTo(null); // positioning at the center of the screen | |
111 | + //MoeConfigEditDialog dialog = new MoeConfigEditDialog(sortedConfigs, themeChanger); | |
112 | + ConfigEditDialog dialog = new ConfigEditDialog(sortedConfigs, themeChanger); | |
113 | + //dialog.setSize(400, 200); //@@TODO remain size | |
114 | + //dialog.setLocationRelativeTo(null); // positioning at the center of the screen | |
102 | 115 | dialog.setVisible(true); |
103 | 116 | onConfigUpdate(); |
104 | 117 | //@@TODO 後処理 -- 自動保存再開など |
@@ -105,7 +118,7 @@ | ||
105 | 118 | } |
106 | 119 | |
107 | 120 | private void onConfigUpdate() { |
108 | - Log.log("-- onConfigUpdate()"); //@@TODO 要・実装 | |
121 | + //Log.log("-- onConfigUpdate()"); //@@TODO 要・実装 | |
109 | 122 | } |
110 | 123 | |
111 | 124 | } |
@@ -47,20 +47,74 @@ | ||
47 | 47 | // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents |
48 | 48 | private void initComponents() { |
49 | 49 | |
50 | + jSplitPane1 = new javax.swing.JSplitPane(); | |
51 | + jLabel2 = new javax.swing.JLabel(); | |
52 | + jScrollPane1 = new javax.swing.JScrollPane(); | |
53 | + jTree1 = new javax.swing.JTree(); | |
54 | + jPanel1 = new javax.swing.JPanel(); | |
55 | + jSeparator1 = new javax.swing.JSeparator(); | |
56 | + jLabel1 = new javax.swing.JLabel(); | |
57 | + | |
50 | 58 | setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); |
59 | + setModal(true); | |
51 | 60 | |
61 | + jSplitPane1.setName("jSplitPane1"); // NOI18N | |
62 | + | |
63 | + jLabel2.setText("jLabel2"); | |
64 | + jLabel2.setName("jLabel2"); // NOI18N | |
65 | + jSplitPane1.setRightComponent(jLabel2); | |
66 | + | |
67 | + jScrollPane1.setName("jScrollPane1"); // NOI18N | |
68 | + | |
69 | + jTree1.setName("jTree1"); // NOI18N | |
70 | + jScrollPane1.setViewportView(jTree1); | |
71 | + | |
72 | + jSplitPane1.setLeftComponent(jScrollPane1); | |
73 | + | |
74 | + jPanel1.setName("jPanel1"); // NOI18N | |
75 | + | |
76 | + javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); | |
77 | + jPanel1.setLayout(jPanel1Layout); | |
78 | + jPanel1Layout.setHorizontalGroup( | |
79 | + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
80 | + .addGap(0, 316, Short.MAX_VALUE) | |
81 | + ); | |
82 | + jPanel1Layout.setVerticalGroup( | |
83 | + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
84 | + .addGap(0, 196, Short.MAX_VALUE) | |
85 | + ); | |
86 | + | |
87 | + jSplitPane1.setRightComponent(jPanel1); | |
88 | + | |
89 | + jSeparator1.setName("jSeparator1"); // NOI18N | |
90 | + | |
91 | + jLabel1.setText("jLabel1"); | |
92 | + jLabel1.setName("jLabel1"); // NOI18N | |
93 | + | |
52 | 94 | javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); |
53 | 95 | getContentPane().setLayout(layout); |
54 | 96 | layout.setHorizontalGroup( |
55 | 97 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
56 | - .addGap(0, 400, Short.MAX_VALUE) | |
98 | + .addComponent(jSplitPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE) | |
99 | + .addComponent(jSeparator1, javax.swing.GroupLayout.Alignment.TRAILING) | |
100 | + .addGroup(layout.createSequentialGroup() | |
101 | + .addContainerGap() | |
102 | + .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) | |
103 | + .addContainerGap()) | |
57 | 104 | ); |
58 | 105 | layout.setVerticalGroup( |
59 | 106 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
60 | - .addGap(0, 300, Short.MAX_VALUE) | |
107 | + .addGroup(layout.createSequentialGroup() | |
108 | + .addComponent(jSplitPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 198, javax.swing.GroupLayout.PREFERRED_SIZE) | |
109 | + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
110 | + .addComponent(jLabel1) | |
111 | + .addGap(6, 6, 6) | |
112 | + .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE) | |
113 | + .addGap(0, 64, Short.MAX_VALUE)) | |
61 | 114 | ); |
62 | 115 | |
63 | 116 | pack(); |
117 | + setLocationRelativeTo(null); | |
64 | 118 | }// </editor-fold>//GEN-END:initComponents |
65 | 119 | |
66 | 120 | /* |
@@ -78,5 +132,12 @@ | ||
78 | 132 | });*/ |
79 | 133 | |
80 | 134 | // Variables declaration - do not modify//GEN-BEGIN:variables |
135 | + private javax.swing.JLabel jLabel1; | |
136 | + private javax.swing.JLabel jLabel2; | |
137 | + private javax.swing.JPanel jPanel1; | |
138 | + private javax.swing.JScrollPane jScrollPane1; | |
139 | + private javax.swing.JSeparator jSeparator1; | |
140 | + private javax.swing.JSplitPane jSplitPane1; | |
141 | + private javax.swing.JTree jTree1; | |
81 | 142 | // End of variables declaration//GEN-END:variables |
82 | 143 | } |