[GME-commit] GMESRC/GME/ObjectInspector InPlaceManager.cpp,1.25,1.26 InPlaceManager.h,1.9,1.10

gme-commit at list.isis.vanderbilt.edu gme-commit at list.isis.vanderbilt.edu
Fri Feb 17 22:03:17 CST 2006


Update of /project/gme-repository/GMESRC/GME/ObjectInspector
In directory escher:/tmp/cvs-serv1667

Modified Files:
	InPlaceManager.cpp InPlaceManager.h 
Log Message:
GMEEditor subkey is considered also.


CVS User: Zoltan Molnar, ISIS (zolmol)

Index: InPlaceManager.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/ObjectInspector/InPlaceManager.cpp,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** InPlaceManager.cpp	10 Feb 2006 21:00:00 -0000	1.25
--- InPlaceManager.cpp	17 Feb 2006 22:03:14 -0000	1.26
***************
*** 364,368 ****
  			extension = ListItem.strContentType;
  		else // interpret it as MIME type (Content-Type), and lookup the extension corresponding to it
! 			content_type_valid = CInPlaceManager::findExt( ListItem.strContentType, extension);
  	
  		content_specific_editor = true;
--- 364,368 ----
  			extension = ListItem.strContentType;
  		else // interpret it as MIME type (Content-Type), and lookup the extension corresponding to it
! 			content_type_valid = CInPlaceManager::findInfoInMimeDB( ListItem.strContentType, szAppPath, extension);
  	
  		content_specific_editor = true;
***************
*** 404,414 ****
  	if( content_specific_editor)
  	{
! 		// success codes are strictly greater than 32
! 		int retcode = (int) ShellExecute( (HWND) m_EditorButton, "edit", szTempFileName, 0, 0, SW_SHOWNORMAL);
! 		if( retcode == SE_ERR_NOASSOC) // failed because no such verb (edit) exists for this extension
! 			retcode = (int) ShellExecute( (HWND) m_EditorButton, "open", szTempFileName, 0, 0, SW_SHOWNORMAL);
  
! 		launched = retcode > 32;
! 		// if it was not launched successfully, use the specified editor
  	}
  
--- 404,435 ----
  	if( content_specific_editor)
  	{
! 		if( !szAppPath.IsEmpty()) // GMEEditor value found in MimeDB
! 		{
! 			CString szCommandLine = " ";
! 			szCommandLine += szTempFileName;
! 			int nCommandLineLength = szCommandLine.GetLength();
  
! 			// startup info for the redactor's process is taken similar to that
! 			// of invoking application
! 			STARTUPINFO startUpInfo;
! 			PROCESS_INFORMATION processInfo;
! 			::GetStartupInfo(&startUpInfo);
! 
! 			// start pref'd editor with the file name as the command line parameter
! 			launched = ::CreateProcess(szAppPath,szCommandLine.GetBuffer(nCommandLineLength),
! 				NULL,NULL,FALSE,0,NULL,NULL,&startUpInfo,&processInfo);
! 			szCommandLine.ReleaseBuffer();
! 		}
! 
! 		if( !launched)
! 		{
! 			// success codes are strictly greater than 32
! 			int retcode = (int) ShellExecute( (HWND) m_EditorButton, "edit", szTempFileName, 0, 0, SW_SHOWNORMAL);
! 			if( retcode == SE_ERR_NOASSOC) // failed because no such verb (edit) exists for this extension
! 				retcode = (int) ShellExecute( (HWND) m_EditorButton, "open", szTempFileName, 0, 0, SW_SHOWNORMAL);
! 
! 			launched = retcode > 32;
! 			// if it was not launched successfully, use the specified editor
! 		}
  	}
  
***************
*** 726,734 ****
  }
  
! /*static*/ bool CInPlaceManager::findExt( const CString& pContentType, CString& pExtension)
  {
  	// mime types (content types) are enumerated under:
  	const TCHAR MIME_DB[] = _T("MIME\\Database\\Content Type\\");
  	const TCHAR EXTENSION_VALUE[] = _T("Extension");
  
  	CRegKey rk;
--- 747,756 ----
  }
  
! /*static*/ bool CInPlaceManager::findInfoInMimeDB( const CString& pContentType, CString& pPrefApp, CString& pExtension)
  {
  	// mime types (content types) are enumerated under:
  	const TCHAR MIME_DB[] = _T("MIME\\Database\\Content Type\\");
  	const TCHAR EXTENSION_VALUE[] = _T("Extension");
+ 	const TCHAR GMEEDITOR_VALUE[] = _T("GMEEditor"); // a developer might introduce here a GME specific value (by an installer)
  
  	CRegKey rk;
***************
*** 744,752 ****
  	res = rk.QueryStringValue( EXTENSION_VALUE, buff, &buff_len);
  	ext.ReleaseBufferSetLength( buff_len);
  	rk.Close();
  
! 	if( res != ERROR_SUCCESS) // it doesn't
! 		return false;
  
  	pExtension = ext;
  	return !pExtension.IsEmpty();
--- 766,784 ----
  	res = rk.QueryStringValue( EXTENSION_VALUE, buff, &buff_len);
  	ext.ReleaseBufferSetLength( buff_len);
+ 
+ 	if( res != ERROR_SUCCESS)
+ 		ext.Empty(); // will not return succesfully
+ 
+ 	buff_len = MAX_PATH;
+ 	CString pref_app(' ', buff_len);
+ 	buff = pref_app.GetBufferSetLength( buff_len);
+ 	res = rk.QueryStringValue( GMEEDITOR_VALUE, buff, &buff_len);
+ 	pref_app.ReleaseBufferSetLength( buff_len);
  	rk.Close();
  
! 	if( res != ERROR_SUCCESS)
! 		pref_app.Empty(); // this is not an error
  
+ 	pPrefApp = pref_app;
  	pExtension = ext;
  	return !pExtension.IsEmpty();

Index: InPlaceManager.h
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/ObjectInspector/InPlaceManager.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** InPlaceManager.h	10 Feb 2006 21:00:00 -0000	1.9
--- InPlaceManager.h	17 Feb 2006 22:03:14 -0000	1.10
***************
*** 57,61 ****
  	void HideEdit();
  
! 	static bool findExt( const CString& pContentType, CString& pExtension);
  	//implemented, but not used
  	//static bool findCommand( const CString& pExtension, CString& pEditCommand);
--- 57,61 ----
  	void HideEdit();
  
! 	static bool findInfoInMimeDB( const CString& pContentType, CString& pPrefApp, CString& pExtension);
  	//implemented, but not used
  	//static bool findCommand( const CString& pExtension, CString& pEditCommand);



More information about the GME-commit mailing list