forked from PeterDaveHello/inno-download-plugin
-
Notifications
You must be signed in to change notification settings - Fork 1
/
idp.iss
687 lines (613 loc) · 26.7 KB
/
idp.iss
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
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
; Inno Download Plugin
; (c)2013-2016 Mitrich Software
; http://mitrichsoftware.wordpress.com/
; https://bitbucket.org/mitrich_k/inno-download-plugin
#define IDPROOT ExtractFilePath(__PATHFILENAME__)
#ifdef UNICODE
#pragma include __INCLUDE__ + ";" + IDPROOT + "\unicode"
#else
#pragma include __INCLUDE__ + ";" + IDPROOT + "\ansi"
#endif
; If IDP_DEBUG is defined before including idp.iss, script will use debug version of idp.dll (not included, you need to build it yourself).
; Debug dll messages can be viewed with SysInternals DebugView (http://technet.microsoft.com/en-us/sysinternals/bb896647.aspx)
#ifdef IDP_DEBUG
#define DBGSUFFIX " debug"
#else
#define DBGSUFFIX
#endif
#ifdef UNICODE
#define IDPDLLDIR IDPROOT + "\unicode" + DBGSUFFIX
#else
#define IDPDLLDIR IDPROOT + "\ansi" + DBGSUFFIX
#endif
#define IDP_VER_MAJOR
#define IDP_VER_MINOR
#define IDP_VER_REV
#define IDP_VER_BUILD
#expr ParseVersion(IDPDLLDIR + "\idp.dll", IDP_VER_MAJOR, IDP_VER_MINOR, IDP_VER_REV, IDP_VER_BUILD)
#define IDP_VER EncodeVer(IDP_VER_MAJOR, IDP_VER_MINOR, IDP_VER_REV, IDP_VER_BUILD)
#define IDP_VER_STR GetFileVersion(IDPDLLDIR + "\idp.dll")
[Files]
Source: "{#IDPDLLDIR}\idp.dll"; Flags: dontcopy;
[Code]
procedure idpAddF(url: String); external 'idpAddF@files:idp.dll cdecl';
procedure idpAddFile(url, filename: String); external 'idpAddFile@files:idp.dll cdecl';
procedure idpAddFileComp(url, filename, components: String); external 'idpAddFileComp@files:idp.dll cdecl';
procedure idpAddMirror(url, mirror: String); external 'idpAddMirror@files:idp.dll cdecl';
procedure idpAddFtpDir(url, mask, destdir: String; recursive: Boolean); external 'idpAddFtpDir@files:idp.dll cdecl';
procedure idpAddFtpDirComp(url, mask, destdir: String; recursive: Boolean; components: String); external 'idpAddFtpDirComp@files:idp.dll cdecl';
procedure idpSetDestDir(dir: String; forAllFiles: Boolean); external 'idpSetDestDir@files:idp.dll cdecl';
procedure idpGetDestDir(dir: String); external 'idpGetDestDir@files:idp.dll cdecl';
procedure idpClearFiles; external 'idpClearFiles@files:idp.dll cdecl';
function idpFilesCount: Integer; external 'idpFilesCount@files:idp.dll cdecl';
function idpFtpDirsCount: Integer; external 'idpFtpDirsCount@files:idp.dll cdecl';
function idpFileDownloaded(url: String): Boolean; external 'idpFileDownloaded@files:idp.dll cdecl';
function idpFilesDownloaded: Boolean; external 'idpFilesDownloaded@files:idp.dll cdecl';
function idpStartEnumFiles: Boolean; external 'idpStartEnumFiles@files:idp.dll cdecl';
function idpEnumFiles(filename: String; fileType: Integer): Boolean; external 'idpEnumFiles@files:idp.dll cdecl';
function idpDownloadFile(url, filename: String): Boolean; external 'idpDownloadFile@files:idp.dll cdecl';
function idpDownloadFileDir(url, destdir, outname: String): Boolean; external 'idpDownloadFileDir@files:idp.dll cdecl';
function idpDownloadFiles: Boolean; external 'idpDownloadFiles@files:idp.dll cdecl';
function idpDownloadFilesComp: Boolean; external 'idpDownloadFilesComp@files:idp.dll cdecl';
function idpDownloadFilesCompUi: Boolean; external 'idpDownloadFilesCompUi@files:idp.dll cdecl';
procedure idpStartDownload; external 'idpStartDownload@files:idp.dll cdecl';
procedure idpStopDownload; external 'idpStopDownload@files:idp.dll cdecl';
procedure idpSetLogin(login, password: String); external 'idpSetLogin@files:idp.dll cdecl';
procedure idpSetProxyMode(mode: String); external 'idpSetProxyMode@files:idp.dll cdecl';
procedure idpSetProxyName(name: String); external 'idpSetProxyName@files:idp.dll cdecl';
procedure idpSetProxyLogin(login, password: String); external 'idpSetProxyLogin@files:idp.dll cdecl';
procedure idpConnectControl(name: String; Handle: HWND); external 'idpConnectControl@files:idp.dll cdecl';
procedure idpAddMessage(name, message: String); external 'idpAddMessage@files:idp.dll cdecl';
procedure idpSetInternalOption(name, value: String); external 'idpSetInternalOption@files:idp.dll cdecl';
procedure idpSetDetailedMode(mode: Boolean); external 'idpSetDetailedMode@files:idp.dll cdecl';
procedure idpSetComponents(components: String); external 'idpSetComponents@files:idp.dll cdecl';
procedure idpReportError; external 'idpReportError@files:idp.dll cdecl';
procedure idpTrace(text: String); external 'idpTrace@files:idp.dll cdecl';
#if defined(UNICODE) && (Ver >= 0x05050300)
procedure idpAddFileSize(url, filename: String; size: Int64); external 'idpAddFileSize@files:idp.dll cdecl';
procedure idpAddFileSizeComp(url, filename: String; size: Int64; components: String); external 'idpAddFileSize@files:idp.dll cdecl';
function idpGetFileSize(url: String; var size: Int64): Boolean; external 'idpGetFileSize@files:idp.dll cdecl';
function idpGetFilesSize(var size: Int64): Boolean; external 'idpGetFilesSize@files:idp.dll cdecl';
#else
procedure idpAddFileSize(url, filename: String; size: Dword); external 'idpAddFileSize32@files:idp.dll cdecl';
procedure idpAddFileSizeComp(url, filename: String; size: Dword; components: String); external 'idpAddFileSize32@files:idp.dll cdecl';
function idpGetFileSize(url: String; var size: Dword): Boolean; external 'idpGetFileSize32@files:idp.dll cdecl';
function idpGetFilesSize(var size: Dword): Boolean; external 'idpGetFilesSize32@files:idp.dll cdecl';
#endif
type TIdpForm = record
Page : TWizardPage;
TotalProgressBar : TNewProgressBar;
FileProgressBar : TNewProgressBar;
TotalProgressLabel: TNewStaticText;
CurrentFileLabel : TNewStaticText;
TotalDownloaded : TNewStaticText;
FileDownloaded : TNewStaticText;
FileNameLabel : TNewStaticText;
SpeedLabel : TNewStaticText;
StatusLabel : TNewStaticText;
ElapsedTimeLabel : TNewStaticText;
RemainingTimeLabel: TNewStaticText;
FileName : TNewStaticText;
Speed : TNewStaticText;
Status : TNewStaticText;
ElapsedTime : TNewStaticText;
RemainingTime : TNewStaticText;
DetailsButton : TNewButton;
GIDetailsButton : HWND; //Graphical Installer
DetailsVisible : Boolean;
InvisibleButton : TNewButton;
end;
TIdpOptions = record
DetailedMode : Boolean;
NoDetailsButton: Boolean;
NoRetryButton : Boolean;
NoSkinnedButton: Boolean; //Graphical Installer
end;
var IDPForm : TIdpForm;
IDPOptions: TIdpOptions;
const IDP_ALL = 0;
IDP_DOWNLOADED = 1;
IDP_NOT_DOWNLOADED = 2;
function StrToBool(value: String): Boolean;
var s: String;
begin
s := LowerCase(value);
if s = 'true' then result := true
else if s = 't' then result := true
else if s = 'yes' then result := true
else if s = 'y' then result := true
else if s = 'false' then result := false
else if s = 'f' then result := false
else if s = 'no' then result := false
else if s = 'n' then result := false
else result := StrToInt(value) > 0;
end;
function WizardVerySilent: Boolean;
var i: Integer;
begin
for i := 1 to ParamCount do
begin
if UpperCase(ParamStr(i)) = '/VERYSILENT' then
begin
result := true;
exit;
end;
end;
result := false;
end;
function WizardSupressMsgBoxes: Boolean;
var i: Integer;
begin
for i := 1 to ParamCount do
begin
if UpperCase(ParamStr(i)) = '/SUPPRESSMSGBOXES' then
begin
result := true;
exit;
end;
end;
result := false;
end;
procedure idpSetOption(name, value: String);
var key: String;
begin
key := LowerCase(name);
if key = 'detailedmode' then IDPOptions.DetailedMode := StrToBool(value)
else if key = 'detailsvisible' then IDPOptions.DetailedMode := StrToBool(value) //alias
else if key = 'detailsbutton' then IDPOptions.NoDetailsButton := not StrToBool(value)
else if key = 'skinnedbutton' then IDPOptions.NoSkinnedButton := not StrToBool(value)
else if key = 'retrybutton' then
begin
IDPOptions.NoRetryButton := StrToInt(value) = 0;
idpSetInternalOption('RetryButton', value);
end
else
idpSetInternalOption(name, value);
end;
procedure idpGetFileList(var FileList: TStringList; fileType: Integer);
var filename: String;
r: Boolean;
begin
idpStartEnumFiles();
while true do
begin
SetLength(filename, 260);
r := idpEnumFiles(filename, fileType);
if not r then break;
FileList.Append(filename);
end;
end;
procedure idpShowDetails(show: Boolean);
begin
IDPForm.FileProgressBar.Visible := show;
IDPForm.CurrentFileLabel.Visible := show;
IDPForm.FileDownloaded.Visible := show;
IDPForm.FileNameLabel.Visible := show;
IDPForm.SpeedLabel.Visible := show;
IDPForm.StatusLabel.Visible := show;
IDPForm.ElapsedTimeLabel.Visible := show;
IDPForm.RemainingTimeLabel.Visible := show;
IDPForm.FileName.Visible := show;
IDPForm.Speed.Visible := show;
IDPForm.Status.Visible := show;
IDPForm.ElapsedTime.Visible := show;
IDPForm.RemainingTime.Visible := show;
IDPForm.DetailsVisible := show;
if IDPForm.DetailsVisible then
begin
IDPForm.DetailsButton.Caption := ExpandConstant('{cm:IDP_HideButton}');
IDPForm.DetailsButton.Top := ScaleY(184);
end
else
begin
IDPForm.DetailsButton.Caption := ExpandConstant('{cm:IDP_DetailsButton}');
IDPForm.DetailsButton.Top := ScaleY(44);
end;
idpSetDetailedMode(show);
end;
procedure idpDetailsButtonClick(Sender: TObject);
begin
idpShowDetails(not IDPForm.DetailsVisible);
end;
#ifdef GRAPHICAL_INSTALLER_PROJECT
procedure idpGIDetailsButtonClick(hButton: HWND);
begin
idpShowDetails(not IDPForm.DetailsVisible);
if IDPForm.DetailsVisible then
begin
ButtonSetText(IDPForm.GIDetailsButton, PAnsiChar(ExpandConstant('{cm:IDP_HideButton}')));
ButtonSetPosition(IDPForm.GIDetailsButton, IDPForm.DetailsButton.Left-ScaleX(5), ScaleY(184), ButtonWidth, ButtonHeight);
end
else
begin
ButtonSetText(IDPForm.GIDetailsButton, PAnsiChar(ExpandConstant('{cm:IDP_DetailsButton}')));
ButtonSetPosition(IDPForm.GIDetailsButton, IDPForm.DetailsButton.Left-ScaleX(5), ScaleY(44), ButtonWidth, ButtonHeight);
end;
ButtonRefresh(hButton);
end;
procedure idpCreateGIDetailsButton;
var swButtonNormalColor : TColor;
swButtonFocusedColor : TColor;
swButtonPressedColor : TColor;
swButtonDisabledColor: TColor;
begin
swButtonNormalColor := SwitchColorFormat(ExpandConstant('{#ButtonNormalColor}'));
swButtonFocusedColor := SwitchColorFormat(ExpandConstant('{#ButtonFocusedColor}'));
swButtonPressedColor := SwitchColorFormat(ExpandConstant('{#ButtonPressedColor}'));
swButtonDisabledColor := SwitchColorFormat(ExpandConstant('{#ButtonDisabledColor}'));
with IDPForm.DetailsButton do
begin
IDPForm.GIDetailsButton := ButtonCreate(IDPForm.Page.Surface.Handle, Left-ScaleX(5), Top, ButtonWidth, ButtonHeight,
ExpandConstant('{tmp}\{#ButtonPicture}'), coButtonShadow, False);
ButtonSetEvent(IDPForm.GIDetailsButton, ButtonClickEventID, WrapButtonCallback(@idpGIDetailsButtonClick, 1));
ButtonSetFont(IDPForm.GIDetailsButton, ButtonFont.Handle);
ButtonSetFontColor(IDPForm.GIDetailsButton, swButtonNormalColor, swButtonFocusedColor, swButtonPressedColor, swButtonDisabledColor);
ButtonSetText(IDPForm.GIDetailsButton, PAnsiChar(Caption));
ButtonSetVisibility(IDPForm.GIDetailsButton, true);
ButtonSetEnabled(IDPForm.GIDetailsButton, true);
end;
end;
#endif
procedure idpFormActivate(Page: TWizardPage);
begin
if WizardSilent then
idpSetOption('RetryButton', '0');
if WizardSupressMsgBoxes then
idpSetInternalOption('ErrorDialog', 'none');
if not IDPOptions.NoRetryButton then
WizardForm.BackButton.Caption := ExpandConstant('{cm:IDP_RetryButton}');
idpShowDetails(IDPOptions.DetailedMode);
IDPForm.DetailsButton.Visible := not IDPOptions.NoDetailsButton;
#ifdef GRAPHICAL_INSTALLER_PROJECT
idpSetInternalOption('RedrawBackground', '1');
idpConnectControl('GIBackButton', hBackButton);
idpConnectControl('GINextButton', hNextButton);
if not IDPOptions.NoSkinnedButton then
begin
IDPForm.DetailsButton.Visible := false;
if IDPForm.GIDetailsButton = 0 then
idpCreateGIDetailsButton;
end;
if IDPOptions.NoRetryButton then
WizardForm.BackButton.Enabled := false
else
WizardForm.BackButton.Visible := false;
WizardForm.NextButton.Enabled := false;
#endif
idpSetComponents(WizardSelectedComponents(false));
if WizardVerySilent then
idpDownloadFilesComp
else if WizardSilent then
begin
WizardForm.Show;
WizardForm.Repaint;
idpDownloadFilesCompUi;
WizardForm.Hide;
end
else
idpStartDownload;
end;
function idpShouldSkipPage(Page: TWizardPage): Boolean;
begin
idpSetComponents(WizardSelectedComponents(false));
Result := ((idpFilesCount = 0) and (idpFtpDirsCount = 0)) or idpFilesDownloaded;
end;
function idpBackButtonClick(Page: TWizardPage): Boolean;
begin
if not IDPOptions.NoRetryButton then // Retry button clicked
begin
idpStartDownload;
Result := False;
end
else
Result := true;
end;
function idpNextButtonClick(Page: TWizardPage): Boolean;
begin
Result := True;
end;
procedure idpCancelButtonClick(Page: TWizardPage; var Cancel, Confirm: Boolean);
begin
if ExitSetupMsgBox then
begin
IDPForm.Status.Caption := ExpandConstant('{cm:IDP_CancellingDownload}');
WizardForm.Repaint;
idpStopDownload;
Cancel := true;
Confirm := false;
end
else
Cancel := false;
end;
procedure idpReportErrorHelper(Sender: TObject);
begin
idpReportError; //calling idpReportError in main thread for compatibility with VCL Styles for IS
end;
function idpCreateDownloadForm(PreviousPageId: Integer): Integer;
begin
IDPForm.Page := CreateCustomPage(PreviousPageId, ExpandConstant('{cm:IDP_FormCaption}'), ExpandConstant('{cm:IDP_FormDescription}'));
IDPForm.TotalProgressBar := TNewProgressBar.Create(IDPForm.Page);
with IDPForm.TotalProgressBar do
begin
Parent := IDPForm.Page.Surface;
Left := ScaleX(0);
Top := ScaleY(16);
Width := ScaleX(410);
Height := ScaleY(20);
Min := 0;
Max := 100;
end;
IDPForm.TotalProgressLabel := TNewStaticText.Create(IDPForm.Page);
with IDPForm.TotalProgressLabel do
begin
Parent := IDPForm.Page.Surface;
Caption := ExpandConstant('{cm:IDP_TotalProgress}');
Left := ScaleX(0);
Top := ScaleY(0);
Width := ScaleX(200);
Height := ScaleY(14);
AutoSize := False;
TabOrder := 1;
end;
IDPForm.CurrentFileLabel := TNewStaticText.Create(IDPForm.Page);
with IDPForm.CurrentFileLabel do
begin
Parent := IDPForm.Page.Surface;
Caption := ExpandConstant('{cm:IDP_CurrentFile}');
Left := ScaleX(0);
Top := ScaleY(48);
Width := ScaleX(200);
Height := ScaleY(14);
AutoSize := False;
TabOrder := 2;
end;
IDPForm.FileProgressBar := TNewProgressBar.Create(IDPForm.Page);
with IDPForm.FileProgressBar do
begin
Parent := IDPForm.Page.Surface;
Left := ScaleX(0);
Top := ScaleY(64);
Width := ScaleX(410);
Height := ScaleY(20);
Min := 0;
Max := 100;
end;
IDPForm.TotalDownloaded := TNewStaticText.Create(IDPForm.Page);
with IDPForm.TotalDownloaded do
begin
Parent := IDPForm.Page.Surface;
Caption := '';
Left := ScaleX(290);
Top := ScaleY(0);
Width := ScaleX(120);
Height := ScaleY(14);
AutoSize := False;
TabOrder := 4;
end;
IDPForm.FileDownloaded := TNewStaticText.Create(IDPForm.Page);
with IDPForm.FileDownloaded do
begin
Parent := IDPForm.Page.Surface;
Caption := '';
Left := ScaleX(290);
Top := ScaleY(48);
Width := ScaleX(120);
Height := ScaleY(14);
AutoSize := False;
TabOrder := 5;
end;
IDPForm.FileNameLabel := TNewStaticText.Create(IDPForm.Page);
with IDPForm.FileNameLabel do
begin
Parent := IDPForm.Page.Surface;
Caption := ExpandConstant('{cm:IDP_File}');
Left := ScaleX(0);
Top := ScaleY(100);
Width := ScaleX(116);
Height := ScaleY(14);
AutoSize := False;
TabOrder := 6;
end;
IDPForm.SpeedLabel := TNewStaticText.Create(IDPForm.Page);
with IDPForm.SpeedLabel do
begin
Parent := IDPForm.Page.Surface;
Caption := ExpandConstant('{cm:IDP_Speed}');
Left := ScaleX(0);
Top := ScaleY(116);
Width := ScaleX(116);
Height := ScaleY(14);
AutoSize := False;
TabOrder := 7;
end;
IDPForm.StatusLabel := TNewStaticText.Create(IDPForm.Page);
with IDPForm.StatusLabel do
begin
Parent := IDPForm.Page.Surface;
Caption := ExpandConstant('{cm:IDP_Status}');
Left := ScaleX(0);
Top := ScaleY(132);
Width := ScaleX(116);
Height := ScaleY(14);
AutoSize := False;
TabOrder := 8;
end;
IDPForm.ElapsedTimeLabel := TNewStaticText.Create(IDPForm.Page);
with IDPForm.ElapsedTimeLabel do
begin
Parent := IDPForm.Page.Surface;
Caption := ExpandConstant('{cm:IDP_ElapsedTime}');
Left := ScaleX(0);
Top := ScaleY(148);
Width := ScaleX(116);
Height := ScaleY(14);
AutoSize := False;
TabOrder := 9;
end;
IDPForm.RemainingTimeLabel := TNewStaticText.Create(IDPForm.Page);
with IDPForm.RemainingTimeLabel do
begin
Parent := IDPForm.Page.Surface;
Caption := ExpandConstant('{cm:IDP_RemainingTime}');
Left := ScaleX(0);
Top := ScaleY(164);
Width := ScaleX(116);
Height := ScaleY(14);
AutoSize := False;
TabOrder := 10;
end;
IDPForm.FileName := TNewStaticText.Create(IDPForm.Page);
with IDPForm.FileName do
begin
Parent := IDPForm.Page.Surface;
Caption := '';
Left := ScaleX(120);
Top := ScaleY(100);
Width := ScaleX(280);
Height := ScaleY(14);
AutoSize := False;
TabOrder := 11;
end;
IDPForm.Speed := TNewStaticText.Create(IDPForm.Page);
with IDPForm.Speed do
begin
Parent := IDPForm.Page.Surface;
Caption := '';
Left := ScaleX(120);
Top := ScaleY(116);
Width := ScaleX(280);
Height := ScaleY(14);
AutoSize := False;
TabOrder := 12;
end;
IDPForm.Status := TNewStaticText.Create(IDPForm.Page);
with IDPForm.Status do
begin
Parent := IDPForm.Page.Surface;
Caption := '';
Left := ScaleX(120);
Top := ScaleY(132);
Width := ScaleX(280);
Height := ScaleY(14);
AutoSize := False;
TabOrder := 13;
end;
IDPForm.ElapsedTime := TNewStaticText.Create(IDPForm.Page);
with IDPForm.ElapsedTime do
begin
Parent := IDPForm.Page.Surface;
Caption := '';
Left := ScaleX(120);
Top := ScaleY(148);
Width := ScaleX(280);
Height := ScaleY(14);
AutoSize := False;
TabOrder := 14;
end;
IDPForm.RemainingTime := TNewStaticText.Create(IDPForm.Page);
with IDPForm.RemainingTime do
begin
Parent := IDPForm.Page.Surface;
Caption := '';
Left := ScaleX(120);
Top := ScaleY(164);
Width := ScaleX(280);
Height := ScaleY(14);
AutoSize := False;
TabOrder := 15;
end;
IDPForm.DetailsButton := TNewButton.Create(IDPForm.Page);
with IDPForm.DetailsButton do
begin
Parent := IDPForm.Page.Surface;
Caption := ExpandConstant('{cm:IDP_DetailsButton}');
Left := ScaleX(336);
Top := ScaleY(184);
Width := ScaleX(75);
Height := ScaleY(23);
TabOrder := 16;
OnClick := @idpDetailsButtonClick;
end;
IDPForm.InvisibleButton := TNewButton.Create(IDPForm.Page);
with IDPForm.InvisibleButton do
begin
Parent := IDPForm.Page.Surface;
Caption := ExpandConstant('You must not see this button');
Left := ScaleX(0);
Top := ScaleY(0);
Width := ScaleX(10);
Height := ScaleY(10);
TabOrder := 17;
Visible := False;
OnClick := @idpReportErrorHelper;
end;
with IDPForm.Page do
begin
OnActivate := @idpFormActivate;
OnShouldSkipPage := @idpShouldSkipPage;
OnBackButtonClick := @idpBackButtonClick;
OnNextButtonClick := @idpNextButtonClick;
OnCancelButtonClick := @idpCancelButtonClick;
end;
Result := IDPForm.Page.ID;
end;
procedure idpConnectControls;
begin
idpConnectControl('TotalProgressLabel', IDPForm.TotalProgressLabel.Handle);
idpConnectControl('TotalProgressBar', IDPForm.TotalProgressBar.Handle);
idpConnectControl('FileProgressBar', IDPForm.FileProgressBar.Handle);
idpConnectControl('TotalDownloaded', IDPForm.TotalDownloaded.Handle);
idpConnectControl('FileDownloaded', IDPForm.FileDownloaded.Handle);
idpConnectControl('FileName', IDPForm.FileName.Handle);
idpConnectControl('Speed', IDPForm.Speed.Handle);
idpConnectControl('Status', IDPForm.Status.Handle);
idpConnectControl('ElapsedTime', IDPForm.ElapsedTime.Handle);
idpConnectControl('RemainingTime', IDPForm.RemainingTime.Handle);
idpConnectControl('InvisibleButton', IDPForm.InvisibleButton.Handle);
idpConnectControl('WizardPage', IDPForm.Page.Surface.Handle);
idpConnectControl('WizardForm', WizardForm.Handle);
idpConnectControl('BackButton', WizardForm.BackButton.Handle);
idpConnectControl('NextButton', WizardForm.NextButton.Handle);
idpConnectControl('LabelFont', IDPForm.TotalDownloaded.Font.Handle);
end;
procedure idpInitMessages;
begin
idpAddMessage('Total progress', ExpandConstant('{cm:IDP_TotalProgress}'));
idpAddMessage('KB/s', ExpandConstant('{cm:IDP_KBs}'));
idpAddMessage('MB/s', ExpandConstant('{cm:IDP_MBs}'));
idpAddMessage('%.2f of %.2f', ExpandConstant('{cm:IDP_X_of_X}'));
idpAddMessage('KB', ExpandConstant('{cm:IDP_KB}'));
idpAddMessage('MB', ExpandConstant('{cm:IDP_MB}'));
idpAddMessage('GB', ExpandConstant('{cm:IDP_GB}'));
idpAddMessage('Initializing...', ExpandConstant('{cm:IDP_Initializing}'));
idpAddMessage('Getting file information...', ExpandConstant('{cm:IDP_GettingFileInformation}'));
idpAddMessage('Starting download...', ExpandConstant('{cm:IDP_StartingDownload}'));
idpAddMessage('Connecting...', ExpandConstant('{cm:IDP_Connecting}'));
idpAddMessage('Downloading...', ExpandConstant('{cm:IDP_Downloading}'));
idpAddMessage('Download complete', ExpandConstant('{cm:IDP_DownloadComplete}'));
idpAddMessage('Download failed', ExpandConstant('{cm:IDP_DownloadFailed}'));
idpAddMessage('Cannot connect', ExpandConstant('{cm:IDP_CannotConnect}'));
idpAddMessage('Unknown', ExpandConstant('{cm:IDP_Unknown}'));
idpAddMessage('Download cancelled', ExpandConstant('{cm:IDP_DownloadCancelled}'));
idpAddMessage('HTTP error %d', ExpandConstant('{cm:IDP_HTTPError_X}'));
idpAddMessage('400', ExpandConstant('{cm:IDP_400}'));
idpAddMessage('401', ExpandConstant('{cm:IDP_401}'));
idpAddMessage('404', ExpandConstant('{cm:IDP_404}'));
idpAddMessage('407', ExpandConstant('{cm:IDP_407}'));
idpAddMessage('500', ExpandConstant('{cm:IDP_500}'));
idpAddMessage('502', ExpandConstant('{cm:IDP_502}'));
idpAddMessage('503', ExpandConstant('{cm:IDP_503}'));
idpAddMessage('Retry', ExpandConstant('{cm:IDP_RetryButton}'));
idpAddMessage('Ignore', ExpandConstant('{cm:IDP_IgnoreButton}'));
idpAddMessage('Cancel', SetupMessage(msgButtonCancel));
idpAddMessage('The following files were not downloaded:', ExpandConstant('{cm:IDP_FilesNotDownloaded}'));
idpAddMessage('Check your connection and click ''Retry'' to try downloading the files again, or click ''Next'' to continue installing anyway.', ExpandConstant('{cm:IDP_RetryNext}'));
idpAddMessage('Check your connection and click ''Retry'' to try downloading the files again, or click ''Cancel'' to terminate setup.', ExpandConstant('{cm:IDP_RetryCancel}'));
end;
procedure idpDownloadAfter(PageAfterId: Integer);
begin
idpCreateDownloadForm(PageAfterId);
idpConnectControls;
idpInitMessages;
end;
#include <idplang\default.iss>