#773 scripts associated with ClipActions are not shown anymore fixed

This commit is contained in:
2015-01-20 21:24:21 +01:00
parent 526edda6fa
commit 25bd81f2f9
6 changed files with 128 additions and 55 deletions
@@ -38,8 +38,6 @@ public class LoadingDialog extends AppDialog implements ImageObserver {
private final JLabel detailLabel;
private LoadingPanel loadingPanel;
JProgressBar progressBar = new JProgressBar(0, 100);
public void setDetail(String d) {
@@ -78,27 +76,18 @@ public class LoadingDialog extends AppDialog implements ImageObserver {
cnt.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
cnt.setLayout(new BorderLayout());
//loadingPanel = new LoadingPanel(50, 50);
//loadingPanel.setPreferredSize(new Dimension(100, 100));
//add(loadingPanel, BorderLayout.WEST);
JPanel pan = new JPanel();
pan.setLayout(new ListLayout(5));
//pan.setPreferredSize(new Dimension(120, 150));
JLabel loadingLabel = new JLabel(translate("loadingpleasewait"));
//loadingLabel.setBounds(0, 30, 150, 20);
loadingLabel.setHorizontalAlignment(SwingConstants.CENTER);
detailLabel = new JLabel("", JLabel.CENTER);
detailLabel.setPreferredSize(new Dimension(loadingLabel.getPreferredSize()));
detailLabel.setHorizontalAlignment(SwingConstants.CENTER);
//detailLabel.setBounds(0, 45, 150, 20);
//progressBar.setBounds(0, 70, 125, 25);
pan.add(loadingLabel);
pan.add(detailLabel);
pan.add(progressBar);
cnt.add(pan, BorderLayout.CENTER);
//progressBar.setVisible(false);
progressBar.setStringPainted(true);
//progressBar.setVisible(false);
View.setWindowIcon(this);
detailLabel.setHorizontalAlignment(SwingConstants.LEFT);
addWindowListener(new WindowAdapter() {
@@ -24,12 +24,15 @@ import com.jpexs.decompiler.flash.gui.View;
import com.jpexs.decompiler.flash.tags.DefineBinaryDataTag;
import com.jpexs.decompiler.flash.tags.DefineSoundTag;
import com.jpexs.decompiler.flash.tags.DefineSpriteTag;
import com.jpexs.decompiler.flash.tags.DoActionTag;
import com.jpexs.decompiler.flash.tags.DoInitActionTag;
import com.jpexs.decompiler.flash.tags.Tag;
import com.jpexs.decompiler.flash.tags.base.CharacterIdTag;
import com.jpexs.decompiler.flash.tags.base.CharacterTag;
import com.jpexs.decompiler.flash.tags.base.ImageTag;
import com.jpexs.decompiler.flash.tags.base.ShapeTag;
import com.jpexs.decompiler.flash.timeline.Frame;
import com.jpexs.decompiler.flash.timeline.TagScript;
import com.jpexs.decompiler.flash.timeline.Timelined;
import com.jpexs.decompiler.flash.treeitems.FolderItem;
import com.jpexs.decompiler.flash.treeitems.SWFList;
@@ -220,6 +223,13 @@ public class TagTreeContextMenu extends JPopupMenu implements ActionListener {
boolean allSelectedIsTagOrFrame = true;
for (TreeItem item : items) {
if (!(item instanceof Tag) && !(item instanceof Frame)) {
if (item instanceof TagScript) {
Tag tag = ((TagScript) item).getTag();
if (tag instanceof DoActionTag || tag instanceof DoInitActionTag) {
continue;
}
}
allSelectedIsTagOrFrame = false;
break;
}
@@ -459,6 +469,8 @@ public class TagTreeContextMenu extends JPopupMenu implements ActionListener {
for (TreeItem tag : sel) {
if (tag instanceof Tag) {
tagsToRemove.add((Tag) tag);
} else if (tag instanceof TagScript) {
tagsToRemove.add(((TagScript) tag).getTag());
} else if (tag instanceof Frame) {
Frame frameNode = (Frame) tag;
Frame frame = frameNode.timeline.getFrames().get(frameNode.frame);
@@ -86,10 +86,13 @@ public class TagTreeModel implements TreeModel {
private final boolean addAllFolders;
private final Map<Tag, TagScript> tagScriptCache;
public TagTreeModel(List<SWFList> swfs, boolean addAllFolders) {
this.swfs = new ArrayList<>();
this.swfFolders = new HashMap<>();
this.addAllFolders = addAllFolders;
this.tagScriptCache = new HashMap<>();
Main.startWork(AppStrings.translate("work.buildingscripttree") + "...");
for (SWFList swfList : swfs) {
if (swfList.isBundle) {
@@ -256,35 +259,32 @@ public class TagTreeModel implements TreeModel {
subNodes.addAll(timeline.getAS2RootPackage().subPackages.values());
subNodes.addAll(timeline.getAS2RootPackage().scripts.values());
for (Tag tag : swf.tags) {
for (Tag tag : timeline.otherTags) {
boolean hasInnerFrames = false;
List<TreeItem> tagSubNodes = new ArrayList<>();
if (tag instanceof Timelined) {
List<TreeItem> tagSubNodes = new ArrayList<>();
boolean hasInnerFrames = false;
for (Frame frame : ((Timelined) tag).getTimeline().getFrames()) {
if (!frame.actions.isEmpty()) {
Timeline timeline2 = ((Timelined) tag).getTimeline();
for (Frame frame : timeline2.getFrames()) {
if (!frame.actions.isEmpty() || !frame.actionContainers.isEmpty()) {
FrameScript frameScript = new FrameScript(swf, frame);
tagSubNodes.add(frameScript);
hasInnerFrames = true;
}
}
}
if (!hasInnerFrames) {
if (tag instanceof ASMSourceContainer) {
for (ASMSource asm : ((ASMSourceContainer) tag).getSubItems()) {
tagSubNodes.add(asm);
}
}
if (tag instanceof ASMSourceContainer) {
for (ASMSource asm : ((ASMSourceContainer) tag).getSubItems()) {
tagSubNodes.add(asm);
}
}
if (!tagSubNodes.isEmpty()) {
TagScript ts = new TagScript(swf, tag, tagSubNodes);
if (hasInnerFrames) {
subFrames.add(ts);
} else {
subNodes.add(ts);
}
} else if (tag instanceof ASMSource) {
TagScript ts = new TagScript(swf, tag, tagSubNodes);
if (!tagSubNodes.isEmpty()) {
TagScript ts = new TagScript(swf, tag, tagSubNodes);
tagScriptCache.put(tag, ts);
if (hasInnerFrames) {
subFrames.add(ts);
} else {
subNodes.add(ts);
}
}
@@ -293,7 +293,7 @@ public class TagTreeModel implements TreeModel {
subNodes.addAll(subFrames);
for (Frame frame : timeline.getFrames()) {
if (!frame.actions.isEmpty()) {
if (!frame.actions.isEmpty() || !frame.actionContainers.isEmpty()) {
FrameScript frameScript = new FrameScript(swf, frame);
subNodes.add(frameScript);
}
@@ -463,7 +463,30 @@ public class TagTreeModel implements TreeModel {
} else if (parentNode instanceof AS2Package) {
return ((AS2Package) parentNode).getChild(index);
} else if (parentNode instanceof FrameScript) {
return ((FrameScript) parentNode).getFrame().actions.get(index);
Frame parentFrame = ((FrameScript) parentNode).getFrame();
TreeItem result;
if (index < parentFrame.actionContainers.size()) {
result = parentFrame.actionContainers.get(index);
} else {
index -= parentFrame.actionContainers.size();
result = parentFrame.actions.get(index);
}
if (result instanceof Tag) {
Tag resultTag = (Tag) result;
TagScript tagScript = tagScriptCache.get(resultTag);
if (tagScript == null) {
List<TreeItem> subNodes = new ArrayList<>();
if (result instanceof ASMSourceContainer) {
for (ASMSource item : ((ASMSourceContainer) result).getSubItems()) {
subNodes.add(item);
}
}
tagScript = new TagScript(result.getSwf(), resultTag, subNodes);
tagScriptCache.put(resultTag, tagScript);
}
result = tagScript;
}
return result;
} else if (parentNode instanceof TagScript) {
return ((TagScript) parentNode).getFrames().get(index);
} else if (parentNode instanceof ClassesListTreeModel) {
@@ -498,7 +521,8 @@ public class TagTreeModel implements TreeModel {
} else if (parentNode instanceof AS2Package) {
return ((AS2Package) parentNode).getChildCount();
} else if (parentNode instanceof FrameScript) {
return ((FrameScript) parentNode).getFrame().actions.size();
Frame parentFrame = ((FrameScript) parentNode).getFrame();
return parentFrame.actionContainers.size() + parentFrame.actions.size();
} else if (parentNode instanceof TagScript) {
return ((TagScript) parentNode).getFrames().size();
} else if (parentNode instanceof ClassesListTreeModel) {
@@ -541,7 +565,15 @@ public class TagTreeModel implements TreeModel {
} else if (parentNode instanceof AS2Package) {
return ((AS2Package) parentNode).getIndexOfChild(childNode);
} else if (parentNode instanceof FrameScript) {
return ((FrameScript) parentNode).getFrame().actions.indexOf(childNode);
Frame parentFrame = ((FrameScript) parentNode).getFrame();
if (childNode instanceof TagScript) {
childNode = ((TagScript) childNode).getTag();
}
if (childNode instanceof ASMSourceContainer) {
return parentFrame.actionContainers.indexOf(childNode);
} else {
return parentFrame.actionContainers.size() + parentFrame.actions.indexOf(childNode);
}
} else if (parentNode instanceof TagScript) {
return ((TagScript) parentNode).getFrames().indexOf(childNode);
} else if (parentNode instanceof ClassesListTreeModel) {