mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-27 01:40:47 +00:00
Tag list view - saving last selected items
Saving last selected view
This commit is contained in:
@@ -105,7 +105,7 @@ public class FolderPreviewPanel extends JPanel {
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
if (e.getClickCount() > 1) {
|
||||
if (selectedIndex > -1) {
|
||||
mainPanel.setTagTreeSelectedNode(FolderPreviewPanel.this.items.get(selectedIndex));
|
||||
mainPanel.setTagTreeSelectedNode(mainPanel.getCurrentTree(), FolderPreviewPanel.this.items.get(selectedIndex));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ import com.jpexs.decompiler.flash.Version;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
|
||||
import com.jpexs.decompiler.flash.configuration.Configuration;
|
||||
import com.jpexs.decompiler.flash.configuration.SwfSpecificConfiguration;
|
||||
import com.jpexs.decompiler.flash.configuration.SwfSpecificCustomConfiguration;
|
||||
import com.jpexs.decompiler.flash.console.CommandLineArgumentParser;
|
||||
import com.jpexs.decompiler.flash.console.ContextMenuTools;
|
||||
import com.jpexs.decompiler.flash.exporters.modes.ExeExportMode;
|
||||
@@ -1310,13 +1311,23 @@ public class Main {
|
||||
|
||||
if (mainFrame != null && fswf != null) {
|
||||
SwfSpecificConfiguration swfConf = Configuration.getSwfSpecificConfiguration(fswf.getShortFileName());
|
||||
String resourcesPathStr = null;
|
||||
String tagListPathStr = null;
|
||||
if (swfConf != null) {
|
||||
String pathStr = swfConf.lastSelectedPath;
|
||||
if (isInited()) {
|
||||
mainFrame.getPanel().tagTree.setSelectionPathString(pathStr);
|
||||
} else {
|
||||
mainFrame.getPanel().tagTree.setExpandPathString(pathStr);
|
||||
}
|
||||
resourcesPathStr = swfConf.lastSelectedPath;
|
||||
}
|
||||
SwfSpecificCustomConfiguration swfCustomConf = Configuration.getSwfSpecificCustomConfiguration(fswf.getShortFileName());
|
||||
if (swfCustomConf != null) {
|
||||
resourcesPathStr = swfCustomConf.getCustomData(SwfSpecificCustomConfiguration.KEY_LAST_SELECTED_PATH_RESOURCES, resourcesPathStr);
|
||||
tagListPathStr = swfCustomConf.getCustomData(SwfSpecificCustomConfiguration.KEY_LAST_SELECTED_PATH_TAGLIST, null);
|
||||
}
|
||||
|
||||
if (isInited()) {
|
||||
mainFrame.getPanel().tagTree.setSelectionPathString(resourcesPathStr);
|
||||
mainFrame.getPanel().tagListTree.setSelectionPathString(tagListPathStr);
|
||||
} else {
|
||||
mainFrame.getPanel().tagTree.setExpandPathString(resourcesPathStr);
|
||||
mainFrame.getPanel().tagListTree.setExpandPathString(tagListPathStr);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2327,6 +2338,7 @@ public class Main {
|
||||
openingFiles = true;
|
||||
openFile(sourceInfos, () -> {
|
||||
mainFrame.getPanel().tagTree.setSelectionPathString(Configuration.lastSessionSelection.get());
|
||||
mainFrame.getPanel().tagListTree.setSelectionPathString(Configuration.lastSessionTagListSelection.get());
|
||||
setSessionLoaded(true);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -878,10 +878,16 @@ public abstract class MainFrameMenu implements MenuBuilder {
|
||||
|
||||
finishMenu("/file");
|
||||
|
||||
if (Configuration.dumpView.get()) {
|
||||
setGroupSelection("view", "/file/view/viewHex");
|
||||
} else {
|
||||
setGroupSelection("view", "/file/view/viewResources");
|
||||
switch(Configuration.lastView.get()){
|
||||
case MainPanel.VIEW_RESOURCES:
|
||||
setGroupSelection("view", "/file/view/viewResources");
|
||||
break;
|
||||
case MainPanel.VIEW_TAGLIST:
|
||||
setGroupSelection("view", "/file/view/viewTagList");
|
||||
break;
|
||||
case MainPanel.VIEW_DUMP:
|
||||
setGroupSelection("view", "/file/view/viewHex");
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -146,9 +146,13 @@ public final class MainFrameRibbon extends AppRibbonFrame {
|
||||
Configuration.lastSessionFiles.set(sb.toString());
|
||||
Configuration.lastSessionFileTitles.set(sbt.toString());
|
||||
|
||||
String path = panel.tagTree.getSelectionPathString();
|
||||
if (path != null) {
|
||||
Configuration.lastSessionSelection.set(path);
|
||||
String pathResources = panel.tagTree.getSelectionPathString();
|
||||
if (pathResources != null) {
|
||||
Configuration.lastSessionSelection.set(pathResources);
|
||||
}
|
||||
String pathTagList = panel.tagListTree.getSelectionPathString();
|
||||
if (pathTagList != null) {
|
||||
Configuration.lastSessionTagListSelection.set(pathTagList);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ import com.jpexs.decompiler.flash.abc.types.traits.Trait;
|
||||
import com.jpexs.decompiler.flash.configuration.Configuration;
|
||||
import com.jpexs.decompiler.flash.configuration.ConfigurationItem;
|
||||
import com.jpexs.decompiler.flash.configuration.SwfSpecificConfiguration;
|
||||
import com.jpexs.decompiler.flash.configuration.SwfSpecificCustomConfiguration;
|
||||
import com.jpexs.decompiler.flash.dumpview.DumpInfo;
|
||||
import com.jpexs.decompiler.flash.dumpview.DumpInfoSwfNode;
|
||||
import com.jpexs.decompiler.flash.exporters.BinaryDataExporter;
|
||||
@@ -704,11 +705,9 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
dumpTree = new DumpTree(null, this);
|
||||
dumpTree.addTreeSelectionListener(this);
|
||||
dumpTree.createContextMenu();
|
||||
|
||||
if (Configuration.dumpView.get()) {
|
||||
currentView = VIEW_DUMP;
|
||||
}
|
||||
|
||||
|
||||
currentView = Configuration.lastView.get();
|
||||
|
||||
statusPanel = new MainFrameStatusPanel(this);
|
||||
add(statusPanel, BorderLayout.SOUTH);
|
||||
|
||||
@@ -1800,7 +1799,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
Timelined t = (Timelined) treeItem;
|
||||
Frame f = tagTree.getModel().getFrame(treeItem.getSwf(), t, frame);
|
||||
if (f != null) {
|
||||
setTagTreeSelectedNode(f);
|
||||
setTagTreeSelectedNode(getCurrentTree(), f);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2265,7 +2264,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
public void updateSearchPos(String searchedText, boolean ignoreCase, boolean regExp, TextTag item) {
|
||||
View.checkAccess();
|
||||
|
||||
setTagTreeSelectedNode(item);
|
||||
setTagTreeSelectedNode(getCurrentTree(), item);
|
||||
previewPanel.getTextPanel().updateSearchPos();
|
||||
}
|
||||
|
||||
@@ -2280,11 +2279,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
}
|
||||
}
|
||||
|
||||
public void setTagTreeSelectedNode(TreeItem treeItem) {
|
||||
if (currentView != VIEW_RESOURCES && currentView != VIEW_TAGLIST) {
|
||||
return;
|
||||
}
|
||||
AbstractTagTree tree = getCurrentTree();
|
||||
public void setTagTreeSelectedNode(AbstractTagTree tree, TreeItem treeItem) {
|
||||
AbstractTagTreeModel ttm = tree.getModel();
|
||||
TreePath tp = ttm.getTreePath(treeItem);
|
||||
if (tp != null) {
|
||||
@@ -3018,7 +3013,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
if (swf != null) {
|
||||
SWF treeItemSwf = swf.getRootSwf();
|
||||
if (this.swfs.contains(treeItemSwf.swfList)) {
|
||||
setTagTreeSelectedNode(treeItem);
|
||||
setTagTreeSelectedNode(getCurrentTree(), treeItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3046,7 +3041,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
if (swf != null) {
|
||||
SWF treeItemSwf = swf.getRootSwf();
|
||||
if (this.swfs.contains(treeItemSwf.swfList)) {
|
||||
setTagTreeSelectedNode(treeItem);
|
||||
setTagTreeSelectedNode(getCurrentTree(), treeItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3233,7 +3228,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
SWF swf = it.getSwf();
|
||||
if (newTag != null) {
|
||||
refreshTree(swf);
|
||||
setTagTreeSelectedNode(newTag);
|
||||
setTagTreeSelectedNode(getCurrentTree(), newTag);
|
||||
}
|
||||
swf.clearImageCache();
|
||||
} catch (IOException ex) {
|
||||
@@ -3260,7 +3255,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
SWF swf = st.getSwf();
|
||||
if (newTag != null) {
|
||||
refreshTree(swf);
|
||||
setTagTreeSelectedNode(newTag);
|
||||
setTagTreeSelectedNode(getCurrentTree(), newTag);
|
||||
}
|
||||
|
||||
swf.clearImageCache();
|
||||
@@ -3315,7 +3310,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
SWF swf = st.getSwf();
|
||||
if (newTag != null) {
|
||||
refreshTree(swf);
|
||||
setTagTreeSelectedNode(newTag);
|
||||
setTagTreeSelectedNode(getCurrentTree(), newTag);
|
||||
}
|
||||
|
||||
swf.clearImageCache();
|
||||
@@ -3622,14 +3617,14 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
dumpTree.expandFirstLevelNodes();
|
||||
}
|
||||
break;
|
||||
case VIEW_RESOURCES:
|
||||
case VIEW_RESOURCES:
|
||||
case VIEW_TAGLIST:
|
||||
if (tagTree.getModel() == null) {
|
||||
TagTreeModel ttm = new TagTreeModel(swfs, Configuration.tagTreeShowEmptyFolders.get());
|
||||
tagTree.setModel(ttm);
|
||||
tagTree.expandFirstLevelNodes();
|
||||
}
|
||||
break;
|
||||
case VIEW_TAGLIST:
|
||||
}
|
||||
|
||||
if (tagListTree.getModel() == null) {
|
||||
TagListTreeModel ttm = new TagListTreeModel(swfs);
|
||||
tagListTree.setModel(ttm);
|
||||
@@ -3675,6 +3670,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
switch (view) {
|
||||
case VIEW_DUMP:
|
||||
currentView = view;
|
||||
Configuration.lastView.set(currentView);
|
||||
if (!isWelcomeScreen) {
|
||||
showContentPanelCard(SPLIT_PANE1);
|
||||
}
|
||||
@@ -3685,6 +3681,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
return true;
|
||||
case VIEW_RESOURCES:
|
||||
currentView = view;
|
||||
Configuration.lastView.set(currentView);
|
||||
if (!isWelcomeScreen) {
|
||||
showContentPanelCard(SPLIT_PANE1);
|
||||
}
|
||||
@@ -3703,6 +3700,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
return true;
|
||||
case VIEW_TIMELINE:
|
||||
currentView = view;
|
||||
Configuration.lastView.set(currentView);
|
||||
final SWF swf = getCurrentSwf();
|
||||
if (swf != null) {
|
||||
TreeItem item = getCurrentTree().getCurrentTreeItem();
|
||||
@@ -3722,6 +3720,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
return false;
|
||||
case VIEW_TAGLIST:
|
||||
currentView = view;
|
||||
Configuration.lastView.set(currentView);
|
||||
if (!isWelcomeScreen) {
|
||||
showContentPanelCard(SPLIT_PANE1);
|
||||
}
|
||||
@@ -3924,8 +3923,11 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
}
|
||||
|
||||
if (swf != null) {
|
||||
SwfSpecificConfiguration swfConf = Configuration.getOrCreateSwfSpecificConfiguration(swf.getShortFileName());
|
||||
swfConf.lastSelectedPath = tagTree.getSelectionPathString();
|
||||
SwfSpecificCustomConfiguration swfCustomConf = Configuration.getOrCreateSwfSpecificCustomConfiguration(swf.getShortFileName());
|
||||
//swfConf.lastSelectedPath = tagTree.getSelectionPathString();
|
||||
swfCustomConf.setCustomData(SwfSpecificCustomConfiguration.KEY_LAST_SELECTED_PATH_RESOURCES, tagTree.getSelectionPathString());
|
||||
swfCustomConf.setCustomData(SwfSpecificCustomConfiguration.KEY_LAST_SELECTED_PATH_TAGLIST, tagListTree.getSelectionPathString());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -918,7 +918,7 @@ public class PreviewPanel extends JPersistentSplitPane implements TagEditorPanel
|
||||
swf.assignClassesToSymbols();
|
||||
swf.assignExportNamesToSymbols();
|
||||
mainPanel.refreshTree(swf);
|
||||
mainPanel.setTagTreeSelectedNode(tag);
|
||||
mainPanel.setTagTreeSelectedNode(mainPanel.getCurrentTree(), tag);
|
||||
genericEditButton.setVisible(true);
|
||||
genericSaveButton.setVisible(false);
|
||||
genericCancelButton.setVisible(false);
|
||||
@@ -949,7 +949,7 @@ public class PreviewPanel extends JPersistentSplitPane implements TagEditorPanel
|
||||
SWF swf = tag.getSwf();
|
||||
tag.getTimelined().resetTimeline();
|
||||
mainPanel.refreshTree(swf);
|
||||
mainPanel.setTagTreeSelectedNode(tag);
|
||||
mainPanel.setTagTreeSelectedNode(mainPanel.getCurrentTree(), tag);
|
||||
}
|
||||
placeGenericPanel.setEditMode(false, null);
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ public class TagInfoPanel extends JPanel {
|
||||
} else if ("frame".equals(scheme)) {
|
||||
item = swf.getTimeline().getFrame(id);
|
||||
}
|
||||
mainPanel.setTagTreeSelectedNode(item);
|
||||
mainPanel.setTagTreeSelectedNode(mainPanel.getCurrentTree(), item);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -491,7 +491,7 @@ public class DumpTree extends JTree {
|
||||
|
||||
if (foundTag != null) {
|
||||
mainPanel.getMainFrame().getMenu().showResourcesView();
|
||||
mainPanel.setTagTreeSelectedNode(foundTag);
|
||||
mainPanel.setTagTreeSelectedNode(mainPanel.getCurrentTree(), foundTag);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -555,3 +555,12 @@ config.description.showImportSymbolClassInfo = Displays some info about how Symb
|
||||
|
||||
config.name.showImportXmlInfo = Show information before importing XML
|
||||
config.description.showImportXmlInfo = Displays some info about how XML importing works after clicking Import XML in the menu.
|
||||
|
||||
config.name.lastSessionTagListSelection = Last session tag list selection
|
||||
config.description.lastSessionTagListSelection = Contains the selection from the last session on the list selection view
|
||||
|
||||
config.name.lastView = Last view
|
||||
config.description.lastView = Last displayed view mode
|
||||
|
||||
config.name.swfSpecificCustomConfigs = SWF specific custom configurations
|
||||
config.description.swfSpecificCustomConfigs = Contains the SWF specific configurations in custom format
|
||||
|
||||
@@ -35,4 +35,9 @@ public class TagListTreeRoot implements TreeItem {
|
||||
public boolean isModified() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "root";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -354,7 +354,7 @@ public abstract class AbstractTagTree extends JTree {
|
||||
TreePath tp = View.getTreePathByPathStrings(this, Arrays.asList(path));
|
||||
if (tp != null) {
|
||||
// the current view is the Resources view, otherwise tp is null
|
||||
mainPanel.setTagTreeSelectedNode((TreeItem) tp.getLastPathComponent());
|
||||
mainPanel.setTagTreeSelectedNode(this, (TreeItem) tp.getLastPathComponent());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -502,4 +502,22 @@ public abstract class AbstractTagTree extends JTree {
|
||||
TreeItem item = (TreeItem) getLastSelectedPathComponent();
|
||||
return item;
|
||||
}
|
||||
|
||||
public String getSelectionPathString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
TreePath path = getSelectionPath();
|
||||
if (path != null) {
|
||||
boolean first = true;
|
||||
for (Object p : path.getPath()) {
|
||||
if (!first) {
|
||||
sb.append("|");
|
||||
}
|
||||
|
||||
first = false;
|
||||
sb.append(p.toString());
|
||||
}
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -555,23 +555,7 @@ public class TagTree extends AbstractTagTree {
|
||||
return (TagTreeModel) super.getModel();
|
||||
}
|
||||
|
||||
public String getSelectionPathString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
TreePath path = getSelectionPath();
|
||||
if (path != null) {
|
||||
boolean first = true;
|
||||
for (Object p : path.getPath()) {
|
||||
if (!first) {
|
||||
sb.append("|");
|
||||
}
|
||||
|
||||
first = false;
|
||||
sb.append(p.toString());
|
||||
}
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -947,7 +947,7 @@ public class TagTreeContextMenu extends JPopupMenu {
|
||||
}
|
||||
|
||||
CharacterIdTag characterIdTag = (CharacterIdTag) itemj;
|
||||
mainPanel.setTagTreeSelectedNode(itemj.getSwf().getCharacter(characterIdTag.getCharacterId()));
|
||||
mainPanel.setTagTreeSelectedNode(mainPanel.getCurrentTree(), itemj.getSwf().getCharacter(characterIdTag.getCharacterId()));
|
||||
}
|
||||
|
||||
private void expandRecursiveActionPerformed(ActionEvent evt) {
|
||||
|
||||
Reference in New Issue
Block a user