[commit] r2022 - trunk/GME/Parser
GMESRC Repository Notifications
gme-commit at list.isis.vanderbilt.edu
Thu Aug 16 11:30:14 CDT 2012
Author: ksmyth
Date: Thu Aug 16 11:30:14 2012
New Revision: 2022
Log:
Add progress bar to XME export
Modified:
trunk/GME/Parser/MgaDumper.cpp
trunk/GME/Parser/MgaDumper.h
Modified: trunk/GME/Parser/MgaDumper.cpp
==============================================================================
--- trunk/GME/Parser/MgaDumper.cpp Thu Aug 16 11:30:04 2012 (r2021)
+++ trunk/GME/Parser/MgaDumper.cpp Thu Aug 16 11:30:14 2012 (r2022)
@@ -139,9 +139,8 @@
return DumpProject2(p, xmlfile, NULL);
}
-STDMETHODIMP CMgaDumper::DumpProject2(IMgaProject *p, BSTR xmlfile, ULONGLONG hwndParent)
+STDMETHODIMP CMgaDumper::DumpProject2(IMgaProject *p, BSTR xmlfile, ULONGLONG hwndParent_)
{
- // TODO: progress bar
CHECK_IN(p);
m_dumpGuids = true; // dump GUIDs with the whole project
m_closureDump = false;
@@ -152,6 +151,13 @@
COMTRY
{
+ HWND hwndParent = (HWND)hwndParent_;
+ if (hwndParent != 0)
+ {
+ COMTHROW( m_progress.CoCreateInstance(L"Mga.MgaProgressDlg") );
+ COMTHROW( m_progress->SetTitle(_bstr_t(L"Exporting XME file...")) );
+ COMTHROW( m_progress->StartProgressDialog(hwndParent) );
+ }
InitDump(p, xmlfile, _bstr_t(L"UTF-8"));
ofs << L"<!DOCTYPE project SYSTEM \"mga.dtd\">\n\n";
@@ -159,8 +165,20 @@
Dump(p);
DoneDump(false);
+ if (m_progress != NULL )
+ {
+ COMTHROW(m_progress->StopProgressDialog());
+ m_progress = NULL;
+ }
}
- COMCATCH( DoneDump(true); )
+ COMCATCH(
+ DoneDump(true);
+ if (m_progress != NULL )
+ {
+ COMTHROW(m_progress->StopProgressDialog());
+ m_progress = NULL;
+ }
+ )
}
STDMETHODIMP CMgaDumper::DumpFCOs(IMgaProject *proj, IMgaFCOs *p, IMgaFolders *f, IMgaRegNodes *r, BSTR xmlfile)
@@ -726,15 +744,24 @@
{
ASSERT( fco != NULL );
- if( ++fco_count > FLUSH_LIMIT )
+ if (fco_count++ % FLUSH_LIMIT == 0)
{
ASSERT( territory != NULL );
- COMTHROW( territory->Flush() );
- COMTHROW( project->CommitTransaction() );
- COMTHROW( project->BeginTransaction(territory, TRANSACTION_READ_ONLY) );
+ if (fco_count >= FLUSH_LIMIT)
+ {
+ COMTHROW( territory->Flush() );
+ COMTHROW( project->CommitTransaction() );
+ COMTHROW( project->BeginTransaction(territory, TRANSACTION_READ_ONLY) );
+ }
- fco_count = 0;
+ if (m_progress)
+ {
+ static TCHAR progress_msg[512];
+ _stprintf_s(progress_msg, _T("Number of exported FCOs: %ld"), (long)fco_count);
+ COMTHROW(m_progress->SetLine(0, PutInBstr(progress_msg)));
+ COMTHROW(m_progress->SetProgress(fco_count, 0));
+ }
}
if( dump_attrs )
Modified: trunk/GME/Parser/MgaDumper.h
==============================================================================
--- trunk/GME/Parser/MgaDumper.h Thu Aug 16 11:30:04 2012 (r2021)
+++ trunk/GME/Parser/MgaDumper.h Thu Aug 16 11:30:14 2012 (r2022)
@@ -7,6 +7,7 @@
#include "CommonVersionInfo.h"
#include "Transcoder.h"
#include "helper.h"
+#include "MgaUtil.h"
class GmeEqual
{
@@ -258,6 +259,7 @@
std::tstring m_currAbsPath;//? it is needed any more?
//std::tstring m_currParAbsPath; // used for 'closurepath' calc
bool m_v2;
+ CComPtr<IMgaProgressDlg> m_progress;
};
More information about the gme-commit
mailing list