* TryToOpenFile failed tofind a sourcewindow if it has no number

This commit is contained in:
pierre 1999-11-22 16:02:12 +00:00
parent e298d7a873
commit 98df9e3486

View File

@ -687,9 +687,9 @@ function SearchFreeWindowNo: integer;
var No: integer; var No: integer;
begin begin
No:=1; No:=1;
while (No<10) and (SearchWindowWithNo(No)<>nil) do while (No<100) and (SearchWindowWithNo(No)<>nil) do
Inc(No); Inc(No);
if No=10 then No:=0; if No=100 then No:=0;
SearchFreeWindowNo:=No; SearchFreeWindowNo:=No;
end; end;
@ -2445,17 +2445,20 @@ var D : DirStr;
end; end;
function SearchOnDesktop: PSourceWindow; function SearchOnDesktop: PSourceWindow;
var W: PWindow; var
V: PView;
W: PWindow;
I: integer; I: integer;
DS : DirStr; DS : DirStr;
NS : NameStr; NS : NameStr;
ES : ExtStr; ES : ExtStr;
Found : boolean; Found : boolean;
SName : string; SName : string;
begin
for I:=1 to 100 do function IsSearchedFile(W : PSourceWindow) : boolean;
var Found: boolean;
begin begin
W:=SearchWindowWithNo(I); Found:=false;
if (W<>nil) and (W^.HelpCtx=hcSourceWindow) then if (W<>nil) and (W^.HelpCtx=hcSourceWindow) then
begin begin
if (D='') then if (D='') then
@ -2478,11 +2481,20 @@ var D : DirStr;
if Found=false then if Found=false then
Found:=SName=UpcaseStr(N+'.pas'); Found:=SName=UpcaseStr(N+'.pas');
end; end;
if Found then Break;
end; end;
IsSearchedFile:=found;
end; end;
if Found=false then W:=nil; function IsSearchedSource(P: PView) : boolean; {$ifndef FPC}far;{$endif}
SearchOnDesktop:=PSourceWindow(W); begin
if assigned(P) and
(TypeOf(P^)=TypeOf(TSourceWindow)) then
IsSearchedSource:=IsSearchedFile(PSourceWindow(P))
else
IsSearchedSource:=false;
end;
begin
SearchOnDesktop:=PSourceWindow(Desktop^.FirstThat(@IsSearchedSource));
end; end;
var var
@ -2838,7 +2850,10 @@ end;
END. END.
{ {
$Log$ $Log$
Revision 1.47 1999-11-18 13:39:24 pierre Revision 1.48 1999-11-22 16:02:12 pierre
* TryToOpenFile failed tofind a sourcewindow if it has no number
Revision 1.47 1999/11/18 13:39:24 pierre
* Better info for Undo debugging * Better info for Undo debugging
Revision 1.46 1999/11/10 00:44:12 pierre Revision 1.46 1999/11/10 00:44:12 pierre