SpreadRedraws Class Reference

Encapsulates a set of regions on a spread, which must be accumulated in order for them to be redrawn at some point, possibly all in one go. This class chooses the most efficient invalidation method, according to the number and nature of regions added. More...

Inheritance diagram for SpreadRedraws:

ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

 SpreadRedraws (Spread *)
 Construct a spread redraw regions object for a given spread. The invalid region is initially NULL.
SpreadGetSpread ()
void AddInvalidRegion (DocRect, Node *pInvalidNode)
 Add another invalid region to the collection of regions for a spread.
void FlushRedraw (DocView *)
 Force the specified DocView to immediately update all the regions encapsulated by this object.
void ClearBackmostChangedNode (Node *pNode)
 Add another invalid region to the collection of regions for a spread.

Private Member Functions

 CC_DECLARE_MEMDUMP (SpreadRedraws)

Private Attributes

SpreadpInvalidSpread
UINT32 RectCount
BOOL TooManyRegions
DocRect InvalidRegions [(20)]
Nodem_pBackmostChangedNode

Detailed Description

Encapsulates a set of regions on a spread, which must be accumulated in order for them to be redrawn at some point, possibly all in one go. This class chooses the most efficient invalidation method, according to the number and nature of regions added.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
22/12/94
See also:
PendingRedraws

Definition at line 198 of file docview.cpp.


Constructor & Destructor Documentation

SpreadRedraws::SpreadRedraws Spread pSpread  ) 
 

Construct a spread redraw regions object for a given spread. The invalid region is initially NULL.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
22/12/94
Parameters:
pSpread - the spread on which invalid regions will occur. [INPUTS]
See also:
SpreadRedraws; PendingRedraws

Definition at line 427 of file docview.cpp.

00428 {
00429     pInvalidSpread = pSpread;
00430     RectCount = 0;
00431     TooManyRegions = FALSE;
00432     m_pBackmostChangedNode = NULL;
00433 }


Member Function Documentation

void SpreadRedraws::AddInvalidRegion DocRect  Rect,
Node pInvalidNode
 

Add another invalid region to the collection of regions for a spread.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
22/12/94
Parameters:
Rect - the region to add (in document co-ordinates) [INPUTS]
See also:
SpreadRedraws; PendingRedraws

Definition at line 447 of file docview.cpp.

00448 {
00449     if (pInvalidNode!=NULL)
00450         if (m_pBackmostChangedNode==NULL || pInvalidNode->IsUnder(m_pBackmostChangedNode)) m_pBackmostChangedNode = pInvalidNode;
00451 
00452     if (TooManyRegions)
00453     {
00454         // We have exceeded the maximum number of inidividual regions, so we just
00455         // union them all together.
00456         InvalidRegions[0] = InvalidRegions[0].Union(Rect);
00457     }
00458     else
00459     {
00460         // Have we just exceeded the maximum number of regions?
00461         if (RectCount == MAX_REDRAW_REGIONS)
00462         {
00463             // Yes - gather all the existing regions together into one.
00464             for (INT32 i = 1; i < MAX_REDRAW_REGIONS; i++)
00465             {
00466                 InvalidRegions[0] = InvalidRegions[0].Union(InvalidRegions[i]);
00467             }
00468 
00469             // Now merge the new region in
00470             InvalidRegions[0] = InvalidRegions[0].Union(Rect);
00471 
00472             // Indicate that we have too many regions
00473             RectCount = 1;
00474             TooManyRegions = TRUE;
00475         }
00476         else
00477         {
00478             // Otherwise, just add region to the array
00479             InvalidRegions[RectCount] = Rect;
00480             RectCount++;
00481         }
00482     }
00483 }

SpreadRedraws::CC_DECLARE_MEMDUMP SpreadRedraws   )  [private]
 

void SpreadRedraws::ClearBackmostChangedNode Node pNode  ) 
 

Add another invalid region to the collection of regions for a spread.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
22/12/94
Parameters:
Rect - the region to add (in document co-ordinates) [INPUTS]
See also:
SpreadRedraws; PendingRedraws

Definition at line 497 of file docview.cpp.

00498 {
00499     if (pNode && (m_pBackmostChangedNode==pNode || pNode->IsNodeInSubtree(m_pBackmostChangedNode)))
00500         m_pBackmostChangedNode = pNode->FindParentSpread();
00501 }

void SpreadRedraws::FlushRedraw DocView pDocView  ) 
 

Force the specified DocView to immediately update all the regions encapsulated by this object.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
22/12/94
Parameters:
pDocView - the DocView to invalidate [INPUTS]
See also:
SpreadRedraws; PendingRedraws

Definition at line 516 of file docview.cpp.

00517 {
00518     // Cause an immediate update of the DocView
00519     for (UINT32 i = 0; i < RectCount; i++)
00520     {
00521         // For the moment, assume that pending redraws must have been due to editing...
00522         pDocView->ForceRedraw(pInvalidSpread, InvalidRegions[i], FALSE, m_pBackmostChangedNode);
00523     }
00524 }

Spread* SpreadRedraws::GetSpread  )  [inline]
 

Definition at line 205 of file docview.cpp.

00205 { return pInvalidSpread; }


Member Data Documentation

DocRect SpreadRedraws::InvalidRegions[(20)] [private]
 

Definition at line 214 of file docview.cpp.

Node* SpreadRedraws::m_pBackmostChangedNode [private]
 

Definition at line 215 of file docview.cpp.

Spread* SpreadRedraws::pInvalidSpread [private]
 

Definition at line 211 of file docview.cpp.

UINT32 SpreadRedraws::RectCount [private]
 

Definition at line 212 of file docview.cpp.

BOOL SpreadRedraws::TooManyRegions [private]
 

Definition at line 213 of file docview.cpp.


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