Fixed Copy / Move to tag tree refreshing

This commit is contained in:
Jindra Petřík
2022-11-06 21:44:39 +01:00
parent 5577c60d78
commit f652a2aed7
3 changed files with 23 additions and 9 deletions
@@ -1159,6 +1159,8 @@ public class TagTreeContextMenu extends JPopupMenu {
}
private void moveTagToActionPerformed(ActionEvent evt, List<TreeItem> items, SWF targetSwf) {
ReadOnlyTagList tags = targetSwf.getTags();;
boolean lastIsShowFrame = !tags.isEmpty() && (tags.get(tags.size() - 1) instanceof ShowFrameTag);
SWF sourceSwf = items.get(0).getSwf();
for (TreeItem item : items) {
Tag tag = (Tag) item;
@@ -1170,6 +1172,9 @@ public class TagTreeContextMenu extends JPopupMenu {
tag.setModified(true);
}
if (lastIsShowFrame) {
targetSwf.frameCount++;
}
sourceSwf.assignExportNamesToSymbols();
targetSwf.assignExportNamesToSymbols();
sourceSwf.assignClassesToSymbols();
@@ -1185,16 +1190,25 @@ public class TagTreeContextMenu extends JPopupMenu {
private void copyTagToActionPerformed(ActionEvent evt, List<TreeItem> items, SWF targetSwf) {
try {
ReadOnlyTagList tags = targetSwf.getTags();;
boolean lastIsShowFrame = !tags.isEmpty() && (tags.get(tags.size() - 1) instanceof ShowFrameTag);
for (TreeItem item : items) {
Tag tag = (Tag) item;
Tag copyTag = tag.cloneTag();
copyTag.setSwf(targetSwf, true);
copyTag.setTimelined(targetSwf);
targetSwf.addTag(copyTag);
checkUniqueCharacterId(copyTag);
targetSwf.updateCharacters();
copyTag.setModified(true);
}
if (lastIsShowFrame) {
targetSwf.frameCount++;
}
targetSwf.resetTimelines(targetSwf);
targetSwf.assignExportNamesToSymbols();
targetSwf.assignClassesToSymbols();
targetSwf.clearImageCache();
@@ -1207,6 +1221,8 @@ public class TagTreeContextMenu extends JPopupMenu {
private void copyTagWithDependenciesToActionPerformed(ActionEvent evt, List<TreeItem> items, SWF targetSwf) {
try {
ReadOnlyTagList tags = targetSwf.getTags();;
boolean lastIsShowFrame = !tags.isEmpty() && (tags.get(tags.size() - 1) instanceof ShowFrameTag);
SWF sourceSwf = items.get(0).getSwf();
for (TreeItem item : items) {
Set<Tag> copiedTags = new HashSet<>();
@@ -1267,6 +1283,10 @@ public class TagTreeContextMenu extends JPopupMenu {
}
}
}
if (lastIsShowFrame) {
targetSwf.frameCount++;
}
targetSwf.assignExportNamesToSymbols();
targetSwf.assignClassesToSymbols();