Skip to content

Commit

Permalink
Merge branch 'v09' into master2
Browse files Browse the repository at this point in the history
Conflicts:
	Material Theme.zip
	src/main/resources/META-INF/plugin.xml
  • Loading branch information
mallowigi committed Aug 30, 2017
2 parents 690ea40 + 7f3968f commit 1f4c3d1
Show file tree
Hide file tree
Showing 345 changed files with 1,122 additions and 414 deletions.
40 changes: 40 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,45 @@
# Changelog

## 0.9.4
- Improvements of Lighter Theme. Now Lighter Theme extends IntelliJ Look And Feel instead of Darcula.
- Fix issues with No Material Theme that triggered some NPEs
- Changed Tree foreground color for Lighter Theme
- Added more UI Icons

## 0.9.3
- Fix issue with projects open (https://github.com/mallowigi/material-theme-jetbrains-eap/issues/145)
- Possibly fix issue with 100% CPU (https://github.com/mallowigi/material-theme-jetbrains-eap/issues/143)
- Fix import icon size (https://github.com/mallowigi/material-theme-jetbrains-eap/issues/147)
- Change deprecated color (https://github.com/mallowigi/material-theme-jetbrains-eap/issues/151)
- Improve Disabled Material Theme

## 0.9.2
- Fix issue with File colors for Psi Icons
- Fix issue with CPU 100% usage
- Fix issue with breakpoint icon size

## 0.9.1.2
- Fix issue with tool window icons in retina
- Add more ui icons

## 0.9.1
- Remove uppercase bold tabs as a default and fix issue with project settings persistence
- Revert fix of debugger tab height as it breaks other tabs

## 0.9.0
- Add custom accent color configuration
- Add Uppercase bold tabs to look more like MDTabs
- Add Compact Sidebar height configuration
- Reduce minimal length of tabs to 18
- Add a border to the editor when tabs placement is left or right
- More UI Icons

## 0.8.1
- Fix issue with Contrast action button not working
- Fix issues with not themed popups
- Add accent color to non-themed search bars
- Add background color to search result

## 0.8.0.2
- Fix issue with custom file statuses not being colorable
- Themed Material Combobox Action button
Expand Down
20 changes: 15 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,18 +185,17 @@ You can customize some plugin features in a Settings Panel under **Settings** ->

Active Tab Settings:
- *Active Tab Highlight*: Customize active tab indicator color and thickness (works also for the Project View selected row)
- *Bold directories*: Set bold font weight for directories in the Project View
- *Tabs Height*: Set a custom height for tabs (between 25 and 60 pixels)
- *Uppercase Bold Tabs*: Set the Editor Tabs in Bold Upper Case

Panel Settings:
- *Contrast Mode*: Add contrast to some of the IDE's components (currently only the Tabs and Tree)
- *Hide Icons*: Hide file icons (you must have Material Icons options on)
- *Compact Sidebar*: Reduce line height between list items in sidebars
- *Custom Sidebar Height*: Set custom line height in Project View (min: 18, max: 30)
- *Custom Tree Indent*: Increase or reduce indentation in the sidebar (min: 2, max: 8)
- *Bold directories*: Set bold font weight for directories in the Project View
- *Compact Status Bar*: Reduce the height of the status bar (this is the default height)

Custom Accents:
- *X Accent*: Change the accent color. See section above for details about accents.
- *Custom Accent Color*: Set a custom color for accent color

Component Settings:
- *Custom Wallpaper*: Set a custom wallpaper for the "no files opened" page
Expand Down Expand Up @@ -264,6 +263,17 @@ Twitter: [@crmag](https://twitter.com/crmag)

**Thanks to [@equinusocio](https://github.com/equinusocio/material-theme) for the inspiration.**

# YourKit

Performance issues are troubleshooted using:

[![YourKit](https://www.yourkit.com/images/yklogo.png)](https://www.yourkit.com/java/profiler/)

YourKit supports open source projects with its full-featured Java Profiler.
YourKit, LLC is the creator of <a href="https://www.yourkit.com/java/profiler/">YourKit Java Profiler</a>
and <a href="https://www.yourkit.com/.net/profiler/">YourKit .NET Profiler</a>,
innovative and intelligent tools for profiling Java and .NET applications.

## Icon Reference

- All file icons have been built using the tools provided by [A File Icon](https://github.com/ihodev/a-file-icon). Great thanks to them!
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ intellij {
pluginName 'Material Theme'
version ideaVersion
type 'IU'
downloadSources Boolean.valueOf(sources)
sameSinceUntilBuild Boolean.valueOf(isEAP)
downloadSources false
sameSinceUntilBuild true
alternativeIdePath idePath
updateSinceUntilBuild = false
plugins = ['com.jetbrains.php:172.3317.83', 'yaml','properties', 'CSS', 'JavaScriptLanguage', 'com.jetbrains.twig:172' +
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#Thu Jul 20 19:13:56 IDT 2017
#Wed Aug 30 18:35:42 IDT 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
Expand Down
45 changes: 40 additions & 5 deletions src/main/java/com/chrisrm/idea/MTConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,10 @@
public class MTConfig implements PersistentStateComponent<MTConfig> {
public static final String DEFAULT_BG = "https://raw.githubusercontent" +
".com/mallowigi/material-theme-jetbrains-eap/master/src/main/resources/themes/wall.jpg,60";
public static final String ACCENT_COLOR = "80CBC4";
// They are public so they can be serialized
public MTTheme selectedTheme = MTTheme.DEFAULT;
public String highlightColor;
public String highlightColor = ACCENT_COLOR;
public boolean highlightColorEnabled = false;
public Integer highlightThickness;
public boolean isContrastMode = false;
Expand All @@ -63,7 +64,7 @@ public class MTConfig implements PersistentStateComponent<MTConfig> {
public boolean isCustomTreeIndentEnabled = false;
public Integer customTreeIndent = 6;

public String accentColor = "80CBC4";
public String accentColor = ACCENT_COLOR;
public String wallpaper = DEFAULT_BG;

public boolean wallpaperSet = true;
Expand All @@ -76,9 +77,11 @@ public class MTConfig implements PersistentStateComponent<MTConfig> {
public Integer tabsHeight = 42;
public boolean isMaterialTheme = true;
public boolean themedScrollbars = true;
public boolean isCompactStatusBar;
public boolean isCompactStatusBar = false;

public String defaultBackground;
public boolean upperCaseTabs = false;
public int customSidebarHeight = 18;

public MTConfig() {
final MTTheme theme = this.selectedTheme;
Expand Down Expand Up @@ -318,6 +321,10 @@ public String getAccentColor() {
public void setAccentColor(final String accentColor) {
this.accentColor = accentColor;
}

public boolean isAccentColorChanged(final Color customAccentColor) {
return !Objects.equals(this.accentColor, customAccentColor);
}
//endregion

//region Wallpapers
Expand Down Expand Up @@ -401,6 +408,18 @@ public void setCompactSidebar(final boolean compactSidebar) {
public boolean isCompactSidebarChanged(final boolean compactSidebar) {
return this.compactSidebar != compactSidebar;
}

public int getCustomSidebarHeight() {
return customSidebarHeight;
}

public boolean customSidebarHeightChanged(final Integer customSidebarHeight) {
return this.customSidebarHeight != customSidebarHeight;
}

public void setCustomSidebarHeight(final Integer customSidebarHeight) {
this.customSidebarHeight = customSidebarHeight;
}
//endregion

//region Statusbar indicator
Expand Down Expand Up @@ -471,7 +490,6 @@ public boolean isCustomTreeIndentChanged(final boolean customTreeIndentEnabled)
}
//endregion


//region Themed Scrollbars
public boolean isThemedScrollbars() {
return themedScrollbars;
Expand Down Expand Up @@ -504,7 +522,24 @@ public String getDefaultBackground() {
return defaultBackground;
}

public void setDefaultBackground(String defaultBackground) {
public void setDefaultBackground(final String defaultBackground) {
this.defaultBackground = defaultBackground;
}

//region Uppercase tabs
public boolean isUpperCaseTabs() {
return upperCaseTabs;
}

public void setIsUpperCaseTabs(final boolean isUpperCaseTabs) {
this.upperCaseTabs = isUpperCaseTabs;
}

public boolean isUpperCaseTabsChanged(final boolean upperCaseTabs) {
return this.upperCaseTabs != upperCaseTabs;
}

//endregion


}
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@
*
*/

package com.chrisrm.idea.themes;
package com.chrisrm.idea;

import com.chrisrm.idea.MTConfig;
import com.chrisrm.idea.config.BeforeConfigNotifier;
import com.chrisrm.idea.config.ConfigNotifier;
import com.chrisrm.idea.config.ui.MTForm;
Expand All @@ -45,9 +44,7 @@
import com.intellij.ui.CaptionPanel;
import com.intellij.ui.components.JBPanel;
import com.intellij.util.messages.MessageBusConnection;
import com.intellij.util.ui.ScrollUtil;
import javassist.*;
import javassist.expr.ConstructorCall;
import javassist.expr.ExprEditor;
import javassist.expr.MethodCall;
import org.jetbrains.annotations.NotNull;
Expand All @@ -63,7 +60,6 @@ public final class MTLafComponent extends JBPanel implements ApplicationComponen
private boolean willRestartIde = false;

static {
// patchUIUtil();
hackTitleLabel();
hackIdeaActionButton();
}
Expand All @@ -87,31 +83,6 @@ public void initComponent() {
connect.subscribe(BeforeConfigNotifier.BEFORE_CONFIG_TOPIC, (this::onBeforeSettingsChanged));
}

public static void patchUIUtil() {
// Hack method
try {
final ClassPool cp = new ClassPool(true);
cp.insertClassPath(new ClassClassPath(ScrollUtil.class));
final CtClass ctClass = cp.get("com.intellij.util.ui.UIUtil");
final CtMethod ctMethod = ctClass.getDeclaredMethod("drawHeader");
ctMethod.instrument(new ExprEditor() {
@Override
public void edit(final ConstructorCall c) throws CannotCompileException {
try {
if (c.getConstructor().getLongName().equals("java.awt.Color")) {
c.replace("{ $_ = javax.swing.UIManager.getColor(\"activeCaption\"); }");
}
} catch (final NotFoundException e) {
e.printStackTrace();
}
}
});
ctClass.writeFile();
} catch (final Exception e) {
e.printStackTrace();
}
}

/**
* For better dialog titles (since I have no idea how to know when dialogs appear, I can't attach events so I'm directly hacking
* the source code). I hate doing this.
Expand Down Expand Up @@ -196,6 +167,23 @@ public void edit(final MethodCall m) throws CannotCompileException {
});

ctClass.toClass();

final CtClass comboBoxActionButtonClass = cp.get("com.intellij.openapi.actionSystem.ex.ComboBoxAction$ComboBoxButton");
final CtMethod paint = comboBoxActionButtonClass.getDeclaredMethod("paint");
paint.instrument(new ExprEditor() {
@Override
public void edit(final MethodCall m) throws CannotCompileException {
if (m.getMethodName().equals("drawRoundRect")) {
m.replace("{ $2 = $4; $5 = 0; $6 = 0; $_ = $proceed($$); }");
} else if (m.getMethodName().equals("setPaint") && m.getLineNumber() > 454 && m.getLineNumber() < 460) {
final String color = "javax.swing.UIManager.getColor(\"TextField.selectedSeparatorColor\")";
m.replace("{ $1 = myMouseInside ? " + color + " : com.intellij.ui.Gray._95; $_ = $proceed($$); }");
}
}
});

comboBoxActionButtonClass.toClass();

} catch (final Exception e) {
e.printStackTrace();
}
Expand Down Expand Up @@ -257,20 +245,6 @@ private void restartIdeIfNecessary(final MTConfig mtConfig, final MTForm form) {
}
}

/**
* Hack SearchTextField to override SDK's createUI
*/
private static void hackSearchTextField() throws NotFoundException, CannotCompileException {
final ClassPool cp = ClassPool.getDefault();
cp.insertClassPath(new ClassClassPath(MTTextFieldUI.class));

final CtClass darculaClass = cp.get("com.intellij.ide.ui.laf.darcula.ui.DarculaTextFieldUI");
final CtClass componentClass = cp.get("javax.swing.JComponent");
final CtMethod createUI = darculaClass.getDeclaredMethod("createUI", new CtClass[]{componentClass});
createUI.setBody("{ return com.chrisrm.idea.ui.MTTextFieldFactory.newInstance($1); }");
darculaClass.toClass();
}

/**
* Replace Table headers
*/
Expand Down
60 changes: 60 additions & 0 deletions src/main/java/com/chrisrm/idea/MTLightLaf.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2017 Chris Magnussen and Elior Boukhobza
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*
*/

package com.chrisrm.idea;

import com.chrisrm.idea.utils.PropertiesParser;
import com.intellij.ide.ui.laf.IntelliJLaf;
import org.jetbrains.annotations.NotNull;

public class MTLightLaf extends IntelliJLaf {

private final MTTheme theme;

public MTLightLaf(@NotNull final MTTheme theme) {
super();
this.theme = theme;
}

/**
* Get Theme Prefix
*/
@Override
protected String getPrefix() {
return theme.getId();
}

/**
* Parse properties value
*
* @param key
* @param value
*/
@Override
protected Object parseValue(final String key, @NotNull final String value) {
return PropertiesParser.parseValue(key, value);
}
}
Loading

0 comments on commit 1f4c3d1

Please sign in to comment.