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.

458 lines
7.1 KiB

  1. /******************************Module*Header*******************************\
  2. * Module Name: app.h
  3. *
  4. * Function prototype for the Video CD Player application.
  5. *
  6. *
  7. * Created: dd-mm-94
  8. * Author: Stephen Estrop [StephenE]
  9. *
  10. * Copyright (c) 1994 - 1999 Microsoft Corporation. All Rights Reserved.
  11. \**************************************************************************/
  12. /* -------------------------------------------------------------------------
  13. ** Functions prototypes
  14. ** -------------------------------------------------------------------------
  15. */
  16. int
  17. DoMainLoop(
  18. void
  19. );
  20. BOOL
  21. InitApplication(
  22. HINSTANCE hInstance
  23. );
  24. BOOL
  25. InitInstance(
  26. HINSTANCE hInstance,
  27. int nCmdShow
  28. );
  29. BOOL
  30. LoadWindowPos(
  31. LPRECT lprc
  32. );
  33. BOOL
  34. SaveWindowPos(
  35. HWND hwnd
  36. );
  37. void
  38. PatB(
  39. HDC hdc,
  40. int x,
  41. int y,
  42. int dx,
  43. int dy,
  44. DWORD rgb
  45. );
  46. void
  47. UpdateMpegMovieRect(
  48. void
  49. );
  50. void
  51. GetAdjustedClientRect(
  52. RECT *prc
  53. );
  54. BOOL
  55. DrawStats(
  56. HDC hdc
  57. );
  58. void
  59. CalcMovieRect(
  60. LPRECT lprc
  61. );
  62. LPCTSTR
  63. IdStr(
  64. int idResource
  65. );
  66. void
  67. UpdateSystemColors(
  68. void
  69. );
  70. #if 0
  71. void
  72. DrawShadowRect(
  73. HDC hdc,
  74. LPRECT lprc
  75. );
  76. #endif
  77. void
  78. SetDurationLength(
  79. REFTIME rt
  80. );
  81. void
  82. SetCurrentPosition(
  83. REFTIME rt
  84. );
  85. TCHAR *
  86. FormatRefTime(
  87. TCHAR *sz,
  88. REFTIME rt
  89. );
  90. void
  91. DoMpegVideoPropertyPage();
  92. void
  93. DoMpegAudioPropertyPage();
  94. /* -------------------------------------------------------------------------
  95. ** Registry stuff
  96. ** -------------------------------------------------------------------------
  97. */
  98. int
  99. ProfileIntIn(
  100. const TCHAR *szKey,
  101. int iDefault
  102. );
  103. BOOL
  104. ProfileIntOut(
  105. const TCHAR *szKey,
  106. int iDefault
  107. );
  108. void
  109. ProfileStringOut (
  110. LPTSTR szKey,
  111. LPTSTR sz
  112. );
  113. UINT
  114. ProfileStringIn (
  115. LPTSTR szKey,
  116. LPTSTR szDef,
  117. LPTSTR sz,
  118. DWORD cb
  119. );
  120. BOOL
  121. LoadWindowPos(
  122. LPRECT lprc
  123. );
  124. BOOL
  125. SaveWindowPos(
  126. HWND hwnd
  127. );
  128. HKEY
  129. GetAppKey(
  130. BOOL fCreate
  131. );
  132. /* -------------------------------------------------------------------------
  133. ** Message crackers
  134. ** -------------------------------------------------------------------------
  135. */
  136. /* void Cls_OnUser(HWND hwnd, WPARAM wParam, LPARAM lParam ) */
  137. #define HANDLE_WM_USER(hwnd, wParam, lParam, fn) \
  138. ((fn)(hwnd, wParam, lParam), 0L)
  139. #ifndef HANDLE_WM_NOTIFY
  140. /* LRESULT Cls_OnNotify(HWND hwnd, int idFrom, NMHDR FAR* pnmhdr); */
  141. #define HANDLE_WM_NOTIFY(hwnd, wParam, lParam, fn) \
  142. (fn)((hwnd), (int)(wParam), (NMHDR FAR*)(lParam))
  143. #endif
  144. /* -------------------------------------------------------------------------
  145. ** VideoCd window class prototypes
  146. ** -------------------------------------------------------------------------
  147. */
  148. extern "C" LRESULT CALLBACK
  149. VideoCdWndProc(
  150. HWND hwnd,
  151. UINT message,
  152. WPARAM wParam,
  153. LPARAM lParam
  154. );
  155. void
  156. VideoCd_OnClose(
  157. HWND hwnd
  158. );
  159. BOOL
  160. VideoCd_OnQueryEndSession(
  161. HWND hwnd
  162. );
  163. void
  164. VideoCd_OnDestroy(
  165. HWND hwnd
  166. );
  167. void
  168. VideoCd_OnCommand(
  169. HWND hwnd,
  170. int id,
  171. HWND hwndCtl,
  172. UINT codeNotify
  173. );
  174. void
  175. VideoCd_OnPaint(
  176. HWND hwnd
  177. );
  178. void
  179. VideoCd_OnTimer(
  180. HWND hwnd,
  181. UINT id
  182. );
  183. BOOL
  184. VideoCd_OnCreate(
  185. HWND hwnd,
  186. LPCREATESTRUCT lpCreateStruct
  187. );
  188. void
  189. VideoCd_OnSize(
  190. HWND hwnd,
  191. UINT state,
  192. int cx,
  193. int cy
  194. );
  195. void
  196. VideoCd_OnKeyUp(
  197. HWND hwnd,
  198. UINT vk,
  199. BOOL fDown,
  200. int cRepeat,
  201. UINT flags
  202. );
  203. void
  204. VideoCd_OnActivate(
  205. HWND hwnd,
  206. WPARAM wParam,
  207. LPARAM lParam
  208. );
  209. void
  210. VideoCd_OnHScroll(
  211. HWND hwnd,
  212. HWND hwndCtl,
  213. UINT code,
  214. int pos
  215. );
  216. void
  217. VideoCd_OnUser(
  218. HWND hwnd,
  219. WPARAM wParam,
  220. LPARAM lParam
  221. );
  222. void
  223. VideoCd_OnSysColorChange(
  224. HWND hwnd
  225. );
  226. void
  227. VideoCd_OnMenuSelect(
  228. HWND hwnd,
  229. HMENU hmenu,
  230. int item,
  231. HMENU hmenuPopup,
  232. UINT flags
  233. );
  234. void
  235. VideoCd_OnInitMenuPopup(
  236. HWND hwnd,
  237. HMENU hMenu,
  238. UINT item,
  239. BOOL fSystemMenu
  240. );
  241. #ifdef WM_NOTIFY
  242. LRESULT
  243. VideoCd_OnNotify(
  244. HWND hwnd,
  245. int idFrom,
  246. NMHDR FAR* pnmhdr
  247. );
  248. #endif
  249. void
  250. VideoCd_OnGraphNotify(
  251. void
  252. );
  253. void
  254. VideoCd_OnDropFiles(
  255. HWND hwnd,
  256. HDROP hdrop);
  257. void
  258. SetPlayButtonsEnableState(
  259. void
  260. );
  261. /* -------------------------------------------------------------------------
  262. ** Command processing functions
  263. ** -------------------------------------------------------------------------
  264. */
  265. BOOL
  266. VcdPlayerSetLog(
  267. void
  268. );
  269. BOOL
  270. VcdPlayerSetPerfLogFile(
  271. void
  272. );
  273. BOOL
  274. VcdPlayerOpenCmd(
  275. void
  276. );
  277. BOOL
  278. VcdPlayerCloseCmd(
  279. void
  280. );
  281. BOOL
  282. VcdPlayerPlayCmd(
  283. void
  284. );
  285. BOOL
  286. VcdPlayerStopCmd(
  287. void
  288. );
  289. BOOL
  290. VcdPlayerPauseCmd(
  291. void
  292. );
  293. BOOL
  294. VcdPlayerPauseCmd(
  295. void
  296. );
  297. void
  298. VcdPlayerSeekCmd(
  299. REFTIME rtSeekBy
  300. );
  301. void
  302. ProcessOpen(
  303. TCHAR *achFileName,
  304. BOOL bPlay = FALSE
  305. );
  306. int
  307. VcdPlayerChangeTimeFormat(
  308. int id
  309. );
  310. /* -------------------------------------------------------------------------
  311. ** Recent filename stuff
  312. ** -------------------------------------------------------------------------
  313. */
  314. typedef TCHAR RECENTFILES[MAX_PATH];
  315. #define MAX_RECENT_FILES 5
  316. #define ID_RECENT_FILE_BASE 500
  317. int
  318. GetRecentFiles(
  319. int LastCount
  320. );
  321. int
  322. SetRecentFiles(
  323. TCHAR *FileName,
  324. int iCount
  325. );
  326. /* -------------------------------------------------------------------------
  327. ** Global Variables
  328. ** -------------------------------------------------------------------------
  329. */
  330. extern int cxMovie;
  331. extern int cyMovie;
  332. extern HWND hwndApp;
  333. extern HWND g_hwndStatusbar;
  334. extern int cx;
  335. extern int cy;
  336. extern int xOffset;
  337. extern int yOffset;
  338. extern TCHAR g_achFileName[];
  339. extern OPENFILENAME ofn;
  340. extern DWORD g_State;
  341. extern HANDLE hRenderLog;
  342. extern int nRecentFiles;
  343. extern LONG lMovieOrgX, lMovieOrgY;
  344. extern TCHAR g_szPerfLog[];
  345. extern int g_TimeFormat;
  346. extern BOOL g_bUseThreadedGraph;
  347. /* -------------------------------------------------------------------------
  348. ** Constants
  349. ** -------------------------------------------------------------------------
  350. */
  351. #define LEFT_MARGIN 2
  352. /* -------------------------------------------------------------------------
  353. ** Video CD Player states
  354. **
  355. ** These are bit flags
  356. ** -------------------------------------------------------------------------
  357. */
  358. #define VCD_PLAYING 0x0001
  359. #define VCD_STOPPED 0x0002
  360. #define VCD_PAUSED 0x0004
  361. #define VCD_SKIP_F 0x0008
  362. #define VCD_SKIP_B 0x0010
  363. #define VCD_FF 0x0020
  364. #define VCD_RW 0x0040
  365. #define VCD_SEEKING (VCD_FF | VCD_RW)
  366. #define VCD_LOADED 0x0080
  367. #define VCD_NO_CD 0x0100
  368. #define VCD_DATA_CD_LOADED 0x0200
  369. #define VCD_EDITING 0x0400
  370. #define VCD_PAUSED_AND_MOVED 0x0800
  371. #define VCD_PLAY_PENDING 0x1000
  372. #define VCD_WAS_PLAYING 0x2000
  373. #define VCD_IN_USE 0x4000
  374. enum {PerformanceTimer = 32, StatusTimer = 33};