OmegaT の背景に画像を表示します。
メインウィンドウに背景設定した場合、エディターも除外できるようにした
| @@ -174,7 +174,7 @@ | ||
| 174 | 174 | makeTransparentStatusbar = !exclude.contains(Parts.StatusBar); |
| 175 | 175 | makeTransparentPaneTitlebar = !exclude.contains(Parts.PaneTitleBar); |
| 176 | 176 | } |
| 177 | - transparent(); | |
| 177 | + transparent(exclude); | |
| 178 | 178 | break; |
| 179 | 179 | |
| 180 | 180 | case EDITOR: |
| @@ -207,7 +207,7 @@ | ||
| 207 | 207 | } |
| 208 | 208 | } |
| 209 | 209 | |
| 210 | - private void transparent() { | |
| 210 | + private void transparent(EnumSet<Parts> exclude) { | |
| 211 | 211 | UIThreadsUtil.mustBeSwingThread(); |
| 212 | 212 | |
| 213 | 213 | if (makeTransparentMenubar) { |
| @@ -220,12 +220,13 @@ | ||
| 220 | 220 | MoeRootPaneUI ui = (MoeRootPaneUI) uis.get(Parts.MainWindow); |
| 221 | 221 | ui.setMarginTop(marginTop); |
| 222 | 222 | } |
| 223 | - transparentRecursive(contentPane); | |
| 224 | - removeInstantStartBgColor(); | |
| 223 | + transparentRecursive(contentPane, exclude); | |
| 224 | + if (!exclude.contains(Parts.EDITOR)) { | |
| 225 | + removeInstantStartBgColor(); | |
| 226 | + } | |
| 225 | 227 | |
| 226 | 228 | // try to make transparent editor pane |
| 227 | - //@@TODO エディターが除外パーツになっている場合を考慮 | |
| 228 | - if (!isEditorTransparent) { | |
| 229 | + if (!exclude.contains(Parts.EDITOR) && !isEditorTransparent) { | |
| 229 | 230 | isEditorTransparent = transparentEditor(); |
| 230 | 231 | if (!isEditorTransparent) { |
| 231 | 232 | CoreEvents.registerProjectChangeListener(this); |
| @@ -374,7 +375,7 @@ | ||
| 374 | 375 | menuBar.setUI ( new WindowsMenuBarUI () { |
| 375 | 376 | @Override |
| 376 | 377 | public void paint ( Graphics g, JComponent c ) { |
| 377 | - int alpha = 100; // transparent <- 0...255 -> opaque | |
| 378 | + int alpha = 100; // transparent <- 0...255 -> opaque //@@TODO sdjust value | |
| 378 | 379 | Color oldColor = g.getColor(); |
| 379 | 380 | Color color = SystemColor.menu; |
| 380 | 381 | g.setColor ( new Color( color.getRGB() & 0xffffff | alpha << 24, true)); |
| @@ -385,20 +386,20 @@ | ||
| 385 | 386 | menuBar.setOpaque(false); |
| 386 | 387 | } |
| 387 | 388 | |
| 388 | - private void transparentRecursive(Component component) { | |
| 389 | + private void transparentRecursive(Component component, EnumSet<Parts> exclude) { | |
| 389 | 390 | // StatusBar |
| 390 | - if (!makeTransparentStatusbar && statusBar.equals(component)) { | |
| 391 | + if (exclude.contains(Parts.StatusBar) && statusBar.equals(component)) { | |
| 391 | 392 | return; |
| 392 | 393 | } |
| 393 | 394 | |
| 394 | 395 | // ButtonPanel |
| 395 | - if (!makeTransparentButtonPanel && buttonPanel.equals(component)) { | |
| 396 | + if (exclude.contains(Parts.ButtonPanel) && buttonPanel.equals(component)) { | |
| 396 | 397 | return; |
| 397 | 398 | } |
| 398 | 399 | |
| 399 | 400 | if (component instanceof JComponent) { |
| 400 | 401 | JComponent c = (JComponent) component; |
| 401 | - if (c.isOpaque()) { | |
| 402 | + if (c.isShowing() && c.isOpaque()) { | |
| 402 | 403 | c.setOpaque(false); |
| 403 | 404 | } |
| 404 | 405 | } |
| @@ -406,16 +407,16 @@ | ||
| 406 | 407 | if (component instanceof Container) { |
| 407 | 408 | Container container = (Container) component; |
| 408 | 409 | for (Component c: container.getComponents()) { |
| 409 | - transparentRecursive(c); | |
| 410 | + transparentRecursive(c, exclude); | |
| 410 | 411 | } |
| 411 | 412 | } |
| 412 | 413 | |
| 413 | 414 | if (component instanceof DockingDesktop) { |
| 414 | - transparentRecursive((DockingDesktop) component); | |
| 415 | + transparentRecursive((DockingDesktop) component, exclude); | |
| 415 | 416 | } |
| 416 | 417 | } |
| 417 | 418 | |
| 418 | - private void transparentRecursive(DockingDesktop desktop) { | |
| 419 | + private void transparentRecursive(DockingDesktop desktop, EnumSet<Parts> exclude) { | |
| 419 | 420 | //DockingPanel dockingPanel = dockingDesktop.getDockingPanel(); // Scoping NG |
| 420 | 421 | // DockingPanel にアクセスできないので、下位要素から上にさかのぼって処理する。 |
| 421 | 422 | // 階層的には、こんな感じになっている。 |
| @@ -429,7 +430,10 @@ | ||
| 429 | 430 | ArrayList<Dockable> dockables = desktop.getContext() |
| 430 | 431 | .getDockablesByState(desktop, DockableState.STATE_DOCKED); |
| 431 | 432 | for (Dockable d : dockables) { |
| 432 | - transparentRecursive(d); | |
| 433 | + Parts part = Parts.valueOf(d.getDockKey().getKey()); | |
| 434 | + if (!exclude.contains(part)) { | |
| 435 | + transparentRecursive(d); | |
| 436 | + } | |
| 433 | 437 | } |
| 434 | 438 | } |
| 435 | 439 |