IDEA-140566 Allow to specify anti-aliasing options in IDE more specifically

This commit is contained in:
Denis Fokin
2015-05-21 13:43:36 +03:00
parent 5d1a382b35
commit 8043a12aa5
46 changed files with 325 additions and 145 deletions
@@ -0,0 +1,80 @@
/*
* Copyright 2000-2015 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.ide.ui;
import java.awt.*;
public enum LCDRenderingScope {
IDE,
EXCLUDING_EDITOR,
OFF;
public static LCDRenderingScope getWithLongestName() {
return IDE;
}
public static Object getKeyForCurrentScope(boolean inEditor) {
Object renderingHint = RenderingHints.VALUE_TEXT_ANTIALIAS_OFF;
UISettings uiSettings = UISettings.getInstance();
if (uiSettings != null && uiSettings.ANTIALIASING_IN_IDE) {
switch (uiSettings.LCD_RENDERING_SCOPE) {
case IDE:
renderingHint = RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB;
break;
case EXCLUDING_EDITOR:
if (!inEditor) {
renderingHint = RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB;
break;
}
case OFF:
renderingHint = RenderingHints.VALUE_TEXT_ANTIALIAS_ON;
break;
}
}
return renderingHint;
}
@Override
public String toString() {
String description ;
switch (this) {
case IDE:
description = "LCD Rendering in IDE and Editor";
break;
case EXCLUDING_EDITOR:
description = "LCD Rendering in IDE";
break;
case OFF:
description = "Without LCD rendering";
break;
default:
description = "LCD Rendering in IDE";
}
return description;
}
public static boolean shouldRenderEditor(LCDRenderingScope scope) {
if (!UISettings.getInstance().ANTIALIASING_IN_IDE) return false;
switch (scope) {
case IDE:
return true;
default:
return false;
}
}
}
@@ -95,7 +95,10 @@ public class UISettings extends SimpleModificationTracker implements PersistentS
public boolean CLOSE_NON_MODIFIED_FILES_FIRST = false;
public boolean ACTIVATE_MRU_EDITOR_ON_CLOSE = false;
public boolean ACTIVATE_RIGHT_EDITOR_ON_CLOSE = false;
@Deprecated
public boolean ANTIALIASING_IN_EDITOR = true;
public boolean ANTIALIASING_IN_IDE = ANTIALIASING_IN_EDITOR;
public LCDRenderingScope LCD_RENDERING_SCOPE = LCDRenderingScope.IDE;
public boolean USE_LCD_RENDERING_IN_EDITOR = true;
public boolean MOVE_MOUSE_ON_DEFAULT_BUTTON = false;
public boolean ENABLE_ALPHA_MODE = false;
@@ -254,47 +257,31 @@ public class UISettings extends SimpleModificationTracker implements PersistentS
fireUISettingsChanged();
}
private static final boolean DEFAULT_ALIASING =
SystemProperties.getBooleanProperty("idea.use.default.antialiasing.in.editor", false);
private static final boolean FORCE_USE_FRACTIONAL_METRICS =
public static final boolean FORCE_USE_FRACTIONAL_METRICS =
SystemProperties.getBooleanProperty("idea.force.use.fractional.metrics", false);
public static void setupFractionalMetrics(final Graphics2D g2d) {
if (FORCE_USE_FRACTIONAL_METRICS) {
g2d.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON);
}
}
/* This method must not be used for set up antialiasing for editor components
*/
public static void setupAntialiasing(final Graphics g) {
if (DEFAULT_ALIASING) return;
Graphics2D g2d = (Graphics2D)g;
UISettings uiSettings = getInstance();
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
if (!isRemoteDesktopConnected() && UIUtil.isRetina()) {
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
} else {
Toolkit tk = Toolkit.getDefaultToolkit();
//noinspection HardCodedStringLiteral
Map map = (Map)tk.getDesktopProperty("awt.font.desktophints");
if (map != null) {
if (isRemoteDesktopConnected()) {
g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_DEFAULT);
}
else {
g2d.addRenderingHints(map);
}
}
if (FORCE_USE_FRACTIONAL_METRICS) {
g2d.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON);
}
}
if (uiSettings != null && uiSettings.ANTIALIASING_IN_EDITOR) {
g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, uiSettings.USE_LCD_RENDERING_IN_EDITOR ?
RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB :
RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
if (uiSettings != null) {
g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, LCDRenderingScope.getKeyForCurrentScope(false));
} else {
g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);
}
setupFractionalMetrics(g2d);
}
/**
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.application.options.editor.EditorAppearanceConfigurable">
<grid id="27dc6" binding="myRootPanel" layout-manager="GridLayoutManager" row-count="16" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="0">
<grid id="27dc6" binding="myRootPanel" layout-manager="GridLayoutManager" row-count="14" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="0">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<xy x="20" y="20" width="500" height="451"/>
@@ -10,12 +10,12 @@
<children>
<vspacer id="f3f11">
<constraints>
<grid row="15" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
<grid row="13" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
</vspacer>
<component id="2eb36" class="javax.swing.JCheckBox" binding="myCbBlockCursor">
<constraints>
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="messages/ApplicationBundle" key="checkbox.use.block.caret"/>
@@ -23,7 +23,7 @@
</component>
<component id="357c7" class="javax.swing.JCheckBox" binding="myCbRightMargin">
<constraints>
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<selected value="false"/>
@@ -32,7 +32,7 @@
</component>
<component id="6a414" class="javax.swing.JCheckBox" binding="myCbShowLineNumbers">
<constraints>
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="messages/ApplicationBundle" key="checkbox.show.line.numbers"/>
@@ -40,7 +40,7 @@
</component>
<component id="2ee6" class="javax.swing.JCheckBox" binding="myCbShowWhitespaces">
<constraints>
<grid row="7" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="messages/ApplicationBundle" key="checkbox.show.whitespaces"/>
@@ -48,7 +48,7 @@
</component>
<component id="c1be5" class="javax.swing.JCheckBox" binding="myLeadingWhitespacesCheckBox">
<constraints>
<grid row="8" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="2" use-parent-layout="false"/>
<grid row="6" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="2" use-parent-layout="false"/>
</constraints>
<properties>
<enabled value="false"/>
@@ -58,7 +58,7 @@
</component>
<component id="2cb48" class="javax.swing.JCheckBox" binding="myInnerWhitespacesCheckBox">
<constraints>
<grid row="9" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="2" use-parent-layout="false"/>
<grid row="7" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="2" use-parent-layout="false"/>
</constraints>
<properties>
<enabled value="false"/>
@@ -68,7 +68,7 @@
</component>
<component id="e4e67" class="javax.swing.JCheckBox" binding="myTrailingWhitespacesCheckBox">
<constraints>
<grid row="10" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="2" use-parent-layout="false"/>
<grid row="8" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="2" use-parent-layout="false"/>
</constraints>
<properties>
<enabled value="false"/>
@@ -78,7 +78,7 @@
</component>
<component id="d097a" class="javax.swing.JCheckBox" binding="myShowVerticalIndentGuidesCheckBox" default-binding="true">
<constraints>
<grid row="11" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="9" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Show vertical indent guides"/>
@@ -86,7 +86,7 @@
</component>
<grid id="7b00c" binding="myAddonPanel" layout-manager="GridBagLayout">
<constraints>
<grid row="14" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="8" fill="2" indent="0" use-parent-layout="false"/>
<grid row="12" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="8" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
@@ -94,23 +94,15 @@
</grid>
<component id="4c9d9" class="javax.swing.JCheckBox" binding="myCbShowMethodSeparators">
<constraints>
<grid row="6" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="messages/ApplicationBundle" key="checkbox.show.method.separators"/>
</properties>
</component>
<component id="6ed9e" class="javax.swing.JCheckBox" binding="myAntialiasingInEditorCheckBox">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="messages/IdeBundle" key="checkbox.use.antialiased.font.in.editor"/>
</properties>
</component>
<component id="f1b45" class="javax.swing.JCheckBox" binding="myCbShowIconsInGutter">
<constraints>
<grid row="12" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="10" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="messages/ApplicationBundle" key="checkbox.show.small.icons.in.gutter"/>
@@ -119,7 +111,7 @@
<grid id="47613" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
@@ -148,20 +140,12 @@
</grid>
<component id="b7193" class="javax.swing.JCheckBox" binding="myShowCodeLensInEditorCheckBox">
<constraints>
<grid row="13" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="11" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="messages/IdeBundle" key="checkbox.show.editor.preview.popup"/>
</properties>
</component>
<component id="11cb4" class="javax.swing.JCheckBox" binding="myUseLCDRendering">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="2" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="messages/IdeBundle" key="checkbox.use.lcd.rendered.font.in.editor"/>
</properties>
</component>
</children>
</grid>
</form>
@@ -60,19 +60,19 @@ public class EditorAppearanceConfigurable extends CompositeConfigurable<UnnamedC
private JTextField myBlinkIntervalField;
private JPanel myAddonPanel;
private JCheckBox myCbShowMethodSeparators;
private JCheckBox myAntialiasingInEditorCheckBox;
//private JCheckBox myAntialiasingInEditorCheckBox;
private JCheckBox myShowCodeLensInEditorCheckBox;
private JCheckBox myCbShowIconsInGutter;
private JCheckBox myShowVerticalIndentGuidesCheckBox;
private JCheckBox myUseLCDRendering;
//private JCheckBox myUseLCDRendering;
public EditorAppearanceConfigurable() {
myAntialiasingInEditorCheckBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
myUseLCDRendering.setEnabled(myAntialiasingInEditorCheckBox.isSelected());
}
});
//myAntialiasingInEditorCheckBox.addActionListener(new ActionListener() {
// @Override
// public void actionPerformed(ActionEvent e) {
// myUseLCDRendering.setEnabled(myAntialiasingInEditorCheckBox.isSelected());
// }
//});
myCbBlinkCaret.addActionListener(
new ActionListener() {
@Override
@@ -115,8 +115,8 @@ public class EditorAppearanceConfigurable extends CompositeConfigurable<UnnamedC
myInnerWhitespacesCheckBox.setSelected(editorSettings.isInnerWhitespacesShown());
myTrailingWhitespacesCheckBox.setSelected(editorSettings.isTrailingWhitespacesShown());
myShowVerticalIndentGuidesCheckBox.setSelected(editorSettings.isIndentGuidesShown());
myAntialiasingInEditorCheckBox.setSelected(UISettings.getInstance().ANTIALIASING_IN_EDITOR);
myUseLCDRendering.setSelected(UISettings.getInstance().USE_LCD_RENDERING_IN_EDITOR);
//myAntialiasingInEditorCheckBox.setSelected(UISettings.getInstance().ANTIALIASING_IN_EDITOR);
//myUseLCDRendering.setSelected(UISettings.getInstance().USE_LCD_RENDERING_IN_EDITOR);
myShowCodeLensInEditorCheckBox.setSelected(UISettings.getInstance().SHOW_EDITOR_TOOLTIP);
myCbShowIconsInGutter.setSelected(DaemonCodeAnalyzerSettings.getInstance().SHOW_SMALL_ICONS_IN_GUTTER);
@@ -151,15 +151,15 @@ public class EditorAppearanceConfigurable extends CompositeConfigurable<UnnamedC
UISettings uiSettings = UISettings.getInstance();
boolean uiSettingsModified = false;
if (uiSettings.ANTIALIASING_IN_EDITOR != myAntialiasingInEditorCheckBox.isSelected()) {
uiSettings.ANTIALIASING_IN_EDITOR = myAntialiasingInEditorCheckBox.isSelected();
uiSettingsModified = true;
}
//if (uiSettings.ANTIALIASING_IN_EDITOR != myAntialiasingInEditorCheckBox.isSelected()) {
// uiSettings.ANTIALIASING_IN_EDITOR = myAntialiasingInEditorCheckBox.isSelected();
// uiSettingsModified = true;
//}
if (uiSettings.USE_LCD_RENDERING_IN_EDITOR != myUseLCDRendering.isSelected()) {
uiSettings.USE_LCD_RENDERING_IN_EDITOR = myUseLCDRendering.isSelected();
uiSettingsModified = true;
}
//if (uiSettings.USE_LCD_RENDERING_IN_EDITOR != myUseLCDRendering.isSelected()) {
// uiSettings.USE_LCD_RENDERING_IN_EDITOR = myUseLCDRendering.isSelected();
// uiSettingsModified = true;
//}
if (uiSettings.SHOW_EDITOR_TOOLTIP != myShowCodeLensInEditorCheckBox.isSelected()) {
uiSettings.SHOW_EDITOR_TOOLTIP = myShowCodeLensInEditorCheckBox.isSelected();
@@ -194,8 +194,8 @@ public class EditorAppearanceConfigurable extends CompositeConfigurable<UnnamedC
isModified |= isModified(myShowVerticalIndentGuidesCheckBox, editorSettings.isIndentGuidesShown());
isModified |= isModified(myCbShowMethodSeparators, DaemonCodeAnalyzerSettings.getInstance().SHOW_METHOD_SEPARATORS);
isModified |= isModified(myCbShowIconsInGutter, DaemonCodeAnalyzerSettings.getInstance().SHOW_SMALL_ICONS_IN_GUTTER);
isModified |= myAntialiasingInEditorCheckBox.isSelected() != UISettings.getInstance().ANTIALIASING_IN_EDITOR;
isModified |= myUseLCDRendering.isSelected() != UISettings.getInstance().USE_LCD_RENDERING_IN_EDITOR;
//isModified |= myAntialiasingInEditorCheckBox.isSelected() != UISettings.getInstance().ANTIALIASING_IN_EDITOR;
//isModified |= myUseLCDRendering.isSelected() != UISettings.getInstance().USE_LCD_RENDERING_IN_EDITOR;
isModified |= myShowCodeLensInEditorCheckBox.isSelected() != UISettings.getInstance().SHOW_EDITOR_TOOLTIP;
return isModified;
@@ -15,12 +15,14 @@
*/
package com.intellij.internal;
import com.intellij.ide.ui.UISettings;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.DumbAwareAction;
import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.ui.JBColor;
import com.intellij.ui.ScreenUtil;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NotNull;
import java.awt.*;
@@ -212,7 +214,7 @@ public class DumpScreenConfigurationAction extends DumbAwareAction {
g = g.create();
if (g instanceof Graphics2D) {
Graphics2D g2d = (Graphics2D)g;
g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
UISettings.setupAntialiasing(g);
}
for (int i = 0; i < myScreenList.size(); i++) {
ScreenInfo info = myScreenList.get(i);
@@ -17,6 +17,7 @@ package com.intellij.openapi.actionSystem.ex;
import com.intellij.icons.AllIcons;
import com.intellij.ide.DataManager;
import com.intellij.ide.ui.UISettings;
import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ModalityState;
@@ -391,8 +392,7 @@ public abstract class ComboBoxAction extends AnAction implements CustomComponent
@Override
public void paint(Graphics g) {
GraphicsUtil.setupAntialiasing(g);
GraphicsUtil.setupAAPainting(g);
UISettings.setupAntialiasing(g);
final Dimension size = getSize();
final boolean isEmpty = getIcon() == null && StringUtil.isEmpty(getText());
@@ -15,6 +15,7 @@
*/
package com.intellij.openapi.ui;
import com.intellij.ide.ui.UISettings;
import com.intellij.util.ArrayUtil;
import com.intellij.util.ui.UIUtil;
@@ -323,7 +324,7 @@ public class MultiLineLabelUI extends BasicLabelUI {
}
protected void drawString(Graphics g, String s, int accChar, int textX, int textY) {
UIUtil.applyRenderingHints(g);
UISettings.setupAntialiasing(g);
if (s.indexOf('\n') == -1)
BasicGraphicsUtils.drawString(g, s, accChar, textX, textY);
else {
@@ -16,6 +16,7 @@
package com.intellij.ui;
import com.intellij.ide.ui.UISettings;
import com.intellij.openapi.editor.markup.EffectType;
import com.intellij.openapi.editor.markup.TextAttributes;
import com.intellij.util.ui.UIUtil;
@@ -342,7 +343,7 @@ public class HighlightableComponent extends JComponent {
}
protected void applyRenderingHints(Graphics g) {
UIUtil.applyRenderingHints(g);
UISettings.setupAntialiasing(g);
}
private int getTextOffset() {
@@ -15,6 +15,7 @@
*/
package com.intellij.ui;
import com.intellij.ide.ui.UISettings;
import com.intellij.util.ui.UIUtil;
import javax.swing.*;
@@ -101,7 +102,7 @@ public class SeparatorWithText extends JComponent {
}
g.drawLine(textR.x + textR.width + getHgap(), lineY, getWidth() - 1, lineY);
}
UIUtil.applyRenderingHints(g);
UISettings.setupAntialiasing(g);
g.setColor(GroupedElementsRenderer.POPUP_SEPARATOR_TEXT_FOREGROUND);
g.drawString(s, textR.x, textR.y + g.getFontMetrics().getAscent());
}
@@ -16,6 +16,7 @@
package com.intellij.ui;
import com.intellij.ide.BrowserUtil;
import com.intellij.ide.ui.UISettings;
import com.intellij.openapi.application.Application;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
@@ -737,7 +738,7 @@ public class SimpleColoredComponent extends JComponent implements Accessible, Co
final List<Object[]> searchMatches = new ArrayList<Object[]>();
UIUtil.applyRenderingHints(g);
UISettings.setupAntialiasing(g);
applyAdditionalHints(g);
final Font ownFont = getFont();
if (ownFont != null) {
@@ -156,9 +156,7 @@ public class TabLabel extends JPanel {
@Override
protected void applyAdditionalHints(@NotNull Graphics2D g) {
if (!SystemInfo.isJavaVersionAtLeast("1.7") && g.getComposite() instanceof AlphaComposite && (((AlphaComposite)g.getComposite()).getAlpha() < 1)) {
g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_GASP);
}
UISettings.setupAntialiasing(g);
}
};
label.setOpaque(false);
@@ -16,6 +16,7 @@
package com.intellij.ui.tabs.impl.singleRow;
import com.intellij.icons.AllIcons;
import com.intellij.ide.ui.UISettings;
import com.intellij.ui.ColorUtil;
import com.intellij.ui.JBColor;
import com.intellij.util.ui.GraphicsUtil;
@@ -46,7 +47,7 @@ public abstract class MoreTabsIcon {
AllIcons.General.MoreTabs.paintIcon(c, graphics, iconX, iconY);
Graphics g = graphics.create();
try {
GraphicsUtil.setupAntialiasing(g, true, true);
UISettings.setupAntialiasing(g);
UIUtil.drawStringWithHighlighting(g, String.valueOf(myCounter),
iconX + AllIcons.General.MoreTabs.getIconWidth() + 2,
iconY + AllIcons.General.MoreTabs.getIconHeight() - 5,
@@ -16,6 +16,7 @@
package com.intellij.ui.treeStructure;
import com.intellij.Patches;
import com.intellij.ide.ui.UISettings;
import com.intellij.ide.util.treeView.*;
import com.intellij.openapi.ui.GraphicsConfig;
import com.intellij.openapi.ui.Queryable;
@@ -25,6 +25,7 @@ import com.intellij.openapi.editor.colors.EditorColors;
import com.intellij.openapi.editor.colors.EditorColorsScheme;
import com.intellij.openapi.editor.ex.EditorEx;
import com.intellij.openapi.editor.ex.FoldingModelEx;
import com.intellij.openapi.editor.ex.util.EditorUIUtil;
import com.intellij.openapi.util.TextRange;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.ui.HintHint;
@@ -78,7 +79,7 @@ public class EditorFragmentComponent extends JPanel {
final BufferedImage textImage = UIUtil.createImage(textImageWidth, textImageHeight, BufferedImage.TYPE_INT_RGB);
Graphics textGraphics = textImage.getGraphics();
UISettings.setupAntialiasing(textGraphics);
EditorUIUtil.setupAntialiasing(textGraphics);
final JComponent rowHeader;
final BufferedImage markersImage;
@@ -90,7 +91,7 @@ public class EditorFragmentComponent extends JPanel {
markersImage = UIUtil.createImage(markersImageWidth, textImageHeight, BufferedImage.TYPE_INT_RGB);
Graphics markerGraphics = markersImage.getGraphics();
UISettings.setupAntialiasing(markerGraphics);
EditorUIUtil.setupAntialiasing(markerGraphics);
markerGraphics.translate(0, -y1);
markerGraphics.setClip(0, y1, rowHeader.getWidth(), textImageHeight);
@@ -17,6 +17,7 @@ package com.intellij.ide.actions;
import com.intellij.ide.BrowserUtil;
import com.intellij.ide.IdeBundle;
import com.intellij.ide.ui.UISettings;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.CustomShortcutSet;
import com.intellij.openapi.application.ApplicationInfo;
@@ -213,7 +214,7 @@ public class AboutPopup {
super.paintChildren(g);
Graphics2D g2 = (Graphics2D)g;
UIUtil.applyRenderingHints(g);
UISettings.setupAntialiasing(g);
Font labelFont = JBUI.Fonts.label();
if (SystemInfo.isWindows) {
@@ -34,6 +34,8 @@ import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.Dictionary;
import java.util.Hashtable;
@@ -70,6 +72,34 @@ public class AppearanceConfigurable extends BaseConfigurable implements Searchab
myComponent.myLafComboBox.setModel(new DefaultComboBoxModel(LafManager.getInstance().getInstalledLookAndFeels()));
myComponent.myLafComboBox.setRenderer(new LafComboBoxRenderer());
myComponent.myAntialiasingCheckBox.setSelected(UISettings.getInstance().ANTIALIASING_IN_IDE);
myComponent.myLCDRenderingScopeCombo.setEnabled(UISettings.getInstance().ANTIALIASING_IN_IDE);
myComponent.myAntialiasingCheckBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
myComponent.myLCDRenderingScopeCombo.setEnabled(myComponent.myAntialiasingCheckBox.isSelected());
}
});
myComponent.myLCDRenderingScopeCombo.setModel(new DefaultComboBoxModel(LCDRenderingScope.values()));
myComponent.myLCDRenderingScopeCombo.setSelectedItem(UISettings.getInstance().LCD_RENDERING_SCOPE);
myComponent.myLCDRenderingScopeCombo.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
if (e.getStateChange() == ItemEvent.SELECTED) {
myComponent.myLCDRenderingScopeCombo.setPrototypeDisplayValue(LCDRenderingScope.getWithLongestName());
Object item = e.getItem();
// it must be
if (item instanceof LCDRenderingScope) {
UISettings.getInstance().LCD_RENDERING_SCOPE = (LCDRenderingScope)item;
}
myComponent.myLCDRenderingScopeCombo.revalidate();
}
}
});
Dictionary<Integer, JComponent> delayDictionary = new Hashtable<Integer, JComponent>();
delayDictionary.put(new Integer(0), new JLabel("0"));
delayDictionary.put(new Integer(1200), new JLabel("1200"));
@@ -135,6 +165,16 @@ public class AppearanceConfigurable extends BaseConfigurable implements Searchab
shouldUpdateUI = true;
}
if (myComponent.myAntialiasingCheckBox.isSelected() != settings.ANTIALIASING_IN_IDE) {
settings.ANTIALIASING_IN_IDE = myComponent.myAntialiasingCheckBox.isSelected();
shouldUpdateUI = true;
}
if (myComponent.myLCDRenderingScopeCombo.getSelectedItem().equals(settings.LCD_RENDERING_SCOPE)) {
settings.LCD_RENDERING_SCOPE = (LCDRenderingScope)myComponent.myLCDRenderingScopeCombo.getSelectedItem();
shouldUpdateUI = true;
}
settings.ANIMATE_WINDOWS = myComponent.myAnimateWindowsCheckBox.isSelected();
boolean update = settings.SHOW_TOOL_WINDOW_NUMBERS != myComponent.myWindowShortcutsCheckBox.isSelected();
settings.SHOW_TOOL_WINDOW_NUMBERS = myComponent.myWindowShortcutsCheckBox.isSelected();
@@ -258,6 +298,8 @@ public class AppearanceConfigurable extends BaseConfigurable implements Searchab
UISettings settings = UISettings.getInstance();
myComponent.myFontCombo.setSelectedItem(settings.FONT_FACE);
myComponent.myAntialiasingCheckBox.setSelected(settings.ANTIALIASING_IN_IDE);
myComponent.myLCDRenderingScopeCombo.setSelectedItem(settings.LCD_RENDERING_SCOPE);
myComponent.myFontSizeCombo.setSelectedItem(Integer.toString(settings.FONT_SIZE));
myComponent.myPresentationModeFontSize.setSelectedItem(Integer.toString(settings.PRESENTATION_MODE_FONT_SIZE));
myComponent.myAnimateWindowsCheckBox.setSelected(settings.ANIMATE_WINDOWS);
@@ -308,6 +350,8 @@ public class AppearanceConfigurable extends BaseConfigurable implements Searchab
boolean isModified = false;
isModified |= !Comparing.equal(myComponent.myFontCombo.getSelectedItem(), settings.FONT_FACE);
isModified |= !Comparing.equal(myComponent.myFontSizeCombo.getEditor().getItem(), Integer.toString(settings.FONT_SIZE));
isModified |= myComponent.myAntialiasingCheckBox.isSelected() != settings.ANTIALIASING_IN_IDE;
isModified |= myComponent.myLCDRenderingScopeCombo.getSelectedItem().equals(settings.LCD_RENDERING_SCOPE);
isModified |= myComponent.myAnimateWindowsCheckBox.isSelected() != settings.ANIMATE_WINDOWS;
isModified |= myComponent.myWindowShortcutsCheckBox.isSelected() != settings.SHOW_TOOL_WINDOW_NUMBERS;
isModified |= myComponent.myShowToolStripesCheckBox.isSelected() == settings.HIDE_TOOL_STRIPES;
@@ -374,6 +418,8 @@ public class AppearanceConfigurable extends BaseConfigurable implements Searchab
private JCheckBox myShowMemoryIndicatorCheckBox;
private JComboBox myLafComboBox;
private JCheckBox myCycleScrollingCheckBox;
private JBCheckBox myAntialiasingCheckBox;
private ComboBox myLCDRenderingScopeCombo;
private JCheckBox myMoveMouseOnDefaultButtonCheckBox;
private JCheckBox myEnableAlphaModeCheckBox;
@@ -16,7 +16,7 @@
<properties/>
<border type="none"/>
<children>
<grid id="d992b" layout-manager="GridLayoutManager" row-count="9" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="d992b" layout-manager="GridLayoutManager" row-count="10" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="1" fill="3" indent="0" use-parent-layout="false"/>
@@ -29,7 +29,7 @@
<children>
<component id="33d7c" class="javax.swing.JCheckBox" binding="myMoveMouseOnDefaultButtonCheckBox">
<constraints>
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="6" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<margin top="2" left="0" bottom="2" right="2"/>
@@ -38,7 +38,7 @@
</component>
<component id="665b2" class="javax.swing.JCheckBox" binding="myCycleScrollingCheckBox">
<constraints>
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<margin top="2" left="0" bottom="2" right="2"/>
@@ -77,7 +77,7 @@
<grid id="d9fb" layout-manager="GridLayoutManager" row-count="1" column-count="4" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="8" fill="2" indent="0" use-parent-layout="false"/>
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="8" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
@@ -129,7 +129,7 @@
<grid id="ce348" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
@@ -147,7 +147,7 @@
</grid>
<component id="a3b32" class="javax.swing.JCheckBox" binding="myHideIconsInQuickNavigation">
<constraints>
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<margin top="2" left="0" bottom="2" right="2"/>
@@ -156,7 +156,7 @@
</component>
<component id="9327f" class="javax.swing.JCheckBox" binding="myHideNavigationPopupsCheckBox">
<constraints>
<grid row="6" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false">
<grid row="7" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false">
<preferred-size width="271" height="29"/>
</grid>
</constraints>
@@ -168,7 +168,7 @@
<grid id="372a6" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="8" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
<grid row="9" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
@@ -194,12 +194,38 @@
</grid>
<component id="2124a" class="javax.swing.JCheckBox" binding="myAltDNDCheckBox">
<constraints>
<grid row="7" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="8" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Drag-n-Drop with ALT pressed only"/>
</properties>
</component>
<grid id="46b20" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="e6a03" class="com.intellij.ui.components.JBCheckBox" binding="myAntialiasingCheckBox">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Antialiasing"/>
</properties>
</component>
<component id="3d30f" class="com.intellij.openapi.ui.ComboBox" binding="myLCDRenderingScopeCombo">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<maximumRowCount value="8"/>
</properties>
</component>
</children>
</grid>
</children>
</grid>
<grid id="26e1c" binding="myTransparencyPanel" layout-manager="GridLayoutManager" row-count="3" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
@@ -204,7 +204,7 @@ public class IdeNotificationArea extends JLabel implements CustomStatusBarWidget
@Override
public void paintIcon(Component c, Graphics g, int x, int y) {
UIUtil.applyRenderingHints(g);
UISettings.setupAntialiasing(g);
Font originalFont = g.getFont();
Color originalColor = g.getColor();
@@ -15,6 +15,7 @@
*/
package com.intellij.openapi.actionSystem.impl;
import com.intellij.ide.ui.UISettings;
import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.actionSystem.ex.ActionButtonLook;
import com.intellij.util.ui.EmptyIcon;
@@ -86,7 +87,7 @@ public class ActionButtonWithText extends ActionButton {
look.paintIconAt(g, this, icon, iconRect.x, iconRect.y);
look.paintBorder(g, this);
UIUtil.applyRenderingHints(g);
UISettings.setupAntialiasing(g);
g.setColor(isButtonEnabled() ? getForeground() : getInactiveTextColor());
SwingUtilities2.drawStringUnderlineCharAt(this, g, text,
getMnemonicCharIndex(text),
@@ -0,0 +1,39 @@
/*
* Copyright 2000-2015 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.openapi.editor.ex.util;
import com.intellij.ide.ui.LCDRenderingScope;
import com.intellij.ide.ui.UISettings;
import java.awt.*;
/**
* @author Denis Fokin
*/
public class EditorUIUtil {
/* This method has to be used for setting up antialiasing and rendering hints in
* editors only.
*/
public static void setupAntialiasing(final Graphics g) {
Graphics2D g2d = (Graphics2D)g;
g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, LCDRenderingScope.getKeyForCurrentScope(true));
UISettings.setupFractionalMetrics(g2d);
}
}
@@ -15,6 +15,7 @@
*/
package com.intellij.openapi.editor.impl;
import com.intellij.ide.ui.LCDRenderingScope;
import com.intellij.ide.ui.UISettings;
import com.intellij.ide.ui.UISettingsListener;
import com.intellij.openapi.application.ApplicationManager;
@@ -26,6 +27,7 @@ import org.intellij.lang.annotations.JdkConstants;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import sun.java2d.pipe.LCDTextRenderer;
import java.awt.*;
import java.util.*;
@@ -31,6 +31,7 @@ import com.intellij.openapi.editor.colors.EditorColorsManager;
import com.intellij.openapi.editor.event.CaretEvent;
import com.intellij.openapi.editor.event.CaretListener;
import com.intellij.openapi.editor.event.DocumentListener;
import com.intellij.openapi.editor.ex.util.EditorUIUtil;
import com.intellij.openapi.editor.ex.util.EditorUtil;
import com.intellij.openapi.ui.Queryable;
import com.intellij.openapi.ui.TypingTarget;
@@ -174,7 +175,7 @@ public class EditorComponentImpl extends JComponent implements Scrollable, DataP
Graphics2D gg = !Boolean.TRUE.equals(EditorTextField.SUPPLEMENTARY_KEY.get(myEditor)) ?
IdeBackgroundUtil.withEditorBackground(g, this) : (Graphics2D)g;
UIUtil.setupComposite(gg);
UISettings.setupAntialiasing(gg);
EditorUIUtil.setupAntialiasing(gg);
myEditor.paint(gg);
}
finally {
@@ -41,6 +41,7 @@ import com.intellij.openapi.editor.colors.EditorColors;
import com.intellij.openapi.editor.colors.EditorFontType;
import com.intellij.openapi.editor.event.EditorMouseEventArea;
import com.intellij.openapi.editor.ex.*;
import com.intellij.openapi.editor.ex.util.EditorUIUtil;
import com.intellij.openapi.editor.ex.util.EditorUtil;
import com.intellij.openapi.editor.markup.*;
import com.intellij.openapi.project.DumbAwareAction;
@@ -204,7 +205,7 @@ class EditorGutterComponentImpl extends EditorGutterComponentEx implements Mouse
g.setTransform(transform);
}
UISettings.setupAntialiasing(g);
EditorUIUtil.setupAntialiasing(g);
Color backgroundColor = getBackground();
paintLineNumbersBackground(g, clip, backgroundColor);
paintAnnotationsBackground(g, clip, backgroundColor);
@@ -38,8 +38,7 @@ public class EditorHeaderComponent extends JPanel {
@Override
public void paint(@NotNull Graphics g) {
Graphics2D g2 = (Graphics2D)g;
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
UISettings.setupAntialiasing(g);
super.paint(g);
}
}
@@ -38,6 +38,7 @@ import com.intellij.openapi.editor.*;
import com.intellij.openapi.editor.actionSystem.DocCommandGroupId;
import com.intellij.openapi.editor.colors.EditorFontType;
import com.intellij.openapi.editor.ex.*;
import com.intellij.openapi.editor.ex.util.EditorUIUtil;
import com.intellij.openapi.editor.markup.ErrorStripeRenderer;
import com.intellij.openapi.editor.markup.RangeHighlighter;
import com.intellij.openapi.fileEditor.impl.EditorWindowHolder;
@@ -1286,7 +1287,7 @@ public class EditorMarkupModelImpl extends MarkupModelImpl implements EditorMark
}
Graphics2D cg = myCacheLevel2.createGraphics();
final AffineTransform t = cg.getTransform();
UISettings.setupAntialiasing(cg);
EditorUIUtil.setupAntialiasing(cg);
int lineShift = -myEditor.getLineHeight() * myCacheStartLine;
AffineTransform translateInstance = AffineTransform.getTranslateInstance(-3, lineShift);
@@ -1310,7 +1311,7 @@ public class EditorMarkupModelImpl extends MarkupModelImpl implements EditorMark
myRelativeY = SwingUtilities.convertPoint(this, 0, 0, myEditor.getScrollPane()).y;
Graphics2D g2d = myCacheLevel1.createGraphics();
final AffineTransform transform = g2d.getTransform();
UISettings.setupAntialiasing(g2d);
EditorUIUtil.setupAntialiasing(g2d);
GraphicsUtil.setupAAPainting(g2d);
g2d.setColor(myEditor.getBackgroundColor());
g2d.fillRect(0, 0, getWidth(), getHeight());
@@ -16,6 +16,7 @@
package com.intellij.openapi.editor.impl;
import com.intellij.ide.ui.UISettings;
import com.intellij.openapi.editor.ex.util.EditorUIUtil;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.util.ui.UIUtil;
@@ -147,7 +148,7 @@ public class FontInfo {
// We need to use antialising-aware font metrics because we've alrady encountered a situation when non-antialiased symbol
// width is not equal to the antialiased one (IDEA-81539).
final Graphics graphics = UIUtil.createImage(1, 1, BufferedImage.TYPE_INT_RGB).getGraphics();
UISettings.setupAntialiasing(graphics);
EditorUIUtil.setupAntialiasing(graphics);
graphics.setFont(myFont);
myFontMetrics = graphics.getFontMetrics();
for (int i = 0; i < 128; i++) {
@@ -23,6 +23,7 @@ import com.intellij.openapi.editor.VisualPosition;
import com.intellij.openapi.editor.colors.EditorColorsScheme;
import com.intellij.openapi.editor.colors.EditorFontType;
import com.intellij.openapi.editor.ex.DocumentEx;
import com.intellij.openapi.editor.ex.util.EditorUIUtil;
import com.intellij.openapi.editor.ex.util.EditorUtil;
import com.intellij.openapi.editor.impl.EditorImpl;
import com.intellij.openapi.editor.markup.TextAttributes;
@@ -288,7 +289,7 @@ public class EditorView implements Disposable {
private static FontRenderContext createFontRenderContext() {
Graphics2D g = (Graphics2D)UIUtil.createImage(1, 1, BufferedImage.TYPE_INT_RGB).getGraphics();
try {
UISettings.setupAntialiasing(g);
EditorUIUtil.setupAntialiasing(g);
return g.getFontRenderContext();
}
finally {
@@ -17,6 +17,7 @@ package com.intellij.openapi.fileEditor.impl;
import com.intellij.ide.actions.ActivateToolWindowAction;
import com.intellij.ide.actions.ShowFilePathAction;
import com.intellij.ide.ui.UISettings;
import com.intellij.openapi.actionSystem.IdeActions;
import com.intellij.openapi.actionSystem.Shortcut;
import com.intellij.openapi.keymap.KeymapManager;
@@ -47,8 +48,7 @@ public class EditorEmptyTextPainter {
public void paintEmptyText(final EditorsSplitters splitters, Graphics g) {
boolean isDarkBackground = UIUtil.isUnderDarcula();
UIUtil.applyRenderingHints(g);
GraphicsUtil.setupAntialiasing(g, true, false);
UISettings.setupAntialiasing(g);
g.setColor(new JBColor(isDarkBackground ? Gray._230 : Gray._80, Gray._160));
g.setFont(JBUI.Fonts.label(isDarkBackground ? 24f : 20f));
@@ -401,8 +401,7 @@ public class PreviewManagerImpl implements PreviewManager, PersistentStateCompon
@Override
public void paint(Graphics g) {
boolean isDarkBackground = UIUtil.isUnderDarcula();
UIUtil.applyRenderingHints(g);
GraphicsUtil.setupAntialiasing(g, true, false);
UISettings.setupAntialiasing(g);
g.setColor(new JBColor(isDarkBackground ? Gray._230 : Gray._80, Gray._160));
g.setFont(JBUI.Fonts.label(isDarkBackground ? 24f : 20f));
@@ -16,6 +16,7 @@
package com.intellij.openapi.ui;
import com.intellij.ide.DataManager;
import com.intellij.ide.ui.UISettings;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.CommonDataKeys;
@@ -471,7 +472,7 @@ public class FrameWrapper implements Disposable, DataProvider {
@Override
public void paint(Graphics g) {
UIUtil.applyRenderingHints(g);
UISettings.setupAntialiasing(g);
super.paint(g);
}
}
@@ -576,7 +577,7 @@ public class FrameWrapper implements Disposable, DataProvider {
@Override
public void paint(Graphics g) {
UIUtil.applyRenderingHints(g);
UISettings.setupAntialiasing(g);
super.paint(g);
}
}
@@ -18,6 +18,7 @@ package com.intellij.openapi.ui.impl;
import com.intellij.ide.DataManager;
import com.intellij.ide.IdeEventQueue;
import com.intellij.ide.impl.TypeSafeDataProviderAdapter;
import com.intellij.ide.ui.UISettings;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.application.Application;
@@ -904,7 +905,7 @@ public class DialogWrapperPeerImpl extends DialogWrapperPeer implements FocusTra
if (!SystemInfo.isMac || UIUtil.isUnderAquaLookAndFeel()) { // avoid rendering problems with non-aqua (alloy) LaFs under mac
// actually, it's a bad idea to globally enable this for dialog graphics since renderers, for example, may not
// inherit graphics so rendering hints won't be applied and trees or lists may render ugly.
UIUtil.applyRenderingHints(g);
UISettings.setupAntialiasing(g);
}
super.paint(g);
@@ -544,7 +544,7 @@ public class GlassPaneDialogWrapperPeer extends DialogWrapperPeer implements Foc
@Override
public void paint(final Graphics g) {
UIUtil.applyRenderingHints(g);
UISettings.setupAntialiasing(g);
super.paint(g);
}
@@ -512,7 +512,7 @@ public class IdeFrameImpl extends JFrame implements IdeFrameEx, DataProvider {
@Override
public void paint(@NotNull Graphics g) {
UIUtil.applyRenderingHints(g);
UISettings.setupAntialiasing(g);
//noinspection Since15
super.paint(g);
}
@@ -15,6 +15,7 @@
*/
package com.intellij.openapi.wm.impl;
import com.intellij.ide.ui.UISettings;
import com.intellij.openapi.wm.ToolWindowAnchor;
import com.intellij.ui.Gray;
import com.intellij.util.ui.JBUI;
@@ -146,6 +147,7 @@ public final class StripeButtonUI extends MetalToggleButtonUI{
// paint text
UISettings.setupAntialiasing(g2);
if(text!=null){
if(model.isEnabled()){
if(model.isArmed()&&model.isPressed()||model.isSelected()){
@@ -404,7 +404,7 @@ public abstract class ToolWindowHeader extends JPanel implements Disposable, UIS
protected void paintChildren(Graphics g) {
Graphics2D graphics = (Graphics2D) g.create();
UIUtil.applyRenderingHints(graphics);
UISettings.setupAntialiasing(g);
super.paintChildren(graphics);
Rectangle r = getBounds();
@@ -17,6 +17,7 @@ package com.intellij.openapi.wm.impl.status;
import com.intellij.icons.AllIcons;
import com.intellij.ide.IdeBundle;
import com.intellij.ide.ui.UISettings;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.progress.TaskInfo;
import com.intellij.openapi.progress.util.ProgressIndicatorBase;
@@ -270,7 +271,7 @@ public class InlineProgressIndicator extends ProgressIndicatorBase implements Di
}
final GraphicsConfig c = GraphicsUtil.setupAAPainting(g);
GraphicsUtil.setupAntialiasing(g, true, true);
UISettings.setupAntialiasing(g);
int arc = 8;
Color bg = getBackground();
@@ -16,6 +16,7 @@
package com.intellij.openapi.wm.impl.status;
import com.intellij.concurrency.JobScheduler;
import com.intellij.ide.ui.UISettings;
import com.intellij.openapi.wm.CustomStatusBarWidget;
import com.intellij.openapi.wm.StatusBar;
import com.intellij.openapi.wm.StatusBarWidget;
@@ -171,7 +172,7 @@ public class MemoryUsagePanel extends JButton implements CustomStatusBarWidget {
final FontMetrics fontMetrics = g.getFontMetrics();
final int infoWidth = fontMetrics.charsWidth(info.toCharArray(), 0, info.length());
final int infoHeight = fontMetrics.getAscent();
UIUtil.applyRenderingHints(g2);
UISettings.setupAntialiasing(g);
g2.setColor(UIUtil.getLabelForeground());
g2.drawString(info, xOffset + (totalBarLength - infoWidth) / 2, yOffset + infoHeight + (barHeight - infoHeight) / 2 - 1);
@@ -16,6 +16,7 @@
package com.intellij.openapi.wm.impl.status;
import com.intellij.icons.AllIcons;
import com.intellij.ide.ui.UISettings;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.ui.Gray;
@@ -84,7 +85,7 @@ public class TextPanel extends JComponent {
final Graphics2D g2 = (Graphics2D)g;
g2.setFont(getFont());
UIUtil.applyRenderingHints(g2);
UISettings.setupAntialiasing(g);
final FontMetrics fm = g2.getFontMetrics();
final int sWidth = fm.stringWidth(s);
@@ -15,6 +15,7 @@
*/
package com.intellij.ui;
import com.intellij.ide.ui.UISettings;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.ui.components.JBScrollPane;
import com.intellij.util.ArrayUtil;
@@ -154,7 +155,7 @@ public abstract class MultilineTreeCellRenderer extends JComponent implements Tr
currBaseLine += myTextInsets.top;
g.setFont(getFont());
g.setColor(fgColor);
UIUtil.applyRenderingHints(g);
UISettings.setupAntialiasing(g);
if (!StringUtil.isEmpty(myPrefix)) {
g.drawString(myPrefix, myTextInsets.left - myPrefixWidth + 1, currBaseLine);
@@ -16,6 +16,7 @@
package com.intellij.ui;
import com.intellij.ide.StartupProgress;
import com.intellij.ide.ui.UISettings;
import com.intellij.openapi.application.ex.ApplicationInfoEx;
import com.intellij.openapi.application.impl.ApplicationInfoImpl;
import com.intellij.openapi.util.IconLoader;
@@ -165,7 +166,7 @@ public class Splash extends JDialog implements StartupProgress {
if (ApplicationInfoImpl.getShadowInstance().showLicenseeInfo()) {
final LicensingFacade provider = LicensingFacade.getInstance();
if (provider != null) {
UIUtil.applyRenderingHints(g);
UISettings.setupAntialiasing(g);
g.setFont(new Font(UIUtil.ARIAL_FONT_NAME, Font.BOLD, JBUI.scale(SystemInfo.isUnix ? 10 : 11)));
g.setColor(textColor);
@@ -16,6 +16,7 @@
*/
package com.intellij.ui.plaf.beg;
import com.intellij.ide.ui.UISettings;
import com.intellij.openapi.actionSystem.impl.ActionMenuItem;
import com.intellij.openapi.keymap.KeymapUtil;
import com.intellij.openapi.util.SystemInfo;
@@ -83,7 +84,7 @@ public class BegMenuItemUI extends BasicMenuItemUI {
}
public void paint(Graphics g, JComponent comp) {
UIUtil.applyRenderingHints(g);
UISettings.setupAntialiasing(g);
JMenuItem jmenuitem = (JMenuItem)comp;
ButtonModel buttonmodel = jmenuitem.getModel();
int mnemonicIndex = jmenuitem.getDisplayedMnemonicIndex();
@@ -15,6 +15,7 @@
*/
package com.intellij.ui.plaf.beg;
import com.intellij.ide.ui.UISettings;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.util.ui.JBUI;
import com.intellij.util.ui.UIUtil;
@@ -71,7 +72,7 @@ public class IdeaMenuUI extends BasicMenuUI{
}
public void paint(Graphics g, JComponent comp) {
UIUtil.applyRenderingHints(g);
UISettings.setupAntialiasing(g);
JMenu jMenu = (JMenu)comp;
ButtonModel buttonmodel = jMenu.getModel();
int mnemonicIndex = jMenu.getDisplayedMnemonicIndex();
@@ -1761,16 +1761,6 @@ public class UIUtil {
return image;
}
public static void applyRenderingHints(final Graphics g) {
Graphics2D g2d = (Graphics2D)g;
Toolkit tk = Toolkit.getDefaultToolkit();
//noinspection HardCodedStringLiteral
Map map = (Map)tk.getDesktopProperty("awt.font.desktophints");
if (map != null) {
g2d.addRenderingHints(map);
}
}
public static BufferedImage createImage(int width, int height, int type) {
if (isRetina()) {
return RetinaImage.create(width, height, type);
@@ -1,5 +1,6 @@
package org.jetbrains.plugins.gradle.util;
import com.intellij.ide.ui.UISettings;
import com.intellij.util.ui.GraphicsUtil;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NotNull;
@@ -31,7 +32,7 @@ public class TextIcon implements Icon {
@Override
public void paintIcon(Component c, Graphics g, int x, int y) {
GraphicsUtil.setupAntialiasing(g, true, false);
UISettings.setupAntialiasing(g);
if (myTextHeight <= 0) {
myTextHeight = g.getFont().createGlyphVector(((Graphics2D)g).getFontRenderContext(), myText).getPixelBounds(null, 0, 0).height;
}
@@ -1,5 +1,6 @@
package com.jetbrains.edu.learning;
import com.intellij.ide.ui.UISettings;
import com.intellij.openapi.actionSystem.ActionManager;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.KeyboardShortcut;
@@ -25,8 +26,8 @@ public class StudyInstructionPainter extends EditorEmptyTextPainter {
@Override
public void paintEmptyText(final EditorsSplitters splitters, Graphics g) {
boolean isDarkBackground = UIUtil.isUnderDarcula();
UIUtil.applyRenderingHints(g);
GraphicsUtil.setupAntialiasing(g, true, false);
UISettings.setupAntialiasing(g);
g.setColor(new JBColor(isDarkBackground ? Gray._230 : Gray._80, Gray._160));
g.setFont(UIUtil.getLabelFont().deriveFont(isDarkBackground ? 24f : 20f));
@@ -15,6 +15,7 @@
*/
package com.intellij.xml.breadcrumbs;
import com.intellij.ide.ui.UISettings;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.SystemInfo;
@@ -756,7 +757,7 @@ public class BreadcrumbsComponent<T extends BreadcrumbsItem> extends JComponent
string = sb.append("...").toString();
}
UIUtil.applyRenderingHints(g2);
UISettings.setupAntialiasing(g2);
g2.drawString(string, offset + ROUND_VALUE, height - fm.getDescent() - 4);
g2.setFont(oldFont);