ye
This commit is contained in:
parent
37402ae2a2
commit
3f172c688d
@ -10,6 +10,9 @@ const int topMarginHeight = 20;
|
|||||||
|
|
||||||
const int fontHeight = 16;
|
const int fontHeight = 16;
|
||||||
const int fontWidth = 12;
|
const int fontWidth = 12;
|
||||||
|
|
||||||
|
const int lines = 30;
|
||||||
|
|
||||||
int scrollPosX;
|
int scrollPosX;
|
||||||
int scrollPosY;
|
int scrollPosY;
|
||||||
|
|
||||||
@ -24,7 +27,7 @@ void setupScrollBars(HWND hwnd)
|
|||||||
si.nPos = scrollPosY;
|
si.nPos = scrollPosY;
|
||||||
si.nPage = windowLines;
|
si.nPage = windowLines;
|
||||||
si.nMin = 0;
|
si.nMin = 0;
|
||||||
si.nMax = 0x80;
|
si.nMax = lines - 1;
|
||||||
SetScrollInfo(hwnd, SB_VERT, &si, TRUE);
|
SetScrollInfo(hwnd, SB_VERT, &si, TRUE);
|
||||||
|
|
||||||
si.fMask = SIF_POS | SIF_PAGE | SIF_RANGE | SIF_DISABLENOSCROLL;
|
si.fMask = SIF_POS | SIF_PAGE | SIF_RANGE | SIF_DISABLENOSCROLL;
|
||||||
@ -78,6 +81,8 @@ void paintTracks(HDC hdc, RECT rcTracks)
|
|||||||
|
|
||||||
int firstLine = max((rcTracks.top - topMarginHeight) / fontHeight, 0);
|
int firstLine = max((rcTracks.top - topMarginHeight) / fontHeight, 0);
|
||||||
int lastLine = scrollPosY + ((rcTracks.bottom - topMarginHeight) + (fontHeight - 1)) / fontHeight;
|
int lastLine = scrollPosY + ((rcTracks.bottom - topMarginHeight) + (fontHeight - 1)) / fontHeight;
|
||||||
|
|
||||||
|
lastLine = min(lastLine, lines);
|
||||||
|
|
||||||
int trackLeft = -scrollPosX;
|
int trackLeft = -scrollPosX;
|
||||||
for (int x = 0; x < 16; ++x)
|
for (int x = 0; x < 16; ++x)
|
||||||
@ -93,6 +98,7 @@ void paintTracks(HDC hdc, RECT rcTracks)
|
|||||||
topMargin.right = trackLeft + trackWidth;
|
topMargin.right = trackLeft + trackWidth;
|
||||||
|
|
||||||
FillRect( hdc, &topMargin, (HBRUSH)GetStockObject(LTGRAY_BRUSH));
|
FillRect( hdc, &topMargin, (HBRUSH)GetStockObject(LTGRAY_BRUSH));
|
||||||
|
|
||||||
/* format the text */
|
/* format the text */
|
||||||
_snprintf_s(temp, 256, "track %d", x);
|
_snprintf_s(temp, 256, "track %d", x);
|
||||||
SetBkMode(hdc, TRANSPARENT);
|
SetBkMode(hdc, TRANSPARENT);
|
||||||
@ -137,11 +143,11 @@ void paintTracks(HDC hdc, RECT rcTracks)
|
|||||||
|
|
||||||
/* right margin */
|
/* right margin */
|
||||||
RECT rightMargin;
|
RECT rightMargin;
|
||||||
topMargin.top = topMarginHeight;
|
rightMargin.top = topMarginHeight;
|
||||||
topMargin.bottom = rcTracks.bottom;
|
rightMargin.bottom = rcTracks.bottom;
|
||||||
topMargin.left = trackLeft;
|
rightMargin.left = trackLeft;
|
||||||
topMargin.right = rcTracks.right;
|
rightMargin.right = rcTracks.right;
|
||||||
FillRect( hdc, &topMargin, (HBRUSH)GetStockObject(LTGRAY_BRUSH));
|
FillRect( hdc, &rightMargin, (HBRUSH)GetStockObject(LTGRAY_BRUSH));
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -226,11 +232,11 @@ void onHScroll(HWND hwnd, UINT sbCode, int newPos)
|
|||||||
// SB_RIGHT currently missing.
|
// SB_RIGHT currently missing.
|
||||||
|
|
||||||
case SB_LINELEFT:
|
case SB_LINELEFT:
|
||||||
setScrollPos(hwnd, scrollPosX - 1, scrollPosY);
|
setScrollPos(hwnd, scrollPosX - fontWidth, scrollPosY);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SB_LINERIGHT:
|
case SB_LINERIGHT:
|
||||||
setScrollPos(hwnd, scrollPosX + 1, scrollPosY);
|
setScrollPos(hwnd, scrollPosX + fontWidth, scrollPosY);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SB_PAGELEFT:
|
case SB_PAGELEFT:
|
||||||
@ -256,7 +262,8 @@ void onSize(HWND hwnd, int width, int height)
|
|||||||
windowWidth = width;
|
windowWidth = width;
|
||||||
windowHeight = height;
|
windowHeight = height;
|
||||||
|
|
||||||
windowLines = height / fontHeight;
|
windowLines = (height - topMarginHeight) / fontHeight;
|
||||||
|
// windowLines = min((height - topMarginHeight) / fontHeight, lines);
|
||||||
setupScrollBars(hwnd);
|
setupScrollBars(hwnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -95,7 +95,7 @@
|
|||||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||||
IntermediateDirectory="$(ConfigurationName)"
|
IntermediateDirectory="$(ConfigurationName)"
|
||||||
ConfigurationType="1"
|
ConfigurationType="1"
|
||||||
CharacterSet="1"
|
CharacterSet="2"
|
||||||
WholeProgramOptimization="1"
|
WholeProgramOptimization="1"
|
||||||
>
|
>
|
||||||
<Tool
|
<Tool
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user