Additional character info tags now placed under the character in the tree

Few icons for tags (metadata,fileattributes,setbackground,place and remove tags)
This commit is contained in:
Jindra Petřík
2015-04-06 09:09:17 +02:00
parent 406fc032b2
commit 73f3bb10cc
27 changed files with 161 additions and 69 deletions
@@ -45,4 +45,9 @@ public enum TreeNodeType {
BUNDLE_SWC,
BUNDLE_BINARY,
HEADER,
SET_BACKGROUNDCOLOR,
FILE_ATTRIBUTES,
METADATA,
PLACE_OBJECT,
REMOVE_OBJECT
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 732 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 568 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 698 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 695 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 805 B

@@ -96,6 +96,8 @@ import com.jpexs.decompiler.flash.tags.base.ASMSource;
import com.jpexs.decompiler.flash.tags.base.ButtonTag;
import com.jpexs.decompiler.flash.tags.base.ImageTag;
import com.jpexs.decompiler.flash.tags.base.MorphShapeTag;
import com.jpexs.decompiler.flash.tags.base.PlaceObjectTypeTag;
import com.jpexs.decompiler.flash.tags.base.RemoveTag;
import com.jpexs.decompiler.flash.tags.base.ShapeTag;
import com.jpexs.decompiler.flash.tags.base.SymbolClassTypeTag;
import com.jpexs.decompiler.flash.tags.base.TextTag;
@@ -336,6 +338,21 @@ public class TagTree extends JTree {
}
}
if(t instanceof SetBackgroundColorTag){
return TreeNodeType.SET_BACKGROUNDCOLOR;
}
if(t instanceof FileAttributesTag){
return TreeNodeType.FILE_ATTRIBUTES;
}
if(t instanceof MetadataTag){
return TreeNodeType.METADATA;
}
if(t instanceof PlaceObjectTypeTag){
return TreeNodeType.PLACE_OBJECT;
}
if(t instanceof RemoveTag){
return TreeNodeType.REMOVE_OBJECT;
}
if (t instanceof Tag) {
return TreeNodeType.OTHER_TAG;
}
@@ -28,6 +28,8 @@ 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.CharacterIdTag;
import com.jpexs.decompiler.flash.tags.base.CharacterTag;
import com.jpexs.decompiler.flash.tags.base.SoundStreamHeadTypeTag;
import com.jpexs.decompiler.flash.timeline.AS2Package;
import com.jpexs.decompiler.flash.timeline.AS3Package;
@@ -190,7 +192,7 @@ public class TagTreeModel implements TreeModel {
List<TreeItem> sounds = new ArrayList<>();
List<TreeItem> binaryData = new ArrayList<>();
List<TreeItem> others = new ArrayList<>();
Map<Integer, List<TreeItem>> mappedTags = new HashMap<>();
for (Tag t : swf.tags) {
TreeNodeType ttype = TagTree.getTreeNodeType(t);
switch (ttype) {
@@ -229,7 +231,20 @@ public class TagTreeModel implements TreeModel {
break;
default:
if (t.getId() != ShowFrameTag.ID && !ShowFrameTag.isNestedTagType(t.getId())) {
others.add(t);
boolean parentFound = false;
if ((t instanceof CharacterIdTag) && !(t instanceof CharacterTag)) {
CharacterIdTag chit = (CharacterIdTag) t;
if (swf.getCharacter(chit.getCharacterId()) != null) {
parentFound = true;
if (!mappedTags.containsKey(chit.getCharacterId())) {
mappedTags.put(chit.getCharacterId(), new ArrayList<>());
}
mappedTags.get(chit.getCharacterId()).add(t);
}
}
if (!parentFound) {
others.add(t);
}
}
break;
}
@@ -318,6 +333,7 @@ public class TagTreeModel implements TreeModel {
TagTreeSwfInfo swfInfo = new TagTreeSwfInfo();
swfInfo.folders = nodeList;
swfInfo.mappedTags = mappedTags;
swfInfo.tagScriptCache = currentTagScriptCache;
swfInfos.put(swf, swfInfo);
}
@@ -461,6 +477,20 @@ public class TagTreeModel implements TreeModel {
return swfInfo.folders;
}
private List<TreeItem> getMappedCharacters(SWF swf,CharacterTag tag) {
TagTreeSwfInfo swfInfo = swfInfos.get(swf);
if (swfInfo == null) {
createTagList(swf);
swfInfo = swfInfos.get(swf);
}
List<TreeItem> mapped = swfInfo.mappedTags.get(tag.getCharacterId());
if(mapped == null){
mapped = new ArrayList<>();
}
return mapped;
}
public List<? extends TreeItem> getAllChildren(Object parent) {
TreeItem parentNode = (TreeItem) parent;
@@ -530,6 +560,8 @@ public class TagTreeModel implements TreeModel {
} else {
return new ArrayList<>();
}
} else if (parentNode instanceof CharacterTag){
return getMappedCharacters(((CharacterTag)parentNode).getSwf(),(CharacterTag)parentNode);
}
return new ArrayList<>();
@@ -600,6 +632,8 @@ public class TagTreeModel implements TreeModel {
return clt.getChild(clt.getRoot(), index);
} else if (parentNode instanceof AS3ClassTreeItem) {
return ((AS3Package) parentNode).getChild(index);
} else if (parentNode instanceof CharacterTag){
return getMappedCharacters(((CharacterTag)parentNode).getSwf(),(CharacterTag)parentNode).get(index);
}
throw new Error("Unsupported parent type: " + parentNode.getClass().getName());
@@ -636,6 +670,8 @@ public class TagTreeModel implements TreeModel {
return clt.getChildCount(clt.getRoot());
} else if (parentNode instanceof AS3Package) {
return ((AS3Package) parentNode).getChildCount();
} else if (parentNode instanceof CharacterTag){
return getMappedCharacters(((CharacterTag)parentNode).getSwf(),(CharacterTag)parentNode).size();
}
return 0;
@@ -690,6 +726,8 @@ public class TagTreeModel implements TreeModel {
return clt.getIndexOfChild(clt.getRoot(), childNode);
} else if (parentNode instanceof AS3ClassTreeItem) {
return ((AS3Package) parentNode).getIndexOfChild((AS3ClassTreeItem) childNode);
} else if (parentNode instanceof CharacterTag){
return getMappedCharacters(((CharacterTag)parentNode).getSwf(),(CharacterTag)parentNode).indexOf(childNode);
}
throw new Error("Unsupported parent type: " + parentNode.getClass().getName());
@@ -29,6 +29,7 @@ import java.util.Map;
public class TagTreeSwfInfo {
public List<TreeItem> folders;
public Map<Integer,List<TreeItem>> mappedTags;
public Map<Tag, TagScript> tagScriptCache;
}