• R/O
  • SSH
  • HTTPS

Commit

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

OmegaT の背景に画像を表示します。


Commit MetaInfo

Revision28 (tree)
Time2014-05-17 02:37:16
Authoryu-tang

Log Message

ステータスバーの透過・不透過の切り替えに対応

Change Summary

Incremental Difference

--- trunk/src/jp/sourceforge/users/yutang/omegat/plugin/moenizer/MoeUI.java (revision 27)
+++ trunk/src/jp/sourceforge/users/yutang/omegat/plugin/moenizer/MoeUI.java (revision 28)
@@ -17,6 +17,7 @@
1717 package jp.sourceforge.users.yutang.omegat.plugin.moenizer;
1818
1919 import com.sun.java.swing.plaf.windows.WindowsMenuBarUI;
20+import com.vlsolutions.swing.docking.AutoHideButtonPanel;
2021 import com.vlsolutions.swing.docking.DockView;
2122 import com.vlsolutions.swing.docking.DockViewTitleBar;
2223 import com.vlsolutions.swing.docking.Dockable;
@@ -36,6 +37,7 @@
3637 import javax.swing.JPanel;
3738 import javax.swing.JScrollPane;
3839 import org.omegat.core.Core;
40+import org.omegat.util.Log;
3941 import org.omegat.util.gui.UIThreadsUtil;
4042
4143 /**
@@ -51,6 +53,9 @@
5153 private Container contentPane;
5254 private JMenuBar menuBar;
5355 private DockingDesktop desktop;
56+ private JPanel statusBar;
57+ private JPanel buttonPanel;
58+
5459
5560 private boolean makeTransparentMenubar = true;
5661 private boolean makeTransparentButtonPanel = true;
@@ -150,7 +155,9 @@
150155 layeredPane = new MoeLayeredPane();
151156 contentPane = frame.getContentPane();
152157 menuBar = frame.getJMenuBar();
158+ statusBar = getJPanel(contentPane);
153159 desktop = getDockingDesktop(contentPane);
160+ buttonPanel = getButtonPanel(desktop);
154161
155162 // replace LayeredPane with MoeLayeredPane
156163 frame.setLayeredPane(layeredPane);
@@ -182,6 +189,16 @@
182189 }
183190
184191 private void transparentRecursive(Component component) {
192+ // StatusBar
193+ if (!makeTransparentStatusbar && statusBar.equals(component)) {
194+ return;
195+ }
196+
197+ // ButtonPanel
198+ if (!makeTransparentButtonPanel && buttonPanel.equals(component)) {
199+ return;
200+ }
201+
185202 if (component instanceof JComponent) {
186203 JComponent c = (JComponent) component;
187204 if (c.isOpaque()) {
@@ -188,7 +205,7 @@
188205 c.setOpaque(false);
189206 }
190207 }
191-
208+
192209 if (component instanceof Container) {
193210 Container container = (Container) component;
194211 for (Component c: container.getComponents()) {
@@ -195,7 +212,7 @@
195212 transparentRecursive(c);
196213 }
197214 }
198-
215+
199216 if (component instanceof DockingDesktop) {
200217 transparentRecursive((DockingDesktop) component);
201218 }
@@ -275,6 +292,38 @@
275292 return null;
276293 }
277294
295+ private JPanel getJPanel(Container contentPane) {
296+ // contentPane
297+ // + javax.swing.JPanel // ステータスバーの実体
298+ // + com.vlsolutions.swing.docking.DockingDesktop // メニューバーの下からステータスバーの上までの領域
299+ for (Component c: contentPane.getComponents()) {
300+ if (c instanceof JPanel) {
301+ return (JPanel) c;
302+ }
303+ }
304+ return null;
305+ }
306+
307+ private JPanel getButtonPanel(DockingDesktop desktop) {
308+ // desktop
309+ // + com.vlsolutions.swing.docking.AutoHideExpandPanel // 非表示
310+ // + com.vlsolutions.swing.docking.DockingDesktop$1 // ボタンパネルの上の領域、ボタンパネルが非表示の場合は下のパネルと同じサイズ
311+ // + javax.swing.JPanel // ボタンパネルを含む領域 <= this
312+
313+ JPanel panel = getJPanel(desktop);
314+ // panel
315+ // + com.vlsolutions.swing.docking.AutoHideButtonPanel // 非表示、未使用
316+ // + com.vlsolutions.swing.docking.AutoHideButtonPanel // 非表示、未使用
317+ // + com.vlsolutions.swing.docking.AutoHideButtonPanel // ボタンがあれば表示(isShowing()、isVisible() ともに true)
318+ // + com.vlsolutions.swing.docking.AutoHideButtonPanel // 非表示、未使用
319+ // + com.vlsolutions.swing.docking.DockingPanel // ボタンパネルの上の領域
320+
321+ // 3番目の AutoHideButtonPanel を取得したい。
322+ // 状態が不明(表示/非表示で識別できるかどうか分からない)なので、
323+ // とりあえずインデックスで決め打ちする。
324+ return (JPanel) panel.getComponent(2);
325+ }
326+
278327 private JEditorPane getJEditorPaneFromEditor(DockingDesktop desktop) {
279328 for (DockableState d: desktop.getDockables()) {
280329 Dockable dockable = d.getDockable();