Update of /cvsroot/anyedit/AnyEditv2 In directory sc8-pr-cvs1:/tmp/cvs-serv1510 Modified Files: AnyEdit.cpp AnyEdit.h AnyEditDoc.cpp AnyEditDoc.h AnyEditView.cpp ClassView.cpp Language.cpp Log Message: Design fixes done as suggested by Leon Index: AnyEdit.cpp =================================================================== RCS file: /cvsroot/anyedit/AnyEditv2/AnyEdit.cpp,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** AnyEdit.cpp 11 Aug 2003 17:21:49 -0000 1.30 --- AnyEdit.cpp 20 Nov 2003 15:47:49 -0000 1.31 *************** *** 1041,1044 **** --- 1041,1061 ---- } + CLanguage * CAnyEditApp::GetLanguage(CString ext) + { + + CString pos; + extmap.Lookup(ext,pos); + if(pos.IsEmpty()) + return NULL; + + CObject * lang=NULL; + langmap.Lookup(pos,lang); + if(lang==NULL) + lang = LoadLanguage(pos); + + return (CLanguage *)lang; + + } + CString CAnyEditApp::SetScintillaLanguage(CString ext, CScintilla *scintilla) { *************** *** 1056,1067 **** { ((CLanguage *)lang)->FillUpScintilla(scintilla); ! return pos; } if(lang==NULL) return pos; ! CLanguage * reallang = (CLanguage *)lang; ! reallang->FillUpScintilla(scintilla); ! return pos; } --- 1073,1083 ---- { ((CLanguage *)lang)->FillUpScintilla(scintilla); ! return pos; } if(lang==NULL) return pos; ! ! ((CLanguage *)lang)->FillUpScintilla(scintilla); return pos; } *************** *** 1112,1151 **** - void CAnyEditApp::GetListWords(CString ext, CString &result) - { - CString pos; - extmap.Lookup(ext,pos); - if(pos.IsEmpty()) - return; - - CObject * lang=NULL; - langmap.Lookup(pos,lang); - if(lang==NULL) - return; - else - { - ((CLanguage *)lang)->GetListWords(result); - } - - } - - BOOL CAnyEditApp::GetAcmpValueToArray(LPCSTR ext,LPCSTR val, CStringArray &arr) - { - - CString pos; - extmap.Lookup(ext,pos); - if(pos.IsEmpty()) - return FALSE; - - CObject * lang=NULL; - langmap.Lookup(pos,lang); - if(lang==NULL) - return FALSE; - else - { - return ((CLanguage *)lang)->GetValueToArray(val,arr); - } - } - void CAnyEditApp::OnFileNew() { --- 1128,1131 ---- *************** *** 1265,1284 **** } - BOOL CAnyEditApp::GetAcmpWordList(LPCSTR ext, CStringArray &arr) - { - CString pos; - extmap.Lookup(ext,pos); - if(pos.IsEmpty()) - return FALSE; - - CObject * lang=NULL; - langmap.Lookup(pos,lang); - if(lang==NULL) - return FALSE; - else - { - return ((CLanguage *)lang)->GetAcmpWordList(arr); - } - } CString CAnyEditApp::GetCurrentProject() --- 1245,1248 ---- Index: AnyEdit.h =================================================================== RCS file: /cvsroot/anyedit/AnyEditv2/AnyEdit.h,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** AnyEdit.h 18 Nov 2003 11:27:21 -0000 1.26 --- AnyEdit.h 20 Nov 2003 15:47:49 -0000 1.27 *************** *** 48,52 **** CString GetCurrentWorkspace(); CString GetCurrentProject(); - BOOL GetAcmpWordList(LPCSTR ext,CStringArray &arr); BOOL CanStartParserThread(); void RefreshParserThread(CWinThread* pNewThread); --- 48,51 ---- *************** *** 55,61 **** void OpenPreferences(); void OpenBrowserWindow(CString url); - void GetListWords(CString ext,CString &result); CObject * LoadLanguage(CString langpos); ! CString SetScintillaLanguage(CString ext,CScintilla * scintilla); void LoadLanguageExtensions(); void ApplyOtherDefaults(CScintilla * scintilla); --- 54,60 ---- void OpenPreferences(); void OpenBrowserWindow(CString url); CObject * LoadLanguage(CString langpos); ! CString SetScintillaLanguage(CString ext, CScintilla *scintilla); ! CLanguage * GetLanguage(CString ext); void LoadLanguageExtensions(); void ApplyOtherDefaults(CScintilla * scintilla); *************** *** 96,100 **** void ResetClassView(LPCSTR str,BOOL parseForProject); CString GetCompFilePathFromLang(LPCSTR lang); - BOOL GetAcmpValueToArray(LPCSTR ext,LPCSTR val, CStringArray &arr); BOOL LockTagList(); void UnlockTagList(); --- 95,98 ---- Index: AnyEditDoc.cpp =================================================================== RCS file: /cvsroot/anyedit/AnyEditv2/AnyEditDoc.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** AnyEditDoc.cpp 6 Jul 2003 18:49:47 -0000 1.10 --- AnyEditDoc.cpp 20 Nov 2003 15:47:49 -0000 1.11 *************** *** 33,36 **** --- 33,37 ---- { // TODO: add one-time construction code here + m_pDocLang = NULL; } *************** *** 206,208 **** --- 207,237 ---- ; //just in case return bResult; //if I return false then I should call disable parsing! + } + + void CAnyEditDoc::SetDocScintilla(CScintilla * m_pscin) + { + m_pScintilla = m_pscin; + } + + void CAnyEditDoc::SetDocLanguage(CLanguage * m_plang) + { + m_pDocLang = m_plang; + } + + void CAnyEditDoc::GetListWords(CString &result) + { + if(m_pDocLang==NULL) return; + m_pDocLang->GetListWords(result); + } + + BOOL CAnyEditDoc::GetAcmpValueToArray(LPCSTR val, CStringArray &arr) + { + if(m_pDocLang==NULL) return FALSE; + return m_pDocLang->GetValueToArray(val,arr); + } + + BOOL CAnyEditDoc::GetAcmpWordList(CStringArray &arr) + { + if(m_pDocLang==NULL) return FALSE; + return m_pDocLang->GetAcmpWordList(arr); } Index: AnyEditDoc.h =================================================================== RCS file: /cvsroot/anyedit/AnyEditv2/AnyEditDoc.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** AnyEditDoc.h 8 May 2003 12:00:56 -0000 1.6 --- AnyEditDoc.h 20 Nov 2003 15:47:49 -0000 1.7 *************** *** 10,13 **** --- 10,14 ---- #endif // _MSC_VER > 1000 #include "scintillaif.h" + #include "Language.h" class CAnyEditDoc : public CDocument *************** *** 18,24 **** // Attributes ! public: CScintilla * m_pScintilla; CString doc_file_path; // Operations public: --- 19,26 ---- // Attributes ! protected: CScintilla * m_pScintilla; CString doc_file_path; + CLanguage * m_pDocLang; // Operations public: *************** *** 37,43 **** --- 39,50 ---- // Implementation public: + BOOL GetAcmpWordList(CStringArray &arr); + BOOL GetAcmpValueToArray(LPCSTR val, CStringArray &arr); + void GetListWords(CString &result); BOOL SaveTempCopy(CString tempPath); void ReloadDefaults(); void HasBeenModified(BOOL modified); + void SetDocScintilla(CScintilla * m_pscin); + void SetDocLanguage(CLanguage * m_plang); virtual ~CAnyEditDoc(); #ifdef _DEBUG Index: AnyEditView.cpp =================================================================== RCS file: /cvsroot/anyedit/AnyEditv2/AnyEditView.cpp,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** AnyEditView.cpp 18 Nov 2003 11:27:22 -0000 1.33 --- AnyEditView.cpp 20 Nov 2003 15:47:49 -0000 1.34 *************** *** 11,15 **** #include "FindReplace.h" #include "Goto.h" ! #ifdef _DEBUG --- 11,15 ---- #include "FindReplace.h" #include "Goto.h" ! #include "Language.h" #ifdef _DEBUG *************** *** 246,250 **** CAnyEditDoc* pDoc = GetDocument(); ! pDoc->m_pScintilla=&m_Scintilla; #ifndef DEBUG --- 246,250 ---- CAnyEditDoc* pDoc = GetDocument(); ! pDoc->SetDocScintilla(&m_Scintilla); #ifndef DEBUG *************** *** 681,685 **** --- 681,691 ---- docname = msc.GetFileExtension(docname); DocExt = docname; + CLanguage * m_pLanguage = NULL; CString tst = theApp.SetScintillaLanguage(docname,&m_Scintilla); + m_pLanguage = theApp.GetLanguage(docname); + if(m_pLanguage!=NULL) + { + GetDocument()->SetDocLanguage(m_pLanguage); + } docname = theApp.GetCompFilePathFromLang(tst); SetAccessTime(); *************** *** 791,795 **** //Next Get Nearest words from word list for document type... CString lwords; ! theApp.GetListWords(DocExt,lwords); CStringArray extwords; --- 797,801 ---- //Next Get Nearest words from word list for document type... CString lwords; ! GetDocument()->GetListWords(lwords); CStringArray extwords; *************** *** 1639,1643 **** const char *root = linebuf + startword; CStringArray arr; ! if(theApp.GetAcmpValueToArray(DocExt,root,arr)) { int delen = strlen(root); --- 1645,1649 ---- const char *root = linebuf + startword; CStringArray arr; ! if(GetDocument()->GetAcmpValueToArray(root,arr)) { int delen = strlen(root); *************** *** 1654,1658 **** { CStringArray arr; ! BOOL b = theApp.GetAcmpWordList(DocExt,arr); if(b) { --- 1660,1664 ---- { CStringArray arr; ! BOOL b = GetDocument()->GetAcmpWordList(arr); if(b) { *************** *** 1672,1676 **** { CStringArray arr; ! if(theApp.GetAcmpValueToArray(DocExt,fup,arr)) { InsertStringArray(arr); --- 1678,1682 ---- { CStringArray arr; ! if(GetDocument()->GetAcmpValueToArray(fup,arr)) { InsertStringArray(arr); Index: ClassView.cpp =================================================================== RCS file: /cvsroot/anyedit/AnyEditv2/ClassView.cpp,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** ClassView.cpp 19 Nov 2003 08:41:56 -0000 1.21 --- ClassView.cpp 20 Nov 2003 15:47:49 -0000 1.22 *************** *** 900,903 **** --- 900,905 ---- case 'g': GETPARENTCATEGORY("Enumerations"); + case 'e': + GETPARENTCATEGORY("Enumerations"); case 'd': GETPARENTCATEGORY("Macros"); Index: Language.cpp =================================================================== RCS file: /cvsroot/anyedit/AnyEditv2/Language.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Language.cpp 27 Aug 2003 06:32:42 -0000 1.9 --- Language.cpp 20 Nov 2003 15:47:49 -0000 1.10 *************** *** 214,218 **** void CLanguage::GetListWords(CString &lwords) { ! lwords = listwords; } --- 214,220 ---- void CLanguage::GetListWords(CString &lwords) { ! //A problem exists with CString thus doing it this way instead of lwords = listwords! ! CString tempstr(listwords.GetBuffer(listwords.GetLength())); ! lwords = tempstr; } |