CProgressBarDLG Class Reference

#include <ProgressBarDLG.h>

Collaboration diagram for CProgressBarDLG:
Collaboration graph
[legend]

List of all members.

Public Types

enum  { IDD = IDD_PROGBAR }

Public Member Functions

 CProgressBarDLG (LPCTSTR tname=NULL, BOOL dispatcher=FALSE, CWnd *pParent=NULL)
 CProgressBarDLG (UINT nIDTemplate, LPCTSTR tname=NULL, BOOL dispatcher=FALSE, CWnd *pParent=NULL)
 CProgressBarDLG (CProgressBarDLG *counter, LPCTSTR tname=NULL, BOOL dispatcher=FALSE)
virtual ~CProgressBarDLG ()
BOOL OnInitDialog ()
virtual CVCounter * MakeChildCounter (int m)
virtual CVCounter * GetUsableCounter ()
virtual void DeleteChildCounter ()
virtual void Start (int m=100, char *tn=NULL)
virtual void Stop ()
virtual void Init ()
virtual void Clear ()
virtual void SetMax (int max)
virtual void SetPos (int pos)
virtual void StepIt (int n=1)
virtual void ResetRate (int m, int n)
virtual void PutFill ()
virtual void SetTitle (char *tn)
virtual bool isCanceled ()

Public Attributes

CWnd * pWnd
UINT dialogID
CString title
BOOL enableDisPatcher
int gmax
int base
double grate
double lrate
double prate
CProgressCtrl * progBar
CProgressBarDLGparent
CProgressBarDLGchild

Protected Member Functions

virtual void DoDataExchange (CDataExchange *pDX)
virtual BOOL OnCommand (WPARAM wParam, LPARAM lParam)

Detailed Description

Definition at line 120 of file ProgressBarDLG.h.


Member Enumeration Documentation

anonymous enum
Enumerator:
IDD 

Definition at line 167 of file ProgressBarDLG.h.

00167 { IDD = IDD_PROGBAR };


Constructor & Destructor Documentation

CProgressBarDLG ( LPCTSTR  tname = NULL,
BOOL  dispatcher = FALSE,
CWnd *  pParent = NULL 
)

Definition at line 23 of file ProgressBarDLG.cpp.

References CProgressBarDLG::dialogID, CProgressBarDLG::enableDisPatcher, CProgressBarDLG::gmax, CProgressBarDLG::IDD, CProgressBarDLG::Init(), CProgressBarDLG::progBar, PROGRESS_COUNTERMAX, CProgressBarDLG::pWnd, and CProgressBarDLG::title.

00024         : CDialog(CProgressBarDLG::IDD, pParent)
00025 {
00026     //{{AFX_DATA_INIT(CProgressBarDLG)
00027         // メモ - ClassWizard はこの位置にマッピング用のマクロを追加または削除します.
00028     //}}AFX_DATA_INIT
00029 
00030     Init();
00031 
00032     dialogID = CProgressBarDLG::IDD;
00033     pWnd     = pParent;
00034     progBar  = NULL;
00035     gmax     = PROGRESS_COUNTERMAX;
00036     title    = tname;
00037     enableDisPatcher = dispatch;
00038 }

Here is the call graph for this function:

CProgressBarDLG ( UINT  nIDTemplate,
LPCTSTR  tname = NULL,
BOOL  dispatcher = FALSE,
CWnd *  pParent = NULL 
)

Definition at line 42 of file ProgressBarDLG.cpp.

References CProgressBarDLG::dialogID, CProgressBarDLG::enableDisPatcher, CProgressBarDLG::gmax, CProgressBarDLG::Init(), CProgressBarDLG::progBar, PROGRESS_COUNTERMAX, CProgressBarDLG::pWnd, and CProgressBarDLG::title.

00043         : CDialog(nIDTemplate, pParent)
00044 {
00045     Init();
00046 
00047     dialogID = nIDTemplate;
00048     pWnd     = pParent;
00049     progBar  = NULL;
00050     gmax     = PROGRESS_COUNTERMAX;
00051     title    = tname;
00052     enableDisPatcher = dispatch;
00053 }

Here is the call graph for this function:

CProgressBarDLG ( CProgressBarDLG counter,
LPCTSTR  tname = NULL,
BOOL  dispatcher = FALSE 
)

Definition at line 57 of file ProgressBarDLG.cpp.

References CProgressBarDLG::enableDisPatcher, CProgressBarDLG::Init(), CProgressBarDLG::parent, and CProgressBarDLG::title.

00058 {
00059     Init();
00060 
00061     parent = counter;
00062     title  = tname;
00063     enableDisPatcher = dispatch;
00064 }

Here is the call graph for this function:

~CProgressBarDLG (  )  [virtual]

Definition at line 68 of file ProgressBarDLG.cpp.

References CProgressBarDLG::child, CProgressBarDLG::parent, and CProgressBarDLG::Stop().

00069 {
00070     if (child !=NULL) delete  child;        // 子供がいれば先に死んでもらう.
00071     if (parent!=NULL) parent->child = NULL; // 親がいれば縁を切る.
00072     Stop();                                 // 停止.
00073 }

Here is the call graph for this function:


Member Function Documentation

void Clear (  )  [virtual]

Definition at line 100 of file ProgressBarDLG.cpp.

References CProgressBarDLG::base, CProgressBarDLG::child, CProgressBarDLG::grate, CProgressBarDLG::lrate, CProgressBarDLG::prate, CProgressBarDLG::progBar, and CProgressBarDLG::title.

00101 {
00102     title  = _T("");
00103     base   = 0;
00104     grate  = 1.0;
00105     lrate  = 1.0;
00106     prate  = 1.0;
00107 
00108     max    = 0;
00109     fill   = 0;
00110     pos    = 0;
00111 
00112     if (child!=NULL) delete child;
00113     child = NULL;
00114 
00115     if (progBar!=NULL) progBar->SetPos(0);
00116 }

void DeleteChildCounter (  )  [virtual]

Definition at line 177 of file ProgressBarDLG.cpp.

References CProgressBarDLG::child, and CProgressBarDLG::PutFill().

00178 {
00179     PutFill();
00180     if (child!=NULL) delete child;
00181     child = NULL;
00182 }

Here is the call graph for this function:

void DoDataExchange ( CDataExchange *  pDX  )  [protected, virtual]

Definition at line 134 of file ProgressBarDLG.cpp.

00135 {
00136     CDialog::DoDataExchange(pDX);
00137     //{{AFX_DATA_MAP(CProgressBarDLG)
00138         // メモ - ClassWizard はこの位置にマッピング用のマクロを追加または削除します.
00139     //}}AFX_DATA_MAP
00140 }

CVCounter * GetUsableCounter (  )  [virtual]

Definition at line 191 of file ProgressBarDLG.cpp.

References CProgressBarDLG::child, and CProgressBarDLG::GetUsableCounter().

Referenced by CProgressBarDLG::GetUsableCounter().

00192 {
00193     if (child==NULL) return (CVCounter*)this;
00194     else  return child->GetUsableCounter();
00195 }

Here is the call graph for this function:

Here is the caller graph for this function:

void Init (  )  [virtual]

Definition at line 77 of file ProgressBarDLG.cpp.

References CProgressBarDLG::base, CProgressBarDLG::child, CProgressBarDLG::dialogID, CProgressBarDLG::enableDisPatcher, CProgressBarDLG::gmax, CProgressBarDLG::grate, CProgressBarDLG::lrate, CProgressBarDLG::parent, CProgressBarDLG::prate, CProgressBarDLG::progBar, CProgressBarDLG::pWnd, and CProgressBarDLG::title.

Referenced by CProgressBarDLG::CProgressBarDLG().

00078 {
00079     dialogID = 0;
00080     pWnd    = NULL;
00081     progBar = NULL;
00082     
00083     max    = 0;
00084     fill   = 0;
00085     pos    = 0;
00086 
00087     gmax   = 0;
00088     base   = 0;
00089     grate  = 1.0;
00090     lrate  = 1.0;
00091     prate  = 1.0;
00092     parent = NULL;
00093     child  = NULL;
00094     title  = _T("");
00095     enableDisPatcher = TRUE;
00096 }

Here is the caller graph for this function:

bool isCanceled (  )  [virtual]

Definition at line 351 of file ProgressBarDLG.cpp.

References CProgressBarDLG::isCanceled(), and CProgressBarDLG::parent.

Referenced by jbxwl::copyFPWithCounter(), CDxSRenderView::GetValidVoxelNum(), CProgressBarDLG::isCanceled(), and CDxSRenderView::PrepareVB().

00352 {
00353     if (parent==NULL) return cancel;
00354     else return parent->isCanceled();
00355 }

Here is the call graph for this function:

Here is the caller graph for this function:

CVCounter * MakeChildCounter ( int  m  )  [virtual]

Definition at line 163 of file ProgressBarDLG.cpp.

00164 {
00165     if (m<=0) return NULL;
00166     ResetRate(m, m);                // 該当区間の lrateを 1.0に戻す.
00167 
00168     child = new CProgressBarDLG(this, (LPCTSTR)title, enableDisPatcher);
00169     child->SetMax(m);
00170     return (CVCounter*)child;
00171 }

BOOL OnCommand ( WPARAM  wParam,
LPARAM  lParam 
) [protected, virtual]

Definition at line 361 of file ProgressBarDLG.cpp.

00362 {
00363     if (wParam==IDCANCEL) cancel = true;
00364 
00365     return CDialog::OnCommand(wParam, lParam);
00366 }

BOOL OnInitDialog (  ) 

Definition at line 120 of file ProgressBarDLG.cpp.

References IDC_PROGBAR_M, CProgressBarDLG::parent, and CProgressBarDLG::progBar.

00121 {
00122     if (parent==NULL) {
00123         //RECT r;
00124         //r.left=10; r.top=10; r.right=300; r.bottom=30;
00125         //progBar->Create(WS_VISIBLE|WS_CHILD|WS_BORDER, r, this, IDD_PROGBAR);
00126         if (progBar==NULL) progBar = (CProgressCtrl*)GetDlgItem(IDC_PROGBAR_M);
00127 
00128     }
00129     return TRUE;
00130 }

void PutFill (  )  [virtual]

Definition at line 281 of file ProgressBarDLG.cpp.

References CProgressBarDLG::base, CProgressBarDLG::enableDisPatcher, CProgressBarDLG::grate, CProgressBarDLG::lrate, CProgressBarDLG::parent, CProgressBarDLG::progBar, and CProgressBarDLG::SetPos().

Referenced by CProgressBarDLG::DeleteChildCounter().

00282 {
00283     pos = fill;
00284     int mem = base + (int)(grate*lrate*pos + 0.5);
00285 
00286     if (parent!=NULL) {
00287         parent->SetPos(mem);
00288     }
00289     else {
00290         progBar->SetPos(mem);
00291     }
00292 
00293     if (enableDisPatcher) DisPatcher();
00294 }

Here is the call graph for this function:

Here is the caller graph for this function:

void ResetRate ( int  m,
int  n 
) [virtual]

Definition at line 302 of file ProgressBarDLG.cpp.

References CProgressBarDLG::base, CProgressBarDLG::grate, and CProgressBarDLG::lrate.

00303 {
00304     if (rng<=0 || num<0) return;
00305     if (num==0) num = 1;
00306 
00307     base  = base + (int)(pos*lrate*grate + 0.5);
00308     lrate = (double)rng/(double)num;
00309     pos   = 0;
00310     fill  = num;
00311 }

void SetMax ( int  max  )  [virtual]

Definition at line 201 of file ProgressBarDLG.cpp.

References CProgressBarDLG::gmax, and CProgressBarDLG::grate.

Referenced by jbxwl::copyFPWithCounter(), and CProgressBarDLG::Start().

00202 {
00203     if (num<=0)  return;
00204 
00205     if (gmax==0) gmax = num;
00206     grate = (double)gmax/(double)num;
00207     fill = max = num;
00208 }

Here is the caller graph for this function:

void SetPos ( int  pos  )  [virtual]

Definition at line 332 of file ProgressBarDLG.cpp.

References CProgressBarDLG::base, CProgressBarDLG::enableDisPatcher, CProgressBarDLG::grate, CProgressBarDLG::lrate, CProgressBarDLG::parent, CProgressBarDLG::progBar, and CProgressBarDLG::SetPos().

Referenced by jbxwl::copyFPWithCounter(), CDxSRenderView::GetValidVoxelNum(), CDxSRenderView::PrepareVB(), CProgressBarDLG::PutFill(), CProgressBarDLG::SetPos(), and CProgressBarDLG::StepIt().

00333 {
00334     if ((int)(lrate*num)>fill) return;
00335 
00336     pos = num;
00337     int mem = base + (int)(grate*lrate*pos + 0.5);
00338 
00339     if (parent!=NULL) {
00340         parent->SetPos(mem);
00341     }
00342     else {
00343         progBar->SetPos(mem);
00344     }
00345 
00346     if (enableDisPatcher) DisPatcher();
00347 }

Here is the call graph for this function:

Here is the caller graph for this function:

void SetTitle ( char *  tn  )  [virtual]

Definition at line 262 of file ProgressBarDLG.cpp.

References jbxwl::mbs2ts(), CProgressBarDLG::parent, CProgressBarDLG::SetTitle(), and CProgressBarDLG::title.

Referenced by CProgressBarDLG::SetTitle().

00263 {
00264     if (tn!=NULL) title = mbs2ts(tn);
00265 
00266     if (parent!=NULL) {
00267         parent->SetTitle(tn);
00268     }
00269     else {
00270         if (start) SetWindowText(title);
00271     }
00272 }

Here is the call graph for this function:

Here is the caller graph for this function:

void Start ( int  m = 100,
char *  tn = NULL 
) [virtual]

Definition at line 215 of file ProgressBarDLG.cpp.

References CProgressBarDLG::dialogID, jbxwl::mbs2ts(), CProgressBarDLG::parent, CProgressBarDLG::progBar, PROGRESS_COUNTERMAX, CProgressBarDLG::pWnd, CProgressBarDLG::SetMax(), and CProgressBarDLG::title.

Referenced by jbxwl::copyFPWithCounter(), CRwGRDoc::MakeViewData(), CDxSRenderView::PrepareVB(), CRwGRDoc::ReadDataFile(), and jbxwl::writeGraphicFileWithCounter().

00216 {
00217     cancel = false;
00218 
00219     if (parent==NULL) {
00220         this->Create(dialogID, pWnd);
00221         this->ShowWindow(SW_SHOW);
00222 
00223         if (tn!=NULL) title = mbs2ts(tn);
00224         if (!title.IsEmpty()) SetWindowText(title);
00225         start = true;
00226 
00227         if (progBar!=NULL) {
00228             progBar->SetPos(0);
00229             progBar->SetRange((short)0, (short)PROGRESS_COUNTERMAX);
00230             progBar->SetStep(1);
00231         }
00232     }
00233     SetMax(m);
00234 }

Here is the call graph for this function:

Here is the caller graph for this function:

void StepIt ( int  n = 1  )  [virtual]

Definition at line 315 of file ProgressBarDLG.cpp.

References CProgressBarDLG::base, CProgressBarDLG::enableDisPatcher, CProgressBarDLG::grate, CProgressBarDLG::lrate, CProgressBarDLG::parent, CProgressBarDLG::progBar, and CProgressBarDLG::SetPos().

Referenced by jbxwl::copyFPWithCounter().

00316 {
00317     pos += n;
00318     int mem = base + (int)(grate*lrate*pos + 0.5);
00319 
00320     if (parent!=NULL) {
00321         parent->SetPos(mem);
00322     }
00323     else {
00324         progBar->SetPos(mem);
00325     }
00326 
00327     if (enableDisPatcher) DisPatcher();
00328 }

Here is the call graph for this function:

Here is the caller graph for this function:

void Stop (  )  [virtual]

Definition at line 240 of file ProgressBarDLG.cpp.

References CProgressBarDLG::base, CProgressBarDLG::grate, CProgressBarDLG::lrate, CProgressBarDLG::parent, and CProgressBarDLG::title.

Referenced by jbxwl::copyFPWithCounter(), CRwGRDoc::MakeViewData(), CDxSRenderView::PrepareVB(), CRwGRDoc::ReadDataFile(), jbxwl::writeGraphicFileWithCounter(), and CProgressBarDLG::~CProgressBarDLG().

00241 {
00242     max   = 0;
00243     pos   = 0;
00244     fill  = 0;
00245     base  = 0;
00246     grate = 1.0;
00247     lrate = 1.0;
00248     title = _T("");
00249     cancel = false;
00250     start  = false;
00251 
00252     if (parent==NULL) {
00253         DestroyWindow();
00254 //      deleteNull(progBar);
00255     }
00256 }

Here is the caller graph for this function:


Member Data Documentation

int base
UINT dialogID
int gmax
double grate
double lrate
double prate

Definition at line 132 of file ProgressBarDLG.h.

Referenced by CProgressBarDLG::Clear(), and CProgressBarDLG::Init().

CProgressCtrl* progBar
CWnd* pWnd
CString title

The documentation for this class was generated from the following files:

Generated on 15 Nov 2023 for JunkBox_Win_Lib by  doxygen 1.6.1