mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-24 23:00:46 +00:00
Added: #2526 Option to disable drag & drop from Resources view to avoid problems on Mac OS
This commit is contained in:
@@ -39,6 +39,7 @@ All notable changes to this project will be documented in this file.
|
|||||||
- view tagIDTagLength field parts
|
- view tagIDTagLength field parts
|
||||||
- show type after colon, not in parenthesis
|
- show type after colon, not in parenthesis
|
||||||
- view bytes length in bytes fields
|
- view bytes length in bytes fields
|
||||||
|
- [#2526] Option to disable drag & drop from Resources view to avoid problems on Mac OS
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- [#2474] Gotos incorrectly decompiled
|
- [#2474] Gotos incorrectly decompiled
|
||||||
@@ -3991,6 +3992,7 @@ Major version of SWF to XML export changed to 2.
|
|||||||
[#2499]: https://www.free-decompiler.com/flash/issues/2499
|
[#2499]: https://www.free-decompiler.com/flash/issues/2499
|
||||||
[#2504]: https://www.free-decompiler.com/flash/issues/2504
|
[#2504]: https://www.free-decompiler.com/flash/issues/2504
|
||||||
[#2519]: https://www.free-decompiler.com/flash/issues/2519
|
[#2519]: https://www.free-decompiler.com/flash/issues/2519
|
||||||
|
[#2526]: https://www.free-decompiler.com/flash/issues/2526
|
||||||
[#2474]: https://www.free-decompiler.com/flash/issues/2474
|
[#2474]: https://www.free-decompiler.com/flash/issues/2474
|
||||||
[#2480]: https://www.free-decompiler.com/flash/issues/2480
|
[#2480]: https://www.free-decompiler.com/flash/issues/2480
|
||||||
[#2338]: https://www.free-decompiler.com/flash/issues/2338
|
[#2338]: https://www.free-decompiler.com/flash/issues/2338
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
*/
|
*/
|
||||||
package com.jpexs.decompiler.flash.configuration;
|
package com.jpexs.decompiler.flash.configuration;
|
||||||
|
|
||||||
import com.jpexs.decompiler.flash.ApplicationInfo;
|
|
||||||
import com.jpexs.decompiler.flash.SWF;
|
import com.jpexs.decompiler.flash.SWF;
|
||||||
import com.jpexs.decompiler.flash.configuration.enums.GridSnapAccuracy;
|
import com.jpexs.decompiler.flash.configuration.enums.GridSnapAccuracy;
|
||||||
import com.jpexs.decompiler.flash.configuration.enums.GuidesSnapAccuracy;
|
import com.jpexs.decompiler.flash.configuration.enums.GuidesSnapAccuracy;
|
||||||
@@ -1163,6 +1162,10 @@ public final class Configuration {
|
|||||||
@ConfigurationCategory("script")
|
@ConfigurationCategory("script")
|
||||||
public static ConfigurationItem<Boolean> showVarsWithDontEnumerateFlag = null;
|
public static ConfigurationItem<Boolean> showVarsWithDontEnumerateFlag = null;
|
||||||
|
|
||||||
|
@ConfigurationDefaultBoolean(true)
|
||||||
|
@ConfigurationCategory("ui")
|
||||||
|
public static ConfigurationItem<Boolean> allowDragAndDropFromResourcesTree = null;
|
||||||
|
|
||||||
private static Map<String, String> configurationDescriptions = new LinkedHashMap<>();
|
private static Map<String, String> configurationDescriptions = new LinkedHashMap<>();
|
||||||
private static Map<String, String> configurationTitles = new LinkedHashMap<>();
|
private static Map<String, String> configurationTitles = new LinkedHashMap<>();
|
||||||
|
|
||||||
|
|||||||
@@ -1030,7 +1030,7 @@ public class Main {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
lastTimeStartWork = nowTime;
|
lastTimeStartWork = nowTime;
|
||||||
View.execInEventDispatch(() -> {
|
View.execInEventDispatchLater(() -> {
|
||||||
if (mainFrame != null) {
|
if (mainFrame != null) {
|
||||||
mainFrame.getPanel().setWorkStatus(name, worker);
|
mainFrame.getPanel().setWorkStatus(name, worker);
|
||||||
if (percent == -1) {
|
if (percent == -1) {
|
||||||
@@ -1043,10 +1043,10 @@ public class Main {
|
|||||||
loadingDialog.setDetail(name);
|
loadingDialog.setDetail(name);
|
||||||
loadingDialog.setPercent(percent);
|
loadingDialog.setPercent(percent);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
if (CommandLineArgumentParser.isCommandLineMode()) {
|
if (CommandLineArgumentParser.isCommandLineMode()) {
|
||||||
System.out.println(name);
|
System.out.println(name);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void stopWork() {
|
public static void stopWork() {
|
||||||
|
|||||||
@@ -228,11 +228,14 @@ import java.awt.dnd.DnDConstants;
|
|||||||
import java.awt.dnd.DragGestureEvent;
|
import java.awt.dnd.DragGestureEvent;
|
||||||
import java.awt.dnd.DragGestureListener;
|
import java.awt.dnd.DragGestureListener;
|
||||||
import java.awt.dnd.DragSource;
|
import java.awt.dnd.DragSource;
|
||||||
|
import java.awt.dnd.DragSourceAdapter;
|
||||||
import java.awt.dnd.DragSourceDragEvent;
|
import java.awt.dnd.DragSourceDragEvent;
|
||||||
import java.awt.dnd.DragSourceDropEvent;
|
import java.awt.dnd.DragSourceDropEvent;
|
||||||
import java.awt.dnd.DragSourceEvent;
|
import java.awt.dnd.DragSourceEvent;
|
||||||
import java.awt.dnd.DragSourceListener;
|
import java.awt.dnd.DragSourceListener;
|
||||||
import java.awt.dnd.DropTarget;
|
import java.awt.dnd.DropTarget;
|
||||||
|
import java.awt.dnd.DropTargetAdapter;
|
||||||
|
import java.awt.dnd.DropTargetDragEvent;
|
||||||
import java.awt.dnd.DropTargetDropEvent;
|
import java.awt.dnd.DropTargetDropEvent;
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import java.awt.event.ActionListener;
|
import java.awt.event.ActionListener;
|
||||||
@@ -273,6 +276,7 @@ import javax.swing.Box;
|
|||||||
import javax.swing.BoxLayout;
|
import javax.swing.BoxLayout;
|
||||||
import javax.swing.Icon;
|
import javax.swing.Icon;
|
||||||
import javax.swing.JColorChooser;
|
import javax.swing.JColorChooser;
|
||||||
|
import javax.swing.JComponent;
|
||||||
import javax.swing.JFileChooser;
|
import javax.swing.JFileChooser;
|
||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
import javax.swing.JOptionPane;
|
import javax.swing.JOptionPane;
|
||||||
@@ -284,6 +288,7 @@ import javax.swing.JSplitPane;
|
|||||||
import javax.swing.JTabbedPane;
|
import javax.swing.JTabbedPane;
|
||||||
import javax.swing.JTree;
|
import javax.swing.JTree;
|
||||||
import javax.swing.SwingConstants;
|
import javax.swing.SwingConstants;
|
||||||
|
import javax.swing.TransferHandler;
|
||||||
import javax.swing.UIManager;
|
import javax.swing.UIManager;
|
||||||
import javax.swing.event.ChangeEvent;
|
import javax.swing.event.ChangeEvent;
|
||||||
import javax.swing.event.ChangeListener;
|
import javax.swing.event.ChangeListener;
|
||||||
@@ -443,6 +448,8 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
|||||||
|
|
||||||
private boolean loadingScrollPosEnabled = true;
|
private boolean loadingScrollPosEnabled = true;
|
||||||
|
|
||||||
|
private static final DataFlavor TREE_FILE_FLAVOR = new DataFlavor(TreeFileFlavor.class, "TreeFile");
|
||||||
|
|
||||||
public synchronized void setLoadingScrollPosEnabled(boolean loadingScrollPosEnabled) {
|
public synchronized void setLoadingScrollPosEnabled(boolean loadingScrollPosEnabled) {
|
||||||
this.loadingScrollPosEnabled = loadingScrollPosEnabled;
|
this.loadingScrollPosEnabled = loadingScrollPosEnabled;
|
||||||
}
|
}
|
||||||
@@ -834,6 +841,10 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
|||||||
|| previewPanel.isEditing() || headerPanel.isEditing();
|
|| previewPanel.isEditing() || headerPanel.isEditing();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class TreeFileFlavor {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private class MyTreeSelectionModel extends DefaultTreeSelectionModel {
|
private class MyTreeSelectionModel extends DefaultTreeSelectionModel {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -1152,20 +1163,31 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
|||||||
dragSource.createDefaultDragGestureRecognizer(tagTree, DnDConstants.ACTION_COPY_OR_MOVE, new DragGestureListener() {
|
dragSource.createDefaultDragGestureRecognizer(tagTree, DnDConstants.ACTION_COPY_OR_MOVE, new DragGestureListener() {
|
||||||
@Override
|
@Override
|
||||||
public void dragGestureRecognized(DragGestureEvent dge) {
|
public void dragGestureRecognized(DragGestureEvent dge) {
|
||||||
|
if (!Configuration.allowDragAndDropFromResourcesTree.get()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
dge.startDrag(DragSource.DefaultCopyDrop, new Transferable() {
|
dge.startDrag(DragSource.DefaultCopyDrop, new Transferable() {
|
||||||
|
|
||||||
|
private List<File> cachedFiles = null;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DataFlavor[] getTransferDataFlavors() {
|
public DataFlavor[] getTransferDataFlavors() {
|
||||||
return new DataFlavor[]{DataFlavor.javaFileListFlavor};
|
return new DataFlavor[]{TREE_FILE_FLAVOR, DataFlavor.javaFileListFlavor};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isDataFlavorSupported(DataFlavor flavor) {
|
public boolean isDataFlavorSupported(DataFlavor flavor) {
|
||||||
return flavor.equals(DataFlavor.javaFileListFlavor);
|
return flavor.equals(TREE_FILE_FLAVOR) || flavor.equals(DataFlavor.javaFileListFlavor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException {
|
public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException {
|
||||||
if (flavor.equals(DataFlavor.javaFileListFlavor)) {
|
if (flavor.equals(DataFlavor.javaFileListFlavor)) {
|
||||||
|
if (cachedFiles != null) {
|
||||||
|
Main.stopWork();
|
||||||
|
return cachedFiles;
|
||||||
|
}
|
||||||
|
|
||||||
List<File> files;
|
List<File> files;
|
||||||
String tempDir = System.getProperty("java.io.tmpdir");
|
String tempDir = System.getProperty("java.io.tmpdir");
|
||||||
if (!tempDir.endsWith(File.separator)) {
|
if (!tempDir.endsWith(File.separator)) {
|
||||||
@@ -1183,6 +1205,9 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
|||||||
} catch (InterruptedException ex) {
|
} catch (InterruptedException ex) {
|
||||||
logger.log(Level.SEVERE, null, ex);
|
logger.log(Level.SEVERE, null, ex);
|
||||||
return null;
|
return null;
|
||||||
|
} catch (Throwable t) {
|
||||||
|
logger.log(Level.SEVERE, null, t);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
files.clear();
|
files.clear();
|
||||||
@@ -1196,34 +1221,14 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
|||||||
f.deleteOnExit();
|
f.deleteOnExit();
|
||||||
}
|
}
|
||||||
new File(tempDir).deleteOnExit();
|
new File(tempDir).deleteOnExit();
|
||||||
return files;
|
cachedFiles = files;
|
||||||
|
|
||||||
|
return cachedFiles;
|
||||||
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}, new DragSourceListener() {
|
}, new DragSourceAdapter() {});
|
||||||
@Override
|
|
||||||
public void dragEnter(DragSourceDragEvent dsde) {
|
|
||||||
enableDrop(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void dragOver(DragSourceDragEvent dsde) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void dropActionChanged(DragSourceDragEvent dsde) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void dragExit(DragSourceEvent dse) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void dragDropEnd(DragSourceDropEvent dsde) {
|
|
||||||
enableDrop(true);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -1411,7 +1416,53 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
|||||||
});
|
});
|
||||||
|
|
||||||
//Opening files with drag&drop to main window
|
//Opening files with drag&drop to main window
|
||||||
enableDrop(true);
|
new DropTarget(this, new DropTargetAdapter() {
|
||||||
|
@Override
|
||||||
|
public void dragEnter(DropTargetDragEvent dtde) {
|
||||||
|
if (dtde.isDataFlavorSupported(TREE_FILE_FLAVOR)
|
||||||
|
|| !dtde.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) {
|
||||||
|
dtde.rejectDrag();
|
||||||
|
} else {
|
||||||
|
dtde.acceptDrag(DnDConstants.ACTION_COPY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dragOver(DropTargetDragEvent dtde) {
|
||||||
|
if (dtde.isDataFlavorSupported(TREE_FILE_FLAVOR)
|
||||||
|
|| !dtde.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) {
|
||||||
|
dtde.rejectDrag();
|
||||||
|
} else {
|
||||||
|
dtde.acceptDrag(DnDConstants.ACTION_COPY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drop(DropTargetDropEvent dtde) {
|
||||||
|
if (dtde.isDataFlavorSupported(TREE_FILE_FLAVOR)
|
||||||
|
|| !dtde.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) {
|
||||||
|
dtde.rejectDrop();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
dtde.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
List<File> droppedFiles = (List<File>) dtde.getTransferable().getTransferData(DataFlavor.javaFileListFlavor);
|
||||||
|
if (droppedFiles != null && !droppedFiles.isEmpty()) {
|
||||||
|
OpenableSourceInfo[] sourceInfos = new OpenableSourceInfo[droppedFiles.size()];
|
||||||
|
for (int i = 0; i < droppedFiles.size(); i++) {
|
||||||
|
sourceInfos[i] = new OpenableSourceInfo(null, droppedFiles.get(i).getAbsolutePath(), null);
|
||||||
|
}
|
||||||
|
Main.openFile(sourceInfos, null, true);
|
||||||
|
dtde.dropComplete(true);
|
||||||
|
}
|
||||||
|
} catch (UnsupportedFlavorException | IOException ex) {
|
||||||
|
dtde.dropComplete(false);
|
||||||
|
//ignored
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
calculateMissingNeededThread = new CalculateMissingNeededThread();
|
calculateMissingNeededThread = new CalculateMissingNeededThread();
|
||||||
calculateMissingNeededThread.start();
|
calculateMissingNeededThread.start();
|
||||||
pinsPanel.load();
|
pinsPanel.load();
|
||||||
@@ -1886,31 +1937,6 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void enableDrop(boolean value) {
|
|
||||||
if (value) {
|
|
||||||
setDropTarget(new DropTarget() {
|
|
||||||
@Override
|
|
||||||
public synchronized void drop(DropTargetDropEvent dtde) {
|
|
||||||
try {
|
|
||||||
dtde.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
List<File> droppedFiles = (List<File>) dtde.getTransferable().getTransferData(DataFlavor.javaFileListFlavor);
|
|
||||||
if (droppedFiles != null && !droppedFiles.isEmpty()) {
|
|
||||||
OpenableSourceInfo[] sourceInfos = new OpenableSourceInfo[droppedFiles.size()];
|
|
||||||
for (int i = 0; i < droppedFiles.size(); i++) {
|
|
||||||
sourceInfos[i] = new OpenableSourceInfo(null, droppedFiles.get(i).getAbsolutePath(), null);
|
|
||||||
}
|
|
||||||
Main.openFile(sourceInfos, null, true);
|
|
||||||
}
|
|
||||||
} catch (UnsupportedFlavorException | IOException ex) {
|
|
||||||
//ignored
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
setDropTarget(null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void updateClassesList() {
|
public void updateClassesList() {
|
||||||
String selectionPath = getCurrentTree().getSelectionPathString();
|
String selectionPath = getCurrentTree().getSelectionPathString();
|
||||||
@@ -6778,7 +6804,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
|||||||
if (calculateMissingNeededThread != null) {
|
if (calculateMissingNeededThread != null) {
|
||||||
calculateMissingNeededThread.interrupt();
|
calculateMissingNeededThread.interrupt();
|
||||||
}
|
}
|
||||||
setDropTarget(null);
|
//setDropTarget(null);
|
||||||
disposeInner(this);
|
disposeInner(this);
|
||||||
Helper.emptyObject(this);
|
Helper.emptyObject(this);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -639,3 +639,6 @@ config.description.autoDeobfuscateIdentifiers = Obfuscated names that are not va
|
|||||||
|
|
||||||
config.name.showVarsWithDontEnumerateFlag = Debugger - show vars with DontEnumerate flag
|
config.name.showVarsWithDontEnumerateFlag = Debugger - show vars with DontEnumerate flag
|
||||||
config.description.showVarsWithDontEnumerateFlag = While debugging ActionScript, show also variables with special DontEnumerate flag, which are internal to flash. It is recommended to hide them as they are usually not relevant.
|
config.description.showVarsWithDontEnumerateFlag = While debugging ActionScript, show also variables with special DontEnumerate flag, which are internal to flash. It is recommended to hide them as they are usually not relevant.
|
||||||
|
|
||||||
|
config.name.allowDragAndDropFromResourcesTree = Allow drag and drop from resources view tree
|
||||||
|
config.description.allowDragAndDropFromResourcesTree = Enable drag and drop items from tree of resources view to export them. On Mac OS, drag out is annoying as it requires all files to be exported before drag starts. Set this to false to avoid accidentally dragging and freezing the application.
|
||||||
|
|||||||
@@ -639,3 +639,6 @@ config.description.autoDeobfuscateIdentifiers = Obfuskovan\u00e9 n\u00e1zvy kter
|
|||||||
|
|
||||||
config.name.showVarsWithDontEnumerateFlag = Lad\u011bn\u00ed - zobrazit prom\u011bnn\u00e9 s p\u0159\u00edznakem DontEnumerate
|
config.name.showVarsWithDontEnumerateFlag = Lad\u011bn\u00ed - zobrazit prom\u011bnn\u00e9 s p\u0159\u00edznakem DontEnumerate
|
||||||
config.description.showVarsWithDontEnumerateFlag = B\u011bhem lad\u011bn\u00ed ActionScriptu zobrazit tak\u00e9 prom\u011bnn\u00e9 se speci\u00e1ln\u00edm p\u0159\u00edznakem DontEnumerate, kter\u00fd je intern\u00ed pro flash. Je doporu\u010deno tyto polo\u017eky skr\u00fdt, jeliko\u017e jsou obvykle nerelevantn\u00ed.
|
config.description.showVarsWithDontEnumerateFlag = B\u011bhem lad\u011bn\u00ed ActionScriptu zobrazit tak\u00e9 prom\u011bnn\u00e9 se speci\u00e1ln\u00edm p\u0159\u00edznakem DontEnumerate, kter\u00fd je intern\u00ed pro flash. Je doporu\u010deno tyto polo\u017eky skr\u00fdt, jeliko\u017e jsou obvykle nerelevantn\u00ed.
|
||||||
|
|
||||||
|
config.name.allowDragAndDropFromResourcesTree = Povolit drag and drop ze stromu zobrazen\u00ed Zdroj\u016f
|
||||||
|
config.description.allowDragAndDropFromResourcesTree = Povolit drag and drop polo\u017eek ze stromu v zobrazen\u00ed zdroj\u016f pro jejich export. Na Mac OS je ta\u017een\u00ed nep\u0159\u00edjemn\u00e9, jeliko\u017e vy\u017eaduje m\u00edt v\u0161echny soubory exportovan\u00e9 p\u0159edem ne\u017e ta\u017een\u00ed za\u010dne. Vypn\u011bte toto tedy pro zabr\u00e1n\u011bn\u00ed ta\u017een\u00ed omylem a zamrznut\u00ed aplikace.
|
||||||
|
|||||||
Reference in New Issue
Block a user