Example #1
0
extern void AutoScroll( RECT eatom, POINT delta )
/***********************************************/
{
    POINT   offset;
    RECT    clrect;
    HWND    wnd;
    int     xdel;
    int     ydel;
    POINT   mouse;

    eatom = eatom;   /* ref'd to avoid warnings */
    if( GetScrollConfig() == SCROLL_NONE ) {
        return;
    }
    wnd = GetAppWnd();
    GetClientRect( wnd, &clrect );
    GetOffset( &offset );
    OffsetRect( &clrect, offset.x, offset.y );
    xdel = 0;
    ydel = 0;
    mouse = GetPrevMouse();
    mouse.x += delta.x;
    mouse.y += delta.y;

    if( (delta.x > 0 &&
         (abs( mouse.x - clrect.right ) < GetHorizontalInc() ||
          mouse.x > clrect.right)) ||
        (delta.x < 0 &&
         (abs( mouse.x - clrect.left ) < GetHorizontalInc() ||
          mouse.x < clrect.left)) ) {
        xdel = delta.x;
        if( xdel > 0 ) {
            xdel = __max( 1, (xdel * SLOW_DOWN_N) / SLOW_DOWN_D );
        } else {
            xdel = __min( -1, (xdel * SLOW_DOWN_N) / SLOW_DOWN_D );
        }
    }
    if( (delta.y > 0 &&
         (abs( mouse.y - clrect.bottom ) < GetVerticalInc() ||
          mouse.y > clrect.bottom))  ||
        (delta.y < 0 &&
         (abs( mouse.y - clrect.top ) < GetVerticalInc() ||
          mouse.y < clrect.top)) ) {
        ydel = delta.y;
        if( ydel > 0 ) {
            ydel = __max( 1, (ydel * SLOW_DOWN_N) / SLOW_DOWN_D );
        } else {
            ydel = __min( -1, (ydel * SLOW_DOWN_N) / SLOW_DOWN_D );
        }
    }

    if( !(GetScrollConfig() & SCROLL_VERT) ) {
        ydel = 0;
    }
    if( !(GetScrollConfig() & SCROLL_HORZ) ) {
        xdel = 0;
    }
    DoScroll( wnd, xdel, ydel, TRUE );
    UpdateWindow( wnd );
}
Example #2
0
static BOOL FilterMoveKeys( int keycode, LPPOINT pt )
/***************************************************/
{
    BOOL    ret;

    ret = TRUE;
    switch( keycode ) {
    case VK_LEFT:
        pt->x = -GetHorizontalInc();
        pt->y = 0;
        break;
    case VK_UP:
        pt->x = 0;
        pt->y = -GetVerticalInc();
        break;
    case VK_RIGHT:
        pt->x = GetHorizontalInc();
        pt->y = 0;
        break;
    case VK_DOWN:
        pt->x = 0;
        pt->y = GetVerticalInc();
        break;
    default:
        ret = FALSE;
        break;
    }
    return( ret );
}