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

📄 zoneset.cpp

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

#include "stdafx.h"
#include "gtmpeg.h"
#include "ZoneSet.h"
#include "gtmpegWnd.h"
#include "ZoneBelong.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
//
/////////////////////////////////////////////////////////////////////////////
CZoneSet::CZoneSet(CChunnel* pCurChunnel,int nChunnel,CWnd* pParent /*=NULL*/)
	: CDialog(CZoneSet::IDD, pParent)
{
	//{{AFX_DATA_INIT(CZoneSet)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
	m_pCurChunnel=pCurChunnel;
	m_nChunnel=nChunnel;
}
/////////////////////////////////////////////////////////////////////////////
//
/////////////////////////////////////////////////////////////////////////////
void CZoneSet::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CZoneSet)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}
/////////////////////////////////////////////////////////////////////////////
//
/////////////////////////////////////////////////////////////////////////////
BEGIN_MESSAGE_MAP(CZoneSet, CDialog)
	//{{AFX_MSG_MAP(CZoneSet)
	ON_BN_CLICKED(IDC_ZONE_BELONG, OnZoneBelong)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
//
/////////////////////////////////////////////////////////////////////////////
BOOL CZoneSet::OnInitDialog() 
{
	CDialog::OnInitDialog();
	CString sTmp;
	sTmp.Format("报警通道%d",m_nChunnel+1);
	GetDlgItem(IDC_CHUNNEL_TXT)->SetWindowText(sTmp);
	for(int i=0;i<16;i++)
	{
	   if(m_pCurChunnel!=NULL)
	   {
	      CZone *pZone=m_pCurChunnel->GetZone(i);
		  if(pZone!=NULL)
		  {
		     CEdit *pEdit=(CEdit *)GetDlgItem(IDC_ZONE_TXT_1+i);
			 pEdit->SetWindowText(pZone->GetZoneTxt());
		     pEdit=(CEdit *)GetDlgItem(IDC_TOUCH_TXT_1+i);
			 pEdit->SetWindowText(pZone->m_sTouchTxt);
			 SetDlgItemInt(IDC_EXIT_TIMER_1+i,pZone->m_nExitTimer,FALSE);
			 SetDlgItemInt(IDC_ENTER_TIMER_1+i,pZone->m_nEnterTimer,FALSE);
			 CComboBox *pBox=(CComboBox *)GetDlgItem(IDC_ZONE_TYPE_1+i);
			 pBox->SetCurSel(pZone->m_nType);
		  }
	   }
	}
    InitCtrlWay();
	BuildZoneSet();
	return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
//
/////////////////////////////////////////////////////////////////////////////
void CZoneSet::OnOK() 
{
    BuildZoneSet();
    CGtMpegWnd *pWnd=(CGtMpegWnd *)theApp.m_pMainWnd;
	CDialog::OnOK();
}
/////////////////////////////////////////////////////
//
/////////////////////////////////////////////////////
void CZoneSet::OnZoneBelong() 
{
   BuildZoneSet();
   CGtMpegWnd *pWnd=(CGtMpegWnd *)theApp.m_pMainWnd;
   pWnd->SaveAlarmSet();
   CZoneBelong dlg(m_pCurChunnel);
   dlg.DoModal();
   BuildZoneSet();
   pWnd->SaveAlarmSet();
   InitCtrlWay();
}
//////////////////////////////////////////////////////
//
//////////////////////////////////////////////////////
void CZoneSet::InitCtrlWay()
{
	for(int i=0;i<16;i++)
	{
	   CZone *pZone=m_pCurChunnel->GetZone(i);
	   CComboBox *pBox=(CComboBox *)GetDlgItem(IDC_ZONE_CTRL1+i);
	   if(pZone->m_nType==7)
	   {
			   pBox->SetCurSel(-1);
			   pBox->EnableWindow(FALSE);
	   }
	   else
	   {
		    if(pZone->m_nBelong==-1)
			{
                pBox->SetCurSel(0);
	  		    pBox->EnableWindow(FALSE);
			}
			else
			{
                pBox->SetCurSel(pZone->m_nCtrlWay);
			    pBox->EnableWindow(TRUE);
			}
	   }
	}
}
//////////////////////////////////////////////////////
//
//////////////////////////////////////////////////////
void CZoneSet::BuildZoneSet()
{
   CGtMpegWnd *pWnd=(CGtMpegWnd *)theApp.m_pMainWnd;
	for(int i=0;i<16;i++)
	{
	   if(m_pCurChunnel!=NULL)
	   {
	      CZone *pZone=m_pCurChunnel->GetZone(i);
		  if(pZone!=NULL)
		  {
		     CEdit *pEdit=(CEdit *)GetDlgItem(IDC_ZONE_TXT_1+i);
			 CString sTxt;
             pEdit->GetWindowText(sTxt);
             pZone->SetZoneTxt(sTxt);
			 pEdit=(CEdit *)GetDlgItem(IDC_TOUCH_TXT_1+i);
			 pEdit->GetWindowText(pZone->m_sTouchTxt);
			 pZone->m_nExitTimer=GetDlgItemInt(IDC_EXIT_TIMER_1+i,NULL,FALSE);
			 pZone->m_nEnterTimer=GetDlgItemInt(IDC_ENTER_TIMER_1+i,NULL,FALSE);
			 CComboBox *pBox=(CComboBox *)GetDlgItem(IDC_ZONE_TYPE_1+i);
			 int nOldType=pZone->m_nType;
			 pZone->m_nType=pBox->GetCurSel();
			 if(nOldType==7&&pZone->m_nType!=7)
			 {
			    NMHDR Msg;
		        Msg.hwndFrom=m_hWnd;
		        UINT uInfoID;
		        Msg.idFrom=IDC_ZONE_STATES_1+i;
		        uInfoID=_ALARM_ZONE_INFO;
		        Msg.code=m_pCurChunnel->m_nSort;
		        Msg.code<<=16;
		        Msg.code+=0;
		        pWnd->SendMessage(WM_NOTIFY,uInfoID,(LPARAM)&Msg);
				for(int j=0;j<16;j++)
				{
				   pZone->m_Zone[j]=-1;
				   CZone *pBelongZone=m_pCurChunnel->GetZone(j);
				   if(pBelongZone->m_nBelong==pZone->GetSort())
				   {
				      pBelongZone->m_nBelong=-1;
					  pBelongZone->m_nCtrlWay=0;
		              Msg.hwndFrom=m_hWnd;
		              UINT uInfoID;
		              Msg.idFrom=IDC_ZONE_STATES_1+j;
		              uInfoID=_ALARM_ZONE_INFO;
		              Msg.code=m_pCurChunnel->m_nSort;
		              Msg.code<<=16;
		              Msg.code+=0;
                      pBelongZone->m_bStates2=FALSE;
                      pBelongZone->m_bStates3=FALSE;
                      pBelongZone->SetStates(FALSE);
				   }
				}
			 }
			 pBox=(CComboBox *)GetDlgItem(IDC_ZONE_CTRL1+i);
			 pZone->m_nCtrlWay=pBox->GetCurSel();
		  }
	   }
	}
}

⌨️ 快捷键说明

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