2
0
Эх сурвалжийг харах

Be sensible. Also clarified code a bit.

Martijn Laan 6 жил өмнө
parent
commit
17a039fcbf

+ 2 - 2
ISHelp/isetup.xml

@@ -4730,7 +4730,7 @@ DiskSliceSize=1457664
 <setupvalid><link topic="yesnonotes"><tt>yes</tt> or <tt>no</tt></link></setupvalid>
 <setupdefault><tt>yes</tt> if <link topic="setup_wizardstyle">WizardStyle</link> is set to <tt>modern</tt>, <tt>no</tt> otherwise</setupdefault>
 <body>
-<p>If set to <tt>yes</tt>, the user will be able to resize and maximize the main Setup wizard window.</p>
+<p>If set to <tt>yes</tt>, the user will be able to resize the main Setup wizard window.</p>
 <p>Use <tt>Anchors</tt> and <tt>KeepSizeY</tt> properties to add full support for <tt>WizardResizable</tt> and <tt>WizardSizePercent</tt> to all your custom controls, custom wizard pages and <tt>TSetupForm</tt> forms if you have any. See the <i>CodeClasses.iss</i> example script for an example.</p>
 <p><b>See also:</b><br/>
 <link topic="setup_wizardsizepercent">WizardSizePercent</link></p>
@@ -4739,7 +4739,7 @@ DiskSliceSize=1457664
 
 <setuptopic directive="WizardSizePercent">
 <setupformat><tt><i>a</i>,<i>b</i></tt>, where <tt><i>a</i></tt> is the horizontal size, and <tt><i>b</i></tt> is the vertical size.</setupformat>
-<setupvalid>each size: <tt>100</tt> or more</setupvalid>
+<setupvalid>each size: <tt>100</tt> through <tt>150</tt></setupvalid>
 <setupdefault><tt>120,120</tt> if <link topic="setup_wizardstyle">WizardStyle</link> is set to <tt>modern</tt>, <tt>100,100</tt> otherwise</setupdefault>
 <body>
 <p>Lets you increase the default size of all Setup and Uninstall wizard windows without increasing the font size. A size of for example 120 means a 20% size increase.</p>

+ 3 - 3
Projects/Compile.pas

@@ -3710,7 +3710,7 @@ var
       end;
   end;
 
-  procedure StrToPercentages(const S: String; var X, Y: Integer; const Min: Integer);
+  procedure StrToPercentages(const S: String; var X, Y: Integer; const Min, Max: Integer);
   var
     I: Integer;
   begin
@@ -3723,7 +3723,7 @@ var
       X := StrToIntDef(S, -1);
       Y := X;
     end;
-    if (X < Min) or (Y < Min) then
+    if (X < Min) or (X > Max) or (Y < Min) or (Y > Max) then
       Invalid;
   end;
 
@@ -4443,7 +4443,7 @@ begin
       end;
     ssWizardSizePercent: begin
         StrToPercentages(Value, SetupHeader.WizardSizePercentX,
-          SetupHeader.WizardSizePercentY, 100)
+          SetupHeader.WizardSizePercentY, 100, 150)
       end;
     ssWizardStyle: begin
         if CompareText(Value, 'classic') = 0 then

+ 17 - 17
Projects/Wizard.pas

@@ -780,7 +780,7 @@ var
   SystemMenu: HMENU;
   P: String;
   I, DefaultSetupTypeIndex: Integer;
-  IgnoreInitComponents: Boolean;
+  DfmDefault, IgnoreInitComponents: Boolean;
   TypeEntry: PSetupTypeEntry;
   ComponentEntry: PSetupComponentEntry;
   SaveClientWidth, SaveClientHeight: Integer;
@@ -838,34 +838,34 @@ begin
     Caption := FmtSetupMessage1(msgSetupWindowTitle, ExpandedAppName);
 
   { Set BorderStyle and BorderIcons:
-    -WindowVisible + WizardResizable = sizeable + maximize
-    -not WindowVisible + WizardResizable = sizeable + maximize + minimize
-    -WindowVisible + not WizardResizable = dialog (.dfm default)
+    -WindowVisible + WizardResizable = sizeable
+    -not WindowVisible + WizardResizable = sizeable + minimize
+    -WindowVisible + not WizardResizable = dialog = .dfm default = do nothing
     -not WindowVisible + not WizardResizable = single + minimize }
-  if not(shWindowVisible in SetupHeader.Options) or
-     (shWizardResizable in SetupHeader.Options) then begin
-    { Save ClientWidth/ClientHeight and restore them after changing
-      BorderStyle. }
+  DfmDefault := (shWindowVisible in SetupHeader.Options) and not (shWizardResizable in SetupHeader.Options);
+  if not DfmDefault then begin
+    { Save ClientWidth/ClientHeight and restore them after changing BorderStyle. }
     SaveClientWidth := ClientWidth;
     SaveClientHeight := ClientHeight;
     if not(shWindowVisible in SetupHeader.Options) then
       BorderIcons := BorderIcons + [biMinimize];
     if not(shWizardResizable in SetupHeader.Options) then
       BorderStyle := bsSingle
-    else begin
-      BorderIcons := BorderIcons + [biMaximize];
+    else
       BorderStyle := bsSizeable;
-    end;
     ClientWidth := SaveClientWidth;
     ClientHeight := SaveClientHeight;
-    if shWizardResizable in SetupHeader.Options then begin
-      EnableAnchorOuterPagesOnResize := True;
-      { Do not allow user to resize it smaller than the current size. }
-      Constraints.MinHeight := Height;
-      Constraints.MinWidth := Width;
-    end;
   end;
 
+  if shWizardResizable in SetupHeader.Options then begin
+    EnableAnchorOuterPagesOnResize := True;
+    { Do not allow user to resize it smaller than 100% nor larger than 150%. }
+    Constraints.MinHeight := Height;
+    Constraints.MinWidth := Width;
+    Constraints.MaxHeight := MulDiv(Height, 150, 100);
+    Constraints.MaxWidth := MulDiv(Width, 150, 100);
+  end;
+  
   { Position the buttons, and scale their size }
   W1 := CalculateButtonWidth([msgButtonBack, msgButtonCancel, msgButtonFinish,
     msgButtonInstall, msgButtonNext]);  { width of each button }

+ 1 - 1
whatsnew.htm

@@ -73,7 +73,7 @@ For conditions of distribution and use, see <a href="http://www.jrsoftware.org/f
 <p><span class="head2">Resizable wizard window</span></p>
 <p>The wizard window is now optionally resizable:</p>
 <ul>
-  <li>Added new [Setup] section directive: <tt>WizardResizable</tt>. If this directive is set to <tt>yes</tt>, the user will be able to resize and maximize the main Setup wizard window.</li>
+  <li>Added new [Setup] section directive: <tt>WizardResizable</tt>. If this directive is set to <tt>yes</tt>, the user will be able to resize the main Setup wizard window.</li>
   <li>Added new [Setup] section directive: <tt>WizardSizePercent</tt>, which can be used to increase the default size of all Setup and Uninstall wizard windows without increasing the font size.</li>
   <li>Pascal Scripting change: Added new <tt>Anchors</tt> property to all controls and new <tt>KeepSizeY</tt> property to <tt>TSetupForm</tt> which allows you to add full support for <tt>WizardResizable</tt> and <tt>WizardSizePercent</tt> to all your custom controls, custom wizard pages and <tt>TSetupForm</tt> forms if you have any. See the <i>CodeClasses.iss</i> example script for an example. This example also shows other changes done to <tt>TSetupForm</tt>.</li>
 </ul>