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); } }
void CServerView::init_paste( LPOBJECT lpObject, CPoint *pt) { RECT rImage, rObjects; CServerDoc* pDoc = GetDocument(); ASSERT(pDoc); LPIMAGE lpImage = pDoc->m_lpImage; ASSERT(lpImage); int xData = RectWidth(&lpObject->rObject); int yData = RectHeight(&lpObject->rObject); // get location rect to center to object on rImage = m_lpDisplay->FileRect; int x, y; // center the object around point if (pt) { x = pt->x; y = pt->y; Display2File(GetSafeHwnd(), (LPINT)&x, (LPINT)&y); x = x - (xData/2); y = y - (yData/2); } // center the object in the location rectangle else { x = ( rImage.left + rImage.right - xData ) / 2; y = ( rImage.top + rImage.bottom - yData ) / 2; } if (x < rImage.left) x = rImage.left; if (y < rImage.top) y = rImage.top; OffsetRect(&lpObject->rObject, x, y); RemoveObjectMarquee(lpImage); // make this object temporary, so it will go away if // the paste is cancelled lpObject->StorageType = ST_TEMPORARY; // save the selection state in case of cancel SaveSelectedObjects(lpImage); ImgAddNewObject(lpImage, lpObject); ImgGetSelObjectRect(lpImage, &rObjects, YES); UpdateImage(lpImage, &rObjects, YES); }
void FloodProc( HWND hWindow, UINT msg, int x, int y, UINT32 Option ) /************************************************************************/ { FRMDATATYPE type; int res; FLOOD_PARMS parms; LPIMAGE lpImage; RECT rArea; switch (msg) { case WM_CREATE: // The first mouse down message if (!IsOnImage(hWindow, x, y)) break; Display2File(hWindow,&x, &y); lpImage = (LPIMAGE)GetImagePtr(hWindow); type = FrameType(ImgGetBaseEditFrame(lpImage)); res = FrameResolution(ImgGetBaseEditFrame(lpImage)); parms.FloodOpacity = Fill.FloodOpacity; parms.FloodMergeMode = Fill.FloodMergeMode; GetActiveColorFromType(type, &parms.Color); parms.iBaseRes = res; parms.x = x; parms.y = y; rArea.left = rArea.right = x; rArea.top = rArea.bottom = y; Measure(lpImage, &rArea, &parms.InColor); parms.FloodRange = Fill.FloodRange; parms.FloodFade = Fill.FloodFade; parms.idFloodColorModel = Fill.idFillColorModel; ProcessCommand(lpImage->lpCmdList, IDS_CMD_FLOOD, &parms); break; case WM_LBUTTONDOWN: break; case WM_LBUTTONUP: break; case WM_MOUSEMOVE: // sent when ToolActive is on break; case WM_LBUTTONDBLCLK: break; case WM_DESTROY: // The cancel operation message Tool.bActive = NO; break; } }
int LinesProc( HWND hWindow, LPARAM lParam, UINT msg ) /************************************************************************/ { int x, y, fx, fy; LPOBJECT lpObject; RGBS rgb; LPFRAME lpFrame; STRING szOptions; static RGBS rgbLast; x = LOWORD(lParam); y = HIWORD(lParam); switch (msg) { case WM_CREATE: // The first mouse down message if (!ONIMAGE(x, y)) break; Display2File(&x, &y); if ( !ImgSelectObjectType( lpImage, x, y, YES/*bAllowBase*/, YES/*bAllowMovable*/, NO/*bAllowPlayable*/ ) ) break; if (!Retouch.hBrush) break; GetActiveRGB( &rgb ); if ( rgb.red != rgbLast.red || rgb.green != rgbLast.green || rgb.blue != rgbLast.blue ) { // if a color change, restuff the brush source OptionGetString( hOptions, iTool+1, szOptions ); lpFrame = TiffResource2Frame( hOptions, (LPSTR)MAKEINTRESOURCE(iTool+1) ); SetSimpleBrushSource( Retouch.hBrush, lpFrame, szOptions ); rgbLast = rgb; } Tool.bActive = YES; break; case WM_SETCURSOR: return( SetToolCursor( hWindow, NULL/*idMoveObject*/, ID_PLAY_OBJECT ) ); case WM_ACTIVATE: if (!lParam) // a deactivate { if (Retouch.hBrush) DestroySimpleBrush(Retouch.hBrush); Retouch.hBrush = NULL; } else { // an activate ( to re-create brush) if ( Tool.hRibbon ) SendMessage( Tool.hRibbon, WM_CONTROLENABLE, 1, 0L ); } break; case WM_LBUTTONDOWN: Tool.bActive = NO; if (ImgCountSelObjects(lpImage, NULL) == 1) lpObject = ImgGetSelObject(lpImage, NULL); else { fx = x; fy = y; Display2File( &fx, &fy ); lpObject = ImgFindSelObject(lpImage, fx, fy, NO); } if (!lpObject) break; if (!ImgEditInit(lpImage, ET_OBJECT, UT_DATA, lpObject)) break; if (!SimpleBrushBegin(hWindow, &lpObject->Pixmap, lpObject->rObject.left, lpObject->rObject.top, Retouch.hBrush)) break; ImgEditedObject(lpImage, lpObject, IDS_UNDOCHANGE, NULL); Tool.bActive = SimpleBrushActive(); /* fall through to WM_MOUSEMOVE */ case WM_MOUSEMOVE: // sent when ToolActive is on fx = x; fy = y; Display2File( &fx, &fy ); SimpleBrushStroke(fx, fy, x, y); break; case WM_LBUTTONUP: SimpleBrushEnd(NO); Tool.bActive = NO; break; case WM_LBUTTONDBLCLK: break; case WM_DESTROY: // The cancel operation message SimpleBrushEnd(NO); Tool.bActive = NO; break; } return(TRUE); }