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.

193 lines
4.6 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. #else
  31. #define DPF 1 ? (void)0 : (void)
  32. #endif
  33. /*
  34. * misc. defines
  35. */
  36. #define HASJOY 0x01
  37. #define HASRUDDERMAYBE 0x02
  38. #define ACTIVE_COLOR RGB( 255, 0, 0 )
  39. #define INACTIVE_COLOR RGB( 128, 0, 0 )
  40. #define TIMER_ID 1
  41. #define JOYPOLLTIME 25 // time between polls in milliseconds
  42. #define JOYCHECKTIME 2500 // time between hw check in milliseconds
  43. #define MAX_STR 256 // max size for string resources
  44. #define ALL_BUTTONS (JOY_BUTTON1|JOY_BUTTON2|JOY_BUTTON3|JOY_BUTTON4)
  45. #define GETKEYNAME( pgv, str, keystr ) wsprintf( str, keystr, pgv->iJoyId+1 )
  46. #define JOYMOVE_DRAWXY 0x00000001
  47. #define JOYMOVE_DRAWR 0x00000002
  48. #define JOYMOVE_DRAWZ 0x00000004
  49. #define JOYMOVE_DRAWU 0x00000008
  50. #define JOYMOVE_DRAWV 0x00000010
  51. #define JOYMOVE_DRAWALL JOYMOVE_DRAWXY | JOYMOVE_DRAWR | JOYMOVE_DRAWZ | \
  52. JOYMOVE_DRAWU | JOYMOVE_DRAWV
  53. #define RANGE_MIN 0
  54. #define RANGE_MAX 65535
  55. #define REGSTR_PATH_JOYSTICK REGSTR_PATH_PRIVATEPROPERTIES "\\Joystick"
  56. #define REGSTR_VAL_JOYTYPES "Show Predefined Types"
  57. /*
  58. * calibration strings defined by an OEM in the registry
  59. */
  60. enum {
  61. CALSTR1=0,
  62. CALSTR2,
  63. CALSTR3,
  64. CALSTR4,
  65. CALSTR5,
  66. CALSTR6,
  67. CALSTR7,
  68. CALSTR8,
  69. CALSTR9,
  70. CALSTR10,
  71. CALSTR11,
  72. CALSTR12,
  73. CALSTR_END
  74. };
  75. #define NUM_CAL_STRS CALSTR_END
  76. /*
  77. * structure for holding all OEM data in the registry
  78. */
  79. typedef struct {
  80. LPSTR keyname;
  81. LPSTR ident_string;
  82. LPSTR vxd_name;
  83. LPSTR xy_label;
  84. LPSTR z_label;
  85. LPSTR r_label;
  86. LPSTR u_label;
  87. LPSTR v_label;
  88. LPSTR pov_label;
  89. LPSTR testmove_desc;
  90. LPSTR testbutton_desc;
  91. LPSTR testmove_cap;
  92. LPSTR testbutton_cap;
  93. LPSTR testwin_cap;
  94. LPSTR cal_cap;
  95. LPSTR calwin_cap;
  96. LPSTR cal_strs[NUM_CAL_STRS];
  97. JOYREGHWSETTINGS hws;
  98. } OEMLIST;
  99. /*
  100. * generic joystick data
  101. */
  102. typedef struct {
  103. LPJOYREGHWCONFIG joyHWDefaults;
  104. OEMLIST *oemList;
  105. int oemCount;
  106. BOOL bHasUserVals;
  107. BOOL bDeleteUserVals;
  108. JOYREGUSERVALUES userVals;
  109. LPSTR regCfgKey;
  110. LPSTR regCurrCfgKey;
  111. LPSTR regSettingsCfgKey;
  112. HBRUSH hbUp;
  113. HBRUSH hbDown;
  114. BOOL bHasTimer;
  115. BOOL bUseTimer;
  116. #if !defined( WANT_SHEETS )
  117. struct _GLOBALVARS *pgvlist;
  118. #endif
  119. BOOL bResetUserVals;
  120. BOOL bHasNonStandardUserVals;
  121. } JOYDATA, *LPJOYDATA;
  122. /*
  123. * structure passed to each sheet
  124. */
  125. typedef struct {
  126. LPJOYDATA pjd;
  127. int iJoyId;
  128. } JOYDATAPTR, *LPJOYDATAPTR;
  129. /*
  130. * structure defining all variables used globally by a tab
  131. */
  132. typedef struct _GLOBALVARS {
  133. LPJOYDATA pjd;
  134. JOYREGHWCONFIG joyHWCurr;
  135. JOYREGHWCONFIG joyHWOrig;
  136. JOYRANGE joyRange;
  137. BOOL bOrigPOVIsPoll;
  138. BOOL bOrigPOVIsButtonCombos;
  139. DWORD dwMaxAxes;
  140. int iJoyId;
  141. int cJoystickTypes;
  142. /* these vars only used by the sheet */
  143. unsigned joyActiveFlags;
  144. } GLOBALVARS, *LPGLOBALVARS;
  145. /*
  146. * function prototypes
  147. */
  148. /* joycal.c */
  149. void DoCalibrate( LPGLOBALVARS pgv, HWND hwnd );
  150. /* joycpl.c */
  151. BOOL CALLBACK JoystickDlg( HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam);
  152. LPVOID DoAlloc( DWORD size );
  153. void DoFree( LPVOID ptr );
  154. void RegistryUpdated( LPGLOBALVARS pgv );
  155. void GetDevCaps( LPGLOBALVARS pgv );
  156. void RegSaveCurrentJoyHW( LPGLOBALVARS pgv );
  157. LPJOYDATA JoystickDataInit( void );
  158. void JoystickDataFini( LPJOYDATA pjd );
  159. #ifdef DEBUG
  160. void cdecl MBOX(LPSTR szFormat, ...);
  161. #endif
  162. /* joymisc.c */
  163. BOOL JoyError( HWND hwnd );
  164. void ChangeIcon( HWND hwnd, int idi, int idc );
  165. void CauseRedraw( LPJOYINFOEX pji, BOOL do_buttons );
  166. void SetOEMText( LPGLOBALVARS pgv, HWND hwnd, BOOL istest );
  167. void ShowControls( LPJOYREGHWCONFIG pcfg, HWND hwnd );
  168. void DoJoyMove( LPGLOBALVARS pgv, HWND hwnd, LPJOYINFOEX pji, LPJOYINFOEX poji, DWORD drawflags );
  169. /* joytest.c */
  170. typedef void (*LPUPDCFGFN)( LPVOID parm );
  171. void DoTest( LPGLOBALVARS pgv, HWND hwnd, LPUPDCFGFN pupdcfgfn, LPVOID pparm );
  172. #endif