mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-01 10:15:09 +00:00
#825 hot keys (and maybe new buttons on new panel) to switch to next or previous DefineText
This commit is contained in:
@@ -121,7 +121,7 @@ public class TextExporter {
|
||||
public void run() throws IOException {
|
||||
fos.write(Utf8Helper.getBytes("ID: " + textTag.getCharacterId() + Helper.newLine));
|
||||
if (settings.mode == TextExportMode.FORMATTED) {
|
||||
fos.write(Utf8Helper.getBytes(textTag.getFormattedText()));
|
||||
fos.write(Utf8Helper.getBytes(textTag.getFormattedText().text));
|
||||
} else {
|
||||
String separator = Configuration.textExportSingleFileRecordSeparator.get();
|
||||
separator = Helper.newLine + separator + Helper.newLine;
|
||||
@@ -149,7 +149,7 @@ public class TextExporter {
|
||||
public void run() throws IOException {
|
||||
try (FileOutputStream fos = new FileOutputStream(file)) {
|
||||
if (settings.mode == TextExportMode.FORMATTED) {
|
||||
fos.write(Utf8Helper.getBytes(textTag.getFormattedText()));
|
||||
fos.write(Utf8Helper.getBytes(textTag.getFormattedText().text));
|
||||
} else {
|
||||
String separator = Configuration.textExportSingleFileRecordSeparator.get();
|
||||
separator = Helper.newLine + separator + Helper.newLine;
|
||||
|
||||
@@ -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.helpers.hilight;
|
||||
|
||||
/**
|
||||
@@ -27,5 +28,6 @@ public enum HighlightSpecialType {
|
||||
SLOT_ID, DISP_ID,
|
||||
FLAG_NEED_REST, FLAG_EXPLICIT, FLAG_HAS_OPTIONAL, FLAG_HAS_PARAM_NAMES,
|
||||
FLAG_IGNORE_REST, FLAG_NEED_ACTIVATION, FLAG_NEED_ARGUMENTS, FLAG_SET_DXNS,
|
||||
FLAG_IGNORE_REST, FLAG_NEED_ACTIVATION, FLAG_NEED_ARGUMENTS, FLAG_SET_DXNS,
|
||||
TRY_TYPE, TRY_NAME,
|
||||
TEXT
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ public class TextImporter {
|
||||
TextTag textTag = (TextTag) tag;
|
||||
if (textTag.getCharacterId() == characterId) {
|
||||
String[] currentRecords = records.get(characterId);
|
||||
String text = textTag.getFormattedText();
|
||||
String text = textTag.getFormattedText().text;
|
||||
if (!saveText(textTag, text, currentRecords)) {
|
||||
return;
|
||||
}
|
||||
@@ -138,7 +138,7 @@ public class TextImporter {
|
||||
if (tag instanceof TextTag) {
|
||||
TextTag textTag = (TextTag) tag;
|
||||
if (textTag.getCharacterId() == characterId) {
|
||||
String text = textTag.getFormattedText();
|
||||
String text = textTag.getFormattedText().text;
|
||||
if (!saveText(textTag, text, records)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -19,9 +19,13 @@ 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.configuration.Configuration;
|
||||
import com.jpexs.decompiler.flash.exporters.commonshape.ExportRectangle;
|
||||
import com.jpexs.decompiler.flash.exporters.commonshape.Matrix;
|
||||
import com.jpexs.decompiler.flash.exporters.commonshape.SVGExporter;
|
||||
import com.jpexs.decompiler.flash.helpers.HighlightedText;
|
||||
import com.jpexs.decompiler.flash.helpers.HighlightedTextWriter;
|
||||
import com.jpexs.decompiler.flash.helpers.hilight.HighlightSpecialType;
|
||||
import com.jpexs.decompiler.flash.tags.base.BoundedTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.FontTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.MissingCharacterHandler;
|
||||
@@ -357,9 +361,9 @@ public class DefineEditTextTag extends TextTag {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFormattedText() {
|
||||
String ret = "";
|
||||
ret += "[";
|
||||
public HighlightedText getFormattedText() {
|
||||
HighlightedTextWriter writer = new HighlightedTextWriter(Configuration.getCodeFormatting(), true);
|
||||
writer.append("[");
|
||||
String[] alignNames = {"left", "right", "center", "justify"};
|
||||
String alignment;
|
||||
if (align < alignNames.length) {
|
||||
@@ -367,22 +371,70 @@ public class DefineEditTextTag extends TextTag {
|
||||
} else {
|
||||
alignment = "unknown";
|
||||
}
|
||||
ret += "\r\nxmin " + bounds.Xmin + "\r\nymin " + bounds.Ymin + "\r\nxmax " + bounds.Xmax + "\r\nymax " + bounds.Ymax + "\r\n";
|
||||
ret += (wordWrap ? "wordwrap 1\r\n" : "") + (multiline ? "multiline 1\r\n" : "")
|
||||
+ (password ? "password 1\r\n" : "") + (readOnly ? "readonly 1\r\n" : "")
|
||||
+ (autoSize ? "autosize 1\r\n" : "") + (noSelect ? "noselect 1\r\n" : "")
|
||||
+ (border ? "border 1\r\n" : "") + (wasStatic ? "wasstatic 1\r\n" : "")
|
||||
+ (html ? "html 1\r\n" : "") + (useOutlines ? "useoutlines 1\r\n" : "")
|
||||
+ (hasFont ? "font " + fontId + "\r\n" + "height " + fontHeight + "\r\n" : "") + (hasTextColor ? "color " + textColor.toHexARGB() + "\r\n" : "")
|
||||
+ (hasFontClass ? "fontclass " + fontClass + "\r\n" : "") + (hasMaxLength ? "maxlength " + maxLength + "\r\n" : "")
|
||||
+ "align " + alignment + "\r\n"
|
||||
+ (hasLayout ? "leftmargin " + leftMargin + "\r\nrightmargin " + rightMargin + "\r\nindent " + indent + "\r\nleading " + leading + "\r\n" : "")
|
||||
+ (!variableName.isEmpty() ? "variablename " + variableName + "\r\n" : "");
|
||||
ret += "]";
|
||||
if (hasText) {
|
||||
ret += initialText.replace("\\", "\\\\").replace("[", "\\[").replace("]", "\\]");
|
||||
writer.newLine();
|
||||
writer.append("xmin " + bounds.Xmin).newLine();
|
||||
writer.append("ymin " + bounds.Ymin).newLine();
|
||||
writer.append("xmax " + bounds.Xmax).newLine();
|
||||
writer.append("ymax " + bounds.Ymax).newLine();
|
||||
if (wordWrap) {
|
||||
writer.append("wordwrap 1").newLine();
|
||||
}
|
||||
return ret;
|
||||
if (multiline) {
|
||||
writer.append("multiline 1").newLine();
|
||||
}
|
||||
if (password) {
|
||||
writer.append("password 1").newLine();
|
||||
}
|
||||
if (readOnly) {
|
||||
writer.append("readonly 1").newLine();
|
||||
}
|
||||
if (autoSize) {
|
||||
writer.append("autosize 1").newLine();
|
||||
}
|
||||
if (noSelect) {
|
||||
writer.append("noselect 1").newLine();
|
||||
}
|
||||
if (border) {
|
||||
writer.append("border 1").newLine();
|
||||
}
|
||||
if (wasStatic) {
|
||||
writer.append("wasstatic 1").newLine();
|
||||
}
|
||||
if (html) {
|
||||
writer.append("html 1").newLine();
|
||||
}
|
||||
if (useOutlines) {
|
||||
writer.append("useoutlines 1").newLine();
|
||||
}
|
||||
if (hasFont) {
|
||||
writer.append("font " + fontId).newLine();
|
||||
writer.append("height " + fontHeight).newLine();
|
||||
}
|
||||
if (hasTextColor) {
|
||||
writer.append("color " + textColor.toHexARGB()).newLine();
|
||||
}
|
||||
if (hasFontClass) {
|
||||
writer.append("fontclass " + fontClass).newLine();
|
||||
}
|
||||
if (hasMaxLength) {
|
||||
writer.append("maxlength " + maxLength).newLine();
|
||||
}
|
||||
writer.append("align " + alignment).newLine();
|
||||
if (hasLayout) {
|
||||
writer.append("leftmargin " + leftMargin).newLine();
|
||||
writer.append("rightmargin " + rightMargin).newLine();
|
||||
writer.append("indent " + indent).newLine();
|
||||
writer.append("leading " + leading).newLine();
|
||||
}
|
||||
if (!variableName.isEmpty()) {
|
||||
writer.append("variablename " + variableName).newLine();
|
||||
}
|
||||
writer.append("]");
|
||||
if (hasText) {
|
||||
String text = initialText.replace("\\", "\\\\").replace("[", "\\[").replace("]", "\\]");
|
||||
writer.hilightSpecial(text, HighlightSpecialType.TEXT);
|
||||
}
|
||||
return new HighlightedText(writer);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -23,6 +23,9 @@ import com.jpexs.decompiler.flash.configuration.Configuration;
|
||||
import com.jpexs.decompiler.flash.exporters.commonshape.ExportRectangle;
|
||||
import com.jpexs.decompiler.flash.exporters.commonshape.Matrix;
|
||||
import com.jpexs.decompiler.flash.exporters.commonshape.SVGExporter;
|
||||
import com.jpexs.decompiler.flash.helpers.HighlightedText;
|
||||
import com.jpexs.decompiler.flash.helpers.HighlightedTextWriter;
|
||||
import com.jpexs.decompiler.flash.helpers.hilight.HighlightSpecialType;
|
||||
import com.jpexs.decompiler.flash.tags.base.BoundedTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.FontTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.MissingCharacterHandler;
|
||||
@@ -127,56 +130,58 @@ public class DefineText2Tag extends TextTag {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFormattedText() {
|
||||
public HighlightedText getFormattedText() {
|
||||
FontTag fnt = null;
|
||||
StringBuilder ret = new StringBuilder();
|
||||
ret.append("[\r\nxmin ").append(textBounds.Xmin).
|
||||
append("\r\nymin ").append(textBounds.Ymin).
|
||||
append("\r\nxmax ").append(textBounds.Xmax).
|
||||
append("\r\nymax ").append(textBounds.Ymax);
|
||||
HighlightedTextWriter writer = new HighlightedTextWriter(Configuration.getCodeFormatting(), true);
|
||||
writer.append("[").newLine();
|
||||
writer.append("xmin " + textBounds.Xmin).newLine();
|
||||
writer.append("ymin " + textBounds.Ymin).newLine();
|
||||
writer.append("xmax " + textBounds.Xmax).newLine();
|
||||
writer.append("ymax " + textBounds.Ymax).newLine();
|
||||
if (textMatrix.translateX != 0) {
|
||||
ret.append("\r\ntranslatex ").append(textMatrix.translateX);
|
||||
writer.append("translatex " + textMatrix.translateX).newLine();
|
||||
}
|
||||
if (textMatrix.translateY != 0) {
|
||||
ret.append("\r\ntranslatey ").append(textMatrix.translateY);
|
||||
writer.append("translatey " + textMatrix.translateY).newLine();
|
||||
}
|
||||
if (textMatrix.hasScale) {
|
||||
ret.append("\r\nscalex ").append(textMatrix.scaleX);
|
||||
ret.append("\r\nscaley ").append(textMatrix.scaleY);
|
||||
writer.append("scalex " + textMatrix.scaleX).newLine();
|
||||
writer.append("scaley " + textMatrix.scaleY).newLine();
|
||||
}
|
||||
if (textMatrix.hasRotate) {
|
||||
ret.append("\r\nrotateskew0 ").append(textMatrix.rotateSkew0);
|
||||
ret.append("\r\nrotateskew1 ").append(textMatrix.rotateSkew1);
|
||||
writer.append("rotateskew0 " + textMatrix.rotateSkew0).newLine();
|
||||
writer.append("rotateskew1 " + textMatrix.rotateSkew1).newLine();
|
||||
}
|
||||
ret.append("\r\n]");
|
||||
writer.append("]");
|
||||
for (TEXTRECORD rec : textRecords) {
|
||||
String params = "";
|
||||
if (rec.styleFlagsHasFont) {
|
||||
for (Tag t : swf.tags) {
|
||||
if (t instanceof FontTag) {
|
||||
if (((FontTag) t).getFontId() == rec.fontId) {
|
||||
fnt = ((FontTag) t);
|
||||
break;
|
||||
if (rec.styleFlagsHasFont || rec.styleFlagsHasColor || rec.styleFlagsHasXOffset || rec.styleFlagsHasYOffset) {
|
||||
writer.append("[").newLine();
|
||||
if (rec.styleFlagsHasFont) {
|
||||
for (Tag t : swf.tags) {
|
||||
if (t instanceof FontTag) {
|
||||
if (((FontTag) t).getFontId() == rec.fontId) {
|
||||
fnt = ((FontTag) t);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
writer.append("font " + rec.fontId).newLine();
|
||||
writer.append("height " + rec.textHeight).newLine();
|
||||
}
|
||||
params += "\r\nfont " + rec.fontId + "\r\nheight " + rec.textHeight;
|
||||
if (rec.styleFlagsHasColor) {
|
||||
writer.append("color " + rec.textColorA.toHexARGB()).newLine();
|
||||
}
|
||||
if (rec.styleFlagsHasXOffset) {
|
||||
writer.append("x " + rec.xOffset).newLine();
|
||||
}
|
||||
if (rec.styleFlagsHasYOffset) {
|
||||
writer.append("y " + rec.yOffset).newLine();
|
||||
}
|
||||
writer.append("]");
|
||||
}
|
||||
if (rec.styleFlagsHasColor) {
|
||||
params += "\r\ncolor " + rec.textColorA.toHexARGB();
|
||||
}
|
||||
if (rec.styleFlagsHasXOffset) {
|
||||
params += "\r\nx " + rec.xOffset;
|
||||
}
|
||||
if (rec.styleFlagsHasYOffset) {
|
||||
params += "\r\ny " + rec.yOffset;
|
||||
}
|
||||
if (params.length() > 0) {
|
||||
ret.append("[").append(params).append("\r\n]");
|
||||
}
|
||||
ret.append(Helper.escapeString(rec.getText(fnt)).replace("[", "\\[").replace("]", "\\]"));
|
||||
writer.hilightSpecial(Helper.escapeString(rec.getText(fnt)).replace("[", "\\[").replace("]", "\\]"), HighlightSpecialType.TEXT);
|
||||
}
|
||||
return ret.toString();
|
||||
return new HighlightedText(writer);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -24,6 +24,9 @@ import com.jpexs.decompiler.flash.configuration.Configuration;
|
||||
import com.jpexs.decompiler.flash.exporters.commonshape.ExportRectangle;
|
||||
import com.jpexs.decompiler.flash.exporters.commonshape.Matrix;
|
||||
import com.jpexs.decompiler.flash.exporters.commonshape.SVGExporter;
|
||||
import com.jpexs.decompiler.flash.helpers.HighlightedText;
|
||||
import com.jpexs.decompiler.flash.helpers.HighlightedTextWriter;
|
||||
import com.jpexs.decompiler.flash.helpers.hilight.HighlightSpecialType;
|
||||
import com.jpexs.decompiler.flash.tags.base.BoundedTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.FontTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.MissingCharacterHandler;
|
||||
@@ -128,61 +131,63 @@ public class DefineTextTag extends TextTag {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFormattedText() {
|
||||
public HighlightedText getFormattedText() {
|
||||
FontTag fnt = null;
|
||||
StringBuilder ret = new StringBuilder();
|
||||
ret.append("[\r\nxmin ").append(textBounds.Xmin).
|
||||
append("\r\nymin ").append(textBounds.Ymin).
|
||||
append("\r\nxmax ").append(textBounds.Xmax).
|
||||
append("\r\nymax ").append(textBounds.Ymax);
|
||||
HighlightedTextWriter writer = new HighlightedTextWriter(Configuration.getCodeFormatting(), true);
|
||||
writer.append("[").newLine();
|
||||
writer.append("xmin " + textBounds.Xmin).newLine();
|
||||
writer.append("ymin " + textBounds.Ymin).newLine();
|
||||
writer.append("xmax " + textBounds.Xmax).newLine();
|
||||
writer.append("ymax " + textBounds.Ymax).newLine();
|
||||
if (textMatrix.translateX != 0) {
|
||||
ret.append("\r\ntranslatex ").append(textMatrix.translateX);
|
||||
writer.append("translatex " + textMatrix.translateX).newLine();
|
||||
}
|
||||
if (textMatrix.translateY != 0) {
|
||||
ret.append("\r\ntranslatey ").append(textMatrix.translateY);
|
||||
writer.append("translatey " + textMatrix.translateY).newLine();
|
||||
}
|
||||
if (textMatrix.hasScale) {
|
||||
ret.append("\r\nscalex ").append(textMatrix.scaleX);
|
||||
ret.append("\r\nscaley ").append(textMatrix.scaleY);
|
||||
writer.append("scalex " + textMatrix.scaleX).newLine();
|
||||
writer.append("scaley " + textMatrix.scaleY).newLine();
|
||||
}
|
||||
if (textMatrix.hasRotate) {
|
||||
ret.append("\r\nrotateskew0 ").append(textMatrix.rotateSkew0);
|
||||
ret.append("\r\nrotateskew1 ").append(textMatrix.rotateSkew1);
|
||||
writer.append("rotateskew0 " + textMatrix.rotateSkew0).newLine();
|
||||
writer.append("rotateskew1 " + textMatrix.rotateSkew1).newLine();
|
||||
}
|
||||
ret.append("\r\n]");
|
||||
writer.append("]");
|
||||
for (TEXTRECORD rec : textRecords) {
|
||||
String params = "";
|
||||
if (rec.styleFlagsHasFont) {
|
||||
for (Tag t : swf.tags) {
|
||||
if (t instanceof FontTag) {
|
||||
if (((FontTag) t).getFontId() == rec.fontId) {
|
||||
fnt = ((FontTag) t);
|
||||
break;
|
||||
if (rec.styleFlagsHasFont || rec.styleFlagsHasColor || rec.styleFlagsHasXOffset || rec.styleFlagsHasYOffset) {
|
||||
writer.append("[").newLine();
|
||||
if (rec.styleFlagsHasFont) {
|
||||
for (Tag t : swf.tags) {
|
||||
if (t instanceof FontTag) {
|
||||
if (((FontTag) t).getFontId() == rec.fontId) {
|
||||
fnt = ((FontTag) t);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
writer.append("font " + rec.fontId).newLine();
|
||||
writer.append("height " + rec.textHeight).newLine();
|
||||
}
|
||||
params += "\r\nfont " + rec.fontId + "\r\nheight " + rec.textHeight;
|
||||
}
|
||||
if (rec.styleFlagsHasColor) {
|
||||
params += "\r\ncolor " + rec.textColor.toHexRGB();
|
||||
}
|
||||
if (rec.styleFlagsHasXOffset) {
|
||||
params += "\r\nx " + rec.xOffset;
|
||||
}
|
||||
if (rec.styleFlagsHasYOffset) {
|
||||
params += "\r\ny " + rec.yOffset;
|
||||
}
|
||||
if (params.length() > 0) {
|
||||
ret.append("[").append(params).append("\r\n]");
|
||||
if (rec.styleFlagsHasColor) {
|
||||
writer.append("color " + rec.textColor.toHexRGB()).newLine();
|
||||
}
|
||||
if (rec.styleFlagsHasXOffset) {
|
||||
writer.append("x " + rec.xOffset).newLine();
|
||||
}
|
||||
if (rec.styleFlagsHasYOffset) {
|
||||
writer.append("y " + rec.yOffset).newLine();
|
||||
}
|
||||
writer.append("]");
|
||||
}
|
||||
|
||||
if (fnt == null) {
|
||||
ret.append(AppResources.translate("fontNotFound").replace("%fontId%", Integer.toString(rec.fontId)));
|
||||
writer.append(AppResources.translate("fontNotFound").replace("%fontId%", Integer.toString(rec.fontId)));
|
||||
} else {
|
||||
ret.append(Helper.escapeString(rec.getText(fnt)).replace("[", "\\[").replace("]", "\\]"));
|
||||
writer.hilightSpecial(Helper.escapeString(rec.getText(fnt)).replace("[", "\\[").replace("]", "\\]"), HighlightSpecialType.TEXT);
|
||||
}
|
||||
}
|
||||
return ret.toString();
|
||||
return new HighlightedText(writer);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -26,6 +26,7 @@ import com.jpexs.decompiler.flash.exporters.modes.FontExportMode;
|
||||
import com.jpexs.decompiler.flash.exporters.shape.BitmapExporter;
|
||||
import com.jpexs.decompiler.flash.exporters.shape.CanvasShapeExporter;
|
||||
import com.jpexs.decompiler.flash.exporters.shape.SVGShapeExporter;
|
||||
import com.jpexs.decompiler.flash.helpers.HighlightedText;
|
||||
import com.jpexs.decompiler.flash.importers.TextImportResizeTextBoundsMode;
|
||||
import com.jpexs.decompiler.flash.tags.text.JustifyAlignGlyphEntry;
|
||||
import com.jpexs.decompiler.flash.tags.text.TextAlign;
|
||||
@@ -81,7 +82,7 @@ public abstract class TextTag extends CharacterTag implements DrawableTag {
|
||||
|
||||
public abstract List<Integer> getFontIds();
|
||||
|
||||
public abstract String getFormattedText();
|
||||
public abstract HighlightedText getFormattedText();
|
||||
|
||||
// use the texts from the "texts" argument when it is not null
|
||||
public abstract boolean setFormattedText(MissingCharacterHandler missingCharHandler, String formattedText, String[] texts) throws TextParseException;
|
||||
|
||||
BIN
libsrc/ffdec_lib/testdata/zipped.zip
vendored
BIN
libsrc/ffdec_lib/testdata/zipped.zip
vendored
Binary file not shown.
@@ -173,7 +173,7 @@ public class FontPanel extends javax.swing.JPanel {
|
||||
if (tag instanceof TextTag) {
|
||||
TextTag textTag = (TextTag) tag;
|
||||
if (textTag.getFontIds().contains(fontId)) {
|
||||
String text = textTag.getFormattedText();
|
||||
String text = textTag.getFormattedText().text;
|
||||
mainPanel.saveText(textTag, text, null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -224,6 +224,14 @@ public abstract class MainFrameMenu {
|
||||
mainFrame.getPanel().refreshDecompiled();
|
||||
}
|
||||
|
||||
protected boolean previousTag() {
|
||||
return mainFrame.getPanel().previousTag();
|
||||
}
|
||||
|
||||
protected boolean nextTag() {
|
||||
return mainFrame.getPanel().nextTag();
|
||||
}
|
||||
|
||||
protected void checkResources() {
|
||||
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||
PrintStream stream = new PrintStream(os);
|
||||
@@ -323,7 +331,7 @@ public abstract class MainFrameMenu {
|
||||
|
||||
@Override
|
||||
public boolean dispatchKeyEvent(KeyEvent e) {
|
||||
if (((JFrame) mainFrame).isActive()) {
|
||||
if (((JFrame) mainFrame).isActive() && e.getID() == KeyEvent.KEY_RELEASED) {
|
||||
int code = e.getKeyCode();
|
||||
if (e.isControlDown() && e.isShiftDown()) {
|
||||
switch (code) {
|
||||
@@ -346,6 +354,13 @@ public abstract class MainFrameMenu {
|
||||
case KeyEvent.VK_E:
|
||||
return export(false);
|
||||
}
|
||||
} else if (e.isControlDown() && !e.isShiftDown()) {
|
||||
switch (code) {
|
||||
case KeyEvent.VK_UP:
|
||||
return previousTag();
|
||||
case KeyEvent.VK_DOWN:
|
||||
return nextTag();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1361,10 +1361,10 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
|
||||
}
|
||||
if (found) {
|
||||
String[] textArray = texts.toArray(new String[texts.size()]);
|
||||
textTag.setFormattedText(getMissingCharacterHandler(), textTag.getFormattedText(), textArray);
|
||||
textTag.setFormattedText(getMissingCharacterHandler(), textTag.getFormattedText().text, textArray);
|
||||
}
|
||||
} else {
|
||||
String text = textTag.getFormattedText();
|
||||
String text = textTag.getFormattedText().text;
|
||||
if (pat.matcher(text).find()) {
|
||||
textTag.setFormattedText(getMissingCharacterHandler(), text.replaceAll(txt, replacement), null);
|
||||
findCount++;
|
||||
@@ -1397,7 +1397,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
|
||||
for (Tag tag : swf.tags) {
|
||||
if (tag instanceof TextTag) {
|
||||
TextTag textTag = (TextTag) tag;
|
||||
if (pat.matcher(textTag.getFormattedText()).find()) {
|
||||
if (pat.matcher(textTag.getFormattedText().text).find()) {
|
||||
found.add(textTag);
|
||||
}
|
||||
}
|
||||
@@ -2075,6 +2075,34 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean previousTag() {
|
||||
if (getCurrentView() == VIEW_RESOURCES) {
|
||||
if (tagTree.getSelectionRows().length > 0) {
|
||||
int row = tagTree.getSelectionRows()[0];
|
||||
if (row > 0) {
|
||||
tagTree.setSelectionRow(row - 1);
|
||||
previewPanel.focusTextPanel();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean nextTag() {
|
||||
if (getCurrentView() == VIEW_RESOURCES) {
|
||||
if (tagTree.getSelectionRows().length > 0) {
|
||||
int row = tagTree.getSelectionRows()[0];
|
||||
if (row < tagTree.getRowCount() - 1) {
|
||||
tagTree.setSelectionRow(row + 1);
|
||||
previewPanel.focusTextPanel();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
switch (e.getActionCommand()) {
|
||||
|
||||
@@ -458,6 +458,10 @@ public class PreviewPanel extends JSplitPane implements ActionListener {
|
||||
textPanel.setText(textTag);
|
||||
}
|
||||
|
||||
public void focusTextPanel() {
|
||||
textPanel.focusTextValue();
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
imagePanel.clearAll();
|
||||
if (media != null) {
|
||||
|
||||
@@ -20,6 +20,9 @@ import com.jpexs.decompiler.flash.SWF;
|
||||
import com.jpexs.decompiler.flash.configuration.Configuration;
|
||||
import com.jpexs.decompiler.flash.gui.abc.LineMarkedEditorPane;
|
||||
import com.jpexs.decompiler.flash.gui.controls.JRepeatButton;
|
||||
import com.jpexs.decompiler.flash.helpers.HighlightedText;
|
||||
import com.jpexs.decompiler.flash.helpers.hilight.HighlightSpecialType;
|
||||
import com.jpexs.decompiler.flash.helpers.hilight.Highlighting;
|
||||
import com.jpexs.decompiler.flash.tags.DefineEditTextTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.FontTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.MissingCharacterHandler;
|
||||
@@ -61,6 +64,10 @@ public class TextPanel extends JPanel {
|
||||
|
||||
private final JButton textCancelButton;
|
||||
|
||||
private final JButton selectPrevousTagButton;
|
||||
|
||||
private final JButton selectNextTagButton;
|
||||
|
||||
private final JButton textAlignLeftButton;
|
||||
|
||||
private final JButton textAlignCenterButton;
|
||||
@@ -114,6 +121,8 @@ public class TextPanel extends JPanel {
|
||||
JPanel textButtonsPanel = new JPanel();
|
||||
textButtonsPanel.setLayout(new FlowLayout(SwingConstants.WEST));
|
||||
|
||||
selectPrevousTagButton = createButton(null, "arrowup16", "selectPreviousTag", e -> mainPanel.previousTag());
|
||||
selectNextTagButton = createButton(null, "arrowdown16", "selectNextTag", e -> mainPanel.nextTag());
|
||||
textAlignLeftButton = createButton(null, "textalignleft16", "text.align.left", e -> textAlign(TextAlign.LEFT));
|
||||
textAlignCenterButton = createButton(null, "textaligncenter16", "text.align.center", e -> textAlign(TextAlign.CENTER));
|
||||
textAlignRightButton = createButton(null, "textalignright16", "text.align.right", e -> textAlign(TextAlign.RIGHT));
|
||||
@@ -122,6 +131,8 @@ public class TextPanel extends JPanel {
|
||||
increaseTranslateXButton = createButton(null, "textindent16", "text.align.translatex.increase", e -> translateX((int) SWF.unitDivisor, ((JRepeatButton) e.getSource()).getRepeatCount()), true);
|
||||
undoChangesButton = createButton(null, "reload16", "text.undo", e -> undoChanges());
|
||||
|
||||
textButtonsPanel.add(selectPrevousTagButton);
|
||||
textButtonsPanel.add(selectNextTagButton);
|
||||
textButtonsPanel.add(textAlignLeftButton);
|
||||
textButtonsPanel.add(textAlignCenterButton);
|
||||
textButtonsPanel.add(textAlignRightButton);
|
||||
@@ -167,12 +178,25 @@ public class TextPanel extends JPanel {
|
||||
|
||||
public void setText(TextTag textTag) {
|
||||
this.textTag = textTag;
|
||||
textValue.setText(textTag.getFormattedText());
|
||||
textValue.setText(textTag.getFormattedText().text);
|
||||
textValue.setCaretPosition(0);
|
||||
modified = false;
|
||||
setEditText(false);
|
||||
}
|
||||
|
||||
public void focusTextValue() {
|
||||
textValue.requestFocusInWindow();
|
||||
if (!modified) {
|
||||
HighlightedText text = textTag.getFormattedText();
|
||||
for (Highlighting highlight : text.specialHilights) {
|
||||
if (highlight.getProperties().subtype == HighlightSpecialType.TEXT) {
|
||||
textValue.select(highlight.startPos, highlight.startPos + highlight.len);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void closeTag() {
|
||||
if (modified && Configuration.autoSaveTagModifications.get()) {
|
||||
saveText(false);
|
||||
|
||||
BIN
src/com/jpexs/decompiler/flash/gui/graphics/arrowdown16.png
Normal file
BIN
src/com/jpexs/decompiler/flash/gui/graphics/arrowdown16.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 381 B |
BIN
src/com/jpexs/decompiler/flash/gui/graphics/arrowup16.png
Normal file
BIN
src/com/jpexs/decompiler/flash/gui/graphics/arrowup16.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 391 B |
@@ -572,3 +572,5 @@ menu.file.export.xml = Export SWF XML
|
||||
#after version 4.1.1
|
||||
text.align.translatex.decrease = Decrease TranslateX
|
||||
text.align.translatex.increase = Increase TranslateX
|
||||
selectPreviousTag = Select previous tag
|
||||
selectNextTag = Select next tag
|
||||
|
||||
@@ -16,3 +16,5 @@
|
||||
button.open = Helyi f\u00e1jl megnyit\u00e1sa
|
||||
button.proxy = Megnyit\u00e1s proxyn kereszt\u00fcl
|
||||
button.exit = Kil\u00e9p\u00e9s az alkalmaz\u00e1sb\u00f3l
|
||||
selectPreviousTag = El\u0151z\u0151 tag kiv\u00e1laszt\u00e1sa
|
||||
selectNextTag = K\u00f6vetkez\u0151 tag kiv\u00e1laszt\u00e1sa
|
||||
|
||||
Reference in New Issue
Block a user