From: Leon W. <moo...@us...> - 2005-04-11 06:56:22
|
Update of /cvsroot/anyedit/AnyEditv2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1077 Modified Files: FileTypeManager.cpp FileTypeManager.h Log Message: - SyntaxFiles are parsed in a seperate thead. This improves speed at a memory penalty. Index: FileTypeManager.h =================================================================== RCS file: /cvsroot/anyedit/AnyEditv2/FileTypeManager.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** FileTypeManager.h 31 Jan 2005 22:54:03 -0000 1.9 --- FileTypeManager.h 11 Apr 2005 06:56:12 -0000 1.10 *************** *** 105,108 **** --- 105,109 ---- /// Set properties for a given langugage to a scintilla control. void SetScintillaProperties(int iLanguage, CScintillaEx* pScintilla, BOOL bSyntaxHighlighting); + protected: /// Last selected file filter. *************** *** 129,132 **** --- 130,139 ---- /// Fill the map with extensions and language numbers void FillExtensionMap(CConfigFile *conf); + + /// ThreadProc function to Parse all the Syntax Files, will be called by RunThread + UINT ParseSyntaxFilesThreadProc(); + + /// Static thread function to Parse the Syntax Files in the background + static UINT RunThread( LPVOID pParam ) { return ((CFileTypeManager*)pParam)->ParseSyntaxFilesThreadProc(); } }; Index: FileTypeManager.cpp =================================================================== RCS file: /cvsroot/anyedit/AnyEditv2/FileTypeManager.cpp,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** FileTypeManager.cpp 11 Apr 2005 06:47:47 -0000 1.27 --- FileTypeManager.cpp 11 Apr 2005 06:56:12 -0000 1.28 *************** *** 247,250 **** --- 247,270 ---- FillLanguageNames(conf); LoadSyntaxFiles(conf); + + // Let's parse all the Syntax Files in the background if we have the time + AfxBeginThread( RunThread, (LPVOID)this, THREAD_PRIORITY_LOWEST ); + } + + UINT CFileTypeManager::ParseSyntaxFilesThreadProc() + { + int iLanguageNr; + POSITION pos; + CSyntaxFile* pSyntaxFile; + + // Walk the Syntax File objects + pos = m_mapSyntaxFiles.GetStartPosition(); + while( NULL != pos ) + { + m_mapSyntaxFiles.GetNextAssoc( pos, iLanguageNr, pSyntaxFile ); + if( NULL != pSyntaxFile ) pSyntaxFile->Parse(); + } + + return 0; } |