feat: XAML export (#2674)

Shape exporter - solid fill, gradient, bitmapfill, strokes
Timeline exporting:
Morphshapes as exported shapes at given ratio.
Clipping, Zoom, Texts, Background color,
Creating project.
Missing: blend modes, filters, nonscaling strokes, sound, video
This commit is contained in:
Jindra Petřík
2026-03-21 20:20:05 +01:00
parent b51ba90d69
commit 5f82b2f840
14 changed files with 1966 additions and 119 deletions

View File

@@ -36,6 +36,7 @@
<include name="**/?*.js"/>
<include name="**/?*.css"/>
<include name="**/?*.bat"/>
<include name="**/?*.zip"/>
</patternset>

File diff suppressed because it is too large Load Diff

View File

@@ -304,6 +304,17 @@ public final class Matrix implements Cloneable {
return "matrix(" + scaleX + ", " + rotateSkew0 + ", "
+ rotateSkew1 + ", " + scaleY + ", " + translateX + ", " + translateY + ")";
}
public String getXamlTransformationString(double translateDivisor, double unitDivisor) {
double translateX = roundPixels400(this.translateX / translateDivisor);
double translateY = roundPixels400(this.translateY / translateDivisor);
double rotateSkew0 = roundPixels400(this.rotateSkew0 / unitDivisor);
double rotateSkew1 = roundPixels400(this.rotateSkew1 / unitDivisor);
double scaleX = roundPixels400(this.scaleX / unitDivisor);
double scaleY = roundPixels400(this.scaleY / unitDivisor);
return "" + scaleX + " " + rotateSkew0 + " "
+ rotateSkew1 + " " + scaleY + " " + translateX + " " + translateY;
}
public static String[] parseSvgNumberList(String params) {
while (params.contains(" ")) {

View File

@@ -0,0 +1,551 @@
/*
* Copyright (C) 2010-2026 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.exporters.shape;
import com.jpexs.decompiler.flash.SWF;
import com.jpexs.decompiler.flash.exporters.commonshape.Matrix;
import com.jpexs.decompiler.flash.tags.base.ImageTag;
import com.jpexs.decompiler.flash.tags.base.ShapeTag;
import com.jpexs.decompiler.flash.types.ColorTransform;
import com.jpexs.decompiler.flash.types.FILLSTYLE;
import com.jpexs.decompiler.flash.types.GRADIENT;
import com.jpexs.decompiler.flash.types.GRADRECORD;
import com.jpexs.decompiler.flash.types.LINESTYLE2;
import com.jpexs.decompiler.flash.types.RGB;
import com.jpexs.decompiler.flash.types.RGBA;
import com.jpexs.decompiler.flash.types.SHAPE;
import java.awt.Color;
import java.io.StringWriter;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
/**
*
* @author JPEXS
*/
public class XamlShapeExporter extends ShapeExporterBase {
/**
* Draw command L
*/
protected static final String DRAW_COMMAND_L = "L";
/**
* Draw command Q
*/
protected static final String DRAW_COMMAND_Q = "Q";
/**
* Path data
*/
protected Element pathData;
/**
* Path geometry
*/
protected Element pathGeometry;
/**
* Path figure
*/
protected Element pathFigure;
/**
* Zoom
*/
protected double zoom;
/**
* Path
*/
protected Element path;
/**
* Id
*/
protected int id;
/**
* Last pattern id
*/
protected int lastPatternId;
/**
* Default color
*/
private final Color defaultColor;
/**
* SWF
*/
private final SWF swf;
/**
* Display zoom
*/
private final double displayZoom;
/**
* Thickness scale
*/
private final double thicknessScale;
/**
* XML document
*/
private Document document;
/**
* XML root element
*/
private Element root;
/**
* Image files
*/
private final Map<Integer, String> imageFiles;
/**
* Geometry only
*/
private final boolean geometryOnly;
/**
* Drawing lines?
*/
private boolean inLines = false;
private final Matrix geometryMatrix;
/**
* Constructor.
*
* @param windingRule Winding rule
* @param shapeNum Shape number
* @param swf SWF
* @param shape Shape
* @param id Id
* @param defaultColor Default color
* @param colorTransform Color transform
* @param zoom Zoom - shape zoom
* @param displayZoom Display zoom - overall SVG zoom
* @param strokeTransformation Stroke transformation
* @param imageFiles Image files
* @param geometryOnly Geometry only
* @param geometryMatrix Geometry matrix
*/
public XamlShapeExporter(int windingRule, int shapeNum, SWF swf, SHAPE shape, int id, Color defaultColor, ColorTransform colorTransform, double zoom, double displayZoom, Matrix strokeTransformation, Map<Integer, String> imageFiles, boolean geometryOnly, Matrix geometryMatrix) {
super(windingRule, shapeNum, swf, shape, colorTransform);
this.swf = swf;
this.id = id;
this.defaultColor = defaultColor;
this.zoom = zoom;
this.displayZoom = displayZoom;
this.imageFiles = imageFiles;
this.geometryOnly = geometryOnly;
this.geometryMatrix = geometryMatrix;
thicknessScale = Math.sqrt(Math.abs(strokeTransformation.scaleX * strokeTransformation.scaleY - strokeTransformation.rotateSkew0 * strokeTransformation.rotateSkew1));
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder;
try {
docBuilder = docFactory.newDocumentBuilder();
document = docBuilder.newDocument();
if (geometryOnly) {
pathGeometry = document.createElement("PathGeometry");
pathGeometry.setAttribute("FillRule", windingRule == ShapeTag.WIND_NONZERO ? "Nonzero" : "EvenOdd");
applyMatrix();
document.appendChild(pathGeometry);
root = pathGeometry;
} else {
root = document.createElement("Canvas");
document.appendChild(root);
}
} catch (ParserConfigurationException ex) {
Logger.getLogger(XamlShapeExporter.class.getName()).log(Level.SEVERE, null, ex);
}
}
private void applyMatrix() {
if (geometryMatrix == null) {
return;
}
Element transform = document.createElement("PathGeometry.Transform");
Element matrixTransform = document.createElement("MatrixTransform");
matrixTransform.setAttribute("Matrix", geometryMatrix.getXamlTransformationString(SWF.unitDivisor / zoom, 1)); //zoom is applied to individual coordinates
transform.appendChild(matrixTransform);
pathGeometry.appendChild(transform);
}
@Override
public void beginShape() {
}
@Override
public void endShape() {
}
@Override
public void beginFills() {
}
@Override
public void endFills() {
}
@Override
public void beginLines() {
inLines = true;
}
@Override
public void endLines(boolean close) {
inLines = false;
if (close && !geometryOnly) {
pathFigure.setAttribute("IsClosed", "True");
}
finalizePath();
}
@Override
public void beginFill(RGB color) {
if (color == null && defaultColor != null) {
color = new RGB(defaultColor);
}
finalizePath();
//path.setAttribute("Stroke", "");
if (color != null) {
String colorHex;
if (color instanceof RGBA) {
colorHex = ((RGBA) color).toHexARGB();
} else {
colorHex = color.toHexRGB();
}
path.setAttribute("Fill", colorHex);
}
}
@Override
public void beginGradientFill(int type, GRADRECORD[] gradientRecords, Matrix matrix, int spreadMethod, int interpolationMethod, float focalPointRatio) {
finalizePath();
Element gradient = (type == FILLSTYLE.LINEAR_GRADIENT)
? document.createElement("LinearGradientBrush")
: document.createElement("RadialGradientBrush");
populateGradientElement(gradient, type, gradientRecords, matrix, spreadMethod, interpolationMethod, focalPointRatio);
//path.setAttribute("Stroke", "");
Element pathFill = document.createElement("Path.Fill");
pathFill.appendChild(gradient);
path.appendChild(pathFill);
}
@Override
public void beginBitmapFill(int bitmapId, Matrix matrix, boolean repeat, boolean smooth, ColorTransform colorTransform) {
finalizePath();
Element imageBrush = document.createElement("ImageBrush");
if (matrix != null) {
Element transform = document.createElement("ImageBrush.Transform");
Element matrixTransform = document.createElement("MatrixTransform");
matrixTransform.setAttribute("Matrix", matrix.getXamlTransformationString(SWF.unitDivisor / zoom, SWF.unitDivisor));
transform.appendChild(matrixTransform);
imageBrush.appendChild(transform);
}
imageBrush.setAttribute("ImageSource", imageFiles.get(bitmapId));
ImageTag image = (ImageTag) swf.getCharacter(bitmapId);
imageBrush.setAttribute("Viewport", "0,0," + image.getImageDimension().width + "," + image.getImageDimension().height);
imageBrush.setAttribute("ViewportUnits", "Absolute");
if (repeat) {
imageBrush.setAttribute("TileMode", "Tile");
}
if (smooth) {
path.setAttribute("RenderOptions.BitmapScalingMode", "HighQuality");
} else {
path.setAttribute("RenderOptions.BitmapScalingMode", "NearestNeighbor");
}
Element pathFill = document.createElement("Path.Fill");
pathFill.appendChild(imageBrush);
path.appendChild(pathFill);
}
@Override
public void endFill() {
finalizePath();
}
@Override
public void lineStyle(double thickness, RGB color, boolean pixelHinting, String scaleMode, int startCaps, int endCaps, int joints, float miterLimit, boolean noClose) {
finalizePath();
//always display minimum stroke of 1 pixel, no matter how zoomed it is
if (thickness * displayZoom * thicknessScale < 1 * SWF.unitDivisor) {
//path.setAttribute("ffdec:has-small-stroke", "true");
//path.setAttribute("ffdec:original-stroke-width", Double.toString(thickness * displayZoom / SWF.unitDivisor));
thickness = 1 * SWF.unitDivisor / displayZoom / thicknessScale;
}
thickness *= zoom / SWF.unitDivisor;
//path.setAttribute("Fill", "");
if (color instanceof RGBA) {
RGBA colorA = (RGBA) color;
path.setAttribute("Stroke", colorA.toHexARGB());
} else if (color != null) {
path.setAttribute("Stroke", color.toHexRGB());
}
path.setAttribute("StrokeThickness", formatDouble(thickness));
switch (startCaps) {
case LINESTYLE2.NO_CAP:
path.setAttribute("StrokeStartLineCap", "Flat");
path.setAttribute("StrokeEndLineCap", "Flat");
break;
case LINESTYLE2.SQUARE_CAP:
path.setAttribute("StrokeStartLineCap", "Square");
path.setAttribute("StrokeEndLineCap", "Square");
break;
default:
path.setAttribute("StrokeStartLineCap", "Round");
path.setAttribute("StrokeEndLineCap", "Round");
break;
}
switch (joints) {
case LINESTYLE2.BEVEL_JOIN:
path.setAttribute("StrokeLineJoin", "Bevel");
break;
case LINESTYLE2.ROUND_JOIN:
path.setAttribute("StrokeLineJoin", "Round");
break;
default:
path.setAttribute("StrokeLineJoin", "Miter");
if (miterLimit >= 1) {
path.setAttribute("StrokeMiterLimit", formatDouble(miterLimit));
}
break;
}
}
@Override
public void lineGradientStyle(int type, GRADRECORD[] gradientRecords, Matrix matrix, int spreadMethod, int interpolationMethod, float focalPointRatio) {
Element gradient = (type == FILLSTYLE.LINEAR_GRADIENT)
? document.createElement("LinearGradientBrush")
: document.createElement("RadialGradientBrush");
populateGradientElement(gradient, type, gradientRecords, matrix, spreadMethod, interpolationMethod, focalPointRatio);
Element pathStroke = document.createElement("Path.Stroke");
pathStroke.appendChild(gradient);
path.appendChild(pathStroke);
//path.setAttribute("Fill", "");
}
@Override
public void lineBitmapStyle(int bitmapId, Matrix matrix, boolean repeat, boolean smooth, ColorTransform colorTransform) {
Element imageBrush = document.createElement("ImageBrush");
if (matrix != null) {
Element transform = document.createElement("ImageBrush.Transform");
Element matrixTransform = document.createElement("MatrixTransform");
matrixTransform.setAttribute("Matrix", matrix.getXamlTransformationString(SWF.unitDivisor / zoom, SWF.unitDivisor));
transform.appendChild(matrixTransform);
imageBrush.appendChild(transform);
}
imageBrush.setAttribute("ImageSource", imageFiles.get(bitmapId));
ImageTag image = (ImageTag) swf.getCharacter(bitmapId);
imageBrush.setAttribute("Viewport", "0,0," + image.getImageDimension().width + "," + image.getImageDimension().height);
imageBrush.setAttribute("ViewportUnits", "Absolute");
if (repeat) {
imageBrush.setAttribute("TileMode", "Tile");
}
if (smooth) {
imageBrush.setAttribute("RenderOptions.BitmapScalingMode", "HighQuality");
} else {
path.setAttribute("RenderOptions.BitmapScalingMode", "NearestNeighbor");
}
Element pathStroke = document.createElement("Path.Stroke");
pathStroke.appendChild(imageBrush);
path.appendChild(pathStroke);
}
@Override
public void moveTo(double x, double y) {
if (geometryOnly && inLines) {
return;
}
pathFigure = document.createElement("PathFigure");
pathFigure.setAttribute("StartPoint", formatDouble(roundPixels20(x * zoom / SWF.unitDivisor)) + "," + formatDouble(roundPixels20(y * zoom / SWF.unitDivisor)));
pathGeometry.appendChild(pathFigure);
}
@Override
public void lineTo(double x, double y) {
if (geometryOnly && inLines) {
return;
}
Element lineSegment = document.createElement("LineSegment");
lineSegment.setAttribute("Point", formatDouble(roundPixels20(x * zoom / SWF.unitDivisor)) + "," + formatDouble(roundPixels20(y * zoom / SWF.unitDivisor)));
pathFigure.appendChild(lineSegment);
}
@Override
public void curveTo(double controlX, double controlY, double anchorX, double anchorY) {
if (geometryOnly && inLines) {
return;
}
Element quadraticBezierSegment = document.createElement("QuadraticBezierSegment");
quadraticBezierSegment.setAttribute("Point1", formatDouble(roundPixels20(controlX * zoom / SWF.unitDivisor)) + "," + formatDouble(roundPixels20(controlY * zoom / SWF.unitDivisor)));
quadraticBezierSegment.setAttribute("Point2", formatDouble(roundPixels20(anchorX * zoom / SWF.unitDivisor)) + "," + formatDouble(roundPixels20(anchorY * zoom / SWF.unitDivisor)));
pathFigure.appendChild(quadraticBezierSegment);
}
/**
* Finalizes path.
*/
protected void finalizePath() {
if (!geometryOnly && path != null && pathData != null && pathGeometry.getChildNodes().getLength() > 0) {
root.appendChild(path);
path.appendChild(pathData);
if (!geometryOnly) {
pathData.appendChild(pathGeometry);
}
}
path = document.createElement("Path");
pathData = document.createElement("Path.Data");
if (!geometryOnly) {
pathGeometry = document.createElement("PathGeometry");
pathGeometry.setAttribute("FillRule", windingRule == ShapeTag.WIND_NONZERO ? "Nonzero" : "EvenOdd");
applyMatrix();
}
pathFigure = document.createElement("PathFigure");
}
/**
* Rounds pixels to 20.
*
* @param pixels Pixels
* @return Rounded pixels
*/
protected double roundPixels20(double pixels) {
return Math.round(pixels * 100) / 100.0;
}
/**
* Populates gradient element.
*
* @param gradient Gradient
* @param type Type
* @param gradientRecords Gradient records
* @param matrix Matrix
* @param spreadMethod Spread method
* @param interpolationMethod Interpolation method
* @param focalPointRatio Focal point ratio
*/
protected void populateGradientElement(Element gradient, int type, GRADRECORD[] gradientRecords, Matrix matrix, int spreadMethod, int interpolationMethod, float focalPointRatio) {
gradient.setAttribute("MappingMode", "Absolute");
if (type == FILLSTYLE.LINEAR_GRADIENT) {
gradient.setAttribute("StartPoint", "-819.2,0");
gradient.setAttribute("EndPoint", "819.2,0");
} else {
gradient.setAttribute("RadiusX", "819.2");
gradient.setAttribute("RadiusY", "819.2");
gradient.setAttribute("Center", "0,0");
if (focalPointRatio != 0) {
gradient.setAttribute("GradientOrigin", Double.toString(819.2 * focalPointRatio) + ",0");
}
}
switch (spreadMethod) {
case GRADIENT.SPREAD_PAD_MODE:
gradient.setAttribute("SpreadMethod", "Pad");
break;
case GRADIENT.SPREAD_REFLECT_MODE:
gradient.setAttribute("SpreadMethod", "Reflect");
break;
case GRADIENT.SPREAD_REPEAT_MODE:
gradient.setAttribute("SpreadMethod", "Repeat");
break;
}
if (interpolationMethod == GRADIENT.INTERPOLATION_LINEAR_RGB_MODE) {
gradient.setAttribute("ColorInterpolationMode", "ScRgbLinearInterpolation");
}
//default is SRgbLinearInterpolation
if (matrix != null) {
String prefix;
if (type == FILLSTYLE.LINEAR_GRADIENT) {
prefix = "LinearGradientBrush";
} else {
prefix = "RadialGradientBrush";
}
Element gradientTransformElement = document.createElement(prefix + ".Transform");
Element matrixTransformElement = document.createElement("MatrixTransform");
matrixTransformElement.setAttribute("Matrix", matrix.getXamlTransformationString(SWF.unitDivisor / zoom, 1 / zoom));
gradientTransformElement.appendChild(matrixTransformElement);
gradient.appendChild(gradientTransformElement);
}
for (int i = 0; i < gradientRecords.length; i++) {
GRADRECORD record = gradientRecords[i];
Element gradientEntry = document.createElement("GradientStop");
gradientEntry.setAttribute("Offset", Double.toString(record.ratio / 255.0));
RGB color = record.color;
if (color instanceof RGBA) {
RGBA colorA = (RGBA) color;
gradientEntry.setAttribute("Color", colorA.toHexARGB());
} else {
gradientEntry.setAttribute("Color", color.toHexRGB());
}
gradient.appendChild(gradientEntry);
}
}
public String getResultAsString() {
try {
Transformer transformer = TransformerFactory.newInstance().newTransformer();
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
StringWriter writer = new StringWriter();
transformer.transform(new DOMSource(document), new StreamResult(writer));
return writer.toString();
} catch (TransformerConfigurationException ex) {
Logger.getLogger(XamlShapeExporter.class.getName()).log(Level.SEVERE, null, ex);
} catch (TransformerException ex) {
Logger.getLogger(XamlShapeExporter.class.getName()).log(Level.SEVERE, null, ex);
}
return "";
}
protected String formatDouble(double val) {
String ret = "" + val;
if (ret.endsWith(".0")) {
ret = ret.substring(0, ret.length() - 2);
}
return ret;
}
}

View File

@@ -100,7 +100,6 @@ public abstract class MainFrameMenu implements MenuBuilder {
private ConfigurationItemChangeListener<Boolean> configListenerGotoMainClassOnStartup;
//private ConfigurationItemChangeListener<Boolean> configListenerAutoRenameIdentifiers;
private ConfigurationItemChangeListener<Boolean> configListenerAutoDeobfuscateIdentifiers;
private ConfigurationItemChangeListener<Boolean> configListenerAutoOpenLoadedSWFs;
@@ -113,7 +112,7 @@ public abstract class MainFrameMenu implements MenuBuilder {
}
protected final Map<String, ActionListener> menuActions = new HashMap<>();
public MainFrameMenu(MainFrame mainFrame) {
registerHotKeys();
this.mainFrame = mainFrame;
@@ -308,7 +307,7 @@ public abstract class MainFrameMenu implements MenuBuilder {
}
Set<OpenableList> listsToClose = new LinkedHashSet<>();
List<SWF> binaryDataClosedSwfs = new ArrayList<>();
if (mainFrame.getPanel().getCurrentView() == MainPanel.VIEW_EASY) {
Openable itemOpenable = mainFrame.getPanel().easyPanel.getSwf();
enumerateListsToClose(listsToClose, itemOpenable, binaryDataClosedSwfs);
@@ -326,12 +325,12 @@ public abstract class MainFrameMenu implements MenuBuilder {
enumerateListsToClose(listsToClose, openable, binaryDataClosedSwfs);
}
openable = null;
for (OpenableList list : listsToClose) {
Main.closeFile(list);
}
mainFrame.getPanel().refreshTree();
Timer timer = new Timer();
timer.schedule(new TimerTask() {
@Override
@@ -510,7 +509,7 @@ public abstract class MainFrameMenu implements MenuBuilder {
mainFrame.getPanel().exportIdea((SWF) openable);
}
protected void exportVsCodeActionPerformed(ActionEvent evt) {
if (Main.isWorking()) {
return;
@@ -521,7 +520,7 @@ public abstract class MainFrameMenu implements MenuBuilder {
mainFrame.getPanel().exportVsCode((SWF) openable);
}
protected void exportJavaActionPerformed(ActionEvent evt) {
if (Main.isWorking()) {
return;
@@ -532,11 +531,22 @@ public abstract class MainFrameMenu implements MenuBuilder {
List<TreeItem> items = new ArrayList<>();
items.add(openable);
mainFrame.getPanel().exportJavaSource(items);
}
/*protected void exportXamlActionPerformed(ActionEvent evt) {
protected void exportSwcActionPerformed(ActionEvent evt) {
if (Main.isWorking()) {
return;
}
if (mainFrame.getPanel().checkEdited()) {
return;
}
Main.saveSwc((SWF) openable);
}
protected void exportXamlActionPerformed(ActionEvent evt) {
if (Main.isWorking()) {
return;
}
@@ -545,7 +555,7 @@ public abstract class MainFrameMenu implements MenuBuilder {
}
mainFrame.getPanel().exportXaml((SWF) openable);
}*/
}
protected void exportFlaActionPerformed(ActionEvent evt) {
if (Main.isWorking()) {
@@ -831,7 +841,7 @@ public abstract class MainFrameMenu implements MenuBuilder {
ViewMessages.showMessageDialog(Main.getDefaultMessagesComponent(), translate("message.homepage").replace("%url%", homePageURL));
}
}
protected void wikiActionPerformed(ActionEvent evt) {
if (Main.isWorking()) {
return;
@@ -900,7 +910,7 @@ public abstract class MainFrameMenu implements MenuBuilder {
}
Main.advancedSettings();
}
protected void solEditorActionPerformed(ActionEvent evt) {
Main.openSolEditor();
}
@@ -941,12 +951,12 @@ public abstract class MainFrameMenu implements MenuBuilder {
button.setSelected(Configuration.autoRenameIdentifiers.get());
}
}
protected void autoDeobfuscateIdentifiersActionPerformed(ActionEvent evt) {
AbstractButton button = (AbstractButton) evt.getSource();
boolean selected = button.isSelected();
Configuration.autoDeobfuscateIdentifiers.set(selected);
Configuration.autoDeobfuscateIdentifiers.set(selected);
mainFrame.getPanel().autoDeobfuscateChanged();
}
@@ -1157,7 +1167,11 @@ public abstract class MainFrameMenu implements MenuBuilder {
setMenuEnabled("/file/export/exportMore/exportIdea", allSameSwf && openableSelected && isAs3 && !isWorking && canExportIdea);
//setMenuEnabled("_/exportVsCode", swfSelected && !isWorking && canExportVsCode);
setMenuEnabled("/file/export/exportMore/exportVsCode", allSameSwf && openableSelected && isAs3 && !isWorking && canExportVsCode);
setMenuEnabled("/file/export/exportMore/exportJava", swfSelected && !isWorking);
setMenuEnabled("/file/export/exportMore/exportSwc", swfSelected && !isWorking);
setMenuEnabled("/file/export/exportMore/exportExe", swfSelected && !isWorking);
setMenuEnabled("/file/export/exportMore/exportXaml", swfSelected && !isWorking);
setMenuEnabled("_/exportSelected", openableSelected && !isWorking);
setMenuEnabled("/file/export/exportSelected", openableSelected && !isWorking);
//setMenuEnabled("/file/export/exportXml", swfSelected && !isWorking);
@@ -1186,7 +1200,6 @@ public abstract class MainFrameMenu implements MenuBuilder {
setMenuEnabled("/tools/abcExplorer", isAs3);
setMenuEnabled("/tools/gotoDocumentClass", hasAbc);
setMenuEnabled("/tools/saveAsExe", swfSelected && !isWorking);
/*setMenuEnabled("/tools/debugger/debuggerSwitch", hasAbc);
setMenuChecked("/tools/debugger/debuggerSwitch", hasDebugger);
@@ -1205,12 +1218,12 @@ public abstract class MainFrameMenu implements MenuBuilder {
setMenuEnabled("/file/start/debugpcode", swfSelected && !isRunningOrDebugging);
setMenuEnabled("/file/start/debuglisten", !isDebugRunning);
setMenuEnabled("/file/start/stop", isRunningOrDebugging);
setMenuEnabled("/file/start/stop", isRunningOrDebugging);
setMenuEnabled("/debugging/debug/stop", isRunningOrDebugging); //same as previous
setMenuEnabled("/debuggingListen/debug/stopListening", isListening);
setMenuEnabled("/debuggingListen/debug/disconnectSession", isSessionConnected);
setMenuEnabled("/debuggingListen/debug/disconnectSession", isSessionConnected);
setPathVisible("/debugging", !isListening && isDebugRunning);
setPathVisible("/debugging/debug", !isListening && isDebugRunning);
//setMenuEnabled("/debugging/debug/pause", isDebugRunning);
@@ -1220,16 +1233,14 @@ public abstract class MainFrameMenu implements MenuBuilder {
setMenuEnabled("/debugging/debug/continue", isDebugPaused);
//setMenuEnabled("/debugging/debug/stack", isDebugPaused);
//setMenuEnabled("/debugging/debug/watch", isDebugPaused);
setPathVisible("/debuggingListen", isListening);
setPathVisible("/debuggingListen/debug", isListening);
setMenuEnabled("/debuggingListen/debug/stepOver", isDebugPaused);
setMenuEnabled("/debuggingListen/debug/stepInto", isDebugPaused);
setMenuEnabled("/debuggingListen/debug/stepOut", isDebugPaused);
setMenuEnabled("/debuggingListen/debug/continue", isDebugPaused);
StringBuilder titleBuilder = new StringBuilder();
titleBuilder.append(ApplicationInfo.applicationVerName);
@@ -1278,7 +1289,7 @@ public abstract class MainFrameMenu implements MenuBuilder {
/*addMenuItem("_/exportFlashDevelop", translate("menu.file.export.flashDevelop"), "exportflashdevelop32", this::exportFlashDevelopActionPerformed, PRIORITY_TOP, null, true, null, false);
addMenuItem("_/exportIdea", translate("menu.file.export.idea"), "exportidea32", this::exportIdeaActionPerformed, PRIORITY_TOP, null, true, null, false);
addMenuItem("_/exportVsCode", translate("menu.file.export.vsCode"), "exportvscode32", this::exportVsCodeActionPerformed, PRIORITY_TOP, null, true, null, false);
*/
*/
addMenuItem("_/exportAll", translate("menu.file.export.all"), "export32", this::exportAllActionPerformed, PRIORITY_TOP, null, true, null, false);
addMenuItem("_/exportSelected", translate("menu.file.export.selection"), "exportsel32", this::exportSelectedActionPerformed, PRIORITY_TOP, null, true, null, false);
addSeparator("_");
@@ -1315,17 +1326,19 @@ public abstract class MainFrameMenu implements MenuBuilder {
addMenuItem("/file/export/exportFla", translate("menu.file.export.fla"), "exportfla32", this::exportFlaActionPerformed, PRIORITY_TOP, null, true, null, false);
addMenuItem("/file/export/exportAll", translate("menu.file.export.all"), "exportall16", this::exportAllActionPerformed, PRIORITY_MEDIUM, null, true, new HotKey("CTRL+SHIFT+E"), false);
addMenuItem("/file/export/exportSelected", translate("menu.file.export.selection"), "exportsel16", this::exportSelectedActionPerformed, PRIORITY_MEDIUM, null, true, null, false);
addMenuItem("/file/export/exportMore", translate("menu.export.file"), "export16", null, PRIORITY_MEDIUM, null, false, null, false);
addMenuItem("/file/export/exportMore/exportXml", "XML", "exportxml32", this::exportXmlActionPerformed, PRIORITY_MEDIUM, null, true, null, false);
addMenuItem("/file/export/exportMore/exportFlashDevelop", "Flash Develop", "exportflashdevelop32", this::exportFlashDevelopActionPerformed, PRIORITY_MEDIUM, null, true, null, false);
addMenuItem("/file/export/exportMore/exportIdea", "IntelliJ Idea", "exportidea32", this::exportIdeaActionPerformed, PRIORITY_MEDIUM, null, true, null, false);
addMenuItem("/file/export/exportMore/exportVsCode", "Visual Studio Code", "exportvscode32", this::exportVsCodeActionPerformed, PRIORITY_MEDIUM, null, true, null, false);
addMenuItem("/file/export/exportMore/exportJava", "Java", "exportjava32", this::exportJavaActionPerformed, PRIORITY_MEDIUM, null, true, null, false);
//addMenuItem("/file/export/exportMore/exportXaml", "XAML", "exportxml32", this::exportXamlActionPerformed, PRIORITY_MEDIUM, null, true, null, false);
addMenuItem("/file/export/exportMore/exportXml", "XML", "exportxml16", this::exportXmlActionPerformed, PRIORITY_MEDIUM, null, true, null, false);
addMenuItem("/file/export/exportMore/exportFlashDevelop", "Flash Develop", "exportflashdevelop16", this::exportFlashDevelopActionPerformed, PRIORITY_MEDIUM, null, true, null, false);
addMenuItem("/file/export/exportMore/exportIdea", "IntelliJ Idea", "exportidea16", this::exportIdeaActionPerformed, PRIORITY_MEDIUM, null, true, null, false);
addMenuItem("/file/export/exportMore/exportVsCode", "Visual Studio Code", "exportvscode16", this::exportVsCodeActionPerformed, PRIORITY_MEDIUM, null, true, null, false);
addMenuItem("/file/export/exportMore/exportJava", "Java", "exportjava16", this::exportJavaActionPerformed, PRIORITY_MEDIUM, null, true, null, false);
addMenuItem("/file/export/exportMore/exportSwc", "SWC", "bundleswc16", this::exportSwcActionPerformed, PRIORITY_MEDIUM, null, true, null, false);
addMenuItem("/file/export/exportMore/exportExe", "EXE", "saveasexe16", this::saveAsExeActionPerformed, PRIORITY_MEDIUM, null, true, null, false);
addMenuItem("/file/export/exportMore/exportXaml", "XAML", "exportxml16", this::exportXamlActionPerformed, PRIORITY_MEDIUM, null, true, null, false);
finishMenu("/file/export/exportMore");
finishMenu("/file/export");
addMenuItem("/import", translate("menu.import"), null, null, 0, null, false, null, false);
@@ -1359,7 +1372,7 @@ public abstract class MainFrameMenu implements MenuBuilder {
addToggleMenuItem("/file/view/viewTagList", translate("menu.file.view.tagList"), "view", "taglist16", this::viewTagListActionPerformed, PRIORITY_MEDIUM, null);
addToggleMenuItem("/file/view/viewHex", translate("menu.file.view.hex"), "view", "viewhex16", this::viewHexActionPerformed, PRIORITY_MEDIUM, null);
addToggleMenuItem("/file/view/easy", translate("menu.file.view.easy"), null, "easy32", this::easyActionPerformed, PRIORITY_TOP, null);
finishMenu("/file/view");
addSeparator("/file");
@@ -1399,8 +1412,7 @@ public abstract class MainFrameMenu implements MenuBuilder {
//addMenuItem("/debugging/debug/watch", translate("menu.debugging.debug.watch"), "watch32", this::watchActionPerformed, PRIORITY_MEDIUM, null, true, null, false);
finishMenu("/debugging/debug");
finishMenu("/debugging");
addMenuItem("/debuggingListen", translate("menu.debugging"), null, null, 0, null, false, null, true);
addMenuItem("/debuggingListen/debug", translate("menu.debugging.debug"), null, null, 0, null, false, null, false);
addMenuItem("/debuggingListen/debug/stopListening", translate("menu.debugging.debug.stopListening"), "stop32", this::stopActionPerformed, PRIORITY_TOP, null, true, null, false);
@@ -1423,14 +1435,14 @@ public abstract class MainFrameMenu implements MenuBuilder {
}
addMenuItem("/tools/replace", translate("menu.tools.replace"), "replace32", this::replaceActionPerformed, PRIORITY_TOP, null, true, null, false);
addMenuItem("/tools/abcExplorer", translate("menu.tools.abcexplorer"), "abcexplorer32", this::abcExplorerActionPerformed, PRIORITY_TOP, null, true, null, false);
addMenuItem("/tools/gotoDocumentClass", translate("menu.tools.gotoDocumentClass"), "gotomainclass32", this::gotoDocumentClassActionPerformed, PRIORITY_TOP, null, true, null, false);
addMenuItem("/tools/solEditor", translate("menu.tools.solEditor"), "soleditor32", this::solEditorActionPerformed, PRIORITY_TOP, null, true, null, false);
if (Platform.isWindows()) {
addMenuItem("/tools/searchMemory", translate("menu.tools.searchMemory"), "loadmemory16", this::searchMemoryActionPerformed, PRIORITY_MEDIUM, null, true, null, false);
}
addMenuItem("/tools/saveAsExe", translate("menu.file.saveasexe"), "saveasexe16", this::saveAsExeActionPerformed, PRIORITY_MEDIUM, null, true, null, false);
//addMenuItem("/tools/saveAsExe", translate("menu.file.saveasexe"), "saveasexe16", this::saveAsExeActionPerformed, PRIORITY_MEDIUM, null, true, null, false);
//addMenuItem("/tools/searchCache", translate("menu.tools.searchCache"), "loadcache16", this::searchCacheActionPerformed, PRIORITY_MEDIUM, null, true, null);
addMenuItem("/tools/deobfuscation", translate("menu.tools.deobfuscation"), "deobfuscate16", null, 0, null, false, null, false);
@@ -1526,12 +1538,11 @@ public abstract class MainFrameMenu implements MenuBuilder {
Configuration.autoRenameIdentifiers.addListener(configListenerAutoRenameIdentifiers = (Boolean newValue) -> {
setMenuChecked("/settings/autoRenameIdentifiers", newValue);
});*/
setMenuChecked("/settings/autoDeobfuscateIdentifiers", Configuration.autoDeobfuscateIdentifiers.get());
Configuration.autoDeobfuscateIdentifiers.addListener(configListenerAutoDeobfuscateIdentifiers = (Boolean newValue) -> {
setMenuChecked("/settings/autoDeobfuscateIdentifiers", newValue);
});
setMenuChecked("/settings/autoOpenLoadedSWFs", Configuration.autoOpenLoadedSWFs.get());
Configuration.autoOpenLoadedSWFs.addListener(configListenerAutoOpenLoadedSWFs = (Boolean newValue) -> {
setMenuChecked("/settings/autoOpenLoadedSWFs", newValue);
@@ -1636,7 +1647,7 @@ public abstract class MainFrameMenu implements MenuBuilder {
break;
}
}
private void alwaysOnTopActionPerformed(ActionEvent evt) {
mainFrame.getWindow().setAlwaysOnTop(!mainFrame.getWindow().isAlwaysOnTop());
setMenuChecked("/file/view/alwaysOnTop", mainFrame.getWindow().isAlwaysOnTop());
@@ -1650,7 +1661,7 @@ public abstract class MainFrameMenu implements MenuBuilder {
Configuration.dumpView.set(false);
mainFrame.getPanel().showView(MainPanel.VIEW_RESOURCES);
setGroupSelection("view", "/file/view/viewResources");
setMenuChecked("/file/view/easy", false);
setMenuChecked("/file/view/easy", false);
}
private void viewHexActionPerformed(ActionEvent evt) {
@@ -1678,7 +1689,7 @@ public abstract class MainFrameMenu implements MenuBuilder {
MainPanel mainPanel = mainFrame.getPanel();
mainPanel.showView(MainPanel.VIEW_TAGLIST);
setGroupSelection("view", "/file/view/viewTagList");
setMenuChecked("/file/view/easy", false);
setMenuChecked("/file/view/easy", false);
}
private void debuggerSwitchActionPerformed(ActionEvent evt) {
@@ -1799,13 +1810,13 @@ public abstract class MainFrameMenu implements MenuBuilder {
Main.runDebug((SWF) openable, false);
return true;
}
public void debugListenActionPerformed(ActionEvent evt) {
if (ViewMessages.showConfirmDialog(mainFrame.getPanel(), "<div align=\"center\">" + translate("message.info.debugListen").replace("\n", "<br>") + "</div>", translate("message.info"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE, Configuration.showDebugListenInfo, JOptionPane.OK_OPTION) != JOptionPane.OK_OPTION) {
return;
}
Main.startDebugListening();
Main.startDebugListening();
}
public boolean debugPCodeActionPerformed(ActionEvent evt) {
@@ -1817,7 +1828,7 @@ public abstract class MainFrameMenu implements MenuBuilder {
Main.stopRun();
return true;
}
public boolean disconnectSessionActionPerformed(ActionEvent evt) {
Main.disconnectSession();
return true;

View File

@@ -61,6 +61,7 @@ import com.jpexs.decompiler.flash.exporters.ShapeExporter;
import com.jpexs.decompiler.flash.exporters.SoundExporter;
import com.jpexs.decompiler.flash.exporters.SymbolClassExporter;
import com.jpexs.decompiler.flash.exporters.TextExporter;
import com.jpexs.decompiler.flash.exporters.XamlExporter;
import com.jpexs.decompiler.flash.exporters.modes.BinaryDataExportMode;
import com.jpexs.decompiler.flash.exporters.modes.ButtonExportMode;
import com.jpexs.decompiler.flash.exporters.modes.Font4ExportMode;
@@ -449,9 +450,9 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
private Map<SWF, BreakpointListDialog> breakpointsListDialogs = new WeakHashMap<>();
private boolean loadingScrollPosEnabled = true;
private static final DataFlavor TREE_FILE_FLAVOR = new DataFlavor(TreeFileFlavor.class, "TreeFile");
private boolean editingStatusSet = false;
public synchronized void setLoadingScrollPosEnabled(boolean loadingScrollPosEnabled) {
@@ -844,11 +845,11 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|| (actionPanel != null && actionPanel.isEditing())
|| previewPanel.isEditing() || headerPanel.isEditing();
}
private class TreeFileFlavor {
}
private class MyTreeSelectionModel extends DefaultTreeSelectionModel {
@Override
@@ -1167,19 +1168,19 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
tagListTree = new TagListTree(null, this);
tagListTree.addTreeSelectionListener(this);
tagListTree.setSelectionModel(new MyTreeSelectionModel());
tagListTree.setSelectionModel(new MyTreeSelectionModel());
DragSource dragSource = DragSource.getDefaultDragSource();
dragSource.createDefaultDragGestureRecognizer(tagTree, DnDConstants.ACTION_COPY_OR_MOVE, new DragGestureListener() {
dragSource.createDefaultDragGestureRecognizer(tagTree, DnDConstants.ACTION_COPY_OR_MOVE, new DragGestureListener() {
@Override
public void dragGestureRecognized(DragGestureEvent dge) {
if (!Configuration.allowDragAndDropFromResourcesTree.get()) {
return;
}
dge.startDrag(DragSource.DefaultCopyDrop, new Transferable() {
private List<File> cachedFiles = null;
@Override
public DataFlavor[] getTransferDataFlavors() {
return new DataFlavor[]{TREE_FILE_FLAVOR, DataFlavor.javaFileListFlavor};
@@ -1188,8 +1189,8 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
@Override
public boolean isDataFlavorSupported(DataFlavor flavor) {
return flavor.equals(TREE_FILE_FLAVOR) || flavor.equals(DataFlavor.javaFileListFlavor);
}
}
@Override
public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException {
if (flavor.equals(DataFlavor.javaFileListFlavor)) {
@@ -1197,7 +1198,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
Main.stopWork();
return cachedFiles;
}
List<File> files;
String tempDir = System.getProperty("java.io.tmpdir");
if (!tempDir.endsWith(File.separator)) {
@@ -1232,13 +1233,14 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
}
new File(tempDir).deleteOnExit();
cachedFiles = files;
return cachedFiles;
}
return null;
}
}, new DragSourceAdapter() {});
}, new DragSourceAdapter() {
});
}
});
@@ -1430,33 +1432,33 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
@Override
public void dragEnter(DropTargetDragEvent dtde) {
if (dtde.isDataFlavorSupported(TREE_FILE_FLAVOR)
|| !dtde.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) {
|| !dtde.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) {
dtde.rejectDrag();
} else {
dtde.acceptDrag(DnDConstants.ACTION_COPY);
}
}
}
@Override
public void dragOver(DropTargetDragEvent dtde) {
if (dtde.isDataFlavorSupported(TREE_FILE_FLAVOR)
|| !dtde.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) {
if (dtde.isDataFlavorSupported(TREE_FILE_FLAVOR)
|| !dtde.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) {
dtde.rejectDrag();
} else {
dtde.acceptDrag(DnDConstants.ACTION_COPY);
}
}
}
@Override
public void drop(DropTargetDropEvent dtde) {
public void drop(DropTargetDropEvent dtde) {
if (dtde.isDataFlavorSupported(TREE_FILE_FLAVOR)
|| !dtde.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) {
|| !dtde.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) {
dtde.rejectDrop();
return;
}
try {
dtde.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);
@SuppressWarnings("unchecked")
@SuppressWarnings("unchecked")
List<File> droppedFiles = (List<File>) dtde.getTransferable().getTransferData(DataFlavor.javaFileListFlavor);
if (droppedFiles != null && !droppedFiles.isEmpty()) {
OpenableSourceInfo[] sourceInfos = new OpenableSourceInfo[droppedFiles.size()];
@@ -1470,9 +1472,9 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
dtde.dropComplete(false);
//ignored
}
}
});
}
});
calculateMissingNeededThread = new CalculateMissingNeededThread();
calculateMissingNeededThread.start();
pinsPanel.load();
@@ -1655,7 +1657,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
if (!abcFound) {
getABCPanel().setAbc(abcList.get(0).getABC());
}
}
}
}
mainMenu.updateComponents(openable);
@@ -1948,7 +1950,6 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
return true;
}
public void updateClassesList() {
String selectionPath = getCurrentTree().getSelectionPathString();
List<TreeItem> nodes = getASTreeNodes(tagTree);
@@ -2123,7 +2124,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
List<File> ret = new ArrayList<>();
List<TreeItem> sel = getSelection(null, selection);
Set<Openable> usedOpenables = new HashSet<>();
Set<OpenableList> usedOpenableLists = new HashSet<>();
@@ -2138,7 +2139,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
usedOpenableLists.add(list);
}
}
Map<String, Integer> usedSwfsIds = new HashMap<>();
for (Openable openable : usedOpenables) {
@@ -2280,10 +2281,8 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
selFile2 = selFile;
}
int aaScale = Configuration.reduceAntialiasConflationByScalingForExport.get() ? Configuration.reduceAntialiasConflationByScalingValueForExport.get() : 1;
EventListener evl = swf.getExportEventListener();
if (export.isOptionEnabled(ImageExportMode.class)) {
@@ -2403,7 +2402,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
}
int aaScale = Configuration.reduceAntialiasConflationByScalingForExport.get() ? Configuration.reduceAntialiasConflationByScalingValueForExport.get() : 1;
EventListener evl = swf.getExportEventListener();
if (export.isOptionEnabled(ImageExportMode.class)) {
@@ -2499,7 +2498,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
EventListener evl = swf.getExportEventListener();
int aaScale = Configuration.reduceAntialiasConflationByScalingForExport.get() ? Configuration.reduceAntialiasConflationByScalingValueForExport.get() : 1;
if (export.isOptionEnabled(ImageExportMode.class)) {
for (ImageExportMode exportMode : ImageExportMode.values()) {
new ImageExporter().exportImages(handler, Path.combine(selFile, ImageExportSettings.EXPORT_FOLDER_NAME, exportMode.name()), swf.getTags(),
@@ -2878,7 +2877,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
if (asms.containsKey(rawScriptName)) {
oldItem = null;
getCurrentTree().setSelectionPath(null);
setTagTreeSelectedNode(getCurrentTree(), asms.get(rawScriptName));
setTagTreeSelectedNode(getCurrentTree(), asms.get(rawScriptName));
return true;
}
/*if (actionPanel != null && asms.containsKey(rawScriptName)) {
@@ -2987,7 +2986,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
public void searchInActionScriptOrText(Boolean searchInText, Openable openable, boolean useSelection) {
View.checkAccess();
if (checkEdited()) {
return;
}
@@ -3435,7 +3434,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
updateClassesList();
reload(true);
}
public void skipDetectionOfUninitializedClassFieldsChanged() {
clearAllScriptCache();
updateClassesList();
@@ -4562,9 +4561,57 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
}
}
}
public void exportXaml(SWF swf) {
//TODO
JFileChooser fc = View.getFileChooserWithIcon("exportxml");
fc.setDialogTitle(AppStrings.translate("menu.file.export.xaml"));
String selDir = Configuration.lastExportDir.get();
fc.setCurrentDirectory(new File(selDir));
if (!selDir.endsWith(File.separator)) {
selDir += File.separator;
}
String swfFileName = swf.getTitleOrShortFileName();
String slnxFileName = swfFileName + ".slnx";
if (swfFileName.toLowerCase(Locale.ENGLISH).endsWith(".swf")
|| swfFileName.toLowerCase(Locale.ENGLISH).endsWith(".gfx")) {
slnxFileName = swfFileName.substring(0, swfFileName.lastIndexOf(".")) + ".slnx";
}
fc.setSelectedFile(new File(selDir + slnxFileName));
fc.setFileFilter(new FileFilter() {
@Override
public boolean accept(File f) {
return f.isDirectory() || f.getName().toLowerCase(Locale.ENGLISH).endsWith(".slnx");
}
@Override
public String getDescription() {
return AppStrings.translate("filter.slnx");
}
});
if (fc.showSaveDialog(Main.getDefaultMessagesComponent()) != JFileChooser.APPROVE_OPTION) {
return;
}
String selFile = Helper.fixDialogFile(fc.getSelectedFile()).getAbsolutePath();
if (selFile.toLowerCase(Locale.ENGLISH).endsWith(".slnx")) {
selFile = selFile.substring(0, selFile.lastIndexOf("."));
}
File parentDir = new File(selFile).getParentFile();
String projectName = new File(selFile).getName();
AbortRetryIgnoreHandler handler = new GuiAbortRetryIgnoreHandler();
Main.startWork(translate("work.exporting.xaml") + "...", null, true);
try {
new RetryTask(() -> {
XamlExporter xamlExporter = new XamlExporter();
xamlExporter.exportSwf(swf, parentDir, projectName, 1);
}, handler).run();
} catch (IOException ex) {
logger.log(Level.SEVERE, null, ex);
} catch (InterruptedException ex) {
//ignore
}
Main.stopWork();
}
public void exportJavaSource(List<TreeItem> items) {
@@ -4953,7 +5000,8 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
}
List<Tag> tagsToRemove = new ArrayList<>();
loopTags: for (Tag tag : swf.getTags()) {
loopTags:
for (Tag tag : swf.getTags()) {
if (tag instanceof CharacterTag) {
CharacterTag characterTag = (CharacterTag) tag;
for (String cls : characterTag.getClassNames()) {
@@ -5091,10 +5139,10 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
};
}
public boolean saveText(TextTag textTag, String formattedText, String[] texts, LineMarkedEditorPane editor, UndoManager undoManager) {
if (undoManager != null) {
public boolean saveText(TextTag textTag, String formattedText, String[] texts, LineMarkedEditorPane editor, UndoManager undoManager) {
if (undoManager != null) {
String prevText = textTag.getFormattedText(false).text;
if (saveTextInternal(textTag, formattedText, texts, editor)) {
if (saveTextInternal(textTag, formattedText, texts, editor)) {
undoManager.doOperation(new DoableOperation() {
boolean first = true;
@@ -5110,7 +5158,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
@Override
public void undoOperation() {
saveTextInternal(textTag, prevText, texts, editor);
saveTextInternal(textTag, prevText, texts, editor);
}
@Override
@@ -5122,11 +5170,11 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
}
return false;
}
return saveTextInternal(textTag, formattedText, texts, editor);
return saveTextInternal(textTag, formattedText, texts, editor);
}
private boolean saveTextInternal(TextTag textTag, String formattedText, String[] texts, LineMarkedEditorPane editor) {
private boolean saveTextInternal(TextTag textTag, String formattedText, String[] texts, LineMarkedEditorPane editor) {
try {
if (textTag.setFormattedText(getMissingCharacterHandler(), formattedText, texts)) {
return true;
@@ -5626,8 +5674,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
AbortRetryIgnoreHandler errorHandler = new GuiAbortRetryIgnoreHandler();
int aaScale = Configuration.reduceAntialiasConflationByScalingForExport.get() ? Configuration.reduceAntialiasConflationByScalingValueForExport.get() : 1;
FrameExporter frameExporter = new FrameExporter();
FrameExportSettings fes = new FrameExportSettings(mode, dialog.getZoom(), dialog.isTransparentFrameBackgroundEnabled(), aaScale);
String subFolder = FrameExportSettings.EXPORT_FOLDER_NAME;
@@ -5782,15 +5829,14 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
private void valueChanged(Object source, TreePath selectedPath) {
TreeItem treeItem = selectedPath == null ? null : (TreeItem) selectedPath.getLastPathComponent();
if (treeItem == null) {
if (treeItem == null) {
updateUi(null);
reload(false);
return;
}
//Main.updateSession();
//Main.updateSession();
if (!(treeItem instanceof OpenableList)) {
Openable openable = treeItem.getOpenable();
if (openables.isEmpty()) {
@@ -6354,12 +6400,12 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
@Override
public Dimension getFilterDimensions() {
return new Dimension(0, 0);
}
}
@Override
public RECT getRectWithFilters() {
return getRect();
}
}
};
previewPanel.showImagePanel(tim, origSwf, 0, true, true, !Configuration.animateSubsprites.get(), false, !Configuration.playFrameSounds.get(), true, false, true, true, true);
} else if (treeItem instanceof DefineFont4Tag) {
@@ -6523,7 +6569,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
Set<Integer> needed;
Set<String> neededClasses;
if (neededCharacters.containsKey(treeItem)) {
needed = neededCharacters.get(treeItem);
neededClasses = neededCharacterClasses.get(treeItem);
@@ -6534,8 +6580,6 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
neededCharacters.put(treeItem, needed);
neededCharacterClasses.put(treeItem, neededClasses);
}
if (needed.size() > 0) {
tagInfo.addInfo("general", "neededCharacters", Helper.joinStrings(needed, ", "));
@@ -6905,13 +6949,13 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
Set<Integer> resultNeeded = new LinkedHashSet<>();
Set<String> resultNeededClasses = new LinkedHashSet<>();
t.getMissingNeededCharacters(needed, neededClasses, resultNeeded, resultNeededClasses);
missingNeededCharacters.put(t, resultNeeded);
missingNeededCharacters.put(t, resultNeeded);
missingNeededCharacterClasses.put(t, resultNeededClasses);
if (characterId != -1 && tim.getTimeline().swf.getCharacter(characterId) == null) {
missingNeededCharacters.get(t).add(characterId);
}
//FIXME: missingNeededCharacterClasses ??
}
/*if (t instanceof DefineSpriteTag) {
@@ -6936,7 +6980,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
}
this.neededCharacters = neededCharacters;
this.missingNeededCharacters = missingNeededCharacters;
tagTree.setMissingNeededCharacters(missingNeededCharacters);
tagListTree.setMissingNeededCharacters(missingNeededCharacters);
}
@@ -7071,7 +7115,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
public EasyPanel getEasyPanel() {
return easyPanel;
}
public void showDebugStackFrame() {
showDetail(DETAILCARDDEBUGSTACKFRAME);
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

View File

@@ -1141,4 +1141,8 @@ menu.debugging.debug.disconnectSession = Disconnect session
sort.alphabetically = Sort alphabetically
#after 25.1.3
menu.export.file = Export file as...
menu.export.file = Export file to...
filter.slnx = .NET solution XML (*.slnx)
menu.file.export.xaml = Export XAML
work.exporting.xaml = Exporting XAML
contextmenu.exportXaml = Export XAML

View File

@@ -1141,4 +1141,8 @@ menu.debugging.debug.disconnectSession = Odpojit sezen\u00ed
sort.alphabetically = Se\u0159adit abecedn\u011b
#after 25.1.3
menu.export.file = Exportovat soubor jako...
menu.export.file = Exportovat soubor do...
filter.slnx = .NET solution XML (*.slnx)
menu.file.export.xaml = Exportovat XAML
work.exporting.xaml = Exportov\u00e1n\u00ed XAML
contextmenu.exportXaml = Exportovat XAML

View File

@@ -999,4 +999,11 @@ variables.header.watches = \u00dcberwachungen
menu.debugging.debug.stopListening = Listening beenden
menu.debugging.debug.disconnectSession = Sitzung trennen
sort.alphabetically = Alphabetisch sortieren
sort.alphabetically = Alphabetisch sortieren
#after 25.1.3
menu.export.file = Datei exportieren nach...
filter.slnx = .NET solution XML (*.slnx)
menu.file.export.xaml = Exportiere als XAML
work.exporting.xaml = XAML exportieren
contextmenu.exportXaml = Exportiere als XAML

View File

@@ -1138,4 +1138,11 @@ variables.header.watches = Sledovania
menu.debugging.debug.stopListening = Zastavi\u0165 po\u010d\u00favanie
menu.debugging.debug.disconnectSession = Odpoji\u0165 sedenie
sort.alphabetically = Zoradi\u0165 abecedne
sort.alphabetically = Zoradi\u0165 abecedne
#after 25.1.3
menu.export.file = Exportova\u0165 s\u00fabor do...
filter.slnx = .NET solution XML (*.slnx)
menu.file.export.xaml = Exportova\u0165 XAML
work.exporting.xaml = Exportovanie XAML
contextmenu.exportXaml = Exportova\u0165 XAML

View File

@@ -255,6 +255,8 @@ public class TagTreeContextMenu extends JPopupMenu {
private JMenuItem saveExeMenuItem;
private JMenuItem exportXamlMenuItem;
private JMenuItem importSwfXmlMenuItem;
private JMenuItem importScriptsMenuItem;
@@ -591,6 +593,16 @@ public class TagTreeContextMenu extends JPopupMenu {
saveExeMenuItem.setIcon(View.getIcon("saveasexe16"));
add(saveExeMenuItem);
exportXamlMenuItem = new JMenuItem(mainPanel.translate("contextmenu.exportXaml"));
exportXamlMenuItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
mainPanel.exportXaml((SWF) getCurrentItem().getOpenable());
}
});
exportXamlMenuItem.setIcon(View.getIcon("exportxml16"));
add(exportXamlMenuItem);
addSeparator();
rawEditMenuItem = new JMenuItem(mainPanel.translate("contextmenu.rawEdit"));
@@ -1423,6 +1435,7 @@ public class TagTreeContextMenu extends JPopupMenu {
exportSwfXmlMenuItem.setVisible(allSelectedIsSwf);
saveSwcMenuItem.setVisible(allSelectedIsSwf && items.size() == 1);
saveExeMenuItem.setVisible(allSelectedIsSwf && items.size() == 1);
exportXamlMenuItem.setVisible(allSelectedIsSwf && items.size() == 1);
importImagesMenuItem.setVisible(false);
importShapesMenuItem.setVisible(false);
@@ -3169,7 +3182,7 @@ public class TagTreeContextMenu extends JPopupMenu {
protected void onStart() {
Main.startWork(AppStrings.translate("work.prepareDebug"), this, true);
}
@Override
protected Object doInBackground() throws Exception {
List<File> tempFiles = new ArrayList<>();
@@ -3198,7 +3211,7 @@ public class TagTreeContextMenu extends JPopupMenu {
public void workerCancelled() {
Main.stopWork();
}
};
};
prepareDebugWorker.execute();
}