mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-27 14:50:45 +00:00
Added Show button records in the tree, preview them
This commit is contained in:
@@ -133,7 +133,9 @@ import com.jpexs.decompiler.flash.tags.EndTag;
|
||||
import com.jpexs.decompiler.flash.tags.FileAttributesTag;
|
||||
import com.jpexs.decompiler.flash.tags.JPEGTablesTag;
|
||||
import com.jpexs.decompiler.flash.tags.MetadataTag;
|
||||
import com.jpexs.decompiler.flash.tags.PlaceObject2Tag;
|
||||
import com.jpexs.decompiler.flash.tags.PlaceObjectTag;
|
||||
import com.jpexs.decompiler.flash.tags.SetBackgroundColorTag;
|
||||
import com.jpexs.decompiler.flash.tags.ShowFrameTag;
|
||||
import com.jpexs.decompiler.flash.tags.Tag;
|
||||
import com.jpexs.decompiler.flash.tags.TagInfo;
|
||||
@@ -164,6 +166,7 @@ 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.BUTTONRECORD;
|
||||
import com.jpexs.decompiler.flash.types.FILLSTYLE;
|
||||
import static com.jpexs.decompiler.flash.types.FILLSTYLE.CLIPPED_BITMAP;
|
||||
import com.jpexs.decompiler.flash.types.FILLSTYLEARRAY;
|
||||
@@ -4324,6 +4327,44 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
} else {
|
||||
previewPanel.setParametersPanelVisible(false);
|
||||
}
|
||||
} else if (treeItem instanceof BUTTONRECORD) {
|
||||
BUTTONRECORD buttonRecord = (BUTTONRECORD) treeItem;
|
||||
previewPanel.setParametersPanelVisible(false);
|
||||
SWF swf = new SWF(buttonRecord.getSwf().getCharset());
|
||||
swf.frameCount = 1;
|
||||
swf.frameRate = buttonRecord.getSwf().frameRate;
|
||||
swf.displayRect = buttonRecord.getTag().getRect();
|
||||
if (swf.getBackgroundColor() != null) {
|
||||
SetBackgroundColorTag setBackgroundColorTag = new SetBackgroundColorTag(swf, swf.getBackgroundColor().backgroundColor);
|
||||
swf.addTag(setBackgroundColorTag);
|
||||
setBackgroundColorTag.setTimelined(swf);
|
||||
}
|
||||
CharacterTag character = buttonRecord.getSwf().getCharacter(buttonRecord.characterId);
|
||||
Set<Integer> needed = new LinkedHashSet<>();
|
||||
character.getNeededCharactersDeep(needed);
|
||||
needed.remove(buttonRecord.characterId);
|
||||
needed.add(buttonRecord.characterId);
|
||||
|
||||
for (int n : needed) {
|
||||
CharacterTag neededCharacter;
|
||||
try {
|
||||
neededCharacter = (CharacterTag) buttonRecord.getSwf().getCharacter(n).cloneTag();
|
||||
} catch (InterruptedException | IOException ex) {
|
||||
Logger.getLogger(MainPanel.class.getName()).log(Level.SEVERE, null, ex);
|
||||
return;
|
||||
}
|
||||
neededCharacter.setSwf(swf);
|
||||
neededCharacter.setTimelined(swf);
|
||||
swf.addTag(neededCharacter);
|
||||
}
|
||||
|
||||
PlaceObject2Tag placeTag = new PlaceObject2Tag(swf, false, 1, buttonRecord.characterId, buttonRecord.placeMatrix, buttonRecord.colorTransform, 0, null, -1, null);
|
||||
swf.addTag(placeTag);
|
||||
placeTag.setTimelined(swf);
|
||||
ShowFrameTag showFrameTag = new ShowFrameTag(swf);
|
||||
swf.addTag(showFrameTag);
|
||||
showFrameTag.setTimelined(swf);
|
||||
previewPanel.showImagePanel(swf, swf, 0, true, true);
|
||||
} else {
|
||||
previewPanel.showEmpty();
|
||||
}
|
||||
@@ -4493,6 +4534,9 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
showCard(CARDPREVIEWPANEL);
|
||||
} else if (treeItem instanceof Tag) {
|
||||
showGenericTag((Tag) treeItem);
|
||||
} else if (treeItem instanceof BUTTONRECORD) {
|
||||
showPreview(treeItem, previewPanel, -1, null);
|
||||
showCard(CARDPREVIEWPANEL);
|
||||
} else {
|
||||
showCard(CARDEMPTYPANEL);
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ public enum TreeNodeType {
|
||||
MORPH_SHAPE,
|
||||
SPRITE,
|
||||
BUTTON,
|
||||
BUTTON_RECORD,
|
||||
AS,
|
||||
AS_CLASS,
|
||||
AS_INTERFACE,
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 733 B |
@@ -24,6 +24,8 @@ import com.jpexs.decompiler.flash.gui.tagtree.AbstractTagTreeModel;
|
||||
import com.jpexs.decompiler.flash.tags.DefineBinaryDataTag;
|
||||
import com.jpexs.decompiler.flash.tags.DefineSpriteTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.ASMSourceContainer;
|
||||
import com.jpexs.decompiler.flash.tags.base.ButtonAction;
|
||||
import com.jpexs.decompiler.flash.tags.base.ButtonTag;
|
||||
import com.jpexs.decompiler.flash.timeline.Frame;
|
||||
import com.jpexs.decompiler.flash.timeline.Timelined;
|
||||
import com.jpexs.decompiler.flash.treeitems.HeaderItem;
|
||||
@@ -97,9 +99,18 @@ public class TagListTreeModel extends AbstractTagTreeModel {
|
||||
return ((Frame) parentNode).allInnerTags.get(index);
|
||||
} else if (parentNode instanceof DefineBinaryDataTag) {
|
||||
return ((DefineBinaryDataTag) parentNode).innerSwf;
|
||||
} else if (parentNode instanceof ASMSourceContainer) {
|
||||
}
|
||||
|
||||
if (parentNode instanceof ButtonTag) {
|
||||
if (index < ((ButtonTag) parentNode).getRecords().size()) {
|
||||
return ((ButtonTag) parentNode).getRecords().get(index);
|
||||
}
|
||||
index -= ((ButtonTag) parentNode).getRecords().size();
|
||||
}
|
||||
if (parentNode instanceof ASMSourceContainer) {
|
||||
return ((ASMSourceContainer)parentNode).getSubItems().get(index);
|
||||
}
|
||||
|
||||
throw new Error("Unsupported parent type: " + parentNode.getClass().getName());
|
||||
}
|
||||
|
||||
@@ -107,7 +118,7 @@ public class TagListTreeModel extends AbstractTagTreeModel {
|
||||
public int getChildCount(Object parent) {
|
||||
TreeItem parentNode = (TreeItem) parent;
|
||||
if (parentNode == root) {
|
||||
return swfs.size();
|
||||
return swfs.size();
|
||||
} else if (parentNode instanceof SWFList) {
|
||||
return ((SWFList) parentNode).swfs.size();
|
||||
} else if (parentNode instanceof SWF) {
|
||||
@@ -120,11 +131,17 @@ public class TagListTreeModel extends AbstractTagTreeModel {
|
||||
return ((DefineSpriteTag) parentNode).getTimeline().getFrameCount();
|
||||
} else if (parentNode instanceof DefineBinaryDataTag) {
|
||||
return (((DefineBinaryDataTag) parentNode).innerSwf == null ? 0 : 1);
|
||||
} else if (parentNode instanceof ASMSourceContainer) {
|
||||
return ((ASMSourceContainer)parentNode).getSubItems().size();
|
||||
}
|
||||
int size = 0;
|
||||
if (parentNode instanceof ButtonTag) {
|
||||
size += ((ButtonTag) parentNode).getRecords().size();
|
||||
}
|
||||
if (parentNode instanceof ASMSourceContainer) {
|
||||
size += ((ASMSourceContainer)parentNode).getSubItems().size();
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
return size;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -165,9 +182,23 @@ public class TagListTreeModel extends AbstractTagTreeModel {
|
||||
return ((Frame) parentNode).allInnerTags.indexOf(child);
|
||||
} else if (parentNode instanceof DefineBinaryDataTag) {
|
||||
return ((DefineBinaryDataTag) parentNode).innerSwf == child ? 0 : -1;
|
||||
} else if (parentNode instanceof ASMSourceContainer) {
|
||||
return ((ASMSourceContainer)parentNode).getSubItems().indexOf(child);
|
||||
}
|
||||
int base = 0;
|
||||
if (parentNode instanceof ButtonTag) {
|
||||
int index = ((ButtonTag) parentNode).getRecords().indexOf(child);
|
||||
if (index > -1) {
|
||||
return index;
|
||||
}
|
||||
base = ((ButtonTag) parentNode).getRecords().size();
|
||||
}
|
||||
if (parentNode instanceof ASMSourceContainer) {
|
||||
int index = ((ASMSourceContainer)parentNode).getSubItems().indexOf(child);
|
||||
if (index == -1) {
|
||||
return -1;
|
||||
}
|
||||
return base + index;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -270,11 +301,16 @@ public class TagListTreeModel extends AbstractTagTreeModel {
|
||||
} else {
|
||||
return new ArrayList<>(0);
|
||||
}
|
||||
} else if (parentNode instanceof ASMSourceContainer) {
|
||||
return ((ASMSourceContainer)parentNode).getSubItems();
|
||||
}
|
||||
List<TreeItem> ret = new ArrayList<>();
|
||||
if (parentNode instanceof ButtonTag) {
|
||||
ret.addAll(((ButtonTag) parentNode).getRecords());
|
||||
}
|
||||
if (parentNode instanceof ASMSourceContainer) {
|
||||
ret.addAll(((ASMSourceContainer)parentNode).getSubItems());
|
||||
}
|
||||
|
||||
return new ArrayList<>();
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -95,6 +95,7 @@ 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.BUTTONRECORD;
|
||||
import com.jpexs.decompiler.flash.types.CLIPACTIONRECORD;
|
||||
import java.awt.Color;
|
||||
import java.util.ArrayList;
|
||||
@@ -217,6 +218,10 @@ public abstract class AbstractTagTree extends JTree {
|
||||
if (t instanceof ButtonTag) {
|
||||
return TreeNodeType.BUTTON;
|
||||
}
|
||||
|
||||
if (t instanceof BUTTONRECORD) {
|
||||
return TreeNodeType.BUTTON_RECORD;
|
||||
}
|
||||
|
||||
if (t instanceof DefineVideoStreamTag) {
|
||||
return TreeNodeType.MOVIE;
|
||||
|
||||
@@ -29,6 +29,7 @@ import com.jpexs.decompiler.flash.tags.SoundStreamBlockTag;
|
||||
import com.jpexs.decompiler.flash.tags.Tag;
|
||||
import com.jpexs.decompiler.flash.tags.base.ASMSource;
|
||||
import com.jpexs.decompiler.flash.tags.base.ASMSourceContainer;
|
||||
import com.jpexs.decompiler.flash.tags.base.ButtonTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.CharacterIdTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.CharacterTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.SoundStreamHeadTypeTag;
|
||||
@@ -44,6 +45,7 @@ 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.BUTTONRECORD;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -541,6 +543,8 @@ public class TagTreeModel extends AbstractTagTreeModel {
|
||||
} else {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
} else if (parentNode instanceof ButtonTag) {
|
||||
return ((ButtonTag) parentNode).getRecords();
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -614,6 +618,8 @@ public class TagTreeModel extends AbstractTagTreeModel {
|
||||
return clt.getChild(clt.getRoot(), index);
|
||||
} else if (parentNode instanceof AS3ClassTreeItem) {
|
||||
return ((AS3Package) parentNode).getChild(index);
|
||||
} else if (parentNode instanceof ButtonTag) {
|
||||
return ((ButtonTag) parentNode).getRecords().get(index);
|
||||
}
|
||||
|
||||
throw new Error("Unsupported parent type: " + parentNode.getClass().getName());
|
||||
@@ -654,6 +660,8 @@ public class TagTreeModel extends AbstractTagTreeModel {
|
||||
return mappedSize + clt.getChildCount(clt.getRoot());
|
||||
} else if (parentNode instanceof AS3Package) {
|
||||
return mappedSize + ((AS3Package) parentNode).getChildCount();
|
||||
} else if (parentNode instanceof ButtonTag) {
|
||||
return mappedSize + ((ButtonTag) parentNode).getRecords().size();
|
||||
} else if (parentNode instanceof CharacterTag) {
|
||||
return mappedSize;
|
||||
}
|
||||
@@ -723,6 +731,8 @@ public class TagTreeModel extends AbstractTagTreeModel {
|
||||
return indexOfAdd(baseIndex, clt.getIndexOfChild(clt.getRoot(), childNode));
|
||||
} else if (parentNode instanceof AS3ClassTreeItem) {
|
||||
return indexOfAdd(baseIndex, ((AS3Package) parentNode).getIndexOfChild((AS3ClassTreeItem) childNode));
|
||||
} else if (parentNode instanceof ButtonTag) {
|
||||
return indexOfAdd(baseIndex, ((ButtonTag) parentNode).getRecords().indexOf(childNode));
|
||||
} else if (parentNode instanceof CharacterTag) {
|
||||
return indexOfAdd(baseIndex, getMappedCharacters(((CharacterTag) parentNode).getSwf(), (CharacterTag) parentNode).indexOf(childNode));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user