mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-24 22:00:55 +00:00
Merge origin/master
This commit is contained in:
@@ -2216,6 +2216,10 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
|
||||
}
|
||||
|
||||
public void loadFromBinaryTag(final DefineBinaryDataTag binaryDataTag) {
|
||||
loadFromBinaryTag(Arrays.asList(binaryDataTag));
|
||||
}
|
||||
|
||||
public void loadFromBinaryTag(final List<DefineBinaryDataTag> binaryDataTags) {
|
||||
|
||||
if (Main.loadingDialog == null || Main.loadingDialog.getOwner() == null) {
|
||||
Main.loadingDialog = new LoadingDialog(mainFrame == null ? null : mainFrame.getWindow());
|
||||
@@ -2226,6 +2230,8 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
for (DefineBinaryDataTag binaryDataTag : binaryDataTags) {
|
||||
try {
|
||||
SWF bswf = new SWF(new ByteArrayInputStream(binaryDataTag.binaryData.getRangeData()), new ProgressListener() {
|
||||
|
||||
@@ -2237,9 +2243,14 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
|
||||
bswf.fileTitle = "(SWF Data)";
|
||||
binaryDataTag.innerSwf = bswf;
|
||||
bswf.binaryData = binaryDataTag;
|
||||
} catch (IOException | InterruptedException ex) {
|
||||
} catch (IOException ex) {
|
||||
//ignore
|
||||
}
|
||||
}
|
||||
} catch (InterruptedException ex) {
|
||||
//ignore
|
||||
}
|
||||
|
||||
Main.loadingDialog.setVisible(false);
|
||||
Main.stopWork();
|
||||
}
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.gui;
|
||||
|
||||
import java.awt.Color;
|
||||
import javax.swing.JTree;
|
||||
import javax.swing.tree.TreeModel;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class MyTree extends JTree {
|
||||
|
||||
public MyTree() {
|
||||
setUI(new MyTreeUI());
|
||||
setBackground(Color.white);
|
||||
}
|
||||
|
||||
public MyTree(TreeModel newModel) {
|
||||
super(newModel);
|
||||
setUI(new MyTreeUI());
|
||||
setBackground(Color.white);
|
||||
}
|
||||
private boolean overrideIsEnabled = false;
|
||||
|
||||
public void setOverrideIsEnable(boolean b) {
|
||||
overrideIsEnabled = true;
|
||||
}
|
||||
|
||||
public boolean isOverrideIsEnable(boolean b) {
|
||||
return overrideIsEnabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
if (overrideIsEnabled) {
|
||||
return false;
|
||||
}
|
||||
return super.isEnabled();
|
||||
}
|
||||
/*
|
||||
@Override
|
||||
public void paint(Graphics g) {
|
||||
g.setColor(Color.white);
|
||||
g.fillRect(0, 0, getWidth(), getHeight());
|
||||
super.paint(g);
|
||||
}*/
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.gui;
|
||||
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Insets;
|
||||
import java.awt.Rectangle;
|
||||
import java.lang.reflect.Field;
|
||||
import javax.swing.tree.TreePath;
|
||||
import org.pushingpixels.substance.internal.ui.SubstanceTreeUI;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
class MyTreeUI extends SubstanceTreeUI {
|
||||
|
||||
@Override
|
||||
protected void paintHorizontalPartOfLeg(Graphics g, Rectangle clipBounds,
|
||||
Insets insets, Rectangle bounds, TreePath path, int row,
|
||||
boolean isExpanded, boolean hasBeenExpanded, boolean isLeaf) {
|
||||
System.out.println("");
|
||||
if (this.tree instanceof MyTree) {
|
||||
Field f = null;
|
||||
Boolean v = false;
|
||||
try {
|
||||
f = SubstanceTreeUI.class.getDeclaredField("inside");
|
||||
f.setAccessible(true);
|
||||
v = (Boolean) f.get(this);
|
||||
f.set(this, Boolean.TRUE);
|
||||
((MyTree) this.tree).setOverrideIsEnable(true);
|
||||
} catch (Throwable t) {
|
||||
//want to default back to substanceUI if this fails.
|
||||
}
|
||||
|
||||
super.paintHorizontalPartOfLeg(g, bounds, insets, bounds, path, row, isLeaf, isLeaf, isLeaf);
|
||||
try {
|
||||
f.set(this, v);
|
||||
((MyTree) this.tree).setOverrideIsEnable(true);
|
||||
} catch (Throwable t) {
|
||||
//see above
|
||||
}
|
||||
}
|
||||
}
|
||||
//repeat for Vertical
|
||||
}
|
||||
@@ -69,6 +69,7 @@ import javax.swing.UIDefaults;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.UnsupportedLookAndFeelException;
|
||||
import javax.swing.plaf.FontUIResource;
|
||||
import javax.swing.plaf.TreeUI;
|
||||
import javax.swing.plaf.basic.BasicColorChooserUI;
|
||||
import javax.swing.text.JTextComponent;
|
||||
import javax.swing.tree.TreeModel;
|
||||
@@ -514,7 +515,14 @@ public class View {
|
||||
tree.expandPath(tp);
|
||||
}
|
||||
|
||||
public static void expandTreeNodesRecursive(JTree tree, TreePath parent, boolean expand) {
|
||||
public static void expandTreeNodes(JTree tree, TreePath parent, boolean expand) {
|
||||
TreeUI ui = tree.getUI();
|
||||
tree.setUI(null);
|
||||
expandTreeNodesRecursive(tree, parent, expand);
|
||||
tree.setUI(ui);
|
||||
}
|
||||
|
||||
private static void expandTreeNodesRecursive(JTree tree, TreePath parent, boolean expand) {
|
||||
TreeModel model = tree.getModel();
|
||||
|
||||
Object node = parent.getLastPathComponent();
|
||||
|
||||
@@ -211,7 +211,7 @@ public class DumpTree extends JTree implements ActionListener {
|
||||
if (path == null) {
|
||||
return;
|
||||
}
|
||||
View.expandTreeNodesRecursive(this, path, true);
|
||||
View.expandTreeNodes(this, path, true);
|
||||
}
|
||||
break;
|
||||
case ACTION_SAVE_TO_FILE: {
|
||||
|
||||
@@ -228,6 +228,9 @@ public class HexView extends JTable {
|
||||
|
||||
private int getIdxByColAndRow(int row, int col) {
|
||||
int idx = -1;
|
||||
if (row < 0 || col < 0) {
|
||||
return -1;
|
||||
}
|
||||
if (col > 0 && col != bytesInRow + 1) {
|
||||
idx = row * bytesInRow + ((col > bytesInRow + 1) ? (col - bytesInRow - 2) : (col - 1));
|
||||
}
|
||||
|
||||
@@ -113,15 +113,14 @@ import com.jpexs.decompiler.flash.treeitems.TreeItem;
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Font;
|
||||
import java.awt.Graphics;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JTree;
|
||||
import javax.swing.plaf.TreeUI;
|
||||
import javax.swing.plaf.basic.BasicLabelUI;
|
||||
import javax.swing.plaf.basic.BasicTreeUI;
|
||||
import javax.swing.tree.DefaultTreeCellRenderer;
|
||||
@@ -216,13 +215,15 @@ public class TagTree extends JTree {
|
||||
setCellRenderer(new TagTreeCellRenderer());
|
||||
setRootVisible(false);
|
||||
setBackground(Color.white);
|
||||
setUI(new BasicTreeUI() {
|
||||
@Override
|
||||
public void paint(Graphics g, JComponent c) {
|
||||
setRowHeight(16);
|
||||
setLargeModel(true);
|
||||
|
||||
TreeUI treeUI = new BasicTreeUI() {
|
||||
{
|
||||
setHashColor(Color.gray);
|
||||
super.paint(g, c);
|
||||
}
|
||||
});
|
||||
};
|
||||
setUI(treeUI);
|
||||
}
|
||||
|
||||
public void createContextMenu() {
|
||||
|
||||
@@ -194,8 +194,9 @@ public class TagTreeContextMenu extends JPopupMenu implements ActionListener {
|
||||
allSelectedIsSwf = false;
|
||||
break;
|
||||
} else if (item instanceof SWF) {
|
||||
SWF swf = (SWF) item;
|
||||
// Do not allow to close SWF in bundle
|
||||
if (((SWF) item).swfList.isBundle) {
|
||||
if (swf.swfList != null &&swf.swfList.isBundle) {
|
||||
allSelectedIsSwf = false;
|
||||
}
|
||||
}
|
||||
@@ -328,11 +329,15 @@ public class TagTreeContextMenu extends JPopupMenu implements ActionListener {
|
||||
switch (e.getActionCommand()) {
|
||||
case ACTION_OPEN_SWFINSIDE: {
|
||||
List<TreeItem> sel = tagTree.getSelected(tagTree);
|
||||
List<DefineBinaryDataTag> binaryDatas = new ArrayList<>();
|
||||
for (TreeItem item : sel) {
|
||||
if (item instanceof DefineBinaryDataTag) {
|
||||
mainPanel.loadFromBinaryTag((DefineBinaryDataTag) item);
|
||||
DefineBinaryDataTag binaryData = (DefineBinaryDataTag) item;
|
||||
if (binaryData.isSwfData()) {
|
||||
binaryDatas.add((DefineBinaryDataTag) item);
|
||||
}
|
||||
}
|
||||
|
||||
mainPanel.loadFromBinaryTag(binaryDatas);
|
||||
}
|
||||
break;
|
||||
case ACTION_RAW_EDIT: {
|
||||
@@ -359,7 +364,7 @@ public class TagTreeContextMenu extends JPopupMenu implements ActionListener {
|
||||
if (path == null) {
|
||||
return;
|
||||
}
|
||||
View.expandTreeNodesRecursive(tagTree, path, true);
|
||||
View.expandTreeNodes(tagTree, path, true);
|
||||
}
|
||||
break;
|
||||
case ACTION_REMOVE_ITEM:
|
||||
@@ -403,7 +408,14 @@ public class TagTreeContextMenu extends JPopupMenu implements ActionListener {
|
||||
List<TreeItem> sel = tagTree.getSelected(tagTree);
|
||||
for (TreeItem item : sel) {
|
||||
if (item instanceof SWF) {
|
||||
Main.closeFile(((SWF) item).swfList);
|
||||
SWF swf = (SWF) item;
|
||||
if (swf.binaryData != null) {
|
||||
// embedded swf
|
||||
swf.binaryData.innerSwf = null;
|
||||
mainPanel.refreshTree();
|
||||
} else {
|
||||
Main.closeFile(swf.swfList);
|
||||
}
|
||||
} else if (item instanceof SWFList) {
|
||||
Main.closeFile((SWFList) item);
|
||||
}
|
||||
|
||||
@@ -461,7 +461,7 @@ public class TagTreeModel implements TreeModel {
|
||||
} else if (parentNode instanceof Frame) {
|
||||
return ((Frame) parentNode).innerTags.indexOf(childNode);
|
||||
} else if (parentNode instanceof DefineSpriteTag) {
|
||||
return ((Frame) parentNode).frame;
|
||||
return ((Frame) childNode).frame;
|
||||
} else if (parentNode instanceof DefineBinaryDataTag) {
|
||||
return 0; // binary data tag can have only 1 child
|
||||
} else if (parentNode instanceof AS2Package) {
|
||||
|
||||
Reference in New Issue
Block a user