#include <penedit.h>
Inheritance diagram for OpAddPath:
Public Member Functions | |
OpAddPath () | |
OpAddPath constructor. | |
Protected Member Functions | |
ExecuteType | AugmentPathWithPath (Path *, NodePath *, INT32) |
This operation is called to update an existing path. If successful it will create a new node, copy the contents of pElement into it and apply the current attributes to it. | |
ActionCode | DeselectPoint (NodePath *pDestNode, INT32 position) |
ActionCode | DeselectHandle (NodePath *pDestNode, INT32 position) |
Definition at line 520 of file penedit.h.
|
OpAddPath constructor.
Definition at line 2435 of file penedit.cpp.
|
|
This operation is called to update an existing path. If successful it will create a new node, copy the contents of pElement into it and apply the current attributes to it.
Definition at line 2462 of file penedit.cpp. 02463 { 02464 #ifndef STANDALONE 02465 02466 // Get a pointer to the path object (makes reading easier) 02467 Path* pDestPath = &(pDestinNode->InkPath); 02468 02469 PathFlags* Flags = pDestPath->GetFlagArray(); 02470 PathVerb* Verbs = pDestPath->GetVerbArray(); 02471 DocCoord* Coords = pDestPath->GetCoordArray(); 02472 02473 PathVerb AfterVerb = Verbs[after] & ~PT_CLOSEFIGURE; 02474 02475 // Set the insert position (v important for path->makespace func) 02476 pDestPath->SetPathPosition(after+1); 02477 02478 // calc how many coords in the insert path 02479 INT32 NumInSource = pSourcePath->GetNumCoords(); 02480 02481 // If we're undoing, create an action for this insert 02482 Action* UnAction; // pointer to action that might be created 02483 ActionCode Act; // Action code that might be used 02484 02485 // Remove selection from around this handle 02486 Act = DeselectHandle(pDestinNode, after); 02487 if (Act == AC_FAIL) 02488 return ExeInclusive; 02489 02490 // if inserting after a moveto, we change the moveto. 02491 if (AfterVerb == PT_MOVETO) 02492 { 02493 // alter the coordinate of the move to 02494 Act = ModifyElementAction::Init(this, 02495 &UndoActions, 02496 Verbs[after], 02497 Flags[after], 02498 Coords[after], 02499 after, 02500 pDestinNode, 02501 (Action**)&UnAction); 02502 02503 if (Act == AC_FAIL) 02504 return ExeInclusive; 02505 02506 DocCoord* SCoords = pSourcePath->GetCoordArray(); 02507 Coords[after] = SCoords[0]; 02508 Flags[after].IsSelected = TRUE; 02509 02510 } 02511 02512 // record a record for the undo. we're inserting elements so we'll want to delete them during undo 02513 Act = RemovePathElementAction::Init(this, &UndoActions, NumInSource-1, after+1, (Action**)(&UnAction)); 02514 if (Act == AC_FAIL) 02515 return ExeInclusive; 02516 02517 // record the path pointer where the remove will take place. (Why isn't this part of the above?) 02518 if (Act == AC_OK) 02519 ((RemovePathElementAction*)UnAction)->RecordPath(pDestinNode); 02520 02521 // copy the necessary data into the destination path. return fail if unable to do so 02522 if (!pDestPath->MergeSectionFrom(after+1, *pSourcePath, 1, NumInSource-1)) 02523 return ExeExclusive; 02524 02525 #endif 02526 return ExeNone; 02527 02528 }
|
|
Definition at line 2580 of file penedit.cpp. 02581 { 02582 #ifndef STANDALONE 02583 02584 ActionCode Act; // Action code that might be used 02585 02586 // Remove the selected end bit 02587 Act = DeselectPoint(pDestinNode, after); 02588 if (Act == AC_FAIL) 02589 return Act; 02590 02591 INT32 lasti = pDestinNode->InkPath.GetNumCoords() -1; 02592 02593 // Now check and remove any other selection bits around the handle 02594 PathVerb* Verbs = pDestinNode->InkPath.GetVerbArray(); 02595 PathVerb AfterVerb = Verbs[after] & ~PT_CLOSEFIGURE; 02596 02597 switch (AfterVerb) 02598 { 02599 case PT_MOVETO: 02600 if (after < lasti) 02601 { 02602 PathVerb NextVerb = Verbs[after+1] & ~PT_CLOSEFIGURE; 02603 if (NextVerb == PT_BEZIERTO) 02604 Act = DeselectPoint(pDestinNode,after+1); 02605 } 02606 break; 02607 02608 case PT_BEZIERTO: 02609 if (after>0) 02610 Act = DeselectPoint(pDestinNode,after-1); 02611 break; 02612 } 02613 02614 return Act; 02615 02616 #else 02617 return AC_OK; 02618 #endif 02619 }
|
|
Definition at line 2545 of file penedit.cpp. 02546 { 02547 #ifndef STANDALONE 02548 02549 Action* UnAction; // pointer to action that might be created 02550 ActionCode Act; // Action code that might be used 02551 02552 PathFlags* Flags = pDestNode->InkPath.GetFlagArray(); 02553 02554 Act = ModifyFlagsAction::Init(this, &UndoActions, Flags[position], position, pDestNode, (Action**)(&UnAction)); 02555 if (Act != AC_FAIL) 02556 Flags[position].IsSelected = FALSE; 02557 02558 return Act; 02559 02560 #else 02561 return AC_OK; 02562 #endif 02563 }
|