From 71e3db5435daef9a4a0f9a719c0d9947dd328fcc Mon Sep 17 00:00:00 2001 From: "honfika@gmail.com" Date: Sat, 19 Dec 2015 08:22:33 +0100 Subject: [PATCH 1/2] svg: path "a" (elliptical arc) command, approximate with polygon (todo: use Bezier) --- .../flash/importers/ShapeImporter.java | 264 ++++++++++++------ 1 file changed, 183 insertions(+), 81 deletions(-) diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/importers/ShapeImporter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/importers/ShapeImporter.java index 79ef9c792..947e250ab 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/importers/ShapeImporter.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/importers/ShapeImporter.java @@ -590,39 +590,141 @@ public class ShapeImporter { y += y0; } - double x1 = x0; - double y1 = y0; - double x2 = x; - double y2 = y; + if (rx == 0 || ry == 0) { + // straight line to (x, y) + PathCommand sera = new PathCommand(); + sera.command = 'L'; + sera.params = new double[]{x, y}; + pathCommands.add(sera); + } else { + rx = Math.abs(rx); + ry = Math.abs(ry); - double d1 = (x1 - x2) / 2; - double d2 = (y1 - y2) / 2; - double x1Comma = Math.cos(fi) * d1 + Math.sin(fi) * d2; - double y1Comma = -Math.sin(fi) * d1 + Math.cos(fi) * d2; + double x1 = x0; + double y1 = y0; + double x2 = x; + double y2 = y; - double c = Math.sqrt((rx * rx * ry * ry - rx * rx * y1Comma * y1Comma - ry * ry * x1Comma * x1Comma) / (rx * rx * y1Comma * y1Comma + ry * ry * x1Comma * x1Comma)); - double cxComma = c * rx * y1Comma / ry; - double cyComma = c * -ry * x1Comma / rx; + double d1 = (x1 - x2) / 2; + double d2 = (y1 - y2) / 2; + double x1Comma = Math.cos(fi) * d1 + Math.sin(fi) * d2; + double y1Comma = -Math.sin(fi) * d1 + Math.cos(fi) * d2; - if (largeFlag == sweepFlag) { - cxComma = -cxComma; - cyComma = -cyComma; + // Correction of out-of-range radii + double lambda = x1Comma * x1Comma / (rx * rx) + y1Comma * y1Comma / (ry * ry); + if (lambda > 1) { + double sqrtLambda = Math.sqrt(lambda); + rx = sqrtLambda * rx; + ry = sqrtLambda * ry; + } + + double c = Math.sqrt((rx * rx * ry * ry - rx * rx * y1Comma * y1Comma - ry * ry * x1Comma * x1Comma) / (rx * rx * y1Comma * y1Comma + ry * ry * x1Comma * x1Comma)); + double cxComma = c * rx * y1Comma / ry; + double cyComma = c * -ry * x1Comma / rx; + + if (largeFlag == sweepFlag) { + cxComma = -cxComma; + cyComma = -cyComma; + } + + double cx = Math.cos(fi) * cxComma - Math.sin(fi) * cyComma + (x1 + x2) / 2; + double cy = Math.sin(fi) * cxComma + Math.cos(fi) * cyComma + (y1 + y2) / 2; + + double px1 = (x1Comma - cxComma) / rx; + double py1 = (y1Comma - cyComma) / ry; + double theta1 = calcAngle(1, 0, px1, py1); + + double px2 = (-x1Comma - cxComma) / rx; + double py2 = (-y1Comma - cyComma) / ry; + double deltaTheta = calcAngle(px1, py1, px2, py2); + if (sweepFlag) { + if (deltaTheta < 0) { + deltaTheta += 2 * Math.PI; + } + } else { + if (deltaTheta > 0) { + deltaTheta -= 2 * Math.PI; + } + } + + double rcp = Math.sqrt(4 - 2 * Math.sqrt(2)); + double delta = Math.PI / 4 / 45; + if (deltaTheta > 0) { + int segmentCount = (int) Math.ceil(deltaTheta / delta); + + double theta = theta1; + + PathCommand sera; + for (int i = 0; i < segmentCount - 1; i++) { + theta += delta; + sera = new PathCommand(); + sera.command = 'L'; + double x12 = Math.cos(theta) * rx; + double y12 = Math.sin(theta) * ry; + x1Comma = Math.cos(fi) * x12 - Math.sin(fi) * y12; + y1Comma = Math.sin(fi) * x12 + Math.cos(fi) * y12; + sera.params = new double[]{cx + x1Comma, cy + y1Comma}; + pathCommands.add(sera); + + /*sera = new PathCommand(); + sera.command = 'Q'; + double x12 = Math.cos(theta) * rx; + double y12 = Math.sin(theta) * ry; + x1Comma = Math.cos(fi) * x12 - Math.sin(fi) * y12; + y1Comma = Math.sin(fi) * x12 + Math.cos(fi) * y12; + + double theta2 = theta - Math.PI / 8; + x12 = Math.cos(theta2) * rx * rcp; + y12 = Math.sin(theta2) * ry * rcp; + double x1Comma2 = Math.cos(fi) * x12 - Math.sin(fi) * y12; + double y1Comma2 = Math.sin(fi) * x12 + Math.cos(fi) * y12; + sera.params = new double[]{cx + x1Comma2, cy + y1Comma2, cx + x1Comma, cy + y1Comma}; + pathCommands.add(sera);*/ + } + + sera = new PathCommand(); + sera.command = 'L'; + sera.params = new double[]{x, y}; + pathCommands.add(sera); + } else { + int segmentCount = (int) Math.ceil(-deltaTheta / delta); + + double theta = theta1; + + PathCommand sera; + for (int i = 0; i < segmentCount - 1; i++) { + theta -= delta; + sera = new PathCommand(); + sera.command = 'L'; + double x12 = Math.cos(theta) * rx; + double y12 = Math.sin(theta) * ry; + x1Comma = Math.cos(fi) * x12 - Math.sin(fi) * y12; + y1Comma = Math.sin(fi) * x12 + Math.cos(fi) * y12; + sera.params = new double[]{cx + x1Comma, cy + y1Comma}; + pathCommands.add(sera); + + /*sera = new PathCommand(); + sera.command = 'Q'; + double x12 = Math.cos(theta) * rx; + double y12 = Math.sin(theta) * ry; + x1Comma = Math.cos(fi) * x12 - Math.sin(fi) * y12; + y1Comma = Math.sin(fi) * x12 + Math.cos(fi) * y12; + + double theta2 = theta + Math.PI / 8; + x12 = Math.cos(theta2) * rx * rcp; + y12 = Math.sin(theta2) * ry * rcp; + double x1Comma2 = Math.cos(fi) * x12 - Math.sin(fi) * y12; + double y1Comma2 = Math.sin(fi) * x12 + Math.cos(fi) * y12; + sera.params = new double[]{cx + x1Comma2, cy + y1Comma2, cx + x1Comma, cy + y1Comma}; + pathCommands.add(sera);*/ + } + + sera = new PathCommand(); + sera.command = 'L'; + sera.params = new double[]{x, y}; + pathCommands.add(sera); + } } - - double cx = Math.cos(fi) * cxComma - Math.sin(fi) * cyComma + (x1 + x2) / 2; - double cy = Math.sin(fi) * cxComma + Math.cos(fi) * cyComma + (y1 + y2) / 2; - - // todo: draw arc, now draw only a line - PathCommand sera = new PathCommand(); - sera.command = 'L'; - sera.params = new double[]{cx, cy}; - pathCommands.add(sera); - - sera = new PathCommand(); - sera.command = 'L'; - sera.params = new double[]{x, y}; - pathCommands.add(sera); - break; default: Logger.getLogger(ShapeImporter.class.getName()).log(Level.WARNING, "Unknown command: {0}", command); @@ -644,6 +746,23 @@ public class ShapeImporter { processCommands(shapeNum, shapes, pathCommands, transform, style); } + private double[] getCoordinates() { + //rx, -sqrt2Minus1RY, + //sqrt2RXHalf, -sqrt2RYHalf, + return null; + } + + private double calcAngle(double ux, double uy, double vx, double vy) { + double lu = Math.sqrt(ux * ux + uy * uy); + double lv = Math.sqrt(ux * ux + uy * uy); + double sign = Math.signum(ux * vy - uy * vx); + if (sign == 0) { + sign = 1; + } + + return sign * Math.acos(ux * vx + uy * vy / (lu * lv)); + } + private void processCircle(int shapeNum, SHAPEWITHSTYLE shapes, Element childElement, Matrix transform, SvgStyle style) { String attr = childElement.getAttribute("cx"); double cx = attr.length() > 0 ? Double.parseDouble(attr) : 0; @@ -653,42 +772,8 @@ public class ShapeImporter { attr = childElement.getAttribute("r"); double r = attr.length() > 0 ? Double.parseDouble(attr) : 0; - double sqrt2RHalf = Math.sqrt(2) * r / 2; - double sqrt2Minus1R = (Math.sqrt(2) - 1) * r; - List pathCommands = new ArrayList<>(); - PathCommand scr = new PathCommand(); - scr.command = 'M'; - scr.params = new double[]{cx + r, cy}; - pathCommands.add(scr); - - double[] points = new double[]{ - cx + r, cy - sqrt2Minus1R, - cx + sqrt2RHalf, cy - sqrt2RHalf, - cx + sqrt2Minus1R, cy - r, - cx, cy - r, - cx - sqrt2Minus1R, cy - r, - cx - sqrt2RHalf, cy - sqrt2RHalf, - cx - r, cy - sqrt2Minus1R, - cx - r, cy, - cx - r, cy + sqrt2Minus1R, - cx - sqrt2RHalf, cy + sqrt2RHalf, - cx - sqrt2Minus1R, cy + r, - cx, cy + r, - cx + sqrt2Minus1R, cy + r, - cx + sqrt2RHalf, cy + sqrt2RHalf, - cx + r, cy + sqrt2Minus1R, - cx + r, cy}; - - for (int i = 0; i < points.length; i += 4) { - PathCommand cer = new PathCommand(); - cer.command = 'Q'; - cer.params = new double[]{points[i], points[i + 1], points[i + 2], points[i + 3]}; - - pathCommands.add(cer); - } - - processCommands(shapeNum, shapes, pathCommands, transform, style); + processEllipse(shapeNum, shapes, transform, style, cx, cy, r, r); } private void processEllipse(int shapeNum, SHAPEWITHSTYLE shapes, Element childElement, Matrix transform, SvgStyle style) { @@ -704,6 +789,10 @@ public class ShapeImporter { attr = childElement.getAttribute("ry"); double ry = attr.length() > 0 ? Double.parseDouble(attr) : 0; + processEllipse(shapeNum, shapes, transform, style, cx, cy, rx, ry); + } + + private void processEllipse(int shapeNum, SHAPEWITHSTYLE shapes, Matrix transform, SvgStyle style, double cx, double cy, double rx, double ry) { double sqrt2RXHalf = Math.sqrt(2) * rx / 2; double sqrt2Minus1RX = (Math.sqrt(2) - 1) * rx; double sqrt2RYHalf = Math.sqrt(2) * ry / 2; @@ -716,28 +805,41 @@ public class ShapeImporter { pathCommands.add(scr); double[] points = new double[]{ - cx + rx, cy - sqrt2Minus1RY, - cx + sqrt2RXHalf, cy - sqrt2RYHalf, - cx + sqrt2Minus1RX, cy - ry, - cx, cy - ry, - cx - sqrt2Minus1RX, cy - ry, - cx - sqrt2RXHalf, cy - sqrt2RYHalf, - cx - rx, cy - sqrt2Minus1RY, - cx - rx, cy, - cx - rx, cy + sqrt2Minus1RY, - cx - sqrt2RXHalf, cy + sqrt2RYHalf, - cx - sqrt2Minus1RX, cy + ry, - cx, cy + ry, - cx + sqrt2Minus1RX, cy + ry, - cx + sqrt2RXHalf, cy + sqrt2RYHalf, - cx + rx, cy + sqrt2Minus1RY, - cx + rx, cy}; + rx, -sqrt2Minus1RY, + sqrt2RXHalf, -sqrt2RYHalf, + sqrt2Minus1RX, -ry, + 0, -ry, + -sqrt2Minus1RX, -ry, + -sqrt2RXHalf, -sqrt2RYHalf, + -rx, -sqrt2Minus1RY, + -rx, 0, + -rx, sqrt2Minus1RY, + -sqrt2RXHalf, sqrt2RYHalf, + -sqrt2Minus1RX, ry, + 0, ry, + sqrt2Minus1RX, ry, + sqrt2RXHalf, sqrt2RYHalf, + rx, sqrt2Minus1RY, + rx, 0}; for (int i = 0; i < points.length; i += 4) { PathCommand cer = new PathCommand(); cer.command = 'Q'; - cer.params = new double[]{points[i], points[i + 1], points[i + 2], points[i + 3]}; + cer.params = new double[]{cx + points[i], cy + points[i + 1], cx + points[i + 2], cy + points[i + 3]}; + /*double tetha = 30; + tetha *= Math.PI / 180; + double x1 = points[i]; + double y1 = points[i + 1]; + double x2 = points[i + 2]; + double y2 = points[i + 3]; + + double x1Comma = Math.cos(tetha) * x1 + Math.sin(tetha) * y1; + double y1Comma = -Math.sin(tetha) * x1 + Math.cos(tetha) * y1; + double x2Comma = Math.cos(tetha) * x2 + Math.sin(tetha) * y2; + double y2Comma = -Math.sin(tetha) * x2 + Math.cos(tetha) * y2; + + cer.params = new double[]{cx + x1Comma, cy + y1Comma, cx + x2Comma, cy + y2Comma};*/ pathCommands.add(cer); } From 29acbc0661ade98cf7b85ce936aea3f89d3d804e Mon Sep 17 00:00:00 2001 From: "honfika@gmail.com" Date: Sat, 19 Dec 2015 10:41:01 +0100 Subject: [PATCH 2/2] svg import warning, config for flash player panel delay --- .../flash/configuration/Configuration.java | 9 ++++-- .../jpexs/decompiler/flash/gui/MainPanel.java | 32 ++++++++++++------- src/com/jpexs/decompiler/flash/gui/View.java | 4 +-- .../locales/AdvancedSettingsDialog.properties | 7 ++-- .../flash/gui/locales/MainFrame.properties | 3 +- .../flash/gui/locales/MainFrame_ca.properties | 2 +- .../flash/gui/locales/MainFrame_cs.properties | 2 +- .../flash/gui/locales/MainFrame_de.properties | 2 +- .../flash/gui/locales/MainFrame_es.properties | 2 +- .../flash/gui/locales/MainFrame_fr.properties | 2 +- .../flash/gui/locales/MainFrame_hu.properties | 2 +- .../flash/gui/locales/MainFrame_it.properties | 2 +- .../flash/gui/locales/MainFrame_nl.properties | 2 +- .../flash/gui/locales/MainFrame_pl.properties | 2 +- .../flash/gui/locales/MainFrame_pt.properties | 2 +- .../gui/locales/MainFrame_pt_BR.properties | 2 +- .../flash/gui/locales/MainFrame_ru.properties | 2 +- .../flash/gui/locales/MainFrame_sv.properties | 2 +- .../flash/gui/locales/MainFrame_uk.properties | 2 +- .../flash/gui/locales/MainFrame_zh.properties | 2 +- .../flash/gui/player/FlashPlayerPanel.java | 7 ++-- 21 files changed, 57 insertions(+), 35 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 0cf58179d..5ac15b69c 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 @@ -104,6 +104,10 @@ public class Configuration { @ConfigurationCategory("display") public static final ConfigurationItem internalFlashViewer = null; + @ConfigurationDefaultInt(1000) + @ConfigurationCategory("display") + public static final ConfigurationItem setMovieDelay = null; + @ConfigurationDefaultBoolean(false) @ConfigurationCategory("display") public static final ConfigurationItem dumpView = null; @@ -529,9 +533,10 @@ public class Configuration { @ConfigurationCategory("script") public static final ConfigurationItem debugHalt = null; - @ConfigurationDefaultBoolean(false) + @ConfigurationDefaultBoolean(true) + @ConfigurationName("warning.svgImport") @ConfigurationCategory("import") - public static final ConfigurationItem experimentalSvgImportEnabled = null; + public static final ConfigurationItem warningSvgImport = null; private enum OSId { diff --git a/src/com/jpexs/decompiler/flash/gui/MainPanel.java b/src/com/jpexs/decompiler/flash/gui/MainPanel.java index 84be2998b..f7f1b1eea 100644 --- a/src/com/jpexs/decompiler/flash/gui/MainPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/MainPanel.java @@ -2615,11 +2615,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se } if (item instanceof ShapeTag) { ShapeTag st = (ShapeTag) item; - String filter = "filter.images|*.jpg;*.jpeg;*.gif;*.png;*.bmp"; - if (Configuration.experimentalSvgImportEnabled.get()) { - filter += ";*.svg"; - } - + String filter = "filter.images|*.jpg;*.jpeg;*.gif;*.png;*.bmp;*.svg"; File selectedFile = showImportFileChooser(filter); if (selectedFile != null) { File selfile = Helper.fixDialogFile(selectedFile); @@ -2627,6 +2623,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se String svgText = null; if (".svg".equals(Path.getExtension(selfile))) { svgText = Helper.readTextFile(selfile.getAbsolutePath()); + showSvgImportWarning(); } else { data = Helper.readFile(selfile.getAbsolutePath()); } @@ -2668,11 +2665,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se if (item instanceof ShapeTag) { ShapeTag st = (ShapeTag) item; - String filter = "filter.images|*.jpg;*.jpeg;*.gif;*.png;*.bmp"; - if (Configuration.experimentalSvgImportEnabled.get()) { - filter += ";*.svg"; - } - + String filter = "filter.images|*.jpg;*.jpeg;*.gif;*.png;*.bmp;*.svg"; File selectedFile = showImportFileChooser(filter); if (selectedFile != null) { File selfile = Helper.fixDialogFile(selectedFile); @@ -2680,6 +2673,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se String svgText = null; if (".svg".equals(Path.getExtension(selfile))) { svgText = Helper.readTextFile(selfile.getAbsolutePath()); + showSvgImportWarning(); } else { data = Helper.readFile(selfile.getAbsolutePath()); } @@ -2702,6 +2696,10 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se } } + private void showSvgImportWarning() { + View.showMessageDialog(null, AppStrings.translate("message.warning.svgImportExperimental"), AppStrings.translate("message.warning"), JOptionPane.WARNING_MESSAGE, Configuration.warningSvgImport); + } + public void replaceAlphaButtonActionPerformed(ActionEvent evt) { TreeItem item = tagTree.getCurrentTreeItem(); if (item == null) { @@ -2794,7 +2792,19 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se @Override public String getDescription() { - return translate(filterName); + StringBuilder extStr = new StringBuilder(); + boolean first = true; + for (String ext : extensions) { + if (first) { + first = false; + } else { + extStr.append(","); + } + + extStr.append("*").append(ext); + } + + return translate(filterName).replace("%extensions%", extStr); } }; if (first) { diff --git a/src/com/jpexs/decompiler/flash/gui/View.java b/src/com/jpexs/decompiler/flash/gui/View.java index f6a9ea3bf..919636b0e 100644 --- a/src/com/jpexs/decompiler/flash/gui/View.java +++ b/src/com/jpexs/decompiler/flash/gui/View.java @@ -472,7 +472,7 @@ public class View { return showConfirmDialog(parentComponent, message, title, optionType, JOptionPane.PLAIN_MESSAGE, showAgainConfig, defaultOption); } - public static int showConfirmDialog(final Component parentComponent, String message, final String title, final int optionType, final int messageTyp, ConfigurationItem showAgainConfig, int defaultOption) { + public static int showConfirmDialog(final Component parentComponent, String message, final String title, final int optionType, final int messageType, ConfigurationItem showAgainConfig, int defaultOption) { JLabel warLabel = new JLabel("" + message.replace("\r\n", "
") + ""); final JPanel warPanel = new JPanel(new BorderLayout()); @@ -487,7 +487,7 @@ public class View { final int ret[] = new int[1]; execInEventDispatch(() -> { - ret[0] = JOptionPane.showConfirmDialog(parentComponent, warPanel, title, optionType, messageTyp); + ret[0] = JOptionPane.showConfirmDialog(parentComponent, warPanel, title, optionType, messageType); }); showAgainConfig.set(!donotShowAgainCheckBox.isSelected()); return ret[0]; diff --git a/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog.properties b/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog.properties index b78076af9..8193b5990 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog.properties @@ -403,5 +403,8 @@ tip = Tip:\u0020 config.name.gui.action.splitPane.vars.dividerLocationPercent = (Internal) AS1/2 Debug menu splitter location config.description.gui.action.splitPane.vars.dividerLocationPercent = -config.name.experimentalSvgImportEnabled = Enable experimental SVG import -config.description.experimentalSvgImportEnabled = +config.name.setMovieDelay = Delay before changing the SWF in external player in ms +config.description.setMovieDelay = Not recommended to change this value below 1000ms + +config.name.warning.svgImport = Warn on SVG import +config.description.warning.svgImport = diff --git a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame.properties b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame.properties index abd01e2a2..f8cf17bcc 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame.properties @@ -126,7 +126,7 @@ message.rename.notfound.identifier = No identifier found under cursor message.rename.notfound.title = Not found message.rename.renamed = Identifiers renamed: %count% -filter.images = Images (*.jpg,*.gif,*.png,*.bmp) +filter.images = Images (%extensions%) filter.fla = %version% Document (*.fla) filter.xfl = %version% Uncompressed Document (*.xfl) filter.swf = SWF files (*.swf) @@ -701,3 +701,4 @@ menu.file.start.debugpcode = Debug P-code #after 7.1.2 button.replaceNoFill = Replace - Update bounds... +message.warning.svgImportExperimental = Not all SVG features are supported. Only solid color fill mode is supported. Please check the log after import. diff --git a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_ca.properties b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_ca.properties index 83d1aef65..8d7dce3bc 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_ca.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_ca.properties @@ -126,7 +126,7 @@ message.rename.notfound.identifier = No s'ha trobat cap identificador sota el cu message.rename.notfound.title = No s'ha trobat message.rename.renamed = Identificadors renomenats: %count% -filter.images = Imatges (*.jpg,*.gif,*.png,*.bmp) +filter.images = Imatges (%extensions%) filter.fla = Document %version% (*.fla) filter.xfl = Document Descomprimit %version% (*.xfl) filter.swf = Fitxers SWF (*.swf) diff --git a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_cs.properties b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_cs.properties index d1d9aeb01..6f3962c48 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_cs.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_cs.properties @@ -126,7 +126,7 @@ message.rename.notfound.identifier = Na m\u00edst\u011b kurzoru nen\u00ed \u017e message.rename.notfound.title = Nenalezeno message.rename.renamed = Po\u010det p\u0159ejmenovan\u00fdch identifik\u00e1tor\u016f: %count% -filter.images = Obr\u00e1zky (*.jpg,*.gif,*.png,*.bmp) +filter.images = Obr\u00e1zky (%extensions%) filter.fla = Dokument %version% (*.fla) filter.xfl = Nekomprimovan\u00fd Dokument %version% (*.xfl) filter.swf = SWF soubory (*.swf) diff --git a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_de.properties b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_de.properties index 4262fbc85..74f568615 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_de.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_de.properties @@ -126,7 +126,7 @@ message.rename.notfound.identifier = Kein Bezeichner unter dem Cursor gefunden message.rename.notfound.title = Nicht gefunden message.rename.renamed = Bezeichner umbenannt: %count% -filter.images = Bilder (*.jpg,*.gif,*.png,*.bmp) +filter.images = Bilder (%extensions%) filter.fla = Flash CS 6 Dokument (*.fla) filter.xfl = Flash CS 6 Unkomprimiertes Dokument (*.xfl) filter.swf = SWF Datei (*.swf) diff --git a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_es.properties b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_es.properties index 2139834a0..e7ff344b5 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_es.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_es.properties @@ -126,7 +126,7 @@ message.rename.notfound.identifier = No se encontr\u00f3 ning\u00fan identificad message.rename.notfound.title = No encontrado message.rename.renamed = Identificadores renombrados: %count% -filter.images = Im\u00e1genes (*.jpg,*.gif,*.png,*.bmp) +filter.images = Im\u00e1genes (%extensions%) filter.fla = Documento %version% (*.fla) filter.xfl = Documento no comprimido %version% (*.xfl) filter.swf = Archivos SWF (*.swf) diff --git a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_fr.properties b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_fr.properties index 710801368..6cd90becc 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_fr.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_fr.properties @@ -126,7 +126,7 @@ message.rename.notfound.identifier = Aucun identificateur trouv\u00e9 sous le cu message.rename.notfound.title = Pas trouv\u00e9 message.rename.renamed = Nombre d'identificateurs renomm\u00e9s : %count% -filter.images = Images (*.jpg,*.gif,*.png,*.bmp) +filter.images = Images (%extensions%) filter.fla = Document %version% (*.fla) filter.xfl = Document d\u00e9compress\u00e9 %version% (*.xfl) filter.swf = Fichiers SWF (*.swf) diff --git a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_hu.properties b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_hu.properties index 87913aab9..dcefadd6a 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_hu.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_hu.properties @@ -126,7 +126,7 @@ message.rename.notfound.identifier = Azonos\u00edt\u00f3 nem tal\u00e1lhat\u00f3 message.rename.notfound.title = Nem tal\u00e1lhat\u00f3 message.rename.renamed = %count% azonos\u00edt\u00f3 \u00e1tnevezve -filter.images = K\u00e9pek (*.jpg,*.gif,*.png,*.bmp) +filter.images = K\u00e9pek (%extensions%) filter.fla = %version% Dokumentum (*.fla) filter.xfl = %version% T\u00f6m\u00f6r\u00edtetlen dokumentum (*.xfl) filter.swf = SWF f\u00e1ljok (*.swf) diff --git a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_it.properties b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_it.properties index 5f88bd707..5120fa3db 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_it.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_it.properties @@ -126,7 +126,7 @@ message.rename.notfound.identifier = Nessun identificatore alla posizione corren message.rename.notfound.title = Non trovato message.rename.renamed = %count% identificatori renominati. -filter.images = Immagini (*.jpg,*.gif,*.png,*.bmp) +filter.images = Immagini (%extensions%) filter.fla = Documento %version% (*.fla) filter.xfl = Documento non compresso %version%(*.xfl) filter.swf = File SWF (*.swf) diff --git a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_nl.properties b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_nl.properties index 60a6845c3..5bd3c41b8 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_nl.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_nl.properties @@ -126,7 +126,7 @@ message.rename.notfound.identifier = Er is geen identifier bij de cursor gevonde message.rename.notfound.title = Niet gevonden message.rename.renamed = Identifiers werden hernoemd: %count% -filter.images = Images (*.jpg,*.gif,*.png,*.bmp) +filter.images = Images (%extensions%) filter.fla = %version% Document (*.fla) filter.xfl = %version% Ongecomprimeerde Document (*.xfl) filter.swf = SWF-bestanden (*.swf) diff --git a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_pl.properties b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_pl.properties index 81bf6231c..b12cf7997 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_pl.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_pl.properties @@ -126,7 +126,7 @@ message.rename.notfound.identifier = Nie znaleziono identyfikatora pod kursorem message.rename.notfound.title = Nie znaleziono message.rename.renamed = Zmieniono nazwy identyfikator\u00f3w: %count% -filter.images = Obrazy (*.jpg,*.gif,*.png,*.bmp) +filter.images = Obrazy (%extensions%) filter.fla = %version% Dokument (*.fla) filter.xfl = %version% Nieskompresowany Dokument (*.xfl) filter.swf = Pliki SWF (*.swf) diff --git a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_pt.properties b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_pt.properties index 51051d796..078b4bb84 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_pt.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_pt.properties @@ -126,7 +126,7 @@ message.rename.notfound.identifier = Identificador n\u00e3o encontrado no cursor message.rename.notfound.title = N\u00e3o Encontrado message.rename.renamed = Identificadores Renomeados: %count% -filter.images = Imagens (*.jpg,*.gif,*.png,*.bmp) +filter.images = Imagens (%extensions%) filter.fla = %version% Documento (*.fla) filter.xfl = %version% Documento n\u00e3o comprimido (*.xfl) filter.swf = Ficheiros SWF (*.swf) diff --git a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_pt_BR.properties b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_pt_BR.properties index fd1e0814e..887a2d5b1 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_pt_BR.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_pt_BR.properties @@ -126,7 +126,7 @@ message.rename.notfound.identifier = Identificador n\u00e3o encontrado no cursor message.rename.notfound.title = N\u00e3o Encontrado message.rename.renamed = Identificadores Renomeados: %count% -filter.images = Ficheiros de Tipo Imagem (*.jpg,*.gif,*.png,*.bmp) +filter.images = Ficheiros de Tipo Imagem (%extensions%) filter.fla = %version% Documento (*.fla) filter.xfl = %version% Documento n\u00e3o comprimido (*.xfl) filter.swf = Ficheiros SWF (*.swf) diff --git a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_ru.properties b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_ru.properties index 0bbcef832..ef84fed45 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_ru.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_ru.properties @@ -126,7 +126,7 @@ message.rename.notfound.identifier = \u041f\u043e\u0434 \u043a\u0443\u0440\u0441 message.rename.notfound.title = \u041d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u043e message.rename.renamed = \u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u0432 \u043f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u043e: %count% -filter.images = \u0418\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f (*.jpg,*.gif,*.png,*.bmp) +filter.images = \u0418\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f (%extensions%) filter.fla = \u041f\u0440\u043e\u0435\u043a\u0442 %version% (*.fla) filter.xfl = \u041d\u0435\u0441\u0436\u0430\u0442\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 %version% (*.xfl) filter.swf = SWF \u0444\u0430\u0439\u043b\u044b (*.swf) diff --git a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_sv.properties b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_sv.properties index 162f8dcc2..62518af1a 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_sv.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_sv.properties @@ -126,7 +126,7 @@ message.rename.notfound.identifier = ingen identifiering hittades under mark\u00 message.rename.notfound.title = Hittades inte message.rename.renamed = Identifierare som har \u00e4ndrat namn: %count% -filter.images = Bilder (*.jpg,*.gif,*.png,*.bmp) +filter.images = Bilder (%extensions%) filter.fla = %version% Dokument (*.fla) filter.xfl = %version% Okomprimerat Dokument (*.xfl) filter.swf = SWF filer (*.swf) diff --git a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_uk.properties b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_uk.properties index ba822e2a2..75519cc6b 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_uk.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_uk.properties @@ -126,7 +126,7 @@ message.rename.notfound.identifier = \u041f\u0456\u0434 \u043a\u0443\u0440\u0441 message.rename.notfound.title = \u041d\u0435 \u0437\u043d\u0430\u0439\u0434\u0435\u043d\u043e message.rename.renamed = \u0406\u0434\u0435\u043d\u0442\u0438\u0444\u0456\u043a\u0430\u0442\u043e\u0440\u0456\u0432 \u043f\u0435\u0440\u0435\u0439\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u043e: %count% -filter.images = \u0417\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u043d\u044f (*.jpg,*.gif,*.png,*.bmp) +filter.images = \u0417\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u043d\u044f (%extensions%) filter.fla = \u041f\u0440\u043e\u0435\u043a\u0442 %version% (*.fla) filter.xfl = \u041d\u0435\u0441\u0442\u0438\u0441\u043d\u0443\u0442\u0438\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 %version% (*.xfl) filter.swf = SWF \u0444\u0430\u0439\u043b\u0438 (*.swf) diff --git a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_zh.properties b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_zh.properties index 0c79ca224..7ddeddf83 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_zh.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_zh.properties @@ -126,7 +126,7 @@ message.rename.notfound.identifier = \u5728\u5149\u6807\u4e0b\u65b9\u6ca1\u6709\ message.rename.notfound.title = \u6ca1\u6709\u627e\u5230 message.rename.renamed = \u6807\u8bc6\u7b26\u91cd\u547d\u540d\u6570\uff1a %count% -filter.images = \u56fe\u7247 (*.jpg,*.gif,*.png,*.bmp) +filter.images = \u56fe\u7247 (%extensions%) filter.fla = %version% \u6587\u4ef6 (*.fla) filter.xfl = %version% \u672a\u538b\u7f29\u6587\u4ef6 (*.xfl) filter.swf = SWF \u6587\u4ef6 (*.swf) diff --git a/src/com/jpexs/decompiler/flash/gui/player/FlashPlayerPanel.java b/src/com/jpexs/decompiler/flash/gui/player/FlashPlayerPanel.java index 633af979b..33acdcda1 100644 --- a/src/com/jpexs/decompiler/flash/gui/player/FlashPlayerPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/player/FlashPlayerPanel.java @@ -16,6 +16,7 @@ */ package com.jpexs.decompiler.flash.gui.player; +import com.jpexs.decompiler.flash.configuration.Configuration; import com.jpexs.decompiler.flash.gui.FlashUnsupportedException; import com.jpexs.decompiler.flash.gui.Main; import com.jpexs.javactivex.ActiveX; @@ -46,6 +47,8 @@ import java.util.regex.Pattern; */ public final class FlashPlayerPanel extends Panel implements Closeable, MediaDisplay { + private final int setMovieDelay = Configuration.setMovieDelay.get(); + private final List listeners = new ArrayList<>(); private final ShockwaveFlash flash; @@ -254,7 +257,7 @@ public final class FlashPlayerPanel extends Panel implements Closeable, MediaDis public synchronized void displaySWF(final String flashName, final Color bgColor, final float frameRate) { - //Minimum of 1000 ms delay before calling flash.setMovie to avoid illegalAccess errors + // Minimum of 1000 ms (setMovieDelay) delay before calling flash.setMovie to avoid illegalAccess errors if (playQueue == null) { playQueue = new Thread() { long lastTime; @@ -279,7 +282,7 @@ public final class FlashPlayerPanel extends Panel implements Closeable, MediaDis movieToPlay = null; } try { - Thread.sleep(1000); + Thread.sleep(setMovieDelay); } catch (InterruptedException ex) { break; }