| 44 | } |
| 45 | |
| 46 | void MemoryViewTable::DrawTable(QPainter& painter, const QPalette& palette, s32 height, DebugInterface& cpu) |
| 47 | { |
| 48 | rowHeight = painter.fontMetrics().height() + 2; |
| 49 | const s32 charWidth = painter.fontMetrics().averageCharWidth(); |
| 50 | const s32 x = charWidth; // Left padding |
| 51 | const s32 y = rowHeight; |
| 52 | const s32 displayTypeWidth = MemoryViewTypeWidth[static_cast<s32>(displayType)]; |
| 53 | const s32 displayTypeVisualWidth = MemoryViewTypeVisualWidth[static_cast<s32>(displayType)]; |
| 54 | rowVisible = (height / rowHeight); |
| 55 | rowCount = rowVisible + 1; |
| 56 | |
| 57 | row1YAxis = 0; |
| 58 | |
| 59 | // Draw the row addresses |
| 60 | painter.setPen(palette.text().color()); |
| 61 | for (u32 i = 0; i < rowCount; i++) |
| 62 | { |
| 63 | painter.drawText(x, y + (rowHeight * i), FilledQStringFromValue(startAddress + (i * 0x10), 16)); |
| 64 | } |
| 65 | valuexAxis = x + (charWidth * 8); |
| 66 | |
| 67 | // Draw the row values |
| 68 | for (u32 i = 0; i < rowCount; i++) |
| 69 | { |
| 70 | const u32 currentRowAddress = startAddress + (i * 0x10); |
| 71 | s32 valX = valuexAxis; |
| 72 | segmentXAxis[0] = valX; |
| 73 | for (int j = 0; j < 16 / displayTypeWidth; j++) |
| 74 | { |
| 75 | valX += charWidth; |
| 76 | const u32 thisSegmentsStart = currentRowAddress + (j * displayTypeWidth); |
| 77 | |
| 78 | segmentXAxis[j] = valX; |
| 79 | |
| 80 | bool penDefault = false; |
| 81 | if ((selectedAddress & ~0xF) == currentRowAddress) |
| 82 | { |
| 83 | if (selectedAddress >= thisSegmentsStart && selectedAddress < (thisSegmentsStart + displayTypeWidth)) |
| 84 | { // If the current byte and row we are drawing is selected |
| 85 | if (!selectedText) |
| 86 | { |
| 87 | s32 charsIntoSegment = 0; |
| 88 | if (displayType == MemoryViewType::FLOAT) |
| 89 | { |
| 90 | charsIntoSegment = selectedIndex; |
| 91 | } |
| 92 | else |
| 93 | { |
| 94 | charsIntoSegment = ((selectedAddress - thisSegmentsStart) * 2) + ((selectedNibbleHI ? 0 : 1) ^ littleEndian); |
| 95 | } |
| 96 | |
| 97 | if (littleEndian) |
| 98 | charsIntoSegment = displayTypeVisualWidth - charsIntoSegment - 1; |
| 99 | painter.setPen(QColor::fromRgb(205, 165, 0)); // SELECTED NIBBLE LINE COLOUR |
| 100 | const QPoint lineStart(valX + (charsIntoSegment * charWidth) + 1, y + (rowHeight * i)); |
| 101 | painter.drawLine(lineStart, lineStart + QPoint(charWidth - 3, 0)); |
| 102 | } |
| 103 | painter.setPen(QColor::fromRgb(0xaa, 0x22, 0x22)); // SELECTED BYTE COLOUR |
no test coverage detected