summaryrefslogtreecommitdiff
path: root/src/main/java/cuchaz/enigma/config
diff options
context:
space:
mode:
authorGravatar Gegy2019-01-30 21:05:32 +0200
committerGravatar GitHub2019-01-30 21:05:32 +0200
commitba7a354efae7d49833c887cf147ac940c975a1fa (patch)
tree02e14fda81dd5984e24f2df392c57c6e829fc875 /src/main/java/cuchaz/enigma/config
parentRewrite the Jenkinsfile to use the new declarative pipeline syntax, lets hope... (diff)
downloadenigma-fork-ba7a354efae7d49833c887cf147ac940c975a1fa.tar.gz
enigma-fork-ba7a354efae7d49833c887cf147ac940c975a1fa.tar.xz
enigma-fork-ba7a354efae7d49833c887cf147ac940c975a1fa.zip
Remap sources (#106)
* Source remapping beginnings * Fix navigation to remapped classes * Translate identifier info reference * Remap local variables with default names in source * Caching translator * Fix lack of highlighting for first opened class * Fix unicode variable names * Unicode checker shouldn't be checking just alphanumeric * Fix package tree being built from obf names * Don't index `this` as method call for method::reference * Apply proposed names * Fix source export issues * Replace unicode var names at bytecode level uniquely * Drop imports from editor source * Class selector fixes * Delta keep track of base mappings to enable lookup of old names * Optimize source remapping by remapping source with a StringBuffer instead of copying * Bump version
Diffstat (limited to 'src/main/java/cuchaz/enigma/config')
-rw-r--r--src/main/java/cuchaz/enigma/config/Config.java5
-rw-r--r--src/main/java/cuchaz/enigma/config/Themes.java17
2 files changed, 11 insertions, 11 deletions
diff --git a/src/main/java/cuchaz/enigma/config/Config.java b/src/main/java/cuchaz/enigma/config/Config.java
index 55f867e..6f5a337 100644
--- a/src/main/java/cuchaz/enigma/config/Config.java
+++ b/src/main/java/cuchaz/enigma/config/Config.java
@@ -74,7 +74,6 @@ public class Config {
74 config.proposedColorOutline = new AlphaColorEntry(0x000000, 0.15f); 74 config.proposedColorOutline = new AlphaColorEntry(0x000000, 0.15f);
75 config.deobfuscatedColor = new AlphaColorEntry(0xDCFFDC, 1.0f); 75 config.deobfuscatedColor = new AlphaColorEntry(0xDCFFDC, 1.0f);
76 config.deobfuscatedColorOutline = new AlphaColorEntry(0x50A050, 1.0f); 76 config.deobfuscatedColorOutline = new AlphaColorEntry(0x50A050, 1.0f);
77 config.otherColorOutline = new AlphaColorEntry(0xB4B4B4, 1.0f);
78 config.editorBackground = 0xFFFFFF; 77 config.editorBackground = 0xFFFFFF;
79 config.highlightColor = 0x3333EE; 78 config.highlightColor = 0x3333EE;
80 config.caretColor = 0x000000; 79 config.caretColor = 0x000000;
@@ -98,7 +97,6 @@ public class Config {
98 config.deobfuscatedColorOutline = new AlphaColorEntry(0x50FA7B, 0.5f); 97 config.deobfuscatedColorOutline = new AlphaColorEntry(0x50FA7B, 0.5f);
99 config.proposedColor = new AlphaColorEntry(0x606366, 0.3f); 98 config.proposedColor = new AlphaColorEntry(0x606366, 0.3f);
100 config.proposedColorOutline = new AlphaColorEntry(0x606366, 0.5f); 99 config.proposedColorOutline = new AlphaColorEntry(0x606366, 0.5f);
101 config.otherColorOutline = new AlphaColorEntry(0xB4B4B4, 0.0f);
102 config.editorBackground = 0x282A36; 100 config.editorBackground = 0x282A36;
103 config.highlightColor = 0xFF79C6; 101 config.highlightColor = 0xFF79C6;
104 config.caretColor = 0xF8F8F2; 102 config.caretColor = 0xF8F8F2;
@@ -128,7 +126,6 @@ public class Config {
128 public AlphaColorEntry proposedColorOutline; 126 public AlphaColorEntry proposedColorOutline;
129 public AlphaColorEntry deobfuscatedColor; 127 public AlphaColorEntry deobfuscatedColor;
130 public AlphaColorEntry deobfuscatedColorOutline; 128 public AlphaColorEntry deobfuscatedColorOutline;
131 public AlphaColorEntry otherColorOutline;
132 129
133 public Integer editorBackground; 130 public Integer editorBackground;
134 public Integer highlightColor; 131 public Integer highlightColor;
@@ -198,12 +195,14 @@ public class Config {
198 } 195 }
199 196
200 private static class IntSerializer implements JsonSerializer<Integer> { 197 private static class IntSerializer implements JsonSerializer<Integer> {
198 @Override
201 public JsonElement serialize(Integer src, Type typeOfSrc, JsonSerializationContext context) { 199 public JsonElement serialize(Integer src, Type typeOfSrc, JsonSerializationContext context) {
202 return new JsonPrimitive("#" + Integer.toHexString(src).toUpperCase()); 200 return new JsonPrimitive("#" + Integer.toHexString(src).toUpperCase());
203 } 201 }
204 } 202 }
205 203
206 private static class IntDeserializer implements JsonDeserializer<Integer> { 204 private static class IntDeserializer implements JsonDeserializer<Integer> {
205 @Override
207 public Integer deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) { 206 public Integer deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) {
208 return (int) Long.parseLong(json.getAsString().replace("#", ""), 16); 207 return (int) Long.parseLong(json.getAsString().replace("#", ""), 16);
209 } 208 }
diff --git a/src/main/java/cuchaz/enigma/config/Themes.java b/src/main/java/cuchaz/enigma/config/Themes.java
index 00324f4..400ea3f 100644
--- a/src/main/java/cuchaz/enigma/config/Themes.java
+++ b/src/main/java/cuchaz/enigma/config/Themes.java
@@ -4,6 +4,7 @@ import com.google.common.collect.ImmutableMap;
4import cuchaz.enigma.gui.Gui; 4import cuchaz.enigma.gui.Gui;
5import cuchaz.enigma.gui.EnigmaSyntaxKit; 5import cuchaz.enigma.gui.EnigmaSyntaxKit;
6import cuchaz.enigma.gui.highlight.BoxHighlightPainter; 6import cuchaz.enigma.gui.highlight.BoxHighlightPainter;
7import cuchaz.enigma.gui.highlight.TokenHighlightType;
7import de.sciss.syntaxpane.DefaultSyntaxKit; 8import de.sciss.syntaxpane.DefaultSyntaxKit;
8 9
9import javax.swing.*; 10import javax.swing.*;
@@ -17,10 +18,11 @@ public class Themes {
17 } 18 }
18 19
19 public static void updateTheme(Gui gui) { 20 public static void updateTheme(Gui gui) {
20 Config.getInstance().lookAndFeel.apply(Config.getInstance()); 21 Config config = Config.getInstance();
21 Config.getInstance().lookAndFeel.setGlobalLAF(); 22 config.lookAndFeel.apply(config);
23 config.lookAndFeel.setGlobalLAF();
22 try { 24 try {
23 Config.getInstance().saveConfig(); 25 config.saveConfig();
24 } catch (IOException e) { 26 } catch (IOException e) {
25 e.printStackTrace(); 27 e.printStackTrace();
26 } 28 }
@@ -28,12 +30,11 @@ public class Themes {
28 DefaultSyntaxKit.initKit(); 30 DefaultSyntaxKit.initKit();
29 DefaultSyntaxKit.registerContentType("text/enigma-sources", EnigmaSyntaxKit.class.getName()); 31 DefaultSyntaxKit.registerContentType("text/enigma-sources", EnigmaSyntaxKit.class.getName());
30 gui.boxHighlightPainters = ImmutableMap.of( 32 gui.boxHighlightPainters = ImmutableMap.of(
31 "obfuscated", BoxHighlightPainter.create(Config.getInstance().obfuscatedColor, Config.getInstance().obfuscatedColorOutline), 33 TokenHighlightType.OBFUSCATED, BoxHighlightPainter.create(config.obfuscatedColor, config.obfuscatedColorOutline),
32 "proposed", BoxHighlightPainter.create(Config.getInstance().proposedColor, Config.getInstance().proposedColorOutline), 34 TokenHighlightType.PROPOSED, BoxHighlightPainter.create(config.proposedColor, config.proposedColorOutline),
33 "deobfuscated", BoxHighlightPainter.create(Config.getInstance().deobfuscatedColor, Config.getInstance().deobfuscatedColorOutline), 35 TokenHighlightType.DEOBFUSCATED, BoxHighlightPainter.create(config.deobfuscatedColor, config.deobfuscatedColorOutline)
34 "other", BoxHighlightPainter.create(null, Config.getInstance().otherColorOutline)
35 ); 36 );
36 gui.setEditorTheme(Config.getInstance().lookAndFeel); 37 gui.setEditorTheme(config.lookAndFeel);
37 SwingUtilities.updateComponentTreeUI(gui.getFrame()); 38 SwingUtilities.updateComponentTreeUI(gui.getFrame());
38 } 39 }
39} 40}