mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-24 19:51:38 +00:00
Double click timelined in Library shows its timeline.
Properly dispose ImagePanels
This commit is contained in:
@@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.easygui;
|
||||
import com.jpexs.decompiler.flash.SWF;
|
||||
import com.jpexs.decompiler.flash.gui.View;
|
||||
import java.awt.BorderLayout;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
@@ -57,4 +58,9 @@ public class EasyPanel extends JPanel {
|
||||
public SWF getSwf() {
|
||||
return tabSwitcher.getSelectedValue();
|
||||
}
|
||||
|
||||
public void dispose() {
|
||||
setSwfs(new ArrayList<>());
|
||||
easySwfPanel.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -371,7 +371,7 @@ public class EasySwfPanel extends JPanel {
|
||||
|
||||
verticalSplitPane = new JPersistentSplitPane(JSplitPane.VERTICAL_SPLIT, topPanel, timelinePanel, Configuration.guiSplitPaneEasyVerticaldividerLocationPercent);
|
||||
|
||||
libraryTreeTable = new LibraryTreeTable();
|
||||
libraryTreeTable = new LibraryTreeTable(this);
|
||||
JScrollPane libraryScrollPane = new FasterScrollPane(libraryTreeTable);
|
||||
|
||||
JPanel libraryPanel = new JPanel(new BorderLayout());
|
||||
@@ -464,13 +464,16 @@ public class EasySwfPanel extends JPanel {
|
||||
if (timelined == null) {
|
||||
stagePanel.clearAll();
|
||||
timelinePanel.setTimelined(null);
|
||||
libraryTreeTable.setSwf(null);
|
||||
libraryPreviewPanel.clearAll();
|
||||
} else {
|
||||
SWF swf = timelined.getSwf();
|
||||
libraryTreeTable.setSwf(swf);
|
||||
stagePanel.setTimelined(swf, swf, 0, true, true, true, true, true, false, true);
|
||||
libraryPreviewPanel.clearAll();
|
||||
stagePanel.setTimelined(timelined, swf, 0, true, true, true, true, true, false, true);
|
||||
stagePanel.pause();
|
||||
stagePanel.gotoFrame(0);
|
||||
timelinePanel.setTimelined(swf);
|
||||
timelinePanel.setTimelined(timelined);
|
||||
}
|
||||
updateUndos();
|
||||
}
|
||||
@@ -501,4 +504,9 @@ public class EasySwfPanel extends JPanel {
|
||||
}
|
||||
Main.getMainFrame().getPanel().updateUiWithCurrentOpenable();
|
||||
}
|
||||
|
||||
public void dispose() {
|
||||
setTimelined(null);
|
||||
undoManager.clear();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,15 +29,19 @@ import com.jpexs.decompiler.flash.tags.base.MorphShapeTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.ShapeTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.SoundTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.TextTag;
|
||||
import com.jpexs.decompiler.flash.timeline.Timelined;
|
||||
import de.javagl.treetable.JTreeTable;
|
||||
import de.javagl.treetable.TreeTableModel;
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.event.KeyAdapter;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JTree;
|
||||
import javax.swing.ListSelectionModel;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.event.TreeModelListener;
|
||||
import javax.swing.plaf.basic.BasicTableUI;
|
||||
import javax.swing.tree.DefaultMutableTreeNode;
|
||||
@@ -50,7 +54,10 @@ import javax.swing.tree.TreePath;
|
||||
*/
|
||||
public class LibraryTreeTable extends JTreeTable {
|
||||
|
||||
public LibraryTreeTable() {
|
||||
private final EasySwfPanel easySwfPanel;
|
||||
private SWF swf;
|
||||
|
||||
public LibraryTreeTable(EasySwfPanel easySwfPanel) {
|
||||
super(new LibraryTreeTableModel(null));
|
||||
getTree().setCellRenderer(new LibraryTreeCellRenderer());
|
||||
getTree().setRootVisible(false);
|
||||
@@ -107,9 +114,32 @@ public class LibraryTreeTable extends JTreeTable {
|
||||
setBackground(Color.WHITE);
|
||||
getTree().setBackground(Color.WHITE);
|
||||
}
|
||||
this.easySwfPanel = easySwfPanel;
|
||||
|
||||
addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
if (SwingUtilities.isLeftMouseButton(e) && e.getClickCount() == 2) {
|
||||
int selectedRow = getSelectedRow();
|
||||
if (selectedRow == -1) {
|
||||
return;
|
||||
}
|
||||
DefaultMutableTreeNode node = (DefaultMutableTreeNode) getValueAt(selectedRow, 0);
|
||||
Object obj = node.getUserObject();
|
||||
if (obj instanceof Timelined) {
|
||||
easySwfPanel.setTimelined((Timelined) obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public void setSwf(SWF swf) {
|
||||
if (swf == this.swf) {
|
||||
return;
|
||||
}
|
||||
this.swf = swf;
|
||||
setTreeTableModel(new LibraryTreeTableModel(swf));
|
||||
}
|
||||
|
||||
|
||||
@@ -6503,6 +6503,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
}
|
||||
|
||||
public void dispose() {
|
||||
easyPanel.dispose();
|
||||
if (calculateMissingNeededThread != null) {
|
||||
calculateMissingNeededThread.interrupt();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user