#include <spread.h>
Inheritance diagram for Spread:

Public Member Functions | |
| Spread () | |
| This constructor creates a Spread linked to no other nodes, with all status flags false, and NULL bounding and pasteboard rectangles. | |
| Spread (Node *ContextNode, AttachNodeDirection Direction, const DocRect &PasteRect, MILLIPOINT BleedOffset=0, 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 neccesary tree links are updated. | |
| virtual DocRect | GetBoundingRect (BOOL DontUseAttrs=FALSE, BOOL HitTest=FALSE) |
| returns the nodes bounding rectangle. If the rectangle is valid the rectangle is simply returned, but is IsBoundingRectValid is FALSE (cos someone called InvaldateBoundingRect() on this node, or one of its children) then the bounding rect is first calculated and the flag reset, before it is returned. The Spreads bounds rect is measured in Document Coords and this conversion is made in here. ie. All objects below the spread measure their coords etc relative to the spread, but the spread itself is measured relative to the document. | |
| DocRect | GetDrawingSize () const |
| Works out the size of the rectangle encompassing the drawing. Code also used to work out the pixel size in the bitmap export options dialog box. Graeme (13/7/00) - Changed the code so that the background layer is ignored. | |
| 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. | |
| Spread * | FindNextSpread () |
| To find the next sibling spread. | |
| Spread * | FindPreviousSpread () |
| To find the current spreads previous sibling spread. | |
| Page * | FindFirstPageInSpread () const |
| To find the first page in a spread. | |
| Page * | FindLastPageInSpread () const |
| To find the spread's last page. Layers and other renderable nodes should always be inserted after the last page. Otherwise, there is likely to be redraw problems. | |
| Document * | FindParentDocument () |
| Finds the parent document for this spread. Should always be one present. Defined as an explicit function so that caller just has to check for NULL returns, rather than also checking that the parent is a chapter. Also, makes it more encapsulated and friendly. | |
| Chapter * | FindParentChapter () |
| Finds the parent chapter for this spread. Should always be one present. Defined as an explicit function so that caller just has to check for NULL returns, rather than also checking that the parent is a chapter. Also, makes it more encapsulated and friendly. | |
| Layer * | FindActiveLayer () |
| For finding the spreads active layer. | |
| Layer * | FindFirstLayer () const |
| To find the spread's first layer. | |
| Layer * | FindLastLayer () const |
| To find the spread's last layer. | |
| Layer * | FindFirstGuideLayer () const |
| To find the spread's first guide layer. | |
| Layer * | FindFirstPageBackgroundLayer () const |
| To find the spread's first page background layer. | |
| Layer * | FindFirstFrameLayer () const |
| To find the spread's first frame layer. | |
| Layer * | FindLastFrameLayer () const |
| To find the spread's last framelayer. | |
| DimScale * | GetPtrDimScale () |
| For getting a ptr to the Spread's dimension scale object. | |
| MILLIPOINT | GetBleedOffset () const |
| For getting the Spread's bleed area size. | |
| BOOL | SetBleedOffset (MILLIPOINT Bleed) |
| For setting a new value for the Spread's bleed area size. | |
| BOOL | GetShowDropShadow () const |
| Finds out the current drop shadow display state. | |
| BOOL | SetShowDropShadow (BOOL NewState) |
| Allows the setting of a new drop shadow display state. | |
| virtual BOOL | IsSpread () const |
| Tell the caller that this is a spread node. | |
| virtual SubtreeRenderState | RenderSubtree (RenderRegion *pRender, Node **ppNextNode=NULL, BOOL bClip=TRUE) |
| BOOL | NeedsToExport (RenderRegion *pRender, BOOL VisibleLayersOnly=FALSE, BOOL CheckSelected=FALSE) |
| Indicate that we don't want to export this class of nodes. | |
| void | Render (RenderRegion *pRender) |
| Renders spread items: Pasteboard and off-paste area Main fold line Spread dividers Bleed Area Drop-shadows Spread outline Print margin. | |
| virtual UINT32 | GetNodeSize () const |
| For finding the size of the node. | |
| virtual void | GetDebugDetails (StringBase *Str) |
| For obtaining debug information about the Node. | |
| virtual BOOL | WritePreChildrenWeb (BaseCamelotFilter *pFilter) |
| Web files do not write out spreads. | |
| virtual BOOL | WritePreChildrenNative (BaseCamelotFilter *pFilter) |
| Writes the spread record to the filter. | |
| virtual BOOL | WriteBeginChildRecordsWeb (BaseCamelotFilter *pFilter) |
| Begins the child record sequence for spread in the web format. | |
| virtual BOOL | WriteBeginChildRecordsNative (BaseCamelotFilter *pFilter) |
| Begins the child record sequence for spread in the native format. | |
| virtual BOOL | WriteEndChildRecordsWeb (BaseCamelotFilter *pFilter) |
| Ends the child record sequence for spread in the web format. | |
| virtual BOOL | WriteEndChildRecordsNative (BaseCamelotFilter *pFilter) |
| Ends the child record sequence for spreads in the native format. | |
| DocCoord | GetUserOrigin () |
| void | SetUserOrigin (DocCoord origin) |
| void | SpreadCoordToDocCoord (DocCoord *pSpreadCoord) const |
| To convert between Document and Spread coordinate spaces. | |
| void | SpreadCoordToDocCoord (DocRect *pSpreadCoord) const |
| void | DocCoordToSpreadCoord (DocCoord *pDocCoord) const |
| To convert between Document and Spread coordinate spaces. | |
| void | DocCoordToSpreadCoord (DocRect *pDocCoord) const |
| BOOL | SpreadCoordToPagesCoord (DocCoord *pPagesCoord, DocCoord SpreadCoord) |
| Convert SpreadCoord to PagesCoord (relative to union of pages in spread). | |
| BOOL | PagesCoordToSpreadCoord (DocCoord *pSpreadCoord, DocCoord PagesCoord) |
| Convert PagesCoord (relative to union of pages in spread) to SpreadCoord. | |
| BOOL | GetPagesRect (DocRect *pPagesRect) |
| Get the union rect of all pages on the spread (in SpreadCoords). | |
| BOOL | TextToSpreadCoord (DocCoord *pDocCoord, StringBase *pxText, StringBase *pyText) |
| Convert Coord in text form (relative to union of pages in spread) into SpreadCoord. | |
| BOOL | SpreadCoordToText (String_256 *pxText, String_256 *pyText, DocCoord DocCoord, BOOL xUnitSpecifier=TRUE, BOOL yUnitSpecifier=TRUE, INT32 dp=-1) |
| Convert SpreadCoord into Coord in text form (relative to union of pages in spread) Note: If only Y specifier required and units are prefix then the unit specifier is actually placed before the x value. | |
| BOOL | GetDecimalPlacesForPixelResolution (View *pView, INT32 *dp) |
| Find the number of dp to resolve a pixel in units and scale associated with spread (calulates the both x and y and returns max). | |
| NodeGrid * | FindFirstDefaultGridInSpread () |
| Finds the first default grid that has been defined in this spread. Should be the only one present. | |
| BOOL | CreateDefaultPageAndGrid (BOOL CreateGrid=TRUE) |
| DocRect | GetPageBounds () const |
| Finds the bounding rectangle of this Spread, defined as the smallest rectangle enclosing all the Pages the Spread contains. | |
| DocRect | GetPageVisibleBounds () const |
| Finds the bounding rectangle of this Spread, defined as the smallest rectangle enclosing all the Pages the Spread contains. | |
| BOOL | GetPageSize (MILLIPOINT *Width, MILLIPOINT *Height, MILLIPOINT *Margin, MILLIPOINT *Bleed, BOOL *Dps, BOOL *ShowDropShadow) |
| Allows the current page size specified for a spread to be determined. Assumes that all pages in one spread are the same size and hence returns this size. | |
| BOOL | SetPageSize (const MILLIPOINT Width, const MILLIPOINT Height, const MILLIPOINT Margin, const MILLIPOINT Bleed, const BOOL Dps, const BOOL ShowDropShadow) |
| Allows the setting of a new page size by height and width for all pages in this spread. Also allows changing of other spread attributes such as:- margin around pages in spread, bleed size single/double page spread whether a drop shadow is displayed for this spread. | |
| DocRect | GetWidePasteboard (View *pView) |
| Return the pixelised boundary of the "wide pasteboard". | |
| DocCoord | GetSpreadCoordOrigin (BOOL Pixelise=TRUE, View *pView=NULL) const |
| To determine the spread coordinate origin This is used to convert between document and spread coordinates: DocCoord = SpreadCoord + Origin SpreadCoord = DocCoord - Origin. | |
| void | SetSpreadCoordOrigin (DocCoord NewOrigin) |
| To set the spread coordinate origin This is used to convert between document and spread coordinates: DocCoord = SpreadCoord + Origin SpreadCoord = DocCoord - Origin. | |
| DocCoord | GetMaxPasteboardSize (void) |
| To determine the maximum size that the pasteboard will allow itself to be expanded to. | |
| BOOL | ExpandPasteboardToInclude (DocRect IncludeRect) |
| To expand the pasteboard area to include the given rectangle. Used when objects are moved outside the current pasteboard area to keep them in an area which the user can see. The pasteboard will never expand beyond a maximum size (see Spread::GetMaxPasteboardSize). | |
| void | AdjustPasteboards (void) |
| This runs through all spreads in this spread's parent chapter, doing the following:. | |
| virtual void | PolyCopyNodeContents (NodeRenderable *pNodeCopy) |
| Polymorphically copies the contents of this node to another. | |
| BOOL | SetSpreadAnimPropertiesParam (const DWORD &Loop, const DWORD &GlobalDelay, const DITHER &Dither, const WEB_PALETTE &WebPalette, const PALETTE_COLOURS &ColoursPalette, const DWORD &NumColsInPalette, const BOOL &UseSystemColours, const BOOL &IsBackgroundTransparent) |
| BOOL | GetSpreadAnimPropertiesParam (DWORD *Loop, DWORD *GlobalDelay, DITHER *Dither, WEB_PALETTE *WebPalette, PALETTE_COLOURS *ColoursPalette, DWORD *NumColsInPalette, BOOL *UseSystemColours, BOOL *pIsBgTransparent) |
| Allows access to the Animation Properties details for this spread. Notes: Karim 07/12/00 - added IsBgTransparent parameter. | |
| AnimPropertiesParam & | GetSpreadAnimPropertiesParam () |
| Returns the the Animation Properties details for this spread. | |
| void | SetSpreadAnimPropertiesParam (const AnimPropertiesParam &Param) |
| void | SetAnimationDelay (const DWORD GlobalDelay) |
| Sets the the delay value within the class data member m_AnimPropertiesParam. This value has been recieved from the Animation properties tab. | |
| void | SetAnimationLoop (const DWORD &Loop) |
| Sets the loop value within the class data member m_AnimPropertiesParam. This value has been recieved from the Animation properties tab. | |
| void | SetAnimationColours (const DITHER &Dither, const WEB_PALETTE &WebPalette, const PALETTE_COLOURS &ColoursPalette, const DWORD &NumColsInPalette, const BOOL &IsBackgroundTransparent) |
| void | GetAnimationColours (DITHER *pDither, WEB_PALETTE *pWebPalette, PALETTE_COLOURS *pColoursPalette, DWORD *pNumColsInPalette, BOOL *pIsBackgroundTransparent) |
| virtual BOOL | WriteSpreadAnimProperties (BaseCamelotFilter *pFilter) |
| DocRect | GetAnimationBoundingRect () |
| Returns the stored animation bounding rect for this spread. | |
| void | SetAnimationBoundingRect (const DocRect &BoundingRect) |
| Sets the new stored bounding rect for this spread. | |
| Quality | GetAnimationQuality () |
| Returns the stored quality that the animation for this spread was captured at. | |
| void | SetAnimationQuality (const Quality &NewQuality) |
| Sets the new stored quality that the animation for this spread was captured at. | |
Protected Member Functions | |
| virtual BOOL | WriteSpreadInformation (BaseCamelotFilter *pFilter) |
Exports the page details, margins, bleed size and other spread related information for this spread to the filter. We output an information record rather than the individual pages as:-
| |
| virtual BOOL | WriteSpreadScaling (BaseCamelotFilter *pFilter) |
| Exports the scaling information for this spread to the filter. | |
| BOOL | SetSizeOfAllPages (const MILLIPOINT Width, const MILLIPOINT Height, const MILLIPOINT Margin, const BOOL Dps) |
| Sets the sizes of all pages in this spread to conform to the newly specified width and height. It will try and align all the pages. It will also try and create and or delete any pages which are necessary to conform to the specified single/double page spread flag. Assumes all the pages in a spread are the same size. | |
| BOOL | AlignPasteboards (const DocRect NewPasteRect, const MILLIPOINT Margin) |
| Tries to align all the pasteboards of the spreads in this chapter to the new size of this spread. Checks to see if the objects on the spread are bigger than the newly specified pasteboard rectangle and if so will put a margin around the object rectangle and then combine this with the specified pasteboard height. This means we will not loose any objects off the spread. As it is changing the size and position of the spread, it will invalidate the spreads bounding rectangle so that hopefully all bounding boxes will be recalculated rather than using the old and more than likely wrong cached one. Assumes at present that it is only called on the first spread in the chapter. | |
| virtual void | SetInitialPasteboardRect (const DocRect &PasteRect) |
| To set the initial pasteboard rectangle of this node, and then change the pasteboard rectangles of all its parents. | |
| virtual BOOL | PostImport () |
| This function is called after a document is imported. Nodes should override this function to do any post-import processing. | |
| void | RenderPasteboard (RenderRegion *pRender) |
| To render the pasteboard and off-paste area. | |
| void | RenderBleedArea (RenderRegion *pRender) |
| Renders the Bleed Area rectangle if the BleedOffset is not 0 Scope: private. | |
| 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 (Spread *NodeCopy) |
| This method copies the node's contents to the node pointed to by NodeCopy. | |
| void | RenderDropShadows (RenderRegion *pRender) |
| To render right-hand and bottom drop shadows Scope: private. | |
Protected Attributes | |
| MILLIPOINT | BleedOffset |
| BOOL | ShowDropShadow |
| BOOL | RalphDontShowPaper |
| DocCoord | SpreadOrigin |
| DocCoord | UserOrigin |
| AnimPropertiesParam | m_AnimPropertiesParam |
Private Attributes | |
| DimScale | SpreadDimScale |
Definition at line 138 of file spread.h.
|
|
This constructor creates a Spread linked to no other nodes, with all status flags false, and NULL bounding and pasteboard rectangles.
Definition at line 178 of file spread.cpp. 00178 : NodeRenderablePaper() 00179 { 00180 UserOrigin = DocCoord(0, 0); 00181 SpreadOrigin = DocCoord(0, 0); 00182 BleedOffset = 36000; 00183 ShowDropShadow = TRUE; 00184 RalphDontShowPaper = FALSE; 00185 //AnimPropertiesParam = constructed 00186 //SpreadDimScale = constructed 00187 }
|
|
||||||||||||||||||||||||||||||||||||
|
This method initialises the node and links it to ContextNode in the direction specified by Direction. All neccesary 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 BoundingRect: Bounding rectangle 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 238 of file spread.cpp. 00246 : NodeRenderablePaper(ContextNode, Direction, Locked, Mangled, 00247 Marked, Selected) 00248 { 00249 BleedOffset = Bleed; 00250 00251 // Set the default spread coord origin 00252 SpreadOrigin = PasteRect.lo; 00253 00254 // Pasteboard is used to indicate the width of the document (for scroll bars etc) 00255 SetInitialPasteboardRect(PasteRect); 00256 00257 // Default to showing the drop shadow on the page 00258 ShowDropShadow = TRUE; 00259 00260 // we only render paper in some ralph document modes 00261 RalphDontShowPaper = FALSE; 00262 00263 UserOrigin = DocCoord(0,0); 00264 }
|
|
|
This runs through all spreads in this spread's parent chapter, doing the following:.
2) Move the pasteboards (and contents) as necessary so that recently expanded pasteboards do not overlap neighbouring spreads, and they all butt up against each other nicely. (Note: The whole pasteboard is moved, including shifting the spread coord origin to keep it in the same relative position) 3) Ensure that all default grids fully cover their pasteboard. Finally, it will cause a redraw of all views onto this document to ensure that they are correctly updated. Notes: **** This has only been tested for single-spread Chapters **** (Although it has been written to hopefully handle multiple spreads)
Definition at line 3365 of file spread.cpp. 03366 { 03367 //#if NEW_PASTEBOARD 03368 Chapter* ParentChapter = FindParentChapter(); 03369 ERROR3IF(ParentChapter == NULL, "No parent Chapter?!"); 03370 03371 // First, find the minimum and maximum pasteboard x extents for the entire document. 03372 // Helpfully, our parent Chapter's pasteboard rect is a union of all of ours! 03373 DocRect ChapterBounds = ParentChapter->GetPasteboardRect(); 03374 03375 // Now we loop through all spreads from this one onwards, doing 2 things 03376 // 1) Make sure that each following spread is shifted to the correct document coordinates 03377 // by ensuring its pasteboard is placed after this spread's one. 03378 // 2) Make sure that all default grids in all spreads fully cover the pasteboards. 03379 Spread* pThisSpread = ParentChapter->FindFirstSpread(); 03380 03381 // Force the x extent of the first pasteboard to match all others in this chapter 03382 DocRect TempPasteRect = pThisSpread->GetPasteboardRect(); 03383 TempPasteRect.lo.x = ChapterBounds.lo.x; 03384 TempPasteRect.hi.x = ChapterBounds.hi.x; 03385 03386 /*if (pThisSpread->FindNextSpread()) 03387 { 03388 DocCoord OriginOffset(pThisSpread->SpreadOrigin.x - pThisSpread->PasteboardRect.lo.x, 03389 pThisSpread->SpreadOrigin.y - pThisSpread->PasteboardRect.lo.y); 03390 03391 DocRect r; 03392 pThisSpread->GetPagesRect(&r); 03393 pThisSpread->SpreadCoordToDocCoord(&r); 03394 r.Inflate(18000); 03395 INT32 ydiff = r.lo.y - TempPasteRect.lo.y; 03396 TempPasteRect.lo.y = r.lo.y; 03397 03398 pThisSpread->SpreadOrigin.x = TempPasteRect.lo.x + OriginOffset.x; 03399 pThisSpread->SpreadOrigin.y = TempPasteRect.lo.y + OriginOffset.y - ydiff; 03400 } 03401 */ 03402 03403 pThisSpread->ChangePasteboardRect(TempPasteRect); 03404 pThisSpread->InvalidateBoundingRect(); 03405 03406 // For each spread... 03407 while (pThisSpread != NULL) 03408 { 03409 Progress::Update(); // Update any active hourglass 03410 03411 Spread* pNextSpread = pThisSpread->FindNextSpread(); 03412 03413 // --- If there is a spread following this one, fix its pasteboard rect position 03414 if (pNextSpread != NULL) 03415 { 03416 DocRect FirstPasteRect = pThisSpread->GetPasteboardRect(FALSE); 03417 /*if (pThisSpread->FindNextSpread()) 03418 { 03419 DocRect r; 03420 pThisSpread->GetPagesRect(&r); 03421 pThisSpread->SpreadCoordToDocCoord(&r); 03422 r.Inflate(18000); 03423 FirstPasteRect.lo.y = r.lo.y; 03424 } 03425 if (pThisSpread->FindPreviousSpread()) 03426 { 03427 DocRect r; 03428 pThisSpread->GetPagesRect(&r); 03429 pThisSpread->SpreadCoordToDocCoord(&r); 03430 r.Inflate(18000); 03431 FirstPasteRect.hi.y = r.hi.y; 03432 } 03433 */ 03434 DocRect SecondPasteRect = pNextSpread->GetPasteboardRect(FALSE); 03435 DocCoord OriginOffset(pNextSpread->SpreadOrigin.x - pNextSpread->PasteboardRect.lo.x, 03436 pNextSpread->SpreadOrigin.y - pNextSpread->PasteboardRect.lo.y); 03437 03438 /*if (pNextSpread->FindNextSpread()) 03439 { 03440 DocRect r; 03441 pNextSpread->GetPagesRect(&r); 03442 pNextSpread->SpreadCoordToDocCoord(&r); 03443 r.Inflate(18000); 03444 INT32 ydiff = r.lo.y - SecondPasteRect.lo.y; 03445 SecondPasteRect.lo.y = r.lo.y; 03446 OriginOffset.y -= ydiff; 03447 } 03448 if (pNextSpread->FindPreviousSpread()) 03449 { 03450 DocRect r; 03451 pNextSpread->GetPagesRect(&r); 03452 pNextSpread->SpreadCoordToDocCoord(&r); 03453 r.Inflate(18000); 03454 SecondPasteRect.hi.y = r.hi.y; 03455 } 03456 */ 03457 03458 // Construct a new Pasteboard rectangle of the correct size, and move it 03459 // to lie just below the previous spread's pasteboard area 03460 TempPasteRect = SecondPasteRect; 03461 03462 TempPasteRect.Translate(-TempPasteRect.lo.x, -TempPasteRect.lo.y); 03463 TempPasteRect.Translate(FirstPasteRect.lo.x, FirstPasteRect.lo.y - TempPasteRect.Height()); 03464 03465 // And force the x extent of this pasteboard to match all others in this chapter 03466 TempPasteRect.lo.x = ChapterBounds.lo.x; 03467 TempPasteRect.hi.x = ChapterBounds.hi.x; 03468 03469 // Move the spread coordinate origin so that it stays at the same relative offset 03470 // from the pasteboard bottom left corner, or else all objects inside the spread 03471 // will suddenly shift to a new place on (or off) the pasteboard! 03472 pNextSpread->SpreadOrigin.x = TempPasteRect.lo.x + OriginOffset.x; 03473 pNextSpread->SpreadOrigin.y = TempPasteRect.lo.y + OriginOffset.y; 03474 03475 // Set the new paste rect 03476 pNextSpread->ChangePasteboardRect(TempPasteRect); 03477 03478 // Make sure bounding rectangles are invalidated so that they are recalculated 03479 pNextSpread->InvalidateBoundingRect(); 03480 } 03481 03482 // --- Fix all the default grids to exactly cover their pasteboards 03483 Node *ptr = pThisSpread->FindFirstChild(); 03484 while (ptr != NULL) 03485 { 03486 if (ptr->IsKindOf(CC_RUNTIME_CLASS(NodeGrid))) 03487 { 03488 // Found a grid type node. Check if its a default type. 03489 NodeGrid* pCurrentGrid = (NodeGrid*)ptr; 03490 03491 if (pCurrentGrid->IsDefault()) 03492 { 03493 // Default grids need to fill the spread's pasteboard rect 03494 DocRect Bounds = pThisSpread->GetPasteboardRect(); 03495 DocCoordToSpreadCoord(&Bounds); 03496 03497 // And set the new bounding rect 03498 pCurrentGrid->SetBoundingRect(Bounds); 03499 } 03500 } 03501 03502 ptr = ptr->FindNext(); 03503 } 03504 03505 // --- And move on to the next spread to fix 03506 pThisSpread = pNextSpread; 03507 } 03508 03509 // And invalidate all displayed views on this document, in order to make sure they 03510 // correctly update on screen. 03511 Document *pDoc = (Document *)FindOwnerDoc(); 03512 if (pDoc != NULL) 03513 pDoc->ForceRedraw(); 03514 03515 //#else 03516 //ERROR3("Spread::AdjustPasteboards is unimplemented - see Jason/Phil"); 03517 //#endif 03518 }
|
|
||||||||||||
|
Tries to align all the pasteboards of the spreads in this chapter to the new size of this spread. Checks to see if the objects on the spread are bigger than the newly specified pasteboard rectangle and if so will put a margin around the object rectangle and then combine this with the specified pasteboard height. This means we will not loose any objects off the spread. As it is changing the size and position of the spread, it will invalidate the spreads bounding rectangle so that hopefully all bounding boxes will be recalculated rather than using the old and more than likely wrong cached one. Assumes at present that it is only called on the first spread in the chapter.
Definition at line 2357 of file spread.cpp. 02358 { 02359 ERROR2IF(this==NULL,FALSE,"Spread::AlignPasteboards called on NULL pointer"); 02360 02361 // Work out the overall bounds of the pages and objects on the page in the spread 02362 // This will be in document coordinates 02363 DocRect ObjectsBounds = GetBoundingRect(FALSE); 02364 02365 // Take copy of entry pasteboard rectangle size 02366 DocRect PasteRect = NewPasteRect; 02367 02368 // Note:: The tops of the old paste board rectangle and the new are aligned rather 02369 // than the bottoms. Hence the 0,0s are different. This means that direct comparisons 02370 // between new size, old size and bounding rectangles are not possible. 02371 // First, get the current paste board rectangle for this spread. 02372 DocRect SpreadRect = GetPasteboardRect(); 02373 02374 // Work out the maximum height and width of pasteboard required to encompass all the 02375 // current objects on the page. Include a margin around the outside. 02376 MILLIPOINT HeightReqd = ObjectsBounds.hi.y - SpreadRect.lo.y + Margin; 02377 MILLIPOINT WidthReqd = ObjectsBounds.hi.x - SpreadRect.lo.x + Margin; 02378 // Above calculations will not include objects off the bottom and/or left hand side of 02379 // the page. We would need to shift the bottom left hand corner of the page plus all 02380 // objects if we were going to move these objects back onto the page. 02381 02382 // If bounding rectangle of objects on page is bigger than the size of this new pasteboard 02383 // rectangle then resize the pasteboard to include the objects bounding box. 02384 if (PasteRect.Width() < WidthReqd || 02385 PasteRect.Height() < HeightReqd ) 02386 { 02387 // Work out what the new required width and height of the pasteboard rectangle is 02388 // including a margin size border around the outside of the objects bounding rectangle 02389 // so that all the handles are accessable. 02390 MILLIPOINT SpreadHeight = 0; 02391 MILLIPOINT SpreadWidth = 0; 02392 if (HeightReqd < PasteRect.Height() ) 02393 SpreadHeight = PasteRect.Height(); 02394 else 02395 SpreadHeight = HeightReqd; 02396 02397 if (WidthReqd < PasteRect.Width() ) 02398 SpreadWidth = PasteRect.Width(); 02399 else 02400 SpreadWidth = WidthReqd; 02401 02402 // Contruct a new PasteRect to take this object bounding rectangle into account. 02403 PasteRect = DocRect(MinDocCoord + 0x10000, 02404 (MaxDocCoord - 0x10000) - (SpreadHeight), 02405 (MinDocCoord + 0x10000) + (SpreadWidth), 02406 MaxDocCoord - 0x10000); 02407 } 02408 02409 // Now we have the required size and position, go and set it 02410 ChangePasteboardRect(PasteRect); 02411 02412 // Make the wide pasteboard align to the new one 02413 // REMOVED - WPB now calculated on the fly rather than cached 02414 // WidePasteboard.lo.y = PasteRect.lo.y; 02415 // WidePasteboard.hi.y = PasteRect.hi.y; 02416 02417 // Make sure bounding rectangles are invalidated so that they are recalculated 02418 InvalidateBoundingRect(); 02419 02420 // Now ensure all following spreads are properly attached to this one 02421 // Assumes that we are altering the first spread in the document 02422 // Note this spread as a possible last spread in the document 02423 Spread* pLastSpread = this; 02424 Spread* pThisSpread = this; 02425 Spread* pNextSpread = FindNextSpread(); 02426 while (pNextSpread != NULL) 02427 { 02428 // Next spread present, so adjust the pasteboard on the first/previous spread to 02429 // be correct assuming that it is not the last one present. 02430 // REMOVED- AdjustPasteboardHeight used to set the wide pasteboard - this is no longer necessary 02431 // as the Wide Pasteboard is calculated on the fly rather than cached now. 02432 // pThisSpread->AdjustPasteboardHeight(FALSE); 02433 02434 DocRect FirstPasteRect = pThisSpread->GetPasteboardRect(FALSE); 02435 DocRect SecondPasteRect = pNextSpread->GetPasteboardRect(FALSE); 02436 // Construct a new Pasteboard rectangle of the correct size and initial position 02437 // and then move it down by the height of the first spread (Down = -ve). 02438 DocRect TempPasteRect(MinDocCoord + 0x10000, 02439 (MaxDocCoord - 0x10000) - SecondPasteRect.Height(), 02440 (MinDocCoord + 0x10000) + SecondPasteRect.Width(), 02441 MaxDocCoord - 0x10000); 02442 02443 TempPasteRect.Translate(0, -( FirstPasteRect.Height() )); 02444 // Now we have the required size and position, go and set it 02445 pNextSpread->ChangePasteboardRect(TempPasteRect); 02446 02447 // Make the wide pasteboard align to the new one 02448 // REMOVED - WPB now calculated on the fly rather than cached 02449 // pNextSpread->WidePasteboard.lo.y = TempPasteRect.lo.y; 02450 // pNextSpread->WidePasteboard.hi.y = TempPasteRect.hi.y; 02451 02452 #ifdef _DEBUG 02453 // On Debug versions check that the spreads are aligned correctly 02454 FirstPasteRect = pThisSpread->GetPasteboardRect(FALSE); 02455 SecondPasteRect = pNextSpread->GetPasteboardRect(FALSE); 02456 TRACEUSER( "Neville", _T("First spread low corner y = %d\n"),FirstPasteRect.LowCorner().y); 02457 TRACEUSER( "Neville", _T("Second spread high corner y = %d\n"),SecondPasteRect.HighCorner().y); 02458 ENSURE((SecondPasteRect.HighCorner().y == FirstPasteRect.LowCorner().y), 02459 "Spread::SetPageSize() Spreads are not properly vertically aligned"); 02460 #endif 02461 02462 // Make sure bounding rectangles are invalidated so that they are recalculated 02463 pNextSpread->InvalidateBoundingRect(); 02464 02465 // Note this next spread as a possible last spread and this spread 02466 pLastSpread = pNextSpread; 02467 pThisSpread = pNextSpread; 02468 02469 // Now, see whether there is a next spread or not. 02470 pNextSpread = pNextSpread->FindNextSpread(); 02471 } 02472 02473 // Last spread in document/chapter so adjust the bottom pasteboard to be correct 02474 // REMOVED - this method just adjusts the Wide pasteboard - no longer necessary as the WPB 02475 // is calculated on the fly rather than cached 02476 // if (pLastSpread != NULL) 02477 // pLastSpread->AdjustPasteboardHeight(TRUE); 02478 02479 return TRUE; 02480 }
|
|
|
This method copies the node's contents to the node pointed to by NodeCopy.
Definition at line 953 of file spread.cpp. 00954 { 00955 ERROR3IF(NodeCopy == NULL,"Trying to copy node contents to\n" 00956 "a node pointed to by a NULL pointer"); 00957 NodeRenderablePaper::CopyNodeContents(NodeCopy); 00958 00959 NodeCopy->BleedOffset = BleedOffset; 00960 NodeCopy->ShowDropShadow = ShowDropShadow; 00961 NodeCopy->SpreadOrigin = SpreadOrigin; 00962 NodeCopy->UserOrigin = UserOrigin; 00963 NodeCopy->m_AnimPropertiesParam = m_AnimPropertiesParam; 00964 NodeCopy->SpreadDimScale = SpreadDimScale; 00965 NodeCopy->RalphDontShowPaper = RalphDontShowPaper; 00966 }
|
|
|
Definition at line 2730 of file spread.cpp. 02731 { 02732 // Work out where to put the page and create it 02733 DocRect PageRect(Gap, Gap, Gap+PageWidth, Gap+(1*PageHeight)); 02734 Page *pPage = new Page(this, FIRSTCHILD, PageRect); 02735 if (pPage == NULL) 02736 return(FALSE); 02737 02738 // Create a default blanket grid in the given spread 02739 if (CreateGrid) 02740 NodeGrid::MakeDefaultGrid(this); 02741 02742 return TRUE; 02743 }
|
|
||||||||||||
|
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 295 of file spread.cpp. 00296 { 00297 if (Plural) 00298 return(String(_R(IDS_SPREAD_DESCRP))); 00299 else 00300 return(String(_R(IDS_SPREAD_DESCRS))); 00301 };
|
|
|
Definition at line 3145 of file spread.cpp. 03146 { 03147 ERROR3IF(pDocRect == NULL, "Illegal NULL params"); 03148 03149 DocCoordToSpreadCoord(&pDocRect->lo); 03150 DocCoordToSpreadCoord(&pDocRect->hi); 03151 }
|
|
|
To convert between Document and Spread coordinate spaces.
Definition at line 3133 of file spread.cpp. 03134 { 03135 ERROR3IF(pDocCoord == NULL, "Illegal NULL params"); 03136 03137 DocCoord Origin = GetSpreadCoordOrigin(); 03138 03139 pDocCoord->x -= Origin.x; 03140 pDocCoord->y -= Origin.y; 03141 }
|
|
|
To expand the pasteboard area to include the given rectangle. Used when objects are moved outside the current pasteboard area to keep them in an area which the user can see. The pasteboard will never expand beyond a maximum size (see Spread::GetMaxPasteboardSize).
The pasteboard expands equally in all directions in order to keep all page "margins" equal. This is necessary so that window scroll positions are not messed when we re-load a file
Definition at line 3221 of file spread.cpp. 03222 { 03223 #if NEW_PASTEBOARD 03224 #error ("This code has been commented out for safety. Please uncomment and try again"); 03225 03226 Progress Hourglass; // Ensure an hourglass is running while we're busy 03227 03228 // Convert the Spread coordinates "IncludeRect" into Document coordinates "IncludeDocRect" 03229 DocRect IncludeDocRect(IncludeRect); 03230 SpreadCoordToDocCoord(&IncludeDocRect); 03231 03232 // If the pasteboard is already big enough, return immediately (success) 03233 if (PasteboardRect.ContainsRect(IncludeDocRect)) 03234 return(TRUE); 03235 03236 // Remember where the view was looking before we moved things about 03237 DocView *pView = DocView::GetSelected(); 03238 DocRect ViewRect; 03239 if (pView != NULL) 03240 { 03241 ViewRect = pView->GetDocViewRect(this); 03242 DocCoordToSpreadCoord(&ViewRect); 03243 } 03244 03245 // Inflate the IncludeRect in order to add a margin outside it. 72000mpt => 1 inch 03246 IncludeDocRect.Inflate(72000); 03247 03248 // And include the rectangle into the new pasteboard rectangle 03249 DocRect NewBounds(PasteboardRect); 03250 NewBounds = NewBounds.Union(IncludeDocRect); 03251 03252 // And now find the amount by which the "margin" should change, and inflate the pasteboard 03253 // rect in all directions, to keep the margin equal around the pages. 03254 INT32 InflateBy = 0; 03255 { 03256 InflateBy = ABS(NewBounds.lo.x - PasteboardRect.lo.x); 03257 03258 INT32 temp = ABS(NewBounds.lo.y - PasteboardRect.lo.y); 03259 if (temp > InflateBy) InflateBy = temp; 03260 03261 temp = ABS(NewBounds.hi.x - PasteboardRect.hi.x); 03262 if (temp > InflateBy) InflateBy = temp; 03263 03264 temp = ABS(NewBounds.hi.y - PasteboardRect.hi.y); 03265 if (temp > InflateBy) InflateBy = temp; 03266 03267 03268 // Make sure we don't expand beyond the maximum size 03269 DocCoord MaxSize = GetMaxPasteboardSize(); 03270 if (PasteboardRect.Width() + 2*InflateBy > MaxSize.x) 03271 InflateBy = (MaxSize.x - PasteboardRect.Width()) / 2; 03272 03273 if (PasteboardRect.Height() + 2*InflateBy > MaxSize.y) 03274 InflateBy = (MaxSize.y - PasteboardRect.Height()) / 2; 03275 03276 // And inflate the original pasteboard 03277 NewBounds = PasteboardRect; 03278 NewBounds.Inflate(InflateBy, InflateBy); 03279 } 03280 03281 // Now we have the required size and position, go and set it 03282 ChangePasteboardRect(NewBounds); 03283 03284 // Make sure bounding rectangles are invalidated so that they are recalculated 03285 InvalidateBoundingRect(); 03286 03287 // Now run through all spreads, lining up their pasteboards so they don't overlap, 03288 // and making sure that their default grids fully cover the pasteboards. 03289 // Note that this also ensures that the document is redrawn 03290 AdjustPasteboards(); 03291 03292 Document *pParentDoc = (Document *) FindOwnerDoc(); 03293 if (pParentDoc != NULL) 03294 { 03295 // Pretend that page size has changed to cause related UI to change (rulers mainly) 03296 BROADCAST_TO_ALL(OptionsChangingMsg(pParentDoc, 03297 OptionsChangingMsg::NEWPAGESIZE)); 03298 } 03299 03300 // Try to keep the scroll offsets sensible 03301 if (pView != NULL && pView->GetDoc() == pParentDoc) 03302 { 03303 // First, scroll to the previously visible view rectangle - this will adjust for the 03304 // new size of the pasteboard (i.e. new size of the view window extent) to make the 03305 // view look like it has not moved at all. 03306 pView->ScrollToShow(&ViewRect); 03307 03308 // Now, make sure that the IncludeRect is visible on screen 03309 pView->ScrollToShow(&IncludeRect); 03310 } 03311 03312 return(TRUE); // return - successful 03313 03314 #else 03315 // Pasteboard can never expand. Sniffle, Sob! 03316 // We return TRUE if the pasteboard already includes the specified rectangle, and 03317 // FALSE if we would have to expand to include it. 03318 03319 // Convert the Spread coordinates "IncludeRect" into Document coordinates "IncludeDocRect" 03320 DocRect IncludeDocRect(IncludeRect); 03321 SpreadCoordToDocCoord(&IncludeDocRect); 03322 03323 // If the pasteboard is already big enough, return immediately (success) 03324 if (PasteboardRect.ContainsRect(IncludeDocRect)) 03325 return(TRUE); 03326 03327 return(FALSE); 03328 #endif 03329 }
|
|
|
For finding the spreads active layer.
Definition at line 1096 of file spread.cpp. 01097 { 01098 // Changed by MarkN 11/8/94 to use Spread::FindFirstLayer()and Layer::FindNextLayer() 01099 01100 Layer* pActiveLayer = NULL; 01101 Layer* pLayer = FindFirstLayer(); // Get first child 01102 BOOL MultipleActiveLayers = FALSE; 01103 while (pLayer != NULL) 01104 { 01105 if (pLayer->IsActive()) // we have found an active layer 01106 { 01107 // There should only ever be one active layer 01108 ERROR3IF(pActiveLayer != NULL, "Spread has more than one active layer"); 01109 if (pActiveLayer != NULL) 01110 MultipleActiveLayers = TRUE; 01111 pActiveLayer = pLayer; 01112 } 01113 01114 pLayer = pLayer->FindNextLayer(); // Find next layer 01115 } 01116 01117 // This line added by MarkN 22/3/95, to ensure that this function cannot fail 01118 // as long as there is at least one layer in this spread. 01119 // The MultipleActiveLayers added by Neville 12/6/96 so that multiple active layers 01120 // are fixed, if found. 01121 if (pActiveLayer == NULL || MultipleActiveLayers) 01122 LayerSGallery::EnsureActiveLayerIntegrity(this,&pActiveLayer); 01123 // Fail if the spread has no active layer 01124 return (pActiveLayer); 01125 }
|
|
|
Finds the first default grid that has been defined in this spread. Should be the only one present.
Definition at line 2682 of file spread.cpp. 02683 { 02684 ERROR2IF(this==NULL,NULL,"Spread::FindFirstDefaultGridInSpread called on NULL pointer"); 02685 02686 Node* pCurrentNode = FindFirstChild(); 02687 while(pCurrentNode != NULL) 02688 { 02689 if (pCurrentNode->IsKindOf(CC_RUNTIME_CLASS(NodeGrid))) 02690 { 02691 // Found a grid type node. Check if its a default type. 02692 NodeGrid* pCurrentGrid = (NodeGrid*)pCurrentNode; 02693 if (pCurrentGrid->IsDefault()) 02694 return (pCurrentGrid); 02695 } 02696 02697 pCurrentNode = pCurrentNode->FindNext(); 02698 } 02699 return (NULL); // No default grids were found 02700 }
|