diff --git a/CHANGELOG.md b/CHANGELOG.md index 72fe30e72..0f7850d1a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ All notable changes to this project will be documented in this file. - [#1460] Bulk importing images - Bulk importing scripts/text/images added to SWF context menu - [#1465] Configuration option to disable SWF preview autoplay +- Setting for disabling expanding first level of tree nodes on SWF load ### Fixed - FLA export printing xxx string on exporting character with id 320 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 bb9b5cc74..526f8003c 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 @@ -763,6 +763,10 @@ public final class Configuration { @ConfigurationDefaultBoolean(true) @ConfigurationCategory("display") public static ConfigurationItem autoPlaySwfs = null; + + @ConfigurationDefaultBoolean(true) + @ConfigurationCategory("ui") + public static ConfigurationItem expandFirstLevelOfTreeOnLoad = null; private enum OSId { WINDOWS, OSX, UNIX diff --git a/src/com/jpexs/decompiler/flash/gui/MainPanel.java b/src/com/jpexs/decompiler/flash/gui/MainPanel.java index 4b28557cb..a7f10138c 100644 --- a/src/com/jpexs/decompiler/flash/gui/MainPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/MainPanel.java @@ -296,17 +296,15 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se private final JProgressBar progressBar = new JProgressBar(0, 100); public TagTree tagTree; - + public FasterScrollPane tagTreeScrollPanel; - public DumpTree dumpTree; + public DumpTree dumpTree; public TagListTree tagListTree; - + private ClipboardPanel resourcesClipboardPanel; private ClipboardPanel tagListClipboardPanel; - - private final FlashPlayerPanel flashPanel; @@ -429,7 +427,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se } clipboardCut = false; resourcesClipboardPanel.update(); - tagListClipboardPanel.update(); + tagListClipboardPanel.update(); } public void cutToClipboard(Collection items) { @@ -444,11 +442,11 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se public boolean clipboardEmpty() { return clipboard.isEmpty(); } - + public int getClipboardSize() { return clipboard.size(); } - + public Set getClipboardContents() { Set ret = new LinkedHashSet<>(); for (WeakReference ref : orderedClipboard) { @@ -935,17 +933,18 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se } ttm.updateSwfs(e); tagTree.expandRoot(); - if (e.getAction() == CollectionChangedAction.RESET) { - tagTree.expandFirstLevelNodes(); - } else if (e.getAction() == CollectionChangedAction.ADD) { - SWFList list = e.getNewItem(); - if (!list.isBundle() && list.swfs.size() == 1) { - tagTree.expandPath(tagTree.getModel().getTreePath(list.get(0))); - } else { - tagTree.expandPath(tagTree.getModel().getTreePath(e.getNewItem())); + if (Configuration.expandFirstLevelOfTreeOnLoad.get()) { + if (e.getAction() == CollectionChangedAction.RESET) { + tagTree.expandFirstLevelNodes(); + } else if (e.getAction() == CollectionChangedAction.ADD) { + SWFList list = e.getNewItem(); + if (!list.isBundle() && list.swfs.size() == 1) { + tagTree.expandPath(tagTree.getModel().getTreePath(list.get(0))); + } else { + tagTree.expandPath(tagTree.getModel().getTreePath(e.getNewItem())); + } } } - } ttm = tagListTree.getModel(); if (ttm != null) { @@ -954,15 +953,17 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se } ttm.updateSwfs(e); tagListTree.expandRoot(); - - if (e.getAction() == CollectionChangedAction.RESET) { - tagListTree.expandFirstLevelNodes(); - } else if (e.getAction() == CollectionChangedAction.ADD) { - SWFList list = e.getNewItem(); - if (!list.isBundle() && list.swfs.size() == 1) { - tagListTree.expandPath(tagListTree.getModel().getTreePath(list.get(0))); - } else { - tagListTree.expandPath(tagListTree.getModel().getTreePath(e.getNewItem())); + + if (Configuration.expandFirstLevelOfTreeOnLoad.get()) { + if (e.getAction() == CollectionChangedAction.RESET) { + tagListTree.expandFirstLevelNodes(); + } else if (e.getAction() == CollectionChangedAction.ADD) { + SWFList list = e.getNewItem(); + if (!list.isBundle() && list.swfs.size() == 1) { + tagListTree.expandPath(tagListTree.getModel().getTreePath(list.get(0))); + } else { + tagListTree.expandPath(tagListTree.getModel().getTreePath(e.getNewItem())); + } } } } @@ -973,12 +974,14 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se dtm.updateSwfs(); View.expandTreeNodes(dumpTree, expandedNodes); dumpTree.expandRoot(); - if (e.getAction() == CollectionChangedAction.RESET) { - dumpTree.expandFirstLevelNodes(); - } else if (e.getAction() == CollectionChangedAction.ADD) { - SWFList list = e.getNewItem(); - for (SWF dswf : list) { - dumpTree.expandSwfNode(dswf); + if (Configuration.expandFirstLevelOfTreeOnLoad.get()) { + if (e.getAction() == CollectionChangedAction.RESET) { + dumpTree.expandFirstLevelNodes(); + } else if (e.getAction() == CollectionChangedAction.ADD) { + SWFList list = e.getNewItem(); + for (SWF dswf : list) { + dumpTree.expandSwfNode(dswf); + } } } } @@ -2684,9 +2687,9 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se final long timeBefore = System.currentTimeMillis(); new CancellableWorker() { - + private int count = 0; - + @Override public Void doInBackground() throws Exception { try { @@ -2744,12 +2747,11 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se Main.stopWork(); long timeAfter = System.currentTimeMillis(); final long timeMs = timeAfter - timeBefore; - View.execInEventDispatch(() -> { refreshTree(swf); setStatus(translate("import.finishedin").replace("%time%", Helper.formatTimeSec(timeMs))); - + ViewMessages.showMessageDialog(MainPanel.this, translate("import.image.result").replace("%count%", Integer.toString(count))); if (count != 0) { reload(true); @@ -3925,17 +3927,17 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se } private JPanel createTagListViewCard() { - tagListClipboardPanel = new ClipboardPanel(this); - - JPanel r = new JPanel(new BorderLayout()); + tagListClipboardPanel = new ClipboardPanel(this); + + JPanel r = new JPanel(new BorderLayout()); r.add(tagListClipboardPanel, BorderLayout.NORTH); r.add(new FasterScrollPane(tagListTree), BorderLayout.CENTER); return r; } private JPanel createResourcesViewCard() { - resourcesClipboardPanel = new ClipboardPanel(this); - JPanel r = new JPanel(new BorderLayout()); + resourcesClipboardPanel = new ClipboardPanel(this); + JPanel r = new JPanel(new BorderLayout()); r.add(resourcesClipboardPanel, BorderLayout.NORTH); r.add(tagTreeScrollPanel = new FasterScrollPane(tagTree), BorderLayout.CENTER); r.add(searchPanel, BorderLayout.SOUTH); @@ -4705,7 +4707,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se @Override public void replaceTag(Tag oldTag, Tag newTag) { - } + } @Override public int indexOfTag(Tag tag) { @@ -4763,6 +4765,6 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se this.missingNeededCharacters = missingNeededCharacters; tagTree.setMissingNeededCharacters(missingNeededCharacters); tagListTree.setMissingNeededCharacters(missingNeededCharacters); - } + } } diff --git a/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog.properties b/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog.properties index 7d39948c2..7ad9be0c3 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog.properties @@ -581,3 +581,5 @@ config.description.showImportImageInfo = Displays some info about how importing config.name.autoPlaySwfs = Autoplay SWF previews config.description.autoPlaySwfs = Automatically play SWF preview on SWF node selection. +config.name.expandFirstLevelOfTreeOnLoad = Expand first level of tree on SWF load +config.description.expandFirstLevelOfTreeOnLoad = Automatically expands first level of nodes in the tree on SWF open. 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 c2bdf6f37..c29c04323 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog_cs.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog_cs.properties @@ -566,4 +566,7 @@ config.name.showImportImageInfo = Zobrazit informaci p\u0159ed importem obr\u00e config.description.showImportImageInfo = Zobraz\u00ed n\u011bjak\u00e9 informace o tom jak import obr\u00e1zk\u016f funguje po kliku na import obr\u00e1zk\u016f v menu. config.name.autoPlaySwfs = Automaticky p\u0159ehr\u00e1vat n\u00e1hledy SWF -config.description.autoPlaySwfs = Automaticicky p\u0159ehr\u00e1vat n\u00e1hled SWF p\u0159i v\u00fdb\u011bru SWF polo\u017eky. \ No newline at end of file +config.description.autoPlaySwfs = Automaticicky p\u0159ehr\u00e1vat n\u00e1hled SWF p\u0159i v\u00fdb\u011bru SWF polo\u017eky. + +config.name.expandFirstLevelOfTreeOnLoad = Rozbalit prvn\u00ed \u00farove\u0148 stromu p\u0159i na\u010dten\u00ed SWF +config.description.expandFirstLevelOfTreeOnLoad = Automaticky rozbal\u00ed prvn\u00ed \u00farove\u0148 polo\u017eek stromu p\u0159i otev\u0159en\u00ed SWF. \ No newline at end of file