Skip to content
This repository has been archived by the owner on Dec 18, 2022. It is now read-only.

Commit

Permalink
Replace Audacity branding in Innosetup, support HiDPI
Browse files Browse the repository at this point in the history
Reference-to: https://github.com/tenacityteam/tenacity/issues/502
Signed-off-by: Lucas Fugmann <lucas@fugi.dev>
  • Loading branch information
FugiMuffi authored and Sol Fisher Romanoff committed Aug 27, 2021
1 parent 9d1f522 commit 3d826b0
Show file tree
Hide file tree
Showing 10 changed files with 47 additions and 3 deletions.
50 changes: 47 additions & 3 deletions win/Inno_Setup_Wizard/tenacity.iss.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; Tenacity: A Digital Audio Editor
; Tenacity: A Digital Audio Editor
; Tenacity(R) is copyright (c) 1999-2021 Tenacity Team.
; License: GPL v2. See License.txt.
;
Expand All @@ -25,8 +25,9 @@ Filename: "{app}\unins*.*";
; compiler-related directives
OutputBaseFilename=tenacity-win-{#AppVersion}-@INSTALLER_SUFFIX@

WizardImageFile=".\tenacity_InnoWizardImage.bmp"
WizardSmallImageFile=".\tenacity_InnoWizardSmallImage.bmp"
; Use 100% images by default
WizardImageFile=".\tenacity_InnoWizardImage_100.bmp"
WizardSmallImageFile=".\tenacity_InnoWizardSmallImage_100.bmp"

SolidCompression=yes

Expand Down Expand Up @@ -114,6 +115,49 @@ Source: "Package\nyquist\*"; DestDir: "{app}\Nyquist\"; Flags: ignoreversion rec
Source: "Package\plug-ins\*"; DestDir: "{app}\Plug-Ins\"; Flags: ignoreversion
Source: "Package\modules\*"; DestDir: "{app}\modules\"; Flags: ignoreversion recursesubdirs

; Include scaled WizardImages
Source: "tenacity_InnoWizardImage_*.bmp"; Excludes: "*100.bmp"; Flags: dontcopy
Source: "tenacity_InnoWizardSmallImage_*.bmp"; Excludes: "*100.bmp"; Flags: dontcopy

; load images based on monitor scale
; by Martin Prikryl (CC BY-SA 3.0)
; https://stackoverflow.com/a/31003152/13384771

[Code]

function GetScalingFactor: Integer;
begin
if WizardForm.Font.PixelsPerInch >= 192 then Result := 200
else
if WizardForm.Font.PixelsPerInch >= 144 then Result := 150
else
if WizardForm.Font.PixelsPerInch >= 120 then Result := 125
else Result := 100;
end;

procedure LoadEmbededScaledBitmap(Image: TBitmapImage; NameBase: string);
var
Name: String;
FileName: String;
begin
Name := Format('%s_%d.bmp', [NameBase, GetScalingFactor]);
ExtractTemporaryFile(Name);
FileName := ExpandConstant('{tmp}\' + Name);
Image.Bitmap.LoadFromFile(FileName);
DeleteFile(FileName);
end;

procedure InitializeWizard;
begin
{ If using larger scaling, load the correct size of images }
if GetScalingFactor > 100 then
begin
LoadEmbededScaledBitmap(WizardForm.WizardBitmapImage, 'tenacity_InnoWizardImage');
LoadEmbededScaledBitmap(WizardForm.WizardBitmapImage2, 'tenacity_InnoWizardImage');
LoadEmbededScaledBitmap(WizardForm.WizardSmallBitmapImage, 'tenacity_InnoWizardSmallImage');
end;
end;

[Icons]
Name: "{commonprograms}\Tenacity"; Filename: "{app}\tenacity.exe"
Name: "{commondesktop}\Tenacity"; Filename: "{app}\tenacity.exe"; Tasks: desktopicon
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit 3d826b0

Please sign in to comment.