www.pudn.com > DVBPlayer.rar > LnbSettingDlg.cpp, change:2004-07-15,size:4942b


// LnbSettingDlg.cpp : implementation file 
// 
 
#include "stdafx.h" 
#include "app.h" 
#include "LnbSettingDlg.h" 
#include "dsm.h" 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// CLnbSettingDlg dialog 
 
 
CLnbSettingDlg::CLnbSettingDlg(CWnd* pParent /*=NULL*/) 
	: CDialog(CLnbSettingDlg::IDD, pParent) 
{ 
	//{{AFX_DATA_INIT(CLnbSettingDlg) 
	m_type = -1; 
	//}}AFX_DATA_INIT 
 
	m_sel_sat = 0 ;  
} 
 
 
void CLnbSettingDlg::DoDataExchange(CDataExchange* pDX) 
{ 
	CDialog::DoDataExchange(pDX); 
	//{{AFX_DATA_MAP(CLnbSettingDlg) 
	DDX_Radio(pDX, IDC_RADIO_TYPE, m_type); 
	//}}AFX_DATA_MAP 
} 
 
 
BEGIN_MESSAGE_MAP(CLnbSettingDlg, CDialog) 
	//{{AFX_MSG_MAP(CLnbSettingDlg) 
	ON_BN_CLICKED(IDC_BUTTON_DEFAULT, OnButtonDefault) 
	ON_CBN_SELCHANGE(IDC_COMBO_DUAL, OnSelchangeComboDual) 
	ON_CBN_SELCHANGE(IDC_COMBO_SATELLITE, OnSelchangeComboSatellite) 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CLnbSettingDlg message handlers 
 
void CLnbSettingDlg::OnOK()  
{ 
	// TODO: Add extra validation here 
	 
 
	//дDz 
	int n  = ( (CComboBox*) GetDlgItem (IDC_COMBO_SATELLITE) ) -> GetCurSel () ;  
	SatelParams parm_sat ;  
 
	parm_sat .bDual_LNB_Flag = ((CComboBox*)GetDlgItem(IDC_COMBO_DUAL)) ->GetCurSel () == 0 ? FALSE : TRUE ;  
	parm_sat .dwFreLOF1 = GetDlgItemInt (IDC_EDIT_LOW_LNB) ;  
	parm_sat .dwFreLOF = GetDlgItemInt(IDC_EDIT_HIGH_LNB) ;  
 
 
	UpdateData(TRUE) ;  
	parm_sat .bType = m_type ;  
	 
 
//	DaModifySatellite( &parm_sat, n) ;  
	m_sel_param = parm_sat ;  
 
 
	CDialog::OnOK(); 
} 
 
void CLnbSettingDlg::OnCancel()  
{ 
	// TODO: Add extra cleanup here 
	 
	CDialog::OnCancel(); 
} 
 
void CLnbSettingDlg::OnButtonDefault()  
{ 
	// TODO: Add your control notification handler code here 
	DefaultData() ;  
} 
 
BOOL CLnbSettingDlg::OnInitDialog()  
{ 
	CDialog::OnInitDialog(); 
	 
	// TODO: Add extra initialization here 
	 
	CComboBox* p_combo_sate = (CComboBox*) GetDlgItem (IDC_COMBO_SATELLITE) ;  
	int i  ; 
 
	for ( i  = 0 ;i < DaGetSatelliteCount() ; i++ ) 
	{ 
		char satName [MAX_PARAM_LENGTH] ; 
		DaGetSatelName ( i, (BYTE*)satName ) ;  
		p_combo_sate ->AddString( satName ) ; 
	} 
 
	if ( m_sel_sat < p_combo_sate ->GetCount() ) p_combo_sate ->SetCurSel(m_sel_sat) ;  
 
#if 0 
 
	DefaultData() ;  
#else 
 
 
	CComboBox* p_combo_dual = (CComboBox*) GetDlgItem (IDC_COMBO_DUAL) ;  
	 
	p_combo_dual ->SetCurSel(m_sel_param .bDual_LNB_Flag == OFF ? 0 : 1) ;  
	 
	 
	SetDlgItemInt(IDC_EDIT_LOW_LNB, m_sel_param .dwFreLOF) ;  
	SetDlgItemInt(IDC_EDIT_HIGH_LNB, m_sel_param .dwFreLOF1) ;  
	 
	OnSelchangeComboDual() ;  
	 
	 
	m_type = m_sel_param .bType ;  
	UpdateData(FALSE) ;  
 
	OnSelchangeComboSatellite() ;  
	OnSelchangeComboDual () ; 
#endif 
	return TRUE;  // return TRUE unless you set the focus to a control 
	              // EXCEPTION: OCX Property Pages should return FALSE 
} 
 
 
 
void CLnbSettingDlg::DefaultData ()  
{ 
	CComboBox* p_combo_dual = (CComboBox*) GetDlgItem (IDC_COMBO_DUAL) ;  
	CComboBox* p_combo_sat = (CComboBox*) GetDlgItem (IDC_COMBO_SATELLITE) ;  
	p_combo_sat ->SetCurSel(0) ;  
	 
	SatelParams sat ;  
	DaGetDefaultSatelAttr ( &sat ) ;  
 
	p_combo_dual ->SetCurSel(sat .bDual_LNB_Flag == OFF ? 0 : 1) ;  
	 
 
	SetDlgItemInt(IDC_EDIT_LOW_LNB, sat .dwFreLOF) ;  
	SetDlgItemInt(IDC_EDIT_HIGH_LNB, sat .dwFreLOF1) ;  
 
	OnSelchangeComboDual() ;  
	OnSelchangeComboSatellite () ;  
		 
 
	m_type = sat .bType ;  
	UpdateData(FALSE) ;  
	 
	 
} 
 
void CLnbSettingDlg::OnSelchangeComboDual()  
{ 
	// TODO: Add your control notification handler code her 
	CComboBox* p_combo_dual = ( CComboBox* ) GetDlgItem ( IDC_COMBO_DUAL  ) ;  
 
	switch(p_combo_dual ->GetCurSel())  
	{ 
	case OFF: 
		GetDlgItem(IDC_STATIC_HIGH) ->ShowWindow(SW_HIDE) ;  
		GetDlgItem(IDC_STATIC_HIGH_HZ) ->ShowWindow(SW_HIDE) ;  
		GetDlgItem(IDC_EDIT_HIGH_LNB) ->ShowWindow(SW_HIDE) ;  
		break; 
 
	case ON: 
		GetDlgItem(IDC_STATIC_HIGH) ->ShowWindow(SW_SHOW) ;  
		GetDlgItem(IDC_STATIC_HIGH_HZ) ->ShowWindow(SW_SHOW) ;  
		GetDlgItem(IDC_EDIT_HIGH_LNB) ->ShowWindow(SW_SHOW) ;  
		break; 
 
	default: 
		ASSERT( FALSE) ;  
	} 
} 
 
void CLnbSettingDlg::OnSelchangeComboSatellite()  
{ 
	// TODO: Add your control notification handler code here 
	int n  = ( (CComboBox*) GetDlgItem (IDC_COMBO_SATELLITE) ) -> GetCurSel () ;  
 
 
	m_sel_sat = n ;  
 
#if 0 
	SatelParams parm_sat ;  
	ASSERT( n >= 0 && n < DaGetSatelliteCount () ) ;  
	DaGetSatelAttr( n, &parm_sat ) ;  
 
	((CComboBox*)GetDlgItem(IDC_COMBO_DUAL)) ->SetCurSel ( parm_sat .bDual_LNB_Flag ?  1 : 0 )  ; 
	SetDlgItemInt(IDC_EDIT_LOW_LNB, parm_sat .dwFreLOF) ;  
	SetDlgItemInt(IDC_EDIT_HIGH_LNB, parm_sat .dwFreLOF1) ;  
	m_type = parm_sat .bType ;  
	UpdateData (FALSE) ;  
#endif 
	 
}