From 0954195598415a567985c7dff59cc2dc74397da5 Mon Sep 17 00:00:00 2001 From: Sergey Malenkov Date: Mon, 2 Aug 2021 13:52:03 +0300 Subject: [PATCH] Tune DragAndDrop.rowBackground after designer's review GitOrigin-RevId: 0f206b4f7e4e0f42608bfd761e7d5799018990dc --- .../src/com/intellij/ide/dnd/Highlighters.java | 2 +- .../com/intellij/ide/ui/laf/darcula/darcula.theme.json | 1 + .../src/com/intellij/ide/ui/laf/intellijlaf.theme.json | 1 + .../src/com/intellij/ui/tree/ui/DefaultTreeUI.java | 10 +++++----- .../src/themes/HighContrast.theme.json | 1 + .../metadata/IntelliJPlatform.themeMetadata.json | 5 +++++ platform/util/ui/src/com/intellij/util/ui/JBUI.java | 1 + 7 files changed, 15 insertions(+), 6 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/ide/dnd/Highlighters.java b/platform/platform-impl/src/com/intellij/ide/dnd/Highlighters.java index a82a76a8ba67..1a35f0b2b6e2 100644 --- a/platform/platform-impl/src/com/intellij/ide/dnd/Highlighters.java +++ b/platform/platform-impl/src/com/intellij/ide/dnd/Highlighters.java @@ -224,7 +224,7 @@ public class Highlighters implements DnDEvent.DropTargetHighlightingType { @Override protected void paintComponent(Graphics g) { - g.setColor(JBUI.CurrentTheme.DragAndDrop.Area.BACKGROUND); + g.setColor(JBUI.CurrentTheme.DragAndDrop.ROW_BACKGROUND); g.fillRect(0, 0, getWidth(), getHeight()); super.paintComponent(g); } diff --git a/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/darcula.theme.json b/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/darcula.theme.json index 44bbf0f62ca5..e1e8c444270d 100644 --- a/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/darcula.theme.json +++ b/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/darcula.theme.json @@ -133,6 +133,7 @@ "DragAndDrop": { "borderColor": "#2F65CA", + "rowBackground": "#2F65CA33", "areaBackground": "#FFFFFF33", "areaBorderColor": "#4F73A8", "areaForeground": "#BABABA" diff --git a/platform/platform-impl/src/com/intellij/ide/ui/laf/intellijlaf.theme.json b/platform/platform-impl/src/com/intellij/ide/ui/laf/intellijlaf.theme.json index 5b55099efc8b..ba1250559ccf 100644 --- a/platform/platform-impl/src/com/intellij/ide/ui/laf/intellijlaf.theme.json +++ b/platform/platform-impl/src/com/intellij/ide/ui/laf/intellijlaf.theme.json @@ -172,6 +172,7 @@ "DragAndDrop": { "borderColor": "#2675BF", + "rowBackground": "#2675BF26", "areaBackground": "#3d7dcc33", "areaBorderColor": "#8ab2de", "areaForeground": "#787878" diff --git a/platform/platform-impl/src/com/intellij/ui/tree/ui/DefaultTreeUI.java b/platform/platform-impl/src/com/intellij/ui/tree/ui/DefaultTreeUI.java index e893b17324f5..f782a5235ab8 100644 --- a/platform/platform-impl/src/com/intellij/ui/tree/ui/DefaultTreeUI.java +++ b/platform/platform-impl/src/com/intellij/ui/tree/ui/DefaultTreeUI.java @@ -1,4 +1,4 @@ -// Copyright 2000-2021 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. +// Copyright 2000-2021 JetBrains s.r.o. and contributors. 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.tree.ui; import com.intellij.ide.ui.UISettings; @@ -11,7 +11,6 @@ import com.intellij.ui.DirtyUI; import com.intellij.ui.ComponentUtil; import com.intellij.ui.LoadingNode; import com.intellij.ui.hover.TreeHoverListener; -import com.intellij.ui.paint.RectanglePainter; import com.intellij.ui.render.RenderingHelper; import com.intellij.ui.render.RenderingUtil; import com.intellij.ui.tree.AsyncTreeModel; @@ -51,6 +50,7 @@ import static com.intellij.openapi.util.SystemInfo.isMac; import static com.intellij.openapi.util.registry.Registry.intValue; import static com.intellij.openapi.util.registry.Registry.is; import static com.intellij.ui.paint.RectanglePainter.DRAW; +import static com.intellij.ui.paint.RectanglePainter.FILL; import static com.intellij.util.EditSourceOnDoubleClickHandler.isExpandPreferable; import static com.intellij.util.ReflectionUtil.getMethod; import static com.intellij.util.containers.ContainerUtil.createWeakSet; @@ -270,10 +270,10 @@ public final class DefaultTreeUI extends BasicTreeUI { JTree.DropLocation dropLocation = tree.getDropLocation(); if (dropLocation != null && g instanceof Graphics2D && path.equals(dropLocation.getPath())) { // paint a dragged tree path in accordance to Highlighters.RectangleHighlighter - g.setColor(JBUI.CurrentTheme.DragAndDrop.Area.BACKGROUND); - RectanglePainter.FILL.paint((Graphics2D)g, helper.getX(), bounds.y, helper.getWidth(), bounds.height, 0); + g.setColor(JBUI.CurrentTheme.DragAndDrop.ROW_BACKGROUND); + FILL.paint((Graphics2D)g, helper.getX(), bounds.y, helper.getWidth(), bounds.height, 0); g.setColor(JBUI.CurrentTheme.DragAndDrop.BORDER_COLOR); - RectanglePainter.DRAW.paint((Graphics2D)g, helper.getX(), bounds.y, helper.getWidth(), bounds.height, 0); + DRAW.paint((Graphics2D)g, helper.getX(), bounds.y, helper.getWidth(), bounds.height, 0); } } if ((bounds.y + bounds.height) >= maxPaintY) break; diff --git a/platform/platform-resources/src/themes/HighContrast.theme.json b/platform/platform-resources/src/themes/HighContrast.theme.json index ec9d1627d39d..6a1b32fa3c6b 100644 --- a/platform/platform-resources/src/themes/HighContrast.theme.json +++ b/platform/platform-resources/src/themes/HighContrast.theme.json @@ -112,6 +112,7 @@ "DragAndDrop": { "borderColor": "#3366FF", + "rowBackground": "#3366FF80", "areaForeground": "#FFFFFF", "areaBackground": "#00EAFF7F", "areaBorderColor": "#1AEBFF" diff --git a/platform/platform-resources/src/themes/metadata/IntelliJPlatform.themeMetadata.json b/platform/platform-resources/src/themes/metadata/IntelliJPlatform.themeMetadata.json index bc78640a49c8..a202b0629bb1 100644 --- a/platform/platform-resources/src/themes/metadata/IntelliJPlatform.themeMetadata.json +++ b/platform/platform-resources/src/themes/metadata/IntelliJPlatform.themeMetadata.json @@ -1236,6 +1236,11 @@ "description": "Drop position highlighting (line/rectangle) for drag-n-drop in trees and lists", "since": "2021.2" }, + { + "key": "DragAndDrop.rowBackground", + "description": "Drop position highlighting (rectangle) for drag-n-drop in trees and lists", + "since": "2021.3" + }, { "key": "Label.successForeground", "description": "Foreground for successful state/text", 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 08a78aff1423..a0ac25f74ac7 100644 --- a/platform/util/ui/src/com/intellij/util/ui/JBUI.java +++ b/platform/util/ui/src/com/intellij/util/ui/JBUI.java @@ -660,6 +660,7 @@ public class JBUI { public interface DragAndDrop { Color BORDER_COLOR = JBColor.namedColor("DragAndDrop.borderColor", 0x2675BF, 0x2F65CA); + Color ROW_BACKGROUND = JBColor.namedColor("DragAndDrop.rowBackground", 0x2675BF26, 0x2F65CA33); interface Area { Color FOREGROUND = JBColor.namedColor("DragAndDrop.areaForeground", 0x787878, 0xBABABA);