📄 myoutput.cpp
字号:
}
CDialog::OnLButtonDblClk(nFlags, point);
}
void CMyOutput::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
CNewclientDlg* mainwnd =(CNewclientDlg*) AfxGetMainWnd();
if(iActiveWndNumber != m_iSubWndNumber)
{
iActiveWndNumber = m_iSubWndNumber;
mainwnd->MoveCurWin(mainwnd->WINDOWNUM, iActiveWndNumber);
mainwnd->F_ShowVideoParams();
if(!ClientParam.m_bUseCard)
{
DWORD dwBright,dwContrast, dwSaturation, dwHue;
dwBright = dwContrast = dwSaturation = dwHue = 0;
NET_DVR_ClientGetVideoEffect(m_iPlayhandle, &dwBright,&dwContrast, &dwSaturation, &dwHue);
ClientParam.m_VideoInfo[iActiveWndNumber].m_iBrightness = dwBright;
ClientParam.m_VideoInfo[iActiveWndNumber].m_iContrast = dwContrast;
ClientParam.m_VideoInfo[iActiveWndNumber].m_iSaturation = dwSaturation;
ClientParam.m_VideoInfo[iActiveWndNumber].m_iHue = dwHue;
}
}
if ((MK_CONTROL&nFlags) && (m_iPlayhandle != -1))
{
NET_DVR_RigisterDrawFun(m_iPlayhandle, DrawFun3, 0);
if (point.x < 0)
{
point.x = 0;
}
g_MouseRect3.left=point.x/16*16;
if (point.y < 0)
{
point.y = 0;
}
g_MouseRect3.top=point.y/16*16;
g_MouseRect3.right=g_MouseRect3.left;
g_MouseRect3.bottom=g_MouseRect3.top;
POINT tPoint=point;
g_ShowRect3.left=tPoint.x/16*16;
g_ShowRect3.top=tPoint.y/16*16;
g_ShowRect3.right=tPoint.x/16*16+1;
g_ShowRect3.bottom=tPoint.y/16*16+1;
}
CDialog::OnLButtonDown(nFlags, point);
}
void CMyOutput::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
if ((MK_CONTROL&nFlags) && (MK_LBUTTON&nFlags) && (m_iPlayhandle != -1))
{
POINT tPoint=point;
g_ShowRect3.right=tPoint.x/16*16;
g_ShowRect3.bottom=tPoint.y/16*16;
}
CDialog::OnMouseMove(nFlags, point);
}
void CMyOutput::OnPaint()
{
CPaintDC dc(this); // device context for painting
// TODO: Add your message handler code here
if(ClientParam.m_bUseCard)
NET_DVR_RestoreSurface_Card();
// Do not call CDialog::OnPaint() for painting messages
}
void CMyOutput::OnRButtonDown(UINT nFlags, CPoint point)
{
CancelSelectZoom();
// TODO: Add your message handler code here and/or call default
CMenu m_PopMenu;
CNewclientDlg* mainwnd =(CNewclientDlg*) AfxGetMainWnd();
if(iActiveWndNumber != m_iSubWndNumber)
{
iActiveWndNumber = m_iSubWndNumber;
mainwnd->MoveCurWin(mainwnd->WINDOWNUM, iActiveWndNumber);
mainwnd->F_ShowVideoParams();
if(!ClientParam.m_bUseCard)
{
DWORD dwBright,dwContrast, dwSaturation, dwHue;
dwBright = dwContrast = dwSaturation = dwHue = 0;
NET_DVR_ClientGetVideoEffect(m_iPlayhandle, &dwBright,&dwContrast, &dwSaturation, &dwHue);
ClientParam.m_VideoInfo[iActiveWndNumber].m_iBrightness = dwBright;
ClientParam.m_VideoInfo[iActiveWndNumber].m_iContrast = dwContrast;
ClientParam.m_VideoInfo[iActiveWndNumber].m_iSaturation = dwSaturation;
ClientParam.m_VideoInfo[iActiveWndNumber].m_iHue = dwHue;
}
}
if(ClientParam.m_bFullScreen || ClientParam.m_bMultiScreen)
return;
if(!m_PopMenu.LoadMenu(IDR_MENU1))
return;
ClientToScreen(&point);
CMenu *psub = (CMenu *)m_PopMenu.GetSubMenu(0);
psub->EnableMenuItem(0, MF_BYPOSITION | MF_DISABLED | MF_GRAYED);
psub->EnableMenuItem(1, MF_BYPOSITION | MF_DISABLED | MF_GRAYED);
psub->EnableMenuItem(2, MF_BYPOSITION | MF_DISABLED | MF_GRAYED);
psub->EnableMenuItem(3, MF_BYPOSITION | MF_DISABLED | MF_GRAYED);
if(ClientParam.m_bCycling)
{
if(ClientParam.m_bPaused)
psub->ModifyMenu(0, MF_BYPOSITION, IDC_MENU_PAUSECYCLE, "Start Cycle");
else
psub->ModifyMenu(0, MF_BYPOSITION, IDC_MENU_PAUSECYCLE, "Pause Cycle");
psub->EnableMenuItem(0, MF_BYPOSITION | MF_ENABLED);
psub->EnableMenuItem(1, MF_BYPOSITION | MF_DISABLED | MF_GRAYED);
psub->EnableMenuItem(2, MF_BYPOSITION | MF_DISABLED | MF_GRAYED);
}
else
{
if(ClientParam.m_bNextPage)
{
psub->EnableMenuItem(0, MF_BYPOSITION | MF_DISABLED | MF_GRAYED);
psub->EnableMenuItem(1, MF_BYPOSITION | MF_ENABLED);
}
if(ClientParam.m_bFrontPage)
{
psub->EnableMenuItem(0, MF_BYPOSITION | MF_DISABLED | MF_GRAYED);
psub->EnableMenuItem(2, MF_BYPOSITION | MF_ENABLED);
}
}
// if(m_iPlayhandle >= 0)
{
if(ClientParam.m_bPlaySound[iActiveWndNumber])
psub->ModifyMenu(3, MF_BYPOSITION, IDC_MENU_SOUND, "Close Sound");
else
psub->ModifyMenu(3, MF_BYPOSITION, IDC_MENU_SOUND, "Open Sound");
psub->EnableMenuItem(3, MF_BYPOSITION | MF_ENABLED);
}
psub->EnableMenuItem(4, MF_BYPOSITION | MF_ENABLED);
psub->TrackPopupMenu(TPM_LEFTALIGN|TPM_RIGHTBUTTON,point.x,point.y,this);
m_PopMenu.DestroyMenu();
CDialog::OnRButtonDown(nFlags, point);
}
void CMyOutput::OnTimer(UINT nIDEvent)
{
// TODO: Add your message handler code here and/or call default
CDialog::OnTimer(nIDEvent);
}
void CMyOutput::OnMenuFrontpage()
{
// TODO: Add your command handler code here
CNewclientDlg* mainwnd =(CNewclientDlg*) AfxGetMainWnd();
mainwnd->F_FrontPage();
}
void CMyOutput::OnMenuNextpage()
{
// TODO: Add your command handler code here
CNewclientDlg* mainwnd =(CNewclientDlg*) AfxGetMainWnd();
mainwnd->F_NextPage();
}
void CMyOutput::OnMenuPausecycle()
{
// TODO: Add your command handler code here
CNewclientDlg* mainwnd =(CNewclientDlg*) AfxGetMainWnd();
mainwnd->F_CyclePause();
}
void CMyOutput::OnMenuSound()
{
// TODO: Add your command handler code here
int i;
WORD wTemp;
WORD wVolumevalue;
wTemp = (0xFFFF) / 100;
wVolumevalue = 50 * wTemp;
if(myoutput[iActiveWndNumber].m_iPlayhandle >= 0)
{
if(ClientParam.m_bUseCard)
{
if(ClientParam.m_bPlaySound[iActiveWndNumber])
{
NET_DVR_CloseSound_Card(myoutput[iActiveWndNumber].m_iPlayhandle);
ClientParam.m_bPlaySound[iActiveWndNumber] = FALSE;
}
else
{
NET_DVR_OpenSound_Card(myoutput[iActiveWndNumber].m_iPlayhandle);
NET_DVR_AudioPreview_Card(myoutput[iActiveWndNumber].m_iPlayhandle, TRUE);
NET_DVR_SetVolume_Card(myoutput[iActiveWndNumber].m_iPlayhandle, wVolumevalue);
ClientParam.m_bPlaySound[iActiveWndNumber] = TRUE;
}
}
else
{
TRACE("Close Audio");
if(!g_bShareSound)
{
NET_DVR_CloseSound();
}
if(ClientParam.m_bPlaySound[iActiveWndNumber])
{
TRACE("Close m_bPlaySound[%d] Sound", iActiveWndNumber);
ClientParam.m_bPlaySound[iActiveWndNumber] = FALSE;
if(g_bShareSound)
{
NET_DVR_CloseSoundShare(myoutput[iActiveWndNumber].m_iPlayhandle);
}
}
else
{
TRACE("Open m_bPlaySound[%d] = TRUE Sound", iActiveWndNumber);
ClientParam.m_bPlaySound[iActiveWndNumber] = TRUE;
if(g_bShareSound)
{
if(!NET_DVR_OpenSoundShare(myoutput[iActiveWndNumber].m_iPlayhandle))
TRACE("Client Play Audio error");
}
else
{
if(!NET_DVR_OpenSound(myoutput[iActiveWndNumber].m_iPlayhandle))
TRACE("Client Play Audio error");
}
if(!NET_DVR_Volume(myoutput[iActiveWndNumber].m_iPlayhandle, wVolumevalue))
TRACE("Client Audio Volume error");
}
}
if(!g_bShareSound)
{
for(i = 0; i < MAXVIEWNUM; i++)
{ //Close the sound flag of other windows
if(i == (int)iActiveWndNumber)
continue;
ClientParam.m_bPlaySound[i] = FALSE;
}
}
}
}
void CMyOutput::OnMenuMultiscreen()
{
// TODO: Add your command handler code here
if(m_iPlayhandle < 0)
return;
CNewclientDlg* mainwnd = (CNewclientDlg*) AfxGetMainWnd();
ClientParam.m_bMultiScreen = TRUE;
mainwnd->F_FullScreen();
mainwnd->ArrayWindow(iActiveWndNumber,mainwnd->WINDOWNUM);
mainwnd->MoveCurWin(mainwnd->WINDOWNUM,iActiveWndNumber);
// StopNet();
}
void CMyOutput::invateframe()
{
Invalidate(TRUE);
UpdateData(FALSE);
if(ClientParam.m_bUseCard)
NET_DVR_RefreshSurface_Card();
}
void CMyOutput::OnCancel()
{
// TODO: Add extra cleanup here
// CDialog::OnCancel();
}
void CMyOutput::OnOK()
{
// TODO: Add extra cleanup here
// CDialog::OnOK();
}
void CMyOutput::OnLButtonUp(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
if ((MK_CONTROL&nFlags) && (m_iPlayhandle != -1))
{
POINT tPoint=point;
g_ShowRect3.right=tPoint.x/16*16;
g_ShowRect3.bottom=tPoint.y/16*16;
NET_DVR_POINT_FRAME ptFrame;
double scale = 1;
if (ClientParam.m_bFullScreen)
{
scale = 0.32;
}
else if (m_iWindowNum == 1)
{
scale = 0.5;
}
else if (m_iWindowNum == 9)
{
scale = 1.5;
}
else if (m_iWindowNum == 16)
{
scale = 2;
}
ptFrame.xTop = (int)(g_MouseRect3.left * 2 * scale);
ptFrame.yTop = (int)(g_MouseRect3.top * 2 * scale);
ptFrame.xBottom = (int)(g_ShowRect3.right * 2 * scale);
ptFrame.yBottom = (int)(g_ShowRect3.bottom * 2 * scale);
if (g_MouseRect3.left < g_ShowRect3.right)
{
if (g_MouseRect3.top < g_ShowRect3.bottom)
{
ptFrame.bCounter = 4;
}
else
{
ptFrame.bCounter = 2;
}
}
else
{
if (g_MouseRect3.top < g_ShowRect3.bottom)
{
ptFrame.bCounter = 3;
}
else
{
ptFrame.bCounter = 1;
}
}
if (!NET_DVR_PTZSelZoomIn(m_iPlayhandle, &ptFrame))
{
CString tmp;
tmp.Format("Error: NET_DVR_PTZSelZoomIn = %d", NET_DVR_GetLastError());
AfxMessageBox(tmp);
}
CancelSelectZoom();
}
else
{
CancelSelectZoom();
}
CDialog::OnLButtonUp(nFlags, point);
}
void CMyOutput::CancelSelectZoom()
{
if (m_iPlayhandle != -1)
{
g_MouseRect3.top = 0;
g_MouseRect3.left = 0;
g_MouseRect3.right = 0;
g_MouseRect3.bottom = 0;
g_ShowRect3.top = 0;
g_ShowRect3.left = 0;
g_ShowRect3.right = 0;
g_ShowRect3.bottom = 0;
NET_DVR_RigisterDrawFun(m_iPlayhandle, NULL, 0);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -