00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #pragma once
00027
00028 #include "CtrlCoolBar.h"
00029 #include "CtrlMediaList.h"
00030
00031
00032 class CMediaFrame : public CWnd
00033 {
00034
00035 public:
00036 CMediaFrame();
00037 virtual ~CMediaFrame();
00038
00039 DECLARE_DYNAMIC(CMediaFrame)
00040
00041
00042 public:
00043 void OnSkinChange();
00044 void OnUpdateCmdUI();
00045 BOOL PlayFile(LPCTSTR pszFile);
00046 BOOL EnqueueFile(LPCTSTR pszFile);
00047 BOOL IsPlaying();
00048 void OnFileDelete(LPCTSTR pszFile);
00049 float GetPosition();
00050 float GetVolume();
00051 BOOL SeekTo(float nPosition);
00052 BOOL SetVolume(float nVolume);
00053 BOOL PaintStatusMicro(CDC& dc, CRect& rcBar);
00054 void UpdateScreenSaverStatus(BOOL bWindowActive);
00055 protected:
00056 void SetFullScreen(BOOL bFullScreen);
00057 void PaintSplash(CDC& dc, CRect& rcBar);
00058 void PaintListHeader(CDC& dc, CRect& rcBar);
00059 void PaintStatus(CDC& dc, CRect& rcBar);
00060 BOOL DoSizeList();
00061 BOOL Prepare();
00062 BOOL PrepareVis();
00063 BOOL OpenFile(LPCTSTR pszFile);
00064 void Cleanup();
00065 void ZoomTo(MediaZoom nZoom);
00066 void AspectTo(double nAspect);
00067 void UpdateState();
00068 void DisableScreenSaver();
00069 void EnableScreenSaver();
00070 HRESULT PluginPlay( BSTR bsFileName );
00071 public:
00072 inline IMediaPlayer* GetPlayer() { return m_pPlayer; }
00073 inline MediaState GetState() { return m_pPlayer != NULL ? m_nState : smsNull; }
00074
00075
00076 protected:
00077 IMediaPlayer* m_pPlayer;
00078 MediaState m_nState;
00079 LONGLONG m_nLength;
00080 LONGLONG m_nPosition;
00081 BOOL m_bMute;
00082 BOOL m_bThumbPlay;
00083 BOOL m_bRepeat;
00084 BOOL m_bLastMedia;
00085 BOOL m_bLastNotPlayed;
00086 BOOL m_bEnqueue;
00087 BOOL m_bStopFlag;
00088 DWORD m_tLastPlay;
00089 protected:
00090 CString m_sFile;
00091 CMetaList m_pMetadata;
00092 DWORD m_tMetadata;
00093 protected:
00094 CMediaListCtrl m_wndList;
00095 CCoolBarCtrl m_wndListBar;
00096 CCoolBarCtrl m_wndToolBar;
00097 CSliderCtrl m_wndPosition;
00098 CSliderCtrl m_wndSpeed;
00099 CSliderCtrl m_wndVolume;
00100 protected:
00101 BOOL m_bFullScreen;
00102 DWORD m_tBarTime;
00103 CPoint m_ptCursor;
00104 BOOL m_bListVisible;
00105 BOOL m_bListWasVisible;
00106 int m_nListSize;
00107 BOOL m_bStatusVisible;
00108 protected:
00109 CRect m_rcVideo;
00110 CRect m_rcStatus;
00111 CBitmap m_bmLogo;
00112 CImageList m_pIcons;
00113 CFont m_pFontDefault;
00114 CFont m_pFontKey;
00115 CFont m_pFontValue;
00116 protected:
00117 int* m_pScreenSaveValue;
00118 BOOL m_bScreenSaverEnabled;
00119 public:
00120 static CMediaFrame* g_pMediaFrame;
00121
00122
00123 public:
00124 virtual BOOL Create(CWnd* pParentWnd);
00125 virtual BOOL OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo);
00126 virtual BOOL PreTranslateMessage(MSG* pMsg);
00127
00128
00129 protected:
00130 DECLARE_MESSAGE_MAP()
00131 afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
00132 afx_msg void OnDestroy();
00133 afx_msg void OnSize(UINT nType, int cx, int cy);
00134 afx_msg void OnPaint();
00135 afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
00136 afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
00137 afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
00138 afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
00139 afx_msg void OnTimer(UINT nIDEvent);
00140 afx_msg void OnClose();
00141
00142 afx_msg void OnUpdateMediaClose(CCmdUI* pCmdUI);
00143 afx_msg void OnMediaClose();
00144 afx_msg void OnUpdateMediaPlay(CCmdUI* pCmdUI);
00145 afx_msg void OnMediaPlay();
00146 afx_msg void OnUpdateMediaPause(CCmdUI* pCmdUI);
00147 afx_msg void OnMediaPause();
00148 afx_msg void OnUpdateMediaStop(CCmdUI* pCmdUI);
00149 afx_msg void OnMediaStop();
00150 afx_msg void OnMediaZoom();
00151 afx_msg void OnUpdateMediaSizeFill(CCmdUI* pCmdUI);
00152 afx_msg void OnMediaSizeFill();
00153 afx_msg void OnUpdateMediaSizeDistort(CCmdUI* pCmdUI);
00154 afx_msg void OnMediaSizeDistort();
00155 afx_msg void OnUpdateMediaSizeOne(CCmdUI* pCmdUI);
00156 afx_msg void OnMediaSizeOne();
00157 afx_msg void OnUpdateMediaSizeTwo(CCmdUI* pCmdUI);
00158 afx_msg void OnMediaSizeTwo();
00159 afx_msg void OnUpdateMediaSizeThree(CCmdUI* pCmdUI);
00160 afx_msg void OnMediaSizeThree();
00161 afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
00162 afx_msg void OnUpdateMediaAspectDefault(CCmdUI* pCmdUI);
00163 afx_msg void OnMediaAspectDefault();
00164 afx_msg void OnUpdateMediaAspect43(CCmdUI* pCmdUI);
00165 afx_msg void OnMediaAspect43();
00166 afx_msg void OnUpdateMediaAspect169(CCmdUI* pCmdUI);
00167 afx_msg void OnMediaAspect169();
00168 afx_msg void OnUpdateMediaFullScreen(CCmdUI* pCmdUI);
00169 afx_msg void OnMediaFullScreen();
00170 afx_msg void OnUpdateMediaPlaylist(CCmdUI* pCmdUI);
00171 afx_msg void OnMediaPlaylist();
00172 afx_msg void OnMediaSettings();
00173 afx_msg void OnUpdateMediaSettings(CCmdUI* pCmdUI);
00174 afx_msg void OnUpdateMediaVis(CCmdUI* pCmdUI);
00175 afx_msg void OnMediaVis();
00176 afx_msg void OnUpdateMediaStatus(CCmdUI* pCmdUI);
00177 afx_msg void OnMediaStatus();
00178 afx_msg void OnUpdateMediaMute(CCmdUI* pCmdUI);
00179 afx_msg void OnMediaMute();
00180
00181 afx_msg void OnNewCurrent(NMHDR* pNotify, LRESULT* pResult);
00182 afx_msg LONG OnMediaKey(WPARAM wParam, LPARAM lParam);
00183
00184 };
00185
00186
00187
00188 #define IDC_MEDIA_FRAME 116
00189 #define IDC_MEDIA_POSITION 117
00190 #define IDC_MEDIA_SPEED 118
00191 #define IDC_MEDIA_VOLUME 119
00192 #define IDC_MEDIA_PLAYLIST 120
00193
00194 #define VK_MEDIA_NEXT_TRACK 0xB0
00195 #define VK_MEDIA_PREV_TRACK 0xB1
00196 #define VK_MEDIA_STOP 0xB2
00197 #define VK_MEDIA_PLAY_PAUSE 0xB3