Merge origin/master

This commit is contained in:
Jindra Petřík
2015-12-03 17:08:03 +01:00
35 changed files with 321 additions and 184 deletions

View File

@@ -19,12 +19,7 @@ package com.jpexs.decompiler.flash.gui;
import com.jpexs.debugger.flash.Variable;
import com.jpexs.debugger.flash.messages.in.InBreakAtExt;
import com.jpexs.debugger.flash.messages.in.InFrame;
import com.jpexs.decompiler.flash.gui.AppStrings;
import com.jpexs.decompiler.flash.gui.DebuggerHandler;
import com.jpexs.decompiler.flash.gui.DebuggerHandler.BreakListener;
import com.jpexs.decompiler.flash.gui.HeaderLabel;
import com.jpexs.decompiler.flash.gui.Main;
import com.jpexs.decompiler.flash.gui.View;
import com.jpexs.decompiler.flash.gui.abc.ABCPanel;
import java.awt.BorderLayout;
import java.awt.Color;
@@ -51,15 +46,25 @@ import javax.swing.table.DefaultTableModel;
public class DebugPanel extends JPanel {
private JTable debugRegistersTable;
private JTable debugLocalsTable;
private JTable debugScopeTable;
private JTable callStackTable;
private JTable stackTable;
private JTabbedPane varTabs;
private BreakListener listener;
private JTextArea traceLogTextarea;
private int logLength = 0;
private List<SelectedTab> tabTypes = new ArrayList<>();
private boolean loading = false;
public static enum SelectedTab {
@@ -314,5 +319,4 @@ public class DebugPanel extends JPanel {
public void dispose() {
Main.getDebugHandler().removeBreakListener(listener);
}
}

View File

@@ -21,8 +21,6 @@ import com.jpexs.debugger.flash.DebugMessageListener;
import com.jpexs.debugger.flash.Debugger;
import com.jpexs.debugger.flash.DebuggerCommands;
import com.jpexs.debugger.flash.DebuggerConnection;
import com.jpexs.debugger.flash.SWD;
import com.jpexs.debugger.flash.Variable;
import com.jpexs.debugger.flash.messages.in.InAskBreakpoints;
import com.jpexs.debugger.flash.messages.in.InBreakAt;
import com.jpexs.debugger.flash.messages.in.InBreakAtExt;
@@ -42,15 +40,11 @@ import com.jpexs.debugger.flash.messages.out.OutGetBreakReason;
import com.jpexs.debugger.flash.messages.out.OutGetSwd;
import com.jpexs.debugger.flash.messages.out.OutGetSwf;
import com.jpexs.debugger.flash.messages.out.OutProcessedTag;
import com.jpexs.decompiler.flash.abc.ClassPath;
import com.jpexs.decompiler.flash.abc.ScriptPack;
import com.jpexs.decompiler.flash.configuration.Configuration;
import com.jpexs.decompiler.graph.DottedChain;
import com.jpexs.helpers.CancellableWorker;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -68,18 +62,27 @@ import java.util.regex.Pattern;
public class DebuggerHandler implements DebugConnectionListener {
private boolean connected = false;
private DebuggerCommands commands = null;
private List<InSwfInfo.SwfInfo> swfs = new ArrayList<>();
private boolean paused = true;
private Map<Integer, String> modulePaths = new HashMap<>();
private Map<String, Integer> classToModule = new HashMap<>();
private Map<String, Set<Integer>> toAddBPointMap = new HashMap<>();
private Map<String, Set<Integer>> confirmedPointMap = new HashMap<>();
private Map<String, Set<Integer>> invalidBreakPointMap = new HashMap<>();
private Map<String, Set<Integer>> toRemoveBPointMap = new HashMap<>();
private int breakIp = -1;
private String breakScriptName = null;
public int getBreakIp() {
@@ -221,6 +224,7 @@ public class DebuggerHandler implements DebugConnectionListener {
private InFrame frame;
private InBreakAtExt breakInfo;
private InBreakReason breakReason;
private final List<BreakListener> breakListeners = new ArrayList<>();
@@ -255,13 +259,11 @@ public class DebuggerHandler implements DebugConnectionListener {
public void connected();
public void disconnected();
}
public static interface TraceListener {
public void trace(String... val);
}
public static interface BreakListener {
@@ -269,7 +271,6 @@ public class DebuggerHandler implements DebugConnectionListener {
public void breakAt(String scriptName, int line);
public void doContinue();
}
public void addBreakListener(BreakListener l) {

View File

@@ -16,7 +16,6 @@
*/
package com.jpexs.decompiler.flash.gui;
import com.jpexs.decompiler.flash.SWF;
import com.jpexs.decompiler.flash.configuration.Configuration;
import com.jpexs.decompiler.flash.gui.player.FlashPlayerPanel;
import com.jpexs.helpers.Helper;
@@ -29,9 +28,6 @@ import java.awt.event.ComponentEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.event.WindowStateListener;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JFrame;
/**
@@ -141,5 +137,4 @@ public final class MainFrameClassic extends AppFrame implements MainFrame {
public MainFrameMenu getMenu() {
return mainMenu;
}
}

View File

@@ -373,5 +373,4 @@ public class MainFrameClassicMenu extends MainFrameMenu {
((JComponent) me).setVisible(val);
}
}
}

View File

@@ -16,7 +16,6 @@
*/
package com.jpexs.decompiler.flash.gui;
import com.jpexs.decompiler.flash.SWF;
import com.jpexs.decompiler.flash.configuration.Configuration;
import com.jpexs.decompiler.flash.gui.player.FlashPlayerPanel;
import com.jpexs.decompiler.flash.treeitems.SWFList;
@@ -33,10 +32,7 @@ import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.event.WindowStateListener;
import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JFrame;
import org.pushingpixels.flamingo.api.ribbon.JRibbon;
import org.pushingpixels.flamingo.internal.ui.ribbon.appmenu.JRibbonApplicationMenuButton;
@@ -199,5 +195,4 @@ public final class MainFrameRibbon extends AppRibbonFrame {
public MainFrameMenu getMenu() {
return mainMenu;
}
}

View File

@@ -37,7 +37,6 @@ import org.pushingpixels.flamingo.api.common.CommandToggleButtonGroup;
import org.pushingpixels.flamingo.api.common.JCommandButton;
import org.pushingpixels.flamingo.api.common.JCommandButtonPanel;
import org.pushingpixels.flamingo.api.common.JCommandToggleButton;
import org.pushingpixels.flamingo.api.common.RichTooltip;
import org.pushingpixels.flamingo.api.common.popup.JPopupPanel;
import org.pushingpixels.flamingo.api.common.popup.PopupPanelCallback;
import org.pushingpixels.flamingo.api.ribbon.AbstractRibbonBand;
@@ -291,7 +290,7 @@ public class MainFrameRibbonMenu extends MainFrameMenu {
cbut = new JCommandButton(fixCommandTitle(subTitle));
}
if (subKey != null) {
//cbut.setActionRichTooltip(new RichTooltip(subTitle, subKey.toString()));
//cbut.setActionRichTooltip(new RichTooltip(subTitle, subKey.toString()));
}
if (subLoader != null) {
cbut.setCommandButtonKind(JCommandButton.CommandButtonKind.ACTION_AND_POPUP_MAIN_ACTION);
@@ -639,5 +638,4 @@ public class MainFrameRibbonMenu extends MainFrameMenu {
}
}
}

View File

@@ -32,6 +32,7 @@ public interface MenuBuilder {
public static class HotKey {
private static Map<Integer, String> keyCodesToNames = new HashMap<>();
private static Map<String, Integer> keyNamesToCodes = new HashMap<>();
{
@@ -57,8 +58,11 @@ public interface MenuBuilder {
}
public int key;
public boolean shiftDown;
public boolean ctrlDown;
public boolean altDown;
@Override
@@ -163,7 +167,6 @@ public interface MenuBuilder {
return s;
}
}
public static final int PRIORITY_LOW = 1;

View File

@@ -16,11 +16,7 @@
*/
package com.jpexs.decompiler.flash.gui.abc;
import com.jpexs.decompiler.flash.gui.DebugPanel;
import com.jpexs.debugger.flash.Variable;
import com.jpexs.debugger.flash.messages.in.InBreakAtExt;
import com.jpexs.debugger.flash.messages.in.InBreakReason;
import com.jpexs.debugger.flash.messages.in.InFrame;
import com.jpexs.decompiler.flash.SWF;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.ClassPath;
@@ -45,6 +41,7 @@ import com.jpexs.decompiler.flash.abc.usages.TraitMultinameUsage;
import com.jpexs.decompiler.flash.configuration.Configuration;
import com.jpexs.decompiler.flash.gui.AppDialog;
import com.jpexs.decompiler.flash.gui.AppStrings;
import com.jpexs.decompiler.flash.gui.DebugPanel;
import com.jpexs.decompiler.flash.gui.DebuggerHandler;
import com.jpexs.decompiler.flash.gui.HeaderLabel;
import com.jpexs.decompiler.flash.gui.Main;
@@ -87,7 +84,6 @@ import java.awt.event.MouseMotionListener;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Pattern;
@@ -105,7 +101,6 @@ import javax.swing.JTable;
import javax.swing.JToggleButton;
import javax.swing.SwingConstants;
import javax.swing.border.BevelBorder;
import javax.swing.event.TableModelEvent;
import javax.swing.event.TableModelListener;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableModel;
@@ -272,6 +267,7 @@ public class ABCPanel extends JPanel implements ItemListener, SearchListener<ABC
// DebuggerHandler.VariableChangedListener varChangeListener;
List<TableModelListener> tableListeners = new ArrayList<>();
private List<Variable> vars;
public VariablesTableModel(List<Variable> vars) {
@@ -348,7 +344,6 @@ public class ABCPanel extends JPanel implements ItemListener, SearchListener<ABC
public void removeTableModelListener(TableModelListener l) {
tableListeners.remove(l);
}
}
public ABCPanel(MainPanel mainPanel) {

View File

@@ -30,7 +30,6 @@ import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.WeakHashMap;
import java.util.regex.Pattern;
/**
*
@@ -59,10 +58,13 @@ public class Debugger {
private final int id;
public boolean finished = false;
private final Map<String, String> parameters = new HashMap<>();
public static final int MSG_STRING = 0;
public static final int MSG_LOADER_URL = 1;
public static final int MSG_LOADER_BYTES = 2;
public String getParameter(String name, String defValue) {

View File

@@ -35,25 +35,35 @@ import jsyntaxpane.components.LineNumbersBreakpointsRuler;
public class DebuggableEditorPane extends LineMarkedEditorPane implements BreakPointListener, LineMarkerPainter {
private static final Color BG_CURRENT_COLOR = new Color(0xd6, 0xe8, 0xe2);
private static final Color BG_RULER_COLOR = new Color(0xe9, 0xe8, 0xe2);
private static final Color BG_BREAKPOINT_COLOR = new Color(0xfc, 0x9d, 0x9f);
private static final Color FG_BREAKPOINT_COLOR = null;
private static final int PRIORITY_BREAKPOINT = 20;
private static final Color BG_IP_COLOR = new Color(0xbd, 0xe6, 0xaa);
private static final Color FG_IP_COLOR = null;
private static final int PRIORITY_IP = 0;
private static final Color BG_INVALID_BREAKPOINT_COLOR = new Color(0xdc, 0xdc, 0xd8);
private static final Color FG_INVALID_BREAKPOINT_COLOR = null;
private static final int PRIORITY_INVALID_BREAKPOINT = 10;
public static final LineMarker BREAKPOINT_MARKER = new LineMarker(FG_BREAKPOINT_COLOR, BG_BREAKPOINT_COLOR, PRIORITY_BREAKPOINT);
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);
protected String scriptName = null;
private LineNumbersBreakpointsRuler ruler;
public synchronized void setScriptName(String scriptName) {
@@ -180,5 +190,4 @@ public class DebuggableEditorPane extends LineMarkedEditorPane implements BreakP
super.removeColorMarker(line, lm);
ruler.repaint();
}
}

View File

@@ -65,6 +65,7 @@ public class LineMarkedEditorPane extends UndoFixedEditorPane implements LinkHan
private static final int truncateLimit = 2 * 1024 * 1024;
public static final Color BG_SELECTED_LINE = new Color(0xe9, 0xef, 0xf8);
public static final Color BG_ERROR_LINE = new Color(255, 200, 200);
private int lastLine = -1;
@@ -80,8 +81,11 @@ public class LineMarkedEditorPane extends UndoFixedEditorPane implements LinkHan
public static class LineMarker implements Comparable<LineMarker> {
private Color bgColor;
private Color color;
private FgPainter fgPainter;
//private int line;
private int priority;
@@ -140,6 +144,7 @@ public class LineMarkedEditorPane extends UndoFixedEditorPane implements LinkHan
}
}
//(Map<Integer, TreeSet<LineMarker>>)
private Map<Integer, SortedSet<LineMarker>> lineMarkers = Collections.synchronizedMap(new HashMap<Integer, SortedSet<LineMarker>>());
public void setLineMarkers(Map<Integer, SortedSet<LineMarker>> colorMarkers) {
@@ -415,7 +420,7 @@ public class LineMarkedEditorPane extends UndoFixedEditorPane implements LinkHan
t = t.substring(0, truncateLimit) + "\r\n" + AppStrings.translate("editorTruncateWarning").replace("%chars%", Integer.toString(truncateLimit));
}
super.setText(t);
setCaretPosition(0); //scroll to top
setCaretPosition(0); //scroll to top
}
public static class FgPainter extends DefaultHighlighter.DefaultHighlightPainter {
@@ -613,5 +618,4 @@ public class LineMarkedEditorPane extends UndoFixedEditorPane implements LinkHan
}
}
}
}