Skip to content
Permalink
Browse files

Reactivate TSynHotKey again, after removing it accidentally in recent…

… SynEdit update. Should fix a crashing preferences dialog.
  • Loading branch information
ansgarbecker committed Nov 11, 2019
1 parent 66ebbca commit 98b75c492d4560a681cd0dce72763af9a3d3efed
Showing with 17 additions and 1 deletion.
  1. +16 −0 components/synedit/Source/SynEditMiscClasses.pas
  2. +1 −1 components/synedit/Source/SynEditReg.pas
@@ -338,6 +338,9 @@ TSynHotKey = class(TCustomControl)
FInvalidKeys: THKInvalidKeys;
FModifiers: THKModifiers;
FPressedOnlyModifiers: Boolean;
FOnChange: TNotifyEvent;
FOnEnter: TNotifyEvent;
FOnExit: TNotifyEvent;
procedure SetBorderStyle(const Value: TSynBorderStyle);
procedure SetHotKey(const Value: TShortCut);
procedure SetInvalidKeys(const Value: THKInvalidKeys);
@@ -360,6 +363,9 @@ TSynHotKey = class(TCustomControl)
property HotKey: TShortCut read FHotKey write SetHotKey default $0041; { Alt+A }
property InvalidKeys: THKInvalidKeys read FInvalidKeys write SetInvalidKeys default [hcNone, hcShift];
property Modifiers: THKModifiers read FModifiers write SetModifiers default [hkAlt];
property OnChange: TNotifyEvent read FOnChange write FOnChange;
property OnEnter: TNotifyEvent read FOnEnter write FOnEnter;
property OnExit: TNotifyEvent read FOnExit write FOnExit;
end;

TSynEditSearchCustom = class(TComponent)
@@ -1467,6 +1473,8 @@ procedure TSynHotKey.KeyDown(var Key: Word; Shift: TShiftState);
end;

Key := SavedKey;
if Assigned(FOnChange) then
FOnChange(Self);
end;

procedure TSynHotKey.KeyUp(var Key: Word; Shift: TShiftState);
@@ -1510,6 +1518,10 @@ procedure TSynHotKey.Paint;
Canvas.Brush.Color := Color;
InflateRect(r, -BorderWidth, -BorderWidth);
Canvas.FillRect(r);
if Enabled then
Canvas.Font.Color := clWindowText
else
Canvas.Font.Color := clGrayText;
TextRect(Canvas, r, BorderWidth + 1, BorderWidth + 1, Text);
end;

@@ -1561,6 +1573,8 @@ procedure TSynHotKey.WMGetDlgCode(var Message: TMessage);
procedure TSynHotKey.WMKillFocus(var Msg: TWMKillFocus);
begin
DestroyCaret;
if Assigned(FOnExit) then
FOnExit(Self);
end;

procedure TSynHotKey.WMSetFocus(var Msg: TWMSetFocus);
@@ -1569,6 +1583,8 @@ procedure TSynHotKey.WMSetFocus(var Msg: TWMSetFocus);
CreateCaret(Handle, 0, 1, -Canvas.Font.Height + 2);
SetCaretPos(BorderWidth + 1 + TextWidth(Canvas, Text), BorderWidth + 1);
ShowCaret(Handle);
if Assigned(FOnEnter) then
FOnEnter(Self);
end;


@@ -170,7 +170,7 @@ procedure Register;
TSynCompletionProposal, TSynAutoComplete, TSynMacroRecorder,
TSynEditPrint, TSynEditPrintPreview, TSynAutoCorrect,
TSynEditSearch, TSynEditRegexSearch, TSynEditOptionsDialog, TSynURIOpener,
TSynEditDocumentManager]);
TSynEditDocumentManager, TSynHotKey]);
{$IFDEF SYN_COMPILER_4_UP}
RegisterComponents(SYNS_ComponentsPage, [TSynHighlighterManager]);
{$ENDIF}

0 comments on commit 98b75c4

Please sign in to comment.
You can’t perform that action at this time.