Skip to content

Commit 5ab1fe3

Browse files
committed
Add up/down keys for synv
1 parent ecf9531 commit 5ab1fe3

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

Scope/windows/Scope.c

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1258,6 +1258,8 @@ void KeyDown(WPARAM wParam, LPARAM lParam)
12581258

12591259
GetClientRect(scope.hwnd, &rect);
12601260

1261+
int height = rect.bottom - rect.top;
1262+
12611263
switch(wParam)
12621264
{
12631265
// Left
@@ -1274,6 +1276,24 @@ void KeyDown(WPARAM wParam, LPARAM lParam)
12741276
scope.index = 0;
12751277
break;
12761278

1279+
// Up
1280+
1281+
case VK_UP:
1282+
if (--yscale.index <= -height / 2)
1283+
yscale.index = 0;
1284+
1285+
InvalidateRgn(yscale.hwnd, NULL, TRUE);
1286+
break;
1287+
1288+
// Down
1289+
1290+
case VK_DOWN:
1291+
if (++yscale.index >= height / 2)
1292+
yscale.index = 0;
1293+
1294+
InvalidateRgn(yscale.hwnd, NULL, TRUE);
1295+
break;
1296+
12771297
default:
12781298
return;
12791299
}
@@ -1444,8 +1464,8 @@ BOOL DrawYScale(HDC hdc, RECT rect)
14441464
{8, 0},
14451465
{4, -4}};
14461466

1447-
SetViewportOrgEx(hdc, width / 3, (yscale.height / 2) + yscale.index,
1448-
NULL);
1467+
SetViewportOrgEx(hdc, (width * 3) / 8,
1468+
(yscale.height / 2) + yscale.index, NULL);
14491469
SelectObject(hdc, GetStockObject(BLACK_BRUSH));
14501470
Polygon(hdc, points, Length(points));
14511471
}

0 commit comments

Comments
 (0)