LOCAL void ZoomBox_OnMouseMove(HWND hWnd, int x, int y, UINT keyFlags) /***********************************************************************/ { BOOL fRButton; POINT pt; if ( !fCapture ) return; fRButton = keyFlags & MK_RBUTTON; if (!fSelection) { if (!IsOnImage(hWnd, x, y)) return; if (fSelection = (abs(StartPoint.x-x) > SMALL_MOVEMENT || abs(StartPoint.y-y) > SMALL_MOVEMENT)) { AstralUpdateWindow(hWnd); AstralSetRectEmpty( &SelectRect ); StartSelection( hWnd, NULL, &SelectRect, SL_BOX|SL_SPECIAL|SL_NOLIMIT, StartPoint, 0L ); } } if (fSelection) { pt.x = x; pt.y = y; UpdateSelection( hWnd, NULL, &SelectRect, SL_BOX|SL_NOLIMIT, pt, CONSTRAINASPECT, lAspectX, lAspectY, MOVEKEY||fRButton,FROMCENTER); } }
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; } }
void TextureFillProc( HWND hWindow, UINT msg, int x, int y, UINT32 Option ) /************************************************************************/ { FNAME szFileName; LPIMAGE lpImage; TEXTUREFILL_PARMS parms; switch (msg) { case WM_CREATE: // The first mouse down message // Load the texture if (!IsOnImage(hWindow, x, y)) break; if (!LookupExtFile(Texture.TextureName, szFileName, IDN_TEXTURE)) break; if (!FileExists(szFileName)) { Message(IDS_EOPEN, (LPSTR)szFileName); break; } lpImage = (LPIMAGE)GetImagePtr ( hWindow ); parms.TextureOpacity = Texture.TextureOpacity; parms.TextureMergeMode = Texture.TextureMergeMode; lstrcpy(parms.TextureName, Texture.TextureName); parms.fHorzFlip = Texture.fHorzFlip; parms.fVertFlip = Texture.fVertFlip; ProcessCommand(lpImage->lpCmdList, IDS_CMD_TEXTUREFILL, &parms); break; case WM_ACTIVATE: if (!Option) // a deactivate { FrameClose( lpTextureFrame ); lpTextureFrame = NULL; } return; case WM_LBUTTONDOWN: break; case WM_LBUTTONUP: Tool.bActive = NO; 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; } }
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; } }
void TintFillProc( HWND hWindow, UINT msg, int x, int y, UINT32 Option ) /************************************************************************/ { LPIMAGE lpImage; FRMDATATYPE type; TINTFILL_PARMS parms; switch (msg) { case WM_CREATE: // The first mouse down message if (!IsOnImage(hWindow, x, y)) break; lpImage = (LPIMAGE)GetImagePtr ( hWindow ); type = FrameType(ImgGetBaseEditFrame(lpImage)); parms.FillOpacity = Fill.FillOpacity; parms.FillMergeMode = Fill.FillMergeMode; GetActiveColorFromType(type, &parms.Color); ProcessCommand(lpImage->lpCmdList, IDS_CMD_TINTFILL, &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; } }
void VignetteProc( HWND hWindow, UINT msg, int x, int y, UINT32 Option ) /************************************************************************/ { RECT Rect; BOOL fShift; POINT pt; static int Type, Style; static BOOL fConstrain; static RECT SelectRect; int res; FRMDATATYPE type; LPIMAGE lpImage; STRING szString; GRADIENT_PARMS parms; switch (msg) { case WM_CREATE: // The first mouse down message if (!IsOnImage(hWindow, x, y)) break; ImgGetInfo(GetActiveImage(), NULL, NULL, NULL, &type); if (type == FDT_LINEART) { AstralStrEx( IDC_TOOLNAMESTART+IDC_VIGNETTE, szString, sizeof(szString) ); Message(IDS_NOTWITHLINEART, (LPSTR)szString); break; } AstralUpdateWindow(hWindow); Tool.bActive = YES; // SetMaskingState( x, y ); break; case WM_LBUTTONDOWN: Type = Vignette.Gradient; fConstrain = ( Type == IDC_VIGSQUARE || Type == IDC_VIGCIRCLE ); AstralSetRectEmpty( &SelectRect ); if ( Type == IDC_VIGCIRCLE || Type == IDC_VIGELLIPSE ) Style = SL_ELLIPSE; else if ( Type == IDC_VIGRADIAL || Type == IDC_VIGLINEAR ) Style = SL_LINE; else Style = SL_BOX; pt.x = x; pt.y = y; StartSelection( hWindow, NULL, &SelectRect, Style | SL_SPECIAL, pt, 0L ); break; case WM_LBUTTONUP: Tool.bActive = NO; Rect = SelectRect; // make a copy before it gets ordered EndSelection( hWindow, NULL, &SelectRect, Style, YES ); lpImage = (LPIMAGE)GetImagePtr ( hWindow ); res = FrameResolution(ImgGetBaseEditFrame(lpImage)); type = FrameType(ImgGetBaseEditFrame(lpImage)); parms.VigOpacity = Vignette.VigOpacity; parms.VigMergeMode = Vignette.VigMergeMode; parms.iBaseRes = res; parms.x1 = Rect.left; parms.y1 = Rect.top; parms.x2 = Rect.right; parms.y2 = Rect.bottom; GetActiveColorFromType(type, &parms.StartColor); GetAlternateColorFromType(type, &parms.EndColor); parms.Gradient = Vignette.Gradient; parms.RepeatCount = Vignette.RepeatCount; parms.SoftTransition = Vignette.SoftTransition; parms.Midpoint = Vignette.Midpoint; parms.VigColorModel = Vignette.VigColorModel; ProcessCommand(lpImage->lpCmdList, IDS_CMD_GRADIENT, &parms); break; case WM_MOUSEMOVE: // sent when ToolActive is on fShift = SHIFT; pt.x = x; pt.y = y; UpdateSelection( hWindow, NULL, &SelectRect, Style, pt, fConstrain^CONSTRAINASPECT, 1L, 1L, MOVEKEY||Window.fRButtonDown, FROMCENTER); break; case WM_LBUTTONDBLCLK: break; case WM_DESTROY: // The cancel operation message if (!Tool.bActive) break; Tool.bActive = NO; EndSelection( hWindow, NULL, &SelectRect, Style, YES ); break; } }