
/*	Copyright (C) G. Jespersen
	See Licence.txt.*/

// MainFrm.h : interface of the CMainFrame class
//
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_MAINFRM_H__A4346DDB_2140_4233_91F1_D9C6A60C91DF__INCLUDED_)
#define AFX_MAINFRM_H__A4346DDB_2140_4233_91F1_D9C6A60C91DF__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "ControlsBar.h"
#include "Player.h"

// Foreward for GetView()
class CDsLavSplitterView;

class CMainFrame : public CFrameWnd
{
	
protected: // create from serialization only
	CMainFrame();
	DECLARE_DYNCREATE(CMainFrame)

// Attributes
protected:
//	CSplitterWnd m_wndSplitter; out for CDsLavSplitterView - see CDsLavApp
public:

	// Controls Bar.
	CControlsBar m_controlsBar;

// Operations
public:

// out for CDsLavSplitterView test
//  virtual BOOL OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext);

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CMainFrame)
	public:
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
	virtual BOOL OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo);
	//}}AFX_VIRTUAL

// Implementation
public:
	virtual ~CMainFrame();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:  // control bar embedded members
	CStatusBar  m_wndStatusBar;
	CToolBar    m_wndToolBar;

// Generated message map functions
protected:
	//{{AFX_MSG(CMainFrame)
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg void OnTimer(UINT nIDEvent);
	afx_msg void OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized);
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
	afx_msg BOOL OnDeviceChange( UINT nEventType, DWORD dwData );


public:
	// Controls Bar Msgs
	//
	// DirectShow callback.
	LRESULT OnVideoEvent(WPARAM wParam, LPARAM lParam);				// WM_USER_VIDEOEVENT

	// From Main Frame
	LRESULT OnSetActivate(WPARAM wParam, LPARAM lParam);				// WM_USER_SET_ACTIVATE

	// From controls bar and ListView.
	LRESULT OnPlaybackStart(WPARAM wParam, LPARAM lParam);			// WM_USER_VID_START
	LRESULT OnPlaybackDvdStart(WPARAM wParam, LPARAM lParam);		// WM_USER_DVD_START
	LRESULT OnPlaybackCdStart(WPARAM wParam, LPARAM lParam);			// WM_USER_CD_START
	// From controls bar.
	LRESULT OnPlaybackStop(WPARAM wParam, LPARAM lParam);			// WM_USER_VID_STOP
	LRESULT OnPlaybackPause(WPARAM wParam, LPARAM lParam);			// WM_USER_VID_PAUSE	
	LRESULT OnPlaybackMute(WPARAM wParam, LPARAM lParam);			// WM_USER_VID_MUTE	
	LRESULT OnPlaybackTime(WPARAM wParam, LPARAM lParam);			// WM_USER_VID_TIME	
	LRESULT OnPlaybackTimeKeyboard(WPARAM wParam, LPARAM lParam);	// WM_USER_VID_TIME_KEYBOARD
	LRESULT OnPlaybackVol(WPARAM wParam, LPARAM lParam);				// WM_USER_VID_VOL	
	LRESULT OnHideLeftPane(WPARAM wParam, LPARAM lParam);			// WM_USER_HIDE_LEFT_PANE

	// Radio Browser update thread.
	LRESULT OnUpdateFinished(WPARAM wParam, LPARAM lParam);			// WM_USER_THREAD_FINISHED
	LRESULT OnUpdateAborted(WPARAM wParam, LPARAM lParam);			// WM_USER_THREAD_ABORTED

	// Helpers
	BOOL PostMessageToControlBar(UINT Msg, WPARAM wParam, LPARAM lParam);
	CDsLavSplitterView * GetSplitterView();
	void SetFocusToView();
	void SetMediaPath(CString strPath);
	void SetMediaName(CString strName);

// Attributes
private:
	CString  m_curDirectory;
	BOOL	 m_redrawBkgnd;
	COLORREF m_screenBkgColor;	
	CString	 m_strMediaPath;	// for use in OnPlaybackStart()
	CString	 m_strMediaName;	// for use in OnPlaybackStart()

	// CD Audio auto play
	BOOL	m_bCdPlaying;
	int		m_curCdTrack;
	CStringArray m_cdFilesAr;

public:
	CPlayer  m_player;

//////////////////////////////////
// CPlayer handlers
	void	ControlsBarDisable();
	void	ControlsBarEnable(int volumePercent);			// 11/23-1 int
	BOOL 	StartVideoPlayback(const CString & filePath);
	BOOL	StartDvdPlayback(const CString & dvdTsPath);
	BOOL 	StartCdPlayback(const CString & cdaPath);
	BOOL	StartCdPlaybackMenu(CString strCdDrive);
	BOOL 	ContinueCdPlayback();
	void 	StopVideoPlayback(BOOL isVideoEvent = FALSE); 
	void	ToggleVideoPlaybackPause(BOOL bEnterPressed);
	BOOL	StepVolume(BOOL stepUp);						// 11/23-1 replace direct calls to player from views

	// test function pointers.
	BOOL SetVideoWindow(BOOL hasVideoStream, BOOL hasAudioStream,
						HWND & hwndVideo, HWND & hwndEvents, CRect & videoRect);


};

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_MAINFRM_H__A4346DDB_2140_4233_91F1_D9C6A60C91DF__INCLUDED_)
