Ejemplo n.º 1
0
//***********************************************************************************************
BOOL CBCGPUserToolsManager::LoadState (LPCTSTR lpszProfileName)
{
	CString strProfileName = ::BCGPGetRegPath (strUserToolsProfile, lpszProfileName);

	while (!m_lstUserTools.IsEmpty ())
	{
		delete m_lstUserTools.RemoveHead ();
	}

	CBCGPRegistrySP regSP;
	CBCGPRegistry& reg = regSP.Create (FALSE, FALSE);

	if (!reg.Open (strProfileName))
	{
		return FALSE;
	}

	if (!reg.Read (strUserToolsEntry, m_lstUserTools))
	{
		//---------------------------------------------------------
		// Tools objects may be corrupted, so, I don't delete them.
		// Memory leak is possible!
		//---------------------------------------------------------
		m_lstUserTools.RemoveAll ();
		return FALSE;
	}

	return TRUE;
}
//************************************************************************************************
BOOL CBCGPMouseManager::LoadState (LPCTSTR lpszProfileName)
{
	CString strProfileName = ::BCGPGetRegPath (strMouseProfile, lpszProfileName);

	BOOL bResult = FALSE;

	LPBYTE	lpbData = NULL;
	UINT	uiDataSize;

	CBCGPRegistrySP regSP;
	CBCGPRegistry& reg = regSP.Create (FALSE, TRUE);
	
	if (!reg.Open (strProfileName))
	{
		TRACE(_T("CBCGPMouseManager::LoadState: Can't open registry %s!\n"), strProfileName);
		return FALSE;
	}

	if (!reg.Read (strRegEntryName, &lpbData, &uiDataSize))
	{
		TRACE(_T("CBCGPMouseManager::LoadState: Can't load registry data %s!\n"), strProfileName);
		return FALSE;
	}

	try
	{
		CMemFile file (lpbData, uiDataSize);
		CArchive ar (&file, CArchive::load);

		Serialize (ar);
		bResult = TRUE;
	}
	catch (CMemoryException* pEx)
	{
		pEx->Delete ();
		TRACE(_T("Memory exception in CBCGPMouseManager::LoadState ()!\n"));
	}
	catch (CArchiveException* pEx)
	{
		pEx->Delete ();
		TRACE(_T("CArchiveException exception in CBCGPMouseManager::LoadState ()!\n"));
	}

	if (lpbData != NULL)
	{
		delete [] lpbData;
	}

	return bResult;
}
Ejemplo n.º 3
0
//***********************************************************************************************
BOOL CBCGPUserToolsManager::SaveState (LPCTSTR lpszProfileName)
{
	CString strProfileName = ::BCGPGetRegPath (strUserToolsProfile, lpszProfileName);

	CBCGPRegistrySP regSP;
	CBCGPRegistry& reg = regSP.Create (FALSE, FALSE);

	if (!reg.CreateKey (strProfileName))
	{
		return FALSE;
	}

	return reg.Write (strUserToolsEntry, m_lstUserTools);
}
//************************************************************************************************
BOOL CBCGPMouseManager::SaveState (LPCTSTR lpszProfileName)
{
	CString strProfileName = ::BCGPGetRegPath (strMouseProfile, lpszProfileName);

	BOOL bResult = FALSE;

	try
	{
		CMemFile file;

		{
			CArchive ar (&file, CArchive::store);

			Serialize (ar);
			ar.Flush ();
		}

		UINT uiDataSize = (UINT) file.GetLength ();
		LPBYTE lpbData = file.Detach ();

		if (lpbData != NULL)
		{
			CBCGPRegistrySP regSP;
			CBCGPRegistry& reg = regSP.Create (FALSE, FALSE);

			if (reg.CreateKey (strProfileName))
			{
				bResult = reg.Write (strRegEntryName, lpbData, uiDataSize);
			}

			free (lpbData);
		}
	}
	catch (CMemoryException* pEx)
	{
		pEx->Delete ();
		TRACE(_T("Memory exception in CBCGPMouseManager::SaveState ()!\n"));
	}
	catch (CArchiveException* pEx)
	{
		pEx->Delete ();
		TRACE(_T("CArchiveException exception in CBCGPMouseManager::SaveState ()!\n"));
	}

	return bResult;
}
//*************************************************************************************
BOOL CBCGPCommandManager::SaveState (LPCTSTR lpszProfileName)
{
	CString strProfileName = ::BCGPGetRegPath (strToolbarProfile, lpszProfileName);

	CString strSection;
	strSection.Format (REG_PARAMS_FMT, strProfileName);

	CBCGPRegistrySP regSP;
	CBCGPRegistry& reg = regSP.Create (FALSE, FALSE);

	if (reg.CreateKey (strSection))
	{
		return	reg.Write (REG_ENTRY_COMMANDS_WITHOUT_IMAGES, m_lstCommandsWithoutImages) &&
				reg.Write (REG_ENTRY_MENU_USER_IMAGES, m_mapMenuUserImages);
	}

	return FALSE;
}
//*************************************************************************************
BOOL CBCGPCommandManager::LoadState (LPCTSTR lpszProfileName)
{
	CString strProfileName = ::BCGPGetRegPath (strToolbarProfile, lpszProfileName);

	CString strSection;
	strSection.Format (REG_PARAMS_FMT, strProfileName);

	CBCGPRegistrySP regSP;
	CBCGPRegistry& reg = regSP.Create (FALSE, TRUE);

	if (!reg.Open (strSection))
	{
		return FALSE;
	}

	m_lstCommandsWithoutImages.RemoveAll ();

	return	reg.Read (REG_ENTRY_COMMANDS_WITHOUT_IMAGES, m_lstCommandsWithoutImages) &&
			reg.Read (REG_ENTRY_MENU_USER_IMAGES, m_mapMenuUserImages);
}
Ejemplo n.º 7
0
//*************************************************************************************
void CBCGPKeyMapDlg::OnDestroy() 
{
	//----------------------------------
	// Save window position and size:
	//----------------------------------
	if (GetWorkspace () != NULL)
	{
		CRect rectPosition;
		GetWindowRect (rectPosition);

		CBCGPRegistrySP regSP;
		CBCGPRegistry& reg = regSP.Create (FALSE, FALSE);

		if (reg.CreateKey (GetWorkspace ()->GetRegSectionPath (strWindowPlacementRegSection)))
		{
			reg.Write (strRectKey, rectPosition);
		}
	}

	CBCGPDialog::OnDestroy();
}
Ejemplo n.º 8
0
void CLangExtDlg::OnOK()
{
	BOOL bRegVaild = TRUE;
	CString strExt;
	LPCTSTR lpszSubSection = _T("SynExt");
	CString strSection = theApp.GetRegSectionPath(lpszSubSection);

	CBCGPRegistrySP regSP;
	CBCGPRegistry& reg = regSP.Create (FALSE, FALSE);

	if (reg.CreateKey(strSection))
	{
		for (UINT i = 0; i < MAX_SYN_LANG; ++i)
		{
			if (m_aryExt[i] == 1)
			{
				strExt = m_listLangExt.GetItemText(i, 1);
				if (!reg.Write(CSynExtension::m_LangNames[i].langName, strExt))
				{
					bRegVaild = FALSE;
				}
				g_GlobalUtils.m_sLanguageExt.SetLanguageFilter(i, strExt);
			}
		}
	}
	else
	{
		bRegVaild = FALSE;
	}
	
	if (!bRegVaild)
	{
		bRegVaild = strExt.LoadString(IDS_REG_ERROR);
		ASSERT(bRegVaild);
		CFMessageBox(strExt, MB_ICONSTOP);
	}

	CBCGPDialog::OnOK();
}
Ejemplo n.º 9
0
//****************************************************************************
BOOL CBCGPDlgImpl::SavePlacement(LPCTSTR lpszProfileName)
{
	if (!m_bLoadWindowPlacement || m_Dlg.GetSafeHwnd () == NULL || (m_Dlg.GetStyle() & WS_CHILD) != 0)
	{
		return FALSE;
	}

	CString strSection;
	if (!GetPlacementSection(lpszProfileName, strSection))
	{
		return FALSE;
	}

	WINDOWPLACEMENT wp;
	wp.length = sizeof (WINDOWPLACEMENT);

	if (!m_Dlg.GetWindowPlacement (&wp))
	{
		return FALSE;
	}

	CBCGPRegistrySP regSP;
	CBCGPRegistry& reg = regSP.Create (FALSE, FALSE);

	if (!reg.CreateKey (strSection))
	{
		return FALSE;
	}

	m_bWindowPlacementIsSet = FALSE;

	RECT rectDesktop;
	SystemParametersInfo(SPI_GETWORKAREA,0,(PVOID)&rectDesktop,0);
	OffsetRect(&wp.rcNormalPosition, rectDesktop.left, rectDesktop.top);

	return	reg.Write (_T("WindowRect"), CRect(wp.rcNormalPosition)) &&
			reg.Write (_T("Flags"), (int)wp.flags) &&
			reg.Write (_T("ShowCmd"), (int)wp.showCmd);
}
Ejemplo n.º 10
0
BOOL CBCGPKeyMapDlg::OnInitDialog() 
{
	CBCGPDialog::OnInitDialog();

	if (AfxGetMainWnd () != NULL && 
		(AfxGetMainWnd ()->GetExStyle () & WS_EX_LAYOUTRTL))
	{
		ModifyStyleEx (0, WS_EX_LAYOUTRTL);
	}

	{
		CBCGPLocalResource locaRes;

		//-----------------
		// Set dialog icon:
		//-----------------
		SetIcon ((HICON) ::LoadImage (
			AfxGetResourceHandle (),
			MAKEINTRESOURCE (IDI_BCGBARRES_HELP),
			IMAGE_ICON,
			::GetSystemMetrics (SM_CXSMICON),
			::GetSystemMetrics (SM_CYSMICON),
			LR_SHARED), FALSE);

		//---------------
		// Setup buttons:
		//---------------
		m_ButtonPrint.m_nFlatStyle = CBCGPButton::BUTTONSTYLE_FLAT;
		m_ButtonCopy.m_nFlatStyle = CBCGPButton::BUTTONSTYLE_FLAT;

		CString strTT;

		if (m_bEnablePrint)
		{
			m_ButtonPrint.SetImage (globalData.Is32BitIcons () ? 
				IDB_BCGBARRES_PRINT32 : IDB_BCGBARRES_PRINT, NULL);
			m_ButtonPrint.GetWindowText (strTT);
			m_ButtonPrint.SetWindowText (_T(""));
			m_ButtonPrint.SetTooltip (strTT);
			m_ButtonPrint.SizeToContent ();
			m_ButtonPrint.m_bDrawFocus = FALSE;
		}
		else
		{
			m_ButtonPrint.ShowWindow (SW_HIDE);
		}

		m_ButtonCopy.SetImage (globalData.Is32BitIcons () ?
			IDB_BCGBARRES_COPY32 : IDB_BCGBARRES_COPY, NULL);
		m_ButtonCopy.GetWindowText (strTT);
		m_ButtonCopy.SetWindowText (_T(""));
		m_ButtonCopy.SetTooltip (strTT);
		m_ButtonCopy.SizeToContent ();
		m_ButtonCopy.m_bDrawFocus = FALSE;

		//-------------
		// Add columns:
		//-------------
		OnSetColumns ();
		SetColumnsWidth ();
	}

	//-------------------------------------------------------------
	// Find all application document templates and fill accelerator
	// tables  combobox by document template data:
	//-------------------------------------------------------------
	CDocManager* pDocManager = AfxGetApp ()->m_pDocManager;
	if (pDocManager != NULL)
	{
		//---------------------------------------
		// Walk all templates in the application:
		//---------------------------------------
		for (POSITION pos = pDocManager->GetFirstDocTemplatePosition (); pos != NULL;)
		{
			CBCGPMultiDocTemplate* pTemplate = 
				(CBCGPMultiDocTemplate*) pDocManager->GetNextDocTemplate (pos);
			ASSERT_VALID (pTemplate);
			ASSERT_KINDOF (CDocTemplate, pTemplate);

			//-----------------------------------------------------
			// We are interessing CBCGPMultiDocTemplate objects with
			// the shared menu only....
			//-----------------------------------------------------
			if (!pTemplate->IsKindOf (RUNTIME_CLASS (CMultiDocTemplate)) ||
				pTemplate->m_hAccelTable == NULL)
			{
				continue;
			}

			CString strName;
			pTemplate->GetDocString (strName, CDocTemplate::fileNewName);

			int iIndex = m_wndViewTypeList.AddString (strName);
			m_wndViewTypeList.SetItemData (iIndex, (DWORD_PTR) pTemplate);
		}
	}

	//--------------------------
	// Add a default application:
	//--------------------------
	CFrameWnd* pWndMain = DYNAMIC_DOWNCAST (CFrameWnd, m_pWndParentFrame);
	if (pWndMain != NULL && pWndMain->m_hAccelTable != NULL)
	{
		CBCGPLocalResource locaRes;

		CString strName;
		strName.LoadString (IDS_BCGBARRES_DEFAULT_VIEW);

		int iIndex = m_wndViewTypeList.AddString (strName);
		m_wndViewTypeList.SetItemData (iIndex, (DWORD_PTR) NULL);

		m_wndViewTypeList.SetCurSel (iIndex);
		OnSelchangeViewType();
	}

	m_KeymapList.SetExtendedStyle (LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES);

	OnSelchangeViewType ();

	//---------------------------------
	// Initialize commands by category:
	//---------------------------------	
	if (m_pWndRibbonBar == NULL)
	{
		m_pDlgCust = new CBCGPToolbarCustomize(m_pWndParentFrame, TRUE);
		m_pDlgCust->EnableUserDefinedToolbars();
		m_pDlgCust->FillCategoriesComboBox (m_wndCategoryList);
	}
#ifndef BCGP_EXCLUDE_RIBBON
	else
	{
		CBCGPRibbonCategory* pMainCategory = m_pWndRibbonBar->GetMainCategory ();
		if (pMainCategory != NULL)
		{
			ASSERT_VALID (pMainCategory);
			m_wndCategoryList.AddString (pMainCategory->GetName ());
		}
		
		for (int i = 0; i < m_pWndRibbonBar->GetCategoryCount (); i++)
		{
			m_wndCategoryList.AddString(m_pWndRibbonBar->GetCategory (i)->GetName ());
		}
	}
#endif

	m_wndCategoryList.SetCurSel (0);
	OnSelchangeCategory ();

	//----------------------------------
	// Restore window position and size:
	//----------------------------------
	if (GetWorkspace () != NULL)
	{
		CBCGPRegistrySP regSP;
		CBCGPRegistry& reg = regSP.Create (FALSE, TRUE);

		CRect rectPosition;

		if (reg.Open (GetWorkspace ()->GetRegSectionPath (strWindowPlacementRegSection)) &&
			reg.Read (strRectKey, rectPosition))
		{
			MoveWindow (rectPosition);
		}
	}

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
Ejemplo n.º 11
0
//*********************************************************************************
BOOL CBCGPOutlookBar::SaveState (LPCTSTR lpszProfileName, int nIndex, UINT uiID)
{
	CBCGPBaseTabbedBar::SaveState (lpszProfileName, nIndex, uiID);

	for (POSITION pos = m_lstCustomPages.GetHeadPosition (); pos != NULL;)
	{
		CBCGPOutlookBarPane* pPage = (CBCGPOutlookBarPane*)m_lstCustomPages.GetNext (pos);
		ASSERT_VALID (pPage);
		int nID = pPage->GetDlgCtrlID ();
		pPage->SaveState (lpszProfileName, nID, nID);
	}

	CString strProfileName = ::BCGPGetRegPath (strOutlookBarProfile, lpszProfileName);

	if (nIndex == -1)
	{
		nIndex = GetDlgCtrlID ();
	}

	CString strSection;
	if (uiID == (UINT) -1)
	{
		strSection.Format (REG_SECTION_FMT, strProfileName, nIndex);
	}
	else
	{
		strSection.Format (REG_SECTION_FMT_EX, strProfileName, nIndex, uiID);
	}

	try
	{
		CMemFile file;

		{
			CArchive ar (&file, CArchive::store);

			ar << (int) m_lstCustomPages.GetCount ();
			for (POSITION pos = m_lstCustomPages.GetHeadPosition (); pos != NULL;)
			{
				CBCGPOutlookBarPane* pPage = (CBCGPOutlookBarPane*)m_lstCustomPages.GetNext (pos);
				ASSERT_VALID (pPage);

				ar << pPage->GetDlgCtrlID ();
				
				CString strName;
				if (pPage->IsTabbed ())
				{
					pPage->GetWindowText (strName);
				}
				else
				{
					pPage->GetParent ()->GetWindowText (strName);
				}

				ar << strName;
			}
			
			CBCGPOutlookWnd* pOutlookBar = (CBCGPOutlookWnd*) GetUnderlinedWindow ();
			if (pOutlookBar != NULL)
			{
				ar << pOutlookBar->GetVisiblePageButtons ();
			}
			else
			{
				ar << -1;
			}

			ar.Flush ();
		}

		UINT uiDataSize = (UINT) file.GetLength ();
		LPBYTE lpbData = file.Detach ();

		if (lpbData != NULL)
		{
			CBCGPRegistrySP regSP;
			CBCGPRegistry& reg = regSP.Create (FALSE, FALSE);

			if (reg.CreateKey (strSection))
			{
				reg.Write (strRegCustomPages, lpbData, uiDataSize);
			}

			free (lpbData);
		}
	}
	catch (CMemoryException* pEx)
	{
		pEx->Delete ();
		TRACE(_T("Memory exception in CBCGPOutlookBar::SaveState ()!\n"));
	}
	catch (CArchiveException* pEx)
	{
		pEx->Delete ();
		TRACE(_T("Archive exception in CBCGPOutlookBar::SaveState ()!\n"));
	}

	return TRUE;
}
Ejemplo n.º 12
0
//*********************************************************************************
BOOL CBCGPOutlookBar::LoadState (LPCTSTR lpszProfileName, int nIndex, UINT uiID)
{
	CBCGPBaseTabbedBar::LoadState (lpszProfileName, nIndex, uiID);

	CString strProfileName = ::BCGPGetRegPath (strOutlookBarProfile, lpszProfileName);

	if (nIndex == -1)
	{
		nIndex = GetDlgCtrlID ();
	}

	CString strSection;
	if (uiID == (UINT) -1)
	{
		strSection.Format (REG_SECTION_FMT, strProfileName, nIndex);
	}
	else
	{
		strSection.Format (REG_SECTION_FMT_EX, strProfileName, nIndex, uiID);
	}

	LPBYTE	lpbData = NULL;
	UINT	uiDataSize;

	CBCGPRegistrySP regSP;
	CBCGPRegistry& reg = regSP.Create (FALSE, TRUE);

	if (!reg.Open (strSection))
	{
		return FALSE;
	}

	if (!reg.Read (strRegCustomPages, &lpbData, &uiDataSize))
	{
		return FALSE;
	}

	CBCGPOutlookWnd* pOutlookBar = (CBCGPOutlookWnd*) GetUnderlinedWindow ();

	try
	{
		CMemFile file (lpbData, uiDataSize);
		CArchive ar (&file, CArchive::load);

		int nCount = 0;
		ar >> nCount;

		for (int i = 0; i < nCount; i++)
		{
			int nID = 0;
			CString strName;
			ar >> nID;
			ar >> strName;

			CBCGPOutlookBarPane* pPage = new CBCGPOutlookBarPane ();
			pPage->Create (this, dwDefaultToolbarStyle, nID);
			pPage->SetOwner (GetOwner ());

			pPage->LoadState (lpszProfileName, nID,  nID);

			m_lstCustomPages.AddTail (pPage);
			pOutlookBar->AddTab (pPage, strName);

			g_arTakenIDs [nID - g_nBCGPMinReservedPageID] = true;
		}

		if (g_pWorkspace != NULL && g_pWorkspace->GetDataVersion () >= 0x60710 && g_pWorkspace->GetDataVersion () != 0x70000)
		{
			int nVisiblePages = 0;
			ar >> nVisiblePages;

			pOutlookBar->SetVisiblePageButtons (nVisiblePages);
		}
	}
	catch (CMemoryException* pEx)
	{
		pEx->Delete ();
		TRACE(_T("Memory exception in CBCGPOutlookBar::SaveState ()!\n"));
	}
	catch (CArchiveException* pEx)
	{
		pEx->Delete ();
		TRACE(_T("Archive exception in CBCGPOutlookBar::LoadState ()!\n"));
	}

	free (lpbData);
	return TRUE;
}
Ejemplo n.º 13
0
//****************************************************************************
BOOL CBCGPDlgImpl::LoadPlacement(LPCTSTR lpszProfileName)
{
	if (!m_bLoadWindowPlacement || m_bWindowPlacementIsSet || m_Dlg.GetSafeHwnd () == NULL || (m_Dlg.GetStyle() & WS_CHILD) != 0)
	{
		return FALSE;
	}

	CString strSection;
	if (!GetPlacementSection(lpszProfileName, strSection))
	{
		return FALSE;
	}

	WINDOWPLACEMENT wp;
	wp.length = sizeof (WINDOWPLACEMENT);

	if (!m_Dlg.GetWindowPlacement (&wp))
	{
		return FALSE;
	}

	CBCGPRegistrySP regSP;
	CBCGPRegistry& reg = regSP.Create (FALSE, TRUE);

	if (!reg.Open (strSection))
	{
		return FALSE;
	}

	CRect rectNormal;
	int nFlags = 0;
	int nShowCmd = SW_SHOWNORMAL;

	if (!reg.Read (_T("WindowRect"), rectNormal) ||
		!reg.Read (_T("Flags"), nFlags) ||
		!reg.Read (_T("ShowCmd"), nShowCmd))
	{
		return FALSE;
	}

	CRect rectDesktop;

	MONITORINFO mi;
	mi.cbSize = sizeof (MONITORINFO);
	if (GetMonitorInfo (MonitorFromPoint (rectNormal.TopLeft (), 
		MONITOR_DEFAULTTONEAREST), &mi))
	{
		rectDesktop = mi.rcWork;
	}
	else
	{
		::SystemParametersInfo (SPI_GETWORKAREA, 0, &rectDesktop, 0);
	}

	CRect rectInter;
	if (rectInter.IntersectRect (&rectDesktop, &rectNormal))
	{
		rectNormal = rectInter;
	}

	wp.rcNormalPosition = rectNormal;
	wp.showCmd = nShowCmd;

	if (wp.showCmd != SW_SHOWNORMAL)
	{
		m_Dlg.SetWindowPlacement (&wp);
	}
	else
	{
		m_Dlg.SetWindowPos (&CWnd::wndTop, rectNormal.left, rectNormal.top, rectNormal.Width (), rectNormal.Height (),
 			SWP_NOZORDER | SWP_NOOWNERZORDER);
	}

	m_bWindowPlacementIsSet = TRUE;
	return TRUE;
}
Ejemplo n.º 14
0
void CSetEditDlg::OnOK()
{
	GetColor();
	GetFont();
	BOOL bRegVaild = TRUE;
	LPCTSTR lpszSubSection = _T("SynColor");
	CString strSection = theApp.GetRegSectionPath(lpszSubSection);

	CBCGPRegistrySP regSP;
	CBCGPRegistry& reg = regSP.Create (FALSE, FALSE);

	if (reg.CreateKey(strSection))
	{
		if (!reg.Write(_T("clrBack"), g_GlobalUtils.m_sColorScheme.m_clrBack))
		{
			bRegVaild = FALSE;
		}

		if (!reg.Write(_T("clrText"), g_GlobalUtils.m_sColorScheme.m_clrText))
		{
			bRegVaild = FALSE;
		}

		if (!reg.Write(_T("clrBackSelActive"), g_GlobalUtils.m_sColorScheme.m_clrBackSelActive))
		{
			bRegVaild = FALSE;
		}

		if (!reg.Write(_T("clrBackSelInActive"), g_GlobalUtils.m_sColorScheme.m_clrBackSelInActive))
		{
			bRegVaild = FALSE;
		}

		if (!reg.Write(_T("clrTextSelActive"), g_GlobalUtils.m_sColorScheme.m_clrTextSelActive))
		{
			bRegVaild = FALSE;
		}

		if (!reg.Write(_T("clrTextSelInActive"), g_GlobalUtils.m_sColorScheme.m_clrTextSelInActive))
		{
			bRegVaild = FALSE;
		}

		if (!reg.Write(_T("clrBackOutline"), g_GlobalUtils.m_sColorScheme.m_clrBackOutline))
		{
			bRegVaild = FALSE;
		}

		if (!reg.Write(_T("clrLineOutline"), g_GlobalUtils.m_sColorScheme.m_clrLineOutline))
		{
			bRegVaild = FALSE;
		}

		if (!reg.Write(_T("clrBackLineNumber"), g_GlobalUtils.m_sColorScheme.m_clrBackLineNumber))
		{
			bRegVaild = FALSE;
		}

		if (!reg.Write(_T("clrTextLineNumber"), g_GlobalUtils.m_sColorScheme.m_clrTextLineNumber))
		{
			bRegVaild = FALSE;
		}

		if (!reg.Write(_T("clrBackSidebar"), g_GlobalUtils.m_sColorScheme.m_clrBackSidebar))
		{
			bRegVaild = FALSE;
		}

		if (!reg.Write(_T("clrHyperlink"), g_GlobalUtils.m_sColorScheme.m_clrHyperlink))
		{
			bRegVaild = FALSE;
		}

		if (!reg.Write(_T("clrSyn"), g_GlobalUtils.m_sColorScheme.m_clrSyn))
		{
			bRegVaild = FALSE;
		}

		if (!reg.Write(_T("clrType"), g_GlobalUtils.m_sColorScheme.m_clrType))
		{
			bRegVaild = FALSE;
		}

		if (!reg.Write(_T("clrNumber"), g_GlobalUtils.m_sColorScheme.m_clrNumber))
		{
			bRegVaild = FALSE;
		}

		if (!reg.Write(_T("clrString"), g_GlobalUtils.m_sColorScheme.m_clrString))
		{
			bRegVaild = FALSE;
		}

		if (!reg.Write(_T("clrChar"), g_GlobalUtils.m_sColorScheme.m_clrChar))
		{
			bRegVaild = FALSE;
		}

		if (!reg.Write(_T("clrComment"), g_GlobalUtils.m_sColorScheme.m_clrComment))
		{
			bRegVaild = FALSE;
		}
	}
	else
	{
		bRegVaild = FALSE;
	}

	lpszSubSection = _T("SynStyle");
	strSection = theApp.GetRegSectionPath(lpszSubSection);

	CBCGPRegistrySP regSPFont;
	CBCGPRegistry& regFont = regSPFont.Create(FALSE, FALSE);

	if (regFont.CreateKey(strSection))
	{
		if (!regFont.Write(_T("EdtFontName"), g_GlobalUtils.m_sStyleScheme.m_strEdtFontName))
		{
			bRegVaild = FALSE;
		}

		if (!regFont.Write(_T("EdtFontBold"), g_GlobalUtils.m_sStyleScheme.m_bEdtFontBold))
		{
			bRegVaild = FALSE;
		}

		if (!regFont.Write(_T("EdtFontItalic"), g_GlobalUtils.m_sStyleScheme.m_bEdtFontItalic))
		{
			bRegVaild = FALSE;
		}

		if (!regFont.Write(_T("EdtFontSize"), (int)g_GlobalUtils.m_sStyleScheme.m_uEdtFontSize))
		{
			bRegVaild = FALSE;
		}
	}
	else
	{
		bRegVaild = FALSE;
	}

	if (!bRegVaild)
	{
		CString strTemp;
		bRegVaild = strTemp.LoadString(IDS_REG_ERROR);
		ASSERT(bRegVaild);
		CFMessageBox(strTemp, MB_ICONSTOP);
	}

	CBCGPDialog::OnOK();
}