mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-168385 Widen Balloon API for new error selection feature
This commit is contained in:
@@ -39,10 +39,26 @@ import static javax.swing.SwingConstants.WEST;
|
||||
* @author Konstantin Bulenkov
|
||||
*/
|
||||
public class DarculaUIUtil {
|
||||
private static final Color GLOW_COLOR = new JBColor(new Color(31, 121, 212), new Color(96, 175, 255));
|
||||
private static final Color GLOW_COLOR = new JBColor(new Color(31, 121, 212), new Color(96, 175, 255));
|
||||
|
||||
private static final Color BALLOON_BORDER = new JBColor(new Color(0xe0a8a9), new Color(0x73454b));
|
||||
private static final Color BALLOON_BACKGROUND = new JBColor(new Color(0xf5e6e7), new Color(0x593d41));
|
||||
private static final Color ACTIVE_ERROR_COLOR = new JBColor(() -> {
|
||||
if (SystemInfo.isMac && UIUtil.isUnderIntelliJLaF()) {
|
||||
return new Color(0x80ff0f0f, true);
|
||||
} else {
|
||||
return (UIUtil.isUnderDarcula()) ? new Color(0x8b3c3c) : new Color(0xe53e4d);
|
||||
}
|
||||
});
|
||||
|
||||
private static final Color INACTIVE_ERROR_COLOR = new JBColor(() -> {
|
||||
if (SystemInfo.isMac && UIUtil.isUnderIntelliJLaF()) {
|
||||
return new Color(0x80f2aaaa, true);
|
||||
} else {
|
||||
return (UIUtil.isUnderDarcula()) ? new Color(0x725252) : new Color(0xebbcbc);
|
||||
}
|
||||
});
|
||||
|
||||
private static final Color BALLOON_BORDER = new JBColor(new Color(0xe0a8a9), new Color(0x73454b));
|
||||
private static final Color BALLOON_BACKGROUND = new JBColor(new Color(0xf5e6e7), new Color(0x593d41));
|
||||
|
||||
public static void paintFocusRing(Graphics g, Rectangle bounds) {
|
||||
MacUIUtil.paintFocusRing((Graphics2D)g, GLOW_COLOR, bounds);
|
||||
@@ -103,17 +119,14 @@ public class DarculaUIUtil {
|
||||
g.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, oldStrokeControlValue);
|
||||
}
|
||||
|
||||
public static void paintErrorRing(Graphics2D g, int width, int height, boolean hasFocus) {
|
||||
int lw = JBUI.scale(UIManager.getInt("TextField.darcula.error.borderWidth"));
|
||||
Shape shape = SystemInfo.isWindows ? new Rectangle2D.Double(lw, lw, width - lw * 2, height - lw * 2) :
|
||||
new RoundRectangle2D.Double(lw, lw, width - lw * 2, height - lw * 2, lw, lw);
|
||||
Color color = hasFocus ? UIManager.getColor("TextField.darcula.error.active") :
|
||||
UIManager.getColor("TextField.darcula.error.inactive");
|
||||
public static void paintErrorBorder(Graphics2D g, int width, int height, boolean hasFocus) {
|
||||
int lw = SystemInfo.isMac && UIUtil.isUnderIntelliJLaF() ? JBUI.scale(3) : JBUI.scale(2);
|
||||
Shape shape = new RoundRectangle2D.Double(lw, lw, width - lw * 2, height - lw * 2, lw, lw);
|
||||
|
||||
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
|
||||
g.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, MacUIUtil.USE_QUARTZ ? RenderingHints.VALUE_STROKE_PURE : RenderingHints.VALUE_STROKE_NORMALIZE);
|
||||
|
||||
g.setPaint(color);
|
||||
g.setPaint(hasFocus ? ACTIVE_ERROR_COLOR : INACTIVE_ERROR_COLOR);
|
||||
g.setStroke(new OuterStroke(lw));
|
||||
g.draw(shape);
|
||||
}
|
||||
|
||||
@@ -81,9 +81,6 @@ TextField.border=com.intellij.ide.ui.laf.darcula.ui.DarculaTextBorder
|
||||
TextField.darcula.search.icon=/com/intellij/ide/ui/laf/darcula/icons/search.png
|
||||
TextField.darcula.searchWithHistory.icon=/com/intellij/ide/ui/laf/darcula/icons/searchWithHistory.png
|
||||
TextField.darcula.clear.icon=/com/intellij/ide/ui/laf/darcula/icons/clear.png
|
||||
TextField.darcula.error.active=8b3c3c
|
||||
TextField.darcula.error.inactive=725252
|
||||
TextField.darcula.error.borderWidth=2
|
||||
|
||||
PasswordField.background=45494A
|
||||
PasswordFieldUI=com.intellij.ide.ui.laf.darcula.ui.DarculaPasswordFieldUI
|
||||
|
||||
+4
-4
@@ -62,14 +62,14 @@ public class DarculaTextBorder implements Border, UIResource {
|
||||
try {
|
||||
g2.translate(x, y);
|
||||
|
||||
Object eop = ((JTextComponent)c).getClientProperty("JComponent.error.outline");
|
||||
Object eop = ((JComponent)c).getClientProperty("JComponent.error.outline");
|
||||
if (Registry.is("ide.inplace.errors.outline") && Boolean.parseBoolean(String.valueOf(eop))) {
|
||||
DarculaUIUtil.paintErrorRing(g2, width, height, c.hasFocus());
|
||||
if (Registry.is("ide.inplace.errors.balloon")) {
|
||||
DarculaUIUtil.paintErrorBorder(g2, width, height, c.hasFocus());
|
||||
if (Registry.is("ide.inplace.errors.balloon") && c.hasFocus()) {
|
||||
DarculaUIUtil.showErrorTip((JComponent)c);
|
||||
}
|
||||
} else if (c.hasFocus()) {
|
||||
DarculaUIUtil.paintFocusRing(g2, new Rectangle(JBUI.scale(2), JBUI.scale(2), width - JBUI.scale(4), height - JBUI.scale(4)));
|
||||
DarculaUIUtil.paintFocusRing(g2, new Rectangle(JBUI.scale(1), JBUI.scale(1), width - JBUI.scale(2), height - JBUI.scale(2)));
|
||||
} else {
|
||||
boolean editable = !(c instanceof JTextComponent) || ((JTextComponent)c).isEditable();
|
||||
g2.setColor(getBorderColor(c.isEnabled() && editable));
|
||||
|
||||
+2
-4
@@ -24,7 +24,6 @@ import com.intellij.ui.Gray;
|
||||
import com.intellij.util.ui.JBUI;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.text.JTextComponent;
|
||||
import java.awt.*;
|
||||
|
||||
/**
|
||||
@@ -49,13 +48,12 @@ public class MacIntelliJTextBorder extends DarculaTextBorder {
|
||||
Graphics2D g = (Graphics2D)g2d;
|
||||
//todo[kb]: make a better solution
|
||||
if (c.getParent() instanceof JComboBox) return;
|
||||
Object eop = ((JTextComponent)c).getClientProperty("JComponent.error.outline");
|
||||
Object eop = ((JComponent)c).getClientProperty("JComponent.error.outline");
|
||||
if (Registry.is("ide.inplace.errors.outline") && Boolean.parseBoolean(String.valueOf(eop))) {
|
||||
Graphics2D g2 = (Graphics2D)g.create();
|
||||
try {
|
||||
g2.translate(x, y);
|
||||
DarculaUIUtil.paintErrorRing(g2, width, height, c.hasFocus());
|
||||
g2.translate(-x, -y);
|
||||
DarculaUIUtil.paintErrorBorder(g2, width, height, c.hasFocus());
|
||||
} finally {
|
||||
g2.dispose();
|
||||
}
|
||||
|
||||
@@ -61,9 +61,6 @@ TextField.border=com.intellij.ide.ui.laf.darcula.ui.DarculaTextBorder
|
||||
TextField.darcula.search.icon=/com/intellij/ide/ui/laf/icons/search.png
|
||||
TextField.darcula.searchWithHistory.icon=/com/intellij/ide/ui/laf/icons/searchWithHistory.png
|
||||
TextField.darcula.clear.icon=/com/intellij/ide/ui/laf/icons/clear.png
|
||||
TextField.darcula.error.active=e53e4d
|
||||
TextField.darcula.error.inactive=ebbcbc
|
||||
TextField.darcula.error.borderWidth=2
|
||||
|
||||
TextArea.selectionForeground=ffffff
|
||||
TextArea.background=ffffff
|
||||
|
||||
@@ -45,7 +45,3 @@ TabbedPane.selectedTabTitlePressedColor=dcdcdc
|
||||
TabbedPane.selectedTabTitleNormalColor=dcdcdc
|
||||
|
||||
TableHeader.cellBorder=2,2,2,2
|
||||
|
||||
TextField.darcula.error.active=ff0f0fff
|
||||
TextField.darcula.error.inactive=f2aaaaff
|
||||
TextField.darcula.error.borderWidth=3
|
||||
|
||||
Reference in New Issue
Block a user