|
|
//----------------------------------------------------------------------------
// Laser Guard Ltd.
// Copyright � 2000-2002. All Rights Reserved.
// Version 1.0 01/01/2000
// Last modification: 08/10/2003
// PROJECT:
// SUBSYSTEM:
// FILE: TabControlDlg.cpp
// AUTHOR: Sergey Chizhevskiy
// OVERVIEW
// ~~~~~~~~
// Source file of TabControlDlg.cpp
//----------------------------------------------------------------------------
#include "stdafx.h"
#include "MultiIPIClient.h"
#include "TabControlDlg.h"
#include "MainDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;#endif
/////////////////////////////////////////////////////////////////////////////
// CTabControlDlg dialog
CTabControlDlg::CTabControlDlg(CWnd* pParent /*=NULL*/) : CDialog(CTabControlDlg::IDD, pParent){ //{{AFX_DATA_INIT(CTabControlDlg)
m_RadioSensitivity = -1; //}}AFX_DATA_INIT
}
void CTabControlDlg::DoDataExchange(CDataExchange* pDX){ CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CTabControlDlg)
DDX_Control(pDX, IDC_BUTTON_REPORT, m_ButtonReport); DDX_Control(pDX, IDC_BUTTON_PHOTO, m_ButtonPhoto); DDX_Control(pDX, IDC_CHECK_IRIS_NIGHT, m_CheckIrisNight); DDX_Control(pDX, IDC_CHECK_IRIS_DAY, m_CheckIrisDay); DDX_Control(pDX, IDC_CHECK_MUTE, m_CheckMute); DDX_Control(pDX, IDC_CHECK_HIDDEN_4, m_CheckHidden4); DDX_Control(pDX, IDC_CHECK_HIDDEN_3, m_CheckHidden3); DDX_Control(pDX, IDC_CHECK_HIDDEN_2, m_CheckHidden2); DDX_Control(pDX, IDC_CHECK_HIDDEN_1, m_CheckHidden1); DDX_Control(pDX, IDC_BUTTON_CLEAR, m_ButtonClear); DDX_Control(pDX, IDC_BUTTON_RESET, m_ButtonReset); DDX_Control(pDX, IDC_SLIDER, m_Slider); DDX_Control(pDX, IDC_STATIC_VIDEO, m_StaticVideo); DDX_Control(pDX, IDC_STATIC_LOCATOR, m_StaticLocator); DDX_Control(pDX, IDC_BUTTON_DOWN, m_ButtonDown); DDX_Control(pDX, IDC_BUTTON_UP, m_ButtonUp); DDX_Control(pDX, IDC_BUTTON_LEFT, m_ButtonLeft); DDX_Control(pDX, IDC_BUTTON_RIGHT, m_ButtonRight); DDX_Control(pDX, IDC_BUTTON_WIDE, m_ButtonWide); DDX_Control(pDX, IDC_BUTTON_TELE, m_ButtonTele); DDX_Radio(pDX, IDC_RADIO_SENSITIVITY, m_RadioSensitivity); //}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CTabControlDlg, CDialog) //{{AFX_MSG_MAP(CTabControlDlg)
ON_WM_PAINT() ON_BN_CLICKED(IDC_BUTTON_CLEAR, OnButtonClear) ON_BN_CLICKED(IDC_BUTTON_RESET, OnButtonReset) ON_WM_SHOWWINDOW() ON_BN_CLICKED(IDC_RADIO_SENSITIVITY, OnRadioSensitivity) ON_BN_CLICKED(IDC_CHECK_HIDDEN_1, OnCheckHidden) ON_BN_CLICKED(IDC_CHECK_MUTE, OnCheckMute) ON_BN_CLICKED(IDC_CHECK_IRIS_DAY, OnCheckIrisDay) ON_BN_CLICKED(IDC_CHECK_IRIS_NIGHT, OnCheckIrisNight) ON_WM_SIZE() ON_BN_CLICKED(IDC_BUTTON_PHOTO, OnButtonPhoto) ON_BN_CLICKED(IDC_RADIO_SENSITIVITY_MEDIUM, OnRadioSensitivity) ON_BN_CLICKED(IDC_RADIO_SENSITIVITY_HIGH, OnRadioSensitivity) ON_BN_CLICKED(IDC_CHECK_HIDDEN_2, OnCheckHidden) ON_BN_CLICKED(IDC_CHECK_HIDDEN_3, OnCheckHidden) ON_BN_CLICKED(IDC_CHECK_HIDDEN_4, OnCheckHidden) ON_BN_CLICKED(IDC_BUTTON_REPORT, OnButtonReport) //}}AFX_MSG_MAP
ON_MESSAGE( LG_BUTTON_BM_SET_STATE, OnLgButtonSetState ) ON_MESSAGE( LG_CAMERA_POSITION_CHANGED, OnLgCameraPositionChanged ) ON_MESSAGE( WM_VIDEO_READY, OnVideoReady )END_MESSAGE_MAP()
BOOL CTabControlDlg::OnInitDialog() { CDialog::OnInitDialog();
m_Slider.SetRange( 0, 100 ); m_Slider.SetPos( 20 ); CRect rect; m_StaticLocator.GetClientRect( &rect ); m_StaticLocator.MapWindowPoints( this, &rect );
m_CameraPositionWnd.Create( this, m_CameraPositionWndRect ); m_Locator.SetCameraPositionWnd( &m_CameraPositionWnd ); m_Locator.Create( this, rect );
m_StaticVideo.GetClientRect( &rect );// m_VideoDC.Create( rect.Width(), rect.Height(), RGB(0,0,0) );
m_VideoWnd.Create( this, rect );
m_CheckHidden1.SetBitmaps( IDB_BITMAP_USEVIEWZONE1, IDB_BITMAP_NOUSEVIEWZONE1 ); m_CheckHidden2.SetBitmaps( IDB_BITMAP_USEVIEWZONE2, IDB_BITMAP_NOUSEVIEWZONE2 ); m_CheckHidden3.SetBitmaps( IDB_BITMAP_USEVIEWZONE3, IDB_BITMAP_NOUSEVIEWZONE3 ); m_CheckHidden4.SetBitmaps( IDB_BITMAP_USEVIEWZONE4, IDB_BITMAP_NOUSEVIEWZONE4 );
m_ButtonUp.SetBitmaps( IDB_BITMAP_UP, IDB_BITMAP_UP ); m_ButtonDown.SetBitmaps( IDB_BITMAP_DOWN, IDB_BITMAP_DOWN ); m_ButtonLeft.SetBitmaps( IDB_BITMAP_LEFT, IDB_BITMAP_LEFT ); m_ButtonRight.SetBitmaps( IDB_BITMAP_RIGHT, IDB_BITMAP_RIGHT ); m_ButtonTele.SetBitmaps( IDB_BITMAP_TELE, IDB_BITMAP_TELE ); m_ButtonWide.SetBitmaps( IDB_BITMAP_WIDE, IDB_BITMAP_WIDE );
m_ButtonPhoto.SetBitmaps( IDB_BITMAP_CAPTURE, IDB_BITMAP_CAPTURE );
m_CheckIrisDay.SetBitmaps( IDB_BITMAP_DAY, IDB_BITMAP_DAY ); m_CheckIrisNight.SetBitmaps( IDB_BITMAP_NIGHT, IDB_BITMAP_NIGHT );
// m_pMainDlg->GetDeviceClient()->DoRemoteLgsSensitivity( LG_TCP_PACKET_LGS::LGS_SENSITIVITY_LOW );
if( !m_pMainDlg->GetDeviceClient()->DoRemoteLgsHiddenOn( FALSE, 0 ) ) { LGLOG( LOG_LEVEL_LOW, LOG_TYPE_ERROR, this, _T("CTabControlDlg::OnInitDialog"), _T("m_pMainDlg->GetDeviceClient()->DoRemoteLgsHiddenOn failed") ); } if( !m_pMainDlg->GetDeviceClient()->DoRemoteLgsConnect() ) { LGLOG( LOG_LEVEL_LOW, LOG_TYPE_ERROR, this, _T("CTabControlDlg::OnInitDialog"), _T("m_pMainDlg->GetDeviceClient()->DoRemoteLgsConnect failed") ); } if( !m_pMainDlg->GetDeviceClient()->DoRemoteLgsVoltage() ) { LGLOG( LOG_LEVEL_LOW, LOG_TYPE_ERROR, this, _T("CTabControlDlg::OnInitDialog"), _T("m_pMainDlg->GetDeviceClient()->DoRemoteLgsVoltage failed") ); } if( !m_pMainDlg->GetDeviceClient()->DoRemotePtzIris( FALSE, 0 ) ) { LGLOG( LOG_LEVEL_LOW, LOG_TYPE_ERROR, this, _T("CTabControlDlg::OnInitDialog"), _T("m_pMainDlg->GetDeviceClient()->DoRemotePtzIris failed") ); }
UpdateControlPosition();
return TRUE;}
void CTabControlDlg::OnPaint() { CPaintDC dc(this); // device context for painting
OnDraw( &dc );
RECT rect; GetClientRect( &rect );
// get skin info
CProgramSkin::SKIN skin; if( !m_pSkin->GetSkin( CProgramSkin::SKIN_CONTROL, skin ) ) return;
DIBSECTION DibSection; if( !::GetObject( skin.hBitmap, sizeof(DibSection), &DibSection ) ) return;
HDC hMemDC = ::CreateCompatibleDC( dc.GetSafeHdc() ); if( !hMemDC ) return;
HBITMAP hBitmap = (HBITMAP)::SelectObject( hMemDC, skin.hBitmap );
::BitBlt( dc.GetSafeHdc(), rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, hMemDC, 0, 0, SRCCOPY );
::SelectObject( hMemDC, hBitmap );
::DeleteDC( hMemDC );}
void CTabControlDlg::OnDraw( CDC *pDC ){// CRect rect;
// m_StaticVideo.GetClientRect( &rect );
// m_StaticVideo.MapWindowPoints( this, &rect );
// m_VideoDIB.Draw( pDC->GetSafeHdc(), &rect, TRUE );
}
LRESULT CTabControlDlg::OnLgCameraPositionChanged( WPARAM wParam, LPARAM lParam ){ return GetParent()->SendMessage( LG_CAMERA_POSITION_CHANGED, wParam, lParam );}
void CTabControlDlg::OnVideo( CLgImageDIB *pDIB, BYTE bSequence ){ // update image
if( IsWindowVisible() ) { m_VideoWnd.UpdateVideoDIB( pDIB, bSequence ); }}
LRESULT CTabControlDlg::OnVideoReady( WPARAM wParam, LPARAM lParam ){ if( !m_pMainDlg->GetDeviceClient()->DoRemoteVideo( m_Slider.GetPos(), wParam ) ) LGLOG( LOG_LEVEL_LOW, LOG_TYPE_ERROR, this, _T("CTabControlDlg::OnVideoReady"), _T("DoRemoteVideo failed") );
return TRUE;}
LRESULT CTabControlDlg::OnLgButtonSetState( WPARAM wParam, LPARAM lParam ){ CLgButton *pButton = (CLgButton*)GetDlgItem( lParam ); switch( pButton->GetDlgCtrlID() ) { case IDC_BUTTON_LEFT: m_Locator.MovePTZ( wParam ? CLocatorWnd::PAN_LEFT : CLocatorWnd::PAN_STOP ); break; case IDC_BUTTON_RIGHT: m_Locator.MovePTZ( wParam ? CLocatorWnd::PAN_RIGTH : CLocatorWnd::PAN_STOP ); break; case IDC_BUTTON_WIDE: m_Locator.MovePTZ( wParam ? CLocatorWnd::ZOOM_WIDE : CLocatorWnd::ZOOM_STOP ); break; case IDC_BUTTON_TELE: m_Locator.MovePTZ( wParam ? CLocatorWnd::ZOOM_TELE : CLocatorWnd::ZOOM_STOP ); break; case IDC_BUTTON_UP: m_Locator.MovePTZ( wParam ? CLocatorWnd::TILT_UP : CLocatorWnd::TILT_STOP ); break; case IDC_BUTTON_DOWN: m_Locator.MovePTZ( wParam ? CLocatorWnd::TILT_DOWN : CLocatorWnd::TILT_STOP ); break; }
return 0;}
BOOL CTabControlDlg::PreTranslateMessage( MSG* pMsg ) { switch( pMsg->message ) { case WM_KEYDOWN: switch( pMsg->wParam ) { case VK_UP: SendDlgItemMessage( IDC_BUTTON_UP, BM_SETSTATE, TRUE ); return TRUE; case VK_DOWN: SendDlgItemMessage( IDC_BUTTON_DOWN, BM_SETSTATE, TRUE ); return TRUE; case VK_LEFT: SendDlgItemMessage( IDC_BUTTON_LEFT, BM_SETSTATE, TRUE ); return TRUE; case VK_RIGHT: SendDlgItemMessage( IDC_BUTTON_RIGHT, BM_SETSTATE, TRUE ); return TRUE; case VK_HOME: case VK_ADD: SendDlgItemMessage( IDC_BUTTON_TELE, BM_SETSTATE, TRUE ); return TRUE; case VK_END: case VK_SUBTRACT: SendDlgItemMessage( IDC_BUTTON_WIDE, BM_SETSTATE, TRUE ); return TRUE; case VK_SPACE: m_pMainDlg->AlarmStop(); return TRUE; } break; case WM_KEYUP: switch( pMsg->wParam ) { case VK_UP: SendDlgItemMessage( IDC_BUTTON_UP, BM_SETSTATE, FALSE ); return TRUE; case VK_DOWN: SendDlgItemMessage( IDC_BUTTON_DOWN, BM_SETSTATE, FALSE ); return TRUE; case VK_LEFT: SendDlgItemMessage( IDC_BUTTON_LEFT, BM_SETSTATE, FALSE ); return TRUE; case VK_RIGHT: SendDlgItemMessage( IDC_BUTTON_RIGHT, BM_SETSTATE, FALSE ); return TRUE; case VK_HOME: case VK_ADD: SendDlgItemMessage( IDC_BUTTON_TELE, BM_SETSTATE, FALSE ); return TRUE; case VK_END: case VK_SUBTRACT: SendDlgItemMessage( IDC_BUTTON_WIDE, BM_SETSTATE, FALSE ); return TRUE; } break; }
return CDialog::PreTranslateMessage(pMsg);}
void CTabControlDlg::OnButtonClear() { m_Locator.Clear(); if( !m_pMainDlg->GetDeviceClient()->DoRemoteLgsClear() ) { LGLOG( LOG_LEVEL_LOW, LOG_TYPE_ERROR, this, _T("CTabControlDlg::OnButtonClear"), _T("m_pMainDlg->GetDeviceClient()->DoRemoteLgsClear failed") ); }
m_pMainDlg->AlarmReset();}
void CTabControlDlg::OnButtonReset() { if( m_pMainDlg->GetDeviceClient()->DoRemoteLgsReset() ) m_ButtonReset.EnableWindow( FALSE ); else LGLOG( LOG_LEVEL_LOW, LOG_TYPE_ERROR, this, _T("CTabControlDlg::OnButtonReset"), _T("m_pMainDlg->GetDeviceClient()->DoRemoteLgsReset failed") );
m_pMainDlg->AlarmReset();}
void CTabControlDlg::OnShowWindow(BOOL bShow, UINT nStatus) { CDialog::OnShowWindow(bShow, nStatus); if( bShow ) { if( !m_pMainDlg->GetDeviceClient()->DoRemoteVideo( m_Slider.GetPos(), 0 ) ) { LGLOG( LOG_LEVEL_LOW, LOG_TYPE_ERROR, this, _T("CTabControlDlg::OnShowWindow"), _T("m_pMainDlg->GetDeviceClient()->DoRemoteVideo failed") ); } }}
void CTabControlDlg::OnConnect(BOOL bConnected){ if( IsWindowVisible() ) { if( !m_pMainDlg->GetDeviceClient()->DoRemoteVideo( m_Slider.GetPos(), 0 ) ) { LGLOG( LOG_LEVEL_LOW, LOG_TYPE_ERROR, this, _T("CTabControlDlg::OnConnect"), _T("m_pMainDlg->GetDeviceClient()->DoRemoteVideo failed") ); } }
// m_pMainDlg->GetDeviceClient()->DoRemoteLgsSensitivity( LG_TCP_PACKET_LGS::LGS_SENSITIVITY_LOW );
if( !m_pMainDlg->GetDeviceClient()->DoRemoteLgsHiddenOn( FALSE, 0 ) ) { LGLOG( LOG_LEVEL_LOW, LOG_TYPE_ERROR, this, _T("CTabControlDlg::OnConnect"), _T("m_pMainDlg->GetDeviceClient()->DoRemoteLgsHiddenOn failed") ); } if( !m_pMainDlg->GetDeviceClient()->DoRemoteLgsConnect() ) { LGLOG( LOG_LEVEL_LOW, LOG_TYPE_ERROR, this, _T("CTabControlDlg::OnConnect"), _T("m_pMainDlg->GetDeviceClient()->DoRemoteLgsConnect failed") ); } if( !m_pMainDlg->GetDeviceClient()->DoRemoteLgsVoltage() ) { LGLOG( LOG_LEVEL_LOW, LOG_TYPE_ERROR, this, _T("CTabControlDlg::OnConnect"), _T("m_pMainDlg->GetDeviceClient()->DoRemoteLgsVoltage failed") ); } if( !m_pMainDlg->GetDeviceClient()->DoRemotePtzIris( FALSE, 0 ) ) { LGLOG( LOG_LEVEL_LOW, LOG_TYPE_ERROR, this, _T("CTabControlDlg::OnConnect"), _T("m_pMainDlg->GetDeviceClient()->DoRemotePtzIris failed") ); }
if( bConnected ) { if( !m_pMainDlg->GetDeviceClient()->DoRemoteLgsBorder() ) { LGLOG( LOG_LEVEL_LOW, LOG_TYPE_ERROR, this, _T("CTabControlDlg::OnConnect"), _T("m_pMainDlg->GetDeviceClient()->DoRemoteLgsBorder failed") ); } if( !m_pMainDlg->GetDeviceClient()->DoRemoteReportList( REMOTE_CONTEXT_CLIENT, NULL, 0 ) ) { LGLOG( LOG_LEVEL_LOW, LOG_TYPE_ERROR, this, _T("CTabControlDlg::OnConnect"), _T("m_pMainDlg->GetDeviceClient()->DoRemoteReportList failed") ); } if( !m_pMainDlg->GetDeviceClient()->DoRemotePtzPosition( FALSE, 0,0,0 ) ) { LGLOG( LOG_LEVEL_LOW, LOG_TYPE_ERROR, this, _T("CTabControlDlg::OnConnect"), _T("m_pMainDlg->GetDeviceClient()->DoRemotePtzPosition failed") ); } }}
void CTabControlDlg::OnRadioSensitivity() { UpdateData( TRUE ); switch( m_RadioSensitivity ) { case 0:// m_pMainDlg->GetDeviceClient()->DoRemoteLgsSensitivity( LG_TCP_PACKET_LGS::LGS_SENSITIVITY_LOW );
break; case 1:// m_pMainDlg->GetDeviceClient()->DoRemoteLgsSensitivity( LG_TCP_PACKET_LGS::LGS_SENSITIVITY_MEDIUM );
break; case 2:// m_pMainDlg->GetDeviceClient()->DoRemoteLgsSensitivity( LG_TCP_PACKET_LGS::LGS_SENSITIVITY_HIGH );
break; }}
void CTabControlDlg::OnCheckHidden() { BYTE bOn = 0; if( m_CheckHidden1.GetCheck() ) bOn |= LG_TCP_PACKET_LGS::LGS_HIDDEN_ON_ZONE_1; if( m_CheckHidden2.GetCheck() ) bOn |= LG_TCP_PACKET_LGS::LGS_HIDDEN_ON_ZONE_2; if( m_CheckHidden3.GetCheck() ) bOn |= LG_TCP_PACKET_LGS::LGS_HIDDEN_ON_ZONE_3; if( m_CheckHidden4.GetCheck() ) bOn |= LG_TCP_PACKET_LGS::LGS_HIDDEN_ON_ZONE_4;
if( !m_pMainDlg->GetDeviceClient()->DoRemoteLgsHiddenOn( TRUE, bOn ) ) { LGLOG( LOG_LEVEL_LOW, LOG_TYPE_ERROR, this, _T("CTabControlDlg::OnCheckHidden"), _T("m_pMainDlg->GetDeviceClient()->DoRemoteLgsHiddenOn failed") ); }}
void CTabControlDlg::OnCheckMute() { m_pMainDlg->AlarmMute( !m_CheckMute.GetCheck() );
CProgramSkin::SKIN skin;
if( m_CheckMute.GetCheck() ) { if( m_pSkin->GetSkin( CProgramSkin::SKIN_CONTROL_SOUND_OFF, skin ) ) m_CheckMute.SetBitmap( skin.hBitmap ); } else { if( m_pSkin->GetSkin( CProgramSkin::SKIN_CONTROL_SOUND_ON, skin ) ) m_CheckMute.SetBitmap( skin.hBitmap ); }}
BOOL CTabControlDlg::SetIris(BOOL bDay){ m_CheckIrisDay.SetCheck( bDay ); m_CheckIrisNight.SetCheck( !bDay ); return TRUE;}
void CTabControlDlg::OnCheckIrisDay() { SetIris( TRUE );
if( !m_pMainDlg->GetDeviceClient()->DoRemotePtzIris( TRUE, TRUE ) ) { LGLOG( LOG_LEVEL_LOW, LOG_TYPE_ERROR, this, _T("CTabControlDlg::OnCheckIrisDay"), _T("m_pMainDlg->GetDeviceClient()->DoRemotePtzIris failed") ); }}
void CTabControlDlg::OnCheckIrisNight() { SetIris( FALSE );
if( !m_pMainDlg->GetDeviceClient()->DoRemotePtzIris( TRUE, FALSE ) ) { LGLOG( LOG_LEVEL_LOW, LOG_TYPE_ERROR, this, _T("CTabControlDlg::OnCheckIrisNight"), _T("m_pMainDlg->GetDeviceClient()->DoRemotePtzIris failed") ); }}
void CTabControlDlg::OnSize(UINT nType, int cx, int cy) { CDialog::OnSize(nType, cx, cy);}
void CTabControlDlg::UpdateControlPosition(){ CProgramSkin::SKIN skin; if( m_pSkin->GetSkin( CProgramSkin::SKIN_CONTROL_VIDEO, skin ) ) { m_StaticVideo.MoveWindow( &skin.rect );// m_VideoDC.Create( skin.rect.right - skin.rect.left, skin.rect.bottom - skin.rect.top, RGB(0,0,0) );
m_VideoWnd.MoveWindow( &skin.rect ); }
if( m_pSkin->GetSkin( CProgramSkin::SKIN_CONTROL_LOCATOR, skin ) && m_Locator.GetSafeHwnd() ) { m_StaticLocator.MoveWindow( &skin.rect ); m_Locator.MoveWindow( &skin.rect ); }
if( m_pSkin->GetSkin( CProgramSkin::SKIN_CONTROL_CLEAR, skin ) ) { m_ButtonClear.MoveWindow( &skin.rect ); m_ButtonClear.SetBitmap( skin.hBitmap ); }
if( m_pSkin->GetSkin( CProgramSkin::SKIN_CONTROL_SOUND_ON, skin ) ) { m_CheckMute.MoveWindow( &skin.rect ); m_CheckMute.SetBitmap( skin.hBitmap ); }
if( m_pSkin->GetSkin( CProgramSkin::SKIN_CONTROL_RESET, skin ) ) { m_ButtonReset.MoveWindow( &skin.rect ); m_ButtonReset.SetBitmap( skin.hBitmap ); }
if( m_pSkin->GetSkin( CProgramSkin::SKIN_CONTROL_REPORT, skin ) ) { m_ButtonReport.MoveWindow( &skin.rect ); m_ButtonReport.SetBitmap( skin.hBitmap ); }
if( m_pSkin->GetSkin( CProgramSkin::SKIN_CONTROL_PTZ_TILT, skin ) ) m_CameraPositionWnd.MoveWindow( &skin.rect );
if( m_pSkin->GetSkin( CProgramSkin::SKIN_CONTROL_QUALITY, skin ) ) m_Slider.MoveWindow( &skin.rect );
if( m_pSkin->GetSkin( CProgramSkin::SKIN_CONTROL_MASK, skin ) ) { CRect br; m_CheckHidden1.GetWindowRect( &br );
INT nWidth = skin.rect.right - skin.rect.left; INT nHeight = skin.rect.bottom - skin.rect.top;
INT nSpace = 3;
INT nDeltaX = ( nWidth - ( br.Width() * 2 + nSpace ) ) / 2 + skin.rect.left; INT nDeltaY = ( nHeight - ( br.Height() * 2 + nSpace ) ) / 2 + skin.rect.top;
CRect rh1( nDeltaX, nDeltaY, nDeltaX + br.Width(), nDeltaY + br.Height() ); m_CheckHidden1.MoveWindow( &rh1 );
CRect rh2( rh1.right + nSpace, nDeltaY, rh1.right + nSpace + br.Width(), nDeltaY + br.Height() ); m_CheckHidden2.MoveWindow( &rh2 );
CRect rh3( rh1.left, rh1.bottom + nSpace, rh1.right, rh1.bottom + nSpace + br.Height() ); m_CheckHidden3.MoveWindow( &rh3 );
CRect rh4( rh1.right + nSpace, rh1.bottom + nSpace, rh1.right + nSpace + br.Width(), rh1.bottom + nSpace + br.Height() ); m_CheckHidden4.MoveWindow( &rh4 ); } if( m_pSkin->GetSkin( CProgramSkin::SKIN_CONTROL_SENSITIVITY, skin ) ) { CRect br; GetDlgItem( IDC_RADIO_SENSITIVITY_HIGH )->GetWindowRect( &br );
INT nWidth = skin.rect.right - skin.rect.left; INT nHeight = skin.rect.bottom - skin.rect.top;
INT nSpace = 3;
INT nDeltaX = ( nWidth - br.Width() ) / 2 + skin.rect.left; INT nDeltaY = ( nHeight - ( br.Height() * 3 + nSpace * 2 ) ) / 2 + skin.rect.top;
CRect rh1( nDeltaX, nDeltaY, nDeltaX + br.Width(), nDeltaY + br.Height() ); GetDlgItem( IDC_RADIO_SENSITIVITY_HIGH )->MoveWindow( &rh1 );
CRect rh2( nDeltaX, rh1.bottom + nSpace, nDeltaX + br.Width(), rh1.bottom + nSpace + br.Height() ); GetDlgItem( IDC_RADIO_SENSITIVITY_MEDIUM )->MoveWindow( &rh2 );
CRect rh3( nDeltaX, rh2.bottom + nSpace, nDeltaX + br.Width(), rh2.bottom + nSpace + br.Height() ); GetDlgItem( IDC_RADIO_SENSITIVITY )->MoveWindow( &rh3 ); }
if( m_pSkin->GetSkin( CProgramSkin::SKIN_CONTROL_PTZ, skin ) ) { CRect br; m_ButtonUp.GetWindowRect( &br );
INT nWidth = skin.rect.right - skin.rect.left; INT nHeight = skin.rect.bottom - skin.rect.top;
INT nSpace = 0;
INT nDeltaX = ( nWidth - ( br.Width() * 3 + nSpace * 2 ) ) / 2 + skin.rect.left; INT nDeltaY = ( nHeight - ( br.Height() * 5 + nSpace * 4 ) ) / 2 + skin.rect.top;
CRect rh1( nDeltaX + nSpace + br.Width(), nDeltaY, nDeltaX + nSpace + br.Width() * 2, nDeltaY + br.Height() ); m_ButtonUp.MoveWindow( &rh1 );
CRect rh2( nDeltaX, rh1.bottom + nSpace, nDeltaX + br.Width(), rh1.bottom + nSpace + br.Height() ); m_ButtonLeft.MoveWindow( &rh2 );
CRect rh3( rh1.right + nSpace, rh2.top, rh1.right + nSpace + br.Width(), rh2.bottom ); m_ButtonRight.MoveWindow( &rh3 );
CRect rh4( rh1.left, rh2.bottom + nSpace, rh1.right, rh2.bottom + nSpace + br.Height() ); m_ButtonDown.MoveWindow( &rh4 );
CRect rh5( rh2.left, rh4.bottom + nSpace, rh2.right, rh4.bottom + nSpace + br.Height() ); m_ButtonTele.MoveWindow( &rh5 );
CRect rh6( rh2.left, rh5.bottom + nSpace, rh2.right, rh5.bottom + nSpace + br.Height() ); m_ButtonWide.MoveWindow( &rh6 );
CRect rh7( rh3.left, rh5.top, rh3.right, rh5.bottom ); m_CheckIrisDay.MoveWindow( &rh7 );
CRect rh8( rh3.left, rh6.top, rh3.right, rh6.bottom ); m_CheckIrisNight.MoveWindow( &rh8 );
CRect rh9( rh1.left, rh6.top, rh1.right, rh6.bottom ); m_ButtonPhoto.MoveWindow( &rh9 ); }
/*
// space between controls
INT nSpace = 5;
// store client rect of control
CRect ClientRect; GetClientRect( &ClientRect );
// set video frame
CRect VideoRect; VideoRect.SetRect( nSpace, nSpace, nSpace + ( ClientRect.Width() - nSpace ) * 4 / 7, nSpace + ( ClientRect.Width() - nSpace ) * 3 / 7 ); m_StaticVideo.MoveWindow( &VideoRect ); m_VideoDC.Create( VideoRect.Width(), VideoRect.Height(), RGB(0,0,0) );
// set locator frame
CRect LocatorRect; LocatorRect.SetRect( VideoRect.right + nSpace, nSpace, ClientRect.right - nSpace, VideoRect.bottom ); m_StaticLocator.MoveWindow( &LocatorRect ); if( m_Locator.GetSafeHwnd() ) m_Locator.MoveWindow( &LocatorRect );
// calculate control button size
CRect LgButtonRect; m_ButtonUp.GetWindowRect( &LgButtonRect ); LgButtonRect.OffsetRect( -LgButtonRect.TopLeft() );
// control shift
INT nControlSpace = (VideoRect.Width() - LgButtonRect.Width() * 10 - nSpace * 9) / 2;
// set slider rect
CRect SliderRect; SliderRect.SetRect( nControlSpace + nSpace, VideoRect.bottom + nSpace, nControlSpace + nSpace + LgButtonRect.Width(), VideoRect.bottom + nSpace * 2 + LgButtonRect.Height() * 2 ); m_Slider.MoveWindow( &SliderRect );
// set button up rect
CRect ButtonUpRect; ButtonUpRect.SetRect( SliderRect.right + nSpace * 3 + LgButtonRect.Width() * 2, VideoRect.bottom + nSpace, SliderRect.right + nSpace * 3 + LgButtonRect.Width() * 3, VideoRect.bottom + nSpace + LgButtonRect.Height() ); m_ButtonUp.MoveWindow( &ButtonUpRect );
// set button down rect
CRect ButtonDownRect; ButtonDownRect.SetRect( SliderRect.right + nSpace * 3 + LgButtonRect.Width() * 2, VideoRect.bottom + nSpace*2 + LgButtonRect.Width(), SliderRect.right + nSpace * 3 + LgButtonRect.Width() * 3, VideoRect.bottom + nSpace*2 + LgButtonRect.Height()*2 ); m_ButtonDown.MoveWindow( &ButtonDownRect );
// set button left rect
CRect ButtonLeftRect; ButtonLeftRect.SetRect( SliderRect.right + nSpace * 2 + LgButtonRect.Width(), VideoRect.bottom + nSpace*2 + LgButtonRect.Width(), SliderRect.right + nSpace * 2 + LgButtonRect.Width() * 2, VideoRect.bottom + nSpace*2 + LgButtonRect.Height()*2 ); m_ButtonLeft.MoveWindow( &ButtonLeftRect );
// set button right rect
CRect ButtonRightRect; ButtonRightRect.SetRect( SliderRect.right + nSpace * 4 + LgButtonRect.Width()* 3, VideoRect.bottom + nSpace*2 + LgButtonRect.Width(), SliderRect.right + nSpace * 4 + LgButtonRect.Width() * 4, VideoRect.bottom + nSpace * 2 + LgButtonRect.Height()*2 ); m_ButtonRight.MoveWindow( &ButtonRightRect );
// set button wide rect
CRect ButtonTeleRect; ButtonTeleRect.SetRect( ButtonRightRect.right + nSpace * 2 + LgButtonRect.Width(), VideoRect.bottom + nSpace, ButtonRightRect.right + nSpace * 2 + LgButtonRect.Width() * 2, VideoRect.bottom + nSpace + LgButtonRect.Height() ); m_ButtonTele.MoveWindow( &ButtonTeleRect );
// set button wide rect
CRect ButtonWideRect; ButtonWideRect.SetRect( ButtonRightRect.right + nSpace * 2 + LgButtonRect.Width(), VideoRect.bottom + nSpace * 2 + LgButtonRect.Height(), ButtonRightRect.right + nSpace * 2 + LgButtonRect.Width() * 2, VideoRect.bottom + nSpace * 2 + LgButtonRect.Height() * 2 ); m_ButtonWide.MoveWindow( &ButtonWideRect );
// set button day rect
CRect ButtonDayRect; ButtonDayRect.SetRect( ButtonTeleRect.right + nSpace * 2 + LgButtonRect.Width(), VideoRect.bottom + nSpace, ButtonTeleRect.right + nSpace * 2 + LgButtonRect.Width() * 2, VideoRect.bottom + nSpace + LgButtonRect.Height() ); m_CheckIrisDay.MoveWindow( &ButtonDayRect );
// set button night rect
CRect ButtonNightRect; ButtonNightRect.SetRect( ButtonTeleRect.right + nSpace * 2 + LgButtonRect.Width(), VideoRect.bottom + nSpace*2 + LgButtonRect.Height(), ButtonTeleRect.right + nSpace * 2 + LgButtonRect.Width() * 2, VideoRect.bottom + nSpace*2 + LgButtonRect.Height()*2 ); m_CheckIrisNight.MoveWindow( &ButtonNightRect );
// set button photo rect
CRect ButtonPhotoRect; ButtonPhotoRect.SetRect( ButtonTeleRect.right + nSpace * 3 + LgButtonRect.Width()*2, VideoRect.bottom + nSpace, ButtonTeleRect.right + nSpace * 3 + LgButtonRect.Width() * 3, VideoRect.bottom + nSpace + LgButtonRect.Height() ); m_ButtonPhoto.MoveWindow( &ButtonPhotoRect );
// locator space
INT nLocatorSpace = (LocatorRect.Width() - LgButtonRect.Width() * 8 - nSpace * 7) / 2;
// set sensitivity buttons height
INT nButtonSensitivityHeight = ( nSpace + LgButtonRect.Height() * 2 ) / 3;
// set sensitivity1 rect
CRect Sensitivity1Rect; Sensitivity1Rect.SetRect( LocatorRect.left + nLocatorSpace, LocatorRect.bottom + nSpace, LocatorRect.left + nLocatorSpace + LgButtonRect.Width() * 2 + nSpace, LocatorRect.bottom + nSpace + nButtonSensitivityHeight ); GetDlgItem( IDC_RADIO_SENSITIVITY )->MoveWindow( &Sensitivity1Rect );
// set sensitivity2 rect
CRect Sensitivity2Rect; Sensitivity2Rect.SetRect( LocatorRect.left + nLocatorSpace, LocatorRect.bottom + nSpace + nButtonSensitivityHeight, LocatorRect.left + nLocatorSpace + LgButtonRect.Width() * 2 + nSpace, LocatorRect.bottom + nSpace + nButtonSensitivityHeight * 2 ); GetDlgItem( IDC_RADIO_SENSITIVITY_MEDIUM )->MoveWindow( &Sensitivity2Rect );
// set sensitivity3 rect
CRect Sensitivity3Rect; Sensitivity3Rect.SetRect( LocatorRect.left + nLocatorSpace, LocatorRect.bottom + nSpace + nButtonSensitivityHeight * 2, LocatorRect.left + nLocatorSpace + LgButtonRect.Width() * 2 + nSpace, LocatorRect.bottom + nSpace + nButtonSensitivityHeight * 3 ); GetDlgItem( IDC_RADIO_SENSITIVITY_HIGH )->MoveWindow( &Sensitivity3Rect ); // store full sensitivity rect
m_CameraPositionWndRect.SetRect( Sensitivity1Rect.TopLeft(), Sensitivity3Rect.BottomRight() ); if( m_CameraPositionWnd.GetSafeHwnd() ) m_CameraPositionWnd.MoveWindow( &m_CameraPositionWndRect );
// set hidden 1 rect
CRect Hidden1Rect; Hidden1Rect.SetRect( Sensitivity3Rect.right + nSpace * 2 + LgButtonRect.Width(), LocatorRect.bottom + nSpace, Sensitivity3Rect.right + nSpace * 2 + LgButtonRect.Width()*2, LocatorRect.bottom + nSpace + LgButtonRect.Height() ); m_CheckHidden1.MoveWindow( &Hidden1Rect );
// set hidden 2 rect
CRect Hidden2Rect; Hidden2Rect.SetRect( Sensitivity3Rect.right + nSpace * 3 + LgButtonRect.Width()*2, LocatorRect.bottom + nSpace, Sensitivity3Rect.right + nSpace * 3 + LgButtonRect.Width()*3, LocatorRect.bottom + nSpace + LgButtonRect.Height() ); m_CheckHidden2.MoveWindow( &Hidden2Rect );
// set hidden 3 rect
CRect Hidden3Rect; Hidden3Rect.SetRect( Sensitivity3Rect.right + nSpace * 2 + LgButtonRect.Width(), LocatorRect.bottom + nSpace*2 + LgButtonRect.Height(), Sensitivity3Rect.right + nSpace * 2 + LgButtonRect.Width()*2, LocatorRect.bottom + nSpace*2 + LgButtonRect.Height()*2 ); m_CheckHidden3.MoveWindow( &Hidden3Rect );
// set hidden 4 rect
CRect Hidden4Rect; Hidden4Rect.SetRect( Sensitivity3Rect.right + nSpace * 3 + LgButtonRect.Width()*2, LocatorRect.bottom + nSpace*2 + LgButtonRect.Height(), Sensitivity3Rect.right + nSpace * 3 + LgButtonRect.Width()*3, LocatorRect.bottom + nSpace*2 + LgButtonRect.Height()*2 ); m_CheckHidden4.MoveWindow( &Hidden4Rect );
// set clear rect
CRect ClearRect; ClearRect.SetRect( Hidden4Rect.right + nSpace * 2 + LgButtonRect.Width(), LocatorRect.bottom + nSpace, Hidden4Rect.right + nSpace * 3 + LgButtonRect.Width()*3, LocatorRect.bottom + nSpace + nButtonSensitivityHeight ); m_ButtonClear.MoveWindow( &ClearRect );
// set reset rect
CRect ResetRect; ResetRect.SetRect( ClearRect.left, ClearRect.bottom, ClearRect.right, ClearRect.bottom + nButtonSensitivityHeight ); m_ButtonReset.MoveWindow( &ResetRect );
// set mute rect
CRect MuteRect; MuteRect.SetRect( ResetRect.left, ResetRect.bottom, ResetRect.right, ResetRect.bottom + nButtonSensitivityHeight ); m_CheckMute.MoveWindow( &MuteRect );*/}
void CTabControlDlg::OnButtonPhoto() { if( !m_pMainDlg->GetDeviceClient()->DoRemoteLgsPhoto() ) { LGLOG( LOG_LEVEL_LOW, LOG_TYPE_ERROR, this, _T("CTabControlDlg::OnButtonPhoto"), _T("m_pMainDlg->GetDeviceClient()->DoRemoteLgsPhoto failed") ); }}
void CTabControlDlg::SetSkin(CProgramSkin *pProgramSkin){ m_pSkin = pProgramSkin;}
void CTabControlDlg::OnButtonReport() { m_pMainDlg->ShowReport( TRUE );}
|