/*===========================================================================
 *
 * File:	Dfexport3dsdialog.CPP
 * Author:	Dave Humphrey (uesp@m0use.net)
 * Created On:	Monday, March 25, 2002
 *
 * Implements the CDfExport3dsDialog for handling a simple dialog displayed
 * when exporting multiple 3DS files.
 *
 *=========================================================================*/

	/* Include Files */
#include "stdafx.h"
#include "dfto3ds.h"
#include "DfExport3dsDialog.h"


/*===========================================================================
 *
 * Begin Local Variable Definition
 *=========================================================================*/

  #ifdef _DEBUG
    #define new DEBUG_NEW
    #undef THIS_FILE
    static char THIS_FILE[] = __FILE__;
  #endif

/*===========================================================================
 *		End of Local Variable Definitions
 *=========================================================================*/


/*===========================================================================
 *
 * Class CDfExport3dsDialog Message Map
 *
 *=========================================================================*/
BEGIN_MESSAGE_MAP(CDfExport3dsDialog, CDialog)
  //{{AFX_MSG_MAP(CDfExport3dsDialog)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/*===========================================================================
 *		End of Class CDfExport3dsDialog Message Map
 *=========================================================================*/



/*===========================================================================
 *
 * Class CDfExport3dsDialog Constructor
 *
 *=========================================================================*/
CDfExport3dsDialog::CDfExport3dsDialog(CWnd* pParent)
	: CDialog(CDfExport3dsDialog::IDD, pParent) {
  //{{AFX_DATA_INIT(CDfExport3dsDialog)
  //}}AFX_DATA_INIT
  m_NumExportFiles = 1;
 }
/*===========================================================================
 *		End of Class CDfExport3dsDialog Constructor
 *=========================================================================*/


/*===========================================================================
 *
 * Class CDfExport3dsDialog Method - void DoDataExchange (pDX);
 *
 *=========================================================================*/
void CDfExport3dsDialog::DoDataExchange(CDataExchange* pDX) {
  CDialog::DoDataExchange(pDX);

  //{{AFX_DATA_MAP(CDfExport3dsDialog)
  DDX_Control(pDX, IDCANCEL, m_CancelButton);
  DDX_Control(pDX, IDC_EXPORT_LABEL, m_ExportLabel);
  DDX_Control(pDX, IDC_EXPORT3DS_PROGRESS, m_ExportProgress);
  //}}AFX_DATA_MAP
 }
/*===========================================================================
 *		End of Class Method CDfExport3dsDialog::DoDataExchange()
 *=========================================================================*/


/*===========================================================================
 *
 * Class CDfExport3dsDialog Method - void InitDialog (NumExportFiles);
 *
 * Initialize the dialog with the total number of 3DS files we are exporting.
 *
 *=========================================================================*/
void CDfExport3dsDialog::InitDialog (const int NumExportFiles) {
  m_NumExportFiles = NumExportFiles;
 }
/*===========================================================================
 *		End of Class Method CDfExport3dsDialog::InitDialog()
 *=========================================================================*/


/*===========================================================================
 *
 * Class CDfExport3dsDialog Method - 
 *		int UpdateProgress (pFilename, NumExported, NumFailed);
 *
 * Updates the displayed dialog box with the given information.  Returns
 * a negative value if the user has pressed the Cancel button.
 *
 *=========================================================================*/
int CDfExport3dsDialog::UpdateProgress (const char* pFilename, const int NumExported, const int NumFailed) {
  char Buffer[512];

  snprintf (Buffer, 512, "Exporting Object %d of %d\r\nFile: %s\r\n%d Exports Failed!", NumExported, m_NumExportFiles, pFilename, NumFailed);
  m_ExportLabel.SetWindowText(Buffer);
  m_ExportProgress.SetPos(NumExported);
  m_ExportLabel.RedrawWindow();
  m_ExportProgress.RedrawWindow();
  m_CancelButton.RedrawWindow();
  
  //MessageBox("Export", "Caption", MB_OK);
  return (0);
 }
/*===========================================================================
 *		End of Class Method CDfExport3dsDialog::UpdateProgress()
 *=========================================================================*/


/*===========================================================================
 *
 * Class CDfExport3dsDialog Event - BOOL OnInitDialog ();
 *
 *=========================================================================*/
BOOL CDfExport3dsDialog::OnInitDialog() {

	/* Call the base class method first */
  CDialog::OnInitDialog();
	
  m_ExportProgress.SetRange(0, m_NumExportFiles);
  return (TRUE);
 }
/*===========================================================================
 *		End of Class Event CDfExport3dsDialog::OnInitDialog()
 *=========================================================================*/


/*===========================================================================
 *
 * Class CDfExport3dsDialog Event - void OnCancel ();
 *
 *=========================================================================*/
void CDfExport3dsDialog::OnCancel() {
  CDialog::OnCancel();
 }
/*===========================================================================
 *		End of Class Event CDfExport3dsDialog::OnCancel()
 *=========================================================================*/