SourceEditor: Refactor, Clean-up

git-svn-id: trunk@24769 -
This commit is contained in:
martin 2010-04-20 23:08:53 +00:00
parent c0c2421905
commit c1060830fd
2 changed files with 9 additions and 6 deletions

View File

@ -1948,7 +1948,7 @@ end;
procedure TMainIDE.SetupSourceNotebook; procedure TMainIDE.SetupSourceNotebook;
begin begin
TSourceEditorManager.Create(OwningComponent); TSourceEditorManager.Create(OwningComponent);
SourceEditorManager.OnWindowActivate := @OnSrcNoteBookActivated; SourceEditorManager.RegisterChangeEvent(semWindowFocused, @OnSrcNoteBookActivated);
SourceEditorManager.OnAddJumpPoint := @OnSrcNoteBookAddJumpPoint; SourceEditorManager.OnAddJumpPoint := @OnSrcNoteBookAddJumpPoint;
SourceEditorManager.OnCloseClicked := @OnSrcNotebookFileClose; SourceEditorManager.OnCloseClicked := @OnSrcNotebookFileClose;
SourceEditorManager.OnClickLink := @OnSrcNoteBookClickLink; SourceEditorManager.OnClickLink := @OnSrcNoteBookClickLink;

View File

@ -845,6 +845,7 @@ type
function GetActiveSourceWindow: TSourceEditorWindowInterface; override; function GetActiveSourceWindow: TSourceEditorWindowInterface; override;
procedure SetActiveSourceWindow(const AValue: TSourceEditorWindowInterface); override; procedure SetActiveSourceWindow(const AValue: TSourceEditorWindowInterface); override;
function GetSourceWindows(Index: integer): TSourceEditorWindowInterface; override; function GetSourceWindows(Index: integer): TSourceEditorWindowInterface; override;
procedure DoWindowFocused(AWindow: TSourceNotebook); // Includes Focus to ChildControl (aka Activated)
function GetActiveEditor: TSourceEditorInterface; override; function GetActiveEditor: TSourceEditorInterface; override;
procedure SetActiveEditor(const AValue: TSourceEditorInterface); override; procedure SetActiveEditor(const AValue: TSourceEditorInterface); override;
procedure DoActiveEditorChanged; procedure DoActiveEditorChanged;
@ -1054,9 +1055,7 @@ type
FOnToggleObjectInspClicked: TNotifyEvent; FOnToggleObjectInspClicked: TNotifyEvent;
FOnUserCommandProcessed: TOnUserCommandProcessed; FOnUserCommandProcessed: TOnUserCommandProcessed;
FOnViewJumpHistory: TNotifyEvent; FOnViewJumpHistory: TNotifyEvent;
FOnWindowActivate: TNotifyEvent;
public public
property OnWindowActivate: TNotifyEvent read FOnWindowActivate write FOnWindowActivate;
property OnAddJumpPoint: TOnAddJumpPoint property OnAddJumpPoint: TOnAddJumpPoint
read FOnAddJumpPoint write FOnAddJumpPoint; read FOnAddJumpPoint write FOnAddJumpPoint;
property OnCloseClicked: TOnCloseSrcEditor property OnCloseClicked: TOnCloseSrcEditor
@ -7225,8 +7224,8 @@ begin
inherited Activate; inherited Activate;
if assigned(Manager) then if assigned(Manager) then
Manager.ActiveSourceWindow := self; Manager.ActiveSourceWindow := self;
if assigned(Manager) and assigned(Manager.OnWindowActivate) then if assigned(Manager) then
Manager.OnWindowActivate(self); Manager.DoWindowFocused(Self);
end; end;
procedure TSourceNotebook.UpdateActiveEditColors(AEditor: TSynEdit); procedure TSourceNotebook.UpdateActiveEditColors(AEditor: TSynEdit);
@ -7661,6 +7660,11 @@ begin
Result := TSourceEditorWindowInterface(FSourceWindowList[Index]); Result := TSourceEditorWindowInterface(FSourceWindowList[Index]);
end; end;
procedure TSourceEditorManagerBase.DoWindowFocused(AWindow: TSourceNotebook);
begin
FChangeNotifyLists[semWindowFocused].CallNotifyEvents(FActiveWindow);
end;
function TSourceEditorManagerBase.GetActiveEditor: TSourceEditorInterface; function TSourceEditorManagerBase.GetActiveEditor: TSourceEditorInterface;
begin begin
If FActiveWindow <> nil then If FActiveWindow <> nil then
@ -8785,7 +8789,6 @@ var
begin begin
Result := TSourceNotebook.Create(Self); Result := TSourceNotebook.Create(Self);
Result.FreeNotification(self); Result.FreeNotification(self);
Result.OnActivate := OnWindowActivate;
Result.OnDropFiles := @OnFilesDroping; Result.OnDropFiles := @OnFilesDroping;
for i := 1 to FUpdateLock do for i := 1 to FUpdateLock do