Added #1959 Display frame labels along frames and FrameLabel tags

This commit is contained in:
Jindra Petřík
2023-02-04 19:36:21 +01:00
parent aaa354804e
commit b43f99efe6
4 changed files with 39 additions and 6 deletions

View File

@@ -2,6 +2,9 @@
All notable changes to this project will be documented in this file.
## [Unreleased]
### Added
- [#1959] Display frame labels along frames and FrameLabel tags
### Fixed
- [#1960] Hide tag tree root handles as it was in previous versions
- [#1964] Freezing on releasing mouse while shape transforming (deadlock)
@@ -2939,6 +2942,7 @@ All notable changes to this project will be documented in this file.
[alpha 9]: https://github.com/jindrapetrik/jpexs-decompiler/compare/alpha8...alpha9
[alpha 8]: https://github.com/jindrapetrik/jpexs-decompiler/compare/alpha7...alpha8
[alpha 7]: https://github.com/jindrapetrik/jpexs-decompiler/releases/tag/alpha7
[#1959]: https://www.free-decompiler.com/flash/issues/1959
[#1960]: https://www.free-decompiler.com/flash/issues/1960
[#1964]: https://www.free-decompiler.com/flash/issues/1964
[#1961]: https://www.free-decompiler.com/flash/issues/1961

View File

@@ -86,4 +86,10 @@ public class FrameLabelTag extends Tag {
public boolean isNamedAnchor() {
return namedAnchor;
}
@Override
public String toString() {
return getName() + (name.isEmpty() ? "" : " (" + name + ")");
}
}

View File

@@ -17,6 +17,7 @@
package com.jpexs.decompiler.flash.timeline;
import com.jpexs.decompiler.flash.tags.DoActionTag;
import com.jpexs.decompiler.flash.tags.FrameLabelTag;
import com.jpexs.decompiler.flash.tags.ShowFrameTag;
import com.jpexs.decompiler.flash.tags.Tag;
import com.jpexs.decompiler.flash.tags.base.ASMSourceContainer;
@@ -93,7 +94,17 @@ public class Frame implements TreeItem, Exportable {
@Override
public String toString() {
return "frame " + (frame + 1);
String name = "frame " + (frame + 1);
List<String> labels = new ArrayList<>();
for (Tag t : innerTags) {
if (t instanceof FrameLabelTag) {
labels.add(((FrameLabelTag)t).name);
}
}
if (!labels.isEmpty()) {
name += " (" + String.join(", ", labels) + ")";
}
return name;
}
@Override

View File

@@ -22,6 +22,7 @@ import static com.jpexs.decompiler.flash.gui.AppDialog.CANCEL_OPTION;
import com.jpexs.decompiler.flash.gui.tagtree.TagTree;
import com.jpexs.decompiler.flash.tags.DefineSpriteTag;
import com.jpexs.decompiler.flash.tags.DoInitActionTag;
import com.jpexs.decompiler.flash.tags.FrameLabelTag;
import com.jpexs.decompiler.flash.tags.ShowFrameTag;
import com.jpexs.decompiler.flash.tags.Tag;
import com.jpexs.decompiler.flash.timeline.Timelined;
@@ -163,9 +164,11 @@ public class SelectTagPositionDialog extends AppDialog {
private final int frame;
private boolean invalid;
private List<String> labels;
public MyFrame(int frame) {
public MyFrame(int frame, List<String> labels) {
this.frame = frame;
this.labels = labels;
}
public int getFrame() {
@@ -182,7 +185,11 @@ public class SelectTagPositionDialog extends AppDialog {
@Override
public String toString() {
return "frame " + frame;
String name = "frame " + frame;
if (!labels.isEmpty()) {
name += " (" + String.join(", ", labels) + ")";
}
return name;
}
}
@@ -190,7 +197,8 @@ public class SelectTagPositionDialog extends AppDialog {
int f = 1;
MyTreeNode frameNode = new MyTreeNode();
frameNode.setData(new MyFrame(1));
List<String> labels = new ArrayList<>();
frameNode.setData(new MyFrame(1, labels));
frameNode.setParent(root);
root.addChild(frameNode);
@@ -204,12 +212,16 @@ public class SelectTagPositionDialog extends AppDialog {
populateNodes(node, (DefineSpriteTag) t);
}
}
if (t instanceof FrameLabelTag) {
labels.add(((FrameLabelTag)t).name);
}
if (t instanceof ShowFrameTag) {
f++;
frameNode = new MyTreeNode();
frameNode.setData(new MyFrame(f));
labels = new ArrayList<>();
frameNode.setData(new MyFrame(f, labels));
frameNode.setParent(root);
root.addChild(frameNode);
root.addChild(frameNode);
}
}
if (frameNode.isLeaf()) {