⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 quincy.h

📁 一个完全使用MFC框架开发的C++编译器的代码。功能十分强大可以编译大型程序。
💻 H
📖 第 1 页 / 共 2 页
字号:
// Quincy.h : main header file for the QUINCY application
//

#ifndef __AFXWIN_H__
	#error include 'stdafx.h' before including this file for PCH
#endif

#ifndef QUINCY_H
#define QUINCY_H

#include <set>
#include "resource.h"       // main symbols
#include "consoleapp.h"
#include "gdbconsole.h"

/////////////////////////////////////////////////////////////////////////////
// CQuincyApp:
// See Quincy.cpp for the implementation of this class
//

class CQuincyDoc;
class CQuincyView;
class CErrorLogDialog;
class CTextDocument;
class CTextView;
class CWatchDialog;
class CExamineDialog;
class Parser;
class Debugger;
class CTutDlg;

struct ErrorMessage {						// error/warning log
	UINT m_nLineNumber;
	CString m_strErrorMsg;
	CString m_strFileSpec;
};

struct Breakpoint	{
	CString m_strFile;
	int m_nLineNo;
	Breakpoint(CString fname = CString(), int lno = 0) : m_strFile(fname), m_nLineNo(lno)	{ }
	bool operator<(const Breakpoint& fr) const
		{ return (m_strFile == fr.m_strFile) ? (m_nLineNo < fr.m_nLineNo) : (m_strFile < fr.m_strFile); }
	bool operator==(const Breakpoint& fr) const
		{ return (m_strFile == fr.m_strFile) ? (m_nLineNo == fr.m_nLineNo) : (m_strFile < fr.m_strFile); }
	Breakpoint& operator=(const Breakpoint& fr)
	{
		if (this != &fr)	{
			m_strFile = fr.m_strFile;
			m_nLineNo = fr.m_nLineNo;
		}
		return *this;
	}
};


//#define CYGWIN_GDB

class CEditorView;

class CQuincyApp : public CWinApp
{
	bool m_bWatchCreated;		// true if watch window has been created
	bool m_bGdbConsoleCreated;	// true if gdb console window has been created
	bool m_bCpp;				// true if compiling .cpp
	bool m_bDoLink;				// true if linking
	bool m_bBypassChangeTest;	// true when user says run in spite of changes

	bool appendnexttext;		// true to append text to previous gdb console prompt
	bool stepping;

	bool m_bBrowser;			// true if a browser is installed

#ifdef TYCPP
	bool m_bReadTutorial;		// true when a tutorial is to be loaded
	bool m_bTutCreated;			// true if tutorial dialog has been created
	bool m_bIsTutorial;			// true if tutorial table of contents is present
	bool m_bTutorialDisplayed;  // true when tutorial is displayed
#endif

	bool m_bGrepIsInstalled;	// true when grep tool is installed
	bool m_bAStyleIsInstalled;  // true when beautifier tool is installed
	bool m_bWEditResIsInstalled;// true when resource editor is installed
	bool m_bCompilerIsInstalled;// true when the gnu compiler is installed

	class Compiler *m_pCompiler;
	class Grep* m_pGrep;
	class Executor* m_pExecutor;

	CStringArray m_Defines;		// #define expressions
	CStringArray m_Includes;	// #include paths
	CStringArray m_Libs;		// library paths

	CString m_strVersion;			// gnu-mingw32 compiler version
	CString m_strQuincyInstallPath;	// where quincy is installed
	CString m_strQuincyBinPath;		// quincy.exe path
	CString m_strLCCPath;			// resource compiler and editor path
	CString m_strRIncludePath;		// resource compiler include path
	CString m_strIncludePath;		// compiler include path

private:
	CString m_strLibPath;		// path to standard C/C++ libraries
	CString m_strToolsPath;		// path to assembler, librarian, linker
	CString m_strStartupCode;	// path to compiler's startup code (crt0.o)

	CString m_strCmdLineOptions;// additional user-specified gcc command-line options

#ifdef TYCPP
	CString m_strTutorialPath;	// path to tutorials
	CString m_strTutorial;		// name of current tutorial file
#endif
	CString m_strTempPath;		// path pointed to by TEMP environment variable
//	CString m_strWorkingPath;	// working path for programs and the compiler

	CView* m_pView;				// -> view of document being compiled

	CEditorView* m_pEditorView;	// -> current active editor view

	DWORD m_nExitCode;			// exit code from compiler programs

	// ----- options
	BOOL m_bDebugging;				// option for adding debug information
	BOOL m_bExceptions;				// option for enabling C++ exception handling 
	BOOL m_bRTTI;					// option for enabling C++ runtime type information
	BOOL m_bStrict;					// option for enabling C/C++ strict ANSI/ISO compliance
	int m_style;					// beautify indenting style
	CString m_command;				// beautifier (AStyle) command line
	int m_maxundos;					// maximum number of editor undos
	bool m_bPrintLineNos;			// true for printing line numbers
	int m_CommandLinePromptOption;	// option for command line prompt
	int m_nOptimize;				// compile optimize option
	int m_tabstops;					// editor tabstops
	int m_taboption;				// 0 = use tab characters, 1 = use spaces
	bool m_bAutoindent;				// true for autoindent feature in editor
	bool m_bSyntaxColors;			// true for syntax colors
	COLORREF m_backgroundcolor;		// syntax color values
	COLORREF m_normalcolor;
	COLORREF m_keywordcolor;
	COLORREF m_commentcolor;
	COLORREF m_stringcolor;
	int m_fontheight;
	int m_fontwidth;
	int m_fontweight;
//	CString m_fontface;
	CString m_strCommandLine;		// default command line
	CString m_strRuntimeDirectory;	// runtime directory
	CString m_strCompiler;			// where the compiler is installed
	CString m_strDebugger;			// where the compiler is installed

	int m_defaultfontheight;
	int m_defaultfontwidth;
	
	GdbConsole* m_pdlgGdbConsole;
	CWatchDialog* m_pdlgWatch;
	CExamineDialog* m_pdlgExamine;
	// ------ source level debugger
	Debugger* m_pDebugger;

	// --- programmed breakpoints 
	std::set<Breakpoint> breakpoints;
	Breakpoint steptobreakpoint;

	CRect m_ConsoleRect;			// screen position of console window

#ifdef TYCPP
	CTutDlg* m_pCTutDlg;
#endif

	OSVERSIONINFO osversion;

	// ------------------ methods

	void SetCompilerPaths();
//	void TestDebuggerPath();
	void SetBrowserPath();

	void LoadArray(CStringArray& array, const CString& rstr);
	void GetArray(CString& str, const CStringArray& array) const;

	void RetabAllTextDocuments(int newtabstops);

public:
	CQuincyApp();
	~CQuincyApp();

	BOOL CQuincyApp::FirstInstance();

	const OSVERSIONINFO& OSVersion() const
		{ return osversion; }

	// ----- IDE methods
	const int Tabstops() const
		{ return m_tabstops; }
	const int TabOption() const
		{ return m_taboption; }
	const int MaxUndos() const
		{ return m_maxundos; }
	const bool AutoIndentOption() const
		{ return m_bAutoindent; }
	const bool SyntaxColorsOption() const
		{ return m_bSyntaxColors; }
	const GetMargin() const
		{ return 2; }		// set an option later? for "off" maybe a la devstudio
	void EditorScreenFont(CFont* font, int ht, int wd, int wt);
	CQuincyDoc* GetProjectDocument(CString* pstrPath = 0);
	CQuincyView* GetProjectView();
	CTextDocument* GetTextDocument(CString pstrPath);
	CTextView* GetTextView(CString pstrPath);
	CString GetFileName(const CString& rstrPath);
	CString GetFilePath(const CString& rstrPath);
	void SaveOpenDocuments();
	void SaveAllDocuments(bool prompt = false);
	void SaveDialogWindowPosition(const CString& strWindow, CWnd* pWnd);
	void RestoreDialogWindowPosition(const CString& strWindow, CWnd* pWnd);
	CWnd* MaximizeDocument(const CString& strDocument);
	void SetBypassChangeTest();
	void BringToTop();
	void SerializeOptions(CArchive& ar, CStringArray& array);
	void SerializeProjectOptions(CArchive& ar, int nSig);
	void InvalidateAllViews(bool rebuildfont = false);
	void RunResourceEditor(const CString& strItem = CString());
	bool IsOnCDROM(const CString& strFileSpec);
	bool PrintLineNumbers() const
		{ return m_bPrintLineNos; }
	void SetPrintLineNumbers(bool bset)
		{ m_bPrintLineNos = bset; }
	const CStringArray& GetIncludeArray() const
		{ return m_Includes; }
	const CStringArray& GetDefinesArray() const
		{ return m_Defines; }
	const CStringArray& GetLibraryArray() const
		{ return m_Libs; }
	int CQuincyApp::DefaultFontHeight() const
		{ return m_defaultfontheight; }
	int CQuincyApp::DefaultFontWidth() const
		{ return m_defaultfontwidth; }

//	bool ToggleMenuCommand(int id);
	void SetMenuCommand(int id);
	void ResetMenuCommand(int id);

	COLORREF BackgroundColor() const
		{ return m_bSyntaxColors ? m_backgroundcolor : RGB(255,255,255); }
	COLORREF NormalColor() const
		{ return m_bSyntaxColors ? m_normalcolor : RGB(0,0,0); }
	COLORREF KeywordColor() const
		{ return m_keywordcolor; }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -