1
0
Fork 0

GUI: Added Implemented color (orange/cyan) directional differentiation for sidebar jumps.

Existing configurations will use their color for forwards, and orange for backwards.
This commit is contained in:
Austin Richards 2019-08-03 16:34:45 -04:00 committed by Duncan Ogilvie
parent 60e1dff147
commit 3bad6cb6dc
4 changed files with 53 additions and 10 deletions

View File

@ -452,6 +452,10 @@ void AppearanceDialog::colorInfoListInit()
colorInfoListAppend(tr("Conditional Jump Lines (no jump)"), "SideBarConditionalJumpLineFalseColor", "");
colorInfoListAppend(tr("Unconditional Jump Lines (jump)"), "SideBarUnconditionalJumpLineTrueColor", "");
colorInfoListAppend(tr("Unconditional Jump Lines (no jump)"), "SideBarUnconditionalJumpLineFalseColor", "");
colorInfoListAppend(tr("Conditional Jump Backwards Lines (jump)"), "SideBarConditionalJumpLineTrueBackwardsColor", "");
colorInfoListAppend(tr("Conditional Jump Backwards Lines (no jump)"), "SideBarConditionalJumpLineFalseBackwardsColor", "");
colorInfoListAppend(tr("Unconditional Jump Backwards Lines (jump)"), "SideBarUnconditionalJumpLineTrueBackwardsColor", "");
colorInfoListAppend(tr("Unconditional Jump Backwards Lines (no jump)"), "SideBarUnconditionalJumpLineFalseBackwardsColor", "");
colorInfoListAppend(tr("Jump Lines (executing)"), "SideBarJumpLineExecuteColor", "");
colorInfoListAppend(tr("Code Folding Checkbox Color"), "SideBarCheckBoxForeColor", "SideBarCheckBoxBackColor");
colorInfoListAppend(tr("Background"), "SideBarBackgroundColor", "");

View File

@ -49,6 +49,10 @@ void CPUSideBar::updateColors()
mUnconditionalJumpLineFalseColor = ConfigColor("SideBarUnconditionalJumpLineFalseColor");
mConditionalJumpLineTrueColor = ConfigColor("SideBarConditionalJumpLineTrueColor");
mUnconditionalJumpLineTrueColor = ConfigColor("SideBarUnconditionalJumpLineTrueColor");
mConditionalJumpLineFalseBackwardsColor = ConfigColor("SideBarConditionalJumpLineFalseBackwardsColor");
mUnconditionalJumpLineFalseBackwardsColor = ConfigColor("SideBarUnconditionalJumpLineFalseBackwardsColor");
mConditionalJumpLineTrueBackwardsColor = ConfigColor("SideBarConditionalJumpLineTrueBackwardsColor");
mUnconditionalJumpLineTrueBackwardsColor = ConfigColor("SideBarUnconditionalJumpLineTrueBackwardsColor");
mBulletBreakpointColor = ConfigColor("SideBarBulletBreakpointColor");
mBulletBookmarkColor = ConfigColor("SideBarBulletBookmarkColor");
@ -63,6 +67,8 @@ void CPUSideBar::updateColors()
mUnconditionalPen = QPen(mUnconditionalJumpLineFalseColor, 1, Qt::SolidLine);
mConditionalPen = QPen(mConditionalJumpLineFalseColor, 1, Qt::DashLine);
mUnconditionalBackwardsPen = QPen(mUnconditionalJumpLineFalseBackwardsColor, 1, Qt::SolidLine);
mConditionalBackwardsPen = QPen(mConditionalJumpLineFalseBackwardsColor, 1, Qt::DashLine);
}
void CPUSideBar::updateFonts()
@ -514,14 +520,29 @@ void CPUSideBar::mouseMoveEvent(QMouseEvent* event)
void CPUSideBar::drawJump(QPainter* painter, int startLine, int endLine, int jumpoffset, bool conditional, bool isexecute, bool isactive)
{
painter->save();
if(conditional)
painter->setPen(mConditionalPen);
else
painter->setPen(mUnconditionalPen); //JMP
// Pixel adjustment to make drawing lines even
int pixel_y_offs = 0;
int y_start = fontHeight * (1 + startLine) - 0.5 * fontHeight - pixel_y_offs;
int y_end = fontHeight * (1 + endLine) - 0.5 * fontHeight;
int y_diff = y_end >= y_start ? 1 : -1;
if(conditional)
{
if(y_diff > 0)
painter->setPen(mConditionalPen);
else
painter->setPen(mConditionalBackwardsPen);
}
else //JMP
{
if(y_diff > 0)
painter->setPen(mUnconditionalPen);
else
painter->setPen(mUnconditionalBackwardsPen);
}
if(isactive) //selected
{
QPen activePen = painter->pen();
@ -536,9 +557,19 @@ void CPUSideBar::drawJump(QPainter* painter, int startLine, int endLine, int jum
if(isexecute)
{
if(conditional)
activePen.setColor(mConditionalJumpLineTrueColor);
{
if(y_diff > 0)
activePen.setColor(mConditionalJumpLineTrueColor);
else
activePen.setColor(mConditionalJumpLineTrueBackwardsColor);
}
else
activePen.setColor(mUnconditionalJumpLineTrueColor);
{
if(y_diff > 0)
activePen.setColor(mUnconditionalJumpLineTrueColor);
else
activePen.setColor(mUnconditionalJumpLineTrueBackwardsColor);
}
}
// Update the painter itself with the new pen style
@ -552,8 +583,6 @@ void CPUSideBar::drawJump(QPainter* painter, int startLine, int endLine, int jum
const int JumpPadding = 11;
int x = viewportWidth - jumpoffset * JumpPadding - 15 - fontHeight;
int x_right = viewportWidth - 12;
int y_start = fontHeight * (1 + startLine) - 0.5 * fontHeight - pixel_y_offs;
int y_end = fontHeight * (1 + endLine) - 0.5 * fontHeight;
// special handling of self-jumping
if(startLine == endLine)

View File

@ -98,6 +98,10 @@ private:
QColor mUnconditionalJumpLineFalseColor;
QColor mConditionalJumpLineTrueColor;
QColor mUnconditionalJumpLineTrueColor;
QColor mConditionalJumpLineFalseBackwardsColor;
QColor mUnconditionalJumpLineFalseBackwardsColor;
QColor mConditionalJumpLineTrueBackwardsColor;
QColor mUnconditionalJumpLineTrueBackwardsColor;
QColor mBulletBreakpointColor;
QColor mBulletBookmarkColor;
@ -112,6 +116,8 @@ private:
QPen mUnconditionalPen;
QPen mConditionalPen;
QPen mUnconditionalBackwardsPen;
QPen mConditionalBackwardsPen;
};
#endif // CPUSIDEBAR_H

View File

@ -81,9 +81,13 @@ Configuration::Configuration() : QObject(), noMoreMsgbox(false)
defaultColors.insert("SideBarCipLabelBackgroundColor", QColor("#4040FF"));
defaultColors.insert("SideBarBackgroundColor", QColor("#FFF8F0"));
defaultColors.insert("SideBarConditionalJumpLineTrueColor", QColor("#FF0000"));
defaultColors.insert("SideBarConditionalJumpLineFalseColor", QColor("#808080"));
defaultColors.insert("SideBarConditionalJumpLineFalseColor", QColor("#00BBFF"));
defaultColors.insert("SideBarUnconditionalJumpLineTrueColor", QColor("#FF0000"));
defaultColors.insert("SideBarUnconditionalJumpLineFalseColor", QColor("#808080"));
defaultColors.insert("SideBarUnconditionalJumpLineFalseColor", QColor("#00BBFF"));
defaultColors.insert("SideBarConditionalJumpLineTrueBackwardsColor", QColor("#FF0000"));
defaultColors.insert("SideBarConditionalJumpLineFalseBackwardsColor", QColor("#FFA500"));
defaultColors.insert("SideBarUnconditionalJumpLineTrueBackwardsColor", QColor("#FF0000"));
defaultColors.insert("SideBarUnconditionalJumpLineFalseBackwardsColor", QColor("#FFA500"));
defaultColors.insert("SideBarBulletColor", QColor("#808080"));
defaultColors.insert("SideBarBulletBreakpointColor", QColor("#FF0000"));
defaultColors.insert("SideBarBulletDisabledBreakpointColor", QColor("#00AA00"));