Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ Decoder Improved.

#### An Improved Hex Editor

Decoder Improved comes bundled with the Delta Hexadecimal Editor, a
swing Hex Editor, developed by the [ExBin](http://www.exbin.org/)
project. Delta provides an improved hex editing experience over the
Decoder Improved comes bundled with the BinEd Hexadecimal Editor, a
swing Hex Editor, developed by the [ExBin](http://bined.exbin.org/)
project. BinEd provides an improved hex editing experience over the
built-in decoder's hex editor by allowing easy insertion and removal,
highlighting, and Unicode support.

Expand Down
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ repositories {
}

dependencies {
compile group: 'org.exbin.deltahex', name: 'deltahex-core', version: '0.1.3'
compile group: 'org.exbin.deltahex', name: 'deltahex-swing', version: '0.1.3'
compile group: 'org.exbin.utils', name: 'exbin-binary_data', version: '0.1.3-20171017.212506-7'
compile group: 'org.exbin.bined', name: 'bined-swing-extended', version: '0.2.0'
compile group: 'org.exbin.bined', name: 'bined-highlight-swing', version: '0.2.0'
compile group: 'org.exbin.auxiliary', name: 'paged_data', version: '0.2.0'
compile group: 'org.bouncycastle', name: 'bcprov-jdk15on', version: '1.54'
compile group: 'javax.xml.bind', name: 'jaxb-api', version: '2.3.1'
compile 'org.jsoup:jsoup:1.12.1'
Expand Down
Binary file removed lib/deltahex-core-0.1.3.jar
Binary file not shown.
Binary file removed lib/deltahex-swing-0.1.3.jar
Binary file not shown.
Binary file removed lib/exbin-binary_data-0.1.3-20171017.212506-7.jar
Binary file not shown.
3 changes: 1 addition & 2 deletions src/main/trust/nccgroup/decoderimproved/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@
import java.nio.charset.CharsetDecoder;
import java.nio.charset.CodingErrorAction;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import org.exbin.utils.binary_data.BinaryData;
import org.exbin.auxiliary.paged_data.BinaryData;


/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package trust.nccgroup.decoderimproved.components;

import org.exbin.deltahex.CodeType;
import org.exbin.deltahex.DataChangedListener;
import org.exbin.deltahex.SelectionRange;
import org.exbin.deltahex.swing.CodeArea;
import org.exbin.utils.binary_data.ByteArrayEditableData;
import org.exbin.bined.CodeType;
import org.exbin.bined.DataChangedListener;
import org.exbin.bined.SelectionRange;
import org.exbin.bined.swing.extended.ExtCodeArea;
import org.exbin.auxiliary.paged_data.ByteArrayEditableData;
import trust.nccgroup.decoderimproved.CONSTANTS;
import trust.nccgroup.decoderimproved.Logger;
import trust.nccgroup.decoderimproved.ModificationModeManager;
Expand All @@ -25,6 +25,8 @@
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.List;
import org.exbin.bined.RowWrappingMode;
import org.exbin.bined.highlight.swing.extended.ExtendedHighlightNonAsciiCodeAreaPainter;

public class DecoderSegment extends JPanel {
private DecoderTab decoderTab;
Expand Down Expand Up @@ -54,7 +56,7 @@ public class DecoderSegment extends JPanel {
private JScrollPane editorPanel;
private JScrollPane hexPanel;
private JTextArea textEditor;
private CodeArea hexEditor;
private ExtCodeArea hexEditor;


// This handles all the modes
Expand Down Expand Up @@ -89,7 +91,7 @@ void updateEditors(DecoderSegmentState dsState) {
lockDocumentEvents = true;
textEditor.setText(dsState.getDisplayString());
textEditor.setEditable(true);
hexEditor.setData(new ByteArrayEditableData(dsState.getByteArray()));
hexEditor.setContentData(new ByteArrayEditableData(dsState.getByteArray()));
lockDocumentEvents = false;
}

Expand Down Expand Up @@ -177,7 +179,8 @@ private void setupComponents() {

// Theses are the drop down labels

hexEditor = new CodeArea();
hexEditor = new ExtCodeArea();
hexEditor.setPainter(new ExtendedHighlightNonAsciiCodeAreaPainter(hexEditor));

// "this" is the decoder segment
this.setMaximumSize(new Dimension(3000, CONSTANTS.SEGMENT_HEIGHT));
Expand Down Expand Up @@ -360,7 +363,7 @@ private void setupComponents() {
@Override
public void dataChanged() {
if (!lockDocumentEvents) {
dsState.setByteArrayList(Utils.convertHexDataToByteArray(hexEditor.getData()));
dsState.setByteArrayList(Utils.convertHexDataToByteArray(hexEditor.getContentData()));
decoderTab.updateDecoderSegments(getSegmentIndex(), false);
}
}
Expand Down Expand Up @@ -442,7 +445,7 @@ private static class MenuHandler {

private static final String NEW_TAB_ACTION_NAME = "Send to new tab";

private static JPopupMenu createHexEditorPopupMenu(final CodeArea codeArea, final DecoderSegment decoderSegment) {
private static JPopupMenu createHexEditorPopupMenu(final ExtCodeArea codeArea, final DecoderSegment decoderSegment) {
JPopupMenu popupMenu = new JPopupMenu();

// Undo popup menu item
Expand Down Expand Up @@ -489,11 +492,21 @@ public void actionPerformed(ActionEvent e) {

JMenu viewMenu = new JMenu("View");

final JCheckBoxMenuItem highlightNonAsciiMenuItem = new JCheckBoxMenuItem("Highlight Non-ASCII");
highlightNonAsciiMenuItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
ExtendedHighlightNonAsciiCodeAreaPainter painter = ((ExtendedHighlightNonAsciiCodeAreaPainter) codeArea.getPainter());
painter.setNonAsciiHighlightingEnabled(!painter.isNonAsciiHighlightingEnabled());
}
});
viewMenu.add(highlightNonAsciiMenuItem);

final JCheckBoxMenuItem showUnprintableMenuItem = new JCheckBoxMenuItem("Unprintable Characters");
showUnprintableMenuItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
codeArea.setShowUnprintableCharacters(!codeArea.isShowUnprintableCharacters());
codeArea.setShowUnprintables(!codeArea.isShowUnprintables());
}
});
viewMenu.add(showUnprintableMenuItem);
Expand All @@ -502,7 +515,13 @@ public void actionPerformed(ActionEvent e) {
wrappingModeMenuItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
codeArea.setWrapMode(!codeArea.isWrapMode());
if (codeArea.getRowWrapping() == RowWrappingMode.WRAPPING) {
codeArea.setMaxBytesPerRow(16);
codeArea.setRowWrapping(RowWrappingMode.NO_WRAPPING);
} else {
codeArea.setMaxBytesPerRow(0);
codeArea.setRowWrapping(RowWrappingMode.WRAPPING);
}
}
});
viewMenu.add(wrappingModeMenuItem);
Expand Down Expand Up @@ -607,14 +626,14 @@ public void actionPerformed(ActionEvent e) {
byte[] selectedData;
if (codeArea.hasSelection()) {
SelectionRange selectionRange = codeArea.getSelection();
// org.exbin.deltahex.SelectionRange has different length for forward and backward selections
// org.exbin.bined.SelectionRange has different length for forward and backward selections
if (selectionRange.getStart() > selectionRange.getLast()) {
selectedData = Utils.convertHexDataToByteArray(codeArea.getData().copy(selectionRange.getFirst(), selectionRange.getLength()));
selectedData = Utils.convertHexDataToByteArray(codeArea.getContentData().copy(selectionRange.getFirst(), selectionRange.getLength()));
} else {
selectedData = Utils.convertHexDataToByteArray(codeArea.getData().copy(selectionRange.getFirst(), selectionRange.getLength() + 1));
selectedData = Utils.convertHexDataToByteArray(codeArea.getContentData().copy(selectionRange.getFirst(), selectionRange.getLength() + 1));
}
} else {
selectedData = Utils.convertHexDataToByteArray(codeArea.getData());
selectedData = Utils.convertHexDataToByteArray(codeArea.getContentData());
}
if (selectedData.length > 0) {
decoderSegment.decoderTab.mainTab.receiveTextFromMenu(selectedData);
Expand Down Expand Up @@ -669,8 +688,9 @@ public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
}
}

showUnprintableMenuItem.setSelected(codeArea.isShowUnprintableCharacters());
wrappingModeMenuItem.setSelected(codeArea.isWrapMode());
highlightNonAsciiMenuItem.setSelected(((ExtendedHighlightNonAsciiCodeAreaPainter) codeArea.getPainter()).isNonAsciiHighlightingEnabled());
showUnprintableMenuItem.setSelected(codeArea.isShowUnprintables());
wrappingModeMenuItem.setSelected(codeArea.getRowWrapping() == RowWrappingMode.WRAPPING);
}

@Override
Expand Down