mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-05 19:46:01 +02:00
SourceEditor: Added logging/debugln
git-svn-id: trunk@37310 -
This commit is contained in:
parent
43b55bf526
commit
3b402f3e72
@ -45,7 +45,7 @@ uses
|
|||||||
SynEditMouseCmds,
|
SynEditMouseCmds,
|
||||||
Classes, SysUtils, Math, Controls, ExtendedNotebook, LCLProc, LCLType, LResources,
|
Classes, SysUtils, Math, Controls, ExtendedNotebook, LCLProc, LCLType, LResources,
|
||||||
LCLIntf, FileUtil, Forms, ComCtrls, Dialogs, StdCtrls, Graphics, Translations,
|
LCLIntf, FileUtil, Forms, ComCtrls, Dialogs, StdCtrls, Graphics, Translations,
|
||||||
ClipBrd, types, Extctrls, Menus, HelpIntfs, LConvEncoding, Messages,
|
ClipBrd, types, Extctrls, Menus, HelpIntfs, LConvEncoding, Messages, LazLoggerBase,
|
||||||
// codetools
|
// codetools
|
||||||
BasicCodeTools, CodeBeautifier, CodeToolManager, CodeCache, SourceLog,
|
BasicCodeTools, CodeBeautifier, CodeToolManager, CodeCache, SourceLog,
|
||||||
// synedit
|
// synedit
|
||||||
@ -551,6 +551,12 @@ type
|
|||||||
);
|
);
|
||||||
TSourceNotebookStates = set of TSourceNotebookState;
|
TSourceNotebookStates = set of TSourceNotebookState;
|
||||||
|
|
||||||
|
TSourceNotebookUpdateFlag = (
|
||||||
|
ufPageNames, ufTabsAndPage, ufStatusBar, ufProjectFiles,
|
||||||
|
ufFocusEditor, ufActiveEditorChanged
|
||||||
|
);
|
||||||
|
TSourceNotebookUpdateFlags = set of TSourceNotebookUpdateFlag;
|
||||||
|
|
||||||
{ TSourceNotebook }
|
{ TSourceNotebook }
|
||||||
|
|
||||||
TSourceNotebook = class(TSourceEditorWindowInterface)
|
TSourceNotebook = class(TSourceEditorWindowInterface)
|
||||||
@ -598,7 +604,7 @@ type
|
|||||||
private
|
private
|
||||||
FManager: TSourceEditorManager;
|
FManager: TSourceEditorManager;
|
||||||
FUpdateLock, FFocusLock: Integer;
|
FUpdateLock, FFocusLock: Integer;
|
||||||
FUpdateFlags: set of (ufPageNames, ufTabsAndPage, ufStatusBar, ufProjectFiles, ufFocusEditor, ufActiveEditorChanged);
|
FUpdateFlags: TSourceNotebookUpdateFlags;
|
||||||
FPageIndex: Integer;
|
FPageIndex: Integer;
|
||||||
fAutoFocusLock: integer;
|
fAutoFocusLock: integer;
|
||||||
FIncrementalSearchPos: TPoint; // last set position
|
FIncrementalSearchPos: TPoint; // last set position
|
||||||
@ -1244,6 +1250,9 @@ implementation
|
|||||||
|
|
||||||
{$R *.lfm}
|
{$R *.lfm}
|
||||||
|
|
||||||
|
var
|
||||||
|
SRCED_LOCK, SRCED_OPEN, SRCED_CLOSE, SRCED_PAGES: PLazLoggerLogGroup;
|
||||||
|
|
||||||
const
|
const
|
||||||
(* SoftCenter are th visible Lines in the Editor where the caret can be locateted,
|
(* SoftCenter are th visible Lines in the Editor where the caret can be locateted,
|
||||||
without CenterCursor adjusting the topline.
|
without CenterCursor adjusting the topline.
|
||||||
@ -1259,6 +1268,21 @@ var
|
|||||||
SourceCompletionCaretXY: TPoint;
|
SourceCompletionCaretXY: TPoint;
|
||||||
AWordCompletion: TWordCompletion = nil;
|
AWordCompletion: TWordCompletion = nil;
|
||||||
|
|
||||||
|
function dbgs(AFlag: TSourceNotebookUpdateFlag): string; overload;
|
||||||
|
begin
|
||||||
|
WriteStr(Result, AFlag);
|
||||||
|
end;
|
||||||
|
function dbgs(AFlags: TSourceNotebookUpdateFlags): string; overload;
|
||||||
|
var i: TSourceNotebookUpdateFlag;
|
||||||
|
begin
|
||||||
|
for i := low(TSourceNotebookUpdateFlags) to high(TSourceNotebookUpdateFlags) do
|
||||||
|
if i in AFlags then begin
|
||||||
|
if Result <> '' then Result := Result + ',';
|
||||||
|
Result := Result + dbgs(i);
|
||||||
|
end;
|
||||||
|
Result := '['+ Result + ']';
|
||||||
|
end;
|
||||||
|
|
||||||
function SourceEditorManager: TSourceEditorManager;
|
function SourceEditorManager: TSourceEditorManager;
|
||||||
begin
|
begin
|
||||||
Result := TSourceEditorManager(SourceEditorManagerIntf);
|
Result := TSourceEditorManager(SourceEditorManagerIntf);
|
||||||
@ -2525,6 +2549,7 @@ end;
|
|||||||
|
|
||||||
destructor TSourceEditor.Destroy;
|
destructor TSourceEditor.Destroy;
|
||||||
begin
|
begin
|
||||||
|
DebugLnEnter(SRCED_CLOSE, ['TSourceEditor.Destroy ']);
|
||||||
if FInEditorChangedUpdating then begin
|
if FInEditorChangedUpdating then begin
|
||||||
debugln(['***** TSourceEditor.Destroy: FInEditorChangedUpdating was true']);
|
debugln(['***** TSourceEditor.Destroy: FInEditorChangedUpdating was true']);
|
||||||
DebugBoss.UnLockCommandProcessing;
|
DebugBoss.UnLockCommandProcessing;
|
||||||
@ -2548,6 +2573,7 @@ begin
|
|||||||
FSharedValues.RemoveSharedEditor(Self);
|
FSharedValues.RemoveSharedEditor(Self);
|
||||||
if FSharedValues.SharedEditorCount = 0 then
|
if FSharedValues.SharedEditorCount = 0 then
|
||||||
FreeAndNil(FSharedValues);
|
FreeAndNil(FSharedValues);
|
||||||
|
DebugLnExit(SRCED_CLOSE, ['TSourceEditor.Destroy ']);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------G O T O L I N E -----------------------------}
|
{------------------------------G O T O L I N E -----------------------------}
|
||||||
@ -2834,22 +2860,16 @@ end;
|
|||||||
|
|
||||||
Procedure TSourceEditor.FocusEditor;
|
Procedure TSourceEditor.FocusEditor;
|
||||||
Begin
|
Begin
|
||||||
{$IFDEF VerboseFocus}
|
DebugLnEnter(SRCED_PAGES, ['>> TSourceEditor.FocusEditor A ',PageName,' ',FEditor.Name]);
|
||||||
debugln('TSourceEditor.FocusEditor A ',PageName,' ',FEditor.Name);
|
|
||||||
{$ENDIF}
|
|
||||||
IDEWindowCreators.ShowForm(SourceNotebook,true);
|
IDEWindowCreators.ShowForm(SourceNotebook,true);
|
||||||
if FEditor.IsVisible then begin
|
if FEditor.IsVisible then begin
|
||||||
FEditor.SetFocus; // TODO: will cal EditorEnter, which does self.Activate => maybe lock, and do here?
|
FEditor.SetFocus; // TODO: will cal EditorEnter, which does self.Activate => maybe lock, and do here?
|
||||||
FSharedValues.SetActiveSharedEditor(Self);
|
FSharedValues.SetActiveSharedEditor(Self);
|
||||||
end else begin
|
end else begin
|
||||||
{$IFDEF VerboseFocus}
|
debugln(SRCED_PAGES, ['TSourceEditor.FocusEditor not IsVisible: ',PageName,' ',FEditor.Name]);
|
||||||
debugln('TSourceEditor.FocusEditor not IsVisible: ',PageName,' ',FEditor.Name);
|
|
||||||
{$ENDIF}
|
|
||||||
end;
|
end;
|
||||||
//DebugLn('TSourceEditor.FocusEditor ',dbgsName(FindOwnerControl(GetFocus)),' ',dbgs(GetFocus));
|
//DebugLn('TSourceEditor.FocusEditor ',dbgsName(FindOwnerControl(GetFocus)),' ',dbgs(GetFocus));
|
||||||
{$IFDEF VerboseFocus}
|
DebugLnExit(SRCED_PAGES, ['<< TSourceEditor.FocusEditor END ',PageName,' ',FEditor.Name]);
|
||||||
debugln('TSourceEditor.FocusEditor END ',PageName,' ',FEditor.Name);
|
|
||||||
{$ENDIF}
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Function TSourceEditor.GetReadOnly: Boolean;
|
Function TSourceEditor.GetReadOnly: Boolean;
|
||||||
@ -4376,6 +4396,7 @@ end;
|
|||||||
|
|
||||||
Function TSourceEditor.Close: Boolean;
|
Function TSourceEditor.Close: Boolean;
|
||||||
Begin
|
Begin
|
||||||
|
DebugLnEnter(SRCED_CLOSE, ['TSourceEditor.Close ShareCount=', FSharedValues.SharedEditorCount]);
|
||||||
Result := True;
|
Result := True;
|
||||||
Visible := False;
|
Visible := False;
|
||||||
Manager.EditorRemoved(Self);
|
Manager.EditorRemoved(Self);
|
||||||
@ -4383,6 +4404,7 @@ Begin
|
|||||||
FEditor.Parent:=nil;
|
FEditor.Parent:=nil;
|
||||||
if FSharedValues.SharedEditorCount = 1 then
|
if FSharedValues.SharedEditorCount = 1 then
|
||||||
CodeBuffer := nil;
|
CodeBuffer := nil;
|
||||||
|
DebugLnExit(SRCED_CLOSE, ['TSourceEditor.Close ']);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSourceEditor.BeginUndoBlock{$IFDEF SynUndoDebugBeginEnd}(ACaller: String = ''){$ENDIF};
|
procedure TSourceEditor.BeginUndoBlock{$IFDEF SynUndoDebugBeginEnd}(ACaller: String = ''){$ENDIF};
|
||||||
@ -4527,6 +4549,7 @@ procedure TSourceEditor.EditorEnter(Sender: TObject);
|
|||||||
var
|
var
|
||||||
SrcEdit: TSourceEditor;
|
SrcEdit: TSourceEditor;
|
||||||
begin
|
begin
|
||||||
|
debugln(SRCED_PAGES, ['TSourceEditor.EditorEnter ']);
|
||||||
if (FSourceNoteBook.FUpdateLock <> 0) or
|
if (FSourceNoteBook.FUpdateLock <> 0) or
|
||||||
(FSourceNoteBook.FFocusLock <> 0)
|
(FSourceNoteBook.FFocusLock <> 0)
|
||||||
then exit;
|
then exit;
|
||||||
@ -5189,6 +5212,7 @@ destructor TSourceNotebook.Destroy;
|
|||||||
var
|
var
|
||||||
i: integer;
|
i: integer;
|
||||||
begin
|
begin
|
||||||
|
DebugLnEnter(SRCED_CLOSE, ['TSourceNotebook.Destroy ']);
|
||||||
if assigned(Manager) then
|
if assigned(Manager) then
|
||||||
Manager.RemoveWindow(Self);
|
Manager.RemoveWindow(Self);
|
||||||
DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TSourceNotebook.Destroy'){$ENDIF};
|
DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TSourceNotebook.Destroy'){$ENDIF};
|
||||||
@ -5208,6 +5232,7 @@ begin
|
|||||||
FreeAndNil(FNotebook);
|
FreeAndNil(FNotebook);
|
||||||
|
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
|
DebugLnExit(SRCED_CLOSE, ['TSourceNotebook.Destroy ']);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSourceNotebook.DeactivateCompletionForm;
|
procedure TSourceNotebook.DeactivateCompletionForm;
|
||||||
@ -5852,6 +5877,7 @@ end;
|
|||||||
|
|
||||||
procedure TSourceNotebook.SetPageIndex(const AValue: Integer);
|
procedure TSourceNotebook.SetPageIndex(const AValue: Integer);
|
||||||
begin
|
begin
|
||||||
|
DebugLnEnter(SRCED_PAGES, ['>> TSourceNotebook.SetPageIndex Cur-PgIdx=', PageIndex, ' FPageIndex=', FPageIndex, ' Value=', AValue, ' FUpdateLock=', FUpdateLock]);
|
||||||
FPageIndex := AValue;
|
FPageIndex := AValue;
|
||||||
if FUpdateLock = 0 then begin
|
if FUpdateLock = 0 then begin
|
||||||
FPageIndex := Max(0, Min(FPageIndex, FNotebook.PageCount-1));
|
FPageIndex := Max(0, Min(FPageIndex, FNotebook.PageCount-1));
|
||||||
@ -5864,6 +5890,7 @@ begin
|
|||||||
NotebookPageChanged(nil);
|
NotebookPageChanged(nil);
|
||||||
HistorySetMostRecent(FNotebook.Pages[FPageIndex]);
|
HistorySetMostRecent(FNotebook.Pages[FPageIndex]);
|
||||||
end;
|
end;
|
||||||
|
DebugLnExit(SRCED_PAGES, ['<< TSourceNotebook.SetPageIndex ']);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TSourceNotebook.GetCompletionBoxPosition: integer;
|
function TSourceNotebook.GetCompletionBoxPosition: integer;
|
||||||
@ -6069,7 +6096,7 @@ procedure TSourceNotebook.DoClose(var CloseAction: TCloseAction);
|
|||||||
var
|
var
|
||||||
Layout: TSimpleWindowLayout;
|
Layout: TSimpleWindowLayout;
|
||||||
begin
|
begin
|
||||||
//debugln(['TSourceNotebook.DoClose ',DbgSName(Self)]);
|
DebugLnEnter(SRCED_CLOSE, ['TSourceNotebook.DoClose ', DbgSName(self)]);
|
||||||
inherited DoClose(CloseAction);
|
inherited DoClose(CloseAction);
|
||||||
CloseAction := caHide;
|
CloseAction := caHide;
|
||||||
{$IFnDEF SingleSrcWindow}
|
{$IFnDEF SingleSrcWindow}
|
||||||
@ -6092,6 +6119,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
DebugLnExit(SRCED_CLOSE, ['TSourceNotebook.DoClose ']);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSourceNotebook.DoShow;
|
procedure TSourceNotebook.DoShow;
|
||||||
@ -6268,6 +6296,7 @@ procedure TSourceNotebook.IncUpdateLockInternal;
|
|||||||
begin
|
begin
|
||||||
if FUpdateLock = 0 then begin
|
if FUpdateLock = 0 then begin
|
||||||
FUpdateFlags := [];
|
FUpdateFlags := [];
|
||||||
|
DebugLn(SRCED_LOCK, ['TSourceNotebook.IncUpdateLockInternal']);
|
||||||
end;
|
end;
|
||||||
inc(FUpdateLock);
|
inc(FUpdateLock);
|
||||||
end;
|
end;
|
||||||
@ -6276,6 +6305,7 @@ procedure TSourceNotebook.DecUpdateLockInternal;
|
|||||||
begin
|
begin
|
||||||
dec(FUpdateLock);
|
dec(FUpdateLock);
|
||||||
if FUpdateLock = 0 then begin
|
if FUpdateLock = 0 then begin
|
||||||
|
DebugLnEnter(SRCED_LOCK, ['>> TSourceNotebook.DecUpdateLockInternal UpdateFlags=', dbgs(FUpdateFlags), ' PageIndex=', FPageIndex]);
|
||||||
PageIndex := FPageIndex;
|
PageIndex := FPageIndex;
|
||||||
if (ufPageNames in FUpdateFlags) then UpdatePageNames;
|
if (ufPageNames in FUpdateFlags) then UpdatePageNames;
|
||||||
if (ufTabsAndPage in FUpdateFlags) then UpdateTabsAndPageTitle;
|
if (ufTabsAndPage in FUpdateFlags) then UpdateTabsAndPageTitle;
|
||||||
@ -6284,6 +6314,7 @@ begin
|
|||||||
if (ufFocusEditor in FUpdateFlags) then FocusEditor;
|
if (ufFocusEditor in FUpdateFlags) then FocusEditor;
|
||||||
if (ufActiveEditorChanged in FUpdateFlags) then DoActiveEditorChanged;
|
if (ufActiveEditorChanged in FUpdateFlags) then DoActiveEditorChanged;
|
||||||
FUpdateFlags := [];
|
FUpdateFlags := [];
|
||||||
|
DebugLnExit(SRCED_LOCK, ['<< TSourceNotebook.DecUpdateLockInternal']);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -6316,6 +6347,7 @@ end;
|
|||||||
|
|
||||||
procedure TSourceNotebook.NoteBookDeletePage(APageIndex: Integer);
|
procedure TSourceNotebook.NoteBookDeletePage(APageIndex: Integer);
|
||||||
begin
|
begin
|
||||||
|
DebugLnEnter(SRCED_PAGES, ['TSourceNotebook.NoteBookDeletePage ', APageIndex]);
|
||||||
HistoryRemove(FNotebook.Pages[APageIndex]);
|
HistoryRemove(FNotebook.Pages[APageIndex]);
|
||||||
if PageCount > 1 then begin
|
if PageCount > 1 then begin
|
||||||
// make sure to select another page in the NoteBook, otherwise the
|
// make sure to select another page in the NoteBook, otherwise the
|
||||||
@ -6339,6 +6371,7 @@ begin
|
|||||||
end else
|
end else
|
||||||
FNotebook.Visible := False;
|
FNotebook.Visible := False;
|
||||||
UpdateTabsAndPageTitle;
|
UpdateTabsAndPageTitle;
|
||||||
|
DebugLnExit(SRCED_PAGES, ['TSourceNotebook.NoteBookDeletePage ']);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSourceNotebook.UpdateTabsAndPageTitle;
|
procedure TSourceNotebook.UpdateTabsAndPageTitle;
|
||||||
@ -6387,11 +6420,14 @@ end;
|
|||||||
procedure TSourceNotebook.DoActiveEditorChanged;
|
procedure TSourceNotebook.DoActiveEditorChanged;
|
||||||
begin
|
begin
|
||||||
if FUpdateLock > 0 then begin
|
if FUpdateLock > 0 then begin
|
||||||
|
DebugLn(SRCED_PAGES, ['TSourceNotebook.DoActiveEditorChanged LOCKED']);
|
||||||
include(FUpdateFlags, ufActiveEditorChanged);
|
include(FUpdateFlags, ufActiveEditorChanged);
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
exclude(FUpdateFlags, ufActiveEditorChanged);
|
exclude(FUpdateFlags, ufActiveEditorChanged);
|
||||||
|
DebugLnEnter(SRCED_PAGES, ['>> TSourceNotebook.DoActiveEditorChanged ']);
|
||||||
Manager.DoActiveEditorChanged;
|
Manager.DoActiveEditorChanged;
|
||||||
|
DebugLnExit(SRCED_PAGES, ['<< TSourceNotebook.DoActiveEditorChanged ']);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSourceNotebook.BeginIncrementalFind;
|
procedure TSourceNotebook.BeginIncrementalFind;
|
||||||
@ -6952,9 +6988,7 @@ var
|
|||||||
s: String;
|
s: String;
|
||||||
Begin
|
Begin
|
||||||
//create a new page
|
//create a new page
|
||||||
{$IFDEF IDE_DEBUG}
|
debugln(SRCED_OPEN, '[TSourceNotebook.NewFile] A ');
|
||||||
debugln('[TSourceNotebook.NewFile] A ');
|
|
||||||
{$ENDIF}
|
|
||||||
// Debugger cause ProcessMessages, which could lead to entering methods in unexpected order
|
// Debugger cause ProcessMessages, which could lead to entering methods in unexpected order
|
||||||
DebugBoss.LockCommandProcessing;
|
DebugBoss.LockCommandProcessing;
|
||||||
try
|
try
|
||||||
@ -6963,13 +6997,9 @@ Begin
|
|||||||
IDEWindowCreators.ShowForm(Self,false);
|
IDEWindowCreators.ShowForm(Self,false);
|
||||||
s := Manager.FindUniquePageName(NewShortName, AShareEditor);
|
s := Manager.FindUniquePageName(NewShortName, AShareEditor);
|
||||||
Result := NewSE(-1, -1, AShareEditor, s);
|
Result := NewSE(-1, -1, AShareEditor, s);
|
||||||
{$IFDEF IDE_DEBUG}
|
debugln(SRCED_OPEN, '[TSourceNotebook.NewFile] B ');
|
||||||
debugln('[TSourceNotebook.NewFile] B ');
|
|
||||||
{$ENDIF}
|
|
||||||
Result.CodeBuffer:=ASource;
|
Result.CodeBuffer:=ASource;
|
||||||
{$IFDEF IDE_DEBUG}
|
debugln(SRCED_OPEN, '[TSourceNotebook.NewFile] D ');
|
||||||
debugln('[TSourceNotebook.NewFile] D ');
|
|
||||||
{$ENDIF}
|
|
||||||
//debugln(['TSourceNotebook.NewFile ',NewShortName,' ',ASource.Filename]);
|
//debugln(['TSourceNotebook.NewFile ',NewShortName,' ',ASource.Filename]);
|
||||||
Result.PageName:= s;
|
Result.PageName:= s;
|
||||||
UpdatePageNames;
|
UpdatePageNames;
|
||||||
@ -6983,9 +7013,7 @@ Begin
|
|||||||
finally
|
finally
|
||||||
DebugBoss.UnLockCommandProcessing;
|
DebugBoss.UnLockCommandProcessing;
|
||||||
end;
|
end;
|
||||||
{$IFDEF IDE_DEBUG}
|
debugln(SRCED_OPEN, '[TSourceNotebook.NewFile] end');
|
||||||
debugln('[TSourceNotebook.NewFile] end');
|
|
||||||
{$ENDIF}
|
|
||||||
CheckFont;
|
CheckFont;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -6995,23 +7023,20 @@ var
|
|||||||
WasSelected: Boolean;
|
WasSelected: Boolean;
|
||||||
begin
|
begin
|
||||||
(* Do not use DisableAutoSizing in here, if a new Editor is focused it needs immediate autosize (during handle creation) *)
|
(* Do not use DisableAutoSizing in here, if a new Editor is focused it needs immediate autosize (during handle creation) *)
|
||||||
{$IFDEF IDE_DEBUG}
|
// Inc/DecUpdateLockInternal does currently noth work, since a tab will be removed
|
||||||
debugln(['TSourceNotebook.CloseFile A APageIndex=',APageIndex]);
|
DebugLnEnter(SRCED_CLOSE, ['>> TSourceNotebook.CloseFile A APageIndex=',APageIndex, ' Cur-Page=', PageIndex]);
|
||||||
{$ENDIF}
|
|
||||||
DebugBoss.LockCommandProcessing;
|
DebugBoss.LockCommandProcessing;
|
||||||
try
|
try
|
||||||
TempEditor:=FindSourceEditorWithPageIndex(APageIndex);
|
TempEditor:=FindSourceEditorWithPageIndex(APageIndex);
|
||||||
if TempEditor=nil then exit;
|
if TempEditor=nil then exit;
|
||||||
WasSelected:=PageIndex=APageIndex;
|
WasSelected:=PageIndex=APageIndex;
|
||||||
//debugln(['TSourceNotebook.CloseFile ',TempEditor.FileName,' ',TempEditor.APageIndex]);
|
debugln(SRCED_CLOSE, ['TSourceNotebook.CloseFile ', DbgSName(TempEditor), ' ', TempEditor.FileName]);
|
||||||
EndIncrementalFind;
|
EndIncrementalFind;
|
||||||
TempEditor.Close;
|
TempEditor.Close;
|
||||||
NoteBookDeletePage(APageIndex); // delete page before sending notification senEditorDestroyed
|
NoteBookDeletePage(APageIndex); // delete page before sending notification senEditorDestroyed
|
||||||
TempEditor.Free;
|
TempEditor.Free; // sends semEditorDestroy
|
||||||
TempEditor:=nil;
|
TempEditor:=nil;
|
||||||
// delete the page
|
// delete the page
|
||||||
//debugln('TSourceNotebook.CloseFile B APageIndex=',APageIndex,' PageCount=',PageCount,' NoteBook.APageIndex=',Notebook.APageIndex);
|
|
||||||
//debugln('TSourceNotebook.CloseFile C APageIndex=',APageIndex,' PageCount=',PageCount,' NoteBook.APageIndex=',Notebook.APageIndex);
|
|
||||||
UpdateProjectFiles;
|
UpdateProjectFiles;
|
||||||
UpdatePageNames;
|
UpdatePageNames;
|
||||||
if WasSelected then
|
if WasSelected then
|
||||||
@ -7030,11 +7055,10 @@ begin
|
|||||||
if IsVisible and (TempEditor <> nil) and (FUpdateLock = 0) then
|
if IsVisible and (TempEditor <> nil) and (FUpdateLock = 0) then
|
||||||
TempEditor.EditorComponent.SetFocus;
|
TempEditor.EditorComponent.SetFocus;
|
||||||
finally
|
finally
|
||||||
|
debugln(SRCED_CLOSE, ['TSourceNotebook.CloseFile UnLock']);
|
||||||
DebugBoss.UnLockCommandProcessing;
|
DebugBoss.UnLockCommandProcessing;
|
||||||
|
DebugLnExit(SRCED_CLOSE, ['<< TSourceNotebook.CloseFile']);
|
||||||
end;
|
end;
|
||||||
{$IFDEF IDE_DEBUG}
|
|
||||||
debugln('TSourceNotebook.CloseFile END');
|
|
||||||
{$ENDIF}
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSourceNotebook.FocusEditor;
|
procedure TSourceNotebook.FocusEditor;
|
||||||
@ -7409,12 +7433,14 @@ Begin
|
|||||||
Include(States, snNotbookPageChangedNeeded);
|
Include(States, snNotbookPageChangedNeeded);
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
DebugLnEnter(SRCED_PAGES, ['>> TSourceNotebook.NotebookPageChanged PageIndex=', PageIndex, ' AutoFocusLock=', fAutoFocusLock]);
|
||||||
|
|
||||||
Exclude(States, snNotbookPageChangedNeeded);
|
Exclude(States, snNotbookPageChangedNeeded);
|
||||||
TempEditor:=GetActiveSE;
|
TempEditor:=GetActiveSE;
|
||||||
if (FHintWindow <> nil) and FHintWindow.Visible then
|
if (FHintWindow <> nil) and FHintWindow.Visible then
|
||||||
HideHint;
|
HideHint;
|
||||||
|
|
||||||
//debugln('TSourceNotebook.NotebookPageChanged ',Pageindex,' ',TempEditor <> nil,' fAutoFocusLock=',fAutoFocusLock);
|
DebugLn(SRCED_PAGES, ['TSourceNotebook.NotebookPageChanged TempEdit=', DbgSName(TempEditor)]);
|
||||||
if TempEditor <> nil then
|
if TempEditor <> nil then
|
||||||
begin
|
begin
|
||||||
if not TempEditor.Visible then begin
|
if not TempEditor.Visible then begin
|
||||||
@ -7433,17 +7459,9 @@ Begin
|
|||||||
not(Manager.HasAutoFocusLock)
|
not(Manager.HasAutoFocusLock)
|
||||||
then
|
then
|
||||||
begin
|
begin
|
||||||
{$IFDEF VerboseFocus}
|
DebugLnEnter(SRCED_PAGES, ['TSourceNotebook.NotebookPageChanged BEFORE SetFocus ', DbgSName(TempEditor.EditorComponent),' Page=', FindPageWithEditor(TempEditor), ' ', TempEditor.FileName]);
|
||||||
debugln('TSourceNotebook.NotebookPageChanged BEFORE SetFocus ',
|
|
||||||
TempEditor.EditorComponent.Name,' ',
|
|
||||||
NoteBookPages[FindPageWithEditor(TempEditor)]);
|
|
||||||
{$ENDIF}
|
|
||||||
TempEditor.FocusEditor; // recursively calls NotebookPageChanged, via EditorEnter
|
TempEditor.FocusEditor; // recursively calls NotebookPageChanged, via EditorEnter
|
||||||
{$IFDEF VerboseFocus}
|
DebugLnExit(SRCED_PAGES, ['TSourceNotebook.NotebookPageChanged AFTER SetFocus ', DbgSName(TempEditor.EditorComponent),' Page=', FindPageWithEditor(TempEditor)]);
|
||||||
debugln('TSourceNotebook.NotebookPageChanged AFTER SetFocus ',
|
|
||||||
TempEditor.EditorComponent.Name,' ',
|
|
||||||
NotebookPages[FindPageWithEditor(TempEditor)]);
|
|
||||||
{$ENDIF}
|
|
||||||
end;
|
end;
|
||||||
UpdateStatusBar;
|
UpdateStatusBar;
|
||||||
UpdateActiveEditColors(TempEditor.EditorComponent);
|
UpdateActiveEditColors(TempEditor.EditorComponent);
|
||||||
@ -7455,6 +7473,7 @@ Begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
CheckCurrentCodeBufferChanged;
|
CheckCurrentCodeBufferChanged;
|
||||||
|
DebugLnExit(SRCED_PAGES, ['<< TSourceNotebook.NotebookPageChanged ']);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Procedure TSourceNotebook.ProcessParentCommand(Sender: TObject;
|
Procedure TSourceNotebook.ProcessParentCommand(Sender: TObject;
|
||||||
@ -9696,6 +9715,11 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
initialization
|
initialization
|
||||||
|
SRCED_LOCK := DebugLogger.RegisterLogGroup('SRCED_LOCK' {$IFDEF SRCED_LOCK} , True {$ENDIF} );
|
||||||
|
SRCED_OPEN := DebugLogger.RegisterLogGroup('SRCED_OPEN' {$IFDEF SRCED_OPEN} , True {$ENDIF} );
|
||||||
|
SRCED_CLOSE := DebugLogger.RegisterLogGroup('SRCED_CLOSE' {$IFDEF SRCED_CLOSE} , True {$ENDIF} );
|
||||||
|
SRCED_PAGES := DebugLogger.RegisterLogGroup('SRCED_PAGES' {$IFDEF SRCED_PAGES} , True {$ENDIF} );
|
||||||
|
|
||||||
InternalInit;
|
InternalInit;
|
||||||
{$I ../images/bookmark.lrs}
|
{$I ../images/bookmark.lrs}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user