BlobManager Class Reference

Class to Manage the various types of selection blobs in Camelot. Currently Camelot knows about the following forms of selection blob :-. More...

#include <blobs.h>

Inheritance diagram for BlobManager:

MessageHandler ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

 BlobManager ()
 Default constructor for the blob manager, marks all the blobs as off.
 ~BlobManager ()
void ToolInterest (BlobStyle)
void AddInterest (BlobStyle)
 If the blobs specified are not already displayed, then they are rendered onto the screen. The Flags that the blob manager maintains about which blobs are on screen and which are not are also updated.
void RemoveInterest (BlobStyle)
 If the blobs specified are already displayed, then they are rendered onto the screen to get rid of them (EORing!). The Flags that the blob manager maintains about which blobs are on screen and which are not are also updated.
BlobStyle GetCurrentInterest (BOOL bIgnoreOffState=FALSE)
 Allows people other than the blobmanager to know what blob are currently displayed.
void BlobRenderingOff (BOOL Redraw)
 After calling this function, any attempts to render blobs from anywhere in Camelot will result in nothing appearing on screen. This is a dangerous function to call if you are not sure what is going on. Normally you should use this function if you are about to do something that will involve the selection state becoming inconsistent with the blobs on screen and you specifically do not want lots of blob rendering going on until you have finished. Here is an example way of using it MonoOn Get rid of the blobs from the screen BlobMgr->BlobRenderingOff(TRUE);.
void BlobRenderingOn (BOOL Redraw)
 If blob rendering has been turned off ( by calling BlobRenderinOff() ) then this function will re-enable it so that rendering can carry on like normal. Ideally this should be called not very long after calling BlobRenderingOff().
INT32 GetBlobSize ()
 This function allows you to find out how wide a blob should be.
void GetBlobRect (const DocCoord &Centre, DocRect *Rect, BOOL MFill=FALSE, BlobType eBlobType=BT_SELECTEDLARGEST)
 Finds the rectangle of a blob that surrounds a given coord. This is to replace the rather long winded method that had to be employed before. If there is no selected document it will leave the rect unchanged.
void Render (DocRect *Rect, Spread *pSpread)
 This function will render all the blobs that are currently being displayed for the given clipping rectangle.
void RenderOn (DocRect *Rect, Spread *pSpread)
 This function will render on all the blobs that are currently being displayed for the given clipping rectangle.
void RenderOff (DocRect *Rect, Spread *pSpread)
 This function will render off all the blobs that are currently being displayed for the given clipping rectangle.
void RenderMyBlobs (DocRect *Rect, Spread *pSpread, NodeRenderable *pNode)
 Renders the blobs for the given node. Only the required blobs are rendered and since the blobs are EOR rendered, this function can be used to put the blobs onto the screen or take them off the screen.
void RenderMyBlobsOn (DocRect *Rect, Spread *pSpread, NodeRenderable *pNode)
 This function will render on all the blobs that are currently being displayed for the given clipping rectangle.
void RenderMyBlobsOff (DocRect *Rect, Spread *pSpread, NodeRenderable *pNode)
 This function will render off all the blobs that are currently being displayed for the given clipping rectangle.
void RenderObjectBlobs (DocRect *Rect, Spread *pSpread, NodeRenderable *pNode)
 This function will render all the blobs that are currently being displayed for the given clipping rectangle.
void RenderObjectBlobsOn (DocRect *Rect, Spread *pSpread, NodeRenderable *pNode)
 This function will render on all the blobs that are currently being displayed for the given clipping rectangle.
void RenderObjectBlobsOff (DocRect *Rect, Spread *pSpread, NodeRenderable *pNode)
 This function will render off all the blobs that are currently being displayed for the given clipping rectangle.
void RenderToolBlobsOn (Tool_v1 *pTool, Spread *pSpread, DocRect *pClipRect)
 This function will render on the specified tools blobs.
void RenderToolBlobsOff (Tool_v1 *pTool, Spread *pSpread, DocRect *pClipRect)
 This function will render off the specified tools blobs.
BOOL IsRemovingBlobs ()

Protected Member Functions

void RenderRequiredBlobs (NodeRenderable *, RenderRegion *)
 Renders the required blobs for the given node into the given render region. The required blobs are specified by the tool when it is activated.
void RenderSpecificBlobs (NodeRenderable *, RenderRegion *, BOOL, BOOL, BOOL, BOOL, BOOL, BOOL, BOOL)
 Renders only the blobs specified. This is called from the Add and Remove Interest Functions to add new types of blob to the display or take types of blob that are no longer needed off the display.
void RenderRequiredBlobsOnSelection (DocRect *Rect)
 Renders the required blobs for the given node into the given render region. The required blobs are specified by the tool when it is activated.
void RenderSpecificBlobsOnSelection (DocRect *Rect, BOOL, BOOL, BOOL, BOOL, BOOL, BOOL, BOOL)
 Renders only the blobs specified. This is called from the Add and Remove Interest Functions to add new types of blob to the display or take types of blob that are no longer needed off the display.
BOOL NeedToRenderSelectionBlobs (DocRect *Rect)
 Check to make sure we need to render some blobs.
BOOL NeedToRenderNodeBlobs (DocRect *Rect, Spread *pSpread, NodeRenderable *pNode)
 Check to make sure we need to render some blobs.
MsgResult Message (Msg *Msg)
 Handles the View Changing message, and makes sure that the blobs are removed from the old view and drawn onto the new view.

Protected Attributes

BOOL IsFillBlob
BOOL IsObjectBlob
BOOL IsArtisticBlob
BOOL IsTinyBlob
BOOL IsPenBlob
BOOL IsToolObjectBlob
BOOL IsEffectBlob
BOOL DrawBlobsAtAll
BOOL RemovingBlobs
BOOL bToolBlobsAreOff

Private Member Functions

 CC_DECLARE_MEMDUMP (BlobManager)

Detailed Description

Class to Manage the various types of selection blobs in Camelot. Currently Camelot knows about the following forms of selection blob :-.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/6/94
Fill Blobs - The blobs rendered by things like Graduated fills to show where the fill starts and ends, it direction etc.

Object Blobs - The blobs that appear to edit the shape of an object. ie the control point blobs on a path

Artistic Blobs - Used to edit information such as pressure details along shapes.

Tiny Blobs - the Blob that is displayed by an object when it is the Boundary selection mode of the selector tool to indicate that it is one of the selected objects.

ToolObject Blobs - These blobs are displayed and used by an object only when a specific tool is selected. They are similar to object blobs except that the _object_ has the final say in whether they are rendered/used or not.

Definition at line 208 of file blobs.h.


Constructor & Destructor Documentation

BlobManager::BlobManager  ) 
 

Default constructor for the blob manager, marks all the blobs as off.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/6/94

Definition at line 194 of file blobs.cpp.

00194                          : MessageHandler(CC_RUNTIME_CLASS(MessageHandler), TRUE)
00195 {
00196     // There are no blobs visible when we start
00197     IsFillBlob = FALSE;
00198     IsObjectBlob = FALSE;
00199     IsArtisticBlob = FALSE;
00200     IsTinyBlob = FALSE;
00201     IsPenBlob = FALSE;
00202     IsToolObjectBlob = FALSE;
00203     IsEffectBlob = FALSE;
00204 
00205     // Blob rendering is switched on by default
00206     DrawBlobsAtAll = TRUE;
00207 
00208     RemovingBlobs = FALSE;
00209 
00210     bToolBlobsAreOff = FALSE;
00211 }

BlobManager::~BlobManager  )  [inline]
 

Definition at line 216 of file blobs.h.

00216 {}


Member Function Documentation

void BlobManager::AddInterest BlobStyle  Blobs  ) 
 

If the blobs specified are not already displayed, then they are rendered onto the screen. The Flags that the blob manager maintains about which blobs are on screen and which are not are also updated.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/6/94
Parameters:
Blobs - The blobs that you which to add to the ones currently displayed [INPUTS]
See also:
BlobManager::RemoveInterest; BlobStyle

Definition at line 332 of file blobs.cpp.

00333 {
00334     RemovingBlobs = FALSE;
00335 
00336     // First we have to work out which bits of the we have to add.
00337     // Do we need Object blobs to be rendered
00338     BOOL DrawObject = FALSE;
00339     if (!IsObjectBlob && Blobs.Object)
00340     {
00341         DrawObject = TRUE;
00342         IsObjectBlob = TRUE;
00343     }
00344 
00345     // Do we need Artistic blobs to be rendered
00346     BOOL DrawArtistic = FALSE;
00347     if (!IsArtisticBlob && Blobs.Artistic)
00348     {
00349         DrawArtistic = TRUE;
00350         IsArtisticBlob = TRUE;
00351     }
00352 
00353     // Do we need Fill blobs to be rendered
00354     BOOL DrawFill = FALSE;
00355     if (!IsFillBlob && Blobs.Fill)
00356     {
00357         DrawFill = TRUE;
00358         IsFillBlob = TRUE;
00359     }
00360 
00361     // Do we need Effect blobs to be rendered
00362     BOOL DrawEffect = FALSE;
00363     if (!IsEffectBlob && Blobs.Effect)
00364     {
00365         DrawEffect = TRUE;
00366         IsEffectBlob = TRUE;
00367     }
00368 
00369     // Do we need Tiny blobs to be rendered
00370     BOOL DrawTiny = FALSE;
00371     if (!IsTinyBlob && Blobs.Tiny)
00372     {
00373         DrawTiny = TRUE;
00374         IsTinyBlob = TRUE;
00375     }
00376 
00377     // Do we need Pen blobs to be rendered
00378     BOOL DrawPen = FALSE;
00379     if (!IsPenBlob && Blobs.Pen)
00380     {
00381         DrawPen = TRUE;
00382         IsPenBlob = TRUE;
00383     }
00384 
00385     // Do we need ToolObject blobs to be rendered
00386     BOOL DrawToolObject = FALSE;
00387     if (!IsToolObjectBlob && Blobs.ToolObject)
00388     {
00389         DrawToolObject = TRUE;
00390         IsToolObjectBlob = TRUE;
00391     }
00392 
00393     if (!NeedToRenderSelectionBlobs(NULL))
00394         return;
00395 
00396     RenderSpecificBlobsOnSelection( NULL, DrawObject, DrawArtistic, 
00397                                     DrawFill, DrawTiny, DrawPen, DrawToolObject, DrawEffect);
00398 
00399     // Now EOR off in all the render regions that are still rendering,
00400     // so that the Blob rendering when the region is finished, 
00401     // will put them on
00402     RenderRegionList* pRegionList = GetApplication()->GetRegionList();
00403 
00404     if (!pRegionList->IsEmpty())
00405     {
00406         // Find out which spread the selection is on
00407         SelRange* Selected = GetApplication()->FindSelection();
00408         Node* pNode = Selected->FindFirst();
00409         
00410         if (pNode)  // Is there a Selection ?
00411         {
00412             Spread* pSpread = pNode->FindParentSpread();
00413 
00414             RenderRegion* pRegion = (RenderRegion*)pRegionList->GetHead();  
00415 
00416             while (pRegion)
00417             {
00418                 // Check the RenderRegion is for the same spread.
00419                 if (pRegion->GetRenderSpread() == pSpread &&
00420                     pRegion->GetRenderView()==DocView::GetSelected() &&
00421                     (pRegion->IsInkRenderStarted || pRegion->NeedsOSPaper))
00422                 {
00423                     // Render the blobs 'clipped' to this Render Region.
00424                     DocRect ClipRect = pRegion->GetRegionRect();
00425                     RenderSpecificBlobsOnSelection( &ClipRect,
00426                                                     DrawObject, DrawArtistic, DrawFill,
00427                                                     DrawTiny, DrawPen, DrawToolObject, DrawEffect );
00428                 }
00429 
00430                 // Get the Next render region
00431                 pRegion = (RenderRegion*)pRegionList->GetNext(pRegion);
00432             }
00433         }
00434     }
00435 }

void BlobManager::BlobRenderingOff BOOL  Redraw  ) 
 

After calling this function, any attempts to render blobs from anywhere in Camelot will result in nothing appearing on screen. This is a dangerous function to call if you are not sure what is going on. Normally you should use this function if you are about to do something that will involve the selection state becoming inconsistent with the blobs on screen and you specifically do not want lots of blob rendering going on until you have finished. Here is an example way of using it MonoOn Get rid of the blobs from the screen BlobMgr->BlobRenderingOff(TRUE);.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/7/94
Parameters:
Redraw - TRUE if you want the blob to be rendered before blob rendering is [INPUTS] turned off.
Party on the selection and change lots of things ...

Invalidate the region of the blobs ...

Switch the blob manager back on again but leave the rendering of the blobs to the normal OnDraw loop BlobMgr->BlobRenderingOn(FALSE) MonoOff

See also:
BlobManager::BlobRenderingOn()

Definition at line 628 of file blobs.cpp.

00629 {
00630     RemovingBlobs = TRUE;
00631 
00632     if (Redraw && NeedToRenderSelectionBlobs(NULL))
00633     {
00634         // EOR on in all the render regions that are still rendering,
00635         // so that the Blob rendering when the region is finished, 
00636         // will take them off
00637         RenderRegionList* pRegionList = GetApplication()->GetRegionList();
00638 
00639         if (!pRegionList->IsEmpty())
00640         {
00641             // Find out which spread the selection is on
00642             SelRange* Selected = GetApplication()->FindSelection();
00643             Node* pNode = Selected->FindFirst();
00644 
00645             if (pNode)  // Is there a Selection ?
00646             {
00647                 Spread* pSpread = pNode->FindParentSpread();
00648 
00649                 RenderRegion* pRegion = (RenderRegion*)pRegionList->GetHead();  
00650 
00651                 while (pRegion)
00652                 {
00653                     // Check the RenderRegion is for the same spread.
00654                     if (pRegion->GetRenderSpread() == pSpread &&
00655                         pRegion->GetRenderView()==DocView::GetSelected() &&
00656                         (pRegion->IsInkRenderStarted || pRegion->NeedsOSPaper))
00657                     {
00658                         // Render the blobs 'clipped' to this Render Region.
00659                         DocRect ClipRect = pRegion->GetRegionRect();
00660                         RenderRequiredBlobsOnSelection(&ClipRect);
00661                     }
00662 
00663                     // Get the Next render region
00664                     pRegion = (RenderRegion*)pRegionList->GetNext(pRegion);
00665                 }
00666             }
00667         }
00668 
00669         RenderRequiredBlobsOnSelection(NULL);
00670     }
00671 
00672     // Mark blob rendering to be off
00673     DrawBlobsAtAll = FALSE;
00674 
00675     // Bodge to stop fill meshes EOR each other out.
00676     AttrFillGeometry::LastRenderedMesh = NULL;
00677 }

void BlobManager::BlobRenderingOn BOOL  Redraw  ) 
 

If blob rendering has been turned off ( by calling BlobRenderinOff() ) then this function will re-enable it so that rendering can carry on like normal. Ideally this should be called not very long after calling BlobRenderingOff().

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/7/94
Parameters:
Redraw - TRUE if you want the blobs to be rendered before blob rendering is [INPUTS] turned on.
See also:
BlobManager::BlobRenderingOn()

Definition at line 696 of file blobs.cpp.

00697 {
00698     RemovingBlobs = FALSE;
00699 
00700     if (Redraw && NeedToRenderSelectionBlobs(NULL))
00701     {
00702         RenderRequiredBlobsOnSelection(NULL);
00703 
00704         // Now EOR off in all the render regions that are still rendering,
00705         // so that the Blob rendering when the region is finished, 
00706         // will put them on
00707         RenderRegionList* pRegionList = GetApplication()->GetRegionList();
00708 
00709         if (!pRegionList->IsEmpty())
00710         {
00711             // Find out which spread the selection is on
00712             SelRange* Selected = GetApplication()->FindSelection();
00713             Node* pNode = Selected->FindFirst();
00714 
00715             if (pNode)  // Is there a Selection ?
00716             {
00717                 Spread* pSpread = pNode->FindParentSpread();
00718 
00719                 RenderRegion* pRegion = (RenderRegion*)pRegionList->GetHead();  
00720 
00721                 while (pRegion)
00722                 {
00723                     // Check the RenderRegion is for the same spread.
00724                     if (pRegion->GetRenderSpread() == pSpread &&
00725                         pRegion->GetRenderView()==DocView::GetSelected() &&
00726                         (pRegion->IsInkRenderStarted || pRegion->NeedsOSPaper))
00727                     {
00728                         // Render the blobs 'clipped' to this Render Region.
00729                         DocRect ClipRect = pRegion->GetRegionRect();
00730                         RenderRequiredBlobsOnSelection(&ClipRect);
00731                     }
00732 
00733                     // Get the Next render region
00734                     pRegion = (RenderRegion*)pRegionList->GetNext(pRegion);
00735                 }
00736             }
00737         }
00738     }
00739 
00740     // Mark blob rendering to be on
00741     DrawBlobsAtAll = TRUE;
00742 
00743     // Bodge to stop fill meshes EOR each other out.
00744     AttrFillGeometry::LastRenderedMesh = NULL;
00745 }

BlobManager::CC_DECLARE_MEMDUMP BlobManager   )  [private]
 

void BlobManager::GetBlobRect const DocCoord Centre,
DocRect Rect,
BOOL  MFill = FALSE,
BlobType  eBlobType = BT_SELECTEDLARGEST
 

Finds the rectangle of a blob that surrounds a given coord. This is to replace the rather long winded method that had to be employed before. If there is no selected document it will leave the rect unchanged.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
27/6/94
Parameters:
Centre - The coordinate to centre the blob on [INPUTS] MFill = Whether we should force this routine to use multi-stage fill routine
Rect - The rect in DocCoords of the blobs [OUTPUTS]
Karim 22/05/2000 - modified this method to take a BlobType param. Note that you *cannot* make use of this new param until the MFill param is removed and all current instances of GetBlobRect() updated. The new param is currently only checked against my ClipView blob type.

Definition at line 793 of file blobs.cpp.

00795 {
00796     // We will be needing a view to do this
00797     DocView* pDocView = DocView::GetSelected();
00798 
00799     // Find out how big a rect is these days, if we have a view
00800     if (pDocView!=NULL)
00801     {
00802         switch (eBlobType)
00803         {
00804         case BT_CLIPVIEW:
00805             OSRenderRegion::GetBlobRect(pDocView->GetViewScale(), Centre, BT_CLIPVIEW, Rect);
00806             break;
00807 
00808         default:
00809             if (!MFill)
00810             {
00811                 OSRenderRegion::GetBlobRect(pDocView->GetViewScale(), Centre, BT_SELECTEDLARGEST, Rect);
00812             }
00813             else
00814             {
00815                 OSRenderRegion::GetBlobRect(pDocView->GetViewScale(), Centre, BT_MSTAGESELECTEDLARGEST, Rect);
00816             }
00817             break;
00818         }
00819     }
00820 }

INT32 BlobManager::GetBlobSize  ) 
 

This function allows you to find out how wide a blob should be.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
27/6/94
Returns:
INT32 - The size (in DocCoords) of a blob.

Definition at line 761 of file blobs.cpp.

00762 {
00763     // To do this, we need to find out how big a blobs rect is
00764     DocRect Rect;
00765     GetBlobRect(DocCoord(0,0), &Rect);
00766 
00767     // return the width of the resulting rect
00768     return Rect.Width();
00769 }

BlobStyle BlobManager::GetCurrentInterest BOOL  bIgnoreOffState = FALSE  ) 
 

Allows people other than the blobmanager to know what blob are currently displayed.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/8/94
Parameters:
bIgnoreOffState - Flag for use by GetBlobBoundingRect functions so that [INPUTS] they can return correct bounds even when blob rendering is turned off
Returns:
A 'BlobStyle' refecting the current blob interest
See also:
BlobManager::AddInterest; BlobStyle

Definition at line 574 of file blobs.cpp.

00575 {
00576     // Make a default blob style with all interest off.
00577     BlobStyle CurrentBlobs;
00578 
00579     if (DrawBlobsAtAll || bIgnoreOffState)
00580     {
00581         // Update it with the current Interest
00582         CurrentBlobs.Fill       = IsFillBlob;
00583         CurrentBlobs.Effect     = IsEffectBlob;
00584         CurrentBlobs.Object     = IsObjectBlob;
00585         CurrentBlobs.Artistic   = IsArtisticBlob;
00586         CurrentBlobs.Tiny       = IsTinyBlob;
00587         CurrentBlobs.Pen        = IsPenBlob;
00588         CurrentBlobs.ToolObject = IsToolObjectBlob;
00589     }
00590 
00591     return CurrentBlobs;
00592 }

BOOL BlobManager::IsRemovingBlobs  )  [inline]
 

Definition at line 251 of file blobs.h.

00251 { return RemovingBlobs; }

MsgResult BlobManager::Message Msg Message  )  [protected, virtual]
 

Handles the View Changing message, and makes sure that the blobs are removed from the old view and drawn onto the new view.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/6/94
Parameters:
Message - the message to examine [INPUTS]
Returns:
-

Reimplemented from MessageHandler.

Definition at line 1600 of file blobs.cpp.

01601 {
01602     if (MESSAGE_IS_A(Message, DocViewMsg))
01603     {
01604         // Get a version of the message in the right type
01605         DocViewMsg* pDocViewMsg = (DocViewMsg*) Message;
01606 
01607         switch (pDocViewMsg->State)
01608         {
01609             // respond to messages that arrive just before and just after the view has changed.
01610             case DocViewMsg::SELABOUTTOCHANGE:
01611             case DocViewMsg::SELCHANGED:
01612             {
01613                 // rub blobs off old view or draw them in on the new one
01614                 if (DocView::GetSelected()!=NULL)
01615                 {
01616                     // go find the selection
01617                     SelRange* Selected = GetApplication()->FindSelection();
01618                     
01619                     // Have to be sure that the selection is correct for the view
01620                     Selected->Update();
01621                     Node* pNode = Selected->FindFirst();
01622             
01623                     // If there is something selected
01624                     if (pNode!=NULL)
01625                     {
01626                         // Find its spread
01627                         Spread* pSpread = pNode->FindParentSpread();
01628                         if (pSpread!=NULL)
01629                         {
01630                             // and render the blobs
01631                             Render(NULL, pSpread);
01632                         }
01633                     }
01634                 }
01635                 break;
01636             }
01637 
01638 
01639             default:
01640                 break;
01641         }
01642     }
01643 
01644     return OK; 
01645 }      

BOOL BlobManager::NeedToRenderNodeBlobs DocRect Rect,
Spread pSpread,
NodeRenderable pNode
[protected]
 

Check to make sure we need to render some blobs.

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

Definition at line 1812 of file blobs.cpp.

01813 {
01814     RenderRegionList* pRegionList = GetApplication()->GetRegionList();
01815     if (pRegionList->IsEmpty())
01816         return TRUE;
01817 
01818     if (Rect != NULL || pNode->IsBounded())
01819     {
01820         // If the Blob we are about to render, is completely contained
01821         // within a pending Render Region, then we don't need to
01822         // render anything
01823 
01824         // Find out the blob rect of this node, if we can
01825         DocRect NodeRect = DocRect(0,0,0,0);
01826         
01827         if (pNode->IsBounded())
01828         {
01829             // Use the node's blob bounds
01830             NodeRect = ((NodeRenderableBounded*)pNode)->GetBlobBoundingRect();
01831         }
01832 
01833         // If a clip rect was given, and it doesn't completely contain the node rect,
01834         // then we'll have to use that
01835         if (Rect && !Rect->ContainsRect(NodeRect))
01836             NodeRect = *Rect;
01837 
01838         if (!NodeRect.IsEmpty())
01839         {
01840             // So lets check the pending regions
01841             RenderRegion* pRegion = (RenderRegion*)pRegionList->GetHead();  
01842 
01843             while (pRegion)
01844             {
01845                 // Check the RenderRegion is for the same spread.
01846                 if (pRegion->GetRenderSpread() == pSpread &&
01847                     pRegion->GetRenderView()==DocView::GetSelected() &&
01848                     (pRegion->IsInkRenderStarted || pRegion->NeedsOSPaper))
01849                 {
01850                     // Get the 'clip' rect of this Render Region.
01851                     DocRect ClipRect = pRegion->GetRegionRect();
01852 
01853                     // If any of the RenderRegions completely contain the rect
01854                     // then there is no point in rendering anything
01855 
01856                     if (ClipRect.ContainsRect(NodeRect))
01857                         return FALSE;       // We don't need to render this node's blobs
01858                 }
01859 
01860                 // Get the Next render region
01861                 pRegion = (RenderRegion*)pRegionList->GetNext(pRegion);
01862             }
01863         }
01864     }
01865     return TRUE;
01866 }

BOOL BlobManager::NeedToRenderSelectionBlobs DocRect Rect  )  [protected]
 

Check to make sure we need to render some blobs.

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

Definition at line 1750 of file blobs.cpp.

01751 {
01752     RenderRegionList* pRegionList = GetApplication()->GetRegionList();
01753     if (pRegionList->IsEmpty())
01754         return TRUE;
01755 
01756     // Find the first selected object in the tree;
01757     SelRange* Selected = GetApplication()->FindSelection();
01758 
01759     if (Selected->Count() == 0)
01760         return FALSE;       // Nothing to render
01761 
01762     Node* pNode = Selected->FindFirst();
01763     Spread* pSpread = pNode->FindParentSpread();
01764 
01765     // Find out the blob rect of the selection
01766     DocRect SelRect = Selected->GetBlobBoundingRect();
01767     
01768     // If a clip rect was given, and it doesn't completely contain the sel bounds,
01769     // then we'll have to use that
01770     if (Rect && !Rect->ContainsRect(SelRect))
01771         SelRect = *Rect;
01772 
01773     if (!SelRect.IsEmpty())
01774     {
01775         // So lets check the pending regions
01776         RenderRegion* pRegion = (RenderRegion*)pRegionList->GetHead();  
01777 
01778         while (pRegion)
01779         {
01780             // Check the RenderRegion is for the same spread.
01781             if (pRegion->GetRenderSpread() == pSpread &&
01782                 pRegion->GetRenderView()==DocView::GetSelected() &&
01783                 (pRegion->IsInkRenderStarted || pRegion->NeedsOSPaper))
01784             {
01785                 // Get the 'clip' rect of this Render Region.
01786                 DocRect ClipRect = pRegion->GetRegionRect();
01787 
01788                 // If any of the RenderRegions completely contain the rect
01789                 // then there is no point in rendering anything
01790 
01791                 if (ClipRect.ContainsRect(SelRect))
01792                     return FALSE;       // We don't need to render any blobs
01793             }
01794 
01795             // Get the Next render region
01796             pRegion = (RenderRegion*)pRegionList->GetNext(pRegion);
01797         }
01798     } 
01799     return TRUE;
01800 }

void BlobManager::RemoveInterest BlobStyle  Blobs  ) 
 

If the blobs specified are already displayed, then they are rendered onto the screen to get rid of them (EORing!). The Flags that the blob manager maintains about which blobs are on screen and which are not are also updated.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/6/94
Parameters:
Blobs - The blobs that you which to remove from the ones currently displayed [INPUTS]
See also:
BlobManager::AddInterest; BlobStyle

Definition at line 454 of file blobs.cpp.

00455 {
00456     RemovingBlobs = TRUE;
00457 
00458     // First we have to work out which bits of the we have to add.
00459     // Do we need Object blobs to be rendered
00460     BOOL DrawObject = FALSE;
00461     if (IsObjectBlob && Blobs.Object)
00462     {
00463         DrawObject = TRUE;
00464         IsObjectBlob = FALSE;
00465     }
00466 
00467     // Do we need Artistic blobs to be rendered
00468     BOOL DrawArtistic = FALSE;
00469     if (IsArtisticBlob && Blobs.Artistic)
00470     {
00471         DrawArtistic = TRUE;
00472         IsArtisticBlob = FALSE;
00473     }
00474 
00475     // Do we need Fill blobs to be rendered
00476     BOOL DrawFill = FALSE;
00477     if (IsFillBlob && Blobs.Fill)
00478     {
00479         DrawFill = TRUE;
00480         IsFillBlob = FALSE;
00481     }
00482 
00483     // Do we need Fill blobs to be rendered
00484     BOOL DrawEffect = FALSE;
00485     if (IsEffectBlob && Blobs.Effect)
00486     {
00487         DrawEffect = TRUE;
00488         IsEffectBlob = FALSE;
00489     }
00490 
00491     // Do we need Tiny blobs to be rendered
00492     BOOL DrawTiny = FALSE;
00493     if (IsTinyBlob && Blobs.Tiny)
00494     {
00495         DrawTiny = TRUE;
00496         IsTinyBlob = FALSE;
00497     }
00498 
00499     // Do we need Pen blobs to be rendered
00500     BOOL DrawPen = FALSE;
00501     if (IsPenBlob && Blobs.Pen)
00502     {
00503         DrawPen = TRUE;
00504         IsPenBlob = FALSE;
00505     }
00506 
00507     // Do we need ToolObject blobs to be rendered
00508     BOOL DrawToolObject = FALSE;
00509     if (IsToolObjectBlob && Blobs.ToolObject)
00510     {
00511         DrawToolObject = TRUE;
00512         IsToolObjectBlob = FALSE;
00513     }
00514 
00515     if (!NeedToRenderSelectionBlobs(NULL))
00516         return;
00517 
00518     // EOR on in all the render regions that are still rendering,
00519     // so that the Blob rendering when the region is finished, 
00520     // will take them off
00521     RenderRegionList* pRegionList = GetApplication()->GetRegionList();
00522 
00523     if (!pRegionList->IsEmpty())
00524     {
00525         // Find out which spread the selection is on
00526         SelRange* Selected = GetApplication()->FindSelection();
00527         Node* pNode = Selected->FindFirst();
00528 
00529         if (pNode)  // Is there a Selection ?
00530         {
00531             Spread* pSpread = pNode->FindParentSpread();
00532 
00533             RenderRegion* pRegion = (RenderRegion*)pRegionList->GetHead();  
00534 
00535             while (pRegion)
00536             {
00537                 // Check the RenderRegion is for the same spread.
00538                 if (pRegion->GetRenderSpread() == pSpread &&
00539                     pRegion->GetRenderView()==DocView::GetSelected() &&
00540                     (pRegion->IsInkRenderStarted || pRegion->NeedsOSPaper))
00541                 {
00542                     // Render the blobs 'clipped' to this Render Region.
00543                     DocRect ClipRect = pRegion->GetRegionRect();
00544                     RenderSpecificBlobsOnSelection( &ClipRect,
00545                                                     DrawObject, DrawArtistic, DrawFill,
00546                                                     DrawTiny, DrawPen, DrawToolObject, DrawEffect );
00547                 }
00548 
00549                 // Get the Next render region
00550                 pRegion = (RenderRegion*)pRegionList->GetNext(pRegion);
00551             }
00552         }
00553     }
00554 
00555     RenderSpecificBlobsOnSelection( NULL, DrawObject, DrawArtistic, 
00556                                     DrawFill, DrawTiny, DrawPen, DrawToolObject, DrawEffect);
00557 }

void BlobManager::Render DocRect Rect,
Spread pSpread
 

This function will render all the blobs that are currently being displayed for the given clipping rectangle.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/6/94

Definition at line 834 of file blobs.cpp.

00835 {
00836     // If we are not drawing blobs today, then return straight away
00837     if (!DrawBlobsAtAll)
00838         return;
00839 
00840     // Now render the sections that need to be rendered to get the corrent blobs on screen
00841     RenderRegion* pRegion = DocView::RenderOnTop(Rect, pSpread, ClippedEOR);
00842     while (pRegion)
00843     {
00844         // Find out the clipping rect of this region
00845         DocRect TestRect = pRegion->GetClipRect();
00846 
00847         // Find the first selected object in the tree;
00848         SelRange* Selected = GetApplication()->FindSelection();
00849 
00850         // Karim 29/06/2000
00851         //  PromoteToParent should never be set TRUE on the selection range, outside
00852         //  of code in which its modifications are required.
00853         //  I have included a TRACE statement here, as a 'quiet' note to programmers,
00854         //  should this occur.
00855         RangeControl rc = Selected->GetRangeControlFlags();
00856         if (rc.PromoteToParent)
00857         {
00858             TRACE( _T("BlobManager::Render; PromoteToParent is TRUE! Read inline comment for details.\n"));
00859             rc.PromoteToParent = FALSE;
00860             Selected->Range::SetRangeControl(rc);
00861         }
00862 
00863         Node* pNode = Selected->FindFirst();
00864         while(pNode)
00865         {
00866             // Render only the required blobs
00867             if (pNode->IsBounded())
00868             {
00869                 // This node is bounded, so see if we really need to render it
00870                 if (TestRect.IsIntersectedWith(((NodeRenderableBounded*)pNode)->GetBlobBoundingRect()))
00871                     RenderRequiredBlobs((NodeRenderable*)pNode, pRegion);
00872             }
00873             else
00874             {
00875                 // Always render it if it is not bounded (probably an Attribute)
00876                 RenderRequiredBlobs((NodeRenderable*)pNode, pRegion);
00877             }
00878 
00879             // Find the next selected node to render
00880             pNode = Selected->FindNext(pNode);
00881         }
00882 
00883         // Go find the next region
00884         pRegion = DocView::GetNextOnTop(Rect);
00885     }
00886 
00887     // Bodge to stop fill meshes EOR each other out.
00888     AttrFillGeometry::LastRenderedMesh = NULL;
00889 }

void BlobManager::RenderMyBlobs DocRect Rect,
Spread pSpread,
NodeRenderable pNode
 

Renders the blobs for the given node. Only the required blobs are rendered and since the blobs are EOR rendered, this function can be used to put the blobs onto the screen or take them off the screen.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
17/6/94
Parameters:
pNode - The node to render the blobs of [INPUTS]

Definition at line 1056 of file blobs.cpp.

01057 {
01058     // If we are not drawing blobs today, then return straight away
01059     if (!DrawBlobsAtAll)
01060         return;
01061 
01062     // Now render the sections that need to be rendered to get the corrent blobs on screen
01063     RenderRegion* pRegion = DocView::RenderOnTop(Rect, pSpread, ClippedEOR);
01064     while (pRegion)
01065     {
01066         // Find out the clipping rect of this region
01067         DocRect TestRect = pRegion->GetClipRect();
01068 
01069         // Render only the blobs that need to be drawn
01070         if (pNode->IsBounded())
01071         {
01072             // This node is bounded, so see if we really need to render it
01073             if (TestRect.IsIntersectedWith(((NodeRenderableBounded*)pNode)->GetBlobBoundingRect()))
01074                 RenderRequiredBlobs(pNode, pRegion);
01075         }
01076         else
01077         {
01078             // Always render it if it is not bounded (probably an Attribute)
01079             RenderRequiredBlobs(pNode, pRegion);
01080         }
01081 
01082         // Go find the next region
01083         pRegion = DocView::GetNextOnTop(Rect);
01084     }
01085 }

void BlobManager::RenderMyBlobsOff DocRect Rect,
Spread pSpread,
NodeRenderable pNode
 

This function will render off all the blobs that are currently being displayed for the given clipping rectangle.

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

Definition at line 1169 of file blobs.cpp.

01170 {
01171     RemovingBlobs = TRUE;
01172 
01173     // If we are not drawing blobs today, then return straight away
01174     if (!DrawBlobsAtAll)
01175         return;
01176 
01177     // Are we in the middle of a Background redraw ?
01178     RenderRegionList* pRegionList = GetApplication()->GetRegionList();
01179     if (pRegionList->IsEmpty())
01180     {
01181         // Nope, so do stuff as normal
01182 
01183         // Draw the blobs off
01184         RenderMyBlobs(Rect, pSpread, pNode);
01185         return;
01186     }
01187 
01188     // We must be background rendering ...
01189 
01190     // So lets try a bit of an optimisation
01191     if (!NeedToRenderNodeBlobs(Rect, pSpread, pNode))
01192         return;
01193 
01194     // Oh well, lets render some blobs then
01195 
01196     // EOR on in all the render regions that are still rendering,
01197     // so that the Blob rendering when the region is finished, 
01198     // will take them off
01199     RenderRegion* pRegion = (RenderRegion*)pRegionList->GetHead();  
01200 
01201     while (pRegion)
01202     {
01203         // Check the RenderRegion is for the same spread.
01204         if (pRegion->GetRenderSpread() == pSpread &&
01205             pRegion->GetRenderView()==DocView::GetSelected() &&
01206             (pRegion->IsInkRenderStarted || pRegion->NeedsOSPaper))
01207         {
01208             // Render the blobs 'clipped' to this Render Region.
01209             DocRect ClipRect = pRegion->GetRegionRect();
01210             RenderMyBlobs(&ClipRect, pSpread, pNode);
01211         }
01212 
01213         // Get the Next render region
01214         pRegion = (RenderRegion*)pRegionList->GetNext(pRegion);
01215     }
01216 
01217     // Stop fill meshes EORing each other out.
01218     FillGeometryAttribute* pLastMesh = AttrFillGeometry::LastRenderedMesh;
01219     AttrFillGeometry::LastRenderedMesh = NULL;
01220 
01221     // Draw the blobs off
01222     RenderMyBlobs(Rect, pSpread, pNode);
01223 
01224     // Stop fill meshes EORing each other out.
01225     AttrFillGeometry::LastRenderedMesh = pLastMesh;
01226 }

void BlobManager::RenderMyBlobsOn DocRect Rect,
Spread pSpread,
NodeRenderable pNode
 

This function will render on all the blobs that are currently being displayed for the given clipping rectangle.

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

Definition at line 1098 of file blobs.cpp.

01099 {
01100     RemovingBlobs = FALSE;
01101 
01102     // If we are not drawing blobs today, then return straight away
01103     if (!DrawBlobsAtAll)
01104         return;
01105 
01106     // Are we in the middle of a Background redraw ?
01107     RenderRegionList* pRegionList = GetApplication()->GetRegionList();
01108     if (pRegionList->IsEmpty())
01109     {
01110         // Nope, so do stuff as normal
01111 
01112         // Draw the blobs on
01113         RenderMyBlobs(Rect, pSpread, pNode);
01114         return;
01115     }
01116 
01117     // We must be background rendering ...
01118 
01119     // So lets try a bit of an optimisation
01120     if (!NeedToRenderNodeBlobs(Rect, pSpread, pNode))
01121         return;
01122 
01123     // Oh well, lets render some blobs then
01124     
01125     // Draw the blobs on
01126     RenderMyBlobs(Rect, pSpread, pNode);
01127 
01128     // Stop fill meshes EORing each other out.
01129     FillGeometryAttribute* pLastMesh = AttrFillGeometry::LastRenderedMesh;
01130     AttrFillGeometry::LastRenderedMesh = NULL;
01131     
01132     // Now EOR off in all the render regions that are still rendering,
01133     // so that the Blob rendering when the region is finished, 
01134     // will put them on
01135 
01136     RenderRegion* pRegion = (RenderRegion*)pRegionList->GetHead();  
01137 
01138     while (pRegion)
01139     {
01140         // Check the RenderRegion is for the same spread.
01141         if (pRegion->GetRenderSpread() == pSpread &&
01142             pRegion->GetRenderView()==DocView::GetSelected() &&
01143             (pRegion->IsInkRenderStarted || pRegion->NeedsOSPaper))
01144         {
01145             // Render the blobs 'clipped' to this Render Region.
01146             DocRect ClipRect = pRegion->GetRegionRect();
01147             RenderMyBlobs(&ClipRect, pSpread, pNode);
01148         }
01149 
01150         // Get the Next render region
01151         pRegion = (RenderRegion*)pRegionList->GetNext(pRegion);
01152     }
01153 
01154     // Stop fill meshes EORing each other out.
01155     AttrFillGeometry::LastRenderedMesh = pLastMesh;
01156 }

void BlobManager::RenderObjectBlobs DocRect Rect,
Spread pSpread,
NodeRenderable pNode