diff --git a/trunk/src/com/jpexs/decompiler/flash/configuration/Configuration.java b/trunk/src/com/jpexs/decompiler/flash/configuration/Configuration.java index 7b515ae56..b48064d31 100644 --- a/trunk/src/com/jpexs/decompiler/flash/configuration/Configuration.java +++ b/trunk/src/com/jpexs/decompiler/flash/configuration/Configuration.java @@ -65,6 +65,8 @@ public class Configuration { public static final ConfigurationItem offeredAssociation = null; @ConfigurationDefaultBoolean(true) public static final ConfigurationItem removeNops = null; + @ConfigurationDefaultBoolean(false) + public static final ConfigurationItem showHexOnlyButton = null; /** * Debug mode = throwing an error when comparing original file and diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/abc/ASMSourceEditorPane.java b/trunk/src/com/jpexs/decompiler/flash/gui/abc/ASMSourceEditorPane.java index 47c59e692..ab8494bf6 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/abc/ASMSourceEditorPane.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/abc/ASMSourceEditorPane.java @@ -77,16 +77,19 @@ public class ASMSourceEditorPane extends LineMarkedEditorPane implements CaretLi this.exportMode = exportMode; long oldOffset = getSelectedOffset(); if (exportMode == ExportMode.PCODE) { + setContentType("text/flasm"); if (textNoHex == null) { textNoHex = getHilightedText(exportMode); } setText(textNoHex); } else if (exportMode == ExportMode.PCODEWITHHEX) { + setContentType("text/flasm"); if (textWithHex == null) { textWithHex = getHilightedText(exportMode); } setText(textWithHex); } else { + setContentType("text/plain"); if (textHexOnly == null) { HilightedTextWriter writer = new HilightedTextWriter(true); Helper.byteArrayToHex(writer, abc.bodies[bodyIndex].code.getBytes()); diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/abc/MethodCodePanel.java b/trunk/src/com/jpexs/decompiler/flash/gui/abc/MethodCodePanel.java index 024d08117..eb990105e 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/abc/MethodCodePanel.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/abc/MethodCodePanel.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.gui.abc; import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.types.traits.Trait; +import com.jpexs.decompiler.flash.configuration.Configuration; import com.jpexs.decompiler.flash.gui.AppStrings; import com.jpexs.decompiler.flash.gui.Main; import com.jpexs.decompiler.flash.gui.View; @@ -114,6 +115,9 @@ public class MethodCodePanel extends JPanel implements ActionListener { hexOnlyButton.addActionListener(this); hexOnlyButton.setToolTipText(AppStrings.translate("button.viewhex")); hexOnlyButton.setMargin(new Insets(3, 3, 3, 3)); + if (!Configuration.showHexOnlyButton.get()) { + hexOnlyButton.setVisible(false); + } buttonsPanel.add(graphButton); buttonsPanel.add(hexButton); diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/action/ActionPanel.java b/trunk/src/com/jpexs/decompiler/flash/gui/action/ActionPanel.java index dabd5f320..d659ca36e 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/action/ActionPanel.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/action/ActionPanel.java @@ -294,6 +294,7 @@ public class ActionPanel extends JPanel implements ActionListener { public void setHex(ExportMode exportMode) { if (exportMode != ExportMode.HEX) { + editor.setContentType("text/flasm"); if (exportMode == ExportMode.PCODE) { if (srcNoHex == null) { srcNoHex = getHilightedText(exportMode); @@ -306,6 +307,7 @@ public class ActionPanel extends JPanel implements ActionListener { setText(srcWithHex); } } else { + editor.setContentType("text/plain"); if (srcHexOnly == null) { HilightedTextWriter writer = new HilightedTextWriter(true); Helper.byteArrayToHex(writer, src.getActionBytes()); @@ -452,6 +454,9 @@ public class ActionPanel extends JPanel implements ActionListener { hexOnlyButton.addActionListener(this); hexOnlyButton.setToolTipText(AppStrings.translate("button.viewhex")); hexOnlyButton.setMargin(new Insets(3, 3, 3, 3)); + if (!Configuration.showHexOnlyButton.get()) { + hexOnlyButton.setVisible(false); + } topButtonsPan = new JPanel(); topButtonsPan.setLayout(new BoxLayout(topButtonsPan, BoxLayout.X_AXIS)); @@ -623,7 +628,13 @@ public class ActionPanel extends JPanel implements ActionListener { boolean rawEdit = hexOnlyButton.isSelected(); if (val) { - setText(rawEdit ? srcHexOnly : srcNoHex); + if (rawEdit) { + editor.setContentType("text/flasm"); + setText(srcHexOnly); + } else { + editor.setContentType("text/plain"); + setText(srcNoHex); + } editor.setEditable(true); saveButton.setVisible(true); editButton.setVisible(false);