From 3236111fea84bb7d2db68aac665e6973d5aaf23a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Sat, 3 May 2025 14:13:32 +0200 Subject: [PATCH] Added: #2370 Objects display - Option to show horizontal and vertical rulers --- CHANGELOG.md | 5 +- .../flash/configuration/Configuration.java | 5 + .../flash/easygui/EasySwfPanel.java | 4 +- .../decompiler/flash/gui/ImagePanel.java | 233 +++++++++++++++++- .../jpexs/decompiler/flash/gui/MainPanel.java | 12 +- .../decompiler/flash/gui/PreviewPanel.java | 26 +- .../flash/gui/SelectFramePositionDialog.java | 4 +- .../flash/gui/SelectTagPositionDialog.java | 4 +- .../flash/gui/action/AddScriptDialog.java | 22 +- .../locales/AdvancedSettingsDialog.properties | 3 + .../AdvancedSettingsDialog_cs.properties | 3 + 11 files changed, 270 insertions(+), 51 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 24c204a2a..c3451c7f4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,11 +5,11 @@ All notable changes to this project will be documented in this file. ### Added - [#2427] Commandline export with use of imported SWFs (importAssets tag) - Auto detect scale factor on Hi-dpi displays -- [#1826] (Optional) Extending shape area by half pixel to fix antialias conflation artifacts - (Can be turned on in advanced settings) +- [#1826] Option to extend shape area by half pixel to fix antialias conflation artifacts - Icons for Simple editor library folders - [#2448] Simple editor - Option to turn off half transparent parent layers - Localized "Open with FFDec" context menu (switch association off/on to apply if already installed) +- [#2370] Objects display - Option to show horizontal and vertical rulers ### Fixed - [#2424] DefineEditText handling of letterSpacing, font size on incorrect values @@ -3742,6 +3742,7 @@ Major version of SWF to XML export changed to 2. [#2427]: https://www.free-decompiler.com/flash/issues/2427 [#1826]: https://www.free-decompiler.com/flash/issues/1826 [#2448]: https://www.free-decompiler.com/flash/issues/2448 +[#2370]: https://www.free-decompiler.com/flash/issues/2370 [#2424]: https://www.free-decompiler.com/flash/issues/2424 [#2391]: https://www.free-decompiler.com/flash/issues/2391 [#2436]: https://www.free-decompiler.com/flash/issues/2436 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 f8706347f..a1177562c 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 @@ -1053,6 +1053,11 @@ public final class Configuration { @ConfigurationCategory("display") public static ConfigurationItem halfTransparentParentLayersEasy = null; + @ConfigurationDefaultBoolean(false) + @ConfigurationCategory("display") + public static ConfigurationItem showRuler = null; + + private enum OSId { WINDOWS, OSX, UNIX } diff --git a/src/com/jpexs/decompiler/flash/easygui/EasySwfPanel.java b/src/com/jpexs/decompiler/flash/easygui/EasySwfPanel.java index 12cb577fe..64371ee7e 100644 --- a/src/com/jpexs/decompiler/flash/easygui/EasySwfPanel.java +++ b/src/com/jpexs/decompiler/flash/easygui/EasySwfPanel.java @@ -527,7 +527,7 @@ public class EasySwfPanel extends JPanel { if (obj instanceof Tag) { Tag t = (Tag) obj; libraryPreviewPanel.setTimelined(TimelinedMaker.makeTimelined(t), t.getSwf(), - -1, false, true, true, true, true, false, true, true); + -1, false, true, true, true, true, false, true, true, true); libraryPreviewPanel.zoomFit(); } else { libraryPreviewPanel.clearAll(); @@ -579,7 +579,7 @@ public class EasySwfPanel extends JPanel { libraryTreeTable.setSwf(swf); libraryPreviewPanel.clearAll(); if (updateStage) { - stagePanel.setTimelined(timelined, swf, 0, true, true, true, true, true, false, true, true); + stagePanel.setTimelined(timelined, swf, 0, true, true, true, true, true, false, true, true, true); stagePanel.pause(); stagePanel.gotoFrame(0); } diff --git a/src/com/jpexs/decompiler/flash/gui/ImagePanel.java b/src/com/jpexs/decompiler/flash/gui/ImagePanel.java index 8f539b3d4..e6a6521dd 100644 --- a/src/com/jpexs/decompiler/flash/gui/ImagePanel.java +++ b/src/com/jpexs/decompiler/flash/gui/ImagePanel.java @@ -22,6 +22,7 @@ import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.LocalDataArea; import com.jpexs.decompiler.flash.action.Stage; import com.jpexs.decompiler.flash.configuration.Configuration; +import com.jpexs.decompiler.flash.configuration.ConfigurationItemChangeListener; import com.jpexs.decompiler.flash.ecma.Undefined; import com.jpexs.decompiler.flash.exporters.commonshape.ExportRectangle; import com.jpexs.decompiler.flash.exporters.commonshape.Matrix; @@ -62,13 +63,16 @@ import java.awt.BasicStroke; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Cursor; +import java.awt.Dimension; import java.awt.FlowLayout; +import java.awt.Font; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Image; import java.awt.KeyEventDispatcher; import java.awt.KeyboardFocusManager; import java.awt.Point; +import java.awt.Polygon; import java.awt.Rectangle; import java.awt.RenderingHints; import java.awt.Shape; @@ -112,6 +116,7 @@ import java.util.logging.Logger; import javax.imageio.ImageIO; import javax.sound.sampled.LineUnavailableException; import javax.sound.sampled.UnsupportedAudioFileException; +import javax.swing.BorderFactory; import javax.swing.BoxLayout; import javax.swing.JLabel; import javax.swing.JPanel; @@ -329,6 +334,12 @@ public final class ImagePanel extends JPanel implements MediaDisplay { private final List parentTimelineds = new ArrayList<>(); + private JPanel topRuler; + + private JPanel leftRuler; + + private boolean contentCanHaveRuler = false; + public void setFrozenButtons(boolean frozenButtons) { this.frozenButtons = frozenButtons; } @@ -359,6 +370,8 @@ public final class ImagePanel extends JPanel implements MediaDisplay { public void setTopPanelVisible(boolean visible) { topPanel.setVisible(visible); + + updateRulerVisibility(); } public void setShowPoints(List showPoints1, List showPoints2) { @@ -666,7 +679,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay { public List getSelectedDepths() { return new ArrayList<>(selectedDepths); - } + } private void calculateFreeOrSelectionTransform() { if (!(doFreeTransform || selectionMode)) { @@ -1367,7 +1380,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay { int drawableFrameCount = dt.getNumFrames(); if (drawableFrameCount == 0) { drawableFrameCount = 1; - } + } double zoomDouble = zoom.fit ? getZoomToFit() : zoom.value; if (lowQuality) { @@ -2456,6 +2469,42 @@ public final class ImagePanel extends JPanel implements MediaDisplay { } } + private Integer getRulerFullLinePixels(double z) { + if (z < 0.0375) { + return null; + } + + int fullLinePixels = 2000; + + if (z >= 0.075) { + fullLinePixels = 1000; + } + + if (z >= 0.15) { + fullLinePixels = 500; + } + + if (z >= 0.31) { + fullLinePixels = 100; + } + if (z >= 0.6) { + fullLinePixels = 50; + } + if (z >= 1.5) { + fullLinePixels = 20; + } + if (z >= 2.99) { + fullLinePixels = 10; + } + if (z >= 5.95) { + fullLinePixels = 5; + } + if (z >= 14.64) { + fullLinePixels = 2; + } + return fullLinePixels; + } + public ImagePanel() { super(new BorderLayout()); //iconPanel.setHorizontalAlignment(JLabel.CENTER); @@ -2502,9 +2551,149 @@ public final class ImagePanel extends JPanel implements MediaDisplay { pointEditPanel.setAlignmentX(JPanel.LEFT_ALIGNMENT); topPanel.add(pointEditPanel); + + topRuler = new JPanel() { + @Override + protected void paintComponent(Graphics g) { + super.paintComponent(g); + double z = getRealZoom(); + + Integer fullLinePixels = getRulerFullLinePixels(z); + if (fullLinePixels == null) { + return; + } + + double fullLineDistance = fullLinePixels * z; + double leftOffset = 25; + Graphics2D g2 = (Graphics2D) g; + g2.setFont(new Font("Monospaced", Font.PLAIN, 12)); + GeneralPath gp = new GeneralPath(); + + double minX = leftOffset + offsetPoint.getX(); + for (; minX >= 0; minX -= fullLineDistance) { + //empty + } + + for (double x = minX; x < getWidth(); x += fullLineDistance) { + gp.moveTo(x, 0); + gp.lineTo(x, getHeight()); + int px = (int) Math.round((x - leftOffset - offsetPoint.getX()) / z); + + int smallLineLength = 4; + int smallerLineLength = 2; + int k = 0; + for (double i = 0; i < fullLineDistance; i += fullLineDistance / 10.0, k++) { + gp.moveTo(x + i, 25); + gp.lineTo(x + i, 25 - (k % 2 == 0 ? smallLineLength : smallerLineLength)); + } + + g2.drawString("" + px, (int) x + 5, 15); + } + g2.setStroke(new BasicStroke(1, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_BEVEL)); + g2.draw(gp); + + if (lastMouseEvent != null) { + int triangleX = lastMouseEvent.getX() + 25; + int triangleHalfWidth = 3; + int triangleHeight = 3; + int triangleYOffset = 3; + + Polygon triangle = new Polygon( + new int[]{triangleX - triangleHalfWidth, triangleX + triangleHalfWidth, triangleX}, + new int[]{25 - triangleHeight - triangleYOffset, 25 - triangleHeight - triangleYOffset, 25 - triangleYOffset}, + 3); + g2.setPaint(getForeground()); + g2.fill(triangle); + } + + g2.setPaint(getBackground()); + g2.fillRect(0, 0, 25, 25); + } + }; + topRuler.setPreferredSize(new Dimension(1, 25)); + topPanel.add(topRuler); + + leftRuler = new JPanel() { + @Override + protected void paintComponent(Graphics g) { + super.paintComponent(g); + double z = getRealZoom(); + + Integer fullLinePixels = getRulerFullLinePixels(z); + if (fullLinePixels == null) { + return; + } + + double fullLineDistance = fullLinePixels * z; + double topOffset = 0; + Graphics2D g2 = (Graphics2D) g; + g2.setFont(new Font("Monospaced", Font.PLAIN, 12)); + GeneralPath gp = new GeneralPath(); + + double minY = topOffset + offsetPoint.getY(); + for (; minY >= 0; minY -= fullLineDistance) { + //empty + } + + AffineTransform origTransform = g2.getTransform(); + + for (double y = minY; y < getHeight(); y += fullLineDistance) { + gp.moveTo(0, y); + gp.lineTo(getWidth(), y); + int py = (int) Math.round((y - topOffset - offsetPoint.getY()) / z); + + int smallLineLength = 4; + int smallerLineLength = 2; + int k = 0; + for (double i = 0; i < fullLineDistance; i += fullLineDistance / 10.0, k++) { + gp.moveTo(25, y + i); + gp.lineTo(25 - (k % 2 == 0 ? smallLineLength : smallerLineLength), y + i); + } + + g2.setTransform(origTransform); + String drawnString = "" + py; + int stringWidth = g2.getFontMetrics().stringWidth(drawnString); + AffineTransform fontTrans = new AffineTransform(); + fontTrans.rotate(-Math.PI / 2, 15, 15); + g2.transform(fontTrans); + g2.drawString(drawnString, 15 - stringWidth + 15 - 5 - Math.round(y), 15); + } + g2.setTransform(origTransform); + + if (lastMouseEvent != null) { + int triangleY = lastMouseEvent.getY(); + int triangleHalfHeight = 3; + int triangleWidth = 3; + int triangleXOffset = 3; + + Polygon triangle = new Polygon( + new int[]{25 - triangleWidth - triangleXOffset, 25 - triangleWidth - triangleXOffset, 25 - triangleXOffset}, + new int[]{triangleY - triangleHalfHeight, triangleY + triangleHalfHeight, triangleY}, + 3); + g2.setPaint(getForeground()); + g2.fill(triangle); + } + + g2.setStroke(new BasicStroke(1, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_BEVEL)); + g2.draw(gp); + } + }; + leftRuler.setPreferredSize(new Dimension(25, 1)); + add(leftRuler, BorderLayout.WEST); + pointEditPanel.setVisible(false); add(topPanel, BorderLayout.NORTH); + leftRuler.setVisible(false); + topRuler.setVisible(false); + + Configuration.showRuler.addListener(new ConfigurationItemChangeListener() { + @Override + public void configurationItemChanged(Boolean newValue) { + updateRulerVisibility(); + } + }); + horizontalScrollBar = new JScrollBar(JScrollBar.HORIZONTAL); verticalScrollBar = new JScrollBar(JScrollBar.VERTICAL); @@ -2656,6 +2845,8 @@ public final class ImagePanel extends JPanel implements MediaDisplay { if (timelined == null) { return; } + leftRuler.repaint(); + topRuler.repaint(); if (thisTimer == null) { startTimer(timelined.getTimeline(), false); } else { @@ -2801,7 +2992,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay { @Override public synchronized void zoom(Zoom zoom) { zoom(zoom, false, false); - } + } private synchronized void zoom(Zoom zoom, boolean useCursor, boolean forced) { if (!zoomAvailable) { @@ -2847,6 +3038,9 @@ public final class ImagePanel extends JPanel implements MediaDisplay { if (textTag != null) { setText(textTag, newTextTag); } + topRuler.repaint(); + leftRuler.repaint(); + fireMediaDisplayStateChanged(); } } @@ -2857,7 +3051,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay { z.fit = true; zoom(z, false, true); } - + @Override public synchronized BufferedImage printScreen() { return iconPanel.getLastImage(); @@ -2899,7 +3093,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay { private Timer setTimelinedTimer = null; - public void setTimelined(final Timelined drawable, final SWF swf, int frame, boolean showObjectsUnderCursor, boolean autoPlay, boolean frozen, boolean alwaysDisplay, boolean muted, boolean mutable, boolean allowZoom, boolean frozenButtons) { + public void setTimelined(final Timelined drawable, final SWF swf, int frame, boolean showObjectsUnderCursor, boolean autoPlay, boolean frozen, boolean alwaysDisplay, boolean muted, boolean mutable, boolean allowZoom, boolean frozenButtons, boolean canHaveRuler) { Stage stage = new Stage(drawable) { @Override public void callFrame(int frame) { @@ -3018,6 +3212,9 @@ public final class ImagePanel extends JPanel implements MediaDisplay { this.showObjectsUnderCursor = showObjectsUnderCursor; this.registrationPointPosition = RegistrationPointPosition.CENTER; iconPanel.calcRect(); + + contentCanHaveRuler = canHaveRuler; + updateRulerVisibility(); redraw(); if (autoPlay) { play(); @@ -3058,9 +3255,17 @@ public final class ImagePanel extends JPanel implements MediaDisplay { horizontalScrollBar.setVisible(false); verticalScrollBar.setVisible(false); + + contentCanHaveRuler = false; + updateRulerVisibility(); fireMediaDisplayStateChanged(); } + private void updateRulerVisibility() { + topRuler.setVisible(contentCanHaveRuler && topPanel.isVisible() && Configuration.showRuler.get()); + leftRuler.setVisible(contentCanHaveRuler && topPanel.isVisible() && Configuration.showRuler.get()); + } + public synchronized void setText(TextTag textTag, TextTag newTextTag) { setBackground(View.getSwfBackgroundColor()); clear(); @@ -3071,6 +3276,9 @@ public final class ImagePanel extends JPanel implements MediaDisplay { stillFrame = true; zoomAvailable = true; + contentCanHaveRuler = true; + updateRulerVisibility(); + this.textTag = textTag; this.newTextTag = newTextTag; @@ -3208,7 +3416,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay { public synchronized int getFrame() { return frame; } - + private static SerializableImage getFrame(Rectangle realRect, RECT rect, ExportRectangle viewRect, SWF swf, int frame, int time, Timelined drawable, RenderContext renderContext, List selectedDepths, boolean doFreeTransform, double zoom, Reference registrationPointRef, Reference boundsRef, Matrix transform, Matrix temporaryMatrix, Matrix newMatrix, boolean selectionMode, List parentTimelineds, List parentDepths, List parentFrames, Matrix parentMatrix @@ -3270,8 +3478,8 @@ public final class ImagePanel extends JPanel implements MediaDisplay { ignoreDepths.add(parentDepthState.depth); if (Configuration.halfTransparentParentLayersEasy.get()) { parentTimelined.getTimeline().toImage(parentFrames.get(i), 0, new RenderContext(), image, image, false, - parentMatrix.preConcatenate(m), new Matrix(), parentMatrix.preConcatenate(m), null, zoom, true, viewRect, parentMatrix.preConcatenate(m), true, Timeline.DRAW_MODE_ALL, 0, !Configuration.disableBitmapSmoothing.get(), - ignoreDepths); + parentMatrix.preConcatenate(m), new Matrix(), parentMatrix.preConcatenate(m), null, zoom, true, viewRect, parentMatrix.preConcatenate(m), true, Timeline.DRAW_MODE_ALL, 0, !Configuration.disableBitmapSmoothing.get(), + ignoreDepths); } parentMatrix = parentMatrix.concatenate(new Matrix(parentDepthState.matrix)); ignoreDepths.clear(); @@ -3344,13 +3552,12 @@ public final class ImagePanel extends JPanel implements MediaDisplay { } int dframe = time % drawableFrameCount; - + if (cht instanceof ButtonTag) { dframe = ButtonTag.FRAME_HITTEST; } - - //Matrix finalMatrix = Matrix.getScaleInstance(1 / SWF.unitDivisor).concatenate(m).concatenate(new Matrix(ds.matrix)); + //Matrix finalMatrix = Matrix.getScaleInstance(1 / SWF.unitDivisor).concatenate(m).concatenate(new Matrix(ds.matrix)); Matrix transform2 = transform; transform2 = transform.concatenate(new Matrix(ds.matrix)); @@ -4412,11 +4619,11 @@ public final class ImagePanel extends JPanel implements MediaDisplay { Matrix b = newMatrix; //getParentMatrix().concatenate(newMatrix); //.concatenate(new Matrix(ds.matrix).inverse()); int dframe = time % drawableFrameCount; - + if (cht instanceof ButtonTag) { dframe = ButtonTag.FRAME_HITTEST; } - + double zoomDouble = zoom.fit ? getZoomToFit() : zoom.value; if (lowQuality) { zoomDouble /= LQ_FACTOR; diff --git a/src/com/jpexs/decompiler/flash/gui/MainPanel.java b/src/com/jpexs/decompiler/flash/gui/MainPanel.java index e0fab2dd6..3f5e794d9 100644 --- a/src/com/jpexs/decompiler/flash/gui/MainPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/MainPanel.java @@ -5852,7 +5852,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se if (treeItem instanceof SWF) { SWF swf = (SWF) treeItem; if (internalViewer) { - previewPanel.showImagePanel(swf, swf, -1, true, Configuration.autoPlaySwfs.get() && Configuration.autoPlayPreviews.get(), !Configuration.animateSubsprites.get(), false, !Configuration.playFrameSounds.get(), true, false, true, false); + previewPanel.showImagePanel(swf, swf, -1, true, Configuration.autoPlaySwfs.get() && Configuration.autoPlayPreviews.get(), !Configuration.animateSubsprites.get(), false, !Configuration.playFrameSounds.get(), true, false, true, false, true); } else { previewPanel.setParametersPanelVisible(false); previewPanel.showFlashViewerPanel(); @@ -5884,7 +5884,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se ImageTag imageTag = (ImageTag) treeItem; previewPanel.setImageReplaceButtonVisible(!((Tag) imageTag).isReadOnly() && imageTag.importSupported(), imageTag instanceof DefineBitsJPEG3Tag || imageTag instanceof DefineBitsJPEG4Tag, false, false, false, false, false); SWF imageSWF = TimelinedMaker.makeTimelinedImage(imageTag); - previewPanel.showImagePanel(imageSWF, imageSWF, 0, false, true, true, true, true, false, false, true, true); + previewPanel.showImagePanel(imageSWF, imageSWF, 0, false, true, true, true, true, false, false, true, true, true); } else if (!isVideoButNotDrawable && (treeItem instanceof DrawableTag) && (!(treeItem instanceof TextTag)) && (!(treeItem instanceof FontTag)) && internalViewer) { final Tag tag = (Tag) treeItem; DrawableTag d = (DrawableTag) tag; @@ -5905,11 +5905,11 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se if (treeItem instanceof DefineSpriteTag) { previewPanel.setImageReplaceButtonVisible(false, false, false, false, false, false, !((Tag) treeItem).isReadOnly()); } - previewPanel.showImagePanel(timelined, tag.getSwf(), -1, true, Configuration.autoPlayPreviews.get(), !Configuration.animateSubsprites.get() && !(treeItem instanceof ButtonTag), treeItem instanceof ShapeTag, !Configuration.playFrameSounds.get(), (treeItem instanceof DefineSpriteTag) || (treeItem instanceof ButtonTag), (treeItem instanceof DefineSpriteTag) || (treeItem instanceof ButtonTag) || (treeItem instanceof ShapeTag), true, false); + previewPanel.showImagePanel(timelined, tag.getSwf(), -1, true, Configuration.autoPlayPreviews.get(), !Configuration.animateSubsprites.get() && !(treeItem instanceof ButtonTag), treeItem instanceof ShapeTag, !Configuration.playFrameSounds.get(), (treeItem instanceof DefineSpriteTag) || (treeItem instanceof ButtonTag), (treeItem instanceof DefineSpriteTag) || (treeItem instanceof ButtonTag) || (treeItem instanceof ShapeTag), true, false, true); } else if (treeItem instanceof Frame && internalViewer) { Frame fn = (Frame) treeItem; SWF swf = (SWF) fn.getOpenable(); - previewPanel.showImagePanel(fn.timeline.timelined, swf, fn.frame, true, Configuration.autoPlayPreviews.get(), !Configuration.animateSubsprites.get(), false, !Configuration.playFrameSounds.get(), true, false, true, false); + previewPanel.showImagePanel(fn.timeline.timelined, swf, fn.frame, true, Configuration.autoPlayPreviews.get(), !Configuration.animateSubsprites.get(), false, !Configuration.playFrameSounds.get(), true, false, true, false, true); } else if (treeItem instanceof ShowFrameTag) { SWF swf; if (timelinedContainer instanceof DefineSpriteTag) { @@ -5917,7 +5917,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se } else { swf = (SWF) timelinedContainer; } - previewPanel.showImagePanel(timelinedContainer, swf, frame, true, Configuration.autoPlayPreviews.get(), !Configuration.animateSubsprites.get(), false, !Configuration.playFrameSounds.get(), true, false, true, false); + previewPanel.showImagePanel(timelinedContainer, swf, frame, true, Configuration.autoPlayPreviews.get(), !Configuration.animateSubsprites.get(), false, !Configuration.playFrameSounds.get(), true, false, true, false, true); } else if ((treeItem instanceof SoundTag)) { //&& isInternalFlashViewerSelected() && (Arrays.asList("mp3", "wav").contains(((SoundTag) tagObj).getExportFormat())))) { previewPanel.showImagePanel(new SerializableImage(View.loadImage("sound32"))); previewPanel.setImageReplaceButtonVisible(false, false, false, !((SoundTag) treeItem).isReadOnly() && ((SoundTag) treeItem).importSupported(), false, false, false); @@ -6049,7 +6049,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se return getRect(); } }; - previewPanel.showImagePanel(tim, origSwf, 0, true, true, !Configuration.animateSubsprites.get(), false, !Configuration.playFrameSounds.get(), true, false, true, true); + previewPanel.showImagePanel(tim, origSwf, 0, true, true, !Configuration.animateSubsprites.get(), false, !Configuration.playFrameSounds.get(), true, false, true, true, true); } else if (treeItem instanceof DefineFont4Tag) { previewPanel.showGenericTagPanel((Tag) treeItem); } else { diff --git a/src/com/jpexs/decompiler/flash/gui/PreviewPanel.java b/src/com/jpexs/decompiler/flash/gui/PreviewPanel.java index 25f426bb8..6865ef637 100644 --- a/src/com/jpexs/decompiler/flash/gui/PreviewPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/PreviewPanel.java @@ -1689,7 +1689,7 @@ public class PreviewPanel extends JPersistentSplitPane implements TagEditorPanel showCardLeft(FLASH_VIEWER_CARD); } - public void showImagePanel(Timelined timelined, SWF swf, int frame, boolean showObjectsUnderCursor, boolean autoPlay, boolean frozen, boolean alwaysDisplay, boolean muted, boolean mutable, boolean allowFreeTransform, boolean allowZoom, boolean frozenButtons) { + public void showImagePanel(Timelined timelined, SWF swf, int frame, boolean showObjectsUnderCursor, boolean autoPlay, boolean frozen, boolean alwaysDisplay, boolean muted, boolean mutable, boolean allowFreeTransform, boolean allowZoom, boolean frozenButtons, boolean canHaveRuler) { showCardLeft(DRAW_PREVIEW_CARD); parametersPanel.setVisible(false); imagePlayControls.setMedia(imagePanel); @@ -1699,7 +1699,7 @@ public class PreviewPanel extends JPersistentSplitPane implements TagEditorPanel } imageTransformSaveButton.setVisible(false); imageTransformCancelButton.setVisible(false); - imagePanel.setTimelined(timelined, swf, frame, showObjectsUnderCursor, autoPlay, frozen, alwaysDisplay, muted, mutable, allowZoom, frozenButtons); + imagePanel.setTimelined(timelined, swf, frame, showObjectsUnderCursor, autoPlay, frozen, alwaysDisplay, muted, mutable, allowZoom, frozenButtons, canHaveRuler); } public void showImagePanel(SerializableImage image) { @@ -1738,7 +1738,7 @@ public class PreviewPanel extends JPersistentSplitPane implements TagEditorPanel private void showFontPage(FontTag fontTag) { if (!MainPanel.isAdobeFlashPlayerEnabled() /*|| ft instanceof GFxDefineCompactedFont*/) { - showImagePanel(TimelinedMaker.makeTimelined(fontTag), fontTag.getSwf(), fontPageNum, true, true, true, true, true, false, false, false, true); + showImagePanel(TimelinedMaker.makeTimelined(fontTag), fontTag.getSwf(), fontPageNum, true, true, true, true, true, false, false, false, true, false); } } @@ -1757,7 +1757,7 @@ public class PreviewPanel extends JPersistentSplitPane implements TagEditorPanel public void showTextPanel(TextTag textTag) { if (!MainPanel.isAdobeFlashPlayerEnabled() /*|| ft instanceof GFxDefineCompactedFont*/) { - showImagePanel(TimelinedMaker.makeTimelined(textTag), textTag.getSwf(), 0, true, true, true, true, true, false, false, true, true); + showImagePanel(TimelinedMaker.makeTimelined(textTag), textTag.getSwf(), 0, true, true, true, true, true, false, false, true, true, true); } showCardRight(CARDTEXTPANEL); @@ -2028,16 +2028,16 @@ public class PreviewPanel extends JPersistentSplitPane implements TagEditorPanel displayEditImagePanel.selectDepth(-1); if (tag instanceof ShapeTag) { Timelined tim = TimelinedMaker.makeTimelined(tag); - displayEditImagePanel.setTimelined(tim, ((Tag) tag).getSwf(), 0, true, Configuration.autoPlayPreviews.get(), !Configuration.animateSubsprites.get(), false, !Configuration.playFrameSounds.get(), false, true, true); + displayEditImagePanel.setTimelined(tim, ((Tag) tag).getSwf(), 0, true, Configuration.autoPlayPreviews.get(), !Configuration.animateSubsprites.get(), false, !Configuration.playFrameSounds.get(), false, true, true, true); } if (tag instanceof MorphShapeTag) { Timelined tim = TimelinedMaker.makeTimelined(tag); - displayEditImagePanel.setTimelined(tim, ((Tag) tag).getSwf(), -1, true, Configuration.autoPlayPreviews.get(), !Configuration.animateSubsprites.get(), false, !Configuration.playFrameSounds.get(), false, true, true); + displayEditImagePanel.setTimelined(tim, ((Tag) tag).getSwf(), -1, true, Configuration.autoPlayPreviews.get(), !Configuration.animateSubsprites.get(), false, !Configuration.playFrameSounds.get(), false, true, true, true); morphDisplayMode = MORPH_ANIMATE; displayEditShowAnimationButton.setSelected(true); } if (tag instanceof PlaceObjectTypeTag) { - displayEditImagePanel.setTimelined(((Tag) tag).getTimelined(), ((Tag) tag).getSwf(), frame, true, Configuration.autoPlayPreviews.get(), !Configuration.animateSubsprites.get(), false, !Configuration.playFrameSounds.get(), true, true, true); + displayEditImagePanel.setTimelined(((Tag) tag).getTimelined(), ((Tag) tag).getSwf(), frame, true, Configuration.autoPlayPreviews.get(), !Configuration.animateSubsprites.get(), false, !Configuration.playFrameSounds.get(), true, true, true, true); PlaceObjectTypeTag place = (PlaceObjectTypeTag) tag; displayEditImagePanel.selectDepth(place.getDepth()); } @@ -2718,19 +2718,19 @@ public class PreviewPanel extends JPersistentSplitPane implements TagEditorPanel private void showAnimationDisplayEditTagButtonActionPerformed(ActionEvent evt) { morphDisplayMode = MORPH_ANIMATE; Timelined tim = TimelinedMaker.makeTimelined(displayEditTag); - displayEditImagePanel.setTimelined(tim, displayEditTag.getSwf(), -1, true, Configuration.autoPlayPreviews.get(), !Configuration.animateSubsprites.get(), false, !Configuration.playFrameSounds.get(), false, true, true); + displayEditImagePanel.setTimelined(tim, displayEditTag.getSwf(), -1, true, Configuration.autoPlayPreviews.get(), !Configuration.animateSubsprites.get(), false, !Configuration.playFrameSounds.get(), false, true, true, true); } private void showStartDisplayEditTagButtonActionPerformed(ActionEvent evt) { morphDisplayMode = MORPH_START; Timelined tim = TimelinedMaker.makeTimelined(displayEditTag); - displayEditImagePanel.setTimelined(tim, displayEditTag.getSwf(), 0, true, Configuration.autoPlayPreviews.get(), !Configuration.animateSubsprites.get(), false, !Configuration.playFrameSounds.get(), false, true, true); + displayEditImagePanel.setTimelined(tim, displayEditTag.getSwf(), 0, true, Configuration.autoPlayPreviews.get(), !Configuration.animateSubsprites.get(), false, !Configuration.playFrameSounds.get(), false, true, true, true); } private void showEndDisplayEditTagButtonActionPerformed(ActionEvent evt) { morphDisplayMode = MORPH_END; Timelined tim = TimelinedMaker.makeTimelined(displayEditTag); - displayEditImagePanel.setTimelined(tim, displayEditTag.getSwf(), tim.getFrameCount() - 1, true, Configuration.autoPlayPreviews.get(), !Configuration.animateSubsprites.get(), false, !Configuration.playFrameSounds.get(), false, true, true); + displayEditImagePanel.setTimelined(tim, displayEditTag.getSwf(), tim.getFrameCount() - 1, true, Configuration.autoPlayPreviews.get(), !Configuration.animateSubsprites.get(), false, !Configuration.playFrameSounds.get(), false, true, true, true); } private void editPointsDisplayEditTagButtonActionPerformed(ActionEvent evt) { @@ -3075,7 +3075,7 @@ public class PreviewPanel extends JPersistentSplitPane implements TagEditorPanel } }; - imagePanel.setTimelined(tim, origSwf, 0, true, true, true, true, true, false, true, true); + imagePanel.setTimelined(tim, origSwf, 0, true, true, true, true, true, false, true, true, true); imagePanel.selectDepth(-1); replaceSpriteButton.setVisible(false); @@ -3187,7 +3187,7 @@ public class PreviewPanel extends JPersistentSplitPane implements TagEditorPanel int pageCount = getFontPageCount(fontTag); fontPageNum = (fontPageNum + pageCount - 1) % pageCount; if (!MainPanel.isAdobeFlashPlayerEnabled() /*|| ft instanceof GFxDefineCompactedFont*/) { - imagePanel.setTimelined(TimelinedMaker.makeTimelined(fontTag, fontPageNum), fontTag.getSwf(), 0, true, true, true, true, true, false, false, true); + imagePanel.setTimelined(TimelinedMaker.makeTimelined(fontTag, fontPageNum), fontTag.getSwf(), 0, true, true, true, true, true, false, false, true, false); } } @@ -3196,7 +3196,7 @@ public class PreviewPanel extends JPersistentSplitPane implements TagEditorPanel int pageCount = getFontPageCount(fontTag); fontPageNum = (fontPageNum + 1) % pageCount; if (!MainPanel.isAdobeFlashPlayerEnabled() /*|| ft instanceof GFxDefineCompactedFont*/) { - imagePanel.setTimelined(TimelinedMaker.makeTimelined(fontTag, fontPageNum), fontTag.getSwf(), 0, true, true, true, true, true, false, false, true); + imagePanel.setTimelined(TimelinedMaker.makeTimelined(fontTag, fontPageNum), fontTag.getSwf(), 0, true, true, true, true, true, false, false, true, false); } } diff --git a/src/com/jpexs/decompiler/flash/gui/SelectFramePositionDialog.java b/src/com/jpexs/decompiler/flash/gui/SelectFramePositionDialog.java index c78138405..9c80cf9f8 100644 --- a/src/com/jpexs/decompiler/flash/gui/SelectFramePositionDialog.java +++ b/src/com/jpexs/decompiler/flash/gui/SelectFramePositionDialog.java @@ -493,9 +493,9 @@ public class SelectFramePositionDialog extends AppDialog { int f = ((MyFrame) tnode.getData()).frame; Object parent = ((MyTreeNode) tnode.getParent()).getData(); if (parent instanceof DefineSpriteTag) { - previewPanel.showImagePanel((DefineSpriteTag) parent, swf, f - 1, true, true, !Configuration.animateSubsprites.get(), false, !Configuration.playFrameSounds.get(), true, false, true, false); + previewPanel.showImagePanel((DefineSpriteTag) parent, swf, f - 1, true, true, !Configuration.animateSubsprites.get(), false, !Configuration.playFrameSounds.get(), true, false, true, false, false); } else { - previewPanel.showImagePanel(swf, swf, f - 1, true, true, !Configuration.animateSubsprites.get(), false, !Configuration.playFrameSounds.get(), true, false, true, false); + previewPanel.showImagePanel(swf, swf, f - 1, true, true, !Configuration.animateSubsprites.get(), false, !Configuration.playFrameSounds.get(), true, false, true, false, false); } } else { previewPanel.showEmpty(); diff --git a/src/com/jpexs/decompiler/flash/gui/SelectTagPositionDialog.java b/src/com/jpexs/decompiler/flash/gui/SelectTagPositionDialog.java index e65eeb084..25b5f520b 100644 --- a/src/com/jpexs/decompiler/flash/gui/SelectTagPositionDialog.java +++ b/src/com/jpexs/decompiler/flash/gui/SelectTagPositionDialog.java @@ -493,9 +493,9 @@ public class SelectTagPositionDialog extends AppDialog { int f = ((MyFrame) tnode.getData()).frame; Object parent = ((MyTreeNode) tnode.getParent()).getData(); if (parent instanceof DefineSpriteTag) { - previewPanel.showImagePanel((DefineSpriteTag) parent, swf, f - 1, true, true, !Configuration.animateSubsprites.get(), false, !Configuration.playFrameSounds.get(), true, false, true, false); + previewPanel.showImagePanel((DefineSpriteTag) parent, swf, f - 1, true, true, !Configuration.animateSubsprites.get(), false, !Configuration.playFrameSounds.get(), true, false, true, false, false); } else { - previewPanel.showImagePanel(swf, swf, f - 1, true, true, !Configuration.animateSubsprites.get(), false, !Configuration.playFrameSounds.get(), true, false, true, false); + previewPanel.showImagePanel(swf, swf, f - 1, true, true, !Configuration.animateSubsprites.get(), false, !Configuration.playFrameSounds.get(), true, false, true, false, false); } } else { previewPanel.showEmpty(); diff --git a/src/com/jpexs/decompiler/flash/gui/action/AddScriptDialog.java b/src/com/jpexs/decompiler/flash/gui/action/AddScriptDialog.java index 2cfee4238..0fbc0f9be 100644 --- a/src/com/jpexs/decompiler/flash/gui/action/AddScriptDialog.java +++ b/src/com/jpexs/decompiler/flash/gui/action/AddScriptDialog.java @@ -732,22 +732,22 @@ public class AddScriptDialog extends AppDialog { int f = ((MyFrame) ((MyTreeNode) tnode.getParent()).getData()).frame; Object parent = ((MyTreeNode) tnode.getParent().getParent()).getData(); if (parent instanceof DefineSpriteTag) { - instancePreviewPanel.showImagePanel((DefineSpriteTag) parent, swf, f - 1, true, Configuration.autoPlayPreviews.get(), !Configuration.animateSubsprites.get(), false, !Configuration.playFrameSounds.get(), true, false, true, false); + instancePreviewPanel.showImagePanel((DefineSpriteTag) parent, swf, f - 1, true, Configuration.autoPlayPreviews.get(), !Configuration.animateSubsprites.get(), false, !Configuration.playFrameSounds.get(), true, false, true, false, false); } else { - instancePreviewPanel.showImagePanel(swf, swf, f - 1, true, Configuration.autoPlayPreviews.get(), !Configuration.animateSubsprites.get(), false, !Configuration.playFrameSounds.get(), true, false, true, false); + instancePreviewPanel.showImagePanel(swf, swf, f - 1, true, Configuration.autoPlayPreviews.get(), !Configuration.animateSubsprites.get(), false, !Configuration.playFrameSounds.get(), true, false, true, false, false); } } else if (tnode.getData() instanceof DefineSpriteTag) { instancePreviewPanel.selectImageDepth(-1); - instancePreviewPanel.showImagePanel((DefineSpriteTag) tnode.getData(), swf, -1, true, Configuration.autoPlayPreviews.get(), !Configuration.animateSubsprites.get(), false, !Configuration.playFrameSounds.get(), true, false, true, false); + instancePreviewPanel.showImagePanel((DefineSpriteTag) tnode.getData(), swf, -1, true, Configuration.autoPlayPreviews.get(), !Configuration.animateSubsprites.get(), false, !Configuration.playFrameSounds.get(), true, false, true, false, false); } else if (tnode.getData() instanceof MyFrame) { instancePreviewPanel.selectImageDepth(-1); int f = ((MyFrame) tnode.getData()).frame; Object parent = ((MyTreeNode) tnode.getParent()).getData(); if (parent instanceof DefineSpriteTag) { - instancePreviewPanel.showImagePanel((DefineSpriteTag) parent, swf, f - 1, true, Configuration.autoPlayPreviews.get(), !Configuration.animateSubsprites.get(), false, !Configuration.playFrameSounds.get(), true, false, true, false); + instancePreviewPanel.showImagePanel((DefineSpriteTag) parent, swf, f - 1, true, Configuration.autoPlayPreviews.get(), !Configuration.animateSubsprites.get(), false, !Configuration.playFrameSounds.get(), true, false, true, false, false); } else { - instancePreviewPanel.showImagePanel(swf, swf, f - 1, true, Configuration.autoPlayPreviews.get(), !Configuration.animateSubsprites.get(), false, !Configuration.playFrameSounds.get(), true, false, true, false); + instancePreviewPanel.showImagePanel(swf, swf, f - 1, true, Configuration.autoPlayPreviews.get(), !Configuration.animateSubsprites.get(), false, !Configuration.playFrameSounds.get(), true, false, true, false, false); } } checkEnabled(); @@ -761,7 +761,7 @@ public class AddScriptDialog extends AppDialog { checkEnabled(); return; } - spriteInitPreviewPanel.showImagePanel(spriteInitList.getSelectedValue(), swf, -1, true, Configuration.autoPlayPreviews.get(), !Configuration.animateSubsprites.get(), false, !Configuration.playFrameSounds.get(), true, false, true, false); + spriteInitPreviewPanel.showImagePanel(spriteInitList.getSelectedValue(), swf, -1, true, Configuration.autoPlayPreviews.get(), !Configuration.animateSubsprites.get(), false, !Configuration.playFrameSounds.get(), true, false, true, false, false); checkEnabled(); } @@ -773,7 +773,7 @@ public class AddScriptDialog extends AppDialog { checkEnabled(); return; } - framePreviewPanel.showImagePanel(swf, swf, selectedIndex, true, Configuration.autoPlayPreviews.get(), !Configuration.animateSubsprites.get(), false, !Configuration.playFrameSounds.get(), true, false, true, false); + framePreviewPanel.showImagePanel(swf, swf, selectedIndex, true, Configuration.autoPlayPreviews.get(), !Configuration.animateSubsprites.get(), false, !Configuration.playFrameSounds.get(), true, false, true, false, false); int f = selectedIndex + 1; if (!frameTextField.getText().equals("" + f)) { @@ -785,7 +785,7 @@ public class AddScriptDialog extends AppDialog { private void buttonValueChanged(ListSelectionEvent e) { buttonPreviewPanel.showEmpty(); if (buttonList.getSelectedIndex() >= 0) { - buttonPreviewPanel.showImagePanel(TimelinedMaker.makeTimelined(buttonList.getSelectedValue()), swf, -1, true, Configuration.autoPlayPreviews.get(), !Configuration.animateSubsprites.get(), false, !Configuration.playFrameSounds.get(), true, false, true, false); + buttonPreviewPanel.showImagePanel(TimelinedMaker.makeTimelined(buttonList.getSelectedValue()), swf, -1, true, Configuration.autoPlayPreviews.get(), !Configuration.animateSubsprites.get(), false, !Configuration.playFrameSounds.get(), true, false, true, false, false); } checkEnabled(); @@ -801,14 +801,14 @@ public class AddScriptDialog extends AppDialog { } MyTreeNode tnode = (MyTreeNode) selection.getLastPathComponent(); if (tnode.getData() instanceof DefineSpriteTag) { - spriteFramePreviewPanel.showImagePanel((DefineSpriteTag) tnode.getData(), swf, -1, true, Configuration.autoPlayPreviews.get(), !Configuration.animateSubsprites.get(), false, !Configuration.playFrameSounds.get(), true, false, true, false); + spriteFramePreviewPanel.showImagePanel((DefineSpriteTag) tnode.getData(), swf, -1, true, Configuration.autoPlayPreviews.get(), !Configuration.animateSubsprites.get(), false, !Configuration.playFrameSounds.get(), true, false, true, false, false); } else if (tnode.getData() instanceof MyFrame) { int f = ((MyFrame) tnode.getData()).frame; Object parent = ((MyTreeNode) tnode.getParent()).getData(); if (parent instanceof DefineSpriteTag) { - spriteFramePreviewPanel.showImagePanel((DefineSpriteTag) parent, swf, f - 1, true, Configuration.autoPlayPreviews.get(), !Configuration.animateSubsprites.get(), false, !Configuration.playFrameSounds.get(), true, false, true, false); + spriteFramePreviewPanel.showImagePanel((DefineSpriteTag) parent, swf, f - 1, true, Configuration.autoPlayPreviews.get(), !Configuration.animateSubsprites.get(), false, !Configuration.playFrameSounds.get(), true, false, true, false, false); } else { - spriteFramePreviewPanel.showImagePanel(swf, swf, f - 1, true, Configuration.autoPlayPreviews.get(), !Configuration.animateSubsprites.get(), false, !Configuration.playFrameSounds.get(), true, false, true, false); + spriteFramePreviewPanel.showImagePanel(swf, swf, f - 1, true, Configuration.autoPlayPreviews.get(), !Configuration.animateSubsprites.get(), false, !Configuration.playFrameSounds.get(), true, false, true, false, false); } if (!spriteFrameTextField.getText().equals("" + f)) { spriteFrameTextField.setText("" + f); diff --git a/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog.properties b/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog.properties index ae0f02f64..07934e7d3 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog.properties @@ -556,3 +556,6 @@ config.description.lastSolEditorDirectory = Directory where last SOL file was op #after 22.0.2 config.name.halfTransparentParentLayersEasy = Half transparent parent layers in Simple editor config.description.halfTransparentParentLayersEasy = Shows parent layers when editing subMovieClips as half transparent. False = do not show parent layers at all. + +config.name.showRuler = Show ruler +config.description.showRuler = Show ruler when displaying / editing SWF objects. \ No newline at end of file diff --git a/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog_cs.properties b/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog_cs.properties index 775c3618c..95677bfa0 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog_cs.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog_cs.properties @@ -554,3 +554,6 @@ config.description.lastSolEditorDirectory = Adres\u00e1\u0159, kde byl posledn\u #after 22.0.2 config.name.halfTransparentParentLayersEasy = Pr\u016fsvitn\u00e9 nad\u0159azen\u00e9 vrstvy v Simple editoru config.description.halfTransparentParentLayersEasy = Zobraz\u00ed nad\u0159azen\u00e9 vrstvy p\u0159i editaci animovan\u00fdch podklip\u016f pr\u016fsvitn\u011b. Vypnuto = nezobraz\u00ed nad\u0159azen\u00e9 vrstvy v\u016fbec. + +config.name.showRuler = Zobrazit prav\u00edtko +config.description.showRuler = Zobrazit prav\u00edtko p\u0159i zobrazov\u00e1n\u00ed / editaci SWF objekt\u016f. \ No newline at end of file