diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/TextExporter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/TextExporter.java index cf4dfc248..b66ad4b77 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/TextExporter.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/TextExporter.java @@ -115,7 +115,7 @@ public class TextExporter { new RetryTask(() -> { fos.write(Utf8Helper.getBytes("ID: " + textTag.getCharacterId() + Helper.newLine)); if (settings.mode == TextExportMode.FORMATTED) { - fos.write(Utf8Helper.getBytes(textTag.getFormattedText().text)); + fos.write(Utf8Helper.getBytes(textTag.getFormattedText(false).text)); } else { String separator = Configuration.textExportSingleFileRecordSeparator.get(); separator = Helper.newLine + separator + Helper.newLine; @@ -140,7 +140,7 @@ public class TextExporter { new RetryTask(() -> { try (OutputStream fos = new BufferedOutputStream(new FileOutputStream(file))) { if (settings.mode == TextExportMode.FORMATTED) { - fos.write(Utf8Helper.getBytes(textTag.getFormattedText().text)); + fos.write(Utf8Helper.getBytes(textTag.getFormattedText(false).text)); } else { String separator = Configuration.textExportSingleFileRecordSeparator.get(); separator = Helper.newLine + separator + Helper.newLine; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/importers/TextImporter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/importers/TextImporter.java index db0e5738c..2532605f7 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/importers/TextImporter.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/importers/TextImporter.java @@ -77,7 +77,7 @@ public class TextImporter { TextTag textTag = swf.getText(characterId); if (textTag != null) { String[] currentRecords = records.get(characterId); - String text = textTag.getFormattedText().text; + String text = textTag.getFormattedText(false).text; if (!saveText(textTag, text, currentRecords)) { return; } @@ -135,7 +135,7 @@ public class TextImporter { if (!formatted) { String[] records = newText.split(recordSeparator); if (textTag != null) { - String text = textTag.getFormattedText().text; + String text = textTag.getFormattedText(false).text; if (!saveText(textTag, text, records)) { return false; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineEditTextTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineEditTextTag.java index e3e7764b1..16754df5f 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineEditTextTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineEditTextTag.java @@ -501,7 +501,7 @@ public class DefineEditTextTag extends TextTag { } @Override - public HighlightedText getFormattedText() { + public HighlightedText getFormattedText(boolean ignoreLetterSpacing) { HighlightedTextWriter writer = new HighlightedTextWriter(Configuration.getCodeFormatting(), true); writer.append("["); String[] alignNames = {"left", "right", "center", "justify"}; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/StaticTextTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/StaticTextTag.java index 019b18f5c..b85639f10 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/StaticTextTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/StaticTextTag.java @@ -227,7 +227,7 @@ public abstract class StaticTextTag extends TextTag { } @Override - public HighlightedText getFormattedText() { + public HighlightedText getFormattedText(boolean ignoreLetterSpacing) { FontTag fnt = null; HighlightedTextWriter writer = new HighlightedTextWriter(Configuration.getCodeFormatting(), true); writer.append("[").newLine(); @@ -263,7 +263,7 @@ public abstract class StaticTextTag extends TextTag { writer.append("height ").append(rec.textHeight).newLine(); textHeight = rec.textHeight; } - if (fnt != null) { + if (fnt != null && !ignoreLetterSpacing) { int letterSpacing = detectLetterSpacing(rec, fnt, textHeight); if (letterSpacing != 0) { writer.append("letterspacing ").append(letterSpacing).newLine(); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/TextTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/TextTag.java index 5eb1afb12..582e8cbae 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/TextTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/TextTag.java @@ -83,7 +83,7 @@ public abstract class TextTag extends CharacterTag implements DrawableTag { public abstract List getFontIds(); - public abstract HighlightedText getFormattedText(); + public abstract HighlightedText getFormattedText(boolean ignoreLetterSpacing); // use the texts from the "texts" argument when it is not null public abstract boolean setFormattedText(MissingCharacterHandler missingCharHandler, String formattedText, String[] texts) throws TextParseException; diff --git a/src/com/jpexs/decompiler/flash/gui/FontPanel.java b/src/com/jpexs/decompiler/flash/gui/FontPanel.java index 6ad19b0bc..cd1777b6d 100644 --- a/src/com/jpexs/decompiler/flash/gui/FontPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/FontPanel.java @@ -186,7 +186,7 @@ public class FontPanel extends JPanel { if (tag instanceof TextTag) { TextTag textTag = (TextTag) tag; if (textTag.getFontIds().contains(fontId)) { - String text = textTag.getFormattedText().text; + String text = textTag.getFormattedText(true).text; mainPanel.saveText(textTag, text, null); } } diff --git a/src/com/jpexs/decompiler/flash/gui/MainPanel.java b/src/com/jpexs/decompiler/flash/gui/MainPanel.java index 0915baace..71b2816ae 100644 --- a/src/com/jpexs/decompiler/flash/gui/MainPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/MainPanel.java @@ -829,11 +829,11 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se } private boolean closeConfirmation(SWFList swfList) { - if (swfList == null) { - if (View.showConfirmDialog(this, translate("message.confirm.closeAll"), translate("message.warning"), JOptionPane.OK_CANCEL_OPTION, Configuration.showCloseConfirmation, JOptionPane.OK_OPTION) != JOptionPane.OK_OPTION) { - return false; - } - } else if (View.showConfirmDialog(this, translate("message.confirm.close").replace("{swfName}", swfList.toString()), translate("message.warning"), JOptionPane.OK_CANCEL_OPTION, Configuration.showCloseConfirmation, JOptionPane.OK_OPTION) != JOptionPane.OK_OPTION) { + String message = swfList == null + ? translate("message.confirm.closeAll") + : translate("message.confirm.close").replace("{swfName}", swfList.toString()); + + if (View.showConfirmDialog(this, message, translate("message.warning"), JOptionPane.OK_CANCEL_OPTION, Configuration.showCloseConfirmation, JOptionPane.OK_OPTION) != JOptionPane.OK_OPTION) { return false; } @@ -1787,10 +1787,10 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se } if (found) { String[] textArray = texts.toArray(new String[texts.size()]); - textTag.setFormattedText(getMissingCharacterHandler(), textTag.getFormattedText().text, textArray); + textTag.setFormattedText(getMissingCharacterHandler(), textTag.getFormattedText(false).text, textArray); } } else { - String text = textTag.getFormattedText().text; + String text = textTag.getFormattedText(false).text; if (pat.matcher(text).find()) { textTag.setFormattedText(getMissingCharacterHandler(), text.replaceAll(txt, replacement), null); findCount++; @@ -1822,7 +1822,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se for (Tag tag : swf.getTags()) { if (tag instanceof TextTag) { TextTag textTag = (TextTag) tag; - if (pat.matcher(textTag.getFormattedText().text).find()) { + if (pat.matcher(textTag.getFormattedText(false).text).find()) { found.add(textTag); } } diff --git a/src/com/jpexs/decompiler/flash/gui/TextPanel.java b/src/com/jpexs/decompiler/flash/gui/TextPanel.java index abed42584..7625cac24 100644 --- a/src/com/jpexs/decompiler/flash/gui/TextPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/TextPanel.java @@ -173,7 +173,7 @@ public class TextPanel extends JPanel implements TagEditorPanel { public void setText(TextTag textTag) { this.textTag = textTag; - textValue.setText(textTag.getFormattedText().text); + textValue.setText(textTag.getFormattedText(false).text); textValue.setCaretPosition(0); setModified(false); setEditText(false); @@ -202,7 +202,7 @@ public class TextPanel extends JPanel implements TagEditorPanel { public void focusTextValue() { textValue.requestFocusInWindow(); if (textTag != null && !isModified()) { - HighlightedText text = textTag.getFormattedText(); + HighlightedText text = textTag.getFormattedText(false); for (Highlighting highlight : text.specialHilights) { if (highlight.getProperties().subtype == HighlightSpecialType.TEXT) { textValue.select(highlight.startPos, highlight.startPos + highlight.len); @@ -219,7 +219,7 @@ public class TextPanel extends JPanel implements TagEditorPanel { if (selEnd > selStart) { StringBuilder selected = new StringBuilder(textValue.getSelectedText()); - HighlightedText text = textTag.getFormattedText(); + HighlightedText text = textTag.getFormattedText(false); boolean allUpper = true; for (Highlighting highlight : text.specialHilights) { if (highlight.getProperties().subtype == HighlightSpecialType.TEXT) {