|
|
@@ -1533,6 +1533,8 @@ const
|
|
|
|
|
|
var
|
|
|
ShowSponsor: Integer;
|
|
|
+ SponsoringLinkLabel, SponsorLinkLabel: TLabel;
|
|
|
+ SponsorImage: TBitmapImage;
|
|
|
|
|
|
procedure SponsorImageClick(Sender: TObject);
|
|
|
begin
|
|
|
@@ -1540,6 +1542,41 @@ begin
|
|
|
OpenBrowser('{#WebReport}?mode=sponsor' + Format('&sponsor=%s&', [Sponsor]) + ExpandConstant('{#WebArguments}'));
|
|
|
end;
|
|
|
|
|
|
+function GetSponsorAreaHeight: Integer;
|
|
|
+begin
|
|
|
+ Result := SponsorPage.SurfaceHeight - SponsorLinkLabel.Height - ScaleY(12);
|
|
|
+end;
|
|
|
+
|
|
|
+procedure CenterSponsorImage;
|
|
|
+begin
|
|
|
+ if (Extended(SponsorImage.Bitmap.Width) / SponsorPage.SurfaceWidth) <
|
|
|
+ (Extended(SponsorImage.Bitmap.Height) / GetSponsorAreaHeight()) then
|
|
|
+ begin
|
|
|
+ SponsorImage.Top := 0;
|
|
|
+ SponsorImage.Height := GetSponsorAreaHeight();
|
|
|
+ SponsorImage.Width :=
|
|
|
+ Trunc((Extended(SponsorImage.Bitmap.Width) / SponsorImage.Bitmap.Height) * SponsorImage.Height);
|
|
|
+ SponsorImage.Left := (SponsorPage.SurfaceWidth - SponsorImage.Width) div 2;
|
|
|
+ end
|
|
|
+ else
|
|
|
+ begin
|
|
|
+ SponsorImage.Left := 0;
|
|
|
+ SponsorImage.Width := SponsorPage.SurfaceWidth;
|
|
|
+ SponsorImage.Height :=
|
|
|
+ Trunc((Extended(SponsorImage.Bitmap.Height) / SponsorImage.Bitmap.Width) * SponsorImage.Width);
|
|
|
+ SponsorImage.Top := (GetSponsorAreaHeight() - SponsorImage.Height) div 2;
|
|
|
+ end;
|
|
|
+ SponsorLinkLabel.Left := SponsorImage.Left;
|
|
|
+ SponsorLinkLabel.Top := GetBottom(SponsorImage) + ScaleX(6);
|
|
|
+ SponsoringLinkLabel.Left := GetRight(SponsorImage) - SponsoringLinkLabel.Width;
|
|
|
+ SponsoringLinkLabel.Top := SponsorLinkLabel.Top;
|
|
|
+end;
|
|
|
+
|
|
|
+procedure WizardFormResize(Sender: TObject);
|
|
|
+begin
|
|
|
+ CenterSponsorImage;
|
|
|
+end;
|
|
|
+
|
|
|
function CheckSponsorReq: Boolean;
|
|
|
var
|
|
|
R, Succeeded: Integer;
|
|
|
@@ -1551,9 +1588,8 @@ var
|
|
|
Size: LongWord;
|
|
|
ZipPath, TargetPath, ImagePath: string;
|
|
|
Shell, ZipFile, TargetFolder: Variant;
|
|
|
- SponsorLinkLabel, SponsoringLinkLabel: TLabel;
|
|
|
- SponsorImage: TBitmapImage;
|
|
|
- ImageSize, GrayHeight: Integer;
|
|
|
+ SponsorArea: TBitmapImage;
|
|
|
+ ImageSize: Integer;
|
|
|
begin
|
|
|
if ShowSponsor = 0 then
|
|
|
begin
|
|
|
@@ -1581,17 +1617,28 @@ begin
|
|
|
begin
|
|
|
Log('Sponsor request succeeded');
|
|
|
|
|
|
+ if CmdLineParamExists('/SponsorArea') then
|
|
|
+ begin
|
|
|
+ SponsorArea := TBitmapImage.Create(SponsorPage);
|
|
|
+ SponsorArea.Parent := SponsorPage.Surface;
|
|
|
+ SponsorArea.Visible := CmdLineParamExists('/SponsorArea');
|
|
|
+ SponsorArea.BackColor := clTeal;
|
|
|
+ SponsorArea.Anchors := [akLeft, akTop, akRight, akBottom];
|
|
|
+ end
|
|
|
+ else
|
|
|
+ begin
|
|
|
+ SponsorArea := nil;
|
|
|
+ end;
|
|
|
+
|
|
|
SponsorLinkLabel := TLabel.Create(SponsorPage);
|
|
|
SponsorLinkLabel.Parent := SponsorPage.Surface;
|
|
|
SponsorLinkLabel.Caption := 'Visit release sponsor';
|
|
|
- SponsorLinkLabel.Top := SponsorPage.Surface.Height - SponsorLinkLabel.Height - ScaleY(2);
|
|
|
SponsorLinkLabel.OnClick := @SponsorImageClick;
|
|
|
LinkLabel(SponsorLinkLabel);
|
|
|
|
|
|
SponsoringLinkLabel := TLabel.Create(SponsorPage);
|
|
|
SponsoringLinkLabel.Parent := SponsorPage.Surface;
|
|
|
SponsoringLinkLabel.Caption := 'Become next release sponsor';
|
|
|
- SponsoringLinkLabel.Top := SponsorLinkLabel.Top;
|
|
|
SponsoringLinkLabel.OnClick := @SponsoringLinkLabelClick;
|
|
|
LinkLabel(SponsoringLinkLabel);
|
|
|
|
|
|
@@ -1686,9 +1733,9 @@ begin
|
|
|
|
|
|
SponsorImage := TBitmapImage.Create(SponsorPage);
|
|
|
SponsorImage.Parent := SponsorPage.Surface;
|
|
|
- SponsorImage.AutoSize := True;
|
|
|
SponsorImage.Hint := SponsorLinkLabel.Caption;
|
|
|
SponsorImage.ShowHint := True;
|
|
|
+ SponsorImage.Stretch := True;
|
|
|
try
|
|
|
LoadBitmap(SponsorImage, ImagePath, SponsorPage.Surface.Color);
|
|
|
except
|
|
|
@@ -1699,26 +1746,26 @@ begin
|
|
|
|
|
|
if ShowSponsor = 0 then
|
|
|
begin
|
|
|
- GrayHeight :=
|
|
|
- // Overal height of area between header and footer (InnerNotebook is smaller and not vertically centered)
|
|
|
- (WizardForm.Bevel.Top - (WizardForm.OuterNotebook.Top + GetBottom(WizardForm.Bevel1)))
|
|
|
- // Bottom padding of InnerNotebook
|
|
|
- - (WizardForm.Bevel.Top - GetBottom(WizardForm.InnerNotebook))
|
|
|
- // height occupied by link label on the bottom of InnerNotebook
|
|
|
- - SponsorLinkLabel.Height;
|
|
|
-
|
|
|
- SponsorImage.Top := ((GrayHeight - SponsorImage.Height) div 2) - (WizardForm.InnerNotebook.Top - GetBottom(WizardForm.Bevel1));
|
|
|
- if SponsorImage.Top < 0 then SponsorImage.Top := 0;
|
|
|
- SponsorImage.Left := (SponsorPage.Surface.Width - SponsorImage.Width) div 2;
|
|
|
- SponsorLinkLabel.Left := SponsorImage.Left;
|
|
|
- if SponsorLinkLabel.Left < 0 then SponsorLinkLabel.Left := 0;
|
|
|
- SponsoringLinkLabel.Left := GetRight(SponsorImage) - SponsoringLinkLabel.Width;
|
|
|
- if GetRight(SponsoringLinkLabel) > SponsorPage.Surface.Width then
|
|
|
- SponsoringLinkLabel.Left := SponsorPage.Surface.Width - SponsoringLinkLabel.Width;
|
|
|
+ if Assigned(SponsorArea) then
|
|
|
+ begin
|
|
|
+ SponsorArea.Left := 0;
|
|
|
+ SponsorArea.Top := 0;
|
|
|
+ SponsorArea.Width := SponsorPage.Surface.Width;
|
|
|
+ SponsorArea.Height := GetSponsorAreaHeight();
|
|
|
+ Log(Format('Sponsor area is %dx%d', [SponsorArea.Width, SponsorArea.Height]));
|
|
|
+ end;
|
|
|
+
|
|
|
+ CenterSponsorImage;
|
|
|
+
|
|
|
SponsorImage.Cursor := crHand;
|
|
|
SponsorImage.OnClick := @SponsorImageClick;
|
|
|
+
|
|
|
+ WizardForm.OnResize := @WizardFormResize;
|
|
|
+
|
|
|
FileSize(ImagePath, ImageSize);
|
|
|
- Log(Format('Sponsor image loaded (%d bytes, %dx%d)', [Integer(ImageSize), SponsorPage.Surface.Width, SponsorImage.Height]));
|
|
|
+ Log(Format('Sponsor image loaded (%d bytes, %dx%d) and displayed (%dx%d)', [
|
|
|
+ Integer(ImageSize), SponsorImage.Bitmap.Width, SponsorImage.Bitmap.Height,
|
|
|
+ SponsorImage.Width, SponsorImage.Height]));
|
|
|
end;
|
|
|
end
|
|
|
else
|