mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-25 04:20:51 +00:00
Added #1290 Export to FlashDevelop project
This commit is contained in:
@@ -452,6 +452,17 @@ public abstract class MainFrameMenu implements MenuBuilder {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void exportFlashDevelopActionPerformed(ActionEvent evt) {
|
||||
if (Main.isWorking()) {
|
||||
return;
|
||||
}
|
||||
if (mainFrame.getPanel().checkEdited()) {
|
||||
return;
|
||||
}
|
||||
|
||||
mainFrame.getPanel().exportFlashDevelopProject((SWF) openable);
|
||||
}
|
||||
|
||||
protected void exportFlaActionPerformed(ActionEvent evt) {
|
||||
if (Main.isWorking()) {
|
||||
@@ -1031,6 +1042,8 @@ public abstract class MainFrameMenu implements MenuBuilder {
|
||||
setMenuEnabled("/file/export/exportAll", openableSelected && !isWorking);
|
||||
setMenuEnabled("_/exportFla", swfSelected && !isWorking);
|
||||
setMenuEnabled("/file/export/exportFla", allSameSwf && openableSelected && !isWorking);
|
||||
setMenuEnabled("_/exportFlashDevelop", swfSelected && !isWorking);
|
||||
setMenuEnabled("/file/export/exportFlashDevelop", allSameSwf && openableSelected && isAs3 && !isWorking);
|
||||
setMenuEnabled("_/exportSelected", openableSelected && !isWorking);
|
||||
setMenuEnabled("/file/export/exportSelected", openableSelected && !isWorking);
|
||||
setMenuEnabled("/file/export/exportXml", swfSelected && !isWorking);
|
||||
@@ -1128,6 +1141,7 @@ public abstract class MainFrameMenu implements MenuBuilder {
|
||||
addMenuItem("_/saveAs", translate("menu.file.saveas"), "saveas32", this::saveAsActionPerformed, PRIORITY_TOP, null, true, null, false);
|
||||
addSeparator("_");
|
||||
addMenuItem("_/exportFla", translate("menu.file.export.fla"), "exportfla32", this::exportFlaActionPerformed, PRIORITY_TOP, null, true, null, false);
|
||||
addMenuItem("_/exportFlashDevelop", translate("menu.file.export.flashDevelop"), "exportflashdevelop32", this::exportFlashDevelopActionPerformed, PRIORITY_TOP, null, true, null, false);
|
||||
addMenuItem("_/exportAll", translate("menu.file.export.all"), "export32", this::exportAllActionPerformed, PRIORITY_TOP, null, true, null, false);
|
||||
addMenuItem("_/exportSelected", translate("menu.file.export.selection"), "exportsel32", this::exportSelectedActionPerformed, PRIORITY_TOP, null, true, null, false);
|
||||
addSeparator("_");
|
||||
@@ -1160,6 +1174,7 @@ public abstract class MainFrameMenu implements MenuBuilder {
|
||||
|
||||
addMenuItem("/file/export", translate("menu.export"), null, null, 0, null, false, null, false);
|
||||
addMenuItem("/file/export/exportFla", translate("menu.file.export.fla"), "exportfla32", this::exportFlaActionPerformed, PRIORITY_TOP, null, true, null, false);
|
||||
addMenuItem("/file/export/exportFlashDevelop", translate("menu.file.export.flashDevelop"), "exportflashdevelop32", this::exportFlashDevelopActionPerformed, PRIORITY_TOP, null, true, null, false);
|
||||
addMenuItem("/file/export/exportXml", translate("menu.file.export.xml"), "exportxml32", this::exportXmlActionPerformed, PRIORITY_MEDIUM, null, true, null, false);
|
||||
addMenuItem("/file/export/exportAll", translate("menu.file.export.all"), "export16", this::exportAllActionPerformed, PRIORITY_MEDIUM, null, true, new HotKey("CTRL+SHIFT+E"), false);
|
||||
addMenuItem("/file/export/exportSelected", translate("menu.file.export.selection"), "exportsel16", this::exportSelectedActionPerformed, PRIORITY_MEDIUM, null, true, null, false);
|
||||
|
||||
@@ -88,6 +88,7 @@ import com.jpexs.decompiler.flash.exporters.settings.SoundExportSettings;
|
||||
import com.jpexs.decompiler.flash.exporters.settings.SpriteExportSettings;
|
||||
import com.jpexs.decompiler.flash.exporters.settings.SymbolClassExportSettings;
|
||||
import com.jpexs.decompiler.flash.exporters.settings.TextExportSettings;
|
||||
import com.jpexs.decompiler.flash.exporters.swf.SwfFlashDevelopExporter;
|
||||
import com.jpexs.decompiler.flash.exporters.swf.SwfJavaExporter;
|
||||
import com.jpexs.decompiler.flash.exporters.swf.SwfXmlExporter;
|
||||
import com.jpexs.decompiler.flash.flexsdk.MxmlcAs3ScriptReplacer;
|
||||
@@ -217,6 +218,7 @@ import com.jpexs.decompiler.flash.types.shaperecords.StraightEdgeRecord;
|
||||
import com.jpexs.decompiler.flash.types.shaperecords.StyleChangeRecord;
|
||||
import com.jpexs.decompiler.flash.types.sound.SoundFormat;
|
||||
import com.jpexs.decompiler.flash.xfl.FLAVersion;
|
||||
import com.jpexs.decompiler.flash.xfl.XFLXmlWriter;
|
||||
import com.jpexs.decompiler.graph.DottedChain;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import com.jpexs.helpers.CancellableWorker;
|
||||
@@ -225,6 +227,7 @@ import com.jpexs.helpers.Path;
|
||||
import com.jpexs.helpers.ProgressListener;
|
||||
import com.jpexs.helpers.Reference;
|
||||
import com.jpexs.helpers.SerializableImage;
|
||||
import com.jpexs.helpers.XmlPrettyFormat;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.CardLayout;
|
||||
import java.awt.Color;
|
||||
@@ -3306,6 +3309,116 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void exportFlashDevelopProject(final SWF swf) {
|
||||
if (swf == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
JFileChooser fc = new JFileChooser();
|
||||
String selDir = Configuration.lastOpenDir.get();
|
||||
fc.setCurrentDirectory(new File(selDir));
|
||||
if (!selDir.endsWith(File.separator)) {
|
||||
selDir += File.separator;
|
||||
}
|
||||
String swfShortName = swf.getShortFileName();
|
||||
if ("".equals(swfShortName)) {
|
||||
swfShortName = "untitled.swf";
|
||||
}
|
||||
String fileName;
|
||||
if (swfShortName.contains(".")) {
|
||||
fileName = swfShortName.substring(0, swfShortName.lastIndexOf(".")) + ".as3proj";
|
||||
} else {
|
||||
fileName = swfShortName + ".as3proj";
|
||||
}
|
||||
|
||||
FileFilter f = new FileFilter() {
|
||||
@Override
|
||||
public boolean accept(File f) {
|
||||
return f.isDirectory() || (f.getName().toLowerCase(Locale.ENGLISH).endsWith(".as3proj"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return translate("filter.as3proj");
|
||||
}
|
||||
};
|
||||
fc.setFileFilter(f);
|
||||
fc.setAcceptAllFileFilterUsed(false);
|
||||
fc.setSelectedFile(new File(selDir + fileName));
|
||||
|
||||
if (fc.showSaveDialog(this) != JFileChooser.APPROVE_OPTION) {
|
||||
return;
|
||||
}
|
||||
|
||||
Configuration.lastOpenDir.set(Helper.fixDialogFile(fc.getSelectedFile()).getParentFile().getAbsolutePath());
|
||||
File sf = Helper.fixDialogFile(fc.getSelectedFile());
|
||||
SwfFlashDevelopExporter exporter = new SwfFlashDevelopExporter();
|
||||
|
||||
String path = sf.getAbsolutePath();
|
||||
if (path.endsWith(".as3proj")) {
|
||||
path = path.substring(0, path.length() - ".as3proj".length());
|
||||
}
|
||||
path += ".as3proj";
|
||||
|
||||
final String fpath = path;
|
||||
|
||||
long timeBefore = System.currentTimeMillis();
|
||||
new CancellableWorker() {
|
||||
@Override
|
||||
protected Void doInBackground() throws Exception {
|
||||
Helper.freeMem();
|
||||
|
||||
CancellableWorker w = this;
|
||||
|
||||
ProgressListener prog = new ProgressListener() {
|
||||
@Override
|
||||
public void progress(int p) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void status(String status) {
|
||||
Main.startWork(translate("work.exporting.flashDevelop") + "..." + status, w);
|
||||
}
|
||||
};
|
||||
EventListener evl = swf.getExportEventListener();
|
||||
try {
|
||||
AbortRetryIgnoreHandler errorHandler = new GuiAbortRetryIgnoreHandler();
|
||||
exporter.exportFlashDevelopProject(swf, new File(fpath), errorHandler, evl);
|
||||
} catch (Exception ex) {
|
||||
logger.log(Level.SEVERE, "FlashDevelop export error", ex);
|
||||
ViewMessages.showMessageDialog(MainPanel.this, translate("error.export") + ": " + ex.getClass().getName() + " " + ex.getLocalizedMessage(), translate("error"), JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
Helper.freeMem();
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
Main.startWork(translate("work.exporting.flashDevelop") + "...", this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void done() {
|
||||
Main.stopWork();
|
||||
long timeAfter = System.currentTimeMillis();
|
||||
final long timeMs = timeAfter - timeBefore;
|
||||
|
||||
View.execInEventDispatch(() -> {
|
||||
setStatus(translate("export.finishedin").replace("%time%", Helper.formatTimeSec(timeMs)));
|
||||
});
|
||||
|
||||
if (Configuration.openFolderAfterFlaExport.get()) {
|
||||
try {
|
||||
Desktop.getDesktop().open(new File(fpath).getAbsoluteFile().getParentFile());
|
||||
} catch (IOException ex) {
|
||||
logger.log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}.execute();
|
||||
}
|
||||
|
||||
public void exportFla(final SWF swf) {
|
||||
if (swf == null) {
|
||||
@@ -3855,6 +3968,8 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void importScript(final Openable openable) {
|
||||
As3ScriptReplacerInterface as3ScriptReplacer = getAs3ScriptReplacer(Main.isSwfAir(openable));
|
||||
if (as3ScriptReplacer == null) {
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 965 B |
Binary file not shown.
|
After Width: | Height: | Size: 1.5 KiB |
@@ -1273,4 +1273,12 @@ tagInfo.idType = Type of the id
|
||||
|
||||
contextmenu.configurePathResolving = Configure path resolving...
|
||||
|
||||
contextmenu.setAsLinkage = Set AS linkage
|
||||
contextmenu.setAsLinkage = Set AS linkage
|
||||
|
||||
contextmenu.exportFlashDevelopProject = Export FlashDevelop project
|
||||
|
||||
filter.as3proj = FlashDevelop AS3 projects (*.as3proj)
|
||||
|
||||
work.exporting.flashDevelop = Exporting FlashDevelop project
|
||||
|
||||
menu.file.export.flashDevelop = Export FD project
|
||||
@@ -1248,4 +1248,13 @@ tagInfo.idType = Typ id
|
||||
|
||||
contextmenu.configurePathResolving = Nastavit resolvov\u00e1n\u00ed cest...
|
||||
|
||||
contextmenu.setAsLinkage = Nastavit AS vazbu
|
||||
contextmenu.setAsLinkage = Nastavit AS vazbu
|
||||
|
||||
|
||||
contextmenu.exportFlashDevelopProject = Exportovat FlashDevelop projekt
|
||||
|
||||
filter.as3proj = FlashDevelop AS3 projekty (*.as3proj)
|
||||
|
||||
work.exporting.flashDevelop = Exportov\u00e1n\u00ed FlashDevelop projektu
|
||||
|
||||
menu.file.export.flashDevelop = Exportovat FD projekt
|
||||
@@ -206,6 +206,8 @@ public class TagTreeContextMenu extends JPopupMenu {
|
||||
private JMenuItem jumpToCharacterMenuItem;
|
||||
|
||||
private JMenuItem exportJavaSourceMenuItem;
|
||||
|
||||
private JMenuItem exportFlashDevelopProjectMenuItem;
|
||||
|
||||
private JMenuItem exportSwfXmlMenuItem;
|
||||
|
||||
@@ -483,6 +485,11 @@ public class TagTreeContextMenu extends JPopupMenu {
|
||||
jumpToCharacterMenuItem.setIcon(View.getIcon("jumpto16"));
|
||||
add(jumpToCharacterMenuItem);
|
||||
|
||||
exportFlashDevelopProjectMenuItem = new JMenuItem(mainPanel.translate("contextmenu.exportFlashDevelopProject"));
|
||||
exportFlashDevelopProjectMenuItem.addActionListener(this::exportFlashDevelopProjectActionPerformed);
|
||||
exportFlashDevelopProjectMenuItem.setIcon(View.getIcon("exportflashdevelop16"));
|
||||
add(exportFlashDevelopProjectMenuItem);
|
||||
|
||||
exportJavaSourceMenuItem = new JMenuItem(mainPanel.translate("contextmenu.exportJavaSource"));
|
||||
exportJavaSourceMenuItem.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
@@ -1158,6 +1165,7 @@ public class TagTreeContextMenu extends JPopupMenu {
|
||||
cleanAbcMenuItem.setVisible(false);
|
||||
rawEditMenuItem.setVisible(false);
|
||||
jumpToCharacterMenuItem.setVisible(false);
|
||||
exportFlashDevelopProjectMenuItem.setVisible(false);
|
||||
exportJavaSourceMenuItem.setVisible(allSelectedIsSwf);
|
||||
exportSwfXmlMenuItem.setVisible(allSelectedIsSwf);
|
||||
|
||||
@@ -1393,6 +1401,13 @@ public class TagTreeContextMenu extends JPopupMenu {
|
||||
collapseRecursiveMenuItem.setVisible(true);
|
||||
}
|
||||
|
||||
if (firstItem instanceof SWF) {
|
||||
SWF swf = (SWF) firstItem;
|
||||
if (swf.isAS3()) {
|
||||
exportFlashDevelopProjectMenuItem.setVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
if (firstItem instanceof HasCharacterId && !(firstItem instanceof CharacterTag)) {
|
||||
jumpToCharacterMenuItem.setVisible(true);
|
||||
}
|
||||
@@ -5405,6 +5420,11 @@ public class TagTreeContextMenu extends JPopupMenu {
|
||||
}
|
||||
}
|
||||
|
||||
public void exportFlashDevelopProjectActionPerformed(ActionEvent evt) {
|
||||
SWF swf = (SWF) getCurrentItem().getOpenable();
|
||||
mainPanel.exportFlashDevelopProject(swf);
|
||||
}
|
||||
|
||||
public void importScriptsActionPerformed(ActionEvent evt) {
|
||||
Openable openable = getCurrentItem().getOpenable();
|
||||
SWF swf = (openable instanceof SWF) ? (SWF) openable : ((ABC) openable).getSwf();
|
||||
|
||||
Reference in New Issue
Block a user