Added logic to ensure that text highlighting always has coloring preference over other coloring options (activitiy coloring, ROM coloring, etc).

This commit is contained in:
mjbudd77 2021-07-18 19:36:08 -04:00
parent 54aeeebb5d
commit bf41302862
1 changed files with 13 additions and 1 deletions

View File

@ -3676,6 +3676,7 @@ void QHexEdit::paintEvent(QPaintEvent *event)
int x, y, w, h, row, col, nrow, addr; int x, y, w, h, row, col, nrow, addr;
int c, cx, cy, ca, l, recty; int c, cx, cy, ca, l, recty;
int pxCharWidth3; int pxCharWidth3;
int colHlgtStart = -1, colHlgtEnd = -1;
char txt[32]; char txt[32];
QString asciiTxt; QString asciiTxt;
QPainter painter(this); QPainter painter(this);
@ -3788,6 +3789,8 @@ void QHexEdit::paintEvent(QPaintEvent *event)
for ( row=0; row < nrow; row++) for ( row=0; row < nrow; row++)
{ {
colHlgtStart = -1; colHlgtEnd = -1;
l = lineOffset + row; l = lineOffset + row;
x = pxXoffset - pxLineXScroll; x = pxXoffset - pxLineXScroll;
@ -3806,19 +3809,23 @@ void QHexEdit::paintEvent(QPaintEvent *event)
if ( l == txtHlgtStartLine ) if ( l == txtHlgtStartLine )
{ {
hlgtXs = txtHlgtStartChar*3; hlgtXs = txtHlgtStartChar*3;
colHlgtStart = txtHlgtStartChar;
} }
else else
{ {
hlgtXs = 0; hlgtXs = 0;
colHlgtStart = 0;
} }
if ( l == txtHlgtEndLine ) if ( l == txtHlgtEndLine )
{ {
hlgtXe = (txtHlgtEndChar+1)*3; hlgtXe = (txtHlgtEndChar+1)*3;
colHlgtEnd = txtHlgtEndChar+1;
} }
else else
{ {
hlgtXe = 16*3; hlgtXe = 16*3;
colHlgtEnd = 16;
} }
hlgtXd = hlgtXe - hlgtXs; hlgtXd = hlgtXe - hlgtXs;
@ -3906,7 +3913,12 @@ void QHexEdit::paintEvent(QPaintEvent *event)
} }
else else
{ {
if ( viewMode == MODE_NES_ROM ) if ( txtHlgtSet && (col >= colHlgtStart) && (col < colHlgtEnd) )
{
// Background is already colored by highlight
painter.setPen( fgColor );
}
else if ( viewMode == MODE_NES_ROM )
{ {
QColor romBgColor, romFgColor; QColor romBgColor, romFgColor;