#include <blndtool.h>
Inheritance diagram for OpAddBlendPath:
Public Member Functions | |
OpAddBlendPath () | |
~OpAddBlendPath () | |
virtual void | Do (OpDescriptor *) |
This removes all the selected blend objects, leaving the original objects in the tree. | |
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. | |
BOOL | IsBlendPathOnTopOfBlend (SelRange *pSel) |
Little utility called by OpAddBlendPath::Do, does what the name suggests. | |
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 (OpAddBlendPath) |
Definition at line 567 of file blndtool.h.
|
Definition at line 573 of file blndtool.h.
|
|
Definition at line 574 of file blndtool.h.
|
|
|
|
Adds the operation to the list of all known operations.
Definition at line 5103 of file blndtool.cpp. 05104 { 05105 return (RegisterOpDescriptor( 05106 0, 05107 _R(IDS_ADDBLENDPATH), 05108 CC_RUNTIME_CLASS(OpAddBlendPath), 05109 OPTOKEN_ADDBLENDPATH, 05110 OpAddBlendPath::GetState, 05111 0, /* help ID */ 05112 _R(IDBBL_ADDBLENDPATH), /* bubble ID */ 05113 0 /* bitmap ID */ 05114 )); 05115 }
|
|
This removes all the selected blend objects, leaving the original objects in the tree.
Reimplemented from Operation. Definition at line 4991 of file blndtool.cpp. 04992 { 04993 SelRange* pSel = GetApplication()->FindSelection(); 04994 04995 BOOL ok = (pSel != NULL); 04996 04997 04998 if (ok) ok = DoStartSelOp(FALSE,FALSE); 04999 05000 /* DY 16/9 in order to render the BlendPath either on 05001 top of or below the rest of the blend we need to know where it was in the 05002 tree before we began */ 05003 BOOL BlendPathOnTop = FALSE; 05004 if (ok) 05005 BlendPathOnTop = IsBlendPathOnTopOfBlend(pSel); 05006 05007 if (ok) 05008 { 05009 // Get an ObjChangeParam ready so we can tell the selected objects what we hope to do 05010 // to the them (i.e. effectively delete them and use their paths). 05011 ObjChangeFlags cFlags; 05012 cFlags.DeleteNode = TRUE; 05013 ObjChangeParam ObjChange(OBJCHANGE_STARTING,cFlags,NULL,this); 05014 05015 BlendPathBecomeA BPBecomeA(this); 05016 BecomeA TestPathBecomeA(BECOMEA_TEST, CC_RUNTIME_CLASS(NodePath)); 05017 05018 Node* pSelNode = pSel->FindFirst(); 05019 while (pSelNode != NULL && ok) 05020 { 05021 Node* pNode = pSelNode; 05022 pSelNode = pSel->FindNext(pSelNode); 05023 05024 if (!pNode->IS_KIND_OF(NodeBlend) && pNode->IsAnObject() && pNode->CanBecomeA(&TestPathBecomeA)) 05025 { 05026 // Will the blend node allow us to do the op to it? 05027 ok = pNode->AllowOp(&ObjChange); 05028 if (ok) ok = pNode->DoBecomeA(&BPBecomeA); 05029 if (ok) ok = DoInvalidateNodeRegion((NodeRenderableInk*)pNode,TRUE,FALSE); 05030 if (ok) ok = DoHideNode(pNode,TRUE); 05031 } 05032 } 05033 05034 // Get an ObjChangeParam ready so we can tell the selected blends what we hope to do 05035 // to the them (i.e. effectively add or change the blend path "attribute"). 05036 ObjChangeFlags cBlendFlags; 05037 cBlendFlags.Attribute = TRUE; 05038 ObjChangeParam BlendChange(OBJCHANGE_STARTING,cBlendFlags,NULL,this); 05039 05040 NodePath* pBlendPath = BPBecomeA.GetNodePath(); 05041 CCAttrMap* pAttrMap = BPBecomeA.GetAttrMap(); 05042 05043 if (ok) ok = (pBlendPath != NULL); 05044 05045 pSelNode = pSel->FindFirst(); 05046 while (pSelNode != NULL && ok) 05047 { 05048 Node* pNode = pSelNode; 05049 pSelNode = pSel->FindNext(pSelNode); 05050 05051 if (pNode->IS_KIND_OF(NodeBlend)) 05052 { 05053 NodeBlend* pNodeBlend = (NodeBlend*)pNode; 05054 05055 05056 ok = pNodeBlend->AllowOp(&BlendChange); 05057 if (ok) ok = pNodeBlend->BlendAlongThisPath(pBlendPath,pAttrMap,this, BlendPathOnTop); 05058 if (ok) ok = DoInvalidateNodeRegion(pNodeBlend,TRUE); 05059 if (ok) 05060 { 05061 // Diccon 9/99 added changeblend action 05062 ChangeBlendAction* pAction; 05063 ChangeBlendOpParam ChangeParam; 05064 ChangeParam.ChangeType = CHANGEBLEND_BLENDONPATH; 05065 ChangeParam.NewBlendedOnCurve = TRUE; 05066 ok = ChangeBlendAction::Init(this,&UndoActions,pNodeBlend,&ChangeParam,&pAction) != AC_FAIL; 05067 } 05068 05069 pNodeBlend->UpdateStepDistance(); 05070 } 05071 } 05072 05073 if (ok) 05074 { 05075 // update the effected parents after the change 05076 ObjChange.Define(OBJCHANGE_FINISHED,cFlags,NULL,this); 05077 UpdateChangedNodes(&ObjChange); 05078 } 05079 } 05080 05081 if (ok) 05082 { 05083 pSel->Update(); 05084 05085 } 05086 else 05087 FailAndExecute(); 05088 05089 End(); 05090 }
|
|
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 5197 of file blndtool.cpp. 05198 { 05199 *OpName = String_256(_R(IDS_ADDBLENDPATH_UNDO)); 05200 }
|
|
Find out the state of the operation at the specific time.
Definition at line 5132 of file blndtool.cpp. 05133 { 05134 OpState State(FALSE,TRUE); // It's not ticked, but it is greyed by default 05135 05136 // Get an ObjChangeParam ready so we can tell the selected blend's parents what we hope to do 05137 // to the blend (i.e. replace it with other nodes). 05138 ObjChangeFlags cFlags; 05139 cFlags.MultiReplaceNode = TRUE; 05140 ObjChangeParam ObjChange(OBJCHANGE_STARTING,cFlags,NULL,NULL); 05141 05142 BOOL Denied = FALSE; 05143 SelRange* pSel = GetApplication()->FindSelection(); 05144 05145 if (pSel != NULL) 05146 { 05147 Node* pNode = pSel->FindFirst(); 05148 while (pNode != NULL && State.Greyed) 05149 { 05150 if (IS_A(pNode,NodeBlend)) 05151 { 05152 // will the node allow the op to happen? (Don't set op permissions - we're only asking) 05153 if (pNode->AllowOp(&ObjChange,FALSE)) 05154 State.Greyed = FALSE; // Yes! we can ungrey 05155 else 05156 Denied = TRUE; // Oooh! we've been denied by at least one selected blend 05157 } 05158 pNode = pSel->FindNext(pNode); 05159 } 05160 } 05161 05162 UINT32 IDS = 0; 05163 if (State.Greyed) 05164 { 05165 // If we are greyed because we've been denied, get the reason for the denial 05166 if (Denied) 05167 IDS = ObjChange.GetReasonForDenial(); 05168 else 05169 IDS = _R(IDS_ADDBLENDPATH_GREYED); 05170 } 05171 05172 05173 if (IDS == 0) 05174 IDS = _R(IDS_ADDBLENDPATH); 05175 05176 *Description = String_256(IDS); 05177 05178 return State; 05179 }
|
|
Little utility called by OpAddBlendPath::Do, does what the name suggests.
Definition at line 5280 of file blndtool.cpp. 05281 { 05282 Node* pNode = pSel->FindFirst(); 05283 05284 while (pNode != NULL) 05285 { 05286 if (pNode->IS_KIND_OF(NodeBlend)) 05287 return TRUE; 05288 else if (pNode->IS_KIND_OF(NodePath)) 05289 return FALSE; 05290 05291 pNode = pSel->FindNext(pNode); 05292 } 05293 05294 /* no way we should reach this point as there must be 05295 either one or the other in the selection for the op to be 05296 allowed, but just in case.. */ 05297 return TRUE; 05298 }
|