diff --git a/platform/editor-ui-api/src/com/intellij/openapi/actionSystem/ActionToolbar.java b/platform/editor-ui-api/src/com/intellij/openapi/actionSystem/ActionToolbar.java index b0dcd3636320..2c2a96730be6 100644 --- a/platform/editor-ui-api/src/com/intellij/openapi/actionSystem/ActionToolbar.java +++ b/platform/editor-ui-api/src/com/intellij/openapi/actionSystem/ActionToolbar.java @@ -47,7 +47,7 @@ public interface ActionToolbar { int AUTO_LAYOUT_POLICY = 2; /** This is default minimum size of the toolbar button */ - Dimension DEFAULT_MINIMUM_BUTTON_SIZE = JBUI.size(25, 25); + Dimension DEFAULT_MINIMUM_BUTTON_SIZE = JBUI.size(22, 22); Dimension NAVBAR_MINIMUM_BUTTON_SIZE = JBUI.size(20, 20); @@ -89,8 +89,8 @@ public interface ActionToolbar { /** * Sets toolbar orientation * - * @see javax.swing.SwingConstants#HORIZONTAL - * @see javax.swing.SwingConstants#VERTICAL + * @see SwingConstants#HORIZONTAL + * @see SwingConstants#VERTICAL */ void setOrientation(int orientation); diff --git a/platform/lang-impl/src/com/intellij/ide/actions/SearchEverywhereAction.java b/platform/lang-impl/src/com/intellij/ide/actions/SearchEverywhereAction.java index ee8130cf4982..dd66211779b3 100644 --- a/platform/lang-impl/src/com/intellij/ide/actions/SearchEverywhereAction.java +++ b/platform/lang-impl/src/com/intellij/ide/actions/SearchEverywhereAction.java @@ -200,7 +200,7 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA JPanel panel = new BorderLayoutPanel() { @Override public Dimension getPreferredSize() { - return JBUI.size(25); + return JBUI.size(24); } }; panel.setOpaque(false); diff --git a/platform/platform-api/src/com/intellij/openapi/actionSystem/ex/ComboBoxAction.java b/platform/platform-api/src/com/intellij/openapi/actionSystem/ex/ComboBoxAction.java index 8263c716367c..4f98b77de8fb 100644 --- a/platform/platform-api/src/com/intellij/openapi/actionSystem/ex/ComboBoxAction.java +++ b/platform/platform-api/src/com/intellij/openapi/actionSystem/ex/ComboBoxAction.java @@ -43,6 +43,8 @@ import org.jetbrains.annotations.Nullable; import javax.swing.*; import java.awt.*; import java.awt.event.*; +import java.awt.geom.Path2D; +import java.awt.geom.RoundRectangle2D; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; @@ -157,7 +159,7 @@ public abstract class ComboBoxAction extends AnAction implements CustomComponent setVisible(presentation.isVisible()); setHorizontalAlignment(LEFT); setFocusable(ScreenReader.isActive()); - putClientProperty("styleCombo", Boolean.TRUE); + putClientProperty("styleCombo", ComboBoxAction.this); Insets margins = getMargin(); setMargin(JBUI.insets(margins.top, 2, margins.bottom, 2)); if (isSmallVariant() && !UIUtil.isUnderGTKLookAndFeel()) { @@ -347,10 +349,10 @@ public abstract class ComboBoxAction extends AnAction implements CustomComponent @Override public Dimension getPreferredSize() { - boolean isEmpty = getIcon() == null && StringUtil.isEmpty(getText()); - int width = isEmpty ? JBUI.scale(10) : super.getPreferredSize().width; - width += getArrowIcon(isEnabled()).getIconWidth(); - return new Dimension(width, isSmallVariant() ? JBUI.scale(24) : super.getPreferredSize().height); + Dimension prefSize = super.getPreferredSize(); + int width = prefSize.width + getArrowIcon(isEnabled()).getIconWidth() + JBUI.scale(5); + width += UIUtil.isUnderWin10LookAndFeel() ? JBUI.scale(10) : 0; + return new Dimension(width, isSmallVariant() ? JBUI.scale(24) : prefSize.height); } @Override @@ -374,100 +376,91 @@ public abstract class ComboBoxAction extends AnAction implements CustomComponent if (UIUtil.isUnderDefaultMacTheme() || UIUtil.isUnderWin10LookAndFeel()) { super.paint(g); - } - else { - UISettings.setupAntialiasing(g); - GraphicsUtil.setupRoundedBorderAntialiasing(g); + } else { + Graphics2D g2 = (Graphics2D)g.create(); + try { + UISettings.setupAntialiasing(g2); + GraphicsUtil.setupRoundedBorderAntialiasing(g2); - final Color textColor = isEnabled() - ? UIManager.getColor("Panel.foreground") - : UIUtil.getInactiveTextColor(); + Color textColor = isEnabled() ? UIManager.getColor("Panel.foreground") : UIUtil.getInactiveTextColor(); - if (myForceTransparent) { - final Icon icon = getIcon(); - int x = 7; - if (icon != null) { - icon.paintIcon(this, g, x, (size.height - icon.getIconHeight()) / 2); - x += icon.getIconWidth() + 3; - } - if (!StringUtil.isEmpty(getText())) { - final Font font = getFont(); - g.setFont(font); - g.setColor(textColor); - UIUtil.drawCenteredString((Graphics2D)g, new Rectangle(x, 0, Integer.MAX_VALUE, size.height), getText(), false, true); - } - } else { - if (isSmallVariant()) { - final Graphics2D g2 = (Graphics2D)g; + if (myForceTransparent) { + paintIconAndText(size, g2, textColor); + } else if (isSmallVariant()) { g2.setColor(UIUtil.getControlColor()); - final int w = getWidth(); - final int h = getHeight(); + + int w = getWidth(); + int h = getHeight(); + if (getModel().isArmed() && getModel().isPressed()) { g2.setPaint(UIUtil.getGradientPaint(0, 0, UIUtil.getControlColor(), 0, h, ColorUtil.shift(UIUtil.getControlColor(), 0.8))); - } - else { - if (UIUtil.isUnderDarcula()) { - g2.setPaint(UIUtil.getGradientPaint(0, 0, ColorUtil.shift(UIUtil.getControlColor(), 1.1), 0, h, - ColorUtil.shift(UIUtil.getControlColor(), 0.9))); - } - else { - g2.setPaint(UIUtil.getGradientPaint(0, 0, new JBColor(SystemInfo.isMac ? Gray._226 : Gray._245, Gray._131), 0, h, - new JBColor(SystemInfo.isMac ? Gray._198 : Gray._208, Gray._128))); - } + } else if (UIUtil.isUnderDarcula()) { + g2.setPaint(UIUtil.getGradientPaint(0, 0, ColorUtil.shift(UIUtil.getControlColor(), 1.1), 0, h, + ColorUtil.shift(UIUtil.getControlColor(), 0.9))); + } else { + g2.setPaint(UIUtil.getGradientPaint(0, 0, new JBColor(SystemInfo.isMac ? Gray._226 : Gray._245, Gray._131), 0, h, + new JBColor(SystemInfo.isMac ? Gray._198 : Gray._208, Gray._128))); } - g2.fillRoundRect(2, 0, w - 2, h, 5, 5); + Rectangle r = new Rectangle(w, h); + JBInsets.removeFrom(r, JBUI.insets(1)); + + float arc = JBUI.scale(3.0f); + Shape outerShape = new RoundRectangle2D.Float(r.x, r.y, r.width, r.height, arc, arc); + g2.fill(outerShape); Color borderColor = myMouseInside ? new JBColor(Gray._111, Gray._118) : new JBColor(Gray._151, Gray._95); g2.setPaint(borderColor); - g2.drawRoundRect(2, 0, w - 3, h - 1, 5, 5); - final Icon icon = getIcon(); - int x = 7; - if (icon != null) { - icon.paintIcon(this, g, x, (size.height - icon.getIconHeight()) / 2); - x += icon.getIconWidth() + 3; - } - if (!StringUtil.isEmpty(getText())) { - final Font font = getFont(); - g2.setFont(font); - g2.setColor(textColor); - UIUtil.drawCenteredString(g2, new Rectangle(x, 0, Integer.MAX_VALUE, size.height), getText(), false, true); - } - } - else { + float lw = JBUI.scale(1.0f); + Path2D outline = new Path2D.Float(Path2D.WIND_EVEN_ODD); + outline.append(outerShape, false); + outline.append(new RoundRectangle2D.Float(r.x + lw, r.y + lw, r.width - lw*2, r.height - lw*2, arc - lw, arc - lw), false); + g2.fill(outline); + + paintIconAndText(size, g2, textColor); + } else { super.paint(g); } + } finally { + g2.dispose(); } } Insets insets = getInsets(); Icon icon = getArrowIcon(isEnabled()); - int x = size.width - icon.getIconWidth(); + int x = size.width - icon.getIconWidth() - insets.right; if (UIUtil.isUnderWin10LookAndFeel()) { - x -= JBUI.scale(6); - x -= JBUI.scale(UIUtil.getParentOfType(ActionToolbar.class, this) != null ? 2 : 0); - } - else { - x -= insets.right; - - if (isSmallVariant()) { - x += JBUI.scale(1); - + x -= JBUI.scale(5); + } else if (isSmallVariant()) { if (UIUtil.isUnderDefaultMacTheme()) { x -= JBUI.scale(3); } - } - else { - x += JBUI.scale(2); - } + } else { + x += JBUI.scale(2); } icon.paintIcon(null, g, x, (size.height - icon.getIconHeight()) / 2); g.setPaintMode(); } + private void paintIconAndText(Dimension size, Graphics2D g2, Color textColor) { + Icon icon = getIcon(); + int x = JBUI.scale(7); + if (icon != null) { + icon.paintIcon(this, g2, x, (size.height - icon.getIconHeight()) / 2); + x += icon.getIconWidth() + JBUI.scale(3); + } + + if (!StringUtil.isEmpty(getText())) { + Font font = getFont(); + g2.setFont(font); + g2.setColor(textColor); + UIUtil.drawCenteredString(g2, new Rectangle(x, 0, Integer.MAX_VALUE, size.height), getText(), false, true); + } + } + @Override public void updateUI() { super.updateUI(); updateButtonSize(); diff --git a/platform/platform-impl/src/com/intellij/application/options/schemes/AbstractSchemesPanel.java b/platform/platform-impl/src/com/intellij/application/options/schemes/AbstractSchemesPanel.java index 7ef368b7f058..9887ed193597 100644 --- a/platform/platform-impl/src/com/intellij/application/options/schemes/AbstractSchemesPanel.java +++ b/platform/platform-impl/src/com/intellij/application/options/schemes/AbstractSchemesPanel.java @@ -127,7 +127,6 @@ public abstract class AbstractSchemesPanel