Added useful custom dimensions to some top-level drawers that lacked them.
[AROS.git] / rom / usb / trident / ActionClass.c
bloba4630553a6e398f09b3ba3a7b70e4258632b8689
1 /*****************************************************************************
2 ** This is the Action custom class, a sub class of Area.mui.
3 ******************************************************************************/
5 #include "debug.h"
7 #define USE_INLINE_STDARG
8 #define __NOLIBBASE__
9 #include <proto/muimaster.h>
10 #include <proto/exec.h>
11 #include <proto/dos.h>
12 #include <proto/poseidon.h>
13 #include <proto/intuition.h>
14 #include <proto/graphics.h>
15 #include <proto/usbclass.h>
16 #include <proto/icon.h>
17 #include <proto/utility.h>
19 #include "Trident.h"
20 #include "ActionClass.h"
21 #include "IconListClass.h"
22 #include "DevWinClass.h"
23 #include "CfgListClass.h"
24 #include "locale.h"
26 extern struct ExecBase *SysBase;
27 extern struct Library *ps;
28 extern struct IntuitionBase *IntuitionBase;
29 extern struct DosLibrary *DOSBase;
31 #define NewList(list) NEWLIST(list)
33 #define USE_NEPTUNE8_BODY
34 //#define USE_NEPTUNE8_HEADER
35 #define USE_NEPTUNE8_COLORS
36 #include "neptune8logo.c"
38 #define CLASSPATH "SYS:Classes/USB"
39 #define STACKLOADER "Sys/poseidon.prefs"
41 /* /// "Some strings" */
42 static STRPTR mainpanels[] =
44 NULL, //"General",
45 NULL,//"Controllers",
46 NULL, //"Devices",
47 NULL, //"Classes",
48 NULL, //"Options",
49 NULL, //"Popups",
50 NULL, //"Config",
51 NULL
54 static STRPTR errlvlstrings[] =
56 NULL, //"All messages",
57 NULL, //"Warnings and worse",
58 NULL, //"Errors and failures",
59 NULL, //"Failures only",
60 NULL
63 static STRPTR popupnewdevicestrings[] =
65 NULL, //"Never open a popup window! Bah!",
66 NULL, //"Only popup on an error condition",
67 NULL, //"Popup on new, unknown devices",
68 NULL, //"Popup, if there is no binding",
69 NULL, //"Popup, if there is no config yet",
70 NULL, //"Popup on configurable class",
71 NULL, //"Popup, regardless of binding",
72 NULL, //"Always immediately annoy me",
73 NULL
75 /* \\\ */
77 /* /// "Some lyrics" */
78 static char *aimeelyrics[] =
80 // 0
81 "\33l\33iIn our endeavor we are never seeing eye to eye\n"
82 "No guts to sever so forever may we wave goodbye\n"
83 "And you're always telling me that it's my turn to move\n"
84 "When I wonder what could make the needle jump the groove\n"
85 "I won't fall for the oldest trick in the book\n"
86 "So don't sit there and think you're off of the hook\n"
87 "By saying there is no use changing 'cause\n\n"
88 "That's just what you are\n"
89 "That's just what you are\n"
90 "\33r(Aimee Mann) ",
92 // 1
93 "\33l\33iI can't do it\n"
94 "I can't conceive\n"
95 "You're everything you're\n"
96 "Trying to make me believe\n"
97 "'Cause this show is\n"
98 "Too well designed\n"
99 "Too well to be held\n"
100 "With only me in mind\n\n"
101 "And how am I different?\n"
102 "How am I different?\n"
103 "How am I different?\n"
104 "\33r(Aimee Mann) ",
106 // 2
107 "\33l\33i'Cause I'll never prove that my\n"
108 "Motives were pure\n"
109 "So let's remove any question of cure\n"
110 "'Cause even though you've made it\n"
111 "Pretty obscure\n"
112 "Baby, it's clear, from here -\n"
113 "You're losing your atmosphere\n"
114 "From here, you're losing it\n"
115 "\33r(Aimee Mann) ",
117 // 3
118 "\33l\33iOh, for the sake of momentum\n"
119 "Even thought I agree with that stuff\n"
120 "About seizing the day\n"
121 "But I hate to think of effort expended\n"
122 "All those minutes and days and hours\n"
123 "I've have frittered away\n\n"
124 "And I know life is getting shorter\n"
125 "I can't bring myself to set the scene\n"
126 "Even when it's approaching torture\n"
127 "I've got my routine\n"
128 "\33r(Aimee Mann) ",
130 // 4
131 "\33l\33i'Cause nothing is good enough\n"
132 "For people like you\n"
133 "Who have to have someone\n"
134 "Take the fall\n"
135 "And something to sabotage -\n"
136 "Determined to lose it all\n\n"
137 "Ladies and gentlemen -\n"
138 "Here's exhibit A\n"
139 "Didn't I try again?\n"
140 "And did the effort pay?\n"
141 "Wouldn't a smarter man\n"
142 "Simply walk away?\n"
143 "\33r(Aimee Mann) ",
145 // 5
146 "\33l\33iIt's not\n"
147 "What you thought\n"
148 "When you first\n"
149 "Began it\n"
150 "You got\n"
151 "What you want\n"
152 "Now you can hardly\n"
153 "Stand it, though\n"
154 "But now you know\n"
155 "It's not going to stop\n"
156 "It's not going to stop\n"
157 "It's not going to stop\n"
158 "'Til you wise up\n"
159 "\33r(Aimee Mann) ",
161 // 6
162 "\33l\33iI don't know you from Adam, it could make my day\n"
163 "If you leave me a message I'll give it away\n"
164 "'Cause the most perfect strangers that you can talk to\n"
165 "Are the ones who pretend that you're not really you\n\n"
166 "And with any attempts here to play Frankenstein\n"
167 "Come with plenty of chances for changing your mind\n"
168 "When you're building your own creation\n"
169 "Nothing's better than real\n"
170 "Than a real imitation\n"
171 "\33r(Aimee Mann) ",
173 // 7
174 "\33l\33iOh, experience is cheap\n"
175 "If that's the company you keep\n"
176 "And before you know that it's free\n"
177 "You've had it\n\n"
178 "Like most amazing things\n"
179 "It's easy to miss and easy to mistake\n"
180 "For when things are really great\n"
181 "It just means everything's in its place\n"
182 "\33r(Aimee Mann) ",
184 // 8
185 "\33l\33iSo here I'm sitting in my car at the same old stoplight\n"
186 "I keep waiting for a change but I don't know what\n"
187 "So red turns into green turning into yellow\n"
188 "But I'm just frozen here on the same old spot\n"
189 "And all I have to do is just press the pedal\n"
190 "But I'm not\n"
191 "No, I'm not\n"
192 "\33r(Aimee Mann) ",
194 // 9
195 "\33l\33iSay you were split, you were split in fragments\n"
196 "And none of the pieces would talk to you\n"
197 "Wouldn't you want to be who you had been?\n"
198 "Well, baby I want that, too\n\n"
199 "So better take the keys and drive forever\n"
200 "Staying won't put these futures back together\n"
201 "All the perfect drugs and superheroes\n"
202 "wouldn't be enough to bring me up to zero\n"
203 "\33r(Aimee Mann) ",
205 // 10
206 "\33l\33iBut nobody wants to hear this tale\n"
207 "The plot is clichéd, the jokes are stale\n"
208 "And baby we've all heard it all before\n"
209 "Oh, I could get specific but\n"
210 "Nobody needs a catalog\n"
211 "With details of a love I can't sell anyone\n\n"
212 "And aside from that\n"
213 "This chain of reaction, baby, is losing a link\n"
214 "Thought I'd hope you'd know what\n"
215 "I tried to tell you and if you don't\n"
216 "I could draw you a picture in invisible ink\n"
217 "\33r(Aimee Mann) ",
219 // 11
220 "\33l\33iWell, she's the face\n"
221 "And I'm the double\n"
222 "Who keeps the pace\n"
223 "And clears the rubble\n"
224 "And, Lost In Space,\n"
225 "Fills up the bubble with air\n\n"
226 "By just pretending to care\n"
227 "Like I'm not even there\n"
228 "Gone, but I don't know where\n"
229 "\33r(Aimee Mann) ",
231 // 12
232 "\33l\33iOh Mario -- why if this is nothing\n"
233 "I'm finding it so hard to dismiss\n"
234 "If you're what I need,\n"
235 "Then only you can save me\n"
236 "So come on baby -- give me the fix\n"
237 "And let's just talk about it\n"
238 "I've got to talk about it\n\n"
239 "Because nobody knows\n"
240 "That's how I nearly fell\n"
241 "Trading clothes\n"
242 "And ringing Pavlov's bell\n"
243 "History shows --\n"
244 "Like it was show and tell\n"
245 "\33r(Aimee Mann) ",
247 // 13
248 "\33l\33iWe have crossed the rubicon\n"
249 "Our ship awash, our rudder gone\n"
250 "The rats have fled but I'm hanging on\n"
251 "Let me try, baby, try\n\n"
253 "Baby, please -- let me begin\n"
254 "Let me be your heroin\n"
255 "Hate the sinner but love the sin\n"
256 "Let me be your heroin\n"
257 "\33r(Aimee Mann) ",
259 // 14
260 "\33l\33iI was undecided like you\n"
261 "At first\n"
262 "But I could not stem the tide of overwhelm\n"
263 "And thirst\n"
264 "You try to keep it going, but a lot of avenues\n"
265 "Just aren't open to you\n"
266 "when you're real bad news\n\n"
267 "I've got love and anger\n"
268 "They come as a pair\n"
269 "You can take your chances\n"
270 "But buyer beware\n"
271 "And I won't\n"
272 "Make you feel bad\n"
273 "When I show you\n"
274 "This big ball of sad isn't\n"
275 "Worth even filling with air\n"
276 "\33r(Aimee Mann) ",
278 // 15
279 "\33l\33iThe moth don't care if the flame is real\n"
280 "'Cause moth and flame got a sweetheart deal\n"
281 "And nothing fuels a good flirtation\n"
282 "Like need and anger and desperation\n"
283 "No, the moth don't care if the flame is real\n"
284 "No, the moth don't care if the flame is real\n\n"
285 "So come on, let's go -- ready or not\n"
286 "'Cause there's a flame I know, hotter than hot\n"
287 "And with a fuse that's so thoroughly shot away\n"
288 "\33r(Aimee Mann) ",
290 // 16
291 "\33l\33iYou've gotta hope\n"
292 "That there's someone for you\n"
293 "As strange as you are\n"
294 "Who can cope\n"
295 "With the things that you do\n"
296 "Without trying too hard\n\n"
298 "'Cause you can bend the truth\n"
299 "'Till it's suiting you\n"
300 "These things that you're wrapping all around you\n"
301 "Never know what they will amount to\n"
302 "If you're life is just going on without you\n"
303 "It's the end of the things you know\n"
304 "Here we go\n"
305 "\33r(Jon Brion) ",
307 // 17
308 "\33l\33iNothing in this world is gonna hold me\n"
309 "No thugs in this road are gonna roll me\n"
310 "No fast talking girl is gonna slow me\n"
311 "Nothing's gonna stop me at all\n"
312 "I'm walking through walls\n\n"
314 "Some people complain\n"
315 "Yeah they caterwaul\n"
316 "I could do the same\n"
317 "But I'm walking through walls\n"
318 "\33r(Jon Brion) ",
320 // 18
321 "\33l\33iIt should be boredom by now\n"
322 "I know the tricks of the trade\n"
323 "But it goes on anyhow\n"
324 "Sometimes the answers are ready made\n\n"
326 "And I go for it every time\n"
327 "Just like a heavy drinker\n"
328 "I go for it every time\n"
329 "Hook, line and sinker\n"
330 "\33r(Jon Brion) ",
332 // 19
333 "\33l\33iIn my dream I'm often running\n"
334 "To a place that's out of view\n"
335 "Of every kind of memory\n"
336 "With strings that tie to you\n\n"
338 "And though a change has taken place\n"
339 "And I no longer do adore her\n"
340 "Still every God forsaken place\n"
341 "Is always right around the corner\n"
342 "\33r(Jon Brion) ",
344 // 20
345 "\33l\33iThings begin, things decay\n"
346 "And you've gotta find a way\n"
347 "To be ok\n"
348 "But it you want to spend the day\n"
349 "Wond'ring what it's all about\n"
350 "Go and knock yourself out\n"
351 "\33r(Jon Brion) ",
353 // 21
354 "\33l\33iThink your troubles are so serious\n"
355 "Well one day you'll be so long gone\n"
356 "Cause nothing ever lasts\n"
357 "It all gets torn to shreds\n"
358 "If something's ever lasting\n"
359 "It's over our heads\n"
360 "It's over our heads\n"
361 "\33r(Jon Brion) ",
363 // 22
364 "\33l\33iAnd why should I begin?\n"
365 "Cause there's a whirl pool\n"
366 "Of people who will stop\n"
367 "And they will tell you\n"
368 "The things that you will not\n"
369 "They roll their eyes and they call you crazy\n\n"
370 "But you get the feeling\n"
371 "That you get what it's about\n"
372 "It's just a feeling\n"
373 "You can't really spell it out\n"
374 "You get the feeling\n"
375 "That you get what it's about\n"
376 "\33r(Jon Brion) ",
378 // 23
379 "\33l\33iI don't wait by the phone like I used to\n"
380 "I don't hope for kind words you might say\n"
381 "You don't prey on my mind like you used to\n"
382 "But you can still ruin my day\n"
383 "You can still ruin my day\n"
384 "\33r(Jon Brion) ",
386 // 24
387 "\33l\33iI had to break the window\n"
388 "It just had to be it was in my way\n"
389 "Better that I break the window\n"
390 "Then forget what I had to say\n\n"
392 "So again I've done the right thing\n"
393 "I was never worried about that\n"
394 "The answer's always been in clear view\n"
395 "But even when the window's clean\n"
396 "I still can't see for the fact\n"
397 "That when it's clean it's so clear\n"
398 "I can't tell what I'm looking through\n"
399 "\33r(Fiona Apple) ",
401 // 25
402 "\33l\33iI seem to you to seek a new disaster every day\n"
403 "You deem me due to clean my view and be at peace and lay\n"
404 "I mean to prove, I mean to move in my own way\n"
405 "And say I've been getting along for long before you came into the play\n\n"
407 "If there was a better way to go then it would find me\n"
408 "I can't help it the road just rolls out behind me\n"
409 "Be kind to me, or treat me mean\n"
410 "I'll make the most of it, I'm an extraordinary machine\n"
411 "\33r(Fiona Apple) ",
413 // 26
414 "\33l\33iEverything good I deem too good to be true\n"
415 "Everything else is just a bore\n"
416 "Everything I have to look forward to\n"
417 "Has a pretty painful and very imposing before\n\n"
419 "Oh sailor why'd you do it\n"
420 "What'd you do that for\n"
421 "Saying there's nothing to it\n"
422 "And then letting it go by the boards\n"
423 "\33r(Fiona Apple) ",
425 // 27
426 "\33l\33iIf you don't have a date\n"
427 "Celebrate\n"
428 "Go out and sit on the lawn\n"
429 "And do nothing\n"
430 "'Cause it's just what you must do\n"
431 "And nobody does it anymore\n\n"
432 "No, I don't believe in the wasting of time,\n"
433 "But I don't believe that I'm wasting mine\n"
434 "\33r(Fiona Apple) ",
436 // 28
437 "\33l\33i'Cause I do know what's good for me\n"
438 "And I've done what I could for you\n"
439 "But you're not benefiting, and yet I'm sitting\n"
440 "Singing again, sing, sing again\n\n"
441 "How can I deal with this, if he won't get with this\n"
442 "Am I gonna heal from this, he won't admit to it\n"
443 "Nothing to figure out, I got to get him out\n"
444 "It's time the truth was out that he don't give a shit about me\n"
445 "\33r(Fiona Apple) ",
447 // 29
448 "\33l\33iSo my darling, give me your absence tonight\n"
449 "Take all of your sympathy and leave it outside\n"
450 "'Cause there's no kind of loving that can make this alright\n"
451 "I'm trying to find a place I belong\n\n"
452 "And I suddenly feel like a different person\n"
453 "From the roots of my soul come a gentle coercion\n"
454 "And I ran my hand over a strange inversion\n"
455 "As the darkness turns into the dawn\n"
456 "The child is gone\n"
457 "\33r(Fiona Apple) ",
459 // 30
460 "\33l\33iBut then the dove of hope began its downward slope\n"
461 "And I believed for a moment that my chances were\n"
462 "Approaching to be grabbed\n"
463 "But as it came down near, so did a weary tear\n"
464 "I thought it was a bird, but it was just a paper bag\n"
465 "\33r(Fiona Apple) ",
467 // 31
468 "\33l\33iWait 'til I get him back\n"
469 "He won't have a back to scratch\n"
470 "Yeah, keep turning that chin\n"
471 "And you will see my face\n"
472 "As I figure how to kill what I cannot catch\n"
473 "\33r(Fiona Apple) "
477 /* /// "HardwareListDisplayHook()" */
478 AROS_UFH3(LONG, HardwareListDisplayHook,
479 AROS_UFHA(struct Hook *, hook, A0),
480 AROS_UFHA(char **, strarr, A2),
481 AROS_UFHA(struct HWListEntry *, hlnode, A1))
483 AROS_USERFUNC_INIT
485 static char buf[16];
486 static char buf2[32];
487 char *cmpstr;
488 char *strptr;
489 struct IconListData *data = (struct IconListData *) INST_DATA(IconListClass->mcc_Class, ((struct ActionData *) hook->h_Data)->hwlistobj);
491 if(hlnode)
493 psdSafeRawDoFmt(buf, 16, "%ld", hlnode->unit);
494 psdSafeRawDoFmt(buf2, 32, "\33O[%08lx] %s", hlnode->phw ? data->mimainlist[18] : data->mimainlist[5], hlnode->phw ? _(MSG_PANEL_HARDWARE_ONLINE_YES) : _(MSG_PANEL_HARDWARE_ONLINE_NO));
495 strptr = hlnode->devname;
496 cmpstr = strptr;
497 while(*cmpstr)
499 switch(*cmpstr++)
501 case ':':
502 case '/':
503 strptr = cmpstr;
504 break;
507 *strarr++ = strptr;
508 *strarr++ = buf;
509 *strarr++ = buf2;
510 *strarr = hlnode->prodname ? hlnode->prodname : (STRPTR) _(MSG_PANEL_HARDWARE_UNKNOWN);
511 } else {
512 *strarr++ = _(MSG_PANEL_HARDWARE_COLS_NAME);
513 *strarr++ = _(MSG_PANEL_HARDWARE_COLS_UNIT);
514 *strarr++ = _(MSG_PANEL_HARDWARE_COLS_ONLINE);
515 *strarr = _(MSG_PANEL_HARDWARE_COLS_PRODUCT);
517 return(0);
518 AROS_USERFUNC_EXIT
520 /* \\\ */
522 /* /// "PrefsListDisplayHook()" */
523 AROS_UFH3(LONG, PrefsListDisplayHook,
524 AROS_UFHA(struct Hook *, hook, A0),
525 AROS_UFHA(char **, strarr, A2),
526 AROS_UFHA(struct PrefsListEntry *, plnode, A1))
528 AROS_USERFUNC_INIT
530 static char buf[16];
532 if(plnode)
534 psdSafeRawDoFmt(buf, 16, "%ld", plnode->size);
535 *strarr++ = plnode->type;
536 *strarr++ = plnode->id;
537 *strarr++ = plnode->owner;
538 *strarr = buf;
539 } else {
540 *strarr++ = _(MSG_PANEL_CONFIG_COLS_TYPE);
541 *strarr++ = _(MSG_PANEL_CONFIG_COLS_DESC);
542 *strarr++ = _(MSG_PANEL_CONFIG_COLS_OWNER);
543 *strarr = _(MSG_PANEL_CONFIG_COLS_SIZE);
545 return(0);
546 AROS_USERFUNC_EXIT
548 /* \\\ */
550 /* /// "CheckDeviceValid()" */
551 BOOL CheckDeviceValid(struct DevListEntry *dlnode)
553 struct Node *pd = NULL;
554 if(dlnode)
556 if(dlnode->pd)
558 while((pd = psdGetNextDevice(pd)))
560 if(pd == dlnode->pd)
562 return(TRUE);
566 dlnode->pd = NULL;
568 return(FALSE);
570 /* \\\ */
572 /* /// "DeviceListDisplayHook()" */
573 AROS_UFH3(LONG, DeviceListDisplayHook,
574 AROS_UFHA(struct Hook *, hook, A0),
575 AROS_UFHA(char **, strarr, A2),
576 AROS_UFHA(struct DevListEntry *, dlnode, A1))
578 AROS_USERFUNC_INIT
580 ULONG clsimg;
581 ULONG stateimg;
582 IPTR devclass;
583 IPTR devsubclass;
584 IPTR devproto;
585 IPTR devislowspeed;
586 IPTR devishighspeed;
587 #ifdef AROS_USB30_CODE
588 IPTR devissuperspeed;
589 #endif
590 IPTR devisconnected;
591 IPTR devhasaddress;
592 IPTR devhasdevdesc;
593 IPTR devhasappbinding;
594 IPTR devisconfigured;
595 IPTR devlowpower = 0;
596 IPTR devisdead = 0;
597 IPTR devissuspended = 0;
598 APTR devbinding;
599 BOOL goodbinding = FALSE;
600 BOOL hasmultiple = FALSE;
601 IPTR ifclass;
602 IPTR ifsubclass;
603 IPTR ifproto;
604 struct List *pclist;
605 struct List *piflist;
606 struct Node *pc;
607 struct Node *pif;
608 APTR ifbinding;
609 struct Library *bindingcls;
610 struct Task *bindingtask;
611 STRPTR statestr;
612 STRPTR tmpcptr;
613 static char buf[100];
614 static char buf2[32];
615 static char buf3[32];
616 STRPTR bufptr;
617 ULONG buflen = 99;
618 struct IconListData *data = (struct IconListData *) INST_DATA(IconListClass->mcc_Class, ((struct ActionData *) hook->h_Data)->devlistobj);
620 if(dlnode)
622 if(!CheckDeviceValid(dlnode))
624 psdSafeRawDoFmt(buf2, 32, "\33O[%08lx] %s",
625 data->mimainlist[0],
626 "Spiritual");
627 psdSafeRawDoFmt(buf3, 32, "\33O[%08lx] %s",
628 data->mimainlist[5], "Ghost");
629 *strarr++ = "<You can't see me>";
630 *strarr++ = "Zero";
631 *strarr++ = buf3;
632 *strarr++ = buf2;
633 *strarr = "None";
634 return(0);
637 psdGetAttrs(PGA_DEVICE, dlnode->pd,
638 DA_Binding, &devbinding,
639 DA_BindingClass, &bindingcls,
640 DA_ProductName, strarr++,
641 DA_IsLowspeed, &devislowspeed,
642 DA_IsHighspeed, &devishighspeed,
643 #ifdef AROS_USB30_CODE
644 DA_IsSuperspeed, &devissuperspeed,
645 #endif
646 DA_IsConnected, &devisconnected,
647 DA_HasAddress, &devhasaddress,
648 DA_HasDevDesc, &devhasdevdesc,
649 DA_IsConfigured, &devisconfigured,
650 DA_IsDead, &devisdead,
651 DA_IsSuspended, &devissuspended,
652 DA_LowPower, &devlowpower,
653 DA_HasAppBinding, &devhasappbinding,
654 DA_Class, &devclass,
655 DA_SubClass, &devsubclass,
656 DA_Protocol, &devproto,
657 DA_ConfigList, &pclist,
658 TAG_END);
660 #ifdef AROS_USB30_CODE
661 *strarr++ = (devislowspeed ? _(MSG_DEVICE_SPEED_LOW) : (devissuperspeed ? _(MSG_DEVICE_SPEED_SUPER) : (devishighspeed ? _(MSG_DEVICE_SPEED_HIGH) : _(MSG_DEVICE_SPEED_FULL))));
662 #else
663 *strarr++ = (devislowspeed ? _(MSG_DEVICE_SPEED_LOW) : (devishighspeed ? _(MSG_DEVICE_SPEED_HIGH) : _(MSG_DEVICE_SPEED_FULL)));
664 #endif
666 if(devissuspended)
668 statestr = _(MSG_DEVICE_STATE_SUSPENDED);
669 stateimg = 19;
671 else if(devisdead)
673 statestr = devlowpower ? _(MSG_DEVICE_STATE_DEADLP) : _(MSG_DEVICE_STATE_DEAD);
674 stateimg = 5;
676 else if(devlowpower)
678 statestr = _(MSG_DEVICE_STATE_LOWPOWER);
679 stateimg = 19;
681 else if(devisconfigured)
683 statestr = _(MSG_DEVICE_STATE_CONFIGURED);
684 stateimg = 18;
686 else if(devhasdevdesc)
688 statestr = _(MSG_DEVICE_STATE_DEVDESC);
689 stateimg = 5;
691 else if(devhasaddress)
693 statestr = _(MSG_DEVICE_STATE_HASADDRESS);
694 stateimg = 5;
696 else if(devisconnected)
698 statestr = _(MSG_DEVICE_STATE_CONNECTED);
699 stateimg = 5;
700 } else {
701 statestr = _(MSG_DEVICE_STATE_DEAD);
702 stateimg = 5;
704 *strarr++ = buf3;
705 if(!devclass)
707 ifclass = 0;
708 pc = pclist->lh_Head;
709 while(pc->ln_Succ)
711 psdGetAttrs(PGA_CONFIG, pc,
712 CA_InterfaceList, &piflist,
713 TAG_END);
714 pif = piflist->lh_Head;
715 while(pif->ln_Succ)
717 psdGetAttrs(PGA_INTERFACE, pif,
718 IFA_Class, &ifclass,
719 IFA_SubClass, &ifsubclass,
720 IFA_Protocol, &ifproto,
721 TAG_END);
722 if(ifclass)
724 if(!devclass)
726 devclass = ifclass;
727 devsubclass = ifsubclass;
728 devproto = ifproto;
729 } else {
730 if(devclass != ifclass)
732 devclass = 0;
733 hasmultiple = TRUE;
734 break;
735 } else {
736 if(devsubclass != ifsubclass)
738 devsubclass = 0;
739 devproto = 0;
740 } else {
741 if(devproto != ifproto)
743 devproto = 0;
749 pif = pif->ln_Succ;
751 pc = pc->ln_Succ;
754 clsimg = 5;
755 switch(devclass)
757 case STILLIMG_CLASSCODE:
758 clsimg = 22;
759 break;
760 case BLUETOOTH_CLASSCODE:
761 clsimg = 21;
762 break;
763 case FWUPGRADE_CLASSCODE:
764 clsimg = 1;
765 break;
766 case VENDOR_CLASSCODE:
767 clsimg++;
768 case SECURITY_CLASSCODE:
769 clsimg++;
770 case SMARTCARD_CLASSCODE:
771 clsimg++;
772 case CDCDATA_CLASSCODE:
773 clsimg++;
774 case HUB_CLASSCODE:
775 clsimg++;
776 case MASSSTORE_CLASSCODE:
777 clsimg++;
778 case PRINTER_CLASSCODE:
779 clsimg++;
780 case PHYSICAL_CLASSCODE:
781 clsimg++;
782 case HID_CLASSCODE:
783 clsimg += 2;
784 case CDCCTRL_CLASSCODE:
785 clsimg++;
786 case AUDIO_CLASSCODE:
787 clsimg++;
788 break;
790 default:
791 clsimg = 0;
793 if(!hasmultiple)
795 psdSafeRawDoFmt(buf2, 32, "\33O[%08lx] %s",
796 data->mimainlist[clsimg],
797 psdNumToStr(NTS_COMBOCLASS,
798 (devclass<<NTSCCS_CLASS)|(devsubclass<<NTSCCS_SUBCLASS)|(devproto<<NTSCCS_PROTO)|
799 NTSCCF_CLASS|NTSCCF_SUBCLASS|NTSCCF_PROTO,
800 "None"));
801 } else {
802 psdSafeRawDoFmt(buf2, 32, "\33O[%08lx] %s",
803 data->mimainlist[0], "Multiple");
805 *strarr++ = buf2;
806 if(devbinding)
808 if(devhasappbinding)
810 psdGetAttrs(PGA_APPBINDING, devbinding,
811 ABA_Task, &bindingtask,
812 TAG_END);
813 *strarr = bindingtask->tc_Node.ln_Name;
814 } else {
815 *strarr = bindingcls->lib_Node.ln_Name;
817 goodbinding = TRUE;
818 } else {
819 *strarr = bufptr = buf;
820 strcpy(buf, "None");
821 pc = pclist->lh_Head;
822 while(pc->ln_Succ)
824 psdGetAttrs(PGA_CONFIG, pc,
825 CA_InterfaceList, &piflist,
826 TAG_END);
827 pif = piflist->lh_Head;
828 while(pif->ln_Succ)
830 psdGetAttrs(PGA_INTERFACE, pif,
831 IFA_Binding, &ifbinding,
832 IFA_BindingClass, &bindingcls,
833 TAG_END);
834 if(ifbinding)
836 goodbinding = TRUE;
837 if((buflen < 99) && ( buflen > 3))
839 *bufptr++ = ',';
840 *bufptr++ = ' ';
841 buflen -= 2;
843 tmpcptr = bindingcls->lib_Node.ln_Name;
844 while((*bufptr++ = *tmpcptr++))
846 if(!(--buflen))
848 *bufptr = 0;
849 break;
852 bufptr--;
854 pif = pif->ln_Succ;
855 if(!buflen)
857 break;
860 pc = pc->ln_Succ;
861 if(!buflen)
863 break;
867 if(!goodbinding && (stateimg == 18))
869 stateimg = 20;
871 psdSafeRawDoFmt(buf3, 32, "\33O[%08lx] %s",
872 data->mimainlist[stateimg], statestr);
873 } else {
874 *strarr++ = _(MSG_PANEL_DEVICES_COLS_NAME);
875 *strarr++ = _(MSG_PANEL_DEVICES_COLS_SPEED);
876 *strarr++ = _(MSG_PANEL_DEVICES_COLS_STATE);
877 *strarr++ = _(MSG_PANEL_DEVICES_COLS_CLASS);
878 *strarr = _(MSG_PANEL_DEVICES_COLS_BINDINGS);
880 return(0);
881 AROS_USERFUNC_EXIT
883 /* \\\ */
885 /* /// "ClassListDisplayHook()" */
886 AROS_UFH3(LONG, ClassListDisplayHook,
887 AROS_UFHA(struct Hook *, hook, A0),
888 AROS_UFHA(char **, strarr, A2),
889 AROS_UFHA(struct ClsListEntry *, clnode, A1))
891 AROS_USERFUNC_INIT
893 static char buf[16];
894 IPTR usecnt;
895 struct Library *UsbClsBase;
896 struct List *lst;
897 struct Node *puc;
899 if(clnode)
901 psdGetAttrs(PGA_STACK, NULL, PA_ClassList, &lst, TAG_END);
902 puc = lst->lh_Head;
903 while(puc->ln_Succ)
905 if(clnode->puc == puc)
907 break;
909 puc = puc->ln_Succ;
911 if(!puc->ln_Succ)
913 clnode->puc = NULL;
914 *strarr++ = "";
915 *strarr++ = "";
916 *strarr = "";
917 return(0);
919 psdGetAttrs(PGA_USBCLASS, clnode->puc,
920 UCA_ClassBase, &UsbClsBase,
921 UCA_ClassName, strarr++,
922 UCA_UseCount, &usecnt,
923 TAG_END);
924 psdSafeRawDoFmt(buf, 16, "%ld", usecnt);
925 *strarr++ = buf;
926 usbGetAttrs(UGA_CLASS, NULL,
927 UCCA_Description, strarr,
928 TAG_END);
930 } else {
931 *strarr++ = _(MSG_PANEL_CLASSES_COLS_NAME);
932 *strarr++ = _(MSG_PANEL_CLASSES_COLS_USE);
933 *strarr = _(MSG_PANEL_CLASSES_COLS_DESC);
935 return(0);
936 AROS_USERFUNC_EXIT
938 /* \\\ */
940 /* /// "ErrorListDisplayHook()" */
941 AROS_UFH3(LONG, ErrorListDisplayHook,
942 AROS_UFHA(struct Hook *, hook, A0),
943 AROS_UFHA(char **, strarr, A2),
944 AROS_UFHA(struct ErrListEntry *, elnode, A1))
946 AROS_USERFUNC_INIT
948 IPTR level;
949 struct DateStamp *ds;
950 struct DateTime dt;
951 static char strtime[LEN_DATSTRING];
953 if(elnode)
955 ds = NULL;
956 psdGetAttrs(PGA_ERRORMSG, elnode->pem,
957 EMA_Level, &level,
958 EMA_Origin, &strarr[2],
959 EMA_Msg, &strarr[3],
960 EMA_DateStamp, &ds,
961 TAG_END);
963 if(ds)
965 dt.dat_Stamp.ds_Days = ds->ds_Days;
966 dt.dat_Stamp.ds_Minute = ds->ds_Minute;
967 dt.dat_Stamp.ds_Tick = ds->ds_Tick;
968 dt.dat_Format = FORMAT_DEF;
969 dt.dat_Flags = 0;
970 dt.dat_StrDay = NULL;
971 dt.dat_StrDate = NULL;
972 dt.dat_StrTime = strtime;
973 DateToStr(&dt);
974 strarr[0] = strtime;
975 } else {
976 strarr[0] = "";
978 strarr[1] = ((level == RETURN_OK) ? _(MSG_LOGLEVEL_OK) :
979 ((level == RETURN_WARN) ? _(MSG_LOGLEVEL_WARNING) :
980 ((level == RETURN_ERROR) ? _(MSG_LOGLEVEL_ERROR) :
981 ((level == RETURN_FAIL) ? _(MSG_LOGLEVEL_FAILURE) : _(MSG_LOGLEVEL_OTHER)))));
983 return(0);
984 AROS_USERFUNC_EXIT
986 /* \\\ */
988 /* /// "IconListDisplayHook()" */
989 AROS_UFH3(LONG, IconListDisplayHook,
990 AROS_UFHA(struct Hook *, hook, A0),
991 AROS_UFHA(char **, strarr, A2),
992 AROS_UFHA(STRPTR, str, A1))
994 AROS_USERFUNC_INIT
996 static char buf[32];
997 struct IconListData *data = (struct IconListData *) INST_DATA(IconListClass->mcc_Class, ((struct ActionData *) hook->h_Data)->cfgpagelv);
999 if(str)
1001 LONG pos = ((IPTR *) strarr)[-1];
1003 if(pos == 5)
1005 pos = 24; // fix for PoPo
1007 else if(pos == 6)
1009 pos = 16; // fix for Configure Management menu
1011 else if(pos == 7)
1013 pos = 23; // fix for Online menu
1016 psdSafeRawDoFmt(buf, 32, "\33O[%08lx] %s",
1017 data->mimainlist[pos],
1018 str);
1019 *strarr = buf;
1021 return(0);
1022 AROS_USERFUNC_EXIT
1024 /* \\\ */
1026 /* /// "AllocHWEntry()" */
1027 struct HWListEntry * AllocHWEntry(struct ActionData *data, struct Node *phw)
1029 struct HWListEntry *hlnode;
1030 STRPTR str;
1031 hlnode = psdAllocVec(sizeof(struct HWListEntry));
1032 if(hlnode)
1034 if(phw)
1036 psdGetAttrs(PGA_HARDWARE, phw,
1037 HA_DeviceName, &str,
1038 HA_DeviceUnit, &hlnode->unit,
1039 HA_ProductName, &hlnode->prodname,
1040 TAG_END);
1041 hlnode->devname = psdCopyStr(str);
1042 hlnode->phw = phw;
1044 AddTail(&data->hwlist, &hlnode->node);
1046 return(hlnode);
1048 /* \\\ */
1050 /* /// "FreeHWEntry()" */
1051 void FreeHWEntry(struct ActionData *data, struct HWListEntry *hlnode)
1053 struct Node *phw;
1054 struct List *lst;
1056 Remove(&hlnode->node);
1057 if(hlnode->phw)
1059 psdLockWritePBase();
1060 psdGetAttrs(PGA_STACK, NULL, PA_HardwareList, &lst, TAG_END);
1061 phw = lst->lh_Head;
1062 while(phw->ln_Succ)
1064 if(phw == hlnode->phw)
1066 psdUnlockPBase();
1067 psdRemHardware(phw);
1068 hlnode->phw = NULL;
1069 phw = NULL;
1070 break;
1072 phw = phw->ln_Succ;
1074 if(phw)
1076 psdUnlockPBase();
1079 if(hlnode->infowindow)
1081 set(hlnode->infowindow, MUIA_Window_Open, FALSE);
1082 if(data->appobj)
1084 DoMethod(data->appobj, OM_REMMEMBER, hlnode->infowindow);
1085 DoMethod(hlnode->infowindow, OM_DISPOSE);
1087 hlnode->infowindow = NULL;
1089 psdFreeVec(hlnode->devname);
1090 psdFreeVec(hlnode);
1092 /* \\\ */
1094 /* /// "AllocDevEntry()" */
1095 struct DevListEntry * AllocDevEntry(struct ActionData *data, struct Node *pd)
1097 struct DevListEntry *dlnode;
1099 dlnode = psdAllocVec(sizeof(struct DevListEntry));
1100 if(dlnode)
1102 dlnode->pd = pd;
1103 dlnode->adata = data;
1104 AddTail(&data->devlist, &dlnode->node);
1106 return(dlnode);
1108 /* \\\ */
1110 /* /// "FreeDevEntry()" */
1111 void FreeDevEntry(struct ActionData *data, struct DevListEntry *dlnode)
1113 if(dlnode->infowindow)
1115 set(dlnode->infowindow, MUIA_Window_Open, FALSE);
1116 if(data->appobj)
1118 DoMethod(data->appobj, OM_REMMEMBER, dlnode->infowindow);
1119 DoMethod(dlnode->infowindow, OM_DISPOSE);
1121 dlnode->infowindow = NULL;
1122 if(dlnode->devdata)
1124 dlnode->devdata->dlnode = NULL;
1127 Remove(&dlnode->node);
1128 psdFreeVec(dlnode);
1130 /* \\\ */
1132 /* /// "AllocClsEntry()" */
1133 struct ClsListEntry * AllocClsEntry(struct ActionData *data, struct Node *puc)
1135 struct ClsListEntry *clnode;
1136 clnode = psdAllocVec(sizeof(struct ClsListEntry));
1137 if(clnode)
1139 clnode->puc = puc;
1141 AddTail(&data->clslist, &clnode->node);
1143 return(clnode);
1145 /* \\\ */
1147 /* /// "FreeClsEntry()" */
1148 void FreeClsEntry(struct ActionData *data, struct ClsListEntry *clnode)
1150 Remove(&clnode->node);
1151 psdFreeVec(clnode);
1153 /* \\\ */
1155 /* /// "FreeErrorList()" */
1156 void FreeErrorList(struct ActionData *data)
1158 struct Node *node;
1159 node = data->errlist.lh_Head;
1160 while(node->ln_Succ)
1162 Remove(node);
1163 psdFreeVec(node);
1164 node = data->errlist.lh_Head;
1167 /* \\\ */
1169 /* /// "CreateErrorList()" */
1170 void CreateErrorList(struct ActionData *data)
1172 struct Node *pem;
1173 struct List *lst;
1174 struct ErrListEntry *elnode;
1175 IPTR level;
1177 set(data->errlistobj, MUIA_List_Quiet, TRUE);
1178 DoMethod(data->errlistobj, MUIM_List_Clear);
1179 FreeErrorList(data);
1180 psdGetAttrs(PGA_STACK, NULL, PA_ErrorMsgList, &lst, TAG_END);
1181 Forbid();
1182 pem = lst->lh_Head;
1183 while(pem->ln_Succ)
1185 psdGetAttrs(PGA_ERRORMSG, pem,
1186 EMA_Level, &level,
1187 TAG_END);
1188 if(level >= data->errorlevel)
1190 if((elnode = psdAllocVec(sizeof(struct ErrListEntry))))
1192 elnode->pem = pem;
1193 AddTail(&data->errlist, &elnode->node);
1194 DoMethod(data->errlistobj, MUIM_List_InsertSingle, elnode, MUIV_List_Insert_Bottom);
1197 pem = pem->ln_Succ;
1199 Permit();
1200 set(data->errlistobj, MUIA_List_Quiet, FALSE);
1201 set(data->errlistobj, MUIA_List_Active, MUIV_List_Active_Bottom);
1203 /* \\\ */
1205 /* /// "FreePrefsList()" */
1206 void FreePrefsList(struct ActionData *data)
1208 struct PrefsListEntry *plnode;
1209 plnode = (struct PrefsListEntry *) data->prefslist.lh_Head;
1210 while(plnode->node.ln_Succ)
1212 Remove(&plnode->node);
1213 psdFreeVec(plnode->id);
1214 psdFreeVec(plnode->owner);
1215 psdFreeVec(plnode->devid);
1216 psdFreeVec(plnode->ifid);
1217 psdFreeVec(plnode);
1218 plnode = (struct PrefsListEntry *) data->prefslist.lh_Head;
1221 /* \\\ */
1223 /* /// "AllocPrefsEntry()" */
1224 struct PrefsListEntry * AllocPrefsEntry(struct ActionData *data, ULONG formid, ULONG size, STRPTR id, STRPTR owner)
1226 struct PrefsListEntry *plnode = NULL;
1228 if((plnode = psdAllocVec(sizeof(struct PrefsListEntry))))
1230 plnode->id = id;
1231 if(strlen(id) > 39)
1233 id[37] = '.';
1234 id[38] = '.';
1235 id[39] = '.';
1236 id[40] = 0;
1238 plnode->chunkid = formid;
1239 plnode->size = size;
1240 switch(formid)
1242 case IFFFORM_STACKCFG:
1243 plnode->type = "Core Cfg";
1244 plnode->node.ln_Pri = 100;
1245 break;
1247 case IFFFORM_DEVICECFG:
1248 plnode->type = "USB Device";
1249 break;
1251 case IFFFORM_CLASSCFG:
1252 plnode->type = "Class Cfg";
1253 plnode->node.ln_Pri = 20;
1254 break;
1256 case IFFFORM_DEVCFGDATA:
1257 plnode->type = " Device Cfg";
1258 break;
1260 case IFFFORM_IFCFGDATA:
1261 plnode->type = " Interface Cfg";
1262 break;
1264 case MAKE_ID('P','S','D','L'):
1265 plnode->type = "Licence";
1266 plnode->node.ln_Pri = 50;
1267 break;
1269 case 0:
1270 break;
1272 default:
1273 plnode->type = "Unknown";
1274 plnode->node.ln_Pri = -100;
1275 break;
1277 if(data->devidstr)
1279 plnode->devid = psdCopyStr(data->devidstr);
1280 if(data->ifidstr)
1282 plnode->ifid = psdCopyStr(data->ifidstr);
1285 plnode->owner = owner;
1286 Enqueue(&data->prefslist, &plnode->node);
1288 return(plnode);
1290 /* \\\ */
1292 /* /// "FindCfgChunk()" */
1293 ULONG * FindCfgChunk(ULONG *form, ULONG chnkid)
1295 ULONG *buf = form + 3;
1296 ULONG len = (AROS_LONG2BE(form[1]) - 3) & ~1UL;
1297 ULONG chlen;
1299 while(len)
1301 if(AROS_LONG2BE(*buf) == chnkid)
1303 return(buf);
1305 chlen = (AROS_LONG2BE(buf[1]) + 9) & ~1UL;
1306 len -= chlen;
1307 buf = (ULONG *) (((UBYTE *) buf) + chlen);
1309 return(NULL);
1311 /* \\\ */
1313 /* /// "GetStringChunk()" */
1314 STRPTR GetStringChunk(ULONG *form, ULONG chnkid, STRPTR defstr)
1316 ULONG *chunkptr;
1317 STRPTR str = NULL;
1318 if((chunkptr = FindCfgChunk(form, chnkid)))
1320 if((str = (STRPTR) psdAllocVec(AROS_LONG2BE(chunkptr[1]) + 1)))
1322 memcpy(str, &chunkptr[2], (size_t) AROS_LONG2BE(chunkptr[1]));
1323 return(str);
1326 if(defstr)
1328 str = psdCopyStr(defstr);
1330 return(str);
1332 /* \\\ */
1334 /* /// "RecursePrefsForm()" */
1335 void RecursePrefsForm(struct ActionData *data, ULONG *form, ULONG depth, STRPTR stack)
1337 struct PrefsListEntry *plnode;
1338 ULONG *endptr;
1339 ULONG *currptr;
1340 ULONG chunklen;
1341 ULONG chunkid;
1342 ULONG formid = AROS_LONG2BE(form[2]);
1343 STRPTR newstack;
1344 ULONG *chunkptr;
1345 STRPTR owner;
1346 STRPTR id;
1347 ULONG formsize = AROS_LONG2BE(form[1]) + 8;
1348 BOOL allocdevid = FALSE;
1349 BOOL allocifid = FALSE;
1351 newstack = (STRPTR) psdAllocVec((ULONG) strlen(stack) + 5);
1352 if(!newstack)
1354 return;
1356 strcpy(newstack, stack);
1357 *((ULONG *) &newstack[strlen(stack)]) = AROS_LONG2BE(formid);
1359 if(AROS_LONG2BE(*((ULONG *) newstack)) != IFFFORM_PSDCFG)
1361 owner = GetStringChunk(form, IFFCHNK_OWNER, "Unknown");
1362 id = psdCopyStr("This is not a poseidon config!");
1363 plnode = AllocPrefsEntry(data, formid, formsize, id, owner);
1365 else if(!strcmp(newstack + 4, "STKC"))
1367 plnode = AllocPrefsEntry(data, formid, formsize, psdCopyStr("Global Stack Configuration"), psdCopyStr("Trident"));
1369 else if(!strcmp(newstack + 4, "DEVC"))
1371 id = GetStringChunk(form, IFFCHNK_DEVID, "Unknown");
1372 data->devidstr = psdCopyStr(id);
1373 allocdevid = TRUE;
1374 plnode = AllocPrefsEntry(data, formid, formsize, id, psdCopyStr("Trident"));
1376 else if(!strcmp(newstack + 4, "DEVCDCFG"))
1378 owner = GetStringChunk(form, IFFCHNK_OWNER, "Unknown");
1379 if(!strcmp(owner, "Trident"))
1381 id = psdCopyStr("Generic Prefs");
1382 } else {
1383 id = psdCopyStrFmt("%s Prefs", owner);
1385 plnode = AllocPrefsEntry(data, formid, formsize, id, owner);
1387 else if(!strcmp(newstack + 4, "DEVCICFG"))
1389 if(formsize > 4)
1391 data->ifidstr = GetStringChunk(form, IFFCHNK_IFID, "Unknown");
1392 allocifid = TRUE;
1393 owner = GetStringChunk(form, IFFCHNK_OWNER, "Unknown");
1394 plnode = AllocPrefsEntry(data, formid, formsize, psdCopyStrFmt("%s Prefs for %s", owner, data->ifidstr), owner);
1397 else if(!strcmp(newstack + 4, "CLSC"))
1399 if(formsize > 4)
1401 owner = GetStringChunk(form, IFFCHNK_OWNER, "Unknown");
1402 id = psdCopyStrFmt("(Default) Prefs for %s", owner);
1403 plnode = AllocPrefsEntry(data, formid, formsize, id, owner);
1406 else if(!strcmp(newstack + 4, "PSDL"))
1408 owner = GetStringChunk(form, IFFCHNK_OWNER, "Unknown");
1409 chunkptr = FindCfgChunk(form, MAKE_ID('S','K','E','Y'));
1410 if(chunkptr)
1412 id = psdCopyStrFmt("Keyfile Serial #%04ld", chunkptr[3] & 0xffff);
1413 } else {
1414 id = psdCopyStr("Corrupted Keyfile?");
1416 plnode = AllocPrefsEntry(data, formid, formsize, id, psdCopyStr("Secret"));
1417 } else {
1418 if(depth == 1)
1420 owner = GetStringChunk(form, IFFCHNK_OWNER, "Unknown");
1421 id = psdCopyStr("Unknown prefs data (XXXX)");
1422 if(id)
1424 *((ULONG *) &id[20]) = AROS_LONG2BE(formid);
1426 plnode = AllocPrefsEntry(data, formid, formsize, id, owner);
1429 depth++;
1430 currptr = &form[3];
1431 endptr = (ULONG *) (((UBYTE *) form) + ((AROS_LONG2BE(form[1]) + 9) & ~1UL));
1432 while(currptr < endptr)
1434 chunkid = AROS_LONG2BE(currptr[0]);
1435 chunklen = (AROS_LONG2BE(currptr[1]) + 9) & ~1UL;
1436 if((chunkid == ID_FORM) && (depth < 3))
1438 RecursePrefsForm(data, currptr, depth, newstack);
1439 } else {
1440 switch(chunkid)
1442 case IFFCHNK_FORCEDBIND:
1443 if(!strcmp(newstack + 4, "DEVC"))
1445 owner = GetStringChunk(form, chunkid, "Unknown");
1446 plnode = AllocPrefsEntry(data, chunkid, chunklen, psdCopyStrFmt("Forced Device Binding to %s", owner), owner);
1447 if(plnode)
1449 plnode->type = " Binding";
1452 else if(!strcmp(newstack + 4, "DEVCICFG"))
1454 owner = GetStringChunk(form, IFFCHNK_OWNER, "Unknown");
1455 plnode = AllocPrefsEntry(data, chunkid, chunklen, psdCopyStrFmt("Forced IFace Binding to %s", owner), owner);
1456 if(plnode)
1458 plnode->type = " Binding";
1461 break;
1464 currptr = (ULONG *) (((UBYTE *) currptr) + chunklen);
1466 if(allocdevid)
1468 psdFreeVec(data->devidstr);
1469 data->devidstr = NULL;
1471 if(allocifid)
1473 psdFreeVec(data->ifidstr);
1474 data->ifidstr = NULL;
1476 psdFreeVec(newstack);
1478 /* \\\ */
1480 /* /// "CreatePrefsList()" */
1481 void CreatePrefsList(struct ActionData *data)
1483 struct PrefsListEntry *plnode;
1484 IPTR oldpos = 0;
1485 IPTR oldhash = 0;
1486 IPTR currhash = 0;
1488 set(data->prefslistobj, MUIA_List_Quiet, TRUE);
1489 get(data->prefslistobj, MUIA_List_Active, &oldpos);
1490 DoMethod(data->prefslistobj, MUIM_List_Clear);
1491 FreePrefsList(data);
1492 data->configroot = psdWriteCfg(NULL);
1493 if(data->configroot)
1495 RecursePrefsForm(data, data->configroot, 0, "");
1496 psdFreeVec(data->configroot);
1497 data->configroot = NULL;
1499 plnode = (struct PrefsListEntry *) data->prefslist.lh_Head;
1500 while(plnode->node.ln_Succ)
1502 DoMethod(data->prefslistobj, MUIM_List_InsertSingle, plnode, MUIV_List_Insert_Bottom);
1503 plnode = (struct PrefsListEntry *) plnode->node.ln_Succ;
1505 set(data->prefslistobj, MUIA_List_Active, oldpos);
1506 set(data->prefslistobj, MUIA_List_Quiet, FALSE);
1507 psdGetAttrs(PGA_STACK, NULL,
1508 PA_CurrConfigHash, &currhash,
1509 PA_SavedConfigHash, &oldhash,
1510 TAG_END);
1511 set(data->saveobj, MUIA_Disabled, (oldhash == currhash));
1513 /* \\\ */
1515 /* /// "FreeGUILists()" */
1516 void FreeGUILists(struct ActionData *data)
1518 struct HWListEntry *hlnode;
1519 struct DevListEntry *dlnode;
1520 struct ClsListEntry *clnode;
1522 hlnode = (struct HWListEntry *) data->hwlist.lh_Head;
1523 while(hlnode->node.ln_Succ)
1525 //hlnode->infowindow = NULL;
1526 hlnode->phw = NULL;
1527 FreeHWEntry(data, hlnode);
1528 hlnode = (struct HWListEntry *) data->hwlist.lh_Head;
1530 dlnode = (struct DevListEntry *) data->devlist.lh_Head;
1531 while(dlnode->node.ln_Succ)
1533 //dlnode->infowindow = NULL;
1534 FreeDevEntry(data, dlnode);
1535 dlnode = (struct DevListEntry *) data->devlist.lh_Head;
1537 clnode = (struct ClsListEntry *) data->clslist.lh_Head;
1538 while(clnode->node.ln_Succ)
1540 FreeClsEntry(data, clnode);
1541 clnode = (struct ClsListEntry *) data->clslist.lh_Head;
1544 /* \\\ */
1546 /* /// "CreateClassPopup()" */
1547 Object * CreateClassPopup(void)
1549 Object *mi_root;
1550 Object *mi_top;
1551 Object *mi_sub;
1552 struct List *lst;
1553 struct Node *puc;
1554 STRPTR clname;
1556 mi_root = MenustripObject,
1557 Child, mi_top = MenuObjectT("Forced binding"),
1558 Child, MenuitemObject,
1559 MUIA_Menuitem_Title, "None",
1560 End,
1561 End,
1562 End;
1564 if(mi_root)
1566 psdLockReadPBase();
1567 psdGetAttrs(PGA_STACK, NULL, PA_ClassList, &lst, TAG_END);
1568 puc = lst->lh_Head;
1569 while(puc->ln_Succ)
1571 psdGetAttrs(PGA_USBCLASS, puc,
1572 UCA_ClassName, &clname,
1573 TAG_END);
1575 mi_sub = MenuitemObject,
1576 MUIA_Menuitem_Title, clname,
1577 End;
1578 if(mi_sub)
1580 DoMethod(mi_top, OM_ADDMEMBER, mi_sub);
1582 puc = puc->ln_Succ;
1584 psdUnlockPBase();
1586 return(mi_root);
1588 /* \\\ */
1590 /* /// "InternalCreateConfig()" */
1591 BOOL InternalCreateConfig(void)
1593 ULONG tmpform[3];
1594 APTR pic;
1595 APTR subpic;
1596 STRPTR name;
1597 IPTR unit;
1598 struct Node *phw;
1599 struct Node *puc;
1600 struct List *lst;
1602 pic = psdFindCfgForm(NULL, IFFFORM_STACKCFG);
1603 if(!pic)
1605 tmpform[0] = AROS_LONG2BE(ID_FORM);
1606 tmpform[1] = AROS_LONG2BE(4);
1607 tmpform[2] = AROS_LONG2BE(IFFFORM_STACKCFG);
1608 psdAddCfgEntry(NULL, tmpform);
1609 pic = psdFindCfgForm(NULL, IFFFORM_STACKCFG);
1611 if(!pic)
1613 return(FALSE);
1616 /* First mark all old hardware entries as offline */
1617 subpic = psdFindCfgForm(pic, IFFFORM_UHWDEVICE);
1618 while(subpic)
1620 tmpform[0] = AROS_LONG2BE(IFFCHNK_OFFLINE);
1621 tmpform[1] = AROS_LONG2BE(4);
1622 tmpform[2] = TRUE;
1623 psdAddCfgEntry(subpic, tmpform);
1624 subpic = psdNextCfgForm(subpic);
1627 /* Add existing hardware entries */
1628 psdLockReadPBase();
1629 psdGetAttrs(PGA_STACK, NULL, PA_HardwareList, &lst, TAG_END);
1630 phw = lst->lh_Head;
1631 while(phw->ln_Succ)
1633 psdGetAttrs(PGA_HARDWARE, phw,
1634 HA_DeviceName, &name,
1635 HA_DeviceUnit, &unit,
1636 TAG_END);
1638 // find corresponding form in config
1639 subpic = psdFindCfgForm(pic, IFFFORM_UHWDEVICE);
1640 while(subpic)
1642 if(psdMatchStringChunk(subpic, IFFCHNK_NAME, name))
1644 ULONG *unitchk = psdGetCfgChunk(subpic, IFFCHNK_UNIT);
1645 if(unitchk && unitchk[2] == unit)
1647 psdFreeVec(unitchk);
1648 break;
1650 psdFreeVec(unitchk);
1652 subpic = psdNextCfgForm(subpic);
1655 if(!subpic)
1657 // not found, add it
1658 tmpform[0] = AROS_LONG2BE(ID_FORM);
1659 tmpform[1] = AROS_LONG2BE(4);
1660 tmpform[2] = AROS_LONG2BE(IFFFORM_UHWDEVICE);
1661 subpic = psdAddCfgEntry(pic, tmpform);
1664 if(subpic)
1666 psdAddStringChunk(subpic, IFFCHNK_NAME, name);
1667 tmpform[0] = AROS_LONG2BE(IFFCHNK_UNIT);
1668 tmpform[1] = AROS_LONG2BE(4);
1669 tmpform[2] = unit;
1670 psdAddCfgEntry(subpic, tmpform);
1671 // remove offline chunk to make sure the thing is going online next time
1672 psdRemCfgChunk(subpic, IFFCHNK_OFFLINE);
1674 phw = phw->ln_Succ;
1676 psdUnlockPBase();
1678 /* Add existing class entries */
1679 psdLockReadPBase();
1680 psdGetAttrs(PGA_STACK, NULL, PA_ClassList, &lst, TAG_END);
1681 puc = lst->lh_Head;
1682 while(puc->ln_Succ)
1684 tmpform[0] = AROS_LONG2BE(ID_FORM);
1685 tmpform[1] = AROS_LONG2BE(4);
1686 tmpform[2] = AROS_LONG2BE(IFFFORM_USBCLASS);
1687 subpic = psdAddCfgEntry(pic, tmpform);
1688 if(subpic)
1690 name = NULL;
1691 psdGetAttrs(PGA_USBCLASS, puc,
1692 UCA_FullPath, &name,
1693 TAG_END);
1694 if(!name)
1696 psdGetAttrs(PGA_USBCLASS, puc,
1697 UCA_ClassName, &name,
1698 TAG_END);
1699 name = psdCopyStrFmt("USB/%s", name);
1700 if(name)
1702 psdAddStringChunk(subpic, IFFCHNK_NAME, name);
1703 psdFreeVec(name);
1705 } else {
1706 psdAddStringChunk(subpic, IFFCHNK_NAME, name);
1709 puc = puc->ln_Succ;
1711 psdUnlockPBase();
1712 return(TRUE);
1714 /* \\\ */
1716 /* /// "InternalCreateConfigGUI()" */
1717 BOOL InternalCreateConfigGUI(struct ActionData *data)
1719 ULONG tmpform[3];
1720 APTR pic;
1721 APTR subpic;
1722 STRPTR name;
1723 IPTR unit;
1724 struct Node *phw;
1725 struct HWListEntry *hlnode;
1726 struct ClsListEntry *clnode;
1727 struct List *lst;
1729 pic = psdFindCfgForm(NULL, IFFFORM_STACKCFG);
1730 if(!pic)
1732 tmpform[0] = AROS_LONG2BE(ID_FORM);
1733 tmpform[1] = AROS_LONG2BE(4);
1734 tmpform[2] = AROS_LONG2BE(IFFFORM_STACKCFG);
1735 psdAddCfgEntry(NULL, tmpform);
1736 pic = psdFindCfgForm(NULL, IFFFORM_STACKCFG);
1738 if(!pic)
1740 return(FALSE);
1743 psdLockReadPBase();
1746 /* First remove all old hardware entries */
1747 while((subpic = psdFindCfgForm(pic, IFFFORM_UHWDEVICE)))
1749 psdRemCfgForm(subpic);
1752 /* Add hardware entries from GUI, but mark them as offline */
1753 hlnode = (struct HWListEntry *) data->hwlist.lh_Head;
1754 while(hlnode->node.ln_Succ)
1756 tmpform[0] = AROS_LONG2BE(ID_FORM);
1757 tmpform[1] = AROS_LONG2BE(4);
1758 tmpform[2] = AROS_LONG2BE(IFFFORM_UHWDEVICE);
1759 subpic = psdAddCfgEntry(pic, tmpform);
1760 if(subpic)
1762 psdAddStringChunk(subpic, IFFCHNK_NAME, hlnode->devname);
1763 tmpform[0] = AROS_LONG2BE(IFFCHNK_UNIT);
1764 tmpform[1] = AROS_LONG2BE(4);
1765 tmpform[2] = hlnode->unit;
1766 psdAddCfgEntry(subpic, tmpform);
1767 tmpform[0] = AROS_LONG2BE(IFFCHNK_OFFLINE);
1768 tmpform[1] = AROS_LONG2BE(4);
1769 tmpform[2] = TRUE;
1770 psdAddCfgEntry(subpic, tmpform);
1772 hlnode = (struct HWListEntry *) hlnode->node.ln_Succ;
1775 /* Now find all hardware entries that are online and mark them as such */
1776 psdGetAttrs(PGA_STACK, NULL, PA_HardwareList, &lst, TAG_END);
1777 phw = lst->lh_Head;
1778 while(phw->ln_Succ)
1780 psdGetAttrs(PGA_HARDWARE, phw,
1781 HA_DeviceName, &name,
1782 HA_DeviceUnit, &unit,
1783 TAG_END);
1785 // find corresponding form in config
1786 subpic = psdFindCfgForm(pic, IFFFORM_UHWDEVICE);
1787 while(subpic)
1789 if(psdMatchStringChunk(subpic, IFFCHNK_NAME, name))
1791 ULONG *unitchk = psdGetCfgChunk(subpic, IFFCHNK_UNIT);
1792 if(unitchk && unitchk[2] == unit)
1794 psdFreeVec(unitchk);
1795 psdRemCfgChunk(subpic, IFFCHNK_OFFLINE);
1796 break;
1798 psdFreeVec(unitchk);
1800 subpic = psdNextCfgForm(subpic);
1802 phw = phw->ln_Succ;
1805 /* Delete all old class entries */
1806 while((subpic = psdFindCfgForm(pic, IFFFORM_USBCLASS)))
1808 psdRemCfgForm(subpic);
1810 /* Add existing class entries */
1811 clnode = (struct ClsListEntry *) data->clslist.lh_Head;
1812 while(clnode->node.ln_Succ)
1814 tmpform[0] = AROS_LONG2BE(ID_FORM);
1815 tmpform[1] = AROS_LONG2BE(4);
1816 tmpform[2] = AROS_LONG2BE(IFFFORM_USBCLASS);
1817 subpic = psdAddCfgEntry(pic, tmpform);
1818 if(subpic)
1820 name = NULL;
1821 psdGetAttrs(PGA_USBCLASS, clnode->puc,
1822 UCA_FullPath, &name,
1823 TAG_END);
1824 if(!name)
1826 psdGetAttrs(PGA_USBCLASS, clnode->puc,
1827 UCA_ClassName, &name,
1828 TAG_END);
1829 name = psdCopyStrFmt("USB/%s", name);
1830 if(name)
1832 psdAddStringChunk(subpic, IFFCHNK_NAME, name);
1833 psdFreeVec(name);
1835 } else {
1836 psdAddStringChunk(subpic, IFFCHNK_NAME, name);
1839 clnode = (struct ClsListEntry *) clnode->node.ln_Succ;
1841 psdUnlockPBase();
1842 data->swallowconfigevent = TRUE;
1843 return(TRUE);
1845 /* \\\ */
1847 /* /// "CleanupEventHandler()" */
1848 void CleanupEventHandler(struct ActionData *data)
1850 if(data->eventhandler)
1852 psdRemEventHandler(data->eventhandler);
1853 data->eventhandler = NULL;
1855 if(data->eventmsgport)
1857 DeleteMsgPort(data->eventmsgport);
1858 data->eventmsgport = NULL;
1861 /* \\\ */
1863 /* /// "SetupEventHandler()" */
1864 BOOL SetupEventHandler(struct ActionData *data)
1866 if((data->eventmsgport = CreateMsgPort()))
1868 data->eventhandler = psdAddEventHandler(data->eventmsgport, ~0);
1869 if(data->eventhandler)
1871 return(TRUE);
1873 } else {
1874 data->eventhandler = NULL;
1876 return(FALSE);
1878 /* \\\ */
1880 /* /// "EventHandler()" */
1881 void EventHandler(struct ActionData *data)
1883 APTR pen;
1884 ULONG eventmask;
1885 IPTR penid;
1886 IPTR penparam1;
1887 IPTR penparam2;
1888 BOOL cfgchanged = FALSE;
1890 eventmask = 0;
1891 while((pen = GetMsg(data->eventmsgport)))
1893 psdGetAttrs(PGA_EVENTNOTE, pen,
1894 ENA_EventID, &penid,
1895 ENA_Param1, &penparam1,
1896 ENA_Param2, &penparam2,
1897 TAG_END);
1898 eventmask |= (1L<<penid);
1899 /*printf("Event %ld, Param1 %ld\n", pen->pen_Event, pen->pen_Param1);*/
1900 switch(penid)
1902 case EHMB_ADDHARDWARE:
1904 struct Node *phw;
1905 struct List *lst;
1906 struct HWListEntry *hlnode;
1907 STRPTR devname;
1908 IPTR unit;
1909 STRPTR prodname;
1911 psdLockReadPBase();
1912 psdGetAttrs(PGA_STACK, NULL, PA_HardwareList, &lst, TAG_END);
1913 phw = lst->lh_Head;
1914 while(phw->ln_Succ)
1916 if(phw == (struct Node *) penparam1)
1918 break;
1920 phw = phw->ln_Succ;
1922 if(phw->ln_Succ)
1924 psdGetAttrs(PGA_HARDWARE, phw,
1925 HA_DeviceName, &devname,
1926 HA_DeviceUnit, &unit,
1927 HA_ProductName, &prodname,
1928 TAG_END);
1930 hlnode = (struct HWListEntry *) data->hwlist.lh_Head;
1931 while(hlnode->node.ln_Succ)
1933 if((!strcmp(devname, hlnode->devname)) &&
1934 (unit == hlnode->unit))
1936 if(!hlnode->phw)
1938 hlnode->phw = phw;
1939 hlnode->prodname = prodname;
1941 break;
1943 hlnode = (struct HWListEntry *) hlnode->node.ln_Succ;
1945 if(!hlnode->node.ln_Succ)
1947 if((hlnode = AllocHWEntry(data, phw)))
1949 DoMethod(data->hwlistobj, MUIM_List_InsertSingle, hlnode, MUIV_List_Insert_Bottom);
1951 } else {
1952 DoMethod(data->hwlistobj, MUIM_List_Redraw, MUIV_List_Redraw_All);
1955 psdUnlockPBase();
1956 break;
1959 case EHMB_REMHARDWARE:
1961 struct HWListEntry *hlnode;
1962 psdLockReadPBase();
1963 hlnode = (struct HWListEntry *) data->hwlist.lh_Head;
1964 while(hlnode->node.ln_Succ)
1966 if(hlnode->phw == (struct Node *) penparam1)
1968 hlnode->phw = NULL;
1969 hlnode->prodname = NULL;
1970 break;
1972 hlnode = (struct HWListEntry *) hlnode->node.ln_Succ;
1974 if(hlnode->node.ln_Succ)
1976 DoMethod(data->hwlistobj, MUIM_List_Redraw, MUIV_List_Redraw_All);
1978 psdUnlockPBase();
1979 break;
1982 case EHMB_ADDDEVICE:
1984 struct Node *pd = NULL;
1985 struct DevListEntry *dlnode;
1986 psdLockReadPBase();
1987 while((pd = psdGetNextDevice(pd)))
1989 if(pd == (struct Node *) penparam1)
1991 dlnode = (struct DevListEntry *) data->devlist.lh_Head;
1992 while(dlnode->node.ln_Succ)
1994 if(dlnode->pd == pd)
1996 // ignore existing entry!
1997 break;
1999 dlnode = (struct DevListEntry *) dlnode->node.ln_Succ;
2001 if(!dlnode->node.ln_Succ)
2003 dlnode = AllocDevEntry(data, pd);
2004 if(dlnode)
2006 DoMethod(data->devlistobj, MUIM_List_InsertSingle, dlnode, MUIV_List_Insert_Bottom);
2009 break;
2012 psdUnlockPBase();
2013 break;
2016 case EHMB_REMDEVICE:
2018 struct DevListEntry *dlnode;
2019 struct DevListEntry *tmpnode;
2020 ULONG pos = 0;
2021 set(data->devlistobj, MUIA_List_Quiet, TRUE);
2022 dlnode = (struct DevListEntry *) data->devlist.lh_Head;
2023 while(dlnode->node.ln_Succ)
2025 if((dlnode->pd == (struct Node *) penparam1) || (!dlnode->pd))
2027 dlnode->pd = NULL;
2030 DoMethod(data->devlistobj, MUIM_List_GetEntry, pos, &tmpnode);
2031 if(!tmpnode)
2032 break;
2033 if(tmpnode == dlnode)
2035 DoMethod(data->devlistobj, MUIM_List_Remove, pos);
2036 break;
2038 pos++;
2039 } while(TRUE);
2040 FreeDevEntry(data, dlnode);
2041 break;
2043 dlnode = (struct DevListEntry *) dlnode->node.ln_Succ;
2045 break;
2048 case EHMB_ADDCLASS:
2050 struct ClsListEntry *clnode;
2051 clnode = (struct ClsListEntry *) data->clslist.lh_Head;
2052 while(clnode->node.ln_Succ)
2054 if(clnode->puc == (struct Node *) penparam1)
2056 break;
2058 clnode = (struct ClsListEntry *) clnode->node.ln_Succ;
2060 if(!clnode->node.ln_Succ)
2062 if((clnode = AllocClsEntry(data, (struct Node *) penparam1)))
2064 DoMethod(data->clslistobj, MUIM_List_InsertSingle, clnode, MUIV_List_Insert_Bottom);
2067 break;
2070 case EHMB_REMCLASS:
2072 struct ClsListEntry *clnode;
2073 struct ClsListEntry *tmpnode;
2074 ULONG pos = 0;
2075 set(data->clslistobj, MUIA_List_Quiet, TRUE);
2076 clnode = (struct ClsListEntry *) data->clslist.lh_Head;
2077 while(clnode->node.ln_Succ)
2079 if((clnode->puc == (struct Node *) penparam1) || (!clnode->puc))
2081 clnode->puc = NULL;
2084 DoMethod(data->clslistobj, MUIM_List_GetEntry, pos, &tmpnode);
2085 if(!tmpnode)
2086 break;
2087 if(tmpnode == clnode)
2089 DoMethod(data->clslistobj, MUIM_List_Remove, pos);
2090 break;
2092 pos++;
2093 } while(TRUE);
2094 tmpnode = (struct ClsListEntry *) clnode->node.ln_Succ;
2095 FreeClsEntry(data, clnode);
2096 clnode = tmpnode;
2097 } else {
2098 clnode = (struct ClsListEntry *) clnode->node.ln_Succ;
2101 break;
2104 case EHMB_ADDERRORMSG:
2106 struct ErrListEntry *elnode;
2107 IPTR level;
2109 psdGetAttrs(PGA_ERRORMSG, (APTR) penparam1,
2110 EMA_Level, &level,
2111 TAG_END);
2112 if(level >= data->errorlevel)
2114 if((elnode = psdAllocVec(sizeof(struct ErrListEntry))))
2116 elnode->pem = (struct Node *) penparam1;
2117 AddTail(&data->errlist, &elnode->node);
2118 DoMethod(data->errlistobj, MUIM_List_InsertSingle, elnode, MUIV_List_Insert_Bottom);
2121 break;
2124 case EHMB_CONFIGCHG:
2125 if(!cfgchanged)
2127 psdDelayMS(100);
2128 cfgchanged = TRUE;
2130 break;
2133 ReplyMsg(pen);
2135 if(eventmask & EHMF_REMERRORMSG)
2137 CreateErrorList(data);
2139 if(eventmask & EHMF_ADDERRORMSG)
2141 set(data->errlistobj, MUIA_List_Active, MUIV_List_Active_Bottom);
2143 if(eventmask & (EHMF_ADDBINDING|EHMF_REMBINDING|EHMF_DEVICEDEAD|EHMF_DEVICELOWPW|EHMF_DEVSUSPENDED|EHMF_DEVRESUMED))
2145 DoMethod(data->devlistobj, MUIM_List_Redraw, MUIV_List_Redraw_All);
2146 DoMethod(data->clslistobj, MUIM_List_Redraw, MUIV_List_Redraw_All);
2147 DoMethod(data->selfobj, MUIM_Action_Dev_Activate);
2149 if(eventmask & EHMF_REMDEVICE)
2151 set(data->devlistobj, MUIA_List_Quiet, FALSE);
2153 if(eventmask & EHMF_REMCLASS)
2155 set(data->clslistobj, MUIA_List_Quiet, FALSE);
2157 if(eventmask & (EHMF_ADDCLASS|EHMF_REMCLASS))
2159 set(data->devlistobj, MUIA_ContextMenu, NULL);
2160 MUI_DisposeObject(data->mi_classpopup);
2161 data->mi_classpopup = CreateClassPopup();
2162 set(data->devlistobj, MUIA_ContextMenu, data->mi_classpopup);
2164 if(cfgchanged)
2166 if(!data->swallowconfigevent)
2168 UpdateConfigToGUI(data);
2169 } else {
2170 IPTR oldhash = 0;
2171 IPTR currhash = 0;
2172 psdGetAttrs(PGA_STACK, NULL,
2173 PA_CurrConfigHash, &currhash,
2174 PA_SavedConfigHash, &oldhash,
2175 TAG_END);
2176 set(data->saveobj, MUIA_Disabled, (oldhash == currhash));
2178 data->swallowconfigevent = FALSE;
2181 /* \\\ */
2183 /* /// "UpdateConfigToGUI()" */
2184 void UpdateConfigToGUI(struct ActionData *data)
2186 struct Node *phw;
2187 struct List *lst;
2188 struct HWListEntry *hlnode;
2189 struct Node *puc;
2190 struct ClsListEntry *clnode;
2191 APTR stackcfg;
2192 IPTR bootdelay;
2193 IPTR subtaskpri;
2194 IPTR loginfo;
2195 IPTR logwarn;
2196 IPTR logerr;
2197 IPTR logfail;
2198 IPTR popupnew = 0;
2199 IPTR popupgone = FALSE;
2200 IPTR popupdeath = FALSE;
2201 IPTR popupdelay = 0;
2202 IPTR popupactivate = FALSE;
2203 IPTR popuptofront = TRUE;
2204 IPTR autodisablelp = FALSE;
2205 IPTR autodisabledead = TRUE;
2206 IPTR powersaving = FALSE;
2207 IPTR forcesuspend = FALSE;
2208 IPTR suspendtimeout = 30;
2209 STRPTR devdtxsoundfile = "";
2210 STRPTR devremsoundfile = "";
2211 IPTR prefsversion = 0;
2212 IPTR relversion = 0;
2214 ULONG numclasses = 0;
2215 APTR pic;
2216 APTR subpic;
2217 APTR oldphw;
2218 ULONG curpos = 0;
2219 IPTR selpos = MUIV_List_Active_Off;
2220 IPTR clsselpos = MUIV_List_Active_Off;
2222 get(data->hwlistobj, MUIA_List_Active, &selpos);
2223 get(data->clslistobj, MUIA_List_Active, &clsselpos);
2225 set(data->hwlistobj, MUIA_List_Quiet, TRUE);
2226 DoMethod(data->hwlistobj, MUIM_List_Clear);
2227 set(data->clslistobj, MUIA_List_Quiet, TRUE);
2228 DoMethod(data->clslistobj, MUIM_List_Clear);
2230 oldphw = data->acthlnode ? data->acthlnode->phw : NULL;
2232 // remove all GUI entries first
2233 hlnode = (struct HWListEntry *) data->hwlist.lh_Head;
2234 while(hlnode->node.ln_Succ)
2236 hlnode->phw = NULL;
2237 FreeHWEntry(data, hlnode);
2238 hlnode = (struct HWListEntry *) data->hwlist.lh_Head;
2241 clnode = (struct ClsListEntry *) data->clslist.lh_Head;
2242 while(clnode->node.ln_Succ)
2244 FreeClsEntry(data, clnode);
2245 clnode = (struct ClsListEntry *) data->clslist.lh_Head;
2248 /* get stuff that's online first */
2249 psdGetAttrs(PGA_STACK, NULL,
2250 PA_HardwareList, &lst,
2251 PA_ReleaseVersion, &relversion,
2252 PA_GlobalConfig, &stackcfg,
2253 TAG_END);
2254 phw = lst->lh_Head;
2255 while(phw->ln_Succ)
2257 if((hlnode = AllocHWEntry(data, phw)))
2259 if(phw == oldphw)
2261 selpos = curpos;
2263 DoMethod(data->hwlistobj, MUIM_List_InsertSingle, hlnode, MUIV_List_Insert_Bottom);
2264 curpos++;
2266 phw = phw->ln_Succ;
2269 psdLockReadPBase();
2270 pic = psdFindCfgForm(NULL, IFFFORM_STACKCFG);
2271 /* now check for additional entries that are offline */
2272 subpic = pic ? psdFindCfgForm(pic, IFFFORM_UHWDEVICE) : NULL;
2273 while(subpic)
2275 hlnode = (struct HWListEntry *) data->hwlist.lh_Head;
2276 while(hlnode->node.ln_Succ)
2278 if(psdMatchStringChunk(subpic, IFFCHNK_NAME, hlnode->devname))
2280 ULONG *unitchk = psdGetCfgChunk(subpic, IFFCHNK_UNIT);
2281 if(unitchk && (unitchk[2] == hlnode->unit))
2283 psdFreeVec(unitchk);
2284 break;
2286 psdFreeVec(unitchk);
2289 hlnode = (struct HWListEntry *) hlnode->node.ln_Succ;
2291 if(!hlnode->node.ln_Succ)
2293 if((hlnode = AllocHWEntry(data, NULL)))
2295 ULONG *unitchk = psdGetCfgChunk(subpic, IFFCHNK_UNIT);
2296 if(unitchk)
2298 hlnode->unit = unitchk[2];
2299 psdFreeVec(unitchk);
2301 hlnode->devname = psdGetStringChunk(subpic, IFFCHNK_NAME);
2302 DoMethod(data->hwlistobj, MUIM_List_InsertSingle, hlnode, MUIV_List_Insert_Bottom);
2303 curpos++;
2306 subpic = psdNextCfgForm(subpic);
2309 psdGetAttrs(PGA_STACK, NULL, PA_ClassList, &lst, TAG_END);
2310 puc = lst->lh_Head;
2311 while(puc->ln_Succ)
2313 if((clnode = AllocClsEntry(data, puc)))
2315 numclasses++;
2316 DoMethod(data->clslistobj, MUIM_List_InsertSingle, clnode, MUIV_List_Insert_Bottom);
2318 puc = puc->ln_Succ;
2321 if(stackcfg)
2323 psdGetAttrs(PGA_STACKCFG, stackcfg, GCA_PrefsVersion, &prefsversion, TAG_END);
2325 psdUnlockPBase();
2327 if(relversion > prefsversion)
2329 psdAddErrorMsg(RETURN_WARN, "Trident", "Forcing a DirScan for (new) classes, as you probably updated to a newer version.");
2330 psdSetAttrs(PGA_STACKCFG, stackcfg, GCA_PrefsVersion, relversion, TAG_END);
2331 DoMethod(data->selfobj, MUIM_Action_Cls_Scan);
2333 else if(!(numclasses || data->autoclassesadded))
2335 psdAddErrorMsg(RETURN_WARN, "Trident", "Doing a DirScan for classes, because none were in config.");
2336 DoMethod(data->selfobj, MUIM_Action_Cls_Scan);
2338 data->autoclassesadded = TRUE;
2340 set(data->hwlistobj, MUIA_List_Active, selpos);
2341 set(data->clslistobj, MUIA_List_Active, clsselpos);
2342 set(data->hwlistobj, MUIA_List_Quiet, FALSE);
2343 set(data->devlistobj, MUIA_List_Quiet, FALSE);
2344 set(data->clslistobj, MUIA_List_Quiet, FALSE);
2345 CreatePrefsList(data);
2347 if(stackcfg)
2349 psdGetAttrs(PGA_STACKCFG, stackcfg,
2350 GCA_SubTaskPri, &subtaskpri,
2351 GCA_BootDelay, &bootdelay,
2352 GCA_LogInfo, &loginfo,
2353 GCA_LogWarning, &logwarn,
2354 GCA_LogError, &logerr,
2355 GCA_LogFailure, &logfail,
2356 GCA_PopupDeviceNew, &popupnew,
2357 GCA_PopupDeviceGone, &popupgone,
2358 GCA_PopupDeviceDeath, &popupdeath,
2359 GCA_PopupCloseDelay, &popupdelay,
2360 GCA_PopupActivateWin, &popupactivate,
2361 GCA_PopupWinToFront, &popuptofront,
2362 GCA_InsertionSound, &devdtxsoundfile,
2363 GCA_RemovalSound, &devremsoundfile,
2364 GCA_AutoDisableLP, &autodisablelp,
2365 GCA_AutoDisableDead, &autodisabledead,
2366 GCA_PowerSaving, &powersaving,
2367 GCA_ForceSuspend, &forcesuspend,
2368 GCA_SuspendTimeout, &suspendtimeout,
2369 TAG_END);
2370 nnset(data->cfgtaskpriobj, MUIA_Numeric_Value, subtaskpri);
2371 nnset(data->cfgbootdelayobj, MUIA_Numeric_Value, bootdelay);
2372 nnset(data->cfgloginfoobj, MUIA_Selected, loginfo);
2373 nnset(data->cfglogwarnobj, MUIA_Selected, logwarn);
2374 nnset(data->cfglogerrobj, MUIA_Selected, logerr);
2375 nnset(data->cfglogfailobj, MUIA_Selected, logfail);
2376 nnset(data->cfgpopupnewobj, MUIA_Cycle_Active, popupnew);
2377 nnset(data->cfgpopupgoneobj, MUIA_Selected, popupgone);
2378 nnset(data->cfgpopupdeathobj, MUIA_Selected, popupdeath);
2379 nnset(data->cfgpopupdelayobj, MUIA_Numeric_Value, popupdelay);
2380 nnset(data->cfgpopupactivateobj, MUIA_Selected, popupactivate);
2381 nnset(data->cfgpopuptofrontobj, MUIA_Selected, popuptofront);
2382 nnset(data->cfgdevdtxsoundobj, MUIA_String_Contents, devdtxsoundfile);
2383 nnset(data->cfgdevremsoundobj, MUIA_String_Contents, devremsoundfile);
2384 nnset(data->cfgautolpobj, MUIA_Selected, autodisablelp);
2385 nnset(data->cfgautodeadobj, MUIA_Selected, autodisabledead);
2386 nnset(data->cfgpowersavingobj, MUIA_Selected, powersaving);
2387 nnset(data->cfgforcesuspendobj, MUIA_Selected, forcesuspend);
2388 nnset(data->cfgsuspendtimeoutobj, MUIA_Numeric_Value, suspendtimeout);
2391 /* \\\ */
2393 Object *MyTextObject(char *Text,char *Help)
2395 Object *obj;
2396 obj = TextObject,
2397 MUIA_ShortHelp, Help,
2398 ButtonFrame,
2399 MUIA_Background, MUII_ButtonBack,
2400 MUIA_CycleChain, 1,
2401 MUIA_InputMode, MUIV_InputMode_RelVerify,
2402 MUIA_Text_Contents, Text,
2403 End;
2405 return(obj);
2408 Object *MyTextObjectDisabled(char *Text,char *Help)
2410 Object *obj;
2411 obj = TextObject,
2412 MUIA_ShortHelp, Help,
2413 ButtonFrame,
2414 MUIA_Background, MUII_ButtonBack,
2415 MUIA_CycleChain, 1,
2416 MUIA_InputMode, MUIV_InputMode_RelVerify,
2417 MUIA_Text_Contents, Text,
2418 MUIA_Disabled, TRUE,
2419 End;
2421 return(obj);
2424 /* /// "Action_OM_NEW()" */
2425 Object * Action_OM_NEW(struct IClass *cl, Object *obj, Msg msg)
2427 struct ActionData *data;
2429 IPTR bootdelay = 0;
2430 IPTR subtaskpri = 5;
2431 IPTR loginfo = TRUE;
2432 IPTR logwarn = TRUE;
2433 IPTR logerr = TRUE;
2434 IPTR logfail = TRUE;
2435 IPTR popupnew = 0;
2436 IPTR popupgone = FALSE;
2437 IPTR popupdeath = FALSE;
2438 IPTR popupdelay = 0;
2439 IPTR popupactivate = FALSE;
2440 IPTR popuptofront = TRUE;
2441 IPTR autodisablelp = FALSE;
2442 IPTR autodisabledead = FALSE;
2443 IPTR autorestartdead = TRUE;
2444 IPTR powersaving = FALSE;
2445 IPTR forcesuspend = FALSE;
2446 IPTR suspendtimeout = 30;
2447 STRPTR devdtxsoundfile = "";
2448 STRPTR devremsoundfile = "";
2449 APTR stackcfg = NULL;
2450 STRPTR aimeemsg;
2451 APTR pd = NULL;
2452 struct DevListEntry *dlnode;
2454 mainpanels[0] = _(MSG_MAINPANEL_GENERAL);
2455 mainpanels[1] = _(MSG_MAINPANEL_CONTROLLERS);
2456 mainpanels[2] = _(MSG_MAINPANEL_DEVICES);
2457 mainpanels[3] = _(MSG_MAINPANEL_CLASSES);
2458 mainpanels[4] = _(MSG_MAINPANEL_OPTIONS);
2459 mainpanels[5] = _(MSG_MAINPANEL_POPUPS);
2460 mainpanels[6] = _(MSG_MAINPANEL_CONFIG);
2462 errlvlstrings[0] = _(MSG_ERRLVL_ALL);
2463 errlvlstrings[1] = _(MSG_ERRLVL_WARNINGS);
2464 errlvlstrings[2] = _(MSG_ERRLVL_ERRORS);
2465 errlvlstrings[3] = _(MSG_ERRLVL_FAILURES);
2467 popupnewdevicestrings[0] = _(MSG_POPUP_NEVER);
2468 popupnewdevicestrings[1] = _(MSG_POPUP_ERROR);
2469 popupnewdevicestrings[2] = _(MSG_POPUP_UNKNOWN);
2470 popupnewdevicestrings[3] = _(MSG_POPUP_NOBINDING);
2471 popupnewdevicestrings[4] = _(MSG_POPUP_NOCONFIG);
2472 popupnewdevicestrings[5] = _(MSG_POPUP_CONFIGCLASS);
2473 popupnewdevicestrings[6] = _(MSG_POPUP_BINDING);
2474 popupnewdevicestrings[7] = _(MSG_POPUP_ALWAYS);
2476 if(!(obj = (Object *) DoSuperMethodA(cl, obj, msg)))
2477 return(0);
2479 data = INST_DATA(cl, obj);
2480 data->selfobj = obj;
2481 NewList(&data->hwlist);
2482 NewList(&data->devlist);
2483 NewList(&data->clslist);
2484 NewList(&data->errlist);
2485 NewList(&data->prefslist);
2487 data->acthlnode = NULL;
2488 data->errorlevel = 0;
2489 data->HardwareDisplayHook.h_Data = data;
2490 data->DeviceDisplayHook.h_Data = data;
2491 data->ClassDisplayHook.h_Data = data;
2492 data->ErrorDisplayHook.h_Data = data;
2493 data->IconDisplayHook.h_Data = data;
2494 data->PrefsDisplayHook.h_Data = data;
2496 data->HardwareDisplayHook.h_Entry = (APTR) HardwareListDisplayHook;
2497 data->DeviceDisplayHook.h_Entry = (APTR) DeviceListDisplayHook;
2498 data->ClassDisplayHook.h_Entry = (APTR) ClassListDisplayHook;
2499 data->ErrorDisplayHook.h_Entry = (APTR) ErrorListDisplayHook;
2500 data->IconDisplayHook.h_Entry = (APTR) IconListDisplayHook;
2501 data->PrefsDisplayHook.h_Entry = (APTR) PrefsListDisplayHook;
2503 aimeemsg = aimeelyrics[(((IPTR) aimeelyrics) / 333) & 31];
2505 /* get current global config */
2506 psdGetAttrs(PGA_STACK, NULL, PA_GlobalConfig, &stackcfg, TAG_END);
2507 if(stackcfg)
2509 psdGetAttrs(PGA_STACKCFG, stackcfg,
2510 GCA_SubTaskPri, &subtaskpri,
2511 GCA_BootDelay, &bootdelay,
2512 GCA_LogInfo, &loginfo,
2513 GCA_LogWarning, &logwarn,
2514 GCA_LogError, &logerr,
2515 GCA_LogFailure, &logfail,
2516 GCA_PopupDeviceNew, &popupnew,
2517 GCA_PopupDeviceGone, &popupgone,
2518 GCA_PopupDeviceDeath, &popupdeath,
2519 GCA_PopupCloseDelay, &popupdelay,
2520 GCA_PopupActivateWin, &popupactivate,
2521 GCA_PopupWinToFront, &popuptofront,
2522 GCA_InsertionSound, &devdtxsoundfile,
2523 GCA_RemovalSound, &devremsoundfile,
2524 GCA_AutoDisableLP, &autodisablelp,
2525 GCA_AutoDisableDead, &autodisabledead,
2526 GCA_AutoRestartDead, &autorestartdead,
2527 GCA_PowerSaving, &powersaving,
2528 GCA_ForceSuspend, &forcesuspend,
2529 GCA_SuspendTimeout, &suspendtimeout,
2530 TAG_END);
2533 /* General panel */
2534 data->cfgcntobj[0] = ScrollgroupObject,
2535 MUIA_HelpNode, "tridentgeneral",
2536 MUIA_Scrollgroup_Contents, VirtgroupObject,
2537 Child, VGroup,
2538 Child, VSpace(0),
2539 Child, HGroup,
2540 Child, HSpace(0),
2541 Child, HGroup,
2542 Child, VGroup,
2543 Child, BodychunkObject,
2544 MUIA_ShortHelp, __(MSG_POSEIDON_SHORTHELP),
2545 MUIA_Bitmap_SourceColors, neptune8_colors,
2546 MUIA_FixWidth, NEPTUNE8_WIDTH,
2547 MUIA_FixHeight, NEPTUNE8_HEIGHT,
2548 MUIA_Bitmap_Width, NEPTUNE8_WIDTH,
2549 MUIA_Bitmap_Height, NEPTUNE8_HEIGHT,
2550 MUIA_Bodychunk_Depth, NEPTUNE8_DEPTH,
2551 MUIA_Bodychunk_Body, neptune8_body,
2552 MUIA_Bodychunk_Compression, NEPTUNE8_COMPRESSION,
2553 MUIA_Bodychunk_Masking, NEPTUNE8_MASKING,
2554 MUIA_Bitmap_Transparent, 0,
2555 MUIA_Bitmap_UseFriend, TRUE,
2556 MUIA_Bitmap_Precision, PRECISION_ICON,
2557 End,
2558 Child, VSpace(0),
2559 End,
2560 Child, VGroup,
2561 Child, VSpace(0),
2562 Child, Label(__(MSG_PANEL_GENERAL_LABEL1)),
2563 Child, Label(__(MSG_PANEL_GENERAL_LABEL2)),
2564 Child, VSpace(20),
2565 Child, Label(__(MSG_PANEL_GENERAL_LABEL3)),
2566 Child, Label(__(MSG_PANEL_GENERAL_LABEL4)),
2567 Child, VSpace(20),
2568 Child, Label(__(MSG_PANEL_GENERAL_LABEL5)),
2569 Child, VSpace(0),
2570 End,
2571 End,
2572 Child, HSpace(0),
2573 End,
2574 Child, VSpace(20),
2575 Child, HGroup,
2576 Child, HSpace(0),
2577 Child, Label(aimeemsg),
2578 Child, HSpace(0),
2579 End,
2580 Child, VSpace(0),
2581 End,
2582 End,
2583 End;
2585 /* Hardware panel */
2586 data->cfgcntobj[1] = VGroup,
2587 MUIA_HelpNode, "tridenthardware",
2588 Child, Label(__(MSG_PANEL_HARDWARE_LABEL1)),
2589 Child, ListviewObject,
2590 MUIA_CycleChain, 1,
2591 MUIA_ShortHelp, __(MSG_PANEL_HARDWARE_CONTROLLER_HELP),
2592 MUIA_Listview_List, data->hwlistobj =
2593 NewObject(IconListClass->mcc_Class, 0, InputListFrame, MUIA_List_MinLineHeight, 16, MUIA_List_Format, "BAR,BAR,BAR,", MUIA_List_Title, TRUE, MUIA_List_DisplayHook, &data->HardwareDisplayHook, TAG_END),
2594 End,
2595 Child, data->hwdevgrpobj = HGroup,
2596 MUIA_Disabled, TRUE,
2597 Child, Label(__(MSG_PANEL_HARDWARE_LABEL2)),
2598 Child, data->hwdevaslobj = PopaslObject,
2599 MUIA_CycleChain, 1,
2600 MUIA_ShortHelp, __(MSG_PANEL_HARDWARE_DEVICE_HELP),
2601 MUIA_Popstring_String, data->hwdevobj = StringObject,
2602 StringFrame,
2603 MUIA_CycleChain, 1,
2604 MUIA_String_AdvanceOnCR, TRUE,
2605 End,
2606 MUIA_Popstring_Button, PopButton(MUII_PopFile),
2607 ASLFR_TitleText, __(MSG_PANEL_HARDWARE_SELECT),
2608 End,
2609 Child, Label(__(MSG_PANEL_HARDWARE_UNIT)),
2610 Child, data->hwunitobj = StringObject,
2611 MUIA_ShortHelp, __(MSG_PANEL_HARDWARE_UNIT_HELP),
2612 StringFrame,
2613 MUIA_HorizWeight, 10,
2614 MUIA_CycleChain, 1,
2615 MUIA_String_AdvanceOnCR, TRUE,
2616 MUIA_String_Integer, 0,
2617 MUIA_String_Accept, "0123456789",
2618 End,
2619 End,
2620 Child, ColGroup(3),
2621 MUIA_Group_SameWidth, TRUE,
2622 Child, data->hwnewobj = MyTextObject(_(MSG_PANEL_HARDWARE_DRIVER_NEW),_(MSG_PANEL_HARDWARE_DRIVER_NEW_HELP)),
2623 Child, data->hwcopyobj = MyTextObject(_(MSG_PANEL_HARDWARE_DRIVER_COPY),_(MSG_PANEL_HARDWARE_DRIVER_COPY_HELP)),
2624 Child, data->hwdelobj = MyTextObject(_(MSG_PANEL_HARDWARE_DRIVER_DELETE),_(MSG_PANEL_HARDWARE_DRIVER_DELETE_HELP)),
2625 Child, data->hwonlineobj = MyTextObject(_(MSG_PANEL_HARDWARE_DRIVER_ONLINE),_(MSG_PANEL_HARDWARE_DRIVER_ONLINE_HELP)),
2626 Child, data->hwofflineobj = MyTextObject(_(MSG_PANEL_HARDWARE_DRIVER_OFFLINE),_(MSG_PANEL_HARDWARE_DRIVER_OFFLINE_HELP)),
2627 Child, data->hwinfoobj = MyTextObject(_(MSG_PANEL_HARDWARE_DRIVER_INFO),_(MSG_PANEL_HARDWARE_DRIVER_INFO_HELP)),
2628 End,
2629 End;
2631 /* Devices panel */
2632 data->cfgcntobj[2] = VGroup,
2633 MUIA_HelpNode, "tridentdevices",
2634 Child, Label(__(MSG_PANEL_DEVICES_LABEL)),
2635 Child, ListviewObject,
2636 MUIA_CycleChain, 1,
2637 MUIA_Listview_List, data->devlistobj =
2638 NewObject(IconListClass->mcc_Class, 0, MUIA_ShortHelp, __(MSG_PANEL_DEVICES_HELP), InputListFrame, MUIA_List_MinLineHeight, 16, MUIA_List_Format, "BAR,BAR,BAR,BAR,", MUIA_List_Title, TRUE, MUIA_List_DisplayHook, &data->DeviceDisplayHook, TAG_END),
2639 End,
2640 Child, ColGroup(4),
2641 MUIA_Group_SameWidth, TRUE,
2642 Child, data->devbindobj = MyTextObject(_(MSG_PANEL_DEVICES_SCAN),_(MSG_PANEL_DEVICES_SCAN_HELP)),
2643 Child, data->devunbindobj = MyTextObjectDisabled(_(MSG_PANEL_DEVICES_UNBIND),_(MSG_PANEL_DEVICES_UNBIND_HELP)),
2644 Child, data->devinfoobj = MyTextObject(_(MSG_PANEL_DEVICES_INFO),_(MSG_PANEL_DEVICES_INFO_HELP)),
2645 Child, data->devcfgobj = MyTextObjectDisabled(_(MSG_PANEL_DEVICES_SETTINGS),_(MSG_PANEL_DEVICES_SETTINGS_HELP)),
2646 Child, data->devsuspendobj = MyTextObjectDisabled(_(MSG_PANEL_DEVICES_SUSPEND),_(MSG_PANEL_DEVICES_SUSPEND_HELP)),
2647 Child, data->devresumeobj = MyTextObjectDisabled(_(MSG_PANEL_DEVICES_RESUME),_(MSG_PANEL_DEVICES_RESUME_HELP)),
2648 Child, data->devpowercycleobj = MyTextObjectDisabled(_(MSG_PANEL_DEVICES_POWERCYCLE),_(MSG_PANEL_DEVICES_POWERCYCLE_HELP)),
2649 Child, data->devdisableobj = MyTextObjectDisabled(_(MSG_PANEL_DEVICES_DISABLE),_(MSG_PANEL_DEVICES_DISABLE_HELP)),
2650 End,
2651 End;
2653 /* Classes panel */
2654 data->cfgcntobj[3] = VGroup,
2655 MUIA_HelpNode, "tridentclasses",
2656 Child, Label(__(MSG_PANEL_CLASSES)),
2657 Child, data->clslistobj = ListviewObject,
2658 MUIA_CycleChain, 1,
2659 MUIA_Listview_List, ListObject,
2660 MUIA_ShortHelp, __(MSG_PANEL_CLASSES_HELP),
2661 InputListFrame,
2662 MUIA_List_Format, "BAR,BAR,",
2663 MUIA_List_Title, TRUE,
2664 MUIA_List_DisplayHook, &data->ClassDisplayHook,
2665 End,
2666 End,
2667 Child, HGroup,
2668 Child, Label(__(MSG_PANEL_CLASSES_LABEL)),
2669 Child, PopaslObject,
2670 MUIA_CycleChain, 1,
2671 MUIA_ShortHelp, __(MSG_PANEL_CLASSES_LABEL_HELP),
2672 MUIA_Popstring_String, data->clsnameobj = StringObject,
2673 StringFrame,
2674 MUIA_CycleChain, 1,
2675 MUIA_String_AdvanceOnCR, TRUE,
2676 MUIA_String_Contents, CLASSPATH "/",
2677 End,
2678 MUIA_Popstring_Button, PopButton(MUII_PopFile),
2679 ASLFR_TitleText, __(MSG_PANEL_CLASSES_SELECT),
2680 End,
2681 End,
2682 Child, HGroup,
2683 MUIA_Group_SameWidth, TRUE,
2684 Child, data->clsaddobj = MyTextObject(_(MSG_PANEL_CLASSES_ADD),_(MSG_PANEL_CLASSES_ADD_HELP)),
2685 Child, data->clsremobj = MyTextObjectDisabled(_(MSG_PANEL_CLASSES_REMOVE),_(MSG_PANEL_CLASSES_REMOVE_HELP)),
2686 Child, data->clscfgobj = MyTextObjectDisabled(_(MSG_PANEL_CLASSES_CONFIG),_(MSG_PANEL_CLASSES_CONFIG_HELP)),
2687 Child, data->clsscanobj = MyTextObject(_(MSG_PANEL_CLASSES_SCAN),_(MSG_PANEL_CLASSES_SCAN_HELP)),
2688 End,
2689 End;
2691 /* Options panel */
2692 data->cfgcntobj[4] = VGroup,
2693 MUIA_HelpNode, "tridentoptions",
2694 Child, Label(__(MSG_PANEL_OPTIONS)),
2695 Child, VSpace(0),
2696 Child, VGroup, GroupFrameT(__(MSG_PANEL_OPTIONS_STACK)),
2697 Child, VSpace(0),
2698 Child, HGroup,
2699 Child, Label(__(MSG_PANEL_OPTIONS_PRIORITY)),
2700 Child, data->cfgtaskpriobj = SliderObject, SliderFrame,
2701 MUIA_ShortHelp, __(MSG_PANEL_OPTIONS_PRIORITY_HELP),
2702 MUIA_CycleChain, 1,
2703 MUIA_Numeric_Min, 0,
2704 MUIA_Numeric_Max, 127,
2705 MUIA_Numeric_Value, subtaskpri,
2706 End,
2707 Child, Label(__(MSG_PANEL_OPTIONS_BOOT)),
2708 Child, data->cfgbootdelayobj = SliderObject, SliderFrame,
2709 MUIA_ShortHelp, __(MSG_PANEL_OPTIONS_BOOT_HELP),
2710 MUIA_CycleChain, 1,
2711 MUIA_Numeric_Min, 0,
2712 MUIA_Numeric_Max, 15,
2713 MUIA_Numeric_Value, bootdelay,
2714 MUIA_Numeric_Format,__(MSG_PANEL_OPTIONS_BOOT_FORMAT),
2715 End,
2716 End,
2717 Child, ColGroup(2),
2718 Child, HGroup,
2719 Child, HSpace(0),
2720 Child, Label(__(MSG_PANEL_OPTIONS_DISABLELOW)),
2721 End,
2722 Child, data->cfgautolpobj = ImageObject, ImageButtonFrame,
2723 MUIA_ShortHelp, __(MSG_PANEL_OPTIONS_DISABLELOW_HELP),
2724 MUIA_Background, MUII_ButtonBack,
2725 MUIA_CycleChain, 1,
2726 MUIA_InputMode, MUIV_InputMode_Toggle,
2727 MUIA_Image_Spec, MUII_CheckMark,
2728 MUIA_Image_FreeVert, TRUE,
2729 MUIA_Selected, autodisablelp,
2730 MUIA_ShowSelState, FALSE,
2731 End,
2732 Child, HGroup,
2733 Child, HSpace(0),
2734 Child, Label(__(MSG_PANEL_OPTIONS_DISABLEDEAD)),
2735 End,
2736 Child, data->cfgautodeadobj = ImageObject, ImageButtonFrame,
2737 MUIA_ShortHelp,__(MSG_PANEL_OPTIONS_DISABLEDEAD_HELP),
2738 MUIA_Background, MUII_ButtonBack,
2739 MUIA_CycleChain, 1,
2740 MUIA_InputMode, MUIV_InputMode_Toggle,
2741 MUIA_Image_Spec, MUII_CheckMark,
2742 MUIA_Image_FreeVert, TRUE,
2743 MUIA_Selected, autodisabledead,
2744 MUIA_Disabled, autorestartdead,
2745 MUIA_ShowSelState, FALSE,
2746 End,
2747 Child, HGroup,
2748 Child, HSpace(0),
2749 Child, Label(__(MSG_PANEL_OPTIONS_POWERCYCLE)),
2750 End,
2751 Child, data->cfgautopcobj = ImageObject, ImageButtonFrame,
2752 MUIA_ShortHelp,__(MSG_PANEL_OPTIONS_POWERCYCLE_HELP),
2753 MUIA_Background, MUII_ButtonBack,
2754 MUIA_CycleChain, 1,
2755 MUIA_InputMode, MUIV_InputMode_Toggle,
2756 MUIA_Image_Spec, MUII_CheckMark,
2757 MUIA_Image_FreeVert, TRUE,
2758 MUIA_Selected, autorestartdead,
2759 MUIA_ShowSelState, FALSE,
2760 End,
2761 Child, HGroup,
2762 Child, HSpace(0),
2763 Child, Label(__(MSG_PANEL_OPTIONS_POWERSAVE)),
2764 End,
2765 Child, data->cfgpowersavingobj = ImageObject, ImageButtonFrame,
2766 MUIA_ShortHelp, __(MSG_PANEL_OPTIONS_POWERSAVE_HELP),
2767 MUIA_Background, MUII_ButtonBack,
2768 MUIA_CycleChain, 1,
2769 MUIA_InputMode, MUIV_InputMode_Toggle,
2770 MUIA_Image_Spec, MUII_CheckMark,
2771 MUIA_Image_FreeVert, TRUE,
2772 MUIA_Selected, powersaving,
2773 MUIA_ShowSelState, FALSE,
2774 End,
2775 Child, HGroup,
2776 Child, HSpace(0),
2777 Child, Label(__(MSG_PANEL_OPTIONS_FORCESUSPEND)),
2778 End,
2779 Child, data->cfgforcesuspendobj = ImageObject, ImageButtonFrame,
2780 MUIA_ShortHelp, __(MSG_PANEL_OPTIONS_FORCESUSPEND_HELP),
2781 MUIA_Background, MUII_ButtonBack,
2782 MUIA_CycleChain, 1,
2783 MUIA_InputMode, MUIV_InputMode_Toggle,
2784 MUIA_Image_Spec, MUII_CheckMark,
2785 MUIA_Image_FreeVert, TRUE,
2786 MUIA_Selected, forcesuspend,
2787 MUIA_ShowSelState, FALSE,
2788 End,
2789 End,
2790 Child, HGroup,
2791 Child, Label(__(MSG_PANEL_OPTIONS_INACTIVITY)),
2792 Child, data->cfgsuspendtimeoutobj = SliderObject, SliderFrame,
2793 MUIA_ShortHelp, __(MSG_PANEL_OPTIONS_INACTIVITY_HELP),
2794 MUIA_CycleChain, 1,
2795 MUIA_Numeric_Min, 5,
2796 MUIA_Numeric_Max, 600,
2797 MUIA_Numeric_Value, suspendtimeout,
2798 MUIA_Numeric_Format, __(MSG_PANEL_OPTIONS_INACTIVITY_FORMAT),
2799 End,
2800 End,
2801 Child, VSpace(0),
2802 End,
2803 Child, VSpace(0),
2804 Child, VGroup, GroupFrameT(__(MSG_PANEL_OPTIONS_LOGGING)),
2805 Child, VSpace(0),
2806 Child, HGroup,
2807 Child, HSpace(0),
2808 Child, ColGroup(4),
2809 Child, HGroup,
2810 Child, HSpace(0),
2811 Child, Label(__(MSG_PANEL_OPTIONS_LOGGING_LABEL)),
2812 End,
2813 Child, data->cfgloginfoobj = ImageObject, ImageButtonFrame,
2814 MUIA_ShortHelp,__(MSG_PANEL_OPTIONS_LOGGING_LABEL_HELP),
2815 MUIA_Background, MUII_ButtonBack,
2816 MUIA_CycleChain, 1,
2817 MUIA_InputMode, MUIV_InputMode_Toggle,
2818 MUIA_Image_Spec, MUII_CheckMark,
2819 MUIA_Image_FreeVert, TRUE,
2820 MUIA_Selected, loginfo,
2821 MUIA_ShowSelState, FALSE,
2822 End,
2823 Child, HGroup,
2824 Child, HSpace(0),
2825 Child, Label(__(MSG_PANEL_OPTIONS_LOGGING_WARN)),
2826 End,
2827 Child, data->cfglogwarnobj = ImageObject, ImageButtonFrame,
2828 MUIA_ShortHelp, __(MSG_PANEL_OPTIONS_LOGGING_WARN_HELP),
2829 MUIA_Background, MUII_ButtonBack,
2830 MUIA_CycleChain, 1,
2831 MUIA_InputMode, MUIV_InputMode_Toggle,
2832 MUIA_Image_Spec, MUII_CheckMark,
2833 MUIA_Image_FreeVert, TRUE,
2834 MUIA_Selected, logwarn,
2835 MUIA_ShowSelState, FALSE,
2836 End,
2837 Child, HGroup,
2838 Child, HSpace(0),
2839 Child, Label(__(MSG_PANEL_OPTIONS_LOGGING_ERR)),
2840 End,
2841 Child, data->cfglogerrobj = ImageObject, ImageButtonFrame,
2842 MUIA_ShortHelp, __(MSG_PANEL_OPTIONS_LOGGING_ERR_HELP),
2843 MUIA_Background, MUII_ButtonBack,
2844 MUIA_CycleChain, 1,
2845 MUIA_InputMode, MUIV_InputMode_Toggle,
2846 MUIA_Image_Spec, MUII_CheckMark,
2847 MUIA_Image_FreeVert, TRUE,
2848 MUIA_Selected, logerr,
2849 MUIA_ShowSelState, FALSE,
2850 End,
2851 Child, HGroup,
2852 Child, HSpace(0),
2853 Child, Label(__(MSG_PANEL_OPTIONS_LOGGING_FAIL)),
2854 End,
2855 Child, data->cfglogfailobj = ImageObject, ImageButtonFrame,
2856 MUIA_ShortHelp, __(MSG_PANEL_OPTIONS_LOGGING_FAIL_HELP),
2857 MUIA_Background, MUII_ButtonBack,
2858 MUIA_CycleChain, 1,
2859 MUIA_InputMode, MUIV_InputMode_Toggle,
2860 MUIA_Image_Spec, MUII_CheckMark,
2861 MUIA_Image_FreeVert, TRUE,
2862 MUIA_Selected, logfail,
2863 MUIA_ShowSelState, FALSE,
2864 End,
2865 End,
2866 Child, HSpace(0),
2867 End,
2868 Child, VSpace(0),
2869 End,
2870 Child, VSpace(0),
2871 Child, HGroup,
2872 Child, HSpace(0),
2873 Child, Label(__(MSG_PANEL_OPTIONS_MEMORY)),
2874 Child, data->mempoolobj = TextObject,
2875 MUIA_Text_Contents, "?",
2876 End,
2877 Child, HSpace(0),
2878 End,
2879 End;
2881 /* PoPo panel */
2882 data->cfgcntobj[5] = VGroup,
2883 MUIA_HelpNode, "tridentpopups",
2884 Child, Label(__(MSG_PANEL_POPO)),
2885 Child, VSpace(0),
2886 Child, VGroup, GroupFrameT(__(MSG_PANEL_POPO_LABEL)),
2887 Child, VSpace(0),
2888 Child, ColGroup(2),
2889 Child, Label(__(MSG_PANEL_POPO_CONNECT)),
2890 Child, HGroup,
2891 Child, data->cfgpopupnewobj = CycleObject,
2892 MUIA_ShortHelp, __(MSG_PANEL_POPO_CONNECT_HELP),
2893 MUIA_CycleChain, 1,
2894 MUIA_Cycle_Entries, popupnewdevicestrings,
2895 MUIA_Cycle_Active, popupnew,
2896 End,
2897 End,
2898 Child, Label(__(MSG_PANEL_POPO_DISCONNECT)),
2899 Child, HGroup,
2900 Child, data->cfgpopupgoneobj = ImageObject, ImageButtonFrame,
2901 MUIA_ShortHelp, _(MSG_PANEL_POPO_DISCONNECT_HELP),
2902 MUIA_Background, MUII_ButtonBack,
2903 MUIA_CycleChain, 1,
2904 MUIA_InputMode, MUIV_InputMode_Toggle,
2905 MUIA_Image_Spec, MUII_CheckMark,
2906 MUIA_Image_FreeVert, TRUE,
2907 MUIA_Selected, popupgone,
2908 MUIA_ShowSelState, FALSE,
2909 End,
2910 Child, HSpace(0),
2911 Child, Label(__(MSG_PANEL_POPO_DEATH)),
2912 Child, data->cfgpopupdeathobj = ImageObject, ImageButtonFrame,
2913 MUIA_ShortHelp, __(MSG_PANEL_POPO_DEATH_HELP),
2914 MUIA_Background, MUII_ButtonBack,
2915 MUIA_CycleChain, 1,
2916 MUIA_InputMode, MUIV_InputMode_Toggle,
2917 MUIA_Image_Spec, MUII_CheckMark,
2918 MUIA_Image_FreeVert, TRUE,
2919 MUIA_Selected, popupdeath,
2920 MUIA_ShowSelState, FALSE,
2921 End,
2922 End,
2923 Child, Label(__(MSG_PANEL_POPO_DELAY)),
2924 Child, data->cfgpopupdelayobj = SliderObject, SliderFrame,
2925 MUIA_ShortHelp, __(MSG_PANEL_POPO_DELAY_HELP),
2926 MUIA_CycleChain, 1,
2927 MUIA_Numeric_Min, 0,
2928 MUIA_Numeric_Max, 25,
2929 MUIA_Numeric_Value, popupdelay,
2930 MUIA_Numeric_Format, __(MSG_PANEL_POPO_DELAY_FORMAT),
2931 End,
2932 Child, Label(__(MSG_PANEL_POPO_ACTIVATE)),
2933 Child, HGroup,
2934 Child, data->cfgpopupactivateobj = ImageObject, ImageButtonFrame,
2935 MUIA_ShortHelp, __(MSG_PANEL_POPO_ACTIVATE_HELP),
2936 MUIA_Background, MUII_ButtonBack,
2937 MUIA_CycleChain, 1,
2938 MUIA_InputMode, MUIV_InputMode_Toggle,
2939 MUIA_Image_Spec, MUII_CheckMark,
2940 MUIA_Image_FreeVert, TRUE,
2941 MUIA_Selected, popupactivate,
2942 MUIA_ShowSelState, FALSE,
2943 End,
2944 Child, HSpace(0),
2945 Child, Label(__(MSG_PANEL_POPO_TOFRONT)),
2946 Child, data->cfgpopuptofrontobj = ImageObject, ImageButtonFrame,
2947 MUIA_ShortHelp, __(MSG_PANEL_POPO_TOFRONT_HELP),
2948 MUIA_Background, MUII_ButtonBack,
2949 MUIA_CycleChain, 1,
2950 MUIA_InputMode, MUIV_InputMode_Toggle,
2951 MUIA_Image_Spec, MUII_CheckMark,
2952 MUIA_Image_FreeVert, TRUE,
2953 MUIA_Selected, popuptofront,
2954 MUIA_ShowSelState, FALSE,
2955 End,
2956 End,
2957 Child, Label(__(MSG_PANEL_POPO_CONSOUND)),
2958 Child, PopaslObject,
2959 MUIA_CycleChain, 1,
2960 MUIA_ShortHelp, __(MSG_PANEL_POPO_CONSOUND_HELP),
2961 MUIA_Popstring_String, data->cfgdevdtxsoundobj = StringObject,
2962 StringFrame,
2963 MUIA_CycleChain, 1,
2964 MUIA_String_AdvanceOnCR, TRUE,
2965 MUIA_String_Contents, devdtxsoundfile,
2966 End,
2967 MUIA_Popstring_Button, PopButton(MUII_PopFile),
2968 ASLFR_TitleText, __(MSG_PANEL_POPO_CONSOUND_SELECT),
2969 End,
2970 Child, Label(__(MSG_PANEL_POPO_DISCONSOUND)),
2971 Child, PopaslObject,
2972 MUIA_CycleChain, 1,
2973 MUIA_ShortHelp, __(MSG_PANEL_POPO_DISCONSOUND_HELP),
2974 MUIA_Popstring_String, data->cfgdevremsoundobj = StringObject,
2975 StringFrame,
2976 MUIA_CycleChain, 1,
2977 MUIA_String_AdvanceOnCR, TRUE,
2978 MUIA_String_Contents, devremsoundfile,
2979 End,
2980 MUIA_Popstring_Button, PopButton(MUII_PopFile),
2981 ASLFR_TitleText, __(MSG_PANEL_POPO_DISCONSOUND_SELECT),
2982 End,
2983 End,
2984 Child, VSpace(0),
2985 End,
2986 Child, VSpace(0),
2987 End;
2989 /* Configuration panel */
2990 data->cfgcntobj[6] = VGroup,
2991 MUIA_HelpNode, "tridentconfig",
2992 Child, Label(__(MSG_PANEL_CONFIG)),
2993 Child, data->prefslistobj = ListviewObject,
2994 MUIA_CycleChain, 1,
2995 MUIA_ShortHelp, __(MSG_PANEL_CONFIG_HELP),
2996 MUIA_Listview_DragType, MUIV_Listview_DragType_Immediate,
2997 MUIA_Listview_List,
2998 NewObject(CfgListClass->mcc_Class, 0, InputListFrame, MUIA_List_Format, "BAR,BAR,BAR,", MUIA_List_Title, TRUE, MUIA_List_DisplayHook, &data->PrefsDisplayHook, MUIA_List_ShowDropMarks, TRUE, MUIA_List_AutoVisible, TRUE, TAG_END),
2999 End,
3000 Child, HGroup,
3001 MUIA_Group_SameWidth, TRUE,
3002 Child, data->prefssaveasobj = MyTextObject(_(MSG_PANEL_CONFIG_SAVEAS),_(MSG_PANEL_CONFIG_SAVEAS_HELP)),
3003 Child, data->prefsexportobj = MyTextObjectDisabled(_(MSG_PANEL_CONFIG_EXPORT),_(MSG_PANEL_CONFIG_EXPORT_HELP)),
3004 Child, data->prefsimportobj = MyTextObject(_(MSG_PANEL_CONFIG_IMPORT),_(MSG_PANEL_CONFIG_IMPORT_HELP)),
3005 Child, data->prefsremoveobj = MyTextObjectDisabled(_(MSG_PANEL_CONFIG_REMOVE),_(MSG_PANEL_CONFIG_REMOVE_HELP)),
3006 End,
3007 End;
3009 data->mainobj = VGroup,
3010 Child, HGroup,
3011 Child, ListviewObject,
3012 MUIA_CycleChain, 1,
3013 MUIA_ShowMe, !registermode,
3014 MUIA_Listview_MultiSelect, MUIV_Listview_MultiSelect_None,
3015 MUIA_Listview_List, data->cfgpagelv =
3016 NewObject(IconListClass->mcc_Class, 0, InputListFrame, MUIA_List_MinLineHeight, 16, MUIA_List_SourceArray, mainpanels, MUIA_List_AdjustWidth, TRUE, MUIA_List_Active, 0, MUIA_List_DisplayHook, &data->IconDisplayHook, TAG_END),
3017 End,
3018 Child, VGroup,
3019 /*ReadListFrame,*/
3020 /*MUIA_Background, MUII_GroupBack,*/
3021 Child, data->cfgpagegrp = (registermode ?
3022 (RegisterGroup(mainpanels),
3023 MUIA_CycleChain, 1,
3024 MUIA_Register_Frame, TRUE,
3025 Child, data->cfgcntobj[0],
3026 Child, data->cfgcntobj[1],
3027 Child, data->cfgcntobj[2],
3028 Child, data->cfgcntobj[3],
3029 Child, data->cfgcntobj[4],
3030 Child, data->cfgcntobj[5],
3031 Child, data->cfgcntobj[6],
3032 End) :
3033 (VGroup,
3034 MUIA_Group_PageMode, TRUE,
3035 MUIA_Group_ActivePage, MUIV_Group_ActivePage_First,
3036 Child, data->cfgcntobj[0],
3037 Child, data->cfgcntobj[1],
3038 Child, data->cfgcntobj[2],
3039 Child, data->cfgcntobj[3],
3040 Child, data->cfgcntobj[4],
3041 Child, data->cfgcntobj[5],
3042 Child, data->cfgcntobj[6],
3043 End)),
3044 End,
3045 End,
3046 Child, BalanceObject,
3047 MUIA_ObjectID, MAKE_ID('I','L','B','P'),
3048 End,
3049 Child, VGroup, GroupFrameT(__(MSG_PANEL_CONFIG_MSGLOG)),
3050 MUIA_VertWeight, 20,
3051 Child, HGroup,
3052 Child, Label(__(MSG_PANEL_CONFIG_INFLVL)),
3053 Child, data->errlvlobj = CycleObject,
3054 MUIA_CycleChain, 1,
3055 MUIA_ShortHelp, __(MSG_PANEL_CONFIG_INFLVL_HELP),
3056 MUIA_Cycle_Entries, errlvlstrings,
3057 End,
3058 Child, HSpace(0),
3059 Child, HGroup,
3060 MUIA_Group_SameWidth, TRUE,
3061 Child, data->errsaveobj = MyTextObject(_(MSG_PANEL_CONFIG_LOGSAVE),_(MSG_PANEL_CONFIG_LOGSAVE_HELP)),
3062 Child, data->errflushobj = MyTextObject(_(MSG_PANEL_CONFIG_LOGFLUSH),_(MSG_PANEL_CONFIG_LOGFLUSH_HELP)),
3063 End,
3064 End,
3065 Child, data->errlistobj = ListviewObject,
3066 MUIA_CycleChain, 1,
3067 MUIA_Listview_Input, FALSE,
3068 MUIA_Listview_List, ListObject,
3069 MUIA_ShortHelp, __(MSG_PANEL_CONFIG_LOGHELP),
3070 ReadListFrame,
3071 MUIA_List_Format, "BAR,BAR,BAR,",
3072 MUIA_List_DisplayHook, &data->ErrorDisplayHook,
3073 End,
3074 End,
3075 End,
3076 Child, HGroup,
3077 MUIA_Group_SameWidth, TRUE,
3078 Child, data->onlineobj = MyTextObject( _(MSG_PANEL_CONFIG_ALLONLINE),_(MSG_PANEL_CONFIG_ALLONLINE_HELP)),
3079 Child, data->offlineobj = MyTextObject(_(MSG_PANEL_CONFIG_ALLOFFLINE),_(MSG_PANEL_CONFIG_ALLOFFLINE_HELP)),
3080 Child, data->restartobj = MyTextObject(_(MSG_PANEL_CONFIG_RESTART),_(MSG_PANEL_CONFIG_RESTART_HELP)),
3081 Child, HSpace(0),
3082 Child, data->saveobj = MyTextObject(_(MSG_PANEL_CONFIG_SAVE),_(MSG_PANEL_CONFIG_SAVE_HELP)),
3083 Child, data->useobj = MyTextObject(_(MSG_PANEL_CONFIG_USE),_(MSG_PANEL_CONFIG_USE_HELP)),
3084 End,
3085 End;
3087 DoMethod(obj, OM_ADDMEMBER, data->mainobj);
3089 DoMethod(data->cfgpagelv, MUIM_Notify, MUIA_List_Active, MUIV_EveryTime,
3090 data->cfgpagegrp, 3, MUIM_Set, MUIA_Group_ActivePage, MUIV_TriggerValue);
3091 DoMethod(data->cfgpagelv, MUIM_Notify, MUIA_List_Active, MUIV_EveryTime,
3092 obj, 1, MUIM_Action_Info_MemPool);
3094 DoMethod(data->hwnewobj, MUIM_Notify, MUIA_Pressed, FALSE,
3095 obj, 1, MUIM_Action_HW_New);
3096 DoMethod(data->hwcopyobj, MUIM_Notify, MUIA_Pressed, FALSE,
3097 obj, 1, MUIM_Action_HW_Copy);
3098 DoMethod(data->hwdelobj, MUIM_Notify, MUIA_Pressed, FALSE,
3099 obj, 1, MUIM_Action_HW_Del);
3100 DoMethod(data->hwinfoobj, MUIM_Notify, MUIA_Pressed, FALSE,
3101 obj, 1, MUIM_Action_HW_Info);
3102 DoMethod(data->hwonlineobj, MUIM_Notify, MUIA_Pressed, FALSE,
3103 obj, 1, MUIM_Action_HW_Online);
3104 DoMethod(data->hwofflineobj, MUIM_Notify, MUIA_Pressed, FALSE,
3105 obj, 1, MUIM_Action_HW_Offline);
3107 DoMethod(data->hwlistobj, MUIM_Notify, MUIA_Listview_DoubleClick, TRUE,
3108 obj, 1, MUIM_Action_HW_Info);
3109 DoMethod(data->hwlistobj, MUIM_Notify, MUIA_List_Active, MUIV_EveryTime,
3110 obj, 1, MUIM_Action_HW_Activate);
3111 DoMethod(data->hwdevobj, MUIM_Notify, MUIA_String_Acknowledge, MUIV_EveryTime,
3112 obj, 2, MUIM_Action_HW_Update, NULL);
3113 DoMethod(data->hwunitobj, MUIM_Notify, MUIA_String_Acknowledge, MUIV_EveryTime,
3114 obj, 2, MUIM_Action_HW_Update, NULL);
3116 DoMethod(data->errsaveobj, MUIM_Notify, MUIA_Pressed, FALSE,
3117 obj, 1, MUIM_Action_SaveErrors);
3118 DoMethod(data->errflushobj, MUIM_Notify, MUIA_Pressed, FALSE,
3119 obj, 1, MUIM_Action_FlushErrors);
3120 DoMethod(data->errlvlobj, MUIM_Notify, MUIA_Cycle_Active, MUIV_EveryTime,
3121 obj, 1, MUIM_Action_ChgErrLevel);
3123 DoMethod(data->onlineobj, MUIM_Notify, MUIA_Pressed, FALSE,
3124 obj, 1, MUIM_Action_Online);
3125 DoMethod(data->offlineobj, MUIM_Notify, MUIA_Pressed, FALSE,
3126 obj, 1, MUIM_Action_Offline);
3127 DoMethod(data->restartobj, MUIM_Notify, MUIA_Pressed, FALSE,
3128 obj, 1, MUIM_Action_Restart);
3130 DoMethod(data->saveobj, MUIM_Notify, MUIA_Pressed, FALSE,
3131 obj, 1, MUIM_Action_SaveQuit);
3132 DoMethod(data->useobj, MUIM_Notify, MUIA_Pressed, FALSE,
3133 obj, 1, MUIM_Action_UseQuit);
3135 DoMethod(data->devlistobj, MUIM_Notify, MUIA_List_Active, MUIV_EveryTime,
3136 obj, 1, MUIM_Action_Dev_Activate);
3137 DoMethod(data->devbindobj, MUIM_Notify, MUIA_Pressed, FALSE,
3138 obj, 1, MUIM_Action_Dev_Bind);
3139 DoMethod(data->devinfoobj, MUIM_Notify, MUIA_Pressed, FALSE,
3140 obj, 1, MUIM_Action_Dev_Info);
3141 DoMethod(data->devunbindobj, MUIM_Notify, MUIA_Pressed, FALSE,
3142 obj, 1, MUIM_Action_Dev_Unbind);
3143 DoMethod(data->devsuspendobj, MUIM_Notify, MUIA_Pressed, FALSE,
3144 obj, 1, MUIM_Action_Dev_Suspend);
3145 DoMethod(data->devresumeobj, MUIM_Notify, MUIA_Pressed, FALSE,
3146 obj, 1, MUIM_Action_Dev_Resume);
3147 DoMethod(data->devpowercycleobj, MUIM_Notify, MUIA_Pressed, FALSE,
3148 obj, 1, MUIM_Action_Dev_PowerCycle);
3149 DoMethod(data->devdisableobj, MUIM_Notify, MUIA_Pressed, FALSE,
3150 obj, 1, MUIM_Action_Dev_Disable);
3151 DoMethod(data->devlistobj, MUIM_Notify, MUIA_Listview_DoubleClick, TRUE,
3152 obj, 1, MUIM_Action_Dev_Info);
3153 DoMethod(data->devlistobj, MUIM_Notify, MUIA_ContextMenuTrigger, MUIV_EveryTime,
3154 obj, 2, MUIM_Action_Dev_ForceBind, MUIV_TriggerValue);
3156 DoMethod(data->devcfgobj, MUIM_Notify, MUIA_Pressed, FALSE,
3157 obj, 1, MUIM_Action_Dev_Configure);
3159 DoMethod(data->clslistobj, MUIM_Notify, MUIA_List_Active, MUIV_EveryTime,
3160 obj, 1, MUIM_Action_Cls_Activate);
3161 DoMethod(data->clsaddobj, MUIM_Notify, MUIA_Pressed, FALSE,
3162 obj, 1, MUIM_Action_Cls_Add);
3163 DoMethod(data->clsnameobj, MUIM_Notify, MUIA_String_Acknowledge, MUIV_EveryTime,
3164 obj, 1, MUIM_Action_Cls_Add);
3165 DoMethod(data->clsremobj, MUIM_Notify, MUIA_Pressed, FALSE,
3166 obj, 1, MUIM_Action_Cls_Remove);
3167 DoMethod(data->clscfgobj, MUIM_Notify, MUIA_Pressed, FALSE,
3168 obj, 1, MUIM_Action_Cls_Configure);
3169 DoMethod(data->clsscanobj, MUIM_Notify, MUIA_Pressed, FALSE,
3170 obj, 1, MUIM_Action_Cls_Scan);
3171 DoMethod(data->clslistobj, MUIM_Notify, MUIA_Listview_DoubleClick, TRUE,
3172 obj, 1, MUIM_Action_Cls_Configure);
3174 DoMethod(data->cfgtaskpriobj, MUIM_Notify, MUIA_Numeric_Value, MUIV_EveryTime,
3175 obj, 1, MUIM_Action_Cfg_Changed);
3176 DoMethod(data->cfgbootdelayobj, MUIM_Notify, MUIA_Numeric_Value, MUIV_EveryTime,
3177 obj, 1, MUIM_Action_Cfg_Changed);
3178 DoMethod(data->cfgloginfoobj, MUIM_Notify, MUIA_Selected, MUIV_EveryTime,
3179 obj, 1, MUIM_Action_Cfg_Changed);
3180 DoMethod(data->cfglogwarnobj, MUIM_Notify, MUIA_Selected, MUIV_EveryTime,
3181 obj, 1, MUIM_Action_Cfg_Changed);
3182 DoMethod(data->cfglogerrobj, MUIM_Notify, MUIA_Selected, MUIV_EveryTime,
3183 obj, 1, MUIM_Action_Cfg_Changed);
3184 DoMethod(data->cfglogfailobj, MUIM_Notify, MUIA_Selected, MUIV_EveryTime,
3185 obj, 1, MUIM_Action_Cfg_Changed);
3187 DoMethod(data->cfgpopupnewobj, MUIM_Notify, MUIA_Cycle_Active, MUIV_EveryTime,
3188 obj, 1, MUIM_Action_Cfg_Changed);
3189 DoMethod(data->cfgpopupgoneobj, MUIM_Notify, MUIA_Selected, MUIV_EveryTime,
3190 obj, 1, MUIM_Action_Cfg_Changed);
3191 DoMethod(data->cfgpopupdeathobj, MUIM_Notify, MUIA_Selected, MUIV_EveryTime,
3192 obj, 1, MUIM_Action_Cfg_Changed);
3193 DoMethod(data->cfgpopupdelayobj, MUIM_Notify, MUIA_Numeric_Value, MUIV_EveryTime,
3194 obj, 1, MUIM_Action_Cfg_Changed);
3195 DoMethod(data->cfgpopupactivateobj, MUIM_Notify, MUIA_Selected, MUIV_EveryTime,
3196 obj, 1, MUIM_Action_Cfg_Changed);
3197 DoMethod(data->cfgpopuptofrontobj, MUIM_Notify, MUIA_Selected, MUIV_EveryTime,
3198 obj, 1, MUIM_Action_Cfg_Changed);
3199 DoMethod(data->cfgdevdtxsoundobj, MUIM_Notify, MUIA_String_Acknowledge, MUIV_EveryTime,
3200 obj, 1, MUIM_Action_Cfg_Snd_Changed);
3201 DoMethod(data->cfgdevremsoundobj, MUIM_Notify, MUIA_String_Acknowledge, MUIV_EveryTime,
3202 obj, 1, MUIM_Action_Cfg_Snd_Changed);
3204 DoMethod(data->cfgautolpobj, MUIM_Notify, MUIA_Selected, MUIV_EveryTime,
3205 obj, 1, MUIM_Action_Cfg_Changed);
3206 DoMethod(data->cfgautodeadobj, MUIM_Notify, MUIA_Selected, MUIV_EveryTime,
3207 obj, 1, MUIM_Action_Cfg_Changed);
3208 DoMethod(data->cfgautopcobj, MUIM_Notify, MUIA_Selected, MUIV_EveryTime,
3209 obj, 1, MUIM_Action_Cfg_Changed);
3211 DoMethod(data->cfgpowersavingobj, MUIM_Notify, MUIA_Selected, MUIV_EveryTime,
3212 obj, 1, MUIM_Action_Cfg_Changed);
3213 DoMethod(data->cfgforcesuspendobj, MUIM_Notify, MUIA_Selected, MUIV_EveryTime,
3214 obj, 1, MUIM_Action_Cfg_Changed);
3215 DoMethod(data->cfgsuspendtimeoutobj, MUIM_Notify, MUIA_Numeric_Value, MUIV_EveryTime,
3216 obj, 1, MUIM_Action_Cfg_Changed);
3218 DoMethod(data->prefslistobj, MUIM_Notify, MUIA_List_Active, MUIV_EveryTime,
3219 obj, 1, MUIM_Action_Cfg_Activate);
3220 DoMethod(data->prefssaveasobj, MUIM_Notify, MUIA_Pressed, FALSE,
3221 obj, 1, MUIM_Action_SavePrefsAs);
3222 DoMethod(data->prefsexportobj, MUIM_Notify, MUIA_Pressed, FALSE,
3223 obj, 1, MUIM_Action_Cfg_Export);
3224 DoMethod(data->prefsimportobj, MUIM_Notify, MUIA_Pressed, FALSE,
3225 obj, 1, MUIM_Action_Cfg_Import);
3226 DoMethod(data->prefsremoveobj, MUIM_Notify, MUIA_Pressed, FALSE,
3227 obj, 1, MUIM_Action_Cfg_Remove);
3229 data->mi_classpopup = CreateClassPopup();
3230 set(data->devlistobj, MUIA_ContextMenu, data->mi_classpopup);
3232 Action_HW_Activate(cl, obj, msg);
3234 CreateErrorList(data);
3235 SetupEventHandler(data);
3236 while((pd = psdGetNextDevice(pd)))
3238 dlnode = AllocDevEntry(data, pd);
3239 if(dlnode)
3241 DoMethod(data->devlistobj, MUIM_List_InsertSingle, dlnode, MUIV_List_Insert_Bottom);
3244 UpdateConfigToGUI(data);
3245 return(obj);
3247 /* \\\ */
3249 /* /// "Action_OM_DISPOSE()" */
3250 IPTR Action_OM_DISPOSE(struct IClass *cl, Object *obj, Msg msg)
3252 struct ActionData *data = INST_DATA(cl, obj);
3253 FreeErrorList(data);
3254 FreePrefsList(data);
3255 FreeGUILists(data);
3256 if(data->mi_classpopup)
3258 MUI_DisposeObject(data->mi_classpopup);
3259 data->mi_classpopup = NULL;
3261 CleanupEventHandler(data);
3262 return(FALSE);
3264 /* \\\ */
3266 /* /// "Action_Setup()" */
3267 IPTR Action_Setup(struct IClass *cl, Object *obj, Msg msg)
3269 struct ActionData *data = INST_DATA(cl, obj);
3271 data->appobj = _app(obj);
3272 data->winobj = _win(obj);
3273 if(!DoSuperMethodA(cl,obj,msg)) return(FALSE);
3275 data->eventihn.ihn_Object = obj;
3276 data->eventihn.ihn_Signals = 1UL<<data->eventmsgport->mp_SigBit;
3277 data->eventihn.ihn_Flags = 0;
3278 data->eventihn.ihn_Method = MUIM_Action_HandlePsdEvents;
3279 DoMethod(data->appobj, MUIM_Application_AddInputHandler, &data->eventihn);
3280 //MUI_RequestIDCMP(obj, IDCMP_INTUITICKS);
3281 return(TRUE);
3283 /* \\\ */
3285 /* /// "Action_HW_New()" */
3286 IPTR Action_HW_New(struct IClass *cl, Object *obj, Msg msg)
3288 struct ActionData *data = INST_DATA(cl, obj);
3289 struct HWListEntry *hlnode;
3290 hlnode = AllocHWEntry(data, NULL);
3291 if(hlnode)
3293 hlnode->devname = psdCopyStr("DEVS:USBHardware/");
3294 DoMethod(data->hwlistobj, MUIM_List_InsertSingle, hlnode, MUIV_List_Insert_Bottom);
3295 set(data->hwlistobj, MUIA_List_Active, MUIV_List_Active_Bottom);
3296 DoMethod(data->hwdevaslobj, MUIM_Popstring_Open);
3297 InternalCreateConfigGUI(data);
3299 return(TRUE);
3301 /* \\\ */
3303 /* /// "Action_HW_Copy()" */
3304 IPTR Action_HW_Copy(struct IClass *cl, Object *obj, Msg msg)
3306 struct ActionData *data = INST_DATA(cl, obj);
3307 struct HWListEntry *hlnode;
3308 if(data->acthlnode)
3310 hlnode = AllocHWEntry(data, NULL);
3311 if(hlnode)
3313 hlnode->devname = psdCopyStr(data->acthlnode->devname);
3314 hlnode->unit = data->acthlnode->unit + 1;
3315 DoMethod(data->hwlistobj, MUIM_List_InsertSingle, hlnode, MUIV_List_Insert_Bottom);
3316 set(data->hwlistobj, MUIA_List_Active, MUIV_List_Active_Bottom);
3317 InternalCreateConfigGUI(data);
3320 return(TRUE);
3322 /* \\\ */
3324 /* /// "Action_HW_Del()" */
3325 IPTR Action_HW_Del(struct IClass *cl, Object *obj, Msg msg)
3327 struct ActionData *data = INST_DATA(cl, obj);
3328 struct HWListEntry *hlnode;
3329 if(data->acthlnode)
3331 hlnode = data->acthlnode;
3332 DoMethod(data->hwlistobj, MUIM_List_Remove, MUIV_List_Remove_Active);
3333 FreeHWEntry(data, hlnode);
3334 InternalCreateConfigGUI(data);
3336 return(TRUE);
3338 /* \\\ */
3340 /* /// "Action_HW_Update()" */
3341 IPTR Action_HW_Update(struct IClass *cl, Object *obj, Msg msg)
3343 struct ActionData *data = INST_DATA(cl, obj);
3344 struct HWListEntry *hlnode;
3345 hlnode = (struct HWListEntry *) ((struct opSet *) msg)->ops_AttrList;
3346 if(!hlnode)
3348 hlnode = data->acthlnode;
3350 if(hlnode)
3352 STRPTR str = "";
3353 psdFreeVec(hlnode->devname);
3354 get(data->hwdevobj, MUIA_String_Contents, &str);
3355 hlnode->devname = psdCopyStr(str);
3356 get(data->hwunitobj, MUIA_String_Integer, &hlnode->unit);
3357 DoMethod(data->hwlistobj, MUIM_List_Redraw, MUIV_List_Redraw_All);
3358 InternalCreateConfigGUI(data);
3360 return(TRUE);
3362 /* \\\ */
3364 /* /// "Action_HW_Activate()" */
3365 IPTR Action_HW_Activate(struct IClass *cl, Object *obj, Msg msg)
3367 struct ActionData *data = INST_DATA(cl, obj);
3368 struct HWListEntry *hlnode;
3369 if(data->acthlnode)
3371 DoMethod(obj, MUIM_Action_HW_Update, data->acthlnode);
3373 DoMethod(data->hwlistobj, MUIM_List_GetEntry, MUIV_List_GetEntry_Active, &hlnode);
3374 if((data->acthlnode = hlnode))
3376 set(data->hwdevgrpobj, MUIA_Disabled, FALSE);
3377 set(data->hwcopyobj, MUIA_Disabled, FALSE);
3378 set(data->hwdelobj, MUIA_Disabled, FALSE);
3379 set(data->hwinfoobj, MUIA_Disabled, !hlnode->phw);
3380 set(data->hwofflineobj, MUIA_Disabled, !hlnode->phw);
3381 set(data->hwonlineobj, MUIA_Disabled, hlnode->phw);
3382 set(data->hwdevobj, MUIA_String_Contents, hlnode->devname);
3383 set(data->hwunitobj, MUIA_String_Integer, hlnode->unit);
3384 } else {
3385 set(data->hwdevgrpobj, MUIA_Disabled, TRUE);
3386 set(data->hwcopyobj, MUIA_Disabled, TRUE);
3387 set(data->hwdelobj, MUIA_Disabled, TRUE);
3388 set(data->hwinfoobj, MUIA_Disabled, TRUE);
3389 set(data->hwofflineobj, MUIA_Disabled, TRUE);
3390 set(data->hwonlineobj, MUIA_Disabled, TRUE);
3392 return(TRUE);
3394 /* \\\ */
3396 /* /// "Action_HW_Info()" */
3397 IPTR Action_HW_Info(struct IClass *cl, Object *obj, Msg msg)
3399 struct ActionData *data = INST_DATA(cl, obj);
3400 struct HWListEntry *hlnode;
3401 IPTR revision = 0;
3402 IPTR version = 0;
3403 IPTR unitnr = -1;
3404 STRPTR devname = _(MSG_UNKNOWN);
3405 STRPTR manufacturer = _(MSG_UNKNOWN);
3406 STRPTR prodname = _(MSG_UNKNOWN);
3407 STRPTR description = _(MSG_UNKNOWN);
3408 STRPTR copyright = _(MSG_UNKNOWN);
3409 STRPTR textbuf1;
3411 DoMethod(data->hwlistobj, MUIM_List_GetEntry, MUIV_List_GetEntry_Active, &hlnode);
3412 if(hlnode)
3414 if(hlnode->infowindow || (!hlnode->phw))
3416 return(TRUE);
3418 psdGetAttrs(PGA_HARDWARE, hlnode->phw,
3419 HA_DeviceName, &devname,
3420 HA_DeviceUnit, &unitnr,
3421 HA_Version, &version,
3422 HA_Revision, &revision,
3423 HA_ProductName, &prodname,
3424 HA_Manufacturer, &manufacturer,
3425 HA_Description, &description,
3426 HA_Copyright, &copyright,
3427 TAG_END);
3429 textbuf1 = psdCopyStrFmt("%s\n%ld\n%V%ld.%ld\n%s\n%s\n%s\n%s",
3430 devname, unitnr, version, revision, prodname,
3431 manufacturer, description, copyright);
3432 hlnode->infowindow = WindowObject,
3433 MUIA_Window_ID , MAKE_ID('H','I','N','F'),
3434 MUIA_Window_Title, __(MSG_HARDWARE_WINDOW),
3435 MUIA_Window_IsSubWindow, FALSE,
3436 WindowContents, HGroup,
3437 MUIA_ShortHelp, __(MSG_HARDWARE_WINDOW_HELP),
3438 MUIA_FrameTitle, __(MSG_HARDWARE_WINDOW_FRAME),
3439 Child, LabelB(__(MSG_HARDWARE_WINDOW_LABEL)),
3440 Child, TextObject,
3441 TextFrame,
3442 MUIA_Background, MUII_TextBack,
3443 MUIA_Text_Contents, textbuf1,
3444 End,
3445 End,
3446 End;
3447 if(hlnode->infowindow)
3449 DoMethod(data->appobj, OM_ADDMEMBER, hlnode->infowindow);
3450 DoMethod(hlnode->infowindow, MUIM_Notify, MUIA_Window_CloseRequest, TRUE,
3451 data->appobj, 5, MUIM_Application_PushMethod, obj, 2, MUIM_Action_CloseSubWinReq, hlnode);
3453 set(hlnode->infowindow, MUIA_Window_Open, TRUE);
3455 psdFreeVec(textbuf1);
3457 return(TRUE);
3459 /* \\\ */
3461 /* /// "Action_HW_Online()" */
3462 IPTR Action_HW_Online(struct IClass *cl, Object *obj, Msg msg)
3464 struct ActionData *data = INST_DATA(cl, obj);
3465 struct HWListEntry *hlnode = data->acthlnode;
3466 if((!hlnode) || hlnode->phw)
3468 return(FALSE);
3471 set(data->appobj, MUIA_Application_Sleep, TRUE);
3472 if((hlnode->phw = psdAddHardware(hlnode->devname, hlnode->unit)))
3474 psdGetAttrs(PGA_HARDWARE, hlnode->phw,
3475 HA_ProductName, &hlnode->prodname,
3476 TAG_END);
3477 #ifdef AROS_USB30_CODE
3478 if(psdEnumerateHardware(hlnode->phw) == NULL) {
3479 psdRemHardware(hlnode->phw);
3480 hlnode->phw = NULL;
3481 hlnode->prodname = NULL;
3483 #else
3484 psdEnumerateHardware(hlnode->phw);
3485 #endif
3488 DoMethod(obj, MUIM_Action_HW_Activate);
3489 DoMethod(data->hwlistobj, MUIM_List_Redraw, MUIV_List_Redraw_All);
3490 psdClassScan();
3491 set(data->appobj, MUIA_Application_Sleep, FALSE);
3492 // update the online status to the config
3493 InternalCreateConfigGUI(data);
3494 return(TRUE);
3496 /* \\\ */
3498 /* /// "Action_HW_Offline()" */
3499 IPTR Action_HW_Offline(struct IClass *cl, Object *obj, Msg msg)
3501 struct ActionData *data = INST_DATA(cl, obj);
3502 struct HWListEntry *hlnode = data->acthlnode;
3503 struct Node *phw;
3504 struct List *lst;
3506 if((!hlnode) || (!hlnode->phw))
3508 return(FALSE);
3511 set(data->appobj, MUIA_Application_Sleep, TRUE);
3513 psdLockWritePBase();
3514 psdGetAttrs(PGA_STACK, NULL, PA_HardwareList, &lst, TAG_END);
3515 phw = lst->lh_Head;
3516 while(phw->ln_Succ)
3518 if(phw == hlnode->phw)
3520 psdUnlockPBase();
3521 psdRemHardware(phw);
3522 phw = NULL;
3523 break;
3525 phw = phw->ln_Succ;
3527 if(phw)
3529 psdUnlockPBase();
3531 hlnode->phw = NULL;
3532 hlnode->prodname = NULL;
3534 DoMethod(obj, MUIM_Action_HW_Activate);
3535 DoMethod(data->hwlistobj, MUIM_List_Redraw, MUIV_List_Redraw_All);
3536 set(data->appobj, MUIA_Application_Sleep, FALSE);
3537 // update the online status to the config
3538 // NOTE! This means that the hardware will not come online on next loading.
3539 InternalCreateConfigGUI(data);
3540 return(TRUE);
3542 /* \\\ */
3544 /* /// "Action_Online()" */
3545 IPTR Action_Online(struct IClass *cl, Object *obj, Msg msg)
3547 struct ActionData *data = INST_DATA(cl, obj);
3548 struct HWListEntry *hlnode;
3549 set(data->appobj, MUIA_Application_Sleep, TRUE);
3550 hlnode = (struct HWListEntry *) data->hwlist.lh_Head;
3551 while(hlnode->node.ln_Succ)
3553 if(!hlnode->phw)
3555 if((hlnode->phw = psdAddHardware(hlnode->devname, hlnode->unit)))
3557 psdGetAttrs(PGA_HARDWARE, hlnode->phw,
3558 HA_ProductName, &hlnode->prodname,
3559 TAG_END);
3560 psdEnumerateHardware(hlnode->phw);
3563 hlnode = (struct HWListEntry *) hlnode->node.ln_Succ;
3565 DoMethod(obj, MUIM_Action_HW_Activate);
3566 DoMethod(data->hwlistobj, MUIM_List_Redraw, MUIV_List_Redraw_All);
3567 psdClassScan();
3568 set(data->appobj, MUIA_Application_Sleep, FALSE);
3569 // update the online status to the config
3570 InternalCreateConfigGUI(data);
3571 return(TRUE);
3573 /* \\\ */
3575 /* /// "Action_Offline()" */
3576 IPTR Action_Offline(struct IClass *cl, Object *obj, Msg msg)
3578 struct ActionData *data = INST_DATA(cl, obj);
3579 struct HWListEntry *hlnode;
3580 set(data->appobj, MUIA_Application_Sleep, TRUE);
3581 hlnode = (struct HWListEntry *) data->hwlist.lh_Head;
3582 while(hlnode->node.ln_Succ)
3584 if(hlnode->phw)
3586 struct Node *phw;
3587 struct List *lst;
3588 psdLockWritePBase();
3589 psdGetAttrs(PGA_STACK, NULL, PA_HardwareList, &lst, TAG_END);
3590 phw = lst->lh_Head;
3591 while(phw->ln_Succ)
3593 if(phw == hlnode->phw)
3595 psdUnlockPBase();
3596 psdRemHardware(phw);
3597 phw = NULL;
3598 break;
3600 phw = phw->ln_Succ;
3602 if(phw)
3604 psdUnlockPBase();
3606 hlnode->phw = NULL;
3607 hlnode->prodname = NULL;
3609 hlnode = (struct HWListEntry *) hlnode->node.ln_Succ;
3611 DoMethod(obj, MUIM_Action_HW_Activate);
3612 DoMethod(data->hwlistobj, MUIM_List_Redraw, MUIV_List_Redraw_All);
3613 set(data->appobj, MUIA_Application_Sleep, FALSE);
3614 // update the online status to the config
3615 // NOTE! This means that the hardware will not come online on next loading.
3616 InternalCreateConfigGUI(data);
3617 return(TRUE);
3619 /* \\\ */
3621 /* /// "Action_Restart()" */
3622 IPTR Action_Restart(struct IClass *cl, Object *obj, Msg msg)
3624 struct ActionData *data = INST_DATA(cl, obj);
3625 struct HWListEntry *hlnode;
3626 set(data->appobj, MUIA_Application_Sleep, TRUE);
3627 hlnode = (struct HWListEntry *) data->hwlist.lh_Head;
3628 while(hlnode->node.ln_Succ)
3630 if(hlnode->phw)
3632 struct Node *phw;
3633 struct List *lst;
3634 psdLockWritePBase();
3635 psdGetAttrs(PGA_STACK, NULL, PA_HardwareList, &lst, TAG_END);
3636 phw = lst->lh_Head;
3637 while(phw->ln_Succ)
3639 if(phw == hlnode->phw)
3641 psdUnlockPBase();
3642 psdRemHardware(phw);
3643 phw = NULL;
3644 break;
3646 phw = phw->ln_Succ;
3648 if(phw)
3650 psdUnlockPBase();
3652 hlnode->phw = NULL;
3653 hlnode->prodname = NULL;
3655 hlnode = (struct HWListEntry *) hlnode->node.ln_Succ;
3657 hlnode = (struct HWListEntry *) data->hwlist.lh_Head;
3658 while(hlnode->node.ln_Succ)
3660 if(!hlnode->phw)
3662 if((hlnode->phw = psdAddHardware(hlnode->devname, hlnode->unit)))
3664 psdGetAttrs(PGA_HARDWARE, hlnode->phw,
3665 HA_ProductName, &hlnode->prodname,
3666 TAG_END);
3667 psdEnumerateHardware(hlnode->phw);
3670 hlnode = (struct HWListEntry *) hlnode->node.ln_Succ;
3672 DoMethod(obj, MUIM_Action_HW_Activate);
3673 DoMethod(data->hwlistobj, MUIM_List_Redraw, MUIV_List_Redraw_All);
3674 psdClassScan();
3675 set(data->appobj, MUIA_Application_Sleep, FALSE);
3676 return(TRUE);
3678 /* \\\ */
3680 /* /// "Action_ChgErrLevel()" */
3681 IPTR Action_ChgErrLevel(struct IClass *cl, Object *obj, Msg msg)
3683 struct ActionData *data = INST_DATA(cl, obj);
3684 IPTR lev = 0;
3685 get(data->errlvlobj, MUIA_Cycle_Active, &lev);
3686 switch(lev)
3688 case 0:
3689 data->errorlevel = RETURN_OK;
3690 break;
3691 case 1:
3692 data->errorlevel = RETURN_WARN;
3693 break;
3694 case 2:
3695 data->errorlevel = RETURN_ERROR;
3696 break;
3697 case 3:
3698 data->errorlevel = RETURN_FAIL;
3699 break;
3701 CreateErrorList(data);
3702 return(TRUE);
3704 /* \\\ */
3706 /* /// "WriteErrorLogFile()" */
3707 void WriteErrorLogFile(BPTR fh)
3709 struct List *lst;
3710 struct Node *pem;
3711 IPTR level;
3712 STRPTR origin;
3713 STRPTR errstr;
3714 struct DateStamp *ds;
3715 struct DateTime dt;
3716 struct DateStamp currdate;
3717 UBYTE strdate[LEN_DATSTRING];
3718 UBYTE strtime[LEN_DATSTRING];
3720 DateStamp(&currdate);
3721 psdLockReadPBase();
3722 psdGetAttrs(PGA_STACK, NULL, PA_ErrorMsgList, &lst, TAG_END);
3723 pem = lst->lh_Head;
3724 while(pem->ln_Succ)
3726 ds = NULL;
3727 psdGetAttrs(PGA_ERRORMSG, pem,
3728 EMA_Level, &level,
3729 EMA_Origin, &origin,
3730 EMA_Msg, &errstr,
3731 EMA_DateStamp, &ds,
3732 TAG_END);
3733 if(ds)
3735 dt.dat_Stamp.ds_Days = ds->ds_Days;
3736 dt.dat_Stamp.ds_Minute = ds->ds_Minute;
3737 dt.dat_Stamp.ds_Tick = ds->ds_Tick;
3738 dt.dat_Format = FORMAT_DEF;
3739 dt.dat_Flags = 0;
3740 dt.dat_StrDay = NULL;
3741 dt.dat_StrDate = strdate;
3742 dt.dat_StrTime = strtime;
3743 DateToStr(&dt);
3744 if(currdate.ds_Days == ds->ds_Days)
3746 FPrintf(fh, "%s| %2ld-%s: %s\n", strtime, level, origin, errstr);
3747 } else {
3748 FPrintf(fh, "%s %s| %2ld-%s: %s\n", strdate, strtime, level, origin, errstr);
3750 } else {
3751 FPrintf(fh, "%2ld-%s: %s\n", level, origin, errstr);
3753 pem = pem->ln_Succ;
3755 psdUnlockPBase();
3757 /* \\\ */
3759 /* /// "Action_SaveErrors()" */
3760 IPTR Action_SaveErrors(struct IClass *cl, Object *obj, Msg msg)
3762 struct FileRequester *aslreq;
3763 char path[256];
3764 struct TagItem asltags[] = { { ASLFR_InitialDrawer, (IPTR) "RAM:" },
3765 { ASLFR_InitialFile, __(MSG_ACTION_SAVE_ERR_FILE) },
3766 { ASLFR_DoSaveMode, (IPTR) TRUE },
3767 { ASLFR_TitleText, __(MSG_ACTION_SAVE_ERR) },
3768 { TAG_END, (IPTR) NULL } };
3769 BPTR fh;
3771 if((aslreq = MUI_AllocAslRequest(ASL_FileRequest, asltags)))
3773 if(MUI_AslRequest(aslreq, TAG_END))
3775 strcpy(path, aslreq->fr_Drawer);
3776 AddPart(path, aslreq->fr_File, 256);
3777 if((fh = Open(path, MODE_NEWFILE)))
3779 WriteErrorLogFile(fh);
3780 Close(fh);
3781 psdAddErrorMsg(RETURN_OK, _(MSG_APP_TITLE), _(MSG_ACTION_ERR_SAVED), path);
3782 } else {
3783 psdAddErrorMsg(RETURN_ERROR, _(MSG_APP_TITLE), _(MSG_ACTION_ERR_SAVED_ERRWRITE), path);
3785 MUI_FreeAslRequest(aslreq);
3788 return(TRUE);
3790 /* \\\ */
3792 /* /// "Action_FlushErrors()" */
3793 IPTR Action_FlushErrors(struct IClass *cl, Object *obj, Msg msg)
3795 struct ActionData *data = INST_DATA(cl, obj);
3796 struct List *lst;
3797 psdGetAttrs(PGA_STACK, NULL, PA_ErrorMsgList, &lst, TAG_END);
3798 Forbid();
3799 while(lst->lh_Head->ln_Succ)
3801 psdRemErrorMsg(lst->lh_Head);
3803 Permit();
3804 CreateErrorList(data);
3805 return(TRUE);
3807 /* \\\ */
3809 /* /// "Action_SaveDeviceList()" */
3810 IPTR Action_SaveDeviceList(struct IClass *cl, Object *obj, Msg msg)
3812 struct FileRequester *aslreq;
3813 char path[256];
3814 struct TagItem asltags[] = { { ASLFR_InitialDrawer, (IPTR) "RAM:" },
3815 { ASLFR_InitialFile, __(MSG_ACTION_SAVE_DEV_FILE) },
3816 { ASLFR_DoSaveMode, (IPTR) TRUE },
3817 { ASLFR_TitleText, __(MSG_ACTION_SAVE_DEV) },
3818 { TAG_END, (IPTR) NULL } };
3819 BPTR fh;
3821 if((aslreq = MUI_AllocAslRequest(ASL_FileRequest, asltags)))
3823 if(MUI_AslRequest(aslreq, TAG_END))
3825 strcpy(path, aslreq->fr_Drawer);
3826 AddPart(path, aslreq->fr_File, 256);
3827 if((fh = Open(path, MODE_NEWFILE)))
3829 if(SystemTags("PsdDevLister", SYS_Output, fh, TAG_END))
3831 psdAddErrorMsg(RETURN_ERROR,_(MSG_APP_TITLE), _(MSG_ACTION_SAVE_DEV_ERREXE));
3832 } else {
3833 psdAddErrorMsg(RETURN_OK, _(MSG_APP_TITLE), _(MSG_ACTION_DEV_SAVED), path);
3835 Close(fh);
3836 } else {
3837 psdAddErrorMsg(RETURN_ERROR, _(MSG_APP_TITLE), _(MSG_ACTION_ERR_SAVED_ERRWRITE), path);
3839 MUI_FreeAslRequest(aslreq);
3842 return(TRUE);
3844 /* \\\ */
3846 /* /// "Action_LoadPrefs()" */
3847 IPTR Action_LoadPrefs(struct IClass *cl, Object *obj, Msg msg)
3849 //struct ActionData *data = INST_DATA(cl, obj);
3850 struct FileRequester *aslreq;
3851 char path[256];
3852 struct TagItem asltags[] = { { ASLFR_InitialDrawer, (IPTR) "ENVARC:Sys" },
3853 { ASLFR_InitialFile, (IPTR) "Poseidon.prefs" },
3854 { ASLFR_TitleText, __(MSG_ACTION_PREFS_LOAD) },
3855 { TAG_END, (IPTR) NULL } };
3857 if((aslreq = MUI_AllocAslRequest(ASL_FileRequest, asltags)))
3859 if(MUI_AslRequest(aslreq, TAG_END))
3861 strcpy(path, aslreq->fr_Drawer);
3862 AddPart(path, aslreq->fr_File, 256);
3863 if(psdLoadCfgFromDisk(path))
3865 psdAddErrorMsg(RETURN_OK, _(MSG_APP_TITLE), _(MSG_ACTION_PREFS_LOADED), path);
3866 //UpdateConfigToGUI(data);
3869 MUI_FreeAslRequest(aslreq);
3871 return(TRUE);
3873 /* \\\ */
3875 /* /// "Action_SavePrefsAs()" */
3876 IPTR Action_SavePrefsAs(struct IClass *cl, Object *obj, Msg msg)
3878 struct ActionData *data = INST_DATA(cl, obj);
3879 struct FileRequester *aslreq;
3880 char path[256];
3881 struct TagItem asltags[] = { { ASLFR_InitialDrawer, (IPTR) "ENVARC:Sys" },
3882 { ASLFR_InitialFile, (IPTR) "Poseidon.prefs" },
3883 { ASLFR_TitleText, __(MSG_ACTION_PREFS_SAVEAS) },
3884 { ASLFR_DoSaveMode, (IPTR) TRUE },
3885 { TAG_END, (IPTR) NULL } };
3887 if((aslreq = MUI_AllocAslRequest(ASL_FileRequest, asltags)))
3889 if(MUI_AslRequest(aslreq, TAG_END))
3891 strcpy(path, aslreq->fr_Drawer);
3892 AddPart(path, aslreq->fr_File, 256);
3893 InternalCreateConfigGUI(data);
3894 if(psdSaveCfgToDisk(path, FALSE))
3896 psdAddErrorMsg(RETURN_OK, _(MSG_APP_TITLE), _(MSG_ACTION_PREFS_SAVED), path);
3898 IPTR hash = 0;
3899 psdGetAttrs(PGA_STACK, NULL, PA_CurrConfigHash, &hash, TAG_END);
3900 psdSetAttrs(PGA_STACK, NULL, PA_SavedConfigHash, hash, TAG_END);
3902 } else {
3903 psdAddErrorMsg(RETURN_ERROR, _(MSG_APP_TITLE), _(MSG_ACTION_PREFS_SAVEDERR), path);
3905 MUI_FreeAslRequest(aslreq);
3908 return(TRUE);
3910 /* \\\ */
3912 /* /// "Action_SavePrefs()" */
3913 IPTR Action_SavePrefs(struct IClass *cl, Object *obj, Msg msg)
3915 struct ActionData *data = INST_DATA(cl, obj);
3917 DoMethod(obj, MUIM_Action_Cfg_Snd_Changed);
3918 InternalCreateConfigGUI(data);
3920 if(!psdSaveCfgToDisk(NULL, FALSE))
3922 psdAddErrorMsg(RETURN_ERROR, _(MSG_APP_TITLE), _(MSG_ACTION_PREFS_NOTSAVED));
3923 } else {
3924 psdAddErrorMsg(RETURN_OK, _(MSG_APP_TITLE), _(MSG_ACTION_PREFS_SAVEDSUCCESS));
3927 return(TRUE);
3929 /* \\\ */
3931 /* /// "Action_Prefs_Changed()" */
3932 IPTR Action_Prefs_Changed(struct IClass *cl, Object *obj, Msg msg)
3934 IPTR oldhash = 0;
3935 IPTR currhash = 0;
3936 DoMethod(obj, MUIM_Action_Cfg_Snd_Changed);
3937 psdGetAttrs(PGA_STACK, NULL,
3938 PA_CurrConfigHash, &currhash,
3939 PA_SavedConfigHash, &oldhash,
3940 TAG_END);
3941 return((IPTR) (currhash != oldhash));
3943 /* \\\ */
3945 /* /// "Action_UseQuit()" */
3946 IPTR Action_UseQuit(struct IClass *cl, Object *obj, Msg msg)
3948 struct ActionData *data = INST_DATA(cl, obj);
3949 LONG res;
3950 //DoMethod(obj, MUIM_Action_Cfg_Snd_Changed);
3951 DoMethod(obj, MUIM_Action_Use);
3952 if(DoMethod(obj, MUIM_Action_Prefs_Changed))
3954 res = MUI_RequestA(data->appobj, data->winobj, 0, NULL, _(MSG_ACTION_USEQUIT), _(MSG_ACTION_CONFIGCHANGED), NULL);
3955 if(res == 0)
3957 return(FALSE);
3959 if(res == 2)
3961 DoMethod(obj, MUIM_Action_SavePrefs);
3964 DoMethod(data->appobj, MUIM_Application_ReturnID, MUIV_Application_ReturnID_Quit);
3965 return(TRUE);
3967 /* \\\ */
3969 /* /// "Action_SaveQuit()" */
3970 IPTR Action_SaveQuit(struct IClass *cl, Object *obj, Msg msg)
3972 struct ActionData *data = INST_DATA(cl, obj);
3973 DoMethod(obj, MUIM_Action_Cfg_Snd_Changed);
3974 DoMethod(obj, MUIM_Action_Use);
3975 if(!(psdSaveCfgToDisk(NULL, FALSE)))
3977 psdAddErrorMsg(RETURN_ERROR, _(MSG_APP_TITLE), _(MSG_ACTION_SAVEQUIT));
3978 } else {
3979 DoMethod(data->appobj, MUIM_Application_ReturnID, MUIV_Application_ReturnID_Quit);
3981 return(TRUE);
3983 /* \\\ */
3985 /* /// "Action_LoadPrefsFrom()" */
3986 IPTR Action_LoadPrefsFrom(struct IClass *cl, Object *obj, Msg msg)
3988 //struct ActionData *data = INST_DATA(cl, obj);
3989 STRPTR path = (STRPTR) ((struct opSet *) msg)->ops_AttrList;
3990 if(psdLoadCfgFromDisk(path))
3992 psdAddErrorMsg(RETURN_OK, _(MSG_APP_TITLE), _(MSG_ACTION_PREFS_LOADED), path);
3993 return(TRUE);
3995 return(FALSE);
3997 /* \\\ */
3999 /* /// "Action_SavePrefsTo()" */
4000 IPTR Action_SavePrefsTo(struct IClass *cl, Object *obj, Msg msg)
4002 struct ActionData *data = INST_DATA(cl, obj);
4003 STRPTR path = (STRPTR) ((struct opSet *) msg)->ops_AttrList;
4004 InternalCreateConfigGUI(data);
4005 if(psdSaveCfgToDisk(path, FALSE))
4007 psdAddErrorMsg(RETURN_OK, _(MSG_APP_TITLE), _(MSG_ACTION_PREFS_SAVED), path);
4008 return(TRUE);
4010 return(FALSE);
4012 /* \\\ */
4014 /* /// "Action_Dev_Activate()" */
4015 IPTR Action_Dev_Activate(struct IClass *cl, Object *obj, Msg msg)
4017 struct ActionData *data = INST_DATA(cl, obj);
4018 struct DevListEntry *dlnode;
4019 APTR binding;
4020 APTR cbind;
4021 struct List *pclist;
4022 struct List *piflist;
4023 struct Node *pc;
4024 struct Node *pif;
4025 struct Node *puc;
4026 IPTR hascfggui = FALSE;
4027 IPTR issuspended = FALSE;
4028 struct Library *UsbClsBase;
4030 DoMethod(data->devlistobj, MUIM_List_GetEntry, MUIV_List_GetEntry_Active, &dlnode);
4031 if(CheckDeviceValid(dlnode))
4033 psdLockReadDevice(dlnode->pd);
4034 set(data->devinfoobj, MUIA_Disabled, FALSE);
4035 psdGetAttrs(PGA_DEVICE, dlnode->pd,
4036 DA_Binding, &binding,
4037 DA_BindingClass, &puc,
4038 DA_ConfigList, &pclist,
4039 DA_IsSuspended, &issuspended,
4040 TAG_END);
4041 if(binding && puc)
4043 psdGetAttrs(PGA_USBCLASS, puc,
4044 UCA_ClassBase, &UsbClsBase,
4045 TAG_END);
4046 usbGetAttrs(UGA_CLASS, NULL,
4047 UCCA_HasBindingCfgGUI, &hascfggui,
4048 TAG_END);
4050 pc = pclist->lh_Head;
4051 while((!binding) && pc->ln_Succ)
4053 psdGetAttrs(PGA_CONFIG, pc,
4054 CA_InterfaceList, &piflist,
4055 TAG_END);
4056 pif = piflist->lh_Head;
4057 while(pif->ln_Succ)
4059 psdGetAttrs(PGA_INTERFACE, pif,
4060 IFA_Binding, &cbind,
4061 IFA_BindingClass, &puc,
4062 TAG_END);
4063 if(cbind)
4065 binding = cbind;
4067 if(cbind && puc && !hascfggui)
4069 psdGetAttrs(PGA_USBCLASS, puc,
4070 UCA_ClassBase, &UsbClsBase,
4071 TAG_END);
4072 usbGetAttrs(UGA_CLASS, NULL,
4073 UCCA_HasBindingCfgGUI, &hascfggui,
4074 TAG_END);
4076 pif = pif->ln_Succ;
4078 pc = pc->ln_Succ;
4080 psdUnlockDevice(dlnode->pd);
4081 set(data->devunbindobj, MUIA_Disabled, !binding);
4082 set(data->devcfgobj, MUIA_Disabled, !hascfggui);
4083 /*if(dlnode->infowindow) FIXME
4085 DoMethod(obj, MUIM_Action_Dev_If_Activate, dlnode);
4087 set(data->devsuspendobj, MUIA_Disabled, issuspended);
4088 set(data->devresumeobj, MUIA_Disabled, !issuspended);
4089 set(data->devpowercycleobj, MUIA_Disabled, FALSE);
4090 set(data->devdisableobj, MUIA_Disabled, FALSE);
4091 set(data->devlistobj, MUIA_ContextMenu, data->mi_classpopup);
4092 } else {
4093 set(data->devunbindobj, MUIA_Disabled, TRUE);
4094 set(data->devinfoobj, MUIA_Disabled, TRUE);
4095 set(data->devcfgobj, MUIA_Disabled, TRUE);
4096 set(data->devsuspendobj, MUIA_Disabled, TRUE);
4097 set(data->devresumeobj, MUIA_Disabled, TRUE);
4098 set(data->devpowercycleobj, MUIA_Disabled, TRUE);
4099 set(data->devdisableobj, MUIA_Disabled, TRUE);
4100 set(data->devlistobj, MUIA_ContextMenu, NULL);
4102 return(TRUE);
4104 /* \\\ */
4106 /* /// "Action_Dev_Info()" */
4107 IPTR Action_Dev_Info(struct IClass *cl, Object *obj, Msg msg)
4109 struct ActionData *data = INST_DATA(cl, obj);
4110 struct DevListEntry *dlnode;
4112 DoMethod(data->devlistobj, MUIM_List_GetEntry, MUIV_List_GetEntry_Active, &dlnode);
4113 if(dlnode)
4115 if(dlnode->infowindow)
4117 return(TRUE);
4119 dlnode->infowindow = NewObject(DevWinClass->mcc_Class, 0, MUIA_DevWin_DevEntry, dlnode, WindowContents, VGroup, End, TAG_END);
4120 if(dlnode->infowindow)
4122 DoMethod(data->appobj, OM_ADDMEMBER, dlnode->infowindow);
4123 DoMethod(dlnode->infowindow, MUIM_Notify, MUIA_Window_CloseRequest, TRUE,
4124 data->appobj, 5, MUIM_Application_PushMethod, obj, 2, MUIM_Action_CloseSubWinReq, dlnode);
4125 set(dlnode->infowindow, MUIA_Window_Open, TRUE);
4128 return(TRUE);
4130 /* \\\ */
4132 /* /// "Action_Dev_Bind()" */
4133 IPTR Action_Dev_Bind(struct IClass *cl, Object *obj, Msg msg)
4135 struct ActionData *data = INST_DATA(cl, obj);
4136 psdClassScan();
4137 DoMethod(obj, MUIM_Action_Dev_Activate);
4138 DoMethod(data->devlistobj, MUIM_List_Redraw, MUIV_List_Redraw_All);
4139 return(TRUE);
4141 /* \\\ */
4143 /* /// "Action_Dev_Unbind()" */
4144 IPTR Action_Dev_Unbind(struct IClass *cl, Object *obj, Msg msg)
4146 struct ActionData *data = INST_DATA(cl, obj);
4147 struct DevListEntry *dlnode;
4148 APTR binding;
4149 struct List *pclist;
4150 struct List *piflist;
4151 struct Node *pc;
4152 struct Node *pif;
4154 DoMethod(data->devlistobj, MUIM_List_GetEntry, MUIV_List_GetEntry_Active, &dlnode);
4155 if(CheckDeviceValid(dlnode))
4157 psdGetAttrs(PGA_DEVICE, dlnode->pd,
4158 DA_Binding, &binding,
4159 DA_ConfigList, &pclist,
4160 TAG_END);
4161 if(binding)
4163 psdReleaseDevBinding(dlnode->pd);
4164 } else {
4165 pc = pclist->lh_Head;
4166 while(pc->ln_Succ)
4168 psdGetAttrs(PGA_CONFIG, pc,
4169 CA_InterfaceList, &piflist,
4170 TAG_END);
4171 pif = piflist->lh_Head;
4172 while(pif->ln_Succ)
4174 psdGetAttrs(PGA_INTERFACE, pif,
4175 IFA_Binding, &binding,
4176 TAG_END);
4177 if(binding)
4179 psdReleaseIfBinding(pif);
4181 pif = pif->ln_Succ;
4183 pc = pc->ln_Succ;
4186 set(data->devunbindobj, MUIA_Disabled, TRUE);
4187 set(data->devcfgobj, MUIA_Disabled, TRUE);
4188 /*if(dlnode->infowindow) FIXME
4190 DoMethod(obj, MUIM_Action_Dev_If_Activate, dlnode);
4191 DoMethod(dlnode->iflvobj, MUIM_List_Redraw, MUIV_List_Redraw_All);
4194 DoMethod(data->devlistobj, MUIM_List_Redraw, MUIV_List_Redraw_All);
4195 return(TRUE);
4197 /* \\\ */
4199 /* /// "Action_Dev_Suspend()" */
4200 IPTR Action_Dev_Suspend(struct IClass *cl, Object *obj, Msg msg)
4202 struct ActionData *data = INST_DATA(cl, obj);
4203 struct DevListEntry *dlnode;
4205 DoMethod(data->devlistobj, MUIM_List_GetEntry, MUIV_List_GetEntry_Active, &dlnode);
4206 if(CheckDeviceValid(dlnode))
4208 psdSuspendDevice(dlnode->pd);
4210 DoMethod(data->devlistobj, MUIM_List_Redraw, MUIV_List_Redraw_All);
4211 return(TRUE);
4213 /* \\\ */
4215 /* /// "Action_Dev_Resume()" */
4216 IPTR Action_Dev_Resume(struct IClass *cl, Object *obj, Msg msg)
4218 struct ActionData *data = INST_DATA(cl, obj);
4219 struct DevListEntry *dlnode;
4221 DoMethod(data->devlistobj, MUIM_List_GetEntry, MUIV_List_GetEntry_Active, &dlnode);
4222 if(CheckDeviceValid(dlnode))
4224 psdResumeDevice(dlnode->pd);
4226 DoMethod(data->devlistobj, MUIM_List_Redraw, MUIV_List_Redraw_All);
4227 return(TRUE);
4229 /* \\\ */
4231 /* /// "Action_Dev_PowerCycle()" */
4232 IPTR Action_Dev_PowerCycle(struct IClass *cl, Object *obj, Msg msg)
4234 struct ActionData *data = INST_DATA(cl, obj);
4235 struct DevListEntry *dlnode;
4236 IPTR hubport = 0;
4237 struct Node *hubpd = NULL;
4238 struct Node *puc = NULL;
4239 struct Library *UsbClsBase;
4241 DoMethod(data->devlistobj, MUIM_List_GetEntry, MUIV_List_GetEntry_Active, &dlnode);
4242 if(CheckDeviceValid(dlnode))
4244 psdGetAttrs(PGA_DEVICE, dlnode->pd,
4245 DA_HubDevice, &hubpd,
4246 DA_AtHubPortNumber, &hubport,
4247 TAG_END);
4248 if(hubpd)
4250 psdGetAttrs(PGA_DEVICE, hubpd,
4251 DA_BindingClass, &puc,
4252 TAG_END);
4254 if(puc)
4256 psdGetAttrs(PGA_USBCLASS, puc,
4257 UCA_ClassBase, &UsbClsBase,
4258 TAG_END);
4259 usbDoMethod(UCM_HubPowerCyclePort, hubpd, hubport);
4262 DoMethod(data->devlistobj, MUIM_List_Redraw, MUIV_List_Redraw_All);
4263 return(TRUE);
4265 /* \\\ */
4267 /* /// "Action_Dev_Disable()" */
4268 IPTR Action_Dev_Disable(struct IClass *cl, Object *obj, Msg msg)
4270 struct ActionData *data = INST_DATA(cl, obj);
4271 struct DevListEntry *dlnode;
4272 IPTR hubport = 0;
4273 struct Node *hubpd = NULL;
4274 struct Node *puc = NULL;
4275 struct Library *UsbClsBase;
4277 DoMethod(data->devlistobj, MUIM_List_GetEntry, MUIV_List_GetEntry_Active, &dlnode);
4278 if(CheckDeviceValid(dlnode))
4280 psdGetAttrs(PGA_DEVICE, dlnode->pd,
4281 DA_HubDevice, &hubpd,
4282 DA_AtHubPortNumber, &hubport,
4283 TAG_END);
4284 if(hubpd)
4286 psdGetAttrs(PGA_DEVICE, hubpd,
4287 DA_BindingClass, &puc,
4288 TAG_END);
4290 if(puc)
4292 psdGetAttrs(PGA_USBCLASS, puc,
4293 UCA_ClassBase, &UsbClsBase,
4294 TAG_END);
4295 usbDoMethod(UCM_HubDisablePort, hubpd, hubport);
4299 DoMethod(data->devlistobj, MUIM_List_Redraw, MUIV_List_Redraw_All);
4300 return(TRUE);
4302 /* \\\ */
4304 /* /// "Action_Dev_Configure()" */
4305 IPTR Action_Dev_Configure(struct IClass *cl, Object *obj, Msg msg)
4307 struct ActionData *data = INST_DATA(cl, obj);
4308 struct DevListEntry *dlnode;
4309 APTR binding;
4310 struct List *pclist;
4311 struct List *piflist;
4312 struct Node *pc;
4313 struct Node *pif;
4314 struct Node *puc;
4315 struct Library *UsbClsBase;
4317 DoMethod(data->devlistobj, MUIM_List_GetEntry, MUIV_List_GetEntry_Active, &dlnode);
4318 if(CheckDeviceValid(dlnode))
4320 psdLockReadDevice(dlnode->pd);
4321 psdGetAttrs(PGA_DEVICE, dlnode->pd,
4322 DA_Binding, &binding,
4323 DA_BindingClass, &puc,
4324 DA_ConfigList, &pclist,
4325 TAG_END);
4326 UsbClsBase = NULL;
4327 if(puc)
4329 psdGetAttrs(PGA_USBCLASS, puc,
4330 UCA_ClassBase, &UsbClsBase,
4331 TAG_END);
4333 if(binding && UsbClsBase)
4335 usbDoMethod(UCM_OpenBindingCfgWindow, binding);
4336 } else {
4337 pc = pclist->lh_Head;
4338 while(pc->ln_Succ)
4340 psdGetAttrs(PGA_CONFIG, pc,
4341 CA_InterfaceList, &piflist,
4342 TAG_END);
4343 pif = piflist->lh_Head;
4344 while(pif->ln_Succ)
4346 psdGetAttrs(PGA_INTERFACE, pif,
4347 IFA_Binding, &binding,
4348 IFA_BindingClass, &puc,
4349 TAG_END);
4350 UsbClsBase = NULL;
4351 if(puc)
4353 psdGetAttrs(PGA_USBCLASS, puc,
4354 UCA_ClassBase, &UsbClsBase,
4355 TAG_END);
4357 if(binding && UsbClsBase)
4359 usbDoMethod(UCM_OpenBindingCfgWindow, binding);
4361 pif = pif->ln_Succ;
4363 pc = pc->ln_Succ;
4366 psdUnlockDevice(dlnode->pd);
4367 return(TRUE);
4369 return(FALSE);
4371 /* \\\ */
4373 /* /// "Action_Dev_ForceBind()" */
4374 IPTR Action_Dev_ForceBind(struct IClass *cl, Object *obj, Msg msg)
4376 struct ActionData *data = INST_DATA(cl, obj);
4377 struct DevListEntry *dlnode;
4378 Object *mi = (Object *) ((IPTR *) msg)[1];
4379 STRPTR name = NULL;
4380 STRPTR devid = NULL;
4381 STRPTR devname = NULL;
4382 LONG clever;
4384 DoMethod(data->devlistobj, MUIM_List_GetEntry, MUIV_List_GetEntry_Active, &dlnode);
4385 if(CheckDeviceValid(dlnode))
4387 get(mi, MUIA_Menuitem_Title, &name);
4388 if(!strcmp(name, _(MSG_ACTION_DEV_FORCEBIND_NONE)))
4390 name = NULL;
4392 psdGetAttrs(PGA_DEVICE, dlnode->pd,
4393 DA_ProductName, &devname,
4394 DA_IDString, &devid,
4395 TAG_END);
4396 if(name)
4398 clever = MUI_RequestA(data->appobj, data->winobj, 0, NULL, _(MSG_ACTION_DEV_FORCE_REQ),_(MSG_ACTION_DEV_FORCE_REQ_TXT), NULL);
4399 if(!clever)
4401 return(FALSE);
4404 if(psdSetForcedBinding(name, devid, NULL))
4406 if(name)
4408 psdAddErrorMsg(RETURN_OK, _(MSG_APP_TITLE), _(MSG_ACTION_DEV_FORCE), devname, name);
4409 } else {
4410 psdAddErrorMsg(RETURN_OK, _(MSG_APP_TITLE), _(MSG_ACTION_DEV_FORCE_REMOVE), devname);
4414 return(TRUE);
4416 /* \\\ */
4418 /* /// "Action_Cfg_Changed()" */
4419 IPTR Action_Cfg_Changed(struct IClass *cl, Object *obj, Msg msg)
4421 struct ActionData *data = INST_DATA(cl, obj);
4422 IPTR bootdelay = 0;
4423 IPTR subtaskpri = 0;
4424 IPTR loginfo = 0;
4425 IPTR logwarn = 0;
4426 IPTR logerr = 0;
4427 IPTR logfail = 0;
4428 IPTR popupnew = 0;
4429 IPTR popupgone = 0;
4430 IPTR popupdeath = 0;
4431 IPTR popupdelay = 0;
4432 IPTR popupactivate = 0;
4433 IPTR popuptofront = 0;
4434 IPTR autodisablelp = 0;
4435 IPTR autodisabledead = 0;
4436 IPTR autorestartdead = 0;
4437 IPTR powersaving = 0;
4438 IPTR forcesuspend = 0;
4439 IPTR suspendtimeout = 0;
4440 APTR stackcfg = NULL;
4442 psdGetAttrs(PGA_STACK, NULL, PA_GlobalConfig, &stackcfg, TAG_END);
4443 get(data->cfgtaskpriobj, MUIA_Numeric_Value, &subtaskpri);
4444 get(data->cfgbootdelayobj, MUIA_Numeric_Value, &bootdelay);
4445 get(data->cfgloginfoobj, MUIA_Selected, &loginfo);
4446 get(data->cfglogwarnobj, MUIA_Selected, &logwarn);
4447 get(data->cfglogerrobj, MUIA_Selected, &logerr);
4448 get(data->cfglogfailobj, MUIA_Selected, &logfail);
4449 get(data->cfgpopupnewobj, MUIA_Cycle_Active, &popupnew);
4450 get(data->cfgpopupgoneobj, MUIA_Selected, &popupgone);
4451 get(data->cfgpopupdeathobj, MUIA_Selected, &popupdeath);
4452 get(data->cfgpopupdelayobj, MUIA_Numeric_Value, &popupdelay);
4453 get(data->cfgpopupactivateobj, MUIA_Selected, &popupactivate);
4454 get(data->cfgpopuptofrontobj, MUIA_Selected, &popuptofront);
4455 get(data->cfgautolpobj, MUIA_Selected, &autodisablelp);
4456 get(data->cfgautodeadobj, MUIA_Selected, &autodisabledead);
4457 get(data->cfgautopcobj, MUIA_Selected, &autorestartdead);
4458 get(data->cfgpowersavingobj, MUIA_Selected, &powersaving);
4459 get(data->cfgforcesuspendobj, MUIA_Selected, &forcesuspend);
4460 get(data->cfgsuspendtimeoutobj, MUIA_Numeric_Value, &suspendtimeout);
4462 if(autorestartdead && autodisabledead)
4464 autodisabledead = FALSE;
4465 nnset(data->cfgautodeadobj, MUIA_Selected, FALSE);
4467 if(autorestartdead)
4469 nnset(data->cfgautodeadobj, MUIA_Disabled, TRUE);
4470 } else {
4471 nnset(data->cfgautodeadobj, MUIA_Disabled, FALSE);
4473 if(stackcfg)
4475 psdSetAttrs(PGA_STACKCFG, stackcfg,
4476 GCA_SubTaskPri, subtaskpri,
4477 GCA_BootDelay, bootdelay,
4478 GCA_LogInfo, loginfo,
4479 GCA_LogWarning, logwarn,
4480 GCA_LogError, logerr,
4481 GCA_LogFailure, logfail,
4482 GCA_PopupDeviceNew, popupnew,
4483 GCA_PopupDeviceGone, popupgone,
4484 GCA_PopupDeviceDeath, popupdeath,
4485 GCA_PopupCloseDelay, popupdelay,
4486 GCA_PopupActivateWin, popupactivate,
4487 GCA_PopupWinToFront, popuptofront,
4488 GCA_AutoDisableLP, autodisablelp,
4489 GCA_AutoDisableDead, autodisabledead,
4490 GCA_AutoRestartDead, autorestartdead,
4491 GCA_PowerSaving, powersaving,
4492 GCA_ForceSuspend, forcesuspend,
4493 GCA_SuspendTimeout, suspendtimeout,
4494 TAG_END);
4496 return(TRUE);
4498 /* \\\ */
4500 /* /// "Action_Cfg_Snd_Changed()" */
4501 IPTR Action_Cfg_Snd_Changed(struct IClass *cl, Object *obj, Msg msg)
4503 struct ActionData *data = INST_DATA(cl, obj);
4504 STRPTR dtxsndfile = "";
4505 STRPTR remsndfile = "";
4506 APTR stackcfg = NULL;
4508 psdGetAttrs(PGA_STACK, NULL, PA_GlobalConfig, &stackcfg, TAG_END);
4509 get(data->cfgdevdtxsoundobj, MUIA_String_Contents, &dtxsndfile);
4510 get(data->cfgdevremsoundobj, MUIA_String_Contents, &remsndfile);
4511 if(stackcfg)
4513 psdSetAttrs(PGA_STACKCFG, stackcfg,
4514 GCA_InsertionSound, dtxsndfile,
4515 GCA_RemovalSound, remsndfile,
4516 TAG_END);
4518 return(TRUE);
4520 /* \\\ */
4522 /* /// "Action_Cls_Activate()" */
4523 IPTR Action_Cls_Activate(struct IClass *cl, Object *obj, Msg msg)
4525 struct ActionData *data = INST_DATA(cl, obj);
4526 struct ClsListEntry *clnode;
4527 DoMethod(data->clslistobj, MUIM_List_GetEntry, MUIV_List_GetEntry_Active, &clnode);
4528 if(clnode)
4530 struct Node *puc;
4531 struct List *lst;
4532 IPTR hascfggui = FALSE;
4533 struct Library *UsbClsBase;
4535 set(data->clsremobj, MUIA_Disabled, FALSE);
4537 psdLockReadPBase();
4538 psdGetAttrs(PGA_STACK, NULL, PA_ClassList, &lst, TAG_END);
4539 puc = lst->lh_Head;
4540 while(puc->ln_Succ)
4542 if(puc == clnode->puc)
4544 psdGetAttrs(PGA_USBCLASS, clnode->puc,
4545 UCA_ClassBase, &UsbClsBase,
4546 TAG_END);
4547 usbGetAttrs(UGA_CLASS, NULL,
4548 UCCA_HasClassCfgGUI, &hascfggui,
4549 TAG_END);
4550 set(data->clscfgobj, MUIA_Disabled, !hascfggui);
4551 break;
4553 puc = puc->ln_Succ;
4555 psdUnlockPBase();
4556 } else {
4557 set(data->clsremobj, MUIA_Disabled, TRUE);
4558 set(data->clscfgobj, MUIA_Disabled, TRUE);
4560 return(TRUE);
4562 /* \\\ */
4564 /* /// "Action_Cls_Add()" */
4565 IPTR Action_Cls_Add(struct IClass *cl, Object *obj, Msg msg)
4567 struct ActionData *data = INST_DATA(cl, obj);
4568 STRPTR clsname = "";
4569 get(data->clsnameobj, MUIA_String_Contents, &clsname);
4570 psdAddClass(clsname, 0);
4571 InternalCreateConfigGUI(data);
4572 return(TRUE);
4574 /* \\\ */
4576 /* /// "Action_Cls_Remove()" */
4577 IPTR Action_Cls_Remove(struct IClass *cl, Object *obj, Msg msg)
4579 struct ActionData *data = INST_DATA(cl, obj);
4580 struct ClsListEntry *clnode;
4581 DoMethod(data->clslistobj, MUIM_List_GetEntry, MUIV_List_GetEntry_Active, &clnode);
4582 if(clnode)
4584 struct Node *puc;
4585 struct List *lst;
4586 psdLockReadPBase();
4587 psdGetAttrs(PGA_STACK, NULL, PA_ClassList, &lst, TAG_END);
4588 puc = lst->lh_Head;
4589 while(puc->ln_Succ)
4591 if(puc == clnode->puc)
4593 clnode->puc = NULL;
4594 DoMethod(data->clslistobj, MUIM_List_Remove, MUIV_List_Remove_Active);
4595 FreeClsEntry(data, clnode);
4596 psdUnlockPBase();
4597 psdRemClass(puc);
4598 puc = NULL;
4599 break;
4601 puc = puc->ln_Succ;
4603 if(puc)
4605 psdUnlockPBase();
4608 InternalCreateConfigGUI(data);
4609 return(TRUE);
4611 /* \\\ */
4613 /* /// "Action_Cls_Scan()" */
4614 IPTR Action_Cls_Scan(struct IClass *cl, Object *obj, Msg msg)
4616 struct ActionData *data = INST_DATA(cl, obj);
4617 struct ExAllControl *exall;
4618 BPTR lock;
4619 struct ExAllData *exdata;
4620 ULONG ents;
4621 struct List *puclist;
4622 UBYTE buf[1024];
4623 UBYTE sbuf[128];
4624 BOOL exready;
4626 psdGetAttrs(PGA_STACK, NULL, PA_ClassList, &puclist, TAG_END);
4627 if((exall = AllocDosObject(DOS_EXALLCONTROL, NULL)))
4629 if((lock = Lock(CLASSPATH, ACCESS_READ)))
4631 exall->eac_LastKey = 0;
4632 exall->eac_MatchString = NULL;
4633 exall->eac_MatchFunc = NULL;
4636 exready = ExAll(lock, (struct ExAllData *) buf, 1024, ED_NAME, exall);
4637 exdata = (struct ExAllData *) buf;
4638 ents = exall->eac_Entries;
4639 while(ents--)
4641 psdSafeRawDoFmt(sbuf, 128, CLASSPATH "/%s", exdata->ed_Name);
4643 if(!FindName(puclist, exdata->ed_Name))
4645 psdAddClass(sbuf, 0);
4647 exdata = exdata->ed_Next;
4649 } while(exready);
4650 UnLock(lock);
4651 InternalCreateConfigGUI(data);
4652 psdClassScan();
4653 } else {
4654 /*errmsg = "Could not lock on SYS:Classes/USB.\n";*/
4656 FreeDosObject(DOS_EXALLCONTROL, exall);
4658 return(TRUE);
4660 /* \\\ */
4662 /* /// "Action_Cls_Configure()" */
4663 IPTR Action_Cls_Configure(struct IClass *cl, Object *obj, Msg msg)
4665 struct ActionData *data = INST_DATA(cl, obj);
4666 struct ClsListEntry *clnode;
4667 DoMethod(data->clslistobj, MUIM_List_GetEntry, MUIV_List_GetEntry_Active, &clnode);
4668 if(clnode)
4670 struct Node *puc;
4671 struct List *lst;
4672 struct Library *UsbClsBase;
4674 psdLockReadPBase();
4675 psdGetAttrs(PGA_STACK, NULL, PA_ClassList, &lst, TAG_END);
4676 puc = lst->lh_Head;
4677 while(puc->ln_Succ)
4679 if(puc == clnode->puc)
4681 psdGetAttrs(PGA_USBCLASS, clnode->puc,
4682 UCA_ClassBase, &UsbClsBase,
4683 TAG_END);
4684 usbDoMethod(UCM_OpenCfgWindow);
4685 break;
4687 puc = puc->ln_Succ;
4689 psdUnlockPBase();
4691 return(TRUE);
4693 return(FALSE);
4695 /* \\\ */
4697 /* /// "Action_Info_MemPool()" */
4698 IPTR Action_Info_MemPool(struct IClass *cl, Object *obj, Msg msg)
4700 struct ActionData *data = INST_DATA(cl, obj);
4701 char buf[32];
4702 IPTR mem;
4703 psdGetAttrs(PGA_STACK, NULL, PA_MemPoolUsage, &mem, TAG_END);
4704 psdSafeRawDoFmt(buf, 32, _(MSG_ACTION_MEMPOOL_FORMAT), (mem+512)>>10);
4705 set(data->mempoolobj, MUIA_Text_Contents, buf);
4706 return(TRUE);
4708 /* \\\ */
4710 /* /// "Action_Cfg_Activate()" */
4711 IPTR Action_Cfg_Activate(struct IClass *cl, Object *obj, Msg msg)
4713 struct ActionData *data = INST_DATA(cl, obj);
4714 struct PrefsListEntry *plnode;
4715 DoMethod(data->prefslistobj, MUIM_List_GetEntry, MUIV_List_GetEntry_Active, &plnode);
4716 if(plnode)
4718 BOOL noexport = FALSE;
4719 switch(plnode->chunkid)
4721 case IFFCHNK_FORCEDBIND:
4722 case MAKE_ID('P','S','D','L'):
4723 noexport = TRUE;
4726 set(data->prefsremoveobj, MUIA_Disabled, plnode->chunkid == IFFFORM_STACKCFG);
4727 set(data->prefsexportobj, MUIA_Disabled, noexport);
4728 } else {
4729 set(data->prefsremoveobj, MUIA_Disabled, TRUE);
4730 set(data->prefsexportobj, MUIA_Disabled, TRUE);
4732 return(TRUE);
4734 /* \\\ */
4736 /* /// "Action_Cfg_Remove()" */
4737 IPTR Action_Cfg_Remove(struct IClass *cl, Object *obj, Msg msg)
4739 struct ActionData *data = INST_DATA(cl, obj);
4740 struct PrefsListEntry *plnode;
4741 DoMethod(data->prefslistobj, MUIM_List_GetEntry, MUIV_List_GetEntry_Active, &plnode);
4742 if(plnode)
4744 LONG result;
4745 APTR pic;
4746 switch(plnode->chunkid)
4748 case IFFFORM_STACKCFG:
4749 break;
4751 case IFFFORM_DEVICECFG:
4752 result = MUI_RequestA(data->appobj, data->winobj, 0, NULL, _(MSG_ACTION_CFG_REMOVE),_(MSG_ACTION_CFG_REMOVE_HELP), &plnode->devid);
4753 if(result)
4755 pic = psdFindCfgForm(NULL, plnode->chunkid);
4756 while(pic)
4758 if(psdMatchStringChunk(pic, IFFCHNK_DEVID, plnode->devid))
4760 psdRemCfgForm(pic);
4761 break;
4763 pic = psdNextCfgForm(pic);
4766 break;
4768 case IFFFORM_CLASSCFG:
4769 result = MUI_RequestA(data->appobj, data->winobj, 0, NULL, _(MSG_ACTION_CFG_REMOVE),_(MSG_ACTION_CFG_REMOVE_DEFAULT), &plnode->owner);
4770 if(result)
4772 pic = psdFindCfgForm(NULL, IFFFORM_CLASSCFG);
4773 while(pic)
4775 if(psdMatchStringChunk(pic, IFFCHNK_OWNER, plnode->owner))
4777 psdRemCfgForm(pic);
4778 break;
4780 pic = psdNextCfgForm(pic);
4783 break;
4785 case IFFFORM_DEVCFGDATA:
4786 result = MUI_Request(data->appobj, data->winobj, 0, NULL, _(MSG_ACTION_CFG_REMOVE),_(MSG_ACTION_CFG_REMOVE_CLASS), plnode->owner, plnode->devid);
4787 if(result)
4789 pic = psdFindCfgForm(NULL, IFFFORM_DEVICECFG);
4790 while(pic)
4792 if(psdMatchStringChunk(pic, IFFCHNK_DEVID, plnode->devid))
4794 pic = psdFindCfgForm(pic, plnode->chunkid);
4795 while(pic)
4797 if(psdMatchStringChunk(pic, IFFCHNK_OWNER, plnode->owner))
4799 psdRemCfgForm(pic);
4800 break;
4802 pic = psdNextCfgForm(pic);
4804 break;
4806 pic = psdNextCfgForm(pic);
4809 break;
4811 case IFFFORM_IFCFGDATA:
4812 result = MUI_Request(data->appobj, data->winobj, 0, NULL, _(MSG_ACTION_CFG_REMOVE),_(MSG_ACTION_CFG_REMOVE_CLASS_DEF),
4813 plnode->owner, plnode->ifid, plnode->devid);
4814 if(result)
4816 pic = psdFindCfgForm(NULL, IFFFORM_DEVICECFG);
4817 while(pic)
4819 if(psdMatchStringChunk(pic, IFFCHNK_DEVID, plnode->devid))
4821 pic = psdFindCfgForm(pic, plnode->chunkid);
4822 while(pic)
4824 if(psdMatchStringChunk(pic, IFFCHNK_IFID, plnode->ifid))
4826 if(psdMatchStringChunk(pic, IFFCHNK_OWNER, plnode->owner))
4828 psdRemCfgForm(pic);
4829 break;
4832 pic = psdNextCfgForm(pic);
4834 break;
4836 pic = psdNextCfgForm(pic);
4839 break;
4841 case IFFCHNK_FORCEDBIND:
4842 psdSetForcedBinding(NULL, plnode->devid, plnode->ifid);
4843 break;
4845 default:
4846 if(plnode->chunkid)
4848 result = MUI_RequestA(data->appobj, data->winobj, 0, NULL, _(MSG_ACTION_CFG_REMOVE),_(MSG_ACTION_CFG_REMOVE_UNKNOWN), NULL);
4849 if(result)
4851 pic = psdFindCfgForm(NULL, plnode->chunkid);
4852 if(pic)
4854 psdRemCfgForm(pic);
4858 break;
4861 return(TRUE);
4863 /* \\\ */
4865 /* /// "Action_Cfg_Export()" */
4866 IPTR Action_Cfg_Export(struct IClass *cl, Object *obj, Msg msg)
4868 struct ActionData *data = INST_DATA(cl, obj);
4869 struct PrefsListEntry *plnode;
4870 struct FileRequester *aslreq;
4871 char path[256];
4872 struct TagItem asltags[] = { { ASLFR_InitialFile, __(MSG_ACTION_CFG_PREFS_FILE) },
4873 { ASLFR_InitialDrawer, (IPTR) "SYS:Prefs/Presets/Poseidon" },
4874 { ASLFR_TitleText, __(MSG_ACTION_CFG_EXPORT) },
4875 { ASLFR_DoSaveMode, (IPTR) TRUE },
4876 { TAG_END, (IPTR) NULL } };
4877 BPTR fh;
4878 ULONG *form;
4880 DoMethod(data->prefslistobj, MUIM_List_GetEntry, MUIV_List_GetEntry_Active, &plnode);
4881 if(plnode)
4883 APTR pic = NULL;
4884 switch(plnode->chunkid)
4886 case IFFFORM_STACKCFG:
4887 asltags[0].ti_Data = __(MSG_ACTION_STACKCFG_FILE);
4888 pic = psdFindCfgForm(NULL, plnode->chunkid);
4889 break;
4891 case IFFFORM_DEVICECFG:
4892 asltags[0].ti_Data = __(MSG_ACTION_DEVICECFG_FILE);
4893 pic = psdFindCfgForm(NULL, plnode->chunkid);
4894 while(pic)
4896 if(psdMatchStringChunk(pic, IFFCHNK_DEVID, plnode->devid))
4898 break;
4900 pic = psdNextCfgForm(pic);
4902 break;
4904 case IFFFORM_CLASSCFG:
4905 asltags[0].ti_Data = __(MSG_ACTION_CLASSCFG_FILE);
4906 pic = psdFindCfgForm(NULL, plnode->chunkid);
4907 while(pic)
4909 if(psdMatchStringChunk(pic, IFFCHNK_OWNER, plnode->owner))
4911 break;
4913 pic = psdNextCfgForm(pic);
4915 break;
4917 case IFFFORM_DEVCFGDATA:
4918 asltags[0].ti_Data = __(MSG_ACTION_DEVCFGDATA_FILE);
4919 pic = psdFindCfgForm(NULL, IFFFORM_DEVICECFG);
4920 while(pic)
4922 if(psdMatchStringChunk(pic, IFFCHNK_DEVID, plnode->devid))
4924 pic = psdFindCfgForm(pic, plnode->chunkid);
4925 while(pic)
4927 if(psdMatchStringChunk(pic, IFFCHNK_OWNER, plnode->owner))
4929 break;
4931 pic = psdNextCfgForm(pic);
4933 break;
4935 pic = psdNextCfgForm(pic);
4937 break;
4939 case IFFFORM_IFCFGDATA:
4940 asltags[0].ti_Data = __(MSG_ACTION_IFCFGDATA_FILE);
4941 pic = psdFindCfgForm(NULL, IFFFORM_DEVICECFG);
4942 while(pic)
4944 if(psdMatchStringChunk(pic, IFFCHNK_DEVID, plnode->devid))
4946 pic = psdFindCfgForm(pic, plnode->chunkid);
4947 while(pic)
4949 if(psdMatchStringChunk(pic, IFFCHNK_IFID, plnode->ifid))
4951 if(psdMatchStringChunk(pic, IFFCHNK_OWNER, plnode->owner))
4953 break;
4956 pic = psdNextCfgForm(pic);
4958 break;
4960 pic = psdNextCfgForm(pic);
4962 break;
4964 case IFFCHNK_FORCEDBIND:
4965 break;
4967 default:
4968 if(plnode->chunkid)
4970 pic = psdFindCfgForm(NULL, plnode->chunkid);
4972 break;
4974 if(!pic)
4976 return(FALSE);
4978 if((aslreq = MUI_AllocAslRequest(ASL_FileRequest, asltags)))
4980 if(MUI_AslRequest(aslreq, TAG_END))
4982 strcpy(path, aslreq->fr_Drawer);
4983 AddPart(path, aslreq->fr_File, 256);
4984 fh = Open(path, MODE_NEWFILE);
4985 if(fh)
4987 form = psdWriteCfg(pic);
4988 if(form)
4990 Write(fh, form, form[1]+8);
4991 psdFreeVec(form);
4993 Close(fh);
4994 } else {
4995 psdAddErrorMsg(RETURN_FAIL, _(MSG_APP_TITLE), _(MSG_ACTION_CFG_FAIL), path);
4998 MUI_FreeAslRequest(aslreq);
5000 return(TRUE);
5002 return(FALSE);
5004 /* \\\ */
5006 /* /// "Action_Cfg_Import()" */
5007 IPTR Action_Cfg_Import(struct IClass *cl, Object *obj, Msg msg)
5009 struct ActionData *data = INST_DATA(cl, obj);
5010 struct PrefsListEntry *plnode;
5011 struct FileRequester *aslreq;
5012 char path[256];
5013 BPTR fh;
5014 ULONG iffhead[3];
5015 ULONG *buff;
5016 APTR pic;
5018 struct TagItem asltags[] = { { ASLFR_InitialDrawer, (IPTR) "SYS:Prefs/Presets/Poseidon" },
5019 { ASLFR_TitleText, __(MSG_ACTION_CFG_IMPORT) },
5020 { TAG_END, (IPTR) NULL } };
5022 DoMethod(data->prefslistobj, MUIM_List_GetEntry, MUIV_List_GetEntry_Active, &plnode);
5024 if((aslreq = MUI_AllocAslRequest(ASL_FileRequest, asltags)))
5026 if(MUI_AslRequest(aslreq, TAG_END))
5028 strcpy(path, aslreq->fr_Drawer);
5029 AddPart(path, aslreq->fr_File, 256);
5030 fh = Open(path, MODE_OLDFILE);
5031 if(fh)
5033 Read(fh, iffhead, 12);
5034 if(AROS_LONG2BE(iffhead[0]) == ID_FORM)
5036 buff = psdAllocVec(AROS_LONG2BE(iffhead[1])+8);
5037 if(buff)
5039 buff[0] = iffhead[0];
5040 buff[1] = iffhead[1];
5041 buff[2] = iffhead[2];
5042 if(Read(fh, &buff[3], AROS_LONG2BE(iffhead[1])-4) == AROS_LONG2BE(iffhead[1])-4)
5044 switch(buff[2])
5046 case IFFFORM_STACKCFG:
5047 pic = psdFindCfgForm(NULL, AROS_LONG2BE(buff[2]));
5048 if(pic)
5050 psdReadCfg(pic, buff);
5051 } else {
5052 psdAddCfgEntry(NULL, buff);
5054 break;
5056 case IFFFORM_DEVICECFG:
5057 case IFFFORM_CLASSCFG:
5058 psdAddCfgEntry(NULL, buff);
5059 break;
5061 case IFFFORM_DEVCFGDATA:
5062 case IFFFORM_IFCFGDATA:
5063 if(plnode)
5065 if((plnode->chunkid == AROS_LONG2BE(buff[2])) ||
5066 (plnode->chunkid == IFFFORM_DEVICECFG) ||
5067 (plnode->chunkid == IFFFORM_IFCFGDATA))
5069 pic = psdFindCfgForm(NULL, IFFFORM_DEVICECFG);
5070 while(pic)
5072 if(psdMatchStringChunk(pic, IFFCHNK_DEVID, plnode->devid))
5074 psdAddCfgEntry(pic, buff);
5075 break;
5077 pic = psdNextCfgForm(pic);
5079 break;
5082 MUI_RequestA(data->appobj, data->winobj, 0, NULL, _(MSG_ACTION_CFGDATA_OOPS),_(MSG_ACTION_CFGDATA_OOPS_HELP), NULL);
5083 break;
5085 case IFFFORM_PSDCFG:
5086 psdLoadCfgFromDisk(path);
5087 break;
5089 default:
5090 MUI_RequestA(data->appobj, data->winobj, 0, NULL, _(MSG_ACTION_CFGDATA_OOPS),_(MSG_ACTION_CFGDATA_ERR), NULL);
5091 break;
5093 } else {
5094 psdAddErrorMsg(RETURN_ERROR, _(MSG_APP_TITLE), _(MSG_ACTION_CFGDATA_ERR_READ), path);
5096 psdFreeVec(buff);
5097 } else {
5098 psdAddErrorMsg(RETURN_ERROR, _(MSG_APP_TITLE), _(MSG_ACTION_CFGDATA_ERR_ALLOC), path);
5100 } else {
5101 psdAddErrorMsg(RETURN_ERROR, _(MSG_APP_TITLE), _(MSG_ACTION_CFGDATA_ERR_IFF), path);
5103 Close(fh);
5104 } else {
5105 psdAddErrorMsg(RETURN_FAIL, _(MSG_APP_TITLE), _(MSG_ACTION_CFGDATA_ERR_OPEN), path);
5108 MUI_FreeAslRequest(aslreq);
5110 return(TRUE);
5112 /* \\\ */
5114 /* /// "ActionDispatcher()" */
5115 AROS_UFH3(IPTR, ActionDispatcher,
5116 AROS_UFHA(struct IClass *, cl, A0),
5117 AROS_UFHA(Object *, obj, A2),
5118 AROS_UFHA(Msg, msg, A1))
5120 AROS_USERFUNC_INIT
5121 // There should never be an uninitialized pointer, but just in case, try to get an mungwall hit if so.
5122 struct ActionData *data = (struct ActionData *) 0xABADCAFE;
5124 // on OM_NEW the obj pointer will be void, so don't try to get the data base in this case.
5125 if(msg->MethodID != OM_NEW) data = INST_DATA(cl, obj);
5127 switch(msg->MethodID)
5129 case OM_NEW:
5130 return((IPTR) Action_OM_NEW(cl, obj, msg));
5132 case MUIM_Setup:
5133 return(Action_Setup(cl, obj, msg));
5135 case MUIM_Cleanup:
5136 //MUI_RejectIDCMP(obj, IDCMP_INTUITICKS);
5137 while(data->OnlUpdTask)
5139 Delay(50);
5141 DoMethod(data->appobj, MUIM_Application_RemInputHandler, &data->eventihn);
5142 data->appobj = NULL;
5143 data->winobj = NULL;
5144 return(DoSuperMethodA(cl,obj,msg));
5146 case OM_DISPOSE:
5147 Action_OM_DISPOSE(cl, obj, msg);
5148 break;
5150 case MUIM_Action_HandlePsdEvents:
5151 EventHandler(data);
5152 return(TRUE);
5154 case MUIM_Action_CloseSubWinReq:
5156 struct DefListEntry *winnode;
5157 winnode = (struct DefListEntry *) ((struct opSet *) msg)->ops_AttrList;
5158 if(winnode->infowindow)
5160 set(winnode->infowindow, MUIA_Window_Open, FALSE);
5161 DoMethod(data->appobj, OM_REMMEMBER, winnode->infowindow);
5162 DoMethod(winnode->infowindow, OM_DISPOSE);
5163 winnode->infowindow = NULL;
5165 return(TRUE);
5168 case MUIM_Action_Cfg_Changed:
5169 return(Action_Cfg_Changed(cl, obj, msg));
5171 case MUIM_Action_Cfg_Snd_Changed:
5172 return(Action_Cfg_Snd_Changed(cl, obj, msg));
5174 case MUIM_Action_HW_New:
5175 return(Action_HW_New(cl, obj, msg));
5177 case MUIM_Action_HW_Copy:
5178 return(Action_HW_Copy(cl, obj, msg));
5180 case MUIM_Action_HW_Del:
5181 return(Action_HW_Del(cl, obj, msg));
5183 case MUIM_Action_HW_Update:
5184 return(Action_HW_Update(cl, obj, msg));
5186 case MUIM_Action_HW_Activate:
5187 return(Action_HW_Activate(cl, obj, msg));
5189 case MUIM_Action_HW_Info:
5190 return(Action_HW_Info(cl, obj, msg));
5192 case MUIM_Action_HW_Online:
5193 return(Action_HW_Online(cl, obj, msg));
5195 case MUIM_Action_HW_Offline:
5196 return(Action_HW_Offline(cl, obj, msg));
5198 case MUIM_Action_Online:
5199 return(Action_Online(cl, obj, msg));
5201 case MUIM_Action_Offline:
5202 return(Action_Offline(cl, obj, msg));
5204 case MUIM_Action_Restart:
5205 return(Action_Restart(cl, obj, msg));
5207 case MUIM_Action_ChgErrLevel:
5208 return(Action_ChgErrLevel(cl, obj, msg));
5210 case MUIM_Action_SaveErrors:
5211 return(Action_SaveErrors(cl, obj, msg));
5213 case MUIM_Action_FlushErrors:
5214 return(Action_FlushErrors(cl, obj, msg));
5216 case MUIM_Action_SaveDeviceList:
5217 return(Action_SaveDeviceList(cl, obj, msg));
5219 case MUIM_Action_Use:
5220 InternalCreateConfigGUI(data);
5221 psdSaveCfgToDisk("ENV:PsdStackloader", TRUE);
5222 psdSaveCfgToDisk("ENV:Sys/poseidon.prefs", FALSE);
5223 return(TRUE);
5225 case MUIM_Action_LoadPrefs:
5226 return(Action_LoadPrefs(cl, obj, msg));
5228 case MUIM_Action_SavePrefsAs:
5229 return(Action_SavePrefsAs(cl, obj, msg));
5231 case MUIM_Action_SavePrefs:
5232 return(Action_SavePrefs(cl, obj, msg));
5234 case MUIM_Action_Prefs_Changed:
5235 return(Action_Prefs_Changed(cl, obj, msg));
5237 case MUIM_Action_UseQuit:
5238 return(Action_UseQuit(cl, obj, msg));
5240 case MUIM_Action_SaveQuit:
5241 return(Action_SaveQuit(cl, obj, msg));
5243 case MUIM_Action_LoadPrefsFrom:
5244 return(Action_LoadPrefsFrom(cl, obj, msg));
5246 case MUIM_Action_SavePrefsTo:
5247 return(Action_SavePrefsTo(cl, obj, msg));
5249 case MUIM_Action_Dev_Activate:
5250 return(Action_Dev_Activate(cl, obj, msg));
5252 case MUIM_Action_Dev_Bind:
5253 return(Action_Dev_Bind(cl, obj, msg));
5255 case MUIM_Action_Dev_Unbind:
5256 return(Action_Dev_Unbind(cl, obj, msg));
5258 case MUIM_Action_Dev_Suspend:
5259 return(Action_Dev_Suspend(cl, obj, msg));
5261 case MUIM_Action_Dev_Resume:
5262 return(Action_Dev_Resume(cl, obj, msg));
5264 case MUIM_Action_Dev_PowerCycle:
5265 return(Action_Dev_PowerCycle(cl, obj, msg));
5267 case MUIM_Action_Dev_Disable:
5268 return(Action_Dev_Disable(cl, obj, msg));
5270 case MUIM_Action_Dev_ForceBind:
5271 return(Action_Dev_ForceBind(cl, obj, msg));
5273 case MUIM_Action_Dev_Info:
5274 return(Action_Dev_Info(cl, obj, msg));
5276 case MUIM_Action_Dev_Configure:
5277 return(Action_Dev_Configure(cl, obj, msg));
5279 case MUIM_Action_Cls_Activate:
5280 return(Action_Cls_Activate(cl, obj, msg));
5282 case MUIM_Action_Cls_Add:
5283 return(Action_Cls_Add(cl, obj, msg));
5285 case MUIM_Action_Cls_Remove:
5286 return(Action_Cls_Remove(cl, obj, msg));
5288 case MUIM_Action_Cls_Scan:
5289 return(Action_Cls_Scan(cl, obj, msg));
5291 case MUIM_Action_Cls_Configure:
5292 return(Action_Cls_Configure(cl, obj, msg));
5294 case MUIM_Action_Info_MemPool:
5295 return(Action_Info_MemPool(cl, obj, msg));
5297 case MUIM_Action_About:
5298 DoMethod(data->cfgpagelv, MUIM_Set, MUIA_List_Active, 0);
5299 return(TRUE);
5301 case MUIM_Action_WakeUp:
5302 set(data->appobj, MUIA_Application_Iconified, FALSE);
5303 DoMethod(data->winobj, MUIM_Window_ToFront);
5304 set(data->winobj, MUIA_Window_Activate, TRUE);
5305 return(TRUE);
5307 case MUIM_Action_Cfg_Activate:
5308 return(Action_Cfg_Activate(cl, obj, msg));
5310 case MUIM_Action_Cfg_Remove:
5311 return(Action_Cfg_Remove(cl, obj, msg));
5313 case MUIM_Action_Cfg_Export:
5314 return(Action_Cfg_Export(cl, obj, msg));
5316 case MUIM_Action_Cfg_Import:
5317 return(Action_Cfg_Import(cl, obj, msg));
5320 return(DoSuperMethodA(cl,obj,msg));
5321 AROS_USERFUNC_EXIT
5323 /* \\\ */