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.

724 lines
28 KiB

  1. /*-----------------------------------------------------------------------------+
  2. | MPLAYER.H |
  3. | |
  4. | (C) Copyright Microsoft Corporation 1991. All rights reserved. |
  5. | |
  6. | Revision History |
  7. | Oct-1992 MikeTri Ported to WIN32 / WIN16 common code |
  8. | |
  9. +-----------------------------------------------------------------------------*/
  10. #if (DBG || defined(DEBUG_RETAIL))
  11. #ifndef DEBUG
  12. #define DEBUG
  13. #endif
  14. #endif
  15. #include <stdlib.h> // Make sure _MAX_PATH is defined if it's there
  16. #include <malloc.h>
  17. #include "dynalink.h"
  18. #include "menuids.h"
  19. #include "helpids.h"
  20. #include "mci.h"
  21. #include "unicode.h"
  22. #include "alloc.h"
  23. #ifndef CHICAGO_PRODUCT
  24. #ifndef RC_INVOKED
  25. #include <winuserp.h>
  26. #endif
  27. #endif
  28. #include <commctrl.h>
  29. #define TBM_SHOWTICS (WM_USER+30)
  30. /* Dialog style on Win4+
  31. */
  32. #ifndef DS_CONTEXTHELP
  33. #define DS_CONTEXTHELP 0
  34. #endif
  35. /* These macros were originally defined for 16-32 portability.
  36. * The code is now expected to build for Win32 only.
  37. */
  38. #define LONG2POINT(l, pt) ((pt).x = (SHORT)LOWORD(l), (pt).y = (SHORT)HIWORD(l))
  39. #define GETWINDOWUINT(hwnd, index) (UINT)GetWindowLongPtr(hwnd, index)
  40. #define GETWINDOWID(hwnd) GETWINDOWUINT((hwnd), GWL_ID)
  41. #define GETHWNDINSTANCE(hwnd) (HINSTANCE)GetWindowLongPtr((hwnd), GWLP_HINSTANCE)
  42. #define SETWINDOWUINT(hwnd, index, ui) (UINT)SetWindowLongPtr(hwnd, index, (LONG_PTR)(ui))
  43. #define MMoveTo(hdc, x, y) MoveToEx(hdc, x, y, NULL)
  44. #define MSetViewportExt(hdc, x, y) SetViewportExtEx(hdc, x, y, NULL)
  45. #define MSetViewportOrg(hdc, x, y) SetViewportOrgEx(hdc, x, y, NULL)
  46. #define MSetWindowExt(hdc, x, y) SetWindowExtEx(hdc, x, y, NULL)
  47. #define MSetWindowOrg(hdc, x, y) SetWindowOrgEx(hdc, x, y, NULL)
  48. #define MGetCurrentTask (HANDLE)ULongToPtr(GetCurrentThreadId())
  49. #define _EXPORT
  50. BOOL WINAPI MGetTextExtent(HDC hdc, LPSTR lpstr, INT cnt, INT *pcx, INT *pcy);
  51. #ifndef RC_INVOKED
  52. #pragma warning(disable: 4001) // nonstandard extension 'single line comment' was used
  53. #pragma warning(disable: 4201) // nonstandard extension used : nameless struct/union
  54. #pragma warning(disable: 4214) // nonstandard extension used : bit field types other than int
  55. #pragma warning(disable: 4103) // used #pragma pack to change alignment (on Chicago)
  56. #endif
  57. #ifdef OLE1_HACK
  58. /* Disgusting OLE1 hackery:
  59. */
  60. void Ole1UpdateObject(void);
  61. extern DWORD gDocVersion;
  62. #define DOC_VERSION_NONE 0
  63. #define DOC_VERSION_OLE1 1
  64. #define DOC_VERSION_OLE2 2
  65. VOID SetDocVersion( DWORD DocVersion );
  66. #endif /* OLE1_HACK */
  67. //
  68. // have the debug version show preview.
  69. //
  70. extern BOOL gfShowPreview;
  71. #define DEF_WIDTH ((GetACP()==932)?600:400)
  72. #define DEF_HEIGHT 124
  73. #define CAPTION_LEN 80 // max length of caption
  74. /* BOGUS constants for Layout() */
  75. #define FSARROW_WIDTH 20 // width of one arrow bitmap for SB
  76. #define FSARROW_HEIGHT 17 // height
  77. #define FSTRACK_HEIGHT 30 // height of the scrollbar
  78. #define LARGE_CONTROL_WIDTH 172 // Width of full transport toolbar
  79. #define SMALL_CONTROL_WIDTH 73 // width with only 3 buttons
  80. #define SB_XPOS 4 // how far in to put scrollbar
  81. #define SHOW_MARK_WIDTH 363 // when to drop mark buttons
  82. #define MAP_HEIGHT 14 // height of trackmap window
  83. #define FULL_TOOLBAR_WIDTH 307 // when to drop last 4 transport btns
  84. #define MARK_WIDTH 52 // width of mark button toolbar
  85. #define MAX_NORMAL_HEIGHT 73 // max size for non-windowed device
  86. #define MIN_NORMAL_HEIGHT 27 // min size for anybody
  87. #ifndef _MAX_PATH
  88. #define _MAX_PATH 144 /* max. length of full pathname */
  89. #endif
  90. #define TOOLBAR_HEIGHT 27
  91. #define BUTTONWIDTH 25
  92. #define BUTTONHEIGHT 23
  93. #define SZCODE TCHAR
  94. /* Strings that MUST be ANSI even if we're compiling Unicode
  95. * e.g. to pass to GetProcAddress, which is ANSI only:
  96. */
  97. #define ANSI_SZCODE CHAR
  98. #define ANSI_TEXT( quote ) quote
  99. /* Macro for string replacement parameter in printf etc:
  100. * (Anyone know of a better way to do this?)
  101. */
  102. #ifdef UNICODE
  103. #define TS L"ws"L
  104. #ifdef DEBUG
  105. #define DTS "ws" /* For unicode args to ASCII API */
  106. #endif
  107. #else
  108. #define TS "s"
  109. #ifdef DEBUG
  110. #define DTS "s"
  111. #endif
  112. #endif /* UNICODE */
  113. /* defines for set sel dlg box */
  114. #define IDC_EDITALL 220 // these 3 are a group
  115. #define IDC_EDITSOME 221
  116. #define IDC_EDITNONE 222
  117. #define IDC_EDITFROM 223
  118. #define IDC_EDITTO 224
  119. #define IDC_EDITNUM 225
  120. #define IDC_SELECTG 226 /* Needed for Context sensitive help */
  121. #define IDC_ETTEXT 227
  122. #define IDC_ESTEXT 228
  123. #define ARROWEDITDELTA 10 /* Add to arrow ID to get edit ID */
  124. #define IDC_XARROWS 180
  125. #define IDC_YARROWS 181
  126. #define IDC_WARROWS 182
  127. #define IDC_HARROWS 183
  128. #define IDC_FARROWS 183
  129. #define IDC_TARROWS 184
  130. #define IDC_NARROWS 210
  131. /* Controls for Selection range dialog */
  132. #define IDC_MARKIN 150
  133. #define IDC_MARKOUT 151
  134. #define DLG_MCICOMMAND 942
  135. #define IDC_MCICOMMAND 10
  136. #define IDC_RESULT 11
  137. /* Bit fields for the gwOptions */
  138. // bottom two bits = Scale Mode (01 = FRAMES) (10 = TIME) (11 = TRACK)
  139. #define OPT_SCALE 0x0003
  140. #define OPT_TITLE 0x0004
  141. #define OPT_BORDER 0x0008
  142. #define OPT_PLAY 0x0010
  143. #define OPT_BAR 0x0020
  144. #define OPT_DITHER 0x0040
  145. #define OPT_AUTORWD 0x0080
  146. #define OPT_AUTOREP 0x0100
  147. #define OPT_USEPALETTE 0x0200
  148. #define OPT_DEFAULT (ID_TIME|OPT_TITLE|OPT_BORDER|OPT_PLAY|OPT_BAR)
  149. #define OPT_FIRST OPT_TITLE
  150. #if 1
  151. #define OPT_LAST OPT_AUTOREP
  152. #else
  153. #define OPT_LAST OPT_USEPALETTE
  154. #endif
  155. #define IDC_CAPTIONTEXT 202
  156. #define IDC_OLEOBJECT 203
  157. #define IDC_TITLETEXT 160
  158. #define TITLE_HEIGHT TOOLBAR_HEIGHT // height of title bar part of object picture
  159. /* Options used when initial Open dialog is displayed:
  160. */
  161. #define OPEN_NONE (UINT)-1
  162. #define OPEN_VFW 0
  163. #define OPEN_MIDI 1
  164. #define OPEN_WAVE 2
  165. #define MCIWND_STYLE WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | \
  166. MCIWNDF_NOPLAYBAR | MCIWNDF_NOMENU | MCIWNDF_SHOWNAME | \
  167. MCIWNDF_NOTIFYALL
  168. /* Parameters for GetIconForCurrentDevice:
  169. */
  170. #define GI_LARGE 0
  171. #define GI_SMALL 1
  172. /* For mapping strings to device IDs
  173. */
  174. typedef struct _STRING_TO_ID_MAP
  175. {
  176. LPTSTR pString;
  177. UINT ID;
  178. }
  179. STRING_TO_ID_MAP, *PSTRING_TO_ID_MAP;
  180. /* global array of all mci devices */
  181. typedef struct {
  182. UINT wDeviceType; // flags, DTMCI_*
  183. PTSTR szDevice; // name used to open device e.g. "WaveAudio"
  184. PTSTR szDeviceName; // name to display to user e.g. "Wave Audio"
  185. PTSTR szFileExt; // file extensions used by device.
  186. } MCIDEVICE, *PMCIDEVICE;
  187. #define MAX_MCI_DEVICES 50
  188. extern UINT gwCurDevice; /* current device */
  189. extern UINT gwNumDevices; /* number of available devices */
  190. extern MCIDEVICE garMciDevices[]; /* array with info about a device */
  191. /* global variables */
  192. extern DWORD gwPlatformId; // Win95, NT etc
  193. extern BOOL gfEmbeddedObject; // TRUE if editing embedded OLE object
  194. extern BOOL gfPlayingInPlace; // TRUE if playing in place
  195. extern BOOL gfParentWasEnabled; // TRUE if parent was enabled
  196. extern BOOL gfShowWhilePlaying; //
  197. extern BOOL gfDirty; //
  198. extern int gfErrorBox; // TRUE if we have a message box active
  199. extern BOOL gfErrorDeath; // Die when errorbox is up
  200. extern BOOL gfOleInitialized;
  201. extern BOOL gfOle2Open;
  202. extern BOOL gfOle2IPEditing;
  203. extern BOOL gfOle2IPPlaying;
  204. extern RECT gInPlacePosRect;
  205. extern HWND ghwndCntr;
  206. extern HWND ghwndIPToolWindow;
  207. extern HWND ghwndIPScrollWindow;
  208. extern LPWSTR sz1Ole10Native;
  209. extern UINT gwOptions; /* play options */
  210. extern UINT gwOpenOption; /* Type of file to open */
  211. extern BOOL gfOpenDialog; // If TRUE, put up open dialog
  212. extern BOOL gfCloseAfterPlaying; // TRUE if we are to hide after play
  213. extern BOOL gfRunWithEmbeddingFlag; // TRUE if run with "-Embedding"
  214. extern HMENU ghMenu; /* normal menu */
  215. extern HICON hiconApp; /* the applicaiion's icon */
  216. extern HANDLE ghInst; /* the application's instance handle */
  217. extern DWORD gfdwFlagsEx; /* the application's RTL status */
  218. extern HANDLE ghInstPrev; /* the application's instance handle */
  219. extern HFONT ghfontMap; /* font used for drawing the track map */
  220. extern HWND ghwndApp; /* handle to the main dialog window */
  221. extern HWND ghwndMap; /* handle to the track map window */
  222. extern HWND ghwndTrackbar; /* handle to the horizontal track bar */
  223. extern HWND ghwndToolbar; /* handle to the toolbar */
  224. extern HWND ghwndMark; /* handle to the Mark buttons toolbar */
  225. extern HWND ghwndFSArrows; /* handle to the scrollbar arrows */
  226. extern HWND ghwndStatic; /* handle ot the static text window */
  227. extern HWND ghwndMCI; /* MCI window returned from MCIWndCreate */
  228. extern HBRUSH ghbrFillPat; /* The selection fill pattern. */
  229. extern UINT gwHeightAdjust; /* Difference between client & non-c height */
  230. extern LPTSTR gszCmdLine; /* null-terminated command line str. */
  231. extern int giCmdShow; /* show command */
  232. extern UINT gwDeviceID; /* current MCI device ID (or NULL) */
  233. extern UINT gwStatus; /* status of current MCI device */
  234. extern UINT gwNumTracks; /* current # of tracks in the medium */
  235. extern UINT gwFirstTrack; /* number of first track */
  236. extern BOOL gfValidMediaInfo; /* are we displaying valid media info? */
  237. extern BOOL gfValidCaption; /* are we displaying a valid caption? */
  238. extern BOOL gfPlayOnly; /* play only window? */
  239. extern BOOL gfJustPlayed; /* Just sent a PlayMCI() command */
  240. extern DWORD gdwLastSeekToPosition; /* Last requested seek position */
  241. extern DWORD gdwMediaLength; /* length of entire medium in msec. */
  242. extern DWORD gdwMediaStart; /* start of medium in msec. */
  243. extern DWORD NEAR * gadwTrackStart; /* array of track start positions */
  244. extern UINT gwOptions; /* the options from the dlg box */
  245. extern SZCODE aszIntl[]; /* string for international section */
  246. extern TCHAR gachAppName[]; /* string for holding the app. name */
  247. extern TCHAR gachClassRoot[]; /* string for holding the class root OLE "Media Clip"*/
  248. extern TCHAR chDecimal; /* Stores current decimal separator */
  249. extern TCHAR chTime; /* Stores the current Time separator */
  250. extern TCHAR chLzero; /* Stores if Leading Zero required for decimal numbers less than 1 */
  251. extern TCHAR aszNotReadyFormat[];
  252. extern TCHAR aszReadyFormat[];
  253. extern TCHAR gachFileDevice[_MAX_PATH]; /* string holding the current file or device name */
  254. extern TCHAR gachWindowTitle[_MAX_PATH]; /* string holding name */
  255. extern TCHAR gachCaption[_MAX_PATH]; /* string holding name */
  256. extern TCHAR gachOpenExtension[5]; /* Non-null if a device extension passed in */
  257. extern TCHAR gachOpenDevice[128]; /* Non-null if a device extension passed in */
  258. extern TCHAR gszHelpFileName[];/* name of the help file */
  259. extern TCHAR gszHtmlHelpFileName[];/* name of the html help file */
  260. extern DWORD gdwSeekPosition; /* Position to seek to after skipping track. */
  261. extern BOOL gfScrollTrack; /* is user dragging the scrollbar thumb? */
  262. extern UINT gwCurScale; /* scale is TIME/TRACKS/FRAMES */
  263. extern INT gwCurZoom; /* current zoom factor */
  264. extern HWND ghwndMCI; /* current window for window objects */
  265. extern RECT grcSize; /* size of MCI object */
  266. extern BOOL gfAppActive; /* Our app active? (incl. playback win) */
  267. extern LONG glSelStart; /* See if selection changes (dirty object)*/
  268. extern LONG glSelEnd; /* See if selection changes (dirty object)*/
  269. extern HPALETTE ghpalApp;
  270. extern BOOL gfInClose;
  271. extern BOOL gfCurrentCDNotAudio; /* TRUE when we have a CD that we can't play */
  272. extern BOOL gfWinIniChange;
  273. extern DWORD gdwPosition; /* The Seek position we emedded */
  274. extern BOOL gfSeenPBCloseMsg;
  275. extern int giHelpContext; /* Contains the context id for help */
  276. extern HANDLE heventDeviceMenuBuilt;/* Event will be signaled when device menu complete */
  277. extern HANDLE heventCmdLineScanned; /* Event will be signaled when command line scanned */
  278. // strings for registration database
  279. extern SZCODE aszKeyMID[];
  280. extern SZCODE aszKeyRMI[];
  281. extern SZCODE aszKeyAVI[];
  282. extern SZCODE aszKeyMMM[];
  283. extern SZCODE aszKeyWAV[];
  284. extern SZCODE szCDAudio[];
  285. extern SZCODE szVideoDisc[];
  286. extern SZCODE szSequencer[];
  287. extern SZCODE szVCR[];
  288. extern SZCODE szWaveAudio[];
  289. extern SZCODE szAVIVideo[];
  290. /* constants */
  291. #define DEVNAME_MAXLEN 40 /* the maximum length of a device name */
  292. /* IDs of icons and dialog boxes */
  293. #define APPICON 10 /* ID of the application's icon */
  294. #define IDI_DDEFAULT 11
  295. #define IDI_DSOUND 12
  296. #define IDI_DVIDEO 13
  297. #define IDI_DANI 14
  298. #define IDI_DMIDI 15
  299. #define IDI_DCDA 16
  300. #define IDC_DRAG 17
  301. #define MPLAYERBOX 11 /* ID of the main "MPlayer" dialog box */
  302. #define MPLAYERACCEL 1
  303. /* IDs of the MPLAYERBOX (main dialog box) controls */
  304. #define ID_MAP 20 /* ID of thetrack map */
  305. #define ID_SB 21 /* ID of the horizontal scrollbar */
  306. #define ID_STATIC 22 /* ID of the static text control */
  307. #define ID_PLAY 23 /* Command 'Play' */
  308. #define ID_PAUSE 24 /* Command 'Pause' */
  309. #define ID_STOP 25 /* Command 'Stop' */
  310. #define ID_PLAYSEL 26 /* Command 'Play Selection' */
  311. #define ID_PLAYTOGGLE 27 /* For accelerator to toggle play/pause*/
  312. #define ID_EJECT 28 /* Command 'Eject' */
  313. #define ID_ESCAPE 29 /* Escape key was hit */
  314. /* IDs of the string resources */
  315. #define IDS_APPNAME 100 /* ID of the application name string */
  316. #define IDS_OPENTITLE 101 /* ID of the "Open Media File" str. */
  317. #define IDS_OUTOFMEMORY 102 /* ID of the "Out of memory" string */
  318. #define IDS_CANTOPENFILEDEV 103 /* ID of the "Cannot open file/dev" str*/
  319. #define IDS_DEVICEINUSE 104 /* ID of the "Device is in use" string */
  320. #define IDS_CANTOPENFILE 105 /* ID of the "Cannot open file" string */
  321. #define IDS_CANTACCESSFILEDEV 106 /* ID of the "Cannot access..." str. */
  322. #define IDS_DEVICECANNOTPLAY 107 /* ID of the "Cannot play..." str. */
  323. #define IDS_SCALE 108 /* ID of the "Scale" string */
  324. #define IDS_CANTPLAY 109
  325. #define IDS_CANTEDIT 110
  326. #define IDS_CANTCOPY 111
  327. #define IDS_FINDFILE 112
  328. #define IDS_DEVICENOTINSTALLED 113
  329. #define IDS_DEVICEERROR 114 /* ID of the "Device error" str. */
  330. #define IDS_CANTPLAYSOUND 115
  331. #define IDS_CANTPLAYVIDEO 116
  332. #define IDS_CANTPLAYMIDI 117
  333. #define IDS_NOTSOUNDFILE 118
  334. #define IDS_NOTVIDEOFILE 119
  335. #define IDS_NOTMIDIFILE 120
  336. #define IDS_TIMEMODE 121 /* Moved "Set Selection" strings from */
  337. #define IDS_FRAMEMODE 122 /* being embedded in DLGS.C ! */
  338. #define IDS_TRACKMODE 123
  339. #define IDS_SEC 124 /* "hrs", "min", "sec" and "msec" string ids. */
  340. #define IDS_MIN 125
  341. #define IDS_HRS 126
  342. #define IDS_MSEC 127
  343. #define IDS_FRAME 128 /* "frame" string id. */
  344. #define IDS_UPDATEOBJECT 129
  345. #define IDS_NOTREADYFORMAT 132
  346. #define IDS_READYFORMAT 133
  347. #define IDS_DEVICEMENUCOMPOUNDFORMAT 134
  348. #define IDS_DEVICEMENUSIMPLEFORMAT 135
  349. #define IDS_ALLFILES 136
  350. #define IDS_ANYDEVICE 137
  351. #define IDS_CLASSROOT 138
  352. #define IDS_NOGOODTIMEFORMATS 139
  353. #define IDS_FRAMERANGE 140
  354. #define IDS_INIFILE 141 /* ID of the private INI file name */
  355. #define IDS_HELPFILE 142 /* ID of help file name */
  356. #define IDS_HTMLHELPFILE 147 /* ID of HTML help file */
  357. #define IDS_NOMCIDEVICES 143 /* no MCI devices are installed. */
  358. #define IDS_PLAYVERB 144
  359. #define IDS_EDITVERB 145
  360. #define IDS_CANTSTARTOLE 146
  361. #define IDS_UNTITLED 149
  362. #define IDS_CANTLOADLIB 151
  363. #define IDS_CANTFINDPROC 152
  364. #define IDS_MPLAYERWIDTH 200
  365. #define IDS_CANTACCESSFILE 250
  366. /* These macros and typedefs can be used to clarify whether we're talking about
  367. * numbers of characters or numbers of bytes in a given buffer.
  368. * Unfortunately C doesn't give us type checking to do this properly.
  369. */
  370. #define BYTE_COUNT( buf ) sizeof(buf)
  371. #define CHAR_COUNT( buf ) (sizeof(buf) / sizeof(TCHAR))
  372. /* Find how many bytes are in a given string:
  373. */
  374. #define STRING_BYTE_COUNT( str ) (STRLEN(str) * sizeof(TCHAR) + sizeof(TCHAR))
  375. #define ANSI_STRING_BYTE_COUNT( str ) (strlen(str) * sizeof(CHAR) + sizeof(CHAR))
  376. /* Check the length of a string or number of bytes where NULL is a valid
  377. * pointer which should give a length of 0:
  378. */
  379. #define STRLEN_NULLOK( str ) ((str) ? STRLEN(str) : 0)
  380. #define STRING_BYTE_COUNT_NULLOK( str ) ((str) ? STRING_BYTE_COUNT(str) : 0)
  381. /* Use this macro for loading strings. It make the parameter list tidier
  382. * and ensures we pass the buffer size in CHARACTERS, not bytes.
  383. * This assumes that the buffer is static, not dynamically allocated.
  384. */
  385. #define LOADSTRING( id, buf ) LoadString(ghInst, (UINT)id, buf, CHAR_COUNT(buf))
  386. #define LOADSTRINGFROM( inst, id, buf ) LoadString(inst, id, buf, CHAR_COUNT(buf))
  387. /* track map scale values */
  388. #define SCALE_HOURS 153 /* draw the scale in hours */
  389. #define SCALE_MINUTES 154 /* draw the scale in minutes */
  390. #define SCALE_SECONDS 155 /* draw the scale in seconds */
  391. #define SCALE_MSEC 156 /* draw it in milli vanilliseconds */
  392. #define SCALE_FRAMES 157 /* draw scale in 'frames' */
  393. #define SCALE_TRACKS 158
  394. #define SCALE_NOTRACKS 159
  395. #define IDS_CLOSE 160
  396. #define IDS_UPDATE 161
  397. #define IDS_NOPICTURE 162
  398. #define IDS_EXIT 163
  399. #define IDS_EXITRETURN 164
  400. #define IDS_SSNOTREADY 170
  401. #define IDS_SSPAUSED 171
  402. #define IDS_SSPLAYING 172
  403. #define IDS_SSSTOPPED 173
  404. #define IDS_SSOPEN 174
  405. #define IDS_SSPARKED 175
  406. #define IDS_SSRECORDING 176
  407. #define IDS_SSSEEKING 177
  408. #define IDS_SSUNKNOWN 178
  409. #define IDS_OLEVER 180
  410. #define IDS_OLEINIT 181
  411. #define IDS_OLENOMEM 182
  412. //InPlace menu names.
  413. #define IDS_EDITMENU 185
  414. #define IDS_INSERTMENU 186
  415. #define IDS_SCALEMENU 187
  416. #define IDS_COMMANDMENU 188
  417. #define IDS_HELPMENU 189
  418. #define IDS_NONE 190
  419. #define IDS_MSGFORMAT 191
  420. #define IDS_FORMATEMBEDDEDTITLE 192
  421. #define IDS_IS_RTL 193
  422. // String for registry fix-up message
  423. #define IDS_BADREG 195
  424. #define IDS_FIXREGERROR 196
  425. #define IDS_NETWORKERROR 197
  426. #define IDS_UNKNOWNNETWORKERROR 198
  427. #define IDS_INSERTAUDIODISC 199
  428. /* macros for displaying error messages */
  429. #define MB_ERROR (MB_ICONEXCLAMATION | MB_OK)
  430. #define Error(hwnd, idsFmt) \
  431. ( ErrorResBox(hwnd, ghInst, MB_ERROR, IDS_APPNAME, (idsFmt)), FALSE )
  432. #define Error1(hwnd, idsFmt, arg1) \
  433. ( ErrorResBox(hwnd, ghInst, MB_ERROR, IDS_APPNAME, (idsFmt), (arg1)), \
  434. FALSE )
  435. #define Error2(hwnd, idsFmt, arg1, arg2) \
  436. ( ErrorResBox(hwnd, ghInst, MB_ERROR, IDS_APPNAME, (idsFmt), (arg1), \
  437. (arg2)), FALSE )
  438. /* app tabbing code */
  439. BOOL IsDannyDialogMessage(HWND hwndApp, MSG msg);
  440. /* calc where the tics belong on the scrollbar */
  441. void FAR PASCAL CalcTicsOfDoom(void);
  442. /* Layout the main window and the children */
  443. void FAR PASCAL Layout(void);
  444. /* prototypes from "errorbox.c" */
  445. short FAR cdecl ErrorResBox(HWND hwnd, HANDLE hInst, UINT flags,
  446. UINT idAppName, UINT idErrorStr, ...);
  447. /* function prototypes from "framebox.c" */
  448. BOOL FAR PASCAL frameboxInit(HANDLE hInst, HANDLE hPrev);
  449. /* function prototypes from "dlgs.c" */
  450. BOOL FAR PASCAL mciDialog(HWND hwnd);
  451. BOOL FAR PASCAL setselDialog(HWND hwnd);
  452. BOOL FAR PASCAL optionsDialog(HWND hwnd);
  453. /* function prototypes from "arrow.c" */
  454. BOOL FAR PASCAL ArrowInit(HANDLE hInst);
  455. /* function prototypes from "mplayer.c" */
  456. void FAR PASCAL FormatTime(DWORD_PTR dwPosition, LPTSTR szNum, LPTSTR szBuf, BOOL fRound);
  457. void FAR PASCAL UpdateDisplay(void);
  458. void FAR PASCAL EnableTimer(BOOL fEnable);
  459. LRESULT FAR PASCAL MPlayerWndProc(HWND hwnd, UINT wMsg, WPARAM wParam, LPARAM lParam);
  460. HICON GetIconForCurrentDevice(UINT Size, UINT DefaultID);
  461. void SetMPlayerIcon(void);
  462. /* function prototypes from "init.c" */
  463. BOOL FAR PASCAL AppInit(HANDLE hInst, HANDLE hPrev, LPTSTR szCmdLine);
  464. void FAR PASCAL InitMPlayerDialog(HWND hwnd);
  465. BOOL FAR PASCAL GetIntlSpecs(void);
  466. void FAR PASCAL SmartWindowPosition (HWND hWndDlg, HWND hWndShow, BOOL fForce);
  467. void FAR PASCAL SizeMPlayer(void);
  468. void FAR PASCAL SetMPlayerSize(LPRECT prc);
  469. void FAR PASCAL InitDeviceMenu(void);
  470. void WaitForDeviceMenu(void);
  471. VOID FAR PASCAL CompleteOpenDialog(BOOL FileSelected);
  472. /* function prototypes from "open.c" */
  473. INT_PTR FAR PASCAL DoOpen(UINT wCurDevice, LPTSTR SzFileName);
  474. BOOL FAR PASCAL DoChooseDevice(UINT wID);
  475. void FAR PASCAL CheckDeviceMenu(void);
  476. BOOL FAR PASCAL OpenMciDevice(LPCTSTR szFile, LPCTSTR szDevice);
  477. UINT FAR PASCAL IsMCIDevice(LPCTSTR szDevice);
  478. /* function prototype from "trackmap.c" */
  479. LRESULT FAR PASCAL fnMPlayerTrackMap(HWND hwnd, UINT wMsg, WPARAM wParam,
  480. LPARAM lParam);
  481. /* function prototype from init.c */
  482. void FAR PASCAL WriteOutPosition(void);
  483. void FAR PASCAL WriteOutOptions(void);
  484. void FAR PASCAL ReadOptions(void);
  485. void MapStatusString(LPTSTR lpstatusstr);
  486. /* function prototype from "math.asm", if needed */
  487. #define MULDIV32( number, numerator, denominator ) \
  488. MulDiv( (int)number, (int)numerator, (int)denominator )
  489. /* function prototype from "doverb.c" */
  490. LPTSTR FAR FileName(LPCTSTR);
  491. /* constants */
  492. #define WM_USER_DESTROY (WM_USER+120)
  493. #define WM_SEND_OLE_CHANGE (WM_USER+122)
  494. #define WM_STARTTRACK (WM_USER+123)
  495. #define WM_ENDTRACK (WM_USER+124)
  496. #define WM_BADREG (WM_USER+125)
  497. #define WM_DOLAYOUT (WM_USER+126)
  498. #define WM_GETDIB (WM_USER+127)
  499. #define WM_NOMCIDEVICES (WM_USER+128)
  500. /* constants */
  501. #define SCROLL_GRANULARITY ((gdwMediaLength+127)/128) /* granularity of the scrollbar */
  502. #define SCROLL_BIGGRAN ((gdwMediaLength+15)/16) /* gran. for page up/down in time mode */
  503. #define UPDATE_TIMER 1 /* # of the timer being used */
  504. #define UPDATE_MSEC 500 /* msec between display updates */
  505. #define UPDATE_INACTIVE_MSEC 2000 /* msec betw. upds. when inactive*/
  506. #define SKIPTRACKDELAY_MSEC 3000 /* max msec for double-page-left */
  507. #define SetDlgFocus(hwnd) SendMessage(ghwndApp, WM_NEXTDLGCTL, (WPARAM)(hwnd), 1L)
  508. #ifdef DEBUG
  509. #define STATICDT
  510. #define STATICFN
  511. int __iDebugLevel;
  512. extern void cdecl dprintf(LPSTR, ...);
  513. #define DPF0 dprintf
  514. #define DPF if (__iDebugLevel > 0) dprintf
  515. #define DPFI if (__iDebugLevel >= 1) dprintf
  516. #define DPF1 if (__iDebugLevel >= 1) dprintf
  517. #define DPF2 if (__iDebugLevel >= 2) dprintf
  518. #define DPF3 if (__iDebugLevel >= 3) dprintf
  519. #define DPF4 if (__iDebugLevel >= 4) dprintf
  520. #define CPF
  521. #else
  522. #define STATICDT static
  523. #define STATICFN static
  524. #define DPF0 ; / ## /
  525. #define DPFI ; / ## /
  526. #define DPF ; / ## /
  527. #define DPF1 ; / ## /
  528. #define DPF2 ; / ## /
  529. #define DPF3 ; / ## /
  530. #define DPF4 ; / ## /
  531. #define CPF / ## /
  532. #endif
  533. #ifdef DEBUG
  534. LPVOID DbgGlobalLock(HGLOBAL hglbMem);
  535. BOOL DbgGlobalUnlock(HGLOBAL hglbMem);
  536. HGLOBAL DbgGlobalFree(HGLOBAL hglbMem);
  537. #define GLOBALLOCK(hglbMem) DbgGlobalLock(hglbMem)
  538. #define GLOBALUNLOCK(hglbMem) DbgGlobalUnlock(hglbMem);
  539. #define GLOBALFREE(hglbMem) DbgGlobalFree(hglbMem)
  540. #else
  541. #define GLOBALLOCK(hglbMem) GlobalLock(hglbMem)
  542. #define GLOBALUNLOCK(hglbMem) GlobalUnlock(hglbMem);
  543. #define GLOBALFREE(hglbMem) GlobalFree(hglbMem)
  544. #endif
  545. /*----Constants--------------------------------------------------------------*/
  546. /* Push buttons */
  547. #define psh15 0x040e
  548. #define pshHelp psh15
  549. /* Checkboxes */
  550. #define chx1 0x0410
  551. /* Static text */
  552. #define stc1 0x0440
  553. #define stc2 0x0441
  554. #define stc3 0x0442
  555. #define stc4 0x0443
  556. /* Listboxes */
  557. #define lst1 0x0460
  558. #define lst2 0x0461
  559. /* Combo boxes */
  560. #define cmb1 0x0470
  561. #define cmb2 0x0471
  562. /* Edit controls */
  563. #define edt1 0x0480
  564. /**************************************************************************
  565. ***************************************************************************/
  566. #define GetWS(hwnd) GetWindowLongPtr(hwnd, GWL_STYLE)
  567. #define PutWS(hwnd, f) SetWindowLongPtr(hwnd, GWL_STYLE, f)
  568. #define TestWS(hwnd,f) (GetWS(hwnd) & f)
  569. #define SetWS(hwnd, f) ((PutWS(hwnd, GetWS(hwnd) | f) & (f)) != (f))
  570. #define ClrWS(hwnd, f) ((PutWS(hwnd, GetWS(hwnd) & ~(f)) & (f)) != 0)
  571. #define GetWSEx(hwnd) GetWindowLongPtr(hwnd, GWL_EXSTYLE)
  572. #define PutWSEx(hwnd, f) SetWindowLongPtr(hwnd, GWL_EXSTYLE, f)
  573. #define SetWSEx(hwnd, f) ((PutWSEx(hwnd, GetWSEx(hwnd) | f) & (f)) != (f))
  574. #define ClrWSEx(hwnd, f) ((PutWSEx(hwnd, GetWSEx(hwnd) & ~(f)) & (f)) != 0)
  575. // server related stuff.
  576. void FAR PASCAL ServerUnblock(void);
  577. void FAR PASCAL BlockServer(void);
  578. void FAR PASCAL UnblockServer(void);
  579. void FAR PASCAL PlayInPlace(HWND hwndApp, HWND hwndClient, LPRECT prc);
  580. void FAR PASCAL EditInPlace(HWND hwndApp, HWND hwndClient, LPRECT prc);
  581. void FAR PASCAL EndPlayInPlace(HWND hwndApp);
  582. void FAR PASCAL EndEditInPlace(HWND hwndApp);
  583. void FAR PASCAL DelayedFixLink(UINT verb, BOOL fShow, BOOL fActivate);
  584. void DirtyObject(BOOL fDocStgChangeOnly);
  585. void CleanObject(void);
  586. void UpdateObject(void);
  587. BOOL FAR PASCAL IsObjectDirty(void);
  588. void FAR PASCAL TerminateServer(void);
  589. void FAR PASCAL SetEmbeddedObjectFlag(BOOL flag);
  590. HMENU GetInPlaceMenu(void);
  591. void PostCloseMessage();
  592. void FAR PASCAL InitDoc(BOOL fUntitled);