diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/AddDIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/AddDIns.java index b9c0945df..3f736a992 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/AddDIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/AddDIns.java @@ -32,7 +32,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; public class AddDIns extends InstructionDefinition { public AddDIns() { - super(0x9B, "add_d", new int[]{}, true /*?*/, AVM2InstructionFlag.NO_FLASH_PLAYER, AVM2InstructionFlag.UNKNOWN_OPERANDS, AVM2InstructionFlag.UNKNOWN_STACK); + super(0x9B, "add_d", new int[]{}, true /*?*/, AVM2InstructionFlag.NO_FLASH_PLAYER, AVM2InstructionFlag.UNKNOWN_OPERANDS, AVM2InstructionFlag.UNKNOWN_STACK, AVM2InstructionFlag.UNDOCUMENTED); } @Override 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 1ca24126b..6fee4e1bc 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 @@ -1,19 +1,29 @@ package com.jpexs.decompiler.flash.docs; +import com.jpexs.decompiler.flash.ApplicationInfo; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2InstructionFlag; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.helpers.Cache; import com.jpexs.helpers.Helper; +import com.jpexs.helpers.utf8.Utf8Helper; import java.io.IOException; +import java.io.InputStream; import java.io.UnsupportedEncodingException; +import java.text.DateFormat; +import java.text.SimpleDateFormat; import java.util.Arrays; +import java.util.Date; import java.util.HashMap; +import java.util.Locale; import java.util.Map; import java.util.Properties; import java.util.ResourceBundle; import java.util.Set; +import java.util.TimeZone; import java.util.TreeSet; +import java.util.logging.Level; +import java.util.logging.Logger; /** * Generator for AVM2 instruction set documentation. @@ -65,28 +75,74 @@ public class As3PCodeDocs { return identName.toString(); } - public static String getDocsForIns(String insName, boolean showDataSize, boolean ui) { + public static String getDocsForIns(String insName, boolean showDataSize, boolean ui, boolean withStyle) { if (!nameToDef.containsKey(insName)) { return null; } - return getDocsForIns(nameToDef.get(insName), showDataSize, ui); + return getDocsForIns(nameToDef.get(insName), showDataSize, ui, withStyle); } private static String getProperty(String name) { if (prop.containsKey(name)) { - return prop.getString(name); + return Helper.escapeHTML(prop.getString(name)); } return null; } - public static String getDocsForIns(InstructionDefinition def, boolean showDataSize, boolean ui) { - final String cacheKey = def.instructionName + "|" + (showDataSize ? 1 : 0) + "|" + (ui ? 1 : 0); + private static String htmlFooter() { + StringBuilder sb = new StringBuilder(); + + sb.append(""); + return sb.toString(); + } + + private static String meta(String name, String content) { + return "\t\t" + NEWLINE; + } + + private static String metaProp(String name, String content) { + return "\t\t" + NEWLINE; + } + + private static String meta(String name, Date content) { + return "\t\t" + NEWLINE; + } + + private static String htmlHeader(String js, String style) { + Date dateGenerated = new Date(); + StringBuilder sb = new StringBuilder(); + sb.append("").append(NEWLINE). + append("").append(NEWLINE). + append("\t").append(NEWLINE); + if (style != null && !style.isEmpty()) { + sb.append("\t\t").append(NEWLINE); + } + if (js != null && !js.isEmpty()) { + sb.append("\t\t").append(NEWLINE); + } + sb.append("\t\t").append(NEWLINE). + append(meta("generator", ApplicationInfo.applicationVerName)). + append(meta("description", getProperty("ui.list.pageDescription"))). + append(metaProp("og:title", getProperty("ui.list.pageTitle"))). + append(metaProp("og:type", "article")). + append(metaProp("og:description", getProperty("ui.list.pageDescription"))). + append(meta("date", dateGenerated)). + append("\t\t").append(getProperty("ui.list.documentTitle")).append("").append(NEWLINE). + append("\t").append(NEWLINE); + return sb.toString(); + } + + public static String getDocsForIns(InstructionDefinition def, boolean showDataSize, boolean ui, boolean standalone) { + final String cacheKey = def.instructionName + "|" + (showDataSize ? 1 : 0) + "|" + (ui ? 1 : 0) + "|" + (standalone ? 1 : 0); String v = docsCache.get(cacheKey); if (v != null) { return v; } StringBuilder sb = new StringBuilder(); + if (standalone) { + sb.append(htmlHeader("", getStyle())); + } String insName = def.instructionName; String insShortDescription = getProperty("instruction." + insName + ".shortDescription"); @@ -103,16 +159,31 @@ public class As3PCodeDocs { } else { stackAfter = getProperty("ui.stack.before") + stackAfter; } - String stack = def.hasFlag(AVM2InstructionFlag.UNKNOWN_STACK) ? getProperty("ui.unknown") : stackBefore + " => " + stackAfter; + stackBefore = "" + stackBefore + ""; + stackAfter = "" + stackAfter + ""; + + 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(String.format("0x%02X", def.instructionCode)).append(" ").append(insName).append("").append(" "); + sb.append("<"); + sb.append(standalone ? "body" : "div"); + sb.append(" class=\"instruction"); + + for (AVM2InstructionFlag fl : def.flags) { + sb.append(" instruction-flag-").append(makeIdent(fl.toString())); + } + sb.append("\">"); + + sb.append("
").append(String.format("0x%02X", def.instructionCode)).append(" ").append(insName).append(""); if (def.hasFlag(AVM2InstructionFlag.UNKNOWN_OPERANDS)) { - sb.append(getProperty("ui.unknown")).append(NEWLINE); + sb.append(" ").append(getProperty("ui.unknown")).append(NEWLINE); } else { String[] operandsDocs = operandsDoc.split(", ?"); boolean first = true; + if (def.operands.length > 0) { + sb.append(" "); + } for (int i = 0; i < def.operands.length; i++) { int op = def.operands[i]; String opDoc = operandsDocs[i]; @@ -154,67 +225,138 @@ public class As3PCodeDocs { } } } - sb.append(NEWLINE); + sb.append("
").append(NEWLINE); } - sb.append(insShortDescription).append(NEWLINE); + sb.append("
").append(insShortDescription).append("
").append(NEWLINE); if (!insDescription.trim().isEmpty()) { - sb.append(insDescription).append(NEWLINE); + sb.append("
").append("").append(getProperty("ui.description")).append("").append(insDescription).append("
").append(NEWLINE); } - - sb.append("").append(getProperty("ui.stack")).append("").append(stack).append(NEWLINE); + sb.append("
").append(getProperty("ui.stack")).append("").append(stack).append("").append("
").append(NEWLINE); boolean flagsPrinted = false; AVM2InstructionFlag flags[] = def.flags.clone(); Arrays.sort(flags, Enum::compareTo); for (AVM2InstructionFlag fl : flags) { - if (fl != AVM2InstructionFlag.UNKNOWN_OPERANDS && fl != AVM2InstructionFlag.UNKNOWN_STACK) { - if (!flagsPrinted) { - flagsPrinted = true; - sb.append("").append(getProperty("ui.flags")).append("").append(NEWLINE); - } - sb.append(getProperty("ui.flags.beginning")).append(flagDescriptions.get(fl)).append(NEWLINE); + if (!flagsPrinted) { + flagsPrinted = true; + sb.append("").append(getProperty("ui.flags")).append("").append("
").append(NEWLINE).append("").append(NEWLINE); + } + sb.append("").append(NEWLINE); + if (standalone) { + sb.append(htmlFooter()); } String r = sb.toString(); docsCache.put(cacheKey, r); return r; } - public static String getAllInstructionDocs() { - StringBuilder sb = new StringBuilder(); - String style = "li {list-style:none; padding:10px;border:1px solid black; border-bottom:none; border-collapse:collapse; } " + NEWLINE - + "ul {padding-left:0; display:table; border-bottom:1px solid black;}" + NEWLINE; + public static String getStyle() { + String cached = docsCache.get("__style"); + if (cached != null) { + return cached; + } + String style = ""; + try { + InputStream is = As3PCodeDocs.class.getResourceAsStream("/com/jpexs/decompiler/flash/docs/docs.css"); + if (is == null) { + Logger.getLogger(As3PCodeDocs.class.getName()).log(Level.SEVERE, "docs.css needed for documentation not found"); + } else { + style = new String(Helper.readStream(is), "UTF-8"); + } + } catch (UnsupportedEncodingException ex) { + //ignore + } + docsCache.put("__style", style); + return style; + } - sb.append("").append(NEWLINE). - append("").append(NEWLINE). - append("").append(NEWLINE). - append("").append(NEWLINE). - append("").append(NEWLINE). - append("").append(getProperty("ui.list.pageTitle")).append("").append(NEWLINE). - append("").append(NEWLINE). - append("").append(NEWLINE); - sb.append("

").append(getProperty("ui.list.heading")).append("

").append(NEWLINE); - sb.append("").append(NEWLINE); + sb.append("\t").append(NEWLINE); + sb.append(htmlFooter()); return sb.toString(); } - public static void main(String[] args) { + public static void main(String[] args) throws UnsupportedEncodingException { System.out.println(getAllInstructionDocs()); } } 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 new file mode 100644 index 000000000..807075899 --- /dev/null +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/docs/docs.css @@ -0,0 +1,15 @@ +html, body {margin:0px; padding: 0px;} +.instruction {background-color: #f5f5b5; color:black;} +li.instruction-item {list-style:none; padding:0px;border:1px solid black; border-bottom:none; border-collapse:collapse; } +ul.instruction-list {padding-left:0; display:table; border-bottom:1px solid black;} +strong.instruction-name {font-weight: bold; color: blue;} +strong.stack-title {font-weight: bold;} +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;} +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; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/docs/docs.js b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/docs/docs.js new file mode 100644 index 000000000..beeac0b56 --- /dev/null +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/docs/docs.js @@ -0,0 +1,152 @@ +function bind(el, evt, func) { + if (el.addEventListener){ + el.addEventListener(evt, func, false); + } else if (el.attachEvent) { + el.attachEvent('on' + evt, func); + } +} + +function showhide(e,show){ + var cls = " "+e.className+" "; + if(show && cls.indexOf(" hidden ") > -1){ + cls = cls.replace(" hidden "," "); + }else if(!show && cls.indexOf(" hidden ") == -1 ){ + cls = cls + "hidden "; + } + cls = cls.trim(); + e.className = cls; +} + +function hideNoName(name){ + var lis = document.getElementsByTagName("li"); + loopi:for(var i=0;i checkedVal) + { + smallestItem = lis[i]; + smallestVal = checkedVal; + } + break; + } + } + } + } + if(smallestItem != null){ + originalUl = smallestItem.parentNode; + originalUl.removeChild(smallestItem); + newUl.appendChild(smallestItem); + } + }while(smallestItem != null); + originalUl.parentNode.replaceChild(newUl,originalUl); + +} + +function applyFilter() { + var order_new = document.getElementById("filter_order").value; + if(order_set != order_new) { + order_set = order_new; + sortInstructions(order_new); + } + showFlags(true); + hideNoName(document.getElementById("filter-byname").value); + var inputs = document.getElementsByTagName("input"); + for(var i=0;i"; + + t += "
"; + t += ""; + t += ""; + t += "
"; + + t += "
"; + t += ""+txt_filter_hide+"
"; + for(var flag in flags){ + var flagDesc = flags[flag]; + var flagSet = flags_set[flag]; + t+= '
'; + } + + t += "
"; + t += ""; + t += ""; + t += "
"; + t += "
"; + + t += ""; //.filter + + + js_switcher.innerHTML = t; + applyFilter(); +} + +bind(window,"load",init); \ No newline at end of file diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/locales/docs/pcode/AS3.properties b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/locales/docs/pcode/AS3.properties index f3720c41a..7b58138d1 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/locales/docs/pcode/AS3.properties +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/locales/docs/pcode/AS3.properties @@ -16,14 +16,22 @@ #String for whole list generation ui.list.heading = AVM2 Instruction list ui.list.pageTitle = AVM2 Instruction list +ui.list.documentTitle = AVM2 Instruction list +ui.list.pageDescription = List of all known ActionScript 3 - AVM2 instructions with their operands and stack values #various strings in UI: ui.unknown = ??? ui.stack = Stack:\u0020 ui.stack.before = ...,\u0020 ui.stack.before.empty = ... +ui.stack.to = \u0020\u279e\u0020 ui.flags = Flags:\u0020 -ui.flags.beginning = \u0020-\u0020 +ui.description = Description:\u0020 +ui.filter.hide = Hide:\u0020 +ui.filter.byname = Find by name:\u0020 +ui.filter.order = Order by:\u0020 +ui.filter.order.code = code +ui.filter.order.name = name #----------------------- Flags of the instructions @@ -917,7 +925,7 @@ instruction.coerce.stackBefore = value instruction.coerce.stackAfter = coercedValue instruction.coerce.operands = type -instruction.coerce_b.shortDescription = Coerce value to boolean [Deprecated] +instruction.coerce_b.shortDescription = Coerce value to boolean instruction.coerce_b.description = instruction.coerce_b.stackBefore = value instruction.coerce_b.stackAfter = booleanValue @@ -1056,8 +1064,8 @@ instruction.inclocal_p.operands = numberContext, localRegister instruction.decrement_p.shortDescription = Decrement value using number context instruction.decrement_p.description = -instruction.decrement_p.stackBefore = -instruction.decrement_p.stackAfter = +instruction.decrement_p.stackBefore = value +instruction.decrement_p.stackAfter = decrementedValue instruction.decrement_p.operands = numberContext instruction.declocal_p.shortDescription = Decrement local register using number context @@ -1194,32 +1202,32 @@ instruction.in.operands = instruction.add_p.shortDescription = Add two values using number context instruction.add_p.description = -instruction.add_p.stackBefore = -instruction.add_p.stackAfter = +instruction.add_p.stackBefore = value1, value2 +instruction.add_p.stackAfter = value3 instruction.add_p.operands = numberContext instruction.subtract_p.shortDescription = Subtract two values using number context instruction.subtract_p.description = -instruction.subtract_p.stackBefore = -instruction.subtract_p.stackAfter = +instruction.subtract_p.stackBefore = value1, value2 +instruction.subtract_p.stackAfter = value3 instruction.subtract_p.operands = numberContext instruction.multiply_p.shortDescription = Multiply two values using number context instruction.multiply_p.description = -instruction.multiply_p.stackBefore = -instruction.multiply_p.stackAfter = +instruction.multiply_p.stackBefore = value1, value2 +instruction.multiply_p.stackAfter = value3 instruction.multiply_p.operands = numberContext instruction.divide_p.shortDescription = Divide two values using number context instruction.divide_p.description = -instruction.divide_p.stackBefore = -instruction.divide_p.stackAfter = +instruction.divide_p.stackBefore = value1, value2 +instruction.divide_p.stackAfter = value3 instruction.divide_p.operands = numberContext instruction.modulo_p.shortDescription = Modulo divide two values using number context instruction.modulo_p.description = -instruction.modulo_p.stackBefore = -instruction.modulo_p.stackAfter = +instruction.modulo_p.stackBefore = value1, value2 +instruction.modulo_p.stackAfter = value3 instruction.modulo_p.operands = numberContext instruction.increment_i.shortDescription = Increment integer value diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/locales/docs/pcode/AS3_cs.properties b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/locales/docs/pcode/AS3_cs.properties index e8aa78156..62957c305 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/locales/docs/pcode/AS3_cs.properties +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/locales/docs/pcode/AS3_cs.properties @@ -16,22 +16,29 @@ #String for whole list generation ui.list.heading = Seznam AVM2 instrukc\u00ed ui.list.pageTitle = Seznam AVM2 instrukc\u00ed +ui.list.documentTitle = Seznam AVM2 instrukc\u00ed +ui.list.pageDescription = Seznam v\u0161ech zn\u00e1m\u00fdch ActionScript 3 - AVM2 instrukc\u00ed s jejich operandy a hodnotami na z\u00e1sobn\u00edku #various strings in UI: ui.unknown = ??? ui.stack = Z\u00e1sobn\u00edk:\u0020 ui.stack.before = ...,\u0020 ui.stack.before.empty = ... +ui.stack.to = \u0020\u279e\u0020 ui.flags = P\u0159\u00edznaky:\u0020 -ui.flags.beginning = \u0020-\u0020 - +ui.description = Popis:\u0020 +ui.filter.hide = Skr\u00fdt:\u0020 +ui.filter.byname = Hledat podle n\u00e1zvu:\u0020 +ui.filter.order = Se\u0159adit podle:\u0020 +ui.filter.order.code = k\u00f3du +ui.filter.order.name = n\u00e1zvu #----------------------- Flags of the instructions instructionFlag.undocumented = Nedokumentovan\u00e9 instructionFlag.unknownStack = Nezn\u00e1m\u00fd z\u00e1sobn\u00edk instructionFlag.es4NumericsMinor = ES4 numerika (ABC minor 17) instructionFlag.floatMajor = Float hodnoty (ABC major 47) -instructionFlag.unknownOperands = Nezn\u00e1me operandy +instructionFlag.unknownOperands = Nezn\u00e1m\u00e9 operandy instructionFlag.noFlashPlayer = Nen\u00ed v standardn\u00edm Flash Playeru instructionFlag.deprecated = P\u0159ekonan\u00e9 instructionFlag.domainMemory = Operace s dom\u00e9novou pam\u011bt\u00ed diff --git a/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java b/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java index cdfc84c2f..9bf7c81a7 100644 --- a/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java +++ b/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java @@ -45,6 +45,7 @@ import com.jpexs.decompiler.flash.action.parser.pcode.ASMParser; import com.jpexs.decompiler.flash.action.parser.script.ActionScript2Parser; import com.jpexs.decompiler.flash.configuration.Configuration; import com.jpexs.decompiler.flash.configuration.ConfigurationItem; +import com.jpexs.decompiler.flash.docs.As3PCodeDocs; import com.jpexs.decompiler.flash.exporters.BinaryDataExporter; import com.jpexs.decompiler.flash.exporters.FontExporter; import com.jpexs.decompiler.flash.exporters.FrameExporter; @@ -163,6 +164,7 @@ import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.Map.Entry; import java.util.Stack; @@ -501,6 +503,19 @@ public class CommandLineArgumentParser { out.println(" ...Forwards all parameters after the -custom parameter to the plugins"); } + if (filter == null || filter.equals("doc")) { + out.println(" " + (cnt++) + ") -doc -type [-out ] [-format ] [-locale ]"); + out.println(" ...Generate documentation"); + out.println(" ...-type Selects documentation type"); + out.println(" ... can be currently only: as3.pcode.instructions for list of ActionScript3 AVM2 instructions"); + out.println(" ...-out (optional) If specified, output is written to instead of stdout"); + out.println(" ...-format (optional, html is default) Selects output format"); + out.println(" ... is currently only html"); + out.println(" ...-locale (optional) Override default locale"); + out.println(" ... is localization identifier, en for english for example"); + out.println(" ... is currently only html"); + } + printCmdLineUsageExamples(out, filter); } @@ -562,6 +577,12 @@ public class CommandLineArgumentParser { exampleFound = true; } + if (filter == null || filter.equals("doc")) { + out.println("java -jar ffdec.jar -doc -type as3.pcode.instructions -format html"); + out.println("java -jar ffdec.jar -doc -type as3.pcode.instructions -format html -locale en -out as3_docs_en.html"); + exampleFound = true; + } + if (!exampleFound) { out.println("Sorry, no example found for command " + filter + ", Let us know in issue tracker when you need it."); } @@ -734,6 +755,8 @@ public class CommandLineArgumentParser { parseRemoveCharacter(args, false); } else if (command.equals("removecharacterwithdependencies")) { parseRemoveCharacter(args, true); + } else if (command.equals("doc")) { + parseDoc(args); } else if (command.equals("importscript")) { parseImportScript(args); } else if (command.equals("importscript")) { @@ -2535,6 +2558,77 @@ public class CommandLineArgumentParser { } } + private static void parseDoc(Stack args) { + String type = null; + String format = null; + String out = null; + String locale = null; + while (!args.isEmpty()) { + String arg = args.pop(); + switch (arg) { + case "-out": + if (args.isEmpty() || out != null) { + badArguments("doc"); + } + out = arg; + break; + case "-type": + if (args.isEmpty() || type != null) { + badArguments("doc"); + } + type = args.pop(); + break; + case "-format": + if (args.isEmpty() || format != null) { + badArguments("doc"); + } + format = args.pop(); + break; + case "-locale": + if (args.isEmpty() || locale != null) { + badArguments("doc"); + } + locale = args.pop(); + + break; + } + } + + if (format == null) { + format = "html"; + } + if (type == null) { + badArguments("doc"); + } else if (!type.equals("as3.pcode.instructions")) { + badArguments("doc"); + } + + if (!format.equals("html")) { + badArguments("doc"); + } + if (locale != null) { + Locale.setDefault(Locale.forLanguageTag(locale)); + } + + String doc = As3PCodeDocs.getAllInstructionDocs(); + + PrintStream outStream; + + if (out == null) { + outStream = System.out; + } else { + try { + outStream = new PrintStream(out); + } catch (FileNotFoundException ex) { + Logger.getLogger(CommandLineArgumentParser.class.getName()).log(Level.SEVERE, ex.getLocalizedMessage()); + System.exit(1); + return; + } + } + + outStream.print(doc); + } + private static void parseRemoveCharacter(Stack args, boolean removeDependencies) { if (args.size() < 3) { badArguments("removecharacter"); diff --git a/src/com/jpexs/decompiler/flash/gui/DocsPanel.java b/src/com/jpexs/decompiler/flash/gui/DocsPanel.java index 5d3cd1905..41cca1db6 100644 --- a/src/com/jpexs/decompiler/flash/gui/DocsPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/DocsPanel.java @@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.gui.abc.DocsListener; import java.awt.BorderLayout; import java.awt.Color; import java.awt.HeadlessException; +import java.awt.Insets; import java.awt.Point; import java.util.logging.Level; import java.util.logging.Logger; @@ -36,25 +37,31 @@ import javax.swing.JScrollPane; public class DocsPanel extends JPanel implements DocsListener { private JEditorPane textDisplay = new JEditorPane(); - //TODO: Make this use skin somehow (?) - public static final Color HINT_COLOR = new Color(245, 245, 181); public DocsPanel() { - setLayout(new BorderLayout()); - add(new JScrollPane(textDisplay), BorderLayout.CENTER); + setLayout(new BorderLayout(0, 0)); + JScrollPane sp = new JScrollPane(textDisplay); + + textDisplay.setMargin(new Insets(0, 0, 0, 0)); + add(sp, BorderLayout.CENTER); textDisplay.setContentType("text/html"); textDisplay.setFocusable(false); - textDisplay.setBackground(HINT_COLOR); + textDisplay.setBackground(Color.white); + } + + @Override + public Insets getInsets() { + return new Insets(0, 0, 0, 0); } @Override public void docs(String identifier, String docs, Point screenLocation) { - textDisplay.setText(docs.replace("\r\n", "
")); + textDisplay.setText(docs); } @Override public void noDocs() { - textDisplay.setText(""); + textDisplay.setText(""); } } diff --git a/src/com/jpexs/decompiler/flash/gui/abc/ASMSourceEditorPane.java b/src/com/jpexs/decompiler/flash/gui/abc/ASMSourceEditorPane.java index f12baec3f..b3129f55e 100644 --- a/src/com/jpexs/decompiler/flash/gui/abc/ASMSourceEditorPane.java +++ b/src/com/jpexs/decompiler/flash/gui/abc/ASMSourceEditorPane.java @@ -444,7 +444,7 @@ public class ASMSourceEditorPane extends DebuggableEditorPane implements CaretLi if (loc != null) { SwingUtilities.convertPointToScreen(loc, this); } - fireDocs(insName, As3PCodeDocs.getDocsForIns(insName, false, true), loc); + fireDocs(insName, As3PCodeDocs.getDocsForIns(insName, false, true, true), loc); } else { fireNoDocs(); }