From 2468d4cf76800e7fe0b7c708dc28924b906fac09 Mon Sep 17 00:00:00 2001 From: "honfika@gmail.com" Date: Fri, 23 Jan 2015 10:54:57 +0100 Subject: [PATCH] add depth to the filenames of the placeoject tags --- .../flash/configuration/Configuration.java | 4 -- .../flash/tags/CSMTextSettingsTag.java | 19 ++---- .../decompiler/flash/tags/DoActionTag.java | 10 --- .../flash/tags/DoInitActionTag.java | 2 +- .../flash/tags/PlaceObject2Tag.java | 9 ++- .../flash/tags/PlaceObject3Tag.java | 9 ++- .../flash/tags/PlaceObject4Tag.java | 9 ++- .../decompiler/flash/tags/PlaceObjectTag.java | 3 +- .../decompiler/flash/tags/UnknownTag.java | 13 ++-- .../flash/tags/base/CharacterIdTag.java | 7 +-- .../flash/tags/base/PlaceObjectTypeTag.java | 61 ++++++++++++------- .../locales/AdvancedSettingsDialog.properties | 3 - .../AdvancedSettingsDialog_hu.properties | 3 - 13 files changed, 65 insertions(+), 87 deletions(-) diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/configuration/Configuration.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/configuration/Configuration.java index 29031eee1..90d6072bd 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/configuration/Configuration.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/configuration/Configuration.java @@ -330,10 +330,6 @@ public class Configuration { @ConfigurationCategory("export") public static final ConfigurationItem textExportSingleFileRecordSeparator = null; - @ConfigurationDefaultBoolean(true) - @ConfigurationCategory("export") - public static final ConfigurationItem addCharacterIdToExportFileName = null; - @ConfigurationCategory("import") public static final ConfigurationItem textImportResizeTextBoundsMode = null; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/CSMTextSettingsTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/CSMTextSettingsTag.java index 51d906d50..daaf1f4c6 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/CSMTextSettingsTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/CSMTextSettingsTag.java @@ -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; import com.jpexs.decompiler.flash.SWF; @@ -108,14 +109,4 @@ public class CSMTextSettingsTag extends Tag { sharpness = sis.readFLOAT("sharpness"); //F32 = FLOAT reserved2 = sis.readUI8("reserved2"); //reserved } - - /** - * Returns string representation of the object - * - * @return String representation of the object - */ - @Override - public String toString() { - return "CSMTextSettings"; - } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DoActionTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DoActionTag.java index bcbdd654c..2ae62d9d5 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DoActionTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DoActionTag.java @@ -118,16 +118,6 @@ public class DoActionTag extends Tag implements ASMSource { return true; } - /** - * Returns string representation of the object - * - * @return String representation of the object - */ - @Override - public String toString() { - return "DoAction"; - } - @Override public ActionList getActions() throws InterruptedException { try { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DoInitActionTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DoInitActionTag.java index a9f733525..4364e1b47 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DoInitActionTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DoInitActionTag.java @@ -202,7 +202,7 @@ public class DoInitActionTag extends CharacterIdTag implements ASMSource { } @Override - public String toString() { + public String getName() { String expName = getExportName(); if ((expName == null) || expName.isEmpty()) { return super.toString(); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/PlaceObject2Tag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/PlaceObject2Tag.java index 2e87f225f..f469de27a 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/PlaceObject2Tag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/PlaceObject2Tag.java @@ -22,7 +22,6 @@ import com.jpexs.decompiler.flash.SWFOutputStream; import com.jpexs.decompiler.flash.abc.CopyOutputStream; import com.jpexs.decompiler.flash.configuration.Configuration; import com.jpexs.decompiler.flash.tags.base.ASMSourceContainer; -import com.jpexs.decompiler.flash.tags.base.CharacterIdTag; import com.jpexs.decompiler.flash.tags.base.PlaceObjectTypeTag; import com.jpexs.decompiler.flash.types.BasicType; import com.jpexs.decompiler.flash.types.CLIPACTIONRECORD; @@ -49,7 +48,7 @@ import java.util.Set; * * @author JPEXS */ -public class PlaceObject2Tag extends CharacterIdTag implements ASMSourceContainer, PlaceObjectTypeTag { +public class PlaceObject2Tag extends PlaceObjectTypeTag implements ASMSourceContainer { /** * @since SWF 5 Has clip actions (sprite characters only) @@ -395,11 +394,11 @@ public class PlaceObject2Tag extends CharacterIdTag implements ASMSourceContaine } @Override - public String toString() { + public String getName() { if (placeFlagHasName) { - return super.toString() + " (" + name + ")"; + return super.getName() + " (" + name + ")"; } else { - return super.toString(); + return super.getName(); } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/PlaceObject3Tag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/PlaceObject3Tag.java index 259689980..351101b7a 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/PlaceObject3Tag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/PlaceObject3Tag.java @@ -23,7 +23,6 @@ import com.jpexs.decompiler.flash.SWFOutputStream; import com.jpexs.decompiler.flash.abc.CopyOutputStream; import com.jpexs.decompiler.flash.configuration.Configuration; import com.jpexs.decompiler.flash.tags.base.ASMSourceContainer; -import com.jpexs.decompiler.flash.tags.base.CharacterIdTag; import com.jpexs.decompiler.flash.tags.base.PlaceObjectTypeTag; import com.jpexs.decompiler.flash.types.BasicType; import com.jpexs.decompiler.flash.types.CLIPACTIONRECORD; @@ -52,7 +51,7 @@ import java.util.Set; * * @author JPEXS */ -public class PlaceObject3Tag extends CharacterIdTag implements ASMSourceContainer, PlaceObjectTypeTag { +public class PlaceObject3Tag extends PlaceObjectTypeTag implements ASMSourceContainer { /** * @since SWF 5 has clip actions (sprite characters only) @@ -540,11 +539,11 @@ public class PlaceObject3Tag extends CharacterIdTag implements ASMSourceContaine } @Override - public String toString() { + public String getName() { if (placeFlagHasName) { - return super.toString() + " (" + name + ")"; + return super.getName() + " (" + name + ")"; } else { - return super.toString(); + return super.getName(); } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/PlaceObject4Tag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/PlaceObject4Tag.java index 28787f0de..1a92c9518 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/PlaceObject4Tag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/PlaceObject4Tag.java @@ -23,7 +23,6 @@ import com.jpexs.decompiler.flash.SWFOutputStream; import com.jpexs.decompiler.flash.abc.CopyOutputStream; import com.jpexs.decompiler.flash.configuration.Configuration; import com.jpexs.decompiler.flash.tags.base.ASMSourceContainer; -import com.jpexs.decompiler.flash.tags.base.CharacterIdTag; import com.jpexs.decompiler.flash.tags.base.PlaceObjectTypeTag; import com.jpexs.decompiler.flash.types.BasicType; import com.jpexs.decompiler.flash.types.CLIPACTIONRECORD; @@ -52,7 +51,7 @@ import java.util.Set; * * @author JPEXS */ -public class PlaceObject4Tag extends CharacterIdTag implements ASMSourceContainer, PlaceObjectTypeTag { +public class PlaceObject4Tag extends PlaceObjectTypeTag implements ASMSourceContainer { /** * @since SWF 5 has clip actions (sprite characters only) @@ -543,11 +542,11 @@ public class PlaceObject4Tag extends CharacterIdTag implements ASMSourceContaine } @Override - public String toString() { + public String getName() { if (placeFlagHasName) { - return super.toString() + " (" + name + ")"; + return super.getName() + " (" + name + ")"; } else { - return super.toString(); + return super.getName(); } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/PlaceObjectTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/PlaceObjectTag.java index 74f5ab76f..a94f3d087 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/PlaceObjectTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/PlaceObjectTag.java @@ -19,7 +19,6 @@ package com.jpexs.decompiler.flash.tags; import com.jpexs.decompiler.flash.SWF; import com.jpexs.decompiler.flash.SWFInputStream; import com.jpexs.decompiler.flash.SWFOutputStream; -import com.jpexs.decompiler.flash.tags.base.CharacterIdTag; import com.jpexs.decompiler.flash.tags.base.PlaceObjectTypeTag; import com.jpexs.decompiler.flash.types.BasicType; import com.jpexs.decompiler.flash.types.CLIPACTIONS; @@ -42,7 +41,7 @@ import java.util.Set; * * @author JPEXS */ -public class PlaceObjectTag extends CharacterIdTag implements PlaceObjectTypeTag { +public class PlaceObjectTag extends PlaceObjectTypeTag { /** * ID of character to place diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/UnknownTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/UnknownTag.java index 9608e2faf..8ed8f9ff2 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/UnknownTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/UnknownTag.java @@ -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; import com.jpexs.decompiler.flash.SWF; @@ -39,7 +40,7 @@ public class UnknownTag extends Tag { } @Override - public String toString() { - return super.toString() + " (ID=" + id + ")"; + public String getName() { + return super.getName() + " (ID=" + id + ")"; } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/CharacterIdTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/CharacterIdTag.java index a1052ce21..dff572efe 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/CharacterIdTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/CharacterIdTag.java @@ -17,7 +17,6 @@ package com.jpexs.decompiler.flash.tags.base; import com.jpexs.decompiler.flash.SWF; -import com.jpexs.decompiler.flash.configuration.Configuration; import com.jpexs.decompiler.flash.tags.Tag; import com.jpexs.helpers.ByteArrayRange; @@ -59,11 +58,7 @@ public abstract class CharacterIdTag extends Tag { @Override public String getExportFileName() { - String result = super.getName(); - if (Configuration.addCharacterIdToExportFileName.get()) { - result += "_" + getCharacterId(); - } - + String result = super.getName() + "_" + getCharacterId(); return result + (exportName != null ? "_" + exportName : ""); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/PlaceObjectTypeTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/PlaceObjectTypeTag.java index 050f2e12c..732956722 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/PlaceObjectTypeTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/PlaceObjectTypeTag.java @@ -1,26 +1,29 @@ /* * 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 com.jpexs.decompiler.flash.SWF; import com.jpexs.decompiler.flash.SWFOutputStream; import com.jpexs.decompiler.flash.types.CLIPACTIONS; import com.jpexs.decompiler.flash.types.ColorTransform; import com.jpexs.decompiler.flash.types.MATRIX; import com.jpexs.decompiler.flash.types.RGBA; import com.jpexs.decompiler.flash.types.filters.FILTER; +import com.jpexs.helpers.ByteArrayRange; import java.io.IOException; import java.util.List; @@ -28,41 +31,53 @@ import java.util.List; * * @author JPEXS */ -public interface PlaceObjectTypeTag { +public abstract class PlaceObjectTypeTag extends CharacterIdTag { - public int getCharacterId(); + public PlaceObjectTypeTag(SWF swf, int id, String name, ByteArrayRange data) { + super(swf, id, name, data); + } - public int getDepth(); + public abstract int getDepth(); - public MATRIX getMatrix(); + public abstract MATRIX getMatrix(); - public String getInstanceName(); + public abstract String getInstanceName(); - public void setInstanceName(String name); + public abstract void setInstanceName(String name); - public void setClassName(String className); + public abstract void setClassName(String className); - public ColorTransform getColorTransform(); + public abstract ColorTransform getColorTransform(); - public int getBlendMode(); + public abstract int getBlendMode(); - public List getFilters(); + public abstract List getFilters(); - public int getClipDepth(); + public abstract int getClipDepth(); - public String getClassName(); + public abstract String getClassName(); - public boolean cacheAsBitmap(); + public abstract boolean cacheAsBitmap(); - public boolean isVisible(); + public abstract boolean isVisible(); - public RGBA getBackgroundColor(); + public abstract RGBA getBackgroundColor(); - public boolean flagMove(); + public abstract boolean flagMove(); - public int getRatio(); + public abstract int getRatio(); - public CLIPACTIONS getClipActions(); + public abstract CLIPACTIONS getClipActions(); - public void writeTagWithMatrix(SWFOutputStream sos, MATRIX m) throws IOException; + public abstract void writeTagWithMatrix(SWFOutputStream sos, MATRIX m) throws IOException; + + @Override + public String getName() { + return super.getName() + " Depth: " + getDepth(); + } + + @Override + public String getExportFileName() { + return super.getExportFileName() + "_" + getDepth(); + } } diff --git a/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog.properties b/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog.properties index 79135a69b..f903aa6fd 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog.properties @@ -308,6 +308,3 @@ config.description.textImportResizeTextBoundsMode = Text bounds resize mode afte config.name.showCloseConfirmation = Show again SWF close confirmation config.description.showCloseConfirmation = Show again SWF close confirmation for modified files. - -config.name.addCharacterIdToExportFileName = Include character ID in export filename -config.description.addCharacterIdToExportFileName = Include character ID in export filename. diff --git a/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog_hu.properties b/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog_hu.properties index aebd001a8..c42125cdb 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog_hu.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog_hu.properties @@ -308,6 +308,3 @@ config.description.textImportResizeTextBoundsMode = Sz\u00f6veg hat\u00e1r \u00e config.name.showCloseConfirmation = SWF bez\u00e1r\u00e1si meger\u0151s\u00edt\u00e9s \u00fajb\u00f3li mutat\u00e1sa config.description.showCloseConfirmation = SWF bez\u00e1r\u00e1si meger\u0151s\u00edt\u00e9s \u00fajb\u00f3li mutat\u00e1sa m\u00f3dosult f\u00e1jlok eset\u00e9n. - -config.name.addCharacterIdToExportFileName = Karakter azonos\u00edt\u00f3 hozz\u00e1ad\u00e1sa az export\u00e1lt f\u00e1jl nev\u00e9hez -config.description.addCharacterIdToExportFileName = Karakter azonos\u00edt\u00f3 hozz\u00e1ad\u00e1sa az export\u00e1lt f\u00e1jl nev\u00e9hez.