#include <ink.h>
Inheritance diagram for NodeRenderableInk:
Public Types | |
enum | SelStateAction { CLEAR, SET, TOGGLE } |
Public Member Functions | |
NodeRenderableInk () | |
This constructor creates a NodeRenderableInk linked to no other, with all status flags false, and an uninitialised bounding rectangle. | |
NodeRenderableInk (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. | |
virtual BOOL | IsAnObject () const |
For determining quickly if the node is an object. | |
virtual BOOL | IsSetCandidate () const |
Indicates that NodeRenderableInks are candidates for membership of Attribute gallery set. | |
virtual BOOL | IsRenderedAsInk () const |
virtual BOOL | CanTransform () |
Determine whether a renderable node can be transformed - if it does not, then no undo information needs to be stored for it. | |
virtual BOOL | ExportRender (RenderRegion *pRender) |
Custom export code for nodes derived from NodeRenderableInk. So far there is only code for the VectorFileRenderRegion (which is a superclass for the EPS, CMX, and Flash render regions) to allow for the export of stroked shapes. | |
virtual void | RenderAppliedFillBlobs (RenderRegion *pRender) |
Draws the Fill blobs of an ink object. It does this by calling all the attributes that are its immediate children and asking them to render their Fill Blobs. If any of them happen to be items such as Graduated fills, then blobs will appear. | |
virtual void | RenderArtisticBlobs (RenderRegion *pRender) |
Draws the Artistic blobs of an ink object. It does this by calling all the attributes that are its immediate children and asking them to render their Artistic Blobs. If any of them happen to be items such as Pressure attributes or some other artistic effect then blobs will appear. | |
virtual void | RenderEorDrag (RenderRegion *) |
Each class derived from NodeRenderableInk should write a version of this member function. In most cases it will be the same as the Render() member function but some of the nodes (such as groups) need to perform special actions. The function is for drawing the object while it is being dragged about by the selector tool. It should do this with an effective wysiwyg level of 0 so that the drawing is fast. | |
virtual void | RenderEffectBlobs (RenderRegion *pRender) |
Draws the Effect blobs of an ink object. It does this by calling all the attributes that are its immediate children and asking them to render their Fill Blobs. If any of them happen to be items such as Graduated fills, then blobs will appear. | |
virtual void | RenderEorDragChildren (RenderRegion *pRender) |
Recursively calls RenderEorDrag for all children of this node, ignoring nodes which have ChildrenAreEorDragRenderedByMe() returning TRUE. | |
virtual BOOL | ChildrenAreEorDragRenderedByMe () |
virtual void | ClearSubSelection (BOOL ReDraw) |
Goes through the object and clears the selection state of all its blobs. eg a selected path has blobs and each of these blobs can be selected. This clears the blobs selection BUT not the objects selection! | |
virtual BOOL | CanSelectAsCompoundParent () |
Ask a node whether or not it's prepared to become selected when one of it's children is clicked on. This function is called in the FindSimple/Compound routines when they are following parent links up the tree from a node which has been "hit". This virtual function should be overridden in derived classes to alter its behaviour. | |
virtual BOOL | CanSelectAsSimple () |
Ask a node whether or not it's prepared to become selected when one of it's clicked on. This function is called in the FindSimple routines when they have just detected a "hit" on a node. This virtual function should be overridden in derived classes to alter its behaviour. | |
virtual BOOL | OnClick (DocCoord, ClickType, ClickModifiers, Spread *) |
Allows the Node to respond to clicks by selecting its blobs or starting drags etc. | |
virtual BOOL | OnMouseMove (const DocCoord &, Spread *, ClickModifiers) |
Called by the selector tool for the selected object(s) when the mouse is moved. | |
virtual BOOL | GetStatusInfo (String_256 **ppStatusText, Cursor **ppStatusCursor) |
Called by the selector tool if either a previous OnMouseMove or OnClick member function call returns TRUE, indicating that the node has some feedback to display when the mous is at the previously passed point. | |
virtual BOOL | OnBlobPopUp (Spread *, DocCoord, ContextMenu *) |
Allows the Node to respond to popup menu clicks by adding items to the popup menu if required. It also allows the node to prevent the menu appearing at all! This functions should be overridden in the all the NodeRenderableInk classes so that this verion never gets called. Eg the NodePath class might claim the click if it happened over one of its blobs. | |
virtual BOOL | OnNodePopUp (Spread *, DocCoord, ContextMenu *) |
Allows the Node to respond to popup menu clicks by adding items to the popup menu if required. It also allows the node to prevent the menu appearing at all! This functions should be overridden in the all the NodeRenderableInk classes so that this verion never gets called. Eg the NodePath class might claim the click if it happened over one of its blobs. | |
virtual void | SelectInRect (const DocRect &Rect, SelStateAction st) |
Helper method for the static fn SelectAllInRect() used by marquee select. This method changes the selection state of this node according to the given bounding rectangle and sel-state action. Most nodes will want to use the default behaviour, which is to select themselves if their bounds lie within the given bounding rectangle. If you want to do something special with the marquee select, then override this method. | |
void | RedrawObject () |
Invalidates the Bounding rectangle of the node, causing it to be redrawn. | |
void | ApplyAttributeToObject (NodeAttribute *Attribute, BOOL Redraw) |
Applys Attribute to the selected node and then if Redraw is TRUE it redraws the node. | |
BOOL | ApplyAttributes (CCAttrMap *pAttribMap, BOOL RequiredAttrsOnly=FALSE) |
This generates copies of all the attributes in the map, and applies them to this node. | |
virtual BOOL | RequiresAttrib (CCRuntimeClass *AttribClass, BOOL Search=FALSE) |
To determine if the node requires attribute AttribType to render itself. | |
virtual BOOL | RequiresAttrib (NodeAttribute *pAttrib, BOOL Search=FALSE) |
To determine if the node requires the pAttr to render itself. | |
virtual BOOL | CanAttrBeAppliedToMe (CCRuntimeClass *AttrType) |
This fn is not to be confused with RequiresAttrib, it determines if an attribute of type AttrType can be directly applied to this object. The object is assumed to Require the attribute. | |
virtual NodeRenderableInk * | GetObjectToApplyTo (CCRuntimeClass *AttrType) |
Before applying an attribute to an object this function should be called to return the actual object the attribute should be applied to. | |
virtual CCRuntimeClass * | GetCurrentAttribGroup () |
Every Ink object has an associated current attribute group, If an attribute is applied to the object, and it needs to become current then the attribute group specified will get updated. | |
NodeAttribute * | GetChildAttrOfType (CCRuntimeClass *ReqdAttrib) |
Scans the child attribute block of the node for an attribute with type ReqdAttrib. | |
BOOL | HasAttrTypesOn (NodeRenderableInk *Object) |
This function returns TRUE if the set of Object's child attribute types are a subset of this objects child attribute types. | |
BOOL | CopyChildrenAsShapes (Node *pDestin) |
This function scans through all children of this object and asks them to convert themselves to shapes. The shapes are placed as children of the destination node. If the routine fails, all children of the destination will automatically be removed. | |
virtual BOOL | ReadPostChildrenWeb (BaseCamelotFilter *pFilter) |
This function is called during the importing of the file. | |
virtual BOOL | ReadPostChildrenNative (BaseCamelotFilter *pFilter) |
virtual BOOL | WriteBeginChildRecordsWeb (BaseCamelotFilter *pFilter) |
Begin to write out you child records, in the web format. | |
virtual BOOL | WriteBeginChildRecordsNative (BaseCamelotFilter *pFilter) |
Begin to write out you child records, in the native format. | |
virtual BOOL | WriteEndChildRecordsWeb (BaseCamelotFilter *pFilter) |
Finished writing out you child records, in the web format. | |
virtual BOOL | WriteEndChildRecordsNative (BaseCamelotFilter *pFilter) |
Finished writing out you child records, in the native format. | |
virtual BOOL | WriteBoundsRecord (BaseCamelotFilter *pFilter) |
Write out a record containing the bounds of this object. | |
virtual BOOL | WillWriteBounds (BaseCamelotFilter *pFilter) |
Determines if the down/up pair need to be written. | |
virtual BOOL | AreYouSafeToRender () |
This function is used by the progressive rendering system & the new file format to determine whether the node is renderable or not. | |
AttrBrushType * | GetAppliedBrushAttribute () |
as above | |
AttrStrokeType * | GetActiveStroke () |
We may have a stroke attribute applied to us that does not do anything under certain circumstances (zero line width, no accompanying variable width attribute). | |
virtual NodePath * | GetVariableWidthStrokePath () |
If we have a variable width stroke applied to us then this will get the path generated by that stroke. This base class version returns NULL, overridden versions must supply their own outline path. | |
virtual NodePath * | GetSmoothVariableWidthStrokePath () |
virtual BOOL | GetAreaDetails (XLONG *pxlArea, XLONG *pXLPerimeter) |
virtual BOOL | CanSupplyDirectBitmap () |
virtual BOOL | GetDirectBitmap (RenderRegion *pRender, LPBITMAPINFO *plpInfo, LPBYTE *plpBits, DocRect *pRect, Matrix *pMat, double *pdRes) |
virtual BOOL | RenderDirectBitmapState (RenderRegion *pRender) |
BOOL | FindAppliedAttributes (CCAttrMap *pAttribMap, INT32 nMax=5000, INT32 *nFound=NULL, BOOL ExcludeIndirectlyAppliedGLAs=FALSE, BOOL bStrictEffectStatus=TRUE) const |
Searches for all the attributes which apply to "this" ink-node. This routine does NOT render them! Use RenderAppliedAttributes if you want that functionality. | |
BOOL | FindAppliedAttribute (CCRuntimeClass *AttribType, NodeAttribute **pAttrFound, BOOL bStrict=TRUE) |
Finds the attribute of type 'AttribType' applied to this node. | |
NodeAttribute * | FindAppliedAttribute (CCRuntimeClass *AttribType, BOOL bExcludeChildAttrs=FALSE, BOOL bStrict=TRUE) |
virtual BOOL | IsValidEffectAttr (NodeAttribute *pAttr) const |
void | DeleteAppliedAttributes () |
This function deletes all child attributes from the node which have the same type and value as the attributes applied above the child level. It is useful for Attribute optimisation work. | |
BOOL | AddChildAttrTypesToSet (AttrTypeSet *pAttrTypeSet) |
A function to return a set of the attribute types of all attribute children of. | |
virtual NodeRenderableInk * | FindNodeAtPointHelper (const Spread *pSpread, const DocCoord dcPoint) |
BOOL | MakeAttributeComplete (Node *Root=NULL, BOOL CheckForDuplicates=TRUE, AttrTypeSet *pAffectedAttrTypes=NULL, BOOL IncludeDefaults=FALSE, BOOL bIncludeEffectAttrs=FALSE) |
This function should be called on a subtree prior to it being moved, either to a new position in the document, or to another document. It is also used to localise attributes; during an ungroup for example. | |
void | NormaliseAttributes () |
This function should be called whenever an attribute-complete node is inserted into the tree (whether it's a new node, or a node which has been moved from elsewhere). | |
BOOL | FactorOutCommonChildAttributes (BOOL Global=FALSE, AttrTypeSet *pAffectedAttrTypes=NULL) |
Scope: public. | |
BOOL | LocaliseCommonAttributes (BOOL CheckForDuplicates=FALSE, BOOL Global=FALSE, AttrTypeSet *pAffectedAttrTypes=NULL, BOOL RecursiveDownwards=FALSE) |
This function is the opposite of the FactorOutCommonChildAttributes function it copies all attributes common to the compound to each child object within the compound which requires each attribute. The groups common attributes are deleted. | |
virtual BOOL | BeginBlendStep (BlendNodeParam *pParam) |
virtual BOOL | EndBlendStep (BlendNodeParam *pParam) |
virtual BOOL | SetParentLayerAsEdited () |
Mark parent layer as edited. If an ink object as something done to it which changes its appearance then we need to mark the parent layer as edited. In this class we actually do the work as these are visible objects in the tree. | |
virtual BOOL | IsSeeThrough (BOOL CheckIndirectAttrs) |
Determines whether this node is see through or not. See through in this case does not necessarily mean transparent - eg we could be a no-colour-fill rectangle. This test is useful if you're going to render into a bitmap, which will then be post-processed and plonked on the document (eg Feathering). This way, you can hopefully avoid any performance hit from unnecessary rendering into an alpha-channel bitmap. | |
Static Public Member Functions | |
static BOOL | Init () |
Reads preferences for NodeRenderableInk. | |
static void | DeselectAll (BOOL RenderBlobs=TRUE, BOOL InformImmediate=TRUE) |
Deselects all the selected objects in the tree, leaving camelot with nothing selected. It also removes the EORed blobs of the objects that were selected at the time of the call. | |
static void | DeselectAllOnLayer (Layer *Layer) |
Same as DeselectAll except that it only deselects objects on Layer. | |
static void | SelectAllInRect (DocRect, Spread *, SelStateAction st=SET) |
Selects all the objects that are wholly inside the supplied rectangle. It will draw in all the EORed blobs of the objects that it selects/deselects. rewritten by Simon so that objects on locked layers do not get selected also more optimal. (st parameter etc added by JCF 1.11.94). | |
static NodeRenderableInk * | FindSimpleAtPoint (Spread *pSpread, DocCoord dcPoint, Node *pHighNode=NULL, Node **ppInterruptNode=NULL) |
Searches the ink-able objects within the given spread for one that lies at or near the given point. The method used to render each candidate object into a small monochrome bitmap, in the reverse order to normal (so that the object normally rendered last is the first to be rendered into the bitmap). The bitmap is examined to see if the object affected the centre or surrounding pixels. | |
static NodeRenderableInk * | FindSimpleAtPointForColourPicker (Spread *pSpread, DocCoord dcPoint, Pixel32bpp &Pix, Node *pHighNode=NULL, Node **ppInterruptNode=NULL) |
Firstly, this function serves to find the 'ID' of the item that our colour picker is over - which is used to update our mouse cursor. Secondly, it obtains the TRUE 32-BIT RGB index for the pixel that our mouse cursor is over - enabling us to do colour manager/dialog type things. The first part of this routine simply calls FindSimpleAtPointFor - and the second part actually does colour specific work. | |
static NodeRenderableInk * | FindColourForNodeRenderableAtPoint (Spread *pSpread, DocCoord dcPoint, Pixel32bpp &Pix, Node *pThisNode, AttrFillGeometry *pThisFill) |
The function obtains the TRUE 32-BIT RGB index for the pixel that our mouse cursor is over for the supplied node. | |
static NodeRenderableInk * | FindCompoundAtPoint (Spread *pSpread, DocCoord dcPoint, Node *pHighNode=NULL) |
This function is similar to NodeRenderableInk::FindSimpleAtPoint, except that. | |
static NodeRenderableInk * | FindCompoundFromSimple (NodeRenderableInk *pSimpleNode, Node *pSiblingNode=NULL) |
This function will search up the parent links from the given "simple" node looking for a node whose parent is a layer. This guarantees that the returned node will be a genuinely selectable object, for example the routine will return the group node if the given point is within a grouped object. | |
static NodeRenderableInk * | FindInnerCompound (Node *pLowNode, Node *pHighNode) |
static void | ClearAttribMap () |
Clears out all entries in the attribute map that is being accumulated as click-detection occurs. This has to be done when going down a child-link because then you are entering a deeper scope where the attributes in the map may not apply. It is called from Node::FindNextHitTest. | |
Protected Member Functions | |
BOOL | CalculatePathBoundingRect (Path &BoundPath, BOOL DontUseAttrs, DocRect *pRect) |
Calculates the bounding rectangle of a path using GDraw. It will optionally go and find all the attributes that are applied to the path and tell GDraw about these as well (this is the normal way of using it) It can make up sone default attributes if needed as well. This will assume that the path is to be stroked as thin as possible. | |
virtual Node * | SimpleCopy (void) |
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. | |
Private Member Functions | |
void | RenderAppliedAttributes (RenderRegion *pRegion) const |
Searches for all the attributes which apply to "this" ink-node, rendering them into the given render-region. Private helper function for NodeRenderableInk::FindSimpleAtPoint. | |
void | RenderAppliedClipAttributes (RenderRegion *pRender) const |
Helper method for RenderAppliedAttributes(). | |
BOOL | FactorOutCommonChildAttrHelper (BOOL Global, AttrTypeSet *pAffectedAttrTypes) |
This is a helper function for FactorOutCommonChildAttributes. It finds all attributes which are common to all children of this compound object and adds the common attributes to this node. If Global is TRUE then it recursivly tries to factor out the attributes on all parent compounds. This function does not delete the attributes which are factored out, This is left to the calling function. | |
BOOL | LocaliseCommonAttrHelper (BOOL CheckForDuplicates, BOOL Global, AttrTypeSet *pAffectedAttrTypes, BOOL RecursiveDownwards=FALSE) |
This function copies all attributes common to the compound to each child object within the compound which requires each attribute. | |
void | DeleteLocalisedAttributes (BOOL Global=FALSE, AttrTypeSet *pAffectedAttrTypes=NULL) |
void | DeleteFactoredOutAttribs (BOOL Global=FALSE, AttrTypeSet *pAffectedAttrTypes=NULL) |
Deletes all child attributes of objects within the compound, which are defined in the groups child attribute block. The attributes of objects which discard their child attributes (like the caret) are only deleted if they have the same value Scope: private. | |
BOOL | FindReqdAttribs (List *ReqdAttribList) |
void | RemoveSuperfluousAttribs () |
BOOL | FindCommonAttributesToFactorOut (CommonAttrSet *CommonAttributeSet) |
This fn does not exist.Finds all attributes common to the compound node. | |
Static Private Member Functions | |
static Node * | FindFirstHitTest (Spread *pStartSpread, const DocRect &drClickRect, CCAttrMap *pAttribMap, BOOL bExcludeLayers, Node *pHighNode=NULL) |
Walks the node tree in the reverse order to rendering, which is the order that nodes should be considered for hit-testing. | |
static Node * | FindNextHitTest (Node *pNode, const DocRect &drClickRect, CCAttrMap *pAttribMap, BOOL bExcludeLayers, BOOL bSkipChildren=FALSE) |
Walks the node tree in the reverse order to rendering, which is the order that nodes should be considered for hit-testing. | |
static BOOL | HitTestChildren (Node *pNode, const DocRect &drClickRect, BOOL bExcludeLayers) |
Private helper function for Node::FindNextHitTest. This function decides whether FindNextHitTest should go down a child link, which it should if (i) there is a child link; AND (ii) this node isn't a locked or invisible layer if such things should be excluded; (iii) if this node has a bounding rectangle it intersects the click rectangle. | |
Private Attributes | |
BOOL | SafeToRender |
Static Private Attributes | |
static BOOL | bUseSmartClicks = TRUE |
If TRUE then click detection is done with rendering, else if FALSE it is done with rectangle intersection. Will be made obsolete once rendering methods are reliable. Defaults to TRUE. | |
static BOOL | AverageHitColour = FALSE |
If TRUE then click detection is done with rendering, else if FALSE it is done with rectangle intersection. Will be made obsolete once rendering methods are reliable. Defaults to TRUE. | |
static CCAttrMap * | pAttribMap |
static INT32 | nFoundAttributes |
static INT32 | nMaxAttributes |
Definition at line 139 of file ink.h.
|
Definition at line 195 of file ink.h.
|
|
This constructor creates a NodeRenderableInk linked to no other, with all status flags false, and an uninitialised bounding rectangle.
Definition at line 2228 of file noderend.cpp. 02228 : NodeRenderableBounded() 02229 { 02230 SafeToRender = FALSE; // Not safe to progressively render during importing yet (see ReadPostChildren...) 02231 MayBeCached = FALSE; // Definitely not cached 02232 }
|
|
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 2277 of file noderend.cpp. 02283 : 02284 NodeRenderableBounded(ContextNode, Direction, Locked, Mangled, Marked,Selected) 02285 { 02286 SafeToRender = FALSE; // Not safe to progressively render during importing yet (see ReadPostChildren...) 02287 MayBeCached = FALSE; // Definitely not cached 02288 }
|
|
A function to return a set of the attribute types of all attribute children of.
Definition at line 4430 of file noderend.cpp. 04431 { 04432 Node* pChild; 04433 // Create a set of the caret's attribute types 04434 for (pChild = FindFirstChild(); 04435 pChild; 04436 pChild = pChild->FindNext()) 04437 { 04438 if (pChild->IsAnAttribute()) 04439 { 04440 // Add the attribute's type to the CaretsAttrTypes set 04441 if (!(pAttrTypeSet->AddToSet(((NodeAttribute*)pChild)->GetAttributeType()))) 04442 return FALSE; // out of mem 04443 } 04444 } 04445 return TRUE; 04446 }
|
|
This generates copies of all the attributes in the map, and applies them to this node.
Definition at line 3927 of file noderend.cpp. 03928 { 03929 if (pAttribMap == NULL) return FALSE; 03930 03931 BOOL ApplyAttr = TRUE; 03932 03933 // iterating all (key, value) pairs 03934 for (CMapPtrToPtr::iterator Pos = pAttribMap->GetStartPosition(); Pos!=pAttribMap->GetEndPosition();) 03935 { 03936 CCRuntimeClass* pType; 03937 void* pVal; 03938 03939 pAttribMap->GetNextAssoc(Pos,pType,pVal); 03940 03941 NodeAttribute* pNodeAttr = (NodeAttribute *)pVal; 03942 03943 if (pNodeAttr->CanBeAppliedToObject()) 03944 { 03945 if (RequiredAttrsOnly) 03946 ApplyAttr = RequiresAttrib(pNodeAttr); 03947 03948 if (ApplyAttr) 03949 { 03950 Node* pNode = pNodeAttr->SimpleCopy(); 03951 if (pNode != NULL) 03952 { 03953 pNode->AttachNode(this,FIRSTCHILD); 03954 // Ilan 03955 // Supply nodes geometry to attributes which require it 03956 ((NodeAttribute*)pNode)->LinkToGeometry(this); 03957 } 03958 } 03959 } 03960 } 03961 03962 // This will remove all the redundant attributes that have been attached to the node 03963 NormaliseAttributes(); 03964 03965 return TRUE; 03966 }
|
|
Applys Attribute to the selected node and then if Redraw is TRUE it redraws the node.
Definition at line 3901 of file noderend.cpp. 03902 { 03903 Attribute->AttachNode(this, FIRSTCHILD); 03904 if (Redraw) 03905 RedrawObject(); // Redraw the node 03906 }
|
|
This function is used by the progressive rendering system & the new file format to determine whether the node is renderable or not.
Reimplemented from Node. Reimplemented in NodeGroup. Definition at line 4570 of file noderend.cpp. 04571 { 04572 return SafeToRender; 04573 }
|
|
Definition at line 392 of file ink.h. 00392 { return TRUE; }
|
|
Calculates the bounding rectangle of a path using GDraw. It will optionally go and find all the attributes that are applied to the path and tell GDraw about these as well (this is the normal way of using it) It can make up sone default attributes if needed as well. This will assume that the path is to be stroked as thin as possible.
Definition at line 3431 of file noderend.cpp. 03433 { 03434 // Check and initialise output. 03435 ERROR3IF(pRect == 0, "NodeRenderableInk::CalculatePathBoundingRect: null output"); 03436 pRect->MakeEmpty(); 03437 03438 // Something to put the new bounding rect into 03439 DocRect NewBoundingRect; 03440 BOOL GDrawResult = TRUE; 03441 GDrawContext *GD = GRenderRegion::GetStaticDrawContext(); 03442 03443 if (GD == NULL) 03444 return(FALSE); 03445 03446 // do we need to use the attrs 03447 if (DontUseAttrs) 03448 { 03449 // here we are not interested in the attributes 03450 // Find out what the paths bounding rect is now 03451 RECT rectTmp; 03452 GDrawResult = GD->CalcStrokeBBox((POINT*)BoundPath.GetCoordArray(), 03453 BoundPath.GetVerbArray(), BoundPath.GetNumCoords(), 03454 &rectTmp, 03455 BoundPath.IsFilled, 0, CAPS_ROUND, JOIN_ROUND, NULL); 03456 if ( rectTmp.left>rectTmp.right || rectTmp.top>rectTmp.bottom ) 03457 return false; 03458 NewBoundingRect = DocRect( rectTmp.left, rectTmp.top, rectTmp.right, rectTmp.bottom ); 03459 } 03460 else 03461 { 03462 // First find all attributes applied to this node... 03463 // 30 is a default value - this will grow if it needs more space 03464 CCAttrMap AttribMap(30); 03465 if (FindAppliedAttributes(&AttribMap)) 03466 { 03467 void* pLineColour = NULL; 03468 AttribMap.Lookup( CC_RUNTIME_CLASS(AttrStrokeColour),pLineColour); 03469 03470 if (pLineColour && (*((AttrStrokeColour*)pLineColour)->GetStartColour() == COLOUR_NONE) || 03471 !BoundPath.IsStroked) 03472 { 03473 // This path is not stroked, so we won't bother with any of the attributes 03474 // applied to it 03475 RECT rectTmp; 03476 GDrawResult = GD->CalcStrokeBBox((POINT*)BoundPath.GetCoordArray(), 03477 BoundPath.GetVerbArray(), BoundPath.GetNumCoords(), 03478 &rectTmp, 03479 BoundPath.IsFilled, 0, CAPS_ROUND, JOIN_ROUND, NULL); 03480 if ( rectTmp.left>rectTmp.right || rectTmp.top>rectTmp.bottom ) 03481 return false; 03482 NewBoundingRect = DocRect( rectTmp.left, rectTmp.top, rectTmp.right, rectTmp.bottom ); 03483 03484 } 03485 else 03486 { 03487 // Extract the info we need from the applied attributes 03488 void* pLineWidth = NULL; 03489 AttribMap.Lookup( CC_RUNTIME_CLASS(AttrLineWidth),pLineWidth); 03490 ENSURE(pLineWidth,"NodePath::GetBoundingRect can't find LineWidth"); 03491 03492 // if we did not get a line width, fail 03493 if (!pLineWidth) 03494 return FALSE; 03495 03496 // The Start cap 03497 void* pStartCap = NULL; 03498 AttribMap.Lookup( CC_RUNTIME_CLASS(AttrStartCap),pStartCap); 03499 #ifdef _DEBUG 03500 if (pStartCap == 0) 03501 TRACE( _T("NodeRenderableInk::CalculatePathBoundingRect: can't find StartCap\n")); 03502 #endif 03503 03504 // The join style 03505 void* pJoinType = NULL; 03506 AttribMap.Lookup( CC_RUNTIME_CLASS(AttrJoinType),pJoinType); 03507 #ifdef _DEBUG 03508 if (pJoinType == 0) 03509 TRACE( _T("NodeRenderableInk::CalculatePathBoundingRect: can't find JoinType\n")); 03510 #endif 03511 if(pStartCap != NULL && pJoinType != NULL && pLineWidth != NULL) 03512 { 03513 // Now pass those values to Gavin along with the path for a bounds calculation 03514 RECT rectTmp; 03515 GDrawResult = GD->CalcStrokeBBox((POINT*)BoundPath.GetCoordArray(), 03516 BoundPath.GetVerbArray(), BoundPath.GetNumCoords(), 03517 &rectTmp, 03518 BoundPath.IsFilled, 03519 ((AttrLineWidth*)pLineWidth)->Value.LineWidth, 03520 (CapStyles)((AttrStartCap*)pStartCap)->Value.StartCap, 03521 (JoinStyles)((AttrJoinType*)pJoinType)->Value.JoinType, 03522 NULL //Pointer to dash pattern attribute 03523 ); 03524 if ( rectTmp.left>rectTmp.right || rectTmp.top>rectTmp.bottom ) 03525 return false; 03526 NewBoundingRect = DocRect( rectTmp.left, rectTmp.top, rectTmp.right, rectTmp.bottom ); 03527 } 03528 } 03529 } 03530 } 03531 03532 // Make sure Gavin did not screw up. 03533 if (!NewBoundingRect.IsValid()) 03534 // Set it to TRUE, as this means it went wrong in Gavin Talk. 03535 GDrawResult = TRUE; 03536 03537 // see if GDraw worked (It returns FALSE when it works!) 03538 if (GDrawResult == FALSE) 03539 { 03540 // update the rectangle 03541 *pRect = NewBoundingRect; 03542 return TRUE; 03543 } 03544 03545 // to get here, something must have failed 03546 return FALSE; 03547 }
|
|
This fn is not to be confused with RequiresAttrib, it determines if an attribute of type AttrType can be directly applied to this object. The object is assumed to Require the attribute.
Certain attributes cannot be directly applied to specific nodes (even though they require the attribute to render). eg. LineSpacing attributes cannot be applied to text character objects. This function is called by the GetObjectToApplyTo virtual function.
Reimplemented in NodeBevel, NodeClipView, and VisibleTextNode. Definition at line 4064 of file noderend.cpp. 04065 { 04066 return TRUE; 04067 }
|
|
Ask a node whether or not it's prepared to become selected when one of it's children is clicked on. This function is called in the FindSimple/Compound routines when they are following parent links up the tree from a node which has been "hit". This virtual function should be overridden in derived classes to alter its behaviour.
Reimplemented in NodeLiveEffect, and NodeLockedEffect. Definition at line 978 of file hittest.cpp. 00979 { 00980 // Virtual base-class function returns TRUE always. 00981 // Override this function in your class. 00982 return TRUE; 00983 }
|
|
Ask a node whether or not it's prepared to become selected when one of it's clicked on. This function is called in the FindSimple routines when they have just detected a "hit" on a node. This virtual function should be overridden in derived classes to alter its behaviour.
Reimplemented in NodeBlender. Definition at line 1007 of file hittest.cpp. 01008 { 01009 // Virtual base-class function returns TRUE always. 01010 // Override this function in your class. 01011 return TRUE; 01012 }
|
|
Reimplemented in NodeBitmap, NodeBitmapEffect, NodeLockedEffect, and NodeFeatherEffect. Definition at line 260 of file ink.h. 00260 {return FALSE;}
|
|
Determine whether a renderable node can be transformed - if it does not, then no undo information needs to be stored for it.
Reimplemented from NodeRenderable. Definition at line 2343 of file noderend.cpp. 02344 { 02345 return TRUE; 02346 }
|
|
Reimplemented in NodeContourController, NodeClipViewController, and NodeMouldGroup. Definition at line 179 of file ink.h. 00179 { return FALSE; }
|
|
Clears out all entries in the attribute map that is being accumulated as click-detection occurs. This has to be done when going down a child-link because then you are entering a deeper scope where the attributes in the map may not apply. It is called from Node::FindNextHitTest.
Definition at line 1293 of file hittest.cpp. 01294 { 01295 pAttribMap->RemoveAll(); 01296 nFoundAttributes = 0; 01297 }
|
|
Goes through the object and clears the selection state of all its blobs. eg a selected path has blobs and each of these blobs can be selected. This clears the blobs selection BUT not the objects selection!
Definition at line 3117 of file noderend.cpp.
|
|
This function scans through all children of this object and asks them to convert themselves to shapes. The shapes are placed as children of the destination node. If the routine fails, all children of the destination will automatically be removed.
Definition at line 4465 of file noderend.cpp. 04466 { 04467 ERROR2IF(pDestin==NULL,FALSE,"pDestin==NULL in CopyChildrenAsShapes"); 04468 04469 // ok lets get the subtree to become a bunch of nodepaths 04470 CopyBecomeA ParamBecomeA(BECOMEA_PASSBACK, 04471 CC_RUNTIME_CLASS(NodePath), 04472 NULL); 04473 04474 // Set the context node 04475 ParamBecomeA.SetContextNode(pDestin); 04476 04477 // now scan the children and get them to do their stuff 04478 Node* pNode = FindFirstChild(); 04479 while (pNode!=NULL) 04480 { 04481 if (pNode->CanBecomeA(&ParamBecomeA)) 04482 { 04483 if (!pNode->DoBecomeA(&ParamBecomeA)) 04484 { 04485 pDestin->CascadeDelete(); 04486 return FALSE; 04487 } 04488 } 04489 04490 pNode=pNode->FindNext(); 04491 } 04492 04493 return TRUE; 04494 }
|
|
This function deletes all child attributes from the node which have the same type and value as the attributes applied above the child level. It is useful for Attribute optimisation work.
Definition at line 4365 of file noderend.cpp. 04366 { 04367 Node* pChild = FindFirstChild(); 04368 Node* pFirstChild = pChild; 04369 04370 // Temporarily unlink the children so that we can easily find applied attributes which 04371 // exclude the child attribs 04372 Child = NULL; 04373 04374 NodeAttribute* pAppliedAttr; 04375 NodeAttribute* pChildAttr; 04376 while (pChild != NULL) 04377 { 04378 if (pChild->IsAnAttribute()) 04379 { 04380 pChildAttr = (NodeAttribute*)pChild; 04381 if (FindAppliedAttribute((pChildAttr->GetAttributeType()), &pAppliedAttr)) 04382 { 04383 if (pAppliedAttr) 04384 { 04385 // Test to see if the attributes have the same value 04386 if ((IS_SAME_CLASS(pAppliedAttr, pChildAttr ))) 04387 { 04388 if ((*pAppliedAttr)==(*pChildAttr)) 04389 { 04390 pChildAttr->CascadeDelete(); // Delete the attribute 04391 delete pChildAttr; 04392 } 04393 } 04394 } 04395 04396 } 04397 } 04398 pChild = pChild->FindNext(); 04399 } 04400 // Restore the children 04401 pChild = pFirstChild; 04402 }
|
|
Deletes all child attributes of objects within the compound, which are defined in the groups child attribute block. The attributes of objects which discard their child attributes (like the caret) are only deleted if they have the same value Scope: private.
Definition at line 1053 of file ndoptmz.cpp. 01054 { 01055 Node* pGroupNode = FindFirstChild(); 01056 while(pGroupNode!=NULL) 01057 { 01058 // Karim 30/08/2000 01059 // Non-optimisable attributes, like feathers and names, 01060 // must not be automatically deleted - only automatically delete optimisable ones. 01061 if (pGroupNode->IsAnAttribute() && ((NodeAttribute*)pGroupNode)->ShouldBeOptimized()) 01062 { 01063 NodeAttribute* pGroupAttr = (NodeAttribute*)pGroupNode; 01064 CCRuntimeClass* GrouptAttrType = pGroupAttr->GetAttributeType(); 01065 if (pAffectedAttrTypes==NULL || pAffectedAttrTypes->InSet(GrouptAttrType)) 01066 { 01067 // delete this group attr type from all child objects of this group 01068 // BUT if obj discards child attrs only delete attr if it also has same value 01069 for (Node* pNode=FindFirstChild(); pNode!=NULL; pNode=pNode->FindNext()) 01070 { 01071 if (pNode->IsAnObject()) 01072 { 01073 NodeRenderableInk* pObject = (NodeRenderableInk*)pNode; 01074 NodeAttribute* pDeadAttr = pObject->GetChildAttrOfType(GrouptAttrType); 01075 if (pDeadAttr!=NULL) 01076 { 01077 // This code used to only test the attribute for equality if pObject 01078 // returned TRUE from DiscardsAttributeChildren, otherwise it would 01079 // just assume that they are identical and delete it. 01080 // The DiscardAttributeChildren checks are now done elsewhere so 01081 // this code now just assumes it can delete any attributes that have 01082 // got this far. 01083 // This optimisation relies on the tree being in a "legal" state 01084 // at the start (i.e. correctly optimised) and also helps to correct 01085 // problems where attributes may have been incorrectly left on children 01086 // (though such "corrections" may change the appearance of the document). 01087 01088 pDeadAttr->CascadeDelete(); 01089 delete pDeadAttr; 01090 } 01091 } 01092 } 01093 } 01094 } 01095 pGroupNode = pGroupNode->FindNext(); 01096 } 01097 01098 // Do we need to delete any parent compound's attributes 01099 if (Global) 01100 { 01101 Node* pParent = FindParent(); 01102 if (pParent && (pParent->IsCompound())) 01103 { 01104 // We need to delete the parent's attributes first (Recursive bit) 01105 ((NodeRenderableInk*)pParent)->DeleteFactoredOutAttribs(Global, pAffectedAttrTypes); 01106 } 01107 } 01108 }
|
|
Scope: private
Definition at line 978 of file ndoptmz.cpp. 00980 { 00981 // Do we need to delete any parent compound's attributes 00982 if (Global) 00983 { 00984 Node* pParent = FindParent(); 00985 if (pParent && pParent->IsCompound()) 00986 { 00987 // We need to localise the parent's attributes first (Recursive bit) 00988 ((NodeRenderableInk*)pParent)->DeleteLocalisedAttributes(Global, pAffectedAttrTypes); 00989 } 00990 } 00991 00992 00993 // Delete all moved attributes 00994 Node* Next; 00995 Node* Current = FindFirstChild(); 00996 while (Current != NULL && !Current->IsAnObject()) 00997 { 00998 Next = Current->FindNext(); 00999 if (Current->IsAnAttribute()) 01000 { 01001 BOOL DeleteAttr = TRUE; 01002 if (pAffectedAttrTypes) 01003 { 01004 // Only delete the attribute if it has been localised 01005 if (!(pAffectedAttrTypes->InSet(((NodeAttribute*)Current)->GetAttributeType()))) 01006 DeleteAttr = FALSE; 01007 } 01008 if (DeleteAttr) 01009 { 01010 // Die 01011 // Ilan 19/04/00 01012 // More generally speaking, all attributes which returned FALSE in their ShouldBeOptimized() 01013 // calls, will not have been localised to the child nodes during DoLocaliseCommonAttributes(). 01014 // Hence don't want to delete these attributes, they must remain attached to the group node 01015 // which we are ungrouping so that they are present on an UNDO of a OpUngroup 01016 // Attributes in this category include Feather attibutes and TemplateAttributes at present 01017 // if (!Current->IsKindOf(CC_RUNTIME_CLASS(TemplateAttribute))) 01018 if( ((NodeAttribute*)Current)->ShouldBeOptimized()) 01019 { 01020 Current->CascadeDelete(); 01021 delete Current; 01022 } 01023 } 01024 } 01025 Current = Next; 01026 } 01027 }
|
|
Deselects all the selected objects in the tree, leaving camelot with nothing selected. It also removes the EORed blobs of the objects that were selected at the time of the call.
Definition at line 3570 of file noderend.cpp. 03571 { 03572 // Find the selected objects in the tree; 03573 SelRange* Selected = GetApplication()->FindSelection(); 03574 ENSURE( Selected!=NULL, "Selection object is null in DeselectAll()"); 03575 03576 // Find first selected node 03577 Node* pFirstSelectedNode = Selected->FindFirst(); 03578 03579 // If there is a selection, EOR blobs off, deselect nodes, and inform everybody 03580 if (pFirstSelectedNode != NULL) 03581 { 03582 // Go though and render all the EOR blobs off the screen 03583 if (RenderBlobs) 03584 { 03585 // Find the Blob Manager 03586 BlobManager* BlobMgr = GetApplication()->GetBlobManager(); 03587 ENSURE( BlobMgr!=NULL, "Blob Manager unexpectedly not there."); 03588 03589 // Render all the blobs 03590 BlobMgr->RenderOff(NULL, pFirstSelectedNode->FindParentSpread()); 03591 } 03592 03593 // and clear the object selection 03594 Node* pNode = pFirstSelectedNode; 03595 while(pNode) 03596 { 03597 // Deselect the object 03598 //ENSURE( pNode->IsKindOf(CC_RUNTIME_CLASS(NodeRenderable)), "Selected Node not renderable"); 03599 //((NodeRenderable*)pNode)->DeSelect(FALSE); 03600 if (pNode->IsNodePath()) 03601 ((NodePath*)pNode)->InkPath.ClearSubSelection(); 03602 03603 /* 03604 // DMc 03605 // Deselect all nodes under node 03606 Node * pSubNode = pNode->FindFirstDepthFirst(); 03607 03608 while (pSubNode) 03609 { 03610 pSubNode->SetSelected(FALSE); 03611 03612 if (pSubNode->IsNodePath()) 03613 { 03614 ((NodePath*)pSubNode)->InkPath.ClearSubSelection(); 03615 } 03616 03617 pSubNode = pSubNode->FindNextDepthFirst(pNode); 03618 } 03619 */ 03620 03621 // Deselect the node itself 03622 pNode->SetSelected(FALSE); 03623 03624 // Find the next node 03625 pNode = Selected->FindNext(pNode); 03626 } 03627 03628 // Selection cache is no longer valid, so update and tell everyone that it has changed 03629 Selected->Update(InformImmediate); 03630 } 03631 }
|
|
Same as DeselectAll except that it only deselects objects on Layer.
Definition at line 3645 of file noderend.cpp. 03646 { 03647 #if !defined(EXCLUDE_FROM_RALPH) 03648 ERROR3IF(Layer == NULL,"Layer == NULL"); 03649 if (Layer == NULL) return; 03650 03651 ERROR3IF(Layer->FindParent() == NULL,"Layer has no parent"); 03652 if (Layer->FindParent() == NULL) return; 03653 03654 ERROR3IF(!IS_A(Layer->FindParent(),Spread),"The parent of a layer was not a spread"); 03655 if (!IS_A(Layer->FindParent(),Spread)) return; 03656 03657 // if the layer has no children, return immediately (otherwise the range screws things up by 03658 // giving nodes from other layers to deselect) - MarkN 11/1/95 03659 if (Layer->FindFirstChild() == NULL) return; 03660 03661 // Find the layer's spread 03662 Spread *pSpread = (Spread*)Layer->FindParent(); 03663 03664 // Set up a range of the selected object in this layer 03665 // RangeControl rc = { TRUE, FALSE }; 03666 Range SelectedRange(Layer->FindFirstChild(),NULL,RangeControl(TRUE,FALSE)); 03667 Node* CurrentNode = SelectedRange.FindFirst(); 03668 03669 // See if there was anything selected in the first place 03670 if (CurrentNode != NULL) 03671 { 03672 // Go and find the Blob Manager 03673 BlobManager* BlobMgr = GetApplication()->GetBlobManager(); 03674 ENSURE( BlobMgr!=NULL, "There is no blob manager - Impossible!"); 03675 if (BlobMgr==NULL) return; 03676 03677 // Go through all the regions and rub out all the blobs 03678 RenderRegion* pRegion = DocView::RenderOnTop( NULL, pSpread, ClippedEOR ); 03679 while (pRegion) 03680 { 03681 // Find out the rect for this render region 03682 DocRect Rect = pRegion->GetRegionRect(); 03683 if ( (Rect.IsValid()) && (!Rect.IsEmpty()) ) 03684 { 03685 // Find the first node in the selection range 03686 CurrentNode = SelectedRange.FindFirst(); 03687 03688 // Find all the selected nodes in the tree 03689 while (CurrentNode != NULL) 03690 { 03691 // Rub the blobs off the screen for this node in this region 03692 ENSURE( CurrentNode->IsKindOf(CC_RUNTIME_CLASS(NodeRenderable)), "Node was not renderbale"); 03693 BlobMgr->RenderMyBlobs(&Rect, pSpread, (NodeRenderable*)CurrentNode); 03694 03695 // Find the next selected object on the layer 03696 CurrentNode = SelectedRange.FindNext(CurrentNode); 03697 } 03698 } 03699 03700 // Thats all the bits deselected for that render region, give me the next one please 03701 pRegion = DocView::GetNextOnTop( NULL ); 03702 } 03703 03704 // Now go though the selected nodes on the layer and deselect them 03705 CurrentNode = SelectedRange.FindFirst(); 03706 while (CurrentNode != NULL) 03707 { 03708 // Make it unselected 03709 //((NodeRenderable*)CurrentNode)->DeSelect( FALSE ); 03710 CurrentNode->SetSelected(FALSE); 03711 03712 // and find the next one 03713 CurrentNode = SelectedRange.FindNext(CurrentNode); 03714 } 03715 03716 // Selection cache is no longer valid 03717 GetApplication()->Selection->Update(TRUE); 03718 } 03719 #endif 03720 }
|
|
Reimplemented in NodeContourController. Definition at line 395 of file ink.h. 00395 { return TRUE; }
|
|
Custom export code for nodes derived from NodeRenderableInk. So far there is only code for the VectorFileRenderRegion (which is a superclass for the EPS, CMX, and Flash render regions) to allow for the export of stroked shapes.
Reimplemented from Node. Reimplemented in NodeGroup, NodeGuideline, NodeContourController, NodeBlendPath, NodeClipViewController, NodeMouldGroup, NodeMouldPath, NodeBevel, NodeBlender, NodeBlend, NodeBitmap, NodeMoulder, NodeMould, NodeRegularShape, TextChar, KernCode, HorizontalTab, CaretNode, EOLNode, and TextStory. Definition at line 4738 of file noderend.cpp. 04739 { 04740 // The return value. 04741 BOOL Result = FALSE; 04742 04743 // Is this a FlashRenderRegion? 04744 if ( pRender->IsKindOf ( CC_RUNTIME_CLASS ( FlashRenderRegion ) ) ) 04745 { 04746 // Cast the render region pointer to be a pointer to a vector file render region. 04747 FlashRenderRegion *pFlash = static_cast<FlashRenderRegion*> ( pRender ); 04748 04749 // Call the appropriate method in the vector file render region class. 04750 Result = pFlash->ExportRenderableNode ( this ); 04751 } 04752 04753 return Result; 04754 }
|
|
This is a helper function for FactorOutCommonChildAttributes. It finds all attributes which are common to all children of this compound object and adds the common attributes to this node. If Global is TRUE then it recursivly tries to factor out the attributes on all parent compounds. This function does not delete the attributes which are factored out, This is left to the calling function.
Definition at line 753 of file ndoptmz.cpp. 00754 { 00755 // This function should only ever get called on a compound object 00756 ENSURE(IsCompound(), "FactorOutCommonChildAttributes called on a non compound object"); 00757 00758 CommonAttrSet CommonAttributeSet; // A list of CommonAttributeItems 00759 00760 if (!FindCommonAttributesToFactorOut(&CommonAttributeSet)) // Ignores attr discard nodes 00761 { 00762 return FALSE; 00763 } 00764 00765 NodeAttribute* pFactoredOutAttr; 00766 00767 // Ok let's add the common attributes to the first child of the group 00768 CommonAttributeItem* pCommonAttr; 00769 for (pCommonAttr = (CommonAttributeItem*)CommonAttributeSet.GetHead(); 00770 pCommonAttr != NULL; 00771 pCommonAttr = (CommonAttributeItem*)CommonAttributeSet.GetNext(pCommonAttr)) 00772 { 00773 // Is the common attribute an attribute which should be factored out ? 00774 if (!pAffectedAttrTypes || (pAffectedAttrTypes->InSet(pCommonAttr->pAttr->GetAttributeType())) ) 00775 { 00776 //pCommonAttr->pAttr->MoveNode(this, FIRSTCHILD); 00777 // Take a copy of the node and insert it as a first child 00778 pFactoredOutAttr = (NodeAttribute*)(pCommonAttr->pAttr->SimpleCopy()); 00779 if (!pFactoredOutAttr) 00780 return FALSE; 00781 pFactoredOutAttr->AttachNode(this, FIRSTCHILD, TRUE, FALSE); 00782 } 00783 } 00784 00785 // The CommonAttributeSet is no longer required 00786 CommonAttributeSet.DeleteAll(); 00787 00788 // Do we need to factor out the parents attributes ? 00789 if (Global) 00790 { 00791 Node* pParent = FindParent(); 00792 if (pParent && (pParent->IsCompound())) 00793 { 00794 // We need to localise the parent's attributes first (Recursive bit) 00795 if (!(((NodeRenderableInk*)pParent)->FactorOutCommonChildAttrHelper(TRUE, pAffectedAttrTypes))) 00796 { 00797 return FALSE; // Failed 00798 } 00799 } 00800 } 00801 return TRUE; // Success 00802 }
|
|
Scope: public.
Definition at line 703 of file ndoptmz.cpp. 00704 { 00705 // This function should only ever get called on a compound object 00706 ENSURE(IsCompound(), "FactorOutCommonChildAttributes called on a non compound object"); 00707 00708 00709 // Try to factor out the neccessary attributes 00710 if (!FactorOutCommonChildAttrHelper(Global, pAffectedAttrTypes)) 00711 { 00712 // Tidyup then return FAIL 00713 DeleteLocalisedAttributes(Global, pAffectedAttrTypes); // tidyup 00714 return FALSE; // Failed 00715 } 00716 else 00717 { 00718 // The only thing that remains now is to delete all remaining factored out attributes 00719 DeleteFactoredOutAttribs(Global, pAffectedAttrTypes); 00720 } 00721 00722 return TRUE; // Success 00723 }
|
|
Definition at line 4294 of file noderend.cpp. 04295 { 04296 // Made more efficient by Simon 09/06/95 04297 // *pAttrFound = ScanForNearestAttrib(AttribType, TRUE); 04298 // if (*pAttrFound) 04299 // return TRUE; 04300 // else 04301 // return FALSE; 04302 04303 // Restored 06/01/2005 by Phil 04304 // FindFirst/PrevAppliedAttr have been made more efficient 04305 // And let's try to only have ONE way of scanning for applied attributes so we only 04306 // have to deal with ONE set of bugs... 04307 // 04308 // 04309 // Repeat the following loop for all attributes we encounter in the tree. 04310 NodeAttribute* pAttrib = NULL; 04311 if (bExcludeChildAttrs) 04312 pAttrib = NodeAttribute::FindPrevAppliedAttr(this); 04313 else 04314 pAttrib = NodeAttribute::FindFirstAppliedAttr(this); 04315 04316 while (pAttrib) 04317 { 04318 if (pAttrib->GetAttributeType() == AttribType) 04319 { 04320 // If the attr is an effect attr 04321 // and it is in my child list 04322 // and I don't allow this type of attr to be an effect 04323 // Then continue looking 04324 // Else return it 04325 // if (!(pAttrib->FindParent()==this && pAttrib->IsEffectAttribute() && !this->IsValidEffectAttr(pAttrib))) 04326 // return pAttrib; 04327 if (pAttrib->FindParent()!=this) 04328 return pAttrib; 04329 04330 if (bStrict) 04331 { 04332 if (pAttrib->IsEffectAttribute() == this->IsValidEffectAttr(pAttrib)) 04333 return pAttrib; 04334 } 04335 else 04336 if (!(pAttrib->IsEffectAttribute() && !this->IsValidEffectAttr(pAttrib))) 04337 return pAttrib; 04338 } 04339 04340 pAttrib = NodeAttribute::FindPrevAppliedAttr(pAttrib); 04341 } 04342 04343 return NULL; 04344 }
|
|
Finds the attribute of type 'AttribType' applied to this node.
Definition at line 4287 of file noderend.cpp. 04288 { 04289 NodeAttribute* pAttr = FindAppliedAttribute(AttribType, FALSE, bStrict); 04290 if (ppAttr) *ppAttr = pAttr; 04291 return (pAttr!=NULL); 04292 }
|
|
Searches for all the attributes which apply to "this" ink-node. This routine does NOT render them! Use RenderAppliedAttributes if you want that functionality.
Definition at line 1504 of file hittest.cpp. 01509 { 01510 // Precondition checks 01511 ERROR2IF(pAttribMap == 0, FALSE, "FindAppliedAttributes passed null map"); 01512 01513 // Find the closest attribute applied to "this" node... 01514 NodeAttribute* pAttrib = NodeAttribute::FindFirstAppliedAttr((Node*)this); 01515 if (pAttrib == 0) return FALSE; 01516 01517 // Get variables ready for the loop, OUTSIDE the loop!!! 01518 CCRuntimeClass* pTypeInfo; 01519 void* pDummy; 01520 INT32 nFound; 01521 if (pnFound) 01522 nFound = *pnFound; 01523 else 01524 nFound = 0; 01525 01526 // BOOL FoundClipAttr = FALSE; 01527 01528 // If we are finding a completely new set of attrs then we should not overwrite any entries 01529 // into the map that have been made within this routine 01530 // (So that normal attrs don't overwrite effect attrs) 01531 BOOL bOverwriteExisting = (nFound!=0); 01532 01533 // Repeat the following loop for all attributes we encounter in the tree. 01534 while (pAttrib) 01535 { 01536 // Get the run-time type of the attribute, which serves as a hash "key". 01537 pTypeInfo = pAttrib->GetAttributeType(); 01538 01539 // Check if this type is already in the hash table. If it isn't then insert 01540 // its address with its run-time type as the key, and check if we need to look 01541 // for any more. 01542 BOOL bEffectStatusOK = FALSE; 01543 if (bStrictEffectStatus) 01544 bEffectStatusOK = (pAttrib->IsEffectAttribute() == this->IsValidEffectAttr(pAttrib)); 01545 else 01546 bEffectStatusOK = !pAttrib->IsEffectAttribute(); 01547 01548 if (!pAttrib->IsAClipViewAttr() && (pAttrib->FindParent() != (Node*)this || bEffectStatusOK)) 01549 { 01550 if (!pAttribMap->Lookup(pTypeInfo, pDummy)) 01551 { 01552 // This is a new attribute for the map 01553 BOOL AddAttr = TRUE; 01554 // NB keep default attrs in map so we don't have incomplete maps 01555 if (ExcludeIndirectlyAppliedGLAs && !pAttrib->IsADefaultAttr() && pAttrib->IsLinkedToNodeGeometry()) 01556 { 01557 if(!pAttrib->IsLinkedToThisNode((Node*)this)) 01558 { 01559 AddAttr = FALSE; 01560 } 01561 } 01562 01563 if(AddAttr) 01564 { 01565 pAttribMap->SetAt(pTypeInfo, pAttrib); 01566 nFound++; 01567 ERROR3IF(nFound>nMax,"Found more attribute types than are registered!"); 01568 } 01569 } 01570 else if (bOverwriteExisting) 01571 { 01572 // An attribute of that type is already in the map 01573 // But if this attribute is a child of the scanned node 01574 // we should force it into the map because it's 01575 // still in scope! 01576 if (pAttrib->FindParent() == (Node*)this) 01577 { 01578 pAttribMap->SetAt(pTypeInfo,pAttrib); 01579 // (Attrib type was already in map so no need to increment counter.) 01580 } 01581 } 01582 } 01583 01584 // After dealing with that attribute can we stop the scan? 01585 // We want to stop as soon as we can, namely when we have all the attribute 01586 // types in the map and when we're no longer scanning children of "this". 01587 if ( nFound >= nMax && (pAttrib->FindParent()!=(Node*)this) ) 01588 break; 01589 01590 // Go on to find the next attribute. 01591 pAttrib = NodeAttribute::FindPrevAppliedAttr(pAttrib); 01592 } 01593 01594 #ifdef _DEBUG 01595 PORTNOTE("other","Removed some IsUserName protected debug") 01596 #if 0 01597 if (IsUserName("Phil") && nMax<5000 && nFound<nMax) 01598 { 01599 TRACE( _T("Not found all reqd atts: (found %d attributes, should be %d)\n"), 01600 nFoundAttributes, nMaxAttributes); 01601 01602 for (POSITION pos = pAttribMap->GetStartPosition(); pos != 0; ) 01603 { 01604 void* pKey; 01605 void* pValue; 01606 pAttribMap->GetNextAssoc(pos, pKey, pValue); 01607 TRACE( _T("\tFound a %s at 0x%lX\n"), 01608 ((CCRuntimeClass*) pKey)->m_lpszClassName, 01609 (UINT32) pValue); 01610 } 01611 01612 List* pTypeList = ObjectRegistry::GetRequiredAttribs(GetRuntimeClass()); 01613 for (ListItem* pItem = pTypeList->GetHead(); 01614 pItem != 0; 01615 pItem = pTypeList->GetNext(pItem)) 01616 { 01617 CCRuntimeClass* pClass = ((NodeAttributeClassItem*) pItem)->AttributeClass; 01618 void* pDummy; 01619 if (!pAttribMap->Lookup(pClass, pDummy)) 01620 { 01621 TRACE( _T("\t\tCouldn't find a %s\n"), pClass->m_lpszClassName); 01622 } 01623 } 01624 } 01625 #endif 01626 #endif 01627 ERROR2IF(nMax<5000 && nFound<nMax,FALSE,"Failed to find all required attributes."); 01628 01629 if (pnFound) 01630 *pnFound = nFound; 01631 01632 return TRUE; 01633 }
|
|
The function obtains the TRUE 32-BIT RGB index for the pixel that our mouse cursor is over for the supplied node.
Definition at line 730 of file hittest.cpp. 00735 { 00736 PORTNOTETRACE("other","NodeRenderableInk::FindColourForNodeRenderableAtPoint - do nothing"); 00737 #ifndef EXCLUDE_FROM_XARALX 00738 // Find the currently active DocView. 00739 DocView* pDocView = DocView::GetSelected(); 00740 ENSURE(pDocView != 0, "Null current DocView in NodeRenderableInk::FindFirstAtPoint"); 00741 00742 // Build a rectangle around the given point, based on the size of a blob. 00743 DocRect drClickRect; 00744 OSRenderRegion::GetBlobRect(pDocView->GetViewScale(), dcPoint, 00745 BT_CLICKME, &drClickRect); 00746 00747 // Get the extent of the current view and convert to spread coordinates. 00748 DocRect drViewRect = pDocView->GetDocViewRect(pSpread); 00749 pSpread->DocCoordToSpreadCoord(&drViewRect); 00750 00751 // Create a colour render region to draw into, if possible. 00752 RenderRegion* pRegion = pDocView->RenderOnTop(&drClickRect, pSpread, COLOURBITMAP); 00753 00754 if (pRegion==0) 00755 { 00756 delete pAttribMap; 00757 ERROR2(0,"FindSimpleAtPoint: couldn't create a RenderRegion!"); 00758 } 00759 00760 // Start with a (very) clean sheet. 00761 pRegion->SetClean(TRUE, TRUE); 00762 00763 pRegion->StopRender (); 00764 00765 while (pRegion != 0) 00766 { 00767 // we want to render everything using the quality the document is using .... 00768 00769 if (pRegion->RRQuality.GetQuality() != Quality::QualityGuideLayer) 00770 { 00771 QualityAttribute* pQualAttr = new QualityAttribute(pDocView->RenderQuality); 00772 pRegion->SetQuality(pQualAttr, TRUE); 00773 } 00774 00775 pRegion->SetFillGeometry ((ColourFillAttribute*) (pThisFill->GetAttributeValue ()), FALSE); 00776 pThisNode->Render (pRegion); 00777 00778 // uncommenting the following line allows us to see what is going on 00779 // OSRenderBitmap::DebugMe(pRegion,8); 00780 00781 // need explicit cast to enable us to call ReadCentrePixel32bpp 00782 if (pRegion->IsKindOf(CC_RUNTIME_CLASS(GRenderClickColour))) 00783 { 00784 GRenderClickColour* actualRegion = (GRenderClickColour*) pRegion; 00785 Pix = actualRegion->GetCentrePixel32BPP(); 00786 } 00787 00788 pRegion->StartRender (); 00789 pRegion = pDocView->GetNextOnTop(&drClickRect); 00790 } 00791 #endif 00792 return 0; // I suppose I should return something else here? //pThisNode); 00793 }
|
|
This fn does not exist.Finds all attributes common to the compound node.
Definition at line 559 of file ndoptmz.cpp. 00560 { 00561 CommonAttributeItem* CommonAttrItem; 00562 CommonAttributeItem* NextCommonAttrItem; 00563 00564 // Place all attributes in the CommonAttributeSet 00565 if (!CommonAttributeSet->AddAllTypesToSet()) 00566 { 00567 return FALSE; // ERROR already called 00568 } 00569 00570 // Scan all grouped objects 00571 for (Node* CurrentObject = FindFirstChild(); 00572 CurrentObject != NULL; 00573 CurrentObject = CurrentObject->FindNext()) 00574 { 00575 if (CurrentObject->IsAnObject()) 00576 { 00577 00578 // Scan all attributes in the CommonAttributeSet in turn 00579 CommonAttrItem = (CommonAttributeItem*)CommonAttributeSet->GetHead(); 00580 00581 while(CommonAttrItem != NULL) 00582 { 00583 // Hand over hand cos we may well delete the CommonAttrItem 00584 NextCommonAttrItem = (CommonAttributeItem*)(CommonAttributeSet->GetNext(CommonAttrItem)); 00585 00586 // Does CurrentObject require the attribute to render 00587 if ( (((NodeRenderableInk*)CurrentObject)->RequiresAttrib(CommonAttrItem->AttrType)) || CurrentObject->IsCompound()) 00588 { 00589 BOOL DeleteCommonAttr = FALSE; // Until we know better 00590 00591 // Ok the current object requires the attribute 00592 // Does the CurrentObject have a child attribute of this type ? 00593 NodeAttribute* pAttrNode = 00594 ((NodeRenderableInk*)CurrentObject)->GetChildAttrOfType(CommonAttrItem->AttrType); 00595 if (pAttrNode != NULL && pAttrNode->ShouldBeOptimized()) 00596 { 00597 // Ok it has an attribute of this type 00598 if (CommonAttrItem->pAttr == NULL) 00599 { 00600 // The attribute becomes a common attribute 00601 CommonAttrItem->pAttr = pAttrNode; 00602 CommonAttrItem->Status = Range::ATTR_COMMON; 00603 } 00604 else if(CommonAttrItem->pAttr->GetRuntimeClass() == 00605 pAttrNode->GetRuntimeClass()) 00606 { 00607 // Ok they are the same runtime class but are they equal 00608 if (!((*pAttrNode)==(*(CommonAttrItem->pAttr)))) 00609 { 00610 // They are not equal so remove CommonAttrItem from the 00611 // common attribute set. 00612 DeleteCommonAttr = TRUE; 00613 } 00614 // DY 12/5/2000 AttrBrushTypes cannot be factored because they 00615 // may contain caches of pressure or timestamp data which apply 00616 // to a specific node only. 00617 // They no longer contain this data so factor them like normal! 00618 //if (pAttrNode->IsKindOf(CC_RUNTIME_CLASS(AttrBrushType))) 00619 // DeleteCommonAttr = TRUE; 00620 } 00621 else 00622 { 00623 // They cannot be the same value cos they are different runtime types 00624 DeleteCommonAttr = TRUE; 00625 } 00626 } 00627 else 00628 { 00629 // The CurrentObject does not have an attribute of this type so it 00630 // cannot be common 00631 DeleteCommonAttr = TRUE; 00632 } 00633 00634 if (DeleteCommonAttr) 00635 { 00636 delete(CommonAttributeSet->RemoveItem(CommonAttrItem)); 00637 } 00638 } 00639 00640 CommonAttrItem = NextCommonAttrItem; 00641 } 00642 } 00643 // Removed because there are circumstances where certain attributes have 00644 // already been factored out eg. Corel filter 00645 //else 00646 //{ 00647 // ENSURE(CurrentObject->GetRuntimeClass() == CC_RUNTIME_CLASS(NodeHidden), 00648 // "It's not an object, it's not a hidden node, so what is it ??"); 00649 //} 00650 } 00651 // Delete all NULL items in the CommonAttributeSet 00652 CommonAttrItem = (CommonAttributeItem*)CommonAttributeSet->GetHead(); 00653 while (CommonAttrItem != NULL) 00654 { 00655 CommonAttributeItem* Next = (CommonAttributeItem*)CommonAttributeSet->GetNext(CommonAttrItem); 00656 if (CommonAttrItem->pAttr == NULL) 00657 { 00658 // Item is a non required attribute so zap it 00659 delete (CommonAttributeSet->RemoveItem(CommonAttrItem)); 00660 } 00661 CommonAttrItem = Next; 00662 } 00663 00664 return TRUE; // Job done 00665 }
|
|
This function is similar to NodeRenderableInk::FindSimpleAtPoint, except that.
Definition at line 950 of file hittest.cpp. 00951 { 00952 return FindCompoundFromSimple(FindSimpleAtPoint(pSpread, dcPoint, pHighNode)); 00953 }
|
|
This function will search up the parent links from the given "simple" node looking for a node whose parent is a layer. This guarantees that the returned node will be a genuinely selectable object, for example the routine will return the group node if the given point is within a grouped object.
Definition at line 815 of file hittest.cpp. 00817 { 00818 // If necessary, search for a selectable parent node. 00819 if (pSimpleNode != 0) 00820 { 00821 for (;;) 00822 { 00823 // Find the node's parent, and if it is a layer then we have a node that can 00824 // be selected. 00825 Node* pParentNode = pSimpleNode->FindParent(); 00826 Node* pSaveParentNode = 0; 00827 00828 // DMc - new test to see which parent node wishes to be selected 00829 while (pParentNode != 0) 00830 { 00831 if (pParentNode->IsRenderable() && 00832 !pParentNode->IsNodeDocument() && 00833 !pParentNode->IsLayer() && 00834 !pParentNode->IsPaper() && 00835 !pParentNode->IsSpread() && 00836 !pParentNode->IsChapter()) 00837 { 00838 if (pParentNode->PromoteHitTestOnChildrenToMe() || 00839 pParentNode->IsSelected()) 00840 pSaveParentNode = pParentNode; 00841 } 00842 00843 pParentNode = pParentNode->FindParent(); 00844 } 00845 00846 pParentNode = pSaveParentNode; 00847 if (pParentNode == 0 || pParentNode->IsLayer()) break; 00848 00849 // If the caller has specified that the node should be in the same level 00850 // as the specified sibling then check to see if the node we've got to 00851 // exists in that sibling list or not... 00852 if (pSiblingNode != 0) 00853 { 00854 // Check all siblings. Start from first sibling in this list. 00855 Node* pSibling = pSimpleNode->FindParent(); 00856 if (pSibling != 0) pSibling = pSibling->FindFirstChild(); 00857 00858 // Loop around comparing members of the sibling list with the specified sibling... 00859 while (pSibling != 0 && pSibling != pSiblingNode) 00860 pSibling = pSibling->FindNext(); 00861 00862 // If we found the specified sibling then stop the CompoundFromSimple search. 00863 if (pSibling == pSiblingNode) break; 00864 } 00865 00866 // If the parent doesn't want to be selected due to one of it's children being 00867 // clicked on then stop NOW! 00868 if (pParentNode->IsAnObject()) 00869 { 00870 if (((NodeRenderableInk*) pParentNode)->CanSelectAsCompoundParent()) 00871 pSimpleNode = (NodeRenderableInk*) pParentNode; // Parent allowed to be selected 00872 else 00873 break; // Parent not allowed to be selected 00874 // So return pSimpleNode now! 00875 } 00876 else 00877 { 00878 // Hit a non-ink node so we must have emerged above the selection surface 00879 // This shouldn't happen, so raise an error! 00880 ERROR2(0, "Couldn't find a selectable compound node in FindCompoundFromSimple"); 00881 } 00882 } 00883 } 00884 00885 // Return the node found, or 0 if we couldn't find any. 00886 return pSimpleNode; 00887 }
|
|
Walks the node tree in the reverse order to rendering, which is the order that nodes should be considered for hit-testing.
Definition at line 1052 of file hittest.cpp. 01057 { 01058 // Make sure that the node we start at is really a spread, as all NodeRenderableInks 01059 // are children of spread nodes. 01060 ENSURE(pStartSpread != NULL, 01061 "Node::FindFirstHitTest: pStartSpread parameter is NULL!"); 01062 ENSURE(pStartSpread->IsSpread(), 01063 "Node::FindFirstHitTest: pStartSpread parameter is not a spread!"); 01064 01065 // Get the bounding box of the objects within the specified spread, converted to 01066 // spread coordinates. 01067 DocRect drSpreadBounds = pStartSpread->GetBoundingRect(); 01068 pStartSpread->DocCoordToSpreadCoord(&drSpreadBounds); 01069 01070 // If the bounding box doesn't intersect the click rectangle then the given spread 01071 // cannot hold any object that was clicked on. 01072 if (!drSpreadBounds.IsIntersectedWith(drClickRect)) 01073 return NULL; 01074 01075 // As the spread does contain the click rectangle, begin the traversal... 01076 // Call FindNextHitTest directly on the Spread so that the last item of the 01077 // Spread's child list can be considered correctly. 01078 Node* pFirstNode = FindNextHitTest((Node*)pStartSpread, drClickRect, pAttribMap, bExcludeLayers); 01079 if (pFirstNode == NULL) 01080 return NULL; 01081 01082 // If there is an upper limit node then go through the tree until we get down to that 01083 // without returning the results for hit-testing. 01084 // (Or until there are no more nodes to consider!) 01085 if (pHighNode != NULL) 01086 { 01087 while (pFirstNode != NULL && pFirstNode != pHighNode) 01088 { 01089 pFirstNode = FindNextHitTest(pFirstNode, drClickRect, pAttribMap, bExcludeLayers); 01090 } 01091 01092 // If we have stopped at the high node then return the next node below that in HitTest order 01093 // as the "first" node... Note that we do not want to examine child nodes of the high node. 01094 if (pFirstNode != NULL) 01095 { 01096 pFirstNode = FindNextHitTest(pFirstNode, drClickRect, pAttribMap, bExcludeLayers, TRUE); 01097 } 01098 } 01099 01100 return pFirstNode; 01101 }
|
|
Definition at line 905 of file hittest.cpp. 00906 { 00907 if (pLowNode==pHighNode) 00908 return 0; 00909 00910 if (!pHighNode->AllowSelectInside()) 00911 return 0; 00912 00913 Node* pLastCompoundNode = pLowNode; 00914 if (pLowNode != 0) 00915 { 00916 for (;;) 00917 { 00918 pLowNode = pLowNode->FindParent(); 00919 if (pLowNode == 0 || pLowNode == pHighNode || IS_A(pLowNode, Layer)) break; 00920 if (pLowNode->IsCompound()) pLastCompoundNode = pLowNode; 00921 // if (IsUserName("JustinF")) TRACE( _T("\t\tLooking at a %s\n"), pLowNode->Name()); 00922 } 00923 } 00924 00925 return (NodeRenderableInk*) pLastCompoundNode; 00926 }
|
|
Walks the node tree in the reverse order to rendering, which is the order that nodes should be considered for hit-testing.
Definition at line 1134 of file hittest.cpp. 01139 { 01140 if (pNode == NULL) 01141 return NULL; 01142 01143 // Storage for pointer to attribute types... 01144 CCRuntimeClass* pTypeInfo; 01145 void* pDummy; 01146 01147 // Check if we should go down the child link of this node. 01148 // (If node is a spread then allow it's children to be scanned because it's bounds 01149 // are in a different coordinate system. This is OK because we know that the 01150 // only time this routine is called on a Spread is the first call made in FindFirstHitTest 01151 // which has already done a bounds test.) 01152 if (!bSkipChildren && 01153 (HitTestChildren(pNode, drClickRect, bExcludeLayers) || 01154 pNode->IsSpread())) 01155 { 01156 // Find its right-most sibling and continue walking from there. 01157 pNode = pNode->FindFirstChild(); 01158 while (pNode->FindNext() != NULL) 01159 { 01160 // If this node is an attribute then it's more local than anything that might 01161 // be in the Attribute map (because we've just gone DOWN in the tree). 01162 // So, we'll bung it directly into the attribute map! 01163 if (pNode->IsAnAttribute() && !pNode->IsAClipViewAttr()) 01164 { 01165 pTypeInfo = ((NodeAttribute*)pNode)->GetAttributeType(); 01166 01167 // Check if this type is already in the hash table. If it isn't then increment 01168 // the number of attribute types found 01169 if (!pAttribMap->Lookup(pTypeInfo, pDummy)) 01170 nFoundAttributes++; 01171 01172 // Insert this local attribute into the map 01173 pAttribMap->SetAt(pTypeInfo, pNode); 01174 } 01175 01176 pNode = pNode->FindNext(); 01177 } 01178 } 01179 else if (pNode->FindPrevious() != NULL) 01180 { 01181 // Otherwise, just backtrack to the immediately-previous sibling, if possible. 01182 pNode = pNode->FindPrevious(); 01183 } 01184 else 01185 { 01186 // We have hit a node with no previous sibling or children. Search up through 01187 // its parents until we find a parent with a previous sibling. This previous 01188 // sibling is our next node. However, if while searching up the parent links 01189 // we hit a spread then we know we have passed all NodeRenderableInks, and the 01190 // search can be terminated. 01191 do 01192 { 01193 if (pNode->IsSpread()) // Don't allow hit-testing to cross spreads 01194 return NULL; 01195 01196 pNode = pNode->FindParent(); 01197 } 01198 while (pNode != NULL && pNode->FindPrevious() == NULL); 01199 if (pNode->IsSpread()) // Don't allow hit-testing to cross spreads 01200 return NULL; 01201 01202 // If we broke out of the above loop because we found a parent with a previous 01203 // sibling then advance to that sibling. 01204 if (pNode != NULL && pNode->FindPrevious() != NULL) 01205 pNode = pNode->FindPrevious(); 01206 if (pNode->IsSpread()) // Don't allow hit-testing to cross spreads 01207 return NULL; 01208 } 01209 01210 // If the found node is an attribute then remove it from the attribute map because it 01211 // has just gone out of scope! 01212 if (pNode->IsAnAttribute() && !pNode->IsAClipViewAttr()) 01213 { 01214 // The node is an attribute. Make sure that it no longer occurs in the 01215 // attribute hash table, so that the next time RenderAppliedAttributes is 01216 // called it will look for this kind. 01217 if (nFoundAttributes > 0 && pAttribMap->RemoveKey(((NodeAttribute*) pNode)->GetAttributeType())) 01218 nFoundAttributes--; 01219 } 01220 01221 01222 // Return the node we've found. 01223 return pNode; 01224 }
|
|
Reimplemented in NodeLiveEffect. Definition at line 335 of file ink.h.
|
|
|
|
Searches the ink-able objects within the given spread for one that lies at or near the given point. The method used to render each candidate object into a small monochrome bitmap, in the reverse order to normal (so that the object normally rendered last is the first to be rendered into the bitmap). The bitmap is examined to see if the object affected the centre or surrounding pixels.
Definition at line 297 of file hittest.cpp. 00302 { 00303 // TRACE(_T("FindSimpleAtPoint(%d, %d)\n"), dcPoint.x, dcPoint.y); 00304 00305 // Find the currently active DocView. 00306 DocView* pDocView = DocView::GetSelected(); 00307 ENSURE(pDocView != 0, "Null current DocView in NodeRenderableInk::FindFirstAtPoint"); 00308 00309 // Initialise the count and limit on the number of attributes encountered. 00310 List* pTypeList = ObjectRegistry::GetRequiredAttribs(0); // <--- 00311 ENSURE(pTypeList != 0 && !pTypeList->IsEmpty(), 00312 "Object Registry returned a dodgy list in NodeRenderableInk::FindSimpleAtPoint"); 00313 nFoundAttributes = 0; 00314 nMaxAttributes = pTypeList->GetCount(); 00315 00316 // Clear interrupt node pointer 00317 if (ppInterruptNode) 00318 *ppInterruptNode = 0; 00319 00320 // Initialise the hash-table used to look-up attributes encountered. 00321 // Make the hash table twice as big as the number of att types for efficient look-up. 00322 pAttribMap = new CCAttrMap(nMaxAttributes*2); 00323 ERROR2IF(pAttribMap==0,0,"FindSimpleAtPoint: couldn't create a CCAttrMap!"); 00324 00325 // Build a rectangle around the given point, based on the size of a blob. 00326 DocRect drClickRect; 00327 OSRenderRegion::GetBlobRect(pDocView->GetViewScale(), dcPoint, 00328 BT_CLICKME, &drClickRect); 00329 00330 // Get the extent of the current view and convert to spread coordinates. 00331 DocRect drViewRect = pDocView->GetDocViewRect(pSpread); 00332 pSpread->DocCoordToSpreadCoord(&drViewRect); 00333 00334 // Create a special hit-detection render region to draw into, if possible. 00335 RenderRegion* pRegion = pDocView->RenderOnTop(&drClickRect, pSpread, CLICKBITMAP); 00336 if (pRegion==NULL) 00337 { 00338 delete pAttribMap; 00339 ERROR2(NULL,"FindSimpleAtPoint: couldn't create a RenderRegion!"); 00340 } 00341 00342 // Start with a (very) clean sheet. 00343 pRegion->SetClean(TRUE, TRUE); 00344 00345 // These point to ink-nodes in the tree that have been rendered into our hit-test 00346 // render-region. 00347 NodeRenderableInk* pHitNode = NULL; // node that occupies dcPoint 00348 NodeRenderableInk* pNearNode = NULL; // node that came closest to dcPoint 00349 NodeRenderableInk* pCompoundHitNode = NULL; // compound node that was hit before trying children 00350 NodeRenderableInk* pCompoundNearNode = NULL; // compound node that was near before trying children 00351 00352 MonotonicTime Slice; // Sample time now 00353 00354 BOOL bSkipChildren = FALSE; 00355 00356 // Perform hit-testing for each render-region provided by the DocView. 00357 while (pRegion != NULL) 00358 { 00359 // Render the first and subsequent ink-nodes into the render-region, checking if any 00360 // draw into it. 00361 for (Node* pNode = FindFirstHitTest(pSpread, drClickRect, pAttribMap, TRUE, pHighNode); 00362 pNode != NULL; 00363 pNode = FindNextHitTest(pNode, drClickRect, pAttribMap, TRUE, bSkipChildren)) 00364 { 00365 bSkipChildren = FALSE; 00366 00367 if (pNode) 00368 { 00369 if (pNode->IsAnObject()) 00370 { 00371 // Does this renderable node intersect the click rectangle? If not, then 00372 // ignore it. 00373 DocRect drBounds = ((NodeRenderableInk*) pNode)->GetBoundingRect(FALSE, TRUE); 00374 if (!drBounds.IsIntersectedWith(drClickRect)) continue; 00375 00376 // This node can be rendered. Find all the outstanding attributes in the 00377 // tree that affect the rendering of this node, and render them. 00378 // 00379 // Jason 15/1/97 - Save the current RR context so that we can restore the render 00380 // stack to a sensible state after rendering this object. This is safe because we 00381 // always render all relevant attributes for every object we hit test. 00382 // We restore immediately after rendering (the 3 RestoreContext() calls, below) 00383 pRegion->SaveContext(); 00384 ((NodeRenderableInk*) pNode)->RenderAppliedAttributes(pRegion); 00385 00386 // This ensures that the object is rendered according to the view Quality setting. 00387 // When Quality attributes appear in the tree this may not be a good thing!!! 00388 // It should really be called before RenderAppliedAttributes but at the moment that seems 00389 // to always set Quality to Normal for some reason!!! 00390 // Extract Quality from DocView object and set it up in the renderregion/monobitmap 00391 00392 // Markn 26/9/95: Added the following 'if' statement to prevent the setting of the view 00393 // quality overriding the quality set by the AttrQuality attribute in the guides layer. 00394 if (pRegion->RRQuality.GetQuality() != Quality::QualityGuideLayer) 00395 { 00396 QualityAttribute *pQualAttr = new QualityAttribute(pDocView->RenderQuality); 00397 pRegion->SetQuality(pQualAttr, TRUE); 00398 } 00399 00400 // Phil 18/03/2004 00401 // Must render clip region attribute AFTER Quality attribute has been set how 00402 // the region will be rendered otherwise GDraw will fail in FillPath! 00403 // 00404 // Karim 13/4/2000 (lucky for some...) 00405 // ok, BODGE CITY here. we're going to do a RenderAppliedClipAttributes(), which 00406 // renders all the ClipRegionAttributes which would normally apply to this node. 00407 // see the method header for more info. 00408 ((NodeRenderableInk*) pNode)->RenderAppliedClipAttributes(pRegion); 00409 00410 do 00411 { 00412 // This 'do' loop will render the same node until the sub render state is 0 00413 // This allows heavy-duty nodes (e.g. blends) to get the hit test bmp to be checked 00414 // at any point during the rendering of the node. 00415 00416 // Now the attributes are done, render the object itself. 00417 pRegion->SetClean(FALSE, FALSE); // Reset just the clean flag so we can tell whether 00418 // compound nodes render anything 00419 // ------------------------------ 00420 pNode->Render(pRegion); 00421 // ------------------------------ 00422 00423 #ifdef DEBUG_CLICK_DETECT_BITMAP 00424 OSRenderBitmap::DebugMe(pRegion, 8); 00425 #endif 00426 // Check if any of the pixels in the render-region were affected by the 00427 // last rendering. 00428 BitmapContents bcDrawCode = OSRenderBitmap::GetContents(pRegion, FALSE); 00429 00430 if (pNode->IsCompoundClass() && !pRegion->IsClean()) 00431 { 00432 #ifdef DEBUG_CLICK_DETECT_BITMAP 00433 OSRenderBitmap::DebugMe(pRegion, 108); 00434 #endif 00435 // Compound has rendered something... 00436 // 00437 // Clean out the bitmap since we know we are going to use it some more 00438 pRegion->SetClean(FALSE, TRUE); 00439 00440 // Compound nodes may render themselves if they have effect 00441 // attributes applied (so that effect transparency is 00442 // properly taken into account during hit testing) 00443 // If the compound node rendered the centre pixel then we must 00444 // allow the children of the node to render themselves to get 00445 // a true indication of the clicked on node 00446 // If not, then we should not allow our children to render 00447 // themselves at all 00448 if (bcDrawCode != BITMAPCONTENTS_CENTRE && bcDrawCode != BITMAPCONTENTS_ANY) 00449 { 00450 // Skip out of this node's subtree... 00451 bSkipChildren = TRUE; 00452 } 00453 else 00454 // else just keep going (treat this as a "near" node) 00455 { 00456 // if (pNearNode == NULL) pNearNode = (NodeRenderableInk*) pNode; 00457 if (bcDrawCode == BITMAPCONTENTS_CENTRE) 00458 { 00459 if (pCompoundHitNode == NULL) pCompoundHitNode = (NodeRenderableInk*)pNode; 00460 } 00461 else 00462 { 00463 if (pCompoundNearNode == NULL) pCompoundNearNode = (NodeRenderableInk*)pNode; 00464 } 00465 } 00466 } 00467 else 00468 { 00469 if (bcDrawCode == BITMAPCONTENTS_CENTRE) 00470 { 00471 // The centre pixel was affected. Remember this node and prepare to 00472 // return result to caller. 00473 pHitNode = (NodeRenderableInk*) pNode; 00474 00475 // And exit both loops. We have to restore the previous RR state first, though 00476 pRegion->RestoreContext(); 00477 goto AfterSearch; 00478 } 00479 else if (bcDrawCode == BITMAPCONTENTS_ANY) 00480 { 00481 // Some outer pixels were affected. If we don't already have a 00482 // "closest" node then remember this one. If we do already have a 00483 // "closest" node then the previous "closest" is "closer", because 00484 // it is on-top! 00485 if (pNearNode == NULL) pNearNode = (NodeRenderableInk*) pNode; 00486 00487 // Don't break because although this stage (typically a stage of a Blend) has returned 00488 // "Near" the next one might be a direct hit! 00489 //break; // break out of the do-while sub render state loop 00490 } 00491 } 00492 00493 00494 // If the caller has allowed us to inetrrupt the hit-testing process 00495 // then we will do so if the mouse has moved... 00496 // Only do these tests every twentieth of a second because they could take some time 00497 if (ppInterruptNode && Slice.Elapsed(50)) 00498 { 00499 Slice.Sample(); // Reset the slice timer 00500 DocView* pDocView = DocView::GetCurrent(); 00501 if (pDocView->IsMouseMoved()) // Has the mouse moved? 00502 { 00503 TRACEUSER( "Phil", _T("FindSimpleAtPoint Interrupt! %lx\n"), pNode); 00504 if (*ppInterruptNode == NULL) // If so set the interrupt 00505 *ppInterruptNode = pNode; // node pointer 00506 pNode = 0; // Clear pointer to "hit" node 00507 00508 // And exit both loops. We have to restore the previous RR state first, though 00509 pRegion->RestoreContext(); 00510 goto AfterSearch; // and stop the search 00511 } 00512 } 00513 00514 // Render the same node until the sub render state is NULL 00515 } while (pRegion->GetSubRenderState() != NULL); 00516 00517 // Restore the RenderRegion attr state to how it was before we rendered this node 00518 pRegion->RestoreContext(); 00519 } 00520 } 00521 00522 } 00523 // Advance onto the next render-region. 00524 pRegion = pDocView->GetNextOnTop(&drClickRect); 00525 } 00526 00527 AfterSearch: 00528 00529 // Discard remaining render regions (although there shouldn't be any). 00530 while (pRegion != NULL) 00531 pRegion = pDocView->GetNextOnTop(&drClickRect); 00532 00533 // Deallocate the hash table. 00534 delete pAttribMap; 00535 00536 // If we found a "hit" then return that node, otherwise return the closest 00537 // "near miss" (which will be null if no node was close). 00538 if (pHitNode == NULL) 00539 { 00540 if (pNearNode != NULL) 00541 { 00542 if (!pNearNode->IsKindOf(CC_RUNTIME_CLASS(NodeShadow)) && 00543 !pNearNode->IsKindOf(CC_RUNTIME_CLASS(NodeShadowController))) 00544 pHitNode = pNearNode; 00545 } 00546 else 00547 if (pCompoundHitNode) 00548 pHitNode = pCompoundHitNode; 00549 else if (pCompoundNearNode) 00550 pHitNode = pCompoundNearNode; 00551 00552 } 00553 else 00554 { 00555 // We might have set pNearNode from a compound render 00556 // but then allowed processing to continue 00557 // So if pNearNode is set but is not the parent of the hit node then 00558 // we should use pNearNode instead 00559 // 00560 // NOTE! We could avoid extra work by making FinNextHitTest stop as soon 00561 // as it leaves the subtree whose root is pNearNode. 00562 if (pCompoundHitNode && !pCompoundHitNode->IsNodeInSubtree(pHitNode)) 00563 pHitNode = pCompoundHitNode; 00564 } 00565 00566 // Check if this node wishes to be selected 00567 // and if not, find it's parent instead... 00568 while (pHitNode != NULL && !pHitNode->CanSelectAsSimple()) // While we have a node but it doesn't 00569 { // want to be selected... 00570 Node* ptemp = pHitNode->FindParent(); // Find parent of current node 00571 if (ptemp != NULL && ptemp->IsAnObject()) // If parent is ink 00572 { 00573 pHitNode = (NodeRenderableInk*) ptemp; // Then reset current pointer 00574 if (!pHitNode->CanSelectAsCompoundParent()) // See if it is prepared to be selected 00575 pHitNode = NULL; // If not then can't select anything! 00576 } 00577 else // Else (parent is NOT ink) 00578 pHitNode = NULL; // Then can't select anything! 00579 } 00580 00581 // Give the node a chance to alter it's "hit" status 00582 if (pHitNode) 00583 pHitNode = pHitNode->FindNodeAtPointHelper(pSpread, dcPoint); 00584 00585 return pHitNode; 00586 }
|
|
Firstly, this function serves to find the 'ID' of the item that our colour picker is over - which is used to update our mouse cursor. Secondly, it obtains the TRUE 32-BIT RGB index for the pixel that our mouse cursor is over - enabling us to do colour manager/dialog type things. The first part of this routine simply calls FindSimpleAtPointFor - and the second part actually does colour specific work.
Definition at line 630 of file hittest.cpp. 00635 { 00636 // Find the currently active DocView. 00637 DocView* pDocView = DocView::GetSelected(); 00638 ENSURE(pDocView != 0, "Null current DocView in NodeRenderableInk::FindFirstAtPoint"); 00639 00640 // Build a rectangle around the given point, based on the size of a blob. 00641 DocRect drClickRect; 00642 OSRenderRegion::GetBlobRect(pDocView->GetViewScale(), dcPoint, 00643 BT_CLICKME, &drClickRect); 00644 00645 // Get the extent of the current view and convert to spread coordinates. 00646 DocRect drViewRect = pDocView->GetDocViewRect(pSpread); 00647 pSpread->DocCoordToSpreadCoord(&drViewRect); 00648 00649 // find 'ID' of item that mouse cursor is over (or not) 00650 NodeRenderableInk* pHitNode = FindSimpleAtPoint (pSpread, dcPoint, pHighNode, ppInterruptNode); 00651 00652 BOOL bOldForce = pDocView->SetForceDefaultColourContexts(); 00653 00654 // Create a colour render region to draw into, if possible. 00655 RenderRegion* pRegion = pDocView->RenderOnTop(&drClickRect, pSpread, COLOURBITMAP); 00656 if (pRegion == 0) 00657 { 00658 pDocView->SetForceDefaultColourContexts(bOldForce); 00659 delete pAttribMap; 00660 ERROR2(0,"FindSimpleAtPoint: couldn't create a RenderRegion!"); 00661 } 00662 00663 // Start with a (very) clean sheet. 00664 pRegion->SetClean(TRUE, TRUE); 00665 pRegion->StopRender(); 00666 00667 while (pRegion != 0) 00668 { 00669 // we want to render everything using the quality the document is using .... 00670 00671 if (pRegion->RRQuality.GetQuality() != Quality::QualityGuideLayer) 00672 { 00673 QualityAttribute *pQualAttr = new QualityAttribute(pDocView->RenderQuality); 00674 pRegion->SetQuality(pQualAttr, TRUE); 00675 } 00676 00677 // render everything over pSpread into our renderregion .... 00678 pDocView->ContinueRenderView(pRegion, pSpread, TRUE, FALSE); 00679 00680 // uncommenting the following line allows us to see what is going on 00681 // OSRenderBitmap::DebugMe(pRegion,8); 00682 00683 // need explicit cast to enable us to call ReadCentrePixel32bpp 00684 if (pRegion->IsKindOf(CC_RUNTIME_CLASS(GRenderClickColour))) 00685 { 00686 GRenderClickColour* actualRegion = (GRenderClickColour*) pRegion; 00687 if (NodeRenderableInk::AverageHitColour) 00688 Pix = actualRegion->GetAveragePixel32BPP(); 00689 else 00690 Pix = actualRegion->GetCentrePixel32BPP(); 00691 } 00692 00693 pRegion->StartRender(); 00694 pRegion = pDocView->GetNextOnTop(&drClickRect); 00695 } 00696 00697 pDocView->SetForceDefaultColourContexts(bOldForce); 00698 return pHitNode; 00699 }
|
|
We may have a stroke attribute applied to us that does not do anything under certain circumstances (zero line width, no accompanying variable width attribute).
Definition at line 1685 of file hittest.cpp. 01686 { 01687 // first up, if we have no stroke colour then any strokes we have aren't really active 01688 AttrStrokeColour* pStrokeColour = NULL; 01689 01690 FindAppliedAttribute(CC_RUNTIME_CLASS(AttrStrokeColour), (NodeAttribute**)&pStrokeColour); 01691 01692 if (pStrokeColour != NULL) 01693 { 01694 // get the stroke colour 01695 StrokeColourAttribute* pVal = (StrokeColourAttribute*)pStrokeColour->GetAttributeValue(); 01696 if (pVal != NULL) 01697 if (pVal->Colour.IsTransparent()) 01698 return NULL; 01699 } 01700 else 01701 return NULL; 01702 01703 // now find out if we have both a stroke and variable width attribute 01704 AttrStrokeType* pStroke = NULL; 01705 AttrVariableWidth* pVarWidth = NULL; 01706 FindAppliedAttribute(CC_RUNTIME_CLASS(AttrStrokeType), (NodeAttribute**)&pStroke); 01707 FindAppliedAttribute(CC_RUNTIME_CLASS(AttrVariableWidth), (NodeAttribute**)&pVarWidth); 01708 01709 if (pVarWidth != NULL && ((VariableWidthAttrValue*)pVarWidth->GetAttributeValue())->GetWidthFunction() != NULL) 01710 { 01711 if (pStroke != NULL && pStroke->HasPathProcessor()) 01712 return pStroke; 01713 } 01714 return NULL; 01715 01716 }
|
|
as above
Definition at line 1649 of file hittest.cpp. 01650 { 01651 AttrBrushType* pAttr = 0; 01652 01653 FindAppliedAttribute(CC_RUNTIME_CLASS(AttrBrushType), (NodeAttribute**)&pAttr); 01654 01655 if (pAttr == NULL) 01656 return NULL; 01657 01658 BrushHandle Handle = pAttr->GetBrushHandle(); 01659 01660 if (Handle == BrushHandle_NoBrush) 01661 return NULL; 01662 01663 // double check to make sure it isn't referring to a deleted brush 01664 BrushDefinition* pDef = BrushComponent::FindBrushDefinition(Handle); 01665 if (pDef == NULL) 01666 return NULL; 01667 01668 return pAttr; 01669 }
|
|
Reimplemented in NodePath. Definition at line 258 of file ink.h. 00258 {return FALSE;}
|
|
Scans the child attribute block of the node for an attribute with type ReqdAttrib.
Definition at line 4192 of file noderend.cpp. 04193 { 04194 /* Node* Current = FindFirstChild(); 04195 while (Current != NULL) 04196 { 04197 if (Current->IsAnAttribute()) 04198 { 04199 if (((NodeAttribute*)Current)->GetAttributeType() == ReqdAttrib) 04200 { 04201 return ((NodeAttribute*)Current); 04202 } 04203 } 04204 else 04205 { 04206 if (Current->IsAnObject()) // Check for end of attribute block 04207 { 04208 return NULL; 04209 } 04210 } 04211 Current = Current->FindNext(); 04212 } 04213 return NULL; // Not found 04214 */ 04215 // It's important to do this scan in reverse render order so that closer scoped 04216 // attributes are found first. This helps report effect attributes correctly 04217 Node* Current = FindLastChild(); 04218 while (Current != NULL) 04219 { 04220 if (Current->IsAnAttribute()) 04221 { 04222 if (((NodeAttribute*)Current)->GetAttributeType() == ReqdAttrib) 04223 { 04224 NodeAttribute* pAttr = (NodeAttribute*)Current; 04225 if (pAttr->IsEffectAttribute() == IsValidEffectAttr(pAttr)) 04226 return pAttr; 04227 } 04228 } 04229 Current = Current->FindPrevious(); 04230 } 04231 return NULL; // Not found 04232 04233 }
|
|
Every Ink object has an associated current attribute group, If an attribute is applied to the object, and it needs to become current then the attribute group specified will get updated.
Reimplemented in BaseTextClass. Definition at line 4168 of file noderend.cpp. 04169 { 04170 return (CC_RUNTIME_CLASS(NodeRenderableInk)); 04171 }
|
|
Reimplemented in NodeBitmap, and NodeBitmapEffect. Definition at line 261 of file ink.h. 00261 {return FALSE;}
|
|
Before applying an attribute to an object this function should be called to return the actual object the attribute should be applied to.
However if in future we meet a situation where things need to be done differently then this function can be overloaded.
Definition at line 4099 of file noderend.cpp. 04100 { 04101 Node* pParent; 04102 NodeRenderableInk* pCurrentObject = this; 04103 do 04104 { 04105 if (pCurrentObject->CanAttrBeAppliedToMe(AttrType)) 04106 { 04107 // if applying line level attr, force it to be the first line of the paragraph 04108 if (IS_A(pCurrentObject,TextLine) && TextLine::IsAttrTypeLineLevel(AttrType)) 04109 pCurrentObject = ((TextLine*)pCurrentObject)->FindFirstLineOfParagraph(); 04110 break; 04111 } 04112 04113 // ok try the parent then 04114 pParent = pCurrentObject->FindParent(); 04115 if (pParent && (pParent->IsAnObject())) 04116 { 04117 pCurrentObject = (NodeRenderableInk*)pParent; 04118 } 04119 else 04120 { 04121 pCurrentObject = NULL; // No more to try 04122 } 04123 } while (pCurrentObject); 04124 04125 04126 return pCurrentObject; 04127 }
|
|
Reimplemented in NodePath, and NodeRegularShape. Definition at line 1743 of file hittest.cpp. 01744 { 01745 return NULL; 01746 }
|
|
Called by the selector tool if either a previous OnMouseMove or OnClick member function call returns TRUE, indicating that the node has some feedback to display when the mous is at the previously passed point.
Definition at line 233 of file hittest.cpp. 00234 { 00235 #ifdef _DEBUG 00236 // if (IsUserName("JustinF")) 00237 // { 00238 // TRACE( _T("Call to base class NodeRenderableInk::GetStatusInfo for a %s\n"), (LPCTSTR) Name()); 00239 // } 00240 #endif 00241 return FALSE; 00242 }
|
|
If we have a variable width stroke applied to us then this will get the path generated by that stroke. This base class version returns NULL, overridden versions must supply their own outline path.
Reimplemented in NodePath, and NodeRegularShape. Definition at line 1736 of file hittest.cpp. 01737 { 01738 return NULL; 01739 }
|
|
This function returns TRUE if the set of Object's child attribute types are a subset of this objects child attribute types.
Definition at line 4246 of file noderend.cpp. 04247 { 04248 AttrTypeSet OurAttrs; 04249 AttrTypeSet ObjectsAttrs; 04250 04251 if (!AddChildAttrTypesToSet(&OurAttrs)) 04252 return FALSE; 04253 04254 if (!(Object->AddChildAttrTypesToSet(&ObjectsAttrs))) 04255 return FALSE; 04256 04257 AttrTypeItem* pObjectsAttr = (AttrTypeItem*)ObjectsAttrs.GetHead(); 04258 04259 CCRuntimeClass* AttrType; 04260 while (pObjectsAttr) 04261 { 04262 AttrType = pObjectsAttr->AttributeType; 04263 if (!(OurAttrs.InSet(AttrType))) 04264 return FALSE; // sets are different 04265 pObjectsAttr = (AttrTypeItem*) ObjectsAttrs.GetNext(pObjectsAttr); 04266 } 04267 04268 return TRUE; 04269 }
|
|
Private helper function for Node::FindNextHitTest. This function decides whether FindNextHitTest should go down a child link, which it should if (i) there is a child link; AND (ii) this node isn't a locked or invisible layer if such things should be excluded; (iii) if this node has a bounding rectangle it intersects the click rectangle.
Definition at line 1249 of file hittest.cpp. 01250 { 01251 // If there's no child link to follow the decision is easy . . . 01252 if (pNode->FindFirstChild() == 0) return FALSE; 01253 01254 // If the node is a locked or invisible layer and the caller wants such things 01255 // ignored then don't follow link down . . . 01256 if (bExcludeLayers && pNode->IsLayer()) 01257 { 01258 Layer* pLayer = (Layer*) pNode; 01259 if (pLayer->IsLocked() || !pLayer->IsVisible()) return FALSE; 01260 } 01261 01262 // If this node has a bounding rectangle then don't go down the link if the given 01263 // mouse-click rectangle doesn't intersect with the bounds . . . 01264 if (pNode->IsBounded()) 01265 { 01266 DocRect drBounds = ((NodeRenderableBounded*) pNode)->GetBoundingRect(); 01267 if (!drBounds.IsIntersectedWith(drClickRect)) return FALSE; 01268 } 01269 01270 // If we pass all the above tests then by all means go down the child link. 01271 return TRUE; 01272 }
|
|
Reads preferences for NodeRenderableInk.
Reimplemented from NodeRenderableBounded. Reimplemented in NodeBitmapEffect, VisibleTextNode, AbstractTextChar, TextLine, BaseTextClass, and TextStory. Definition at line 2195 of file noderend.cpp. 02196 { 02197 #if !defined(EXCLUDE_FROM_RALPH) 02198 BOOL bOK = TRUE; 02199 bOK = bOK && Camelot.DeclareSection(TEXT("DebugFlags"), 10) 02200 && Camelot.DeclarePref(TEXT("DebugFlags"), TEXT("SmartClicks"), &bUseSmartClicks, FALSE, TRUE) 02201 && Camelot.DeclareSection(TEXT("Rendering"), 10) 02202 && Camelot.DeclarePref(TEXT("Rendering"), TEXT("EyeDropperAverage"), &AverageHitColour, FALSE, TRUE); 02203 02204 return bOK; 02205 #else 02206 return TRUE; 02207 #endif 02208 }
|
|
For determining quickly if the node is an object.
Reimplemented from Node. Definition at line 2305 of file noderend.cpp. 02306 { 02307 return TRUE; // Cos it is 02308 }
|
|
Reimplemented from Node. Definition at line 158 of file ink.h. 00158 {return TRUE;}
|
|
Determines whether this node is see through or not. See through in this case does not necessarily mean transparent - eg we could be a no-colour-fill rectangle. This test is useful if you're going to render into a bitmap, which will then be post-processed and plonked on the document (eg Feathering). This way, you can hopefully avoid any performance hit from unnecessary rendering into an alpha-channel bitmap.
Reimplemented from NodeRenderable. Definition at line 4634 of file noderend.cpp. 04635 { 04636 // we do the searches in this order: 04637 // 04638 // 1. any attrs applied to us (not recursive). 04639 // 2. ask any non-attribute children if they are see-through (recursive). 04640 // 04641 // we finish the search as soon as we get a positive result. 04642 04643 BOOL bIsSeeThrough = FALSE; 04644 04645 // 1. Check our indirectly-applied attributes. 04646 if (CheckIndirectAttrs) 04647 { 04648 CCAttrMap* pAttrMap = CCAttrMap::MakeAppliedAttrMap(this); 04649 if (pAttrMap != NULL) 04650 { 04651 bIsSeeThrough = pAttrMap->IsSeeThrough(); 04652 delete pAttrMap; 04653 } 04654 } 04655 04656 // 2. Check all our NodeRenderable children. 04657 // Note that if we've checked indirect attrs, 04658 // then we needn't bother re-testing any attributes. 04659 for (Node* pKid = FindFirstChild(); 04660 pKid != NULL && !bIsSeeThrough; 04661 pKid = pKid->FindNext() ) 04662 { 04663 if (pKid->IsNodeRenderableClass()) 04664 { 04665 if (CheckIndirectAttrs && pKid->IsAnAttribute()) 04666 { 04667 // do nothing. 04668 } 04669 else 04670 { 04671 bIsSeeThrough = ((NodeRenderable*)pKid)->IsSeeThrough(FALSE); 04672 } 04673 } 04674 } 04675 04676 return bIsSeeThrough; 04677 }
|
|
Indicates that NodeRenderableInks are candidates for membership of Attribute gallery set.
Reimplemented from Node. Reimplemented in TextChar, TextLine, BaseTextClass, and TextStory. Definition at line 2322 of file noderend.cpp. 02323 { 02324 return TRUE; 02325 }
|
|
Reimplemented in NodeGroup, NodeMouldGroup, NodeBrush, NodeMoulder, NodeMould, and NodeEffect. Definition at line 319 of file ink.h. 00319 {return FALSE;}
|
|
This function copies all attributes common to the compound to each child object within the compound which requires each attribute.
pAffectedAttrTypes: An optional set of attribute types. If this is specified then we only consider localising those attributes which have a type which is in this set. RecursiveDownwards: Passed on to the attribute helper, means that if we have a child who is also compound then we will also localise their attributes. Defaults to FALSE.
Scope: private
Definition at line 918 of file ndoptmz.cpp. 00922 { 00923 // Do we need to globally optimise ? 00924 if (Global) 00925 { 00926 Node* pParent = FindParent(); 00927 if (pParent && (pParent->IsCompound())) 00928 { 00929 // We need to localise the parent's attributes first (Recursive bit) 00930 if (!(((NodeRenderableInk*)pParent)->LocaliseCommonAttrHelper(CheckForDuplicates, TRUE, pAffectedAttrTypes))) 00931 { 00932 return FALSE; // Failed 00933 } 00934 } 00935 } 00936 00937 // add all necessary attrs to each child object in the group 00938 for (Node* Current=FindFirstChild(); Current!=NULL; Current=Current->FindNext()) 00939 { 00940 if (RecursiveForChildren && Current->IsCompound()) 00941 ((NodeRenderableInk*)Current)->LocaliseCommonAttributes(FALSE, FALSE, NULL, TRUE); 00942 00943 if (Current->IsAnObject()) 00944 { 00945 NodeRenderableInk* pObject = (NodeRenderableInk*)Current; 00946 BOOL ChkForDups = CheckForDuplicates; 00947 Node* pRoot = RecursiveForChildren ? NULL : this; 00948 if(!pObject->MakeAttributeComplete(pRoot,ChkForDups,pAffectedAttrTypes)) 00949 return FALSE; // out of memory 00950 } 00951 } 00952 00953 return TRUE; 00954 }
|
|
This function is the opposite of the FactorOutCommonChildAttributes function it copies all attributes common to the compound to each child object within the compound which requires each attribute. The groups common attributes are deleted.
pAffectedAttrTypes: An optional set of attribute types. If this is specified then we only consider localising those attributes which have a type which is in this set. RecursiveForChildren: Passed onto the helper function, means that if we have children who are compound then they will have LocaliseCommonAttrs called on them also
Definition at line 847 of file ndoptmz.cpp. 00851 { 00852 // This function should only ever get called on a compound object 00853 ENSURE(IsCompound(), "LocaliseCommonAttributes called on a non compound object"); 00854 00855 // First of all let's try and localise the attributes. This is the bit that can fail 00856 if (!LocaliseCommonAttrHelper(CheckForDuplicates, Global, pAffectedAttrTypes, RecursiveForChildren)) 00857 { 00858 // We ran out of memory so we must, delete all attributes which were localised 00859 DeleteFactoredOutAttribs(Global, pAffectedAttrTypes); 00860 return FALSE; 00861 } 00862 else 00863 { 00864 // We managed to localise all the attributes so it is now safe to delete 00865 // them from the compounds. 00866 DeleteLocalisedAttributes(Global, pAffectedAttrTypes); 00867 return TRUE; 00868 } 00869 }
|
|
This function should be called on a subtree prior to it being moved, either to a new position in the document, or to another document. It is also used to localise attributes; during an ungroup for example.
After the subtree has been moved to its new position, the function NodeRenderableInk::NormaliseAttributes should be called.
Definition at line 183 of file ndoptmz.cpp. 00188 { 00189 Node* Current = NULL; // Pointer to the current node in the tree 00190 00191 NodeAttribute* CurAttr; 00192 CCRuntimeClass* AttrType; 00193 BOOL Exists; 00194 00195 Node* PreFirstChild = FindFirstChild(); // Remember the FirstChild of the node before we add 00196 // any new attributes, this will come in handy if we 00197 // need to abort. 00198 00199 // Loop until all attributes are copied, we are not interested in the defaults cos these are the 00200 // same for all docs !. 00201 if (bIncludeEffectAttrs) 00202 Current = NodeAttribute::FindFirstAppliedAttr(this, Root); 00203 else 00204 Current = NodeAttribute::FindPrevAppliedAttr(this, Root); 00205 00206 while (Current && (IncludeDefaults || (!(IS_A(Current->FindParent(), NodeDocument)))) ) 00207 { 00208 // Find the next node, snaking up the tree 00209 if (Current->IsAnAttribute()) 00210 { 00211 CurAttr = (NodeAttribute*)Current; 00212 if (CurAttr->CanBeAppliedToObject() && CurAttr->ShouldBeOptimized()) 00213 { 00214 AttrType = CurAttr->GetAttributeType(); 00215 00216 BOOL Required = RequiresAttrib(AttrType) || this->IsCompound(); 00217 // Is the attribute required ? 00218 if (Required && (!pAffectedAttrTypes || pAffectedAttrTypes->InSet(AttrType))) 00219 { 00220 Exists = FALSE; 00221 if (CheckForDuplicates) 00222 { 00223 // triggers can have duplicates 00224 if(!CurAttr->CanBeMultiplyApplied()) 00225 { 00226 // Does the node already have this child attribute 00227 Exists = (GetChildAttrOfType(AttrType) != NULL); 00228 } 00229 } 00230 00231 #ifdef _DEBUG 00232 if (!CheckForDuplicates) 00233 { 00234 // If we feel there is no need to check for duplicates then there shouldn't be any ! 00235 if (!CurAttr->CanBeMultiplyApplied()) 00236 { 00237 NodeAttribute* pChildAttr = GetChildAttrOfType(AttrType); 00238 if ((pChildAttr != NULL)) 00239 { 00240 #if DEBUG_TREE 00241 DebugTreeDlg::DumpSubTree(this, 4); 00242 #endif 00243 TRACE(_T("Duplicate Attr found at %x %s\n"), pChildAttr, pChildAttr->GetRuntimeClass()->m_lpszClassName); 00244 } 00245 // ERROR3IF((pChildAttr != NULL), "MakeAttributeComplete: Duplicate attr found !"); 00246 } 00247 } 00248 #endif 00249 00250 if (!Exists) 00251 { 00252 // Make a copy of the attribute 00253 NodeAttribute* NewAttr = (NodeAttribute*)CurAttr->SimpleCopy(); 00254 00255 if (NewAttr == NULL) 00256 { 00257 goto OutOfMemory; 00258 } 00259 00260 // Now add the attribute to this node 00261 NewAttr->AttachNode(this, FIRSTCHILD, TRUE, FALSE); 00262 } 00263 } 00264 } 00265 } 00266 Current = NodeAttribute::FindPrevAppliedAttr(Current, Root); 00267 00268 // in order to copy brush ink nodes we need to break if the parent is NULL, else is violates 00269 if (Current!=NULL && Current->FindParent() == NULL) 00270 break; 00271 } 00272 00273 return TRUE; 00274 00275 OutOfMemory: 00276 00277 // Delete any new attributes added to the node 00278 Current = FindFirstChild(); 00279 Node* Next; 00280 00281 while (Current != PreFirstChild) 00282 { 00283 ENSURE(Current != NULL, "PreFirstChild could not be found"); 00284 ENSURE(Current->IsAnAttribute(), "Should be a NodeAttribute"); 00285 00286 Next = Current->FindNext(); 00287 // Delete the attribute 00288 Current->CascadeDelete(); 00289 delete Current; 00290 00291 Current = Next; 00292 } 00293 00294 return FALSE; 00295 }
|
|
This function should be called whenever an attribute-complete node is inserted into the tree (whether it's a new node, or a node which has been moved from elsewhere).
Definition at line 318 of file ndoptmz.cpp. 00319 { 00320 00321 NodeAttribute* ChildAttribute; 00322 NodeAttribute* GlobalAttribute; 00323 00324 Node* LocalScan; 00325 Node* NextLocal; 00326 00327 // Scan the child attribute block 00328 LocalScan = FindFirstChild(); 00329 // Stop if we hit an object or if there are no more children 00330 // NOTE: Stopping scanning when we find the first RendereblInk node prevents 00331 // Effect attributes being Normalised. THIS IS DELIBERATE! 00332 while((LocalScan != NULL) && (!LocalScan->IsAnObject())) 00333 { 00334 // Hand over hand (LocalScan may get deleted) 00335 NextLocal = LocalScan->FindNext(); 00336 if(LocalScan->IsAnAttribute() && ((NodeAttribute*)LocalScan)->ShouldBeOptimized()) // cos it could be a NodeHidden 00337 { 00338 ChildAttribute = (NodeAttribute*)LocalScan; 00339 // We now need to search up the tree to see if ChildAttribute is redundant 00340 // Node* GlobalScan = FindPreviousEffectiveNode(); 00341 Node* GlobalScan = NodeAttribute::FindPrevAppliedAttr(this); 00342 // Search until we can go no higher 00343 while (GlobalScan != NULL) 00344 { 00345 if (GlobalScan->IsAnAttribute()) 00346 { 00347 GlobalAttribute = (NodeAttribute*)GlobalScan; 00348 // An attribute has been found, is it the same class as ChildAttribute ? 00349 if(GlobalAttribute->GetRuntimeClass() == 00350 ChildAttribute->GetRuntimeClass()) 00351 { 00352 // Yes it is, so let's check if they are equal 00353 if ((*GlobalAttribute)==(*ChildAttribute)) 00354 { 00355 // They are equal so we can nuke the child object because it's 00356 // redundant 00357 ChildAttribute->CascadeDelete(); 00358 delete ChildAttribute; 00359 } 00360 break; // don't search any further 00361 } 00362 00363 } 00364 // GlobalScan = GlobalScan->FindPreviousEffectiveNode(); // climb higher 00365 GlobalScan = NodeAttribute::FindPrevAppliedAttr(GlobalScan); 00366 } 00367 } 00368 LocalScan = NextLocal; // Get the next child 00369 } 00370 00371 }
|
|
Allows the Node to respond to popup menu clicks by adding items to the popup menu if required. It also allows the node to prevent the menu appearing at all! This functions should be overridden in the all the NodeRenderableInk classes so that this verion never gets called. Eg the NodePath class might claim the click if it happened over one of its blobs.
Reimplemented in NodePath. Definition at line 3362 of file noderend.cpp. 03366 { 03367 // we do not want to claim the click, so return FALSE 03368 return FALSE; 03369 }
|
|
Allows the Node to respond to clicks by selecting its blobs or starting drags etc.
Karim 07/04/2000 With the advent of ToolObject blobs, this method can now be called when Object blobs are not showing. What this means is that when this method is called, you should *check* that conditions are right for you to respond. eg if BlobManager's current interest does not include Object blobs, you may not want to do anything. Reimplemented in NodeGroup, NodeGuideline, NodeClipViewController, NodeMouldGroup, NodeBlender, NodeBlend, NodeBitmap, NodeMoulder, NodeMould, NodePath, NodeRegularShape, and NodeSimpleShape. Definition at line 3329 of file noderend.cpp. 03331 { 03332 // we do not want to claim the click, so return FALSE 03333 return FALSE; 03334 }
|
|
Called by the selector tool for the selected object(s) when the mouse is moved.
Definition at line 200 of file hittest.cpp. 00201 { 00202 #ifdef _DEBUG 00203 // if (IsUserName("JustinF")) 00204 // { 00205 // TRACE( _T("Call to base class NodeRenderableInk::OnMouseMove for a %s\n"), (LPCTSTR) Name()); 00206 // } 00207 #endif 00208 return FALSE; 00209 }
|
|
Allows the Node to respond to popup menu clicks by adding items to the popup menu if required. It also allows the node to prevent the menu appearing at all! This functions should be overridden in the all the NodeRenderableInk classes so that this verion never gets called. Eg the NodePath class might claim the click if it happened over one of its blobs.
Reimplemented in NodeGuideline, NodeBevel, NodeBlend, NodeBitmap, NodeContour, NodeMould, NodePath, NodeRegularShape, VisibleTextNode, and TextStory. Definition at line 3397 of file noderend.cpp. 03401 { 03402 // we do not want to claim the click, so return FALSE 03403 return FALSE; 03404 }
|
|
Reimplemented from Node. Definition at line 4565 of file noderend.cpp. 04566 { 04567 return ReadPostChildrenWeb(pFilter); 04568 }
|
|
This function is called during the importing of the file. > virtual BOOL Node::ReadPostChildrenWeb(BaseCamelotFilter* pFilter)
Reimplemented from Node. Definition at line 4559 of file noderend.cpp. 04560 { 04561 SafeToRender = NodeRenderableBounded::ReadPostChildrenWeb(pFilter); 04562 return SafeToRender; 04563 }
|
|
Invalidates the Bounding rectangle of the node, causing it to be redrawn.
Definition at line 3860 of file noderend.cpp. 03861 { 03862 // Find this nodes parent spread 03863 Spread* pSpread = FindParentSpread(); 03864 03865 // Find the owner document (could do it on this node, but leaping to spread 03866 // directly is slighlt quicker). 03867 BaseDocument *pDoc = pSpread->FindOwnerDoc(); 03868 03869 if ((pSpread != NULL) && (pDoc != NULL)) 03870 { 03871 // Invalidate region (if we're in a real document) 03872 if (IS_A(pDoc, Document)) 03873 ((Document *) pDoc)->ForceRedraw(pSpread, GetBoundingRect(), FALSE, this); 03874 else 03875 // Not in a real document - ought to complain. 03876 // (If this ERROR3 proves to be a problem then could be removed - Tim) 03877 ERROR3("Trying to redraw an object that is in a BaseDocument!"); 03878 } 03879 }
|
|
|
|
Searches for all the attributes which apply to "this" ink-node, rendering them into the given render-region. Private helper function for NodeRenderableInk::FindSimpleAtPoint.
Definition at line 1317 of file hittest.cpp. 01318 { 01319 // If we are missing some attributes then search until we find all of them. 01320 FindAppliedAttributes(pAttribMap, nMaxAttributes, &nFoundAttributes); 01321 01322 // Make sure our dummy flat fill, that will be used in the 01323 // place of any 'fancy' fills, is set up. 01324 *(DummyFill.GetStartColour()) = DocColour(COLOUR_BLACK); 01325 01326 // OK, we have found the full quota of attributes. Now render them all. 01327 CCAttrMap::iterator pos = pAttribMap->GetStartPosition(); 01328 while( pos != pAttribMap->GetEndPosition() ) 01329 { 01330 CCRuntimeClass* pKey; 01331 void* pVal; 01332 pAttribMap->GetNextAssoc(pos, pKey, pVal); 01333 01334 // Get the 'Family' of Attributes the fill belongs to 01335 CCRuntimeClass* AttrFamily = ((NodeAttribute*) pVal)->GetAttributeType(); 01336 // Get the actual fill type 01337 CCRuntimeClass* AttrClass = ((NodeAttribute*) pVal)->GetRuntimeClass(); 01338 01339 // Check for a Transparency fill. 01340 // We can ignore them, as they do not effect hit testing. 01341 if ( AttrFamily != CC_RUNTIME_CLASS(AttrTranspFillGeometry) ) 01342 { 01343 // Is this a fancy fill type ? 01344 if ( AttrFamily == CC_RUNTIME_CLASS(AttrFillGeometry) && 01345 AttrClass != CC_RUNTIME_CLASS(AttrFlatColourFill) ) 01346 { 01347 if (AttrClass == CC_RUNTIME_CLASS(AttrBitmapColourFill) && 01348 ((NodeAttribute*) pVal)->NeedsTransparency()) 01349 { 01350 // It must be a masked bitmap, so we'll need to render it. 01351 // The render code will check the 'VeryMono' flag, and render 01352 // the bitmap non-masked pixels as black 01353 ((NodeAttribute*) pVal)->Render(pRegion); 01354 } 01355 else 01356 { 01357 // Yes, so just render a black flat fill 01358 DummyFill.Render(pRegion); 01359 } 01360 } 01361 else 01362 { 01363 // It's only a flat fill, so we might as well render it. 01364 // This will allow 'no colour' fills to work too. 01365 ((NodeAttribute*) pVal)->Render(pRegion); 01366 } 01367 } 01368 } 01369 }
|
|
Helper method for RenderAppliedAttributes().
Notes: This is a bit of a BODGE, but is required because ClipRegionAttributes are not stored in the tree inside a NodeAttribute, and are therefore not picked up on by the normal RenderAppliedAttributes() process. See also: RenderAppliedAttributes(). Definition at line 1400 of file hittest.cpp. 01401 { 01402 // 1. pRefNode starts on this node. We look for a NCVC which clips pRefNode, add it to 01403 // our list, and then that NCVC becomes the new pRefNode to work from. 01404 // 01405 // 2. To find a NCVC which clips us, we go straight up the tree. If we find a NCVC, 01406 // then we check whether its child which we came from is also one of its keyhole 01407 // nodes. If so, we ignore it and continue. If not, then it must clip us, and 01408 // therefore the NCVC becomes the new pRefNode. 01409 // 01410 // 3. We repeat the process until we hit a layer node, which marks the top of this 01411 // branch of the tree. 01412 // 01413 Node* pRefNode = (Node*) this; 01414 std::list<NodeClipViewController*> lNCVC; 01415 BOOL bFinished = FALSE; 01416 while (!bFinished) 01417 { 01418 // go up the tree until we reach the top or we reach a NCVC 01419 // for which we are not a keyhole node. 01420 Node* pChild = pRefNode; 01421 Node* pParent = pRefNode->FindParent(); 01422 BOOL bFoundApplicableNCVC = pParent->IsANodeClipViewController() && 01423 !((NodeClipViewController*)pParent)->OwnsAsKeyholeNode(pChild); 01424 01425 while (pParent != NULL && !pParent->IsLayer() && !bFoundApplicableNCVC) 01426 { 01427 pChild = pParent; 01428 pParent = pParent->FindParent(); 01429 bFoundApplicableNCVC = pParent->IsANodeClipViewController() && 01430 !((NodeClipViewController*)pParent)->OwnsAsKeyholeNode(pChild); 01431 } 01432 01433 if (bFoundApplicableNCVC) 01434 { 01435 lNCVC.push_front((NodeClipViewController*) pParent); 01436 pRefNode = pParent; 01437 } 01438 else 01439 { 01440 bFinished = TRUE; 01441 } 01442 } 01443 01444 // ok, now go through the list in reverse order, telling the NCV belonging to each NCVC 01445 // to render is ClipRegionAttribute. 01446 NodeClipView* pClipView = 0; 01447 NodeClipViewController* pNCVC = 0; 01448 while (!lNCVC.empty()) 01449 { 01450 pNCVC = lNCVC.back(); 01451 lNCVC.pop_back(); 01452 pClipView = pNCVC->GetClipView(); 01453 if (pClipView != 0) 01454 { 01455 // DEBUG: 01456 // TRACEUSER( "Karim", _T("NRInk::RenderAppliedClipAttrs; NCVC: 0x%x\n"), (DWORD)pNCVC); 01457 pClipView->RenderClipAttr(pRender); 01458 } 01459 } 01460 // DEBUG: 01461 // TRACEUSER( "Karim", _T("NRInk::RenderAppliedClipAttrs; this: 0x%x; %s\n"), 01462 // (DWORD)this, this->Name()); 01463 }
|
|
Draws the Fill blobs of an ink object. It does this by calling all the attributes that are its immediate children and asking them to render their Fill Blobs. If any of them happen to be items such as Graduated fills, then blobs will appear.
Reimplemented from NodeRenderable. Definition at line 3141 of file noderend.cpp. 03142 { 03143 #if !defined(EXCLUDE_FROM_RALPH) 03144 CCAttrMap* pAttribMap = new CCAttrMap(30); 03145 if (pAttribMap == NULL) 03146 return; 03147 03148 // Find the topmost effect applied to this node 03149 // So that we can test whether it has preferential effect attributes 03150 Node* pEffectNode = FindParent(); 03151 NodeEffect* pTopEffectNode = NULL; 03152 while (pEffectNode && pEffectNode->IsEffect()) 03153 { 03154 // BODGE! we happen to know that shadow controllers can't have effect attrs applied to them 03155 // Would be better of there were some nice way to ask effect nodes about this. 03156 if (!pEffectNode->IsAShadowController()) 03157 pTopEffectNode = (NodeEffect*)pEffectNode; 03158 pEffectNode = pEffectNode->FindParent(); 03159 } 03160 03161 // Now find any attributes that are applied to this node. 03162 BOOL FoundAttrs = FindAppliedAttributes(pAttribMap, 5000, NULL, FALSE); 03163 03164 if (FoundAttrs) 03165 { 03166 // iterating all (key, value) pairs 03167 for (CCAttrMap::iterator Pos = pAttribMap->GetStartPosition(); Pos != pAttribMap->GetEndPosition();) 03168 { 03169 CCRuntimeClass *pType; 03170 void *pVal; 03171 pAttribMap->GetNextAssoc(Pos,pType,pVal); 03172 NodeAttribute* pAttr = (NodeAttribute*)pVal; 03173 03174 // Only render fill blobs for the applied attribute if it can't 03175 // be overridden by a preferential effect attribute above... 03176 if (pTopEffectNode==NULL || (pTopEffectNode!=NULL && !pTopEffectNode->IsValidEffectAttr(pAttr))) 03177 pAttr->RenderFillBlobs(pRender); 03178 } 03179 } 03180 03181 delete pAttribMap; 03182 #endif 03183 }
|
|
Draws the Artistic blobs of an ink object. It does this by calling all the attributes that are its immediate children and asking them to render their Artistic Blobs. If any of them happen to be items such as Pressure attributes or some other artistic effect then blobs will appear.
Reimplemented from NodeRenderable. Definition at line 3247 of file noderend.cpp. 03248 { 03249 #if !defined(EXCLUDE_FROM_RALPH) 03250 CCAttrMap* pAttribMap = new CCAttrMap(30); 03251 if (pAttribMap == NULL) 03252 return; 03253 03254 // Now find any attributes that are applied to this node. 03255 BOOL FoundAttrs = FindAppliedAttributes(pAttribMap); 03256 03257 if (FoundAttrs) 03258 { 03259 // iterating all (key, value) pairs 03260 for (CCAttrMap::iterator Pos = pAttribMap->GetStartPosition(); Pos != pAttribMap->GetEndPosition();) 03261 { 03262 CCRuntimeClass *pType; 03263 void *pVal; 03264 pAttribMap->GetNextAssoc(Pos,pType,pVal); 03265 03266 NodeAttribute* pAttr = (NodeAttribute*)pVal; 03267 pAttr->RenderArtisticBlobs(pRender); 03268 } 03269 } 03270 03271 delete pAttribMap; 03272 #endif 03273 }
|
|
Reimplemented in NodeBitmapEffect. Definition at line 262 of file ink.h. 00262 {return FALSE;}
|
|
Draws the Effect blobs of an ink object. It does this by calling all the attributes that are its immediate children and asking them to render their Fill Blobs. If any of them happen to be items such as Graduated fills, then blobs will appear.
Reimplemented from NodeRenderable. Definition at line 3200 of file noderend.cpp. 03201 { 03202 #if !defined(EXCLUDE_FROM_RALPH) 03203 Node* pEffectNode = FindParent(); 03204 Node* pTopEffectNode = NULL; 03205 03206 while (pEffectNode && pEffectNode->IsEffect()) 03207 { 03208 // BODGE! we happen to know that shadow controllers can't have effect attrs applied to them 03209 // Would be better of there were some nice way to ask effect nodes about this. 03210 if (!pEffectNode->IsAShadowController()) 03211 pTopEffectNode = pEffectNode; 03212 pEffectNode = pEffectNode->FindParent(); 03213 } 03214 03215 if (pTopEffectNode && pTopEffectNode->IsBounded()) 03216 { 03217 if (pTopEffectNode!=this) 03218 ((NodeRenderableBounded*)pTopEffectNode)->RenderEffectBlobs(pRender); 03219 03220 // Allow any effect attributes to render their blobs... 03221 NodeAttribute* pAttr = (NodeAttribute*)pTopEffectNode->FindLastChild(CC_RUNTIME_CLASS(NodeAttribute)); 03222 while (pAttr && pAttr->IsEffectAttribute()) 03223 { 03224 pAttr->RenderFillBlobs(pRender); 03225 03226 pAttr = (NodeAttribute*)pAttr->FindPrevious(CC_RUNTIME_CLASS(NodeAttribute)); 03227 } 03228 } 03229 #endif 03230 }
|
|
Each class derived from NodeRenderableInk should write a version of this member function. In most cases it will be the same as the Render() member function but some of the nodes (such as groups) need to perform special actions. The function is for drawing the object while it is being dragged about by the selector tool. It should do this with an effective wysiwyg level of 0 so that the drawing is fast.
Reimplemented in NodeContourController, NodeBlendPath, NodeBrushMaker, NodeBrushPath, NodeClipViewController, NodeMouldGroup, NodeMouldPath, NodeBevel, NodeBlender, NodeClipView, NodeContour, NodePath, NodeRegularShape, NodeSimpleShape, and TextChar. Definition at line 3052 of file noderend.cpp. 03053 { 03054 // This function does nothing. It is a virtual function and should be replaced by 03055 // derived class versions of it 03056 }
|
|
Recursively calls RenderEorDrag for all children of this node, ignoring nodes which have ChildrenAreEorDragRenderedByMe() returning TRUE.
Reimplemented in NodeMouldGroup. Definition at line 3073 of file noderend.cpp. 03074 { 03075 Node * pNode = FindFirstChild(); 03076 03077 while (pNode) 03078 { 03079 if (pNode->IsAnObject()) 03080 { 03081 if (pNode->IsCompound()) 03082 { 03083 if (((NodeRenderableInk *)pNode)->ChildrenAreEorDragRenderedByMe()) 03084 { 03085 // just render this node 03086 ((NodeRenderableInk *)pNode)->RenderEorDrag(pRender); 03087 } 03088 else 03089 { 03090 ((NodeRenderableInk *)pNode)->RenderEorDragChildren(pRender); 03091 ((NodeRenderableInk *)pNode)->RenderEorDrag(pRender); 03092 } 03093 } 03094 else 03095 { 03096 ((NodeRenderableInk *)pNode)->RenderEorDrag(pRender); 03097 } 03098 } 03099 03100 pNode = pNode->FindNext(); 03101 } 03102 }
|
|
To determine if the node requires the pAttr to render itself.
Reimplemented in NodeBevel, NodeBitmap, and NodeClipView. Definition at line 4147 of file noderend.cpp. 04149 { 04150 CCRuntimeClass* AttribType = pAttr->GetAttributeType(); 04151 // Call fn which takes type 04152 return RequiresAttrib(AttribType, Search); 04153 }
|
|
To determine if the node requires attribute AttribType to render itself.
Reimplemented in NodeBevel, and NodeClipView. Definition at line 3988 of file noderend.cpp. 03990 { 03991 List* ReqdAttribList; 03992 03993 if (!IsCompound()) 03994 { 03995 // Obtain the list of required attributes for this node 03996 ReqdAttribList = ObjectRegistry::GetRequiredAttribs(GetRuntimeClass()); 03997 //Is AttribClass in the list ? 03998 NodeAttributeClassItem* AttrClassItem = (NodeAttributeClassItem*)(ReqdAttribList->GetHead()); 03999 04000 while (AttrClassItem != NULL) 04001 { 04002 if (AttrClassItem->AttributeClass == AttribType) 04003 { 04004 return TRUE; 04005 } 04006 AttrClassItem = (NodeAttributeClassItem*)(ReqdAttribList->GetNext(AttrClassItem)); 04007 } 04008 } 04009 else 04010 { 04011 if (Search) 04012 { 04013 // Ask the kids if they require the attribute (they will ask their kids etc.) 04014 Node* pChild = FindFirstChild(); 04015 NodeRenderableInk* pChildObject; 04016 while (pChild) 04017 { 04018 if (pChild->IsAnObject()) 04019 { 04020 pChildObject = (NodeRenderableInk*)pChild; 04021 if (pChildObject->RequiresAttrib(AttribType, Search)) 04022 return TRUE; 04023 } 04024 pChild = pChild->FindNext(); 04025 } 04026 } 04027 else 04028 return TRUE; // Assume the compound requires the attribute 04029 } 04030 return FALSE; // Not found (!IsCompound || IsCompound && Search cases ) 04031 }
|
|
Selects all the objects that are wholly inside the supplied rectangle. It will draw in all the EORed blobs of the objects that it selects/deselects. rewritten by Simon so that objects on locked layers do not get selected also more optimal. (st parameter etc added by JCF 1.11.94).
Definition at line 3742 of file noderend.cpp. 03744 { 03745 // Make sure we are not being told garbage 03746 ERROR3IF(pSpread == NULL, "No spread in NodeRenderableInk::SelectAllInRect"); 03747 ERROR3IF(pSpread->FindFirstLayer() == NULL, "No layer in NodeRenderableInk::SelectAllInRect"); 03748 03749 03750 // Make all objects on modifiable layers within the given bounding box selected or 03751 // whatever. 03752 for (Layer* pLayer = pSpread->FindFirstLayer(); 03753 pLayer != NULL; 03754 pLayer = pLayer->FindNextLayer()) 03755 { 03756 if (!pLayer->IsLocked() && pLayer->IsVisible() && 03757 pLayer->GetBoundingRect().IsIntersectedWith(Rect)) 03758 { 03759 // The current layer is not locked so select all objects which intersect 03760 // with rect 03761 /* Range rng(pLayer->FindFirstChild(), NULL, RangeControl(TRUE, TRUE)); 03762 for (Node* pNode = rng.FindFirst(); 03763 pNode != NULL; 03764 pNode = rng.FindNext(pNode)) 03765 { 03766 // make sure it is a Renderable Ink Node 03767 if (pNode->IsAnObject()) 03768 { 03769 ((NodeRenderableInk*)pNode)->SelectInRect(Rect, st); 03770 } 03771 } 03772 */ 03773 Node* pNode = pLayer->FindFirstChild(); 03774 while (pNode) 03775 { 03776 // make sure it is a Renderable Ink Node 03777 if (pNode->IsAnObject()) 03778 { 03779 ((NodeRenderableInk*)pNode)->SelectInRect(Rect, st); 03780 } 03781 03782 pNode = pNode->FindNext(); 03783 } 03784 03785 } 03786 } 03787 03788 // Update the selection cache 03789 GetApplication()->UpdateSelection(); 03790 }
|
|
Helper method for the static fn SelectAllInRect() used by marquee select. This method changes the selection state of this node according to the given bounding rectangle and sel-state action. Most nodes will want to use the default behaviour, which is to select themselves if their bounds lie within the given bounding rectangle. If you want to do something special with the marquee select, then override this method.
Definition at line 3819 of file noderend.cpp. 03820 { 03821 // ok, check whether we lie within the given rect. 03822 if (Rect.ContainsRect(GetBoundingRect())) 03823 { 03824 switch (st) 03825 { 03826 case CLEAR: 03827 DeSelect(TRUE); 03828 break; 03829 03830 case SET: 03831 Select(TRUE); 03832 break; 03833 03834 case TOGGLE: 03835 if (IsSelected()) 03836 DeSelect(TRUE); 03837 else 03838 Select(TRUE); 03839 break; 03840 03841 default: 03842 ERROR3("NodeRenderableInk::SelectInRect; Unknown SelStateAction!\n"); 03843 break; 03844 } 03845 } 03846 }
|
|
Mark parent layer as edited. If an ink object as something done to it which changes its appearance then we need to mark the parent layer as edited. In this class we actually do the work as these are visible objects in the tree.
Reimplemented from Node. Definition at line 4589 of file noderend.cpp. 04590 { 04591 // New 31/7/97 Neville 04592 // Mark the parent layer as edited as something has changed on it 04593 Layer * pLayer = (Layer*) FindParent(CC_RUNTIME_CLASS(Layer)); 04594 if (pLayer) 04595 { 04596 // Note that this layer has been edited 04597 pLayer->SetEdited(TRUE); 04598 #ifdef _DEBUG 04599 // Tell the frame gallery to update its display of the frame 04600 BROADCAST_TO_ALL(LayerMsg(pLayer, LayerMsg::REDRAW_LAYER)); 04601 #endif 04602 } 04603 04604 return TRUE; 04605 }
|
|
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 NodeRenderableBounded. Reimplemented in NodeGroup, NodeGuideline, NodeContourController, NodeBlendPath, NodeBrushMaker, NodeBrushPath, NodeClipViewController, NodeMouldGroup, NodeMouldBitmap, NodeMouldPath, NodeAnimatingBitmap, NodeBevel, NodeBlender, NodeBlend, NodeBitmap, NodeBrush, NodeClipView, NodeContour, NodeEllipse, NodeLiveEffect, NodeLockedEffect, NodeFeatherEffect, NodeMoulder, NodeMould, NodePath, NodeEffect, NodeRect, NodeRegularShape, NodeSimpleShape, VisibleTextNode, AbstractTextChar, TextChar, KernCode, HorizontalTab, CaretNode, EOLNode, TextLine, BaseTextClass, and TextStory. Definition at line 3291 of file noderend.cpp. 03292 { 03293 NodeRenderableInk* NodeCopy; 03294 NodeCopy = new NodeRenderableInk(); 03295 if (NodeCopy) 03296 NodeRenderableBounded::CopyNodeContents(NodeCopy); 03297 return (NodeCopy); 03298 }
|
|
Determines if the down/up pair need to be written.
Reimplemented in NodeGroup, and NodeBitmapEffect. Definition at line 2453 of file noderend.cpp. 02454 { 02455 return(pFilter->GetBoundsWriteLevel() >= BWL_ALL); 02456 }
|
|
Begin to write out you child records, in the native format.
Reimplemented from Node. Reimplemented in NodeBlender, NodePath, TextLine, and TextStory. Definition at line 2386 of file noderend.cpp. 02387 { 02388 BOOL bNeedDown = FALSE; 02389 BOOL ok = TRUE; 02390 02391 Node* pChild = FindFirstChild(); 02392 if (pChild != NULL) 02393 { 02394 // The node is considered to have children ONLY if at least one child is not a hidden node. 02395 if (!pChild->IsNodeHidden() || (pChild->FindNextNonHidden() != NULL)) 02396 { 02397 bNeedDown = TRUE; 02398 } 02399 } 02400 02401 BOOL bBounds = WillWriteBounds(pFilter); 02402 if (bNeedDown || bBounds) 02403 { 02404 ok = pFilter->WriteZeroSizedRecord(TAG_DOWN); 02405 if (ok && bBounds) 02406 ok = WriteBoundsRecord(pFilter); 02407 } 02408 02409 return(ok); 02410 }
|
|
Begin to write out you child records, in the web format.
Reimplemented from Node. Reimplemented in NodeBlender, TextLine, and TextStory. Definition at line 2365 of file noderend.cpp. 02366 { 02367 return(WriteBeginChildRecordsNative(pFilter)); 02368 }
|
|
Write out a record containing the bounds of this object.
Reimplemented in NodeGroup, NodeBlender, and NodeBitmapEffect. Definition at line 2425 of file noderend.cpp. 02426 { 02427 BOOL ok = TRUE; 02428 // Write out the record 02429 DocRect Rect = GetBoundingRect(); 02430 02431 CamelotFileRecord Rec(pFilter, TAG_OBJECTBOUNDS, TAG_OBJECTBOUNDS_SIZE); 02432 ok = Rec.Init(); 02433 if (ok) ok = Rec.WriteCoord(Rect.lo); 02434 if (ok) ok = Rec.WriteCoord(Rect.hi); 02435 if (ok) ok = pFilter->Write(&Rec); 02436 02437 return(ok); 02438 }
|
|
Finished writing out you child records, in the native format.
Reimplemented from Node. Reimplemented in NodeBlender, NodePath, TextLine, and TextStory. Definition at line 2496 of file noderend.cpp. 02497 { 02498 BOOL bNeedUp = WillWriteBounds(pFilter); 02499 02500 Node* pChild = FindFirstChild(); 02501 if (pChild != NULL) 02502 { 02503 // The node is considered to have children ONLY if at least one child is not a hidden node. 02504 if (!pChild->IsNodeHidden() || (pChild->FindNextNonHidden() != NULL)) 02505 bNeedUp = TRUE; 02506 } 02507 02508 if (bNeedUp) 02509 return pFilter->WriteZeroSizedRecord(TAG_UP); 02510 02511 return TRUE; 02512 }
|
|
Finished writing out you child records, in the web format.
Reimplemented from Node. Reimplemented in NodeBlender, TextLine, and TextStory. Definition at line 2475 of file noderend.cpp. 02476 { 02477 return WriteEndChildRecordsNative(pFilter); 02478 }
|
|
If TRUE then click detection is done with rendering, else if FALSE it is done with rectangle intersection. Will be made obsolete once rendering methods are reliable. Defaults to TRUE. Preference: AverageHitColour Section: ?
|
|
If TRUE then click detection is done with rendering, else if FALSE it is done with rectangle intersection. Will be made obsolete once rendering methods are reliable. Defaults to TRUE. Preference: SmartClicks Section: DebugFlags
|
|
|
|
|
|
|
|
|