OmegaT の背景に画像を表示します。
メニューバーの透過・不透過の切り替えに対応
| @@ -50,7 +50,7 @@ | ||
| 50 | 50 | |
| 51 | 51 | private final File file; |
| 52 | 52 | private ConfigObject config = null; |
| 53 | - private final TreeSet<ConfigObject> configs | |
| 53 | + private final TreeSet<ConfigObject> providerConfigs | |
| 54 | 54 | = new TreeSet<ConfigObject> |
| 55 | 55 | (new Comparator<ConfigObject>() { |
| 56 | 56 | @Override |
| @@ -70,12 +70,27 @@ | ||
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - public Set<ConfigObject> getConfigs() { | |
| 74 | - return configs; | |
| 73 | + public Object get(String key) { | |
| 74 | + if (config != null) { | |
| 75 | + Map flatten = config.flatten(); | |
| 76 | + if (flatten.containsKey(key)) { | |
| 77 | + return flatten.get(key); | |
| 78 | + } | |
| 79 | + } | |
| 80 | + return null; | |
| 75 | 81 | } |
| 76 | 82 | |
| 83 | + public boolean get(String key, boolean defaultValue) { | |
| 84 | + Object ret = get(key); | |
| 85 | + return ret != null ? (Boolean) ret : defaultValue; | |
| 86 | + } | |
| 87 | + | |
| 88 | + public Set<ConfigObject> getProviderConfigs() { | |
| 89 | + return providerConfigs; | |
| 90 | + } | |
| 91 | + | |
| 77 | 92 | public ConfigObject getCurrentConfig() { |
| 78 | - for (ConfigObject entry : configs) { | |
| 93 | + for (ConfigObject entry : providerConfigs) { | |
| 79 | 94 | boolean enabled = (Boolean) entry.get(KEY_ENABLED); |
| 80 | 95 | if (enabled) { |
| 81 | 96 | return entry; |
| @@ -108,7 +123,7 @@ | ||
| 108 | 123 | String name = e.getKey(); |
| 109 | 124 | ConfigObject conf = e.getValue(); |
| 110 | 125 | if (!name.equals(CONF_GENERAL)) { |
| 111 | - configs.add(conf); | |
| 126 | + providerConfigs.add(conf); | |
| 112 | 127 | } |
| 113 | 128 | } |
| 114 | 129 | } |
| @@ -75,6 +75,10 @@ | ||
| 75 | 75 | (new SlideShow()).execute(); |
| 76 | 76 | |
| 77 | 77 | ui = MoeUI.getInstance(); |
| 78 | + ui.setMakeTransparentMenubar(getMakeTransparentMenubar()); | |
| 79 | + ui.setMakeTransparentButtonPanel(getMakeTransparentButtonPanel()); | |
| 80 | + ui.setMakeTransparentStatusbar(getMakeTransparentStatusbar()); | |
| 81 | + ui.setMakeTransparentPaneTitlebar(getMakeTransparentPaneTitlebar()); | |
| 78 | 82 | |
| 79 | 83 | // この時点でコンポーネントの透過設定をしても反映されない(タイミング?)。 |
| 80 | 84 | // Workaround として、invokeLater でキューに突っ込んで、後で処理する。 |
| @@ -119,7 +123,23 @@ | ||
| 119 | 123 | break; |
| 120 | 124 | } |
| 121 | 125 | } |
| 122 | - | |
| 126 | + | |
| 127 | + private boolean getMakeTransparentMenubar() { | |
| 128 | + return config.get("__general__.makeTransparentMenubar", true); | |
| 129 | + } | |
| 130 | + | |
| 131 | + private boolean getMakeTransparentButtonPanel() { | |
| 132 | + return config.get("__general__.makeTransparentButtonPanel", true); | |
| 133 | + } | |
| 134 | + | |
| 135 | + private boolean getMakeTransparentStatusbar() { | |
| 136 | + return config.get("__general__.makeTransparentStatusbar", true); | |
| 137 | + } | |
| 138 | + | |
| 139 | + private boolean getMakeTransparentPaneTitlebar() { | |
| 140 | + return config.get("__general__.makeTransparentMenubar", true); | |
| 141 | + } | |
| 142 | + | |
| 123 | 143 | private class SlideShow extends SwingWorker<Object, Void> { |
| 124 | 144 | private long interval = -1; |
| 125 | 145 |
| @@ -147,6 +167,6 @@ | ||
| 147 | 167 | } |
| 148 | 168 | return null; |
| 149 | 169 | } |
| 150 | - } | |
| 151 | - | |
| 170 | + } | |
| 171 | + | |
| 152 | 172 | } |
| @@ -100,7 +100,6 @@ | ||
| 100 | 100 | */ |
| 101 | 101 | @Override |
| 102 | 102 | public BufferedImage getNextImage() { |
| 103 | - Log.log("DefaultImageLoader.getNextImage() called."); | |
| 104 | 103 | return image; |
| 105 | 104 | } |
| 106 | 105 |
| @@ -52,6 +52,11 @@ | ||
| 52 | 52 | private JMenuBar menuBar; |
| 53 | 53 | private DockingDesktop desktop; |
| 54 | 54 | |
| 55 | + private boolean makeTransparentMenubar = true; | |
| 56 | + private boolean makeTransparentButtonPanel = true; | |
| 57 | + private boolean makeTransparentStatusbar = true; | |
| 58 | + private boolean makeTransparentPaneTitlebar = true; | |
| 59 | + | |
| 55 | 60 | static { |
| 56 | 61 | moeUI = null; |
| 57 | 62 | } |
| @@ -73,7 +78,11 @@ | ||
| 73 | 78 | public void transparent() { |
| 74 | 79 | UIThreadsUtil.mustBeSwingThread(); |
| 75 | 80 | |
| 76 | - transparent(menuBar); | |
| 81 | + if (makeTransparentMenubar) { | |
| 82 | + //@@TODO メニューバーが不透過の場合、背景画像の上描画位置を調整する必要がある | |
| 83 | + //@@TODO makeTransparentPaneTitlebar フィールド対応 | |
| 84 | + transparent(menuBar); | |
| 85 | + } | |
| 77 | 86 | transparentRecursive(contentPane); |
| 78 | 87 | transparentInstantStart(desktop); |
| 79 | 88 |
| @@ -120,6 +129,22 @@ | ||
| 120 | 129 | }); |
| 121 | 130 | } |
| 122 | 131 | |
| 132 | + public void setMakeTransparentMenubar(boolean makeTransparentMenubar) { | |
| 133 | + this.makeTransparentMenubar = makeTransparentMenubar; | |
| 134 | + } | |
| 135 | + | |
| 136 | + public void setMakeTransparentButtonPanel(boolean makeTransparentButtonPanel) { | |
| 137 | + this.makeTransparentButtonPanel = makeTransparentButtonPanel; | |
| 138 | + } | |
| 139 | + | |
| 140 | + public void setMakeTransparentStatusbar(boolean makeTransparentStatusbar) { | |
| 141 | + this.makeTransparentStatusbar = makeTransparentStatusbar; | |
| 142 | + } | |
| 143 | + | |
| 144 | + public void setMakeTransparentPaneTitlebar(boolean makeTransparentPaneTitlebar) { | |
| 145 | + this.makeTransparentPaneTitlebar = makeTransparentPaneTitlebar; | |
| 146 | + } | |
| 147 | + | |
| 123 | 148 | private void initUI() { |
| 124 | 149 | frame = Core.getMainWindow().getApplicationFrame(); |
| 125 | 150 | layeredPane = new MoeLayeredPane(); |