mirror of https://gitlab.com/basile.b/dexed.git
start #353
This commit is contained in:
parent
c1375df3d0
commit
cd783ab90a
|
@ -60,6 +60,17 @@ type
|
||||||
AData: Pointer): TRect; override;
|
AData: Pointer): TRect; override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
// Specialized to allow displaying call tips, actual param in bold
|
||||||
|
TCEEditorCallTipWindow = class(TCEEditorHintWindow)
|
||||||
|
strict private
|
||||||
|
fIndexOfExpectedArg: integer;
|
||||||
|
public
|
||||||
|
function CalcHintRect(MaxWidth: Integer; const AHint: string;
|
||||||
|
AData: Pointer): TRect; override;
|
||||||
|
procedure Paint; override;
|
||||||
|
property indexOfExpectedArg: integer write fIndexOfExpectedArg;
|
||||||
|
end;
|
||||||
|
|
||||||
// Stores the state of a particular source code folding.
|
// Stores the state of a particular source code folding.
|
||||||
TCEFoldCache = class(TCollectionItem)
|
TCEFoldCache = class(TCollectionItem)
|
||||||
private
|
private
|
||||||
|
@ -188,7 +199,7 @@ type
|
||||||
fDefaultFontSize: Integer;
|
fDefaultFontSize: Integer;
|
||||||
fPositions: TCESynMemoPositions;
|
fPositions: TCESynMemoPositions;
|
||||||
fMousePos: TPoint;
|
fMousePos: TPoint;
|
||||||
fCallTipWin: TCEEditorHintWindow;
|
fCallTipWin: TCEEditorCallTipWindow;
|
||||||
fDDocWin: TCEEditorHintWindow;
|
fDDocWin: TCEEditorHintWindow;
|
||||||
fDDocDelay: Integer;
|
fDDocDelay: Integer;
|
||||||
fAutoDotDelay: Integer;
|
fAutoDotDelay: Integer;
|
||||||
|
@ -267,7 +278,7 @@ type
|
||||||
Selected: boolean; Index: integer): boolean;
|
Selected: boolean; Index: integer): boolean;
|
||||||
procedure completionCodeCompletion(var value: string; SourceValue: string;
|
procedure completionCodeCompletion(var value: string; SourceValue: string;
|
||||||
var SourceStart, SourceEnd: TPoint; KeyChar: TUTF8Char; Shift: TShiftState);
|
var SourceStart, SourceEnd: TPoint; KeyChar: TUTF8Char; Shift: TShiftState);
|
||||||
procedure showCallTipsString(const tips: string);
|
procedure showCallTipsString(const tips: string; indexOfExpected: integer);
|
||||||
function lexCanCloseBrace: boolean;
|
function lexCanCloseBrace: boolean;
|
||||||
function canInsertLeadingDdocSymbol: char;
|
function canInsertLeadingDdocSymbol: char;
|
||||||
procedure handleStatusChanged(Sender: TObject; Changes: TSynStatusChanges);
|
procedure handleStatusChanged(Sender: TObject; Changes: TSynStatusChanges);
|
||||||
|
@ -492,6 +503,58 @@ begin
|
||||||
Font.Size:= FontSize;
|
Font.Size:= FontSize;
|
||||||
result := inherited CalcHintRect(MaxWidth, AHint, AData);
|
result := inherited CalcHintRect(MaxWidth, AHint, AData);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TCEEditorCallTipWindow.CalcHintRect(MaxWidth: Integer; const AHint: String; AData: Pointer): TRect;
|
||||||
|
begin
|
||||||
|
Font.Style := Font.Style + [fsBold];
|
||||||
|
result := inherited CalcHintRect(MaxWidth, AHint, AData);
|
||||||
|
Font.Style := Font.Style - [fsBold];
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCEEditorCallTipWindow.Paint;
|
||||||
|
//var
|
||||||
|
//s: string;
|
||||||
|
//a: string;
|
||||||
|
//i: integer = 0;
|
||||||
|
//x: integer = 0;
|
||||||
|
//o: integer = 0;
|
||||||
|
//r: TStringRange = (ptr:nil; pos:0; len: 0);
|
||||||
|
//f: TFontStyles;
|
||||||
|
begin
|
||||||
|
//s := caption;
|
||||||
|
//caption := '';
|
||||||
|
inherited Paint;
|
||||||
|
//if s.isEmpty then
|
||||||
|
// exit;
|
||||||
|
//f := canvas.Font.Style;
|
||||||
|
//r.init(s);
|
||||||
|
//// func decl (TODO skip template params)
|
||||||
|
//a := r.takeUntil('(').yield + '(';
|
||||||
|
//o := x;
|
||||||
|
//x += canvas.TextWidth(a);
|
||||||
|
//canvas.TextOut(o, 0, a);
|
||||||
|
//r.popFront;
|
||||||
|
//// func args
|
||||||
|
//while not r.empty do
|
||||||
|
//begin
|
||||||
|
// a := r.takeUntil(',').yield;
|
||||||
|
// if not r.empty then
|
||||||
|
// begin
|
||||||
|
// r.popFrontN(2);
|
||||||
|
// a += ', ';
|
||||||
|
// end;
|
||||||
|
// o := x;
|
||||||
|
// if fIndexOfExpectedArg = i then
|
||||||
|
// canvas.Font.Style := canvas.Font.Style + [fsBold]
|
||||||
|
// else
|
||||||
|
// canvas.Font.Style := canvas.Font.Style - [fsBold];
|
||||||
|
// x += canvas.TextWidth(a);
|
||||||
|
// canvas.TextOut(o, 0, a);
|
||||||
|
// canvas.Font.Style := f;
|
||||||
|
// i += 1;
|
||||||
|
//end;
|
||||||
|
end;
|
||||||
|
|
||||||
{$REGION TSortDialog -----------------------------------------------------------}
|
{$REGION TSortDialog -----------------------------------------------------------}
|
||||||
constructor TSortDialog.construct(editor: TCESynMemo);
|
constructor TSortDialog.construct(editor: TCESynMemo);
|
||||||
var
|
var
|
||||||
|
@ -2537,7 +2600,7 @@ procedure TCESynMemo.InitHintWins;
|
||||||
begin
|
begin
|
||||||
if fCallTipWin.isNil then
|
if fCallTipWin.isNil then
|
||||||
begin
|
begin
|
||||||
fCallTipWin := TCEEditorHintWindow.Create(self);
|
fCallTipWin := TCEEditorCallTipWindow.Create(self);
|
||||||
fCallTipWin.Color := clInfoBk + $01010100;
|
fCallTipWin.Color := clInfoBk + $01010100;
|
||||||
fCallTipWin.Font.Color:= clInfoText;
|
fCallTipWin.Font.Color:= clInfoText;
|
||||||
end;
|
end;
|
||||||
|
@ -2553,6 +2616,7 @@ procedure TCESynMemo.showCallTips(findOpenParen: boolean = true);
|
||||||
var
|
var
|
||||||
str, lne: string;
|
str, lne: string;
|
||||||
i, x: integer;
|
i, x: integer;
|
||||||
|
j: integer = 0;
|
||||||
begin
|
begin
|
||||||
if not fIsDSource and not alwaysAdvancedFeatures then
|
if not fIsDSource and not alwaysAdvancedFeatures then
|
||||||
exit;
|
exit;
|
||||||
|
@ -2565,6 +2629,8 @@ begin
|
||||||
begin
|
begin
|
||||||
if i = 1 then
|
if i = 1 then
|
||||||
break;
|
break;
|
||||||
|
if str[i] = ',' then
|
||||||
|
j += 1;
|
||||||
if str[i-1] = '(' then
|
if str[i-1] = '(' then
|
||||||
begin
|
begin
|
||||||
LogicalCaretXY := Point(i, CaretY);
|
LogicalCaretXY := Point(i, CaretY);
|
||||||
|
@ -2597,14 +2663,14 @@ begin
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
str := str[1..str.length-1];
|
str := str[1..str.length-1];
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
showCallTipsString(str);
|
showCallTipsString(str, j);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
if findOpenParen then
|
if findOpenParen then
|
||||||
CaretX:=x;
|
CaretX:=x;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCESynMemo.showCallTipsString(const tips: string);
|
procedure TCESynMemo.showCallTipsString(const tips: string; indexOfExpected: integer);
|
||||||
var
|
var
|
||||||
pnt: TPoint;
|
pnt: TPoint;
|
||||||
begin
|
begin
|
||||||
|
@ -2612,6 +2678,7 @@ begin
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
pnt := ClientToScreen(point(CaretXPix, CaretYPix));
|
pnt := ClientToScreen(point(CaretXPix, CaretYPix));
|
||||||
|
fCallTipWin.indexOfExpectedArg:=indexOfExpected;
|
||||||
fCallTipWin.FontSize := Font.Size;
|
fCallTipWin.FontSize := Font.Size;
|
||||||
fCallTipWin.HintRect := fCallTipWin.CalcHintRect(0, tips, nil);
|
fCallTipWin.HintRect := fCallTipWin.CalcHintRect(0, tips, nil);
|
||||||
fCallTipWin.OffsetHintRect(pnt, Font.Size * 2);
|
fCallTipWin.OffsetHintRect(pnt, Font.Size * 2);
|
||||||
|
@ -2636,7 +2703,7 @@ begin
|
||||||
if fCallTipStrings.Count = 0 then
|
if fCallTipStrings.Count = 0 then
|
||||||
hideCallTips
|
hideCallTips
|
||||||
else
|
else
|
||||||
showCallTipsString(fCallTipStrings.Text);
|
showCallTipsString(fCallTipStrings.Text, 0);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCESynMemo.showDDocs;
|
procedure TCESynMemo.showDDocs;
|
||||||
|
@ -3479,8 +3546,11 @@ begin
|
||||||
case c of
|
case c of
|
||||||
#39: if autoCloseSingleQuote in fAutoClosedPairs then
|
#39: if autoCloseSingleQuote in fAutoClosedPairs then
|
||||||
autoClosePair(autoCloseSingleQuote);
|
autoClosePair(autoCloseSingleQuote);
|
||||||
',': if not fCallTipWin.Visible then
|
',':
|
||||||
|
begin
|
||||||
|
hideCallTips;
|
||||||
showCallTips(true);
|
showCallTips(true);
|
||||||
|
end;
|
||||||
'"': if autoCloseDoubleQuote in fAutoClosedPairs then
|
'"': if autoCloseDoubleQuote in fAutoClosedPairs then
|
||||||
autoClosePair(autoCloseDoubleQuote);
|
autoClosePair(autoCloseDoubleQuote);
|
||||||
'`': if autoCloseBackTick in fAutoClosedPairs then
|
'`': if autoCloseBackTick in fAutoClosedPairs then
|
||||||
|
|
Loading…
Reference in New Issue