PlayerPlaylistBar.h

00001 /* 
00002  *      Copyright (C) 2003-2005 Gabest
00003  *      http://www.gabest.org
00004  *
00005  *  This Program is free software; you can redistribute it and/or modify
00006  *  it under the terms of the GNU General Public License as published by
00007  *  the Free Software Foundation; either version 2, or (at your option)
00008  *  any later version.
00009  *   
00010  *  This Program is distributed in the hope that it will be useful,
00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00013  *  GNU General Public License for more details.
00014  *   
00015  *  You should have received a copy of the GNU General Public License
00016  *  along with GNU Make; see the file COPYING.  If not, write to
00017  *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 
00018  *  http://www.gnu.org/copyleft/gpl.html
00019  *
00020  */
00021 
00022 #pragma once
00023 #include <afxcoll.h>
00024 #include "PlayerListCtrl.h"
00025 #include "Playlist.h"
00026 
00027 class OpenMediaData;
00028 
00029 class CPlayerPlaylistBar : public CSizingControlBarG
00030 {
00031         DECLARE_DYNAMIC(CPlayerPlaylistBar)
00032 
00033 private:
00034         enum {COL_NAME, COL_TIME};
00035 
00036         CImageList m_fakeImageList;
00037         CPlayerListCtrl m_list;
00038 
00039         int m_nTimeColWidth;
00040         void ResizeListColumn();
00041 
00042         void AddItem(CString fn, CList<CString>* subs);
00043         void AddItem(CList<CString>& fns, CList<CString>* subs);
00044         void ParsePlayList(CString fn, CList<CString>* subs);
00045         void ParsePlayList(CList<CString>& fns, CList<CString>* subs);
00046 
00047         bool ParseMPCPlayList(CString fn);
00048         bool SaveMPCPlayList(CString fn, CTextFile::enc e, bool fRemovePath);
00049 
00050         void SetupList();       
00051         void UpdateList();
00052         void EnsureVisible(POSITION pos);
00053         int FindItem(POSITION pos);
00054         POSITION FindPos(int i);
00055 
00056         CImageList* m_pDragImage;
00057         BOOL m_bDragging;
00058         int m_nDragIndex, m_nDropIndex;
00059         CPoint m_ptDropPoint;
00060 
00061         void DropItemOnList();
00062 
00063 public:
00064         CPlayerPlaylistBar();
00065         virtual ~CPlayerPlaylistBar();
00066 
00067         BOOL Create(CWnd* pParentWnd);
00068 
00069         CPlaylist m_pl;
00070 
00071         int GetCount();
00072         int GetSelIdx();
00073         void SetSelIdx(int i);
00074         bool IsAtEnd();
00075         bool GetCur(CPlaylistItem& pli);
00076         CString GetCur();
00077         void SetNext(), SetPrev(), SetFirst(), SetLast();
00078         void SetCurValid(bool fValid);
00079         void SetCurTime(REFERENCE_TIME rt);
00080 
00081         void Refresh();
00082         void Empty();
00083 
00084         void Open(CList<CString>& fns, bool fMulti, CList<CString>* subs = NULL);
00085         void Append(CList<CString>& fns, bool fMulti, CList<CString>* subs = NULL);
00086 
00087         void Open(CStringW vdn, CStringW adn, int vinput, int vchannel, int ainput);
00088         void Append(CStringW vdn, CStringW adn, int vinput, int vchannel, int ainput);
00089 
00090         OpenMediaData* GetCurOMD(REFERENCE_TIME rtStart = 0);
00091 
00092         void LoadPlaylist();
00093         void SavePlaylist();
00094 
00095 protected:
00096         virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
00097         virtual BOOL PreTranslateMessage(MSG* pMsg);
00098 
00099         DECLARE_MESSAGE_MAP()
00100 
00101 public:
00102         afx_msg void OnSize(UINT nType, int cx, int cy);
00103         afx_msg void OnLvnKeyDown(NMHDR* pNMHDR, LRESULT* pResult);
00104         afx_msg void OnNMDblclkList(NMHDR* pNMHDR, LRESULT* pResult);
00105         afx_msg void OnLvnKeydownList(NMHDR* pNMHDR, LRESULT* pResult);
00106 //      afx_msg void OnCustomdrawList(NMHDR* pNMHDR, LRESULT* pResult);
00107         afx_msg void OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct);
00108         afx_msg BOOL OnFileClosePlaylist(UINT nID);
00109         afx_msg BOOL OnPlayPlay(UINT nID);
00110         afx_msg void OnDropFiles(HDROP hDropInfo);
00111         afx_msg void OnBeginDrag(NMHDR* pNMHDR, LRESULT* pResult);
00112         afx_msg void OnMouseMove(UINT nFlags, CPoint point);
00113         afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
00114         afx_msg BOOL OnToolTipNotify(UINT id, NMHDR* pNMHDR, LRESULT* pResult);
00115         afx_msg void OnTimer(UINT nIDEvent);
00116         afx_msg void OnContextMenu(CWnd* /*pWnd*/, CPoint /*point*/);
00117         afx_msg void OnLvnEndlabeleditList(NMHDR* pNMHDR, LRESULT* pResult);
00118 };

Generated on Tue Dec 13 14:46:59 2005 for guliverkli by  doxygen 1.4.5