Removed: Option to preview flash items via ActiveX component is no longer available. FFDec now supports its internal flash viewer only.

This commit is contained in:
Jindra Petřík
2025-05-08 23:12:47 +02:00
parent 1971fe9753
commit a1e28f8e88
15 changed files with 96 additions and 227 deletions

View File

@@ -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.

View File

@@ -112,6 +112,7 @@ public final class Configuration {
*/
@ConfigurationDefaultBoolean(false)
@ConfigurationInternal
@ConfigurationRemoved
public static ConfigurationItem<Boolean> useAdobeFlashPlayerForPreviews = null;
@ConfigurationDefaultInt(1000)
@@ -565,6 +566,7 @@ public final class Configuration {
@ConfigurationDefaultBoolean(false)
//@ConfigurationCategory("script")
@ConfigurationRemoved
public static ConfigurationItem<Boolean> enableScriptInitializerDisplay = null;
@ConfigurationDefaultBoolean(false)
@@ -788,6 +790,7 @@ public final class Configuration {
@ConfigurationDefaultBoolean(false)
@ConfigurationCategory("display")
@ConfigurationRemoved
public static ConfigurationItem<Boolean> allowMiterClipLinestyle = null;
@ConfigurationDefaultBoolean(true)
@@ -1554,6 +1557,10 @@ public final class Configuration {
Field[] fields = Configuration.class.getDeclaredFields();
Map<String, Field> 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) {

View File

@@ -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 {
}

View File

@@ -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;

View File

@@ -3284,7 +3284,6 @@ public class Main {
}
Configuration.saveConfig();
if (mainFrame != null && mainFrame.getPanel() != null) {
mainFrame.getPanel().unloadFlashPlayer();
mainFrame.dispose();
}
if (fileTxt != null) {

View File

@@ -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();

View File

@@ -47,8 +47,8 @@ public class MainFrameClassicMenu extends MainFrameMenu {
private final Map<String, ButtonGroup> menuButtonGroups = new HashMap<>();
public MainFrameClassicMenu(MainFrameClassic mainFrame, boolean externalFlashPlayerUnavailable) {
super(mainFrame, externalFlashPlayerUnavailable);
public MainFrameClassicMenu(MainFrameClassic mainFrame) {
super(mainFrame);
this.mainFrame = mainFrame;
}

View File

@@ -112,16 +112,10 @@ public abstract class MainFrameMenu implements MenuBuilder {
}
protected final Map<String, ActionListener> 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) {

View File

@@ -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);

View File

@@ -102,8 +102,8 @@ public class MainFrameRibbonMenu extends MainFrameMenu {
private final Map<String, RibbonContextualTaskGroup> 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;
}

View File

@@ -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) {

View File

@@ -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 = "<html><center>" + labelStr.replace("\n", "<br>") + "</center></html>";
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

View File

@@ -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();

View File

@@ -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();

View File

@@ -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();