Save last selected Easy mode SWF

This commit is contained in:
Jindra Petřík
2024-10-29 16:55:43 +01:00
parent b341837df4
commit f5ec76125d
5 changed files with 29 additions and 2 deletions
@@ -1038,7 +1038,9 @@ public final class Configuration {
@ConfigurationName("gui.splitPaneEasyHorizontal.dividerLocationPercent") @ConfigurationName("gui.splitPaneEasyHorizontal.dividerLocationPercent")
@ConfigurationInternal @ConfigurationInternal
public static ConfigurationItem<Double> guiSplitPaneEasyHorizontaldividerLocationPercent = null; public static ConfigurationItem<Double> guiSplitPaneEasyHorizontaldividerLocationPercent = null;
public static ConfigurationItem<String> lastSessionEasySwf = null;
private enum OSId { private enum OSId {
WINDOWS, OSX, UNIX WINDOWS, OSX, UNIX
} }
@@ -3013,6 +3013,16 @@ public class Main {
openFile(sourceInfos, (Openable openable) -> { openFile(sourceInfos, (Openable openable) -> {
mainFrame.getPanel().tagTree.setSelectionPathString(Configuration.lastSessionSelection.get()); mainFrame.getPanel().tagTree.setSelectionPathString(Configuration.lastSessionSelection.get());
mainFrame.getPanel().tagListTree.setSelectionPathString(Configuration.lastSessionTagListSelection.get()); mainFrame.getPanel().tagListTree.setSelectionPathString(Configuration.lastSessionTagListSelection.get());
Set<SWF> 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); setSessionLoaded(true);
mainFrame.getPanel().reload(true); mainFrame.getPanel().reload(true);
mainFrame.getPanel().updateUiWithCurrentOpenable(); mainFrame.getPanel().updateUiWithCurrentOpenable();
@@ -16,6 +16,7 @@
*/ */
package com.jpexs.decompiler.flash.gui; package com.jpexs.decompiler.flash.gui;
import com.jpexs.decompiler.flash.SWF;
import com.jpexs.decompiler.flash.configuration.Configuration; import com.jpexs.decompiler.flash.configuration.Configuration;
import com.jpexs.decompiler.flash.gui.player.FlashPlayerPanel; import com.jpexs.decompiler.flash.gui.player.FlashPlayerPanel;
import com.jpexs.decompiler.flash.treeitems.OpenableList; import com.jpexs.decompiler.flash.treeitems.OpenableList;
@@ -155,6 +156,13 @@ public final class MainFrameRibbon extends AppRibbonFrame {
Configuration.lastSessionFiles.set(sb.toString()); Configuration.lastSessionFiles.set(sb.toString());
Configuration.lastSessionFileTitles.set(sbt.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(); String pathResources = panel.tagTree.getSelectionPathString();
if (pathResources != null) { if (pathResources != null) {
Configuration.lastSessionSelection.set(pathResources); Configuration.lastSessionSelection.set(pathResources);
@@ -6706,4 +6706,8 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
public boolean fontEmbed(TreeItem item, boolean create) { public boolean fontEmbed(TreeItem item, boolean create) {
return previewPanel.getFontPanel().fontEmbed(item, create); return previewPanel.getFontPanel().fontEmbed(item, create);
} }
public EasyPanel getEasyPanel() {
return easyPanel;
}
} }
@@ -540,4 +540,7 @@ config.name.gui.splitPaneEasyVertical.dividerLocationPercent = (Internal) Easy U
config.description.gui.splitPaneEasyVertical.dividerLocationPercent = config.description.gui.splitPaneEasyVertical.dividerLocationPercent =
config.name.gui.splitPaneEasyHorizontal.dividerLocationPercent = (Internal) Easy UI horizontal splitter location config.name.gui.splitPaneEasyHorizontal.dividerLocationPercent = (Internal) Easy UI horizontal splitter location
config.description.gui.splitPaneEasyHorizontal.dividerLocationPercent = 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