This commit is contained in:
honfika@gmail.com
2015-02-26 23:56:48 +01:00
parent 88adac7965
commit 2befbcb65d
15 changed files with 147 additions and 84 deletions

View File

@@ -0,0 +1,32 @@
/*
* 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.
*/
package com.jpexs.decompiler.flash;
/**
*
* @author JPEXS
*/
public class BigObject {
private byte[] dummy = new byte[512 * 1024 * 1024];
@Override
protected void finalize() throws Throwable {
super.finalize();
System.out.println("swf finalized");
}
}

View File

@@ -182,6 +182,8 @@ import org.monte.media.avi.AVIWriter;
*/
public final class SWF implements SWFContainerItem, Timelined {
// big object for testing cleanup
//BigObject bigObj = new BigObject();
/**
* Default version of SWF file format
*/

View File

@@ -409,6 +409,10 @@ public class Configuration {
@ConfigurationCategory("ui")
public static final ConfigurationItem<Boolean> editorMode = null;
@ConfigurationDefaultBoolean(false)
@ConfigurationCategory("ui")
public static final ConfigurationItem<Boolean> autoSaveTagModifications = null;
private enum OSId {
WINDOWS, OSX, UNIX

View File

@@ -660,6 +660,10 @@ public class DefineEditTextTag extends TextTag {
return true;
}
@Override
public void updateTextBounds() {
}
@Override
public boolean alignText(TextAlign textAlign) {
return true;

View File

@@ -436,10 +436,15 @@ public class DefineText2Tag extends TextTag {
throw ex;
}
updateTextBounds(textBounds);
updateTextBounds();
return true;
}
@Override
public void updateTextBounds() {
updateTextBounds(textBounds);
}
@Override
public boolean alignText(TextAlign textAlign) {
alignText(swf, textRecords, textAlign);
@@ -450,6 +455,7 @@ public class DefineText2Tag extends TextTag {
@Override
public boolean translateText(int diff) {
textMatrix.translateX += diff;
updateTextBounds();
setModified(true);
return true;
}

View File

@@ -444,10 +444,15 @@ public class DefineTextTag extends TextTag {
throw ex;
}
updateTextBounds(textBounds);
updateTextBounds();
return true;
}
@Override
public void updateTextBounds() {
updateTextBounds(textBounds);
}
@Override
public boolean alignText(TextAlign textAlign) {
alignText(swf, textRecords, textAlign);
@@ -458,6 +463,7 @@ public class DefineTextTag extends TextTag {
@Override
public boolean translateText(int diff) {
textMatrix.translateX += diff;
updateTextBounds();
setModified(true);
return true;
}

View File

@@ -85,6 +85,8 @@ public abstract class TextTag extends CharacterTag implements DrawableTag {
// use the texts from the "texts" argument when it is not null
public abstract boolean setFormattedText(MissingCharacterHandler missingCharHandler, String formattedText, String[] texts) throws TextParseException;
public abstract void updateTextBounds();
public abstract boolean alignText(TextAlign textAlign);
public abstract boolean translateText(int diff);
@@ -500,7 +502,7 @@ public abstract class TextTag extends CharacterTag implements DrawableTag {
return result;
}
public void updateTextBounds(RECT textBounds) {
protected void updateTextBounds(RECT textBounds) {
TextImportResizeTextBoundsMode resizeMode = Configuration.textImportResizeTextBoundsMode.get();
if (resizeMode != null && (resizeMode.equals(TextImportResizeTextBoundsMode.GROW_ONLY) || resizeMode.equals(TextImportResizeTextBoundsMode.GROW_AND_SHRINK))) {
ExportRectangle newBounds = calculateTextBounds();