diff --git a/platform/dvcs-impl/src/com/intellij/dvcs/ui/BranchActionGroupPopup.java b/platform/dvcs-impl/src/com/intellij/dvcs/ui/BranchActionGroupPopup.java index 44b4c8c5c3f0..e7c0c7aace78 100644 --- a/platform/dvcs-impl/src/com/intellij/dvcs/ui/BranchActionGroupPopup.java +++ b/platform/dvcs-impl/src/com/intellij/dvcs/ui/BranchActionGroupPopup.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -84,8 +84,6 @@ public class BranchActionGroupPopup extends PopupFactoryImpl.ActionGroupPopup { myBranchLabel.setBackground(getBackground()); myBranchLabel.setForeground(JBColor.GRAY); // different foreground than for other elements } - - adjustOpacity(myBranchLabel, isSelected); } else { myBranchLabel.setVisible(false); @@ -111,4 +109,3 @@ public class BranchActionGroupPopup extends PopupFactoryImpl.ActionGroupPopup { }; } } - diff --git a/platform/platform-api/src/com/intellij/ui/GroupedElementsRenderer.java b/platform/platform-api/src/com/intellij/ui/GroupedElementsRenderer.java index 5fb4b53175c9..4a2abb304aa2 100644 --- a/platform/platform-api/src/com/intellij/ui/GroupedElementsRenderer.java +++ b/platform/platform-api/src/com/intellij/ui/GroupedElementsRenderer.java @@ -73,13 +73,13 @@ public abstract class GroupedElementsRenderer { setDeselected(myTextLabel); } - adjustOpacity(myTextLabel, isSelected); - myRendererComponent.setPrefereedWidth(preferredForcedWidth); return myRendererComponent; } + /** @deprecated backgrounds are set uniformly via setSelected() / setDeselected() (to be removed in IDEA 16) */ + @SuppressWarnings("UnusedDeclaration") protected static void adjustOpacity(JComponent component, boolean selected) { if (selected) { if (UIUtil.isUnderNimbusLookAndFeel()) { @@ -94,13 +94,12 @@ public abstract class GroupedElementsRenderer { } protected final void setSelected(JComponent aComponent) { - aComponent.setBackground(getSelectionBackground()); + UIUtil.setBackgroundRecursively(aComponent, getSelectionBackground()); aComponent.setForeground(getSelectionForeground()); } - protected final void setDeselected(JComponent aComponent) { - aComponent.setBackground(getBackground()); + UIUtil.setBackgroundRecursively(aComponent, getBackground()); aComponent.setForeground(getForeground()); } diff --git a/platform/platform-impl/src/com/intellij/ide/ui/laf/LafManagerImpl.java b/platform/platform-impl/src/com/intellij/ide/ui/laf/LafManagerImpl.java index 929d03d28db0..53ff6cdf5f1e 100644 --- a/platform/platform-impl/src/com/intellij/ide/ui/laf/LafManagerImpl.java +++ b/platform/platform-impl/src/com/intellij/ide/ui/laf/LafManagerImpl.java @@ -243,7 +243,7 @@ public final class LafManagerImpl extends LafManager implements ApplicationCompo @Override public void run() { fixGtkPopupStyle(); - patchOptionPaneIcons(UIManager.getLookAndFeelDefaults()); + patchGtkDefaults(UIManager.getLookAndFeelDefaults()); } }); } @@ -535,7 +535,7 @@ public final class LafManagerImpl extends LafManager implements ApplicationCompo patchLafFonts(uiDefaults); - patchOptionPaneIcons(uiDefaults); + patchGtkDefaults(uiDefaults); fixSeparatorColor(uiDefaults); @@ -695,13 +695,12 @@ public final class LafManagerImpl extends LafManager implements ApplicationCompo } } - private static void patchOptionPaneIcons(UIDefaults defaults) { + private static void patchGtkDefaults(UIDefaults defaults) { if (!UIUtil.isUnderGTKLookAndFeel()) return; Map map = ContainerUtil.newHashMap( Arrays.asList("OptionPane.errorIcon", "OptionPane.informationIcon", "OptionPane.warningIcon", "OptionPane.questionIcon"), Arrays.asList(AllIcons.General.ErrorDialog, AllIcons.General.InformationDialog, AllIcons.General.WarningDialog, AllIcons.General.QuestionDialog)); - // GTK+ L&F keeps icons hidden in style SynthStyle style = SynthLookAndFeel.getStyle(new JOptionPane(""), Region.DESKTOP_ICON); for (String key : map.keySet()) { @@ -710,6 +709,12 @@ public final class LafManagerImpl extends LafManager implements ApplicationCompo Object icon = style == null ? null : style.get(null, key); defaults.put(key, icon instanceof Icon ? icon : map.get(key)); } + + Color fg = defaults.getColor("Label.foreground"); + Color bg = defaults.getColor("Label.background"); + if (fg != null && bg != null) { + defaults.put("Label.disabledForeground", UIUtil.mix(fg, bg, 0.5)); + } } private void patchLafFonts(UIDefaults uiDefaults) { diff --git a/platform/util/src/com/intellij/util/ui/UIUtil.java b/platform/util/src/com/intellij/util/ui/UIUtil.java index 4ae0c69fc005..47f5990554a3 100644 --- a/platform/util/src/com/intellij/util/ui/UIUtil.java +++ b/platform/util/src/com/intellij/util/ui/UIUtil.java @@ -1248,6 +1248,7 @@ public class UIUtil { public static Color shade(final Color c, final double factor, final double alphaFactor) { assert factor >= 0 : factor; + //noinspection UseJBColor return new Color( Math.min((int)Math.round(c.getRed() * factor), 255), Math.min((int)Math.round(c.getGreen() * factor), 255), @@ -1259,6 +1260,7 @@ public class UIUtil { public static Color mix(final Color c1, final Color c2, final double factor) { assert 0 <= factor && factor <= 1.0 : factor; final double backFactor = 1.0 - factor; + //noinspection UseJBColor return new Color( Math.min((int)Math.round(c1.getRed() * backFactor + c2.getRed() * factor), 255), Math.min((int)Math.round(c1.getGreen() * backFactor + c2.getGreen() * factor), 255), @@ -2880,6 +2882,15 @@ public class UIUtil { } } + public static void setBackgroundRecursively(@NotNull Component component, @NotNull Color bg) { + component.setBackground(bg); + if (component instanceof Container) { + for (Component c : ((Container)component).getComponents()) { + setBackgroundRecursively(c, bg); + } + } + } + public static void addInsets(@NotNull JComponent component, @NotNull Insets insets) { if (component.getBorder() != null) { component.setBorder(new CompoundBorder(new EmptyBorder(insets), component.getBorder())); diff --git a/spellchecker/src/com/intellij/spellchecker/jetbrains.dic b/spellchecker/src/com/intellij/spellchecker/jetbrains.dic index 170617bf2908..e1413b893901 100644 --- a/spellchecker/src/com/intellij/spellchecker/jetbrains.dic +++ b/spellchecker/src/com/intellij/spellchecker/jetbrains.dic @@ -244,6 +244,8 @@ keychain keychains keyframe keyframes +keymap +keymaps kotlin labeler labelers @@ -615,6 +617,7 @@ versa vertices viewlet viewport +viewports vtlvariable watchlist webpack