commit
96935050fb
5 changed files with 118 additions and 107 deletions
13
pom.xml
13
pom.xml
|
@ -181,7 +181,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.slf4j</groupId>
|
<groupId>org.slf4j</groupId>
|
||||||
<artifactId>slf4j-api</artifactId>
|
<artifactId>slf4j-api</artifactId>
|
||||||
<version>1.7.31</version>
|
<version>1.7.32</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.smali</groupId>
|
<groupId>org.smali</groupId>
|
||||||
|
@ -225,14 +225,15 @@
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.weisj</groupId>
|
<groupId>com.github.weisj</groupId>
|
||||||
<artifactId>darklaf-core</artifactId>
|
<artifactId>darklaf-core-jawt-dll</artifactId>
|
||||||
<version>2.6.2-20210719.010320-83</version> <!-- TODO Change to release when ready -->
|
<version>2.6.2-jawt-dll-SNAPSHOT</version> <!-- TODO Change to release when ready, see below -->
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!-- RELEASE VERSION:
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.weisj</groupId>
|
<groupId>com.github.weisj</groupId>
|
||||||
<artifactId>darklaf-windows</artifactId>
|
<artifactId>darklaf-core</artifactId>
|
||||||
<version>2.6.2-20210719.010320-83</version> <!-- TODO Remove when ready -->
|
<version>2.6.2</version>
|
||||||
</dependency>
|
</dependency>-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.weisj</groupId>
|
<groupId>com.github.weisj</groupId>
|
||||||
<artifactId>darklaf-extensions-rsyntaxarea</artifactId>
|
<artifactId>darklaf-extensions-rsyntaxarea</artifactId>
|
||||||
|
|
|
@ -11,6 +11,7 @@ import java.awt.Graphics;
|
||||||
import java.awt.Rectangle;
|
import java.awt.Rectangle;
|
||||||
import java.awt.event.*;
|
import java.awt.event.*;
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
import the.bytecode.club.bytecodeviewer.Configuration;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author laullon
|
* @author laullon
|
||||||
|
@ -22,22 +23,22 @@ public class JHexEditor extends JPanel implements FocusListener, AdjustmentListe
|
||||||
protected int textLength = 16;
|
protected int textLength = 16;
|
||||||
protected int lastWidth;
|
protected int lastWidth;
|
||||||
|
|
||||||
byte[] buff;
|
byte[] buf;
|
||||||
public int cursor;
|
public int cursor;
|
||||||
public Font font;
|
public Font font;
|
||||||
protected int border = 2;
|
protected int border = 2;
|
||||||
public boolean DEBUG = false;
|
public boolean DEBUG = false;
|
||||||
private final JScrollBar sb;
|
private final JScrollBar sb;
|
||||||
private int inicio = 0;
|
private int begin = 0;
|
||||||
private int lineas = 10;
|
private int lines = 10;
|
||||||
private JHexEditorHEX hex;
|
private final JHexEditorHEX hex;
|
||||||
private JHexEditorASCII ascii;
|
private final JHexEditorASCII ascii;
|
||||||
|
|
||||||
public JHexEditor(byte[] buff)
|
public JHexEditor(byte[] buff)
|
||||||
{
|
{
|
||||||
super();
|
super();
|
||||||
|
|
||||||
this.buff = buff;
|
this.buf = buff;
|
||||||
this.font = new Font(Font.MONOSPACED, Font.PLAIN, BytecodeViewer.viewer.getFontSize());
|
this.font = new Font(Font.MONOSPACED, Font.PLAIN, BytecodeViewer.viewer.getFontSize());
|
||||||
|
|
||||||
checkSize();
|
checkSize();
|
||||||
|
@ -47,26 +48,25 @@ public class JHexEditor extends JPanel implements FocusListener, AdjustmentListe
|
||||||
sb = new JScrollBar(JScrollBar.VERTICAL);
|
sb = new JScrollBar(JScrollBar.VERTICAL);
|
||||||
sb.addAdjustmentListener(this);
|
sb.addAdjustmentListener(this);
|
||||||
sb.setMinimum(0);
|
sb.setMinimum(0);
|
||||||
sb.setMaximum(buff.length / getLineas());
|
sb.setMaximum(buff.length / getLines());
|
||||||
|
|
||||||
JPanel p1, p2, p3;
|
JPanel p1, p2, p3;
|
||||||
// centro
|
// HEX Editor
|
||||||
hex = new JHexEditorHEX(this);
|
hex = new JHexEditorHEX(this);
|
||||||
p1 = new JPanel(new BorderLayout(1, 1));
|
p1 = new JPanel(new BorderLayout(1, 1));
|
||||||
p1.add(hex, BorderLayout.CENTER);
|
p1.add(hex, BorderLayout.CENTER);
|
||||||
p1.add(new Columnas(), BorderLayout.NORTH);
|
p1.add(new Column(), BorderLayout.NORTH);
|
||||||
|
|
||||||
// izq.
|
|
||||||
p2 = new JPanel(new BorderLayout(1, 1));
|
p2 = new JPanel(new BorderLayout(1, 1));
|
||||||
p2.add(new Filas(), BorderLayout.CENTER);
|
p2.add(new Row(), BorderLayout.CENTER);
|
||||||
p2.add(new Caja(), BorderLayout.NORTH);
|
p2.add(new Cell(), BorderLayout.NORTH);
|
||||||
|
|
||||||
// der
|
// ASCII Editor
|
||||||
ascii = new JHexEditorASCII(this);
|
ascii = new JHexEditorASCII(this);
|
||||||
p3 = new JPanel(new BorderLayout(1, 1));
|
p3 = new JPanel(new BorderLayout(1, 1));
|
||||||
p3.add(sb, BorderLayout.EAST);
|
p3.add(sb, BorderLayout.EAST);
|
||||||
p3.add(ascii, BorderLayout.CENTER);
|
p3.add(ascii, BorderLayout.CENTER);
|
||||||
p3.add(new Caja(), BorderLayout.NORTH);
|
p3.add(new Cell(), BorderLayout.NORTH);
|
||||||
|
|
||||||
JPanel panel = new JPanel();
|
JPanel panel = new JPanel();
|
||||||
panel.setLayout(new BorderLayout(1, 1));
|
panel.setLayout(new BorderLayout(1, 1));
|
||||||
|
@ -89,14 +89,14 @@ public class JHexEditor extends JPanel implements FocusListener, AdjustmentListe
|
||||||
FontMetrics fn = getFontMetrics(font);
|
FontMetrics fn = getFontMetrics(font);
|
||||||
|
|
||||||
Rectangle rec = this.getBounds();
|
Rectangle rec = this.getBounds();
|
||||||
lineas = (rec.height / fn.getHeight()) - 1;
|
lines = (rec.height / fn.getHeight()) - 1;
|
||||||
int n = (buff.length / textLength) - 1;
|
int n = (buf.length / textLength) - 1;
|
||||||
if (lineas > n) {
|
if (lines > n) {
|
||||||
lineas = n;
|
lines = n;
|
||||||
inicio = 0;
|
begin = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
sb.setValues(getInicio(), +getLineas(), 0, buff.length / textLength);
|
sb.setValues(getBegin(), +getLines(), 0, buf.length / textLength);
|
||||||
sb.setValueIsAdjusting(true);
|
sb.setValueIsAdjusting(true);
|
||||||
super.paint(g);
|
super.paint(g);
|
||||||
}
|
}
|
||||||
|
@ -138,22 +138,22 @@ public class JHexEditor extends JPanel implements FocusListener, AdjustmentListe
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
protected int getInicio() {
|
protected int getBegin() {
|
||||||
return inicio;
|
return begin;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected int getLineas() {
|
protected int getLines() {
|
||||||
return lineas;
|
return lines;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void fondo(Graphics g, int x, int y, int s) {
|
protected void background(Graphics g, int x, int y, int s) {
|
||||||
FontMetrics fn = getFontMetrics(font);
|
FontMetrics fn = getFontMetrics(font);
|
||||||
g.fillRect(((fn.stringWidth(" ") + 1) * x) + border,
|
g.fillRect(((fn.stringWidth(" ") + 1) * x) + border,
|
||||||
(fn.getHeight() * y) + border, ((fn.stringWidth(" ") + 1) * s),
|
(fn.getHeight() * y) + border, ((fn.stringWidth(" ") + 1) * s),
|
||||||
fn.getHeight() + 1);
|
fn.getHeight() + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void cuadro(Graphics g, int x, int y, int s) {
|
protected void border(Graphics g, int x, int y, int s) {
|
||||||
FontMetrics fn = getFontMetrics(font);
|
FontMetrics fn = getFontMetrics(font);
|
||||||
g.drawRect(((fn.stringWidth(" ") + 1) * x) + border,
|
g.drawRect(((fn.stringWidth(" ") + 1) * x) + border,
|
||||||
(fn.getHeight() * y) + border, ((fn.stringWidth(" ") + 1) * s),
|
(fn.getHeight() * y) + border, ((fn.stringWidth(" ") + 1) * s),
|
||||||
|
@ -178,41 +178,39 @@ public class JHexEditor extends JPanel implements FocusListener, AdjustmentListe
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void adjustmentValueChanged(AdjustmentEvent e) {
|
public void adjustmentValueChanged(AdjustmentEvent e) {
|
||||||
inicio = e.getValue();
|
begin = e.getValue();
|
||||||
if (inicio < 0)
|
if (begin < 0)
|
||||||
inicio = 0;
|
begin = 0;
|
||||||
repaint();
|
repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseWheelMoved(MouseWheelEvent e) {
|
public void mouseWheelMoved(MouseWheelEvent e) {
|
||||||
inicio += (e.getUnitsToScroll());
|
begin += (e.getUnitsToScroll());
|
||||||
if ((inicio + lineas) >= buff.length / textLength)
|
if ((begin + lines) >= buf.length / textLength)
|
||||||
inicio = (buff.length / textLength) - lineas;
|
begin = (buf.length / textLength) - lines;
|
||||||
if (inicio < 0)
|
if (begin < 0)
|
||||||
inicio = 0;
|
begin = 0;
|
||||||
repaint();
|
repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void keyPressed(KeyEvent e) {
|
public void keyPressed(KeyEvent e) {
|
||||||
/*
|
/* switch(e.getKeyCode()) { case 33: // rep if(cursor>=(16*lines))
|
||||||
* switch(e.getKeyCode()) { case 33: // rep if(cursor>=(16*lineas))
|
cursor-=(16*lines); refreshCursor(); break; case 34: // fin
|
||||||
* cursor-=(16*lineas); actualizaCursor(); break; case 34: // fin
|
if(cursor<(buff.length-(16*lines))) cursor+=(16*lines);
|
||||||
* if(cursor<(buff.length-(16*lineas))) cursor+=(16*lineas);
|
refreshCursor(); break; case 35: // fin cursor=buff.length-1;
|
||||||
* actualizaCursor(); break; case 35: // fin cursor=buff.length-1;
|
refreshCursor(); break; case 36: // ini cursor=0;
|
||||||
* actualizaCursor(); break; case 36: // ini cursor=0;
|
refreshCursor(); break; case 37: // <-- if(cursor!=0) cursor--;
|
||||||
* actualizaCursor(); break; case 37: // <-- if(cursor!=0) cursor--;
|
refreshCursor(); break; case 38: // <-- if(cursor>15) cursor-=16;
|
||||||
* actualizaCursor(); break; case 38: // <-- if(cursor>15) cursor-=16;
|
refreshCursor(); break; case 39: // --> if(cursor!=(buff.length-1))
|
||||||
* actualizaCursor(); break; case 39: // --> if(cursor!=(buff.length-1))
|
cursor++; refreshCursor(); break; case 40: // -->
|
||||||
* cursor++; actualizaCursor(); break; case 40: // -->
|
if(cursor<(buff.length-16)) cursor+=16; refreshCursor(); break; } */
|
||||||
* if(cursor<(buff.length-16)) cursor+=16; actualizaCursor(); break; }
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class Columnas extends JPanel {
|
private class Column extends JPanel {
|
||||||
private static final long serialVersionUID = -1734199617526339842L;
|
private static final long serialVersionUID = -1734199617526339842L;
|
||||||
|
|
||||||
public Columnas() {
|
public Column() {
|
||||||
this.setLayout(new BorderLayout(1, 1));
|
this.setLayout(new BorderLayout(1, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -227,7 +225,7 @@ public class JHexEditor extends JPanel implements FocusListener, AdjustmentListe
|
||||||
FontMetrics fn = getFontMetrics(font);
|
FontMetrics fn = getFontMetrics(font);
|
||||||
int h = fn.getHeight();
|
int h = fn.getHeight();
|
||||||
int nl = 1;
|
int nl = 1;
|
||||||
d.setSize(((fn.stringWidth(" ") + 1) * +((textLength * 3) - 1))
|
d.setSize(((fn.stringWidth(" ") + 1) * ((textLength * 3) - 1))
|
||||||
+ (border * 2) + 1, h * nl + (border * 2) + 1);
|
+ (border * 2) + 1, h * nl + (border * 2) + 1);
|
||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
|
@ -235,14 +233,14 @@ public class JHexEditor extends JPanel implements FocusListener, AdjustmentListe
|
||||||
@Override
|
@Override
|
||||||
public void paint(Graphics g) {
|
public void paint(Graphics g) {
|
||||||
Dimension d = getMinimumSize();
|
Dimension d = getMinimumSize();
|
||||||
g.setColor(Color.white);
|
g.setColor(Configuration.lafTheme.isDark() ? Color.darkGray : Color.white);
|
||||||
g.fillRect(0, 0, d.width, d.height);
|
g.fillRect(0, 0, d.width, d.height);
|
||||||
g.setColor(Color.black);
|
g.setColor(Configuration.lafTheme.isDark() ? Color.white : Color.black);
|
||||||
g.setFont(font);
|
g.setFont(font);
|
||||||
|
|
||||||
for (int n = 0; n < textLength; n++) {
|
for (int n = 0; n < textLength; n++) {
|
||||||
if (n == (cursor % textLength))
|
if (n == (cursor % textLength))
|
||||||
cuadro(g, n * 3, 0, 2);
|
border(g, n * 3, 0, 2);
|
||||||
String s = "00" + Integer.toHexString(n);
|
String s = "00" + Integer.toHexString(n);
|
||||||
s = s.substring(s.length() - 2);
|
s = s.substring(s.length() - 2);
|
||||||
printString(g, s, n * 3, 0);
|
printString(g, s, n * 3, 0);
|
||||||
|
@ -250,7 +248,7 @@ public class JHexEditor extends JPanel implements FocusListener, AdjustmentListe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class Caja extends JPanel {
|
private class Cell extends JPanel {
|
||||||
private static final long serialVersionUID = -6124062720565016834L;
|
private static final long serialVersionUID = -6124062720565016834L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -270,10 +268,10 @@ public class JHexEditor extends JPanel implements FocusListener, AdjustmentListe
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class Filas extends JPanel {
|
private class Row extends JPanel {
|
||||||
private static final long serialVersionUID = 8797347523486018051L;
|
private static final long serialVersionUID = 8797347523486018051L;
|
||||||
|
|
||||||
public Filas() {
|
public Row() {
|
||||||
this.setLayout(new BorderLayout(1, 1));
|
this.setLayout(new BorderLayout(1, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -287,7 +285,7 @@ public class JHexEditor extends JPanel implements FocusListener, AdjustmentListe
|
||||||
Dimension d = new Dimension();
|
Dimension d = new Dimension();
|
||||||
FontMetrics fn = getFontMetrics(font);
|
FontMetrics fn = getFontMetrics(font);
|
||||||
int h = fn.getHeight();
|
int h = fn.getHeight();
|
||||||
int nl = getLineas();
|
int nl = getLines();
|
||||||
d.setSize((fn.stringWidth(" ") + 1) * (8) + (border * 2) + 1, h
|
d.setSize((fn.stringWidth(" ") + 1) * (8) + (border * 2) + 1, h
|
||||||
* nl + (border * 2) + 1);
|
* nl + (border * 2) + 1);
|
||||||
return d;
|
return d;
|
||||||
|
@ -297,18 +295,18 @@ public class JHexEditor extends JPanel implements FocusListener, AdjustmentListe
|
||||||
public void paint(Graphics g)
|
public void paint(Graphics g)
|
||||||
{
|
{
|
||||||
Dimension d = getMinimumSize();
|
Dimension d = getMinimumSize();
|
||||||
g.setColor(Color.white);
|
g.setColor(Configuration.lafTheme.isDark() ? Color.darkGray : Color.white);
|
||||||
g.fillRect(0, 0, d.width, d.height);
|
g.fillRect(0, 0, d.width, d.height);
|
||||||
g.setColor(Color.black);
|
g.setColor(Configuration.lafTheme.isDark() ? Color.white : Color.black);
|
||||||
g.setFont(font);
|
g.setFont(font);
|
||||||
|
|
||||||
int ini = getInicio();
|
int ini = getBegin();
|
||||||
int fin = ini + getLineas();
|
int fin = ini + getLines();
|
||||||
int y = 0;
|
int y = 0;
|
||||||
for (int n = ini; n < fin; n++)
|
for (int n = ini; n < fin; n++)
|
||||||
{
|
{
|
||||||
if (n == (cursor / textLength))
|
if (n == (cursor / textLength))
|
||||||
cuadro(g, 0, y, 8);
|
border(g, 0, y, 8);
|
||||||
String s = "0000000000000" + Integer.toHexString(n);
|
String s = "0000000000000" + Integer.toHexString(n);
|
||||||
s = s.substring(s.length() - 8);
|
s = s.substring(s.length() - 8);
|
||||||
printString(g, s, 0, y++);
|
printString(g, s, 0, y++);
|
||||||
|
|
|
@ -9,6 +9,7 @@ import java.awt.event.KeyListener;
|
||||||
import java.awt.event.MouseEvent;
|
import java.awt.event.MouseEvent;
|
||||||
import java.awt.event.MouseListener;
|
import java.awt.event.MouseListener;
|
||||||
import javax.swing.JComponent;
|
import javax.swing.JComponent;
|
||||||
|
import the.bytecode.club.bytecodeviewer.Configuration;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author laullon
|
* @author laullon
|
||||||
|
@ -41,7 +42,7 @@ public class JHexEditorASCII extends JComponent implements MouseListener, KeyLis
|
||||||
FontMetrics fn = getFontMetrics(he.font);
|
FontMetrics fn = getFontMetrics(he.font);
|
||||||
int w = fn.stringWidth(" ");
|
int w = fn.stringWidth(" ");
|
||||||
int h = fn.getHeight();
|
int h = fn.getHeight();
|
||||||
int nl = he.getLineas();
|
int nl = he.getLines();
|
||||||
int len = he.textLength + 1;
|
int len = he.textLength + 1;
|
||||||
|
|
||||||
int width = (len * w) + (he.border * 2) + 5;
|
int width = (len * w) + (he.border * 2) + 5;
|
||||||
|
@ -63,39 +64,39 @@ public class JHexEditorASCII extends JComponent implements MouseListener, KeyLis
|
||||||
@Override
|
@Override
|
||||||
public void paint(Graphics g) {
|
public void paint(Graphics g) {
|
||||||
debug("paint(" + g + ")");
|
debug("paint(" + g + ")");
|
||||||
debug("cursor=" + he.cursor + " buff.length=" + he.buff.length);
|
debug("cursor=" + he.cursor + " buff.length=" + he.buf.length);
|
||||||
Dimension d = getMinimumSize();
|
Dimension d = getMinimumSize();
|
||||||
g.setColor(Color.white);
|
g.setColor(Configuration.lafTheme.isDark() ? Color.darkGray : Color.white);
|
||||||
g.fillRect(0, 0, d.width, d.height);
|
g.fillRect(0, 0, d.width, d.height);
|
||||||
g.setColor(Color.black);
|
g.setColor(Configuration.lafTheme.isDark() ? Color.white : Color.black);
|
||||||
|
|
||||||
g.setFont(he.font);
|
g.setFont(he.font);
|
||||||
|
|
||||||
// datos ascii
|
// ASCII data
|
||||||
int ini = he.getInicio() * he.textLength;
|
int start = he.getBegin() * he.textLength;
|
||||||
int fin = ini + (he.getLineas() * he.textLength);
|
int stop = start + (he.getLines() * he.textLength);
|
||||||
if (fin > he.buff.length)
|
if (stop > he.buf.length)
|
||||||
fin = he.buff.length;
|
stop = he.buf.length;
|
||||||
|
|
||||||
int x = 0;
|
int x = 0;
|
||||||
int y = 0;
|
int y = 0;
|
||||||
for (int n = ini; n < fin; n++) {
|
for (int n = start; n < stop; n++) {
|
||||||
if (n == he.cursor) {
|
if (n == he.cursor) {
|
||||||
g.setColor(Color.blue);
|
g.setColor(Color.blue);
|
||||||
if (hasFocus())
|
if (hasFocus())
|
||||||
he.fondo(g, x, y, 1);
|
he.background(g, x, y, 1);
|
||||||
else
|
else
|
||||||
he.cuadro(g, x, y, 1);
|
he.border(g, x, y, 1);
|
||||||
if (hasFocus())
|
if (hasFocus())
|
||||||
g.setColor(Color.white);
|
g.setColor(Configuration.lafTheme.isDark() ? Color.black : Color.white);
|
||||||
else
|
else
|
||||||
g.setColor(Color.black);
|
g.setColor(Configuration.lafTheme.isDark() ? Color.white : Color.black);
|
||||||
} else {
|
} else {
|
||||||
g.setColor(Color.black);
|
g.setColor(Configuration.lafTheme.isDark() ? Color.white : Color.black);
|
||||||
}
|
}
|
||||||
|
|
||||||
String s = String.valueOf((char) (he.buff[n] & 0xFF));//"" + new Character((char) he.buff[n]);
|
String s = String.valueOf((char) (he.buf[n] & 0xFF));//"" + new Character((char) he.buff[n]);
|
||||||
if ((he.buff[n] < 20) || (he.buff[n] > 126))
|
if ((he.buf[n] < 20) || (he.buf[n] > 126))
|
||||||
s = ".";//"" + (char) 16;
|
s = ".";//"" + (char) 16;
|
||||||
he.printString(g, s, (x++), y);
|
he.printString(g, s, (x++), y);
|
||||||
if (x == he.textLength) {
|
if (x == he.textLength) {
|
||||||
|
@ -111,20 +112,18 @@ public class JHexEditorASCII extends JComponent implements MouseListener, KeyLis
|
||||||
System.out.println("JHexEditorASCII ==> " + s);
|
System.out.println("JHexEditorASCII ==> " + s);
|
||||||
}
|
}
|
||||||
|
|
||||||
// calcular la posicion del raton
|
public int calculateMousePosition(int x, int y) {
|
||||||
public int calcularPosicionRaton(int x, int y) {
|
|
||||||
FontMetrics fn = getFontMetrics(he.font);
|
FontMetrics fn = getFontMetrics(he.font);
|
||||||
x = x / (fn.stringWidth(" ") + 1);
|
x = x / (fn.stringWidth(" ") + 1);
|
||||||
y = y / fn.getHeight();
|
y = y / fn.getHeight();
|
||||||
debug("x=" + x + " ,y=" + y);
|
debug("x=" + x + " ,y=" + y);
|
||||||
return x + ((y + he.getInicio()) * he.textLength);
|
return x + ((y + he.getBegin()) * he.textLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
// mouselistener
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseClicked(MouseEvent e) {
|
public void mouseClicked(MouseEvent e) {
|
||||||
debug("mouseClicked(" + e + ")");
|
debug("mouseClicked(" + e + ")");
|
||||||
he.cursor = calcularPosicionRaton(e.getX(), e.getY());
|
he.cursor = calculateMousePosition(e.getX(), e.getY());
|
||||||
this.requestFocus();
|
this.requestFocus();
|
||||||
he.repaint();
|
he.repaint();
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class JHexEditorHEX extends JComponent implements MouseListener, KeyListe
|
||||||
public void paint(Graphics g)
|
public void paint(Graphics g)
|
||||||
{
|
{
|
||||||
debug("paint(" + g + ")");
|
debug("paint(" + g + ")");
|
||||||
debug("cursor=" + he.cursor + " buff.length=" + he.buff.length);
|
debug("cursor=" + he.cursor + " buff.length=" + he.buf.length);
|
||||||
|
|
||||||
if(!Configuration.lafTheme.isDark())
|
if(!Configuration.lafTheme.isDark())
|
||||||
{
|
{
|
||||||
|
@ -56,25 +56,25 @@ public class JHexEditorHEX extends JComponent implements MouseListener, KeyListe
|
||||||
|
|
||||||
g.setFont(he.font);
|
g.setFont(he.font);
|
||||||
|
|
||||||
int ini = he.getInicio() * he.textLength;
|
int start = he.getBegin() * he.textLength;
|
||||||
int fin = ini + (he.getLineas() * he.textLength);
|
int stop = start + (he.getLines() * he.textLength);
|
||||||
if (fin > he.buff.length)
|
if (stop > he.buf.length)
|
||||||
fin = he.buff.length;
|
stop = he.buf.length;
|
||||||
|
|
||||||
// datos hex
|
// HEX data
|
||||||
int x = 0;
|
int x = 0;
|
||||||
int y = 0;
|
int y = 0;
|
||||||
for (int n = ini; n < fin; n++) {
|
for (int n = start; n < stop; n++) {
|
||||||
if (n == he.cursor) {
|
if (n == he.cursor) {
|
||||||
if (hasFocus()) {
|
if (hasFocus()) {
|
||||||
g.setColor(Color.black);
|
g.setColor(Color.black);
|
||||||
he.fondo(g, (x * 3), y, 2);
|
he.background(g, (x * 3), y, 2);
|
||||||
g.setColor(Color.blue);
|
g.setColor(Color.blue);
|
||||||
int cursor = 0;
|
int cursor = 0;
|
||||||
he.fondo(g, (x * 3) + cursor, y, 1);
|
he.background(g, (x * 3) + cursor, y, 1);
|
||||||
} else {
|
} else {
|
||||||
g.setColor(Color.blue);
|
g.setColor(Color.blue);
|
||||||
he.cuadro(g, (x * 3), y, 2);
|
he.border(g, (x * 3), y, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasFocus())
|
if (hasFocus())
|
||||||
|
@ -85,7 +85,7 @@ public class JHexEditorHEX extends JComponent implements MouseListener, KeyListe
|
||||||
g.setColor(Configuration.lafTheme.isDark() ? Color.white : Color.black);
|
g.setColor(Configuration.lafTheme.isDark() ? Color.white : Color.black);
|
||||||
}
|
}
|
||||||
|
|
||||||
String s = ("0" + Integer.toHexString(he.buff[n]));
|
String s = ("0" + Integer.toHexString(he.buf[n]));
|
||||||
s = s.substring(s.length() - 2);
|
s = s.substring(s.length() - 2);
|
||||||
he.printString(g, s, ((x++) * 3), y);
|
he.printString(g, s, ((x++) * 3), y);
|
||||||
if (x == he.textLength) {
|
if (x == he.textLength) {
|
||||||
|
@ -100,20 +100,18 @@ public class JHexEditorHEX extends JComponent implements MouseListener, KeyListe
|
||||||
System.out.println("JHexEditorHEX ==> " + s);
|
System.out.println("JHexEditorHEX ==> " + s);
|
||||||
}
|
}
|
||||||
|
|
||||||
// calcular la posicion del raton
|
public int calculateMousePosition(int x, int y) {
|
||||||
public int calcularPosicionRaton(int x, int y) {
|
|
||||||
FontMetrics fn = getFontMetrics(he.font);
|
FontMetrics fn = getFontMetrics(he.font);
|
||||||
x = x / ((fn.stringWidth(" ") + 1) * 3);
|
x = x / ((fn.stringWidth(" ") + 1) * 3);
|
||||||
y = y / fn.getHeight();
|
y = y / fn.getHeight();
|
||||||
debug("x=" + x + " ,y=" + y);
|
debug("x=" + x + " ,y=" + y);
|
||||||
return x + ((y + he.getInicio()) * he.textLength);
|
return x + ((y + he.getBegin()) * he.textLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
// mouselistener
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseClicked(MouseEvent e) {
|
public void mouseClicked(MouseEvent e) {
|
||||||
debug("mouseClicked(" + e + ")");
|
debug("mouseClicked(" + e + ")");
|
||||||
he.cursor = calcularPosicionRaton(e.getX(), e.getY());
|
he.cursor = calculateMousePosition(e.getX(), e.getY());
|
||||||
this.requestFocus();
|
this.requestFocus();
|
||||||
he.repaint();
|
he.repaint();
|
||||||
}
|
}
|
||||||
|
@ -149,7 +147,7 @@ public class JHexEditorHEX extends JComponent implements MouseListener, KeyListe
|
||||||
* he.buff[he.cursor]=(byte)Integer.parseInt(new String(str),16);
|
* he.buff[he.cursor]=(byte)Integer.parseInt(new String(str),16);
|
||||||
*
|
*
|
||||||
* if(cursor!=1) cursor=1; else if(he.cursor!=(he.buff.length-1)){
|
* if(cursor!=1) cursor=1; else if(he.cursor!=(he.buff.length-1)){
|
||||||
* he.cursor++; cursor=0;} he.actualizaCursor(); }
|
* he.cursor++; cursor=0;} he.refreshCursor(); }
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -237,5 +237,20 @@
|
||||||
"APK_CONVERSION_DECODING": "APK-Konvertierung",
|
"APK_CONVERSION_DECODING": "APK-Konvertierung",
|
||||||
"CFR_SETTINGS": "CFR-Einstellungen",
|
"CFR_SETTINGS": "CFR-Einstellungen",
|
||||||
"FERNFLOWER_SETTINGS": "FernFlower Einstellungen",
|
"FERNFLOWER_SETTINGS": "FernFlower Einstellungen",
|
||||||
"SUGGESTED_FIX_NO_DECOMPILER_WARNING": "WARNUNG: Derzeit ist kein Decompiler ausgewählt. Versuchen Sie Ansicht>Fenster und wählen Sie einen Decompiler."
|
"SUGGESTED_FIX_NO_DECOMPILER_WARNING": "ACHTUNG: Derzeit ist kein Dekompilierer ausgewählt. Versuchen Sie unter Ansicht>Fenster einen Dekompilierer auszuwählen.",
|
||||||
|
"RELOAD_RESOURCES_TITLE": "{PRODUCT_NAME} - Ressourcen neu laden",
|
||||||
|
"RELOAD_RESOURCES_CONFIRM": "Sind Sie sicher, dass Sie die Ressourcen neu laden möchten?",
|
||||||
|
"SELECT_FILE_TITLE": "Wählen Sie Datei oder Ordner zum Öffnen in {BCV}",
|
||||||
|
"SELECT_FILE_DESCRIPTION": "APKs, DEX, Klassen oder Zip/Jar/War-Archive",
|
||||||
|
"SELECT_EXTERNAL_PLUGIN_TITLE": "Externes Plugin auswählen",
|
||||||
|
"SELECT_EXTERNAL_PLUGIN_DESCRIPTION": "BCV Externes Plugin in js, java, python, ruby oder groovy",
|
||||||
|
"FOREIGN_LIBRARY_WARNING": "ACHTUNG: Wenn dies ausgeschaltet ist, werden veraltete Bibliotheken NICHT entfernt.\nDies stellt auch ein Sicherheitsproblem dar.\nSCHALTEN SIE ES NUR AUS, WENN SIE WISSEN, WAS SIE TUN.",
|
||||||
|
"EXIT_TITLE": "{PRODUCT_NAME} - Beenden",
|
||||||
|
"EXIT_CONFIRM": "Sind Sie sicher, dass Sie das Programm beenden wollen?",
|
||||||
|
"ABOUT_TITLE": "{PRODUCT_NAME} - Über - {WEBSITE} | {TBC}",
|
||||||
|
"PLUGIN_CONSOLE_TITLE": "{PRODUCT_NAME} - Plugin-Konsole",
|
||||||
|
"RESET_TITLE": "{PRODUCT_NAME} - Arbeitsbereich zurücksetzen",
|
||||||
|
"RESET_CONFIRM": "Sind Sie sicher, dass Sie den Arbeitsbereich zurücksetzen wollen?\n\rDadurch werden auch der Datei-Navigator und die Suche zurückgesetzt.",
|
||||||
|
"CLOSE_ALL_BUT_THIS": "Alle außer diesen schließen",
|
||||||
|
"CLOSE_TAB": "Tab schließen"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue