Prechádzať zdrojové kódy

Rename the Images.res' icons back to 'image' so it's clear they're not full icons. Also add uninstall image and show it as the uninstall wizard image. To do: make this happen only if SetupIcon is not set (by removing the icon image at compile time).

Martijn Laan 4 rokov pred
rodič
commit
43671648e1

+ 15 - 9
Components/BitmapImage.pas

@@ -42,7 +42,7 @@ type
     constructor Create(AOwner: TComponent); override;
     constructor Create(AOwner: TComponent); override;
     destructor Destroy; override;
     destructor Destroy; override;
     procedure InitializeFromIcon(const Icon: TIcon; const BkColor: TColor); overload;
     procedure InitializeFromIcon(const Icon: TIcon; const BkColor: TColor); overload;
-    procedure InitializeFromIcon(const hInstance: HINST; const ResourceName: PChar; const BkColor: TColor); overload;
+    function InitializeFromIcon(const hInstance: HINST; const ResourceName: PChar; const BkColor: TColor): Boolean; overload;
   published
   published
     property Align;
     property Align;
     property Anchors;
     property Anchors;
@@ -96,17 +96,23 @@ begin
   Bitmap.Canvas.Draw(0, 0, Icon);
   Bitmap.Canvas.Draw(0, 0, Icon);
 end;
 end;
 
 
-procedure TBitmapImage.InitializeFromIcon(const hInstance: HINST; const ResourceName: PChar; const BkColor: TColor);
+function TBitmapImage.InitializeFromIcon(const hInstance: HINST; const ResourceName: PChar; const BkColor: TColor): Boolean;
 var
 var
+  Handle: THandle;
   Icon: TIcon;
   Icon: TIcon;
 begin
 begin
-  Icon := TIcon.Create;
-  try
-    Icon.Handle := LoadImage(hInstance, ResourceName, IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR);
-    InitializeFromIcon(Icon, BkColor);
-  finally
-    Icon.Free;
-  end;
+  Handle := LoadImage(hInstance, ResourceName, IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR);
+  if Handle <> 0 then begin
+    Icon := TIcon.Create;
+    try
+      Icon.Handle := Handle;
+      InitializeFromIcon(Icon, BkColor);
+      Result := True;
+    finally
+      Icon.Free;
+    end;
+  end else
+    Result := False;
 end;
 end;
 
 
 constructor TBitmapImage.Create(AOwner: TComponent);
 constructor TBitmapImage.Create(AOwner: TComponent);

BIN
Projects/Images.res


+ 1 - 1
Projects/NewDisk.pas

@@ -80,7 +80,7 @@ begin
   OKButton.Caption := SetupMessages[msgButtonOK];
   OKButton.Caption := SetupMessages[msgButtonOK];
   CancelButton.Caption := SetupMessages[msgButtonCancel];
   CancelButton.Caption := SetupMessages[msgButtonCancel];
 
 
-  DiskBitmapImage.InitializeFromIcon(HInstance, 'Z_DISKICON', Color); {don't localize}
+  DiskBitmapImage.InitializeFromIcon(HInstance, 'Z_DISKIMAGE', Color); {don't localize}
 
 
   TryEnableAutoCompleteFileSystem(PathEdit.Handle);
   TryEnableAutoCompleteFileSystem(PathEdit.Handle);
 
 

BIN
Projects/Setup.res


BIN
Projects/SetupLdr.res


+ 2 - 1
Projects/UninstProgressForm.pas

@@ -112,7 +112,8 @@ begin
 
 
   PageNameLabel.Font.Style := [fsBold];
   PageNameLabel.Font.Style := [fsBold];
   PageNameLabel.Caption := SetupMessages[msgWizardUninstalling];
   PageNameLabel.Caption := SetupMessages[msgWizardUninstalling];
-  WizardSmallBitmapImage.InitializeFromIcon(Application.Icon, MainPanel.Color);
+  if not WizardSmallBitmapImage.InitializeFromIcon(HInstance, 'Z_UNINSTALLIMAGE', MainPanel.Color) then {don't localize}
+    WizardSmallBitmapImage.InitializeFromIcon(Application.Icon, MainPanel.Color);
   if SetupMessages[msgBeveledLabel] <> '' then begin
   if SetupMessages[msgBeveledLabel] <> '' then begin
     BeveledLabel.Caption := ' ' + SetupMessages[msgBeveledLabel] + ' ';
     BeveledLabel.Caption := ' ' + SetupMessages[msgBeveledLabel] + ' ';
     BeveledLabel.Visible := True;
     BeveledLabel.Visible := True;

+ 3 - 3
Projects/Wizard.pas

@@ -871,9 +871,9 @@ begin
   WizardBitmapImage2.Stretch := (shWizardImageStretch in SetupHeader.Options);
   WizardBitmapImage2.Stretch := (shWizardImageStretch in SetupHeader.Options);
   WizardSmallBitmapImage.Bitmap := SelectBestImage(WizardSmallImages, WizardSmallBitmapImage.Width, WizardSmallBitmapImage.Height);
   WizardSmallBitmapImage.Bitmap := SelectBestImage(WizardSmallImages, WizardSmallBitmapImage.Width, WizardSmallBitmapImage.Height);
   WizardSmallBitmapImage.Stretch := (shWizardImageStretch in SetupHeader.Options);
   WizardSmallBitmapImage.Stretch := (shWizardImageStretch in SetupHeader.Options);
-  SelectDirBitmapImage.InitializeFromIcon(HInstance, 'Z_DIRICON', SelectDirPage.Color); {don't localize}
-  SelectGroupBitmapImage.InitializeFromIcon(HInstance, 'Z_GROUPICON', SelectProgramGroupPage.Color); {don't localize}
-  PreparingErrorBitmapImage.InitializeFromIcon(HInstance, 'Z_STOPICON', PreparingPage.Color); {don't localize}
+  SelectDirBitmapImage.InitializeFromIcon(HInstance, 'Z_DIRIMAGE', SelectDirPage.Color); {don't localize}
+  SelectGroupBitmapImage.InitializeFromIcon(HInstance, 'Z_GROUPIMAGE', SelectProgramGroupPage.Color); {don't localize}
+  PreparingErrorBitmapImage.InitializeFromIcon(HInstance, 'Z_STOPIMAGE', PreparingPage.Color); {don't localize}
 
 
   { Initialize wpWelcome page }
   { Initialize wpWelcome page }
   RegisterExistingPage(wpWelcome, WelcomePage, nil, '', '');
   RegisterExistingPage(wpWelcome, WelcomePage, nil, '', '');