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.
236 lines
7.2 KiB
236 lines
7.2 KiB
//----------------------------------------------------------------------------
|
|
// Laser Guard Ltd.
|
|
// Copyright © 2000-2002. All Rights Reserved.
|
|
// Version 1.0 01/01/2000
|
|
// Last modification: 08/10/2003
|
|
// PROJECT:
|
|
// SUBSYSTEM:
|
|
// FILE: SetupFixedVideoDlg.cpp
|
|
// AUTHOR: Sergey Chizhevskiy
|
|
// OVERVIEW
|
|
// ~~~~~~~~
|
|
// Source file of SetupFixedVideoDlg.cpp
|
|
//----------------------------------------------------------------------------
|
|
#include "stdafx.h"
|
|
#include "resource.h"
|
|
#include "SetupFixedVideoDlg.h"
|
|
#include "..\LgLib\Video\LgDirectShowVideoInputEnum.h"
|
|
#include "..\LgLib\Version.h"
|
|
|
|
CSetupFixedVideoDlg::CSetupFixedVideoDlg()
|
|
{
|
|
|
|
}
|
|
|
|
CSetupFixedVideoDlg::~CSetupFixedVideoDlg()
|
|
{
|
|
|
|
}
|
|
|
|
BOOL CSetupFixedVideoDlg::DoModal( PPROFILE_DATA pRofileData, CLocatorRegionArray *pRegionArray, HBITMAP hBackground, HWND hParent )
|
|
{
|
|
// get hinstance handle
|
|
HINSTANCE hInstance = (HINSTANCE)::GetWindowLong( hParent, GWL_HINSTANCE );
|
|
|
|
// store data
|
|
m_Data = *pRofileData;
|
|
m_RegionArray = *pRegionArray;
|
|
m_hBackground = hBackground;
|
|
|
|
// call edit dialog
|
|
if( CGenericWnd::DoModal( hInstance, (LPCTSTR)IDD_SETUP_FIXED_VIDEO_DLG, hParent ) == IDOK )
|
|
{
|
|
// update data
|
|
*pRofileData = m_Data;
|
|
*pRegionArray = m_RegionArray;
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
LRESULT CSetupFixedVideoDlg::OnCommand( WPARAM wParam, LPARAM )
|
|
{
|
|
UINT nCtrlId = LOWORD( wParam );
|
|
|
|
switch( nCtrlId )
|
|
{
|
|
case IDOK:
|
|
if( HIWORD(wParam) == BN_CLICKED )
|
|
OnButtonOk();
|
|
break;
|
|
|
|
case IDCANCEL:
|
|
if( HIWORD(wParam) == BN_CLICKED )
|
|
EndDialog( IDCANCEL );
|
|
break;
|
|
|
|
case IDC_CHECK_FIXED_VIDEO_ENABLE:
|
|
if( HIWORD(wParam) == BN_CLICKED )
|
|
OnCheckEnable();
|
|
break;
|
|
|
|
case IDC_CHECK_EDIT_LINE:
|
|
if( HIWORD(wParam) == BN_CLICKED )
|
|
OnCheckEditLine();
|
|
break;
|
|
|
|
case IDC_CHECK_EDIT_POINT:
|
|
if( HIWORD(wParam) == BN_CLICKED )
|
|
OnCheckEditPoint();
|
|
break;
|
|
|
|
case IDC_BUTTON_CLEAR:
|
|
OnButtonClear();
|
|
}
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
LRESULT CSetupFixedVideoDlg::OnInitDialog( WPARAM, LPARAM )
|
|
{
|
|
// create locator window
|
|
RECT rect;
|
|
::GetClientRect( GetDlgItem( IDC_STATIC_LOCATOR ), &rect );
|
|
::MapWindowPoints( GetDlgItem( IDC_STATIC_LOCATOR ), GetSafeHwnd(), (LPPOINT)&rect, 2 );
|
|
|
|
m_LocatorWnd.Create( GetSafeHwnd(), rect.left, rect.top,
|
|
rect.right - rect.left, rect.bottom - rect.top );
|
|
|
|
// get hinstance handle
|
|
HINSTANCE hInstance = (HINSTANCE)::GetWindowLong( GetSafeHwnd(), GWL_HINSTANCE );
|
|
|
|
// set locator background
|
|
m_LocatorWnd.SetBackground( m_hBackground );
|
|
|
|
// set region array
|
|
m_LocatorWnd.SetRegionArray( &m_RegionArray );
|
|
|
|
// adjust controls
|
|
::CheckRadioButton( GetSafeHwnd(), IDC_RADIO_FIXED_VIDEO_INPUT1, IDC_RADIO_FIXED_VIDEO_INPUT4, m_Data.FixedVideoInput + IDC_RADIO_FIXED_VIDEO_INPUT1 );
|
|
// ::CheckRadioButton( GetSafeHwnd(), IDC_RADIO_FIXED_VIDEO_DEVICE1, IDC_RADIO_FIXED_VIDEO_DEVICE4, m_Data.FixedVideoDevice + IDC_RADIO_FIXED_VIDEO_DEVICE1 );
|
|
::SendDlgItemMessage( GetSafeHwnd(), IDC_COMBO_VIDEO_DEVICE, CB_RESETCONTENT, 0, 0 );
|
|
CLgDirectShowVideoInputEnum vie;
|
|
if( vie.Create() )
|
|
{
|
|
for( INT i = 0; i < vie.GetVideoInputDeviceCount(); i++ )
|
|
{
|
|
CLgDirectShowVideoInputEnum::DSVID_INFO DeviceInfo;
|
|
if( vie.GetVideoInputDeviceInfo( i, &DeviceInfo ) )
|
|
::SendDlgItemMessage( GetSafeHwnd(), IDC_COMBO_VIDEO_DEVICE, CB_ADDSTRING, 0, (LPARAM)DeviceInfo.pFrendlyName );
|
|
}
|
|
::SendDlgItemMessage( GetSafeHwnd(), IDC_COMBO_VIDEO_DEVICE, CB_SETCURSEL, m_Data.FixedVideoDevice, 0 );
|
|
}
|
|
::CheckRadioButton( GetSafeHwnd(), IDC_RADIO_FIXED_VIDEO_PAL, IDC_RADIO_FIXED_VIDEO_NTSC, m_Data.FixedVideoStandart + IDC_RADIO_FIXED_VIDEO_PAL );
|
|
::SendDlgItemMessage( GetSafeHwnd(), IDC_CHECK_FIXED_VIDEO_ENABLE, BM_SETCHECK, m_Data.FixedVideoEnable, 0 );
|
|
|
|
// update dynamic controls
|
|
OnCheckEnable();
|
|
OnCheckEditLine();
|
|
OnCheckEditPoint();
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
void CSetupFixedVideoDlg::OnButtonOk()
|
|
{
|
|
// fixed video parameters
|
|
for( INT i = IDC_RADIO_FIXED_VIDEO_INPUT1; i <= IDC_RADIO_FIXED_VIDEO_INPUT4; i++ )
|
|
{
|
|
if( SendDlgItemMessage( i, BM_GETCHECK, 0, 0 ) == BST_CHECKED )
|
|
{
|
|
m_Data.FixedVideoInput = i - IDC_RADIO_FIXED_VIDEO_INPUT1;
|
|
break;
|
|
}
|
|
}
|
|
/*
|
|
for( i = IDC_RADIO_FIXED_VIDEO_DEVICE1; i <= IDC_RADIO_FIXED_VIDEO_DEVICE4; i++ )
|
|
{
|
|
if( SendDlgItemMessage( i, BM_GETCHECK, 0, 0 ) == BST_CHECKED )
|
|
{
|
|
m_Data.FixedVideoDevice = i - IDC_RADIO_FIXED_VIDEO_DEVICE1;
|
|
break;
|
|
}
|
|
}
|
|
*/
|
|
m_Data.FixedVideoDevice = ::SendDlgItemMessage( GetSafeHwnd(), IDC_COMBO_VIDEO_DEVICE, CB_GETCURSEL, 0, 0 );
|
|
|
|
for( i = IDC_RADIO_FIXED_VIDEO_PAL; i <= IDC_RADIO_FIXED_VIDEO_NTSC; i++ )
|
|
{
|
|
if( SendDlgItemMessage( i, BM_GETCHECK, 0, 0 ) == BST_CHECKED )
|
|
{
|
|
m_Data.FixedVideoStandart = i - IDC_RADIO_FIXED_VIDEO_PAL;
|
|
break;
|
|
}
|
|
}
|
|
m_Data.FixedVideoEnable = SendDlgItemMessage( IDC_CHECK_FIXED_VIDEO_ENABLE, BM_GETCHECK, 0, 0 );
|
|
|
|
m_RegionArray = m_LocatorWnd.GetRegionArray();
|
|
|
|
EndDialog( IDOK );
|
|
}
|
|
|
|
void CSetupFixedVideoDlg::OnButtonClear()
|
|
{
|
|
m_LocatorWnd.ClearRegions();
|
|
}
|
|
|
|
void CSetupFixedVideoDlg::OnCheckEnable()
|
|
{
|
|
// get enable flag
|
|
BOOL bEnable = SendDlgItemMessage( IDC_CHECK_FIXED_VIDEO_ENABLE, BM_GETCHECK, 0, 0 );
|
|
|
|
// enable controls according to enable flag
|
|
::EnableWindow( GetDlgItem( IDC_RADIO_FIXED_VIDEO_DEVICE1 ), bEnable );
|
|
::EnableWindow( GetDlgItem( IDC_RADIO_FIXED_VIDEO_DEVICE2 ), bEnable );
|
|
::EnableWindow( GetDlgItem( IDC_RADIO_FIXED_VIDEO_DEVICE3 ), bEnable );
|
|
::EnableWindow( GetDlgItem( IDC_RADIO_FIXED_VIDEO_DEVICE4 ), bEnable );
|
|
::EnableWindow( GetDlgItem( IDC_COMBO_VIDEO_DEVICE ), bEnable );
|
|
::EnableWindow( GetDlgItem( IDC_RADIO_FIXED_VIDEO_INPUT1 ), bEnable );
|
|
::EnableWindow( GetDlgItem( IDC_RADIO_FIXED_VIDEO_INPUT2 ), bEnable );
|
|
::EnableWindow( GetDlgItem( IDC_RADIO_FIXED_VIDEO_INPUT3 ), bEnable );
|
|
::EnableWindow( GetDlgItem( IDC_RADIO_FIXED_VIDEO_INPUT4 ), bEnable );
|
|
::EnableWindow( GetDlgItem( IDC_RADIO_FIXED_VIDEO_PAL ), bEnable );
|
|
::EnableWindow( GetDlgItem( IDC_RADIO_FIXED_VIDEO_NTSC ), bEnable );
|
|
::EnableWindow( GetDlgItem( IDC_CHECK_EDIT_LINE ), bEnable );
|
|
::EnableWindow( GetDlgItem( IDC_CHECK_EDIT_POINT ), bEnable );
|
|
|
|
// check edit state
|
|
if( !bEnable )
|
|
{
|
|
// go out from edit mode
|
|
if( SendDlgItemMessage( IDC_CHECK_EDIT, BM_GETCHECK, 0, 0 ) )
|
|
SendDlgItemMessage( IDC_CHECK_EDIT, BM_CLICK, 0, 0 );
|
|
}
|
|
}
|
|
|
|
void CSetupFixedVideoDlg::OnCheckEditLine()
|
|
{
|
|
// get enable flag
|
|
BOOL bEditLine = SendDlgItemMessage( IDC_CHECK_EDIT_LINE, BM_GETCHECK, 0, 0 );
|
|
|
|
// uncheck another edit mode
|
|
SendDlgItemMessage( IDC_CHECK_EDIT_POINT, BM_SETCHECK, 0, 0 );
|
|
|
|
// set editor mode
|
|
m_LocatorWnd.SetEditMode( bEditLine, RGB(0xFF,0xFF,0), CLocatorWnd::EDIT_MODE_LINE );
|
|
|
|
// enable clear button
|
|
::EnableWindow( GetDlgItem( IDC_BUTTON_CLEAR ), bEditLine );
|
|
}
|
|
|
|
void CSetupFixedVideoDlg::OnCheckEditPoint()
|
|
{
|
|
// get enable flag
|
|
BOOL bEditPoint = SendDlgItemMessage( IDC_CHECK_EDIT_POINT, BM_GETCHECK, 0, 0 );
|
|
|
|
// uncheck another edit mode
|
|
SendDlgItemMessage( IDC_CHECK_EDIT_LINE, BM_SETCHECK, 0, 0 );
|
|
|
|
// set editor mode
|
|
m_LocatorWnd.SetEditMode( bEditPoint, RGB(0xFF,0xFF,0), CLocatorWnd::EDIT_MODE_POINT );
|
|
|
|
// enable clear button
|
|
::EnableWindow( GetDlgItem( IDC_BUTTON_CLEAR ), bEditPoint );
|
|
}
|