Browse Source

* Added TBreakpointCollection.FindBreakpointAt method

pierre 22 years ago
parent
commit
7f5de6e254
1 changed files with 21 additions and 1 deletions
  1. 21 1
      ide/fpdebug.pas

+ 21 - 1
ide/fpdebug.pas

@@ -121,6 +121,7 @@ type
       function  ToggleFileLine(FileName: String;LineNr : Longint) : boolean;
       procedure Update;
       procedure ShowBreakpoints(W : PFPWindow);
+      function  FindBreakpointAt(Editor : PSourceEditor; Line : longint) : PBreakpoint;
       procedure AdaptBreakpoints(Editor : PSourceEditor; Pos, Change : longint);
       procedure ShowAllBreakpoints;
     end;
@@ -1716,6 +1717,22 @@ begin
     end;
 end;
 
+function TBreakpointCollection.FindBreakpointAt(Editor : PSourceEditor; Line : longint) : PBreakpoint;
+
+  function IsAtLine(P : PBreakpoint) : boolean;{$ifndef FPC}far;{$endif}
+  begin
+    If assigned(P^.FileName) and
+       (OSFileName(FExpand(P^.FileName^))=OSFileName(FExpand(Editor^.FileName))) and
+       (Line=P^.Line) then
+      IsAtLine:=true
+    else
+      IsAtLine:=false;
+  end;
+
+begin
+  FindBreakpointAt:=FirstThat(@IsAtLine);
+end;
+
 procedure TBreakpointCollection.ShowAllBreakpoints;
 
   procedure SetInSource(P : PBreakpoint);{$ifndef FPC}far;{$endif}
@@ -3557,7 +3574,10 @@ end.
 
 {
   $Log$
-  Revision 1.41  2002-12-16 09:05:28  pierre
+  Revision 1.42  2002-12-16 15:15:40  pierre
+   * Added TBreakpointCollection.FindBreakpointAt method
+
+  Revision 1.41  2002/12/16 09:05:28  pierre
    * sanity ceck in ToggleFileLine method
 
   Revision 1.40  2002/02/09 02:04:46  pierre