Issue #185 on-clip action headers displaying and exporting

This commit is contained in:
Jindra Petk
2013-07-07 11:58:11 +02:00
parent 3b0754021e
commit 04e741b141
19 changed files with 337 additions and 150 deletions

View File

@@ -1404,7 +1404,7 @@ public class SWF {
}
if (name instanceof DirectValueTreeItem) {
variables.add(new KeyValue<DirectValueTreeItem, ConstantPool>((DirectValueTreeItem) name, constantPool));
variables.add(new KeyValue<>((DirectValueTreeItem) name, constantPool));
usageTypes.put((DirectValueTreeItem) name, usageType);
}

View File

@@ -17,6 +17,7 @@
package com.jpexs.decompiler.flash;
import com.jpexs.decompiler.flash.action.Action;
import com.jpexs.decompiler.flash.helpers.Helper;
import com.jpexs.decompiler.flash.helpers.Highlighting;
import com.jpexs.decompiler.flash.tags.DefineBitsJPEG2Tag;
import com.jpexs.decompiler.flash.tags.DefineBitsJPEG3Tag;
@@ -42,9 +43,9 @@ import com.jpexs.decompiler.flash.tags.DefineText2Tag;
import com.jpexs.decompiler.flash.tags.DefineTextTag;
import com.jpexs.decompiler.flash.tags.ExportAssetsTag;
import com.jpexs.decompiler.flash.tags.ShowFrameTag;
import com.jpexs.decompiler.flash.tags.Tag;
import com.jpexs.decompiler.flash.tags.base.ASMSource;
import com.jpexs.decompiler.flash.tags.base.Container;
import com.jpexs.decompiler.flash.tags.base.Exportable;
import java.io.File;
import java.io.FileOutputStream;
import java.util.ArrayList;
@@ -240,10 +241,10 @@ public class TagNode {
List<String> existingNames = new ArrayList<>();
for (TagNode node : nodeList) {
String name = "";
if (node.tag instanceof Tag) {
name = ((Tag) node.tag).getExportFileName();
if (node.tag instanceof Exportable) {
name = ((Exportable) node.tag).getExportFileName();
} else {
name = node.tag.toString();
name = Helper.makeFileName(node.tag.toString());
}
int i = 1;
String baseName = name;
@@ -266,12 +267,13 @@ public class TagNode {
ev.handleEvent("export", "Exporting " + f + " ...");
}
String res;
ASMSource asm = ((ASMSource) node.tag);
if (isPcode) {
res = Highlighting.stripHilights(((ASMSource) node.tag).getASMSource(SWF.DEFAULT_VERSION, false));
res = asm.getActionSourcePrefix() + Highlighting.stripHilights(asm.getASMSource(SWF.DEFAULT_VERSION, false)) + asm.getActionSourceSuffix();
} else {
List<Action> as = ((ASMSource) node.tag).getActions(SWF.DEFAULT_VERSION);
List<Action> as = asm.getActions(SWF.DEFAULT_VERSION);
Action.setActionsAddresses(as, 0, SWF.DEFAULT_VERSION);
res = (Highlighting.stripHilights(Action.actionsToSource(as, SWF.DEFAULT_VERSION)));
res = asm.getActionSourcePrefix() + Highlighting.stripHilights(Action.actionsToSource(as, SWF.DEFAULT_VERSION)) + asm.getActionSourceSuffix();
}
try (FileOutputStream fos = new FileOutputStream(f)) {
fos.write(res.getBytes("utf-8"));

View File

@@ -31,7 +31,6 @@ import com.jpexs.decompiler.flash.abc.types.traits.TraitMethodGetterSetter;
import com.jpexs.decompiler.flash.abc.types.traits.TraitSlotConst;
import com.jpexs.decompiler.flash.abc.types.traits.Traits;
import com.jpexs.decompiler.flash.abc.usages.*;
import com.jpexs.decompiler.flash.helpers.Helper;
import com.jpexs.decompiler.flash.tags.ABCContainerTag;
import java.io.*;
import java.util.ArrayList;

View File

@@ -48,7 +48,6 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Properties;
import java.util.TreeMap;
import java.util.logging.ConsoleHandler;
import java.util.logging.FileHandler;
import java.util.logging.Level;

View File

@@ -52,8 +52,6 @@ import java.io.StringReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Pattern;
import javax.swing.BoxLayout;
import javax.swing.JButton;
@@ -100,6 +98,7 @@ public class ActionPanel extends JPanel implements ActionListener {
private String srcWithHex;
private String srcNoHex;
private String lastDecompiled = "";
private ASMSource lastASM;
public JPanel searchPanel;
public JLabel searchPos;
private List<ASMSource> found = new ArrayList<>();
@@ -295,8 +294,9 @@ public class ActionPanel extends JPanel implements ActionListener {
lastCode = asm.getActions(SWF.DEFAULT_VERSION);
decompiledHilights = sc.hilights;
lastDecompiled = sc.text;
lastASM = asm;
stripped = lastDecompiled;
decompiledEditor.setText(lastDecompiled);
decompiledEditor.setText(asm.getActionSourcePrefix() + lastDecompiled + asm.getActionSourceSuffix());
}
setEditMode(false);
setDecompiledEditMode(false);
@@ -540,7 +540,17 @@ public class ActionPanel extends JPanel implements ActionListener {
}
public void setDecompiledEditMode(boolean val) {
String pref = lastASM.getActionSourcePrefix();
int lastPos = decompiledEditor.getCaretPosition();
if (val) {
String newText = lastDecompiled;
decompiledEditor.setText(newText);
if (lastPos > -1) {
int newpos = lastPos - pref.length();
if (newpos < newText.length() && newpos >= 0) {
decompiledEditor.setCaretPosition(newpos);
}
}
decompiledEditor.setEditable(true);
saveDecompiledButton.setVisible(true);
editDecompiledButton.setVisible(false);
@@ -549,6 +559,14 @@ public class ActionPanel extends JPanel implements ActionListener {
decompiledEditor.getCaret().setVisible(true);
decLabel.setIcon(View.getIcon("editing16"));
} else {
String newText = pref + lastDecompiled + lastASM.getActionSourceSuffix();
decompiledEditor.setText(newText);
if (lastPos > -1) {
int newpos = lastPos + pref.length();
if (newpos < newText.length()) {
decompiledEditor.setCaretPosition(newpos);
}
}
decompiledEditor.setEditable(false);
saveDecompiledButton.setVisible(false);
editDecompiledButton.setVisible(true);
@@ -610,19 +628,13 @@ public class ActionPanel extends JPanel implements ActionListener {
setDecompiledEditMode(true);
} else if (e.getActionCommand().equals("CANCELDECOMPILED")) {
setDecompiledEditMode(false);
decompiledEditor.setText(lastDecompiled);
} else if (e.getActionCommand().equals("SAVEDECOMPILED")) {
try {
ActionScriptParser par = new ActionScriptParser();
src.setActions(par.parse(decompiledEditor.getText()), SWF.DEFAULT_VERSION);
setSource(this.src, false);
JOptionPane.showMessageDialog(this, translate("message.action.saved"));
saveDecompiledButton.setVisible(false);
cancelDecompiledButton.setVisible(false);
editDecompiledButton.setVisible(true);
experimentalLabel.setVisible(true);
decompiledEditor.setEditable(false);
editDecompiledMode = false;
setDecompiledEditMode(false);
} catch (IOException ex) {
} catch (ParseException ex) {
JOptionPane.showMessageDialog(this, translate("error.action.save").replace("%error%", ex.text).replace("%line%", "" + ex.line), translate("error"), JOptionPane.ERROR_MESSAGE);

View File

@@ -83,6 +83,7 @@ public class DefineButtonTag extends CharacterTag implements ASMSource, BoundedT
*
* @param data Data bytes
* @param version SWF version
* @param pos
* @throws IOException
*/
public DefineButtonTag(byte[] data, int version, long pos) throws IOException {
@@ -262,4 +263,14 @@ public class DefineButtonTag extends CharacterTag implements ASMSource, BoundedT
public int getNumFrames() {
return 1;
}
@Override
public String getActionSourcePrefix() {
return "";
}
@Override
public String getActionSourceSuffix() {
return "";
}
}

View File

@@ -150,4 +150,14 @@ public class DoActionTag extends Tag implements ASMSource {
public void removeDisassemblyListener(DisassemblyListener listener) {
listeners.remove(listener);
}
@Override
public String getActionSourcePrefix() {
return "";
}
@Override
public String getActionSourceSuffix() {
return "";
}
}

View File

@@ -192,4 +192,14 @@ public class DoInitActionTag extends CharacterIdTag implements ASMSource {
}
return pathParts[pathParts.length - 1];
}
@Override
public String getActionSourcePrefix() {
return "";
}
@Override
public String getActionSourceSuffix() {
return "";
}
}

View File

@@ -367,4 +367,22 @@ public class PlaceObject2Tag extends Tag implements Container, PlaceObjectTypeTa
public void setClassName(String className) {
//not supported
}
@Override
public String toString() {
if (name != null) {
return super.toString() + " (" + name + ")";
} else {
return super.toString();
}
}
@Override
public CLIPACTIONS getClipActions() {
if (placeFlagHasClipActions) {
return clipActions;
} else {
return null;
}
}
}

View File

@@ -484,4 +484,22 @@ public class PlaceObject3Tag extends Tag implements Container, PlaceObjectTypeTa
placeFlagHasClassName = true;
this.className = className;
}
@Override
public String toString() {
if (name != null) {
return super.toString() + " (" + name + ")";
} else {
return super.toString();
}
}
@Override
public CLIPACTIONS getClipActions() {
if (placeFlagHasClipActions) {
return clipActions;
} else {
return null;
}
}
}

View File

@@ -18,6 +18,7 @@ package com.jpexs.decompiler.flash.tags;
import com.jpexs.decompiler.flash.SWFInputStream;
import com.jpexs.decompiler.flash.SWFOutputStream;
import com.jpexs.decompiler.flash.types.CLIPACTIONS;
import com.jpexs.decompiler.flash.types.CXFORM;
import com.jpexs.decompiler.flash.types.CXFORMWITHALPHA;
import com.jpexs.decompiler.flash.types.MATRIX;
@@ -196,4 +197,9 @@ public class PlaceObjectTag extends Tag implements PlaceObjectTypeTag {
public void setClassName(String className) {
//not supported
}
@Override
public CLIPACTIONS getClipActions() {
return null;
}
}

View File

@@ -1,5 +1,6 @@
package com.jpexs.decompiler.flash.tags;
import com.jpexs.decompiler.flash.types.CLIPACTIONS;
import com.jpexs.decompiler.flash.types.CXFORM;
import com.jpexs.decompiler.flash.types.CXFORMWITHALPHA;
import com.jpexs.decompiler.flash.types.MATRIX;
@@ -46,4 +47,6 @@ public interface PlaceObjectTypeTag {
public boolean flagMove();
public int getRatio();
public CLIPACTIONS getClipActions();
}

View File

@@ -17,6 +17,7 @@
package com.jpexs.decompiler.flash.tags;
import com.jpexs.decompiler.flash.tags.base.CharacterTag;
import com.jpexs.decompiler.flash.tags.base.Exportable;
import com.jpexs.decompiler.flash.tags.base.NeedsCharacters;
import java.util.HashMap;
import java.util.HashSet;
@@ -26,7 +27,7 @@ import java.util.Set;
/**
* Represents Tag inside SWF file
*/
public class Tag implements NeedsCharacters {
public class Tag implements NeedsCharacters, Exportable {
/**
* Identifier of tag type
@@ -49,6 +50,7 @@ public class Tag implements NeedsCharacters {
return name;
}
@Override
public String getExportFileName() {
return getName();
}
@@ -68,6 +70,7 @@ public class Tag implements NeedsCharacters {
* @param id Tag type identifier
* @param name Tag name
* @param data Bytes of data
* @param pos
*/
public Tag(int id, String name, byte[] data, long pos) {
this.id = id;

View File

@@ -68,4 +68,8 @@ public interface ASMSource {
public void addDisassemblyListener(DisassemblyListener listener);
public void removeDisassemblyListener(DisassemblyListener listener);
public String getActionSourcePrefix();
public String getActionSourceSuffix();
}

View File

@@ -0,0 +1,26 @@
/*
* Copyright (C) 2013 JPEXS
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.jpexs.decompiler.flash.tags.base;
/**
*
* @author JPEXS
*/
public interface Exportable {
public String getExportFileName();
}

View File

@@ -21,7 +21,9 @@ import com.jpexs.decompiler.flash.DisassemblyListener;
import com.jpexs.decompiler.flash.ReReadableInputStream;
import com.jpexs.decompiler.flash.SWFInputStream;
import com.jpexs.decompiler.flash.action.Action;
import com.jpexs.decompiler.flash.helpers.Helper;
import com.jpexs.decompiler.flash.tags.base.ASMSource;
import com.jpexs.decompiler.flash.tags.base.Exportable;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -35,7 +37,7 @@ import java.util.logging.Logger;
*
* @author JPEXS
*/
public class BUTTONCONDACTION implements ASMSource {
public class BUTTONCONDACTION implements ASMSource, Exportable {
private long pos;
@@ -204,4 +206,59 @@ public class BUTTONCONDACTION implements ASMSource {
public void removeDisassemblyListener(DisassemblyListener listener) {
listeners.remove(listener);
}
private String getHeader(boolean asFilename) {
List<String> events = new ArrayList<>();
if (condOverUpToOverDown) {
events.add("press");
}
if (condOverDownToOverUp) {
events.add("release");
}
if (condOutDownToIdle) {
events.add("releaseOutside");
}
if (condIdleToOverUp) {
events.add("rollOver");
}
if (condOverUpToIddle) {
events.add("rollOut");
}
if (condOverDownToOutDown) {
events.add("dragOut");
}
if (condOutDownToOverDown) {
events.add("dragOver");
}
if (condKeyPress > 0) {
if (asFilename) {
events.add("keyPress " + Helper.makeFileName(CLIPACTIONRECORD.keyToString(condKeyPress).replace("<", "").replace(">", "")) + "");
} else {
events.add("keyPress \"" + CLIPACTIONRECORD.keyToString(condKeyPress) + "\"");
}
}
String onStr = "";
for (int i = 0; i < events.size(); i++) {
if (i > 0) {
onStr += ", ";
}
onStr += events.get(i);
}
return "on(" + onStr + ")";
}
@Override
public String getActionSourcePrefix() {
return getHeader(false) + "{\r\n";
}
@Override
public String getActionSourceSuffix() {
return "}\r\n";
}
@Override
public String getExportFileName() {
return getHeader(true);
}
}

View File

@@ -22,6 +22,7 @@ import com.jpexs.decompiler.flash.ReReadableInputStream;
import com.jpexs.decompiler.flash.SWFInputStream;
import com.jpexs.decompiler.flash.action.Action;
import com.jpexs.decompiler.flash.tags.base.ASMSource;
import com.jpexs.decompiler.flash.tags.base.Exportable;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -35,8 +36,50 @@ import java.util.logging.Logger;
*
* @author JPEXS
*/
public class CLIPACTIONRECORD implements ASMSource {
public class CLIPACTIONRECORD implements ASMSource, Exportable {
public static String keyToString(int key) {
if ((key < CLIPACTIONRECORD.KEYNAMES.length) && (key > 0) && (CLIPACTIONRECORD.KEYNAMES[key] != null)) {
return CLIPACTIONRECORD.KEYNAMES[key];
} else {
return "" + (char) key;
}
}
public static final String KEYNAMES[] = {
null,
"<Left>",
"<Right>",
"<Home>",
"<End>",
"<Insert>",
"<Delete>",
null,
"<Backspace>",
null,
null,
null,
null,
"<Enter>",
"<Up>",
"<Down>",
"<PageUp>",
"<PageDown>",
"<Tab>",
"<Escape>",
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
"<Space>"
};
private long pos;
private long hdrPos;
@@ -82,7 +125,7 @@ public class CLIPACTIONRECORD implements ASMSource {
*/
@Override
public String toString() {
return "CLIPACTIONRECORD";
return eventFlags.getHeader(keyCode, false);
}
/**
@@ -160,4 +203,19 @@ public class CLIPACTIONRECORD implements ASMSource {
public void removeDisassemblyListener(DisassemblyListener listener) {
listeners.remove(listener);
}
@Override
public String getActionSourcePrefix() {
return eventFlags.getHeader(keyCode, false) + "{\r\n";
}
@Override
public String getActionSourceSuffix() {
return "}\r\n";
}
@Override
public String getExportFileName() {
return eventFlags.getHeader(keyCode, true);
}
}

View File

@@ -16,6 +16,10 @@
*/
package com.jpexs.decompiler.flash.types;
import com.jpexs.decompiler.flash.helpers.Helper;
import java.util.ArrayList;
import java.util.List;
/**
* Specifies one or more sprite events to which an event handler applies.
*
@@ -100,72 +104,75 @@ public class CLIPEVENTFLAGS {
*/
public boolean clipEventDragOut = false;
/**
* Returns a string representation of the object
*
* @return a string representation of the object.
*/
@Override
public String toString() {
public String getHeader(int key, boolean asFileName) {
String ret = "";
List<String> onList = new ArrayList<>();
if (clipEventKeyUp) {
ret += "onClipEvent(keyUp)";
ret = "onClipEvent(keyUp)";
}
if (clipEventKeyDown) {
ret += "onClipEvent(keyDown)";
ret = "onClipEvent(keyDown)";
}
if (clipEventMouseUp) {
ret += "onClipEvent(mouseUp)";
ret = "onClipEvent(mouseUp)";
}
if (clipEventMouseDown) {
ret += "onClipEvent(mouseDown)";
ret = "onClipEvent(mouseDown)";
}
if (clipEventMouseMove) {
ret += "onClipEvent(mouseMove)";
ret = "onClipEvent(mouseMove)";
}
if (clipEventUnload) {
ret += "onClipEvent(unload)";
ret = "onClipEvent(unload)";
}
if (clipEventEnterFrame) {
ret += "onClipEvent(enterFrame)";
ret = "onClipEvent(enterFrame)";
}
if (clipEventLoad) {
ret += "onClipEvent(load)";
}
if (clipEventDragOver) {
ret += "on(dragOver)";
}
if (clipEventRollOut) {
ret += "on(rollOut)";
}
if (clipEventRollOver) {
ret += "on(rollOver)";
}
if (clipEventReleaseOutside) {
ret += "on(releaseOutside)";
}
if (clipEventRelease) {
ret += "on(release)";
}
if (clipEventPress) {
ret += "on(press)";
}
if (clipEventInitialize) {
ret += "on(initialize)";
ret = "onClipEvent(load)";
}
if (clipEventData) {
ret += "onClipEvent(data)";
ret = "onClipEvent(data)";
}
if (clipEventConstruct) {
ret += "on(construct)";
if (clipEventDragOver) {
onList.add("dragOver");
}
if (clipEventKeyPress) {
ret += "on(keyPress)";
if (clipEventRollOut) {
onList.add("rollOut");
}
if (clipEventDragOut) {
ret += "on(dragOut)";
if (clipEventRollOver) {
onList.add("rollOver");
}
if (clipEventReleaseOutside) {
onList.add("releaseOutside");
}
if (clipEventRelease) {
onList.add("release");
}
if (clipEventPress) {
onList.add("press");
}
if (clipEventInitialize) {
onList.add("initialize");
}
if (clipEventConstruct) {
onList.add("construct");
}
if (clipEventKeyPress) {
if (asFileName) {
onList.add("keyPress " + Helper.makeFileName(CLIPACTIONRECORD.keyToString(key).replace("<", "").replace(">", "")) + "");
} else {
onList.add("keyPress \"" + CLIPACTIONRECORD.keyToString(key) + "\"");
}
}
if (clipEventDragOut) {
onList.add("dragOut");
}
if (!onList.isEmpty()) {
ret = "on(" + Helper.joinStrings(onList, ",") + ")";
}
return ret.trim();
}

View File

@@ -54,6 +54,8 @@ import com.jpexs.decompiler.flash.tags.base.ShapeTag;
import com.jpexs.decompiler.flash.tags.base.TextTag;
import com.jpexs.decompiler.flash.types.BUTTONCONDACTION;
import com.jpexs.decompiler.flash.types.BUTTONRECORD;
import com.jpexs.decompiler.flash.types.CLIPACTIONRECORD;
import com.jpexs.decompiler.flash.types.CLIPACTIONS;
import com.jpexs.decompiler.flash.types.CXFORM;
import com.jpexs.decompiler.flash.types.CXFORMWITHALPHA;
import com.jpexs.decompiler.flash.types.FILLSTYLE;
@@ -1015,7 +1017,7 @@ public class XFLConverter {
return ret;
}
public static String convertSymbolInstance(String name, MATRIX matrix, CXFORM colorTransform, CXFORMWITHALPHA colorTransformAlpha, boolean cacheAsBitmap, int blendMode, List<FILTER> filters, boolean isVisible, RGBA backgroundColor, CharacterTag tag, HashMap<Integer, CharacterTag> characters, List<Tag> tags) {
public static String convertSymbolInstance(String name, MATRIX matrix, CXFORM colorTransform, CXFORMWITHALPHA colorTransformAlpha, boolean cacheAsBitmap, int blendMode, List<FILTER> filters, boolean isVisible, RGBA backgroundColor, CLIPACTIONS clipActions, CharacterTag tag, HashMap<Integer, CharacterTag> characters, List<Tag> tags) {
String ret = "";
if (matrix == null) {
matrix = new MATRIX();
@@ -1121,91 +1123,25 @@ public class XFLConverter {
if (!db2.actions.isEmpty()) {
ret += "<Actionscript><script><![CDATA[";
for (BUTTONCONDACTION bca : db2.actions) {
List<String> events = new ArrayList<>();
if (bca.condOverUpToOverDown) {
events.add("press");
}
if (bca.condOverDownToOverUp) {
events.add("release");
}
if (bca.condOutDownToIdle) {
events.add("releaseOutside");
}
if (bca.condIdleToOverUp) {
events.add("rollOver");
}
if (bca.condOverUpToIddle) {
events.add("rollOut");
}
if (bca.condOverDownToOutDown) {
events.add("dragOut");
}
if (bca.condOutDownToOverDown) {
events.add("dragOver");
}
if (bca.condKeyPress > 0) {
String keyNames[] = {
null,
"<Left>",
"<Right>",
"<Home>",
"<End>",
"<Insert>",
"<Delete>",
null,
"<Backspace>",
null,
null,
null,
null,
"<Enter>",
"<Up>",
"<Down>",
"<PageUp>",
"<PageDown>",
"<Tab>",
"<Escape>",
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
"<Space>"
};
if ((bca.condKeyPress < keyNames.length) && (bca.condKeyPress > 0) && (keyNames[bca.condKeyPress] != null)) {
events.add("keyPress \"" + keyNames[bca.condKeyPress] + "\"");
} else {
events.add("keyPress \"" + (char) bca.condKeyPress + "\"");
}
}
String onStr = "";
for (int i = 0; i < events.size(); i++) {
if (i > 0) {
onStr += ", ";
}
onStr += events.get(i);
}
ret += "on(" + onStr + "){\r\n";
ret += convertActionScript(bca);
ret += "}";
}
ret += "]]></script></Actionscript>";
}
}
if (clipActions != null) {
ret += "<Actionscript><script><![CDATA[";
for (CLIPACTIONRECORD rec : clipActions.clipActionRecords) {
ret += convertActionScript(rec);
}
ret += "]]></script></Actionscript>";
}
ret += "</DOMSymbolInstance>";
return ret;
}
private static String convertActionScript(ASMSource as) {
String decompiledASHilighted = com.jpexs.decompiler.flash.action.Action.actionsToSource(as.getActions(SWF.DEFAULT_VERSION), SWF.DEFAULT_VERSION);
return Highlighting.stripHilights(decompiledASHilighted);
return as.getActionSourcePrefix() + Highlighting.stripHilights(decompiledASHilighted) + as.getActionSourceSuffix();
}
private static long getTimestamp() {
@@ -1312,11 +1248,11 @@ public class XFLConverter {
MATRIX matrix = rec.placeMatrix;
String recCharStr = "";
if (character instanceof TextTag) {
recCharStr = convertText(null, tags, (TextTag) character, matrix, filters);
recCharStr = convertText(null, tags, (TextTag) character, matrix, filters, null);
} else if (character instanceof DefineVideoStreamTag) {
recCharStr = convertVideoInstance(null, matrix, (DefineVideoStreamTag) character);
recCharStr = convertVideoInstance(null, matrix, (DefineVideoStreamTag) character, null);
} else {
recCharStr = convertSymbolInstance(null, matrix, null, colorTransformAlpha, false, blendMode, filters, true, null, characters.get(rec.characterId), characters, tags);
recCharStr = convertSymbolInstance(null, matrix, null, colorTransformAlpha, false, blendMode, filters, true, null, null, characters.get(rec.characterId), characters, tags);
}
int duration = frame - lastFrame;
lastFrame = frame;
@@ -1783,7 +1719,7 @@ public class XFLConverter {
return ret;
}
private static String convertVideoInstance(String instanceName, MATRIX matrix, DefineVideoStreamTag video) {
private static String convertVideoInstance(String instanceName, MATRIX matrix, DefineVideoStreamTag video, CLIPACTIONS clipActions) {
String ret = "<DOMVideoInstance libraryItemName=\"movie" + video.characterID + ".flv\" frameRight=\"" + (20 * video.width) + "\" frameBottom=\"" + (20 * video.height) + "\"";
if (instanceName != null) {
ret += " name=\"" + xmlString(instanceName) + "\"";
@@ -1820,6 +1756,7 @@ public class XFLConverter {
List<FILTER> filters = new ArrayList<>();
boolean isVisible = true;
RGBA backGroundColor = null;
CLIPACTIONS clipActions = null;
int characterId = -1;
int ratio = -1;
boolean shapeTween = false;
@@ -1854,6 +1791,11 @@ public class XFLConverter {
if (colorTransFormAlpha2 != null) {
colorTransFormAlpha = colorTransFormAlpha2;
}
CLIPACTIONS clipActions2 = po.getClipActions();
if (clipActions2 != null) {
clipActions = clipActions2;
}
if (po.cacheAsBitmap()) {
cacheAsBitmap = true;
}
@@ -1878,6 +1820,7 @@ public class XFLConverter {
blendMode = po.getBlendMode();
filters = po.getFilters();
ratio = po.getRatio();
clipActions = po.getClipActions();
}
@@ -1900,6 +1843,7 @@ public class XFLConverter {
isVisible = true;
backGroundColor = null;
characterId = -1;
clipActions = null;
}
}
if (t instanceof FrameLabelTag) {
@@ -1927,11 +1871,11 @@ public class XFLConverter {
} else {
shapeTween = false;
if (character instanceof TextTag) {
elements += convertText(instanceName, tags, (TextTag) character, matrix, filters);
elements += convertText(instanceName, tags, (TextTag) character, matrix, filters, clipActions);
} else if (character instanceof DefineVideoStreamTag) {
elements += convertVideoInstance(instanceName, matrix, (DefineVideoStreamTag) character);
elements += convertVideoInstance(instanceName, matrix, (DefineVideoStreamTag) character, clipActions);
} else {
elements += convertSymbolInstance(instanceName, matrix, colorTransForm, colorTransFormAlpha, cacheAsBitmap, blendMode, filters, isVisible, backGroundColor, character, characters, tags);
elements += convertSymbolInstance(instanceName, matrix, colorTransForm, colorTransFormAlpha, cacheAsBitmap, blendMode, filters, isVisible, backGroundColor, clipActions, character, characters, tags);
}
}
}
@@ -2201,7 +2145,7 @@ public class XFLConverter {
return ret;
}
public static String convertText(String instanceName, List<Tag> tags, TextTag tag, MATRIX matrix, List<FILTER> filters) {
public static String convertText(String instanceName, List<Tag> tags, TextTag tag, MATRIX matrix, List<FILTER> filters, CLIPACTIONS clipActions) {
String ret = "";
if (matrix == null) {
matrix = new MATRIX();