SynEdit: CaretRespondsToFocus

git-svn-id: trunk@27096 -
This commit is contained in:
martin 2010-08-14 19:09:25 +00:00
parent 76e6393192
commit abc928b804
2 changed files with 13 additions and 1 deletions

View File

@ -7111,7 +7111,7 @@ begin
if (eoDropFiles in ChangedOptions) and not (csDesigning in ComponentState) and HandleAllocated then if (eoDropFiles in ChangedOptions) and not (csDesigning in ComponentState) and HandleAllocated then
; // ToDo DragAcceptFiles ; // ToDo DragAcceptFiles
if (eoPersistentCaret in ChangedOptions) and HandleAllocated then begin if (eoPersistentCaret in ChangedOptions) and HandleAllocated then begin
SetCaretRespondToFocus(Handle,not (eoPersistentCaret in fOptions)); FScreenCaret.PersistentCaret := eoPersistentCaret in fOptions;
UpdateCaret; UpdateCaret;
end; end;
if (eoShowSpecialChars in ChangedOptions) and HandleAllocated then if (eoShowSpecialChars in ChangedOptions) and HandleAllocated then

View File

@ -268,6 +268,7 @@ type
procedure SetDisplayType(const AType: TSynCaretType); procedure SetDisplayType(const AType: TSynCaretType);
procedure SetVisible(const AValue: Boolean); procedure SetVisible(const AValue: Boolean);
private private
FPersistentCaret: Boolean;
FPixelWidth, FPixelHeight: Integer; FPixelWidth, FPixelHeight: Integer;
FOffsetX, FOffsetY: Integer; FOffsetX, FOffsetY: Integer;
FCurrentPosX, FCurrentPosY: Integer; FCurrentPosX, FCurrentPosY: Integer;
@ -280,6 +281,7 @@ type
procedure SetClipRect(const AValue: TRect); procedure SetClipRect(const AValue: TRect);
procedure SetClipTop(const AValue: Integer); procedure SetClipTop(const AValue: Integer);
procedure SetHandle(const AValue: HWND); procedure SetHandle(const AValue: HWND);
procedure SetPersistentCaret(const AValue: Boolean);
procedure UpdateDisplayType; procedure UpdateDisplayType;
procedure UpdateDisplay; procedure UpdateDisplay;
procedure ShowCaret; procedure ShowCaret;
@ -305,6 +307,7 @@ type
property ExtraLineChars: Integer read FExtraLineChars; // Extend the longest line by x chars property ExtraLineChars: Integer read FExtraLineChars; // Extend the longest line by x chars
property OnExtraLineCharsChanged: TNotifyEvent property OnExtraLineCharsChanged: TNotifyEvent
read FOnExtraLineCharsChanged write FOnExtraLineCharsChanged; read FOnExtraLineCharsChanged write FOnExtraLineCharsChanged;
property PersistentCaret: Boolean read FPersistentCaret write SetPersistentCaret;
end; end;
implementation implementation
@ -1682,6 +1685,14 @@ begin
UpdateDisplay; UpdateDisplay;
end; end;
procedure TSynEditScreenCaret.SetPersistentCaret(const AValue: Boolean);
begin
if FPersistentCaret = AValue then exit;
FPersistentCaret := AValue;
if FCurrentCreated then
SetCaretRespondToFocus(Handle, not FPersistentCaret);
end;
procedure TSynEditScreenCaret.SetClipBottom(const AValue: Integer); procedure TSynEditScreenCaret.SetClipBottom(const AValue: Integer);
begin begin
if FClipBottom = AValue then exit; if FClipBottom = AValue then exit;
@ -1752,6 +1763,7 @@ begin
FCurrentVisible := False; FCurrentVisible := False;
FCurrentClippedWidth := w; FCurrentClippedWidth := w;
FCurrentPosX := x - 1; FCurrentPosX := x - 1;
SetCaretRespondToFocus(Handle, not FPersistentCaret);
end; end;
if (x <> FCurrentPosX) or (y <> FCurrentPosY) then if (x <> FCurrentPosX) or (y <> FCurrentPosY) then
SetCaretPosEx(FHandle, x, y); SetCaretPosEx(FHandle, x, y);