fpmsrch.inc 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  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(msg_nodebuginfoavailable,nil); Exit; end;
  20. OpenSymbolBrowser(0,0,label_sym_objects,label_sym_globalscope,nil,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(msg_nodebuginfoavailable,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(msg_toomanysymbolscantdisplayall,nil);
  60. Desktop^.GetExtent(R); R.A.X:=R.B.X-35;
  61. Desktop^.Insert(New(PBrowserWindow, Init(R,
  62. label_sym_globals,SearchFreeWindowNo,nil,label_sym_globalscope,'',S,nil,nil,nil)));
  63. end;
  64. procedure TIDEApp.Modules;
  65. var
  66. R: TRect;
  67. S: PSortedSymbolCollection;
  68. procedure InsertInS(P: PSymbol); {$ifndef FPC}far;{$endif}
  69. begin
  70. S^.Insert(P);
  71. end;
  72. begin
  73. if BrowCol.Modules=nil then
  74. begin ErrorBox(msg_nodebuginfoavailable,nil); Exit; end;
  75. if assigned(ModulesCollection) then
  76. begin
  77. ModulesCollection^.deleteAll;
  78. Dispose(ModulesCollection,done);
  79. end;
  80. New(S, Init(500,500));
  81. ModulesCollection:=S;
  82. BrowCol.Modules^.ForEach(@InsertInS);
  83. Desktop^.GetExtent(R); R.A.X:=R.B.X-35;
  84. Desktop^.Insert(New(PBrowserWindow, Init(R,
  85. dialog_units,SearchFreeWindowNo,nil,label_sym_globalscope,'',S,nil,nil,nil)));
  86. end;
  87. function SymbolDialog(S : string) : PDialog;
  88. var D: PDialog;
  89. R,R1,R2: TRect;
  90. IL: PInputLine;
  91. begin
  92. R.Assign(0,0,40,8);
  93. New(D, Init(R, dialog_browsesymbol));
  94. with D^ do
  95. begin
  96. Options:=Options or ofCentered;
  97. GetExtent(R); R.Grow(-3,-2); R.B.Y:=R.A.Y+1;
  98. R1.Copy(R);
  99. R2.Copy(R); Inc(R2.A.Y);Inc(R2.B.Y);
  100. New(IL, Init(R2,255));
  101. Insert(IL);
  102. IL^.SetData(S);
  103. Insert(New(PLabel, Init(R1, label_entersymboltobrowse, IL)));
  104. GetExtent(R); R.Grow(-8,-1); R.A.Y:=R.B.Y-2; R.B.X:=R.A.X+10;
  105. Insert(New(PButton, Init(R, button_OK, cmOK, bfDefault)));
  106. R.Move(15,0);
  107. Insert(New(PButton, Init(R, button_Cancel, cmCancel, bfNormal)));
  108. end;
  109. IL^.Select;
  110. SymbolDialog:=D;
  111. end;
  112. procedure TIDEApp.SearchSymbol;
  113. var
  114. EditorWindow : PSourceWindow;
  115. S : string;
  116. begin
  117. EditorWindow:=FirstEditorWindow;
  118. If assigned(EditorWindow) then
  119. S:=LowerCaseStr(EditorWindow^.Editor^.GetCurrentWord)
  120. else
  121. S:='';
  122. if ExecuteDialog(SymbolDialog(S),@S)<>cmCancel then
  123. OpenOneSymbolBrowser(S);
  124. end;
  125. {
  126. $Log$
  127. Revision 1.1 2001-08-04 11:30:23 peter
  128. * ide works now with both compiler versions
  129. Revision 1.1.2.1 2001/03/20 00:20:42 pierre
  130. * fix some memory leaks + several small enhancements
  131. Revision 1.1 2000/07/13 09:48:35 michael
  132. + Initial import
  133. Revision 1.13 2000/05/02 08:42:28 pierre
  134. * new set of Gabor changes: see fixes.txt
  135. Revision 1.12 2000/03/07 21:57:01 pierre
  136. * adapted to change of OpenSymbolBrowser
  137. Revision 1.11 1999/07/28 23:11:21 peter
  138. * fixes from gabor
  139. Revision 1.10 1999/06/29 12:49:55 pierre
  140. * SearchSymbol works
  141. Revision 1.9 1999/06/28 19:32:22 peter
  142. * fixes from gabor
  143. Revision 1.8 1999/06/28 12:38:19 pierre
  144. * Globals(Modules)Collection tracing
  145. Revision 1.7 1999/06/25 00:34:50 pierre
  146. + SearchSymbol function
  147. Revision 1.6 1999/04/07 21:55:51 peter
  148. + object support for browser
  149. * html help fixes
  150. * more desktop saving things
  151. * NODEBUG directive to exclude debugger
  152. Revision 1.5 1999/03/01 15:41:59 peter
  153. + Added dummy entries for functions not yet implemented
  154. * MenuBar didn't update itself automatically on command-set changes
  155. * Fixed Debugging/Profiling options dialog
  156. * TCodeEditor converts spaces to tabs at save only if efUseTabChars is
  157. set
  158. * efBackSpaceUnindents works correctly
  159. + 'Messages' window implemented
  160. + Added '$CAP MSG()' and '$CAP EDIT' to available tool-macros
  161. + Added TP message-filter support (for ex. you can call GREP thru
  162. GREP2MSG and view the result in the messages window - just like in TP)
  163. * A 'var' was missing from the param-list of THelpFacility.TopicSearch,
  164. so topic search didn't work...
  165. * In FPHELP.PAS there were still context-variables defined as word instead
  166. of THelpCtx
  167. * StdStatusKeys() was missing from the statusdef for help windows
  168. + Topic-title for index-table can be specified when adding a HTML-files
  169. Revision 1.4 1999/02/10 09:51:03 pierre
  170. * Adapted to TBrowserWindow changes
  171. Revision 1.3 1999/02/04 13:32:08 pierre
  172. * Several things added (I cannot commit them independently !)
  173. + added TBreakpoint and TBreakpointCollection
  174. + added cmResetDebugger,cmGrep,CmToggleBreakpoint
  175. + Breakpoint list in INIFile
  176. * Select items now also depend of SwitchMode
  177. * Reading of option '-g' was not possible !
  178. + added search for -Fu args pathes in TryToOpen
  179. + added code for automatic opening of FileDialog
  180. if source not found
  181. Revision 1.2 1999/01/14 21:42:23 peter
  182. * source tracking from Gabor
  183. Revision 1.1 1999/01/12 14:29:37 peter
  184. + Implemented still missing 'switch' entries in Options menu
  185. + Pressing Ctrl-B sets ASCII mode in editor, after which keypresses (even
  186. ones with ASCII < 32 ; entered with Alt+<###>) are interpreted always as
  187. ASCII chars and inserted directly in the text.
  188. + Added symbol browser
  189. * splitted fp.pas to fpide.pas
  190. Revision 1.9 1999/01/09 18:00:47 peter
  191. Original implementation
  192. }