// CommandBarsDesignerEditView.cpp // // (c)1998-2025 Codejock Software, All Rights Reserved. // // THIS SOURCE FILE IS THE PROPERTY OF CODEJOCK SOFTWARE AND IS NOT TO BE // RE-DISTRIBUTED BY ANY MEANS WHATSOEVER WITHOUT THE EXPRESSED WRITTEN // CONSENT OF CODEJOCK SOFTWARE. // // THIS SOURCE CODE CAN ONLY BE USED UNDER THE TERMS AND CONDITIONS OUTLINED // IN THE XTREME TOOLKIT PRO LICENSE AGREEMENT. CODEJOCK SOFTWARE GRANTS TO // YOU (ONE SOFTWARE DEVELOPER) THE LIMITED RIGHT TO USE THIS SOFTWARE ON A // SINGLE COMPUTER. // // CONTACT INFORMATION: // support@codejock.com // http://www.codejock.com // ///////////////////////////////////////////////////////////////////////////// #include "stdafx.h" #include "commandbarsdesigner.h" #include "CommandBarsDesignerEditView.h" #include "MainFrm.h" #ifdef _DEBUG # define new DEBUG_NEW # undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CCommandBarsDesignerEditView IMPLEMENT_DYNCREATE(CCommandBarsDesignerEditView, CEditViewBase) CCommandBarsDesignerEditView::CCommandBarsDesignerEditView() { } CCommandBarsDesignerEditView::~CCommandBarsDesignerEditView() { } BEGIN_MESSAGE_MAP(CCommandBarsDesignerEditView, CEditViewBase) //{{AFX_MSG_MAP(CCommandBarsDesignerEditView) // NOTE - the ClassWizard will add and remove mapping macros here. //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CCommandBarsDesignerEditView drawing void CCommandBarsDesignerEditView::OnDraw(CDC*) { } void CCommandBarsDesignerEditView::OnActivateView(BOOL bActivate, CView* pActivateView, CView* pDeactiveView) { CEditViewBase::OnActivateView(bActivate, pActivateView, pDeactiveView); ((CMainFrame*)AfxGetMainWnd())->RefreshPanes(); if (bActivate) { RefreshColors(); } } void CCommandBarsDesignerEditView::RefreshColors() { UINT nTheme = ((CMainFrame*)AfxGetMainWnd())->m_nTheme; CString sIni = _T("EditConfig\\SyntaxEdit.ini"); CString sSchema = _T("EditConfig\\Schemas\\_XAML.schclass"); COLORREF clrBackColor; COLORREF clrLineNumberBackColor; COLORREF clrLineNumberTextColor; switch (nTheme) { case ID_COLORFUL_ACCESS: case ID_COLORFUL_EXEL: case ID_COLORFUL_ONENOTE: case ID_COLORFUL_OUTLOOK: case ID_COLORFUL_POWERPOINT: case ID_COLORFUL_PUBLISHER: case ID_COLORFUL_WORD: case ID_WHITE_ACCESS: case ID_WHITE_EXEL: case ID_WHITE_ONENOTE: case ID_WHITE_OUTLOOK: case ID_WHITE_POWERPOINT: case ID_WHITE_PUBLISHER: case ID_WHITE_WORD: case ID_DARKGRAY_ACCESS: case ID_DARKGRAY_EXEL: case ID_DARKGRAY_ONENOTE: case ID_DARKGRAY_OUTLOOK: case ID_DARKGRAY_POWERPOINT: case ID_DARKGRAY_PUBLISHER: case ID_DARKGRAY_WORD: clrBackColor = RGB(246, 246, 246); clrLineNumberBackColor = RGB(246, 246, 246); clrLineNumberTextColor = RGB(43, 145, 175); break; case ID_BLACK_ACCESS: case ID_BLACK_EXEL: case ID_BLACK_ONENOTE: case ID_BLACK_OUTLOOK: case ID_BLACK_POWERPOINT: case ID_BLACK_PUBLISHER: case ID_BLACK_WORD: clrBackColor = RGB(28, 28, 28); clrLineNumberBackColor = RGB(28, 28, 28); clrLineNumberTextColor = RGB(86, 156, 214); break; default: clrBackColor = RGB(255, 255, 255); clrLineNumberBackColor = RGB(255, 255, 255); clrLineNumberTextColor = RGB(43, 145, 175); break; } GetEditCtrl().GetPaintManager()->SetBackColor(clrBackColor, FALSE); GetEditCtrl().GetPaintManager()->SetLineNumberBackColor(clrLineNumberBackColor, FALSE); GetEditCtrl().GetPaintManager()->SetLineNumberTextColor(clrLineNumberTextColor, FALSE); GetEditCtrl().SetSelMargin(FALSE); if (GetEditCtrl().GetEditBuffer()) GetEditCtrl().GetEditBuffer()->SetFileExt(_T(".XAML")); GetEditCtrl().SetConfigFile(CXTPSyntaxEditCtrl::GetModulePath() + sIni, TRUE); { CStdioFile file; CString strLine; CString strINI; CString strSchema; if (file.Open(CXTPSyntaxEditCtrl::GetModulePath() + sIni, CFile::modeRead)) { while (file.ReadString(strLine)) { strINI += strLine + _T("\r\n"); } file.Close(); } else { AfxMessageBox(_T("Could not load file")); } strLine = _T(""); strSchema = _T(""); if (file.Open(CXTPSyntaxEditCtrl::GetModulePath() + sSchema, CFile::modeRead)) { while (file.ReadString(strLine)) { strSchema += strLine + _T("\r\n"); } file.Close(); } else { AfxMessageBox(_T("Could not load file")); } GetEditCtrl().SetSyntaxAndColorScheme(strSchema, strINI, FALSE, FALSE); } } ///////////////////////////////////////////////////////////////////////////// // CCommandBarsDesignerEditView diagnostics #ifdef _DEBUG void CCommandBarsDesignerEditView::AssertValid() const { CEditViewBase::AssertValid(); } void CCommandBarsDesignerEditView::Dump(CDumpContext& dc) const { CEditViewBase::Dump(dc); } #endif //_DEBUG ///////////////////////////////////////////////////////////////////////////// // CCommandBarsDesignerEditView message handlers void CCommandBarsDesignerEditView::OnInitialUpdate() { CEditViewBase::OnInitialUpdate(); if (m_fnt.GetSafeHandle() == 0) { CXTPNonClientMetrics ncm; STRCPY_S(ncm.lfMenuFont.lfFaceName, LF_FACESIZE, _T("Courier")); m_fnt.CreateFontIndirect(&ncm.lfMenuFont); SetFont(&m_fnt); } }