1
0

fileview_internal.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. #ifndef NULLOSFT_MEDIALIBRARY_FILEVIEW_CONTROL_INTERNAL_HEADER
  2. #define NULLOSFT_MEDIALIBRARY_FILEVIEW_CONTROL_INTERNAL_HEADER
  3. #if defined(_MSC_VER) && (_MSC_VER >= 1020)
  4. #pragma once
  5. #endif
  6. #include <windows.h>
  7. #include "../winamp/gen.h"
  8. #include "api__gen_ml.h"
  9. #include "./ml_ipc_0313.h"
  10. #include "../nu/trace.h"
  11. #include "./ml_imagelist.h"
  12. #include "./ml_imagefilter.h"
  13. #include "./skinning.h"
  14. #ifndef LONGX86
  15. #ifdef _WIN64
  16. #define LONGX86 LONG_PTR
  17. #else /*_WIN64*/
  18. #define LONGX86 LONG
  19. #endif /*_WIN64*/
  20. #endif // LONGX86
  21. #define METADATA_SOURCE_UNKNOWN 0
  22. #define METADATA_SOURCE_FILEINFO 1
  23. #define METADATA_SOURCE_MLDB 2
  24. #define FVM_GETIDEALHEIGHT (MLFVM_FIRST + 101) // internal use
  25. #define CSTR_INVARIANT MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT)
  26. #define METATYPE_AUDIO 0
  27. #define METATYPE_VIDEO 1
  28. #define METATYPE_PLAYLIST 2
  29. #define MF_NAME 0
  30. #define MF_SIZE 1
  31. #define MF_TYPE 2
  32. #define MF_MODIFIED 3
  33. #define MF_CREATED 4
  34. #define MF_EXTENSION 5
  35. #define MF_ATTRIBUTES 6
  36. #define MF_ARTIST 7
  37. #define MF_ALBUM 8
  38. #define MF_TITLE 9
  39. #define MF_INMLDB 10
  40. #define MF_GENRE 11
  41. #define MF_COMMENT 12
  42. #define MF_LENGTH 13
  43. #define MF_BITRATE 14
  44. #define MF_TRACKNUM 15
  45. #define MF_TRACKCOUNT 16
  46. #define MF_DISCNUM 17
  47. #define MF_DISCCOUNT 18
  48. #define MF_YEAR 19
  49. #define MF_PUBLISHER 20
  50. #define MF_COMPOSER 21
  51. #define MF_ALBUMARTIST 22
  52. #define MF_SOURCE 23
  53. typedef struct __AUDIOMETA
  54. {
  55. UINT nSource;
  56. LPWSTR pszArtist;
  57. LPWSTR pszTitle;
  58. LPWSTR pszAlbum;
  59. LPWSTR pszGenre;
  60. LPWSTR pszComment;
  61. INT nLength;
  62. INT nBitrate;
  63. INT nTrackNum;
  64. INT nTrackCount;
  65. INT nDiscNum;
  66. INT nDiscCount;
  67. INT nYear;
  68. LPWSTR pszAlbumArtist;
  69. LPWSTR pszPublisher;
  70. LPWSTR pszComposer;
  71. } AUDIOMETA;
  72. typedef __AUDIOMETA VIDEOMETA;
  73. #define MAX_PLAYLIST_ENTRIES 20
  74. typedef struct __PLENTRY
  75. {
  76. LPWSTR pszTitle;
  77. INT nLength;
  78. } PLENTRY;
  79. typedef struct __PLAYLISTMETA
  80. {
  81. UINT nCount;
  82. LPWSTR pszTitle;
  83. INT nLength;
  84. PLENTRY szEntries[MAX_PLAYLIST_ENTRIES];
  85. } PLAYLISTMETA;
  86. typedef struct _FILEMETARECORD
  87. {
  88. DWORD type;
  89. union
  90. {
  91. AUDIOMETA audio;
  92. VIDEOMETA video;
  93. PLAYLISTMETA playlist;
  94. };
  95. }FILEMETARECORD;
  96. typedef struct _FILERECORD
  97. {
  98. WIN32_FIND_DATAW Info;
  99. INT fileType;
  100. size_t extOffset;
  101. FILEMETARECORD *pMeta;
  102. } FILERECORD;
  103. typedef struct _FILEDATA
  104. {
  105. size_t count;
  106. size_t allocated;
  107. FILERECORD *pRec;
  108. size_t *pSort;
  109. ULONGLONG folderSize;
  110. WCHAR szPath[MAX_PATH*2];
  111. } FILEDATA;
  112. #ifdef __cplusplus
  113. extern "C" {
  114. #endif
  115. extern winampGeneralPurposePlugin plugin;
  116. #ifdef __cplusplus
  117. }
  118. #endif
  119. extern HWND g_hwnd;
  120. extern HMLIMGFLTRMNGR hmlifMngr; // default gen_ml fitler manager
  121. // toolbar
  122. HWND FileViewToolbar_Create(HWND hwndParent);
  123. // filesystem
  124. size_t FileView_ReadFileData(FILEDATA *pfd, LPCWSTR pszPath, UINT fStyle, FILESYSTEMINFO *pfsi);
  125. LPCWSTR FileView_GetTypeFamily(LPCWSTR pszExtension);
  126. // metadata
  127. typedef void (CALLBACK *DISCOVERCALLBACK)(LPCWSTR /*pszFileName*/, ULONG_PTR /*param*/);
  128. void FileViewMeta_InitializeStorage(HWND hView);
  129. void FileViewMeta_ReleaseStorage(HWND hView);
  130. FILEMETARECORD *FileViewMeta_GetFromCache(LPCWSTR pszPath, FILERECORD *pfr);
  131. BOOL FileViewMeta_Discover(LPCWSTR pszPath, FILERECORD *pfr, DISCOVERCALLBACK fnCallback, ULONG_PTR param, INT queueMax);
  132. void FileViewMeta_TruncateQueue(size_t max);
  133. BOOL FileViewMeta_GetString(FILEMETARECORD *pMeta, UINT uMetaField, LPCWSTR *ppszOut);
  134. BOOL FileViewMeta_GetInt(FILEMETARECORD *pMeta, UINT uMetaField, INT *pOut);
  135. // formatting
  136. INT FileView_FormatFileTime(FILETIME *pft, LPWSTR pszDest, INT cchDest);
  137. INT FileView_FormatType(UINT fileType, LPWSTR pszDest, INT cchDest);
  138. INT FileView_FormatAttributes(UINT uAttributes, LPWSTR pszDest, INT cchDest);
  139. INT FileView_FormatYesNo(BOOL bValue, LPWSTR pszDest, INT cchDest);
  140. INT FileView_FormatYear(INT nYear, LPWSTR pszDest, INT cchDest);
  141. INT FileView_FormatBitrate(INT nBitrate, LPWSTR pszDest, INT cchDest);
  142. INT FileView_FormatLength(INT nLength, LPWSTR pszDest, INT cchDest);
  143. INT FileView_FormatIntSlashInt(INT part1, INT part2, LPWSTR pszDest, INT cchDest);
  144. #define FIF_TOOLTIP 0
  145. #define FIF_STATUS 1
  146. void FileView_FormatFileInfo(FILERECORD *pfr, LPWSTR pszText, size_t cchTextMax, UINT mode);
  147. void FileView_FormatAudioTip(FILERECORD *pfr, LPWSTR pszText, size_t cchTextMax, LPCWSTR pszSeparator);
  148. void FileView_FormatDefaultTip(FILERECORD *pfr, LPWSTR pszText, size_t cchTextMax, LPCWSTR pszSeparator);
  149. // sorting
  150. void FileView_SortByColumn(FILEDATA *pFileData, UINT uColumn);
  151. void FileView_SortByColumnEx(FILEDATA *pFileData, UINT uColumn, size_t *pOrder, size_t count);
  152. // menu
  153. HMENU FileViewMenu_Initialize();
  154. HMENU FileViewMenu_GetSubMenu(HWND hView, HMENU hViewMenu, UINT uMenuType);
  155. UINT FileViewMenu_GetMenuType(HWND hView, HMENU hViewMenu, HMENU hMenu);
  156. // view
  157. void FileView_DisplayPopupMenu(HWND hdlg, UINT uMenu, UINT uFlags, POINT pt);
  158. // registered columns
  159. typedef struct _FILEVIEWCOLUMN
  160. {
  161. UINT id;
  162. LPWSTR pszText;
  163. INT width;
  164. UINT format;
  165. INT order;
  166. INT widthMin;
  167. INT widthMax;
  168. } FILEVIEWCOLUMN;
  169. extern const FILEVIEWCOLUMN szRegisteredColumns[];
  170. extern const INT RegisteredColumnsCount;
  171. #endif // NULLOSFT_MEDIALIBRARY_FILEVIEW_CONTROL_INTERNAL_HEADER