Fixed Switching between openables on session load and on view type change

This commit is contained in:
Jindra Petřík
2023-09-30 10:03:11 +02:00
parent f3c7f7faf8
commit 17ea470eea
4 changed files with 49 additions and 1 deletions

View File

@@ -59,6 +59,7 @@ All notable changes to this project will be documented in this file.
- AS3 Initialization of var in script initializer
- AS3 Nullpointer on getting multiname which is out of bounds
- Exceptions on cancelling file loading
- Switching between openables on session load and on view type change
### Changed
- [#2070] String values inside SWF to XML export are backslash escaped

View File

@@ -149,6 +149,7 @@ import javax.swing.SwingUtilities;
import javax.swing.SwingWorker;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.filechooser.FileFilter;
import org.pushingpixels.substance.api.SubstanceLookAndFeel;
@@ -2783,6 +2784,16 @@ public class Main {
openFile(sourceInfos, () -> {
mainFrame.getPanel().tagTree.setSelectionPathString(Configuration.lastSessionSelection.get());
mainFrame.getPanel().tagListTree.setSelectionPathString(Configuration.lastSessionTagListSelection.get());
if (mainFrame.getPanel().getCurrentView() == MainPanel.VIEW_RESOURCES) {
mainFrame.getPanel().valueChanged(new TreeSelectionEvent(
mainFrame.getPanel().tagTree, mainFrame.getPanel().tagTree.getSelectionPath(), false, null, null
));
}
if (mainFrame.getPanel().getCurrentView() == MainPanel.VIEW_TAGLIST) {
mainFrame.getPanel().valueChanged(new TreeSelectionEvent(
mainFrame.getPanel().tagListTree, mainFrame.getPanel().tagListTree.getSelectionPath(), false, null, null
));
}
setSessionLoaded(true);
});
}

View File

@@ -1441,6 +1441,40 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
return actionPanel;
}
private void updateUiWithCurrentOpenable() {
switch (currentView) {
case VIEW_RESOURCES:
TreeItem resourcesTi = (TreeItem) tagTree.getLastSelectedPathComponent();
if (resourcesTi != null) {
Openable resourcesOpenable = resourcesTi.getOpenable();
if (resourcesOpenable != null) {
updateUi(resourcesOpenable);
}
}
break;
case VIEW_TAGLIST:
TreeItem tagListTi = (TreeItem) tagListTree.getLastSelectedPathComponent();
if (tagListTi != null) {
Openable tagListOpenable = tagListTi.getOpenable();
if (tagListOpenable != null) {
updateUi(tagListOpenable);
}
}
break;
case VIEW_DUMP:
DumpInfo di = (DumpInfo) dumpTree.getLastSelectedPathComponent();
if (di != null) {
Openable dumpOpenable = di.getOpenable();
if (dumpOpenable != null) {
updateUi(dumpOpenable);
}
}
break;
case VIEW_TIMELINE:
break;
}
}
private void updateUi(final Openable openable) {
View.checkAccess();
@@ -4797,6 +4831,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
treePanelMode = TreePanelMode.DUMP_TREE;
showDetail(DETAILCARDEMPTYPANEL);
reload(true);
updateUiWithCurrentOpenable();
return true;
case VIEW_RESOURCES:
pinsPanel.setVisible(true);
@@ -4818,6 +4853,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
refreshPins();
reload(true);
updateUiWithCurrentOpenable();
return true;
case VIEW_TIMELINE:
pinsPanel.setVisible(false);
@@ -4853,6 +4889,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
treePanelMode = TreePanelMode.TAGLIST_TREE;
refreshPins();
reload(true);
updateUiWithCurrentOpenable();
return true;
}

View File

@@ -20,7 +20,6 @@ import com.jpexs.decompiler.flash.SWF;
import com.jpexs.decompiler.flash.configuration.Configuration;
import com.jpexs.decompiler.flash.gui.MainPanel;
import com.jpexs.decompiler.flash.gui.tagtree.AbstractTagTree;
import static com.jpexs.decompiler.flash.gui.tagtree.AbstractTagTree.getSelection;
import com.jpexs.decompiler.flash.tags.DefineSpriteTag;
import com.jpexs.decompiler.flash.tags.DoInitActionTag;
import com.jpexs.decompiler.flash.tags.Tag;