/**********************************************************************/
/*                                                                    */
/* File name: DLLAbout.cpp                                            */
/*                                                                    */
/* Since:     2002/12/03                                              */
/*                                                                    */
/* Version:   1.02                                                    */
/*                                                                    */
/* Author:    MONTAGNE Xavier [XM] {link xavier.montagne@wanadoo.fr}  */
/*                                                                    */
/* Purpose: Display a ABOUT Window showing the name of the DLL and    */
/*          the version number. Also display the main features of the */
/*          selected chip.                                            */
/*                                                                    */
/* Distribution: This file is part of PP18.                           */
/*               PP18 is free software; you can redistribute it       */
/*               and/or modify it under the terms of the GNU General  */
/*               Public License as published by the Free Software     */
/*               Foundation; either version 2, or (at your option)    */
/*               any later version.                                   */
/*                                                                    */
/*               PP18 is distributed in the hope that it will be      */
/*               useful, but WITHOUT ANY WARRANTY; without even the   */
/*               implied warranty of MERCHANTABILITY or FITNESS FOR A */
/*               PARTICULAR PURPOSE.  See the GNU General Public      */
/*               License for more details.                            */
/*                                                                    */
/*               You should have received a copy of the GNU General   */
/*               Public License along with PP18; see the file         */
/*               COPYING.txt. If not, write to the Free Software      */
/*               Foundation, 59 Temple Place - Suite 330,             */
/*               Boston, MA 02111-1307, USA.                          */
/*                                                                    */
/* History:                                                           */
/*      2002/12/03  [XM] Create this file                             */
/*                                                                    */
/**********************************************************************/

/***********************************************************************
 * INCLUDES
 **********************************************************************/
#include <vcl.h>
#include <vcl\Registry.hpp>

#include "DDLAbout.h"
#include "DLL_interface.h"
#pragma hdrstop

/***********************************************************************
 * Function prototypes.
 **********************************************************************/
extern "C" void DLLAboutWindow_Show(void);
extern unsigned int delay_IO;
extern unsigned int delay_Prog;
extern unsigned short LPT_adr_out;
extern unsigned short LPT_adr_in;
extern unsigned int IsLocked;

/***********************************************************************
 * Global variables.
 **********************************************************************/
#pragma package(smart_init)
#pragma resource "*.dfm"
TAboutWindow *AboutWindow;
TRegistry *regKey;

/***********************************************************************
 * Window constructor.
 *
 * @param  TComponent* Owner  IN  Parent object reference
 * @return none
 **********************************************************************/
__fastcall TAboutWindow::TAboutWindow(TComponent* Owner)
    : TForm(Owner)
{
}

/***********************************************************************
 * Response of the click event on the OK button.
 *
 * @param  TObject *Sender    IN  Caller object reference
 * @return void
 **********************************************************************/
void __fastcall TAboutWindow::ButtonOKClick(TObject *Sender)
{
  AboutWindow->Close();
}

/***********************************************************************
 * Build one instance of the TAboutWindow object.
 * Show the window into modal mode (the window captures the focus).
 *
 * @param  void
 * @return void
 **********************************************************************/
void DLLAboutWindow_Show(void)
{
  regKey = new TRegistry();
  regKey->OpenKey("\\Software\\PP18\\DLL\\Settings", false);
  Settings(PL_CLOCK, regKey->ReadInteger("CLOCK_MASK"), \
           regKey->ReadInteger("CLOCK_INV"));
  Settings(PL_DATA_TO_PIC, regKey->ReadInteger("DATA_TO_PIC_MASK"), \
           regKey->ReadInteger("DATA_TO_PIC_INV"));
  Settings(PL_VPP, regKey->ReadInteger("VPP_MASK"), \
           regKey->ReadInteger("VPP_INV"));
  Settings(PL_VCC, regKey->ReadInteger("VCC_MASK"), \
           regKey->ReadInteger("VCC_INV"));
  Settings(PL_DATA_FROM_PIC, regKey->ReadInteger("DATA_FROM_PIC_MASK"), \
           regKey->ReadInteger("DATA_FROM_PIC_INV"));

  delay_IO    = regKey->ReadInteger("DelayIO");
  delay_Prog  = regKey->ReadInteger("DelayProg");
  LPT_adr_out = regKey->ReadInteger("LPT_port_@");
  LPT_adr_in  = LPT_adr_out + 1;

  IsLocked = false;  

  if (AboutWindow == NULL)
    AboutWindow = new TAboutWindow(Application);
  AboutWindow->ShowModal();
}


/* End of file */

