Skip to content

Commit 49742d6

Browse files
author
delphidabbler
committed
Remove user info page from Code Import wizard dialogue box
1 parent a951250 commit 49742d6

File tree

2 files changed

+45
-127
lines changed

2 files changed

+45
-127
lines changed

Src/FmCodeImportDlg.dfm

Lines changed: 14 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
11
inherited CodeImportDlg: TCodeImportDlg
22
Caption = 'Import Wizard'
33
ExplicitWidth = 565
4-
ExplicitHeight = 433
4+
ExplicitHeight = 436
55
PixelsPerInch = 96
66
TextHeight = 13
77
inherited pnlBody: TPanel
88
Height = 321
99
ExplicitHeight = 321
1010
inherited pcWizard: TPageControl
1111
Height = 288
12-
ActivePage = tsUpdate
12+
ActivePage = tsFile
1313
ExplicitHeight = 288
1414
object tsInfo: TTabSheet
1515
Caption = 'tsInfo'
1616
TabVisible = False
17+
ExplicitLeft = 0
18+
ExplicitTop = 0
19+
ExplicitWidth = 0
20+
ExplicitHeight = 0
1721
object lblIntro: TLabel
1822
Left = 0
1923
Top = 8
@@ -33,15 +37,15 @@ inherited CodeImportDlg: TCodeImportDlg
3337
object lblFile: TLabel
3438
Left = 0
3539
Top = 8
36-
Width = 220
40+
Width = 230
3741
Height = 13
3842
Caption = 'Open import &file: (click button to browse for file)'
3943
FocusControl = edFile
4044
end
4145
object lblLoadFile: TLabel
4246
Left = 0
4347
Top = 72
44-
Width = 172
48+
Width = 179
4549
Height = 13
4650
Caption = 'Click the Next button to read the file.'
4751
end
@@ -67,76 +71,22 @@ inherited CodeImportDlg: TCodeImportDlg
6771
TabOrder = 1
6872
end
6973
end
70-
object tsUserInfo: TTabSheet
71-
Caption = 'tsUserInfo'
72-
ImageIndex = 2
73-
TabVisible = False
74-
object lblName: TLabel
75-
Left = 0
76-
Top = 8
77-
Width = 31
78-
Height = 13
79-
Caption = 'Name:'
80-
end
81-
object lblEmail: TLabel
82-
Left = 0
83-
Top = 45
84-
Width = 28
85-
Height = 13
86-
Caption = 'Email:'
87-
end
88-
object lblComments: TLabel
89-
Left = 0
90-
Top = 85
91-
Width = 52
92-
Height = 13
93-
Caption = 'Comments:'
94-
end
95-
object edComments: TMemo
96-
Left = 72
97-
Top = 82
98-
Width = 297
99-
Height = 154
100-
ParentColor = True
101-
ReadOnly = True
102-
ScrollBars = ssVertical
103-
TabOrder = 2
104-
end
105-
object edName: TEdit
106-
Left = 72
107-
Top = 3
108-
Width = 297
109-
Height = 21
110-
ParentColor = True
111-
ReadOnly = True
112-
TabOrder = 0
113-
end
114-
object edEmail: TEdit
115-
Left = 72
116-
Top = 42
117-
Width = 297
118-
Height = 21
119-
ParentColor = True
120-
ReadOnly = True
121-
TabOrder = 1
122-
end
123-
end
12474
object tsUpdate: TTabSheet
12575
Caption = 'tsUpdate'
12676
ImageIndex = 3
12777
TabVisible = False
12878
object lblImportList: TLabel
12979
Left = 0
13080
Top = 53
131-
Width = 86
81+
Width = 91
13282
Height = 13
13383
Caption = 'Imported &snippets:'
13484
FocusControl = lvImports
13585
end
13686
object lblSelectedSnippet: TLabel
13787
Left = 0
13888
Top = 217
139-
Width = 82
89+
Width = 83
14090
Height = 13
14191
Caption = 'S&elected snippet:'
14292
FocusControl = edRename
@@ -203,6 +153,10 @@ inherited CodeImportDlg: TCodeImportDlg
203153
Caption = 'tsFinish'
204154
ImageIndex = 5
205155
TabVisible = False
156+
ExplicitLeft = 0
157+
ExplicitTop = 0
158+
ExplicitWidth = 0
159+
ExplicitHeight = 0
206160
object lblFinish: TLabel
207161
Left = 0
208162
Top = 8

Src/FmCodeImportDlg.pas

Lines changed: 31 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,17 @@ interface
1717

1818
uses
1919
// Delphi
20-
Classes, ActnList, Controls, ComCtrls, StdCtrls, ExtCtrls, Forms,
20+
Classes,
21+
ActnList,
22+
Controls,
23+
ComCtrls,
24+
StdCtrls,
25+
ExtCtrls,
26+
Forms,
2127
// Project
22-
FmWizardDlg, UBaseObjects, UCodeImportMgr;
28+
FmWizardDlg,
29+
UBaseObjects,
30+
UCodeImportMgr;
2331

2432
type
2533
/// <summary>
@@ -30,21 +38,14 @@ interface
3038
TCodeImportDlg = class(TWizardDlg, INoPublicConstruct)
3139
tsInfo: TTabSheet;
3240
tsFile: TTabSheet;
33-
tsUserInfo: TTabSheet;
3441
tsUpdate: TTabSheet;
3542
lblIntro: TLabel;
3643
lblFile: TLabel;
3744
edFile: TEdit;
3845
btnBrowse: TButton;
3946
tsFinish: TTabSheet;
40-
lblName: TLabel;
41-
lblEmail: TLabel;
42-
lblComments: TLabel;
43-
edComments: TMemo;
4447
lvImports: TListView;
4548
lblImportList: TLabel;
46-
edName: TEdit;
47-
edEmail: TEdit;
4849
lblLoadFile: TLabel;
4950
btnRename: TButton;
5051
edRename: TEdit;
@@ -71,13 +72,12 @@ TCodeImportDlg = class(TWizardDlg, INoPublicConstruct)
7172
strict private
7273
const
7374
// Indices of wizard pages
74-
cIntroPage = 0;
75-
cFilePage = 1;
76-
cUserInfoPage = 2; // displayed only there is user info
77-
cUpdatePage = 3;
78-
cFinishPage = 4;
75+
cIntroPage = 0;
76+
cFilePage = 1;
77+
cUpdatePage = 2;
78+
cFinishPage = 3;
7979
// Index of subitems in list view
80-
cLVActionIdx = 1;
80+
cLVActionIdx = 1;
8181
cLVImportName = 0;
8282
var
8383
/// <summary>Reference to import manager object used to perform import
@@ -100,8 +100,6 @@ TCodeImportDlg = class(TWizardDlg, INoPublicConstruct)
100100
/// error message if not.</summary>
101101
class procedure CanOpenDialogClose(Sender: TObject;
102102
var CanClose: Boolean);
103-
/// <summary>Populates controls on user information page.</summary>
104-
procedure InitUserInfo;
105103
/// <summary>Displays current details of all snippets in import file in
106104
/// list view on update page.</summary>
107105
procedure InitImportInfo;
@@ -153,14 +151,6 @@ TCodeImportDlg = class(TWizardDlg, INoPublicConstruct)
153151
/// <remarks>Overridden method called from ancestor class.</remarks>
154152
procedure MoveForward(const PageIdx: Integer; var CanMove: Boolean);
155153
override;
156-
/// <summary>Determines index of page following page indexed by PageIdx.
157-
/// Skips user info page if there is no user info.</summary>
158-
/// <remarks>Overridden method called from ancestor class.</remarks>
159-
function NextPage(const PageIdx: Integer): Integer; override;
160-
/// <summary>Determines index of page preceding page indexed by PageIdx.
161-
/// Skips user info page if there is no user info.</summary>
162-
/// <remarks>Overridden method called from ancestor class.</remarks>
163-
function PrevPage(const PageIdx: Integer): Integer; override;
164154
public
165155
/// <summary>Displays wizard, passing a reference to import manager object
166156
/// to be used for import operations. Returns True if wizard finishes or
@@ -175,10 +165,16 @@ implementation
175165

176166
uses
177167
// Delphi
178-
SysUtils, Dialogs,
168+
SysUtils,
169+
Dialogs,
179170
// Project
180-
UCtrlArranger, UExceptions, UMessageBox, UOpenDialogEx, UOpenDialogHelper,
181-
USnippetValidator, UStrUtils;
171+
UCtrlArranger,
172+
UExceptions,
173+
UMessageBox,
174+
UOpenDialogEx,
175+
UOpenDialogHelper,
176+
USnippetValidator,
177+
UStrUtils;
182178

183179
{$R *.dfm}
184180

@@ -232,34 +228,32 @@ procedure TCodeImportDlg.actRenameUpdate(Sender: TObject);
232228
procedure TCodeImportDlg.ArrangeForm;
233229
begin
234230
TCtrlArranger.SetLabelHeights(Self);
231+
235232
// Arrange controls on tab sheets
233+
236234
// tsInfo
237-
{ nothing to do }
235+
// nothing to do
236+
238237
// tsFile
239238
TCtrlArranger.AlignVCentres(
240239
TCtrlArranger.BottomOf(lblFile, 6), [edFile, btnBrowse]
241240
);
242241
lblLoadFile.Top := TCtrlArranger.BottomOf([edFile, btnBrowse], 12);
243-
// tsUserInfo
244-
TCtrlArranger.AlignVCentres(8, [lblName, edName]);
245-
TCtrlArranger.AlignVCentres(
246-
TCtrlArranger.BottomOf([lblName, edName], 8), [lblEmail, edEmail]
247-
);
248-
lblComments.Top := TCtrlArranger.BottomOf([lblEmail, edEmail], 8);
249-
edComments.Top := lblComments.Top;
242+
250243
// tsUpdate
251244
lblImportList.Top := TCtrlArranger.BottomOf(lblModifyInstructions, 8);
252245
lvImports.Top := TCtrlArranger.BottomOf(lblImportList, 6);
253246
lblSelectedSnippet.Top := TCtrlArranger.BottomOf(lvImports, 8);
254247
TCtrlArranger.AlignVCentres(
255248
TCtrlArranger.BottomOf(lblSelectedSnippet, 6), [edRename, btnRename]
256249
);
250+
257251
// tsFinish
258252
sbFinish.Top := TCtrlArranger.BottomOf(lblFinish, 6);
259253

260254
// Size body
261255
pnlBody.ClientHeight := TCtrlArranger.MaxContainerHeight(
262-
[tsInfo, tsFile, tsUserInfo, tsUpdate, tsFinish]
256+
[tsInfo, tsFile, tsUpdate, tsFinish]
263257
) + pnlBody.ClientHeight - tsInfo.Height;
264258

265259
// Arrange inherited controls and size the form
@@ -269,7 +263,6 @@ procedure TCodeImportDlg.ArrangeForm;
269263
procedure TCodeImportDlg.BeginPage(const PageIdx: Integer);
270264
begin
271265
case PageIdx of
272-
cUserInfoPage: InitUserInfo;
273266
cUpdatePage: InitImportInfo;
274267
cFinishPage: PresentResults;
275268
end;
@@ -329,14 +322,12 @@ function TCodeImportDlg.HeadingText(const PageIdx: Integer): string;
329322
// Page headings
330323
sIntroPageheading = 'Import snippets from a file';
331324
sFilePage = 'Choose import file';
332-
sUserInfoPage = 'User information';
333325
sUpdatePage = 'Edit import and update database';
334326
sFinishPage = 'Import complete';
335327
begin
336328
case PageIdx of
337329
cIntroPage: Result := sIntroPageheading;
338330
cFilePage: Result := sFilePage;
339-
cUserInfoPage: Result := sUserInfoPage;
340331
cUpdatePage: Result := sUpdatePage;
341332
cFinishPage: Result := sFinishPage;
342333
end;
@@ -377,13 +368,6 @@ procedure TCodeImportDlg.InitImportInfo;
377368
end;
378369
end;
379370

380-
procedure TCodeImportDlg.InitUserInfo;
381-
begin
382-
edName.Text := fImportMgr.UserInfo.Details.Name;
383-
edEmail.Text := fImportMgr.UserInfo.Details.Email;
384-
edComments.Text := fImportMgr.UserInfo.Comments;
385-
end;
386-
387371
constructor TCodeImportDlg.InternalCreate(AOwner: TComponent;
388372
const ImportMgr: TCodeImportMgr);
389373
begin
@@ -427,16 +411,6 @@ procedure TCodeImportDlg.MoveForward(const PageIdx: Integer;
427411
end;
428412
end;
429413

430-
function TCodeImportDlg.NextPage(const PageIdx: Integer): Integer;
431-
begin
432-
case PageIdx of
433-
cFilePage:
434-
if fImportMgr.UserInfo.IsNul then
435-
Exit(cUpdatePage);
436-
end;
437-
Result := inherited NextPage(PageIdx);
438-
end;
439-
440414
procedure TCodeImportDlg.PresentResults;
441415

442416
// ---------------------------------------------------------------------------
@@ -468,16 +442,6 @@ procedure TCodeImportDlg.PresentResults;
468442
end;
469443
end;
470444

471-
function TCodeImportDlg.PrevPage(const PageIdx: Integer): Integer;
472-
begin
473-
case PageIdx of
474-
cUpdatePage:
475-
if fImportMgr.UserInfo.IsNul then
476-
Exit(cFilePage);
477-
end;
478-
Result := inherited PrevPage(PageIdx);
479-
end;
480-
481445
procedure TCodeImportDlg.ReadImportFile;
482446
begin
483447
fImportMgr.Import(GetFileNameFromEditCtrl);

0 commit comments

Comments
 (0)