IDE.RegistryDesignerForm.pas 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. unit IDE.RegistryDesignerForm;
  2. {
  3. Inno Setup
  4. Copyright (C) 1997-2025 Jordan Russell
  5. Portions by Martijn Laan
  6. For conditions of distribution and use, see LICENSE.TXT.
  7. Registry Designer form
  8. Originally contributed by leserg73
  9. }
  10. interface
  11. uses
  12. SysUtils, Classes,
  13. Forms, Controls, StdCtrls, ExtCtrls,
  14. IDE.Wizard.WizardFormRegistryHelper, NewStaticText, BitmapButton;
  15. type
  16. TRegistryDesignerForm = class(TForm)
  17. Panel1: TPanel;
  18. Bevel1: TBevel;
  19. InsertButton: TButton;
  20. CancelButton: TButton;
  21. AppRegistryFileLabel: TNewStaticText;
  22. AppRegistryFileEdit: TEdit;
  23. AppRegistryFileButton: TButton;
  24. AppRegistrySettingsLabel: TNewStaticText;
  25. AppRegistryUninsDeleteKeyCheck: TCheckBox;
  26. AppRegistryUninsDeleteKeyIfEmptyCheck: TCheckBox;
  27. AppRegistryUninsDeleteValueCheck: TCheckBox;
  28. AppRegistryMinVerCheck: TCheckBox;
  29. AppRegistryMinVerEdit: TEdit;
  30. PrivilegesRequiredLabel: TNewStaticText;
  31. AppRegistryMinVerDocBitBtn: TBitmapButton;
  32. procedure InsertButtonClick(Sender: TObject);
  33. procedure FormCreate(Sender: TObject);
  34. procedure FormDestroy(Sender: TObject);
  35. private
  36. FRegistryHelper: TWizardFormRegistryHelper;
  37. procedure SetPrivilegesRequired(const Value: TPrivilegesRequired);
  38. function GetText: String;
  39. public
  40. property PrivilegesRequired: TPrivilegesRequired write SetPrivilegesRequired;
  41. property Text: string read GetText;
  42. end;
  43. implementation
  44. {$R *.dfm}
  45. uses
  46. IDE.HelperFunc;
  47. procedure TRegistryDesignerForm.SetPrivilegesRequired(
  48. const Value: TPrivilegesRequired);
  49. begin
  50. if Value = prAdmin then
  51. PrivilegesRequiredLabel.Caption := 'Script has PrivilegesRequired=admin'
  52. else if Value = prLowest then
  53. PrivilegesRequiredLabel.Caption := 'Script has PrivilegesRequired=lowest'
  54. else
  55. PrivilegesRequiredLabel.Caption := 'Script has PrivilegesRequiredOverridesAllowed set';
  56. FRegistryHelper.PrivilegesRequired := Value;
  57. end;
  58. procedure TRegistryDesignerForm.FormCreate(Sender: TObject);
  59. begin
  60. InitFormFont(Self);
  61. InitFormTheme(Self);
  62. FRegistryHelper := TWizardFormRegistryHelper.Create(Self, AppRegistryFileEdit,
  63. AppRegistryFileButton, AppRegistryUninsDeleteKeyCheck,
  64. AppRegistryUninsDeleteKeyIfEmptyCheck, AppRegistryUninsDeleteValueCheck,
  65. AppRegistryMinVerCheck, AppRegistryMinVerEdit, AppRegistryMinVerDocBitBtn);
  66. end;
  67. procedure TRegistryDesignerForm.FormDestroy(Sender: TObject);
  68. begin
  69. FRegistryHelper.Free;
  70. end;
  71. function TRegistryDesignerForm.GetText: String;
  72. begin
  73. Result := '';
  74. FRegistryHelper.AddScript(Result, True);
  75. end;
  76. procedure TRegistryDesignerForm.InsertButtonClick(Sender: TObject);
  77. begin
  78. if not FileExists(AppRegistryFileEdit.Text) then
  79. ModalResult := mrCancel;
  80. end;
  81. end.