/***************************************************************************
**
**    $Header:   D:/EPSLDV1/SRC/LOG/PERWIN.CPP   1.8   20 Jun 1996 09:24:38   ZJRD  $
**
**    $Log:   D:/EPSLDV1/SRC/LOG/PERWIN.CPP  $
** 
**    Rev 1.8   20 Jun 1996 09:24:38   ZJRD
** EasyPack/SLD Version 1.20a
** 
**    Rev 1.6   10 Jun 1996 10:19:16   ZJRD
** EasyPack/SLD Version 1.20
** 
**    Rev 1.4   29 May 1996 09:28:12   ZJRD
** No change.
** 
**    Rev 1.3   16 May 1996 09:08:34   ZJRD
** No change.
** 
**    Rev 1.2   10 May 1996 09:09:04   ZJRD
** No change.
** 
**    Rev 1.1   02 May 1996 10:25:00   ZJRD
** EasyPack/SLD Version 1.92
** 
**    Rev 1.29   18 Apr 1996 13:01:42   Shirley
** No change.
** 
**    Rev 1.28   12 Apr 1996 10:38:42   Shirley
** EasyPack/SLD Version 1.90
** 
**    Rev 1.26   15 Feb 1996 08:51:38   Shirley
** No change.
** 
**    Rev 1.25   12 Feb 1996 14:06:06   Shirley
** No change.
** 
**    Rev 1.24   06 Feb 1996 15:32:38   Shirley
** No change.
** 
**    Rev 1.23   06 Feb 1996 13:46:52   Shirley
** No change.
** 
**    Rev 1.22   01 Feb 1996 10:13:24   Shirley
** No change.
** 
**    Rev 1.21   26 Jan 1996 09:17:36   Shirley
** No change.
** 
**    Rev 1.20   25 Jan 1996 13:17:36   Shirley
** No change.
** 
**    Rev 1.19   24 Jan 1996 10:37:02   Shirley
** No change.
** 
**    Rev 1.18   23 Jan 1996 11:27:32   Shirley
** No change.
** 
**    Rev 1.17   18 Jan 1996 10:10:48   Shirley
** No change.
** 
**    Rev 1.16   15 Jan 1996 16:11:48   Shirley
** No change.
** 
**    Rev 1.15   04 Jan 1996 11:12:48   Shirley
** No change.
** 
**    Rev 1.14   30 Nov 1995 09:12:06   Shirley
** No change.
** 
**    Rev 1.13   28 Nov 1995 15:34:08   Shirley
** No change.
** 
**    Rev 1.12   21 Nov 1995 11:19:54   Shirley
** No change.
** 
**    Rev 1.11   13 Nov 1995 09:22:36   Shirley
** No change.
** 
**    Rev 1.10   12 Nov 1995 11:33:08   Shirley
** No change.
** 
**    Rev 1.9   08 Nov 1995 16:29:38   Shirley
** No change.
** 
**    Rev 1.8   08 Nov 1995 12:40:08   Shirley
** No change.
** 
**    Rev 1.7   02 Nov 1995 10:08:30   Shirley
** No change.
** 
**    Rev 1.6   27 Oct 1995 16:45:58   Shirley
** No change.
** 
**    Rev 1.5   27 Oct 1995 13:48:06   Shirley
** No change.
** 
**    Rev 1.4   25 Oct 1995 14:29:22   Shirley
** EasyPack/SLD Version 0.1f
** 
**    Rev 1.2   13 Oct 1995 13:22:38   Shirley
** No change.
** 
**    Rev 1.1   29 Sep 1995 09:53:12   Shirley
** No change.
** 
**    Rev 1.0   20 Sep 1995 10:56:24   Shirley
** Initial revision.
** 
**    
** 
** 
**
**
**
****************************************************************************/

/////////////////////////////////////////////////////////////////////////////
//
//  File name:  PERWIN.CPP
//
//  Description:The implementation file of CPerWin class for Peripheral window
//
//  Author:     Jerry Yan
//
//  Date:       09/18/95
//
//  Modification:
//
//      1. 09/18/95, Initial version 
//
//
//  Copyright (C) 1995 Microtek International. All rights reserved.
//
/////////////////////////////////////////////////////////////////////////////


// perwin.cpp : implementation file
//

#include "stdafx.h"
#include "resource.h"
#include "xview.h"
#include "perwin.h"
#include "uicom.h"

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

void PeriOpenWindow(CMDIFrameWnd * pParentWnd)
{
    if (isPeriOn) return;
    pPeriDocTemplate->OpenDocumentFile(NULL);
}                  

/////////////////////////////////////////////////////////////////////////////
// CPerWin

IMPLEMENT_DYNCREATE(CPerWin, CMDIChildWnd)

CPerWin::CPerWin()
{                 
    isPeriOn = TRUE;
    pPeriWnd = this;
}

CPerWin::~CPerWin()
{                   
    isPeriOn = FALSE;
    pPeriWnd = 0;
}


BEGIN_MESSAGE_MAP(CPerWin, CMDIChildWnd)
    //{{AFX_MSG_MAP(CPerWin)
    ON_WM_MDIACTIVATE()
    ON_WM_SETCURSOR()
    //}}AFX_MSG_MAP
END_MESSAGE_MAP()


/////////////////////////////////////////////////////////////////////////////
// CPerWin message handlers


void CPerWin::OnMDIActivate(BOOL bActivate, CWnd* pActivateWnd, CWnd* pDeactivateWnd)
{
    CMDIChildWnd::OnMDIActivate(bActivate, pActivateWnd, pDeactivateWnd);
    
    // TODO: Add your message handler code here
    if(bActivate && pActivateWnd == this)
        GetMDIFrame()->SendMessage(XM_MDIACTIVE, WORD(bActivate), 
            LONG(WID_PERI));
    else if(!bActivate && !pActivateWnd)
        GetMDIFrame()->SendMessage(XM_MDIACTIVE, WORD(bActivate)); 
}

BOOL CPerWin::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
{
    // TODO: Add your message handler code here and/or call default
    
    if(message == WM_RBUTTONDOWN)   return FALSE;
    return CMDIChildWnd::OnSetCursor(pWnd, nHitTest, message);
}
