From 4d7637cfe2e56c19fe9ea2ee9eb7f61982ee2c30 Mon Sep 17 00:00:00 2001 From: ehouse Date: Sat, 5 Dec 2009 02:36:59 +0000 Subject: [PATCH] cleanup: combine clauses --- xwords4/wince/ceutil.c | 36 +++++++++++++++--------------------- 1 file changed, 15 insertions(+), 21 deletions(-) diff --git a/xwords4/wince/ceutil.c b/xwords4/wince/ceutil.c index bf82354d9..c094142dd 100755 --- a/xwords4/wince/ceutil.c +++ b/xwords4/wince/ceutil.c @@ -769,32 +769,26 @@ ceDoDlgFocusScroll( CeDlgHdr* dlgHdr, HWND nextCtrl ) * scrolling to see how to fix it. */ - if ( !IS_SMARTPHONE(dlgHdr->globals) ) { + if ( !IS_SMARTPHONE(dlgHdr->globals) && !!nextCtrl ) { HWND hDlg = dlgHdr->hDlg; + RECT rect; + XP_U16 dlgHeight, ctrlHeight, dlgTop; + XP_S16 ctrlPos; - if ( !!nextCtrl ) { - RECT rect; - XP_U16 dlgHeight, ctrlHeight, dlgTop; - XP_S16 ctrlPos; + GetClientRect( hDlg, &rect ); + dlgHeight = rect.bottom - rect.top; - GetClientRect( hDlg, &rect ); - dlgHeight = rect.bottom - rect.top; - XP_LOGF( "dlgHeight: %d", dlgHeight ); + GetWindowRect( hDlg, &rect ); + dlgTop = rect.top; - GetWindowRect( hDlg, &rect ); - dlgTop = rect.top; + GetWindowRect( nextCtrl, &rect ); + ctrlPos = rect.top - dlgTop - TITLE_HT; + ctrlHeight = rect.bottom - rect.top; - GetWindowRect( nextCtrl, &rect ); - ctrlPos = rect.top - dlgTop - TITLE_HT; - ctrlHeight = rect.bottom - rect.top; - - if ( ctrlPos < 0 ) { - XP_LOGF( "need to scroll it DOWN into view" ); - adjustScrollPos( hDlg, ctrlPos ); - } else if ( (ctrlPos + ctrlHeight) > dlgHeight ) { - XP_LOGF( "need to scroll it UP into view" ); - setScrollPos( hDlg, ctrlPos - ctrlHeight ); - } + if ( ctrlPos < 0 ) { + adjustScrollPos( hDlg, ctrlPos ); + } else if ( (ctrlPos + ctrlHeight) > dlgHeight ) { + setScrollPos( hDlg, ctrlPos - ctrlHeight ); } } } /* ceDoDlgFocusScroll */