mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-29 09:46:01 +00:00
update characterids when tag was moved or copied (copy with dependencies is not ready,yet)
This commit is contained in:
@@ -153,6 +153,7 @@ import java.io.OutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.EmptyStackException;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
@@ -179,7 +180,7 @@ public final class SWF implements SWFContainerItem, Timelined {
|
||||
* Default version of SWF file format
|
||||
*/
|
||||
public static final int DEFAULT_VERSION = 10;
|
||||
|
||||
|
||||
/**
|
||||
* Maximum SWF file format version
|
||||
* Needs to be fixed when SWF versions reaches this value
|
||||
@@ -358,7 +359,7 @@ public final class SWF implements SWFContainerItem, Timelined {
|
||||
if (characters == null) {
|
||||
Map<Integer, CharacterTag> chars = new HashMap<>();
|
||||
parseCharacters(tags, chars);
|
||||
characters = chars;
|
||||
characters = Collections.unmodifiableMap(chars);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -506,10 +507,12 @@ public final class SWF implements SWFContainerItem, Timelined {
|
||||
}
|
||||
|
||||
public void resetTimelines(Timelined timelined) {
|
||||
timelined.getTimeline().reset();
|
||||
for (Tag t : timelined.getTimeline().tags) {
|
||||
if (t instanceof Timelined) {
|
||||
resetTimelines((Timelined) t);
|
||||
timelined.resetTimeline();
|
||||
if (timelined instanceof SWF) {
|
||||
for (Tag t : ((SWF) timelined).tags) {
|
||||
if (t instanceof Timelined) {
|
||||
resetTimelines((Timelined) t);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -570,6 +573,13 @@ public final class SWF implements SWFContainerItem, Timelined {
|
||||
return timeline;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetTimeline() {
|
||||
if (timeline != null) {
|
||||
timeline.reset(this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all tags with specified id
|
||||
*
|
||||
@@ -869,9 +879,7 @@ public final class SWF implements SWFContainerItem, Timelined {
|
||||
this.tags = tags;
|
||||
if (!checkOnly) {
|
||||
checkInvalidSprites();
|
||||
Map<Integer, CharacterTag> chars = new HashMap<>();
|
||||
parseCharacters(tags, chars);
|
||||
characters = chars;
|
||||
updateCharacters();
|
||||
assignExportNamesToSymbols();
|
||||
assignClassesToSymbols();
|
||||
SWFDecompilerPlugin.fireSwfParsed(this);
|
||||
@@ -2381,14 +2389,14 @@ public final class SWF implements SWFContainerItem, Timelined {
|
||||
if (drawableFrameCount == 0) {
|
||||
drawableFrameCount = 1;
|
||||
}
|
||||
|
||||
|
||||
int dframe;
|
||||
if (timeline.fontFrameNum != -1) {
|
||||
dframe = timeline.fontFrameNum;
|
||||
} else {
|
||||
dframe = (time + layer.time) % drawableFrameCount;
|
||||
}
|
||||
|
||||
|
||||
if (character instanceof ButtonTag) {
|
||||
dframe = ButtonTag.FRAME_UP;
|
||||
if (renderContext.stateUnderCursor == layer) {
|
||||
@@ -2731,7 +2739,7 @@ public final class SWF implements SWFContainerItem, Timelined {
|
||||
DefineSpriteTag sprite = (DefineSpriteTag) timelined;
|
||||
sprite.setModified(true);
|
||||
}
|
||||
timelined.getTimeline().reset();
|
||||
timelined.resetTimeline();
|
||||
} else {
|
||||
// timeline should be always the swf here
|
||||
if (removeDependencies) {
|
||||
|
||||
@@ -188,6 +188,22 @@ public class DefineButton2Tag extends ButtonTag implements ASMSourceContainer {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceCharacter(int oldCharacterId, int newCharacterId) {
|
||||
boolean modified = false;
|
||||
for (int i = 0; i < characters.size(); i++) {
|
||||
BUTTONRECORD character = characters.get(i);
|
||||
if (character.characterId == oldCharacterId) {
|
||||
character.characterId = newCharacterId;
|
||||
modified = true;
|
||||
}
|
||||
}
|
||||
if (modified) {
|
||||
setModified(true);
|
||||
}
|
||||
return modified;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeCharacter(int characterId) {
|
||||
boolean modified = false;
|
||||
@@ -269,7 +285,19 @@ public class DefineButton2Tag extends ButtonTag implements ASMSourceContainer {
|
||||
}
|
||||
|
||||
timeline = new Timeline(swf, this, new ArrayList<Tag>(), buttonId, getRect());
|
||||
initTimeline(timeline);
|
||||
return timeline;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetTimeline() {
|
||||
if (timeline != null) {
|
||||
timeline.reset(swf, this, new ArrayList<Tag>(), buttonId, getRect());
|
||||
initTimeline(timeline);
|
||||
}
|
||||
}
|
||||
|
||||
private void initTimeline(Timeline timeline) {
|
||||
int maxDepth = 0;
|
||||
Frame frameUp = new Frame(timeline, 0);
|
||||
Frame frameDown = new Frame(timeline, 0);
|
||||
@@ -321,7 +349,6 @@ public class DefineButton2Tag extends ButtonTag implements ASMSourceContainer {
|
||||
}
|
||||
|
||||
timeline.addFrame(frameHit);
|
||||
return timeline;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -239,6 +239,22 @@ public class DefineButtonTag extends ButtonTag implements ASMSource {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceCharacter(int oldCharacterId, int newCharacterId) {
|
||||
boolean modified = false;
|
||||
for (int i = 0; i < characters.size(); i++) {
|
||||
BUTTONRECORD character = characters.get(i);
|
||||
if (character.characterId == oldCharacterId) {
|
||||
character.characterId = newCharacterId;
|
||||
modified = true;
|
||||
}
|
||||
}
|
||||
if (modified) {
|
||||
setModified(true);
|
||||
}
|
||||
return modified;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeCharacter(int characterId) {
|
||||
boolean modified = false;
|
||||
@@ -351,8 +367,21 @@ public class DefineButtonTag extends ButtonTag implements ASMSource {
|
||||
if (timeline != null) {
|
||||
return timeline;
|
||||
}
|
||||
timeline = new Timeline(swf, this, new ArrayList<Tag>(), buttonId, getRect());
|
||||
|
||||
timeline = new Timeline(swf, this, new ArrayList<Tag>(), buttonId, getRect());
|
||||
initTimeline(timeline);
|
||||
return timeline;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetTimeline() {
|
||||
if (timeline != null) {
|
||||
timeline.reset(swf, this, new ArrayList<Tag>(), buttonId, getRect());
|
||||
initTimeline(timeline);
|
||||
}
|
||||
}
|
||||
|
||||
private void initTimeline(Timeline timeline) {
|
||||
ColorTransform clrTrans = null;
|
||||
for (Tag t : swf.tags) {
|
||||
if (t instanceof DefineButtonCxformTag) {
|
||||
@@ -405,8 +434,6 @@ public class DefineButtonTag extends ButtonTag implements ASMSource {
|
||||
frameHit = frameUp;
|
||||
}
|
||||
timeline.addFrame(frameHit);
|
||||
|
||||
return timeline;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -879,6 +879,16 @@ public class DefineEditTextTag extends TextTag {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceCharacter(int oldCharacterId, int newCharacterId) {
|
||||
if (fontId == oldCharacterId) {
|
||||
fontId = newCharacterId;
|
||||
setModified(true);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeCharacter(int characterId) {
|
||||
if (fontId == characterId) {
|
||||
|
||||
@@ -101,6 +101,18 @@ public class DefineMorphShape2Tag extends MorphShapeTag {
|
||||
endEdges.getNeededCharacters(needed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceCharacter(int oldCharacterId, int newCharacterId) {
|
||||
boolean modified = false;
|
||||
modified |= morphFillStyles.replaceCharacter(oldCharacterId, newCharacterId);
|
||||
modified |= startEdges.replaceCharacter(oldCharacterId, newCharacterId);
|
||||
modified |= endEdges.replaceCharacter(oldCharacterId, newCharacterId);
|
||||
if (modified) {
|
||||
setModified(true);
|
||||
}
|
||||
return modified;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeCharacter(int characterId) {
|
||||
boolean modified = false;
|
||||
|
||||
@@ -88,6 +88,18 @@ public class DefineMorphShapeTag extends MorphShapeTag {
|
||||
endEdges.getNeededCharacters(needed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceCharacter(int oldCharacterId, int newCharacterId) {
|
||||
boolean modified = false;
|
||||
modified |= morphFillStyles.replaceCharacter(oldCharacterId, newCharacterId);
|
||||
modified |= startEdges.replaceCharacter(oldCharacterId, newCharacterId);
|
||||
modified |= endEdges.replaceCharacter(oldCharacterId, newCharacterId);
|
||||
if (modified) {
|
||||
setModified(true);
|
||||
}
|
||||
return modified;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeCharacter(int characterId) {
|
||||
boolean modified = false;
|
||||
|
||||
@@ -72,6 +72,15 @@ public class DefineShape2Tag extends ShapeTag {
|
||||
getShapes().getNeededCharacters(needed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceCharacter(int oldCharacterId, int newCharacterId) {
|
||||
boolean modified = getShapes().replaceCharacter(oldCharacterId, newCharacterId);
|
||||
if (modified) {
|
||||
setModified(true);
|
||||
}
|
||||
return modified;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeCharacter(int characterId) {
|
||||
boolean modified = getShapes().removeCharacter(characterId);
|
||||
|
||||
@@ -72,6 +72,15 @@ public class DefineShape3Tag extends ShapeTag {
|
||||
getShapes().getNeededCharacters(needed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceCharacter(int oldCharacterId, int newCharacterId) {
|
||||
boolean modified = getShapes().replaceCharacter(oldCharacterId, newCharacterId);
|
||||
if (modified) {
|
||||
setModified(true);
|
||||
}
|
||||
return modified;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeCharacter(int characterId) {
|
||||
boolean modified = getShapes().removeCharacter(characterId);
|
||||
|
||||
@@ -85,6 +85,15 @@ public class DefineShape4Tag extends ShapeTag {
|
||||
getShapes().getNeededCharacters(needed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceCharacter(int oldCharacterId, int newCharacterId) {
|
||||
boolean modified = getShapes().replaceCharacter(oldCharacterId, newCharacterId);
|
||||
if (modified) {
|
||||
setModified(true);
|
||||
}
|
||||
return modified;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeCharacter(int characterId) {
|
||||
boolean modified = getShapes().removeCharacter(characterId);
|
||||
|
||||
@@ -71,6 +71,15 @@ public class DefineShapeTag extends ShapeTag {
|
||||
getShapes().getNeededCharacters(needed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceCharacter(int oldCharacterId, int newCharacterId) {
|
||||
boolean modified = getShapes().replaceCharacter(oldCharacterId, newCharacterId);
|
||||
if (modified) {
|
||||
setModified(true);
|
||||
}
|
||||
return modified;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeCharacter(int characterId) {
|
||||
boolean modified = getShapes().removeCharacter(characterId);
|
||||
|
||||
@@ -93,6 +93,13 @@ public class DefineSpriteTag extends CharacterTag implements DrawableTag, Timeli
|
||||
return timeline;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetTimeline() {
|
||||
if (timeline != null) {
|
||||
timeline.reset(swf, this, subTags, spriteId, getRect());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCharacterId() {
|
||||
return spriteId;
|
||||
@@ -288,6 +295,15 @@ public class DefineSpriteTag extends CharacterTag implements DrawableTag, Timeli
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceCharacter(int oldCharacterId, int newCharacterId) {
|
||||
boolean modified = getTimeline().replaceCharacter(oldCharacterId, newCharacterId);
|
||||
if (modified) {
|
||||
setModified(true);
|
||||
}
|
||||
return modified;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeCharacter(int characterId) {
|
||||
boolean modified = getTimeline().removeCharacter(characterId);
|
||||
|
||||
@@ -579,6 +579,21 @@ public class DefineText2Tag extends TextTag {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceCharacter(int oldCharacterId, int newCharacterId) {
|
||||
boolean modified = false;
|
||||
for (TEXTRECORD tr : textRecords) {
|
||||
if (tr.fontId == oldCharacterId) {
|
||||
tr.fontId = newCharacterId;
|
||||
modified = true;
|
||||
}
|
||||
}
|
||||
if (modified) {
|
||||
setModified(true);
|
||||
}
|
||||
return modified;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeCharacter(int characterId) {
|
||||
boolean modified = false;
|
||||
|
||||
@@ -591,6 +591,21 @@ public class DefineTextTag extends TextTag {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceCharacter(int oldCharacterId, int newCharacterId) {
|
||||
boolean modified = false;
|
||||
for (TEXTRECORD tr : textRecords) {
|
||||
if (tr.fontId == oldCharacterId) {
|
||||
tr.fontId = newCharacterId;
|
||||
modified = true;
|
||||
}
|
||||
}
|
||||
if (modified) {
|
||||
setModified(true);
|
||||
}
|
||||
return modified;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeCharacter(int characterId) {
|
||||
boolean modified = false;
|
||||
|
||||
@@ -303,6 +303,11 @@ public class PlaceObject2Tag extends PlaceObjectTypeTag implements ASMSourceCont
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceCharacter(int oldCharacterId, int newCharacterId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeCharacter(int characterId) {
|
||||
// the place object tag will be removed
|
||||
|
||||
@@ -438,6 +438,11 @@ public class PlaceObject3Tag extends PlaceObjectTypeTag implements ASMSourceCont
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceCharacter(int oldCharacterId, int newCharacterId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeCharacter(int characterId) {
|
||||
// the place object tag will be removed
|
||||
|
||||
@@ -441,6 +441,11 @@ public class PlaceObject4Tag extends PlaceObjectTypeTag implements ASMSourceCont
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceCharacter(int oldCharacterId, int newCharacterId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeCharacter(int characterId) {
|
||||
// the place object tag will be removed
|
||||
|
||||
@@ -146,6 +146,11 @@ public class PlaceObjectTag extends PlaceObjectTypeTag {
|
||||
needed.add(characterId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceCharacter(int oldCharacterId, int newCharacterId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeCharacter(int characterId) {
|
||||
// the place object tag will be removed
|
||||
|
||||
@@ -573,6 +573,11 @@ public abstract class Tag implements NeedsCharacters, Exportable, Serializable {
|
||||
public void getNeededCharacters(Set<Integer> needed) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceCharacter(int oldCharacterId, int newCharacterId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeCharacter(int characterId) {
|
||||
return false;
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3.0 of the License, or (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* 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.tags.base;
|
||||
|
||||
import java.util.Set;
|
||||
@@ -25,5 +26,7 @@ public interface NeedsCharacters {
|
||||
|
||||
public void getNeededCharacters(Set<Integer> needed);
|
||||
|
||||
public boolean replaceCharacter(int oldCharacterId, int newCharacterId);
|
||||
|
||||
public boolean removeCharacter(int characterId);
|
||||
}
|
||||
|
||||
@@ -133,6 +133,11 @@ public abstract class ShapeTag extends CharacterTag implements DrawableTag, Lazy
|
||||
getShapes().getNeededCharacters(needed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceCharacter(int oldCharacterId, int newCharacterId) {
|
||||
return getShapes().replaceCharacter(oldCharacterId, newCharacterId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeCharacter(int characterId) {
|
||||
return getShapes().removeCharacter(characterId);
|
||||
|
||||
@@ -72,7 +72,7 @@ public class Timeline {
|
||||
public int maxDepth;
|
||||
|
||||
public int fontFrameNum = -1;
|
||||
|
||||
|
||||
public List<Tag> tags;
|
||||
|
||||
private final List<Frame> frames = new ArrayList<>();
|
||||
@@ -124,7 +124,11 @@ public class Timeline {
|
||||
return depthMaxFrame;
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
public void reset(SWF swf) {
|
||||
reset(swf, null, swf.tags, 0, swf.displayRect);
|
||||
}
|
||||
|
||||
public void reset(SWF swf, Tag parentTag, List<Tag> tags, int id, RECT displayRect) {
|
||||
initialized = false;
|
||||
frames.clear();
|
||||
depthMaxFrame.clear();
|
||||
@@ -132,6 +136,13 @@ public class Timeline {
|
||||
asmSourceContainers.clear();
|
||||
actionFrames.clear();
|
||||
otherTags.clear();
|
||||
this.id = id;
|
||||
this.swf = swf;
|
||||
this.displayRect = displayRect;
|
||||
this.frameRate = swf.frameRate;
|
||||
this.timelined = parentTag == null ? swf : (Timelined) parentTag;
|
||||
this.parentTag = parentTag;
|
||||
this.tags = tags;
|
||||
as2RootPackage = new AS2Package(null, null, swf);
|
||||
}
|
||||
|
||||
@@ -425,6 +436,18 @@ public class Timeline {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean replaceCharacter(int oldCharacterId, int newCharacterId) {
|
||||
boolean modified = false;
|
||||
for (int i = 0; i < tags.size(); i++) {
|
||||
Tag t = tags.get(i);
|
||||
if (t instanceof CharacterIdTag && ((CharacterIdTag) t).getCharacterId() == oldCharacterId) {
|
||||
((CharacterIdTag) t).setCharacterId(newCharacterId);
|
||||
modified = true;
|
||||
}
|
||||
}
|
||||
return modified;
|
||||
}
|
||||
|
||||
public boolean removeCharacter(int characterId) {
|
||||
boolean modified = false;
|
||||
for (int i = 0; i < tags.size(); i++) {
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3.0 of the License, or (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* 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.tags.base.BoundedTag;
|
||||
@@ -24,4 +25,6 @@ import com.jpexs.decompiler.flash.tags.base.BoundedTag;
|
||||
public interface Timelined extends BoundedTag {
|
||||
|
||||
public Timeline getTimeline();
|
||||
|
||||
public void resetTimeline();
|
||||
}
|
||||
|
||||
@@ -79,6 +79,15 @@ public class FILLSTYLE implements NeedsCharacters, Serializable {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceCharacter(int oldCharacterId, int newCharacterId) {
|
||||
if (bitmapId == oldCharacterId) {
|
||||
bitmapId = newCharacterId;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeCharacter(int characterId) {
|
||||
if (bitmapId == characterId) {
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3.0 of the License, or (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* 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.types;
|
||||
|
||||
import com.jpexs.decompiler.flash.tags.base.NeedsCharacters;
|
||||
@@ -34,6 +35,15 @@ public class FILLSTYLEARRAY implements NeedsCharacters, Serializable {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceCharacter(int oldCharacterId, int newCharacterId) {
|
||||
boolean modified = false;
|
||||
for (FILLSTYLE fs : fillStyles) {
|
||||
modified |= fs.replaceCharacter(oldCharacterId, newCharacterId);
|
||||
}
|
||||
return modified;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeCharacter(int characterId) {
|
||||
boolean modified = false;
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3.0 of the License, or (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* 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.types;
|
||||
|
||||
import com.jpexs.decompiler.flash.tags.DefineShape3Tag;
|
||||
@@ -39,6 +40,11 @@ public class LINESTYLE implements NeedsCharacters, Serializable {
|
||||
public void getNeededCharacters(Set<Integer> needed) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceCharacter(int oldCharacterId, int newCharacterId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeCharacter(int characterId) {
|
||||
return false;
|
||||
|
||||
@@ -76,6 +76,14 @@ public class LINESTYLE2 extends LINESTYLE implements Serializable {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceCharacter(int oldCharacterId, int newCharacterId) {
|
||||
if (fillType != null) {
|
||||
return fillType.replaceCharacter(oldCharacterId, newCharacterId);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeCharacter(int characterId) {
|
||||
if (fillType != null) {
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3.0 of the License, or (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* 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.types;
|
||||
|
||||
import com.jpexs.decompiler.flash.tags.base.NeedsCharacters;
|
||||
@@ -34,6 +35,15 @@ public class LINESTYLEARRAY implements NeedsCharacters, Serializable {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceCharacter(int oldCharacterId, int newCharacterId) {
|
||||
boolean modified = false;
|
||||
for (LINESTYLE ls : lineStyles) {
|
||||
modified |= ls.replaceCharacter(oldCharacterId, newCharacterId);
|
||||
}
|
||||
return modified;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeCharacter(int characterId) {
|
||||
boolean modified = false;
|
||||
|
||||
@@ -81,6 +81,15 @@ public class MORPHFILLSTYLE implements NeedsCharacters, Serializable {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceCharacter(int oldCharacterId, int newCharacterId) {
|
||||
if (bitmapId == oldCharacterId) {
|
||||
bitmapId = newCharacterId;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeCharacter(int characterId) {
|
||||
if (bitmapId == characterId) {
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3.0 of the License, or (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* 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.types;
|
||||
|
||||
import com.jpexs.decompiler.flash.tags.base.NeedsCharacters;
|
||||
@@ -34,6 +35,15 @@ public class MORPHFILLSTYLEARRAY implements NeedsCharacters, Serializable {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceCharacter(int oldCharacterId, int newCharacterId) {
|
||||
boolean modified = false;
|
||||
for (MORPHFILLSTYLE fs : fillStyles) {
|
||||
modified |= fs.replaceCharacter(oldCharacterId, newCharacterId);
|
||||
}
|
||||
return modified;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeCharacter(int characterId) {
|
||||
boolean modified = false;
|
||||
|
||||
@@ -52,6 +52,15 @@ public class SHAPE implements NeedsCharacters, Serializable {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceCharacter(int oldCharacterId, int newCharacterId) {
|
||||
boolean modified = false;
|
||||
for (SHAPERECORD r : shapeRecords) {
|
||||
modified |= r.replaceCharacter(oldCharacterId, newCharacterId);
|
||||
}
|
||||
return modified;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeCharacter(int characterId) {
|
||||
boolean modified = false;
|
||||
|
||||
@@ -42,6 +42,17 @@ public class SHAPEWITHSTYLE extends SHAPE implements NeedsCharacters, Serializab
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceCharacter(int oldCharacterId, int newCharacterId) {
|
||||
boolean modified = false;
|
||||
modified |= fillStyles.replaceCharacter(oldCharacterId, newCharacterId);
|
||||
modified |= lineStyles.replaceCharacter(oldCharacterId, newCharacterId);
|
||||
for (SHAPERECORD r : shapeRecords) {
|
||||
modified |= r.replaceCharacter(oldCharacterId, newCharacterId);
|
||||
}
|
||||
return modified;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeCharacter(int characterId) {
|
||||
boolean modified = false;
|
||||
|
||||
@@ -59,6 +59,11 @@ public abstract class SHAPERECORD implements Cloneable, NeedsCharacters, Seriali
|
||||
public void getNeededCharacters(Set<Integer> needed) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceCharacter(int oldCharacterId, int newCharacterId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeCharacter(int characterId) {
|
||||
return false;
|
||||
|
||||
@@ -89,6 +89,14 @@ public final class StyleChangeRecord extends SHAPERECORD implements Cloneable {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceCharacter(int oldCharacterId, int newCharacterId) {
|
||||
if (fillStyles != null) {
|
||||
return fillStyles.replaceCharacter(oldCharacterId, newCharacterId);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeCharacter(int characterId) {
|
||||
if (fillStyles != null) {
|
||||
|
||||
Reference in New Issue
Block a user