LOCAL void ZoomBox_OnLButtonDown(HWND hWnd, BOOL fDoubleClick, int x, int y, UINT keyFlags) /***********************************************************************/ { RECT rWin; HWND hOwner; if ( fCapture ) return; SetCapture( hWnd ); fCapture = TRUE; hOldFocus= GetFocus(); SetFocus(hWnd); fMarquee = EnableMarquee(FALSE); if (!IsOnImage(hWnd, x, y)) return; StartPoint.x = x; StartPoint.y = y; fSelection = NO; if ( hOwner = GetZoomOwner(hWnd) ) { GetClientRect(hOwner, &rWin); lAspectY = rWin.bottom - rWin.top ; lAspectX = rWin.right - rWin.left ; } else { lAspectY = 1L; lAspectX = 1L; } }
LOCAL void ZoomBox_OnKeyUp(HWND hWnd, UINT vk, BOOL fDown, int cRepeat, UINT flags) /***********************************************************************/ { if ( vk != VK_ESCAPE ) return; if ( !fCapture ) return; ReleaseCapture(); fCapture = FALSE; if (fSelection) EndSelection( hWnd, NULL, &SelectRect, SL_BOX | SL_NOLIMIT, YES ); SetFocus(hOldFocus); EnableMarquee(fMarquee); }
LOCAL void ZoomBox_OnLButtonUp(HWND hWnd, int x, int y, UINT keyFlags) /***********************************************************************/ { BOOL fGotaRect; LPDISPLAY lpMyDisplay; RECT ClientRect; HWND hOwner; if ( !fCapture ) return; ReleaseCapture(); fCapture = FALSE; if (fSelection) { EndSelection( hWnd, NULL, &SelectRect, SL_BOX|SL_NOLIMIT, YES ); if (abs(SelectRect.right-SelectRect.left) <= SMALL_MOVEMENT && abs(SelectRect.bottom-SelectRect.top) <= SMALL_MOVEMENT) fGotaRect = NO; else fGotaRect = YES; } else { fGotaRect = NO; SelectRect.left = SelectRect.right = StartPoint.x; SelectRect.top = SelectRect.bottom = StartPoint.y; Display2File( hWnd, (LPINT)&SelectRect.left, (LPINT)&SelectRect.top ); Display2File( hWnd, (LPINT)&SelectRect.right, (LPINT)&SelectRect.bottom ); } // clip to file rect lpMyDisplay = GetDisplayPtr(hWnd); ClientRect = lpMyDisplay->FileRect; AstralIntersectRect( &SelectRect, &SelectRect, &ClientRect ); SetFocus(hOldFocus); EnableMarquee(fMarquee); hOwner = GetZoomOwner(hWnd); if (!hOwner) return; if (IsIconic(hOwner)) return; SaveLastView(hOwner); if ( fGotaRect ) ViewRect(hOwner, &SelectRect, NO); else { Zoom( hOwner, SelectRect.left, SelectRect.top, ( SHIFT ? -100 : ( CONTROL ? +100 : 0 ) ), YES,NO); } }
static void ScrollEnd( HWND hWnd ) /************************************************************************/ { if ( !bScrolling ) return; if ( lpProc ) { // Call the display hook and turn it back on lpProc->DisplayHookProc( hWnd, Window.hDC, NULL ); SetDisplayHook( hWnd, lpProc ); lpProc = NULL; } EnableMarquee( YES ); SetupRulers(hWnd); ZoomMainViewChanged( hWnd ); bScrolling = NO; }
static void ScrollStart( HWND hWnd ) /************************************************************************/ { if ( bScrolling ) return; // Rely on the fact that we always get an SB_ENDSCROLL when done if ( hWnd == GetActiveDoc() ) DisplayBrush(0, 0, 0, OFF); if ( lpProc = GetDisplayHook(hWnd) ) { // Call the display hook and turn it off lpProc->DisplayHookProc( hWnd, Window.hDC, NULL ); SetDisplayHook( hWnd, NULL ); } EnableMarquee( NO ); RemoveMarquee(); AstralUpdateWindow( hWnd ); bScrolling = YES; }