mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-11 13:56:05 +02:00
added some SrcEditorIntf functions
git-svn-id: trunk@7799 -
This commit is contained in:
parent
8cc5cbf6e1
commit
97f7f4e134
@ -228,7 +228,7 @@ type
|
||||
// selections
|
||||
function SelectionAvailable: boolean; override;
|
||||
function GetText(OnlySelection: boolean): string; override;
|
||||
Procedure SelectText(LineNum, CharStart, LineNum2, CharEnd: Integer); override;
|
||||
procedure SelectText(const StartPos, EndPos: TPoint); override;
|
||||
procedure ReplaceLines(StartLine, EndLine: integer; const NewText: string); override;
|
||||
procedure EncloseSelection;
|
||||
procedure UpperCaseSelection;
|
||||
@ -257,6 +257,8 @@ type
|
||||
function GetSelStart: Integer; override;
|
||||
procedure SetSelEnd(const AValue: Integer); override;
|
||||
procedure SetSelStart(const AValue: Integer); override;
|
||||
function GetSelection: string; override;
|
||||
procedure SetSelection(const AValue: string); override;
|
||||
procedure CopyToClipboard; override;
|
||||
procedure CutToClipboard; override;
|
||||
|
||||
@ -1705,6 +1707,16 @@ begin
|
||||
FEditor.SelStart:=AValue;
|
||||
end;
|
||||
|
||||
function TSourceEditor.GetSelection: string;
|
||||
begin
|
||||
Result:=FEditor.SelText;
|
||||
end;
|
||||
|
||||
procedure TSourceEditor.SetSelection(const AValue: string);
|
||||
begin
|
||||
FEditor.SelText:=AValue;
|
||||
end;
|
||||
|
||||
procedure TSourceEditor.CopyToClipboard;
|
||||
begin
|
||||
FEditor.CopyToClipboard;
|
||||
@ -2102,16 +2114,10 @@ Begin
|
||||
FEditor.CaretY := Num;
|
||||
end;
|
||||
|
||||
Procedure TSourceEditor.SelectText(LineNum,CharStart,LineNum2,CharEnd: Integer);
|
||||
var
|
||||
P: TPoint;
|
||||
Procedure TSourceEditor.SelectText(const StartPos, EndPos: TPoint);
|
||||
Begin
|
||||
P.X := CharStart;
|
||||
P.Y := LineNum;
|
||||
FEditor.BlockBegin := P;
|
||||
P.X := CharEnd;
|
||||
P.Y := LineNum2;
|
||||
FEditor.BlockEnd := P;
|
||||
FEditor.BlockBegin := StartPos;
|
||||
FEditor.BlockEnd := EndPos;
|
||||
end;
|
||||
|
||||
procedure TSourceEditor.ReplaceLines(StartLine, EndLine: integer;
|
||||
|
@ -33,6 +33,8 @@ type
|
||||
|
||||
TSourceEditorInterface = class
|
||||
protected
|
||||
function GetSelection: string;
|
||||
procedure SetSelection(const AValue: string);
|
||||
function GetBlockBegin: TPoint; virtual; abstract;
|
||||
function GetBlockEnd: TPoint; virtual; abstract;
|
||||
function GetCodeToolsBuffer: TObject; virtual; abstract;
|
||||
@ -62,7 +64,8 @@ type
|
||||
// selections
|
||||
function SelectionAvailable: boolean; virtual; abstract;
|
||||
function GetText(OnlySelection: boolean): string; virtual; abstract;
|
||||
procedure SelectText(LineNum, CharStart, LineNum2, CharEnd: Integer); virtual; abstract;
|
||||
procedure SelectText(LineNum, CharStart, LineNum2, CharEnd: Integer);
|
||||
procedure SelectText(const StartPos, EndPos: TPoint); virtual; abstract;
|
||||
procedure ReplaceLines(StartLine, EndLine: integer; const NewText: string); virtual; abstract;
|
||||
procedure CopyToClipboard; virtual; abstract;
|
||||
procedure CutToClipboard; virtual; abstract;
|
||||
@ -105,6 +108,7 @@ type
|
||||
property SelStart: Integer read GetSelStart write SetSelStart;
|
||||
property SourceText: string read GetSourceText write SetSourceText;
|
||||
property TopLine: Integer read GetTopLine write SetTopLine;
|
||||
property Selection: string read GetSelection write SetSelection;
|
||||
end;
|
||||
|
||||
{ TSourceEditorWindowInterface }
|
||||
@ -123,5 +127,13 @@ var
|
||||
|
||||
implementation
|
||||
|
||||
{ TSourceEditorInterface }
|
||||
|
||||
procedure TSourceEditorInterface.SelectText(LineNum, CharStart, LineNum2,
|
||||
CharEnd: Integer);
|
||||
begin
|
||||
SelectText(Point(CharStart,LineNum),Point(CharEnd,LineNum2));
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user