diskprobe: Add striped look and vertical line separators

* vertical lines per 4 bytes displayed
* striped line colors

Change-Id: I08508f15a60c5ceab8e3088faca9c03576c129e0
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4563
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
This commit is contained in:
Felix Ehlers 2021-10-08 23:55:31 +02:00 committed by Adrien Destugues
parent ba6a1df423
commit 36df12a51a

View File

@ -398,14 +398,42 @@ DataView::Draw(BRect updateRect)
char line[255];
BPoint location(kHorizontalSpace, kVerticalSpace + fAscent);
const float kTintDarkenTouch = (B_NO_TINT + B_DARKEN_1_TINT) / 2.0f;
for (uint32 lineNum = 0, i = 0; i < fSizeInView; lineNum++, i += kBlockSize) {
// Tint every 2nd line to create a striped background
float tint = (lineNum % 2 == 0) ? B_NO_TINT : kTintDarkenTouch;
SetLowUIColor(B_DOCUMENT_BACKGROUND_COLOR, tint);
FillRect(BRect(location.x - kHorizontalSpace,
kVerticalSpace + lineNum * fFontHeight,
location.x - kHorizontalSpace / 2 + Bounds().right,
kVerticalSpace + (lineNum + 1) * fFontHeight), B_SOLID_LOW);
for (uint32 i = 0; i < fSizeInView; i += kBlockSize) {
ConvertLine(line, i, fData + i, fSizeInView - i);
DrawString(line, location);
location.y += fFontHeight;
}
// Draw first vertical line after 18 chars ("0000: xx xx xx xx")
// Next three vertical lines require an offset of 12 chars ("xx xx xx xx")
BPoint line_start(kHorizontalSpace + fCharWidth * 18 + fCharWidth / 2, 0);
BPoint line_end(line_start.x, Bounds().bottom);
rgb_color lineColor = tint_color(lineColor, B_LIGHTEN_2_TINT);
uint32 kDrawNumLines = 3;
BeginLineArray(kDrawNumLines);
for (uint32 i = 0; i < kDrawNumLines; i++) {
AddLine(line_start, line_end, lineColor);
line_start.x += fCharWidth * 12;
line_end.x = line_start.x;
}
EndLineArray();
DrawSelection();
}