fpmsrch.inc 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. {
  2. $Id$
  3. This file is part of the Free Pascal Integrated Development Environment
  4. Copyright (c) 1998 by Berczi Gabor
  5. Search menu entries
  6. See the file COPYING.FPC, included in this distribution,
  7. for details about the copyright.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. **********************************************************************}
  12. procedure TIDEApp.FindProcedure;
  13. begin
  14. NotImplemented;
  15. end;
  16. procedure TIDEApp.Objects;
  17. begin
  18. if ObjectTree=nil then
  19. begin ErrorBox('No debug info available.',nil); Exit; end;
  20. OpenSymbolBrowser(0,0,'Objects','Global scope',nil,nil,nil,ObjectTree,nil);
  21. end;
  22. procedure TIDEApp.Globals;
  23. var R: TRect;
  24. S: PSortedSymbolCollection;
  25. Overflow: boolean;
  26. Level : longint;
  27. procedure InsertInS(P: PSymbol); {$ifndef FPC}far;{$endif}
  28. procedure InsertItemsInS(P: PSymbolCollection);
  29. var I: Sw_integer;
  30. begin
  31. for I:=0 to P^.Count-1 do
  32. InsertInS(P^.At(I));
  33. end;
  34. begin
  35. Inc(level);
  36. if S^.Count=MaxCollectionSize then
  37. begin Overflow:=true; Exit; end;
  38. S^.Insert(P);
  39. { this is wrong because it inserted args or locals of proc
  40. in the globals list !! PM}
  41. if (P^.Items<>nil) and (level=1) then
  42. InsertItemsInS(P^.Items);
  43. Dec(level);
  44. end;
  45. begin
  46. level:=0;
  47. if BrowCol.Modules=nil then
  48. begin ErrorBox('No debug info available.',nil); Exit; end;
  49. Overflow:=false;
  50. if assigned(GlobalsCollection) then
  51. begin
  52. GlobalsCollection^.deleteAll;
  53. Dispose(GlobalsCollection,done);
  54. end;
  55. New(S, Init(500,500));
  56. GlobalsCollection:=S;
  57. BrowCol.Modules^.ForEach(@InsertInS);
  58. if Overflow then
  59. WarningBox('Too many symbols. Can''t display all of them.',nil);
  60. Desktop^.GetExtent(R); R.A.X:=R.B.X-35;
  61. Desktop^.Insert(New(PBrowserWindow, Init(R,
  62. 'Browse: Globals',SearchFreeWindowNo,nil,'Global scope',S,nil,nil,nil)));
  63. end;
  64. procedure TIDEApp.Modules;
  65. var
  66. S: PSortedSymbolCollection;
  67. procedure InsertInS(P: PSymbol); {$ifndef FPC}far;{$endif}
  68. begin
  69. S^.Insert(P);
  70. end;
  71. begin
  72. if BrowCol.Modules=nil then
  73. begin ErrorBox('No debug info available.',nil); Exit; end;
  74. if assigned(ModulesCollection) then
  75. begin
  76. ModulesCollection^.deleteAll;
  77. Dispose(ModulesCollection,done);
  78. end;
  79. New(S, Init(500,500));
  80. ModulesCollection:=S;
  81. BrowCol.Modules^.ForEach(@InsertInS);
  82. OpenSymbolBrowser(0,0,'Units','Global scope',nil,S,nil,nil,nil);
  83. end;
  84. function SymbolDialog(S : string) : PDialog;
  85. var D: PDialog;
  86. R,R1,R2: TRect;
  87. IL: PInputLine;
  88. begin
  89. R.Assign(0,0,40,8);
  90. New(D, Init(R, 'Browse Symbol'));
  91. with D^ do
  92. begin
  93. Options:=Options or ofCentered;
  94. GetExtent(R); R.Grow(-3,-2); R.B.Y:=R.A.Y+1;
  95. R1.Copy(R);
  96. R2.Copy(R); Inc(R2.A.Y);Inc(R2.B.Y);
  97. New(IL, Init(R2,255));
  98. Insert(IL);
  99. IL^.SetData(S);
  100. Insert(New(PLabel, Init(R1, 'Enter S~y~mbol to browse', IL)));
  101. GetExtent(R); R.Grow(-8,-1); R.A.Y:=R.B.Y-2; R.B.X:=R.A.X+10;
  102. Insert(New(PButton, Init(R, '~O~K', cmOK, bfDefault)));
  103. R.Move(15,0);
  104. Insert(New(PButton, Init(R, '~C~ancel', cmCancel, bfNormal)));
  105. end;
  106. IL^.Select;
  107. SymbolDialog:=D;
  108. end;
  109. procedure TIDEApp.SearchSymbol;
  110. var
  111. EditorWindow : PSourceWindow;
  112. S : string;
  113. begin
  114. EditorWindow:=FirstEditorWindow;
  115. If assigned(EditorWindow) then
  116. S:=LowerCaseStr(EditorWindow^.Editor^.GetCurrentWord)
  117. else
  118. S:='';
  119. if ExecuteDialog(SymbolDialog(S),@S)<>cmCancel then
  120. OpenOneSymbolBrowser(S);
  121. end;
  122. {
  123. $Log$
  124. Revision 1.11 1999-07-28 23:11:21 peter
  125. * fixes from gabor
  126. Revision 1.10 1999/06/29 12:49:55 pierre
  127. * SearchSymbol works
  128. Revision 1.9 1999/06/28 19:32:22 peter
  129. * fixes from gabor
  130. Revision 1.8 1999/06/28 12:38:19 pierre
  131. * Globals(Modules)Collection tracing
  132. Revision 1.7 1999/06/25 00:34:50 pierre
  133. + SearchSymbol function
  134. Revision 1.6 1999/04/07 21:55:51 peter
  135. + object support for browser
  136. * html help fixes
  137. * more desktop saving things
  138. * NODEBUG directive to exclude debugger
  139. Revision 1.5 1999/03/01 15:41:59 peter
  140. + Added dummy entries for functions not yet implemented
  141. * MenuBar didn't update itself automatically on command-set changes
  142. * Fixed Debugging/Profiling options dialog
  143. * TCodeEditor converts spaces to tabs at save only if efUseTabChars is
  144. set
  145. * efBackSpaceUnindents works correctly
  146. + 'Messages' window implemented
  147. + Added '$CAP MSG()' and '$CAP EDIT' to available tool-macros
  148. + Added TP message-filter support (for ex. you can call GREP thru
  149. GREP2MSG and view the result in the messages window - just like in TP)
  150. * A 'var' was missing from the param-list of THelpFacility.TopicSearch,
  151. so topic search didn't work...
  152. * In FPHELP.PAS there were still context-variables defined as word instead
  153. of THelpCtx
  154. * StdStatusKeys() was missing from the statusdef for help windows
  155. + Topic-title for index-table can be specified when adding a HTML-files
  156. Revision 1.4 1999/02/10 09:51:03 pierre
  157. * Adapted to TBrowserWindow changes
  158. Revision 1.3 1999/02/04 13:32:08 pierre
  159. * Several things added (I cannot commit them independently !)
  160. + added TBreakpoint and TBreakpointCollection
  161. + added cmResetDebugger,cmGrep,CmToggleBreakpoint
  162. + Breakpoint list in INIFile
  163. * Select items now also depend of SwitchMode
  164. * Reading of option '-g' was not possible !
  165. + added search for -Fu args pathes in TryToOpen
  166. + added code for automatic opening of FileDialog
  167. if source not found
  168. Revision 1.2 1999/01/14 21:42:23 peter
  169. * source tracking from Gabor
  170. Revision 1.1 1999/01/12 14:29:37 peter
  171. + Implemented still missing 'switch' entries in Options menu
  172. + Pressing Ctrl-B sets ASCII mode in editor, after which keypresses (even
  173. ones with ASCII < 32 ; entered with Alt+<###>) are interpreted always as
  174. ASCII chars and inserted directly in the text.
  175. + Added symbol browser
  176. * splitted fp.pas to fpide.pas
  177. Revision 1.9 1999/01/09 18:00:47 peter
  178. Original implementation
  179. }