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

/////////////////////////////////////////////////////////////////////////////
//
//  File name:  TRCSCHDG.CPP
//
//  Description:The implement file for the class: CTrcSchDg
//
//  Author:     Lane Li
//
//  Date:       09/10/95
//
//  Modification:
//
//      1. 09/10/95, Initial version
//
//
//  Copyright (C) 1995 Microtek International. All rights reserved.
//
/////////////////////////////////////////////////////////////////////////////

// trcschdg.cpp : implementation file
//

#include "stdafx.h"
#include "resource.h"
#include "xview.h"
#include "trcschdg.h" 
#include "lanecom.h"

#ifdef _DEBUG
#undef THIS_FILE
static char BASED_CODE THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CTrcSchDg dialog
                                      
CStringList g_trcSearchList;

CTrcSchDg::CTrcSchDg(CWnd* pParent /*=NULL*/)
	: CDialog(CTrcSchDg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CTrcSchDg)
	m_strContent = "";
	//}}AFX_DATA_INIT
}

void CTrcSchDg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CTrcSchDg)
	DDX_Control(pDX, IDC_TRC_SEARCH_COMBO, m_strCombo);
	DDX_CBString(pDX, IDC_TRC_SEARCH_COMBO, m_strContent);
	DDV_MaxChars(pDX, m_strContent, 100);
	//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CTrcSchDg, CDialog)
	//{{AFX_MSG_MAP(CTrcSchDg)
	ON_BN_CLICKED(IDC_TRC_SEARCH_CANCEL, OnTrcSearchCancel)
	ON_BN_CLICKED(IDC_TRC_SEARCH_SEARCH, OnTrcSearchSearch)
	ON_BN_CLICKED(ID_HELP, OnHelp)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()


/////////////////////////////////////////////////////////////////////////////
// CTrcSchDg message handlers

void CTrcSchDg::OnTrcSearchCancel()
{
	// TODO: Add your control notification handler code here
	EndDialog(0);
}

void CTrcSchDg::OnTrcSearchSearch()
{
	// TODO: Add your control notification handler code here
	
		// Add to combo box without same token
    int count;
	count = GetDlgItemText(IDC_TRC_SEARCH_COMBO, searchContent, 129);
	searchContent[count]='\0'; 
    strcpy(m_strContent.GetBuffer(100),(LPSTR)searchContent);
    
	POSITION pos = ::g_trcSearchList.GetHeadPosition();
	POSITION nextPos = pos;
	while ( nextPos ) {  
		if (m_strContent == ::g_trcSearchList.GetNext(nextPos)){
			g_trcSearchList.RemoveAt(pos);
		}
		pos = nextPos;			
	}                                

	g_trcSearchList.AddHead(m_strContent);	
    m_strContent.ReleaseBuffer();
	EndDialog(1);	
}

BOOL CTrcSchDg::OnInitDialog()
{
	CDialog::OnInitDialog();
    CenterWindow();
	
	// TODO: Add extra initialization here
	m_strCombo.ResetContent();
	
 	POSITION pos = ::g_trcSearchList.GetHeadPosition();
	while ( pos ) {
		m_strCombo.AddString(::g_trcSearchList.GetNext(pos));
	}                                
	
	if (m_strCombo.GetCount() >= 1){
		m_strCombo.SetCurSel(m_strCombo.GetCount()-1);
		m_strCombo.GetLBText(0, m_strContent);
	}

	UpdateData(FALSE);
	
	return TRUE;  // return TRUE  unless you set the focus to a control
}




void CTrcSchDg::OnHelp()
{
	// TODO: Add your control notification handler code here
	char szHelpPath[256];
	
	strcpy(szHelpPath, AfxGetApp()->m_pszHelpFilePath);
	
    int nLen = strlen(szHelpPath);
    while ( nLen ) {
	if ( '\\' == szHelpPath[--nLen] ) {
	    break;
	}
    }
    szHelpPath[++nLen] = '\0';
    
    strcat(szHelpPath, "epsld52f.hlp");

	//::WinHelp(m_hWnd, szHelpPath,  HELP_CONTEXT, 0X18043);
	AfxGetApp()->WinHelp(0X18043);
}
