diff --git a/trunk/src/com/jpexs/decompiler/flash/configuration/Configuration.java b/trunk/src/com/jpexs/decompiler/flash/configuration/Configuration.java index 16a0c956f..06117f86a 100644 --- a/trunk/src/com/jpexs/decompiler/flash/configuration/Configuration.java +++ b/trunk/src/com/jpexs/decompiler/flash/configuration/Configuration.java @@ -260,7 +260,7 @@ public class Configuration { public static List getRecentFiles() { String files = recentFiles.get(); - if (files == null) { + if (files == null || files.isEmpty()) { return new ArrayList<>(); } return Arrays.asList(files.split("::")); diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/Main.java b/trunk/src/com/jpexs/decompiler/flash/gui/Main.java index 1b2d983c2..6e896ffb6 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/Main.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/Main.java @@ -462,6 +462,11 @@ public class Main { mainFrame.getPanel().close(swf); } + public static void closeAll() { + sourceInfos.clear(); + mainFrame.getPanel().closeAll(); + } + public static boolean saveFileDialog(SWF swf) { return saveFileDialog(swf, ".swf"); } diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/MainFrameRibbonMenu.java b/trunk/src/com/jpexs/decompiler/flash/gui/MainFrameRibbonMenu.java index c33dee1ff..59a2014a3 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/MainFrameRibbonMenu.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/MainFrameRibbonMenu.java @@ -35,6 +35,7 @@ import java.util.Timer; import java.util.TimerTask; import java.util.logging.Level; import java.util.logging.Logger; +import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JCheckBoxMenuItem; import javax.swing.JOptionPane; @@ -88,6 +89,8 @@ public class MainFrameRibbonMenu implements MainFrameMenu, ActionListener { static final String ACTION_SAVE_AS = "SAVEAS"; static final String ACTION_SAVE_AS_EXE = "SAVEASEXE"; static final String ACTION_OPEN = "OPEN"; + static final String ACTION_CLOSE = "CLOSE"; + static final String ACTION_CLOSE_ALL = "CLOSEALL"; static final String ACTION_EXPORT_FLA = "EXPORTFLA"; public static final String ACTION_EXPORT_SEL = "EXPORTSEL"; static final String ACTION_EXPORT = "EXPORT"; @@ -101,6 +104,7 @@ public class MainFrameRibbonMenu implements MainFrameMenu, ActionListener { static final String ACTION_DEOBFUSCATE_ALL = "DEOBFUSCATEALL"; static final String ACTION_REMOVE_NON_SCRIPTS = "REMOVENONSCRIPTS"; static final String ACTION_REFRESH_DECOMPILED = "REFRESHDECOMPILED"; + static final String ACTION_CLEAR_RECENT_FILES = "CLEARRECENTFILES"; private MainFrameRibbon mainFrame; @@ -125,10 +129,13 @@ public class MainFrameRibbonMenu implements MainFrameMenu, ActionListener { private JCommandButton deobfuscationCommandButton; private JCommandButton searchCommandButton; private JCommandButton gotoDocumentClassCommandButton; + private JCommandButton clearRecentFilesCommandButton; RibbonApplicationMenuEntryPrimary exportFlaMenu; RibbonApplicationMenuEntryPrimary exportAllMenu; RibbonApplicationMenuEntryPrimary exportSelMenu; + RibbonApplicationMenuEntryPrimary closeFileMenu; + RibbonApplicationMenuEntryPrimary closeAllFilesMenu; public MainFrameRibbonMenu(MainFrameRibbon mainFrame, JRibbon ribbon, boolean externalFlashPlayerUnavailable) { this.mainFrame = mainFrame; @@ -181,6 +188,8 @@ public class MainFrameRibbonMenu implements MainFrameMenu, ActionListener { RibbonApplicationMenuEntryPrimary checkUpdatesMenu = new RibbonApplicationMenuEntryPrimary(View.getResizableIcon("update32"), translate("menu.help.checkupdates"), new ActionRedirector(this, ACTION_CHECK_UPDATES), JCommandButton.CommandButtonKind.ACTION_ONLY); RibbonApplicationMenuEntryPrimary aboutMenu = new RibbonApplicationMenuEntryPrimary(View.getResizableIcon("about32"), translate("menu.help.about"), new ActionRedirector(this, ACTION_ABOUT), JCommandButton.CommandButtonKind.ACTION_ONLY); RibbonApplicationMenuEntryPrimary openFileMenu = new RibbonApplicationMenuEntryPrimary(View.getResizableIcon("open32"), translate("menu.file.open"), new ActionRedirector(this, ACTION_OPEN), JCommandButton.CommandButtonKind.ACTION_AND_POPUP_MAIN_ACTION); + closeFileMenu = new RibbonApplicationMenuEntryPrimary(View.getResizableIcon("close32"), translate("menu.file.close"), new ActionRedirector(this, ACTION_CLOSE), JCommandButton.CommandButtonKind.ACTION_ONLY); + closeAllFilesMenu = new RibbonApplicationMenuEntryPrimary(View.getResizableIcon("close32"), translate("menu.file.closeAll"), new ActionRedirector(this, ACTION_CLOSE_ALL), JCommandButton.CommandButtonKind.ACTION_ONLY); openFileMenu.setRolloverCallback(new RibbonApplicationMenuEntryPrimary.PrimaryRolloverCallback() { @Override public void menuEntryActivated(JPanel targetPanel) { @@ -219,6 +228,8 @@ public class MainFrameRibbonMenu implements MainFrameMenu, ActionListener { RibbonApplicationMenuEntryFooter exitMenu = new RibbonApplicationMenuEntryFooter(View.getResizableIcon("exit32"), translate("menu.file.exit"), new ActionRedirector(this, "EXIT")); mainMenu.addMenuEntry(openFileMenu); + mainMenu.addMenuEntry(closeFileMenu); + mainMenu.addMenuEntry(closeAllFilesMenu); mainMenu.addMenuSeparator(); mainMenu.addMenuEntry(exportFlaMenu); mainMenu.addMenuEntry(exportAllMenu); @@ -334,7 +345,15 @@ public class MainFrameRibbonMenu implements MainFrameMenu, ActionListener { deobfuscationBand.addCommandButton(globalrenameCommandButton, RibbonElementPriority.MEDIUM); deobfuscationBand.addCommandButton(renameinvalidCommandButton, RibbonElementPriority.MEDIUM); - return new RibbonTask(translate("menu.tools"), toolsBand, deobfuscationBand); + JRibbonBand otherToolsBand = new JRibbonBand(translate("menu.tools.otherTools"), null); + otherToolsBand.setResizePolicies(getResizePolicies(otherToolsBand)); + + clearRecentFilesCommandButton = new JCommandButton(fixCommandTitle(translate("menu.tools.otherTools.clearRecentFiles")), View.getResizableIcon("deobfuscate32")); + assignListener(clearRecentFilesCommandButton, ACTION_CLEAR_RECENT_FILES); + + otherToolsBand.addCommandButton(clearRecentFilesCommandButton, RibbonElementPriority.MEDIUM); + + return new RibbonTask(translate("menu.tools"), toolsBand, deobfuscationBand, otherToolsBand); } private RibbonTask createSettingsRibbonTask(boolean externalFlashPlayerUnavailable) { @@ -461,6 +480,8 @@ public class MainFrameRibbonMenu implements MainFrameMenu, ActionListener { exportAllMenu.setEnabled(swfLoaded); exportFlaMenu.setEnabled(swfLoaded); exportSelMenu.setEnabled(swfLoaded); + closeFileMenu.setEnabled(swfLoaded); + closeAllFilesMenu.setEnabled(swfLoaded); saveCommandButton.setEnabled(swfLoaded); saveasCommandButton.setEnabled(swfLoaded); @@ -562,6 +583,9 @@ public class MainFrameRibbonMenu implements MainFrameMenu, ActionListener { miAutoDeobfuscation.setSelected(!miAutoDeobfuscation.isSelected()); } break; + case ACTION_CLEAR_RECENT_FILES: + Configuration.recentFiles.set(null); + break; case ACTION_EXIT: mainFrame.panel.setVisible(false); if (Main.proxyFrame != null) { @@ -622,6 +646,12 @@ public class MainFrameRibbonMenu implements MainFrameMenu, ActionListener { case ACTION_OPEN: Main.openFileDialog(); break; + case ACTION_CLOSE: + Main.closeFile(mainFrame.panel.getCurrentSwf()); + break; + case ACTION_CLOSE_ALL: + Main.closeAll(); + break; case ACTION_EXPORT_FLA: mainFrame.panel.exportFla(mainFrame.panel.getCurrentSwf()); break; diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/graphics/close16.png b/trunk/src/com/jpexs/decompiler/flash/gui/graphics/close16.png new file mode 100644 index 000000000..ace289edd Binary files /dev/null and b/trunk/src/com/jpexs/decompiler/flash/gui/graphics/close16.png differ diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/graphics/close32.png b/trunk/src/com/jpexs/decompiler/flash/gui/graphics/close32.png new file mode 100644 index 000000000..30a45b821 Binary files /dev/null and b/trunk/src/com/jpexs/decompiler/flash/gui/graphics/close32.png differ diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/locales/MainFrame.properties b/trunk/src/com/jpexs/decompiler/flash/gui/locales/MainFrame.properties index 292f22500..f6acaffbe 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/locales/MainFrame.properties +++ b/trunk/src/com/jpexs/decompiler/flash/gui/locales/MainFrame.properties @@ -386,3 +386,9 @@ filter.exe = Executable files (*.exe) #after version 1.8.0 font.updateTexts = Update texts + +#after version 1.8.0u1 +menu.file.close = Close +menu.file.closeAll = Close all +menu.tools.otherTools = Other +menu.tools.otherTools.clearRecentFiles = Clear recent files diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_hu.properties b/trunk/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_hu.properties index 629102688..71a9bec1f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_hu.properties +++ b/trunk/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_hu.properties @@ -386,3 +386,9 @@ filter.exe = Futtathat\u00f3 f\u00e1jlok (*.exe) #after version 1.8.0 font.updateTexts = Sz\u00f6vegek friss\u00edt\u00e9se + +#after version 1.8.0u1 +menu.file.close = Bez\u00e1r\u00e1s +menu.file.closeAll = Minden bez\u00e1r\u00e1sa +menu.tools.otherTools = Egy\u00e9b +menu.tools.otherTools.clearRecentFiles = El\u0151zm\u00e9nyek t\u00f6rl\u00e9se