mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-08 15:36:03 +02:00
IDE: completion form is now created on demand and the internal double buffer bitmap is resized correct
git-svn-id: trunk@11130 -
This commit is contained in:
parent
385b95d4f5
commit
8d7812da86
@ -642,6 +642,8 @@ begin
|
||||
{$ENDIF}
|
||||
Scroll.LargeChange := NbLinesInWindow;
|
||||
|
||||
bitmap.Width:=ClientWidth;
|
||||
bitmap.Height:=ClientHeight;
|
||||
with bitmap do begin
|
||||
{$IFNDEF SYN_LAZARUS}
|
||||
canvas.pen.color := fbcolor;
|
||||
|
@ -599,6 +599,7 @@ type
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
procedure InitMacros(AMacroList: TTransferMacroList);
|
||||
procedure CreateCompletionForm;
|
||||
|
||||
procedure ShowLazDoc;
|
||||
procedure UpdateLazDoc;
|
||||
@ -1450,6 +1451,7 @@ Begin
|
||||
|
||||
ecWordCompletion :
|
||||
if not TCustomSynEdit(Sender).ReadOnly then begin
|
||||
SourceNotebook.CreateCompletionForm;
|
||||
CurrentCompletionType:=ctWordCompletion;
|
||||
TextS := FEditor.LineText;
|
||||
LogCaret:=FEditor.LogicalCaretXY;
|
||||
@ -2118,7 +2120,8 @@ Begin
|
||||
end;
|
||||
if FCodeTemplates<>nil then
|
||||
FCodeTemplates.AddEditor(FEditor);
|
||||
aCompletion.AddEditor(FEditor);
|
||||
if aCompletion<>nil then
|
||||
aCompletion.AddEditor(FEditor);
|
||||
RefreshEditorSettings;
|
||||
FEditor.EndUpdate;
|
||||
end else begin
|
||||
@ -2246,7 +2249,7 @@ begin
|
||||
//debugln('TSourceEditor.StartIdentCompletion');
|
||||
if (FEditor.ReadOnly) or (CurrentCompletionType<>ctNone) then exit;
|
||||
SourceNotebook.fIdentCompletionJumpToError:=JumpToError;
|
||||
|
||||
SourceNotebook.CreateCompletionForm;
|
||||
CurrentCompletionType:=ctIdentCompletion;
|
||||
TextS := FEditor.LineText;
|
||||
LogCaret:=FEditor.LogicalCaretXY;
|
||||
@ -2414,7 +2417,8 @@ Begin
|
||||
FOnBeforeClose(Self);
|
||||
|
||||
Visible := False;
|
||||
aCompletion.RemoveEditor(FEditor);
|
||||
if aCompletion<>nil then
|
||||
aCompletion.RemoveEditor(FEditor);
|
||||
SourceEditorMarks.DeleteAllForEditor(FEditor);
|
||||
FEditor.Parent:=nil;
|
||||
CodeBuffer := nil;
|
||||
@ -2903,26 +2907,6 @@ begin
|
||||
// popup menu
|
||||
BuildPopupMenu;
|
||||
|
||||
// completion form
|
||||
aCompletion := TSynCompletion.Create(Self);
|
||||
with aCompletion do
|
||||
Begin
|
||||
EndOfTokenChr:='()[].,;:-+=^*<>/';
|
||||
Width:=400;
|
||||
OnExecute := @ccExecute;
|
||||
OnCancel := @ccCancel;
|
||||
OnCodeCompletion := @ccComplete;
|
||||
OnPaintItem:=@OnSynCompletionPaintItem;
|
||||
OnMeasureItem := @OnSynCompletionMeasureItem;
|
||||
OnSearchPosition:=@OnSynCompletionSearchPosition;
|
||||
OnKeyCompletePrefix:=@OnSynCompletionCompletePrefix;
|
||||
OnKeyNextChar:=@OnSynCompletionNextChar;
|
||||
OnKeyPrevChar:=@OnSynCompletionPrevChar;
|
||||
OnKeyPress:=@OnSynCompletionKeyPress;
|
||||
OnUTF8KeyPress:=@OnSynCompletionUTF8KeyPress;
|
||||
ShortCut:=Menus.ShortCut(VK_UNKNOWN,[]);
|
||||
end;
|
||||
|
||||
// HintTimer
|
||||
FHintTimer := TTimer.Create(Self);
|
||||
with FHintTimer do begin
|
||||
@ -2985,6 +2969,34 @@ begin
|
||||
lisPromptForValue,@MacroFuncPrompt,[tmfInteractive]));
|
||||
end;
|
||||
|
||||
procedure TSourceNotebook.CreateCompletionForm;
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
// completion form
|
||||
aCompletion := TSynCompletion.Create(Self);
|
||||
with aCompletion do
|
||||
Begin
|
||||
EndOfTokenChr:='()[].,;:-+=^*<>/';
|
||||
Width:=400;
|
||||
OnExecute := @ccExecute;
|
||||
OnCancel := @ccCancel;
|
||||
OnCodeCompletion := @ccComplete;
|
||||
OnPaintItem:=@OnSynCompletionPaintItem;
|
||||
OnMeasureItem := @OnSynCompletionMeasureItem;
|
||||
OnSearchPosition:=@OnSynCompletionSearchPosition;
|
||||
OnKeyCompletePrefix:=@OnSynCompletionCompletePrefix;
|
||||
OnKeyNextChar:=@OnSynCompletionNextChar;
|
||||
OnKeyPrevChar:=@OnSynCompletionPrevChar;
|
||||
OnKeyPress:=@OnSynCompletionKeyPress;
|
||||
OnUTF8KeyPress:=@OnSynCompletionUTF8KeyPress;
|
||||
ShortCut:=Menus.ShortCut(VK_UNKNOWN,[]);
|
||||
end;
|
||||
|
||||
for i:=0 to EditorCount-1 do
|
||||
aCompletion.AddEditor(Editors[i].FEditor);
|
||||
end;
|
||||
|
||||
procedure TSourceNotebook.ShowLazDoc;
|
||||
begin
|
||||
DoShowLazDoc;
|
||||
@ -3096,6 +3108,7 @@ var P:TPoint;
|
||||
begin
|
||||
//writeln('TSourceNotebook.OnCodeTemplateTokenNotFound ',AToken,',',AnEditor.ReadOnly,',',CurrentCompletionType=ctNone);
|
||||
if (AnEditor.ReadOnly=false) and (CurrentCompletionType=ctNone) then begin
|
||||
SourceNotebook.CreateCompletionForm;
|
||||
CurrentCompletionType:=ctTemplateCompletion;
|
||||
with AnEditor do begin
|
||||
P := Point(CaretXPix - length(AToken)*CharWidth,CaretYPix + LineHeight);
|
||||
|
@ -151,10 +151,7 @@ end;
|
||||
function TBitmap.GetCanvas: TCanvas;
|
||||
begin
|
||||
if FCanvas = nil then
|
||||
begin
|
||||
HandleNeeded;
|
||||
CreateCanvas;
|
||||
end;
|
||||
Result := FCanvas;
|
||||
end;
|
||||
|
||||
|
@ -7974,8 +7974,8 @@ begin
|
||||
Drawable := nil;
|
||||
end;
|
||||
if Drawable<>nil then begin
|
||||
//DebugLn('TGtkWidgetSet.SelectObject DC=',DbgS(DC),8),' GDIBitmap=',DbgS(Cardinal(CurrentBitmap),
|
||||
//' GDIBitmapType=',ord(CurrentBitmap^.GDIBitmapType),' Drawable=',DbgS(Drawable));
|
||||
//DebugLn(['TGtkWidgetSet.SelectObject DC=',DbgS(Pointer(DC)),' GDIBitmap=',DbgS(CurrentBitmap),
|
||||
//' GDIBitmapType=',ord(CurrentBitmap^.GDIBitmapType),' Drawable=',DbgS(Drawable)]);
|
||||
if GC <> nil then begin
|
||||
gdk_gc_unref(GC);
|
||||
GC:=nil;
|
||||
|
Loading…
Reference in New Issue
Block a user