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

📄 sourceeditunit.hpp

📁 这是一个有关文本编辑器的源程序,支持彩色语法,你可以任意修改,修改后发给我一份
💻 HPP
📖 第 1 页 / 共 2 页
字号:
// Borland C++ Builder
// Copyright (c) 1995, 2002 by Borland Software Corporation
// All rights reserved

// (DO NOT EDIT: machine generated header) 'SourceEditUnit.pas' rev: 6.00

#ifndef SourceEditUnitHPP
#define SourceEditUnitHPP

#pragma delphiheader begin
#pragma option push -w-
#pragma option push -Vx
#include <RtfExport.hpp>	// Pascal unit
#include <MemoComponentUnit.hpp>	// Pascal unit
#include <ObjList.hpp>	// Pascal unit
#include <Consts.hpp>	// Pascal unit
#include <StdCtrls.hpp>	// Pascal unit
#include <Dialogs.hpp>	// Pascal unit
#include <Forms.hpp>	// Pascal unit
#include <Controls.hpp>	// Pascal unit
#include <Graphics.hpp>	// Pascal unit
#include <Classes.hpp>	// Pascal unit
#include <SysUtils.hpp>	// Pascal unit
#include <Messages.hpp>	// Pascal unit
#include <Windows.hpp>	// Pascal unit
#include <SysInit.hpp>	// Pascal unit
#include <System.hpp>	// Pascal unit

//-- user supplied -----------------------------------------------------------

namespace Sourceeditunit
{
//-- type declarations -------------------------------------------------------
class DELPHICLASS ESourceEdit;
class PASCALIMPLEMENTATION ESourceEdit : public Sysutils::Exception 
{
	typedef Sysutils::Exception inherited;
	
public:
	#pragma option push -w-inl
	/* Exception.Create */ inline __fastcall ESourceEdit(const AnsiString Msg) : Sysutils::Exception(Msg) { }
	#pragma option pop
	#pragma option push -w-inl
	/* Exception.CreateFmt */ inline __fastcall ESourceEdit(const AnsiString Msg, const System::TVarRec * Args, const int Args_Size) : Sysutils::Exception(Msg, Args, Args_Size) { }
	#pragma option pop
	#pragma option push -w-inl
	/* Exception.CreateRes */ inline __fastcall ESourceEdit(int Ident)/* overload */ : Sysutils::Exception(Ident) { }
	#pragma option pop
	#pragma option push -w-inl
	/* Exception.CreateResFmt */ inline __fastcall ESourceEdit(int Ident, const System::TVarRec * Args, const int Args_Size)/* overload */ : Sysutils::Exception(Ident, Args, Args_Size) { }
	#pragma option pop
	#pragma option push -w-inl
	/* Exception.CreateHelp */ inline __fastcall ESourceEdit(const AnsiString Msg, int AHelpContext) : Sysutils::Exception(Msg, AHelpContext) { }
	#pragma option pop
	#pragma option push -w-inl
	/* Exception.CreateFmtHelp */ inline __fastcall ESourceEdit(const AnsiString Msg, const System::TVarRec * Args, const int Args_Size, int AHelpContext) : Sysutils::Exception(Msg, Args, Args_Size, AHelpContext) { }
	#pragma option pop
	#pragma option push -w-inl
	/* Exception.CreateResHelp */ inline __fastcall ESourceEdit(int Ident, int AHelpContext)/* overload */ : Sysutils::Exception(Ident, AHelpContext) { }
	#pragma option pop
	#pragma option push -w-inl
	/* Exception.CreateResFmtHelp */ inline __fastcall ESourceEdit(System::PResStringRec ResStringRec, const System::TVarRec * Args, const int Args_Size, int AHelpContext)/* overload */ : Sysutils::Exception(ResStringRec, Args, Args_Size, AHelpContext) { }
	#pragma option pop
	
public:
	#pragma option push -w-inl
	/* TObject.Destroy */ inline __fastcall virtual ~ESourceEdit(void) { }
	#pragma option pop
	
};


typedef SmallString<1>  TIgnoreChar;

#pragma option push -b-
enum TParenthesisStyle { psOpening, psClosing };
#pragma option pop

#pragma pack(push, 4)
struct TDebuggableRange
{
	int RStart;
	int REnd;
	AnsiString Text;
	AnsiString ClassName;
} ;
#pragma pack(pop)

typedef DynamicArray<TDebuggableRange >  TDebuggableRanges;

#pragma option push -b-
enum SourceEditUnit__2 { soCaseSensitive, soSearchSelText, soSearchAllText, soFromCursor, soWholeRange, soUp, soDown };
#pragma option pop

typedef Set<SourceEditUnit__2, soCaseSensitive, soDown>  TSearchOption;

#pragma pack(push, 4)
struct TSearchRange
{
	int BegPos;
	int EndPos;
	int CurPos;
} ;
#pragma pack(pop)

class DELPHICLASS TSourceEdit;
class DELPHICLASS TSyntaxColoring;
class DELPHICLASS TCustomStyles;
class DELPHICLASS TCustomStyle;
class PASCALIMPLEMENTATION TCustomStyles : public Classes::TCollection 
{
	typedef Classes::TCollection inherited;
	
public:
	TCustomStyle* operator[](int Index) { return Items[Index]; }
	
private:
	TSyntaxColoring* FColoring;
	HIDESBASE TCustomStyle* __fastcall GetItem(int Index);
	HIDESBASE void __fastcall SetItem(int Index, TCustomStyle* Value);
	
protected:
	DYNAMIC Classes::TPersistent* __fastcall GetOwner(void);
	virtual void __fastcall Update(Classes::TCollectionItem* Item);
	
public:
	__fastcall TCustomStyles(TSyntaxColoring* AColoring);
	HIDESBASE TCustomStyle* __fastcall Add(void);
	TCustomStyle* __fastcall FindStyle(const AnsiString S);
	__property TCustomStyle* Items[int Index] = {read=GetItem, write=SetItem/*, default*/};
public:
	#pragma option push -w-inl
	/* TCollection.Destroy */ inline __fastcall virtual ~TCustomStyles(void) { }
	#pragma option pop
	
};


class DELPHICLASS TWordLists;
class DELPHICLASS TWordList;
class PASCALIMPLEMENTATION TWordLists : public Classes::TCollection 
{
	typedef Classes::TCollection inherited;
	
public:
	TWordList* operator[](int Index) { return Items[Index]; }
	
private:
	TSyntaxColoring* FColoring;
	HIDESBASE TWordList* __fastcall GetItem(int Index);
	HIDESBASE void __fastcall SetItem(int Index, TWordList* Value);
	
protected:
	DYNAMIC Classes::TPersistent* __fastcall GetOwner(void);
	virtual void __fastcall Update(Classes::TCollectionItem* Item);
	
public:
	__fastcall TWordLists(TSyntaxColoring* AColoring);
	HIDESBASE TWordList* __fastcall Add(void);
	TWordList* __fastcall FindList(const AnsiString S);
	__property TWordList* Items[int Index] = {read=GetItem, write=SetItem/*, default*/};
public:
	#pragma option push -w-inl
	/* TCollection.Destroy */ inline __fastcall virtual ~TWordLists(void) { }
	#pragma option pop
	
};


class PASCALIMPLEMENTATION TSyntaxColoring : public Objlist::TOwnedPersistent 
{
	typedef Objlist::TOwnedPersistent inherited;
	
private:
	Graphics::TColor FNumberColor;
	Graphics::TColor FSymbolColor;
	TCustomStyles* FCustomStyles;
	TWordLists* FWordLists;
	bool FEnabled;
	int FUpdateDebth;
	Classes::TStringList* FParenthesisColors;
	bool FSymbolCustomStyle;
	bool FNumberCustomStyle;
	Graphics::TFontStyles FNumberStyle;
	Graphics::TFontStyles FSymbolStyle;
	bool FParenthesisCustomStyle;
	Graphics::TFontStyles FParenthesisStyle;
	void __fastcall SetCustomStyles(const TCustomStyles* Value);
	void __fastcall SetNumberColor(const Graphics::TColor Value);
	void __fastcall SetSymbolColor(const Graphics::TColor Value);
	void __fastcall SetWordLists(const TWordLists* Value);
	void __fastcall SetEnabled(const bool Value);
	void __fastcall SetParenthesisColors(const Classes::TStringList* Value);
	void __fastcall SetNumberCustomStyle(const bool Value);
	void __fastcall SetNumberStyle(const Graphics::TFontStyles Value);
	void __fastcall SetSymbolCustomStyle(const bool Value);
	void __fastcall SetSymbolStyle(const Graphics::TFontStyles Value);
	void __fastcall SetParenthesisCustomStyle(const bool Value);
	void __fastcall SetParenthesisStyle(const Graphics::TFontStyles Value);
	
protected:
	Graphics::TFont* SymbolFont;
	Graphics::TFont* NumberFont;
	Graphics::TFont* ParenthesisFont;
	void __fastcall ChangeNotification(System::TObject* Sender);
	
public:
	__fastcall virtual TSyntaxColoring(Classes::TPersistent* AOwner);
	__fastcall virtual ~TSyntaxColoring(void);
	virtual void __fastcall ColoringChange(void);
	virtual void __fastcall Assign(Classes::TPersistent* Source);
	Graphics::TColor __fastcall GetParenthesisColor(int Index);
	virtual void __fastcall BeginUpdate(void);
	virtual void __fastcall EndUpdate(void);
	
__published:
	__property bool Enabled = {read=FEnabled, write=SetEnabled, nodefault};
	__property Graphics::TColor SymbolColor = {read=FSymbolColor, write=SetSymbolColor, nodefault};
	__property Graphics::TFontStyles SymbolStyle = {read=FSymbolStyle, write=SetSymbolStyle, nodefault};
	__property bool SymbolCustomStyle = {read=FSymbolCustomStyle, write=SetSymbolCustomStyle, nodefault};
	__property Graphics::TColor NumberColor = {read=FNumberColor, write=SetNumberColor, nodefault};
	__property Graphics::TFontStyles NumberStyle = {read=FNumberStyle, write=SetNumberStyle, nodefault};
	__property bool NumberCustomStyle = {read=FNumberCustomStyle, write=SetNumberCustomStyle, nodefault};
	__property TWordLists* WordLists = {read=FWordLists, write=SetWordLists};
	__property TCustomStyles* CustomStyles = {read=FCustomStyles, write=SetCustomStyles};
	__property Classes::TStringList* ParenthesisColors = {read=FParenthesisColors, write=SetParenthesisColors};
	__property Graphics::TFontStyles ParenthesisStyle = {read=FParenthesisStyle, write=SetParenthesisStyle, nodefault};
	__property bool ParenthesisCustomStyle = {read=FParenthesisCustomStyle, write=SetParenthesisCustomStyle, nodefault};
};


class DELPHICLASS TSyntaxRange;
typedef TMetaClass*TSyntaxRangeClass;

class PASCALIMPLEMENTATION TSyntaxRange : public Memocomponentunit::TCustomFormattedRange 
{
	typedef Memocomponentunit::TCustomFormattedRange inherited;
	
private:
	int FParenthesisLevel;
	TSyntaxRange* FNextRange;
	TSyntaxRange* FPrevRange;
	
protected:
	virtual void __fastcall SetNewParenthesisLevel(void);
	virtual int __fastcall GetNextParenthesisLevel(void);
	virtual Graphics::TColor __fastcall GetColor(void);
	virtual bool __fastcall ReplaceSyntaxRanges(TSyntaxRange* &StartRange);
	
public:
	__fastcall virtual ~TSyntaxRange(void);
	/*         class method */ static bool __fastcall EqualEndings(TMetaClass* vmt, TSyntaxRange* Range1, TSyntaxRange* Range2);
	virtual bool __fastcall EqualEndingsWith(TSyntaxRange* Range);
	/*         class method */ static TSyntaxRange* __fastcall InsertRangeBefore(TMetaClass* vmt, TSyntaxRange* Range, TMetaClass* RangeClass, TSourceEdit* Editor);
	TSyntaxRange* __fastcall InsertBefore(TMetaClass* RangeClass);
	TSyntaxRange* __fastcall InsertAfter(TMetaClass* RangeClass);
	/*         class method */ static TSyntaxRange* __fastcall NewRangeInsertedBefore(TMetaClass* vmt, TSyntaxRange* Range, TSourceEdit* Editor);
	/*         class method */ static TSyntaxRange* __fastcall NewRangeInsertedAfter(TMetaClass* vmt, TSyntaxRange* Range, TSourceEdit* Editor);
	virtual void __fastcall UpdateParenthesisLevel(void);
	__property int NextParenthesisLevel = {read=GetNextParenthesisLevel, nodefault};
	__property TSyntaxRange* PrevRange = {read=FPrevRange, write=FPrevRange};
	__property TSyntaxRange* NextRange = {read=FNextRange, write=FNextRange};
	
__published:
	__property int ParenthesisLevel = {read=FParenthesisLevel, write=FParenthesisLevel, nodefault};
public:
	#pragma option push -w-inl
	/* TMCRange.Create */ inline __fastcall virtual TSyntaxRange(Objlist::TFastObjectContainer* Collection) : Memocomponentunit::TCustomFormattedRange(Collection) { }
	#pragma option pop
	
};


class PASCALIMPLEMENTATION TSourceEdit : public Memocomponentunit::TMemoComponent 
{
	typedef Memocomponentunit::TMemoComponent inherited;
	
private:
	bool FAutoIndent;
	TSyntaxColoring* FSyntaxColoring;
	TSyntaxRange* FFirstSyntaxRange;
	TSyntaxRange* FLastSyntaxRange;
	bool FAutoIndentIncrease;
	char FAutoIndentIncreaseStart;
	char FAutoIndentIncreaseEnd;
	bool FSplitOnFly;
	TSearchOption FSearchOption;
	TSearchRange FSearch;
	HIDESBASE MESSAGE void __fastcall CMFontChanged(Messages::TMessage &Message);
	HIDESBASE MESSAGE void __fastcall WMKeyDown(Messages::TWMKey &Message);
	void __fastcall SetSyntaxColoring(const TSyntaxColoring* Value);
	void __fastcall SetSplitOnFly(const bool Value);
	int __fastcall GetCurrentCol(void);
	int __fastcall GetCurrentRow(void);
	void __fastcall SetSearchOption(const TSearchOption Value);
	
protected:
	TSyntaxRange* SyntaxStartRange;
	TSyntaxRange* LastPRange;
	Memocomponentunit::TCustomRange* LastCRange;
	DYNAMIC void __fastcall KeyPress(char &Key);
	DYNAMIC void __fastcall TextChangeNotification(int StartPos, int OldLength, int NewLength);
	DYNAMIC void __fastcall TextChangeNotificationAfter(void);
	virtual void __fastcall ReColor(void);
	virtual void __fastcall ReColorRange(Memocomponentunit::TCustomRange* Range);
	virtual void __fastcall FreeAllSyntaxRanges(void);
	virtual bool __fastcall ReplaceSyntaxRanges(TSyntaxRange* NewRange, TSyntaxRange* &StartRange);
	virtual Memocomponentunit::TFormattedRangeArray __fastcall CreateSplitRanges(Memocomponentunit::TCustomRange* Range);
	void __fastcall OverwriteRange(System::TObject* Sender);
	virtual TSyntaxRange* __fastcall FindSyntaxHole(void);
	virtual TSyntaxRange* __fastcall FindSyntaxOverlap(void);
	virtual TDebuggableRanges __fastcall MakeDebuggableRanges();
	
public:
	__fastcall virtual TSourceEdit(Classes::TComponent* AOwner);
	__fastcall virtual ~TSourceEdit(void);
	virtual TSyntaxRange* __fastcall SyntaxRangeAtPos(int RangePos);
	virtual TSyntaxRange* __fastcall SyntaxRangeAtPosWithHint(int RangePos, TSyntaxRange* Hint);
	bool __fastcall FindText(AnsiString ATxt);
	HIDESBASE bool __fastcall ReplaceText(AnsiString FindTxt, AnsiString ReplaceTxt, bool ReplaceAll);
	void __fastcall GotoLine(int LineNo);
	void __fastcall ExportToRtf(AnsiString FileName, bool NeedColor = true);
	__property TSyntaxRange* FirstSyntaxRange = {read=FFirstSyntaxRange, write=FFirstSyntaxRange};
	__property TSyntaxRange* LastSyntaxRange = {read=FLastSyntaxRange, write=FLastSyntaxRange};
	__property TSearchOption SearchOption = {read=FSearchOption, write=SetSearchOption, nodefault};
	__property int CurrentCol = {read=GetCurrentCol, nodefault};
	__property int CurrentRow = {read=GetCurrentRow, nodefault};
	
__published:
	__property TSyntaxColoring* SyntaxColoring = {read=FSyntaxColoring, write=SetSyntaxColoring};
	__property bool AutoIndent = {read=FAutoIndent, write=FAutoIndent, nodefault};
	__property bool AutoIndentIncrease = {read=FAutoIndentIncrease, write=FAutoIndentIncrease, nodefault};
	__property char AutoIndentIncreaseStart = {read=FAutoIndentIncreaseStart, write=FAutoIndentIncreaseStart, nodefault};
	__property char AutoIndentIncreaseEnd = {read=FAutoIndentIncreaseEnd, write=FAutoIndentIncreaseEnd, nodefault};
	__property bool SplitOnFly = {read=FSplitOnFly, write=SetSplitOnFly, nodefault};
public:
	#pragma option push -w-inl
	/* TWinControl.CreateParented */ inline __fastcall TSourceEdit(HWND ParentWindow) : Memocomponentunit::TMemoComponent(ParentWindow) { }
	#pragma option pop
	
};


class DELPHICLASS TNormalTextRange;
class PASCALIMPLEMENTATION TNormalTextRange : public TSyntaxRange 
{
	typedef TSyntaxRange inherited;
	
protected:
	virtual Graphics::TFont* __fastcall GetFont(void);
	

⌨️ 快捷键说明

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