www.pudn.com > LECTEUR-MP3.zip > MainFrm.cpp


// MainFrm.cpp : implementation of the CMainFrame class 
// 
 
#include "stdafx.h" 
#include "MusGest.h" 
 
#include "MainFrm.h" 
 
 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// CMainFrame 
 
IMPLEMENT_DYNCREATE(CMainFrame, CBaseVarFrame) 
 
BEGIN_MESSAGE_MAP(CMainFrame, CBaseVarFrame) 
	//{{AFX_MSG_MAP(CMainFrame) 
	ON_WM_CREATE() 
	ON_WM_SYSCOMMAND() 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
static UINT indicators[] = 
{ 
	ID_SEPARATOR,           // status line indicator 
	ID_INDICATOR_CAPS, 
	ID_INDICATOR_NUM, 
	ID_INDICATOR_SCRL, 
}; 
 
///////////////////////////////////////////////////////////////////////////// 
// CMainFrame construction/destruction 
 
CMainFrame::CMainFrame() 
{ 
 
	 
} 
 
CMainFrame::~CMainFrame() 
{ 
} 
 
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{ 
	if (CBaseVarFrame::OnCreate(lpCreateStruct) == -1) 
		return -1; 
 
	return 0; 
} 
 
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) 
{ 
	if( !CBaseVarFrame::PreCreateWindow(cs) ) 
		return FALSE; 
	// TODO: Modify the Window class or styles here by modifying 
	//  the CREATESTRUCT cs 
 
	return TRUE; 
} 
 
///////////////////////////////////////////////////////////////////////////// 
// CMainFrame diagnostics 
 
#ifdef _DEBUG 
void CMainFrame::AssertValid() const 
{ 
	CBaseVarFrame::AssertValid(); 
} 
 
void CMainFrame::Dump(CDumpContext& dc) const 
{ 
	CBaseVarFrame::Dump(dc); 
} 
 
#endif //_DEBUG 
 
///////////////////////////////////////////////////////////////////////////// 
// CMainFrame message handlers 
//--------------------------------------------------------------- 
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)  
{ 
		// TODO: add member initialization code here 
	if (!m_wndStatusBar.Create(this) || 
	!m_wndStatusBar.SetIndicators(indicators, 
		  sizeof(indicators)/sizeof(UINT))) 
	{ 
		TRACE0("Failed to create status bar\n"); 
		return -1;      // fail to create 
	} 
 
/*	if (!m_dlgBar.Create(this, IDD_PLAY_DLG, 
        CBRS_BOTTOM|CBRS_TOOLTIPS|CBRS_FLYBY, IDD_PLAY_DLG)) 
    { 
		TRACE0("Failed to create DlgBar\n"); 
	}*/ 
 
	// TODO: Add your specialized code here and/or call the base class 
	return CBaseVarFrame::OnCreateClient(lpcs, pContext); 
} 
 
//--------------------------------------------------------------- 
void CMainFrame::ChangeFolder(CString strNewFolder) 
{ 
	CMusGestView * pView = NULL; 
	pView = (CMusGestView*)GetLeftView(); 
 
	if (pView) 
		pView->Start(strNewFolder); 
} 
 
//--------------------------------------------------------------- 
void CMainFrame::NewFolder(CString strNewFolder) 
{ 
	CMusGestView * pView = NULL; 
	pView = (CMusGestView*)GetLeftView(); 
	if (pView) 
		pView->CreateFolder(strNewFolder); 
} 
 
//--------------------------------------------------------------- 
void CMainFrame::ChangeVolume(float fVol) 
{ 
	CFileView * pView = NULL; 
	pView = (CFileView*)GetRightView(0,0); 
 
	if (pView) 
		pView->ChangeVolume(fVol); 
} 
 
//------------------------------------------------------------------------------------- 
void CMainFrame::ShowVolume(int iVol) 
{ 
	CString strTmp, strText; 
 
	strText.Format("Volume : %d ",iVol); 
	strTmp += "Gestionaire de fichier audio   ----   "; 
	strTmp += strText; 
	strTmp += '%'; 
	SetWindowText(strTmp); 
}