Click here to Skip to main content
15,888,051 members
Articles / Desktop Programming / MFC

Brainchild, A syntax coloring edit control

Rate me:
Please Sign up or sign in to vote.
4.85/5 (64 votes)
16 Jun 2005CPOL5 min read 705.9K   26.8K   263  
Syntax coloring, multi-level undo/redo editor control.
//
//	bcframe.h
//
//	By Jan van den Baard.
//
//	"Brainchild Custom Editor Control" demonstration program.
//	This code is public domain, use and abuse as you desire.
//

class BCChildWnd;
class Brainchild;

class BCFrameWnd : public ClsMDIMainWindow
{
	friend class BCChildWnd;
	friend class Brainchild;
	
	_NO_COPY( BCFrameWnd );
public:
	// Constructor/destructor.
	BCFrameWnd();
	virtual ~BCFrameWnd();

	// Setup the correct menu.
	void SetupMenu();
	void AddDocument( LPCTSTR pszFilename );
	void Quit();

protected:
	// Overidables.
	virtual LRESULT WindowProc( UINT uMsg, WPARAM wParam, LPARAM lParam );
	virtual LRESULT OnEraseBkgnd( ClsDC *pDC ) { return 0; }
	virtual void OnMDIChildRemoved( ClsMDIChildWindow *pWnd );
	virtual LRESULT OnClose();
	virtual LRESULT OnSize( UINT nSizeType, int nWidth, int nHeight );
	virtual LRESULT OnCommand( UINT nNotifyCode, UINT nCtrlID, HWND hWndCtrl );
	virtual LRESULT OnCreate( LPCREATESTRUCT pCS );
	virtual LRESULT OnNotify( LPNMHDR pHdr );

	// Helpers.
	BOOL GetKeys();
	BOOL ChangeSwitch( UINT nID );
	BOOL AlreadyOpen( LPCTSTR pszFilename );
	BOOL ExecuteCommand( UINT nID );
	void SaveAs( BCChildWnd *pChild );
	void ParseCommandLine();
	void ConvertShortToFull( LPCTSTR pszFileName );
	void ActivateTab( ClsWindow *pWindow );

	// Data.
	ClsSimpleArray<BCChildWnd *>	m_Childs;		// Array to track the created childs.
	BCStatus			m_Status;		// Status bar.
	BCToolbar			m_Toolbar;		// Tool bar.
	BCMenu				m_FrameMenu;		// Frame menu.
	BCMenu				m_ChildMenu;		// Child menu.
	BCMenu				m_ContextMenu;		// Context menu.
	HIMAGELIST			m_hToolbar;		// Toolbar images.
	HIMAGELIST			m_hPin;			// Pin-toolbar.
	ClsMRU				m_MRUFiles;		// Most-Recently-Used files.
	ClsMRU				m_HotFiles;		// Hot files.
	DWORD				m_dwChildMax;		// Children maximized?
	ClsString			m_CurrPath;		// Path of the current window.
	ClsDotNetTabControl		m_MDITabs;		// DotNet style tabs.
};

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
Netherlands Netherlands
I have been programming for a hobby since 1985. I have started programming on the C= 64. After that I migrated to the C= Amiga which I traded in for a PC back in 1997 I believe. Back in 2000 I decided to lose a hobby and start developing software for a living.

Currently I am working mainly in developing software for building security and access control systems.

Comments and Discussions