mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-06 00:19:53 +01:00
DBG, SourceEditor: Prevent moving focus for auto continue breakpoints
git-svn-id: trunk@31101 -
This commit is contained in:
parent
7b9af3aeac
commit
97caca8832
131
ide/main.pp
131
ide/main.pp
@ -14876,71 +14876,76 @@ begin
|
||||
exit;
|
||||
end;
|
||||
|
||||
if (ActiveSrcEdit=nil) or (ActiveUnitInfo=nil) then
|
||||
GetCurrentUnit(ActiveSrcEdit,ActiveUnitInfo);
|
||||
|
||||
if AddJumpPoint and (ActiveUnitInfo <> nil) and (ActiveSrcEdit <> nil)
|
||||
then begin
|
||||
if (NewSource<>ActiveUnitInfo.Source)
|
||||
or (ActiveSrcEdit.EditorComponent.CaretX<>NewX)
|
||||
or (ActiveSrcEdit.EditorComponent.CaretY<>NewY) then
|
||||
SourceEditorManager.AddJumpPointClicked(Self);
|
||||
end;
|
||||
|
||||
if (ActiveUnitInfo = nil) or (NewSource<>ActiveUnitInfo.Source)
|
||||
then begin
|
||||
// jump to other file -> open it
|
||||
ActiveUnitInfo := Project1.UnitInfoWithFilename(NewSource.Filename);
|
||||
AnEditorInfo := nil;
|
||||
if ActiveUnitInfo <> nil then
|
||||
AnEditorInfo := GetAvailableUnitEditorInfo(ActiveUnitInfo, Point(NewX,NewY), NewTopLine);
|
||||
if AnEditorInfo <> nil then begin
|
||||
SourceEditorManager.ActiveEditor := TSourceEditor(AnEditorInfo.EditorComponent);
|
||||
Result := mrOK;
|
||||
end
|
||||
else
|
||||
Result:=DoOpenEditorFile(NewSource.Filename,-1,-1,
|
||||
[ofOnlyIfExists,ofRegularFile,ofDoNotLoadResource]);
|
||||
if Result<>mrOk then begin
|
||||
UpdateSourceNames;
|
||||
exit;
|
||||
end;
|
||||
NewSrcEdit := SourceEditorManager.ActiveEditor;
|
||||
end
|
||||
else begin
|
||||
AnEditorInfo := GetAvailableUnitEditorInfo(ActiveUnitInfo, Point(NewX,NewY), NewTopLine);
|
||||
if AnEditorInfo <> nil then begin
|
||||
NewSrcEdit := TSourceEditor(AnEditorInfo.EditorComponent);
|
||||
SourceEditorManager.ActiveEditor := NewSrcEdit;
|
||||
end
|
||||
else
|
||||
NewSrcEdit:=ActiveSrcEdit;
|
||||
end;
|
||||
if NewX<1 then NewX:=1;
|
||||
if NewY<1 then NewY:=1;
|
||||
//debugln(['[TMainIDE.DoJumpToCodePos] ',NewX,',',NewY,',',NewTopLine]);
|
||||
SourceEditorManager.BeginAutoFocusLock;
|
||||
try
|
||||
NewSrcEdit.BeginUpdate;
|
||||
NewSrcEdit.EditorComponent.MoveLogicalCaretIgnoreEOL(Point(NewX,NewY));
|
||||
if not NewSrcEdit.IsLocked then begin
|
||||
if NewTopLine < 1 then
|
||||
NewSrcEdit.CenterCursor(True)
|
||||
else
|
||||
NewSrcEdit.TopLine:=NewTopLine;
|
||||
end;
|
||||
//DebugLn('TMainIDE.DoJumpToCodePos NewY=',dbgs(NewY),' ',dbgs(TopLine),' ',dbgs(NewTopLine));
|
||||
with NewSrcEdit.EditorComponent do
|
||||
LeftChar:=Max(NewX - (CharsInWindow * 4 div 5), 1);
|
||||
finally
|
||||
NewSrcEdit.EndUpdate;
|
||||
end;
|
||||
if MarkLine then
|
||||
NewSrcEdit.ErrorLine := NewY;
|
||||
if (ActiveSrcEdit=nil) or (ActiveUnitInfo=nil) then
|
||||
GetCurrentUnit(ActiveSrcEdit,ActiveUnitInfo);
|
||||
|
||||
if FocusEditor then
|
||||
SourceEditorManager.ShowActiveWindowOnTop(True);
|
||||
UpdateSourceNames;
|
||||
Result:=mrOk;
|
||||
if AddJumpPoint and (ActiveUnitInfo <> nil) and (ActiveSrcEdit <> nil)
|
||||
then begin
|
||||
if (NewSource<>ActiveUnitInfo.Source)
|
||||
or (ActiveSrcEdit.EditorComponent.CaretX<>NewX)
|
||||
or (ActiveSrcEdit.EditorComponent.CaretY<>NewY) then
|
||||
SourceEditorManager.AddJumpPointClicked(Self);
|
||||
end;
|
||||
|
||||
if (ActiveUnitInfo = nil) or (NewSource<>ActiveUnitInfo.Source)
|
||||
then begin
|
||||
// jump to other file -> open it
|
||||
ActiveUnitInfo := Project1.UnitInfoWithFilename(NewSource.Filename);
|
||||
AnEditorInfo := nil;
|
||||
if ActiveUnitInfo <> nil then
|
||||
AnEditorInfo := GetAvailableUnitEditorInfo(ActiveUnitInfo, Point(NewX,NewY), NewTopLine);
|
||||
if AnEditorInfo <> nil then begin
|
||||
SourceEditorManager.ActiveEditor := TSourceEditor(AnEditorInfo.EditorComponent);
|
||||
Result := mrOK;
|
||||
end
|
||||
else
|
||||
Result:=DoOpenEditorFile(NewSource.Filename,-1,-1,
|
||||
[ofOnlyIfExists,ofRegularFile,ofDoNotLoadResource]);
|
||||
if Result<>mrOk then begin
|
||||
UpdateSourceNames;
|
||||
exit;
|
||||
end;
|
||||
NewSrcEdit := SourceEditorManager.ActiveEditor;
|
||||
end
|
||||
else begin
|
||||
AnEditorInfo := GetAvailableUnitEditorInfo(ActiveUnitInfo, Point(NewX,NewY), NewTopLine);
|
||||
if AnEditorInfo <> nil then begin
|
||||
NewSrcEdit := TSourceEditor(AnEditorInfo.EditorComponent);
|
||||
SourceEditorManager.ActiveEditor := NewSrcEdit;
|
||||
end
|
||||
else
|
||||
NewSrcEdit:=ActiveSrcEdit;
|
||||
end;
|
||||
if NewX<1 then NewX:=1;
|
||||
if NewY<1 then NewY:=1;
|
||||
//debugln(['[TMainIDE.DoJumpToCodePos] ',NewX,',',NewY,',',NewTopLine]);
|
||||
try
|
||||
NewSrcEdit.BeginUpdate;
|
||||
NewSrcEdit.EditorComponent.MoveLogicalCaretIgnoreEOL(Point(NewX,NewY));
|
||||
if not NewSrcEdit.IsLocked then begin
|
||||
if NewTopLine < 1 then
|
||||
NewSrcEdit.CenterCursor(True)
|
||||
else
|
||||
NewSrcEdit.TopLine:=NewTopLine;
|
||||
end;
|
||||
//DebugLn('TMainIDE.DoJumpToCodePos NewY=',dbgs(NewY),' ',dbgs(TopLine),' ',dbgs(NewTopLine));
|
||||
with NewSrcEdit.EditorComponent do
|
||||
LeftChar:=Max(NewX - (CharsInWindow * 4 div 5), 1);
|
||||
finally
|
||||
NewSrcEdit.EndUpdate;
|
||||
end;
|
||||
if MarkLine then
|
||||
NewSrcEdit.ErrorLine := NewY;
|
||||
|
||||
if FocusEditor then
|
||||
SourceEditorManager.ShowActiveWindowOnTop(True);
|
||||
UpdateSourceNames;
|
||||
Result:=mrOk;
|
||||
finally
|
||||
SourceEditorManager.EndAutoFocusLock;
|
||||
end;
|
||||
end;
|
||||
|
||||
{-------------------------------------------------------------------------------
|
||||
|
||||
@ -822,6 +822,7 @@ type
|
||||
FSourceWindowByFocusList: TFPList;
|
||||
FUpdateLock: Integer;
|
||||
FActiveEditorLock: Integer;
|
||||
FAutoFocusLock: Integer;
|
||||
FUpdateFlags: set of (ufMgrActiveEditorChanged, ufShowWindowOnTop, ufShowWindowOnTopFocus);
|
||||
procedure FreeSourceWindows;
|
||||
function GetActiveSourceWindowIndex: integer;
|
||||
@ -843,6 +844,9 @@ type
|
||||
function GetUniqueSourceEditors(Index: integer): TSourceEditorInterface; override;
|
||||
function GetMarklingProducers(Index: integer): TSourceMarklingProducer; override;
|
||||
public
|
||||
procedure BeginAutoFocusLock;
|
||||
procedure EndAutoFocusLock;
|
||||
function HasAutoFocusLock: Boolean;
|
||||
// Windows
|
||||
function SourceWindowWithEditor(const AEditor: TSourceEditorInterface): TSourceEditorWindowInterface;
|
||||
override;
|
||||
@ -6965,7 +6969,9 @@ Begin
|
||||
TempEditor.EditorComponent.CaretXY := CaretXY;
|
||||
TempEditor.EditorComponent.TopLine := TopLine;
|
||||
end;
|
||||
if (fAutoFocusLock=0) and (Screen.ActiveCustomForm=GetParentForm(Self)) then
|
||||
if (fAutoFocusLock=0) and (Screen.ActiveCustomForm=GetParentForm(Self)) and
|
||||
not(Manager.HasAutoFocusLock)
|
||||
then
|
||||
begin
|
||||
{$IFDEF VerboseFocus}
|
||||
debugln('TSourceNotebook.NotebookPageChanged BEFORE SetFocus ',
|
||||
@ -7826,6 +7832,21 @@ begin
|
||||
Result:=TSourceMarklingProducer(fProducers[Index]);
|
||||
end;
|
||||
|
||||
procedure TSourceEditorManagerBase.BeginAutoFocusLock;
|
||||
begin
|
||||
inc(FAutoFocusLock);
|
||||
end;
|
||||
|
||||
procedure TSourceEditorManagerBase.EndAutoFocusLock;
|
||||
begin
|
||||
dec(FAutoFocusLock);
|
||||
end;
|
||||
|
||||
function TSourceEditorManagerBase.HasAutoFocusLock: Boolean;
|
||||
begin
|
||||
Result := FAutoFocusLock > 0;
|
||||
end;
|
||||
|
||||
function TSourceEditorManagerBase.GetActiveCompletionPlugin: TSourceEditorCompletionPlugin;
|
||||
begin
|
||||
Result := FActiveCompletionPlugin;
|
||||
@ -7955,6 +7976,7 @@ var
|
||||
h: TSrcEditMangerHandlerType;
|
||||
begin
|
||||
FUpdateFlags := [];
|
||||
FAutoFocusLock := 0;
|
||||
for i := low(TsemChangeReason) to high(TsemChangeReason) do
|
||||
FChangeNotifyLists[i] := TMethodList.Create;
|
||||
for h:=low(FHandlers) to high(FHandlers) do
|
||||
|
||||
Loading…
Reference in New Issue
Block a user