Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
SyntaxColorizer.h
Package: solidgraph_sources.zip [view]
Upload User: kairuinn
Upload Date: 2009-02-07
Package Size: 2922k
Code Size: 3k
Category:
Graph program
Development Platform:
Visual C++
- // SyntaxColorizer.h: interface for the CSyntaxColorizer class.
- //
- // Version: 1.0.0
- // Author: Jeff Schering jeffschering@hotmail.com
- // Date: Jan 2001
- // Copyright 2001 by Jeff Schering
- //
- //////////////////////////////////////////////////////////////////////
- #if !defined(AFX_SYNTAXCOLORIZER_H__5C50E421_E4AC_11D4_A61E_60A459C10100__INCLUDED_)
- #define AFX_SYNTAXCOLORIZER_H__5C50E421_E4AC_11D4_A61E_60A459C10100__INCLUDED_
- #if _MSC_VER > 1000
- #pragma once
- #endif // _MSC_VER > 1000
- #define CLR_STRING RGB(55,0,200)
- #define CLR_PLAIN RGB(0,0,0)
- #define CLR_COMMENT RGB(0,170,0)
- #define CLR_KEYWORD RGB(0,0,255)
- #define GRP_KEYWORD 0
- class CSyntaxColorizer
- {
- public:
- CSyntaxColorizer();
- virtual ~CSyntaxColorizer();
- //protected vars
- protected:
- unsigned char *m_pTableZero, *m_pTableOne;
- unsigned char *m_pTableTwo, *m_pTableThree;
- unsigned char *m_pTableFour, *m_pAllowable;
- enum Types
- {
- SKIP,
- DQSTART, //Double Quotes start
- DQEND, //Double Quotes end
- SQSTART, //Single Quotes start
- SQEND, //Single Quotes end
- CMSTART, //Comment start (both single and multi line)
- SLEND, //Single line comment end
- MLEND, //Multi line comment end
- KEYWORD //Keyword start
- } m_type;
- struct SKeyword
- {
- char* keyword;
- int keylen;
- CHARFORMAT cf;
- int group;
- SKeyword* pNext;
- SKeyword() { pNext = NULL; }
- };
- SKeyword* m_pskKeyword;
- CHARFORMAT m_cfComment;
- CHARFORMAT m_cfString;
- CHARFORMAT m_cfDefault;
- //protected member functions
- protected:
- void addKey(LPCTSTR Keyword, CHARFORMAT cf, int grp);
- void createTables();
- void deleteTables();
- void createDefaultKeywordList();
- void createDefaultCharFormat();
- void colorize(LPTSTR lpszBuf, CRichEditCtrl *pCtrl, long iOffset = 0);
- //public member functions
- public:
- void Colorize(long StartChar, long nEndChar, CRichEditCtrl *pCtrl);
- void Colorize(CHARRANGE cr, CRichEditCtrl *pCtrl);
- void GetCommentStyle(CHARFORMAT &cf) { cf = m_cfComment; };
- void GetStringStyle(CHARFORMAT &cf) { cf = m_cfString; };
- void GetGroupStyle(int grp, CHARFORMAT &cf);
- void GetDefaultStyle(CHARFORMAT &cf) { cf = m_cfDefault; };
- void SetCommentStyle(CHARFORMAT cf) { m_cfComment = cf; };
- void SetCommentColor(COLORREF cr);
- void SetStringStyle(CHARFORMAT cf) { m_cfString = cf; };
- void SetStringColor(COLORREF cr);
- void SetGroupStyle(int grp, CHARFORMAT cf);
- void SetGroupColor(int grp, COLORREF cr);
- void SetDefaultStyle(CHARFORMAT cf) { m_cfDefault = cf; };
- void AddKeyword(LPCTSTR Keyword, CHARFORMAT cf, int grp = 0);
- void AddKeyword(LPCTSTR Keyword, COLORREF cr, int grp = 0);
- void ClearKeywordList();
- CString GetKeywordList();
- CString GetKeywordList(int grp);
- };
- #endif // !defined(AFX_SYNTAXCOLORIZER_H__5C50E421_E4AC_11D4_A61E_60A459C10100__INCLUDED_)