mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-20 07:59:37 +01:00
This commit is contained in:
parent
0e94a6b1db
commit
7c60c7ce47
@ -206,6 +206,7 @@ type
|
||||
procedure IncHintLock;
|
||||
procedure DecHintLock;
|
||||
procedure DoOnDragResize(Sender: TObject);
|
||||
procedure ClearCurrentString;
|
||||
public
|
||||
constructor Create(AOwner: Tcomponent); override;
|
||||
destructor Destroy; override;
|
||||
@ -264,9 +265,22 @@ type
|
||||
|
||||
{ TSynBaseCompletion }
|
||||
|
||||
TSynBaseCompletion = class;
|
||||
TOnBeforeExeucteFlag = (befAbort);
|
||||
TOnBeforeExeucteFlags = set of TOnBeforeExeucteFlag;
|
||||
|
||||
TOnBeforeExecuteEvent = procedure(
|
||||
ASender: TSynBaseCompletion;
|
||||
var ACurrentString: String;
|
||||
var APosition: Integer; // Defaults to -1. If left at -1 position will be calculated from CurrentString
|
||||
var AnX, AnY: Integer; // Coordinates for the form
|
||||
var AnResult: TOnBeforeExeucteFlags
|
||||
) of object;
|
||||
|
||||
TSynBaseCompletion = class(TLazSynMultiEditPlugin)
|
||||
private
|
||||
FAutoUseSingleIdent: Boolean;
|
||||
FOnBeforeExecute: TOnBeforeExecuteEvent;
|
||||
Form: TSynBaseCompletionForm;
|
||||
FAddedPersistentCaret, FChangedNoneBlink: boolean;
|
||||
FOnExecute: TNotifyEvent;
|
||||
@ -342,6 +356,7 @@ type
|
||||
property ClSelect: TColor read GetClSelect write SetClSelect; deprecated; // use SelectedColor
|
||||
property NbLinesInWindow: Integer read GetNbLinesInWindow write SetNbLinesInWindow; deprecated;
|
||||
published
|
||||
property OnBeforeExecute: TOnBeforeExecuteEvent read FOnBeforeExecute write FOnBeforeExecute;
|
||||
property OnExecute: TNotifyEvent read FOnExecute write FOnExecute;
|
||||
property OnPaintItem: TSynBaseCompletionPaintItem
|
||||
read GetOnPaintItem write SetOnPaintItem;
|
||||
@ -1330,6 +1345,12 @@ begin
|
||||
FOnDragResized(Sender);
|
||||
end;
|
||||
|
||||
procedure TSynBaseCompletionForm.ClearCurrentString;
|
||||
begin
|
||||
FCurrentString := '';
|
||||
FPosition := 0;
|
||||
end;
|
||||
|
||||
procedure TSynBaseCompletionForm.SetItemList(const Value: TStrings);
|
||||
begin
|
||||
FItemList.Assign(Value);
|
||||
@ -1456,6 +1477,8 @@ end;
|
||||
procedure TSynBaseCompletion.Execute(s: string; x, y: integer);
|
||||
var
|
||||
CurSynEdit: TCustomSynEdit;
|
||||
p: Integer;
|
||||
r: TOnBeforeExeucteFlags;
|
||||
begin
|
||||
//writeln('TSynBaseCompletion.Execute ',Form.CurrentEditor.Name);
|
||||
|
||||
@ -1463,7 +1486,19 @@ begin
|
||||
FAddedPersistentCaret := False;
|
||||
FChangedNoneBlink := False;
|
||||
|
||||
Form.ClearCurrentString;
|
||||
p := -1;
|
||||
r := [];
|
||||
if Assigned(OnBeforeExecute) then
|
||||
OnBeforeExecute(Self, s, p, x, y, r);
|
||||
if befAbort in r then
|
||||
exit;
|
||||
|
||||
|
||||
CurrentString := s;
|
||||
if p >= 0 then
|
||||
Position := p;
|
||||
|
||||
if Assigned(OnExecute) then
|
||||
OnExecute(Self);
|
||||
if (ItemList.Count=1) and Assigned(OnValidate) and FAutoUseSingleIdent then begin
|
||||
|
||||
Loading…
Reference in New Issue
Block a user