You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
205 lines
6.4 KiB
205 lines
6.4 KiB
//----------------------------------------------------------------------------
|
|
// Laser Guard Ltd.
|
|
// Copyright © 2000-2002. All Rights Reserved.
|
|
// Version 1.0 01/01/2000
|
|
// Last modification: 08/10/2003
|
|
// PROJECT:
|
|
// SUBSYSTEM:
|
|
// FILE: LgUICameraControlWnd.cpp
|
|
// AUTHOR: Sergey Chizhevskiy
|
|
// OVERVIEW
|
|
// ~~~~~~~~
|
|
// Source file of LgUICameraControlWnd.cpp
|
|
//----------------------------------------------------------------------------
|
|
#include "stdafx.h"
|
|
#include "LgUICameraControlWnd.h"
|
|
#include "LgUICameraEngine.h"
|
|
|
|
CLgUICameraControlWnd::CLgUICameraControlWnd( CWnd* pParent )
|
|
{
|
|
//{{AFX_DATA_INIT(CCameraNavigateDlg)
|
|
//}}AFX_DATA_INIT
|
|
}
|
|
|
|
CLgUICameraControlWnd::~CLgUICameraControlWnd()
|
|
{
|
|
}
|
|
|
|
BEGIN_MESSAGE_MAP(CLgUICameraControlWnd, CDialog)
|
|
//{{AFX_MSG_MAP(CCameraNavigateDlg)
|
|
//}}AFX_MSG_MAP
|
|
ON_MESSAGE( WM_LG_BUTTON_SET_STATE, OnWmLgButtonSetState )
|
|
END_MESSAGE_MAP()
|
|
|
|
const short IDC_BUTTON_WIDE = 10;
|
|
const short IDC_BUTTON_TELE = 11;
|
|
const short IDC_BUTTON_UP = 12;
|
|
const short IDC_BUTTON_DOWN = 13;
|
|
const short IDC_BUTTON_LEFT = 14;
|
|
const short IDC_BUTTON_RIGHT = 15;
|
|
//const short IDC_BUTTON_IRIS,
|
|
//const short IDC_BUTTON_LOCK_CAMERA,
|
|
//const short IDC_BUTTON_LOCK_NAVIGATE,
|
|
//const short IDC_BUTTON_PREV,
|
|
//const short IDC_BUTTON_NEXT,
|
|
//const short IDC_BUTTON_PHOTO,
|
|
|
|
void CLgUICameraControlWnd::DoDataExchange(CDataExchange* pDX)
|
|
{
|
|
CDialog::DoDataExchange(pDX);
|
|
//{{AFX_DATA_MAP(CLgUICameraControlWnd)
|
|
DDX_Control(pDX, IDC_BUTTON_UP, m_ButtonUp);
|
|
DDX_Control(pDX, IDC_BUTTON_RIGHT, m_ButtonRight);
|
|
DDX_Control(pDX, IDC_BUTTON_TELE, m_ButtonTele);
|
|
DDX_Control(pDX, IDC_BUTTON_LEFT, m_ButtonLeft);
|
|
DDX_Control(pDX, IDC_BUTTON_WIDE, m_ButtonWide);
|
|
DDX_Control(pDX, IDC_BUTTON_DOWN, m_ButtonDown);
|
|
//}}AFX_DATA_MAP
|
|
}
|
|
|
|
typedef struct VCCB_TEMPLATE
|
|
{
|
|
DLGITEMTEMPLATE Item;
|
|
WORD ItemClass[2];
|
|
WORD ItemName;
|
|
WORD ItemData;
|
|
WORD ItemReserved;
|
|
}VCCB_TEMPLATE, *PVCCB_TEMPLATE;
|
|
|
|
typedef struct VCCD_TEMPLATE
|
|
{
|
|
DLGTEMPLATE Dlg;
|
|
WORD DlgMenu;
|
|
WORD DlgClass;
|
|
WORD DlgName;
|
|
VCCB_TEMPLATE DlgItem[6];
|
|
}VCCD_TEMPLATE, *PVCCD_TEMPLATE;
|
|
|
|
const cbSpace = 2;
|
|
const cbSize = 20;
|
|
|
|
VCCD_TEMPLATE VideoCameraControlDialogTemplate =
|
|
{
|
|
// Dlg
|
|
{
|
|
WS_CHILD | DS_3DLOOK | WS_VISIBLE | WS_DLGFRAME, 0, 6,
|
|
0, 0, cbSpace+(cbSize+cbSpace)*4, cbSpace+(cbSize+cbSpace)*2
|
|
},
|
|
// DlgMenu, DlgClass, DlgName
|
|
0, 0, 0,
|
|
{
|
|
// ----- DlgItem[0] -------
|
|
WS_CHILD | WS_VISIBLE, 0, cbSpace+(cbSize+cbSpace)*0, cbSpace+(cbSize+cbSpace)/2, cbSize, cbSize, IDC_BUTTON_LEFT,
|
|
// ItemClass[2], ItemName, ItemData, ItemReserved
|
|
0xFFFF, 0x0080, 0x0000, 0x0000, 0,
|
|
|
|
// ----- DlgItem[1] -------
|
|
WS_CHILD | WS_VISIBLE, 0, cbSpace+(cbSize+cbSpace)*1, cbSpace, cbSize, cbSize, IDC_BUTTON_UP,
|
|
// ItemClass[2], ItemName, ItemData, ItemReserved
|
|
0xFFFF, 0x0080, 0x0000, 0x0000, 0,
|
|
|
|
// ----- DlgItem[2] -------
|
|
WS_CHILD | WS_VISIBLE, 0, cbSpace+(cbSize+cbSpace)*2, cbSpace+(cbSize+cbSpace)/2, cbSize, cbSize, IDC_BUTTON_RIGHT,
|
|
// ItemClass[2], ItemName, ItemData, ItemReserved
|
|
0xFFFF, 0x0080, 0x0000, 0x0000, 0,
|
|
|
|
// ----- DlgItem[3] -------
|
|
WS_CHILD | WS_VISIBLE, 0, cbSpace+(cbSize+cbSpace)*3, cbSpace, cbSize, cbSize, IDC_BUTTON_TELE,
|
|
// ItemClass[2], ItemName, ItemData, ItemReserved
|
|
0xFFFF, 0x0080, 0x0000, 0x0000, 0,
|
|
|
|
// ----- DlgItem[4] -------
|
|
WS_CHILD | WS_VISIBLE, 0, cbSpace+(cbSize+cbSpace)*1, cbSpace+(cbSize+cbSpace)*1, cbSize, cbSize, IDC_BUTTON_DOWN,
|
|
// ItemClass[2], ItemName, ItemData, ItemReserved
|
|
0xFFFF, 0x0080, 0x0000, 0x0000, 0,
|
|
|
|
// ----- DlgItem[5] -------
|
|
WS_CHILD | WS_VISIBLE, 0, cbSpace+(cbSize+cbSpace)*3, cbSpace+(cbSize+cbSpace)*1, cbSize, cbSize, IDC_BUTTON_WIDE,
|
|
// ItemClass[2], ItemName, ItemData, ItemReserved
|
|
0xFFFF, 0x0080, 0x0000, 0x0000, 0,
|
|
},
|
|
};
|
|
|
|
LRESULT CLgUICameraControlWnd::OnWmLgButtonSetState( WPARAM wParam, LPARAM lParam )
|
|
{
|
|
// check camera link
|
|
CLgUICamera* pCamera = *this;
|
|
if( !pCamera )
|
|
return FALSE;
|
|
|
|
UINT uControlID = wParam;
|
|
switch( uControlID )
|
|
{
|
|
case IDC_BUTTON_WIDE: pCamera->UICameraMovePTZ( lParam ? CLgUICamera::CAMERA_ZOOM_WIDE : CLgUICamera::CAMERA_ZOOM_STOP ); break;
|
|
case IDC_BUTTON_TELE: pCamera->UICameraMovePTZ( lParam ? CLgUICamera::CAMERA_ZOOM_TELE : CLgUICamera::CAMERA_ZOOM_STOP ); break;
|
|
case IDC_BUTTON_UP: pCamera->UICameraMovePTZ( lParam ? CLgUICamera::CAMERA_TILT_UP : CLgUICamera::CAMERA_TILT_STOP ); break;
|
|
case IDC_BUTTON_DOWN: pCamera->UICameraMovePTZ( lParam ? CLgUICamera::CAMERA_TILT_DOWN : CLgUICamera::CAMERA_TILT_STOP ); break;
|
|
case IDC_BUTTON_LEFT: pCamera->UICameraMovePTZ( lParam ? CLgUICamera::CAMERA_PAN_LEFT : CLgUICamera::CAMERA_PAN_STOP ); break;
|
|
case IDC_BUTTON_RIGHT: pCamera->UICameraMovePTZ( lParam ? CLgUICamera::CAMERA_PAN_RIGHT : CLgUICamera::CAMERA_PAN_STOP ); break;
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
BOOL CLgUICameraControlWnd::Create( CWnd *pParentWnd, int x, int y, int nWidth, int nHeight )
|
|
{
|
|
if( !CDialog::CreateIndirect( (LPCDLGTEMPLATE)&VideoCameraControlDialogTemplate, pParentWnd ) )
|
|
return FALSE;
|
|
|
|
if( pParentWnd )
|
|
SetParent( pParentWnd );
|
|
|
|
if( nWidth < 0 || nHeight < 0 )
|
|
return TRUE;
|
|
|
|
MoveWindow( x, y, nWidth, nHeight );
|
|
|
|
EnableControl( FALSE );
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
BOOL CLgUICameraControlWnd::Link( CLgLink<CLgUICamera,CLgUICameraControlWnd>* pVideoCamera )
|
|
{
|
|
if( !CLgLink<CLgUICameraControlWnd,CLgUICamera>::Link( pVideoCamera ) )
|
|
return FALSE;
|
|
|
|
OnVideoCameraControl( *pVideoCamera, pVideoCamera->GetThis()->IsControlAvailible() );
|
|
return TRUE;
|
|
}
|
|
|
|
BOOL CLgUICameraControlWnd::Unlink( CLgLink<CLgUICamera,CLgUICameraControlWnd>* pVideoCamera )
|
|
{
|
|
if( !CLgLink<CLgUICameraControlWnd,CLgUICamera>::Unlink( pVideoCamera ) )
|
|
return FALSE;
|
|
|
|
if( GetSafeHwnd() )
|
|
EnableControl( FALSE );
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
BOOL CLgUICameraControlWnd::OnVideoCameraControl( CLgUICamera *pVideoCamera, BOOL bAvailible )
|
|
{
|
|
// check pointer
|
|
if( !pVideoCamera )
|
|
return FALSE;
|
|
|
|
// check camera link
|
|
CLgUICamera* pCurrentVideoCamera = *this;
|
|
if( pCurrentVideoCamera != pVideoCamera )
|
|
return FALSE;
|
|
|
|
return EnableControl( bAvailible );
|
|
}
|
|
|
|
BOOL CLgUICameraControlWnd::EnableControl( BOOL bEnable )
|
|
{
|
|
m_ButtonUp.EnableWindow( bEnable );
|
|
m_ButtonDown.EnableWindow( bEnable );
|
|
m_ButtonLeft.EnableWindow( bEnable );
|
|
m_ButtonRight.EnableWindow( bEnable );
|
|
m_ButtonTele.EnableWindow( bEnable );
|
|
m_ButtonWide.EnableWindow( bEnable );
|
|
return TRUE;
|
|
}
|