1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
|
{
This file is part of the Free Pascal Integrated Development Environment
Copyright (c) 1998 by Berczi Gabor
Search menu entries
See the file COPYING.FPC, included in this distribution,
for details about the copyright.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
**********************************************************************}
function ProcedureDialog(S : string) : PDialog;
var D: PDialog;
R,R1,R2: TRect;
IL: PEditorInputLine;
begin
R.Assign(0,0,40,8);
New(D, Init(R, dialog_proceduredialog));
with D^ do
begin
Options:=Options or ofCentered;
GetExtent(R); R.Grow(-3,-2); R.B.Y:=R.A.Y+1;
R1.Copy(R);
R2.Copy(R); Inc(R2.A.Y);Inc(R2.B.Y);
New(IL, Init(R2,255));
Insert(IL);
IL^.SetData(S);
Insert(New(PLabel, Init(R1, label_enterproceduretofind, IL)));
GetExtent(R); R.Grow(-8,-1); R.A.Y:=R.B.Y-2; R.B.X:=R.A.X+10;
Insert(New(PButton, Init(R, button_OK, cmOK, bfDefault)));
R.Move(15,0);
Insert(New(PButton, Init(R, button_Cancel, cmCancel, bfNormal)));
end;
IL^.Select;
ProcedureDialog:=D;
end;
procedure TIDEApp.FindProcedure;
var R: TRect;
S: PSortedSymbolCollection;
Overflow: boolean;
ProcS : string;
Level : longint;
function NameMatches(const St : string) : boolean;
begin
NameMatches:=(ProcS='') or (Pos(ProcS,UpcaseStr(St)) > 0);
end;
procedure InsertInS(P: PSymbol);
procedure InsertItemsInS(P: PSymbolCollection);
var I: Sw_integer;
begin
for I:=0 to P^.Count-1 do
InsertInS(P^.At(I));
end;
begin
Inc(level);
if S^.Count=MaxCollectionSize then
begin Overflow:=true; Exit; end;
if {(P^.typ = procsym) this needs symconst unit which I prefer to avoid }
((P^.GetTypeName='proc') or (P^.GetTypeName='func'))
and NameMatches(P^.GetName) then
S^.Insert(P);
{ this is wrong because it inserted args or locals of proc
in the globals list !! PM}
if (P^.Items<>nil) and (level=1) then
InsertItemsInS(P^.Items);
Dec(level);
end;
var
EditorWindow : PSourceWindow;
begin
level:=0;
if BrowCol.Modules=nil then
begin ErrorBox(msg_nodebuginfoavailable,nil); Exit; end;
EditorWindow:=FirstEditorWindow;
If assigned(EditorWindow) then
ProcS:=LowerCaseStr(EditorWindow^.Editor^.GetCurrentWord)
else
ProcS:='';
if ExecuteDialog(ProcedureDialog(ProcS),@ProcS)=cmCancel then
exit;
ProcS:=UpcaseStr(ProcS);
Overflow:=false;
if assigned(ProcedureCollection) then
begin
ProcedureCollection^.deleteAll;
Dispose(ProcedureCollection,done);
end;
New(S, Init(500,500));
ProcedureCollection:=S;
BrowCol.Modules^.ForEach(TCallbackProcParam(@InsertInS));
if Overflow then
WarningBox(msg_toomanysymbolscantdisplayall,nil);
Desktop^.GetExtent(R); R.A.X:=R.B.X-35;
Desktop^.Insert(New(PBrowserWindow, Init(R,
label_sym_findprocedure,SearchFreeWindowNo,nil,label_sym_findprocedure2+ProcS,'',S,nil,nil,nil)));
end;
procedure TIDEApp.Objects;
begin
if ObjectTree=nil then
begin ErrorBox(msg_nodebuginfoavailable,nil); Exit; end;
OpenSymbolBrowser(0,0,label_sym_objects,label_sym_globalscope,nil,nil,nil,nil,ObjectTree,nil);
end;
procedure TIDEApp.Globals;
var R: TRect;
S: PSortedSymbolCollection;
Overflow: boolean;
Level : longint;
procedure InsertInS(P: PSymbol);
procedure InsertItemsInS(P: PSymbolCollection);
var I: Sw_integer;
begin
for I:=0 to P^.Count-1 do
InsertInS(P^.At(I));
end;
begin
Inc(level);
if S^.Count=MaxCollectionSize then
begin Overflow:=true; Exit; end;
S^.Insert(P);
{ this is wrong because it inserted args or locals of proc
in the globals list !! PM}
if (P^.Items<>nil) and (level=1) then
InsertItemsInS(P^.Items);
Dec(level);
end;
begin
level:=0;
if BrowCol.Modules=nil then
begin ErrorBox(msg_nodebuginfoavailable,nil); Exit; end;
Overflow:=false;
if assigned(GlobalsCollection) then
begin
GlobalsCollection^.deleteAll;
Dispose(GlobalsCollection,done);
end;
New(S, Init(500,500));
GlobalsCollection:=S;
BrowCol.Modules^.ForEach(TCallbackProcParam(@InsertInS));
if Overflow then
WarningBox(msg_toomanysymbolscantdisplayall,nil);
Desktop^.GetExtent(R); R.A.X:=R.B.X-35;
Desktop^.Insert(New(PBrowserWindow, Init(R,
label_sym_globals,SearchFreeWindowNo,nil,label_sym_globalscope,'',S,nil,nil,nil)));
end;
procedure TIDEApp.Modules;
var
R: TRect;
S: PSortedSymbolCollection;
procedure InsertInS(P: PSymbol);
begin
S^.Insert(P);
end;
begin
if BrowCol.Modules=nil then
begin ErrorBox(msg_nodebuginfoavailable,nil); Exit; end;
if assigned(ModulesCollection) then
begin
ModulesCollection^.deleteAll;
Dispose(ModulesCollection,done);
end;
New(S, Init(500,500));
ModulesCollection:=S;
BrowCol.Modules^.ForEach(TCallbackProcParam(@InsertInS));
Desktop^.GetExtent(R); R.A.X:=R.B.X-35;
Desktop^.Insert(New(PBrowserWindow, Init(R,
dialog_units,SearchFreeWindowNo,nil,label_sym_globalscope,'',S,nil,nil,nil)));
end;
function SymbolDialog(S : string) : PDialog;
var D: PDialog;
R,R1,R2: TRect;
IL: PEditorInputLine;
begin
R.Assign(0,0,40,8);
New(D, Init(R, dialog_browsesymbol));
with D^ do
begin
Options:=Options or ofCentered;
GetExtent(R); R.Grow(-3,-2); R.B.Y:=R.A.Y+1;
R1.Copy(R);
R2.Copy(R); Inc(R2.A.Y);Inc(R2.B.Y);
New(IL, Init(R2,255));
Insert(IL);
IL^.SetData(S);
Insert(New(PLabel, Init(R1, label_entersymboltobrowse, IL)));
GetExtent(R); R.Grow(-8,-1); R.A.Y:=R.B.Y-2; R.B.X:=R.A.X+10;
Insert(New(PButton, Init(R, button_OK, cmOK, bfDefault)));
R.Move(15,0);
Insert(New(PButton, Init(R, button_Cancel, cmCancel, bfNormal)));
end;
IL^.Select;
SymbolDialog:=D;
end;
procedure TIDEApp.SearchSymbol;
var
EditorWindow : PSourceWindow;
S : string;
begin
EditorWindow:=FirstEditorWindow;
If assigned(EditorWindow) then
S:=LowerCaseStr(EditorWindow^.Editor^.GetCurrentWord)
else
S:='';
if ExecuteDialog(SymbolDialog(S),@S)<>cmCancel then
OpenOneSymbolBrowser(S);
end;
|