grub2: bring back build of aros-side grub2 tools
[AROS.git] / rom / usb / classes / hid / hid.gui.c
blob527650c77250e0cc0bc98ac2ef22936a0b81c168
1 /*
2 * GUI
3 */
5 #include "debug.h"
6 #include "numtostr.h"
8 #include "hid.class.h"
10 #ifdef USE_NLIST
12 #undef ListObject
13 #define ListObject MUIOBJMACRO_START("NList.mcc")
15 #undef ListviewObject
16 #define ListviewObject MUIOBJMACRO_START("NListview.mcc")
17 #endif
19 extern const STRPTR GM_UNIQUENAME(libname);
21 /* /// "Strings" */
22 static char *MainGUIPages[] = { "General", "Keyboard", "Action", NULL };
23 static char *MainGUIPagesDefault[] = { "General", "Keyboard", NULL };
25 static char *LLPortStrings[] = { "Don't touch", "Overwrite with USB", "Merge with USB", "Disable", "Analogue Hack", NULL };
26 static char *LLRumbleStrings[] = { "Off", "Port 0", "Port 1", "Port 2", "Port 3", NULL };
28 static char *TurboMouseStrings[] = { "Off", "1000 Hz", "500 Hz", "250 Hz", "125 Hz", NULL };
30 static char *ActionTypeStrings[] = { "No action", "Qualifiers", "Keymapping", "Raw key",
31 "Vanilla key", "Keystring", "Mouse position", "Mouse buttons",
32 "Tablet data", "Digital joystick", "Analogue joystick",
33 "Scrollwheel", "Sound", "Shell", "Arexx", "HID output",
34 "HID feature", "Miscellaneous", "Variables", "Ext. Raw key", NULL };
36 static char *ActionTriggerStrings[] = { "Down", "Up", "Any", "Always", "NaN", NULL };
37 static UWORD ActionTriggerVals[] = { HUA_DOWNEVENT, HUA_UPEVENT, HUA_ANY, HUA_ALWAYS, HUA_NAN, 0 };
39 static char *A_CCVariableStrings[] = { "Eval. item val", "Orig. item value", "Constant", "Click count", "Click time",
40 "USB qualifiers", "All qualifiers", "Random bit", "Random value", "Timer",
41 "Local var 1", "Local var 2", "Local var 3", "Local var 4",
42 "Local var 5", "Local var 6", "Local var 7", "Local var 8",
43 "Global var A", "Global var B", "Global var C", "Global var D",
44 "Global var E", "Global var F", "Global var G", "Global var H",
45 NULL };
46 static UWORD A_CCVariableVals[] = { HUAT_EITEMVALUE, HUAT_OITEMVALUE, HUAT_CONST, HUAT_CLICKCOUNT, HUAT_CLICKTIME,
47 HUAT_QUALIFIERS, HUAT_ALLQUAL, HUAT_RANDOMBIT, HUAT_RANDOMVAL, HUAT_TIMER,
48 HUAT_LOCALVAR1, HUAT_LOCALVAR2, HUAT_LOCALVAR3, HUAT_LOCALVAR4,
49 HUAT_LOCALVAR5, HUAT_LOCALVAR6, HUAT_LOCALVAR7, HUAT_LOCALVAR8,
50 HUAT_GLOBVARA, HUAT_GLOBVARB, HUAT_GLOBVARC, HUAT_GLOBVARD,
51 HUAT_GLOBVARE, HUAT_GLOBVARF, HUAT_GLOBVARG, HUAT_GLOBVARH,
52 0 };
54 static char *A_CCCondStrings[] = { "==", "!=", "<", "<=", ">", ">=", "and", "nand", "or", "xor", "and not",
55 "bw and", "bw nand", "bw or", "bw xor", "bw and not", NULL };
56 static UWORD A_CCCondVals[] = { HUAT_EQ, HUAT_NE, HUAT_LT, HUAT_LE, HUAT_GT, HUAT_GE, HUAT_AND, HUAT_NAND, HUAT_OR, HUAT_XOR, HUAT_ANDNOT,
57 HUAT_BWAND, HUAT_BWNAND, HUAT_BWOR, HUAT_BWXOR, HUAT_BWANDNOT, 0 };
59 static char *A_QualOpStrings[] = { "Set", "Clear", "Toggle", "Assign", NULL };
60 static UWORD A_QualOpVals[] = { HUAT_SET, HUAT_CLEAR, HUAT_TOGGLE, HUAT_ASSIGN, 0 };
61 static char *A_QualifierStrings[] = { "Left shift", "Right shift", "Caps lock", "Control",
62 "Left alt", "Right alt", "Left amiga", "Right amiga",
63 "Numeric pad", NULL };
65 static char *A_MousePosOpStrings[] = { "relative horizontal", "relative vertical", "to absolute X", "to absolute Y", NULL };
66 static UWORD A_MousePosOpVals[] = { HUAT_DELTAX, HUAT_DELTAY, HUAT_ABSX, HUAT_ABSY, 0 };
68 static char *A_MouseButOpStrings[] = { "Press", "Release", "Flip", "Assign", NULL };
69 static UWORD A_MouseButOpVals[] = { HUAT_SET, HUAT_CLEAR, HUAT_TOGGLE, HUAT_ASSIGN, 0 };
70 static char *A_MouseButStrings[] = { "left", "right", "middle", "fourth", "fifth", NULL };
72 static char *A_TabletAxisStrings[] = { "pressure", "X rotation", "Y rotation", "Z rotation", "proximity", "Z position", NULL };
73 static UWORD A_TabletAxisVals[] = { HUAT_PRESSURE, HUAT_XROT, HUAT_YROT, HUAT_ZROT, HUAT_PROX, HUAT_ABSZ, 0 };
75 static char *A_WheelOpStrings[] = { "horizontal movement", "vertical movement", "left (by distance)", "right (by distance)",
76 "up (by distance)", "down (by distance)", NULL };
77 static UWORD A_WheelOpVals[] = { HUAT_DELTAX, HUAT_DELTAY, HUAT_LEFT, HUAT_RIGHT, HUAT_UP, HUAT_DOWN, 0 };
79 static char *A_JoypadOpStrings[] = { "Push", "Release", "Toggle", "Assign", NULL };
80 static UWORD A_JoypadOpVals[] = { HUAT_SET, HUAT_CLEAR, HUAT_TOGGLE, HUAT_ASSIGN, 0 };
82 static char *A_JoypadFeatStrings[] = { "left", "right", "up", "down", "hatswitch",
83 "red (fire)", "blue (2nd)", "green (shuffle)", "yellow (repeat)",
84 "forward", "reverse", "play/pause", NULL };
85 static UWORD A_JoypadFeatVals[] = { HUAT_LEFT, HUAT_RIGHT, HUAT_UP, HUAT_DOWN, HUAT_HATSWITCH,
86 HUAT_RED, HUAT_BLUE, HUAT_GREEN, HUAT_YELLOW,
87 HUAT_FORWARD, HUAT_REVERSE, HUAT_PLAY, 0 };
89 static char *A_APadFeatStrings[] = { "X axis", "Y axis", NULL };
90 static UWORD A_APadFeatVals[] = { HUAT_ABSX, HUAT_ABSY, 0 };
92 static char *A_TarVariableStrings[] = { "Local var 1", "Local var 2", "Local var 3", "Local var 4",
93 "Local var 5", "Local var 6", "Local var 7", "Local var 8",
94 "Global var A", "Global var B", "Global var C", "Global var D",
95 "Global var E", "Global var F", "Global var G", "Global var H",
96 NULL };
97 static UWORD A_TarVariableVals[] = { HUAT_LOCALVAR1, HUAT_LOCALVAR2, HUAT_LOCALVAR3, HUAT_LOCALVAR4,
98 HUAT_LOCALVAR5, HUAT_LOCALVAR6, HUAT_LOCALVAR7, HUAT_LOCALVAR8,
99 HUAT_GLOBVARA, HUAT_GLOBVARB, HUAT_GLOBVARC, HUAT_GLOBVARD,
100 HUAT_GLOBVARE, HUAT_GLOBVARF, HUAT_GLOBVARG, HUAT_GLOBVARH,
101 0 };
103 static char *A_TarVarOpStrings[] = { "assign :=", "not := !", "add +=", "sub -=", "mult *=", "div /=", "mod %=",
104 "and (x && y)", "nand !(x && y)", "or (x || y)", "xor (x ^^ y)", "and not (x && !y)",
105 "bw and (x & y)", "bw nand ~(x & y)", "bw or (x | y)", "bw xor (x ^ y)", "bw and not (x & ~y)",
106 "shift <- (x << y)", "shift -> (x >> y)",
107 NULL };
108 static UWORD A_TarVarOpVals[] = { HUAT_ASSIGN, HUAT_ASSNOT, HUAT_ADD, HUAT_SUB, HUAT_MULTIPLY, HUAT_DIVIDE, HUAT_MODULO,
109 HUAT_AND, HUAT_NAND, HUAT_OR, HUAT_XOR, HUAT_ANDNOT,
110 HUAT_BWAND, HUAT_BWNAND, HUAT_BWOR, HUAT_BWXOR, HUAT_BWANDNOT,
111 HUAT_ASL, HUAT_ASR, 0 };
113 static char *A_OutOpStrings[] = { "Set", "Clear", "Toggle", "Assign", NULL };
114 static UWORD A_OutOpVals[] = { HUAT_SET, HUAT_CLEAR, HUAT_TOGGLE, HUAT_ASSIGN, 0 };
116 /* JPB_JOY_LEFT, JPB_JOY_RIGHT, JPB_JOY_UP, JPB_JOY_DOWN,
117 JPB_BUTTON_RED, JPB_BUTTON_BLUE, JPB_BUTTON_GREEN, JPB_BUTTON_YELLOW,
118 JPB_BUTTON_FORWARD, JPB_BUTTON_REVERSE, JPB_BUTTON_PLAY,
119 0xffff, 0 }; */
121 static char *A_JoypadPortStrings[] = { "port 0", "port 1", "port 2", "port 3", NULL };
123 static char *A_MiscOpStrings[] = { "Activate window", "Window to front", "Window to back", "Close window",
124 "Zip window", "Screen cycle", "WB to front", "Display beep",
125 "Reboot machine", "Flush events", NULL };
126 static UWORD A_MiscOpVals[] = { HUAT_ACTWINDOW, HUAT_WIN2FRONT, HUAT_WIN2BACK, HUAT_CLOSEWINDOW,
127 HUAT_ZIPWINDOW, HUAT_SCREENCYCLE, HUAT_WB2FRONT, HUAT_DISPLAYBEEP,
128 HUAT_REBOOT, HUAT_FLUSHEVENTS, 0 };
129 /* \\\ */
131 /* /// "nRevLookup()" */
132 ULONG nRevLookup(UWORD id, UWORD def, UWORD *field)
134 ULONG res = 0;
135 while(*field)
137 if(*field++ == id)
139 return(res);
141 res++;
143 return(def);
145 /* \\\ */
147 /* /// "nGUITask()" */
148 AROS_UFH0(void, GM_UNIQUENAME(nGUITask))
150 AROS_USERFUNC_INIT
152 struct Task *thistask;
153 struct NepHidBase *nh;
154 struct NepClassHid *nch;
155 UWORD count;
156 struct HidUsageIDMap *hum;
158 char barbar[] = "BAR,BAR,";
159 //char barbarbar[] = "BAR,BAR,BAR,";
160 char barbarbarbar[] = "BAR,BAR,BAR,BAR,";
162 thistask = FindTask(NULL);
163 #undef ps
164 #define ps nch->nch_PsdBase
165 #undef IntuitionBase
166 #define IntuitionBase nch->nch_IntBase
167 #undef KeymapBase
168 #define KeymapBase nch->nch_KeyBase
169 #undef MUIMasterBase
170 #define MUIMasterBase nch->nch_MUIBase
172 nch = thistask->tc_UserData;
173 nh = nch->nch_ClsBase;
175 ++nh->nh_Library.lib_OpenCnt;
176 NewList(&nch->nch_GUIItems);
177 NewList(&nch->nch_GUIOutItems);
178 if(!(MUIMasterBase = OpenLibrary(MUIMASTER_NAME, MUIMASTER_VMIN)))
180 KPRINTF(10, ("Couldn't open muimaster.library.\n"));
181 GM_UNIQUENAME(nGUITaskCleanup)(nch);
182 return;
185 if(!(IntuitionBase = OpenLibrary("intuition.library", 39)))
187 KPRINTF(10, ("Couldn't open intuition.library.\n"));
188 GM_UNIQUENAME(nGUITaskCleanup)(nch);
189 return;
191 if(!(KeymapBase = OpenLibrary("keymap.library", 39)))
193 KPRINTF(10, ("Couldn't open keymap.library.\n"));
194 GM_UNIQUENAME(nGUITaskCleanup)(nch);
195 return;
197 if(!(ps = OpenLibrary("poseidon.library", 4)))
199 KPRINTF(10, ("Couldn't open poseidon.library.\n"));
200 GM_UNIQUENAME(nGUITaskCleanup)(nch);
201 return;
204 nch->nch_ActionClass = MUI_CreateCustomClass(NULL, MUIC_Area , NULL, sizeof(struct ActionData), GM_UNIQUENAME(ActionDispatcher));
205 if(!nch->nch_ActionClass)
207 KPRINTF(10, ("Couldn't create ActionClass.\n"));
208 GM_UNIQUENAME(nGUITaskCleanup)(nch);
209 return;
211 for(count = 0; count < 128; count++)
213 struct InputEvent ie;
214 UBYTE buf[16];
215 UBYTE buf2[80];
216 LONG actual;
217 BOOL printable;
218 WORD charpos;
219 LONG targetpos;
220 STRPTR betterstr;
222 ie.ie_Class = IECLASS_RAWKEY;
223 ie.ie_SubClass = 0;
224 ie.ie_Qualifier = 0;
225 ie.ie_Code = count;
226 ie.ie_EventAddress = NULL;
228 if((betterstr = nNumToStr(nch, NTS_RAWKEY, (ULONG) count, NULL)))
230 strcpy(buf, betterstr);
231 actual = strlen(buf);
232 } else {
233 actual = MapRawKey(&ie, buf, 15, NULL);
235 if(actual > 0)
237 printable = TRUE;
238 charpos = 0;
241 if((buf[charpos] < 0x20) || ((buf[charpos] >= 0x80) && (buf[charpos] < 0xa0)))
243 printable = FALSE;
244 break;
246 } while(++charpos < actual);
247 if(printable)
249 buf[actual] = 0;
250 nch->nch_RawKeyArray[count] = psdCopyStrFmt("0x%02lx (%s)", count, buf);
251 } else {
252 strcpy(buf2, "unprintable seq.");
253 charpos = 0;
256 targetpos = strlen(buf2);
257 buf2[targetpos++] = ' ';
258 psdSafeRawDoFmt(&buf2[targetpos], 79-targetpos, "$%02lx", buf[charpos]);
259 } while((++charpos < actual) && targetpos < 75);
260 nch->nch_RawKeyArray[count] = psdCopyStrFmt("0x%02lx (%s)", count, buf2);
262 } else {
263 nch->nch_RawKeyArray[count] = psdCopyStrFmt("0x%02lx", count);
267 for(count = 0; count < 128; count++)
269 nch->nch_ExtRawKeyArray[count] = psdCopyStrFmt("0x%02lx %s", count, nNumToStr(nch, NTS_EXTRAWKEY, (ULONG) count, "<undef.>"));
272 hum = (struct HidUsageIDMap *) hidusage07;
273 count = 0;
274 while(hum->hum_String)
276 nch->nch_USBKeyArray[count] = hum++;
277 count++;
280 nch->nch_USBKeyListDisplayHook.h_Data = nch;
281 nch->nch_ReportListDisplayHook.h_Data = nch;
282 nch->nch_ItemListDisplayHook.h_Data = nch;
283 nch->nch_ActionListDisplayHook.h_Data = nch;
285 nch->nch_USBKeyListDisplayHook.h_Entry = (APTR) GM_UNIQUENAME(USBKeyListDisplayHook);
286 nch->nch_ReportListDisplayHook.h_Entry = (APTR) GM_UNIQUENAME(ReportListDisplayHook);
287 nch->nch_ItemListDisplayHook.h_Entry = (APTR) GM_UNIQUENAME(ItemListDisplayHook);
288 nch->nch_ActionListDisplayHook.h_Entry = (APTR) GM_UNIQUENAME(ActionListDisplayHook);
290 nch->nch_App = ApplicationObject,
291 MUIA_Application_Title , (IPTR)GM_UNIQUENAME(libname),
292 MUIA_Application_Version , (IPTR)VERSION_STRING,
293 MUIA_Application_Copyright , (IPTR)"©2002-2009 Chris Hodges",
294 MUIA_Application_Author , (IPTR)"Chris Hodges <chrisly@platon42.de>",
295 MUIA_Application_Description, (IPTR)"Settings for the hid.class",
296 MUIA_Application_Base , (IPTR)"HID",
297 MUIA_Application_HelpFile , (IPTR)"HELP:Poseidon.guide",
298 MUIA_Application_Menustrip , (IPTR)MenustripObject,
299 Child, (IPTR)MenuObjectT((IPTR)"Project"),
300 Child, (IPTR)(nch->nch_AboutMI = MenuitemObject,
301 MUIA_Menuitem_Title, (IPTR)"About...",
302 MUIA_Menuitem_Shortcut, (IPTR)"?",
303 End),
304 End,
305 Child, (IPTR)MenuObjectT((IPTR)"Quick Setup"),
306 //Child, (IPTR)MUIA_Menu_Enabled, nch->nch_Interface ? TRUE : FALSE,
307 Child, (IPTR)MenuitemObject,
308 MUIA_Menuitem_Title, (IPTR)"Mouse",
309 Child, (IPTR)(nch->nch_SwapLMBRMBMI = MenuitemObject,
310 MUIA_Menuitem_Title, (IPTR)"Swap LMB<->RMB",
311 End),
312 Child, (IPTR)MenuitemObject,
313 MUIA_Menuitem_Title, (IPTR)NM_BARLABEL,
314 End,
315 Child, (IPTR)(nch->nch_MouseAccel100MI = MenuitemObject,
316 MUIA_Menuitem_Title, (IPTR)"Acceleration off",
317 MUIA_Menuitem_Enabled, FALSE,
318 End),
319 Child, (IPTR)(nch->nch_MouseAccel150MI = MenuitemObject,
320 MUIA_Menuitem_Title, (IPTR)"Acceleration 150%",
321 MUIA_Menuitem_Enabled, FALSE,
322 End),
323 Child, (IPTR)(nch->nch_MouseAccel200MI = MenuitemObject,
324 MUIA_Menuitem_Title, (IPTR)"Acceleration 200%",
325 MUIA_Menuitem_Enabled, FALSE,
326 End),
327 End,
328 Child, (IPTR)MenuitemObject,
329 MUIA_Menuitem_Title, (IPTR)"Joystick",
330 Child, (IPTR)(nch->nch_JoyPort0MI = MenuitemObject,
331 MUIA_Menuitem_Title, (IPTR)"Select Port 0",
332 End),
333 Child, (IPTR)(nch->nch_JoyPort1MI = MenuitemObject,
334 MUIA_Menuitem_Title, (IPTR)"Select Port 1",
335 End),
336 Child, (IPTR)(nch->nch_JoyPort2MI = MenuitemObject,
337 MUIA_Menuitem_Title, (IPTR)"Select Port 2",
338 End),
339 Child, (IPTR)(nch->nch_JoyPort3MI = MenuitemObject,
340 MUIA_Menuitem_Title, (IPTR)"Select Port 3",
341 End),
342 Child, (IPTR)MenuitemObject,
343 MUIA_Menuitem_Title, (IPTR)NM_BARLABEL,
344 End,
345 Child, (IPTR)(nch->nch_JoyAutofireMI = MenuitemObject,
346 MUIA_Menuitem_Title, (IPTR)"Add Autofire Actions",
347 MUIA_Menuitem_Enabled, FALSE,
348 End),
349 End,
350 End,
351 Child, (IPTR)MenuObjectT((IPTR)"Settings"),
352 Child, (IPTR)(nch->nch_UseMI = MenuitemObject,
353 MUIA_Menuitem_Title, (IPTR)"Save",
354 MUIA_Menuitem_Shortcut, (IPTR)"S",
355 End),
356 Child, (IPTR)(nch->nch_SetDefaultMI = MenuitemObject,
357 MUIA_Menuitem_Title, (IPTR)"Save as Default",
358 MUIA_Menuitem_Shortcut, (IPTR)"D",
359 End),
360 Child, (IPTR)MenuitemObject,
361 MUIA_Menuitem_Title, (IPTR)NM_BARLABEL,
362 End,
363 Child, (IPTR)(nch->nch_MUIPrefsMI = MenuitemObject,
364 MUIA_Menuitem_Title, (IPTR)"MUI Settings",
365 MUIA_Menuitem_Shortcut, (IPTR)"M",
366 End),
367 End,
368 Child, (IPTR)MenuObjectT((IPTR)"Debug"),
369 Child, (IPTR)(nch->nch_DebugReportMI = MenuitemObject,
370 MUIA_Menuitem_Title, (IPTR)"Report Descriptor",
371 End),
372 End,
373 End,
375 SubWindow, (IPTR)(nch->nch_MainWindow = WindowObject,
376 MUIA_Window_ID , MAKE_ID('M','A','I','N'),
377 MUIA_Window_Title, (IPTR)GM_UNIQUENAME(libname),
378 MUIA_HelpNode, (IPTR)GM_UNIQUENAME(libname),
380 WindowContents, (IPTR)VGroup,
381 Child, (IPTR)(nch->nch_ActionObj = NewObject(nch->nch_ActionClass->mcc_Class, 0, MUIA_ShowMe, FALSE, TAG_END)),
382 Child, (IPTR)RegisterGroup(nch->nch_Interface ? MainGUIPages : MainGUIPagesDefault),
383 MUIA_CycleChain, 1,
384 MUIA_Register_Frame, TRUE,
385 Child, (IPTR)VGroup,
386 Child, (IPTR)VSpace(0),
387 Child, (IPTR)ColGroup(2), GroupFrameT(nch->nch_Interface ? "Device Settings" : "Default Device Settings"),
388 //Child, (IPTR)HSpace(0),
389 Child, (IPTR)Label((IPTR) "Shell console window:"),
390 Child, (IPTR)(nch->nch_ConWindowObj = StringObject,
391 StringFrame,
392 MUIA_CycleChain, 1,
393 MUIA_String_AdvanceOnCR, TRUE,
394 MUIA_String_Contents, (IPTR)nch->nch_CDC->cdc_ShellCon,
395 MUIA_String_MaxLen, 127,
396 End),
397 Child, (IPTR)Label((IPTR) "Shell default stack:"),
398 Child, (IPTR)(nch->nch_ShellStackObj = StringObject,
399 StringFrame,
400 MUIA_CycleChain, 1,
401 MUIA_String_AdvanceOnCR, TRUE,
402 MUIA_String_Integer, nch->nch_CDC->cdc_ShellStack,
403 MUIA_String_Accept, (IPTR)"0123456789",
404 End),
405 Child, (IPTR)Label((IPTR) "Enable keyboard reset:"),
406 Child, (IPTR)HGroup,
407 Child, (IPTR)(nch->nch_EnableKBResetObj = ImageObject, ImageButtonFrame,
408 MUIA_Background, MUII_ButtonBack,
409 MUIA_CycleChain, 1,
410 MUIA_InputMode, MUIV_InputMode_Toggle,
411 MUIA_Image_Spec, MUII_CheckMark,
412 MUIA_Image_FreeVert, TRUE,
413 MUIA_Selected, nch->nch_CDC->cdc_EnableKBReset,
414 MUIA_ShowSelState, FALSE,
415 End),
416 Child, (IPTR)HSpace(0),
417 Child, (IPTR)Label((IPTR) "Hijack ResetHandlers:"),
418 Child, (IPTR)(nch->nch_EnableRHObj = ImageObject, ImageButtonFrame,
419 MUIA_Background, MUII_ButtonBack,
420 MUIA_CycleChain, 1,
421 MUIA_InputMode, MUIV_InputMode_Toggle,
422 MUIA_Image_Spec, MUII_CheckMark,
423 MUIA_Image_FreeVert, TRUE,
424 MUIA_Selected, nch->nch_CDC->cdc_EnableRH,
425 MUIA_ShowSelState, FALSE,
426 End),
427 End,
428 Child, (IPTR)Label((IPTR) "Reset delay:"),
429 Child, (IPTR)(nch->nch_ResetDelayObj = SliderObject, SliderFrame,
430 MUIA_CycleChain, 1,
431 MUIA_Numeric_Min, 0,
432 MUIA_Numeric_Max, 60,
433 MUIA_Numeric_Value, nch->nch_CDC->cdc_ResetDelay,
434 MUIA_Numeric_Format, (IPTR) "%ldsec",
435 End),
436 Child, (IPTR)Label((IPTR) "Turbo mouse:"),
437 Child, (IPTR)HGroup,
438 Child, (IPTR)(nch->nch_TurboMouseObj = CycleObject,
439 MUIA_CycleChain, 1,
440 MUIA_Cycle_Entries, (IPTR)TurboMouseStrings,
441 MUIA_Cycle_Active, nch->nch_CDC->cdc_TurboMouse,
442 End),
443 Child, (IPTR)HSpace(0),
444 End,
445 End,
446 Child, (IPTR)VSpace(0),
447 Child, (IPTR)ColGroup(2), GroupFrameT("HID Output Control Window"),
448 Child, (IPTR)Label((IPTR) "Open on startup:"),
449 Child, (IPTR)HGroup,
450 Child, (IPTR)(nch->nch_HIDCtrlAutoObj = ImageObject, ImageButtonFrame,
451 MUIA_Background, MUII_ButtonBack,
452 MUIA_CycleChain, 1,
453 MUIA_InputMode, MUIV_InputMode_Toggle,
454 MUIA_Image_Spec, MUII_CheckMark,
455 MUIA_Image_FreeVert, TRUE,
456 MUIA_Selected, nch->nch_CDC->cdc_HIDCtrlOpen,
457 MUIA_ShowSelState, FALSE,
458 End),
459 Child, (IPTR)HSpace(0),
460 Child, (IPTR)(nch->nch_HIDCtrlOpenObj = TextObject, ButtonFrame,
461 MUIA_ShowMe, (IPTR)nch->nch_Interface,
462 MUIA_Background, MUII_ButtonBack,
463 MUIA_CycleChain, 1,
464 MUIA_InputMode, MUIV_InputMode_RelVerify,
465 MUIA_Text_Contents, (IPTR)"\33c Open now ",
466 End),
467 End,
468 Child, (IPTR)Label((IPTR) "Window Title:"),
469 Child, (IPTR)HGroup,
470 Child, (IPTR)(nch->nch_HIDCtrlTitleObj = StringObject,
471 StringFrame,
472 MUIA_CycleChain, 1,
473 MUIA_String_AdvanceOnCR, TRUE,
474 MUIA_String_Contents, (IPTR)nch->nch_CDC->cdc_HIDCtrlTitle,
475 MUIA_String_MaxLen, 31,
476 End),
477 Child, (IPTR)Label((IPTR) "Rexx Port:"),
478 Child, (IPTR)(nch->nch_HIDCtrlRexxObj = StringObject,
479 StringFrame,
480 MUIA_CycleChain, 1,
481 MUIA_String_AdvanceOnCR, TRUE,
482 MUIA_String_Contents, (IPTR)nch->nch_CDC->cdc_HIDCtrlRexx,
483 MUIA_String_MaxLen, 31,
484 End),
485 End,
486 End,
487 Child, (IPTR)VSpace(0),
488 Child, (IPTR)ColGroup(4), GroupFrameT("LowLevel Library Joypad emulation"),
489 Child, (IPTR)Label((IPTR) "Port 0:"),
490 Child, (IPTR)(nch->nch_LLPortModeObj[0] = CycleObject,
491 MUIA_CycleChain, 1,
492 MUIA_Cycle_Entries, (IPTR)LLPortStrings,
493 MUIA_Cycle_Active, nch->nch_CDC->cdc_LLPortMode[0],
494 End),
495 Child, (IPTR)Label((IPTR) "Port 2:"),
496 Child, (IPTR)(nch->nch_LLPortModeObj[2] = CycleObject,
497 MUIA_CycleChain, 1,
498 MUIA_Cycle_Entries, (IPTR)LLPortStrings,
499 MUIA_Cycle_Active, nch->nch_CDC->cdc_LLPortMode[2],
500 End),
501 Child, (IPTR)Label((IPTR) "Port 1:"),
502 Child, (IPTR)(nch->nch_LLPortModeObj[1] = CycleObject,
503 MUIA_CycleChain, 1,
504 MUIA_Cycle_Entries, (IPTR)LLPortStrings,
505 MUIA_Cycle_Active, nch->nch_CDC->cdc_LLPortMode[1],
506 End),
507 Child, (IPTR)Label((IPTR) "Port 3:"),
508 Child, (IPTR)(nch->nch_LLPortModeObj[3] = CycleObject,
509 MUIA_CycleChain, 1,
510 MUIA_Cycle_Entries, (IPTR)LLPortStrings,
511 MUIA_Cycle_Active, nch->nch_CDC->cdc_LLPortMode[3],
512 End),
513 Child, (IPTR)Label((IPTR) "Rumble Port:"),
514 Child, (IPTR)(nch->nch_LLRumblePortObj = CycleObject,
515 MUIA_CycleChain, 1,
516 MUIA_Cycle_Entries, (IPTR)LLRumbleStrings,
517 MUIA_Cycle_Active, nch->nch_CDC->cdc_LLRumblePort,
518 End),
519 Child, (IPTR)HSpace(0),
520 Child, (IPTR)HSpace(0),
521 End,
522 Child, (IPTR)VSpace(0),
523 End,
524 Child, (IPTR)VGroup,
525 //Child, (IPTR)VSpace(0),
526 Child, (IPTR)HGroup, GroupFrameT((IPTR)(nch->nch_Interface ? "Keyboard mapping" : "Default Keyboard mapping")),
527 Child, (IPTR)VGroup,
528 Child, (IPTR)HGroup,
529 Child, (IPTR)(nch->nch_USBKeymapLVObj = ListviewObject,
530 MUIA_Listview_MultiSelect, MUIV_Listview_MultiSelect_None,
531 MUIA_Listview_List, (IPTR)ListObject,
532 MUIA_CycleChain, 1,
533 InputListFrame,
534 MUIA_List_SourceArray, (IPTR)nch->nch_USBKeyArray,
535 MUIA_List_DisplayHook, (IPTR)&nch->nch_USBKeyListDisplayHook,
536 MUIA_List_AutoVisible, TRUE,
537 End,
538 End),
539 Child, (IPTR)VGroup,
540 Child, (IPTR)VSpace(0),
541 Child, (IPTR)Label((IPTR) "->"),
542 Child, (IPTR)VSpace(0),
543 End,
544 Child, (IPTR)(nch->nch_RawKeymapLVObj = ListviewObject,
545 MUIA_Listview_Input, TRUE,
546 MUIA_Listview_MultiSelect, MUIV_Listview_MultiSelect_None,
547 MUIA_Listview_List, (IPTR)ListObject,
548 InputListFrame,
549 MUIA_CycleChain, 1,
550 MUIA_List_SourceArray, (IPTR)nch->nch_RawKeyArray,
551 MUIA_List_AutoVisible, TRUE,
552 End,
553 End),
554 End,
555 Child, (IPTR)HGroup,
556 Child, (IPTR)(nch->nch_RestoreDefKeymapObj = TextObject, ButtonFrame,
557 MUIA_Background, MUII_ButtonBack,
558 MUIA_CycleChain, 1,
559 MUIA_InputMode, MUIV_InputMode_RelVerify,
560 MUIA_Text_Contents, (IPTR)"\33c Restore default keymap ",
561 End),
562 Child, (IPTR)HSpace(0),
563 Child, (IPTR)(nch->nch_TrackKeyEventsObj = ImageObject, ImageButtonFrame,
564 MUIA_Background, MUII_ButtonBack,
565 MUIA_CycleChain, 1,
566 MUIA_InputMode, MUIV_InputMode_Toggle,
567 MUIA_Image_Spec, MUII_CheckMark,
568 MUIA_Image_FreeVert, TRUE,
569 MUIA_Disabled, !nch->nch_Interface,
570 MUIA_ShowSelState, FALSE,
571 End),
572 Child, (IPTR)Label((IPTR) "Track incoming key events"),
573 End,
574 End,
575 End,
576 //Child, (IPTR)VSpace(0),
577 End,
578 Child, (IPTR)VGroup,
579 //Child, (IPTR)VSpace(0),
580 Child, (IPTR)VGroup, GroupFrameT((IPTR)"Action handling"),
581 Child, (IPTR)HGroup,
582 Child, (IPTR)VGroup, GroupFrameT((IPTR)"Reports and collections"),
583 MUIA_HorizWeight, 10,
584 Child, (IPTR)(nch->nch_ReportLVObj = ListviewObject,
585 MUIA_Listview_MultiSelect, MUIV_Listview_MultiSelect_None,
586 MUIA_Listview_List, (IPTR)ListObject,
587 MUIA_CycleChain, 1,
588 InputListFrame,
589 MUIA_List_DisplayHook, (IPTR)&nch->nch_ReportListDisplayHook,
590 MUIA_List_AutoVisible, TRUE,
591 End,
592 End),
593 Child, (IPTR)HGroup,
594 Child, (IPTR)(nch->nch_FillDefObj = TextObject, ButtonFrame,
595 MUIA_Background, MUII_ButtonBack,
596 MUIA_CycleChain, 1,
597 MUIA_InputMode, MUIV_InputMode_RelVerify,
598 MUIA_Text_Contents, (IPTR)"\33c Fill defaults ",
599 End),
600 Child, (IPTR)(nch->nch_ClearActionsObj = TextObject, ButtonFrame,
601 MUIA_Background, MUII_ButtonBack,
602 MUIA_CycleChain, 1,
603 MUIA_InputMode, MUIV_InputMode_RelVerify,
604 MUIA_Text_Contents, (IPTR)"\33c Clear actions ",
605 End),
606 End,
607 End,
608 Child, (IPTR)VGroup, GroupFrameT((IPTR)"Usage items"),
609 Child, (IPTR)(nch->nch_ItemLVObj = ListviewObject,
610 MUIA_Listview_MultiSelect, MUIV_Listview_MultiSelect_None,
611 MUIA_Listview_List, (IPTR)ListObject,
612 InputListFrame,
613 MUIA_CycleChain, 1,
614 MUIA_List_DisplayHook, (IPTR)&nch->nch_ItemListDisplayHook,
615 MUIA_List_Format, (IPTR)barbarbarbar,
616 MUIA_List_Title, TRUE,
617 MUIA_List_AutoVisible, TRUE,
618 End,
619 End),
620 End,
621 End,
622 Child, (IPTR)HGroup,
623 Child, (IPTR)(nch->nch_TrackEventsObj = ImageObject, ImageButtonFrame,
624 MUIA_Background, MUII_ButtonBack,
625 MUIA_CycleChain, 1,
626 MUIA_InputMode, MUIV_InputMode_Toggle,
627 MUIA_Image_Spec, MUII_CheckMark,
628 MUIA_Image_FreeVert, TRUE,
629 //MUIA_Selected,
630 MUIA_ShowSelState, FALSE,
631 End),
632 Child, (IPTR)Label((IPTR) "Track incoming events"),
633 Child, (IPTR)HSpace(0),
634 Child, (IPTR)(nch->nch_ReportValuesObj = ImageObject, ImageButtonFrame,
635 MUIA_Background, MUII_ButtonBack,
636 MUIA_CycleChain, 1,
637 MUIA_InputMode, MUIV_InputMode_Toggle,
638 MUIA_Image_Spec, MUII_CheckMark,
639 MUIA_Image_FreeVert, TRUE,
640 //MUIA_Selected,
641 MUIA_ShowSelState, FALSE,
642 End),
643 Child, (IPTR)Label((IPTR) "Report current values"),
644 Child, (IPTR)HSpace(0),
645 Child, (IPTR)(nch->nch_DisableActionsObj = ImageObject, ImageButtonFrame,
646 MUIA_Background, MUII_ButtonBack,
647 MUIA_CycleChain, 1,
648 MUIA_InputMode, MUIV_InputMode_Toggle,
649 MUIA_Image_Spec, MUII_CheckMark,
650 MUIA_Image_FreeVert, TRUE,
651 //MUIA_Selected,
652 MUIA_ShowSelState, FALSE,
653 End),
654 Child, (IPTR)Label((IPTR) "Disable all actions"),
655 End,
656 Child, (IPTR)HGroup, GroupFrameT("Performed actions"),
657 Child, (IPTR)VGroup,
658 Child, (IPTR)(nch->nch_ActionLVObj = ListviewObject,
659 MUIA_Listview_MultiSelect, MUIV_Listview_MultiSelect_None,
660 MUIA_Listview_List, (IPTR)ListObject,
661 InputListFrame,
662 MUIA_CycleChain, 1,
663 MUIA_List_DisplayHook, (IPTR)&nch->nch_ActionListDisplayHook,
664 MUIA_List_Format, (IPTR)barbar,
665 MUIA_List_Title, TRUE,
666 MUIA_List_AutoVisible, TRUE,
667 End,
668 End),
669 Child, (IPTR)HGroup,
670 Child, (IPTR)(nch->nch_ActionNewObj = TextObject, ButtonFrame,
671 MUIA_Background, MUII_ButtonBack,
672 MUIA_CycleChain, 1,
673 MUIA_InputMode, MUIV_InputMode_RelVerify,
674 MUIA_Text_Contents, (IPTR)"\33c New ",
675 End),
676 Child, (IPTR)(nch->nch_ActionCopyObj = TextObject, ButtonFrame,
677 MUIA_Background, MUII_ButtonBack,
678 MUIA_CycleChain, 1,
679 MUIA_InputMode, MUIV_InputMode_RelVerify,
680 MUIA_Text_Contents, (IPTR)"\33c Copy ",
681 End),
682 Child, (IPTR)(nch->nch_ActionDelObj = TextObject, ButtonFrame,
683 MUIA_Background, MUII_ButtonBack,
684 MUIA_CycleChain, 1,
685 MUIA_InputMode, MUIV_InputMode_RelVerify,
686 MUIA_Text_Contents, (IPTR)"\33c Del ",
687 End),
688 Child, (IPTR)(nch->nch_ActionUpObj = TextObject, ButtonFrame,
689 MUIA_Background, MUII_ButtonBack,
690 MUIA_CycleChain, 1,
691 MUIA_InputMode, MUIV_InputMode_RelVerify,
692 MUIA_Text_Contents, (IPTR)"\33c Up ",
693 End),
694 Child, (IPTR)(nch->nch_ActionDownObj = TextObject, ButtonFrame,
695 MUIA_Background, MUII_ButtonBack,
696 MUIA_CycleChain, 1,
697 MUIA_InputMode, MUIV_InputMode_RelVerify,
698 MUIA_Text_Contents, (IPTR)"\33c Down ",
699 End),
700 End,
701 End,
702 Child, (IPTR)(nch->nch_ActionAreaObj = VGroup,
703 MUIA_Disabled, TRUE,
704 Child, (IPTR)HGroup,
705 Child, (IPTR)(nch->nch_ActionSelectorObj = CycleObject,
706 MUIA_CycleChain, 1,
707 MUIA_Cycle_Entries, (IPTR)ActionTypeStrings,
708 MUIA_Cycle_Active, 0,
709 End),
710 Child, (IPTR)Label((IPTR) "Trigger:"),
711 Child, (IPTR)(nch->nch_ActionTriggerObj = CycleObject,
712 MUIA_CycleChain, 1,
713 MUIA_Cycle_Entries, (IPTR)ActionTriggerStrings,
714 MUIA_Cycle_Active, 0,
715 End),
716 End,
717 Child, (IPTR)HGroup,
718 Child, (IPTR)Label((IPTR) "Opts:"),
719 Child, (IPTR)(nch->nch_ActionAbsToRelObj = TextObject, ButtonFrame,
720 MUIA_Background, MUII_ButtonBack,
721 MUIA_CycleChain, 1,
722 MUIA_InputMode, MUIV_InputMode_Toggle,
723 MUIA_Text_Contents, (IPTR)"\33c Abs->Rel ",
724 End),
725 Child, (IPTR)(nch->nch_ActionClipEnableObj = TextObject, ButtonFrame,
726 MUIA_Background, MUII_ButtonBack,
727 MUIA_CycleChain, 1,
728 MUIA_InputMode, MUIV_InputMode_Toggle,
729 MUIA_Text_Contents, (IPTR)"\33c Clip ",
730 End),
731 Child, (IPTR)(nch->nch_ActionScaleEnableObj = TextObject, ButtonFrame,
732 MUIA_Background, MUII_ButtonBack,
733 MUIA_CycleChain, 1,
734 MUIA_InputMode, MUIV_InputMode_Toggle,
735 MUIA_Text_Contents, (IPTR)"\33c Scale ",
736 End),
737 Child, (IPTR)(nch->nch_ActionCCEnableObj = TextObject, ButtonFrame,
738 MUIA_Background, MUII_ButtonBack,
739 MUIA_CycleChain, 1,
740 MUIA_InputMode, MUIV_InputMode_Toggle,
741 MUIA_Text_Contents, (IPTR)"\33c CC ",
742 End),
743 Child, (IPTR)(nch->nch_ActionValEnableObj = TextObject, ButtonFrame,
744 MUIA_Background, MUII_ButtonBack,
745 MUIA_CycleChain, 1,
746 MUIA_InputMode, MUIV_InputMode_Toggle,
747 MUIA_Text_Contents, (IPTR)"\33c Val ",
748 End),
749 End,
750 Child, (IPTR)(nch->nch_A_ClipGroupObj = HGroup, GroupFrameT("Clipping"),
751 MUIA_ShowMe, FALSE,
752 Child, (IPTR)Label((IPTR) "Min:"),
753 Child, (IPTR)(nch->nch_A_ClipMinObj = SliderObject, SliderFrame,
754 MUIA_CycleChain, 1,
755 MUIA_Numeric_Min, 0,
756 MUIA_Numeric_Max, 100,
757 MUIA_Numeric_Format, (IPTR)"%ld%%",
758 End),
759 Child, (IPTR)Label((IPTR) "Max:"),
760 Child, (IPTR)(nch->nch_A_ClipMaxObj = SliderObject, SliderFrame,
761 MUIA_CycleChain, 1,
762 MUIA_Numeric_Min, 0,
763 MUIA_Numeric_Max, 100,
764 MUIA_Numeric_Format, (IPTR)"%ld%%",
765 End),
766 Child, (IPTR)Label((IPTR) "Stretch:"),
767 Child, (IPTR)(nch->nch_A_ClipStretchObj = ImageObject, ImageButtonFrame,
768 MUIA_Background, MUII_ButtonBack,
769 MUIA_CycleChain, 1,
770 MUIA_InputMode, MUIV_InputMode_Toggle,
771 MUIA_Image_Spec, MUII_CheckMark,
772 MUIA_Image_FreeVert, TRUE,
773 //MUIA_Selected,
774 MUIA_ShowSelState, FALSE,
775 End),
776 End),
777 Child, (IPTR)(nch->nch_A_ScaleGroupObj = HGroup, GroupFrameT("Scaling"),
778 MUIA_ShowMe, FALSE,
779 Child, (IPTR)Label((IPTR) "Min:"),
780 Child, (IPTR)(nch->nch_A_ScaleMinObj = StringObject,
781 StringFrame,
782 MUIA_String_Accept, (IPTR)"0123456789-",
783 MUIA_CycleChain, 1,
784 MUIA_String_AdvanceOnCR, TRUE,
785 MUIA_String_MaxLen, 10,
786 End),
787 Child, (IPTR)Label((IPTR) "Max:"),
788 Child, (IPTR)(nch->nch_A_ScaleMaxObj = StringObject,
789 StringFrame,
790 MUIA_String_Accept, (IPTR)"0123456789-",
791 MUIA_CycleChain, 1,
792 MUIA_String_AdvanceOnCR, TRUE,
793 MUIA_String_MaxLen, 10,
794 End),
795 End),
796 Child, (IPTR)(nch->nch_A_CCGroupObj = VGroup, GroupFrameT("Pre-condition code"),
797 MUIA_ShowMe, FALSE,
798 Child, (IPTR)HGroup,
799 Child, (IPTR)Label((IPTR) "If"),
800 Child, (IPTR)(nch->nch_A_CCVar1Obj = CycleObject,
801 MUIA_CycleChain, 1,
802 MUIA_Cycle_Entries, (IPTR)A_CCVariableStrings,
803 End),
804 Child, (IPTR)(nch->nch_A_CCCondObj = CycleObject,
805 MUIA_CycleChain, 1,
806 MUIA_Cycle_Entries, (IPTR)A_CCCondStrings,
807 End),
808 Child, (IPTR)(nch->nch_A_CCVar2Obj = CycleObject,
809 MUIA_CycleChain, 1,
810 MUIA_Cycle_Entries, (IPTR)A_CCVariableStrings,
811 End),
812 End,
813 Child, (IPTR)HGroup,
814 Child, (IPTR)Label((IPTR) "Left constant:"),
815 Child, (IPTR)(nch->nch_A_CCConst1Obj = StringObject,
816 StringFrame,
817 MUIA_String_Accept, (IPTR)"0123456789-",
818 MUIA_CycleChain, 1,
819 MUIA_String_AdvanceOnCR, TRUE,
820 MUIA_String_MaxLen, 10,
821 End),
822 Child, (IPTR)Label((IPTR) "Right constant:"),
823 Child, (IPTR)(nch->nch_A_CCConst2Obj = StringObject,
824 StringFrame,
825 MUIA_String_Accept, (IPTR)"0123456789-",
826 MUIA_CycleChain, 1,
827 MUIA_String_AdvanceOnCR, TRUE,
828 MUIA_String_MaxLen, 10,
829 End),
830 End,
831 End),
832 Child, (IPTR)(nch->nch_A_ValGroupObj = VGroup, GroupFrameT("Input value redirection"),
833 MUIA_ShowMe, FALSE,
834 Child, (IPTR)HGroup,
835 Child, (IPTR)Label((IPTR) "Take value for action from"),
836 Child, (IPTR)(nch->nch_A_ValVarObj = CycleObject,
837 MUIA_CycleChain, 1,
838 MUIA_Cycle_Entries, (IPTR)A_CCVariableStrings,
839 End),
840 End,
841 Child, (IPTR)HGroup,
842 Child, (IPTR)Label((IPTR) "Constant:"),
843 Child, (IPTR)(nch->nch_A_ValConstObj = StringObject,
844 StringFrame,
845 MUIA_String_Accept, (IPTR)"0123456789-",
846 MUIA_CycleChain, 1,
847 MUIA_String_AdvanceOnCR, TRUE,
848 MUIA_String_MaxLen, 10,
849 End),
850 End,
851 End),
852 Child, (IPTR)(nch->nch_ActionPageObj = VGroup,
853 MUIA_Group_PageMode, TRUE,
854 //MUIA_Group_ActivePage, MUIV_Group_ActivePage_First,
855 Child, (IPTR)VGroup, GroupFrameT("No action"), /* HUA_NOP */
856 Child, (IPTR)VSpace(0),
857 Child, (IPTR)HGroup,
858 Child, (IPTR)HSpace(0),
859 Child, (IPTR)Label((IPTR) "Does absolutely nothing."),
860 Child, (IPTR)HSpace(0),
861 End,
862 Child, (IPTR)VSpace(0),
863 End,
864 Child, (IPTR)VGroup, GroupFrameT("Change key qualifiers"), /* HUA_QUALIFIER */
865 Child, (IPTR)VSpace(0),
866 Child, (IPTR)HGroup,
867 Child, (IPTR)HSpace(0),
868 Child, (IPTR)(nch->nch_A_KeyQualOpObj = CycleObject,
869 MUIA_CycleChain, 1,
870 MUIA_Cycle_Entries, (IPTR)A_QualOpStrings,
871 End),
872 Child, (IPTR)Label((IPTR) "qualifier"),
873 Child, (IPTR)(nch->nch_A_KeyQualObj = CycleObject,
874 MUIA_CycleChain, 1,
875 MUIA_Cycle_Entries, (IPTR)A_QualifierStrings,
876 End),
877 Child, (IPTR)HSpace(0),
878 End,
879 Child, (IPTR)VSpace(0),
880 End,
881 Child, (IPTR)VGroup, GroupFrameT("USB Keyboard mapping"), /* HUA_KEYMAP */
882 Child, (IPTR)VSpace(0),
883 Child, (IPTR)HGroup,
884 Child, (IPTR)HSpace(0),
885 Child, (IPTR)Label((IPTR) "\33cMapping of USB keycodes\nto Amiga rawcodes"),
886 Child, (IPTR)HSpace(0),
887 End,
888 Child, (IPTR)VSpace(0),
889 End,
890 Child, (IPTR)VGroup, GroupFrameT("Raw key"), /* HUA_RAWKEY */
891 //Child, (IPTR)VSpace(0),
892 Child, (IPTR)Label((IPTR) "\33cSelect key to send"),
893 Child, (IPTR)(nch->nch_A_RawKeyObj = ListviewObject,
894 MUIA_Listview_Input, TRUE,
895 MUIA_Listview_MultiSelect, MUIV_Listview_MultiSelect_None,
896 MUIA_Listview_List, (IPTR)ListObject,
897 InputListFrame,
898 MUIA_CycleChain, 1,
899 MUIA_List_SourceArray, (IPTR)nch->nch_RawKeyArray,
900 MUIA_List_AutoVisible, TRUE,
901 End,
902 End),
903 Child, (IPTR)HGroup,
904 Child, (IPTR)(nch->nch_A_RawKeyUpObj = ImageObject, ImageButtonFrame,
905 MUIA_Background, MUII_ButtonBack,
906 MUIA_CycleChain, 1,
907 MUIA_InputMode, MUIV_InputMode_Toggle,
908 MUIA_Image_Spec, MUII_CheckMark,
909 MUIA_Image_FreeVert, TRUE,
910 //MUIA_Selected,
911 MUIA_ShowSelState, FALSE,
912 End),
913 Child, (IPTR)Label((IPTR) "Send keyup event instead of keydown"),
914 Child, (IPTR)HSpace(0),
915 End,
916 //Child, (IPTR)VSpace(0),
917 End,
918 Child, (IPTR)VGroup, GroupFrameT("Vanilla key"), /* HUA_VANILLA */
919 Child, (IPTR)VSpace(0),
920 Child, (IPTR)HGroup,
921 Child, (IPTR)Label((IPTR) "Key to send:"),
922 Child, (IPTR)(nch->nch_A_VanillaStrObj = StringObject,
923 StringFrame,
924 MUIA_CycleChain, 1,
925 MUIA_String_AdvanceOnCR, TRUE,
926 MUIA_String_MaxLen, 80,
927 End),
928 End,
929 Child, (IPTR)VSpace(0),
930 End,
931 Child, (IPTR)VGroup, GroupFrameT("Keystring"), /* HUA_KEYSTRING */
932 Child, (IPTR)VSpace(0),
933 Child, (IPTR)HGroup,
934 Child, (IPTR)Label((IPTR) "String to send:"),
935 Child, (IPTR)(nch->nch_A_KeyStringObj = StringObject,
936 StringFrame,
937 MUIA_CycleChain, 1,
938 MUIA_String_AdvanceOnCR, TRUE,
939 MUIA_String_MaxLen, 80,
940 End),
941 End,
942 Child, (IPTR)VSpace(0),
943 End,
944 Child, (IPTR)VGroup, GroupFrameT("Mouse pointer position"), /* HUA_MOUSEPOS */
945 Child, (IPTR)VSpace(0),
946 Child, (IPTR)HGroup,
947 Child, (IPTR)HSpace(0),
948 Child, (IPTR)Label((IPTR) "Move mouse"),
949 Child, (IPTR)(nch->nch_A_MousePosOpObj = CycleObject,
950 MUIA_CycleChain, 1,
951 MUIA_Cycle_Entries, (IPTR)A_MousePosOpStrings,
952 End),
953 Child, (IPTR)HSpace(0),
954 End,
955 Child, (IPTR)VSpace(0),
956 End,
957 Child, (IPTR)VGroup, GroupFrameT("Mouse buttons"), /* HUA_BUTTONS */
958 Child, (IPTR)VSpace(0),
959 Child, (IPTR)HGroup,
960 Child, (IPTR)HSpace(0),
961 Child, (IPTR)(nch->nch_A_MouseButOpObj = CycleObject,
962 MUIA_CycleChain, 1,
963 MUIA_Cycle_Entries, (IPTR)A_MouseButOpStrings,
964 End),
965 Child, (IPTR)(nch->nch_A_MouseButObj = CycleObject,
966 MUIA_CycleChain, 1,
967 MUIA_Cycle_Entries, (IPTR)A_MouseButStrings,
968 End),
969 Child, (IPTR)Label((IPTR) "mouse button"),
970 Child, (IPTR)HSpace(0),
971 End,
972 Child, (IPTR)VSpace(0),
973 End,
974 Child, (IPTR)VGroup, GroupFrameT("Tablet information"), /* HUA_TABLET */
975 Child, (IPTR)VSpace(0),
976 Child, (IPTR)HGroup,
977 Child, (IPTR)HSpace(0),
978 Child, (IPTR)Label((IPTR) "Send"),
979 Child, (IPTR)(nch->nch_A_TabletAxisObj = CycleObject,
980 MUIA_CycleChain, 1,
981 MUIA_Cycle_Entries, (IPTR)A_TabletAxisStrings,
982 End),
983 Child, (IPTR)Label((IPTR) "data"),
984 Child, (IPTR)HSpace(0),
985 End,
986 Child, (IPTR)VSpace(0),
987 End,
988 Child, (IPTR)VGroup, GroupFrameT("Digital joypad (lowlevel.library)"), /* HUA_DIGJOY */
989 Child, (IPTR)VSpace(0),
990 Child, (IPTR)HGroup,
991 Child, (IPTR)HSpace(0),
992 Child, (IPTR)(nch->nch_A_JoypadOpObj = CycleObject,
993 MUIA_CycleChain, 1,
994 MUIA_Cycle_Entries, (IPTR)A_JoypadOpStrings,
995 End),
996 Child, (IPTR)(nch->nch_A_JoypadFeatObj = CycleObject,
997 MUIA_CycleChain, 1,
998 MUIA_Cycle_Entries, (IPTR)A_JoypadFeatStrings,
999 End),
1000 Child, (IPTR)Label((IPTR) "on"),
1001 Child, (IPTR)(nch->nch_A_JoypadPortObj = CycleObject,
1002 MUIA_CycleChain, 1,
1003 MUIA_Cycle_Entries, (IPTR)A_JoypadPortStrings,
1004 End),
1005 Child, (IPTR)HSpace(0),
1006 End,
1007 Child, (IPTR)VSpace(0),
1008 End,
1009 Child, (IPTR)VGroup, GroupFrameT("Analogue joysticks (lowlevel hack)"), /* HUA_ANALOGJOY */
1010 Child, (IPTR)VSpace(0),
1011 Child, (IPTR)HGroup,
1012 Child, (IPTR)HSpace(0),
1013 Child, (IPTR)Label((IPTR) "Set"),
1014 Child, (IPTR)(nch->nch_A_APadFeatObj = CycleObject,
1015 MUIA_CycleChain, 1,
1016 MUIA_Cycle_Entries, (IPTR)A_APadFeatStrings,
1017 End),
1018 Child, (IPTR)Label((IPTR) "of"),
1019 Child, (IPTR)(nch->nch_A_APadPortObj = CycleObject,
1020 MUIA_CycleChain, 1,
1021 MUIA_Cycle_Entries, (IPTR)A_JoypadPortStrings,
1022 End),
1023 Child, (IPTR)HSpace(0),
1024 End,
1025 Child, (IPTR)VSpace(0),
1026 End,
1027 Child, (IPTR)VGroup, GroupFrameT("Scrollwheel information"), /* HUA_WHEEL */
1028 Child, (IPTR)VSpace(0),
1029 Child, (IPTR)HGroup,
1030 Child, (IPTR)HSpace(0),
1031 Child, (IPTR)Label((IPTR) "Send"),
1032 Child, (IPTR)(nch->nch_A_WheelOpObj = CycleObject,
1033 MUIA_CycleChain, 1,
1034 MUIA_Cycle_Entries, (IPTR)A_WheelOpStrings,
1035 End),
1036 Child, (IPTR)Label((IPTR) "event"),
1037 Child, (IPTR)HSpace(0),
1038 End,
1039 Child, (IPTR)HGroup,
1040 Child, (IPTR)Label((IPTR) "Distance:"),
1041 Child, (IPTR)(nch->nch_A_WheelDistObj = SliderObject, SliderFrame,
1042 MUIA_CycleChain, 1,
1043 MUIA_Numeric_Min, 1,
1044 MUIA_Numeric_Max, 32,
1045 End),
1046 End,
1047 Child, (IPTR)VSpace(0),
1048 End,
1049 Child, (IPTR)VGroup, GroupFrameT("Sound playback"), /* HUA_SOUND */
1050 Child, (IPTR)VSpace(0),
1051 Child, (IPTR)ColGroup(2),
1052 Child, (IPTR)Label((IPTR) "Soundfile:"),
1053 Child, (IPTR)PopaslObject,
1054 MUIA_CycleChain, 1,
1055 MUIA_Popstring_String, (IPTR)(nch->nch_A_SoundFileObj = StringObject,
1056 StringFrame,
1057 MUIA_CycleChain, 1,
1058 MUIA_String_AdvanceOnCR, TRUE,
1059 End),
1060 MUIA_Popstring_Button, (IPTR)PopButton(MUII_PopFile),
1061 ASLFR_TitleText, (IPTR)"Select sound file...",
1062 End,
1063 Child, (IPTR)Label((IPTR) "Volume:"),
1064 Child, (IPTR)(nch->nch_A_SoundVolObj = SliderObject, SliderFrame,
1065 MUIA_CycleChain, 1,
1066 MUIA_Numeric_Min, 0,
1067 MUIA_Numeric_Max, 64,
1068 End),
1069 End,
1070 Child, (IPTR)VSpace(0),
1071 End,
1072 Child, (IPTR)VGroup, GroupFrameT("Shell command execution"), /* HUA_SHELL */
1073 Child, (IPTR)VSpace(0),
1074 Child, (IPTR)ColGroup(2),
1075 Child, (IPTR)Label((IPTR) "Command:"),
1076 Child, (IPTR)PopaslObject,
1077 MUIA_Popstring_String, (IPTR)(nch->nch_A_ShellComObj = StringObject,
1078 StringFrame,
1079 MUIA_CycleChain, 1,
1080 MUIA_String_AdvanceOnCR, TRUE,
1081 End),
1082 MUIA_Popstring_Button, (IPTR)PopButton(MUII_PopFile),
1083 ASLFR_TitleText, (IPTR) "Select an executable...",
1084 End,
1085 Child, (IPTR)Label((IPTR) "ASync:"),
1086 Child, (IPTR)HGroup,
1087 Child, (IPTR)(nch->nch_A_ShellAsyncObj = ImageObject, ImageButtonFrame,
1088 MUIA_Background, MUII_ButtonBack,
1089 MUIA_CycleChain, 1,
1090 MUIA_InputMode, MUIV_InputMode_Toggle,
1091 MUIA_Image_Spec, MUII_CheckMark,
1092 MUIA_Image_FreeVert, TRUE,
1093 MUIA_Selected, nch->nch_CDC->cdc_EnableRH,
1094 MUIA_ShowSelState, FALSE,
1095 End),
1096 Child, (IPTR)HSpace(0),
1097 End,
1098 End,
1099 Child, (IPTR)VSpace(0),
1100 End,
1101 Child, (IPTR)VGroup, GroupFrameT("Arexx command execution"), /* HUA_AREXX */
1102 Child, (IPTR)VSpace(0),
1103 Child, (IPTR)HGroup,
1104 Child, (IPTR)HSpace(0),
1105 Child, (IPTR)Label((IPTR) "Sorry, not yet implemented."),
1106 Child, (IPTR)HSpace(0),
1107 End,
1108 Child, (IPTR)VSpace(0),
1109 End,
1110 Child, (IPTR)VGroup, GroupFrameT("HID output variables"), /* HUA_OUTPUT */
1111 Child, (IPTR)(nch->nch_A_OutItemLVObj = ListviewObject,
1112 MUIA_Listview_MultiSelect, MUIV_Listview_MultiSelect_None,
1113 MUIA_Listview_List, (IPTR)ListObject,
1114 InputListFrame,
1115 MUIA_CycleChain, 1,
1116 MUIA_List_DisplayHook, (IPTR)&nch->nch_ItemListDisplayHook,
1117 MUIA_List_Format, (IPTR)barbarbarbar,
1118 MUIA_List_Title, TRUE,
1119 MUIA_List_AutoVisible, TRUE,
1120 End,
1121 End),
1122 //Child, (IPTR)VSpace(0),
1123 Child, (IPTR)HGroup,
1124 Child, (IPTR)Label((IPTR) "Array values:"),
1125 Child, (IPTR)(nch->nch_A_OutArrayObj = StringObject,
1126 StringFrame,
1127 MUIA_CycleChain, 1,
1128 MUIA_String_AdvanceOnCR, TRUE,
1129 MUIA_String_MaxLen, 256,
1130 End),
1131 End,
1132 Child, (IPTR)HGroup,
1133 Child, (IPTR)Label((IPTR) "Operation:"),
1134 Child, (IPTR)(nch->nch_A_OutOpObj = CycleObject,
1135 MUIA_CycleChain, 1,
1136 MUIA_Cycle_Entries, (IPTR)A_OutOpStrings,
1137 End),
1138 End,
1139 End,
1140 Child, (IPTR)VGroup, GroupFrameT("HID feature variables"), /* HUA_FEATURE */
1141 Child, (IPTR)(nch->nch_A_FeatItemLVObj = ListviewObject,
1142 MUIA_Listview_MultiSelect, MUIV_Listview_MultiSelect_None,
1143 MUIA_Listview_List, (IPTR)ListObject,
1144 InputListFrame,
1145 MUIA_CycleChain, 1,
1146 MUIA_List_DisplayHook, (IPTR)&nch->nch_ItemListDisplayHook,
1147 MUIA_List_Format, (IPTR)barbarbarbar,
1148 MUIA_List_Title, TRUE,
1149 MUIA_List_AutoVisible, TRUE,
1150 End,
1151 End),
1152 //Child, (IPTR)VSpace(0),
1153 Child, (IPTR)HGroup,
1154 Child, (IPTR)Label((IPTR) "Array values:"),
1155 Child, (IPTR)(nch->nch_A_FeatArrayObj = StringObject,
1156 StringFrame,
1157 MUIA_CycleChain, 1,
1158 MUIA_String_AdvanceOnCR, TRUE,
1159 MUIA_String_MaxLen, 256,
1160 End),
1161 End,
1162 Child, (IPTR)HGroup,
1163 Child, (IPTR)Label((IPTR) "Operation:"),
1164 Child, (IPTR)(nch->nch_A_FeatOpObj = CycleObject,
1165 MUIA_CycleChain, 1,
1166 MUIA_Cycle_Entries, (IPTR)A_OutOpStrings,
1167 End),
1168 End,
1169 End,
1170 Child, (IPTR)VGroup, GroupFrameT("Miscellaneous stuff"), /* HUA_MISC */
1171 Child, (IPTR)VSpace(0),
1172 Child, (IPTR)HGroup,
1173 Child, (IPTR)HSpace(0),
1174 Child, (IPTR)Label((IPTR) "Event:"),
1175 Child, (IPTR)(nch->nch_A_MiscOpObj = CycleObject,
1176 MUIA_CycleChain, 1,
1177 MUIA_Cycle_Entries, (IPTR)A_MiscOpStrings,
1178 End),
1179 Child, (IPTR)HSpace(0),
1180 End,
1181 Child, (IPTR)VSpace(0),
1182 End,
1183 Child, (IPTR)VGroup, GroupFrameT("Changing variables"), /* HUA_VARIABLES */
1184 Child, (IPTR)VSpace(0),
1185 Child, (IPTR)HGroup,
1186 Child, (IPTR)(nch->nch_A_TarVarObj = CycleObject,
1187 MUIA_CycleChain, 1,
1188 MUIA_Cycle_Entries, (IPTR)A_TarVariableStrings,
1189 End),
1190 Child, (IPTR)(nch->nch_A_TarVarOpObj = CycleObject,
1191 MUIA_CycleChain, 1,
1192 MUIA_Cycle_Entries, (IPTR)A_TarVarOpStrings,
1193 End),
1194 End,
1195 Child, (IPTR)VSpace(0),
1196 End,
1197 Child, (IPTR)VGroup, GroupFrameT("Extended Raw key"), /* HUA_EXTRAWKEY */
1198 //Child, (IPTR)VSpace(0),
1199 Child, (IPTR)Label((IPTR) "\33cSelect key to send"),
1200 Child, (IPTR)(nch->nch_A_ExtRawKeyObj = ListviewObject,
1201 MUIA_Listview_Input, TRUE,
1202 MUIA_Listview_MultiSelect, MUIV_Listview_MultiSelect_None,
1203 MUIA_Listview_List, (IPTR)ListObject,
1204 InputListFrame,
1205 MUIA_CycleChain, 1,
1206 MUIA_List_SourceArray, (IPTR)nch->nch_ExtRawKeyArray,
1207 MUIA_List_AutoVisible, TRUE,
1208 End,
1209 End),
1210 Child, (IPTR)HGroup,
1211 Child, (IPTR)(nch->nch_A_ExtRawKeyUpObj = ImageObject, ImageButtonFrame,
1212 MUIA_Background, MUII_ButtonBack,
1213 MUIA_CycleChain, 1,
1214 MUIA_InputMode, MUIV_InputMode_Toggle,
1215 MUIA_Image_Spec, MUII_CheckMark,
1216 MUIA_Image_FreeVert, TRUE,
1217 MUIA_ShowSelState, FALSE,
1218 End),
1219 Child, (IPTR)Label((IPTR) "Send keyup event instead of keydown"),
1220 Child, (IPTR)HSpace(0),
1221 End,
1222 //Child, (IPTR)VSpace(0),
1223 End,
1224 End),
1225 End),
1226 End,
1227 End,
1228 //Child, (IPTR)VSpace(0),
1229 End,
1230 End,
1231 //Child, (IPTR)VSpace(0),
1232 Child, (IPTR)HGroup,
1233 MUIA_Group_SameWidth, TRUE,
1234 Child, (IPTR)(nch->nch_UseObj = TextObject, ButtonFrame,
1235 MUIA_ShowMe, (IPTR)nch->nch_Interface,
1236 MUIA_Background, MUII_ButtonBack,
1237 MUIA_CycleChain, 1,
1238 MUIA_InputMode, MUIV_InputMode_RelVerify,
1239 MUIA_Text_Contents, (IPTR)"\33c Save ",
1240 End),
1241 Child, (IPTR)(nch->nch_SetDefaultObj = TextObject, ButtonFrame,
1242 MUIA_Background, MUII_ButtonBack,
1243 MUIA_CycleChain, 1,
1244 MUIA_InputMode, MUIV_InputMode_RelVerify,
1245 MUIA_Text_Contents, (IPTR)(nch->nch_Interface ? "\33c Save as Default " : "\33c Save Defaults "),
1246 End),
1247 Child, (IPTR)(nch->nch_CloseObj = TextObject, ButtonFrame,
1248 MUIA_Background, MUII_ButtonBack,
1249 MUIA_CycleChain, 1,
1250 MUIA_InputMode, MUIV_InputMode_RelVerify,
1251 MUIA_Text_Contents, (IPTR)"\33c Use ",
1252 End),
1253 End,
1254 End,
1255 End),
1256 End;
1258 if(!nch->nch_App)
1260 KPRINTF(10, ("Couldn't create application\n"));
1261 GM_UNIQUENAME(nGUITaskCleanup)(nch);
1262 return;
1266 struct ActionData *ad = INST_DATA(nch->nch_ActionClass->mcc_Class, nch->nch_ActionObj);
1267 ad->ad_NCH = nch;
1270 nch->nch_GUICurrentColl = NULL;
1271 nch->nch_GUICurrentItem = NULL;
1272 nch->nch_QuitGUI = FALSE;
1274 DoMethod(nch->nch_MainWindow, MUIM_Notify, MUIA_Window_CloseRequest, TRUE,
1275 nch->nch_ActionObj, 1, MUIM_Action_UseConfig);
1276 DoMethod(nch->nch_UseObj, MUIM_Notify, MUIA_Pressed, FALSE,
1277 nch->nch_ActionObj, 1, MUIM_Action_StoreConfig);
1278 DoMethod(nch->nch_SetDefaultObj, MUIM_Notify, MUIA_Pressed, FALSE,
1279 nch->nch_ActionObj, 1, MUIM_Action_DefaultConfig);
1280 DoMethod(nch->nch_CloseObj, MUIM_Notify, MUIA_Pressed, FALSE,
1281 nch->nch_ActionObj, 1, MUIM_Action_UseConfig);
1283 DoMethod(nch->nch_AboutMI, MUIM_Notify, MUIA_Menuitem_Trigger, MUIV_EveryTime,
1284 nch->nch_ActionObj, 1, MUIM_Action_About);
1285 DoMethod(nch->nch_UseMI, MUIM_Notify, MUIA_Menuitem_Trigger, MUIV_EveryTime,
1286 nch->nch_ActionObj, 1, MUIM_Action_StoreConfig);
1287 DoMethod(nch->nch_SetDefaultMI, MUIM_Notify, MUIA_Menuitem_Trigger, MUIV_EveryTime,
1288 nch->nch_ActionObj, 1, MUIM_Action_DefaultConfig);
1289 DoMethod(nch->nch_MUIPrefsMI, MUIM_Notify, MUIA_Menuitem_Trigger, MUIV_EveryTime,
1290 nch->nch_App, 2, MUIM_Application_OpenConfigWindow, 0);
1291 DoMethod(nch->nch_SwapLMBRMBMI, MUIM_Notify, MUIA_Menuitem_Trigger, MUIV_EveryTime,
1292 nch->nch_ActionObj, 1, MUIM_Action_SwapLMBRMB);
1293 DoMethod(nch->nch_MouseAccel100MI, MUIM_Notify, MUIA_Menuitem_Trigger, MUIV_EveryTime,
1294 nch->nch_ActionObj, 2, MUIM_Action_SetMouseAccel, 100);
1295 DoMethod(nch->nch_MouseAccel150MI, MUIM_Notify, MUIA_Menuitem_Trigger, MUIV_EveryTime,
1296 nch->nch_ActionObj, 2, MUIM_Action_SetMouseAccel, 150);
1297 DoMethod(nch->nch_MouseAccel200MI, MUIM_Notify, MUIA_Menuitem_Trigger, MUIV_EveryTime,
1298 nch->nch_ActionObj, 2, MUIM_Action_SetMouseAccel, 200);
1299 DoMethod(nch->nch_JoyPort0MI, MUIM_Notify, MUIA_Menuitem_Trigger, MUIV_EveryTime,
1300 nch->nch_ActionObj, 2, MUIM_Action_SetJoyPort, 0);
1301 DoMethod(nch->nch_JoyPort1MI, MUIM_Notify, MUIA_Menuitem_Trigger, MUIV_EveryTime,
1302 nch->nch_ActionObj, 2, MUIM_Action_SetJoyPort, 1);
1303 DoMethod(nch->nch_JoyPort2MI, MUIM_Notify, MUIA_Menuitem_Trigger, MUIV_EveryTime,
1304 nch->nch_ActionObj, 2, MUIM_Action_SetJoyPort, 2);
1305 DoMethod(nch->nch_JoyPort3MI, MUIM_Notify, MUIA_Menuitem_Trigger, MUIV_EveryTime,
1306 nch->nch_ActionObj, 2, MUIM_Action_SetJoyPort, 3);
1307 DoMethod(nch->nch_JoyAutofireMI, MUIM_Notify, MUIA_Menuitem_Trigger, MUIV_EveryTime,
1308 nch->nch_ActionObj, 1, MUIM_Action_AddAutofire);
1310 DoMethod(nch->nch_DebugReportMI, MUIM_Notify, MUIA_Menuitem_Trigger, MUIV_EveryTime,
1311 nch->nch_ActionObj, 1, MUIM_Action_DebugReport);
1313 DoMethod(nch->nch_EnableKBResetObj, MUIM_Notify, MUIA_Selected, MUIV_EveryTime,
1314 nch->nch_ActionObj, 1, MUIM_Action_UpdateDevPrefs);
1315 DoMethod(nch->nch_EnableRHObj, MUIM_Notify, MUIA_Selected, MUIV_EveryTime,
1316 nch->nch_ActionObj, 1, MUIM_Action_UpdateDevPrefs);
1317 DoMethod(nch->nch_ResetDelayObj, MUIM_Notify, MUIA_Numeric_Value, MUIV_EveryTime,
1318 nch->nch_ActionObj, 1, MUIM_Action_UpdateDevPrefs);
1319 DoMethod(nch->nch_ShellStackObj, MUIM_Notify, MUIA_String_Integer, MUIV_EveryTime,
1320 nch->nch_ActionObj, 1, MUIM_Action_UpdateDevPrefs);
1321 DoMethod(nch->nch_TurboMouseObj, MUIM_Notify, MUIA_Cycle_Active, MUIV_EveryTime,
1322 nch->nch_ActionObj, 1, MUIM_Action_UpdateDevPrefs);
1324 DoMethod(nch->nch_HIDCtrlAutoObj, MUIM_Notify, MUIA_Selected, MUIV_EveryTime,
1325 nch->nch_ActionObj, 1, MUIM_Action_UpdateDevPrefs);
1326 DoMethod(nch->nch_HIDCtrlOpenObj, MUIM_Notify, MUIA_Pressed, FALSE,
1327 nch->nch_ActionObj, 1, MUIM_Action_ShowHIDControl);
1329 for(count = 0; count < 4; count++)
1331 DoMethod(nch->nch_LLPortModeObj[count], MUIM_Notify, MUIA_Cycle_Active, MUIV_EveryTime,
1332 nch->nch_ActionObj, 1, MUIM_Action_UpdateDevPrefs);
1334 DoMethod(nch->nch_LLRumblePortObj, MUIM_Notify, MUIA_Cycle_Active, MUIV_EveryTime,
1335 nch->nch_ActionObj, 1, MUIM_Action_UpdateDevPrefs);
1337 DoMethod(nch->nch_USBKeymapLVObj, MUIM_Notify, MUIA_List_Active, MUIV_EveryTime,
1338 nch->nch_ActionObj, 1, MUIM_Action_KeymapSelectUSB);
1339 DoMethod(nch->nch_RawKeymapLVObj, MUIM_Notify, MUIA_List_Active, MUIV_EveryTime,
1340 nch->nch_ActionObj, 1, MUIM_Action_KeymapSelectRaw);
1341 DoMethod(nch->nch_RestoreDefKeymapObj, MUIM_Notify, MUIA_Pressed, FALSE,
1342 nch->nch_ActionObj, 1, MUIM_Action_RestDefKeymap);
1343 DoMethod(nch->nch_TrackKeyEventsObj, MUIM_Notify, MUIA_Selected, MUIV_EveryTime,
1344 nch->nch_ActionObj, 1, MUIM_Action_SetTracking);
1346 DoMethod(nch->nch_ActionSelectorObj, MUIM_Notify, MUIA_Cycle_Active, MUIV_EveryTime,
1347 nch->nch_ActionPageObj, 3, MUIM_Set, MUIA_Group_ActivePage, MUIV_TriggerValue);
1349 DoMethod(nch->nch_ReportLVObj, MUIM_Notify, MUIA_List_Active, MUIV_EveryTime,
1350 nch->nch_ActionObj, 1, MUIM_Action_SelectReport);
1352 DoMethod(nch->nch_FillDefObj, MUIM_Notify, MUIA_Pressed, FALSE,
1353 nch->nch_ActionObj, 1, MUIM_Action_FillDefReport);
1354 DoMethod(nch->nch_ClearActionsObj, MUIM_Notify, MUIA_Pressed, FALSE,
1355 nch->nch_ActionObj, 1, MUIM_Action_ClearReport);
1357 DoMethod(nch->nch_TrackEventsObj, MUIM_Notify, MUIA_Selected, MUIV_EveryTime,
1358 nch->nch_ActionObj, 1, MUIM_Action_SetTracking);
1359 DoMethod(nch->nch_ReportValuesObj, MUIM_Notify, MUIA_Selected, MUIV_EveryTime,
1360 nch->nch_ActionObj, 1, MUIM_Action_SetTracking);
1361 DoMethod(nch->nch_DisableActionsObj, MUIM_Notify, MUIA_Selected, MUIV_EveryTime,
1362 nch->nch_ActionObj, 1, MUIM_Action_SetTracking);
1364 DoMethod(nch->nch_ItemLVObj, MUIM_Notify, MUIA_List_Active, MUIV_EveryTime,
1365 nch->nch_ActionObj, 1, MUIM_Action_SelectItem);
1367 DoMethod(nch->nch_ActionLVObj, MUIM_Notify, MUIA_List_Active, MUIV_EveryTime,
1368 nch->nch_ActionObj, 1, MUIM_Action_SelectAction);
1370 DoMethod(nch->nch_ActionNewObj, MUIM_Notify, MUIA_Pressed, FALSE,
1371 nch->nch_ActionObj, 1, MUIM_Action_NewAction);
1372 DoMethod(nch->nch_ActionCopyObj, MUIM_Notify, MUIA_Pressed, FALSE,
1373 nch->nch_ActionObj, 1, MUIM_Action_CopyAction);
1374 DoMethod(nch->nch_ActionDelObj, MUIM_Notify, MUIA_Pressed, FALSE,
1375 nch->nch_ActionObj, 1, MUIM_Action_DelAction);
1376 DoMethod(nch->nch_ActionUpObj, MUIM_Notify, MUIA_Pressed, FALSE,
1377 nch->nch_ActionObj, 1, MUIM_Action_MoveActionUp);
1378 DoMethod(nch->nch_ActionDownObj, MUIM_Notify, MUIA_Pressed, FALSE,
1379 nch->nch_ActionObj, 1, MUIM_Action_MoveActionDown);
1381 DoMethod(nch->nch_ActionClipEnableObj, MUIM_Notify, MUIA_Selected, MUIV_EveryTime,
1382 nch->nch_A_ClipGroupObj, 3, MUIM_Set, MUIA_ShowMe, MUIV_TriggerValue);
1383 DoMethod(nch->nch_ActionScaleEnableObj, MUIM_Notify, MUIA_Selected, MUIV_EveryTime,
1384 nch->nch_A_ScaleGroupObj, 3, MUIM_Set, MUIA_ShowMe, MUIV_TriggerValue);
1385 DoMethod(nch->nch_ActionCCEnableObj, MUIM_Notify, MUIA_Selected, MUIV_EveryTime,
1386 nch->nch_A_CCGroupObj, 3, MUIM_Set, MUIA_ShowMe, MUIV_TriggerValue);
1387 DoMethod(nch->nch_ActionValEnableObj, MUIM_Notify, MUIA_Selected, MUIV_EveryTime,
1388 nch->nch_A_ValGroupObj, 3, MUIM_Set, MUIA_ShowMe, MUIV_TriggerValue);
1390 DoMethod(nch->nch_ActionSelectorObj, MUIM_Notify, MUIA_Cycle_Active, MUIV_EveryTime,
1391 nch->nch_ActionObj, 1, MUIM_Action_SetActionType);
1392 DoMethod(nch->nch_ActionTriggerObj, MUIM_Notify, MUIA_Cycle_Active, MUIV_EveryTime,
1393 nch->nch_ActionObj, 1, MUIM_Action_UpdateAction);
1395 DoMethod(nch->nch_ActionAbsToRelObj, MUIM_Notify, MUIA_Selected, MUIV_EveryTime,
1396 nch->nch_ActionObj, 1, MUIM_Action_UpdateAOptions);
1397 DoMethod(nch->nch_ActionClipEnableObj, MUIM_Notify, MUIA_Selected, MUIV_EveryTime,
1398 nch->nch_ActionObj, 1, MUIM_Action_UpdateAOptions);
1399 DoMethod(nch->nch_ActionScaleEnableObj, MUIM_Notify, MUIA_Selected, MUIV_EveryTime,
1400 nch->nch_ActionObj, 1, MUIM_Action_UpdateAOptions);
1401 DoMethod(nch->nch_ActionCCEnableObj, MUIM_Notify, MUIA_Selected, MUIV_EveryTime,
1402 nch->nch_ActionObj, 1, MUIM_Action_UpdateAOptions);
1403 DoMethod(nch->nch_ActionValEnableObj, MUIM_Notify, MUIA_Selected, MUIV_EveryTime,
1404 nch->nch_ActionObj, 1, MUIM_Action_UpdateAOptions);
1406 DoMethod(nch->nch_A_ClipMinObj, MUIM_Notify, MUIA_Numeric_Value, MUIV_EveryTime,
1407 nch->nch_ActionObj, 1, MUIM_Action_UpdateAOptions);
1408 DoMethod(nch->nch_A_ClipMaxObj, MUIM_Notify, MUIA_Numeric_Value, MUIV_EveryTime,
1409 nch->nch_ActionObj, 1, MUIM_Action_UpdateAOptions);
1410 DoMethod(nch->nch_A_ClipStretchObj, MUIM_Notify, MUIA_Selected, MUIV_EveryTime,
1411 nch->nch_ActionObj, 1, MUIM_Action_UpdateAOptions);
1413 DoMethod(nch->nch_A_ScaleMinObj, MUIM_Notify, MUIA_String_Contents, MUIV_EveryTime,
1414 nch->nch_ActionObj, 1, MUIM_Action_UpdateAOptions);
1415 DoMethod(nch->nch_A_ScaleMaxObj, MUIM_Notify, MUIA_String_Contents, MUIV_EveryTime,
1416 nch->nch_ActionObj, 1, MUIM_Action_UpdateAOptions);
1418 DoMethod(nch->nch_A_CCVar1Obj, MUIM_Notify, MUIA_Cycle_Active, MUIV_EveryTime,
1419 nch->nch_ActionObj, 1, MUIM_Action_UpdateAOptions);
1420 DoMethod(nch->nch_A_CCCondObj, MUIM_Notify, MUIA_Cycle_Active, MUIV_EveryTime,
1421 nch->nch_ActionObj, 1, MUIM_Action_UpdateAOptions);
1422 DoMethod(nch->nch_A_CCVar2Obj, MUIM_Notify, MUIA_Cycle_Active, MUIV_EveryTime,
1423 nch->nch_ActionObj, 1, MUIM_Action_UpdateAOptions);
1424 DoMethod(nch->nch_A_CCConst1Obj, MUIM_Notify, MUIA_String_Contents, MUIV_EveryTime,
1425 nch->nch_ActionObj, 1, MUIM_Action_UpdateAOptions);
1426 DoMethod(nch->nch_A_CCConst2Obj, MUIM_Notify, MUIA_String_Contents, MUIV_EveryTime,
1427 nch->nch_ActionObj, 1, MUIM_Action_UpdateAOptions);
1429 DoMethod(nch->nch_A_ValVarObj, MUIM_Notify, MUIA_Cycle_Active, MUIV_EveryTime,
1430 nch->nch_ActionObj, 1, MUIM_Action_UpdateAOptions);
1431 DoMethod(nch->nch_A_ValConstObj, MUIM_Notify, MUIA_String_Contents, MUIV_EveryTime,
1432 nch->nch_ActionObj, 1, MUIM_Action_UpdateAOptions);
1434 DoMethod(nch->nch_A_KeyQualObj, MUIM_Notify, MUIA_Cycle_Active, MUIV_EveryTime,
1435 nch->nch_ActionObj, 1, MUIM_Action_UpdateAction);
1436 DoMethod(nch->nch_A_KeyQualOpObj, MUIM_Notify, MUIA_Cycle_Active, MUIV_EveryTime,
1437 nch->nch_ActionObj, 1, MUIM_Action_UpdateAction);
1438 DoMethod(nch->nch_A_RawKeyObj, MUIM_Notify, MUIA_List_Active, MUIV_EveryTime,
1439 nch->nch_ActionObj, 1, MUIM_Action_UpdateAction);
1440 DoMethod(nch->nch_A_RawKeyUpObj, MUIM_Notify, MUIA_Selected, MUIV_EveryTime,
1441 nch->nch_ActionObj, 1, MUIM_Action_UpdateAction);
1442 DoMethod(nch->nch_A_VanillaStrObj, MUIM_Notify, MUIA_String_Contents, MUIV_EveryTime,
1443 nch->nch_ActionObj, 1, MUIM_Action_UpdateAction);
1444 DoMethod(nch->nch_A_KeyStringObj, MUIM_Notify, MUIA_String_Contents, MUIV_EveryTime,
1445 nch->nch_ActionObj, 1, MUIM_Action_UpdateAction);
1446 DoMethod(nch->nch_A_MousePosOpObj, MUIM_Notify, MUIA_Cycle_Active, MUIV_EveryTime,
1447 nch->nch_ActionObj, 1, MUIM_Action_UpdateAction);
1448 DoMethod(nch->nch_A_MouseButOpObj, MUIM_Notify, MUIA_Cycle_Active, MUIV_EveryTime,
1449 nch->nch_ActionObj, 1, MUIM_Action_UpdateAction);
1450 DoMethod(nch->nch_A_MouseButObj, MUIM_Notify, MUIA_Cycle_Active, MUIV_EveryTime,
1451 nch->nch_ActionObj, 1, MUIM_Action_UpdateAction);
1452 DoMethod(nch->nch_A_TabletAxisObj, MUIM_Notify, MUIA_Cycle_Active, MUIV_EveryTime,
1453 nch->nch_ActionObj, 1, MUIM_Action_UpdateAction);
1454 DoMethod(nch->nch_A_WheelOpObj, MUIM_Notify, MUIA_Cycle_Active, MUIV_EveryTime,
1455 nch->nch_ActionObj, 1, MUIM_Action_UpdateAction);
1456 DoMethod(nch->nch_A_WheelDistObj, MUIM_Notify, MUIA_Numeric_Value, MUIV_EveryTime,
1457 nch->nch_ActionObj, 1, MUIM_Action_UpdateAction);
1458 DoMethod(nch->nch_A_JoypadOpObj, MUIM_Notify, MUIA_Cycle_Active, MUIV_EveryTime,
1459 nch->nch_ActionObj, 1, MUIM_Action_UpdateAction);
1460 DoMethod(nch->nch_A_JoypadFeatObj, MUIM_Notify, MUIA_Cycle_Active, MUIV_EveryTime,
1461 nch->nch_ActionObj, 1, MUIM_Action_UpdateAction);
1462 DoMethod(nch->nch_A_JoypadPortObj, MUIM_Notify, MUIA_Cycle_Active, MUIV_EveryTime,
1463 nch->nch_ActionObj, 1, MUIM_Action_UpdateAction);
1464 DoMethod(nch->nch_A_APadFeatObj, MUIM_Notify, MUIA_Cycle_Active, MUIV_EveryTime,
1465 nch->nch_ActionObj, 1, MUIM_Action_UpdateAction);
1466 DoMethod(nch->nch_A_APadPortObj, MUIM_Notify, MUIA_Cycle_Active, MUIV_EveryTime,
1467 nch->nch_ActionObj, 1, MUIM_Action_UpdateAction);
1468 DoMethod(nch->nch_A_SoundFileObj, MUIM_Notify, MUIA_String_Contents, MUIV_EveryTime,
1469 nch->nch_ActionObj, 1, MUIM_Action_UpdateAction);
1470 DoMethod(nch->nch_A_SoundVolObj, MUIM_Notify, MUIA_Numeric_Value, MUIV_EveryTime,
1471 nch->nch_ActionObj, 1, MUIM_Action_UpdateAction);
1472 DoMethod(nch->nch_A_ShellComObj, MUIM_Notify, MUIA_String_Contents, MUIV_EveryTime,
1473 nch->nch_ActionObj, 1, MUIM_Action_UpdateAction);
1474 DoMethod(nch->nch_A_ShellAsyncObj, MUIM_Notify, MUIA_Selected, MUIV_EveryTime,
1475 nch->nch_ActionObj, 1, MUIM_Action_UpdateAction);
1476 DoMethod(nch->nch_A_MiscOpObj, MUIM_Notify, MUIA_Cycle_Active, MUIV_EveryTime,
1477 nch->nch_ActionObj, 1, MUIM_Action_UpdateAction);
1478 DoMethod(nch->nch_A_TarVarObj, MUIM_Notify, MUIA_Cycle_Active, MUIV_EveryTime,
1479 nch->nch_ActionObj, 1, MUIM_Action_UpdateAction);
1480 DoMethod(nch->nch_A_TarVarOpObj, MUIM_Notify, MUIA_Cycle_Active, MUIV_EveryTime,
1481 nch->nch_ActionObj, 1, MUIM_Action_UpdateAction);
1482 DoMethod(nch->nch_A_OutOpObj, MUIM_Notify, MUIA_Cycle_Active, MUIV_EveryTime,
1483 nch->nch_ActionObj, 1, MUIM_Action_UpdateAction);
1484 DoMethod(nch->nch_A_OutArrayObj, MUIM_Notify, MUIA_String_Contents, MUIV_EveryTime,
1485 nch->nch_ActionObj, 1, MUIM_Action_UpdateAction);
1486 DoMethod(nch->nch_A_OutItemLVObj, MUIM_Notify, MUIA_List_Active, MUIV_EveryTime,
1487 nch->nch_ActionObj, 1, MUIM_Action_UpdateAction);
1488 DoMethod(nch->nch_A_FeatOpObj, MUIM_Notify, MUIA_Cycle_Active, MUIV_EveryTime,
1489 nch->nch_ActionObj, 1, MUIM_Action_UpdateAction);
1490 DoMethod(nch->nch_A_FeatArrayObj, MUIM_Notify, MUIA_String_Contents, MUIV_EveryTime,
1491 nch->nch_ActionObj, 1, MUIM_Action_UpdateAction);
1492 DoMethod(nch->nch_A_FeatItemLVObj, MUIM_Notify, MUIA_List_Active, MUIV_EveryTime,
1493 nch->nch_ActionObj, 1, MUIM_Action_UpdateAction);
1494 DoMethod(nch->nch_A_ExtRawKeyObj, MUIM_Notify, MUIA_List_Active, MUIV_EveryTime,
1495 nch->nch_ActionObj, 1, MUIM_Action_UpdateAction);
1496 DoMethod(nch->nch_A_ExtRawKeyUpObj, MUIM_Notify, MUIA_Selected, MUIV_EveryTime,
1497 nch->nch_ActionObj, 1, MUIM_Action_UpdateAction);
1499 if(nch->nch_Interface)
1501 struct NepHidCollection *nhc;
1502 struct NepHidReport *nhr = (struct NepHidReport *) nch->nch_HidReports.lh_Head;
1503 struct NepHidItem *nhi;
1504 struct NepHidGItem *nhgi;
1505 Object *outobj;
1507 nch->nch_GUICurrentColl = NULL;
1508 while(nhr->nhr_Node.ln_Succ)
1510 nhc = (struct NepHidCollection *) nhr->nhr_Collections.lh_Head;
1511 while(nhc->nhc_Node.ln_Succ)
1513 if(nhc->nhc_Items.lh_Head->ln_Succ)
1515 DoMethod(nch->nch_ReportLVObj, MUIM_List_InsertSingle, nhc, MUIV_List_Insert_Bottom);
1516 if(!nch->nch_GUICurrentColl)
1518 nch->nch_GUICurrentColl = nhc;
1519 set(nch->nch_ReportLVObj, MUIA_List_Active, MUIV_List_Active_Top);
1522 nhi = (struct NepHidItem *) nhc->nhc_Items.lh_Head;
1523 while(nhi->nhi_Node.ln_Succ)
1525 if(nhi->nhi_Type == REPORT_MAIN_OUTPUT)
1527 outobj = nch->nch_A_OutItemLVObj;
1529 else if(nhi->nhi_Type == REPORT_MAIN_FEATURE)
1531 outobj = nch->nch_A_FeatItemLVObj;
1532 } else {
1533 outobj = NULL;
1535 if(outobj)
1537 if(nhi->nhi_Flags & RPF_MAIN_VARIABLE)
1539 if((nhgi = nAllocGOutItem(nch, nhi, &nhi->nhi_ActionList, nhi->nhi_Usage)))
1541 DoMethod(outobj, MUIM_List_InsertSingle, nhgi, MUIV_List_Insert_Bottom);
1543 } else {
1544 STRPTR newstr;
1545 //ULONG acount;
1546 //if(nhi->nhi_SameUsages)
1548 if((nhgi = nAllocGOutItem(nch, nhi, &nhi->nhi_ActionList, nhi->nhi_Usage)))
1550 if((newstr = psdCopyStrFmt("%s Array [%ld]", nhgi->nhgi_Name, nhi->nhi_Count)))
1552 psdFreeVec(nhgi->nhgi_Name);
1553 nhgi->nhgi_Name = newstr;
1555 DoMethod(outobj, MUIM_List_InsertSingle, nhgi, MUIV_List_Insert_Bottom);
1558 #if 0
1559 else {
1560 acount = 0;
1563 if((nhgi = nAllocGOutItem(nch, nhi, &nhi->nhi_ActionMap[acount], nhi->nhi_UsageMap[acount])))
1565 if((newstr = psdCopyStrFmt(" +%s", nhgi->nhgi_Name)))
1567 psdFreeVec(nhgi->nhgi_Name);
1568 nhgi->nhgi_Name = newstr;
1571 DoMethod(outobj, MUIM_List_InsertSingle, nhgi, MUIV_List_Insert_Bottom);
1573 } while(++acount < (nhi->nhi_LogicalMax-nhi->nhi_LogicalMin+1));
1575 #endif
1578 nhi = (struct NepHidItem *) nhi->nhi_Node.ln_Succ;
1580 nhc = (struct NepHidCollection *) nhc->nhc_Node.ln_Succ;
1582 nhr = (struct NepHidReport *) nhr->nhr_Node.ln_Succ;
1587 IPTR isopen = 0;
1588 IPTR iconify = 0;
1589 ULONG sigs;
1590 ULONG sigmask;
1591 LONG retid;
1593 get(nch->nch_App, MUIA_Application_Iconified, &iconify);
1594 set(nch->nch_MainWindow, MUIA_Window_Open, TRUE);
1595 get(nch->nch_MainWindow, MUIA_Window_Open, &isopen);
1596 if(!(isopen || iconify))
1598 GM_UNIQUENAME(nGUITaskCleanup)(nch);
1599 return;
1601 nch->nch_TrackingSignal = AllocSignal(-1);
1602 sigmask = (1<<nch->nch_TrackingSignal);
1605 retid = DoMethod(nch->nch_App, MUIM_Application_NewInput, &sigs);
1606 if(sigs)
1608 sigs = Wait(sigs | sigmask | SIGBREAKF_CTRL_C);
1609 if(nch->nch_TrackEvents && (sigs & sigmask))
1611 BOOL track;
1612 ULONG count;
1613 struct NepHidItem *titem;
1614 struct List *talist;
1615 struct NepHidCollection *nhc;
1616 struct NepHidGItem *nhgi;
1618 talist = nch->nch_LastItemAList;
1619 if((titem = nch->nch_LastItem))
1621 track = TRUE;
1622 if(nch->nch_GUICurrentItem)
1624 if(nch->nch_GUICurrentItem->nhgi_ActionList == talist)
1626 track = FALSE;
1629 if(track)
1631 if(nch->nch_GUICurrentColl == titem->nhi_Collection)
1633 /* Already the right collection, find item */
1634 count = 0;
1635 nhgi = NULL;
1638 DoMethod(nch->nch_ItemLVObj, MUIM_List_GetEntry, count, &nhgi);
1639 if(!nhgi)
1641 break;
1643 if(nhgi->nhgi_ActionList == talist)
1645 /* Heureka! */
1646 set(nch->nch_ItemLVObj, MUIA_List_Active, count);
1647 DoMethod(nch->nch_ItemLVObj, MUIM_List_Jump, count);
1648 nch->nch_LastItemAList = NULL;
1649 nch->nch_LastItem = NULL;
1650 break;
1652 count++;
1653 } while(TRUE);
1654 } else {
1655 /* Find collection */
1656 count = 0;
1657 nhc = NULL;
1660 DoMethod(nch->nch_ReportLVObj, MUIM_List_GetEntry, count, &nhc);
1661 if(!nhc)
1663 break;
1665 if(nhc == titem->nhi_Collection)
1667 /* Heureka! */
1668 set(nch->nch_ReportLVObj, MUIA_List_Active, count);
1669 DoMethod(nch->nch_ReportLVObj, MUIM_List_Jump, count);
1670 break;
1672 count++;
1673 } while(TRUE);
1678 if(nch->nch_TrackKeyEvents && (sigs & sigmask))
1680 if((nch->nch_CurrUSBKey != nch->nch_LastUSBKey) && nch->nch_LastUSBKey)
1682 hum = (struct HidUsageIDMap *) hidusage07;
1683 count = 0;
1684 while(hum->hum_String)
1686 if(hum->hum_ID == (nch->nch_LastUSBKey & 0xffff))
1688 set(nch->nch_USBKeymapLVObj, MUIA_List_Active, count);
1689 break;
1691 hum++;
1692 count++;
1694 nch->nch_CurrUSBKey = nch->nch_LastUSBKey;
1698 if(nch->nch_ReportValues && (sigs & sigmask) && nch->nch_ItemChanged)
1700 DoMethod(nch->nch_ItemLVObj, MUIM_List_Redraw, MUIV_List_Redraw_Active);
1701 nch->nch_ItemChanged = FALSE;
1704 if(sigs & SIGBREAKF_CTRL_C)
1706 break;
1709 } while((!nch->nch_QuitGUI) && (retid != MUIV_Application_ReturnID_Quit));
1710 FreeSignal(nch->nch_TrackingSignal);
1711 nch->nch_TrackingSignal = -1;
1712 set(nch->nch_MainWindow, MUIA_Window_Open, FALSE);
1714 GM_UNIQUENAME(nGUITaskCleanup)(nch);
1716 AROS_USERFUNC_EXIT
1718 /* \\\ */
1720 /* /// "nGUITaskCleanup()" */
1721 void GM_UNIQUENAME(nGUITaskCleanup)(struct NepClassHid *nch)
1723 UWORD count;
1724 struct NepHidGItem *nhgi;
1726 if(nch->nch_App)
1728 MUI_DisposeObject(nch->nch_App);
1729 nch->nch_App = NULL;
1732 for(count = 0; count < 128; count++)
1734 psdFreeVec(nch->nch_RawKeyArray[count]);
1735 nch->nch_RawKeyArray[count] = NULL;
1736 psdFreeVec(nch->nch_ExtRawKeyArray[count]);
1737 nch->nch_ExtRawKeyArray[count] = NULL;
1739 nhgi = (struct NepHidGItem *) nch->nch_GUIItems.lh_Head;
1740 while(nhgi->nhgi_Node.ln_Succ)
1742 nFreeGItem(nch, nhgi);
1743 nhgi = (struct NepHidGItem *) nch->nch_GUIItems.lh_Head;
1745 nhgi = (struct NepHidGItem *) nch->nch_GUIOutItems.lh_Head;
1746 while(nhgi->nhgi_Node.ln_Succ)
1748 nFreeGItem(nch, nhgi);
1749 nhgi = (struct NepHidGItem *) nch->nch_GUIOutItems.lh_Head;
1751 if(nch->nch_ActionClass)
1753 MUI_DeleteCustomClass(nch->nch_ActionClass);
1754 nch->nch_ActionClass = NULL;
1757 if(MUIMasterBase)
1759 CloseLibrary(MUIMasterBase);
1760 MUIMasterBase = NULL;
1762 if(IntuitionBase)
1764 CloseLibrary(IntuitionBase);
1765 IntuitionBase = NULL;
1767 if(KeymapBase)
1769 CloseLibrary(KeymapBase);
1770 KeymapBase = NULL;
1772 if(ps)
1774 CloseLibrary(ps);
1775 ps = NULL;
1777 Forbid();
1778 nch->nch_GUITask = NULL;
1779 if(nch->nch_ReadySigTask)
1781 Signal(nch->nch_ReadySigTask, 1L<<nch->nch_ReadySignal);
1783 --nch->nch_ClsBase->nh_Library.lib_OpenCnt;
1785 /* \\\ */
1787 /* /// "nAllocGItem()" */
1788 struct NepHidGItem * nAllocGItem(struct NepClassHid *nch, struct NepHidItem *nhi, struct List *actionlist, ULONG usageid)
1790 struct NepHidGItem *nhgi;
1792 if(!(nhgi = psdAllocVec(sizeof(struct NepHidGItem))))
1794 return(NULL);
1796 nhgi->nhgi_Item = nhi;
1797 nhgi->nhgi_ActionList = actionlist;
1798 if(usageid)
1800 nhgi->nhgi_Name = nGetUsageName(nch, usageid);
1802 AddTail(&nch->nch_GUIItems, &nhgi->nhgi_Node);
1803 return(nhgi);
1805 /* \\\ */
1807 /* /// "nAllocGOutItem()" */
1808 struct NepHidGItem * nAllocGOutItem(struct NepClassHid *nch, struct NepHidItem *nhi, struct List *actionlist, ULONG usageid)
1810 struct NepHidGItem *nhgi;
1812 if(!(nhgi = psdAllocVec(sizeof(struct NepHidGItem))))
1814 return(NULL);
1816 nhgi->nhgi_Item = nhi;
1817 nhgi->nhgi_ActionList = actionlist;
1818 if(usageid)
1820 nhgi->nhgi_Name = nGetUsageName(nch, usageid);
1822 AddTail(&nch->nch_GUIOutItems, &nhgi->nhgi_Node);
1823 return(nhgi);
1825 /* \\\ */
1827 /* /// "nFreeGItem()" */
1828 void nFreeGItem(struct NepClassHid *nch, struct NepHidGItem *nhgi)
1830 if(nhgi)
1832 Remove(&nhgi->nhgi_Node);
1833 psdFreeVec(nhgi->nhgi_Name);
1834 psdFreeVec(nhgi);
1837 /* \\\ */
1839 /* /// "USBKeyListDisplayHook()" */
1840 AROS_UFH3(LONG, GM_UNIQUENAME(USBKeyListDisplayHook),
1841 AROS_UFHA(struct Hook *, hook, A0),
1842 AROS_UFHA(char **, strarr, A2),
1843 AROS_UFHA(struct HidUsageIDMap *, hum, A1))
1845 AROS_USERFUNC_INIT
1847 if(hum)
1849 *strarr = hum->hum_String;
1850 } else {
1851 *strarr = "\33l\33uHID Key name";
1853 return(0);
1855 AROS_USERFUNC_EXIT
1857 /* \\\ */
1859 /* /// "ReportListDisplayHook()" */
1860 AROS_UFH3(LONG, GM_UNIQUENAME(ReportListDisplayHook),
1861 AROS_UFHA(struct Hook *, hook, A0),
1862 AROS_UFHA(char **, strarr, A2),
1863 AROS_UFHA(struct NepHidCollection *, nhc, A1))
1865 AROS_USERFUNC_INIT
1867 struct NepClassHid *nch = (struct NepClassHid *) hook->h_Data;
1869 if(nhc)
1871 if(!nhc->nhc_Parent)
1873 *strarr = nhc->nhc_Name;
1874 } else {
1875 STRPTR srcptr;
1876 STRPTR tarptr;
1877 *strarr = tarptr = nch->nch_TmpStrBufReport;
1878 srcptr = nhc->nhc_Name;
1879 while((*tarptr++ = *srcptr++));
1880 while((nhc = nhc->nhc_Parent))
1882 tarptr[-1] = ' ';
1883 *tarptr++ = '(';
1884 srcptr = nhc->nhc_Name;
1885 while((*tarptr++ = *srcptr++));
1886 tarptr[-1] = ')';
1887 *tarptr++ = 0;
1890 } else {
1891 *strarr = "\33l\33uName";
1893 return(0);
1895 AROS_USERFUNC_EXIT
1897 /* \\\ */
1899 /* /// "ItemListDisplayHook()" */
1900 AROS_UFH3(LONG, GM_UNIQUENAME(ItemListDisplayHook),
1901 AROS_UFHA(struct Hook *, hook, A0),
1902 AROS_UFHA(char **, strarr, A2),
1903 AROS_UFHA(struct NepHidGItem *, nhgi, A1))
1905 AROS_USERFUNC_INIT
1907 struct NepClassHid *nch = (struct NepClassHid *) hook->h_Data;
1908 struct NepHidItem *nhi;
1909 STRPTR buf;
1910 ULONG flags;
1911 if(nhgi)
1913 nhi = nhgi->nhgi_Item;
1914 psdSafeRawDoFmt(nch->nch_TmpStrBufItem, 10, "%ld", nhi->nhi_LogicalMin);
1915 psdSafeRawDoFmt(&nch->nch_TmpStrBufItem[10], 10, "%ld", nhi->nhi_LogicalMax);
1916 buf = &nch->nch_TmpStrBufItem[30];
1917 flags = nhi->nhi_Flags;
1918 if(flags & RPF_MAIN_CONST)
1920 strcpy(buf, "const ");
1921 buf += 6;
1923 if(!(flags & RPF_MAIN_NONLINEAR))
1925 strcpy(buf, "lin. ");
1926 buf += 5;
1928 if(flags & RPF_MAIN_RELATIVE)
1930 strcpy(buf, "rel. ");
1931 buf += 5;
1932 } else {
1933 strcpy(buf, "abs. ");
1934 buf += 5;
1936 *strarr++ = nhgi->nhgi_Name;
1937 if(flags & RPF_MAIN_VARIABLE)
1939 strcpy(buf, "var. ");
1940 buf += 5;
1941 psdSafeRawDoFmt(&nch->nch_TmpStrBufItem[20], 10, "%ld", nhi->nhi_OldValue);
1942 *strarr++ = &nch->nch_TmpStrBufItem[20];
1943 } else {
1944 strcpy(buf, "array ");
1945 buf += 6;
1946 *strarr++ = "n/a";
1948 if(flags & RPF_MAIN_CONST)
1950 strcpy(buf, "const ");
1951 buf += 6;
1953 if(flags & RPF_MAIN_WRAP)
1955 strcpy(buf, "wrap ");
1956 buf += 5;
1958 if(flags & RPF_MAIN_NOPREF)
1960 strcpy(buf, "nopref. ");
1961 buf += 8;
1963 if(flags & RPF_MAIN_NULLSTATE)
1965 strcpy(buf, "null ");
1966 buf += 5;
1968 if(flags & RPF_MAIN_VOLATILE)
1970 strcpy(buf, "vola. ");
1971 buf += 6;
1973 if(flags & RPF_MAIN_BUFBYTES)
1975 strcpy(buf, "bufbytes");
1976 } else {
1977 strcpy(buf, "bitfield");
1979 *strarr++ = nch->nch_TmpStrBufItem;
1980 *strarr++ = &nch->nch_TmpStrBufItem[10];
1981 *strarr = &nch->nch_TmpStrBufItem[30];
1982 } else {
1983 *strarr++ = "\33l\33uName";
1984 *strarr++ = "\33l\33uVal";
1985 *strarr++ = "\33l\33uMin";
1986 *strarr++ = "\33l\33uMax";
1987 *strarr = "\33l\33uType";
1990 return(0);
1992 AROS_USERFUNC_EXIT
1994 /* \\\ */
1996 /* /// "ActionListDisplayHook()" */
1997 AROS_UFH3(LONG, GM_UNIQUENAME(ActionListDisplayHook),
1998 AROS_UFHA(struct Hook *, hook, A0),
1999 AROS_UFHA(char **, strarr, A2),
2000 AROS_UFHA(struct NepHidAction *, nha, A1))
2002 AROS_USERFUNC_INIT
2004 struct NepClassHid *nch = (struct NepClassHid *) hook->h_Data;
2005 STRPTR p1str, p2str;
2007 if(nha)
2009 *strarr++ = ActionTypeStrings[nha->nha_Type & HUA_ATYPEMASK];
2010 switch(nha->nha_Type & HUA_TRIGMASK)
2012 case HUA_DOWNEVENT:
2013 *strarr++ = "Down";
2014 break;
2015 case HUA_UPEVENT:
2016 *strarr++ = "Up";
2017 break;
2018 case HUA_ANY:
2019 *strarr++ = "Any";
2020 break;
2021 case HUA_ALWAYS:
2022 *strarr++ = "Always";
2023 break;
2024 case HUA_NAN:
2025 *strarr++ = "NaN";
2026 break;
2027 default:
2028 *strarr++ = "???";
2031 *strarr = "???";
2033 switch(nha->nha_Type & HUA_ATYPEMASK)
2035 case HUA_NOP:
2036 case HUA_KEYMAP:
2037 *strarr = "None";
2038 break;
2040 case HUA_QUALIFIER:
2041 p1str = "???";
2042 switch(nha->nha_QualMode)
2044 case HUAT_SET:
2045 p1str = "Set";
2046 break;
2047 case HUAT_CLEAR:
2048 p1str = "Clear";
2049 break;
2050 case HUAT_TOGGLE:
2051 p1str = "Toggle";
2052 break;
2053 case HUAT_ASSIGN:
2054 p1str = "Assign";
2055 break;
2058 psdSafeRawDoFmt(nch->nch_TmpStrBufAction, 80, "%s %s", p1str, A_QualifierStrings[nha->nha_Qualifier]);
2059 *strarr = nch->nch_TmpStrBufAction;
2060 break;
2062 case HUA_MOUSEPOS:
2063 switch(nha->nha_MouseAxis)
2065 case HUAT_DELTAX:
2066 *strarr = "Delta X";
2067 break;
2069 case HUAT_DELTAY:
2070 *strarr = "Delta Y";
2071 break;
2073 case HUAT_ABSX:
2074 *strarr = "Absolute X";
2075 break;
2077 case HUAT_ABSY:
2078 *strarr = "Absolute Y";
2079 break;
2081 break;
2083 case HUA_BUTTONS:
2084 p1str = "???";
2085 switch(nha->nha_ButtonMode)
2087 case HUAT_SET:
2088 p1str = "Press";
2089 break;
2090 case HUAT_CLEAR:
2091 p1str = "Release";
2092 break;
2093 case HUAT_TOGGLE:
2094 p1str = "Flip";
2095 break;
2096 case HUAT_ASSIGN:
2097 p1str = "Assign";
2098 break;
2100 p2str = "???";
2101 switch(nha->nha_ButtonNo)
2103 case 1:
2104 p2str = "left mouse button";
2105 break;
2107 case 2:
2108 p2str = "right mouse button";
2109 break;
2111 case 3:
2112 p2str = "middle mouse button";
2113 break;
2115 case 4:
2116 p2str = "fourth mouse button";
2117 break;
2119 case 5:
2120 p2str = "fifth mouse button";
2121 break;
2123 psdSafeRawDoFmt(*strarr = nch->nch_TmpStrBufAction, 80, "%s %s", p1str, p2str);
2124 break;
2126 case HUA_WHEEL:
2127 switch(nha->nha_WheelMode)
2129 case HUAT_DELTAX:
2130 *strarr = "Wheel horizontal";
2131 break;
2133 case HUAT_DELTAY:
2134 *strarr = "Wheel vertical";
2135 break;
2137 case HUAT_LEFT:
2138 *strarr = "Wheel left";
2139 break;
2141 case HUAT_RIGHT:
2142 *strarr = "Wheel right";
2143 break;
2145 case HUAT_UP:
2146 *strarr = "Wheel up";
2147 break;
2149 case HUAT_DOWN:
2150 *strarr = "Wheel down";
2151 break;
2153 break;
2155 case HUA_DIGJOY:
2156 p1str = A_JoypadOpStrings[nRevLookup(nha->nha_JoypadOp, 0, A_JoypadOpVals)];
2157 p2str = A_JoypadFeatStrings[nRevLookup(nha->nha_JoypadFeat, 0, A_JoypadFeatVals)];
2158 psdSafeRawDoFmt(*strarr = nch->nch_TmpStrBufAction, 80, "%s %s (port %ld)", p1str, p2str, (ULONG) nha->nha_JoypadPort);
2159 break;
2161 case HUA_ANALOGJOY:
2162 p1str = A_APadFeatStrings[nRevLookup(nha->nha_APadFeat, 0, A_APadFeatVals)];
2163 psdSafeRawDoFmt(*strarr = nch->nch_TmpStrBufAction, 80, "Set %s (port %ld)", p1str, (ULONG) nha->nha_JoypadPort);
2164 break;
2166 case HUA_TABLET:
2167 switch(nha->nha_TabletAxis)
2169 case HUAT_PRESSURE:
2170 *strarr = "Pressure";
2171 break;
2173 case HUAT_XROT:
2174 *strarr = "X rotation";
2175 break;
2177 case HUAT_YROT:
2178 *strarr = "Y rotation";
2179 break;
2181 case HUAT_ZROT:
2182 *strarr = "Z rotation";
2183 break;
2185 case HUAT_PROX:
2186 *strarr = "In proximity";
2187 break;
2189 case HUAT_ABSZ:
2190 *strarr = "Z position";
2192 break;
2194 case HUA_RAWKEY:
2195 psdSafeRawDoFmt(*strarr = nch->nch_TmpStrBufAction, 80, "%s %s",
2196 (nha->nha_RawKey & IECODE_UP_PREFIX) ? "keyup" : "keydown",
2197 nch->nch_RawKeyArray[nha->nha_RawKey & (~IECODE_UP_PREFIX)]);
2198 break;
2200 case HUA_SOUND:
2201 *strarr = p1str = nha->nha_SoundFile;
2202 while(*p1str)
2204 if(*p1str++ == '/')
2206 *strarr = p1str;
2209 break;
2211 case HUA_VANILLA:
2212 *strarr = nha->nha_VanillaString;
2213 break;
2215 case HUA_KEYSTRING:
2216 *strarr = nha->nha_KeyString;
2217 break;
2219 case HUA_SHELL:
2220 *strarr = nha->nha_ExeString;
2221 break;
2223 case HUA_OUTPUT:
2225 struct NepHidItem *nhi;
2226 ULONG dummy;
2227 BOOL freeit = FALSE;
2229 p1str = A_OutOpStrings[nRevLookup(nha->nha_OutOp, 0, A_OutOpVals)];
2230 p2str = "???";
2231 if((nhi = nFindItemID(nch, nha->nha_OutItem, REPORT_MAIN_OUTPUT, &dummy)))
2233 p2str = nGetUsageName(nch, nhi->nhi_Usage);
2234 freeit = TRUE;
2235 if(!(nhi->nhi_Flags & RPF_MAIN_VARIABLE))
2237 p1str = nha->nha_OutArray;
2240 psdSafeRawDoFmt(*strarr = nch->nch_TmpStrBufAction, 80, "%s %s", p1str, p2str);
2241 if(freeit)
2243 psdFreeVec(p2str);
2245 break;
2248 case HUA_FEATURE:
2250 struct NepHidItem *nhi;
2251 ULONG dummy;
2252 BOOL freeit = FALSE;
2254 p1str = A_OutOpStrings[nRevLookup(nha->nha_FeatOp, 0, A_OutOpVals)];
2255 p2str = "???";
2256 if((nhi = nFindItemID(nch, nha->nha_FeatItem, REPORT_MAIN_FEATURE, &dummy)))
2258 p2str = nGetUsageName(nch, nhi->nhi_Usage);
2259 freeit = TRUE;
2260 if(!(nhi->nhi_Flags & RPF_MAIN_VARIABLE))
2262 p1str = nha->nha_OutArray;
2265 psdSafeRawDoFmt(*strarr = nch->nch_TmpStrBufAction, 80, "%s %s", p1str, p2str);
2266 if(freeit)
2268 psdFreeVec(p2str);
2270 break;
2273 case HUA_MISC:
2274 *strarr = A_MiscOpStrings[nRevLookup(nha->nha_MiscMode, 0, A_MiscOpVals)];
2275 break;
2277 case HUA_VARIABLES:
2278 p1str = A_TarVariableStrings[nRevLookup(nha->nha_TarVar, 0, A_TarVariableVals)];
2279 p2str = A_TarVarOpStrings[nRevLookup(nha->nha_TarVarOp, 0, A_TarVarOpVals)];
2280 psdSafeRawDoFmt(*strarr = nch->nch_TmpStrBufAction, 80, "%s %s", p1str, p2str);
2281 break;
2283 case HUA_EXTRAWKEY:
2284 psdSafeRawDoFmt(*strarr = nch->nch_TmpStrBufAction, 80, "%s %s",
2285 (nha->nha_RawKey & IECODE_UP_PREFIX) ? "keyup" : "keydown",
2286 nch->nch_ExtRawKeyArray[nha->nha_RawKey & (~IECODE_UP_PREFIX)]);
2287 break;
2290 } else {
2291 *strarr++ = "\33l\33uType";
2292 *strarr++ = "\33l\33uTrigger";
2293 *strarr = "\33l\33uParams";
2295 return(0);
2297 AROS_USERFUNC_EXIT
2299 /* \\\ */
2301 /* /// "ActionDispatcher()" */
2302 AROS_UFH3(IPTR, GM_UNIQUENAME(ActionDispatcher),
2303 AROS_UFHA(struct IClass *, cl, A0),
2304 AROS_UFHA(Object *, obj, A2),
2305 AROS_UFHA(Msg, msg, A1))
2307 AROS_USERFUNC_INIT
2309 struct ActionData *ad = (struct ActionData *) 0xABADCAFE;
2310 struct NepClassHid *nch = NULL;
2311 struct HidUsageIDMap *hum;
2312 ULONG tmpval;
2313 STRPTR tmpstr;
2314 ULONG count;
2316 if(msg->MethodID != OM_NEW)
2318 ad = INST_DATA(cl, obj);
2319 nch = ad->ad_NCH;
2321 switch(msg->MethodID)
2323 case OM_NEW:
2324 if(!(obj = (Object *) DoSuperMethodA(cl,obj,msg)))
2326 return(0);
2328 return (IPTR)obj;
2330 case MUIM_Action_UseConfig:
2331 case MUIM_Action_DefaultConfig:
2332 case MUIM_Action_StoreConfig:
2334 struct PsdIFFContext *pic;
2335 struct PsdIFFContext *rppic;
2336 struct NepHidReport *nhr;
2337 struct NepHidCollection *nhc;
2338 struct NepHidItem *nhi;
2339 struct List *alistptr;
2340 ULONG *usageptr;
2341 ULONG count;
2342 ULONG newform[3];
2344 DoMethod(nch->nch_ActionObj, MUIM_Action_UpdateDevPrefs);
2345 DoMethod(nch->nch_ActionObj, MUIM_Action_UpdateAction);
2346 DoMethod(nch->nch_ActionObj, MUIM_Action_UpdateAOptions);
2348 if(msg->MethodID == MUIM_Action_DefaultConfig)
2350 pic = psdGetClsCfg(GM_UNIQUENAME(libname));
2351 if(!pic)
2353 psdSetClsCfg(GM_UNIQUENAME(libname), NULL);
2354 pic = psdGetClsCfg(GM_UNIQUENAME(libname));
2356 if(pic)
2358 psdAddCfgEntry(pic, nch->nch_CDC);
2359 psdAddCfgEntry(pic, &nch->nch_KeymapCfg);
2360 psdSaveCfgToDisk(NULL, FALSE);
2363 if(nch->nch_Interface)
2365 pic = psdGetUsbDevCfg(GM_UNIQUENAME(libname), nch->nch_DevIDString, nch->nch_IfIDString);
2366 if(!pic)
2368 psdSetUsbDevCfg(GM_UNIQUENAME(libname), nch->nch_DevIDString, nch->nch_IfIDString, NULL);
2369 pic = psdGetUsbDevCfg(GM_UNIQUENAME(libname), nch->nch_DevIDString, nch->nch_IfIDString);
2371 if(pic)
2373 psdAddCfgEntry(pic, nch->nch_CDC);
2374 if(memcmp(&nch->nch_KeymapCfg, &nch->nch_ClsBase->nh_DummyNCH.nch_KeymapCfg, sizeof(struct KeymapCfg)))
2376 psdAddCfgEntry(pic, &nch->nch_KeymapCfg);
2377 } else {
2378 psdRemCfgChunk(pic, AROS_LONG2BE(nch->nch_KeymapCfg.kmc_ChunkID));
2381 /* Create config file */
2382 newform[0] = AROS_LONG2BE(ID_FORM);
2383 newform[1] = AROS_LONG2BE(4);
2384 nhr = (struct NepHidReport *) nch->nch_HidReports.lh_Head;
2385 while(nhr->nhr_Node.ln_Succ)
2387 if(nhr->nhr_ReportID == 0xffff)
2389 newform[2] = AROS_LONG2BE(MAKE_ID('X','R','P','T'));
2391 else if(nhr->nhr_ReportID == 0xfffe)
2393 newform[2] = AROS_LONG2BE(MAKE_ID('W','C','O','M'));
2394 } else {
2395 newform[2] = AROS_LONG2BE(MAKE_ID('R','P','T','0')+nhr->nhr_ReportID);
2398 rppic = psdFindCfgForm(pic, AROS_LONG2BE(newform[2]));
2399 if(!rppic)
2401 rppic = psdAddCfgEntry(pic, newform);
2402 if(!rppic)
2404 break;
2406 } else {
2407 psdRemCfgChunk(rppic, 0);
2410 /* find out, if we can get rid of defaults before saving */
2411 nhc = (struct NepHidCollection *) nhr->nhr_Collections.lh_Head;
2412 while(nhc->nhc_Node.ln_Succ)
2414 nhi = (struct NepHidItem *) nhc->nhc_Items.lh_Head;
2415 while(nhi->nhi_Node.ln_Succ)
2417 if(nhi->nhi_Flags & RPF_MAIN_VARIABLE)
2419 usageptr = &nhi->nhi_Usage;
2420 alistptr = &nhi->nhi_ActionList;
2421 count = 1;
2422 } else {
2423 usageptr = nhi->nhi_UsageMap;
2424 alistptr = nhi->nhi_ActionMap;
2425 count = nhi->nhi_MapSize;
2429 nCheckForDefaultAction(nch, nhi, alistptr++, nhc, *usageptr++);
2430 } while(--count);
2431 nhi = (struct NepHidItem *) nhi->nhi_Node.ln_Succ;
2433 nhc = (struct NepHidCollection *) nhc->nhc_Node.ln_Succ;
2436 nhc = (struct NepHidCollection *) nhr->nhr_Collections.lh_Head;
2437 while(nhc->nhc_Node.ln_Succ)
2439 nhi = (struct NepHidItem *) nhc->nhc_Items.lh_Head;
2440 while(nhi->nhi_Node.ln_Succ)
2442 nSaveItem(nch, rppic, &nhi->nhi_ActionList, nhr->nhr_ItemIDBase);
2443 if((alistptr = nhi->nhi_ActionMap))
2445 count = nhi->nhi_MapSize;
2448 nSaveItem(nch, rppic, alistptr++, nhr->nhr_ItemIDBase);
2449 } while(--count);
2451 nhi = (struct NepHidItem *) nhi->nhi_Node.ln_Succ;
2453 nhc = (struct NepHidCollection *) nhc->nhc_Node.ln_Succ;
2455 nhr = (struct NepHidReport *) nhr->nhr_Node.ln_Succ;
2457 if(msg->MethodID != MUIM_Action_UseConfig)
2459 psdSaveCfgToDisk(NULL, FALSE);
2461 nch->nch_QuitGUI = TRUE;
2463 } else {
2464 nch->nch_QuitGUI = TRUE;
2466 return(TRUE);
2469 case MUIM_Action_About:
2470 MUI_RequestA(nch->nch_App, nch->nch_MainWindow, 0, NULL, "Blimey!", VERSION_STRING, NULL);
2471 return(TRUE);
2473 case MUIM_Action_UpdateDevPrefs:
2475 CONST_STRPTR tmpstr;
2476 tmpstr = "";
2477 get(nch->nch_ConWindowObj, MUIA_String_Contents, &tmpstr);
2478 strncpy(nch->nch_CDC->cdc_ShellCon, tmpstr, 127);
2480 get(nch->nch_EnableKBResetObj, MUIA_Selected, &nch->nch_CDC->cdc_EnableKBReset);
2481 get(nch->nch_EnableRHObj, MUIA_Selected, &nch->nch_CDC->cdc_EnableRH);
2482 get(nch->nch_ResetDelayObj, MUIA_Numeric_Value, &nch->nch_CDC->cdc_ResetDelay);
2483 get(nch->nch_ShellStackObj, MUIA_String_Integer, &nch->nch_CDC->cdc_ShellStack);
2484 get(nch->nch_TurboMouseObj, MUIA_Cycle_Active, &nch->nch_CDC->cdc_TurboMouse);
2486 get(nch->nch_HIDCtrlAutoObj, MUIA_Selected, &nch->nch_CDC->cdc_HIDCtrlOpen);
2487 tmpstr = "";
2488 get(nch->nch_HIDCtrlRexxObj, MUIA_String_Contents, &tmpstr);
2489 strncpy(nch->nch_CDC->cdc_HIDCtrlRexx, tmpstr, 31);
2490 tmpstr = "";
2491 get(nch->nch_HIDCtrlTitleObj, MUIA_String_Contents, &tmpstr);
2492 strncpy(nch->nch_CDC->cdc_HIDCtrlTitle, tmpstr, 31);
2494 for(count = 0; count < 4; count++)
2496 get(nch->nch_LLPortModeObj[count], MUIA_Cycle_Active, &nch->nch_CDC->cdc_LLPortMode[count]);
2498 get(nch->nch_LLRumblePortObj, MUIA_Cycle_Active, &nch->nch_CDC->cdc_LLRumblePort);
2500 if(nch->nch_EPInPipe)
2502 psdSetAttrs(PGA_PIPE, nch->nch_EPInPipe,
2503 PPA_Interval, nch->nch_CDC->cdc_TurboMouse ? 1<<nch->nch_CDC->cdc_TurboMouse : nch->nch_EPInInterval,
2504 TAG_END);
2507 return(TRUE);
2510 case MUIM_Action_SelectReport:
2512 struct NepHidGItem *nhgi = NULL;
2513 struct NepHidItem *nhi = NULL;
2514 ULONG acount;
2515 STRPTR newstr;
2516 STRPTR idstr1, idstr2;
2517 ULONG pos;
2518 ULONG jumppos = 0;
2520 nch->nch_SilentActionUpdate = TRUE;
2521 DoMethod(nch->nch_ReportLVObj, MUIM_List_GetEntry, MUIV_List_GetEntry_Active, &nch->nch_GUICurrentColl);
2522 set(nch->nch_ItemLVObj, MUIA_List_Quiet, TRUE);
2523 DoMethod(nch->nch_ItemLVObj, MUIM_List_Clear);
2524 nhgi = (struct NepHidGItem *) nch->nch_GUIItems.lh_Head;
2525 while(nhgi->nhgi_Node.ln_Succ)
2527 nFreeGItem(nch, nhgi);
2528 nhgi = (struct NepHidGItem *) nch->nch_GUIItems.lh_Head;
2530 nch->nch_GUICurrentItem = NULL;
2531 if(nch->nch_GUICurrentColl)
2533 pos = 0;
2534 nhi = (struct NepHidItem *) nch->nch_GUICurrentColl->nhc_Items.lh_Head;
2535 while(nhi->nhi_Node.ln_Succ)
2537 if(nhi->nhi_Type == REPORT_MAIN_INPUT)
2539 if(nhi->nhi_Flags & RPF_MAIN_VARIABLE)
2541 if((nhgi = nAllocGItem(nch, nhi, &nhi->nhi_ActionList, nhi->nhi_Usage)))
2543 DoMethod(nch->nch_ItemLVObj, MUIM_List_InsertSingle, nhgi, MUIV_List_Insert_Bottom);
2544 if((!nch->nch_GUICurrentItem) ||
2545 (nch->nch_TrackEvents && (nhgi->nhgi_ActionList == nch->nch_LastItemAList)))
2547 nch->nch_GUICurrentItem = nhgi;
2548 jumppos = pos;
2550 pos++;
2552 } else {
2553 if((nhgi = nAllocGItem(nch, nhi, &nhi->nhi_ActionList, 0)))
2555 idstr1 = nGetUsageName(nch, nhi->nhi_UsageMap[0]);
2556 if(nhi->nhi_SameUsages)
2558 nhgi->nhgi_Name = psdCopyStrFmt("%s Array", idstr1);
2559 } else {
2560 idstr2 = nGetUsageName(nch, nhi->nhi_UsageMap[nhi->nhi_LogicalMax-nhi->nhi_LogicalMin]);
2561 nhgi->nhgi_Name = psdCopyStrFmt("Default for %s->%s", idstr1, idstr2);
2562 psdFreeVec(idstr2);
2564 psdFreeVec(idstr1);
2565 DoMethod(nch->nch_ItemLVObj, MUIM_List_InsertSingle, nhgi, MUIV_List_Insert_Bottom);
2566 if((!nch->nch_GUICurrentItem) ||
2567 (nch->nch_TrackEvents && (nhgi->nhgi_ActionList == nch->nch_LastItemAList)))
2569 nch->nch_GUICurrentItem = nhgi;
2570 jumppos = pos;
2572 pos++;
2574 if(!nhi->nhi_SameUsages)
2576 acount = 0;
2579 if((nhgi = nAllocGItem(nch, nhi, &nhi->nhi_ActionMap[acount], nhi->nhi_UsageMap[acount])))
2581 if((newstr = psdCopyStrFmt(" +%s", nhgi->nhgi_Name)))
2583 psdFreeVec(nhgi->nhgi_Name);
2584 nhgi->nhgi_Name = newstr;
2587 DoMethod(nch->nch_ItemLVObj, MUIM_List_InsertSingle, nhgi, MUIV_List_Insert_Bottom);
2588 if((!nch->nch_GUICurrentItem) ||
2589 (nch->nch_TrackEvents && (nhgi->nhgi_ActionList == nch->nch_LastItemAList)))
2591 nch->nch_GUICurrentItem = nhgi;
2592 jumppos = pos;
2594 pos++;
2596 } while(++acount < (nhi->nhi_LogicalMax-nhi->nhi_LogicalMin+1));
2600 nhi = (struct NepHidItem *) nhi->nhi_Node.ln_Succ;
2602 set(nch->nch_FillDefObj, MUIA_Disabled, FALSE);
2603 set(nch->nch_ClearActionsObj, MUIA_Disabled, FALSE);
2604 set(nch->nch_ItemLVObj, MUIA_Disabled, FALSE);
2605 set(nch->nch_ItemLVObj, MUIA_List_Quiet, FALSE);
2606 nch->nch_SilentActionUpdate = FALSE;
2607 set(nch->nch_ItemLVObj, MUIA_List_Active, jumppos);
2608 DoMethod(nch->nch_ItemLVObj, MUIM_List_Jump, jumppos);
2609 } else {
2610 set(nch->nch_FillDefObj, MUIA_Disabled, TRUE);
2611 set(nch->nch_ClearActionsObj, MUIA_Disabled, TRUE);
2612 nch->nch_SilentActionUpdate = FALSE;
2613 set(nch->nch_ItemLVObj, MUIA_Disabled, TRUE);
2614 set(nch->nch_ItemLVObj, MUIA_List_Quiet, FALSE);
2616 if(!nch->nch_GUICurrentAction)
2618 DoMethod(nch->nch_ActionObj, MUIM_Action_SelectAction);
2620 return(TRUE);
2623 case MUIM_Action_DebugReport:
2624 if(nch->nch_GUICurrentColl)
2626 nDebugReport(nch, nch->nch_GUICurrentColl->nhc_Report);
2628 return(TRUE);
2630 case MUIM_Action_SelectItem:
2632 struct NepHidGItem *nhgi;
2633 struct NepHidAction *nha;
2635 nch->nch_SilentActionUpdate = TRUE;
2636 DoMethod(nch->nch_ItemLVObj, MUIM_List_GetEntry, MUIV_List_GetEntry_Active, &nch->nch_GUICurrentItem);
2637 set(nch->nch_ActionLVObj, MUIA_List_Quiet, TRUE);
2638 DoMethod(nch->nch_ActionLVObj, MUIM_List_Clear);
2639 nch->nch_GUICurrentAction = NULL;
2640 nch->nch_SilentActionUpdate = FALSE;
2641 if((nhgi = nch->nch_GUICurrentItem))
2643 nha = (struct NepHidAction *) nhgi->nhgi_ActionList->lh_Head;
2644 while(nha->nha_Node.ln_Succ)
2646 DoMethod(nch->nch_ActionLVObj, MUIM_List_InsertSingle, nha, MUIV_List_Insert_Bottom);
2647 if(!nch->nch_GUICurrentAction)
2649 nch->nch_GUICurrentAction = nha;
2650 set(nch->nch_ActionLVObj, MUIA_List_Active, MUIV_List_Active_Top);
2652 nha = (struct NepHidAction *) nha->nha_Node.ln_Succ;
2654 set(nch->nch_ActionLVObj, MUIA_Disabled, FALSE);
2655 set(nch->nch_ActionNewObj, MUIA_Disabled, FALSE);
2656 //set(nch->nch_ActionLVObj, MUIA_List_Active, MUIV_List_Active_Off);
2657 } else {
2658 set(nch->nch_ActionLVObj, MUIA_Disabled, TRUE);
2659 set(nch->nch_ActionNewObj, MUIA_Disabled, TRUE);
2660 set(nch->nch_ActionCopyObj, MUIA_Disabled, TRUE);
2661 set(nch->nch_ActionDelObj, MUIA_Disabled, TRUE);
2662 set(nch->nch_ActionUpObj, MUIA_Disabled, TRUE);
2663 set(nch->nch_ActionDownObj, MUIA_Disabled, TRUE);
2665 if(!nch->nch_GUICurrentAction)
2667 DoMethod(nch->nch_ActionObj, MUIM_Action_SelectAction);
2669 set(nch->nch_ActionLVObj, MUIA_List_Quiet, FALSE);
2671 return(TRUE);
2674 case MUIM_Action_SelectAction:
2676 struct NepHidAction *nha;
2677 if(!nch->nch_SilentActionUpdate)
2679 DoMethod(nch->nch_ActionLVObj, MUIM_List_GetEntry, MUIV_List_GetEntry_Active, &nch->nch_GUICurrentAction);
2680 if((nha = nch->nch_GUICurrentAction))
2682 set(nch->nch_ActionSelectorObj, MUIA_Cycle_Active, nha->nha_Type & HUA_ATYPEMASK);
2683 set(nch->nch_ActionAreaObj, MUIA_Disabled, FALSE);
2684 set(nch->nch_ActionCopyObj, MUIA_Disabled, FALSE);
2685 set(nch->nch_ActionDelObj, MUIA_Disabled, FALSE);
2686 set(nch->nch_ActionUpObj, MUIA_Disabled, FALSE);
2687 set(nch->nch_ActionDownObj, MUIA_Disabled, FALSE);
2688 DoMethod(nch->nch_ActionObj, MUIM_Action_SetActionType);
2689 } else {
2690 set(nch->nch_ActionAreaObj, MUIA_Disabled, TRUE);
2691 set(nch->nch_ActionCopyObj, MUIA_Disabled, TRUE);
2692 set(nch->nch_ActionDelObj, MUIA_Disabled, TRUE);
2693 set(nch->nch_ActionUpObj, MUIA_Disabled, TRUE);
2694 set(nch->nch_ActionDownObj, MUIA_Disabled, TRUE);
2697 return(TRUE);
2700 case MUIM_Action_FillDefReport:
2702 struct NepHidItem *nhi;
2703 struct NepHidCollection *nhc;
2704 ULONG count;
2705 struct List *alistptr;
2706 ULONG *usageptr;
2708 DoMethod(nch->nch_ReportLVObj, MUIM_List_GetEntry, MUIV_List_GetEntry_Active, &nhc);
2709 if(nhc)
2711 if(MUI_Request(nch->nch_App, nch->nch_MainWindow, 0, NULL, "Fill with default|Cancel",
2712 "Warning! This operation will erase\n"
2713 "all of the actions defined for\n"
2714 "the selected collection '%s'\n"
2715 "replace it with default values.", nhc->nhc_Name))
2717 DoMethod(nch->nch_ActionLVObj, MUIM_List_Clear);
2718 Forbid();
2719 nCleanCollection(nch, nhc);
2720 nhi = (struct NepHidItem *) nhc->nhc_Items.lh_Head;
2721 while(nhi->nhi_Node.ln_Succ)
2723 if(nhi->nhi_Flags & RPF_MAIN_VARIABLE)
2725 usageptr = &nhi->nhi_Usage;
2726 alistptr = &nhi->nhi_ActionList;
2727 count = 1;
2728 } else {
2729 usageptr = nhi->nhi_UsageMap;
2730 alistptr = nhi->nhi_ActionMap;
2731 count = nhi->nhi_MapSize;
2735 nDetectDefaultAction(nch, nhi, alistptr++, nhc, *usageptr++);
2736 } while(--count);
2737 nhi = (struct NepHidItem *) nhi->nhi_Node.ln_Succ;
2739 Permit();
2740 nch->nch_GUICurrentAction = NULL;
2741 set(nch->nch_ItemLVObj, MUIA_List_Active, MUIV_List_Active_Off);
2742 set(nch->nch_ItemLVObj, MUIA_List_Active, MUIV_List_Active_Top);
2745 return(TRUE);
2748 case MUIM_Action_SwapLMBRMB:
2749 case MUIM_Action_SetJoyPort:
2751 struct NepHidItem *nhi;
2752 struct NepHidCollection *nhc;
2753 struct NepHidAction *nha;
2754 ULONG count;
2755 struct List *alistptr;
2757 DoMethod(nch->nch_ReportLVObj, MUIM_List_GetEntry, MUIV_List_GetEntry_Active, &nhc);
2758 if(nhc)
2760 nhi = (struct NepHidItem *) nhc->nhc_Items.lh_Head;
2761 while(nhi->nhi_Node.ln_Succ)
2763 if(nhi->nhi_Flags & RPF_MAIN_VARIABLE)
2765 alistptr = &nhi->nhi_ActionList;
2766 count = 1;
2767 } else {
2768 alistptr = nhi->nhi_ActionMap;
2769 count = nhi->nhi_MapSize;
2773 nha = (struct NepHidAction *) alistptr->lh_Head;
2774 while(nha->nha_Node.ln_Succ)
2776 if(msg->MethodID == MUIM_Action_SwapLMBRMB)
2778 if(nha->nha_ButtonNo == 1)
2780 nha->nha_ButtonNo = 2;
2782 else if(nha->nha_ButtonNo == 2)
2784 nha->nha_ButtonNo = 1;
2786 } else {
2787 if(((nha->nha_Type & HUA_ATYPEMASK) == HUA_DIGJOY) ||
2788 ((nha->nha_Type & HUA_ATYPEMASK) == HUA_ANALOGJOY))
2790 nha->nha_JoypadPort = (IPTR)((struct opSet *) msg)->ops_AttrList;
2793 nha = (struct NepHidAction *) nha->nha_Node.ln_Succ;
2795 alistptr++;
2796 } while(--count);
2797 nhi = (struct NepHidItem *) nhi->nhi_Node.ln_Succ;
2799 DoMethod(nch->nch_ActionObj, MUIM_Action_SelectItem);
2802 return(TRUE);
2805 case MUIM_Action_ClearReport:
2807 struct NepHidCollection *nhc;
2809 DoMethod(nch->nch_ReportLVObj, MUIM_List_GetEntry, MUIV_List_GetEntry_Active, &nhc);
2810 if(nhc)
2812 if(MUI_Request(nch->nch_App, nch->nch_MainWindow, 0, NULL, "Clear|Cancel",
2813 "Warning! This operation will erase\n"
2814 "all of the actions defined for\n"
2815 "the selected collection '%s'\n"
2816 "replace them with default values.", nhc->nhc_Name))
2818 DoMethod(nch->nch_ActionLVObj, MUIM_List_Clear);
2819 Forbid();
2820 nCleanCollection(nch, nhc);
2821 Permit();
2822 nch->nch_GUICurrentAction = NULL;
2823 set(nch->nch_ItemLVObj, MUIA_List_Active, MUIV_List_Active_Off);
2824 set(nch->nch_ItemLVObj, MUIA_List_Active, MUIV_List_Active_Top);
2827 return(TRUE);
2830 case MUIM_Action_SetTracking:
2832 ULONG state = 0;
2833 get(nch->nch_TrackKeyEventsObj, MUIA_Selected, &state);
2834 nch->nch_TrackKeyEvents = state;
2835 get(nch->nch_TrackEventsObj, MUIA_Selected, &state);
2836 nch->nch_TrackEvents = state;
2837 get(nch->nch_ReportValuesObj, MUIA_Selected, &state);
2838 nch->nch_ReportValues = state;
2839 get(nch->nch_DisableActionsObj, MUIA_Selected, &state);
2840 nch->nch_DisableActions = state;
2841 return(TRUE);
2844 case MUIM_Action_NewAction:
2846 struct NepHidAction *nha;
2847 if(nch->nch_GUICurrentItem)
2849 Forbid();
2850 nha = nAllocAction(nch, nch->nch_GUICurrentItem->nhgi_ActionList, HUA_NOP|HUA_DOWNEVENT);
2851 Permit();
2852 if(nha)
2854 DoMethod(nch->nch_ActionLVObj, MUIM_List_InsertSingle, nha, MUIV_List_Insert_Bottom);
2855 set(nch->nch_ActionLVObj, MUIA_List_Active, MUIV_List_Active_Bottom);
2858 return(TRUE);
2861 case MUIM_Action_CopyAction:
2863 struct NepHidAction *nha;
2864 struct NepHidAction *newnha;
2865 DoMethod(nch->nch_ActionLVObj, MUIM_List_GetEntry, MUIV_List_GetEntry_Active, &nch->nch_GUICurrentAction);
2866 if((nha = nch->nch_GUICurrentAction))
2868 newnha = psdAllocVec(sizeof(struct NepHidAction));
2869 if(newnha)
2871 *newnha = *nha;
2872 Forbid();
2873 AddTail(nch->nch_GUICurrentItem->nhgi_ActionList, &newnha->nha_Node);
2874 Permit();
2875 DoMethod(nch->nch_ActionLVObj, MUIM_List_InsertSingle, newnha, MUIV_List_Insert_Bottom);
2876 set(nch->nch_ActionLVObj, MUIA_List_Active, MUIV_List_Active_Bottom);
2879 return(TRUE);
2882 case MUIM_Action_DelAction:
2884 struct NepHidAction *nha;
2885 DoMethod(nch->nch_ActionLVObj, MUIM_List_GetEntry, MUIV_List_GetEntry_Active, &nch->nch_GUICurrentAction);
2886 if((nha = nch->nch_GUICurrentAction))
2888 nch->nch_GUICurrentAction = NULL;
2889 DoMethod(nch->nch_ActionLVObj, MUIM_List_Remove, MUIV_List_Remove_Active);
2890 Forbid();
2891 Remove(&nha->nha_Node);
2892 psdFreeVec(nha);
2893 Permit();
2895 return(TRUE);
2898 case MUIM_Action_MoveActionUp:
2900 struct Node *nha;
2901 struct Node *nhapred;
2902 struct Node *nhapredpred;
2903 struct Node *nhasucc;
2904 DoMethod(nch->nch_ActionLVObj, MUIM_List_GetEntry, MUIV_List_GetEntry_Active, &nha);
2905 if(nha)
2907 nhasucc = nha->ln_Succ;
2908 nhapred = nha->ln_Pred;
2909 if((nhapredpred = nhapred->ln_Pred))
2911 Forbid();
2912 nhapredpred->ln_Succ = nha;
2913 nha->ln_Pred = nhapredpred;
2914 nha->ln_Succ = nhapred;
2915 nhapred->ln_Pred = nha;
2916 nhapred->ln_Succ = nhasucc;
2917 nhasucc->ln_Pred = nhapred;
2918 Permit();
2919 DoMethod(nch->nch_ActionLVObj, MUIM_List_Move, MUIV_List_Move_Active, MUIV_List_Move_Previous);
2920 set(nch->nch_ActionLVObj, MUIA_List_Active, MUIV_List_Active_Up);
2923 return(TRUE);
2926 case MUIM_Action_MoveActionDown:
2928 struct Node *nha;
2929 struct Node *nhapred;
2930 struct Node *nhasucc;
2931 struct Node *nhasuccsucc;
2932 DoMethod(nch->nch_ActionLVObj, MUIM_List_GetEntry, MUIV_List_GetEntry_Active, &nha);
2933 if(nha)
2935 nhasucc = nha->ln_Succ;
2936 nhapred = nha->ln_Pred;
2937 if((nhasuccsucc = nhasucc->ln_Succ))
2939 Forbid();
2940 nhapred->ln_Succ = nhasucc;
2941 nhasucc->ln_Pred = nhapred;
2942 nhasucc->ln_Succ = nha;
2943 nha->ln_Pred = nhasucc;
2944 nha->ln_Succ = nhasuccsucc;
2945 nhasuccsucc->ln_Pred = nha;
2946 Permit();
2947 DoMethod(nch->nch_ActionLVObj, MUIM_List_Move, MUIV_List_Move_Active, MUIV_List_Move_Next);
2948 set(nch->nch_ActionLVObj, MUIA_List_Active, MUIV_List_Active_Down);
2951 return(TRUE);
2954 case MUIM_Action_SetActionType:
2956 struct NepHidAction *nha;
2957 if((nha = nch->nch_GUICurrentAction))
2959 tmpval = 0;
2960 get(nch->nch_ActionSelectorObj, MUIA_Cycle_Active, &tmpval);
2961 if(tmpval != (nha->nha_Type & HUA_ATYPEMASK))
2963 nha->nha_IsDefault = FALSE;
2965 nha->nha_Type = (nha->nha_Type & HUA_TRIGMASK) | tmpval;
2966 nnset(nch->nch_ActionTriggerObj, MUIA_Cycle_Active, nRevLookup(nha->nha_Type & HUA_TRIGMASK, 0, ActionTriggerVals));
2968 nnset(nch->nch_ActionAbsToRelObj, MUIA_Selected, nha->nha_AbsToRel);
2969 nnset(nch->nch_ActionClipEnableObj, MUIA_Selected, nha->nha_ClipEnable);
2970 nnset(nch->nch_A_ClipMinObj, MUIA_Numeric_Value, nha->nha_ClipMin);
2971 nnset(nch->nch_A_ClipMaxObj, MUIA_Numeric_Value, nha->nha_ClipMax);
2972 nnset(nch->nch_A_ClipStretchObj, MUIA_Selected, nha->nha_ClipStretch);
2974 nnset(nch->nch_ActionScaleEnableObj, MUIA_Selected, nha->nha_ScaleEnable);
2975 psdSafeRawDoFmt(nch->nch_TmpStrBuf0, 80, "%ld", nha->nha_ScaleMin);
2976 nnset(nch->nch_A_ScaleMinObj, MUIA_String_Contents, nch->nch_TmpStrBuf0);
2977 psdSafeRawDoFmt(nch->nch_TmpStrBuf0, 80, "%ld", nha->nha_ScaleMax);
2978 nnset(nch->nch_A_ScaleMaxObj, MUIA_String_Contents, nch->nch_TmpStrBuf0);
2980 nnset(nch->nch_ActionCCEnableObj, MUIA_Selected, nha->nha_CCEnable);
2981 nnset(nch->nch_A_CCVar1Obj, MUIA_Cycle_Active, nRevLookup(nha->nha_CCVar1, 0, A_CCVariableVals));
2982 nnset(nch->nch_A_CCCondObj, MUIA_Cycle_Active, nRevLookup(nha->nha_CCCond, 0, A_CCCondVals));
2983 nnset(nch->nch_A_CCVar2Obj, MUIA_Cycle_Active, nRevLookup(nha->nha_CCVar2, 0, A_CCVariableVals));
2984 psdSafeRawDoFmt(nch->nch_TmpStrBuf0, 80, "%ld", nha->nha_CCConst1);
2985 nnset(nch->nch_A_CCConst1Obj, MUIA_String_Contents, nch->nch_TmpStrBuf0);
2986 psdSafeRawDoFmt(nch->nch_TmpStrBuf0, 80, "%ld", nha->nha_CCConst2);
2987 nnset(nch->nch_A_CCConst2Obj, MUIA_String_Contents, nch->nch_TmpStrBuf0);
2989 nnset(nch->nch_ActionValEnableObj, MUIA_Selected, nha->nha_ValEnable);
2990 nnset(nch->nch_A_ValVarObj, MUIA_Cycle_Active, nRevLookup(nha->nha_ValVar, 0, A_CCVariableVals));
2991 psdSafeRawDoFmt(nch->nch_TmpStrBuf0, 80, "%ld", nha->nha_ValConst);
2992 nnset(nch->nch_A_ValConstObj, MUIA_String_Contents, nch->nch_TmpStrBuf0);
2994 nnset(nch->nch_A_ClipGroupObj, MUIA_ShowMe, nha->nha_ClipEnable);
2995 nnset(nch->nch_A_ScaleGroupObj, MUIA_ShowMe, nha->nha_ScaleEnable);
2996 nnset(nch->nch_A_CCGroupObj, MUIA_ShowMe, nha->nha_CCEnable);
2997 nnset(nch->nch_A_ValGroupObj, MUIA_ShowMe, nha->nha_ValEnable);
2999 nnset(nch->nch_A_KeyQualOpObj, MUIA_Cycle_Active, nRevLookup(nha->nha_QualMode, 0, A_QualOpVals));
3000 nnset(nch->nch_A_KeyQualObj, MUIA_Cycle_Active, nha->nha_Qualifier);
3001 nnset(nch->nch_A_RawKeyUpObj, MUIA_Selected, nha->nha_RawKey & IECODE_UP_PREFIX);
3002 nnset(nch->nch_A_RawKeyObj, MUIA_List_Active, nha->nha_RawKey & (~IECODE_UP_PREFIX));
3003 nnset(nch->nch_A_VanillaStrObj, MUIA_String_Contents, nha->nha_VanillaString);
3004 nnset(nch->nch_A_KeyStringObj, MUIA_String_Contents, nha->nha_KeyString);
3005 nnset(nch->nch_A_MousePosOpObj, MUIA_Cycle_Active, nRevLookup(nha->nha_MouseAxis, 0, A_MousePosOpVals));
3006 nnset(nch->nch_A_MouseButOpObj, MUIA_Cycle_Active, nRevLookup(nha->nha_ButtonMode, 0, A_MouseButOpVals));
3007 nnset(nch->nch_A_MouseButObj, MUIA_Cycle_Active, nha->nha_ButtonNo ? nha->nha_ButtonNo-1 : 0);
3008 nnset(nch->nch_A_TabletAxisObj, MUIA_Cycle_Active, nRevLookup(nha->nha_TabletAxis, 0, A_TabletAxisVals));
3009 nnset(nch->nch_A_WheelOpObj, MUIA_Cycle_Active, nRevLookup(nha->nha_WheelMode, 0, A_WheelOpVals));
3010 nnset(nch->nch_A_WheelDistObj, MUIA_Numeric_Value, nha->nha_WheelDist);
3011 nnset(nch->nch_A_JoypadOpObj, MUIA_Cycle_Active, nRevLookup(nha->nha_JoypadOp, 0, A_JoypadOpVals));
3012 nnset(nch->nch_A_JoypadFeatObj, MUIA_Cycle_Active, nRevLookup(nha->nha_JoypadFeat, 0, A_JoypadFeatVals));
3013 nnset(nch->nch_A_JoypadPortObj, MUIA_Cycle_Active, nha->nha_JoypadPort);
3014 nnset(nch->nch_A_APadFeatObj, MUIA_Cycle_Active, nRevLookup(nha->nha_APadFeat, 0, A_APadFeatVals));
3015 nnset(nch->nch_A_APadPortObj, MUIA_Cycle_Active, nha->nha_JoypadPort);
3016 nnset(nch->nch_A_SoundFileObj, MUIA_String_Contents, nha->nha_SoundFile);
3017 nnset(nch->nch_A_SoundVolObj, MUIA_Numeric_Value, nha->nha_SoundVolume);
3018 nnset(nch->nch_A_ShellComObj, MUIA_String_Contents, nha->nha_ExeString);
3019 nnset(nch->nch_A_ShellAsyncObj, MUIA_Selected, nha->nha_ShellAsync);
3020 nnset(nch->nch_A_OutOpObj, MUIA_Cycle_Active, nRevLookup(nha->nha_OutOp, 0, A_OutOpVals));
3021 nnset(nch->nch_A_OutArrayObj, MUIA_String_Contents, nha->nha_OutArray);
3023 struct NepHidItem *nhi;
3024 struct NepHidGItem *nhgi;
3025 ULONG pos;
3026 if((nhi = nFindItemID(nch, nha->nha_OutItem, REPORT_MAIN_OUTPUT, &pos)))
3028 pos = 0;
3031 nhgi = NULL;
3032 DoMethod(nch->nch_A_OutItemLVObj, MUIM_List_GetEntry, pos, &nhgi);
3033 if(!nhgi)
3035 break;
3037 if(nhgi->nhgi_Item == nhi)
3039 nnset(nch->nch_A_OutItemLVObj, MUIA_List_Active, pos);
3040 break;
3042 pos++;
3044 while(TRUE);
3047 nnset(nch->nch_A_FeatOpObj, MUIA_Cycle_Active, nRevLookup(nha->nha_FeatOp, 0, A_OutOpVals));
3048 nnset(nch->nch_A_FeatArrayObj, MUIA_String_Contents, nha->nha_OutArray);
3050 struct NepHidItem *nhi;
3051 struct NepHidGItem *nhgi;
3052 ULONG pos;
3053 if((nhi = nFindItemID(nch, nha->nha_FeatItem, REPORT_MAIN_FEATURE, &pos)))
3055 pos = 0;
3058 nhgi = NULL;
3059 DoMethod(nch->nch_A_FeatItemLVObj, MUIM_List_GetEntry, pos, &nhgi);
3060 if(!nhgi)
3062 break;
3064 if(nhgi->nhgi_Item == nhi)
3066 nnset(nch->nch_A_FeatItemLVObj, MUIA_List_Active, pos);
3067 break;
3069 pos++;
3071 while(TRUE);
3074 nnset(nch->nch_A_MiscOpObj, MUIA_Cycle_Active, nRevLookup(nha->nha_MiscMode, 0, A_MiscOpVals));
3076 nnset(nch->nch_A_TarVarObj, MUIA_Cycle_Active, nRevLookup(nha->nha_TarVar, 0, A_TarVariableVals));
3077 nnset(nch->nch_A_TarVarOpObj, MUIA_Cycle_Active, nRevLookup(nha->nha_TarVarOp, 0, A_TarVarOpVals));
3079 nnset(nch->nch_A_ExtRawKeyUpObj, MUIA_Selected, nha->nha_RawKey & IECODE_UP_PREFIX);
3080 nnset(nch->nch_A_ExtRawKeyObj, MUIA_List_Active, nha->nha_RawKey & (~IECODE_UP_PREFIX));
3082 DoMethod(nch->nch_ActionObj, MUIM_Action_UpdateAction);
3083 DoMethod(nch->nch_ActionObj, MUIM_Action_UpdateAOptions);
3084 DoMethod(nch->nch_ActionLVObj, MUIM_List_Redraw, MUIV_List_Redraw_Active);
3086 return(TRUE);
3089 case MUIM_Action_UpdateAOptions:
3091 struct NepHidAction *nha;
3093 if((nha = nch->nch_GUICurrentAction))
3095 nha->nha_IsDefault = FALSE;
3096 tmpval = 0;
3097 get(nch->nch_ActionAbsToRelObj, MUIA_Selected, &tmpval);
3098 nha->nha_AbsToRel = tmpval;
3100 tmpval = 0;
3101 get(nch->nch_ActionClipEnableObj, MUIA_Selected, &tmpval);
3102 nha->nha_ClipEnable = tmpval;
3103 if(tmpval)
3105 tmpval = 0;
3106 get(nch->nch_A_ClipMinObj, MUIA_Numeric_Value, &tmpval);
3107 nha->nha_ClipMin = tmpval;
3108 tmpval = 0;
3109 get(nch->nch_A_ClipMaxObj, MUIA_Numeric_Value, &tmpval);
3110 nha->nha_ClipMax = tmpval;
3111 tmpval = 0;
3112 get(nch->nch_A_ClipStretchObj, MUIA_Selected, &tmpval);
3113 nha->nha_ClipStretch = tmpval;
3116 tmpval = 0;
3117 get(nch->nch_ActionScaleEnableObj, MUIA_Selected, &tmpval);
3118 nha->nha_ScaleEnable = tmpval;
3119 if(tmpval)
3121 tmpval = 0;
3122 get(nch->nch_A_ScaleMinObj, MUIA_String_Integer, &tmpval);
3123 nha->nha_ScaleMin = tmpval;
3124 tmpval = 0;
3125 get(nch->nch_A_ScaleMaxObj, MUIA_String_Integer, &tmpval);
3126 nha->nha_ScaleMax = tmpval;
3129 tmpval = 0;
3130 get(nch->nch_ActionCCEnableObj, MUIA_Selected, &tmpval);
3131 nha->nha_CCEnable = tmpval;
3132 if(tmpval)
3134 tmpval = 0;
3135 get(nch->nch_A_CCVar1Obj, MUIA_Cycle_Active, &tmpval);
3136 nha->nha_CCVar1 = A_CCVariableVals[tmpval];
3137 tmpval = 0;
3138 get(nch->nch_A_CCCondObj, MUIA_Cycle_Active, &tmpval);
3139 nha->nha_CCCond = A_CCCondVals[tmpval];
3140 tmpval = 0;
3141 get(nch->nch_A_CCVar2Obj, MUIA_Cycle_Active, &tmpval);
3142 nha->nha_CCVar2 = A_CCVariableVals[tmpval];
3143 tmpval = 0;
3144 get(nch->nch_A_CCConst1Obj, MUIA_String_Integer, &tmpval);
3145 nha->nha_CCConst1 = tmpval;
3146 tmpval = 0;
3147 get(nch->nch_A_CCConst2Obj, MUIA_String_Integer, &tmpval);
3148 nha->nha_CCConst2 = tmpval;
3151 tmpval = 0;
3152 get(nch->nch_ActionValEnableObj, MUIA_Selected, &tmpval);
3153 nha->nha_ValEnable = tmpval;
3154 if(tmpval)
3156 tmpval = 0;
3157 get(nch->nch_A_ValVarObj, MUIA_Cycle_Active, &tmpval);
3158 nha->nha_ValVar = A_CCVariableVals[tmpval];
3159 tmpval = 0;
3160 get(nch->nch_A_ValConstObj, MUIA_String_Integer, &tmpval);
3161 nha->nha_ValConst = tmpval;
3164 return(TRUE);
3167 case MUIM_Action_UpdateAction:
3169 struct NepHidAction *nha;
3170 struct NepHidGItem *nhgi;
3172 if((nha = nch->nch_GUICurrentAction))
3174 nha->nha_IsDefault = FALSE;
3175 tmpval = 0;
3176 get(nch->nch_ActionTriggerObj, MUIA_Cycle_Active, &tmpval);
3177 nha->nha_Type = (nha->nha_Type & HUA_ATYPEMASK) | ActionTriggerVals[tmpval];
3178 switch(nha->nha_Type & HUA_ATYPEMASK)
3180 case HUA_QUALIFIER:
3181 tmpval = 0;
3182 get(nch->nch_A_KeyQualOpObj, MUIA_Cycle_Active, &tmpval);
3183 nha->nha_QualMode = A_QualOpVals[tmpval];
3184 tmpval = 0;
3185 get(nch->nch_A_KeyQualObj, MUIA_Cycle_Active, &tmpval);
3186 nha->nha_Qualifier = tmpval;
3187 break;
3189 case HUA_RAWKEY:
3190 tmpval = 0;
3191 get(nch->nch_A_RawKeyUpObj, MUIA_Selected, &tmpval);
3192 if(tmpval)
3194 tmpval = 0;
3195 get(nch->nch_A_RawKeyObj, MUIA_List_Active, &tmpval);
3196 nha->nha_RawKey = tmpval|IECODE_UP_PREFIX;
3197 } else {
3198 tmpval = 0;
3199 get(nch->nch_A_RawKeyObj, MUIA_List_Active, &tmpval);
3200 nha->nha_RawKey = tmpval;
3202 break;
3204 case HUA_VANILLA:
3205 tmpstr = "";
3206 get(nch->nch_A_VanillaStrObj, MUIA_String_Contents, &tmpstr);
3207 strncpy(nha->nha_VanillaString, tmpstr, 79);
3208 break;
3210 case HUA_KEYSTRING:
3211 tmpstr = "";
3212 get(nch->nch_A_KeyStringObj, MUIA_String_Contents, &tmpstr);
3213 strncpy(nha->nha_KeyString, tmpstr, 79);
3214 break;
3216 case HUA_MOUSEPOS:
3217 tmpval = 0;
3218 get(nch->nch_A_MousePosOpObj, MUIA_Cycle_Active, &tmpval);
3219 nha->nha_MouseAxis = A_MousePosOpVals[tmpval];
3220 break;
3222 case HUA_BUTTONS:
3223 tmpval = 0;
3224 get(nch->nch_A_MouseButOpObj, MUIA_Cycle_Active, &tmpval);
3225 nha->nha_ButtonMode = A_MouseButOpVals[tmpval];
3226 tmpval = 0;
3227 get(nch->nch_A_MouseButObj, MUIA_Cycle_Active, &tmpval);
3228 nha->nha_ButtonNo = tmpval+1;
3229 break;
3231 case HUA_TABLET:
3232 tmpval = 0;
3233 get(nch->nch_A_TabletAxisObj, MUIA_Cycle_Active, &tmpval);
3234 nha->nha_TabletAxis = A_TabletAxisVals[tmpval];
3235 break;
3237 case HUA_WHEEL:
3238 tmpval = 0;
3239 get(nch->nch_A_WheelOpObj, MUIA_Cycle_Active, &tmpval);
3240 nha->nha_WheelMode = A_WheelOpVals[tmpval];
3241 tmpval = 0;
3242 get(nch->nch_A_WheelDistObj, MUIA_Numeric_Value, &tmpval);
3243 nha->nha_WheelDist = tmpval;
3244 break;
3246 case HUA_DIGJOY:
3247 tmpval = 0;
3248 get(nch->nch_A_JoypadOpObj, MUIA_Cycle_Active, &tmpval);
3249 nha->nha_JoypadOp = A_JoypadOpVals[tmpval];
3250 tmpval = 0;
3251 get(nch->nch_A_JoypadFeatObj, MUIA_Cycle_Active, &tmpval);
3252 nha->nha_JoypadFeat = A_JoypadFeatVals[tmpval];
3253 tmpval = 0;
3254 get(nch->nch_A_JoypadPortObj, MUIA_Cycle_Active, &tmpval);
3255 nha->nha_JoypadPort = tmpval;
3256 break;
3258 case HUA_ANALOGJOY:
3259 tmpval = 0;
3260 get(nch->nch_A_APadFeatObj, MUIA_Cycle_Active, &tmpval);
3261 nha->nha_APadFeat = A_APadFeatVals[tmpval];
3262 tmpval = 0;
3263 get(nch->nch_A_APadPortObj, MUIA_Cycle_Active, &tmpval);
3264 nha->nha_JoypadPort = tmpval;
3265 break;
3267 case HUA_SOUND:
3268 tmpstr = "";
3269 get(nch->nch_A_SoundFileObj, MUIA_String_Contents, &tmpstr);
3270 strncpy(nha->nha_SoundFile, tmpstr, 255);
3271 tmpval = 0;
3272 get(nch->nch_A_SoundVolObj, MUIA_Numeric_Value, &tmpval);
3273 nha->nha_SoundVolume = tmpval;
3274 break;
3276 case HUA_SHELL:
3277 tmpstr = "";
3278 get(nch->nch_A_ShellComObj, MUIA_String_Contents, &tmpstr);
3279 strncpy(nha->nha_ExeString, tmpstr, 79);
3280 tmpval = 0;
3281 get(nch->nch_A_ShellAsyncObj, MUIA_Selected, &tmpval);
3282 nha->nha_ShellAsync = tmpval;
3283 break;
3285 case HUA_OUTPUT:
3286 DoMethod(nch->nch_A_OutItemLVObj, MUIM_List_GetEntry, MUIV_List_GetEntry_Active, &nhgi);
3287 tmpval = 0;
3288 get(nch->nch_A_OutOpObj, MUIA_Cycle_Active, &tmpval);
3289 nha->nha_OutOp = A_OutOpVals[tmpval];
3290 tmpstr = "";
3291 get(nch->nch_A_OutArrayObj, MUIA_String_Contents, &tmpstr);
3292 strncpy(nha->nha_OutArray, tmpstr, 255);
3293 if(nhgi)
3295 nha->nha_OutItem = GET_WTYPE(nhgi->nhgi_ActionList);
3296 if(nhgi->nhgi_Item->nhi_Flags & RPF_MAIN_VARIABLE)
3298 set(nch->nch_A_OutArrayObj, MUIA_Disabled, TRUE);
3299 set(nch->nch_A_OutOpObj, MUIA_Disabled, FALSE);
3300 } else {
3301 set(nch->nch_A_OutArrayObj, MUIA_Disabled, FALSE);
3302 set(nch->nch_A_OutOpObj, MUIA_Disabled, TRUE);
3304 } else {
3305 nha->nha_OutItem = 0;
3307 break;
3309 case HUA_FEATURE:
3310 DoMethod(nch->nch_A_FeatItemLVObj, MUIM_List_GetEntry, MUIV_List_GetEntry_Active, &nhgi);
3311 tmpval = 0;
3312 get(nch->nch_A_FeatOpObj, MUIA_Cycle_Active, &tmpval);
3313 nha->nha_FeatOp = A_OutOpVals[tmpval];
3314 tmpstr = "";
3315 get(nch->nch_A_FeatArrayObj, MUIA_String_Contents, &tmpstr);
3316 strncpy(nha->nha_OutArray, tmpstr, 255);
3317 if(nhgi)
3319 nha->nha_FeatItem = GET_WTYPE(nhgi->nhgi_ActionList);
3320 } else {
3321 nha->nha_FeatItem = 0;
3323 break;
3325 case HUA_MISC:
3326 tmpval = 0;
3327 get(nch->nch_A_MiscOpObj, MUIA_Cycle_Active, &tmpval);
3328 nha->nha_MiscMode = A_MiscOpVals[tmpval];
3329 break;
3331 case HUA_VARIABLES:
3332 tmpval = 0;
3333 get(nch->nch_A_TarVarObj, MUIA_Cycle_Active, &tmpval);
3334 nha->nha_TarVar = A_TarVariableVals[tmpval];
3335 tmpval = 0;
3336 get(nch->nch_A_TarVarOpObj, MUIA_Cycle_Active, &tmpval);
3337 nha->nha_TarVarOp = A_TarVarOpVals[tmpval];
3338 break;
3340 case HUA_EXTRAWKEY:
3341 tmpval = 0;
3342 get(nch->nch_A_ExtRawKeyUpObj, MUIA_Selected, &tmpval);
3343 if(tmpval)
3345 tmpval = 0;
3346 get(nch->nch_A_ExtRawKeyObj, MUIA_List_Active, &tmpval);
3347 nha->nha_RawKey = tmpval|IECODE_UP_PREFIX;
3348 } else {
3349 tmpval = 0;
3350 get(nch->nch_A_ExtRawKeyObj, MUIA_List_Active, &tmpval);
3351 nha->nha_RawKey = tmpval;
3353 break;
3356 DoMethod(nch->nch_ActionLVObj, MUIM_List_Redraw, MUIV_List_Redraw_Active);
3358 return(TRUE);
3361 case MUIM_Action_KeymapSelectUSB:
3362 DoMethod(nch->nch_USBKeymapLVObj, MUIM_List_GetEntry, MUIV_List_GetEntry_Active, &hum);
3363 if(hum)
3365 nch->nch_CurrUSBKey = hum->hum_ID | 0x070000;
3366 set(nch->nch_RawKeymapLVObj, MUIA_List_Active, nch->nch_KeymapCfg.kmc_Keymap[hum->hum_ID]);
3368 return(TRUE);
3370 case MUIM_Action_KeymapSelectRaw:
3371 DoMethod(nch->nch_USBKeymapLVObj, MUIM_List_GetEntry, MUIV_List_GetEntry_Active, &hum);
3372 if(hum)
3374 tmpval = 0;
3375 get(nch->nch_RawKeymapLVObj, MUIA_List_Active, &tmpval);
3376 nch->nch_KeymapCfg.kmc_Keymap[hum->hum_ID] = tmpval;
3378 return(TRUE);
3380 case MUIM_Action_RestDefKeymap:
3381 CopyMemQuick(usbkeymap, nch->nch_KeymapCfg.kmc_Keymap, 256);
3382 DoMethod(nch->nch_USBKeymapLVObj, MUIM_List_GetEntry, MUIV_List_GetEntry_Active, &hum);
3383 if(hum)
3385 nch->nch_CurrUSBKey = hum->hum_ID | 0x070000;
3386 set(nch->nch_RawKeymapLVObj, MUIA_List_Active, nch->nch_KeymapCfg.kmc_Keymap[hum->hum_ID]);
3388 return(TRUE);
3390 case MUIM_Action_ShowHIDControl:
3391 Forbid();
3392 if(nch->nch_HCApp)
3394 DoMethod(nch->nch_HCApp, MUIM_Application_PushMethod,
3395 nch->nch_HCActionObj, 1, MUIM_Action_ShowHIDControl);
3397 Permit();
3398 return(TRUE);
3400 return(DoSuperMethodA(cl,obj,msg));
3402 AROS_USERFUNC_EXIT
3404 /* \\\ */