diff --git a/ide/main.pp b/ide/main.pp index e33fa8c352..ef63b00d1d 100644 --- a/ide/main.pp +++ b/ide/main.pp @@ -1948,7 +1948,7 @@ end; procedure TMainIDE.SetupSourceNotebook; begin TSourceEditorManager.Create(OwningComponent); - SourceEditorManager.OnWindowActivate := @OnSrcNoteBookActivated; + SourceEditorManager.RegisterChangeEvent(semWindowFocused, @OnSrcNoteBookActivated); SourceEditorManager.OnAddJumpPoint := @OnSrcNoteBookAddJumpPoint; SourceEditorManager.OnCloseClicked := @OnSrcNotebookFileClose; SourceEditorManager.OnClickLink := @OnSrcNoteBookClickLink; diff --git a/ide/sourceeditor.pp b/ide/sourceeditor.pp index abe8267987..808a869f01 100644 --- a/ide/sourceeditor.pp +++ b/ide/sourceeditor.pp @@ -845,6 +845,7 @@ type function GetActiveSourceWindow: TSourceEditorWindowInterface; override; procedure SetActiveSourceWindow(const AValue: TSourceEditorWindowInterface); override; function GetSourceWindows(Index: integer): TSourceEditorWindowInterface; override; + procedure DoWindowFocused(AWindow: TSourceNotebook); // Includes Focus to ChildControl (aka Activated) function GetActiveEditor: TSourceEditorInterface; override; procedure SetActiveEditor(const AValue: TSourceEditorInterface); override; procedure DoActiveEditorChanged; @@ -1054,9 +1055,7 @@ type FOnToggleObjectInspClicked: TNotifyEvent; FOnUserCommandProcessed: TOnUserCommandProcessed; FOnViewJumpHistory: TNotifyEvent; - FOnWindowActivate: TNotifyEvent; public - property OnWindowActivate: TNotifyEvent read FOnWindowActivate write FOnWindowActivate; property OnAddJumpPoint: TOnAddJumpPoint read FOnAddJumpPoint write FOnAddJumpPoint; property OnCloseClicked: TOnCloseSrcEditor @@ -7225,8 +7224,8 @@ begin inherited Activate; if assigned(Manager) then Manager.ActiveSourceWindow := self; - if assigned(Manager) and assigned(Manager.OnWindowActivate) then - Manager.OnWindowActivate(self); + if assigned(Manager) then + Manager.DoWindowFocused(Self); end; procedure TSourceNotebook.UpdateActiveEditColors(AEditor: TSynEdit); @@ -7661,6 +7660,11 @@ begin Result := TSourceEditorWindowInterface(FSourceWindowList[Index]); end; +procedure TSourceEditorManagerBase.DoWindowFocused(AWindow: TSourceNotebook); +begin + FChangeNotifyLists[semWindowFocused].CallNotifyEvents(FActiveWindow); +end; + function TSourceEditorManagerBase.GetActiveEditor: TSourceEditorInterface; begin If FActiveWindow <> nil then @@ -8785,7 +8789,6 @@ var begin Result := TSourceNotebook.Create(Self); Result.FreeNotification(self); - Result.OnActivate := OnWindowActivate; Result.OnDropFiles := @OnFilesDroping; for i := 1 to FUpdateLock do