editor panes: hexonly button is disabled by default (new icon needed)

This commit is contained in:
Honfika
2013-11-10 19:22:22 +01:00
parent 81b597f388
commit 82ab797b5f
4 changed files with 21 additions and 1 deletions

View File

@@ -65,6 +65,8 @@ public class Configuration {
public static final ConfigurationItem<Boolean> offeredAssociation = null;
@ConfigurationDefaultBoolean(true)
public static final ConfigurationItem<Boolean> removeNops = null;
@ConfigurationDefaultBoolean(false)
public static final ConfigurationItem<Boolean> showHexOnlyButton = null;
/**
* Debug mode = throwing an error when comparing original file and

View File

@@ -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());

View File

@@ -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);

View File

@@ -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);