add ability to tune a track color on hover

This commit is contained in:
Sergey Malenkov
2017-11-27 20:13:07 +03:00
parent 1997065e3d
commit c457dc1f61
2 changed files with 28 additions and 2 deletions
@@ -50,8 +50,8 @@ class ScrollPainter extends RegionPainter.Alpha {
}
static final class Track {
static final RegionPainter<Float> DARCULA = new ScrollPainter(0, .0f, .1f, Gray.x80, null);
static final RegionPainter<Float> DEFAULT = DARCULA;
static final RegionPainter<Float> DARCULA = new TrackPainter("ide.scroll.track.darcula.alpha", "ide.scroll.track.darcula.fill");
static final RegionPainter<Float> DEFAULT = new TrackPainter("ide.scroll.track.default.alpha", "ide.scroll.track.default.fill");
}
static final class Thumb {
@@ -377,4 +377,18 @@ class ScrollPainter extends RegionPainter.Alpha {
RectanglePainter.paint(g, x, y, width, height, SystemInfo.isMac ? Math.min(width, height) : 0, myFillColor, myDrawColor);
}
}
private static class TrackPainter extends ScrollPainter {
private final IntSupplier supplier;
private TrackPainter(String alpha, String fill) {
super(0, 0, 0, gray(fill, 0x80), null);
supplier = value(alpha, 26);
}
@Override
protected float getAlpha(Float value) {
return value == null ? 0 : value * supplier.getAsInt() / 255;
}
}
}
@@ -149,6 +149,18 @@ ide.scroll.layout.header.over.corner.description=Expand a scroll pane header if
ide.scroll.thumb.small.if.opaque=false
ide.scroll.thumb.small.if.opaque.description=Allows to tune an opaque thumb thickness. Affects Windows and Linux only.
ide.scroll.track.darcula.alpha=26
ide.scroll.track.darcula.alpha.description=Allows to tune a track color on hover.
ide.scroll.track.darcula.fill=128
ide.scroll.track.darcula.fill.description=Allows to tune a track color on hover.
ide.scroll.track.default.alpha=26
ide.scroll.track.default.alpha.description=Allows to tune a track color on hover.
ide.scroll.track.default.fill=128
ide.scroll.track.default.fill.description=Allows to tune a track color on hover.
ide.editor.thumb.experimental=true
ide.editor.thumb.experimental.description=Another approach to paint editor's scroll thumb.