/******	Ids.h *************************************************************\

Project:	USBJoystick Configure plug-in
Component:	JoySetup
This file:	Component ID assignments for the master list + the two
		on-demand detail windows

  - "Joystick"    : master window, auto-created. A wide ScrollList of
                    sticks+devices + an Edit button + a Close button.
  - "StickDetail" : one legacy Joystick_Read stick. Created on demand,
                    one instance per open stick, multiple at once.
  - "DevDetail"   : one enumerated USB slot. Created on demand, one
                    instance per open slot.

\**************************************************************************/

#ifndef __ids_h
#define __ids_h

#include "toolbox.h"

/* Display/list limits - keep in sync with Res file and USBJoystick API */

#define STICK_MAX		((int) 8)	/* legacy sticks 0..7 */
#define STICK_BUTTON_MAX	((int) 32)	/* stickdetail_btn_0..31 - Joystick_Read's 16-bit reason returns up to 32 buttons in R1 */
#define AXIS_MAX_DISPLAY	((int) 16)	/* devdetail_axis_*_0..15 */
#define BUTTON_MAX_DISPLAY	((int) 32)	/* devdetail_btn_0..31 */
#define DEVICE_SLOT_MAX		((int) 32)	/* Joystick_Enumerate bitmask width */

#define MAX_DETAIL		(STICK_MAX + DEVICE_SLOT_MAX)

/*========================================================================*/
/* Master window "Joystick"						  */
/*========================================================================*/

#define joylist			((ComponentId) 0x10)
#define joylist_edit		((ComponentId) 0x20)
#define joylist_close		((ComponentId) 0x30)
#define joylist_set		((ComponentId) 0x40)

#define joylist_emu_serialport	((ComponentId) 0x50)
#define joylist_emu_joy		((ComponentId) 0x51)
#define joylist_emu_adc		((ComponentId) 0x52)

#define joylist_ctrl_mouse	((ComponentId) 0x60)
#define joylist_ctrl_keyboard	((ComponentId) 0x61)

/*========================================================================*/
/* Detail window "StickDetail" (one legacy stick)			  */
/*========================================================================*/

#define stickdetail_close		((ComponentId) 0x01)

#define stickdetail_x8_label		((ComponentId) 0x12)
#define stickdetail_x8			((ComponentId) 0x13)
#define stickdetail_y8_label		((ComponentId) 0x14)
#define stickdetail_y8			((ComponentId) 0x15)
#define stickdetail_x16_label		((ComponentId) 0x16)
#define stickdetail_x16			((ComponentId) 0x17)
#define stickdetail_y16_label		((ComponentId) 0x18)
#define stickdetail_y16			((ComponentId) 0x19)

#define stickdetail_buttons_label	((ComponentId) 0x20)

/* Only the first of these are placed in the Res file; code clones them up to STICK_BUTTON_MAX . */
#define stickdetail_btn(n)		((ComponentId) (0x21 + (n)))
#define stickdetail_btnlabel(n)		((ComponentId) (0x41 + (n)))

/*========================================================================*/
/* Detail window "DevDetail" (one enumerated USB slot)			  */
/*========================================================================*/

#define devdetail_manuf_label		((ComponentId) 0x42)
#define devdetail_manuf			((ComponentId) 0x43)
#define devdetail_product_label		((ComponentId) 0x44)
#define devdetail_product		((ComponentId) 0x45)
#define devdetail_serial_label		((ComponentId) 0x46)
#define devdetail_serial		((ComponentId) 0x47)
#define devdetail_ids_label		((ComponentId) 0x48)
#define devdetail_ids			((ComponentId) 0x49)
#define devdetail_stick_label		((ComponentId) 0x4A)
#define devdetail_stick			((ComponentId) 0x4B)

#define devdetail_axis_overflow		((ComponentId) 0x50)

#define devdetail_axes_box		((ComponentId) 0x51)
#define devdetail_buttons_box		((ComponentId) 0x52)

/* Axis rows, 0x200 + n*0x10. Only the first row is placed in the Res fie; code clones to axis count */
#define devdetail_axis_label(n)		((ComponentId) (0x200 + (n)*0x10))
#define devdetail_axis_range(n)		((ComponentId) (0x201 + (n)*0x10))
#define devdetail_axis_summary(n)	((ComponentId) (0x202 + (n)*0x10))
#define devdetail_axis_edit(n)		((ComponentId) (0x203 + (n)*0x10))
#define devdetail_axis_add(n)		((ComponentId) (0x204 + (n)*0x10))

/* Button grid. Only the first ones are placed in the Res file; code clones to BUTTON_MAX_DISPLAY */
#define devdetail_btn(n)		((ComponentId) (0x400 + (n)))
#define devdetail_btnlabel(n)		((ComponentId) (0x600 + (n)))

#define devdetail_btnpick		((ComponentId) 0x70)
#define devdetail_btnsummary		((ComponentId) 0x71)
#define devdetail_btnedit		((ComponentId) 0x72)
#define devdetail_btnadd		((ComponentId) 0x73)

/* Footer buttons (in DevFooter, attached as toolbar to DevDetail) */
#define devdetail_cancel		((ComponentId) 0x501)
#define devdetail_set			((ComponentId) 0x502)
#define devdetail_default		((ComponentId) 0x504)

/*========================================================================*/
/* Dialogue "BindEdit" (edit one input's bindings)			  */
/*========================================================================*/

#define bindedit_kind		((ComponentId) 0x30)
#define bindedit_detail		((ComponentId) 0x40)
#define bindedit_number		((ComponentId) 0x50)
#define bindedit_invert		((ComponentId) 0x60)
#define bindedit_delete		((ComponentId) 0x80)

#define bindedit_ok		((ComponentId) 0x90)
#define bindedit_cancel		((ComponentId) 0xA0)

#endif
