[commit] r1426 - in trunk/GME: MgaUtil Parser

GMESRC Repository Notifications gme-commit at list.isis.vanderbilt.edu
Mon Jul 25 11:07:21 CDT 2011


Author: ksmyth
Date: Mon Jul 25 11:07:21 2011
New Revision: 1426

Log:
XML import progress bar: fix dimensions, draw more often, use Marquee/indeterminate progress bar, use commctrls 6.0

Modified:
   trunk/GME/MgaUtil/MgaProgressDlg.cpp
   trunk/GME/MgaUtil/MgaUtil.rc
   trunk/GME/MgaUtil/StdAfx.cpp
   trunk/GME/MgaUtil/StdAfx.h
   trunk/GME/MgaUtil/targetver.h
   trunk/GME/Parser/MgaParser.cpp

Modified: trunk/GME/MgaUtil/MgaProgressDlg.cpp
==============================================================================
--- trunk/GME/MgaUtil/MgaProgressDlg.cpp	Fri Jul 22 15:52:24 2011	(r1425)
+++ trunk/GME/MgaUtil/MgaProgressDlg.cpp	Mon Jul 25 11:07:21 2011	(r1426)
@@ -2,6 +2,9 @@
 #include "stdafx.h"
 #include "MgaProgressDlg.h"
 
+EXTERN_C IMAGE_DOS_HEADER __ImageBase;
+#define HINST_THISCOMPONENT ((HINSTANCE)&__ImageBase)
+
 // --------------------------- CMgaProgressDlg
 
 CMgaProgressDlg::CMgaProgressDlg() 
@@ -51,7 +54,9 @@
 	AFX_MANAGE_STATE(AfxGetStaticModuleState())
 
 	CWnd *win = hwndParent == NULL ? AfxGetMainWnd() : CWnd::FromHandle(hwndParent);
-	dlg.Create(IDD_PROGRESSDLG, win);
+	// n.b. dlg.Create doesn't load comctl32 6.0
+	dlg.Attach(CreateDialogW(HINST_THISCOMPONENT, MAKEINTRESOURCE(IDD_PROGRESSDLG), hwndParent, NULL));
+	//dlg.Create(IDD_PROGRESSDLG, win);
 	ASSERT( dlg.m_hWnd != NULL );
 
 	dlg.SetWindowText(title);
@@ -59,6 +64,7 @@
 	dlg.GetDlgItem(nIDs[1])->SetWindowText(lines[1]);
 
 	dlg.ShowWindow(SW_SHOWNORMAL);
+	dlg.UpdateWindow();
 
 	return S_OK;
 }
@@ -71,12 +77,33 @@
 	CProgressCtrl *ctrl = (CProgressCtrl*)dlg.GetDlgItem(IDC_PROGRESS1);
 	ASSERT( ctrl != NULL );
 
-	ctrl->SetRange32(0, total);
-	ctrl->SetPos(completed);
-
-//	dlg.Invalidate();
-	dlg.UpdateWindow();
+	if (total == 0) {
+		if (!(ctrl->GetStyle() & PBS_MARQUEE)) {
+			ctrl->ModifyStyle(0, PBS_MARQUEE);
+			ctrl->SetMarquee(TRUE, 30);
+		}
+	} else {
+		if ((ctrl->GetStyle() & PBS_MARQUEE)) {
+			ctrl->ModifyStyle(0, PBS_MARQUEE, 0, 0);
+			ctrl->SetMarquee(FALSE, 30);
+		}
+	}
+	if (!(ctrl->GetStyle() & PBS_MARQUEE)) {
+		ctrl->SetRange32(0, total);
+		ctrl->SetPos(completed);
+	}
 
+	//dlg.UpdateWindow();
+	MSG msg;
+	while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE) > 0)
+	{
+		if (msg.message == WM_QUIT) {
+			PostQuitMessage((int)msg.wParam);
+			return S_OK;
+		}
+		TranslateMessage(&msg);
+		DispatchMessage(&msg);
+	}
 	return S_OK;
 }
 
@@ -94,8 +121,10 @@
 	if( dlg.m_hWnd == NULL )
 		COMRETURN(E_INVALID_USAGE);
 
-	dlg.DestroyWindow();
+	HWND hwnd = dlg.m_hWnd;
+	dlg.Detach();
 	ASSERT( dlg.m_hWnd == NULL );
+	::DestroyWindow(hwnd);
 
 	return S_OK;
 }

Modified: trunk/GME/MgaUtil/MgaUtil.rc
==============================================================================
--- trunk/GME/MgaUtil/MgaUtil.rc	Fri Jul 22 15:52:24 2011	(r1425)
+++ trunk/GME/MgaUtil/MgaUtil.rc	Mon Jul 25 11:07:21 2011	(r1426)
@@ -12,13 +12,11 @@
 #undef APSTUDIO_READONLY_SYMBOLS
 
 /////////////////////////////////////////////////////////////////////////////
-// English (U.S.) resources
+// English (United States) resources
 
 #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
-#ifdef _WIN32
 LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
 #pragma code_page(1252)
-#endif //_WIN32
 
 /////////////////////////////////////////////////////////////////////////////
 //
@@ -130,7 +128,7 @@
     CONTROL         "All",IDC_ALLCOMPS,"Button",BS_AUTORADIOBUTTON,214,210,25,10
 END
 
-IDD_PROPERTIES_DIALOG DIALOG  0, 0, 157, 258
+IDD_PROPERTIES_DIALOG DIALOG 0, 0, 157, 258
 STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
 CAPTION "Model Properties"
 FONT 8, "MS Sans Serif"
@@ -219,17 +217,17 @@
     PUSHBUTTON      "Change...",IDC_SETRELID,116,199,33,14
 END
 
-IDD_PROGRESSDLG DIALOG  0, 0, 244, 70
+IDD_PROGRESSDLG DIALOGEX 0, 0, 244, 45
 STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
 CAPTION "Dialog"
-FONT 8, "MS Sans Serif"
+FONT 8, "MS Sans Serif", 0, 0, 0x0
 BEGIN
-    CONTROL         "Progress1",IDC_PROGRESS1,"msctls_progress32",WS_BORDER,10,45,225,20
-    LTEXT           "",IDC_STATIC1,10,10,225,15
-    LTEXT           "",IDC_STATIC2,10,25,225,15
+    CONTROL         "Progress1",IDC_PROGRESS1,"msctls_progress32",WS_BORDER,7,29,230,9
+    LTEXT           "",IDC_STATIC1,7,7,230,8
+    LTEXT           "",IDC_STATIC2,7,18,230,8
 END
 
-IDD_METAPURGEDIALOG DIALOG  0, 0, 371, 182
+IDD_METAPURGEDIALOG DIALOG 0, 0, 371, 182
 STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
 CAPTION "Dialog"
 FONT 8, "MS Sans Serif"
@@ -289,7 +287,7 @@
     COMBOBOX        IDC_ENGINECOMBO,80,71,125,30,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
 END
 
-IDD_FOLDERPROPERTIES_DIALOG DIALOG  0, 0, 157, 175
+IDD_FOLDERPROPERTIES_DIALOG DIALOG 0, 0, 157, 175
 STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
 CAPTION "Folder Properties"
 FONT 8, "MS Sans Serif"
@@ -365,7 +363,7 @@
     LTEXT           "Y:",IDC_STATIC_YCOORD,343,311,8,8
 END
 
-IDD_XSLTDIAL DIALOG  0, 0, 372, 151
+IDD_XSLTDIAL DIALOG 0, 0, 372, 151
 STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
 CAPTION "XSL Transformation"
 FONT 8, "MS Sans Serif"
@@ -428,7 +426,7 @@
     LTEXT           "ClosureId:",IDC_STATIC,164,219,33,10
 END
 
-IDD_CLOSURERES DIALOG  0, 0, 275, 127
+IDD_CLOSURERES DIALOG 0, 0, 275, 127
 STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
 CAPTION "Selective Closure Result"
 FONT 8, "MS Sans Serif"
@@ -438,7 +436,7 @@
     GROUPBOX        "Folders and Models the Closure can be pasted in:",IDC_STATIC,21,10,178,103
 END
 
-IDD_CLOSURESMARTCP DIALOG  0, 0, 226, 58
+IDD_CLOSURESMARTCP DIALOG 0, 0, 226, 58
 STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
 CAPTION "Smart copy dialog"
 FONT 8, "MS Sans Serif"
@@ -451,7 +449,7 @@
     PUSHBUTTON      "Invert",IDC_INVERT,12,41,29,13
 END
 
-IDD_CLOSUREKINDSEL DIALOG  0, 0, 186, 95
+IDD_CLOSUREKINDSEL DIALOG 0, 0, 186, 95
 STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
 CAPTION "Include the following children"
 FONT 8, "MS Sans Serif"
@@ -597,7 +595,7 @@
 //
 
 #ifdef APSTUDIO_INVOKED
-GUIDELINES DESIGNINFO 
+GUIDELINES DESIGNINFO
 BEGIN
     IDD_DIALOG_LIST, DIALOG
     BEGIN
@@ -654,7 +652,6 @@
         LEFTMARGIN, 7
         RIGHTMARGIN, 237
         TOPMARGIN, 7
-        BOTTOMMARGIN, 63
     END
 
     IDD_METAPURGEDIALOG, DIALOG
@@ -774,7 +771,7 @@
 // Menu
 //
 
-IDR_CNTXMENU_REGBRW MENU 
+IDR_CNTXMENU_REGBRW MENU
 BEGIN
     POPUP "Cntx"
     BEGIN
@@ -800,12 +797,12 @@
 // String Table
 //
 
-STRINGTABLE 
+STRINGTABLE
 BEGIN
     IDS_REGISTRAR_NAME      "GME Registration Agent"
 END
 
-#endif    // English (U.S.) resources
+#endif    // English (United States) resources
 /////////////////////////////////////////////////////////////////////////////
 
 

Modified: trunk/GME/MgaUtil/StdAfx.cpp
==============================================================================
--- trunk/GME/MgaUtil/StdAfx.cpp	Fri Jul 22 15:52:24 2011	(r1425)
+++ trunk/GME/MgaUtil/StdAfx.cpp	Mon Jul 25 11:07:21 2011	(r1426)
@@ -12,3 +12,5 @@
 
 #import "ParserLib.tlb" implementation_only auto_search no_namespace no_search_namespace raw_method_prefix("") high_method_prefix("__")
 
+#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
+

Modified: trunk/GME/MgaUtil/StdAfx.h
==============================================================================
--- trunk/GME/MgaUtil/StdAfx.h	Fri Jul 22 15:52:24 2011	(r1425)
+++ trunk/GME/MgaUtil/StdAfx.h	Mon Jul 25 11:07:21 2011	(r1426)
@@ -16,6 +16,8 @@
 #define VC_EXTRALEAN            // Exclude rarely-used stuff from Windows headers
 #endif
 
+#define ISOLATION_AWARE_ENABLED 1
+
 #include "targetver.h"
 
 #define _CRT_SECURE_NO_WARNINGS
@@ -58,6 +60,8 @@
 extern CComModule _Module;
 #include <atlcom.h>
 
+#include <CommCtrl.h>
+
 #define wireHWND HWND
 
 #import "CoreLib.tlb" no_implementation auto_search no_namespace no_search_namespace raw_method_prefix("") high_method_prefix("__")

Modified: trunk/GME/MgaUtil/targetver.h
==============================================================================
--- trunk/GME/MgaUtil/targetver.h	Fri Jul 22 15:52:24 2011	(r1425)
+++ trunk/GME/MgaUtil/targetver.h	Mon Jul 25 11:07:21 2011	(r1426)
@@ -8,12 +8,12 @@
 
 // Modify the following defines if you have to target a platform prior to the ones specified below.
 // Refer to MSDN for the latest info on corresponding values for different platforms.
-#ifndef WINVER                          // Specifies that the minimum required platform is Windows 2000.
-#define WINVER 0x0500           // Change this to the appropriate value to target other versions of Windows.
+#ifndef WINVER                          // Specifies that the minimum required platform is Windows XP.
+#define WINVER 0x0501           // Change this to the appropriate value to target other versions of Windows.
 #endif
 
-#ifndef _WIN32_WINNT            // Specifies that the minimum required platform is Windows 2000.
-#define _WIN32_WINNT 0x0500     // Change this to the appropriate value to target other versions of Windows.
+#ifndef _WIN32_WINNT            // Specifies that the minimum required platform is Windows XP.
+#define _WIN32_WINNT 0x0501     // Change this to the appropriate value to target other versions of Windows.
 #endif
 
 #ifndef _WIN32_WINDOWS          // Specifies that the minimum required platform is Windows Me.

Modified: trunk/GME/Parser/MgaParser.cpp
==============================================================================
--- trunk/GME/Parser/MgaParser.cpp	Fri Jul 22 15:52:24 2011	(r1425)
+++ trunk/GME/Parser/MgaParser.cpp	Mon Jul 25 11:07:21 2011	(r1426)
@@ -419,7 +419,7 @@
 
 	++counter;
 
-	if( counter % 2000 == 0 )
+	if( counter % 1000 == 0 )
 	{
 		_stprintf_s(progress_msg, _T("Phase: %d, number of parsed objects: %ld"), pass_count, (long)counter/2);
 		COMTHROW( progress->SetLine(0, PutInBstr(progress_msg)) );
@@ -427,7 +427,7 @@
 		if( pass_count == 1 )
 			max_counter = counter + 10000;
 
-		COMTHROW( progress->SetProgress(counter, max_counter) );
+		COMTHROW( progress->SetProgress(counter, 0) );
 	}
 
 	if( skip_element_level > 0 )


More information about the gme-commit mailing list