Selaa lähdekoodia

Bring back WizardImageBackColor and WizardSmallImageBackColor.

This reverts (and improves) commit ee1e25f0e786bddff719afd76b9447b13d5e9748.
Martijn Laan 2 viikkoa sitten
vanhempi
commit
4c2b4cb2df

+ 17 - 11
ISHelp/isetup.xml

@@ -1132,10 +1132,12 @@ DefaultGroupName=My Program
 <li><link topic="setup_showcomponentsizes">ShowComponentSizes</link></li>
 <li><link topic="setup_showtaskstreelines">ShowTasksTreeLines</link></li>
 <li><link topic="setup_wizardimagealphaformat">WizardImageAlphaFormat</link></li>
+<li><link topic="setup_wizardimagebackcolor">WizardImageBackColor</link></li>
 <li><link topic="setup_wizardimagefile">WizardImageFile</link></li>
 <li><link topic="setup_wizardimagestretch">WizardImageStretch</link></li>
 <li><link topic="setup_wizardresizable">WizardResizable</link></li>
 <li><link topic="setup_wizardsizepercent">WizardSizePercent</link></li>
+<li><link topic="setup_wizardsmallimagebackcolor">WizardSmallImageBackColor</link></li>
 <li><link topic="setup_wizardsmallimagefile">WizardSmallImageFile</link></li>
 <li><link topic="setup_wizardstyle">WizardStyle</link></li>
 </ul>
@@ -1160,8 +1162,6 @@ DefaultGroupName=My Program
 <li><link topic="setup_windowvisible">WindowShowCaption</link></li>
 <li><link topic="setup_windowvisible">WindowStartMaximized</link></li>
 <li><link topic="setup_windowvisible">WindowVisible</link></li>
-<li><link topic="setup_wizardimagebackcolor">WizardImageBackColor</link></li>
-<li><link topic="setup_wizardsmallimagebackcolor">WizardSmallImageBackColor</link></li>
 </ul>
 
 </body>
@@ -5457,7 +5457,7 @@ DiskSliceSize=736000000
 <setupdefault><i>(blank)</i></setupdefault>
 <body>
 <p>Specifies the name(s) of the image file(s) to display on the left side of the <i>Welcome</i> and <i>Setup Completed</i> wizard pages. Wildcards are supported and the files(s) must be located in your installation's <link topic="sourcedirectorynotes">source directory</link> when running the compiler, unless a fully qualified pathname is specified or the pathname is prefixed by "compiler:", in which case it looks for the file in the compiler directory.</p>
-<p>Supports .bmp and .png images, including those with transparency. Even transparent .bmp files are supported, see <link topic="setup_wizardimagealphaformat">WizardImageAlphaFormat</link> for more information.</p>
+<p>Supports .bmp and .png images, including those with transparency. Use <link topic="setup_wizardimagebackcolor">WizardImageBackColor</link> to customize the background color. Even transparent .bmp files are supported, see <link topic="setup_wizardimagealphaformat">WizardImageAlphaFormat</link> for more information.</p>
 <p>The size of the area in which the image is displayed depends on the system's DPI setting and whether the default <link topic="langoptionssection">font settings</link> are being used. At standard DPI with the default font settings, the size of the area is 164x314 pixels. At 200% DPI, the width and height will be roughly double that. In all cases, an aspect ratio of 164:314 is maintained. The specified image should have the same aspect ratio.</p>
 <p>Any size of image may be used; by default, images that are too small or too large to fit in the image area will be stretched or shrunk. Specifying an image larger than 164x314 is recommended to avoid the image looking blurry on higher-DPI systems. The size of the default built-in image is 240x459.</p>
 <p>If a single larger-sized image does not produce a satisfactory result across different DPI settings, multiple files may be specified, separated by commas. In that case, Setup will automatically select the one that best matches the size of the image area. Assuming the default font settings are being used, the size of the image area at various DPI settings is:</p>
@@ -5477,6 +5477,7 @@ DiskSliceSize=736000000
 <p><b>See also:</b><br/>
 <link topic="setup_wizardsmallimagefile">WizardSmallImageFile</link><br/>
 <link topic="setup_wizardimagealphaformat">WizardImageAlphaFormat</link><br/>
+<link topic="setup_wizardimagebackcolor">WizardImageBackColor</link><br/>
 <link topic="setup_wizardimagestretch">WizardImageStretch</link></p>
 </body>
 </setuptopic>
@@ -5485,7 +5486,7 @@ DiskSliceSize=736000000
 <setupdefault><i>(blank)</i></setupdefault>
 <body>
 <p>Specifies the name(s) of the image file(s) to display in the upper right corner of the wizard. Wildcards are supported and the file(s) must be located in your installation's <link topic="sourcedirectorynotes">source directory</link> when running the compiler, unless a fully qualified pathname is specified or the pathname is prefixed by "compiler:", in which case it looks for the file in the compiler directory.</p>
-<p>Supports .bmp and .png images, including those with transparency. Even transparent .bmp files are supported, see <link topic="setup_wizardimagealphaformat">WizardImageAlphaFormat</link> for more information.</p>
+<p>Supports .bmp and .png images, including those with transparency. Use <link topic="setup_wizardsmallimagebackcolor">WizardSmallImageBackColor</link> to customize the background color. Even transparent .bmp files are supported, see <link topic="setup_wizardimagealphaformat">WizardImageAlphaFormat</link> for more information.</p>
 <p>The size of the area in which the image is displayed depends on the system's DPI setting and whether the default <link topic="langoptionssection">font settings</link> are being used. At standard DPI with the default font settings, the size of the area is 58x58 pixels. At 200% DPI, the width and height will be roughly double that. In all cases, the area is square; thus, the specified image should be square as well.</p>
 <p>Any size of image may be used; by default, images that are too small or too large to fit in the image area will be stretched or shrunk. Specifying an image larger than 58x58 is recommended to avoid the image looking blurry on higher-DPI systems. The size of the default built-in image is 147x147.</p>
 <p>If a single larger-sized image does not produce a satisfactory result across different DPI settings, multiple files may be specified, separated by commas. In that case, Setup will automatically select the one that best matches the size of the image area. Assuming the default font settings are being used, the size of the image area at various DPI settings is:</p>
@@ -5506,6 +5507,7 @@ DiskSliceSize=736000000
 <p><b>See also:</b><br/>
 <link topic="setup_wizardimagefile">WizardImageFile</link><br/>
 <link topic="setup_wizardimagealphaformat">WizardImageAlphaFormat</link><br/>
+<link topic="setup_wizardsmallimagebackcolor">WizardSmallImageBackColor</link><br/>
 <link topic="setup_wizardimagestretch">WizardImageStretch</link></p>
 </body>
 </setuptopic>
@@ -5539,8 +5541,18 @@ DiskSliceSize=736000000
 </setuptopic>
 
 <setuptopic directive="WizardImageBackColor">
+<setupvalid>A value in the form of <tt>$<i>bbggrr</i></tt>, where <tt>bb</tt>, <tt>gg</tt>, and <tt>rr</tt> specify the two-digit intensities (in hexadecimal) for blue, green, and red respectively. Or it may be one of the following predefined color names: <tt>clBlack</tt>, <tt>clMaroon</tt>, <tt>clGreen</tt>, <tt>clOlive</tt>, <tt>clNavy</tt>, <tt>clPurple</tt>, <tt>clTeal</tt>, <tt>clGray</tt>, <tt>clSilver</tt>, <tt>clRed</tt>, <tt>clLime</tt>, <tt>clYellow</tt>, <tt>clBlue</tt>, <tt>clFuchsia</tt>, <tt>clAqua</tt>, <tt>clWhite</tt>, <tt>clNone</tt>, <tt>clWindow</tt>.</setupvalid>
+<setupdefault><tt>$f9f3e8</tt> (bluish gray) if the built-in wizard image is used, <tt>clWindow</tt> otherwise.</setupdefault>
+<body>
+<p>This directive specifies the background color used to fill any unused or transparent space around the wizard image, which is specified by <link topic="setup_wizardimagefile">WizardImageFile</link>.</p>
+</body>
+</setuptopic>
+
+<setuptopic directive="WizardSmallImageBackColor">
+<setupvalid>A value in the form of <tt>$<i>bbggrr</i></tt>, where <tt>bb</tt>, <tt>gg</tt>, and <tt>rr</tt> specify the two-digit intensities (in hexadecimal) for blue, green, and red respectively. Or it may be one of the following predefined color names: <tt>clBlack</tt>, <tt>clMaroon</tt>, <tt>clGreen</tt>, <tt>clOlive</tt>, <tt>clNavy</tt>, <tt>clPurple</tt>, <tt>clTeal</tt>, <tt>clGray</tt>, <tt>clSilver</tt>, <tt>clRed</tt>, <tt>clLime</tt>, <tt>clYellow</tt>, <tt>clBlue</tt>, <tt>clFuchsia</tt>, <tt>clAqua</tt>, <tt>clWhite</tt>, <tt>clNone</tt>, <tt>clWindow</tt>.</setupvalid>
+<setupdefault><tt>clNone</tt> if the built-in small wizard image is used, <tt>clWindow</tt> otherwise.</setupdefault>
 <body>
-<p><i>Obsolete in 5.5.7.</i> This directive formerly specified the background color used to fill any unused space around the wizard bitmap when <link topic="setup_wizardimagestretch">WizardImageStretch</link> was set to <tt>no</tt>. Now any unused space is filled with the standard window color (usually white). If you wish to create a colored border around the image, do so by modifying the bitmap itself.</p>
+<p>This directive specifies the background color used to fill any unused or transparent space around the small wizard image, which is specified by <link topic="setup_wizardsmallimagefile">WizardSmallImageFile</link>.</p>
 </body>
 </setuptopic>
 
@@ -5580,12 +5592,6 @@ DiskSliceSize=736000000
 </body>
 </setuptopic>
 
-<setuptopic directive="WizardSmallImageBackColor">
-<body>
-<p><i>Obsolete in 5.0.4.</i> This directive formerly specified the background color used to fill any unused space around the small wizard bitmap when <link topic="setup_wizardimagestretch">WizardImageStretch</link> was set to <tt>no</tt>. Now any unused space is filled with the standard window color (usually white). If you wish to create a colored border around the image, do so by modifying the bitmap itself.</p>
-</body>
-</setuptopic>
-
 <setuptopic directive="SourceDir">
 <body>
 <p>Specifies a new <link topic="sourcedirectorynotes">source directory</link> for the script.</p>

+ 13 - 15
Projects/Src/Compiler.HelperFunc.pas

@@ -65,7 +65,6 @@ const
   clNone = TColor($1FFFFFFF);
   clDefault = TColor($20000000);
 
-function IdentToColor(const Ident: string; var Color: Longint): Boolean;
 function StringToColor(const S: string): TColor;
 function IsRelativePath(const Filename: String): Boolean;
 function CreateMemoryStreamFromFile(const Filename: String; const CheckTrust: Boolean = False;
@@ -137,21 +136,20 @@ const
     (Value: clInfoBk; Name: 'clInfoBk'),
     (Value: clNone; Name: 'clNone'));
 
-function IdentToColor(const Ident: string; var Color: Longint): Boolean;
-var
-  I: Integer;
-begin
-  for I := Low(Colors) to High(Colors) do
-    if CompareText(Colors[I].Name, Ident) = 0 then
-    begin
-      Result := True;
-      Color := Longint(Colors[I].Value);
-      Exit;
-    end;
-  Result := False;
-end;
-
 function StringToColor(const S: string): TColor;
+
+  function IdentToColor(const Ident: string; var Color: LongInt): Boolean;
+  begin
+    for var I := Low(Colors) to High(Colors) do
+      if CompareText(Colors[I].Name, Ident) = 0 then
+      begin
+        Result := True;
+        Color := LongInt(Colors[I].Value);
+        Exit;
+      end;
+    Result := False;
+  end;
+
 begin
   if not IdentToColor(S, Longint(Result)) then
     Result := TColor(StrToInt(S));

+ 23 - 6
Projects/Src/Compiler.SetupCompiler.pas

@@ -3220,8 +3220,19 @@ begin
         else
           Invalid;
     end;
-    ssWizardImageBackColor, ssWizardSmallImageBackColor: begin
-        WarningsList.Add(Format(SCompilerEntryObsolete, ['Setup', KeyName]));
+    ssWizardImageBackColor: begin
+        try
+          SetupHeader.WizardImageBackColor := StringToColor(Value);
+        except
+          Invalid;
+        end;
+      end;
+    ssWizardSmallImageBackColor: begin
+        try
+          SetupHeader.WizardSmallImageBackColor := StringToColor(Value);
+        except
+          Invalid;
+        end;
       end;
     ssWizardImageStretch: begin
         SetSetupHeaderOption(shWizardImageStretch);
@@ -7997,10 +8008,13 @@ begin
         WarningsList.Add(Format(SCompilerWizImageRenamed, [WizardImageFile, 'compiler:WizClassicImage.bmp']));
         WizardImageFile := 'compiler:WizClassicImage.bmp';
       end;
-      WizardImages := CreateWizardImagesFromFiles('WizardImageFile', WizardImageFile)
+      WizardImages := CreateWizardImagesFromFiles('WizardImageFile', WizardImageFile);
+      if SetupDirectiveLines[ssWizardImageBackColor] = 0 then
+        SetupHeader.WizardImageBackColor := clWindow;
     end else begin
       WizardImages := CreateWizardImagesFromResources(['WizardImage'], ['150']);
-      Include(SetupHeader.Options, shUsesBuiltinWizardImages);
+      if SetupDirectiveLines[ssWizardImageBackColor] = 0 then
+        SetupHeader.WizardImageBackColor := $f9f3e8; { Bluish Gray }
     end;
     LineNumber := SetupDirectiveLines[ssWizardSmallImageFile];
     AddStatus(Format(SCompilerStatusReadingFile, ['WizardSmallImageFile']));
@@ -8009,10 +8023,13 @@ begin
         WarningsList.Add(Format(SCompilerWizImageRenamed, [WizardSmallImageFile, 'compiler:WizClassicSmallImage.bmp']));
         WizardSmallImageFile := 'compiler:WizClassicSmallImage.bmp';
       end;
-      WizardSmallImages := CreateWizardImagesFromFiles('WizardSmallImage', WizardSmallImageFile)
+      WizardSmallImages := CreateWizardImagesFromFiles('WizardSmallImage', WizardSmallImageFile);
+      if SetupDirectiveLines[ssWizardSmallImageBackColor] = 0 then
+        SetupHeader.WizardSmallImageBackColor := clWindow;
     end else begin
       WizardSmallImages := CreateWizardImagesFromResources(['WizardSmallImage'], ['250']);
-      Include(SetupHeader.Options, shUsesBuiltinSmallWizardImages);
+      if SetupDirectiveLines[ssWizardSmallImageBackColor] = 0 then
+        SetupHeader.WizardSmallImageBackColor := clNone;
     end;
     LineNumber := 0;
 

+ 0 - 3
Projects/Src/Setup.WizardForm.dfm

@@ -81,7 +81,6 @@ object WizardForm: TWizardForm
         Width = 164
         Height = 314
         Anchors = [akLeft, akTop, akBottom]
-        BackColor = clWindow
       end
       object FWelcomeLabel2: TNewStaticText
         Left = 176
@@ -706,7 +705,6 @@ object WizardForm: TWizardForm
           Width = 58
           Height = 58
           Anchors = [akTop, akRight]
-          BackColor = clWindow
         end
         object FPageDescriptionLabel: TNewStaticText
           Left = 40
@@ -745,7 +743,6 @@ object WizardForm: TWizardForm
         Width = 164
         Height = 314
         Anchors = [akLeft, akTop, akBottom]
-        BackColor = clWindow
       end
       object FRunList: TNewCheckListBox
         Left = 176

+ 3 - 7
Projects/Src/Setup.WizardForm.pas

@@ -881,24 +881,20 @@ begin
 
   { Initialize images }
   WizardBitmapImage.Graphic := SelectBestImage(WizardImages, WizardBitmapImage.Width, WizardBitmapImage.Height);
+  WizardBitmapImage.BackColor := SetupHeader.WizardImageBackColor;
   WizardBitmapImage.Center := True;
   WizardBitmapImage.Stretch := (shWizardImageStretch in SetupHeader.Options);
   WizardBitmapImage2.Bitmap := WizardBitmapImage.Bitmap;
+  WizardBitmapImage2.BackColor := SetupHeader.WizardImageBackColor;
   WizardBitmapImage2.Center := True;
   WizardBitmapImage2.Stretch := (shWizardImageStretch in SetupHeader.Options);
   WizardSmallBitmapImage.Graphic := SelectBestImage(WizardSmallImages, WizardSmallBitmapImage.Width, WizardSmallBitmapImage.Height);
+  WizardSmallBitmapImage.BackColor := SetupHeader.WizardSmallImageBackColor;
   WizardSmallBitmapImage.Stretch := (shWizardImageStretch in SetupHeader.Options);
   SelectDirBitmapImage.InitializeFromIcon(HInstance, 'Z_DIRICON', clNone, [32, 48, 64]); {don't localize}
   SelectGroupBitmapImage.InitializeFromIcon(HInstance, 'Z_GROUPICON', clNone, [32, 48, 64]); {don't localize}
   PreparingErrorBitmapImage.InitializeFromIcon(HInstance, 'Z_STOPICON', clNone, [16, 24, 32]); {don't localize}
 
-  if shUsesBuiltinWizardImages in SetupHeader.Options then begin
-    WizardBitmapImage.BackColor := $F9F3E8; { Bluish Gray }
-    WizardBitmapImage2.BackColor := WizardBitmapImage.BackColor;
-  end;
-  if shUsesBuiltinSmallWizardImages in SetupHeader.Options then
-    WizardSmallBitmapImage.BackColor := clNone;
-
   { Initialize wpWelcome page }
   RegisterExistingPage(wpWelcome, WelcomePage, nil, '', '');
   WelcomeLabel1.Caption := ExpandSetupMessage(msgWelcomeLabel1) + SNewLine;

+ 2 - 2
Projects/Src/Shared.Struct.pas

@@ -64,8 +64,7 @@ type
     shSignedUninstaller, shUsePreviousLanguage, shDisableWelcomePage,
     shCloseApplications, shRestartApplications, shAllowNetworkDrive,
     shForceCloseApplications, shAppNameHasConsts, shUsePreviousPrivileges,
-    shWizardResizable, shUninstallLogging, shUsesBuiltinWizardImages,
-    shUsesBuiltinSmallWizardImages);
+    shWizardResizable, shUninstallLogging);
   TSetupLanguageDetectionMethod = (ldUILanguage, ldLocale, ldNone);
   TSetupCompressMethod = (cmStored, cmZip, cmBzip, cmLZMA, cmLZMA2);
   TSetupKDFSalt = array[0..15] of Byte;
@@ -120,6 +119,7 @@ type
     WizardStyle: TSetupWizardStyle;
     WizardSizePercentX, WizardSizePercentY: Integer;
     WizardImageAlphaFormat: (afIgnored, afDefined, afPremultiplied); // Must be same as Graphics.TAlphaFormat
+    WizardImageBackColor, WizardSmallImageBackColor: LongInt;
     ExtraDiskSpaceRequired: Int64;
     SlicesPerDisk: Integer;
     UninstallLogMode: (lmAppend, lmNew, lmOverwrite);

+ 2 - 2
whatsnew.htm

@@ -51,8 +51,8 @@ For conditions of distribution and use, see <a href="files/is/license.txt">LICEN
 <ul>
 <li>Added support for .png files to <tt>[Setup]</tt> section directives <tt>WizardImageFile</tt> and <tt>WizardSmallImageFile</tt>.</li>
 <li>Improved support for stretching 32-bit .bmp files with transparency.</li>
-<li>The built-in wizard images and icons now have transparent backgrounds, allowing their background colors to be customized using Pascal scripting and the <tt>BackColor</tt> property.<br/>
-    By default, the background colors match those previously used in the images and icons, so their appearance remains unchanged unless customized.</li>
+<li>The built-in wizard images and icons now have transparent backgrounds, allowing their background colors to be customized again using Setup section directives <tt>WizardImageBackColor</tt> and <tt>WizardSmallImageBackColor</tt>, which are no longer obsolete.<br/>
+    The default values of these directives match previously used colors, so the appearance of all images and icons remains unchanged by default.</li>
 <li>Pascal Scripting:
 <ul>
   <li>Added new <tt>TPngImage</tt> support class.</li>