mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
fix switcher for darcula
This commit is contained in:
@@ -225,7 +225,7 @@ public class Switcher extends AnAction implements DumbAware {
|
||||
@Override
|
||||
protected void paintComponent(Graphics g) {
|
||||
super.paintComponent(g);
|
||||
g.setColor(BORDER_COLOR);
|
||||
g.setColor(UIUtil.isUnderDarcula() ? Gray._68 : BORDER_COLOR);
|
||||
g.drawLine(0, 0, getWidth(), 0);
|
||||
}
|
||||
};
|
||||
@@ -284,7 +284,7 @@ public class Switcher extends AnAction implements DumbAware {
|
||||
if (selected) {
|
||||
return renderer;
|
||||
}
|
||||
final Color bgColor = list == mouseMoveSrc && index == mouseMoveListIndex ? ON_MOUSE_OVER_BG_COLOR : Color.WHITE;
|
||||
final Color bgColor = list == mouseMoveSrc && index == mouseMoveListIndex ? ON_MOUSE_OVER_BG_COLOR : list.getBackground();
|
||||
UIUtil.changeBackGround(renderer, bgColor);
|
||||
return renderer;
|
||||
}
|
||||
@@ -309,7 +309,7 @@ public class Switcher extends AnAction implements DumbAware {
|
||||
g.drawLine(0, 0, 0, getHeight());
|
||||
}
|
||||
};
|
||||
separator.setBackground(Color.WHITE);
|
||||
separator.setBackground(UIUtil.getControlColor());
|
||||
|
||||
int selectionIndex = -1;
|
||||
final FileEditorManagerImpl editorManager = (FileEditorManagerImpl)FileEditorManager.getInstance(project);
|
||||
@@ -961,7 +961,7 @@ public class Switcher extends AnAction implements DumbAware {
|
||||
append(name, SimpleTextAttributes.fromTextAttributes(attributes));
|
||||
|
||||
if (!selected && myPinned && FileEditorManager.getInstance(myProject).isFileOpen(virtualFile)) {
|
||||
setBackground(LightColors.SLIGHTLY_GREEN);
|
||||
setBackground(UIUtil.isUnderDarcula() ? list.getBackground().brighter() : LightColors.SLIGHTLY_GREEN);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-7
@@ -15,11 +15,9 @@
|
||||
*/
|
||||
package com.intellij.ide.actions;
|
||||
|
||||
import com.intellij.openapi.editor.markup.EffectType;
|
||||
import com.intellij.openapi.editor.markup.TextAttributes;
|
||||
import com.intellij.openapi.ui.GraphicsConfig;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.wm.ToolWindow;
|
||||
import com.intellij.openapi.ui.GraphicsConfig;
|
||||
import com.intellij.ui.ColoredListCellRenderer;
|
||||
import com.intellij.ui.SimpleTextAttributes;
|
||||
import com.intellij.ui.SpeedSearchBase;
|
||||
@@ -36,7 +34,6 @@ import java.util.Map;
|
||||
*/
|
||||
class SwitcherToolWindowsListRenderer extends ColoredListCellRenderer {
|
||||
private static final Map<String, Icon> iconCache = new HashMap<String, Icon>();
|
||||
private static final SimpleTextAttributes ID_STYLE = new SimpleTextAttributes(SimpleTextAttributes.STYLE_UNDERLINE, Color.black);
|
||||
private final SpeedSearchBase mySpeedSearch;
|
||||
private final Map<ToolWindow, String> ids;
|
||||
private final Map<ToolWindow, String> shortcuts;
|
||||
@@ -62,12 +59,11 @@ class SwitcherToolWindowsListRenderer extends ColoredListCellRenderer {
|
||||
if (myPinned) {
|
||||
name = ids.get(tw);
|
||||
} else {
|
||||
append(shortcuts.get(tw), ID_STYLE);
|
||||
append(shortcuts.get(tw), new SimpleTextAttributes(SimpleTextAttributes.STYLE_UNDERLINE, null));
|
||||
name = ": " + ids.get(tw);
|
||||
}
|
||||
|
||||
final TextAttributes attributes = new TextAttributes(Color.BLACK, null, null, EffectType.LINE_UNDERSCORE, Font.PLAIN);
|
||||
append(name, SimpleTextAttributes.fromTextAttributes(attributes));
|
||||
append(name);
|
||||
if (mySpeedSearch != null && mySpeedSearch.isPopupActive()) {
|
||||
hide = mySpeedSearch.matchingFragments(ids.get(tw)) == null && !StringUtil.isEmpty(mySpeedSearch.getEnteredPrefix());
|
||||
}
|
||||
|
||||
@@ -15,13 +15,15 @@
|
||||
*/
|
||||
package com.intellij.ide.ui.laf;
|
||||
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.openapi.util.IconLoader;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.ui.ColorUtil;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.plaf.ColorUIResource;
|
||||
import javax.swing.plaf.IconUIResource;
|
||||
import javax.swing.plaf.InsetsUIResource;
|
||||
import javax.swing.plaf.basic.BasicLookAndFeel;
|
||||
import java.awt.*;
|
||||
@@ -38,8 +40,12 @@ final class IdeaDarkLaf extends BasicLookAndFeel {
|
||||
BasicLookAndFeel base;
|
||||
public IdeaDarkLaf() {
|
||||
try {
|
||||
final String name = UIManager.getSystemLookAndFeelClassName();
|
||||
base = (BasicLookAndFeel)Class.forName(name).newInstance();
|
||||
if (SystemInfo.isWindows) {
|
||||
base = new IdeaLaf();
|
||||
} else {
|
||||
final String name = UIManager.getSystemLookAndFeelClassName();
|
||||
base = (BasicLookAndFeel)Class.forName(name).newInstance();
|
||||
}
|
||||
}
|
||||
catch (Exception ignore) {
|
||||
log(ignore);
|
||||
@@ -48,7 +54,7 @@ final class IdeaDarkLaf extends BasicLookAndFeel {
|
||||
|
||||
private void callInit(String method, UIDefaults defaults) {
|
||||
try {
|
||||
final Method superMethod = base.getClass().getDeclaredMethod(method, UIDefaults.class);
|
||||
final Method superMethod = BasicLookAndFeel.class.getDeclaredMethod(method, UIDefaults.class);
|
||||
superMethod.setAccessible(true);
|
||||
superMethod.invoke(base, defaults);
|
||||
}
|
||||
@@ -65,17 +71,11 @@ final class IdeaDarkLaf extends BasicLookAndFeel {
|
||||
@Override
|
||||
public UIDefaults getDefaults() {
|
||||
try {
|
||||
final Method superMethod = base.getClass().getDeclaredMethod("getDefaults");
|
||||
final Method superMethod = BasicLookAndFeel.class.getDeclaredMethod("getDefaults");
|
||||
superMethod.setAccessible(true);
|
||||
final UIDefaults defaults = (UIDefaults)superMethod.invoke(base);
|
||||
LafManagerImpl.initInputMapDefaults(defaults);
|
||||
initIdeaDefaults(defaults);
|
||||
if (SystemInfo.isMac) {
|
||||
defaults.put("Menu.arrowIcon", AllIcons.Mac.Tree_white_right_arrow);
|
||||
defaults.put("MenuItem.acceleratorForeground", new ColorUIResource(255, 255, 255));
|
||||
defaults.put("Separator.foreground", new ColorUIResource(ColorUtil.fromHex("888888")));
|
||||
defaults.put("PopupMenu.background", new ColorUIResource(ColorUtil.fromHex("444444")));
|
||||
}
|
||||
return defaults;
|
||||
}
|
||||
catch (Exception ignore) {
|
||||
@@ -86,7 +86,7 @@ final class IdeaDarkLaf extends BasicLookAndFeel {
|
||||
|
||||
private void call(String method) {
|
||||
try {
|
||||
final Method superMethod = base.getClass().getDeclaredMethod(method);
|
||||
final Method superMethod = BasicLookAndFeel.class.getDeclaredMethod(method);
|
||||
superMethod.setAccessible(true);
|
||||
superMethod.invoke(base);
|
||||
}
|
||||
@@ -101,81 +101,9 @@ final class IdeaDarkLaf extends BasicLookAndFeel {
|
||||
|
||||
@SuppressWarnings({"HardCodedStringLiteral"})
|
||||
static void initIdeaDefaults(UIDefaults defaults) {
|
||||
try {
|
||||
final Properties properties = new Properties();
|
||||
final InputStream stream = IdeaDarkLaf.class.getResourceAsStream("darcula_mac.properties");
|
||||
properties.load(stream);
|
||||
for (String key : properties.stringPropertyNames()) {
|
||||
final String value = properties.getProperty(key);
|
||||
if (key.endsWith("Insets")) {
|
||||
final List<String> numbers = StringUtil.split(value, ",");
|
||||
defaults.put(key, new InsetsUIResource(Integer.parseInt(numbers.get(0)),
|
||||
Integer.parseInt(numbers.get(1)),
|
||||
Integer.parseInt(numbers.get(2)),
|
||||
Integer.parseInt(numbers.get(3))));
|
||||
} else {
|
||||
final Color color = ColorUtil.fromHex(value, null);
|
||||
final Integer invVal = getInteger(value);
|
||||
loadDefaults(defaults, null); //load defaults
|
||||
loadDefaults(defaults, SystemInfo.isMac ? "mac" : SystemInfo.isWindows ? "windows" : "linux"); // load OS customization
|
||||
|
||||
if (color != null) {
|
||||
defaults.put(key, new ColorUIResource(color));
|
||||
} else if (invVal != null) {
|
||||
defaults.put(key, invVal);
|
||||
} else {
|
||||
defaults.put(key, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (IOException e) {
|
||||
log(e);
|
||||
}
|
||||
//defaults.put("TitledBorder.titleColor", IdeaBlueMetalTheme.primary1);
|
||||
//ColorUIResource col = new ColorUIResource(0, 0, 0);
|
||||
//defaults.put("ScrollBar.background", col);
|
||||
//defaults.put("ScrollBar.track", col);
|
||||
//
|
||||
////Border scrollPaneBorder = new BorderUIResource(new BegBorders.ScrollPaneBorder());
|
||||
////defaults.put("ScrollPane.border", scrollPaneBorder);
|
||||
//ColorUIResource defaultBackground = new ColorUIResource(68, 68, 68);
|
||||
//ColorUIResource defaultForeground = new ColorUIResource(255, 255, 255);
|
||||
//final ColorUIResource selectionBackground = new ColorUIResource(44, 44, 44);
|
||||
//defaults.put("Tree.background", defaultBackground);
|
||||
//defaults.put("List.background", defaultBackground);
|
||||
//defaults.put("Table.background", defaultBackground);
|
||||
//defaults.put("Tree.foreground", defaultForeground);
|
||||
//defaults.put("Tree.textForeground", defaultForeground);
|
||||
//defaults.put("Tree.selectionBackground", selectionBackground);
|
||||
//defaults.put("Tree.selectionForeground", defaultForeground);
|
||||
//
|
||||
//defaults.put("List.foreground", defaultForeground);
|
||||
//defaults.put("Table.foreground", defaultForeground);
|
||||
//
|
||||
//defaults.put("control", new ColorUIResource(44, 44, 44));
|
||||
//
|
||||
//defaults.put("Panel.background", new ColorUIResource(44, 44, 44));
|
||||
//defaults.put("Panel.foreground", new ColorUIResource(255, 255, 255));
|
||||
//defaults.put("Menu.selectionBackground", new ColorUIResource(190, 190, 190));
|
||||
//defaults.put("Menu.background", new ColorUIResource(68, 68, 68));
|
||||
//defaults.put("MenuItem.background", new ColorUIResource(68, 68, 68));
|
||||
//defaults.put("Menu.foreground", new ColorUIResource(255, 255, 255));
|
||||
//defaults.put("MenuItem.foreground", new ColorUIResource(255, 255, 255));
|
||||
////defaults.put("ScrollPaneUI", BegScrollPaneUI.class.getName());
|
||||
//
|
||||
//defaults.put("TabbedPane.tabInsets", new Insets(0, 4, 0, 4));
|
||||
//defaults.put("ToolTip.background", new ColorUIResource(0, 14, 0));
|
||||
//defaults.put("ToolTip.border", new ColoredSideBorder(Color.gray, Color.gray, Color.black, Color.black, 1));
|
||||
//defaults.put("Tree.ancestorInputMap", null);
|
||||
//defaults.put("FileView.directoryIcon", AllIcons.Nodes.Folder);
|
||||
//defaults.put("FileChooser.upFolderIcon", AllIcons.Nodes.UpFolder);
|
||||
//defaults.put("FileChooser.newFolderIcon", AllIcons.Nodes.NewFolder);
|
||||
//defaults.put("FileChooser.homeFolderIcon", AllIcons.Nodes.HomeFolder);
|
||||
//defaults.put("OptionPane.errorIcon", AllIcons.General.ErrorDialog);
|
||||
//defaults.put("OptionPane.informationIcon", AllIcons.General.InformationDialog);
|
||||
//defaults.put("OptionPane.warningIcon", AllIcons.General.WarningDialog);
|
||||
//defaults.put("OptionPane.questionIcon", AllIcons.General.QuestionDialog);
|
||||
//defaults.put("Tree.expandedIcon", WindowsTreeUI.ExpandedIcon.createExpandedIcon());
|
||||
//defaults.put("Tree.collapsedIcon", WindowsTreeUI.CollapsedIcon.createCollapsedIcon());
|
||||
defaults.put("Table.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] {
|
||||
"ctrl C", "copy",
|
||||
"ctrl V", "paste",
|
||||
@@ -228,6 +156,42 @@ final class IdeaDarkLaf extends BasicLookAndFeel {
|
||||
}));
|
||||
}
|
||||
|
||||
private static void loadDefaults(UIDefaults defaults, @Nullable String postfix) {
|
||||
try {
|
||||
final Properties properties = new Properties();
|
||||
final String secondPart = postfix == null ? "" : "_" + postfix;
|
||||
final String name = "darcula" + secondPart + ".properties";
|
||||
final InputStream stream = IdeaDarkLaf.class.getResourceAsStream(name);
|
||||
properties.load(stream);
|
||||
for (String key : properties.stringPropertyNames()) {
|
||||
final String value = properties.getProperty(key);
|
||||
if (key.endsWith("Insets")) {
|
||||
final List<String> numbers = StringUtil.split(value, ",");
|
||||
defaults.put(key, new InsetsUIResource(Integer.parseInt(numbers.get(0)),
|
||||
Integer.parseInt(numbers.get(1)),
|
||||
Integer.parseInt(numbers.get(2)),
|
||||
Integer.parseInt(numbers.get(3))));
|
||||
} else {
|
||||
final Color color = ColorUtil.fromHex(value, null);
|
||||
final Integer invVal = getInteger(value);
|
||||
Icon icon = value != null && value.startsWith("AllIcons.") ? IconLoader.getIcon(value) : null;
|
||||
if (color != null) {
|
||||
defaults.put(key, new ColorUIResource(color));
|
||||
} else if (invVal != null) {
|
||||
defaults.put(key, invVal);
|
||||
} else if (icon != null) {
|
||||
defaults.put(key, new IconUIResource(icon));
|
||||
} else {
|
||||
defaults.put(key, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (IOException e) {
|
||||
log(e);
|
||||
}
|
||||
}
|
||||
|
||||
private static Integer getInteger(String value) {
|
||||
try {
|
||||
return Integer.parseInt(value);
|
||||
@@ -286,7 +250,7 @@ final class IdeaDarkLaf extends BasicLookAndFeel {
|
||||
@Override
|
||||
protected void loadSystemColors(UIDefaults defaults, String[] systemColors, boolean useNative) {
|
||||
try {
|
||||
final Method superMethod = base.getClass().getDeclaredMethod("loadSystemColors",
|
||||
final Method superMethod = BasicLookAndFeel.class.getDeclaredMethod("loadSystemColors",
|
||||
UIDefaults.class,
|
||||
String[].class,
|
||||
boolean.class);
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
Menu.maxGutterIconWidth=18
|
||||
MenuItem.maxGutterIconWidth=18
|
||||
MenuItem.acceleratorDelimiter=-
|
||||
|
||||
#Trees
|
||||
Tree.background=444444
|
||||
Tree.foreground=FFFFFF
|
||||
Tree.textForeground=FFFFFF
|
||||
#Tree.selectionBackground=BEBEBE
|
||||
#Tree.selectionForeground=444444
|
||||
|
||||
#Lists
|
||||
List.background=444444
|
||||
List.foreground=FFFFFF
|
||||
|
||||
#Tables
|
||||
Table.background=444444
|
||||
Table.foreground=FFFFFF
|
||||
control=444444
|
||||
Panel.background=404040
|
||||
Panel.foreground=FFFFFF
|
||||
Menu.selectionBackground=bebebe
|
||||
MenuBar.background=444444
|
||||
MenuBar.disabledBackground=444444
|
||||
MenuBar.shadow=444444
|
||||
Menu.background=444444
|
||||
MenuItem.background=444444
|
||||
Menu.foreground=FFFFFF
|
||||
MenuItem.foreground=ffffff
|
||||
TabbedPane.tabInsets=0,4,0,4
|
||||
ToggleButton.foreground=ffffff
|
||||
Separator.background=444444
|
||||
Separator.foreground=888888
|
||||
|
||||
Label.foreground=ffffff
|
||||
Focus.color=ff0000
|
||||
|
||||
TextField.background=444444
|
||||
TextField.foreground=ffffff
|
||||
CheckBox.background=444444
|
||||
CheckBox.foreground=ffffff
|
||||
RadioButton.foreground=ffffff
|
||||
|
||||
StatusBar.topColor=2c2c2c
|
||||
StatusBar.top2Color=2c2c2c
|
||||
StatusBar.bottomColor=2c2c2c
|
||||
|
||||
TextField.caretForeground=ffffff
|
||||
MenuItem.acceleratorForeground=ffffff
|
||||
PopupMenu.background=444444
|
||||
@@ -1,48 +1 @@
|
||||
Menu.maxGutterIconWidth=18
|
||||
MenuItem.maxGutterIconWidth=18
|
||||
MenuItem.acceleratorDelimiter=-
|
||||
|
||||
#Trees
|
||||
Tree.background=444444
|
||||
Tree.foreground=FFFFFF
|
||||
Tree.textForeground=FFFFFF
|
||||
#Tree.selectionBackground=BEBEBE
|
||||
#Tree.selectionForeground=444444
|
||||
|
||||
#Lists
|
||||
List.background=444444
|
||||
List.foreground=FFFFFF
|
||||
|
||||
#Tables
|
||||
Table.background=444444
|
||||
Table.foreground=FFFFFF
|
||||
control=444444
|
||||
Panel.background=404040
|
||||
Panel.foreground=FFFFFF
|
||||
Menu.selectionBackground=bebebe
|
||||
MenuBar.background=444444
|
||||
MenuBar.disabledBackground=444444
|
||||
MenuBar.shadow=444444
|
||||
Menu.background=444444
|
||||
MenuItem.background=444444
|
||||
Menu.foreground=FFFFFF
|
||||
MenuItem.foreground=ffffff
|
||||
TabbedPane.tabInsets=0,4,0,4
|
||||
ToggleButton.foreground=ffffff
|
||||
Separator.foreground=ffffff
|
||||
Separator.background=444444
|
||||
|
||||
Label.foreground=ffffff
|
||||
Focus.color=ff0000
|
||||
|
||||
TextField.background=444444
|
||||
TextField.foreground=ffffff
|
||||
CheckBox.background=444444
|
||||
CheckBox.foreground=ffffff
|
||||
RadioButton.foreground=ffffff
|
||||
|
||||
StatusBar.topColor=2c2c2c
|
||||
StatusBar.top2Color=2c2c2c
|
||||
StatusBar.bottomColor=2c2c2c
|
||||
|
||||
TextField.caretForeground=ffffff
|
||||
Menu.arrowIcon=AllIcons.Mac.Tree_white_right_arrow
|
||||
Reference in New Issue
Block a user