#753 Reload "saved as" swf

This commit is contained in:
2014-12-14 17:21:56 +01:00
parent 60f170dcda
commit fac4df46e5
6 changed files with 50 additions and 43 deletions
+3 -1
View File
@@ -369,8 +369,10 @@ public class Main {
}
public static void saveFile(SWF swf, String outfile, SaveFileMode mode) throws IOException {
if (mode == SaveFileMode.SAVEAS) {
if (mode == SaveFileMode.SAVEAS && !swf.swfList.isBundle) {
swf.file = outfile;
swf.fileTitle = null;
swf.swfList.sourceInfo.setFile(outfile);
}
File outfileF = new File(outfile);
File tmpFile = new File(outfile + ".tmp");
@@ -335,8 +335,9 @@ public class MainFrameClassicMenu implements MainFrameMenu, ActionListener {
}
@Override
public void updateComponents(SWF swf, List<ABCContainerTag> abcList) {
public void updateComponents(SWF swf) {
boolean swfLoaded = swf != null;
List<ABCContainerTag> abcList = swfLoaded ? swf.abcList : null;
boolean hasAbc = swfLoaded && abcList != null && !abcList.isEmpty();
/*saveCommandButton.setEnabled(swfLoaded);
@@ -358,9 +359,8 @@ public class MainFrameClassicMenu implements MainFrameMenu, ActionListener {
private boolean saveAs(SWF swf, SaveFileMode mode) {
if (Main.saveFileDialog(swf, mode)) {
swf.fileTitle = null;
mainFrame.setTitle(ApplicationInfo.applicationVerName + (Configuration.displayFileName.get() ? " - " + swf.getFileTitle() : ""));
saveCommandButton.setEnabled(mainFrame.panel.getCurrentSwf() != null);
updateComponents(mainFrame.panel.getCurrentSwf());
return true;
}
return false;
@@ -1,32 +1,32 @@
/*
* Copyright (C) 2010-2014 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 com.jpexs.decompiler.flash.SWF;
import com.jpexs.decompiler.flash.tags.ABCContainerTag;
import java.util.List;
/**
*
* @author JPEXS
*/
public interface MainFrameMenu {
public boolean isInternalFlashViewerSelected();
public void updateComponents(SWF swf, List<ABCContainerTag> abcList);
}
/*
* Copyright (C) 2010-2014 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 com.jpexs.decompiler.flash.SWF;
import com.jpexs.decompiler.flash.tags.ABCContainerTag;
import java.util.List;
/**
*
* @author JPEXS
*/
public interface MainFrameMenu {
public boolean isInternalFlashViewerSelected();
public void updateComponents(SWF swf);
}
@@ -627,8 +627,9 @@ public class MainFrameRibbonMenu implements MainFrameMenu, ActionListener {
}
@Override
public void updateComponents(SWF swf, List<ABCContainerTag> abcList) {
public void updateComponents(SWF swf) {
boolean swfLoaded = swf != null;
List<ABCContainerTag> abcList = swfLoaded ? swf.abcList : null;
boolean hasAbc = swfLoaded && abcList != null && !abcList.isEmpty();
boolean hasDebugger = hasAbc && Main.hasDebugger(swf);
@@ -668,9 +669,8 @@ public class MainFrameRibbonMenu implements MainFrameMenu, ActionListener {
private boolean saveAs(SWF swf, SaveFileMode mode) {
if (Main.saveFileDialog(swf, mode)) {
swf.fileTitle = null;
mainFrame.setTitle(ApplicationInfo.applicationVerName + (Configuration.displayFileName.get() ? " - " + swf.getFileTitle() : ""));
saveCommandButton.setEnabled(mainFrame.panel.getCurrentSwf() != null);
updateComponents(mainFrame.panel.getCurrentSwf());
return true;
}
return false;
@@ -642,7 +642,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
isWelcomeScreen = false;
}
mainMenu.updateComponents(swf, abcList);
mainMenu.updateComponents(swf);
}
private void updateUi() {
@@ -653,7 +653,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
}
mainFrame.setTitle(ApplicationInfo.applicationVerName);
mainMenu.updateComponents(null, null);
mainMenu.updateComponents(null);
}
public void closeAll() {