#include <view.h>
Public Member Functions | |
ProgressDisplay () | |
Initialise the progress display object. Defaults to no progress display. | |
void | SetUp (RenderRegion *pRender, ScanningRenderRegion *pScanner) |
Sets up the progress display object based on the render regions passed in. | |
BOOL | IncProgress (INT32 NumNodes=1) |
Updates the rendered node count by the number specified. If the progress display needs updating, then it is updated. | |
BOOL | FirstStageDone () |
Should be called when the first stage of 3-pass rendering is complete. | |
BOOL | SecondStageDone () |
Should be called when the second stage of 3-pass rendering is complete. | |
void | AllStagesDone () |
Should be called when the 3-pass rendering has been finished. This causes the progress bar to be de-initialised when exporting Camelot EPS. | |
void | StartBitmapPhase (INT32 NumBands) |
Gets ready to render the banded bitmap phase of the rendering. Works out how much each band should update the progress position by. | |
void | StartBitmapPhaseBand (INT32 TotalNumScanlines) |
Inform the progress display that a band is about to start being rendered, and how many scanlines high it will be. | |
BOOL | BitmapPhaseBandRenderedTo (INT32 ScanlinesRendered) |
Update the progress to reflect how many scanlines have been rendered in this band of the bitmap rendering phase. | |
BOOL | EndBitmapPhaseBand () |
Another band of the bitmap rendering phase has been finished, so update the progress display. | |
void | SetUpOptimal (RenderRegion *pRender, ScanningRenderRegion *pScanner) |
This function sets up the Progress display ready to start rendering the nodes. | |
BOOL | SetNodesRendered (INT32 NumNodes) |
Lets the rendering loop tell the display system when a node has been rendered. It can act on this to update the progress display whenever needed. | |
Protected Attributes | |
BOOL | DoProgressDisplay |
BOOL | IsPrinting |
INT32 | NumNodesRendered |
INT32 | LastProgressUpdate |
INT32 | ProgressInterval |
INT32 | FirstStageCount |
INT32 | SecondStageCount |
INT32 | ThirdStageCount |
INT32 | BandSize |
INT32 | BandHeight |
INT32 | BandOffset |
INT32 | BandIncrement |
INT32 | TotalNodes |
CCPrintInfo * | pPrintInfo |
INT32 | ProgressScaleFactor |
Definition at line 144 of file view.h.
|
Initialise the progress display object. Defaults to no progress display.
Definition at line 1657 of file view.cpp. 01658 { 01659 // WEBSTER-ranbirr-13/11/96 01660 #ifndef WEBSTER 01661 #ifndef STANDALONE 01662 pPrintInfo = CCPrintInfo::GetCurrent(); 01663 #else 01664 pPrintInfo = NULL; 01665 #endif 01666 #endif //webster 01667 DoProgressDisplay = FALSE; 01668 IsPrinting = FALSE; 01669 NumNodesRendered = 0; 01670 LastProgressUpdate = 0; 01671 ProgressInterval = 1; 01672 TotalNodes = 0; 01673 01674 // Currently we use a scale factor of 256 so that we get decent resolution even 01675 // when exporting only a few nodes that have lots of transparency. 01676 // We use 256 (a power of 2) so that muls and divs are fast. 01677 ProgressScaleFactor = 256; 01678 }
|
|
Should be called when the 3-pass rendering has been finished. This causes the progress bar to be de-initialised when exporting Camelot EPS.
Definition at line 1989 of file view.cpp. 01990 { 01991 #ifndef STANDALONE 01992 // If we are exporting EPS, end the progress indicator as we're all done. 01993 if (DoProgressDisplay && !IsPrinting) 01994 EndSlowJob(); 01995 #endif 01996 }
|
|
Update the progress to reflect how many scanlines have been rendered in this band of the bitmap rendering phase.
Definition at line 2060 of file view.cpp. 02061 { 02062 #ifndef STANDALONE 02063 02064 if (!DoProgressDisplay) 02065 // No progress display needed. 02066 return TRUE; 02067 02068 // Work out how far into this band we have got. 02069 BandOffset = ScanlinesRendered * BandIncrement; 02070 if (BandOffset > BandSize) 02071 BandOffset = BandSize; 02072 INT32 ProgressPos = (NumNodesRendered * ProgressScaleFactor) + BandOffset; 02073 02074 // WEBSTER-ranbirr-13/11/96 02075 #ifndef WEBSTER 02076 // Update progress indicators 02077 if (IsPrinting && pPrintInfo != NULL) 02078 { 02079 // Update slider 02080 pPrintInfo->SetSliderSubRangePos(ProgressPos); 02081 02082 // Does user want to suspend printing? 02083 if (pPrintInfo->Abort()) 02084 return FALSE; 02085 } 02086 else 02087 #endif //webster 02088 return ContinueSlowJob(ProgressPos); 02089 02090 #endif 02091 02092 // All ok 02093 return TRUE; 02094 }
|
|
Another band of the bitmap rendering phase has been finished, so update the progress display.
Definition at line 2110 of file view.cpp. 02111 { 02112 #ifndef STANDALONE 02113 02114 if (!DoProgressDisplay) 02115 return TRUE; 02116 02117 // Move on, but limit to range! (in case of cock-ups) 02118 NumNodesRendered += (BandSize / ProgressScaleFactor); 02119 if (NumNodesRendered > (FirstStageCount + SecondStageCount)) 02120 NumNodesRendered = (FirstStageCount + SecondStageCount); 02121 // WEBSTER-ranbirr-13/11/96 02122 #ifndef WEBSTER 02123 if (IsPrinting && pPrintInfo != NULL) 02124 { 02125 // Update slider 02126 pPrintInfo->SetSliderSubRangePos(NumNodesRendered * ProgressScaleFactor); 02127 02128 // Does user want to suspend printing? 02129 if (pPrintInfo->Abort()) 02130 return FALSE; 02131 } 02132 else 02133 #endif //webster 02134 return ContinueSlowJob(NumNodesRendered * ProgressScaleFactor); 02135 #endif 02136 // All ok 02137 return TRUE; 02138 }
|
|
Should be called when the first stage of 3-pass rendering is complete.
Definition at line 1910 of file view.cpp. 01911 { 01912 #ifndef STANDALONE 01913 01914 NumNodesRendered = FirstStageCount; 01915 01916 if (!DoProgressDisplay) 01917 // No progress display needed. 01918 return TRUE; 01919 // WEBSTER-ranbirr-13/11/96 01920 #ifndef WEBSTER 01921 if (IsPrinting && pPrintInfo != NULL) 01922 pPrintInfo->SetSliderSubRangePos(NumNodesRendered * ProgressScaleFactor); 01923 else 01924 #endif //webster 01925 return ContinueSlowJob(NumNodesRendered * ProgressScaleFactor); 01926 01927 #endif 01928 01929 // All ok 01930 return TRUE; 01931 }
|
|
Updates the rendered node count by the number specified. If the progress display needs updating, then it is updated.
Definition at line 1855 of file view.cpp. 01856 { 01857 #ifndef STANDALONE 01858 01859 NumNodesRendered++; 01860 01861 if (!DoProgressDisplay) 01862 // No progress display needed. 01863 return TRUE; 01864 // WEBSTER-ranbirr-13/11/96 01865 #ifndef WEBSTER 01866 if (IsPrinting && (pPrintInfo != NULL) && (pPrintInfo->m_bContinuePrinting == FALSE)) 01867 // User has cancelled job 01868 return FALSE; 01869 #endif //webster 01870 if ((NumNodesRendered * ProgressScaleFactor) > (LastProgressUpdate + ProgressInterval)) 01871 { 01872 // Time to update the progress display. 01873 LastProgressUpdate = NumNodesRendered * ProgressScaleFactor; 01874 // WEBSTER-ranbirr-13/11/96 01875 #ifndef WEBSTER 01876 if (IsPrinting && pPrintInfo != NULL) 01877 { 01878 // Update slider 01879 pPrintInfo->SetSliderSubRangePos(LastProgressUpdate); 01880 01881 // Does user want to suspend printing? 01882 if (pPrintInfo->Abort()) 01883 return FALSE; 01884 } 01885 else 01886 #endif //webster 01887 return ContinueSlowJob(LastProgressUpdate); 01888 } 01889 01890 #endif 01891 01892 // All ok 01893 return TRUE; 01894 }
|
|
Should be called when the second stage of 3-pass rendering is complete.
Definition at line 1947 of file view.cpp. 01948 { 01949 #ifndef STANDALONE 01950 01951 NumNodesRendered = FirstStageCount + SecondStageCount; 01952 01953 if (!DoProgressDisplay) 01954 // No progress display needed. 01955 return TRUE; 01956 // WEBSTER-ranbirr-13/11/96 01957 #ifndef WEBSTER 01958 if (IsPrinting && pPrintInfo != NULL) 01959 { 01960 // Update slider 01961 pPrintInfo->SetSliderSubRangePos(NumNodesRendered * ProgressScaleFactor); 01962 01963 // Does user want to suspend printing? 01964 if (pPrintInfo->Abort()) 01965 return FALSE; 01966 } 01967 else 01968 #endif //webster 01969 return ContinueSlowJob(NumNodesRendered * ProgressScaleFactor); 01970 01971 #endif 01972 01973 // All ok 01974 return TRUE; 01975 }
|
|
Lets the rendering loop tell the display system when a node has been rendered. It can act on this to update the progress display whenever needed.
Definition at line 4288 of file view.cpp. 04289 { 04290 #ifndef STANDALONE 04291 // If we have advanced a node, then update 04292 if (NumNodes>NumNodesRendered) 04293 { 04294 // TRACE( _T("SetNodesRendered = %d\n"), NumNodes); 04295 NumNodesRendered = NumNodes; 04296 } 04297 04298 if (!DoProgressDisplay) 04299 // No progress display needed. 04300 return TRUE; 04301 // WEBSTER-ranbirr-13/11/96 04302 #ifndef WEBSTER 04303 if (IsPrinting && (pPrintInfo != NULL) && (pPrintInfo->m_bContinuePrinting == FALSE)) 04304 // User has cancelled job 04305 return FALSE; 04306 #endif //webster 04307 if ((NumNodesRendered * ProgressScaleFactor) > (LastProgressUpdate + ProgressInterval)) 04308 { 04309 // Time to update the progress display. 04310 LastProgressUpdate = NumNodesRendered * ProgressScaleFactor; 04311 // WEBSTER-ranbirr-13/11/96 04312 #ifndef WEBSTER 04313 if (IsPrinting && pPrintInfo != NULL) 04314 { 04315 // Update slider 04316 pPrintInfo->SetSliderSubRangePos(LastProgressUpdate); 04317 04318 // Does user want to suspend printing? 04319 if (pPrintInfo->Abort()) 04320 return FALSE; 04321 } 04322 else 04323 #endif //webster 04324 return ContinueSlowJob(LastProgressUpdate); 04325 } 04326 04327 #endif 04328 04329 // All ok 04330 return TRUE; 04331 }
|
|
Sets up the progress display object based on the render regions passed in.
Definition at line 1695 of file view.cpp. 01696 { 01697 #ifndef STANDALONE 01698 // Work out if we need a progress display 01699 IsPrinting = pRender->IsPrinting(); 01700 if (!IsPrinting && !IS_A(pRender, CamelotEPSRenderRegion)) 01701 // No - stop here 01702 return; 01703 01704 // We need a progress display 01705 DoProgressDisplay = TRUE; 01706 01707 // Find out how many nodes the stages need to render... 01708 BOOL FoundLastComplex = FALSE; 01709 FirstStageCount = 0; 01710 SecondStageCount = 0; 01711 ThirdStageCount = 0; 01712 01713 DocRect ClipRect = pRender->GetClipRect(); 01714 Spread *pSpread = pRender->GetRenderSpread(); 01715 01716 // ---------------------------------------------------------------- 01717 // NOTE! This is the last use of FindFirstForClippedInkRender! 01718 // It should be replaced by RenderTree and a Callback object 01719 Node *pNode = pSpread->FindFirstForClippedInkRender(&ClipRect, pRender); 01720 // ---------------------------------------------------------------- 01721 01722 Node *pLastComplexNode = pScanner->GetLastComplexObject(); 01723 01724 // Work out whether to count just selected objects, or all of them. 01725 BOOL CountAllObjects = TRUE; 01726 // WEBSTER-ranbirr-13/11/96 01727 #ifndef WEBSTER 01728 if (IsPrinting && pPrintInfo != NULL) 01729 { 01730 PrintControl *pPrCtrl = pPrintInfo->GetPrintControl(); 01731 ERROR3IF(pPrCtrl == NULL, "Unable to find PrintControl object from PrintInfo."); 01732 CountAllObjects = (pPrCtrl->GetObjPrintRange() == PRINTRANGEOBJ_ALL); 01733 } 01734 #endif //webster 01735 if (CountAllObjects) 01736 { 01737 // Count *all* objects 01738 while (pNode != NULL) 01739 { 01740 // Count the node that we have 01741 if (FoundLastComplex) 01742 ThirdStageCount++; 01743 else 01744 FirstStageCount++; 01745 01746 // Have we found the last complex node yet? 01747 // (If so, then we start incrementing ThirdStageCount instead of 01748 // FirstStageCount). 01749 if (pNode == pLastComplexNode) 01750 FoundLastComplex = TRUE; 01751 01752 // Find another one to count 01753 pNode = pNode->FindNextForClippedInkRender(&ClipRect, pRender); 01754 } 01755 } 01756 else 01757 { 01758 // Count only *selected objects* 01759 // (We do this by not rendering any bounded object that is not selected). 01760 // 01761 // This is in a different loop so that we don't impact performance of 01762 // normal printing. 01763 while (pNode != NULL) 01764 { 01765 // Count the node that we have, unless it is bounded but not selected. 01766 if (View::IsPrintableNodeSelected(pNode)) 01767 { 01768 if (FoundLastComplex) 01769 ThirdStageCount++; 01770 else 01771 FirstStageCount++; 01772 } 01773 01774 // Have we found the last complex node yet? 01775 // (If so, then we start incrementing ThirdStageCount instead of 01776 // FirstStageCount). 01777 if (pNode == pLastComplexNode) 01778 FoundLastComplex = TRUE; 01779 01780 // Find another one to render 01781 pNode = pNode->FindNextForClippedInkRender(&ClipRect, pRender); 01782 } 01783 } 01784 01785 01786 // Ok - now we need to set the slider range for the print progress dialog. 01787 // We do this on a number of nodes basis - the first and second stages render the 01788 // same number of nodes, so we count the 'first' count twice, and then add the 01789 // 'third' count. 01790 if (pScanner->GetNumComplex() != 0) 01791 { 01792 SecondStageCount = FirstStageCount; 01793 01794 // Check to see if we do not do the first stage, - if not then we do the whole 01795 // thing as a bitmap without bothering with the mask (becuase it's too much for 01796 // most printer drivers to cope with). 01797 if ((PrintMonitor::PrintMaskType==PrintMonitor::MASK_SIMPLE) && 01798 (CCDC::GetType(pRender->GetRenderDC(), TRUE) != RENDERTYPE_PRINTER_PS)) 01799 { 01800 FirstStageCount = 0; 01801 } 01802 } 01803 01804 INT32 Range = FirstStageCount + SecondStageCount + ThirdStageCount; 01805 // WEBSTER-ranbirr-13/11/96 01806 #ifndef WEBSTER 01807 if (IsPrinting) 01808 { 01809 // if (pPrintInfo == NULL) 01810 // { 01811 // ERROR2RAW("No PrintInfo object found!"); 01812 // InformError(); 01813 // return; 01814 // } 01815 01816 if (pPrintInfo != NULL) 01817 { 01818 pPrintInfo->SetSliderSubRangeMax(Range * ProgressScaleFactor); 01819 pPrintInfo->SetSliderSubRangePos(0); 01820 } 01821 } 01822 else 01823 #endif //wesbter 01824 { 01825 // Start progress display (with no initial delay) for Camelot EPS export 01826 String_64 ExportMsg(_R(IDT_EXPORTMSG_CAMEPS)); 01827 BeginSlowJob(Range * ProgressScaleFactor, FALSE, &ExportMsg); 01828 } 01829 01830 // Provide a progress update for every 1% 01831 ProgressInterval = (Range * ProgressScaleFactor) / 100; 01832 #else 01833 // Do nothing as not required on standalone viewer 01834 return; 01835 #endif 01836 01837 }
|
|
This function sets up the Progress display ready to start rendering the nodes.
Definition at line 4214 of file view.cpp. 04215 { 04216 #ifndef STANDALONE 04217 // Work out if we need a progress display 04218 IsPrinting = pRender->IsPrinting(); 04219 if (!IsPrinting && !IS_A(pRender, CamelotEPSRenderRegion)) 04220 // No - stop here 04221 return; 04222 04223 // We need a progress display 04224 DoProgressDisplay = TRUE; 04225 DocRect ClipRect = pRender->GetClipRect(); 04226 Spread *pSpread = pRender->GetRenderSpread(); 04227 // Node *pNode = pSpread->FindFirstForClippedInkRender(&ClipRect, pRender); 04228 TotalNodes = 0; 04229 04230 // Work out whether to count just selected objects, or all of them. 04231 BOOL CountAllObjects = TRUE; 04232 // WEBSTER-ranbirr-13/11/96 04233 #ifndef WEBSTER 04234 if ((IsPrinting) && (pPrintInfo!=NULL)) 04235 { 04236 PrintControl *pPrCtrl = pPrintInfo->GetPrintControl(); 04237 CountAllObjects = (pPrCtrl->GetObjPrintRange() == PRINTRANGEOBJ_ALL); 04238 } 04239 #endif //webster 04240 04241 OptimalPrintRenderCallback MyCallback(pRender->GetRenderView(), pSpread, CountAllObjects, pScanner, FALSE, &TotalNodes, NULL, TRUE); 04242 pRender->RenderTree(pSpread, FALSE, FALSE, &MyCallback); 04243 04244 TRACE( _T("TotalNodes = %d\n"), TotalNodes); 04245 04246 // WEBSTER-ranbirr-13/11/96 04247 #ifndef WEBSTER 04248 // Set up the slider according to the printing flag 04249 if (IsPrinting) 04250 { 04251 if (pPrintInfo != NULL) 04252 { 04253 // actually set the slider 04254 TRACEUSER( "Gerry", _T("Setting Progress slider up to %ld\n"), TotalNodes * ProgressScaleFactor); 04255 pPrintInfo->SetSliderSubRangeMax(TotalNodes * ProgressScaleFactor); 04256 pPrintInfo->SetSliderSubRangePos(0); 04257 } 04258 } 04259 else 04260 #endif //webster 04261 { 04262 // Start progress display (with no initial delay) for Camelot EPS export 04263 String_64 ExportMsg(_R(IDT_EXPORTMSG_CAMEPS)); 04264 BeginSlowJob(TotalNodes*ProgressScaleFactor, FALSE, &ExportMsg); 04265 } 04266 04267 // Provide a progress update for every 1% 04268 ProgressInterval = (TotalNodes * ProgressScaleFactor) / 100; 04269 TRACE( _T("ProgressInterval = %d\n"), ProgressInterval); 04270 #endif 04271 }
|
|
Gets ready to render the banded bitmap phase of the rendering. Works out how much each band should update the progress position by.
Definition at line 2012 of file view.cpp. 02013 { 02014 if (!DoProgressDisplay) 02015 return; 02016 02017 // Work out how much of the progress range we can use for each band. 02018 BandSize = (SecondStageCount * ProgressScaleFactor) / NumBands; 02019 BandOffset = 0; 02020 }
|
|
Inform the progress display that a band is about to start being rendered, and how many scanlines high it will be.
Definition at line 2035 of file view.cpp. 02036 { 02037 // Remember how high this band is. 02038 BandHeight = TotalNumScanlines; 02039 02040 // Work out how much to move the progress display by for each scanline. 02041 BandIncrement = BandSize / BandHeight; 02042 }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|