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.

226 lines
5.4 KiB

  1. //****************************************************************************
  2. //
  3. // File: joycpl.h
  4. // Content: Joystick cpl header file
  5. // History:
  6. // Date By Reason
  7. // ==== == ======
  8. // 29-nov-94 craige initial implementation
  9. // 15-dec-94 craige allow N joysticks
  10. //
  11. // Copyright (c) Microsoft Corporation 1994, 1995
  12. //
  13. //****************************************************************************
  14. #ifndef __JOYCPL_INCLUDED__
  15. #define __JOYCPL_INCLUDED__
  16. #include <windows.h>
  17. #include <windowsx.h>
  18. #define NOSTATUSBAR
  19. #include <commctrl.h>
  20. #include <mmsystem.h>
  21. #include <mmddk.h>
  22. #include <stdlib.h>
  23. #include <regstr.h>
  24. #include <cpl.h>
  25. #include "rcids.h"
  26. //#define WANT_SHEETS
  27. //#ifdef DEBUG
  28. // void cdecl dprintf( LPSTR szFormat, ... );
  29. // #define DPF dprintf
  30. #define DPF TRACE
  31. //#else
  32. // #define DPF 1 ? (void)0 : (void)
  33. //#endif
  34. /*
  35. * misc. defines
  36. */
  37. #define HASJOY 0x01
  38. #define HASRUDDERMAYBE 0x02
  39. #define ACTIVE_COLOR RGB( 255, 0, 0 )
  40. #define INACTIVE_COLOR RGB( 128, 0, 0 )
  41. #define TIMER_ID 1
  42. #define MAX_STR_LEN 255
  43. #define STR_LEN_128 128
  44. #define STR_LEN_64 64
  45. #define STR_LEN_32 32
  46. #define JOYPOLLTIME 25 // time between polls in milliseconds
  47. #define JOYCHECKTIME 2500 // time between hw check in milliseconds
  48. #define MAX_STR 256 // max size for string resources
  49. #define ALL_BUTTONS (JOY_BUTTON1 | \
  50. JOY_BUTTON2 | \
  51. JOY_BUTTON3 | \
  52. JOY_BUTTON4 | \
  53. JOY_BUTTON5 | \
  54. JOY_BUTTON6 | \
  55. JOY_BUTTON7 | \
  56. JOY_BUTTON8 | \
  57. JOY_BUTTON9 | \
  58. JOY_BUTTON10 | \
  59. JOY_BUTTON11 | \
  60. JOY_BUTTON12 | \
  61. JOY_BUTTON13 | \
  62. JOY_BUTTON14 | \
  63. JOY_BUTTON15 | \
  64. JOY_BUTTON16 | \
  65. JOY_BUTTON17 | \
  66. JOY_BUTTON18 | \
  67. JOY_BUTTON19 | \
  68. JOY_BUTTON20 | \
  69. JOY_BUTTON21 | \
  70. JOY_BUTTON22 | \
  71. JOY_BUTTON23 | \
  72. JOY_BUTTON24 | \
  73. JOY_BUTTON25 | \
  74. JOY_BUTTON26 | \
  75. JOY_BUTTON27 | \
  76. JOY_BUTTON28 | \
  77. JOY_BUTTON29 | \
  78. JOY_BUTTON30 | \
  79. JOY_BUTTON31 | \
  80. JOY_BUTTON32 )
  81. #define GETKEYNAME( pgv, str, keystr ) wsprintf( str, keystr, pgv->iJoyId+1 )
  82. #define JOYMOVE_DRAWXY 0x00000001
  83. #define JOYMOVE_DRAWR 0x00000002
  84. #define JOYMOVE_DRAWZ 0x00000004
  85. #define JOYMOVE_DRAWU 0x00000008
  86. #define JOYMOVE_DRAWV 0x00000010
  87. #define JOYMOVE_DRAWALL JOYMOVE_DRAWXY | JOYMOVE_DRAWR | JOYMOVE_DRAWZ | \
  88. JOYMOVE_DRAWU | JOYMOVE_DRAWV
  89. /*
  90. * calibration strings defined by an OEM in the registry
  91. */
  92. enum {
  93. CALSTR1=0,
  94. CALSTR2,
  95. CALSTR3,
  96. CALSTR4,
  97. CALSTR5,
  98. CALSTR6,
  99. CALSTR7,
  100. CALSTR8,
  101. CALSTR9,
  102. CALSTR10,
  103. CALSTR11,
  104. CALSTR12,
  105. CALSTR_END
  106. };
  107. #define NUM_CAL_STRS CALSTR_END
  108. /*
  109. * structure for holding all OEM data in the registry
  110. */
  111. typedef struct {
  112. LPSTR keyname;
  113. LPSTR ident_string;
  114. LPSTR vxd_name;
  115. LPSTR xy_label;
  116. LPSTR z_label;
  117. LPSTR r_label;
  118. LPSTR u_label;
  119. LPSTR v_label;
  120. LPSTR pov_label;
  121. LPSTR testmove_desc;
  122. LPSTR testbutton_desc;
  123. LPSTR testmove_cap;
  124. LPSTR testbutton_cap;
  125. LPSTR testwin_cap;
  126. LPSTR cal_cap;
  127. LPSTR calwin_cap;
  128. LPSTR cal_strs[NUM_CAL_STRS];
  129. JOYREGHWSETTINGS hws;
  130. } OEMLIST;
  131. /*
  132. * generic joystick data
  133. */
  134. typedef struct {
  135. LPJOYREGHWCONFIG joyHWDefaults;
  136. OEMLIST *oemList;
  137. int oemCount;
  138. BOOL bHasUserVals;
  139. BOOL bDeleteUserVals;
  140. JOYREGUSERVALUES userVals;
  141. LPSTR regCfgKey;
  142. LPSTR regCurrCfgKey;
  143. LPSTR regSettingsCfgKey;
  144. HBRUSH hbUp;
  145. HBRUSH hbDown;
  146. BOOL bHasTimer;
  147. BOOL bUseTimer;
  148. #if !defined( WANT_SHEETS )
  149. struct _GLOBALVARS *pgvlist;
  150. #endif
  151. BOOL bResetUserVals;
  152. BOOL bHasNonStandardUserVals;
  153. } JOYDATA, *LPJOYDATA;
  154. /*
  155. * structure passed to each sheet
  156. */
  157. typedef struct {
  158. LPJOYDATA pjd;
  159. int iJoyId;
  160. } JOYDATAPTR, *LPJOYDATAPTR;
  161. /*
  162. * structure defining all variables used globally by a tab
  163. */
  164. typedef struct _GLOBALVARS {
  165. LPJOYDATA pjd;
  166. JOYREGHWCONFIG joyHWCurr;
  167. JOYREGHWCONFIG joyHWOrig;
  168. JOYRANGE joyRange;
  169. BOOL bOrigPOVIsPoll;
  170. BOOL bOrigPOVIsButtonCombos;
  171. DWORD dwMaxAxes;
  172. int iJoyId;
  173. /* these vars only used by the sheet */
  174. unsigned joyActiveFlags;
  175. } GLOBALVARS, *LPGLOBALVARS;
  176. /*
  177. * function prototypes
  178. */
  179. /* joycal.c */
  180. void DoCalibrate( LPGLOBALVARS pgv, HWND hwnd );
  181. /* joycpl.c */
  182. BOOL CALLBACK JoystickDlg( HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam);
  183. LPVOID DoAlloc( DWORD size );
  184. void DoFree( LPVOID ptr );
  185. void RegistryUpdated( LPGLOBALVARS pgv );
  186. void GetDevCaps( LPGLOBALVARS pgv );
  187. void RegSaveCurrentJoyHW( LPGLOBALVARS pgv );
  188. LPJOYDATA JoystickDataInit( void );
  189. void JoystickDataFini( LPJOYDATA pjd );
  190. LRESULT GetHelpFileName(LPSTR lpszHelpFileName, short* ulSize);
  191. void OnHelp(LPARAM lParam);
  192. #ifdef DEBUG
  193. void cdecl MBOX(LPSTR szFormat, ...);
  194. #endif
  195. /* joymisc.c */
  196. BOOL JoyError( HWND hwnd );
  197. void ChangeIcon( HWND hwnd, int idi, int idc );
  198. void CauseRedraw( LPJOYINFOEX pji, BOOL do_buttons );
  199. void SetOEMText( LPGLOBALVARS pgv, HWND hwnd, BOOL istest );
  200. void ShowControls( LPJOYREGHWCONFIG pcfg, HWND hwnd );
  201. void DoJoyMove( LPGLOBALVARS pgv, HWND hwnd, LPJOYINFOEX pji, LPJOYINFOEX poji, DWORD drawflags );
  202. /* joytest.c */
  203. typedef void (*LPUPDCFGFN)( LPVOID parm );
  204. void DoTest( LPGLOBALVARS pgv, HWND hwnd, LPUPDCFGFN pupdcfgfn, LPVOID pparm );
  205. BOOL CALLBACK TestProc( HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam);
  206. #endif