mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-24 19:51:38 +00:00
Reset modified flag on undo.
This commit is contained in:
@@ -55,6 +55,12 @@ public interface Timelined extends BoundedTag {
|
|||||||
*/
|
*/
|
||||||
public void setModified(boolean value);
|
public void setModified(boolean value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets modification flag.
|
||||||
|
* @return True of modified
|
||||||
|
*/
|
||||||
|
public boolean isModified();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets tags.
|
* Gets tags.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -126,10 +126,13 @@ public class EasySwfPanel extends JPanel {
|
|||||||
final boolean transformEnabled = transformEnabled();
|
final boolean transformEnabled = transformEnabled();
|
||||||
undoManager.doOperation(new DoableOperation() {
|
undoManager.doOperation(new DoableOperation() {
|
||||||
|
|
||||||
|
private boolean wasModified = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doOperation() {
|
public void doOperation() {
|
||||||
timelinePanel.setFrame(frame, depth);
|
timelinePanel.setFrame(frame, depth);
|
||||||
DepthState ds = stagePanel.getTimelined().getTimeline().getFrame(frame).layers.get(depth);
|
DepthState ds = stagePanel.getTimelined().getTimeline().getFrame(frame).layers.get(depth);
|
||||||
|
wasModified = ds.placeObjectTag.isModified();
|
||||||
ds.placeObjectTag.setMatrix(newMatrix);
|
ds.placeObjectTag.setMatrix(newMatrix);
|
||||||
ds.placeObjectTag.setPlaceFlagHasMatrix(newMatrix != null);
|
ds.placeObjectTag.setPlaceFlagHasMatrix(newMatrix != null);
|
||||||
ds.placeObjectTag.setModified(true);
|
ds.placeObjectTag.setModified(true);
|
||||||
@@ -151,6 +154,9 @@ public class EasySwfPanel extends JPanel {
|
|||||||
DepthState ds = stagePanel.getTimelined().getTimeline().getFrame(frame).layers.get(depth);
|
DepthState ds = stagePanel.getTimelined().getTimeline().getFrame(frame).layers.get(depth);
|
||||||
ds.placeObjectTag.setMatrix(fpreviousMatrix);
|
ds.placeObjectTag.setMatrix(fpreviousMatrix);
|
||||||
ds.placeObjectTag.setPlaceFlagHasMatrix(fpreviousMatrix != null);
|
ds.placeObjectTag.setPlaceFlagHasMatrix(fpreviousMatrix != null);
|
||||||
|
if (!wasModified) {
|
||||||
|
ds.placeObjectTag.setModified(false);
|
||||||
|
}
|
||||||
stagePanel.getTimelined().resetTimeline();
|
stagePanel.getTimelined().resetTimeline();
|
||||||
stagePanel.repaint();
|
stagePanel.repaint();
|
||||||
if (transformEnabled()) {
|
if (transformEnabled()) {
|
||||||
@@ -190,26 +196,27 @@ public class EasySwfPanel extends JPanel {
|
|||||||
|| (tag instanceof ButtonTag)
|
|| (tag instanceof ButtonTag)
|
||||||
) {
|
) {
|
||||||
|
|
||||||
undoManager.doOperation(new DoableOperation() {
|
undoManager.doOperation(new TimelinedTagListDoableOperation(stagePanel.getTimelined()) {
|
||||||
|
|
||||||
private PlaceObject2Tag place;
|
private List<Tag> swfTags;
|
||||||
private RemoveObject2Tag remove;
|
private final int fframe = stagePanel.getFrame();
|
||||||
private List<Tag> tags;
|
private final int fdepth = stagePanel.getSelectedDepth();
|
||||||
private int frame = stagePanel.getFrame();
|
|
||||||
private int depth = stagePanel.getSelectedDepth();
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doOperation() {
|
public void doOperation() {
|
||||||
timelinePanel.setFrame(frame, depth);
|
super.doOperation();
|
||||||
|
timelinePanel.setFrame(fframe, fdepth);
|
||||||
CharacterTag ch = (CharacterTag) tag;
|
CharacterTag ch = (CharacterTag) tag;
|
||||||
int maxDepth = stagePanel.getTimelined().getTimeline().getMaxDepth();
|
int maxDepth = stagePanel.getTimelined().getTimeline().getMaxDepth();
|
||||||
int newDepth = maxDepth + 1;
|
int newDepth = maxDepth + 1;
|
||||||
Timelined timelined = stagePanel.getTimelined();
|
Timelined timelined = stagePanel.getTimelined();
|
||||||
|
|
||||||
tags = timelined.getSwf().getTags().toArrayList();
|
if (timelined.getSwf() != timelined) {
|
||||||
|
swfTags = timelined.getSwf().getTags().toArrayList();
|
||||||
|
}
|
||||||
|
|
||||||
ShowFrameTag showFrameTag = timelined.getTimeline().getFrame(frame).showFrameTag;
|
ShowFrameTag showFrameTag = timelined.getTimeline().getFrame(fframe).showFrameTag;
|
||||||
place = new PlaceObject2Tag(timelined.getSwf());
|
PlaceObject2Tag place = new PlaceObject2Tag(timelined.getSwf());
|
||||||
place.depth = newDepth;
|
place.depth = newDepth;
|
||||||
place.placeFlagHasCharacter = true;
|
place.placeFlagHasCharacter = true;
|
||||||
place.characterId = ch.getCharacterId();
|
place.characterId = ch.getCharacterId();
|
||||||
@@ -221,7 +228,7 @@ public class EasySwfPanel extends JPanel {
|
|||||||
} else {
|
} else {
|
||||||
timelined.addTag(timelined.indexOfTag(showFrameTag), place);
|
timelined.addTag(timelined.indexOfTag(showFrameTag), place);
|
||||||
|
|
||||||
remove = new RemoveObject2Tag(timelined.getSwf());
|
RemoveObject2Tag remove = new RemoveObject2Tag(timelined.getSwf());
|
||||||
remove.depth = newDepth;
|
remove.depth = newDepth;
|
||||||
timelined.addTag(timelined.indexOfTag(showFrameTag) + 1, remove);
|
timelined.addTag(timelined.indexOfTag(showFrameTag) + 1, remove);
|
||||||
}
|
}
|
||||||
@@ -230,7 +237,7 @@ public class EasySwfPanel extends JPanel {
|
|||||||
DefineBeforeUsageFixer fixer = new DefineBeforeUsageFixer();
|
DefineBeforeUsageFixer fixer = new DefineBeforeUsageFixer();
|
||||||
boolean tagOrderChanged = fixer.fixDefineBeforeUsage(timelined.getSwf());
|
boolean tagOrderChanged = fixer.fixDefineBeforeUsage(timelined.getSwf());
|
||||||
if (!tagOrderChanged) {
|
if (!tagOrderChanged) {
|
||||||
tags = null;
|
swfTags = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
timelined.resetTimeline();
|
timelined.resetTimeline();
|
||||||
@@ -241,33 +248,25 @@ public class EasySwfPanel extends JPanel {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void undoOperation() {
|
public void undoOperation() {
|
||||||
Timelined timelined = place.getTimelined();
|
super.undoOperation();
|
||||||
timelined.removeTag(place);
|
|
||||||
if (remove != null) {
|
|
||||||
timelined.removeTag(remove);
|
|
||||||
}
|
|
||||||
timelined.resetTimeline();
|
timelined.resetTimeline();
|
||||||
|
|
||||||
//Tag order changed, put the original tags back
|
//Tag order changed, put the original tags back
|
||||||
if (tags != null) {
|
if (swfTags != null) {
|
||||||
SWF swf = timelined.getSwf();
|
SWF swf = timelined.getSwf();
|
||||||
ReadOnlyTagList newTags = swf.getTags();
|
ReadOnlyTagList newTags = swf.getTags();
|
||||||
int size = newTags.size();
|
int size = newTags.size();
|
||||||
for (int i = 0; i < size; i++) {
|
for (int i = 0; i < size; i++) {
|
||||||
swf.removeTag(0);
|
swf.removeTag(0);
|
||||||
}
|
}
|
||||||
for (int i = 0; i < tags.size(); i++) {
|
for (int i = 0; i < swfTags.size(); i++) {
|
||||||
if (tags.get(i) == place) {
|
swf.addTag(swfTags.get(i));
|
||||||
continue;
|
|
||||||
}
|
|
||||||
swf.addTag(tags.get(i));
|
|
||||||
}
|
}
|
||||||
swf.resetTimeline();
|
swf.resetTimeline();
|
||||||
}
|
}
|
||||||
|
|
||||||
stagePanel.repaint();
|
stagePanel.repaint();
|
||||||
timelinePanel.refresh();
|
timelinePanel.refresh();
|
||||||
timelinePanel.setFrame(frame, depth);
|
timelinePanel.setFrame(fframe, fdepth);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ public abstract class TimelinedTagListDoableOperation implements DoableOperation
|
|||||||
|
|
||||||
private final Timelined timelined;
|
private final Timelined timelined;
|
||||||
protected List<Tag> tags;
|
protected List<Tag> tags;
|
||||||
|
protected boolean wasModified = false;
|
||||||
|
|
||||||
public TimelinedTagListDoableOperation(Timelined timelined) {
|
public TimelinedTagListDoableOperation(Timelined timelined) {
|
||||||
this.timelined = timelined;
|
this.timelined = timelined;
|
||||||
@@ -37,6 +38,7 @@ public abstract class TimelinedTagListDoableOperation implements DoableOperation
|
|||||||
@Override
|
@Override
|
||||||
public void doOperation() {
|
public void doOperation() {
|
||||||
saveTagList();
|
saveTagList();
|
||||||
|
wasModified = timelined.isModified();
|
||||||
timelined.setModified(true);
|
timelined.setModified(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,6 +64,9 @@ public abstract class TimelinedTagListDoableOperation implements DoableOperation
|
|||||||
@Override
|
@Override
|
||||||
public void undoOperation() {
|
public void undoOperation() {
|
||||||
restoreTagList();
|
restoreTagList();
|
||||||
|
if (!wasModified) {
|
||||||
|
timelined.setModified(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -5961,6 +5961,11 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isModified() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ReadOnlyTagList getTags() {
|
public ReadOnlyTagList getTags() {
|
||||||
if (cachedTags == null) {
|
if (cachedTags == null) {
|
||||||
|
|||||||
@@ -2778,6 +2778,11 @@ public class PreviewPanel extends JPersistentSplitPane implements TagEditorPanel
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isModified() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ReadOnlyTagList getTags() {
|
public ReadOnlyTagList getTags() {
|
||||||
if (cachedTags == null) {
|
if (cachedTags == null) {
|
||||||
|
|||||||
@@ -305,6 +305,11 @@ public class TimelinedMaker {
|
|||||||
public void setModified(boolean value) {
|
public void setModified(boolean value) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isModified() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ReadOnlyTagList getTags() {
|
public ReadOnlyTagList getTags() {
|
||||||
return ReadOnlyTagList.EMPTY;
|
return ReadOnlyTagList.EMPTY;
|
||||||
|
|||||||
Reference in New Issue
Block a user