Merge remote-tracking branch 'origin/master'

This commit is contained in:
Anna Kozlova
2014-10-31 21:39:38 +01:00
5 changed files with 28 additions and 13 deletions
@@ -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 {
};
}
}
@@ -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());
}
@@ -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<String, Icon> 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) {
@@ -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()));
@@ -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