View Class Reference

The basic kernel view item. This class contains minimal functionality to maintain the 'current' view, and the connection from a kernel view object to an OIL view object. DocView and PrintView are derived from this class. More...

#include <view.h>

Inheritance diagram for View:

ListItem CCObject SimpleCCObject ClipboardView DialogView DocView ExpressView MetafileView PrintView XPFView List of all members.

Public Member Functions

 View ()
 Initialise a View object.
virtual ~View ()
 Cleans up a view object.
BOOL ConnectToOilView (CCamView *)
 To set up the bi-directional connection between the OIL view object and the View. The OIL view object causes the creation of the View and so already has a pointer to it when it calls this routine to set up the connection in the other direction.
DocumentGetDoc () const
 Returns the linake between this View and its Document.
CCamViewGetConnectionToOilView () const
 To get a pointer to the OIL view object which mirrors this one. Note that this can return NULL if the View does not have a mirroring OIL object. In this case the view is closed but the View remains available so that in the future a new view will be able to use all of its viewing parameters.
PrintControlGetPrintControl ()
 Simple way of getting the PrintControl object associated with this view's document.
virtual void SetViewState (ViewState *)
 Sets the structure which is shared by both View and the OIL view object to which it is connected. NB. PrintViews do NOT share the ViewState with the OIL view, because the OIL view is the screen based view, so the PrintView is the only one that needs to use the view state. The CCamView always uses the ViewState of its DocView, not its PrintView.
virtual BOOL ViewStateChanged ()=0
BOOL SetCurrent ()
 Make this object be the 'current' View.
virtual void SetViewPixelSize ()=0
void OnDraw (wxDC *, OilRect)
 Do the drawing, guv.
virtual void ContinueRenderView (RenderRegion *, Spread *, BOOL fRenderPaper=TRUE, BOOL fDeleteRegionAfter=TRUE, BOOL bForceImmediate=FALSE)=0
virtual wxDC * GetRenderDC ()=0
virtual void AllocateDC ()
 Hints that we've done with our DC.
virtual void DoneWithDC ()
 Hints that we've done with our DC.
virtual BOOL RenderTreeCallback (Node *pNode, RenderRegion *pRender)
RenderViewResult RenderOptimalView (RenderRegion *r, Matrix &, Spread *, BOOL)
 This function has been designed along similar lines to the RenderView() function found elsewhere in this file. This version of the function is slightly different though. This version of the function is able to render complex objects, such as transparent objects into normal render regions. It does this by first scanning through all the objects that need rendering to see if any of them require complex things. If they do, then part of the rendering is done into a bitmap and blitted over the rest of the shapes using a masked blit. All very complicated really! This is the optimal version of this function, that will render individual complex shapes to the device instead of building them all up and blitting them in one go. This will produce the best quality results as as many objects as possible will be rendered to the resolution of the device.
SlowJobResult RenderOptimalBitmapPhase (DocRect &ClipRect, Matrix &, Spread *, RenderRegion *, Node *, Node *, BOOL RenderAllObjects, BOOL bPrintPaper, INT32 &, ProgressDisplay *pProgress, INT32 TotalProgress)
 Renders the masked bitmap part of the process. This function will get called many times during the typical rendering of the document (once for each run of complex nodes in the document).
virtual RenderViewResult RenderSimpleView (RenderRegion *, Matrix &, Spread *, BOOL)
 This function has been designed along similar lines to the RenderView() function found elsewhere in this file. This version of the function is slightly different though. This version of the function is able to render complex objects, such as transparent objects into normal render regions. It does this by first scanning through all the objects that need rendering to see if any of them require complex things. If they do, then part of the rendering is done into a bitmap and blitted over the rest of the shapes using a masked blit. All very complicated really!
SlowJobResult RenderBitmapPhase (DocRect &ClipRect, Matrix &, Spread *, RenderRegion *, Node *, Node *, BOOL bRenderAll, BOOL bPrintPaper, ProgressDisplay &Progress)
 This function is called from RenderSimpleView if it ends up having to do the 3 phase rendering system. This function performs the bitmap phase, where all the objects deemed to be complex by the Host render region are rendered into a bitmap using GDraw and a mono, mask bitmap. The bitmap is blitted into the host render region using the mask bitmap, minimising the amount of bitmaps ending up in the view (important for things like postscript that do not really like bitmaps very much).
virtual void RenderPaper (Spread *, DocRect, wxDC *, Matrix &)
 Actually renders the paper onto the screen. Moved from 'MakeNewRenderRegion' so that it can be called from outside (eg. ResetRegion).
virtual BOOL RenderPageMarks (RenderRegion *, Matrix &, DocRect &, Spread *)
 Performs the rendering of page marks, ie crop marks, registration marks etc to the screen and printer. This base class version does nothing. All mark rendering technology is held in DocView and PrintView.
virtual BOOL GetForeBackMode ()=0
virtual void SetForeBackMode (BOOL)=0
virtual Matrix ConstructRenderingMatrix (Spread *pSpread)
 From the given spread, construct a matrix that will convert spread coordinates to OS coordinates.
virtual Matrix ConstructScaledRenderingMatrix (Spread *pSpread, double ScaleFactor)
 Create a rendermatrix at ScaleFactor precision of the current Scale Allows you to create a bitmap with higher/lower resolution than the current view eg used to create a bitmap of a given invalid region at double the current zoom factor (ie synonymous concept to "double resolution" or "double DPI").
FIXED16 GetPixelWidth ()
 Get the width of a pixel in this view.
FIXED16 GetPixelHeight ()
 Get the height of a pixel in this view.
void GetPixelSize (FIXED16 *PixelWidth, FIXED16 *PixelHeight)
 Get the size of a pixel in this view.
virtual void SetPixelSize (FIXED16 PixelWidth, FIXED16 PixelHeight)
 Set the size of a pixel in this view.
FIXED16 GetScaledPixelWidth ()
 Get the width of a scaled pixel in this view.
FIXED16 GetScaledPixelHeight ()
 Get the height of a scaled pixel in this view.
void GetScaledPixelSize (FIXED16 *PixelWidth, FIXED16 *PixelHeight)
 Get the size of a scaled pixel in this view.
virtual void SetScaledPixelSize (FIXED16 PixelWidth, FIXED16 PixelHeight)
 Set the size of a scaled pixel in this view.
virtual double GetConvertToEditableShapesDPI ()
 Allows derived view classes to override the reolution.
ColourContextGetColourContext (ColourModel Model, BOOL ReturnNULLIfNone=FALSE)
 To find an appropriate colour context in the given colour model for use when rendering into this view. This allows us to control colour separation and correction down to a per-view level.
ColourPlateGetColourPlate (void)
 To find out what colour separation options are currently in use by this view.
void SetColourPlate (ColourPlate *NewPlate, BOOL bSendContextChanged=TRUE)
 Sets a new colour plate (colour separation description for this view. Any future requests for colour contexts for this view (e.g. the next time it is redrawn, etc) will return a ColourContext using this new ColourPlate.
void SetColourContext (ColourModel Model, ColourContext *NewContext=NULL)
 Sets a new colour context for this view.
BOOL GetForceDefaultColourContexts (void)
BOOL SetForceDefaultColourContexts (BOOL bForceDefault=TRUE)
WorkCoord GetScrollOffsets () const
 To find the position of the top left corner of the display.
virtual BOOL SetScrollOffsets (WorkCoord, BOOL RedrawNeeded=TRUE)
 To scroll this view to a new position over the document. The coordinate supplied is the coordinate of the top left corner of the viewport onto the document. The RedrawNeeded flag is TRUE when any invalid areas created should be redrawn immediately and FALSE if they should be ignored.
FIXED16 GetViewScale () const
 Inquire the viewing scale factor from this View.
virtual BOOL SetViewScale (FIXED16)
 Set the viewing scale factor for this view. (Also, sets up the scaled pixel size in DocCoord if this View is current.
virtual DocRect GetDocViewRect (Spread *)=0
virtual void SetExtent (DocCoord, DocCoord)=0
virtual WorkRect GetViewRect ()=0

Static Public Member Functions

static void Deinit ()
 De-initialises the view system. At the moment this involves destroying our PaperRenderRegion.
static ViewGetCurrent ()
 Find the current View object which SHOULD have been set as one of the very first actions during event processing.
static void SetNoCurrent ()
 Set the current View pointer to be NULL, i.e., there is no current View object.
static void DeInitOnTopRegion ()
 Deinitialises the static OnTop RenderRegion, used for blob rendering.
static BOOL IsPrintableNodeSelected (Node *)
 Determine whether a given node should be rendered when we are printing with "selected objects only" enabled. It checks to see if the node is bounded - if it isn't, then it's an attribute or similar and so is always rendered. If it is bounded then return TRUE if it is selected or if it is the child of a selected object. Otherwise we return FALSE to indicate that it should not be printed.

Public Attributes

Quality RenderQuality

Protected Member Functions

virtual void RenderPaper (RenderRegion *, Spread *)
 To render the parts of a Document which are not rendered when printing. Ie. all the parts of the document that represent the paper on which the ink will be rendered. This function does not take any notice of the RenderControl object - it renders until it has finished so that at least the pages, pasteboard, etc. will be drawn when any region is invalidated.
SlowJobResult RenderSimpleNodes (Node *pNode, RenderRegion *pRender, ProgressDisplay &Progress, Node *pLastComplexNode=NULL)
 Function to render nodes 'normally' during 3-pass rendering. This copes with stopping at the specified last complex node, and with only printing selected objects if the user has requested it.
SlowJobResult RenderSimpleNodesUnclipped (Node *pNode, RenderRegion *pRender, ProgressDisplay &Progress, Node *pLastComplexNode=NULL)
 Function to render nodes 'normally' during 3-pass rendering. This copes with stopping at the specified last complex node, and with only printing selected objects if the user has requested it.
RenderRegionNewRenderRegion (DocRect InvalidRect, Matrix &ViewMatrix, wxDC *pDevContext, Spread *pSpread, RenderType rType, bool fOwned=false)
virtual void MakeNewRenderRegion (Spread *, DocRect, wxDC *, RenderType, BOOL PaintPaper=FALSE, Node *pInvalidNode=NULL)
 Makes a new render region and adds it to the list associated with the DocView. Depending on the type of render region requested, it may be rendered to completion immediately (e.g. print regions are). Note that if PaintPaper is FALSE, pDevContext isn't used, so can be NULL.

Protected Attributes

CCamViewpViewWindow
DocumentpDoc
ViewStatepVState
FIXED16 PixelWidth
FIXED16 PixelHeight
FIXED16 ScaledPixelWidth
FIXED16 ScaledPixelHeight
ColourPlateColPlate
ColourContextArray ColourContexts
BOOL ShouldDeleteContext [16]
BOOL ForceDefaultColourContexts
FIXED16 Scale
DocRect PhysExtent
BOOL m_bSolidDrag

Static Protected Attributes

static ViewCurrent = NULL

Private Member Functions

 CC_DECLARE_DYNAMIC (View)

Static Private Attributes

static PaperRenderRegionpPaperRegion = NULL
static PaperRenderRegionpOnTopRegion = NULL

Detailed Description

The basic kernel view item. This class contains minimal functionality to maintain the 'current' view, and the connection from a kernel view object to an OIL view object. DocView and PrintView are derived from this class.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
02/07/95
See also:
DocView; PrintView

Definition at line 228 of file view.h.


Constructor & Destructor Documentation

View::View  ) 
 

Initialise a View object.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
02/23/95
See also:
View

Definition at line 180 of file view.cpp.

00181 {
00182     // No connections yet...
00183     pViewWindow = NULL;
00184     pDoc = NULL;
00185     pVState= NULL;
00186 
00187     // Actual size of OIL pixels that this view uses - default to 96dpi.
00188     PixelWidth = PixelHeight = FIXED16(72000.0 / 96);
00189 
00190     // Scaled size of OIL pixels that this view uses - default to scale of 100%
00191     ScaledPixelWidth = ScaledPixelHeight = PixelWidth;
00192 
00193     // View scale factor - default to 100%
00194     Scale = 1.0;
00195 
00196     // Initialise our ColourPlate and colour contexts to NULL pointers
00197     ForceDefaultColourContexts = FALSE;
00198     ColPlate = NULL;
00199 
00200     for (INT32 i = 0; i < (INT32) MAX_COLOURMODELS; i++)
00201     {
00202         ColourContexts.Context[i] = NULL;
00203         ShouldDeleteContext[i] = TRUE;
00204     }
00205 
00206     m_bSolidDrag = FALSE;
00207 }

View::~View  )  [virtual]
 

Cleans up a view object.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
02/23/95
See also:
View

Definition at line 222 of file view.cpp.

00223 {
00224     if (this == Current)
00225         SetNoCurrent();
00226 
00227     // Decommission all colour contexts that we own
00228     ColourContextList  *cclist = ColourContextList::GetList();
00229     ERROR3IF( cclist == NULL, "No ColourContextList? What's up?" );
00230 
00231     // Delete any old context we had in use (ignoring the ShouldDeleteContext flags)
00232     for (INT32 i = 0; i < (INT32) MAX_COLOURMODELS; i++)
00233     {
00234         if (ColourContexts.Context[i] != NULL)
00235             cclist->RemoveContext(&(ColourContexts.Context[i]));
00236     }
00237 
00238     if (ColPlate != NULL)
00239         delete ColPlate;
00240 
00241     if (pVState != NULL)
00242     {
00243         delete pVState;
00244         pVState=NULL;
00245     }
00246 }


Member Function Documentation

void View::AllocateDC  )  [virtual]
 

Hints that we've done with our DC.

Author:
Alex Bligh <alex@alex.org.uk>
Date:
12/06/2006
See also:
View; PaperRenderRegion.
Note this is merely a hint. This routine is not guaranteed to eb called

Definition at line 261 of file view.cpp.

00262 {
00263     if (pViewWindow)
00264         pViewWindow->AllocateDC();
00265 }

View::CC_DECLARE_DYNAMIC View   )  [private]
 

BOOL View::ConnectToOilView CCamView pOilView  ) 
 

To set up the bi-directional connection between the OIL view object and the View. The OIL view object causes the creation of the View and so already has a pointer to it when it calls this routine to set up the connection in the other direction.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/5/93
Parameters:
Pointer to view object in the OIL layer which we will mirror. [INPUTS]
None [OUTPUTS]
Returns:
None

Errors: None

Definition at line 323 of file view.cpp.

00324 {
00325     ERROR2IF(this==NULL,FALSE,"View member func called on NULL pointer");
00326 
00327     ERROR2IF(pViewWindow != NULL, FALSE,
00328                 "View::ConnectToOilView called when connection already established");
00329 
00330     pViewWindow = pOilView;
00331 
00332     return TRUE;
00333 }

Matrix View::ConstructRenderingMatrix Spread pSpread  )  [virtual]
 

From the given spread, construct a matrix that will convert spread coordinates to OS coordinates.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com> & Rik
Date:
10/12/93
Parameters:
pSpread - the spread that is to be rendered. [INPUTS]
Returns:
The required transformation matrix.
See also:
DocView::OnDraw

Reimplemented in ExpressView, and PrintView.

Definition at line 1113 of file view.cpp.

01114 {
01115     // Get the PIXELISED origin of spread coordinates, in document coords
01116     DocCoord SpreadCoordOrigin = pSpread->GetSpreadCoordOrigin(TRUE, this);
01117 
01118     // Convert it into logical Work Coords
01119     // NOTE: We convert this via the spread, because the Spread Coord Origin can now
01120     // lie *outside* the current chapter/spread pasteboard bounds, and so the version
01121     // of this call that takes a document pointer can't find the enclosing chapter!
01122     // Of course, we know the enclosing chapter, because this point is in a known spread!
01123     WorkCoord WorkCoordOffset = SpreadCoordOrigin.ToWork(pSpread, this);
01124 
01125     // Offset it by the window scroll position
01126     WorkCoordOffset.x -= pVState->GetScrollPos().x;
01127     WorkCoordOffset.y -= pVState->GetScrollPos().y;
01128 
01129     // Just in case the above hasn't work (the DocCoord conversion seems to produce some rounding
01130     // errors), Pixelize the offset
01131     WorkCoordOffset.Pixelise(72000.0/PixelWidth.MakeDouble(),72000.0/PixelHeight.MakeDouble());
01132     
01133     // Construct the transformation matrix for the spread.
01134     Matrix RenderMatrix;
01135 
01136     // We can chop the 64bit values down to 32bit now, as we have them in the correct range
01137     Matrix TranslateToOrigin( (INT32)WorkCoordOffset.x, (INT32)WorkCoordOffset.y);
01138 
01139     Matrix ScaleMat(Scale, Scale);
01140 
01141     // The following matrix compositions MUST be performed in this order.
01142     // If you are tempted to optimise this code MAKE SURE THAT THEY ARE STILL
01143     // IN THIS ORDER WHEN YOU'VE FINISHED!
01144 
01145     // Apply scale factors to convert from millipoint distances to pixel distances...
01146     RenderMatrix *= ScaleMat;
01147 
01148     // Apply scroll-offset translation to move origin to viewing position...
01149     RenderMatrix *= TranslateToOrigin;
01150 
01151     return RenderMatrix;
01152 }

Matrix View::ConstructScaledRenderingMatrix Spread pSpread,
double  ScaleFactor
[virtual]
 

Create a rendermatrix at ScaleFactor precision of the current Scale Allows you to create a bitmap with higher/lower resolution than the current view eg used to create a bitmap of a given invalid region at double the current zoom factor (ie synonymous concept to "double resolution" or "double DPI").

Author:
Ilan_Copelyn (Xara Group Ltd) <camelotdev@xara.com>
Date:
06/06/00
Parameters:
pSpread = the spread that is to be rendered. [INPUTS] ScaleFactor = multiplier for current Scale (ie zoom factor)
Returns:
The required transformation matrix.
See also:
View::ConstructRenderingMatrix(Spread *pSpread)

Definition at line 1171 of file view.cpp.

01172 {
01173     // Get the PIXELISED origin of spread coordinates, in document coords
01174     DocCoord SpreadCoordOrigin = pSpread->GetSpreadCoordOrigin(TRUE, this);
01175 
01176     // Convert it into logical Work Coords
01177     // NOTE: We convert this via the spread, because the Spread Coord Origin can now
01178     // lie *outside* the current chapter/spread pasteboard bounds, and so the version
01179     // of this call that takes a document pointer can't find the enclosing chapter!
01180     // Of course, we know the enclosing chapter, because this point is in a known spread!
01181     WorkCoord WorkCoordOffset = SpreadCoordOrigin.ToWork(pSpread, this);
01182 
01183     // Offset it by the window scroll position
01184     WorkCoordOffset.x -= pVState->GetScrollPos().x;
01185     WorkCoordOffset.y -= pVState->GetScrollPos().y;
01186     
01187     // Construct the transformation matrix for the spread.
01188     Matrix RenderMatrix;
01189 
01190     // We can chop the 64bit values down to 32bit now, as we have them in the correct range
01191     Matrix TranslateToOrigin( (INT32)WorkCoordOffset.x, (INT32)WorkCoordOffset.y);
01192 
01193     FIXED16 ScaledScale = Scale.MakeDouble() * ScaleFactor;
01194     Matrix ScaleMat(ScaledScale, ScaledScale);
01195 
01196     // The following matrix compositions MUST be performed in this order.
01197     // If you are tempted to optimise this code MAKE SURE THAT THEY ARE STILL
01198     // IN THIS ORDER WHEN YOU'VE FINISHED!
01199 
01200     // Apply scale factors to convert from millipoint distances to pixel distances...
01201     RenderMatrix *= ScaleMat;
01202 
01203     // Apply scroll-offset translation to move origin to viewing position...
01204     RenderMatrix *= TranslateToOrigin;
01205 
01206     return RenderMatrix;
01207 }

virtual void View::ContinueRenderView RenderRegion ,
Spread ,
BOOL  fRenderPaper = TRUE,
BOOL  fDeleteRegionAfter = TRUE,
BOOL  bForceImmediate = FALSE
[pure virtual]
 

Implemented in DocView, ExpressView, PrintView, XPFView, ClipboardView, DialogView, and MetafileView.

void View::Deinit void   )  [static]
 

De-initialises the view system. At the moment this involves destroying our PaperRenderRegion.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
02/23/95
See also:
View; PaperRenderRegion.

Definition at line 298 of file view.cpp.

00299 {
00300     // Lose our PaperRenderRegion...
00301     delete pPaperRegion;
00302     delete pOnTopRegion;
00303 }

void View::DeInitOnTopRegion  )  [static]
 

Deinitialises the static OnTop RenderRegion, used for blob rendering.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
2/5/95

Definition at line 568 of file view.cpp.

00569 {
00570     if (pOnTopRegion)
00571         pOnTopRegion->DetachDevice();
00572 }

void View::DoneWithDC  )  [virtual]
 

Hints that we've done with our DC.

Author:
Alex Bligh <alex@alex.org.uk>
Date:
12/06/2006
See also:
View; PaperRenderRegion.
Note this is merely a hint. This routine is not guaranteed to eb called

Definition at line 280 of file view.cpp.

00281 {
00282     if (pViewWindow)
00283         pViewWindow->DoneWithDC();
00284 }

ColourContext * View::GetColourContext ColourModel  Model,
BOOL  ReturnNULLIfNone = FALSE
 

To find an appropriate colour context in the given colour model for use when rendering into this view. This allows us to control colour separation and correction down to a per-view level.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
22/5/96
Parameters:
Model - The colour model of the context you want to find [INPUTS] ReturnNULLIfNone - if FALSE, an appropriate view will be found, by searching my parent document and global contexts if necessary. if TRUE, then if this view hasn't got it's own special context it will immediately return NULL.
Returns:
NULL, or a pointer to an appropriate context.
Notes: This only functions for RGB and CMYK contexts at present. If you wish to render to a view using an output context of a different type, you will need to upgrade tios method.

ONLY Use the returned pointer temporarily - If the view is deleted or if the ColourPlate options on the view are changed, the context will be deleted. You should thus always call this function to get the current Context - it's cached, and quick after the first call.

See also:
View::GetColourPlate; View::SetColourPlate; ColourContext; ColourManager

Definition at line 1407 of file view.cpp.

01408 {
01409     // If our internal flag is set, we will return a default global colour context
01410     // This allows View::RenderOptimalBitmapPhase to create RenderRegions which will
01411     // not colour spearate or correct (as we want to do the correction as a post process
01412     // on the produced bitmap)
01413     if (ForceDefaultColourContexts)
01414         return(ColourManager::GetColourContext(Model, pDoc));
01415 
01416 
01417     // Under normal circumstances, if we have a special ColourPlate, we look in our
01418     // cache for an appropriate context. First, we'll make sure an appropriate context
01419     // is cached (We don't do this if the caller specified ReturnNULLIfNone)
01420     if (!ReturnNULLIfNone && ColourContexts.Context[Model] == NULL && ColPlate != NULL)
01421     {
01422         // It's not cached yet - create a new context of this type
01423         ColourContext *NewCC = NULL;
01424 
01425         switch(Model)
01426         {
01427             case COLOURMODEL_RGBT:
01428                 NewCC = new ColourContextRGBT(this);
01429                 break;
01430 
01431             case COLOURMODEL_CMYK:
01432                 NewCC = new ColourContextCMYK(this);
01433                 break;
01434 
01435             default:
01436                 ERROR3("View::GetColourContext only supports RGB/CMYK contexts at present");
01437                 break;
01438         }
01439 
01440         if (NewCC != NULL)
01441         {
01442             // Copy our ColourPlate
01443             ColourPlate *NewPlate = new ColourPlate(*ColPlate);
01444 
01445             if (NewPlate == NULL)
01446             {
01447                 // Failure - delete the ColourContext and abandon the attempt
01448                 delete NewCC;
01449                 NewCC = NULL;
01450             }
01451             else
01452             {
01453                 // Attach the ColourPlate to the context, add it into our cache of ColourContexts,
01454                 // and add the new context to the context list
01455                 NewCC->SetColourPlate(NewPlate);
01456 
01457                 ColourContextList *cclist = ColourContextList::GetList();
01458                 ERROR3IF(cclist == NULL, "No ColourContextList? What's up?");
01459 
01460                 ColourContexts.Context[Model] = NewCC;
01461                 cclist->AddContext(&(ColourContexts.Context[Model]));
01462             }
01463         }
01464     }
01465 
01466     // See if we've got a cached context we can return
01467     ColourContext *cc = ColourContexts.Context[Model];
01468 
01469     // If we own our own colour context, then use it. Otherwise, find a suitable
01470     // context from our parent document; if that has none, then use a global default.
01471     // (We don't do this if the caller specified ReturnNULLIfNone)
01472     if (cc == NULL && !ReturnNULLIfNone)
01473         cc = ColourManager::GetColourContext(Model, pDoc);
01474 
01475     return(cc);
01476 }

ColourPlate * View::GetColourPlate void   ) 
 

To find out what colour separation options are currently in use by this view.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
13/6/96
Returns:
NULL, or a pointer to the current ouptut ColourPlate
See also:
View::SetColourPlate; View::GetColourContext

Definition at line 1495 of file view.cpp.

01496 {
01497     return(ColPlate);
01498 }

CCamView * View::GetConnectionToOilView  )  const
 

To get a pointer to the OIL view object which mirrors this one. Note that this can return NULL if the View does not have a mirroring OIL object. In this case the view is closed but the View remains available so that in the future a new view will be able to use all of its viewing parameters.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/5/93
Returns:
Pointer to the OIL view object which mirrors this one.

Definition at line 350 of file view.cpp.

00351 {
00352     return pViewWindow;
00353 }

double View::GetConvertToEditableShapesDPI  )  [virtual]
 

Allows derived view classes to override the reolution.

Author:
Gerry_Iles (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/08/2005
Returns:
The resolution to use for convert top editable shapes operations while this view is current

Reimplemented in XPFView.

Definition at line 1343 of file view.cpp.

01344 {
01345     INT32 iPixPerInch = 0;
01346     if (!GetApplication()->GetConvertToEditableShapesDPI(&iPixPerInch))
01347     {
01348         ERROR3("View::GetConvertToEditableShapesDPI; Couldn't get app's dpi");
01349         iPixPerInch = 96;
01350     }
01351 
01352     return(iPixPerInch);
01353 }

View * View::GetCurrent  )  [static]
 

Find the current View object which SHOULD have been set as one of the very first actions during event processing.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
24/5/93
Returns:
Pointer to the current View object.

Reimplemented in DocView.

Definition at line 386 of file view.cpp.

00387 {
00388 #ifdef RALPH
00389     if(::GetCurrentThreadId() == RalphDocument::GetImportingThreadID())
00390     {
00391         return RalphDocument::GetImportingDoc()->GetFirstDocView();
00392     }
00393 #endif
00394 
00395     return Current;
00396 }

Document * View::GetDoc  )  const
 

Returns the linake between this View and its Document.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/3/94
Returns:
A pointer to the kernel Document associated with this View.

Definition at line 368 of file view.cpp.

00369 {
00370     return pDoc;
00371 }

virtual DocRect View::GetDocViewRect Spread  )  [pure virtual]
 

Implemented in DocView, ExpressView, PrintView, XPFView, ClipboardView, DialogView, and MetafileView.

BOOL View::GetForceDefaultColourContexts void   )  [inline]
 

Definition at line 374 of file view.h.

00374 { return(ForceDefaultColourContexts); }

virtual BOOL View::GetForeBackMode  )  [pure virtual]
 

Implemented in DocView, ExpressView, PrintView, XPFView, ClipboardView, DialogView, and MetafileView.

FIXED16 View::GetPixelHeight  ) 
 

Get the height of a pixel in this view.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
02/19/95
Returns:
The pixel height for this view

Definition at line 1238 of file view.cpp.

01239 {
01240     return PixelHeight;
01241 }

void View::GetPixelSize FIXED16 pPixelWidth,
FIXED16 pPixelHeight
 

Get the size of a pixel in this view.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
02/10/95
Parameters:
pPixelWidth,pPixelHeight - pixel size. [OUTPUTS]

Definition at line 1254 of file view.cpp.

01255 {
01256     *pPixelWidth = PixelWidth;
01257     *pPixelHeight = PixelHeight;
01258 }

FIXED16 View::GetPixelWidth  ) 
 

Get the width of a pixel in this view.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
02/19/95
Returns:
The pixel width for this view

Definition at line 1221 of file view.cpp.

01222 {
01223     return PixelWidth;
01224 }

PrintControl * View::GetPrintControl  ) 
 

Simple way of getting the PrintControl object associated with this view's document.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
05/09/95
Returns:
Pointer to the PrintControl object, or NULL if none found, or the view is not attached to a document.

Errors: If no print control found => ERROR2

Definition at line 4172 of file view.cpp.

04173 {
04174 #ifndef STANDALONE
04175 
04176     if (pDoc == NULL)
04177         // This view is not attached to a document (e.g. it's a DialogView)
04178         return NULL;
04179 
04180     // Find print control object for this document, to see if we are
04181     // printing via bitmap, and so if we need to band the output.
04182     PrintComponent *pPrintComponent = (PrintComponent *)
04183         pDoc->GetDocComponent(CC_RUNTIME_CLASS(PrintComponent));
04184     ERROR2IF(pPrintComponent == NULL, NULL, 
04185              "Unable to find PrintComponent object in document.");
04186 
04187     PrintControl *pPrintControl = pPrintComponent->GetPrintControl();
04188     ERROR2IF(pPrintControl == NULL, NULL, 
04189              "Unable to find PrintControl object in document component.");
04190 
04191     return pPrintControl;
04192 
04193 #else
04194     return NULL;
04195 #endif
04196 }

virtual wxDC* View::GetRenderDC  )  [pure virtual]
 

Implemented in DocView, ExpressView, PrintView, XPFView, ClipboardView, DialogView, and MetafileView.

FIXED16 View::GetScaledPixelHeight  ) 
 

Get the height of a scaled pixel in this view.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
02/19/95
Returns:
The scaled pixel height for this view

Definition at line 1307 of file view.cpp.

01308 {
01309     return ScaledPixelHeight;
01310 }

void View::GetScaledPixelSize FIXED16 pScaledPixelWidth,
FIXED16 pScaledPixelHeight
 

Get the size of a scaled pixel in this view.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
02/10/95
Parameters:
pScaledPixelWidth,pScaledPixelHeight - scaled pixel size. [OUTPUTS]

Definition at line 1323 of file view.cpp.

01324 {
01325     *pScaledPixelWidth = ScaledPixelWidth;
01326     *pScaledPixelHeight = ScaledPixelHeight;
01327 }

FIXED16 View::GetScaledPixelWidth  ) 
 

Get the width of a scaled pixel in this view.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
02/19/95
Returns:
The scaled pixel width for this view

Definition at line 1290 of file view.cpp.

01291 {
01292     return ScaledPixelWidth;
01293 }

WorkCoord View::GetScrollOffsets  )  const
 

To find the position of the top left corner of the display.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/7/93
Returns:
Top left corner of the viewport in WorkCoords.

Definition at line 1038 of file view.cpp.

01039 {
01040     ERROR2IF(this==NULL,WorkCoord(0,0),"View member func called on NULL pointer");
01041 
01042     return pVState->GetScrollPos();
01043 }

virtual WorkRect View::GetViewRect  )  [pure virtual]
 

Implemented in DocView, ExpressView, PrintView, XPFView, ClipboardView, DialogView, and MetafileView.

FIXED16 View::GetViewScale  )  const
 

Inquire the viewing scale factor from this View.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
31/5/93
Returns:
Viewing scale factor for this view.

Definition at line 1091 of file view.cpp.

01092 {
01093     return Scale;
01094 }

BOOL View::IsPrintableNodeSelected Node pNode  )  [static]
 

Determine whether a given node should be rendered when we are printing with "selected objects only" enabled. It checks to see if the node is bounded - if it isn't, then it's an attribute or similar and so is always rendered. If it is bounded then return TRUE if it is selected or if it is the child of a selected object. Otherwise we return FALSE to indicate that it should not be printed.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
05/28/95
Parameters:
pNode - the node to check. [INPUTS]
Returns:
TRUE if the node should be printed; FALSE if not.
See also:
View::RenderSimpleNodes

Definition at line 2228 of file view.cpp.

02229 {
02230     if (pNode->IsBounded())
02231     {
02232         // We must check the selected status of this node.
02233         // Even if this node is not selected, its parent might be, so we
02234         // scan upwards until we find a layer, or a selected node.
02235         Node *pTestNode = pNode;
02236         while ((pTestNode != NULL) && 
02237                (!pTestNode->IsSelected()) && 
02238                (!pTestNode->IsLayer()))
02239         {
02240             pTestNode = pTestNode->FindParent();
02241         }
02242 
02243         // If we failed to find a parent at some point then it can't possibly be selected
02244         if (pTestNode == NULL)
02245             return(FALSE);
02246 
02247         // If it is selected then we'd better print this node
02248         if (pTestNode->IsSelected())
02249             return(TRUE);
02250 
02251         // If the original node is a shadow then we should test the right sibling
02252         // and print this node if that is selected
02253         if (pNode->IsAShadow())
02254         {
02255             Node* pRightSibling = pNode->FindNext();
02256             if (pRightSibling && pRightSibling->IsSelected())
02257                 return(TRUE);
02258         }
02259 
02260         // Fall back to not printing this node
02261         return(FALSE);
02262 
02263         // Ok, what did we find?
02264 //      return ((pTestNode != NULL) && pTestNode->IsSelected());
02265     }
02266     else
02267     {
02268         // It is a non-bounded node such as an attribute so we render it always.
02269         return TRUE;
02270     }
02271 }

void View::MakeNewRenderRegion Spread pSpread,
DocRect  ClipRect,
wxDC *  pDevContext,
RenderType  rType,
BOOL  PaintPaper = FALSE,
Node pInvalidNode = NULL
[protected, virtual]
 

Makes a new render region and adds it to the list associated with the DocView. Depending on the type of render region requested, it may be rendered to completion immediately (e.g. print regions are). Note that if PaintPaper is FALSE, pDevContext isn't used, so can be NULL.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/12/94
Parameters:
pSpread - pointer to the spread concerned [INPUTS] ClipRect - Rectangle to create region from pDevContect - pointer to the device context for this region (may be NULL if PaintPaper == FALSE) rType - type of rendering PaintPaper - TRUE if paper should be redrawn immediately, FALSE otherwise (ignored for non-screen render regions).
- [OUTPUTS]
Returns:
-

Reimplemented in PrintView.

Definition at line 598 of file view.cpp.

00600 {
00601     // Construct the transformation matrix for the spread.
00602     Matrix RenderMatrix = ConstructRenderingMatrix(pSpread);
00603 
00604     // Go and create the new render region
00605     RenderRegion *NewRegion = NULL;
00606 
00607     if (pViewWindow != NULL)
00608     {
00609 //      NewRegion = NewRenderRegion(ClipRect, RenderMatrix, GetRenderDC(), pSpread, rType);
00610         // GAT - Is it safe to change the above line to the one below?
00611         NewRegion = NewRenderRegion(ClipRect, RenderMatrix, pDevContext, pSpread, rType);
00612     }
00613 
00614     if (NewRegion == NULL)
00615     {
00616         TRACEALL( _T("Not enough memory to create render region\n") );
00617         return;
00618     }
00619 
00620     if (rType == RENDERTYPE_SCREEN)
00621     {
00622         if (PaintPaper)
00623         {
00624             // Call helper function defined below
00625             RenderPaper(pSpread, ClipRect, pDevContext, RenderMatrix);
00626         }
00627         else
00628         {
00629             // Caller does not want paper to be rendered, so set the flag to indicate that
00630             // OS paper rendering is not needed.
00631             NewRegion->NeedsOSPaper = FALSE;
00632         }
00633     }
00634 
00635     NewRegion->SetBackmostChangedNode(pInvalidNode);
00636 
00637     // Add the region to the list of regions to render and start the
00638     // rendering process off if it has some ink to render
00639     Camelot.AddRenderRegion(NewRegion);
00640 }

RenderRegion * View::NewRenderRegion DocRect  InvalidRect,
Matrix ViewMatrix,
wxDC *  pDevContext,
Spread pSpread,
RenderType  rType,
bool  fOwned = false
[protected]
 

Definition at line 511 of file view.cpp.

00514 {
00515     RenderRegion *pNewRRegion;
00516 
00517     if (rType == RENDERTYPE_SCREENXOR)
00518     {
00519         if (pOnTopRegion == NULL)
00520         {
00521             // No OnTop rendering region - get a new render region of 
00522             // the special type RENDERTYPE_SCREENPAPER.
00523             pOnTopRegion = (PaperRenderRegion *) NewRenderRegion(InvalidRect, ViewMatrix,
00524                                                                  pDevContext, pSpread,
00525                                                                  RENDERTYPE_SCREENPAPER, fOwned );
00526             pOnTopRegion->SaveContext();
00527         }
00528         else
00529         {
00530             // Change the device of the OnTop rendering region
00531             pOnTopRegion->AttachDevice(this, pSpread, pDevContext, 
00532                                        ViewMatrix, Scale, InvalidRect, fOwned );
00533         }
00534 
00535         pNewRRegion = pOnTopRegion;
00536     }
00537     else
00538     {
00539         // JCF: added 'this' argument to the end of the list.
00540         pNewRRegion = OSRenderRegion::Create(InvalidRect, ViewMatrix, Scale, rType, this);
00541 
00542         // If the construction was succesful then
00543         // Attach the new RenderRegion to a Window and its DC for rendering...
00544         if (pNewRRegion)
00545         {
00546             if (!pNewRRegion->AttachDevice(this, pDevContext, pSpread, fOwned))
00547             {
00548                 // the AttachDevice failed, so tidy up
00549                 delete pNewRRegion;
00550                 pNewRRegion = NULL;
00551             }
00552         }
00553     }
00554 
00555     return pNewRRegion;
00556 }

void View::OnDraw wxDC *  pDevContext,
OilRect  OilClipRect
 

Do the drawing, guv.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com> & Rik & JustinF
Date:
10/12/93
Parameters:
pDevContext - the device context of the view to render. [INPUTS] OilClipRect - the clipping rectangle of the invalid region (in OilCoords).

Reimplemented in PrintView.

Definition at line 899 of file view.cpp.

00900 {
00901     if (CCamApp::IsDisabled())
00902         return;                             // If the system is disabled, ignore
00903 
00904 //  TRACE( _T("View::OnDraw\n") );
00905     
00906 //  TRACE( _T("Rect = (%d, %d, %d, %d)"), OilClipRect.lo.x, OilClipRect.lo.y, OilClipRect.hi.x, OilClipRect.hi.y );
00907 
00908     // find type of rendering device
00909     const RenderType rType = CCDC::GetType(pDevContext, TRUE);
00910 
00911     // Convert OilClipRect to 64 bit WorkCoords
00912     WorkRect ClipRect = OilClipRect.ToWork(pVState->GetScrollPos());
00913 //TRACE( _T("View::GetScrollPos : %d %d"),(INT32)(pVState->GetScrollPos().x/750),(INT32)(pVState->GetScrollPos().y/750));
00914 //TRACE( _T("ClipRect : %d %d %d %d\n"),(INT32)(ClipRect.lo.x/750),(INT32)(ClipRect.lo.y/750),(INT32)(ClipRect.hi.x/750),(INT32)(ClipRect.hi.y/750));
00915 
00916     ERROR3IF(ClipRect.lo.x > ClipRect.hi.x, "DocView::OnDraw clipping rect is invalid");
00917     ERROR3IF(ClipRect.lo.y > ClipRect.hi.y, "DocView::OnDraw clipping rect is invalid");
00918 
00919     // Use the last chapter as a sentinel.
00920     Chapter* pLastChapter = (Chapter*) pDoc->GetFirstNode()->
00921                                 FindNext()->FindLastChild(CC_RUNTIME_CLASS(Chapter));
00922 
00923     // Find all the spreads in the document that intersect the clipping rect, and create
00924     // a render region for each of them.
00925 
00926     // Iterate over the chapters in the document.
00927     for (Chapter* pChapter = Node::FindFirstChapter(pDoc);
00928          pChapter != 0;
00929          pChapter = pChapter->FindNextChapter())
00930     {
00931         // Convert chapter bounding box to logical coords
00932         WorkRect LogChapterRect;
00933         DocRect PhysChapterRect = pChapter->GetPasteboardRect(TRUE, this);
00934         LogChapterRect.lo = PhysChapterRect.lo.ToWork(pDoc, this);
00935         LogChapterRect.hi = PhysChapterRect.hi.ToWork(pDoc, this);
00936 
00937         BOOL IsLastChapter = (pChapter == pLastChapter);
00938 
00939         // Check to see if this chapter intersects the clipping rectangle.
00940         // If the chapter is the last one in the document, then the chapter's pasteboard
00941         // does not include the area of the bottom of the last spread, so we only check
00942         // the chapter's top boundary.
00943         if (ClipRect.lo.y <= LogChapterRect.hi.y &&
00944             (IsLastChapter || ClipRect.hi.y >= LogChapterRect.lo.y))
00945         {
00946             // Find the last spread in the chapter.
00947             Spread* pLastSpread = (Spread*) pChapter->FindLastChild(CC_RUNTIME_CLASS(Spread));
00948 
00949             // Iterate over the spreads in the chapter.
00950             for (Spread* pSpread = pChapter->FindFirstSpread();
00951                  pSpread != 0;
00952                  pSpread = pSpread->FindNextSpread())
00953             {
00954                 // Convert spread bounding box to logical coords
00955                 DocRect PhysSpreadRect = pSpread->GetPasteboardRect(TRUE, this);    // Pixelised
00956 
00957                 WorkRect LogSpreadRect;
00958                 LogSpreadRect.lo = PhysSpreadRect.lo.ToWork(pSpread, this);
00959                 LogSpreadRect.hi = PhysSpreadRect.hi.ToWork(pSpread, this);
00960 
00961                 BOOL IsLastSpread = (pSpread == pLastSpread);
00962 
00963                 // Check if spread intersects the clipping rect
00964                 if (ClipRect.lo.y <= LogSpreadRect.hi.y &&
00965                     ((IsLastChapter && IsLastSpread) || ClipRect.hi.y >= LogSpreadRect.lo.y))
00966                 {
00967                     // Make render region for intersection between spread and cliprect.
00968                     DocRect SpreadClipRect = pSpread->GetWidePasteboard(this);
00969 
00970                     // Convert clip rectangle to document coords
00971                     DocRect DocClipRect = OilClipRect.ToDoc(pSpread, this);
00972 
00973                     // Clip to spread rectangle
00974                     SpreadClipRect = SpreadClipRect.Intersection(DocClipRect);
00975 
00976                     // Make sure that the clip region is valid after the intersection
00977                     if (SpreadClipRect.IsValid() && !SpreadClipRect.IsEmpty())
00978                     {
00979                         // Convert document coords to spread coords and make a render region.
00980                         pSpread->DocCoordToSpreadCoord(&SpreadClipRect);
00981                         MakeNewRenderRegion(pSpread, SpreadClipRect, pDevContext, rType, TRUE);
00982                     }
00983                 }
00984             }
00985         }
00986     }
00987 
00988 //  TRACE( _T("Leaving View::OnDraw\n") );
00989 }

SlowJobResult View::RenderBitmapPhase DocRect ComplexClipRect,
Matrix ViewTrans,
Spread pSpread,
RenderRegion pHostRegion,
Node pFirstComplex,
Node pLastComplex,
BOOL  bRenderAll,
BOOL  bPrintPaper,
ProgressDisplay Progress
 

This function is called from RenderSimpleView if it ends up having to do the 3 phase rendering system. This function performs the bitmap phase, where all the objects deemed to be complex by the Host render region are rendered into a bitmap using GDraw and a mono, mask bitmap. The bitmap is blitted into the host render region using the mask bitmap, minimising the amount of bitmaps ending up in the view (important for things like postscript that do not really like bitmaps very much).

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/4/95
Parameters:
ClipRect - the clipping rectangle of the region [INPUTS] ViewTrans - the matrix to render through pSpread - The Spread we are drawing pHostRegion - The Render Region we are rendering on behalf of pFirstComplex - The first complex node that needs rendering pLastComplex - The last complex node that needs rendering Progress - the usual progress display object.
Returns:
TRUE if everything was fabby, FALSE if there was a problem
See also:
DocView::RenderSimpleView; ProgressDisplay

Definition at line 3736 of file view.cpp.

03739 {
03740 #ifndef STANDALONE
03741 //  TRACEUSER( "Gerry", _T("View::RenderBitmapPhase\n"));
03742 
03743     BOOL bIsOnScreen = pHostRegion->IS_KIND_OF(GRenderRegion);
03744 
03745     ERROR3IF(!bIsOnScreen &&
03746              PrintMonitor::PrintMaskType==PrintMonitor::MASK_OPTIMAL,
03747             "PrintMaskType must be SIMPLE or MASKED here\n");
03748 
03749     // This needs to be done in 2 phases - one to create the bitmap we will blit into the
03750     // host render region and one to create the mask to show us which parts of the bitmap
03751     // need to be blitted. First we will create the bitmap to blit into the host.
03752     // create the bitmap render region
03753 //  CNativeDC* pDC = pHostRegion->GetRenderDC();
03754 
03755     double Dpi;
03756     if (bIsOnScreen)
03757     {
03758         Dpi = (double) (72000.0 / PixelWidth.MakeDouble());
03759 //      Dpi = Dpi / 4.0;
03760     }
03761     else if (pHostRegion->IsPrinting())
03762     {
03763         PrintControl *pPrintControl = GetPrintControl();
03764         ERROR2IF(pPrintControl == NULL, SLOWJOB_FAILURE, "No print control in RenderBitmapPhase()");
03765         Dpi = (double) pPrintControl->GetDotsPerInch();
03766     }
03767     else if (IS_A(pHostRegion, CamelotEPSRenderRegion))
03768     {
03769         // Use DPI as set in EPS export options dialog.
03770         Dpi = (double) EPSFilter::XSEPSExportDPI;
03771     }
03772     else
03773     {
03774         // Default to something reasonable (only really used for screens).
03775         Dpi = (double) (72000.0 / PixelWidth.MakeDouble());
03776     }
03777 
03778     BOOL bDoScan = TRUE;
03779     if (bIsOnScreen)
03780     {
03781         // Now check the print method to determine if we need to do a three-pass render
03782         // Get document pointer
03783         Document* pDoc = GetDoc();
03784 
03785         // Get print information for this document.
03786         PrintComponent *pPrint = (PrintComponent *) pDoc->GetDocComponent(CC_RUNTIME_CLASS(PrintComponent));
03787         if (pPrint)
03788         {
03789             PrintControl *pPrintControl = pPrint->GetPrintControl();
03790             if (pPrintControl)
03791             {
03792                 if (pPrintControl->GetPrintMethod() != PRINTMETHOD_NORMAL)
03793                 {
03794                     bDoScan = FALSE;
03795                 }
03796             }
03797         }
03798     }
03799 
03800     // Check to see if we should do a masked blit.
03801     // We always do it under NT, or to a PostScript printer; under other conditions
03802     // we are controlled by the printing preference.
03803     BOOL DoMaskedBlit = FALSE;
03804     if (//IsWin32NT() || 
03805         bIsOnScreen ||
03806         (PrintMonitor::PrintMaskType==PrintMonitor::MASK_MASKED) ||
03807         (CCDC::GetType(pHostRegion->GetRenderDC(), TRUE) == RENDERTYPE_PRINTER_PS) ||
03808         IS_A(pHostRegion, CamelotEPSRenderRegion))
03809     {
03810         DoMaskedBlit = TRUE;
03811     }
03812 
03813     // Work out the clip rect to use
03814     DocRect ClipRect = ComplexClipRect;
03815     ClipRect.Inflate((INT32)(2*72000.0/Dpi + 0.5));
03816 
03817     // We will need the clip rect of the whole region too
03818     DocRect RClipRect = pHostRegion->GetRegionRect();
03819 
03820 //  pHostRegion->StopRender();
03821 
03822     // During this function, we force the View::GetColourContext function to return default
03823     // global contexts to anyone who asks, in order to disable any attempts to
03824     // colour separate or correct the output (we want a normal composite bitmap which
03825     // will be colour corrected by the main render region when we call PlotBitmap, below)
03826     BOOL OldForceState = ForceDefaultColourContexts;
03827     ForceDefaultColourContexts = TRUE;
03828 
03829     // Create a new GDraw context so we don't have to keep stopping and starting our regions
03830     GDrawAsm TempContext;
03831     if (!TempContext.Init())
03832     {
03833         ForceDefaultColourContexts = OldForceState;
03834         return SLOWJOB_FAILURE;
03835     }
03836 
03837     // Replace the static GDraw context with our temp one
03838 //  GDrawContext* pOldGD = NULL;
03839 
03840     GDrawContext* pOldGD = GRenderRegion::SetTempDrawContext(&TempContext);
03841     if (pOldGD == NULL)
03842     {
03843         TRACEUSER( "Gerry", _T("NULL GDraw context returned from SetTempDrawContext\n"));
03844     }
03845 
03846     // Feathers require that the ScaleFactor of the render region be set correctly 
03847     // or they will only render correctly at 100%
03848     FIXED16 TempScale;
03849     ViewTrans.Decompose(&TempScale, NULL, NULL, NULL, NULL);
03850 
03851     // Set it up
03852     GRenderBitmap BitmapRR(ClipRect, ViewTrans, TempScale, 32, Dpi);
03853     BitmapRR.AttachDevice(this, NULL, pSpread);
03854 
03855     // Update progress display if necessary.
03856     Progress.StartBitmapPhase(BitmapRR.GetNumBands());
03857 
03858     // Also create a masked mono bitmap and Set them up
03859     MaskedRenderRegion MaskedBitmap(ClipRect, ViewTrans, TempScale, Dpi);
03860     MaskedBitmap.AttachDevice(this, NULL, pSpread);
03861 
03862     // ask for the bands to overlap
03863     BitmapRR.SetOverlapBands(TRUE);
03864     MaskedBitmap.SetOverlapBands(TRUE);
03865 
03866     // Start the first band
03867     if (!BitmapRR.SetFirstBand())
03868     {
03869         ForceDefaultColourContexts = OldForceState;
03870         return SLOWJOB_FAILURE;
03871     }
03872 
03873     // in the masked region as well
03874     if (!MaskedBitmap.SetFirstBand())
03875     {
03876         ForceDefaultColourContexts = OldForceState;
03877         return SLOWJOB_FAILURE;
03878     }
03879 
03880     INT32 CurrentBand = 0;
03881 
03882     // loop through all the available bands
03883     BOOL MoreBands = FALSE;
03884     do
03885     {
03886         CurrentBand++;
03887 //      TRACEUSER( "Gerry", _T("Printing Band %d\n"),CurrentBand);
03888 
03889         // Start rendering into the bitmap
03890         if (!BitmapRR.StartRender())
03891         {
03892             GRenderRegion::SetTempDrawContext(pOldGD);
03893             ForceDefaultColourContexts = OldForceState;
03894             return SLOWJOB_FAILURE;
03895         }
03896 
03897         // Should draw a big white rectangle here, into the bitmap render region or
03898         // transparent objects will not fade to white where you can see the paper under them
03899         DocRect DrawRect = ClipRect;
03900         // Inflate the rect by 2 pixels
03901         DrawRect.Inflate( (INT32)(2*72000.0/Dpi + 0.5) );
03902 
03903         if (bPrintPaper)
03904         {
03905             BitmapRR.SaveContext();
03906             RenderPaper(&BitmapRR, pSpread);
03907             BitmapRR.RestoreContext();
03908         }
03909         else
03910         {
03911             // Draw it into the real bitmap
03912             BitmapRR.SaveContext();
03913             DocColour white(255,255,255);
03914             BitmapRR.SetFillColour(white);
03915             BitmapRR.DrawRect(&DrawRect);
03916             BitmapRR.RestoreContext();
03917         }
03918 
03919         // We anti-alias the transparency mask 
03920         QualityAttribute *pAttr = new QualityAttribute();
03921         pAttr->QualityValue.SetQuality(QUALITY_MAX);
03922         BitmapRR.SetQuality(pAttr, TRUE);
03923 //      BitmapRR.RRQuality.SetQuality(QUALITY_MAX);
03924 //      BitmapRR.SetQualityLevel();
03925 
03926         RRCaps HostCaps;
03927         pHostRegion->GetRenderRegionCaps(&HostCaps);
03928 
03929         SimpleBitmapRenderCallback ImageCallback(this, bRenderAll, pFirstComplex, pLastComplex, FALSE);
03930         BitmapRR.RenderTree(pSpread, FALSE, FALSE, &ImageCallback);
03931 
03932         // Stop rendering
03933         BitmapRR.StopRender();
03934 
03935         // Start it up
03936         if (!MaskedBitmap.StartRender())
03937         {
03938             GRenderRegion::SetTempDrawContext(pOldGD);
03939             ForceDefaultColourContexts = OldForceState;
03940             return SLOWJOB_FAILURE;
03941         }
03942 
03943         // Now, either we are rendering a masked bitmap, in which case we only want the complex
03944         // objects to render in the mask, or we are rendering the objects with a rectangular
03945         // bitmap, in which case we want *all* objects to render into the mask.
03946         if (DoMaskedBlit)
03947         {
03948             // Find out what the host can do
03949             pHostRegion->GetRenderRegionCaps(&HostCaps);
03950         }
03951         else
03952         {
03953             // Mark this region as not able to do anything, so the bitmap render region
03954             // will do everything for it (i.e. all objects will render into the mask).
03955             HostCaps.CanDoNothing();
03956         }
03957 
03958         MaskedBitmap.SetHostCaps(&HostCaps);
03959 
03960         // Fill the mask in "simple"
03961         MaskedBitmap.SaveContext();
03962         DocColour white(255,255,255);
03963         MaskedBitmap.SetFillColour(white);
03964         MaskedBitmap.DrawRect(&DrawRect);
03965         MaskedBitmap.RestoreContext();
03966 
03967         if (!bDoScan)
03968         {
03969             HostCaps.CanDoNothing();
03970             MaskedBitmap.SetHostCaps(&HostCaps);
03971         }
03972 
03973         SimpleBitmapRenderCallback MaskCallback(this, bRenderAll, pFirstComplex, pLastComplex, TRUE);
03974         MaskedBitmap.RenderTree(pSpread, FALSE, FALSE, &MaskCallback);
03975 
03976         // Tell the render region we are done rendering
03977         MaskedBitmap.StopRender();
03978         
03979         // Make the mask a little bigger, to cover any errors from different dpis
03980         MaskedBitmap.SpreadMask();
03981 
03982         // Get the mask bitmap from the render region
03983 //      OILBitmap* pMaskBitmap = MaskedBitmap.ExtractBitmapCopy();
03984 //      KernelBitmap* pRealMaskBmp = new KernelBitmap(pMaskBitmap, TRUE);
03985 //      pRealMaskBmp->AttachDebugCopyToCurrentDocument("TestMask");
03986 //      delete pRealMaskBmp;
03987         
03988         // Get the bitmaps from the render region
03989         OILBitmap* pFullBitmap = BitmapRR.ExtractBitmap();
03990         KernelBitmap* pRealBmp = new KernelBitmap(pFullBitmap, TRUE);
03991 
03992 //      pRealBmp->AttachDebugCopyToCurrentDocument("TestBmp");
03993 
03994         // Restore the ForceDefaultContext flag around the output rendering section
03995         ForceDefaultColourContexts = OldForceState;
03996         
03997         // Restore the original GDrawContext
03998         if (GRenderRegion::SetTempDrawContext(pOldGD) != &TempContext)
03999         {
04000             TRACEUSER( "Gerry", _T("Not &TempContext when restoring\n"));
04001         }
04002         pOldGD = NULL;
04003 
04004         // Now render the bitmap we have into the host render region.
04005 //      if (pHostRegion->StartRender())
04006 //      {
04007             // Save the context
04008             pHostRegion->SaveContext();
04009 
04010             // Render the bitmap using the mask
04011             DocRect BandClipRect = BitmapRR.GetClipRect();
04012 //          TRACE( _T("BandClipRect = (%d, %d) - (%d, %d)\n"), BandClipRect.lo.x, BandClipRect.lo.y, BandClipRect.hi.x, BandClipRect.hi.y);
04013 //          TRACE( _T("BandMatrix = \n"));
04014 //          Matrix HostMatrix = pHostRegion->GetMatrix();
04015 //          HostMatrix.Dump();
04016             SlowJobResult Result = pHostRegion->DrawMaskedBitmap(BandClipRect, pRealBmp, 
04017                                                                  &MaskedBitmap, &Progress);
04018 
04019             if (Result != SLOWJOB_SUCCESS)
04020             {
04021                 // Either something has gone wrong, or an error has occured, so clean up.
04022 
04023                 // Get rid of the bitmaps. We have to detach it once, as it was attached 
04024                 // when extracted from the render region.
04025 //              pFullBitmap->Detach();
04026                 delete pRealBmp;
04027                 pRealBmp = NULL;
04028 
04029                 return Result;
04030             }
04031 
04032             // restore the context and stop rendering
04033             pHostRegion->RestoreContext();
04034 //          pHostRegion->StopRender();
04035 //      }
04036 
04037         ForceDefaultColourContexts = TRUE;
04038 
04039         // Make sure we are using the temporary GDrawContext
04040         pOldGD = GRenderRegion::SetTempDrawContext(&TempContext);
04041         if (pOldGD == NULL)
04042         {
04043             TRACEUSER( "Gerry", _T("NULL GDraw context returned from SetTempDrawContext\n"));
04044         }
04045 
04046         // get rid of the bitmaps. We have to detach it once, as it was attached when extracted from the rr
04047 //      pFullBitmap->Detach();
04048         delete pRealBmp;
04049         pRealBmp = NULL;
04050 
04051         // Ensure all captures are cleared before setting up next band.
04052         MaskedBitmap.FreeOffscreenState();
04053         BitmapRR.FreeOffscreenState();
04054 
04055         // Get the next bands ready
04056         BOOL MoreMaskedBands = MaskedBitmap.GetNextBand();
04057         MoreBands = BitmapRR.GetNextBand();
04058         CAM_USE(MoreMaskedBands); // suppress unused variable wanring on retail builds
04059         ERROR3IF(MoreMaskedBands!=MoreBands, "Bands don't match");
04060 
04061         // Update progress display
04062         if (!Progress.EndBitmapPhaseBand())
04063         {
04064             ForceDefaultColourContexts = OldForceState;
04065             // User has aborted operation
04066             return SLOWJOB_USERABORT;
04067         }
04068 
04069     } while (MoreBands);
04070 
04071 #endif
04072 
04073     // Restore the ForceDefaultContext flag
04074     ForceDefaultColourContexts = OldForceState;
04075 
04076     // Restore the original GDrawContext
04077     if (GRenderRegion::SetTempDrawContext(pOldGD) != &TempContext)
04078     {
04079         TRACEUSER( "Gerry", _T("Not &TempContext when restoring\n"));
04080     }
04081     pOldGD = NULL;
04082 
04083 //  pHostRegion->StartRender();
04084     
04085 //  TRACEUSER( "Gerry", _T("End of View::RenderBitmapPhase\n"));
04086 
04087     // all worked
04088     return SLOWJOB_SUCCESS;
04089 }

SlowJobResult View::RenderOptimalBitmapPhase DocRect ClipRect,
Matrix ViewTrans,
Spread pSpread,
RenderRegion pRender,
Node pLastNormalInRun,
Node pLastComplexInRun,
BOOL  RenderAllObjects,
BOOL  bPrintPaper,
INT32 &  NodesSoFar,
ProgressDisplay pProgress,
INT32  TotalProgress
 

Renders the masked bitmap part of the process. This function will get called many times during the typical rendering of the document (once for each run of complex nodes in the document).

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/7/95
Parameters:
ClipRect - the Clipping rectangle [INPUTS] ViewTrans - the view matrix to use pSpread - the Spread to render to pRender - the host render region pLastNormalInRun - The last normal node in this run pLastComplexInRun - the last complex node in the run RenderAllObjects - TRUE if we render all objects, FALSE if its just the selection NodesSoFar - the number of nodes rendered so far Progress - the Progress display object
NodesSoFar - The Number of nodes rendered after the Complex ones have been done [OUTPUTS]
Returns:
SLOWJOB_SUCCESS - if all went well SLOWJOB_FAILURE - if all went bad SLOWJOB_USERABORT - if the user press 'esc'
Notes: All rendering to the bitmap is done in composite colour (by ignoring the ColourPlate attached to this view). The bitmap is then plotted into the output RenderRegion, at which point it will be separated/corrected according to the ColourPlate settings. This is for 2 reasons: 1) If we didn't stop it here, the output would be colour corrected twice, and thus come out wrong 2) Bleach transparency does not work correctly on pre-separated colours, so we must render using composite colour in order to nmake such transparent objects come out correctly.

Definition at line 2891 of file view.cpp.

02896 {
02897     TRACEUSER( "Gerry", _T("View::RenderOptimalBitmapPhase TotalProgress = %d\n"), TotalProgress);
02898 
02899     INT32 EndProgress = NodesSoFar + TotalProgress;
02900 
02901     // work out the DPI - this is a bit complicated really
02902     double Dpi = 96.0;
02903     if (!pRender->IS_KIND_OF(GRenderRegion) && pRender->IsPrinting())
02904     {
02905         // we are printing, so ask the print options
02906         PrintControl *pPrintControl = GetPrintControl();
02907         ERROR2IF(pPrintControl == NULL, SLOWJOB_FAILURE, "No print control in RenderOptimalView");
02908         Dpi = (double) pPrintControl->GetDotsPerInch();
02909     }
02910     else if (IS_A(pRender, CamelotEPSRenderRegion))
02911     {
02912         // Use DPI as set in EPS export options dialog.
02913         Dpi = (double) EPSFilter::XSEPSExportDPI;
02914     }
02915     else
02916     {
02917         // Default to something reasonable (only really used for screens).
02918         Dpi = (double) (72000.0 / PixelWidth.MakeDouble());
02919     }
02920 
02921     // Markn 27/10/95
02922     // Scan the layers finding the union of the bounds of all the layers that should be rendered
02923     // This will be used to calc the Bitmap clip rect
02924     DocRect BitmapClipRect;
02925     Layer* pLayer = pSpread->FindFirstLayer();
02926     while (pLayer != NULL)
02927     {
02928         if (pLayer->NeedsToRender(pRender))
02929             BitmapClipRect = BitmapClipRect.Union(pLayer->GetBoundingRect());
02930 
02931         pLayer = pLayer->FindNextLayer();
02932     }
02933     // Make sure that the BitmapClipRect does not incude an area that's not included in the entry ClipRect
02934     BitmapClipRect = BitmapClipRect.Intersection(ClipRect);
02935 
02936     // Now we make sure the clip rect is pixel aligned
02937     INT32 TempPixels;
02938     double dPixelWidth = 72000.0 / Dpi;
02939     if (BitmapClipRect.Width() < dPixelWidth || BitmapClipRect.Height() < dPixelWidth)
02940     {
02941         TRACE( _T("Very small rectangle\n"));
02942     }
02943     TempPixels = (INT32)(((double)BitmapClipRect.lo.x) / dPixelWidth);
02944     BitmapClipRect.lo.x = (INT32)(((double)TempPixels) * dPixelWidth);
02945     if (BitmapClipRect.Width() < dPixelWidth)
02946         BitmapClipRect.hi.x = (INT32)(BitmapClipRect.lo.x + dPixelWidth);
02947     
02948     TempPixels = (INT32)(((double)BitmapClipRect.lo.y) / dPixelWidth);
02949     BitmapClipRect.lo.y = (INT32)(((double)TempPixels) * dPixelWidth);
02950     if (BitmapClipRect.Height() < dPixelWidth)
02951         BitmapClipRect.hi.y = INT32(BitmapClipRect.lo.y + dPixelWidth);
02952 
02953     // Markn 26/10/95
02954     // Find out if this render region is printing or not.
02955     // This is used as a param to the constructors of the bitmap-related render regions so that they
02956     // have the same printing state as the main render region.
02957     // If they don't, some nodes that shouldn't render when printing (e.g. background layers) will get 
02958     // rendered into the bitmaps.
02959     BOOL Printing = pRender->IsPrinting();
02960 
02961     // During this function, we force the View::GetColourContext function to return default
02962     // global contexts to anyone who asks, in order to disable any attempts to
02963     // colour separate or correct the output (we want a normal composite bitmap which
02964     // will be colour corrected by the main render region when we call PlotBitmap, below)
02965     BOOL OldForceState = ForceDefaultColourContexts;
02966     ForceDefaultColourContexts = TRUE;
02967 
02968     // Create a new GDraw context so we don't have to keep stopping and starting our regions
02969     GDrawAsm TempContext;
02970     if (!TempContext.Init())
02971     {
02972         return SLOWJOB_FAILURE;
02973     }
02974 
02975     // Use the temporary GDrawContext
02976     GDrawContext* pOldGD = GRenderRegion::SetTempDrawContext(&TempContext);
02977     if (pOldGD == NULL)
02978     {
02979         TRACEUSER( "Gerry", _T("NULL GDraw context returned from SetTempDrawContext\n"));
02980     }
02981 
02982     // Feathers require that the ScaleFactor of the render region be set correctly 
02983     // or they will only render correctly at 100%
02984     FIXED16 TempScale;
02985     ViewTrans.Decompose(&TempScale, NULL, NULL, NULL, NULL);
02986 
02987     // Also create a masked mono bitmap and Set them up
02988     PrintingMaskedRenderRegion MaskedBitmap(BitmapClipRect, ViewTrans, TempScale, Dpi, Printing);
02989     MaskedBitmap.AttachDevice(this, NULL, pSpread);
02990 
02991     // Create the colour Render Region as well
02992     GRenderBitmap BitmapRR(BitmapClipRect, ViewTrans, TempScale, 32, Dpi, Printing);
02993     BitmapRR.AttachDevice(this, NULL, pSpread);
02994 
02995     // ask for the bands to overlap
02996     BitmapRR.SetOverlapBands(TRUE);
02997     MaskedBitmap.SetOverlapBands(TRUE);
02998 
02999     // Start the first band in both of our renderregions
03000     if (!BitmapRR.SetFirstBand() || !MaskedBitmap.SetFirstBand())
03001     {
03002         ForceDefaultColourContexts = OldForceState;
03003         return SLOWJOB_FAILURE;
03004     }
03005 
03006     // Count the nodes in this complex run
03007 //  BOOL StartCounting = FALSE;
03008     INT32 TotalBands = MaskedBitmap.GetNumBands();
03009 
03010     // Count the nodes to be rendered so we can calculate the increment to use
03011     if (!MaskedBitmap.StartRender())
03012     {
03013         // Restore the ForceDefaultContext flag
03014         ForceDefaultColourContexts = OldForceState;
03015         GRenderRegion::SetTempDrawContext(pOldGD);
03016         return SLOWJOB_FAILURE;
03017     }
03018 
03019     // Find out what the host can do
03020     RRCaps HostCaps;
03021     pRender->GetRenderRegionCaps(&HostCaps);
03022     MaskedBitmap.SetHostCaps(&HostCaps);
03023     INT32 TotalNodes = 0;
03024 
03025     OptimalBitmapRenderCallback CountCallback(this, RenderAllObjects, pLastNormalInRun, pLastComplexInRun, TRUE, 0, &TotalNodes, pProgress, TRUE);
03026     MaskedBitmap.RenderTree(pSpread, FALSE, FALSE, &CountCallback);
03027 
03028     // Tell the render region we are done rendering
03029     MaskedBitmap.StopRender();
03030 
03031     double NodesPerBand = 0.0;
03032     if (TotalBands != 0)
03033         NodesPerBand = ((double)TotalProgress) / ((double)TotalBands * 3.0);
03034     double NodeIncrement = 0.0;
03035     if (TotalNodes != 0)
03036         NodeIncrement = NodesPerBand / ((double) TotalNodes);
03037 
03038 //  TRACEUSER( "Gerry", _T("TotalNodes - %ld\n"), TotalNodes);
03039 //  TRACEUSER( "Gerry", _T("TotalBands - %ld\n"), TotalBands);
03040 //  TRACEUSER( "Gerry", _T("NodesPerBand - %f\n"), NodesPerBand);
03041 //  TRACEUSER( "Gerry", _T("NodeIncrement - %f\n"), NodeIncrement);
03042 
03043     INT32 CurrentBand = 0;
03044 
03045     // loop through all the available bands
03046     BOOL MoreBands = FALSE;
03047     do
03048     {
03049         // Update the current band variable
03050         CurrentBand++;
03051 //      TRACEUSER( "Gerry", _T("Printing Band %d of %d\n"),CurrentBand,TotalBands);
03052 
03053         // Start it up
03054         if (!MaskedBitmap.StartRender())
03055         {
03056             // Restore the ForceDefaultContext flag
03057             ForceDefaultColourContexts = OldForceState;
03058             GRenderRegion::SetTempDrawContext(pOldGD);
03059             return SLOWJOB_FAILURE;
03060         }
03061 
03062         // Find out what the host can do
03063         RRCaps HostCaps;
03064         pRender->GetRenderRegionCaps(&HostCaps);
03065         MaskedBitmap.SetHostCaps(&HostCaps);
03066 
03067         // Fill the mask in white
03068         DocRect DrawRect = ClipRect;
03069 
03070         // Inflate the rect by 2 pixels
03071         DrawRect.Inflate((INT32)(2*72000.0/Dpi + 0.5)); 
03072 
03073         // Tell the masked render region that the following nodes are Simple
03074         MaskedBitmap.SetMaskDrawingMode(FALSE);
03075 
03076         MaskedBitmap.SaveContext();
03077         DocColour white(255,255,255);
03078         MaskedBitmap.SetFillColour(white);
03079         MaskedBitmap.DrawRect(&DrawRect);
03080         MaskedBitmap.RestoreContext();
03081 
03082         // Find out the size of the Region
03083         DocRect SizeOfRegion = MaskedBitmap.GetClipRect();
03084 
03085         // start actually rendering nodes in to the mask. Just the ones in this
03086         // complex run are actually rendering solid into the mask. All other nodes,
03087         // before and after the run are punched out.
03088         double RegionArea = (double)SizeOfRegion.Width() * (double)SizeOfRegion.Height();
03089         OptimalBitmapRenderCallback MaskCallback(this, RenderAllObjects, pLastNormalInRun, pLastComplexInRun, TRUE, RegionArea, &NodesSoFar, pProgress, FALSE, NodeIncrement);
03090         MaskedBitmap.RenderTree(pSpread, FALSE, FALSE, &MaskCallback);
03091 
03092         ENSURE(MaskedBitmap.GetCaptureDepth()==1, "Mask capture nesting not unwound correctly in RenderOptimalBitmapPhase\n");
03093 
03094         // Tell the render region we are done rendering
03095         MaskedBitmap.StopRender();
03096 
03097         // Make the mask a little bigger, to cover any errors from different dpis
03098         MaskedBitmap.SpreadMask();
03099 
03100 #ifdef _DEBUG_ATTACH_OPTIMAL_MASK
03101 OILBitmap* pMaskBitmap = MaskedBitmap.ExtractBitmapCopy();
03102 KernelBitmap* pRealMaskBmp = new KernelBitmap(pMaskBitmap, TRUE);
03103 pRealMaskBmp->AttachDebugCopyToCurrentDocument("TestMask");
03104 delete pRealMaskBmp;
03105 #endif
03106 
03107         // Draw the colour bitmap
03108         if (MaskedBitmap.FindCoverage()>0)
03109         {
03110             // Start rendering into the bitmap
03111             {
03112                 // Start the render region up.
03113                 BOOL ok = BitmapRR.StartRender();
03114                 if (!ok)
03115                 {
03116                     // Restore the ForceDefaultContext flag
03117                     ForceDefaultColourContexts = OldForceState;
03118                     GRenderRegion::SetTempDrawContext(pOldGD);
03119                     return SLOWJOB_FAILURE;
03120                 }
03121             }
03122 
03123             // Should draw a big white rectangle here, into the bitmap render region or
03124             // transparent objects will not fade to white where you can see the paper under them
03125             // Draw it into the real bitmap
03126             if (bPrintPaper)
03127             {
03128                 BitmapRR.SaveContext();
03129                 RenderPaper(&BitmapRR, pSpread);
03130                 BitmapRR.RestoreContext();
03131             }
03132             else
03133             {
03134                 BitmapRR.SaveContext();
03135                 DocColour white(255,255,255);
03136                 BitmapRR.SetFillColour(white);
03137                 BitmapRR.DrawRect(&DrawRect);
03138                 BitmapRR.RestoreContext();
03139             }
03140 
03141             // We always anti-alias the bitmap output
03142             QualityAttribute *pAttr = new QualityAttribute();
03143             pAttr->QualityValue.SetQuality(QUALITY_MAX);
03144             BitmapRR.SetQuality(pAttr, TRUE);
03145 
03146             OptimalBitmapRenderCallback ImageCallback(this, RenderAllObjects, pLastNormalInRun, pLastComplexInRun, FALSE, RegionArea, &NodesSoFar, pProgress, FALSE, NodeIncrement);
03147             BitmapRR.RenderTree(pSpread, FALSE, FALSE, &ImageCallback);
03148 
03149             ENSURE(BitmapRR.GetCaptureDepth()==1, "Bitmap capture nesting not unwound correctly in RenderOptimalBitmapPhase\n");
03150 
03151             // Stop rendering
03152             BitmapRR.StopRender();
03153 
03154             // Get the bitmaps from the render region
03155             OILBitmap* pFullBitmap = BitmapRR.ExtractBitmap();
03156             KernelBitmap* pRealBmp = new KernelBitmap(pFullBitmap, TRUE);
03157 
03158 #ifdef _DEBUG_ATTACH_OPTIMAL_BITMAP
03159 pRealBmp->AttachDebugCopyToCurrentDocument("TestBmp");
03160 #endif
03161 
03162             // Restore the ForceDefaultContext flag around the output rendering section
03163             ForceDefaultColourContexts = OldForceState;
03164 
03165             if (GRenderRegion::SetTempDrawContext(pOldGD) != &TempContext)
03166             {
03167                 TRACEUSER( "Gerry", _T("Not &TempContext when restoring\n"));
03168             }
03169             pOldGD = NULL;
03170 
03171 //          TRACE( _T("Rendering bitmap with mask\n"));
03172             // Save the context
03173             pRender->SaveContext();
03174 
03175             // Render the bitmap using the mask
03176             DocRect BandClipRect = BitmapRR.GetClipRect();
03177             SlowJobResult Result = pRender->DrawMaskedBitmap(BandClipRect, pRealBmp, &MaskedBitmap, NULL);
03178             if (Result != SLOWJOB_SUCCESS)
03179             {
03180                 // Either something has gone wrong, or an error has occured, so clean up.
03181 
03182                 // Get rid of the bitmaps. We have to detach it once, as it was attached 
03183                 // when extracted from the render region.
03184 //              pFullBitmap->Detach();
03185                 delete pRealBmp;
03186                 pRealBmp = NULL;
03187 
03188                 return SLOWJOB_FAILURE;
03189             }
03190 
03191             // restore the context and stop rendering
03192             pRender->RestoreContext();
03193 
03194             NodesSoFar += (INT32)NodesPerBand;
03195             if (pProgress)
03196             {
03197                 if (!pProgress->SetNodesRendered(NodesSoFar))
03198                 {
03199                     TRACE( _T("*****************************\n"));
03200                     TRACE( _T("************ User aborted job\n"));
03201                     TRACE( _T("*****************************\n"));
03202                 }
03203             }
03204 
03205             ForceDefaultColourContexts = TRUE;
03206 
03207             // Use the temporary GDrawContext
03208             pOldGD = GRenderRegion::SetTempDrawContext(&TempContext);
03209             if (pOldGD == NULL)
03210             {
03211                 TRACEUSER( "Gerry", _T("NULL GDraw context returned from SetTempDrawContext\n"));
03212             }
03213 
03214             // get rid of the bitmaps. We have to detach it once, as it was attached when extracted from the rr
03215 //          pFullBitmap->Detach();
03216             delete pRealBmp;
03217             pRealBmp = NULL;
03218         }
03219         else
03220         {
03221 //          TRACEUSER( "Gerry", _T("No mask coverage\n"));
03222 
03223             NodesSoFar += (INT32)(NodesPerBand * 2.0);
03224             if (pProgress)
03225             {
03226                 if (!pProgress->SetNodesRendered(NodesSoFar))
03227                 {
03228                     TRACE( _T("*****************************\n"));
03229                     TRACE( _T("************ User aborted job\n"));
03230                     TRACE( _T("*****************************\n"));
03231                 }
03232             }
03233         }
03234 
03235         // Ensure all captures are cleared before setting up next band
03236         BitmapRR.FreeOffscreenState();
03237 
03238         // Get the next bands ready
03239         BOOL MoreMaskedBands = MaskedBitmap.GetNextBand();
03240 TRACEUSER( "Phil", _T("GetNextBand (Before) %d, %d\n"), BitmapRR.GetClipRect().lo.y, BitmapRR.GetClipRect().hi.y);
03241         MoreBands = BitmapRR.GetNextBand();
03242 TRACEUSER( "Phil", _T("GetNextBand (After)  %d, %d\n"), BitmapRR.GetClipRect().lo.y, BitmapRR.GetClipRect().hi.y);
03243         ERROR3IF(MoreMaskedBands!=MoreBands, "Bands don't match");
03244         if (MoreMaskedBands!=MoreBands)
03245            MoreBands = FALSE;
03246 
03247     } while (MoreBands);
03248 
03249 
03250     // Restore the ForceDefaultContext flag
03251     ForceDefaultColourContexts = OldForceState;
03252 
03253     if (GRenderRegion::SetTempDrawContext(pOldGD) != &TempContext)
03254     {
03255         TRACEUSER( "Gerry", _T("Not &TempContext when restoring\n"));
03256     }
03257     pOldGD = NULL;
03258     
03259     // All went well so makesure the progress is at the right point
03260     NodesSoFar = EndProgress;
03261     if (pProgress)
03262         pProgress->SetNodesRendered(NodesSoFar);
03263 
03264     TRACEUSER( "Gerry", _T("End of View::RenderOptimalBitmapPhase\n"));
03265     return SLOWJOB_SUCCESS;
03266 }

RenderViewResult View::RenderOptimalView RenderRegion pRender,
Matrix ViewTrans,
Spread pSpread,
BOOL  PrintPaper
 

This function has been designed along similar lines to the RenderView() function found elsewhere in this file. This version of the function is slightly different though. This version of the function is able to render complex objects, such as transparent objects into normal render regions. It does this by first scanning through all the objects that need rendering to see if any of them require complex things. If they do, then part of the rendering is done into a bitmap and blitted over the rest of the shapes using a masked blit. All very complicated really! This is the optimal version of this function, that will render individual complex shapes to the device instead of building them all up and blitting them in one go. This will produce the best quality results as as many objects as possible will be rendered to the resolution of the device.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
25/7/95
Parameters:
pRender - The render region to render into [INPUTS] ViewTrans - the transform matrix to use for the rendering pSpread - the spread to render PrintPaper - TRUE if the paper should be rendered as well
Returns:
RENDERVIEW_SUCCESS - view was rendered successfully RENDERVIEW_FAILURE - an error occured while rendering the view. RENDERVIEW_NOTNEEDED - the view was not rendered as the usual RenderView call can be used instead. RENDERVIEW_USERABORT - the user aborted the rendering operation. (e.g. pressing Escape, or aborting the print job)
See also:
DocView::RenderView

Definition at line 2699 of file view.cpp.

02701 {
02702 //  TRACEUSER( "Gerry", _T("View::RenderOptimalView\n"));
02703     ERROR3IF(PrintMonitor::PrintMaskType!=PrintMonitor::MASK_OPTIMAL, "PrintMaskType must be OPTIMAL here\n");
02704 
02705     // Find out what the host render region is capable of
02706     RRCaps Caps;
02707     pRender->GetRenderRegionCaps(&Caps);
02708 
02709     // Whether or not the rendering was successful.
02710     RenderViewResult Result = RENDERVIEW_FAILURE;
02711 
02712     // Find out the Clipping rectangle of the render region to draw into
02713     DocRect ClipRect = pRender->GetClipRect();
02714 
02715     BOOL Printing = pRender->IsPrinting();
02716 
02717     // Create and set up a new Scanning render region
02718     ScanningRenderRegion Scanner(Printing);
02719 
02720     // Attach a device to the scanning render region
02721     // Since this rr does no real rendering, it does not need a Device context
02722     Scanner.AttachDevice(this, (CNativeDC*) NULL, pSpread);
02723 
02724     // Get it ready to render
02725     Scanner.SetMatrix(ViewTrans);
02726     Scanner.SetClipRect(ClipRect);
02727     
02728     // Start the render region and return if it fails
02729     if (Scanner.StartRender())
02730     {           
02731         // and tell the scanning render region about the caps of the host region
02732         Scanner.SetHostRRCaps(Caps);
02733 
02734         // Work out whether we need to render all objects, or just the selected ones.
02735         BOOL RenderAllObjects = TRUE;
02736         CCPrintInfo *pPrintInfo = NULL;
02737         if (Printing)
02738         {
02739             pPrintInfo = CCPrintInfo::GetCurrent();
02740             if (pPrintInfo != NULL)
02741             {
02742                 PrintControl *pPrCtrl = pPrintInfo->GetPrintControl();
02743                 RenderAllObjects = (pPrCtrl->GetObjPrintRange() == PRINTRANGEOBJ_ALL);
02744             }
02745         }
02746 
02747 //      BOOL ReallyPrinting = Printing && (pPrintInfo != NULL);
02748 
02749         // We going to analyse the document
02750         if (pPrintInfo != NULL)
02751             pPrintInfo->SetAnalysing();
02752 
02753         ScannerRenderCallback ScanCallback(this, RenderAllObjects, &Scanner);
02754 
02755         // Call RenderTree to do the rendering
02756         Scanner.RenderTree(pSpread, FALSE, TRUE, &ScanCallback);
02757 
02758         // Thats all the nodes rendered, so stop rendering
02759         Scanner.StopRender();
02760 
02761         // Ok, we now have a Scanning render region that has all the info we need to know in it.
02762 #ifdef _DEBUG
02763         // Dump out the node span info
02764 //      Scanner.DumpNodeRuns();
02765 #endif
02766 
02767         // We going to print the document now
02768         if (pPrintInfo != NULL)
02769             pPrintInfo->SetPrinting();
02770 
02771         // Set up the matrix and clipping rect
02772         pRender->SetMatrix(ViewTrans);
02773         pRender->SetClipRect(ClipRect);
02774 
02775         // Ask the render region not to render complex shapes
02776         pRender->SetRenderComplexShapes(FALSE);
02777     
02778         // Start the render region and get out if it fails
02779         if (!pRender->StartRender())
02780             goto OptimalRenderError;
02781 
02782         // I think it likely we need to put something in here.
02783         if (Printing)
02784         {
02785             // Render the spreads paper marks where necessary
02786             RenderPageMarks(pRender, ViewTrans, ClipRect, pSpread);
02787         }
02788 
02789         // Draw the paper if we have been asked to do so.
02790         if (PrintPaper)
02791         {
02792             // Render all paper nodes from there into the real render region
02793             pRender->SaveContext();
02794             RenderPaper(pRender, pSpread);
02795             pRender->RestoreContext();
02796 
02797             if (pRender->NeedsOSPaper)
02798             {
02799                 // This render region uses the OS to render paper, so if we don't
02800                 // render anything except paper then there is no need for e.g.
02801                 // GRenderRegions to blit anything.  Hence we call this function
02802                 // to clear the changed bbox.
02803                 pRender->SetClean(TRUE, FALSE);
02804             }
02805 
02806             // The Paper is now done
02807             pRender->IsPaperRendered = TRUE;
02808         }
02809 
02810         ProgressDisplay Progress;
02811         Progress.SetUpOptimal(pRender, &Scanner);
02812         INT32 NodesRendered = 0;
02813 
02814 //      TRACE( _T("Starting main render\n"));
02815         // We need to call RenderTree for the spread
02816         // We pass the ScanningRenderRegion to the RenderCallback object
02817         // so that it can tell which objects are normal and which are complex
02818         // We also pass the progress object so that can be updated
02819         OptimalPrintRenderCallback MyCallback(this, pSpread, RenderAllObjects, &Scanner, PrintPaper, &NodesRendered, &Progress, FALSE);
02820         pRender->RenderTree(pSpread, FALSE, FALSE, &MyCallback);
02821         MyCallback.FinishRendering(pRender);
02822 
02823         // Examine the callback object to see if anything went wrong
02824 
02825         // And stop rendering
02826         pRender->StopRender();
02827 
02828         // All worked, so return success
02829         Result = RENDERVIEW_SUCCESS;
02830     }
02831     
02832 OptimalRenderError:
02833 #ifdef _DEBUG
02834     if (Result != RENDERVIEW_SUCCESS)
02835         TRACEUSER( "Gerry", _T("RenderOptimalView failed\n"));
02836 #endif
02837 
02838     // Unlink the RenderRegion from list and error if it was not there
02839     BOOL InList = Camelot.DeleteRenderRegion(pRender);
02840     CAM_USE(InList); // Suppress unused variable warning on retail build
02841     ERROR3IF(!InList, "DocView::RenderOptimalView tried to delete a RenderRegion not in the list");
02842 
02843     // Instruct the render region to commit suicide. This call doesn't work on a CamelotEPS
02844     // render region.
02845     pRender->ConditionalSuicide ();
02846 
02847 //  TRACEUSER( "Gerry", _T("End of View::RenderOptimalView\n"));
02848 
02849     return Result;
02850 }

BOOL View::RenderPageMarks RenderRegion pCurrRegion,
Matrix ViewTrans,
DocRect ClipRect,
Spread pSpread
[virtual]
 

Performs the rendering of page marks, ie crop marks, registration marks etc to the screen and printer. This base class version does nothing. All mark rendering technology is held in DocView and PrintView.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
08/08/96
Parameters:
pSpread - pointer to the spread concerned [INPUTS] ClipRect - Rectangle to create region from pDevContect - pointer to the device context for this region (may be NULL if PaintPaper == FALSE) RenderMatrix- the render matrix to use. rType - the type of render to give the region
- [OUTPUTS]
Returns:
-
See also:
DocView, PrintView

Reimplemented in DocView.

Definition at line 797 of file view.cpp.

00798 {
00799 #if !defined(EXCLUDE_FROM_RALPH)
00800 #ifndef STANDALONE
00801 
00802 /*
00803     // Ask the render region not to render complex shapes
00804     BOOL OldState = pCurrRegion->SetRenderComplexShapes(FALSE);
00805 
00806     // Create and set an identity matrix. We will cope with
00807     // the view transform later
00808     Matrix OldMatrix = pCurrRegion->GetMatrix();
00809     Matrix Identity;
00810 
00811     // Work out the transformed clip rectangle onto the paper
00812     DocRect TransformedClipRect(ClipRect);
00813     ViewTrans.transform(&TransformedClipRect.lo);
00814     ViewTrans.transform(&TransformedClipRect.hi);
00815 
00816     MILLIPOINT Tmp;
00817 
00818     if (TransformedClipRect.lo.x > TransformedClipRect.hi.x)
00819     {
00820         Tmp = TransformedClipRect.lo.x;
00821         TransformedClipRect.lo.x = TransformedClipRect.hi.x;
00822         TransformedClipRect.hi.x = Tmp;
00823     }
00824 
00825     if (TransformedClipRect.lo.y > TransformedClipRect.hi.y)
00826     {
00827         Tmp = TransformedClipRect.lo.y;
00828         TransformedClipRect.lo.y = TransformedClipRect.hi.y;
00829         TransformedClipRect.hi.y = Tmp;
00830     }
00831 
00832 //  pCurrRegion->SetMatrix(ViewTrans);
00833     pCurrRegion->SetClipRect(TransformedClipRect);
00834     pCurrRegion->SetMatrix(Identity);
00835 
00836     // Start the render region and return if it fails
00837     if (!pCurrRegion->StartRender())
00838     {
00839         pCurrRegion->SetMatrix(OldMatrix);
00840 
00841         pCurrRegion->SetRenderComplexShapes(OldState);
00842         return FALSE;
00843     }
00844 */
00845     // start a save context for attributes
00846     pCurrRegion->SaveContext();
00847 
00848     if (pCurrRegion!=NULL && pSpread!=NULL)
00849     {
00850         if (!IS_A(pCurrRegion,PaperRenderRegion))
00851         {
00852             // find this documents print mark component.
00853             Document* pDoc = (Document*)pSpread->FindOwnerDoc();
00854             if (pDoc)
00855             {
00856                 // ok, render all the print marks where necessary.
00857                 PrintMarksMan* pMarksMan = GetApplication()->GetMarksManager();
00858                 if (pMarksMan!=NULL)
00859                 {
00860                     // find this documents print mark component.
00861                     PrintMarksComponent* pMarksComp = (PrintMarksComponent*)pDoc->GetDocComponent(CC_RUNTIME_CLASS(PrintMarksComponent));
00862                     if (pMarksComp != NULL)
00863                         pMarksMan->RenderPrintMarks(pMarksComp, pCurrRegion, ViewTrans, ClipRect, pSpread);
00864                 }
00865             }
00866         }
00867     }
00868 
00869     pCurrRegion->RestoreContext();
00870 /*
00871     pCurrRegion->StopRender();
00872 
00873     // Done rendering the print marks
00874     pCurrRegion->SetMatrix(OldMatrix);
00875     pCurrRegion->SetClipRect(ClipRect);
00876     pCurrRegion->SetRenderComplexShapes(OldState);
00877 */
00878 
00879 #endif
00880 #endif
00881     return TRUE;    
00882 }

void View::RenderPaper RenderRegion pRRegion,
Spread pSpread
[protected, virtual]
 

To render the parts of a Document which are not rendered when printing. Ie. all the parts of the document that represent the paper on which the ink will be rendered. This function does not take any notice of the RenderControl object - it renders until it has finished so that at least the pages, pasteboard, etc. will be drawn when any region is invalidated.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
19/5/93
Parameters:
pRRegion - The render region to draw in [INPUTS] pSpread - the spread to draw Scope: Private

Definition at line 730 of file view.cpp.

00731 {
00732     // We always want paper to render to the same display quality level.
00733     pRRegion->SetDefaultQuality();
00734 
00735     Node* pn = (Node*) pSpread;
00736 
00737     // First render all the paper nodes in the tree through the given RenderRegion...
00738     while (pn != NULL)
00739     {
00740 //TRACEUSER("Phil", _T("RenderPaper for %x - %x\n"), pSpread, pn);
00741         pn->Render(pRRegion);
00742         pn = pn->FindNextForClippedPaperRender();
00743     }
00744 
00745 #ifndef STANDALONE
00746     // Render the printable area using the document's PrintControl object, but only if this
00747     // is a DocView & the ShowPrintBorder's flag is set
00748     if (GetRuntimeClass() == CC_RUNTIME_CLASS(DocView))
00749     {
00750         DocView* pDocView = (DocView*)this;
00751 
00752         if (pDoc!=NULL)
00753         {
00754             if (pDocView->GetShowPrintBorders())
00755             {
00756                 PrintComponent* pPrComp = (PrintComponent*)pDoc->GetDocComponent(CC_RUNTIME_CLASS(PrintComponent));
00757                 if (pPrComp != NULL)
00758                 {
00759                     PrintControl* pPrCtrl = pPrComp->GetPrintControl();
00760                     if (pPrCtrl != NULL)
00761                         pPrCtrl->RenderPrintBorder(pRRegion);
00762                 }
00763             }
00764         }
00765     }   
00766 #endif
00767 }

void View::RenderPaper Spread pSpread,
DocRect  ClipRect,
wxDC *  pDevContext,
Matrix RenderMatrix
[virtual]
 

Actually renders the paper onto the screen. Moved from 'MakeNewRenderRegion' so that it can be called from outside (eg. ResetRegion).

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/6/95
Parameters:
pSpread - pointer to the spread concerned [INPUTS] ClipRect - Rectangle to create region from pDevContect - pointer to the device context for this region (may be NULL if PaintPaper == FALSE)
- [OUTPUTS]
Returns:
-

Definition at line 661 of file view.cpp.

00662 {
00663 //  TRACE( _T("View::RenderPaper\n") );
00664     if (pPaperRegion == NULL)
00665     {
00666         // No paper rendering region - get a new render region of 
00667         // the special type RENDERTYPE_SCREENPAPER.
00668         pPaperRegion = (PaperRenderRegion *) NewRenderRegion(ClipRect, RenderMatrix,
00669                                                              pDevContext, pSpread,
00670                                                              RENDERTYPE_SCREENPAPER);
00671 
00672         // We save the context here, so that PaperRenderRegion::DetachDevice() can
00673         // throw away all the attributes.  We only need to do it here because
00674         // PaperRenderRegion::AttachDevice() (see 2 inches below) calls SaveContext()
00675         // automagically.
00676         pPaperRegion->SaveContext();
00677     }
00678     else
00679     {
00680         // Change the device of the paper rendering region
00681         pPaperRegion->AttachDevice(this, pSpread, pDevContext, 
00682                                    RenderMatrix, Scale, ClipRect);
00683     }
00684 
00685     // Set up the rendering system.
00686     if (!pPaperRegion->StartRender())
00687     {
00688         TRACEALL( _T("StartRender failed for paper in OnDraw\n") );
00689         return;
00690     }
00691 
00692     // Render the paper objects using the permanent PaperRenderRegion.
00693     pPaperRegion->SaveContext();
00694     RenderPaper(pPaperRegion, pSpread);
00695     pPaperRegion->RestoreContext();
00696     pPaperRegion->StopRender();
00697     pPaperRegion->DetachDevice();
00698 
00699     // Draw the DragBlobs.
00700     Operation* pOp = Operation::GetCurrentDragOp();
00701     if (pOp != NULL)
00702         pOp->RenderDragBlobs(ClipRect, pSpread, m_bSolidDrag);
00703 }

SlowJobResult View::RenderSimpleNodes Node pNode,
RenderRegion pRender,
ProgressDisplay Progress,
Node pLastComplexNode = NULL
[protected]
 

Function to render nodes 'normally' during 3-pass rendering. This copes with stopping at the specified last complex node, and with only printing selected objects if the user has requested it.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
05/25/95
Parameters:
pNode - the node to start rendering at. [INPUTS] pRender - the render region to render the nodes into. Progress - usual progress info object. pLastComplexNode - optional: if not NULL, then stop rendering when this node is reached, otherwise render to completion.
Returns:
SLOWJOB_SUCCESS if rendered ok; SLOWJOB_FAILURE if an error occured; SLOWJOB_USERABORT if the user intervened - e.g. pressed Escape.
See also:
ProgressInfo; View::RenderSimpleView

Definition at line 2163 of file view.cpp.

02165 {
02166 #ifndef STANDALONE
02167     DocRect ClipRect = pRender->GetClipRect();
02168 
02169     // Work out whether we need to render all objects, or just the selected ones.
02170     BOOL RenderAllObjects = TRUE;
02171 //  WEBSTER-ranbirr-13/11/96
02172 #ifndef WEBSTER
02173     if (pRender->IsPrinting())
02174     {
02175         CCPrintInfo *pPrintInfo = CCPrintInfo::GetCurrent();
02176 //      ERROR2IF(pPrintInfo == NULL, SLOWJOB_FAILURE, "No print info while printing!");
02177         if (pPrintInfo != NULL)
02178         {
02179             PrintControl *pPrCtrl = pPrintInfo->GetPrintControl();
02180             RenderAllObjects = (pPrCtrl->GetObjPrintRange() == PRINTRANGEOBJ_ALL);
02181         }
02182     }
02183 #endif //webster
02184     // Render nodes into specified render region
02185     while ((pNode!=NULL) && (pNode != pLastComplexNode))
02186     {
02187         if (pNode->IsRenderable() && (RenderAllObjects || IsPrintableNodeSelected(pNode)))
02188         {
02189             // Render the node that we have
02190             pNode->Render(pRender);
02191 
02192             // If progress display is needed, update it if it's time.
02193             if (!Progress.IncProgress())
02194                 return SLOWJOB_USERABORT;
02195         }
02196 
02197         // Find another one to render
02198         pNode = pNode->FindNextForClippedInkRender(&ClipRect, pRender);
02199     }
02200 
02201     // All ok
02202     return SLOWJOB_SUCCESS;
02203 #else
02204     return SLOWJOB_FAILURE;
02205 #endif
02206 }

SlowJobResult View::RenderSimpleNodesUnclipped Node pNode,
RenderRegion pRender,
ProgressDisplay Progress,
Node pLastComplexNode = NULL
[protected]
 

Function to render nodes 'normally' during 3-pass rendering. This copes with stopping at the specified last complex node, and with only printing selected objects if the user has requested it.

Author:
Gerry_Iles (Xara Group Ltd) <camelotdev@xara.com>
Date:
08/03/2004
Parameters:
pNode - the node to start rendering at. [INPUTS] pRender - the render region to render the nodes into. Progress - usual progress info object. pLastComplexNode - optional: if not NULL, then stop rendering when this node is reached, otherwise render to completion.
Returns:
SLOWJOB_SUCCESS if rendered ok; SLOWJOB_FAILURE if an error occured; SLOWJOB_USERABORT if the user intervened - e.g. pressed Escape.
See also:
ProgressInfo; View::RenderSimpleView

Definition at line 4114 of file view.cpp.

04116 {
04117 #ifndef STANDALONE
04118     // Work out whether we need to render all objects, or just the selected ones.
04119     BOOL RenderAllObjects = TRUE;
04120 //  WEBSTER-ranbirr-13/11/96
04121 #ifndef WEBSTER
04122     if (pRender->IsPrinting())
04123     {
04124         CCPrintInfo *pPrintInfo = CCPrintInfo::GetCurrent();
04125 //      ERROR2IF(pPrintInfo == NULL, SLOWJOB_FAILURE, "No print info while printing!");
04126         if (pPrintInfo != NULL)
04127         {
04128             PrintControl *pPrCtrl = pPrintInfo->GetPrintControl();
04129             RenderAllObjects = (pPrCtrl->GetObjPrintRange() == PRINTRANGEOBJ_ALL);
04130         }
04131     }
04132 #endif //webster
04133     // Render nodes into specified render region
04134     while ((pNode!=NULL) && (pNode != pLastComplexNode))
04135     {
04136         if (pNode->IsRenderable() && (RenderAllObjects || IsPrintableNodeSelected(pNode)) && pNode->NeedsToRender(pRender))
04137         {
04138             // Render the node that we have
04139             pNode->Render(pRender);
04140 
04141             // If progress display is needed, update it if it's time.
04142             if (!Progress.IncProgress())
04143                 return SLOWJOB_USERABORT;
04144         }
04145 
04146         // Find another one to render
04147         pNode = pNode->FindNextForUnclippedInkRender(pRender);
04148     }
04149 
04150     // All ok
04151     return SLOWJOB_SUCCESS;
04152 #else
04153     return SLOWJOB_FAILURE;
04154 #endif
04155 }

RenderViewResult View::RenderSimpleView RenderRegion pRender,
Matrix ViewTrans,
Spread pSpread,
BOOL  PrintPaper
[virtual]
 

This function has been designed along similar lines to the RenderView() function found elsewhere in this file. This version of the function is slightly different though. This version of the function is able to render complex objects, such as transparent objects into normal render regions. It does this by first scanning through all the objects that need rendering to see if any of them require complex things. If they do, then part of the rendering is done into a bitmap and blitted over the rest of the shapes using a masked blit. All very complicated really!

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/4/95
Parameters:
pRender - The render region to render into [INPUTS] ViewTrans - the transform matrix to use for the rendering pSpread - the spread to render PrintPaper - TRUE if the paper should be rendered as well
Returns:
RENDERVIEW_SUCCESS - view was rendered successfully RENDERVIEW_FAILURE - an error occured while rendering the view. RENDERVIEW_NOTNEEDED - the view was not rendered as the usual RenderView call can be used instead. RENDERVIEW_USERABORT - the user aborted the rendering operation. (e.g. pressing Escape, or aborting the print job)
See also:
DocView::RenderView

Definition at line 3473 of file view.cpp.

03475 {
03476 #ifndef STANDALONE
03477 //  TRACEUSER( "Gerry", _T("View::RenderSimpleView\n"));
03478 
03479     BOOL bIsOnScreen = pRender->IS_KIND_OF(GRenderRegion);
03480 
03481     // if the preference says we should not be in this function then call the other function
03482     if (!bIsOnScreen && PrintMonitor::PrintMaskType==PrintMonitor::MASK_OPTIMAL)
03483         return RenderOptimalView(pRender, ViewTrans, pSpread, PrintPaper);
03484 
03485     // Find out what the host render region is capable of
03486     RRCaps Caps;
03487     pRender->GetRenderRegionCaps(&Caps);
03488 
03489     // Whether or not the rendering was successful.
03490     RenderViewResult Result = RENDERVIEW_FAILURE;
03491 
03492     // Find out the Clipping rectangle of the render region to draw into
03493     DocRect ClipRect = pRender->GetClipRect();
03494 
03495     // Work out whether we need to render all objects, or just the selected ones.
03496     BOOL RenderAllObjects = TRUE;
03497 #ifndef WEBSTER
03498     CCPrintInfo *pPrintInfo = NULL;
03499     if (!bIsOnScreen && pRender->IsPrinting())
03500     {
03501         pPrintInfo = CCPrintInfo::GetCurrent();
03502 //      ERROR2IF(pPrintInfo == NULL, RENDERVIEW_FAILURE, "No print info while printing!");
03503         if (pPrintInfo != NULL)
03504         {
03505             PrintControl *pPrCtrl = pPrintInfo->GetPrintControl();
03506             RenderAllObjects = (pPrCtrl->GetObjPrintRange() == PRINTRANGEOBJ_ALL);
03507         }
03508     }
03509 #endif //webster
03510     // Create and set up a new Scanning render region
03511     ScanningRenderRegion Scanner(pRender->IsPrinting());
03512 
03513     BOOL bDoScan = TRUE;
03514     
03515     if (bIsOnScreen)
03516     {
03517         // Now check the print method to determine if we need to do a three-pass render
03518         // Get document pointer
03519         Document* pDoc = GetDoc();
03520 
03521         // Get print information for this document.
03522         PrintComponent *pPrint = (PrintComponent *) pDoc->GetDocComponent(CC_RUNTIME_CLASS(PrintComponent));
03523         if (pPrint)
03524         {
03525             PrintControl *pPrintControl = pPrint->GetPrintControl();
03526             if (pPrintControl)
03527             {
03528                 if (pPrintControl->GetPrintMethod() != PRINTMETHOD_NORMAL)
03529                 {
03530                     bDoScan = FALSE;
03531                 }
03532             }
03533         }
03534     }
03535 
03536     // Declare some useful vars before the scanning chunk
03537 //  Node* pFirstInkNode = NULL;
03538 //  Node* pNode = NULL;
03539     if (bDoScan)
03540     {
03541         // Attach a device to the scanning render region
03542         // Since this rr does no real rendering, it does not need a Device context
03543         Scanner.AttachDevice(this, (CNativeDC *)NULL, pSpread);
03544 
03545         // Get it ready to render
03546         Scanner.SetMatrix(ViewTrans);
03547         Scanner.SetClipRect(ClipRect);
03548         
03549         // Start the render region and return if it fails
03550         if (!Scanner.StartRender())
03551             return RENDERVIEW_FAILURE;
03552         
03553         // and tell the scanning render region about the caps of the host region
03554         Scanner.SetHostRRCaps(Caps);
03555 
03556         //  WEBSTER-ranbirr-13/11/96
03557 #ifndef WEBSTER
03558         // We going to analyse the document
03559         if (pPrintInfo != NULL)
03560             pPrintInfo->SetAnalysing();
03561 #endif //webster
03562         // Find the first node to render
03563 //      pFirstInkNode = pSpread->FindFirstForUnclippedInkRender(&Scanner);
03564 //      Scanner.SetRenderState(pFirstInkNode);
03565 
03566         ScannerRenderCallback ScanCallback(this, RenderAllObjects, &Scanner);
03567 
03568         // Call RenderTree to do the rendering
03569         Scanner.RenderTree(pSpread, FALSE, FALSE, &ScanCallback);
03570         
03571         // Thats all the nodes rendered, so stop rendering  
03572         Scanner.StopRender();
03573     }
03574     
03575     //  WEBSTER-ranbirr-13/11/96
03576 #ifndef WEBSTER
03577     // We going to print the document now
03578     if (pPrintInfo != NULL)
03579         pPrintInfo->SetPrinting();
03580 #endif //webster
03581 
03582     // Ok, we now have a Scanning render region that has all the info we need to know in it.
03583     // See if there were any complex shapes in the region
03584     // If we didn't do a scan then pretend there is one complex node
03585     /*INT32 NumComplex =*/ bDoScan ? Scanner.GetNumComplex() : 1;
03586 
03587     // Oh well, there are complex shapes to draw, so we had better do the comlpex thing
03588 
03589     pRender->SetMatrix(ViewTrans);
03590     pRender->SetClipRect(ClipRect);
03591     
03592     // Ask the render region not to render complex shapes
03593     pRender->SetRenderComplexShapes(FALSE);
03594     
03595     // Start the render region and return if it fails
03596     if (!pRender->StartRender())
03597         return RENDERVIEW_FAILURE;
03598 
03599     // I think it likely we need to put something in here.
03600     if (pRender->IsPrinting())
03601     {
03602         // Render the spreads paper marks where necessary
03603         RenderPageMarks(pRender, ViewTrans, ClipRect, pSpread);
03604     }
03605 
03606     // Draw the paper if we have been asked to do so.
03607     if (PrintPaper)
03608     {
03609         // Render all paper nodes from there into the real render region
03610         pRender->SaveContext();
03611         RenderPaper(pRender, pSpread);
03612         pRender->RestoreContext();
03613 
03614         if (pRender->NeedsOSPaper)
03615         {
03616             // This render region uses the OS to render paper, so if we don't
03617             // render anything except paper then there is no need for e.g.
03618             // GRenderRegions to blit anything.  Hence we call this function
03619             // to clear the changed bbox.
03620             pRender->SetClean(TRUE, FALSE);
03621         }
03622 
03623         // The Paper is now done
03624         pRender->IsPaperRendered = TRUE;
03625     }
03626 
03627     // Find the first and last complex node in the document
03628     Node* pFirstComplexNode = Scanner.GetFirstComplexObject();  
03629     Node* pLastComplexNode = Scanner.GetLastComplexObject();
03630 
03631     // Create and initialise the progress display.
03632     // (NB. we don't always do progress display, e.g. for screens we don't bother)
03633     ProgressDisplay Progress;
03634 //  Progress.SetUp(pRender, &Scanner);
03635     INT32 NodesRendered = 0;
03636 
03637     // Find the first node to render
03638 //  pFirstInkNode = pSpread->FindFirstForUnclippedInkRender(pRender);
03639     if (!bDoScan)
03640     {
03641         pFirstComplexNode = pSpread;
03642         pLastComplexNode = NULL;
03643     }
03644 
03645     TRACE( _T("pFirstComplexNode = 0x%08x\n"), pFirstComplexNode);
03646     TRACE( _T("pLastComplexNode  = 0x%08x\n"), pLastComplexNode);
03647     
03648 //  pRender->SetRenderState(pFirstInkNode);
03649 
03650     // Find out about the first node and the first complex node
03651 //  pNode = pRender->GetRenderState();
03652 
03653     // Check to see if we should do a masked blit.
03654     // We always do it under NT, or to a PostScript printer or EPS file; under other conditions
03655     // we are controlled by the printing preference.
03656     BOOL DoMaskedBlit = FALSE;
03657     if (//IsWin32NT() || 
03658         bIsOnScreen ||
03659         (PrintMonitor::PrintMaskType==PrintMonitor::MASK_MASKED) ||
03660         (CCDC::GetType(pRender->GetRenderDC(), TRUE) == RENDERTYPE_PRINTER_PS) ||
03661         IS_A(pRender, CamelotEPSRenderRegion))
03662     {
03663         DoMaskedBlit = bDoScan;             // Don't render simple phase if not scanning
03664     }
03665     SimplePrintRenderCallback MyCallback(this, pSpread, RenderAllObjects, &Scanner, DoMaskedBlit, PrintPaper, &NodesRendered, &Progress);
03666     pRender->RenderTree(pSpread, FALSE, FALSE, &MyCallback);
03667 
03668     pRender->StopRender();
03669 
03670     // If we get here, it all worked
03671     Result = RENDERVIEW_SUCCESS;
03672 
03673 //ExitRenderSimpleView:
03674 
03675     // Unlink the RenderRegion from list and error if it was not there
03676     BOOL InList = Camelot.DeleteRenderRegion(pRender);
03677     ERROR2IF(!InList,RENDERVIEW_FAILURE,"DocView::RenderView tried to delete a RenderRegion not in the list");
03678 
03679     // Instruct the render region to commit suicide. This call doesn't work on a CamelotEPS
03680     // render region.
03681     pRender->ConditionalSuicide ();
03682 
03683     // Finish progress bar for EPS export
03684     if (Result == RENDERVIEW_SUCCESS)
03685         Progress.AllStagesDone();
03686 
03687 //  TRACEUSER( "Gerry", _T("End of View::RenderSimpleView\n"));
03688 
03689     return Result;
03690 
03691 #else
03692     return RENDERVIEW_USERABORT;
03693 #endif
03694 }

virtual BOOL View::RenderTreeCallback Node pNode,
RenderRegion pRender
[inline, virtual]
 

Definition at line 281 of file view.h.

00281 {return TRUE;}

void View::SetColourContext ColourModel  Model,
ColourContext NewContext = NULL
 

Sets a new colour context for this view.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/6/96
Parameters:
Model - The colour model of this context [INPUTS] NewContext - NULL to delete any existing context attached to this view, or a pointer to the new context to use. Any old attached context will be deleted. The new context is now "owned" by the view, which will delete it when it is finished with it.
When we render to a view, an appropriate CMYK or RGB context is used for output, fetched by calling View::GetColourContext. Normally, the view will get a global default context, attach a copy of the View's ColourPlate (see View::SetColourPlate) to it, and return that. However, if you set a special context, this will be used instead of a global default.

This is only currently used by the printing system to use a CMYK context which knows how to colour-correct separated output for the output printer device.

Notes: Once given to a view, the ColourContext is "Owned" by the view, and will be deleted when the view is deleted, or when this function is called to set a different context active. Call this function with a NULL pointer to clear any existing ColourContext attached to the view.

The View will attach the context to the global ColourContext list for you

The View will always attach its own ColourPlate to the ColourContext that you pass in, overriding any ColourPlate you may have given it.

(Implementation) The View keeps a special array of BOOLs next to its Array of contexts, which tell it whether the context in the cache is one created on demand by the view (which it can delete when the ColourPlate is changed) or one passed in by the caller (which should only be deleted on destruction or Context change)

See also:
View::SetColourPlate; View::GetColourPlate; View::GetColourContext

Definition at line 1613 of file view.cpp.

01614 {
01615     ColourContextList *cclist = ColourContextList::GetList();
01616     ERROR3IF(cclist == NULL, "No ColourContextList? What's up?");
01617 
01618     if (ColourContexts.Context[Model] != NULL)
01619         cclist->RemoveContext(&(ColourContexts.Context[Model]));
01620 
01621     ColourContexts.Context[Model] = NewContext;
01622     ShouldDeleteContext[Model] = TRUE;      // Reset the auto-delete flag by default
01623 
01624     if (NewContext != NULL)
01625     {
01626         ERROR3IF(Model != NewContext->GetColourModel(),
01627                     "View::SetColourContext - Model must match colour context's model!");
01628 
01629         ColourPlate *NewPlate = NULL;
01630         if (ColPlate != NULL)
01631             NewPlate = new ColourPlate(*ColPlate);
01632 
01633         // Attach our ColourPlate to the context, add it into our cache of ColourContexts,
01634         // and add the new context to the context list
01635         NewContext->SetColourPlate(NewPlate);
01636 
01637         cclist->AddContext(&(ColourContexts.Context[Model]));
01638 
01639         if (ColourContexts.Context[Model] != NULL)
01640         {
01641             // Instruct ourselves not to auto-delete this context from the cache
01642             ShouldDeleteContext[Model] = FALSE;
01643         }
01644     }
01645 }

void View::SetColourPlate ColourPlate NewPlate,
BOOL  bSendContextChanged = TRUE
 

Sets a new colour plate (colour separation description for this view. Any future requests for colour contexts for this view (e.g. the next time it is redrawn, etc) will return a ColourContext using this new ColourPlate.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
13/6/96
Parameters:
NewPlate - NULL (to remove any attached plate), or a pointer to a new [INPUTS] ColourPlate to use - (the existing COlourPLate attached to this view will be deleted, and replaced with a copy of this new ColourPlate)
Notes: A copy is made of the ColourPlate object - you still own the one you lent us.

See also:
View::GetColourPlate; View::GetColourContext

Definition at line 1525 of file view.cpp.

01526 {
01527     if (ColPlate != NULL)
01528     {
01529         delete ColPlate;
01530         ColPlate = NULL;
01531     }
01532 
01533     if (NewPlate != NULL)
01534         ColPlate = new ColourPlate(*NewPlate);
01535 
01536     // Wipe any cached colour contexts for the old ColourPlate
01537     ColourContextList *cclist = ColourContextList::GetList();
01538     ERROR3IF(cclist == NULL, "No ColourContextList? What's up?");
01539 
01540     for (INT32 i = 0; i < (INT32) MAX_COLOURMODELS; i++)
01541     {
01542         if (ColourContexts.Context[i] != NULL)
01543         {
01544             if (ShouldDeleteContext[i])
01545                 cclist->RemoveContext(&(ColourContexts.Context[i]));
01546             else
01547             {
01548                 // We didn't cache this context, so we shouldn't delete it
01549                 // Instead, we should just change it over to use the new ColourPlate
01550                 ColourPlate *NewPlate = NULL;
01551                 if (ColPlate != NULL)
01552                     NewPlate = new ColourPlate(*ColPlate);
01553 
01554                 // Attach the ColourPlate to the context - even if it is NULL this is safe
01555                 ColourContexts.Context[i]->SetColourPlate(NewPlate);
01556             }
01557         }
01558     }
01559 
01560     // And if necessary, inform everybody that the colour separation options for 
01561     // the selected view have been changed
01562     if (bSendContextChanged && this == DocView::GetSelected())
01563         ColourManager::SelViewContextHasChanged();
01564 }

BOOL View::SetCurrent  ) 
 

Make this object be the 'current' View.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
24/5/93
Returns:
TRUE if function set current correctly FALSE otherwise (then an Error has been set)

Reimplemented in DocView.

Definition at line 411 of file view.cpp.

00412 {
00413 #ifdef RALPH
00414     // if we are being called from the load thread just ignore 
00415     if(::GetCurrentThreadId() == RalphDocument::GetImportingThreadID())
00416         return TRUE;
00417 #endif
00418     if (Current!=this)
00419     {
00420         Current = this;
00421 
00422         if (this != NULL)
00423         {
00424             SetViewPixelSize();
00425             if (pDoc != NULL) 
00426                 pDoc->SetCurrent();
00427         }
00428     }
00429 
00430     return TRUE;
00431 }                                                     

virtual void View::SetExtent DocCoord  ,
DocCoord 
[pure virtual]
 

Implemented in DocView, ExpressView, PrintView, XPFView, ClipboardView, DialogView, and MetafileView.

BOOL View::SetForceDefaultColourContexts BOOL  bForceDefault = TRUE  )  [inline]
 

Definition at line 376 of file view.h.

00377     {
00378         BOOL bOldForce = ForceDefaultColourContexts;
00379         ForceDefaultColourContexts = bForceDefault;
00380         return(bOldForce);
00381     }

virtual void View::SetForeBackMode BOOL   )  [pure virtual]
 

Implemented in DocView, ExpressView, PrintView, XPFView, ClipboardView, DialogView, and MetafileView.

void View::SetNoCurrent  )  [static]
 

Set the current View pointer to be NULL, i.e., there is no current View object.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
24/5/93

Reimplemented in DocView.

Definition at line 446 of file view.cpp.

00447 {
00448 #ifdef RALPH
00449     // if we are being called from the load thread just ignore 
00450     if(::GetCurrentThreadId() == RalphDocument::GetImportingThreadID())
00451         return ;
00452 #endif
00453 
00454     // Set no current View or Document.
00455     Current = NULL;
00456     Document::SetNoCurrent();
00457 }

void View::SetPixelSize FIXED16  NewPixelWidth,
FIXED16  NewPixelHeight
[virtual]
 

Set the size of a pixel in this view.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
02/10/95
Parameters:
PixelWidth,PixelHeight - new pixel size to use. [INPUTS]

Definition at line 1272 of file view.cpp.

01273 {
01274     PixelWidth = NewPixelWidth;
01275     PixelHeight = NewPixelHeight;
01276 }

void View::SetScaledPixelSize FIXED16  NewScaledPixelWidth,
FIXED16  NewScaledPixelHeight
[virtual]
 

Set the size of a scaled pixel in this view.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
02/10/95
Parameters:
NewScaledPixelWidth,NewScaledPixelHeight - new scaled pixel size to use. [INPUTS]

Definition at line 1367 of file view.cpp.

01368 {
01369     ScaledPixelWidth = NewScaledPixelWidth;
01370     ScaledPixelHeight = NewScaledPixelHeight;
01371 }

BOOL View::SetScrollOffsets WorkCoord  NewTopLeft,
BOOL  RedrawNeeded = TRUE
[virtual]
 

To scroll this view to a new position over the document. The coordinate supplied is the coordinate of the top left corner of the viewport onto the document. The RedrawNeeded flag is TRUE when any invalid areas created should be redrawn immediately and FALSE if they should be ignored.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/7/93
Parameters:
New scroll offsets [INPUTS] Flag to control whether redraw is needed or not

Reimplemented in DocView.

Definition at line 1008 of file view.cpp.

01009 {
01010 //  TRACE(_T("View::SetScrollOffsets(%d, %d)\n"), (INT32)(NewTopLeft.x), (INT32)(NewTopLeft.y));
01011     ERROR2IF(this==NULL,FALSE,"View member func called on NULL pointer");
01012 
01013     //Graham 7/12/97: Downgraded to an error 3, otherwise this can go off in retail builds
01014     if (NewTopLeft.x < (XLONG)0  || NewTopLeft.y > (XLONG)0)
01015     {
01016         ERROR3("View::SetScrollOffsets - invalid parameters");
01017         return FALSE;
01018     }
01019 
01020     pVState->SetScrollPos(NewTopLeft);          // Set the new scroll offsets
01021     return TRUE;
01022 }

virtual void View::SetViewPixelSize  )  [pure virtual]
 

Implemented in DocView, ExpressView, PrintView, XPFView, ClipboardView, DialogView, and MetafileView.

BOOL View::SetViewScale FIXED16  NewScale  )  [virtual]
 

Set the viewing scale factor for this view. (Also, sets up the scaled pixel size in DocCoord if this View is current.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
31/5/93
Parameters:
New view scale factor [INPUTS]

Reimplemented in DocView.

Definition at line 1059 of file view.cpp.

01060 {
01061     ERROR2IF(this==NULL,FALSE,"View member func called on NULL pointer");
01062     ERROR2IF(pVState==NULL,FALSE,"View not connected to ViewState");
01063 
01064     // Set the new scale
01065     pVState->ViewScale = Scale = NewScale;
01066 
01067     // Set up the scaled pixel size for this view according to new scale.
01068     SetViewPixelSize();
01069 
01070     // Inform the Viewstate that it has been changed and that the doc extent may
01071     // need to be recomputed...
01072     ViewStateChanged();
01073 
01074     return TRUE;
01075 }

void View::SetViewState ViewState pvs  )  [virtual]
 

Sets the structure which is shared by both View and the OIL view object to which it is connected. NB. PrintViews do NOT share the ViewState with the OIL view, because the OIL view is the screen based view, so the PrintView is the only one that needs to use the view state. The CCamView always uses the ViewState of its DocView, not its PrintView.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/5/93
Returns:
A pointer to the ViewState object associated with this View.

Definition at line 476 of file view.cpp.

00477 {
00478     ERROR3IF(pvs == NULL, "View::SetViewState called with a null parameter!");
00479     
00480     // Justin here: removed this ERROR3 because it stops the workspace restoration code
00481     // working.  This is a temp fix, just for the 1.1 release.  What we need is a function
00482     // that allows you to *change* the ViewState this View refers to, and unfortunately
00483     // the effect of these two ERROR3's is to make that impossible, as you can't pass a new
00484     // ViewState, or set th existing one to null.
00485 //  ERROR3IF(pVState != NULL, "View::SetViewState called when view already has a view state.");
00486     
00487     pVState = pvs;
00488     
00489     // Inform the ViewState object which view it is describing.
00490     pVState->pView = this;
00491 }

virtual BOOL View::ViewStateChanged  )  [pure virtual]
 

Implemented in DocView, ExpressView, PrintView, XPFView, ClipboardView, DialogView, and MetafileView.


Member Data Documentation

ColourContextArray View::ColourContexts [protected]
 

Definition at line 385 of file view.h.

ColourPlate* View::ColPlate [protected]
 

Definition at line 384 of file view.h.

View * View::Current = NULL [static, protected]
 

Definition at line 260 of file view.h.

BOOL View::ForceDefaultColourContexts [protected]
 

Definition at line 388 of file view.h.

BOOL View::m_bSolidDrag [protected]
 

Definition at line 418 of file view.h.

Document* View::pDoc [protected]
 

Definition at line 242 of file view.h.

DocRect View::PhysExtent [protected]
 

Definition at line 400 of file view.h.

FIXED16 View::PixelHeight [protected]
 

Definition at line 350 of file view.h.

FIXED16 View::PixelWidth [protected]
 

Definition at line 350 of file view.h.

PaperRenderRegion * View::pOnTopRegion = NULL [static, private]
 

Definition at line 313 of file view.h.

PaperRenderRegion * View::pPaperRegion = NULL [static, private]
 

Definition at line 310 of file view.h.

CCamView* View::pViewWindow [protected]
 

Definition at line 241 of file view.h.

ViewState* View::pVState [protected]
 

Definition at line 243 of file view.h.

Quality View::RenderQuality
 

Definition at line 283 of file view.h.

FIXED16 View::Scale [protected]
 

Definition at line 399 of file view.h.

FIXED16 View::ScaledPixelHeight [protected]
 

Definition at line 354 of file view.h.

FIXED16 View::ScaledPixelWidth [protected]
 

Definition at line 354 of file view.h.

BOOL View::ShouldDeleteContext[16] [protected]
 

Definition at line 386 of file view.h.


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