NodeGuideline Class Reference

Defines the NodeGuideline Class. More...

#include <guides.h>

Inheritance diagram for NodeGuideline:

NodeRenderableInk NodeRenderableBounded NodeRenderable Node CCObject SimpleCCObject List of all members.

Public Member Functions

 NodeGuideline ()
 This constructor creates a NodeGuideline linked to no other nodes, with all status flags false, and NULL bounding and pasteboard rectangles.
virtual String Describe (BOOL Plural, BOOL Verbose)
 To return a description of the Node object in either the singular or the plural. This method is called by the DescribeRange method.
virtual SubtreeRenderState RenderSubtree (RenderRegion *pRender, Node **ppNextNode=NULL, BOOL bClip=TRUE)
 This function will indicate to the caller whether or not we want to render the given node, according to the information passed in.
virtual void Render (RenderRegion *pRender)
 For rendering a node.
virtual DocRect GetBoundingRect (BOOL DontUseAttrs=FALSE, BOOL HitTest=FALSE)
 Calcs the bounds of the guideline. This varies with the current view.
virtual BOOL OnClick (DocCoord PointerPos, ClickType Click, ClickModifiers ClickMods, Spread *pSpread)
 Allows the Node to respond to clicks.
virtual BOOL OnNodePopUp (Spread *pSpread, DocCoord PointerPos, ContextMenu *pMenu)
 Allows the guideline to respond to pop up menu clicks on itself.
virtual void SetSelected (BOOL Status)
 Overrides the base class selection function.
virtual void Transform (TransformBase &Trans)
 Transforms the guideline using Trans.
virtual void PreExportRender (RenderRegion *pRegion)
 Called before any child nodes are asked to export.
virtual BOOL ExportRender (RenderRegion *pRegion)
 Called after child nodes are asked to export.
virtual BOOL NeedsToExport (RenderRegion *pRender, BOOL VisibleLayersOnly=FALSE, BOOL CheckSelected=FALSE)
 This function will indicate to the caller whether or not we want to export the given node, according to the information passed in.
DocRect GetRenderRect (BOOL HitTest=FALSE, RenderRegion *pRender=NULL)
 see NodeGuideline::GetRenderRect(Ordinate,Type,HitTest,pRender)
virtual void GetDebugDetails (StringBase *Str)
 For obtaining debug information about the Node.
virtual BOOL Snap (DocCoord *pDocCoord)
 The snap function for DocCoords.
virtual BOOL Snap (DocRect *pDocRect, const DocCoord &PrevCoord, const DocCoord &CurCoord)
 Place holder for derived classes.
void SetType (GuidelineType NewType)
GuidelineType GetType ()
void MakeHorzGuideline ()
void MakeVertGuideline ()
void SetOrdinate (MILLIPOINT NewOrdinate)
MILLIPOINT GetOrdinate ()
virtual void PolyCopyNodeContents (NodeRenderable *pNodeCopy)
 Polymorphically copies the contents of this node to another.
virtual BOOL WritePreChildrenWeb (BaseCamelotFilter *pFilter)
 Web format doesn't export guidelines.
virtual BOOL WritePreChildrenNative (BaseCamelotFilter *pFilter)
 Saves out the guideline in the v2 native file format.

Static Public Member Functions

static DocRect GetRenderRect (MILLIPOINT Ordinate, GuidelineType Type, BOOL HitTest=FALSE, RenderRegion *pRender=NULL)
 Main routine for calculating the bounding rect that represents a guideline This is mainly used for invalidating areas on screen for redraw purposes. If HitTest is TRUE, the rect is inflated by the size of the magnetic snap distance so that clicking near a guideline in order to drag it will work.
static MILLIPOINT ToSpreadOrdinate (Spread *pSpread, MILLIPOINT UserOrdinate, GuidelineType Type)
 Converts a given ordinate within UserCoord space, into a Spread-related ordinate.
static MILLIPOINT ToUserOrdinate (Spread *pSpread, MILLIPOINT SpreadOrdinate, GuidelineType Type)
 Converts a given ordinate within SpreadCoord space, into a User-related ordinate.

Private Member Functions

virtual NodeSimpleCopy ()
 This method returns a shallow copy of the node with all Node pointers NULL. The function is virtual, and must be defined for all derived classes.
void CopyNodeContents (NodeGuideline *NodeCopy)
 This method copies the node's contents to the node pointed to by NodeCopy.
MILLIPOINT ExtractOrdinate (DocCoord *pDocCoord)
 Central place for ordinate extraction.
void ReplaceOrdinate (DocCoord *pDocCoord, MILLIPOINT Ordinate)
 Central place for ordinate setting.
void TranslateRect (DocRect *pDocRect, MILLIPOINT Delta)
 Central place for doc rect translation.

Static Private Member Functions

static MILLIPOINT GetScaledPixelWidth (RenderRegion *pRender=NULL)
 Gets the scaled pixel width. if pRender != NULL, the render view associated with it is used, otherwise the selected doc view is used.

Private Attributes

GuidelineType Type
MILLIPOINT Ordinate

Detailed Description

Defines the NodeGuideline Class.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/9/95 Base Classes: NodeRenderableInk
See also:
NodeRenderableInk

Definition at line 130 of file guides.h.


Constructor & Destructor Documentation

NodeGuideline::NodeGuideline  ) 
 

This constructor creates a NodeGuideline linked to no other nodes, with all status flags false, and NULL bounding and pasteboard rectangles.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/9/95
Parameters:
- [INPUTS]
[OUTPUTS] 
Returns:
-

Errors:

Definition at line 233 of file guides.cpp.

00233                             : NodeRenderableInk()
00234 {
00235 // WEBSTER - markn 14/1/97
00236 #ifndef WEBSTER
00237     Type     = GUIDELINE_HORZ;
00238     Ordinate = 72000*9;
00239 #endif // WEBSTER
00240 }                    


Member Function Documentation

void NodeGuideline::CopyNodeContents NodeGuideline NodeCopy  )  [private]
 

This method copies the node's contents to the node pointed to by NodeCopy.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/9/95
Parameters:
- [INPUTS]
A copy of this node [OUTPUTS]
Returns:
-

Errors: An assertion failure will occur if NodeCopy is NULL Scope: protected

Definition at line 290 of file guides.cpp.

00291 {
00292 // WEBSTER - markn 14/1/97
00293 #ifndef WEBSTER
00294     ENSURE(NodeCopy != NULL,"Trying to copy a NodeGuideline's contents to a NULL node");  
00295     
00296     NodeRenderableInk::CopyNodeContents(NodeCopy); 
00297 
00298     NodeCopy->Type      = this->Type;
00299     NodeCopy->Ordinate  = this->Ordinate;
00300 #endif // WEBSTER
00301 }

String NodeGuideline::Describe BOOL  Plural,
BOOL  Verbose
[virtual]
 

To return a description of the Node object in either the singular or the plural. This method is called by the DescribeRange method.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/9/95
Parameters:
Plural,: Flag indicating if the string description should be plural or [INPUTS] singular.
- [OUTPUTS] Retuns: Description of the object
The description will always begin with a lower case letter.

Returns:
Errors: A resource exception will be thrown if a problem occurs when loading the string resource.
See also:
-

Reimplemented from Node.

Definition at line 378 of file guides.cpp.

00379 {     
00380 //  ENSURE (FALSE,"The illegal function NodeGuideline::Describe was called\n"); 
00381     
00382     return( _T("") ); // Just to keep the compiler happy
00383 }; 

BOOL NodeGuideline::ExportRender RenderRegion pRegion  )  [virtual]
 

Called after child nodes are asked to export.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/10/95
Parameters:
pRegion = the render region to export to [INPUTS]
- [OUTPUTS]
Returns:
TRUE if exported completely, FALSE to indicate Render() needs to be called

Reimplemented from NodeRenderableInk.

Definition at line 506 of file guides.cpp.

00507 {
00508 // WEBSTER - markn 14/1/97
00509 #ifndef WEBSTER
00510 #ifdef DO_EXPORT
00511     if (pRegion->IS_KIND_OF(NativeRenderRegion))
00512     {
00513         /*EPSExportDC *pDC = */ (EPSExportDC *) pRegion->GetRenderDC();
00514 
00515 //      pDC->OutputToken(_T("ceo"));            // Output end extended object token
00516 //      pDC->OutputNewLine();
00517     }
00518 #endif
00519 #endif // WEBSTER
00520     return TRUE;
00521 }

MILLIPOINT NodeGuideline::ExtractOrdinate DocCoord pDocCoord  )  [private]
 

Central place for ordinate extraction.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/9/95
Parameters:
pDocCoord = A DocCoord in Spread coords [INPUTS]
- [OUTPUTS]
Returns:
Either the X or the Y ordinate, dependant on the guideline type
See also:
CSnap

Definition at line 858 of file guides.cpp.

00859 {
00860 #ifndef WEBSTER
00861     // WEBSTER - markn 14/1/97
00862     ERROR3IF(pDocCoord == NULL,"pDocCoord is NULL");
00863 
00864     if (Type == GUIDELINE_HORZ)
00865         return pDocCoord->y;
00866     else
00867         return pDocCoord->x;
00868 #else
00869     return 0;
00870 #endif // WEBSTER
00871 }

DocRect NodeGuideline::GetBoundingRect BOOL  DontUseAttrs = FALSE,
BOOL  HitTest = FALSE
[virtual]
 

Calcs the bounds of the guideline. This varies with the current view.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/9/95
Parameters:
DontUseAttrs - TRUE if you want to ignore all the nodes attributes [INPUTS] FALSE by default. HitTest - TRUE if being called during HitTest
- [OUTPUTS]
Returns:
Bounding rect for the guideline
NOTE: Bounds are only given for hit testing. This is so the bounds of guidelines aren't incorporated into the bounds of its parent (i.e. the layer). If you don't do this, doing a 'zoom to objects' will try and zoom to guidelines which is very wrong
See also:
CSnap

Reimplemented from NodeRenderableBounded.

Definition at line 730 of file guides.cpp.

00731 {
00732 // WEBSTER - markn 14/1/97
00733 #ifndef WEBSTER
00734     if (HitTest)
00735         return GetRenderRect(HitTest);
00736     else
00737 #endif // WEBSTER
00738         return DocRect(0,0,0,0);
00739 }

void NodeGuideline::GetDebugDetails StringBase Str  )  [virtual]
 

For obtaining debug information about the Node.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/9/95
Parameters:
- [INPUTS]
Str,: String giving debug info about the node [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Reimplemented from NodeRenderableBounded.

Definition at line 343 of file guides.cpp.

00344 {          
00345 // WEBSTER - markn 14/1/97
00346 #ifndef WEBSTER
00347     NodeRenderableInk::GetDebugDetails(Str); 
00348 #endif // WEBSTER
00349 }

MILLIPOINT NodeGuideline::GetOrdinate  )  [inline]
 

Definition at line 171 of file guides.h.

00171 { return Ordinate; }

DocRect NodeGuideline::GetRenderRect BOOL  HitTest = FALSE,
RenderRegion pRender = NULL
 

see NodeGuideline::GetRenderRect(Ordinate,Type,HitTest,pRender)

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/9/95
Parameters:
pRenderRect = ptr to a render region (if NULL current DocView is used) [INPUTS] HitTest - TRUE if being called during HitTest
- [OUTPUTS]
Returns:
Bounding rect for this guideline
See also:
CSnap

Definition at line 651 of file guides.cpp.

00652 {
00653     return NodeGuideline::GetRenderRect(Ordinate,Type,HitTest,pRender);
00654 }

DocRect NodeGuideline::GetRenderRect MILLIPOINT  Ordinate,
GuidelineType  Type,
BOOL  HitTest = FALSE,
RenderRegion pRender = NULL
[static]
 

Main routine for calculating the bounding rect that represents a guideline This is mainly used for invalidating areas on screen for redraw purposes. If HitTest is TRUE, the rect is inflated by the size of the magnetic snap distance so that clicking near a guideline in order to drag it will work.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/9/95
Parameters:
Ordinate = ordinate value [INPUTS] Type = guideline type pRenderRect = ptr to a render region (if NULL current DocView is used) HitTest - TRUE if being called during HitTest
- [OUTPUTS]
Returns:
Rect to render
See also:
NodeGuideline::GetScaledPixelWidth()

Definition at line 676 of file guides.cpp.

00677 {
00678 #if !defined(EXCLUDE_FROM_RALPH)
00679     DocRect Rect = DocRect(Ordinate,Ordinate,Ordinate,Ordinate);
00680 
00681     MILLIPOINT PixelWidth = GetScaledPixelWidth(pRender);
00682 
00683     if (HitTest)
00684         PixelWidth = (CSnap::GetSnapDist()*2);
00685     else
00686         PixelWidth *= 2;
00687 
00688     if (Type == GUIDELINE_HORZ)
00689     {
00690         Rect.lo.x = MIN_INT;
00691         Rect.hi.x = MAX_INT;
00692         Rect.lo.y -= PixelWidth/2;
00693         Rect.hi.y += PixelWidth/2;
00694     }
00695     else
00696     {
00697         Rect.lo.x -= PixelWidth/2;
00698         Rect.hi.x += PixelWidth/2;
00699         Rect.lo.y = MIN_INT;
00700         Rect.hi.y = MAX_INT;
00701     }
00702 
00703     return Rect;
00704 #else
00705     return DocRect(0,0,0,0);
00706 #endif
00707 }

MILLIPOINT NodeGuideline::GetScaledPixelWidth RenderRegion pRender = NULL  )  [static, private]
 

Gets the scaled pixel width. if pRender != NULL, the render view associated with it is used, otherwise the selected doc view is used.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/9/95
Parameters:
pRender,: Render region to render into (can be NULL) [INPUTS]
- [OUTPUTS]
Returns:
-
It uses the all View::GetScaledPixelSize() function.

Definition at line 402 of file guides.cpp.

00403 {
00404 // WEBSTER - markn 14/1/97
00405 #ifndef WEBSTER
00406     MILLIPOINT Width = 0;
00407     View* pView = NULL;
00408 
00409     if (pRender != NULL)
00410         pView = pRender->GetRenderView();
00411     else
00412         pView = DocView::GetCurrent();
00413 
00414     if (pView != NULL)
00415     {
00416         // Get the scaled pixel size for the view
00417         FIXED16 ScaledPixelWidth,
00418                 ScaledPixelHeight; // Not used
00419         pView->GetScaledPixelSize(&ScaledPixelWidth, &ScaledPixelHeight);
00420         Width = (MILLIPOINT)ScaledPixelWidth.MakeLong();
00421     }
00422 
00423     return Width;
00424 #else
00425     return 0;
00426 #endif // WEBSTER
00427     return 0;
00428 }

GuidelineType NodeGuideline::GetType void   )  [inline]
 

Definition at line 164 of file guides.h.

00164 { return Type; }

void NodeGuideline::MakeHorzGuideline  )  [inline]
 

Definition at line 166 of file guides.h.

00166 { Type = GUIDELINE_HORZ; }

void NodeGuideline::MakeVertGuideline  )  [inline]
 

Definition at line 167 of file guides.h.

00167 { Type = GUIDELINE_VERT; }

BOOL NodeGuideline::NeedsToExport RenderRegion pRender,
BOOL  VisibleLayersOnly = FALSE,
BOOL  CheckSelected = FALSE
[virtual]
 

This function will indicate to the caller whether or not we want to export the given node, according to the information passed in.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
25/5/94
Parameters:
pRender - A pointer to the current render region (null if none) [INPUTS] ExcludeInvisibleLayers - TRUE => remove nodes which are on invisible layers
  • FALSE => export everything CheckSelected - TRUE => we check if object selected and only export selected bjects
  • FALSE => we don't bother checking for selection or not
    Returns:
    TRUE => This node should be exported, FALSE => This node does not need to be exported.
    NodeGuidelines only export to the native file format.

See also:
NodeGuideline::NeedsToRender

Reimplemented from NodeRenderable.

Definition at line 625 of file guides.cpp.

00626 {
00627 // WEBSTER - markn 14/1/97
00628 #ifdef DO_EXPORT
00629 #ifndef WEBSTER
00630     return (pRender->IS_KIND_OF(NativeRenderRegion));
00631 #endif // WEBSTER
00632 #endif
00633     return FALSE;
00634 }

BOOL NodeGuideline::OnClick DocCoord  PointerPos,
ClickType  Click,
ClickModifiers  ClickMods,
Spread pSpread
[virtual]
 

Allows the Node to respond to clicks.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/9/95
Parameters:
PointerPos - The Location of the mouse pointer at the time of the click [INPUTS] Click - The type of click received (single, double, drag etc) ClickMods - The modifiers to the click (eg shift, control etc ) pSpread - The spread the click occured in
Returns:
BOOL - TRUE if the node claims the click as its own and FALSE if it is not interested in the click
Guidelines will return TRUE for ALL clicks.

They only acually do something on CLICKTYPE_SINGLE clicks. With this click they initiate a drag on the guideline to allow the user to move them about the page.

Reimplemented from NodeRenderableInk.

Definition at line 763 of file guides.cpp.

00764 {
00765 #if !defined(EXCLUDE_FROM_RALPH)
00766     if (ClickMods.Menu)
00767         return FALSE;
00768 
00769     if (Click == CLICKTYPE_SINGLE)
00770     {
00771         OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_GUIDELINE);
00772         ERROR3IF(pOpDesc == NULL,"FindOpDescriptor(OPTOKEN_GUIDELINE) failed");
00773 
00774         if (pOpDesc != NULL)
00775         {
00776             OpGuidelineParam GuidelineParam;
00777 
00778             GuidelineParam.Method       = GUIDELINEOPMETHOD_MOVE_DRAG;
00779             GuidelineParam.pGuideline   = this;
00780 
00781             pOpDesc->Invoke(&GuidelineParam);
00782         }
00783     }
00784 #endif
00785     return TRUE;
00786 }

BOOL NodeGuideline::OnNodePopUp Spread pSpread,
DocCoord  PointerPos,
ContextMenu pMenu
[virtual]
 

Allows the guideline to respond to pop up menu clicks on itself.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/5/95
Parameters:
pSpread The spread in which things are happening [INPUTS] PointerPos The Location of the mouse pointer at the time of the click pMenu The menu to which items should be added
Returns:
BOOL - TRUE if the node claims the click as its own and FALSE if it is not interested in the click

Reimplemented from NodeRenderableInk.

Definition at line 802 of file guides.cpp.

00803 {
00804 //  WEBSTER-ranbirr-01/12/96    
00805 #ifndef WEBSTER
00806     BOOL ok = TRUE;
00807 
00808 #if !defined(EXCLUDE_FROM_RALPH)
00809     // set up data required for ops which could be invoked
00810     GuidelinePropDlg::SetEditGuidelineParams(this);
00811     OpDeleteGuideline::SetGuideline(this);
00812 
00813     ok = ok && pMenu->BuildCommand(OPTOKEN_DELETEGUIDELINE);
00814     ok = ok && pMenu->BuildCommand(OPTOKEN_SNAPTOGUIDES,TRUE);
00815     ok = ok && pMenu->BuildCommand(OPTOKEN_EDITGUIDELINEPROPDLG);
00816     ok = ok && pMenu->BuildCommand(OPTOKEN_GUIDEPROPERTIESDLG);
00817 #endif
00818 
00819     return ok;
00820 #else //webster
00821     return FALSE;
00822 #endif //webster
00823 }

void NodeGuideline::PolyCopyNodeContents NodeRenderable pNodeCopy  )  [virtual]
 

Polymorphically copies the contents of this node to another.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/12/2003
Parameters:
- [OUTPUTS]
Returns:
Errors: An assertion failure will occur if NodeCopy is NULL Scope: protected

Reimplemented from NodeRenderableBounded.

Definition at line 316 of file guides.cpp.

00317 {
00318     ENSURE(pNodeCopy, "Trying to copy a node's contents into a NULL node");
00319     ENSURE(IS_A(pNodeCopy, NodeGuideline), "PolyCopyNodeContents given wrong dest node type");
00320 
00321     if (IS_A(pNodeCopy, NodeGuideline))
00322         CopyNodeContents((NodeGuideline*)pNodeCopy);
00323 }

void NodeGuideline::PreExportRender RenderRegion pRegion  )  [virtual]
 

Called before any child nodes are asked to export.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/10/95
Parameters:
pRegion = the render region to export to [INPUTS]
- [OUTPUTS]
Returns:
-

Reimplemented from Node.

Definition at line 470 of file guides.cpp.

00471 {
00472 // WEBSTER - markn 14/1/97
00473 #ifndef WEBSTER
00474 #ifdef DO_EXPORT
00475     if (pRegion->IS_KIND_OF(NativeRenderRegion))
00476     {
00477         EPSExportDC *pDC = (EPSExportDC *) pRegion->GetRenderDC();
00478 
00479 //      pDC->OutputValue(INT32(TAG_GUIDELINE)); // Output start extended object tag and token
00480 //      pDC->OutputToken("cso");
00481 //      pDC->OutputNewLine();
00482 
00483         pDC->OutputValue(Ordinate);
00484         pDC->OutputValue(INT32(Type));
00485 
00486         pDC->OutputToken(_T("glne"));           // Camelot "guideline" token
00487         pDC->OutputNewLine();
00488     }
00489 #endif
00490 #endif // WEBSTER
00491 }

void NodeGuideline::Render RenderRegion pRender  )  [virtual]
 

For rendering a node.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/9/95
Parameters:
RendRegion,: Render region to render into [INPUTS]
- [OUTPUTS]
Returns:
-

Reimplemented from Node.

Definition at line 536 of file guides.cpp.

00537 {
00538 #if !defined(EXCLUDE_FROM_RALPH)
00539     pRender->SaveContext();
00540     DocRect Rect = pRender->GetClipRect();
00541 
00542     DocCoord StartCoord,EndCoord;
00543 
00544 //  INT32 DashUnit = (72000/4)*4;
00545 
00546     if (Type == GUIDELINE_HORZ)
00547     {
00548         StartCoord.x = Rect.lo.x;
00549         EndCoord.x   = Rect.hi.x;
00550         PullOntoStep(&StartCoord.x,&EndCoord.x,pRender->GetScaledPixelWidth()*4);
00551 
00552         StartCoord.y = EndCoord.y = Ordinate;
00553     }
00554     else
00555     {
00556         StartCoord.y = Rect.lo.y;
00557         EndCoord.y   = Rect.hi.y;
00558         PullOntoStep(&StartCoord.y,&EndCoord.y,pRender->GetScaledPixelWidth()*4);
00559 
00560         StartCoord.x = EndCoord.x = Ordinate;
00561     }
00562 
00563     pRender->DrawLine(StartCoord,EndCoord);
00564         
00565     pRender->RestoreContext();
00566 #endif
00567 }

SubtreeRenderState NodeGuideline::RenderSubtree RenderRegion pRender,
Node **  ppNextNode = NULL,
BOOL  bClip = TRUE
[virtual]
 

This function will indicate to the caller whether or not we want to render the given node, according to the information passed in.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
25/5/94
Parameters:
pRender - A pointer to the current render region (null if none) [INPUTS]
Returns:
TRUE => This node should be rendered, FALSE => This node does not need to be rendered.
See also:
NodeRenderableBounded::NeedsToRender

Reimplemented from NodeRenderableBounded.

Definition at line 584 of file guides.cpp.

00585 {
00586 #if !defined(EXCLUDE_FROM_RALPH)
00587     // If no cliprect supplied, assume we do need to render
00588     if (pRender==NULL)  
00589         return SUBTREE_ROOTANDCHILDREN;
00590 
00591     if (pRender->IsPrinting())
00592         return SUBTREE_NORENDER;
00593 
00594     if (pRender->IS_KIND_OF(EPSRenderRegion))
00595         return SUBTREE_NORENDER;
00596 
00597     return SUBTREE_ROOTANDCHILDREN;
00598 #else
00599     return SUBTREE_NORENDER;
00600 #endif
00601 }

void NodeGuideline::ReplaceOrdinate DocCoord pDocCoord,
MILLIPOINT  Ordinate
[private]
 

Central place for ordinate setting.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/9/95
Parameters:
pDocCoord = A DocCoord in Spread coords [INPUTS] Ordinate = ordinate value
Either the X or the Y ordinate of pDocCoord set to Ordinate, dependant on the guideline type [OUTPUTS]
Returns:
-
See also:
CSnap

Definition at line 888 of file guides.cpp.

00889 {
00890 // WEBSTER - markn 14/1/97
00891 #ifndef WEBSTER
00892     ERROR3IF(pDocCoord == NULL,"pDocCoord is NULL");
00893 
00894     if (Type == GUIDELINE_HORZ)
00895         pDocCoord->y = Ordinate;
00896     else
00897         pDocCoord->x = Ordinate;
00898 #endif // WEBSTER
00899 }

void NodeGuideline::SetOrdinate MILLIPOINT  NewOrdinate  )  [inline]
 

Definition at line 170 of file guides.h.

00170 { Ordinate = NewOrdinate; }

void NodeGuideline::SetSelected BOOL  Status  )  [virtual]
 

Overrides the base class selection function.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
7/9/95
Parameters:
Status = selection state (ignored) [INPUTS]
Returns:
-
'Status' is ignored and the node is always forced to be unselected.

Reimplemented from Node.

Definition at line 839 of file guides.cpp.

00840 {
00841     Flags.Selected = FALSE;
00842 }

void NodeGuideline::SetType GuidelineType  NewType  )  [inline]
 

Definition at line 163 of file guides.h.

00163 { Type = NewType; }

Node * NodeGuideline::SimpleCopy void   )  [private, virtual]
 

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.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/9/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
A copy of the node, or NULL if memory runs out

Errors: If memory runs out when trying to copy, then ERROR is called with an out of memory error and the function returns NULL. Scope: protected

Reimplemented from NodeRenderableInk.

Definition at line 261 of file guides.cpp.

00262 {
00263 // WEBSTER - markn 14/1/97
00264 #ifndef WEBSTER
00265     NodeGuideline* NodeCopy = new NodeGuideline();   
00266     if (NodeCopy != NULL)
00267         CopyNodeContents(NodeCopy);   
00268     return (NodeCopy);
00269 #else
00270     return NULL;
00271 #endif // WEBSTER
00272 }          

BOOL NodeGuideline::Snap DocRect pDocRect,
const DocCoord PrevCoord,
const DocCoord CurCoord
[virtual]
 

Place holder for derived classes.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/9/95
Parameters:
A DocRect, and two coords [INPUTS]
- [OUTPUTS]
Returns:
TRUE if pDocRect has snapped to this guideline - FALSE otherwise
See also:
CSnap

Reimplemented from NodeRenderableBounded.

Definition at line 1044 of file guides.cpp.

01045 {
01046 #if !defined(EXCLUDE_FROM_RALPH)
01047     MILLIPOINT SnapDist = CSnap::GetSnapDist();
01048 
01049     MILLIPOINT SrcOrdinate  = ExtractOrdinate(&pDocRect->lo);
01050     MILLIPOINT Dist = Ordinate-SrcOrdinate;
01051     if (abs_milli(Dist) <= SnapDist)
01052     {
01053         TranslateRect(pDocRect,Dist);
01054         return TRUE;
01055     }
01056 
01057     SrcOrdinate  = ExtractOrdinate(&pDocRect->hi);
01058     Dist = Ordinate-SrcOrdinate;
01059     if (abs_milli(Dist) <= SnapDist)
01060     {
01061         TranslateRect(pDocRect,Dist);
01062         return TRUE;
01063     }
01064 #endif
01065     return FALSE;
01066 }

BOOL NodeGuideline::Snap DocCoord pDocCoord  )  [virtual]
 

The snap function for DocCoords.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/9/95
Parameters:
pDocCoord = A DocCoord in Spread coords [INPUTS]
- [OUTPUTS]
Returns:
TRUE if pDocCoord has snapped to this guideline - FALSE otherwise
See also:
CSnap

Reimplemented from NodeRenderableBounded.

Definition at line 1013 of file guides.cpp.

01014 {
01015 #if !defined(EXCLUDE_FROM_RALPH)
01016     MILLIPOINT SnapDist     = CSnap::GetSnapDist();
01017     MILLIPOINT SrcOrdinate  = ExtractOrdinate(pDocCoord);
01018 
01019     MILLIPOINT Dist = abs_milli(Ordinate-SrcOrdinate);
01020 
01021     if (Dist <= SnapDist)
01022     {
01023         ReplaceOrdinate(pDocCoord,Ordinate);
01024         return TRUE;
01025     }
01026 #endif
01027     return FALSE;
01028 }

MILLIPOINT NodeGuideline::ToSpreadOrdinate Spread pSpread,
MILLIPOINT  UserOrdinate,
GuidelineType  Type
[static]
 

Converts a given ordinate within UserCoord space, into a Spread-related ordinate.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/10/95
Parameters:
pSpread = ptr to a spread [INPUTS] UserOrdinate= ordinate value in UserCoords Type = the type of guideline
- [OUTPUTS]
Returns:
Spread ordinate version of UserOrdinate
See also:

Definition at line 918 of file guides.cpp.

00919 {
00920 // WEBSTER - markn 14/1/97
00921 #ifndef WEBSTER
00922     ERROR2IF(pSpread == NULL,0,"pSpread is NULL");
00923 
00924     UserCoord   UCoord(UserOrdinate,UserOrdinate);
00925     DocCoord    DCoord = UCoord.ToSpread(pSpread);
00926 
00927     if (Type == GUIDELINE_HORZ)
00928         return DCoord.y;
00929     else
00930         return DCoord.x;
00931 #else
00932     return 0;
00933 #endif // WEBSTER
00934 }

MILLIPOINT NodeGuideline::ToUserOrdinate Spread pSpread,
MILLIPOINT  SpreadOrdinate,
GuidelineType  Type
[static]
 

Converts a given ordinate within SpreadCoord space, into a User-related ordinate.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/10/95
Parameters:
pSpread = ptr to a spread [INPUTS] SpreadOrdinate = ordinate value in UserCoords Type = the type of guideline
- [OUTPUTS]
Returns:
User ordinate version of SpreadOrdinate
See also:

Definition at line 952 of file guides.cpp.

00953 {
00954 // WEBSTER - markn 14/1/97
00955 #ifndef WEBSTER
00956     ERROR2IF(pSpread == NULL,0,"pSpread is NULL");
00957 
00958     DocCoord    DCoord(SpreadOrdinate,SpreadOrdinate);
00959     UserCoord   UCoord = DCoord.ToUser(pSpread);
00960 
00961     if (Type == GUIDELINE_HORZ)
00962         return UCoord.y;
00963     else
00964         return UCoord.x;
00965 #else
00966     return 0;
00967 #endif // WEBSTER
00968 }

void NodeGuideline::Transform TransformBase Trans  )  [virtual]
 

Transforms the guideline using Trans.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/10/95
Parameters:
Trans = the transformation to apply [INPUTS]
- [OUTPUTS]
Returns:
-

Reimplemented from NodeRenderableBounded.

Definition at line 443 of file guides.cpp.

00444 {
00445 #if !defined(EXCLUDE_FROM_RALPH)
00446     DocCoord Coord(Ordinate,Ordinate);
00447 
00448     Trans.Transform(&Coord,1);
00449 
00450     if (Type == GUIDELINE_HORZ)
00451         Ordinate = Coord.y;
00452     else
00453         Ordinate = Coord.x;
00454 #endif
00455 }

void NodeGuideline::TranslateRect DocRect pDocRect,
MILLIPOINT  Delta
[private]
 

Central place for doc rect translation.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/9/95
Parameters:
pDocRect = ptr to a DocRect [INPUTS] Delta = amount to translate rect by
Either the X or the Y ordinates of pDocRec are translated by Delta, dependant on the guideline type [OUTPUTS]
Returns:
-
See also:
CSnap

Definition at line 986 of file guides.cpp.

00987 {
00988 // WEBSTER - markn 14/1/97
00989 #ifndef WEBSTER
00990     ERROR3IF(pDocRect == NULL,"pDocRect is NULL");
00991 
00992     if (Type == GUIDELINE_HORZ)
00993         pDocRect->Translate(0,Delta);
00994     else
00995         pDocRect->Translate(Delta,0);
00996 #endif // WEBSTER
00997 }

BOOL NodeGuideline::WritePreChildrenNative BaseCamelotFilter pFilter  )  [virtual]
 

Saves out the guideline in the v2 native file format.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
8/8/96
Parameters:
pFilter = ptr to filter to write to [INPUTS]
- [OUTPUTS]
Returns:
TRUE if ok, FALSE otherwise
See also:

Reimplemented from Node.

Definition at line 1102 of file guides.cpp.

01103 {
01104 #ifdef DO_EXPORT
01105     ERROR2IF(pFilter == NULL,FALSE,"NULL filter param");
01106     ERROR3IF(UINT32(Type) > 255,"Can't store the guideline type in a byte");
01107 
01108     CamelotFileRecord Rec(pFilter,TAG_GUIDELINE,TAG_GUIDELINE_SIZE);
01109 
01110     BOOL    ok = Rec.Init();
01111     if (ok) ok = Rec.WriteBYTE(Type);
01112 
01113     if (ok && Type == GUIDELINE_HORZ)
01114         ok = Rec.WriteYOrd(Ordinate);
01115     else
01116         ok = Rec.WriteXOrd(Ordinate);
01117 
01118     if (ok) ok = pFilter->Write(&Rec);
01119 
01120     if (!ok)
01121         pFilter->GotError(_R(IDE_FILE_WRITE_ERROR));
01122 
01123     return ok;
01124 #else
01125     return FALSE;
01126 #endif
01127 }

BOOL NodeGuideline::WritePreChildrenWeb BaseCamelotFilter pFilter  )  [virtual]
 

Web format doesn't export guidelines.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
8/8/96
Parameters:
pFilter = ptr to filter to write to [INPUTS]
- [OUTPUTS]
Returns:
TRUE if ok, FALSE otherwise
See also:

Reimplemented from Node.

Definition at line 1082 of file guides.cpp.

01083 {
01084     return FALSE;
01085 }


Member Data Documentation

MILLIPOINT NodeGuideline::Ordinate [private]
 

Definition at line 196 of file guides.h.

GuidelineType NodeGuideline::Type [private]
 

Definition at line 195 of file guides.h.


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 03:56:55 2007 for Camelot by  doxygen 1.4.4