From d4a5e0346247b156ded609c3ee55a1777b9a40aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Sun, 14 Feb 2021 08:03:51 +0100 Subject: [PATCH] #1155, #1602 AS3 remove trait button --- CHANGELOG.md | 1 + .../decompiler/flash/gui/abc/ABCPanel.java | 48 ++++++++++++++++++ .../flash/gui/graphics/traitremove16.png | Bin 0 -> 701 bytes .../flash/gui/locales/MainFrame.properties | 5 ++ .../flash/gui/locales/MainFrame_cs.properties | 5 ++ 5 files changed, 59 insertions(+) create mode 100644 src/com/jpexs/decompiler/flash/gui/graphics/traitremove16.png diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a5024c77..260a83f9a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ All notable changes to this project will be documented in this file. ## [Unreleased] ### Added - #1202 Check for modifications outside FFDec and ask user to reload +- #1155, #1602 AS3 remove trait button ### Fixed - #1298 AS1/2 properly decompiled setProperty/getProperty diff --git a/src/com/jpexs/decompiler/flash/gui/abc/ABCPanel.java b/src/com/jpexs/decompiler/flash/gui/abc/ABCPanel.java index 53981892a..ae57b96b8 100644 --- a/src/com/jpexs/decompiler/flash/gui/abc/ABCPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/abc/ABCPanel.java @@ -68,6 +68,7 @@ import com.jpexs.decompiler.flash.gui.abc.tablemodels.UIntTableModel; import com.jpexs.decompiler.flash.gui.controls.JPersistentSplitPane; import com.jpexs.decompiler.flash.gui.editor.LinkHandler; import com.jpexs.decompiler.flash.gui.tagtree.TagTreeModel; +import com.jpexs.decompiler.flash.helpers.GraphTextWriter; import com.jpexs.decompiler.flash.importers.As3ScriptReplaceException; import com.jpexs.decompiler.flash.importers.As3ScriptReplaceExceptionItem; import com.jpexs.decompiler.flash.importers.As3ScriptReplacerInterface; @@ -922,6 +923,12 @@ public class ABCPanel extends JPanel implements ItemListener, SearchListener= 0 && traitId < abc.class_info.get(classIndex).static_traits.traits.size()) { + traitIndex = traitId; + traits = staticTraits; + } else { + if (traitId >= 0 && traitId < staticTraits.traits.size() + instanceTraits.traits.size()) { + traitIndex = traitId - staticTraits.traits.size(); + traits = instanceTraits; + } else { + traits = null; + } + } + + if (traits == null) { + return; + } + + if (View.showConfirmDialog(null, AppStrings.translate("message.confirm.removetrait"), AppStrings.translate("message.warning"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE) == JOptionPane.OK_OPTION) { + traits.traits.remove(traitIndex); + ((Tag) abc.parentTag).setModified(true); + reload(); + } + } + private void addTraitButtonActionPerformed(ActionEvent evt) { int class_index = decompiledTextArea.getClassIndex(); if (class_index < 0) { diff --git a/src/com/jpexs/decompiler/flash/gui/graphics/traitremove16.png b/src/com/jpexs/decompiler/flash/gui/graphics/traitremove16.png new file mode 100644 index 0000000000000000000000000000000000000000..9fbae67250babae698555c899907179c139932f0 GIT binary patch literal 701 zcmV;u0z&OtcA_q_1U#pC~GN zxfc`_zq*cJS5eFyM^neBh0V3}>eD$_#z~y93x^BudEejjyyv`!5k(Q1Oa`e`3dv*= zi9`bNcpQQtAQp?w0$`>sCY?^B-|tVXYPG6B!r|~#2t$==L8Verl*{Gv2ts4T1p-Cg41%^T)c)i|3Aq-XBPb9^Eh~-MB(?O%%1HUtLQYw|; z_xr)~`~-xd%KMgOSq3fM-RomxYk()80j@IKD;A5?1w0eX zO8_7BFTq~F0B&Ih{IyeXKfVEz$#iz?L`i>Ij^m_Stu}(_2;{@7O(gElqvL#zLDr4E zPj?Wzbx~#))VC+@m1SA2+wGRu@+EI*AlQZ4U$s{{4PFIsxvodT`{7+wFD@IcbRw7dsPL` zqN+OerCF_3joECLc-<-@E9d2JYjfCrFoQ2E$G|VCW%r`$A@jfIYBU-(27}>DVEOcY jqWG2CCjT8;O!xl+&v_qytO7mD00000NkvXXu0mjfWRW`K literal 0 HcmV?d00001 diff --git a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame.properties b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame.properties index c1e28abef..696f03f36 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame.properties @@ -777,3 +777,8 @@ filter.iggy = Iggy files (*.iggy) script.seemsBroken = WARNING: The code decompilation contains \u00a7\u00a7 instructions. \ This is usually caused by an obfuscation (See Settings/Automatic deobfuscation) \ or a nonstandard compiler used (Haxe, etc.). + +#after 13.0.3 +button.removetrait = Remove trait + +message.confirm.removetrait = Do you really want to remove selected trait? \ No newline at end of file diff --git a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_cs.properties b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_cs.properties index 12acf6c58..3ce9fe72b 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_cs.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_cs.properties @@ -755,3 +755,8 @@ filter.iggy = Iggy soubory (*.iggy) script.seemsBroken = VAROV\u00c1N\u00cd: K\u00f3d dekompilace obsahuje \u00a7\u00a7 instrukce. \ To je obvykle zp\u016fsobeno n\u011bjakou obfuskac\u00ed (viz Nastaven\u00ed/Automatick\u00e1 deobfuskace) \ nebo pou\u017eit\u00edm nestandardn\u00edho kompil\u00e1toru (Haxe, etc.). + +#after 13.0.3 +button.removetrait = Odstranit vlastnost + +message.confirm.removetrait = Opravdu chcete odstranit vybranou vlastnost? \ No newline at end of file