
/***************************************************************************
**
**    $Header:   D:/ECB2S/SRC/LOG/SHLLOGDI.CPP   1.2.1.4   17 Apr 1997 15:58:58   ZJRD  $
**
**    $Log:   D:/ECB2S/SRC/LOG/SHLLOGDI.CPP  $
** 
**    Rev 1.2.1.4   17 Apr 1997 15:58:58   ZJRD
** No change.
** 
**    Rev 1.2.1.3   16 Apr 1997 10:30:48   ZJRD
** No change.
** 
**    Rev 1.2.1.2   10 Apr 1997 15:40:58   ZJRD
** No change.
** 
**    Rev 1.2.1.1   03 Apr 1997 15:19:38   ZJRD
** No change.
** 
**    Rev 1.2.1.0   28 Mar 1997 10:24:22   ZJRD
** easy pack sld 2.09d
** 
**    Rev 1.1   19 Mar 1997 11:34:24   ZJRD
** No change.
** 
**    Rev 1.0   12 Mar 1997 14:49:18   ZJRD
** Initial revision.
** 
**    Rev 1.7.1.0.1.2   09 Dec 1996 10:14:34   ZJRD
** EasyPack/SLD Version 2.0P
** 
**    Rev 1.7.1.0.1.0   11 Nov 1996 12:57:50   ZJRD
** EasyPack/SLD Version 2.01
** 
**    Rev 1.7.1.4   09 Sep 1996 13:14:24   ZJRD
** EasyPack/SLD Version 1.9f
** 
**    Rev 1.7.1.3   05 Sep 1996 11:25:56   ZJRD
** No change.
** 
**    Rev 1.7.1.2   02 Sep 1996 09:53:04   ZJRD
** No change.
** 
**    Rev 1.7.1.1   28 Aug 1996 15:45:50   ZJRD
** No change.
** 
**    Rev 1.7.1.0   12 Aug 1996 10:50:48   ZJRD
** EasyPack/SLD Version 1.98
** 
**    Rev 1.7   11 Jun 1996 10:28:38   ZJRD
** EasyPack/SLD Version 1.97
** 
**    Rev 1.5   05 Jun 1996 14:57:16   ZJRD
** No change.
** 
**    Rev 1.4   29 May 1996 09:37:58   ZJRD
** No change.
** 
**    Rev 1.3   16 May 1996 09:01:08   ZJRD
** No change.
** 
**    Rev 1.2   10 May 1996 09:15:24   ZJRD
** No change.
** 
**    Rev 1.1   02 May 1996 10:29:44   ZJRD
** EasyPack/SLD Version 1.92
** 
**    Rev 1.31   18 Apr 1996 13:02:08   Shirley
** No change.
** 
**    Rev 1.30   12 Apr 1996 10:41:02   Shirley
** EasyPack/SLD Version 1.90
** 
**    Rev 1.28   15 Feb 1996 08:56:04   Shirley
** No change.
** 
**    Rev 1.27   12 Feb 1996 14:07:20   Shirley
** No change.
** 
**    Rev 1.26   06 Feb 1996 15:33:48   Shirley
** No change.
** 
**    Rev 1.25   06 Feb 1996 13:47:42   Shirley
** No change.
** 
**    Rev 1.24   01 Feb 1996 10:18:58   Shirley
** EasyPack/SLD Version 0.35b
** 
**    Rev 1.23   26 Jan 1996 09:14:12   Shirley
** No change.
** 
**    Rev 1.22   25 Jan 1996 13:14:04   Shirley
** No change.
** 
**    Rev 1.21   24 Jan 1996 10:35:24   Shirley
** No change.
** 
**    Rev 1.20   23 Jan 1996 11:26:12   Shirley
** EasypPack/SLD Version 0.34c
** 
**    Rev 1.19   18 Jan 1996 10:14:50   Shirley
** No change.
** 
**    Rev 1.18   15 Jan 1996 16:16:56   Shirley
** No change.
** 
**    Rev 1.17   04 Jan 1996 11:14:02   Shirley
** EasyPack/SLD Version 0.34
** 
**    Rev 1.16   30 Nov 1995 09:14:18   Shirley
** No change.
** 
**    Rev 1.15   28 Nov 1995 15:33:12   Shirley
** No change.
** 
**    Rev 1.14   21 Nov 1995 11:19:06   Shirley
** No change.
** 
**    Rev 1.13   13 Nov 1995 09:21:48   Shirley
** No change.
** 
**    Rev 1.12   12 Nov 1995 11:33:24   Shirley
** No change.
** 
**    Rev 1.11   08 Nov 1995 16:29:54   Shirley
** No change.
** 
**    Rev 1.10   08 Nov 1995 12:44:00   Shirley
** No change.
** 
**    Rev 1.9   02 Nov 1995 10:04:56   Shirley
** No change.
** 
**    Rev 1.8   27 Oct 1995 16:47:50   Shirley
** No change.
** 
**    Rev 1.7   27 Oct 1995 13:45:52   Shirley
** No change.
** 
**    Rev 1.6   25 Oct 1995 14:27:26   Shirley
** No change.
** 
**    Rev 1.5   18 Oct 1995 14:51:36   Shirley
** No change.
** 
**    Rev 1.4   13 Oct 1995 13:21:14   Shirley
** No change.
** 
**    Rev 1.3   29 Sep 1995 09:49:12   Shirley
** No change.
** 
**    Rev 1.2   20 Sep 1995 10:53:10   Shirley
** No change.
** 
**    Rev 1.1   15 Sep 1995 09:47:52   Shirley
** No change.
** 
**    Rev 1.0   07 Sep 1995 09:54:20   Shirley
** Initial revision.
**
****************************************************************************/

/////////////////////////////////////////////////////////////////////////////
//
//  File name:  SHLLOGDI.CPP
//
//  Description:The implement file for the class: CLogDialog
//
//  Author:     Roger Zhang
//
//  Date:       04/24/95
//
//  Modification:
//
//      1. 04/24/95, Initial version 
//
//
//  Copyright (C) 1995 Microtek International. All rights reserved.
//
/////////////////////////////////////////////////////////////////////////////

#include "stdafx.h"

#include "shlcom.h"
#include "resource.h"
#include "shllogdi.h"       
#include "uicom.h"

#ifdef _DEBUG
#undef THIS_FILE
static char BASED_CODE THIS_FILE[] = __FILE__;
#endif
    
/////////////////////////////////////////////////////////////////////////////
static char BASED_CODE szFilter[] = 
    "Log Files(*.log)|*.log|Command Files(*.cmd)|*.cmd"
    "|All Files(*.*)|*.*||";    

char pchTitle[50];
    
/////////////////////////////////////////////////////////////////////////////
// CLogDialog dialog

/////////////////////////////////////////////////////////////////////////////
//
//  Name:   
//
//  Description: 
//
//  Input:  
//
//  Output: 
//
//  Return: 
//
/////////////////////////////////////////////////////////////////////////////
CLogDialog::CLogDialog(void)
: CFileDialog(TRUE, NULL, "*.log", 
  OFN_ENABLETEMPLATE | OFN_HIDEREADONLY, szFilter, NULL)
{                  
    //m_ofn.lpstrTitle = "Open Log File"; 
    //char pchTitle[256];
    //ErrGetErrorText(ER_SHL_OPEN_LOG_FILE, pchTitle);   	
    //strcpy(m_ofn.lpstrTitle, pchTitle);          
    //m_ofn.lpstrTitle = pchTitle;          

	HINSTANCE  hInst = AfxGetInstanceHandle();
	m_ofn.hInstance	= hInst;
	m_ofn.lpTemplateName = (LPCSTR)IDD_LOG;		    
    m_nIDHelp = IDD_OPEN_LOGFILE;
    
    //{{AFX_DATA_INIT(CLogDialog)
    m_nAppend = TstGetLogAppend();
    m_nCommand = TstGetLogCommand();
//	m_nAppend = 0;
//	m_nCommand = 1;
	//}}AFX_DATA_INIT
}

/////////////////////////////////////////////////////////////////////////////
//
//  Name:   
//
//  Description: 
//
//  Input:  
//
//  Output: 
//
//  Return: 
//
/////////////////////////////////////////////////////////////////////////////
void CLogDialog::DoDataExchange(CDataExchange* pDX)
{
    CDialog::DoDataExchange(pDX);
    //{{AFX_DATA_MAP(CLogDialog)
	DDX_Control(pDX, IDC_COMMAND, m_btnCommand);
	DDX_Control(pDX, IDC_APPEND, m_btnAppend);
	DDX_Radio(pDX, IDC_APPEND, m_nAppend);
	DDX_Radio(pDX, IDC_COMMAND, m_nCommand);
	//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CLogDialog, CFileDialog)
    //{{AFX_MSG_MAP(CLogDialog)
    //}}AFX_MSG_MAP
END_MESSAGE_MAP()


/////////////////////////////////////////////////////////////////////////////
// CLogDialog message handlers

/////////////////////////////////////////////////////////////////////////////
//
//  Name:   
//
//  Description: 
//
//  Input:  
//
//  Output: 
//
//  Return: 
//
/////////////////////////////////////////////////////////////////////////////
BOOL CLogDialog::OnInitDialog()
{
    CFileDialog::OnInitDialog();
    
    // TODO: Add extra initialization here         
/*
    CRect rect;
    GetWindowRect(rect);

    VERIFY(SetWindowPos(NULL, 20, 20, rect.Width() + 20, rect.Height() + 80,
        SWP_NOZORDER|SWP_NOREDRAW|SWP_NOACTIVATE));



    VERIFY(SetWindowPos(NULL, 20, 20, rect.Width() + 120, rect.Height() + 40,
        SWP_NOMOVE|SWP_NOZORDER|SWP_NOREDRAW|SWP_NOACTIVATE));

    
    
    CRect rcCancel;
    GetDlgItem(IDCANCEL)->GetWindowRect(rcCancel);
    ScreenToClient(rcCancel);

    CPoint   pt(10 , rect.Height() - 15);
	CRect rectFrame1(pt.x, pt.y , pt.x + 165, pt.y + 45);
		                                                          
    m_Stc1.Create(NULL, WS_CHILD|WS_VISIBLE|SS_BLACKFRAME|WS_GROUP, 
        rectFrame1, this, IDC_OPENLOGFILE_STATIC2);

	CRect rectBtn1(pt.x + 10, pt.y + 5, pt.x + 150, pt.y +  20);
	  	                                                             
    m_btnAppend.Create("&Append",WS_VISIBLE|WS_TABSTOP|WS_CHILD|WS_GROUP
        |BS_AUTORADIOBUTTON, rectBtn1, this, IDC_OPENLOGFILE_APPEND);

    m_btnAppend.SetFont(GetFont(), TRUE);
    
    rectBtn1.OffsetRect(0, 22);                   
    
    m_btnOverwrite.Create("&Overwrite",WS_VISIBLE|WS_CHILD
        |BS_AUTORADIOBUTTON, rectBtn1, this, IDC_OPENLOGFILE_OVERWRITE);
    m_btnOverwrite.SetFont(GetFont(), TRUE);  

    
    rectFrame1.OffsetRect(190, 0);
    m_Stc2.Create(NULL, WS_CHILD|WS_VISIBLE|SS_BLACKFRAME|WS_GROUP, 
        rectFrame1, this, IDC_OPENLOGFILE_STATIC2);

    rectBtn1.OffsetRect(190, -22);    

    m_btnCommand.Create("&Commands",WS_VISIBLE|WS_CHILD|WS_TABSTOP|WS_GROUP
        |BS_AUTORADIOBUTTON, rectBtn1, this, IDC_OPENLOGFILE_COMMAND);
    m_btnCommand.SetFont(GetFont(), TRUE);

    rectBtn1.OffsetRect(0, 22);                     

    m_btnResult.Create("Commands and &Result",WS_VISIBLE|WS_CHILD|WS_TABSTOP
        |BS_AUTORADIOBUTTON, rectBtn1, this, IDC_OPENLOGFILE_RESULT);
    m_btnResult.SetFont(GetFont(), TRUE);
*/
/*
    if(m_nAppend) 
    	m_btnAppend.SetCheck(1);
    else    //m_btnOverwrite.SetCheck(1);
		m_btnAppend.SetCheck(0);    
    if(m_nCommand) 
    	m_btnCommand.SetCheck(1);    
    else    //m_btnResult.SetCheck(1);
        m_btnCommand.SetCheck(0);
*/
            
    CenterWindow();
    
    return TRUE;  // return TRUE  unless you set the focus to a control
}

/////////////////////////////////////////////////////////////////////////////
//
//  Name:   
//
//  Description: 
//
//  Input:  
//
//  Output: 
//
//  Return: 
//
/////////////////////////////////////////////////////////////////////////////
void CLogDialog::OnOK()
{
    // TODO: Add extra validation here
    m_nAppend  = m_btnAppend.GetCheck();
    m_nCommand = m_btnCommand.GetCheck();
    
    CFileDialog::OnOK();
}

/////////////////////////////////(EOF)///////////////////////////////////////
