Clone tags and frames

This commit is contained in:
Exund
2022-10-23 19:36:10 +02:00
committed by Jindra Petřík
parent 8e011e6392
commit 2fb840baac
8 changed files with 167 additions and 22 deletions

View File

@@ -3190,13 +3190,19 @@ public final class SWF implements SWFContainerItem, Timelined {
updateCharacters();
}
}
public int indexOfTag(Tag tag) {
return tags.indexOf(tag);
}
/**
* Adds a tag to the SWF If targetTreeItem is: - Frame: adds the tag to the
* Adds a tag to the SWF If targetTreeItem is:
* - Frame: adds the tag to the
* Frame. Frame can be a frame of the main timeline or a DefineSprite frame
* - DefineSprite: adds the tag to the end of the DefineSprite's tag list -
* Any other tag in the SWF: adds the new tag exactly before the specified
* tag - Other: adds the tag to the end of the SWF's tag list
* - DefineSprite: adds the tag to the end of the DefineSprite's tag list
* - Any other tag in the SWF: adds the new tag exactly before the specified
* tag
* - Other: adds the tag to the end of the SWF's tag list
*
* @param tag
* @param targetTreeItem

View File

@@ -327,6 +327,11 @@ public class DefineSpriteTag extends DrawableTag implements Timelined {
subTags.add(index, tag);
}
@Override
public int indexOfTag(Tag tag) {
return subTags.indexOf(tag);
}
@Override
public void createOriginalData() {
super.createOriginalData();

View File

@@ -172,6 +172,11 @@ public abstract class ButtonTag extends DrawableTag implements Timelined {
@Override
public void addTag(int index, Tag tag) {
}
@Override
public int indexOfTag(Tag tag) {
return -1;
}
@Override
public void replaceTag(int index, Tag newTag) {

View File

@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.timeline;
import com.jpexs.decompiler.flash.ReadOnlyTagList;
@@ -42,4 +43,6 @@ public interface Timelined extends BoundedTag {
public void addTag(int index, Tag tag);
public void replaceTag(int index, Tag newTag);
public int indexOfTag(Tag tag);
}