SafeRenderPointer Class Reference

A object to handle the current 'safe' rendering pointer within the document. This is used for 'Progressive Rendering' (see kernel.h/cpp), during the loading of a document. More...

#include <document.h>

Inheritance diagram for SafeRenderPointer:

CCObject SimpleCCObject List of all members.

Public Member Functions

 SafeRenderPointer ()
 Constructs a SafeRenderPointer object.
 ~SafeRenderPointer ()
 Destroys a SafeRenderPointer object.
void SetPointerValid ()
 Sets the pointer as being valid.
void SetPointerInValid ()
 Sets the pointer as being invalid.
BOOL IsPointerValid ()
 Returns whether or not the pointer is valid.
BOOL UpdateLastSafeNode (Node *pNewNode)
 Updates the last safe node that can be rendered.
NodeGetLastSafeNode ()
 Returns a pointer to the last safe node that can be rendered.

Protected Attributes

NodepLastSafeNodeToRender
BOOL m_bPointerValid

Detailed Description

A object to handle the current 'safe' rendering pointer within the document. This is used for 'Progressive Rendering' (see kernel.h/cpp), during the loading of a document.

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

Definition at line 185 of file document.h.


Constructor & Destructor Documentation

SafeRenderPointer::SafeRenderPointer  ) 
 

Constructs a SafeRenderPointer object.

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

Definition at line 6145 of file document.cpp.

06146 {
06147     m_bPointerValid = TRUE;
06148     pLastSafeNodeToRender = NULL;
06149 }

SafeRenderPointer::~SafeRenderPointer  ) 
 

Destroys a SafeRenderPointer object.

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

Definition at line 6161 of file document.cpp.

06162 {
06163     // Empty.
06164 }


Member Function Documentation

Node * SafeRenderPointer::GetLastSafeNode  ) 
 

Returns a pointer to the last safe node that can be rendered.

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

Definition at line 6234 of file document.cpp.

06235 {
06236     if (!m_bPointerValid)
06237         return NULL;
06238 
06239     Node* pSafeNode = NULL;
06240 
06241     // Make sure this pointer cannot be updated by another thread while we read it
06242 //  CCamApp::EnterSafeRenderCriticalSection();
06243 
06244     pSafeNode = pLastSafeNodeToRender;
06245 //  TRACEUSER( "Will", _T("Thread %d is reading safe node as %x\n"), GetCurrentThreadId(), pSafeNode);
06246 
06247     // Ok, it's safe for other threads to update it now
06248 //  CCamApp::ExitSafeRenderCriticalSection();
06249 
06250     return pSafeNode;
06251 }

BOOL SafeRenderPointer::IsPointerValid  ) 
 

Returns whether or not the pointer is valid.

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

Definition at line 6295 of file document.cpp.

06296 {
06297     return m_bPointerValid;
06298 }

void SafeRenderPointer::SetPointerInValid  ) 
 

Sets the pointer as being invalid.

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

Definition at line 6279 of file document.cpp.

06280 {
06281 //  TRACEUSER( "Will", _T("Thread %d is setting safe node ptr as INVALID\n"), GetCurrentThreadId());
06282     m_bPointerValid = FALSE;
06283 }

void SafeRenderPointer::SetPointerValid  ) 
 

Sets the pointer as being valid.

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

Definition at line 6263 of file document.cpp.

06264 {
06265 //  TRACEUSER( "Will", _T("Thread %d is setting safe node ptr as VALID\n"), GetCurrentThreadId());
06266     m_bPointerValid = TRUE;
06267 }

BOOL SafeRenderPointer::UpdateLastSafeNode Node pNewNode  ) 
 

Updates the last safe node that can be rendered.

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

Definition at line 6176 of file document.cpp.

06177 {
06178     ERROR2IF(!m_bPointerValid, FALSE, "Trying to set safe pointer when it's invalid.");
06179 
06180 #ifdef RALPH
06181 
06182     if ((!pLastSafeNodeToRender) && pNewNode)
06183     {
06184         NodeDocument* pNodeDoc = (NodeDocument*) pNewNode->FindParent(CC_RUNTIME_CLASS(NodeDocument)); 
06185         ASSERT (pNodeDoc); 
06186         if (pNodeDoc)
06187         {
06188             Document* TheDoc = (Document*)pNodeDoc->GetParentDoc();
06189             ASSERT(TheDoc); 
06190             if (TheDoc)
06191             {
06192                 RalphDocument* pRalphDoc = TheDoc->GetRalphDoc(); 
06193                 if (pRalphDoc)
06194                 {
06195                     RalphView * pRalphView = pRalphDoc->GetRalphView();
06196                     if(pRalphView)
06197                     {
06198                     /*  OpZoomDescriptor::FakeZoomToRect(&(pRalphDoc->GetViewportRect()));
06199                         pRalphView->SetSafeToDraw(TRUE);
06200                     */
06201                         //Beep(1500,15);
06202 
06203                         SendMessage(pRalphView->GetSafeHwnd(),WM_ZOOMTORECT,NULL,(INT32)(pRalphDoc->GetViewportRect()));
06204                     }
06205                 }
06206             }
06207         }
06208     }
06209 
06210 #endif
06211 
06212     // Make sure this pointer cannot be accessed by other threads
06213     // while we update it
06214 //  CCamApp::EnterSafeRenderCriticalSection();
06215     
06216 //  TRACEUSER( "Will", _T("Thread %d is setting safe node to %x\n"), GetCurrentThreadId(), pNewNode);
06217     pLastSafeNodeToRender = pNewNode;
06218 
06219     // Ok, it's safe for other threads to access us now
06220 //  CCamApp::ExitSafeRenderCriticalSection();
06221     return TRUE;
06222 }


Member Data Documentation

BOOL SafeRenderPointer::m_bPointerValid [protected]
 

Definition at line 204 of file document.h.

Node* SafeRenderPointer::pLastSafeNodeToRender [protected]
 

Definition at line 203 of file document.h.


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