mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-29 08:34:37 +01:00
fix scrollbars now that I finally understand what nPage is supposed to be.
This commit is contained in:
parent
691f5fea19
commit
be219b71f2
3 changed files with 16 additions and 25 deletions
|
@ -360,19 +360,17 @@ ceInitUtilFuncs( CEAppGlobals* globals )
|
|||
# define SCROLL_SHRINK 1
|
||||
|
||||
static void
|
||||
updateScrollInfo( HWND hwnd, XP_U16 nHidden )
|
||||
updateScrollInfo( CEAppGlobals* globals, XP_U16 nHidden )
|
||||
{
|
||||
SCROLLINFO sinfo;
|
||||
|
||||
XP_MEMSET( &sinfo, 0, sizeof(sinfo) );
|
||||
sinfo.cbSize = sizeof(sinfo);
|
||||
sinfo.fMask = SIF_RANGE | SIF_POS | SIF_PAGE;
|
||||
sinfo.nPos = 0;
|
||||
sinfo.nMin = 0;
|
||||
sinfo.nMax = nHidden;
|
||||
sinfo.nPage = 1;
|
||||
sinfo.nMax = model_numRows( globals->game.model );
|
||||
sinfo.nPage = sinfo.nMax - nHidden + 1;
|
||||
|
||||
(void)SetScrollInfo( hwnd, SB_CTL, &sinfo, TRUE );
|
||||
(void)SetScrollInfo( globals->scrollHandle, SB_CTL, &sinfo, TRUE );
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -398,11 +396,10 @@ showScroller( CEAppGlobals* globals, XP_U16 nHidden, XP_U16 x, XP_U16 y,
|
|||
globals->hInst, // The instance handle
|
||||
NULL ); // s'pposed to be NULL
|
||||
|
||||
updateScrollInfo( hwndSB, nHidden );
|
||||
globals->scrollHandle = hwndSB;
|
||||
updateScrollInfo( globals, nHidden );
|
||||
|
||||
EnableWindow( hwndSB, nHidden > 0 );
|
||||
|
||||
globals->scrollHandle = hwndSB;
|
||||
}
|
||||
|
||||
ShowWindow( globals->scrollHandle, SW_SHOW );
|
||||
|
@ -2831,7 +2828,7 @@ ce_util_trayHiddenChange( XW_UtilCtxt* uc, XW_TrayVisState XP_UNUSED(newState),
|
|||
|
||||
if ( !!globals->scrollHandle ) {
|
||||
nHiddenRows = model_numRows( globals->game.model ) - nVisibleRows;
|
||||
updateScrollInfo( globals->scrollHandle, nHiddenRows );
|
||||
updateScrollInfo( globals, nHiddenRows );
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -349,7 +349,7 @@ void
|
|||
ceDlgSetup( CeDlgHdr* dlgHdr, HWND hDlg, DlgStateTask doWhat )
|
||||
{
|
||||
RECT rect;
|
||||
XP_U16 vHeight;
|
||||
XP_U16 fullHeight;
|
||||
CEAppGlobals* globals = dlgHdr->globals;
|
||||
|
||||
dlgHdr->hDlg = hDlg;
|
||||
|
@ -359,10 +359,10 @@ ceDlgSetup( CeDlgHdr* dlgHdr, HWND hDlg, DlgStateTask doWhat )
|
|||
|
||||
GetClientRect( hDlg, &rect );
|
||||
XP_ASSERT( rect.top == 0 );
|
||||
vHeight = rect.bottom; /* This is before we've resized it */
|
||||
fullHeight = rect.bottom; /* This is before we've resized it */
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
(void)mkFullscreenWithSoftkeys( globals, hDlg, vHeight,
|
||||
(void)mkFullscreenWithSoftkeys( globals, hDlg, fullHeight,
|
||||
(doWhat & DLG_STATE_DONEONLY) != 0);
|
||||
#elif defined DEBUG
|
||||
/* Force it to be small so we can test scrolling etc. */
|
||||
|
@ -379,21 +379,14 @@ ceDlgSetup( CeDlgHdr* dlgHdr, HWND hDlg, DlgStateTask doWhat )
|
|||
if ( !IS_SMARTPHONE(globals) ) {
|
||||
SCROLLINFO sinfo;
|
||||
|
||||
XP_LOGF( "%s: vHeight: %d; r.bottom: %ld", __func__, vHeight,
|
||||
rect.bottom );
|
||||
|
||||
XP_MEMSET( &sinfo, 0, sizeof(sinfo) );
|
||||
sinfo.cbSize = sizeof(sinfo);
|
||||
|
||||
sinfo.fMask = SIF_RANGE | SIF_POS | SIF_PAGE;
|
||||
sinfo.nPos = 0;
|
||||
sinfo.nMin = 0;
|
||||
sinfo.nMax = vHeight - rect.bottom;
|
||||
if ( sinfo.nMax < 0 ) {
|
||||
sinfo.nMax = 0; /* disables the thing! */
|
||||
if ( rect.bottom < fullHeight ) {
|
||||
sinfo.nMax = fullHeight;
|
||||
dlgHdr->nPage = sinfo.nPage = rect.bottom - 1;
|
||||
}
|
||||
XP_LOGF( "%s: set max to %d", __func__, sinfo.nMax );
|
||||
sinfo.nPage = 10;
|
||||
|
||||
(void)SetScrollInfo( hDlg, SB_VERT, &sinfo, FALSE );
|
||||
}
|
||||
|
@ -494,14 +487,14 @@ ceDoDlgScroll( CeDlgHdr* dlgHdr, WPARAM wParam )
|
|||
vertChange = -1;
|
||||
break;
|
||||
case SB_PAGEUP: //
|
||||
vertChange = -10;
|
||||
vertChange = -dlgHdr->nPage;
|
||||
break;
|
||||
|
||||
case SB_LINEDOWN: // Scrolls one line down
|
||||
vertChange = 1;
|
||||
break;
|
||||
case SB_PAGEDOWN: // Scrolls one page down
|
||||
vertChange = 10;
|
||||
vertChange = dlgHdr->nPage;
|
||||
break;
|
||||
|
||||
case SB_THUMBTRACK: /* still dragging; don't redraw */
|
||||
|
|
|
@ -54,6 +54,7 @@ typedef struct CeDlgHdr {
|
|||
|
||||
/* Below this line is private to ceutil.c */
|
||||
DlgStateTask doWhat;
|
||||
XP_U16 nPage;
|
||||
} CeDlgHdr;
|
||||
void ceDlgSetup( CeDlgHdr* dlgHdr, HWND hDlg, DlgStateTask doWhat );
|
||||
XP_Bool ceDoDlgHandle( CeDlgHdr* dlgHdr, UINT message, WPARAM wParam, LPARAM lParam);
|
||||
|
|
Loading…
Add table
Reference in a new issue