mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-30 12:41:34 +00:00
hex dump moved to separate ribbon task - view + icons
space between hex and ASCII dump white foreground for hilighted bytes
This commit is contained in:
@@ -51,19 +51,23 @@ public class HexView extends JTable {
|
||||
JLabel l = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, col);
|
||||
int level = -1;
|
||||
if (col > 0 && highlightStarts != null) {
|
||||
int idx = row * bytesInRow + ((col > bytesInRow) ? (col - bytesInRow - 1) : (col - 1));
|
||||
for (int i = 0; i < highlightStarts.length; i++) {
|
||||
if (highlightStarts[i] <= idx && highlightEnds[i] >= idx) {
|
||||
level++;
|
||||
} else {
|
||||
break;
|
||||
if(col!=bytesInRow+1){
|
||||
int idx = row * bytesInRow + ((col > bytesInRow + 1) ? (col - bytesInRow - 2) : (col - 1));
|
||||
for (int i = 0; i < highlightStarts.length; i++) {
|
||||
if (highlightStarts[i] <= idx && highlightEnds[i] >= idx) {
|
||||
level++;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (level > -1) {
|
||||
l.setForeground(Color.white);
|
||||
l.setBackground(highlightColors[level % highlightColors.length]);
|
||||
} else {
|
||||
l.setForeground(Color.black);
|
||||
l.setBackground(row % 2 == 0 ? bgColor : bgColorAlternate);
|
||||
}
|
||||
|
||||
@@ -94,7 +98,7 @@ public class HexView extends JTable {
|
||||
|
||||
@Override
|
||||
public int getColumnCount() {
|
||||
return 2 * bytesInRow + 1;
|
||||
return 2 * bytesInRow + 1 + 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -117,8 +121,10 @@ public class HexView extends JTable {
|
||||
return String.format("%02X", data[pos]);
|
||||
}
|
||||
return null;
|
||||
} else if (column == 1 + bytesInRow) {
|
||||
return null;
|
||||
} else {
|
||||
int pos = row * bytesInRow + column - bytesInRow - 1;
|
||||
int pos = row * bytesInRow + column - bytesInRow - 1 - 1;
|
||||
if (pos < data.length) {
|
||||
return (char) data[pos];
|
||||
}
|
||||
@@ -146,8 +152,12 @@ public class HexView extends JTable {
|
||||
column.setMaxWidth(25);
|
||||
column.setCellRenderer(cellRenderer);
|
||||
}
|
||||
|
||||
column = columnModel.getColumn(bytesInRow + 1);
|
||||
column.setMaxWidth(10);
|
||||
|
||||
for (int i = 0; i < bytesInRow; i++) {
|
||||
column = columnModel.getColumn(i + bytesInRow + 1);
|
||||
column = columnModel.getColumn(i + bytesInRow + 1 + 1);
|
||||
column.setMaxWidth(10);
|
||||
column.setCellRenderer(cellRenderer);
|
||||
}
|
||||
|
||||
@@ -50,9 +50,12 @@ import javax.swing.JEditorPane;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.SwingUtilities;
|
||||
import org.pushingpixels.flamingo.api.common.AbstractCommandButton;
|
||||
import org.pushingpixels.flamingo.api.common.CommandButtonDisplayState;
|
||||
import org.pushingpixels.flamingo.api.common.CommandToggleButtonGroup;
|
||||
import org.pushingpixels.flamingo.api.common.JCommandButton;
|
||||
import org.pushingpixels.flamingo.api.common.JCommandButtonPanel;
|
||||
import org.pushingpixels.flamingo.api.common.JCommandToggleButton;
|
||||
import org.pushingpixels.flamingo.api.ribbon.JRibbon;
|
||||
import org.pushingpixels.flamingo.api.ribbon.JRibbonBand;
|
||||
import org.pushingpixels.flamingo.api.ribbon.JRibbonComponent;
|
||||
@@ -118,6 +121,8 @@ public class MainFrameRibbonMenu implements MainFrameMenu, ActionListener {
|
||||
static final String ACTION_REFRESH_DECOMPILED = "REFRESHDECOMPILED";
|
||||
static final String ACTION_CLEAR_RECENT_FILES = "CLEARRECENTFILES";
|
||||
static final String ACTION_CHECK_RESOURCES = "CHECKRESOURCES";
|
||||
static final String ACTION_VIEWMODE_RESOURCES = "VIEWMODERESOURCES";
|
||||
static final String ACTION_VIEWMODE_HEX = "VIEWMODEHEX";
|
||||
|
||||
private final MainFrameRibbon mainFrame;
|
||||
|
||||
@@ -137,6 +142,8 @@ public class MainFrameRibbonMenu implements MainFrameMenu, ActionListener {
|
||||
private JCommandButton exportFlaCommandButton;
|
||||
private JCommandButton exportSelectionCommandButton;
|
||||
private JCommandButton importTextCommandButton;
|
||||
private JCommandToggleButton viewModeResourcesToggleButton;
|
||||
private JCommandToggleButton viewModeHexToggleButton;
|
||||
|
||||
private JCommandButton reloadCommandButton;
|
||||
private JCommandButton renameinvalidCommandButton;
|
||||
@@ -177,7 +184,7 @@ public class MainFrameRibbonMenu implements MainFrameMenu, ActionListener {
|
||||
return mainFrame.translate(key);
|
||||
}
|
||||
|
||||
private void assignListener(JCommandButton b, final String command) {
|
||||
private void assignListener(AbstractCommandButton b, final String command) {
|
||||
final MainFrameRibbonMenu t = this;
|
||||
b.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
@@ -322,8 +329,33 @@ public class MainFrameRibbonMenu implements MainFrameMenu, ActionListener {
|
||||
assignListener(importTextCommandButton, ACTION_IMPORT_TEXT);
|
||||
|
||||
importBand.addCommandButton(importTextCommandButton, RibbonElementPriority.TOP);
|
||||
|
||||
|
||||
JRibbonBand viewBand = new JRibbonBand(translate("menu.view"), null);
|
||||
viewBand.setResizePolicies(getResizePolicies(viewBand));
|
||||
|
||||
CommandToggleButtonGroup grp=new CommandToggleButtonGroup();
|
||||
|
||||
viewModeResourcesToggleButton = new JCommandToggleButton(fixCommandTitle(translate("menu.file.view.resources")), View.getResizableIcon("viewresources16"));
|
||||
assignListener(viewModeResourcesToggleButton, ACTION_VIEWMODE_RESOURCES);
|
||||
|
||||
viewModeHexToggleButton = new JCommandToggleButton(fixCommandTitle(translate("menu.file.view.hex")), View.getResizableIcon("viewhex16"));
|
||||
assignListener(viewModeHexToggleButton, ACTION_VIEWMODE_HEX);
|
||||
|
||||
grp.add(viewModeResourcesToggleButton);
|
||||
grp.add(viewModeHexToggleButton);
|
||||
|
||||
if(Configuration.dumpView.get()){
|
||||
grp.setSelected(viewModeHexToggleButton, true);
|
||||
}else{
|
||||
grp.setSelected(viewModeResourcesToggleButton, true);
|
||||
}
|
||||
|
||||
|
||||
viewBand.addCommandButton(viewModeResourcesToggleButton, RibbonElementPriority.MEDIUM);
|
||||
viewBand.addCommandButton(viewModeHexToggleButton, RibbonElementPriority.MEDIUM);
|
||||
|
||||
return new RibbonTask(translate("menu.file"), editBand, exportBand, importBand);
|
||||
return new RibbonTask(translate("menu.file"), editBand, exportBand, importBand, viewBand);
|
||||
}
|
||||
|
||||
private RibbonTask createToolsRibbonTask() {
|
||||
@@ -427,10 +459,10 @@ public class MainFrameRibbonMenu implements MainFrameMenu, ActionListener {
|
||||
miAutoRenameIdentifiers.setActionCommand(ACTION_AUTO_RENAME_IDENTIFIERS);
|
||||
miAutoRenameIdentifiers.addActionListener(this);
|
||||
|
||||
miDumpView = new JCheckBox(translate("menu.settings.dumpView"));
|
||||
/*miDumpView = new JCheckBox(translate("menu.settings.dumpView"));
|
||||
miDumpView.setSelected(Configuration.dumpView.get());
|
||||
miDumpView.setActionCommand(ACTION_DUMP_VIEW_SWITCH);
|
||||
miDumpView.addActionListener(this);
|
||||
miDumpView.addActionListener(this);*/
|
||||
|
||||
settingsBand.addRibbonComponent(new JRibbonComponent(miAutoDeobfuscation));
|
||||
settingsBand.addRibbonComponent(new JRibbonComponent(miInternalViewer));
|
||||
@@ -442,7 +474,7 @@ public class MainFrameRibbonMenu implements MainFrameMenu, ActionListener {
|
||||
settingsBand.addRibbonComponent(new JRibbonComponent(miCacheDisk));
|
||||
settingsBand.addRibbonComponent(new JRibbonComponent(miGotoMainClassOnStartup));
|
||||
settingsBand.addRibbonComponent(new JRibbonComponent(miAutoRenameIdentifiers));
|
||||
settingsBand.addRibbonComponent(new JRibbonComponent(miDumpView));
|
||||
//settingsBand.addRibbonComponent(new JRibbonComponent(miDumpView));
|
||||
|
||||
JRibbonBand languageBand = new JRibbonBand(translate("menu.language"), null);
|
||||
List<RibbonBandResizePolicy> languageBandResizePolicies = getIconBandResizePolicies(languageBand);
|
||||
@@ -620,6 +652,15 @@ public class MainFrameRibbonMenu implements MainFrameMenu, ActionListener {
|
||||
Configuration.internalFlashViewer.set(miInternalViewer.isSelected());
|
||||
mainFrame.panel.reload(true);
|
||||
break;
|
||||
|
||||
case ACTION_VIEWMODE_RESOURCES:
|
||||
Configuration.dumpView.set(false);
|
||||
mainFrame.panel.showDumpView(false);
|
||||
break;
|
||||
case ACTION_VIEWMODE_HEX:
|
||||
Configuration.dumpView.set(true);
|
||||
mainFrame.panel.showDumpView(true);
|
||||
break;
|
||||
case ACTION_DUMP_VIEW_SWITCH:
|
||||
Configuration.dumpView.set(miDumpView.isSelected());
|
||||
mainFrame.panel.showDumpView(miDumpView.isSelected());
|
||||
|
||||
BIN
src/com/jpexs/decompiler/flash/gui/graphics/viewhex16.png
Normal file
BIN
src/com/jpexs/decompiler/flash/gui/graphics/viewhex16.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 554 B |
BIN
src/com/jpexs/decompiler/flash/gui/graphics/viewresources16.png
Normal file
BIN
src/com/jpexs/decompiler/flash/gui/graphics/viewresources16.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 755 B |
@@ -488,3 +488,7 @@ contextmenu.rawEdit = Raw edit
|
||||
contextmenu.jumpToCharacter = Jump to character
|
||||
|
||||
menu.settings.dumpView = Dump view
|
||||
|
||||
menu.view = View
|
||||
menu.file.view.resources = Resources
|
||||
menu.file.view.hex = Hex dump
|
||||
@@ -478,4 +478,8 @@ error.text.import = Chyba b\u011bhem importu textu. Chcete pokra\u010dovat?
|
||||
contextmenu.removeWithDependencies = Odstranit se z\u00e1vislostmi
|
||||
|
||||
abc.action.find-usages = Naj\u00edt pou\u017eit\u00ed
|
||||
abc.action.find-declaration = Naj\u00edt deklaraci
|
||||
abc.action.find-declaration = Naj\u00edt deklaraci
|
||||
|
||||
menu.view = Zobrazen\u00ed
|
||||
menu.file.view.resources = Zdroje
|
||||
menu.file.view.hex = Hex dump
|
||||
Reference in New Issue
Block a user