⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 zoneoperator.cpp

📁 一个完整的数字硬盘录像机系统软件
💻 CPP
字号:
// ZoneOperator.cpp : implementation file
//

#include "stdafx.h"
#include "gtmpeg.h"
#include "ZoneOperator.h"
#include "StatesWnd.h"
#include "Chunnel.h"
#include "GtMpegWnd.h"
#include "MapDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CZoneOperator property page

IMPLEMENT_DYNCREATE(CZoneOperator, CPropertyPage)

CZoneOperator::CZoneOperator() : CPropertyPage(CZoneOperator::IDD)
{
	//{{AFX_DATA_INIT(CZoneOperator)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
	m_nCurChunnel=0;
}

CZoneOperator::~CZoneOperator()
{
}
/////////////////////////////////////////////////////////////////////////////
//
/////////////////////////////////////////////////////////////////////////////
void CZoneOperator::DoDataExchange(CDataExchange* pDX)
{
	CPropertyPage::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CZoneOperator)
	DDX_Control(pDX, IDC_CHUNNEL_BOX, m_cChunnelBox);
	//}}AFX_DATA_MAP
}
/////////////////////////////////////////////////////////////////////////////
//
/////////////////////////////////////////////////////////////////////////////
BEGIN_MESSAGE_MAP(CZoneOperator, CPropertyPage)
	//{{AFX_MSG_MAP(CZoneOperator)
	ON_CBN_CLOSEUP(IDC_CHUNNEL_BOX, OnCloseupChunnelBox)
	ON_BN_CLICKED(IDC_OPEN_MAP, OnOpenMap)
	ON_BN_CLICKED(IDC_RESET, OnReset)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
//
/////////////////////////////////////////////////////////////////////////////
BOOL CZoneOperator::OnInitDialog() 
{
	CPropertyPage::OnInitDialog();
	for(int i=0;i<theApp.m_nChunnel;i++)
	{
	    CString sTxt;
		sTxt.Format("报警通道%d",i+1);
		m_cChunnelBox.AddString(sTxt);
	}
	m_cChunnelBox.SetCurSel(m_nCurChunnel);
	Init();
	UpdateSet();
	return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
//
/////////////////////////////////////////////////////////////////////////////
void CZoneOperator::Init()
{
    CGtMpegWnd *pWnd=(CGtMpegWnd *)theApp.m_pMainWnd;
    CChunnel* pCurChunnel=pWnd->GetChunnel(m_nCurChunnel);
	CZone *pZone=NULL;
	for(int i=0;i<16;i++)
	{
	  CRect rect;
	  GetDlgItem(IDC_ZONE_STATES_1+i)->GetWindowRect(rect);
	  ScreenToClient(rect);
	  rect.bottom=rect.top+16;
	  pZone=pCurChunnel->GetZone(i);
	  if(pZone!=NULL)
	  {
	      m_wndZoneStates[i].Create(FALSE,rect,this,IDC_ZONE_STATES_1+i);
		  m_wndZoneStates[i].SetZone(pZone);
		  if(pZone->m_nType!=3)
			  m_wndZoneStates[i].EnableWindow(TRUE);
		  else
              m_wndZoneStates[i].EnableWindow(FALSE);
	  }
	}
	for(i=0;i<8;i++)
	{
	  CRect rect;
	  GetDlgItem(IDC_SECONDARY_STATES_1+i)->GetWindowRect(rect);
	  ScreenToClient(rect);
	  m_wndSecondaryStates[i].Create(TRUE,rect,this,IDC_SECONDARY_STATES_1+i);
	  m_wndSecondaryStates[i].SetSecondary(pCurChunnel->GetSecondary(i));
	}
}
/////////////////////////////////////////////////////////////////////////////
//
/////////////////////////////////////////////////////////////////////////////
void CZoneOperator::UpdateSet()
{
    CGtMpegWnd *pWnd=(CGtMpegWnd *)theApp.m_pMainWnd;
    CChunnel* pCurChunnel=pWnd->GetChunnel(m_nCurChunnel);
	if(pCurChunnel!=NULL)
	{
		for(int i=0;i<16;i++)
		    m_wndZoneStates[i].SetZone(pCurChunnel->GetZone(i));
		for(i=0;i<8;i++)
		     m_wndSecondaryStates[i].SetSecondary(pCurChunnel->GetSecondary(i));
	}
}
/////////////////////////////////////////////////////////////////////////////
//
/////////////////////////////////////////////////////////////////////////////
void CZoneOperator::OnCloseupChunnelBox() 
{
  int nIndex=m_cChunnelBox.GetCurSel();
  if(nIndex!=-1)
  {
     if(nIndex!=m_nCurChunnel)
	 {
	    m_nCurChunnel=nIndex;
		UpdateSet();
		SetFocus();
	 }
  }
}
/////////////////////////////////////////////////////////////////////////////
//
/////////////////////////////////////////////////////////////////////////////
void CZoneOperator::OnOpenMap() 
{
    CFileStatus Status;
	CString sMapFile=GetAppPath()+"电子地图.jpg";
    if (!CFile::GetStatus (sMapFile, Status))
	{
 	    MessageBox("没有发现"+sMapFile);
		return;
	}
	CMapDlg dlg;
	dlg.DoModal();
}
/////////////////////////////////////////////////////////////////////////////
//
/////////////////////////////////////////////////////////////////////////////
void CZoneOperator::OnReset() 
{
		UpdateSet();
}
/////////////////////////////////////////////////////////////////////////////
//
/////////////////////////////////////////////////////////////////////////////

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -