PrintMarksMan Class Reference

The 'Print Marks Manager'. This manager handles the installation, formatting and rendering of printer marks. It liaises with the print box to provide a UI to enable and disable print marks. More...

#include <prnmks.h>

List of all members.

Public Member Functions

 PrintMarksMan ()
 Constructor for the PrintMarks Manager.
 ~PrintMarksMan ()
 Destruct the PrintMarks manager. We delete all remaining cached items here.
BOOL IsTemplateCached () const
 Return whether the disc based template file of marks has been cached once already.
BOOL ConstructCache ()
 Here we construct the cache afresh. Well almost afresh, we need to do the following.
void InvalidateCache ()
 Throws away the cache entirely. We unset the 'Template has been cached' variable which will result in a proper refiltering of the mark template file the next time we initialise.
BOOL AddMarkToDoc (UINT32 MarkHandle, Document *pDocument)
 Add a mark reference to the documents displayable printer marks.
BOOL RemoveMarkFromDoc (UINT32 MarkHandle, Document *pDocument)
 Removes the mark reference held in the print marks doc component inside this document.
void ConvertAllDocColours (Document *pDoc)
 Convert all the index colours in the document to local doc colours. This avoids problems with copying data out of the tree and deleting the index colours. What does this mean. Ok, if you make a copy of the print mark, put the copy in the PMM and delete the original document, you will delete the doc component colour list which contains all used index colour definitions. These index col defs contain usage counts which will be incremented during the copy. An attempt to delete all these index colours will cause an error (index colour still in use) even though its not in use in the document. Hence we need to remove all index colour references from the document before we make a copy. This is what the function does by making local doc colours.
BOOL AddDefaultMarksToDoc (Document *pDocument)
 Add all 'defaults to on' mark references to the documents displayable printer marks.
BOOL ShowPrintMarks (Document *ScopeDoc) const
 Determine if a docuemnt will output printers marks when printing.
void RenderPrintMarks (Document *ScopeDoc, BOOL DisplayEm=TRUE, BOOL LoadTemplateMarks=TRUE)
 Enable/Disable output of printers marks for the given document.
void RenderPrintMarks (PrintMarksComponent *pComp, RenderRegion *pRRegion, const Matrix &Transform, const DocRect &ClipRect, Spread *pSpread)
void StartPrinting ()
 Called from the print control system to tell the print mark manager that printing has started. Here we make sure all our print time local variables are set to default values.
BOOL AddPageRect (const DocRect &Rect)
 This function provides the ability to specify n page rectangles. Each of these rectangles will have crop marks positioned around the paper edge to line up with this rectangle. Hence the print system uses this function to specify the final positions of all the multi fit page rectangles during a print. We make sure we then create and render the right number of crop marks to fit this rectangle list.
void ResetPageRects ()
 Destroys the list of page rectangles the print marks manager caches.
void SetBleed (MILLIPOINT bleed)
 Tells the print marks manager what bleed to use during this print pass. This is usually a globally set value and is unlikely to change across plates or pages. We use the value to inflate the typesetting rect by.
void SetEmulsionDown (BOOL state)
 Tells the print marks manager which way up the emulsion is. This determins whether the marks manager will flip its marks during rendering or not.
void SetImagesettingRect ()
 Define the print marks rectangle. During a print this rectangle will determin where print marks will be placed. For instance if you are printing a 2x2 multiple fit page, the print marks rectangle will be the union of all these page tiles. Hence the print marks will be places around the entire print area. Crop marks will be placed in this area too but will be positioned to align with each page. Notes: The union of the PageRects, added while printing the current paper will give the imagesetting rectangle. Each one of these PageRects needs a set of crop marks.
void EndPrinting ()
 Called from the print control system to tell the print mark manager that printing has ended. Here we delete all the page rectangle positions added to our cached list.
MILLIPOINT GetCropMarkWidth (Document *ScopeDoc) const
void ClipToBleed (RenderRegion *pRRegion, Spread *pSpread)
 Export the bleed rectangle as the current clipping region. All graphics will be clipped to this region.

Public Attributes

PrintMarksCache PMMCache

Private Member Functions

 CC_DECLARE_MEMDUMP (PrintMarksMan)
void CompileMarkRegion (PrintMarksComponent *pComp, MarkRegion CurrRegion)
 Add all the marks which are supposedly in this region into the region and format em before rendering. What happens is this. Each mark reference in the doc component is found in the marks manager. The record in the marks manager describes the regions the mark should be formatted into. We add the mark if it happens to be the right region on entry. Adding the mark to the formatting region adds a position record which is used to render the mark when the region is rendered.
void RenderPrintMarksAroundRect (PrintMarksComponent *pComp, RenderRegion *pRRegion, const Matrix *pTrans, const DocRect &Rect, MILLIPOINT bleed)
 Render all user print marks contained in this doc component.
void RenderCropMarksAroundRect (RenderRegion *pRRegion, const Matrix *pTrans, const DocRect &Rect, MILLIPOINT bleed)
 Render all print marks contained in this doc component and the crop marks if they are enabled around the given rectangle.
MILLIPOINT AdjustedBleed () const
 Internal function to get the adjusted bleed value.

Private Attributes

BOOL TemplateCached
MarkFormatRegion MFRegion
DocRect ImagesettingRect
PageRectList PageRects
MILLIPOINT Bleed
BOOL EmulsionDown


Detailed Description

The 'Print Marks Manager'. This manager handles the installation, formatting and rendering of printer marks. It liaises with the print box to provide a UI to enable and disable print marks.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/07/96
See also:
Specification of print marks inside 'ImageSetting Phase 3' documentation

Definition at line 705 of file prnmks.h.


Constructor & Destructor Documentation

PrintMarksMan::PrintMarksMan  ) 
 

Constructor for the PrintMarks Manager.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/07/96

Definition at line 1782 of file prnmks.cpp.

01783 {
01784     Bleed = 0;
01785     TemplateCached=FALSE;
01786     EmulsionDown=FALSE;
01787 }

PrintMarksMan::~PrintMarksMan  ) 
 

Destruct the PrintMarks manager. We delete all remaining cached items here.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/07/96

Definition at line 1800 of file prnmks.cpp.

01801 {
01802 }


Member Function Documentation

BOOL PrintMarksMan::AddDefaultMarksToDoc Document pDocument  ) 
 

Add all 'defaults to on' mark references to the documents displayable printer marks.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/07/96
Parameters:
pDocument = a pointer to a document to add the default set to [INPUTS]
Returns:
TRUE if all 'defaults to on' marks have been added, FALSE if none have.

Definition at line 2103 of file prnmks.cpp.

02104 {
02105     ERROR3IF(pDocument==NULL,"NULL document pointer passed to AddDefaultMarks()");
02106     BOOL Added=FALSE;
02107     if (pDocument!=NULL)
02108     {
02109         // Get that print marks doc component
02110         PrintMarksComponent* pMarksComp = 
02111         (PrintMarksComponent*)pDocument->GetDocComponent(CC_RUNTIME_CLASS(PrintMarksComponent));
02112         if (pMarksComp && pMarksComp->IsVirgin())
02113         {
02114             // now go through each print mark and add it if necessary
02115             PrintMarkItem* pMarkItem = PMMCache.GetFirstMark();
02116             while (pMarkItem)
02117             {
02118                 // check to see if this mark is on by default
02119                 if (pMarkItem->DefaultsToOn())
02120                 {
02121                     // Add this item to the document
02122                     UINT32 handle = pMarkItem->GetHandle();
02123                     pMarksComp->AddMark(handle);
02124                 }
02125                 // find the next print mark item
02126                 pMarkItem = PMMCache.GetNextMark(pMarkItem);
02127             }
02128             // ok we've tried to add em.
02129             Added=TRUE;
02130         }
02131     }
02132     return Added;
02133 }

BOOL PrintMarksMan::AddMarkToDoc UINT32  MarkHandle,
Document pDocument
 

Add a mark reference to the documents displayable printer marks.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/07/96
Parameters:
MarkHandle = the handle of the mark to add [INPUTS] pDocument = a pointer to a document to add the mark to
Returns:
TRUE if the mark has been added, FALSE if not.

Definition at line 2024 of file prnmks.cpp.

02025 {
02026     ERROR2IF(pDocument==NULL,FALSE,"NULL document pointer passed to AddMarkToDoc!");
02027     // Sanity check, make sure this mark handle actually exists
02028     if (!PMMCache.FindMark(MarkHandle))
02029     {
02030         ERROR3("Illegal handle given to PrintMarksMan::AddMarkToDoc");
02031         return FALSE;
02032     }
02033 
02034     // ok, try to find the print marks component in this document.
02035     PrintMarksComponent* pComponent = 
02036     (PrintMarksComponent*)pDocument->GetDocComponent(CC_RUNTIME_CLASS(PrintMarksComponent));
02037     if (!pComponent)
02038     {
02039         ERROR3("We're stimmied, there's no PrintMarksComponent in this document!");
02040         return FALSE;
02041     }
02042 
02043     // super duper, we've got the doc component, so lets add our mark reference to
02044     // its list.
02045     return pComponent->AddMark(MarkHandle);
02046 }

BOOL PrintMarksMan::AddPageRect const DocRect rect  ) 
 

This function provides the ability to specify n page rectangles. Each of these rectangles will have crop marks positioned around the paper edge to line up with this rectangle. Hence the print system uses this function to specify the final positions of all the multi fit page rectangles during a print. We make sure we then create and render the right number of crop marks to fit this rectangle list.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/07/96
Parameters:
rect = a document rectangle specifying the a pages position in the [INPUTS] print paper coordinate system
Returns:
-
See also:
ScreenView::EnumeratePagePatches().

Definition at line 2265 of file prnmks.cpp.

02266 {
02267     // add this rectangle
02268     return PageRects.AddPageRect(rect);
02269 }

MILLIPOINT PrintMarksMan::AdjustedBleed  )  const [private]
 

Internal function to get the adjusted bleed value.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/07/96
Parameters:
- [INPUTS]
Returns:
the size of the bleed as we know it

Definition at line 2324 of file prnmks.cpp.

02325 {
02326     return (Bleed+OUTSIDEBLEEDWIDTH);
02327 }

PrintMarksMan::CC_DECLARE_MEMDUMP PrintMarksMan   )  [private]
 

void PrintMarksMan::ClipToBleed RenderRegion pRRegion,
Spread pSpread
 

Export the bleed rectangle as the current clipping region. All graphics will be clipped to this region.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/8/96
Parameters:
pRRegion = a pointer to a render region [INPUTS] Pass in NULL to use the selected doc.
Returns:
-

Definition at line 2515 of file prnmks.cpp.

02516 {
02517     // if any of these are null we can't do the job
02518     if (pRRegion==NULL)
02519         return;
02520 
02521     // if there's no imagesetting rect to render around we can't position our marks
02522     if (ImagesettingRect.IsEmpty())
02523         return;
02524 
02525     // do we need to display our marks?
02526     if ( !ShowPrintMarks( (Document *) (pSpread->FindOwnerDoc()) ) )
02527         return;
02528 
02529 PORTNOTE("printing", "disabled print mark generation use of PrintPSRenderRegion")
02530 #ifndef EXCLUDE_FROM_XARALX
02531     // dont render to a none postscript region
02532     if ( !IS_A(pRRegion, PrintPSRenderRegion) )
02533         return;
02534 
02535     // BODGE ALERT...
02536     // Clip everything else to this imagesetting rectangle
02537 
02538     // Go get the adjusted bleed
02539     MILLIPOINT adjbleed = AdjustedBleed();
02540     DocRect Rect = ImagesettingRect;
02541     Rect.Inflate(adjbleed);
02542     PSPrintDC *pPrintDC = (PSPrintDC*)pRRegion->GetRenderDC();
02543     ((PrintPSRenderRegion*)pRRegion)->WriteClipRegion(pPrintDC, Rect);
02544 
02545     // BODGE ALERT
02546     // Mike 02/09/96 - We should be performing stacked clipping. This is not the place
02547     //                 to alter the postscript clip region but if will suffice for now.
02548 #endif
02549 }

void PrintMarksMan::CompileMarkRegion PrintMarksComponent pComp,
MarkRegion  CurrRegion
[private]
 

Add all the marks which are supposedly in this region into the region and format em before rendering. What happens is this. Each mark reference in the doc component is found in the marks manager. The record in the marks manager describes the regions the mark should be formatted into. We add the mark if it happens to be the right region on entry. Adding the mark to the formatting region adds a position record which is used to render the mark when the region is rendered.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/08/96
Parameters:
pComp = the document component containing the print marks [INPUTS] CurrRegion = the current region we're formatting marks in
Returns:
-

Definition at line 2893 of file prnmks.cpp.

02894 {
02895     UINT32 handle;
02896     // Dig the mark reference out of this doc component.
02897     DocPrintMark* pDocMark = pComp->GetFirstMark();
02898     while (pDocMark)
02899     {
02900         // retrieve the reference handle of this mark
02901         handle=pDocMark->GetHandle();
02902 
02903         // find the mark item in the print marks cache
02904         PrintMarkItem* pMarkItem = PMMCache.FindMark(handle);
02905         if (pMarkItem && pMarkItem->NeedsToRender())
02906         {
02907             // ok we have a pointer to the mark item. Scan through all its format
02908             // positions and add the mark if necessary
02909             PrintMark* pPrintMark = pMarkItem->GetPrintMark();
02910             if (pPrintMark)
02911             {
02912                 MarkPosition* pMarkPosition = pPrintMark->GetFirstPosition();
02913                 while (pMarkPosition!=NULL)
02914                 {
02915                     if (pMarkPosition->GetRegion()==CurrRegion)
02916                     {
02917                         MarkFormat LocalFormat = pMarkPosition->GetFormat();
02918                         MFRegion.AddMark(pMarkItem, &LocalFormat);
02919                     }
02920 
02921                     pMarkPosition = pPrintMark->GetNextPosition(pMarkPosition);
02922                 }
02923             }
02924         }
02925 
02926         // go onto format and render the next object
02927         pDocMark = pComp->GetNextMark(pDocMark);
02928     }
02929 }

BOOL PrintMarksMan::ConstructCache  ) 
 

Here we construct the cache afresh. Well almost afresh, we need to do the following.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/07/96
(1) find the disc file containing our marks (2) load the file as a document (3) convert all index colours used in objects to lookalike doc colours (4) enumerate each layer and decode the layer name (5) find the group inside the layer which contains the mark (6) make a copy of this information as a PrintMarkItem (7) merge the PrintMarkItem with the current contents of the cache. This is v.important as there will be valuable information already in the cache we don't want to lose. (8) destroy the document on completion (or partial completion==failure)

easy really. We use various lower level functions to perform all of course.

Definition at line 1850 of file prnmks.cpp.

01851 {
01852     // If its already cached then ignore this call.
01853     if (TemplateCached)
01854         return TRUE;
01855 
01856     BOOL ok=FALSE;
01857     // otherwise do some serious stuff.
01858     TCHAR SearchFile[] = _T("mrktmpl.xar");
01859 //  TCHAR *OutputBuff = new TCHAR[_MAX_PATH];
01860     if (1 /*OutputBuff*/)
01861     {
01862         LoadPrintMarks LdPrintMark;
01863         // try to find the search file...
01864         StringVar s(CamResource::GetResourceFilePath(SearchFile));
01865 PORTNOTE("other", "Disabled printmark resource file finding")
01866 #ifndef EXCLUDE_FROM_XARALX
01867         ok = FileUtil::FindResourceFile(SearchFile, OutputBuff);
01868 #endif
01869         // Add a crop mark bits.
01870         ok = ok && PMMCache.CreateCropMark();
01871         // Add a text info mark too.
01872         ok = ok && PMMCache.CreateTextInfoMark();
01873         // Get the winoil level direct loader to do its stuff
01874         ok = ok && LdPrintMark.Execute(s);
01875         // delete the allocated buffer
01876 //      delete OutputBuff;
01877     }
01878     // return all is well/not well
01879     return (TemplateCached=ok);
01880 }

void PrintMarksMan::ConvertAllDocColours Document pDoc  ) 
 

Convert all the index colours in the document to local doc colours. This avoids problems with copying data out of the tree and deleting the index colours. What does this mean. Ok, if you make a copy of the print mark, put the copy in the PMM and delete the original document, you will delete the doc component colour list which contains all used index colour definitions. These index col defs contain usage counts which will be incremented during the copy. An attempt to delete all these index colours will cause an error (index colour still in use) even though its not in use in the document. Hence we need to remove all index colour references from the document before we make a copy. This is what the function does by making local doc colours.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com> / Mike
Date:
31/07/96

Definition at line 1938 of file prnmks.cpp.

01939 {
01940     ERROR3IF(pDoc==NULL,"No doc pointer during PrintMarksMan::ConvertAllDocColours!");
01941 
01942     Node *CurNode = Node::DocFindFirstDepthFirst(pDoc);
01943     Node *NextNode;
01944 
01945     while (CurNode !=NULL)
01946     {
01947         // We may be about to chop this node out of the tree, so get the next node now
01948         NextNode = CurNode->DocFindNextDepthFirst();
01949 
01950         // Use to scan the colour fields of the attribute.
01951         UINT32 Context = 0;
01952         DocColour *pColour;
01953 
01954         if (CurNode->IsAnAttribute())
01955         {
01956             NodeAttribute *pNodeAttr = (NodeAttribute *) CurNode;
01957 
01958             // Get the next colour field from the attribute
01959             pColour = pNodeAttr->EnumerateColourFields(Context++);
01960 
01961             while (pColour != NULL)
01962             {
01963                 // For each colour field, make sure the colour is a local DocColour so that
01964                 // the sub-tree is entirely stand-alone
01965                 if (pColour->FindParentIndexedColour() != NULL)
01966                 {
01967                     ColourGeneric ColDef;
01968                     ColourContext *cc = ColourManager::GetColourContext(pColour->GetColourModel());
01969                     ERROR3IF(cc == NULL, "Can't find colour context?!");
01970 
01971                     // Get the IndexedColour definition as a standalone colour definition
01972                     cc->ConvertColour(pColour->FindParentIndexedColour(), &ColDef);
01973 
01974                     // Make the DocColour into a simple standalone "lookalike" of the parent colour
01975                     *pColour = DocColour(pColour->GetColourModel(), &ColDef);
01976                 }
01977 
01978                 pColour = pNodeAttr->EnumerateColourFields(Context++);
01979             }
01980         }
01981         CurNode = NextNode;
01982     }
01983 }

void PrintMarksMan::EndPrinting  ) 
 

Called from the print control system to tell the print mark manager that printing has ended. Here we delete all the page rectangle positions added to our cached list.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/07/96
Parameters:
- [INPUTS]
Returns:
-

Definition at line 2218 of file prnmks.cpp.

02219 {
02220     PageRects.DeleteAll();
02221     ImagesettingRect.MakeEmpty();
02222 }

MILLIPOINT PrintMarksMan::GetCropMarkWidth Document ScopeDoc  )  const
 

Definition at line 2392 of file prnmks.cpp.

02393 {
02394     if (ShowPrintMarks(ScopeDoc))
02395         return (CROPMARK_LENGTH + OUTSIDEBLEEDWIDTH);
02396     else
02397         return 0;
02398 }

void PrintMarksMan::InvalidateCache void   ) 
 

Throws away the cache entirely. We unset the 'Template has been cached' variable which will result in a proper refiltering of the mark template file the next time we initialise.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/07/96
Parameters:
- [INPUTS]
Returns:
-

Definition at line 2000 of file prnmks.cpp.

02001 {
02002     // Force a proper recache next time the marks are accessed
02003     TemplateCached=FALSE;
02004     // Destroy everything in the current marks list
02005     PMMCache.Invalidate();
02006 }

BOOL PrintMarksMan::IsTemplateCached  )  const
 

Return whether the disc based template file of marks has been cached once already.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/07/96
Returns:
TRUE if we've cached the print marks template once during the life of the program FALSE if not.

Definition at line 1819 of file prnmks.cpp.

01820 {
01821     return TemplateCached;
01822 }

BOOL PrintMarksMan::RemoveMarkFromDoc UINT32  MarkHandle,
Document pDocument
 

Removes the mark reference held in the print marks doc component inside this document.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/07/96
Parameters:
MarkHandle = the handle of the mark to remove [INPUTS] pDocument = a pointer to a document to remove the mark from
Returns:
TRUE if the mark has been removed FALSE if not. This result will occur only when the document does not contain a print marks component or I cannot find the specified mark. If the mark exists it will never fail to be removed.

Definition at line 2068 of file prnmks.cpp.

02069 {
02070     ERROR2IF(pDocument==NULL,FALSE,"NULL document pointer passed to AddMarkToDoc!");
02071     // ok, try to find the print marks component in this document.
02072     PrintMarksComponent* pComponent = 
02073     (PrintMarksComponent*)pDocument->GetDocComponent(CC_RUNTIME_CLASS(PrintMarksComponent));
02074     if (!pComponent)
02075     {
02076         ERROR3("We're stimmied, there's no PrintMarksComponent in this document!");
02077         return FALSE;
02078     }
02079 
02080     // super duper, we've got the doc component, so lets add our mark reference to
02081     // its list.
02082     pComponent->RemoveMark(MarkHandle);
02083     return TRUE;
02084 }

void PrintMarksMan::RenderCropMarksAroundRect RenderRegion pRRegion,
const Matrix pTrans,
const DocRect Rect,
MILLIPOINT  bleed
[private]
 

Render all print marks contained in this doc component and the crop marks if they are enabled around the given rectangle.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/08/96
Parameters:
pRRegion= the render region to draw in [INPUTS] pSpread = the spread to draw
Returns:

Definition at line 2570 of file prnmks.cpp.

02574 {
02575     // create a cropline path and set it up
02576     Path CropLine;
02577     if (!CropLine.Initialise())
02578         return;
02579 
02580     // an extra bit we pust the marks out by if the bleed is zero       
02581     INT32 ExtraBit = 0;
02582     if (bleed==0)
02583         ExtraBit = 2384;
02584 
02585     // transform the rectangle if necessary
02586     DocRect TransformedRect(Rect);
02587     TransformedRect.Inflate(bleed+ExtraBit);
02588     if (pTrans)
02589     {
02590         pTrans->transform(&TransformedRect.lo);
02591         pTrans->transform(&TransformedRect.hi);
02592     }
02593 
02594     MILLIPOINT Tmp;
02595 
02596     if (TransformedRect.lo.x > TransformedRect.hi.x)
02597     {
02598         Tmp = TransformedRect.lo.x;
02599         TransformedRect.lo.x = TransformedRect.hi.x;
02600         TransformedRect.hi.x = Tmp;
02601     }
02602 
02603     if (TransformedRect.lo.y > TransformedRect.hi.y)
02604     {
02605         Tmp = TransformedRect.lo.y;
02606         TransformedRect.lo.y = TransformedRect.hi.y;
02607         TransformedRect.hi.y = Tmp;
02608     }
02609 
02610     // Calculate the inverse of the render matrix, this allows us to render
02611     // through a scaling render region and prevent our marks being scaled.
02612     Matrix ViewTrans = pRRegion->GetMatrix();
02613     ViewTrans = ViewTrans.Inverse();
02614 
02615     // get the cropmark length
02616     INT32 Length = CROPMARK_LENGTH;
02617     double Thickness = CROPMARK_THICKNESS;
02618 
02619     // now adjust it a little as we may be pushing the cropmarks out
02620     // by 1mm and taking 1mm off the length. This is only done when there
02621     // is no bleed set and means the cropmarks don't touch each other.
02622     Length -= ExtraBit;
02623     if (Length<1) Length=1;
02624 
02625     // ok we need to scale the thickness dependent on the current scale
02626     // facter within this render region otherwise, the region will scale it
02627     // for us which would be real bad stuff indeed.
02628     FIXED16 CurrScale;
02629     ViewTrans.Decompose(&CurrScale);
02630     double scale = CurrScale.MakeDouble();
02631     // Emulsion down does its stuff by getting the render matrix to flip about
02632     // the Y axis. This shows up in the scale as a negative value returned. We
02633     // need the absoulte scale.
02634     if (scale<0) scale = -scale;
02635     Thickness = Thickness*scale;
02636     INT32 Thick = (INT32)(Thickness+0.5);
02637     if (Thick<1) Thick=1;
02638 
02639     // start setting attributes in this render context
02640     pRRegion->SaveContext();
02641     pRRegion->SetLineColour(COLOUR_BLACK);
02642     pRRegion->SetLineWidth(Thick);
02643 
02644     // Set up some dummy data
02645     CropLine.AddMoveTo(DocCoord(0,0));
02646     CropLine.AddLineTo(DocCoord(72000,0));
02647     // Get the coords array in our cropline path
02648     DocCoord *Coords = CropLine.GetCoordArray();
02649 
02650     // go through all our registered page rectangles and generate
02651     DocCoord iLo = TransformedRect.lo;
02652     DocCoord iHi = TransformedRect.hi;
02653 
02654     // process all our page rectangles
02655     PageRect *pRect = PageRects.GetFirstPageRect();
02656     DocCoord p0,p1,rLo,rHi;
02657 
02658     // ok finally render them all
02659 #define LINEDRAW(p,q) \
02660         ViewTrans.transform(&p); \
02661         ViewTrans.transform(&q); \
02662         Coords[0]=p;  \
02663         Coords[1]=q;  \
02664         pRRegion->DrawPath(&CropLine);
02665     
02666     while (pRect)
02667     {
02668         rLo = pRect->Rect.lo;
02669         rHi = pRect->Rect.hi;
02670 
02671         p0.x = iLo.x; 
02672         p1.x = iLo.x - Length;
02673         p0.y = p1.y = rLo.y;
02674         LINEDRAW(p0,p1);
02675         p0.x = iLo.x; 
02676         p1.x = iLo.x - Length;
02677         p0.y = p1.y = rHi.y;
02678         LINEDRAW(p0,p1);
02679         
02680         p0.y = iHi.y;
02681         p1.y = iHi.y + Length;
02682         p0.x = p1.x = rLo.x;
02683         LINEDRAW(p0,p1);
02684         p0.y = iHi.y;
02685         p1.y = iHi.y + Length;
02686         p0.x = p1.x = rHi.x;
02687         LINEDRAW(p0,p1);
02688     
02689         p0.x = iHi.x;
02690         p1.x = iHi.x + Length;
02691         p0.y = p1.y = rHi.y;
02692         LINEDRAW(p0,p1);
02693         p0.x = iHi.x;
02694         p1.x = iHi.x + Length;
02695         p0.y = p1.y = rLo.y;
02696         LINEDRAW(p0,p1);
02697 
02698         p0.y = iLo.y;
02699         p1.y = iLo.y - Length;
02700         p0.x = p1.x = rHi.x;
02701         LINEDRAW(p0,p1);
02702         p0.y = iLo.y;
02703         p1.y = iLo.y - Length;
02704         p0.x = p1.x = rLo.x;
02705         LINEDRAW(p0,p1);
02706 
02707         pRect = PageRects.GetNextPageRect(pRect);
02708     }
02709 
02710 #undef LINEDRAW
02711 
02712     // pop the attribute context again
02713     pRRegion->RestoreContext();
02714 }

void PrintMarksMan::RenderPrintMarks PrintMarksComponent pComp,
RenderRegion pRRegion,
const Matrix Transform,
const DocRect ClipRect,
Spread pSpread
 

Definition at line 2420 of file prnmks.cpp.

02425 {
02426     // if any of these are null we can't do the job
02427     if (pComp==NULL || pRRegion==NULL || pSpread==NULL)
02428         return;
02429 
02430     // do we need to display our marks?
02431     if ( !ShowPrintMarks( (Document *) (pSpread->FindOwnerDoc()) ) )
02432         return;
02433 
02434     // if there's no imagesetting rect to render around we can't position our marks
02435     if (ImagesettingRect.IsEmpty())
02436         return;
02437 
02438     // Go get the adjusted bleed
02439     MILLIPOINT adjbleed = AdjustedBleed();
02440 
02441     // is this region a postscript render region?
02442 PORTNOTE("printing", "disabled print mark generation use of PrintPSRenderRegion")
02443 #ifndef EXCLUDE_FROM_XARALX
02444     BOOL OldClipState = FALSE;
02445     BOOL IsPostScript = pRRegion->IS_KIND_OF(PrintPSRenderRegion);
02446     PSPrintDC *pPrintDC = NULL;
02447 
02448     // configure the postscript clipping region
02449     if (IsPostScript)
02450     {
02451         // Get the render DC
02452         pPrintDC = (PSPrintDC*)pRRegion->GetRenderDC();
02453         if (pPrintDC==NULL)
02454             return;
02455 
02456         // Disable the print clipping for the moment
02457         OldClipState = pPrintDC->SetClipping(FALSE);
02458     }
02459 #endif      
02460 
02461     // check for any user doc marks
02462     DocPrintMark* pDocMark = pComp->GetFirstMark();
02463     if (pDocMark!=NULL)
02464     {
02465         // Update the text info mark now. This builds the time/date etc.
02466         Document* pDoc = Document::GetSelected();
02467         PMMCache.UpdateTextInfoMark(pDoc, pRRegion);
02468 
02469         // get the bleed size used in this spread
02470         RenderPrintMarksAroundRect(pComp, pRRegion, NULL, ImagesettingRect, adjbleed);
02471 
02472         // ok are crop marks created?
02473         if (PMMCache.CropMarkHandle>0)
02474         {
02475             // and are they in this document component?
02476             if (pComp->FindMark(PMMCache.CropMarkHandle)!=NULL)
02477                 RenderCropMarksAroundRect(pRRegion, NULL, ImagesettingRect, adjbleed);
02478         }
02479     }
02480 
02481 PORTNOTE("printing", "disabled print mark generation use of PrintPSRenderRegion")
02482 #ifndef EXCLUDE_FROM_XARALX
02483     // finalise any bleed area clipping in PostScript
02484     if (IsPostScript)
02485     {
02486         if (pPrintDC)
02487         {
02488             // Reset the clipping state of affairs.
02489             pPrintDC->SetClipping(TRUE); //OldClipState);
02490             // Export the cliptobleed stuff
02491             pPrintDC->OutputPSClipping();
02492             // ClipToBleed(pRRegion,pSpread);
02493         }
02494     }
02495 #endif
02496 }

void PrintMarksMan::RenderPrintMarks Document ScopeDoc,
BOOL  DisplayEm = TRUE,
BOOL  UpdateCache = TRUE
 

Enable/Disable output of printers marks for the given document.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>/Jason
Date:
... / 28/8/96
Parameters:
ScopeDoc - points to the document for which you want to find out. [INPUTS] Pass in NULL to use the selected doc.
DisplayEm - TRUE to enable, FALSE to disable, printing of printers marks

LoadTemplateMarks - TRUE to ensure that the printers marks are cached in the PMM, or FALSE to merely enable/disable printing thereof. Note that if the PMM cache is not initialised, then no print marks are available, and hence this variable defaults to TRUE. If they're already cached, nothing is done.

See also:
PrinterMarksMan::ShowPrintMarks; TypesetInfo::SetOutputPrintersMarks

Definition at line 2352 of file prnmks.cpp.

02353 {
02354     TypesetInfo *pInfo = TypesetInfo::FindTypesetInfoForDoc(ScopeDoc);
02355     if (pInfo != NULL)
02356         pInfo->SetOutputPrintersMarks(DisplayEm);
02357 
02358     if (DisplayEm && UpdateCache)
02359         ConstructCache();
02360 }

void PrintMarksMan::RenderPrintMarksAroundRect PrintMarksComponent pComp,
RenderRegion pRRegion,
const Matrix pTrans,
const DocRect Rect,
MILLIPOINT  bleed
[private]
 

Render all user print marks contained in this doc component.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/08/96
Parameters:
pComp = the document component containing the print marks [INPUTS] pRRegion= the render region to draw in pSpread = the spread to draw
Returns:

Definition at line 2738 of file prnmks.cpp.

02743 {
02744     pRRegion->SaveContext();
02745 
02746     // transform the rectangle if necessary
02747     DocRect TransformedRect(Rect);
02748     if (pTrans)
02749     {
02750         pTrans->transform(&TransformedRect.lo);
02751         pTrans->transform(&TransformedRect.hi);
02752     }
02753 
02754     // construct all 16 regions around this page rect
02755     PageMarkRegions MyPageRegions;
02756     MyPageRegions.Initialise(TransformedRect,bleed);
02757     Matrix OuterTransform;
02758     if (EmulsionDown)
02759     {
02760         DocRect Rect = TransformedRect;
02761         Rect.Inflate(bleed);
02762         INT32 w = Rect.Width();
02763         OuterTransform *= Matrix(-Rect.lo);
02764         OuterTransform *= Matrix(FIXED16(-1), FIXED16(0), FIXED16(0), FIXED16(1), w, 0);
02765         OuterTransform *= Matrix(Rect.lo);
02766     }
02767 
02768     for (INT32 i=0; i<MAXPAGEREGIONS; i++)
02769     {
02770         if (MyPageRegions.Region[i].Valid)
02771         {
02772             // Make sure the formatting region is empty first
02773             MFRegion.Empty();
02774             MFRegion.SetPosition(MyPageRegions.Region[i].Pos);
02775             MFRegion.SetOrientation(MyPageRegions.Region[i].OrientX);
02776 //          MFRegion.SetFlipRender(EmulsionDown);
02777             CompileMarkRegion(pComp, (MarkRegion)i );
02778             MFRegion.Render(pRRegion,OuterTransform);
02779         }
02780     }   
02781     // pop the attribute context again
02782     pRRegion->RestoreContext();
02783 }

void PrintMarksMan::ResetPageRects  ) 
 

Destroys the list of page rectangles the print marks manager caches.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/07/96
Parameters:
- [INPUTS]
Returns:
-

Definition at line 2305 of file prnmks.cpp.

02306 {
02307     PageRects.DeleteAll();
02308 }

void PrintMarksMan::SetBleed MILLIPOINT  bleed  ) 
 

Tells the print marks manager what bleed to use during this print pass. This is usually a globally set value and is unlikely to change across plates or pages. We use the value to inflate the typesetting rect by.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/07/96
Parameters:
bleed = the bleed used during this print [INPUTS]
Returns:
-

Definition at line 2240 of file prnmks.cpp.

02241 {
02242     Bleed=bleed;
02243 }

void PrintMarksMan::SetEmulsionDown BOOL  state  ) 
 

Tells the print marks manager which way up the emulsion is. This determins whether the marks manager will flip its marks during rendering or not.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/07/96
Parameters:
state = the new state of the emulsion down flag the print marks manager [INPUTS] will use during this print
Returns:
-

Definition at line 2287 of file prnmks.cpp.

02288 {
02289     EmulsionDown=state;
02290 }   

void PrintMarksMan::SetImagesettingRect  ) 
 

Define the print marks rectangle. During a print this rectangle will determin where print marks will be placed. For instance if you are printing a 2x2 multiple fit page, the print marks rectangle will be the union of all these page tiles. Hence the print marks will be places around the entire print area. Crop marks will be placed in this area too but will be positioned to align with each page. Notes: The union of the PageRects, added while printing the current paper will give the imagesetting rectangle. Each one of these PageRects needs a set of crop marks.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/07/96
Parameters:
- [INPUTS]
Returns:
-

Definition at line 2161 of file prnmks.cpp.

02162 {
02163     ImagesettingRect.MakeEmpty();
02164     PageRect* pRect = PageRects.GetFirstPageRect();
02165     while (pRect)
02166     {
02167         ImagesettingRect = ImagesettingRect.Union(pRect->Rect);
02168         pRect = PageRects.GetNextPageRect(pRect);
02169     }
02170 }

BOOL PrintMarksMan::ShowPrintMarks Document ScopeDoc  )  const
 

Determine if a docuemnt will output printers marks when printing.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/8/96
Parameters:
ScopeDoc - points to the document for which you want to find out. [INPUTS] Pass in NULL to use the selected doc.
Returns:
TRUE if printers marks will be output when printing this document
See also:
PrinterMarksMan::RenderPrintMarks; TypesetInfo::SetOutputPrintersMarks

Definition at line 2382 of file prnmks.cpp.

02383 {
02384     TypesetInfo *pInfo = TypesetInfo::FindTypesetInfoForDoc(ScopeDoc);
02385     if (pInfo != NULL)
02386         return(pInfo->OutputPrintersMarks());
02387 
02388     return(FALSE);
02389 }

void PrintMarksMan::StartPrinting  ) 
 

Called from the print control system to tell the print mark manager that printing has started. Here we make sure all our print time local variables are set to default values.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/07/96
Parameters:
- [INPUTS]
Returns:
-

Definition at line 2189 of file prnmks.cpp.

02190 {
02191     // destroy the current set of rectangles
02192     PageRects.DeleteAll();
02193     ImagesettingRect.MakeEmpty();
02194     EmulsionDown=FALSE;
02195     Bleed=0;
02196     // now cache the print time
02197     CCTime MyTime;
02198     PMMCache.CachedTime.Empty();
02199     String_64 TimeFormat(_T("%dy/%mt/%yr  %th.%mn %pm"));
02200     MyTime.ConvertStandardDateAndTime(&TimeFormat, &PMMCache.CachedTime);
02201 }


Member Data Documentation

MILLIPOINT PrintMarksMan::Bleed [private]
 

Definition at line 763 of file prnmks.h.

BOOL PrintMarksMan::EmulsionDown [private]
 

Definition at line 764 of file prnmks.h.

DocRect PrintMarksMan::ImagesettingRect [private]
 

Definition at line 761 of file prnmks.h.

MarkFormatRegion PrintMarksMan::MFRegion [private]
 

Definition at line 760 of file prnmks.h.

PageRectList PrintMarksMan::PageRects [private]
 

Definition at line 762 of file prnmks.h.

PrintMarksCache PrintMarksMan::PMMCache
 

Definition at line 710 of file prnmks.h.

BOOL PrintMarksMan::TemplateCached [private]
 

Definition at line 757 of file prnmks.h.


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