From a1e28f8e884f3c82edf8faa75fa12177935706fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Thu, 8 May 2025 23:12:47 +0200 Subject: [PATCH] Removed: Option to preview flash items via ActiveX component is no longer available. FFDec now supports its internal flash viewer only. --- CHANGELOG.md | 2 + .../flash/configuration/Configuration.java | 7 + .../configuration/ConfigurationRemoved.java | 32 +++++ .../flash/gui/AdvancedSettingsDialog.java | 2 - src/com/jpexs/decompiler/flash/gui/Main.java | 1 - .../flash/gui/MainFrameClassic.java | 19 +-- .../flash/gui/MainFrameClassicMenu.java | 4 +- .../decompiler/flash/gui/MainFrameMenu.java | 10 +- .../decompiler/flash/gui/MainFrameRibbon.java | 18 +-- .../flash/gui/MainFrameRibbonMenu.java | 4 +- .../jpexs/decompiler/flash/gui/MainPanel.java | 84 +++--------- .../decompiler/flash/gui/PreviewPanel.java | 126 +++--------------- .../flash/gui/SelectFramePositionDialog.java | 2 +- .../flash/gui/SelectTagPositionDialog.java | 2 +- .../flash/gui/action/AddScriptDialog.java | 10 +- 15 files changed, 96 insertions(+), 227 deletions(-) create mode 100644 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/configuration/ConfigurationRemoved.java diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d7843cfb..9712b9b85 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -64,6 +64,8 @@ All notable changes to this project will be documented in this file. - [PR215] ffdec.sh - Ignore all java options when checking version ### Removed +- Option to preview flash items via ActiveX component is no longer available. + FFDec now supports its internal flash viewer only. - Windows installer does not associate SWF files anymore as it caused false positives on some AVs. You can associate them later in FFDec settings. 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 dae789b42..07361c577 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 @@ -112,6 +112,7 @@ public final class Configuration { */ @ConfigurationDefaultBoolean(false) @ConfigurationInternal + @ConfigurationRemoved public static ConfigurationItem useAdobeFlashPlayerForPreviews = null; @ConfigurationDefaultInt(1000) @@ -565,6 +566,7 @@ public final class Configuration { @ConfigurationDefaultBoolean(false) //@ConfigurationCategory("script") + @ConfigurationRemoved public static ConfigurationItem enableScriptInitializerDisplay = null; @ConfigurationDefaultBoolean(false) @@ -788,6 +790,7 @@ public final class Configuration { @ConfigurationDefaultBoolean(false) @ConfigurationCategory("display") + @ConfigurationRemoved public static ConfigurationItem allowMiterClipLinestyle = null; @ConfigurationDefaultBoolean(true) @@ -1554,6 +1557,10 @@ public final class Configuration { Field[] fields = Configuration.class.getDeclaredFields(); Map result = new HashMap<>(); for (Field field : fields) { + ConfigurationRemoved removedAnnotation = field.getAnnotation(ConfigurationRemoved.class); + if (removedAnnotation != null) { + continue; + } if (ConfigurationItem.class.isAssignableFrom(field.getType())) { String name = ConfigurationItem.getName(field); if (lowerCaseNames) { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/configuration/ConfigurationRemoved.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/configuration/ConfigurationRemoved.java new file mode 100644 index 000000000..59f4c2895 --- /dev/null +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/configuration/ConfigurationRemoved.java @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2010-2024 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.configuration; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Configuration removed annotation. + * + * @author JPEXS + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.FIELD) +public @interface ConfigurationRemoved { +} diff --git a/src/com/jpexs/decompiler/flash/gui/AdvancedSettingsDialog.java b/src/com/jpexs/decompiler/flash/gui/AdvancedSettingsDialog.java index 19dd0cd2e..58e83ee91 100644 --- a/src/com/jpexs/decompiler/flash/gui/AdvancedSettingsDialog.java +++ b/src/com/jpexs/decompiler/flash/gui/AdvancedSettingsDialog.java @@ -21,7 +21,6 @@ import com.jpexs.decompiler.flash.configuration.ConfigurationCategory; import com.jpexs.decompiler.flash.configuration.ConfigurationDirectory; import com.jpexs.decompiler.flash.configuration.ConfigurationFile; import com.jpexs.decompiler.flash.configuration.ConfigurationItem; -import com.jpexs.decompiler.flash.gui.helpers.SpringUtilities; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; @@ -68,7 +67,6 @@ import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JTabbedPane; import javax.swing.JTextField; -import javax.swing.SpringLayout; import javax.swing.UIManager; import javax.swing.WindowConstants; import javax.swing.table.DefaultTableModel; diff --git a/src/com/jpexs/decompiler/flash/gui/Main.java b/src/com/jpexs/decompiler/flash/gui/Main.java index 2944a0142..41eb10489 100644 --- a/src/com/jpexs/decompiler/flash/gui/Main.java +++ b/src/com/jpexs/decompiler/flash/gui/Main.java @@ -3284,7 +3284,6 @@ public class Main { } Configuration.saveConfig(); if (mainFrame != null && mainFrame.getPanel() != null) { - mainFrame.getPanel().unloadFlashPlayer(); mainFrame.dispose(); } if (fileTxt != null) { diff --git a/src/com/jpexs/decompiler/flash/gui/MainFrameClassic.java b/src/com/jpexs/decompiler/flash/gui/MainFrameClassic.java index 3fe6a78eb..8738bfa7d 100644 --- a/src/com/jpexs/decompiler/flash/gui/MainFrameClassic.java +++ b/src/com/jpexs/decompiler/flash/gui/MainFrameClassic.java @@ -43,25 +43,12 @@ public final class MainFrameClassic extends AppFrame implements MainFrame { private final MainFrameMenu mainMenu; public MainFrameClassic() { - super(); + super(); - FlashPlayerPanel flashPanel = null; - FlashPlayerPanel flashPanel2 = null; - - if (Configuration.useAdobeFlashPlayerForPreviews.get()) { - try { - flashPanel = new FlashPlayerPanel(this); - flashPanel2 = new FlashPlayerPanel(this); - } catch (FlashUnsupportedException fue) { - //ignored - } - } - - boolean externalFlashPlayerUnavailable = flashPanel == null; - mainMenu = new MainFrameClassicMenu(this, externalFlashPlayerUnavailable); + mainMenu = new MainFrameClassicMenu(this); mainMenu.createMenuBar(); - panel = new MainPanel(this, mainMenu, flashPanel, flashPanel2); + panel = new MainPanel(this, mainMenu); int w = Configuration.guiWindowWidth.get(); int h = Configuration.guiWindowHeight.get(); diff --git a/src/com/jpexs/decompiler/flash/gui/MainFrameClassicMenu.java b/src/com/jpexs/decompiler/flash/gui/MainFrameClassicMenu.java index fac106a30..ede0e6107 100644 --- a/src/com/jpexs/decompiler/flash/gui/MainFrameClassicMenu.java +++ b/src/com/jpexs/decompiler/flash/gui/MainFrameClassicMenu.java @@ -47,8 +47,8 @@ public class MainFrameClassicMenu extends MainFrameMenu { private final Map menuButtonGroups = new HashMap<>(); - public MainFrameClassicMenu(MainFrameClassic mainFrame, boolean externalFlashPlayerUnavailable) { - super(mainFrame, externalFlashPlayerUnavailable); + public MainFrameClassicMenu(MainFrameClassic mainFrame) { + super(mainFrame); this.mainFrame = mainFrame; } diff --git a/src/com/jpexs/decompiler/flash/gui/MainFrameMenu.java b/src/com/jpexs/decompiler/flash/gui/MainFrameMenu.java index 1bf03bb3f..ea1dcc346 100644 --- a/src/com/jpexs/decompiler/flash/gui/MainFrameMenu.java +++ b/src/com/jpexs/decompiler/flash/gui/MainFrameMenu.java @@ -112,16 +112,10 @@ public abstract class MainFrameMenu implements MenuBuilder { } protected final Map menuActions = new HashMap<>(); - - /*public boolean isInternalFlashViewerSelected() { - return isMenuChecked("/settings/internalViewer"); //miInternalViewer.isSelected(); - }*/ - private final boolean externalFlashPlayerUnavailable; - - public MainFrameMenu(MainFrame mainFrame, boolean externalFlashPlayerUnavailable) { + + public MainFrameMenu(MainFrame mainFrame) { registerHotKeys(); this.mainFrame = mainFrame; - this.externalFlashPlayerUnavailable = externalFlashPlayerUnavailable; } protected String translate(String key) { diff --git a/src/com/jpexs/decompiler/flash/gui/MainFrameRibbon.java b/src/com/jpexs/decompiler/flash/gui/MainFrameRibbon.java index 7a120f7be..8a2f9fb8c 100644 --- a/src/com/jpexs/decompiler/flash/gui/MainFrameRibbon.java +++ b/src/com/jpexs/decompiler/flash/gui/MainFrameRibbon.java @@ -54,29 +54,17 @@ public final class MainFrameRibbon extends AppRibbonFrame { public MainFrameRibbon() { super(); - - FlashPlayerPanel flashPanel = null; - FlashPlayerPanel flashPanel2 = null; - - if (Configuration.useAdobeFlashPlayerForPreviews.get()) { - try { - flashPanel = new FlashPlayerPanel(this); - flashPanel2 = new FlashPlayerPanel(this); - } catch (FlashUnsupportedException fue) { - //ignored - } - } + Container cnt = getContentPane(); cnt.setLayout(new BorderLayout()); JRibbon ribbon = getRibbon(); cnt.add(ribbon, BorderLayout.NORTH); - boolean externalFlashPlayerUnavailable = flashPanel == null; - mainMenu = new MainFrameRibbonMenu(this, ribbon, externalFlashPlayerUnavailable); + mainMenu = new MainFrameRibbonMenu(this, ribbon); mainMenu.createMenuBar(); - panel = new MainPanel(this, mainMenu, flashPanel, flashPanel2); + panel = new MainPanel(this, mainMenu); panel.setBackground(Color.yellow); cnt.add(panel, BorderLayout.CENTER); diff --git a/src/com/jpexs/decompiler/flash/gui/MainFrameRibbonMenu.java b/src/com/jpexs/decompiler/flash/gui/MainFrameRibbonMenu.java index 60de6c804..2cca417d7 100644 --- a/src/com/jpexs/decompiler/flash/gui/MainFrameRibbonMenu.java +++ b/src/com/jpexs/decompiler/flash/gui/MainFrameRibbonMenu.java @@ -102,8 +102,8 @@ public class MainFrameRibbonMenu extends MainFrameMenu { private final Map optionalGroups = new HashMap<>(); - public MainFrameRibbonMenu(MainFrameRibbon mainFrame, JRibbon ribbon, boolean externalFlashPlayerUnavailable) { - super(mainFrame, externalFlashPlayerUnavailable); + public MainFrameRibbonMenu(MainFrameRibbon mainFrame, JRibbon ribbon) { + super(mainFrame); this.ribbon = ribbon; } diff --git a/src/com/jpexs/decompiler/flash/gui/MainPanel.java b/src/com/jpexs/decompiler/flash/gui/MainPanel.java index 3f5e794d9..c5f98700c 100644 --- a/src/com/jpexs/decompiler/flash/gui/MainPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/MainPanel.java @@ -342,11 +342,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se private ClipboardPanel resourcesClipboardPanel; private ClipboardPanel tagListClipboardPanel; - - private final FlashPlayerPanel flashPanel; - - private final FlashPlayerPanel flashPanel2; - + private final JPanel contentPanel; private final JPanel displayPanel; @@ -1091,13 +1087,11 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se return mainFrame.translate(key); } - public MainPanel(MainFrame mainFrame, MainFrameMenu mainMenu, FlashPlayerPanel flashPanel, FlashPlayerPanel previewFlashPanel) { + public MainPanel(MainFrame mainFrame, MainFrameMenu mainMenu) { super(); this.mainFrame = mainFrame; this.mainMenu = mainMenu; - this.flashPanel = flashPanel; - this.flashPanel2 = previewFlashPanel; mainFrame.setTitle(ApplicationInfo.applicationVerName); @@ -1260,9 +1254,9 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se displayPanel = new JPanel(new CardLayout()); DefaultSyntaxKit.initKit(); - previewPanel = new PreviewPanel(this, flashPanel); + previewPanel = new PreviewPanel(this); - dumpPreviewPanel = new PreviewPanel(this, previewFlashPanel); + dumpPreviewPanel = new PreviewPanel(this); dumpPreviewPanel.setReadOnly(true); displayPanel.add(previewPanel, CARDPREVIEWPANEL); @@ -5547,24 +5541,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se } } return null; - } - - public void unloadFlashPlayer() { - if (flashPanel != null) { - try { - flashPanel.close(); - } catch (IOException ex) { - // ignore - } - } - if (flashPanel2 != null) { - try { - flashPanel2.close(); - } catch (IOException ex) { - // ignore - } - } - } + } public void clearDebuggerColors() { if (abcPanel != null) { @@ -5575,24 +5552,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se actionPanel.decompiledEditor.removeColorMarkerOnAllLines(DecompiledEditorPane.IP_MARKER); actionPanel.editor.removeColorMarkerOnAllLines(DecompiledEditorPane.IP_MARKER); } - } - - private void stopFlashPlayer() { - if (flashPanel != null) { - if (!flashPanel.isStopped()) { - flashPanel.stopSWF(); - } - } - if (flashPanel2 != null) { - if (!flashPanel2.isStopped()) { - flashPanel2.stopSWF(); - } - } - } - - public static boolean isAdobeFlashPlayerEnabled() { - return Configuration.useAdobeFlashPlayerForPreviews.get(); - } + } public static final int VIEW_RESOURCES = 0; @@ -5845,19 +5805,12 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se previewPanel.showEmpty(); return; } - boolean internalViewer = !isAdobeFlashPlayerEnabled(); boolean isVideoButNotDrawable = (treeItem instanceof DefineVideoStreamTag) && (!DefineVideoStreamTag.displayAvailable()); 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, true); - } else { - previewPanel.setParametersPanelVisible(false); - previewPanel.showFlashViewerPanel(); - previewPanel.showSwf(swf); - } + 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 if ((treeItem instanceof PlaceObjectTypeTag)) { previewPanel.showDisplayEditTagPanel((PlaceObjectTypeTag) treeItem, frame); } else if (treeItem instanceof ShapeTag) { @@ -5885,7 +5838,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se 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, true); - } else if (!isVideoButNotDrawable && (treeItem instanceof DrawableTag) && (!(treeItem instanceof TextTag)) && (!(treeItem instanceof FontTag)) && internalViewer) { + } else if (!isVideoButNotDrawable && (treeItem instanceof DrawableTag) && (!(treeItem instanceof TextTag)) && (!(treeItem instanceof FontTag))) { final Tag tag = (Tag) treeItem; DrawableTag d = (DrawableTag) tag; Timelined timelined; @@ -5906,7 +5859,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se 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, true); - } else if (treeItem instanceof Frame && internalViewer) { + } else if (treeItem instanceof Frame) { 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, true); @@ -5932,9 +5885,9 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se logger.log(Level.SEVERE, null, ex); } } - } else if ((treeItem instanceof FontTag) && internalViewer) { + } else if ((treeItem instanceof FontTag)) { previewPanel.showFontPanel((FontTag) treeItem); - } else if ((treeItem instanceof TextTag) && internalViewer) { + } else if ((treeItem instanceof TextTag)) { previewPanel.showTextPanel((TextTag) treeItem); } else if ((!(treeItem instanceof DefineFont4Tag)) && ((treeItem instanceof Frame) || (treeItem instanceof CharacterTag) || (treeItem instanceof FontTag) || (treeItem instanceof SoundStreamHeadTypeTag))) { previewPanel.createAndShowTempSwf(treeItem); @@ -6156,12 +6109,9 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se folderPreviewPanel.clear(); folderListPanel.clear(); previewPanel.clear(); - stopFlashPlayer(); previewPanel.setImageReplaceButtonVisible(false, false, false, false, false, false, false); - boolean internalViewer = !isAdobeFlashPlayerEnabled(); - Frame frameTreeItem = null; if (treeItem instanceof Frame) { frameTreeItem = (Frame) treeItem; @@ -6297,22 +6247,22 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se } else if (treeItem instanceof ImageTag) { showPreview(treeItem, previewPanel, -1, null); showCard(CARDPREVIEWPANEL); - } else if ((treeItem instanceof DrawableTag) && (!(treeItem instanceof TextTag)) && (!(treeItem instanceof FontTag)) && internalViewer) { + } else if ((treeItem instanceof DrawableTag) && (!(treeItem instanceof TextTag)) && (!(treeItem instanceof FontTag))) { showPreview(treeItem, previewPanel, -1, null); showCard(CARDPREVIEWPANEL); - } else if ((treeItem instanceof FontTag) && internalViewer) { + } else if (treeItem instanceof FontTag) { showPreview(treeItem, previewPanel, -1, null); showCard(CARDPREVIEWPANEL); - } else if ((treeItem instanceof TextTag) && internalViewer) { + } else if (treeItem instanceof TextTag) { showPreview(treeItem, previewPanel, -1, null); showCard(CARDPREVIEWPANEL); - } else if (frameTreeItem != null && internalViewer) { + } else if (frameTreeItem != null) { showPreview(frameTreeItem, previewPanel, -1, null); showCard(CARDPREVIEWPANEL); - } else if (treeItem instanceof ShowFrameTag && internalViewer) { + } else if (treeItem instanceof ShowFrameTag) { showPreview(treeItem, previewPanel, getFrameForTreeItem(treeItem), getTimelinedForTreeItem(treeItem)); showCard(CARDPREVIEWPANEL); - } else if ((treeItem instanceof SoundTag)) { //&& isInternalFlashViewerSelected() && (Arrays.asList("mp3", "wav").contains(((SoundTag) tagObj).getExportFormat())))) { + } else if ((treeItem instanceof SoundTag)) { showPreview(treeItem, previewPanel, -1, null); showCard(CARDPREVIEWPANEL); } else if (frameTreeItem != null) { diff --git a/src/com/jpexs/decompiler/flash/gui/PreviewPanel.java b/src/com/jpexs/decompiler/flash/gui/PreviewPanel.java index 5a471795c..818a53e47 100644 --- a/src/com/jpexs/decompiler/flash/gui/PreviewPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/PreviewPanel.java @@ -182,8 +182,6 @@ public class PreviewPanel extends JPersistentSplitPane implements TagEditorPanel private final JPanel viewerCards; - private final FlashPlayerPanel flashPanel; - private File tempFile; private ImagePanel imagePanel; @@ -355,15 +353,14 @@ public class PreviewPanel extends JPersistentSplitPane implements TagEditorPanel } } - public PreviewPanel(MainPanel mainPanel, FlashPlayerPanel flashPanel) { + public PreviewPanel(MainPanel mainPanel) { super(JSplitPane.HORIZONTAL_SPLIT, Configuration.guiPreviewSplitPaneDividerLocationPercent); this.mainPanel = mainPanel; - this.flashPanel = flashPanel; viewerCards = new JPanel(); viewerCards.setLayout(new CardLayout()); - viewerCards.add(createFlashPlayerPanel(flashPanel), FLASH_VIEWER_CARD); + viewerCards.add(createFlashPlayerPanel(), FLASH_VIEWER_CARD); viewerCards.add(createImagesCard(), DRAW_PREVIEW_CARD); viewerCards.add(createBinaryCard(), BINARY_TAG_CARD); viewerCards.add(createProductInfoCard(), PRODUCTINFO_TAG_CARD); @@ -560,52 +557,23 @@ public class PreviewPanel extends JPersistentSplitPane implements TagEditorPanel return metadataTagButtonsPanel; } - private JPanel createFlashPlayerPanel(FlashPlayerPanel flashPanel) { + private JPanel createFlashPlayerPanel() { JPanel pan = new JPanel(new BorderLayout()); JLabel prevLabel = new HeaderLabel(mainPanel.translate("swfpreview")); prevLabel.setHorizontalAlignment(SwingConstants.CENTER); - //prevLabel.setBorder(new BevelBorder(BevelBorder.RAISED)); - + pan.add(prevLabel, BorderLayout.NORTH); + JPanel swtPanel = new JPanel(new GridBagLayout()); + JPanel buttonsPanel = new JPanel(new FlowLayout()); + JButton flashProjectorButton = new JButton(mainPanel.translate("button.showin.flashprojector")); + flashProjectorButton.addActionListener(this::flashProjectorActionPerformed); + buttonsPanel.add(flashProjectorButton); + GridBagConstraints gbc = new GridBagConstraints(); + gbc.anchor = GridBagConstraints.CENTER; + gbc.fill = GridBagConstraints.HORIZONTAL; + swtPanel.add(buttonsPanel, gbc); - Component leftComponent; - if (flashPanel != null) { - JPanel flashPlayPanel = new JPanel(new BorderLayout()); - flashPlayPanel.add(flashPanel, BorderLayout.CENTER); - - JPanel flashPlayPanel2 = new JPanel(new BorderLayout()); - flashPlayPanel2.add(flashPlayPanel, BorderLayout.CENTER); - flashPlayPanel2.add(new PlayerControls(mainPanel, flashPanel, null), BorderLayout.SOUTH); - leftComponent = flashPlayPanel2; - } else { - JPanel swtPanel = new JPanel(new GridBagLayout()); - /*String labelStr = ""; - if (!Platform.isWindows()) { - labelStr = mainPanel.translate("notavailonthisplatform"); - } else { - if (Configuration.useAdobeFlashPlayerForPreviews.get()) { - labelStr = mainPanel.translate("notavailable.activex") + "\n" + mainPanel.translate("notavailable.activex.disable"); - } else { - labelStr = mainPanel.translate("notavailable.internalviewer"); - } - } - String htmlLabelStr = "
" + labelStr.replace("\n", "
") + "
"; - swtPanel.add(new JLabel(htmlLabelStr, JLabel.CENTER), BorderLayout.CENTER); - swtPanel.setBackground(View.getDefaultBackgroundColor());*/ - - JPanel buttonsPanel = new JPanel(new FlowLayout()); - JButton flashProjectorButton = new JButton(mainPanel.translate("button.showin.flashprojector")); - flashProjectorButton.addActionListener(this::flashProjectorActionPerformed); - buttonsPanel.add(flashProjectorButton); - GridBagConstraints gbc = new GridBagConstraints(); - gbc.anchor = GridBagConstraints.CENTER; - gbc.fill = GridBagConstraints.HORIZONTAL; - swtPanel.add(buttonsPanel, gbc); - - leftComponent = swtPanel; - } - - pan.add(leftComponent, BorderLayout.CENTER); + pan.add(swtPanel, BorderLayout.CENTER); return pan; } @@ -1805,9 +1773,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, false); - } + showImagePanel(TimelinedMaker.makeTimelined(fontTag), fontTag.getSwf(), fontPageNum, true, true, true, true, true, false, false, false, true, false); } public static int getFontPageCount(FontTag fontTag) { @@ -1824,9 +1790,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, true); - } + showImagePanel(TimelinedMaker.makeTimelined(textTag), textTag.getSwf(), 0, true, true, true, true, true, false, false, true, true, true); showCardRight(CARDTEXTPANEL); if (!readOnly) { @@ -2219,61 +2183,13 @@ public class PreviewPanel extends JPersistentSplitPane implements TagEditorPanel header = new PreviewExporter().exportSwf(fos, treeItem, backgroundColor, fontPageNum, false); } - if (flashPanel != null) { - flashPanel.displaySWF(tempFile.getAbsolutePath(), backgroundColor, header.frameRate); - } - this.currentItem = treeItem; showFlashViewerPanel(); } catch (IOException | ActionParseException ex) { Logger.getLogger(PreviewPanel.class.getName()).log(Level.SEVERE, null, ex); } - } - - public void showSwf(SWF swf) { - currentItem = swf; - if (flashPanel == null) { - return; - } - Color backgroundColor = View.getDefaultBackgroundColor(); - SetBackgroundColorTag setBgColorTag = swf.getBackgroundColor(); - if (setBgColorTag != null) { - backgroundColor = setBgColorTag.backgroundColor.toColor(); - } - - if (tempFile != null) { - tempFile.delete(); - } - try { - tempFile = File.createTempFile("ffdec_view_", ".swf"); - SWF savedSWF = swf; - if (swf.gfx) { - savedSWF = new GfxConvertor().convertSwf(swf); - } - try (OutputStream fos = new BufferedOutputStream(new FileOutputStream(tempFile))) { - swf.saveTo(fos, false, swf.gfx); - } - //Inject Loader - if (swf.isAS3() && Configuration.autoOpenLoadedSWFs.get() && Configuration.useAdobeFlashPlayerForPreviews.get() && !DebuggerTools.hasDebugger(swf)) { - SWF instrSWF; - try (InputStream fis = new BufferedInputStream(new FileInputStream(tempFile))) { - instrSWF = new SWF(fis, false, false); - } - - DebuggerTools.switchDebugger(instrSWF); - DebuggerTools.injectDebugLoader(instrSWF); - try (OutputStream fos = new BufferedOutputStream(new FileOutputStream(tempFile))) { - instrSWF.saveTo(fos); - } - } - flashPanel.displaySWF(tempFile.getAbsolutePath(), backgroundColor, swf.frameRate); - } catch (IOException iex) { - Logger.getLogger(PreviewPanel.class.getName()).log(Level.SEVERE, "Cannot create tempfile", iex); - } catch (InterruptedException ex) { - //ignored - } - } + } private void editMetadataButtonActionPerformed(ActionEvent evt) { TreeItem item = mainPanel.getCurrentTree().getCurrentTreeItem(); @@ -3298,18 +3214,14 @@ public class PreviewPanel extends JPersistentSplitPane implements TagEditorPanel FontTag fontTag = fontPanel.getFontTag(); 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, false); - } + imagePanel.setTimelined(TimelinedMaker.makeTimelined(fontTag, fontPageNum), fontTag.getSwf(), 0, true, true, true, true, true, false, false, true, false); } private void nextFontsButtonActionPerformed(ActionEvent evt) { FontTag fontTag = fontPanel.getFontTag(); 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, false); - } + imagePanel.setTimelined(TimelinedMaker.makeTimelined(fontTag, fontPageNum), fontTag.getSwf(), 0, true, true, true, true, true, false, false, true, false); } @Override diff --git a/src/com/jpexs/decompiler/flash/gui/SelectFramePositionDialog.java b/src/com/jpexs/decompiler/flash/gui/SelectFramePositionDialog.java index 9c80cf9f8..9fe285f54 100644 --- a/src/com/jpexs/decompiler/flash/gui/SelectFramePositionDialog.java +++ b/src/com/jpexs/decompiler/flash/gui/SelectFramePositionDialog.java @@ -419,7 +419,7 @@ public class SelectFramePositionDialog extends AppDialog { positionTree.addTreeSelectionListener(this::positionTreeValueChanged); positionTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); - previewPanel = new PreviewPanel(Main.getMainFrame().getPanel(), null); + previewPanel = new PreviewPanel(Main.getMainFrame().getPanel()); previewPanel.setReadOnly(true); previewPanel.setPreferredSize(new Dimension(300, 1)); previewPanel.showEmpty(); diff --git a/src/com/jpexs/decompiler/flash/gui/SelectTagPositionDialog.java b/src/com/jpexs/decompiler/flash/gui/SelectTagPositionDialog.java index 25b5f520b..7edd35bb3 100644 --- a/src/com/jpexs/decompiler/flash/gui/SelectTagPositionDialog.java +++ b/src/com/jpexs/decompiler/flash/gui/SelectTagPositionDialog.java @@ -416,7 +416,7 @@ public class SelectTagPositionDialog extends AppDialog { positionTree.addTreeSelectionListener(this::positionTreeValueChanged); positionTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); - previewPanel = new PreviewPanel(Main.getMainFrame().getPanel(), null); + previewPanel = new PreviewPanel(Main.getMainFrame().getPanel()); previewPanel.setReadOnly(true); previewPanel.setPreferredSize(new Dimension(300, 1)); 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 0fbc0f9be..3fe36535b 100644 --- a/src/com/jpexs/decompiler/flash/gui/action/AddScriptDialog.java +++ b/src/com/jpexs/decompiler/flash/gui/action/AddScriptDialog.java @@ -262,7 +262,7 @@ public class AddScriptDialog extends AppDialog { frameList.addListSelectionListener(this::frameValueChanged); frameList.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - framePreviewPanel = new PreviewPanel(Main.getMainFrame().getPanel(), null); + framePreviewPanel = new PreviewPanel(Main.getMainFrame().getPanel()); framePreviewPanel.setReadOnly(true); framePreviewPanel.setPreferredSize(new Dimension(300, 1)); framePreviewPanel.showEmpty(); @@ -312,7 +312,7 @@ public class AddScriptDialog extends AppDialog { private JPanel createSpriteInitPanel() { - spriteInitPreviewPanel = new PreviewPanel(Main.getMainFrame().getPanel(), null); + spriteInitPreviewPanel = new PreviewPanel(Main.getMainFrame().getPanel()); spriteInitPreviewPanel.setReadOnly(true); spriteInitPreviewPanel.setPreferredSize(new Dimension(300, 1)); spriteInitPreviewPanel.showEmpty(); @@ -436,7 +436,7 @@ public class AddScriptDialog extends AppDialog { spriteFramePanel.add(spriteFrameTopPanel, BorderLayout.NORTH); - spriteFramePreviewPanel = new PreviewPanel(Main.getMainFrame().getPanel(), null); + spriteFramePreviewPanel = new PreviewPanel(Main.getMainFrame().getPanel()); spriteFramePreviewPanel.setReadOnly(true); spriteFramePreviewPanel.setPreferredSize(new Dimension(300, 1)); spriteFramePreviewPanel.showEmpty(); @@ -475,7 +475,7 @@ public class AddScriptDialog extends AppDialog { buttonList.addListSelectionListener(this::buttonValueChanged); buttonList.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - buttonPreviewPanel = new PreviewPanel(Main.getMainFrame().getPanel(), null); + buttonPreviewPanel = new PreviewPanel(Main.getMainFrame().getPanel()); buttonPreviewPanel.setReadOnly(true); buttonPreviewPanel.setPreferredSize(new Dimension(300, 1)); buttonPreviewPanel.showEmpty(); @@ -664,7 +664,7 @@ public class AddScriptDialog extends AppDialog { instanceTree.setBackground(Color.white); } - instancePreviewPanel = new PreviewPanel(Main.getMainFrame().getPanel(), null); + instancePreviewPanel = new PreviewPanel(Main.getMainFrame().getPanel()); instancePreviewPanel.setReadOnly(true); instancePreviewPanel.setPreferredSize(new Dimension(300, 1)); instancePreviewPanel.showEmpty();