Merge pull request #240 from mjbudd77/master

Added edit copy, paste, and find functions to Qt Hex Editor
This commit is contained in:
mjbudd77 2020-11-17 00:27:40 -05:00 committed by GitHub
commit 3f5d479f44
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 834 additions and 234 deletions

View File

@ -50,8 +50,8 @@ Name Table Viewer | YES | NO
Memory Hex Editor | YES | YES |
Trace Logger | YES | NO |
Code/Data Logger | YES | NO |
Game Genie Encoder/Decoder | NO | NO |
iNES Header Editor | NO | NO |
Game Genie Encoder/Decoder | YES | NO |
iNES Header Editor | YES | NO |
Built in help pages | NO | NO |
Network play (who actually uses this???) | NO | NO |
-----------------------------------------------------|-------------|-------------|

View File

@ -3097,7 +3097,7 @@ QAsmView::QAsmView(QWidget *parent)
wheelPixelCounter = 0;
//setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Expanding );
setFocusPolicy(Qt::StrongFocus);
setFocusPolicy(Qt::StrongFocus);
clipboard = QGuiApplication::clipboard();
@ -3533,7 +3533,7 @@ void QAsmView::loadHighlightToClipboard(void)
{
l = lineOffset + row;
if ( (l >= txtHlgtStartLine) && (l <= txtHlgtEndLine) )
if ( (l >= txtHlgtStartLine) && (l <= txtHlgtEndLine) )
{
int hlgtXs, hlgtXe, hlgtXd;
std::string s;

File diff suppressed because it is too large Load Diff

View File

@ -14,7 +14,9 @@
#include <QHBoxLayout>
#include <QComboBox>
#include <QCheckBox>
#include <QLineEdit>
#include <QPushButton>
#include <QRadioButton>
#include <QLabel>
#include <QMenu>
#include <QFrame>
@ -113,10 +115,14 @@ class QHexEdit : public QWidget
void setForeGroundColor( QColor fg );
void setBackGroundColor( QColor bg );
void memModeUpdate(void);
void openGotoAddrDialog(void);
void openGotoAddrDialog(void);
int checkMemActivity(void);
int getAddr(void){ return cursorAddr; };
int FreezeRam( const char *name, uint32_t a, uint8_t v, int c, int s, int type );
void loadHighlightToClipboard(void);
void pasteFromClipboard(void);
void clearHighlight(void);
int findPattern( std::vector <unsigned char> &varray, int dir );
enum {
MODE_NES_RAM = 0,
@ -128,17 +134,22 @@ class QHexEdit : public QWidget
protected:
void paintEvent(QPaintEvent *event);
void keyPressEvent(QKeyEvent *event);
void keyReleaseEvent(QKeyEvent *event);
void keyReleaseEvent(QKeyEvent *event);
void mousePressEvent(QMouseEvent * event);
void mouseReleaseEvent(QMouseEvent * event);
void mouseMoveEvent(QMouseEvent * event);
void wheelEvent(QWheelEvent *event);
void resizeEvent(QResizeEvent *event);
void contextMenuEvent(QContextMenuEvent *event);
void calcFontData(void);
void resetCursor(void);
bool textIsHighlighted(void);
void setHighlightEndCoord( int x, int y );
QPoint convPixToCursor( QPoint p );
int convPixToAddr( QPoint p );
bool frzRamAddrValid( int addr );
void loadClipboard( const char *txt );
QFont font;
@ -151,12 +162,13 @@ class QHexEdit : public QWidget
QScrollBar *hbar;
QColor highLightColor[ HIGHLIGHT_ACTIVITY_NUM_COLORS ];
QColor rvActvTextColor[ HIGHLIGHT_ACTIVITY_NUM_COLORS ];
QClipboard *clipboard;
HexEditorDialog_t *parent;
uint64_t total_instructions_lp;
int viewMode;
int viewMode;
int lineOffset;
int pxCharWidth;
int pxCharHeight;
@ -176,10 +188,10 @@ class QHexEdit : public QWidget
int viewLines;
int viewWidth;
int viewHeight;
int maxLineOffset;
int editAddr;
int editValue;
int editMask;
int maxLineOffset;
int editAddr;
int editValue;
int editMask;
int jumpToRomValue;
int ctxAddr;
int frzRamAddr;
@ -187,10 +199,19 @@ class QHexEdit : public QWidget
int frzRamMode;
int frzIdx;
int wheelPixelCounter;
int txtHlgtAnchorChar;
int txtHlgtAnchorLine;
int txtHlgtStartChar;
int txtHlgtStartLine;
int txtHlgtStartAddr;
int txtHlgtEndChar;
int txtHlgtEndLine;
int txtHlgtEndAddr;
bool cursorBlink;
bool reverseVideo;
bool actvHighlightEnable;
bool mouseLeftBtnDown;
private slots:
void jumpToROM(void);
@ -208,6 +229,28 @@ class QHexEdit : public QWidget
};
class HexEditorFindDialog_t : public QDialog
{
Q_OBJECT
public:
HexEditorFindDialog_t(QWidget *parent = 0);
~HexEditorFindDialog_t(void);
QLineEdit *searchBox;
QRadioButton *upBtn;
QRadioButton *dnBtn;
QRadioButton *hexBtn;
QRadioButton *txtBtn;
protected:
void closeEvent(QCloseEvent *bar);
HexEditorDialog_t *parent;
public slots:
void closeWindow(void);
void runSearch(void);
};
class HexEditorDialog_t : public QDialog
{
Q_OBJECT
@ -222,8 +265,9 @@ class HexEditorDialog_t : public QDialog
void openDebugSymbolEditWindow( int addr );
QHexEdit *editor;
protected:
HexEditorFindDialog_t *findDialog;
protected:
void closeEvent(QCloseEvent *bar);
QScrollBar *vbar;
@ -235,11 +279,12 @@ class HexEditorDialog_t : public QDialog
QAction *viewOAM;
QAction *viewROM;
QAction *gotoAddrAct;
QAction *undoEditAct;
private:
public slots:
void closeWindow(void);
public slots:
void closeWindow(void);
private slots:
void updatePeriodic(void);
void vbarMoved(int value);
@ -256,7 +301,10 @@ class HexEditorDialog_t : public QDialog
void pickForeGroundColor(void);
void pickBackGroundColor(void);
void removeAllBookmarks(void);
void openGotoAddrDialog(void);
void openGotoAddrDialog(void);
void copyToClipboard(void);
void pasteFromClipboard(void);
void openFindDialog(void);
};
int hexEditorNumWindows(void);