From f8e5f809d42052d13e5c1eb408adf65bccd6bbca Mon Sep 17 00:00:00 2001 From: Sergey Malenkov Date: Thu, 12 Oct 2017 19:47:53 +0300 Subject: [PATCH] add experimental editor's thumb on windows --- .../intellij/ui/components/ScrollPainter.java | 38 +++++++++++++++++-- .../util/resources/misc/registry.properties | 30 +++++++++++++++ 2 files changed, 65 insertions(+), 3 deletions(-) diff --git a/platform/platform-api/src/com/intellij/ui/components/ScrollPainter.java b/platform/platform-api/src/com/intellij/ui/components/ScrollPainter.java index b22fbdd77c31..23ad3d3c0988 100644 --- a/platform/platform-api/src/com/intellij/ui/components/ScrollPainter.java +++ b/platform/platform-api/src/com/intellij/ui/components/ScrollPainter.java @@ -71,9 +71,41 @@ class ScrollPainter extends RegionPainter.Alpha { } static final class EditorThumb { - static final RegionPainter DARCULA = new ScrollPainter(0, .33f, .12f, Gray.xA6, Gray.x1A); - static final RegionPainter DEFAULT = new Protected(new SubtractColor(0, .25f, .15f, Gray.x80, Gray.xA6), - new ScrollPainter(0, .25f, .15f, Gray.x80, Gray.x59)); + private static final RegionPainter DARCULA_OLD = new ScrollPainter(0, .33f, .12f, Gray.xA6, Gray.x1A); + private static final RegionPainter DARCULA_NEW = new EditorThumbPainter( + 1, + value("win.editor.thumb.darcula.alpha.base", 89), + value("win.editor.thumb.darcula.alpha.delta", 166), + new ColorFunction( + value("win.editor.thumb.darcula.color.min", 0x8C), + value("win.editor.thumb.darcula.color.max", 0xA1)), + gray("win.editor.thumb.darcula.border", 0x1F)); + + private static final RegionPainter DEFAULT_OLD = new Protected(new SubtractColor(0, .25f, .15f, Gray.x80, Gray.xA6), + new ScrollPainter(0, .25f, .15f, Gray.x80, Gray.x59)); + private static final RegionPainter DEFAULT_NEW = new EditorThumbPainter( + 2, + value("win.editor.thumb.default.alpha.base", 140), + value("win.editor.thumb.default.alpha.delta", 115), + new ColorFunction( + value("win.editor.thumb.default.color.min", 0x9E), + value("win.editor.thumb.default.color.max", 0xBD)), + gray("win.editor.thumb.default.border", 0x8C)); + + static final RegionPainter DARCULA = new RegionPainter() { + @Override + public void paint(Graphics2D g, int x, int y, int width, int height, Float value) { + RegionPainter painter = Registry.is("ide.editor.thumb.experimental") ? DARCULA_NEW : DARCULA_OLD; + painter.paint(g, x, y, width, height, value); + } + }; + static final RegionPainter DEFAULT = new RegionPainter() { + @Override + public void paint(Graphics2D g, int x, int y, int width, int height, Float value) { + RegionPainter painter = Registry.is("ide.editor.thumb.experimental") ? DEFAULT_NEW : DEFAULT_OLD; + painter.paint(g, x, y, width, height, value); + } + }; static final class Mac { private static final RegionPainter DARCULA_OLD = new Round(1, .35f, .20f, xA6, x0D); diff --git a/platform/util/resources/misc/registry.properties b/platform/util/resources/misc/registry.properties index 51cebb99b0ce..4f7ccec3be09 100644 --- a/platform/util/resources/misc/registry.properties +++ b/platform/util/resources/misc/registry.properties @@ -177,6 +177,36 @@ mac.editor.thumb.default.alpha.base.description=Allows to tune an experimental t mac.editor.thumb.default.alpha.delta=153 mac.editor.thumb.default.alpha.delta.description=Allows to tune an experimental thumb color in the editor component. +win.editor.thumb.darcula.border=31 +win.editor.thumb.darcula.border.description=Allows to tune an experimental thumb border in the editor component. + +win.editor.thumb.darcula.color.min=140 +win.editor.thumb.darcula.color.min.description=Allows to tune an experimental thumb color in the editor component. + +win.editor.thumb.darcula.color.max=161 +win.editor.thumb.darcula.color.max.description=Allows to tune an experimental thumb color in the editor component. + +win.editor.thumb.darcula.alpha.base=89 +win.editor.thumb.darcula.alpha.base.description=Allows to tune an experimental thumb color in the editor component. + +win.editor.thumb.darcula.alpha.delta=166 +win.editor.thumb.darcula.alpha.delta.description=Allows to tune an experimental thumb color in the editor component. + +win.editor.thumb.default.border=140 +win.editor.thumb.default.border.description=Allows to tune an experimental thumb border in the editor component. + +win.editor.thumb.default.color.min=158 +win.editor.thumb.default.color.min.description=Allows to tune an experimental thumb color in the editor component. + +win.editor.thumb.default.color.max=189 +win.editor.thumb.default.color.max.description=Allows to tune an experimental thumb color in the editor component. + +win.editor.thumb.default.alpha.base=140 +win.editor.thumb.default.alpha.base.description=Allows to tune an experimental thumb color in the editor component. + +win.editor.thumb.default.alpha.delta=115 +win.editor.thumb.default.alpha.delta.description=Allows to tune an experimental thumb color in the editor component. + mac.scroll.thumb.darcula.color=166 mac.scroll.thumb.darcula.color.description=Allows to tune a thumb color in the editor component.