mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-25 13:10:46 +00:00
Fixed code style
This commit is contained in:
@@ -968,7 +968,7 @@ public class CommandLineArgumentParser {
|
||||
}
|
||||
final File inFile = new File(args.pop());
|
||||
final File outFile = new File(args.pop());
|
||||
|
||||
|
||||
processModifyAbc(inFile, outFile, null, new AbcAction() {
|
||||
@Override
|
||||
public void abcAction(ABC abc, OutputStream stdout) throws IOException {
|
||||
@@ -4425,11 +4425,11 @@ public class CommandLineArgumentParser {
|
||||
switch (key.toLowerCase()) {
|
||||
case "version":
|
||||
try {
|
||||
version = Integer.valueOf(value);
|
||||
} catch (NumberFormatException nfe) {
|
||||
badArguments("header");
|
||||
}
|
||||
break;
|
||||
version = Integer.valueOf(value);
|
||||
} catch (NumberFormatException nfe) {
|
||||
badArguments("header");
|
||||
}
|
||||
break;
|
||||
case "gfx":
|
||||
gfx = parseBooleanConfigValue(value);
|
||||
if (gfx == null) {
|
||||
@@ -4519,18 +4519,18 @@ public class CommandLineArgumentParser {
|
||||
break;
|
||||
case "framecount":
|
||||
try {
|
||||
frameCount = Integer.valueOf(value);
|
||||
} catch (NumberFormatException nfe) {
|
||||
badArguments("header");
|
||||
}
|
||||
break;
|
||||
frameCount = Integer.valueOf(value);
|
||||
} catch (NumberFormatException nfe) {
|
||||
badArguments("header");
|
||||
}
|
||||
break;
|
||||
case "framerate":
|
||||
try {
|
||||
frameRate = Float.valueOf(value);
|
||||
} catch (NumberFormatException nfe) {
|
||||
badArguments("header");
|
||||
}
|
||||
break;
|
||||
frameRate = Float.valueOf(value);
|
||||
} catch (NumberFormatException nfe) {
|
||||
badArguments("header");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
badArguments("header");
|
||||
}
|
||||
@@ -4754,7 +4754,7 @@ public class CommandLineArgumentParser {
|
||||
}
|
||||
|
||||
private static void processModifyAbc(File inFile, File outFile, File stdOutFile, AbcAction action, String charset) {
|
||||
|
||||
|
||||
//It does not have .abc extension, assuming its SWF - process all its ABC tags
|
||||
if (!inFile.getAbsolutePath().toLowerCase().endsWith(".abc")) {
|
||||
SwfAction swfAction = new SwfAction() {
|
||||
@@ -4769,7 +4769,7 @@ public class CommandLineArgumentParser {
|
||||
processModifySWF(inFile, outFile, stdOutFile, swfAction, charset);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
OutputStream stdout = null;
|
||||
|
||||
try {
|
||||
|
||||
@@ -37,15 +37,16 @@ import org.fusesource.jansi.AnsiConsole;
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class CommandLineHelp {
|
||||
|
||||
private static Map<String, List<Command>> commands = new LinkedHashMap<>();
|
||||
private static Map<String, Option> preOptions = new LinkedHashMap<>();
|
||||
private static String preface = null;
|
||||
private static Map<String, String> aliasMap = new HashMap<>();
|
||||
|
||||
|
||||
static {
|
||||
parse();
|
||||
parse();
|
||||
}
|
||||
|
||||
|
||||
private static String getPreface(String command, String arguments) {
|
||||
String ret = preface;
|
||||
if (command != null) {
|
||||
@@ -55,32 +56,33 @@ public class CommandLineHelp {
|
||||
ret = ret.replace("Executable:", "@|bold,underline Executable|@:");
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
private static String hilight(String str) {
|
||||
str = str.replaceAll("<[a-zA-Z_0-9]+>", "@|italic $0|@");
|
||||
str = str.replaceAll("(^|[ \\[\\(\\|\n])(-[a-zA-Z_0-9]+)", "$1@|yellow $2|@");
|
||||
str = str.replaceAll("@\\|yellow (-[a-zA-Z_0-9]+)\\|@ command", "@|bold $1|@ command");
|
||||
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
private static String indentArguments(String arguments, String commandName) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < commandName.length(); i++) {
|
||||
sb.append(" ");
|
||||
}
|
||||
sb.append(" ");
|
||||
return arguments.replace("\r\n", "\r\n" + sb.toString());
|
||||
return arguments.replace("\r\n", "\r\n" + sb.toString());
|
||||
}
|
||||
|
||||
|
||||
private static class Command {
|
||||
|
||||
String name;
|
||||
String customSynopsis;
|
||||
String arguments;
|
||||
String header;
|
||||
String description;
|
||||
List<String> aliases;
|
||||
|
||||
|
||||
List<Option> preOptions = new ArrayList<>();
|
||||
|
||||
public Command(String name, String customSynopsis, String arguments, String header, String description, List<String> aliases) {
|
||||
@@ -95,8 +97,8 @@ public class CommandLineHelp {
|
||||
@Override
|
||||
public String toString() {
|
||||
return name + " " + header;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public String getHeader(int padWidth) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
StringBuilder sbRaw = new StringBuilder();
|
||||
@@ -106,43 +108,42 @@ public class CommandLineHelp {
|
||||
List<String> aliasesBold = new ArrayList<>();
|
||||
for (String alias : aliases) {
|
||||
aliasesBold.add("@|bold " + alias + "|@");
|
||||
}
|
||||
}
|
||||
sb.append(" | ").append(String.join(" | ", aliasesBold));
|
||||
sbRaw.append(" | ").append(String.join(" | ", aliases));
|
||||
}
|
||||
while(sbRaw.length() < padWidth - 2) {
|
||||
while (sbRaw.length() < padWidth - 2) {
|
||||
sb.append(" ");
|
||||
sbRaw.append(" ");
|
||||
}
|
||||
sb.append(" ");
|
||||
sbRaw.append(" ");
|
||||
|
||||
|
||||
if (sbRaw.length() > padWidth) {
|
||||
sb.append("\r\n");
|
||||
for (int i = 0; i < padWidth; i++) {
|
||||
sb.append(" ");
|
||||
}
|
||||
}
|
||||
}
|
||||
sb.append(header);
|
||||
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
public String getHelp(boolean includePreOptions, boolean includePreface) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
|
||||
if (includePreface) {
|
||||
sb.append(header).append("\r\n");
|
||||
}
|
||||
|
||||
|
||||
String synopsis;
|
||||
String hilightedArguments = "";
|
||||
String hilightedName = "";
|
||||
if (customSynopsis != null) {
|
||||
synopsis = customSynopsis;
|
||||
} else {
|
||||
hilightedName = "@|bold " + name + "|@ ";
|
||||
hilightedName = "@|bold " + name + "|@ ";
|
||||
hilightedArguments = hilight(indentArguments(arguments, name));
|
||||
synopsis = hilightedName + hilightedArguments;
|
||||
}
|
||||
@@ -153,18 +154,18 @@ public class CommandLineHelp {
|
||||
sb.append("@|bold,underline Aliases|@:");
|
||||
for (String alias : aliases) {
|
||||
sb.append("\r\n@|bold ").append(alias).append("|@");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
sb.append(synopsis);
|
||||
if (!aliases.isEmpty()) {
|
||||
for (String alias : aliases) {
|
||||
sb.append("\r\nalias @|bold ").append(alias).append("|@");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!includePreface) {
|
||||
sb.append("\r\n");
|
||||
sb.append("\r\n");
|
||||
sb.append(indent(header));
|
||||
}
|
||||
if (!description.isEmpty()) {
|
||||
@@ -180,59 +181,60 @@ public class CommandLineHelp {
|
||||
sb.append("@|bold,underline Pre-options|@:");
|
||||
for (Option opt : preOptions) {
|
||||
sb.append("\r\n");
|
||||
sb.append(opt.getHelp(false)).append("\r\n");
|
||||
sb.append(opt.getHelp(false)).append("\r\n");
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
public void addPreOption(Option option) {
|
||||
preOptions.add(option);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static String indent(String text) {
|
||||
String indent = " ";
|
||||
return indent + rtrim(text.replace("\r\n", "\r\n" + indent));
|
||||
}
|
||||
|
||||
|
||||
private static String rtrim(String text) {
|
||||
return text.replaceAll("\\s+$","");
|
||||
return text.replaceAll("\\s+$", "");
|
||||
}
|
||||
|
||||
|
||||
private static class Option {
|
||||
|
||||
String name;
|
||||
String arguments;
|
||||
String appliesTo;
|
||||
String description;
|
||||
String description;
|
||||
|
||||
public Option(String name, String arguments, String appliesTo, String description) {
|
||||
this.name = name;
|
||||
this.arguments = arguments;
|
||||
this.appliesTo = appliesTo;
|
||||
this.description = description;
|
||||
}
|
||||
}
|
||||
|
||||
public String getHelp(boolean getAppliesTos) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("@|yellow ").append(name).append("|@").append(" ").append(hilight(arguments)).append("\r\n");
|
||||
if (getAppliesTos) {
|
||||
if (getAppliesTos) {
|
||||
sb.append(indent("Applies to: " + appliesTo.replaceAll("-[a-zA-Z_0-9]+", "@|bold $0|@"))).append("\r\n");
|
||||
}
|
||||
sb.append(indent(hilight(description)));
|
||||
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static void parse() {
|
||||
InputStream is = CommandLineHelp.class.getClassLoader().getResourceAsStream("com/jpexs/decompiler/flash/console/help.txt");
|
||||
try(BufferedReader br = new BufferedReader(new InputStreamReader(is, Utf8Helper.charset))) {
|
||||
InputStream is = CommandLineHelp.class.getClassLoader().getResourceAsStream("com/jpexs/decompiler/flash/console/help.txt");
|
||||
try (BufferedReader br = new BufferedReader(new InputStreamReader(is, Utf8Helper.charset))) {
|
||||
String s;
|
||||
boolean commandsSection = false;
|
||||
boolean optionsSection = false;
|
||||
@@ -261,11 +263,11 @@ public class CommandLineHelp {
|
||||
commandsSection = false;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (prefaceSection) {
|
||||
prefaceBuilder.append(s).append("\r\n");
|
||||
}
|
||||
|
||||
|
||||
if (commandsSection) {
|
||||
if (s.isEmpty()) {
|
||||
if (itemName != null) {
|
||||
@@ -315,7 +317,7 @@ public class CommandLineHelp {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (optionsSection) {
|
||||
if (s.isEmpty()) {
|
||||
if (itemName != null) {
|
||||
@@ -348,7 +350,7 @@ public class CommandLineHelp {
|
||||
itemName = s;
|
||||
arguments = "";
|
||||
}
|
||||
descriptionBuffer.setLength(0);
|
||||
descriptionBuffer.setLength(0);
|
||||
appliesToSection = true;
|
||||
} else if (s.startsWith(" ")) {
|
||||
if (appliesToSection && s.startsWith(" Applies to: ")) {
|
||||
@@ -364,13 +366,13 @@ public class CommandLineHelp {
|
||||
Logger.getLogger(CommandLineHelp.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void printCmdLineUsage(PrintStream out, String filter) {
|
||||
AnsiConsole.systemInstall();
|
||||
if (filter == null) {
|
||||
out.println(getPreface(null, null));
|
||||
out.println();
|
||||
|
||||
|
||||
out.println("@|bold,underline Global pre-options|@:");
|
||||
for (Option opt : preOptions.values()) {
|
||||
if ("*".equals(opt.appliesTo)) {
|
||||
@@ -378,7 +380,7 @@ public class CommandLineHelp {
|
||||
}
|
||||
}
|
||||
out.println();
|
||||
|
||||
|
||||
out.println("@|bold,underline Commands:|@");
|
||||
for (String name : commands.keySet()) {
|
||||
if ("main".equals(name)) {
|
||||
@@ -386,13 +388,13 @@ public class CommandLineHelp {
|
||||
}
|
||||
List<Command> list = commands.get(name);
|
||||
for (Command c : list) {
|
||||
out.println(c.getHeader(20));
|
||||
out.println(c.getHeader(20));
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if ("all".equals(filter)) {
|
||||
out.println(getPreface(null, null));
|
||||
out.println();
|
||||
|
||||
|
||||
out.println("@|bold,underline Commands:|@");
|
||||
for (String name : commands.keySet()) {
|
||||
if ("main".equals(name)) {
|
||||
@@ -403,21 +405,21 @@ public class CommandLineHelp {
|
||||
out.println(c.getHelp(false, false));
|
||||
out.println();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
out.println("@|bold,underline Pre-options|@:");
|
||||
for (Option opt : preOptions.values()) {
|
||||
out.println(opt.getHelp(true));
|
||||
out.println(opt.getHelp(true));
|
||||
}
|
||||
out.println();
|
||||
} else {
|
||||
|
||||
} else {
|
||||
|
||||
if (aliasMap.containsKey("-" + filter)) {
|
||||
filter = aliasMap.get("-" + filter).substring(1);
|
||||
} else if (aliasMap.containsKey(filter)) {
|
||||
filter = aliasMap.get(filter).substring(1);
|
||||
}
|
||||
|
||||
|
||||
if (commands.containsKey("-" + filter.toLowerCase())) {
|
||||
boolean first = true;
|
||||
for (Command c : commands.get("-" + filter.toLowerCase())) {
|
||||
@@ -438,8 +440,8 @@ public class CommandLineHelp {
|
||||
}
|
||||
AnsiConsole.systemUninstall();
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
public static void main(String[] args) {
|
||||
printCmdLineUsage(System.out, "export");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ public class StdInAwareFileInputStream extends InputStream implements AutoClosea
|
||||
|
||||
public StdInAwareFileInputStream(String file) throws FileNotFoundException {
|
||||
this(new File(file));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int available() throws IOException {
|
||||
@@ -66,7 +66,7 @@ public class StdInAwareFileInputStream extends InputStream implements AutoClosea
|
||||
public void close() throws IOException {
|
||||
is.close();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int read() throws IOException {
|
||||
return is.read();
|
||||
|
||||
@@ -98,7 +98,7 @@ public final class BinaryPanel extends JPanel {
|
||||
hexEditor.setData(data, null, null);
|
||||
boolean isSwfData = binaryData.isSwfData();
|
||||
if (isSwfData) {
|
||||
swfOrPackedDataInsideLabel.setText(AppStrings.translate("binarydata.swfInside"));
|
||||
swfOrPackedDataInsideLabel.setText(AppStrings.translate("binarydata.swfInside"));
|
||||
} else {
|
||||
binaryData.detectPacker();
|
||||
if (binaryData.getUsedPacker() != null) {
|
||||
|
||||
@@ -46,27 +46,27 @@ import javax.swing.table.DefaultTableModel;
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class BreakpointListDialog extends AppDialog {
|
||||
|
||||
private SWF swf;
|
||||
private JTable table = new JTable();
|
||||
private List<Breakpoint> breakpointList = new ArrayList<>();
|
||||
private Timer refreshTimer = null;
|
||||
private static final int REFRESH_TIMEOUT = 1000;
|
||||
|
||||
|
||||
|
||||
private class Breakpoint {
|
||||
|
||||
public String scriptName;
|
||||
public int line;
|
||||
|
||||
public Breakpoint(String scriptName, int line) {
|
||||
this.scriptName = scriptName;
|
||||
this.line = line;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public BreakpointListDialog(Window owner, SWF swf) {
|
||||
super(owner);
|
||||
|
||||
|
||||
setDefaultCloseOperation(HIDE_ON_CLOSE);
|
||||
setTitle(translate("dialog.title") + " - " + swf.getShortFileName());
|
||||
this.swf = swf;
|
||||
@@ -79,47 +79,45 @@ public class BreakpointListDialog extends AppDialog {
|
||||
int row = table.rowAtPoint(e.getPoint());
|
||||
if (table.getSelectedRow() != -1 && row != -1) {
|
||||
gotoButtonActionPerformed(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
Container cnt = getContentPane();
|
||||
cnt.setLayout(new BorderLayout());
|
||||
cnt.add(new JScrollPane(table), BorderLayout.CENTER);
|
||||
|
||||
|
||||
JPanel buttonsPanel = new JPanel(new FlowLayout());
|
||||
|
||||
|
||||
JButton gotoButton = new JButton(translate("button.goto"));
|
||||
gotoButton.addActionListener(this::gotoButtonActionPerformed);
|
||||
buttonsPanel.add(gotoButton);
|
||||
|
||||
|
||||
JButton removeButton = new JButton(translate("button.remove"));
|
||||
removeButton.addActionListener(this::removeButtonActionPerformed);
|
||||
buttonsPanel.add(removeButton);
|
||||
|
||||
|
||||
JButton removeAllButton = new JButton(translate("button.removeAll"));
|
||||
removeAllButton.addActionListener(this::removeAllButtonActionPerformed);
|
||||
buttonsPanel.add(removeAllButton);
|
||||
|
||||
|
||||
JButton closeButton = new JButton(translate("button.close"));
|
||||
closeButton.addActionListener(this::closeButtonActionPerformed);
|
||||
buttonsPanel.add(closeButton);
|
||||
|
||||
|
||||
cnt.add(buttonsPanel, BorderLayout.SOUTH);
|
||||
|
||||
|
||||
refresh();
|
||||
|
||||
|
||||
setSize(500, 300);
|
||||
|
||||
|
||||
//View.setWindowIcon(this);
|
||||
List<Image> images = new ArrayList<>();
|
||||
images.add(View.loadImage("breakpointlist16"));
|
||||
setIconImages(images);
|
||||
View.centerScreen(this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private Breakpoint getSelected() {
|
||||
int row = table.getSelectedRow();
|
||||
if (row == -1) {
|
||||
@@ -127,11 +125,11 @@ public class BreakpointListDialog extends AppDialog {
|
||||
}
|
||||
return breakpointList.get(row);
|
||||
}
|
||||
|
||||
|
||||
private void closeButtonActionPerformed(ActionEvent evt) {
|
||||
setVisible(false);
|
||||
}
|
||||
|
||||
|
||||
private void removeButtonActionPerformed(ActionEvent evt) {
|
||||
Breakpoint breakpoint = getSelected();
|
||||
if (breakpoint == null) {
|
||||
@@ -141,8 +139,7 @@ public class BreakpointListDialog extends AppDialog {
|
||||
refreshMarkers();
|
||||
refresh();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void refreshMarkers() {
|
||||
if (swf.isAS3()) {
|
||||
Main.getMainFrame().getPanel().getABCPanel().decompiledTextArea.refreshMarkers();
|
||||
@@ -152,13 +149,13 @@ public class BreakpointListDialog extends AppDialog {
|
||||
Main.getMainFrame().getPanel().getActionPanel().editor.refreshMarkers();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void removeAllButtonActionPerformed(ActionEvent evt) {
|
||||
Main.getDebugHandler().clearBreakPoints(swf);
|
||||
refreshMarkers();
|
||||
refresh();
|
||||
}
|
||||
|
||||
|
||||
private void gotoButtonActionPerformed(ActionEvent evt) {
|
||||
Breakpoint breakpoint = getSelected();
|
||||
if (breakpoint == null) {
|
||||
@@ -184,26 +181,25 @@ public class BreakpointListDialog extends AppDialog {
|
||||
int abcIndex = Integer.parseInt(m.group("abc"));
|
||||
int bodyIndex = Integer.parseInt(m.group("body"));
|
||||
ABC abc = swf.getAbcList().get(abcIndex).getABC();
|
||||
methodIndex = abc.bodies.get(bodyIndex).method_info;
|
||||
methodIndex = abc.bodies.get(bodyIndex).method_info;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Main.getMainFrame().getPanel().gotoScriptLine(swf, breakpoint.scriptName, breakpoint.line, classIndex, traitIndex, methodIndex, breakpoint.scriptName.startsWith("#PCODE"));
|
||||
}
|
||||
|
||||
public void refresh() {
|
||||
|
||||
public void refresh() {
|
||||
DefaultTableModel defaultTableModel = new DefaultTableModel() {
|
||||
@Override
|
||||
public boolean isCellEditable(int row, int column) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
};
|
||||
defaultTableModel.addColumn(translate("breakpoint.scriptName"));
|
||||
defaultTableModel.addColumn(translate("breakpoint.line"));
|
||||
defaultTableModel.addColumn(translate("breakpoint.status"));
|
||||
|
||||
defaultTableModel.addColumn(translate("breakpoint.status"));
|
||||
|
||||
Map<String, Set<Integer>> breakpoints = Main.getDebugHandler().getAllBreakPoints(swf, false);
|
||||
|
||||
|
||||
List<Breakpoint> newBreakpointList = new ArrayList<>();
|
||||
for (String scriptName : breakpoints.keySet()) {
|
||||
for (int line : breakpoints.get(scriptName)) {
|
||||
@@ -242,12 +238,12 @@ public class BreakpointListDialog extends AppDialog {
|
||||
@Override
|
||||
public void run() {
|
||||
refresh();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}, REFRESH_TIMEOUT, REFRESH_TIMEOUT);
|
||||
}
|
||||
super.setVisible(b);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ public class ClipboardPanel extends JPanel {
|
||||
clearButton.setToolTipText(AppStrings.translate("clipboard.clear.frame"));
|
||||
} else {
|
||||
label.setToolTipText(AppStrings.translate("clipboard.hint"));
|
||||
clearButton.setToolTipText(AppStrings.translate("clipboard.clear"));
|
||||
clearButton.setToolTipText(AppStrings.translate("clipboard.clear"));
|
||||
}
|
||||
setVisible(clipboardSize > 0);
|
||||
}
|
||||
|
||||
@@ -43,13 +43,13 @@ public class CollectDepthAsSpritesDialog extends AppDialog {
|
||||
private final JButton okButton = new JButton(translate("button.ok"));
|
||||
|
||||
private final JButton cancelButton = new JButton(translate("button.cancel"));
|
||||
|
||||
|
||||
private final JList<Integer> depthsList;
|
||||
|
||||
private final JCheckBox replaceCheckBox;
|
||||
|
||||
private final JCheckBox offsetCheckBox;
|
||||
|
||||
|
||||
private final JCheckBox firstMatrixCheckBox;
|
||||
|
||||
private int result = ERROR_OPTION;
|
||||
@@ -61,21 +61,21 @@ public class CollectDepthAsSpritesDialog extends AppDialog {
|
||||
Container cnt = getContentPane();
|
||||
cnt.setLayout(new BoxLayout(cnt, BoxLayout.Y_AXIS));
|
||||
cnt.add(new JLabel(translate("collect.depths")));
|
||||
|
||||
|
||||
depthsList = new JList<>();
|
||||
depthsList.setVisibleRowCount(7);
|
||||
depthsList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
|
||||
|
||||
|
||||
JScrollPane listScroller = new FasterScrollPane(depthsList);
|
||||
listScroller.setPreferredSize(new Dimension(400, 200));
|
||||
cnt.add(listScroller);
|
||||
|
||||
|
||||
replaceCheckBox = new JCheckBox(translate("collect.replace"));
|
||||
cnt.add(replaceCheckBox);
|
||||
|
||||
|
||||
offsetCheckBox = new JCheckBox(translate("collect.offset"));
|
||||
cnt.add(offsetCheckBox);
|
||||
|
||||
|
||||
firstMatrixCheckBox = new JCheckBox(translate("collect.matrix"));
|
||||
cnt.add(firstMatrixCheckBox);
|
||||
|
||||
@@ -112,20 +112,20 @@ public class CollectDepthAsSpritesDialog extends AppDialog {
|
||||
|
||||
return depthsList.getSelectedValuesList();
|
||||
}
|
||||
|
||||
|
||||
public boolean getReplace() {
|
||||
return replaceCheckBox.isSelected();
|
||||
}
|
||||
|
||||
|
||||
public boolean getOffset() {
|
||||
return offsetCheckBox.isSelected();
|
||||
}
|
||||
|
||||
|
||||
public boolean getEnsureFirstMatrix() {
|
||||
return firstMatrixCheckBox.isSelected();
|
||||
}
|
||||
|
||||
public int showDialog(Collection<Integer> depths) {
|
||||
public int showDialog(Collection<Integer> depths) {
|
||||
depthsList.setListData(depths.toArray(new Integer[depths.size()]));
|
||||
depthsList.setVisibleRowCount(7);
|
||||
setVisible(true);
|
||||
|
||||
@@ -62,7 +62,7 @@ public class ConfigurationDirectorySelection extends JPanel {
|
||||
JFileChooser fc = new JFileChooser();
|
||||
fc.setSelectedFile(new File(current));
|
||||
fc.setMultiSelectionEnabled(false);
|
||||
fc.setCurrentDirectory(new File((String) config.get()));
|
||||
fc.setCurrentDirectory(new File((String) config.get()));
|
||||
fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
|
||||
fc.setAcceptAllFileFilterUsed(false);
|
||||
int returnVal = fc.showOpenDialog(Main.getDefaultMessagesComponent());
|
||||
|
||||
@@ -61,7 +61,7 @@ public class DebugLogDialog extends AppDialog {
|
||||
public void onMessage(String clientId, String msg) {
|
||||
log(translate("msg.header").replace("%clientid%", clientId) + msg);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onLoaderURL(String clientId, String url) {
|
||||
log(translate("msg.header").replace("%clientid%", clientId) + " LOADURL:" + url);
|
||||
@@ -75,7 +75,7 @@ public class DebugLogDialog extends AppDialog {
|
||||
@Override
|
||||
public void onDumpByteArray(String clientId, byte[] data) {
|
||||
log(translate("msg.header").replace("%clientid%", clientId) + " DUMPBYTEARRAY: " + data.length + "B");
|
||||
}
|
||||
}
|
||||
});
|
||||
Container cnt = getContentPane();
|
||||
cnt.setLayout(new BorderLayout());
|
||||
|
||||
@@ -77,7 +77,7 @@ public class DebugPanel extends JPanel {
|
||||
|
||||
private MyTreeTable debugLocalsTable; //JTable debugLocalsTable;
|
||||
|
||||
private MyTreeTable debugScopeTable;
|
||||
private MyTreeTable debugScopeTable;
|
||||
|
||||
private JTable constantPoolTable;
|
||||
|
||||
@@ -86,7 +86,7 @@ public class DebugPanel extends JPanel {
|
||||
private BreakListener breakListener;
|
||||
|
||||
private DebuggerHandler.FrameChangeListener frameChangeListener;
|
||||
|
||||
|
||||
private JTextArea traceLogTextarea;
|
||||
|
||||
private int logLength = 0;
|
||||
@@ -146,7 +146,7 @@ public class DebugPanel extends JPanel {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void logAdd(String message) {
|
||||
boolean wasEmpty = logLength == 0;
|
||||
String add = message + "\r\n";
|
||||
@@ -208,12 +208,12 @@ public class DebugPanel extends JPanel {
|
||||
if (isByteArray) {
|
||||
JMenu exportMenu = new JMenu(AppStrings.translate("debug.export").replace("%name%", v.name));
|
||||
JMenuItem exportByteArrayMenuItem = new JMenuItem(AppStrings.translate("debug.export.bytearray"));
|
||||
exportByteArrayMenuItem.addActionListener((ActionEvent e1) -> {
|
||||
exportByteArrayMenuItem.addActionListener((ActionEvent e1) -> {
|
||||
JFileChooser fc = new JFileChooser();
|
||||
fc.setCurrentDirectory(new File(Configuration.lastExportDir.get()));
|
||||
if (fc.showSaveDialog(Main.getDefaultMessagesComponent()) == JFileChooser.APPROVE_OPTION) {
|
||||
File file = Helper.fixDialogFile(fc.getSelectedFile());
|
||||
|
||||
|
||||
//Variant with direct calling readByte - SLOW
|
||||
/*
|
||||
try (FileOutputStream fos = new FileOutputStream(file)) {
|
||||
@@ -224,7 +224,7 @@ public class DebugPanel extends JPanel {
|
||||
Logger.getLogger(DebugPanel.class.getName()).log(Level.SEVERE, null, ex);
|
||||
ViewMessages.showMessageDialog(Main.getDefaultMessagesComponent(), AppStrings.translate("error.file.save") + ": " + ex.getLocalizedMessage(), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
*/
|
||||
*/
|
||||
//Asynchronous variant
|
||||
/*DebuggerTools.initDebugger().addMessageListener(new DebugAdapter() {
|
||||
|
||||
@@ -245,34 +245,33 @@ public class DebugPanel extends JPanel {
|
||||
Main.getDebugHandler().callMethod(debugConnectionClass, "writeMsg", Arrays.asList(v, (Double) (double) Debugger.MSG_DUMP_BYTEARRAY));
|
||||
} catch (DebuggerHandler.ActionScriptException ex) {
|
||||
Logger.getLogger(DebugPanel.class.getName()).log(Level.SEVERE, "Error exporting ByteArray", ex);
|
||||
}*/
|
||||
|
||||
}*/
|
||||
//Variant using comma separated bytes, pretty fast
|
||||
try {
|
||||
Variable debugConnectionClass = Main.getDebugHandler().getVariable(0, Main.currentDebuggerPackage + "::DebugConnection", false, false).parent;
|
||||
Variable debugConnectionClass = Main.getDebugHandler().getVariable(0, Main.currentDebuggerPackage + "::DebugConnection", false, false).parent;
|
||||
String dataStr = (String) Main.getDebugHandler().callMethod(debugConnectionClass, "readCommaSeparatedFromByteArray", Arrays.asList(v)).variables.get(0).value;
|
||||
String[] parts = dataStr.split(",");
|
||||
byte[] data = new byte[parts.length];
|
||||
for (int i = 0; i < parts.length; i++) {
|
||||
data[i] = (byte) Integer.parseInt(parts[i]);
|
||||
}
|
||||
|
||||
|
||||
try (FileOutputStream fos = new FileOutputStream(file)) {
|
||||
fos.write(data);
|
||||
Configuration.lastExportDir.set(file.getParentFile().getAbsolutePath());
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(DebugPanel.class.getName()).log(Level.SEVERE, null, ex);
|
||||
Logger.getLogger(DebugPanel.class.getName()).log(Level.SEVERE, null, ex);
|
||||
ViewMessages.showMessageDialog(Main.getDefaultMessagesComponent(), AppStrings.translate("error.file.save") + ": " + ex.getLocalizedMessage(), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
} catch (DebuggerHandler.ActionScriptException ex) {
|
||||
Logger.getLogger(DebugPanel.class.getName()).log(Level.SEVERE, "Error exporting ByteArray", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
exportMenu.add(exportByteArrayMenuItem);
|
||||
pm.add(exportMenu);
|
||||
|
||||
|
||||
JMenu importMenu = new JMenu(AppStrings.translate("debug.import").replace("%name%", v.name));
|
||||
JMenuItem importByteArrayMenuItem = new JMenuItem(AppStrings.translate("debug.import.bytearray"));
|
||||
importByteArrayMenuItem.addActionListener((ActionEvent e1) -> {
|
||||
@@ -281,7 +280,7 @@ public class DebugPanel extends JPanel {
|
||||
if (fc.showOpenDialog(Main.getDefaultMessagesComponent()) == JFileChooser.APPROVE_OPTION) {
|
||||
File file = Helper.fixDialogFile(fc.getSelectedFile());
|
||||
Configuration.lastOpenDir.set(file.getParentFile().getAbsolutePath());
|
||||
|
||||
|
||||
//Variant with asynchronous connection
|
||||
/*DebuggerTools.initDebugger().addMessageListener(new DebugAdapter() {
|
||||
@Override
|
||||
@@ -303,7 +302,6 @@ public class DebugPanel extends JPanel {
|
||||
} catch (DebuggerHandler.ActionScriptException ex) {
|
||||
Logger.getLogger(DebugPanel.class.getName()).log(Level.SEVERE, "Error exporting ByteArray", ex);
|
||||
}*/
|
||||
|
||||
//Variant with direct writeByte calls - SLOW
|
||||
/*try (FileInputStream fis = new FileInputStream(file)) {
|
||||
Main.debugImportByteArray(v, fis);
|
||||
@@ -311,7 +309,6 @@ public class DebugPanel extends JPanel {
|
||||
Logger.getLogger(DebugPanel.class.getName()).log(Level.SEVERE, null, ex);
|
||||
ViewMessages.showMessageDialog(Main.getDefaultMessagesComponent(), AppStrings.translate("error.file.save") + ": " + ex.getLocalizedMessage(), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
|
||||
}*/
|
||||
|
||||
//Variant with using comma separated bytes, pretty fast
|
||||
try {
|
||||
byte[] data = Helper.readFileEx(file.getAbsolutePath());
|
||||
@@ -320,7 +317,7 @@ public class DebugPanel extends JPanel {
|
||||
for (int i = 0; i < data.length; i++) {
|
||||
sb.append(splitter);
|
||||
sb.append(data[i] & 0xff);
|
||||
splitter = ",";
|
||||
splitter = ",";
|
||||
}
|
||||
String dataStr = sb.toString();
|
||||
Variable debugConnectionClass = Main.getDebugHandler().getVariable(0, Main.currentDebuggerPackage + "::DebugConnection", false, false).parent;
|
||||
@@ -328,12 +325,12 @@ public class DebugPanel extends JPanel {
|
||||
Main.getDebugHandler().callMethod(debugConnectionClass, "writeCommaSeparatedToByteArray", Arrays.asList(dataStr, v));
|
||||
} catch (DebuggerHandler.ActionScriptException ex) {
|
||||
Logger.getLogger(DebugPanel.class.getName()).log(Level.SEVERE, "Error exporting ByteArray", ex);
|
||||
}
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(DebugPanel.class.getName()).log(Level.SEVERE, null, ex);
|
||||
ViewMessages.showMessageDialog(Main.getDefaultMessagesComponent(), AppStrings.translate("error.file.save") + ": " + ex.getLocalizedMessage(), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
|
||||
Logger.getLogger(DebugPanel.class.getName()).log(Level.SEVERE, null, ex);
|
||||
ViewMessages.showMessageDialog(Main.getDefaultMessagesComponent(), AppStrings.translate("error.file.save") + ": " + ex.getLocalizedMessage(), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
importMenu.add(importByteArrayMenuItem);
|
||||
@@ -364,8 +361,8 @@ public class DebugPanel extends JPanel {
|
||||
addWatchMenu.add(watchReadMenuItem);
|
||||
addWatchMenu.add(watchWriteMenuItem);
|
||||
addWatchMenu.add(watchReadWriteMenuItem);
|
||||
pm.add(addWatchMenu);
|
||||
pm.show(e.getComponent(), e.getX(), e.getY());
|
||||
pm.add(addWatchMenu);
|
||||
pm.show(e.getComponent(), e.getX(), e.getY());
|
||||
}
|
||||
};
|
||||
|
||||
@@ -392,14 +389,14 @@ public class DebugPanel extends JPanel {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Main.getDebugHandler().addErrorListener(new DebuggerHandler.ErrorListener() {
|
||||
@Override
|
||||
public void errorException(String message, Variable thrownVar) {
|
||||
logAdd("unhandled exception: " + message);
|
||||
selectedTab = tabTypes.get(tabTypes.size() - 1);
|
||||
refresh();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Main.getDebugHandler().addConnectionListener(new DebuggerHandler.ConnectionListener() {
|
||||
@@ -413,7 +410,7 @@ public class DebugPanel extends JPanel {
|
||||
refresh();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Main.getDebugHandler().addFrameChangeListener(frameChangeListener = new DebuggerHandler.FrameChangeListener() {
|
||||
@Override
|
||||
public void frameChanged() {
|
||||
@@ -423,7 +420,7 @@ public class DebugPanel extends JPanel {
|
||||
refresh();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Main.getDebugHandler().addBreakListener(breakListener = new DebuggerHandler.BreakListener() {
|
||||
@@ -439,7 +436,7 @@ public class DebugPanel extends JPanel {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakAt(String scriptName, int line, int classIndex, int traitIndex, int methodIndex) {
|
||||
public void breakAt(String scriptName, int line, int classIndex, int traitIndex, int methodIndex) {
|
||||
|
||||
}
|
||||
});
|
||||
@@ -620,7 +617,7 @@ public class DebugPanel extends JPanel {
|
||||
pa.add(new FasterScrollPane(constantPoolTable), BorderLayout.CENTER);
|
||||
varTabs.addTab(AppStrings.translate("constantpool.header"), pa);
|
||||
}
|
||||
|
||||
|
||||
if (logLength > 0) {
|
||||
tabTypes.add(SelectedTab.LOG);
|
||||
|
||||
|
||||
@@ -46,8 +46,7 @@ public class DebugStackPanel extends JPanel {
|
||||
private int[] classIndices = new int[0];
|
||||
private int[] methodIndices = new int[0];
|
||||
private int[] traitIndices = new int[0];
|
||||
|
||||
|
||||
|
||||
public DebugStackPanel() {
|
||||
stackTable = new JTable();
|
||||
Main.getDebugHandler().addFrameChangeListener(new DebuggerHandler.FrameChangeListener() {
|
||||
@@ -81,7 +80,6 @@ public class DebugStackPanel extends JPanel {
|
||||
});
|
||||
|
||||
//JLabel titleLabel = new JLabel(AppStrings.translate("callStack.header"), JLabel.CENTER);
|
||||
|
||||
setLayout(new BorderLayout());
|
||||
//add(titleLabel, BorderLayout.NORTH);
|
||||
add(new FasterScrollPane(stackTable), BorderLayout.CENTER);
|
||||
@@ -127,7 +125,7 @@ public class DebugStackPanel extends JPanel {
|
||||
int f = info.files.get(i);
|
||||
data[i][0] = Main.getDebugHandler().moduleToString(f);
|
||||
data[i][1] = info.lines.get(i);
|
||||
data[i][2] = info.stacks.get(i);
|
||||
data[i][2] = info.stacks.get(i);
|
||||
Integer newClassIndex = Main.getDebugHandler().moduleToClassIndex(f);
|
||||
newClassIndices[i] = newClassIndex == null ? -1 : newClassIndex;
|
||||
Integer newMethodIndex = Main.getDebugHandler().moduleToMethodIndex(f);
|
||||
@@ -135,12 +133,11 @@ public class DebugStackPanel extends JPanel {
|
||||
Integer newTraitIndex = Main.getDebugHandler().moduleToTraitIndex(f);;
|
||||
newTraitIndices[i] = newTraitIndex == null ? -1 : newTraitIndex;
|
||||
}
|
||||
|
||||
|
||||
DefaultTableModel tm = new DefaultTableModel(data, new Object[]{
|
||||
AppStrings.translate("callStack.header.file"),
|
||||
AppStrings.translate("callStack.header.line"),
|
||||
AppStrings.translate("stack.header.item")
|
||||
AppStrings.translate("stack.header.item")
|
||||
}) {
|
||||
@Override
|
||||
public boolean isCellEditable(int row, int column) {
|
||||
|
||||
@@ -105,11 +105,11 @@ public class DebuggerHandler implements DebugConnectionListener {
|
||||
private int breakIp = -1;
|
||||
|
||||
private String breakScriptName = null;
|
||||
|
||||
|
||||
private List<String> stackScriptNames = new ArrayList<>();
|
||||
|
||||
|
||||
private List<Integer> stackLines = new ArrayList<>();
|
||||
|
||||
|
||||
private SWF debuggedSwf = null;
|
||||
|
||||
public static class ActionScriptException extends Exception {
|
||||
@@ -136,7 +136,7 @@ public class DebuggerHandler implements DebugConnectionListener {
|
||||
|
||||
public SWF getDebuggedSwf() {
|
||||
return debuggedSwf;
|
||||
}
|
||||
}
|
||||
|
||||
public int getBreakIp() {
|
||||
if (!isPaused()) {
|
||||
@@ -147,7 +147,7 @@ public class DebuggerHandler implements DebugConnectionListener {
|
||||
|
||||
public int getDepth() {
|
||||
return depth;
|
||||
}
|
||||
}
|
||||
|
||||
public String getBreakScriptName() {
|
||||
if (!isPaused()) {
|
||||
@@ -155,7 +155,7 @@ public class DebuggerHandler implements DebugConnectionListener {
|
||||
}
|
||||
return breakScriptName;
|
||||
}
|
||||
|
||||
|
||||
public synchronized List<String> getStackScripts() {
|
||||
if (!isPaused()) {
|
||||
return new ArrayList<>();
|
||||
@@ -168,7 +168,7 @@ public class DebuggerHandler implements DebugConnectionListener {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return stackLines;
|
||||
}
|
||||
}
|
||||
|
||||
public InGetVariable getVariable(long parentId, String varName, boolean children, boolean useGetter) {
|
||||
try {
|
||||
@@ -245,7 +245,7 @@ public class DebuggerHandler implements DebugConnectionListener {
|
||||
}
|
||||
|
||||
public synchronized Set<Integer> getBreakPoints(SWF swf, String scriptName, boolean onlyValid) {
|
||||
Set<Integer> lines = new TreeSet<>();
|
||||
Set<Integer> lines = new TreeSet<>();
|
||||
if (confirmedPointMap.containsKey(swf) && confirmedPointMap.get(swf).containsKey(scriptName)) {
|
||||
lines.addAll(confirmedPointMap.get(swf).get(scriptName));
|
||||
}
|
||||
@@ -290,10 +290,10 @@ public class DebuggerHandler implements DebugConnectionListener {
|
||||
}
|
||||
toAddBPointMap.get(swf).get(scriptName).addAll(invalidBreakPointMap.get(swf).get(scriptName));
|
||||
}
|
||||
|
||||
|
||||
invalidBreakPointMap.get(swf).clear();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public synchronized Map<String, Set<Integer>> getAllBreakPoints(SWF swf, boolean validOnly) {
|
||||
@@ -390,7 +390,7 @@ public class DebuggerHandler implements DebugConnectionListener {
|
||||
}
|
||||
|
||||
private InFrame frame;
|
||||
|
||||
|
||||
private int depth;
|
||||
|
||||
private InConstantPool pool;
|
||||
@@ -402,9 +402,9 @@ public class DebuggerHandler implements DebugConnectionListener {
|
||||
private final List<BreakListener> breakListeners = new CopyOnWriteArrayList<>();
|
||||
|
||||
private final List<TraceListener> traceListeners = new ArrayList<>();
|
||||
|
||||
|
||||
private final List<ErrorListener> errorListeners = new ArrayList<>();
|
||||
|
||||
|
||||
private final List<FrameChangeListener> frameChangeListeners = new ArrayList<>();
|
||||
|
||||
private final List<ConnectionListener> clisteners = new ArrayList<>();
|
||||
@@ -413,24 +413,24 @@ public class DebuggerHandler implements DebugConnectionListener {
|
||||
this.depth = depth;
|
||||
refreshFrame();
|
||||
}
|
||||
|
||||
|
||||
public String moduleToString(int file) {
|
||||
if (!modulePaths.containsKey(file)) {
|
||||
return "unknown";
|
||||
}
|
||||
return modulePaths.get(file);
|
||||
}
|
||||
|
||||
|
||||
public Integer moduleToMethodIndex(int file) {
|
||||
return moduleToMethodIndex.get(file);
|
||||
return moduleToMethodIndex.get(file);
|
||||
}
|
||||
|
||||
|
||||
public Integer moduleToClassIndex(int file) {
|
||||
return moduleToClassIndex.get(file);
|
||||
return moduleToClassIndex.get(file);
|
||||
}
|
||||
|
||||
|
||||
public Integer moduleToTraitIndex(int file) {
|
||||
return moduleToTraitIndex.get(file);
|
||||
return moduleToTraitIndex.get(file);
|
||||
}
|
||||
|
||||
public synchronized InBreakAtExt getBreakInfo() {
|
||||
@@ -458,11 +458,12 @@ public class DebuggerHandler implements DebugConnectionListener {
|
||||
|
||||
public void trace(String... val);
|
||||
}
|
||||
|
||||
|
||||
public static interface ErrorListener {
|
||||
public void errorException(String message, Variable thrownVar);
|
||||
|
||||
public void errorException(String message, Variable thrownVar);
|
||||
}
|
||||
|
||||
|
||||
public static interface FrameChangeListener {
|
||||
|
||||
public void frameChanged();
|
||||
@@ -478,11 +479,11 @@ public class DebuggerHandler implements DebugConnectionListener {
|
||||
public void addBreakListener(BreakListener l) {
|
||||
breakListeners.add(l);
|
||||
}
|
||||
|
||||
|
||||
public void addFrameChangeListener(FrameChangeListener l) {
|
||||
frameChangeListeners.add(l);
|
||||
}
|
||||
|
||||
|
||||
public void removeFrameChangeListener(FrameChangeListener l) {
|
||||
frameChangeListeners.remove(l);
|
||||
}
|
||||
@@ -494,7 +495,7 @@ public class DebuggerHandler implements DebugConnectionListener {
|
||||
public void removeTraceListener(TraceListener l) {
|
||||
traceListeners.remove(l);
|
||||
}
|
||||
|
||||
|
||||
public void addErrorListener(ErrorListener l) {
|
||||
errorListeners.add(l);
|
||||
}
|
||||
@@ -555,8 +556,8 @@ public class DebuggerHandler implements DebugConnectionListener {
|
||||
|
||||
public List<InSwfInfo.SwfInfo> getSwfs() {
|
||||
return swfs;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void disconnect() {
|
||||
frame = null;
|
||||
pool = null;
|
||||
@@ -580,7 +581,7 @@ public class DebuggerHandler implements DebugConnectionListener {
|
||||
}
|
||||
confirmedPointMap.get(debuggedSwf).clear();
|
||||
}
|
||||
|
||||
|
||||
if (invalidBreakPointMap.containsKey(debuggedSwf)) {
|
||||
for (String scriptName : invalidBreakPointMap.get(debuggedSwf).keySet()) {
|
||||
if (!toAddBPointMap.containsKey(debuggedSwf)) {
|
||||
@@ -592,7 +593,7 @@ public class DebuggerHandler implements DebugConnectionListener {
|
||||
toAddBPointMap.get(debuggedSwf).get(scriptName).addAll(invalidBreakPointMap.get(debuggedSwf).get(scriptName));
|
||||
}
|
||||
invalidBreakPointMap.get(debuggedSwf).clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
for (ConnectionListener l : clisteners) {
|
||||
l.disconnected();
|
||||
@@ -608,7 +609,7 @@ public class DebuggerHandler implements DebugConnectionListener {
|
||||
throw new IOException("Not connected");
|
||||
}
|
||||
return commands;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void failedListen(IOException ex) {
|
||||
@@ -636,7 +637,7 @@ public class DebuggerHandler implements DebugConnectionListener {
|
||||
}
|
||||
|
||||
Main.getMainFrame().getPanel().updateMenu();
|
||||
|
||||
|
||||
//enlog(DebuggerConnection.class);
|
||||
//enlog(DebuggerCommands.class);
|
||||
//enlog(DebuggerHandler.class);
|
||||
@@ -669,7 +670,6 @@ public class DebuggerHandler implements DebugConnectionListener {
|
||||
boolean isAS3 = (Main.getMainFrame().getPanel().getCurrentSwf().isAS3());
|
||||
try {
|
||||
|
||||
|
||||
con.addMessageListener(new DebugMessageListener<InErrorException>() {
|
||||
@Override
|
||||
public void message(InErrorException t) {
|
||||
@@ -677,9 +677,9 @@ public class DebuggerHandler implements DebugConnectionListener {
|
||||
l.errorException(t.exceptionMessage, t.thrownVar);
|
||||
}
|
||||
con.dropMessage(t);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
con.addMessageListener(new DebugMessageListener<InNumScript>() {
|
||||
@Override
|
||||
public void message(InNumScript t) {
|
||||
@@ -697,12 +697,11 @@ public class DebuggerHandler implements DebugConnectionListener {
|
||||
moduleToSwfIndex.put(sc.module, sc.swfIndex);
|
||||
int file = sc.module;
|
||||
String name = sc.name;
|
||||
|
||||
|
||||
|
||||
name = name.replaceAll("\\[(invalid_utf8=[0-9]+)\\]", "{$1}");
|
||||
|
||||
|
||||
Logger.getLogger(DebuggerHandler.class.getName()).log(Level.FINE, "Received script added - index {0} name: {1}", new Object[]{file, name});
|
||||
|
||||
|
||||
Matcher m;
|
||||
if ((m = patAS3.matcher(name)).matches()) {
|
||||
String clsNameWithSuffix = m.group(3).replace("{{semicolon}}", ";");
|
||||
@@ -783,7 +782,7 @@ public class DebuggerHandler implements DebugConnectionListener {
|
||||
for (int i = 0; i < isb.files.size(); i++) {
|
||||
String sname = moduleNames.get(isb.files.get(i));
|
||||
if (!confirmedPointMap.containsKey(debuggedSwf)) {
|
||||
confirmedPointMap.put(debuggedSwf, new HashMap<>());
|
||||
confirmedPointMap.put(debuggedSwf, new HashMap<>());
|
||||
}
|
||||
if (!confirmedPointMap.get(debuggedSwf).containsKey(sname)) {
|
||||
confirmedPointMap.get(debuggedSwf).put(sname, new TreeSet<>());
|
||||
@@ -852,14 +851,14 @@ public class DebuggerHandler implements DebugConnectionListener {
|
||||
synchronized (DebuggerHandler.this) {
|
||||
breakScriptName = newBreakScriptName;
|
||||
breakIp = message.line;
|
||||
|
||||
|
||||
if (breakInfo != null) {
|
||||
List<String> files = new ArrayList<>();
|
||||
for (int i = 0; i < breakInfo.files.size(); i++) {
|
||||
files.add(Main.getDebugHandler().moduleToString(breakInfo.files.get(i)));
|
||||
}
|
||||
stackScriptNames = files;
|
||||
List<Integer> lines = new ArrayList<>(breakInfo.lines);
|
||||
List<Integer> lines = new ArrayList<>(breakInfo.lines);
|
||||
stackLines = lines;
|
||||
}
|
||||
}
|
||||
@@ -874,7 +873,7 @@ public class DebuggerHandler implements DebugConnectionListener {
|
||||
Main.startWork(AppStrings.translate("work.breakat") + newBreakScriptName + ":" + message.line + " " + AppStrings.translate("debug.break.reason." + reason), null);
|
||||
}
|
||||
depth = 0;
|
||||
refreshFrame();
|
||||
refreshFrame();
|
||||
for (BreakListener l : breakListeners) {
|
||||
l.breakAt(newBreakScriptName, message.line,
|
||||
moduleToClassIndex.containsKey(message.file) ? moduleToClassIndex.get(message.file) : -1,
|
||||
@@ -932,8 +931,8 @@ public class DebuggerHandler implements DebugConnectionListener {
|
||||
if (!isConnected()) {
|
||||
Logger.getLogger(DebuggerHandler.class.getName()).log(Level.FINEST, "not sending bps, not connected");
|
||||
return;
|
||||
}
|
||||
synchronized (this) {
|
||||
}
|
||||
synchronized (this) {
|
||||
if (toRemoveBPointMap.containsKey(debuggedSwf)) {
|
||||
for (String scriptName : toRemoveBPointMap.get(debuggedSwf).keySet()) {
|
||||
int file = moduleIdOf(scriptName);
|
||||
|
||||
@@ -147,9 +147,9 @@ public class ExportDialog extends AppDialog {
|
||||
private JTextField zoomTextField = new JTextField();
|
||||
|
||||
private JCheckBox embedCheckBox;
|
||||
|
||||
|
||||
private JCheckBox resampleWavCheckBox;
|
||||
|
||||
|
||||
private JCheckBox transparentFrameBackgroundCheckBox;
|
||||
|
||||
public <E> E getValue(Class<E> option) {
|
||||
@@ -176,11 +176,11 @@ public class ExportDialog extends AppDialog {
|
||||
public boolean isEmbedEnabled() {
|
||||
return embedCheckBox.isSelected();
|
||||
}
|
||||
|
||||
|
||||
public boolean isResampleWavEnabled() {
|
||||
return resampleWavCheckBox.isSelected();
|
||||
}
|
||||
|
||||
|
||||
public boolean isTransparentFrameBackgroundEnabled() {
|
||||
return transparentFrameBackgroundCheckBox.isSelected();
|
||||
}
|
||||
@@ -306,7 +306,7 @@ public class ExportDialog extends AppDialog {
|
||||
top += selectAllCheckBox.getHeight();
|
||||
|
||||
List<Class> visibleOptionClasses = new ArrayList<>();
|
||||
|
||||
|
||||
boolean zoomable = false;
|
||||
for (int i = 0; i < optionNames.length; i++) {
|
||||
Class c = optionClasses[i];
|
||||
@@ -340,7 +340,7 @@ public class ExportDialog extends AppDialog {
|
||||
if (Arrays.asList(zoomClasses).contains(c)) {
|
||||
zoomable = true;
|
||||
}
|
||||
|
||||
|
||||
visibleOptionClasses.add(c);
|
||||
|
||||
JLabel lab = new JLabel(translate(optionNames[i]));
|
||||
@@ -380,14 +380,13 @@ public class ExportDialog extends AppDialog {
|
||||
}
|
||||
if (Configuration.lastExportEnableEmbed.get()) {
|
||||
embedCheckBox.setSelected(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
resampleWavCheckBox = new JCheckBox(translate("resampleWav"));
|
||||
resampleWavCheckBox.setVisible(false);
|
||||
|
||||
|
||||
if (embedCheckBox.isVisible() ||visibleOptionClasses.contains(SoundExportMode.class)) {
|
||||
if (embedCheckBox.isVisible() || visibleOptionClasses.contains(SoundExportMode.class)) {
|
||||
top += 2;
|
||||
resampleWavCheckBox.setVisible(true);
|
||||
comboPanel.add(resampleWavCheckBox);
|
||||
@@ -402,17 +401,17 @@ public class ExportDialog extends AppDialog {
|
||||
w = resampleWavCheckBox.getWidth() + 10;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
transparentFrameBackgroundCheckBox = new JCheckBox(translate("transparentFrameBackground"));
|
||||
transparentFrameBackgroundCheckBox.setVisible(false);
|
||||
if (visibleOptionClasses.contains(FrameExportMode.class)) {
|
||||
top += 2;
|
||||
top += 2;
|
||||
transparentFrameBackgroundCheckBox.setVisible(true);
|
||||
comboPanel.add(transparentFrameBackgroundCheckBox);
|
||||
if (Configuration.lastExportTransparentBackground.get()) {
|
||||
transparentFrameBackgroundCheckBox.setSelected(true);
|
||||
}
|
||||
|
||||
|
||||
transparentFrameBackgroundCheckBox.setBounds(10, top, transparentFrameBackgroundCheckBox.getPreferredSize().width, transparentFrameBackgroundCheckBox.getPreferredSize().height);
|
||||
top += transparentFrameBackgroundCheckBox.getHeight();
|
||||
|
||||
|
||||
@@ -243,11 +243,11 @@ public class FolderListPanel extends JPanel {
|
||||
String s;
|
||||
if (treeItem instanceof Tag) {
|
||||
Tag t = (Tag) treeItem;
|
||||
String uniqueId = t.getUniqueId();
|
||||
String uniqueId = t.getUniqueId();
|
||||
s = ((Tag) treeItem).getTagName();
|
||||
if (uniqueId != null) {
|
||||
s = s + " (" + uniqueId + ")";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
s = treeItem.toString();
|
||||
}
|
||||
|
||||
@@ -248,11 +248,11 @@ public class FolderPreviewPanel extends JPanel {
|
||||
TreeItem treeItem = items.get(index);
|
||||
if (treeItem instanceof Tag) {
|
||||
Tag t = (Tag) treeItem;
|
||||
String uniqueId = t.getUniqueId();
|
||||
String uniqueId = t.getUniqueId();
|
||||
s = ((Tag) treeItem).getTagName();
|
||||
if (uniqueId != null) {
|
||||
s = s + " (" + uniqueId + ")";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
s = treeItem.toString();
|
||||
}
|
||||
|
||||
@@ -81,33 +81,33 @@ public class FontEmbedDialog extends AppDialog {
|
||||
private final JCheckBox allCheckbox;
|
||||
|
||||
private final JCheckBox importAscentDescentLeadingCheckBox;
|
||||
|
||||
|
||||
private final JTextField fontNameTextField;
|
||||
|
||||
public String getCreateFontName() {
|
||||
return fontNameTextField.getText();
|
||||
}
|
||||
|
||||
|
||||
public Font getSelectedFont() {
|
||||
if (ttfFileRadio.isSelected() && customFont != null) {
|
||||
return customFont;
|
||||
}
|
||||
return ((FontFace) faceSelection.getSelectedItem()).font;
|
||||
}
|
||||
|
||||
|
||||
public boolean isBold() {
|
||||
if (ttfFileRadio.isSelected() && customFont != null) {
|
||||
return customFont.isBold();
|
||||
}
|
||||
return ((FontFace) faceSelection.getSelectedItem()).isBold();
|
||||
}
|
||||
|
||||
|
||||
public boolean isItalic() {
|
||||
if (ttfFileRadio.isSelected() && customFont != null) {
|
||||
return customFont.isItalic();
|
||||
}
|
||||
return ((FontFace) faceSelection.getSelectedItem()).isItalic();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isImportAscentDescentLeading() {
|
||||
return importAscentDescentLeadingCheckBox.isSelected();
|
||||
@@ -159,12 +159,10 @@ public class FontEmbedDialog extends AppDialog {
|
||||
setSize(900, 600);
|
||||
setDefaultCloseOperation(HIDE_ON_CLOSE);
|
||||
setTitle(translate("dialog.title"));
|
||||
|
||||
|
||||
|
||||
Container cnt = getContentPane();
|
||||
cnt.setLayout(new BoxLayout(cnt, BoxLayout.Y_AXIS));
|
||||
|
||||
|
||||
fontNameTextField = new JTextField(30);
|
||||
fontNameTextField.setText(translate("font.name.default"));
|
||||
fontNameTextField.selectAll();
|
||||
@@ -174,7 +172,7 @@ public class FontEmbedDialog extends AppDialog {
|
||||
fontNamePanel.add(fontNameTextField);
|
||||
cnt.add(fontNamePanel);
|
||||
}
|
||||
|
||||
|
||||
JPanel selFontPanel = new JPanel(new FlowLayout());
|
||||
|
||||
installedRadio = new JRadioButton(translate("installed"));
|
||||
|
||||
@@ -47,11 +47,11 @@ public class FontFace implements Comparable<FontFace> {
|
||||
public boolean isBold() {
|
||||
return toString().toLowerCase().contains("bold");
|
||||
}
|
||||
|
||||
|
||||
public boolean isItalic() {
|
||||
return toString().toLowerCase().contains("italic");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 7;
|
||||
|
||||
@@ -615,7 +615,7 @@ public class FontPanel extends JPanel implements TagEditorPanel {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public boolean fontEmbed(TreeItem item, boolean create) {
|
||||
if (item == null) {
|
||||
return false;
|
||||
|
||||
@@ -275,7 +275,7 @@ public class GenericTagTreePanel extends GenericTagPanel {
|
||||
@Override
|
||||
public boolean canAdd() {
|
||||
return swfType.canAdd();
|
||||
}
|
||||
}
|
||||
};
|
||||
} catch (AnnotationParseException | IllegalArgumentException | IllegalAccessException ex) {
|
||||
logger.log(Level.SEVERE, null, ex);
|
||||
@@ -907,8 +907,8 @@ public class GenericTagTreePanel extends GenericTagPanel {
|
||||
if (val instanceof byte[]) {
|
||||
valStr += " = " + ((byte[]) val).length + " byte";
|
||||
} else if (val instanceof ByteArrayRange) {
|
||||
valStr += " = " + ((ByteArrayRange) val).getLength() + " byte";
|
||||
} else {
|
||||
valStr += " = " + ((ByteArrayRange) val).getLength() + " byte";
|
||||
} else {
|
||||
valStr += " = " + colorAdd + val.toString() + enumAdd;
|
||||
}
|
||||
}
|
||||
@@ -973,7 +973,7 @@ public class GenericTagTreePanel extends GenericTagPanel {
|
||||
}
|
||||
typeStr += "]";
|
||||
bracketsDetected = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String arrayBrackets = "";
|
||||
@@ -1470,7 +1470,7 @@ public class GenericTagTreePanel extends GenericTagPanel {
|
||||
fieldMap.put(sf, swf.hasStrippedShapesFromFonts());
|
||||
} else {
|
||||
fieldMap.put(sf, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!ev.eval(fieldMap, parentTagId)) {
|
||||
@@ -1529,7 +1529,7 @@ public class GenericTagTreePanel extends GenericTagPanel {
|
||||
if (swfArray != null && !swfArray.countField().isEmpty()) {
|
||||
countFieldName = swfArray.countField();
|
||||
}
|
||||
|
||||
|
||||
if (countFieldName != null) { //Fields with same countField must be enlarged too
|
||||
Field[] fields = obj.getClass().getDeclaredFields();
|
||||
List<Integer> sameFlds = new ArrayList<>();
|
||||
@@ -1545,7 +1545,7 @@ public class GenericTagTreePanel extends GenericTagPanel {
|
||||
JOptionPane.showMessageDialog(this, "This field is abstract, cannot be instantiated, sorry."); //TODO!!!
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int f : sameFlds) {
|
||||
ReflectionTools.addToField(obj, fields[f], index, true, cls);
|
||||
@@ -1625,7 +1625,7 @@ public class GenericTagTreePanel extends GenericTagPanel {
|
||||
if (fieldSwfArray != null && !fieldSwfArray.countField().isEmpty()) {
|
||||
fieldCountFieldName = fieldSwfArray.countField();
|
||||
}
|
||||
|
||||
|
||||
if (fieldCountFieldName != null && fieldCountFieldName.equals(countFieldName)) {
|
||||
ReflectionTools.removeFromField(obj, fields[f], index);
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ public class HeaderInfoPanel extends JPanel implements TagEditorPanel {
|
||||
private final JSpinner versionEditor = new JSpinner();
|
||||
|
||||
private final JCheckBox gfxCheckBox = new JCheckBox();
|
||||
|
||||
|
||||
private final JCheckBox encryptedCheckBox = new JCheckBox();
|
||||
|
||||
private final JPanel frameRateEditorPanel = new JPanel();
|
||||
@@ -162,7 +162,7 @@ public class HeaderInfoPanel extends JPanel implements TagEditorPanel {
|
||||
encryptedCheckBox.addChangeListener((ChangeEvent e) -> {
|
||||
validateHeader();
|
||||
});
|
||||
|
||||
|
||||
gfxCheckBox.addChangeListener((ChangeEvent e) -> {
|
||||
validateHeader();
|
||||
});
|
||||
@@ -247,7 +247,7 @@ public class HeaderInfoPanel extends JPanel implements TagEditorPanel {
|
||||
propertiesPanel.add(versionEditorPanel, "1,2");
|
||||
propertiesPanel.add(new JLabel(AppStrings.translate("header.encrypted")), "0,3");
|
||||
propertiesPanel.add(encryptedLabel, "1,3");
|
||||
propertiesPanel.add(encryptedCheckBox, "1,3");
|
||||
propertiesPanel.add(encryptedCheckBox, "1,3");
|
||||
propertiesPanel.add(new JLabel(AppStrings.translate("header.gfx")), "0,4");
|
||||
propertiesPanel.add(gfxLabel, "1,4");
|
||||
propertiesPanel.add(gfxCheckBox, "1,4");
|
||||
@@ -364,10 +364,10 @@ public class HeaderInfoPanel extends JPanel implements TagEditorPanel {
|
||||
|
||||
encryptedLabel.setText(swf.encrypted ? AppStrings.translate("yes") : AppStrings.translate("no"));
|
||||
encryptedCheckBox.setSelected(swf.encrypted);
|
||||
|
||||
|
||||
gfxLabel.setText(swf.gfx ? AppStrings.translate("yes") : AppStrings.translate("no"));
|
||||
gfxCheckBox.setSelected(swf.gfx);
|
||||
|
||||
|
||||
fileSizeLabel.setText(Long.toString(swf.fileSize));
|
||||
|
||||
frameRateLabel.setText(Float.toString(swf.frameRate));
|
||||
@@ -408,7 +408,7 @@ public class HeaderInfoPanel extends JPanel implements TagEditorPanel {
|
||||
});
|
||||
encryptedCheckBox.addChangeListener((ChangeEvent e) -> {
|
||||
setModified();
|
||||
});
|
||||
});
|
||||
gfxCheckBox.addChangeListener((ChangeEvent e) -> {
|
||||
setModified();
|
||||
});
|
||||
@@ -498,7 +498,7 @@ public class HeaderInfoPanel extends JPanel implements TagEditorPanel {
|
||||
resultStr += AppStrings.translate("header.warning.unsupportedGfxCompression") + " ";
|
||||
result = false;
|
||||
}
|
||||
|
||||
|
||||
if (gfx && encrypted) {
|
||||
resultStr += AppStrings.translate("header.warning.unsupportedGfxEncryption") + " ";
|
||||
result = false;
|
||||
|
||||
@@ -262,7 +262,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
private boolean frozen = false;
|
||||
|
||||
private boolean muted = false;
|
||||
|
||||
|
||||
private boolean resample = false;
|
||||
|
||||
private boolean mutable = false;
|
||||
@@ -347,7 +347,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
listener.pointsUpdated(points);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void fireStatusChanged(String status) {
|
||||
for (MediaDisplayListener listener : listeners) {
|
||||
listener.statusChanged(status);
|
||||
@@ -437,11 +437,11 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
pointEditPanel.setVisible(false);
|
||||
redraw();
|
||||
}
|
||||
|
||||
|
||||
public void setStatus(String status) {
|
||||
fireStatusChanged(status);
|
||||
}
|
||||
|
||||
|
||||
public void setNoStatus() {
|
||||
fireStatusChanged("");
|
||||
}
|
||||
@@ -754,7 +754,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
private Point2D dragStart = null;
|
||||
|
||||
private Point2D selectionEnd = null;
|
||||
|
||||
|
||||
private boolean canInvert = true;
|
||||
|
||||
private Rectangle2D getSelectionRect() {
|
||||
@@ -938,7 +938,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
RECT timRect = timelined.getRect();
|
||||
axisX = (int) Math.round(offsetPoint.getX());
|
||||
axisY = (int) Math.round(offsetPoint.getY());
|
||||
if (canInvert) {
|
||||
if (canInvert) {
|
||||
g2.setComposite(BlendComposite.Invert);
|
||||
} else {
|
||||
g2.setComposite(AlphaComposite.SrcOver);
|
||||
@@ -2378,7 +2378,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
if (!muted && button != null && freeTransformDepth == -1) {
|
||||
DefineButtonSoundTag sounds = button.getSounds();
|
||||
if (sounds != null && sounds.buttonSoundChar3 != 0) { // OverDownToOverUp
|
||||
CharacterTag soundCharTag = swf.getCharacter(sounds.buttonSoundChar3);
|
||||
CharacterTag soundCharTag = swf.getCharacter(sounds.buttonSoundChar3);
|
||||
if (soundCharTag instanceof SoundTag) {
|
||||
playSound((SoundTag) soundCharTag, sounds.buttonSoundInfo3, timer);
|
||||
}
|
||||
@@ -2421,7 +2421,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
drawFrame(thisTimer, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Timelined getTimelined() {
|
||||
return timelined;
|
||||
@@ -2484,11 +2484,11 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
private synchronized void updateScrollBars() {
|
||||
if (!zoomAvailable) {
|
||||
View.execInEventDispatchLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
horizontalScrollBar.setVisible(false);
|
||||
verticalScrollBar.setVisible(false);
|
||||
}
|
||||
@Override
|
||||
public void run() {
|
||||
horizontalScrollBar.setVisible(false);
|
||||
verticalScrollBar.setVisible(false);
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
@@ -2552,7 +2552,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
public synchronized void zoom(Zoom zoom) {
|
||||
zoom(zoom, false);
|
||||
}
|
||||
|
||||
|
||||
private synchronized void zoom(Zoom zoom, boolean useCursor) {
|
||||
if (!zoomAvailable) {
|
||||
return;
|
||||
@@ -2935,7 +2935,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
private static SerializableImage getFrame(Rectangle realRect, RECT rect, ExportRectangle viewRect, SWF swf, int frame, int time, Timelined drawable, RenderContext renderContext, int selectedDepth, int freeTransformDepth, double zoom, Reference<Point2D> registrationPointRef, Reference<Rectangle2D> boundsRef, Matrix transform, Matrix temporaryMatrix, Matrix newMatrix) {
|
||||
Timeline timeline = drawable.getTimeline();
|
||||
SerializableImage img;
|
||||
|
||||
|
||||
int width = (int) (viewRect.getWidth() * zoom);
|
||||
int height = (int) (viewRect.getHeight() * zoom);
|
||||
if (width == 0) {
|
||||
@@ -3569,7 +3569,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void statusChanged(String status) {
|
||||
public void statusChanged(String status) {
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -216,7 +216,7 @@ public class Main {
|
||||
public static CancellableWorker importWorker = null;
|
||||
public static CancellableWorker deobfuscatePCodeWorker = null;
|
||||
public static CancellableWorker swfPrepareWorker = null;
|
||||
|
||||
|
||||
public static String currentDebuggerPackage = null;
|
||||
|
||||
public static boolean isSwfAir(Openable openable) {
|
||||
@@ -290,7 +290,6 @@ public class Main {
|
||||
return runProcess != null && !runProcessDebug;
|
||||
}
|
||||
|
||||
|
||||
public static synchronized void debugExportByteArray(Variable v, OutputStream os) throws IOException {
|
||||
try {
|
||||
long objectId = 0L;
|
||||
@@ -300,7 +299,7 @@ public class Main {
|
||||
Object oldPos = getDebugHandler().getVariable(objectId, "position", false, true).parent.value;
|
||||
getDebugHandler().setVariable(objectId, "position", VariableType.NUMBER, 0);
|
||||
int length = (int) (double) (Double) getDebugHandler().getVariable(objectId, "length", false, true).parent.value;
|
||||
|
||||
|
||||
for (int i = 0; i < length; i++) {
|
||||
int b = (int) (double) (Double) getDebugHandler().callFunction(false, "readByte", v, new ArrayList<>()).variables.get(0).value;
|
||||
os.write(b);
|
||||
@@ -310,7 +309,7 @@ public class Main {
|
||||
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static synchronized void debugImportByteArray(Variable v, InputStream is) throws IOException {
|
||||
try {
|
||||
long objectId = 0L;
|
||||
@@ -320,7 +319,7 @@ public class Main {
|
||||
Double oldPos = (Double) getDebugHandler().getVariable(objectId, "position", false, true).parent.value;
|
||||
getDebugHandler().setVariable(objectId, "length", VariableType.NUMBER, 0);
|
||||
getDebugHandler().setVariable(objectId, "position", VariableType.NUMBER, 0);
|
||||
|
||||
|
||||
int length = 0;
|
||||
int b;
|
||||
while ((b = is.read()) > -1) {
|
||||
@@ -524,15 +523,14 @@ public class Main {
|
||||
//ignore, return instrSWF
|
||||
}
|
||||
instrSWF.removeEventListener(prepEventListner);
|
||||
|
||||
|
||||
//instrSWF = super.prepare(instrSWF);
|
||||
|
||||
if (!DebuggerTools.hasDebugger(instrSWF)) {
|
||||
DebuggerTools.switchDebugger(instrSWF);
|
||||
}
|
||||
DebuggerTools.injectDebugLoader(instrSWF);
|
||||
currentDebuggerPackage = instrSWF.debuggerPackage;
|
||||
|
||||
|
||||
return instrSWF;
|
||||
}
|
||||
}
|
||||
@@ -715,11 +713,11 @@ public class Main {
|
||||
public static synchronized String getIpClass() {
|
||||
return getDebugHandler().getBreakScriptName();
|
||||
}
|
||||
|
||||
|
||||
public static synchronized List<Integer> getStackLines() {
|
||||
return getDebugHandler().getStackLines();
|
||||
}
|
||||
|
||||
|
||||
public static synchronized List<String> getStackClasses() {
|
||||
return getDebugHandler().getStackScripts();
|
||||
}
|
||||
@@ -846,7 +844,7 @@ public class Main {
|
||||
}
|
||||
proxyFrame.setVisible(true);
|
||||
proxyFrame.setState(Frame.NORMAL);
|
||||
}
|
||||
}
|
||||
|
||||
public static void continueWork(String name) {
|
||||
continueWork(name, -1);
|
||||
@@ -885,7 +883,7 @@ public class Main {
|
||||
public static void startWork(String name, CancellableWorker worker) {
|
||||
startWork(name, -1, worker);
|
||||
}
|
||||
|
||||
|
||||
public static void startWork(final String name, final int percent, final CancellableWorker worker) {
|
||||
working = true;
|
||||
long nowTime = System.currentTimeMillis();
|
||||
@@ -1350,7 +1348,6 @@ public class Main {
|
||||
/*if (swf.encrypted) {
|
||||
hasEncrypted = true;
|
||||
}*/
|
||||
|
||||
swf.addEventListener(new EventListener() {
|
||||
@Override
|
||||
public void handleExportingEvent(String type, int index, int count, Object data) {
|
||||
@@ -1416,10 +1413,9 @@ public class Main {
|
||||
|
||||
});
|
||||
}*/
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public static void saveFileToExe(SWF swf, ExeExportMode exeExportMode, File tmpFile) throws IOException {
|
||||
try (FileOutputStream fos = new FileOutputStream(tmpFile); BufferedOutputStream bos = new BufferedOutputStream(fos)) {
|
||||
switch (exeExportMode) {
|
||||
@@ -1660,13 +1656,13 @@ public class Main {
|
||||
|
||||
final SWF fswf = firstSWF;
|
||||
final Openable fopenable = firstOpenable;
|
||||
View.execInEventDispatch(() -> {
|
||||
View.execInEventDispatch(() -> {
|
||||
if (mainFrame == null) {
|
||||
Main.startWork(AppStrings.translate("work.creatingwindow") + "...", null);
|
||||
ensureMainFrame();
|
||||
}
|
||||
loadingDialog.setVisible(false);
|
||||
|
||||
loadingDialog.setVisible(false);
|
||||
|
||||
if (mainFrame != null) {
|
||||
mainFrame.setVisible(true);
|
||||
}
|
||||
@@ -1772,7 +1768,7 @@ public class Main {
|
||||
Cache.clearAll();
|
||||
initGui();
|
||||
reloadSWFs();
|
||||
}
|
||||
}
|
||||
|
||||
public static void newFile() {
|
||||
View.checkAccess();
|
||||
@@ -1884,7 +1880,7 @@ public class Main {
|
||||
|
||||
return openFile(newSourceInfos, executeAfterOpen, null);
|
||||
}
|
||||
|
||||
|
||||
public static OpenFileResult openFile(OpenableSourceInfo[] newSourceInfos, Runnable executeAfterOpen, int[] reloadIndices) {
|
||||
View.checkAccess();
|
||||
|
||||
@@ -2417,8 +2413,8 @@ public class Main {
|
||||
watcherWorker.execute();
|
||||
}
|
||||
|
||||
DebuggerTools.initDebugger().addMessageListener(new DebugAdapter() {
|
||||
|
||||
DebuggerTools.initDebugger().addMessageListener(new DebugAdapter() {
|
||||
|
||||
@Override
|
||||
public void onLoaderBytes(String clientId, byte[] data) {
|
||||
String hash = md5(data);
|
||||
@@ -2444,7 +2440,7 @@ public class Main {
|
||||
openFile(osi);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
try {
|
||||
@@ -2620,26 +2616,26 @@ public class Main {
|
||||
UIManager.put("ColorChooser.sampleText", AppStrings.translate("ColorChooser.sampleText"));
|
||||
|
||||
}
|
||||
|
||||
public static String getDefaultCharacterEncoding() {
|
||||
|
||||
public static String getDefaultCharacterEncoding() {
|
||||
// Creating an array of byte type chars and
|
||||
// passing random alphabet as an argument.abstract
|
||||
// Say alphabet be 'w'
|
||||
byte[] byte_array = { 'w' };
|
||||
|
||||
byte[] byte_array = {'w'};
|
||||
|
||||
// Creating an object of InputStream
|
||||
InputStream instream
|
||||
= new ByteArrayInputStream(byte_array);
|
||||
|
||||
= new ByteArrayInputStream(byte_array);
|
||||
|
||||
// Now, opening new file input stream reader
|
||||
InputStreamReader streamreader
|
||||
= new InputStreamReader(instream);
|
||||
= new InputStreamReader(instream);
|
||||
String defaultCharset = streamreader.getEncoding();
|
||||
|
||||
|
||||
// Returning default character encoding
|
||||
return defaultCharset;
|
||||
}
|
||||
|
||||
|
||||
private static void initLookAndFeel() {
|
||||
if (Configuration.useRibbonInterface.get()) {
|
||||
View.setLookAndFeel();
|
||||
@@ -2663,7 +2659,7 @@ public class Main {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void initJna() {
|
||||
if (Platform.isWindows()) {
|
||||
String jnaTempDir = Configuration.jnaTempDirectory.get();
|
||||
@@ -2672,18 +2668,18 @@ public class Main {
|
||||
} else {
|
||||
jnaTempDir = System.getProperty("java.io.tmpdir");
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
com.sun.jna.Native.toByteArray(""); //Trigger JNA.Native class static initializer, which will load the DLL
|
||||
} catch (UnsatisfiedLinkError error) {
|
||||
initLookAndFeel();
|
||||
ViewMessages.showMessageDialog(null,
|
||||
"Cannot read JNA DLL file from current Temporary directory:\r\n"
|
||||
+ jnaTempDir + "\r\n"
|
||||
+ "The reason is probably Unicode characters in the path or in your username.\r\n"
|
||||
+ "In the following dialog, please specify new temporary directory path,\r\n"
|
||||
+ "which DOES NOT contain any special Unicode characters. (Only basic latin supported)\r\n"
|
||||
+ "Then application restart is required.",
|
||||
ViewMessages.showMessageDialog(null,
|
||||
"Cannot read JNA DLL file from current Temporary directory:\r\n"
|
||||
+ jnaTempDir + "\r\n"
|
||||
+ "The reason is probably Unicode characters in the path or in your username.\r\n"
|
||||
+ "In the following dialog, please specify new temporary directory path,\r\n"
|
||||
+ "which DOES NOT contain any special Unicode characters. (Only basic latin supported)\r\n"
|
||||
+ "Then application restart is required.",
|
||||
"FFDec JNA Error", JOptionPane.ERROR_MESSAGE);
|
||||
View.execInEventDispatch(new Runnable() {
|
||||
@Override
|
||||
@@ -2699,9 +2695,9 @@ public class Main {
|
||||
} else {
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2803,7 +2799,7 @@ public class Main {
|
||||
* @param args the command line arguments
|
||||
* @throws IOException On error
|
||||
*/
|
||||
public static void main(String[] args) throws IOException {
|
||||
public static void main(String[] args) throws IOException {
|
||||
decodeLaunch5jArgs(args);
|
||||
setSessionLoaded(false);
|
||||
|
||||
@@ -2850,7 +2846,7 @@ public class Main {
|
||||
} else {
|
||||
for (String fileToOpen : filesToOpen) {
|
||||
openFile(fileToOpen, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -3311,9 +3307,9 @@ public class Main {
|
||||
|
||||
} catch (Exception ex) {
|
||||
throw new RuntimeException("Problems with creating the log files");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static List<SWF> getDependencies(SWF swf) {
|
||||
SwfSpecificCustomConfiguration conf = Configuration.getSwfSpecificCustomConfiguration(swf.getShortPathTitle());
|
||||
List<SWF> dependencies = new ArrayList<>();
|
||||
@@ -3325,7 +3321,7 @@ public class Main {
|
||||
}
|
||||
return dependencies;
|
||||
}
|
||||
|
||||
|
||||
public static void showBreakpointsList() {
|
||||
SWF swf = getMainFrame().getPanel().getCurrentSwf();
|
||||
getMainFrame().getPanel().showBreakpointlistDialog(swf);
|
||||
|
||||
@@ -72,7 +72,7 @@ public final class MainFrameClassic extends AppFrame implements MainFrame {
|
||||
Insets insets = Toolkit.getDefaultToolkit().getScreenInsets(device.getDefaultConfiguration());
|
||||
int maxWidth = bounds.width - (insets.left + insets.right);
|
||||
int maxHeight = bounds.height - (insets.top + insets.bottom);
|
||||
|
||||
|
||||
if (w > maxWidth) {
|
||||
w = maxWidth;
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ public abstract class MainFrameMenu implements MenuBuilder {
|
||||
try {
|
||||
openable.saveTo(baos);
|
||||
SWF swf = (SWF) openable;
|
||||
byte[] data = baos.toByteArray();
|
||||
byte[] data = baos.toByteArray();
|
||||
swf.binaryData.setDataBytes(new ByteArrayRange(data));
|
||||
swf.binaryData.setModified(true);
|
||||
swf.binaryData.getTopLevelBinaryData().pack();
|
||||
@@ -1356,7 +1356,7 @@ public abstract class MainFrameMenu implements MenuBuilder {
|
||||
Configuration.flattenASPackages.addListener(configListenerFlattenASPackages = (Boolean newValue) -> {
|
||||
setMenuChecked("/settings/flattenASPackages", newValue);
|
||||
});
|
||||
|
||||
|
||||
if (Platform.isWindows()) {
|
||||
setMenuChecked("/settings/associate", ContextMenuTools.isAddedToContextMenu());
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ public final class MainFrameRibbon extends AppRibbonFrame {
|
||||
Insets insets = Toolkit.getDefaultToolkit().getScreenInsets(device.getDefaultConfiguration());
|
||||
int maxWidth = bounds.width - (insets.left + insets.right);
|
||||
int maxHeight = bounds.height - (insets.top + insets.bottom);
|
||||
|
||||
|
||||
if (w > maxWidth) {
|
||||
w = maxWidth;
|
||||
}
|
||||
@@ -106,7 +106,7 @@ public final class MainFrameRibbon extends AppRibbonFrame {
|
||||
}
|
||||
if (maximizedVertical) {
|
||||
state |= JFrame.MAXIMIZED_VERT;
|
||||
}
|
||||
}
|
||||
setExtendedState(state);
|
||||
|
||||
View.setWindowIcon(this);
|
||||
@@ -185,19 +185,17 @@ public final class MainFrameRibbon extends AppRibbonFrame {
|
||||
GraphicsConfiguration gc = View.getWindowDevice(MainFrameRibbon.this.getWindow()).getDefaultConfiguration();
|
||||
|
||||
Insets screenInsets = Toolkit.getDefaultToolkit().getScreenInsets(gc);
|
||||
Rectangle screenBounds = gc.getBounds();
|
||||
Rectangle screenBounds = gc.getBounds();
|
||||
Rectangle maxBounds = new Rectangle(
|
||||
screenBounds.x + screenInsets.left,
|
||||
screenBounds.y + screenInsets.top,
|
||||
screenBounds.width - (screenInsets.left + screenInsets.right),
|
||||
screenBounds.height - (screenInsets.top + screenInsets.bottom)
|
||||
screenBounds.x + screenInsets.left,
|
||||
screenBounds.y + screenInsets.top,
|
||||
screenBounds.width - (screenInsets.left + screenInsets.right),
|
||||
screenBounds.height - (screenInsets.top + screenInsets.bottom)
|
||||
);
|
||||
setMaximizedBounds(maxBounds);
|
||||
}
|
||||
super.setExtendedState(state);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static void getApplicationMenuButtons(Component comp, List<JRibbonApplicationMenuButton> ret) {
|
||||
if (comp instanceof JRibbonApplicationMenuButton) {
|
||||
|
||||
@@ -176,7 +176,7 @@ public class MainFrameRibbonMenu extends MainFrameMenu {
|
||||
SWF swf;
|
||||
if (openable == null) {
|
||||
swf = null;
|
||||
} else if (openable instanceof SWF) {
|
||||
} else if (openable instanceof SWF) {
|
||||
swf = (SWF) openable;
|
||||
} else {
|
||||
swf = ((ABC) openable).getSwf();
|
||||
@@ -513,7 +513,7 @@ public class MainFrameRibbonMenu extends MainFrameMenu {
|
||||
} else if (o instanceof JComponent) {
|
||||
band.addRibbonComponent(new JRibbonComponent((JComponent) o));
|
||||
cnt++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (cnt > 0) {
|
||||
if (parts.length != 3) {
|
||||
|
||||
@@ -457,9 +457,8 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
public ScrollPosStorage scrollPosStorage;
|
||||
|
||||
private Map<Openable, ABCExplorerDialog> abcExplorerDialogs = new WeakHashMap<>();
|
||||
|
||||
private Map<SWF, BreakpointListDialog> breakpointsListDialogs = new WeakHashMap<>();
|
||||
|
||||
private Map<SWF, BreakpointListDialog> breakpointsListDialogs = new WeakHashMap<>();
|
||||
|
||||
public void savePins() {
|
||||
pinsPanel.save();
|
||||
@@ -693,7 +692,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
if (e.getKeyCode() == 'C') {
|
||||
if (!frameItems.isEmpty()) {
|
||||
contextPopupMenu.copyTagOrFrameToClipboardActionPerformed(null, frameItems);
|
||||
} else {
|
||||
} else {
|
||||
if (e.isShiftDown()) {
|
||||
contextPopupMenu.copyTagToClipboardWithDependenciesActionPerformed(null, tagItems);
|
||||
} else {
|
||||
@@ -728,7 +727,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
if (firstItem.getOpenable() != getClipboardContents().iterator().next().getOpenable()) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
} else {
|
||||
if (!((firstItem instanceof Tag) || (firstItem instanceof Frame))) {
|
||||
return;
|
||||
}
|
||||
@@ -790,7 +789,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
public boolean clipboardEmpty() {
|
||||
return clipboard.isEmpty();
|
||||
}
|
||||
|
||||
|
||||
public ClipboardType getClipboardType() {
|
||||
if (clipboard.isEmpty()) {
|
||||
return ClipboardType.NONE;
|
||||
@@ -1083,7 +1082,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
public String translate(String key) {
|
||||
if (mainFrame == null) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
return mainFrame.translate(key);
|
||||
}
|
||||
|
||||
@@ -1692,7 +1691,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
if (abcExportDialog != null) {
|
||||
abcExportDialog.setVisible(false);
|
||||
abcExplorerDialogs.remove(openable);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (Openable openable : openableList) {
|
||||
@@ -1784,14 +1783,14 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
if (cc != null) {
|
||||
cc.setCustomData(CustomConfigurationKeys.KEY_LOADED_IMPORT_ASSETS, "");
|
||||
}
|
||||
|
||||
|
||||
saveBreakpoints(swf);
|
||||
|
||||
ABCExplorerDialog abcExportDialog = abcExplorerDialogs.get(swf);
|
||||
if (abcExportDialog != null) {
|
||||
abcExportDialog.setVisible(false);
|
||||
}
|
||||
|
||||
|
||||
BreakpointListDialog breakpointsListDialog = breakpointsListDialogs.get(swf);
|
||||
if (breakpointsListDialog != null) {
|
||||
breakpointsListDialog.setVisible(false);
|
||||
@@ -2064,13 +2063,13 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
as12scripts.add(d);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (d instanceof SoundStreamHeadTypeTag) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (d instanceof Tag
|
||||
|| d instanceof ASMSource
|
||||
if (d instanceof Tag
|
||||
|| d instanceof ASMSource
|
||||
|| d instanceof BinaryDataInterface
|
||||
|| d instanceof SoundStreamFrameRange) {
|
||||
TreeNodeType nodeType = TagTree.getTreeNodeType(d);
|
||||
@@ -2496,13 +2495,13 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
public List<OpenableList> getSwfs() {
|
||||
return openables;
|
||||
}
|
||||
|
||||
|
||||
public Map<String, SWF> getSwfsMap(SWF swf) {
|
||||
Map<String, SWF> result = new LinkedHashMap<>();
|
||||
populateSwfs(result, swf, swf.getShortFileName());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
private void populateSwfs(Map<String, SWF> result, SWF targetSwf, String name) {
|
||||
for (Tag t : targetSwf.getTags()) {
|
||||
if (t instanceof DefineBinaryDataTag) {
|
||||
@@ -2513,10 +2512,10 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
if (binaryData.getInnerSwf() != null) {
|
||||
result.put(bname, binaryData.getInnerSwf());
|
||||
}
|
||||
} while ((binaryData = binaryData.getSub()) != null);
|
||||
} while ((binaryData = binaryData.getSub()) != null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public OpenableList getCurrentSwfList() {
|
||||
SWF swf = getCurrentSwf();
|
||||
@@ -2645,9 +2644,9 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
@Override
|
||||
public void run() {
|
||||
abcPanel.detailPanel.methodTraitPanel.methodCodePanel.gotoInstrLine(line);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
} else {
|
||||
abcPanel.decompiledTextArea.gotoLine(line);
|
||||
}
|
||||
@@ -2974,7 +2973,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
|
||||
boolean ignoreCase = searchDialog.ignoreCaseCheckBox.isSelected();
|
||||
boolean regexp = searchDialog.regexpCheckBox.isSelected();
|
||||
|
||||
|
||||
boolean scriptSearch = searchDialog.searchInASRadioButton.isSelected()
|
||||
|| searchDialog.searchInPCodeRadioButton.isSelected();
|
||||
if (scriptSearch) {
|
||||
@@ -3404,15 +3403,15 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
}
|
||||
path += compressed ? ".fla" : ".xfl";
|
||||
final FLAVersion selectedVersion = versions.get(compressed ? flaFilters.indexOf(selectedFilter) : xflFilters.indexOf(selectedFilter));
|
||||
final File selfile = new File(path);
|
||||
final File selfile = new File(path);
|
||||
long timeBefore = System.currentTimeMillis();
|
||||
new CancellableWorker() {
|
||||
@Override
|
||||
protected Void doInBackground() throws Exception {
|
||||
Helper.freeMem();
|
||||
|
||||
|
||||
CancellableWorker w = this;
|
||||
|
||||
|
||||
ProgressListener prog = new ProgressListener() {
|
||||
@Override
|
||||
public void progress(int p) {
|
||||
@@ -3423,7 +3422,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
Main.startWork(translate("work.exporting.fla") + "..." + status, w);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
try {
|
||||
AbortRetryIgnoreHandler errorHandler = new GuiAbortRetryIgnoreHandler();
|
||||
if (compressed) {
|
||||
@@ -3453,14 +3452,14 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
View.execInEventDispatch(() -> {
|
||||
setStatus(translate("export.finishedin").replace("%time%", Helper.formatTimeSec(timeMs)));
|
||||
});
|
||||
|
||||
|
||||
if (Configuration.openFolderAfterFlaExport.get()) {
|
||||
try {
|
||||
Desktop.getDesktop().open(selfile.getAbsoluteFile().getParentFile());
|
||||
} catch (IOException ex) {
|
||||
logger.log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}.execute();
|
||||
}
|
||||
@@ -3893,8 +3892,8 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
|
||||
@Override
|
||||
public void scriptImportError() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
List<ScriptPack> packs;
|
||||
@@ -3915,9 +3914,9 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
|
||||
@Override
|
||||
public void scriptImportError() {
|
||||
}
|
||||
}
|
||||
},
|
||||
Main.getDependencies(swf)
|
||||
Main.getDependencies(swf)
|
||||
);
|
||||
|
||||
if (countAs3 > 0) {
|
||||
@@ -4427,10 +4426,9 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
|
||||
tagTree.updateSwfs(openables);
|
||||
tagListTree.updateSwfs(openables);
|
||||
|
||||
|
||||
|
||||
getCurrentTree().clearSelection();
|
||||
if (selectionPath != null) {
|
||||
if (selectionPath != null) {
|
||||
getCurrentTree().setSelectionPathString(selectionPath);
|
||||
}
|
||||
reload(true);
|
||||
@@ -4551,16 +4549,16 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
if (fileStart == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
DefineShape4Tag shapeStart = new DefineShape4Tag(morphShape.getSwf());
|
||||
SWF.addTagBefore(shapeStart, morphShape);
|
||||
|
||||
|
||||
DefineShape4Tag shapeEnd = new DefineShape4Tag(morphShape.getSwf());
|
||||
SWF.addTagBefore(shapeEnd, morphShape);
|
||||
|
||||
|
||||
shapeStart.shapeBounds = Helper.deepCopy(morphShape.startBounds);
|
||||
shapeEnd.shapeBounds = Helper.deepCopy(morphShape.endBounds);
|
||||
|
||||
|
||||
if (morphShape instanceof DefineMorphShape2Tag) {
|
||||
DefineMorphShape2Tag ms2 = (DefineMorphShape2Tag) morphShape;
|
||||
shapeStart.edgeBounds = Helper.deepCopy(ms2.startEdgeBounds);
|
||||
@@ -4578,8 +4576,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
} else {
|
||||
dataStart = Helper.readFile(selfileStart.getAbsolutePath());
|
||||
}
|
||||
|
||||
|
||||
|
||||
try {
|
||||
Tag newStartTag;
|
||||
if (svgTextStart != null) {
|
||||
@@ -4588,15 +4585,15 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
newStartTag = new ShapeImporter().importImage(shapeStart, dataStart, 0, fill);
|
||||
}
|
||||
newStartTag.getTimelined().removeTag(newStartTag);
|
||||
|
||||
|
||||
if (shapeEnd.shapes.shapeRecords.size() <= 1) {
|
||||
File fileEnd = showImportFileChooser("filter.images|*.jpg;*.jpeg;*.gif;*.png;*.bmp;*.svg", true, AppStrings.translate("dialog.morphshape.endShape"));
|
||||
|
||||
if (fileEnd == null) {
|
||||
fileEnd = fileStart;
|
||||
}
|
||||
|
||||
File selfileEnd = Helper.fixDialogFile(fileEnd);
|
||||
|
||||
File selfileEnd = Helper.fixDialogFile(fileEnd);
|
||||
byte[] dataEnd = null;
|
||||
String svgTextEnd = null;
|
||||
if (".svg".equals(Path.getExtension(selfileEnd))) {
|
||||
@@ -4607,7 +4604,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
} else {
|
||||
dataEnd = Helper.readFile(selfileEnd.getAbsolutePath());
|
||||
}
|
||||
|
||||
|
||||
Tag newEndTag;
|
||||
if (svgTextEnd != null) {
|
||||
newEndTag = new SvgImporter().importSvg(shapeEnd, svgTextEnd, fill);
|
||||
@@ -4616,30 +4613,30 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
}
|
||||
newEndTag.getTimelined().removeTag(newEndTag);
|
||||
}
|
||||
|
||||
|
||||
DefineMorphShape2Tag newMorphShape = new DefineMorphShape2Tag(morphShape.getSwf());
|
||||
newMorphShape.setTimelined(morphShape.getTimelined());
|
||||
SWF.addTagBefore(newMorphShape, morphShape);
|
||||
|
||||
|
||||
MorphShapeGenerator gen = new MorphShapeGenerator();
|
||||
try {
|
||||
gen.generate(newMorphShape, shapeStart, shapeEnd);
|
||||
gen.generate(newMorphShape, shapeStart, shapeEnd);
|
||||
} catch (StyleMismatchException sme) {
|
||||
newMorphShape.getTimelined().removeTag(newMorphShape);
|
||||
SWF swf = morphShape.getSwf();
|
||||
SWF swf = morphShape.getSwf();
|
||||
swf.resetTimeline();
|
||||
refreshTree(swf);
|
||||
ViewMessages.showMessageDialog(this, AppStrings.translate("error.morphshape.incompatible"), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
|
||||
return false;
|
||||
}
|
||||
SWF swf = newMorphShape.getSwf();
|
||||
|
||||
SWF swf = newMorphShape.getSwf();
|
||||
|
||||
morphShape.getTimelined().removeTag(morphShape);
|
||||
newMorphShape.setCharacterId(morphShape.getCharacterId());
|
||||
swf.updateCharacters();
|
||||
swf.updateCharacters();
|
||||
swf.resetTimeline();
|
||||
refreshTree(swf);
|
||||
setTagTreeSelectedNode(getCurrentTree(), newMorphShape);
|
||||
setTagTreeSelectedNode(getCurrentTree(), newMorphShape);
|
||||
swf.clearImageCache();
|
||||
swf.clearShapeCache();
|
||||
} catch (IOException ex) {
|
||||
@@ -4887,7 +4884,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
newTag = new SvgImporter().importSvg(st, svgText, false);
|
||||
} else {
|
||||
newTag = new ShapeImporter().importImage(st, data, 0, false);
|
||||
}
|
||||
}
|
||||
SWF swf = st.getSwf();
|
||||
if (newTag != null) {
|
||||
refreshTree(swf);
|
||||
@@ -5039,7 +5036,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
if (title != null) {
|
||||
fc.setDialogTitle(title);
|
||||
}
|
||||
|
||||
|
||||
if (fc.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {
|
||||
File result = fc.getSelectedFile();
|
||||
Configuration.lastOpenDir.set(Helper.fixDialogFile(result).getParentFile().getAbsolutePath());
|
||||
@@ -5601,11 +5598,11 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
} else if ((treeItem instanceof BUTTONRECORD) && (!((BUTTONRECORD) treeItem).getSwf().getCyclicCharacters().contains(((BUTTONRECORD) treeItem).characterId))) {
|
||||
BUTTONRECORD buttonRecord = (BUTTONRECORD) treeItem;
|
||||
previewPanel.setParametersPanelVisible(false);
|
||||
SWF origSwf = ((SWF)treeItem.getOpenable());
|
||||
SWF origSwf = ((SWF) treeItem.getOpenable());
|
||||
Timelined tim = new Timelined() {
|
||||
|
||||
|
||||
ReadOnlyTagList cachedTags = null;
|
||||
|
||||
|
||||
@Override
|
||||
public SWF getSwf() {
|
||||
return origSwf;
|
||||
@@ -5613,17 +5610,17 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
|
||||
@Override
|
||||
public Timeline getTimeline() {
|
||||
return new Timeline(origSwf, this, Integer.MAX_VALUE,buttonRecord.getTag().getRect());
|
||||
return new Timeline(origSwf, this, Integer.MAX_VALUE, buttonRecord.getTag().getRect());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetTimeline() {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setModified(boolean value) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -5695,7 +5692,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
public RECT getRectWithStrokes() {
|
||||
return getRect();
|
||||
}
|
||||
};
|
||||
};
|
||||
previewPanel.showImagePanel(tim, origSwf, 0, true, true, !Configuration.animateSubsprites.get(), false, !Configuration.playFrameSounds.get(), true, false, true);
|
||||
} else if (treeItem instanceof DefineFont4Tag) {
|
||||
previewPanel.showGenericTagPanel((Tag) treeItem);
|
||||
@@ -5711,7 +5708,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
|
||||
private void saveBreakpoints(Openable openable) {
|
||||
if (openable instanceof SWF) {
|
||||
SwfSpecificCustomConfiguration swfCustomConf = Configuration.getOrCreateSwfSpecificCustomConfiguration(openable.getShortPathTitle());
|
||||
SwfSpecificCustomConfiguration swfCustomConf = Configuration.getOrCreateSwfSpecificCustomConfiguration(openable.getShortPathTitle());
|
||||
SWF swf = (SWF) openable;
|
||||
Map<String, Set<Integer>> breakpoints = Main.getDebugHandler().getAllBreakPoints(swf, false);
|
||||
List<String> breakpointList = new ArrayList<>();
|
||||
@@ -5726,8 +5723,8 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
|
||||
public void reload(boolean forceReload) {
|
||||
reload(forceReload, true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void reload(boolean forceReload, boolean scrollToVisible) {
|
||||
View.checkAccess();
|
||||
|
||||
@@ -5806,7 +5803,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
if (treeItem instanceof SceneFrame) {
|
||||
frameTreeItem = ((SceneFrame) treeItem).getFrame();
|
||||
}
|
||||
|
||||
|
||||
if ((treeItem instanceof AS3Package) && ((AS3Package) treeItem).isCompoundScript()) {
|
||||
final ScriptPack scriptLeaf = ((AS3Package) treeItem).getCompoundInitializerPack();
|
||||
if (Main.isInited() && (!Main.isWorking() || Main.isDebugging())) {
|
||||
@@ -6111,8 +6108,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
String folderName = item.getName();
|
||||
if (TagTreeModel.FOLDER_OTHERS.equals(folderName)
|
||||
|| TagTreeModel.FOLDER_SCRIPTS.equals(folderName)
|
||||
|| TagTreeModel.FOLDER_SOUNDS.equals(folderName)
|
||||
) {
|
||||
|| TagTreeModel.FOLDER_SOUNDS.equals(folderName)) {
|
||||
showFolderList(tagTree.getFullModel().getTreePath(item));
|
||||
return;
|
||||
}
|
||||
@@ -6124,7 +6120,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
folderPreviewPanel.setItems(folderPreviewItems);
|
||||
showCard(CARDFOLDERPREVIEWPANEL);
|
||||
}
|
||||
|
||||
|
||||
private void showFolderPreviewList(TreePath path) {
|
||||
List<TreeItem> items = new ArrayList<>(getCurrentTree().getFullModel().getAllChildren((TreeItem) path.getLastPathComponent()));
|
||||
folderPreviewPanel.setItems(items);
|
||||
@@ -6289,7 +6285,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
|
||||
return new Timelined() {
|
||||
private Timeline tim;
|
||||
|
||||
|
||||
@Override
|
||||
public Timeline getTimeline() {
|
||||
if (tim == null) {
|
||||
@@ -6309,8 +6305,6 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void initTimeline(Timeline timeline) {
|
||||
if (tag instanceof MorphShapeTag) {
|
||||
timeline.frameRate = PreviewExporter.MORPH_SHAPE_ANIMATION_FRAME_RATE;
|
||||
@@ -6637,7 +6631,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
}
|
||||
return dialog;
|
||||
}
|
||||
|
||||
|
||||
public BreakpointListDialog showBreakpointlistDialog(SWF swf) {
|
||||
BreakpointListDialog dialog = breakpointsListDialogs.get(swf);
|
||||
if (dialog != null) {
|
||||
|
||||
@@ -193,9 +193,9 @@ public class PreviewPanel extends JPersistentSplitPane implements TagEditorPanel
|
||||
|
||||
// Image tag buttons
|
||||
private JButton replaceShapeButton;
|
||||
|
||||
|
||||
private JButton replaceMorphShapeButton;
|
||||
|
||||
|
||||
private JButton replaceMorphShapeUpdateBoundsButton;
|
||||
|
||||
private JButton replaceShapeUpdateBoundsButton;
|
||||
@@ -324,8 +324,8 @@ public class PreviewPanel extends JPersistentSplitPane implements TagEditorPanel
|
||||
if (readOnly) {
|
||||
parametersPanel.setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public PreviewPanel(MainPanel mainPanel, FlashPlayerPanel flashPanel) {
|
||||
super(JSplitPane.HORIZONTAL_SPLIT, Configuration.guiPreviewSplitPaneDividerLocationPercent);
|
||||
this.mainPanel = mainPanel;
|
||||
@@ -361,7 +361,7 @@ public class PreviewPanel extends JPersistentSplitPane implements TagEditorPanel
|
||||
public FontPanel getFontPanel() {
|
||||
return fontPanel;
|
||||
}
|
||||
|
||||
|
||||
private void createParametersPanel() {
|
||||
displayWithPreview = new JPanel(new CardLayout());
|
||||
|
||||
@@ -584,13 +584,13 @@ public class PreviewPanel extends JPersistentSplitPane implements TagEditorPanel
|
||||
}
|
||||
|
||||
private void setStatus(String status) {
|
||||
imagePlayControls.setStatus(status);
|
||||
imagePlayControls.setStatus(status);
|
||||
}
|
||||
|
||||
|
||||
private void setNoStatus() {
|
||||
setStatus("");
|
||||
}
|
||||
|
||||
|
||||
private JPanel createImagesCard() {
|
||||
JPanel shapesCard = new JPanel(new BorderLayout());
|
||||
JPanel previewPanel = new JPanel(new BorderLayout());
|
||||
@@ -843,7 +843,7 @@ public class PreviewPanel extends JPersistentSplitPane implements TagEditorPanel
|
||||
ser.deltaY = points.get(pointsPos).y - y;
|
||||
ser.simplify();
|
||||
ser.calculateBits();
|
||||
pointsPos += 1;
|
||||
pointsPos += 1;
|
||||
}
|
||||
if (rec instanceof CurvedEdgeRecord) {
|
||||
CurvedEdgeRecord cer = (CurvedEdgeRecord) rec;
|
||||
@@ -986,7 +986,7 @@ public class PreviewPanel extends JPersistentSplitPane implements TagEditorPanel
|
||||
cer.anchorDeltaY = (int) Math.round(left.get(2).getY() - left.get(1).getY());
|
||||
|
||||
cer.calculateBits();
|
||||
|
||||
|
||||
CurvedEdgeRecord newCer = new CurvedEdgeRecord();
|
||||
newCer.controlDeltaX = (int) Math.round(right.get(1).getX() - right.get(0).getX());
|
||||
newCer.controlDeltaY = (int) Math.round(right.get(1).getY() - right.get(0).getY());
|
||||
@@ -1191,7 +1191,7 @@ public class PreviewPanel extends JPersistentSplitPane implements TagEditorPanel
|
||||
//placeSplitPane.setDividerLocation(800);
|
||||
displayEditTagCard.add(createDisplayEditTagButtonsPanel(), BorderLayout.SOUTH);
|
||||
|
||||
((GenericTagTreePanel) displayEditGenericPanel).addTreeSelectionListener(new TreeSelectionListener() {
|
||||
((GenericTagTreePanel) displayEditGenericPanel).addTreeSelectionListener(new TreeSelectionListener() {
|
||||
@Override
|
||||
public void valueChanged(TreeSelectionEvent e) {
|
||||
if (e.getNewLeadSelectionPath() == null) {
|
||||
@@ -1199,7 +1199,7 @@ public class PreviewPanel extends JPersistentSplitPane implements TagEditorPanel
|
||||
displayEditImagePanel.setHilightedEdge(null);
|
||||
return;
|
||||
}
|
||||
JTree tree = (JTree) e.getSource();
|
||||
JTree tree = (JTree) e.getSource();
|
||||
Object obj = e.getPath().getLastPathComponent();
|
||||
if (obj instanceof GenericTagTreePanel.FieldNode) {
|
||||
GenericTagTreePanel.FieldNode fieldNode = (GenericTagTreePanel.FieldNode) obj;
|
||||
@@ -1266,7 +1266,7 @@ public class PreviewPanel extends JPersistentSplitPane implements TagEditorPanel
|
||||
.replace("%x3%", "" + point3.x)
|
||||
.replace("%y3%", "" + point3.y);
|
||||
} else if (rec instanceof StyleChangeRecord) {
|
||||
StyleChangeRecord scr = (StyleChangeRecord) rec;
|
||||
StyleChangeRecord scr = (StyleChangeRecord) rec;
|
||||
List<String> styleStatusParts = new ArrayList<>();
|
||||
if (scr.stateMoveTo) {
|
||||
Point point1 = new Point(scr.moveDeltaX, scr.moveDeltaY);
|
||||
@@ -1278,7 +1278,7 @@ public class PreviewPanel extends JPersistentSplitPane implements TagEditorPanel
|
||||
} else {
|
||||
Point point1 = new Point(x, y);
|
||||
Point[] hilightedPoint = new Point[]{point1};
|
||||
displayEditImagePanel.setHilightedEdge(hilightedPoint);
|
||||
displayEditImagePanel.setHilightedEdge(hilightedPoint);
|
||||
}
|
||||
if (scr.stateNewStyles) {
|
||||
int shapeNum = 0;
|
||||
@@ -1296,7 +1296,7 @@ public class PreviewPanel extends JPersistentSplitPane implements TagEditorPanel
|
||||
styleStatusParts.add(AppStrings.translate("shaperecords.edge.style.newstyles")
|
||||
.replace("%numfillstyles%", "" + scr.fillStyles.fillStyles.length)
|
||||
.replace("%numlinestyles%", "" + (shapeNum < 3 ? scr.lineStyles.lineStyles.length : scr.lineStyles.lineStyles2.length))
|
||||
);
|
||||
);
|
||||
}
|
||||
if (scr.stateFillStyle0) {
|
||||
styleStatusParts.add(AppStrings.translate("shaperecords.edge.style.fillstyle0")
|
||||
@@ -1305,7 +1305,7 @@ public class PreviewPanel extends JPersistentSplitPane implements TagEditorPanel
|
||||
if (scr.stateFillStyle1) {
|
||||
styleStatusParts.add(AppStrings.translate("shaperecords.edge.style.fillstyle1")
|
||||
.replace("%value%", "" + scr.fillStyle1));
|
||||
}
|
||||
}
|
||||
String styleDetails = String.join(", ", styleStatusParts);
|
||||
edgeStatus = AppStrings.translate("shaperecords.edge.style").replace("%details%", styleDetails);
|
||||
} else if (rec instanceof EndShapeRecord) {
|
||||
@@ -1318,13 +1318,13 @@ public class PreviewPanel extends JPersistentSplitPane implements TagEditorPanel
|
||||
displayEditImagePanel.setStatus("");
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
String status = AppStrings.translate("shaperecords.status")
|
||||
.replace("%fillstyle0%", "" + fillStyle0)
|
||||
.replace("%fillstyle1%", "" + fillStyle1)
|
||||
.replace("%linestyle%", "" + lineStyle)
|
||||
.replace("%stylesindex%", "" + stylesIndex)
|
||||
.replace("%edge%", edgeStatus);
|
||||
.replace("%edge%", edgeStatus);
|
||||
displayEditImagePanel.setStatus(status);
|
||||
break;
|
||||
}
|
||||
@@ -1402,7 +1402,7 @@ public class PreviewPanel extends JPersistentSplitPane implements TagEditorPanel
|
||||
}
|
||||
});
|
||||
replaceShapeButton.setVisible(false);
|
||||
|
||||
|
||||
replaceMorphShapeButton = new JButton(mainPanel.translate("button.replace"), View.getIcon("importmorphshape16"));
|
||||
replaceMorphShapeButton.setMargin(new Insets(3, 3, 3, 10));
|
||||
replaceMorphShapeButton.addActionListener(new ActionListener() {
|
||||
@@ -1412,7 +1412,7 @@ public class PreviewPanel extends JPersistentSplitPane implements TagEditorPanel
|
||||
}
|
||||
});
|
||||
replaceMorphShapeButton.setVisible(false);
|
||||
|
||||
|
||||
replaceMorphShapeUpdateBoundsButton = new JButton(mainPanel.translate("button.replaceNoFill"), View.getIcon("importmorphshape16"));
|
||||
replaceMorphShapeUpdateBoundsButton.setMargin(new Insets(3, 3, 3, 10));
|
||||
replaceMorphShapeUpdateBoundsButton.addActionListener(new ActionListener() {
|
||||
@@ -1847,7 +1847,7 @@ public class PreviewPanel extends JPersistentSplitPane implements TagEditorPanel
|
||||
replaceImageAlphaButton.setVisible(showAlpha);
|
||||
replaceSpriteButton.setVisible(showSprite);
|
||||
replaceShapeButton.setVisible(showShape);
|
||||
replaceMorphShapeButton.setVisible(showMorphShape);
|
||||
replaceMorphShapeButton.setVisible(showMorphShape);
|
||||
morphShowPanel.setVisible(showMorphShape);
|
||||
displayEditEditPointsButton.setVisible(showShape || showMorphShape);
|
||||
replaceShapeUpdateBoundsButton.setVisible(showShape);
|
||||
@@ -2244,7 +2244,7 @@ public class PreviewPanel extends JPersistentSplitPane implements TagEditorPanel
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private void saveDisplayEditTag(boolean refreshTree) {
|
||||
if (displayEditMode == EDIT_TRANSFORM) {
|
||||
Matrix matrix = displayEditImagePanel.getNewMatrix();
|
||||
@@ -2256,7 +2256,6 @@ public class PreviewPanel extends JPersistentSplitPane implements TagEditorPanel
|
||||
if (displayEditTag instanceof ShapeTag) {
|
||||
ShapeTag shape = (ShapeTag) displayEditTag;
|
||||
|
||||
|
||||
RECT newShapeBounds = transformRECT(matrix, shape.shapeBounds);
|
||||
if (checkRectLarge(newShapeBounds)) {
|
||||
return;
|
||||
@@ -2269,8 +2268,8 @@ public class PreviewPanel extends JPersistentSplitPane implements TagEditorPanel
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
oldShapeRecords = Helper.deepCopy(shape.shapes.shapeRecords);
|
||||
|
||||
oldShapeRecords = Helper.deepCopy(shape.shapes.shapeRecords);
|
||||
transformSHAPE(matrix, shape.shapes, shape.getShapeNum());
|
||||
if (checkShapeLarge(shape.shapes.shapeRecords)) {
|
||||
shape.shapes.shapeRecords = oldShapeRecords;
|
||||
@@ -2301,8 +2300,8 @@ public class PreviewPanel extends JPersistentSplitPane implements TagEditorPanel
|
||||
DefineMorphShape2Tag morphShape2 = (DefineMorphShape2Tag) morphShape;
|
||||
newEdgeBounds = transformRECT(matrix, morphShape2.startEdgeBounds);
|
||||
}
|
||||
|
||||
oldShapeRecords = Helper.deepCopy(morphShape.startEdges.shapeRecords);
|
||||
|
||||
oldShapeRecords = Helper.deepCopy(morphShape.startEdges.shapeRecords);
|
||||
transformSHAPE(matrix, morphShape.startEdges, morphShape.getShapeNum() == 1 ? 3 : 4);
|
||||
if (checkShapeLarge(morphShape.startEdges.shapeRecords)) {
|
||||
morphShape.startEdges.shapeRecords = oldShapeRecords;
|
||||
@@ -2327,8 +2326,8 @@ public class PreviewPanel extends JPersistentSplitPane implements TagEditorPanel
|
||||
DefineMorphShape2Tag morphShape2 = (DefineMorphShape2Tag) morphShape;
|
||||
newEdgeBounds = transformRECT(matrix, morphShape2.endEdgeBounds);
|
||||
}
|
||||
|
||||
oldShapeRecords = Helper.deepCopy(morphShape.endEdges.shapeRecords);
|
||||
|
||||
oldShapeRecords = Helper.deepCopy(morphShape.endEdges.shapeRecords);
|
||||
transformSHAPE(matrix, morphShape.endEdges, morphShape.getShapeNum() == 1 ? 3 : 4);
|
||||
if (checkShapeLarge(morphShape.endEdges.shapeRecords)) {
|
||||
morphShape.endEdges.shapeRecords = oldShapeRecords;
|
||||
@@ -2374,7 +2373,7 @@ public class PreviewPanel extends JPersistentSplitPane implements TagEditorPanel
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
displayEditImagePanel.setHilightedPoints(null);
|
||||
displayEditTag.setModified(true);
|
||||
if (displayEditTag instanceof ShapeTag) {
|
||||
@@ -2396,12 +2395,12 @@ public class PreviewPanel extends JPersistentSplitPane implements TagEditorPanel
|
||||
morphShape.updateStartBounds();
|
||||
if (checkRectLarge(morphShape.endBounds)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (morphShape instanceof DefineMorphShape2Tag) {
|
||||
DefineMorphShape2Tag morphShape2 = (DefineMorphShape2Tag) morphShape;
|
||||
if (checkRectLarge(morphShape2.endEdgeBounds)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (morphDisplayMode == MORPH_END) {
|
||||
@@ -2413,7 +2412,7 @@ public class PreviewPanel extends JPersistentSplitPane implements TagEditorPanel
|
||||
DefineMorphShape2Tag morphShape2 = (DefineMorphShape2Tag) morphShape;
|
||||
if (checkRectLarge(morphShape2.startEdgeBounds)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2441,7 +2440,7 @@ public class PreviewPanel extends JPersistentSplitPane implements TagEditorPanel
|
||||
replaceShapeUpdateBoundsButton.setVisible(true);
|
||||
displayEditEditPointsButton.setVisible(true);
|
||||
}
|
||||
|
||||
|
||||
if (displayEditTag instanceof MorphShapeTag) {
|
||||
replaceMorphShapeButton.setVisible(true);
|
||||
replaceMorphShapeUpdateBoundsButton.setVisible(true);
|
||||
@@ -2496,7 +2495,7 @@ public class PreviewPanel extends JPersistentSplitPane implements TagEditorPanel
|
||||
displayEditSaveButton.setVisible(true);
|
||||
displayEditCancelButton.setVisible(true);
|
||||
replaceShapeButton.setVisible(false);
|
||||
replaceMorphShapeButton.setVisible(false);
|
||||
replaceMorphShapeButton.setVisible(false);
|
||||
replaceShapeUpdateBoundsButton.setVisible(false);
|
||||
replaceMorphShapeUpdateBoundsButton.setVisible(false);
|
||||
displayEditEditPointsButton.setVisible(false);
|
||||
@@ -2750,15 +2749,15 @@ public class PreviewPanel extends JPersistentSplitPane implements TagEditorPanel
|
||||
}
|
||||
|
||||
CharacterTag displayedCharacter = (CharacterTag) item;
|
||||
|
||||
CharacterTag placedCharacter = displayedCharacter;
|
||||
|
||||
CharacterTag placedCharacter = displayedCharacter;
|
||||
SWF origSwf = placedCharacter.getSwf();
|
||||
RECT rect = origSwf.getRect();
|
||||
if (displayedCharacter instanceof BoundedTag) {
|
||||
rect = ((BoundedTag) displayedCharacter).getRect();
|
||||
}
|
||||
final RECT frect = rect;
|
||||
Timelined tim = new Timelined() {
|
||||
Timelined tim = new Timelined() {
|
||||
ReadOnlyTagList cachedTags = null;
|
||||
|
||||
@Override
|
||||
|
||||
@@ -49,13 +49,13 @@ public class QuickFindPanel extends JPanel {
|
||||
public JTextField findTextField;
|
||||
|
||||
public JButton prevButton;
|
||||
|
||||
|
||||
public JButton nextButton;
|
||||
|
||||
public JCheckBox ignoreCaseCheckbox;
|
||||
|
||||
|
||||
public JCheckBox regExpCheckbox;
|
||||
|
||||
|
||||
public JCheckBox wrapCheckbox;
|
||||
|
||||
public JLabel statusLabel;
|
||||
|
||||
@@ -54,11 +54,10 @@ public class ReplaceCharacterDialog extends AppDialog {
|
||||
private final JButton cancelButton = new JButton(translate("button.cancel"));
|
||||
|
||||
//private final JComboBox<ComboBoxItem<CharacterTag>> charactersComboBox = new JComboBox<>();
|
||||
|
||||
private final JList<ComboBoxItem<CharacterTag>> charactersListBox = new JList<>();
|
||||
|
||||
|
||||
private final JTextField searchTextField = new JTextField(10);
|
||||
|
||||
|
||||
private DefaultListModel<ComboBoxItem<CharacterTag>> fullModel = new DefaultListModel<>();
|
||||
|
||||
private int result = ERROR_OPTION;
|
||||
@@ -69,16 +68,16 @@ public class ReplaceCharacterDialog extends AppDialog {
|
||||
setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);
|
||||
Container cnt = getContentPane();
|
||||
cnt.setLayout(new BorderLayout());
|
||||
|
||||
JPanel topPanel = new JPanel(new BorderLayout());
|
||||
|
||||
JPanel topPanel = new JPanel(new BorderLayout());
|
||||
topPanel.add(new JLabel(translate("replace.with")), BorderLayout.WEST);
|
||||
|
||||
|
||||
JPanel searchPanel = new JPanel(new FlowLayout());
|
||||
JLabel iconSearchLabel = new JLabel(View.getIcon("search16"));
|
||||
searchPanel.add(iconSearchLabel);
|
||||
searchPanel.add(searchTextField);
|
||||
topPanel.add(searchPanel, BorderLayout.EAST);
|
||||
|
||||
|
||||
cnt.add(topPanel, BorderLayout.NORTH);
|
||||
|
||||
charactersListBox.setModel(new DefaultListModel<>());
|
||||
@@ -97,12 +96,12 @@ public class ReplaceCharacterDialog extends AppDialog {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
okButton.setEnabled(false);
|
||||
|
||||
JScrollPane sc = new JScrollPane(charactersListBox);
|
||||
sc.setPreferredSize(new Dimension(400,300));
|
||||
|
||||
sc.setPreferredSize(new Dimension(400, 300));
|
||||
|
||||
cnt.add(sc, BorderLayout.CENTER);
|
||||
|
||||
charactersListBox.setCellRenderer(new CharacterTagListCellRenderer());
|
||||
@@ -115,7 +114,6 @@ public class ReplaceCharacterDialog extends AppDialog {
|
||||
|
||||
cnt.add(panButtons, BorderLayout.SOUTH);
|
||||
|
||||
|
||||
searchTextField.getDocument().addDocumentListener(new DocumentListener() {
|
||||
@Override
|
||||
public void insertUpdate(DocumentEvent e) {
|
||||
@@ -131,9 +129,9 @@ public class ReplaceCharacterDialog extends AppDialog {
|
||||
public void changedUpdate(DocumentEvent e) {
|
||||
update();
|
||||
}
|
||||
|
||||
|
||||
private void update() {
|
||||
String searchedText = searchTextField.getText();
|
||||
String searchedText = searchTextField.getText();
|
||||
ComboBoxItem<CharacterTag> selectedValue = charactersListBox.getSelectedValue();
|
||||
DefaultListModel<ComboBoxItem<CharacterTag>> filteredModel = new DefaultListModel<>();
|
||||
int newSelectedIndex = -1;
|
||||
@@ -147,16 +145,16 @@ public class ReplaceCharacterDialog extends AppDialog {
|
||||
}
|
||||
}
|
||||
}
|
||||
charactersListBox.setModel(filteredModel);
|
||||
charactersListBox.setModel(filteredModel);
|
||||
if (newSelectedIndex != -1) {
|
||||
charactersListBox.setSelectedIndex(newSelectedIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
setModalityType(ModalityType.APPLICATION_MODAL);
|
||||
View.setWindowIcon(this);
|
||||
setTitle(translate("dialog.title"));
|
||||
setTitle(translate("dialog.title"));
|
||||
pack();
|
||||
View.centerScreen(this);
|
||||
}
|
||||
@@ -184,8 +182,8 @@ public class ReplaceCharacterDialog extends AppDialog {
|
||||
}
|
||||
|
||||
public int showDialog(SWF swf, int selectedCharacterId) {
|
||||
Map<Integer, CharacterTag> characters = swf.getCharacters(false);
|
||||
fullModel = new DefaultListModel<>();
|
||||
Map<Integer, CharacterTag> characters = swf.getCharacters(false);
|
||||
fullModel = new DefaultListModel<>();
|
||||
fullModel.clear();
|
||||
for (Integer key : characters.keySet()) {
|
||||
CharacterTag character = characters.get(key);
|
||||
@@ -193,7 +191,7 @@ public class ReplaceCharacterDialog extends AppDialog {
|
||||
continue;
|
||||
}
|
||||
int characterId = character.getCharacterId();
|
||||
if (characterId != selectedCharacterId) {
|
||||
if (characterId != selectedCharacterId) {
|
||||
fullModel.addElement(new ComboBoxItem<>(character.getName(), character));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,6 @@ import javax.swing.SwingConstants;
|
||||
/*
|
||||
* Taken from https://github.com/tips4java/tips4java/blob/main/source/ScrollablePanel.java
|
||||
*/
|
||||
|
||||
/**
|
||||
* A panel that implements the Scrollable interface. This class allows you to
|
||||
* customize the scrollable features by using newly provided setter methods so
|
||||
@@ -157,7 +156,7 @@ public class ScrollablePanel extends JPanel implements Scrollable, SwingConstant
|
||||
public IncrementInfo getScrollableBlockIncrement(int orientation) {
|
||||
return orientation == SwingConstants.HORIZONTAL ? horizontalBlock : verticalBlock;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getScrollableBlockIncrement(
|
||||
Rectangle visible, int orientation, int direction) {
|
||||
@@ -219,7 +218,7 @@ public class ScrollablePanel extends JPanel implements Scrollable, SwingConstant
|
||||
public IncrementInfo getScrollableUnitIncrement(int orientation) {
|
||||
return orientation == SwingConstants.HORIZONTAL ? horizontalUnit : verticalUnit;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getScrollableUnitIncrement(
|
||||
Rectangle visible, int orientation, int direction) {
|
||||
@@ -275,7 +274,7 @@ public class ScrollablePanel extends JPanel implements Scrollable, SwingConstant
|
||||
@Override
|
||||
public Dimension getPreferredScrollableViewportSize() {
|
||||
return getPreferredSize();
|
||||
}
|
||||
}
|
||||
|
||||
protected int getScrollableIncrement(IncrementInfo info, int distance) {
|
||||
if (info.getIncrement() == IncrementType.PIXELS) {
|
||||
|
||||
@@ -151,12 +151,13 @@ public class SelectFramePositionDialog extends AppDialog {
|
||||
}
|
||||
|
||||
private static class MyTimelineEnd {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return AppDialog.translateForDialog("timeline.end", SelectFramePositionDialog.class);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static class MySprites {
|
||||
|
||||
@Override
|
||||
@@ -198,20 +199,19 @@ public class SelectFramePositionDialog extends AppDialog {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void populateSprites(MyTreeNode root, Timelined tim) {
|
||||
for (Tag t : tim.getTags()) {
|
||||
for (Tag t : tim.getTags()) {
|
||||
if (t instanceof DefineSpriteTag) {
|
||||
MyTreeNode node = new MyTreeNode();
|
||||
node.setData(t);
|
||||
root.addChild(node);
|
||||
populateSprites(root, (DefineSpriteTag) t);
|
||||
populateSprites(root, (DefineSpriteTag) t);
|
||||
DefineSpriteTag sprite = (DefineSpriteTag) t;
|
||||
populateFrames(node, sprite);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void populateFrames(MyTreeNode parent, Timelined tim) {
|
||||
MyTreeNode frameNode = new MyTreeNode();
|
||||
List<String> labels = new ArrayList<>();
|
||||
@@ -220,7 +220,7 @@ public class SelectFramePositionDialog extends AppDialog {
|
||||
int f = 1;
|
||||
parent.addChild(frameNode);
|
||||
int numtags = 0;
|
||||
for (Tag t : tim.getTags()) {
|
||||
for (Tag t : tim.getTags()) {
|
||||
if (t instanceof FrameLabelTag) {
|
||||
labels.add(((FrameLabelTag) t).name);
|
||||
}
|
||||
@@ -243,13 +243,13 @@ public class SelectFramePositionDialog extends AppDialog {
|
||||
endNode.setData(end);
|
||||
parent.addChild(endNode);
|
||||
}
|
||||
|
||||
|
||||
private void populateNodes(MyTreeNode root, Timelined tim) {
|
||||
MyTreeNode spritesNode = new MyTreeNode();
|
||||
spritesNode.setData(new MySprites());
|
||||
root.addChild(spritesNode);
|
||||
populateSprites(spritesNode, tim);
|
||||
populateFrames(root, tim);
|
||||
populateFrames(root, tim);
|
||||
}
|
||||
|
||||
private void selectPath(List<Object> path) {
|
||||
@@ -330,7 +330,7 @@ public class SelectFramePositionDialog extends AppDialog {
|
||||
}
|
||||
if (subValue instanceof MySprites) {
|
||||
lab.setIcon(View.getIcon("foldersprites16"));
|
||||
}
|
||||
}
|
||||
|
||||
if (subValue instanceof MyFrame) {
|
||||
lab.setIcon(TagTree.getIconForType(TreeNodeType.FRAME));
|
||||
@@ -377,10 +377,9 @@ public class SelectFramePositionDialog extends AppDialog {
|
||||
int row = rows[0];
|
||||
|
||||
Object selection = getLastSelectedPathComponent();
|
||||
if (selection != null
|
||||
if (selection != null
|
||||
&& (((MyTreeNode) selection).getData() instanceof DefineSpriteTag)
|
||||
|| (((MyTreeNode) selection).getData() instanceof MySprites)
|
||||
) { // && !isCollapsed(row)) {
|
||||
|| (((MyTreeNode) selection).getData() instanceof MySprites)) { // && !isCollapsed(row)) {
|
||||
return;
|
||||
}
|
||||
Rectangle rect = this.getRowBounds(row);
|
||||
@@ -391,7 +390,7 @@ public class SelectFramePositionDialog extends AppDialog {
|
||||
int lineStartX = offsetX + rect.x;
|
||||
int backStartX = getWidth() + offsetX;
|
||||
g.fillRect(lineStartX, rect.y, getWidth() - lineStartX, 1);
|
||||
|
||||
|
||||
Graphics2D g2d = (Graphics2D) g;
|
||||
g2d.setPaint(getForeground());
|
||||
GeneralPath path = new GeneralPath();
|
||||
@@ -399,7 +398,7 @@ public class SelectFramePositionDialog extends AppDialog {
|
||||
path.moveTo(lineStartX - 6, rect.y + 6);
|
||||
path.lineTo(lineStartX, rect.y);
|
||||
path.lineTo(lineStartX + 6, rect.y + 6);
|
||||
|
||||
|
||||
path.closePath();
|
||||
g2d.fill(path);
|
||||
}
|
||||
@@ -511,11 +510,11 @@ public class SelectFramePositionDialog extends AppDialog {
|
||||
}
|
||||
|
||||
private void okButtonActionPerformed(ActionEvent evt) {
|
||||
|
||||
|
||||
selectedTimelined = getCurrentSelectedTimelined();
|
||||
|
||||
MyTreeNode node = (MyTreeNode) positionTree.getLastSelectedPathComponent();
|
||||
|
||||
|
||||
MyTreeNode node = (MyTreeNode) positionTree.getLastSelectedPathComponent();
|
||||
|
||||
if (node.getData() instanceof MyFrame) {
|
||||
selectedFrame = ((MyFrame) node.getData()).frame;
|
||||
} else if (node.getData() instanceof MyTimelineEnd) {
|
||||
@@ -524,8 +523,6 @@ public class SelectFramePositionDialog extends AppDialog {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
result = OK_OPTION;
|
||||
previewPanel.clear();
|
||||
setVisible(false);
|
||||
@@ -537,8 +534,7 @@ public class SelectFramePositionDialog extends AppDialog {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets current selected frame. -1 = end of timeline
|
||||
* position
|
||||
* Gets current selected frame. -1 = end of timeline position
|
||||
*
|
||||
*/
|
||||
public int getSelectedFrame() {
|
||||
|
||||
@@ -197,9 +197,9 @@ public class SelectTagPositionDialog extends AppDialog {
|
||||
}
|
||||
|
||||
boolean wasMinFrame = minFrame <= 1;
|
||||
|
||||
|
||||
for (Tag t : tim.getTags()) {
|
||||
|
||||
|
||||
if (wasMinFrame) {
|
||||
MyTreeNode node = new MyTreeNode();
|
||||
node.setData(t);
|
||||
@@ -218,13 +218,13 @@ public class SelectTagPositionDialog extends AppDialog {
|
||||
f++;
|
||||
if (f >= minFrame) {
|
||||
wasMinFrame = true;
|
||||
|
||||
|
||||
frameNode = new MyTreeNode();
|
||||
labels = new ArrayList<>();
|
||||
frameNode.setData(new MyFrame(f, labels));
|
||||
frameNode.setParent(root);
|
||||
root.addChild(frameNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (frameNode.isLeaf()) {
|
||||
@@ -285,7 +285,7 @@ public class SelectTagPositionDialog extends AppDialog {
|
||||
public SelectTagPositionDialog(Window parent, SWF swf, boolean allowInsideSprites) {
|
||||
this(parent, swf, allowInsideSprites, null, 1);
|
||||
}
|
||||
|
||||
|
||||
public SelectTagPositionDialog(Window parent, SWF swf, boolean allowInsideSprites, String newTypeName, int minFrame) {
|
||||
this(parent, swf, null, null, allowInsideSprites, false, newTypeName, minFrame);
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ public class SoundTagPlayer implements MediaDisplay {
|
||||
private boolean paused = false;
|
||||
|
||||
private boolean closed = false;
|
||||
|
||||
|
||||
private boolean resample = false;
|
||||
|
||||
private final Object playLock = new Object();
|
||||
@@ -77,7 +77,7 @@ public class SoundTagPlayer implements MediaDisplay {
|
||||
private long lengthInMicroSec = 0;
|
||||
|
||||
private double microsecPerByte = 0;
|
||||
|
||||
|
||||
private double microsecPerByteResampled = 0;
|
||||
|
||||
private double positionMicrosec = 0;
|
||||
@@ -85,7 +85,7 @@ public class SoundTagPlayer implements MediaDisplay {
|
||||
private Long newPositionMicrosec = null;
|
||||
|
||||
private byte[] wavData = null;
|
||||
|
||||
|
||||
private byte[] wavDataResampled = null;
|
||||
|
||||
private boolean active = false;
|
||||
@@ -169,9 +169,9 @@ public class SoundTagPlayer implements MediaDisplay {
|
||||
}, 100, 100);
|
||||
|
||||
if (!async) {
|
||||
setPausedFlag(true);
|
||||
setPausedFlag(true);
|
||||
}
|
||||
|
||||
|
||||
this.resample = resample;
|
||||
|
||||
thread = new Thread("Sound tag player") {
|
||||
@@ -196,7 +196,7 @@ public class SoundTagPlayer implements MediaDisplay {
|
||||
}
|
||||
};
|
||||
thread.start();
|
||||
}
|
||||
}
|
||||
|
||||
private void openSound(SOUNDINFO soundInfo, SoundTag tag, boolean resample) throws IOException, LineUnavailableException, UnsupportedAudioFileException {
|
||||
SWF swf = (SWF) tag.getOpenable();
|
||||
@@ -206,12 +206,12 @@ public class SoundTagPlayer implements MediaDisplay {
|
||||
List<ByteArrayRange> soundData = tag.getRawSoundData();
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
tag.getSoundFormat().createWav(soundInfo, soundData, baos, tag.getInitialLatency(), false);
|
||||
wavData = baos.toByteArray();
|
||||
wavData = baos.toByteArray();
|
||||
swf.putToCache(soundInfo, tag, false, wavData);
|
||||
baos = new ByteArrayOutputStream();
|
||||
tag.getSoundFormat().createWav(soundInfo, soundData, baos, tag.getInitialLatency(), true);
|
||||
wavDataResampled = baos.toByteArray();
|
||||
swf.putToCache(soundInfo, tag, true, wavDataResampled);
|
||||
wavDataResampled = baos.toByteArray();
|
||||
swf.putToCache(soundInfo, tag, true, wavDataResampled);
|
||||
}
|
||||
|
||||
long soundLength44 = 0;
|
||||
@@ -220,7 +220,7 @@ public class SoundTagPlayer implements MediaDisplay {
|
||||
int sampleLen = (isUnCompressed ? (tag.getSoundSize() ? 2 : 1) : 2) * (tag.getSoundFormat().stereo ? 2 : 1);
|
||||
switch (tag.getSoundRate()) {
|
||||
case 0: //5.5kHz
|
||||
soundLength44 = 8 * tag.getTotalSoundSampleCount();
|
||||
soundLength44 = 8 * tag.getTotalSoundSampleCount();
|
||||
microsecPerByte = 1000000d / (5512.5d * sampleLen);
|
||||
break;
|
||||
case 1: //11kHz
|
||||
@@ -232,12 +232,12 @@ public class SoundTagPlayer implements MediaDisplay {
|
||||
microsecPerByte = 1000000d / (22050d * sampleLen);
|
||||
break;
|
||||
case 3: //44kHz
|
||||
soundLength44 = tag.getTotalSoundSampleCount();
|
||||
soundLength44 = tag.getTotalSoundSampleCount();
|
||||
microsecPerByte = 1000000d / (44100d * sampleLen);
|
||||
break;
|
||||
}
|
||||
|
||||
microsecPerByteResampled = 1000000d / (44100d * sampleLen);
|
||||
|
||||
microsecPerByteResampled = 1000000d / (44100d * sampleLen);
|
||||
lengthInMicroSec = soundLength44 * 1000000 / 44100;
|
||||
|
||||
synchronized (playLock) {
|
||||
@@ -283,7 +283,7 @@ public class SoundTagPlayer implements MediaDisplay {
|
||||
|
||||
private void reloadAudioStream() throws IOException, UnsupportedAudioFileException, LineUnavailableException {
|
||||
audioStream = AudioSystem.getAudioInputStream(new ByteArrayInputStream(resample ? wavDataResampled : wavData));
|
||||
|
||||
|
||||
if (sourceLine != null) {
|
||||
sourceLine.drain();
|
||||
sourceLine.stop();
|
||||
@@ -463,10 +463,10 @@ public class SoundTagPlayer implements MediaDisplay {
|
||||
loopCount = loop ? Integer.MAX_VALUE : 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void setResample(boolean resample) {
|
||||
this.resample = resample;
|
||||
rewind();
|
||||
this.resample = resample;
|
||||
rewind();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -555,5 +555,5 @@ public class SoundTagPlayer implements MediaDisplay {
|
||||
@Override
|
||||
public boolean isMutable() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -360,7 +360,7 @@ public class View {
|
||||
public static void centerScreen(Window f) {
|
||||
centerScreen(f, false);
|
||||
}
|
||||
|
||||
|
||||
public static void centerScreen(Window f, boolean mainWindow) {
|
||||
int topLeftX;
|
||||
int topLeftY;
|
||||
@@ -802,94 +802,103 @@ public class View {
|
||||
public static boolean isOceanic() {
|
||||
return SubstanceLookAndFeel.getCurrentSkin() instanceof OceanicSkin;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This calls JTextComponent.viewToModel2D on Java 9+ or viewToModel on Java 8.
|
||||
* This calls JTextComponent.viewToModel2D on Java 9+ or viewToModel on Java
|
||||
* 8.
|
||||
*
|
||||
* @param editor
|
||||
* @param pt
|
||||
* @return
|
||||
* @return
|
||||
*/
|
||||
public static int textComponentViewToModel(JTextComponent editor, Point2D pt) {
|
||||
try {
|
||||
public static int textComponentViewToModel(JTextComponent editor, Point2D pt) {
|
||||
try {
|
||||
return (int) (Integer) JTextComponent.class.getDeclaredMethod("viewToModel2D", Point2D.class).invoke(editor, pt);
|
||||
} catch (NoSuchMethodException | SecurityException | IllegalAccessException | InvocationTargetException ex) {
|
||||
//method does not exist, we must be on Java8
|
||||
}
|
||||
|
||||
|
||||
//Try older method
|
||||
Point p = new Point((int) Math.round(pt.getX()), (int) Math.round(pt.getY()));
|
||||
try {
|
||||
try {
|
||||
return (int) (Integer) JTextComponent.class.getDeclaredMethod("viewToModel", Point.class).invoke(editor, p);
|
||||
} catch (NoSuchMethodException | SecurityException | IllegalAccessException | InvocationTargetException ex) {
|
||||
Logger.getLogger(View.class.getName()).log(Level.SEVERE, null, ex);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This calls JTextComponent.viewToModel2D on Java 9+ or viewToModel on Java 8.
|
||||
* This calls JTextComponent.viewToModel2D on Java 9+ or viewToModel on Java
|
||||
* 8.
|
||||
*
|
||||
* @param editor
|
||||
* @param pt
|
||||
* @return
|
||||
* @return
|
||||
*/
|
||||
public static int textComponentViewToModel(JTextComponent editor, Point pt) {
|
||||
Point2D p2d = new Point2D.Double(pt.x, pt.y);
|
||||
return textComponentViewToModel(editor, p2d);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This calls JTextComponent.modelToView2D on Java 9+ or modelToView on Java 8.
|
||||
* This calls JTextComponent.modelToView2D on Java 9+ or modelToView on Java
|
||||
* 8.
|
||||
*
|
||||
* @param editor
|
||||
* @param pos
|
||||
* @return
|
||||
* @throws javax.swing.text.BadLocationException
|
||||
* @return
|
||||
* @throws javax.swing.text.BadLocationException
|
||||
*/
|
||||
public static Rectangle2D textComponentModelToView(JTextComponent editor, int pos) throws BadLocationException {
|
||||
try {
|
||||
public static Rectangle2D textComponentModelToView(JTextComponent editor, int pos) throws BadLocationException {
|
||||
try {
|
||||
return (Rectangle2D) JTextComponent.class.getDeclaredMethod("modelToView2D", int.class).invoke(editor, pos);
|
||||
} catch (NoSuchMethodException | SecurityException | IllegalAccessException | InvocationTargetException ex) {
|
||||
//method does not exist, we must be on Java8
|
||||
}
|
||||
|
||||
|
||||
//Try older method
|
||||
try {
|
||||
try {
|
||||
return (Rectangle) JTextComponent.class.getDeclaredMethod("modelToView", int.class).invoke(editor, pos);
|
||||
} catch (NoSuchMethodException | SecurityException | IllegalAccessException | InvocationTargetException ex) {
|
||||
Logger.getLogger(View.class.getName()).log(Level.SEVERE, null, ex);
|
||||
Logger.getLogger(View.class.getName()).log(Level.SEVERE, null, ex);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This calls TextUI.modelToView2D on Java 9+ or modelToView on Java 8.
|
||||
*
|
||||
* @param textUi
|
||||
* @param t
|
||||
* @param pos
|
||||
* @param bias
|
||||
* @return
|
||||
* @throws javax.swing.text.BadLocationException
|
||||
* @return
|
||||
* @throws javax.swing.text.BadLocationException
|
||||
*/
|
||||
public static Rectangle2D textUIModelToView(TextUI textUi, JTextComponent t, int pos, Position.Bias bias) throws BadLocationException {
|
||||
try {
|
||||
try {
|
||||
return (Rectangle2D) TextUI.class.getDeclaredMethod("modelToView2D", JTextComponent.class, int.class, Position.Bias.class).invoke(textUi, t, pos, bias);
|
||||
} catch (NoSuchMethodException | SecurityException | IllegalAccessException | InvocationTargetException ex) {
|
||||
//method does not exist, we must be on Java8
|
||||
}
|
||||
|
||||
|
||||
//Try older method
|
||||
try {
|
||||
return (Rectangle) TextUI.class.getDeclaredMethod("modelToView", JTextComponent.class, int.class, Position.Bias.class).invoke(textUi, t, pos, bias);
|
||||
} catch (NoSuchMethodException | SecurityException | IllegalAccessException | InvocationTargetException ex) {
|
||||
Logger.getLogger(View.class.getName()).log(Level.SEVERE, null, ex);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates locale using Locale.of on Java19, using constructor on older Javas.
|
||||
* Creates locale using Locale.of on Java19, using constructor on older
|
||||
* Javas.
|
||||
*
|
||||
* @param language
|
||||
* @param country
|
||||
* @return
|
||||
* @return
|
||||
*/
|
||||
public static Locale createLocale(String language, String country) {
|
||||
try {
|
||||
@@ -903,11 +912,13 @@ public class View {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates locale using Locale.of on Java19, using constructor on older Javas.
|
||||
* Creates locale using Locale.of on Java19, using constructor on older
|
||||
* Javas.
|
||||
*
|
||||
* @param language
|
||||
* @return
|
||||
* @return
|
||||
*/
|
||||
public static Locale createLocale(String language) {
|
||||
try {
|
||||
|
||||
@@ -56,7 +56,8 @@ public class WrapLayout extends FlowLayout {
|
||||
* Creates a new flow layout manager with the indicated alignment and the
|
||||
* indicated horizontal and vertical gaps.
|
||||
*
|
||||
* <p>The value of the alignment argument must be one of
|
||||
* <p>
|
||||
* The value of the alignment argument must be one of
|
||||
* <code>WrapLayout</code>, <code>WrapLayout</code>, or
|
||||
* <code>WrapLayout</code>.
|
||||
*
|
||||
|
||||
@@ -134,14 +134,14 @@ public class ABCExplorerDialog extends AppDialog {
|
||||
private Runnable packListener;
|
||||
|
||||
private ABCSimpleUsageDetector usageDetector = null;
|
||||
|
||||
private JButton cleanButton = new JButton(View.getIcon("clean16"));
|
||||
|
||||
|
||||
private JButton cleanButton = new JButton(View.getIcon("clean16"));
|
||||
|
||||
private JTable usagesTable = new JTable(new DefaultTableModel()) {
|
||||
@Override
|
||||
public boolean isCellEditable(int row, int column) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
public ABCExplorerDialog(Window owner, MainPanel mainPanel, Openable openable, ABC abc) {
|
||||
@@ -208,24 +208,24 @@ public class ABCExplorerDialog extends AppDialog {
|
||||
|
||||
tagInfoLabel = new JLabel();
|
||||
topLeftPanel.add(tagInfoLabel);
|
||||
|
||||
|
||||
cleanButton.setToolTipText(translate("button.clean"));
|
||||
cleanButton.addActionListener(this::cleanActionPerformed);
|
||||
|
||||
|
||||
JPanel topRightPanel = new JPanel(new FlowLayout());
|
||||
topRightPanel.add(cleanButton);
|
||||
|
||||
|
||||
JPanel topPanel = new JPanel(new BorderLayout());
|
||||
topPanel.add(topLeftPanel, BorderLayout.WEST);
|
||||
topPanel.add(topRightPanel, BorderLayout.EAST);
|
||||
|
||||
mainTabbedPane = new JTabbedPane();
|
||||
cpTabbedPane = new JTabbedPane();
|
||||
|
||||
|
||||
DefaultTableModel model = new DefaultTableModel();
|
||||
model.addColumn(translate("usages").replace("%item%", "-"));
|
||||
usagesTable.setModel(model);
|
||||
|
||||
|
||||
usagesTable.addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
@@ -237,15 +237,15 @@ public class ABCExplorerDialog extends AppDialog {
|
||||
String path = (String) usagesTable.getModel().getValueAt(row, 0);
|
||||
selectPath(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
usagesTable.addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseReleased(MouseEvent e) {
|
||||
if (e.isPopupTrigger()) {
|
||||
int row = usagesTable.rowAtPoint( e.getPoint() );
|
||||
int column = usagesTable.columnAtPoint( e.getPoint() );
|
||||
int row = usagesTable.rowAtPoint(e.getPoint());
|
||||
int column = usagesTable.columnAtPoint(e.getPoint());
|
||||
if (!usagesTable.isRowSelected(row)) {
|
||||
usagesTable.changeSelection(row, column, false, false);
|
||||
}
|
||||
@@ -259,7 +259,7 @@ public class ABCExplorerDialog extends AppDialog {
|
||||
return;
|
||||
}
|
||||
selectPath((String) usagesTable.getModel().getValueAt(row, 0));
|
||||
}
|
||||
}
|
||||
});
|
||||
JMenuItem copyMenuItem = new JMenuItem(translate("copy.paths"), View.getIcon("copy16"));
|
||||
copyMenuItem.addActionListener(new ActionListener() {
|
||||
@@ -268,10 +268,10 @@ public class ABCExplorerDialog extends AppDialog {
|
||||
int[] rows = usagesTable.getSelectedRows();
|
||||
List<String> values = new ArrayList<>();
|
||||
for (int row : rows) {
|
||||
values.add((String)usagesTable.getModel().getValueAt(row, 0));
|
||||
values.add((String) usagesTable.getModel().getValueAt(row, 0));
|
||||
}
|
||||
copyToClipboard(String.join("\r\n", values));
|
||||
}
|
||||
}
|
||||
});
|
||||
JMenuItem copyAllMenuItem = new JMenuItem(translate("copy.paths.all"), View.getIcon("copy16"));
|
||||
copyAllMenuItem.addActionListener(new ActionListener() {
|
||||
@@ -279,27 +279,27 @@ public class ABCExplorerDialog extends AppDialog {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
List<String> values = new ArrayList<>();
|
||||
for (int row = 0; row < usagesTable.getModel().getRowCount(); row++) {
|
||||
values.add((String)usagesTable.getModel().getValueAt(row, 0));
|
||||
values.add((String) usagesTable.getModel().getValueAt(row, 0));
|
||||
}
|
||||
copyToClipboard(String.join("\r\n", values));
|
||||
}
|
||||
}
|
||||
});
|
||||
popupMenu.add(hilightMenuItem);
|
||||
popupMenu.add(copyMenuItem);
|
||||
popupMenu.add(copyAllMenuItem);
|
||||
popupMenu.show(e.getComponent(), e.getX(), e.getY());
|
||||
popupMenu.show(e.getComponent(), e.getX(), e.getY());
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
JPanel centralPanel = new JPanel(new BorderLayout());
|
||||
JPanel rightPanel = new JPanel(new BorderLayout());
|
||||
rightPanel.add(new FasterScrollPane(usagesTable, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED), BorderLayout.CENTER);
|
||||
rightPanel.add(new FasterScrollPane(usagesTable, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED), BorderLayout.CENTER);
|
||||
//rightPanel.add(calculateUsagesButton, BorderLayout.SOUTH);
|
||||
JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, mainTabbedPane, rightPanel);
|
||||
splitPane.setDividerLocation(800);
|
||||
centralPanel.add(splitPane);
|
||||
|
||||
centralPanel.add(splitPane);
|
||||
|
||||
cnt.add(topPanel, BorderLayout.NORTH);
|
||||
cnt.add(centralPanel, BorderLayout.CENTER);
|
||||
|
||||
@@ -310,12 +310,12 @@ public class ABCExplorerDialog extends AppDialog {
|
||||
abcComboBoxActionPerformed(null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
JRootPane rootPane = getRootPane();
|
||||
KeyStroke keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_G, KeyEvent.CTRL_DOWN_MASK);
|
||||
InputMap inputMap = rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
|
||||
ActionMap actionMap = rootPane.getActionMap();
|
||||
|
||||
|
||||
inputMap.put(keyStroke, "ctrlGAction");
|
||||
actionMap.put("ctrlGAction", new AbstractAction() {
|
||||
@Override
|
||||
@@ -327,7 +327,7 @@ public class ABCExplorerDialog extends AppDialog {
|
||||
selectPath(path);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
setSize(1024, 600);
|
||||
setTitle(translate("title") + " - " + openable.getTitleOrShortFileName());
|
||||
List<Image> images = new ArrayList<>();
|
||||
@@ -364,11 +364,11 @@ public class ABCExplorerDialog extends AppDialog {
|
||||
}
|
||||
|
||||
private void abcComboBoxActionPerformed(ActionEvent e) {
|
||||
usageDetector = null;
|
||||
DefaultTableModel model = new DefaultTableModel();
|
||||
usageDetector = null;
|
||||
DefaultTableModel model = new DefaultTableModel();
|
||||
model.addColumn(translate("usages").replace("%item%", "-"));
|
||||
usagesTable.setModel(model);
|
||||
|
||||
|
||||
int index = abcComboBox == null ? 0 : abcComboBox.getSelectedIndex();
|
||||
if (index == -1) {
|
||||
return;
|
||||
@@ -435,14 +435,14 @@ public class ABCExplorerDialog extends AppDialog {
|
||||
mainTabbedPane.addTab("mb (" + abc.bodies.size() + ")", View.getIcon(TreeType.METHOD_BODY.getIcon().getFile()), makeTreePanel(abc, TreeType.METHOD_BODY));
|
||||
|
||||
abc.removeChangeListener(packListener);
|
||||
abc.addChangeListener(packListener);
|
||||
abc.addChangeListener(packListener);
|
||||
refreshUsages();
|
||||
repaint();
|
||||
}
|
||||
|
||||
|
||||
private void refreshUsages() {
|
||||
ABCSimpleUsageDetector newUsageDetector = new ABCSimpleUsageDetector(getSelectedAbc());
|
||||
newUsageDetector.detect();
|
||||
newUsageDetector.detect();
|
||||
usageDetector = newUsageDetector;
|
||||
int zeroUsages = newUsageDetector.getZeroUsagesCount();
|
||||
cleanButton.setText("(" + zeroUsages + ")");
|
||||
@@ -460,7 +460,7 @@ public class ABCExplorerDialog extends AppDialog {
|
||||
JTree tree = (JTree) fasterScrollPane.getViewport().getView();
|
||||
return tree;
|
||||
}
|
||||
|
||||
|
||||
private String getCurrentPath() {
|
||||
JTree tree = getCurrentTree();
|
||||
TreePath tp = tree.getSelectionPath();
|
||||
@@ -487,10 +487,10 @@ public class ABCExplorerDialog extends AppDialog {
|
||||
key = sv.getTitle();
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
pathParts.add(key);
|
||||
}
|
||||
return String.join("/", pathParts);
|
||||
return String.join("/", pathParts);
|
||||
}
|
||||
|
||||
public void selectTrait(int scriptIndex, int classIndex, int traitIndex, int traitType) {
|
||||
@@ -549,11 +549,11 @@ public class ABCExplorerDialog extends AppDialog {
|
||||
if (selectedType == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (mainTabbedPane.getTabCount() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
int stringOffset = 0;
|
||||
if (getSelectedAbc().hasDecimalSupport()) {
|
||||
stringOffset = 1;
|
||||
@@ -573,7 +573,7 @@ public class ABCExplorerDialog extends AppDialog {
|
||||
case CONSTANT_DOUBLE:
|
||||
mainTabbedPane.setSelectedIndex(0);
|
||||
cpTabbedPane.setSelectedIndex(2);
|
||||
break;
|
||||
break;
|
||||
case CONSTANT_DECIMAL:
|
||||
if (!getSelectedAbc().hasDecimalSupport()) {
|
||||
return;
|
||||
@@ -594,21 +594,21 @@ public class ABCExplorerDialog extends AppDialog {
|
||||
}
|
||||
mainTabbedPane.setSelectedIndex(0);
|
||||
cpTabbedPane.setSelectedIndex(4);
|
||||
break;
|
||||
break;
|
||||
case CONSTANT_STRING:
|
||||
mainTabbedPane.setSelectedIndex(0);
|
||||
mainTabbedPane.setSelectedIndex(0);
|
||||
cpTabbedPane.setSelectedIndex(3 + stringOffset);
|
||||
break;
|
||||
case CONSTANT_NAMESPACE:
|
||||
mainTabbedPane.setSelectedIndex(0);
|
||||
mainTabbedPane.setSelectedIndex(0);
|
||||
cpTabbedPane.setSelectedIndex(4 + stringOffset);
|
||||
break;
|
||||
case CONSTANT_NAMESPACE_SET:
|
||||
mainTabbedPane.setSelectedIndex(0);
|
||||
mainTabbedPane.setSelectedIndex(0);
|
||||
cpTabbedPane.setSelectedIndex(5 + stringOffset);
|
||||
break;
|
||||
case CONSTANT_MULTINAME:
|
||||
mainTabbedPane.setSelectedIndex(0);
|
||||
mainTabbedPane.setSelectedIndex(0);
|
||||
cpTabbedPane.setSelectedIndex(6 + stringOffset);
|
||||
break;
|
||||
case METHOD_INFO:
|
||||
@@ -624,16 +624,16 @@ public class ABCExplorerDialog extends AppDialog {
|
||||
mainTabbedPane.setSelectedIndex(4);
|
||||
break;
|
||||
case SCRIPT_INFO:
|
||||
mainTabbedPane.setSelectedIndex(5);
|
||||
mainTabbedPane.setSelectedIndex(5);
|
||||
break;
|
||||
case METHOD_BODY:
|
||||
mainTabbedPane.setSelectedIndex(6);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
selectPath(getCurrentTree(), path);
|
||||
}
|
||||
|
||||
|
||||
private void selectPath(JTree tree, String path) {
|
||||
String[] parts = path.split("/");
|
||||
TreeModel model = tree.getModel();
|
||||
@@ -671,7 +671,7 @@ public class ABCExplorerDialog extends AppDialog {
|
||||
parent = child;
|
||||
continue loopp;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
TreePath treePath = new TreePath(treePathObjectsList.toArray(new Object[treePathObjectsList.size()]));
|
||||
tree.setSelectionPath(treePath);
|
||||
@@ -715,14 +715,14 @@ public class ABCExplorerDialog extends AppDialog {
|
||||
@Override
|
||||
public void valueChanged(TreeSelectionEvent e) {
|
||||
DefaultTableModel model = new DefaultTableModel();
|
||||
|
||||
|
||||
if (tree.getSelectionCount() != 1 || usageDetector == null) {
|
||||
//usagesList.setModel(new DefaultListModel<>());
|
||||
model.addColumn(translate("usages").replace("%item%", "-"));
|
||||
usagesTable.setModel(model);
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Object selection = tree.getLastSelectedPathComponent();
|
||||
|
||||
if (selection instanceof ValueWithIndex) {
|
||||
@@ -734,14 +734,14 @@ public class ABCExplorerDialog extends AppDialog {
|
||||
//usagesList.setModel(model);
|
||||
model.addColumn(translate("usages").replace("%item%", vwi.type.getAbbreviation() + vwi.index + ": " + vwi.getDescription()));
|
||||
for (String usage : newUsages) {
|
||||
model.addRow(new Object[] {usage});
|
||||
model.addRow(new Object[]{usage});
|
||||
}
|
||||
usagesTable.setModel(model);
|
||||
usagesTable.setModel(model);
|
||||
} else {
|
||||
model.addColumn(translate("usages").replace("%item%", "-"));
|
||||
model.addColumn(translate("usages").replace("%item%", "-"));
|
||||
}
|
||||
} else {
|
||||
model.addColumn(translate("usages").replace("%item%", "-"));
|
||||
model.addColumn(translate("usages").replace("%item%", "-"));
|
||||
}
|
||||
usagesTable.setModel(model);
|
||||
}
|
||||
@@ -771,11 +771,9 @@ public class ABCExplorerDialog extends AppDialog {
|
||||
if (tree.getSelectionCount() != 1) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Object selection = tree.getLastSelectedPathComponent();
|
||||
|
||||
|
||||
if (selection instanceof ValueWithIndex) {
|
||||
ValueWithIndex vwi = (ValueWithIndex) selection;
|
||||
if (vwi.getType() == TreeType.SCRIPT_INFO) {
|
||||
@@ -815,12 +813,12 @@ public class ABCExplorerDialog extends AppDialog {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (selection != null) {
|
||||
|
||||
if (selection != null) {
|
||||
JMenuItem copyMenuItem = new JMenuItem(translate("copy.path"), View.getIcon("copy16"));
|
||||
copyMenuItem.addActionListener(this::copyPathActionPerformed);
|
||||
menu.add(copyMenuItem);
|
||||
|
||||
|
||||
JMenuItem copyRowMenuItem = new JMenuItem(translate("copy.row"), View.getIcon("copy16"));
|
||||
copyRowMenuItem.addActionListener(this::copyRowActionPerformed);
|
||||
menu.add(copyRowMenuItem);
|
||||
@@ -877,9 +875,9 @@ public class ABCExplorerDialog extends AppDialog {
|
||||
}
|
||||
|
||||
private void copyPathActionPerformed(ActionEvent e) {
|
||||
copyToClipboard(getCurrentPath());
|
||||
copyToClipboard(getCurrentPath());
|
||||
}
|
||||
|
||||
|
||||
private void copyRowActionPerformed(ActionEvent e) {
|
||||
Object selection = getCurrentTree().getLastSelectedPathComponent();
|
||||
if (selection != null) {
|
||||
@@ -2651,7 +2649,7 @@ public class ABCExplorerDialog extends AppDialog {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void cleanActionPerformed(ActionEvent e) {
|
||||
ABC abc = getSelectedAbc();
|
||||
if (abc != null) {
|
||||
@@ -2661,7 +2659,7 @@ public class ABCExplorerDialog extends AppDialog {
|
||||
int mainIndex = mainTabbedPane.getSelectedIndex();
|
||||
int cpIndex = cpTabbedPane.getSelectedIndex();
|
||||
ABCCleaner cleaner = new ABCCleaner();
|
||||
cleaner.clean(abc);
|
||||
cleaner.clean(abc);
|
||||
if (cpIndex > -1) {
|
||||
cpTabbedPane.setSelectedIndex(cpIndex);
|
||||
}
|
||||
|
||||
@@ -190,7 +190,7 @@ public class ABCPanel extends JPanel implements ItemListener, SearchListener<Scr
|
||||
private final DebugPanel debugPanel;
|
||||
|
||||
private final JLabel experimentalLabel = new JLabel(AppStrings.translate("action.edit.experimental"));
|
||||
|
||||
|
||||
private final JLabel flexLabel = new JLabel(AppStrings.translate("action.edit.flex"));
|
||||
|
||||
private final JLabel infoNotEditableLabel;
|
||||
@@ -248,7 +248,7 @@ public class ABCPanel extends JPanel implements ItemListener, SearchListener<Scr
|
||||
libraryComboBox.setSelectedIndex(SWF.LIBRARY_AIR);
|
||||
} else {
|
||||
libraryComboBox.setSelectedIndex(SWF.LIBRARY_FLASH);
|
||||
}
|
||||
}
|
||||
this.abc = abc;
|
||||
setDecompiledEditMode(false);
|
||||
navigator.setAbc(abc);
|
||||
@@ -293,7 +293,7 @@ public class ABCPanel extends JPanel implements ItemListener, SearchListener<Scr
|
||||
public long traitId;
|
||||
|
||||
private List<VariableNode> childs;
|
||||
|
||||
|
||||
public List<Variable> traits = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
@@ -357,13 +357,13 @@ public class ABCPanel extends JPanel implements ItemListener, SearchListener<Scr
|
||||
|
||||
if ("".equals(var.name)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
InGetVariable igv;
|
||||
|
||||
Long objectId = varToObjectId(var);
|
||||
|
||||
|
||||
boolean useGetter = (var.flags & VariableFlags.IS_CONST) == 0;
|
||||
|
||||
|
||||
if (parentObjectId == 0 && objectId != 0L) {
|
||||
igv = Main.getDebugHandler().getVariable(objectId, "", true, useGetter);
|
||||
} else {
|
||||
@@ -440,11 +440,11 @@ public class ABCPanel extends JPanel implements ItemListener, SearchListener<Scr
|
||||
}
|
||||
if (var.vType == VariableType.OBJECT) {
|
||||
return (Long) var.value;
|
||||
}
|
||||
}
|
||||
if (var.vType == VariableType.MOVIECLIP) {
|
||||
return (Long) var.value;
|
||||
}
|
||||
return 0L;
|
||||
return 0L;
|
||||
}
|
||||
|
||||
public static class VariablesTableModel implements MyTreeTableModel {
|
||||
@@ -963,7 +963,7 @@ public class ABCPanel extends JPanel implements ItemListener, SearchListener<Scr
|
||||
|
||||
iconsPanel.add(deobfuscateButton);
|
||||
iconsPanel.add(deobfuscateOptionsButton);
|
||||
|
||||
|
||||
JButton breakpointListButton = new JButton(View.getIcon("breakpointlist16"));
|
||||
breakpointListButton.setMargin(new Insets(5, 5, 5, 5));
|
||||
breakpointListButton.addActionListener(this::breakPointListButtonActionPerformed);
|
||||
@@ -1108,7 +1108,7 @@ public class ABCPanel extends JPanel implements ItemListener, SearchListener<Scr
|
||||
|
||||
decLabel.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
//decLabel.setBorder(new BevelBorder(BevelBorder.RAISED));
|
||||
|
||||
|
||||
decompiledTextArea.changeContentType("text/actionscript3");
|
||||
decompiledTextArea.setFont(Configuration.getSourceFont());
|
||||
|
||||
@@ -1603,9 +1603,9 @@ public class ABCPanel extends JPanel implements ItemListener, SearchListener<Scr
|
||||
saveDecompiledButton.setVisible(val);
|
||||
saveDecompiledButton.setEnabled(false);
|
||||
editDecompiledButton.setVisible(!val);
|
||||
|
||||
|
||||
boolean useFlex = Configuration.useFlexAs3Compiler.get();
|
||||
|
||||
|
||||
experimentalLabel.setVisible(!useFlex && !val);
|
||||
flexLabel.setVisible(useFlex && !val);
|
||||
cancelDecompiledButton.setVisible(val);
|
||||
@@ -1660,8 +1660,6 @@ public class ABCPanel extends JPanel implements ItemListener, SearchListener<Scr
|
||||
return (TreeItem) scriptsPath.getLastPathComponent();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void saveDecompiled(boolean refreshTree) {
|
||||
final ABC localAbc = abc;
|
||||
int oldIndex = pack.scriptIndex;
|
||||
@@ -1672,8 +1670,7 @@ public class ABCPanel extends JPanel implements ItemListener, SearchListener<Scr
|
||||
TreeItem scriptNode = getScriptNodeForPack(pack);
|
||||
|
||||
String as = decompiledTextArea.getText();
|
||||
|
||||
|
||||
|
||||
localAbc.replaceScriptPack(scriptReplacer, pack, as, Main.getDependencies(pack.abc.getSwf()));
|
||||
scriptReplacer.deinitReplacement(pack);
|
||||
lastDecompiled = as;
|
||||
@@ -1898,7 +1895,7 @@ public class ABCPanel extends JPanel implements ItemListener, SearchListener<Scr
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void breakPointListButtonActionPerformed(ActionEvent evt) {
|
||||
Main.showBreakpointsList();
|
||||
}
|
||||
|
||||
@@ -378,7 +378,7 @@ public class ASMSourceEditorPane extends DebuggableEditorPane implements CaretLi
|
||||
}
|
||||
|
||||
super.setText(highlightedText.text);
|
||||
setCaretPosition(0);
|
||||
setCaretPosition(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -641,10 +641,10 @@ public class ASMSourceEditorPane extends DebuggableEditorPane implements CaretLi
|
||||
Flasm3Lexer lexer = new Flasm3Lexer(new StringReader(curLine));
|
||||
ParsedSymbol symb = lexer.lex();
|
||||
while (symb.type == ParsedSymbol.TYPE_LABEL) {
|
||||
symb = lexer.lex();
|
||||
symb = lexer.lex();
|
||||
}
|
||||
if (symb.type == ParsedSymbol.TYPE_INSTRUCTION_NAME) {
|
||||
String insName = (String) symb.value;
|
||||
String insName = (String) symb.value;
|
||||
int argumentToHilight = -1;
|
||||
int column = 0;
|
||||
try {
|
||||
@@ -653,9 +653,9 @@ public class ASMSourceEditorPane extends DebuggableEditorPane implements CaretLi
|
||||
column = caretPosition - rowStart;
|
||||
} catch (BadLocationException ex) {
|
||||
//ignore
|
||||
}
|
||||
}
|
||||
symb = lexer.lex();
|
||||
if (symb.pos <= column) {
|
||||
if (symb.pos <= column) {
|
||||
argumentToHilight++;
|
||||
int parentLevel = 0;
|
||||
Stack<Integer> parentsStack = new Stack<>();
|
||||
@@ -664,8 +664,7 @@ public class ASMSourceEditorPane extends DebuggableEditorPane implements CaretLi
|
||||
break;
|
||||
}
|
||||
if (symb.type == ParsedSymbol.TYPE_PARENT_OPEN
|
||||
|| symb.type == ParsedSymbol.TYPE_BRACKET_OPEN
|
||||
) {
|
||||
|| symb.type == ParsedSymbol.TYPE_BRACKET_OPEN) {
|
||||
parentsStack.push(symb.type);
|
||||
parentLevel++;
|
||||
}
|
||||
@@ -691,7 +690,7 @@ public class ASMSourceEditorPane extends DebuggableEditorPane implements CaretLi
|
||||
argumentToHilight++;
|
||||
}
|
||||
symb = lexer.lex();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (AVM2Code.instructionAliases.containsKey(insName)) {
|
||||
insName = AVM2Code.instructionAliases.get(insName);
|
||||
@@ -707,7 +706,7 @@ public class ASMSourceEditorPane extends DebuggableEditorPane implements CaretLi
|
||||
}
|
||||
} catch (IOException | AVM2ParseException iex) {
|
||||
//ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
String pathDocs = As3PCodeOtherDocs.getDocsForPath(pathNoTrait, nightMode);
|
||||
if (pathDocs == null) {
|
||||
|
||||
@@ -916,7 +916,7 @@ public class DecompiledEditorPane extends DebuggableEditorPane implements CaretL
|
||||
|
||||
if (decompileNeeded) {
|
||||
//long timeBefore = System.currentTimeMillis();
|
||||
setShowMarkers(false);
|
||||
setShowMarkers(false);
|
||||
View.execInEventDispatch(() -> {
|
||||
setText("// " + AppStrings.translate("work.decompiling") + "...");
|
||||
});
|
||||
@@ -925,7 +925,7 @@ public class DecompiledEditorPane extends DebuggableEditorPane implements CaretL
|
||||
//long timeAfter = System.currentTimeMillis();
|
||||
//long delta = timeAfter - timeBefore;
|
||||
//System.err.println("Finished in " + Helper.formatTimeSec(delta));
|
||||
setShowMarkers(true);
|
||||
setShowMarkers(true);
|
||||
View.execInEventDispatch(() -> {
|
||||
setSourceCompleted(scriptLeaf, htext);
|
||||
});
|
||||
@@ -952,7 +952,7 @@ public class DecompiledEditorPane extends DebuggableEditorPane implements CaretL
|
||||
if (ex instanceof ExecutionException) {
|
||||
cause = ex.getCause();
|
||||
}
|
||||
setShowMarkers(false);
|
||||
setShowMarkers(false);
|
||||
if (cause instanceof CancellationException) {
|
||||
setText("// " + AppStrings.translate("work.canceled"));
|
||||
} else {
|
||||
@@ -970,7 +970,7 @@ public class DecompiledEditorPane extends DebuggableEditorPane implements CaretL
|
||||
Main.startWork(AppStrings.translate("work.decompiling") + "...", worker);
|
||||
}
|
||||
} else {
|
||||
setShowMarkers(true);
|
||||
setShowMarkers(true);
|
||||
setSourceCompleted(scriptLeaf, decompiledText);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -207,7 +207,7 @@ public class DetailPanel extends JPanel implements TagEditorPanel {
|
||||
saveButton.setEnabled(false);
|
||||
editButton.setVisible(!val);
|
||||
cancelButton.setVisible(val);
|
||||
selectedLabel.setIcon(val ? View.getIcon("editing16") : null);
|
||||
selectedLabel.setIcon(val ? View.getIcon("editing16") : null);
|
||||
}
|
||||
|
||||
public void showCard(final String name, final Trait trait, int traitIndex, ABC abc) {
|
||||
|
||||
@@ -52,7 +52,7 @@ import javax.swing.border.BevelBorder;
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class LinkDialog extends JDialog {
|
||||
public class LinkDialog extends JDialog {
|
||||
|
||||
private MainPanel mainPanel;
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ public class SelectTagOfTypeDialog extends AppDialog {
|
||||
if (t instanceof ShowFrameTag) {
|
||||
frame++;
|
||||
}
|
||||
|
||||
|
||||
if (frame >= minFrame) {
|
||||
if (tagType.isAssignableFrom(t.getClass())) {
|
||||
tagComboBox.addItem(new ComboItem(pos, t, frame));
|
||||
|
||||
@@ -20,9 +20,6 @@ import com.jpexs.decompiler.flash.SWF;
|
||||
import com.jpexs.decompiler.flash.abc.ABC;
|
||||
import com.jpexs.decompiler.flash.abc.ScriptPack;
|
||||
import com.jpexs.decompiler.flash.gui.AppDialog;
|
||||
import static com.jpexs.decompiler.flash.gui.AppDialog.CANCEL_OPTION;
|
||||
import static com.jpexs.decompiler.flash.gui.AppDialog.ERROR_OPTION;
|
||||
import static com.jpexs.decompiler.flash.gui.AppDialog.OK_OPTION;
|
||||
import com.jpexs.decompiler.flash.gui.SelectTagPositionDialog;
|
||||
import com.jpexs.decompiler.flash.gui.View;
|
||||
import com.jpexs.decompiler.flash.tags.ABCContainerTag;
|
||||
@@ -69,11 +66,11 @@ import javax.swing.event.DocumentListener;
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class SetClassToCharacterMappingDialog extends AppDialog {
|
||||
|
||||
public class SetClassToCharacterMappingDialog extends AppDialog {
|
||||
|
||||
private final JButton proceedButton = new JButton(translate("button.proceed"));
|
||||
private final JButton cancelButton = new JButton(translate("button.cancel"));
|
||||
|
||||
|
||||
private final JTextField classNameTextField = new JTextField(30);
|
||||
private final JTextField parentClassNameTextField = new JTextField(30);
|
||||
private String selectedClass = null;
|
||||
@@ -85,58 +82,54 @@ public class SetClassToCharacterMappingDialog extends AppDialog {
|
||||
private int result = ERROR_OPTION;
|
||||
|
||||
private final SWF swf;
|
||||
|
||||
|
||||
private final int characterId;
|
||||
|
||||
|
||||
private int characterFrame = -1;
|
||||
|
||||
|
||||
|
||||
private int abcCount = 0;
|
||||
|
||||
|
||||
private int symbolClassCount = 0;
|
||||
|
||||
|
||||
private ABCContainerTag foundInAbcContainer = null;
|
||||
|
||||
|
||||
private final List<ABCContainerTag> abcContainers = new ArrayList<>();
|
||||
|
||||
|
||||
private int abcFrame = -1;
|
||||
|
||||
|
||||
private boolean createClass = false;
|
||||
|
||||
|
||||
private final JPanel classFoundOrNotOrErrorPanel;
|
||||
|
||||
|
||||
private final JLabel errorLabel = new JLabel();
|
||||
|
||||
private final JRadioButton existingAbcTagRadioButton = new JRadioButton(translate("class.notfound.create.abc.where.existing"));
|
||||
private final JRadioButton existingAbcTagRadioButton = new JRadioButton(translate("class.notfound.create.abc.where.existing"));
|
||||
private final JRadioButton newAbcTagRadioButton = new JRadioButton(translate("class.notfound.create.abc.where.new"));
|
||||
|
||||
|
||||
private final JRadioButton createClassRadioButton = new JRadioButton(translate("class.notfound.create"));
|
||||
private final JRadioButton onlySetClassNameRadioButton = new JRadioButton(translate("class.notfound.onlySetClassName"));
|
||||
|
||||
private final JRadioButton existingSymbolClassTagRadioButton = new JRadioButton(translate("class.notfound.onlySetClassName.symbolClass.where.existing"));
|
||||
private final JRadioButton newSymbolClassTagRadioButton = new JRadioButton(translate("class.notfound.onlySetClassName.symbolClass.where.new"));
|
||||
|
||||
|
||||
private final static String CLASS_NOT_FOUND_CARD = "Class not found panel";
|
||||
private final static String CLASS_FOUND_CARD = "Class found panel";
|
||||
private final static String ERROR_CARD = "Error panel";
|
||||
|
||||
private final static String CREATE_CLASS_CARD = "Create class panel";
|
||||
private final static String DO_NOT_CREATE_CLASS_CARD = "Do not create class panel";
|
||||
|
||||
private final static Map<Class<?>, String> tagTypeToParentClass = new HashMap<>();
|
||||
|
||||
|
||||
private static final String CLASS_NOT_FOUND_CARD = "Class not found panel";
|
||||
private static final String CLASS_FOUND_CARD = "Class found panel";
|
||||
private static final String ERROR_CARD = "Error panel";
|
||||
|
||||
private static final String CREATE_CLASS_CARD = "Create class panel";
|
||||
private static final String DO_NOT_CREATE_CLASS_CARD = "Do not create class panel";
|
||||
|
||||
private static final Map<Class<?>, String> tagTypeToParentClass = new HashMap<>();
|
||||
|
||||
static {
|
||||
tagTypeToParentClass.put(SoundTag.class, "flash.media.Sound");
|
||||
tagTypeToParentClass.put(ImageTag.class, "flash.display.Bitmap");
|
||||
tagTypeToParentClass.put(FontTag.class, "flash.text.Font");
|
||||
tagTypeToParentClass.put(DefineFont4Tag.class, "flash.text.Font");
|
||||
tagTypeToParentClass.put(DefineFont4Tag.class, "flash.text.Font");
|
||||
tagTypeToParentClass.put(DefineBinaryDataTag.class, "flash.utils.ByteArray");
|
||||
tagTypeToParentClass.put(DefineSpriteTag.class, "flash.display.Sprite");
|
||||
tagTypeToParentClass.put(DefineSpriteTag.class, "flash.display.Sprite");
|
||||
}
|
||||
|
||||
|
||||
public static String getParentClassFromCharacter(CharacterTag ch) {
|
||||
for (Class<?> cls : tagTypeToParentClass.keySet()) {
|
||||
if (cls.isAssignableFrom(ch.getClass())) {
|
||||
@@ -145,20 +138,20 @@ public class SetClassToCharacterMappingDialog extends AppDialog {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public SetClassToCharacterMappingDialog(Window owner, SWF swf, int characterId) {
|
||||
super(owner);
|
||||
|
||||
|
||||
this.swf = swf;
|
||||
this.characterId = characterId;
|
||||
|
||||
|
||||
CharacterTag ch = swf.getCharacter(characterId);
|
||||
if (ch == null) {
|
||||
throw new RuntimeException("Character " + characterId + " not found");
|
||||
}
|
||||
|
||||
|
||||
parentClassNameTextField.setText(getParentClassFromCharacter(ch));
|
||||
|
||||
|
||||
int frame = 1;
|
||||
for (Tag t : swf.getTags()) {
|
||||
if (t == ch) {
|
||||
@@ -183,102 +176,96 @@ public class SetClassToCharacterMappingDialog extends AppDialog {
|
||||
frame++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
LinkedHashSet<String> classNames = ch.getClassNames();
|
||||
|
||||
|
||||
LinkedHashSet<String> classNames = ch.getClassNames();
|
||||
|
||||
if (classNames.size() == 1) {
|
||||
classNameTextField.setText(classNames.iterator().next());
|
||||
}
|
||||
|
||||
setDefaultCloseOperation(HIDE_ON_CLOSE);
|
||||
setTitle(translate("dialog.title"));
|
||||
|
||||
|
||||
Container cnt = getContentPane();
|
||||
cnt.setLayout(new BoxLayout(cnt, BoxLayout.Y_AXIS));
|
||||
|
||||
|
||||
|
||||
|
||||
JPanel classFoundPanel = new JPanel();
|
||||
classFoundPanel.setLayout(new BoxLayout(classFoundPanel, BoxLayout.Y_AXIS));
|
||||
|
||||
|
||||
JLabel classFoundLabel = new JLabel(translate("class.found"));
|
||||
classFoundPanel.add(classFoundLabel);
|
||||
JLabel symbolClassApropriateLabel = new JLabel(translate("symbolClassAppropriate"));
|
||||
classFoundPanel.add(symbolClassApropriateLabel);
|
||||
|
||||
|
||||
JPanel classNotFoundPanel = new JPanel();
|
||||
classNotFoundPanel.setLayout(new BoxLayout(classNotFoundPanel, BoxLayout.Y_AXIS));
|
||||
JLabel notFoundLabel = new JLabel(translate("class.notfound"));
|
||||
classNotFoundPanel.add(notFoundLabel);
|
||||
JLabel createAskLabel = new JLabel(translate("class.notfound.createAsk"));
|
||||
classNotFoundPanel.add(createAskLabel);
|
||||
|
||||
|
||||
ButtonGroup doCreateClassButtonGroup = new ButtonGroup();
|
||||
doCreateClassButtonGroup.add(createClassRadioButton);
|
||||
doCreateClassButtonGroup.add(onlySetClassNameRadioButton);
|
||||
|
||||
|
||||
JPanel createNewClassAsk = new JPanel(new FlowLayout());
|
||||
createNewClassAsk.add(createClassRadioButton);
|
||||
createNewClassAsk.add(onlySetClassNameRadioButton);
|
||||
createClassRadioButton.setSelected(true);
|
||||
classNotFoundPanel.add(createNewClassAsk);
|
||||
|
||||
|
||||
|
||||
JPanel createNewClassPanel = new JPanel();
|
||||
createNewClassPanel.setLayout(new BoxLayout(createNewClassPanel, BoxLayout.Y_AXIS));
|
||||
|
||||
|
||||
JLabel parentClassNameLabel = new JLabel(translate("class.notfound.create.parentType"));
|
||||
createNewClassPanel.add(parentClassNameLabel);
|
||||
createNewClassPanel.add(parentClassNameLabel);
|
||||
createNewClassPanel.add(parentClassNameTextField);
|
||||
|
||||
|
||||
JLabel abcWhereLabel = new JLabel(translate("class.notfound.create.abc.where"));
|
||||
createNewClassPanel.add(abcWhereLabel);
|
||||
createNewClassPanel.add(abcWhereLabel);
|
||||
ButtonGroup abcTargetButtonGroup = new ButtonGroup();
|
||||
abcTargetButtonGroup.add(existingAbcTagRadioButton);
|
||||
abcTargetButtonGroup.add(newAbcTagRadioButton);
|
||||
existingAbcTagRadioButton.setSelected(true);
|
||||
|
||||
|
||||
JPanel abcTargetPanel = new JPanel(new FlowLayout());
|
||||
abcTargetPanel.add(existingAbcTagRadioButton);
|
||||
abcTargetPanel.add(newAbcTagRadioButton);
|
||||
|
||||
createNewClassPanel.add(abcTargetPanel);
|
||||
|
||||
|
||||
createNewClassPanel.add(abcTargetPanel);
|
||||
|
||||
JLabel symbolClassApropriate2Label = new JLabel(translate("symbolClassAppropriate"));
|
||||
classFoundPanel.add(symbolClassApropriate2Label);
|
||||
createNewClassPanel.add(symbolClassApropriate2Label);
|
||||
|
||||
|
||||
|
||||
JPanel doNotCreateNewClassPanel = new JPanel();
|
||||
doNotCreateNewClassPanel.setLayout(new BoxLayout(doNotCreateNewClassPanel, BoxLayout.Y_AXIS));
|
||||
|
||||
|
||||
ButtonGroup whereToStoreMappingButtonGroup = new ButtonGroup();
|
||||
whereToStoreMappingButtonGroup.add(existingSymbolClassTagRadioButton);
|
||||
whereToStoreMappingButtonGroup.add(newSymbolClassTagRadioButton);
|
||||
doNotCreateNewClassPanel.add(new JLabel(translate("class.notfound.onlySetClassName.symbolClass.where")));
|
||||
|
||||
|
||||
JPanel whereToStoreMappingPanel = new JPanel(new FlowLayout());
|
||||
whereToStoreMappingPanel.add(existingSymbolClassTagRadioButton);
|
||||
whereToStoreMappingPanel.add(newSymbolClassTagRadioButton);
|
||||
doNotCreateNewClassPanel.add(whereToStoreMappingPanel);
|
||||
existingSymbolClassTagRadioButton.setSelected(true);
|
||||
|
||||
|
||||
setCentralAlignment(doNotCreateNewClassPanel);
|
||||
setCentralAlignment(createNewClassPanel);
|
||||
|
||||
|
||||
JPanel createNewClassAskCards = new JPanel(new CardLayout());
|
||||
createNewClassAskCards.add(createNewClassPanel, CREATE_CLASS_CARD);
|
||||
createNewClassAskCards.add(doNotCreateNewClassPanel, DO_NOT_CREATE_CLASS_CARD);
|
||||
|
||||
|
||||
classNotFoundPanel.add(createNewClassAskCards);
|
||||
|
||||
|
||||
ChangeListener createClassSwitched = new ChangeListener() {
|
||||
@Override
|
||||
public void stateChanged(ChangeEvent e) {
|
||||
CardLayout cl = (CardLayout) createNewClassAskCards.getLayout();
|
||||
if (createClassRadioButton.isSelected()) {
|
||||
if (createClassRadioButton.isSelected()) {
|
||||
cl.show(createNewClassAskCards, CREATE_CLASS_CARD);
|
||||
} else {
|
||||
cl.show(createNewClassAskCards, DO_NOT_CREATE_CLASS_CARD);
|
||||
@@ -286,10 +273,10 @@ public class SetClassToCharacterMappingDialog extends AppDialog {
|
||||
checkEnabled();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
createClassRadioButton.addChangeListener(createClassSwitched);
|
||||
onlySetClassNameRadioButton.addChangeListener(createClassSwitched);
|
||||
|
||||
|
||||
JPanel buttonsPanel = new JPanel(new FlowLayout());
|
||||
proceedButton.addActionListener(this::okButtonActionPerformed);
|
||||
cancelButton.addActionListener(this::cancelButtonActionPerformed);
|
||||
@@ -302,38 +289,35 @@ public class SetClassToCharacterMappingDialog extends AppDialog {
|
||||
|
||||
JPanel errorPanel = new JPanel(new FlowLayout());
|
||||
errorPanel.add(errorLabel);
|
||||
|
||||
|
||||
|
||||
setCentralAlignment(classFoundPanel);
|
||||
setCentralAlignment(classNotFoundPanel);
|
||||
setCentralAlignment(errorPanel);
|
||||
|
||||
|
||||
classFoundOrNotOrErrorPanel = new JPanel(new CardLayout());
|
||||
classFoundOrNotOrErrorPanel.add(classFoundPanel, CLASS_FOUND_CARD);
|
||||
classFoundOrNotOrErrorPanel.add(classNotFoundPanel, CLASS_NOT_FOUND_CARD);
|
||||
classFoundOrNotOrErrorPanel.add(errorPanel, ERROR_CARD);
|
||||
|
||||
|
||||
cnt.add(classFoundOrNotOrErrorPanel);
|
||||
|
||||
|
||||
cnt.add(buttonsPanel);
|
||||
|
||||
setCentralAlignment((JComponent)cnt);
|
||||
|
||||
|
||||
setCentralAlignment((JComponent) cnt);
|
||||
|
||||
if (abcCount == 0) {
|
||||
newAbcTagRadioButton.setSelected(true);
|
||||
//abcTargetPanel.setVisible(false);
|
||||
newAbcTagRadioButton.setEnabled(false);
|
||||
existingAbcTagRadioButton.setEnabled(false);
|
||||
}
|
||||
|
||||
|
||||
if (symbolClassCount == 0) {
|
||||
newSymbolClassTagRadioButton.setSelected(true);
|
||||
newSymbolClassTagRadioButton.setEnabled(false);
|
||||
existingSymbolClassTagRadioButton.setEnabled(false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
existingSymbolClassTagRadioButton.addChangeListener(new ChangeListener() {
|
||||
@Override
|
||||
public void stateChanged(ChangeEvent e) {
|
||||
@@ -346,7 +330,7 @@ public class SetClassToCharacterMappingDialog extends AppDialog {
|
||||
checkEnabled();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
existingAbcTagRadioButton.addChangeListener(new ChangeListener() {
|
||||
@Override
|
||||
public void stateChanged(ChangeEvent e) {
|
||||
@@ -359,7 +343,7 @@ public class SetClassToCharacterMappingDialog extends AppDialog {
|
||||
checkEnabled();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
classNameTextField.getDocument().addDocumentListener(new DocumentListener() {
|
||||
@Override
|
||||
public void insertUpdate(DocumentEvent e) {
|
||||
@@ -383,9 +367,9 @@ public class SetClassToCharacterMappingDialog extends AppDialog {
|
||||
setModal(true);
|
||||
setResizable(false);
|
||||
View.setWindowIcon(this);
|
||||
View.centerScreen(this);
|
||||
View.centerScreen(this);
|
||||
}
|
||||
|
||||
|
||||
private void setCentralAlignment(JComponent container) {
|
||||
Component[] components = container.getComponents();
|
||||
for (Component component : components) {
|
||||
@@ -394,13 +378,13 @@ public class SetClassToCharacterMappingDialog extends AppDialog {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void checkEnabled() {
|
||||
|
||||
private void checkEnabled() {
|
||||
|
||||
boolean ok = true;
|
||||
|
||||
|
||||
String newClassName = classNameTextField.getText();
|
||||
|
||||
|
||||
if (newClassName.isEmpty()) {
|
||||
ok = false;
|
||||
errorLabel.setText("");
|
||||
@@ -426,40 +410,40 @@ public class SetClassToCharacterMappingDialog extends AppDialog {
|
||||
}
|
||||
}
|
||||
|
||||
CardLayout cl = (CardLayout) classFoundOrNotOrErrorPanel.getLayout();
|
||||
|
||||
CardLayout cl = (CardLayout) classFoundOrNotOrErrorPanel.getLayout();
|
||||
|
||||
if (ok) {
|
||||
List<String> classNames = new ArrayList<>();
|
||||
classNames.add(newClassName);
|
||||
foundInAbcContainer = null;
|
||||
try {
|
||||
List<ScriptPack> scriptPacks = swf.getScriptPacksByClassNames(classNames);
|
||||
if (!scriptPacks.isEmpty()) {
|
||||
if (!scriptPacks.isEmpty()) {
|
||||
ABC foundInAbc = scriptPacks.get(0).abc; //Assume there is only single pack with the class
|
||||
|
||||
|
||||
boolean foundContainer = false;
|
||||
for (ABCContainerTag cnt : abcContainers) {
|
||||
if (cnt.getABC() == foundInAbc) {
|
||||
foundInAbcContainer = cnt;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
//ignore
|
||||
}
|
||||
|
||||
|
||||
if (foundInAbcContainer != null) {
|
||||
cl.show(classFoundOrNotOrErrorPanel, CLASS_FOUND_CARD);
|
||||
cl.show(classFoundOrNotOrErrorPanel, CLASS_FOUND_CARD);
|
||||
} else {
|
||||
cl.show(classFoundOrNotOrErrorPanel, CLASS_NOT_FOUND_CARD);
|
||||
|
||||
|
||||
if (createClassRadioButton.isSelected()) {
|
||||
if (existingAbcTagRadioButton.isSelected() && abcCount == 1) {
|
||||
proceedButton.setText(translate("button.ok"));
|
||||
} else {
|
||||
proceedButton.setText(translate("button.proceed"));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (existingSymbolClassTagRadioButton.isSelected() && symbolClassCount == 1) {
|
||||
proceedButton.setText(translate("button.ok"));
|
||||
@@ -469,10 +453,10 @@ public class SetClassToCharacterMappingDialog extends AppDialog {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
cl.show(classFoundOrNotOrErrorPanel,ERROR_CARD);
|
||||
cl.show(classFoundOrNotOrErrorPanel, ERROR_CARD);
|
||||
proceedButton.setText(translate("button.ok"));
|
||||
}
|
||||
|
||||
|
||||
proceedButton.setEnabled(ok);
|
||||
}
|
||||
|
||||
@@ -499,7 +483,7 @@ public class SetClassToCharacterMappingDialog extends AppDialog {
|
||||
}
|
||||
selectedPosition = selectTagPositionDialog.getSelectedTag();
|
||||
selectedTimelined = selectTagPositionDialog.getSelectedTimelined();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (existingSymbolClassTagRadioButton.isSelected()) {
|
||||
SelectTagOfTypeDialog selectSymbolClassDialog = new SelectTagOfTypeDialog(owner, swf, SymbolClassTag.class, "SymbolClass", characterFrame);
|
||||
@@ -517,13 +501,12 @@ public class SetClassToCharacterMappingDialog extends AppDialog {
|
||||
}
|
||||
selectedPosition = selectTagPositionDialog.getSelectedTag();
|
||||
selectedTimelined = selectTagPositionDialog.getSelectedTimelined();
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
selectedAbcContainer = foundInAbcContainer;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (selectedAbcContainer != null) {
|
||||
int frame = 1;
|
||||
for (Tag t : swf.getTags()) {
|
||||
@@ -536,7 +519,7 @@ public class SetClassToCharacterMappingDialog extends AppDialog {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
createClass = foundInAbcContainer == null && createClassRadioButton.isSelected();
|
||||
|
||||
result = OK_OPTION;
|
||||
@@ -569,7 +552,7 @@ public class SetClassToCharacterMappingDialog extends AppDialog {
|
||||
selectedSymbolClassTag = null;
|
||||
foundInAbcContainer = null;
|
||||
createClass = false;
|
||||
abcFrame = -1;
|
||||
abcFrame = -1;
|
||||
setVisible(true);
|
||||
return result;
|
||||
}
|
||||
@@ -589,7 +572,7 @@ public class SetClassToCharacterMappingDialog extends AppDialog {
|
||||
public SymbolClassTag getSelectedSymbolClassTag() {
|
||||
return selectedSymbolClassTag;
|
||||
}
|
||||
|
||||
|
||||
public Timelined getSelectedTimelined() {
|
||||
return selectedTimelined;
|
||||
}
|
||||
@@ -600,16 +583,16 @@ public class SetClassToCharacterMappingDialog extends AppDialog {
|
||||
|
||||
public boolean isClassFound() {
|
||||
return foundInAbcContainer != null;
|
||||
}
|
||||
}
|
||||
|
||||
public int getCharacterFrame() {
|
||||
return characterFrame;
|
||||
}
|
||||
}
|
||||
|
||||
public int getAbcFrame() {
|
||||
return abcFrame;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public boolean doCreateClass() {
|
||||
return createClass;
|
||||
}
|
||||
|
||||
@@ -521,7 +521,7 @@ public class ActionPanel extends JPanel implements SearchListener<ScriptSearchRe
|
||||
} else {
|
||||
decompiledText = SWF.getFromCache(asm);
|
||||
}
|
||||
|
||||
|
||||
HighlightedText fdecompiledText = decompiledText;
|
||||
|
||||
setDecompiledEditMode(false);
|
||||
@@ -550,13 +550,13 @@ public class ActionPanel extends JPanel implements SearchListener<ScriptSearchRe
|
||||
|
||||
DisassemblyListener listener = getDisassemblyListener();
|
||||
asm.addDisassemblyListener(listener);
|
||||
innerActions = asm.getActions();
|
||||
innerActions = asm.getActions();
|
||||
asm.removeDisassemblyListener(listener);
|
||||
}
|
||||
|
||||
if (decompileNeeded) {
|
||||
View.execInEventDispatch(() -> {
|
||||
decompiledEditor.setShowMarkers(false);
|
||||
decompiledEditor.setShowMarkers(false);
|
||||
setDecompiledText("-", "-", "// " + AppStrings.translate("work.decompiling") + "...");
|
||||
});
|
||||
|
||||
@@ -574,7 +574,7 @@ public class ActionPanel extends JPanel implements SearchListener<ScriptSearchRe
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void done() {
|
||||
View.execInEventDispatch(() -> {
|
||||
@@ -614,7 +614,7 @@ public class ActionPanel extends JPanel implements SearchListener<ScriptSearchRe
|
||||
if (decompiledText == null) {
|
||||
decompiledText = HighlightedText.EMPTY;
|
||||
}
|
||||
|
||||
|
||||
editor.setShowMarkers(true);
|
||||
decompiledEditor.setShowMarkers(Configuration.decompile.get());
|
||||
lastASM = asm;
|
||||
@@ -786,18 +786,16 @@ public class ActionPanel extends JPanel implements SearchListener<ScriptSearchRe
|
||||
}
|
||||
|
||||
JPanel panCode = new JPanel(new BorderLayout());
|
||||
|
||||
|
||||
//sourceTextArea.addDocsListener(docsPanel);
|
||||
|
||||
if (Configuration.displayAs12PCodeDocsPanel.get()) {
|
||||
final DocsPanel docsPanel = new DocsPanel();
|
||||
final DocsPanel docsPanel = new DocsPanel();
|
||||
ScrollablePanel scrollablePanel = new ScrollablePanel(new BorderLayout());
|
||||
scrollablePanel.setScrollableWidth(ScrollablePanel.ScrollableSizeHint.FIT);
|
||||
scrollablePanel.setScrollableHeight(ScrollablePanel.ScrollableSizeHint.STRETCH);
|
||||
scrollablePanel.add(docsPanel, BorderLayout.CENTER);
|
||||
panCode.add(new JPersistentSplitPane(JSplitPane.VERTICAL_SPLIT, new FasterScrollPane(editor), new FasterScrollPane(scrollablePanel), Configuration.guiActionDocsSplitPaneDividerLocationPercent), BorderLayout.CENTER);
|
||||
|
||||
|
||||
|
||||
editor.addCaretListener(new CaretListener() {
|
||||
@Override
|
||||
public void caretUpdate(CaretEvent e) {
|
||||
@@ -807,14 +805,14 @@ public class ActionPanel extends JPanel implements SearchListener<ScriptSearchRe
|
||||
try {
|
||||
ASMParsedSymbol symb = lexer.lex();
|
||||
while (symb.type == ASMParsedSymbol.TYPE_LABEL) {
|
||||
symb = lexer.lex();
|
||||
symb = lexer.lex();
|
||||
}
|
||||
if (symb.type == ASMParsedSymbol.TYPE_INSTRUCTION_NAME) {
|
||||
String actionName = (String) symb.value;
|
||||
Color c = UIManager.getColor("EditorPane.background");
|
||||
int light = (c.getRed() + c.getGreen() + c.getBlue()) / 3;
|
||||
boolean nightMode = light <= 128;
|
||||
|
||||
|
||||
int argumentToHilight = -1;
|
||||
int column = 0;
|
||||
try {
|
||||
@@ -822,9 +820,9 @@ public class ActionPanel extends JPanel implements SearchListener<ScriptSearchRe
|
||||
column = e.getDot() - rowStart;
|
||||
} catch (BadLocationException ex) {
|
||||
//ignore
|
||||
}
|
||||
}
|
||||
symb = lexer.lex();
|
||||
if (symb.pos <= column) {
|
||||
if (symb.pos <= column) {
|
||||
argumentToHilight++;
|
||||
while (symb.type != ASMParsedSymbol.TYPE_EOL && symb.type != ASMParsedSymbol.TYPE_EOF) {
|
||||
if (symb.pos >= column) {
|
||||
@@ -834,17 +832,15 @@ public class ActionPanel extends JPanel implements SearchListener<ScriptSearchRe
|
||||
argumentToHilight++;
|
||||
}
|
||||
symb = lexer.lex();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
String docs = As12PCodeDocs.getDocsForIns(actionName, true, true, nightMode, argumentToHilight);
|
||||
Point loc = editor.getLineLocation(editor.getLine() + 1);
|
||||
if (loc != null) {
|
||||
SwingUtilities.convertPointToScreen(loc, editor);
|
||||
}
|
||||
|
||||
|
||||
docsPanel.docs("action." + actionName, docs, loc);
|
||||
} else {
|
||||
docsPanel.noDocs();
|
||||
@@ -853,7 +849,7 @@ public class ActionPanel extends JPanel implements SearchListener<ScriptSearchRe
|
||||
//ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
panCode.add(new FasterScrollPane(editor), BorderLayout.CENTER);
|
||||
@@ -954,7 +950,7 @@ public class ActionPanel extends JPanel implements SearchListener<ScriptSearchRe
|
||||
|
||||
iconsPanel.add(deobfuscateButton);
|
||||
iconsPanel.add(deobfuscateOptionsButton);
|
||||
|
||||
|
||||
JButton breakpointListButton = new JButton(View.getIcon("breakpointlist16"));
|
||||
breakpointListButton.setMargin(new Insets(5, 5, 5, 5));
|
||||
breakpointListButton.addActionListener(this::breakPointListButtonActionPerformed);
|
||||
@@ -984,9 +980,9 @@ public class ActionPanel extends JPanel implements SearchListener<ScriptSearchRe
|
||||
debugPanel.setVisible(false);
|
||||
|
||||
decLabel.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
|
||||
|
||||
setLayout(new BorderLayout());
|
||||
|
||||
|
||||
if (Configuration.displayAs12PCodePanel.get()) {
|
||||
add(splitPane = new JPersistentSplitPane(JSplitPane.HORIZONTAL_SPLIT, panA, panB, Configuration.guiActionSplitPaneDividerLocationPercent), BorderLayout.CENTER);
|
||||
} else {
|
||||
@@ -1099,7 +1095,7 @@ public class ActionPanel extends JPanel implements SearchListener<ScriptSearchRe
|
||||
Configuration.deobfuscateAs12RemoveInvalidNamesAssignments.set(menuItem.isSelected());
|
||||
mainPanel.autoDeobfuscateChanged();
|
||||
}
|
||||
|
||||
|
||||
private void breakPointListButtonActionPerformed(ActionEvent evt) {
|
||||
Main.showBreakpointsList();
|
||||
}
|
||||
|
||||
@@ -46,5 +46,5 @@ public class DebugAdapter implements DebugListener {
|
||||
public byte[] onRequestBytes(String clientId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -27,10 +27,10 @@ public interface DebugListener {
|
||||
public void onLoaderURL(String clientId, String url);
|
||||
|
||||
public void onLoaderBytes(String clientId, byte[] data);
|
||||
|
||||
|
||||
public void onDumpByteArray(String clientId, byte[] data);
|
||||
|
||||
public void onFinish(String clientId);
|
||||
|
||||
|
||||
public byte[] onRequestBytes(String clientId);
|
||||
}
|
||||
|
||||
@@ -46,22 +46,19 @@ public class Debugger {
|
||||
public static final int MSG_LOADER_BYTES = 2;
|
||||
|
||||
public static final int MSG_DUMP_BYTEARRAY = 3;
|
||||
|
||||
|
||||
public static final int MSG_REQUEST_BYTEARRAY = 4;
|
||||
|
||||
|
||||
|
||||
private static final Set<DebugListener> listeners = new HashSet<>();
|
||||
|
||||
private static Logger logger = Logger.getLogger(Debugger.class.getName());
|
||||
|
||||
|
||||
private static boolean active = false;
|
||||
|
||||
public static boolean isActive() {
|
||||
return active;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public synchronized void addMessageListener(DebugListener l) {
|
||||
listeners.add(l);
|
||||
}
|
||||
@@ -84,7 +81,6 @@ public class Debugger {
|
||||
|
||||
private final Map<String, String> parameters = new HashMap<>();
|
||||
|
||||
|
||||
public String getParameter(String name, String defValue) {
|
||||
if (parameters.containsKey(name)) {
|
||||
return parameters.get(name);
|
||||
@@ -133,7 +129,7 @@ public class Debugger {
|
||||
os.write(data.length & 0xff);
|
||||
os.write(data);
|
||||
}
|
||||
|
||||
|
||||
private byte[] readBytes(InputStream is) throws IOException {
|
||||
int len = is.read();
|
||||
if (len == -1) {
|
||||
@@ -187,8 +183,7 @@ public class Debugger {
|
||||
@Override
|
||||
public void run() {
|
||||
String clientName = Integer.toString(id);
|
||||
try (InputStream is = s.getInputStream();
|
||||
OutputStream os = s.getOutputStream()) {
|
||||
try (InputStream is = s.getInputStream(); OutputStream os = s.getOutputStream()) {
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
|
||||
int c;
|
||||
@@ -227,25 +222,25 @@ public class Debugger {
|
||||
}
|
||||
while (true) {
|
||||
int type = 0;
|
||||
logger.finer("reading type...");
|
||||
logger.finer("reading type...");
|
||||
if (hasType) {
|
||||
type = readType(is);
|
||||
}
|
||||
logger.log(Level.FINE, "received type {0}", type);
|
||||
switch (type) {
|
||||
case MSG_STRING:
|
||||
logger.finer("reading string...");
|
||||
logger.finer("reading string...");
|
||||
ret = readString(is);
|
||||
logger.finer("informing listeners...");
|
||||
logger.finer("informing listeners...");
|
||||
for (DebugListener l : listeners) {
|
||||
l.onMessage(clientName, ret);
|
||||
}
|
||||
logger.finer("listeners informed");
|
||||
break;
|
||||
case MSG_LOADER_URL:
|
||||
logger.finer("reading string...");
|
||||
logger.finer("reading string...");
|
||||
ret = readString(is);
|
||||
logger.finer("informing listeners...");
|
||||
logger.finer("informing listeners...");
|
||||
for (DebugListener l : listeners) {
|
||||
l.onLoaderURL(clientName, ret);
|
||||
}
|
||||
@@ -254,7 +249,7 @@ public class Debugger {
|
||||
case MSG_LOADER_BYTES:
|
||||
logger.finer("reading bytes...");
|
||||
byte[] retB = readBytes(is);
|
||||
logger.finer("informing listeners...");
|
||||
logger.finer("informing listeners...");
|
||||
for (DebugListener l : listeners) {
|
||||
l.onLoaderBytes(clientName, retB);
|
||||
}
|
||||
@@ -263,14 +258,14 @@ public class Debugger {
|
||||
case MSG_DUMP_BYTEARRAY:
|
||||
logger.finer("reading bytes...");
|
||||
byte[] retBa = readBytes(is);
|
||||
logger.finer("informing listeners...");
|
||||
logger.finer("informing listeners...");
|
||||
for (DebugListener l : listeners) {
|
||||
l.onDumpByteArray(clientName, retBa);
|
||||
}
|
||||
logger.finer("listeners informed");
|
||||
break;
|
||||
case MSG_REQUEST_BYTEARRAY:
|
||||
logger.finer("checking listeners for data...");
|
||||
logger.finer("checking listeners for data...");
|
||||
boolean dataFound = false;
|
||||
for (DebugListener l : listeners) {
|
||||
byte[] data = l.onRequestBytes(clientName);
|
||||
|
||||
@@ -46,8 +46,8 @@ public class DebuggerTools {
|
||||
|
||||
public static final String DEBUGGER_PACKAGE = "com.jpexs.decompiler.flash.debugger";
|
||||
|
||||
private static volatile Debugger debugger;
|
||||
|
||||
private static volatile Debugger debugger;
|
||||
|
||||
private static ScriptPack getDebuggerScriptPack(SWF swf) {
|
||||
List<ABC> allAbcList = new ArrayList<>();
|
||||
for (ABCContainerTag ac : swf.getAbcList()) {
|
||||
@@ -262,9 +262,7 @@ public class DebuggerTools {
|
||||
ft.useNetwork = true;
|
||||
ft.setModified(true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//Add call to DebugConnection.initClient("") to the document class
|
||||
/*String documentClass = swf.getDocumentClass();
|
||||
if (documentClass != null) {
|
||||
@@ -301,8 +299,7 @@ public class DebuggerTools {
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
*/
|
||||
} catch (Exception ex) {
|
||||
logger.log(Level.SEVERE, "Error while attaching debugger", ex);
|
||||
//ignore
|
||||
|
||||
@@ -417,8 +417,6 @@ public class DumpTree extends JTree {
|
||||
View.expandTreeNodes(this, path, true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void saveUncompressedToFileButtonActionPerformed(ActionEvent evt) {
|
||||
saveToFileButtonActionPerformed(true);
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ public class DebuggableEditorPane extends LineMarkedEditorPane implements BreakP
|
||||
private static final Color BG_RULER_COLOR = new Color(0xe9, 0xe8, 0xe2);
|
||||
|
||||
private static Color BG_BREAKPOINT_COLOR = new Color(0xfc, 0x9d, 0x9f);
|
||||
|
||||
|
||||
private static final Color BG_STACK_COLOR = new Color(0xe7, 0xe1, 0xef);
|
||||
|
||||
private static final Color FG_BREAKPOINT_COLOR = null;
|
||||
@@ -50,9 +50,9 @@ public class DebuggableEditorPane extends LineMarkedEditorPane implements BreakP
|
||||
private static final Color BG_IP_COLOR = new Color(0xbd, 0xe6, 0xaa);
|
||||
|
||||
private static final Color FG_IP_COLOR = null;
|
||||
|
||||
|
||||
private static final Color FG_STACK_COLOR = null;
|
||||
|
||||
|
||||
private static final int PRIORITY_STACK = 30;
|
||||
|
||||
private static final int PRIORITY_IP = 0;
|
||||
@@ -68,15 +68,15 @@ public class DebuggableEditorPane extends LineMarkedEditorPane implements BreakP
|
||||
public static final LineMarker IP_MARKER = new LineMarker(FG_IP_COLOR, BG_IP_COLOR, PRIORITY_IP);
|
||||
|
||||
public static final LineMarker INVALID_BREAKPOINT_MARKER = new LineMarker(FG_INVALID_BREAKPOINT_COLOR, BG_INVALID_BREAKPOINT_COLOR, PRIORITY_INVALID_BREAKPOINT);
|
||||
|
||||
|
||||
public static final LineMarker STACK_MARKER = new LineMarker(FG_STACK_COLOR, BG_STACK_COLOR, PRIORITY_STACK);
|
||||
|
||||
protected String scriptName = null;
|
||||
|
||||
|
||||
protected String breakPointScriptName = null;
|
||||
|
||||
private LineNumbersBreakpointsRuler ruler;
|
||||
|
||||
|
||||
private boolean showMarkers = true;
|
||||
|
||||
public DebuggableEditorPane() {
|
||||
@@ -157,7 +157,7 @@ public class DebuggableEditorPane extends LineMarkedEditorPane implements BreakP
|
||||
|
||||
public boolean isShowMarkers() {
|
||||
return showMarkers;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setText(String t) {
|
||||
@@ -171,7 +171,7 @@ public class DebuggableEditorPane extends LineMarkedEditorPane implements BreakP
|
||||
|
||||
public String getBreakPointScriptName() {
|
||||
return breakPointScriptName;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintLineMarker(Graphics g, int line, int x, int lineY, int textY, int lineHeight, boolean currentLine, int maxLines) {
|
||||
@@ -221,7 +221,7 @@ public class DebuggableEditorPane extends LineMarkedEditorPane implements BreakP
|
||||
g.setColor(BG_IP_COLOR);
|
||||
g.fillPolygon(new int[]{mx, mx + 10, mx}, new int[]{textY - 10, textY - 5, textY}, 3);
|
||||
g.setColor(Color.black);
|
||||
g.drawPolygon(new int[]{mx, mx + 10, mx}, new int[]{textY - 10, textY - 5, textY}, 3);
|
||||
g.drawPolygon(new int[]{mx, mx + 10, mx}, new int[]{textY - 10, textY - 5, textY}, 3);
|
||||
}
|
||||
if (currentLine) {
|
||||
g.setColor(UIManager.getColor("List.selectionForeground"));
|
||||
|
||||
@@ -229,8 +229,8 @@ public class LineMarkedEditorPane extends UndoFixedEditorPane implements LinkHan
|
||||
} catch (BadLocationException ex) {
|
||||
//ignore
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -523,7 +523,7 @@ public class LineMarkedEditorPane extends UndoFixedEditorPane implements LinkHan
|
||||
|
||||
Rectangle2D r = com.jpexs.decompiler.flash.gui.View.textUIModelToView(mapper, c, offs0, Position.Bias.Forward);
|
||||
FontMetrics fm = g.getFontMetrics();
|
||||
fgStyle.drawText(seg, (int) r.getX(), (int) r.getY() + fm.getAscent(), g, null, offs0);
|
||||
fgStyle.drawText(seg, (int) r.getX(), (int) r.getY() + fm.getAscent(), g, null, offs0);
|
||||
|
||||
} catch (BadLocationException e) {
|
||||
// can't render
|
||||
|
||||
@@ -163,9 +163,9 @@ public class UndoFixedEditorPane extends JEditorPane {
|
||||
((SyntaxDocument) doc).setIgnoreUpdate(false);
|
||||
}
|
||||
|
||||
doc.putProperty(PlainDocument.tabSizeAttribute, Configuration.tabSize.get());
|
||||
doc.putProperty(PlainDocument.tabSizeAttribute, Configuration.tabSize.get());
|
||||
doc.putProperty("jpexs:useTabs", Configuration.indentUseTabs.get());
|
||||
|
||||
|
||||
setDocument(doc);
|
||||
} catch (BadLocationException | IOException ex) {
|
||||
Logger.getLogger(UndoFixedEditorPane.class.getName()).log(Level.SEVERE, null, ex);
|
||||
|
||||
@@ -195,7 +195,7 @@ public class BinaryDataEditor extends JPanel implements GenericTagEditor {
|
||||
public void added() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Object getObject() {
|
||||
return obj;
|
||||
|
||||
@@ -114,7 +114,7 @@ public class BooleanEditor extends JCheckBox implements GenericTagEditor {
|
||||
public String getReadOnlyValue() {
|
||||
return getChangedValue().toString();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Object getObject() {
|
||||
return obj;
|
||||
|
||||
@@ -280,7 +280,7 @@ public class ColorEditor extends JPanel implements GenericTagEditor, ActionListe
|
||||
int h = System.identityHashCode(this);
|
||||
return "<cite style=\"background-color:rgb(" + color.getRed() + "," + color.getGreen() + "," + color.getBlue() + ");\"> </cite> " + getChangedValue().toString();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Object getObject() {
|
||||
return obj;
|
||||
|
||||
@@ -155,7 +155,7 @@ public class EnumEditor extends JComboBox<ComboBoxItem<Integer>> implements Gene
|
||||
public String getReadOnlyValue() {
|
||||
return getChangedValue().toString();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Object getObject() {
|
||||
return obj;
|
||||
|
||||
@@ -91,7 +91,7 @@ public class FloatEditor extends JTextField implements GenericTagEditor {
|
||||
String newValue = getText();
|
||||
if (Objects.equals(oldValue, newValue)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Object val;
|
||||
if (type.equals(double.class) || type.equals(Double.class)) {
|
||||
val = Double.valueOf(getText());
|
||||
@@ -146,7 +146,7 @@ public class FloatEditor extends JTextField implements GenericTagEditor {
|
||||
@Override
|
||||
public void validateValue() {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Object getObject() {
|
||||
return obj;
|
||||
|
||||
@@ -41,6 +41,6 @@ public interface GenericTagEditor {
|
||||
public String getReadOnlyValue();
|
||||
|
||||
public void validateValue();
|
||||
|
||||
|
||||
public Object getObject();
|
||||
}
|
||||
|
||||
@@ -148,7 +148,7 @@ public class NumberEditor extends JSpinner implements GenericTagEditor {
|
||||
} else {
|
||||
max <<= 30;
|
||||
}
|
||||
m = new SpinnerNumberModel((Number) toLong(value), (long) (-max), (long) max - 1, 1L);
|
||||
m = new SpinnerNumberModel((Number) toLong(value), (long) (-max), (long) max - 1, 1L);
|
||||
break;
|
||||
case SI32:
|
||||
m = new SpinnerNumberModel(toDouble(value), -0x80000000, 0x7fffffff, 1);
|
||||
@@ -242,5 +242,5 @@ public class NumberEditor extends JSpinner implements GenericTagEditor {
|
||||
@Override
|
||||
public Object getObject() {
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@ public class StringEditor extends JTextArea implements GenericTagEditor {
|
||||
@Override
|
||||
public void validateValue() {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Object getObject() {
|
||||
return obj;
|
||||
|
||||
@@ -161,7 +161,7 @@ public class UUIDEditor extends JTextField implements GenericTagEditor {
|
||||
@Override
|
||||
public void validateValue() {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Object getObject() {
|
||||
return obj;
|
||||
|
||||
@@ -61,19 +61,22 @@ public class ObservableList<E> implements List<E> {
|
||||
public <T> T[] toArray(T[] a) {
|
||||
return list.toArray(a);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Move item to desired position.0 A 1 B 2 C 3 D 4 E.
|
||||
*
|
||||
* <p>move(1, 3)
|
||||
*
|
||||
* <p>0 A
|
||||
* <p>
|
||||
* move(1, 3)
|
||||
*
|
||||
* <p>
|
||||
* 0 A
|
||||
* 1 C
|
||||
* 2 B
|
||||
* 3 D
|
||||
* 4 E
|
||||
*
|
||||
* <p>move(3, 1) 0 A 1 D 2 B 3 C 4 E
|
||||
* <p>
|
||||
* move(3, 1) 0 A 1 D 2 B 3 C 4 E
|
||||
*
|
||||
*/
|
||||
public boolean move(int oldIndex, int newIndex) {
|
||||
@@ -103,7 +106,7 @@ public class ObservableList<E> implements List<E> {
|
||||
@Override
|
||||
public boolean containsAll(Collection<?> c) {
|
||||
return list.containsAll(c);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeAll(Collection<?> c) {
|
||||
@@ -156,7 +159,7 @@ public class ObservableList<E> implements List<E> {
|
||||
boolean result = list.add(e);
|
||||
fireCollectionChanged(new CollectionChangedEvent<>(CollectionChangedAction.ADD, e, size() - 1));
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(int index, E element) {
|
||||
|
||||
@@ -313,7 +313,7 @@ public class HexView extends JTable {
|
||||
selectionStart = -1;
|
||||
selectionEnd = -1;
|
||||
getModel().fireTableDataChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private int getIdxByColAndRow(int row, int col) {
|
||||
int idx = -1;
|
||||
|
||||
@@ -52,7 +52,7 @@ public class FirstInstance {
|
||||
private static boolean canCommunicate = false;
|
||||
private static boolean inited = false;
|
||||
|
||||
public synchronized static void ensureInited() {
|
||||
public static synchronized void ensureInited() {
|
||||
if (inited) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -478,6 +478,6 @@ public final class FlashPlayerPanel extends Panel implements Closeable, MediaDis
|
||||
|
||||
@Override
|
||||
public void setResample(boolean resample) {
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ public interface MediaDisplay extends Closeable {
|
||||
public boolean isPlaying();
|
||||
|
||||
public void setLoop(boolean loop);
|
||||
|
||||
|
||||
public void setResample(boolean resample);
|
||||
|
||||
public void gotoFrame(int frame);
|
||||
|
||||
@@ -25,6 +25,6 @@ public interface MediaDisplayListener {
|
||||
public void mediaDisplayStateChanged(MediaDisplay source);
|
||||
|
||||
public void playingFinished(MediaDisplay source);
|
||||
|
||||
|
||||
public void statusChanged(String status);
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ public class PlayerControls extends JPanel implements MediaDisplayListener {
|
||||
private final JButton pauseButton;
|
||||
|
||||
private final JButton loopButton;
|
||||
|
||||
|
||||
private final JToggleButton resampleButton;
|
||||
|
||||
private MediaDisplay display;
|
||||
@@ -94,7 +94,7 @@ public class PlayerControls extends JPanel implements MediaDisplayListener {
|
||||
private static final Icon loopIcon = View.getIcon("loopon16");
|
||||
|
||||
private static final Icon noLoopIcon = View.getIcon("loopoff16");
|
||||
|
||||
|
||||
private static final Icon resampleIcon = View.getIcon("resample16");
|
||||
|
||||
private final JLabel percentLabel = new JLabel("100%");
|
||||
@@ -120,7 +120,7 @@ public class PlayerControls extends JPanel implements MediaDisplayListener {
|
||||
private final JToggleButton freezeButton;
|
||||
|
||||
private final JToggleButton muteButton;
|
||||
|
||||
|
||||
private final JTextField statusTextField;
|
||||
|
||||
public static final int ZOOM_DECADE_STEPS = 10;
|
||||
@@ -150,7 +150,7 @@ public class PlayerControls extends JPanel implements MediaDisplayListener {
|
||||
public PlayerControls(final MainPanel mainPanel, MediaDisplay display, JPanel middleButtonsPanel) {
|
||||
|
||||
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
|
||||
|
||||
|
||||
statusTextField = new JTextField(50);
|
||||
statusTextField.setEditable(false);
|
||||
statusTextField.setBorder(null);
|
||||
@@ -158,7 +158,7 @@ public class PlayerControls extends JPanel implements MediaDisplayListener {
|
||||
//statusTextField.setVisible(true);
|
||||
statusTextField.setOpaque(false);
|
||||
add(statusTextField);
|
||||
|
||||
|
||||
graphicControls = new JPanel(new BorderLayout());
|
||||
JPanel graphicButtonsPanel = new JPanel(new FlowLayout());
|
||||
JButton selectColorButton = new JButton(View.getIcon("color16"));
|
||||
@@ -321,13 +321,13 @@ public class PlayerControls extends JPanel implements MediaDisplayListener {
|
||||
loopButton.addActionListener(this::loopButtonActionPerformed);
|
||||
boolean loop = Configuration.loopMedia.get();
|
||||
loopButton.setIcon(loop ? loopIcon : noLoopIcon);
|
||||
|
||||
|
||||
resampleButton = new JToggleButton(resampleIcon);
|
||||
resampleButton.setToolTipText(AppStrings.translate("preview.resample"));
|
||||
resampleButton.setMargin(new Insets(4, 2, 2, 2));
|
||||
resampleButton.addActionListener(this::resampleButtonActionPerformed);
|
||||
resampleButton.setSelected(Configuration.previewResampleSound.get());
|
||||
|
||||
|
||||
buttonsPanel.add(pauseButton);
|
||||
buttonsPanel.add(stopButton);
|
||||
buttonsPanel.add(loopButton);
|
||||
@@ -352,8 +352,8 @@ public class PlayerControls extends JPanel implements MediaDisplayListener {
|
||||
});
|
||||
playbackControls.add(progress);
|
||||
playbackControls.add(controlPanel);
|
||||
|
||||
add(playbackControls);
|
||||
|
||||
add(playbackControls);
|
||||
this.display.addEventListener(this);
|
||||
}
|
||||
|
||||
@@ -361,7 +361,7 @@ public class PlayerControls extends JPanel implements MediaDisplayListener {
|
||||
statusTextField.setText(status);
|
||||
//statusTextField.setVisible(!status.isEmpty());
|
||||
}
|
||||
|
||||
|
||||
private String formatMs(long ms) {
|
||||
long s = ms / 1000;
|
||||
ms %= 1000;
|
||||
@@ -518,7 +518,7 @@ public class PlayerControls extends JPanel implements MediaDisplayListener {
|
||||
loopButton.setIcon(loop ? loopIcon : noLoopIcon);
|
||||
display.setLoop(loop);
|
||||
}
|
||||
|
||||
|
||||
private void resampleButtonActionPerformed(ActionEvent evt) {
|
||||
boolean resample = resampleButton.isSelected();
|
||||
Configuration.previewResampleSound.set(resample);
|
||||
|
||||
@@ -722,7 +722,7 @@ public class ProxyFrame extends AppFrame implements CatchedListener, MouseListen
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setVisible(boolean b) {
|
||||
if (b == true) {
|
||||
|
||||
@@ -65,7 +65,7 @@ public class TagListTree extends AbstractTagTree {
|
||||
@Override
|
||||
public TagListTreeModel getFullModel() {
|
||||
return (TagListTreeModel) super.getFullModel();
|
||||
}
|
||||
}
|
||||
|
||||
class TreeTransferHandler extends TransferHandler {
|
||||
|
||||
|
||||
@@ -178,11 +178,11 @@ public abstract class AbstractTagTree extends JTree {
|
||||
}
|
||||
|
||||
public static Icon getIconFor(TreeItem val, boolean folderExpanded) {
|
||||
|
||||
|
||||
if (val instanceof SoundStreamHeadTypeTag) {
|
||||
return View.getIcon("foldersounds16");
|
||||
}
|
||||
|
||||
|
||||
TreeNodeType type = getTreeNodeType(val);
|
||||
|
||||
if (type == TreeNodeType.FOLDER && folderExpanded) {
|
||||
@@ -381,8 +381,8 @@ public abstract class AbstractTagTree extends JTree {
|
||||
|| (t instanceof FrameScript)
|
||||
|| (t instanceof SceneFrame)) {
|
||||
return TreeNodeType.FRAME;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (t instanceof Scene) {
|
||||
return TreeNodeType.SCENE;
|
||||
}
|
||||
@@ -610,11 +610,10 @@ public abstract class AbstractTagTree extends JTree {
|
||||
}
|
||||
}
|
||||
|
||||
if (d instanceof Tag
|
||||
|| d instanceof ASMSource
|
||||
if (d instanceof Tag
|
||||
|| d instanceof ASMSource
|
||||
|| d instanceof BinaryDataInterface
|
||||
|| d instanceof SoundStreamFrameRange
|
||||
) {
|
||||
|| d instanceof SoundStreamFrameRange) {
|
||||
TreeNodeType nodeType = TagTree.getTreeNodeType(d);
|
||||
if (nodeType == TreeNodeType.IMAGE) {
|
||||
ret.add(d);
|
||||
|
||||
@@ -350,7 +350,7 @@ public class TagTree extends AbstractTagTree {
|
||||
String expName = tag.getSwf().getExportName(tag.getCharacterId());
|
||||
if (expName != null && !expName.isEmpty()) {
|
||||
String[] pathParts = expName.contains(".") ? expName.split("\\.") : new String[]{expName};
|
||||
return pathParts[pathParts.length - 1];
|
||||
return pathParts[pathParts.length - 1];
|
||||
}
|
||||
}
|
||||
if (value != null) {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -93,7 +93,7 @@ public class TagTreeModel extends AbstractTagTreeModel {
|
||||
public static final String FOLDER_OTHERS = "others";
|
||||
|
||||
public static final String FOLDER_SCRIPTS = "scripts";
|
||||
|
||||
|
||||
public static final String FOLDER_SCENES = "scenes";
|
||||
|
||||
private final List<TreeModelListener> listeners = new ArrayList<>();
|
||||
@@ -266,7 +266,7 @@ public class TagTreeModel extends AbstractTagTreeModel {
|
||||
frames.add(timeline.getFrame(i));
|
||||
}
|
||||
List<TreeItem> scenes = new ArrayList<>();
|
||||
|
||||
|
||||
List<Scene> sceneList = timeline.getScenes();
|
||||
scenes.addAll(sceneList);
|
||||
|
||||
@@ -435,7 +435,7 @@ public class TagTreeModel extends AbstractTagTreeModel {
|
||||
return newPath;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (obj instanceof FolderItem && n instanceof FolderItem) {
|
||||
// FolderItems are always recreated, so compare them by name and swf
|
||||
FolderItem nds = (FolderItem) n;
|
||||
@@ -696,7 +696,7 @@ public class TagTreeModel extends AbstractTagTreeModel {
|
||||
} else if (parentNode instanceof SoundStreamHeadTypeTag) {
|
||||
SoundStreamHeadTypeTag head = (SoundStreamHeadTypeTag) parentNode;
|
||||
return head.getRanges().get(index);
|
||||
}
|
||||
}
|
||||
|
||||
throw new Error("Unsupported parent type: " + parentNode.getClass().getName());
|
||||
}
|
||||
@@ -715,7 +715,7 @@ public class TagTreeModel extends AbstractTagTreeModel {
|
||||
} else if (parentNode instanceof SWF) {
|
||||
return mappedSize + getSwfFolders((SWF) parentNode).size();
|
||||
} else if (parentNode instanceof Scene) {
|
||||
return mappedSize + ((Scene) parentNode).getSceneFrameCount();
|
||||
return mappedSize + ((Scene) parentNode).getSceneFrameCount();
|
||||
} else if (parentNode instanceof HeaderItem) {
|
||||
return mappedSize + 0;
|
||||
} else if (parentNode instanceof FolderItem) {
|
||||
|
||||
@@ -1240,10 +1240,8 @@ public class Translator extends JFrame implements ItemListener {
|
||||
public String toString() {
|
||||
String[] parts = locale.split("_");
|
||||
Locale loc;
|
||||
|
||||
|
||||
|
||||
if (parts.length == 2) {
|
||||
|
||||
if (parts.length == 2) {
|
||||
loc = View.createLocale(parts[0], parts[1]);
|
||||
} else {
|
||||
loc = View.createLocale(parts[0]);
|
||||
|
||||
Reference in New Issue
Block a user