tools/adflib: Add some sane defaults to the partition labels
[AROS.git] / rom / usb / trident / ActionClass.c
blob09efa688ca3548a72191f6ccfd380b527a9f97ca
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 psdEnumerateHardware(hlnode->phw);
3480 DoMethod(obj, MUIM_Action_HW_Activate);
3481 DoMethod(data->hwlistobj, MUIM_List_Redraw, MUIV_List_Redraw_All);
3482 psdClassScan();
3483 set(data->appobj, MUIA_Application_Sleep, FALSE);
3484 // update the online status to the config
3485 InternalCreateConfigGUI(data);
3486 return(TRUE);
3488 /* \\\ */
3490 /* /// "Action_HW_Offline()" */
3491 IPTR Action_HW_Offline(struct IClass *cl, Object *obj, Msg msg)
3493 struct ActionData *data = INST_DATA(cl, obj);
3494 struct HWListEntry *hlnode = data->acthlnode;
3495 struct Node *phw;
3496 struct List *lst;
3498 if((!hlnode) || (!hlnode->phw))
3500 return(FALSE);
3503 set(data->appobj, MUIA_Application_Sleep, TRUE);
3505 psdLockWritePBase();
3506 psdGetAttrs(PGA_STACK, NULL, PA_HardwareList, &lst, TAG_END);
3507 phw = lst->lh_Head;
3508 while(phw->ln_Succ)
3510 if(phw == hlnode->phw)
3512 psdUnlockPBase();
3513 psdRemHardware(phw);
3514 phw = NULL;
3515 break;
3517 phw = phw->ln_Succ;
3519 if(phw)
3521 psdUnlockPBase();
3523 hlnode->phw = NULL;
3524 hlnode->prodname = NULL;
3526 DoMethod(obj, MUIM_Action_HW_Activate);
3527 DoMethod(data->hwlistobj, MUIM_List_Redraw, MUIV_List_Redraw_All);
3528 set(data->appobj, MUIA_Application_Sleep, FALSE);
3529 // update the online status to the config
3530 // NOTE! This means that the hardware will not come online on next loading.
3531 InternalCreateConfigGUI(data);
3532 return(TRUE);
3534 /* \\\ */
3536 /* /// "Action_Online()" */
3537 IPTR Action_Online(struct IClass *cl, Object *obj, Msg msg)
3539 struct ActionData *data = INST_DATA(cl, obj);
3540 struct HWListEntry *hlnode;
3541 set(data->appobj, MUIA_Application_Sleep, TRUE);
3542 hlnode = (struct HWListEntry *) data->hwlist.lh_Head;
3543 while(hlnode->node.ln_Succ)
3545 if(!hlnode->phw)
3547 if((hlnode->phw = psdAddHardware(hlnode->devname, hlnode->unit)))
3549 psdGetAttrs(PGA_HARDWARE, hlnode->phw,
3550 HA_ProductName, &hlnode->prodname,
3551 TAG_END);
3552 psdEnumerateHardware(hlnode->phw);
3555 hlnode = (struct HWListEntry *) hlnode->node.ln_Succ;
3557 DoMethod(obj, MUIM_Action_HW_Activate);
3558 DoMethod(data->hwlistobj, MUIM_List_Redraw, MUIV_List_Redraw_All);
3559 psdClassScan();
3560 set(data->appobj, MUIA_Application_Sleep, FALSE);
3561 // update the online status to the config
3562 InternalCreateConfigGUI(data);
3563 return(TRUE);
3565 /* \\\ */
3567 /* /// "Action_Offline()" */
3568 IPTR Action_Offline(struct IClass *cl, Object *obj, Msg msg)
3570 struct ActionData *data = INST_DATA(cl, obj);
3571 struct HWListEntry *hlnode;
3572 set(data->appobj, MUIA_Application_Sleep, TRUE);
3573 hlnode = (struct HWListEntry *) data->hwlist.lh_Head;
3574 while(hlnode->node.ln_Succ)
3576 if(hlnode->phw)
3578 struct Node *phw;
3579 struct List *lst;
3580 psdLockWritePBase();
3581 psdGetAttrs(PGA_STACK, NULL, PA_HardwareList, &lst, TAG_END);
3582 phw = lst->lh_Head;
3583 while(phw->ln_Succ)
3585 if(phw == hlnode->phw)
3587 psdUnlockPBase();
3588 psdRemHardware(phw);
3589 phw = NULL;
3590 break;
3592 phw = phw->ln_Succ;
3594 if(phw)
3596 psdUnlockPBase();
3598 hlnode->phw = NULL;
3599 hlnode->prodname = NULL;
3601 hlnode = (struct HWListEntry *) hlnode->node.ln_Succ;
3603 DoMethod(obj, MUIM_Action_HW_Activate);
3604 DoMethod(data->hwlistobj, MUIM_List_Redraw, MUIV_List_Redraw_All);
3605 set(data->appobj, MUIA_Application_Sleep, FALSE);
3606 // update the online status to the config
3607 // NOTE! This means that the hardware will not come online on next loading.
3608 InternalCreateConfigGUI(data);
3609 return(TRUE);
3611 /* \\\ */
3613 /* /// "Action_Restart()" */
3614 IPTR Action_Restart(struct IClass *cl, Object *obj, Msg msg)
3616 struct ActionData *data = INST_DATA(cl, obj);
3617 struct HWListEntry *hlnode;
3618 set(data->appobj, MUIA_Application_Sleep, TRUE);
3619 hlnode = (struct HWListEntry *) data->hwlist.lh_Head;
3620 while(hlnode->node.ln_Succ)
3622 if(hlnode->phw)
3624 struct Node *phw;
3625 struct List *lst;
3626 psdLockWritePBase();
3627 psdGetAttrs(PGA_STACK, NULL, PA_HardwareList, &lst, TAG_END);
3628 phw = lst->lh_Head;
3629 while(phw->ln_Succ)
3631 if(phw == hlnode->phw)
3633 psdUnlockPBase();
3634 psdRemHardware(phw);
3635 phw = NULL;
3636 break;
3638 phw = phw->ln_Succ;
3640 if(phw)
3642 psdUnlockPBase();
3644 hlnode->phw = NULL;
3645 hlnode->prodname = NULL;
3647 hlnode = (struct HWListEntry *) hlnode->node.ln_Succ;
3649 hlnode = (struct HWListEntry *) data->hwlist.lh_Head;
3650 while(hlnode->node.ln_Succ)
3652 if(!hlnode->phw)
3654 if((hlnode->phw = psdAddHardware(hlnode->devname, hlnode->unit)))
3656 psdGetAttrs(PGA_HARDWARE, hlnode->phw,
3657 HA_ProductName, &hlnode->prodname,
3658 TAG_END);
3659 psdEnumerateHardware(hlnode->phw);
3662 hlnode = (struct HWListEntry *) hlnode->node.ln_Succ;
3664 DoMethod(obj, MUIM_Action_HW_Activate);
3665 DoMethod(data->hwlistobj, MUIM_List_Redraw, MUIV_List_Redraw_All);
3666 psdClassScan();
3667 set(data->appobj, MUIA_Application_Sleep, FALSE);
3668 return(TRUE);
3670 /* \\\ */
3672 /* /// "Action_ChgErrLevel()" */
3673 IPTR Action_ChgErrLevel(struct IClass *cl, Object *obj, Msg msg)
3675 struct ActionData *data = INST_DATA(cl, obj);
3676 IPTR lev = 0;
3677 get(data->errlvlobj, MUIA_Cycle_Active, &lev);
3678 switch(lev)
3680 case 0:
3681 data->errorlevel = RETURN_OK;
3682 break;
3683 case 1:
3684 data->errorlevel = RETURN_WARN;
3685 break;
3686 case 2:
3687 data->errorlevel = RETURN_ERROR;
3688 break;
3689 case 3:
3690 data->errorlevel = RETURN_FAIL;
3691 break;
3693 CreateErrorList(data);
3694 return(TRUE);
3696 /* \\\ */
3698 /* /// "WriteErrorLogFile()" */
3699 void WriteErrorLogFile(BPTR fh)
3701 struct List *lst;
3702 struct Node *pem;
3703 IPTR level;
3704 STRPTR origin;
3705 STRPTR errstr;
3706 struct DateStamp *ds;
3707 struct DateTime dt;
3708 struct DateStamp currdate;
3709 UBYTE strdate[LEN_DATSTRING];
3710 UBYTE strtime[LEN_DATSTRING];
3712 DateStamp(&currdate);
3713 psdLockReadPBase();
3714 psdGetAttrs(PGA_STACK, NULL, PA_ErrorMsgList, &lst, TAG_END);
3715 pem = lst->lh_Head;
3716 while(pem->ln_Succ)
3718 ds = NULL;
3719 psdGetAttrs(PGA_ERRORMSG, pem,
3720 EMA_Level, &level,
3721 EMA_Origin, &origin,
3722 EMA_Msg, &errstr,
3723 EMA_DateStamp, &ds,
3724 TAG_END);
3725 if(ds)
3727 dt.dat_Stamp.ds_Days = ds->ds_Days;
3728 dt.dat_Stamp.ds_Minute = ds->ds_Minute;
3729 dt.dat_Stamp.ds_Tick = ds->ds_Tick;
3730 dt.dat_Format = FORMAT_DEF;
3731 dt.dat_Flags = 0;
3732 dt.dat_StrDay = NULL;
3733 dt.dat_StrDate = strdate;
3734 dt.dat_StrTime = strtime;
3735 DateToStr(&dt);
3736 if(currdate.ds_Days == ds->ds_Days)
3738 FPrintf(fh, "%s| %2ld-%s: %s\n", strtime, level, origin, errstr);
3739 } else {
3740 FPrintf(fh, "%s %s| %2ld-%s: %s\n", strdate, strtime, level, origin, errstr);
3742 } else {
3743 FPrintf(fh, "%2ld-%s: %s\n", level, origin, errstr);
3745 pem = pem->ln_Succ;
3747 psdUnlockPBase();
3749 /* \\\ */
3751 /* /// "Action_SaveErrors()" */
3752 IPTR Action_SaveErrors(struct IClass *cl, Object *obj, Msg msg)
3754 struct FileRequester *aslreq;
3755 char path[256];
3756 struct TagItem asltags[] = { { ASLFR_InitialDrawer, (IPTR) "RAM:" },
3757 { ASLFR_InitialFile, __(MSG_ACTION_SAVE_ERR_FILE) },
3758 { ASLFR_DoSaveMode, (IPTR) TRUE },
3759 { ASLFR_TitleText, __(MSG_ACTION_SAVE_ERR) },
3760 { TAG_END, (IPTR) NULL } };
3761 BPTR fh;
3763 if((aslreq = MUI_AllocAslRequest(ASL_FileRequest, asltags)))
3765 if(MUI_AslRequest(aslreq, TAG_END))
3767 strcpy(path, aslreq->fr_Drawer);
3768 AddPart(path, aslreq->fr_File, 256);
3769 if((fh = Open(path, MODE_NEWFILE)))
3771 WriteErrorLogFile(fh);
3772 Close(fh);
3773 psdAddErrorMsg(RETURN_OK, _(MSG_APP_TITLE), _(MSG_ACTION_ERR_SAVED), path);
3774 } else {
3775 psdAddErrorMsg(RETURN_ERROR, _(MSG_APP_TITLE), _(MSG_ACTION_ERR_SAVED_ERRWRITE), path);
3777 MUI_FreeAslRequest(aslreq);
3780 return(TRUE);
3782 /* \\\ */
3784 /* /// "Action_FlushErrors()" */
3785 IPTR Action_FlushErrors(struct IClass *cl, Object *obj, Msg msg)
3787 struct ActionData *data = INST_DATA(cl, obj);
3788 struct List *lst;
3789 psdGetAttrs(PGA_STACK, NULL, PA_ErrorMsgList, &lst, TAG_END);
3790 Forbid();
3791 while(lst->lh_Head->ln_Succ)
3793 psdRemErrorMsg(lst->lh_Head);
3795 Permit();
3796 CreateErrorList(data);
3797 return(TRUE);
3799 /* \\\ */
3801 /* /// "Action_SaveDeviceList()" */
3802 IPTR Action_SaveDeviceList(struct IClass *cl, Object *obj, Msg msg)
3804 struct FileRequester *aslreq;
3805 char path[256];
3806 struct TagItem asltags[] = { { ASLFR_InitialDrawer, (IPTR) "RAM:" },
3807 { ASLFR_InitialFile, __(MSG_ACTION_SAVE_DEV_FILE) },
3808 { ASLFR_DoSaveMode, (IPTR) TRUE },
3809 { ASLFR_TitleText, __(MSG_ACTION_SAVE_DEV) },
3810 { TAG_END, (IPTR) NULL } };
3811 BPTR fh;
3813 if((aslreq = MUI_AllocAslRequest(ASL_FileRequest, asltags)))
3815 if(MUI_AslRequest(aslreq, TAG_END))
3817 strcpy(path, aslreq->fr_Drawer);
3818 AddPart(path, aslreq->fr_File, 256);
3819 if((fh = Open(path, MODE_NEWFILE)))
3821 if(SystemTags("PsdDevLister", SYS_Output, fh, TAG_END))
3823 psdAddErrorMsg(RETURN_ERROR,_(MSG_APP_TITLE), _(MSG_ACTION_SAVE_DEV_ERREXE));
3824 } else {
3825 psdAddErrorMsg(RETURN_OK, _(MSG_APP_TITLE), _(MSG_ACTION_DEV_SAVED), path);
3827 Close(fh);
3828 } else {
3829 psdAddErrorMsg(RETURN_ERROR, _(MSG_APP_TITLE), _(MSG_ACTION_ERR_SAVED_ERRWRITE), path);
3831 MUI_FreeAslRequest(aslreq);
3834 return(TRUE);
3836 /* \\\ */
3838 /* /// "Action_LoadPrefs()" */
3839 IPTR Action_LoadPrefs(struct IClass *cl, Object *obj, Msg msg)
3841 //struct ActionData *data = INST_DATA(cl, obj);
3842 struct FileRequester *aslreq;
3843 char path[256];
3844 struct TagItem asltags[] = { { ASLFR_InitialDrawer, (IPTR) "ENVARC:Sys" },
3845 { ASLFR_InitialFile, (IPTR) "Poseidon.prefs" },
3846 { ASLFR_TitleText, __(MSG_ACTION_PREFS_LOAD) },
3847 { TAG_END, (IPTR) NULL } };
3849 if((aslreq = MUI_AllocAslRequest(ASL_FileRequest, asltags)))
3851 if(MUI_AslRequest(aslreq, TAG_END))
3853 strcpy(path, aslreq->fr_Drawer);
3854 AddPart(path, aslreq->fr_File, 256);
3855 if(psdLoadCfgFromDisk(path))
3857 psdAddErrorMsg(RETURN_OK, _(MSG_APP_TITLE), _(MSG_ACTION_PREFS_LOADED), path);
3858 //UpdateConfigToGUI(data);
3861 MUI_FreeAslRequest(aslreq);
3863 return(TRUE);
3865 /* \\\ */
3867 /* /// "Action_SavePrefsAs()" */
3868 IPTR Action_SavePrefsAs(struct IClass *cl, Object *obj, Msg msg)
3870 struct ActionData *data = INST_DATA(cl, obj);
3871 struct FileRequester *aslreq;
3872 char path[256];
3873 struct TagItem asltags[] = { { ASLFR_InitialDrawer, (IPTR) "ENVARC:Sys" },
3874 { ASLFR_InitialFile, (IPTR) "Poseidon.prefs" },
3875 { ASLFR_TitleText, __(MSG_ACTION_PREFS_SAVEAS) },
3876 { ASLFR_DoSaveMode, (IPTR) TRUE },
3877 { TAG_END, (IPTR) NULL } };
3879 if((aslreq = MUI_AllocAslRequest(ASL_FileRequest, asltags)))
3881 if(MUI_AslRequest(aslreq, TAG_END))
3883 strcpy(path, aslreq->fr_Drawer);
3884 AddPart(path, aslreq->fr_File, 256);
3885 InternalCreateConfigGUI(data);
3886 if(psdSaveCfgToDisk(path, FALSE))
3888 psdAddErrorMsg(RETURN_OK, _(MSG_APP_TITLE), _(MSG_ACTION_PREFS_SAVED), path);
3890 IPTR hash = 0;
3891 psdGetAttrs(PGA_STACK, NULL, PA_CurrConfigHash, &hash, TAG_END);
3892 psdSetAttrs(PGA_STACK, NULL, PA_SavedConfigHash, hash, TAG_END);
3894 } else {
3895 psdAddErrorMsg(RETURN_ERROR, _(MSG_APP_TITLE), _(MSG_ACTION_PREFS_SAVEDERR), path);
3897 MUI_FreeAslRequest(aslreq);
3900 return(TRUE);
3902 /* \\\ */
3904 /* /// "Action_SavePrefs()" */
3905 IPTR Action_SavePrefs(struct IClass *cl, Object *obj, Msg msg)
3907 struct ActionData *data = INST_DATA(cl, obj);
3909 DoMethod(obj, MUIM_Action_Cfg_Snd_Changed);
3910 InternalCreateConfigGUI(data);
3912 if(!psdSaveCfgToDisk(NULL, FALSE))
3914 psdAddErrorMsg(RETURN_ERROR, _(MSG_APP_TITLE), _(MSG_ACTION_PREFS_NOTSAVED));
3915 } else {
3916 psdAddErrorMsg(RETURN_OK, _(MSG_APP_TITLE), _(MSG_ACTION_PREFS_SAVEDSUCCESS));
3919 return(TRUE);
3921 /* \\\ */
3923 /* /// "Action_Prefs_Changed()" */
3924 IPTR Action_Prefs_Changed(struct IClass *cl, Object *obj, Msg msg)
3926 IPTR oldhash = 0;
3927 IPTR currhash = 0;
3928 DoMethod(obj, MUIM_Action_Cfg_Snd_Changed);
3929 psdGetAttrs(PGA_STACK, NULL,
3930 PA_CurrConfigHash, &currhash,
3931 PA_SavedConfigHash, &oldhash,
3932 TAG_END);
3933 return((IPTR) (currhash != oldhash));
3935 /* \\\ */
3937 /* /// "Action_UseQuit()" */
3938 IPTR Action_UseQuit(struct IClass *cl, Object *obj, Msg msg)
3940 struct ActionData *data = INST_DATA(cl, obj);
3941 LONG res;
3942 //DoMethod(obj, MUIM_Action_Cfg_Snd_Changed);
3943 DoMethod(obj, MUIM_Action_Use);
3944 if(DoMethod(obj, MUIM_Action_Prefs_Changed))
3946 res = MUI_RequestA(data->appobj, data->winobj, 0, NULL, _(MSG_ACTION_USEQUIT), _(MSG_ACTION_CONFIGCHANGED), NULL);
3947 if(res == 0)
3949 return(FALSE);
3951 if(res == 2)
3953 DoMethod(obj, MUIM_Action_SavePrefs);
3956 DoMethod(data->appobj, MUIM_Application_ReturnID, MUIV_Application_ReturnID_Quit);
3957 return(TRUE);
3959 /* \\\ */
3961 /* /// "Action_SaveQuit()" */
3962 IPTR Action_SaveQuit(struct IClass *cl, Object *obj, Msg msg)
3964 struct ActionData *data = INST_DATA(cl, obj);
3965 DoMethod(obj, MUIM_Action_Cfg_Snd_Changed);
3966 DoMethod(obj, MUIM_Action_Use);
3967 if(!(psdSaveCfgToDisk(NULL, FALSE)))
3969 psdAddErrorMsg(RETURN_ERROR, _(MSG_APP_TITLE), _(MSG_ACTION_SAVEQUIT));
3970 } else {
3971 DoMethod(data->appobj, MUIM_Application_ReturnID, MUIV_Application_ReturnID_Quit);
3973 return(TRUE);
3975 /* \\\ */
3977 /* /// "Action_LoadPrefsFrom()" */
3978 IPTR Action_LoadPrefsFrom(struct IClass *cl, Object *obj, Msg msg)
3980 //struct ActionData *data = INST_DATA(cl, obj);
3981 STRPTR path = (STRPTR) ((struct opSet *) msg)->ops_AttrList;
3982 if(psdLoadCfgFromDisk(path))
3984 psdAddErrorMsg(RETURN_OK, _(MSG_APP_TITLE), _(MSG_ACTION_PREFS_LOADED), path);
3985 return(TRUE);
3987 return(FALSE);
3989 /* \\\ */
3991 /* /// "Action_SavePrefsTo()" */
3992 IPTR Action_SavePrefsTo(struct IClass *cl, Object *obj, Msg msg)
3994 struct ActionData *data = INST_DATA(cl, obj);
3995 STRPTR path = (STRPTR) ((struct opSet *) msg)->ops_AttrList;
3996 InternalCreateConfigGUI(data);
3997 if(psdSaveCfgToDisk(path, FALSE))
3999 psdAddErrorMsg(RETURN_OK, _(MSG_APP_TITLE), _(MSG_ACTION_PREFS_SAVED), path);
4000 return(TRUE);
4002 return(FALSE);
4004 /* \\\ */
4006 /* /// "Action_Dev_Activate()" */
4007 IPTR Action_Dev_Activate(struct IClass *cl, Object *obj, Msg msg)
4009 struct ActionData *data = INST_DATA(cl, obj);
4010 struct DevListEntry *dlnode;
4011 APTR binding;
4012 APTR cbind;
4013 struct List *pclist;
4014 struct List *piflist;
4015 struct Node *pc;
4016 struct Node *pif;
4017 struct Node *puc;
4018 IPTR hascfggui = FALSE;
4019 IPTR issuspended = FALSE;
4020 struct Library *UsbClsBase;
4022 DoMethod(data->devlistobj, MUIM_List_GetEntry, MUIV_List_GetEntry_Active, &dlnode);
4023 if(CheckDeviceValid(dlnode))
4025 psdLockReadDevice(dlnode->pd);
4026 set(data->devinfoobj, MUIA_Disabled, FALSE);
4027 psdGetAttrs(PGA_DEVICE, dlnode->pd,
4028 DA_Binding, &binding,
4029 DA_BindingClass, &puc,
4030 DA_ConfigList, &pclist,
4031 DA_IsSuspended, &issuspended,
4032 TAG_END);
4033 if(binding && puc)
4035 psdGetAttrs(PGA_USBCLASS, puc,
4036 UCA_ClassBase, &UsbClsBase,
4037 TAG_END);
4038 usbGetAttrs(UGA_CLASS, NULL,
4039 UCCA_HasBindingCfgGUI, &hascfggui,
4040 TAG_END);
4042 pc = pclist->lh_Head;
4043 while((!binding) && pc->ln_Succ)
4045 psdGetAttrs(PGA_CONFIG, pc,
4046 CA_InterfaceList, &piflist,
4047 TAG_END);
4048 pif = piflist->lh_Head;
4049 while(pif->ln_Succ)
4051 psdGetAttrs(PGA_INTERFACE, pif,
4052 IFA_Binding, &cbind,
4053 IFA_BindingClass, &puc,
4054 TAG_END);
4055 if(cbind)
4057 binding = cbind;
4059 if(cbind && puc && !hascfggui)
4061 psdGetAttrs(PGA_USBCLASS, puc,
4062 UCA_ClassBase, &UsbClsBase,
4063 TAG_END);
4064 usbGetAttrs(UGA_CLASS, NULL,
4065 UCCA_HasBindingCfgGUI, &hascfggui,
4066 TAG_END);
4068 pif = pif->ln_Succ;
4070 pc = pc->ln_Succ;
4072 psdUnlockDevice(dlnode->pd);
4073 set(data->devunbindobj, MUIA_Disabled, !binding);
4074 set(data->devcfgobj, MUIA_Disabled, !hascfggui);
4075 /*if(dlnode->infowindow) FIXME
4077 DoMethod(obj, MUIM_Action_Dev_If_Activate, dlnode);
4079 set(data->devsuspendobj, MUIA_Disabled, issuspended);
4080 set(data->devresumeobj, MUIA_Disabled, !issuspended);
4081 set(data->devpowercycleobj, MUIA_Disabled, FALSE);
4082 set(data->devdisableobj, MUIA_Disabled, FALSE);
4083 set(data->devlistobj, MUIA_ContextMenu, data->mi_classpopup);
4084 } else {
4085 set(data->devunbindobj, MUIA_Disabled, TRUE);
4086 set(data->devinfoobj, MUIA_Disabled, TRUE);
4087 set(data->devcfgobj, MUIA_Disabled, TRUE);
4088 set(data->devsuspendobj, MUIA_Disabled, TRUE);
4089 set(data->devresumeobj, MUIA_Disabled, TRUE);
4090 set(data->devpowercycleobj, MUIA_Disabled, TRUE);
4091 set(data->devdisableobj, MUIA_Disabled, TRUE);
4092 set(data->devlistobj, MUIA_ContextMenu, NULL);
4094 return(TRUE);
4096 /* \\\ */
4098 /* /// "Action_Dev_Info()" */
4099 IPTR Action_Dev_Info(struct IClass *cl, Object *obj, Msg msg)
4101 struct ActionData *data = INST_DATA(cl, obj);
4102 struct DevListEntry *dlnode;
4104 DoMethod(data->devlistobj, MUIM_List_GetEntry, MUIV_List_GetEntry_Active, &dlnode);
4105 if(dlnode)
4107 if(dlnode->infowindow)
4109 return(TRUE);
4111 dlnode->infowindow = NewObject(DevWinClass->mcc_Class, 0, MUIA_DevWin_DevEntry, dlnode, WindowContents, VGroup, End, TAG_END);
4112 if(dlnode->infowindow)
4114 DoMethod(data->appobj, OM_ADDMEMBER, dlnode->infowindow);
4115 DoMethod(dlnode->infowindow, MUIM_Notify, MUIA_Window_CloseRequest, TRUE,
4116 data->appobj, 5, MUIM_Application_PushMethod, obj, 2, MUIM_Action_CloseSubWinReq, dlnode);
4117 set(dlnode->infowindow, MUIA_Window_Open, TRUE);
4120 return(TRUE);
4122 /* \\\ */
4124 /* /// "Action_Dev_Bind()" */
4125 IPTR Action_Dev_Bind(struct IClass *cl, Object *obj, Msg msg)
4127 struct ActionData *data = INST_DATA(cl, obj);
4128 psdClassScan();
4129 DoMethod(obj, MUIM_Action_Dev_Activate);
4130 DoMethod(data->devlistobj, MUIM_List_Redraw, MUIV_List_Redraw_All);
4131 return(TRUE);
4133 /* \\\ */
4135 /* /// "Action_Dev_Unbind()" */
4136 IPTR Action_Dev_Unbind(struct IClass *cl, Object *obj, Msg msg)
4138 struct ActionData *data = INST_DATA(cl, obj);
4139 struct DevListEntry *dlnode;
4140 APTR binding;
4141 struct List *pclist;
4142 struct List *piflist;
4143 struct Node *pc;
4144 struct Node *pif;
4146 DoMethod(data->devlistobj, MUIM_List_GetEntry, MUIV_List_GetEntry_Active, &dlnode);
4147 if(CheckDeviceValid(dlnode))
4149 psdGetAttrs(PGA_DEVICE, dlnode->pd,
4150 DA_Binding, &binding,
4151 DA_ConfigList, &pclist,
4152 TAG_END);
4153 if(binding)
4155 psdReleaseDevBinding(dlnode->pd);
4156 } else {
4157 pc = pclist->lh_Head;
4158 while(pc->ln_Succ)
4160 psdGetAttrs(PGA_CONFIG, pc,
4161 CA_InterfaceList, &piflist,
4162 TAG_END);
4163 pif = piflist->lh_Head;
4164 while(pif->ln_Succ)
4166 psdGetAttrs(PGA_INTERFACE, pif,
4167 IFA_Binding, &binding,
4168 TAG_END);
4169 if(binding)
4171 psdReleaseIfBinding(pif);
4173 pif = pif->ln_Succ;
4175 pc = pc->ln_Succ;
4178 set(data->devunbindobj, MUIA_Disabled, TRUE);
4179 set(data->devcfgobj, MUIA_Disabled, TRUE);
4180 /*if(dlnode->infowindow) FIXME
4182 DoMethod(obj, MUIM_Action_Dev_If_Activate, dlnode);
4183 DoMethod(dlnode->iflvobj, MUIM_List_Redraw, MUIV_List_Redraw_All);
4186 DoMethod(data->devlistobj, MUIM_List_Redraw, MUIV_List_Redraw_All);
4187 return(TRUE);
4189 /* \\\ */
4191 /* /// "Action_Dev_Suspend()" */
4192 IPTR Action_Dev_Suspend(struct IClass *cl, Object *obj, Msg msg)
4194 struct ActionData *data = INST_DATA(cl, obj);
4195 struct DevListEntry *dlnode;
4197 DoMethod(data->devlistobj, MUIM_List_GetEntry, MUIV_List_GetEntry_Active, &dlnode);
4198 if(CheckDeviceValid(dlnode))
4200 psdSuspendDevice(dlnode->pd);
4202 DoMethod(data->devlistobj, MUIM_List_Redraw, MUIV_List_Redraw_All);
4203 return(TRUE);
4205 /* \\\ */
4207 /* /// "Action_Dev_Resume()" */
4208 IPTR Action_Dev_Resume(struct IClass *cl, Object *obj, Msg msg)
4210 struct ActionData *data = INST_DATA(cl, obj);
4211 struct DevListEntry *dlnode;
4213 DoMethod(data->devlistobj, MUIM_List_GetEntry, MUIV_List_GetEntry_Active, &dlnode);
4214 if(CheckDeviceValid(dlnode))
4216 psdResumeDevice(dlnode->pd);
4218 DoMethod(data->devlistobj, MUIM_List_Redraw, MUIV_List_Redraw_All);
4219 return(TRUE);
4221 /* \\\ */
4223 /* /// "Action_Dev_PowerCycle()" */
4224 IPTR Action_Dev_PowerCycle(struct IClass *cl, Object *obj, Msg msg)
4226 struct ActionData *data = INST_DATA(cl, obj);
4227 struct DevListEntry *dlnode;
4228 IPTR hubport = 0;
4229 struct Node *hubpd = NULL;
4230 struct Node *puc = NULL;
4231 struct Library *UsbClsBase;
4233 DoMethod(data->devlistobj, MUIM_List_GetEntry, MUIV_List_GetEntry_Active, &dlnode);
4234 if(CheckDeviceValid(dlnode))
4236 psdGetAttrs(PGA_DEVICE, dlnode->pd,
4237 DA_HubDevice, &hubpd,
4238 DA_AtHubPortNumber, &hubport,
4239 TAG_END);
4240 if(hubpd)
4242 psdGetAttrs(PGA_DEVICE, hubpd,
4243 DA_BindingClass, &puc,
4244 TAG_END);
4246 if(puc)
4248 psdGetAttrs(PGA_USBCLASS, puc,
4249 UCA_ClassBase, &UsbClsBase,
4250 TAG_END);
4251 usbDoMethod(UCM_HubPowerCyclePort, hubpd, hubport);
4254 DoMethod(data->devlistobj, MUIM_List_Redraw, MUIV_List_Redraw_All);
4255 return(TRUE);
4257 /* \\\ */
4259 /* /// "Action_Dev_Disable()" */
4260 IPTR Action_Dev_Disable(struct IClass *cl, Object *obj, Msg msg)
4262 struct ActionData *data = INST_DATA(cl, obj);
4263 struct DevListEntry *dlnode;
4264 IPTR hubport = 0;
4265 struct Node *hubpd = NULL;
4266 struct Node *puc = NULL;
4267 struct Library *UsbClsBase;
4269 DoMethod(data->devlistobj, MUIM_List_GetEntry, MUIV_List_GetEntry_Active, &dlnode);
4270 if(CheckDeviceValid(dlnode))
4272 psdGetAttrs(PGA_DEVICE, dlnode->pd,
4273 DA_HubDevice, &hubpd,
4274 DA_AtHubPortNumber, &hubport,
4275 TAG_END);
4276 if(hubpd)
4278 psdGetAttrs(PGA_DEVICE, hubpd,
4279 DA_BindingClass, &puc,
4280 TAG_END);
4282 if(puc)
4284 psdGetAttrs(PGA_USBCLASS, puc,
4285 UCA_ClassBase, &UsbClsBase,
4286 TAG_END);
4287 usbDoMethod(UCM_HubDisablePort, hubpd, hubport);
4291 DoMethod(data->devlistobj, MUIM_List_Redraw, MUIV_List_Redraw_All);
4292 return(TRUE);
4294 /* \\\ */
4296 /* /// "Action_Dev_Configure()" */
4297 IPTR Action_Dev_Configure(struct IClass *cl, Object *obj, Msg msg)
4299 struct ActionData *data = INST_DATA(cl, obj);
4300 struct DevListEntry *dlnode;
4301 APTR binding;
4302 struct List *pclist;
4303 struct List *piflist;
4304 struct Node *pc;
4305 struct Node *pif;
4306 struct Node *puc;
4307 struct Library *UsbClsBase;
4309 DoMethod(data->devlistobj, MUIM_List_GetEntry, MUIV_List_GetEntry_Active, &dlnode);
4310 if(CheckDeviceValid(dlnode))
4312 psdLockReadDevice(dlnode->pd);
4313 psdGetAttrs(PGA_DEVICE, dlnode->pd,
4314 DA_Binding, &binding,
4315 DA_BindingClass, &puc,
4316 DA_ConfigList, &pclist,
4317 TAG_END);
4318 UsbClsBase = NULL;
4319 if(puc)
4321 psdGetAttrs(PGA_USBCLASS, puc,
4322 UCA_ClassBase, &UsbClsBase,
4323 TAG_END);
4325 if(binding && UsbClsBase)
4327 usbDoMethod(UCM_OpenBindingCfgWindow, binding);
4328 } else {
4329 pc = pclist->lh_Head;
4330 while(pc->ln_Succ)
4332 psdGetAttrs(PGA_CONFIG, pc,
4333 CA_InterfaceList, &piflist,
4334 TAG_END);
4335 pif = piflist->lh_Head;
4336 while(pif->ln_Succ)
4338 psdGetAttrs(PGA_INTERFACE, pif,
4339 IFA_Binding, &binding,
4340 IFA_BindingClass, &puc,
4341 TAG_END);
4342 UsbClsBase = NULL;
4343 if(puc)
4345 psdGetAttrs(PGA_USBCLASS, puc,
4346 UCA_ClassBase, &UsbClsBase,
4347 TAG_END);
4349 if(binding && UsbClsBase)
4351 usbDoMethod(UCM_OpenBindingCfgWindow, binding);
4353 pif = pif->ln_Succ;
4355 pc = pc->ln_Succ;
4358 psdUnlockDevice(dlnode->pd);
4359 return(TRUE);
4361 return(FALSE);
4363 /* \\\ */
4365 /* /// "Action_Dev_ForceBind()" */
4366 IPTR Action_Dev_ForceBind(struct IClass *cl, Object *obj, Msg msg)
4368 struct ActionData *data = INST_DATA(cl, obj);
4369 struct DevListEntry *dlnode;
4370 Object *mi = (Object *) ((IPTR *) msg)[1];
4371 STRPTR name = NULL;
4372 STRPTR devid = NULL;
4373 STRPTR devname = NULL;
4374 LONG clever;
4376 DoMethod(data->devlistobj, MUIM_List_GetEntry, MUIV_List_GetEntry_Active, &dlnode);
4377 if(CheckDeviceValid(dlnode))
4379 get(mi, MUIA_Menuitem_Title, &name);
4380 if(!strcmp(name, _(MSG_ACTION_DEV_FORCEBIND_NONE)))
4382 name = NULL;
4384 psdGetAttrs(PGA_DEVICE, dlnode->pd,
4385 DA_ProductName, &devname,
4386 DA_IDString, &devid,
4387 TAG_END);
4388 if(name)
4390 clever = MUI_RequestA(data->appobj, data->winobj, 0, NULL, _(MSG_ACTION_DEV_FORCE_REQ),_(MSG_ACTION_DEV_FORCE_REQ_TXT), NULL);
4391 if(!clever)
4393 return(FALSE);
4396 if(psdSetForcedBinding(name, devid, NULL))
4398 if(name)
4400 psdAddErrorMsg(RETURN_OK, _(MSG_APP_TITLE), _(MSG_ACTION_DEV_FORCE), devname, name);
4401 } else {
4402 psdAddErrorMsg(RETURN_OK, _(MSG_APP_TITLE), _(MSG_ACTION_DEV_FORCE_REMOVE), devname);
4406 return(TRUE);
4408 /* \\\ */
4410 /* /// "Action_Cfg_Changed()" */
4411 IPTR Action_Cfg_Changed(struct IClass *cl, Object *obj, Msg msg)
4413 struct ActionData *data = INST_DATA(cl, obj);
4414 IPTR bootdelay = 0;
4415 IPTR subtaskpri = 0;
4416 IPTR loginfo = 0;
4417 IPTR logwarn = 0;
4418 IPTR logerr = 0;
4419 IPTR logfail = 0;
4420 IPTR popupnew = 0;
4421 IPTR popupgone = 0;
4422 IPTR popupdeath = 0;
4423 IPTR popupdelay = 0;
4424 IPTR popupactivate = 0;
4425 IPTR popuptofront = 0;
4426 IPTR autodisablelp = 0;
4427 IPTR autodisabledead = 0;
4428 IPTR autorestartdead = 0;
4429 IPTR powersaving = 0;
4430 IPTR forcesuspend = 0;
4431 IPTR suspendtimeout = 0;
4432 APTR stackcfg = NULL;
4434 psdGetAttrs(PGA_STACK, NULL, PA_GlobalConfig, &stackcfg, TAG_END);
4435 get(data->cfgtaskpriobj, MUIA_Numeric_Value, &subtaskpri);
4436 get(data->cfgbootdelayobj, MUIA_Numeric_Value, &bootdelay);
4437 get(data->cfgloginfoobj, MUIA_Selected, &loginfo);
4438 get(data->cfglogwarnobj, MUIA_Selected, &logwarn);
4439 get(data->cfglogerrobj, MUIA_Selected, &logerr);
4440 get(data->cfglogfailobj, MUIA_Selected, &logfail);
4441 get(data->cfgpopupnewobj, MUIA_Cycle_Active, &popupnew);
4442 get(data->cfgpopupgoneobj, MUIA_Selected, &popupgone);
4443 get(data->cfgpopupdeathobj, MUIA_Selected, &popupdeath);
4444 get(data->cfgpopupdelayobj, MUIA_Numeric_Value, &popupdelay);
4445 get(data->cfgpopupactivateobj, MUIA_Selected, &popupactivate);
4446 get(data->cfgpopuptofrontobj, MUIA_Selected, &popuptofront);
4447 get(data->cfgautolpobj, MUIA_Selected, &autodisablelp);
4448 get(data->cfgautodeadobj, MUIA_Selected, &autodisabledead);
4449 get(data->cfgautopcobj, MUIA_Selected, &autorestartdead);
4450 get(data->cfgpowersavingobj, MUIA_Selected, &powersaving);
4451 get(data->cfgforcesuspendobj, MUIA_Selected, &forcesuspend);
4452 get(data->cfgsuspendtimeoutobj, MUIA_Numeric_Value, &suspendtimeout);
4454 if(autorestartdead && autodisabledead)
4456 autodisabledead = FALSE;
4457 nnset(data->cfgautodeadobj, MUIA_Selected, FALSE);
4459 if(autorestartdead)
4461 nnset(data->cfgautodeadobj, MUIA_Disabled, TRUE);
4462 } else {
4463 nnset(data->cfgautodeadobj, MUIA_Disabled, FALSE);
4465 if(stackcfg)
4467 psdSetAttrs(PGA_STACKCFG, stackcfg,
4468 GCA_SubTaskPri, subtaskpri,
4469 GCA_BootDelay, bootdelay,
4470 GCA_LogInfo, loginfo,
4471 GCA_LogWarning, logwarn,
4472 GCA_LogError, logerr,
4473 GCA_LogFailure, logfail,
4474 GCA_PopupDeviceNew, popupnew,
4475 GCA_PopupDeviceGone, popupgone,
4476 GCA_PopupDeviceDeath, popupdeath,
4477 GCA_PopupCloseDelay, popupdelay,
4478 GCA_PopupActivateWin, popupactivate,
4479 GCA_PopupWinToFront, popuptofront,
4480 GCA_AutoDisableLP, autodisablelp,
4481 GCA_AutoDisableDead, autodisabledead,
4482 GCA_AutoRestartDead, autorestartdead,
4483 GCA_PowerSaving, powersaving,
4484 GCA_ForceSuspend, forcesuspend,
4485 GCA_SuspendTimeout, suspendtimeout,
4486 TAG_END);
4488 return(TRUE);
4490 /* \\\ */
4492 /* /// "Action_Cfg_Snd_Changed()" */
4493 IPTR Action_Cfg_Snd_Changed(struct IClass *cl, Object *obj, Msg msg)
4495 struct ActionData *data = INST_DATA(cl, obj);
4496 STRPTR dtxsndfile = "";
4497 STRPTR remsndfile = "";
4498 APTR stackcfg = NULL;
4500 psdGetAttrs(PGA_STACK, NULL, PA_GlobalConfig, &stackcfg, TAG_END);
4501 get(data->cfgdevdtxsoundobj, MUIA_String_Contents, &dtxsndfile);
4502 get(data->cfgdevremsoundobj, MUIA_String_Contents, &remsndfile);
4503 if(stackcfg)
4505 psdSetAttrs(PGA_STACKCFG, stackcfg,
4506 GCA_InsertionSound, dtxsndfile,
4507 GCA_RemovalSound, remsndfile,
4508 TAG_END);
4510 return(TRUE);
4512 /* \\\ */
4514 /* /// "Action_Cls_Activate()" */
4515 IPTR Action_Cls_Activate(struct IClass *cl, Object *obj, Msg msg)
4517 struct ActionData *data = INST_DATA(cl, obj);
4518 struct ClsListEntry *clnode;
4519 DoMethod(data->clslistobj, MUIM_List_GetEntry, MUIV_List_GetEntry_Active, &clnode);
4520 if(clnode)
4522 struct Node *puc;
4523 struct List *lst;
4524 IPTR hascfggui = FALSE;
4525 struct Library *UsbClsBase;
4527 set(data->clsremobj, MUIA_Disabled, FALSE);
4529 psdLockReadPBase();
4530 psdGetAttrs(PGA_STACK, NULL, PA_ClassList, &lst, TAG_END);
4531 puc = lst->lh_Head;
4532 while(puc->ln_Succ)
4534 if(puc == clnode->puc)
4536 psdGetAttrs(PGA_USBCLASS, clnode->puc,
4537 UCA_ClassBase, &UsbClsBase,
4538 TAG_END);
4539 usbGetAttrs(UGA_CLASS, NULL,
4540 UCCA_HasClassCfgGUI, &hascfggui,
4541 TAG_END);
4542 set(data->clscfgobj, MUIA_Disabled, !hascfggui);
4543 break;
4545 puc = puc->ln_Succ;
4547 psdUnlockPBase();
4548 } else {
4549 set(data->clsremobj, MUIA_Disabled, TRUE);
4550 set(data->clscfgobj, MUIA_Disabled, TRUE);
4552 return(TRUE);
4554 /* \\\ */
4556 /* /// "Action_Cls_Add()" */
4557 IPTR Action_Cls_Add(struct IClass *cl, Object *obj, Msg msg)
4559 struct ActionData *data = INST_DATA(cl, obj);
4560 STRPTR clsname = "";
4561 get(data->clsnameobj, MUIA_String_Contents, &clsname);
4562 psdAddClass(clsname, 0);
4563 InternalCreateConfigGUI(data);
4564 return(TRUE);
4566 /* \\\ */
4568 /* /// "Action_Cls_Remove()" */
4569 IPTR Action_Cls_Remove(struct IClass *cl, Object *obj, Msg msg)
4571 struct ActionData *data = INST_DATA(cl, obj);
4572 struct ClsListEntry *clnode;
4573 DoMethod(data->clslistobj, MUIM_List_GetEntry, MUIV_List_GetEntry_Active, &clnode);
4574 if(clnode)
4576 struct Node *puc;
4577 struct List *lst;
4578 psdLockReadPBase();
4579 psdGetAttrs(PGA_STACK, NULL, PA_ClassList, &lst, TAG_END);
4580 puc = lst->lh_Head;
4581 while(puc->ln_Succ)
4583 if(puc == clnode->puc)
4585 clnode->puc = NULL;
4586 DoMethod(data->clslistobj, MUIM_List_Remove, MUIV_List_Remove_Active);
4587 FreeClsEntry(data, clnode);
4588 psdUnlockPBase();
4589 psdRemClass(puc);
4590 puc = NULL;
4591 break;
4593 puc = puc->ln_Succ;
4595 if(puc)
4597 psdUnlockPBase();
4600 InternalCreateConfigGUI(data);
4601 return(TRUE);
4603 /* \\\ */
4605 /* /// "Action_Cls_Scan()" */
4606 IPTR Action_Cls_Scan(struct IClass *cl, Object *obj, Msg msg)
4608 struct ActionData *data = INST_DATA(cl, obj);
4609 struct ExAllControl *exall;
4610 BPTR lock;
4611 struct ExAllData *exdata;
4612 ULONG ents;
4613 struct List *puclist;
4614 UBYTE buf[1024];
4615 UBYTE sbuf[128];
4616 BOOL exready;
4618 psdGetAttrs(PGA_STACK, NULL, PA_ClassList, &puclist, TAG_END);
4619 if((exall = AllocDosObject(DOS_EXALLCONTROL, NULL)))
4621 if((lock = Lock(CLASSPATH, ACCESS_READ)))
4623 exall->eac_LastKey = 0;
4624 exall->eac_MatchString = NULL;
4625 exall->eac_MatchFunc = NULL;
4628 exready = ExAll(lock, (struct ExAllData *) buf, 1024, ED_NAME, exall);
4629 exdata = (struct ExAllData *) buf;
4630 ents = exall->eac_Entries;
4631 while(ents--)
4633 psdSafeRawDoFmt(sbuf, 128, CLASSPATH "/%s", exdata->ed_Name);
4635 if(!FindName(puclist, exdata->ed_Name))
4637 psdAddClass(sbuf, 0);
4639 exdata = exdata->ed_Next;
4641 } while(exready);
4642 UnLock(lock);
4643 InternalCreateConfigGUI(data);
4644 psdClassScan();
4645 } else {
4646 /*errmsg = "Could not lock on SYS:Classes/USB.\n";*/
4648 FreeDosObject(DOS_EXALLCONTROL, exall);
4650 return(TRUE);
4652 /* \\\ */
4654 /* /// "Action_Cls_Configure()" */
4655 IPTR Action_Cls_Configure(struct IClass *cl, Object *obj, Msg msg)
4657 struct ActionData *data = INST_DATA(cl, obj);
4658 struct ClsListEntry *clnode;
4659 DoMethod(data->clslistobj, MUIM_List_GetEntry, MUIV_List_GetEntry_Active, &clnode);
4660 if(clnode)
4662 struct Node *puc;
4663 struct List *lst;
4664 struct Library *UsbClsBase;
4666 psdLockReadPBase();
4667 psdGetAttrs(PGA_STACK, NULL, PA_ClassList, &lst, TAG_END);
4668 puc = lst->lh_Head;
4669 while(puc->ln_Succ)
4671 if(puc == clnode->puc)
4673 psdGetAttrs(PGA_USBCLASS, clnode->puc,
4674 UCA_ClassBase, &UsbClsBase,
4675 TAG_END);
4676 usbDoMethod(UCM_OpenCfgWindow);
4677 break;
4679 puc = puc->ln_Succ;
4681 psdUnlockPBase();
4683 return(TRUE);
4685 return(FALSE);
4687 /* \\\ */
4689 /* /// "Action_Info_MemPool()" */
4690 IPTR Action_Info_MemPool(struct IClass *cl, Object *obj, Msg msg)
4692 struct ActionData *data = INST_DATA(cl, obj);
4693 char buf[32];
4694 IPTR mem;
4695 psdGetAttrs(PGA_STACK, NULL, PA_MemPoolUsage, &mem, TAG_END);
4696 psdSafeRawDoFmt(buf, 32, _(MSG_ACTION_MEMPOOL_FORMAT), (mem+512)>>10);
4697 set(data->mempoolobj, MUIA_Text_Contents, buf);
4698 return(TRUE);
4700 /* \\\ */
4702 /* /// "Action_Cfg_Activate()" */
4703 IPTR Action_Cfg_Activate(struct IClass *cl, Object *obj, Msg msg)
4705 struct ActionData *data = INST_DATA(cl, obj);
4706 struct PrefsListEntry *plnode;
4707 DoMethod(data->prefslistobj, MUIM_List_GetEntry, MUIV_List_GetEntry_Active, &plnode);
4708 if(plnode)
4710 BOOL noexport = FALSE;
4711 switch(plnode->chunkid)
4713 case IFFCHNK_FORCEDBIND:
4714 case MAKE_ID('P','S','D','L'):
4715 noexport = TRUE;
4718 set(data->prefsremoveobj, MUIA_Disabled, plnode->chunkid == IFFFORM_STACKCFG);
4719 set(data->prefsexportobj, MUIA_Disabled, noexport);
4720 } else {
4721 set(data->prefsremoveobj, MUIA_Disabled, TRUE);
4722 set(data->prefsexportobj, MUIA_Disabled, TRUE);
4724 return(TRUE);
4726 /* \\\ */
4728 /* /// "Action_Cfg_Remove()" */
4729 IPTR Action_Cfg_Remove(struct IClass *cl, Object *obj, Msg msg)
4731 struct ActionData *data = INST_DATA(cl, obj);
4732 struct PrefsListEntry *plnode;
4733 DoMethod(data->prefslistobj, MUIM_List_GetEntry, MUIV_List_GetEntry_Active, &plnode);
4734 if(plnode)
4736 LONG result;
4737 APTR pic;
4738 switch(plnode->chunkid)
4740 case IFFFORM_STACKCFG:
4741 break;
4743 case IFFFORM_DEVICECFG:
4744 result = MUI_RequestA(data->appobj, data->winobj, 0, NULL, _(MSG_ACTION_CFG_REMOVE),_(MSG_ACTION_CFG_REMOVE_HELP), &plnode->devid);
4745 if(result)
4747 pic = psdFindCfgForm(NULL, plnode->chunkid);
4748 while(pic)
4750 if(psdMatchStringChunk(pic, IFFCHNK_DEVID, plnode->devid))
4752 psdRemCfgForm(pic);
4753 break;
4755 pic = psdNextCfgForm(pic);
4758 break;
4760 case IFFFORM_CLASSCFG:
4761 result = MUI_RequestA(data->appobj, data->winobj, 0, NULL, _(MSG_ACTION_CFG_REMOVE),_(MSG_ACTION_CFG_REMOVE_DEFAULT), &plnode->owner);
4762 if(result)
4764 pic = psdFindCfgForm(NULL, IFFFORM_CLASSCFG);
4765 while(pic)
4767 if(psdMatchStringChunk(pic, IFFCHNK_OWNER, plnode->owner))
4769 psdRemCfgForm(pic);
4770 break;
4772 pic = psdNextCfgForm(pic);
4775 break;
4777 case IFFFORM_DEVCFGDATA:
4778 result = MUI_Request(data->appobj, data->winobj, 0, NULL, _(MSG_ACTION_CFG_REMOVE),_(MSG_ACTION_CFG_REMOVE_CLASS), plnode->owner, plnode->devid);
4779 if(result)
4781 pic = psdFindCfgForm(NULL, IFFFORM_DEVICECFG);
4782 while(pic)
4784 if(psdMatchStringChunk(pic, IFFCHNK_DEVID, plnode->devid))
4786 pic = psdFindCfgForm(pic, plnode->chunkid);
4787 while(pic)
4789 if(psdMatchStringChunk(pic, IFFCHNK_OWNER, plnode->owner))
4791 psdRemCfgForm(pic);
4792 break;
4794 pic = psdNextCfgForm(pic);
4796 break;
4798 pic = psdNextCfgForm(pic);
4801 break;
4803 case IFFFORM_IFCFGDATA:
4804 result = MUI_Request(data->appobj, data->winobj, 0, NULL, _(MSG_ACTION_CFG_REMOVE),_(MSG_ACTION_CFG_REMOVE_CLASS_DEF),
4805 plnode->owner, plnode->ifid, plnode->devid);
4806 if(result)
4808 pic = psdFindCfgForm(NULL, IFFFORM_DEVICECFG);
4809 while(pic)
4811 if(psdMatchStringChunk(pic, IFFCHNK_DEVID, plnode->devid))
4813 pic = psdFindCfgForm(pic, plnode->chunkid);
4814 while(pic)
4816 if(psdMatchStringChunk(pic, IFFCHNK_IFID, plnode->ifid))
4818 if(psdMatchStringChunk(pic, IFFCHNK_OWNER, plnode->owner))
4820 psdRemCfgForm(pic);
4821 break;
4824 pic = psdNextCfgForm(pic);
4826 break;
4828 pic = psdNextCfgForm(pic);
4831 break;
4833 case IFFCHNK_FORCEDBIND:
4834 psdSetForcedBinding(NULL, plnode->devid, plnode->ifid);
4835 break;
4837 default:
4838 if(plnode->chunkid)
4840 result = MUI_RequestA(data->appobj, data->winobj, 0, NULL, _(MSG_ACTION_CFG_REMOVE),_(MSG_ACTION_CFG_REMOVE_UNKNOWN), NULL);
4841 if(result)
4843 pic = psdFindCfgForm(NULL, plnode->chunkid);
4844 if(pic)
4846 psdRemCfgForm(pic);
4850 break;
4853 return(TRUE);
4855 /* \\\ */
4857 /* /// "Action_Cfg_Export()" */
4858 IPTR Action_Cfg_Export(struct IClass *cl, Object *obj, Msg msg)
4860 struct ActionData *data = INST_DATA(cl, obj);
4861 struct PrefsListEntry *plnode;
4862 struct FileRequester *aslreq;
4863 char path[256];
4864 struct TagItem asltags[] = { { ASLFR_InitialFile, __(MSG_ACTION_CFG_PREFS_FILE) },
4865 { ASLFR_InitialDrawer, (IPTR) "SYS:Prefs/Presets/Poseidon" },
4866 { ASLFR_TitleText, __(MSG_ACTION_CFG_EXPORT) },
4867 { ASLFR_DoSaveMode, (IPTR) TRUE },
4868 { TAG_END, (IPTR) NULL } };
4869 BPTR fh;
4870 ULONG *form;
4872 DoMethod(data->prefslistobj, MUIM_List_GetEntry, MUIV_List_GetEntry_Active, &plnode);
4873 if(plnode)
4875 APTR pic = NULL;
4876 switch(plnode->chunkid)
4878 case IFFFORM_STACKCFG:
4879 asltags[0].ti_Data = __(MSG_ACTION_STACKCFG_FILE);
4880 pic = psdFindCfgForm(NULL, plnode->chunkid);
4881 break;
4883 case IFFFORM_DEVICECFG:
4884 asltags[0].ti_Data = __(MSG_ACTION_DEVICECFG_FILE);
4885 pic = psdFindCfgForm(NULL, plnode->chunkid);
4886 while(pic)
4888 if(psdMatchStringChunk(pic, IFFCHNK_DEVID, plnode->devid))
4890 break;
4892 pic = psdNextCfgForm(pic);
4894 break;
4896 case IFFFORM_CLASSCFG:
4897 asltags[0].ti_Data = __(MSG_ACTION_CLASSCFG_FILE);
4898 pic = psdFindCfgForm(NULL, plnode->chunkid);
4899 while(pic)
4901 if(psdMatchStringChunk(pic, IFFCHNK_OWNER, plnode->owner))
4903 break;
4905 pic = psdNextCfgForm(pic);
4907 break;
4909 case IFFFORM_DEVCFGDATA:
4910 asltags[0].ti_Data = __(MSG_ACTION_DEVCFGDATA_FILE);
4911 pic = psdFindCfgForm(NULL, IFFFORM_DEVICECFG);
4912 while(pic)
4914 if(psdMatchStringChunk(pic, IFFCHNK_DEVID, plnode->devid))
4916 pic = psdFindCfgForm(pic, plnode->chunkid);
4917 while(pic)
4919 if(psdMatchStringChunk(pic, IFFCHNK_OWNER, plnode->owner))
4921 break;
4923 pic = psdNextCfgForm(pic);
4925 break;
4927 pic = psdNextCfgForm(pic);
4929 break;
4931 case IFFFORM_IFCFGDATA:
4932 asltags[0].ti_Data = __(MSG_ACTION_IFCFGDATA_FILE);
4933 pic = psdFindCfgForm(NULL, IFFFORM_DEVICECFG);
4934 while(pic)
4936 if(psdMatchStringChunk(pic, IFFCHNK_DEVID, plnode->devid))
4938 pic = psdFindCfgForm(pic, plnode->chunkid);
4939 while(pic)
4941 if(psdMatchStringChunk(pic, IFFCHNK_IFID, plnode->ifid))
4943 if(psdMatchStringChunk(pic, IFFCHNK_OWNER, plnode->owner))
4945 break;
4948 pic = psdNextCfgForm(pic);
4950 break;
4952 pic = psdNextCfgForm(pic);
4954 break;
4956 case IFFCHNK_FORCEDBIND:
4957 break;
4959 default:
4960 if(plnode->chunkid)
4962 pic = psdFindCfgForm(NULL, plnode->chunkid);
4964 break;
4966 if(!pic)
4968 return(FALSE);
4970 if((aslreq = MUI_AllocAslRequest(ASL_FileRequest, asltags)))
4972 if(MUI_AslRequest(aslreq, TAG_END))
4974 strcpy(path, aslreq->fr_Drawer);
4975 AddPart(path, aslreq->fr_File, 256);
4976 fh = Open(path, MODE_NEWFILE);
4977 if(fh)
4979 form = psdWriteCfg(pic);
4980 if(form)
4982 Write(fh, form, form[1]+8);
4983 psdFreeVec(form);
4985 Close(fh);
4986 } else {
4987 psdAddErrorMsg(RETURN_FAIL, _(MSG_APP_TITLE), _(MSG_ACTION_CFG_FAIL), path);
4990 MUI_FreeAslRequest(aslreq);
4992 return(TRUE);
4994 return(FALSE);
4996 /* \\\ */
4998 /* /// "Action_Cfg_Import()" */
4999 IPTR Action_Cfg_Import(struct IClass *cl, Object *obj, Msg msg)
5001 struct ActionData *data = INST_DATA(cl, obj);
5002 struct PrefsListEntry *plnode;
5003 struct FileRequester *aslreq;
5004 char path[256];
5005 BPTR fh;
5006 ULONG iffhead[3];
5007 ULONG *buff;
5008 APTR pic;
5010 struct TagItem asltags[] = { { ASLFR_InitialDrawer, (IPTR) "SYS:Prefs/Presets/Poseidon" },
5011 { ASLFR_TitleText, __(MSG_ACTION_CFG_IMPORT) },
5012 { TAG_END, (IPTR) NULL } };
5014 DoMethod(data->prefslistobj, MUIM_List_GetEntry, MUIV_List_GetEntry_Active, &plnode);
5016 if((aslreq = MUI_AllocAslRequest(ASL_FileRequest, asltags)))
5018 if(MUI_AslRequest(aslreq, TAG_END))
5020 strcpy(path, aslreq->fr_Drawer);
5021 AddPart(path, aslreq->fr_File, 256);
5022 fh = Open(path, MODE_OLDFILE);
5023 if(fh)
5025 Read(fh, iffhead, 12);
5026 if(AROS_LONG2BE(iffhead[0]) == ID_FORM)
5028 buff = psdAllocVec(AROS_LONG2BE(iffhead[1])+8);
5029 if(buff)
5031 buff[0] = iffhead[0];
5032 buff[1] = iffhead[1];
5033 buff[2] = iffhead[2];
5034 if(Read(fh, &buff[3], AROS_LONG2BE(iffhead[1])-4) == AROS_LONG2BE(iffhead[1])-4)
5036 switch(buff[2])
5038 case IFFFORM_STACKCFG:
5039 pic = psdFindCfgForm(NULL, AROS_LONG2BE(buff[2]));
5040 if(pic)
5042 psdReadCfg(pic, buff);
5043 } else {
5044 psdAddCfgEntry(NULL, buff);
5046 break;
5048 case IFFFORM_DEVICECFG:
5049 case IFFFORM_CLASSCFG:
5050 psdAddCfgEntry(NULL, buff);
5051 break;
5053 case IFFFORM_DEVCFGDATA:
5054 case IFFFORM_IFCFGDATA:
5055 if(plnode)
5057 if((plnode->chunkid == AROS_LONG2BE(buff[2])) ||
5058 (plnode->chunkid == IFFFORM_DEVICECFG) ||
5059 (plnode->chunkid == IFFFORM_IFCFGDATA))
5061 pic = psdFindCfgForm(NULL, IFFFORM_DEVICECFG);
5062 while(pic)
5064 if(psdMatchStringChunk(pic, IFFCHNK_DEVID, plnode->devid))
5066 psdAddCfgEntry(pic, buff);
5067 break;
5069 pic = psdNextCfgForm(pic);
5071 break;
5074 MUI_RequestA(data->appobj, data->winobj, 0, NULL, _(MSG_ACTION_CFGDATA_OOPS),_(MSG_ACTION_CFGDATA_OOPS_HELP), NULL);
5075 break;
5077 case IFFFORM_PSDCFG:
5078 psdLoadCfgFromDisk(path);
5079 break;
5081 default:
5082 MUI_RequestA(data->appobj, data->winobj, 0, NULL, _(MSG_ACTION_CFGDATA_OOPS),_(MSG_ACTION_CFGDATA_ERR), NULL);
5083 break;
5085 } else {
5086 psdAddErrorMsg(RETURN_ERROR, _(MSG_APP_TITLE), _(MSG_ACTION_CFGDATA_ERR_READ), path);
5088 psdFreeVec(buff);
5089 } else {
5090 psdAddErrorMsg(RETURN_ERROR, _(MSG_APP_TITLE), _(MSG_ACTION_CFGDATA_ERR_ALLOC), path);
5092 } else {
5093 psdAddErrorMsg(RETURN_ERROR, _(MSG_APP_TITLE), _(MSG_ACTION_CFGDATA_ERR_IFF), path);
5095 Close(fh);
5096 } else {
5097 psdAddErrorMsg(RETURN_FAIL, _(MSG_APP_TITLE), _(MSG_ACTION_CFGDATA_ERR_OPEN), path);
5100 MUI_FreeAslRequest(aslreq);
5102 return(TRUE);
5104 /* \\\ */
5106 /* /// "ActionDispatcher()" */
5107 AROS_UFH3(IPTR, ActionDispatcher,
5108 AROS_UFHA(struct IClass *, cl, A0),
5109 AROS_UFHA(Object *, obj, A2),
5110 AROS_UFHA(Msg, msg, A1))
5112 AROS_USERFUNC_INIT
5113 // There should never be an uninitialized pointer, but just in case, try to get an mungwall hit if so.
5114 struct ActionData *data = (struct ActionData *) 0xABADCAFE;
5116 // on OM_NEW the obj pointer will be void, so don't try to get the data base in this case.
5117 if(msg->MethodID != OM_NEW) data = INST_DATA(cl, obj);
5119 switch(msg->MethodID)
5121 case OM_NEW:
5122 return((IPTR) Action_OM_NEW(cl, obj, msg));
5124 case MUIM_Setup:
5125 return(Action_Setup(cl, obj, msg));
5127 case MUIM_Cleanup:
5128 //MUI_RejectIDCMP(obj, IDCMP_INTUITICKS);
5129 while(data->OnlUpdTask)
5131 Delay(50);
5133 DoMethod(data->appobj, MUIM_Application_RemInputHandler, &data->eventihn);
5134 data->appobj = NULL;
5135 data->winobj = NULL;
5136 return(DoSuperMethodA(cl,obj,msg));
5138 case OM_DISPOSE:
5139 Action_OM_DISPOSE(cl, obj, msg);
5140 break;
5142 case MUIM_Action_HandlePsdEvents:
5143 EventHandler(data);
5144 return(TRUE);
5146 case MUIM_Action_CloseSubWinReq:
5148 struct DefListEntry *winnode;
5149 winnode = (struct DefListEntry *) ((struct opSet *) msg)->ops_AttrList;
5150 if(winnode->infowindow)
5152 set(winnode->infowindow, MUIA_Window_Open, FALSE);
5153 DoMethod(data->appobj, OM_REMMEMBER, winnode->infowindow);
5154 DoMethod(winnode->infowindow, OM_DISPOSE);
5155 winnode->infowindow = NULL;
5157 return(TRUE);
5160 case MUIM_Action_Cfg_Changed:
5161 return(Action_Cfg_Changed(cl, obj, msg));
5163 case MUIM_Action_Cfg_Snd_Changed:
5164 return(Action_Cfg_Snd_Changed(cl, obj, msg));
5166 case MUIM_Action_HW_New:
5167 return(Action_HW_New(cl, obj, msg));
5169 case MUIM_Action_HW_Copy:
5170 return(Action_HW_Copy(cl, obj, msg));
5172 case MUIM_Action_HW_Del:
5173 return(Action_HW_Del(cl, obj, msg));
5175 case MUIM_Action_HW_Update:
5176 return(Action_HW_Update(cl, obj, msg));
5178 case MUIM_Action_HW_Activate:
5179 return(Action_HW_Activate(cl, obj, msg));
5181 case MUIM_Action_HW_Info:
5182 return(Action_HW_Info(cl, obj, msg));
5184 case MUIM_Action_HW_Online:
5185 return(Action_HW_Online(cl, obj, msg));
5187 case MUIM_Action_HW_Offline:
5188 return(Action_HW_Offline(cl, obj, msg));
5190 case MUIM_Action_Online:
5191 return(Action_Online(cl, obj, msg));
5193 case MUIM_Action_Offline:
5194 return(Action_Offline(cl, obj, msg));
5196 case MUIM_Action_Restart:
5197 return(Action_Restart(cl, obj, msg));
5199 case MUIM_Action_ChgErrLevel:
5200 return(Action_ChgErrLevel(cl, obj, msg));
5202 case MUIM_Action_SaveErrors:
5203 return(Action_SaveErrors(cl, obj, msg));
5205 case MUIM_Action_FlushErrors:
5206 return(Action_FlushErrors(cl, obj, msg));
5208 case MUIM_Action_SaveDeviceList:
5209 return(Action_SaveDeviceList(cl, obj, msg));
5211 case MUIM_Action_Use:
5212 InternalCreateConfigGUI(data);
5213 psdSaveCfgToDisk("ENV:PsdStackloader", TRUE);
5214 psdSaveCfgToDisk("ENV:Sys/poseidon.prefs", FALSE);
5215 return(TRUE);
5217 case MUIM_Action_LoadPrefs:
5218 return(Action_LoadPrefs(cl, obj, msg));
5220 case MUIM_Action_SavePrefsAs:
5221 return(Action_SavePrefsAs(cl, obj, msg));
5223 case MUIM_Action_SavePrefs:
5224 return(Action_SavePrefs(cl, obj, msg));
5226 case MUIM_Action_Prefs_Changed:
5227 return(Action_Prefs_Changed(cl, obj, msg));
5229 case MUIM_Action_UseQuit:
5230 return(Action_UseQuit(cl, obj, msg));
5232 case MUIM_Action_SaveQuit:
5233 return(Action_SaveQuit(cl, obj, msg));
5235 case MUIM_Action_LoadPrefsFrom:
5236 return(Action_LoadPrefsFrom(cl, obj, msg));
5238 case MUIM_Action_SavePrefsTo:
5239 return(Action_SavePrefsTo(cl, obj, msg));
5241 case MUIM_Action_Dev_Activate:
5242 return(Action_Dev_Activate(cl, obj, msg));
5244 case MUIM_Action_Dev_Bind:
5245 return(Action_Dev_Bind(cl, obj, msg));
5247 case MUIM_Action_Dev_Unbind:
5248 return(Action_Dev_Unbind(cl, obj, msg));
5250 case MUIM_Action_Dev_Suspend:
5251 return(Action_Dev_Suspend(cl, obj, msg));
5253 case MUIM_Action_Dev_Resume:
5254 return(Action_Dev_Resume(cl, obj, msg));
5256 case MUIM_Action_Dev_PowerCycle:
5257 return(Action_Dev_PowerCycle(cl, obj, msg));
5259 case MUIM_Action_Dev_Disable:
5260 return(Action_Dev_Disable(cl, obj, msg));
5262 case MUIM_Action_Dev_ForceBind:
5263 return(Action_Dev_ForceBind(cl, obj, msg));
5265 case MUIM_Action_Dev_Info:
5266 return(Action_Dev_Info(cl, obj, msg));
5268 case MUIM_Action_Dev_Configure:
5269 return(Action_Dev_Configure(cl, obj, msg));
5271 case MUIM_Action_Cls_Activate:
5272 return(Action_Cls_Activate(cl, obj, msg));
5274 case MUIM_Action_Cls_Add:
5275 return(Action_Cls_Add(cl, obj, msg));
5277 case MUIM_Action_Cls_Remove:
5278 return(Action_Cls_Remove(cl, obj, msg));
5280 case MUIM_Action_Cls_Scan:
5281 return(Action_Cls_Scan(cl, obj, msg));
5283 case MUIM_Action_Cls_Configure:
5284 return(Action_Cls_Configure(cl, obj, msg));
5286 case MUIM_Action_Info_MemPool:
5287 return(Action_Info_MemPool(cl, obj, msg));
5289 case MUIM_Action_About:
5290 DoMethod(data->cfgpagelv, MUIM_Set, MUIA_List_Active, 0);
5291 return(TRUE);
5293 case MUIM_Action_WakeUp:
5294 set(data->appobj, MUIA_Application_Iconified, FALSE);
5295 DoMethod(data->winobj, MUIM_Window_ToFront);
5296 set(data->winobj, MUIA_Window_Activate, TRUE);
5297 return(TRUE);
5299 case MUIM_Action_Cfg_Activate:
5300 return(Action_Cfg_Activate(cl, obj, msg));
5302 case MUIM_Action_Cfg_Remove:
5303 return(Action_Cfg_Remove(cl, obj, msg));
5305 case MUIM_Action_Cfg_Export:
5306 return(Action_Cfg_Export(cl, obj, msg));
5308 case MUIM_Action_Cfg_Import:
5309 return(Action_Cfg_Import(cl, obj, msg));
5312 return(DoSuperMethodA(cl,obj,msg));
5313 AROS_USERFUNC_EXIT
5315 /* \\\ */