#include <blndtool.h>
Inheritance diagram for OpRemoveBlend:
Public Member Functions | |
OpRemoveBlend () | |
~OpRemoveBlend () | |
virtual void | Do (OpDescriptor *) |
This removes all the selected blend objects, leaving the original objects in the tree. Notes: Phil 12/09/2005 This routine is somewhat perverse. It makes efforts to find all the blends in the selection surface and below by calling BuildListOfSelectedNodes but then all of the blends below the selection surface don't allow themselves to be "removed" during the AllowOp phase. Note that after AllowOp has been called on inner blends the subtree is marked as OPPERMISSION_DENIED and is no longer found by Range::SmartFindNext! What a mess! (Too dangerous to change it now, though). | |
virtual void | GetOpName (String_256 *OpName) |
The GetOpName fn is overridden so that we return back a description appropriate to the type of attribute that the operation applies. | |
Static Public Member Functions | |
static BOOL | Declare () |
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. | |
Private Member Functions | |
CC_DECLARE_DYNCREATE (OpRemoveBlend) |
Definition at line 628 of file blndtool.h.
|
Definition at line 634 of file blndtool.h.
|
|
Definition at line 635 of file blndtool.h.
|
|
|
|
Adds the operation to the list of all known operations.
Definition at line 5578 of file blndtool.cpp. 05579 { 05580 return (RegisterOpDescriptor( 05581 0, 05582 _R(IDS_REMOVEBLEND), 05583 CC_RUNTIME_CLASS(OpRemoveBlend), 05584 OPTOKEN_REMOVEBLEND, 05585 OpRemoveBlend::GetState, 05586 0, /* help ID */ 05587 _R(IDBBL_REMOVEBLEND), /* bubble ID */ 05588 0 /* bitmap ID */ 05589 )); 05590 }
|
|
This removes all the selected blend objects, leaving the original objects in the tree. Notes: Phil 12/09/2005 This routine is somewhat perverse. It makes efforts to find all the blends in the selection surface and below by calling BuildListOfSelectedNodes but then all of the blends below the selection surface don't allow themselves to be "removed" during the AllowOp phase. Note that after AllowOp has been called on inner blends the subtree is marked as OPPERMISSION_DENIED and is no longer found by Range::SmartFindNext! What a mess! (Too dangerous to change it now, though).
Reimplemented from Operation. Definition at line 5437 of file blndtool.cpp. 05438 { 05439 SelRange* pSel = GetApplication()->FindSelection(); 05440 05441 BOOL ok = (pSel != NULL); 05442 05443 if (ok) ok = DoStartSelOp(FALSE,FALSE); 05444 List BlendList; 05445 if (ok) ok = BevelTools::BuildListOfSelectedNodes(&BlendList, CC_RUNTIME_CLASS(NodeBlend), FALSE); 05446 05447 05448 if (ok) 05449 { 05450 // Get an ObjChangeParam ready so we can tell the selected blend's parents what we hope to do 05451 // to the blend (i.e. replace it with other nodes). 05452 ObjChangeFlags cFlags; 05453 cFlags.MultiReplaceNode = TRUE; 05454 ObjChangeParam ObjChange(OBJCHANGE_STARTING,cFlags,NULL,this); 05455 05456 NodeListItem* pListItem = (NodeListItem*)BlendList.GetHead(); 05457 05458 05459 while (pListItem != NULL) 05460 { 05461 05462 NodeBlend* pNodeBlend = (NodeBlend*)pListItem->pNode; 05463 05464 // We now have a selected NodeBlend node. Here's what we do: 05465 // Invalidate the region 05466 // Localise common attributes 05467 // Hide the NodeBlend 05468 // Move all other nodes next to the place the NodeBlend node used to be (select them too) 05469 05470 NodeHidden* pNodeHidden; 05471 05472 // Bodge to overcome strange behaviour of this function when blends 05473 // are found inside selected blend 05474 // (After AllowOp, OPPERMISSION_DENIED is set on the blend and then 05475 // DoInvalidateRegion does nothing) 05476 pNodeBlend->ReleaseCached(TRUE, FALSE, FALSE, TRUE); 05477 05478 // Will the blend node allow us to do the op to it? 05479 ok = pNodeBlend->AllowOp(&ObjChange); 05480 05481 if(!ok) 05482 { 05483 UINT32 IDS = ObjChange.GetReasonForDenial(); 05484 05485 if (IDS == _R(IDS_CANT_REMOVE_BLEND_WHEN_BEVELLED) || 05486 IDS == _R(IDS_CANT_REMOVE_BLEND_WHEN_CONTOURED) ) 05487 InformWarning(IDS); 05488 } 05489 05490 DocRect BRect = pNodeBlend->GetBoundingRect(); 05491 Spread* pSpread = Document::GetSelectedSpread(); 05492 05493 if (ok) ok = DoInvalidateRegion(pSpread, BRect); 05494 // Invalidate the whole blend region 05495 if (ok) ok = DoInvalidateNodeRegion(pNodeBlend,TRUE,FALSE); 05496 05497 if (ok) ok = pNodeBlend->RotateBlendEndObjectsBack(this); 05498 05499 // Invalidate the whole blend region again 05500 BRect = pNodeBlend->GetBoundingRect(); 05501 if (ok) ok = DoInvalidateRegion(pSpread, BRect); 05502 // Localise the attributes 05503 if (ok) ok = DoLocaliseCommonAttributes(pNodeBlend); 05504 05505 // Firstly, hide the blend node, and deselect it 05506 if (ok) ok = DoHideNode(pNodeBlend,TRUE,&pNodeHidden,FALSE); 05507 if (ok) pNodeBlend->SetSelected(FALSE); 05508 05509 if (ok) 05510 { 05511 // Diccon 9/99 add an action so we can restore multiple blends on curves 05512 NodeBlender* pBlender = pNodeBlend->FindFirstBlender(); 05513 while (pBlender != NULL) 05514 { 05515 // set the nodeblendpathindex in an undoable way 05516 ChangeBlenderOpParam Param; 05517 Param.m_NewNodeBlendPathIndex = (-1); 05518 Param.m_ChangeType = CHANGEBLENDER_NBPINDEX; 05519 ok = ChangeBlenderAction::Init(this, &UndoActions, pBlender, Param); 05520 //pBlender = pNodeBlendFindNextBlender(pBlender); 05521 pBlender = pNodeBlend->FindNextBlender(pBlender); 05522 } 05523 } 05524 05525 // Move all the child ink nodes up (leave blender nodes safe under the hidden blend parent node) 05526 Node* pNode = pNodeBlend->FindFirstChild(); 05527 while (pNode != NULL && ok) 05528 { 05529 Node* pNext = pNode->FindNext(); 05530 05531 if (pNode->IsAnObject()) 05532 { 05533 NodeRenderableInk* pInkNode = (NodeRenderableInk*)pNode; 05534 if (pInkNode->IS_KIND_OF(NodeBlendPath)) 05535 ok = pNodeBlend->DetachNodeBlendPath(pNodeHidden,PREV,this); 05536 else if (!pInkNode->IS_KIND_OF(NodeBlender)) 05537 { 05538 ok = DoMoveNode(pInkNode,pNodeHidden,PREV); // Move next to hidden node (where blend node used to be) 05539 if (ok) DoSelectNode(pInkNode); // Select it, because it's nicer that way 05540 } 05541 } 05542 pNode = pNext; 05543 } 05544 05545 pListItem = (NodeListItem*)BlendList.GetNext(pListItem); 05546 } 05547 BlendList.DeleteAll(); 05548 05549 05550 if (ok) 05551 { 05552 // update the effected parents after the change 05553 ObjChange.Define(OBJCHANGE_FINISHED,cFlags,NULL,this); 05554 UpdateChangedNodes(&ObjChange); 05555 } 05556 05557 05558 if (ok) 05559 pSel->Update(); 05560 else 05561 FailAndExecute(); 05562 05563 End(); 05564 } 05565 }
|
|
The GetOpName fn is overridden so that we return back a description appropriate to the type of attribute that the operation applies.
Reimplemented from Operation. Definition at line 5704 of file blndtool.cpp. 05705 { 05706 *OpName = String_256(_R(IDS_REMOVEBLEND_UNDO)); 05707 }
|
|
Find out the state of the operation at the specific time.
Definition at line 5607 of file blndtool.cpp. 05608 { 05609 OpState State(FALSE,TRUE); // It's not ticked, but it is greyed by default 05610 05611 // Get an ObjChangeParam ready so we can tell the selected blend's parents what we hope to do 05612 // to the blend (i.e. replace it with other nodes). 05613 ObjChangeFlags cFlags; 05614 cFlags.MultiReplaceNode = TRUE; 05615 ObjChangeParam ObjChange(OBJCHANGE_STARTING,cFlags,NULL,NULL); 05616 05617 BOOL Denied = FALSE; 05618 List BlendList; 05619 BOOL ok = BevelTools::BuildListOfSelectedNodes(&BlendList, CC_RUNTIME_CLASS(NodeBlend), FALSE); 05620 if (ok) 05621 { 05622 NodeListItem* pListItem = (NodeListItem*)BlendList.GetHead(); 05623 05624 while (pListItem != NULL) 05625 { 05626 05627 NodeBlend* pNodeBlend = (NodeBlend*)pListItem->pNode; 05628 // will the node allow the op to happen? (Don't set op permissions - we're only asking) 05629 if (pNodeBlend->AllowOp(&ObjChange,FALSE)) 05630 State.Greyed = FALSE; // Yes! we can ungrey 05631 else 05632 Denied = TRUE; // Oooh! we've been denied by at least one selected blend 05633 05634 pListItem = (NodeListItem*)BlendList.GetNext(pListItem); 05635 } 05636 } 05637 05638 BlendList.DeleteAll(); 05639 05640 05641 05642 /* 05643 SelRange* pSel = GetApplication()->FindSelection(); 05644 05645 if (pSel != NULL) 05646 { 05647 RangeControl rg = pSel->GetRangeControlFlags(); 05648 rg.PromoteToParent = TRUE; 05649 pSel->Range::SetRangeControl(rg); 05650 05651 Node* pNode = pSel->FindFirst(); 05652 while (pNode != NULL && State.Greyed) 05653 { 05654 if (IS_A(pNode,NodeBlend)) 05655 { 05656 // will the node allow the op to happen? (Don't set op permissions - we're only asking) 05657 if (pNode->AllowOp(&ObjChange,FALSE)) 05658 State.Greyed = FALSE; // Yes! we can ungrey 05659 else 05660 Denied = TRUE; // Oooh! we've been denied by at least one selected blend 05661 } 05662 pNode = pSel->FindNext(pNode); 05663 } 05664 05665 rg.PromoteToParent = FALSE; 05666 pSel->Range::SetRangeControl(rg); 05667 } 05668 */ 05669 UINT32 IDS = 0; 05670 if (State.Greyed) 05671 { 05672 // If we are greyed because we've been denied, get the reason for the denial 05673 if (Denied) 05674 IDS = ObjChange.GetReasonForDenial(); 05675 else 05676 IDS = _R(IDS_REMOVEBLEND_GREYED); 05677 } 05678 05679 05680 if (IDS == 0) 05681 IDS = _R(IDS_REMOVEBLEND); 05682 05683 *Description = String_256(IDS); 05684 05685 return State; 05686 }
|