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; }
void ViewRect(HWND hWnd, LPRECT lpRect, BOOL fResizeWindow) /************************************************************************/ { int x, y, left, top; RECT rMax; LPDISPLAY lpDisplay; HWND hMDIWindow = hWnd; CWnd *pWnd = CWnd::FromHandle(hMDIWindow); if (pWnd->IsKindOf(RUNTIME_CLASS(CServerView))) hMDIWindow = pWnd->GetParentFrame()->GetSafeHwnd(); lpDisplay = GetDisplayPtr(hWnd); if (fResizeWindow) // if allowed to change size use a max size GetClientRect(PictPubApp.Get_hClientAstral(), &rMax); else // if window size will not change use current DispRect rMax = lpDisplay->DispRect; if (!CanZoom(hWnd, 0L, lpRect, &rMax)) return; SaveLastView(hWnd); lpDisplay->FileRect = *lpRect; lpDisplay->FileRate = 0; lpDisplay->ViewPercentage = 0; x = (lpDisplay->FileRect.left + lpDisplay->FileRect.right+1) / 2; y = ( lpDisplay->FileRect.top + lpDisplay->FileRect.bottom+1) / 2; if (fResizeWindow) { GetWinXY(hMDIWindow, &left, &top); FullViewWindow(hWnd, left, top, x, y, NO); } else { ComputeDispRect(hWnd); ComputeFileRect(hWnd, x, y, lpDisplay->FileRate); SetupRulers(hWnd); InvalidateRect(hWnd, NULL, TRUE); } ZoomMainViewChanged(hWnd); }
void Zoom( HWND hWnd, int x, int y, int value, BOOL fIncremental, BOOL fAllowSizeChange ) /************************************************************************/ { LFIXED FileRate; int Percentage, left, top; LPDISPLAY lpDisplay; HWND hMDIWindow = hWnd; CWnd *pWnd = CWnd::FromHandle(hMDIWindow); if (pWnd->IsKindOf(RUNTIME_CLASS(CServerView))) hMDIWindow = pWnd->GetParentFrame()->GetSafeHwnd(); if (IsIconic(hMDIWindow)) return; if (!ComputeZoom(hWnd,x,y,value,fIncremental, &FileRate, &Percentage)) { Message( IDS_BADZOOM ); return; } SaveLastView(hWnd); lpDisplay = GetDisplayPtr(hWnd); lpDisplay->ViewPercentage = Percentage; lpDisplay->FileRate = FileRate; if (fAllowSizeChange) { GetWinXY(hMDIWindow, &left, &top); FullViewWindow(hWnd, left, top, x, y, YES); } else { ComputeDispRect(hWnd); // Change the FileRect to accomodate ComputeFileRect( hWnd, x, y, FileRate); SetupRulers(hWnd); InvalidateRect( hWnd, NULL, TRUE ); } ZoomMainViewChanged(hWnd); // update the 'zoom window' }
void RevertLastView(HWND hWnd) /************************************************************************/ { int iWidth, iHeight, i; RECT FileRect, WindowRect,r; LFIXED FileRate; int ViewPercentage; POINT UpperLeft; LPIMAGE lpImage; LPDISPLAY lpDisplay; HWND hMDIWindow = hWnd; HWND hClient; lpImage = GetImagePtr(hWnd); lpDisplay = GetDisplayPtr(hWnd); CWnd *pWnd = CWnd::FromHandle(hMDIWindow); if (pWnd->IsKindOf(RUNTIME_CLASS(CServerView))) hMDIWindow = pWnd->GetParentFrame()->GetSafeHwnd(); if (IsIconic(hMDIWindow)) return; FileRect = lpDisplay->FileRect; lpDisplay->FileRect = lpDisplay->LastFileRect; lpDisplay->LastFileRect = FileRect; FileRate = lpDisplay->FileRate; lpDisplay->FileRate = lpDisplay->LastFileRate; lpDisplay->LastFileRate = FileRate; ViewPercentage = lpDisplay->ViewPercentage; lpDisplay->ViewPercentage = lpDisplay->LastViewPercentage; lpDisplay->LastViewPercentage = ViewPercentage; ComputeDispRect(hWnd); ComputeFileRect(hWnd, -1, -1, lpDisplay->FileRate); GetWindowRect(hWnd, &WindowRect); hClient = GetParent(hMDIWindow); ScreenToClient(hClient, (LPPOINT)&WindowRect); ScreenToClient(hClient, (LPPOINT)&WindowRect.right); if (!IsZoomed(hMDIWindow) && !EqualRect(&lpDisplay->LastWindowRect, &WindowRect)) { GetWindowRect(hMDIWindow, &r); ScreenToClient(hClient, (LPPOINT)&r); ScreenToClient(hClient, (LPPOINT)&r.right); iWidth = RectWidth(&lpDisplay->LastWindowRect)-1; iWidth += r.right - WindowRect.right; iHeight = RectHeight(&lpDisplay->LastWindowRect)-1; iHeight += r.bottom - WindowRect.bottom; UpperLeft.x = lpDisplay->LastWindowRect.left; i = (WindowRect.left - r.left); UpperLeft.x -= i; iWidth += i; UpperLeft.y = lpDisplay->LastWindowRect.top; i = (WindowRect.top - r.top); UpperLeft.y -= i; iHeight += i; MoveWindow(hMDIWindow,UpperLeft.x, UpperLeft.y, iWidth, iHeight, TRUE); lpDisplay->LastWindowRect = WindowRect; } else { SetupRulers(hWnd); InvalidateRect(hWnd, NULL, TRUE); } ZoomMainViewChanged(hWnd); }
LOCAL void ZoomBox_OnSize(HWND hWnd, UINT state, int cx, int cy) /***********************************************************************/ { ZoomMainViewChanged(NULL); SetZoomDefSize(cx, cy); }