Skip to content

Commit

Permalink
Updating code to use SVGs instead of pngs (#1086)
Browse files Browse the repository at this point in the history
Using new SVG icons when available (old icons moved to legacy folder)
  • Loading branch information
m0rkeulv authored Apr 15, 2021
1 parent 0e48235 commit cb2a56f
Show file tree
Hide file tree
Showing 42 changed files with 74 additions and 47 deletions.
18 changes: 18 additions & 0 deletions resources/icons/Haxe_logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion resources/icons/class.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion resources/icons/enum.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion resources/icons/field.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion resources/icons/file.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion resources/icons/interface.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
2 changes: 1 addition & 1 deletion resources/icons/method.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions resources/icons/nme.svg
13 changes: 7 additions & 6 deletions src/common/com/intellij/plugins/haxe/HaxeComponentType.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import com.intellij.icons.AllIcons;
import com.intellij.plugins.haxe.lang.psi.*;
import com.intellij.psi.PsiElement;
import icons.HaxeIcons;
import org.jetbrains.annotations.Nullable;

import javax.swing.*;
Expand All @@ -33,7 +34,7 @@ public enum HaxeComponentType {
CLASS(0) {
@Override
public Icon getIcon() {
return icons.HaxeIcons.C_Haxe;
return icons.HaxeIcons.Class;
}
@Override
public Icon getCompletionIcon() {
Expand All @@ -42,7 +43,7 @@ public Icon getCompletionIcon() {
}, ENUM(1) {
@Override
public Icon getIcon() {
return icons.HaxeIcons.E_Haxe;
return icons.HaxeIcons.Enum;
}
@Override
public Icon getCompletionIcon() {
Expand All @@ -51,7 +52,7 @@ public Icon getCompletionIcon() {
}, INTERFACE(2) {
@Override
public Icon getIcon() {
return icons.HaxeIcons.I_Haxe;
return icons.HaxeIcons.Interface;
}
@Override
public Icon getCompletionIcon() {
Expand All @@ -65,7 +66,7 @@ public Icon getIcon() {
}, METHOD(4) {
@Override
public Icon getIcon() {
return AllIcons.Nodes.Method;
return HaxeIcons.Method;
}
}, VARIABLE(5) {
@Override
Expand All @@ -75,7 +76,7 @@ public Icon getIcon() {
}, FIELD(6) {
@Override
public Icon getIcon() {
return AllIcons.Nodes.Field;
return HaxeIcons.Field;
}
}, PARAMETER(7) {
@Override
Expand All @@ -90,7 +91,7 @@ public Icon getIcon() {
}, CLASSVARIABLE(9) {
@Override
public Icon getIcon() {
return AllIcons.Nodes.Field;
return HaxeIcons.Field;
}
};

Expand Down
2 changes: 1 addition & 1 deletion src/common/com/intellij/plugins/haxe/HaxeFileType.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public String getDefaultExtension() {
}

public Icon getIcon() {
return icons.HaxeIcons.Haxe_16;
return icons.HaxeIcons.HAXE_LOGO;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ public HaxeSdkType() {

@Override
public Icon getIcon() {
return icons.HaxeIcons.Haxe_16;
return icons.HaxeIcons.HAXE_LOGO;
}

@Override
public Icon getIconForAddAction() {
return icons.HaxeIcons.Haxe_16;
return icons.HaxeIcons.HAXE_LOGO;
}

public static HaxeSdkType getInstance() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public String getDefaultExtension() {
}

public Icon getIcon() {
return icons.HaxeIcons.Haxe_16;
return icons.HaxeIcons.HAXE_LOGO;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,15 @@ public static String getTemplateShortName(String templateName) {
public static Icon getTemplateIcon(String name) {
name = getTemplateShortName(name);
if ("Class".equals(name)) {
return icons.HaxeIcons.C_Haxe;
return icons.HaxeIcons.Class;
}
else if ("Interface".equals(name)) {
return icons.HaxeIcons.I_Haxe;
return icons.HaxeIcons.Interface;
}
else if ("Enum".equals(name)) {
return icons.HaxeIcons.E_Haxe;
return icons.HaxeIcons.Enum;
}
return icons.HaxeIcons.Haxe_16;
return icons.HaxeIcons.HAXE_LOGO;
}

public static PsiElement createClass(String className, String packageName, PsiDirectory directory, String templateName, @org.jetbrains.annotations.Nullable java.lang.ClassLoader classLoader)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public class CreateClassAction extends CreateTemplateInPackageAction<PsiFile> {
}

public CreateClassAction() {
super(HaxeBundle.message("action.create.new.class"), HaxeBundle.message("action.create.new.class"), icons.HaxeIcons.Haxe_16, SOURCES);
super(HaxeBundle.message("action.create.new.class"), HaxeBundle.message("action.create.new.class"), icons.HaxeIcons.HAXE_LOGO, SOURCES);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
public class CreateNMMLFileAction extends CreateFileFromTemplateAction implements DumbAware {
public CreateNMMLFileAction() {
super(HaxeBundle.message("create.nmml.file.action"), HaxeBundle.message("create.nmml.file.action.description"),
icons.HaxeIcons.Nmml_16);
icons.HaxeIcons.NMML_LOGO);
}

@Override
Expand All @@ -52,7 +52,7 @@ protected void buildDialog(Project project, PsiDirectory directory, CreateFileFr
for (FileTemplate fileTemplate : HaxeFileTemplateUtil.getNMMLTemplates()) {
final String templateName = fileTemplate.getName();
final String shortName = HaxeFileTemplateUtil.getTemplateShortName(templateName);
builder.addKind(shortName, icons.HaxeIcons.Nmml_16, templateName);
builder.addKind(shortName, icons.HaxeIcons.NMML_LOGO, templateName);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public LookupElement toLookupElement() {
.append("):")
.append(this.retType);

Icon icon = "var".equals(this.memberType) ? HaxeIcons.Field_Haxe : HaxeIcons.Method_Haxe;
Icon icon = "var".equals(this.memberType) ? HaxeIcons.Field : HaxeIcons.Method;

LookupElementBuilder lookupElementBuilder = LookupElementBuilder.create(this, this.name)
.withIcon(icon)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class HXMLColorSettingsPage implements ColorSettingsPage {
@Nullable
@Override
public Icon getIcon() {
return HaxeIcons.Haxe_16;
return HaxeIcons.HAXE_LOGO;
}

@NotNull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public String getDisplayName() {

@Override
public Icon getIcon() {
return icons.HaxeIcons.Haxe_16;
return icons.HaxeIcons.HAXE_LOGO;
}

@NotNull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public LibraryPropertiesEditor createPropertiesEditor(@NotNull LibraryEditorComp

@Override
public Icon getIcon() {
return icons.HaxeIcons.Haxe_16;
return icons.HaxeIcons.HAXE_LOGO;
}

public static HaxeLibraryType getInstance() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,10 @@ public String getDescription() {
return HaxeBundle.message("haxe.module.type.description");
}

// @Override - Missing from 2017.2
public Icon getBigIcon() {
return icons.HaxeIcons.Haxe_24;
}

@Override
public Icon getNodeIcon(boolean isOpened) {
return icons.HaxeIcons.Haxe_16;
return icons.HaxeIcons.HAXE_LOGO;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,6 @@ public String getDefaultExtension() {

@Override
public Icon getIcon() {
return icons.HaxeIcons.Nmml_16;
return icons.HaxeIcons.NMML_LOGO;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public String getConfigurationTypeDescription() {
}

public Icon getIcon() {
return icons.HaxeIcons.Haxe_16;
return icons.HaxeIcons.HAXE_LOGO;
}

@NotNull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public String getConfigurationTypeDescription() {

@Override
public Icon getIcon() {
return icons.HaxeIcons.Haxe_16;
return icons.HaxeIcons.HAXE_LOGO;
}

@NotNull
Expand Down
22 changes: 10 additions & 12 deletions src/icons/HaxeIcons.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,20 @@

import javax.swing.*;

/**
* NOTE THIS FILE IS AUTO-GENERATED by the build/scripts/icons.gant
* Don't repeat mistakes of others ;-)
*/

public class HaxeIcons {
private static Icon load(String path) {
return IconLoader.getIcon(path, HaxeIcons.class);
}

public static final Icon C_Haxe = load("/icons/C_Logo.png"); // 16x16
public static final Icon E_Haxe = load("/icons/E_Logo.png"); // 16x16
public static final Icon Haxe_16 = load("/icons/HaxeLogo_16.png"); // 16x16
public static final Icon Haxe_24 = load("/icons/HaxeLogo_24.png"); // 24x24
public static final Icon I_Haxe = load("/icons/I_Logo.png"); // 16x16
public static final Icon Nmml_16 = load("/icons/nmml_16.png"); // 16x16
public static final Icon Class = load("/icons/class.svg");
public static final Icon Enum = load("/icons/enum.svg");
public static final Icon Interface = load("/icons/interface.svg");
public static final Icon Method = load("/icons/method.svg");
public static final Icon Field = load("/icons/field.svg");

public static final Icon HAXE_LOGO = load("/icons/Haxe_logo.svg");
public static final Icon NMML_LOGO = load("/icons/nme.svg");


public static final Icon Method_Haxe = load("/icons/method-logo.png"); //16x16
public static final Icon Field_Haxe = load("/icons/field-logo.png"); //16x16
}

0 comments on commit cb2a56f

Please sign in to comment.