LOCAL BOOL ShieldFloat_OnInitDialog(HWND hDlg, HWND hWndFocus, LPARAM lParam) /************************************************************************/ { int i; BOOL active; long Color; RestorePopup( hDlg, "xyShield", RightPopup ); for (i=0; i<NUM_COLORMASKS; i++) { InitDlgItemSpin( hDlg, IDC_MASKRANGE1 + i, ColorMask.MaskRange[i], NO, 0, 100 ); active = ColorMask.Mask & (1 << i); CheckDlgButton( hDlg, IDC_MASKACTIVE1 + i, active ); CopyRGB(&ColorMask.MaskColor[i].rgb, &Color); SetWindowLong( GetDlgItem( hDlg, IDC_MASKCOLOR1+i ), GWL_ACTIVE, Color ); } CheckComboItem( hDlg, IDC_SHIELDSELECT, IDC_MASKINCLUDE,IDC_MASKEXCLUDE, ColorMask.Include ? IDC_MASKINCLUDE : IDC_MASKEXCLUDE); CheckDlgButton( hDlg, IDC_SHIELD_IFHIDDEN, !ColorMask.IfHidden ); SetupShield(); ColorMask.On = YES; ControlEnable( hDlg, IDC_PREVIEW, ColorMask.Mask ); ControlEnable( hDlg, IDC_RESET, NO ); return(TRUE); }
/************************************************************************ UnhookZoom Unhooks the zoom window from the specified window. if this was its owner then zoom window destroys itself.. ************************************************************************/ void UnhookZoom(HWND hWnd) { HWND hOwner, hWndMe; if (!hZoomWindow) return; hOwner = GetZoomOwner(hZoomWindow); if (hOwner != hWnd || !hOwner) return; hWndMe = hZoomWindow; DestroyWindow(hWndMe); // will set hZoomWindow = NULL hZoomWindow = NULL; } //************************************************************************ // ZoomSizeToDef // Computes and sets size and position on the screen // for the new zoom window according to the defaults //***********************************************************************/ void ZoomSizeToDef() { LPIMAGE lpMyImage; RECT rOwner, rArea, rParent; HWND hWndOwner,hParent; int x,y,height, width; int borderW, borderH; STRING szString; if (!hZoomWindow) return; lpMyImage = (LPIMAGE)GetImagePtr (hZoomWindow ); hWndOwner = GetZoomOwner(hZoomWindow); hParent = PictPubApp.Get_hWndAstral(); if (!hWndOwner || !hParent) return; if (hZoomWindow && lpMyImage ) { x = View.rZoomRect.left; y = View.rZoomRect.top; width = View.rZoomRect.right - View.rZoomRect.left; height = View.rZoomRect.bottom - View.rZoomRect.top; if (height == 0 || width == 0) { // no previous values // use saved values if possible GetDefaultString( _T("sizeZoom"), _T("0,0"), szString, sizeof(STRING) ); AsciiToInt2( szString, &width, &height); if (width+height != 0) { MoveWindow (hZoomWindow,x,y,width, height, FALSE); if (RestorePopup( hZoomWindow, _T("xyZoom"), NULL )) { // Restore popup will change View.rZoomRect x = View.rZoomRect.left; y = View.rZoomRect.top; MoveWindow (hZoomWindow,x,y,width, height, FALSE); return; } } // saved values failed, now use defaults GetWindowRect(hZoomWindow, &rArea); borderW = rArea.right - rArea.left; borderH = rArea.bottom - rArea.top; GetClientRect(hZoomWindow, &rArea); borderW -= rArea.right - rArea.left; borderH -= rArea.bottom - rArea.top; GetClientRect(hWndOwner, &rOwner); GetClientRect(hParent, &rParent); height = FMUL(RectHeight(&rOwner), View.ZoomDefaultSize)+borderH; width = FMUL(RectWidth(&rOwner), View.ZoomDefaultSize)+borderW; x = rParent.right-width; y = rParent.top + borderH; if (IsIconic(hWndOwner)) { height = (rOwner.bottom - rOwner.top)+borderH; width = (rOwner.right - rOwner.left)+borderW; } } MoveWindow (hZoomWindow,x,y,width, height, FALSE); } }