【VC开源代码栏目提醒】:网学会员鉴于大家对VC开源代码十分关注,论文会员在此为大家搜集整理了“COLOREDITDOC.CPP”一文,供大家参考学习
// ColorEditDoc.cpp : implementation of the CColorEditDoc class
//
// Copyright (c) 1996-1997, Keith Rule
// You may freely use or modify this code provided this
// copyright is included in all derived versions.
#include "stdafx.h"
#include "ColorEdit.h"
#include "ColorEditDoc.h"
#include "ProgressBar.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CColorEditDoc
IMPLEMENT_DYNCREATE(CColorEditDoc, CDocument)
BEGIN_MESSAGE_MAP(CColorEditDoc, CDocument)
//{{AFX_MSG_MAP(CColorEditDoc)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
BEGIN_DISPATCH_MAP(CColorEditDoc, CDocument)
//{{AFX_DISPATCH_MAP(CColorEditDoc)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_DISPATCH_MAP
END_DISPATCH_MAP()
// Note: we add support for IID_IColorEdit to support typesafe binding
// from VBA. This IID must match the GUID that is attached to the
// dispinterface in the .ODL file.
// {F6898245-462B-11D1-B99D-00A0C9763A0A}
static const IID IID_IColorEdit =
{ 0xf6898245, 0x462b, 0x11d1, { 0xb9, 0x9d, 0x0, 0xa0, 0xc9, 0x76, 0x3a, 0xa } };
BEGIN_INTERFACE_MAP(CColorEditDoc, CDocument)
INTERFACE_PART(CColorEditDoc, IID_IColorEdit, Dispatch)
END_INTERFACE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CColorEditDoc construction/destruction
CColorEditDoc::CColorEditDoc() : CUndo(25, 64*1024)
{
m_text.AddComment(_T("/*"), _T("*/"));
m_text.AddComment(_T("//"), _T("\n"));
m_text.AddQuote(_T("\""), _T("\""), RGB(0, 200, 200));
m_text.AddQuote(_T("\'"), _T("\'"), RGB(0, 200, 200));
m_text.AddKeyword(_T("static"));
m_text.AddKeyword(_T("const"));
m_text.AddKeyword(_T("char"));
m_text.AddKeyword(_T("short"));
m_text.AddKeyword(_T("unsigned"));
m_text.AddKeyword(_T("void"));
m_text.AddKeyword(_T("long"));
m_text.AddKeyword(_T("int"));
m_text.AddKeyword(_T("float"));
m_text.AddKeyword(_T("double"));
m_text.AddKeyword(_T("struct"));
m_text.AddKeyword(_T("typedef"));
m_text.AddKeyword(_T("class"));
m_text.AddKeyword(_T("public"));
m_text.AddKeyword(_T("private"));
m_text.AddKeyword(_T("protected"));
m_text.AddKeyword(_T("for"));
m_text.AddKeyword(_T("while"));
m_text.AddKeyword(_T("do"));
m_text.AddKeyword(_T("if"));
m_text.AddKeyword(_T("else"));
m_text.AddKeyword(_T("switch"));
m_text.AddKeyword(_T("case"));
m_text.AddKeyword(_T("break"));
m_text.AddKeyword(_T("continue"));
m_text.AddKeyword(_T("return"));
m_text.AddKeyword(_T("this"));
m_text.AddKeyword(_T("new"));
m_text.AddKeyword(_T("delete"));
m_text.AddKeyword(_T("sizeof"));
m_text.AddKeyword(_T("#define"), RGB(128, 128, 128));
m_text.AddKeyword(_T("#include"), RGB(128, 128, 128));
m_text.AddKeyword(_T("#ifdef"), RGB(128, 128, 128));
m_text.AddKeyword(_T("#ifndef"), RGB(128, 128, 128));
m_text.AddKeyword(_T("#endif"), RGB(128, 128, 128));
m_text.AddKeyword(_T("define"), RGB(128, 128, 128));
m_text.AddKeyword(_T("#else"), RGB(128, 128, 128));
m_text.AddKeyword(_T("#elseif"), RGB(128, 128, 128));
m_text.AddKeyword(_T("#undef"), RGB(128, 128, 128));
m_text.AddUpdateTarget(this);
EnableAutomation();
AfxOleLockApp();
}
CColorEditDoc::~CColorEditDoc()
{
AfxOleUnlockApp();
}
BOOL CColorEditDoc::OnNewDocument()
{
if (!CDocument::OnNewDocument