#include <exprview.h>
Inheritance diagram for ExpressView:
Public Member Functions | |
ExpressView (Document *) | |
First stage of two part constructor. | |
BOOL | Init () |
Second stage of two part constructor. | |
virtual | ~ExpressView () |
Destroys a printing view - this is because it has finished printing or something went wrong during printing. | |
virtual BOOL | ViewStateChanged () |
Inform the ExpressView that its OIL view object has changed the shared ViewState structure. | |
virtual void | SetViewPixelSize () |
Sets up the normal and scaled pixel sizes according to this view. | |
virtual void | ContinueRenderView (RenderRegion *, Spread *, BOOL=TRUE, BOOL=TRUE, BOOL bForceImmediate=FALSE) |
Used by RenderRegion::DefaultRender() to carry on rendering a view. In this case (i.e. printing) it only gets called once, as it calls RenderView which prints the view in one go, i.e. we don't do background rendering. | |
virtual CDC * | GetRenderDC () |
Access function for the device context of this ExpressView passed in via OnDraw(). | |
virtual BOOL | GetForeBackMode () |
To find out if background rendering is on. | |
virtual void | SetForeBackMode (BOOL) |
Set the background render flag for this view. Notes: Should never be asked to render in background. | |
BOOL | DoRender (CDC *pDC, DocRect drClip, const DocRect &BitmapSize, BPP Bpp) |
Renders immediately this ExpressView's bitmap. | |
OILBitmap * | GetBitmap () const |
Having called DoRender() to render the document into a bitmap of the given specification, we can get a pointer to it here. | |
virtual DocRect | GetDocViewRect (Spread *) |
To find the rectangle describing the viewport onto the document. | |
virtual void | SetExtent (DocCoord, DocCoord) |
Informs the ExpressView that the extent of the document has changed in some way and that the view must be altered to take this into account (namely the scrollbars). | |
virtual WorkRect | GetViewRect () |
To find the rectangle describing the viewport onto the document. | |
Protected Member Functions | |
virtual Matrix | ConstructRenderingMatrix (Spread *pSpread) |
From the given spread, construct a matrix that will convert spread coordinates to OS coordinates. | |
virtual void | MakeNewRenderRegion (Spread *, DocRect, CDC *, RenderType, BOOL PaintPaper=FALSE, Node *pInvalidNode=NULL) |
Renders the document to the printer. This function will build all the render regions needed to do a print. | |
Protected Attributes | |
FIXED16 | m_XScale |
FIXED16 | m_YScale |
Matrix | m_ScaleMatrix |
GRenderBitmap * | m_pBitmapRegion |
CDC * | m_pCDC |
BPP | m_Bpp |
OILBitmap * | m_pBitmap |
Definition at line 123 of file exprview.h.
|
First stage of two part constructor.
Definition at line 143 of file exprview.cpp. 00144 { 00145 // Set up document; no CamView yet. 00146 pDoc = pOwnerDoc; 00147 pViewWindow = NULL; 00148 00149 m_pBitmapRegion = NULL; 00150 m_pCDC = NULL; 00151 m_pBitmap = NULL; 00152 m_Bpp = 8; 00153 00154 m_XScale = 1.0; 00155 m_YScale = 1.0; 00156 }
|
|
Destroys a printing view - this is because it has finished printing or something went wrong during printing.
Definition at line 206 of file exprview.cpp.
|
|
From the given spread, construct a matrix that will convert spread coordinates to OS coordinates.
Reimplemented from View. Definition at line 488 of file exprview.cpp. 00489 { 00490 ERROR2IF(pSpread == NULL, Matrix(), "pSpread == NULL"); 00491 00492 // Get the PIXELISED origin of spread coordinates, in document coords 00493 DocCoord SpreadCoordOrigin = pSpread->GetSpreadCoordOrigin(TRUE, this); 00494 00495 // Convert it into logical Work Coords 00496 // NOTE: We convert this via the spread, because the Spread Coord Origin can now 00497 // lie *outside* the current chapter/spread pasteboard bounds, and so the version 00498 // of this call that takes a document pointer can't find the enclosing chapter! 00499 // Of course, we know the enclosing chapter, because this point is in a known spread! 00500 WorkCoord WorkCoordOffset = SpreadCoordOrigin.ToWork(pSpread, this); 00501 00502 // Offset it by the window scroll position 00503 WorkCoordOffset.x -= pVState->GetScrollPos().x; 00504 WorkCoordOffset.y -= pVState->GetScrollPos().y; 00505 00506 // Construct the transformation matrix for the spread. 00507 Matrix RenderMatrix; 00508 00509 // We can chop the 64bit values down to 32bit now, as we have them in the correct range 00510 Matrix TranslateToOrigin( (INT32)WorkCoordOffset.x, (INT32)WorkCoordOffset.y); 00511 00512 Matrix ScaleMat(Scale, Scale); 00513 00514 // The following matrix compositions MUST be performed in this order. 00515 // If you are tempted to optimise this code MAKE SURE THAT THEY ARE STILL 00516 // IN THIS ORDER WHEN YOU'VE FINISHED! 00517 00518 // Apply scale factors to convert from millipoint distances to pixel distances... 00519 RenderMatrix *= ScaleMat; 00520 00521 // And to the bitmap size 00522 RenderMatrix *= m_ScaleMatrix; 00523 00524 // Apply scroll-offset translation to move origin to viewing position... 00525 RenderMatrix *= TranslateToOrigin; 00526 00527 return RenderMatrix; 00528 }
|
|
Used by RenderRegion::DefaultRender() to carry on rendering a view. In this case (i.e. printing) it only gets called once, as it calls RenderView which prints the view in one go, i.e. we don't do background rendering.
Implements View. Definition at line 256 of file exprview.cpp. 00259 { 00260 // Render the document in one operation. 00261 Matrix mxRndr = ConstructRenderingMatrix(pSpread); 00262 00263 // Scroll offsets etc may have changed, so transfer matrix. 00264 pRRegion->SetMatrix(mxRndr); 00265 00266 #ifdef RALPH 00267 // Wait until it's safe to enter 00268 CCamApp::EnterGDrawCriticalSection(); 00269 #endif 00270 00271 // Tell the RenderRegion that I am going to start rendering. 00272 if (!pRRegion->StartRender()) 00273 { 00274 TRACEALL( _T("StartRender failed in RenderView\n")); 00275 // will be deleted quickly 00276 } 00277 else 00278 { 00279 // Never render the paper but do all the ink (non-paper) parts of the document. 00280 pRRegion->RenderTree(pSpread, FALSE); 00281 00282 // Reset state to new posn in tree. 00283 pRRegion->StopRender(); 00284 00285 } 00286 // Our render regions are always Bitmap ones 00287 // Assume there's only one 00288 GRenderBitmap* pGRBRegion = (GRenderBitmap*)pRRegion; 00289 ERROR3IF(!pGRBRegion->IS_KIND_OF(GRenderBitmap), "pGRBRegion isn't kinda GRenderBitmap"); 00290 m_pBitmap = pGRBRegion->ExtractBitmapCopy(); 00291 00292 #ifdef RALPH 00293 // Let another process have a go 00294 CCamApp::ExitGDrawCriticalSection(); 00295 #endif 00296 00297 00298 if (fDeleteRegionAfter) 00299 { 00300 delete pRRegion; 00301 } 00302 }
|
|
Renders immediately this ExpressView's bitmap.
Definition at line 602 of file exprview.cpp. 00604 { 00605 ERROR2IF(pDC == NULL, FALSE, "pDC == NULL"); 00606 00607 TRACEUSER( "Colin", _T("dpi %d drClip %ld,%ld\tBitmapSize %ld,%ld BPP %d Quality %d\n"), 00608 pDC->GetDeviceCaps(LOGPIXELSX), 00609 drClip.hix, drClip.hiy, 00610 BitmapSize.hix, BitmapSize.hiy, 00611 Bpp, 00612 RenderQuality.GetQuality()); 00613 // Remember the current view so we can give it back after rendering 00614 View* pCurrentView = GetCurrent(); 00615 00616 m_pCDC = pDC; 00617 m_Bpp = Bpp; 00618 00619 // Convert clip rect to OIL coords 00620 PORTNOTE("spread", "Multi-spread warning!") 00621 Spread* pSpread = pDoc->FindFirstSpread(); 00622 ERROR2IF(!pSpread, FALSE, "pSpread NULL"); 00623 00624 pSpread->DocCoordToSpreadCoord(&drClip); 00625 OilRect orClip = drClip.ToOil(pSpread, this); 00626 00627 // Scale to the bitmap size 00628 m_ScaleMatrix = Matrix(drClip, BitmapSize); 00629 00630 // Construct the invalid render regions 00631 OnDraw(pDC, orClip); 00632 00633 BOOL bSuccessful = FALSE; 00634 // And render them into the given DC 00635 if (m_pBitmapRegion != NULL) 00636 { 00637 #ifndef RALPH 00638 // Start the rendering indicator going. 00639 if (GetApplication()->GetpStatusLine()) 00640 GetApplication()->GetpStatusLine()->SetRenderIndicator(Rendering); 00641 #endif 00642 // Render it. 00643 Error::RenderThreadIn(); // Make errors close window 00644 m_pBitmapRegion->DefaultRender(); 00645 Error::RenderThreadOut(); // Normal errors 00646 00647 #ifndef RALPH 00648 // Disable rendering indicator. 00649 if (GetApplication()->GetpStatusLine()) 00650 GetApplication()->GetpStatusLine()->SetRenderIndicator(NotRendering); 00651 #endif 00652 bSuccessful = TRUE; 00653 } 00654 // Restore the view 00655 pCurrentView->SetCurrent(); 00656 return bSuccessful; 00657 }
|
|
Having called DoRender() to render the document into a bitmap of the given specification, we can get a pointer to it here.
Definition at line 671 of file exprview.cpp. 00672 { 00673 return m_pBitmap; 00674 }
|
|
To find the rectangle describing the viewport onto the document.
Implements View. Definition at line 466 of file exprview.cpp.
|
|
To find out if background rendering is on.
Implements View. Definition at line 389 of file exprview.cpp. 00390 { 00391 // ExpressViews don't background render yet. 00392 return FALSE; 00393 }
|
|
Access function for the device context of this ExpressView passed in via OnDraw().
Implements View. Definition at line 226 of file exprview.cpp. 00227 { 00228 return m_pCDC; 00229 }
|
|
To find the rectangle describing the viewport onto the document.
Implements View. Definition at line 443 of file exprview.cpp.
|
|
Second stage of two part constructor.
Reimplemented from SimpleCCObject. Definition at line 171 of file exprview.cpp. 00172 { 00173 pVState = new ViewState; 00174 if (pVState == NULL) 00175 { 00176 TRACE( _T("Unable to create ViewState\n")); 00177 return FALSE; 00178 } 00179 // Connect this view state to this view 00180 pVState->pView = this; 00181 00182 PORTNOTE("spread", "Multi-spread warning!") 00183 Spread* pSpread = pDoc->FindFirstSpread(); 00184 DocView* pView = pDoc->GetFirstDocView(); 00185 00186 // Get the real bounds, in millipoints, of the document's first spread, converted 00187 // to pixels. 00188 GetScaledPixelSize(&ScaledPixelWidth, &ScaledPixelHeight); 00189 00190 return TRUE; 00191 }
|
|
Renders the document to the printer. This function will build all the render regions needed to do a print.
Definition at line 549 of file exprview.cpp. 00551 { 00552 // Construct the transformation matrix for the spread. 00553 Matrix RenderMatrix = ConstructRenderingMatrix(pSpread); 00554 00555 // Go and create the new render region 00556 m_pBitmapRegion = NULL; 00557 double dpi = pDevContext->GetDeviceCaps(LOGPIXELSX); 00558 // We'll restrict it to 96dpi for now to avoid huge bitmaps 00559 if (dpi > 96.0) 00560 { 00561 TRACE( _T("dpi request for %f\n"), dpi); 00562 dpi = 96.0; 00563 } 00564 00565 m_pBitmapRegion = new GRenderBitmap (ClipRect, RenderMatrix, Scale, m_Bpp, dpi, 00566 FALSE, XARADITHER_ERROR_DIFFUSION, 0, TRUE); 00567 00568 // See if it worked 00569 if (m_pBitmapRegion == NULL) 00570 { 00571 TRACEALL( _T("Not enough memory to create render region\n")); 00572 return; 00573 } 00574 00575 // If the construction was succesful then 00576 // Attach the new RenderRegion to a Window and its DC for rendering... 00577 if (!m_pBitmapRegion->AttachDevice(this, pDevContext, pSpread)) 00578 { 00579 // the AttachDevice failed, so tidy up 00580 delete m_pBitmapRegion; 00581 return; 00582 } 00583 00584 m_pBitmapRegion->SetBackmostChangedNode(pInvalidNode); 00585 }
|
|
Informs the ExpressView that the extent of the document has changed in some way and that the view must be altered to take this into account (namely the scrollbars).
Implements View. Definition at line 411 of file exprview.cpp. 00412 { 00413 // "Pixelise" the extent DocCoords. 00414 // Effectively, this helps ensure that the spread will be aligned to a whole pixel boundary 00415 // and allows both GDraw and GDI to consistently plot the same pixels when rendering 00416 // the same primitive. 00417 lolog.Pixelise(this); 00418 hilog.Pixelise(this); 00419 00420 // Convert the extent given in DocCoord to WorkCoords... 00421 pVState->WorkAreaExtent.lo = lolog.ToWork(pDoc, this); 00422 pVState->WorkAreaExtent.hi = hilog.ToWork(pDoc, this); 00423 }
|
|
Set the background render flag for this view. Notes: Should never be asked to render in background.
Implements View. Definition at line 370 of file exprview.cpp. 00371 { 00372 // Nobody should try to set the printing to be background yet. 00373 ERROR3IF(NewFlag, "Trying to make a ExpressView background render!"); 00374 }
|
|
Sets up the normal and scaled pixel sizes according to this view.
Implements View. Definition at line 349 of file exprview.cpp. 00350 { 00351 // Set the scaled pixel size 00352 ScaledPixelWidth = PixelWidth / m_XScale; 00353 ScaledPixelHeight = PixelHeight / m_YScale; 00354 }
|
|
Inform the ExpressView that its OIL view object has changed the shared ViewState structure.
Implements View. Definition at line 319 of file exprview.cpp. 00320 { 00321 // Sanity checks. 00322 ERROR2IF(this==NULL,FALSE,"DocView member func called on NULL pointer"); 00323 ERROR2IF(pDoc==NULL,FALSE,"ViewStateChanged: There MUST be an owner doc for this view!"); 00324 00325 DocCoord ExtentLo; // coord of bottom-left of logical extent 00326 DocCoord ExtentHi; // coord of top-right of logical extent 00327 00328 // Read DocCoords extent of document & set extent in platform-indy ViewState struct. 00329 pDoc->GetExtents(&ExtentLo, &ExtentHi, &PhysExtent, this); 00330 00331 // Set extent in platform-indy ViewState struct 00332 SetExtent(ExtentLo, ExtentHi); 00333 00334 return TRUE; 00335 }
|
|
Definition at line 166 of file exprview.h. |
|
Definition at line 167 of file exprview.h. |
|
Definition at line 163 of file exprview.h. |
|
Definition at line 165 of file exprview.h. |
|
Definition at line 161 of file exprview.h. |
|
Definition at line 159 of file exprview.h. |
|
Definition at line 160 of file exprview.h. |