diff options
Diffstat (limited to 'src/main/java/cuchaz/enigma/config')
| -rw-r--r-- | src/main/java/cuchaz/enigma/config/Config.java | 6 | ||||
| -rw-r--r-- | src/main/java/cuchaz/enigma/config/Themes.java | 16 |
2 files changed, 20 insertions, 2 deletions
diff --git a/src/main/java/cuchaz/enigma/config/Config.java b/src/main/java/cuchaz/enigma/config/Config.java index 75ced70..4441468 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 04ecfde..4b1f478 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 | } |