Menu

[r2017]: / trunk / Src / UDialogMgr.pas  Maximize  Restore  History

Download this file

319 lines (284 with data), 10.3 kB

  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
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
{
* UDialogMgr.pas
*
* Implements class that manages the display of dialog boxes.
*
* $Rev$
* $Date$
*
* ***** BEGIN LICENSE BLOCK *****
*
* Version: MPL 1.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
* the specific language governing rights and limitations under the License.
*
* The Original Code is UDialogMgr.pas
*
* The Initial Developer of the Original Code is Peter Johnson
* (http://www.delphidabbler.com/).
*
* Portions created by the Initial Developer are Copyright (C) 2007-2012 Peter
* Johnson. All Rights Reserved.
*
* Contributor(s)
* NONE
*
* ***** END LICENSE BLOCK *****
}
unit UDialogMgr;
interface
uses
// Delphi
Classes,
// Project
DB.USnippet, UCompileMgr, USearch;
type
{
TDialogMgr:
Class that manages the display of dialog boxes. Has Owner property that is
supplied to each dialog box as it is displayed.
}
TDialogMgr = class(TComponent)
public
procedure ShowAboutDlg;
{Displays About box.
}
procedure ShowBugReportDlg;
{Displays Bug Report dialog box.
}
function ExecFindCompilerDlg(out ASearch: ISearch;
out RefineExisting: Boolean): Boolean;
{Displays Find Compiler dialog box.
@param ASearch [out] Set to object recording search details if user OKs.
@param RefineExisting [out] Set to flag indicating if any existing
search is to be refined (True) or if compiler search is to apply to
whole database (False).
@return True if user OKs or false if user cancels.
}
function ExecFindTextDlg(out ASearch: ISearch; out RefineExisting: Boolean):
Boolean;
{Displays Find Text dialog box.
@param ASearch [out] Set to object recording search details if user OKs.
@param RefineExisting [out] Set to flag indicating if any existing
search is to be refined (True) or if text search is to apply to whole
database (False).
@return True if user OKs or false if user cancels.
}
function ExecFindXRefsDlg(const ASnippet: TSnippet;
out ASearch: ISearch): Boolean;
{Displays Find Cross References dialog box.
@param ASnippet [in] Snippet for which Cross-references are required.
@param ASearch [out] Set to object recording search details if user OKs.
@return True if user OKs or false if user cancels.
}
function ExecPreferencesDlg(out UpdateUI: Boolean): Boolean;
{Display Preferences dialog box.
@param UpdateUI [out] Flag indicates if UI needs to be updated as a
result of changes to preferences.
@return True if user OKs and preferences are updated or False if
cancelled.
}
function ExecRegistrationDlg: Boolean;
{Displays Registration dialog box.
@return True if program was registered and False if not.
}
function ExecSelectionSearchDlg(const SelectedSnippets: TSnippetList;
out ASearch: ISearch): Boolean;
{Displays Select Snippets dialog box.
@param SelectedSnippets [in] Default list of selected snippets.
@param ASearch [out] Search to be performed if user OKs.
@return True if user OKs or false if user cancels.
}
function ExecUpdateDlg: Boolean;
{Displays Update From Web dialog box.
@return True if database updated succesfully or false if database up to
date, update failed or user cancelled.
}
function ExecPrintDlg: Boolean;
{Displays Print dialog box.
@return True if user OKs, False if cancelled.
}
function ExecPageSetupDlg: Boolean;
{Displays Page Setup dialog box. Records page setup in persistent storage
if user OKs.
@return True if user OKs, False if cancelled.
}
procedure ShowDonateDlg;
{Displays Donate dialog box.
}
procedure ShowTestUnit(const Snippet: TSnippet);
{Displays test unit used to test compile a snippet.
@param Snippet [in] Snippet to be test compiled.
}
procedure ShowDependencyTree(const Snippet: TSnippet);
{Displays dependency tree for a snippet.
@param Snippet [in] Snippet for which dependency tree is required.
}
function ExecProxyServerDlg: Boolean;
{Displays Proxy Server configuration dialog box.
@return True if user OKs or False if user cancels.
}
procedure ShowNewsDlg;
{Displays latest news about CodeSnip and database in a dialog box.
}
procedure ShowTestCompileDlg(const CompileMgr: TCompileMgr;
const Snippet: TSnippet);
{Displays test compile dialog box that performs a test compilation.
@param CompileMgr [in] Object used to manage compilation and retain
results.
@param Snippet [in] Snippet to be compiled.
}
end;
implementation
uses
// Project
FmAboutDlg, FmDependenciesDlg, FmDonateDlg, FmFindCompilerDlg, FmFindTextDlg,
FmFindXRefsDlg, FmNewsDlg, FmPreferencesDlg, FmPrintDlg, FmProxyServerDlg,
FmRegistrationDlg, FmSelectionSearchDlg, FmTestCompileDlg, FmUpdateDlg,
FmUserBugReportDlg, UPageSetupDlgMgr, UTestUnitDlgMgr;
{ TDialogMgr }
function TDialogMgr.ExecFindCompilerDlg(out ASearch: ISearch;
out RefineExisting: Boolean): Boolean;
{Displays Find Compiler dialog box.
@param ASearch [out] Set to object recording search details if user OKs.
@param RefineExisting [out] Set to flag indicating if any existing search is
to be refined (True) or if compiler search is to apply to whole database
(False).
@return True if user OKs or false if user cancels.
}
begin
Result := TFindCompilerDlg.Execute(Owner, ASearch, RefineExisting);
end;
function TDialogMgr.ExecFindTextDlg(out ASearch: ISearch;
out RefineExisting: Boolean): Boolean;
{Displays Find Text dialog box.
@param ASearch [out] Set to object recording search details if user OKs.
@param RefineExisting [out] Set to flag indicating if any existing search is
to be refined (True) or if text search is to apply to whole database
(False).
@return True if user OKs or false if user cancels.
}
begin
Result := TFindTextDlg.Execute(Owner, ASearch, RefineExisting);
end;
function TDialogMgr.ExecFindXRefsDlg(const ASnippet: TSnippet;
out ASearch: ISearch): Boolean;
{Displays Find Cross References dialog box.
@param ASnippet [in] Snippet for which Cross-references are required.
@param ASearch [out] Set to object recording search details if user OKs.
@return True if user OKs or false if user cancels.
}
begin
Result := TFindXRefsDlg.Execute(Owner, ASnippet, ASearch);
end;
function TDialogMgr.ExecPageSetupDlg: Boolean;
{Displays Page Setup dialog box. Records page setup in persistent storage if
user OKs.
@return True if user OKs, False if cancelled.
}
begin
Result := TPageSetupDlgMgr.Execute(Owner);
end;
function TDialogMgr.ExecPreferencesDlg(out UpdateUI: Boolean): Boolean;
{Display Preferences dialog box.
@param UpdateUI [out] Flag indicates if UI needs to be updated as a result
of changes to preferences.
@return True if user OKs and preferences are updated or False if cancelled.
}
begin
Result := TPreferencesDlg.Execute(Owner, UpdateUI);
end;
function TDialogMgr.ExecPrintDlg: Boolean;
{Displays Print dialog box.
@return True if user OKs, False if cancelled.
}
begin
Result := TPrintDlg.Execute(Owner);
end;
function TDialogMgr.ExecProxyServerDlg: Boolean;
{Displays Proxy Server configuration dialog box.
@return True if user OKs or False if user cancels.
}
begin
Result := TProxyServerDlg.Execute(Owner);
end;
function TDialogMgr.ExecRegistrationDlg: Boolean;
{Displays Registration dialog box.
@return True if program was registered and False if not.
}
begin
Result := TRegistrationDlg.Execute(Owner);
end;
function TDialogMgr.ExecSelectionSearchDlg(
const SelectedSnippets: TSnippetList; out ASearch: ISearch): Boolean;
{Displays Select Snippets dialog box.
@param SelectedSnippets [in] Default list of selected snippets.
@param ASearch [out] Search to be performed if user OKs.
@return True if user OKs or false if user cancels.
}
begin
Result := TSelectionSearchDlg.Execute(Owner, SelectedSnippets, ASearch);
end;
function TDialogMgr.ExecUpdateDlg: Boolean;
{Displays Update From Web dialog box.
@return True if database updated succesfully or false if database up to
date, update failed or user cancelled.
}
begin
Result := TUpdateDlg.Execute(Owner);
end;
procedure TDialogMgr.ShowAboutDlg;
{Displays About box.
}
begin
TAboutDlg.Execute(Owner);
end;
procedure TDialogMgr.ShowBugReportDlg;
{Displays Bug Report dialog box.
}
begin
TUserBugReportDlg.Execute(Owner);
end;
procedure TDialogMgr.ShowDependencyTree(const Snippet: TSnippet);
{Displays dependency tree for a snippet.
@param Snippet [in] Snippet for which dependency tree is required.
}
begin
TDependenciesDlg.Execute(Owner, Snippet, [tiDependsUpon, tiRequiredBy]);
end;
procedure TDialogMgr.ShowDonateDlg;
{Displays Donate dialog box.
}
begin
TDonateDlg.Execute(Owner);
end;
procedure TDialogMgr.ShowNewsDlg;
{Displays latest news about CodeSnip and database in a dialog box.
}
begin
TNewsDlg.Execute(Owner);
end;
procedure TDialogMgr.ShowTestCompileDlg(const CompileMgr: TCompileMgr;
const Snippet: TSnippet);
{Displays test compile dialog box that performs a test compilation.
@param CompileMgr [in] Object used to manage compilation and retain
results.
@param Snippet [in] Snippet to be compiled.
}
begin
TTestCompileDlg.Execute(Owner, CompileMgr, Snippet);
end;
procedure TDialogMgr.ShowTestUnit(const Snippet: TSnippet);
{Displays test unit used to test compile a snippet.
@param Snippet [in] Snippet to be test compiled.
}
begin
TTestUnitDlgMgr.DisplayTestUnit(Owner, Snippet);
end;
end.
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.