#include <nodebrsh.h>
Inheritance diagram for NodeBrush:
Public Member Functions | |
NodeBrush () | |
This constructor creates a NodeBrush linked to no other. | |
NodeBrush (Node *ContextNode, AttachNodeDirection Direction, BOOL Locked=FALSE, BOOL Mangled=FALSE, BOOL Marked=FALSE, BOOL Selected=FALSE) | |
This method initialises the node and links it to ContextNode in the direction specified by Direction. All necessary tree links are updated. | |
~NodeBrush () | |
Destructor. | |
virtual DocRect | GetBoundingRect (BOOL DontUseAttrs=FALSE, BOOL HitTest=FALSE) |
if the bounding rect is valid it is returned, if not, it is recalculated and then returned. | |
virtual DocRect | GetBlobBoundingRect () |
This calls the base classes GetBlobBoundingRect(), and inflates the result by the width of a blob. | |
virtual void | Render (RenderRegion *pRender) |
Renders the nodebrushpath, if selected, otherwise nothing. The main rendering is performed by the nodebrushmaker. | |
virtual SubtreeRenderState | RenderSubtree (RenderRegion *pRender, Node **ppNextNode, BOOL bClip=TRUE) |
Enables Nodes to be able to Do Pre Print time alterations or even take over the control of the current Printing of their children. | |
void | RenderObjectBlobs (RenderRegion *pRender) |
Renders the object blobs. | |
void | RenderTinyBlobs (RenderRegion *pRender) |
Renders the object blobs. | |
virtual String | Describe (BOOL Plural, BOOL Verbose=TRUE) |
To return a description of the Brush object in either the singular or the plural. This method is called by the DescribeRange method. | |
virtual void | Transform (TransformBase &Trans) |
transforms the brush | |
virtual BOOL | WritePreChildrenWeb (BaseCamelotFilter *pFilter) |
Writes the brush record to the filter. | |
virtual BOOL | WritePreChildrenNative (BaseCamelotFilter *pFilter) |
Writes the brush record to the filter. | |
virtual Node * | HasEditableChild (CCRuntimeClass *ChildClass, Node *pPrevEditable) |
This function returns our edit node (the NodeBrushPath). | |
virtual ChangeCode | OnChildChange (ObjChangeParam *pParam) |
This function should be overridden in derived object classes. Composite objects can use this function to respond to one of their children undergoing a change. They should return CC_FAIL whenever they are unable to cope with the change. | |
virtual BOOL | AllowOp (ObjChangeParam *pParam, BOOL SetOpPermissionState=TRUE) |
In this instance, the func gives the brush a chance to stop an op from happening to one of its children. Currently the only permitted ops on children are those that change their appearance, .eg. change fill, line width etc. | |
NodeBrushPath * | GetNodeBrushPath () |
as above | |
void | SetNodeBrushPath (NodeBrushPath *pPath) |
as above | |
NodeBrushMaker * | GetNodeBrushMaker () |
as above | |
void | SetNodeBrushMaker (NodeBrushMaker *pMaker) |
as above | |
MILLIPOINT | GetBrushSpacing () |
as above | |
void | SetBrushSpacing (MILLIPOINT Value) |
Sets the distance between brush objects used buy the nodebrushmaker. | |
NodeRenderableInk * | GetInkNode () |
as above | |
BOOL | ResetBrushPath () |
Asks the nodebrushmaker to recalculate its number of steps, for use when the nodebrushpath has been edited. | |
BOOL | ReInitialiseInk () |
Asks the nodebrushmaker to reinitialise itself, for use when the ink node has been altered, e.g. attribute changes. Note that this must be called AFTER the attribute change in order to work. | |
BOOL | ChangeNodeBrushPath (NodeBrushPath *pNewPath) |
Changes the nodebrushpath used by the brush. | |
virtual void | PolyCopyNodeContents (NodeRenderable *pNodeCopy) |
Polymorphically copies the contents of this node to another. | |
virtual BOOL | IsValidEffectAttr (NodeAttribute *pAttr) const |
Get width of pixels for use in capturing this group as a tight group bitmapDetermine whether this type of attribute can be an effect attribute On this node at this time.Determine whether this attribute instance can be an effect attribute On this node at this time. | |
virtual BOOL | GroupCanTransformCached (TransformBase &Trans) const |
Protected Member Functions | |
virtual Node * | SimpleCopy () |
This method returns a shallow copy of the node with all Node pointers NULL. The function is virtual, and must be defined for all derived classes. | |
void | CopyNodeContents (NodeBrush *pCopyOfNode) |
Copies the data from this node to pCopyOfNode by first calling the base class to get it to copy its stuff, and then copying its own stuff Scope: protected. | |
Protected Attributes | |
String_32 | m_BrushName |
NodeBrushPath * | m_pNodeBrushPath |
NodeBrushMaker * | m_pNodeBrushMaker |
Private Member Functions | |
CC_DECLARE_DYNCREATE (NodeBrush) |
Definition at line 121 of file nodebrsh.h.
|
This constructor creates a NodeBrush linked to no other.
Definition at line 142 of file nodebrsh.cpp. 00142 : NodeGroup() 00143 { 00144 00145 }
|
|
This method initialises the node and links it to ContextNode in the direction specified by Direction. All necessary tree links are updated.
Specifies the direction in which this node is to be attached to the ContextNode. The values this variable can take are as follows: PREV : Attach node as a previous sibling of the context node NEXT : Attach node as a next sibling of the context node FIRSTCHILD: Attach node as the first child of the context node LASTCHILD : Attach node as a last child of the context node The remaining inputs specify the status of the node: Locked: Is node locked ? Mangled: Is node mangled ? Marked: Is node marked ? Selected: Is node selected ?
Definition at line 191 of file nodebrsh.cpp. 00197 :NodeGroup(ContextNode, Direction, Locked, Mangled, Marked, 00198 Selected) 00199 { 00200 00201 00202 }
|
|
Destructor.
Definition at line 220 of file nodebrsh.cpp.
|
|
In this instance, the func gives the brush a chance to stop an op from happening to one of its children. Currently the only permitted ops on children are those that change their appearance, .eg. change fill, line width etc.
Definition at line 899 of file nodebrsh.cpp. 00900 { 00901 ERROR2IF(pParam==NULL,FALSE,"NodeBlend::AllowOp() - pParam==NULL"); 00902 00903 // clean out the calling-child ptr, so it doesn't get passed around unintentionally. 00904 pParam->SetCallingChild(NULL); 00905 00906 // decide if we allow it ... (and if we'll still exist after the op) 00907 BOOL allowed=TRUE; 00908 ObjChangeFlags Flags=pParam->GetChangeFlags(); 00909 if (pParam->GetDirection()==OBJCHANGE_CALLEDBYCHILD) 00910 { 00911 if (Flags.DeleteNode || Flags.MultiReplaceNode || Flags.MoveNode) 00912 { 00913 pParam->SetReasonForDenial(_R(IDS_BLEND_CANT_OP_ON_CHILDREN)); 00914 allowed=FALSE; 00915 } 00916 } 00917 00918 // if we allow it, (and our parents weren't calling us) see if our parents do ... 00919 if (allowed && pParam->GetDirection()!=OBJCHANGE_CALLEDBYPARENT && Parent!=NULL) 00920 { 00921 ObjChangeDirection OldDirection=pParam->GetDirection(); 00922 pParam->SetCallingChild(this); 00923 pParam->SetDirection(OBJCHANGE_CALLEDBYCHILD); 00924 allowed=Parent->AllowOp(pParam,SetOpPermissionState); 00925 pParam->SetDirection(OldDirection); 00926 } 00927 00928 if (allowed && pParam->GetDirection() == OBJCHANGE_CALLEDBYCHILD) 00929 { 00930 if (pParam->GetOpPointer()) 00931 { 00932 if (pParam->GetOpPointer()->IS_KIND_OF(OpApplyShadow)) 00933 { 00934 allowed = FALSE; 00935 } 00936 00937 PORTNOTE("other", "Removed use of OpCreateBevel from NodeBrush::AllowOp") 00938 #if !defined(EXCLUDE_FROM_XARALX) 00939 if (pParam->GetOpPointer()->IS_KIND_OF(OpCreateBevel)) 00940 { 00941 allowed = FALSE; 00942 } 00943 #endif 00944 } 00945 } 00946 00947 // if setting permisions ... (and possibly cause post-op code to be called) 00948 if (SetOpPermissionState) 00949 { 00950 if (allowed) 00951 { 00952 if (Parent!=NULL) 00953 Parent->SetOpPermission(PERMISSION_ALLOWED); 00954 00955 // if post process required, ensure our OnChildChange is called (by setting permission on ourself), 00956 // insert an inverse action in the undo 00957 if (pParam->GetDirection()==OBJCHANGE_CALLEDBYCHILD || Flags.Attribute) 00958 { 00959 SetOpPermission(PERMISSION_ALLOWED); 00960 PORTNOTE("other", "Removed use of ChangeBrushOpParam from NodeBrush::AllowOp") 00961 #if !defined(EXCLUDE_FROM_XARALX) 00962 UndoableOperation* pOp=pParam->GetOpPointer(); 00963 if (pOp!=NULL) 00964 { 00965 ChangeBrushOpParam BrushParam; 00966 BrushParam.ChangeType = CHANGEBRUSH_REGEN; 00967 ChangeBrushAction* pNewAction; 00968 if (allowed) allowed=(ChangeBrushAction::Init(pOp, pOp->GetUndoActionList(), this, 00969 &BrushParam, &pNewAction) != AC_FAIL); 00970 if (allowed) allowed=pOp->DoInvalidateNodeRegion(this,TRUE); 00971 } 00972 #endif 00973 } 00974 } 00975 else 00976 SetOpPermission(PERMISSION_DENIED,TRUE); 00977 } 00978 00979 // if the op was allowed, inform our children by calling their AllowOp()s 00980 // this must be done after we've inserted our undo actions so that any child undo actions will be undone first! 00981 if (allowed && pParam->GetDirection()!=OBJCHANGE_CALLEDBYCHILD) 00982 AllowOp_AccountForCompound(pParam, SetOpPermissionState); 00983 00984 00985 // return result (directly, or indirectly via a child AllowOp()) to op 00986 return allowed; 00987 }
|
|
|
|
Changes the nodebrushpath used by the brush.
Definition at line 804 of file nodebrsh.cpp. 00805 { 00806 if (pNewPath == NULL) 00807 { 00808 ERROR3("NodeBrushPath is NULL"); 00809 return FALSE;; 00810 } 00811 00812 m_pNodeBrushPath = pNewPath; 00813 if (m_pNodeBrushMaker != NULL) 00814 m_pNodeBrushMaker->InitialisePath(pNewPath); 00815 else 00816 { 00817 ERROR3("NodeBrushMaker is NULL"); 00818 return FALSE;; 00819 } 00820 return TRUE; 00821 }
|
|
Copies the data from this node to pCopyOfNode by first calling the base class to get it to copy its stuff, and then copying its own stuff Scope: protected.
Definition at line 528 of file nodebrsh.cpp. 00529 { 00530 NodeGroup::CopyNodeContents(pCopyOfNode); 00531 00532 // Copy member vars here 00533 00534 }
|
|
To return a description of the Brush object in either the singular or the plural. This method is called by the DescribeRange method.
Reimplemented from NodeGroup. Definition at line 581 of file nodebrsh.cpp. 00582 { 00583 return m_BrushName; 00584 }
|
|
This calls the base classes GetBlobBoundingRect(), and inflates the result by the width of a blob.
Reimplemented from NodeGroup. Definition at line 238 of file nodebrsh.cpp. 00239 { 00240 00241 #if !defined(EXCLUDE_FROM_RALPH) 00242 // Find the base class blob bounding rectangle 00243 DocRect Rect = NodeGroup::GetBlobBoundingRect(); 00244 00245 // inflate it by the width of a blob (plus a bit) 00246 DocRect TempRect; 00247 GetApplication()->GetBlobManager()->GetBlobRect(Rect.lo,&TempRect); 00248 INT32 Delta = ((TempRect.hi.x - TempRect.lo.x)*1)/1; 00249 Rect.Inflate(Delta); 00250 00251 return Rect; 00252 #else 00253 return DocRect(0,0,0,0); 00254 #endif 00255 00256 }
|
|
if the bounding rect is valid it is returned, if not, it is recalculated and then returned.
Reimplemented from NodeGroup. Definition at line 275 of file nodebrsh.cpp. 00276 { 00277 /* 00278 // first get the bounding rect of the path 00279 DocRect Rect = m_pNodeBrushPath->GetBoundingRect(); 00280 00281 // inflate by half the size of the brush ink object. 00282 00283 NodeRenderableInk* pInk = m_pNodeBrushMaker->GetInkNode(); 00284 00285 if (pInk != NULL) 00286 { 00287 DocRect InkRect = pInk->GetBoundingRect(); 00288 00289 INT32 dx = InkRect.Width() / 2; 00290 INT32 dy = InkRect.Height() / 2; 00291 00292 Rect.Inflate(dx, dy); 00293 } 00294 00295 return Rect; 00296 */ 00297 // default docrect constructor makes empty rect 00298 DocRect Rect; 00299 if (m_pNodeBrushMaker != NULL) 00300 Rect = m_pNodeBrushMaker->GetBoundingRect(); 00301 00302 return Rect; 00303 }
|
|
as above
Definition at line 675 of file nodebrsh.cpp. 00676 { 00677 if (m_pNodeBrushMaker != NULL) 00678 return m_pNodeBrushMaker->GetBrushSpacing(); 00679 else 00680 { 00681 ERROR3("NodeBrushMaker is NULL"); 00682 return 0; 00683 } 00684 }
|
|
as above
Definition at line 867 of file nodebrsh.cpp. 00868 { 00869 if (m_pNodeBrushMaker != NULL) 00870 { 00871 return m_pNodeBrushMaker->GetInkNode(); 00872 } 00873 return NULL; 00874 }
|
|
as above
Definition at line 638 of file nodebrsh.cpp. 00639 { 00640 return m_pNodeBrushMaker; 00641 }
|
|
as above
Definition at line 599 of file nodebrsh.cpp. 00600 { 00601 return m_pNodeBrushPath; 00602 }
|
|
Reimplemented from NodeGroup. Definition at line 189 of file nodebrsh.h. 00189 {return FALSE;}
|
|
This function returns our edit node (the NodeBrushPath).
Reimplemented from Node. Definition at line 841 of file nodebrsh.cpp. 00842 { 00843 if (ChildClass != CC_RUNTIME_CLASS(NodePath)) 00844 return NULL; 00845 00846 NodeBrushPath* pNodeBrushPath = GetNodeBrushPath(); 00847 // check to see if this has already been asked for once 00848 if (((Node*)pNodeBrushPath) == pPreviousChild) 00849 return NULL; 00850 00851 return pNodeBrushPath; 00852 }
|
|
Get width of pixels for use in capturing this group as a tight group bitmapDetermine whether this type of attribute can be an effect attribute On this node at this time.Determine whether this attribute instance can be an effect attribute On this node at this time.
Reimplemented from NodeGroup. Definition at line 188 of file nodebrsh.h. 00188 {return FALSE;}
|
|
This function should be overridden in derived object classes. Composite objects can use this function to respond to one of their children undergoing a change. They should return CC_FAIL whenever they are unable to cope with the change.
Reimplemented from NodeGroup. Definition at line 1011 of file nodebrsh.cpp. 01012 { 01013 PORTNOTE("other","NodeBrush::OnChildChange - ChangeBrushAction ChangeBrushOpParam") 01014 #ifndef EXCLUDE_FROM_XARALX 01015 ERROR2IF(pParam == NULL,CC_FAIL,"pParam == NULL"); 01016 01017 ObjChangeType cType = pParam->GetChangeType(); 01018 ObjChangeFlags Flags = pParam->GetChangeFlags(); 01019 01020 if (cType == OBJCHANGE_FINISHED) 01021 { 01022 UndoableOperation* pUndoOp = pParam->GetOpPointer(); 01023 01024 if (pUndoOp == NULL) 01025 { 01026 ERROR3("Couldn't get undo op"); 01027 return CC_FAIL; 01028 } 01029 01030 ChangeBrushAction* pAction; 01031 ChangeBrushOpParam OpParam; 01032 OpParam.ChangeType = CHANGEBRUSH_REGEN; 01033 01034 BOOL ok = (ChangeBrushAction::Init(pUndoOp, pUndoOp->GetUndoActionList(), 01035 this, &OpParam, &pAction) != AC_FAIL); 01036 01037 if (ok) ok = pUndoOp->DoInvalidateNodeRegion(this,TRUE); 01038 01039 if (ok) 01040 return CC_OK; 01041 else 01042 return CC_FAIL; 01043 } 01044 #endif 01045 return CC_OK; 01046 }
|
|
Polymorphically copies the contents of this node to another.
Reimplemented from NodeGroup. Definition at line 550 of file nodebrsh.cpp. 00551 { 00552 ENSURE(pNodeCopy, "Trying to copy a node's contents into a NULL node"); 00553 ENSURE(IS_A(pNodeCopy, NodeBrush), "PolyCopyNodeContents given wrong dest node type"); 00554 00555 if (IS_A(pNodeCopy, NodeBrush)) 00556 CopyNodeContents((NodeBrush*)pNodeCopy); 00557 }
|
|
Asks the nodebrushmaker to reinitialise itself, for use when the ink node has been altered, e.g. attribute changes. Note that this must be called AFTER the attribute change in order to work.
Definition at line 761 of file nodebrsh.cpp. 00762 { 00763 if (m_pNodeBrushMaker!= NULL) 00764 { 00765 NodeRenderableInk* pInk = m_pNodeBrushMaker->GetInkNode(); 00766 if (pInk != NULL) 00767 { 00768 //if (!m_pNodeBrushMaker->InitialiseInk(pInk)) 00769 // return FALSE; 00770 //else 00771 { 00772 // clear the cache in case we have any points left to render 00773 m_pNodeBrushMaker->ClearListOfPointsToRender(); 00774 return TRUE; 00775 } 00776 } 00777 00778 } 00779 ERROR3("NodeBrushMaker is NULL"); 00780 return FALSE; 00781 00782 }
|
|
Renders the nodebrushpath, if selected, otherwise nothing. The main rendering is performed by the nodebrushmaker.
Reimplemented from Node. Definition at line 319 of file nodebrsh.cpp. 00320 { 00321 if (this->IsSelected()) 00322 { 00323 if (m_pNodeBrushPath != NULL) 00324 m_pNodeBrushPath->RenderObjectBlobs(pRender); 00325 } 00326 if (m_pNodeBrushMaker != NULL) 00327 m_pNodeBrushMaker->Render(pRender); 00328 }
|
|
Renders the object blobs.
Reimplemented from NodeGroup. Definition at line 364 of file nodebrsh.cpp. 00365 { 00366 #if !defined(EXCLUDE_FROM_RALPH) 00367 // Find out about the groups bounding rect 00368 DocRect BoundingRect = GetBoundingRect(); 00369 00370 // Inflate the bounds by the width of a blob 00371 DocRect TempRect; 00372 GetApplication()->GetBlobManager()->GetBlobRect(BoundingRect.lo,&TempRect); 00373 INT32 Delta = ((TempRect.hi.x - TempRect.lo.x)*3)/4; 00374 BoundingRect.Inflate(Delta); 00375 00376 // Find out where to draw the blobs 00377 DocCoord Low = BoundingRect.LowCorner(); 00378 DocCoord High = BoundingRect.HighCorner(); 00379 00380 // Set the colours of the blobs 00381 pRegion->SetFillColour(COLOUR_UNSELECTEDBLOB); 00382 pRegion->SetLineColour(COLOUR_NONE); 00383 00384 // Draw all the blobs 00385 pRegion->DrawBlob(Low, BT_UNSELECTED); 00386 pRegion->DrawBlob(High, BT_UNSELECTED); 00387 pRegion->DrawBlob(DocCoord(Low.x, High.y), BT_UNSELECTED); 00388 pRegion->DrawBlob(DocCoord(High.x, Low.y), BT_UNSELECTED); 00389 00390 // for some reason the NBP is never called, there is probably a 00391 // proper fix for this but I don't have time right now, so render 00392 // the nodeblend path here 00393 m_pNodeBrushPath->RenderObjectBlobs(pRegion); 00394 00395 00396 #endif 00397 }
|
|
Enables Nodes to be able to Do Pre Print time alterations or even take over the control of the current Printing of their children.
Reimplemented from NodeGroup. Definition at line 345 of file nodebrsh.cpp. 00346 { 00347 return SUBTREE_ROOTONLY; 00348 }
|
|
Renders the object blobs.
Reimplemented from NodeGroup. Definition at line 411 of file nodebrsh.cpp. 00412 { 00413 // for some reason the NBP is never called, there is probably a 00414 // proper fix for this but I don't have time right now, so render 00415 // the nodeblend path here 00416 m_pNodeBrushPath->RenderTinyBlobs(pRegion); 00417 00418 }
|
|
Asks the nodebrushmaker to recalculate its number of steps, for use when the nodebrushpath has been edited.
Definition at line 729 of file nodebrsh.cpp. 00730 { 00731 // get the brushmaker to recalculate how many steps it needs 00732 if (m_pNodeBrushMaker != NULL) 00733 { 00734 m_pNodeBrushMaker->RecalculateMaxStep(); 00735 m_pNodeBrushMaker->ClearListOfPointsToRender(); 00736 } 00737 else 00738 { 00739 ERROR3("NodeBrushMaker is NULL"); 00740 return FALSE; 00741 } 00742 return TRUE; 00743 00744 }
|
|
Sets the distance between brush objects used buy the nodebrushmaker.
Definition at line 698 of file nodebrsh.cpp. 00699 { 00700 if (Spacing >= BRUSH_MIN_SPACING && Spacing >= BRUSH_MAX_SPACING) 00701 { 00702 ERROR3("Invalid spacing got passed to NodeBrush::SetBrushSpacing"); 00703 Spacing = BRUSH_DEFAULT_SPACING; 00704 } 00705 00706 if (m_pNodeBrushMaker != NULL) 00707 { 00708 m_pNodeBrushMaker->SetBrushSpacing(Spacing); 00709 } 00710 else 00711 ERROR3("NodeBrushMaker is NULL"); 00712 00713 }
|
|
as above
Definition at line 657 of file nodebrsh.cpp. 00658 { 00659 m_pNodeBrushMaker = pMaker; 00660 00661 }
|
|
as above
Definition at line 618 of file nodebrsh.cpp. 00619 { 00620 m_pNodeBrushPath = pPath; 00621 00622 }
|
|
This method returns a shallow copy of the node with all Node pointers NULL. The function is virtual, and must be defined for all derived classes.
Reimplemented from NodeGroup. Definition at line 504 of file nodebrsh.cpp. 00505 { 00506 NodeBrush* pCopyOfNode = new NodeBrush(); 00507 if (pCopyOfNode != NULL) 00508 CopyNodeContents(pCopyOfNode); 00509 return (pCopyOfNode); 00510 }
|
|
transforms the brush
Reimplemented from NodeGroup. Definition at line 432 of file nodebrsh.cpp. 00433 { 00434 // The groups bounding rect is no longer valid 00435 InvalidateBoundingRect(); 00436 00437 // Transform all the children 00438 // See GroupCanTransformCached() 00439 NodeGroup::Transform(Trans); 00440 00441 }
|
|
Writes the brush record to the filter. > virtual BOOL NodeBrush::WritePreChildrenNative(BaseCamelotFilter* pFilter)
Reimplemented from NodeGroup. Definition at line 479 of file nodebrsh.cpp. 00480 { 00481 return TRUE; 00482 }
|
|
Writes the brush record to the filter. > virtual BOOL NodeBrush::WritePreChildrenWeb(BaseCamelotFilter* pFilter)
Reimplemented from NodeGroup. Definition at line 459 of file nodebrsh.cpp. 00460 { 00461 return TRUE; 00462 }
|
|
Definition at line 197 of file nodebrsh.h. |
|
Definition at line 199 of file nodebrsh.h. |
|
Definition at line 198 of file nodebrsh.h. |