fpmsrch.inc 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  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. FormatStrStr(dialog_browse,label_sym_globals),SearchFreeWindowNo,nil,label_sym_globalscope,'',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(msg_nodebuginfoavailable,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,dialog_units,label_sym_globalscope,nil,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, dialog_browsesymbol));
  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, label_entersymboltobrowse, 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, button_OK, cmOK, bfDefault)));
  103. R.Move(15,0);
  104. Insert(New(PButton, Init(R, button_Cancel, 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.1 2000-07-13 09:48:35 michael
  125. + Initial import
  126. Revision 1.13 2000/05/02 08:42:28 pierre
  127. * new set of Gabor changes: see fixes.txt
  128. Revision 1.12 2000/03/07 21:57:01 pierre
  129. * adapted to change of OpenSymbolBrowser
  130. Revision 1.11 1999/07/28 23:11:21 peter
  131. * fixes from gabor
  132. Revision 1.10 1999/06/29 12:49:55 pierre
  133. * SearchSymbol works
  134. Revision 1.9 1999/06/28 19:32:22 peter
  135. * fixes from gabor
  136. Revision 1.8 1999/06/28 12:38:19 pierre
  137. * Globals(Modules)Collection tracing
  138. Revision 1.7 1999/06/25 00:34:50 pierre
  139. + SearchSymbol function
  140. Revision 1.6 1999/04/07 21:55:51 peter
  141. + object support for browser
  142. * html help fixes
  143. * more desktop saving things
  144. * NODEBUG directive to exclude debugger
  145. Revision 1.5 1999/03/01 15:41:59 peter
  146. + Added dummy entries for functions not yet implemented
  147. * MenuBar didn't update itself automatically on command-set changes
  148. * Fixed Debugging/Profiling options dialog
  149. * TCodeEditor converts spaces to tabs at save only if efUseTabChars is
  150. set
  151. * efBackSpaceUnindents works correctly
  152. + 'Messages' window implemented
  153. + Added '$CAP MSG()' and '$CAP EDIT' to available tool-macros
  154. + Added TP message-filter support (for ex. you can call GREP thru
  155. GREP2MSG and view the result in the messages window - just like in TP)
  156. * A 'var' was missing from the param-list of THelpFacility.TopicSearch,
  157. so topic search didn't work...
  158. * In FPHELP.PAS there were still context-variables defined as word instead
  159. of THelpCtx
  160. * StdStatusKeys() was missing from the statusdef for help windows
  161. + Topic-title for index-table can be specified when adding a HTML-files
  162. Revision 1.4 1999/02/10 09:51:03 pierre
  163. * Adapted to TBrowserWindow changes
  164. Revision 1.3 1999/02/04 13:32:08 pierre
  165. * Several things added (I cannot commit them independently !)
  166. + added TBreakpoint and TBreakpointCollection
  167. + added cmResetDebugger,cmGrep,CmToggleBreakpoint
  168. + Breakpoint list in INIFile
  169. * Select items now also depend of SwitchMode
  170. * Reading of option '-g' was not possible !
  171. + added search for -Fu args pathes in TryToOpen
  172. + added code for automatic opening of FileDialog
  173. if source not found
  174. Revision 1.2 1999/01/14 21:42:23 peter
  175. * source tracking from Gabor
  176. Revision 1.1 1999/01/12 14:29:37 peter
  177. + Implemented still missing 'switch' entries in Options menu
  178. + Pressing Ctrl-B sets ASCII mode in editor, after which keypresses (even
  179. ones with ASCII < 32 ; entered with Alt+<###>) are interpreted always as
  180. ASCII chars and inserted directly in the text.
  181. + Added symbol browser
  182. * splitted fp.pas to fpide.pas
  183. Revision 1.9 1999/01/09 18:00:47 peter
  184. Original implementation
  185. }