mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-15 15:41:24 +01:00
drawing tweaks: better test for wide short tray tile; don't inval
scroll rects unless focus shifting.
This commit is contained in:
parent
b25f20587a
commit
373a931b3e
2 changed files with 30 additions and 15 deletions
|
@ -617,18 +617,23 @@ static void
|
|||
ceGetCharValHts( const XP_Rect* xprect, XP_U16* charHt, XP_U16* valHt )
|
||||
{
|
||||
XP_U16 visHt = xprect->height - TRAY_BORDER;
|
||||
XP_U16 visWidth = xprect->width - 5; /* ??? */
|
||||
|
||||
/* if tiles are wider than tall we can let them overlap vertically */
|
||||
if ( xprect->width > xprect->height ) {
|
||||
*valHt = visHt / 2;
|
||||
if ( xprect->width > (xprect->height*2) ) {
|
||||
if ( visWidth > visHt ) {
|
||||
if ( visWidth > (visHt*2) ) {
|
||||
*charHt = visHt;
|
||||
*valHt = (3*visHt) / 4;
|
||||
} else {
|
||||
*charHt = (visHt * 4) / 5;
|
||||
*charHt = (visHt * 4) / 5;
|
||||
*valHt = visHt / 2;
|
||||
}
|
||||
} else {
|
||||
*valHt = visHt / 3;
|
||||
*charHt = visHt - *valHt;
|
||||
}
|
||||
/* XP_LOGF( "%s(width:%d, height:%d)=>char: %d, val:%d", __func__, */
|
||||
/* xprect->width, xprect->height, *charHt, *valHt ); */
|
||||
}
|
||||
|
||||
DLSTATIC XP_Bool
|
||||
|
|
|
@ -430,9 +430,16 @@ makeScrollbar( CEAppGlobals* globals, XP_U16 nHidden, XP_U16 xx, XP_U16 yy,
|
|||
XP_U16 width, XP_U16 height )
|
||||
{
|
||||
HWND hwndSB;
|
||||
RECT tmp;
|
||||
XP_U16 rectHt;
|
||||
|
||||
++xx;
|
||||
width -= 2; /* make narrower: on CE will erase cell border */
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
RECT tmp = { .left = xx, .right = xx + width };
|
||||
XP_U16 rectHt = height / 10; /* each focus rect to be 1/10th height */
|
||||
tmp.left = xx;
|
||||
tmp.right = xx + width;
|
||||
rectHt = height / 10; /* each focus rect to be 1/10th height */
|
||||
|
||||
tmp.top = yy;
|
||||
tmp.bottom = yy + rectHt;
|
||||
|
@ -444,10 +451,8 @@ makeScrollbar( CEAppGlobals* globals, XP_U16 nHidden, XP_U16 xx, XP_U16 yy,
|
|||
|
||||
yy += rectHt;
|
||||
height -= rectHt * 2; /* above and below */
|
||||
|
||||
width -= 2; /* make narrower: on CE will erase cell border */
|
||||
++xx;
|
||||
#endif
|
||||
|
||||
/* Need to destroy it, or resize it, because board size may be changing
|
||||
in case where portrait display's been flipped. */
|
||||
if ( !!globals->scrollHandle ) {
|
||||
|
@ -2111,19 +2116,24 @@ ceCheckHandleFocusKey( CEAppGlobals* globals, WPARAM wParam, LPARAM lParam,
|
|||
draw = board_focusChanged( board, order[index], XP_TRUE );
|
||||
|
||||
if ( !!globals->scrollHandle ) {
|
||||
XP_Bool scrollerHasFocus = globals->scrollerHasFocus;
|
||||
if ( order[index] == OBJ_NONE ) {
|
||||
XP_ASSERT( !scrollerHasFocus );
|
||||
SetFocus( globals->scrollHandle );
|
||||
globals->scrollerHasFocus = XP_TRUE;
|
||||
} else {
|
||||
scrollerHasFocus = XP_TRUE;
|
||||
} else if ( scrollerHasFocus ) {
|
||||
SetFocus( globals->hWnd );
|
||||
globals->scrollerHasFocus = XP_FALSE;
|
||||
scrollerHasFocus = XP_FALSE;
|
||||
}
|
||||
if ( scrollerHasFocus != globals->scrollerHasFocus ) {
|
||||
globals->scrollerHasFocus = scrollerHasFocus;
|
||||
#ifdef _WIN32_WCE
|
||||
InvalidateRect( globals->hWnd, &globals->scrollRects[0], TRUE );
|
||||
InvalidateRect( globals->hWnd, &globals->scrollRects[1], TRUE );
|
||||
InvalidateRect( globals->hWnd, &globals->scrollRects[0], FALSE );
|
||||
InvalidateRect( globals->hWnd, &globals->scrollRects[1], FALSE );
|
||||
#else
|
||||
InvalidateRect( globals->scrollHandle, NULL, TRUE );
|
||||
InvalidateRect( globals->scrollHandle, NULL, FALSE );
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue