#include <penedit.h>
Inheritance diagram for OpPenHandles:
Public Member Functions | |
OpPenHandles () | |
OpPenEorHandles constructor. | |
Protected Member Functions | |
void | RenderHandles () |
Render some drag control handles as the mouse moves around. These will spin around an anchor point. | |
void | UpdateHandles (RenderRegion *) |
Render some drag control handles as the mouse moves around. These will spin around an anchor point. Their appearence and positioning is set by the flags variable hflags. | |
DocRect | GetHandlesRect () |
Calculate the bounding rect of the drag blobs. | |
void | RecalcHandles (DocCoord, BOOL) |
Recalc handles, given a new drag position which is generally following the mouse pointer, will work out the relative positions of the drag handles. The drag handles can be made to follow the drag position absolutely, or reletively dependent on their start positions. | |
void | SetDragHandles (HandleFlags, DocCoord, DocCoord, DocCoord, Spread *) |
Set up the initial positions of the drag handles. Note, the handles contain their own coordinates of where they think they are. These are separate from the drag mouse position. This allows the handles to represent a relation to the drag point and not an absolute position. | |
void | ChangeTrackHandle (DocCoord, BOOL) |
DocCoord | GetTrackHandle () const |
Return the private track handle coordinate for reference by none inclass code. | |
DocCoord | GetGhostHandle () const |
DocCoord | GetMidHandle () const |
DocCoord | CalcGhostEnd (DocCoord start, DocCoord end) const |
Calculate a ghost end coordinate given two input coordinates. ghost = point1 - (point2 - point1). | |
void | RenderTestRect (DocRect, Spread *, StockColour) |
Render a black rectangle. Useful for checking render regions and clipping. | |
BOOL | HasMouseMoved (DocCoord &OriginalPoint, DocCoord &PointerPos, double threshold=2) |
Checks to see whether two coordinates are the same. The current test also checks for movement of less than two pixels in the scaled view. If the mouse has moved less than threshold*ScaledPixelSize then the points are considered equivalent. | |
Protected Attributes | |
HandleFlags | Hflags |
DocCoord | StartMousePos |
DocCoord | CurrentMousePos |
Spread * | StartSpread |
Private Member Functions | |
void | SetHandleEnds (DocCoord, DocCoord, DocCoord) |
Private Attributes | |
DocCoord | TrackEnd |
DocCoord | MidPoint |
DocCoord | GhostEnd |
Definition at line 229 of file penedit.h.
|
OpPenEorHandles constructor.
Definition at line 230 of file penedit.cpp.
|
|
Calculate a ghost end coordinate given two input coordinates. ghost = point1 - (point2 - point1).
Definition at line 279 of file penedit.cpp. 00280 { 00281 DocCoord ghost; 00282 ghost.x = start.x - (end.x - start.x); 00283 ghost.y = start.y - (end.y - start.y); 00284 00285 return ghost; 00286 }
|
|
Definition at line 527 of file penedit.cpp. 00528 { 00529 CurrentMousePos = newpos; 00530 RecalcHandles(newpos, constrain); 00531 }
|
|
Definition at line 254 of file penedit.cpp. 00255 { 00256 return GhostEnd; 00257 }
|
|
Calculate the bounding rect of the drag blobs.
Definition at line 301 of file penedit.cpp. 00302 { 00303 // just set it to be an empty rectangle 00304 DocRect BoundRect (0,0,0,0); 00305 DocView* pDocView = DocView::GetSelected(); 00306 ERROR2IF(pDocView == NULL, BoundRect, 00307 "No selected DocView in OpPenHandles::GetHandlesRect()"); 00308 00309 // Find the Rect around the drag blobs if there is any, otherwise return that bbox 00310 // of the start pos. 00311 00312 OSRenderRegion::GetBlobRect(pDocView->GetViewScale(), TrackEnd, BT_SELECTEDLARGEST, &BoundRect); 00313 DocRect BlobRect; 00314 OSRenderRegion::GetBlobRect(pDocView->GetViewScale(), GhostEnd, BT_SELECTEDLARGEST, &BlobRect); 00315 BoundRect = BoundRect.Union(BlobRect); 00316 return BoundRect; 00317 }
|
|
Definition at line 259 of file penedit.cpp. 00260 { 00261 return MidPoint; 00262 }
|
|
Return the private track handle coordinate for reference by none inclass code.
Definition at line 249 of file penedit.cpp. 00250 { 00251 return TrackEnd; 00252 }
|
|
Checks to see whether two coordinates are the same. The current test also checks for movement of less than two pixels in the scaled view. If the mouse has moved less than threshold*ScaledPixelSize then the points are considered equivalent.
Definition at line 551 of file penedit.cpp. 00552 { 00553 if (OriginalPoint==PointerPos) 00554 return FALSE; 00555 00556 INT32 dist = (INT32)(OriginalPoint.Distance(PointerPos)+0.5); 00557 00558 FIXED16 ScaledPixelWidth, 00559 ScaledPixelHeight; 00560 GetWorkingView()->GetScaledPixelSize(&ScaledPixelWidth, &ScaledPixelHeight); 00561 00562 INT32 PixWidth = ScaledPixelWidth.MakeLong(); 00563 INT32 PixHeight = ScaledPixelHeight.MakeLong(); 00564 00565 PixWidth = (INT32)(PixWidth*threshold+0.5); 00566 PixHeight = (INT32)(PixHeight*threshold+0.5); 00567 00568 INT32 range; 00569 (PixWidth<PixHeight) ? (range=PixHeight) : (range=PixWidth); 00570 00571 return (dist>range); 00572 }
|
|
Recalc handles, given a new drag position which is generally following the mouse pointer, will work out the relative positions of the drag handles. The drag handles can be made to follow the drag position absolutely, or reletively dependent on their start positions.
Definition at line 336 of file penedit.cpp. 00337 { 00338 00339 // Recalculate the position of the handle which is following the 00340 // mouse. 00341 00342 DocCoord Constrain = DragPos; 00343 if (constrain) 00344 DocView::ConstrainToAngle(MidPoint, &Constrain); 00345 00346 if (Hflags.TrackPointMoves) 00347 TrackEnd=Constrain; 00348 else if (Hflags.TrackPointSpins) 00349 { 00350 double Glen = TrackEnd.Distance(MidPoint); 00351 double Dlen = Constrain.Distance(MidPoint); 00352 DocCoord direction; 00353 direction.x = Constrain.x - MidPoint.x; 00354 direction.y = Constrain.y - MidPoint.y; 00355 if (Dlen!=0) 00356 { 00357 double ndx = direction.x / Dlen; 00358 double ndy = direction.y / Dlen; 00359 TrackEnd.x = MidPoint.x + (INT32)(Glen*ndx); 00360 TrackEnd.y = MidPoint.y + (INT32)(Glen*ndy); 00361 } 00362 } 00363 00364 // Recalc the position of the handle opposite, the track handle accross 00365 // the midpoint. 00366 00367 if (Hflags.GhostPointMoves) 00368 { 00369 GhostEnd.x = MidPoint.x - (Constrain.x - MidPoint.x); 00370 GhostEnd.y = MidPoint.y - (Constrain.y - MidPoint.y); 00371 } 00372 else if (Hflags.GhostPointSpins) 00373 { 00374 // if we're spinning, the ghost point will remain a set distance 00375 // from the midpoint, but just spin around coincident with 00376 // the drag pos. 00377 double Glen = GhostEnd.Distance(MidPoint); 00378 double Dlen = Constrain.Distance(MidPoint); 00379 DocCoord direction; 00380 direction.x = Constrain.x - MidPoint.x; 00381 direction.y = Constrain.y - MidPoint.y; 00382 if (Dlen!=0) 00383 { 00384 double ndx = direction.x / Dlen; 00385 double ndy = direction.y / Dlen; 00386 GhostEnd.x = MidPoint.x - (INT32)(Glen*ndx); 00387 GhostEnd.y = MidPoint.y - (INT32)(Glen*ndy); 00388 } 00389 } 00390 00391 }
|
|
Render some drag control handles as the mouse moves around. These will spin around an anchor point.
Definition at line 406 of file penedit.cpp. 00407 { 00408 DocRect Rect = GetHandlesRect(); 00409 RenderRegion* pRegion = DocView::RenderOnTop( &Rect, StartSpread, ClippedEOR ); 00410 while ( pRegion ) 00411 { 00412 UpdateHandles(pRegion); 00413 pRegion = DocView::GetNextOnTop(NULL); 00414 } 00415 }
|
|
Render a black rectangle. Useful for checking render regions and clipping.
Definition at line 586 of file penedit.cpp. 00587 { 00588 if (Error::IsUserName("Mike")) 00589 { 00590 TRACE( _T("RectLox=%d\n"),Rect.lo.x); 00591 TRACE( _T("RectLoy=%d\n"),Rect.lo.y); 00592 TRACE( _T("RectHix=%d\n"),Rect.hi.x); 00593 TRACE( _T("RectHiy=%d\n\n"),Rect.hi.y); 00594 } 00595 00596 RenderRegion* pRegion = DocView::RenderOnTop( &Rect, pSpread, ClippedEOR ); 00597 while ( pRegion ) 00598 { 00599 pRegion -> SetFillColour(colour); 00600 pRegion -> DrawRect(&Rect); 00601 pRegion = DocView::GetNextOnTop(NULL); 00602 } 00603 }
|
|
Set up the initial positions of the drag handles. Note, the handles contain their own coordinates of where they think they are. These are separate from the drag mouse position. This allows the handles to represent a relation to the drag point and not an absolute position.
Definition at line 503 of file penedit.cpp. 00508 { 00509 StartMousePos = Click; 00510 CurrentMousePos = Click; 00511 StartSpread = pSpread; 00512 Hflags = HandFlags; 00513 SetHandleEnds(Click, Drag, Ghost); 00514 }
|
|
Definition at line 476 of file penedit.cpp.
|
|
Render some drag control handles as the mouse moves around. These will spin around an anchor point. Their appearence and positioning is set by the flags variable hflags.
Definition at line 433 of file penedit.cpp. 00434 { 00435 pRegion->SetLineColour(COLOUR_BEZIERBLOB); 00436 pRegion->SetFillColour(COLOUR_TRANS); 00437 pRegion->DrawBlob(MidPoint, BT_SELECTED); 00438 00439 if (TrackEnd != MidPoint) 00440 { 00441 pRegion->SetLineColour(COLOUR_BEZIERLINE); 00442 pRegion->SetFillColour(COLOUR_TRANS); 00443 00444 if (Hflags.RenderTrackEnd && Hflags.RenderGhostEnd) 00445 pRegion->DrawLine(TrackEnd, GhostEnd); 00446 else 00447 { 00448 if (Hflags.RenderTrackEnd) 00449 pRegion->DrawLine(TrackEnd,MidPoint); 00450 if (Hflags.RenderGhostEnd) 00451 pRegion->DrawLine(GhostEnd,MidPoint); 00452 } 00453 00454 pRegion -> SetLineColour(COLOUR_TRANS); 00455 pRegion -> SetFillColour(COLOUR_UNSELECTEDBLOB); 00456 00457 if (Hflags.RenderTrackEnd) 00458 pRegion -> DrawBlob(TrackEnd, BT_UNSELECTED); 00459 if (Hflags.RenderGhostEnd) 00460 pRegion -> DrawBlob(GhostEnd, BT_UNSELECTED); 00461 00462 } 00463 }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|