Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

196 lines
5.2 KiB

  1. #ifndef ZAXXON_H
  2. #define ZAXXON_H
  3. #include "bands.h"
  4. #include "sccls.h"
  5. #include "power.h"
  6. #include "uxtheme.h"
  7. #include "tmschema.h"
  8. #include "runtask.h"
  9. #define WM_SONGTHUMBDONE WM_USER + 1
  10. #define WM_SONGCHANGE WM_USER + 2
  11. #define WM_SONGSTOP WM_USER + 3
  12. #define WM_SETARTIST WM_USER + 4
  13. #define WM_SETALBUM WM_USER + 5
  14. #define WM_SETSONG WM_USER + 6
  15. #define WM_UPDATESONG WM_USER + 7
  16. class CSongExtractionTask;
  17. class CMusicExtractionTask;
  18. class CZaxxon;
  19. class CSong
  20. {
  21. int _cRef;
  22. public:
  23. CSong();
  24. void AddRef();
  25. void Release();
  26. TCHAR szSong[MAX_PATH];
  27. TCHAR szTitle[MAX_PATH];
  28. TCHAR szArtist[MAX_PATH];
  29. TCHAR szAlbum[MAX_PATH];
  30. TCHAR szDuration[50];
  31. DWORD _id;
  32. };
  33. class CSongExtractionTask : public CRunnableTask
  34. {
  35. public:
  36. CSongExtractionTask(HWND hwnd, CSong* psong);
  37. STDMETHODIMP RunInitRT(void);
  38. private:
  39. virtual ~CSongExtractionTask();
  40. HWND _hwnd;
  41. CSong* _psong;
  42. };
  43. class CZaxxonEditor
  44. {
  45. public:
  46. CZaxxon* _pzax;
  47. HWND _hwnd;
  48. HWND _hwndList;
  49. HWND _hwndToolbar;
  50. BOOL _fIgnoreChange;
  51. HDPA hSongList;
  52. void UpdateSong(CSong* psong);
  53. void LoadPlaylist();
  54. void SavePlaylist();
  55. void ClearPlaylist();
  56. void HighlightSong(PTSTR psz);
  57. void RemoveFromPlaylist();
  58. void InsertFilename(int i, PTSTR psz);
  59. void AddFilenameToListview(int i, PTSTR psz);
  60. void AddFilename(PTSTR psz);
  61. void AddToPlaylist();
  62. CZaxxonEditor(CZaxxon* pzax);
  63. ~CZaxxonEditor();
  64. BOOL Initialize();
  65. BOOL Show(BOOL fShow);
  66. LRESULT WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  67. static LRESULT CALLBACK s_WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  68. };
  69. class CZaxxon : public CToolBand,
  70. public IWinEventHandler,
  71. public IDropTarget,
  72. public IShellMenuCallback
  73. {
  74. public:
  75. // *** IUnknown ***
  76. virtual STDMETHODIMP_(ULONG) AddRef(void)
  77. { return CToolBand::AddRef(); };
  78. virtual STDMETHODIMP_(ULONG) Release(void)
  79. { return CToolBand::Release(); };
  80. virtual STDMETHODIMP QueryInterface(REFIID riid, LPVOID * ppvObj);
  81. // *** IOleWindow methods ***
  82. virtual STDMETHODIMP GetWindow(HWND * phwnd);
  83. virtual STDMETHODIMP ContextSensitiveHelp(BOOL bEnterMode) {return E_NOTIMPL;};
  84. // *** IDeskBar methods ***
  85. virtual STDMETHODIMP SetClient(IUnknown* punk) { return E_NOTIMPL; };
  86. virtual STDMETHODIMP GetClient(IUnknown** ppunkClient) { return E_NOTIMPL; };
  87. virtual STDMETHODIMP OnPosRectChangeDB (LPRECT prc) { return E_NOTIMPL;};
  88. // ** IWinEventHandler ***
  89. virtual STDMETHODIMP IsWindowOwner(HWND hwnd);
  90. virtual STDMETHODIMP OnWinEvent(HWND hwnd, UINT dwMsg, WPARAM wParam, LPARAM lParam, LRESULT* plres);
  91. // *** IDeskBand methods ***
  92. virtual STDMETHODIMP GetBandInfo(DWORD dwBandID, DWORD fViewMode,
  93. DESKBANDINFO* pdbi);
  94. // *** IDockingWindow methods (override) ***
  95. virtual STDMETHODIMP ShowDW(BOOL fShow);
  96. virtual STDMETHODIMP CloseDW(DWORD dw);
  97. // *** IInputObject methods (override) ***
  98. virtual STDMETHODIMP TranslateAcceleratorIO(LPMSG lpMsg);
  99. virtual STDMETHODIMP HasFocusIO();
  100. virtual STDMETHODIMP UIActivateIO(BOOL fActivate, LPMSG lpMsg);
  101. virtual STDMETHODIMP GetClassID(CLSID *pClassID);
  102. virtual STDMETHODIMP Load(IStream *pStm);
  103. virtual STDMETHODIMP Save(IStream *pStm, BOOL fClearDirty);
  104. // *** IDropTarget methods ***
  105. virtual STDMETHODIMP DragEnter(IDataObject *pdtobj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect);
  106. virtual STDMETHODIMP DragOver(DWORD grfKeyState, POINTL pt, DWORD *pdwEffect);
  107. virtual STDMETHODIMP DragLeave(void);
  108. virtual STDMETHODIMP Drop(IDataObject *pdtobj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect);
  109. // *** IShellMenuCallback methods ***
  110. virtual STDMETHODIMP CallbackSM(LPSMDATA psmd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  111. CZaxxon();
  112. virtual ~CZaxxon();
  113. HWND GetHWND() {return _hwnd;}
  114. HRESULT RecurseAddFile(IShellFolder* psf);
  115. LRESULT _OnCommand(WORD wNotifyCode, WORD wID, HWND hwnd);
  116. LRESULT _OnNotify(LPNMHDR pnm);
  117. void _DoMenu();
  118. void SongStop();
  119. CZaxxonEditor* _pEdit;
  120. DWORD _dwViewMode;
  121. HTHEME _hTheme;
  122. HIMAGELIST _himlHot;
  123. HIMAGELIST _himlDef;
  124. HFONT _hfont;
  125. IZaxxonPlayer* _pzax;
  126. HWND _hwndSongTile;
  127. IThumbnail* _pThumbnail;
  128. BOOL _fHide;
  129. BOOL _fAllowFadeout;
  130. BOOL _fPlaying;
  131. BOOL _fEditorShown;
  132. BYTE _bOpacity;
  133. HBRUSH _hbr;
  134. IShellTaskScheduler* _pScheduler;
  135. HMENU _hmenuOpenFolder;
  136. TCHAR _szArtist[MAX_PATH];
  137. TCHAR _szSong[MAX_PATH];
  138. TCHAR _szAlbum[MAX_PATH];
  139. HBITMAP _hbmpAlbumArt;
  140. HWND _CreateWindow(HWND hwndParent);
  141. friend class CMusicExtractionTask;
  142. friend LRESULT ZaxxonWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  143. friend HRESULT CZaxxon_CreateInstance(IUnknown *punk, REFIID riid, void **ppv);
  144. };
  145. void FillRectClr(HDC hdc, PRECT prc, COLORREF clr);
  146. #define RECTWIDTH(rc) ((rc).right - (rc).left)
  147. #define RECTHEIGHT(rc) ((rc).bottom - (rc).top)
  148. void CenterOnTopOf(HWND hwnd, HWND hwndOn);
  149. #endif