mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-07 11:38:18 +02:00
implemented auto ident completion after point plus idle
git-svn-id: trunk@7294 -
This commit is contained in:
parent
3c4f7a315b
commit
a27c24ae41
@ -4657,7 +4657,6 @@ begin
|
|||||||
Width:=MaxX-Left-Left;
|
Width:=MaxX-Left-Left;
|
||||||
Height:=110;
|
Height:=110;
|
||||||
Caption:='Automatic features';
|
Caption:='Automatic features';
|
||||||
Visible:=true;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
AutoIdentifierCompletionCheckBox:=TCheckBox.Create(Self);
|
AutoIdentifierCompletionCheckBox:=TCheckBox.Create(Self);
|
||||||
@ -4670,8 +4669,6 @@ begin
|
|||||||
Height:=20;
|
Height:=20;
|
||||||
Caption:=dlgEdIdComlet;
|
Caption:=dlgEdIdComlet;
|
||||||
Checked:=EditorOpts.AutoIdentifierCompletion;
|
Checked:=EditorOpts.AutoIdentifierCompletion;
|
||||||
Enabled:=false;
|
|
||||||
Visible:=true;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
AutoCodeParametersCheckBox:=TCheckBox.Create(Self);
|
AutoCodeParametersCheckBox:=TCheckBox.Create(Self);
|
||||||
@ -4686,7 +4683,6 @@ begin
|
|||||||
Caption:=dlgEdCodeParams;
|
Caption:=dlgEdCodeParams;
|
||||||
Checked:=EditorOpts.AutoCodeParameters;
|
Checked:=EditorOpts.AutoCodeParameters;
|
||||||
Enabled:=false;
|
Enabled:=false;
|
||||||
Visible:=true;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
AutoToolTipExprEvalCheckBox:=TCheckBox.Create(Self);
|
AutoToolTipExprEvalCheckBox:=TCheckBox.Create(Self);
|
||||||
@ -4700,7 +4696,6 @@ begin
|
|||||||
Caption:=dlgTooltipEval;
|
Caption:=dlgTooltipEval;
|
||||||
Checked:=EditorOpts.AutoToolTipExprEval;
|
Checked:=EditorOpts.AutoToolTipExprEval;
|
||||||
Enabled:=false;
|
Enabled:=false;
|
||||||
Visible:=true;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
AutoToolTipSymbToolsCheckBox:=TCheckBox.Create(Self);
|
AutoToolTipSymbToolsCheckBox:=TCheckBox.Create(Self);
|
||||||
@ -4713,7 +4708,6 @@ begin
|
|||||||
Height:=AutoIdentifierCompletionCheckBox.Height;
|
Height:=AutoIdentifierCompletionCheckBox.Height;
|
||||||
Caption:=dlgTooltipTools;
|
Caption:=dlgTooltipTools;
|
||||||
Checked:=EditorOpts.AutoToolTipSymbTools;
|
Checked:=EditorOpts.AutoToolTipSymbTools;
|
||||||
Visible:=true;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
AutoDelayLabel:=TLabel.Create(Self);
|
AutoDelayLabel:=TLabel.Create(Self);
|
||||||
@ -4725,7 +4719,6 @@ begin
|
|||||||
+AutoIdentifierCompletionCheckBox.Width+17;
|
+AutoIdentifierCompletionCheckBox.Width+17;
|
||||||
Width:=70;
|
Width:=70;
|
||||||
Caption:=dlgEdDelay;
|
Caption:=dlgEdDelay;
|
||||||
Visible:=true;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
AutoDelayTrackBar:=TTrackBar.Create(Self);
|
AutoDelayTrackBar:=TTrackBar.Create(Self);
|
||||||
@ -4741,7 +4734,6 @@ begin
|
|||||||
Height:=10;
|
Height:=10;
|
||||||
Position:=EditorOpts.AutoDelayInMSec div 250;
|
Position:=EditorOpts.AutoDelayInMSec div 250;
|
||||||
TickMarks:=tmBottomRight;
|
TickMarks:=tmBottomRight;
|
||||||
Visible:=true;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
AutoDelayMinLabel:=TLabel.Create(Self);
|
AutoDelayMinLabel:=TLabel.Create(Self);
|
||||||
@ -4753,7 +4745,6 @@ begin
|
|||||||
+AutoIdentifierCompletionCheckBox.Width+15;
|
+AutoIdentifierCompletionCheckBox.Width+15;
|
||||||
Width:=70;
|
Width:=70;
|
||||||
Caption:='0.5 ' + DlgTimeSecondUnit;
|
Caption:='0.5 ' + DlgTimeSecondUnit;
|
||||||
Visible:=true;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
AutoDelayMaxLabel:=TLabel.Create(Self);
|
AutoDelayMaxLabel:=TLabel.Create(Self);
|
||||||
@ -4764,7 +4755,6 @@ begin
|
|||||||
Left:=AutoDelayTrackBar.Left+AutoDelayTrackBar.Width-30;
|
Left:=AutoDelayTrackBar.Left+AutoDelayTrackBar.Width-30;
|
||||||
Width:=70;
|
Width:=70;
|
||||||
Caption:='1.5 '+ dlgTimeSecondUnit;
|
Caption:='1.5 '+ dlgTimeSecondUnit;
|
||||||
Visible:=true;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
CodeTemplatesGroupBox:=TGroupBox.Create(Self);
|
CodeTemplatesGroupBox:=TGroupBox.Create(Self);
|
||||||
@ -4777,7 +4767,6 @@ begin
|
|||||||
Height:=250;
|
Height:=250;
|
||||||
Caption:=dlgEdCodeTempl;
|
Caption:=dlgEdCodeTempl;
|
||||||
OnResize:=@CodeTemplatesGroupBoxResize;
|
OnResize:=@CodeTemplatesGroupBoxResize;
|
||||||
Visible:=true;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
CodeTemplateFileNameLabel:=TLabel.Create(Self);
|
CodeTemplateFileNameLabel:=TLabel.Create(Self);
|
||||||
@ -4788,7 +4777,6 @@ begin
|
|||||||
Left:=7;
|
Left:=7;
|
||||||
Width:=110;
|
Width:=110;
|
||||||
Caption:=dlgTplFName;
|
Caption:=dlgTplFName;
|
||||||
Visible:=true;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
CodeTemplateFileNameComboBox:=TComboBox.Create(Self);
|
CodeTemplateFileNameComboBox:=TComboBox.Create(Self);
|
||||||
@ -4802,7 +4790,6 @@ begin
|
|||||||
OnChange:=@ComboBoxOnChange;
|
OnChange:=@ComboBoxOnChange;
|
||||||
OnKeyDown:=@ComboBoxOnKeyDown;
|
OnKeyDown:=@ComboBoxOnKeyDown;
|
||||||
OnExit:=@ComboBoxOnExit;
|
OnExit:=@ComboBoxOnExit;
|
||||||
Visible:=true;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
CodeTemplateFileNameButton:=TButton.Create(Self);
|
CodeTemplateFileNameButton:=TButton.Create(Self);
|
||||||
@ -4815,7 +4802,6 @@ begin
|
|||||||
Height:=Width;
|
Height:=Width;
|
||||||
Caption:='...';
|
Caption:='...';
|
||||||
OnClick:=@CodeTemplateFileNameButtonClick;
|
OnClick:=@CodeTemplateFileNameButtonClick;
|
||||||
Visible:=true;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
CodeTemplateAddButton:=TButton.Create(Self);
|
CodeTemplateAddButton:=TButton.Create(Self);
|
||||||
@ -4828,7 +4814,6 @@ begin
|
|||||||
Height:=23;
|
Height:=23;
|
||||||
Caption:=dlgEdAdd;
|
Caption:=dlgEdAdd;
|
||||||
OnClick:=@CodeTemplateButtonClick;
|
OnClick:=@CodeTemplateButtonClick;
|
||||||
Visible:=true;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
CodeTemplateEditButton:=TButton.Create(Self);
|
CodeTemplateEditButton:=TButton.Create(Self);
|
||||||
@ -4841,7 +4826,6 @@ begin
|
|||||||
Height:=CodeTemplateAddButton.Height;
|
Height:=CodeTemplateAddButton.Height;
|
||||||
Caption:=dlgEdEdit;
|
Caption:=dlgEdEdit;
|
||||||
OnClick:=@CodeTemplateButtonClick;
|
OnClick:=@CodeTemplateButtonClick;
|
||||||
Visible:=true;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
CodeTemplateDeleteButton:=TButton.Create(Self);
|
CodeTemplateDeleteButton:=TButton.Create(Self);
|
||||||
@ -4854,7 +4838,6 @@ begin
|
|||||||
Height:=CodeTemplateAddButton.Height;
|
Height:=CodeTemplateAddButton.Height;
|
||||||
Caption:=dlgEdDelete;
|
Caption:=dlgEdDelete;
|
||||||
OnClick:=@CodeTemplateButtonClick;
|
OnClick:=@CodeTemplateButtonClick;
|
||||||
Visible:=true;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
CodeTemplatesLabel:=TLabel.Create(Self);
|
CodeTemplatesLabel:=TLabel.Create(Self);
|
||||||
@ -4865,7 +4848,6 @@ begin
|
|||||||
Left:=CodeTemplateAddButton.Left+CodeTemplateAddButton.Width+5;
|
Left:=CodeTemplateAddButton.Left+CodeTemplateAddButton.Width+5;
|
||||||
Width:=60;
|
Width:=60;
|
||||||
Caption:='Templates';
|
Caption:='Templates';
|
||||||
Visible:=true;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
CodeTemplateListBox:=TListBox.Create(Self);
|
CodeTemplateListBox:=TListBox.Create(Self);
|
||||||
@ -4877,7 +4859,6 @@ begin
|
|||||||
Width:=Parent.ClientWidth-8-Left;
|
Width:=Parent.ClientWidth-8-Left;
|
||||||
Height:=80;
|
Height:=80;
|
||||||
OnMouseUp:=@CodeTemplateListBoxMouseUp;
|
OnMouseUp:=@CodeTemplateListBoxMouseUp;
|
||||||
Visible:=true;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
CodeTemplateCodeLabel:=TLabel.Create(Self);
|
CodeTemplateCodeLabel:=TLabel.Create(Self);
|
||||||
@ -4889,7 +4870,6 @@ begin
|
|||||||
Width:=CodeTemplatesLabel.Width;
|
Width:=CodeTemplatesLabel.Width;
|
||||||
Height:=CodeTemplatesLabel.Height;
|
Height:=CodeTemplatesLabel.Height;
|
||||||
Caption:='Code';
|
Caption:='Code';
|
||||||
Visible:=true;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
CodeTemplateCodePreview:=TPreviewEditor.Create(Self);
|
CodeTemplateCodePreview:=TPreviewEditor.Create(Self);
|
||||||
@ -4902,7 +4882,6 @@ begin
|
|||||||
Height:=CodeTemplatesGroupBox.ClientHeight-20-Top;
|
Height:=CodeTemplatesGroupBox.ClientHeight-20-Top;
|
||||||
Lines.Clear;
|
Lines.Clear;
|
||||||
Gutter.Visible:=false;
|
Gutter.Visible:=false;
|
||||||
Visible:=true;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
CodeTemplateIndentTypeRadioGroup:=TRadioGroup.Create(Self);
|
CodeTemplateIndentTypeRadioGroup:=TRadioGroup.Create(Self);
|
||||||
@ -4920,7 +4899,6 @@ begin
|
|||||||
Add('Line start');
|
Add('Line start');
|
||||||
EndUpdate;
|
EndUpdate;
|
||||||
end;
|
end;
|
||||||
Visible:=true;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
CurCodeTemplate:=-1;
|
CurCodeTemplate:=-1;
|
||||||
|
@ -159,24 +159,23 @@ type
|
|||||||
procedure SetPopupMenu(NewPopupMenu: TPopupMenu);
|
procedure SetPopupMenu(NewPopupMenu: TPopupMenu);
|
||||||
function GetFilename: string;
|
function GetFilename: string;
|
||||||
|
|
||||||
Function GotoLine(Value: Integer): Integer;
|
function GotoLine(Value: Integer): Integer;
|
||||||
|
|
||||||
Procedure CreateEditor(AOwner: TComponent; AParent: TWinControl);
|
procedure CreateEditor(AOwner: TComponent; AParent: TWinControl);
|
||||||
procedure SetVisible(Value: boolean);
|
procedure SetVisible(Value: boolean);
|
||||||
protected
|
protected
|
||||||
ErrorMsgs: TStrings;
|
ErrorMsgs: TStrings;
|
||||||
Procedure ReParent(AParent: TWinControl);
|
procedure ReParent(AParent: TWinControl);
|
||||||
|
|
||||||
Procedure ProcessCommand(Sender: TObject;
|
procedure ProcessCommand(Sender: TObject;
|
||||||
var Command: TSynEditorCommand; var AChar: TUTF8Char; Data: pointer);
|
var Command: TSynEditorCommand; var AChar: TUTF8Char; Data: pointer);
|
||||||
Procedure ProcessUserCommand(Sender: TObject;
|
procedure ProcessUserCommand(Sender: TObject;
|
||||||
var Command: TSynEditorCommand; var AChar: TUTF8Char; Data: pointer);
|
var Command: TSynEditorCommand; var AChar: TUTF8Char; Data: pointer);
|
||||||
Procedure UserCommandProcessed(Sender: TObject;
|
procedure UserCommandProcessed(Sender: TObject;
|
||||||
var Command: TSynEditorCommand; var AChar: TUTF8Char; Data: pointer);
|
var Command: TSynEditorCommand; var AChar: TUTF8Char; Data: pointer);
|
||||||
Procedure ccOnTimer(sender: TObject);
|
procedure ccAddMessage(Texts: String);
|
||||||
Procedure ccAddMessage(Texts: String);
|
|
||||||
|
|
||||||
Procedure FocusEditor;// called by TSourceNotebook when the Notebook page
|
procedure FocusEditor;// called by TSourceNotebook when the Notebook page
|
||||||
// changes so the editor is focused
|
// changes so the editor is focused
|
||||||
procedure OnGutterClick(Sender: TObject; X, Y, Line: integer;
|
procedure OnGutterClick(Sender: TObject; X, Y, Line: integer;
|
||||||
mark: TSynEditMark);
|
mark: TSynEditMark);
|
||||||
@ -189,6 +188,7 @@ type
|
|||||||
procedure SetExecutionLine(NewLine: integer);
|
procedure SetExecutionLine(NewLine: integer);
|
||||||
procedure OnCodeBufferChanged(Sender: TSourceLog;
|
procedure OnCodeBufferChanged(Sender: TSourceLog;
|
||||||
SrcLogEntry: TSourceLogEntry);
|
SrcLogEntry: TSourceLogEntry);
|
||||||
|
procedure StartIdentCompletion;
|
||||||
|
|
||||||
procedure LinesInserted(sender: TObject; FirstLine,Count: Integer);
|
procedure LinesInserted(sender: TObject; FirstLine,Count: Integer);
|
||||||
procedure LinesDeleted(sender: TObject; FirstLine,Count: Integer);
|
procedure LinesDeleted(sender: TObject; FirstLine,Count: Integer);
|
||||||
@ -606,6 +606,7 @@ type
|
|||||||
AnEditor: TCustomSynEdit; var Index:integer);
|
AnEditor: TCustomSynEdit; var Index:integer);
|
||||||
procedure OnWordCompletionGetSource(
|
procedure OnWordCompletionGetSource(
|
||||||
var Source: TStrings; SourceIndex: integer);
|
var Source: TStrings; SourceIndex: integer);
|
||||||
|
procedure OnIdentCompletionTimer(Sender: TObject);
|
||||||
|
|
||||||
procedure FindReplaceDlgKey(Sender: TObject; var Key: Word;
|
procedure FindReplaceDlgKey(Sender: TObject; var Key: Word;
|
||||||
Shift:TShiftState; FindDlgComponent: TFindDlgComponent);
|
Shift:TShiftState; FindDlgComponent: TFindDlgComponent);
|
||||||
@ -685,7 +686,7 @@ var
|
|||||||
// active
|
// active
|
||||||
CurCompletionControl: TSynCompletion;
|
CurCompletionControl: TSynCompletion;
|
||||||
CurrentCompletionType: TCompletionType;
|
CurrentCompletionType: TCompletionType;
|
||||||
IdentCompletionTimer: TTimer;
|
IdentCompletionTimer: TIdleTimer;
|
||||||
AWordCompletion: TWordCompletion;
|
AWordCompletion: TWordCompletion;
|
||||||
|
|
||||||
GotoDialog: TfrmGoto;
|
GotoDialog: TfrmGoto;
|
||||||
@ -962,6 +963,8 @@ Procedure TSourceEditor.ProcessCommand(Sender: TObject;
|
|||||||
// these are normal commands for synedit, define extra actions here
|
// these are normal commands for synedit, define extra actions here
|
||||||
// otherwise use ProcessUserCommand
|
// otherwise use ProcessUserCommand
|
||||||
begin
|
begin
|
||||||
|
IdentCompletionTimer.AutoEnabled:=false;
|
||||||
|
|
||||||
if (FSourceNoteBook<>nil)
|
if (FSourceNoteBook<>nil)
|
||||||
and (snIncrementalFind in FSourceNoteBook.States) then begin
|
and (snIncrementalFind in FSourceNoteBook.States) then begin
|
||||||
case Command of
|
case Command of
|
||||||
@ -1011,13 +1014,21 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
ecChar:
|
||||||
|
begin
|
||||||
|
//debugln('TSourceEditor.ProcessCommand AChar="',AChar,'" AutoIdentifierCompletion=',dbgs(EditorOpts.AutoIdentifierCompletion),' Interval=',dbgs(IdentCompletionTimer.Interval));
|
||||||
|
if (AChar='.') and EditorOpts.AutoIdentifierCompletion then
|
||||||
|
IdentCompletionTimer.AutoEnabled:=true;
|
||||||
|
end;
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
//debugln('TSourceEditor.ProcessCommand B IdentCompletionTimer.AutoEnabled=',dbgs(IdentCompletionTimer.AutoEnabled));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Procedure TSourceEditor.ProcessUserCommand(Sender: TObject;
|
Procedure TSourceEditor.ProcessUserCommand(Sender: TObject;
|
||||||
var Command: TSynEditorCommand; var AChar: TUTF8Char; Data: pointer);
|
var Command: TSynEditorCommand; var AChar: TUTF8Char; Data: pointer);
|
||||||
// define all extra keys here, that should are not handled by synedit
|
// define all extra keys here, that should not be handled by synedit
|
||||||
var
|
var
|
||||||
I: Integer;
|
I: Integer;
|
||||||
P: TPoint;
|
P: TPoint;
|
||||||
@ -1035,24 +1046,7 @@ Begin
|
|||||||
FindHelpForSourceAtCursor;
|
FindHelpForSourceAtCursor;
|
||||||
|
|
||||||
ecIdentCompletion :
|
ecIdentCompletion :
|
||||||
if not TCustomSynEdit(Sender).ReadOnly then begin
|
StartIdentCompletion;
|
||||||
CurrentCompletionType:=ctIdentCompletion;
|
|
||||||
TextS := FEditor.LineText;
|
|
||||||
LogCaret:=FEditor.LogicalCaretXY;
|
|
||||||
i := LogCaret.X - 1;
|
|
||||||
if i > length(TextS) then
|
|
||||||
TextS2 := ''
|
|
||||||
else begin
|
|
||||||
while (i > 0) and (TextS[i] in ['a'..'z','A'..'Z','0'..'9','_']) do
|
|
||||||
dec(i);
|
|
||||||
TextS2 := Trim(copy(TextS, i + 1, LogCaret.X - i - 1));
|
|
||||||
end;
|
|
||||||
with TCustomSynEdit(Sender) do
|
|
||||||
P := ClientToScreen(Point(CaretXPix - length(TextS2)*CharWidth
|
|
||||||
,CaretYPix + LineHeight));
|
|
||||||
aCompletion.Editor:=TCustomSynEdit(Sender);
|
|
||||||
aCompletion.Execute(TextS2,P.X,P.Y);
|
|
||||||
end;
|
|
||||||
|
|
||||||
ecWordCompletion :
|
ecWordCompletion :
|
||||||
if not TCustomSynEdit(Sender).ReadOnly then begin
|
if not TCustomSynEdit(Sender).ReadOnly then begin
|
||||||
@ -1619,11 +1613,6 @@ Begin
|
|||||||
ErrorMsgs.Add(Texts);
|
ErrorMsgs.Add(Texts);
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Procedure TSourceEditor.ccOnTimer(sender: TObject);
|
|
||||||
Begin
|
|
||||||
IdentCompletionTimer.Enabled := False;
|
|
||||||
End;
|
|
||||||
|
|
||||||
Procedure TSourceEditor.CreateEditor(AOwner: TComponent; AParent: TWinControl);
|
Procedure TSourceEditor.CreateEditor(AOwner: TComponent; AParent: TWinControl);
|
||||||
var
|
var
|
||||||
NewName: string;
|
NewName: string;
|
||||||
@ -1780,6 +1769,34 @@ writeln('[TSourceEditor.OnCodeBufferChanged] A ',FIgnoreCodeBufferLock,' ',SrcLo
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TSourceEditor.StartIdentCompletion;
|
||||||
|
var
|
||||||
|
I: Integer;
|
||||||
|
P: TPoint;
|
||||||
|
TextS, TextS2: String;
|
||||||
|
LogCaret: TPoint;
|
||||||
|
begin
|
||||||
|
debugln('TSourceEditor.StartIdentCompletion');
|
||||||
|
if not FEditor.ReadOnly then begin
|
||||||
|
CurrentCompletionType:=ctIdentCompletion;
|
||||||
|
TextS := FEditor.LineText;
|
||||||
|
LogCaret:=FEditor.LogicalCaretXY;
|
||||||
|
i := LogCaret.X - 1;
|
||||||
|
if i > length(TextS) then
|
||||||
|
TextS2 := ''
|
||||||
|
else begin
|
||||||
|
while (i > 0) and (TextS[i] in ['a'..'z','A'..'Z','0'..'9','_']) do
|
||||||
|
dec(i);
|
||||||
|
TextS2 := Trim(copy(TextS, i + 1, LogCaret.X - i - 1));
|
||||||
|
end;
|
||||||
|
with FEditor do
|
||||||
|
P := ClientToScreen(Point(CaretXPix - length(TextS2)*CharWidth
|
||||||
|
,CaretYPix + LineHeight));
|
||||||
|
aCompletion.Editor:=FEditor;
|
||||||
|
aCompletion.Execute(TextS2,P.X,P.Y);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TSourceEditor.IncreaseIgnoreCodeBufferLock;
|
procedure TSourceEditor.IncreaseIgnoreCodeBufferLock;
|
||||||
begin
|
begin
|
||||||
inc(FIgnoreCodeBufferLock);
|
inc(FIgnoreCodeBufferLock);
|
||||||
@ -2194,9 +2211,14 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
// identifier completion
|
// identifier completion
|
||||||
IdentCompletionTimer := TTimer.Create(self);
|
IdentCompletionTimer := TIdleTimer.Create(Self);
|
||||||
IdentCompletionTimer.Enabled := False;
|
with IdentCompletionTimer do begin
|
||||||
IdentCompletionTimer.Interval := 500;
|
AutoEnabled := False;
|
||||||
|
Enabled := false;
|
||||||
|
Interval := EditorOpts.AutoDelayInMSec;
|
||||||
|
OnTimer := @OnIdentCompletionTimer;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
// marks
|
// marks
|
||||||
SourceEditorMarks:=TSourceMarks.Create(Self);
|
SourceEditorMarks:=TSourceMarks.Create(Self);
|
||||||
@ -2348,11 +2370,22 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TSourceNotebook.OnIdentCompletionTimer(Sender: TObject);
|
||||||
|
var
|
||||||
|
TempEditor: TSourceEditor;
|
||||||
|
begin
|
||||||
|
//debugln('TSourceNotebook.OnIdentCompletionTimer');
|
||||||
|
IdentCompletionTimer.Enabled:=false;
|
||||||
|
IdentCompletionTimer.AutoEnabled:=false;
|
||||||
|
TempEditor:=GetActiveSE;
|
||||||
|
if TempEditor<>nil then TempEditor.StartIdentCompletion;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TSourceNotebook.OnCodeTemplateTokenNotFound(Sender: TObject;
|
procedure TSourceNotebook.OnCodeTemplateTokenNotFound(Sender: TObject;
|
||||||
AToken: string; AnEditor: TCustomSynEdit; var Index:integer);
|
AToken: string; AnEditor: TCustomSynEdit; var Index:integer);
|
||||||
var P:TPoint;
|
var P:TPoint;
|
||||||
begin
|
begin
|
||||||
//writeln('RRRRRRRRRRR ',AToken,',',AnEditor.ReadOnly,',',CurrentCompletionType=ctNone);
|
//writeln('TSourceNotebook.OnCodeTemplateTokenNotFound ',AToken,',',AnEditor.ReadOnly,',',CurrentCompletionType=ctNone);
|
||||||
if (AnEditor.ReadOnly=false) and (CurrentCompletionType=ctNone) then begin
|
if (AnEditor.ReadOnly=false) and (CurrentCompletionType=ctNone) then begin
|
||||||
CurrentCompletionType:=ctTemplateCompletion;
|
CurrentCompletionType:=ctTemplateCompletion;
|
||||||
with AnEditor do
|
with AnEditor do
|
||||||
@ -2622,6 +2655,7 @@ end;
|
|||||||
|
|
||||||
Procedure TSourceNotebook.ccExecute(Sender: TObject);
|
Procedure TSourceNotebook.ccExecute(Sender: TObject);
|
||||||
// init completion form
|
// init completion form
|
||||||
|
// called by aCompletion.OnExecute just before showing
|
||||||
var
|
var
|
||||||
S: TStrings;
|
S: TStrings;
|
||||||
Prefix: String;
|
Prefix: String;
|
||||||
@ -4662,6 +4696,7 @@ end;
|
|||||||
procedure TSourceNotebook.OnApplicationUserInput(Sender: TObject; Msg: Cardinal
|
procedure TSourceNotebook.OnApplicationUserInput(Sender: TObject; Msg: Cardinal
|
||||||
);
|
);
|
||||||
begin
|
begin
|
||||||
|
//debugln('TSourceNotebook.OnApplicationUserInput');
|
||||||
HideHint;
|
HideHint;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -4689,6 +4724,7 @@ var
|
|||||||
CurHint: String;
|
CurHint: String;
|
||||||
begin
|
begin
|
||||||
// hide other hints
|
// hide other hints
|
||||||
|
//debugln('TSourceNotebook.ShowSynEditHint A');
|
||||||
Application.HideHint;
|
Application.HideHint;
|
||||||
//
|
//
|
||||||
ASrcEdit:=GetActiveSE;
|
ASrcEdit:=GetActiveSE;
|
||||||
@ -4918,13 +4954,13 @@ end;
|
|||||||
procedure TSynEditPlugin1.LinesDeleted(FirstLine, Count: integer);
|
procedure TSynEditPlugin1.LinesDeleted(FirstLine, Count: integer);
|
||||||
begin
|
begin
|
||||||
if Assigned(OnLinesDeleted) then
|
if Assigned(OnLinesDeleted) then
|
||||||
OnLinesDeleted(self,Firstline,Count);
|
OnLinesDeleted(self,Firstline,Count);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSynEditPlugin1.LinesInserted(FirstLine, Count: integer);
|
procedure TSynEditPlugin1.LinesInserted(FirstLine, Count: integer);
|
||||||
begin
|
begin
|
||||||
if Assigned(OnLinesInserted) then
|
if Assigned(OnLinesInserted) then
|
||||||
OnLinesInserted(self,Firstline,Count);
|
OnLinesInserted(self,Firstline,Count);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -309,10 +309,10 @@ type
|
|||||||
constructor Create(TheOwner: TComponent); override;
|
constructor Create(TheOwner: TComponent); override;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
property AutoEnabled: boolean read FAutoEnabled write SetAutoEnabled;
|
property AutoEnabled: boolean read FAutoEnabled write SetAutoEnabled;
|
||||||
property AutoEndEvent: TIdleTimerAutoEvent
|
|
||||||
read FAutoEndEvent write SetAutoEndEvent default itaOnIdle;
|
|
||||||
property AutoStartEvent: TIdleTimerAutoEvent
|
property AutoStartEvent: TIdleTimerAutoEvent
|
||||||
read FAutoStartEvent write SetAutoStartEvent default itaOnUserInput;
|
read FAutoStartEvent write SetAutoStartEvent default itaOnIdle;
|
||||||
|
property AutoEndEvent: TIdleTimerAutoEvent
|
||||||
|
read FAutoEndEvent write SetAutoEndEvent default itaOnUserInput;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -996,6 +996,9 @@ end.
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.137 2005/06/29 09:24:14 mattias
|
||||||
|
implemented auto ident completion after point plus idle
|
||||||
|
|
||||||
Revision 1.136 2005/05/09 14:52:33 vincents
|
Revision 1.136 2005/05/09 14:52:33 vincents
|
||||||
also invalidate control, if it is only moved, but not resized.
|
also invalidate control, if it is only moved, but not resized.
|
||||||
|
|
||||||
|
@ -67,8 +67,8 @@ end;
|
|||||||
constructor TIdleTimer.Create(TheOwner: TComponent);
|
constructor TIdleTimer.Create(TheOwner: TComponent);
|
||||||
begin
|
begin
|
||||||
inherited Create(TheOwner);
|
inherited Create(TheOwner);
|
||||||
FAutoEndEvent:=itaOnIdle;
|
FAutoStartEvent:=itaOnIdle;
|
||||||
FAutoStartEvent:=itaOnUserInput;
|
FAutoEndEvent:=itaOnUserInput;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
destructor TIdleTimer.Destroy;
|
destructor TIdleTimer.Destroy;
|
||||||
@ -80,7 +80,7 @@ end;
|
|||||||
procedure TIdleTimer.UpdateHandlers;
|
procedure TIdleTimer.UpdateHandlers;
|
||||||
begin
|
begin
|
||||||
if FAutoEnabled
|
if FAutoEnabled
|
||||||
and ([csDesigning,csLoading]*ComponentState=[]) then begin
|
and ([csDesigning,csLoading,csDestroying]*ComponentState=[]) then begin
|
||||||
// connect handlers
|
// connect handlers
|
||||||
if FHandlersConnected or (Application=nil) then exit;
|
if FHandlersConnected or (Application=nil) then exit;
|
||||||
Application.AddOnIdleHandler(@DoOnIdle,true);
|
Application.AddOnIdleHandler(@DoOnIdle,true);
|
||||||
|
Loading…
Reference in New Issue
Block a user