#include <guides.h>
Inheritance diagram for NodeGuideline:
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 Node * | SimpleCopy () |
This method returns a shallow copy of the node with all Node pointers NULL. The function is virtual, and must be defined for all derived classes. | |
void | CopyNodeContents (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 |
Definition at line 130 of file guides.h.
|
This constructor creates a NodeGuideline linked to no other nodes, with all status flags false, and NULL bounding and pasteboard rectangles.
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 }
|
|
This method copies the node's contents to the node pointed to by NodeCopy.
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 }
|
|
To return a description of the Node object in either the singular or the plural. This method is called by the DescribeRange method.
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 };
|
|
Called after child nodes are asked to export.
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 }
|
|
Central place for ordinate extraction.
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 }
|
|
Calcs the bounds of the guideline. This varies with the current view.
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 }
|
|
For obtaining debug information about the Node.
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 }
|
|
Definition at line 171 of file guides.h. 00171 { return Ordinate; }
|
|
see NodeGuideline::GetRenderRect(Ordinate,Type,HitTest,pRender)
Definition at line 651 of file guides.cpp. 00652 { 00653 return NodeGuideline::GetRenderRect(Ordinate,Type,HitTest,pRender); 00654 }
|
|
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.
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 }
|
|
Gets the scaled pixel width. if pRender != NULL, the render view associated with it is used, otherwise the selected doc view is used.
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 }
|
|
Definition at line 164 of file guides.h. 00164 { return Type; }
|
|
Definition at line 166 of file guides.h. 00166 { Type = GUIDELINE_HORZ; }
|
|
Definition at line 167 of file guides.h. 00167 { Type = GUIDELINE_VERT; }
|
|
This function will indicate to the caller whether or not we want to export the given node, according to the information passed in.
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 }
|
|
Allows the Node to respond to 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 }
|
|
Allows the guideline to respond to pop up menu clicks on itself.
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 }
|
|
Polymorphically copies the contents of this node to another.
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 }
|
|
Called before any child nodes are asked to export.
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 }
|
|
For rendering a node.
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 }
|
|
This function will indicate to the caller whether or not we want to render the given node, according to the information passed in.
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 }
|
|
Central place for ordinate setting.
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 }
|
|
Definition at line 170 of file guides.h. 00170 { Ordinate = NewOrdinate; }
|
|
Overrides the base class selection function.
Reimplemented from Node. Definition at line 839 of file guides.cpp.
|
|
Definition at line 163 of file guides.h. 00163 { Type = NewType; }
|
|
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 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 }
|
|
Place holder for derived classes.
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 }
|
|
The snap function for DocCoords.
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 }
|
|
Converts a given ordinate within UserCoord space, into a Spread-related ordinate.
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 }
|
|
Converts a given ordinate within SpreadCoord space, into a User-related ordinate.
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 }
|
|
Transforms the guideline using Trans.
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 }
|
|
Central place for doc rect translation.
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 }
|
|
Saves out the guideline in the v2 native file format.
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 }
|
|
Web format doesn't export guidelines.
Reimplemented from Node. Definition at line 1082 of file guides.cpp. 01083 { 01084 return FALSE; 01085 }
|
|
|
|
|