unit uMissingImages;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ComCtrls, ExtCtrls, ImgList, Buttons, IniFiles,
  GR32_Image;

type
  TFormMissingImages = class(TForm)
    ImageTypeSelector: TComboBoxEx;
    SettingsList: TListView;
    IL_Settings: TImageList;
    ButtonDefault: TButton;
    ButtonStart: TButton;
    ButtonClose: TButton;
    LabelFeatureDescription: TLabel;
    TopImage: TImage32;
    procedure ImageTypeSelectorSelect(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure ButtonDefaultClick(Sender: TObject);
    procedure ButtonCloseClick(Sender: TObject);
    procedure ButtonStartClick(Sender: TObject);
  private
    { Private declarations }
  public
    MissingImagesList: THashedStringList;
    { Public declarations }
  end;

var
  FormMissingImages: TFormMissingImages;

implementation

uses uMain, uStatus, uCommon, uFilesUtil;

{$R *.dfm}

procedure TFormMissingImages.ImageTypeSelectorSelect(Sender: TObject);
begin
  ImageTypeSelector.Tag:= ImageTypeSelector.ItemsEx[ImageTypeSelector.ItemIndex].ImageIndex;
end;

procedure TFormMissingImages.FormShow(Sender: TObject);
begin
  FormMain.LoadTopBar(TopImage, 'images.png');
  FormMain.UpdateImageTypeDescriptionComboBoxEx(ImageTypeSelector);
  SetComboBoxEx(ImageTypeSelector, 1);
  ButtonDefault.Click;
end;

procedure TFormMissingImages.ButtonDefaultClick(Sender: TObject);
var
  Loop: ShortInt;
begin
  SettingsList.Items.BeginUpdate;
  for Loop:=0 to SettingsList.Items.Count-1 do
      SettingsList.Items[Loop].Checked:= True;
  SettingsList.Items.EndUpdate;
end;

procedure TFormMissingImages.ButtonCloseClick(Sender: TObject);
begin
  Close;
end;

procedure TFormMissingImages.ButtonStartClick(Sender: TObject);
begin
  if (not SettingsList.Items[1].Checked) and (not SettingsList.Items[2].Checked) then
     GenerateMessage('Warning', 'You need to select one type of files for scanning, either zipped or unzipped!', 2)
  else
     begin
       FormMain.ScanMissingImages(1, True);
       FormMain.ScanMissingImages(2);
       FormMain.ScanMissingImages(3);
       FormMain.ScanMissingImages(4);
       FormMain.ScanMissingImages(5);
       FormMain.ScanMissingImages(6, False, True);
     end;
end;

end.
