Просмотр исходного кода

Add WizardBackColor and WizardBackColorDynamicDark directives.

Todo:
-Hide SelectLanguageForm bevel and WizardForm bottom bevel? Optionally?
-Make NewCheckListBox use the color when WantTabs is True.
-Support it in Uninstall?
-Doc.
Martijn Laan 3 месяцев назад
Родитель
Сommit
fbe2cc66dd

+ 3 - 2
Components/NewStaticText.pas

@@ -378,7 +378,8 @@ end;
 
 { TNewStaticTextStyleHook - same as Vcl.StdCtrls' TStaticTextStyleHook
   except that it accesses the Control property as a TNewStaticText instead
-  of a TCustomStaticText or TStaticText }
+  of a TCustomStaticText or TStaticText, and that it uses the control's
+  Color property }
 
 type
   TControlAccess = class(TControl);
@@ -411,7 +412,7 @@ begin
       LStyle.DrawParentBackground(Handle, Canvas.Handle, Details, False);
       Canvas.Brush.Style := bsClear;
     end else {$ENDIF} begin
-      Canvas.Brush.Color := LStyle.GetStyleColor(scWindow);
+      Canvas.Brush.Color := TNewStaticText(Control).Color;
       Canvas.FillRect(R);
     end;
     Details := LStyle.GetElementDetails(States[Control.Enabled]);

+ 19 - 0
Projects/Src/Compiler.SetupCompiler.pas

@@ -3312,6 +3312,20 @@ begin
     ssWindowVisible: begin
         WarningsList.Add(Format(SCompilerEntryObsolete, ['Setup', KeyName]));
       end;
+    ssWizardBackColor: begin
+        try
+          SetupHeader.WizardBackColor := StringToColor(Value);
+        except
+          Invalid;
+        end;
+      end;
+    ssWizardBackColorDynamicDark: begin
+        try
+          SetupHeader.WizardBackColorDynamicDark := StringToColor(Value);
+        except
+          Invalid;
+        end;
+      end;
     ssWizardImageAlphaFormat: begin
         if CompareText(Value, 'none') = 0 then
           SetupHeader.WizardImageAlphaFormat := afIgnored
@@ -7931,6 +7945,8 @@ begin
     SetupHeader.WizardDarkStyle := wdsLight;
     SetupHeader.WizardSizePercentX := 120;
     SetupHeader.WizardSizePercentY := SetupHeader.WizardSizePercentX;
+    SetupHeader.WizardBackColor := clNone;
+    SetupHeader.WizardBackColorDynamicDark := clNone;
 
     { Read [Setup] section }
     EnumIniSection(EnumSetupProc, 'Setup', 0, True, True, '', False, False);
@@ -8110,6 +8126,9 @@ begin
     end;
     if shAlwaysUsePersonalGroup in SetupHeader.Options then
       UsedUserAreas.Add('AlwaysUsePersonalGroup');
+    if (SetupHeader.WizardBackColor <> clNone) or (SetupHeader.WizardBackColorDynamicDark <> clNone) then
+      if WizardStyleSpecial = '' then
+        WizardStyleSpecial := 'windows11';
     if WizardStyleSpecial <> '' then begin
       const BuiltinStyleFile = 'builtin:' + WizardStyleSpecial;
       if WizardStyleFile = '' then

+ 10 - 4
Projects/Src/Setup.MainFunc.pas

@@ -141,7 +141,8 @@ var
   InstallMode: (imNormal, imSilent, imVerySilent);
   HasIcons, IsWin64, Is64BitInstallMode, IsAdmin, IsPowerUserOrAdmin, IsAdminInstallMode,
     NeedPassword, NeedSerial, NeedsRestart, RestartSystem, IsWinDark, IsDarkInstallMode,
-    IsUninstaller, AllowUninstallerShutdown, AcceptedQueryEndSessionInProgress: Boolean;
+    IsUninstaller, AllowUninstallerShutdown, AcceptedQueryEndSessionInProgress,
+    CustomWizardBackground: Boolean;
   InstallDefaultDisableFsRedir, ScriptFuncDisableFsRedir: Boolean;
   InstallDefaultRegView: TRegView = rvDefault;
   HasCustomType, HasComponents, HasTasks: Boolean;
@@ -243,9 +244,9 @@ implementation
 
 uses
   ShellAPI, ShlObj, StrUtils, ActiveX, RegStr, Imaging.pngimage, Themes,
-  ChaCha20, ECDSA, ISSigFunc, BidiCtrls,
+  ChaCha20, ECDSA, ISSigFunc, BidiCtrls, PathFunc, FormBackgroundStyleHook,
   SetupLdrAndSetup.Messages, Shared.SetupMessageIDs, Setup.DownloadFileFunc, Setup.ExtractFileFunc,
-  SetupLdrAndSetup.InstFunc, Setup.InstFunc, Setup.RedirFunc, PathFunc, FormBackgroundStyleHook,
+  SetupLdrAndSetup.InstFunc, Setup.InstFunc, Setup.RedirFunc,
   Compression.Base, Compression.Zlib, Compression.bzlib, Compression.LZMADecompressor,
   Shared.SetupEntFunc, Shared.EncryptionFunc,  Setup.SelectLanguageForm,
   Setup.WizardForm, Setup.DebugClient, Shared.VerInfoFunc, Setup.FileExtractor,
@@ -3327,6 +3328,7 @@ begin
         if IsDynamicDark then begin
           SetupHeader.WizardImageBackColor := SetupHeader.WizardImageBackColorDynamicDark;
           SetupHeader.WizardSmallImageBackColor := SetupHeader.WizardSmallImageBackColorDynamicDark;
+          SetupHeader.WizardBackColor := SetupHeader.WizardBackColorDynamicDark;
           MainIconPostfix := '_DARK';
           WantWizardImagesDynamicDark := True; { Handled below }
         end;
@@ -3351,7 +3353,11 @@ begin
             TStyleManager.SetStyle(Handle);
             if not IsDarkInstallMode and (shWizardLightButtonsUnstyled in SetupHeader.Options) then
               TNewButton.DontStyle := True;
-            TCustomStyleEngine.RegisterStyleHook(TSetupForm, TFormBackgroundStyleHook);
+            CustomWizardBackground := SetupHeader.WizardBackColor <> clNone;
+            if CustomWizardBackground then begin
+              TCustomStyleEngine.RegisterStyleHook(TSetupForm, TFormBackgroundStyleHook);
+              TFormBackgroundStyleHook.BackColor := SetupHeader.WizardBackColor;
+            end;
           end;
         end;
 

+ 2 - 1
Projects/Src/Setup.SelectLanguageForm.pas

@@ -94,7 +94,8 @@ constructor TSelectLanguageForm.Create(AOwner: TComponent);
 begin
   inherited;
 
-  MainPanel.ParentBackground := False;
+  if not CustomWizardBackground then
+    MainPanel.ParentBackground := False;
 
   InitializeFont(False, True);
 

+ 11 - 8
Projects/Src/Setup.TaskDialogForm.pas

@@ -132,14 +132,17 @@ begin
     KeepSizeY: UpdateHeight will set height }
   InitializeFont(True, True);
 
-  var LStyle := StyleServices(Self);
-  if not LStyle.Enabled or LStyle.IsSystemStyle then
-    LStyle := nil;
-  if LStyle <> nil then begin
-    { Make MainPanel look the same as WizardForm's main area }
-    MainPanel.StyleElements := [];
-    MainPanel.Color := LStyle.GetStyleColor(scWindow);
-  end;
+  if not CustomWizardBackground then begin
+   var LStyle := StyleServices(Self);
+    if not LStyle.Enabled or LStyle.IsSystemStyle then
+      LStyle := nil;
+    if LStyle <> nil then begin
+      { Make MainPanel look the same as WizardForm's main area }
+      MainPanel.StyleElements := [];
+      MainPanel.Color := LStyle.GetStyleColor(scWindow);
+    end;
+  end else
+    MainPanel.ParentBackground := True;
 
   const Pad = 10;
   const PadX = ScalePixelsX(Pad);

+ 27 - 8
Projects/Src/Setup.WizardForm.pas

@@ -784,7 +784,8 @@ begin
   if not LStyle.Enabled or LStyle.IsSystemStyle then
     LStyle := nil;
 
-  MainPanel.ParentBackground := False;
+  if not CustomWizardBackground then
+    MainPanel.ParentBackground := False;
 
   InitializeFont;
   SetFontNameSize(WelcomeLabel1.Font, LangOptions.WelcomeFontName,
@@ -822,16 +823,28 @@ begin
   BackButton.Left := X;
 
   { Initialize wizard style - also see TUninstallProgressForm.Initialize and TTaskDialogForm.Create }
-  if LStyle <> nil then begin
-    { TNewNotebook(Page) ignores VCL Styles so it needs a bit of help }
-    WelcomePage.ParentColor := True;
-    OuterNotebook.ParentColor := True;
-    FinishedPage.ParentColor := True;
-    Color := LStyle.GetStyleColor(scWindow);
+  if not CustomWizardBackground then begin
+    if LStyle <> nil then begin
+      { TNewNotebook(Page) ignores VCL Styles so it needs a bit of help }
+      WelcomePage.ParentColor := True;
+      OuterNotebook.ParentColor := True;
+      FinishedPage.ParentColor := True;
+      Color := LStyle.GetStyleColor(scWindow);
+    end;
+  end else begin
+    OuterNotebook.ParentBackground := True;
+    for I := 0 to OuterNotebook.PageCount-1 do
+      OuterNotebook.Pages[I].ParentBackground := True;
+    InnerNotebook.ParentBackground := True;
+    for I := 0 to InnerNotebook.PageCount-1 do
+      InnerNotebook.Pages[I].ParentBackground := True;
   end;
   if shWizardModern in SetupHeader.Options then begin
-    if LStyle = nil then
+    if LStyle = nil then begin
+      if CustomWizardBackground then
+        InternalError('Unexpected CustomWizardBackground value');
       OuterNotebook.Color := clWindow;
+    end;
     Bevel1.Visible := False;
   end;
 
@@ -1086,6 +1099,11 @@ begin
   else
     BeveledLabel.Caption := '';
   BeveledLabel.Top := Bevel.Top - ((BeveledLabel.Height - 1) div 2);
+  if not CustomWizardBackground then begin
+    if LStyle <> nil then
+      BeveledLabel.Color := LStyle.GetStyleColor(scWindow)
+  end else
+    BeveledLabel.Color := SetupHeader.WizardBackColor;
 
   { Don't set UseRichEdit to True on the TRichEditViewers unless they are going
     to be used. There's no need to load riched*.dll unnecessarily. }
@@ -1388,6 +1406,7 @@ begin
     controls placed on the page. Also see TSetupForm.CreateWnd.  }
   NotebookPage.SetCurrentPPI(InnerNotebook.CurrentPPI);
   NotebookPage.Notebook := InnerNotebook;
+  NotebookPage.ParentBackground := InnerNotebook.ParentBackground;
   NotebookPage.HandleNeeded; { See TSetupForm.InitializeFont comment }
   APage.FID := FNextPageID;
   APage.FOuterNotebookPage := InnerPage;

+ 2 - 0
Projects/Src/Shared.SetupSectionDirectives.pas

@@ -169,6 +169,8 @@ type
     ssWindowShowCaption,
     ssWindowStartMaximized,
     ssWindowVisible,
+    ssWizardBackColor,
+    ssWizardBackColorDynamicDark,
     ssWizardImageAlphaFormat,
     ssWizardImageBackColor,
     ssWizardImageBackColorDynamicDark,

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

@@ -33,7 +33,7 @@ const
     this file it's recommended you change SetupID. Any change will do (like
     changing the letters or numbers), as long as your format is
     unrecognizable by the standard Inno Setup. }
-  SetupID: TSetupID = 'Inno Setup Setup Data (6.6.0)';
+  SetupID: TSetupID = 'Inno Setup Setup Data (6.6.1)';
   UninstallLogID: array[Boolean] of TUninstallLogID =
     ('Inno Setup Uninstall Log (b)', 'Inno Setup Uninstall Log (b) 64-bit');
   MessagesHdrID: TMessagesHdrID = 'Inno Setup Messages (6.5.0) (u)';
@@ -120,8 +120,8 @@ type
     WizardSizePercentX, WizardSizePercentY: Integer;
     WizardDarkStyle: TSetupWizardDarkStyle;
     WizardImageAlphaFormat: (afIgnored, afDefined, afPremultiplied); // Must be same as Graphics.TAlphaFormat
-    WizardImageBackColor, WizardSmallImageBackColor: LongInt;
-    WizardImageBackColorDynamicDark, WizardSmallImageBackColorDynamicDark: LongInt;
+    WizardImageBackColor, WizardSmallImageBackColor, WizardBackColor: LongInt;
+    WizardImageBackColorDynamicDark, WizardSmallImageBackColorDynamicDark, WizardBackColorDynamicDark: LongInt;
     ExtraDiskSpaceRequired: Int64;
     SlicesPerDisk: Integer;
     UninstallLogMode: (lmAppend, lmNew, lmOverwrite);