瀏覽代碼

Merge branch 'ser163-filelist-generator'. Closes #440.

Martijn Laan 1 年之前
父節點
當前提交
32d7e343f7

+ 114 - 0
Projects/CompFilesDesigner.dfm

@@ -0,0 +1,114 @@
+object FilesDesignerForm: TFilesDesignerForm
+  Left = 624
+  Top = 375
+  BorderStyle = bsDialog
+  Caption = '[Files] Entries Designer'
+  ClientHeight = 403
+  ClientWidth = 575
+  Color = clBtnFace
+  Font.Charset = DEFAULT_CHARSET
+  Font.Color = clWindowText
+  Font.Height = -12
+  Font.Name = 'Segoe UI'
+  Font.Style = []
+  Position = poDesktopCenter
+  OnCreate = FormCreate
+  OnDestroy = FormDestroy
+  TextHeight = 15
+  object Panel1: TPanel
+    Left = 0
+    Top = 361
+    Width = 575
+    Height = 42
+    Align = alBottom
+    BevelOuter = bvNone
+    TabOrder = 0
+    object Bevel1: TBevel
+      Left = 0
+      Top = 0
+      Width = 575
+      Height = 3
+      Align = alTop
+      Shape = bsBottomLine
+    end
+    object InsertButton: TButton
+      Left = 406
+      Top = 11
+      Width = 75
+      Height = 25
+      Caption = 'Insert'
+      ModalResult = 1
+      TabOrder = 0
+      OnClick = InsertButtonClick
+    end
+    object CancelButton: TButton
+      Left = 490
+      Top = 11
+      Width = 75
+      Height = 25
+      Cancel = True
+      Caption = 'Cancel'
+      ModalResult = 2
+      TabOrder = 1
+    end
+  end
+  object AppFilesEditButton: TButton
+    Left = 476
+    Top = 107
+    Width = 89
+    Height = 23
+    Caption = '&Parameters...'
+    TabOrder = 1
+  end
+  object AppFilesRemoveButton: TButton
+    Left = 476
+    Top = 135
+    Width = 89
+    Height = 23
+    Caption = 'Remo&ve'
+    TabOrder = 2
+  end
+  object AppFilesAddDirButton: TButton
+    Left = 476
+    Top = 79
+    Width = 89
+    Height = 23
+    Caption = 'Add fol&der...'
+    TabOrder = 3
+  end
+  object AppFilesAddButton: TButton
+    Left = 476
+    Top = 51
+    Width = 89
+    Height = 23
+    Caption = '&Add file(s)...'
+    TabOrder = 4
+  end
+  object AppFilesListBox: TDropListBox
+    Left = 8
+    Top = 52
+    Width = 453
+    Height = 297
+    ItemHeight = 15
+    TabOrder = 5
+  end
+  object AppFilesLabel: TNewStaticText
+    Left = 8
+    Top = 32
+    Width = 411
+    Height = 16
+    AutoSize = False
+    Caption = '&Files:'
+    FocusControl = AppFilesListBox
+    TabOrder = 6
+    WordWrap = True
+  end
+  object NotCreateAppDirCheck: TCheckBox
+    Left = 8
+    Top = 8
+    Width = 253
+    Height = 17
+    Caption = '&Script has CreateAppDir=no'
+    TabOrder = 7
+  end
+end

+ 60 - 0
Projects/CompFilesDesigner.pas

@@ -0,0 +1,60 @@
+unit CompFilesDesigner;
+
+interface
+
+uses
+  Classes, Controls, Forms, Dialogs, ExtCtrls, StdCtrls,
+  UIStateForm, NewStaticText, DropListBox, CompWizardFilesHelper;
+
+type
+  TFilesDesignerForm = class(TUIStateForm)
+    Panel1: TPanel;
+    InsertButton: TButton;
+    CancelButton: TButton;
+    AppFilesEditButton: TButton;
+    AppFilesRemoveButton: TButton;
+    AppFilesAddDirButton: TButton;
+    AppFilesAddButton: TButton;
+    AppFilesListBox: TDropListBox;
+    AppFilesLabel: TNewStaticText;
+    NotCreateAppDirCheck: TCheckBox;
+    Bevel1: TBevel;
+    procedure FormCreate(Sender: TObject);
+    procedure FormDestroy(Sender: TObject);
+    procedure InsertButtonClick(Sender: TObject);
+  private
+    FFilesHelper: TWizardFormFilesHelper;
+    function GetText: String;
+  public
+    property Text: string read GetText;
+  end;
+
+implementation
+
+{$R *.dfm}
+
+procedure TFilesDesignerForm.FormCreate(Sender: TObject);
+begin
+  FFilesHelper := TWizardFormFilesHelper.Create(Handle,
+    NotCreateAppDirCheck, AppFilesListBox, AppFilesAddButton, AppFilesAddDirButton,
+    AppFilesEditButton, AppFilesRemoveButton);
+end;
+
+procedure TFilesDesignerForm.FormDestroy(Sender: TObject);
+begin
+  FFilesHelper.Free;
+end;
+
+function TFilesDesignerForm.GetText: String;
+begin
+  Result := '';
+  FFilesHelper.AddScript(Result);
+end;
+
+procedure TFilesDesignerForm.InsertButtonClick(Sender: TObject);
+begin
+  if FFilesHelper.FilesCount = 0 then
+    ModalResult := mrCancel;
+end;
+
+end.

+ 8 - 3
Projects/CompForm.dfm

@@ -675,10 +675,15 @@ object CompileForm: TCompileForm
         ShortCut = 24647
         OnClick = TGenerateGUIDClick
       end
-      object TInsertMsgBox: TMenuItem
-        Caption = '&MessageBox Designer...'
+      object TMsgBoxDesigner: TMenuItem
+        Caption = '&MsgBox/TaskDialogMsgBox Designer...'
         ShortCut = 24653
-        OnClick = TInsertMsgBoxClick
+        OnClick = TMsgBoxDesignerClick
+      end
+      object TFilesDesigner: TMenuItem
+        Caption = '[F&iles] Entries Designer...'
+        ShortCut = 24649
+        OnClick = TFilesDesignerClick
       end
       object N7: TMenuItem
         Caption = '-'

+ 29 - 8
Projects/CompForm.pas

@@ -190,7 +190,7 @@ type
     PListSelectAll: TMenuItem;
     DebugCallStackList: TListBox;
     VDebugCallStack: TMenuItem;
-    TInsertMsgBox: TMenuItem;
+    TMsgBoxDesigner: TMenuItem;
     ToolBarPanel: TPanel;
     HMailingList: TMenuItem;
     MemosTabSet: TNewTabSet; { First tab is the main memo, last tab is the preprocessor output memo }
@@ -210,6 +210,7 @@ type
     N22: TMenuItem;
     PrintDialog: TPrintDialog;
     FSaveEncodingUTF8NoPreamble: TMenuItem;
+    TFilesDesigner: TMenuItem;
     procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
     procedure FExitClick(Sender: TObject);
     procedure FOpenMainFileClick(Sender: TObject);
@@ -294,7 +295,7 @@ type
       State: TOwnerDrawState);
     procedure VDebugCallStackClick(Sender: TObject);
     procedure HMailingListClick(Sender: TObject);
-    procedure TInsertMsgBoxClick(Sender: TObject);
+    procedure TMsgBoxDesignerClick(Sender: TObject);
     procedure MemosTabSetClick(Sender: TObject);
     procedure FSaveAllClick(Sender: TObject);
     procedure RStepOutClick(Sender: TObject);
@@ -309,6 +310,7 @@ type
       State: TOwnerDrawState);
     procedure FindResultsListDblClick(Sender: TObject);
     procedure FPrintClick(Sender: TObject);
+    procedure TFilesDesignerClick(Sender: TObject);
   private
     { Private declarations }
     FMemos: TList<TCompScintEdit>;                      { FMemos[0] is the main memo and FMemos[1] the preprocessor output memo - also see MemosTabSet comment above }
@@ -518,7 +520,8 @@ uses
   PathFunc, CmnFunc, CmnFunc2, FileClass, CompMsgs, TmSchema, BrowseFunc,
   HtmlHelpFunc, TaskbarProgressFunc,
   {$IFDEF STATICCOMPILER} Compile, {$ENDIF}
-  CompOptions, CompStartup, CompWizard, CompSignTools, CompTypes, CompInputQueryCombo, CompMessageBoxDesigner;
+  CompOptions, CompStartup, CompWizard, CompSignTools, CompTypes, CompInputQueryCombo, CompMsgBoxDesigner,
+  CompFilesDesigner;
 
 {$R *.DFM}
 
@@ -2877,7 +2880,8 @@ var
 begin
   MemoIsReadOnly := FActiveMemo.ReadOnly;
   TGenerateGUID.Enabled := not MemoIsReadOnly;
-  TInsertMsgBox.Enabled := not MemoIsReadOnly;
+  TMsgBoxDesigner.Enabled := not MemoIsReadOnly;
+  TFilesDesigner.Enabled := not MemoIsReadOnly;
 end;
 
 procedure TCompileForm.TAddRemoveProgramsClick(Sender: TObject);
@@ -2892,19 +2896,36 @@ begin
     FActiveMemo.SelText := GenerateGuid;
 end;
 
-procedure TCompileForm.TInsertMsgBoxClick(Sender: TObject);
+procedure TCompileForm.TMsgBoxDesignerClick(Sender: TObject);
 var
-  MsgBoxForm: TMBDForm;
+  MsgBoxForm: TMsgBoxDesignerForm;
 begin
-  MsgBoxForm := TMBDForm.Create(Application);
+  MsgBoxForm := TMsgBoxDesignerForm.Create(Application);
   try
-    if MsgBoxForm.ShowModal = mrOk then
+    if (MsgBoxForm.ShowModal = mrOk) and
+       (MsgBox('The generated Pascal script will be inserted into the editor at the cursor position. Continue?',
+        SCompilerFormCaption, mbConfirmation, MB_YESNO) = IDYES) then
       FActiveMemo.SelText := MsgBoxForm.Text;
   finally
     MsgBoxForm.Free;
   end;
 end;
 
+procedure TCompileForm.TFilesDesignerClick(Sender: TObject);
+var
+  FilesDesignerForm: TFilesDesignerForm;
+begin
+  FilesDesignerForm := TFilesDesignerForm.Create(Application);
+  try
+    if (FilesDesignerForm.ShowModal = mrOk) and
+       (MsgBox('The generated script will be inserted into the editor at the cursor position. Continue?',
+        SCompilerFormCaption, mbConfirmation, MB_YESNO) = IDYES) then
+      FActiveMemo.SelText := FilesDesignerForm.Text;
+  finally
+    FilesDesignerForm.Free;
+  end;
+end;
+
 procedure TCompileForm.TSignToolsClick(Sender: TObject);
 var
   SignToolsForm: TSignToolsForm;

+ 2 - 2
Projects/CompMessageBoxDesigner.dfm → Projects/CompMsgBoxDesigner.dfm

@@ -1,8 +1,8 @@
-object MBDForm: TMBDForm
+object MsgBoxDesignerForm: TMsgBoxDesignerForm
   Left = 0
   Top = 0
   BorderStyle = bsDialog
-  Caption = 'MessageBox Designer'
+  Caption = 'MsgBox/TaskDialogMsgBox Designer'
   ClientHeight = 380
   ClientWidth = 548
   Color = clBtnFace

+ 23 - 23
Projects/CompMessageBoxDesigner.pas → Projects/CompMsgBoxDesigner.pas

@@ -1,4 +1,4 @@
-unit CompMessageBoxDesigner;
+unit CompMsgBoxDesigner;
 
 {
   Inno Setup
@@ -18,7 +18,7 @@ uses
   UIStateForm, StdCtrls, ExtCtrls, NewStaticText, ComCtrls, pngimage;
 
 type
-  TMBDForm = class(TUIStateForm)
+  TMsgBoxDesignerForm = class(TUIStateForm)
     IMGmbInformation: TImage;
     IMGmbConfirmation: TImage;
     IMGmbError: TImage;
@@ -114,7 +114,7 @@ uses
 
 {$R *.DFM}
 
-procedure TMBDForm.FormCreate(Sender: TObject);
+procedure TMsgBoxDesignerForm.FormCreate(Sender: TObject);
 begin
   InitFormFont(Self);
 
@@ -141,7 +141,7 @@ begin
   Button2Label.Visible := False;
 end;
 
-procedure TMBDForm.rbMB_OKClick(Sender: TObject);
+procedure TMsgBoxDesignerForm.rbMB_OKClick(Sender: TObject);
 begin
   cb_IDOK.Checked := False;
   cb_IDCANCEL.Checked := False;
@@ -201,7 +201,7 @@ begin
   end;
 end;
 
-procedure TMBDForm.rbMB_YESNOClick(Sender: TObject);
+procedure TMsgBoxDesignerForm.rbMB_YESNOClick(Sender: TObject);
 begin
   cb_IDOK.Checked := False;
   cb_IDCANCEL.Checked := False;
@@ -264,7 +264,7 @@ begin
   end;
 end;
 
-procedure TMBDForm.rbMB_OKCANCELClick(Sender: TObject);
+procedure TMsgBoxDesignerForm.rbMB_OKCANCELClick(Sender: TObject);
 begin
   cb_IDOK.Checked := False;
   cb_IDCANCEL.Checked := False;
@@ -327,7 +327,7 @@ begin
   end;
 end;
 
-procedure TMBDForm.rbMB_RETRYCANCELClick(Sender: TObject);
+procedure TMsgBoxDesignerForm.rbMB_RETRYCANCELClick(Sender: TObject);
 begin
   cb_IDOK.Checked := False;
   cb_IDCANCEL.Checked := False;
@@ -390,7 +390,7 @@ begin
   end;
 end;
 
-procedure TMBDForm.rbMB_YESNOCANCELClick(Sender: TObject);
+procedure TMsgBoxDesignerForm.rbMB_YESNOCANCELClick(Sender: TObject);
 begin
   cb_IDOK.Checked := False;
   cb_IDCANCEL.Checked := False;
@@ -453,7 +453,7 @@ begin
   end;
 end;
 
-procedure TMBDForm.rbMB_ABORTRETRYIGNOREClick(Sender: TObject);
+procedure TMsgBoxDesignerForm.rbMB_ABORTRETRYIGNOREClick(Sender: TObject);
 begin
   cb_IDOK.Checked := False;
   cb_IDCANCEL.Checked := False;
@@ -516,12 +516,12 @@ begin
   end;
 end;
 
-procedure TMBDForm.UpDown1Changing(Sender: TObject; var AllowChange: Boolean);
+procedure TMsgBoxDesignerForm.UpDown1Changing(Sender: TObject; var AllowChange: Boolean);
 begin
    AllowChange := True;
 end;
 
-procedure TMBDForm.cb_MsgBoxClick(Sender: TObject);
+procedure TMsgBoxDesignerForm.cb_MsgBoxClick(Sender: TObject);
 begin
    IMGmbConfirmation.Visible := True;
    cb_MB_SETFOREGROUND.Enabled := True;
@@ -574,7 +574,7 @@ begin
    rbMB_OKClick(Self);
 end;
 
-procedure TMBDForm.cb_SuppressibleClick(Sender: TObject);
+procedure TMsgBoxDesignerForm.cb_SuppressibleClick(Sender: TObject);
 begin
    if cb_Suppressible.Checked then begin
      cb_DefIDOK.Visible := True;
@@ -617,7 +617,7 @@ begin
    if rbMB_ABORTRETRYIGNORE.Checked then rbMB_ABORTRETRYIGNOREClick(Self);
 end;
 
-procedure TMBDForm.cb_TaskDialogMsgBoxClick(Sender: TObject);
+procedure TMsgBoxDesignerForm.cb_TaskDialogMsgBoxClick(Sender: TObject);
 begin
    IMGmbConfirmation.Visible := False;
    cb_MB_SETFOREGROUND.Enabled := False;
@@ -681,13 +681,13 @@ begin
    rbMB_OKClick(Self);
 end;
 
-procedure TMBDForm.rb_IDOKClick(Sender: TObject);
+procedure TMsgBoxDesignerForm.rb_IDOKClick(Sender: TObject);
 begin
    if rb_IDOK.Checked then
       rb_IDCANCEL.Checked := False;
 end;
 
-procedure TMBDForm.rb_IDCANCELClick(Sender: TObject);
+procedure TMsgBoxDesignerForm.rb_IDCANCELClick(Sender: TObject);
 begin
    if rb_IDCANCEL.Checked then begin
       rb_IDOK.Checked := False;
@@ -697,7 +697,7 @@ begin
    end;
 end;
 
-procedure TMBDForm.rb_IDYESClick(Sender: TObject);
+procedure TMsgBoxDesignerForm.rb_IDYESClick(Sender: TObject);
 begin
    if rb_IDYES.Checked then begin
       rb_IDNO.Checked := False;
@@ -705,7 +705,7 @@ begin
    end;
 end;
 
-procedure TMBDForm.rb_IDNOClick(Sender: TObject);
+procedure TMsgBoxDesignerForm.rb_IDNOClick(Sender: TObject);
 begin
    if rb_IDNO.Checked then begin
       rb_IDYES.Checked := False;
@@ -713,7 +713,7 @@ begin
    end;
 end;
 
-procedure TMBDForm.rb_IDRETRYClick(Sender: TObject);
+procedure TMsgBoxDesignerForm.rb_IDRETRYClick(Sender: TObject);
 begin
    if rb_IDRETRY.Checked then begin
       rb_IDCANCEL.Checked := False;
@@ -722,7 +722,7 @@ begin
    end;
 end;
 
-procedure TMBDForm.rb_IDIGNOREClick(Sender: TObject);
+procedure TMsgBoxDesignerForm.rb_IDIGNOREClick(Sender: TObject);
 begin
    if rb_IDIGNORE.Checked then begin
       rb_IDABORT.Checked := False;
@@ -730,7 +730,7 @@ begin
    end;
 end;
 
-procedure TMBDForm.rb_IDABORTClick(Sender: TObject);
+procedure TMsgBoxDesignerForm.rb_IDABORTClick(Sender: TObject);
 begin
    if rb_IDABORT.Checked then begin
       rb_IDIGNORE.Checked := False;
@@ -738,7 +738,7 @@ begin
    end;
 end;
 
-procedure TMBDForm.MBDButtonPreviewClick(Sender: TObject);
+procedure TMsgBoxDesignerForm.MBDButtonPreviewClick(Sender: TObject);
 var
   ButtonsBtn : Cardinal;
   TypeIcon : TMsgBoxType;
@@ -834,7 +834,7 @@ begin
   end;
 end;
 
-procedure TMBDForm.MSGTextKeyPress(Sender: TObject; var Key: Char);
+procedure TMsgBoxDesignerForm.MSGTextKeyPress(Sender: TObject; var Key: Char);
 begin
   if Key = #27 then begin
     MBDButtonCancel.Click;
@@ -842,7 +842,7 @@ begin
   end;
 end;
 
-function TMBDForm.GetText: String;
+function TMsgBoxDesignerForm.GetText: String;
 
    { MsgBox / SuppressibleMsgBox }
    function TextMsg(M: Integer; a, b, c, d, e, f: String): String;

+ 1 - 8
Projects/CompWizard.dfm

@@ -521,9 +521,6 @@ object WizardForm: TWizardForm
             Anchors = [akLeft, akTop, akRight, akBottom]
             ItemHeight = 13
             TabOrder = 6
-            OnClick = AppFilesListBoxClick
-            OnDblClick = AppFilesListBoxDblClick
-            OnDropFile = AppFilesListBoxDropFile
           end
           object AppFilesAddButton: TButton
             Left = 360
@@ -533,7 +530,6 @@ object WizardForm: TWizardForm
             Anchors = [akTop, akRight]
             Caption = '&Add file(s)...'
             TabOrder = 7
-            OnClick = AppFilesAddButtonClick
           end
           object AppFilesEditButton: TButton
             Left = 360
@@ -541,9 +537,8 @@ object WizardForm: TWizardForm
             Width = 89
             Height = 23
             Anchors = [akTop, akRight]
-            Caption = '&Edit...'
+            Caption = '&Parameters...'
             TabOrder = 9
-            OnClick = AppFilesEditButtonClick
           end
           object AppFilesRemoveButton: TButton
             Left = 360
@@ -553,7 +548,6 @@ object WizardForm: TWizardForm
             Anchors = [akTop, akRight]
             Caption = 'Remo&ve'
             TabOrder = 10
-            OnClick = AppFilesRemoveButtonClick
           end
           object AppExeEdit: TEdit
             Left = 36
@@ -590,7 +584,6 @@ object WizardForm: TWizardForm
             Anchors = [akTop, akRight]
             Caption = 'Add fol&der...'
             TabOrder = 8
-            OnClick = AppFilesAddDirButtonClick
           end
           object NoAppExeCheck: TCheckBox
             Left = 36

+ 9 - 162
Projects/CompWizard.pas

@@ -14,8 +14,9 @@ interface
 {$I VERSION.INC}
 
 uses
-  Windows, Forms, Classes, Graphics, StdCtrls, ExtCtrls, Controls, Dialogs,
-  UIStateForm, NewStaticText, DropListBox, NewCheckListBox, NewNotebook;
+  Windows, Forms, Classes, Graphics, StdCtrls, ExtCtrls, Controls, Dialogs, pngimage,
+  UIStateForm, NewStaticText, DropListBox, NewCheckListBox, NewNotebook,
+  CompWizardFilesHelper;
 
 type
   TWizardPage = (wpWelcome, wpAppInfo, wpAppDir, wpAppFiles, wpAppAssoc, wpAppIcons,
@@ -140,15 +141,7 @@ type
     procedure AppRootDirComboBoxChange(Sender: TObject);
     procedure NotCreateAppDirCheckClick(Sender: TObject);
     procedure AppExeButtonClick(Sender: TObject);
-    procedure AppFilesListBoxClick(Sender: TObject);
-    procedure AppFilesListBoxDblClick(Sender: TObject);
-    procedure AppFilesAddButtonClick(Sender: TObject);
     procedure NotDisableProgramGroupPageCheckClick(Sender: TObject);
-    procedure AppFilesEditButtonClick(Sender: TObject);
-    procedure AppFilesRemoveButtonClick(Sender: TObject);
-    procedure AppFilesAddDirButtonClick(Sender: TObject);
-    procedure AppFilesListBoxDropFile(Sender: TDropListBox;
-      const FileName: String);
     procedure PasswordEditChange(Sender: TObject);
     procedure OutputDirButtonClick(Sender: TObject);
     procedure AllLanguagesButtonClick(Sender: TObject);
@@ -160,7 +153,7 @@ type
   private
     CurPage: TWizardPage;
     FWizardName: String;
-    FWizardFiles: TList;
+    FFilesHelper: TWizardFormFilesHelper;
     FLanguages: TStringList;
     FResult: TWizardFormResult;
     FResultScript: String;
@@ -168,9 +161,6 @@ type
     procedure SetWizardName(const WizardName: String);
     procedure CurPageChanged;
     function SkipCurPage: Boolean;
-    procedure AddWizardFile(const Source: String; const RecurseSubDirs, CreateAllSubDirs: Boolean);
-    procedure UpdateWizardFiles;
-    procedure UpdateWizardFilesButtons;
     procedure UpdateAppExeControls;
     procedure UpdateAppAssocControls;
     procedure UpdateAppIconsControls;
@@ -284,7 +274,9 @@ begin
   FResult := wrNone;
 
   FWizardName := SWizardDefaultName;
-  FWizardFiles := TList.Create;
+  FFilesHelper := TWizardFormFilesHelper.Create(Handle,
+    NotCreateAppDirCheck, AppFilesListBox, AppFilesAddButton, AppFilesAddDirButton,
+    AppFilesEditButton, AppFilesRemoveButton);
 
   FLanguages := TStringList.Create;
   FLanguages.Sorted := True;
@@ -344,7 +336,6 @@ begin
   { AppFiles }
   AppExeEdit.Text := PathExtractPath(NewParamStr(0)) + 'Examples\MyProg.exe';
   AppExeRunCheck.Checked := True;
-  UpdateWizardFilesButtons;
 
   { AppAssoc }
   CreateAssocCheck.Checked := True;
@@ -396,13 +387,9 @@ begin
 end;
 
 procedure TWizardForm.FormDestroy(Sender: TObject);
-var
-  I: Integer;
 begin
   FLanguages.Free;
-  for I := 0 to FWizardFiles.Count-1 do
-    Dispose(FWizardFiles[i]);
-  FWizardFiles.Free;
+  FFilesHelper.Free;
 end;
 
 { --- }
@@ -594,47 +581,6 @@ end;
 
 {---}
 
-procedure TWizardForm.AddWizardFile(const Source: String; const RecurseSubDirs, CreateAllSubDirs: Boolean);
-var
-  WizardFile: PWizardFile;
-begin
-  New(WizardFile);
-  WizardFile.Source := Source;
-  WizardFile.RecurseSubDirs := RecurseSubDirs;
-  WizardFile.CreateAllSubDirs := CreateAllSubDirs;
-  WizardFile.DestRootDirIsConstant := True;
-  if not NotCreateAppDirCheck.Checked then
-    WizardFile.DestRootDir := '{app}'
-  else
-    WizardFile.DestRootDir := '{win}';
-  WizardFile.DestSubDir := '';
-  FWizardFiles.Add(WizardFile);
-end;
-
-procedure TWizardForm.UpdateWizardFiles;
-var
-  WizardFile: PWizardFile;
-  I: Integer;
-begin
-  AppFilesListBox.Items.BeginUpdate;
-  AppFilesListBox.Items.Clear;
-  for I := 0 to FWizardFiles.Count-1 do begin
-    WizardFile := FWizardFiles[i];
-    AppFilesListBox.Items.Add(WizardFile.Source);
-  end;
-  AppFilesListBox.Items.EndUpdate;
-  UpdateHorizontalExtent(AppFilesListBox);
-end;
-
-procedure TWizardForm.UpdateWizardFilesButtons;
-var
-  Enabled: Boolean;
-begin
-  Enabled := AppFilesListBox.ItemIndex >= 0;
-  AppFilesEditButton.Enabled := Enabled;
-  AppFilesRemoveButton.Enabled := Enabled;
-end;
-
 procedure TWizardForm.UpdateAppExeControls;
 var
   Enabled: Boolean;
@@ -761,96 +707,6 @@ begin
   UpdateAppIconsControls;
 end;
 
-procedure TWizardForm.AppFilesListBoxClick(Sender: TObject);
-begin
-  UpdateWizardFilesButtons;
-end;
-
-procedure TWizardForm.AppFilesListBoxDblClick(Sender: TObject);
-begin
-  if AppFilesEditButton.Enabled then
-    AppFilesEditButton.Click;
-end;
-
-procedure TWizardForm.AppFilesAddButtonClick(Sender: TObject);
-var
-  FileList: TStringList;
-  I: Integer;
-begin
-  FileList := TStringList.Create;
-  try
-    if NewGetOpenFileNameMulti('', FileList, '', SWizardAllFilesFilter, '', Handle) then begin
-      FileList.Sort;
-      for I := 0 to FileList.Count-1 do
-        AddWizardFile(FileList[I], False, False);
-      UpdateWizardFiles;
-    end;
-  finally
-    FileList.Free;
-  end;
-end;
-
-procedure TWizardForm.AppFilesAddDirButtonClick(Sender: TObject);
-var
-  Path: String;
-  Recurse: Boolean;
-begin
-  Path := '';
-  if BrowseForFolder(SWizardAppFiles3, Path, Handle, False) then begin
-    case MsgBox(Format(SWizardAppFilesSubDirsMessage, [Path]), '', mbConfirmation, MB_YESNOCANCEL) of
-      IDYES: Recurse := True;
-      IDNO: Recurse := False;
-    else
-      Exit;
-    end;
-    AddWizardFile(AddBackslash(Path) + '*', Recurse, Recurse);
-    UpdateWizardFiles;
-  end;
-end;
-
-procedure TWizardForm.AppFilesListBoxDropFile(Sender: TDropListBox;
-  const FileName: String);
-begin
-  if DirExists(FileName) then
-    AddWizardFile(AddBackslash(FileName) + '*', True, True)
-  else
-    AddWizardFile(FileName, False, False);
-  UpdateWizardFiles;
-  UpdateWizardFilesButtons;
-end;
-
-procedure TWizardForm.AppFilesEditButtonClick(Sender: TObject);
-var
-  WizardFileForm: TWizardFileForm;
-  Index: Integer;
-begin
-  WizardFileForm := TWizardFileForm.Create(Application);
-  try
-    Index := AppFilesListBox.ItemIndex;
-    WizardFileForm.AllowAppDestRootDir := not NotCreateAppDirCheck.Checked;
-    WizardFileForm.WizardFile := FWizardFiles[Index];
-    if WizardFileForm.ShowModal = mrOK then begin
-      UpdateWizardFiles;
-      AppFilesListBox.ItemIndex := Index;
-      AppFilesListBox.TopIndex := Index;
-      UpdateWizardFilesButtons;
-    end;
-  finally
-    WizardFileForm.Free;
-  end;
-end;
-
-procedure TWizardForm.AppFilesRemoveButtonClick(Sender: TObject);
-var
-  I: Integer;
-begin
-  I := AppFilesListBox.ItemIndex;
-  Dispose(FWizardFiles[I]);
-  FWizardFiles.Delete(I);
-  UpdateWizardFiles;
-  UpdateWizardFilesButtons;
-end;
-
 procedure TWizardForm.CreateAssocCheckClick(Sender: TObject);
 begin
   UpdateAppAssocControls;
@@ -939,7 +795,6 @@ end;
 procedure TWizardForm.GenerateScript;
 var
   Script, ISPP, Setup, Languages, Tasks, Files, Registry, INI, Icons, Run, UninstallDelete: String;
-  WizardFile: PWizardFile;
   I: Integer;
   AppExeName, AppName, AppAmpEscapedName, AppAssocKey, LanguageName, LanguageMessagesFile: String;
 begin
@@ -1054,15 +909,7 @@ begin
       Registry := Registry + 'Root: HKA; Subkey: "Software\Classes\Applications\' + AppExeName + '\SupportedTypes"; ValueType: string; ValueName: ".myp"; ValueData: ""' + SNewLine;
     end;
 
-    for I := 0 to FWizardFiles.Count-1 do begin
-      WizardFile := FWizardFiles[I];
-      Files := Files + 'Source: "' + WizardFile.Source + '"; DestDir: "' + RemoveBackslashUnlessRoot(AddBackslash(WizardFile.DestRootDir) + WizardFile.DestSubDir) + '"; Flags: ignoreversion';
-      if WizardFile.RecurseSubDirs then
-        Files := Files + ' recursesubdirs';
-      if WizardFile.CreateAllSubDirs then
-        Files := Files + ' createallsubdirs';
-      Files := Files + SNewLine;
-    end;
+    FFilesHelper.AddScript(Files);
 
     { AppGroup }
     if not NotCreateAppDirCheck.Checked then begin

+ 229 - 0
Projects/CompWizardFilesHelper.pas

@@ -0,0 +1,229 @@
+unit CompWizardFilesHelper;
+
+interface
+
+uses
+  Windows, Classes, StdCtrls,
+  DropListBox;
+
+type
+  TWizardFormFilesHelper = class
+    private
+      FWizardFiles: TList;
+      FHandle: HWND;
+      FNotCreateAppDirCheck: TCheckBox;
+      FFilesListBox: TDropListBox;
+      FEditButton: TButton;
+      FRemoveButton: TButton;
+      procedure AddWizardFile(const Source: String; const RecurseSubDirs, CreateAllSubDirs: Boolean);
+      function GetWizardFilesCount: Integer;
+      procedure UpdateWizardFiles;
+      procedure UpdateWizardFilesButtons;
+      procedure FilesListBoxClick(Sender: TObject);
+      procedure FilesListBoxDblClick(Sender: TObject);
+      procedure FilesListBoxDropFile(Sender: TDropListBox; const FileName: String);
+      procedure AddButtonClick(Sender: TObject);
+      procedure AddDirButtonClick(Sender: TObject);
+      procedure EditButtonClick(Sender: TObject);
+      procedure RemoveButtonClick(Sender: TObject);
+    public
+      constructor Create(const Handle: HWND;
+        const NotCreateAppDirCheck: TCheckBox; const FilesListBox: TDropListBox;
+        const AddButton, AddDirButton, EditButton, RemoveButton: TButton);
+      destructor Destroy; override;
+      procedure AddScript(var Files: String);
+      property FilesCount: Integer read GetWizardFilesCount;
+  end;
+
+implementation
+
+uses
+  SysUtils, Forms, UITypes,
+  CmnFunc, CmnFunc2, BrowseFunc, PathFunc,
+  CompMsgs, CompWizardFile;
+
+constructor TWizardFormFilesHelper.Create(const Handle: HWND;
+  const NotCreateAppDirCheck: TCheckBox; const FilesListBox: TDropListBox;
+  const AddButton, AddDirButton, EditButton, RemoveButton: TButton);
+begin
+  inherited Create;
+
+  FWizardFiles := TList.Create;
+
+  FHandle := Handle;
+  FNotCreateAppDirCheck := NotCreateAppDirCheck;
+  FFilesListBox := FilesListBox;
+  FEditButton := EditButton;
+  FRemoveButton := RemoveButton;
+
+  FilesListBox.OnClick := FilesListBoxClick;
+  FilesListBox.OnDblClick := FilesListBoxDblClick;
+  FilesListBox.OnDropFile :=   FilesListBoxDropFile;
+  AddButton.OnClick := AddButtonClick;
+  AddDirButton.OnClick := AddDirButtonClick;
+  EditButton.OnClick := EditButtonClick;
+  RemoveButton.OnClick := RemoveButtonClick;
+
+  UpdateWizardFilesButtons;
+end;
+
+destructor TWizardFormFilesHelper.Destroy;
+begin
+  for var I := 0 to FWizardFiles.Count-1 do
+    Dispose(FWizardFiles[i]);
+  FWizardFiles.Free;
+end;
+
+procedure TWizardFormFilesHelper.AddWizardFile(const Source: String; const RecurseSubDirs, CreateAllSubDirs: Boolean);
+var
+  WizardFile: PWizardFile;
+begin
+  New(WizardFile);
+  WizardFile.Source := Source;
+  WizardFile.RecurseSubDirs := RecurseSubDirs;
+  WizardFile.CreateAllSubDirs := CreateAllSubDirs;
+  WizardFile.DestRootDirIsConstant := True;
+  if not FNotCreateAppDirCheck.Checked then
+    WizardFile.DestRootDir := '{app}'
+  else
+    WizardFile.DestRootDir := '{win}';
+  WizardFile.DestSubDir := '';
+  FWizardFiles.Add(WizardFile);
+end;
+
+function TWizardFormFilesHelper.GetWizardFilesCount: Integer;
+begin
+  Result := FWizardFiles.Count;
+end;
+
+procedure TWizardFormFilesHelper.UpdateWizardFiles;
+var
+  WizardFile: PWizardFile;
+  I: Integer;
+begin
+  FFilesListBox.Items.BeginUpdate;
+  FFilesListBox.Items.Clear;
+  for I := 0 to FWizardFiles.Count-1 do begin
+    WizardFile := FWizardFiles[i];
+    FFilesListBox.Items.Add(WizardFile.Source);
+  end;
+  FFilesListBox.Items.EndUpdate;
+  UpdateHorizontalExtent(FFilesListBox);
+end;
+
+procedure TWizardFormFilesHelper.UpdateWizardFilesButtons;
+var
+  Enabled: Boolean;
+begin
+  Enabled := FFilesListBox.ItemIndex >= 0;
+  FEditButton.Enabled := Enabled;
+  FRemoveButton.Enabled := Enabled;
+end;
+
+procedure TWizardFormFilesHelper.FilesListBoxClick(Sender: TObject);
+begin
+  UpdateWizardFilesButtons;
+end;
+
+procedure TWizardFormFilesHelper.FilesListBoxDblClick(Sender: TObject);
+begin
+  if FEditButton.Enabled then
+    FEditButton.Click;
+end;
+
+procedure TWizardFormFilesHelper.FilesListBoxDropFile(Sender: TDropListBox;
+  const FileName: String);
+begin
+  if DirExists(FileName) then
+    AddWizardFile(AddBackslash(FileName) + '*', True, True)
+  else
+    AddWizardFile(FileName, False, False);
+  UpdateWizardFiles;
+  UpdateWizardFilesButtons;
+end;
+
+procedure TWizardFormFilesHelper.AddButtonClick(Sender: TObject);
+var
+  FileList: TStringList;
+  I: Integer;
+begin
+  FileList := TStringList.Create;
+  try
+    if NewGetOpenFileNameMulti('', FileList, '', SWizardAllFilesFilter, '', FHandle) then begin
+      FileList.Sort;
+      for I := 0 to FileList.Count-1 do
+        AddWizardFile(FileList[I], False, False);
+      UpdateWizardFiles;
+    end;
+  finally
+    FileList.Free;
+  end
+end;
+
+procedure TWizardFormFilesHelper.AddDirButtonClick(Sender: TObject);
+var
+  Path: String;
+  Recurse: Boolean;
+begin
+  Path := '';
+  if BrowseForFolder(SWizardAppFiles3, Path, FHandle, False) then begin
+    case MsgBox(Format(SWizardAppFilesSubDirsMessage, [Path]), '', mbConfirmation, MB_YESNOCANCEL) of
+      IDYES: Recurse := True;
+      IDNO: Recurse := False;
+    else
+      Exit;
+    end;
+    AddWizardFile(AddBackslash(Path) + '*', Recurse, Recurse);
+    UpdateWizardFiles;
+  end;
+end;
+
+procedure TWizardFormFilesHelper.EditButtonClick(Sender: TObject);
+var
+  WizardFileForm: TWizardFileForm;
+  Index: Integer;
+begin
+  WizardFileForm := TWizardFileForm.Create(Application);
+  try
+    Index := FFilesListBox.ItemIndex;
+    WizardFileForm.AllowAppDestRootDir := not FNotCreateAppDirCheck.Checked;
+    WizardFileForm.WizardFile := FWizardFiles[Index];
+    if WizardFileForm.ShowModal = mrOk then begin
+      UpdateWizardFiles;
+      FFilesListBox.ItemIndex := Index;
+      FFilesListBox.TopIndex := Index;
+      UpdateWizardFilesButtons;
+    end;
+  finally
+    WizardFileForm.Free;
+  end;
+end;
+
+procedure TWizardFormFilesHelper.RemoveButtonClick(Sender: TObject);
+var
+  I: Integer;
+begin
+  I := FFilesListBox.ItemIndex;
+    Dispose(FWizardFiles[I]);
+  FWizardFiles.Delete(I);
+  UpdateWizardFiles;
+  UpdateWizardFilesButtons;
+end;
+
+procedure TWizardFormFilesHelper.AddScript(var Files: String);
+var
+  WizardFile: PWizardFile;
+  I: Integer;
+begin
+  for I := 0 to FWizardFiles.Count-1 do begin
+    WizardFile := FWizardFiles[I];
+    Files := Files + 'Source: "' + WizardFile.Source + '"; DestDir: "' + RemoveBackslashUnlessRoot(AddBackslash(WizardFile.DestRootDir) + WizardFile.DestSubDir) + '"; Flags: ignoreversion';
+    if WizardFile.RecurseSubDirs then
+      Files := Files + ' recursesubdirs';
+    if WizardFile.CreateAllSubDirs then
+      Files := Files + ' createallsubdirs';
+    Files := Files + SNewLine;
+  end;
+end;
+
+end.

+ 7 - 5
Projects/Compil32.dpr

@@ -36,10 +36,12 @@ uses
   ScintEdit in '..\Components\ScintEdit.pas',
   ScintStylerInnoSetup in '..\Components\ScintStylerInnoSetup.pas',
   ModernColors in '..\Components\ModernColors.pas',
-  CompMessageBoxDesigner in 'CompMessageBoxDesigner.pas' {MBDForm},
-  CompScintEdit in 'CompScintEdit.pas';
+  CompMsgBoxDesigner in 'CompMsgBoxDesigner.pas' {MsgBoxDesignerForm},
+  CompScintEdit in 'CompScintEdit.pas',
+  CompFilesDesigner in 'CompFilesDesigner.pas' {FilesDesignerForm},
+  CompWizardFilesHelper in 'CompWizardFilesHelper.pas';
 
-{$SetPEFlags IMAGE_FILE_RELOCS_STRIPPED} 
+{$SetPEFlags IMAGE_FILE_RELOCS_STRIPPED}
 {$SETPEOSVERSION 6.0}
 {$SETPESUBSYSVERSION 6.0}
 {$WEAKLINKRTTI ON}
@@ -89,7 +91,7 @@ begin
       if CommandLineCompile then
         CommandLine := '/CC ' + CommandLine;
     end;
-    
+
     if Length(CommandLine) > RESTART_MAX_CMD_LINE then
       CommandLine := '';
 
@@ -109,7 +111,7 @@ const
   MutexName = 'InnoSetupCompilerAppMutex';
 begin
   CreateMutex(MutexName);
-  CreateMutex('Global\' + MutexName);  { don't localize }
+  CreateMutex('Global\' + MutexName); { don't localize }
 end;
 
 var

+ 7 - 2
Projects/Compil32.dproj

@@ -110,10 +110,15 @@
         <DCCReference Include="..\Components\ScintEdit.pas"/>
         <DCCReference Include="..\Components\ScintStylerInnoSetup.pas"/>
         <DCCReference Include="..\Components\ModernColors.pas"/>
-        <DCCReference Include="CompMessageBoxDesigner.pas">
-            <Form>MBDForm</Form>
+        <DCCReference Include="CompMsgBoxDesigner.pas">
+            <Form>MsgBoxDesignerForm</Form>
         </DCCReference>
         <DCCReference Include="CompScintEdit.pas"/>
+        <DCCReference Include="CompFilesDesigner.pas">
+            <Form>FilesDesignerForm</Form>
+            <FormType>dfm</FormType>
+        </DCCReference>
+        <DCCReference Include="CompWizardFilesHelper.pas"/>
         <BuildConfiguration Include="Base">
             <Key>Base</Key>
         </BuildConfiguration>

+ 1 - 0
whatsnew.htm

@@ -35,6 +35,7 @@ For conditions of distribution and use, see <a href="https://jrsoftware.org/file
   <ul>
   <li>Added new <i>UTF-8 without BOM</i> menu item to the <i>Save Encoding</i> submenu of the <i>File</i> menu.</li>
   <li>New script files are now saved as UTF-8 with BOM by default. Existing files are still saved as they were.</li>
+  <li>Added new <i>[Files] Entries Designer</i> menu item to the <i>Tools</i> menu to design and insert extra entries to the [Files] section.</li>
   </ul>
   </li>
   <li>Pascal Scripting changes: