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