Added a cursor row/column color highlight option to Qt hex editor.
This commit is contained in:
parent
68555d98ab
commit
a0088e271b
|
@ -1310,6 +1310,16 @@ HexEditorDialog_t::HexEditorDialog_t(QWidget *parent)
|
||||||
|
|
||||||
colorMenu->addAction(actHlgtRV);
|
colorMenu->addAction(actHlgtRV);
|
||||||
|
|
||||||
|
// Color -> Highlight Reverse Video
|
||||||
|
rolColHlgtAct = new QAction(tr("Highlight &Cursor Row/Column"), this);
|
||||||
|
//rolColHlgtAct->setShortcuts(QKeySequence::Open);
|
||||||
|
rolColHlgtAct->setStatusTip(tr("Highlight Cursor Row/Column"));
|
||||||
|
rolColHlgtAct->setCheckable(true);
|
||||||
|
rolColHlgtAct->setChecked(false);
|
||||||
|
connect(rolColHlgtAct, SIGNAL(triggered(bool)), this, SLOT(rolColHlgtChanged(bool)) );
|
||||||
|
|
||||||
|
colorMenu->addAction(rolColHlgtAct);
|
||||||
|
|
||||||
// Color -> ForeGround Color
|
// Color -> ForeGround Color
|
||||||
actColorFG = new QAction(tr("&ForeGround Color"), this);
|
actColorFG = new QAction(tr("&ForeGround Color"), this);
|
||||||
//actColorFG->setShortcuts(QKeySequence::Open);
|
//actColorFG->setShortcuts(QKeySequence::Open);
|
||||||
|
@ -1491,8 +1501,12 @@ void HexEditorDialog_t::pickForeGroundColor(void)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
QColorDialog dialog( this );
|
QColorDialog dialog( this );
|
||||||
|
QPalette pal;
|
||||||
|
|
||||||
|
pal = editor->palette();
|
||||||
|
|
||||||
dialog.setOption( QColorDialog::DontUseNativeDialog, true );
|
dialog.setOption( QColorDialog::DontUseNativeDialog, true );
|
||||||
|
dialog.setCurrentColor( pal.color(QPalette::WindowText) );
|
||||||
ret = dialog.exec();
|
ret = dialog.exec();
|
||||||
|
|
||||||
if ( ret == QDialog::Accepted )
|
if ( ret == QDialog::Accepted )
|
||||||
|
@ -1509,8 +1523,12 @@ void HexEditorDialog_t::pickBackGroundColor(void)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
QColorDialog dialog( this );
|
QColorDialog dialog( this );
|
||||||
|
QPalette pal;
|
||||||
|
|
||||||
|
pal = editor->palette();
|
||||||
|
|
||||||
dialog.setOption( QColorDialog::DontUseNativeDialog, true );
|
dialog.setOption( QColorDialog::DontUseNativeDialog, true );
|
||||||
|
dialog.setCurrentColor( pal.color(QPalette::Window) );
|
||||||
ret = dialog.exec();
|
ret = dialog.exec();
|
||||||
|
|
||||||
if ( ret == QDialog::Accepted )
|
if ( ret == QDialog::Accepted )
|
||||||
|
@ -1708,6 +1726,12 @@ void HexEditorDialog_t::actvHighlightRVCB(bool enable)
|
||||||
editor->setHighlightReverseVideo( enable );
|
editor->setHighlightReverseVideo( enable );
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
void HexEditorDialog_t::rolColHlgtChanged(bool enable)
|
||||||
|
{
|
||||||
|
//printf("Highlight: %i \n", enable );
|
||||||
|
editor->setRowColHlgtEna( enable );
|
||||||
|
}
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
void HexEditorDialog_t::openDebugSymbolEditWindow( int addr )
|
void HexEditorDialog_t::openDebugSymbolEditWindow( int addr )
|
||||||
{
|
{
|
||||||
int ret, bank;
|
int ret, bank;
|
||||||
|
@ -1846,6 +1870,9 @@ QHexEdit::QHexEdit(QWidget *parent)
|
||||||
g_config->getOption("SDL.HexEditFgColor", &colorString);
|
g_config->getOption("SDL.HexEditFgColor", &colorString);
|
||||||
fg.setNamedColor( colorString.c_str() );
|
fg.setNamedColor( colorString.c_str() );
|
||||||
|
|
||||||
|
rowColHlgtColor = QColor("dark blue");
|
||||||
|
rolColHlgtEna = false;
|
||||||
|
|
||||||
pal = this->palette();
|
pal = this->palette();
|
||||||
pal.setColor(QPalette::Base , bg );
|
pal.setColor(QPalette::Base , bg );
|
||||||
pal.setColor(QPalette::Window , bg );
|
pal.setColor(QPalette::Window , bg );
|
||||||
|
@ -1980,8 +2007,6 @@ void QHexEdit::setForeGroundColor( QColor fg )
|
||||||
QPalette pal;
|
QPalette pal;
|
||||||
|
|
||||||
pal = this->palette();
|
pal = this->palette();
|
||||||
//pal.setColor(QPalette::Base , Qt::black);
|
|
||||||
//pal.setColor(QPalette::Window , Qt::black);
|
|
||||||
pal.setColor(QPalette::WindowText, fg );
|
pal.setColor(QPalette::WindowText, fg );
|
||||||
|
|
||||||
this->setPalette(pal);
|
this->setPalette(pal);
|
||||||
|
@ -1992,9 +2017,7 @@ void QHexEdit::setBackGroundColor( QColor bg )
|
||||||
QPalette pal;
|
QPalette pal;
|
||||||
|
|
||||||
pal = this->palette();
|
pal = this->palette();
|
||||||
//pal.setColor(QPalette::Base , Qt::black);
|
|
||||||
pal.setColor(QPalette::Window , bg );
|
pal.setColor(QPalette::Window , bg );
|
||||||
//pal.setColor(QPalette::WindowText, fg );
|
|
||||||
|
|
||||||
this->setPalette(pal);
|
this->setPalette(pal);
|
||||||
}
|
}
|
||||||
|
@ -2939,6 +2962,11 @@ void QHexEdit::contextMenuEvent(QContextMenuEvent *event)
|
||||||
|
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
void QHexEdit::setRowColHlgtEna(bool val)
|
||||||
|
{
|
||||||
|
rolColHlgtEna = val;
|
||||||
|
}
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
void QHexEdit::addBookMarkCB(void)
|
void QHexEdit::addBookMarkCB(void)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -2962,18 +2990,18 @@ void QHexEdit::addBookMarkCB(void)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
dialog.setWindowTitle( tr("Add Bookmark") );
|
dialog.setWindowTitle( tr("Add Bookmark") );
|
||||||
dialog.setLabelText( tr("Specify New Bookmark Description") );
|
dialog.setLabelText( tr("Specify New Bookmark Description") );
|
||||||
dialog.setOkButtonText( tr("Add") );
|
dialog.setOkButtonText( tr("Add") );
|
||||||
dialog.setTextValue( tr(stmp) );
|
dialog.setTextValue( tr(stmp) );
|
||||||
|
|
||||||
ret = dialog.exec();
|
ret = dialog.exec();
|
||||||
|
|
||||||
if ( QDialog::Accepted == ret )
|
if ( QDialog::Accepted == ret )
|
||||||
{
|
{
|
||||||
hbm.addBookMark( ctxAddr, viewMode, dialog.textValue().toStdString().c_str() );
|
hbm.addBookMark( ctxAddr, viewMode, dialog.textValue().toStdString().c_str() );
|
||||||
parent->populateBookmarkMenu();
|
parent->populateBookmarkMenu();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
static int RamFreezeCB(char *name, uint32 a, uint8 v, int compare,int s,int type, void *data)
|
static int RamFreezeCB(char *name, uint32 a, uint8 v, int compare,int s,int type, void *data)
|
||||||
|
@ -3580,6 +3608,20 @@ void QHexEdit::paintEvent(QPaintEvent *event)
|
||||||
}
|
}
|
||||||
cursorAddr = ca;
|
cursorAddr = ca;
|
||||||
|
|
||||||
|
if ( rolColHlgtEna )
|
||||||
|
{
|
||||||
|
painter.fillRect( 0 , cy, viewWidth, pxCursorHeight, rowColHlgtColor );
|
||||||
|
|
||||||
|
if ( cursorPosX < 32 )
|
||||||
|
{
|
||||||
|
painter.fillRect( cx - (0.5*pxCharWidth) , 0, (3*pxCharWidth), viewHeight, rowColHlgtColor );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
painter.fillRect( cx, 0, (pxCharWidth), viewHeight, rowColHlgtColor );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( cursorBlink )
|
if ( cursorBlink )
|
||||||
{
|
{
|
||||||
painter.fillRect( cx , cy, pxCharWidth, pxCursorHeight, QColor("gray") );
|
painter.fillRect( cx , cy, pxCharWidth, pxCursorHeight, QColor("gray") );
|
||||||
|
@ -3592,7 +3634,6 @@ void QHexEdit::paintEvent(QPaintEvent *event)
|
||||||
|
|
||||||
txtHlgtSet = textIsHighlighted();
|
txtHlgtSet = textIsHighlighted();
|
||||||
|
|
||||||
|
|
||||||
for ( row=0; row < nrow; row++)
|
for ( row=0; row < nrow; row++)
|
||||||
{
|
{
|
||||||
l = lineOffset + row;
|
l = lineOffset + row;
|
||||||
|
@ -3774,7 +3815,13 @@ void QHexEdit::paintEvent(QPaintEvent *event)
|
||||||
}
|
}
|
||||||
|
|
||||||
painter.setPen( this->palette().color(QPalette::WindowText));
|
painter.setPen( this->palette().color(QPalette::WindowText));
|
||||||
painter.drawText( pxHexOffset - pxLineXScroll, pxLineSpacing, "00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F" );
|
for (x=0; x<16; x++)
|
||||||
|
{
|
||||||
|
txt[0] = '0';
|
||||||
|
txt[1] = convToXchar( x );
|
||||||
|
txt[2] = 0;
|
||||||
|
painter.drawText( pxHexOffset - pxLineXScroll + (x * pxCharWidth * 3), pxLineSpacing, txt );
|
||||||
|
}
|
||||||
painter.drawLine( pxHexOffset - (pxCharWidth/2) - pxLineXScroll, 0, pxHexOffset - (pxCharWidth/2) - pxLineXScroll, h );
|
painter.drawLine( pxHexOffset - (pxCharWidth/2) - pxLineXScroll, 0, pxHexOffset - (pxCharWidth/2) - pxLineXScroll, h );
|
||||||
painter.drawLine( pxHexAscii - (pxCharWidth/2) - pxLineXScroll, 0, pxHexAscii - (pxCharWidth/2) - pxLineXScroll, h );
|
painter.drawLine( pxHexAscii - (pxCharWidth/2) - pxLineXScroll, 0, pxHexAscii - (pxCharWidth/2) - pxLineXScroll, h );
|
||||||
painter.drawLine( 0, pxLineSpacing + (pxLineLead), w, pxLineSpacing + (pxLineLead) );
|
painter.drawLine( 0, pxLineSpacing + (pxLineLead), w, pxLineSpacing + (pxLineLead) );
|
||||||
|
|
|
@ -140,6 +140,7 @@ class QHexEdit : public QWidget
|
||||||
void clearHighlight(void);
|
void clearHighlight(void);
|
||||||
int findPattern( std::vector <unsigned char> &varray, int dir );
|
int findPattern( std::vector <unsigned char> &varray, int dir );
|
||||||
void requestUpdate(void);
|
void requestUpdate(void);
|
||||||
|
void setRowColHlgtEna(bool val);
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
MODE_NES_RAM = 0,
|
MODE_NES_RAM = 0,
|
||||||
|
@ -182,6 +183,7 @@ class QHexEdit : public QWidget
|
||||||
QScrollBar *hbar;
|
QScrollBar *hbar;
|
||||||
QColor highLightColor[ HIGHLIGHT_ACTIVITY_NUM_COLORS ];
|
QColor highLightColor[ HIGHLIGHT_ACTIVITY_NUM_COLORS ];
|
||||||
QColor rvActvTextColor[ HIGHLIGHT_ACTIVITY_NUM_COLORS ];
|
QColor rvActvTextColor[ HIGHLIGHT_ACTIVITY_NUM_COLORS ];
|
||||||
|
QColor rowColHlgtColor;
|
||||||
QClipboard *clipboard;
|
QClipboard *clipboard;
|
||||||
|
|
||||||
HexEditorDialog_t *parent;
|
HexEditorDialog_t *parent;
|
||||||
|
@ -233,6 +235,7 @@ class QHexEdit : public QWidget
|
||||||
bool actvHighlightEnable;
|
bool actvHighlightEnable;
|
||||||
bool mouseLeftBtnDown;
|
bool mouseLeftBtnDown;
|
||||||
bool updateRequested;
|
bool updateRequested;
|
||||||
|
bool rolColHlgtEna;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void jumpToROM(void);
|
void jumpToROM(void);
|
||||||
|
@ -303,6 +306,7 @@ class HexEditorDialog_t : public QDialog
|
||||||
QAction *undoEditAct;
|
QAction *undoEditAct;
|
||||||
QAction *loadTableAct;
|
QAction *loadTableAct;
|
||||||
QAction *unloadTableAct;
|
QAction *unloadTableAct;
|
||||||
|
QAction *rolColHlgtAct;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -323,6 +327,7 @@ class HexEditorDialog_t : public QDialog
|
||||||
void setViewROM(void);
|
void setViewROM(void);
|
||||||
void actvHighlightCB(bool value);
|
void actvHighlightCB(bool value);
|
||||||
void actvHighlightRVCB(bool value);
|
void actvHighlightRVCB(bool value);
|
||||||
|
void rolColHlgtChanged(bool);
|
||||||
void pickForeGroundColor(void);
|
void pickForeGroundColor(void);
|
||||||
void pickBackGroundColor(void);
|
void pickBackGroundColor(void);
|
||||||
void removeAllBookmarks(void);
|
void removeAllBookmarks(void);
|
||||||
|
|
Loading…
Reference in New Issue