mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-11 18:31:54 +00:00
Added: #2370 Magnet icon toggle for snap options.
Better popups for deobfuscate options + link options.
This commit is contained in:
@@ -12,7 +12,7 @@ All notable changes to this project will be documented in this file.
|
||||
- [#2370] Objects display - Option to show horizontal and vertical rulers
|
||||
- [#2370] Objects display - Create guides by dragging from a ruler
|
||||
- Objects dragging - show touch point and snap it to 9 important points around object rectangle
|
||||
- [#2370] Snap to guides, objects and pixels, Snap align
|
||||
- [#2370] Snap to guides, objects and pixels, Snap align, toggle with magnet icon
|
||||
|
||||
### Fixed
|
||||
- [#2424] DefineEditText handling of letterSpacing, font size on incorrect values
|
||||
|
||||
@@ -399,6 +399,11 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
|
||||
private int guidesCharacterId = -1;
|
||||
|
||||
@Override
|
||||
public boolean canUseSnapping() {
|
||||
return selectionMode || doFreeTransform || hilightedPoints != null;
|
||||
}
|
||||
|
||||
public void setFrozenButtons(boolean frozenButtons) {
|
||||
this.frozenButtons = frozenButtons;
|
||||
}
|
||||
|
||||
109
src/com/jpexs/decompiler/flash/gui/PopupButton.java
Normal file
109
src/com/jpexs/decompiler/flash/gui/PopupButton.java
Normal file
@@ -0,0 +1,109 @@
|
||||
/*
|
||||
* Copyright (C) 2025 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.gui;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.JPopupMenu;
|
||||
import javax.swing.JToggleButton;
|
||||
import javax.swing.event.PopupMenuEvent;
|
||||
import javax.swing.event.PopupMenuListener;
|
||||
|
||||
/**
|
||||
* Button with a popup on click.
|
||||
* The logic ensures that it stays down when menu is shown.
|
||||
* @author JPEXS
|
||||
*/
|
||||
public abstract class PopupButton extends JToggleButton {
|
||||
|
||||
private boolean insideButton = false;
|
||||
|
||||
private PopupMenuListener popupListener;
|
||||
|
||||
private JPopupMenu popupMenu;
|
||||
|
||||
public PopupButton(Icon icon) {
|
||||
super(icon);
|
||||
initListeners();
|
||||
}
|
||||
|
||||
public PopupButton(String text) {
|
||||
super(text);
|
||||
initListeners();
|
||||
}
|
||||
|
||||
public PopupButton(String text, Icon icon) {
|
||||
super(text, icon);
|
||||
initListeners();
|
||||
}
|
||||
|
||||
private void initListeners() {
|
||||
addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseEntered(MouseEvent e) {
|
||||
insideButton = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseExited(MouseEvent e) {
|
||||
insideButton = false;
|
||||
}
|
||||
});
|
||||
addActionListener(this::popupOpenActionPerformed);
|
||||
popupListener = new PopupMenuListener() {
|
||||
@Override
|
||||
public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
|
||||
if (!insideButton) {
|
||||
PopupButton.this.setSelected(false);
|
||||
}
|
||||
if (popupMenu != null) {
|
||||
popupMenu.removePopupMenuListener(popupListener);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void popupMenuCanceled(PopupMenuEvent e) {
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Method for getting (constructing?) a popup menu
|
||||
* @return A popup menu
|
||||
*/
|
||||
protected abstract JPopupMenu getPopupMenu();
|
||||
|
||||
private void popupOpenActionPerformed(ActionEvent evt) {
|
||||
if (!isSelected()) {
|
||||
return;
|
||||
}
|
||||
|
||||
popupMenu = getPopupMenu();
|
||||
popupMenu.addPopupMenuListener(popupListener);
|
||||
|
||||
JToggleButton sourceButton = (JToggleButton) evt.getSource();
|
||||
popupMenu.show(sourceButton, 0, sourceButton.getHeight());
|
||||
}
|
||||
}
|
||||
@@ -92,6 +92,11 @@ public class SoundTagPlayer implements MediaDisplay {
|
||||
|
||||
private int instanceId = totalInstances++;
|
||||
|
||||
@Override
|
||||
public boolean canUseSnapping() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getInstanceId() {
|
||||
return instanceId;
|
||||
}
|
||||
|
||||
@@ -57,6 +57,7 @@ import com.jpexs.decompiler.flash.gui.FasterScrollPane;
|
||||
import com.jpexs.decompiler.flash.gui.HeaderLabel;
|
||||
import com.jpexs.decompiler.flash.gui.Main;
|
||||
import com.jpexs.decompiler.flash.gui.MainPanel;
|
||||
import com.jpexs.decompiler.flash.gui.PopupButton;
|
||||
import com.jpexs.decompiler.flash.gui.SearchListener;
|
||||
import com.jpexs.decompiler.flash.gui.SearchPanel;
|
||||
import com.jpexs.decompiler.flash.gui.TagEditorPanel;
|
||||
@@ -978,8 +979,23 @@ public class ABCPanel extends JPanel implements ItemListener, SearchListener<Scr
|
||||
}
|
||||
});
|
||||
|
||||
JButton deobfuscateOptionsButton = new JButton(View.getIcon("deobfuscateoptions16"));
|
||||
deobfuscateOptionsButton.addActionListener(this::deobfuscateOptionsButtonActionPerformed);
|
||||
PopupButton deobfuscateOptionsButton = new PopupButton(View.getIcon("deobfuscateoptions16")) {
|
||||
@Override
|
||||
protected JPopupMenu getPopupMenu() {
|
||||
JPopupMenu popupMenu = new JPopupMenu();
|
||||
JCheckBoxMenuItem simplifyExpressionsMenuItem = new JCheckBoxMenuItem(AppStrings.translate("deobfuscate_options.simplify_expressions"));
|
||||
simplifyExpressionsMenuItem.setSelected(Configuration.simplifyExpressions.get());
|
||||
simplifyExpressionsMenuItem.addActionListener(ABCPanel.this::simplifyExpressionsMenuItemActionPerformed);
|
||||
/*JCheckBoxMenuItem removeObfuscatedDeclarationsMenuItem = new JCheckBoxMenuItem(AppStrings.translate("deobfuscate_options.remove_obfuscated_declarations"));
|
||||
removeObfuscatedDeclarationsMenuItem.setSelected(Configuration.deobfuscateAs12RemoveInvalidNamesAssignments.get());
|
||||
removeObfuscatedDeclarationsMenuItem.addActionListener(this::removeObfuscatedDeclarationsMenuItemActionPerformed);
|
||||
*/
|
||||
popupMenu.add(simplifyExpressionsMenuItem);
|
||||
//popupMenu.add(removeObfuscatedDeclarationsMenuItem);
|
||||
|
||||
return popupMenu;
|
||||
}
|
||||
};
|
||||
deobfuscateOptionsButton.setToolTipText(AppStrings.translate("button.deobfuscate_options"));
|
||||
deobfuscateOptionsButton.setMargin(new Insets(0, 0, 0, 0));
|
||||
deobfuscateOptionsButton.setPreferredSize(new Dimension(30, deobfuscateButton.getPreferredSize().height));
|
||||
@@ -1004,7 +1020,9 @@ public class ABCPanel extends JPanel implements ItemListener, SearchListener<Scr
|
||||
|
||||
JPanel libraryAndLinkPanel = new JPanel(new FlowLayout());
|
||||
|
||||
LinkDialog linkDialog = new LinkDialog(mainPanel);
|
||||
JToggleButton linkButton = new JToggleButton(View.getIcon("link16"));
|
||||
|
||||
LinkDialog linkDialog = new LinkDialog(mainPanel, linkButton);
|
||||
|
||||
libraryComboBox = new JComboBox<>();
|
||||
libraryComboBox.addItem("AIR (airglobal.swc)");
|
||||
@@ -1029,9 +1047,8 @@ public class ABCPanel extends JPanel implements ItemListener, SearchListener<Scr
|
||||
|
||||
libraryAndLinkPanel.add(linksLabel);
|
||||
|
||||
JButton linkButton = new JButton(View.getIcon("link16"));
|
||||
linkButton.setToolTipText(AppStrings.translate("button.abc.linkedSwfs.hint"));
|
||||
|
||||
linkButton.setToolTipText(AppStrings.translate("button.abc.linkedSwfs.hint"));
|
||||
|
||||
linkDialog.addSaveListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
@@ -1042,6 +1059,9 @@ public class ABCPanel extends JPanel implements ItemListener, SearchListener<Scr
|
||||
linkButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (!linkButton.isSelected()) {
|
||||
return;
|
||||
}
|
||||
linkDialog.setLocationRelativeTo(linkButton);
|
||||
Point loc = new Point(0, linkButton.getHeight());
|
||||
SwingUtilities.convertPointToScreen(loc, linkButton);
|
||||
@@ -1799,23 +1819,7 @@ public class ABCPanel extends JPanel implements ItemListener, SearchListener<Scr
|
||||
} else {
|
||||
toggleButton.setSelected(Configuration.autoDeobfuscate.get());
|
||||
}
|
||||
}
|
||||
|
||||
private void deobfuscateOptionsButtonActionPerformed(ActionEvent evt) {
|
||||
JPopupMenu popupMenu = new JPopupMenu();
|
||||
JCheckBoxMenuItem simplifyExpressionsMenuItem = new JCheckBoxMenuItem(AppStrings.translate("deobfuscate_options.simplify_expressions"));
|
||||
simplifyExpressionsMenuItem.setSelected(Configuration.simplifyExpressions.get());
|
||||
simplifyExpressionsMenuItem.addActionListener(this::simplifyExpressionsMenuItemActionPerformed);
|
||||
/*JCheckBoxMenuItem removeObfuscatedDeclarationsMenuItem = new JCheckBoxMenuItem(AppStrings.translate("deobfuscate_options.remove_obfuscated_declarations"));
|
||||
removeObfuscatedDeclarationsMenuItem.setSelected(Configuration.deobfuscateAs12RemoveInvalidNamesAssignments.get());
|
||||
removeObfuscatedDeclarationsMenuItem.addActionListener(this::removeObfuscatedDeclarationsMenuItemActionPerformed);
|
||||
*/
|
||||
popupMenu.add(simplifyExpressionsMenuItem);
|
||||
//popupMenu.add(removeObfuscatedDeclarationsMenuItem);
|
||||
|
||||
JButton sourceButton = (JButton) evt.getSource();
|
||||
popupMenu.show(sourceButton, 0, sourceButton.getHeight());
|
||||
}
|
||||
}
|
||||
|
||||
private void simplifyExpressionsMenuItemActionPerformed(ActionEvent evt) {
|
||||
JCheckBoxMenuItem menuItem = (JCheckBoxMenuItem) evt.getSource();
|
||||
|
||||
@@ -42,6 +42,7 @@ import javax.swing.JDialog;
|
||||
import javax.swing.JList;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JRootPane;
|
||||
import javax.swing.JToggleButton;
|
||||
import javax.swing.ListCellRenderer;
|
||||
import javax.swing.ListModel;
|
||||
import javax.swing.SwingUtilities;
|
||||
@@ -58,6 +59,8 @@ public class LinkDialog extends JDialog {
|
||||
|
||||
private SWF swf;
|
||||
|
||||
private boolean overLinkButton = false;
|
||||
|
||||
private List<ActionListener> saveListeners = new ArrayList<>();
|
||||
|
||||
public void addSaveListener(ActionListener listener) {
|
||||
@@ -74,8 +77,19 @@ public class LinkDialog extends JDialog {
|
||||
}
|
||||
}
|
||||
|
||||
public LinkDialog(MainPanel mainPanel) {
|
||||
public LinkDialog(MainPanel mainPanel, JToggleButton linkButton) {
|
||||
this.mainPanel = mainPanel;
|
||||
linkButton.addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseEntered(MouseEvent e) {
|
||||
overLinkButton = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseExited(MouseEvent e) {
|
||||
overLinkButton = false;
|
||||
}
|
||||
});
|
||||
setUndecorated(true);
|
||||
setResizable(false);
|
||||
getRootPane().setWindowDecorationStyle(JRootPane.NONE);
|
||||
@@ -86,6 +100,9 @@ public class LinkDialog extends JDialog {
|
||||
public void windowDeactivated(WindowEvent e) {
|
||||
save(swf, false);
|
||||
swf = null;
|
||||
if (!overLinkButton) {
|
||||
linkButton.setSelected(false);
|
||||
}
|
||||
dispose();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
* Copyright (C) 2025 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.gui.abc;
|
||||
|
||||
import com.jpexs.decompiler.flash.configuration.Configuration;
|
||||
import com.jpexs.decompiler.flash.gui.AppStrings;
|
||||
import com.jpexs.decompiler.flash.gui.PopupButton;
|
||||
import com.jpexs.decompiler.flash.gui.View;
|
||||
import java.awt.Insets;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JCheckBoxMenuItem;
|
||||
import javax.swing.JPopupMenu;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class SnapOptionsButton extends PopupButton {
|
||||
|
||||
|
||||
public SnapOptionsButton() {
|
||||
super(View.getIcon("snap16"));
|
||||
setToolTipText(AppStrings.translate("button.snap_options"));
|
||||
setMargin(new Insets(0, 0, 0, 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected JPopupMenu getPopupMenu() {
|
||||
JPopupMenu popupMenu = new JPopupMenu();
|
||||
|
||||
JCheckBox snapAlignMenuItem = new JCheckBox(AppStrings.translate("snap_options.snap_align"));
|
||||
snapAlignMenuItem.setSelected(Configuration.snapAlign.get());
|
||||
snapAlignMenuItem.addActionListener(this::snapAlignMenuItemActionPerformed);
|
||||
popupMenu.add(snapAlignMenuItem);
|
||||
|
||||
JCheckBox snapToGuidesMenuItem = new JCheckBox(AppStrings.translate("snap_options.snap_to_guides"));
|
||||
snapToGuidesMenuItem.setSelected(Configuration.snapToGuides.get());
|
||||
snapToGuidesMenuItem.addActionListener(this::snapToGuidesMenuItemActionPerformed);
|
||||
popupMenu.add(snapToGuidesMenuItem);
|
||||
|
||||
JCheckBox snapToPixelsMenuItem = new JCheckBox(AppStrings.translate("snap_options.snap_to_pixels"));
|
||||
snapToPixelsMenuItem.setSelected(Configuration.snapToPixels.get());
|
||||
snapToPixelsMenuItem.addActionListener(this::snapToPixelsMenuItemActionPerformed);
|
||||
popupMenu.add(snapToPixelsMenuItem);
|
||||
|
||||
JCheckBox snapToObjectsMenuItem = new JCheckBox(AppStrings.translate("snap_options.snap_to_objects"));
|
||||
snapToObjectsMenuItem.setSelected(Configuration.snapToObjects.get());
|
||||
snapToObjectsMenuItem.addActionListener(this::snapToObjectsMenuItemActionPerformed);
|
||||
popupMenu.add(snapToObjectsMenuItem);
|
||||
|
||||
return popupMenu;
|
||||
}
|
||||
|
||||
private void snapAlignMenuItemActionPerformed(ActionEvent evt) {
|
||||
JCheckBox menuItem = (JCheckBox) evt.getSource();
|
||||
Configuration.snapAlign.set(menuItem.isSelected());
|
||||
}
|
||||
|
||||
private void snapToGuidesMenuItemActionPerformed(ActionEvent evt) {
|
||||
JCheckBox menuItem = (JCheckBox) evt.getSource();
|
||||
Configuration.snapToGuides.set(menuItem.isSelected());
|
||||
}
|
||||
|
||||
private void snapToPixelsMenuItemActionPerformed(ActionEvent evt) {
|
||||
JCheckBox menuItem = (JCheckBox) evt.getSource();
|
||||
Configuration.snapToPixels.set(menuItem.isSelected());
|
||||
}
|
||||
|
||||
private void snapToObjectsMenuItemActionPerformed(ActionEvent evt) {
|
||||
JCheckBox menuItem = (JCheckBox) evt.getSource();
|
||||
Configuration.snapToObjects.set(menuItem.isSelected());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -47,6 +47,7 @@ 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;
|
||||
import com.jpexs.decompiler.flash.gui.PopupButton;
|
||||
import com.jpexs.decompiler.flash.gui.ScrollablePanel;
|
||||
import com.jpexs.decompiler.flash.gui.SearchListener;
|
||||
import com.jpexs.decompiler.flash.gui.SearchPanel;
|
||||
@@ -92,6 +93,7 @@ import javax.swing.BorderFactory;
|
||||
import javax.swing.Box;
|
||||
import javax.swing.BoxLayout;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JCheckBoxMenuItem;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JOptionPane;
|
||||
@@ -196,8 +198,8 @@ public class ActionPanel extends JPanel implements SearchListener<ScriptSearchRe
|
||||
|
||||
public synchronized boolean isScriptLoaded() {
|
||||
return scriptLoaded;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void addScriptListener(Runnable listener) {
|
||||
scriptListeners.add(listener);
|
||||
}
|
||||
@@ -498,7 +500,7 @@ public class ActionPanel extends JPanel implements SearchListener<ScriptSearchRe
|
||||
|
||||
public synchronized void setSource(final ASMSource src, final boolean useCache) {
|
||||
View.checkAccess();
|
||||
|
||||
|
||||
scriptLoaded = false;
|
||||
|
||||
if (setSourceWorker != null) {
|
||||
@@ -554,7 +556,7 @@ public class ActionPanel extends JPanel implements SearchListener<ScriptSearchRe
|
||||
asm.removeDisassemblyListener(listener);
|
||||
}
|
||||
|
||||
if (decompileNeeded) {
|
||||
if (decompileNeeded) {
|
||||
View.execInEventDispatch(() -> {
|
||||
decompiledEditor.setShowMarkers(false);
|
||||
if (src.getSwf().needsCalculatingAS2UninitializeClassTraits(src)) {
|
||||
@@ -946,8 +948,23 @@ public class ActionPanel extends JPanel implements SearchListener<ScriptSearchRe
|
||||
}
|
||||
});
|
||||
|
||||
JButton deobfuscateOptionsButton = new JButton(View.getIcon("deobfuscateoptions16"));
|
||||
deobfuscateOptionsButton.addActionListener(this::deobfuscateOptionsButtonActionPerformed);
|
||||
PopupButton deobfuscateOptionsButton = new PopupButton(View.getIcon("deobfuscateoptions16")) {
|
||||
@Override
|
||||
protected JPopupMenu getPopupMenu() {
|
||||
JPopupMenu popupMenu = new JPopupMenu();
|
||||
JCheckBox simplifyExpressionsMenuItem = new JCheckBox(AppStrings.translate("deobfuscate_options.simplify_expressions"));
|
||||
simplifyExpressionsMenuItem.setSelected(Configuration.simplifyExpressions.get());
|
||||
simplifyExpressionsMenuItem.addActionListener(ActionPanel.this::simplifyExpressionsMenuItemActionPerformed);
|
||||
JCheckBox removeObfuscatedDeclarationsMenuItem = new JCheckBox(AppStrings.translate("deobfuscate_options.remove_obfuscated_declarations"));
|
||||
removeObfuscatedDeclarationsMenuItem.setSelected(Configuration.deobfuscateAs12RemoveInvalidNamesAssignments.get());
|
||||
removeObfuscatedDeclarationsMenuItem.addActionListener(ActionPanel.this::removeObfuscatedDeclarationsMenuItemActionPerformed);
|
||||
|
||||
popupMenu.add(simplifyExpressionsMenuItem);
|
||||
popupMenu.add(removeObfuscatedDeclarationsMenuItem);
|
||||
|
||||
return popupMenu;
|
||||
}
|
||||
};
|
||||
deobfuscateOptionsButton.setToolTipText(AppStrings.translate("button.deobfuscate_options"));
|
||||
deobfuscateOptionsButton.setMargin(new Insets(0, 0, 0, 0));
|
||||
deobfuscateOptionsButton.setPreferredSize(new Dimension(30, deobfuscateButton.getPreferredSize().height));
|
||||
@@ -1074,31 +1091,15 @@ public class ActionPanel extends JPanel implements SearchListener<ScriptSearchRe
|
||||
}
|
||||
}
|
||||
|
||||
private void deobfuscateOptionsButtonActionPerformed(ActionEvent evt) {
|
||||
JPopupMenu popupMenu = new JPopupMenu();
|
||||
JCheckBoxMenuItem simplifyExpressionsMenuItem = new JCheckBoxMenuItem(AppStrings.translate("deobfuscate_options.simplify_expressions"));
|
||||
simplifyExpressionsMenuItem.setSelected(Configuration.simplifyExpressions.get());
|
||||
simplifyExpressionsMenuItem.addActionListener(this::simplifyExpressionsMenuItemActionPerformed);
|
||||
JCheckBoxMenuItem removeObfuscatedDeclarationsMenuItem = new JCheckBoxMenuItem(AppStrings.translate("deobfuscate_options.remove_obfuscated_declarations"));
|
||||
removeObfuscatedDeclarationsMenuItem.setSelected(Configuration.deobfuscateAs12RemoveInvalidNamesAssignments.get());
|
||||
removeObfuscatedDeclarationsMenuItem.addActionListener(this::removeObfuscatedDeclarationsMenuItemActionPerformed);
|
||||
|
||||
popupMenu.add(simplifyExpressionsMenuItem);
|
||||
popupMenu.add(removeObfuscatedDeclarationsMenuItem);
|
||||
|
||||
JButton sourceButton = (JButton) evt.getSource();
|
||||
popupMenu.show(sourceButton, 0, sourceButton.getHeight());
|
||||
}
|
||||
|
||||
private void simplifyExpressionsMenuItemActionPerformed(ActionEvent evt) {
|
||||
JCheckBoxMenuItem menuItem = (JCheckBoxMenuItem) evt.getSource();
|
||||
Configuration.simplifyExpressions.set(menuItem.isSelected());
|
||||
JCheckBox checkBox = (JCheckBox) evt.getSource();
|
||||
Configuration.simplifyExpressions.set(checkBox.isSelected());
|
||||
mainPanel.autoDeobfuscateChanged();
|
||||
}
|
||||
|
||||
private void removeObfuscatedDeclarationsMenuItemActionPerformed(ActionEvent evt) {
|
||||
JCheckBoxMenuItem menuItem = (JCheckBoxMenuItem) evt.getSource();
|
||||
Configuration.deobfuscateAs12RemoveInvalidNamesAssignments.set(menuItem.isSelected());
|
||||
JCheckBox checkBox = (JCheckBox) evt.getSource();
|
||||
Configuration.deobfuscateAs12RemoveInvalidNamesAssignments.set(checkBox.isSelected());
|
||||
mainPanel.autoDeobfuscateChanged();
|
||||
}
|
||||
|
||||
@@ -1437,5 +1438,5 @@ public class ActionPanel extends JPanel implements SearchListener<ScriptSearchRe
|
||||
|
||||
public synchronized ASMSource getSrc() {
|
||||
return src;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BIN
src/com/jpexs/decompiler/flash/gui/graphics/snap16.png
Normal file
BIN
src/com/jpexs/decompiler/flash/gui/graphics/snap16.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 660 B |
BIN
src/com/jpexs/decompiler/flash/gui/graphics/snap32.png
Normal file
BIN
src/com/jpexs/decompiler/flash/gui/graphics/snap32.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
@@ -1021,3 +1021,11 @@ message.wiki = Visit FFDec Wiki at: \r\n%url%
|
||||
|
||||
#after 22.0.1
|
||||
filter.swf_spl = SWF files (*.swf, *.spl)
|
||||
|
||||
#after 22.0.2
|
||||
button.snap_options = Snap options
|
||||
snap_options.snap_align = Snap Align
|
||||
snap_options.snap_to_guides = Snap to Guides
|
||||
snap_options.snap_to_pixels = Snap to Pixels
|
||||
snap_options.snap_to_objects = Snap to Objects
|
||||
|
||||
|
||||
@@ -71,6 +71,11 @@ public final class FlashPlayerPanel extends Panel implements Closeable, MediaDis
|
||||
|
||||
private Color bgColor;
|
||||
|
||||
@Override
|
||||
public boolean canUseSnapping() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean loopAvailable() {
|
||||
return false;
|
||||
|
||||
@@ -82,4 +82,6 @@ public interface MediaDisplay extends Closeable {
|
||||
public void setMuted(boolean value);
|
||||
|
||||
public boolean isMutable();
|
||||
|
||||
public boolean canUseSnapping();
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.jpexs.decompiler.flash.gui.player;
|
||||
|
||||
import com.jpexs.decompiler.flash.gui.AppStrings;
|
||||
import com.jpexs.decompiler.flash.gui.View;
|
||||
import com.jpexs.decompiler.flash.gui.abc.SnapOptionsButton;
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.math.BigDecimal;
|
||||
@@ -35,6 +36,7 @@ public class ZoomPanel extends JPanel implements MediaDisplayListener {
|
||||
|
||||
private MediaDisplay display;
|
||||
private JButton zoomFitButton;
|
||||
private SnapOptionsButton snapOptionsButton;
|
||||
private final JLabel percentLabel = new JLabel("100%");
|
||||
private boolean zoomToFit = false;
|
||||
private double realZoom = 1.0;
|
||||
@@ -57,6 +59,8 @@ public class ZoomPanel extends JPanel implements MediaDisplayListener {
|
||||
JButton zoomNoneButton = new JButton(View.getIcon("zoomnone16"));
|
||||
zoomNoneButton.addActionListener(this::zoomNoneButtonActionPerformed);
|
||||
zoomNoneButton.setToolTipText(AppStrings.translate("button.zoomnone.hint"));
|
||||
|
||||
snapOptionsButton = new SnapOptionsButton();
|
||||
|
||||
setLayout(new FlowLayout());
|
||||
add(percentLabel);
|
||||
@@ -64,6 +68,7 @@ public class ZoomPanel extends JPanel implements MediaDisplayListener {
|
||||
add(zoomOutButton);
|
||||
add(zoomNoneButton);
|
||||
add(zoomFitButton);
|
||||
add(snapOptionsButton);
|
||||
|
||||
display.addEventListener(this);
|
||||
}
|
||||
@@ -149,6 +154,7 @@ public class ZoomPanel extends JPanel implements MediaDisplayListener {
|
||||
Zoom zoom = display.getZoom();
|
||||
zoomFitButton.setVisible(zoom != null);
|
||||
percentLabel.setVisible(zoom != null);
|
||||
snapOptionsButton.setVisible(display.canUseSnapping());
|
||||
Zoom currentZoom = new Zoom();
|
||||
currentZoom.fit = zoomToFit;
|
||||
currentZoom.value = realZoom;
|
||||
|
||||
Reference in New Issue
Block a user