More tidying
This commit is contained in:
@@ -251,8 +251,8 @@ namespace Widgets
|
|||||||
const ByteItem* endItem,
|
const ByteItem* endItem,
|
||||||
QPainter* painter
|
QPainter* painter
|
||||||
) {
|
) {
|
||||||
constexpr auto padding = 6;
|
static constexpr auto PADDING = 6;
|
||||||
constexpr auto rectRadius = 4;
|
static constexpr auto RECT_RADIUS = 4;
|
||||||
|
|
||||||
const auto startItemPos = startItem->position();
|
const auto startItemPos = startItem->position();
|
||||||
const auto endItemPos = endItem->position();
|
const auto endItemPos = endItem->position();
|
||||||
@@ -269,22 +269,22 @@ namespace Widgets
|
|||||||
const auto rightMostItemPos = rightMostItem->position();
|
const auto rightMostItemPos = rightMostItem->position();
|
||||||
|
|
||||||
painterPath.addRoundedRect(
|
painterPath.addRoundedRect(
|
||||||
leftMostItemPos.x() - padding,
|
leftMostItemPos.x() - PADDING,
|
||||||
startItemPos.y() - padding,
|
startItemPos.y() - PADDING,
|
||||||
(rightMostItemPos.x() + rightMostItem->size().width()) - leftMostItemPos.x() + (padding * 2),
|
(rightMostItemPos.x() + rightMostItem->size().width()) - leftMostItemPos.x() + (PADDING * 2),
|
||||||
(endItemPos.y() + endItemSize.height()) - startItemPos.y() + (padding * 2),
|
(endItemPos.y() + endItemSize.height()) - startItemPos.y() + (PADDING * 2),
|
||||||
rectRadius,
|
RECT_RADIUS,
|
||||||
rectRadius
|
RECT_RADIUS
|
||||||
);
|
);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
painterPath.addRoundedRect(
|
painterPath.addRoundedRect(
|
||||||
startItemPos.x() - padding,
|
startItemPos.x() - PADDING,
|
||||||
startItemPos.y() - padding,
|
startItemPos.y() - PADDING,
|
||||||
(endItemPos.x() + endItemSize.width()) - startItemPos.x() + (padding * 2),
|
(endItemPos.x() + endItemSize.width()) - startItemPos.x() + (PADDING * 2),
|
||||||
(endItemPos.y() + endItemSize.height()) - startItemPos.y() + (padding * 2),
|
(endItemPos.y() + endItemSize.height()) - startItemPos.y() + (PADDING * 2),
|
||||||
rectRadius,
|
RECT_RADIUS,
|
||||||
rectRadius
|
RECT_RADIUS
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -305,8 +305,8 @@ namespace Widgets
|
|||||||
{
|
{
|
||||||
auto labelText = item->focusedMemoryRegion.name;
|
auto labelText = item->focusedMemoryRegion.name;
|
||||||
|
|
||||||
static constexpr auto lineColor = QColor{0x4F, 0x4F, 0x4F};
|
static constexpr auto LINE_COLOR = QColor{0x4F, 0x4F, 0x4F};
|
||||||
static constexpr auto labelFontColor = QColor{0x68, 0x68, 0x68};
|
static constexpr auto LABEL_FONT_COLOR = QColor{0x68, 0x68, 0x68};
|
||||||
|
|
||||||
static auto labelFont = QFont{"'Ubuntu', sans-serif"};
|
static auto labelFont = QFont{"'Ubuntu', sans-serif"};
|
||||||
labelFont.setPixelSize(12);
|
labelFont.setPixelSize(12);
|
||||||
@@ -337,7 +337,7 @@ namespace Widgets
|
|||||||
labelSize.height()
|
labelSize.height()
|
||||||
};
|
};
|
||||||
|
|
||||||
painter->setPen(lineColor);
|
painter->setPen(LINE_COLOR);
|
||||||
|
|
||||||
if (item->focusedMemoryRegion.addressRange.startAddress != item->focusedMemoryRegion.addressRange.endAddress) {
|
if (item->focusedMemoryRegion.addressRange.startAddress != item->focusedMemoryRegion.addressRange.endAddress) {
|
||||||
const auto lineStartX =
|
const auto lineStartX =
|
||||||
@@ -375,7 +375,7 @@ namespace Widgets
|
|||||||
verticalLineYEnd + 4
|
verticalLineYEnd + 4
|
||||||
});
|
});
|
||||||
|
|
||||||
painter->setPen(labelFontColor);
|
painter->setPen(LABEL_FONT_COLOR);
|
||||||
painter->drawText(labelRect, Qt::AlignCenter, labelText);
|
painter->drawText(labelRect, Qt::AlignCenter, labelText);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -385,8 +385,8 @@ namespace Widgets
|
|||||||
|
|
||||||
auto labelText = item->valueLabel.value_or("??");
|
auto labelText = item->valueLabel.value_or("??");
|
||||||
|
|
||||||
static const auto lineColor = QColor{0x4F, 0x4F, 0x4F};
|
static constexpr auto LINE_COLOR = QColor{0x4F, 0x4F, 0x4F};
|
||||||
static const auto labelFontColor = QColor{0x94, 0x6F, 0x30};
|
static constexpr auto LABEL_FONT_COLOR = QColor{0x94, 0x6F, 0x30};
|
||||||
|
|
||||||
static auto labelFont = QFont{"'Ubuntu', sans-serif"};
|
static auto labelFont = QFont{"'Ubuntu', sans-serif"};
|
||||||
labelFont.setPixelSize(12);
|
labelFont.setPixelSize(12);
|
||||||
@@ -414,7 +414,7 @@ namespace Widgets
|
|||||||
labelSize.height()
|
labelSize.height()
|
||||||
};
|
};
|
||||||
|
|
||||||
painter->setPen(lineColor);
|
painter->setPen(LINE_COLOR);
|
||||||
|
|
||||||
if (item->focusedMemoryRegion.addressRange.startAddress != item->focusedMemoryRegion.addressRange.endAddress) {
|
if (item->focusedMemoryRegion.addressRange.startAddress != item->focusedMemoryRegion.addressRange.endAddress) {
|
||||||
const auto lineStartX = position.x() + item->items.front()->relativePosition.x() + (ByteItem::WIDTH / 2);
|
const auto lineStartX = position.x() + item->items.front()->relativePosition.x() + (ByteItem::WIDTH / 2);
|
||||||
@@ -447,9 +447,9 @@ namespace Widgets
|
|||||||
* Draw a circle just above the first byte item of the region, to indicate the first byte used to generate
|
* Draw a circle just above the first byte item of the region, to indicate the first byte used to generate
|
||||||
* the value (which will depend on the configured endianness of the region).
|
* the value (which will depend on the configured endianness of the region).
|
||||||
*/
|
*/
|
||||||
painter->setBrush(lineColor);
|
painter->setBrush(LINE_COLOR);
|
||||||
|
|
||||||
constexpr auto radius = 2;
|
static constexpr auto RADIUS = 2;
|
||||||
painter->drawEllipse(
|
painter->drawEllipse(
|
||||||
QPoint{
|
QPoint{
|
||||||
item->focusedMemoryRegion.endianness == TargetMemoryEndianness::BIG ? lineStartX : lineEndX,
|
item->focusedMemoryRegion.endianness == TargetMemoryEndianness::BIG ? lineStartX : lineEndX,
|
||||||
@@ -457,8 +457,8 @@ namespace Widgets
|
|||||||
? verticalLineYStart
|
? verticalLineYStart
|
||||||
: position.y() + item->groupSize.height() - FocusedRegionGroupItem::ANNOTATION_HEIGHT + 4 + 5
|
: position.y() + item->groupSize.height() - FocusedRegionGroupItem::ANNOTATION_HEIGHT + 4 + 5
|
||||||
},
|
},
|
||||||
radius,
|
RADIUS,
|
||||||
radius
|
RADIUS
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -469,7 +469,7 @@ namespace Widgets
|
|||||||
verticalLineYStart
|
verticalLineYStart
|
||||||
});
|
});
|
||||||
|
|
||||||
painter->setPen(labelFontColor);
|
painter->setPen(LABEL_FONT_COLOR);
|
||||||
painter->drawText(labelRect, Qt::AlignCenter, labelText);
|
painter->drawText(labelRect, Qt::AlignCenter, labelText);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -494,9 +494,9 @@ namespace Widgets
|
|||||||
16
|
16
|
||||||
).rightJustified(8, '0').toUpper();
|
).rightJustified(8, '0').toUpper();
|
||||||
|
|
||||||
static constexpr auto lineColor = QColor{0x4F, 0x4F, 0x4F};
|
static constexpr auto LINE_COLOR = QColor{0x4F, 0x4F, 0x4F};
|
||||||
static constexpr auto headingLabelFontColor = QColor{0x6F, 0x6F, 0x6F};
|
static constexpr auto HEADING_LABEL_FONT_COLOR = QColor{0x6F, 0x6F, 0x6F};
|
||||||
static constexpr auto valueLabelFontColor = QColor{0x94, 0x6F, 0x30, 230};
|
static constexpr auto VALUE_LABEL_FONT_COLOR = QColor{0x94, 0x6F, 0x30, 230};
|
||||||
|
|
||||||
static auto headingLabelFont = QFont{"'Ubuntu', sans-serif"};
|
static auto headingLabelFont = QFont{"'Ubuntu', sans-serif"};
|
||||||
headingLabelFont.setPixelSize(13);
|
headingLabelFont.setPixelSize(13);
|
||||||
@@ -518,12 +518,12 @@ namespace Widgets
|
|||||||
auto stackPointerHeadingLabelSize = fontMetrics.size(Qt::TextSingleLine, stackPointerHeadingText);
|
auto stackPointerHeadingLabelSize = fontMetrics.size(Qt::TextSingleLine, stackPointerHeadingText);
|
||||||
auto stackPointerLabelSize = fontMetrics.size(Qt::TextSingleLine, stackPointerValueText);
|
auto stackPointerLabelSize = fontMetrics.size(Qt::TextSingleLine, stackPointerValueText);
|
||||||
|
|
||||||
static constexpr auto labelLineHeight = 4;
|
static constexpr auto LABEL_LINE_HEIGHT = 4;
|
||||||
static constexpr auto labelBottomMargin = 10;
|
static constexpr auto LABEL_BOTTOM_MARGIN = 10;
|
||||||
static constexpr auto labelRightMargin = 3;
|
static constexpr auto LABEL_RIGHT_MARGIN = 3;
|
||||||
|
|
||||||
const auto heightOffset = headingLabelSize.height() + stackSizeHeadingLabelSize.height()
|
const auto heightOffset = headingLabelSize.height() + stackSizeHeadingLabelSize.height()
|
||||||
+ stackPointerHeadingLabelSize.height() + (labelBottomMargin * 3) + 15;
|
+ stackPointerHeadingLabelSize.height() + (LABEL_BOTTOM_MARGIN * 3) + 15;
|
||||||
|
|
||||||
const auto verticalLineYStart = static_cast<int>(position.y() + heightOffset - 5);
|
const auto verticalLineYStart = static_cast<int>(position.y() + heightOffset - 5);
|
||||||
const auto verticalLineYEnd = static_cast<int>(position.y() + heightOffset);
|
const auto verticalLineYEnd = static_cast<int>(position.y() + heightOffset);
|
||||||
@@ -534,7 +534,7 @@ namespace Widgets
|
|||||||
const auto labelRect = QRect{
|
const auto labelRect = QRect{
|
||||||
position.x() + (groupWidth - headingLabelSize.width()) / 2,
|
position.x() + (groupWidth - headingLabelSize.width()) / 2,
|
||||||
verticalLineYStart - stackPointerHeadingLabelSize.height() - stackSizeHeadingLabelSize.height()
|
verticalLineYStart - stackPointerHeadingLabelSize.height() - stackSizeHeadingLabelSize.height()
|
||||||
- headingLabelSize.height() - labelLineHeight - (labelBottomMargin * 2) - 3,
|
- headingLabelSize.height() - LABEL_LINE_HEIGHT - (LABEL_BOTTOM_MARGIN * 2) - 3,
|
||||||
headingLabelSize.width(),
|
headingLabelSize.width(),
|
||||||
headingLabelSize.height()
|
headingLabelSize.height()
|
||||||
};
|
};
|
||||||
@@ -543,14 +543,14 @@ namespace Widgets
|
|||||||
labelRect.left() + (labelRect.width() / 2) - (
|
labelRect.left() + (labelRect.width() / 2) - (
|
||||||
(stackPointerHeadingLabelSize.width() + stackPointerLabelSize.width()) / 2
|
(stackPointerHeadingLabelSize.width() + stackPointerLabelSize.width()) / 2
|
||||||
),
|
),
|
||||||
labelRect.bottom() + labelBottomMargin,
|
labelRect.bottom() + LABEL_BOTTOM_MARGIN,
|
||||||
stackPointerHeadingLabelSize.width(),
|
stackPointerHeadingLabelSize.width(),
|
||||||
stackPointerHeadingLabelSize.height()
|
stackPointerHeadingLabelSize.height()
|
||||||
};
|
};
|
||||||
|
|
||||||
const auto stackPointerValueLabelRect = QRect{
|
const auto stackPointerValueLabelRect = QRect{
|
||||||
stackPointerHeadingLabelRect.right() + labelRightMargin,
|
stackPointerHeadingLabelRect.right() + LABEL_RIGHT_MARGIN,
|
||||||
labelRect.bottom() + labelBottomMargin,
|
labelRect.bottom() + LABEL_BOTTOM_MARGIN,
|
||||||
stackPointerLabelSize.width(),
|
stackPointerLabelSize.width(),
|
||||||
stackPointerLabelSize.height()
|
stackPointerLabelSize.height()
|
||||||
};
|
};
|
||||||
@@ -559,19 +559,19 @@ namespace Widgets
|
|||||||
labelRect.left() + (labelRect.width() / 2) - (
|
labelRect.left() + (labelRect.width() / 2) - (
|
||||||
(stackSizeHeadingLabelSize.width() + stackSizeLabelSize.width()) / 2
|
(stackSizeHeadingLabelSize.width() + stackSizeLabelSize.width()) / 2
|
||||||
),
|
),
|
||||||
stackPointerHeadingLabelRect.bottom() + labelBottomMargin,
|
stackPointerHeadingLabelRect.bottom() + LABEL_BOTTOM_MARGIN,
|
||||||
stackSizeHeadingLabelSize.width(),
|
stackSizeHeadingLabelSize.width(),
|
||||||
stackSizeHeadingLabelSize.height()
|
stackSizeHeadingLabelSize.height()
|
||||||
};
|
};
|
||||||
|
|
||||||
const auto stackSizeValueLabelRect = QRect{
|
const auto stackSizeValueLabelRect = QRect{
|
||||||
stackSizeHeadingLabelRect.right() + labelRightMargin,
|
stackSizeHeadingLabelRect.right() + LABEL_RIGHT_MARGIN,
|
||||||
stackPointerHeadingLabelRect.bottom() + labelBottomMargin,
|
stackPointerHeadingLabelRect.bottom() + LABEL_BOTTOM_MARGIN,
|
||||||
stackSizeLabelSize.width(),
|
stackSizeLabelSize.width(),
|
||||||
stackSizeLabelSize.height()
|
stackSizeLabelSize.height()
|
||||||
};
|
};
|
||||||
|
|
||||||
painter->setPen(lineColor);
|
painter->setPen(LINE_COLOR);
|
||||||
|
|
||||||
painter->drawLine(QLine{
|
painter->drawLine(QLine{
|
||||||
lineStartX,
|
lineStartX,
|
||||||
@@ -596,19 +596,19 @@ namespace Widgets
|
|||||||
|
|
||||||
painter->drawLine(QLine{
|
painter->drawLine(QLine{
|
||||||
position.x() + groupWidth / 2,
|
position.x() + groupWidth / 2,
|
||||||
verticalLineYStart - labelLineHeight,
|
verticalLineYStart - LABEL_LINE_HEIGHT,
|
||||||
position.x() + groupWidth / 2,
|
position.x() + groupWidth / 2,
|
||||||
verticalLineYStart
|
verticalLineYStart
|
||||||
});
|
});
|
||||||
|
|
||||||
painter->setPen(headingLabelFontColor);
|
painter->setPen(HEADING_LABEL_FONT_COLOR);
|
||||||
|
|
||||||
painter->drawText(labelRect, Qt::AlignCenter, headingText);
|
painter->drawText(labelRect, Qt::AlignCenter, headingText);
|
||||||
painter->drawText(stackSizeHeadingLabelRect, Qt::AlignCenter, stackSizeHeadingText);
|
painter->drawText(stackSizeHeadingLabelRect, Qt::AlignCenter, stackSizeHeadingText);
|
||||||
painter->drawText(stackPointerHeadingLabelRect, Qt::AlignCenter, stackPointerHeadingText);
|
painter->drawText(stackPointerHeadingLabelRect, Qt::AlignCenter, stackPointerHeadingText);
|
||||||
|
|
||||||
painter->setFont(valueFont);
|
painter->setFont(valueFont);
|
||||||
painter->setPen(valueLabelFontColor);
|
painter->setPen(VALUE_LABEL_FONT_COLOR);
|
||||||
painter->drawText(stackSizeValueLabelRect, Qt::AlignCenter, stackSizeValueText);
|
painter->drawText(stackSizeValueLabelRect, Qt::AlignCenter, stackSizeValueText);
|
||||||
painter->drawText(stackPointerValueLabelRect, Qt::AlignCenter, stackPointerValueText);
|
painter->drawText(stackPointerValueLabelRect, Qt::AlignCenter, stackPointerValueText);
|
||||||
}
|
}
|
||||||
@@ -620,65 +620,57 @@ namespace Widgets
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static constexpr auto standardBackgroundColor = QColor{0x32, 0x33, 0x30, 0};
|
static constexpr auto STANDARD_BACKGROUND_COLOR = QColor{0x32, 0x33, 0x30, 0};
|
||||||
static constexpr auto selectedBackgroundColor = QColor{0x3C, 0x59, 0x5C, 255};
|
static constexpr auto SELECTED_BACKGROUND_COLOR = QColor{0x3C, 0x59, 0x5C, 255};
|
||||||
static constexpr auto primaryHighlightedBackgroundColor = QColor{0x3B, 0x59, 0x37, 255};
|
static constexpr auto PRIMARY_HIGHLIGHTED_BACKGROUND_COLOR = QColor{0x3B, 0x59, 0x37, 255};
|
||||||
static constexpr auto groupedBackgroundColor = QColor{0x44, 0x44, 0x41, 255};
|
static constexpr auto GROUPED_BACKGROUND_COLOR = QColor{0x44, 0x44, 0x41, 255};
|
||||||
static constexpr auto stackMemoryBackgroundColor = QColor{0x44, 0x44, 0x41, 200};
|
static constexpr auto STACK_MEMORY_BACKGROUND_COLOR = QColor{0x44, 0x44, 0x41, 200};
|
||||||
static constexpr auto stackMemoryBarColor = QColor{0x67, 0x57, 0x20, 255};
|
static constexpr auto STACK_MEMORY_BAR_COLOR = QColor{0x67, 0x57, 0x20, 255};
|
||||||
static constexpr auto changedMemoryBackgroundColor = QColor{0x5C, 0x49, 0x5D, 200};
|
static constexpr auto CHANGED_MEMORY_BACKGROUND_COLOR = QColor{0x5C, 0x49, 0x5D, 200};
|
||||||
static constexpr auto changedMemoryFadedBackgroundColor = QColor{0x5C, 0x49, 0x5D, 125};
|
static constexpr auto CHANGED_MEMORY_FADED_BACKGROUND_COLOR = QColor{0x5C, 0x49, 0x5D, 125};
|
||||||
|
static constexpr auto HOVERED_STACK_MEMORY_BACKGROUND_COLOR = QColor{0x44, 0x44, 0x41, 255};
|
||||||
|
static constexpr auto HOVERED_BACKGROUND_COLOR = QColor{0x8E, 0x8B, 0x83, 70};
|
||||||
|
static constexpr auto STANDARD_FONT_COLOR = QColor{0xAF, 0xB1, 0xB3};
|
||||||
|
static constexpr auto FADED_FONT_COLOR = QColor{0xAF, 0xB1, 0xB3, 100};
|
||||||
|
static constexpr auto ASCII_FONT_COLOR = QColor{0xA7, 0x77, 0x26};
|
||||||
|
static constexpr auto CHANGED_MEMORY_ASCII_FONT_COLOR = QColor{0xB7, 0x7F, 0x21};
|
||||||
|
|
||||||
static const auto hoveredStackMemoryBackgroundColor = QColor{
|
static constexpr auto BYTE_ITEM_RECT = QRect{0, 0, ByteItem::WIDTH, ByteItem::HEIGHT};
|
||||||
stackMemoryBackgroundColor.red(),
|
static constexpr auto BYTE_ITEM_SIZE = BYTE_ITEM_RECT.size();
|
||||||
stackMemoryBackgroundColor.green(),
|
|
||||||
stackMemoryBackgroundColor.blue(),
|
|
||||||
255
|
|
||||||
};
|
|
||||||
|
|
||||||
static constexpr auto hoveredBackgroundColor = QColor{0x8E, 0x8B, 0x83, 70};
|
auto standardTemplatePixmap = QPixmap{BYTE_ITEM_SIZE};
|
||||||
|
standardTemplatePixmap.fill(STANDARD_BACKGROUND_COLOR);
|
||||||
|
|
||||||
static constexpr auto standardFontColor = QColor{0xAF, 0xB1, 0xB3};
|
auto primaryHighlightedTemplatePixmap = QPixmap{BYTE_ITEM_SIZE};
|
||||||
static constexpr auto fadedFontColor = QColor{0xAF, 0xB1, 0xB3, 100};
|
primaryHighlightedTemplatePixmap.fill(PRIMARY_HIGHLIGHTED_BACKGROUND_COLOR);
|
||||||
static constexpr auto asciiFontColor = QColor{0xA7, 0x77, 0x26};
|
|
||||||
static constexpr auto changedMemoryAsciiFontColor = QColor{0xB7, 0x7F, 0x21};
|
|
||||||
|
|
||||||
static constexpr auto byteItemRect = QRect{0, 0, ByteItem::WIDTH, ByteItem::HEIGHT};
|
auto selectedTemplatePixmap = QPixmap{BYTE_ITEM_SIZE};
|
||||||
static constexpr auto byteItemSize = byteItemRect.size();
|
selectedTemplatePixmap.fill(SELECTED_BACKGROUND_COLOR);
|
||||||
|
|
||||||
auto standardTemplatePixmap = QPixmap{byteItemSize};
|
auto groupedTemplatePixmap = QPixmap{BYTE_ITEM_SIZE};
|
||||||
standardTemplatePixmap.fill(standardBackgroundColor);
|
groupedTemplatePixmap.fill(GROUPED_BACKGROUND_COLOR);
|
||||||
|
|
||||||
auto primaryHighlightedTemplatePixmap = QPixmap{byteItemSize};
|
auto stackMemoryTemplatePixmap = QPixmap{BYTE_ITEM_SIZE};
|
||||||
primaryHighlightedTemplatePixmap.fill(primaryHighlightedBackgroundColor);
|
stackMemoryTemplatePixmap.fill(STACK_MEMORY_BACKGROUND_COLOR);
|
||||||
|
|
||||||
auto selectedTemplatePixmap = QPixmap{byteItemSize};
|
|
||||||
selectedTemplatePixmap.fill(selectedBackgroundColor);
|
|
||||||
|
|
||||||
auto groupedTemplatePixmap = QPixmap{byteItemSize};
|
|
||||||
groupedTemplatePixmap.fill(groupedBackgroundColor);
|
|
||||||
|
|
||||||
auto stackMemoryTemplatePixmap = QPixmap{byteItemSize};
|
|
||||||
stackMemoryTemplatePixmap.fill(stackMemoryBackgroundColor);
|
|
||||||
|
|
||||||
{
|
{
|
||||||
auto painter = QPainter{&stackMemoryTemplatePixmap};
|
auto painter = QPainter{&stackMemoryTemplatePixmap};
|
||||||
painter.setBrush(stackMemoryBarColor);
|
painter.setBrush(STACK_MEMORY_BAR_COLOR);
|
||||||
painter.setPen(Qt::PenStyle::NoPen);
|
painter.setPen(Qt::PenStyle::NoPen);
|
||||||
painter.drawRect(0, byteItemSize.height() - 3, byteItemSize.width(), 3);
|
painter.drawRect(0, BYTE_ITEM_SIZE.height() - 3, BYTE_ITEM_SIZE.width(), 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto changedMemoryTemplatePixmap = QPixmap{byteItemSize};
|
auto changedMemoryTemplatePixmap = QPixmap{BYTE_ITEM_SIZE};
|
||||||
changedMemoryTemplatePixmap.fill(changedMemoryBackgroundColor);
|
changedMemoryTemplatePixmap.fill(CHANGED_MEMORY_BACKGROUND_COLOR);
|
||||||
|
|
||||||
auto changedMemoryFadedTemplatePixmap = QPixmap{byteItemSize};
|
auto changedMemoryFadedTemplatePixmap = QPixmap{BYTE_ITEM_SIZE};
|
||||||
changedMemoryFadedTemplatePixmap.fill(changedMemoryFadedBackgroundColor);
|
changedMemoryFadedTemplatePixmap.fill(CHANGED_MEMORY_FADED_BACKGROUND_COLOR);
|
||||||
|
|
||||||
auto hoveredStackMemoryTemplatePixmap = QPixmap{byteItemSize};
|
auto hoveredStackMemoryTemplatePixmap = QPixmap{BYTE_ITEM_SIZE};
|
||||||
hoveredStackMemoryTemplatePixmap.fill(hoveredStackMemoryBackgroundColor);
|
hoveredStackMemoryTemplatePixmap.fill(HOVERED_STACK_MEMORY_BACKGROUND_COLOR);
|
||||||
|
|
||||||
auto hoveredPrimaryTemplatePixmap = QPixmap{byteItemSize};
|
auto hoveredPrimaryTemplatePixmap = QPixmap{BYTE_ITEM_SIZE};
|
||||||
hoveredPrimaryTemplatePixmap.fill(hoveredBackgroundColor);
|
hoveredPrimaryTemplatePixmap.fill(HOVERED_BACKGROUND_COLOR);
|
||||||
|
|
||||||
static auto font = QFont{"'Ubuntu', sans-serif", 8};
|
static auto font = QFont{"'Ubuntu', sans-serif", 8};
|
||||||
|
|
||||||
@@ -692,8 +684,8 @@ namespace Widgets
|
|||||||
auto standardPixmap = standardTemplatePixmap;
|
auto standardPixmap = standardTemplatePixmap;
|
||||||
auto painter = QPainter{&standardPixmap};
|
auto painter = QPainter{&standardPixmap};
|
||||||
painter.setFont(font);
|
painter.setFont(font);
|
||||||
painter.setPen(standardFontColor);
|
painter.setPen(STANDARD_FONT_COLOR);
|
||||||
painter.drawText(byteItemRect, Qt::AlignCenter, hexValue);
|
painter.drawText(BYTE_ITEM_RECT, Qt::AlignCenter, hexValue);
|
||||||
|
|
||||||
HexViewerItemRenderer::standardPixmapsByValue.emplace_back(std::move(standardPixmap));
|
HexViewerItemRenderer::standardPixmapsByValue.emplace_back(std::move(standardPixmap));
|
||||||
}
|
}
|
||||||
@@ -702,8 +694,8 @@ namespace Widgets
|
|||||||
auto selectedPixmap = selectedTemplatePixmap;
|
auto selectedPixmap = selectedTemplatePixmap;
|
||||||
auto painter = QPainter{&selectedPixmap};
|
auto painter = QPainter{&selectedPixmap};
|
||||||
painter.setFont(font);
|
painter.setFont(font);
|
||||||
painter.setPen(standardFontColor);
|
painter.setPen(STANDARD_FONT_COLOR);
|
||||||
painter.drawText(byteItemRect, Qt::AlignCenter, hexValue);
|
painter.drawText(BYTE_ITEM_RECT, Qt::AlignCenter, hexValue);
|
||||||
|
|
||||||
HexViewerItemRenderer::selectedPixmapsByValue.emplace_back(std::move(selectedPixmap));
|
HexViewerItemRenderer::selectedPixmapsByValue.emplace_back(std::move(selectedPixmap));
|
||||||
}
|
}
|
||||||
@@ -712,8 +704,8 @@ namespace Widgets
|
|||||||
auto primaryHighlightedPixmap = primaryHighlightedTemplatePixmap;
|
auto primaryHighlightedPixmap = primaryHighlightedTemplatePixmap;
|
||||||
auto painter = QPainter{&primaryHighlightedPixmap};
|
auto painter = QPainter{&primaryHighlightedPixmap};
|
||||||
painter.setFont(font);
|
painter.setFont(font);
|
||||||
painter.setPen(standardFontColor);
|
painter.setPen(STANDARD_FONT_COLOR);
|
||||||
painter.drawText(byteItemRect, Qt::AlignCenter, hexValue);
|
painter.drawText(BYTE_ITEM_RECT, Qt::AlignCenter, hexValue);
|
||||||
|
|
||||||
HexViewerItemRenderer::primaryHighlightedPixmapsByValue.emplace_back(std::move(primaryHighlightedPixmap));
|
HexViewerItemRenderer::primaryHighlightedPixmapsByValue.emplace_back(std::move(primaryHighlightedPixmap));
|
||||||
}
|
}
|
||||||
@@ -722,8 +714,8 @@ namespace Widgets
|
|||||||
auto groupedPixmap = groupedTemplatePixmap;
|
auto groupedPixmap = groupedTemplatePixmap;
|
||||||
auto painter = QPainter{&groupedPixmap};
|
auto painter = QPainter{&groupedPixmap};
|
||||||
painter.setFont(font);
|
painter.setFont(font);
|
||||||
painter.setPen(standardFontColor);
|
painter.setPen(STANDARD_FONT_COLOR);
|
||||||
painter.drawText(byteItemRect, Qt::AlignCenter, hexValue);
|
painter.drawText(BYTE_ITEM_RECT, Qt::AlignCenter, hexValue);
|
||||||
|
|
||||||
HexViewerItemRenderer::groupedPixmapsByValue.emplace_back(std::move(groupedPixmap));
|
HexViewerItemRenderer::groupedPixmapsByValue.emplace_back(std::move(groupedPixmap));
|
||||||
}
|
}
|
||||||
@@ -732,8 +724,8 @@ namespace Widgets
|
|||||||
auto stackMemoryPixmap = stackMemoryTemplatePixmap;
|
auto stackMemoryPixmap = stackMemoryTemplatePixmap;
|
||||||
auto painter = QPainter{&stackMemoryPixmap};
|
auto painter = QPainter{&stackMemoryPixmap};
|
||||||
painter.setFont(font);
|
painter.setFont(font);
|
||||||
painter.setPen(standardFontColor);
|
painter.setPen(STANDARD_FONT_COLOR);
|
||||||
painter.drawText(byteItemRect, Qt::AlignCenter, hexValue);
|
painter.drawText(BYTE_ITEM_RECT, Qt::AlignCenter, hexValue);
|
||||||
|
|
||||||
HexViewerItemRenderer::stackMemoryPixmapsByValue.emplace_back(std::move(stackMemoryPixmap));
|
HexViewerItemRenderer::stackMemoryPixmapsByValue.emplace_back(std::move(stackMemoryPixmap));
|
||||||
}
|
}
|
||||||
@@ -742,8 +734,8 @@ namespace Widgets
|
|||||||
auto changedMemoryPixmap = changedMemoryTemplatePixmap;
|
auto changedMemoryPixmap = changedMemoryTemplatePixmap;
|
||||||
auto painter = QPainter{&changedMemoryPixmap};
|
auto painter = QPainter{&changedMemoryPixmap};
|
||||||
painter.setFont(font);
|
painter.setFont(font);
|
||||||
painter.setPen(standardFontColor);
|
painter.setPen(STANDARD_FONT_COLOR);
|
||||||
painter.drawText(byteItemRect, Qt::AlignCenter, hexValue);
|
painter.drawText(BYTE_ITEM_RECT, Qt::AlignCenter, hexValue);
|
||||||
|
|
||||||
HexViewerItemRenderer::changedMemoryPixmapsByValue.emplace_back(std::move(changedMemoryPixmap));
|
HexViewerItemRenderer::changedMemoryPixmapsByValue.emplace_back(std::move(changedMemoryPixmap));
|
||||||
}
|
}
|
||||||
@@ -752,8 +744,8 @@ namespace Widgets
|
|||||||
auto hoveredPrimaryPixmap = hoveredPrimaryTemplatePixmap;
|
auto hoveredPrimaryPixmap = hoveredPrimaryTemplatePixmap;
|
||||||
auto painter = QPainter{&hoveredPrimaryPixmap};
|
auto painter = QPainter{&hoveredPrimaryPixmap};
|
||||||
painter.setFont(font);
|
painter.setFont(font);
|
||||||
painter.setPen(standardFontColor);
|
painter.setPen(STANDARD_FONT_COLOR);
|
||||||
painter.drawText(byteItemRect, Qt::AlignCenter, hexValue);
|
painter.drawText(BYTE_ITEM_RECT, Qt::AlignCenter, hexValue);
|
||||||
|
|
||||||
HexViewerItemRenderer::hoveredPrimaryPixmapsByValue.emplace_back(std::move(hoveredPrimaryPixmap));
|
HexViewerItemRenderer::hoveredPrimaryPixmapsByValue.emplace_back(std::move(hoveredPrimaryPixmap));
|
||||||
}
|
}
|
||||||
@@ -762,8 +754,8 @@ namespace Widgets
|
|||||||
auto standardAsciiPixmap = standardTemplatePixmap;
|
auto standardAsciiPixmap = standardTemplatePixmap;
|
||||||
auto painter = QPainter{&standardAsciiPixmap};
|
auto painter = QPainter{&standardAsciiPixmap};
|
||||||
painter.setFont(font);
|
painter.setFont(font);
|
||||||
painter.setPen(asciiValue.has_value() ? asciiFontColor : fadedFontColor);
|
painter.setPen(asciiValue.has_value() ? ASCII_FONT_COLOR : FADED_FONT_COLOR);
|
||||||
painter.drawText(byteItemRect, Qt::AlignCenter, asciiValue.value_or(hexValue));
|
painter.drawText(BYTE_ITEM_RECT, Qt::AlignCenter, asciiValue.value_or(hexValue));
|
||||||
|
|
||||||
HexViewerItemRenderer::standardAsciiPixmapsByValue.emplace_back(std::move(standardAsciiPixmap));
|
HexViewerItemRenderer::standardAsciiPixmapsByValue.emplace_back(std::move(standardAsciiPixmap));
|
||||||
}
|
}
|
||||||
@@ -772,8 +764,8 @@ namespace Widgets
|
|||||||
auto selectedAsciiPixmap = selectedTemplatePixmap;
|
auto selectedAsciiPixmap = selectedTemplatePixmap;
|
||||||
auto painter = QPainter{&selectedAsciiPixmap};
|
auto painter = QPainter{&selectedAsciiPixmap};
|
||||||
painter.setFont(font);
|
painter.setFont(font);
|
||||||
painter.setPen(asciiValue.has_value() ? asciiFontColor : fadedFontColor);
|
painter.setPen(asciiValue.has_value() ? ASCII_FONT_COLOR : FADED_FONT_COLOR);
|
||||||
painter.drawText(byteItemRect, Qt::AlignCenter, asciiValue.value_or(hexValue));
|
painter.drawText(BYTE_ITEM_RECT, Qt::AlignCenter, asciiValue.value_or(hexValue));
|
||||||
|
|
||||||
HexViewerItemRenderer::selectedAsciiPixmapsByValue.emplace_back(std::move(selectedAsciiPixmap));
|
HexViewerItemRenderer::selectedAsciiPixmapsByValue.emplace_back(std::move(selectedAsciiPixmap));
|
||||||
}
|
}
|
||||||
@@ -782,8 +774,8 @@ namespace Widgets
|
|||||||
auto primaryHighlightedAsciiPixmap = primaryHighlightedTemplatePixmap;
|
auto primaryHighlightedAsciiPixmap = primaryHighlightedTemplatePixmap;
|
||||||
auto painter = QPainter{&primaryHighlightedAsciiPixmap};
|
auto painter = QPainter{&primaryHighlightedAsciiPixmap};
|
||||||
painter.setFont(font);
|
painter.setFont(font);
|
||||||
painter.setPen(asciiValue.has_value() ? asciiFontColor : fadedFontColor);
|
painter.setPen(asciiValue.has_value() ? ASCII_FONT_COLOR : FADED_FONT_COLOR);
|
||||||
painter.drawText(byteItemRect, Qt::AlignCenter, asciiValue.value_or(hexValue));
|
painter.drawText(BYTE_ITEM_RECT, Qt::AlignCenter, asciiValue.value_or(hexValue));
|
||||||
|
|
||||||
HexViewerItemRenderer::primaryHighlightedAsciiPixmapsByValue.emplace_back(
|
HexViewerItemRenderer::primaryHighlightedAsciiPixmapsByValue.emplace_back(
|
||||||
std::move(primaryHighlightedAsciiPixmap)
|
std::move(primaryHighlightedAsciiPixmap)
|
||||||
@@ -794,8 +786,8 @@ namespace Widgets
|
|||||||
auto groupedAsciiPixmap = groupedTemplatePixmap;
|
auto groupedAsciiPixmap = groupedTemplatePixmap;
|
||||||
auto painter = QPainter{&groupedAsciiPixmap};
|
auto painter = QPainter{&groupedAsciiPixmap};
|
||||||
painter.setFont(font);
|
painter.setFont(font);
|
||||||
painter.setPen(asciiValue.has_value() ? asciiFontColor : fadedFontColor);
|
painter.setPen(asciiValue.has_value() ? ASCII_FONT_COLOR : FADED_FONT_COLOR);
|
||||||
painter.drawText(byteItemRect, Qt::AlignCenter, asciiValue.value_or(hexValue));
|
painter.drawText(BYTE_ITEM_RECT, Qt::AlignCenter, asciiValue.value_or(hexValue));
|
||||||
|
|
||||||
HexViewerItemRenderer::groupedAsciiPixmapsByValue.emplace_back(std::move(groupedAsciiPixmap));
|
HexViewerItemRenderer::groupedAsciiPixmapsByValue.emplace_back(std::move(groupedAsciiPixmap));
|
||||||
}
|
}
|
||||||
@@ -804,8 +796,8 @@ namespace Widgets
|
|||||||
auto stackMemoryAsciiPixmap = stackMemoryTemplatePixmap;
|
auto stackMemoryAsciiPixmap = stackMemoryTemplatePixmap;
|
||||||
auto painter = QPainter{&stackMemoryAsciiPixmap};
|
auto painter = QPainter{&stackMemoryAsciiPixmap};
|
||||||
painter.setFont(font);
|
painter.setFont(font);
|
||||||
painter.setPen(asciiValue.has_value() ? asciiFontColor : fadedFontColor);
|
painter.setPen(asciiValue.has_value() ? ASCII_FONT_COLOR : FADED_FONT_COLOR);
|
||||||
painter.drawText(byteItemRect, Qt::AlignCenter, asciiValue.value_or(hexValue));
|
painter.drawText(BYTE_ITEM_RECT, Qt::AlignCenter, asciiValue.value_or(hexValue));
|
||||||
|
|
||||||
HexViewerItemRenderer::stackMemoryAsciiPixmapsByValue.emplace_back(std::move(stackMemoryAsciiPixmap));
|
HexViewerItemRenderer::stackMemoryAsciiPixmapsByValue.emplace_back(std::move(stackMemoryAsciiPixmap));
|
||||||
}
|
}
|
||||||
@@ -817,8 +809,8 @@ namespace Widgets
|
|||||||
|
|
||||||
auto painter = QPainter{&changedMemoryAsciiPixmap};
|
auto painter = QPainter{&changedMemoryAsciiPixmap};
|
||||||
painter.setFont(font);
|
painter.setFont(font);
|
||||||
painter.setPen(asciiValue.has_value() ? changedMemoryAsciiFontColor : fadedFontColor);
|
painter.setPen(asciiValue.has_value() ? CHANGED_MEMORY_ASCII_FONT_COLOR : FADED_FONT_COLOR);
|
||||||
painter.drawText(byteItemRect, Qt::AlignCenter, asciiValue.value_or(hexValue));
|
painter.drawText(BYTE_ITEM_RECT, Qt::AlignCenter, asciiValue.value_or(hexValue));
|
||||||
|
|
||||||
HexViewerItemRenderer::changedMemoryAsciiPixmapsByValue.emplace_back(std::move(changedMemoryAsciiPixmap));
|
HexViewerItemRenderer::changedMemoryAsciiPixmapsByValue.emplace_back(std::move(changedMemoryAsciiPixmap));
|
||||||
}
|
}
|
||||||
@@ -827,8 +819,8 @@ namespace Widgets
|
|||||||
auto hoveredPrimaryAsciiPixmap = hoveredPrimaryTemplatePixmap;
|
auto hoveredPrimaryAsciiPixmap = hoveredPrimaryTemplatePixmap;
|
||||||
auto painter = QPainter{&hoveredPrimaryAsciiPixmap};
|
auto painter = QPainter{&hoveredPrimaryAsciiPixmap};
|
||||||
painter.setFont(font);
|
painter.setFont(font);
|
||||||
painter.setPen(asciiValue.has_value() ? asciiFontColor : fadedFontColor);
|
painter.setPen(asciiValue.has_value() ? ASCII_FONT_COLOR : FADED_FONT_COLOR);
|
||||||
painter.drawText(byteItemRect, Qt::AlignCenter, asciiValue.value_or(hexValue));
|
painter.drawText(BYTE_ITEM_RECT, Qt::AlignCenter, asciiValue.value_or(hexValue));
|
||||||
|
|
||||||
HexViewerItemRenderer::hoveredPrimaryAsciiPixmapsByValue.emplace_back(std::move(hoveredPrimaryAsciiPixmap));
|
HexViewerItemRenderer::hoveredPrimaryAsciiPixmapsByValue.emplace_back(std::move(hoveredPrimaryAsciiPixmap));
|
||||||
}
|
}
|
||||||
@@ -838,24 +830,24 @@ namespace Widgets
|
|||||||
HexViewerItemRenderer::missingDataPixmap = standardTemplatePixmap;
|
HexViewerItemRenderer::missingDataPixmap = standardTemplatePixmap;
|
||||||
auto painter = QPainter{&HexViewerItemRenderer::missingDataPixmap.value()};
|
auto painter = QPainter{&HexViewerItemRenderer::missingDataPixmap.value()};
|
||||||
painter.setFont(font);
|
painter.setFont(font);
|
||||||
painter.setPen(standardFontColor);
|
painter.setPen(STANDARD_FONT_COLOR);
|
||||||
painter.drawText(byteItemRect, Qt::AlignCenter, "??");
|
painter.drawText(BYTE_ITEM_RECT, Qt::AlignCenter, "??");
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
HexViewerItemRenderer::selectedMissingDataPixmap = selectedTemplatePixmap;
|
HexViewerItemRenderer::selectedMissingDataPixmap = selectedTemplatePixmap;
|
||||||
auto painter = QPainter{&HexViewerItemRenderer::selectedMissingDataPixmap.value()};
|
auto painter = QPainter{&HexViewerItemRenderer::selectedMissingDataPixmap.value()};
|
||||||
painter.setFont(font);
|
painter.setFont(font);
|
||||||
painter.setPen(standardFontColor);
|
painter.setPen(STANDARD_FONT_COLOR);
|
||||||
painter.drawText(byteItemRect, Qt::AlignCenter, "??");
|
painter.drawText(BYTE_ITEM_RECT, Qt::AlignCenter, "??");
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
HexViewerItemRenderer::primaryHighlightedMissingDataPixmap = primaryHighlightedTemplatePixmap;
|
HexViewerItemRenderer::primaryHighlightedMissingDataPixmap = primaryHighlightedTemplatePixmap;
|
||||||
auto painter = QPainter{&HexViewerItemRenderer::primaryHighlightedMissingDataPixmap.value()};
|
auto painter = QPainter{&HexViewerItemRenderer::primaryHighlightedMissingDataPixmap.value()};
|
||||||
painter.setFont(font);
|
painter.setFont(font);
|
||||||
painter.setPen(standardFontColor);
|
painter.setPen(STANDARD_FONT_COLOR);
|
||||||
painter.drawText(byteItemRect, Qt::AlignCenter, "??");
|
painter.drawText(BYTE_ITEM_RECT, Qt::AlignCenter, "??");
|
||||||
}
|
}
|
||||||
|
|
||||||
HexViewerItemRenderer::pixmapCachesGenerated = true;
|
HexViewerItemRenderer::pixmapCachesGenerated = true;
|
||||||
|
|||||||
@@ -455,24 +455,6 @@ namespace Targets::Microchip::Avr8::OpcodeDecoder
|
|||||||
&& (!canSkipNextInstruction || canChangeProgramFlow)
|
&& (!canSkipNextInstruction || canChangeProgramFlow)
|
||||||
class Opcode
|
class Opcode
|
||||||
{
|
{
|
||||||
using SelfType = Opcode<
|
|
||||||
instructionName,
|
|
||||||
expectedOpcode,
|
|
||||||
wordSize,
|
|
||||||
mnemonic,
|
|
||||||
canChangeProgramFlow,
|
|
||||||
sourceRegisterParameter,
|
|
||||||
destinationRegisterParameter,
|
|
||||||
dataParameter,
|
|
||||||
programAddressParameter,
|
|
||||||
programAddressOffsetParameter,
|
|
||||||
registerBitPositionParameter,
|
|
||||||
statusRegisterBitPositionParameter,
|
|
||||||
ioSpaceAddressParameter,
|
|
||||||
dataSpaceAddressParameter,
|
|
||||||
displacementParameter,
|
|
||||||
canSkipNextInstruction
|
|
||||||
>;
|
|
||||||
using OpcodeDataType = std::conditional_t<(wordSize > 1), std::uint32_t, std::uint16_t>;
|
using OpcodeDataType = std::conditional_t<(wordSize > 1), std::uint32_t, std::uint16_t>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -515,13 +497,13 @@ namespace Targets::Microchip::Avr8::OpcodeDecoder
|
|||||||
opcode = (opcode << 16) | static_cast<OpcodeDataType>(*(dataBegin + 3) << 8 | *(dataBegin + 2));
|
opcode = (opcode << 16) | static_cast<OpcodeDataType>(*(dataBegin + 3) << 8 | *(dataBegin + 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((opcode & SelfType::opcodeMask()) != static_cast<OpcodeDataType>(expectedOpcode)) {
|
if ((opcode & Opcode::opcodeMask()) != static_cast<OpcodeDataType>(expectedOpcode)) {
|
||||||
// Opcode mismatch
|
// Opcode mismatch
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto output = Instruction{
|
auto output = Instruction{
|
||||||
.name = SelfType::name,
|
.name = Opcode::name,
|
||||||
.opcode = opcode,
|
.opcode = opcode,
|
||||||
.byteSize = byteSize,
|
.byteSize = byteSize,
|
||||||
.mnemonic = mnemonic,
|
.mnemonic = mnemonic,
|
||||||
|
|||||||
Reference in New Issue
Block a user