build/windows: Add dark mode on .exe Installer thanks to Inno 6.6.0

This reverts f9ba3435
This commit is contained in:
Bruno Lopes 2025-09-28 16:24:25 -03:00
parent 6f6329744d
commit 5cfcc9608b
No known key found for this signature in database
5 changed files with 28 additions and 47 deletions

View file

@ -26,7 +26,7 @@ Write-Output "$([char]27)[0Ksection_start:$(Get-Date -UFormat %s -Millisecond 0)
## Install or Update Inno (if needed)
## (We need to ensure that TLS 1.2 is enabled because of some runners)
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Invoke-WebRequest https://files.jrsoftware.org/is/6/innosetup-6.5.4.exe -OutFile ..\is.exe
Invoke-WebRequest https://jrsoftware.org/download.php/is.exe -OutFile ..\is.exe
$inno_version_downloaded = (Get-Item ..\is.exe).VersionInfo.ProductVersion -replace ' ',''
$broken_inno = Get-ChildItem $env:TMP -Filter *.isl.bak -ErrorAction SilentlyContinue
$inno_version = Get-ItemProperty Registry::'HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Uninstall\Inno Setup*' -ErrorAction SilentlyContinue | Select-Object -ExpandProperty DisplayVersion

View file

@ -246,17 +246,18 @@ ChangesEnvironment=yes
AlwaysShowDirOnReadyPage=yes
;3.4.2 INSTALLER UI: uses modern Win32 "Vista" (still used today) design
WizardStyle=modern
WizardStyle=modern dynamic
WizardSizePercent=100
WizardResizable=no
WizardImageAlphaFormat=defined
WizardSmallImageFile={#WIZARD_SMALL_IMAGE}
WizardSmallImageFileDynamicDark={#WIZARD_SMALL_IMAGE}
WizardImageFile={#WIZARD_IMAGE}
WizardImageFileDynamicDark={#WIZARD_IMAGE}
WizardImageStretch=yes
WizardKeepAspectRatio=no
[LangOptions]
DialogFontName=Segoe UI
DialogFontSize=9
WelcomeFontName=Segoe UI
DialogFontBaseScaleHeight=13
DialogFontBaseScaleWidth=6
WelcomeFontSize=12
;3.4.1 INSTALLER PAGES AGAIN
@ -1038,7 +1039,9 @@ end;
//2. LICENSE
procedure InfoBeforeLikeLicense();
begin
WizardForm.Bevel.Visible := False;
if not IsDarkInstallMode then begin
WizardForm.Bevel.Visible := False;
end;
WizardForm.InfoBeforeClickLabel.Visible := False;
WizardForm.InfoBeforeMemo.Height := WizardForm.InfoBeforeMemo.Height + WizardForm.InfoBeforeMemo.Top - WizardForm.InfoBeforeClickLabel.Top;
@ -1046,39 +1049,8 @@ begin
end;
//3. INSTALL DIR: override Inno custom dir icon
procedure NativeDirIcon();
var TypRect: TRect;
Icon: THandle;
IconSize: Integer;
begin
WizardForm.SelectDirBitmapImage.Visible := False;
//3. INSTALL DIR (no customizations)
Icon := ExtractIcon(0,'imageres.dll',3)
with TBitmapImage.Create(WizardForm.SelectDirPage) do begin
Parent := WizardForm.SelectDirPage;
with Bitmap do begin
Left := 0;
Top := 0;
AutoSize := True;
Center := True;
Width := ScaleY(32);
Height := ScaleY(32);
Canvas.FillRect(TypRect);
if WizardForm.Font.PixelsPerInch >= 168 then begin //175% scaling
IconSize := 64;
end else if WizardForm.Font.PixelsPerInch >= 144 then begin //150% scaling
IconSize := 48;
end else if WizardForm.Font.PixelsPerInch >= 120 then begin //125% scaling
IconSize := 32;
end else begin //100% scaling
IconSize := 32;
end;
DrawIconEx(Canvas.Handle, 0, 0, Icon, IconSize, IconSize, 0, 0, DI_NORMAL);
end;
end;
end;
//4. COMPONENTS: Add panel with description on click, to the right of the list
var
@ -1262,7 +1234,9 @@ end;
//7.1 BEFORE INSTALL
procedure PreparingFaceLift();
begin
WizardForm.Bevel.Visible := False;
if not IsDarkInstallMode then begin
WizardForm.Bevel.Visible := False;
end;
end;
//Create restore point
@ -1673,7 +1647,9 @@ end;
procedure InstallingFaceLift();
var lblMessage1,lblURL,lblMessage2: TLabel; //TNewStaticText doesn't support alignment
begin
WizardForm.Bevel.Visible := False;
if not IsDarkInstallMode then begin
WizardForm.Bevel.Visible := False;
end;
with WizardForm.ProgressGauge do
begin
@ -1933,7 +1909,6 @@ procedure InitializeWizard();
begin
UpdateWizardImages();
InitCustomPages();
NativeDirIcon();
end;
function ShouldSkipPage(pPageID: Integer): Boolean;

View file

@ -226,7 +226,7 @@ begin
AutoSize := True;
Bitmap.Width := GetSystemMetrics(SM_CXICON);
Bitmap.Height := GetSystemMetrics(SM_CYICON);
Bitmap.Canvas.Brush.Color := TPanel(Parent).Color;
Bitmap.Canvas.Brush.Color := GetThemedBgColor;
Bitmap.Canvas.FillRect(TypRect);
DrawIcon(Bitmap.Canvas.Handle,0,0,Icon); //draws icon scaled
//DrawIconEx(Bitmap.Canvas.Handle,0,0,Icon,0,0,0,0,DI_NORMAL {or DI_DEFAULTSIZE}); //draws icon without scaling
@ -285,7 +285,7 @@ begin
Blank.Top := 0;
Blank.Right := Width;
Blank.Bottom := Height;
Bitmap.Canvas.Brush.Color := TPanel(Parent).Color;
Bitmap.Canvas.Brush.Color := GetThemedBgColor;
Bitmap.Canvas.FillRect(Blank);
end;
end;
@ -445,7 +445,7 @@ begin
exit;
end;
MessageForm := CreateCustomForm();
MessageForm := CreateCustomForm(ScaleX(256), ScaleY(128), False, True);
MessageForm.Caption := Title;
if (CancelButton = 0) or (CancelButton > GetArrayLength(ButtonText)) then //no cancel button - remove close button

View file

@ -174,4 +174,10 @@ begin
end;
end;
function GetThemedBgColor: TColor;
begin
if IsDarkInstallMode then
Result := $2b2b2b
else
Result := $ffffff;
end;

View file

@ -106,7 +106,7 @@ end;
procedure CreateMessageForm(var frmMessage: TForm; const pMessage: String);
var lblMessage: TNewStaticText;
begin
frmMessage := CreateCustomForm();
frmMessage := CreateCustomForm(ScaleX(256), ScaleY(128), False, True);
with frmMessage do
begin
BorderStyle := bsDialog;