SynEdit small optimization (unnecessary call to shiftstate)

git-svn-id: trunk@21010 -
This commit is contained in:
martin 2009-07-29 19:14:32 +00:00
parent a5da38b431
commit ea95a7e23c
2 changed files with 9 additions and 7 deletions

View File

@ -1765,7 +1765,8 @@ begin
UpdateScrollbars; UpdateScrollbars;
// must be past UpdateScrollbars; but before UpdateCaret (for ScrollBar-Auto-show) // must be past UpdateScrollbars; but before UpdateCaret (for ScrollBar-Auto-show)
if sfEnsureCursorPos in fStateFlags then if sfEnsureCursorPos in fStateFlags then
EnsureCursorPosVisible; EnsureCursorPosVisible; // TODO: This may call SetTopLine, change order
// This does Paintlock, should be before final decrease
// Must be after EnsureCursorPosVisible (as it does MoveCaretToVisibleArea) // Must be after EnsureCursorPosVisible (as it does MoveCaretToVisibleArea)
if sfCaretChanged in fStateFlags then if sfCaretChanged in fStateFlags then
UpdateCaret; UpdateCaret;
@ -1773,7 +1774,8 @@ begin
// UpdateScrollbars; // UpdateScrollbars;
if fStatusChanges <> [] then if fStatusChanges <> [] then
DoOnStatusChange(fStatusChanges); DoOnStatusChange(fStatusChanges);
fMarkupHighCaret.CheckState; // Todo need a global lock, including the markup fMarkupHighCaret.CheckState; // Todo: need a global lock, including the markup
// Todo: Markup can do invalidation, should be before ScrollAfterTopLineChanged;
end; end;
if (fPaintLock = 0) then if (fPaintLock = 0) then
FBlockSelection.AutoExtend := False; FBlockSelection.AutoExtend := False;
@ -2215,7 +2217,7 @@ begin
{$ENDIF} {$ENDIF}
inherited; inherited;
if assigned(fMarkupCtrlMouse) then if assigned(fMarkupCtrlMouse) then
fMarkupCtrlMouse.UpdateCtrlState; fMarkupCtrlMouse.UpdateCtrlState(Shift);
UpdateCursor; UpdateCursor;
Data := nil; Data := nil;
C := #0; C := #0;
@ -2266,7 +2268,7 @@ begin
{$ENDIF} {$ENDIF}
inherited KeyUp(Key, Shift); inherited KeyUp(Key, Shift);
if assigned(fMarkupCtrlMouse) then if assigned(fMarkupCtrlMouse) then
fMarkupCtrlMouse.UpdateCtrlState; fMarkupCtrlMouse.UpdateCtrlState(Shift);
UpdateCursor; UpdateCursor;
end; end;

View File

@ -51,7 +51,7 @@ type
protected protected
procedure SetLines(const AValue : TSynEditStrings); override; procedure SetLines(const AValue : TSynEditStrings); override;
public public
procedure UpdateCtrlState; procedure UpdateCtrlState(aShift: TShiftState);
procedure UpdateCtrlMouse; procedure UpdateCtrlMouse;
property LastMouseCaret: TPoint read FLastMouseCaret write SetLastMouseCaret; property LastMouseCaret: TPoint read FLastMouseCaret write SetLastMouseCaret;
public public
@ -95,9 +95,9 @@ begin
UpdateCtrlMouse; UpdateCtrlMouse;
end; end;
procedure TSynEditMarkupCtrlMouseLink.UpdateCtrlState; procedure TSynEditMarkupCtrlMouseLink.UpdateCtrlState(aShift: TShiftState);
begin begin
if FLastControlIsPressed <> IsCtrlMouseShiftState(GetKeyShiftState) then if FLastControlIsPressed <> IsCtrlMouseShiftState(aShift) then
UpdateCtrlMouse; UpdateCtrlMouse;
end; end;