dump view: basic hex view (should be changed to a real hex view component)

This commit is contained in:
honfika
2014-06-22 09:49:12 +02:00
parent 4e0ec9df93
commit 38335ec2e4
23 changed files with 953 additions and 812 deletions
+1 -1
View File
@@ -1526,7 +1526,7 @@ public final class SWF implements TreeItem, Timelined {
final Color fbackgroundColor=backgroundColor; final Color fbackgroundColor=backgroundColor;
final Iterator<BufferedImage> frameImages = new Iterator<BufferedImage>() { final Iterator<BufferedImage> frameImages = new Iterator<BufferedImage>() {
private int pos=0; private final int pos=0;
@Override @Override
public boolean hasNext() { public boolean hasNext() {
@@ -129,10 +129,10 @@ public class ActionScriptParser {
private final boolean debugMode = false; private final boolean debugMode = false;
private static final String AS3_NAMESPACE = "http://adobe.com/AS3/2006/builtin"; private static final String AS3_NAMESPACE = "http://adobe.com/AS3/2006/builtin";
private ABC abc; private final ABC abc;
private List<ABC> otherABCs; private final List<ABC> otherABCs;
private static List<ABC> playerABCs = new ArrayList<>(); private static final List<ABC> playerABCs = new ArrayList<>();
private long uniqId() { private long uniqId() {
uniqLast++; uniqLast++;
@@ -1,36 +1,36 @@
/* /*
* Copyright (C) 2014 JPEXS * Copyright (C) 2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.parser.script; package com.jpexs.decompiler.flash.abc.avm2.parser.script;
import com.jpexs.decompiler.flash.abc.avm2.instructions.jumps.JumpIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.jumps.JumpIns;
/** /**
* *
* @author JPEXS * @author JPEXS
*/ */
public class BreakJumpIns extends JumpIns { public class BreakJumpIns extends JumpIns {
private long loopId; private final long loopId;
public BreakJumpIns(long loopId) { public BreakJumpIns(long loopId) {
this.loopId = loopId; this.loopId = loopId;
} }
public long getLoopId() { public long getLoopId() {
return loopId; return loopId;
} }
} }
@@ -28,7 +28,7 @@ import com.jpexs.decompiler.graph.model.LocalData;
public class ConstAVM2Item extends AVM2Item { public class ConstAVM2Item extends AVM2Item {
private final int namespace; private final int namespace;
private boolean isStatic; private final boolean isStatic;
public String var; public String var;
public GraphTargetItem type; public GraphTargetItem type;
public String customNamespace; public String customNamespace;
@@ -1,37 +1,37 @@
/* /*
* Copyright (C) 2014 JPEXS * Copyright (C) 2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.parser.script; package com.jpexs.decompiler.flash.abc.avm2.parser.script;
import com.jpexs.decompiler.flash.abc.avm2.instructions.jumps.JumpIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.jumps.JumpIns;
/** /**
* *
* @author JPEXS * @author JPEXS
*/ */
public class ContinueJumpIns extends JumpIns { public class ContinueJumpIns extends JumpIns {
private long loopId; private final long loopId;
public ContinueJumpIns(long loopId) { public ContinueJumpIns(long loopId) {
this.loopId = loopId; this.loopId = loopId;
} }
public long getLoopId() { public long getLoopId() {
return loopId; return loopId;
} }
} }
@@ -1,36 +1,36 @@
/* /*
* Copyright (C) 2014 JPEXS * Copyright (C) 2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.parser.script; package com.jpexs.decompiler.flash.abc.avm2.parser.script;
import com.jpexs.decompiler.flash.abc.avm2.instructions.jumps.JumpIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.jumps.JumpIns;
/** /**
* *
* @author JPEXS * @author JPEXS
*/ */
public class FinallyJumpIns extends JumpIns { public class FinallyJumpIns extends JumpIns {
private long finallyClauseId; private final long finallyClauseId;
public FinallyJumpIns(long finallyClauseId) { public FinallyJumpIns(long finallyClauseId) {
this.finallyClauseId = finallyClauseId; this.finallyClauseId = finallyClauseId;
} }
public long getClauseId() { public long getClauseId() {
return finallyClauseId; return finallyClauseId;
} }
} }
@@ -52,7 +52,7 @@ import java.util.List;
*/ */
public class IndexAVM2Item extends AssignableAVM2Item { public class IndexAVM2Item extends AssignableAVM2Item {
private List<Integer> openedNamespaces; private final List<Integer> openedNamespaces;
public GraphTargetItem object; public GraphTargetItem object;
public GraphTargetItem index; public GraphTargetItem index;
public boolean attr; public boolean attr;
@@ -27,9 +27,9 @@ import java.util.List;
*/ */
public class MethodAVM2Item extends FunctionAVM2Item { public class MethodAVM2Item extends FunctionAVM2Item {
private boolean isStatic; private final boolean isStatic;
private boolean isFinal; private final boolean isFinal;
private boolean override; private final boolean override;
public String customNamespace; public String customNamespace;
public boolean isInterface; public boolean isInterface;
@@ -64,8 +64,8 @@ public class PropertyAVM2Item extends AssignableAVM2Item {
public GraphTargetItem object; public GraphTargetItem object;
public ABC abc; public ABC abc;
public List<ABC> otherABCs; public List<ABC> otherABCs;
private List<Integer> openedNamespaces; private final List<Integer> openedNamespaces;
private List<MethodBody> callStack; private final List<MethodBody> callStack;
public List<GraphTargetItem> scopeStack = new ArrayList<GraphTargetItem>(); public List<GraphTargetItem> scopeStack = new ArrayList<GraphTargetItem>();
@Override @Override
@@ -28,7 +28,7 @@ import com.jpexs.decompiler.graph.model.LocalData;
public class SlotAVM2Item extends AVM2Item { public class SlotAVM2Item extends AVM2Item {
private final int namespace; private final int namespace;
private boolean isStatic; private final boolean isStatic;
public String var; public String var;
public GraphTargetItem type; public GraphTargetItem type;
public String customNamespace; public String customNamespace;
@@ -58,7 +58,7 @@ public class UnresolvedAVM2Item extends AssignableAVM2Item {
//private GraphTargetItem ns = null; //private GraphTargetItem ns = null;
public GraphTargetItem resolved; public GraphTargetItem resolved;
public GraphTargetItem resolvedRoot; public GraphTargetItem resolvedRoot;
private boolean mustBeType; private final boolean mustBeType;
public List<String> importedClasses; public List<String> importedClasses;
public List<GraphTargetItem> scopeStack = new ArrayList<GraphTargetItem>(); public List<GraphTargetItem> scopeStack = new ArrayList<GraphTargetItem>();
public List<GraphTargetItem> subtypes; public List<GraphTargetItem> subtypes;
@@ -153,7 +153,7 @@ import java.util.List;
*/ */
public class ActionScriptParser { public class ActionScriptParser {
private int swfVersion; private final int swfVersion;
public ActionScriptParser(int swfVersion) { public ActionScriptParser(int swfVersion) {
this.swfVersion = swfVersion; this.swfVersion = swfVersion;
@@ -596,7 +596,7 @@ public class ActionSourceGenerator implements SourceGenerator {
return ret; return ret;
} }
private final List<String> constantPool; private final List<String> constantPool;
private int swfVersion; private final int swfVersion;
public int getSwfVersion() { public int getSwfVersion() {
return swfVersion; return swfVersion;
@@ -56,7 +56,7 @@ import javax.swing.table.DefaultTableModel;
*/ */
public class AdvancedSettingsDialog extends AppDialog implements ActionListener { public class AdvancedSettingsDialog extends AppDialog implements ActionListener {
private Map<String, Component> componentsMap = new HashMap<>(); private final Map<String, Component> componentsMap = new HashMap<>();
/** /**
* Creates new form AdvancedSettingsDialog * Creates new form AdvancedSettingsDialog
@@ -24,6 +24,7 @@ import javax.swing.JTree;
import javax.swing.plaf.basic.BasicLabelUI; import javax.swing.plaf.basic.BasicLabelUI;
import javax.swing.plaf.basic.BasicTreeUI; import javax.swing.plaf.basic.BasicTreeUI;
import javax.swing.tree.DefaultTreeCellRenderer; import javax.swing.tree.DefaultTreeCellRenderer;
import javax.swing.tree.TreeModel;
/** /**
* *
@@ -72,4 +73,17 @@ public class DumpTree extends JTree {
}); });
} }
@Override
public void setModel(TreeModel tm) {
super.setModel(tm);
if (tm != null) {
int rowCount = tm.getChildCount(tm.getRoot());
for (int i = rowCount - 1; i >= 0; i--) {
expandRow(i);
}
}
}
} }
@@ -0,0 +1,126 @@
/*
* 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.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.table.AbstractTableModel;
import javax.swing.table.JTableHeader;
import javax.swing.table.TableColumn;
import javax.swing.table.TableColumnModel;
/**
*
* @author JPEXS
*/
public class DumpViewPanel extends JPanel {
private final int bytesInRow = 16;
private final JLabel dumpViewLabel;
private final JTable dumpViewHexTable;
private byte[] data;
public DumpViewPanel() {
super(new BorderLayout());
dumpViewLabel = new JLabel();
dumpViewLabel.setMinimumSize(new Dimension(100, 20));
add(dumpViewLabel, BorderLayout.SOUTH);
dumpViewHexTable = new JTable();
dumpViewHexTable.setBackground(Color.white);
dumpViewHexTable.setFont(new Font("Monospaced", Font.PLAIN, 12));
dumpViewHexTable.setTableHeader(new JTableHeader());
dumpViewHexTable.setMaximumSize(new Dimension(200, 200));
TableColumnModel columnModel = dumpViewHexTable.getColumnModel();
columnModel.addColumn(new TableColumn());
columnModel.getColumn(0).setMinWidth(100);
for (int i = 0; i < bytesInRow; i++) {
columnModel.addColumn(new TableColumn());
columnModel.getColumn(i + 1).setWidth(20);
}
for (int i = 0; i < bytesInRow; i++) {
columnModel.addColumn(new TableColumn());
columnModel.getColumn(i + bytesInRow + 1).setWidth(10);
}
dumpViewHexTable.setShowHorizontalLines(false);
dumpViewHexTable.setModel(new AbstractTableModel() {
@Override
public int getRowCount() {
if (data == null) {
return 0;
}
int byteCount = data.length;
int rowCount = byteCount / bytesInRow;
if (byteCount + bytesInRow != 0) {
rowCount++;
}
return rowCount;
}
@Override
public int getColumnCount() {
return 2*bytesInRow + 1;
}
@Override
public String getColumnName(int column) {
if (column == 0) {
return "Address";
} else if (column <= bytesInRow) {
return String.format("%01X", column - 1);
}
return "";
}
@Override
public Object getValueAt(int row, int column) {
if (column == 0) {
return String.format("%08X", (long) row * bytesInRow);
} else if (column <= bytesInRow) {
int pos = row * bytesInRow + column - 1;
if (pos < data.length) {
return String.format("%02X", data[pos]);
}
return null;
} else {
int pos = row * bytesInRow + column - bytesInRow - 1;
if (pos < data.length) {
return (char)data[pos];
}
return null;
}
}
});
add(new JScrollPane(dumpViewHexTable), BorderLayout.CENTER);
}
public void setData(byte[] data) {
this.data = data;
}
public void setLabelText(String text) {
dumpViewLabel.setText(text);
}
}
@@ -1,129 +1,129 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.gui; package com.jpexs.decompiler.flash.gui;
import com.jpexs.decompiler.flash.configuration.Configuration; import com.jpexs.decompiler.flash.configuration.Configuration;
import com.jpexs.decompiler.flash.gui.player.FlashPlayerPanel; import com.jpexs.decompiler.flash.gui.player.FlashPlayerPanel;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Window; import java.awt.Window;
import java.awt.event.ComponentAdapter; import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent; import java.awt.event.ComponentEvent;
import java.awt.event.WindowAdapter; import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent; import java.awt.event.WindowEvent;
import java.awt.event.WindowStateListener; import java.awt.event.WindowStateListener;
import javax.swing.JFrame; import javax.swing.JFrame;
/** /**
* *
* @author JPEXS * @author JPEXS
*/ */
public final class MainFrameClassic extends AppFrame implements MainFrame { public final class MainFrameClassic extends AppFrame implements MainFrame {
public MainPanel panel; public MainPanel panel;
private MainFrameMenu mainMenu; private final MainFrameMenu mainMenu;
public MainFrameClassic() { public MainFrameClassic() {
super(); super();
FlashPlayerPanel flashPanel = null; FlashPlayerPanel flashPanel = null;
try { try {
flashPanel = new FlashPlayerPanel(this); flashPanel = new FlashPlayerPanel(this);
} catch (FlashUnsupportedException fue) { } catch (FlashUnsupportedException fue) {
} }
boolean externalFlashPlayerUnavailable = flashPanel == null; boolean externalFlashPlayerUnavailable = flashPanel == null;
mainMenu = new MainFrameClassicMenu(this, externalFlashPlayerUnavailable); mainMenu = new MainFrameClassicMenu(this, externalFlashPlayerUnavailable);
panel = new MainPanel(this, mainMenu, flashPanel); panel = new MainPanel(this, mainMenu, flashPanel);
int w = Configuration.guiWindowWidth.get(); int w = Configuration.guiWindowWidth.get();
int h = Configuration.guiWindowHeight.get(); int h = Configuration.guiWindowHeight.get();
Dimension dim = java.awt.Toolkit.getDefaultToolkit().getScreenSize(); Dimension dim = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
if (w > dim.width) { if (w > dim.width) {
w = dim.width; w = dim.width;
} }
if (h > dim.height) { if (h > dim.height) {
h = dim.height; h = dim.height;
} }
setSize(w, h); setSize(w, h);
boolean maximizedHorizontal = Configuration.guiWindowMaximizedHorizontal.get(); boolean maximizedHorizontal = Configuration.guiWindowMaximizedHorizontal.get();
boolean maximizedVertical = Configuration.guiWindowMaximizedVertical.get(); boolean maximizedVertical = Configuration.guiWindowMaximizedVertical.get();
int state = 0; int state = 0;
if (maximizedHorizontal) { if (maximizedHorizontal) {
state |= JFrame.MAXIMIZED_HORIZ; state |= JFrame.MAXIMIZED_HORIZ;
} }
if (maximizedVertical) { if (maximizedVertical) {
state |= JFrame.MAXIMIZED_VERT; state |= JFrame.MAXIMIZED_VERT;
} }
setExtendedState(state); setExtendedState(state);
View.setWindowIcon(this); View.setWindowIcon(this);
addWindowStateListener(new WindowStateListener() { addWindowStateListener(new WindowStateListener() {
@Override @Override
public void windowStateChanged(WindowEvent e) { public void windowStateChanged(WindowEvent e) {
int state = e.getNewState(); int state = e.getNewState();
Configuration.guiWindowMaximizedHorizontal.set((state & JFrame.MAXIMIZED_HORIZ) == JFrame.MAXIMIZED_HORIZ); Configuration.guiWindowMaximizedHorizontal.set((state & JFrame.MAXIMIZED_HORIZ) == JFrame.MAXIMIZED_HORIZ);
Configuration.guiWindowMaximizedVertical.set((state & JFrame.MAXIMIZED_VERT) == JFrame.MAXIMIZED_VERT); Configuration.guiWindowMaximizedVertical.set((state & JFrame.MAXIMIZED_VERT) == JFrame.MAXIMIZED_VERT);
} }
}); });
addComponentListener(new ComponentAdapter() { addComponentListener(new ComponentAdapter() {
@Override @Override
public void componentResized(ComponentEvent e) { public void componentResized(ComponentEvent e) {
int state = getExtendedState(); int state = getExtendedState();
if ((state & JFrame.MAXIMIZED_HORIZ) == 0) { if ((state & JFrame.MAXIMIZED_HORIZ) == 0) {
Configuration.guiWindowWidth.set(getWidth()); Configuration.guiWindowWidth.set(getWidth());
} }
if ((state & JFrame.MAXIMIZED_VERT) == 0) { if ((state & JFrame.MAXIMIZED_VERT) == 0) {
Configuration.guiWindowHeight.set(getHeight()); Configuration.guiWindowHeight.set(getHeight());
} }
} }
}); });
addWindowListener(new WindowAdapter() { addWindowListener(new WindowAdapter() {
@Override @Override
public void windowClosing(WindowEvent e) { public void windowClosing(WindowEvent e) {
Main.exit(); Main.exit();
} }
}); });
java.awt.Container cnt = getContentPane(); java.awt.Container cnt = getContentPane();
cnt.setLayout(new BorderLayout()); cnt.setLayout(new BorderLayout());
cnt.add(panel); cnt.add(panel);
View.centerScreen(this); View.centerScreen(this);
} }
@Override @Override
public void setVisible(boolean b) { public void setVisible(boolean b) {
super.setVisible(b); super.setVisible(b);
panel.setVisible(b); panel.setVisible(b);
} }
@Override @Override
public MainPanel getPanel() { public MainPanel getPanel() {
return panel; return panel;
} }
@Override @Override
public Window getWindow() { public Window getWindow() {
return this; return this;
} }
} }
@@ -41,7 +41,7 @@ import org.pushingpixels.flamingo.internal.ui.ribbon.appmenu.JRibbonApplicationM
public final class MainFrameRibbon extends AppRibbonFrame implements MainFrame { public final class MainFrameRibbon extends AppRibbonFrame implements MainFrame {
public MainPanel panel; public MainPanel panel;
private MainFrameMenu mainMenu; private final MainFrameMenu mainMenu;
public MainFrameRibbon() { public MainFrameRibbon() {
super(); super();
@@ -619,7 +619,7 @@ public class MainFrameRibbonMenu implements MainFrameMenu, ActionListener {
mainFrame.panel.reload(true); mainFrame.panel.reload(true);
break; break;
case ACTION_DUMP_VIEW_SWITCH: case ACTION_DUMP_VIEW_SWITCH:
Configuration.internalFlashViewer.set(miDumpView.isSelected()); Configuration.dumpView.set(miDumpView.isSelected());
mainFrame.panel.showDumpView(miDumpView.isSelected()); mainFrame.panel.showDumpView(miDumpView.isSelected());
break; break;
case ACTION_SEARCH: case ACTION_SEARCH:
@@ -227,8 +227,6 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
private final JPanel contentPanel; private final JPanel contentPanel;
private final JPanel displayPanel; private final JPanel displayPanel;
private JPanel folderPreviewPanel; private JPanel folderPreviewPanel;
private JPanel dumpViewPanel;
private JLabel dumpViewLabel; // very very simple dump view, todo: hexview with virtual scrolling
private boolean isWelcomeScreen = true; private boolean isWelcomeScreen = true;
private static final String CARDPREVIEWPANEL = "Preview card"; private static final String CARDPREVIEWPANEL = "Preview card";
private static final String CARDFOLDERPREVIEWPANEL = "Folder preview card"; private static final String CARDFOLDERPREVIEWPANEL = "Folder preview card";
@@ -246,8 +244,9 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
private JPanel detailPanel; private JPanel detailPanel;
private JTextField filterField = new MyTextField(""); private JTextField filterField = new MyTextField("");
private JPanel searchPanel; private JPanel searchPanel;
private PreviewPanel previewPanel; private final PreviewPanel previewPanel;
private JPanel treePanel; private DumpViewPanel dumpViewPanel;
private final JPanel treePanel;
private AbortRetryIgnoreHandler errorHandler = new GuiAbortRetryIgnoreHandler(); private AbortRetryIgnoreHandler errorHandler = new GuiAbortRetryIgnoreHandler();
private CancellableWorker setSourceWorker; private CancellableWorker setSourceWorker;
public TreeNode oldNode; public TreeNode oldNode;
@@ -502,9 +501,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
private JPanel createDumpPreviewCard() { private JPanel createDumpPreviewCard() {
JPanel dumpViewCard = new JPanel(new BorderLayout()); JPanel dumpViewCard = new JPanel(new BorderLayout());
dumpViewPanel = new JPanel(new WrapLayout(FlowLayout.LEFT)); dumpViewPanel = new DumpViewPanel();
dumpViewLabel = new JLabel();
dumpViewPanel.add(dumpViewLabel);
dumpViewCard.add(new JScrollPane(dumpViewPanel), BorderLayout.CENTER); dumpViewCard.add(new JScrollPane(dumpViewPanel), BorderLayout.CENTER);
return dumpViewCard; return dumpViewCard;
@@ -1761,7 +1758,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
File textsFolder = new File(Path.combine(folder, TextExporter.TEXT_EXPORT_FOLDER)); File textsFolder = new File(Path.combine(folder, TextExporter.TEXT_EXPORT_FOLDER));
String[] files = textsFolder.list(new FilenameFilter() { String[] files = textsFolder.list(new FilenameFilter() {
private Pattern pat = Pattern.compile("\\d+\\.txt", Pattern.CASE_INSENSITIVE); private final Pattern pat = Pattern.compile("\\d+\\.txt", Pattern.CASE_INSENSITIVE);
@Override @Override
public boolean accept(File dir, String name) { public boolean accept(File dir, String name) {
@@ -2385,15 +2382,19 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
} }
private void dumpTreeValueChanged(TreeSelectionEvent e) { private void dumpTreeValueChanged(TreeSelectionEvent e) {
showCard(CARDDUMPVIEW);
DumpInfo dumpInfo = (DumpInfo) e.getPath().getLastPathComponent(); DumpInfo dumpInfo = (DumpInfo) e.getPath().getLastPathComponent();
if (dumpInfo.lengthBytes != 0 || dumpInfo.lengthBits != 0) { if (dumpInfo.lengthBytes != 0 || dumpInfo.lengthBits != 0) {
// todo // todo
dumpViewLabel.setText("startByte: " + dumpInfo.startByte + dumpViewPanel.setLabelText("startByte: " + dumpInfo.startByte +
" startBit: " + dumpInfo.startBit + " startBit: " + dumpInfo.startBit +
" lengthBytes: " + dumpInfo.lengthBytes + " lengthBytes: " + dumpInfo.lengthBytes +
" lengthBits: " + dumpInfo.lengthBits); " lengthBits: " + dumpInfo.lengthBits);
} }
// todo honfika: support multiple swf
dumpViewPanel.setData(swfs.get(0).swfs.get(0).uncompressedData);
dumpViewPanel.revalidate();
showCard(CARDDUMPVIEW);
} }
@Override @Override
@@ -51,7 +51,7 @@ public class QuickFindPanel extends JPanel implements ActionListener, jsyntaxpan
public JCheckBox ignoreCaseCheckbox,regExpCheckbox,wrapCheckbox; public JCheckBox ignoreCaseCheckbox,regExpCheckbox,wrapCheckbox;
public JLabel statusLabel; public JLabel statusLabel;
private Markers.SimpleMarker marker = new Markers.SimpleMarker(Color.PINK); private final Markers.SimpleMarker marker = new Markers.SimpleMarker(Color.PINK);
private WeakReference<JTextComponent> target; private WeakReference<JTextComponent> target;
private WeakReference<DocumentSearchData> dsd; private WeakReference<DocumentSearchData> dsd;
private int oldCaretPosition; private int oldCaretPosition;
File diff suppressed because it is too large Load Diff
@@ -26,7 +26,7 @@ import com.jpexs.decompiler.flash.SWFInputStream;
*/ */
public class TagStub extends Tag { public class TagStub extends Tag {
private SWFInputStream dataStream; private final SWFInputStream dataStream;
/** /**
* Constructor * Constructor