main.h 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. #pragma once
  2. #include <wtypes.h>
  3. #include <windowsx.h>
  4. #include "./graphics.h"
  5. #include "DeviceView.h"
  6. #include "../ml_pmp/pmp.h"
  7. #include "..\..\General\gen_ml/itemlist.h"
  8. #include <map>
  9. #include "./syncDialog.h"
  10. #include "./syncCloudDialog.h"
  11. #ifndef LONGX86
  12. #ifdef _WIN64
  13. #define LONGX86 LONG_PTR
  14. #else /*_WIN64*/
  15. #define LONGX86 LONG
  16. #endif /*_WIN64*/
  17. #endif // LONGX86
  18. #define CSTR_INVARIANT MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT)
  19. #ifdef __cplusplus
  20. #define SENDMSG(__hwnd, __msgId, __wParam, __lParam) ::SendMessageW((__hwnd), (__msgId), (__wParam), (__lParam))
  21. #else
  22. #define SENDMSG(__hwnd, __msgId, __wParam, __lParam) SendMessageW((__hwnd), (__msgId), (__wParam), (__lParam))
  23. #endif // __cplusplus
  24. #define SENDMLIPC(__hwndML, __ipcMsgId, __param) SENDMSG((__hwndML), WM_ML_IPC, (WPARAM)(__param), (LPARAM)(__ipcMsgId))
  25. #define SENDWAIPC(__hwndWA, __ipcMsgId, __param) SENDMSG((__hwndWA), WM_WA_IPC, (WPARAM)(__param), (LPARAM)(__ipcMsgId))
  26. #define SENDCMD(__hwnd, __ctrlId, __eventId, __hctrl) (SENDMSG((__hwnd), WM_COMMAND, MAKEWPARAM(__ctrlId, __eventId), (LPARAM)(__hctrl)))
  27. #define DIALOG_RESULT(__hwnd, __result) { SetWindowLongPtrW((__hwnd), DWLP_MSGRESULT, ((LONGX86)(LONG_PTR)(__result))); return TRUE; }
  28. #ifndef RECTWIDTH
  29. #define RECTWIDTH(__r) ((__r).right - (__r).left)
  30. #endif
  31. #ifndef RECTHEIGHT
  32. #define RECTHEIGHT(__r) ((__r).bottom - (__r).top)
  33. #endif
  34. #undef CLAMP
  35. #define CLAMP(x, low, high) (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x)))
  36. #ifndef ARRAYSIZE
  37. #define ARRAYSIZE(_a) (sizeof(_a)/sizeof((_a)[0]))
  38. #endif
  39. #define DEFAULT_PMP_SEND_TO 1
  40. extern DeviceView *configDevice;
  41. extern winampMediaLibraryPlugin plugin;
  42. extern C_ItemList devices;
  43. extern HWND mainMessageWindow;
  44. extern std::map<DeviceView *, bool> device_update_map;
  45. extern C_Config * global_config;
  46. extern void Devices_Init();
  47. extern HMENU m_context_menus, m_context_menus2;
  48. /* indirectplaybackserver.cpp - for localhost HTTP-based playback (for devices that don't support direct playback */
  49. void startServer();
  50. void stopServer();
  51. ATOM GetViewAtom();
  52. void *GetViewData(HWND hwnd);
  53. BOOL SetViewData(HWND hwnd, void *data);
  54. void *RemoveViewData(HWND hwnd);
  55. BOOL FormatResProtocol(const wchar_t *resourceName,
  56. const wchar_t *resourceType,
  57. wchar_t *buffer,
  58. size_t bufferMax);
  59. #define CENTER_OVER_WINAMP ((HWND)0)
  60. #define CENTER_OVER_ML ((HWND)1)
  61. #define CENTER_OVER_ML_VIEW ((HWND)2)
  62. BOOL CenterWindow(HWND window, HWND centerWindow);
  63. HWND OnSelChanged(HWND hwndDlg, HWND external, DeviceView *dev);
  64. LinkedQueue *getTransferQueue(DeviceView *deviceView = NULL);
  65. LinkedQueue *getFinishedTransferQueue(DeviceView *deviceView = NULL);
  66. int getTransferProgress(DeviceView *deviceView = NULL);
  67. extern int groupBtn, customAllowed, enqueuedef;