diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c6e952ef..850c33cbc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ All notable changes to this project will be documented in this file. - [#1371] Go to character id (Ctrl+G in tag tree) - [#1156] FLA, SVG, Canvas Export - 9 slice scaling (DefineScalingGrid) - [#843] Compound assignments (like +=) decompilation and direct editation +- [#1221] Separate icons for different actionscript objects (class/interface/frame/) ### Changed - [#1471] Import script menuitem renamed to Import scripts. @@ -2094,6 +2095,7 @@ All notable changes to this project will be documented in this file. [#1371]: https://www.free-decompiler.com/flash/issues/1371 [#1156]: https://www.free-decompiler.com/flash/issues/1156 [#843]: https://www.free-decompiler.com/flash/issues/843 +[#1221]: https://www.free-decompiler.com/flash/issues/1221 [#1471]: https://www.free-decompiler.com/flash/issues/1471 [#1396]: https://www.free-decompiler.com/flash/issues/1396 [#1254]: https://www.free-decompiler.com/flash/issues/1254 diff --git a/graphics/scripticons16.xcf b/graphics/scripticons16.xcf new file mode 100644 index 000000000..d415b402f Binary files /dev/null and b/graphics/scripticons16.xcf differ diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ScriptPack.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ScriptPack.java index 514f642d5..f2fb15686 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ScriptPack.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ScriptPack.java @@ -122,6 +122,17 @@ public class ScriptPack extends AS3ClassTreeItem { return packageName; } + public Trait getPublicTrait() { + for (int t : traitIndices) { + Multiname name = abc.script_info.get(scriptIndex).traits.traits.get(t).getName(abc); + Namespace ns = name.getNamespace(abc.constants); + if ((ns.kind == Namespace.KIND_PACKAGE) || (ns.kind == Namespace.KIND_PACKAGE_INTERNAL)) { + return abc.script_info.get(scriptIndex).traits.traits.get(t); + } + } + return null; + } + public String getPathScriptName() { String scriptName = ""; for (int t : traitIndices) { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/configuration/Configuration.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/configuration/Configuration.java index e2246a2ef..80a067fb6 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/configuration/Configuration.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/configuration/Configuration.java @@ -693,6 +693,10 @@ public final class Configuration { @ConfigurationCategory("ui") public static ConfigurationItem displayAs3TraitsListAndConstantsPanel = null; + @ConfigurationDefaultBoolean(true) + @ConfigurationCategory("ui") + public static ConfigurationItem useAsTypeIcons = null; + private enum OSId { WINDOWS, OSX, UNIX } diff --git a/src/com/jpexs/decompiler/flash/gui/MainPanel.java b/src/com/jpexs/decompiler/flash/gui/MainPanel.java index 85b21349f..28fddaacd 100644 --- a/src/com/jpexs/decompiler/flash/gui/MainPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/MainPanel.java @@ -1264,6 +1264,9 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se if (nodeType == TreeNodeType.AS) { as12scripts.add(d); } + if (nodeType == TreeNodeType.AS_FRAME) { + as12scripts.add(d); + } if (nodeType == TreeNodeType.MOVIE) { movies.add((Tag) d); } diff --git a/src/com/jpexs/decompiler/flash/gui/TreeNodeType.java b/src/com/jpexs/decompiler/flash/gui/TreeNodeType.java index 57db0df21..277704657 100644 --- a/src/com/jpexs/decompiler/flash/gui/TreeNodeType.java +++ b/src/com/jpexs/decompiler/flash/gui/TreeNodeType.java @@ -32,6 +32,15 @@ public enum TreeNodeType { SPRITE, BUTTON, AS, + AS_CLASS, + AS_INTERFACE, + AS_FRAME, + AS_FUNCTION, + AS_VAR, + AS_CONST, + AS_BUTTON, + AS_CLIP, + AS_INIT, PACKAGE, FRAME, SHOW_FRAME, diff --git a/src/com/jpexs/decompiler/flash/gui/graphics/asbutton16.png b/src/com/jpexs/decompiler/flash/gui/graphics/asbutton16.png new file mode 100644 index 000000000..bbf6c6b66 Binary files /dev/null and b/src/com/jpexs/decompiler/flash/gui/graphics/asbutton16.png differ diff --git a/src/com/jpexs/decompiler/flash/gui/graphics/asclass16.png b/src/com/jpexs/decompiler/flash/gui/graphics/asclass16.png new file mode 100644 index 000000000..a6808fd94 Binary files /dev/null and b/src/com/jpexs/decompiler/flash/gui/graphics/asclass16.png differ diff --git a/src/com/jpexs/decompiler/flash/gui/graphics/asclip16.png b/src/com/jpexs/decompiler/flash/gui/graphics/asclip16.png new file mode 100644 index 000000000..3d84d78a9 Binary files /dev/null and b/src/com/jpexs/decompiler/flash/gui/graphics/asclip16.png differ diff --git a/src/com/jpexs/decompiler/flash/gui/graphics/asconst16.png b/src/com/jpexs/decompiler/flash/gui/graphics/asconst16.png new file mode 100644 index 000000000..b41a8a2e1 Binary files /dev/null and b/src/com/jpexs/decompiler/flash/gui/graphics/asconst16.png differ diff --git a/src/com/jpexs/decompiler/flash/gui/graphics/asframe16.png b/src/com/jpexs/decompiler/flash/gui/graphics/asframe16.png new file mode 100644 index 000000000..e0ff0e02c Binary files /dev/null and b/src/com/jpexs/decompiler/flash/gui/graphics/asframe16.png differ diff --git a/src/com/jpexs/decompiler/flash/gui/graphics/asfunction16.png b/src/com/jpexs/decompiler/flash/gui/graphics/asfunction16.png new file mode 100644 index 000000000..669c82331 Binary files /dev/null and b/src/com/jpexs/decompiler/flash/gui/graphics/asfunction16.png differ diff --git a/src/com/jpexs/decompiler/flash/gui/graphics/asinit16.png b/src/com/jpexs/decompiler/flash/gui/graphics/asinit16.png new file mode 100644 index 000000000..a15f29e5f Binary files /dev/null and b/src/com/jpexs/decompiler/flash/gui/graphics/asinit16.png differ diff --git a/src/com/jpexs/decompiler/flash/gui/graphics/asinterface16.png b/src/com/jpexs/decompiler/flash/gui/graphics/asinterface16.png new file mode 100644 index 000000000..bfbfd52e6 Binary files /dev/null and b/src/com/jpexs/decompiler/flash/gui/graphics/asinterface16.png differ diff --git a/src/com/jpexs/decompiler/flash/gui/graphics/asvar16.png b/src/com/jpexs/decompiler/flash/gui/graphics/asvar16.png new file mode 100644 index 000000000..2ac95102d Binary files /dev/null and b/src/com/jpexs/decompiler/flash/gui/graphics/asvar16.png differ diff --git a/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog.properties b/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog.properties index 69e65b377..11649929b 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog.properties @@ -516,3 +516,7 @@ config.description.displayAs3PCodeDocsPanel = Show panel with documentation of i config.name.displayAs3TraitsListAndConstantsPanel = Show AS3 traits list and constants panel config.description.displayAs3TraitsListAndConstantsPanel = Show panel with list of traits and constants under the tag tree for AS3 + +config.name.useAsTypeIcons = Use script icons based on item type +config.description.useAsTypeIcons = Use different icons for different script types (class/interface/frame/...) + diff --git a/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog_cs.properties b/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog_cs.properties index 2639de861..be645ed9c 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog_cs.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog_cs.properties @@ -498,4 +498,16 @@ config.name.checkForModifications = Kontrolovat zm\u011bny soubor\u016f mimo FFD config.description.checkForModifications = Kontrolovat zm\u011bny soubor\u016f jin\u00fdmi aplikacemi a pt\u00e1t se na nov\u00e9 na\u010dten\u00ed config.name.warning.initializers = Varovat p\u0159i AS3 slot/const editaci o inicializ\u00e1torech -config.description.warning.initializers = Zobrazovat varov\u00e1n\u00ed p\u0159i editaci AS3 slot/const o inicializ\u00e1torech \ No newline at end of file +config.description.warning.initializers = Zobrazovat varov\u00e1n\u00ed p\u0159i editaci AS3 slot/const o inicializ\u00e1torech + +config.name.parametersPanelInSearchResults = Zobrazit panel s parametry ve v\u00fdsledc\u00edch vyhled\u00e1v\u00e1n\u00ed +config.description.parametersPanelInSearchResults = Zobraz\u00ed panel s parametry jako hledan\u00fd text / ignorovat velikost / regexp v okn\u011b v\u00fdsledk\u016f hled\u00e1n\u00ed + +config.name.displayAs3PCodeDocsPanel = Zobrazit panel s dokumentac\u00ed v AS3 P-k\u00f3du +config.description.displayAs3PCodeDocsPanel = Zobraz\u00ed panel s dokumentac\u00ed instrukc\u00ed a struktury k\u00f3du p\u0159i editaci a zobrazen\u00ed AS3 P-k\u00f3du + +config.name.displayAs3TraitsListAndConstantsPanel = Zobrazit panel se seznamem AS3 vlastnost\u00ed a konstant +config.description.displayAs3TraitsListAndConstantsPanel = Zobraz\u00ed panel se seznamem AS3 vlastnost\u00ed a konstant pod stromem tag\u016f. + +config.name.useAsTypeIcons = Pou\u017e\u00edt ikony skript\u016f na z\u00e1klad\u011b typu polo\u017eky +config.description.useAsTypeIcons = Pou\u017eije r\u016fzn\u00e9 ikony pro r\u016fzn\u00e9 typy skript\u016f (t\u0159\u00edda/interface/frame/...) \ No newline at end of file diff --git a/src/com/jpexs/decompiler/flash/gui/tagtree/TagTree.java b/src/com/jpexs/decompiler/flash/gui/tagtree/TagTree.java index ac7acc1c7..e405cd957 100644 --- a/src/com/jpexs/decompiler/flash/gui/tagtree/TagTree.java +++ b/src/com/jpexs/decompiler/flash/gui/tagtree/TagTree.java @@ -20,6 +20,12 @@ import com.jpexs.decompiler.flash.SWC; import com.jpexs.decompiler.flash.SWF; import com.jpexs.decompiler.flash.ZippedSWFBundle; import com.jpexs.decompiler.flash.abc.ScriptPack; +import com.jpexs.decompiler.flash.abc.types.traits.Trait; +import com.jpexs.decompiler.flash.abc.types.traits.TraitClass; +import com.jpexs.decompiler.flash.abc.types.traits.TraitFunction; +import com.jpexs.decompiler.flash.abc.types.traits.TraitMethodGetterSetter; +import com.jpexs.decompiler.flash.abc.types.traits.TraitSlotConst; +import com.jpexs.decompiler.flash.configuration.Configuration; import com.jpexs.decompiler.flash.gui.MainPanel; import com.jpexs.decompiler.flash.gui.TreeNodeType; import com.jpexs.decompiler.flash.gui.View; @@ -114,6 +120,8 @@ import com.jpexs.decompiler.flash.treeitems.FolderItem; import com.jpexs.decompiler.flash.treeitems.HeaderItem; import com.jpexs.decompiler.flash.treeitems.SWFList; import com.jpexs.decompiler.flash.treeitems.TreeItem; +import com.jpexs.decompiler.flash.types.BUTTONCONDACTION; +import com.jpexs.decompiler.flash.types.CLIPACTIONRECORD; import java.awt.Color; import java.awt.Component; import java.awt.Font; @@ -324,11 +332,61 @@ public class TagTree extends JTree { return TreeNodeType.BINARY_DATA; } + if (Configuration.useAsTypeIcons.get()) { + if (t instanceof DoInitActionTag) { + DoInitActionTag doInit = (DoInitActionTag) t; + if (doInit.getSwf().getExportName(doInit.spriteId) != null) { + return TreeNodeType.AS_CLASS; + } + return TreeNodeType.AS_INIT; + } + + if (t instanceof CLIPACTIONRECORD) { + return TreeNodeType.AS_CLIP; + } + + if (t instanceof BUTTONCONDACTION) { + return TreeNodeType.AS_BUTTON; + } + + if (t instanceof DoActionTag) { + return TreeNodeType.AS_FRAME; + } + } + if (t instanceof ASMSource) { return TreeNodeType.AS; } if (t instanceof ScriptPack) { + if (Configuration.useAsTypeIcons.get()) { + ScriptPack pack = (ScriptPack) t; + Trait trait = pack.getPublicTrait(); + if (trait == null) { + return TreeNodeType.AS; + } + if (trait instanceof TraitFunction) { + return TreeNodeType.AS_FUNCTION; + } + if (trait instanceof TraitMethodGetterSetter) { + return TreeNodeType.AS_FUNCTION; + } + if (trait instanceof TraitSlotConst) { + TraitSlotConst traitSlotConst = (TraitSlotConst) trait; + if (traitSlotConst.isConst()) { + return TreeNodeType.AS_CONST; + } else { + return TreeNodeType.AS_VAR; + } + } + if (trait instanceof TraitClass) { + TraitClass traitClass = (TraitClass) trait; + if (pack.abc.instance_info.get(traitClass.class_info).isInterface()) { + return TreeNodeType.AS_INTERFACE; + } + return TreeNodeType.AS_CLASS; + } + } return TreeNodeType.AS; } @@ -585,6 +643,9 @@ public class TagTree extends JTree { if (nodeType == TreeNodeType.AS) { ret.add(d); } + if (nodeType == TreeNodeType.AS_FRAME) { + ret.add(d); + } if (nodeType == TreeNodeType.MOVIE) { ret.add(d); } diff --git a/src/com/jpexs/decompiler/flash/gui/tagtree/TagTreeModel.java b/src/com/jpexs/decompiler/flash/gui/tagtree/TagTreeModel.java index e5443523d..0f724b5d0 100644 --- a/src/com/jpexs/decompiler/flash/gui/tagtree/TagTreeModel.java +++ b/src/com/jpexs/decompiler/flash/gui/tagtree/TagTreeModel.java @@ -231,6 +231,7 @@ public class TagTreeModel implements TreeModel { binaryData.add(t); break; case AS: + case AS_FRAME: break; default: if (t.getId() != ShowFrameTag.ID && !ShowFrameTag.isNestedTagType(t.getId())) {