Skip to content

Commit 727d41e

Browse files
committed
Added progress dialog to show plugins loading
1 parent a387512 commit 727d41e

File tree

3 files changed

+45
-0
lines changed

3 files changed

+45
-0
lines changed

dialogs/ProgDlg.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ CProgressDlg::CProgressDlg(UINT nCaptionID)
2727
// NOTE: the ClassWizard will add member initialization here
2828
//}}AFX_DATA_INIT
2929
m_bParentDisabled = FALSE;
30+
m_bHideCancel = FALSE;
3031
}
3132

3233
CProgressDlg::~CProgressDlg()
@@ -212,5 +213,8 @@ BOOL CProgressDlg::OnInitDialog()
212213
m_Progress.SetStep(m_nStep);
213214
m_Progress.SetPos(m_nLower);
214215

216+
if (m_bHideCancel)
217+
GetDlgItem (IDCANCEL)->ShowWindow (SW_HIDE);
218+
215219
return TRUE;
216220
}

dialogs/ProgDlg.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ class CProgressDlg : public CDialog
2626
int OffsetPos(int nPos);
2727
int StepIt();
2828

29+
bool m_bHideCancel;
30+
2931
// Dialog Data
3032
//{{AFX_DATA(CProgressDlg)
3133
enum { IDD = CG_IDD_PROGRESS };

xml/xml_load_world.cpp

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include "..\MUSHview.h"
88
#include "..\genprint.h"
99
#include "..\mainfrm.h"
10+
#include "..\dialogs\ProgDlg.h"
1011

1112
/*
1213
@@ -594,10 +595,46 @@ POSITION lpos;
594595
for (lpos = m_strCurrentIncludeFileList.GetHeadPosition (); lpos; )
595596
strIncludeList.AddTail (m_strCurrentIncludeFileList.GetNext (lpos));
596597

598+
int iCount = 0;
599+
600+
if (bPlugins)
601+
{
602+
for (POSITION nodepos = (parent).ChildrenList.GetHeadPosition (); nodepos; )
603+
{
604+
CXMLelement * node = (parent).ChildrenList.GetNext (nodepos);
605+
if (node->strName == "include" && !node->bUsed)
606+
iCount++;
607+
}
608+
}
609+
610+
CProgressDlg * pDlg = NULL;
611+
612+
if (iCount)
613+
{
614+
pDlg = new CProgressDlg;
615+
pDlg->m_bHideCancel = true;
616+
pDlg->Create ();
617+
pDlg->SetRange (0, iCount);
618+
pDlg->SetStep (1);
619+
pDlg->SetWindowText (Translate ("Loading plugins ..."));
620+
}
621+
597622
// see if we have "include" tag(s)
598623

599624
LOAD_LOOP (parent, "include", pIncludeElement);
600625

626+
if (pDlg)
627+
{
628+
Get_XML_string (*pIncludeElement, "name", strFileName, false, true);
629+
630+
int iSlash = strFileName.ReverseFind ('\\');
631+
if (iSlash != -1)
632+
strFileName = strFileName.Mid (iSlash + 1);
633+
634+
pDlg->SetStatus (TFormat ("Loading plugin: %s", (LPCTSTR) strFileName));
635+
pDlg->StepIt ();
636+
}
637+
601638
try
602639
{
603640
Load_One_Include_XML (*pIncludeElement,
@@ -623,6 +660,8 @@ POSITION lpos;
623660

624661
END_LOAD_LOOP;
625662

663+
delete pDlg;
664+
626665
// restore current include list tree
627666
m_strCurrentIncludeFileList.RemoveAll ();
628667
for (lpos = strIncludeList.GetHeadPosition (); lpos; )

0 commit comments

Comments
 (0)