fpsymbol.pas 54 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968
  1. {
  2. $Id$
  3. This file is part of the Free Pascal Integrated Development Environment
  4. Copyright (c) 1998 by Berczi Gabor
  5. Symbol browse support routines for the IDE
  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. {$i globdir.inc}
  13. unit FPSymbol;
  14. interface
  15. uses Objects,Drivers,Views,Menus,Dialogs,
  16. {$ifndef FVISION}
  17. Outline,
  18. {$endif FVISION}
  19. BrowCol,
  20. WViews,
  21. FPViews;
  22. const
  23. { Browser tab constants }
  24. btScope = 0;
  25. btReferences = 1;
  26. btInheritance = 2;
  27. btMemInfo = 3;
  28. btUnitInfo = 4;
  29. btBreakWatch = 7;
  30. type
  31. PBrowserWindow = ^TBrowserWindow;
  32. PGDBValueCollection = ^TGDBValueCollection;
  33. PGDBValue = ^TGDBValue;
  34. TGDBValue = Object(TObject)
  35. constructor Init(Const AExpr : String;ASym : PSymbol);
  36. procedure GetValue;
  37. function GetText : String;
  38. destructor Done;virtual;
  39. private
  40. expr : Pstring;
  41. St : Pstring;
  42. S : PSymbol;
  43. GDBI : longint;
  44. end;
  45. TGDBValueCollection = Object(TCollection)
  46. function At(Index: sw_Integer): PGDBValue;
  47. end;
  48. PSymbolView = ^TSymbolView;
  49. TSymbolView = object(TLocalMenuListBox)
  50. constructor Init(var Bounds: TRect; AHScrollBar, AVScrollBar: PScrollBar);
  51. destructor Done;virtual;
  52. procedure HandleEvent(var Event: TEvent); virtual;
  53. procedure SetState(AState: Word; Enable: Boolean); virtual;
  54. function GotoItem(Item: sw_integer): boolean; virtual;
  55. function TrackItem(Item: sw_integer; AutoTrack: boolean): boolean; virtual;
  56. function GetPalette: PPalette; virtual;
  57. function GetLocalMenu: PMenu; virtual;
  58. procedure ClearHighlights;
  59. procedure AutoTrackSource; virtual;
  60. procedure Browse; virtual;
  61. procedure GotoSource; virtual;
  62. procedure TrackSource; virtual;
  63. procedure OptionsDlg; virtual;
  64. private
  65. MyBW : PBrowserWindow;
  66. function TrackReference(R: PReference; AutoTrack: boolean): boolean; virtual;
  67. function GotoReference(R: PReference): boolean; virtual;
  68. end;
  69. PSymbolScopeView = ^TSymbolScopeView;
  70. TSymbolScopeView = object(TSymbolView)
  71. constructor Init(var Bounds: TRect; ASymbols: PSymbolCollection; AHScrollBar, AVScrollBar: PScrollBar);
  72. destructor Done; virtual;
  73. procedure SetGDBCol;
  74. function GetText(Item,MaxLen: Sw_Integer): String; virtual;
  75. procedure HandleEvent(var Event: TEvent); virtual;
  76. procedure Draw; virtual;
  77. procedure LookUp(S: string); virtual;
  78. function GotoItem(Item: sw_integer): boolean; virtual;
  79. function TrackItem(Item: sw_integer; AutoTrack: boolean): boolean; virtual;
  80. private
  81. Symbols: PSymbolCollection;
  82. SymbolsValue : PGDBValueCollection;
  83. LookupStr: string;
  84. end;
  85. PSymbolReferenceView = ^TSymbolReferenceView;
  86. TSymbolReferenceView = object(TSymbolView)
  87. constructor Init(var Bounds: TRect; AReferences: PReferenceCollection; AHScrollBar, AVScrollBar: PScrollBar);
  88. destructor Done; virtual;
  89. procedure HandleEvent(var Event: TEvent); virtual;
  90. function GetText(Item,MaxLen: Sw_Integer): String; virtual;
  91. procedure SelectItem(Item: Sw_Integer); virtual;
  92. function GotoItem(Item: sw_integer): boolean; virtual;
  93. function TrackItem(Item: sw_integer; AutoTrack: boolean): boolean; virtual;
  94. procedure Browse; virtual;
  95. private
  96. References: PReferenceCollection;
  97. end;
  98. PSymbolMemInfoView = ^TSymbolMemInfoView;
  99. TSymbolMemInfoView = object(TStaticText)
  100. constructor Init(var Bounds: TRect; AMemInfo: PSymbolMemInfo);
  101. destructor Done; virtual;
  102. procedure GetText(var S: String); virtual;
  103. function GetPalette: PPalette; virtual;
  104. private
  105. MemInfo: PSymbolMemInfo;
  106. MyBW : PBrowserWindow;
  107. end;
  108. PSymbolMemoView = ^TSymbolMemoView;
  109. TSymbolMemoView = object(TFPMemo)
  110. function GetPalette: PPalette; virtual;
  111. end;
  112. {$ifndef FVISION}
  113. PSymbolInheritanceView = ^TSymbolInheritanceView;
  114. TSymbolInheritanceView = object(TOutlineViewer)
  115. constructor Init(var Bounds: TRect; AHScrollBar, AVScrollBar: PScrollBar; ARoot: PObjectSymbol);
  116. destructor Done; virtual;
  117. function GetRoot: Pointer; virtual;
  118. function HasChildren(Node: Pointer): Boolean; virtual;
  119. function GetChild(Node: Pointer; I: Integer): Pointer; virtual;
  120. function GetNumChildren(Node: Pointer): Integer; virtual;
  121. function GetText(Node: Pointer): String; virtual;
  122. procedure Adjust(Node: Pointer; Expand: Boolean); virtual;
  123. function IsExpanded(Node: Pointer): Boolean; virtual;
  124. procedure Selected(I: Integer); virtual;
  125. procedure HandleEvent(var Event: TEvent); virtual;
  126. function GetPalette: PPalette; virtual;
  127. private
  128. Root : PObjectSymbol;
  129. MyBW : PBrowserWindow;
  130. end;
  131. {$endif FVISION}
  132. PBrowserTabItem = ^TBrowserTabItem;
  133. TBrowserTabItem = record
  134. Sign : char;
  135. Link : PView;
  136. Next : PBrowserTabItem;
  137. end;
  138. PBrowserTab = ^TBrowserTab;
  139. TBrowserTab = object(TView)
  140. Items: PBrowserTabItem;
  141. constructor Init(var Bounds: TRect; AItems: PBrowserTabItem);
  142. function GetItemCount: sw_integer; virtual;
  143. function GetItem(Index: sw_integer): PBrowserTabItem; virtual;
  144. procedure SetParams(AFlags: word; ACurrent: Sw_integer); virtual;
  145. procedure SelectItem(Index: Sw_integer); virtual;
  146. procedure Draw; virtual;
  147. function GetPalette: PPalette; virtual;
  148. procedure HandleEvent(var Event: TEvent); virtual;
  149. destructor Done; virtual;
  150. private
  151. Flags : word;
  152. Current : Sw_integer;
  153. end;
  154. PUnitInfoPanel = ^TUnitInfoPanel;
  155. TUnitInfoPanel = object(TPanel)
  156. InOwnerCall: boolean;
  157. procedure HandleEvent(var Event: TEvent); virtual;
  158. end;
  159. TBrowserWindow = object(TFPWindow)
  160. constructor Init(var Bounds: TRect; ATitle: TTitleStr; ANumber: Sw_Integer;ASym : PSymbol;
  161. const AName,APrefix: string; ASymbols: PSymbolCollection; AReferences: PReferenceCollection;
  162. AInheritance: PObjectSymbol; AMemInfo: PSymbolMemInfo);
  163. procedure HandleEvent(var Event: TEvent); virtual;
  164. procedure SetState(AState: Word; Enable: Boolean); virtual;
  165. procedure Close; virtual;
  166. procedure SelectTab(BrowserTab: Sw_integer); virtual;
  167. function GetPalette: PPalette; virtual;
  168. destructor Done;virtual;
  169. private
  170. PageTab : PBrowserTab;
  171. ST : PStaticText;
  172. Sym : PSymbol;
  173. ScopeView : PSymbolScopeView;
  174. ReferenceView : PSymbolReferenceView;
  175. {$ifndef FVISION}
  176. InheritanceView: PSymbolInheritanceView;
  177. {$endif FVISION}
  178. MemInfoView : PSymbolMemInfoView;
  179. UnitInfoText : PSymbolMemoView;
  180. UnitInfoUsed : PSymbolScopeView;
  181. UnitInfoDependent : PSymbolScopeView;
  182. UnitInfo : PUnitInfoPanel;
  183. Prefix : PString;
  184. IsValid : boolean;
  185. DebuggerValue : PGDBValue;
  186. end;
  187. procedure OpenSymbolBrowser(X,Y: Sw_integer;const Name,Line: string;S : PSymbol;
  188. ParentBrowser : PBrowserWindow;
  189. Symbols: PSymbolCollection; References: PReferenceCollection;
  190. Inheritance: PObjectSymbol; MemInfo: PSymbolMemInfo);
  191. function IsSymbolInfoAvailable: boolean;
  192. procedure OpenOneSymbolBrowser(Name : String);
  193. procedure CloseAllBrowsers;
  194. procedure RemoveBrowsersCollection;
  195. const
  196. GlobalsCollection : PSortedCollection = nil;
  197. ModulesCollection : PSortedCollection = nil;
  198. implementation
  199. uses App,Strings,
  200. {$ifdef FVISION}
  201. FVConsts,
  202. {$else}
  203. Commands,
  204. {$endif}
  205. {$ifdef BROWSERCOL}
  206. symconst,
  207. {$endif BROWSERCOL}
  208. WUtils,WEditor,
  209. FPConst,FPString,FPUtils,FPVars,{$ifndef FPDEBUG}FPDebug{$endif},FPIDE;
  210. procedure CloseAllBrowsers;
  211. procedure SendCloseIfBrowser(P: PView); {$ifndef FPC}far;{$endif}
  212. begin
  213. if assigned(P) and
  214. ((TypeOf(P^)=TypeOf(TBrowserWindow)) or
  215. (TypeOf(P^)=TypeOf(TSymbolView)) or
  216. (TypeOf(P^)=TypeOf(TSymbolScopeView)) or
  217. (TypeOf(P^)=TypeOf(TSymbolReferenceView)) or
  218. (TypeOf(P^)=TypeOf(TSymbolMemInfoView)) or
  219. {$ifndef FVISION}
  220. (TypeOf(P^)=TypeOf(TSymbolInheritanceView)) or
  221. {$endif FVISION}
  222. (TypeOf(P^)=TypeOf(TSymbolMemoView))) then
  223. Message(P,evCommand,cmClose,nil);
  224. end;
  225. begin
  226. Desktop^.ForEach(@SendCloseIfBrowser);
  227. end;
  228. procedure RemoveBrowsersCollection;
  229. begin
  230. if assigned(GlobalsCollection) then
  231. begin
  232. GlobalsCollection^.deleteAll;
  233. Dispose(GlobalsCollection,done);
  234. GlobalsCollection:=nil;
  235. end;
  236. if assigned(ModulesCollection) then
  237. begin
  238. ModulesCollection^.deleteAll;
  239. Dispose(ModulesCollection,done);
  240. ModulesCollection:=nil;
  241. end;
  242. end;
  243. function NewBrowserTabItem(ASign: char; ALink: PView; ANext: PBrowserTabItem): PBrowserTabItem;
  244. var P: PBrowserTabItem;
  245. begin
  246. New(P); FillChar(P^,SizeOf(P^),0);
  247. with P^ do begin Sign:=ASign; Link:=ALink; Next:=ANext; end;
  248. NewBrowserTabItem:=P;
  249. end;
  250. procedure DisposeBrowserTabItem(P: PBrowserTabItem);
  251. begin
  252. if P<>nil then Dispose(P);
  253. end;
  254. procedure DisposeBrowserTabList(P: PBrowserTabItem);
  255. begin
  256. if P<>nil then
  257. begin
  258. if P^.Next<>nil then DisposeBrowserTabList(P^.Next);
  259. DisposeBrowserTabItem(P);
  260. end;
  261. end;
  262. function IsSymbolInfoAvailable: boolean;
  263. begin
  264. IsSymbolInfoAvailable:=BrowCol.Modules<>nil;
  265. end;
  266. procedure OpenOneSymbolBrowser(Name : String);
  267. var Index : sw_integer;
  268. PS,S : PSymbol;
  269. Anc : PObjectSymbol;
  270. P : Pstring;
  271. Symbols: PSymbolCollection;
  272. function Search(P : PSymbol) : boolean;
  273. begin
  274. Search:=UpcaseStr(P^.Items^.LookUp(Name,Index))=Name;
  275. end;
  276. begin
  277. Name:=UpcaseStr(Name);
  278. If BrowCol.Modules<>nil then
  279. begin
  280. PS:=BrowCol.Modules^.FirstThat(@Search);
  281. If assigned(PS) then
  282. begin
  283. S:=PS^.Items^.At(Index);
  284. Symbols:=S^.Items;
  285. if (not assigned(symbols) or (symbols^.count=0)) and
  286. assigned(S^.Ancestor) then
  287. Symbols:=S^.Ancestor^.Items;
  288. if (S^.Flags and sfObject)=0 then
  289. Anc:=nil
  290. else if S^.Ancestor=nil then
  291. Anc:=ObjectTree
  292. else
  293. Anc:=SearchObjectForSymbol(S^.Ancestor);
  294. OpenSymbolBrowser(0,20,
  295. PS^.Items^.At(Index)^.GetName,
  296. PS^.Items^.At(Index)^.GetText,
  297. PS^.Items^.At(Index),nil,
  298. Symbols,PS^.Items^.At(Index)^.References,Anc,PS^.MemInfo);
  299. end
  300. else
  301. begin
  302. P:=@Name;
  303. ErrorBox(msg_symbolnotfound,@P);
  304. end;
  305. end
  306. else
  307. ErrorBox(msg_nobrowserinfoavailable,nil);
  308. end;
  309. (*procedure ReadBrowseLog(FileName: string);
  310. var f: text;
  311. IOOK,EndOfFile: boolean;
  312. Line: string;
  313. procedure NextLine;
  314. begin
  315. readln(f,Line);
  316. EndOfFile:=Eof(f);
  317. end;
  318. var Level: integer;
  319. procedure ProcessSymTable(Indent: integer; Owner: PSymbolCollection);
  320. var IndentS,S,Source: string;
  321. Sym: PSymbol;
  322. Ref: PSymbolReference;
  323. P: byte;
  324. PX: TPoint;
  325. PS: PString;
  326. PCount: integer;
  327. Params: array[0..30] of PString;
  328. Typ: tsymtyp;
  329. ExitBack: boolean;
  330. begin
  331. Inc(Level);
  332. IndentS:=CharStr(' ',Indent); ExitBack:=false;
  333. Sym:=nil;
  334. repeat
  335. if copy(Line,1,length(IndentS))<>IndentS then ExitBack:=true else
  336. if copy(Line,Indent+1,3)='***' then
  337. { new symbol }
  338. begin
  339. S:=copy(Line,Indent+1+3,255);
  340. P:=Pos('***',S); if P=0 then P:=length(S)+1;
  341. S:=Trim(copy(S,1,P-1));
  342. if (copy(S,1,1)='_') and (Pos('$$',S)>0) then
  343. begin
  344. repeat
  345. P:=Pos('$$',S);
  346. if P>0 then Delete(S,1,P+1);
  347. until P=0;
  348. P:=Pos('$',S);
  349. Delete(S,1,P);
  350. PCount:=0;
  351. repeat
  352. P:=Pos('$',S); if P=0 then P:=length(S)+1;
  353. Params[PCount]:=TypeNames^.Add(copy(S,1,P-1));
  354. Inc(PCount);
  355. Delete(S,1,P);
  356. until S='';
  357. Sym^.Typ:=procsym;
  358. Sym^.SetParams(PCount,@Params);
  359. end
  360. else
  361. New(Sym, Init(S, varsym, 0, nil));
  362. Owner^.Insert(Sym);
  363. NextLine;
  364. end else
  365. if copy(Line,Indent+1,3)='---' then
  366. { child symtable }
  367. begin
  368. S:=Trim(copy(Line,Indent+1+12,255));
  369. if Level=1 then Typ:=unitsym else
  370. Typ:=typesym;
  371. if (Sym<>nil) and (Sym^.GetName=S) then
  372. else
  373. begin
  374. New(Sym, Init(S, Typ, 0, nil));
  375. Owner^.Insert(Sym);
  376. end;
  377. Sym^.Typ:=Typ;
  378. NextLine;
  379. New(Sym^.Items, Init(0,50));
  380. ProcessSymTable(Indent+2,Sym^.Items);
  381. end else
  382. { if Sym<>nil then}
  383. if copy(Line,Indent+1,1)=' ' then
  384. { reference }
  385. begin
  386. S:=copy(Line,Indent+1+2,255);
  387. P:=Pos('(',S); if P=0 then P:=length(S)+1;
  388. Source:=Trim(copy(S,1,P-1)); Delete(S,1,P);
  389. P:=Pos(',',S); if P=0 then P:=length(S)+1;
  390. PX.Y:=StrToInt(copy(S,1,P-1)); Delete(S,1,P);
  391. P:=Pos(')',S); if P=0 then P:=length(S)+1;
  392. PX.X:=StrToInt(copy(S,1,P-1)); Delete(S,1,P);
  393. PS:=ModuleNames^.Add(Source);
  394. New(Ref, Init(PS, PX));
  395. if Sym^.References=nil then
  396. New(Sym^.References, Init(10,50));
  397. Sym^.References^.Insert(Ref);
  398. end;
  399. if ExitBack=false then
  400. NextLine;
  401. until EndOfFile or ExitBack;
  402. Dec(Level);
  403. end;
  404. begin
  405. DoneSymbolBrowser;
  406. InitSymbolBrowser;
  407. {$I-}
  408. Assign(f,FileName);
  409. Reset(f);
  410. Level:=0;
  411. NextLine;
  412. while (IOResult=0) and (EndOfFile=false) do
  413. ProcessSymTable(0,Modules);
  414. Close(f);
  415. EatIO;
  416. {$I+}
  417. end;*)
  418. {****************************************************************************
  419. TGDBValue
  420. ****************************************************************************}
  421. constructor TGDBValue.Init(Const AExpr : String;ASym : PSymbol);
  422. begin
  423. St := nil;
  424. S := ASym;
  425. Expr:=NewStr(AExpr);
  426. GDBI:=-1;
  427. end;
  428. destructor TGDBValue.Done;
  429. begin
  430. If Assigned(St) then
  431. begin
  432. DisposeStr(St);
  433. st:=nil;
  434. end;
  435. If Assigned(Expr) then
  436. begin
  437. DisposeStr(Expr);
  438. Expr:=nil;
  439. end;
  440. end;
  441. procedure TGDBValue.GetValue;
  442. var
  443. p : pchar;
  444. begin
  445. {$ifdef BROWSERCOL}
  446. {$ifndef NODEBUG}
  447. if not assigned(Debugger) then
  448. exit;
  449. if not Debugger^.IsRunning then
  450. exit;
  451. if (S^.typ<>varsym) or (GDBI=Debugger^.RunCount) then
  452. exit;
  453. If Assigned(St) then
  454. DisposeStr(St);
  455. if assigned(Expr) then
  456. begin
  457. p:=Debugger^.GetValue(Expr^);
  458. St:=NewStr(GetPChar(p));
  459. if assigned(p) then
  460. StrDispose(p);
  461. GDBI:=Debugger^.RunCount;
  462. end;
  463. {$endif ndef NODEBUG}
  464. {$endif BROWSERCOL}
  465. end;
  466. function TGDBValue.GetText : String;
  467. begin
  468. GetValue;
  469. if assigned(St) then
  470. GetText:=S^.GetText+' = '+GetStr(St)
  471. else
  472. GetText:=S^.GetText;
  473. end;
  474. {****************************************************************************
  475. TGDBValueCollection
  476. ****************************************************************************}
  477. function TGDBValueCollection.At(Index: sw_Integer): PGDBValue;
  478. begin
  479. At:= Inherited At(Index);
  480. end;
  481. {****************************************************************************
  482. TSymbolView
  483. ****************************************************************************}
  484. constructor TSymbolView.Init(var Bounds: TRect; AHScrollBar, AVScrollBar: PScrollBar);
  485. begin
  486. inherited Init(Bounds,1,AVScrollBar);
  487. HScrollBar:=AHScrollBar;
  488. MyBW:=nil;
  489. if assigned(HScrollBar) then
  490. begin
  491. HScrollBar^.SetRange(1,80);
  492. end;
  493. Options:=Options or (ofSelectable+ofTopSelect);
  494. EventMask:=EventMask or evBroadcast;
  495. end;
  496. procedure TSymbolView.ClearHighlights;
  497. begin
  498. Message(Desktop,evBroadcast,cmClearLineHighlights,nil);
  499. end;
  500. procedure TSymbolView.AutoTrackSource;
  501. begin
  502. if Range>0 then
  503. TrackSource;
  504. end;
  505. procedure TSymbolView.OptionsDlg;
  506. begin
  507. { Abstract }
  508. end;
  509. destructor TSymbolView.Done;
  510. begin
  511. EventMask:=EventMask and not evBroadcast;
  512. Inherited Done;
  513. end;
  514. procedure TSymbolView.SetState(AState: Word; Enable: Boolean);
  515. var OState: longint;
  516. begin
  517. OState:=State;
  518. inherited SetState(AState,Enable);
  519. if ((OState xor State) and sfFocused)<>0 then
  520. if GetState(sfFocused) then
  521. begin
  522. if (MiscOptions and moAutoTrackSource)<>0 then
  523. AutoTrackSource;
  524. end
  525. else
  526. Message(Desktop,evBroadcast,cmClearLineHighlights,nil);
  527. end;
  528. procedure TSymbolView.Browse;
  529. begin
  530. SelectItem(Focused);
  531. end;
  532. procedure TSymbolView.GotoSource;
  533. begin
  534. if GotoItem(Focused) then
  535. PutCommand(Owner,evCommand,cmClose,nil);
  536. end;
  537. procedure TSymbolView.TrackSource;
  538. begin
  539. TrackItem(Focused,false);
  540. end;
  541. procedure TSymbolView.HandleEvent(var Event: TEvent);
  542. var DontClear: boolean;
  543. begin
  544. case Event.What of
  545. evKeyDown :
  546. begin
  547. DontClear:=false;
  548. case Event.KeyCode of
  549. kbEnter :
  550. Browse;
  551. kbCtrlEnter :
  552. GotoSource;
  553. kbSpaceBar :
  554. TrackSource;
  555. kbRight,kbLeft :
  556. if HScrollBar<>nil then
  557. HScrollBar^.HandleEvent(Event);
  558. else DontClear:=true;
  559. end;
  560. if DontClear=false then ClearEvent(Event);
  561. end;
  562. evMouseDown :
  563. begin
  564. if Event.double then
  565. begin
  566. Browse;
  567. ClearEvent(Event);
  568. end;
  569. end;
  570. evCommand :
  571. begin
  572. DontClear:=false;
  573. case Event.Command of
  574. cmSymBrowse :
  575. Browse;
  576. cmSymGotoSource :
  577. GotoSource;
  578. cmSymTrackSource :
  579. TrackSource;
  580. cmSymOptions :
  581. OptionsDlg;
  582. else DontClear:=true;
  583. end;
  584. if DontClear=false then ClearEvent(Event);
  585. end;
  586. evBroadcast :
  587. case Event.Command of
  588. cmListFocusChanged :
  589. if Event.InfoPtr=@Self then
  590. if (MiscOptions and moAutoTrackSource)<>0 then
  591. if GetState(sfFocused) then
  592. AutoTrackSource;
  593. end;
  594. end;
  595. inherited HandleEvent(Event);
  596. end;
  597. function TSymbolView.GetPalette: PPalette;
  598. const
  599. P: string[length(CBrowserListBox)] = CBrowserListBox;
  600. begin
  601. GetPalette:=@P;
  602. end;
  603. function TSymbolView.GetLocalMenu: PMenu;
  604. begin
  605. GetLocalMenu:=NewMenu(
  606. NewItem(menu_symlocal_browse,'',kbNoKey,cmSymBrowse,hcSymBrowse,
  607. NewItem(menu_symlocal_gotosource,'',kbNoKey,cmSymGotoSource,hcSymGotoSource,
  608. NewItem(menu_symlocal_tracksource,'',kbNoKey,cmSymTrackSource,hcSymTrackSource,
  609. NewLine(
  610. NewItem(menu_symlocal_options,'',kbNoKey,cmSymOptions,hcSymOptions,
  611. nil))))));
  612. end;
  613. function TSymbolView.GotoItem(Item: sw_integer): boolean;
  614. begin
  615. SelectItem(Item);
  616. GotoItem:=true;
  617. end;
  618. function TSymbolView.TrackItem(Item: sw_integer; AutoTrack: boolean): boolean;
  619. begin
  620. SelectItem(Item);
  621. TrackItem:=true;
  622. end;
  623. function LastBrowserWindow: PBrowserWindow;
  624. var BW: PBrowserWindow;
  625. procedure IsBW(P: PView); {$ifndef FPC}far;{$endif}
  626. begin
  627. if (P^.HelpCtx=hcBrowserWindow) then
  628. BW:=pointer(P);
  629. end;
  630. begin
  631. BW:=nil;
  632. Desktop^.ForEach(@IsBW);
  633. LastBrowserWindow:=BW;
  634. end;
  635. function TSymbolView.TrackReference(R: PReference; AutoTrack: boolean): boolean;
  636. var W: PSourceWindow;
  637. BW: PBrowserWindow;
  638. P: TPoint;
  639. begin
  640. ClearHighlights;
  641. Desktop^.Lock;
  642. P.X:=R^.Position.X-1; P.Y:=R^.Position.Y-1;
  643. if AutoTrack then
  644. W:=SearchOnDesktop(R^.GetFileName,false)
  645. else
  646. W:=TryToOpenFile(nil,R^.GetFileName,P.X,P.Y,true);
  647. if not assigned(W) then
  648. begin
  649. Desktop^.Unlock;
  650. if IDEApp.OpenSearch(R^.GetFileName+'*') then
  651. begin
  652. W:=TryToOpenFile(nil,R^.GetFileName,R^.Position.X-1,R^.Position.Y-1,true);
  653. if Assigned(W) then
  654. W^.Select;
  655. end;
  656. Desktop^.Lock;
  657. end;
  658. if W<>nil then
  659. begin
  660. BW:=LastBrowserWindow;
  661. if BW=nil then
  662. W^.Select
  663. else
  664. begin
  665. Desktop^.Delete(W);
  666. Desktop^.InsertBefore(W,BW^.NextView);
  667. end;
  668. W^.Editor^.SetLineFlagExclusive(lfHighlightRow,P.Y);
  669. end;
  670. Desktop^.UnLock;
  671. if Assigned(W)=false then
  672. ErrorBox(FormatStrStr(msg_cantfindfile,R^.GetFileName),nil);
  673. TrackReference:=W<>nil;
  674. end;
  675. function TSymbolView.GotoReference(R: PReference): boolean;
  676. var W: PSourceWindow;
  677. begin
  678. Desktop^.Lock;
  679. W:=TryToOpenFile(nil,R^.GetFileName,R^.Position.X-1,R^.Position.Y-1,true);
  680. if Assigned(W) then
  681. W^.Select
  682. else
  683. begin
  684. Desktop^.Unlock;
  685. if IDEApp.OpenSearch(R^.GetFileName+'*') then
  686. begin
  687. W:=TryToOpenFile(nil,R^.GetFileName,R^.Position.X-1,R^.Position.Y-1,true);
  688. if Assigned(W) then
  689. W^.Select;
  690. end;
  691. Desktop^.Lock;
  692. end;
  693. Desktop^.UnLock;
  694. if Assigned(W)=false then
  695. ErrorBox(FormatStrStr(msg_cantfindfile,R^.GetFileName),nil);
  696. GotoReference:=W<>nil;
  697. end;
  698. {****************************************************************************
  699. TSymbolScopeView
  700. ****************************************************************************}
  701. constructor TSymbolScopeView.Init(var Bounds: TRect; ASymbols: PSymbolCollection; AHScrollBar, AVScrollBar: PScrollBar);
  702. begin
  703. inherited Init(Bounds,AHScrollBar, AVScrollBar);
  704. Symbols:=ASymbols;
  705. NewList(ASymbols);
  706. New(SymbolsValue,Init(50,50));
  707. SetRange(Symbols^.Count);
  708. end;
  709. destructor TSymbolScopeView.Done;
  710. begin
  711. {if assigned(Symbols) then
  712. begin
  713. the elements belong to other lists
  714. Symbols^.DeleteAll;
  715. dispose(Symbols,done);
  716. end;}
  717. if Assigned(SymbolsValue) then
  718. begin
  719. Dispose(SymbolsValue,Done);
  720. SymbolsValue:=nil;
  721. end;
  722. Inherited Done;
  723. end;
  724. procedure TSymbolScopeView.HandleEvent(var Event: TEvent);
  725. var OldFocus: sw_integer;
  726. begin
  727. case Event.What of
  728. evKeyDown :
  729. case Event.KeyCode of
  730. kbBack :
  731. begin
  732. LookUp(copy(LookUpStr,1,length(LookUpStr)-1));
  733. ClearEvent(Event);
  734. end;
  735. else
  736. if Event.CharCode in[#33..#255] then
  737. begin
  738. LookUp(LookUpStr+Event.CharCode);
  739. ClearEvent(Event);
  740. end;
  741. end;
  742. end;
  743. OldFocus:=Focused;
  744. inherited HandleEvent(Event);
  745. if OldFocus<>Focused then
  746. Lookup('');
  747. end;
  748. procedure TSymbolScopeView.Draw;
  749. var DeltaX: sw_integer;
  750. begin
  751. inherited Draw;
  752. if Assigned(HScrollBar)=false then DeltaX:=0 else
  753. DeltaX:=HScrollBar^.Value-HScrollBar^.Min;
  754. SetCursor(2+SymbolTypLen+length(LookUpStr)-DeltaX,Focused-TopItem);
  755. end;
  756. procedure TSymbolScopeView.LookUp(S: string);
  757. var Idx,Slength: Sw_integer;
  758. NS: string;
  759. begin
  760. NS:=LookUpStr;
  761. Slength:=Length(S);
  762. if (Symbols=nil) or (S='') then NS:='' else
  763. begin
  764. S:=Symbols^.LookUp(S,Idx);
  765. if Idx<>-1 then
  766. begin
  767. NS:=S;
  768. FocusItem(Idx);
  769. end;
  770. end;
  771. LookUpStr:=Copy(NS,1,Slength);
  772. SetState(sfCursorVis,LookUpStr<>'');
  773. DrawView;
  774. end;
  775. function TSymbolScopeView.GotoItem(Item: sw_integer): boolean;
  776. var S: PSymbol;
  777. OK: boolean;
  778. begin
  779. OK:=Range>0;
  780. if OK then
  781. begin
  782. S:=List^.At(Item);
  783. OK:=(S^.References<>nil) and (S^.References^.Count>0);
  784. if OK then
  785. OK:=GotoReference(S^.References^.At(0));
  786. end;
  787. GotoItem:=OK;
  788. end;
  789. function TSymbolScopeView.TrackItem(Item: sw_integer; AutoTrack: boolean): boolean;
  790. var S: PSymbol;
  791. OK: boolean;
  792. begin
  793. OK:=Range>0;
  794. if OK then
  795. begin
  796. S:=List^.At(Item);
  797. OK:=(S^.References<>nil) and (S^.References^.Count>0);
  798. if OK then
  799. OK:=TrackReference(S^.References^.At(0),AutoTrack);
  800. end;
  801. TrackItem:=OK;
  802. end;
  803. procedure TSymbolScopeView.SetGDBCol;
  804. var S : PSymbol;
  805. I : sw_integer;
  806. begin
  807. if assigned(MyBW) and (SymbolsValue^.Count=0) then
  808. begin
  809. For i:=0 to Symbols^.Count-1 do
  810. begin
  811. S:=Symbols^.At(I);
  812. SymbolsValue^.Insert(New(PGDBValue,Init(GetStr(MyBW^.Prefix)+S^.GetName,S)));
  813. end;
  814. end;
  815. end;
  816. function TSymbolScopeView.GetText(Item,MaxLen: Sw_Integer): String;
  817. var S1: string;
  818. S : PSymbol;
  819. SG : PGDBValue;
  820. begin
  821. S:=Symbols^.At(Item);
  822. if Assigned(SymbolsValue) and (SymbolsValue^.Count>Item) then
  823. SG:=SymbolsValue^.At(Item)
  824. else
  825. SG:=nil;
  826. if assigned(SG) then
  827. S1:=SG^.getText
  828. else
  829. S1:=S^.GetText;
  830. GetText:=copy(S1,1,MaxLen);
  831. end;
  832. {****************************************************************************
  833. TSymbolReferenceView
  834. ****************************************************************************}
  835. constructor TSymbolReferenceView.Init(var Bounds: TRect; AReferences: PReferenceCollection;
  836. AHScrollBar, AVScrollBar: PScrollBar);
  837. begin
  838. inherited Init(Bounds,AHScrollBar, AVScrollBar);
  839. References:=AReferences;
  840. NewList(AReferences);
  841. SetRange(References^.Count);
  842. end;
  843. destructor TSymbolReferenceView.Done;
  844. begin
  845. Inherited Done;
  846. end;
  847. procedure TSymbolReferenceView.HandleEvent(var Event: TEvent);
  848. var OldFocus: sw_integer;
  849. DontClear: boolean;
  850. begin
  851. OldFocus:=Focused;
  852. case Event.What of
  853. evKeyDown :
  854. begin
  855. DontClear:=false;
  856. case Event.KeyCode of
  857. kbEnter :
  858. TrackItem(Focused,false);
  859. kbCtrlEnter :
  860. GotoItem(Focused);
  861. else DontClear:=true;
  862. end;
  863. if DontClear=false then ClearEvent(Event);
  864. end;
  865. end;
  866. inherited HandleEvent(Event);
  867. if OldFocus<>Focused then
  868. if (MiscOptions and moAutoTrackSource)=0 then
  869. ClearHighlights;
  870. end;
  871. procedure TSymbolReferenceView.Browse;
  872. begin
  873. { do nothing here }
  874. end;
  875. function TSymbolReferenceView.GetText(Item,MaxLen: Sw_Integer): String;
  876. var S: string;
  877. P: PReference;
  878. begin
  879. P:=References^.At(Item);
  880. S:=P^.GetFileName+'('+IntToStr(P^.Position.Y)+','+IntToStr(P^.Position.X)+')';
  881. GetText:=copy(S,1,MaxLen);
  882. end;
  883. function TSymbolReferenceView.GotoItem(Item: sw_integer): boolean;
  884. var OK: boolean;
  885. begin
  886. OK:=Range>0;
  887. if OK then
  888. OK:=GotoReference(List^.At(Item));
  889. GotoItem:=OK;
  890. end;
  891. function TSymbolReferenceView.TrackItem(Item: sw_integer; AutoTrack: boolean): boolean;
  892. var OK: boolean;
  893. begin
  894. OK:=Range>0;
  895. if OK then
  896. OK:=TrackReference(List^.At(Item),AutoTrack);
  897. TrackItem:=OK;
  898. end;
  899. procedure TSymbolReferenceView.SelectItem(Item: Sw_Integer);
  900. begin
  901. GotoItem(Item);
  902. end;
  903. constructor TSymbolMemInfoView.Init(var Bounds: TRect; AMemInfo: PSymbolMemInfo);
  904. begin
  905. inherited Init(Bounds,'');
  906. Options:=Options or (ofSelectable+ofTopSelect);
  907. MemInfo:=AMemInfo;
  908. MyBW:=nil;
  909. end;
  910. destructor TSymbolMemInfoView.Done;
  911. begin
  912. { if assigned(MemInfo) then
  913. dispose(MemInfo);}
  914. Inherited Done;
  915. end;
  916. procedure TSymbolMemInfoView.GetText(var S: String);
  917. function SizeStr(Size: longint): string;
  918. var S: string[40];
  919. begin
  920. S:=IntToStrL(Size,7);
  921. S:=S+' byte';
  922. if Size>1 then S:=S+'s';
  923. if Size=-1 then
  924. SizeStr:='variable'
  925. else
  926. SizeStr:=S;
  927. end;
  928. function AddrStr(Addr: longint): string;
  929. { Warning this is endian specific code !! (PM) }
  930. type TLongint = record LoW,HiW: word; end;
  931. begin
  932. with TLongint(Addr) do
  933. AddrStr:='$'+IntToHex(HiW,4)+IntToHex(LoW,4);
  934. end;
  935. begin
  936. ClearFormatParams;
  937. AddFormatParamStr(msg_sizeinmemory);
  938. AddFormatParamStr(msg_sizeonstack);
  939. S:=
  940. FormatStrF(
  941. #13+
  942. { ' Memory location: '+AddrStr(MemInfo^.Addr)+#13+
  943. ' Local address: '+AddrStr(MemInfo^.LocalAddr)+#13+}
  944. { ??? internal linker ??? }
  945. '%18s: '+SizeStr(MemInfo^.Size)+#13+
  946. '%18s: '+SizeStr(MemInfo^.PushSize)+#13+
  947. '',
  948. FormatParams);
  949. end;
  950. function TSymbolMemInfoView.GetPalette: PPalette;
  951. begin
  952. GetPalette:=inherited GetPalette;
  953. end;
  954. function TSymbolMemoView.GetPalette: PPalette;
  955. const P: string[length(CFPSymbolMemo)] = CFPSymbolMemo;
  956. begin
  957. GetPalette:=@P;
  958. end;
  959. {****************************************************************************
  960. TSymbolInheritanceView
  961. ****************************************************************************}
  962. {$ifndef FVISION}
  963. constructor TSymbolInheritanceView.Init(var Bounds: TRect; AHScrollBar, AVScrollBar: PScrollBar; ARoot: PObjectSymbol);
  964. begin
  965. inherited Init(Bounds,AHScrollBar,AVScrollBar);
  966. Options:=Options or (ofSelectable+ofTopSelect);
  967. Root:=ARoot;
  968. MyBW:=nil;
  969. ExpandAll(GetRoot);
  970. Update;
  971. end;
  972. destructor TSymbolInheritanceView.Done;
  973. begin
  974. { do not dispose,
  975. belongs to a symbolcollection (PM)
  976. if assigned(Root) then
  977. dispose(Root,done); }
  978. Inherited Done;
  979. end;
  980. function TSymbolInheritanceView.GetRoot: Pointer;
  981. begin
  982. GetRoot:=Root;
  983. end;
  984. function TSymbolInheritanceView.HasChildren(Node: Pointer): Boolean;
  985. begin
  986. HasChildren:=GetNumChildren(Node)>0;
  987. end;
  988. function TSymbolInheritanceView.GetChild(Node: Pointer; I: Integer): Pointer;
  989. begin
  990. GetChild:=PObjectSymbol(Node)^.GetDescendant(I);
  991. end;
  992. function TSymbolInheritanceView.GetNumChildren(Node: Pointer): Integer;
  993. begin
  994. GetNumChildren:=PObjectSymbol(Node)^.GetDescendantCount;
  995. end;
  996. function TSymbolInheritanceView.GetText(Node: Pointer): String;
  997. begin
  998. GetText:=PObjectSymbol(Node)^.GetName;
  999. end;
  1000. procedure TSymbolInheritanceView.Adjust(Node: Pointer; Expand: Boolean);
  1001. begin
  1002. PObjectSymbol(Node)^.Expanded:=Expand;
  1003. end;
  1004. function TSymbolInheritanceView.IsExpanded(Node: Pointer): Boolean;
  1005. begin
  1006. IsExpanded:=PObjectSymbol(Node)^.Expanded;
  1007. end;
  1008. procedure TSymbolInheritanceView.HandleEvent(var Event: TEvent);
  1009. var DontClear: boolean;
  1010. begin
  1011. case Event.What of
  1012. evKeyDown :
  1013. begin
  1014. DontClear:=false;
  1015. case Event.KeyCode of
  1016. kbLeft,kbRight,
  1017. kbCtrlLeft,kbCtrlRight :
  1018. if Assigned(HScrollBar) then
  1019. HScrollBar^.HandleEvent(Event)
  1020. else
  1021. DontClear:=true;
  1022. else DontClear:=true;
  1023. end;
  1024. if DontClear=false then ClearEvent(Event);
  1025. end;
  1026. evMouseDown :
  1027. begin
  1028. if Event.double then
  1029. begin
  1030. Message(@Self,evKeyDown,kbEnter,nil);
  1031. ClearEvent(Event);
  1032. end;
  1033. end;
  1034. end;
  1035. inherited HandleEvent(Event);
  1036. end;
  1037. function TSymbolInheritanceView.GetPalette: PPalette;
  1038. const P: string[length(CBrowserOutline)] = CBrowserOutline;
  1039. begin
  1040. GetPalette:=@P;
  1041. end;
  1042. procedure TSymbolInheritanceView.Selected(I: Integer);
  1043. var P: pointer;
  1044. S: PSymbol;
  1045. St : String;
  1046. Anc: PObjectSymbol;
  1047. begin
  1048. P:=GetNode(I);
  1049. if P=nil then Exit;
  1050. S:=PObjectSymbol(P)^.Symbol;
  1051. { this happens for the top objects view (PM) }
  1052. if S=nil then exit;
  1053. st:=S^.GetName;
  1054. if S^.Ancestor=nil then
  1055. Anc:=ObjectTree
  1056. else
  1057. Anc:=SearchObjectForSymbol(S^.Ancestor);
  1058. OpenSymbolBrowser(Origin.X-1,FOC-Delta.Y+1,
  1059. st,
  1060. S^.GetText,S,nil,
  1061. S^.Items,S^.References,Anc,S^.MemInfo);
  1062. end;
  1063. {$endif FVISION}
  1064. {****************************************************************************
  1065. TBrowserTab
  1066. ****************************************************************************}
  1067. constructor TBrowserTab.Init(var Bounds: TRect; AItems: PBrowserTabItem);
  1068. begin
  1069. inherited Init(Bounds);
  1070. Options:=Options or ofPreProcess;
  1071. Items:=AItems;
  1072. SetParams(0,0);
  1073. end;
  1074. procedure TBrowserTab.SetParams(AFlags: word; ACurrent: Sw_integer);
  1075. begin
  1076. Flags:=AFlags;
  1077. SelectItem(ACurrent);
  1078. end;
  1079. procedure TBrowserTab.SelectItem(Index: Sw_integer);
  1080. var P: PBrowserTabItem;
  1081. begin
  1082. Current:=Index;
  1083. P:=GetItem(Current);
  1084. if (P<>nil) and (P^.Link<>nil) then
  1085. P^.Link^.Focus;
  1086. DrawView;
  1087. end;
  1088. function TBrowserTab.GetItemCount: sw_integer;
  1089. var Count: integer;
  1090. P: PBrowserTabItem;
  1091. begin
  1092. Count:=0; P:=Items;
  1093. while (P<>nil) do
  1094. begin
  1095. Inc(Count);
  1096. P:=P^.Next;
  1097. end;
  1098. GetItemCount:=Count;
  1099. end;
  1100. function TBrowserTab.GetItem(Index: sw_integer): PBrowserTabItem;
  1101. var Counter: integer;
  1102. P: PBrowserTabItem;
  1103. begin
  1104. P:=Items; Counter:=0;
  1105. while (P<>nil) and (Counter<Index) do
  1106. begin
  1107. P:=P^.Next;
  1108. Inc(Counter);
  1109. end;
  1110. GetItem:=P;
  1111. end;
  1112. procedure TBrowserTab.Draw;
  1113. var B: TDrawBuffer;
  1114. SelColor, NormColor, C: word;
  1115. I,CurX,Count: Sw_integer;
  1116. function Names(Idx: integer): char;
  1117. begin
  1118. Names:=GetItem(Idx)^.Sign;
  1119. end;
  1120. begin
  1121. NormColor:=GetColor(1); SelColor:=GetColor(2);
  1122. MoveChar(B,'Ä',SelColor,Size.X);
  1123. CurX:=0; Count:=0;
  1124. for I:=0 to GetItemCount-1 do
  1125. if (Flags and (1 shl I))<>0 then
  1126. begin
  1127. Inc(Count);
  1128. if Current=I then C:=SelColor
  1129. else C:=NormColor;
  1130. if Count=1 then MoveChar(B[CurX],'´',SelColor,1)
  1131. else MoveChar(B[CurX],'³',SelColor,1);
  1132. MoveCStr(B[CurX+1],' '+Names(I)+' ',C);
  1133. Inc(CurX,4);
  1134. end;
  1135. if Count>0 then
  1136. MoveChar(B[CurX],'Ã',SelColor,1);
  1137. WriteLine(0,0,Size.X,Size.Y,B);
  1138. end;
  1139. procedure TBrowserTab.HandleEvent(var Event: TEvent);
  1140. var I,Idx: integer;
  1141. DontClear: boolean;
  1142. P: TPoint;
  1143. function GetItemForCoord(X: integer): integer;
  1144. var I,CurX,Idx: integer;
  1145. begin
  1146. CurX:=0; Idx:=-1;
  1147. for I:=0 to GetItemCount-1 do
  1148. if (Flags and (1 shl I))<>0 then
  1149. begin
  1150. if (CurX+1<=X) and (X<=CurX+3) then
  1151. begin Idx:=I; Break; end;
  1152. Inc(CurX,4);
  1153. end;
  1154. GetItemForCoord:=Idx;
  1155. end;
  1156. begin
  1157. case Event.What of
  1158. evMouseDown :
  1159. if MouseInView(Event.Where) then
  1160. begin
  1161. repeat
  1162. MakeLocal(Event.Where,P);
  1163. Idx:=GetItemForCoord(P.X);
  1164. if Idx<>-1 then
  1165. SelectItem(Idx);
  1166. until not MouseEvent(Event, evMouseMove);
  1167. ClearEvent(Event);
  1168. end;
  1169. evKeyDown :
  1170. begin
  1171. DontClear:=false; Idx:=-1;
  1172. for I:=0 to GetItemCount-1 do
  1173. if GetCtrlCode(GetItem(I)^.Sign)=Event.KeyCode then
  1174. if (Flags and (1 shl I))<>0 then
  1175. begin
  1176. Idx:=I;
  1177. Break;
  1178. end;
  1179. if Idx=-1 then
  1180. DontClear:=true
  1181. else
  1182. SelectItem(Idx);
  1183. if DontClear=false then ClearEvent(Event);
  1184. end;
  1185. end;
  1186. inherited HandleEvent(Event);
  1187. end;
  1188. function TBrowserTab.GetPalette: PPalette;
  1189. const P: string[length(CBrowserTab)] = CBrowserTab;
  1190. begin
  1191. GetPalette:=@P;
  1192. end;
  1193. destructor TBrowserTab.Done;
  1194. begin
  1195. if Items<>nil then DisposeBrowserTabList(Items);
  1196. inherited Done;
  1197. end;
  1198. procedure TUnitInfoPanel.HandleEvent(var Event: TEvent);
  1199. begin
  1200. if (Event.What=evBroadcast) and (Event.Command=cmListItemSelected) and
  1201. (InOwnerCall=false) then
  1202. begin
  1203. InOwnerCall:=true;
  1204. if Assigned(Owner) then
  1205. Owner^.HandleEvent(Event);
  1206. InOwnerCall:=false;
  1207. end;
  1208. inherited HandleEvent(Event);
  1209. end;
  1210. constructor TBrowserWindow.Init(var Bounds: TRect; ATitle: TTitleStr; ANumber: Sw_Integer;ASym : PSymbol;
  1211. const AName,APrefix: string; ASymbols: PSymbolCollection; AReferences: PReferenceCollection;
  1212. AInheritance: PObjectSymbol; AMemInfo: PSymbolMemINfo);
  1213. var R,R2,R3: TRect;
  1214. HSB,VSB: PScrollBar;
  1215. CST: PColorStaticText;
  1216. I: sw_integer;
  1217. function CreateVSB(R: TRect): PScrollBar;
  1218. var R2: TRect;
  1219. SB: PScrollBar;
  1220. begin
  1221. R2.Copy(R); R2.Move(1,0); R2.A.X:=R2.B.X-1;
  1222. New(SB, Init(R2)); SB^.GrowMode:=gfGrowLoX+gfGrowHiX+gfGrowHiY;
  1223. CreateVSB:=SB;
  1224. end;
  1225. function CreateHSB(R: TRect): PScrollBar;
  1226. var R2: TRect;
  1227. SB: PScrollBar;
  1228. begin
  1229. R2.Copy(R); R2.Move(0,1); R2.A.Y:=R2.B.Y-1;
  1230. New(SB, Init(R2)); SB^.GrowMode:=gfGrowLoY+gfGrowHiX+gfGrowHiY;
  1231. CreateHSB:=SB;
  1232. end;
  1233. begin
  1234. inherited Init(Bounds, FormatStrStr(dialog_browse,ATitle), ANumber);
  1235. HelpCtx:=hcBrowserWindow;
  1236. Sym:=ASym;
  1237. Prefix:=NewStr(APrefix);
  1238. GetExtent(R); R.Grow(-1,-1); R.B.Y:=R.A.Y+1;
  1239. {$ifndef NODEBUG}
  1240. if {assigned(Debugger) and Debugger^.IsRunning and}
  1241. assigned(Sym) and (Sym^.typ=varsym) then
  1242. begin
  1243. New(DebuggerValue,Init(ATitle,Sym));
  1244. New(ST, Init(R, ' '+DebuggerValue^.GetText));
  1245. end
  1246. else
  1247. {$endif NODEBUG}
  1248. begin
  1249. New(ST, Init(R, ' '+AName));
  1250. DebuggerValue:=nil;
  1251. end;
  1252. ST^.GrowMode:=gfGrowHiX;
  1253. Insert(ST);
  1254. GetExtent(R); R.Grow(-1,-1); Inc(R.A.Y,2);
  1255. if assigned(ASymbols) and (ASymbols^.Count>0) then
  1256. begin
  1257. HSB:=CreateHSB(R);
  1258. Insert(HSB);
  1259. VSB:=CreateVSB(R);
  1260. Insert(VSB);
  1261. New(ScopeView, Init(R, ASymbols, HSB, VSB));
  1262. ScopeView^.GrowMode:=gfGrowHiX+gfGrowHiY;
  1263. Insert(ScopeView);
  1264. ScopeView^.MyBW:=@Self;
  1265. ScopeView^.SetGDBCol;
  1266. end;
  1267. if assigned(AReferences) and (AReferences^.Count>0) then
  1268. begin
  1269. HSB:=CreateHSB(R);
  1270. Insert(HSB);
  1271. VSB:=CreateVSB(R);
  1272. Insert(VSB);
  1273. New(ReferenceView, Init(R, AReferences, HSB, VSB));
  1274. ReferenceView^.GrowMode:=gfGrowHiX+gfGrowHiY;
  1275. Insert(ReferenceView);
  1276. ReferenceView^.MyBW:=@Self;
  1277. end;
  1278. if assigned(AInheritance) then
  1279. begin
  1280. HSB:=CreateHSB(R);
  1281. Insert(HSB);
  1282. VSB:=CreateVSB(R);
  1283. Insert(VSB);
  1284. {$ifndef FVISION}
  1285. New(InheritanceView, Init(R, HSB,VSB, AInheritance));
  1286. InheritanceView^.GrowMode:=gfGrowHiX+gfGrowHiY;
  1287. Insert(InheritanceView);
  1288. InheritanceView^.MyBW:=@Self;
  1289. {$endif FVISION}
  1290. end;
  1291. if assigned(AMemInfo) then
  1292. begin
  1293. New(MemInfoView, Init(R, AMemInfo));
  1294. MemInfoView^.GrowMode:=gfGrowHiX+gfGrowHiY;
  1295. Insert(MemInfoView);
  1296. MemInfoView^.MyBW:=@Self;
  1297. end;
  1298. if Assigned(Asym) and (TypeOf(ASym^)=TypeOf(TModuleSymbol)) then
  1299. with PModuleSymbol(Sym)^ do
  1300. begin
  1301. New(UnitInfo, Init(R));
  1302. UnitInfo^.GetExtent(R3);
  1303. R2.Copy(R3);
  1304. R2.B.Y:=R2.A.Y+3;
  1305. if (Assigned(UsedUnits) or Assigned(DependentUnits))=false then
  1306. R2.B.Y:=R3.B.Y;
  1307. HSB:=CreateHSB(R2); {UnitInfo^.Insert(HSB); HSB:=nil;}
  1308. VSB:=CreateVSB(R2);
  1309. {UnitInfo^.Insert(VSB);
  1310. VSB will be owned by UnitInfoText PM }
  1311. New(UnitInfoText, Init(R2,HSB,VSB, nil));
  1312. with UnitInfoText^ do
  1313. begin
  1314. GrowMode:=gfGrowHiX;
  1315. if Assigned(LoadedFrom) then
  1316. begin
  1317. AddLine(FormatStrStr2('%s : %s',msg_usedfirstin,GetStr(LoadedFrom)));
  1318. AddLine(FormatStrStr('%s : ',msg_mainsource));
  1319. AddLine(FormatStrStr(' %s',GetStr(MainSource)));
  1320. if Assigned(SourceFiles) and (SourceFiles^.Count>1) then
  1321. begin
  1322. AddLine(FormatStrStr('%s : ',msg_sourcefiles));
  1323. for I:=0 to SourceFiles^.Count-1 do
  1324. AddLine(FormatStrStr(' %s',GetStr(SourceFiles^.At(I))));
  1325. end;
  1326. end;
  1327. end;
  1328. UnitInfo^.Insert(UnitInfoText);
  1329. if Assigned(UsedUnits) then
  1330. begin
  1331. Inc(R2.A.Y,R2.B.Y-R2.A.Y); R2.B.Y:=R2.A.Y+1;
  1332. New(CST, Init(R2,'´ Used units Ã'+CharStr('Ä',255),ColorIndex(12),false));
  1333. CST^.GrowMode:=gfGrowHiX;
  1334. UnitInfo^.Insert(CST);
  1335. Inc(R2.A.Y,R2.B.Y-R2.A.Y); R2.B.Y:=R2.A.Y+4;
  1336. if Assigned(DependentUnits)=false then R2.B.Y:=R3.B.Y;
  1337. {HSB:=CreateHSB(R2); UnitInfo^.Insert(HSB); }
  1338. HSB:=nil;
  1339. VSB:=CreateVSB(R2);
  1340. {UnitInfo^.Insert(VSB); this created crashes,
  1341. that were difficult to findout PM }
  1342. New(UnitInfoUsed, Init(R2,UsedUnits,HSB,VSB));
  1343. UnitInfoUsed^.GrowMode:=gfGrowHiY+gfGrowHiX;
  1344. UnitInfoUsed^.MyBW:=@Self;
  1345. UnitInfo^.Insert(UnitInfoUsed);
  1346. end;
  1347. if Assigned(DependentUnits) then
  1348. begin
  1349. Inc(R2.A.Y,R2.B.Y-R2.A.Y); R2.B.Y:=R2.A.Y+1;
  1350. New(CST, Init(R2,'´ Dependent units Ã'+CharStr('Ä',255),ColorIndex(12),false));
  1351. CST^.GrowMode:=gfGrowLoY+gfGrowHiX+gfGrowHiY;
  1352. UnitInfo^.Insert(CST);
  1353. Inc(R2.A.Y,R2.B.Y-R2.A.Y); R2.B.Y:=R3.B.Y;
  1354. {HSB:=CreateHSB(R2); UnitInfo^.Insert(HSB); }
  1355. HSB:=nil;
  1356. VSB:=CreateVSB(R2);
  1357. { UnitInfo^.Insert(VSB); this created crashes,
  1358. that were difficult to findout PM }
  1359. New(UnitInfoDependent, Init(R2,DependentUnits,HSB,VSB));
  1360. UnitInfoDependent^.GrowMode:=gfGrowLoY+gfGrowHiX+gfGrowHiY;
  1361. UnitInfoDependent^.MyBW:=@Self;
  1362. UnitInfo^.Insert(UnitInfoDependent);
  1363. end;
  1364. if Assigned(UnitInfoText) then
  1365. UnitInfoText^.Select;
  1366. Insert(UnitInfo);
  1367. end;
  1368. GetExtent(R); R.Grow(-1,-1); R.Move(0,1); R.B.Y:=R.A.Y+1;
  1369. New(PageTab, Init(R,
  1370. NewBrowserTabItem(label_browsertab_scope,ScopeView,
  1371. NewBrowserTabItem(label_browsertab_reference,ReferenceView,
  1372. {$ifndef FVISION}
  1373. NewBrowserTabItem(label_browsertab_inheritance,InheritanceView,
  1374. {$endif FVISION}
  1375. NewBrowserTabItem(label_browsertab_memory,MemInfoView,
  1376. NewBrowserTabItem(label_browsertab_unit,UnitInfo,
  1377. nil))
  1378. {$ifndef FVISION}
  1379. )
  1380. {$endif FVISION}
  1381. ))));
  1382. PageTab^.GrowMode:=gfGrowHiX;
  1383. Insert(PageTab);
  1384. if assigned(ScopeView) then
  1385. SelectTab(btScope)
  1386. else
  1387. if assigned(ReferenceView) then
  1388. SelectTab(btReferences)
  1389. {$ifndef FVISION}
  1390. else
  1391. if assigned(InheritanceView) then
  1392. SelectTab(btInheritance)
  1393. {$endif FVISION}
  1394. ;
  1395. end;
  1396. destructor TBrowserWindow.Done;
  1397. begin
  1398. { UnitInfoText needs to be removed first
  1399. to avoid crashes within the UnitInfo destructor PM }
  1400. if Assigned(UnitInfoText) then
  1401. begin
  1402. UnitInfo^.Delete(UnitInfoText);
  1403. Dispose(UnitInfoText,Done);
  1404. UnitInfoText:=nil;
  1405. end;
  1406. if assigned(DebuggerValue) then
  1407. begin
  1408. Dispose(DebuggerValue,Done);
  1409. DebuggerValue:=nil;
  1410. end;
  1411. if assigned(Prefix) then
  1412. begin
  1413. DisposeStr(Prefix);
  1414. Prefix:=nil;
  1415. end;
  1416. inherited Done;
  1417. end;
  1418. procedure TBrowserWindow.HandleEvent(var Event: TEvent);
  1419. var DontClear: boolean;
  1420. S: PSymbol;
  1421. Symbols: PSymbolCollection;
  1422. Anc: PObjectSymbol;
  1423. P: TPoint;
  1424. begin
  1425. case Event.What of
  1426. evBroadcast :
  1427. case Event.Command of
  1428. cmDebuggerStopped :
  1429. begin
  1430. if Assigned(DebuggerValue) and
  1431. (DebuggerValue^.GDBI<>Event.InfoLong) then
  1432. begin
  1433. If Assigned(ST^.Text) then
  1434. DisposeStr(ST^.Text);
  1435. ST^.Text:=NewStr(DebuggerValue^.GetText);
  1436. ST^.DrawView;
  1437. end;
  1438. end;
  1439. cmSearchWindow :
  1440. ClearEvent(Event);
  1441. cmListItemSelected :
  1442. begin
  1443. S:=nil;
  1444. if (Event.InfoPtr=ScopeView) then
  1445. begin
  1446. S:=ScopeView^.Symbols^.At(ScopeView^.Focused);
  1447. MakeGlobal(ScopeView^.Origin,P);
  1448. Desktop^.MakeLocal(P,P); Inc(P.Y,ScopeView^.Focused-ScopeView^.TopItem);
  1449. Inc(P.Y);
  1450. end;
  1451. if (Event.InfoPtr=UnitInfoUsed) then
  1452. begin
  1453. S:=UnitInfoUsed^.Symbols^.At(UnitInfoUsed^.Focused);
  1454. MakeGlobal(UnitInfoUsed^.Origin,P);
  1455. Desktop^.MakeLocal(P,P); Inc(P.Y,UnitInfoUsed^.Focused-UnitInfoUsed^.TopItem);
  1456. Inc(P.Y);
  1457. end;
  1458. if (Event.InfoPtr=UnitInfoDependent) then
  1459. begin
  1460. S:=UnitInfoDependent^.Symbols^.At(UnitInfoDependent^.Focused);
  1461. MakeGlobal(UnitInfoDependent^.Origin,P);
  1462. Desktop^.MakeLocal(P,P); Inc(P.Y,UnitInfoDependent^.Focused-UnitInfoDependent^.TopItem);
  1463. Inc(P.Y);
  1464. end;
  1465. if Assigned(S) then
  1466. begin
  1467. if S^.Ancestor=nil then Anc:=nil else
  1468. Anc:=SearchObjectForSymbol(S^.Ancestor);
  1469. Symbols:=S^.Items;
  1470. if (not assigned(Symbols) or (symbols^.count=0)) then
  1471. if assigned(S^.Ancestor) then
  1472. Symbols:=S^.Ancestor^.Items;
  1473. if (S^.GetReferenceCount>0) or (assigned(Symbols) and (Symbols^.Count>0)) or (Anc<>nil) then
  1474. OpenSymbolBrowser(Origin.X-1,P.Y,
  1475. S^.GetName,
  1476. ScopeView^.GetText(ScopeView^.Focused,255),
  1477. S,@self,
  1478. Symbols,S^.References,Anc,S^.MemInfo);
  1479. end;
  1480. end;
  1481. end;
  1482. { evCommand :
  1483. begin
  1484. DontClear:=false;
  1485. case Event.Command of
  1486. cmGotoSymbol :
  1487. if Event.InfoPtr=ScopeView then
  1488. if ReferenceView<>nil then
  1489. if ReferenceView^.Range>0 then
  1490. ReferenceView^.GotoItem(0);
  1491. cmTrackSymbol :
  1492. if Event.InfoPtr=ScopeView then
  1493. if (ScopeView<>nil) and (ScopeView^.Range>0) then
  1494. begin
  1495. S:=ScopeView^.At(ScopeView^.Focused);
  1496. if (S^.References<>nil) and (S^.References^.Count>0) then
  1497. TrackItem(S^.References^.At(0));
  1498. else DontClear:=true;
  1499. end;
  1500. if DontClear=false then ClearEvent(Event);
  1501. end;}
  1502. evKeyDown :
  1503. begin
  1504. DontClear:=false;
  1505. case Event.KeyCode of
  1506. kbEsc :
  1507. Close;
  1508. else DontClear:=true;
  1509. end;
  1510. if DontClear=false then ClearEvent(Event);
  1511. end;
  1512. end;
  1513. inherited HandleEvent(Event);
  1514. end;
  1515. procedure TBrowserWindow.SetState(AState: Word; Enable: Boolean);
  1516. {var OldState: word;}
  1517. begin
  1518. { OldState:=State;}
  1519. inherited SetState(AState,Enable);
  1520. { if ((State xor OldState) and sfActive)<>0 then
  1521. if GetState(sfActive)=false then
  1522. Message(Desktop,evBroadcast,cmClearLineHighlights,nil);}
  1523. end;
  1524. procedure TBrowserWindow.Close;
  1525. begin
  1526. inherited Close;
  1527. end;
  1528. procedure TBrowserWindow.SelectTab(BrowserTab: Sw_integer);
  1529. var Tabs: Sw_integer;
  1530. { PB : PBreakpoint;
  1531. PS :PString;
  1532. l : longint; }
  1533. begin
  1534. (* case BrowserTab of
  1535. btScope :
  1536. if assigned(ScopeView) then
  1537. ScopeView^.Select;
  1538. btReferences :
  1539. if assigned(ReferenceView) then
  1540. ReferenceView^.Select;
  1541. btBreakWatch :
  1542. begin
  1543. if Assigned(Sym) then
  1544. begin
  1545. if Pos('proc',Sym^.GetText)>0 then
  1546. { insert function breakpoint }
  1547. begin
  1548. { make it visible }
  1549. PS:=Sym^.Name;
  1550. l:=Length(PS^);
  1551. If PS^[l]='*' then
  1552. begin
  1553. PB:=BreakpointsCollection^.GetType(bt_function,copy(GetStr(PS),1,l-1));
  1554. If Assigned(PB) then
  1555. BreakpointsCollection^.Delete(PB);
  1556. Sym^.Name:=NewStr(copy(GetStr(PS),1,l-1));
  1557. DrawView;
  1558. DisposeStr(PS);
  1559. end
  1560. else
  1561. begin
  1562. Sym^.Name:=NewStr(GetStr(PS)+'*');
  1563. DrawView;
  1564. New(PB,init_function(GetStr(PS)));
  1565. DisposeStr(PS);
  1566. BreakpointsCollection^.Insert(PB);
  1567. BreakpointsCollection^.Update;
  1568. end;
  1569. end
  1570. else if pos('var',Sym^.GetText)>0 then
  1571. { insert watch point }
  1572. begin
  1573. { make it visible }
  1574. PS:=Sym^.Name;
  1575. l:=Length(PS^);
  1576. If PS^[l]='*' then
  1577. begin
  1578. PB:=BreakpointsCollection^.GetType(bt_awatch,copy(PS^,1,l-1));
  1579. If Assigned(PB) then
  1580. BreakpointsCollection^.Delete(PB);
  1581. Sym^.Name:=NewStr(copy(PS^,1,l-1));
  1582. DrawView;
  1583. DisposeStr(PS);
  1584. end
  1585. else
  1586. begin
  1587. Sym^.Name:=NewStr(GetStr(PS)+'*');
  1588. DrawView;
  1589. New(PB,init_type(bt_awatch,GetStr(PS)));
  1590. DisposeStr(PS);
  1591. BreakpointsCollection^.Insert(PB);
  1592. BreakpointsCollection^.Update;
  1593. end;
  1594. end;
  1595. end;
  1596. end;
  1597. end;*)
  1598. Tabs:=0;
  1599. if assigned(ScopeView) then
  1600. Tabs:=Tabs or (1 shl btScope);
  1601. if assigned(ReferenceView) then
  1602. Tabs:=Tabs or (1 shl btReferences);
  1603. {$ifndef FVISION}
  1604. if assigned(InheritanceView) then
  1605. Tabs:=Tabs or (1 shl btInheritance);
  1606. {$endif FVISION}
  1607. if assigned(MemInfoView) then
  1608. Tabs:=Tabs or (1 shl btMemInfo);
  1609. if Assigned(Sym) then
  1610. if (Pos('proc',Sym^.GetText)>0) or (Pos('var',Sym^.GetText)>0) then
  1611. Tabs:=Tabs or (1 shl btBreakWatch);
  1612. if assigned(UnitInfo) then
  1613. Tabs:=Tabs or (1 shl btUnitInfo);
  1614. if PageTab<>nil then PageTab^.SetParams(Tabs,BrowserTab);
  1615. end;
  1616. function TBrowserWindow.GetPalette: PPalette;
  1617. const S: string[length(CBrowserWindow)] = CBrowserWindow;
  1618. begin
  1619. GetPalette:=@S;
  1620. end;
  1621. procedure OpenSymbolBrowser(X,Y: Sw_integer;const Name,Line: string;S : PSymbol;
  1622. ParentBrowser : PBrowserWindow;
  1623. Symbols: PSymbolCollection; References: PReferenceCollection;
  1624. Inheritance: PObjectSymbol; MemInfo: PSymbolMemInfo);
  1625. var R: TRect;
  1626. PB : PBrowserWindow;
  1627. St,st2 : string;
  1628. begin
  1629. if X=0 then X:=Desktop^.Size.X-35;
  1630. R.A.X:=X; R.A.Y:=Y;
  1631. R.B.X:=R.A.X+35; R.B.Y:=R.A.Y+15;
  1632. while (R.B.Y>Desktop^.Size.Y) do R.Move(0,-1);
  1633. if assigned(ParentBrowser) and assigned(ParentBrowser^.Prefix) and
  1634. assigned(ParentBrowser^.sym) and
  1635. (ParentBrowser^.sym^.typ<>unitsym)
  1636. {$ifdef COMPILER_1_0}
  1637. and (ParentBrowser^.sym^.typ<>programsym)
  1638. {$endif COMPILER_1_0}
  1639. then
  1640. begin
  1641. st:=GetStr(ParentBrowser^.Prefix)+' '+Name;
  1642. end
  1643. else
  1644. st:=Name;
  1645. st2:=st;
  1646. if assigned(S) and ((S^.Flags and sfPointer)<>0) then
  1647. begin
  1648. st:=st+'^';
  1649. if assigned(S^.Ancestor) and
  1650. ((S^.Ancestor^.Flags and sfRecord)<>0) then
  1651. st:=st+'.';
  1652. end
  1653. else if assigned(S) and ((S^.Flags and sfRecord)<>0) then
  1654. st:=st+'.';
  1655. PB:=New(PBrowserWindow, Init(R,
  1656. st2,SearchFreeWindowNo,S,Line,st,
  1657. Symbols,References,Inheritance,MemInfo));
  1658. {$ifndef GABOR}
  1659. if (assigned(S) and (S^.typ=varsym)) or
  1660. (assigned(ParentBrowser) and ParentBrowser^.IsValid) then
  1661. PB^.IsValid:=true;
  1662. {$endif}
  1663. Desktop^.Insert(PB);
  1664. end;
  1665. END.
  1666. {
  1667. $Log$
  1668. Revision 1.3 2001-08-05 12:23:00 peter
  1669. * Automatically support for fvision or old fv
  1670. Revision 1.2 2001/08/05 02:01:48 peter
  1671. * FVISION define to compile with fvision units
  1672. Revision 1.1 2001/08/04 11:30:24 peter
  1673. * ide works now with both compiler versions
  1674. Revision 1.1.2.7 2001/04/06 22:13:38 pierre
  1675. * fix trobles with Symbol browsers
  1676. Revision 1.1.2.6 2001/03/22 01:13:17 pierre
  1677. * fix some double insert problems
  1678. Revision 1.1.2.5 2001/03/20 00:20:42 pierre
  1679. * fix some memory leaks + several small enhancements
  1680. Revision 1.1.2.4 2001/03/18 01:09:50 pierre
  1681. * fix some label oddities
  1682. Revision 1.1.2.3 2001/03/15 00:31:06 pierre
  1683. * avoid crash on Globals
  1684. Revision 1.1.2.2 2000/11/13 16:59:09 pierre
  1685. * some function in double removed from fputils unit
  1686. Revision 1.1.2.1 2000/09/27 21:06:11 pierre
  1687. * fix GPF in tbrowserwindow.init
  1688. Revision 1.1 2000/07/13 09:48:36 michael
  1689. + Initial import
  1690. Revision 1.30 2000/07/05 10:19:07 pierre
  1691. + display 'variable' for open array size
  1692. Revision 1.29 2000/06/22 09:07:12 pierre
  1693. * Gabor changes: see fixes.txt
  1694. Revision 1.28 2000/06/16 08:50:42 pierre
  1695. + new bunch of Gabor's changes
  1696. Revision 1.27 2000/05/29 10:44:57 pierre
  1697. + New bunch of Gabor's changes: see fixes.txt
  1698. Revision 1.26 2000/05/02 08:42:28 pierre
  1699. * new set of Gabor changes: see fixes.txt
  1700. Revision 1.25 2000/04/18 11:42:37 pierre
  1701. lot of Gabor changes : see fixes.txt
  1702. Revision 1.24 2000/03/21 23:26:55 pierre
  1703. adapted to wcedit addition
  1704. Revision 1.23 2000/03/15 10:29:03 pierre
  1705. * TGDBValue object
  1706. Revision 1.22 2000/03/08 16:53:21 pierre
  1707. * Value of vars in browsers cleaned up
  1708. Revision 1.21 2000/03/07 21:55:16 pierre
  1709. + Add current value to browser
  1710. Revision 1.20 1999/11/10 00:42:42 pierre
  1711. * LookUp function now returns the complete name in browcol
  1712. and fpsymbol only yakes a part of LoopUpStr
  1713. Revision 1.19 1999/09/16 14:34:59 pierre
  1714. + TBreakpoint and TWatch registering
  1715. + WatchesCollection and BreakpointsCollection stored in desk file
  1716. * Syntax highlighting was broken
  1717. Revision 1.18 1999/07/28 23:11:22 peter
  1718. * fixes from gabor
  1719. Revision 1.17 1999/06/28 12:35:05 pierre
  1720. + CloseAllBrowsers needed before compilation to avoid problems
  1721. + ModulesCollection and GlobalsCollection to avoid memory leaks
  1722. Revision 1.16 1999/06/17 23:44:01 pierre
  1723. * problem with Inheritance list
  1724. Revision 1.15 1999/04/15 08:58:06 peter
  1725. * syntax highlight fixes
  1726. * browser updates
  1727. Revision 1.14 1999/04/07 21:55:53 peter
  1728. + object support for browser
  1729. * html help fixes
  1730. * more desktop saving things
  1731. * NODEBUG directive to exclude debugger
  1732. Revision 1.13 1999/03/16 00:44:44 peter
  1733. * forgotten in last commit :(
  1734. Revision 1.12 1999/03/01 15:42:02 peter
  1735. + Added dummy entries for functions not yet implemented
  1736. * MenuBar didn't update itself automatically on command-set changes
  1737. * Fixed Debugging/Profiling options dialog
  1738. * TCodeEditor converts spaces to tabs at save only if efUseTabChars is
  1739. set
  1740. * efBackSpaceUnindents works correctly
  1741. + 'Messages' window implemented
  1742. + Added '$CAP MSG()' and '$CAP EDIT' to available tool-macros
  1743. + Added TP message-filter support (for ex. you can call GREP thru
  1744. GREP2MSG and view the result in the messages window - just like in TP)
  1745. * A 'var' was missing from the param-list of THelpFacility.TopicSearch,
  1746. so topic search didn't work...
  1747. * In FPHELP.PAS there were still context-variables defined as word instead
  1748. of THelpCtx
  1749. * StdStatusKeys() was missing from the statusdef for help windows
  1750. + Topic-title for index-table can be specified when adding a HTML-files
  1751. Revision 1.11 1999/02/22 11:51:38 peter
  1752. * browser updates from gabor
  1753. Revision 1.9 1999/02/18 13:44:34 peter
  1754. * search fixed
  1755. + backward search
  1756. * help fixes
  1757. * browser updates
  1758. Revision 1.7 1999/02/16 12:44:20 pierre
  1759. * DoubleClick works now
  1760. Revision 1.6 1999/02/10 09:44:59 pierre
  1761. + added B tab for functions and vars for break/watch
  1762. TBrowserWindow also stores the symbol itself for break/watchpoints
  1763. Revision 1.5 1999/02/04 17:53:47 pierre
  1764. + OpenOneSymbolBrowser
  1765. Revision 1.4 1999/02/04 13:16:14 pierre
  1766. + column info added
  1767. Revision 1.3 1999/01/21 11:54:23 peter
  1768. + tools menu
  1769. + speedsearch in symbolbrowser
  1770. * working run command
  1771. Revision 1.2 1999/01/14 21:42:24 peter
  1772. * source tracking from Gabor
  1773. Revision 1.1 1999/01/12 14:29:40 peter
  1774. + Implemented still missing 'switch' entries in Options menu
  1775. + Pressing Ctrl-B sets ASCII mode in editor, after which keypresses (even
  1776. ones with ASCII < 32 ; entered with Alt+<###>) are interpreted always as
  1777. ASCII chars and inserted directly in the text.
  1778. + Added symbol browser
  1779. * splitted fp.pas to fpide.pas
  1780. Revision 1.0 1999/01/09 11:49:41 gabor
  1781. Original implementation
  1782. }