mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-27 23:55:34 +00:00
rendering fix, gc and cache clear buttons added to debug menu
This commit is contained in:
@@ -2561,7 +2561,7 @@ public final class SWF implements SWFContainerItem, Timelined {
|
||||
SerializableImage img = null;
|
||||
String cacheKey = null;
|
||||
if (drawable instanceof ShapeTag) {
|
||||
cacheKey = m.toString() + clrTrans.toString();
|
||||
cacheKey = ((ShapeTag) drawable).getCharacterId() + m.toString() + clrTrans.toString();
|
||||
img = renderContext.shapeCache.get(cacheKey);
|
||||
}
|
||||
|
||||
|
||||
@@ -146,6 +146,10 @@ public class Configuration {
|
||||
@ConfigurationCategory("debug")
|
||||
public static final ConfigurationItem<Boolean> debugMode = null;
|
||||
|
||||
@ConfigurationDefaultBoolean(false)
|
||||
@ConfigurationCategory("debug")
|
||||
public static final ConfigurationItem<Boolean> showDebugMenu = null;
|
||||
|
||||
/**
|
||||
* Turn off resolving constants in ActionScript 2
|
||||
*/
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
package com.jpexs.decompiler.flash.gui;
|
||||
|
||||
import com.jpexs.decompiler.flash.SWF;
|
||||
import com.jpexs.decompiler.flash.SWFBundle;
|
||||
import com.jpexs.decompiler.flash.configuration.Configuration;
|
||||
import com.jpexs.decompiler.flash.console.ContextMenuTools;
|
||||
import com.jpexs.decompiler.flash.tags.ABCContainerTag;
|
||||
|
||||
@@ -41,6 +41,7 @@ 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.icon.ResizableIcon;
|
||||
import org.pushingpixels.flamingo.api.ribbon.JRibbon;
|
||||
import org.pushingpixels.flamingo.api.ribbon.JRibbonBand;
|
||||
import org.pushingpixels.flamingo.api.ribbon.JRibbonComponent;
|
||||
@@ -155,14 +156,8 @@ public class MainFrameRibbonMenu extends MainFrameMenu implements ActionListener
|
||||
|
||||
private static final String ACTION_DEOBFUSCATE_ALL = "DEOBFUSCATEALL";
|
||||
|
||||
private static final String ACTION_REMOVE_NON_SCRIPTS = "REMOVENONSCRIPTS";
|
||||
|
||||
private static final String ACTION_REFRESH_DECOMPILED = "REFRESHDECOMPILED";
|
||||
|
||||
private static final String ACTION_CLEAR_RECENT_FILES = "CLEARRECENTFILES";
|
||||
|
||||
private static final String ACTION_CHECK_RESOURCES = "CHECKRESOURCES";
|
||||
|
||||
private static final String ACTION_VIEWMODE_RESOURCES = "VIEWMODERESOURCES";
|
||||
|
||||
private static final String ACTION_VIEWMODE_HEX_DUMP = "VIEWMODEHEXDUMP";
|
||||
@@ -270,7 +265,7 @@ public class MainFrameRibbonMenu extends MainFrameMenu implements ActionListener
|
||||
ribbon.addTask(createSettingsRibbonTask(externalFlashPlayerUnavailable));
|
||||
ribbon.addTask(createHelpRibbonTask());
|
||||
|
||||
if (Configuration.debugMode.get()) {
|
||||
if (Configuration.showDebugMenu.get()) {
|
||||
ribbon.addTask(createDebugRibbonTask());
|
||||
}
|
||||
|
||||
@@ -520,7 +515,6 @@ public class MainFrameRibbonMenu extends MainFrameMenu implements ActionListener
|
||||
searchCommandButton = new JCommandButton(fixCommandTitle(translate("menu.tools.search")), View.getResizableIcon("search32"));
|
||||
assignListener(searchCommandButton, ACTION_SEARCH);
|
||||
|
||||
// todo: change icon
|
||||
replaceCommandButton = new JCommandButton(fixCommandTitle(translate("menu.tools.replace")), View.getResizableIcon("replace32"));
|
||||
assignListener(replaceCommandButton, ACTION_REPLACE);
|
||||
|
||||
@@ -703,21 +697,35 @@ public class MainFrameRibbonMenu extends MainFrameMenu implements ActionListener
|
||||
private RibbonTask createDebugRibbonTask() {
|
||||
// ----------------------------------------- DEBUG -----------------------------------
|
||||
|
||||
ResizableIcon icon = View.getResizableIcon("update16");
|
||||
JRibbonBand debugBand = new JRibbonBand("Debug", null);
|
||||
debugBand.setResizePolicies(getResizePolicies(debugBand));
|
||||
|
||||
JCommandButton removeNonScriptsCommandButton = new JCommandButton(fixCommandTitle("Remove non scripts"), View.getResizableIcon("update16"));
|
||||
assignListener(removeNonScriptsCommandButton, ACTION_REMOVE_NON_SCRIPTS);
|
||||
JCommandButton removeNonScriptsCommandButton = new JCommandButton(fixCommandTitle("Remove non scripts"), icon);
|
||||
removeNonScriptsCommandButton.addActionListener(e -> removeNonScripts());
|
||||
|
||||
JCommandButton refreshDecompiledCommandButton = new JCommandButton(fixCommandTitle("Refresh decompiled script"), View.getResizableIcon("update16"));
|
||||
assignListener(refreshDecompiledCommandButton, ACTION_REFRESH_DECOMPILED);
|
||||
JCommandButton refreshDecompiledCommandButton = new JCommandButton(fixCommandTitle("Refresh decompiled script"), icon);
|
||||
refreshDecompiledCommandButton.addActionListener(e -> refreshDecompiled());
|
||||
|
||||
JCommandButton checkResourcesCommandButton = new JCommandButton(fixCommandTitle("Check resources"), View.getResizableIcon("update16"));
|
||||
assignListener(checkResourcesCommandButton, ACTION_CHECK_RESOURCES);
|
||||
JCommandButton checkResourcesCommandButton = new JCommandButton(fixCommandTitle("Check resources"), icon);
|
||||
checkResourcesCommandButton.addActionListener(e -> checkResources());
|
||||
|
||||
JCommandButton callGcCommandButton = new JCommandButton(fixCommandTitle("Call System.gc()"), icon);
|
||||
callGcCommandButton.addActionListener(e -> System.gc());
|
||||
|
||||
JCommandButton emptyCacheCommandButton = new JCommandButton(fixCommandTitle("Empty cache"), icon);
|
||||
emptyCacheCommandButton.addActionListener(e -> {
|
||||
SWF swf = mainFrame.getPanel().getCurrentSwf();
|
||||
if (swf != null) {
|
||||
swf.clearAllCache();
|
||||
}
|
||||
});
|
||||
|
||||
debugBand.addCommandButton(removeNonScriptsCommandButton, RibbonElementPriority.MEDIUM);
|
||||
debugBand.addCommandButton(refreshDecompiledCommandButton, RibbonElementPriority.MEDIUM);
|
||||
debugBand.addCommandButton(checkResourcesCommandButton, RibbonElementPriority.MEDIUM);
|
||||
debugBand.addCommandButton(callGcCommandButton, RibbonElementPriority.MEDIUM);
|
||||
debugBand.addCommandButton(emptyCacheCommandButton, RibbonElementPriority.MEDIUM);
|
||||
return new RibbonTask("Debug", debugBand);
|
||||
}
|
||||
|
||||
@@ -1000,15 +1008,6 @@ public class MainFrameRibbonMenu extends MainFrameMenu implements ActionListener
|
||||
case ACTION_DEOBFUSCATE_ALL:
|
||||
deobfuscate();
|
||||
break;
|
||||
case ACTION_REMOVE_NON_SCRIPTS:
|
||||
removeNonScripts();
|
||||
break;
|
||||
case ACTION_REFRESH_DECOMPILED:
|
||||
refreshDecompiled();
|
||||
break;
|
||||
case ACTION_CHECK_RESOURCES:
|
||||
checkResources();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -326,3 +326,6 @@ config.description.autoSaveTagModifications = Save the changes when you select a
|
||||
|
||||
config.name.saveSessionOnExit = Save session on exit
|
||||
config.description.saveSessionOnExit = Save the current session and reopens it after FFDec restart (works only with real files)
|
||||
|
||||
config.name.showDebugMenu = Show debug menu
|
||||
config.description.showDebugMenu = Shows debug menu in the ribbon
|
||||
|
||||
@@ -323,3 +323,6 @@ config.description.autoSaveTagModifications = V\u00e1ltoz\u00e1sok ment\u00e9se
|
||||
|
||||
config.name.saveSessionOnExit = Munkamenet ment\u00e9se kil\u00e9p\u00e9skor
|
||||
config.description.saveSessionOnExit = Elmenti az aktu\u00e1lis munkamenetet \u00e9s vissza\u00e1ll\u00edtja azt az FFDec \u00fajraind\u00edt\u00e1sa ut\u00e1n (csak igazi f\u00e1jlokkal m\u0171k\u00f6dik)
|
||||
|
||||
config.name.showDebugMenu = Hibakeres\u00e9si men\u00fc mutat\u00e1sa
|
||||
config.description.showDebugMenu = Hibakeres\u00e9si men\u00fc mutat\u00e1sa a szalagon
|
||||
|
||||
@@ -549,6 +549,7 @@ public class TagTreeContextMenu extends JPopupMenu implements ActionListener {
|
||||
Tag tag = (Tag) item;
|
||||
tag.undo();
|
||||
tag.getSwf().clearAllCache();
|
||||
tagTree.getModel().updateNode(item);
|
||||
} catch (InterruptedException | IOException ex) {
|
||||
Logger.getLogger(TagTreeContextMenu.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
|
||||
@@ -139,6 +139,11 @@ public class TagTreeModel implements TreeModel {
|
||||
fireTreeStructureChanged(new TreeModelEvent(this, changedPath));
|
||||
}
|
||||
|
||||
public void updateNode(TreeItem treeItem) {
|
||||
TreePath changedPath = getTreePath(treeItem);
|
||||
fireTreeStructureChanged(new TreeModelEvent(this, changedPath));
|
||||
}
|
||||
|
||||
private void fireTreeNodesRemoved(TreeModelEvent e) {
|
||||
for (TreeModelListener listener : listeners) {
|
||||
listener.treeNodesRemoved(e);
|
||||
@@ -520,7 +525,7 @@ public class TagTreeModel implements TreeModel {
|
||||
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public TreeItem getChild(Object parent, int index) {
|
||||
TreeItem parentNode = (TreeItem) parent;
|
||||
|
||||
Reference in New Issue
Block a user