diff --git a/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/ui/DarculaCheckBoxBorder.java b/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/ui/DarculaCheckBoxBorder.java index 6ea532cf8ffe..9b0e1366e659 100644 --- a/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/ui/DarculaCheckBoxBorder.java +++ b/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/ui/DarculaCheckBoxBorder.java @@ -9,6 +9,7 @@ import org.jetbrains.annotations.Nullable; import javax.swing.*; import javax.swing.border.Border; +import javax.swing.plaf.ButtonUI; import javax.swing.plaf.UIResource; import java.awt.*; @@ -32,23 +33,14 @@ public class DarculaCheckBoxBorder implements Border, UIResource, VisualPaddings @Nullable @Override public Insets getVisualPaddings(@NotNull Component component) { - if (component instanceof JRadioButton) { - if (((JRadioButton)component).getUI().getClass() == DarculaRadioButtonUI.class) { - // darcula - return JBUI.insets(0, 2, 0, 0); - } - else { - // mac light - return JBUI.insets(3, 3, 2, 0); + if (component instanceof AbstractButton) { + ButtonUI ui = ((AbstractButton)component).getUI(); + if (ui instanceof VisualPaddingsProvider) { + return ((VisualPaddingsProvider)ui).getVisualPaddings(component); } } - else if (component instanceof JCheckBox && ((JCheckBox)component).getUI().getClass() == DarculaCheckBoxUI.class) { - // darcula - return JBUI.insets(0, 2, 0, 0); - } - else { - // mac light - return JBUI.insets(3, 4, 2, 0); - } + + // unrealistic + return JBUI.emptyInsets(); } } diff --git a/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/ui/DarculaCheckBoxUI.java b/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/ui/DarculaCheckBoxUI.java index 3a06a6d51d4a..f32bfe51a514 100644 --- a/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/ui/DarculaCheckBoxUI.java +++ b/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/ui/DarculaCheckBoxUI.java @@ -1,9 +1,12 @@ // Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.ide.ui.laf.darcula.ui; +import com.intellij.ide.ui.laf.VisualPaddingsProvider; import com.intellij.ide.ui.laf.darcula.DarculaUIUtil; import com.intellij.openapi.util.SystemInfo; import com.intellij.util.ui.*; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import sun.swing.SwingUtilities2; import javax.swing.*; @@ -16,9 +19,15 @@ import java.awt.*; /** * @author Konstantin Bulenkov */ -public class DarculaCheckBoxUI extends MetalCheckBoxUI { +public class DarculaCheckBoxUI extends MetalCheckBoxUI implements VisualPaddingsProvider { private static final Icon DEFAULT_ICON = JBUI.scale(EmptyIcon.create(18)).asUIResource(); + @Nullable + @Override + public Insets getVisualPaddings(@NotNull Component component) { + return JBUI.insets(0, 2, 0, 0); + } + @SuppressWarnings("MethodOverridesStaticMethodOfSuperclass") public static ComponentUI createUI(JComponent c) { return new DarculaCheckBoxUI(); diff --git a/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/ui/DarculaRadioButtonUI.java b/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/ui/DarculaRadioButtonUI.java index e0ac918dc876..3e52583b2e3b 100644 --- a/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/ui/DarculaRadioButtonUI.java +++ b/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/ui/DarculaRadioButtonUI.java @@ -1,11 +1,14 @@ // Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.ide.ui.laf.darcula.ui; +import com.intellij.ide.ui.laf.VisualPaddingsProvider; import com.intellij.ide.ui.laf.darcula.DarculaUIUtil; import com.intellij.util.ui.EmptyIcon; import com.intellij.util.ui.IconCache; import com.intellij.util.ui.JBInsets; import com.intellij.util.ui.JBUI; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import sun.swing.SwingUtilities2; import javax.swing.*; @@ -18,9 +21,15 @@ import java.awt.*; /** * @author Konstantin Bulenkov */ -public class DarculaRadioButtonUI extends MetalRadioButtonUI { +public class DarculaRadioButtonUI extends MetalRadioButtonUI implements VisualPaddingsProvider { private static final Icon DEFAULT_ICON = JBUI.scale(EmptyIcon.create(19)).asUIResource(); + @Nullable + @Override + public Insets getVisualPaddings(@NotNull Component component) { + return JBUI.insets(0, 2, 0, 0); + } + @SuppressWarnings({"MethodOverridesStaticMethodOfSuperclass", "UnusedDeclaration"}) public static ComponentUI createUI(JComponent c) { return new DarculaRadioButtonUI(); diff --git a/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/ui/DarculaTextFieldUI.java b/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/ui/DarculaTextFieldUI.java index 0724afe43b36..531df16217df 100644 --- a/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/ui/DarculaTextFieldUI.java +++ b/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/ui/DarculaTextFieldUI.java @@ -32,7 +32,7 @@ public class DarculaTextFieldUI extends TextFieldWithPopupHandlerUI { return JBUI.scale(JBUI.getInt("TextFieldUI.spinnerOrComboboxEditorHeight", 22)); } else { - return JBUI.scale(JBUI.isUseCorrectInputHeightOnMacOS(c) ? getMinimumHeightForTextField() : 22) + i.top + i.bottom; + return JBUI.scale(JBUI.isUseCorrectInputHeight(c) ? getMinimumHeightForTextField() : 22) + i.top + i.bottom; } } diff --git a/platform/platform-impl/src/com/intellij/ide/ui/laf/intellij/MacIntelliJCheckBoxUI.java b/platform/platform-impl/src/com/intellij/ide/ui/laf/intellij/MacIntelliJCheckBoxUI.java index 3af24f2aae2a..90c44075bd4f 100644 --- a/platform/platform-impl/src/com/intellij/ide/ui/laf/intellij/MacIntelliJCheckBoxUI.java +++ b/platform/platform-impl/src/com/intellij/ide/ui/laf/intellij/MacIntelliJCheckBoxUI.java @@ -18,9 +18,12 @@ package com.intellij.ide.ui.laf.intellij; import com.intellij.ide.ui.laf.darcula.ui.DarculaCheckBoxUI; import com.intellij.util.ui.EmptyIcon; import com.intellij.util.ui.JBUI; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import javax.swing.*; import javax.swing.plaf.ComponentUI; +import java.awt.*; /** * @author Konstantin Bulenkov @@ -46,4 +49,10 @@ public class MacIntelliJCheckBoxUI extends DarculaCheckBoxUI { protected int textIconGap() { return JBUI.scale(4); } + + @Nullable + @Override + public Insets getVisualPaddings(@NotNull Component component) { + return JBUI.insets(3, 4, 2, 0); + } } diff --git a/platform/platform-impl/src/com/intellij/ide/ui/laf/intellij/MacIntelliJComboBoxUI.java b/platform/platform-impl/src/com/intellij/ide/ui/laf/intellij/MacIntelliJComboBoxUI.java index f663a0c78971..b8c886bdc99e 100644 --- a/platform/platform-impl/src/com/intellij/ide/ui/laf/intellij/MacIntelliJComboBoxUI.java +++ b/platform/platform-impl/src/com/intellij/ide/ui/laf/intellij/MacIntelliJComboBoxUI.java @@ -140,7 +140,7 @@ public class MacIntelliJComboBoxUI extends DarculaComboBoxUI { int iconWidth = DEFAULT_ICON.getIconWidth() + i.right; int iconHeight = DEFAULT_ICON.getIconHeight() + i.top + i.bottom; int editorHeight = editor != null ? editor.getPreferredSize().height + i.top + i.bottom : 0; - int maxHeight = JBUI.scale(JBUI.isUseCorrectInputHeightOnMacOS(comboBox) ? MacIntelliJTextFieldUI.MACOS_LIGHT_INPUT_HEIGHT_TOTAL : 26); + int maxHeight = JBUI.scale(JBUI.isUseCorrectInputHeight(comboBox) ? MacIntelliJTextFieldUI.MACOS_LIGHT_INPUT_HEIGHT_TOTAL : 26); return new Dimension(Math.max(d.width + JBUI.scale(7), iconWidth), Math.max(Math.max(iconHeight, editorHeight), maxHeight)); } diff --git a/platform/platform-impl/src/com/intellij/ide/ui/laf/intellij/MacIntelliJRadioButtonUI.java b/platform/platform-impl/src/com/intellij/ide/ui/laf/intellij/MacIntelliJRadioButtonUI.java index 8c2ff449a627..eedaf5ed95fe 100644 --- a/platform/platform-impl/src/com/intellij/ide/ui/laf/intellij/MacIntelliJRadioButtonUI.java +++ b/platform/platform-impl/src/com/intellij/ide/ui/laf/intellij/MacIntelliJRadioButtonUI.java @@ -18,9 +18,12 @@ package com.intellij.ide.ui.laf.intellij; import com.intellij.ide.ui.laf.darcula.ui.DarculaRadioButtonUI; import com.intellij.util.ui.EmptyIcon; import com.intellij.util.ui.JBUI; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import javax.swing.*; import javax.swing.plaf.ComponentUI; +import java.awt.*; /** * @author Konstantin Bulenkov @@ -37,4 +40,10 @@ public class MacIntelliJRadioButtonUI extends DarculaRadioButtonUI { public Icon getDefaultIcon() { return DEFAULT_ICON; } + + @Nullable + @Override + public Insets getVisualPaddings(@NotNull Component component) { + return JBUI.insets(3, 3, 2, 0); + } } diff --git a/platform/platform-impl/src/com/intellij/ide/ui/laf/intellij/MacIntelliJTextFieldUI.java b/platform/platform-impl/src/com/intellij/ide/ui/laf/intellij/MacIntelliJTextFieldUI.java index ecbd6e3b7b34..a653845f4ea5 100644 --- a/platform/platform-impl/src/com/intellij/ide/ui/laf/intellij/MacIntelliJTextFieldUI.java +++ b/platform/platform-impl/src/com/intellij/ide/ui/laf/intellij/MacIntelliJTextFieldUI.java @@ -44,7 +44,7 @@ public class MacIntelliJTextFieldUI extends DarculaTextFieldUI { @Override protected int getMinimumHeight() { JTextComponent component = getComponent(); - if (JBUI.isUseCorrectInputHeightOnMacOS(component)) { + if (JBUI.isUseCorrectInputHeight(component)) { return super.getMinimumHeight(); } return DarculaEditorTextFieldBorder.isComboBoxEditor(component) ? JBUI.scale(18) : JBUI.scale(26); diff --git a/platform/platform-impl/src/com/intellij/ide/ui/laf/intellij/WinIntelliJButtonBorder.java b/platform/platform-impl/src/com/intellij/ide/ui/laf/intellij/WinIntelliJButtonBorder.java index 5148f4f5d0ba..7a754e95816b 100644 --- a/platform/platform-impl/src/com/intellij/ide/ui/laf/intellij/WinIntelliJButtonBorder.java +++ b/platform/platform-impl/src/com/intellij/ide/ui/laf/intellij/WinIntelliJButtonBorder.java @@ -1,11 +1,13 @@ // Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.ide.ui.laf.intellij; +import com.intellij.ide.ui.laf.VisualPaddingsProvider; import com.intellij.ide.ui.laf.darcula.ui.DarculaButtonUI; import com.intellij.util.ui.JBInsets; import com.intellij.util.ui.JBUI; import com.intellij.util.ui.UIUtil; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import javax.swing.*; import javax.swing.border.Border; @@ -18,7 +20,7 @@ import static com.intellij.ide.ui.laf.intellij.WinIntelliJButtonUI.DISABLED_ALPH /** * @author Konstantin Bulenkov */ -public class WinIntelliJButtonBorder implements Border, UIResource { +public class WinIntelliJButtonBorder implements Border, UIResource, VisualPaddingsProvider { @Override public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { if (!(c instanceof AbstractButton) || UIUtil.isHelpButton(c)) return; @@ -50,6 +52,12 @@ public class WinIntelliJButtonBorder implements Border, UIResource { } } + @Nullable + @Override + public Insets getVisualPaddings(@NotNull Component component) { + return JBUI.insets(1); + } + private static Color getBorderColor(AbstractButton b) { ButtonModel bm = b.getModel(); diff --git a/platform/platform-impl/src/com/intellij/ide/ui/laf/intellij/WinIntelliJCheckBoxUI.java b/platform/platform-impl/src/com/intellij/ide/ui/laf/intellij/WinIntelliJCheckBoxUI.java index d8ad6f603138..8eec22760b9e 100644 --- a/platform/platform-impl/src/com/intellij/ide/ui/laf/intellij/WinIntelliJCheckBoxUI.java +++ b/platform/platform-impl/src/com/intellij/ide/ui/laf/intellij/WinIntelliJCheckBoxUI.java @@ -20,6 +20,8 @@ import com.intellij.util.ui.EmptyIcon; import com.intellij.util.ui.IconCache; import com.intellij.util.ui.JBUI; import com.intellij.util.ui.UIUtil; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import javax.swing.*; import javax.swing.plaf.ComponentUI; @@ -31,6 +33,12 @@ import java.awt.*; public class WinIntelliJCheckBoxUI extends DarculaCheckBoxUI { private static final Icon DEFAULT_ICON = JBUI.scale(EmptyIcon.create(13)).asUIResource(); + @Nullable + @Override + public Insets getVisualPaddings(@NotNull Component component) { + return JBUI.insets(1, 0); + } + @SuppressWarnings({"MethodOverridesStaticMethodOfSuperclass", "UnusedDeclaration"}) public static ComponentUI createUI(JComponent c) { AbstractButton b = (AbstractButton)c; diff --git a/platform/platform-impl/src/com/intellij/ide/ui/laf/intellij/WinIntelliJComboBoxUI.java b/platform/platform-impl/src/com/intellij/ide/ui/laf/intellij/WinIntelliJComboBoxUI.java index fdd2657c54d7..887e58a06cff 100644 --- a/platform/platform-impl/src/com/intellij/ide/ui/laf/intellij/WinIntelliJComboBoxUI.java +++ b/platform/platform-impl/src/com/intellij/ide/ui/laf/intellij/WinIntelliJComboBoxUI.java @@ -23,6 +23,7 @@ import com.intellij.ui.PopupMenuListenerAdapter; import com.intellij.util.ui.*; import com.intellij.util.ui.components.BorderLayoutPanel; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import javax.swing.*; import javax.swing.border.Border; @@ -578,4 +579,10 @@ public class WinIntelliJComboBoxUI extends DarculaComboBoxUI { return panel; } } + + @Nullable + @Override + public Insets getVisualPaddings(@NotNull Component component) { + return JBUI.insets(1); + } } diff --git a/platform/platform-impl/src/com/intellij/ide/ui/laf/intellij/WinIntelliJPasswordFieldUI.java b/platform/platform-impl/src/com/intellij/ide/ui/laf/intellij/WinIntelliJPasswordFieldUI.java index cfdc181625bb..80988d105e40 100644 --- a/platform/platform-impl/src/com/intellij/ide/ui/laf/intellij/WinIntelliJPasswordFieldUI.java +++ b/platform/platform-impl/src/com/intellij/ide/ui/laf/intellij/WinIntelliJPasswordFieldUI.java @@ -16,6 +16,9 @@ package com.intellij.ide.ui.laf.intellij; import com.intellij.ide.ui.laf.darcula.DarculaUIUtil; +import com.intellij.ide.ui.laf.darcula.ui.DarculaEditorTextFieldBorder; +import com.intellij.util.ui.JBUI; +import com.intellij.util.ui.UIUtil; import javax.swing.*; import javax.swing.plaf.ComponentUI; @@ -87,4 +90,15 @@ public class WinIntelliJPasswordFieldUI extends BasicPasswordFieldUI { g2.dispose(); } } + + @Override + public Dimension getMinimumSize(JComponent c) { + Dimension size = super.getMinimumSize(c); + if (size != null && JBUI.isUseCorrectInputHeight(c)) { + size.height = DarculaEditorTextFieldBorder.isComboBoxEditor(c) || + UIUtil.getParentOfType(JSpinner.class, c) != null ? + JBUI.scale(18) : JBUI.scale(24); + } + return size; + } } diff --git a/platform/platform-impl/src/com/intellij/ide/ui/laf/intellij/WinIntelliJRadioButtonUI.java b/platform/platform-impl/src/com/intellij/ide/ui/laf/intellij/WinIntelliJRadioButtonUI.java index a573fd0c3c2b..4541ab6e8dea 100644 --- a/platform/platform-impl/src/com/intellij/ide/ui/laf/intellij/WinIntelliJRadioButtonUI.java +++ b/platform/platform-impl/src/com/intellij/ide/ui/laf/intellij/WinIntelliJRadioButtonUI.java @@ -19,6 +19,8 @@ import com.intellij.ide.ui.laf.darcula.ui.DarculaRadioButtonUI; import com.intellij.util.ui.EmptyIcon; import com.intellij.util.ui.IconCache; import com.intellij.util.ui.JBUI; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import javax.swing.*; import javax.swing.plaf.ComponentUI; @@ -53,4 +55,10 @@ public class WinIntelliJRadioButtonUI extends DarculaRadioButtonUI { public Icon getDefaultIcon() { return DEFAULT_ICON; } + + @Nullable + @Override + public Insets getVisualPaddings(@NotNull Component component) { + return JBUI.insets(1, 0); + } } diff --git a/platform/platform-impl/src/com/intellij/ide/ui/laf/intellij/WinIntelliJSpinnerBorder.java b/platform/platform-impl/src/com/intellij/ide/ui/laf/intellij/WinIntelliJSpinnerBorder.java index 80e0c7544651..f5f727d6ba08 100644 --- a/platform/platform-impl/src/com/intellij/ide/ui/laf/intellij/WinIntelliJSpinnerBorder.java +++ b/platform/platform-impl/src/com/intellij/ide/ui/laf/intellij/WinIntelliJSpinnerBorder.java @@ -20,6 +20,8 @@ import com.intellij.ide.ui.laf.darcula.ui.DarculaSpinnerBorder; import com.intellij.openapi.ui.ErrorBorderCapable; import com.intellij.util.ui.JBInsets; import com.intellij.util.ui.JBUI; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import javax.swing.*; import java.awt.*; @@ -76,4 +78,10 @@ public class WinIntelliJSpinnerBorder extends DarculaSpinnerBorder implements Er public Insets getBorderInsets(Component c) { return new JBInsets(2, 2, 2, 2).asUIResource(); } + + @Nullable + @Override + public Insets getVisualPaddings(@NotNull Component component) { + return JBUI.insets(1); + } } diff --git a/platform/platform-impl/src/com/intellij/ide/ui/laf/intellij/WinIntelliJTextBorder.java b/platform/platform-impl/src/com/intellij/ide/ui/laf/intellij/WinIntelliJTextBorder.java index 32fbd7b485b8..99216bd687bb 100644 --- a/platform/platform-impl/src/com/intellij/ide/ui/laf/intellij/WinIntelliJTextBorder.java +++ b/platform/platform-impl/src/com/intellij/ide/ui/laf/intellij/WinIntelliJTextBorder.java @@ -20,6 +20,8 @@ import com.intellij.ide.ui.laf.darcula.ui.TextFieldWithPopupHandlerUI; import com.intellij.ui.ColorPanel; import com.intellij.util.ui.JBInsets; import com.intellij.util.ui.JBUI; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import javax.swing.*; import java.awt.*; @@ -92,5 +94,11 @@ public class WinIntelliJTextBorder extends DarculaTextBorder { g2.dispose(); } } + + @Nullable + @Override + public Insets getVisualPaddings(@NotNull Component component) { + return JBUI.insets(1); + } } diff --git a/platform/platform-impl/src/com/intellij/ui/layout/SpacingConfiguration.kt b/platform/platform-impl/src/com/intellij/ui/layout/SpacingConfiguration.kt index bd997e163a52..af92670bd5b1 100644 --- a/platform/platform-impl/src/com/intellij/ui/layout/SpacingConfiguration.kt +++ b/platform/platform-impl/src/com/intellij/ui/layout/SpacingConfiguration.kt @@ -8,16 +8,18 @@ import com.intellij.util.ui.UIUtil fun createIntelliJSpacingConfiguration(): SpacingConfiguration { // https://jetbrains.github.io/ui/controls/input_field/#spacing val isUnderIntelliJLaF = UIUtil.isUnderIntelliJLaF() + val isUnderWin10LookAndFeel = UIUtil.isUnderWin10LookAndFeel() val labelColumnVerticalTopGap = when { SystemInfoRt.isMac && isUnderIntelliJLaF -> 2 + isUnderWin10LookAndFeel -> 3 else -> 4 } return object : SpacingConfiguration { override val labelColumnVerticalTopGap = JBUI.scale(labelColumnVerticalTopGap) - override val isCompensateVisualPaddings = SystemInfoRt.isMac + override val isCompensateVisualPaddings = SystemInfoRt.isMac || isUnderWin10LookAndFeel override val horizontalGap = JBUI.scale(8) override val verticalGap = JBUI.scale(5 * 2) diff --git a/platform/platform-impl/src/com/intellij/ui/layout/layout.kt b/platform/platform-impl/src/com/intellij/ui/layout/layout.kt index 9f6218f683ac..4192b1e8b7e5 100644 --- a/platform/platform-impl/src/com/intellij/ui/layout/layout.kt +++ b/platform/platform-impl/src/com/intellij/ui/layout/layout.kt @@ -1,9 +1,7 @@ // Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.ui.layout -import com.intellij.openapi.util.SystemInfoRt import com.intellij.ui.components.Panel -import com.intellij.util.ui.JBUI import javax.swing.JPanel /** @@ -23,9 +21,6 @@ inline fun panel(vararg constraints: LCFlags, title: String? = null, init: Layou builder.init() val panel = Panel(title, layout = null) - if (SystemInfoRt.isMac) { - panel.putClientProperty(JBUI.COMPENSATE_VISUAL_PADDING_KEY, false) - } builder.builder.build(panel, constraints) return panel } \ No newline at end of file diff --git a/platform/platform-impl/src/com/intellij/ui/layout/migLayout/MigLayoutBuilder.kt b/platform/platform-impl/src/com/intellij/ui/layout/migLayout/MigLayoutBuilder.kt index ad577025eea9..df8865642ce8 100644 --- a/platform/platform-impl/src/com/intellij/ui/layout/migLayout/MigLayoutBuilder.kt +++ b/platform/platform-impl/src/com/intellij/ui/layout/migLayout/MigLayoutBuilder.kt @@ -4,6 +4,7 @@ package com.intellij.ui.layout.migLayout import com.intellij.ui.components.noteComponent import com.intellij.ui.layout.* import com.intellij.util.containers.ContainerUtil +import com.intellij.util.ui.JBUI import net.miginfocom.layout.* import net.miginfocom.layout.PlatformDefaults.VISUAL_PADDING_PROPERTY import net.miginfocom.layout.PlatformDefaults.setDefaultVisualPadding @@ -11,6 +12,7 @@ import net.miginfocom.swing.MigLayout import java.awt.Component import java.awt.Container import javax.swing.ButtonGroup +import javax.swing.JComponent import javax.swing.JDialog import javax.swing.JLabel @@ -84,6 +86,10 @@ internal class MigLayoutBuilder(val spacing: SpacingConfiguration) : LayoutBuild } override fun build(container: Container, layoutConstraints: Array) { + if (spacing.isCompensateVisualPaddings) { + (container as JComponent).putClientProperty(JBUI.COMPENSATE_VISUAL_PADDING_KEY, false) + } + val lc = LC() lc.gridGapX = gapToBoundSize(0, true) lc.gridGapY = gapToBoundSize(spacing.verticalGap, false) diff --git a/platform/platform-impl/src/com/intellij/ui/layout/migLayout/MigLayoutRow.kt b/platform/platform-impl/src/com/intellij/ui/layout/migLayout/MigLayoutRow.kt index 44171b17791a..a76197b115fd 100644 --- a/platform/platform-impl/src/com/intellij/ui/layout/migLayout/MigLayoutRow.kt +++ b/platform/platform-impl/src/com/intellij/ui/layout/migLayout/MigLayoutRow.kt @@ -275,7 +275,7 @@ internal class MigLayoutRow(private val parent: MigLayoutRow?, } val paddings = (border as? VisualPaddingsProvider)?.getVisualPaddings(originalComponent) ?: return - originalComponent.putClientProperty(PlatformDefaults.VISUAL_PADDING_PROPERTY, paddings) + originalComponent.putClientProperty(PlatformDefaults.VISUAL_PADDING_PROPERTY, intArrayOf(paddings.top, paddings.left, paddings.bottom, paddings.right)) } private fun shareCellWithPreviousComponentIfNeed(component: JComponent, componentCC: Lazy): Boolean { diff --git a/platform/platform-tests/testData/ui/laf/Darcula/win/components.svg b/platform/platform-tests/testData/ui/laf/Darcula/win/components.svg index ef926c0f3f45..d1ca54054594 100644 --- a/platform/platform-tests/testData/ui/laf/Darcula/win/components.svg +++ b/platform/platform-tests/testData/ui/laf/Darcula/win/components.svg @@ -1,3 +1,4 @@ + diff --git a/platform/platform-tests/testData/ui/laf/IntelliJ/win/components.svg b/platform/platform-tests/testData/ui/laf/IntelliJ/win/components.svg index abfb9b4e879c..29ad18514ccc 100644 --- a/platform/platform-tests/testData/ui/laf/IntelliJ/win/components.svg +++ b/platform/platform-tests/testData/ui/laf/IntelliJ/win/components.svg @@ -1,3 +1,4 @@ + diff --git a/platform/platform-tests/testData/ui/layout/Darcula/align fields in the nested grid.yml b/platform/platform-tests/testData/ui/layout/Darcula/align fields in the nested grid.yml index 716a95721252..dc71a55517ba 100644 --- a/platform/platform-tests/testData/ui/layout/Darcula/align fields in the nested grid.yml +++ b/platform/platform-tests/testData/ui/layout/Darcula/align fields in the nested grid.yml @@ -12,6 +12,7 @@ layoutConstraints: - {horizontal: true, unit: 0, value: 0.0} - {horizontal: false, unit: 0, value: 0.0} - {horizontal: true, unit: 0, value: 0.0} + visualPadding: false rowConstraints: constraints: - align: {horizontal: false, unit: 6, value: 0.0} @@ -40,7 +41,7 @@ componentConstrains: 'Database:': horizontal: gapBefore: - min: &id006 {horizontal: true, value: 21.0} + min: &id006 {horizontal: true, value: 23.0} preferred: *id006 vertical: gapBefore: @@ -60,7 +61,7 @@ componentConstrains: 'Master Password:': horizontal: gapBefore: - min: &id009 {horizontal: true, value: 21.0} + min: &id009 {horizontal: true, value: 23.0} preferred: *id009 vertical: gapBefore: @@ -77,18 +78,18 @@ componentConstrains: spanX: 2097051 wrap: true cellBounds: -- [0, 0, 480, 24] -- [0, 34, 131, 24] -- [137, 34, 335, 24] -- [137, 34, 335, 24] -- [0, 68, 131, 24] -- [137, 68, 343, 24] -- [137, 98, 343, 14] +- [0, 0, 480, 23] +- [0, 33, 115, 32] +- [121, 33, 351, 32] +- [121, 33, 351, 32] +- [0, 75, 115, 30] +- [121, 75, 359, 30] +- [121, 111, 359, 16] componentBounds: - In KeePass: [-2, 0, 90, 24] - 'Database:': [21, 38, 61, 16] - 'JTextField #2': [135, 32, 314, 28] - 'JLabel #3': [451, 38, 21, 16] - 'Master Password:': [21, 72, 110, 16] - 'JBPasswordField #5': [135, 66, 254, 28] - Stored using weak encryption.: [138, 98, 155, 14] + In KeePass: [0, 0, 78, 23] + 'Database:': [23, 41, 51, 16] + 'JTextField #2': [121, 33, 326, 32] + 'JLabel #3': [451, 41, 21, 16] + 'Master Password:': [23, 81, 92, 16] + 'JBPasswordField #5': [121, 75, 250, 30] + Stored using weak encryption.: [122, 111, 159, 16] diff --git a/platform/platform-tests/testData/ui/layout/Darcula/align fields.yml b/platform/platform-tests/testData/ui/layout/Darcula/align fields.yml index ede3b4d63d6b..fcbe63484296 100644 --- a/platform/platform-tests/testData/ui/layout/Darcula/align fields.yml +++ b/platform/platform-tests/testData/ui/layout/Darcula/align fields.yml @@ -12,6 +12,7 @@ layoutConstraints: - {horizontal: true, unit: 0, value: 0.0} - {horizontal: false, unit: 0, value: 0.0} - {horizontal: true, unit: 0, value: 0.0} + visualPadding: false rowConstraints: constraints: - align: {horizontal: false, unit: 6, value: 0.0} @@ -46,11 +47,11 @@ componentConstrains: spanX: 2097051 wrap: true cellBounds: -- [0, 0, 142, 24] -- [148, 0, 332, 24] -- [0, 34, 142, 24] -- [148, 34, 332, 24] +- [0, 0, 124, 22] +- [130, 0, 350, 22] +- [0, 32, 124, 32] +- [130, 32, 350, 32] componentBounds: - Create Android module: [0, 4, 142, 16] - 'Android module name:': [0, 38, 139, 16] - 'JTextField #3': [146, 32, 336, 28] + Create Android module: [0, 4, 124, 16] + 'Android module name:': [0, 36, 123, 16] + 'JTextField #3': [130, 32, 350, 32] diff --git a/platform/platform-tests/testData/ui/layout/Darcula/cell.yml b/platform/platform-tests/testData/ui/layout/Darcula/cell.yml index 8b386a4f9b55..53452f2c7b3c 100644 --- a/platform/platform-tests/testData/ui/layout/Darcula/cell.yml +++ b/platform/platform-tests/testData/ui/layout/Darcula/cell.yml @@ -12,6 +12,7 @@ layoutConstraints: - {horizontal: true, unit: 0, value: 0.0} - {horizontal: false, unit: 0, value: 0.0} - {horizontal: true, unit: 0, value: 0.0} + visualPadding: false rowConstraints: constraints: - align: {horizontal: false, unit: 6, value: 0.0} @@ -52,7 +53,7 @@ componentConstrains: Use File -> Settings Repository... to configure: horizontal: gapBefore: - min: &id008 {horizontal: true, value: 1.0} + min: &id008 {horizontal: true, value: 4.0} preferred: *id008 skip: 1 spanX: 2097051 @@ -64,14 +65,14 @@ componentConstrains: vertical: {grow: 100.0} wrap: true cellBounds: -- [0, 0, 70, 24] -- [76, 0, 396, 24] -- [76, 0, 396, 24] -- [76, 30, 404, 14] -- [0, 54, 480, 256] +- [0, 0, 59, 30] +- [65, 0, 407, 30] +- [65, 0, 407, 30] +- [65, 36, 415, 16] +- [0, 62, 480, 248] componentBounds: - 'Repository:': [0, 4, 70, 16] - 'ComboBox #1': [73, -3, 42, 30] - Delete: [117, -3, 78, 30] - Use File -> Settings Repository... to configure: [77, 30, 233, 14] - 'JBScrollPane #4': [0, 54, 480, 256] + 'Repository:': [0, 4, 59, 16] + 'ComboBox #1': [65, 0, 41, 30] + Delete: [114, 0, 78, 30] + Use File -> Settings Repository... to configure: [69, 36, 237, 16] + 'JBScrollPane #4': [0, 62, 480, 248] diff --git a/platform/platform-tests/testData/ui/layout/Darcula/note row in the dialog.yml b/platform/platform-tests/testData/ui/layout/Darcula/note row in the dialog.yml index 4d347bc9dedc..c64b3b4a2c0e 100644 --- a/platform/platform-tests/testData/ui/layout/Darcula/note row in the dialog.yml +++ b/platform/platform-tests/testData/ui/layout/Darcula/note row in the dialog.yml @@ -12,6 +12,7 @@ layoutConstraints: - {horizontal: true, unit: 0, value: 0.0} - {horizontal: false, unit: 0, value: 0.0} - {horizontal: true, unit: 0, value: 0.0} + visualPadding: false rowConstraints: constraints: - align: {horizontal: false, unit: 6, value: 0.0} @@ -64,14 +65,14 @@ componentConstrains: wrap: true cellBounds: - [0, 0, 480, 62] -- [0, 72, 100, 24] -- [106, 72, 374, 24] -- [106, 106, 374, 24] -- [0, 140, 480, 52] +- [0, 72, 83, 30] +- [89, 72, 391, 30] +- [89, 112, 391, 22] +- [0, 144, 480, 52] componentBounds: Profiler requires access to the kernel-level API. Enter the sudo password to allow this.: [ - 0, 10, 287, 32] - 'Sudo password:': [0, 76, 100, 16] - 'JPasswordField #2': [104, 70, 254, 28] - !!binary "G1JlbWVtYmVy": [104, 106, 91, 24] - 'SimpleColoredComponent #4': [0, 152, 316, 20] + 0, 10, 242, 32] + 'Sudo password:': [0, 78, 83, 16] + 'JPasswordField #2': [89, 72, 250, 30] + !!binary "G1JlbWVtYmVy": [89, 112, 89, 22] + 'SimpleColoredComponent #4': [0, 156, 271, 20] diff --git a/platform/platform-tests/testData/ui/layout/Darcula/visual paddings.yml b/platform/platform-tests/testData/ui/layout/Darcula/visual paddings.yml index 984a41cb5e87..335d2891af0e 100644 --- a/platform/platform-tests/testData/ui/layout/Darcula/visual paddings.yml +++ b/platform/platform-tests/testData/ui/layout/Darcula/visual paddings.yml @@ -12,6 +12,7 @@ layoutConstraints: - {horizontal: true, unit: 0, value: 0.0} - {horizontal: false, unit: 0, value: 0.0} - {horizontal: true, unit: 0, value: 0.0} + visualPadding: false rowConstraints: constraints: - align: {horizontal: false, unit: 6, value: 0.0} @@ -150,7 +151,7 @@ componentConstrains: 'Scroll pane:': vertical: gapBefore: - max: &id021 {horizontal: false, value: 1.0} + max: &id021 {horizontal: false, value: 4.0} min: *id021 preferred: *id021 'JBScrollPane #26': @@ -160,57 +161,57 @@ componentConstrains: vertical: {grow: 100.0} wrap: true cellBounds: -- [0, 0, 124, 24] -- [130, 0, 516, 24] -- [0, 34, 124, 24] -- [130, 34, 516, 24] -- [0, 68, 124, 24] -- [130, 68, 516, 24] -- [0, 102, 124, 24] -- [130, 102, 516, 24] -- [0, 136, 124, 24] -- [130, 136, 516, 24] -- [0, 170, 124, 24] -- [130, 170, 516, 24] -- [0, 204, 124, 24] -- [130, 204, 516, 24] -- [0, 238, 124, 24] -- [130, 238, 516, 24] -- [0, 272, 124, 24] -- [130, 272, 516, 24] -- [0, 306, 124, 24] -- [130, 306, 508, 24] -- [130, 306, 508, 24] -- [130, 306, 508, 24] -- [130, 306, 508, 24] -- [130, 306, 508, 24] -- [130, 306, 508, 24] -- [0, 340, 124, 21] -- [130, 340, 516, 21] +- [0, 0, 108, 32] +- [114, 0, 529, 32] +- [0, 42, 108, 30] +- [114, 42, 529, 30] +- [0, 82, 108, 30] +- [114, 82, 529, 30] +- [0, 122, 108, 30] +- [114, 122, 529, 30] +- [0, 162, 108, 30] +- [114, 162, 529, 30] +- [0, 202, 108, 22] +- [114, 202, 529, 22] +- [0, 234, 108, 23] +- [114, 234, 529, 23] +- [0, 267, 108, 30] +- [114, 267, 529, 30] +- [0, 307, 108, 30] +- [114, 307, 529, 30] +- [0, 347, 108, 32] +- [114, 347, 521, 32] +- [114, 347, 521, 32] +- [114, 347, 521, 32] +- [114, 347, 521, 32] +- [114, 347, 521, 32] +- [114, 347, 521, 32] +- [0, 389, 108, 20] +- [114, 389, 529, 20] componentBounds: - 'Text field:': [0, 4, 61, 16] - 'JTextField #1': [128, -2, 520, 28] - 'Password:': [0, 38, 64, 16] - 'JPasswordField #3': [128, 32, 254, 28] - 'Combobox:': [0, 72, 71, 16] - 'JComboBox #5': [127, 65, 522, 30] - 'Combobox Editable:': [0, 106, 124, 16] - 'JComboBox #7': [127, 99, 522, 30] - 'Button:': [0, 140, 47, 16] - label: [128, 204, 51, 24] - 'CheckBox:': [0, 174, 66, 16] - enabled: [128, 170, 71, 24] - 'RadioButton:': [0, 208, 81, 16] - 'Spinner:': [0, 242, 51, 16] - 'JBIntSpinner #15': [127, 235, 72, 30] - 'Text with browse:': [0, 276, 110, 16] - 'TextFieldWithHistoryWithBrowseButton #17': [127, 269, 522, 30] - 'All:': [0, 310, 19, 16] - 'JTextField #19': [128, 304, 41, 28] - 'JPasswordField #20': [173, 304, 254, 28] - 'JComboBox #21': [430, 303, 53, 30] - b: [485, 303, 78, 30] - c: [566, 306, 30, 24] - rb: [602, 306, 36, 24] - 'Scroll pane:': [0, 341, 72, 16] - 'JBScrollPane #26': [130, 340, 516, 21] + 'Text field:': [0, 4, 51, 16] + 'JTextField #1': [114, 0, 529, 32] + 'Password:': [0, 46, 53, 16] + 'JPasswordField #3': [114, 42, 250, 30] + 'Combobox:': [0, 86, 63, 16] + 'JComboBox #5': [114, 82, 529, 30] + 'Combobox Editable:': [0, 126, 108, 16] + 'JComboBox #7': [114, 122, 529, 30] + 'Button:': [0, 166, 39, 16] + label: [114, 234, 48, 23] + 'CheckBox:': [0, 206, 56, 16] + enabled: [114, 202, 65, 22] + 'RadioButton:': [0, 238, 69, 16] + 'Spinner:': [0, 271, 43, 16] + 'JBIntSpinner #15': [114, 267, 72, 30] + 'Text with browse:': [0, 311, 92, 16] + 'TextFieldWithHistoryWithBrowseButton #17': [114, 307, 529, 30] + 'All:': [0, 351, 17, 16] + 'JTextField #19': [114, 347, 40, 32] + 'JPasswordField #20': [162, 347, 250, 30] + 'JComboBox #21': [420, 347, 50, 30] + b: [478, 347, 78, 30] + c: [564, 347, 29, 22] + rb: [601, 347, 34, 23] + 'Scroll pane:': [0, 393, 61, 16] + 'JBScrollPane #26': [114, 389, 529, 20] diff --git a/platform/platform-tests/testData/ui/layout/Darcula/win/align fields in the nested grid.svg b/platform/platform-tests/testData/ui/layout/Darcula/win/align fields in the nested grid.svg new file mode 100644 index 000000000000..3f9dc5621fa1 --- /dev/null +++ b/platform/platform-tests/testData/ui/layout/Darcula/win/align fields in the nested grid.svg @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Stored using weak encryption. + + + + + + + + + + + + Master Password: + + + + + + + + + + + + + + + Database: + + + + + + In KeePass + + + diff --git a/platform/platform-tests/testData/ui/layout/Darcula/win/align fields.svg b/platform/platform-tests/testData/ui/layout/Darcula/win/align fields.svg new file mode 100644 index 000000000000..a4f61a4490e1 --- /dev/null +++ b/platform/platform-tests/testData/ui/layout/Darcula/win/align fields.svg @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + input + + + + + + Android module name: + + + + + + Android module name: + + + Create Android module + + + diff --git a/platform/platform-tests/testData/ui/layout/Darcula/win/cell.svg b/platform/platform-tests/testData/ui/layout/Darcula/win/cell.svg new file mode 100644 index 000000000000..3746aec9b075 --- /dev/null +++ b/platform/platform-tests/testData/ui/layout/Darcula/win/cell.svg @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Use File -> Settings Repository... to configure + + + + + + + + + Delete + + + + + + + + + + + + + + + + + + + + Repository: + + + diff --git a/platform/platform-tests/testData/ui/layout/Darcula/win/note row in the dialog.svg b/platform/platform-tests/testData/ui/layout/Darcula/win/note row in the dialog.svg new file mode 100644 index 000000000000..eaae83d0424e --- /dev/null +++ b/platform/platform-tests/testData/ui/layout/Darcula/win/note row in the dialog.svg @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Should be an empty row above as a gap. + Click me + . + + + + + + &Remember + + + + + + + + + + + + Sudo password: + + + Profiler requires access to the kernel-level API. + Enter the sudo password to allow this. + + + diff --git a/platform/platform-tests/testData/ui/layout/Darcula/win/visual paddings.svg b/platform/platform-tests/testData/ui/layout/Darcula/win/visual paddings.svg new file mode 100644 index 000000000000..86a6a13b7fc4 --- /dev/null +++ b/platform/platform-tests/testData/ui/layout/Darcula/win/visual paddings.svg @@ -0,0 +1,328 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Scroll pane: + + + + + + rb + + + + + + c + + + + + + + + + b + + + + + + + + + + + + + + + c1 + + + + + + + + + + + + • + • + • + • + • + • + + + + + + + + + + + + t + + + + + + All: + + + + + + Text with browse: + + + + + + + + + + + + Spinner: + + + + + + label + + + RadioButton: + + + + + + enabled + + + CheckBox: + + + + + + + + + label + + + + + + + Button: + + + + + + + + + + + + + Combobox Editable: + + + + + + + + + + + one + + + + + + Combobox: + + + + + + + + + • + • + • + • + • + • + + + + + + Password: + + + + + + + + + text + + + + + + Text field: + + + diff --git a/platform/platform-tests/testData/ui/layout/IntelliJ/win/align fields in the nested grid.svg b/platform/platform-tests/testData/ui/layout/IntelliJ/win/align fields in the nested grid.svg new file mode 100644 index 000000000000..4c2b78024e80 --- /dev/null +++ b/platform/platform-tests/testData/ui/layout/IntelliJ/win/align fields in the nested grid.svg @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Stored using weak encryption. + + + + + + + + + + Master Password: + + + + + + + + + + + + + Database: + + + + + + In KeePass + + + diff --git a/platform/platform-tests/testData/ui/layout/IntelliJ/win/align fields in the nested grid.yml b/platform/platform-tests/testData/ui/layout/IntelliJ/win/align fields in the nested grid.yml new file mode 100644 index 000000000000..7358642a9776 --- /dev/null +++ b/platform/platform-tests/testData/ui/layout/IntelliJ/win/align fields in the nested grid.yml @@ -0,0 +1,94 @@ +layoutConstraints: + fillX: true + gridGapX: + min: &id001 {horizontal: true, unit: 0, value: 0.0} + preferred: *id001 + gridGapY: + min: &id002 {horizontal: false, value: 10.0} + preferred: *id002 + hideMode: 3 + insets: + - {horizontal: false, unit: 0, value: 0.0} + - {horizontal: true, unit: 0, value: 0.0} + - {horizontal: false, unit: 0, value: 0.0} + - {horizontal: true, unit: 0, value: 0.0} +rowConstraints: + constraints: + - align: {horizontal: false, unit: 6, value: 0.0} + - {} + - gapAfter: + max: &id003 {horizontal: true, value: 6.0} + min: *id003 + preferred: *id003 + - {} + count: 4 +columnConstraints: + constraints: + - gapAfter: + max: &id004 {horizontal: true, value: 6.0} + min: *id004 + preferred: *id004 + - gapAfter: + max: &id005 {horizontal: true, value: 8.0} + min: *id005 + preferred: *id005 + grow: 100.0 + - {} + count: 3 +componentConstrains: + In KeePass: {spanX: 2097051, wrap: true} + 'Database:': + horizontal: + gapBefore: + min: &id006 {horizontal: true, value: 17.0} + preferred: *id006 + vertical: + gapBefore: + max: &id007 {horizontal: false, value: 3.0} + min: *id007 + preferred: *id007 + 'JTextField #2': + horizontal: {grow: 100.0} + split: 2 + 'JLabel #3': + horizontal: + gapBefore: + min: &id008 {horizontal: true, value: 4.0} + preferred: *id008 + spanX: 2097051 + wrap: true + 'Master Password:': + horizontal: + gapBefore: + min: &id009 {horizontal: true, value: 17.0} + preferred: *id009 + vertical: + gapBefore: + max: &id010 {horizontal: false, value: 3.0} + min: *id010 + preferred: *id010 + 'JBPasswordField #5': {spanX: 2097051, wrap: true} + Stored using weak encryption.: + horizontal: + gapBefore: + min: &id011 {horizontal: true, value: 1.0} + preferred: *id011 + skip: 1 + spanX: 2097051 + wrap: true +cellBounds: +- [0, 0, 480, 22] +- [0, 32, 109, 22] +- [115, 32, 357, 22] +- [115, 32, 357, 22] +- [0, 64, 109, 23] +- [115, 64, 365, 23] +- [115, 93, 365, 16] +componentBounds: + In KeePass: [0, -1, 72, 24] + 'Database:': [17, 35, 51, 16] + 'JTextField #2': [114, 31, 334, 24] + 'JLabel #3': [451, 35, 21, 16] + 'Master Password:': [17, 67, 92, 16] + 'JBPasswordField #5': [114, 63, 252, 25] + Stored using weak encryption.: [116, 93, 159, 16] diff --git a/platform/platform-tests/testData/ui/layout/IntelliJ/win/align fields.svg b/platform/platform-tests/testData/ui/layout/IntelliJ/win/align fields.svg new file mode 100644 index 000000000000..487d51ac5cc2 --- /dev/null +++ b/platform/platform-tests/testData/ui/layout/IntelliJ/win/align fields.svg @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + input + + + + + + Android module name: + + + + + + Android module name: + + + Create Android module + + + diff --git a/platform/platform-tests/testData/ui/layout/IntelliJ/win/align fields.yml b/platform/platform-tests/testData/ui/layout/IntelliJ/win/align fields.yml new file mode 100644 index 000000000000..1693151a9121 --- /dev/null +++ b/platform/platform-tests/testData/ui/layout/IntelliJ/win/align fields.yml @@ -0,0 +1,56 @@ +layoutConstraints: + fillX: true + gridGapX: + min: &id001 {horizontal: true, unit: 0, value: 0.0} + preferred: *id001 + gridGapY: + min: &id002 {horizontal: false, value: 10.0} + preferred: *id002 + hideMode: 3 + insets: + - {horizontal: false, unit: 0, value: 0.0} + - {horizontal: true, unit: 0, value: 0.0} + - {horizontal: false, unit: 0, value: 0.0} + - {horizontal: true, unit: 0, value: 0.0} +rowConstraints: + constraints: + - align: {horizontal: false, unit: 6, value: 0.0} +columnConstraints: + constraints: + - gapAfter: + max: &id003 {horizontal: true, value: 6.0} + min: *id003 + preferred: *id003 + - gapAfter: + max: &id004 {horizontal: true, value: 8.0} + min: *id004 + preferred: *id004 + grow: 100.0 + - {} + count: 3 +componentConstrains: + Create Android module: + vertical: + gapBefore: + max: &id005 {horizontal: false, value: 3.0} + min: *id005 + preferred: *id005 + 'Android module name:': + vertical: + gapBefore: + max: &id006 {horizontal: false, value: 3.0} + min: *id006 + preferred: *id006 + 'JTextField #3': + horizontal: {grow: 100.0} + spanX: 2097051 + wrap: true +cellBounds: +- [0, 0, 124, 22] +- [130, 0, 350, 22] +- [0, 32, 124, 22] +- [130, 32, 350, 22] +componentBounds: + Create Android module: [0, 3, 124, 16] + 'Android module name:': [0, 35, 123, 16] + 'JTextField #3': [129, 31, 352, 24] diff --git a/platform/platform-tests/testData/ui/layout/IntelliJ/win/cell.svg b/platform/platform-tests/testData/ui/layout/IntelliJ/win/cell.svg new file mode 100644 index 000000000000..2d12a6f1832c --- /dev/null +++ b/platform/platform-tests/testData/ui/layout/IntelliJ/win/cell.svg @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Use File -> Settings Repository... to configure + + + + + + + + Delete + + + + + + + + + + + + + + + + + + + Repository: + + + diff --git a/platform/platform-tests/testData/ui/layout/IntelliJ/win/cell.yml b/platform/platform-tests/testData/ui/layout/IntelliJ/win/cell.yml new file mode 100644 index 000000000000..46df9a7b06ac --- /dev/null +++ b/platform/platform-tests/testData/ui/layout/IntelliJ/win/cell.yml @@ -0,0 +1,77 @@ +layoutConstraints: + fillX: true + gridGapX: + min: &id001 {horizontal: true, unit: 0, value: 0.0} + preferred: *id001 + gridGapY: + min: &id002 {horizontal: false, value: 10.0} + preferred: *id002 + hideMode: 3 + insets: + - {horizontal: false, unit: 0, value: 0.0} + - {horizontal: true, unit: 0, value: 0.0} + - {horizontal: false, unit: 0, value: 0.0} + - {horizontal: true, unit: 0, value: 0.0} +rowConstraints: + constraints: + - align: {horizontal: false, unit: 6, value: 0.0} + gapAfter: + max: &id003 {horizontal: true, value: 6.0} + min: *id003 + preferred: *id003 + - {} + count: 2 +columnConstraints: + constraints: + - gapAfter: + max: &id004 {horizontal: true, value: 6.0} + min: *id004 + preferred: *id004 + - gapAfter: + max: &id005 {horizontal: true, value: 8.0} + min: *id005 + preferred: *id005 + grow: 100.0 + - {} + count: 3 +componentConstrains: + 'Repository:': + vertical: + gapBefore: + max: &id006 {horizontal: false, value: 3.0} + min: *id006 + preferred: *id006 + 'ComboBox #1': {split: 2} + Delete: + horizontal: + gapBefore: + min: &id007 {horizontal: true, value: 8.0} + preferred: *id007 + spanX: 2097051 + wrap: true + Use File -> Settings Repository... to configure: + horizontal: + gapBefore: + min: &id008 {horizontal: true, value: 1.0} + preferred: *id008 + skip: 1 + spanX: 2097051 + wrap: true + 'JBScrollPane #4': + horizontal: {grow: 100.0} + pushY: 100.0 + spanX: 2097051 + vertical: {grow: 100.0} + wrap: true +cellBounds: +- [0, 0, 59, 22] +- [65, 0, 407, 22] +- [65, 0, 407, 22] +- [65, 28, 415, 16] +- [0, 54, 480, 256] +componentBounds: + 'Repository:': [0, 3, 59, 16] + 'ComboBox #1': [64, -1, 42, 24] + Delete: [112, -1, 74, 24] + Use File -> Settings Repository... to configure: [66, 28, 237, 16] + 'JBScrollPane #4': [0, 54, 480, 256] diff --git a/platform/platform-tests/testData/ui/layout/IntelliJ/win/note row in the dialog.svg b/platform/platform-tests/testData/ui/layout/IntelliJ/win/note row in the dialog.svg new file mode 100644 index 000000000000..1ca456befc55 --- /dev/null +++ b/platform/platform-tests/testData/ui/layout/IntelliJ/win/note row in the dialog.svg @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Should be an empty row above as a gap. + Click me + . + + + + + + &Remember + + + + + + + + + + Sudo password: + + + Profiler requires access to the kernel-level API. + Enter the sudo password to allow this. + + + diff --git a/platform/platform-tests/testData/ui/layout/IntelliJ/win/note row in the dialog.yml b/platform/platform-tests/testData/ui/layout/IntelliJ/win/note row in the dialog.yml new file mode 100644 index 000000000000..970a52e074e9 --- /dev/null +++ b/platform/platform-tests/testData/ui/layout/IntelliJ/win/note row in the dialog.yml @@ -0,0 +1,77 @@ +layoutConstraints: + fillX: true + gridGapX: + min: &id001 {horizontal: true, unit: 0, value: 0.0} + preferred: *id001 + gridGapY: + min: &id002 {horizontal: false, value: 10.0} + preferred: *id002 + hideMode: 3 + insets: + - {horizontal: false, unit: 0, value: 0.0} + - {horizontal: true, unit: 0, value: 0.0} + - {horizontal: false, unit: 0, value: 0.0} + - {horizontal: true, unit: 0, value: 0.0} +rowConstraints: + constraints: + - align: {horizontal: false, unit: 6, value: 0.0} + noGrid: true + - {} + - {} + - {noGrid: true} + count: 4 +columnConstraints: + constraints: + - gapAfter: + max: &id003 {horizontal: true, value: 6.0} + min: *id003 + preferred: *id003 + - gapAfter: + max: &id004 {horizontal: true, value: 8.0} + min: *id004 + preferred: *id004 + grow: 100.0 + - {} + count: 3 +componentConstrains: + Profiler requires access to the kernel-level API. Enter the sudo password to allow this.: + spanX: 2097051 + vertical: + gapAfter: + min: &id005 {horizontal: false, value: 20.0} + preferred: *id005 + gapBefore: + min: &id006 {horizontal: false, value: 10.0} + preferred: *id006 + wrap: true + 'Sudo password:': + vertical: + gapBefore: + max: &id007 {horizontal: false, value: 3.0} + min: *id007 + preferred: *id007 + 'JPasswordField #2': {spanX: 2097051, wrap: true} + !!binary "G1JlbWVtYmVy": {skip: 1, spanX: 2097051, wrap: true} + 'SimpleColoredComponent #4': + spanX: 2097051 + vertical: + gapAfter: + min: &id008 {horizontal: false, value: 20.0} + preferred: *id008 + gapBefore: + min: &id009 {horizontal: false, value: 12.0} + preferred: *id009 + wrap: true +cellBounds: +- [0, 0, 480, 62] +- [0, 72, 83, 23] +- [89, 72, 391, 23] +- [89, 105, 391, 22] +- [0, 137, 480, 52] +componentBounds: + Profiler requires access to the kernel-level API. Enter the sudo password to allow this.: [ + 0, 10, 242, 32] + 'Sudo password:': [0, 75, 83, 16] + 'JPasswordField #2': [88, 71, 252, 25] + !!binary "G1JlbWVtYmVy": [89, 104, 83, 24] + 'SimpleColoredComponent #4': [0, 149, 269, 20] diff --git a/platform/platform-tests/testData/ui/layout/IntelliJ/win/visual paddings.svg b/platform/platform-tests/testData/ui/layout/IntelliJ/win/visual paddings.svg new file mode 100644 index 000000000000..fcac524bc3e3 --- /dev/null +++ b/platform/platform-tests/testData/ui/layout/IntelliJ/win/visual paddings.svg @@ -0,0 +1,284 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Scroll pane: + + + + + + rb + + + + + + c + + + + + + + + b + + + + + + + + + + + + + + c1 + + + + + + + + + + • + • + • + • + • + • + + + + + + + + + + t + + + + + + All: + + + + + + Text with browse: + + + + + + + + + Spinner: + + + + + + label + + + RadioButton: + + + + + + enabled + + + CheckBox: + + + + + + + + label + + + + + + Button: + + + + + + + + + + + + + Combobox Editable: + + + + + + + + + + + one + + + + + + Combobox: + + + + + + + • + • + • + • + • + • + + + + + + Password: + + + + + + + text + + + + + + Text field: + + + diff --git a/platform/platform-tests/testData/ui/layout/IntelliJ/win/visual paddings.yml b/platform/platform-tests/testData/ui/layout/IntelliJ/win/visual paddings.yml new file mode 100644 index 000000000000..891dca742268 --- /dev/null +++ b/platform/platform-tests/testData/ui/layout/IntelliJ/win/visual paddings.yml @@ -0,0 +1,216 @@ +layoutConstraints: + fillX: true + gridGapX: + min: &id001 {horizontal: true, unit: 0, value: 0.0} + preferred: *id001 + gridGapY: + min: &id002 {horizontal: false, value: 10.0} + preferred: *id002 + hideMode: 3 + insets: + - {horizontal: false, unit: 0, value: 0.0} + - {horizontal: true, unit: 0, value: 0.0} + - {horizontal: false, unit: 0, value: 0.0} + - {horizontal: true, unit: 0, value: 0.0} +rowConstraints: + constraints: + - align: {horizontal: false, unit: 6, value: 0.0} +columnConstraints: + constraints: + - gapAfter: + max: &id003 {horizontal: true, value: 6.0} + min: *id003 + preferred: *id003 + - gapAfter: + max: &id004 {horizontal: true, value: 8.0} + min: *id004 + preferred: *id004 + grow: 100.0 + - {} + count: 3 +componentConstrains: + 'Text field:': + vertical: + gapBefore: + max: &id005 {horizontal: false, value: 3.0} + min: *id005 + preferred: *id005 + 'JTextField #1': + horizontal: {grow: 100.0} + spanX: 2097051 + wrap: true + 'Password:': + vertical: + gapBefore: + max: &id006 {horizontal: false, value: 3.0} + min: *id006 + preferred: *id006 + 'JPasswordField #3': {spanX: 2097051, wrap: true} + 'Combobox:': + vertical: + gapBefore: + max: &id007 {horizontal: false, value: 3.0} + min: *id007 + preferred: *id007 + 'JComboBox #5': + horizontal: {grow: 100.0} + spanX: 2097051 + wrap: true + 'Combobox Editable:': + vertical: + gapBefore: + max: &id008 {horizontal: false, value: 3.0} + min: *id008 + preferred: *id008 + 'JComboBox #7': + horizontal: {grow: 100.0} + spanX: 2097051 + wrap: true + 'Button:': + vertical: + gapBefore: + max: &id009 {horizontal: false, value: 3.0} + min: *id009 + preferred: *id009 + label: {spanX: 2097051, wrap: true} + 'CheckBox:': + vertical: + gapBefore: + max: &id010 {horizontal: false, value: 3.0} + min: *id010 + preferred: *id010 + enabled: {spanX: 2097051, wrap: true} + 'RadioButton:': + vertical: + gapBefore: + max: &id011 {horizontal: false, value: 3.0} + min: *id011 + preferred: *id011 + 'Spinner:': + vertical: + gapBefore: + max: &id012 {horizontal: false, value: 3.0} + min: *id012 + preferred: *id012 + 'JBIntSpinner #15': {spanX: 2097051, wrap: true} + 'Text with browse:': + vertical: + gapBefore: + max: &id013 {horizontal: false, value: 3.0} + min: *id013 + preferred: *id013 + 'TextFieldWithHistoryWithBrowseButton #17': + horizontal: + grow: 100.0 + size: + min: {horizontal: true, value: 350.0} + spanX: 2097051 + wrap: true + 'All:': + vertical: + gapBefore: + max: &id014 {horizontal: false, value: 3.0} + min: *id014 + preferred: *id014 + 'JTextField #19': + horizontal: {grow: 100.0} + split: 6 + 'JPasswordField #20': + horizontal: + gapBefore: + min: &id015 {horizontal: true, value: 8.0} + preferred: *id015 + size: + max: &id016 {horizontal: true, value: 250.0} + min: *id016 + preferred: *id016 + 'JComboBox #21': + horizontal: + gapBefore: + min: &id017 {horizontal: true, value: 8.0} + preferred: *id017 + grow: 100.0 + b: + horizontal: + gapBefore: + min: &id018 {horizontal: true, value: 8.0} + preferred: *id018 + c: + horizontal: + gapBefore: + min: &id019 {horizontal: true, value: 8.0} + preferred: *id019 + rb: + horizontal: + gapBefore: + min: &id020 {horizontal: true, value: 8.0} + preferred: *id020 + spanX: 2097051 + wrap: true + 'Scroll pane:': + vertical: + gapBefore: + max: &id021 {horizontal: false, value: 1.0} + min: *id021 + preferred: *id021 + 'JBScrollPane #26': + horizontal: {grow: 100.0} + pushY: 100.0 + spanX: 2097051 + vertical: {grow: 100.0} + wrap: true +cellBounds: +- [0, 0, 108, 22] +- [114, 0, 482, 22] +- [0, 32, 108, 23] +- [114, 32, 482, 23] +- [0, 65, 108, 22] +- [114, 65, 482, 22] +- [0, 97, 108, 22] +- [114, 97, 482, 22] +- [0, 129, 108, 22] +- [114, 129, 482, 22] +- [0, 161, 108, 22] +- [114, 161, 482, 22] +- [0, 193, 108, 22] +- [114, 193, 482, 22] +- [0, 225, 108, 22] +- [114, 225, 482, 22] +- [0, 257, 108, 22] +- [114, 257, 482, 22] +- [0, 289, 108, 23] +- [114, 289, 474, 23] +- [114, 289, 474, 23] +- [114, 289, 474, 23] +- [114, 289, 474, 23] +- [114, 289, 474, 23] +- [114, 289, 474, 23] +- [0, 322, 108, 20] +- [114, 322, 482, 20] +componentBounds: + 'Text field:': [0, 3, 51, 16] + 'JTextField #1': [113, -1, 484, 24] + 'Password:': [0, 35, 53, 16] + 'JPasswordField #3': [113, 31, 252, 25] + 'Combobox:': [0, 68, 63, 16] + 'JComboBox #5': [113, 64, 484, 24] + 'Combobox Editable:': [0, 100, 108, 16] + 'JComboBox #7': [113, 96, 484, 24] + 'Button:': [0, 132, 39, 16] + label: [114, 192, 42, 24] + 'CheckBox:': [0, 164, 56, 16] + enabled: [114, 160, 59, 24] + 'RadioButton:': [0, 196, 69, 16] + 'Spinner:': [0, 228, 43, 16] + 'JBIntSpinner #15': [113, 224, 67, 24] + 'Text with browse:': [0, 260, 92, 16] + 'TextFieldWithHistoryWithBrowseButton #17': [113, 256, 484, 24] + 'All:': [0, 292, 17, 16] + 'JTextField #19': [113, 288, 14, 24] + 'JPasswordField #20': [133, 288, 252, 25] + 'JComboBox #21': [391, 288, 51, 24] + b: [448, 288, 74, 24] + c: [529, 288, 23, 24] + rb: [560, 288, 28, 24] + 'Scroll pane:': [0, 323, 61, 16] + 'JBScrollPane #26': [114, 322, 482, 20] diff --git a/platform/util/src/com/intellij/util/ui/JBUI.java b/platform/util/src/com/intellij/util/ui/JBUI.java index 791f701daee8..58fdf0cd0369 100644 --- a/platform/util/src/com/intellij/util/ui/JBUI.java +++ b/platform/util/src/com/intellij/util/ui/JBUI.java @@ -1476,8 +1476,8 @@ public class JBUI { * * Correct input size is used now only for UI DSL. */ - public static boolean isUseCorrectInputHeightOnMacOS(@NotNull Component component) { - if (!SystemInfoRt.isMac) { + public static boolean isUseCorrectInputHeight(@NotNull Component component) { + if (!(SystemInfoRt.isMac || UIUtil.isUnderWin10LookAndFeel())) { return false; } @@ -1486,6 +1486,6 @@ public class JBUI { } public static boolean isCompensateVisualPaddingOnComponentLevel(@Nullable Component parent) { - return !(SystemInfoRt.isMac && parent instanceof JPanel && ((JPanel)parent).getClientProperty(COMPENSATE_VISUAL_PADDING_KEY) == Boolean.FALSE); + return !((SystemInfoRt.isMac || UIUtil.isUnderWin10LookAndFeel()) && parent instanceof JPanel && ((JPanel)parent).getClientProperty(COMPENSATE_VISUAL_PADDING_KEY) == Boolean.FALSE); } } \ No newline at end of file