diff --git a/ide/uniteditor.pp b/ide/uniteditor.pp index 786ff045c5..5ab75a289e 100644 --- a/ide/uniteditor.pp +++ b/ide/uniteditor.pp @@ -2066,7 +2066,6 @@ end; Function TSourceEditor.RefreshEditorSettings: Boolean; Begin Result:=true; - EditorOpts. SetSyntaxHighlighterType(fSyntaxHighlighterType); EditorOpts.GetSynEditSettings(FEditor); SourceNotebook.UpdateActiveEditColors; diff --git a/lcl/controls.pp b/lcl/controls.pp index 3abbe6473a..c99047f842 100644 --- a/lcl/controls.pp +++ b/lcl/controls.pp @@ -1422,13 +1422,10 @@ type { TWinControlActionLink } - TWinControlActionLink = class(TControlActionLink) - protected - procedure AssignClient(AClient: TObject); override; - function IsHelpContextLinked: Boolean; override; - procedure SetHelpContext(Value: THelpContext); override; - end; - + // Since HelpContext and HelpKeyword are properties of TControl, + // this class is obsolete. In order not to break existing code, + // its declaration is aliased to TControlActionLink. + TWinControlActionLink = TControlActionLink; TWinControlActionLinkClass = class of TWinControlActionLink; @@ -1518,9 +1515,6 @@ type var BoundsModified: Boolean); protected FWinControlFlags: TWinControlFlags; - procedure AssignTo(Dest: TPersistent); override; - procedure ActionChange(Sender: TObject; CheckDefaults: Boolean); override; - function GetActionLinkClass: TControlActionLinkClass; override; procedure AdjustClientRect(var ARect: TRect); virtual; procedure AlignControls(AControl: TControl; var RemainingClientRect: TRect); virtual; diff --git a/lcl/include/control.inc b/lcl/include/control.inc index 362a3976dc..8bca437b85 100644 --- a/lcl/include/control.inc +++ b/lcl/include/control.inc @@ -591,21 +591,18 @@ end; ------------------------------------------------------------------------------} function TControl.IsHelpContextStored: boolean; begin - if ActionLink=nil then - Result := HelpContext<>0 - else - Result := not ActionLink.IsHelpContextLinked; + Result := (ActionLink = nil) or not ActionLink.IsHelpLinked; end; {------------------------------------------------------------------------------ function TControl.IsHelpKeyWordStored: boolean; ------------------------------------------------------------------------------} +// Using IsHelpContextLinked() for controlling HelpKeyword +// is not correct. Therefore, use IsHelpLinked which means that all 3 Help* properties +// must be equal. Also, this function becomes exactly the same as one just above. function TControl.IsHelpKeyWordStored: boolean; begin - if ActionLink=nil then - Result := HelpKeyword<>'' - else - Result := not ActionLink.IsHelpContextLinked; + Result := (ActionLink = nil) or not ActionLink.IsHelpLinked; end; function TControl.IsOnClickStored: Boolean; @@ -1358,6 +1355,11 @@ begin Visible := NewAction.Visible; if not CheckDefaults or not Assigned(OnClick) then OnClick := NewAction.OnExecute; + if not CheckDefaults or (Self.HelpContext = 0) then + Self.HelpContext := HelpContext; + if not CheckDefaults or (Self.HelpKeyword = '') then + Self.HelpKeyword := HelpKeyword; + // HelpType is set implicitly when assigning HelpContext or HelpKeyword end; end; @@ -2624,6 +2626,9 @@ begin Caption := Self.Caption; Visible := Self.Visible; OnExecute := Self.OnClick; + HelpContext := Self.HelpContext; + HelpKeyword := Self.HelpKeyword; + HelpType := Self.HelpType; end else inherited AssignTo(Dest); end; @@ -2925,6 +2930,8 @@ end; procedure TControl.SetHelpContext(const AValue: THelpContext); begin if FHelpContext=AValue then exit; + if not (csLoading in ComponentState) then + FHelpType := htContext; FHelpContext:=AValue; end; @@ -2934,6 +2941,8 @@ end; procedure TControl.SetHelpKeyword(const AValue: String); begin if FHelpKeyword=AValue then exit; + if not (csLoading in ComponentState) then + FHelpType := htKeyword; FHelpKeyword:=AValue; end; diff --git a/lcl/include/controlactionlink.inc b/lcl/include/controlactionlink.inc index 0eceb8c72c..ae3d60e55f 100644 --- a/lcl/include/controlactionlink.inc +++ b/lcl/include/controlactionlink.inc @@ -115,23 +115,4 @@ begin if IsHelpLinked then FClient.HelpType := Value; end; -{ TWinControlActionLink } - -procedure TWinControlActionLink.AssignClient(AClient: TObject); -begin - inherited AssignClient(AClient); - FClient := AClient as TWinControl; -end; - -function TWinControlActionLink.IsHelpContextLinked: Boolean; -begin - // only for Delphi compatibility - Result := IsHelpLinked; -end; - -procedure TWinControlActionLink.SetHelpContext(Value: THelpContext); -begin - inherited SetHelpContext(Value); -end; - // included by controls.pp diff --git a/lcl/include/wincontrol.inc b/lcl/include/wincontrol.inc index 1a19621970..43a97b5fd0 100644 --- a/lcl/include/wincontrol.inc +++ b/lcl/include/wincontrol.inc @@ -3629,27 +3629,6 @@ Begin end; end; -procedure TWinControl.AssignTo(Dest: TPersistent); -begin - inherited AssignTo(Dest); - if Dest is TCustomAction then - TCustomAction(Dest).HelpContext:=HelpContext; -end; - -procedure TWinControl.ActionChange(Sender: TObject; CheckDefaults: Boolean); -begin - inherited ActionChange(Sender,CheckDefaults); - if Sender is TCustomAction then - with TCustomAction(Sender) do - if (not CheckDefaults) or (Self.HelpContext = 0) then - Self.HelpContext := HelpContext; -end; - -function TWinControl.GetActionLinkClass: TControlActionLinkClass; -begin - Result := TWinControlActionLink; -end; - {------------------------------------------------------------------------------ TWinControl KeyDown ------------------------------------------------------------------------------}