new editor scroll bar and 2px stripes
@@ -1569,7 +1569,7 @@
|
||||
<value>
|
||||
<option name="BACKGROUND" value="52503a" />
|
||||
<option name="EFFECT_TYPE" value="2" />
|
||||
<option name="ERROR_STRIPE_COLOR" value="8c8c00" />
|
||||
<option name="ERROR_STRIPE_COLOR" value="be9117" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="WRITE_IDENTIFIER_UNDER_CARET_ATTRIBUTES">
|
||||
|
||||
@@ -17,13 +17,16 @@ package com.intellij.codeHighlighting;
|
||||
|
||||
import com.intellij.lang.annotation.HighlightSeverity;
|
||||
import com.intellij.openapi.editor.colors.CodeInsightColors;
|
||||
import com.intellij.openapi.editor.colors.EditorColorsManager;
|
||||
import com.intellij.openapi.editor.colors.EditorColorsScheme;
|
||||
import com.intellij.openapi.editor.colors.TextAttributesKey;
|
||||
import com.intellij.openapi.editor.markup.TextAttributes;
|
||||
import com.intellij.openapi.extensions.ExtensionPointName;
|
||||
import com.intellij.openapi.extensions.Extensions;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.util.ImageLoader;
|
||||
import com.intellij.ui.JBColor;
|
||||
import com.intellij.util.containers.HashMap;
|
||||
import com.intellij.util.ui.ColorIcon;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -35,10 +38,11 @@ public class HighlightDisplayLevel {
|
||||
private static final Map<HighlightSeverity, HighlightDisplayLevel> ourMap = new HashMap<HighlightSeverity, HighlightDisplayLevel>();
|
||||
|
||||
public static final HighlightDisplayLevel GENERIC_SERVER_ERROR_OR_WARNING = new HighlightDisplayLevel(HighlightSeverity.GENERIC_SERVER_ERROR_OR_WARNING,
|
||||
createIconByMask(CodeInsightColors.GENERIC_SERVER_ERROR_OR_WARNING));
|
||||
public static final HighlightDisplayLevel ERROR = new HighlightDisplayLevel(HighlightSeverity.ERROR, createIconByMask(CodeInsightColors.ERRORS_ATTRIBUTES));
|
||||
public static final HighlightDisplayLevel WARNING = new HighlightDisplayLevel(HighlightSeverity.WARNING, createIconByMask(CodeInsightColors.WARNINGS_ATTRIBUTES));
|
||||
public static final HighlightDisplayLevel DO_NOT_SHOW = new HighlightDisplayLevel(HighlightSeverity.INFORMATION, createIconByMask(new Color(30, 160, 0)));
|
||||
createIconByKey(CodeInsightColors.GENERIC_SERVER_ERROR_OR_WARNING));
|
||||
public static final HighlightDisplayLevel ERROR = new HighlightDisplayLevel(HighlightSeverity.ERROR, createIconByKey(CodeInsightColors.ERRORS_ATTRIBUTES));
|
||||
public static final HighlightDisplayLevel WARNING = new HighlightDisplayLevel(HighlightSeverity.WARNING, createIconByKey(CodeInsightColors.WARNINGS_ATTRIBUTES));
|
||||
public static final Color GREEN = new JBColor(new Color(30, 160, 0), new Color(30, 160, 0));
|
||||
public static final HighlightDisplayLevel DO_NOT_SHOW = new HighlightDisplayLevel(HighlightSeverity.INFORMATION, createIconByMask(GREEN));
|
||||
/**
|
||||
* use #WEAK_WARNING instead
|
||||
*/
|
||||
@@ -107,19 +111,14 @@ public class HighlightDisplayLevel {
|
||||
}
|
||||
}
|
||||
|
||||
public static class ImageHolder {
|
||||
public static final Image ourErrorMaskImage = ImageLoader.loadFromResource("/general/errorMask.png");
|
||||
}
|
||||
|
||||
private static final int EMPTY_ICON_DIM = 12;
|
||||
|
||||
@NotNull
|
||||
private static Icon createIconByMask(@NotNull TextAttributesKey key) {
|
||||
Icon icon = createIconByMaskFromExtensions(key);
|
||||
if (icon != null) return icon;
|
||||
TextAttributes defaultAttributes = key.getDefaultAttributes();
|
||||
if (defaultAttributes == null) defaultAttributes = TextAttributes.ERASE_MARKER;
|
||||
return createIconByMask(defaultAttributes.getErrorStripeColor());
|
||||
public static Icon createIconByKey(@NotNull TextAttributesKey key) {
|
||||
for (IconCreator creator : Extensions.getExtensions(IconCreator.EXTENSION_POINT_NAME)) {
|
||||
Icon icon = creator.createIcon(key);
|
||||
if (icon != null) return icon;
|
||||
}
|
||||
return new SingleColorIcon(key);
|
||||
}
|
||||
|
||||
public interface IconCreator {
|
||||
@@ -128,35 +127,49 @@ public class HighlightDisplayLevel {
|
||||
Icon createIcon(@NotNull TextAttributesKey key);
|
||||
}
|
||||
|
||||
public static Icon createIconByMaskFromExtensions(@NotNull TextAttributesKey key) {
|
||||
for (IconCreator creator : Extensions.getExtensions(IconCreator.EXTENSION_POINT_NAME)) {
|
||||
Icon icon = creator.createIcon(key);
|
||||
if (icon != null) return icon;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Icon createIconByMask(final Color renderColor) {
|
||||
return new SingleColorIconWithMask(renderColor);
|
||||
return new MyColorIcon(EMPTY_ICON_DIM, renderColor);
|
||||
}
|
||||
|
||||
public static class SingleColorIconWithMask implements Icon {
|
||||
private static class MyColorIcon extends ColorIcon implements ColoredIcon {
|
||||
public MyColorIcon(int size, @NotNull Color color) {
|
||||
super(size, color);
|
||||
}
|
||||
|
||||
private final Color myColor;
|
||||
@Override
|
||||
public Color getColor() {
|
||||
return getIconColor();
|
||||
}
|
||||
}
|
||||
|
||||
public interface ColoredIcon {
|
||||
Color getColor();
|
||||
}
|
||||
|
||||
public static class SingleColorIcon implements Icon, ColoredIcon {
|
||||
private final TextAttributesKey myKey;
|
||||
|
||||
public SingleColorIconWithMask(final Color color) {
|
||||
myColor = color;
|
||||
public SingleColorIcon(final TextAttributesKey key) {
|
||||
myKey = key;
|
||||
}
|
||||
|
||||
public Color getColor() {
|
||||
return myColor;
|
||||
final EditorColorsManager manager = EditorColorsManager.getInstance();
|
||||
if (manager != null) {
|
||||
final EditorColorsScheme globalScheme = manager.getGlobalScheme();
|
||||
return globalScheme.getAttributes(myKey).getErrorStripeColor();
|
||||
}
|
||||
TextAttributes defaultAttributes = myKey.getDefaultAttributes();
|
||||
if (defaultAttributes == null) defaultAttributes = TextAttributes.ERASE_MARKER;
|
||||
return defaultAttributes.getErrorStripeColor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintIcon(final Component c, final Graphics g, final int x, final int y) {
|
||||
final Graphics2D g2 = (Graphics2D)g;
|
||||
g2.drawImage(ImageHolder.ourErrorMaskImage, x, y, myColor, null);
|
||||
g2.setColor(getColor());
|
||||
g2.fillRect(x, y, EMPTY_ICON_DIM, EMPTY_ICON_DIM);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -30,7 +30,7 @@ public class DaemonCodeAnalyzerSettings {
|
||||
public String NO_AUTO_IMPORT_PATTERN = "[a-z].?";
|
||||
public boolean SUPPRESS_WARNINGS = true;
|
||||
public boolean SHOW_METHOD_SEPARATORS = false;
|
||||
public int ERROR_STRIPE_MARK_MIN_HEIGHT = 3;
|
||||
public int ERROR_STRIPE_MARK_MIN_HEIGHT = 2;
|
||||
public boolean SHOW_SMALL_ICONS_IN_GUTTER = true;
|
||||
|
||||
@Transient
|
||||
|
||||
|
Before Width: | Height: | Size: 113 B After Width: | Height: | Size: 104 B |
|
Before Width: | Height: | Size: 113 B After Width: | Height: | Size: 106 B |
|
Before Width: | Height: | Size: 94 B |
|
Before Width: | Height: | Size: 435 B |
|
Before Width: | Height: | Size: 92 B |
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -17,6 +17,7 @@
|
||||
package com.intellij.application.options.editor;
|
||||
|
||||
import com.intellij.codeInsight.daemon.DaemonCodeAnalyzerSettings;
|
||||
import com.intellij.ide.ui.UISettings;
|
||||
import com.intellij.openapi.options.ConfigurationException;
|
||||
import com.intellij.openapi.options.ex.ConfigurableWrapper;
|
||||
import com.intellij.profile.codeInspection.ui.ErrorOptionsProvider;
|
||||
@@ -66,6 +67,7 @@ public class ErrorHighlightingPanel {
|
||||
for (ErrorOptionsProvider optionsProvider : myExtensions) {
|
||||
optionsProvider.apply();
|
||||
}
|
||||
UISettings.getInstance().fireUISettingsChanged();
|
||||
}
|
||||
|
||||
public JPanel getPanel(){
|
||||
|
||||
@@ -39,9 +39,8 @@ import com.intellij.ui.treeStructure.treetable.TreeTable;
|
||||
import com.intellij.ui.treeStructure.treetable.TreeTableModel;
|
||||
import com.intellij.ui.treeStructure.treetable.TreeTableTree;
|
||||
import com.intellij.util.Alarm;
|
||||
import com.intellij.util.NotNullFunction;
|
||||
import com.intellij.util.NullableFunction;
|
||||
import com.intellij.util.containers.*;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.containers.HashSet;
|
||||
import com.intellij.util.ui.TextTransferable;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -57,7 +56,6 @@ import java.awt.*;
|
||||
import java.awt.datatransfer.Transferable;
|
||||
import java.awt.event.*;
|
||||
import java.util.*;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -511,7 +509,7 @@ public class InspectionsConfigTreeTable extends TreeTable {
|
||||
}
|
||||
final Icon icon = state.getLevel().getIcon();
|
||||
final String scopeName = state.getScopeName();
|
||||
if (icon instanceof HighlightDisplayLevel.SingleColorIconWithMask) {
|
||||
if (icon instanceof HighlightDisplayLevel.ColoredIcon) {
|
||||
final SeverityAndOccurrences severityAndOccurrences = myScopeToAverageSeverityMap.get(scopeName);
|
||||
final String inspectionName = state.getTool().getShortName();
|
||||
if (severityAndOccurrences == null) {
|
||||
|
||||
@@ -15,11 +15,10 @@
|
||||
*/
|
||||
package com.intellij.profile.codeInspection.ui.inspectionsTree;
|
||||
|
||||
|
||||
import com.intellij.codeHighlighting.HighlightDisplayLevel;
|
||||
import com.intellij.codeHighlighting.HighlightDisplayLevel.ColoredIcon;
|
||||
import com.intellij.codeInspection.ex.InspectionProfileImpl;
|
||||
import com.intellij.lang.annotation.HighlightSeverity;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.profile.codeInspection.ui.ScopeOrderComparator;
|
||||
import com.intellij.ui.JBColor;
|
||||
|
||||
@@ -32,10 +31,6 @@ import java.util.List;
|
||||
* @author Dmitry Batkovich
|
||||
*/
|
||||
public class MultiScopeSeverityIcon implements Icon {
|
||||
private final static Logger LOG = Logger.getInstance(MultiScopeSeverityIcon.class);
|
||||
|
||||
private final static JBColor MIXED_SEVERITY_COLOR = JBColor.DARK_GRAY;
|
||||
|
||||
private final static int SIZE = 12;
|
||||
|
||||
private final LinkedHashMap<String, HighlightDisplayLevel> myScopeToAverageSeverityMap;
|
||||
@@ -63,6 +58,10 @@ public class MultiScopeSeverityIcon implements Icon {
|
||||
}
|
||||
}
|
||||
|
||||
private static JBColor getMixedSeverityColor() {
|
||||
return JBColor.DARK_GRAY;
|
||||
}
|
||||
|
||||
public String getDefaultScopeName() {
|
||||
return myDefaultScopeName;
|
||||
}
|
||||
@@ -73,21 +72,17 @@ public class MultiScopeSeverityIcon implements Icon {
|
||||
|
||||
@Override
|
||||
public void paintIcon(final Component c, final Graphics g, final int i, final int j) {
|
||||
final int iconWidth = getIconWidth();
|
||||
|
||||
final int partWidth = iconWidth / myScopeToAverageSeverityMap.size();
|
||||
final int partWidth = getIconWidth() / myScopeToAverageSeverityMap.size();
|
||||
|
||||
final Collection<HighlightDisplayLevel> values = myScopeToAverageSeverityMap.values();
|
||||
int idx = 0;
|
||||
for (final HighlightDisplayLevel level : values) {
|
||||
final Icon icon = level.getIcon();
|
||||
g.setColor(icon instanceof HighlightDisplayLevel.SingleColorIconWithMask ?
|
||||
((HighlightDisplayLevel.SingleColorIconWithMask)icon).getColor() : MIXED_SEVERITY_COLOR);
|
||||
g.setColor(icon instanceof ColoredIcon ? ((ColoredIcon)icon).getColor() : getMixedSeverityColor());
|
||||
final int x = i + partWidth * idx;
|
||||
g.fillRect(x, j, partWidth, getIconHeight());
|
||||
idx++;
|
||||
}
|
||||
g.drawImage(HighlightDisplayLevel.ImageHolder.ourErrorMaskImage, i, j, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.codeHighlighting;
|
||||
|
||||
import com.intellij.openapi.editor.colors.EditorColorsManager;
|
||||
import com.intellij.openapi.editor.colors.EditorColorsScheme;
|
||||
import com.intellij.openapi.editor.colors.TextAttributesKey;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
public class DefaultIconCreator implements HighlightDisplayLevel.IconCreator {
|
||||
@Override
|
||||
public Icon createIcon(@NotNull TextAttributesKey key) {
|
||||
final EditorColorsManager manager = EditorColorsManager.getInstance();
|
||||
if (manager != null) {
|
||||
final EditorColorsScheme globalScheme = manager.getGlobalScheme();
|
||||
return HighlightDisplayLevel.createIconByMask(globalScheme.getAttributes(key).getErrorStripeColor());
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -197,7 +197,7 @@ public class JBScrollPane extends JScrollPane {
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean relayoutScrollbars(@NotNull JComponent container, @NotNull ScrollPaneLayout layout, boolean forceRelayout) {
|
||||
private boolean relayoutScrollbars(@NotNull JComponent container, @NotNull ScrollPaneLayout layout, boolean forceRelayout) {
|
||||
JViewport viewport = layout.getViewport();
|
||||
if (viewport == null) return false;
|
||||
|
||||
@@ -262,12 +262,12 @@ public class JBScrollPane extends JScrollPane {
|
||||
return hasOverlayScrollbars;
|
||||
}
|
||||
|
||||
private static boolean shouldExtendViewportUnderScrollbar(@Nullable JScrollBar scrollbar) {
|
||||
private boolean shouldExtendViewportUnderScrollbar(@Nullable JScrollBar scrollbar) {
|
||||
if (scrollbar == null || !scrollbar.isVisible()) return false;
|
||||
return isOverlaidScrollbar(scrollbar);
|
||||
}
|
||||
|
||||
private static boolean isOverlaidScrollbar(@Nullable JScrollBar scrollbar) {
|
||||
protected boolean isOverlaidScrollbar(@Nullable JScrollBar scrollbar) {
|
||||
if (!ButtonlessScrollBarUI.isMacOverlayScrollbarSupported()) return false;
|
||||
|
||||
ScrollBarUI vsbUI = scrollbar == null ? null : scrollbar.getUI();
|
||||
@@ -323,10 +323,10 @@ public class JBScrollPane extends JScrollPane {
|
||||
|
||||
@Override
|
||||
protected void paintComponent(Graphics g) {
|
||||
g.setColor(ButtonlessScrollBarUI.getTrackBackground());
|
||||
g.setColor(ButtonlessScrollBarUI.getTrackBackgroundDefault());
|
||||
g.fillRect(0, 0, getWidth(), getHeight());
|
||||
|
||||
g.setColor(ButtonlessScrollBarUI.getTrackBorderColor());
|
||||
g.setColor(ButtonlessScrollBarUI.getTrackBorderColorDefault());
|
||||
|
||||
int x2 = getWidth() - 1;
|
||||
int y2 = getHeight() - 1;
|
||||
|
||||
@@ -24,7 +24,9 @@ import com.intellij.ui.JBColor;
|
||||
import com.intellij.ui.LightColors;
|
||||
import com.intellij.ui.components.JBScrollPane;
|
||||
import com.intellij.util.Alarm;
|
||||
import com.intellij.util.NotNullProducer;
|
||||
import com.intellij.util.ReflectionUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.ChangeEvent;
|
||||
@@ -41,30 +43,48 @@ import java.lang.reflect.Method;
|
||||
public class ButtonlessScrollBarUI extends BasicScrollBarUI {
|
||||
private static final Logger LOG = Logger.getInstance("#" + ButtonlessScrollBarUI.class.getName());
|
||||
|
||||
public static JBColor getGradientLightColor() {
|
||||
return new JBColor(Gray._251, Gray._95);
|
||||
private JBColor getGradientLightColor() {
|
||||
return jbColor(Gray._251, Gray._95);
|
||||
}
|
||||
|
||||
public static JBColor getGradientDarkColor() {
|
||||
return new JBColor(Gray._215, Gray._80);
|
||||
private JBColor getGradientDarkColor() {
|
||||
return jbColor(Gray._215, Gray._80);
|
||||
}
|
||||
|
||||
private static JBColor getGradientThumbBorderColor() {
|
||||
return new JBColor(Gray._201, Gray._85);
|
||||
private JBColor getGradientThumbBorderColor() {
|
||||
return jbColor(Gray._201, Gray._85);
|
||||
}
|
||||
|
||||
public static JBColor getTrackBackground() {
|
||||
public static JBColor getTrackBackgroundDefault() {
|
||||
return new JBColor(LightColors.SLIGHTLY_GRAY, UIUtil.getListBackground());
|
||||
}
|
||||
|
||||
public static JBColor getTrackBorderColor() {
|
||||
public static JBColor getTrackBorderColorDefault() {
|
||||
return new JBColor(Gray._230, UIUtil.getListBackground());
|
||||
}
|
||||
|
||||
private static final BasicStroke BORDER_STROKE = new BasicStroke();
|
||||
private JBColor getTrackBackground() {
|
||||
return jbColor(LightColors.SLIGHTLY_GRAY, UIUtil.getListBackground());
|
||||
}
|
||||
|
||||
private JBColor getTrackBorderColor() {
|
||||
return jbColor(Gray._230, UIUtil.getListBackground());
|
||||
}
|
||||
|
||||
private static int getAnimationColorShift() {
|
||||
return UIUtil.isUnderDarcula() ? 20 : 40;
|
||||
private static final BasicStroke BORDER_STROKE = new BasicStroke();
|
||||
|
||||
private JBColor jbColor(final Color regular, final Color dark) {
|
||||
return new JBColor(new NotNullProducer<Color>() {
|
||||
@NotNull
|
||||
@Override
|
||||
public Color produce() {
|
||||
return isDark() ? dark : regular;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private int getAnimationColorShift() {
|
||||
return isDark() ? 20 : 40;
|
||||
}
|
||||
|
||||
private final AdjustmentListener myAdjustmentListener;
|
||||
@@ -119,8 +139,8 @@ public class ButtonlessScrollBarUI extends BasicScrollBarUI {
|
||||
if (oldViewportPosition != null) {
|
||||
int scrollH = position.x - oldViewportPosition.x;
|
||||
int scrollV = position.y - oldViewportPosition.y;
|
||||
scrolled = (vertical && scrollH == 0 && scrollV != 0) ||
|
||||
(!vertical && scrollV == 0 && scrollH != 0);
|
||||
scrolled = vertical && scrollH == 0 && scrollV != 0 ||
|
||||
!vertical && scrollV == 0 && scrollH != 0;
|
||||
}
|
||||
oldViewportPosition = position;
|
||||
|
||||
@@ -128,7 +148,7 @@ public class ButtonlessScrollBarUI extends BasicScrollBarUI {
|
||||
if (oldViewportDimension != null) {
|
||||
int resizedH = dimension.width - oldViewportDimension.width;
|
||||
int resizedV = dimension.height - oldViewportDimension.height;
|
||||
resized = (vertical && resizedV != 0) || (!vertical && resizedH != 0);
|
||||
resized = vertical && resizedV != 0 || !vertical && resizedH != 0;
|
||||
}
|
||||
oldViewportDimension = dimension;
|
||||
|
||||
@@ -380,7 +400,6 @@ public class ButtonlessScrollBarUI extends BasicScrollBarUI {
|
||||
return new ButtonlessScrollBarUI();
|
||||
}
|
||||
|
||||
|
||||
public static BasicScrollBarUI createTransparent() {
|
||||
return new ButtonlessScrollBarUI() {
|
||||
@Override
|
||||
@@ -493,7 +512,7 @@ public class ButtonlessScrollBarUI extends BasicScrollBarUI {
|
||||
public void paintNow(int frame, int totalFrames, int cycle) {
|
||||
myThumbFadeColorShift = getAnimationColorShift();
|
||||
if (frame > DELAY_FRAMES) {
|
||||
myThumbFadeColorShift *= 1 - ((double)(frame - DELAY_FRAMES)) / ((double)(totalFrames - DELAY_FRAMES));
|
||||
myThumbFadeColorShift *= 1 - (double)(frame - DELAY_FRAMES) / (double)(totalFrames - DELAY_FRAMES);
|
||||
}
|
||||
|
||||
if (scrollbar != null) {
|
||||
@@ -604,7 +623,6 @@ public class ButtonlessScrollBarUI extends BasicScrollBarUI {
|
||||
return super.contains(c, x, y);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void paintTrack(Graphics g, JComponent c, Rectangle trackBounds) {
|
||||
if (alwaysShowTrack() || myMouseOverScrollbarExpandLevel > 0) {
|
||||
@@ -681,11 +699,20 @@ public class ButtonlessScrollBarUI extends BasicScrollBarUI {
|
||||
RenderingHints oldHints = g2d.getRenderingHints();
|
||||
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
|
||||
|
||||
JBColor baseColor = new JBColor(Gray._0, Gray._128);
|
||||
JBColor baseColor = new JBColor(new NotNullProducer<Color>() {
|
||||
@NotNull
|
||||
@Override
|
||||
public Color produce() {
|
||||
return !isDark() ? Gray._0 : Gray._128;
|
||||
}
|
||||
});
|
||||
|
||||
int arc = Math.min(thumbBounds.width, thumbBounds.height);
|
||||
|
||||
if (alwaysShowTrack()) {
|
||||
g2d.setColor(new Color(baseColor.getRed(), baseColor.getGreen(), baseColor.getBlue(), UIUtil.isUnderDarcula() ? 100 : 40));
|
||||
if (alwaysPaintThumb()) {
|
||||
//noinspection UseJBColor
|
||||
g2d.setColor(new Color(baseColor.getRed(), baseColor.getGreen(), baseColor.getBlue(), isDark() ? 100 : 40));
|
||||
//g2d.fillRoundRect(thumbBounds.x, thumbBounds.y, thumbBounds.width, thumbBounds.height, arc, arc);
|
||||
g2d.drawRoundRect(thumbBounds.x, thumbBounds.y, thumbBounds.width, thumbBounds.height, arc, arc);
|
||||
}
|
||||
|
||||
@@ -693,9 +720,16 @@ public class ButtonlessScrollBarUI extends BasicScrollBarUI {
|
||||
g2d.setColor(adjustColor(baseColor));
|
||||
g2d.fillRoundRect(thumbBounds.x, thumbBounds.y, thumbBounds.width, thumbBounds.height, arc, arc);
|
||||
}
|
||||
|
||||
g2d.setRenderingHints(oldHints);
|
||||
}
|
||||
|
||||
protected boolean isDark() {
|
||||
return UIUtil.isUnderDarcula();
|
||||
}
|
||||
|
||||
protected boolean alwaysPaintThumb() {
|
||||
return alwaysShowTrack();
|
||||
}
|
||||
|
||||
private Rectangle getMacScrollBarBounds(Rectangle baseBounds, boolean thumb) {
|
||||
boolean vertical = isVertical();
|
||||
@@ -782,12 +816,13 @@ public class ButtonlessScrollBarUI extends BasicScrollBarUI {
|
||||
|
||||
protected Color adjustColor(Color c) {
|
||||
if (isMacOverlayScrollbar()) {
|
||||
int alpha = (int)((120 + (myMouseOverScrollbarExpandLevel * 20)) * (1 - myMacScrollbarFadeLevel));
|
||||
int alpha = (int)((120 + myMouseOverScrollbarExpandLevel * 20) * (1 - myMacScrollbarFadeLevel));
|
||||
//noinspection UseJBColor
|
||||
return new Color(c.getRed(), c.getGreen(), c.getBlue(), alpha);
|
||||
}
|
||||
else {
|
||||
if (myThumbFadeColorShift == 0) return c;
|
||||
final int sign = UIUtil.isUnderDarcula() ? -1 : 1;
|
||||
final int sign = isDark() ? -1 : 1;
|
||||
return Gray.get(Math.max(0, Math.min(255, c.getRed() - sign * myThumbFadeColorShift)));
|
||||
}
|
||||
}
|
||||
@@ -806,8 +841,12 @@ public class ButtonlessScrollBarUI extends BasicScrollBarUI {
|
||||
return new EmptyButton();
|
||||
}
|
||||
|
||||
public boolean isMacScrollbarHiddenAndDistractionFreeEnabled() {
|
||||
return myMacScrollbarHidden && Registry.is("editor.distraction.free.mode");
|
||||
protected boolean isMacScrollbarHiddenAndDistractionFreeEnabled() {
|
||||
return myMacScrollbarHidden && isMacOverlayScrollbarSupported() && isDistractionFreeMode();
|
||||
}
|
||||
|
||||
protected static boolean isDistractionFreeMode() {
|
||||
return Registry.is("editor.distraction.free.mode");
|
||||
}
|
||||
|
||||
public void registerRepaintCallback(ScrollbarRepaintCallback callback) {
|
||||
|
||||
@@ -488,6 +488,36 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
|
||||
myEditorComponent = new EditorComponentImpl(this);
|
||||
myScrollPane = new MyScrollPane();
|
||||
myVerticalScrollBar = (MyScrollBar)myScrollPane.getVerticalScrollBar();
|
||||
((MyScrollBar)myScrollPane.getHorizontalScrollBar()).setPersistentUI(new ButtonlessScrollBarUI() {
|
||||
@Override
|
||||
public boolean alwaysShowTrack() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isDark() {
|
||||
return isDarkEnough();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Color adjustColor(Color c) {
|
||||
return isMacOverlayScrollbar() ? super.adjustColor(c) : adjustThumbColor(super.adjustColor(c), isDark());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void paintThumb(Graphics g, JComponent c, Rectangle thumbBounds) {
|
||||
if (!isMacOverlayScrollbar()) {
|
||||
int half = getThickness() / 2;
|
||||
int shift = half - 1;
|
||||
g.translate(0, shift);
|
||||
super.paintThumb(g, c, thumbBounds);
|
||||
g.translate(0, -shift);
|
||||
}
|
||||
else {
|
||||
super.paintThumb(g, c, thumbBounds);
|
||||
}
|
||||
}
|
||||
});
|
||||
myPanel = new JPanel();
|
||||
|
||||
UIUtil.putClientProperty(
|
||||
@@ -550,6 +580,15 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
static Color adjustThumbColor(@NotNull Color base, boolean dark) {
|
||||
return ColorUtil.withAlpha(ColorUtil.shift(base, dark ? 1.1 : 0.9), dark ? 0.85 : 0.7);
|
||||
}
|
||||
|
||||
boolean isDarkEnough() {
|
||||
return ColorUtil.isDark(getBackgroundColor());
|
||||
}
|
||||
|
||||
private static void updateCaretVisualPosition(CaretEvent e) {
|
||||
CaretImpl caretImpl = (CaretImpl)e.getCaret();
|
||||
if (caretImpl != null) {
|
||||
@@ -6752,38 +6791,20 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
|
||||
return new MyScrollBar(Adjustable.VERTICAL);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JScrollBar createHorizontalScrollBar() {
|
||||
return new MyScrollBar(Adjustable.HORIZONTAL);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setupCorners() {
|
||||
super.setupCorners();
|
||||
|
||||
setBorder(new TablessBorder());
|
||||
}
|
||||
|
||||
setCorner(getVerticalScrollbarOrientation() == EditorEx.VERTICAL_SCROLLBAR_LEFT ?
|
||||
LOWER_RIGHT_CORNER :
|
||||
LOWER_LEFT_CORNER, new JPanel() {
|
||||
@Override
|
||||
public void paint(@NotNull Graphics g) {
|
||||
if (UISettings.getInstance().PRESENTATION_MODE) {
|
||||
return;
|
||||
}
|
||||
|
||||
final Rectangle bounds = getBounds();
|
||||
int width = bounds.width;
|
||||
int height = bounds.height;
|
||||
|
||||
g.setColor(ButtonlessScrollBarUI.getTrackBackground());
|
||||
g.fillRect(0, 0, width, height);
|
||||
|
||||
int shortner = myGutterComponent.getFoldingAreaWidth() / 2;
|
||||
|
||||
g.setColor(myGutterComponent.getBackground());
|
||||
g.fillRect(0, 0, width - shortner, height);
|
||||
|
||||
g.setColor(ButtonlessScrollBarUI.getTrackBorderColor());
|
||||
g.drawLine(width - 1 - shortner, 0, width - 1 - shortner, height);
|
||||
g.drawLine(0, 0, width - 1, 0);
|
||||
}
|
||||
});
|
||||
protected boolean isOverlaidScrollbar(@Nullable JScrollBar scrollbar) {
|
||||
ScrollBarUI vsbUI = scrollbar == null ? null : scrollbar.getUI();
|
||||
return vsbUI instanceof ButtonlessScrollBarUI && !((ButtonlessScrollBarUI)vsbUI).alwaysShowTrack();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
*/
|
||||
package com.intellij.openapi.editor.impl;
|
||||
|
||||
import com.intellij.codeInsight.daemon.DaemonCodeAnalyzerSettings;
|
||||
import com.intellij.codeInsight.hint.*;
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.ide.ui.UISettings;
|
||||
import com.intellij.ide.ui.UISettingsListener;
|
||||
import com.intellij.openapi.Disposable;
|
||||
@@ -42,12 +42,10 @@ import com.intellij.openapi.editor.ex.*;
|
||||
import com.intellij.openapi.editor.markup.ErrorStripeRenderer;
|
||||
import com.intellij.openapi.editor.markup.RangeHighlighter;
|
||||
import com.intellij.openapi.fileEditor.impl.EditorWindowHolder;
|
||||
import com.intellij.openapi.ui.GraphicsConfig;
|
||||
import com.intellij.openapi.ui.MessageType;
|
||||
import com.intellij.openapi.ui.popup.Balloon;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.ProperTextRange;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.wm.ToolWindowAnchor;
|
||||
import com.intellij.openapi.wm.ex.ToolWindowManagerEx;
|
||||
@@ -79,12 +77,14 @@ import java.util.List;
|
||||
import java.util.Queue;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import static com.intellij.openapi.editor.ex.util.EditorUtil.isRealFileEditor;
|
||||
|
||||
public class EditorMarkupModelImpl extends MarkupModelImpl implements EditorMarkupModel {
|
||||
private static final TooltipGroup ERROR_STRIPE_TOOLTIP_GROUP = new TooltipGroup("ERROR_STRIPE_TOOLTIP_GROUP", 0);
|
||||
private static final Icon ERRORS_FOUND_ICON = AllIcons.General.ErrorsFound;
|
||||
private static final int ERROR_ICON_WIDTH = ERRORS_FOUND_ICON.getIconWidth();
|
||||
private static final int ERROR_ICON_HEIGHT = ERRORS_FOUND_ICON.getIconHeight();
|
||||
private static final int ERROR_ICON_WIDTH = 12;
|
||||
private static final int ERROR_ICON_HEIGHT = 12;
|
||||
private static final int PREFERRED_WIDTH = ERROR_ICON_WIDTH + 3;
|
||||
public static final int MAX_STRIPE_SIZE = 3;
|
||||
private final EditorImpl myEditor;
|
||||
// null renderer means we should not show traffic light icon
|
||||
private ErrorStripeRenderer myErrorStripeRenderer;
|
||||
@@ -99,7 +99,7 @@ public class EditorMarkupModelImpl extends MarkupModelImpl implements EditorMark
|
||||
|
||||
@NotNull private ErrorStripTooltipRendererProvider myTooltipRendererProvider = new BasicTooltipRendererProvider();
|
||||
|
||||
private int myMinMarkHeight = 3;
|
||||
private int myMinMarkHeight;// height for horizontal, width for vertical stripes
|
||||
private static final int myPreviewLines = 5;// Actually preview has myPreviewLines * 2 + 1 lines (above + below + current one)
|
||||
private static final int myCachePreviewLines = 100;// Actually cache image has myCachePreviewLines * 2 + 1 lines (above + below + current one)
|
||||
private LightweightHint myEditorPreviewHint = null;
|
||||
@@ -111,6 +111,7 @@ public class EditorMarkupModelImpl extends MarkupModelImpl implements EditorMark
|
||||
super(editor.getDocument());
|
||||
myEditor = editor;
|
||||
myEditorFragmentRenderer = new EditorFragmentRenderer();
|
||||
setMinMarkHeight(DaemonCodeAnalyzerSettings.getInstance().ERROR_STRIPE_MARK_MIN_HEIGHT);
|
||||
}
|
||||
|
||||
private int offsetToLine(int offset, Document document) {
|
||||
@@ -424,7 +425,7 @@ public class EditorMarkupModelImpl extends MarkupModelImpl implements EditorMark
|
||||
return myEditor.isMirrored();
|
||||
}
|
||||
|
||||
private static final Dimension STRIPE_BUTTON_PREFERRED_SIZE = new Dimension(ERROR_ICON_WIDTH + 4, ERROR_ICON_HEIGHT + 4);
|
||||
private static final Dimension STRIPE_BUTTON_PREFERRED_SIZE = new Dimension(ERROR_ICON_WIDTH, ERROR_ICON_HEIGHT);
|
||||
|
||||
private class ErrorStripeButton extends JButton {
|
||||
private ErrorStripeButton() {
|
||||
@@ -437,29 +438,15 @@ public class EditorMarkupModelImpl extends MarkupModelImpl implements EditorMark
|
||||
|
||||
final Rectangle bounds = getBounds();
|
||||
final Rectangle errorIconBounds = new Rectangle(0, 0, ERROR_ICON_WIDTH, ERROR_ICON_HEIGHT);
|
||||
errorIconBounds.x = bounds.width / 2 - errorIconBounds.width / 2 + 1;
|
||||
errorIconBounds.y = bounds.height / 2 - errorIconBounds.height / 2;
|
||||
errorIconBounds.x = (bounds.width - errorIconBounds.width) / 2 + 2;
|
||||
errorIconBounds.y = (bounds.height - errorIconBounds.height) / 2 - 1;
|
||||
|
||||
try {
|
||||
if (UISettings.getInstance().PRESENTATION_MODE || ButtonlessScrollBarUI.isMacOverlayScrollbarSupported()) {
|
||||
g.setColor(getEditor().getColorsScheme().getDefaultBackground());
|
||||
g.fillRect(0, 0, bounds.width, bounds.height);
|
||||
g.setColor(getEditor().getColorsScheme().getDefaultBackground());
|
||||
g.fillRect(0, 0, bounds.width, bounds.height);
|
||||
|
||||
if (myErrorStripeRenderer != null) {
|
||||
myErrorStripeRenderer.paint(this, g, errorIconBounds);
|
||||
}
|
||||
} else {
|
||||
|
||||
g.setColor(ButtonlessScrollBarUI.getTrackBackground());
|
||||
g.fillRect(0, 0, bounds.width, bounds.height);
|
||||
|
||||
g.setColor(ButtonlessScrollBarUI.getTrackBorderColor());
|
||||
int borderX = !isMirrored() ? 0 : bounds.width - 1;
|
||||
g.drawLine(borderX, 0, borderX, bounds.height);
|
||||
|
||||
if (myErrorStripeRenderer != null) {
|
||||
myErrorStripeRenderer.paint(this, g, errorIconBounds);
|
||||
}
|
||||
if (myErrorStripeRenderer != null) {
|
||||
myErrorStripeRenderer.paint(this, g, errorIconBounds);
|
||||
}
|
||||
}
|
||||
finally {
|
||||
@@ -484,6 +471,11 @@ public class EditorMarkupModelImpl extends MarkupModelImpl implements EditorMark
|
||||
return myErrorStripeButton;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isMacScrollbarHiddenAndDistractionFreeEnabled() {
|
||||
return super.isMacScrollbarHiddenAndDistractionFreeEnabled() && isRealFileEditor(myEditor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean alwaysShowTrack() {
|
||||
if (scrollbar.getOrientation() == Adjustable.VERTICAL) return true;
|
||||
@@ -528,15 +520,14 @@ public class EditorMarkupModelImpl extends MarkupModelImpl implements EditorMark
|
||||
if (!UISettings.getInstance().SHOW_EDITOR_TOOLTIP) {
|
||||
hideMyEditorPreviewHint();
|
||||
}
|
||||
setMinMarkHeight(DaemonCodeAnalyzerSettings.getInstance().ERROR_STRIPE_MARK_MIN_HEIGHT);
|
||||
repaintTrafficTooltip();
|
||||
repaintTrafficLightIcon();
|
||||
repaintVerticalScrollBar();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void paintThumb(Graphics g, JComponent c, Rectangle thumbBounds) {
|
||||
if (UISettings.getInstance().PRESENTATION_MODE || ButtonlessScrollBarUI.isMacOverlayScrollbarSupported()) {
|
||||
super.paintThumb(g, c, thumbBounds);
|
||||
return;
|
||||
}
|
||||
|
||||
if (isMacOverlayScrollbar()) {
|
||||
if (!isMirrored()) {
|
||||
super.paintThumb(g, c, thumbBounds);
|
||||
@@ -544,17 +535,16 @@ public class EditorMarkupModelImpl extends MarkupModelImpl implements EditorMark
|
||||
else {
|
||||
Graphics2D g2d = (Graphics2D)g;
|
||||
AffineTransform old = g2d.getTransform();
|
||||
|
||||
AffineTransform tx = AffineTransform.getScaleInstance(-1, 1);
|
||||
tx.translate(-c.getWidth(), 0);
|
||||
g2d.transform(tx);
|
||||
g.translate(1, 0);
|
||||
super.paintThumb(g, c, thumbBounds);
|
||||
g2d.setTransform(old);
|
||||
}
|
||||
}
|
||||
else {
|
||||
int shift = isMirrored() ? -9 : 9;
|
||||
int half = getThickness() / 2;
|
||||
int shift = isMirrored() ? -half + 2 : half - 1;
|
||||
g.translate(shift, 0);
|
||||
super.paintThumb(g, c, thumbBounds);
|
||||
g.translate(-shift, 0);
|
||||
@@ -562,25 +552,28 @@ public class EditorMarkupModelImpl extends MarkupModelImpl implements EditorMark
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int adjustThumbWidth(int width) {
|
||||
if (isMacOverlayScrollbar() || UISettings.getInstance().PRESENTATION_MODE) return super.adjustThumbWidth(width);
|
||||
return width - 2;
|
||||
protected boolean isDark() {
|
||||
return myEditor.isDarkEnough();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean alwaysPaintThumb() {
|
||||
if (scrollbar.getOrientation() == Adjustable.VERTICAL) return !(isDistractionFreeMode() && isRealFileEditor(myEditor));
|
||||
return super.alwaysPaintThumb();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getThickness() {
|
||||
if (UISettings.getInstance().PRESENTATION_MODE || ButtonlessScrollBarUI.isMacOverlayScrollbarSupported()) return super.getThickness();
|
||||
return super.getThickness() + (isMacOverlayScrollbar() ? 2 : 7);
|
||||
int fix = isMacOverlayScrollbar() ? -2 : 0;
|
||||
return super.getThickness() + myMinMarkHeight - 1 + fix;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void doPaintTrack(Graphics g, JComponent c, Rectangle bounds) {
|
||||
if (UISettings.getInstance().PRESENTATION_MODE || ButtonlessScrollBarUI.isMacOverlayScrollbarSupported()) {
|
||||
g.setColor(getEditor().getColorsScheme().getDefaultBackground());
|
||||
g.fillRect(bounds.x, bounds.y, bounds.width, bounds.height);
|
||||
//return;
|
||||
if (isMacScrollbarHiddenAndDistractionFreeEnabled()) {
|
||||
paintTrackBasement(g, bounds);
|
||||
return;
|
||||
}
|
||||
if (isMacScrollbarHiddenAndDistractionFreeEnabled()) return;
|
||||
Rectangle clip = g.getClipBounds().intersection(bounds);
|
||||
if (clip.height == 0) return;
|
||||
|
||||
@@ -602,7 +595,7 @@ public class EditorMarkupModelImpl extends MarkupModelImpl implements EditorMark
|
||||
try {
|
||||
myDirtyYPositions = myDirtyYPositions.intersection(docRange);
|
||||
if (myDirtyYPositions == null) myDirtyYPositions = docRange;
|
||||
repaint(imageGraphics, componentBounds.width, ERROR_ICON_WIDTH - 1, myDirtyYPositions);
|
||||
repaint(imageGraphics, componentBounds.width, ERROR_ICON_WIDTH, myDirtyYPositions);
|
||||
myDirtyYPositions = null;
|
||||
}
|
||||
finally {
|
||||
@@ -614,28 +607,13 @@ public class EditorMarkupModelImpl extends MarkupModelImpl implements EditorMark
|
||||
}
|
||||
|
||||
private void paintTrackBasement(Graphics g, Rectangle bounds) {
|
||||
if (UISettings.getInstance().PRESENTATION_MODE || ButtonlessScrollBarUI.isMacOverlayScrollbarSupported()) {
|
||||
g.setColor(EditorColorsManager.getInstance().getGlobalScheme().getDefaultBackground());
|
||||
g.fillRect(bounds.x, bounds.y, bounds.width, bounds.height);
|
||||
return;
|
||||
}
|
||||
|
||||
g.setColor(ButtonlessScrollBarUI.getTrackBackground());
|
||||
g.fillRect(bounds.x, bounds.y, bounds.width, bounds.height + 1);
|
||||
|
||||
g.setColor(ButtonlessScrollBarUI.getTrackBorderColor());
|
||||
int border = isMirrored() ? bounds.x + bounds.width - 1 : bounds.x;
|
||||
g.drawLine(border, bounds.y, border, bounds.y + bounds.height + 1);
|
||||
g.setColor(EditorColorsManager.getInstance().getGlobalScheme().getDefaultBackground());
|
||||
g.fillRect(bounds.x, bounds.y, bounds.width, bounds.height);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Color adjustColor(Color c) {
|
||||
if (isMacOverlayScrollbar()) return super.adjustColor(c);
|
||||
|
||||
if (UIUtil.isUnderDarcula()) {
|
||||
return c;
|
||||
}
|
||||
return ColorUtil.withAlpha(ColorUtil.shift(super.adjustColor(c), 0.9), 0.85);
|
||||
return isMacOverlayScrollbar() ? super.adjustColor(c) : EditorImpl.adjustThumbColor(super.adjustColor(c), isDark());
|
||||
}
|
||||
|
||||
private void repaint(final Graphics g, int gutterWidth, final int stripeWidth, ProperTextRange yrange) {
|
||||
@@ -708,7 +686,7 @@ public class EditorMarkupModelImpl extends MarkupModelImpl implements EditorMark
|
||||
if (yStart[0] != ys) {
|
||||
if (!stripes.isEmpty()) {
|
||||
PositionedStripe top = stripes.get(0);
|
||||
drawSpot(g, width, top.thin, yStart[0], ys, top.color, true, true);
|
||||
drawSpot(g, width, top.thin, yStart[0], ys, top.color);
|
||||
}
|
||||
yStart[0] = ys;
|
||||
}
|
||||
@@ -747,70 +725,32 @@ public class EditorMarkupModelImpl extends MarkupModelImpl implements EditorMark
|
||||
stripes.remove(i);
|
||||
if (i == 0) {
|
||||
// visible
|
||||
drawSpot(g, width, endingStripe.thin, yStart, endingStripe.yEnd, endingStripe.color, true, true);
|
||||
drawSpot(g, width, endingStripe.thin, yStart, endingStripe.yEnd, endingStripe.color);
|
||||
yStart = endingStripe.yEnd;
|
||||
}
|
||||
}
|
||||
return yStart;
|
||||
}
|
||||
|
||||
private void drawSpot(Graphics g,
|
||||
int width,
|
||||
boolean thinErrorStripeMark,
|
||||
int yStart,
|
||||
int yEnd,
|
||||
Color color,
|
||||
boolean drawTopDecoration,
|
||||
boolean drawBottomDecoration) {
|
||||
GraphicsConfig config = GraphicsUtil.setupAAPainting(g);
|
||||
int x = isMirrored() ? 3 : 5;
|
||||
int paintWidth = width;
|
||||
boolean flatStyle = Registry.is("ide.new.markup.markers");
|
||||
private void drawSpot(Graphics g, int width, boolean thinErrorStripeMark, int yStart, int yEnd, Color color) {
|
||||
if (color == null) return;
|
||||
int paintWidth;
|
||||
int x;
|
||||
if (thinErrorStripeMark) {
|
||||
paintWidth /= 2;
|
||||
paintWidth += flatStyle ? -2 : 1;
|
||||
x = isMirrored() ? width + 2 : 0;
|
||||
//noinspection SuspiciousNameCombination
|
||||
paintWidth = myMinMarkHeight;
|
||||
x = isMirrored() ? getThickness() - paintWidth : 0;
|
||||
if (yEnd - yStart < 6) {
|
||||
yStart -= 1;
|
||||
yEnd += yEnd-yStart - 1;
|
||||
yEnd += yEnd - yStart - 1;
|
||||
}
|
||||
}
|
||||
if (color == null) return;
|
||||
Color darker = color;
|
||||
if (!UIUtil.isUnderDarcula()) {
|
||||
float[] hsb = Color.RGBtoHSB(color.getRed(), color.getGreen(), color.getBlue(), null);
|
||||
hsb[2] = Math.min(1f, hsb[2] * 0.85f);
|
||||
//noinspection UseJBColor
|
||||
darker = new Color(Color.HSBtoRGB(hsb[0], hsb[1], hsb[2]));
|
||||
else {
|
||||
x = myMinMarkHeight + 1;
|
||||
paintWidth = width;
|
||||
}
|
||||
|
||||
if (flatStyle) {
|
||||
g.setColor(darker);
|
||||
g.fillRoundRect(x, yStart, paintWidth, yEnd - yStart, 3,3);
|
||||
config.restore();
|
||||
return;
|
||||
}
|
||||
|
||||
g.setColor(color);
|
||||
g.fillRect(x + 1, yStart, paintWidth - 2, yEnd - yStart + 1);
|
||||
|
||||
Color brighter = color.brighter();
|
||||
g.setColor(brighter);
|
||||
//left decoration
|
||||
UIUtil.drawLine(g, x, yStart, x, yEnd/* - 1*/);
|
||||
if (drawTopDecoration) {
|
||||
//top decoration
|
||||
UIUtil.drawLine(g, x + 1, yStart, x + paintWidth - 2, yStart);
|
||||
}
|
||||
|
||||
g.setColor(darker);
|
||||
if (drawBottomDecoration) {
|
||||
// bottom decoration
|
||||
UIUtil.drawLine(g, x + 1, yEnd/* - 1*/, x + paintWidth - 2, yEnd/* - 1*/); // large bottom to let overwrite by hl below
|
||||
}
|
||||
//right decoration
|
||||
UIUtil.drawLine(g, x + paintWidth - 2, yStart, x + paintWidth - 2, yEnd/* - 1*/);
|
||||
config.restore();
|
||||
g.fillRect(x, yStart, paintWidth, yEnd - yStart);
|
||||
}
|
||||
|
||||
// mouse events
|
||||
@@ -881,8 +821,8 @@ public class EditorMarkupModelImpl extends MarkupModelImpl implements EditorMark
|
||||
@Override
|
||||
public void mouseWheelMoved(MouseWheelEvent e) {
|
||||
if (myEditorPreviewHint == null) return;
|
||||
myWheelAccumulator += (e.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL ? e.getUnitsToScroll() * e.getScrollAmount() :
|
||||
e.getWheelRotation() < 0 ? -e.getScrollAmount() : e.getScrollAmount());
|
||||
myWheelAccumulator += e.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL ? e.getUnitsToScroll() * e.getScrollAmount() :
|
||||
e.getWheelRotation() < 0 ? -e.getScrollAmount() : e.getScrollAmount();
|
||||
myRowAdjuster = myWheelAccumulator / myEditor.getLineHeight();
|
||||
showToolTipByMouseMove(e);
|
||||
}
|
||||
@@ -989,8 +929,8 @@ public class EditorMarkupModelImpl extends MarkupModelImpl implements EditorMark
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMinMarkHeight(final int minMarkHeight) {
|
||||
myMinMarkHeight = minMarkHeight;
|
||||
public void setMinMarkHeight(int minMarkHeight) {
|
||||
myMinMarkHeight = Math.min(minMarkHeight, MAX_STRIPE_SIZE);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -243,7 +243,7 @@
|
||||
<option name="BACKGROUND"/>
|
||||
<option name="EFFECT_COLOR" value="ff0000"/>
|
||||
<option name="EFFECT_TYPE" value="2"/>
|
||||
<option name="ERROR_STRIPE_COLOR" value="ff0000" />
|
||||
<option name="ERROR_STRIPE_COLOR" value="CC1B13" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="BLINKING_HIGHLIGHTS_ATTRIBUTES">
|
||||
@@ -286,7 +286,7 @@
|
||||
<option name="BACKGROUND" value="f6ebbc"/>
|
||||
<option name="EFFECT_COLOR"/>
|
||||
<option name="EFFECT_TYPE" value="1"/>
|
||||
<option name="ERROR_STRIPE_COLOR" value="ffff00" />
|
||||
<option name="ERROR_STRIPE_COLOR" value="F7C600" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="GENERIC_SERVER_ERROR_OR_WARNING">
|
||||
@@ -357,7 +357,7 @@
|
||||
<option name="FOREGROUND"/>
|
||||
<option name="BACKGROUND" value="D6D6D6"/>
|
||||
<option name="EFFECT_COLOR"/>
|
||||
<option name="ERROR_STRIPE_COLOR" value="cbcbcb"/>
|
||||
<option name="ERROR_STRIPE_COLOR" value="C8C8C8"/>
|
||||
</value>
|
||||
</option>
|
||||
|
||||
@@ -366,7 +366,7 @@
|
||||
<option name="FOREGROUND"/>
|
||||
<option name="BACKGROUND" value="C8F2C8"/>
|
||||
<option name="EFFECT_COLOR"/>
|
||||
<option name="ERROR_STRIPE_COLOR" value="baeeba"/>
|
||||
<option name="ERROR_STRIPE_COLOR" value="AADEAA"/>
|
||||
</value>
|
||||
</option>
|
||||
|
||||
@@ -375,7 +375,7 @@
|
||||
<option name="FOREGROUND"/>
|
||||
<option name="BACKGROUND" value="CAD9FA"/>
|
||||
<option name="EFFECT_COLOR"/>
|
||||
<option name="ERROR_STRIPE_COLOR" value="bccff9"/>
|
||||
<option name="ERROR_STRIPE_COLOR" value="B8CBF5"/>
|
||||
</value>
|
||||
</option>
|
||||
|
||||
@@ -879,7 +879,7 @@
|
||||
<option name="FONT_TYPE" value="3" />
|
||||
<option name="EFFECT_COLOR" />
|
||||
<option name="EFFECT_TYPE" value="0" />
|
||||
<option name="ERROR_STRIPE_COLOR" value="ff" />
|
||||
<option name="ERROR_STRIPE_COLOR" value="295CFF" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="BOOKMARKS_ATTRIBUTES">
|
||||
|
||||
@@ -806,7 +806,6 @@
|
||||
|
||||
<refactoring.moveDirectoryWithClassesHelper
|
||||
implementation="com.intellij.refactoring.move.moveClassesOrPackages.MoveDirectoryWithClassesHelper$Default" order="last"/>
|
||||
<codeHighlighting.iconCreator implementation="com.intellij.codeHighlighting.DefaultIconCreator"/>
|
||||
|
||||
<defaultHighlightingSettingProvider implementation="com.intellij.codeInsight.daemon.impl.analysis.GeneratedSourcesHighlightingSettingProvider"/>
|
||||
<editorNotificationProvider implementation="com.intellij.ide.GeneratedFileEditingNotificationProvider"/>
|
||||
|
||||
@@ -457,9 +457,6 @@ commonjs.complete.required.filename.with.extension.description=If checked, requi
|
||||
fix.jdk7.alt.shortcuts=true
|
||||
fix.jdk7.alt.shortcuts.description=Allow to use alt for shortcuts on MacOSX with jdk7+
|
||||
|
||||
ide.new.markup.markers=true
|
||||
ide.new.markup.markers.description=New error stripe markers
|
||||
|
||||
spy.js.realtime.evaluation=false
|
||||
spy.js.realtime.evaluation.description=Enables spy-js autocomplete and realtime evaluation
|
||||
|
||||
|
||||
@@ -402,8 +402,6 @@ public class AllIcons {
|
||||
public static final Icon Ellipsis = IconLoader.getIcon("/general/ellipsis.png"); // 9x9
|
||||
public static final Icon Error = IconLoader.getIcon("/general/error.png"); // 16x16
|
||||
public static final Icon ErrorDialog = IconLoader.getIcon("/general/errorDialog.png"); // 32x32
|
||||
public static final Icon ErrorMask = IconLoader.getIcon("/general/errorMask.png"); // 12x12
|
||||
public static final Icon ErrorsFound = IconLoader.getIcon("/general/errorsFound.png"); // 12x12
|
||||
public static final Icon ErrorsInProgress = IconLoader.getIcon("/general/errorsInProgress.png"); // 12x12
|
||||
public static final Icon ExclMark = IconLoader.getIcon("/general/exclMark.png"); // 16x16
|
||||
public static final Icon ExpandAll = IconLoader.getIcon("/general/expandAll.png"); // 11x16
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
*/
|
||||
package com.intellij.spellchecker;
|
||||
|
||||
import com.intellij.codeHighlighting.HighlightDisplayLevel;
|
||||
import com.intellij.codeInsight.daemon.impl.HighlightInfoType;
|
||||
import com.intellij.codeInsight.daemon.impl.SeveritiesProvider;
|
||||
import com.intellij.lang.annotation.HighlightSeverity;
|
||||
@@ -41,7 +42,7 @@ public class SpellCheckerSeveritiesProvider extends SeveritiesProvider {
|
||||
final TextAttributes attributes = new TextAttributes();
|
||||
|
||||
attributes.setEffectType(EffectType.WAVE_UNDERSCORE);
|
||||
attributes.setEffectColor(new Color(0, 128, 0));
|
||||
attributes.setEffectColor(HighlightDisplayLevel.GREEN);
|
||||
|
||||
HighlightInfoType typo = new HighlightInfoType.HighlightInfoTypeImpl(TYPO, TextAttributesKey.createTextAttributesKey("TYPO", attributes));
|
||||
return Collections.singletonList(typo);
|
||||
@@ -49,7 +50,7 @@ public class SpellCheckerSeveritiesProvider extends SeveritiesProvider {
|
||||
|
||||
@Override
|
||||
public Color getTrafficRendererColor(@NotNull TextAttributes textAttributes) {
|
||||
return Color.GREEN;
|
||||
return HighlightDisplayLevel.GREEN;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||