From f5ec76125d9eb21adaa9587af8a10c5a404c9a20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Sun, 13 Oct 2024 19:38:04 +0200 Subject: [PATCH] Save last selected Easy mode SWF --- .../decompiler/flash/configuration/Configuration.java | 4 +++- src/com/jpexs/decompiler/flash/gui/Main.java | 10 ++++++++++ .../jpexs/decompiler/flash/gui/MainFrameRibbon.java | 8 ++++++++ src/com/jpexs/decompiler/flash/gui/MainPanel.java | 4 ++++ .../gui/locales/AdvancedSettingsDialog.properties | 5 ++++- 5 files changed, 29 insertions(+), 2 deletions(-) diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/configuration/Configuration.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/configuration/Configuration.java index a47d62473..82457276e 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 @@ -1038,7 +1038,9 @@ public final class Configuration { @ConfigurationName("gui.splitPaneEasyHorizontal.dividerLocationPercent") @ConfigurationInternal public static ConfigurationItem guiSplitPaneEasyHorizontaldividerLocationPercent = null; - + + public static ConfigurationItem lastSessionEasySwf = null; + private enum OSId { WINDOWS, OSX, UNIX } diff --git a/src/com/jpexs/decompiler/flash/gui/Main.java b/src/com/jpexs/decompiler/flash/gui/Main.java index 73a0c5292..4c1854c3d 100644 --- a/src/com/jpexs/decompiler/flash/gui/Main.java +++ b/src/com/jpexs/decompiler/flash/gui/Main.java @@ -3013,6 +3013,16 @@ public class Main { openFile(sourceInfos, (Openable openable) -> { mainFrame.getPanel().tagTree.setSelectionPathString(Configuration.lastSessionSelection.get()); mainFrame.getPanel().tagListTree.setSelectionPathString(Configuration.lastSessionTagListSelection.get()); + + Set allSwfs = mainFrame.getPanel().getAllSwfs(); + + for (SWF s : allSwfs) { + String name = s.getFile() + "|" + s.getFileTitle(); + if (name.equals(Configuration.lastSessionEasySwf.get())) { + mainFrame.getPanel().getEasyPanel().setSwf(s); + } + } + setSessionLoaded(true); mainFrame.getPanel().reload(true); mainFrame.getPanel().updateUiWithCurrentOpenable(); diff --git a/src/com/jpexs/decompiler/flash/gui/MainFrameRibbon.java b/src/com/jpexs/decompiler/flash/gui/MainFrameRibbon.java index 7f4ea4458..dfd6dd846 100644 --- a/src/com/jpexs/decompiler/flash/gui/MainFrameRibbon.java +++ b/src/com/jpexs/decompiler/flash/gui/MainFrameRibbon.java @@ -16,6 +16,7 @@ */ package com.jpexs.decompiler.flash.gui; +import com.jpexs.decompiler.flash.SWF; import com.jpexs.decompiler.flash.configuration.Configuration; import com.jpexs.decompiler.flash.gui.player.FlashPlayerPanel; import com.jpexs.decompiler.flash.treeitems.OpenableList; @@ -155,6 +156,13 @@ public final class MainFrameRibbon extends AppRibbonFrame { Configuration.lastSessionFiles.set(sb.toString()); Configuration.lastSessionFileTitles.set(sbt.toString()); + SWF easySwf = panel.getEasyPanel().getSwf(); + if (easySwf != null) { + Configuration.lastSessionEasySwf.set(easySwf.getFile()+ "|" + easySwf.getFileTitle()); + } else { + Configuration.lastSessionEasySwf.set(""); + } + String pathResources = panel.tagTree.getSelectionPathString(); if (pathResources != null) { Configuration.lastSessionSelection.set(pathResources); diff --git a/src/com/jpexs/decompiler/flash/gui/MainPanel.java b/src/com/jpexs/decompiler/flash/gui/MainPanel.java index bbb92b599..061413f53 100644 --- a/src/com/jpexs/decompiler/flash/gui/MainPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/MainPanel.java @@ -6706,4 +6706,8 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se public boolean fontEmbed(TreeItem item, boolean create) { return previewPanel.getFontPanel().fontEmbed(item, create); } + + public EasyPanel getEasyPanel() { + return easyPanel; + } } diff --git a/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog.properties b/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog.properties index e5f11bf1a..8ffbe2bee 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog.properties @@ -540,4 +540,7 @@ config.name.gui.splitPaneEasyVertical.dividerLocationPercent = (Internal) Easy U config.description.gui.splitPaneEasyVertical.dividerLocationPercent = config.name.gui.splitPaneEasyHorizontal.dividerLocationPercent = (Internal) Easy UI horizontal splitter location -config.description.gui.splitPaneEasyHorizontal.dividerLocationPercent = \ No newline at end of file +config.description.gui.splitPaneEasyHorizontal.dividerLocationPercent = + +config.name.lastSessionEasySwf = Last Easy mode session file +config.description.lastSessionEasySwf = Contains the selected SWF from the last session in Easy mode \ No newline at end of file