CompWizard.pas 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026
  1. unit CompWizard;
  2. {
  3. Inno Setup
  4. Copyright (C) 1997-2020 Jordan Russell
  5. Portions by Martijn Laan
  6. For conditions of distribution and use, see LICENSE.TXT.
  7. Compiler IDE Script Wizard form
  8. }
  9. interface
  10. {$I VERSION.INC}
  11. uses
  12. Windows, Forms, Classes, Graphics, StdCtrls, ExtCtrls, Controls, Dialogs, pngimage,
  13. UIStateForm, NewStaticText, DropListBox, NewCheckListBox, NewNotebook,
  14. CompWizardFilesHelper;
  15. type
  16. TWizardPage = (wpWelcome, wpAppInfo, wpAppDir, wpAppFiles, wpAppAssoc, wpAppIcons,
  17. wpAppDocs, wpPrivilegesRequired, wpLanguages, wpCompiler,
  18. wpISPP, wpFinished);
  19. TWizardFormResult = (wrNone, wrEmpty, wrComplete);
  20. TWizardForm = class(TUIStateForm)
  21. CancelButton: TButton;
  22. NextButton: TButton;
  23. BackButton: TButton;
  24. OuterNotebook: TNewNotebook;
  25. InnerNotebook: TNewNotebook;
  26. WelcomePage: TNewNotebookPage;
  27. MainPage: TNewNotebookPage;
  28. AppInfoPage: TNewNotebookPage;
  29. AppDirPage: TNewNotebookPage;
  30. AppFilesPage: TNewNotebookPage;
  31. AppIconsPage: TNewNotebookPage;
  32. AppDocsPage: TNewNotebookPage;
  33. PrivilegesRequiredPage: TNewNotebookPage;
  34. LanguagesPage: TNewNotebookPage;
  35. CompilerPage: TNewNotebookPage;
  36. ISPPPage: TNewNotebookPage;
  37. FinishedPage: TNewNotebookPage;
  38. Bevel: TBevel;
  39. WelcomeImage: TImage;
  40. WelcomeLabel1: TNewStaticText;
  41. PnlMain: TPanel;
  42. Bevel1: TBevel;
  43. PageNameLabel: TNewStaticText;
  44. PageDescriptionLabel: TNewStaticText;
  45. InnerImage: TImage;
  46. FinishedLabel: TNewStaticText;
  47. FinishedImage: TImage;
  48. WelcomeLabel2: TNewStaticText;
  49. EmptyCheck: TCheckBox;
  50. WelcomeLabel3: TNewStaticText;
  51. AppNameLabel: TNewStaticText;
  52. AppNameEdit: TEdit;
  53. AppVersionLabel: TNewStaticText;
  54. AppVersionEdit: TEdit;
  55. AppDirNameLabel: TNewStaticText;
  56. AppRootDirComboBox: TComboBox;
  57. AppRootDirEdit: TEdit;
  58. AppDirNameEdit: TEdit;
  59. NotDisableDirPageCheck: TCheckBox;
  60. AppRootDirLabel: TNewStaticText;
  61. AppPublisherLabel: TNewStaticText;
  62. AppPublisherEdit: TEdit;
  63. OtherLabel: TNewStaticText;
  64. NotCreateAppDirCheck: TCheckBox;
  65. AppFilesLabel: TNewStaticText;
  66. AppFilesListBox: TDropListBox;
  67. AppFilesAddButton: TButton;
  68. AppFilesEditButton: TButton;
  69. AppFilesRemoveButton: TButton;
  70. AppURLLabel: TNewStaticText;
  71. AppURLEdit: TEdit;
  72. AppExeLabel: TNewStaticText;
  73. AppExeEdit: TEdit;
  74. AppExeRunCheck: TCheckBox;
  75. AppExeButton: TButton;
  76. AppGroupNameLabel: TNewStaticText;
  77. AppGroupNameEdit: TEdit;
  78. NotDisableProgramGroupPageCheck: TCheckBox;
  79. AllowNoIconsCheck: TCheckBox;
  80. AppExeIconsLabel: TNewStaticText;
  81. DesktopIconCheck: TCheckBox;
  82. CreateUninstallIconCheck: TCheckBox;
  83. CreateURLIconCheck: TCheckBox;
  84. AppLicenseFileLabel: TNewStaticText;
  85. AppLicenseFileEdit: TEdit;
  86. AppLicenseFileButton: TButton;
  87. AppInfoBeforeFileLabel: TNewStaticText;
  88. AppInfoBeforeFileEdit: TEdit;
  89. AppInfoBeforeFileButton: TButton;
  90. AppInfoAfterFileLabel: TNewStaticText;
  91. AppInfoAfterFileEdit: TEdit;
  92. AppInfoAfterFileButton: TButton;
  93. RequiredLabel1: TNewStaticText;
  94. RequiredLabel2: TNewStaticText;
  95. AppFilesAddDirButton: TButton;
  96. ISPPCheck: TCheckBox;
  97. ISPPLabel: TLabel;
  98. OutputDirLabel: TNewStaticText;
  99. OutputDirEdit: TEdit;
  100. OutputBaseFileNameLabel: TNewStaticText;
  101. OutputBaseFileNameEdit: TEdit;
  102. SetupIconFileLabel: TNewStaticText;
  103. SetupIconFileEdit: TEdit;
  104. PasswordLabel: TNewStaticText;
  105. PasswordEdit: TEdit;
  106. SetupIconFileButton: TButton;
  107. EncryptionCheck: TCheckBox;
  108. OutputDirButton: TButton;
  109. LanguagesLabel: TNewStaticText;
  110. LanguagesList: TNewCheckListBox;
  111. AllLanguagesButton: TButton;
  112. NoLanguagesButton: TButton;
  113. NoAppExeCheck: TCheckBox;
  114. UseAutoProgramsCheck: TCheckBox;
  115. PrivilegesRequiredLabel: TNewStaticText;
  116. PrivilegesRequiredAdminRadioButton: TRadioButton;
  117. PrivilegesRequiredLowestRadioButton: TRadioButton;
  118. PrivilegesRequiredOverridesAllowedCommandLineCheckbox: TCheckBox;
  119. PrivilegesRequiredOverridesAllowedDialogCheckbox: TCheckBox;
  120. AppAssocPage: TNewNotebookPage;
  121. AppAssocNameEdit: TEdit;
  122. AppAssocNameLabel: TNewStaticText;
  123. CreateAssocCheck: TCheckBox;
  124. AppAssocExtLabel: TNewStaticText;
  125. AppAssocExtEdit: TEdit;
  126. procedure FormCreate(Sender: TObject);
  127. procedure FormShow(Sender: TObject);
  128. procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
  129. procedure FormDestroy(Sender: TObject);
  130. procedure NextButtonClick(Sender: TObject);
  131. procedure BackButtonClick(Sender: TObject);
  132. procedure FileButtonClick(Sender: TObject);
  133. procedure AppRootDirComboBoxChange(Sender: TObject);
  134. procedure NotCreateAppDirCheckClick(Sender: TObject);
  135. procedure AppExeButtonClick(Sender: TObject);
  136. procedure NotDisableProgramGroupPageCheckClick(Sender: TObject);
  137. procedure PasswordEditChange(Sender: TObject);
  138. procedure OutputDirButtonClick(Sender: TObject);
  139. procedure AllLanguagesButtonClick(Sender: TObject);
  140. procedure NoLanguagesButtonClick(Sender: TObject);
  141. procedure NoAppExeCheckClick(Sender: TObject);
  142. procedure UseAutoProgramsCheckClick(Sender: TObject);
  143. procedure PrivilegesRequiredOverridesAllowedDialogCheckboxClick(Sender: TObject);
  144. procedure CreateAssocCheckClick(Sender: TObject);
  145. private
  146. CurPage: TWizardPage;
  147. FWizardName: String;
  148. FFilesHelper: TWizardFormFilesHelper;
  149. FLanguages: TStringList;
  150. FResult: TWizardFormResult;
  151. FResultScript: String;
  152. function FixLabel(const S: String): String;
  153. procedure SetWizardName(const WizardName: String);
  154. procedure CurPageChanged;
  155. function SkipCurPage: Boolean;
  156. procedure UpdateAppExeControls;
  157. procedure UpdateAppAssocControls;
  158. procedure UpdateAppIconsControls;
  159. procedure GenerateScript;
  160. public
  161. property WizardName: String write SetWizardName;
  162. property Result: TWizardFormResult read FResult;
  163. property ResultScript: String read FResultScript;
  164. end;
  165. implementation
  166. {$R *.DFM}
  167. uses
  168. SysUtils, ShlObj, ActiveX, UITypes,
  169. PathFunc, CmnFunc, CmnFunc2, CompFunc, VerInfo, BrowseFunc,
  170. CompMsgs, CompWizardFile;
  171. type
  172. TConstant = record
  173. Constant, Description: String;
  174. end;
  175. const
  176. NotebookPages: array[TWizardPage, 0..1] of Integer =
  177. ((0, -1), (1, 0), (1, 1), (1, 2),
  178. (1, 3), (1, 4), (1, 5), (1, 6),
  179. (1, 7), (1, 8), (1, 9), (2, -1));
  180. PageCaptions: array[TWizardPage] of String =
  181. (SWizardWelcome, SWizardAppInfo, SWizardAppDir, SWizardAppFiles, SWizardAppAssoc,
  182. SWizardAppIcons, SWizardAppDocs, SWizardPrivilegesRequired, SWizardLanguages,
  183. SWizardCompiler, SWizardISPP, SWizardFinished);
  184. PageDescriptions: array[TWizardPage] of String =
  185. ('', SWizardAppInfo2, SWizardAppDir2, SWizardAppFiles2, SWizardAppAssoc2,
  186. SWizardAppIcons2, SWizardAppDocs2, SWizardPrivilegesRequired2, SWizardLanguages2,
  187. SWizardCompiler2, SWizardISPP2, '');
  188. RequiredLabelVisibles: array[TWizardPage] of Boolean =
  189. (False, True, True, True, True, True, False, True, True, False, False, False);
  190. AppRootDirs: array[0..0] of TConstant =
  191. (
  192. ( Constant: '{autopf}'; Description: 'Program Files folder')
  193. );
  194. LanguagesDefaultIsl = 'Default.isl';
  195. LanguagesDefaultIslDescription = 'English';
  196. EnabledColors: array[Boolean] of TColor = (clBtnFace, clWindow);
  197. function EscapeAmpersands(const S: String): String;
  198. begin
  199. Result := S;
  200. StringChangeEx(Result, '&', '&&', True);
  201. end;
  202. function TWizardForm.FixLabel(const S: String): String;
  203. begin
  204. Result := S;
  205. {don't localize these}
  206. StringChange(Result, '[name]', FWizardName);
  207. end;
  208. procedure TWizardForm.SetWizardName(const WizardName: String);
  209. begin
  210. FWizardName := WizardName;
  211. end;
  212. { --- }
  213. type
  214. TNotebookAccess = class(TNotebook);
  215. procedure TWizardForm.FormCreate(Sender: TObject);
  216. procedure AddLanguages(const Extension: String);
  217. var
  218. SearchRec: TSearchRec;
  219. begin
  220. if FindFirst(PathExtractPath(NewParamStr(0)) + 'Languages\*.' + Extension, faAnyFile, SearchRec) = 0 then begin
  221. repeat
  222. FLanguages.Add(SearchRec.Name);
  223. until FindNext(SearchRec) <> 0;
  224. FindClose(SearchRec);
  225. end;
  226. end;
  227. procedure MakeBold(const Ctl: TNewStaticText);
  228. begin
  229. Ctl.Font.Style := [fsBold];
  230. end;
  231. function SpaceLanguageName(const LanguageName: String): String;
  232. var
  233. I: Integer;
  234. begin
  235. Result := '';
  236. for I := 1 to Length(LanguageName) do begin
  237. if (I <> 1) and CharInSet(LanguageName[I], ['A'..'Z']) then
  238. Result := Result + ' ';
  239. Result := Result + LanguageName[I];
  240. end;
  241. end;
  242. var
  243. I: Integer;
  244. begin
  245. FResult := wrNone;
  246. FWizardName := SWizardDefaultName;
  247. FFilesHelper := TWizardFormFilesHelper.Create(Handle,
  248. NotCreateAppDirCheck, AppFilesListBox, AppFilesAddButton, AppFilesAddDirButton,
  249. AppFilesEditButton, AppFilesRemoveButton);
  250. FLanguages := TStringList.Create;
  251. FLanguages.Sorted := True;
  252. FLanguages.Duplicates := dupIgnore; { Some systems also return .islu files when searching for *.isl }
  253. AddLanguages('isl');
  254. AddLanguages('islu');
  255. FLanguages.Sorted := False;
  256. FLanguages.Insert(0, LanguagesDefaultIsl);
  257. InitFormFont(Self);
  258. if Font.Name = 'Segoe UI' then begin
  259. { See Wizard.pas }
  260. for I := 0 to OuterNotebook.PageCount-1 do
  261. OuterNotebook.Pages[I].HandleNeeded;
  262. for I := 0 to InnerNotebook.PageCount-1 do
  263. InnerNotebook.Pages[I].HandleNeeded;
  264. ClientWidth := MulDiv(ClientWidth, 105, 100);
  265. end;
  266. if FontExists('Verdana') then
  267. WelcomeLabel1.Font.Name := 'Verdana';
  268. TNotebookAccess(OuterNotebook).ParentBackground := False;
  269. OuterNotebook.Color := clWindow;
  270. MakeBold(PageNameLabel);
  271. MakeBold(RequiredLabel1);
  272. MakeBold(AppNameLabel);
  273. MakeBold(AppVersionLabel);
  274. MakeBold(AppRootDirLabel);
  275. MakeBold(AppDirNameLabel);
  276. MakeBold(AppExeLabel);
  277. MakeBold(AppAssocNameLabel);
  278. MakeBold(AppAssocExtLabel);
  279. MakeBold(AppGroupNameLabel);
  280. MakeBold(PrivilegesRequiredLabel);
  281. MakeBold(LanguagesLabel);
  282. FinishedImage.Picture := WelcomeImage.Picture;
  283. RequiredLabel2.Left := RequiredLabel1.Left + RequiredLabel1.Width;
  284. { AppInfo }
  285. AppNameEdit.Text := 'My Program';
  286. AppVersionEdit.Text := '1.5';
  287. AppPublisherEdit.Text := 'My Company, Inc.';
  288. AppURLEdit.Text := 'https://www.example.com/';
  289. { AppDir }
  290. for I := Low(AppRootDirs) to High(AppRootDirs) do
  291. AppRootDirComboBox.Items.Add(AppRootDirs[I].Description);
  292. AppRootDirComboBox.Items.Add('(Custom)');
  293. AppRootDirComboBox.ItemIndex := 0;
  294. AppRootDirEdit.Enabled := False;
  295. AppRootDirEdit.Color := clBtnFace;
  296. NotDisableDirPageCheck.Checked := True;
  297. { AppFiles }
  298. AppExeEdit.Text := PathExtractPath(NewParamStr(0)) + 'Examples\MyProg.exe';
  299. AppExeRunCheck.Checked := True;
  300. { AppAssoc }
  301. CreateAssocCheck.Checked := True;
  302. AppAssocExtEdit.Text := '.myp';
  303. { AppIcons }
  304. UseAutoProgramsCheck.Checked := True;
  305. NotDisableProgramGroupPageCheck.Checked := True;
  306. DesktopIconCheck.Checked := True;
  307. { PrivilegesRequired }
  308. PrivilegesRequiredAdminRadioButton.Checked := True;
  309. { Languages }
  310. for I := 0 to FLanguages.Count-1 do begin
  311. if FLanguages[I] <> LanguagesDefaultIsl then
  312. LanguagesList.AddCheckBox(SpaceLanguageName(PathChangeExt(FLanguages[I], '')), '', 0, False, True, False, True, TObject(I))
  313. else
  314. LanguagesList.AddCheckBox(LanguagesDefaultIslDescription, '', 0, True, True, False, True, TObject(I));
  315. end;
  316. { Compiler }
  317. OutputBaseFileNameEdit.Text := 'mysetup';
  318. EncryptionCheck.Visible := ISCryptInstalled;
  319. EncryptionCheck.Checked := True;
  320. EncryptionCheck.Enabled := False;
  321. { ISPP }
  322. ISPPLabel.Caption := FixLabel(SWizardISPPLabel);
  323. ISPPCheck.Caption := SWizardISPPCheck;
  324. ISPPCheck.Checked := ISPPInstalled;
  325. CurPage := Low(TWizardPage);
  326. CurPageChanged;
  327. end;
  328. procedure TWizardForm.FormShow(Sender: TObject);
  329. begin
  330. Caption := FWizardName;
  331. WelcomeLabel1.Caption := FixLabel(WelcomeLabel1.Caption);
  332. FinishedLabel.Caption := FixLabel(FinishedLabel.Caption);
  333. end;
  334. procedure TWizardForm.FormCloseQuery(Sender: TObject;
  335. var CanClose: Boolean);
  336. begin
  337. if ModalResult = mrCancel then
  338. CanClose := MsgBox(FixLabel(SWizardCancelMessage), FWizardName, mbConfirmation, MB_YESNO) = idYes;
  339. end;
  340. procedure TWizardForm.FormDestroy(Sender: TObject);
  341. begin
  342. FLanguages.Free;
  343. FFilesHelper.Free;
  344. end;
  345. { --- }
  346. procedure TWizardForm.CurPageChanged;
  347. { Call this whenever the current page is changed }
  348. begin
  349. OuterNotebook.ActivePage := OuterNotebook.Pages[NotebookPages[CurPage, 0]];
  350. if NotebookPages[CurPage, 1] <> -1 then
  351. InnerNotebook.ActivePage := InnerNotebook.Pages[NotebookPages[CurPage, 1]];
  352. { Set button visibility and captions }
  353. BackButton.Visible := not (CurPage = wpWelcome);
  354. if CurPage = wpFinished then
  355. NextButton.Caption := SWizardFinishButton
  356. else
  357. NextButton.Caption := SWizardNextButton;
  358. RequiredLabel1.Visible := RequiredLabelVisibles[CurPage];
  359. RequiredLabel2.Visible := RequiredLabel1.Visible;
  360. { Set the Caption to match the current page's title }
  361. PageNameLabel.Caption := PageCaptions[CurPage];
  362. PageDescriptionLabel.Caption := PageDescriptions[CurPage];
  363. { Adjust focus }
  364. case CurPage of
  365. wpAppInfo: ActiveControl := AppNameEdit;
  366. wpAppDir:
  367. begin
  368. if AppRootDirComboBox.Enabled then
  369. ActiveControl := AppRootDirComboBox
  370. else
  371. ActiveControl := NotCreateAppDirCheck;
  372. end;
  373. wpAppFiles:
  374. begin
  375. if AppExeEdit.Enabled then
  376. ActiveControl := AppExeEdit
  377. else
  378. ActiveControl := AppFilesListBox;
  379. end;
  380. wpAppAssoc: ActiveControl := CreateAssocCheck;
  381. wpAppIcons:
  382. begin
  383. if UseAutoProgramsCheck.Enabled then
  384. ActiveControl := UseAutoProgramsCheck
  385. else
  386. ActiveControl := AppGroupNameEdit;
  387. end;
  388. wpAppDocs: ActiveControl := AppLicenseFileEdit;
  389. wpPrivilegesRequired:
  390. begin
  391. if PrivilegesRequiredAdminRadioButton.Checked then
  392. ActiveControl := PrivilegesRequiredAdminRadioButton
  393. else
  394. ActiveControl := PrivilegesRequiredLowestRadioButton;
  395. end;
  396. wpLanguages: ActiveControl := LanguagesList;
  397. wpCompiler: ActiveControl := OutputDirEdit;
  398. wpISPP: ActiveControl := ISPPCheck;
  399. end;
  400. end;
  401. function TWizardForm.SkipCurPage: Boolean;
  402. begin
  403. if ((CurPage = wpAppAssoc) and not CreateAssocCheck.Enabled) or
  404. ((CurPage = wpAppIcons) and NotCreateAppDirCheck.Checked) or
  405. ((CurPage = wpLanguages) and not (FLanguages.Count > 1)) or
  406. ((CurPage = wpISPP) and not ISPPInstalled) or
  407. (not (CurPage in [wpWelcome, wpFinished]) and EmptyCheck.Checked) then
  408. Result := True
  409. else
  410. Result := False;
  411. end;
  412. procedure TWizardForm.NextButtonClick(Sender: TObject);
  413. function CheckAppInfoPage: Boolean;
  414. begin
  415. Result := False;
  416. if AppNameEdit.Text = '' then begin
  417. MsgBox(SWizardAppNameError, '', mbError, MB_OK);
  418. ActiveControl := AppNameEdit;
  419. end else if AppVersionEdit.Text = '' then begin
  420. MsgBox(SWizardAppVersionError, '', mbError, MB_OK);
  421. ActiveControl := AppVersionEdit;
  422. end else
  423. Result := True;
  424. end;
  425. function CheckAppDirPage: Boolean;
  426. begin
  427. Result := False;
  428. if not NotCreateAppDirCheck.Checked and
  429. (AppRootDirComboBox.ItemIndex = AppRootDirComboBox.Items.Count-1) and
  430. (AppRootDirEdit.Text = '') then begin
  431. MsgBox(SWizardAppRootDirError, '', mbError, MB_OK);
  432. ActiveControl := AppRootDirEdit;
  433. end else if not NotCreateAppDirCheck.Checked and (AppDirNameEdit.Text = '') then begin
  434. MsgBox(SWizardAppDirNameError, '', mbError, MB_OK);
  435. ActiveControl := AppDirNameEdit;
  436. end else
  437. Result := True;
  438. end;
  439. function CheckAppFilesPage: Boolean;
  440. begin
  441. Result := False;
  442. if AppExeEdit.Enabled and (AppExeEdit.Text = '') then begin
  443. MsgBox(SWizardAppExeError, '', mbError, MB_OK);
  444. ActiveControl := AppExeEdit;
  445. end else
  446. Result := True;
  447. end;
  448. function CheckAppIconsPage: Boolean;
  449. begin
  450. Result := False;
  451. if AppGroupNameEdit.Text = '' then begin
  452. MsgBox(SWizardAppGroupNameError, '', mbError, MB_OK);
  453. ActiveControl := AppGroupNameEdit;
  454. end else
  455. Result := True;
  456. end;
  457. function CheckLanguagesPage: Boolean;
  458. var
  459. I: Integer;
  460. begin
  461. Result := False;
  462. for I := 0 to LanguagesList.Items.Count-1 do begin
  463. if LanguagesList.Checked[I] then begin
  464. Result := True;
  465. Exit;
  466. end;
  467. end;
  468. MsgBox(SWizardLanguagesSelError, '', mbError, MB_OK);
  469. ActiveControl := LanguagesList;
  470. end;
  471. begin
  472. case CurPage of
  473. wpAppInfo: if not CheckAppInfoPage then Exit;
  474. wpAppDir: if not CheckAppDirPage then Exit;
  475. wpAppFiles: if not CheckAppFilesPage then Exit;
  476. wpAppIcons: if not CheckAppIconsPage then Exit;
  477. wpLanguages: if not CheckLanguagesPage then Exit;
  478. end;
  479. repeat
  480. if CurPage = wpAppAssoc then begin
  481. if (AppAssocExtEdit.Text <> '') and (AppAssocExtEdit.Text[1] <> '.') then
  482. AppAssocExtEdit.Text := '.' + AppAssocExtEdit.Text;
  483. end else if CurPage = wpFinished then begin
  484. GenerateScript;
  485. ModalResult := mrOk;
  486. Exit;
  487. end;
  488. Inc(CurPage);
  489. { Even if we're skipping a page, we should still update it }
  490. case CurPage of
  491. wpAppDir: if AppDirNameEdit.Text = '' then AppDirNameEdit.Text := AppNameEdit.Text;
  492. wpAppAssoc: if AppAssocNameEdit.Text = '' then AppAssocNameEdit.Text := AppNameEdit.Text + ' File';
  493. wpAppIcons: if AppGroupNameEdit.Text = '' then AppGroupNameEdit.Text := AppNameEdit.Text;
  494. end;
  495. until not SkipCurPage;
  496. CurPageChanged;
  497. end;
  498. procedure TWizardForm.BackButtonClick(Sender: TObject);
  499. begin
  500. if CurPage = Low(TWizardPage) then Exit;
  501. { Go to the previous page }
  502. Dec(CurPage);
  503. while SkipCurPage do
  504. Dec(CurPage);
  505. CurPageChanged;
  506. end;
  507. {---}
  508. procedure TWizardForm.UpdateAppExeControls;
  509. var
  510. Enabled: Boolean;
  511. begin
  512. Enabled := not NotCreateAppDirCheck.Checked;
  513. NoAppExeCheck.Enabled := Enabled;
  514. Enabled := Enabled and not NoAppExeCheck.Checked;
  515. AppExeLabel.Enabled := Enabled;
  516. AppExeEdit.Enabled := Enabled;
  517. AppExeEdit.Color := EnabledColors[Enabled];
  518. AppExeButton.Enabled := Enabled;
  519. AppExeRunCheck.Enabled := Enabled;
  520. AppExeIconsLabel.Enabled := Enabled;
  521. DesktopIconCheck.Enabled := Enabled;
  522. if Enabled then
  523. AppExeLabel.Font.Style := AppExeLabel.Font.Style + [fsBold]
  524. else
  525. AppExeLabel.Font.Style := AppExeLabel.Font.Style - [fsBold];
  526. end;
  527. procedure TWizardForm.UpdateAppAssocControls;
  528. var
  529. Enabled: Boolean;
  530. begin
  531. Enabled := not NoAppExeCheck.Checked;
  532. CreateAssocCheck.Enabled := Enabled;
  533. Enabled := Enabled and CreateAssocCheck.Checked;
  534. AppAssocNameLabel.Enabled := Enabled;
  535. AppAssocNameEdit.Enabled := Enabled;
  536. AppAssocExtLabel.Enabled := Enabled;
  537. AppAssocExtEdit.Enabled := Enabled;
  538. if Enabled then begin
  539. AppAssocNameLabel.Font.Style := AppAssocNameLabel.Font.Style + [fsBold];
  540. AppAssocExtLabel.Font.Style := AppAssocExtLabel.Font.Style + [fsBold];
  541. end else begin
  542. AppAssocNameLabel.Font.Style := AppAssocNameLabel.Font.Style - [fsBold];
  543. AppAssocExtLabel.Font.Style := AppAssocExtLabel.Font.Style - [fsBold];
  544. end;
  545. end;
  546. procedure TWizardForm.UpdateAppIconsControls;
  547. var
  548. Enabled: Boolean;
  549. begin
  550. UseAutoProgramsCheck.Enabled := NoAppExeCheck.Enabled and not NoAppExeCheck.Checked;
  551. Enabled := not (UseAutoProgramsCheck.Enabled and UseAutoProgramsCheck.Checked);
  552. AppGroupNameLabel.Enabled := Enabled;
  553. AppGroupNameEdit.Enabled := Enabled;
  554. AppGroupNameEdit.Color := EnabledColors[Enabled];
  555. NotDisableProgramGroupPageCheck.Enabled := Enabled;
  556. AllowNoIconsCheck.Enabled := Enabled and NotDisableProgramGroupPageCheck.Checked;
  557. CreateURLIconCheck.Enabled := Enabled and (AppURLEdit.Text <> '');
  558. CreateUninstallIconCheck.Enabled := Enabled;
  559. if Enabled then
  560. AppGroupNameLabel.Font.Style := AppGroupNameLabel.Font.Style + [fsBold]
  561. else
  562. AppGroupNameLabel.Font.Style := AppGroupNameLabel.Font.Style - [fsBold];
  563. end;
  564. {---}
  565. procedure TWizardForm.AppRootDirComboBoxChange(Sender: TObject);
  566. begin
  567. if AppRootDirComboBox.ItemIndex = AppRootDirComboBox.Items.Count-1 then begin
  568. AppRootDirEdit.Enabled := True;
  569. AppRootDirEdit.Color := clWindow;
  570. ActiveControl := AppRootDirEdit;
  571. end else begin
  572. AppRootDirEdit.Enabled := False;
  573. AppRootDirEdit.Color := clBtnFace;
  574. end;
  575. end;
  576. procedure TWizardForm.NotCreateAppDirCheckClick(Sender: TObject);
  577. var
  578. Enabled: Boolean;
  579. begin
  580. Enabled := not NotCreateAppDirCheck.Checked;
  581. { AppDir }
  582. AppRootDirLabel.Enabled := Enabled;
  583. AppRootDirComboBox.Enabled := Enabled;
  584. AppRootDirComboBox.Color := EnabledColors[Enabled];
  585. AppRootDirEdit.Enabled := Enabled and (AppRootDirComboBox.ItemIndex = AppRootDirComboBox.Items.Count-1);
  586. AppRootDirEdit.Color := EnabledColors[AppRootDirEdit.Enabled];
  587. AppDirNameLabel.Enabled := Enabled;
  588. AppDirNameEdit.Enabled := Enabled;
  589. AppDirNameEdit.Color := EnabledColors[Enabled];
  590. NotDisableDirPageCheck.Enabled := Enabled;
  591. if Enabled then begin
  592. AppRootDirLabel.Font.Style := AppRootDirLabel.Font.Style + [fsBold];
  593. AppDirNameLabel.Font.Style := AppRootDirLabel.Font.Style + [fsBold];
  594. end else begin
  595. AppRootDirLabel.Font.Style := AppRootDirLabel.Font.Style - [fsBold];
  596. AppDirNameLabel.Font.Style := AppRootDirLabel.Font.Style - [fsBold];
  597. end;
  598. { AppFiles }
  599. UpdateAppExeControls;
  600. end;
  601. procedure TWizardForm.AppExeButtonClick(Sender: TObject);
  602. var
  603. FileName: String;
  604. begin
  605. FileName := AppExeEdit.Text;
  606. if NewGetOpenFileName('', FileName, PathExtractPath(FileName), SWizardAppExeFilter, SWizardAppExeDefaultExt, Handle) then
  607. AppExeEdit.Text := FileName;
  608. end;
  609. procedure TWizardForm.NoAppExeCheckClick(Sender: TObject);
  610. begin
  611. UpdateAppExeControls;
  612. UpdateAppAssocControls;
  613. UpdateAppIconsControls;
  614. end;
  615. procedure TWizardForm.CreateAssocCheckClick(Sender: TObject);
  616. begin
  617. UpdateAppAssocControls;
  618. end;
  619. procedure TWizardForm.UseAutoProgramsCheckClick(Sender: TObject);
  620. begin
  621. UpdateAppIconsControls;
  622. end;
  623. procedure TWizardForm.NotDisableProgramGroupPageCheckClick(
  624. Sender: TObject);
  625. begin
  626. UpdateAppIconsControls;
  627. end;
  628. procedure TWizardForm.FileButtonClick(Sender: TObject);
  629. var
  630. Edit: TEdit;
  631. Filter, DefaultExt, FileName: String;
  632. begin
  633. if Sender = AppLicenseFileButton then
  634. Edit := AppLicenseFileEdit
  635. else if Sender = AppInfoBeforeFileButton then
  636. Edit := AppInfoBeforeFileEdit
  637. else if Sender = AppInfoAfterFileButton then
  638. Edit := AppInfoAfterFileEdit
  639. else
  640. Edit := SetupIconFileEdit;
  641. if Sender <> SetupIconFileButton then begin
  642. Filter := SWizardAppDocsFilter;
  643. DefaultExt := SWizardAppDocsDefaultExt;
  644. end else begin
  645. Filter := SWizardCompilerSetupIconFileFilter;
  646. DefaultExt := SWizardCompilerSetupIconFileDefaultExt;
  647. end;
  648. FileName := Edit.Text;
  649. if NewGetOpenFileName('', FileName, PathExtractPath(FileName), Filter, DefaultExt, Handle) then
  650. Edit.Text := FileName;
  651. end;
  652. procedure TWizardForm.OutputDirButtonClick(Sender: TObject);
  653. var
  654. Path: String;
  655. begin
  656. Path := OutputDirEdit.Text;
  657. if PathDrivePartLength(Path) = 0 then
  658. Path := ''; { don't pass in a relative path to BrowseForFolder }
  659. if BrowseForFolder(SWizardCompilerOutputDir, Path, Handle, True) then
  660. OutputDirEdit.Text := Path;
  661. end;
  662. procedure TWizardForm.PasswordEditChange(Sender: TObject);
  663. begin
  664. EncryptionCheck.Enabled := PasswordEdit.Text <> '';
  665. end;
  666. procedure TWizardForm.AllLanguagesButtonClick(Sender: TObject);
  667. var
  668. I: Integer;
  669. begin
  670. for I := 0 to LanguagesList.Items.Count-1 do
  671. LanguagesList.Checked[I] := True;
  672. end;
  673. procedure TWizardForm.NoLanguagesButtonClick(Sender: TObject);
  674. var
  675. I: Integer;
  676. begin
  677. for I := 0 to LanguagesList.Items.Count-1 do
  678. LanguagesList.Checked[I] := False;
  679. end;
  680. procedure TWizardForm.PrivilegesRequiredOverridesAllowedDialogCheckboxClick(
  681. Sender: TObject);
  682. begin
  683. PrivilegesRequiredOverridesAllowedCommandLineCheckbox.Enabled := not PrivilegesRequiredOverridesAllowedDialogCheckbox.Checked;
  684. if PrivilegesRequiredOverridesAllowedDialogCheckbox.Checked then
  685. PrivilegesRequiredOverridesAllowedCommandLineCheckbox.Checked := True;
  686. end;
  687. { --- }
  688. procedure TWizardForm.GenerateScript;
  689. var
  690. Script, ISPP, Setup, Languages, Tasks, Files, Registry, INI, Icons, Run, UninstallDelete: String;
  691. I: Integer;
  692. AppExeName, AppName, AppAmpEscapedName, AppAssocKey, LanguageName, LanguageMessagesFile: String;
  693. begin
  694. Script := '';
  695. AppExeName := PathExtractName(AppExeEdit.Text);
  696. AppName := AppNameEdit.Text;
  697. AppAmpEscapedName := EscapeAmpersands(AppName);
  698. if ISPPCheck.Checked then begin
  699. { Setup ISPP usage. Change the edits to reflect ISPP usage. A bit ugly but for now it works. }
  700. ISPP := '#define MyAppName "' + AppNameEdit.Text + '"' + SNewLine +
  701. '#define MyAppVersion "' + AppVersionEdit.Text + '"' + SNewLine;
  702. if AppDirNameEdit.Text = AppNameEdit.Text then
  703. AppDirNameEdit.Text := '{#MyAppName}';
  704. if AppGroupNameEdit.Text = AppNameEdit.Text then
  705. AppGroupNameEdit.Text := '{#MyAppName}';
  706. AppNameEdit.Text := '{#MyAppName}';
  707. AppAmpEscapedName := '{#StringChange(MyAppName, ''&'', ''&&'')}';
  708. AppVersionEdit.Text := '{#MyAppVersion}';
  709. if AppPublisherEdit.Text <> '' then begin
  710. ISPP := ISPP + '#define MyAppPublisher "' + AppPublisherEdit.Text + '"' + SNewLine;
  711. AppPublisherEdit.Text := '{#MyAppPublisher}';
  712. end;
  713. if AppURLEdit.Text <> '' then begin
  714. ISPP := ISPP + '#define MyAppURL "' + AppURLEdit.Text + '"' + SNewLine;
  715. AppURLEdit.Text := '{#MyAppURL}';
  716. end;
  717. { Special ones }
  718. if not NoAppExeCheck.Checked then begin
  719. ISPP := ISPP + '#define MyAppExeName "' + AppExeName + '"' + SNewLine;
  720. AppExeName := '{#MyAppExeName}';
  721. end;
  722. if CreateAssocCheck.Enabled and CreateAssocCheck.Checked then begin
  723. if Pos(AppName, AppAssocNameEdit.Text) = 1 then
  724. ISPP := ISPP + '#define MyAppAssocName MyAppName + "' + Copy(AppAssocNameEdit.Text, Length(AppName)+1, MaxInt) + '"' + SNewLine
  725. else
  726. ISPP := ISPP + '#define MyAppAssocName "' + AppAssocNameEdit.Text + '"' + SNewLine;
  727. AppAssocNameEdit.Text := '{#MyAppAssocName}';
  728. ISPP := ISPP + '#define MyAppAssocExt "' + AppAssocExtEdit.Text + '"' + SNewLine;
  729. AppAssocExtEdit.Text := '{#MyAppAssocExt}';
  730. ISPP := ISPP + '#define MyAppAssocKey StringChange(MyAppAssocName, " ", "") + MyAppAssocExt' + SNewLine;
  731. AppAssocKey := '{#MyAppAssocKey}';
  732. end;
  733. end else begin
  734. ISPP := '';
  735. AppAssocKey := StringReplace(AppAssocNameEdit.Text, ' ', '', [rfReplaceAll]) + AppAssocExtEdit.Text;
  736. end;
  737. Setup := '[Setup]' + SNewLine;
  738. Languages := '[Languages]' + SNewLine;
  739. Tasks := '[Tasks]' + SNewLine;
  740. Files := '[Files]' + SNewLine;
  741. Registry := '[Registry]' + SNewLine;
  742. INI := '[INI]' + SNewLine;
  743. Icons := '[Icons]' + SNewLine;
  744. Run := '[Run]' + SNewLine;
  745. UninstallDelete := '[UninstallDelete]' + SNewLine;
  746. if not EmptyCheck.Checked then begin
  747. Setup := Setup + (
  748. '; NOTE: The value of AppId uniquely identifies this application. Do not use the same AppId value in installers for other applications.' + SNewLine +
  749. '; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)' + SNewLine);
  750. Setup := Setup + 'AppId={' + GenerateGuid + SNewLine;
  751. { AppInfo }
  752. Setup := Setup + 'AppName=' + AppNameEdit.Text + SNewLine;
  753. Setup := Setup + 'AppVersion=' + AppVersionEdit.Text + SNewLine;
  754. Setup := Setup + ';AppVerName=' + AppNameEdit.Text + ' ' + AppVersionEdit.Text + SNewLine;
  755. if AppPublisherEdit.Text <> '' then
  756. Setup := Setup + 'AppPublisher=' + AppPublisherEdit.Text + SNewLine;
  757. if AppURLEdit.Text <> '' then begin
  758. Setup := Setup + 'AppPublisherURL=' + AppURLEdit.Text + SNewLine;
  759. Setup := Setup + 'AppSupportURL=' + AppURLEdit.Text + SNewLine;
  760. Setup := Setup + 'AppUpdatesURL=' + AppURLEdit.Text + SNewLine;
  761. end;
  762. { AppDir }
  763. if not NotCreateAppDirCheck.Checked then begin
  764. if AppRootDirComboBox.ItemIndex = AppRootDirComboBox.Items.Count-1 then
  765. Setup := Setup + 'DefaultDirName=' + AddBackslash(AppRootDirEdit.Text) + AppDirNameEdit.Text + SNewLine
  766. else
  767. Setup := Setup + 'DefaultDirName=' + AddBackslash(AppRootDirs[AppRootDirComboBox.ItemIndex].Constant) + AppDirNameEdit.Text + SNewLine;
  768. if not NotDisableDirPageCheck.Checked then
  769. Setup := Setup + 'DisableDirPage=yes' + SNewLine;
  770. end else begin
  771. Setup := Setup + 'CreateAppDir=no' + SNewLine;
  772. end;
  773. { AppFiles }
  774. if not NotCreateAppDirCheck.Checked and not NoAppExeCheck.Checked then begin
  775. Files := Files + 'Source: "' + PathExtractPath(AppExeEdit.Text) + AppExeName + '"; DestDir: "{app}"; Flags: ignoreversion' + SNewLine;
  776. if AppExeRunCheck.Checked then begin
  777. if CompareText(PathExtractExt(AppExeEdit.Text), '.exe') = 0 then
  778. Run := Run + 'Filename: "{app}\' + AppExeName + '"; Description: "{cm:LaunchProgram,' + AppAmpEscapedName + '}"; Flags: nowait postinstall skipifsilent' + SNewLine
  779. else
  780. Run := Run + 'Filename: "{app}\' + AppExeName + '"; Description: "{cm:LaunchProgram,' + AppAmpEscapedName + '}"; Flags: shellexec postinstall skipifsilent' + SNewLine;
  781. end;
  782. end;
  783. { AppAssocation }
  784. if CreateAssocCheck.Enabled and CreateAssocCheck.Checked then begin
  785. Setup := Setup + 'ChangesAssociations=yes' + SNewLine;
  786. Registry := Registry + 'Root: HKA; Subkey: "Software\Classes\' + AppAssocExtEdit.Text + '\OpenWithProgids"; ValueType: string; ValueName: "' + AppAssocKey + '"; ValueData: ""; Flags: uninsdeletevalue' + SNewLine;
  787. Registry := Registry + 'Root: HKA; Subkey: "Software\Classes\' + AppAssocKey + '"; ValueType: string; ValueName: ""; ValueData: "' + AppAssocNameEdit.Text + '"; Flags: uninsdeletekey' + SNewLine;
  788. Registry := Registry + 'Root: HKA; Subkey: "Software\Classes\' + AppAssocKey + '\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\' + AppExeName + ',0"' + SNewLine;
  789. Registry := Registry + 'Root: HKA; Subkey: "Software\Classes\' + AppAssocKey + '\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\' + AppExeName + '"" ""%1"""' + SNewLine;
  790. Registry := Registry + 'Root: HKA; Subkey: "Software\Classes\Applications\' + AppExeName + '\SupportedTypes"; ValueType: string; ValueName: ".myp"; ValueData: ""' + SNewLine;
  791. end;
  792. FFilesHelper.AddScript(Files);
  793. { AppGroup }
  794. if not NotCreateAppDirCheck.Checked then begin
  795. if UseAutoProgramsCheck.Enabled and UseAutoProgramsCheck.Checked then begin
  796. Setup := Setup + 'DisableProgramGroupPage=yes' + SNewLine;
  797. Icons := Icons + 'Name: "{autoprograms}\' + AppNameEdit.Text + '"; Filename: "{app}\' + AppExeName + '"' + SNewLine;
  798. end else begin
  799. Setup := Setup + 'DefaultGroupName=' + AppGroupNameEdit.Text + SNewLine;
  800. if not NoAppExeCheck.Checked then
  801. Icons := Icons + 'Name: "{group}\' + AppNameEdit.Text + '"; Filename: "{app}\' + AppExeName + '"' + SNewLine;
  802. if not NotDisableProgramGroupPageCheck.Checked then
  803. Setup := Setup + 'DisableProgramGroupPage=yes' + SNewLine;
  804. if AllowNoIconsCheck.Checked and NotDisableProgramGroupPageCheck.Checked then
  805. Setup := Setup + 'AllowNoIcons=yes' + SNewLine;
  806. if CreateURLIconCheck.Enabled and CreateURLIconCheck.Checked then
  807. Icons := Icons + 'Name: "{group}\{cm:ProgramOnTheWeb,' + AppNameEdit.Text + '}"; Filename: "' + AppURLEdit.Text + '"' + SNewLine;
  808. if CreateUninstallIconCheck.Checked then
  809. Icons := Icons + 'Name: "{group}\{cm:UninstallProgram,' + AppNameEdit.Text + '}"; Filename: "{uninstallexe}"' + SNewLine;
  810. end;
  811. if DesktopIconCheck.Enabled and DesktopIconCheck.Checked then begin
  812. Tasks := Tasks + 'Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked' + SNewLine;
  813. Icons := Icons + 'Name: "{autodesktop}\' + AppNameEdit.Text + '"; Filename: "{app}\' + AppExeName + '"; Tasks: desktopicon' + SNewLine;
  814. end;
  815. end;
  816. { AppDocs }
  817. if AppLicenseFileEdit.Text <> '' then
  818. Setup := Setup + 'LicenseFile=' + AppLicenseFileEdit.Text + SNewLine;
  819. if AppInfoBeforeFileEdit.Text <> '' then
  820. Setup := Setup + 'InfoBeforeFile=' + AppInfoBeforeFileEdit.Text + SNewLine;
  821. if AppInfoAfterFileEdit.Text <> '' then
  822. Setup := Setup + 'InfoAfterFile=' + AppInfoAfterFileEdit.Text + SNewLine;
  823. { PrivilegesRequired }
  824. if PrivilegesRequiredAdminRadioButton.Checked then
  825. Setup := Setup + '; Uncomment the following line to run in non administrative install mode (install for current user only.)' + SNewLine + ';'
  826. else
  827. Setup := Setup + '; Remove the following line to run in administrative install mode (install for all users.)' + SNewLine;
  828. Setup := Setup + 'PrivilegesRequired=lowest' + SNewLine; { Note how previous made sure this is outputted as comment if needed. }
  829. if PrivilegesRequiredOverridesAllowedDialogCheckbox.Checked then
  830. Setup := Setup + 'PrivilegesRequiredOverridesAllowed=dialog' + SNewLine
  831. else if PrivilegesRequiredOverridesAllowedCommandLineCheckbox.Checked then
  832. Setup := Setup + 'PrivilegesRequiredOverridesAllowed=commandline' + SNewLine;
  833. { Languages }
  834. if FLanguages.Count > 1 then begin
  835. for I := 0 to LanguagesList.Items.Count-1 do begin
  836. if LanguagesList.Checked[I] then begin
  837. LanguageMessagesFile := FLanguages[Integer(LanguagesList.ItemObject[I])];
  838. if LanguageMessagesFile <> LanguagesDefaultIsl then begin
  839. LanguageName := LanguagesList.Items[I];
  840. LanguageMessagesFile := 'Languages\' + LanguageMessagesFile;
  841. end else
  842. LanguageName := LanguagesDefaultIslDescription;
  843. StringChange(LanguageName, ' ', '');
  844. LanguageName := LowerCase(LanguageName);
  845. Languages := Languages + 'Name: "' + LanguageName + '"; MessagesFile: "compiler:' + LanguageMessagesFile + '"' + SNewLine;
  846. end;
  847. end;
  848. end;
  849. { Compiler }
  850. if OutputDirEdit.Text <> '' then
  851. Setup := Setup + 'OutputDir=' + OutputDirEdit.Text + SNewLine;
  852. if OutputBaseFileNameEdit.Text <> '' then
  853. Setup := Setup + 'OutputBaseFilename=' + OutputBaseFileNameEdit.Text + SNewLine;
  854. if SetupIconFileEdit.Text <> '' then
  855. Setup := Setup + 'SetupIconFile=' + SetupIconFileEdit.Text + SNewLine;
  856. if PasswordEdit.Text <> '' then begin
  857. Setup := Setup + 'Password=' + PasswordEdit.Text + SNewLine;
  858. if ISCryptInstalled and EncryptionCheck.Checked then
  859. Setup := Setup + 'Encryption=yes' + SNewLine;
  860. end;
  861. { Other }
  862. Setup := Setup + 'Compression=lzma' + SNewLine;
  863. Setup := Setup + 'SolidCompression=yes' + SNewLine;
  864. Setup := Setup + 'WizardStyle=modern' + SNewLine;
  865. { Build script }
  866. if ISPP <> '' then
  867. Script := Script + ISPP + SNewLine;
  868. Script := Script + Setup + SNewLine;
  869. if Length(Languages) > Length('[Languages]')+2 then
  870. Script := Script + Languages + SNewLine;
  871. if Length(Tasks) > Length('[Tasks]')+2 then
  872. Script := Script + Tasks + SNewLine;
  873. if Length(Files) > Length('[Files]')+2 then
  874. Script := Script + Files +
  875. '; NOTE: Don''t use "Flags: ignoreversion" on any shared system files' +
  876. SNewLine2;
  877. if Length(Registry) > Length('[Registry]')+2 then
  878. Script := Script + Registry + SNewLine;
  879. if Length(INI) > Length('[INI]')+2 then
  880. Script := Script + INI + SNewLine;
  881. if Length(Icons) > Length('[Icons]')+2 then
  882. Script := Script + Icons + SNewLine;
  883. if Length(Run) > Length('[Run]')+2 then
  884. Script := Script + Run + SNewLine;
  885. if Length(UninstallDelete) > Length('[UninstallDelete]')+2 then
  886. Script := Script + UninstallDelete + SNewLine;
  887. FResult := wrComplete;
  888. end else begin
  889. Script := Script + Setup + SNewLine;
  890. FResult := wrEmpty;
  891. end;
  892. FResultScript := FixLabel(SWizardScriptHeader) + SNewLine2 + Script;
  893. end;
  894. { --- }
  895. end.