diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/docs/As3PCodeDocs.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/docs/As3PCodeDocs.java
index f2f42ffeb..ecc3e2d5e 100644
--- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/docs/As3PCodeDocs.java
+++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/docs/As3PCodeDocs.java
@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this library.
*/
+ * License along with this library.
+ */
package com.jpexs.decompiler.flash.docs;
import com.jpexs.decompiler.flash.ApplicationInfo;
@@ -82,14 +83,14 @@ public class As3PCodeDocs extends AbstractDocs {
return identName.toString();
}
- public static String getDocsForIns(String insName, boolean showDataSize, boolean ui, boolean withStyle) {
+ public static String getDocsForIns(String insName, boolean showDataSize, boolean ui, boolean withStyle, boolean nightMode) {
if (!nameToDef.containsKey(insName)) {
return null;
}
- return getDocsForIns(nameToDef.get(insName), showDataSize, ui, withStyle);
+ return getDocsForIns(nameToDef.get(insName), showDataSize, ui, withStyle, nightMode);
}
- public static String getDocsForIns(InstructionDefinition def, boolean showDataSize, boolean ui, boolean standalone) {
+ public static String getDocsForIns(InstructionDefinition def, boolean showDataSize, boolean ui, boolean standalone, boolean nightMode) {
final String cacheKey = def.instructionName + "|" + (showDataSize ? 1 : 0) + "|" + (ui ? 1 : 0) + "|" + (standalone ? 1 : 0);
String v = docsCache.get(cacheKey);
if (v != null) {
@@ -98,7 +99,7 @@ public class As3PCodeDocs extends AbstractDocs {
StringBuilder sb = new StringBuilder();
if (standalone) {
- sb.append(htmlHeader("", getStyle()));
+ sb.append(htmlHeader("", getStyle(), nightMode));
}
String insName = def.instructionName;
@@ -122,9 +123,17 @@ public class As3PCodeDocs extends AbstractDocs {
String stack = def.hasFlag(AVM2InstructionFlag.UNKNOWN_STACK) ? getProperty("ui.unknown") : stackBefore + "" + getProperty("ui.stack.to") + "" + stackAfter;
String operandsDoc = def.hasFlag(AVM2InstructionFlag.UNKNOWN_OPERANDS) ? getProperty("ui.unknown") : getProperty("instruction." + insName + ".operands");
- sb.append("<");
- sb.append(standalone ? "body" : "div");
- sb.append(" class=\"instruction");
+ if (standalone) {
+ sb.append("
");
+ }
+
+ sb.append("").append(NEWLINE);
}
- sb.append("");
- sb.append(standalone ? "body" : "div"); //.instruction
- sb.append(">").append(NEWLINE);
+ sb.append("
").append(NEWLINE); //.instruction
if (standalone) {
+ sb.append("");
sb.append(htmlFooter());
}
String r = sb.toString();
@@ -241,7 +249,7 @@ public class As3PCodeDocs extends AbstractDocs {
return js;
}
- public static String getAllInstructionDocs() {
+ public static String getAllInstructionDocs(boolean nightMode) {
String jsData = "";
jsData += "var txt_filter_hide = \"" + getProperty("ui.filter.hide") + "\";" + NEWLINE;
@@ -264,7 +272,12 @@ public class As3PCodeDocs extends AbstractDocs {
}
StringBuilder sb = new StringBuilder();
- sb.append(htmlHeader(jsData + getJs(), getStyle()));
+ sb.append(htmlHeader(jsData + getJs(), getStyle(), nightMode));
+ sb.append("");
sb.append("\t\t").append(getProperty("ui.list.heading")).append("
").append(NEWLINE);
sb.append("");
sb.append("\t\t").append(NEWLINE);
@@ -275,7 +288,7 @@ public class As3PCodeDocs extends AbstractDocs {
continue;
}
sb.append("\t\t\t- ").append(NEWLINE);
- sb.append("\t\t\t\t").append(getDocsForIns(def, true, false, false).trim().replace(NEWLINE, NEWLINE + "\t\t\t\t")).append(NEWLINE);
+ sb.append("\t\t\t\t").append(getDocsForIns(def, true, false, false, nightMode).trim().replace(NEWLINE, NEWLINE + "\t\t\t\t")).append(NEWLINE);
sb.append("\t\t\t
").append(NEWLINE);
}
sb.append("\t\t
").append(NEWLINE);
@@ -285,10 +298,10 @@ public class As3PCodeDocs extends AbstractDocs {
}
public static void main(String[] args) throws UnsupportedEncodingException {
- System.out.println(getAllInstructionDocs());
+ System.out.println(getAllInstructionDocs(false));
}
- protected static String htmlHeader(String js, String style) {
+ protected static String htmlHeader(String js, String style, boolean nightMode) {
Date dateGenerated = new Date();
StringBuilder sb = new StringBuilder();
sb.append("").append(NEWLINE).
diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/docs/As3PCodeOtherDocs.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/docs/As3PCodeOtherDocs.java
index aa9f8b17d..2f715bf6c 100644
--- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/docs/As3PCodeOtherDocs.java
+++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/docs/As3PCodeOtherDocs.java
@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this library.
*/
+ * License along with this library.
+ */
package com.jpexs.decompiler.flash.docs;
import com.jpexs.decompiler.flash.ApplicationInfo;
@@ -30,12 +31,12 @@ public class As3PCodeOtherDocs extends AbstractDocs {
prop = ResourceBundle.getBundle("com.jpexs.decompiler.flash.locales.docs.pcode.AS3other");
}
- public static String getDocsForPath(String path) {
+ public static String getDocsForPath(String path, boolean nightMode) {
- return getDocsForPath(path, true);
+ return getDocsForPath(path, true, nightMode);
}
- private static String getDocsForPath(String path, boolean standalone) {
+ private static String getDocsForPath(String path, boolean standalone, boolean nightMode) {
final String cacheKey = path + "|" + (standalone ? 1 : 0);
String v = docsCache.get(cacheKey);
@@ -53,10 +54,16 @@ public class As3PCodeOtherDocs extends AbstractDocs {
sb.append(htmlHeader("", getStyle()));
}
- sb.append("<");
- sb.append(standalone ? "body" : "div");
- sb.append(" class=\"otherdoc\"");
- sb.append(">");
+ if (standalone) {
+ sb.append("");
+ }
+ sb.append("");
String pathParts[] = new String[]{path};
if (path.contains(".")) {
@@ -88,10 +95,9 @@ public class As3PCodeOtherDocs extends AbstractDocs {
}
}
- sb.append("");
- sb.append(standalone ? "body" : "div"); //.instruction
- sb.append(">").append(NEWLINE);
+ sb.append("
").append(NEWLINE); //.instruction
if (standalone) {
+ sb.append("");
sb.append(htmlFooter());
}
String r = sb.toString();
diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/docs/docs.css b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/docs/docs.css
index d21c1a291..781d1b5ab 100644
--- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/docs/docs.css
+++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/docs/docs.css
@@ -9,11 +9,25 @@ strong.flags-title {font-weight: bold;}
.hidden {display:none}
.filter-flag-title {display:inline-block; width: 50ex;}
.instruction {padding:5px;}
-.instruction.instruction-flag-noFlashPlayer {background-color: #ccc;}
+.instruction.instruction-flag-noFlashPlayer {background-color: #cccccc;}
body {font-family: serif;}
h1, h2, h3, h4, h5 {font-family: sans-serif;}
.instruction-signature {font-family: "Courier New", monospace; font-size: 1.05em;}
.filter {font-family: sans-serif; }
.path {font-weight: bold; color: blue;}
.path-block {}
-.path-docs {}
\ No newline at end of file
+.path-docs {}
+
+
+.night {background-color: red;}
+
+body.standalone {background-color: #f5f5b5;}
+body.standalonenight {background-color: #330;}
+
+body.standalonenight .instruction {background-color: #330; color:white;}
+body.standalonenight .otherdoc {background-color: #330; color:white;}
+body.standalonenight .instruction.instruction-flag-noFlashPlayer {background-color: #333;}
+
+body.standalonenight strong.instruction-name {color: #88f;}
+
+body.standalonenight .path {color: #88f;}
diff --git a/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java b/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java
index 0d3cebb25..433cf5a64 100644
--- a/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java
+++ b/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java
@@ -3369,9 +3369,13 @@ public class CommandLineArgumentParser {
String format = null;
String out = null;
String locale = null;
+ boolean nightMode = false;
while (!args.isEmpty()) {
String arg = args.pop();
switch (arg) {
+ case "-night":
+ nightMode = true;
+ break;
case "-out":
if (args.isEmpty() || out != null) {
badArguments("doc");
@@ -3416,7 +3420,7 @@ public class CommandLineArgumentParser {
Locale.setDefault(Locale.forLanguageTag(locale));
}
- String doc = As3PCodeDocs.getAllInstructionDocs();
+ String doc = As3PCodeDocs.getAllInstructionDocs(nightMode);
PrintStream outStream;
diff --git a/src/com/jpexs/decompiler/flash/gui/abc/ASMSourceEditorPane.java b/src/com/jpexs/decompiler/flash/gui/abc/ASMSourceEditorPane.java
index 8bab5de83..cd80449db 100644
--- a/src/com/jpexs/decompiler/flash/gui/abc/ASMSourceEditorPane.java
+++ b/src/com/jpexs/decompiler/flash/gui/abc/ASMSourceEditorPane.java
@@ -47,6 +47,7 @@ import com.jpexs.decompiler.flash.tags.ABCContainerTag;
import com.jpexs.decompiler.flash.tags.Tag;
import com.jpexs.decompiler.graph.ScopeStack;
import com.jpexs.helpers.Helper;
+import java.awt.Color;
import java.awt.Point;
import java.io.IOException;
import java.io.StringReader;
@@ -60,6 +61,7 @@ import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
import javax.swing.event.CaretEvent;
import javax.swing.event.CaretListener;
@@ -593,6 +595,10 @@ public class ASMSourceEditorPane extends DebuggableEditorPane implements CaretLi
public void updateDocs() {
String path = getLevel();
+ Color c = UIManager.getColor("EditorPane.background");
+ int light = (c.getRed() + c.getGreen() + c.getBlue()) / 3;
+ boolean nightMode = light <= 128;
+
String pathNoTrait = path;
if (path.startsWith("trait.method")) {
pathNoTrait = path.substring("trait.".length());
@@ -626,11 +632,12 @@ public class ASMSourceEditorPane extends DebuggableEditorPane implements CaretLi
SwingUtilities.convertPointToScreen(loc, this);
}
if (insNameToDef.containsKey(insName)) {
- fireDocs("instruction." + insName, As3PCodeDocs.getDocsForIns(insName, false, true, true), loc);
+
+ fireDocs("instruction." + insName, As3PCodeDocs.getDocsForIns(insName, false, true, true, nightMode), loc);
return;
}
}
- String pathDocs = As3PCodeOtherDocs.getDocsForPath(pathNoTrait);
+ String pathDocs = As3PCodeOtherDocs.getDocsForPath(pathNoTrait, nightMode);
if (pathDocs == null) {
fireNoDocs();
} else {