From: Leon W. <moo...@us...> - 2005-04-05 08:20:31
|
Update of /cvsroot/anyedit/AnyEditv2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2447 Modified Files: AnyEdit.cpp AnyEdit.rc MainFrm.cpp MainFrm.h resource.h Log Message: - Added Language Menu, to change the Syntax Highlighting language of the current document. Index: AnyEdit.cpp =================================================================== RCS file: /cvsroot/anyedit/AnyEditv2/AnyEdit.cpp,v retrieving revision 1.109 retrieving revision 1.110 diff -C2 -d -r1.109 -r1.110 *** AnyEdit.cpp 24 Mar 2005 09:22:31 -0000 1.109 --- AnyEdit.cpp 5 Apr 2005 08:20:17 -0000 1.110 *************** *** 72,76 **** #endif ! #define SETTINGS_VERSION_NUM 5 #define STARTUP_PAGE_FILENAME "StartPage\\home.htm" --- 72,76 ---- #endif ! #define SETTINGS_VERSION_NUM 6 #define STARTUP_PAGE_FILENAME "StartPage\\home.htm" Index: AnyEdit.rc =================================================================== RCS file: /cvsroot/anyedit/AnyEditv2/AnyEdit.rc,v retrieving revision 1.114 retrieving revision 1.115 diff -C2 -d -r1.114 -r1.115 *** AnyEdit.rc 9 Feb 2005 21:15:10 -0000 1.114 --- AnyEdit.rc 5 Apr 2005 08:20:18 -0000 1.115 *************** *** 410,413 **** --- 410,417 ---- ID_SEARCH_CLEARALLBOOKMARKS END + POPUP "&Language" + BEGIN + MENUITEM "Dummy", ID_MENU_LANGUAGE + END POPUP "&Tools" BEGIN *************** *** 2040,2044 **** STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Quick Jump" ! FONT 8, "MS Sans Serif" BEGIN GROUPBOX "Choose Location",IDC_STATIC,7,7,294,64 --- 2044,2048 ---- STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Quick Jump" ! FONT 8, "MS Sans Serif", 0, 0, 0x1 BEGIN GROUPBOX "Choose Location",IDC_STATIC,7,7,294,64 Index: resource.h =================================================================== RCS file: /cvsroot/anyedit/AnyEditv2/resource.h,v retrieving revision 1.74 retrieving revision 1.75 diff -C2 -d -r1.74 -r1.75 *** resource.h 1 Feb 2005 07:03:03 -0000 1.74 --- resource.h 5 Apr 2005 08:20:21 -0000 1.75 *************** *** 651,657 **** #define ID_CLASSVIEW_UPDATE 33042 #define ID_EDIT_LAST 59999 // Next default values for new objects ! // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS --- 651,658 ---- #define ID_CLASSVIEW_UPDATE 33042 #define ID_EDIT_LAST 59999 + #define ID_MENU_LANGUAGE 60000 // Next default values for new objects ! // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS Index: MainFrm.cpp =================================================================== RCS file: /cvsroot/anyedit/AnyEditv2/MainFrm.cpp,v retrieving revision 1.77 retrieving revision 1.78 diff -C2 -d -r1.77 -r1.78 *** MainFrm.cpp 24 Mar 2005 09:12:55 -0000 1.77 --- MainFrm.cpp 5 Apr 2005 08:20:20 -0000 1.78 *************** *** 46,49 **** --- 46,50 ---- #include "CreateTagThread.h" #include "DocIter.h" + #include "ConfigFile.h" #ifdef _DEBUG *************** *** 110,113 **** --- 111,116 ---- ON_COMMAND_EX_RANGE(ID_USER_TOOL1, ID_USER_TOOL10, OnSelectedUserTools) ON_UPDATE_COMMAND_UI_RANGE(ID_USER_TOOL1, ID_USER_TOOL10, OnUpdateUserTools) + ON_COMMAND_EX_RANGE(ID_MENU_LANGUAGE, ID_MENU_LANGUAGE + 20, OnMenuLanguage) + ON_UPDATE_COMMAND_UI_RANGE(ID_MENU_LANGUAGE, ID_MENU_LANGUAGE + 20, OnUpdateMenuLanguage) ON_COMMAND_EX_RANGE(50000, 55000, OnSelectedPluginMenu) ON_REGISTERED_MESSAGE(BCGM_CUSTOMIZEHELP, OnHelpCustomizeToolbars) *************** *** 336,339 **** --- 339,354 ---- } + if (pMenuPopup->GetMenuBar()->CommandToIndex(ID_MENU_LANGUAGE) >= 0 ) + { + if (CBCGToolBar::IsCustomizeMode ()) + { + return FALSE; + } + + pMenuPopup->RemoveAllItems(); + + LoadLanguageMenu( pMenuPopup ); + } + if (pMenuPopup->GetMenuBar ()->CommandToIndex (ID_VIEW_TOOLBARS) >= 0) { *************** *** 462,465 **** --- 477,516 ---- } + void CMainFrame::LoadLanguageMenu(CBCGPopupMenu *popUp) + { + CMenu menu; + int iCount; + int iNrOfLanguages; + int iActiveLanguage; + + if( !menu.CreateMenu() ) return; + + CConfigFile* pConfigFile = theApp.GetConfigFile(); + ASSERT(pConfigFile != NULL); + + iActiveLanguage = -1; + CMDIChildWnd* pActiveChild = MDIGetActive(); + if(pActiveChild) + { + CView* pActiveView = pActiveChild->GetActiveView(); + if ( (pActiveView) && (pActiveView->IsKindOf(RUNTIME_CLASS(CAnyEditView))) ) + { + CAnyEditDoc* pDocument = (CAnyEditDoc*)pActiveView->GetDocument(); + ASSERT(pDocument != NULL); + iActiveLanguage = pDocument->GetLanguageNr(); + } + } + + iNrOfLanguages = pConfigFile->GetLanguageCount(); + for( iCount = 0; iCount < iNrOfLanguages; ++ iCount ) + { + UINT nFlags; + nFlags = MF_STRING | MF_ENABLED; + if( iCount == iActiveLanguage ) nFlags |= MF_CHECKED; + menu.AppendMenu( nFlags, ID_MENU_LANGUAGE + iCount, pConfigFile->GetLanguageName( iCount ) ); + } + popUp->GetMenuBar ()->ImportFromMenu(menu, TRUE); + } + BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) { *************** *** 845,849 **** if( id < 0 || id > 9 || 0 == uiaUserTools[id] ) return FALSE; trToolRunner.ExecuteTool( uiaUserTools[id], &m_wndOutputBar ); ! return TRUE; } --- 896,900 ---- if( id < 0 || id > 9 || 0 == uiaUserTools[id] ) return FALSE; trToolRunner.ExecuteTool( uiaUserTools[id], &m_wndOutputBar ); ! return TRUE; } *************** *** 989,996 **** theApp.GetWorkspace()->GetCurrentProject()->GetFileSet(setFiles); ! std::string sFilename; for (STRSET::const_iterator i = setFiles.begin(); i != setFiles.end(); i++) { ! sFilename = (*i); arFiles.Add(sFilename.c_str()); } --- 1040,1047 ---- theApp.GetWorkspace()->GetCurrentProject()->GetFileSet(setFiles); ! std::string sFilename; for (STRSET::const_iterator i = setFiles.begin(); i != setFiles.end(); i++) { ! sFilename = (*i); arFiles.Add(sFilename.c_str()); } *************** *** 1007,1014 **** theApp.GetWorkspace()->GetFileSet(setFiles); ! std::string sFilename; for (STRSET::const_iterator i = setFiles.begin(); i != setFiles.end(); i++) { ! sFilename = (*i); arFiles.Add(sFilename.c_str()); } --- 1058,1065 ---- theApp.GetWorkspace()->GetFileSet(setFiles); ! std::string sFilename; for (STRSET::const_iterator i = setFiles.begin(); i != setFiles.end(); i++) { ! sFilename = (*i); arFiles.Add(sFilename.c_str()); } *************** *** 1030,1034 **** // run grep m_bFindInFilesContinue = true; ! m_bCanGrep = !m_fileGrep.Grep( this, /*this,*/ pMgr->GetFindString(), pMgr->GetFileTypes(), pArrFilesOrFolder, dwFlags ); --- 1081,1085 ---- // run grep m_bFindInFilesContinue = true; ! m_bCanGrep = !m_fileGrep.Grep( this, /*this,*/ pMgr->GetFindString(), pMgr->GetFileTypes(), pArrFilesOrFolder, dwFlags ); *************** *** 1308,1312 **** } ! BOOL CMainFrame::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo) { if (m_bInCmdMsg) --- 1359,1363 ---- } ! BOOL CMainFrame::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo) { if (m_bInCmdMsg) *************** *** 1345,1349 **** /// Close all open documents ! void CMainFrame::OnFileCloseAll() { OnWindowCloseAll(); --- 1396,1400 ---- /// Close all open documents ! void CMainFrame::OnFileCloseAll() { OnWindowCloseAll(); *************** *** 1407,1416 **** /// When grep is working the button is pushed. So you can stop grep. ! void CMainFrame::OnUpdateSearchFindfiles(CCmdUI* pCmdUI) { pCmdUI->SetCheck( m_bCanGrep ? 0 : 1); } ! /// Grep calls this function to interrupt the search. bool CMainFrame::CanContinueSearch() { --- 1458,1467 ---- /// When grep is working the button is pushed. So you can stop grep. ! void CMainFrame::OnUpdateSearchFindfiles(CCmdUI* pCmdUI) { pCmdUI->SetCheck( m_bCanGrep ? 0 : 1); } ! /// Grep calls this function to interrupt the search. bool CMainFrame::CanContinueSearch() { *************** *** 1434,1438 **** } ! void CMainFrame::OnSyncFileView() { m_bSyncFileView = !m_bSyncFileView; --- 1485,1489 ---- } ! void CMainFrame::OnSyncFileView() { m_bSyncFileView = !m_bSyncFileView; *************** *** 1440,1449 **** } ! void CMainFrame::OnUpdateSyncFileView(CCmdUI* pCmdUI) { pCmdUI->SetCheck( m_bSyncFileView ? TRUE : FALSE ); } ! BOOL CMainFrame::OnCommand(WPARAM wParam, LPARAM lParam) { if (m_bInCommand) --- 1491,1500 ---- } ! void CMainFrame::OnUpdateSyncFileView(CCmdUI* pCmdUI) { pCmdUI->SetCheck( m_bSyncFileView ? TRUE : FALSE ); } ! BOOL CMainFrame::OnCommand(WPARAM wParam, LPARAM lParam) { if (m_bInCommand) *************** *** 1476,1477 **** --- 1527,1549 ---- return CBCGMDIFrameWnd::OnCommand(wParam, lParam); } + + void CMainFrame::OnMenuLanguage(UINT uiId) + { + CMDIChildWnd* pActiveChild = MDIGetActive(); + if(pActiveChild) + { + CView* pActiveView = pActiveChild->GetActiveView(); + if ( (pActiveView) && (pActiveView->IsKindOf(RUNTIME_CLASS(CAnyEditView))) ) + { + CAnyEditDoc* pDocument = (CAnyEditDoc*)pActiveView->GetDocument(); + ASSERT(pDocument != NULL); + pDocument->SetLanguageNr( uiId - ID_MENU_LANGUAGE ); + } + } + + } + + void CMainFrame::OnUpdateMenuLanguage(CCmdUI* pCmdUI) + { + pCmdUI->Enable(); + } Index: MainFrm.h =================================================================== RCS file: /cvsroot/anyedit/AnyEditv2/MainFrm.h,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** MainFrm.h 29 Jan 2005 17:55:12 -0000 1.50 --- MainFrm.h 5 Apr 2005 08:20:21 -0000 1.51 *************** *** 32,35 **** --- 32,36 ---- void LoadToolMenus(CMenu &popUp); void LoadRecentMenus(CMenu &popUp); + void LoadLanguageMenu(CBCGPopupMenu *popUp); // Attributes *************** *** 182,185 **** --- 183,188 ---- afx_msg void OnSyncFileView(); afx_msg void OnUpdateSyncFileView(CCmdUI* pCmdUI); + afx_msg void OnMenuLanguage(UINT uiId); + afx_msg void OnUpdateMenuLanguage(CCmdUI* pCmdUI); //}}AFX_MSG void OnNewTemplate (UINT id); |