#1314 user interface

This commit is contained in:
2016-12-03 13:06:55 +01:00
parent 75066a0faf
commit 820ef1a5f1
8 changed files with 28 additions and 20 deletions
@@ -187,8 +187,8 @@ public class AdvancedSettingsDialog extends AppDialog {
buttonsPanel.add(buttonsLeftPanel, BorderLayout.WEST);
JPanel buttonsRightPanel = new JPanel(new FlowLayout());
buttonsRightPanel.add(cancelButton);
buttonsRightPanel.add(okButton);
buttonsRightPanel.add(cancelButton);
buttonsPanel.add(buttonsRightPanel, BorderLayout.EAST);
cnt.add(buttonsPanel, BorderLayout.SOUTH);
@@ -197,13 +197,11 @@ public class AdvancedSettingsDialog extends AppDialog {
JComboBox<SkinSelect> skinComboBox = new JComboBox<>();
skinComboBox.setRenderer(new SubstanceDefaultListCellRenderer() {
@Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
SubstanceDefaultListCellRenderer cmp = (SubstanceDefaultListCellRenderer) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); //To change body of generated methods, choose Tools | Templates.
final SkinSelect ss = (SkinSelect) value;
cmp.setIcon(new Icon() {
@Override
public void paintIcon(Component c, Graphics g, int x, int y) {
Graphics2D g2 = (Graphics2D) g;
@@ -241,7 +239,6 @@ public class AdvancedSettingsDialog extends AppDialog {
});
return cmp;
}
});
skinComboBox.addItem(new SkinSelect(OceanicSkin.NAME, OceanicSkin.class.getName()));
Map<String, SkinInfo> skins = SubstanceLookAndFeel.getAllSkins();
@@ -1701,16 +1701,19 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
boolean ignoreCase = searchDialog.ignoreCaseCheckBox.isSelected();
boolean regexp = searchDialog.regexpCheckBox.isSelected();
if (searchDialog.searchInASRadioButton.isSelected()) {
boolean scriptSearch = searchDialog.searchInASRadioButton.isSelected()
|| searchDialog.searchInPCodeRadioButton.isSelected();
if (scriptSearch) {
boolean pCodeSearch = searchDialog.searchInPCodeRadioButton.isSelected();
new CancellableWorker<Void>() {
@Override
protected Void doInBackground() throws Exception {
List<ABCPanelSearchResult> abcResult = null;
List<ActionSearchResult> actionResult = null;
if (swf.isAS3()) {
abcResult = getABCPanel().search(swf, txt, ignoreCase, regexp, this);
abcResult = getABCPanel().search(swf, txt, ignoreCase, regexp, pCodeSearch, this);
} else {
actionResult = getActionPanel().search(swf, txt, ignoreCase, regexp, this);
actionResult = getActionPanel().search(swf, txt, ignoreCase, regexp, pCodeSearch, this);
}
List<ABCPanelSearchResult> fAbcResult = abcResult;
@@ -55,6 +55,8 @@ public class SearchDialog extends AppDialog {
public JRadioButton searchInASRadioButton = new JRadioButton(translate("checkbox.searchAS"));
public JRadioButton searchInPCodeRadioButton = new JRadioButton(translate("checkbox.searchPCode"));
public JRadioButton searchInTextsRadioButton = new JRadioButton(translate("checkbox.searchText"));
private int result = ERROR_OPTION;
@@ -99,12 +101,15 @@ public class SearchDialog extends AppDialog {
if (!replace) {
ButtonGroup group = new ButtonGroup();
group.add(searchInASRadioButton);
group.add(searchInPCodeRadioButton);
group.add(searchInTextsRadioButton);
JPanel rbPanel = new JPanel(new FlowLayout());
searchInASRadioButton.setSelected(true);
searchInPCodeRadioButton.setSelected(false);
searchInTextsRadioButton.setSelected(false);
rbPanel.add(searchInASRadioButton);
// todo: honfika rbPanel.add(searchInPCodeRadioButton);
rbPanel.add(searchInTextsRadioButton);
cnt.add(rbPanel);
}
@@ -137,6 +137,7 @@ import jsyntaxpane.TokenType;
public class ABCPanel extends JPanel implements ItemListener, SearchListener<ABCPanelSearchResult>, TagEditorPanel {
private As3ScriptReplacerInterface scriptReplacer = null;
private ScriptPack pack = null;
private final MainPanel mainPanel;
@@ -187,7 +188,8 @@ public class ABCPanel extends JPanel implements ItemListener, SearchListener<ABC
return mainPanel;
}
public List<ABCPanelSearchResult> search(final SWF swf, final String txt, boolean ignoreCase, boolean regexp, CancellableWorker<Void> worker) {
public List<ABCPanelSearchResult> search(final SWF swf, final String txt, boolean ignoreCase, boolean regexp, boolean pcode, CancellableWorker<Void> worker) {
// todo: pcode seach
List<String> ignoredClasses = new ArrayList<>();
List<String> ignoredNss = new ArrayList<>();
@@ -310,6 +312,7 @@ public class ABCPanel extends JPanel implements ItemListener, SearchListener<ABC
public List<VariableNode> path = new ArrayList<>();
public Variable var;
public Variable varInsideGetter;
public Long parentObjectId;
@@ -317,6 +320,7 @@ public class ABCPanel extends JPanel implements ItemListener, SearchListener<ABC
public int level;
public Variable trait;
public long traitId;
private List<VariableNode> childs;
@@ -392,8 +396,8 @@ public class ABCPanel extends JPanel implements ItemListener, SearchListener<ABC
igv = Main.getDebugHandler().getVariable(parentObjectId, var.name, true);
}
//current var is getter function - set it to value really got
//if ((var.flags & VariableFlags.HAS_GETTER) > 0)
//current var is getter function - set it to value really got
//if ((var.flags & VariableFlags.HAS_GETTER) > 0)
{
varInsideGetter = igv.parent;
}
@@ -506,10 +510,15 @@ public class ABCPanel extends JPanel implements ItemListener, SearchListener<ABC
}
private static final int COLUMN_NAME = 0;
private static final int COLUMN_TRAIT = 1;
private static final int COLUMN_SCOPE = 2;
private static final int COLUMN_FLAGS = 3;
private static final int COLUMN_TYPE = 4;
private static final int COLUMN_VALUE = 5;
@Override
@@ -852,7 +861,6 @@ public class ABCPanel extends JPanel implements ItemListener, SearchListener<ABC
decompiledTextArea.addTextChangedListener(this::decompiledTextAreaTextChanged);
decompiledTextArea.setLinkHandler(new LinkHandler() {
@Override
public boolean isLink(Token token) {
return hasDeclaration(token.start);
@@ -921,7 +929,6 @@ public class ABCPanel extends JPanel implements ItemListener, SearchListener<ABC
panB.add(decLabel, BorderLayout.NORTH);
Main.getDebugHandler().addConnectionListener(new DebuggerHandler.ConnectionListener() {
@Override
public void connected() {
decButtonsPan.setVisible(false);
@@ -1293,7 +1300,6 @@ public class ABCPanel extends JPanel implements ItemListener, SearchListener<ABC
public void setDecompiledEditMode(boolean val) {
View.execInEventDispatch(new Runnable() {
@Override
public void run() {
if (val) {
@@ -255,7 +255,7 @@ public class ActionPanel extends JPanel implements SearchListener<ActionSearchRe
return null;
}
public List<ActionSearchResult> search(SWF swf, final String txt, boolean ignoreCase, boolean regexp, CancellableWorker<Void> worker) {
public List<ActionSearchResult> search(SWF swf, final String txt, boolean ignoreCase, boolean regexp, boolean pcode, CancellableWorker<Void> worker) {
if (txt != null && !txt.isEmpty()) {
searchPanel.setOptions(ignoreCase, regexp);
Map<String, ASMSource> asms = swf.getASMs(false);
@@ -469,7 +469,6 @@ public class ActionPanel extends JPanel implements SearchListener<ActionSearchRe
final boolean decompileNeeded = decompile;
CancellableWorker worker = new CancellableWorker() {
@Override
protected Void doInBackground() throws Exception {
@@ -585,7 +584,6 @@ public class ActionPanel extends JPanel implements SearchListener<ActionSearchRe
decompiledEditor = new DebuggableEditorPane();
decompiledEditor.setEditable(false);
decompiledEditor.setLinkHandler(new LinkHandler() {
@Override
public boolean isLink(Token token) {
int pos = token.start;
@@ -740,7 +738,6 @@ public class ActionPanel extends JPanel implements SearchListener<ActionSearchRe
//decPanel.add(searchPanel, BorderLayout.NORTH);
Main.getDebugHandler().addConnectionListener(new DebuggerHandler.ConnectionListener() {
@Override
public void connected() {
decButtonsPan.setVisible(false);
@@ -28,3 +28,4 @@ error.invalidregexp = Invalid pattern
checkbox.searchText = Search in texts
checkbox.searchAS = Search in AS
checkbox.replaceInParameters = Replace in parameters
checkbox.searchPCode = Search in P-Code