#include <pathedit.h>
Inheritance diagram for OpNodePathEditControlBlob:
Public Member Functions | |
OpNodePathEditControlBlob () | |
void | DoStartDragEdit (NodePath *, DocCoord Anchor, Spread *pSpread, INT32) |
This is called when a Drag operation has been started on a control point of a path. | |
virtual void | DragPointerMove (DocCoord PointerPos, ClickModifiers ClickMods, Spread *, BOOL bSolidDrag) |
This is called every time the mouse moves, during a drag. | |
virtual void | RenderDragBlobs (DocRect, Spread *, BOOL bSolidDrag) |
Renders the new version of the path to the window. It calls to the base class function to render the path, then renders some blobs itself. | |
Static Public Member Functions | |
static BOOL | Init () |
Adds the operation to the list of all known operations. | |
static OpState | GetState (String_256 *Description, OpDescriptor *) |
Find out the state of the operation at the specific time. | |
Protected Member Functions | |
BOOL | BuildEditPath () |
Builds a copy of the path that we can edit, without destroying the original data. Also sets the NeedToRenderFlags for the EOR rendering during the drag. The parts of the path need to be rendered during the drag are the segment that contains this control point and the segment with the opposite control point if the rotate flag is set on the endpoint. | |
void | RecalculatePath (DocCoord Offset) |
Will move the control point in question and then re-calculate the whole path setting the redraw flag where needed. | |
virtual void | RenderDraggingBlobs (DocRect, Spread *) |
Call this function to render all the blobs on screen from this operation. | |
void | RenderPathEditControlBlobs (DocRect Rect, Spread *pSpread) |
Renders the new version of the path to the window. It calls to the base class function to render the path, then renders some blobs itself. | |
void | SetStatusLineHelp () |
Updates the status line message to reflect the current situation. | |
Protected Attributes | |
INT32 | Index |
INT32 | EndPointIndex |
INT32 | OppositeIndex |
Definition at line 270 of file pathedit.h.
|
Definition at line 277 of file pathedit.h. 00277 : OpNodePathEditBlob() { };
|
|
Builds a copy of the path that we can edit, without destroying the original data. Also sets the NeedToRenderFlags for the EOR rendering during the drag. The parts of the path need to be rendered during the drag are the segment that contains this control point and the segment with the opposite control point if the rotate flag is set on the endpoint.
Reimplemented from OpNodePathEditBlob. Definition at line 3584 of file pathedit.cpp. 03585 { 03586 // Make a copy of the original path and clear its need to render flags 03587 const INT32 NumCoords = OriginalPath->InkPath.GetNumCoords(); 03588 if (!EditPath.Initialise(NumCoords, 24)) 03589 return FALSE; 03590 if (!EditPath.CopyPathDataFrom(&(OriginalPath->InkPath))) 03591 return FALSE; 03592 EditPath.ClearNeedToRender(); 03593 03594 PathFlags* Flags = EditPath.GetFlagArray(); 03595 03596 // Set the render flag on the endpoint after the dragged control point so that segment renders 03597 if (Flags[Index-1].IsEndPoint) 03598 Flags[Index+2].NeedToRender = TRUE; 03599 else 03600 Flags[Index+1].NeedToRender = TRUE; 03601 03602 // Now do the same for the opposite control point, if the Rotate flag is set on the endpoint 03603 if (Flags[EndPointIndex].IsRotate && OppositeIndex>=0 && OppositeIndex<NumCoords) 03604 { 03605 if (Flags[OppositeIndex-1].IsEndPoint) 03606 Flags[OppositeIndex+2].NeedToRender = TRUE; 03607 else 03608 Flags[OppositeIndex+1].NeedToRender = TRUE; 03609 } 03610 03611 // Set the endpoints smooth flag to FALSE 03612 Flags[EndPointIndex].IsSmooth = FALSE; 03613 03614 return TRUE; 03615 }
|
|
This is called when a Drag operation has been started on a control point of a path.
Definition at line 3403 of file pathedit.cpp. 03405 { 03406 // We had better take a note of the starting point of the drag 03407 LastMousePos = Anchor; 03408 StartMousePos = Anchor; 03409 StartSpread = pSpread; 03410 OriginalPath = OrigPath; 03411 Index = ControlIndex; 03412 BOOL ok = TRUE; 03413 03414 PathFlags* Flags = OrigPath->InkPath.GetFlagArray(); 03415 PathVerb* Verbs = OrigPath->InkPath.GetVerbArray(); 03416 DocCoord* Coords = OrigPath->InkPath.GetCoordArray(); 03417 03418 // Find the index of the end point that this control point is attached to 03419 if (Flags[Index-1].IsEndPoint) 03420 EndPointIndex = Index-1; 03421 else 03422 EndPointIndex = Index+1; 03423 ConstrainPoint = Coords[EndPointIndex]; 03424 ConstrainPrevPoint = ConstrainPoint; 03425 ConstrainNextPoint = ConstrainPoint; 03426 03427 // Find the opposite index 03428 OppositeIndex = OrigPath->InkPath.FindOppositeControlPoint(Index); 03429 03430 // We also need to make a version of the path that we can change 03431 if (ok) 03432 ok = BuildEditPath(); 03433 03434 // Create and send a change message about this path edit 03435 if (ok) 03436 ok = EditObjChange.ObjChangeStarting(OrigPath,this,&EditPath,StartSpread,TRUE) == CC_OK; 03437 03438 if (ok) 03439 ok = CreateCursors(); 03440 if (ok) 03441 ChangeCursor(pCrossHairCursor); 03442 03443 // Since we're editing control points, we have to clear the IsSmooth flags on this, 03444 // the adjacent point and the endpoint 03445 if (ok) 03446 { 03447 Flags = EditPath.GetFlagArray(); 03448 Verbs = EditPath.GetVerbArray(); 03449 03450 Flags[ControlIndex].IsSmooth = FALSE; 03451 if (OppositeIndex >= 0) 03452 Flags[OppositeIndex].IsSmooth = FALSE; 03453 Flags[EndPointIndex].IsSmooth = FALSE; 03454 } 03455 03456 // Render the bits of the path that are different 03457 if (ok) 03458 { 03459 DocRect EditPathBBox = EditPath.GetBoundingRect(); 03460 RenderPathEditControlBlobs(EditPathBBox, pSpread); 03461 DragStarted = TRUE; 03462 03463 // And tell the Dragging system that we need drags to happen 03464 ok = StartDrag(DRAGTYPE_AUTOSCROLL, &EditPathBBox, &LastMousePos); 03465 } 03466 03467 if (!ok) 03468 { 03469 InformError(); 03470 FailAndExecute(); 03471 End(); 03472 } 03473 }
|
|
This is called every time the mouse moves, during a drag.
Reimplemented from OpNodePathEditBlob. Definition at line 3493 of file pathedit.cpp. 03494 { 03495 EndSnapped = FALSE; // Always false in this operation 03496 03497 // If drag has moved onto a different spread, convert the coord to be relative to the 03498 // original spread. 03499 if (pSpread != StartSpread) 03500 PointerPos = MakeRelativeToSpread(StartSpread, pSpread, PointerPos); 03501 03502 Path TempPath; 03503 03504 // inform the parent a change is happening 03505 if (EditObjChange.ChangeMask.EorBlobs) 03506 { 03507 ChangeCode Chge=EditObjChange.RenderCurrentBlobs(OriginalPath,this,&EditPath,StartSpread,TRUE); 03508 if (Chge!=CC_OK) 03509 return; 03510 // Create a local copy of the edit path 03511 if (!TempPath.Initialise(EditPath.GetNumCoords(), 12)) 03512 return; 03513 TempPath.CopyPathDataFrom(&EditPath); 03514 } 03515 03516 // Optionally constrain the new position 03517 ERROR3IF(ConstrainPoint == DocCoord(-1,-1),"ConstrainPoint wasn't set"); 03518 if (ClickMods.Constrain) 03519 DocView::ConstrainToAngle(ConstrainPoint, &PointerPos); 03520 DocView::SnapCurrent(StartSpread, &PointerPos); 03521 03522 // Rub out the old EORed version of the path 03523 RenderPathEditControlBlobs( EditPath.GetBoundingRect(), StartSpread ); 03524 03525 // This is the bit where we go off and re-calculate the paths position, 03526 // based on how much the mouse has moved 03527 DocCoord Offset; 03528 Offset.x = PointerPos.x - LastMousePos.x; 03529 Offset.y = PointerPos.y - LastMousePos.y; 03530 RecalculatePath( Offset ); 03531 03532 if (EditObjChange.ChangeMask.EorBlobs) 03533 { 03534 ChangeCode Chge=EditObjChange.RenderChangedBlobs(OriginalPath,this,&EditPath,StartSpread,TRUE); 03535 if (Chge!=CC_OK) 03536 { 03537 // replace the old edit path 03538 EditPath.CopyPathDataFrom(&TempPath); 03539 RenderPathEditControlBlobs( EditPath.GetBoundingRect(), StartSpread ); 03540 return; 03541 } 03542 } 03543 03544 // Update the last mouse position and draw in the new version of the path 03545 LastMousePos = PointerPos; 03546 RenderPathEditControlBlobs( EditPath.GetBoundingRect(), StartSpread ); 03547 03548 // Now we want to update the Line tool infobar if the position of control point being 03549 // dragged is being shown. 03550 PathFlags* Flags = EditPath.GetFlagArray(); 03551 // DocCoord* Coords = EditPath.GetCoordArray(); 03552 INT32 CurrentIndex; 03553 03554 if (Flags[Index+1].IsEndPoint) 03555 { 03556 CurrentIndex = Index+1; 03557 } 03558 else 03559 { 03560 CurrentIndex = Index-1; 03561 } 03562 03563 // We'll broadcast a message about the edit, thus hopping over the kernel/tool DLL boundary 03564 BROADCAST_TO_ALL(PathEditedMsg(&EditPath, pSpread, CurrentIndex)); 03565 03566 SetStatusLineHelp(); 03567 }
|
|
Find out the state of the operation at the specific time.
Reimplemented from OpNodePathEditBlob. Definition at line 3777 of file pathedit.cpp. 03778 { 03779 OpState Blobby; 03780 03781 return Blobby; 03782 }
|
|
Adds the operation to the list of all known operations.
Reimplemented from OpNodePathEditBlob. Definition at line 3748 of file pathedit.cpp. 03749 { 03750 PORTNOTETRACE("other","OpNodePathEditControlBlob::Init - do nothing"); 03751 return (RegisterOpDescriptor( 03752 0, 03753 _R(IDS_NODEPATH_EDIT), 03754 CC_RUNTIME_CLASS(OpNodePathEditControlBlob), 03755 OPTOKEN_NODEPATH, 03756 OpNodePathEditControlBlob::GetState, 03757 0, // help ID 03758 _R(IDBBL_NODEPATHOP), 03759 0 ) ); // bitmap ID 03760 }
|
|
Will move the control point in question and then re-calculate the whole path setting the redraw flag where needed.
Definition at line 3632 of file pathedit.cpp. 03633 { 03634 // Find the coords in the path 03635 DocCoord* Coords = EditPath.GetCoordArray(); 03636 PathFlags* Flags = EditPath.GetFlagArray(); 03637 INT32 NumCoords = EditPath.GetNumCoords(); 03638 if (Flags[EndPointIndex].IsRotate && OppositeIndex >=0 && OppositeIndex < NumCoords) 03639 { 03640 EditPath.CalcRotate(Coords[EndPointIndex], &Coords[Index], &Coords[OppositeIndex], Offset); 03641 } 03642 else 03643 { 03644 Coords[Index].x += Offset.x; 03645 Coords[Index].y += Offset.y; 03646 } 03647 }
|
|
Renders the new version of the path to the window. It calls to the base class function to render the path, then renders some blobs itself.
Reimplemented from OpNodePathEditBlob. Definition at line 3661 of file pathedit.cpp. 03662 { 03663 // Don't render anything if the last mouse position is the same as the start point 03664 if (LastMousePos == StartMousePos) return; 03665 03666 // Now render the current edit path 03667 RenderPathEditControlBlobs(Rect,pSpread); 03668 03669 // And report the change to our parents. 03670 if (EditObjChange.ChangeMask.EorBlobs) 03671 EditObjChange.RenderCurrentBlobs(OriginalPath,this,&EditPath,StartSpread,TRUE); 03672 }
|
|
Call this function to render all the blobs on screen from this operation.
Reimplemented from OpNodePathEditBlob. Definition at line 3683 of file pathedit.cpp. 03684 { 03685 RenderPathEditControlBlobs(Rect, pSpread); 03686 }
|
|
Renders the new version of the path to the window. It calls to the base class function to render the path, then renders some blobs itself.
Definition at line 3703 of file pathedit.cpp. 03704 { 03705 if (LastMousePos == StartMousePos) 03706 return; 03707 03708 DocCoord* Coords = EditPath.GetCoordArray(); 03709 PathFlags* Flags = EditPath.GetFlagArray(); 03710 // PathVerb* Verbs = EditPath.GetVerbArray(); 03711 INT32 NumCoords = EditPath.GetNumCoords(); 03712 03713 // BOOL PrevIsEndPoint; 03714 DocCoord StartCoord = Coords[0]; 03715 03716 // And this bit actually draws the path we have just made 03717 RenderRegion* pRegion = DocView::RenderOnTop( NULL, StartSpread, ClippedEOR ); 03718 while ( pRegion ) 03719 { 03720 OpNodePathEditBlob::RenderPathEditBlobs(Rect, pSpread); 03721 03722 EditPath.DrawControlBlob(pRegion, Coords[Index]); 03723 EditPath.DrawControlLine(pRegion, Coords[Index], Coords[EndPointIndex]); 03724 if (Flags[EndPointIndex].IsRotate && OppositeIndex>=0 && OppositeIndex<NumCoords && Flags[Index].IsSelected) 03725 { 03726 03727 EditPath.DrawControlBlob(pRegion, Coords[OppositeIndex]); 03728 EditPath.DrawControlLine(pRegion, Coords[OppositeIndex], Coords[EndPointIndex]); 03729 } 03730 03731 // Get the Next render region 03732 pRegion = DocView::GetNextOnTop( &Rect ); 03733 03734 } 03735 }
|
|
Updates the status line message to reflect the current situation.
Reimplemented from OpNodePathEditBlob. Definition at line 3793 of file pathedit.cpp. 03794 { 03795 String_256 HelpString(_R(IDS_PATHDRAGFINISHCONTROL)); 03796 GetApplication()->UpdateStatusBarText(&HelpString, FALSE); 03797 }
|
|
Definition at line 300 of file pathedit.h. |
|
Definition at line 299 of file pathedit.h. |
|
Definition at line 301 of file pathedit.h. |