Added activity color options to hex editor menu.
This commit is contained in:
parent
6aacaa5595
commit
6a425f61d1
|
@ -288,10 +288,10 @@ HexEditorDialog_t::HexEditorDialog_t(QWidget *parent)
|
||||||
//QVBoxLayout *mainLayout;
|
//QVBoxLayout *mainLayout;
|
||||||
QGridLayout *grid;
|
QGridLayout *grid;
|
||||||
QMenuBar *menuBar;
|
QMenuBar *menuBar;
|
||||||
QMenu *fileMenu;
|
QMenu *fileMenu, *viewMenu, *hlgtMenu;
|
||||||
QMenu *viewMenu;
|
|
||||||
QAction *saveROM;
|
QAction *saveROM;
|
||||||
QAction *viewRAM, *viewPPU, *viewOAM, *viewROM;
|
QAction *viewRAM, *viewPPU, *viewOAM, *viewROM;
|
||||||
|
QAction *actHlgt, *actHlgtRV;
|
||||||
QActionGroup *group;
|
QActionGroup *group;
|
||||||
|
|
||||||
setWindowTitle("Hex Editor");
|
setWindowTitle("Hex Editor");
|
||||||
|
@ -362,6 +362,30 @@ HexEditorDialog_t::HexEditorDialog_t(QWidget *parent)
|
||||||
viewMenu->addAction(viewROM);
|
viewMenu->addAction(viewROM);
|
||||||
|
|
||||||
viewRAM->setChecked(true); // Set default view
|
viewRAM->setChecked(true); // Set default view
|
||||||
|
|
||||||
|
// Highlighting
|
||||||
|
hlgtMenu = menuBar->addMenu(tr("Highlight"));
|
||||||
|
|
||||||
|
// Highlighting -> Highlight Activity
|
||||||
|
actHlgt = new QAction(tr("Highlight Activity"), this);
|
||||||
|
//actHlgt->setShortcuts(QKeySequence::Open);
|
||||||
|
actHlgt->setStatusTip(tr("Highlight Activity"));
|
||||||
|
actHlgt->setCheckable(true);
|
||||||
|
actHlgt->setChecked(true);
|
||||||
|
connect(actHlgt, SIGNAL(triggered(bool)), this, SLOT(actvHighlightCB(bool)) );
|
||||||
|
|
||||||
|
hlgtMenu->addAction(actHlgt);
|
||||||
|
|
||||||
|
// Highlighting -> Highlight Reverse Video
|
||||||
|
actHlgtRV = new QAction(tr("Highlight Reverse Video"), this);
|
||||||
|
//actHlgtRV->setShortcuts(QKeySequence::Open);
|
||||||
|
actHlgtRV->setStatusTip(tr("Highlight Reverse Video"));
|
||||||
|
actHlgtRV->setCheckable(true);
|
||||||
|
actHlgtRV->setChecked(false);
|
||||||
|
connect(actHlgtRV, SIGNAL(triggered(bool)), this, SLOT(actvHighlightRVCB(bool)) );
|
||||||
|
|
||||||
|
hlgtMenu->addAction(actHlgtRV);
|
||||||
|
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// Menu End
|
// Menu End
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
|
@ -458,6 +482,18 @@ void HexEditorDialog_t::setViewROM(void)
|
||||||
setMode( MODE_NES_ROM );
|
setMode( MODE_NES_ROM );
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
void HexEditorDialog_t::actvHighlightCB(bool enable)
|
||||||
|
{
|
||||||
|
//printf("Highlight: %i \n", enable );
|
||||||
|
editor->setHighlightActivity( enable );
|
||||||
|
}
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void HexEditorDialog_t::actvHighlightRVCB(bool enable)
|
||||||
|
{
|
||||||
|
//printf("Highlight: %i \n", enable );
|
||||||
|
editor->setHighlightReverseVideo( enable );
|
||||||
|
}
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
void HexEditorDialog_t::showMemViewResults (bool reset)
|
void HexEditorDialog_t::showMemViewResults (bool reset)
|
||||||
{
|
{
|
||||||
int memSize;
|
int memSize;
|
||||||
|
@ -587,6 +623,8 @@ QHexEdit::QHexEdit(memBlock_t *blkPtr, QWidget *parent)
|
||||||
editAddr = -1;
|
editAddr = -1;
|
||||||
editValue = 0;
|
editValue = 0;
|
||||||
editMask = 0;
|
editMask = 0;
|
||||||
|
reverseVideo = false;
|
||||||
|
actvHighlightEnable = true;
|
||||||
|
|
||||||
highLightColor[ 0].setRgb( 0x00, 0x00, 0x00 );
|
highLightColor[ 0].setRgb( 0x00, 0x00, 0x00 );
|
||||||
highLightColor[ 1].setRgb( 0x35, 0x40, 0x00 );
|
highLightColor[ 1].setRgb( 0x35, 0x40, 0x00 );
|
||||||
|
@ -605,6 +643,26 @@ QHexEdit::QHexEdit(memBlock_t *blkPtr, QWidget *parent)
|
||||||
highLightColor[14].setRgb( 0xCF, 0x72, 0x00 );
|
highLightColor[14].setRgb( 0xCF, 0x72, 0x00 );
|
||||||
highLightColor[15].setRgb( 0xC7, 0x8B, 0x3C );
|
highLightColor[15].setRgb( 0xC7, 0x8B, 0x3C );
|
||||||
|
|
||||||
|
for (int i=0; i<HIGHLIGHT_ACTIVITY_NUM_COLORS; i++)
|
||||||
|
{
|
||||||
|
float red, green, blue, avg, grayScale;
|
||||||
|
|
||||||
|
red = highLightColor[i].redF();
|
||||||
|
green = highLightColor[i].greenF();
|
||||||
|
blue = highLightColor[i].blueF();
|
||||||
|
|
||||||
|
avg = (red + green + blue) / 3.0;
|
||||||
|
|
||||||
|
if ( avg >= 0.5 )
|
||||||
|
{
|
||||||
|
grayScale = 0.0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
grayScale = 1.0;
|
||||||
|
}
|
||||||
|
rvActvTextColor[i].setRgbF( grayScale, grayScale, grayScale );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
QHexEdit::~QHexEdit(void)
|
QHexEdit::~QHexEdit(void)
|
||||||
|
@ -636,6 +694,16 @@ void QHexEdit::calcFontData(void)
|
||||||
viewLines = (viewHeight - pxLineSpacing) / pxLineSpacing;
|
viewLines = (viewHeight - pxLineSpacing) / pxLineSpacing;
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
void QHexEdit::setHighlightActivity( int enable )
|
||||||
|
{
|
||||||
|
actvHighlightEnable = enable;
|
||||||
|
}
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void QHexEdit::setHighlightReverseVideo( int enable )
|
||||||
|
{
|
||||||
|
reverseVideo = enable;
|
||||||
|
}
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
void QHexEdit::setMode( int mode )
|
void QHexEdit::setMode( int mode )
|
||||||
{
|
{
|
||||||
viewMode = mode;
|
viewMode = mode;
|
||||||
|
@ -1042,10 +1110,18 @@ void QHexEdit::paintEvent(QPaintEvent *event)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( mb->buf[addr].actv > 0 )
|
if ( actvHighlightEnable && (mb->buf[addr].actv > 0) )
|
||||||
|
{
|
||||||
|
if ( reverseVideo )
|
||||||
|
{
|
||||||
|
painter.setPen( rvActvTextColor[ mb->buf[addr].actv ] );
|
||||||
|
painter.fillRect( x - (0.5*pxCharWidth) , y-pxLineSpacing+pxLineLead, 3*pxCharWidth, pxLineSpacing, highLightColor[ mb->buf[addr].actv ] );
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
painter.setPen( highLightColor[ mb->buf[addr].actv ] );
|
painter.setPen( highLightColor[ mb->buf[addr].actv ] );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
painter.setPen( this->palette().color(QPalette::WindowText));
|
painter.setPen( this->palette().color(QPalette::WindowText));
|
||||||
|
|
|
@ -53,6 +53,8 @@ class QHexEdit : public QWidget
|
||||||
void setLine( int newLineOffset );
|
void setLine( int newLineOffset );
|
||||||
void setAddr( int newAddrOffset );
|
void setAddr( int newAddrOffset );
|
||||||
void setScrollBars( QScrollBar *h, QScrollBar *v );
|
void setScrollBars( QScrollBar *h, QScrollBar *v );
|
||||||
|
void setHighlightActivity( int enable );
|
||||||
|
void setHighlightReverseVideo( int enable );
|
||||||
|
|
||||||
static const int HIGHLIGHT_ACTIVITY_NUM_COLORS = 16;
|
static const int HIGHLIGHT_ACTIVITY_NUM_COLORS = 16;
|
||||||
protected:
|
protected:
|
||||||
|
@ -73,6 +75,7 @@ class QHexEdit : public QWidget
|
||||||
QScrollBar *vbar;
|
QScrollBar *vbar;
|
||||||
QScrollBar *hbar;
|
QScrollBar *hbar;
|
||||||
QColor highLightColor[ HIGHLIGHT_ACTIVITY_NUM_COLORS ];
|
QColor highLightColor[ HIGHLIGHT_ACTIVITY_NUM_COLORS ];
|
||||||
|
QColor rvActvTextColor[ HIGHLIGHT_ACTIVITY_NUM_COLORS ];
|
||||||
|
|
||||||
int viewMode;
|
int viewMode;
|
||||||
int lineOffset;
|
int lineOffset;
|
||||||
|
@ -97,6 +100,8 @@ class QHexEdit : public QWidget
|
||||||
int editMask;
|
int editMask;
|
||||||
|
|
||||||
bool cursorBlink;
|
bool cursorBlink;
|
||||||
|
bool reverseVideo;
|
||||||
|
bool actvHighlightEnable;
|
||||||
};
|
};
|
||||||
|
|
||||||
class HexEditorDialog_t : public QDialog
|
class HexEditorDialog_t : public QDialog
|
||||||
|
@ -150,5 +155,6 @@ class HexEditorDialog_t : public QDialog
|
||||||
void setViewPPU(void);
|
void setViewPPU(void);
|
||||||
void setViewOAM(void);
|
void setViewOAM(void);
|
||||||
void setViewROM(void);
|
void setViewROM(void);
|
||||||
|
void actvHighlightCB(bool value);
|
||||||
|
void actvHighlightRVCB(bool value);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue