Skip to content

Commit

Permalink
Added #1959 Display frame labels along frames and FrameLabel tags
Browse files Browse the repository at this point in the history
  • Loading branch information
jindrapetrik committed Feb 12, 2023
1 parent aaa3548 commit b43f99e
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,10 @@ public String getLabelName() {
public boolean isNamedAnchor() {
return namedAnchor;
}

@Override
public String toString() {
return getName() + (name.isEmpty() ? "" : " (" + name + ")");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -93,7 +94,17 @@ public Openable getOpenable() {

@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
Expand Down
22 changes: 17 additions & 5 deletions src/com/jpexs/decompiler/flash/gui/SelectTagPositionDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
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;
Expand Down Expand Up @@ -163,9 +164,11 @@ private static class MyFrame {

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() {
Expand All @@ -182,15 +185,20 @@ public boolean isInvalid() {

@Override
public String toString() {
return "frame " + frame;
String name = "frame " + frame;
if (!labels.isEmpty()) {
name += " (" + String.join(", ", labels) + ")";
}
return name;
}
}

private void populateNodes(MyTreeNode root, Timelined tim) {
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);

Expand All @@ -204,12 +212,16 @@ private void populateNodes(MyTreeNode root, Timelined tim) {
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()) {
Expand Down

0 comments on commit b43f99e

Please sign in to comment.