diff options
| -rw-r--r-- | build.gradle | 7 | ||||
| -rw-r--r-- | src/main/java/cuchaz/enigma/Main.java | 6 | ||||
| -rw-r--r-- | src/main/java/cuchaz/enigma/config/Config.java | 6 | ||||
| -rw-r--r-- | src/main/java/cuchaz/enigma/config/Themes.java | 16 |
4 files changed, 29 insertions, 6 deletions
diff --git a/build.gradle b/build.gradle index 896534d5..8eae880d 100644 --- a/build.gradle +++ b/build.gradle | |||
| @@ -54,6 +54,11 @@ repositories { | |||
| 54 | name "Modmuss Repository" | 54 | name "Modmuss Repository" |
| 55 | url 'http://maven.modmuss50.me/' | 55 | url 'http://maven.modmuss50.me/' |
| 56 | } | 56 | } |
| 57 | |||
| 58 | ivy { | ||
| 59 | name "darcula" | ||
| 60 | artifactPattern "https://raw.githubusercontent.com/bulenkov/Darcula/master/build/[module].[ext]" | ||
| 61 | } | ||
| 57 | } | 62 | } |
| 58 | 63 | ||
| 59 | configurations { | 64 | configurations { |
| @@ -72,6 +77,8 @@ dependencies { | |||
| 72 | compile 'org.ow2.asm:asm-tree:7.0' | 77 | compile 'org.ow2.asm:asm-tree:7.0' |
| 73 | compile 'org.ow2.asm:asm-util:7.0' | 78 | compile 'org.ow2.asm:asm-util:7.0' |
| 74 | 79 | ||
| 80 | compile name: "darcula", version: "1.0.0" | ||
| 81 | |||
| 75 | application 'de.sciss:syntaxpane:1.1.+' | 82 | application 'de.sciss:syntaxpane:1.1.+' |
| 76 | 83 | ||
| 77 | testCompile 'junit:junit:4.+' | 84 | testCompile 'junit:junit:4.+' |
diff --git a/src/main/java/cuchaz/enigma/Main.java b/src/main/java/cuchaz/enigma/Main.java index 688a55e0..339b15e0 100644 --- a/src/main/java/cuchaz/enigma/Main.java +++ b/src/main/java/cuchaz/enigma/Main.java | |||
| @@ -11,18 +11,16 @@ | |||
| 11 | 11 | ||
| 12 | package cuchaz.enigma; | 12 | package cuchaz.enigma; |
| 13 | 13 | ||
| 14 | import cuchaz.enigma.config.Config; | 14 | import cuchaz.enigma.config.Themes; |
| 15 | import cuchaz.enigma.gui.Gui; | 15 | import cuchaz.enigma.gui.Gui; |
| 16 | 16 | ||
| 17 | import javax.swing.*; | ||
| 18 | import java.io.File; | 17 | import java.io.File; |
| 19 | import java.util.jar.JarFile; | 18 | import java.util.jar.JarFile; |
| 20 | 19 | ||
| 21 | public class Main { | 20 | public class Main { |
| 22 | 21 | ||
| 23 | public static void main(String[] args) throws Exception { | 22 | public static void main(String[] args) throws Exception { |
| 24 | if (Config.getInstance().useSystemLAF) | 23 | Themes.setLAF(); |
| 25 | UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); | ||
| 26 | Gui gui = new Gui(); | 24 | Gui gui = new Gui(); |
| 27 | 25 | ||
| 28 | // parse command-line args | 26 | // parse command-line args |
diff --git a/src/main/java/cuchaz/enigma/config/Config.java b/src/main/java/cuchaz/enigma/config/Config.java index 75ced70c..44414682 100644 --- a/src/main/java/cuchaz/enigma/config/Config.java +++ b/src/main/java/cuchaz/enigma/config/Config.java | |||
| @@ -40,7 +40,8 @@ public class Config { | |||
| 40 | public Integer identifierColor; | 40 | public Integer identifierColor; |
| 41 | public Integer defaultTextColor; | 41 | public Integer defaultTextColor; |
| 42 | 42 | ||
| 43 | public boolean useSystemLAF = true; | 43 | public boolean useSystemLAF; |
| 44 | public boolean useDraculaLAF; | ||
| 44 | 45 | ||
| 45 | private Config() { | 46 | private Config() { |
| 46 | gson = new GsonBuilder() | 47 | gson = new GsonBuilder() |
| @@ -95,6 +96,7 @@ public class Config { | |||
| 95 | this.identifierColor = 0x000000; | 96 | this.identifierColor = 0x000000; |
| 96 | this.defaultTextColor = 0x000000; | 97 | this.defaultTextColor = 0x000000; |
| 97 | this.useSystemLAF = true; | 98 | this.useSystemLAF = true; |
| 99 | this.useDraculaLAF = false; | ||
| 98 | this.saveConfig(); | 100 | this.saveConfig(); |
| 99 | } | 101 | } |
| 100 | 102 | ||
| @@ -113,4 +115,4 @@ public class Config { | |||
| 113 | public static Config getInstance() { | 115 | public static Config getInstance() { |
| 114 | return INSTANCE; | 116 | return INSTANCE; |
| 115 | } | 117 | } |
| 116 | } \ No newline at end of file | 118 | } |
diff --git a/src/main/java/cuchaz/enigma/config/Themes.java b/src/main/java/cuchaz/enigma/config/Themes.java index 04ecfde3..4b1f4784 100644 --- a/src/main/java/cuchaz/enigma/config/Themes.java +++ b/src/main/java/cuchaz/enigma/config/Themes.java | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | package cuchaz.enigma.config; | 1 | package cuchaz.enigma.config; |
| 2 | 2 | ||
| 3 | import com.bulenkov.darcula.DarculaLaf; | ||
| 3 | import cuchaz.enigma.gui.Gui; | 4 | import cuchaz.enigma.gui.Gui; |
| 4 | import cuchaz.enigma.gui.MinecraftSyntaxKit; | 5 | import cuchaz.enigma.gui.MinecraftSyntaxKit; |
| 5 | import cuchaz.enigma.gui.highlight.DeobfuscatedHighlightPainter; | 6 | import cuchaz.enigma.gui.highlight.DeobfuscatedHighlightPainter; |
| @@ -7,6 +8,7 @@ import cuchaz.enigma.gui.highlight.ObfuscatedHighlightPainter; | |||
| 7 | import cuchaz.enigma.gui.highlight.OtherHighlightPainter; | 8 | import cuchaz.enigma.gui.highlight.OtherHighlightPainter; |
| 8 | import de.sciss.syntaxpane.DefaultSyntaxKit; | 9 | import de.sciss.syntaxpane.DefaultSyntaxKit; |
| 9 | 10 | ||
| 11 | import javax.swing.*; | ||
| 10 | import java.awt.*; | 12 | import java.awt.*; |
| 11 | import java.io.IOException; | 13 | import java.io.IOException; |
| 12 | 14 | ||
| @@ -43,6 +45,7 @@ public class Themes { | |||
| 43 | Config.getInstance().typeColor = 0xF8F8F2; | 45 | Config.getInstance().typeColor = 0xF8F8F2; |
| 44 | Config.getInstance().identifierColor = 0xF8F8F2; | 46 | Config.getInstance().identifierColor = 0xF8F8F2; |
| 45 | Config.getInstance().defaultTextColor = 0xF8F8F2; | 47 | Config.getInstance().defaultTextColor = 0xF8F8F2; |
| 48 | Config.getInstance().useDraculaLAF = true; | ||
| 46 | updateTheme(gui); | 49 | updateTheme(gui); |
| 47 | } | 50 | } |
| 48 | 51 | ||
| @@ -60,7 +63,20 @@ public class Themes { | |||
| 60 | gui.otherHighlightPainter = new OtherHighlightPainter(); | 63 | gui.otherHighlightPainter = new OtherHighlightPainter(); |
| 61 | gui.editor.updateUI(); | 64 | gui.editor.updateUI(); |
| 62 | gui.editor.setBackground(new Color(Config.getInstance().editorBackground)); | 65 | gui.editor.setBackground(new Color(Config.getInstance().editorBackground)); |
| 66 | setLAF(); | ||
| 67 | SwingUtilities.updateComponentTreeUI(gui.getFrame()); | ||
| 63 | gui.getController().refreshCurrentClass(); | 68 | gui.getController().refreshCurrentClass(); |
| 64 | } | 69 | } |
| 65 | 70 | ||
| 71 | public static void setLAF(){ | ||
| 72 | try { | ||
| 73 | if (Config.getInstance().useDraculaLAF){ | ||
| 74 | UIManager.setLookAndFeel(new DarculaLaf()); | ||
| 75 | } else if (Config.getInstance().useSystemLAF) | ||
| 76 | UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); | ||
| 77 | } catch (Exception e){ | ||
| 78 | throw new Error("Failed to set LAF", e); | ||
| 79 | } | ||
| 80 | } | ||
| 81 | |||
| 66 | } | 82 | } |