Browse Source

Merge pull request #2 from hudsonb/master

Update
master
Brian Hudson 11 years ago
parent
commit
fa3f479ee4
  1. 2
      .idea/artifacts/darcula.xml
  2. BIN
      build/darcula.jar
  3. 2
      src/com/bulenkov/darcula/DarculaLaf.java
  4. 27
      src/com/bulenkov/darcula/darcula.properties
  5. BIN
      src/com/bulenkov/darcula/icons/clear.png
  6. BIN
      src/com/bulenkov/darcula/icons/clear@2x.png
  7. BIN
      src/com/bulenkov/darcula/icons/internalFrame.png
  8. BIN
      src/com/bulenkov/darcula/icons/search.png
  9. BIN
      src/com/bulenkov/darcula/icons/search@2x.png
  10. BIN
      src/com/bulenkov/darcula/icons/searchWithHistory.png
  11. BIN
      src/com/bulenkov/darcula/icons/searchWithHistory@2x.png
  12. 32
      src/com/bulenkov/darcula/ui/DarculaInternalFrameBorder.java
  13. 232
      src/com/bulenkov/darcula/ui/DarculaInternalFrameUI.java
  14. 8
      src/com/bulenkov/darcula/ui/DarculaTextFieldUI.java

2
.idea/artifacts/Darcula_jar.xml → .idea/artifacts/darcula.xml

@ -1,5 +1,5 @@
<component name="ArtifactManager">
<artifact type="jar" build-on-make="true" name="darcula:jar">
<artifact type="jar" build-on-make="true" name="darcula">
<output-path>$PROJECT_DIR$/build/</output-path>
<root id="archive" name="darcula.jar">
<element id="module-output" name="Darcula" />

BIN
build/darcula.jar

Binary file not shown.

2
src/com/bulenkov/darcula/DarculaLaf.java

@ -98,7 +98,7 @@ public final class DarculaLaf extends BasicLookAndFeel {
defaults.put("Tree.expandedIcon", new IconUIResource(IconLoader.getIcon("/com/bulenkov/darcula/icons/treeNodeExpanded.png")));
defaults.put("CheckBoxMenuItem.checkIcon", EmptyIcon.create(16));
defaults.put("RadioButtonMenuItem.checkIcon", EmptyIcon.create(16));
defaults.put("InternalFrame.icon", new IconUIResource(IconLoader.getIcon("/com/bulenkov/darcula/icons/internalFrame.png")));
return defaults;
}
catch (Exception ignore) {

27
src/com/bulenkov/darcula/darcula.properties

@ -56,7 +56,7 @@ Table.descendingSortIcon=AllIcons.General.SplitDown
TableHeader.cellBorder=com.bulenkov.darcula.DarculaTableHeaderBorder
TitledBorder.titleColor=bbbbbb
internal
MenuBar.disabledBackground=3c3f41
MenuBar.shadow=3c3f41
MenuBar.darcula.borderColor=555555
@ -65,7 +65,7 @@ MenuBar.darcula.borderShadowColor=282828
TabbedPaneUI=com.bulenkov.darcula.ui.DarculaTabbedPaneUI
TabbedPane.tabInsets=0,4,0,4
TabbedPane.highlight=292b2d
TabbedPane.light=444444
TabbedPane.light=444444 internal
TabbedPane.selected=41516D
TabbedPane.selectHighlight=3c3f41
TabbedPane.contentBorderInsets=3,1,1,1
@ -79,9 +79,9 @@ Focus.color=ff0000
TextField.background=45494A
TextFieldUI=com.bulenkov.darcula.ui.DarculaTextFieldUI
TextField.border=com.bulenkov.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.search.icon=/com/bulenkov/darcula/icons/search.png
TextField.darcula.searchWithHistory.icon=/com/bulenkov/darcula/icons/searchWithHistory.png
TextField.darcula.clear.icon=/com/bulenkov/darcula/icons/clear.png
TextArea.selectionForeground=bbbbbb
PasswordField.background=45494A
@ -166,4 +166,19 @@ Hyperlink.linkColor=589df6
#Tree.background=45494A
FileView.fileIcon=AllIcons.FileTypes.Unknown
FileView.fileIcon=AllIcons.FileTypes.Unknown
InternalFrameUI=com.bulenkov.darcula.ui.DarculaInternalFrameUI
InternalFrame.border=com.bulenkov.darcula.ui.DarculaInternalFrameBorder
InternalFrame.darcula.borderColor=5F5F5F
InternalFrame.darcula.borderInnerColor=3C3F41
InternalFrameTitlePane.darcula.borderColorTop=5F5F5F
InternalFrameTitlePane.darcula.borderColorLeft=27292A
InternalFrameTitlePane.darcula.borderColorBottom=3C3F41
InternalFrameTitlePane.darcula.selected.borderColorTop=566172
InternalFrameTitlePane.darcula.selected.borderColorLeft=27292A
InternalFrameTitlePane.darcula.selected.borderColorBottom=313C4C
InternalFrameTitlePane.darcula.backgroundColor=3A3D3F
InternalFrameTitlePane.darcula.selected.backgroundColor=424D5F
InternalFrameTitlePane.darcula.buttonColor=8B8B8B
InternalFrameTitlePane.darcula.hovered.buttonColor=A8A8A8

BIN
src/com/bulenkov/darcula/icons/clear.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 421 B

BIN
src/com/bulenkov/darcula/icons/clear@2x.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 668 B

BIN
src/com/bulenkov/darcula/icons/internalFrame.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 311 B

BIN
src/com/bulenkov/darcula/icons/search.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 365 B

BIN
src/com/bulenkov/darcula/icons/search@2x.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 631 B

BIN
src/com/bulenkov/darcula/icons/searchWithHistory.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 391 B

BIN
src/com/bulenkov/darcula/icons/searchWithHistory@2x.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 738 B

32
src/com/bulenkov/darcula/ui/win/DarculaWindowsInternalFrameUI.java → src/com/bulenkov/darcula/ui/DarculaInternalFrameBorder.java

@ -14,25 +14,31 @@
* limitations under the License.
*/
package com.bulenkov.darcula.ui.win;
package com.bulenkov.darcula.ui;
import javax.swing.*;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicInternalFrameUI;
import javax.swing.border.Border;
import javax.swing.plaf.InsetsUIResource;
import javax.swing.plaf.UIResource;
import java.awt.*;
/**
* @author Konstantin Bulenkov
*/
public class DarculaWindowsInternalFrameUI extends BasicInternalFrameUI {
public DarculaWindowsInternalFrameUI(JInternalFrame b) {
super(b);
}
@SuppressWarnings({"MethodOverridesStaticMethodOfSuperclass", "UnusedDeclaration"})
public static ComponentUI createUI(JComponent c) {
return new DarculaWindowsInternalFrameUI(((JInternalFrame) c));
}
public class DarculaInternalFrameBorder implements Border, UIResource {
@Override
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) {
g.setColor(UIManager.getColor("InternalFrame.darcula.borderColor"));
g.drawRect(x, y, w-1, h-1);
}
@Override
public Insets getBorderInsets(Component c) {
return new InsetsUIResource(1, 1, 1, 1);
}
@Override
public boolean isBorderOpaque() {
return true;
}
}

232
src/com/bulenkov/darcula/ui/DarculaInternalFrameUI.java

@ -15,41 +15,233 @@
*/
package com.bulenkov.darcula.ui;
import com.bulenkov.iconloader.util.GraphicsConfig;
import com.bulenkov.iconloader.util.GraphicsUtil;
import javax.swing.*;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicInternalFrameTitlePane;
import javax.swing.plaf.basic.BasicInternalFrameUI;
import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
/**
* @author Konstantin Bulenkov
*/
public class DarculaInternalFrameUI extends BasicInternalFrameUI {
public DarculaInternalFrameUI(JInternalFrame b) {
super(b);
}
public DarculaInternalFrameUI(JInternalFrame b) {
super(b);
}
@SuppressWarnings({"MethodOverridesStaticMethodOfSuperclass", "UnusedDeclaration"})
public static ComponentUI createUI(JComponent c) {
return new DarculaInternalFrameUI((JInternalFrame)c);
}
@SuppressWarnings({"MethodOverridesStaticMethodOfSuperclass", "UnusedDeclaration"})
public static ComponentUI createUI(JComponent c) {
return new DarculaInternalFrameUI((JInternalFrame) c);
}
@Override
protected JComponent createNorthPane(JInternalFrame w) {
this.titlePane = new BasicInternalFrameTitlePane(w) {
@Override
protected void installDefaults() {
super.installDefaults();
closeIcon = new CloseIcon();
maxIcon = new MaximizeIcon();
minIcon = new MinimizeIcon();
iconIcon = new IconifyIcon();
selectedTitleColor = UIManager.getColor("InternalFrameTitlePane.darcula.selected.backgroundColor");
selectedTextColor = UIManager.getColor("darcula.textForeground");
notSelectedTitleColor = UIManager.getColor("InternalFrameTitlePane.darcula.backgroundColor");
notSelectedTextColor = UIManager.getColor("darcula.textForeground");
}
@Override
protected void createButtons() {
super.createButtons();
MouseListener listener = new MouseAdapter() {
@Override
public void mouseEntered(MouseEvent e) {
Icon icon = ((JButton) e.getComponent()).getIcon();
if (icon instanceof FrameIcon) {
Color c = ((FrameIcon) icon).getColor();
((FrameIcon) icon).setColor(c.brighter());
e.getComponent().repaint();
}
}
@Override
public void mouseExited(MouseEvent e) {
Icon icon = ((JButton) e.getComponent()).getIcon();
if (icon instanceof FrameIcon) {
((FrameIcon) icon).setColor(UIManager.getColor("InternalFrameTitlePane.darcula.buttonColor"));
e.getComponent().repaint();
}
}
};
closeButton.setBorder(null);
closeButton.setOpaque(false);
closeButton.addMouseListener(listener);
maxButton.setBorder(null);
maxButton.setOpaque(false);
maxButton.addMouseListener(listener);
iconButton.setBorder(null);
iconButton.setOpaque(false);
iconButton.addMouseListener(listener);
}
@Override
protected void paintBorder(Graphics g) {
int w = getWidth();
int h = getHeight();
Color top = UIManager.getColor("InternalFrameTitlePane.darcula.borderColorTop");
Color left = UIManager.getColor("InternalFrameTitlePane.darcula.borderColorLeft");
Color bottom = UIManager.getColor("InternalFrameTitlePane.darcula.borderColorBottom");
if (frame.isSelected()) {
top = UIManager.getColor("InternalFrameTitlePane.darcula.selected.borderColorTop");
left = UIManager.getColor("InternalFrameTitlePane.darcula.selected.borderColorLeft");
bottom = UIManager.getColor("InternalFrameTitlePane.darcula.selected.borderColorBottom");
}
g.setColor(top);
g.drawLine(2, 0, w, 0);
g.setColor(left);
g.drawLine(0, 1, 0, h);
g.setColor(bottom);
g.drawLine(2, h, w, h);
}
};
this.titlePane.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 0));
return this.titlePane;
}
private static abstract class FrameIcon implements Icon {
private Color mColor;
public FrameIcon(Color c) {
mColor = c;
}
public Color getColor() {
return mColor;
}
public void setColor(Color c) {
mColor = c;
}
@Override
public int getIconWidth() {
return 16;
}
@Override
public int getIconHeight() {
return 16;
}
}
private static class CloseIcon extends FrameIcon {
public CloseIcon() {
this(UIManager.getColor("InternalFrameTitlePane.darcula.buttonColor"));
}
public CloseIcon(Color c) {
super(c);
}
@Override
public void paintIcon(Component c, Graphics g, int x, int y) {
Graphics2D g2 = (Graphics2D) g;
GraphicsConfig config = GraphicsUtil.setupAAPainting(g2);
g2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE);
g2.setStroke(new BasicStroke(1.5f));
g2.setPaint(getColor());
g.drawLine(5, 4, 11, 10);
g.drawLine(11, 4, 5, 10);
config.restore();
}
}
private static class MaximizeIcon extends FrameIcon {
public MaximizeIcon() {
this(UIManager.getColor("InternalFrameTitlePane.darcula.buttonColor"));
}
public MaximizeIcon(Color c) {
super(c);
}
@Override
public void paintIcon(Component c, Graphics g, int x, int y) {
Graphics2D g2 = (Graphics2D) g;
GraphicsConfig config = GraphicsUtil.setupAAPainting(g2);
g2.setStroke(new BasicStroke(2f));
g2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE);
g2.setPaint(getColor());
g2.setStroke(new BasicStroke(2f));
g2.drawRect(3, 3, 10, 9);
config.restore();
}
}
@Override
protected JComponent createNorthPane(JInternalFrame w) {
this.titlePane = new BasicInternalFrameTitlePane(w) {
@Override
protected void paintBorder(Graphics g) {
super.paintBorder(g);
}
@Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
}
};
return this.titlePane;
protected void installDefaults() {
super.installDefaults();
}
private static class MinimizeIcon extends FrameIcon {
public MinimizeIcon() {
this(UIManager.getColor("InternalFrameTitlePane.darcula.buttonColor"));
}
public MinimizeIcon(Color c) {
super(c);
}
@Override
public void paintIcon(Component c, Graphics g, int x, int y) {
Graphics2D g2 = (Graphics2D) g;
GraphicsConfig config = GraphicsUtil.setupAAPainting(g2);
g2.setStroke(new BasicStroke(2f));
g2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE);
g2.setPaint(getColor());
g2.setStroke(new BasicStroke(2f));
g2.drawRect(1, 5, 8, 8);
g2.drawLine(4, 2, 12, 2);
g2.drawLine(12, 3, 12, 10);
config.restore();
}
}
private static class IconifyIcon extends FrameIcon {
public IconifyIcon() {
this(UIManager.getColor("InternalFrameTitlePane.darcula.buttonColor"));
}
public IconifyIcon(Color c) {
super(c);
}
@Override
public void paintIcon(Component c, Graphics g, int x, int y) {
Graphics2D g2 = (Graphics2D) g;
GraphicsConfig config = GraphicsUtil.setupAAPainting(g2);
g2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE);
g2.setPaint(getColor());
g2.setStroke(new BasicStroke(2f));
g2.drawLine(4, 12, 12, 12);
config.restore();
}
}
}

8
src/com/bulenkov/darcula/ui/DarculaTextFieldUI.java

@ -32,10 +32,6 @@ import java.awt.event.*;
* @author Konstantin Bulenkov
*/
public class DarculaTextFieldUI extends BasicTextFieldUI {
private static final Icon SEARCH_ICON = IconLoader.findIcon("/com/intellij/ide/ui/laf/darcula/icons/search.png", DarculaTextFieldUI.class, true);
private static final Icon SEARCH_WITH_HISTORY_ICON = IconLoader.findIcon("/com/intellij/ide/ui/laf/darcula/icons/searchWithHistory.png", DarculaTextFieldUI.class, true);
private static final Icon CLEAR_ICON = IconLoader.findIcon("/com/intellij/ide/ui/laf/darcula/icons/clear.png", DarculaTextFieldUI.class, true);
private enum SearchAction {POPUP, CLEAR}
private final JTextField myTextField;
@ -165,14 +161,14 @@ public class DarculaTextFieldUI extends BasicTextFieldUI {
Point p = getSearchIconCoord();
Icon searchIcon = getComponent().getClientProperty("JTextField.Search.FindPopup") instanceof JPopupMenu ? UIManager.getIcon("TextField.darcula.searchWithHistory.icon") : UIManager.getIcon("TextField.darcula.search.icon");
if (searchIcon == null) {
searchIcon = IconLoader.findIcon("/com/intellij/ide/ui/laf/icons/search.png", DarculaTextFieldUI.class, true);
searchIcon = IconLoader.findIcon("/com/bulenkov/darcula/icons/search.png", DarculaTextFieldUI.class, true);
}
searchIcon.paintIcon(null, g, p.x, p.y);
if (getComponent().hasFocus() && getComponent().getText().length() > 0) {
p = getClearIconCoord();
Icon clearIcon = UIManager.getIcon("TextField.darcula.clear.icon");
if (clearIcon == null) {
clearIcon = IconLoader.findIcon("/com/intellij/ide/ui/laf/icons/clear.png", DarculaTextFieldUI.class, true);
clearIcon = IconLoader.findIcon("/com/bulenkov/darcula/icons/clear.png", DarculaTextFieldUI.class, true);
}
clearIcon.paintIcon(null, g, p.x, p.y);
}

Loading…
Cancel
Save