diff --git a/platform/dvcs-impl/src/com/intellij/dvcs/actions/DvcsCompareWithAction.java b/platform/dvcs-impl/src/com/intellij/dvcs/actions/DvcsCompareWithAction.java index 2a07231fad3c..12a5df13924c 100644 --- a/platform/dvcs-impl/src/com/intellij/dvcs/actions/DvcsCompareWithAction.java +++ b/platform/dvcs-impl/src/com/intellij/dvcs/actions/DvcsCompareWithAction.java @@ -33,7 +33,6 @@ import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.wm.IdeFocusManager; import com.intellij.ui.dsl.listCellRenderer.BuilderKt; import com.intellij.util.containers.JBIterable; -import com.intellij.util.ui.JBDimension; import com.intellij.util.ui.JBUI; import com.intellij.vcs.CompareWithLocalDialog; import org.jetbrains.annotations.Nls; @@ -105,7 +104,7 @@ public abstract class DvcsCompareWithAction extends DumbAw .setAutoselectOnMouseMove(true) .setNamerForFiltering(o -> o) .setRenderer(BuilderKt.textListCellRenderer((@NlsSafe var name) -> name)) - .withFixedRendererSize(new JBDimension(350, JBUI.CurrentTheme.List.rowHeight())) // do not freeze on huge lists + .withFixedRendererSize(new Dimension(JBUI.scale(350), JBUI.CurrentTheme.List.rowHeight())) // do not freeze on huge lists .createPopup(); } diff --git a/platform/lang-impl/src/com/intellij/find/actions/ShowUsagesTable.java b/platform/lang-impl/src/com/intellij/find/actions/ShowUsagesTable.java index 770d782bc64e..83102b174a54 100644 --- a/platform/lang-impl/src/com/intellij/find/actions/ShowUsagesTable.java +++ b/platform/lang-impl/src/com/intellij/find/actions/ShowUsagesTable.java @@ -92,7 +92,7 @@ public final class ShowUsagesTable extends JBTable implements DataProvider { public int getRowHeight() { if (ExperimentalUI.isNewUI()) { Insets innerInsets = JBUI.CurrentTheme.Popup.Selection.innerInsets(); - return JBUI.scale(JBUI.CurrentTheme.List.rowHeight()) + innerInsets.top + innerInsets.bottom; + return JBUI.CurrentTheme.List.rowHeight() + innerInsets.top + innerInsets.bottom; } return super.getRowHeight() + 2 * ShowUsagesTableCellRenderer.MARGIN; diff --git a/platform/lang-impl/src/com/intellij/ide/actions/newclass/CreateWithTemplatesDialogPanel.java b/platform/lang-impl/src/com/intellij/ide/actions/newclass/CreateWithTemplatesDialogPanel.java index c10558b609a1..0066a1fdb3d6 100644 --- a/platform/lang-impl/src/com/intellij/ide/actions/newclass/CreateWithTemplatesDialogPanel.java +++ b/platform/lang-impl/src/com/intellij/ide/actions/newclass/CreateWithTemplatesDialogPanel.java @@ -104,7 +104,8 @@ public class CreateWithTemplatesDialogPanel extends NewItemWithTemplatesPopupPan } }; wrapper.setBackground(JBUI.CurrentTheme.Popup.BACKGROUND); - wrapper.setBorder(JBUI.Borders.emptyTop(JBUI.CurrentTheme.NewClassDialog.fieldsSeparatorWidth())); + //noinspection UseDPIAwareBorders + wrapper.setBorder(new EmptyBorder(JBUI.CurrentTheme.NewClassDialog.fieldsSeparatorWidth(), 0, 0, 0)); wrapper.add(delegate, BorderLayout.CENTER); return wrapper; } diff --git a/platform/platform-api/src/com/intellij/openapi/ui/popup/util/PopupUtil.java b/platform/platform-api/src/com/intellij/openapi/ui/popup/util/PopupUtil.java index 6c5495eb007c..2a8530f4dcac 100644 --- a/platform/platform-api/src/com/intellij/openapi/ui/popup/util/PopupUtil.java +++ b/platform/platform-api/src/com/intellij/openapi/ui/popup/util/PopupUtil.java @@ -253,7 +253,7 @@ public final class PopupUtil { public static void configListRendererFixedHeight(SelectablePanel selectablePanel) { configListRendererFlexibleHeight(selectablePanel); - selectablePanel.setPreferredHeight(JBUI.scale(JBUI.CurrentTheme.List.rowHeight())); + selectablePanel.setPreferredHeight(JBUI.CurrentTheme.List.rowHeight()); } public static void configListRendererFlexibleHeight(SelectablePanel selectablePanel) { diff --git a/platform/platform-impl/src/com/intellij/ui/GroupedComboBoxRenderer.kt b/platform/platform-impl/src/com/intellij/ui/GroupedComboBoxRenderer.kt index 88a83d46d8bb..ec4e8bf5a3c7 100644 --- a/platform/platform-impl/src/com/intellij/ui/GroupedComboBoxRenderer.kt +++ b/platform/platform-impl/src/com/intellij/ui/GroupedComboBoxRenderer.kt @@ -79,7 +79,7 @@ abstract class GroupedComboBoxRenderer(val combo: ComboBox? = null) : Grou override fun getPreferredSize(): Dimension { return super.getPreferredSize().let { if (maxWidth > 0) it.width = maxWidth - it.height = JBUI.scale(JBUI.CurrentTheme.List.rowHeight()) + it.height = JBUI.CurrentTheme.List.rowHeight() if (!ExperimentalUI.isNewUI()) { val insets = ComboBoxPopup.COMBO_ITEM_BORDER.borderInsets it.height += insets.bottom + insets.top diff --git a/platform/platform-impl/src/com/intellij/ui/dsl/listCellRenderer/impl/LcrRowImpl.kt b/platform/platform-impl/src/com/intellij/ui/dsl/listCellRenderer/impl/LcrRowImpl.kt index acae11ad6040..6e83c38e27d4 100644 --- a/platform/platform-impl/src/com/intellij/ui/dsl/listCellRenderer/impl/LcrRowImpl.kt +++ b/platform/platform-impl/src/com/intellij/ui/dsl/listCellRenderer/impl/LcrRowImpl.kt @@ -207,7 +207,7 @@ internal class LcrRowImpl(private val renderer: LcrRow.() -> Unit) : LcrRo selectionInsets = JBInsets.create(0, 12) border = JBUI.Borders.empty(0, 20) } - preferredHeight = JBUI.scale(JBUI.CurrentTheme.List.rowHeight()) + preferredHeight = JBUI.CurrentTheme.List.rowHeight() background = list.background selectionColor = selectionBg diff --git a/platform/platform-impl/src/com/intellij/ui/plaf/beg/IdeaMenuUI.java b/platform/platform-impl/src/com/intellij/ui/plaf/beg/IdeaMenuUI.java index 201d7874eeb0..9f6a540a1b23 100644 --- a/platform/platform-impl/src/com/intellij/ui/plaf/beg/IdeaMenuUI.java +++ b/platform/platform-impl/src/com/intellij/ui/plaf/beg/IdeaMenuUI.java @@ -70,7 +70,7 @@ public class IdeaMenuUI extends BasicMenuUI { JBInsets outerInsets = IdeaPopupMenuUI.isPartOfPopupMenu(c) ? JBUI.CurrentTheme.PopupMenu.Selection.outerInsets() : JBUI.CurrentTheme.Menu.Selection.outerInsets(); - return new Dimension(preferredSize.width, JBUI.scale(JBUI.CurrentTheme.List.rowHeight()) + outerInsets.height()); + return new Dimension(preferredSize.width, JBUI.CurrentTheme.List.rowHeight() + outerInsets.height()); } return preferredSize; diff --git a/platform/platform-impl/src/com/intellij/ui/popup/list/PopupListElementRenderer.java b/platform/platform-impl/src/com/intellij/ui/popup/list/PopupListElementRenderer.java index 532fdcc15e8a..266608d765ca 100644 --- a/platform/platform-impl/src/com/intellij/ui/popup/list/PopupListElementRenderer.java +++ b/platform/platform-impl/src/com/intellij/ui/popup/list/PopupListElementRenderer.java @@ -118,7 +118,7 @@ public class PopupListElementRenderer extends GroupedItemsListRenderer { public Dimension getPreferredSize() { Dimension size = super.getPreferredSize(); if (ExperimentalUI.isNewUI()) { - size.height = JBUI.scale(JBUI.CurrentTheme.List.rowHeight()); + size.height = JBUI.CurrentTheme.List.rowHeight(); } return size; } diff --git a/platform/platform-impl/src/com/intellij/ui/popup/tree/TreePopupImpl.java b/platform/platform-impl/src/com/intellij/ui/popup/tree/TreePopupImpl.java index 06a3baecda0b..38cf83592afc 100644 --- a/platform/platform-impl/src/com/intellij/ui/popup/tree/TreePopupImpl.java +++ b/platform/platform-impl/src/com/intellij/ui/popup/tree/TreePopupImpl.java @@ -354,7 +354,7 @@ public class TreePopupImpl extends WizardPopup implements TreePopup, NextStepHan public @NotNull Dimension getPreferredSize() { Dimension size = super.getPreferredSize(); if (ExperimentalUI.isNewUI()) { - size.height = JBUI.scale(JBUI.CurrentTheme.Tree.rowHeight()); + size.height = JBUI.CurrentTheme.Tree.rowHeight(); } return size; } diff --git a/platform/platform-impl/src/com/intellij/ui/tree/ui/DefaultTreeLayoutCache.kt b/platform/platform-impl/src/com/intellij/ui/tree/ui/DefaultTreeLayoutCache.kt index 4043f62a3ba8..63cd4b8c4ab7 100644 --- a/platform/platform-impl/src/com/intellij/ui/tree/ui/DefaultTreeLayoutCache.kt +++ b/platform/platform-impl/src/com/intellij/ui/tree/ui/DefaultTreeLayoutCache.kt @@ -22,7 +22,7 @@ class DefaultTreeLayoutCache( private val autoExpandHandler: (TreePath) -> Unit, ) : AbstractLayoutCache() { - constructor(autoExpandHandler: (TreePath) -> Unit) : this(JBUI.scale(JBUI.CurrentTheme.Tree.rowHeight()), autoExpandHandler) + constructor(autoExpandHandler: (TreePath) -> Unit) : this(JBUI.CurrentTheme.Tree.rowHeight(), autoExpandHandler) private var root: Node? = null private val rows = NodeList(onUpdate = { diff --git a/platform/util/ui/src/com/intellij/util/ui/JBUI.java b/platform/util/ui/src/com/intellij/util/ui/JBUI.java index 1aadab0baa35..ffa4eee75215 100644 --- a/platform/util/ui/src/com/intellij/util/ui/JBUI.java +++ b/platform/util/ui/src/com/intellij/util/ui/JBUI.java @@ -1282,7 +1282,7 @@ public final class JBUI { } public static int fontSizeOffset() { - return getInt("CompletionPopup.Advertiser.fontSizeOffset", Math.round(CurrentTheme.Advertiser.FONT_SIZE_OFFSET.getUnscaled())); + return getInt("CompletionPopup.Advertiser.fontSizeOffset", CurrentTheme.Advertiser.FONT_SIZE_OFFSET.get()); } public static @NotNull Border border() { @@ -1923,7 +1923,7 @@ public final class JBUI { } public static int fieldsSeparatorWidth() { - return getInt("NewClass.separatorWidth", 10); + return getInt("NewClass.separatorWidth", JBUIScale.scale(10)); } } @@ -1986,9 +1986,8 @@ public final class JBUI { return selected ? Selection.foreground(focused) : FOREGROUND; } - /** @return unscaled value */ static int rowHeight() { - int defaultHeight = 24; + int defaultHeight = JBUIScale.scale(24); int result = getInt("List.rowHeight", defaultHeight); // Linux doesn't support rowHeight now, use default value. See IDEA-234112 return result <= 0 ? defaultHeight : result; @@ -2107,7 +2106,6 @@ public final class JBUI { return selected ? Selection.foreground(focused) : FOREGROUND; } - /** @return unscaled value */ static int rowHeight() { int defaultHeight = defaultRowHeight(); int result = getInt(rowHeightKey(), defaultHeight); @@ -2120,7 +2118,7 @@ public final class JBUI { } static int defaultRowHeight() { - return 24; + return JBUIScale.scale(24); } final class Selection { @@ -2271,19 +2269,11 @@ public final class JBUI { } } - /** - * @param defaultValue must be unscaled - * @return unscaled value of {@code propertyName} if it is specified, otherwise the {@code defaultValue} - */ public static int getInt(@NonNls @NotNull String propertyName, int defaultValue) { Object value = UIManager.get(propertyName); return value instanceof Integer ? (Integer)value : defaultValue; } - /** - * @param defaultValue must be unscaled - * @return unscaled value of {@code propertyName} if it is specified, otherwise the {@code defaultValue} - */ public static float getFloat(@NonNls @NotNull String propertyName, float defaultValue) { Object value = UIManager.get(propertyName); if (value instanceof Float) return (Float)value; diff --git a/plugins/git4idea/src/git4idea/ui/branch/popup/GitBranchesTreePopup.kt b/plugins/git4idea/src/git4idea/ui/branch/popup/GitBranchesTreePopup.kt index 1d4fc0a59416..dfaa30a4ac9e 100644 --- a/plugins/git4idea/src/git4idea/ui/branch/popup/GitBranchesTreePopup.kt +++ b/plugins/git4idea/src/git4idea/ui/branch/popup/GitBranchesTreePopup.kt @@ -723,7 +723,7 @@ class GitBranchesTreePopup(project: Project, step: GitBranchesTreePopupStep, par internal val POPUP_KEY = DataKey.create("GIT_BRANCHES_TREE_POPUP") internal val treeRowHeight: Int - get() = if (isNewUI) JBUI.scale(JBUI.CurrentTheme.List.rowHeight()) else JBUIScale.scale(22) + get() = if (isNewUI) JBUI.CurrentTheme.List.rowHeight() else JBUIScale.scale(22) /** * @param selectedRepository - Selected repository: diff --git a/plugins/package-search/src/com/jetbrains/packagesearch/intellij/plugin/ui/toolwindow/panels/management/packages/PackagesTable.kt b/plugins/package-search/src/com/jetbrains/packagesearch/intellij/plugin/ui/toolwindow/panels/management/packages/PackagesTable.kt index b6f321580e56..928d3d58b83d 100644 --- a/plugins/package-search/src/com/jetbrains/packagesearch/intellij/plugin/ui/toolwindow/panels/management/packages/PackagesTable.kt +++ b/plugins/package-search/src/com/jetbrains/packagesearch/intellij/plugin/ui/toolwindow/panels/management/packages/PackagesTable.kt @@ -176,8 +176,8 @@ internal class PackagesTable( setShowGrid(false) rowHeight = JBUI.getInt( "PackageSearch.PackagesList.rowHeight", - JBUI.getInt("List.rowHeight", if (PackageSearchUI.isNewUI) 24 else 20) - ).scaled() + JBUI.getInt("List.rowHeight", if (PackageSearchUI.isNewUI) 24.scaled() else 20.scaled()) + ) setExpandableItemsEnabled(false) selectionModel.selectionMode = ListSelectionModel.SINGLE_SELECTION