Browse Source

+ BrowserAtCursor started
* bug in TryToOpenFile removed

pierre 26 years ago
parent
commit
98295eb7d0
1 changed files with 28 additions and 4 deletions
  1. 28 4
      ide/text/fpviews.pas

+ 28 - 4
ide/text/fpviews.pas

@@ -281,6 +281,7 @@ function  ConfirmBox(S: string; Params: pointer; CanCancel: boolean): word;
 function IsThereAnyEditor: boolean;
 function IsThereAnyEditor: boolean;
 function IsThereAnyWindow: boolean;
 function IsThereAnyWindow: boolean;
 function FirstEditorWindow: PSourceWindow;
 function FirstEditorWindow: PSourceWindow;
+function EditorWindowFile(const Name : String): PSourceWindow;
 
 
 function  SearchMenuItem(Menu: PMenu; Cmd: word): PMenuItem;
 function  SearchMenuItem(Menu: PMenu; Cmd: word): PMenuItem;
 procedure SetMenuItemParam(Menu: PMenuItem; Param: string);
 procedure SetMenuItemParam(Menu: PMenuItem; Param: string);
@@ -331,7 +332,7 @@ implementation
 
 
 uses
 uses
   Keyboard,Memory,MsgBox,Validate,
   Keyboard,Memory,MsgBox,Validate,
-  Tokens,FPSwitch,
+  Tokens,FPSwitch,FPSymbol,
   FPVars,FPUtils,FPHelp,FPCompile;
   FPVars,FPUtils,FPHelp,FPCompile;
 
 
 const
 const
@@ -369,6 +370,16 @@ begin
   FirstEditorWindow:=pointer(Desktop^.FirstThat(@EditorWindow));
   FirstEditorWindow:=pointer(Desktop^.FirstThat(@EditorWindow));
 end;
 end;
 
 
+function EditorWindowFile(const Name : String): PSourceWindow;
+function EditorWindow(P: PView): boolean; {$ifndef FPC}far;{$endif}
+begin
+  EditorWindow:=(TypeOf(P^)=TypeOf(TSourceWindow)) and
+                 (PSourceWindow(P)^.Editor^.FileName=Name);
+end;
+begin
+  EditorWindowFile:=pointer(Desktop^.FirstThat(@EditorWindow));
+end;
+
 procedure InsertButtons(ADialog: PDialog);
 procedure InsertButtons(ADialog: PDialog);
 var R   : TRect;
 var R   : TRect;
     W,H : integer;
     W,H : integer;
@@ -735,6 +746,11 @@ begin
               P:=CurPos; Inc(P.X); Inc(P.Y);
               P:=CurPos; Inc(P.X); Inc(P.Y);
               LocalMenu(P);
               LocalMenu(P);
             end;
             end;
+          cmBrowseAtCursor:
+            begin
+              S:=LowerCaseStr(GetEditorCurWord(@Self));
+              OpenOneSymbolBrowser(S);
+            end;
           cmOpenAtCursor :
           cmOpenAtCursor :
             begin
             begin
               S:=LowerCaseStr(GetEditorCurWord(@Self));
               S:=LowerCaseStr(GetEditorCurWord(@Self));
@@ -801,7 +817,7 @@ begin
   Editor^.GrowMode:=gfGrowHiX+gfGrowHiY;
   Editor^.GrowMode:=gfGrowHiX+gfGrowHiY;
   if LoadFile then
   if LoadFile then
     if Editor^.LoadFile=false then
     if Editor^.LoadFile=false then
-       ErrorBox('Error reading file.',nil);
+       ErrorBox(#3'Error reading file.',nil);
   Insert(Editor);
   Insert(Editor);
   UpdateTitle;
   UpdateTitle;
 end;
 end;
@@ -2971,6 +2987,7 @@ begin
     if CheckDir('.'+DirSep,N,NewExt) then OK:=true;
     if CheckDir('.'+DirSep,N,NewExt) then OK:=true;
   CheckExt:=OK;
   CheckExt:=OK;
 end;
 end;
+
 function TryToOpen(const DD : dirstr): PSourceWindow;
 function TryToOpen(const DD : dirstr): PSourceWindow;
 var Found: boolean;
 var Found: boolean;
     W : PSourceWindow;
     W : PSourceWindow;
@@ -3044,8 +3061,11 @@ begin
              break;
              break;
            DrStr:=Copy(DrStr,pos(';',DrStr)+1,255);
            DrStr:=Copy(DrStr,pos(';',DrStr)+1,255);
         End;
         End;
-      W:=TryToOpen(DrStr);
+      if not assigned(W) then
+        W:=TryToOpen(DrStr);
       NewEditorOpened:=W<>nil;
       NewEditorOpened:=W<>nil;
+      if assigned(W) then
+        W^.Editor^.SetCurPtr(CurX,CurY);
     end;
     end;
   TryToOpenFile:=W;
   TryToOpenFile:=W;
 end;
 end;
@@ -3054,7 +3074,11 @@ end;
 END.
 END.
 {
 {
   $Log$
   $Log$
-  Revision 1.7  1999-02-04 13:32:11  pierre
+  Revision 1.8  1999-02-04 17:45:23  pierre
+    + BrowserAtCursor started
+    * bug in TryToOpenFile removed
+
+  Revision 1.7  1999/02/04 13:32:11  pierre
     * Several things added (I cannot commit them independently !)
     * Several things added (I cannot commit them independently !)
     + added TBreakpoint and TBreakpointCollection
     + added TBreakpoint and TBreakpointCollection
     + added cmResetDebugger,cmGrep,CmToggleBreakpoint
     + added cmResetDebugger,cmGrep,CmToggleBreakpoint