Author: tkreuzer
Date: Tue Nov 13 17:18:44 2007
New Revision: 30422
URL:
http://svn.reactos.org/svn/reactos?rev=30422&view=rev
Log:
charmap: scroll 1 position on SB_LINEDOWN and 1 page on SB_PAGEDOWN, update window on
SB_THUMPTRACK, use ScrollWindowEx on scrolling.
Modified:
trunk/reactos/base/applications/charmap/map.c
trunk/reactos/base/applications/charmap/precomp.h
Modified: trunk/reactos/base/applications/charmap/map.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/charmap/…
==============================================================================
--- trunk/reactos/base/applications/charmap/map.c (original)
+++ trunk/reactos/base/applications/charmap/map.c Tue Nov 13 17:18:44 2007
@@ -91,7 +91,7 @@
for (y = 0; y < YCELLS; y++)
for (x = 0; x < XCELLS; x++)
{
- ch = (WCHAR)((256 * infoPtr->iPage) + (XCELLS * y) + x);
+ ch = (WCHAR)((XCELLS * (y + infoPtr->iYStart)) + x);
TagFontToCell(&infoPtr->Cells[y][x], ch);
@@ -348,43 +348,67 @@
INT Value,
INT Pos)
{
+ INT iYDiff, iOldYStart = infoPtr->iYStart;
+
switch (Value)
{
case SB_LINEUP:
- infoPtr->iPage -= 1;
+ infoPtr->iYStart -= 1;
break;
case SB_LINEDOWN:
- infoPtr->iPage += 1;
+ infoPtr->iYStart += 1;
break;
case SB_PAGEUP:
- infoPtr->iPage -= 16;
+ infoPtr->iYStart -= YCELLS;
break;
case SB_PAGEDOWN:
- infoPtr->iPage += 16;
- break;
-
- case SB_THUMBPOSITION:
- infoPtr->iPage = Pos;
+ infoPtr->iYStart += YCELLS;
+ break;
+
+ case SB_THUMBTRACK:
+ infoPtr->iYStart = Pos;
break;
default:
break;
}
- infoPtr->iPage = max(0,
- min(infoPtr->iPage, 255));
-
- SetScrollPos(infoPtr->hMapWnd,
- SB_VERT,
- infoPtr->iPage,
- TRUE);
-
- InvalidateRect(infoPtr->hMapWnd,
- NULL,
- TRUE);
+ infoPtr->iYStart = max(0,
+ min(infoPtr->iYStart, 255*16));
+
+ iYDiff = iOldYStart - infoPtr->iYStart;
+ if (iYDiff)
+ {
+ SetScrollPos(infoPtr->hMapWnd,
+ SB_VERT,
+ infoPtr->iYStart,
+ TRUE);
+
+ if (abs(iYDiff) < YCELLS)
+ {
+ RECT rect;
+ GetClientRect(infoPtr->hMapWnd, &rect);
+ rect.top += 2;
+ rect.bottom -= 2;
+ ScrollWindowEx(infoPtr->hMapWnd,
+ 0,
+ iYDiff * infoPtr->CellSize.cy,
+ &rect,
+ &rect,
+ NULL,
+ NULL,
+ SW_INVALIDATE);
+ }
+ else
+ {
+ InvalidateRect(infoPtr->hMapWnd,
+ NULL,
+ TRUE);
+ }
+ }
}
Modified: trunk/reactos/base/applications/charmap/precomp.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/charmap/…
==============================================================================
--- trunk/reactos/base/applications/charmap/precomp.h (original)
+++ trunk/reactos/base/applications/charmap/precomp.h Tue Nov 13 17:18:44 2007
@@ -36,7 +36,7 @@
PCELL pActiveCell;
HFONT hFont;
LOGFONTW CurrentFont;
- INT iPage;
+ INT iYStart;
} MAP, *PMAP;
typedef struct {