From addbc66fd6e35b2c92ad514cccaa7fb208eecd18 Mon Sep 17 00:00:00 2001 From: "honfika@gmail.com" Date: Mon, 4 Jan 2016 09:46:21 +0100 Subject: [PATCH] show warning when switching to hex view if swf is modified --- .../decompiler/flash/configuration/Configuration.java | 5 +++++ src/com/jpexs/decompiler/flash/gui/MainFrameMenu.java | 7 ++++++- .../flash/gui/locales/AdvancedSettingsDialog.properties | 5 ++++- .../decompiler/flash/gui/locales/MainFrame.properties | 4 +++- 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/configuration/Configuration.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/configuration/Configuration.java index 311f04381..8308de15c 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/configuration/Configuration.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/configuration/Configuration.java @@ -538,6 +538,11 @@ public class Configuration { @ConfigurationCategory("import") public static final ConfigurationItem warningSvgImport = null; + @ConfigurationDefaultBoolean(true) + @ConfigurationName("warning.hexViewNotUpToDate") + @ConfigurationCategory("import") + public static final ConfigurationItem warningHexViewNotUpToDate = null; + @ConfigurationDefaultBoolean(false) @ConfigurationName("shapeImport.useNonSmoothedFill") @ConfigurationCategory("import") diff --git a/src/com/jpexs/decompiler/flash/gui/MainFrameMenu.java b/src/com/jpexs/decompiler/flash/gui/MainFrameMenu.java index 8ebb55c5f..e583853d8 100644 --- a/src/com/jpexs/decompiler/flash/gui/MainFrameMenu.java +++ b/src/com/jpexs/decompiler/flash/gui/MainFrameMenu.java @@ -1040,7 +1040,12 @@ public abstract class MainFrameMenu implements MenuBuilder { private void viewHexActionPerformed(ActionEvent evt) { Configuration.dumpView.set(true); - mainFrame.getPanel().showView(MainPanel.VIEW_DUMP); + MainPanel mainPanel = mainFrame.getPanel(); + if (mainPanel.isModified()) { + View.showMessageDialog(null, translate("message.warning.hexViewNotUpToDate"), translate("message.warning"), JOptionPane.WARNING_MESSAGE, Configuration.warningHexViewNotUpToDate); + } + + mainPanel.showView(MainPanel.VIEW_DUMP); setGroupSelection("view", "/file/view/viewHex"); setMenuChecked("/tools/timeline", false); } diff --git a/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog.properties b/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog.properties index ead033fd8..3209b9393 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog.properties @@ -413,4 +413,7 @@ config.name.shapeImport.useNonSmoothedFill = Use non-smoothed fill when a shape config.description.shapeImport.useNonSmoothedFill = config.name.internalFlashViewer.execute.as12 = AS1/2 in own flash viewer (Experimental) -config.description.internalFlashViewer.execute.as12 = Try to execute ActionScript 1/2 during SWF playback using FFDec flash viewer \ No newline at end of file +config.description.internalFlashViewer.execute.as12 = Try to execute ActionScript 1/2 during SWF playback using FFDec flash viewer + +config.name.warning.hexViewNotUpToDate = Show Hex View not up-to-date warning +config.description.warning.hexViewNotUpToDate = diff --git a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame.properties b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame.properties index 1b08517d5..4a0907630 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame.properties @@ -704,4 +704,6 @@ button.replaceNoFill = Replace - Update bounds... message.warning.svgImportExperimental = Not all SVG features are supported. Only solid color fill mode is supported. Please check the log after import. message.imported.swf = The SWF file uses assets from an imported SWF file:\n%url%\nDo you want the assets to be loaded from that URL? -message.imported.swf.manually = Cannot load imported SWF\n%url%\nThe file or URL does not exist.\nDo you want to select local file? \ No newline at end of file +message.imported.swf.manually = Cannot load imported SWF\n%url%\nThe file or URL does not exist.\nDo you want to select local file? + +message.warning.hexViewNotUpToDate = Hex View is not up-to-date. Please save and reload the file to update Hex View.