fpsymbol.pas 54 KB

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