📄 synedit.pas
字号:
function GetSelEnd: integer; //DDH 10/16/01
function GetSelStart: integer; //DDH 10/16/01
function GetSelLength: integer;
procedure SetSelEnd(const Value: integer); //DDH 10/16/01
procedure SetSelStart(const Value: integer); //DDH 10/16/01
procedure SetSelLength(const Value: integer);
procedure SetAlwaysShowCaret(const Value: Boolean); //DDH 10/16/01
procedure PrepareIdentChars(var IdentChars, WhiteChars: TSynIdentChars); //DDH 11/01/01
procedure LinesHookChanged;
property InternalCaretX: Integer write InternalSetCaretX;
property InternalCaretY: Integer write InternalSetCaretY;
property InternalCaretXY: TPoint write InternalSetCaretXY;
public
property Canvas; //DDH 10/16/01
property SelStart: Integer read GetSelStart write SetSelStart; //DDH 10/16/01
property SelEnd: Integer read GetSelEnd write SetSelEnd; //DDH 10/16/01
property AlwaysShowCaret: Boolean read FAlwaysShowCaret //DDH 10/16/01
write SetAlwaysShowCaret;
procedure UpdateCaret; //DDH 10/16/01 moved from protected to public (needed in Completion Proposal)
{$IFDEF SYN_COMPILER_4_UP} //DDH 10/17/01 change from Fl醰io Etrusco
procedure AddKey(Command: TSynEditorCommand; Key1: word; SS1: TShiftState;
Key2: word = 0; SS2: TShiftState = []);
{$ELSE}
procedure AddKey(Command: TSynEditorCommand; Key1: word; SS1: TShiftState;
Key2: word; SS2: TShiftState);
{$ENDIF}
procedure BeginUndoBlock; //sbs 2000-11-19
procedure BeginUpdate;
function CaretXPix: Integer;
function CaretYPix: Integer;
function CharIndexToRowCol(Index: integer): TPoint;
procedure Clear;
procedure ClearAll;
procedure ClearBookMark(BookMark: Integer);
procedure ClearSelection;
procedure CommandProcessor(Command: TSynEditorCommand; AChar: char;
Data: pointer); virtual;
procedure ClearUndo;
procedure CopyToClipboard;
constructor Create(AOwner: TComponent); override;
procedure CutToClipboard;
destructor Destroy; override;
procedure DoCopyToClipboard(const SText: string);
procedure DragDrop(Source: TObject; X, Y: Integer); override;
procedure EndUndoBlock; //sbs 2000-11-19
procedure EndUpdate;
procedure EnsureCursorPosVisible;
procedure EnsureCursorPosVisibleEx(ForceToMiddle: Boolean);
procedure FindMatchingBracket; virtual; //GBN 2001-10-23 Moved to public
function GetMatchingBracket: TPoint; virtual; //GBN 2001-10-23
function GetMatchingBracketEx(APoint: TPoint;
AdjustForTabs: Boolean): TPoint; virtual; //DDH 2001-10-23
{$IFDEF SYN_COMPILER_4_UP}
function ExecuteAction(Action: TBasicAction): boolean; override;
{$ENDIF}
procedure ExecuteCommand(Command: TSynEditorCommand; AChar: char;
Data: pointer); virtual;
function GetBookMark(BookMark: integer; var X, Y: integer): boolean;
function GetHighlighterAttriAtRowCol(XY: TPoint; var Token: string;
var Attri: TSynHighlighterAttributes): boolean;
function GetHighlighterAttriAtRowColEx(XY: TPoint; var Token: string;
var TokenType, Start: Integer;
var Attri: TSynHighlighterAttributes): boolean; //DDH 10/16/01
function GetPositionOfMouse(out Point: TPoint): Boolean;
function GetWordAtRowCol(XY: TPoint): string;
procedure GotoBookMark(BookMark: Integer);
procedure GotoLineAndCenter(ALine: Integer);
function IdentChars: TSynIdentChars; //DDH 10/17/01 from Fl醰io Etrusco
procedure InvalidateGutter;
// note: FirstLine and LastLine don't need to be in correct order
procedure InvalidateGutterLines(FirstLine, LastLine: integer);
procedure InvalidateLine(Line: integer);
procedure InvalidateLines(FirstLine, LastLine: integer); //Fiala 2001-12-17 moved to public
function IsBookmark(BookMark: integer): boolean;
procedure LockUndo;
function LogicalToPhysicalPos(p: TPoint): TPoint;
function PhysicalToLogicalPos(p: TPoint): TPoint; //sblbg 2001-12-17
function NextWordPos: TPoint; virtual;
function NextWordPosEx(XY: TPoint): TPoint; virtual;
procedure Notification(AComponent: TComponent;
Operation: TOperation); override;
procedure PasteFromClipboard;
function WordStart: TPoint; virtual;
function WordStartEx(XY: TPoint): TPoint; virtual;
function WordEnd: TPoint; virtual;
function WordEndEx(XY: TPoint): TPoint; virtual;
function PrevWordPos: TPoint; virtual;
function PrevWordPosEx(XY: TPoint): TPoint; virtual;
function PixelsToRowColumn(Pixels: TPoint): TPoint;
procedure Redo;
procedure RegisterCommandHandler(AHandlerProc: THookedCommandEvent;
AHandlerData: pointer);
function RowColumnToPixels(RowCol: TPoint): TPoint;
function RowColToCharIndex(RowCol: TPoint): integer;
function SearchReplace(const ASearch, AReplace: string;
AOptions: TSynSearchOptions): integer;
procedure SelectAll;
procedure SetBookMark(BookMark: Integer; X: Integer; Y: Integer);
procedure SetCaretAndSelection(ptCaret, ptBefore, ptAfter: TPoint);
procedure SetDefaultKeystrokes; virtual;
procedure SetOptionFlag(Flag: TSynEditorOption; Value: boolean);
procedure SetSelWord;
procedure Undo;
procedure UnlockUndo;
procedure UnregisterCommandHandler(AHandlerProc: THookedCommandEvent);
{$IFDEF SYN_COMPILER_4_UP}
function UpdateAction(Action: TBasicAction): boolean; override;
{$ENDIF}
procedure SetFocus; override;
procedure AddKeyUpHandler (aHandler : TKeyEvent);
procedure RemoveKeyUpHandler (aHandler : TKeyEvent);
procedure AddKeyDownHandler (aHandler : TKeyEvent);
procedure RemoveKeyDownHandler (aHandler : TKeyEvent);
procedure AddKeyPressHandler (aHandler : TKeyPressEvent);
procedure RemoveKeyPressHandler (aHandler : TKeyPressEvent);
procedure AddFocusControl (aControl: TWinControl);
procedure RemoveFocusControl (aControl: TWinControl);
procedure AddMouseDownHandler(aHandler: TMouseEvent);
procedure RemoveMouseDownHandler(aHandler: TMouseEvent);
{$IFDEF SYN_CLX}
function EventFilter(Sender: QObjectH; Event: QEventH): Boolean; override;
{$ELSE}
procedure WndProc(var Msg: TMessage); override;
{$ENDIF}
procedure SetLinesPointer(ASynEdit: TCustomSynEdit); //ddh 2002-7-15
procedure RemoveLinesPointer; //ddh 2002-7-15
procedure HookTextBuffer(aBuffer: TSynEditStringList;
aUndo, aRedo: TSynEditUndoList);
procedure UnHookTextBuffer;
public
property BlockBegin: TPoint read GetBlockBegin write SetBlockBegin;
property BlockEnd: TPoint read GetBlockEnd write SetBlockEnd;
property CanPaste: Boolean read GetCanPaste;
property CanRedo: boolean read GetCanRedo;
property CanUndo: boolean read GetCanUndo;
property CaretX: Integer read fCaretX write SetCaretX;
property CaretY: Integer read fCaretY write SetCaretY;
property CaretXY: TPoint read GetCaretXY write SetCaretXY;
property ActiveLineColor: TColor read fActiveLineColor
write SetActiveLineColor default clNone;
property DisplayX: Integer read GetDisplayX; //GN 10/16/01
property DisplayY: Integer read GetDisplayY; //GN 10/16/01
property DisplayXY: TPoint read GetDisplayXY; //GN 10/16/01
property CharsInWindow: Integer read fCharsInWindow;
property CharWidth: integer read fCharWidth;
property Color;
property Font: TFont read GetFont write SetFont;
property Highlighter: TSynCustomHighlighter
read fHighlighter write SetHighlighter;
property LeftChar: Integer read fLeftChar write SetLeftChar;
property LineHeight: integer read fTextHeight;
property LinesInWindow: Integer read fLinesInWindow;
property LineText: string read GetLineText write SetLineText;
property Lines: TStrings read fLines write SetLines;
property Marks: TSynEditMarkList read fMarkList;
property MaxLineWidth: integer read fMaxLineWidth write SetMaxLineWidth
default 1024;
property Modified: Boolean read fModified write SetModified;
property PaintLock: Integer read fPaintLock;
property ReadOnly: Boolean read GetReadOnly write SetReadOnly default FALSE;
property SearchEngine: TSynEditSearchCustom read fSearchEngine write SetSearchEngine;
property SelAvail: Boolean read GetSelAvail;
property SelLength: integer read GetSelLength write SetSelLength;
property SelTabBlock: Boolean read GetSelTabBlock;
property SelTabLine: Boolean read GetSelTabLine;
property SelText: string read GetSelText write SetSelTextExternal;
property Text: string read SynGetText write SynSetText;
property TopLine: Integer read fTopLine write SetTopLine;
property WordAtCursor: string read GetWordAtCursor;
property WordAtMouse: string read GetWordAtMouse;
property UndoList: TSynEditUndoList read fUndoList;
property RedoList: TSynEditUndoList read fRedoList;
public
property OnProcessCommand: TProcessCommandEvent
read FOnProcessCommand write FOnProcessCommand;
property BookMarkOptions: TSynBookMarkOpt
read fBookMarkOpt write fBookMarkOpt;
property BorderStyle: TSynBorderStyle read FBorderStyle write SetBorderStyle
default bsSingle;
property ExtraLineSpacing: integer
read fExtraLineSpacing write SetExtraLineSpacing default 0;
property Gutter: TSynGutter read fGutter write SetGutter;
property HideSelection: boolean read fHideSelection write SetHideSelection
default false;
property InsertCaret: TSynEditCaretType read FInsertCaret
write SetInsertCaret default ctVerticalLine;
property InsertMode: boolean read fInserting write SetInsertMode
default true;
property Keystrokes: TSynEditKeyStrokes
read FKeystrokes write SetKeystrokes stored False;
property MaxUndo: Integer read GetMaxUndo write SetMaxUndo default 1024;
property Options: TSynEditorOptions read fOptions write SetOptions
default SYNEDIT_DEFAULT_OPTIONS;
property OverwriteCaret: TSynEditCaretType read FOverwriteCaret
write SetOverwriteCaret default ctBlock;
property RightEdge: Integer read fRightEdge write SetRightEdge default 80;
property RightEdgeColor: TColor
read fRightEdgeColor write SetRightEdgeColor default clSilver;
property ScrollHintColor: TColor read fScrollHintColor
write fScrollHintColor default clInfoBk;
property ScrollHintFormat: TScrollHintFormat read fScrollHintFormat
write fScrollHintFormat default shfTopLineOnly;
property ScrollBars: TScrollStyle
read FScrollBars write SetScrollBars default ssBoth;
property SelectedColor: TSynSelectedColor
read FSelectedColor write FSelectedColor;
property SelectionMode: TSynSelectionMode
read FSelectionMode write SetSelectionMode default smNormal;
property TabWidth: integer read fTabWidth write SetTabWidth default 8;
property WantReturns: boolean read fWantReturns write fWantReturns default True;
property WantTabs: boolean read fWantTabs write fWantTabs default False;
property OnChange: TNotifyEvent read FOnChange write FOnChange;
property OnClearBookmark: TPlaceMarkEvent read fOnClearMark
write fOnClearMark;
property OnCommandProcessed: TProcessCommandEvent
read fOnCommandProcessed write fOnCommandProcessed;
property OnContextHelp: TContextHelpEvent
read fOnContextHelp write fOnContextHelp;
property OnDropFiles: TDropFilesEvent read fOnDropFiles write fOnDropFiles;
property OnGutterClick: TGutterClickEvent
read fOnGutterClick write fOnGutterClick;
property OnGutterGetText: TGutterGetTextEvent read fOnGutterGetText
write fOnGutterGetText;
property OnGutterPaint: TGutterPaintEvent read fOnGutterPaint
write fOnGutterPaint;
property OnPaint: TPaintEvent read fOnPaint write fOnPaint;
property OnPlaceBookmark: TPlaceMarkEvent
read FOnPlaceMark write FOnPlaceMark;
property OnProcessUserCommand: TProcessCommandEvent
read FOnProcessUserCommand write FOnProcessUserCommand;
property OnReplaceText: TReplaceTextEvent read fOnReplaceText
write fOnReplaceText;
property OnSpecialLineColors: TSpecialLineColorsEvent
read fOnSpecialLineColors write fOnSpecialLineColors;
property OnStatusChange: TStatusChangeEvent
read fOnStatusChange write fOnStatusChange;
property OnPaintTransient: TPaintTransient
read fOnPaintTransient write fOnPaintTransient; //GBN 2001-10-23
property OnScroll: TScrollEvent
read fOnScroll write fOnScroll; //GBN 2002-05-14
property OnLineNumber: TLineNumberEvent
read fOnLineNumber write FOnLineNumber;
property IsScrolling : Boolean read FIsScrolling; //ddh 2002-06-22
published
property Cursor default crIBeam;
end;
TSynEdit = class(TCustomSynEdit)
published
// inherited properties
property Align;
{$IFDEF SYN_COMPILER_4_UP}
property Anchors;
property Constraints;
{$ENDIF}
property Color;
property ActiveLineColor;
{$IFDEF SYN_CLX}
{$ELSE}
property Ctl3D;
property ParentCtl3D;
{$ENDIF}
property Enabled;
property Font;
property Height;
property Name;
property ParentColor default False;
property ParentFont default False;
property ParentShowHint;
property PopupMenu;
property ShowHint;
property TabOrder;
property TabStop default True;
property Visible;
property Width;
// property WordWrap; //Fiala 2001-12-17 //When it works, uncomment this. It currently *does not work*
// inherited events
property OnClick;
property OnDblClick;
property OnDragDrop;
property OnDragOver;
{$IFDEF SYN_CLX}
{$ELSE}
{$IFDEF SYN_COMPILER_4_UP}
property OnEndDock;
property OnStartDock;
{$ENDIF}
{$ENDIF}
property OnEndDrag;
property OnEnter;
property OnExit;
property OnKeyDown;
property OnKeyPress;
property OnKeyUp;
property OnMouseDown;
property OnMouseMove;
property OnMouseUp;
property OnStartDrag;
// TCustomSynEdit properties
property BookMarkOptions;
property BorderStyle;
property ExtraLineSpacing;
property Gutter;
property HideSelection;
property Highlighter;
property InsertCaret;
property InsertMode;
property Keystrokes;
property Lines;
property MaxLineWidth;
property MaxUndo;
property Options;
property OverwriteCaret;
property ReadOnly;
property RightEdge;
property RightEdgeColor;
property ScrollHintColor;
property ScrollHintFormat;
property ScrollBars;
property SearchEngine;
property SelectedColor;
property SelectionMode;
property TabWidth;
property WantReturns;
property WantTabs;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -