mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-25 03:50:44 +00:00
Issue #578 Always on top fixed on search results, using dialog where possible
This commit is contained in:
@@ -18,6 +18,7 @@ package com.jpexs.decompiler.flash.gui;
|
||||
|
||||
import com.jpexs.decompiler.flash.AppStrings;
|
||||
import com.jpexs.decompiler.flash.configuration.Configuration;
|
||||
import java.awt.Window;
|
||||
import java.util.ResourceBundle;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JRootPane;
|
||||
@@ -36,6 +37,15 @@ public abstract class AppDialog extends JDialog {
|
||||
getRootPane().setWindowDecorationStyle(JRootPane.FRAME);
|
||||
}
|
||||
}
|
||||
|
||||
public AppDialog(Window owner) {
|
||||
super(owner);
|
||||
View.installEscapeCloseOperation(this);
|
||||
if (Configuration.useRibbonInterface.get()) {
|
||||
getRootPane().setWindowDecorationStyle(JRootPane.FRAME);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public String translate(String key) {
|
||||
return resourceBundle.getString(key);
|
||||
|
||||
+4
-2
@@ -26,6 +26,7 @@ import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Point;
|
||||
import java.awt.Polygon;
|
||||
import java.awt.Window;
|
||||
import java.awt.geom.AffineTransform;
|
||||
import java.awt.geom.Line2D;
|
||||
import java.util.HashMap;
|
||||
@@ -38,7 +39,7 @@ import javax.swing.JScrollPane;
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class GraphFrame extends AppFrame {
|
||||
public class GraphDialog extends AppDialog {
|
||||
|
||||
private class GraphPanel extends JPanel {
|
||||
|
||||
@@ -246,7 +247,8 @@ public class GraphFrame extends AppFrame {
|
||||
int frameWidthDiff;
|
||||
int frameHeightDiff;
|
||||
|
||||
public GraphFrame(Graph graph, String name) throws InterruptedException {
|
||||
public GraphDialog(Window owner,Graph graph, String name) throws InterruptedException {
|
||||
super(owner);
|
||||
setSize(500, 500);
|
||||
Container cnt = getContentPane();
|
||||
cnt.setLayout(new BorderLayout());
|
||||
@@ -16,6 +16,8 @@
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.gui;
|
||||
|
||||
import java.awt.Window;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
@@ -31,4 +33,6 @@ public interface MainFrame {
|
||||
public boolean isVisible();
|
||||
|
||||
public void setVisible(boolean b);
|
||||
|
||||
public Window getWindow();
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.configuration.Configuration;
|
||||
import com.jpexs.decompiler.flash.gui.player.FlashPlayerPanel;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Window;
|
||||
import java.awt.event.ComponentAdapter;
|
||||
import java.awt.event.ComponentEvent;
|
||||
import java.awt.event.WindowAdapter;
|
||||
@@ -118,4 +119,11 @@ public final class MainFrameClassic extends AppFrame implements MainFrame {
|
||||
public MainPanel getPanel() {
|
||||
return panel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Window getWindow() {
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -23,8 +23,11 @@ import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Container;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Window;
|
||||
import java.awt.event.ComponentAdapter;
|
||||
import java.awt.event.ComponentEvent;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.awt.event.WindowStateListener;
|
||||
@@ -115,6 +118,8 @@ public final class MainFrameRibbon extends AppRibbonFrame implements MainFrame {
|
||||
});
|
||||
|
||||
View.centerScreen(this);
|
||||
|
||||
|
||||
}
|
||||
|
||||
private static void getApplicationMenuButtons(Component comp, List<JRibbonApplicationMenuButton> ret) {
|
||||
@@ -215,4 +220,11 @@ public final class MainFrameRibbon extends AppRibbonFrame implements MainFrame {
|
||||
public MainPanel getPanel() {
|
||||
return panel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Window getWindow() {
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -272,6 +272,12 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
|
||||
}
|
||||
}
|
||||
|
||||
public MainFrame getMainFrame() {
|
||||
return mainFrame;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static {
|
||||
try {
|
||||
File.createTempFile("temp", ".swf").delete(); //First call to this is slow, so make it first
|
||||
@@ -1388,7 +1394,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
|
||||
|
||||
public void searchAs() {
|
||||
if (searchDialog == null) {
|
||||
searchDialog = new SearchDialog();
|
||||
searchDialog = new SearchDialog(getMainFrame().getWindow());
|
||||
}
|
||||
searchDialog.setVisible(true);
|
||||
if (searchDialog.result) {
|
||||
|
||||
@@ -20,6 +20,7 @@ import java.awt.Container;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.Image;
|
||||
import java.awt.Window;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.ArrayList;
|
||||
@@ -52,7 +53,8 @@ public class SearchDialog extends AppDialog implements ActionListener {
|
||||
public JRadioButton searchInTextsRadioButton = new JRadioButton(translate("checkbox.searchText"));
|
||||
public boolean result = false;
|
||||
|
||||
public SearchDialog() {
|
||||
public SearchDialog(Window owner) {
|
||||
super(owner);
|
||||
setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);
|
||||
Container cnt = getContentPane();
|
||||
setSize(400, 150);
|
||||
|
||||
@@ -21,6 +21,7 @@ import java.awt.BorderLayout;
|
||||
import java.awt.Container;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.Window;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.MouseAdapter;
|
||||
@@ -48,7 +49,8 @@ public class SearchResultsDialog<E> extends AppDialog implements ActionListener{
|
||||
private final JButton gotoButton = new JButton(translate("button.goto"));
|
||||
private final JButton closeButton = new JButton(translate("button.close"));
|
||||
|
||||
public SearchResultsDialog(String text,SearchListener<E> listener) {
|
||||
public SearchResultsDialog(Window owner,String text,SearchListener<E> listener) {
|
||||
super(owner);
|
||||
setTitle(translate("dialog.title").replace("%text%", text));
|
||||
Container cnt=getContentPane();
|
||||
model = new DefaultListModel<>();
|
||||
@@ -80,7 +82,6 @@ public class SearchResultsDialog<E> extends AppDialog implements ActionListener{
|
||||
cnt.add(sp,BorderLayout.CENTER);
|
||||
cnt.add(buttonsPanel,BorderLayout.SOUTH);
|
||||
pack();
|
||||
setAlwaysOnTop(true);
|
||||
View.centerScreen(this);
|
||||
View.setWindowIcon(this);
|
||||
}
|
||||
|
||||
@@ -164,6 +164,13 @@ public class ABCPanel extends JPanel implements ItemListener, ActionListener, Se
|
||||
|
||||
static final String ACTION_ADD_TRAIT = "ADDTRAIT";
|
||||
|
||||
public MainPanel getMainPanel() {
|
||||
return mainPanel;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public boolean search(final String txt, boolean ignoreCase, boolean regexp) {
|
||||
if ((txt != null) && (!txt.isEmpty())) {
|
||||
searchPanel.setOptions(ignoreCase, regexp);
|
||||
@@ -216,12 +223,11 @@ public class ABCPanel extends JPanel implements ItemListener, ActionListener, Se
|
||||
|
||||
searchPanel.setSearchText(txt);
|
||||
|
||||
final ABCPanel that=this;
|
||||
View.execInEventDispatch(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
SearchResultsDialog<ABCPanelSearchResult> sr=new SearchResultsDialog<ABCPanelSearchResult>(txt,that);
|
||||
SearchResultsDialog<ABCPanelSearchResult> sr=new SearchResultsDialog<>(ABCPanel.this.mainPanel.getMainFrame().getWindow(),txt,ABCPanel.this);
|
||||
sr.setResults(found);
|
||||
sr.setVisible(true);
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ import com.jpexs.decompiler.flash.abc.types.MethodBody;
|
||||
import com.jpexs.decompiler.flash.abc.types.traits.Trait;
|
||||
import com.jpexs.decompiler.flash.configuration.Configuration;
|
||||
import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode;
|
||||
import com.jpexs.decompiler.flash.gui.GraphFrame;
|
||||
import com.jpexs.decompiler.flash.gui.GraphDialog;
|
||||
import com.jpexs.decompiler.flash.gui.View;
|
||||
import com.jpexs.decompiler.flash.helpers.HilightedText;
|
||||
import com.jpexs.decompiler.flash.helpers.HilightedTextWriter;
|
||||
@@ -63,6 +63,10 @@ public class ASMSourceEditorPane extends LineMarkedEditorPane implements CaretLi
|
||||
private ScriptExportMode exportMode = ScriptExportMode.PCODE;
|
||||
private Trait trait;
|
||||
|
||||
public ABCPanel getAbcPanel(){
|
||||
return decompiledEditor.getAbcPanel();
|
||||
}
|
||||
|
||||
public ScriptExportMode getExportMode() {
|
||||
return exportMode;
|
||||
}
|
||||
@@ -168,7 +172,7 @@ public class ASMSourceEditorPane extends LineMarkedEditorPane implements CaretLi
|
||||
public void graph() {
|
||||
try {
|
||||
AVM2Graph gr = new AVM2Graph(abc.bodies.get(bodyIndex).code, abc, abc.bodies.get(bodyIndex), false, -1, -1, new HashMap<Integer, GraphTargetItem>(), new Stack<GraphTargetItem>(), new HashMap<Integer, String>(), new ArrayList<String>(), new HashMap<Integer, Integer>(), abc.bodies.get(bodyIndex).code.visitCode(abc.bodies.get(bodyIndex)));
|
||||
(new GraphFrame(gr, name)).setVisible(true);
|
||||
(new GraphDialog(getAbcPanel().getMainPanel().getMainFrame().getWindow(),gr, name)).setVisible(true);
|
||||
} catch (InterruptedException ex) {
|
||||
Logger.getLogger(ASMSourceEditorPane.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
|
||||
@@ -67,6 +67,12 @@ public class DecompiledEditorPane extends LineMarkedEditorPane implements CaretL
|
||||
public void addScriptListener(Runnable l){
|
||||
scriptListeners.add(l);
|
||||
}
|
||||
|
||||
public ABCPanel getAbcPanel() {
|
||||
return abcPanel;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void removeScriptListener(Runnable l){
|
||||
scriptListeners.remove(l);
|
||||
|
||||
@@ -23,6 +23,7 @@ import com.jpexs.decompiler.flash.abc.usages.InsideClassMultinameUsage;
|
||||
import com.jpexs.decompiler.flash.abc.usages.MethodMultinameUsage;
|
||||
import com.jpexs.decompiler.flash.abc.usages.MultinameUsage;
|
||||
import com.jpexs.decompiler.flash.abc.usages.TraitMultinameUsage;
|
||||
import com.jpexs.decompiler.flash.gui.AppDialog;
|
||||
import com.jpexs.decompiler.flash.gui.AppFrame;
|
||||
import com.jpexs.decompiler.flash.gui.View;
|
||||
import com.jpexs.decompiler.flash.tags.ABCContainerTag;
|
||||
@@ -44,7 +45,7 @@ import javax.swing.JScrollPane;
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class UsageFrame extends AppFrame implements ActionListener, MouseListener {
|
||||
public class UsageFrame extends AppDialog implements ActionListener, MouseListener {
|
||||
|
||||
static final String ACTION_GOTO = "GOTO";
|
||||
static final String ACTION_CANCEL = "CANCEL";
|
||||
@@ -56,6 +57,7 @@ public class UsageFrame extends AppFrame implements ActionListener, MouseListene
|
||||
private final ABCPanel abcPanel;
|
||||
|
||||
public UsageFrame(List<ABCContainerTag> abcTags, ABC abc, int multinameIndex, ABCPanel abcPanel, boolean definitions) {
|
||||
super(abcPanel.getMainPanel().getMainFrame().getWindow());
|
||||
this.abcPanel = abcPanel;
|
||||
List<MultinameUsage> usages = definitions?abc.findMultinameDefinition(abcTags,multinameIndex):abc.findMultinameUsage(abcTags,multinameIndex);
|
||||
Multiname m = abc.constants.constant_multiname.get(multinameIndex);
|
||||
|
||||
@@ -28,7 +28,7 @@ import com.jpexs.decompiler.flash.action.swf4.ActionPush;
|
||||
import com.jpexs.decompiler.flash.action.swf4.ConstantIndex;
|
||||
import com.jpexs.decompiler.flash.configuration.Configuration;
|
||||
import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode;
|
||||
import com.jpexs.decompiler.flash.gui.GraphFrame;
|
||||
import com.jpexs.decompiler.flash.gui.GraphDialog;
|
||||
import com.jpexs.decompiler.flash.gui.HeaderLabel;
|
||||
import com.jpexs.decompiler.flash.gui.Main;
|
||||
import com.jpexs.decompiler.flash.gui.MainPanel;
|
||||
@@ -251,12 +251,11 @@ public class ActionPanel extends JPanel implements ActionListener, SearchListene
|
||||
|
||||
Main.stopWork();
|
||||
searchPanel.setSearchText(txt);
|
||||
final ActionPanel that=this;
|
||||
View.execInEventDispatch(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
SearchResultsDialog<ActionSearchResult> sr=new SearchResultsDialog<ActionSearchResult>(txt,that);
|
||||
SearchResultsDialog<ActionSearchResult> sr=new SearchResultsDialog<>(ActionPanel.this.mainPanel.getMainFrame().getWindow(),txt,ActionPanel.this);
|
||||
sr.setResults(found);
|
||||
sr.setVisible(true);
|
||||
}
|
||||
@@ -705,7 +704,7 @@ public class ActionPanel extends JPanel implements ActionListener, SearchListene
|
||||
case ACTION_GRAPH:
|
||||
if (lastCode != null) {
|
||||
try {
|
||||
GraphFrame gf = new GraphFrame(new ActionGraph(lastCode, new HashMap<Integer, String>(), new HashMap<String, GraphTargetItem>(), new HashMap<String, GraphTargetItem>(), SWF.DEFAULT_VERSION), "");
|
||||
GraphDialog gf = new GraphDialog(mainPanel.getMainFrame().getWindow(),new ActionGraph(lastCode, new HashMap<Integer, String>(), new HashMap<String, GraphTargetItem>(), new HashMap<String, GraphTargetItem>(), SWF.DEFAULT_VERSION), "");
|
||||
gf.setVisible(true);
|
||||
} catch (InterruptedException ex) {
|
||||
Logger.getLogger(ActionPanel.class.getName()).log(Level.SEVERE, null, ex);
|
||||
|
||||
@@ -22,7 +22,7 @@ import com.jpexs.decompiler.flash.gui.ErrorLogFrame;
|
||||
import com.jpexs.decompiler.flash.gui.ExportDialog;
|
||||
import com.jpexs.decompiler.flash.gui.FontEmbedDialog;
|
||||
import com.jpexs.decompiler.flash.gui.FontPreviewDialog;
|
||||
import com.jpexs.decompiler.flash.gui.GraphFrame;
|
||||
import com.jpexs.decompiler.flash.gui.GraphDialog;
|
||||
import com.jpexs.decompiler.flash.gui.LoadFromCacheFrame;
|
||||
import com.jpexs.decompiler.flash.gui.LoadFromMemoryFrame;
|
||||
import com.jpexs.decompiler.flash.gui.LoadingDialog;
|
||||
@@ -59,7 +59,7 @@ public class CheckResources {
|
||||
ExportDialog.class,
|
||||
FontEmbedDialog.class,
|
||||
FontPreviewDialog.class,
|
||||
GraphFrame.class,
|
||||
GraphDialog.class,
|
||||
// GraphTreeFrame.class, // empty
|
||||
LoadFromCacheFrame.class,
|
||||
LoadFromMemoryFrame.class,
|
||||
|
||||
Reference in New Issue
Block a user