// ConfigDlg1.cpp : implementation file // #include "stdafx.h" #include "resource.h" #include "ConfigDlg1.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CConfigDlg1 dialog BEGIN_MESSAGE_MAP(CConfigDlg1, CDialog) //{{AFX_MSG_MAP(CConfigDlg1) ON_BN_CLICKED(IDC_CONFIG_OK, OnConfigOk) ON_BN_CLICKED(IDC_BUTTON_BROWSE0, OnButtonBrowse) ON_BN_CLICKED(IDC_BUTTON_BROWSE1, OnButtonBrowse1) ON_BN_CLICKED(IDC_BUTTON_BROWSE2, OnButtonBrowse2) ON_BN_CLICKED(IDC_BUTTON_BROWSE3, OnButtonBrowse3) ON_BN_CLICKED(IDC_BUTTON_BROWSE4, OnButtonBrowse4) ON_BN_CLICKED(IDC_BUTTON_BROWSE5, OnButtonBrowse5) ON_BN_CLICKED(IDC_CONFIG_CANCEL, OnConfigCancel) ON_BN_CLICKED(IDC_CHECK_SCAN_REP, OnCheckScanRep) ON_BN_CLICKED(IDC_TEXT_ENABLE, OnTextEnable) //}}AFX_MSG_MAP END_MESSAGE_MAP() CConfigDlg1::CConfigDlg1(CWnd* pParent /*=NULL*/) : CDialog(CConfigDlg1::IDD, pParent) { //{{AFX_DATA_INIT(CConfigDlg1) // NOTE: the ClassWizard will add member initialization here //}}AFX_DATA_INIT } void CConfigDlg1::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CConfigDlg1) DDX_Control(pDX, IDC_TEXT_ENABLE, m_TextEnable); DDX_Control(pDX, IDC_BUTTON_BROWSE0, m_TextOption); DDX_Control(pDX, IDC_CHECK_SCAN_REP, m_ScanRep); //}}AFX_DATA_MAP DDX_Text( pDX, IDC_EDIT1, this->acPlaylists[ 0 ] ); DDX_Text( pDX, IDC_EDIT2, this->acPlaylists[ 1 ] ); DDX_Text( pDX, IDC_EDIT3, this->acPlaylists[ 2 ] ); DDX_Text( pDX, IDC_EDIT4, this->acPlaylists[ 3 ] ); DDX_Text( pDX, IDC_EDIT5, this->acPlaylists[ 4 ] ); DDX_Text( pDX, IDC_EDIT6, this->acPlaylists[ 5 ] ); DDX_Text( pDX, IDC_TZ, this->iTZ ); DDX_Text( pDX, IDC_INTERVAL_NUM, this->iRefreshInterval ); DDX_Text( pDX, IDC_FW_VERSION, this->sVersion ); DDX_Check( pDX, IDC_CHECK_SCAN_REP, this->bScanRepeat ); DDX_Check( pDX, IDC_CHECK_AUTOREP, this->bAutoRepeat ); DDX_Check( pDX, IDC_TEXT_ENABLE, this->iText ); DDX_Check( pDX, IDC_SPLIT_ENABLE, this->iSplit ); GetDlgItem( IDC_CHECK_AUTOREP)->EnableWindow( this->bScanRepeat ? FALSE: TRUE ); GetDlgItem( IDC_SPLIT_ENABLE )->EnableWindow( this->iText ? TRUE: FALSE ); } ///////////////////////////////////////////////////////////////////////////// // CConfigDlg1 message handlers void CConfigDlg1::OnConfigOk() { // TODO: Add your control notification handler code here // Save data back to a config file CDialog::OnOK(); } void CConfigDlg1::OnConfigCancel() { // TODO: Add your control notification handler code here CDialog::OnCancel(); } void CConfigDlg1::DoBrowse(CString* cStr) { // TODO: Add your control notification handler code here CFileDialog cDlg( TRUE, NULL, NULL, OFN_OVERWRITEPROMPT,"WinAmp playlists (*.m3u)|*.m3u|All files|*.*||"); int i= cDlg.DoModal(); if(i == IDOK) { *cStr= cDlg.GetPathName(); UpdateData( FALSE ); } } void CConfigDlg1::OnButtonBrowse() { this->DoBrowse( &this->acPlaylists[ 0 ] ); } void CConfigDlg1::OnButtonBrowse1() { this->DoBrowse( &this->acPlaylists[ 1 ] ); } void CConfigDlg1::OnButtonBrowse2() { this->DoBrowse( &this->acPlaylists[ 2 ] ); } void CConfigDlg1::OnButtonBrowse3() { this->DoBrowse( &this->acPlaylists[ 3 ] ); } void CConfigDlg1::OnButtonBrowse4() { this->DoBrowse( &this->acPlaylists[ 4 ] ); } void CConfigDlg1::OnButtonBrowse5() { this->DoBrowse( &this->acPlaylists[ 5 ] ); } void CConfigDlg1::SetPlaylist( int iPlaylist, char* sPlaylist ) { this->acPlaylists[ iPlaylist ]= sPlaylist; } void CConfigDlg1::UpdatePlaylist(int iPlaylist, char *sPlaylist) { strcpy( sPlaylist, (LPCTSTR)this->acPlaylists[ iPlaylist ] ); } void CConfigDlg1::SetFormData(char *sVersion, int bScanRepeat, int bAutoRepeat, int iRefreshInterval, int iText, int iSplit, int iTZ) { char s[ 20 ]; this->bScanRepeat= bScanRepeat; this->bAutoRepeat= bAutoRepeat; this->iRefreshInterval= iRefreshInterval; this->iText= iText; this->iSplit= iSplit; sprintf( s, "(%c.%c)", sVersion[ 1 ], sVersion[ 2 ] ); this->sVersion= s; this->iTZ= iTZ; } void CConfigDlg1::UpdateFormData(int * bScanRepeat, int * bAutoRepeat, int* iRefreshInterval, int* iText, int* iSplit, int* iTZ) { *bScanRepeat= this->bScanRepeat; *bAutoRepeat= this->bAutoRepeat; *iRefreshInterval= this->iRefreshInterval; *iText= this->iText; *iSplit= this->iSplit; *iTZ= this->iTZ; } void CConfigDlg1::OnCheckScanRep() { GetDlgItem( IDC_CHECK_AUTOREP)->EnableWindow( this->m_ScanRep.GetCheck() ? FALSE: TRUE ); } void CConfigDlg1::OnTextEnable() { // TODO: Add your control notification handler code here GetDlgItem( IDC_SPLIT_ENABLE )->EnableWindow( this->m_TextEnable.GetCheck() ? TRUE: FALSE ); }