ソースを参照

Merge branch 'main' into downloadtemporaryfile

Martijn Laan 5 年 前
コミット
edafd0b4b6

+ 1 - 1
Examples/CodeAutomation.iss

@@ -279,7 +279,7 @@ end;
 
 procedure CreateButton(ALeft, ATop: Integer; ACaption: String; ANotifyEvent: TNotifyEvent);
 begin
-  with TButton.Create(WizardForm) do begin
+  with TNewButton.Create(WizardForm) do begin
     Left := ALeft;
     Top := ATop;
     Width := WizardForm.CancelButton.Width;

+ 1 - 1
Examples/CodeAutomation2.iss

@@ -267,7 +267,7 @@ end;
 
 procedure CreateButton(ALeft, ATop: Integer; ACaption: String; ANotifyEvent: TNotifyEvent);
 begin
-  with TButton.Create(WizardForm) do begin
+  with TNewButton.Create(WizardForm) do begin
     Left := ALeft;
     Top := ATop;
     Width := (WizardForm.CancelButton.Width*3)/2;

+ 13 - 10
Examples/CodeClasses.iss

@@ -37,6 +37,7 @@ var
   Form: TSetupForm;
   Edit: TNewEdit;
   OKButton, CancelButton: TNewButton;
+  W: Integer;
 begin
   Form := CreateCustomForm();
   try
@@ -55,26 +56,28 @@ begin
 
     OKButton := TNewButton.Create(Form);
     OKButton.Parent := Form;
+    OKButton.Caption := 'OK';
     OKButton.Left := Form.ClientWidth - ScaleX(75 + 6 + 75 + 10);
     OKButton.Top := Form.ClientHeight - ScaleY(23 + 10);
-    OKButton.Width := ScaleX(75);
     OKButton.Height := ScaleY(23);
     OKButton.Anchors := [akRight, akBottom]
-    OKButton.Caption := 'OK';
     OKButton.ModalResult := mrOk;
     OKButton.Default := True;
 
     CancelButton := TNewButton.Create(Form);
     CancelButton.Parent := Form;
+    CancelButton.Caption := 'Cancel';
     CancelButton.Left := Form.ClientWidth - ScaleX(75 + 10);
     CancelButton.Top := Form.ClientHeight - ScaleY(23 + 10);
-    CancelButton.Width := ScaleX(75);
     CancelButton.Height := ScaleY(23);
     CancelButton.Anchors := [akRight, akBottom]
-    CancelButton.Caption := 'Cancel';
     CancelButton.ModalResult := mrCancel;
     CancelButton.Cancel := True;
 
+    W := Form.CalculateButtonWidth([OKButton.Caption, CancelButton.Caption]);
+    OKButton.Width := W;
+    CancelButton.Width := W;
+
     Form.ActiveControl := Edit;
     { Keep the form from sizing vertically since we don't have any controls which can size vertically }
     Form.KeepSizeY := True;
@@ -126,9 +129,9 @@ begin
   Page := CreateCustomPage(wpWelcome, 'Custom wizard page controls', 'TButton and others');
 
   Button := TNewButton.Create(Page);
-  Button.Width := ScaleX(75);
-  Button.Height := ScaleY(23);
   Button.Caption := 'TNewButton';
+  Button.Width := WizardForm.CalculateButtonWidth([Button.Caption]);
+  Button.Height := ScaleY(23);
   Button.OnClick := @ButtonOnClick;
   Button.Parent := Page.Surface;
 
@@ -176,21 +179,21 @@ begin
   Memo.Parent := Page.Surface;
 
   FormButton := TNewButton.Create(Page);
+  FormButton.Caption := 'TSetupForm';
   FormButton.Top := Memo.Top + Memo.Height + ScaleY(8);
-  FormButton.Width := ScaleX(75);
+  FormButton.Width := WizardForm.CalculateButtonWidth([FormButton.Caption]);
   FormButton.Height := ScaleY(23);
   FormButton.Anchors := [akLeft, akBottom];
-  FormButton.Caption := 'TSetupForm';
   FormButton.OnClick := @FormButtonOnClick;
   FormButton.Parent := Page.Surface;
 
   TaskDialogButton := TNewButton.Create(Page);
+  TaskDialogButton.Caption := 'TaskDialogMsgBox';
   TaskDialogButton.Top := FormButton.Top;
   TaskDialogButton.Left := FormButton.Left + FormButton.Width + ScaleX(8);
-  TaskDialogButton.Width := ScaleX(110);
+  TaskDialogButton.Width := WizardForm.CalculateButtonWidth([TaskDialogButton.Caption]);
   TaskDialogButton.Height := ScaleY(23);
   TaskDialogButton.Anchors := [akLeft, akBottom];
-  TaskDialogButton.Caption := 'TaskDialogMsgBox';
   TaskDialogButton.OnClick := @TaskDialogButtonOnClick;
   TaskDialogButton.Parent := Page.Surface;
 

+ 1 - 1
ISHelp/isetup.xml

@@ -1635,7 +1635,7 @@ ExternalSize: 1048576; Flags: external
 <p>Tells Setup the file is a font that needs to be installed. The value of this parameter is the name of the font as stored in the registry or WIN.INI. This must be exactly the same name as you see when you double-click the font file in Explorer. Note that Setup will automatically append " (TrueType)" to the end of the name.</p>
 <p>If the file is not a TrueType font, you must specify the flag <tt>fontisnttruetype</tt> in the Flags parameter.</p>
 <p>It's recommended that you use the flags <tt>onlyifdoesntexist</tt> and <tt>uninsneveruninstall</tt> when installing fonts to the {autofonts} directory.</p>
-<p>If the installation is running in <link topic="admininstallmode">non administrative install mode</link>, Windows 10 Version 1803 or later is required successfully install a font.</p>
+<p>If the installation is running in <link topic="admininstallmode">non administrative install mode</link>, Windows 10 Version 1803 or later is required to successfully install a font.</p>
 <p>For compatibility with 64-bit Windows, fonts should not be installed to the <tt>{sys}</tt> directory. Use <tt>{autofonts}</tt> as the destination directory instead.</p>
 <example>
 <pre>Source: "OZHANDIN.TTF"; DestDir: "{autofonts}"; FontInstall: "Oz Handicraft BT"; Flags: onlyifdoesntexist uninsneveruninstall</pre>

+ 1 - 0
ISHelp/isxclasses.pas

@@ -732,6 +732,7 @@ TUIStateForm = class(TForm)
 end;
 
 TSetupForm = class(TUIStateForm)
+  function CalculateButtonWidth(const ButtonCaptions: array of String): Integer;
   function ShouldSizeX: Boolean;
   function ShouldSizeY: Boolean;
   procedure FlipSizeAndCenterIfNeeded(const ACenterInsideControl: Boolean; const CenterInsideControlCtl: TWinControl; const CenterInsideControlInsideClientArea: Boolean);

+ 1 - 0
Projects/ScriptClasses_C.pas

@@ -295,6 +295,7 @@ procedure RegisterSetupForm_C(Cl: TPSPascalCompiler);
 begin
   with Cl.AddClassN(Cl.FindClass('TUIStateForm'), 'TSetupForm') do
   begin
+    RegisterMethod('function CalculateButtonWidth(const ButtonCaptions: array of String): Integer;');
     RegisterMethod('function ShouldSizeX: Boolean;');
     RegisterMethod('function ShouldSizeY: Boolean;');
     RegisterMethod('procedure FlipSizeAndCenterIfNeeded(const ACenterInsideControl: Boolean; const CenterInsideControlCtl: TWinControl; const CenterInsideControlInsideClientArea: Boolean)');

+ 1 - 0
Projects/ScriptClasses_R.pas

@@ -187,6 +187,7 @@ procedure RegisterSetupForm_R(Cl: TPSRuntimeClassImporter);
 begin
   with Cl.Add(TSetupForm) do
   begin
+    RegisterMethod(@TSetupForm.CalculateButtonWidth, 'CalculateButtonWidth');
     RegisterMethod(@TSetupForm.ShouldSizeX, 'ShouldSizeX');
     RegisterMethod(@TSetupForm.ShouldSizeY, 'ShouldSizeY');
     RegisterMethod(@TSetupForm.FlipSizeAndCenterIfNeeded, 'FlipSizeAndCenterIfNeeded');

+ 2 - 2
Projects/ScriptDlg.pas

@@ -441,7 +441,7 @@ var
   Edit: TEdit;
   Button: TNewButton;
 begin
-  ButtonWidth := WizardForm.CalculateButtonWidth([msgButtonWizardBrowse]);
+  ButtonWidth := WizardForm.CalculateButtonWidth([SetupMessages[msgButtonWizardBrowse]]);
 
   if APrompt <> '' then begin
     PromptLabel := TNewStaticText.Create(Self);
@@ -583,7 +583,7 @@ var
   Edit: TEdit;
   Button: TNewButton;
 begin
-  ButtonWidth := WizardForm.CalculateButtonWidth([msgButtonWizardBrowse]);
+  ButtonWidth := WizardForm.CalculateButtonWidth([SetupMessages[msgButtonWizardBrowse]]);
 
   if APrompt <> '' then begin
     PromptLabel := TNewStaticText.Create(Self);

+ 2 - 2
Projects/SelFolderForm.pas

@@ -128,8 +128,8 @@ begin
   FFolderTreeView.Top := FFolderTreeView.Top + YDiff;
   NewFolderButton.Caption := SetupMessages[msgButtonNewFolder];
   NewFolderButton.Top := NewFolderButton.Top + YDiff;
-  NewFolderButton.Width := CalculateButtonWidth([msgButtonNewFolder]);
-  W := CalculateButtonWidth([msgButtonOK, msgButtonCancel]);
+  NewFolderButton.Width := CalculateButtonWidth([SetupMessages[msgButtonNewFolder]]);
+  W := CalculateButtonWidth([SetupMessages[msgButtonOK], SetupMessages[msgButtonCancel]]);
   CancelButton.Caption := SetupMessages[msgButtonCancel];
   CancelButton.SetBounds(CancelButton.Left + CancelButton.Width - W,
     CancelButton.Top + YDiff, W, CancelButton.Height);

+ 3 - 3
Projects/SetupForm.pas

@@ -47,7 +47,7 @@ type
     {$ELSE}
     constructor CreateNew(AOwner: TComponent; Dummy: Integer = 0); override;
     {$ENDIF}
-    function CalculateButtonWidth(const ButtonCaptions: array of TSetupMessageID): Integer;
+    function CalculateButtonWidth(const ButtonCaptions: array of String): Integer;
     procedure InitializeFont;
     function ScalePixelsX(const N: Integer): Integer;
     function ScalePixelsY(const N: Integer): Integer;
@@ -316,7 +316,7 @@ begin
   inherited;
 end;
 
-function TSetupForm.CalculateButtonWidth(const ButtonCaptions: array of TSetupMessageID): Integer;
+function TSetupForm.CalculateButtonWidth(const ButtonCaptions: array of String): Integer;
 var
   DC: HDC;
   I, W: Integer;
@@ -327,7 +327,7 @@ begin
   try
     SelectObject(DC, Font.Handle);
     for I := Low(ButtonCaptions) to High(ButtonCaptions) do begin
-      W := GetTextWidth(DC, SetupMessages[ButtonCaptions[I]], True) + ScalePixelsX(20);
+      W := GetTextWidth(DC, ButtonCaptions[I], True) + ScalePixelsX(20);
       if Result < W then
         Result := W;
     end;

+ 5 - 4
Projects/Wizard.pas

@@ -895,8 +895,9 @@ begin
   end;
   
   { Position the buttons, and scale their size }
-  W1 := CalculateButtonWidth([msgButtonBack, msgButtonCancel, msgButtonFinish,
-    msgButtonInstall, msgButtonNext]);  { width of each button }
+  W1 := CalculateButtonWidth([SetupMessages[msgButtonBack], SetupMessages[msgButtonCancel],
+    SetupMessages[msgButtonFinish], SetupMessages[msgButtonInstall],
+    SetupMessages[msgButtonNext]]);  { width of each button }
   W2 := ScalePixelsX(10);  { margin, and space between Next & Cancel }
 
   BackButton.Width := W1;
@@ -1008,7 +1009,7 @@ begin
   DirEdit.Top := DirEdit.Top + I;
   TryEnableAutoCompleteFileSystem(DirEdit.Handle);
   DirBrowseButton.Caption := SetupMessages[msgButtonWizardBrowse];
-  X := CalculateButtonWidth([msgButtonWizardBrowse]);
+  X := CalculateButtonWidth([SetupMessages[msgButtonWizardBrowse]]);
   DirBrowseButton.SetBounds(InnerNotebook.Width - X,
     DirBrowseButton.Top + I, X, DirBrowseButton.Height);
   DirEdit.Width := DirBrowseButton.Left - ScalePixelsX(10) - DirEdit.Left;
@@ -1053,7 +1054,7 @@ begin
   Inc(I, AdjustLabelHeight(SelectStartMenuFolderBrowseLabel));
   GroupEdit.Top := GroupEdit.Top + I;
   GroupBrowseButton.Caption := SetupMessages[msgButtonWizardBrowse];
-  X := CalculateButtonWidth([msgButtonWizardBrowse]);
+  X := CalculateButtonWidth([SetupMessages[msgButtonWizardBrowse]]);
   GroupBrowseButton.SetBounds(InnerNotebook.Width - X,
     GroupBrowseButton.Top + I, X, GroupBrowseButton.Height);
   GroupEdit.Width := GroupBrowseButton.Left - ScalePixelsX(10) - GroupEdit.Left;

+ 7 - 2
whatsnew.htm

@@ -26,7 +26,7 @@ Portions Copyright &copy; 2000-2020 Martijn Laan. All rights reserved.<br />
 For conditions of distribution and use, see <a href="https://jrsoftware.org/files/is/license.txt">LICENSE.TXT</a>.
 </p>
 
-<p><b>Want to be notified by e-mail of  of new Inno Setup releases?</b> <a href="https://jrsoftware.org/ismail.php">Subscribe</a> to the Inno Setup Mailing List!<br /><b>If you subscribed before October 2019, please resubscribe.</b></p>
+<p><b>Want to be notified by e-mail of new Inno Setup releases?</b> <a href="https://jrsoftware.org/ismail.php">Subscribe</a> to the Inno Setup Mailing List!<br /><b>If you subscribed before October 2019, please resubscribe.</b></p>
 
 <p><a name="6.1.0"></a><span class="ver">6.1.0-dev </span><span class="date">(?)</span></p>
 <p><span class="head2">Per-user fonts</span></p>
@@ -86,7 +86,12 @@ For conditions of distribution and use, see <a href="https://jrsoftware.org/file
     <li>These new prompts also use other new messages: <a href="https://github.com/jrsoftware/issrc/commit/e5ccbc5e0b1e2327a3608b1c69d016613c88df7e">View differences in Default.isl</a> for a complete list.</li>
   </ul>
   </li>
-  <li>Pascal Scripting change: <i>Fix:</i> Support function <tt>WizardSelectComponents</tt> now also updates component sizes and the current selection's required disk space.</li>
+  <li>Pascal Scripting changes:
+  <ul>
+    <li>Added new <tt>CalculateButtonWidth</tt> function to the <tt>TSetupForm</tt> support class.</li>
+    <li><i>Fix:</i> Support function <tt>WizardSelectComponents</tt> now also updates component sizes and the current selection's required disk space.</li>
+  </ul>
+  </li>
   <li>Minor tweaks.</li>
 </ul>