1 /*****************************************************************************
2 ** This is the Action custom class, a sub class of Area.mui.
3 ******************************************************************************/
7 #define USE_INLINE_STDARG
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>
20 #include "ActionClass.h"
21 #include "IconListClass.h"
22 #include "DevWinClass.h"
23 #include "CfgListClass.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"
40 #define CLASSNAMEMAX 128
42 /* /// "Some strings" */
43 static STRPTR mainpanels
[] =
55 static STRPTR errlvlstrings
[] =
57 NULL
, //"All messages",
58 NULL
, //"Warnings and worse",
59 NULL
, //"Errors and failures",
60 NULL
, //"Failures only",
64 static STRPTR popupnewdevicestrings
[] =
66 NULL
, //"Never open a popup window! Bah!",
67 NULL
, //"Only popup on an error condition",
68 NULL
, //"Popup on new, unknown devices",
69 NULL
, //"Popup, if there is no binding",
70 NULL
, //"Popup, if there is no config yet",
71 NULL
, //"Popup on configurable class",
72 NULL
, //"Popup, regardless of binding",
73 NULL
, //"Always immediately annoy me",
78 /* /// "Some lyrics" */
79 static char *aimeelyrics
[] =
82 "\33l\33iIn our endeavor we are never seeing eye to eye\n"
83 "No guts to sever so forever may we wave goodbye\n"
84 "And you're always telling me that it's my turn to move\n"
85 "When I wonder what could make the needle jump the groove\n"
86 "I won't fall for the oldest trick in the book\n"
87 "So don't sit there and think you're off of the hook\n"
88 "By saying there is no use changing 'cause\n\n"
89 "That's just what you are\n"
90 "That's just what you are\n"
94 "\33l\33iI can't do it\n"
96 "You're everything you're\n"
97 "Trying to make me believe\n"
98 "'Cause this show is\n"
100 "Too well to be held\n"
101 "With only me in mind\n\n"
102 "And how am I different?\n"
103 "How am I different?\n"
104 "How am I different?\n"
108 "\33l\33i'Cause I'll never prove that my\n"
109 "Motives were pure\n"
110 "So let's remove any question of cure\n"
111 "'Cause even though you've made it\n"
113 "Baby, it's clear, from here -\n"
114 "You're losing your atmosphere\n"
115 "From here, you're losing it\n"
119 "\33l\33iOh, for the sake of momentum\n"
120 "Even thought I agree with that stuff\n"
121 "About seizing the day\n"
122 "But I hate to think of effort expended\n"
123 "All those minutes and days and hours\n"
124 "I've have frittered away\n\n"
125 "And I know life is getting shorter\n"
126 "I can't bring myself to set the scene\n"
127 "Even when it's approaching torture\n"
128 "I've got my routine\n"
132 "\33l\33i'Cause nothing is good enough\n"
133 "For people like you\n"
134 "Who have to have someone\n"
136 "And something to sabotage -\n"
137 "Determined to lose it all\n\n"
138 "Ladies and gentlemen -\n"
140 "Didn't I try again?\n"
141 "And did the effort pay?\n"
142 "Wouldn't a smarter man\n"
143 "Simply walk away?\n"
153 "Now you can hardly\n"
156 "It's not going to stop\n"
157 "It's not going to stop\n"
158 "It's not going to stop\n"
163 "\33l\33iI don't know you from Adam, it could make my day\n"
164 "If you leave me a message I'll give it away\n"
165 "'Cause the most perfect strangers that you can talk to\n"
166 "Are the ones who pretend that you're not really you\n\n"
167 "And with any attempts here to play Frankenstein\n"
168 "Come with plenty of chances for changing your mind\n"
169 "When you're building your own creation\n"
170 "Nothing's better than real\n"
171 "Than a real imitation\n"
175 "\33l\33iOh, experience is cheap\n"
176 "If that's the company you keep\n"
177 "And before you know that it's free\n"
179 "Like most amazing things\n"
180 "It's easy to miss and easy to mistake\n"
181 "For when things are really great\n"
182 "It just means everything's in its place\n"
186 "\33l\33iSo here I'm sitting in my car at the same old stoplight\n"
187 "I keep waiting for a change but I don't know what\n"
188 "So red turns into green turning into yellow\n"
189 "But I'm just frozen here on the same old spot\n"
190 "And all I have to do is just press the pedal\n"
196 "\33l\33iSay you were split, you were split in fragments\n"
197 "And none of the pieces would talk to you\n"
198 "Wouldn't you want to be who you had been?\n"
199 "Well, baby I want that, too\n\n"
200 "So better take the keys and drive forever\n"
201 "Staying won't put these futures back together\n"
202 "All the perfect drugs and superheroes\n"
203 "wouldn't be enough to bring me up to zero\n"
207 "\33l\33iBut nobody wants to hear this tale\n"
208 "The plot is clich�d, the jokes are stale\n"
209 "And baby we've all heard it all before\n"
210 "Oh, I could get specific but\n"
211 "Nobody needs a catalog\n"
212 "With details of a love I can't sell anyone\n\n"
213 "And aside from that\n"
214 "This chain of reaction, baby, is losing a link\n"
215 "Thought I'd hope you'd know what\n"
216 "I tried to tell you and if you don't\n"
217 "I could draw you a picture in invisible ink\n"
221 "\33l\33iWell, she's the face\n"
222 "And I'm the double\n"
223 "Who keeps the pace\n"
224 "And clears the rubble\n"
225 "And, Lost In Space,\n"
226 "Fills up the bubble with air\n\n"
227 "By just pretending to care\n"
228 "Like I'm not even there\n"
229 "Gone, but I don't know where\n"
233 "\33l\33iOh Mario -- why if this is nothing\n"
234 "I'm finding it so hard to dismiss\n"
235 "If you're what I need,\n"
236 "Then only you can save me\n"
237 "So come on baby -- give me the fix\n"
238 "And let's just talk about it\n"
239 "I've got to talk about it\n\n"
240 "Because nobody knows\n"
241 "That's how I nearly fell\n"
243 "And ringing Pavlov's bell\n"
245 "Like it was show and tell\n"
249 "\33l\33iWe have crossed the rubicon\n"
250 "Our ship awash, our rudder gone\n"
251 "The rats have fled but I'm hanging on\n"
252 "Let me try, baby, try\n\n"
254 "Baby, please -- let me begin\n"
255 "Let me be your heroin\n"
256 "Hate the sinner but love the sin\n"
257 "Let me be your heroin\n"
261 "\33l\33iI was undecided like you\n"
263 "But I could not stem the tide of overwhelm\n"
265 "You try to keep it going, but a lot of avenues\n"
266 "Just aren't open to you\n"
267 "when you're real bad news\n\n"
268 "I've got love and anger\n"
269 "They come as a pair\n"
270 "You can take your chances\n"
273 "Make you feel bad\n"
275 "This big ball of sad isn't\n"
276 "Worth even filling with air\n"
280 "\33l\33iThe moth don't care if the flame is real\n"
281 "'Cause moth and flame got a sweetheart deal\n"
282 "And nothing fuels a good flirtation\n"
283 "Like need and anger and desperation\n"
284 "No, the moth don't care if the flame is real\n"
285 "No, the moth don't care if the flame is real\n\n"
286 "So come on, let's go -- ready or not\n"
287 "'Cause there's a flame I know, hotter than hot\n"
288 "And with a fuse that's so thoroughly shot away\n"
292 "\33l\33iYou've gotta hope\n"
293 "That there's someone for you\n"
294 "As strange as you are\n"
296 "With the things that you do\n"
297 "Without trying too hard\n\n"
299 "'Cause you can bend the truth\n"
300 "'Till it's suiting you\n"
301 "These things that you're wrapping all around you\n"
302 "Never know what they will amount to\n"
303 "If you're life is just going on without you\n"
304 "It's the end of the things you know\n"
309 "\33l\33iNothing in this world is gonna hold me\n"
310 "No thugs in this road are gonna roll me\n"
311 "No fast talking girl is gonna slow me\n"
312 "Nothing's gonna stop me at all\n"
313 "I'm walking through walls\n\n"
315 "Some people complain\n"
316 "Yeah they caterwaul\n"
317 "I could do the same\n"
318 "But I'm walking through walls\n"
322 "\33l\33iIt should be boredom by now\n"
323 "I know the tricks of the trade\n"
324 "But it goes on anyhow\n"
325 "Sometimes the answers are ready made\n\n"
327 "And I go for it every time\n"
328 "Just like a heavy drinker\n"
329 "I go for it every time\n"
330 "Hook, line and sinker\n"
334 "\33l\33iIn my dream I'm often running\n"
335 "To a place that's out of view\n"
336 "Of every kind of memory\n"
337 "With strings that tie to you\n\n"
339 "And though a change has taken place\n"
340 "And I no longer do adore her\n"
341 "Still every God forsaken place\n"
342 "Is always right around the corner\n"
346 "\33l\33iThings begin, things decay\n"
347 "And you've gotta find a way\n"
349 "But it you want to spend the day\n"
350 "Wond'ring what it's all about\n"
351 "Go and knock yourself out\n"
355 "\33l\33iThink your troubles are so serious\n"
356 "Well one day you'll be so long gone\n"
357 "Cause nothing ever lasts\n"
358 "It all gets torn to shreds\n"
359 "If something's ever lasting\n"
360 "It's over our heads\n"
361 "It's over our heads\n"
365 "\33l\33iAnd why should I begin?\n"
366 "Cause there's a whirl pool\n"
367 "Of people who will stop\n"
368 "And they will tell you\n"
369 "The things that you will not\n"
370 "They roll their eyes and they call you crazy\n\n"
371 "But you get the feeling\n"
372 "That you get what it's about\n"
373 "It's just a feeling\n"
374 "You can't really spell it out\n"
375 "You get the feeling\n"
376 "That you get what it's about\n"
380 "\33l\33iI don't wait by the phone like I used to\n"
381 "I don't hope for kind words you might say\n"
382 "You don't prey on my mind like you used to\n"
383 "But you can still ruin my day\n"
384 "You can still ruin my day\n"
388 "\33l\33iI had to break the window\n"
389 "It just had to be it was in my way\n"
390 "Better that I break the window\n"
391 "Then forget what I had to say\n\n"
393 "So again I've done the right thing\n"
394 "I was never worried about that\n"
395 "The answer's always been in clear view\n"
396 "But even when the window's clean\n"
397 "I still can't see for the fact\n"
398 "That when it's clean it's so clear\n"
399 "I can't tell what I'm looking through\n"
400 "\33r(Fiona Apple) ",
403 "\33l\33iI seem to you to seek a new disaster every day\n"
404 "You deem me due to clean my view and be at peace and lay\n"
405 "I mean to prove, I mean to move in my own way\n"
406 "And say I've been getting along for long before you came into the play\n\n"
408 "If there was a better way to go then it would find me\n"
409 "I can't help it the road just rolls out behind me\n"
410 "Be kind to me, or treat me mean\n"
411 "I'll make the most of it, I'm an extraordinary machine\n"
412 "\33r(Fiona Apple) ",
415 "\33l\33iEverything good I deem too good to be true\n"
416 "Everything else is just a bore\n"
417 "Everything I have to look forward to\n"
418 "Has a pretty painful and very imposing before\n\n"
420 "Oh sailor why'd you do it\n"
421 "What'd you do that for\n"
422 "Saying there's nothing to it\n"
423 "And then letting it go by the boards\n"
424 "\33r(Fiona Apple) ",
427 "\33l\33iIf you don't have a date\n"
429 "Go out and sit on the lawn\n"
431 "'Cause it's just what you must do\n"
432 "And nobody does it anymore\n\n"
433 "No, I don't believe in the wasting of time,\n"
434 "But I don't believe that I'm wasting mine\n"
435 "\33r(Fiona Apple) ",
438 "\33l\33i'Cause I do know what's good for me\n"
439 "And I've done what I could for you\n"
440 "But you're not benefiting, and yet I'm sitting\n"
441 "Singing again, sing, sing again\n\n"
442 "How can I deal with this, if he won't get with this\n"
443 "Am I gonna heal from this, he won't admit to it\n"
444 "Nothing to figure out, I got to get him out\n"
445 "It's time the truth was out that he don't give a shit about me\n"
446 "\33r(Fiona Apple) ",
449 "\33l\33iSo my darling, give me your absence tonight\n"
450 "Take all of your sympathy and leave it outside\n"
451 "'Cause there's no kind of loving that can make this alright\n"
452 "I'm trying to find a place I belong\n\n"
453 "And I suddenly feel like a different person\n"
454 "From the roots of my soul come a gentle coercion\n"
455 "And I ran my hand over a strange inversion\n"
456 "As the darkness turns into the dawn\n"
457 "The child is gone\n"
458 "\33r(Fiona Apple) ",
461 "\33l\33iBut then the dove of hope began its downward slope\n"
462 "And I believed for a moment that my chances were\n"
463 "Approaching to be grabbed\n"
464 "But as it came down near, so did a weary tear\n"
465 "I thought it was a bird, but it was just a paper bag\n"
466 "\33r(Fiona Apple) ",
469 "\33l\33iWait 'til I get him back\n"
470 "He won't have a back to scratch\n"
471 "Yeah, keep turning that chin\n"
472 "And you will see my face\n"
473 "As I figure how to kill what I cannot catch\n"
478 static inline ULONG
GetLONGBE(void *address
)
480 UBYTE
*ptr
= (UBYTE
*)address
;
483 retval
= (ptr
[0] << 24) | (ptr
[1] << 16) | (ptr
[2] << 8) | ptr
[3];
488 /* /// "HardwareListDisplayHook()" */
489 AROS_UFH3(LONG
, HardwareListDisplayHook
,
490 AROS_UFHA(struct Hook
*, hook
, A0
),
491 AROS_UFHA(char **, strarr
, A2
),
492 AROS_UFHA(struct HWListEntry
*, hlnode
, A1
))
497 static char buf2
[32];
500 struct IconListData
*data
= (struct IconListData
*) INST_DATA(IconListClass
->mcc_Class
, ((struct ActionData
*) hook
->h_Data
)->hwlistobj
);
504 psdSafeRawDoFmt(buf
, 16, "%ld", hlnode
->unit
);
505 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
));
506 strptr
= hlnode
->devname
;
521 *strarr
= hlnode
->prodname
? hlnode
->prodname
: (STRPTR
) _(MSG_PANEL_HARDWARE_UNKNOWN
);
523 *strarr
++ = _(MSG_PANEL_HARDWARE_COLS_NAME
);
524 *strarr
++ = _(MSG_PANEL_HARDWARE_COLS_UNIT
);
525 *strarr
++ = _(MSG_PANEL_HARDWARE_COLS_ONLINE
);
526 *strarr
= _(MSG_PANEL_HARDWARE_COLS_PRODUCT
);
533 /* /// "PrefsListDisplayHook()" */
534 AROS_UFH3(LONG
, PrefsListDisplayHook
,
535 AROS_UFHA(struct Hook
*, hook
, A0
),
536 AROS_UFHA(char **, strarr
, A2
),
537 AROS_UFHA(struct PrefsListEntry
*, plnode
, A1
))
545 psdSafeRawDoFmt(buf
, 16, "%ld", plnode
->size
);
546 *strarr
++ = plnode
->type
;
547 *strarr
++ = plnode
->id
;
548 *strarr
++ = plnode
->owner
;
551 *strarr
++ = _(MSG_PANEL_CONFIG_COLS_TYPE
);
552 *strarr
++ = _(MSG_PANEL_CONFIG_COLS_DESC
);
553 *strarr
++ = _(MSG_PANEL_CONFIG_COLS_OWNER
);
554 *strarr
= _(MSG_PANEL_CONFIG_COLS_SIZE
);
561 /* /// "CheckDeviceValid()" */
562 BOOL
CheckDeviceValid(struct DevListEntry
*dlnode
)
564 struct Node
*pd
= NULL
;
569 while((pd
= psdGetNextDevice(pd
)))
583 /* /// "DeviceListDisplayHook()" */
584 AROS_UFH3(LONG
, DeviceListDisplayHook
,
585 AROS_UFHA(struct Hook
*, hook
, A0
),
586 AROS_UFHA(char **, strarr
, A2
),
587 AROS_UFHA(struct DevListEntry
*, dlnode
, A1
))
598 #ifdef AROS_USB30_CODE
599 IPTR devissuperspeed
;
604 IPTR devhasappbinding
;
605 IPTR devisconfigured
;
606 IPTR devlowpower
= 0;
608 IPTR devissuspended
= 0;
610 BOOL goodbinding
= FALSE
;
611 BOOL hasmultiple
= FALSE
;
616 struct List
*piflist
;
620 struct Library
*bindingcls
;
621 struct Task
*bindingtask
;
624 static char buf
[100];
625 static char buf2
[32];
626 static char buf3
[32];
629 struct IconListData
*data
= (struct IconListData
*) INST_DATA(IconListClass
->mcc_Class
, ((struct ActionData
*) hook
->h_Data
)->devlistobj
);
633 if(!CheckDeviceValid(dlnode
))
635 psdSafeRawDoFmt(buf2
, 32, "\33O[%08lx] %s",
638 psdSafeRawDoFmt(buf3
, 32, "\33O[%08lx] %s",
639 data
->mimainlist
[5], "Ghost");
640 *strarr
++ = "<You can't see me>";
648 psdGetAttrs(PGA_DEVICE
, dlnode
->pd
,
649 DA_Binding
, &devbinding
,
650 DA_BindingClass
, &bindingcls
,
651 DA_ProductName
, strarr
++,
652 DA_IsLowspeed
, &devislowspeed
,
653 DA_IsHighspeed
, &devishighspeed
,
654 #ifdef AROS_USB30_CODE
655 DA_IsSuperspeed
, &devissuperspeed
,
657 DA_IsConnected
, &devisconnected
,
658 DA_HasAddress
, &devhasaddress
,
659 DA_HasDevDesc
, &devhasdevdesc
,
660 DA_IsConfigured
, &devisconfigured
,
661 DA_IsDead
, &devisdead
,
662 DA_IsSuspended
, &devissuspended
,
663 DA_LowPower
, &devlowpower
,
664 DA_HasAppBinding
, &devhasappbinding
,
666 DA_SubClass
, &devsubclass
,
667 DA_Protocol
, &devproto
,
668 DA_ConfigList
, &pclist
,
671 #ifdef AROS_USB30_CODE
672 *strarr
++ = (devislowspeed
? _(MSG_DEVICE_SPEED_LOW
) : (devissuperspeed
? _(MSG_DEVICE_SPEED_SUPER
) : (devishighspeed
? _(MSG_DEVICE_SPEED_HIGH
) : _(MSG_DEVICE_SPEED_FULL
))));
674 *strarr
++ = (devislowspeed
? _(MSG_DEVICE_SPEED_LOW
) : (devishighspeed
? _(MSG_DEVICE_SPEED_HIGH
) : _(MSG_DEVICE_SPEED_FULL
)));
679 statestr
= _(MSG_DEVICE_STATE_SUSPENDED
);
684 statestr
= devlowpower
? _(MSG_DEVICE_STATE_DEADLP
) : _(MSG_DEVICE_STATE_DEAD
);
689 statestr
= _(MSG_DEVICE_STATE_LOWPOWER
);
692 else if(devisconfigured
)
694 statestr
= _(MSG_DEVICE_STATE_CONFIGURED
);
697 else if(devhasdevdesc
)
699 statestr
= _(MSG_DEVICE_STATE_DEVDESC
);
702 else if(devhasaddress
)
704 statestr
= _(MSG_DEVICE_STATE_HASADDRESS
);
707 else if(devisconnected
)
709 statestr
= _(MSG_DEVICE_STATE_CONNECTED
);
712 statestr
= _(MSG_DEVICE_STATE_DEAD
);
719 pc
= pclist
->lh_Head
;
722 psdGetAttrs(PGA_CONFIG
, pc
,
723 CA_InterfaceList
, &piflist
,
725 pif
= piflist
->lh_Head
;
728 psdGetAttrs(PGA_INTERFACE
, pif
,
730 IFA_SubClass
, &ifsubclass
,
731 IFA_Protocol
, &ifproto
,
738 devsubclass
= ifsubclass
;
741 if(devclass
!= ifclass
)
747 if(devsubclass
!= ifsubclass
)
752 if(devproto
!= ifproto
)
768 case STILLIMG_CLASSCODE
:
771 case BLUETOOTH_CLASSCODE
:
774 case FWUPGRADE_CLASSCODE
:
777 case VENDOR_CLASSCODE
:
779 case SECURITY_CLASSCODE
:
781 case SMARTCARD_CLASSCODE
:
783 case CDCDATA_CLASSCODE
:
787 case MASSSTORE_CLASSCODE
:
789 case PRINTER_CLASSCODE
:
791 case PHYSICAL_CLASSCODE
:
795 case CDCCTRL_CLASSCODE
:
797 case AUDIO_CLASSCODE
:
806 psdSafeRawDoFmt(buf2
, 32, "\33O[%08lx] %s",
807 data
->mimainlist
[clsimg
],
808 psdNumToStr(NTS_COMBOCLASS
,
809 (devclass
<<NTSCCS_CLASS
)|(devsubclass
<<NTSCCS_SUBCLASS
)|(devproto
<<NTSCCS_PROTO
)|
810 NTSCCF_CLASS
|NTSCCF_SUBCLASS
|NTSCCF_PROTO
,
813 psdSafeRawDoFmt(buf2
, 32, "\33O[%08lx] %s",
814 data
->mimainlist
[0], "Multiple");
821 psdGetAttrs(PGA_APPBINDING
, devbinding
,
822 ABA_Task
, &bindingtask
,
824 *strarr
= bindingtask
->tc_Node
.ln_Name
;
826 *strarr
= bindingcls
->lib_Node
.ln_Name
;
830 *strarr
= bufptr
= buf
;
832 pc
= pclist
->lh_Head
;
835 psdGetAttrs(PGA_CONFIG
, pc
,
836 CA_InterfaceList
, &piflist
,
838 pif
= piflist
->lh_Head
;
841 psdGetAttrs(PGA_INTERFACE
, pif
,
842 IFA_Binding
, &ifbinding
,
843 IFA_BindingClass
, &bindingcls
,
848 if((buflen
< 99) && ( buflen
> 3))
854 tmpcptr
= bindingcls
->lib_Node
.ln_Name
;
855 while((*bufptr
++ = *tmpcptr
++))
878 if(!goodbinding
&& (stateimg
== 18))
882 psdSafeRawDoFmt(buf3
, 32, "\33O[%08lx] %s",
883 data
->mimainlist
[stateimg
], statestr
);
885 *strarr
++ = _(MSG_PANEL_DEVICES_COLS_NAME
);
886 *strarr
++ = _(MSG_PANEL_DEVICES_COLS_SPEED
);
887 *strarr
++ = _(MSG_PANEL_DEVICES_COLS_STATE
);
888 *strarr
++ = _(MSG_PANEL_DEVICES_COLS_CLASS
);
889 *strarr
= _(MSG_PANEL_DEVICES_COLS_BINDINGS
);
896 /* /// "ClassListDisplayHook()" */
897 AROS_UFH3(LONG
, ClassListDisplayHook
,
898 AROS_UFHA(struct Hook
*, hook
, A0
),
899 AROS_UFHA(char **, strarr
, A2
),
900 AROS_UFHA(struct ClsListEntry
*, clnode
, A1
))
906 struct Library
*UsbClsBase
;
912 psdGetAttrs(PGA_STACK
, NULL
, PA_ClassList
, &lst
, TAG_END
);
916 if(clnode
->puc
== puc
)
930 psdGetAttrs(PGA_USBCLASS
, clnode
->puc
,
931 UCA_ClassBase
, &UsbClsBase
,
932 UCA_ClassName
, strarr
++,
933 UCA_UseCount
, &usecnt
,
935 psdSafeRawDoFmt(buf
, 16, "%ld", usecnt
);
937 usbGetAttrs(UGA_CLASS
, NULL
,
938 UCCA_Description
, strarr
,
942 *strarr
++ = _(MSG_PANEL_CLASSES_COLS_NAME
);
943 *strarr
++ = _(MSG_PANEL_CLASSES_COLS_USE
);
944 *strarr
= _(MSG_PANEL_CLASSES_COLS_DESC
);
951 /* /// "ErrorListDisplayHook()" */
952 AROS_UFH3(LONG
, ErrorListDisplayHook
,
953 AROS_UFHA(struct Hook
*, hook
, A0
),
954 AROS_UFHA(char **, strarr
, A2
),
955 AROS_UFHA(struct ErrListEntry
*, elnode
, A1
))
960 struct DateStamp
*ds
;
962 static char strtime
[LEN_DATSTRING
];
967 psdGetAttrs(PGA_ERRORMSG
, elnode
->pem
,
969 EMA_Origin
, &strarr
[2],
976 dt
.dat_Stamp
.ds_Days
= ds
->ds_Days
;
977 dt
.dat_Stamp
.ds_Minute
= ds
->ds_Minute
;
978 dt
.dat_Stamp
.ds_Tick
= ds
->ds_Tick
;
979 dt
.dat_Format
= FORMAT_DEF
;
981 dt
.dat_StrDay
= NULL
;
982 dt
.dat_StrDate
= NULL
;
983 dt
.dat_StrTime
= strtime
;
989 strarr
[1] = ((level
== RETURN_OK
) ? _(MSG_LOGLEVEL_OK
) :
990 ((level
== RETURN_WARN
) ? _(MSG_LOGLEVEL_WARNING
) :
991 ((level
== RETURN_ERROR
) ? _(MSG_LOGLEVEL_ERROR
) :
992 ((level
== RETURN_FAIL
) ? _(MSG_LOGLEVEL_FAILURE
) : _(MSG_LOGLEVEL_OTHER
)))));
999 /* /// "IconListDisplayHook()" */
1000 AROS_UFH3(LONG
, IconListDisplayHook
,
1001 AROS_UFHA(struct Hook
*, hook
, A0
),
1002 AROS_UFHA(char **, strarr
, A2
),
1003 AROS_UFHA(STRPTR
, str
, A1
))
1007 static char buf
[32];
1008 struct IconListData
*data
= (struct IconListData
*) INST_DATA(IconListClass
->mcc_Class
, ((struct ActionData
*) hook
->h_Data
)->cfgpagelv
);
1012 LONG pos
= ((IPTR
*) strarr
)[-1];
1016 pos
= 24; // fix for PoPo
1020 pos
= 16; // fix for Configure Management menu
1024 pos
= 23; // fix for Online menu
1027 psdSafeRawDoFmt(buf
, 32, "\33O[%08lx] %s",
1028 data
->mimainlist
[pos
],
1037 /* /// "AllocHWEntry()" */
1038 struct HWListEntry
* AllocHWEntry(struct ActionData
*data
, struct Node
*phw
)
1040 struct HWListEntry
*hlnode
;
1042 hlnode
= psdAllocVec(sizeof(struct HWListEntry
));
1047 psdGetAttrs(PGA_HARDWARE
, phw
,
1048 HA_DeviceName
, &str
,
1049 HA_DeviceUnit
, &hlnode
->unit
,
1050 HA_ProductName
, &hlnode
->prodname
,
1052 hlnode
->devname
= psdCopyStr(str
);
1055 AddTail(&data
->hwlist
, &hlnode
->node
);
1061 /* /// "FreeHWEntry()" */
1062 void FreeHWEntry(struct ActionData
*data
, struct HWListEntry
*hlnode
)
1067 Remove(&hlnode
->node
);
1070 psdLockWritePBase();
1071 psdGetAttrs(PGA_STACK
, NULL
, PA_HardwareList
, &lst
, TAG_END
);
1075 if(phw
== hlnode
->phw
)
1078 psdRemHardware(phw
);
1090 if(hlnode
->infowindow
)
1092 set(hlnode
->infowindow
, MUIA_Window_Open
, FALSE
);
1095 DoMethod(data
->appobj
, OM_REMMEMBER
, hlnode
->infowindow
);
1096 DoMethod(hlnode
->infowindow
, OM_DISPOSE
);
1098 hlnode
->infowindow
= NULL
;
1100 psdFreeVec(hlnode
->devname
);
1105 /* /// "AllocDevEntry()" */
1106 struct DevListEntry
* AllocDevEntry(struct ActionData
*data
, struct Node
*pd
)
1108 struct DevListEntry
*dlnode
;
1110 dlnode
= psdAllocVec(sizeof(struct DevListEntry
));
1114 dlnode
->adata
= data
;
1115 AddTail(&data
->devlist
, &dlnode
->node
);
1121 /* /// "FreeDevEntry()" */
1122 void FreeDevEntry(struct ActionData
*data
, struct DevListEntry
*dlnode
)
1124 if(dlnode
->infowindow
)
1126 set(dlnode
->infowindow
, MUIA_Window_Open
, FALSE
);
1129 DoMethod(data
->appobj
, OM_REMMEMBER
, dlnode
->infowindow
);
1130 DoMethod(dlnode
->infowindow
, OM_DISPOSE
);
1132 dlnode
->infowindow
= NULL
;
1135 dlnode
->devdata
->dlnode
= NULL
;
1138 Remove(&dlnode
->node
);
1143 /* /// "AllocClsEntry()" */
1144 struct ClsListEntry
* AllocClsEntry(struct ActionData
*data
, struct Node
*puc
)
1146 struct ClsListEntry
*clnode
;
1147 clnode
= psdAllocVec(sizeof(struct ClsListEntry
));
1152 AddTail(&data
->clslist
, &clnode
->node
);
1158 /* /// "FreeClsEntry()" */
1159 void FreeClsEntry(struct ActionData
*data
, struct ClsListEntry
*clnode
)
1161 Remove(&clnode
->node
);
1166 /* /// "FreeErrorList()" */
1167 void FreeErrorList(struct ActionData
*data
)
1170 node
= data
->errlist
.lh_Head
;
1171 while(node
->ln_Succ
)
1175 node
= data
->errlist
.lh_Head
;
1180 /* /// "CreateErrorList()" */
1181 void CreateErrorList(struct ActionData
*data
)
1185 struct ErrListEntry
*elnode
;
1188 set(data
->errlistobj
, MUIA_List_Quiet
, TRUE
);
1189 DoMethod(data
->errlistobj
, MUIM_List_Clear
);
1190 FreeErrorList(data
);
1191 psdGetAttrs(PGA_STACK
, NULL
, PA_ErrorMsgList
, &lst
, TAG_END
);
1196 psdGetAttrs(PGA_ERRORMSG
, pem
,
1199 if(level
>= data
->errorlevel
)
1201 if((elnode
= psdAllocVec(sizeof(struct ErrListEntry
))))
1204 AddTail(&data
->errlist
, &elnode
->node
);
1205 DoMethod(data
->errlistobj
, MUIM_List_InsertSingle
, elnode
, MUIV_List_Insert_Bottom
);
1211 set(data
->errlistobj
, MUIA_List_Quiet
, FALSE
);
1212 set(data
->errlistobj
, MUIA_List_Active
, MUIV_List_Active_Bottom
);
1216 /* /// "FreePrefsList()" */
1217 void FreePrefsList(struct ActionData
*data
)
1219 struct PrefsListEntry
*plnode
;
1220 plnode
= (struct PrefsListEntry
*) data
->prefslist
.lh_Head
;
1221 while(plnode
->node
.ln_Succ
)
1223 Remove(&plnode
->node
);
1224 psdFreeVec(plnode
->id
);
1225 psdFreeVec(plnode
->owner
);
1226 psdFreeVec(plnode
->devid
);
1227 psdFreeVec(plnode
->ifid
);
1229 plnode
= (struct PrefsListEntry
*) data
->prefslist
.lh_Head
;
1234 /* /// "AllocPrefsEntry()" */
1235 struct PrefsListEntry
* AllocPrefsEntry(struct ActionData
*data
, ULONG formid
, ULONG size
, STRPTR id
, STRPTR owner
)
1237 struct PrefsListEntry
*plnode
= NULL
;
1239 if((plnode
= psdAllocVec(sizeof(struct PrefsListEntry
))))
1249 plnode
->chunkid
= formid
;
1250 plnode
->size
= size
;
1253 case IFFFORM_STACKCFG
:
1254 plnode
->type
= "Core Cfg";
1255 plnode
->node
.ln_Pri
= 100;
1258 case IFFFORM_DEVICECFG
:
1259 plnode
->type
= "USB Device";
1262 case IFFFORM_CLASSCFG
:
1263 plnode
->type
= "Class Cfg";
1264 plnode
->node
.ln_Pri
= 20;
1267 case IFFFORM_DEVCFGDATA
:
1268 plnode
->type
= " Device Cfg";
1271 case IFFFORM_IFCFGDATA
:
1272 plnode
->type
= " Interface Cfg";
1275 case MAKE_ID('P','S','D','L'):
1276 plnode
->type
= "Licence";
1277 plnode
->node
.ln_Pri
= 50;
1284 plnode
->type
= "Unknown";
1285 plnode
->node
.ln_Pri
= -100;
1290 plnode
->devid
= psdCopyStr(data
->devidstr
);
1293 plnode
->ifid
= psdCopyStr(data
->ifidstr
);
1296 plnode
->owner
= owner
;
1297 Enqueue(&data
->prefslist
, &plnode
->node
);
1303 /* /// "FindCfgChunk()" */
1304 ULONG
* FindCfgChunk(ULONG
*form
, ULONG chnkid
)
1306 ULONG
*buf
= form
+ 3;
1307 ULONG len
= (AROS_LONG2BE(form
[1]) - 3) & ~1UL;
1312 if(AROS_LONG2BE(*buf
) == chnkid
)
1316 chlen
= (AROS_LONG2BE(buf
[1]) + 9) & ~1UL;
1318 buf
= (ULONG
*) (((UBYTE
*) buf
) + chlen
);
1324 /* /// "GetStringChunk()" */
1325 STRPTR
GetStringChunk(ULONG
*form
, ULONG chnkid
, STRPTR defstr
)
1329 if((chunkptr
= FindCfgChunk(form
, chnkid
)))
1331 if((str
= (STRPTR
) psdAllocVec(AROS_LONG2BE(chunkptr
[1]) + 1)))
1333 memcpy(str
, &chunkptr
[2], (size_t) AROS_LONG2BE(chunkptr
[1]));
1339 str
= psdCopyStr(defstr
);
1345 /* /// "RecursePrefsForm()" */
1346 void RecursePrefsForm(struct ActionData
*data
, ULONG
*form
, ULONG depth
, STRPTR stack
)
1348 struct PrefsListEntry
*plnode
;
1353 ULONG formid
= AROS_LONG2BE(form
[2]);
1358 ULONG formsize
= AROS_LONG2BE(form
[1]) + 8;
1359 BOOL allocdevid
= FALSE
;
1360 BOOL allocifid
= FALSE
;
1362 newstack
= (STRPTR
) psdAllocVec((ULONG
) strlen(stack
) + 5);
1367 strcpy(newstack
, stack
);
1368 *((ULONG
*) &newstack
[strlen(stack
)]) = AROS_LONG2BE(formid
);
1370 if(AROS_LONG2BE(*((ULONG
*) newstack
)) != IFFFORM_PSDCFG
)
1372 owner
= GetStringChunk(form
, IFFCHNK_OWNER
, "Unknown");
1373 id
= psdCopyStr("This is not a poseidon config!");
1374 plnode
= AllocPrefsEntry(data
, formid
, formsize
, id
, owner
);
1376 else if(!strcmp(newstack
+ 4, "STKC"))
1378 plnode
= AllocPrefsEntry(data
, formid
, formsize
, psdCopyStr("Global Stack Configuration"), psdCopyStr("Trident"));
1380 else if(!strcmp(newstack
+ 4, "DEVC"))
1382 id
= GetStringChunk(form
, IFFCHNK_DEVID
, "Unknown");
1383 data
->devidstr
= psdCopyStr(id
);
1385 plnode
= AllocPrefsEntry(data
, formid
, formsize
, id
, psdCopyStr("Trident"));
1387 else if(!strcmp(newstack
+ 4, "DEVCDCFG"))
1389 owner
= GetStringChunk(form
, IFFCHNK_OWNER
, "Unknown");
1390 if(!strcmp(owner
, "Trident"))
1392 id
= psdCopyStr("Generic Prefs");
1394 id
= psdCopyStrFmt("%s Prefs", owner
);
1396 plnode
= AllocPrefsEntry(data
, formid
, formsize
, id
, owner
);
1398 else if(!strcmp(newstack
+ 4, "DEVCICFG"))
1402 data
->ifidstr
= GetStringChunk(form
, IFFCHNK_IFID
, "Unknown");
1404 owner
= GetStringChunk(form
, IFFCHNK_OWNER
, "Unknown");
1405 plnode
= AllocPrefsEntry(data
, formid
, formsize
, psdCopyStrFmt("%s Prefs for %s", owner
, data
->ifidstr
), owner
);
1408 else if(!strcmp(newstack
+ 4, "CLSC"))
1412 owner
= GetStringChunk(form
, IFFCHNK_OWNER
, "Unknown");
1413 id
= psdCopyStrFmt("(Default) Prefs for %s", owner
);
1414 plnode
= AllocPrefsEntry(data
, formid
, formsize
, id
, owner
);
1417 else if(!strcmp(newstack
+ 4, "PSDL"))
1419 owner
= GetStringChunk(form
, IFFCHNK_OWNER
, "Unknown");
1420 chunkptr
= FindCfgChunk(form
, MAKE_ID('S','K','E','Y'));
1423 id
= psdCopyStrFmt("Keyfile Serial #%04ld", chunkptr
[3] & 0xffff);
1425 id
= psdCopyStr("Corrupted Keyfile?");
1427 plnode
= AllocPrefsEntry(data
, formid
, formsize
, id
, psdCopyStr("Secret"));
1431 owner
= GetStringChunk(form
, IFFCHNK_OWNER
, "Unknown");
1432 id
= psdCopyStr("Unknown prefs data (XXXX)");
1435 *((ULONG
*) &id
[20]) = AROS_LONG2BE(formid
);
1437 plnode
= AllocPrefsEntry(data
, formid
, formsize
, id
, owner
);
1442 endptr
= (ULONG
*) (((UBYTE
*) form
) + ((GetLONGBE(&form
[1]) + 9) & ~1UL));
1443 while(currptr
< endptr
)
1445 chunkid
= GetLONGBE(&currptr
[0]);
1446 chunklen
= (GetLONGBE(&currptr
[1]) + 9) & ~1UL;
1447 if((chunkid
== ID_FORM
) && (depth
< 3))
1449 RecursePrefsForm(data
, currptr
, depth
, newstack
);
1453 case IFFCHNK_FORCEDBIND
:
1454 if(!strcmp(newstack
+ 4, "DEVC"))
1456 owner
= GetStringChunk(form
, chunkid
, "Unknown");
1457 plnode
= AllocPrefsEntry(data
, chunkid
, chunklen
, psdCopyStrFmt("Forced Device Binding to %s", owner
), owner
);
1460 plnode
->type
= " Binding";
1463 else if(!strcmp(newstack
+ 4, "DEVCICFG"))
1465 owner
= GetStringChunk(form
, IFFCHNK_OWNER
, "Unknown");
1466 plnode
= AllocPrefsEntry(data
, chunkid
, chunklen
, psdCopyStrFmt("Forced IFace Binding to %s", owner
), owner
);
1469 plnode
->type
= " Binding";
1475 currptr
= (ULONG
*) (((UBYTE
*) currptr
) + chunklen
);
1479 psdFreeVec(data
->devidstr
);
1480 data
->devidstr
= NULL
;
1484 psdFreeVec(data
->ifidstr
);
1485 data
->ifidstr
= NULL
;
1487 psdFreeVec(newstack
);
1491 /* /// "CreatePrefsList()" */
1492 void CreatePrefsList(struct ActionData
*data
)
1494 struct PrefsListEntry
*plnode
;
1499 set(data
->prefslistobj
, MUIA_List_Quiet
, TRUE
);
1500 get(data
->prefslistobj
, MUIA_List_Active
, &oldpos
);
1501 DoMethod(data
->prefslistobj
, MUIM_List_Clear
);
1502 FreePrefsList(data
);
1503 data
->configroot
= psdWriteCfg(NULL
);
1504 if(data
->configroot
)
1506 RecursePrefsForm(data
, data
->configroot
, 0, "");
1507 psdFreeVec(data
->configroot
);
1508 data
->configroot
= NULL
;
1510 plnode
= (struct PrefsListEntry
*) data
->prefslist
.lh_Head
;
1511 while(plnode
->node
.ln_Succ
)
1513 DoMethod(data
->prefslistobj
, MUIM_List_InsertSingle
, plnode
, MUIV_List_Insert_Bottom
);
1514 plnode
= (struct PrefsListEntry
*) plnode
->node
.ln_Succ
;
1516 set(data
->prefslistobj
, MUIA_List_Active
, oldpos
);
1517 set(data
->prefslistobj
, MUIA_List_Quiet
, FALSE
);
1518 psdGetAttrs(PGA_STACK
, NULL
,
1519 PA_CurrConfigHash
, &currhash
,
1520 PA_SavedConfigHash
, &oldhash
,
1522 set(data
->saveobj
, MUIA_Disabled
, (oldhash
== currhash
));
1526 /* /// "FreeGUILists()" */
1527 void FreeGUILists(struct ActionData
*data
)
1529 struct HWListEntry
*hlnode
;
1530 struct DevListEntry
*dlnode
;
1531 struct ClsListEntry
*clnode
;
1533 hlnode
= (struct HWListEntry
*) data
->hwlist
.lh_Head
;
1534 while(hlnode
->node
.ln_Succ
)
1536 //hlnode->infowindow = NULL;
1538 FreeHWEntry(data
, hlnode
);
1539 hlnode
= (struct HWListEntry
*) data
->hwlist
.lh_Head
;
1541 dlnode
= (struct DevListEntry
*) data
->devlist
.lh_Head
;
1542 while(dlnode
->node
.ln_Succ
)
1544 //dlnode->infowindow = NULL;
1545 FreeDevEntry(data
, dlnode
);
1546 dlnode
= (struct DevListEntry
*) data
->devlist
.lh_Head
;
1548 clnode
= (struct ClsListEntry
*) data
->clslist
.lh_Head
;
1549 while(clnode
->node
.ln_Succ
)
1551 FreeClsEntry(data
, clnode
);
1552 clnode
= (struct ClsListEntry
*) data
->clslist
.lh_Head
;
1557 /* /// "CreateClassPopup()" */
1558 Object
* CreateClassPopup(void)
1567 mi_root
= MenustripObject
,
1568 Child
, mi_top
= MenuObjectT("Forced binding"),
1569 Child
, MenuitemObject
,
1570 MUIA_Menuitem_Title
, "None",
1578 psdGetAttrs(PGA_STACK
, NULL
, PA_ClassList
, &lst
, TAG_END
);
1582 psdGetAttrs(PGA_USBCLASS
, puc
,
1583 UCA_ClassName
, &clname
,
1586 mi_sub
= MenuitemObject
,
1587 MUIA_Menuitem_Title
, clname
,
1591 DoMethod(mi_top
, OM_ADDMEMBER
, mi_sub
);
1601 /* /// "InternalCreateConfig()" */
1602 BOOL
InternalCreateConfig(void)
1613 pic
= psdFindCfgForm(NULL
, IFFFORM_STACKCFG
);
1616 tmpform
[0] = AROS_LONG2BE(ID_FORM
);
1617 tmpform
[1] = AROS_LONG2BE(4);
1618 tmpform
[2] = AROS_LONG2BE(IFFFORM_STACKCFG
);
1619 psdAddCfgEntry(NULL
, tmpform
);
1620 pic
= psdFindCfgForm(NULL
, IFFFORM_STACKCFG
);
1627 /* First mark all old hardware entries as offline */
1628 subpic
= psdFindCfgForm(pic
, IFFFORM_UHWDEVICE
);
1631 tmpform
[0] = AROS_LONG2BE(IFFCHNK_OFFLINE
);
1632 tmpform
[1] = AROS_LONG2BE(4);
1634 psdAddCfgEntry(subpic
, tmpform
);
1635 subpic
= psdNextCfgForm(subpic
);
1638 /* Add existing hardware entries */
1640 psdGetAttrs(PGA_STACK
, NULL
, PA_HardwareList
, &lst
, TAG_END
);
1644 psdGetAttrs(PGA_HARDWARE
, phw
,
1645 HA_DeviceName
, &name
,
1646 HA_DeviceUnit
, &unit
,
1649 // find corresponding form in config
1650 subpic
= psdFindCfgForm(pic
, IFFFORM_UHWDEVICE
);
1653 if(psdMatchStringChunk(subpic
, IFFCHNK_NAME
, name
))
1655 ULONG
*unitchk
= psdGetCfgChunk(subpic
, IFFCHNK_UNIT
);
1656 if(unitchk
&& unitchk
[2] == unit
)
1658 psdFreeVec(unitchk
);
1661 psdFreeVec(unitchk
);
1663 subpic
= psdNextCfgForm(subpic
);
1668 // not found, add it
1669 tmpform
[0] = AROS_LONG2BE(ID_FORM
);
1670 tmpform
[1] = AROS_LONG2BE(4);
1671 tmpform
[2] = AROS_LONG2BE(IFFFORM_UHWDEVICE
);
1672 subpic
= psdAddCfgEntry(pic
, tmpform
);
1677 psdAddStringChunk(subpic
, IFFCHNK_NAME
, name
);
1678 tmpform
[0] = AROS_LONG2BE(IFFCHNK_UNIT
);
1679 tmpform
[1] = AROS_LONG2BE(4);
1681 psdAddCfgEntry(subpic
, tmpform
);
1682 // remove offline chunk to make sure the thing is going online next time
1683 psdRemCfgChunk(subpic
, IFFCHNK_OFFLINE
);
1689 /* Add existing class entries */
1691 psdGetAttrs(PGA_STACK
, NULL
, PA_ClassList
, &lst
, TAG_END
);
1695 tmpform
[0] = AROS_LONG2BE(ID_FORM
);
1696 tmpform
[1] = AROS_LONG2BE(4);
1697 tmpform
[2] = AROS_LONG2BE(IFFFORM_USBCLASS
);
1698 subpic
= psdAddCfgEntry(pic
, tmpform
);
1702 psdGetAttrs(PGA_USBCLASS
, puc
,
1703 UCA_FullPath
, &name
,
1707 psdGetAttrs(PGA_USBCLASS
, puc
,
1708 UCA_ClassName
, &name
,
1710 name
= psdCopyStrFmt("USB/%s", name
);
1713 psdAddStringChunk(subpic
, IFFCHNK_NAME
, name
);
1717 psdAddStringChunk(subpic
, IFFCHNK_NAME
, name
);
1727 /* /// "InternalCreateConfigGUI()" */
1728 BOOL
InternalCreateConfigGUI(struct ActionData
*data
)
1736 struct HWListEntry
*hlnode
;
1737 struct ClsListEntry
*clnode
;
1740 pic
= psdFindCfgForm(NULL
, IFFFORM_STACKCFG
);
1743 tmpform
[0] = AROS_LONG2BE(ID_FORM
);
1744 tmpform
[1] = AROS_LONG2BE(4);
1745 tmpform
[2] = AROS_LONG2BE(IFFFORM_STACKCFG
);
1746 psdAddCfgEntry(NULL
, tmpform
);
1747 pic
= psdFindCfgForm(NULL
, IFFFORM_STACKCFG
);
1757 /* First remove all old hardware entries */
1758 while((subpic
= psdFindCfgForm(pic
, IFFFORM_UHWDEVICE
)))
1760 psdRemCfgForm(subpic
);
1763 /* Add hardware entries from GUI, but mark them as offline */
1764 hlnode
= (struct HWListEntry
*) data
->hwlist
.lh_Head
;
1765 while(hlnode
->node
.ln_Succ
)
1767 tmpform
[0] = AROS_LONG2BE(ID_FORM
);
1768 tmpform
[1] = AROS_LONG2BE(4);
1769 tmpform
[2] = AROS_LONG2BE(IFFFORM_UHWDEVICE
);
1770 subpic
= psdAddCfgEntry(pic
, tmpform
);
1773 psdAddStringChunk(subpic
, IFFCHNK_NAME
, hlnode
->devname
);
1774 tmpform
[0] = AROS_LONG2BE(IFFCHNK_UNIT
);
1775 tmpform
[1] = AROS_LONG2BE(4);
1776 tmpform
[2] = hlnode
->unit
;
1777 psdAddCfgEntry(subpic
, tmpform
);
1778 tmpform
[0] = AROS_LONG2BE(IFFCHNK_OFFLINE
);
1779 tmpform
[1] = AROS_LONG2BE(4);
1781 psdAddCfgEntry(subpic
, tmpform
);
1783 hlnode
= (struct HWListEntry
*) hlnode
->node
.ln_Succ
;
1786 /* Now find all hardware entries that are online and mark them as such */
1787 psdGetAttrs(PGA_STACK
, NULL
, PA_HardwareList
, &lst
, TAG_END
);
1791 psdGetAttrs(PGA_HARDWARE
, phw
,
1792 HA_DeviceName
, &name
,
1793 HA_DeviceUnit
, &unit
,
1796 // find corresponding form in config
1797 subpic
= psdFindCfgForm(pic
, IFFFORM_UHWDEVICE
);
1800 if(psdMatchStringChunk(subpic
, IFFCHNK_NAME
, name
))
1802 ULONG
*unitchk
= psdGetCfgChunk(subpic
, IFFCHNK_UNIT
);
1803 if(unitchk
&& unitchk
[2] == unit
)
1805 psdFreeVec(unitchk
);
1806 psdRemCfgChunk(subpic
, IFFCHNK_OFFLINE
);
1809 psdFreeVec(unitchk
);
1811 subpic
= psdNextCfgForm(subpic
);
1816 /* Delete all old class entries */
1817 while((subpic
= psdFindCfgForm(pic
, IFFFORM_USBCLASS
)))
1819 psdRemCfgForm(subpic
);
1821 /* Add existing class entries */
1822 clnode
= (struct ClsListEntry
*) data
->clslist
.lh_Head
;
1823 while(clnode
->node
.ln_Succ
)
1825 tmpform
[0] = AROS_LONG2BE(ID_FORM
);
1826 tmpform
[1] = AROS_LONG2BE(4);
1827 tmpform
[2] = AROS_LONG2BE(IFFFORM_USBCLASS
);
1828 subpic
= psdAddCfgEntry(pic
, tmpform
);
1832 psdGetAttrs(PGA_USBCLASS
, clnode
->puc
,
1833 UCA_FullPath
, &name
,
1837 psdGetAttrs(PGA_USBCLASS
, clnode
->puc
,
1838 UCA_ClassName
, &name
,
1840 name
= psdCopyStrFmt("USB/%s", name
);
1843 psdAddStringChunk(subpic
, IFFCHNK_NAME
, name
);
1847 psdAddStringChunk(subpic
, IFFCHNK_NAME
, name
);
1850 clnode
= (struct ClsListEntry
*) clnode
->node
.ln_Succ
;
1853 data
->swallowconfigevent
= TRUE
;
1858 /* /// "CleanupEventHandler()" */
1859 void CleanupEventHandler(struct ActionData
*data
)
1861 if(data
->eventhandler
)
1863 psdRemEventHandler(data
->eventhandler
);
1864 data
->eventhandler
= NULL
;
1866 if(data
->eventmsgport
)
1868 DeleteMsgPort(data
->eventmsgport
);
1869 data
->eventmsgport
= NULL
;
1874 /* /// "SetupEventHandler()" */
1875 BOOL
SetupEventHandler(struct ActionData
*data
)
1877 if((data
->eventmsgport
= CreateMsgPort()))
1879 data
->eventhandler
= psdAddEventHandler(data
->eventmsgport
, ~0);
1880 if(data
->eventhandler
)
1885 data
->eventhandler
= NULL
;
1891 /* /// "EventHandler()" */
1892 void EventHandler(struct ActionData
*data
)
1899 BOOL cfgchanged
= FALSE
;
1902 while((pen
= GetMsg(data
->eventmsgport
)))
1904 psdGetAttrs(PGA_EVENTNOTE
, pen
,
1905 ENA_EventID
, &penid
,
1906 ENA_Param1
, &penparam1
,
1907 ENA_Param2
, &penparam2
,
1909 eventmask
|= (1L<<penid
);
1910 /*printf("Event %ld, Param1 %ld\n", pen->pen_Event, pen->pen_Param1);*/
1913 case EHMB_ADDHARDWARE
:
1917 struct HWListEntry
*hlnode
;
1923 psdGetAttrs(PGA_STACK
, NULL
, PA_HardwareList
, &lst
, TAG_END
);
1927 if(phw
== (struct Node
*) penparam1
)
1935 psdGetAttrs(PGA_HARDWARE
, phw
,
1936 HA_DeviceName
, &devname
,
1937 HA_DeviceUnit
, &unit
,
1938 HA_ProductName
, &prodname
,
1941 hlnode
= (struct HWListEntry
*) data
->hwlist
.lh_Head
;
1942 while(hlnode
->node
.ln_Succ
)
1944 if((!strcmp(devname
, hlnode
->devname
)) &&
1945 (unit
== hlnode
->unit
))
1950 hlnode
->prodname
= prodname
;
1954 hlnode
= (struct HWListEntry
*) hlnode
->node
.ln_Succ
;
1956 if(!hlnode
->node
.ln_Succ
)
1958 if((hlnode
= AllocHWEntry(data
, phw
)))
1960 DoMethod(data
->hwlistobj
, MUIM_List_InsertSingle
, hlnode
, MUIV_List_Insert_Bottom
);
1963 DoMethod(data
->hwlistobj
, MUIM_List_Redraw
, MUIV_List_Redraw_All
);
1970 case EHMB_REMHARDWARE
:
1972 struct HWListEntry
*hlnode
;
1974 hlnode
= (struct HWListEntry
*) data
->hwlist
.lh_Head
;
1975 while(hlnode
->node
.ln_Succ
)
1977 if(hlnode
->phw
== (struct Node
*) penparam1
)
1980 hlnode
->prodname
= NULL
;
1983 hlnode
= (struct HWListEntry
*) hlnode
->node
.ln_Succ
;
1985 if(hlnode
->node
.ln_Succ
)
1987 DoMethod(data
->hwlistobj
, MUIM_List_Redraw
, MUIV_List_Redraw_All
);
1993 case EHMB_ADDDEVICE
:
1995 struct Node
*pd
= NULL
;
1996 struct DevListEntry
*dlnode
;
1998 while((pd
= psdGetNextDevice(pd
)))
2000 if(pd
== (struct Node
*) penparam1
)
2002 dlnode
= (struct DevListEntry
*) data
->devlist
.lh_Head
;
2003 while(dlnode
->node
.ln_Succ
)
2005 if(dlnode
->pd
== pd
)
2007 // ignore existing entry!
2010 dlnode
= (struct DevListEntry
*) dlnode
->node
.ln_Succ
;
2012 if(!dlnode
->node
.ln_Succ
)
2014 dlnode
= AllocDevEntry(data
, pd
);
2017 DoMethod(data
->devlistobj
, MUIM_List_InsertSingle
, dlnode
, MUIV_List_Insert_Bottom
);
2027 case EHMB_REMDEVICE
:
2029 struct DevListEntry
*dlnode
;
2030 struct DevListEntry
*tmpnode
;
2032 set(data
->devlistobj
, MUIA_List_Quiet
, TRUE
);
2033 dlnode
= (struct DevListEntry
*) data
->devlist
.lh_Head
;
2034 while(dlnode
->node
.ln_Succ
)
2036 if((dlnode
->pd
== (struct Node
*) penparam1
) || (!dlnode
->pd
))
2041 DoMethod(data
->devlistobj
, MUIM_List_GetEntry
, pos
, &tmpnode
);
2044 if(tmpnode
== dlnode
)
2046 DoMethod(data
->devlistobj
, MUIM_List_Remove
, pos
);
2051 FreeDevEntry(data
, dlnode
);
2054 dlnode
= (struct DevListEntry
*) dlnode
->node
.ln_Succ
;
2061 struct ClsListEntry
*clnode
;
2062 clnode
= (struct ClsListEntry
*) data
->clslist
.lh_Head
;
2063 while(clnode
->node
.ln_Succ
)
2065 if(clnode
->puc
== (struct Node
*) penparam1
)
2069 clnode
= (struct ClsListEntry
*) clnode
->node
.ln_Succ
;
2071 if(!clnode
->node
.ln_Succ
)
2073 if((clnode
= AllocClsEntry(data
, (struct Node
*) penparam1
)))
2075 DoMethod(data
->clslistobj
, MUIM_List_InsertSingle
, clnode
, MUIV_List_Insert_Bottom
);
2083 struct ClsListEntry
*clnode
;
2084 struct ClsListEntry
*tmpnode
;
2086 set(data
->clslistobj
, MUIA_List_Quiet
, TRUE
);
2087 clnode
= (struct ClsListEntry
*) data
->clslist
.lh_Head
;
2088 while(clnode
->node
.ln_Succ
)
2090 if((clnode
->puc
== (struct Node
*) penparam1
) || (!clnode
->puc
))
2095 DoMethod(data
->clslistobj
, MUIM_List_GetEntry
, pos
, &tmpnode
);
2098 if(tmpnode
== clnode
)
2100 DoMethod(data
->clslistobj
, MUIM_List_Remove
, pos
);
2105 tmpnode
= (struct ClsListEntry
*) clnode
->node
.ln_Succ
;
2106 FreeClsEntry(data
, clnode
);
2109 clnode
= (struct ClsListEntry
*) clnode
->node
.ln_Succ
;
2115 case EHMB_ADDERRORMSG
:
2117 struct ErrListEntry
*elnode
;
2120 psdGetAttrs(PGA_ERRORMSG
, (APTR
) penparam1
,
2123 if(level
>= data
->errorlevel
)
2125 if((elnode
= psdAllocVec(sizeof(struct ErrListEntry
))))
2127 elnode
->pem
= (struct Node
*) penparam1
;
2128 AddTail(&data
->errlist
, &elnode
->node
);
2129 DoMethod(data
->errlistobj
, MUIM_List_InsertSingle
, elnode
, MUIV_List_Insert_Bottom
);
2135 case EHMB_CONFIGCHG
:
2146 if(eventmask
& EHMF_REMERRORMSG
)
2148 CreateErrorList(data
);
2150 if(eventmask
& EHMF_ADDERRORMSG
)
2152 set(data
->errlistobj
, MUIA_List_Active
, MUIV_List_Active_Bottom
);
2154 if(eventmask
& (EHMF_ADDBINDING
|EHMF_REMBINDING
|EHMF_DEVICEDEAD
|EHMF_DEVICELOWPW
|EHMF_DEVSUSPENDED
|EHMF_DEVRESUMED
))
2156 DoMethod(data
->devlistobj
, MUIM_List_Redraw
, MUIV_List_Redraw_All
);
2157 DoMethod(data
->clslistobj
, MUIM_List_Redraw
, MUIV_List_Redraw_All
);
2158 DoMethod(data
->selfobj
, MUIM_Action_Dev_Activate
);
2160 if(eventmask
& EHMF_REMDEVICE
)
2162 set(data
->devlistobj
, MUIA_List_Quiet
, FALSE
);
2164 if(eventmask
& EHMF_REMCLASS
)
2166 set(data
->clslistobj
, MUIA_List_Quiet
, FALSE
);
2168 if(eventmask
& (EHMF_ADDCLASS
|EHMF_REMCLASS
))
2170 set(data
->devlistobj
, MUIA_ContextMenu
, NULL
);
2171 MUI_DisposeObject(data
->mi_classpopup
);
2172 data
->mi_classpopup
= CreateClassPopup();
2173 set(data
->devlistobj
, MUIA_ContextMenu
, data
->mi_classpopup
);
2177 if(!data
->swallowconfigevent
)
2179 UpdateConfigToGUI(data
);
2183 psdGetAttrs(PGA_STACK
, NULL
,
2184 PA_CurrConfigHash
, &currhash
,
2185 PA_SavedConfigHash
, &oldhash
,
2187 set(data
->saveobj
, MUIA_Disabled
, (oldhash
== currhash
));
2189 data
->swallowconfigevent
= FALSE
;
2194 /* /// "UpdateConfigToGUI()" */
2195 void UpdateConfigToGUI(struct ActionData
*data
)
2199 struct HWListEntry
*hlnode
;
2201 struct ClsListEntry
*clnode
;
2210 IPTR popupgone
= FALSE
;
2211 IPTR popupdeath
= FALSE
;
2212 IPTR popupdelay
= 0;
2213 IPTR popupactivate
= FALSE
;
2214 IPTR popuptofront
= TRUE
;
2215 IPTR autodisablelp
= FALSE
;
2216 IPTR autodisabledead
= TRUE
;
2217 IPTR powersaving
= FALSE
;
2218 IPTR forcesuspend
= FALSE
;
2219 IPTR suspendtimeout
= 30;
2220 STRPTR devdtxsoundfile
= "";
2221 STRPTR devremsoundfile
= "";
2222 IPTR prefsversion
= 0;
2223 IPTR relversion
= 0;
2225 ULONG numclasses
= 0;
2230 IPTR selpos
= MUIV_List_Active_Off
;
2231 IPTR clsselpos
= MUIV_List_Active_Off
;
2233 get(data
->hwlistobj
, MUIA_List_Active
, &selpos
);
2234 get(data
->clslistobj
, MUIA_List_Active
, &clsselpos
);
2236 set(data
->hwlistobj
, MUIA_List_Quiet
, TRUE
);
2237 DoMethod(data
->hwlistobj
, MUIM_List_Clear
);
2238 set(data
->clslistobj
, MUIA_List_Quiet
, TRUE
);
2239 DoMethod(data
->clslistobj
, MUIM_List_Clear
);
2241 oldphw
= data
->acthlnode
? data
->acthlnode
->phw
: NULL
;
2243 // remove all GUI entries first
2244 hlnode
= (struct HWListEntry
*) data
->hwlist
.lh_Head
;
2245 while(hlnode
->node
.ln_Succ
)
2248 FreeHWEntry(data
, hlnode
);
2249 hlnode
= (struct HWListEntry
*) data
->hwlist
.lh_Head
;
2252 clnode
= (struct ClsListEntry
*) data
->clslist
.lh_Head
;
2253 while(clnode
->node
.ln_Succ
)
2255 FreeClsEntry(data
, clnode
);
2256 clnode
= (struct ClsListEntry
*) data
->clslist
.lh_Head
;
2259 /* get stuff that's online first */
2260 psdGetAttrs(PGA_STACK
, NULL
,
2261 PA_HardwareList
, &lst
,
2262 PA_ReleaseVersion
, &relversion
,
2263 PA_GlobalConfig
, &stackcfg
,
2268 if((hlnode
= AllocHWEntry(data
, phw
)))
2274 DoMethod(data
->hwlistobj
, MUIM_List_InsertSingle
, hlnode
, MUIV_List_Insert_Bottom
);
2281 pic
= psdFindCfgForm(NULL
, IFFFORM_STACKCFG
);
2282 /* now check for additional entries that are offline */
2283 subpic
= pic
? psdFindCfgForm(pic
, IFFFORM_UHWDEVICE
) : NULL
;
2286 hlnode
= (struct HWListEntry
*) data
->hwlist
.lh_Head
;
2287 while(hlnode
->node
.ln_Succ
)
2289 if(psdMatchStringChunk(subpic
, IFFCHNK_NAME
, hlnode
->devname
))
2291 ULONG
*unitchk
= psdGetCfgChunk(subpic
, IFFCHNK_UNIT
);
2292 if(unitchk
&& (unitchk
[2] == hlnode
->unit
))
2294 psdFreeVec(unitchk
);
2297 psdFreeVec(unitchk
);
2300 hlnode
= (struct HWListEntry
*) hlnode
->node
.ln_Succ
;
2302 if(!hlnode
->node
.ln_Succ
)
2304 if((hlnode
= AllocHWEntry(data
, NULL
)))
2306 ULONG
*unitchk
= psdGetCfgChunk(subpic
, IFFCHNK_UNIT
);
2309 hlnode
->unit
= unitchk
[2];
2310 psdFreeVec(unitchk
);
2312 hlnode
->devname
= psdGetStringChunk(subpic
, IFFCHNK_NAME
);
2313 DoMethod(data
->hwlistobj
, MUIM_List_InsertSingle
, hlnode
, MUIV_List_Insert_Bottom
);
2317 subpic
= psdNextCfgForm(subpic
);
2320 psdGetAttrs(PGA_STACK
, NULL
, PA_ClassList
, &lst
, TAG_END
);
2324 if((clnode
= AllocClsEntry(data
, puc
)))
2327 DoMethod(data
->clslistobj
, MUIM_List_InsertSingle
, clnode
, MUIV_List_Insert_Bottom
);
2334 psdGetAttrs(PGA_STACKCFG
, stackcfg
, GCA_PrefsVersion
, &prefsversion
, TAG_END
);
2338 if(relversion
> prefsversion
)
2340 psdAddErrorMsg(RETURN_WARN
, "Trident", "Forcing a DirScan for (new) classes, as you probably updated to a newer version.");
2341 psdSetAttrs(PGA_STACKCFG
, stackcfg
, GCA_PrefsVersion
, relversion
, TAG_END
);
2342 DoMethod(data
->selfobj
, MUIM_Action_Cls_Scan
);
2344 else if(!(numclasses
|| data
->autoclassesadded
))
2346 psdAddErrorMsg(RETURN_WARN
, "Trident", "Doing a DirScan for classes, because none were in config.");
2347 DoMethod(data
->selfobj
, MUIM_Action_Cls_Scan
);
2349 data
->autoclassesadded
= TRUE
;
2351 set(data
->hwlistobj
, MUIA_List_Active
, selpos
);
2352 set(data
->clslistobj
, MUIA_List_Active
, clsselpos
);
2353 set(data
->hwlistobj
, MUIA_List_Quiet
, FALSE
);
2354 set(data
->devlistobj
, MUIA_List_Quiet
, FALSE
);
2355 set(data
->clslistobj
, MUIA_List_Quiet
, FALSE
);
2356 CreatePrefsList(data
);
2360 psdGetAttrs(PGA_STACKCFG
, stackcfg
,
2361 GCA_SubTaskPri
, &subtaskpri
,
2362 GCA_BootDelay
, &bootdelay
,
2363 GCA_LogInfo
, &loginfo
,
2364 GCA_LogWarning
, &logwarn
,
2365 GCA_LogError
, &logerr
,
2366 GCA_LogFailure
, &logfail
,
2367 GCA_PopupDeviceNew
, &popupnew
,
2368 GCA_PopupDeviceGone
, &popupgone
,
2369 GCA_PopupDeviceDeath
, &popupdeath
,
2370 GCA_PopupCloseDelay
, &popupdelay
,
2371 GCA_PopupActivateWin
, &popupactivate
,
2372 GCA_PopupWinToFront
, &popuptofront
,
2373 GCA_InsertionSound
, &devdtxsoundfile
,
2374 GCA_RemovalSound
, &devremsoundfile
,
2375 GCA_AutoDisableLP
, &autodisablelp
,
2376 GCA_AutoDisableDead
, &autodisabledead
,
2377 GCA_PowerSaving
, &powersaving
,
2378 GCA_ForceSuspend
, &forcesuspend
,
2379 GCA_SuspendTimeout
, &suspendtimeout
,
2381 nnset(data
->cfgtaskpriobj
, MUIA_Numeric_Value
, subtaskpri
);
2382 nnset(data
->cfgbootdelayobj
, MUIA_Numeric_Value
, bootdelay
);
2383 nnset(data
->cfgloginfoobj
, MUIA_Selected
, loginfo
);
2384 nnset(data
->cfglogwarnobj
, MUIA_Selected
, logwarn
);
2385 nnset(data
->cfglogerrobj
, MUIA_Selected
, logerr
);
2386 nnset(data
->cfglogfailobj
, MUIA_Selected
, logfail
);
2387 nnset(data
->cfgpopupnewobj
, MUIA_Cycle_Active
, popupnew
);
2388 nnset(data
->cfgpopupgoneobj
, MUIA_Selected
, popupgone
);
2389 nnset(data
->cfgpopupdeathobj
, MUIA_Selected
, popupdeath
);
2390 nnset(data
->cfgpopupdelayobj
, MUIA_Numeric_Value
, popupdelay
);
2391 nnset(data
->cfgpopupactivateobj
, MUIA_Selected
, popupactivate
);
2392 nnset(data
->cfgpopuptofrontobj
, MUIA_Selected
, popuptofront
);
2393 nnset(data
->cfgdevdtxsoundobj
, MUIA_String_Contents
, devdtxsoundfile
);
2394 nnset(data
->cfgdevremsoundobj
, MUIA_String_Contents
, devremsoundfile
);
2395 nnset(data
->cfgautolpobj
, MUIA_Selected
, autodisablelp
);
2396 nnset(data
->cfgautodeadobj
, MUIA_Selected
, autodisabledead
);
2397 nnset(data
->cfgpowersavingobj
, MUIA_Selected
, powersaving
);
2398 nnset(data
->cfgforcesuspendobj
, MUIA_Selected
, forcesuspend
);
2399 nnset(data
->cfgsuspendtimeoutobj
, MUIA_Numeric_Value
, suspendtimeout
);
2404 Object
*MyTextObject(char *Text
,char *Help
)
2408 MUIA_ShortHelp
, Help
,
2410 MUIA_Background
, MUII_ButtonBack
,
2412 MUIA_InputMode
, MUIV_InputMode_RelVerify
,
2413 MUIA_Text_Contents
, Text
,
2419 Object
*MyTextObjectDisabled(char *Text
,char *Help
)
2423 MUIA_ShortHelp
, Help
,
2425 MUIA_Background
, MUII_ButtonBack
,
2427 MUIA_InputMode
, MUIV_InputMode_RelVerify
,
2428 MUIA_Text_Contents
, Text
,
2429 MUIA_Disabled
, TRUE
,
2435 /* /// "Action_OM_NEW()" */
2436 Object
* Action_OM_NEW(struct IClass
*cl
, Object
*obj
, Msg msg
)
2438 struct ActionData
*data
;
2441 IPTR subtaskpri
= 5;
2442 IPTR loginfo
= TRUE
;
2443 IPTR logwarn
= TRUE
;
2445 IPTR logfail
= TRUE
;
2447 IPTR popupgone
= FALSE
;
2448 IPTR popupdeath
= FALSE
;
2449 IPTR popupdelay
= 0;
2450 IPTR popupactivate
= FALSE
;
2451 IPTR popuptofront
= TRUE
;
2452 IPTR autodisablelp
= FALSE
;
2453 IPTR autodisabledead
= FALSE
;
2454 IPTR autorestartdead
= TRUE
;
2455 IPTR powersaving
= FALSE
;
2456 IPTR forcesuspend
= FALSE
;
2457 IPTR suspendtimeout
= 30;
2458 STRPTR devdtxsoundfile
= "";
2459 STRPTR devremsoundfile
= "";
2460 APTR stackcfg
= NULL
;
2463 struct DevListEntry
*dlnode
;
2465 mainpanels
[0] = _(MSG_MAINPANEL_GENERAL
);
2466 mainpanels
[1] = _(MSG_MAINPANEL_CONTROLLERS
);
2467 mainpanels
[2] = _(MSG_MAINPANEL_DEVICES
);
2468 mainpanels
[3] = _(MSG_MAINPANEL_CLASSES
);
2469 mainpanels
[4] = _(MSG_MAINPANEL_OPTIONS
);
2470 mainpanels
[5] = _(MSG_MAINPANEL_POPUPS
);
2471 mainpanels
[6] = _(MSG_MAINPANEL_CONFIG
);
2473 errlvlstrings
[0] = _(MSG_ERRLVL_ALL
);
2474 errlvlstrings
[1] = _(MSG_ERRLVL_WARNINGS
);
2475 errlvlstrings
[2] = _(MSG_ERRLVL_ERRORS
);
2476 errlvlstrings
[3] = _(MSG_ERRLVL_FAILURES
);
2478 popupnewdevicestrings
[0] = _(MSG_POPUP_NEVER
);
2479 popupnewdevicestrings
[1] = _(MSG_POPUP_ERROR
);
2480 popupnewdevicestrings
[2] = _(MSG_POPUP_UNKNOWN
);
2481 popupnewdevicestrings
[3] = _(MSG_POPUP_NOBINDING
);
2482 popupnewdevicestrings
[4] = _(MSG_POPUP_NOCONFIG
);
2483 popupnewdevicestrings
[5] = _(MSG_POPUP_CONFIGCLASS
);
2484 popupnewdevicestrings
[6] = _(MSG_POPUP_BINDING
);
2485 popupnewdevicestrings
[7] = _(MSG_POPUP_ALWAYS
);
2487 if(!(obj
= (Object
*) DoSuperMethodA(cl
, obj
, msg
)))
2490 data
= INST_DATA(cl
, obj
);
2491 data
->selfobj
= obj
;
2492 NewList(&data
->hwlist
);
2493 NewList(&data
->devlist
);
2494 NewList(&data
->clslist
);
2495 NewList(&data
->errlist
);
2496 NewList(&data
->prefslist
);
2498 data
->acthlnode
= NULL
;
2499 data
->errorlevel
= 0;
2500 data
->HardwareDisplayHook
.h_Data
= data
;
2501 data
->DeviceDisplayHook
.h_Data
= data
;
2502 data
->ClassDisplayHook
.h_Data
= data
;
2503 data
->ErrorDisplayHook
.h_Data
= data
;
2504 data
->IconDisplayHook
.h_Data
= data
;
2505 data
->PrefsDisplayHook
.h_Data
= data
;
2507 data
->HardwareDisplayHook
.h_Entry
= (APTR
) HardwareListDisplayHook
;
2508 data
->DeviceDisplayHook
.h_Entry
= (APTR
) DeviceListDisplayHook
;
2509 data
->ClassDisplayHook
.h_Entry
= (APTR
) ClassListDisplayHook
;
2510 data
->ErrorDisplayHook
.h_Entry
= (APTR
) ErrorListDisplayHook
;
2511 data
->IconDisplayHook
.h_Entry
= (APTR
) IconListDisplayHook
;
2512 data
->PrefsDisplayHook
.h_Entry
= (APTR
) PrefsListDisplayHook
;
2514 aimeemsg
= aimeelyrics
[(((IPTR
) aimeelyrics
) / 333) & 31];
2516 /* get current global config */
2517 psdGetAttrs(PGA_STACK
, NULL
, PA_GlobalConfig
, &stackcfg
, TAG_END
);
2520 psdGetAttrs(PGA_STACKCFG
, stackcfg
,
2521 GCA_SubTaskPri
, &subtaskpri
,
2522 GCA_BootDelay
, &bootdelay
,
2523 GCA_LogInfo
, &loginfo
,
2524 GCA_LogWarning
, &logwarn
,
2525 GCA_LogError
, &logerr
,
2526 GCA_LogFailure
, &logfail
,
2527 GCA_PopupDeviceNew
, &popupnew
,
2528 GCA_PopupDeviceGone
, &popupgone
,
2529 GCA_PopupDeviceDeath
, &popupdeath
,
2530 GCA_PopupCloseDelay
, &popupdelay
,
2531 GCA_PopupActivateWin
, &popupactivate
,
2532 GCA_PopupWinToFront
, &popuptofront
,
2533 GCA_InsertionSound
, &devdtxsoundfile
,
2534 GCA_RemovalSound
, &devremsoundfile
,
2535 GCA_AutoDisableLP
, &autodisablelp
,
2536 GCA_AutoDisableDead
, &autodisabledead
,
2537 GCA_AutoRestartDead
, &autorestartdead
,
2538 GCA_PowerSaving
, &powersaving
,
2539 GCA_ForceSuspend
, &forcesuspend
,
2540 GCA_SuspendTimeout
, &suspendtimeout
,
2545 data
->cfgcntobj
[0] = ScrollgroupObject
,
2546 MUIA_HelpNode
, "tridentgeneral",
2547 MUIA_Scrollgroup_Contents
, VirtgroupObject
,
2554 Child
, BodychunkObject
,
2555 MUIA_ShortHelp
, __(MSG_POSEIDON_SHORTHELP
),
2556 MUIA_Bitmap_SourceColors
, neptune8_colors
,
2557 MUIA_FixWidth
, NEPTUNE8_WIDTH
,
2558 MUIA_FixHeight
, NEPTUNE8_HEIGHT
,
2559 MUIA_Bitmap_Width
, NEPTUNE8_WIDTH
,
2560 MUIA_Bitmap_Height
, NEPTUNE8_HEIGHT
,
2561 MUIA_Bodychunk_Depth
, NEPTUNE8_DEPTH
,
2562 MUIA_Bodychunk_Body
, neptune8_body
,
2563 MUIA_Bodychunk_Compression
, NEPTUNE8_COMPRESSION
,
2564 MUIA_Bodychunk_Masking
, NEPTUNE8_MASKING
,
2565 MUIA_Bitmap_Transparent
, 0,
2566 MUIA_Bitmap_UseFriend
, TRUE
,
2567 MUIA_Bitmap_Precision
, PRECISION_ICON
,
2573 Child
, Label(__(MSG_PANEL_GENERAL_LABEL1
)),
2574 Child
, Label(__(MSG_PANEL_GENERAL_LABEL2
)),
2576 Child
, Label(__(MSG_PANEL_GENERAL_LABEL3
)),
2577 Child
, Label(__(MSG_PANEL_GENERAL_LABEL4
)),
2579 Child
, Label(__(MSG_PANEL_GENERAL_LABEL5
)),
2588 Child
, Label(aimeemsg
),
2596 /* Hardware panel */
2597 data
->cfgcntobj
[1] = VGroup
,
2598 MUIA_HelpNode
, "tridenthardware",
2599 Child
, Label(__(MSG_PANEL_HARDWARE_LABEL1
)),
2600 Child
, ListviewObject
,
2602 MUIA_ShortHelp
, __(MSG_PANEL_HARDWARE_CONTROLLER_HELP
),
2603 MUIA_Listview_List
, data
->hwlistobj
=
2604 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
),
2606 Child
, data
->hwdevgrpobj
= HGroup
,
2607 MUIA_Disabled
, TRUE
,
2608 Child
, Label(__(MSG_PANEL_HARDWARE_LABEL2
)),
2609 Child
, data
->hwdevaslobj
= PopaslObject
,
2611 MUIA_ShortHelp
, __(MSG_PANEL_HARDWARE_DEVICE_HELP
),
2612 MUIA_Popstring_String
, data
->hwdevobj
= StringObject
,
2615 MUIA_String_AdvanceOnCR
, TRUE
,
2617 MUIA_Popstring_Button
, PopButton(MUII_PopFile
),
2618 ASLFR_TitleText
, __(MSG_PANEL_HARDWARE_SELECT
),
2620 Child
, Label(__(MSG_PANEL_HARDWARE_UNIT
)),
2621 Child
, data
->hwunitobj
= StringObject
,
2622 MUIA_ShortHelp
, __(MSG_PANEL_HARDWARE_UNIT_HELP
),
2624 MUIA_HorizWeight
, 10,
2626 MUIA_String_AdvanceOnCR
, TRUE
,
2627 MUIA_String_Integer
, 0,
2628 MUIA_String_Accept
, "0123456789",
2632 MUIA_Group_SameWidth
, TRUE
,
2633 Child
, data
->hwnewobj
= MyTextObject(_(MSG_PANEL_HARDWARE_DRIVER_NEW
),_(MSG_PANEL_HARDWARE_DRIVER_NEW_HELP
)),
2634 Child
, data
->hwcopyobj
= MyTextObject(_(MSG_PANEL_HARDWARE_DRIVER_COPY
),_(MSG_PANEL_HARDWARE_DRIVER_COPY_HELP
)),
2635 Child
, data
->hwdelobj
= MyTextObject(_(MSG_PANEL_HARDWARE_DRIVER_DELETE
),_(MSG_PANEL_HARDWARE_DRIVER_DELETE_HELP
)),
2636 Child
, data
->hwonlineobj
= MyTextObject(_(MSG_PANEL_HARDWARE_DRIVER_ONLINE
),_(MSG_PANEL_HARDWARE_DRIVER_ONLINE_HELP
)),
2637 Child
, data
->hwofflineobj
= MyTextObject(_(MSG_PANEL_HARDWARE_DRIVER_OFFLINE
),_(MSG_PANEL_HARDWARE_DRIVER_OFFLINE_HELP
)),
2638 Child
, data
->hwinfoobj
= MyTextObject(_(MSG_PANEL_HARDWARE_DRIVER_INFO
),_(MSG_PANEL_HARDWARE_DRIVER_INFO_HELP
)),
2643 data
->cfgcntobj
[2] = VGroup
,
2644 MUIA_HelpNode
, "tridentdevices",
2645 Child
, Label(__(MSG_PANEL_DEVICES_LABEL
)),
2646 Child
, ListviewObject
,
2648 MUIA_Listview_List
, data
->devlistobj
=
2649 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
),
2652 MUIA_Group_SameWidth
, TRUE
,
2653 Child
, data
->devbindobj
= MyTextObject(_(MSG_PANEL_DEVICES_SCAN
),_(MSG_PANEL_DEVICES_SCAN_HELP
)),
2654 Child
, data
->devunbindobj
= MyTextObjectDisabled(_(MSG_PANEL_DEVICES_UNBIND
),_(MSG_PANEL_DEVICES_UNBIND_HELP
)),
2655 Child
, data
->devinfoobj
= MyTextObject(_(MSG_PANEL_DEVICES_INFO
),_(MSG_PANEL_DEVICES_INFO_HELP
)),
2656 Child
, data
->devcfgobj
= MyTextObjectDisabled(_(MSG_PANEL_DEVICES_SETTINGS
),_(MSG_PANEL_DEVICES_SETTINGS_HELP
)),
2657 Child
, data
->devsuspendobj
= MyTextObjectDisabled(_(MSG_PANEL_DEVICES_SUSPEND
),_(MSG_PANEL_DEVICES_SUSPEND_HELP
)),
2658 Child
, data
->devresumeobj
= MyTextObjectDisabled(_(MSG_PANEL_DEVICES_RESUME
),_(MSG_PANEL_DEVICES_RESUME_HELP
)),
2659 Child
, data
->devpowercycleobj
= MyTextObjectDisabled(_(MSG_PANEL_DEVICES_POWERCYCLE
),_(MSG_PANEL_DEVICES_POWERCYCLE_HELP
)),
2660 Child
, data
->devdisableobj
= MyTextObjectDisabled(_(MSG_PANEL_DEVICES_DISABLE
),_(MSG_PANEL_DEVICES_DISABLE_HELP
)),
2665 data
->cfgcntobj
[3] = VGroup
,
2666 MUIA_HelpNode
, "tridentclasses",
2667 Child
, Label(__(MSG_PANEL_CLASSES
)),
2668 Child
, data
->clslistobj
= ListviewObject
,
2670 MUIA_Listview_List
, ListObject
,
2671 MUIA_ShortHelp
, __(MSG_PANEL_CLASSES_HELP
),
2673 MUIA_List_Format
, "BAR,BAR,",
2674 MUIA_List_Title
, TRUE
,
2675 MUIA_List_DisplayHook
, &data
->ClassDisplayHook
,
2679 Child
, Label(__(MSG_PANEL_CLASSES_LABEL
)),
2680 Child
, PopaslObject
,
2682 MUIA_ShortHelp
, __(MSG_PANEL_CLASSES_LABEL_HELP
),
2683 MUIA_Popstring_String
, data
->clsnameobj
= StringObject
,
2686 MUIA_String_AdvanceOnCR
, TRUE
,
2687 MUIA_String_Contents
, CLASSPATH
"/",
2689 MUIA_Popstring_Button
, PopButton(MUII_PopFile
),
2690 ASLFR_TitleText
, __(MSG_PANEL_CLASSES_SELECT
),
2694 MUIA_Group_SameWidth
, TRUE
,
2695 Child
, data
->clsaddobj
= MyTextObject(_(MSG_PANEL_CLASSES_ADD
),_(MSG_PANEL_CLASSES_ADD_HELP
)),
2696 Child
, data
->clsremobj
= MyTextObjectDisabled(_(MSG_PANEL_CLASSES_REMOVE
),_(MSG_PANEL_CLASSES_REMOVE_HELP
)),
2697 Child
, data
->clscfgobj
= MyTextObjectDisabled(_(MSG_PANEL_CLASSES_CONFIG
),_(MSG_PANEL_CLASSES_CONFIG_HELP
)),
2698 Child
, data
->clsscanobj
= MyTextObject(_(MSG_PANEL_CLASSES_SCAN
),_(MSG_PANEL_CLASSES_SCAN_HELP
)),
2703 data
->cfgcntobj
[4] = VGroup
,
2704 MUIA_HelpNode
, "tridentoptions",
2705 Child
, Label(__(MSG_PANEL_OPTIONS
)),
2707 Child
, VGroup
, GroupFrameT(__(MSG_PANEL_OPTIONS_STACK
)),
2710 Child
, Label(__(MSG_PANEL_OPTIONS_PRIORITY
)),
2711 Child
, data
->cfgtaskpriobj
= SliderObject
, SliderFrame
,
2712 MUIA_ShortHelp
, __(MSG_PANEL_OPTIONS_PRIORITY_HELP
),
2714 MUIA_Numeric_Min
, 0,
2715 MUIA_Numeric_Max
, 127,
2716 MUIA_Numeric_Value
, subtaskpri
,
2718 Child
, Label(__(MSG_PANEL_OPTIONS_BOOT
)),
2719 Child
, data
->cfgbootdelayobj
= SliderObject
, SliderFrame
,
2720 MUIA_ShortHelp
, __(MSG_PANEL_OPTIONS_BOOT_HELP
),
2722 MUIA_Numeric_Min
, 0,
2723 MUIA_Numeric_Max
, 15,
2724 MUIA_Numeric_Value
, bootdelay
,
2725 MUIA_Numeric_Format
,__(MSG_PANEL_OPTIONS_BOOT_FORMAT
),
2731 Child
, Label(__(MSG_PANEL_OPTIONS_DISABLELOW
)),
2733 Child
, data
->cfgautolpobj
= ImageObject
, ImageButtonFrame
,
2734 MUIA_ShortHelp
, __(MSG_PANEL_OPTIONS_DISABLELOW_HELP
),
2735 MUIA_Background
, MUII_ButtonBack
,
2737 MUIA_InputMode
, MUIV_InputMode_Toggle
,
2738 MUIA_Image_Spec
, MUII_CheckMark
,
2739 MUIA_Image_FreeVert
, TRUE
,
2740 MUIA_Selected
, autodisablelp
,
2741 MUIA_ShowSelState
, FALSE
,
2745 Child
, Label(__(MSG_PANEL_OPTIONS_DISABLEDEAD
)),
2747 Child
, data
->cfgautodeadobj
= ImageObject
, ImageButtonFrame
,
2748 MUIA_ShortHelp
,__(MSG_PANEL_OPTIONS_DISABLEDEAD_HELP
),
2749 MUIA_Background
, MUII_ButtonBack
,
2751 MUIA_InputMode
, MUIV_InputMode_Toggle
,
2752 MUIA_Image_Spec
, MUII_CheckMark
,
2753 MUIA_Image_FreeVert
, TRUE
,
2754 MUIA_Selected
, autodisabledead
,
2755 MUIA_Disabled
, autorestartdead
,
2756 MUIA_ShowSelState
, FALSE
,
2760 Child
, Label(__(MSG_PANEL_OPTIONS_POWERCYCLE
)),
2762 Child
, data
->cfgautopcobj
= ImageObject
, ImageButtonFrame
,
2763 MUIA_ShortHelp
,__(MSG_PANEL_OPTIONS_POWERCYCLE_HELP
),
2764 MUIA_Background
, MUII_ButtonBack
,
2766 MUIA_InputMode
, MUIV_InputMode_Toggle
,
2767 MUIA_Image_Spec
, MUII_CheckMark
,
2768 MUIA_Image_FreeVert
, TRUE
,
2769 MUIA_Selected
, autorestartdead
,
2770 MUIA_ShowSelState
, FALSE
,
2774 Child
, Label(__(MSG_PANEL_OPTIONS_POWERSAVE
)),
2776 Child
, data
->cfgpowersavingobj
= ImageObject
, ImageButtonFrame
,
2777 MUIA_ShortHelp
, __(MSG_PANEL_OPTIONS_POWERSAVE_HELP
),
2778 MUIA_Background
, MUII_ButtonBack
,
2780 MUIA_InputMode
, MUIV_InputMode_Toggle
,
2781 MUIA_Image_Spec
, MUII_CheckMark
,
2782 MUIA_Image_FreeVert
, TRUE
,
2783 MUIA_Selected
, powersaving
,
2784 MUIA_ShowSelState
, FALSE
,
2788 Child
, Label(__(MSG_PANEL_OPTIONS_FORCESUSPEND
)),
2790 Child
, data
->cfgforcesuspendobj
= ImageObject
, ImageButtonFrame
,
2791 MUIA_ShortHelp
, __(MSG_PANEL_OPTIONS_FORCESUSPEND_HELP
),
2792 MUIA_Background
, MUII_ButtonBack
,
2794 MUIA_InputMode
, MUIV_InputMode_Toggle
,
2795 MUIA_Image_Spec
, MUII_CheckMark
,
2796 MUIA_Image_FreeVert
, TRUE
,
2797 MUIA_Selected
, forcesuspend
,
2798 MUIA_ShowSelState
, FALSE
,
2802 Child
, Label(__(MSG_PANEL_OPTIONS_INACTIVITY
)),
2803 Child
, data
->cfgsuspendtimeoutobj
= SliderObject
, SliderFrame
,
2804 MUIA_ShortHelp
, __(MSG_PANEL_OPTIONS_INACTIVITY_HELP
),
2806 MUIA_Numeric_Min
, 5,
2807 MUIA_Numeric_Max
, 600,
2808 MUIA_Numeric_Value
, suspendtimeout
,
2809 MUIA_Numeric_Format
, __(MSG_PANEL_OPTIONS_INACTIVITY_FORMAT
),
2815 Child
, VGroup
, GroupFrameT(__(MSG_PANEL_OPTIONS_LOGGING
)),
2822 Child
, Label(__(MSG_PANEL_OPTIONS_LOGGING_LABEL
)),
2824 Child
, data
->cfgloginfoobj
= ImageObject
, ImageButtonFrame
,
2825 MUIA_ShortHelp
,__(MSG_PANEL_OPTIONS_LOGGING_LABEL_HELP
),
2826 MUIA_Background
, MUII_ButtonBack
,
2828 MUIA_InputMode
, MUIV_InputMode_Toggle
,
2829 MUIA_Image_Spec
, MUII_CheckMark
,
2830 MUIA_Image_FreeVert
, TRUE
,
2831 MUIA_Selected
, loginfo
,
2832 MUIA_ShowSelState
, FALSE
,
2836 Child
, Label(__(MSG_PANEL_OPTIONS_LOGGING_WARN
)),
2838 Child
, data
->cfglogwarnobj
= ImageObject
, ImageButtonFrame
,
2839 MUIA_ShortHelp
, __(MSG_PANEL_OPTIONS_LOGGING_WARN_HELP
),
2840 MUIA_Background
, MUII_ButtonBack
,
2842 MUIA_InputMode
, MUIV_InputMode_Toggle
,
2843 MUIA_Image_Spec
, MUII_CheckMark
,
2844 MUIA_Image_FreeVert
, TRUE
,
2845 MUIA_Selected
, logwarn
,
2846 MUIA_ShowSelState
, FALSE
,
2850 Child
, Label(__(MSG_PANEL_OPTIONS_LOGGING_ERR
)),
2852 Child
, data
->cfglogerrobj
= ImageObject
, ImageButtonFrame
,
2853 MUIA_ShortHelp
, __(MSG_PANEL_OPTIONS_LOGGING_ERR_HELP
),
2854 MUIA_Background
, MUII_ButtonBack
,
2856 MUIA_InputMode
, MUIV_InputMode_Toggle
,
2857 MUIA_Image_Spec
, MUII_CheckMark
,
2858 MUIA_Image_FreeVert
, TRUE
,
2859 MUIA_Selected
, logerr
,
2860 MUIA_ShowSelState
, FALSE
,
2864 Child
, Label(__(MSG_PANEL_OPTIONS_LOGGING_FAIL
)),
2866 Child
, data
->cfglogfailobj
= ImageObject
, ImageButtonFrame
,
2867 MUIA_ShortHelp
, __(MSG_PANEL_OPTIONS_LOGGING_FAIL_HELP
),
2868 MUIA_Background
, MUII_ButtonBack
,
2870 MUIA_InputMode
, MUIV_InputMode_Toggle
,
2871 MUIA_Image_Spec
, MUII_CheckMark
,
2872 MUIA_Image_FreeVert
, TRUE
,
2873 MUIA_Selected
, logfail
,
2874 MUIA_ShowSelState
, FALSE
,
2884 Child
, Label(__(MSG_PANEL_OPTIONS_MEMORY
)),
2885 Child
, data
->mempoolobj
= TextObject
,
2886 MUIA_Text_Contents
, "?",
2893 data
->cfgcntobj
[5] = VGroup
,
2894 MUIA_HelpNode
, "tridentpopups",
2895 Child
, Label(__(MSG_PANEL_POPO
)),
2897 Child
, VGroup
, GroupFrameT(__(MSG_PANEL_POPO_LABEL
)),
2900 Child
, Label(__(MSG_PANEL_POPO_CONNECT
)),
2902 Child
, data
->cfgpopupnewobj
= CycleObject
,
2903 MUIA_ShortHelp
, __(MSG_PANEL_POPO_CONNECT_HELP
),
2905 MUIA_Cycle_Entries
, popupnewdevicestrings
,
2906 MUIA_Cycle_Active
, popupnew
,
2909 Child
, Label(__(MSG_PANEL_POPO_DISCONNECT
)),
2911 Child
, data
->cfgpopupgoneobj
= ImageObject
, ImageButtonFrame
,
2912 MUIA_ShortHelp
, _(MSG_PANEL_POPO_DISCONNECT_HELP
),
2913 MUIA_Background
, MUII_ButtonBack
,
2915 MUIA_InputMode
, MUIV_InputMode_Toggle
,
2916 MUIA_Image_Spec
, MUII_CheckMark
,
2917 MUIA_Image_FreeVert
, TRUE
,
2918 MUIA_Selected
, popupgone
,
2919 MUIA_ShowSelState
, FALSE
,
2922 Child
, Label(__(MSG_PANEL_POPO_DEATH
)),
2923 Child
, data
->cfgpopupdeathobj
= ImageObject
, ImageButtonFrame
,
2924 MUIA_ShortHelp
, __(MSG_PANEL_POPO_DEATH_HELP
),
2925 MUIA_Background
, MUII_ButtonBack
,
2927 MUIA_InputMode
, MUIV_InputMode_Toggle
,
2928 MUIA_Image_Spec
, MUII_CheckMark
,
2929 MUIA_Image_FreeVert
, TRUE
,
2930 MUIA_Selected
, popupdeath
,
2931 MUIA_ShowSelState
, FALSE
,
2934 Child
, Label(__(MSG_PANEL_POPO_DELAY
)),
2935 Child
, data
->cfgpopupdelayobj
= SliderObject
, SliderFrame
,
2936 MUIA_ShortHelp
, __(MSG_PANEL_POPO_DELAY_HELP
),
2938 MUIA_Numeric_Min
, 0,
2939 MUIA_Numeric_Max
, 25,
2940 MUIA_Numeric_Value
, popupdelay
,
2941 MUIA_Numeric_Format
, __(MSG_PANEL_POPO_DELAY_FORMAT
),
2943 Child
, Label(__(MSG_PANEL_POPO_ACTIVATE
)),
2945 Child
, data
->cfgpopupactivateobj
= ImageObject
, ImageButtonFrame
,
2946 MUIA_ShortHelp
, __(MSG_PANEL_POPO_ACTIVATE_HELP
),
2947 MUIA_Background
, MUII_ButtonBack
,
2949 MUIA_InputMode
, MUIV_InputMode_Toggle
,
2950 MUIA_Image_Spec
, MUII_CheckMark
,
2951 MUIA_Image_FreeVert
, TRUE
,
2952 MUIA_Selected
, popupactivate
,
2953 MUIA_ShowSelState
, FALSE
,
2956 Child
, Label(__(MSG_PANEL_POPO_TOFRONT
)),
2957 Child
, data
->cfgpopuptofrontobj
= ImageObject
, ImageButtonFrame
,
2958 MUIA_ShortHelp
, __(MSG_PANEL_POPO_TOFRONT_HELP
),
2959 MUIA_Background
, MUII_ButtonBack
,
2961 MUIA_InputMode
, MUIV_InputMode_Toggle
,
2962 MUIA_Image_Spec
, MUII_CheckMark
,
2963 MUIA_Image_FreeVert
, TRUE
,
2964 MUIA_Selected
, popuptofront
,
2965 MUIA_ShowSelState
, FALSE
,
2968 Child
, Label(__(MSG_PANEL_POPO_CONSOUND
)),
2969 Child
, PopaslObject
,
2971 MUIA_ShortHelp
, __(MSG_PANEL_POPO_CONSOUND_HELP
),
2972 MUIA_Popstring_String
, data
->cfgdevdtxsoundobj
= StringObject
,
2975 MUIA_String_AdvanceOnCR
, TRUE
,
2976 MUIA_String_Contents
, devdtxsoundfile
,
2978 MUIA_Popstring_Button
, PopButton(MUII_PopFile
),
2979 ASLFR_TitleText
, __(MSG_PANEL_POPO_CONSOUND_SELECT
),
2981 Child
, Label(__(MSG_PANEL_POPO_DISCONSOUND
)),
2982 Child
, PopaslObject
,
2984 MUIA_ShortHelp
, __(MSG_PANEL_POPO_DISCONSOUND_HELP
),
2985 MUIA_Popstring_String
, data
->cfgdevremsoundobj
= StringObject
,
2988 MUIA_String_AdvanceOnCR
, TRUE
,
2989 MUIA_String_Contents
, devremsoundfile
,
2991 MUIA_Popstring_Button
, PopButton(MUII_PopFile
),
2992 ASLFR_TitleText
, __(MSG_PANEL_POPO_DISCONSOUND_SELECT
),
3000 /* Configuration panel */
3001 data
->cfgcntobj
[6] = VGroup
,
3002 MUIA_HelpNode
, "tridentconfig",
3003 Child
, Label(__(MSG_PANEL_CONFIG
)),
3004 Child
, data
->prefslistobj
= ListviewObject
,
3006 MUIA_ShortHelp
, __(MSG_PANEL_CONFIG_HELP
),
3007 MUIA_Listview_DragType
, MUIV_Listview_DragType_Immediate
,
3009 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
),
3012 MUIA_Group_SameWidth
, TRUE
,
3013 Child
, data
->prefssaveasobj
= MyTextObject(_(MSG_PANEL_CONFIG_SAVEAS
),_(MSG_PANEL_CONFIG_SAVEAS_HELP
)),
3014 Child
, data
->prefsexportobj
= MyTextObjectDisabled(_(MSG_PANEL_CONFIG_EXPORT
),_(MSG_PANEL_CONFIG_EXPORT_HELP
)),
3015 Child
, data
->prefsimportobj
= MyTextObject(_(MSG_PANEL_CONFIG_IMPORT
),_(MSG_PANEL_CONFIG_IMPORT_HELP
)),
3016 Child
, data
->prefsremoveobj
= MyTextObjectDisabled(_(MSG_PANEL_CONFIG_REMOVE
),_(MSG_PANEL_CONFIG_REMOVE_HELP
)),
3020 data
->mainobj
= VGroup
,
3022 Child
, ListviewObject
,
3024 MUIA_ShowMe
, !registermode
,
3025 MUIA_Listview_MultiSelect
, MUIV_Listview_MultiSelect_None
,
3026 MUIA_Listview_List
, data
->cfgpagelv
=
3027 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
),
3031 /*MUIA_Background, MUII_GroupBack,*/
3032 Child
, data
->cfgpagegrp
= (registermode
?
3033 (RegisterGroup(mainpanels
),
3035 MUIA_Register_Frame
, TRUE
,
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],
3045 MUIA_Group_PageMode
, TRUE
,
3046 MUIA_Group_ActivePage
, MUIV_Group_ActivePage_First
,
3047 Child
, data
->cfgcntobj
[0],
3048 Child
, data
->cfgcntobj
[1],
3049 Child
, data
->cfgcntobj
[2],
3050 Child
, data
->cfgcntobj
[3],
3051 Child
, data
->cfgcntobj
[4],
3052 Child
, data
->cfgcntobj
[5],
3053 Child
, data
->cfgcntobj
[6],
3057 Child
, BalanceObject
,
3058 MUIA_ObjectID
, MAKE_ID('I','L','B','P'),
3060 Child
, VGroup
, GroupFrameT(__(MSG_PANEL_CONFIG_MSGLOG
)),
3061 MUIA_VertWeight
, 20,
3063 Child
, Label(__(MSG_PANEL_CONFIG_INFLVL
)),
3064 Child
, data
->errlvlobj
= CycleObject
,
3066 MUIA_ShortHelp
, __(MSG_PANEL_CONFIG_INFLVL_HELP
),
3067 MUIA_Cycle_Entries
, errlvlstrings
,
3071 MUIA_Group_SameWidth
, TRUE
,
3072 Child
, data
->errsaveobj
= MyTextObject(_(MSG_PANEL_CONFIG_LOGSAVE
),_(MSG_PANEL_CONFIG_LOGSAVE_HELP
)),
3073 Child
, data
->errflushobj
= MyTextObject(_(MSG_PANEL_CONFIG_LOGFLUSH
),_(MSG_PANEL_CONFIG_LOGFLUSH_HELP
)),
3076 Child
, data
->errlistobj
= ListviewObject
,
3078 MUIA_Listview_Input
, FALSE
,
3079 MUIA_Listview_List
, ListObject
,
3080 MUIA_ShortHelp
, __(MSG_PANEL_CONFIG_LOGHELP
),
3082 MUIA_List_Format
, "BAR,BAR,BAR,",
3083 MUIA_List_DisplayHook
, &data
->ErrorDisplayHook
,
3088 MUIA_Group_SameWidth
, TRUE
,
3089 Child
, data
->onlineobj
= MyTextObject( _(MSG_PANEL_CONFIG_ALLONLINE
),_(MSG_PANEL_CONFIG_ALLONLINE_HELP
)),
3090 Child
, data
->offlineobj
= MyTextObject(_(MSG_PANEL_CONFIG_ALLOFFLINE
),_(MSG_PANEL_CONFIG_ALLOFFLINE_HELP
)),
3091 Child
, data
->restartobj
= MyTextObject(_(MSG_PANEL_CONFIG_RESTART
),_(MSG_PANEL_CONFIG_RESTART_HELP
)),
3093 Child
, data
->saveobj
= MyTextObject(_(MSG_PANEL_CONFIG_SAVE
),_(MSG_PANEL_CONFIG_SAVE_HELP
)),
3094 Child
, data
->useobj
= MyTextObject(_(MSG_PANEL_CONFIG_USE
),_(MSG_PANEL_CONFIG_USE_HELP
)),
3098 DoMethod(obj
, OM_ADDMEMBER
, data
->mainobj
);
3100 DoMethod(data
->cfgpagelv
, MUIM_Notify
, MUIA_List_Active
, MUIV_EveryTime
,
3101 data
->cfgpagegrp
, 3, MUIM_Set
, MUIA_Group_ActivePage
, MUIV_TriggerValue
);
3102 DoMethod(data
->cfgpagelv
, MUIM_Notify
, MUIA_List_Active
, MUIV_EveryTime
,
3103 obj
, 1, MUIM_Action_Info_MemPool
);
3105 DoMethod(data
->hwnewobj
, MUIM_Notify
, MUIA_Pressed
, FALSE
,
3106 obj
, 1, MUIM_Action_HW_New
);
3107 DoMethod(data
->hwcopyobj
, MUIM_Notify
, MUIA_Pressed
, FALSE
,
3108 obj
, 1, MUIM_Action_HW_Copy
);
3109 DoMethod(data
->hwdelobj
, MUIM_Notify
, MUIA_Pressed
, FALSE
,
3110 obj
, 1, MUIM_Action_HW_Del
);
3111 DoMethod(data
->hwinfoobj
, MUIM_Notify
, MUIA_Pressed
, FALSE
,
3112 obj
, 1, MUIM_Action_HW_Info
);
3113 DoMethod(data
->hwonlineobj
, MUIM_Notify
, MUIA_Pressed
, FALSE
,
3114 obj
, 1, MUIM_Action_HW_Online
);
3115 DoMethod(data
->hwofflineobj
, MUIM_Notify
, MUIA_Pressed
, FALSE
,
3116 obj
, 1, MUIM_Action_HW_Offline
);
3118 DoMethod(data
->hwlistobj
, MUIM_Notify
, MUIA_Listview_DoubleClick
, TRUE
,
3119 obj
, 1, MUIM_Action_HW_Info
);
3120 DoMethod(data
->hwlistobj
, MUIM_Notify
, MUIA_List_Active
, MUIV_EveryTime
,
3121 obj
, 1, MUIM_Action_HW_Activate
);
3122 DoMethod(data
->hwdevobj
, MUIM_Notify
, MUIA_String_Acknowledge
, MUIV_EveryTime
,
3123 obj
, 2, MUIM_Action_HW_Update
, NULL
);
3124 DoMethod(data
->hwunitobj
, MUIM_Notify
, MUIA_String_Acknowledge
, MUIV_EveryTime
,
3125 obj
, 2, MUIM_Action_HW_Update
, NULL
);
3127 DoMethod(data
->errsaveobj
, MUIM_Notify
, MUIA_Pressed
, FALSE
,
3128 obj
, 1, MUIM_Action_SaveErrors
);
3129 DoMethod(data
->errflushobj
, MUIM_Notify
, MUIA_Pressed
, FALSE
,
3130 obj
, 1, MUIM_Action_FlushErrors
);
3131 DoMethod(data
->errlvlobj
, MUIM_Notify
, MUIA_Cycle_Active
, MUIV_EveryTime
,
3132 obj
, 1, MUIM_Action_ChgErrLevel
);
3134 DoMethod(data
->onlineobj
, MUIM_Notify
, MUIA_Pressed
, FALSE
,
3135 obj
, 1, MUIM_Action_Online
);
3136 DoMethod(data
->offlineobj
, MUIM_Notify
, MUIA_Pressed
, FALSE
,
3137 obj
, 1, MUIM_Action_Offline
);
3138 DoMethod(data
->restartobj
, MUIM_Notify
, MUIA_Pressed
, FALSE
,
3139 obj
, 1, MUIM_Action_Restart
);
3141 DoMethod(data
->saveobj
, MUIM_Notify
, MUIA_Pressed
, FALSE
,
3142 obj
, 1, MUIM_Action_SaveQuit
);
3143 DoMethod(data
->useobj
, MUIM_Notify
, MUIA_Pressed
, FALSE
,
3144 obj
, 1, MUIM_Action_UseQuit
);
3146 DoMethod(data
->devlistobj
, MUIM_Notify
, MUIA_List_Active
, MUIV_EveryTime
,
3147 obj
, 1, MUIM_Action_Dev_Activate
);
3148 DoMethod(data
->devbindobj
, MUIM_Notify
, MUIA_Pressed
, FALSE
,
3149 obj
, 1, MUIM_Action_Dev_Bind
);
3150 DoMethod(data
->devinfoobj
, MUIM_Notify
, MUIA_Pressed
, FALSE
,
3151 obj
, 1, MUIM_Action_Dev_Info
);
3152 DoMethod(data
->devunbindobj
, MUIM_Notify
, MUIA_Pressed
, FALSE
,
3153 obj
, 1, MUIM_Action_Dev_Unbind
);
3154 DoMethod(data
->devsuspendobj
, MUIM_Notify
, MUIA_Pressed
, FALSE
,
3155 obj
, 1, MUIM_Action_Dev_Suspend
);
3156 DoMethod(data
->devresumeobj
, MUIM_Notify
, MUIA_Pressed
, FALSE
,
3157 obj
, 1, MUIM_Action_Dev_Resume
);
3158 DoMethod(data
->devpowercycleobj
, MUIM_Notify
, MUIA_Pressed
, FALSE
,
3159 obj
, 1, MUIM_Action_Dev_PowerCycle
);
3160 DoMethod(data
->devdisableobj
, MUIM_Notify
, MUIA_Pressed
, FALSE
,
3161 obj
, 1, MUIM_Action_Dev_Disable
);
3162 DoMethod(data
->devlistobj
, MUIM_Notify
, MUIA_Listview_DoubleClick
, TRUE
,
3163 obj
, 1, MUIM_Action_Dev_Info
);
3164 DoMethod(data
->devlistobj
, MUIM_Notify
, MUIA_ContextMenuTrigger
, MUIV_EveryTime
,
3165 obj
, 2, MUIM_Action_Dev_ForceBind
, MUIV_TriggerValue
);
3167 DoMethod(data
->devcfgobj
, MUIM_Notify
, MUIA_Pressed
, FALSE
,
3168 obj
, 1, MUIM_Action_Dev_Configure
);
3170 DoMethod(data
->clslistobj
, MUIM_Notify
, MUIA_List_Active
, MUIV_EveryTime
,
3171 obj
, 1, MUIM_Action_Cls_Activate
);
3172 DoMethod(data
->clsaddobj
, MUIM_Notify
, MUIA_Pressed
, FALSE
,
3173 obj
, 1, MUIM_Action_Cls_Add
);
3174 DoMethod(data
->clsnameobj
, MUIM_Notify
, MUIA_String_Acknowledge
, MUIV_EveryTime
,
3175 obj
, 1, MUIM_Action_Cls_Add
);
3176 DoMethod(data
->clsremobj
, MUIM_Notify
, MUIA_Pressed
, FALSE
,
3177 obj
, 1, MUIM_Action_Cls_Remove
);
3178 DoMethod(data
->clscfgobj
, MUIM_Notify
, MUIA_Pressed
, FALSE
,
3179 obj
, 1, MUIM_Action_Cls_Configure
);
3180 DoMethod(data
->clsscanobj
, MUIM_Notify
, MUIA_Pressed
, FALSE
,
3181 obj
, 1, MUIM_Action_Cls_Scan
);
3182 DoMethod(data
->clslistobj
, MUIM_Notify
, MUIA_Listview_DoubleClick
, TRUE
,
3183 obj
, 1, MUIM_Action_Cls_Configure
);
3185 DoMethod(data
->cfgtaskpriobj
, MUIM_Notify
, MUIA_Numeric_Value
, MUIV_EveryTime
,
3186 obj
, 1, MUIM_Action_Cfg_Changed
);
3187 DoMethod(data
->cfgbootdelayobj
, MUIM_Notify
, MUIA_Numeric_Value
, MUIV_EveryTime
,
3188 obj
, 1, MUIM_Action_Cfg_Changed
);
3189 DoMethod(data
->cfgloginfoobj
, MUIM_Notify
, MUIA_Selected
, MUIV_EveryTime
,
3190 obj
, 1, MUIM_Action_Cfg_Changed
);
3191 DoMethod(data
->cfglogwarnobj
, MUIM_Notify
, MUIA_Selected
, MUIV_EveryTime
,
3192 obj
, 1, MUIM_Action_Cfg_Changed
);
3193 DoMethod(data
->cfglogerrobj
, MUIM_Notify
, MUIA_Selected
, MUIV_EveryTime
,
3194 obj
, 1, MUIM_Action_Cfg_Changed
);
3195 DoMethod(data
->cfglogfailobj
, MUIM_Notify
, MUIA_Selected
, MUIV_EveryTime
,
3196 obj
, 1, MUIM_Action_Cfg_Changed
);
3198 DoMethod(data
->cfgpopupnewobj
, MUIM_Notify
, MUIA_Cycle_Active
, MUIV_EveryTime
,
3199 obj
, 1, MUIM_Action_Cfg_Changed
);
3200 DoMethod(data
->cfgpopupgoneobj
, MUIM_Notify
, MUIA_Selected
, MUIV_EveryTime
,
3201 obj
, 1, MUIM_Action_Cfg_Changed
);
3202 DoMethod(data
->cfgpopupdeathobj
, MUIM_Notify
, MUIA_Selected
, MUIV_EveryTime
,
3203 obj
, 1, MUIM_Action_Cfg_Changed
);
3204 DoMethod(data
->cfgpopupdelayobj
, MUIM_Notify
, MUIA_Numeric_Value
, MUIV_EveryTime
,
3205 obj
, 1, MUIM_Action_Cfg_Changed
);
3206 DoMethod(data
->cfgpopupactivateobj
, MUIM_Notify
, MUIA_Selected
, MUIV_EveryTime
,
3207 obj
, 1, MUIM_Action_Cfg_Changed
);
3208 DoMethod(data
->cfgpopuptofrontobj
, MUIM_Notify
, MUIA_Selected
, MUIV_EveryTime
,
3209 obj
, 1, MUIM_Action_Cfg_Changed
);
3210 DoMethod(data
->cfgdevdtxsoundobj
, MUIM_Notify
, MUIA_String_Acknowledge
, MUIV_EveryTime
,
3211 obj
, 1, MUIM_Action_Cfg_Snd_Changed
);
3212 DoMethod(data
->cfgdevremsoundobj
, MUIM_Notify
, MUIA_String_Acknowledge
, MUIV_EveryTime
,
3213 obj
, 1, MUIM_Action_Cfg_Snd_Changed
);
3215 DoMethod(data
->cfgautolpobj
, MUIM_Notify
, MUIA_Selected
, MUIV_EveryTime
,
3216 obj
, 1, MUIM_Action_Cfg_Changed
);
3217 DoMethod(data
->cfgautodeadobj
, MUIM_Notify
, MUIA_Selected
, MUIV_EveryTime
,
3218 obj
, 1, MUIM_Action_Cfg_Changed
);
3219 DoMethod(data
->cfgautopcobj
, MUIM_Notify
, MUIA_Selected
, MUIV_EveryTime
,
3220 obj
, 1, MUIM_Action_Cfg_Changed
);
3222 DoMethod(data
->cfgpowersavingobj
, MUIM_Notify
, MUIA_Selected
, MUIV_EveryTime
,
3223 obj
, 1, MUIM_Action_Cfg_Changed
);
3224 DoMethod(data
->cfgforcesuspendobj
, MUIM_Notify
, MUIA_Selected
, MUIV_EveryTime
,
3225 obj
, 1, MUIM_Action_Cfg_Changed
);
3226 DoMethod(data
->cfgsuspendtimeoutobj
, MUIM_Notify
, MUIA_Numeric_Value
, MUIV_EveryTime
,
3227 obj
, 1, MUIM_Action_Cfg_Changed
);
3229 DoMethod(data
->prefslistobj
, MUIM_Notify
, MUIA_List_Active
, MUIV_EveryTime
,
3230 obj
, 1, MUIM_Action_Cfg_Activate
);
3231 DoMethod(data
->prefssaveasobj
, MUIM_Notify
, MUIA_Pressed
, FALSE
,
3232 obj
, 1, MUIM_Action_SavePrefsAs
);
3233 DoMethod(data
->prefsexportobj
, MUIM_Notify
, MUIA_Pressed
, FALSE
,
3234 obj
, 1, MUIM_Action_Cfg_Export
);
3235 DoMethod(data
->prefsimportobj
, MUIM_Notify
, MUIA_Pressed
, FALSE
,
3236 obj
, 1, MUIM_Action_Cfg_Import
);
3237 DoMethod(data
->prefsremoveobj
, MUIM_Notify
, MUIA_Pressed
, FALSE
,
3238 obj
, 1, MUIM_Action_Cfg_Remove
);
3240 data
->mi_classpopup
= CreateClassPopup();
3241 set(data
->devlistobj
, MUIA_ContextMenu
, data
->mi_classpopup
);
3243 Action_HW_Activate(cl
, obj
, msg
);
3245 CreateErrorList(data
);
3246 SetupEventHandler(data
);
3247 while((pd
= psdGetNextDevice(pd
)))
3249 dlnode
= AllocDevEntry(data
, pd
);
3252 DoMethod(data
->devlistobj
, MUIM_List_InsertSingle
, dlnode
, MUIV_List_Insert_Bottom
);
3255 UpdateConfigToGUI(data
);
3260 /* /// "Action_OM_DISPOSE()" */
3261 IPTR
Action_OM_DISPOSE(struct IClass
*cl
, Object
*obj
, Msg msg
)
3263 struct ActionData
*data
= INST_DATA(cl
, obj
);
3264 FreeErrorList(data
);
3265 FreePrefsList(data
);
3267 if(data
->mi_classpopup
)
3269 MUI_DisposeObject(data
->mi_classpopup
);
3270 data
->mi_classpopup
= NULL
;
3272 CleanupEventHandler(data
);
3277 /* /// "Action_Setup()" */
3278 IPTR
Action_Setup(struct IClass
*cl
, Object
*obj
, Msg msg
)
3280 struct ActionData
*data
= INST_DATA(cl
, obj
);
3282 data
->appobj
= _app(obj
);
3283 data
->winobj
= _win(obj
);
3284 if(!DoSuperMethodA(cl
,obj
,msg
)) return(FALSE
);
3286 data
->eventihn
.ihn_Object
= obj
;
3287 data
->eventihn
.ihn_Signals
= 1UL<<data
->eventmsgport
->mp_SigBit
;
3288 data
->eventihn
.ihn_Flags
= 0;
3289 data
->eventihn
.ihn_Method
= MUIM_Action_HandlePsdEvents
;
3290 DoMethod(data
->appobj
, MUIM_Application_AddInputHandler
, &data
->eventihn
);
3291 //MUI_RequestIDCMP(obj, IDCMP_INTUITICKS);
3296 /* /// "Action_HW_New()" */
3297 IPTR
Action_HW_New(struct IClass
*cl
, Object
*obj
, Msg msg
)
3299 struct ActionData
*data
= INST_DATA(cl
, obj
);
3300 struct HWListEntry
*hlnode
;
3301 hlnode
= AllocHWEntry(data
, NULL
);
3304 hlnode
->devname
= psdCopyStr("DEVS:USBHardware/");
3305 DoMethod(data
->hwlistobj
, MUIM_List_InsertSingle
, hlnode
, MUIV_List_Insert_Bottom
);
3306 set(data
->hwlistobj
, MUIA_List_Active
, MUIV_List_Active_Bottom
);
3307 DoMethod(data
->hwdevaslobj
, MUIM_Popstring_Open
);
3308 InternalCreateConfigGUI(data
);
3314 /* /// "Action_HW_Copy()" */
3315 IPTR
Action_HW_Copy(struct IClass
*cl
, Object
*obj
, Msg msg
)
3317 struct ActionData
*data
= INST_DATA(cl
, obj
);
3318 struct HWListEntry
*hlnode
;
3321 hlnode
= AllocHWEntry(data
, NULL
);
3324 hlnode
->devname
= psdCopyStr(data
->acthlnode
->devname
);
3325 hlnode
->unit
= data
->acthlnode
->unit
+ 1;
3326 DoMethod(data
->hwlistobj
, MUIM_List_InsertSingle
, hlnode
, MUIV_List_Insert_Bottom
);
3327 set(data
->hwlistobj
, MUIA_List_Active
, MUIV_List_Active_Bottom
);
3328 InternalCreateConfigGUI(data
);
3335 /* /// "Action_HW_Del()" */
3336 IPTR
Action_HW_Del(struct IClass
*cl
, Object
*obj
, Msg msg
)
3338 struct ActionData
*data
= INST_DATA(cl
, obj
);
3339 struct HWListEntry
*hlnode
;
3342 hlnode
= data
->acthlnode
;
3343 DoMethod(data
->hwlistobj
, MUIM_List_Remove
, MUIV_List_Remove_Active
);
3344 FreeHWEntry(data
, hlnode
);
3345 InternalCreateConfigGUI(data
);
3351 /* /// "Action_HW_Update()" */
3352 IPTR
Action_HW_Update(struct IClass
*cl
, Object
*obj
, Msg msg
)
3354 struct ActionData
*data
= INST_DATA(cl
, obj
);
3355 struct HWListEntry
*hlnode
;
3356 hlnode
= (struct HWListEntry
*) ((struct opSet
*) msg
)->ops_AttrList
;
3359 hlnode
= data
->acthlnode
;
3364 psdFreeVec(hlnode
->devname
);
3365 get(data
->hwdevobj
, MUIA_String_Contents
, &str
);
3366 hlnode
->devname
= psdCopyStr(str
);
3367 get(data
->hwunitobj
, MUIA_String_Integer
, &hlnode
->unit
);
3368 DoMethod(data
->hwlistobj
, MUIM_List_Redraw
, MUIV_List_Redraw_All
);
3369 InternalCreateConfigGUI(data
);
3375 /* /// "Action_HW_Activate()" */
3376 IPTR
Action_HW_Activate(struct IClass
*cl
, Object
*obj
, Msg msg
)
3378 struct ActionData
*data
= INST_DATA(cl
, obj
);
3379 struct HWListEntry
*hlnode
;
3382 DoMethod(obj
, MUIM_Action_HW_Update
, data
->acthlnode
);
3384 DoMethod(data
->hwlistobj
, MUIM_List_GetEntry
, MUIV_List_GetEntry_Active
, &hlnode
);
3385 if((data
->acthlnode
= hlnode
))
3387 set(data
->hwdevgrpobj
, MUIA_Disabled
, FALSE
);
3388 set(data
->hwcopyobj
, MUIA_Disabled
, FALSE
);
3389 set(data
->hwdelobj
, MUIA_Disabled
, FALSE
);
3390 set(data
->hwinfoobj
, MUIA_Disabled
, !hlnode
->phw
);
3391 set(data
->hwofflineobj
, MUIA_Disabled
, !hlnode
->phw
);
3392 set(data
->hwonlineobj
, MUIA_Disabled
, hlnode
->phw
);
3393 set(data
->hwdevobj
, MUIA_String_Contents
, hlnode
->devname
);
3394 set(data
->hwunitobj
, MUIA_String_Integer
, hlnode
->unit
);
3396 set(data
->hwdevgrpobj
, MUIA_Disabled
, TRUE
);
3397 set(data
->hwcopyobj
, MUIA_Disabled
, TRUE
);
3398 set(data
->hwdelobj
, MUIA_Disabled
, TRUE
);
3399 set(data
->hwinfoobj
, MUIA_Disabled
, TRUE
);
3400 set(data
->hwofflineobj
, MUIA_Disabled
, TRUE
);
3401 set(data
->hwonlineobj
, MUIA_Disabled
, TRUE
);
3407 /* /// "Action_HW_Info()" */
3408 IPTR
Action_HW_Info(struct IClass
*cl
, Object
*obj
, Msg msg
)
3410 struct ActionData
*data
= INST_DATA(cl
, obj
);
3411 struct HWListEntry
*hlnode
;
3415 STRPTR devname
= _(MSG_UNKNOWN
);
3416 STRPTR manufacturer
= _(MSG_UNKNOWN
);
3417 STRPTR prodname
= _(MSG_UNKNOWN
);
3418 STRPTR description
= _(MSG_UNKNOWN
);
3419 STRPTR copyright
= _(MSG_UNKNOWN
);
3422 DoMethod(data
->hwlistobj
, MUIM_List_GetEntry
, MUIV_List_GetEntry_Active
, &hlnode
);
3425 if(hlnode
->infowindow
|| (!hlnode
->phw
))
3429 psdGetAttrs(PGA_HARDWARE
, hlnode
->phw
,
3430 HA_DeviceName
, &devname
,
3431 HA_DeviceUnit
, &unitnr
,
3432 HA_Version
, &version
,
3433 HA_Revision
, &revision
,
3434 HA_ProductName
, &prodname
,
3435 HA_Manufacturer
, &manufacturer
,
3436 HA_Description
, &description
,
3437 HA_Copyright
, ©right
,
3440 textbuf1
= psdCopyStrFmt("%s\n%ld\nV%ld.%ld\n%s\n%s\n%s\n%s",
3441 devname
, unitnr
, version
, revision
, prodname
,
3442 manufacturer
, description
, copyright
);
3443 hlnode
->infowindow
= WindowObject
,
3444 MUIA_Window_ID
, MAKE_ID('H','I','N','F'),
3445 MUIA_Window_Title
, __(MSG_HARDWARE_WINDOW
),
3446 MUIA_Window_IsSubWindow
, FALSE
,
3447 WindowContents
, HGroup
,
3448 MUIA_ShortHelp
, __(MSG_HARDWARE_WINDOW_HELP
),
3449 MUIA_FrameTitle
, __(MSG_HARDWARE_WINDOW_FRAME
),
3450 Child
, LabelB(__(MSG_HARDWARE_WINDOW_LABEL
)),
3453 MUIA_Background
, MUII_TextBack
,
3454 MUIA_Text_Contents
, textbuf1
,
3458 if(hlnode
->infowindow
)
3460 DoMethod(data
->appobj
, OM_ADDMEMBER
, hlnode
->infowindow
);
3461 DoMethod(hlnode
->infowindow
, MUIM_Notify
, MUIA_Window_CloseRequest
, TRUE
,
3462 data
->appobj
, 5, MUIM_Application_PushMethod
, obj
, 2, MUIM_Action_CloseSubWinReq
, hlnode
);
3464 set(hlnode
->infowindow
, MUIA_Window_Open
, TRUE
);
3466 psdFreeVec(textbuf1
);
3472 /* /// "Action_HW_Online()" */
3473 IPTR
Action_HW_Online(struct IClass
*cl
, Object
*obj
, Msg msg
)
3475 struct ActionData
*data
= INST_DATA(cl
, obj
);
3476 struct HWListEntry
*hlnode
= data
->acthlnode
;
3477 if((!hlnode
) || hlnode
->phw
)
3482 set(data
->appobj
, MUIA_Application_Sleep
, TRUE
);
3483 if((hlnode
->phw
= psdAddHardware(hlnode
->devname
, hlnode
->unit
)))
3485 psdGetAttrs(PGA_HARDWARE
, hlnode
->phw
,
3486 HA_ProductName
, &hlnode
->prodname
,
3488 #ifdef AROS_USB30_CODE
3489 if(psdEnumerateHardware(hlnode
->phw
) == NULL
) {
3490 psdRemHardware(hlnode
->phw
);
3492 hlnode
->prodname
= NULL
;
3495 psdEnumerateHardware(hlnode
->phw
);
3499 DoMethod(obj
, MUIM_Action_HW_Activate
);
3500 DoMethod(data
->hwlistobj
, MUIM_List_Redraw
, MUIV_List_Redraw_All
);
3502 set(data
->appobj
, MUIA_Application_Sleep
, FALSE
);
3503 // update the online status to the config
3504 InternalCreateConfigGUI(data
);
3509 /* /// "Action_HW_Offline()" */
3510 IPTR
Action_HW_Offline(struct IClass
*cl
, Object
*obj
, Msg msg
)
3512 struct ActionData
*data
= INST_DATA(cl
, obj
);
3513 struct HWListEntry
*hlnode
= data
->acthlnode
;
3517 if((!hlnode
) || (!hlnode
->phw
))
3522 set(data
->appobj
, MUIA_Application_Sleep
, TRUE
);
3524 psdLockWritePBase();
3525 psdGetAttrs(PGA_STACK
, NULL
, PA_HardwareList
, &lst
, TAG_END
);
3529 if(phw
== hlnode
->phw
)
3532 psdRemHardware(phw
);
3543 hlnode
->prodname
= NULL
;
3545 DoMethod(obj
, MUIM_Action_HW_Activate
);
3546 DoMethod(data
->hwlistobj
, MUIM_List_Redraw
, MUIV_List_Redraw_All
);
3547 set(data
->appobj
, MUIA_Application_Sleep
, FALSE
);
3548 // update the online status to the config
3549 // NOTE! This means that the hardware will not come online on next loading.
3550 InternalCreateConfigGUI(data
);
3555 /* /// "Action_Online()" */
3556 IPTR
Action_Online(struct IClass
*cl
, Object
*obj
, Msg msg
)
3558 struct ActionData
*data
= INST_DATA(cl
, obj
);
3559 struct HWListEntry
*hlnode
;
3560 set(data
->appobj
, MUIA_Application_Sleep
, TRUE
);
3561 hlnode
= (struct HWListEntry
*) data
->hwlist
.lh_Head
;
3562 while(hlnode
->node
.ln_Succ
)
3566 if((hlnode
->phw
= psdAddHardware(hlnode
->devname
, hlnode
->unit
)))
3568 psdGetAttrs(PGA_HARDWARE
, hlnode
->phw
,
3569 HA_ProductName
, &hlnode
->prodname
,
3571 psdEnumerateHardware(hlnode
->phw
);
3574 hlnode
= (struct HWListEntry
*) hlnode
->node
.ln_Succ
;
3576 DoMethod(obj
, MUIM_Action_HW_Activate
);
3577 DoMethod(data
->hwlistobj
, MUIM_List_Redraw
, MUIV_List_Redraw_All
);
3579 set(data
->appobj
, MUIA_Application_Sleep
, FALSE
);
3580 // update the online status to the config
3581 InternalCreateConfigGUI(data
);
3586 /* /// "Action_Offline()" */
3587 IPTR
Action_Offline(struct IClass
*cl
, Object
*obj
, Msg msg
)
3589 struct ActionData
*data
= INST_DATA(cl
, obj
);
3590 struct HWListEntry
*hlnode
;
3591 set(data
->appobj
, MUIA_Application_Sleep
, TRUE
);
3592 hlnode
= (struct HWListEntry
*) data
->hwlist
.lh_Head
;
3593 while(hlnode
->node
.ln_Succ
)
3599 psdLockWritePBase();
3600 psdGetAttrs(PGA_STACK
, NULL
, PA_HardwareList
, &lst
, TAG_END
);
3604 if(phw
== hlnode
->phw
)
3607 psdRemHardware(phw
);
3618 hlnode
->prodname
= NULL
;
3620 hlnode
= (struct HWListEntry
*) hlnode
->node
.ln_Succ
;
3622 DoMethod(obj
, MUIM_Action_HW_Activate
);
3623 DoMethod(data
->hwlistobj
, MUIM_List_Redraw
, MUIV_List_Redraw_All
);
3624 set(data
->appobj
, MUIA_Application_Sleep
, FALSE
);
3625 // update the online status to the config
3626 // NOTE! This means that the hardware will not come online on next loading.
3627 InternalCreateConfigGUI(data
);
3632 /* /// "Action_Restart()" */
3633 IPTR
Action_Restart(struct IClass
*cl
, Object
*obj
, Msg msg
)
3635 struct ActionData
*data
= INST_DATA(cl
, obj
);
3636 struct HWListEntry
*hlnode
;
3637 set(data
->appobj
, MUIA_Application_Sleep
, TRUE
);
3638 hlnode
= (struct HWListEntry
*) data
->hwlist
.lh_Head
;
3639 while(hlnode
->node
.ln_Succ
)
3645 psdLockWritePBase();
3646 psdGetAttrs(PGA_STACK
, NULL
, PA_HardwareList
, &lst
, TAG_END
);
3650 if(phw
== hlnode
->phw
)
3653 psdRemHardware(phw
);
3664 hlnode
->prodname
= NULL
;
3666 hlnode
= (struct HWListEntry
*) hlnode
->node
.ln_Succ
;
3668 hlnode
= (struct HWListEntry
*) data
->hwlist
.lh_Head
;
3669 while(hlnode
->node
.ln_Succ
)
3673 if((hlnode
->phw
= psdAddHardware(hlnode
->devname
, hlnode
->unit
)))
3675 psdGetAttrs(PGA_HARDWARE
, hlnode
->phw
,
3676 HA_ProductName
, &hlnode
->prodname
,
3678 psdEnumerateHardware(hlnode
->phw
);
3681 hlnode
= (struct HWListEntry
*) hlnode
->node
.ln_Succ
;
3683 DoMethod(obj
, MUIM_Action_HW_Activate
);
3684 DoMethod(data
->hwlistobj
, MUIM_List_Redraw
, MUIV_List_Redraw_All
);
3686 set(data
->appobj
, MUIA_Application_Sleep
, FALSE
);
3691 /* /// "Action_ChgErrLevel()" */
3692 IPTR
Action_ChgErrLevel(struct IClass
*cl
, Object
*obj
, Msg msg
)
3694 struct ActionData
*data
= INST_DATA(cl
, obj
);
3696 get(data
->errlvlobj
, MUIA_Cycle_Active
, &lev
);
3700 data
->errorlevel
= RETURN_OK
;
3703 data
->errorlevel
= RETURN_WARN
;
3706 data
->errorlevel
= RETURN_ERROR
;
3709 data
->errorlevel
= RETURN_FAIL
;
3712 CreateErrorList(data
);
3717 /* /// "WriteErrorLogFile()" */
3718 void WriteErrorLogFile(BPTR fh
)
3725 struct DateStamp
*ds
;
3727 struct DateStamp currdate
;
3728 UBYTE strdate
[LEN_DATSTRING
];
3729 UBYTE strtime
[LEN_DATSTRING
];
3731 DateStamp(&currdate
);
3733 psdGetAttrs(PGA_STACK
, NULL
, PA_ErrorMsgList
, &lst
, TAG_END
);
3738 psdGetAttrs(PGA_ERRORMSG
, pem
,
3740 EMA_Origin
, &origin
,
3746 dt
.dat_Stamp
.ds_Days
= ds
->ds_Days
;
3747 dt
.dat_Stamp
.ds_Minute
= ds
->ds_Minute
;
3748 dt
.dat_Stamp
.ds_Tick
= ds
->ds_Tick
;
3749 dt
.dat_Format
= FORMAT_DEF
;
3751 dt
.dat_StrDay
= NULL
;
3752 dt
.dat_StrDate
= strdate
;
3753 dt
.dat_StrTime
= strtime
;
3755 if(currdate
.ds_Days
== ds
->ds_Days
)
3757 FPrintf(fh
, "%s| %2ld-%s: %s\n", strtime
, level
, origin
, errstr
);
3759 FPrintf(fh
, "%s %s| %2ld-%s: %s\n", strdate
, strtime
, level
, origin
, errstr
);
3762 FPrintf(fh
, "%2ld-%s: %s\n", level
, origin
, errstr
);
3770 /* /// "Action_SaveErrors()" */
3771 IPTR
Action_SaveErrors(struct IClass
*cl
, Object
*obj
, Msg msg
)
3773 struct FileRequester
*aslreq
;
3775 struct TagItem asltags
[] = { { ASLFR_InitialDrawer
, (IPTR
) "RAM:" },
3776 { ASLFR_InitialFile
, __(MSG_ACTION_SAVE_ERR_FILE
) },
3777 { ASLFR_DoSaveMode
, (IPTR
) TRUE
},
3778 { ASLFR_TitleText
, __(MSG_ACTION_SAVE_ERR
) },
3779 { TAG_END
, (IPTR
) NULL
} };
3782 if((aslreq
= MUI_AllocAslRequest(ASL_FileRequest
, asltags
)))
3784 if(MUI_AslRequest(aslreq
, TAG_END
))
3786 strcpy(path
, aslreq
->fr_Drawer
);
3787 AddPart(path
, aslreq
->fr_File
, 256);
3788 if((fh
= Open(path
, MODE_NEWFILE
)))
3790 WriteErrorLogFile(fh
);
3792 psdAddErrorMsg(RETURN_OK
, _(MSG_APP_TITLE
), _(MSG_ACTION_ERR_SAVED
), path
);
3794 psdAddErrorMsg(RETURN_ERROR
, _(MSG_APP_TITLE
), _(MSG_ACTION_ERR_SAVED_ERRWRITE
), path
);
3796 MUI_FreeAslRequest(aslreq
);
3803 /* /// "Action_FlushErrors()" */
3804 IPTR
Action_FlushErrors(struct IClass
*cl
, Object
*obj
, Msg msg
)
3806 struct ActionData
*data
= INST_DATA(cl
, obj
);
3808 psdGetAttrs(PGA_STACK
, NULL
, PA_ErrorMsgList
, &lst
, TAG_END
);
3810 while(lst
->lh_Head
->ln_Succ
)
3812 psdRemErrorMsg(lst
->lh_Head
);
3815 CreateErrorList(data
);
3820 /* /// "Action_SaveDeviceList()" */
3821 IPTR
Action_SaveDeviceList(struct IClass
*cl
, Object
*obj
, Msg msg
)
3823 struct FileRequester
*aslreq
;
3825 struct TagItem asltags
[] = { { ASLFR_InitialDrawer
, (IPTR
) "RAM:" },
3826 { ASLFR_InitialFile
, __(MSG_ACTION_SAVE_DEV_FILE
) },
3827 { ASLFR_DoSaveMode
, (IPTR
) TRUE
},
3828 { ASLFR_TitleText
, __(MSG_ACTION_SAVE_DEV
) },
3829 { TAG_END
, (IPTR
) NULL
} };
3832 if((aslreq
= MUI_AllocAslRequest(ASL_FileRequest
, asltags
)))
3834 if(MUI_AslRequest(aslreq
, TAG_END
))
3836 strcpy(path
, aslreq
->fr_Drawer
);
3837 AddPart(path
, aslreq
->fr_File
, 256);
3838 if((fh
= Open(path
, MODE_NEWFILE
)))
3840 if(SystemTags("PsdDevLister", SYS_Output
, fh
, TAG_END
))
3842 psdAddErrorMsg(RETURN_ERROR
,_(MSG_APP_TITLE
), _(MSG_ACTION_SAVE_DEV_ERREXE
));
3844 psdAddErrorMsg(RETURN_OK
, _(MSG_APP_TITLE
), _(MSG_ACTION_DEV_SAVED
), path
);
3848 psdAddErrorMsg(RETURN_ERROR
, _(MSG_APP_TITLE
), _(MSG_ACTION_ERR_SAVED_ERRWRITE
), path
);
3850 MUI_FreeAslRequest(aslreq
);
3857 /* /// "Action_LoadPrefs()" */
3858 IPTR
Action_LoadPrefs(struct IClass
*cl
, Object
*obj
, Msg msg
)
3860 //struct ActionData *data = INST_DATA(cl, obj);
3861 struct FileRequester
*aslreq
;
3863 struct TagItem asltags
[] = { { ASLFR_InitialDrawer
, (IPTR
) "ENVARC:Sys" },
3864 { ASLFR_InitialFile
, (IPTR
) "Poseidon.prefs" },
3865 { ASLFR_TitleText
, __(MSG_ACTION_PREFS_LOAD
) },
3866 { TAG_END
, (IPTR
) NULL
} };
3868 if((aslreq
= MUI_AllocAslRequest(ASL_FileRequest
, asltags
)))
3870 if(MUI_AslRequest(aslreq
, TAG_END
))
3872 strcpy(path
, aslreq
->fr_Drawer
);
3873 AddPart(path
, aslreq
->fr_File
, 256);
3874 if(psdLoadCfgFromDisk(path
))
3876 psdAddErrorMsg(RETURN_OK
, _(MSG_APP_TITLE
), _(MSG_ACTION_PREFS_LOADED
), path
);
3877 //UpdateConfigToGUI(data);
3880 MUI_FreeAslRequest(aslreq
);
3886 /* /// "Action_SavePrefsAs()" */
3887 IPTR
Action_SavePrefsAs(struct IClass
*cl
, Object
*obj
, Msg msg
)
3889 struct ActionData
*data
= INST_DATA(cl
, obj
);
3890 struct FileRequester
*aslreq
;
3892 struct TagItem asltags
[] = { { ASLFR_InitialDrawer
, (IPTR
) "ENVARC:Sys" },
3893 { ASLFR_InitialFile
, (IPTR
) "Poseidon.prefs" },
3894 { ASLFR_TitleText
, __(MSG_ACTION_PREFS_SAVEAS
) },
3895 { ASLFR_DoSaveMode
, (IPTR
) TRUE
},
3896 { TAG_END
, (IPTR
) NULL
} };
3898 if((aslreq
= MUI_AllocAslRequest(ASL_FileRequest
, asltags
)))
3900 if(MUI_AslRequest(aslreq
, TAG_END
))
3902 strcpy(path
, aslreq
->fr_Drawer
);
3903 AddPart(path
, aslreq
->fr_File
, 256);
3904 InternalCreateConfigGUI(data
);
3905 if(psdSaveCfgToDisk(path
, FALSE
))
3907 psdAddErrorMsg(RETURN_OK
, _(MSG_APP_TITLE
), _(MSG_ACTION_PREFS_SAVED
), path
);
3910 psdGetAttrs(PGA_STACK
, NULL
, PA_CurrConfigHash
, &hash
, TAG_END
);
3911 psdSetAttrs(PGA_STACK
, NULL
, PA_SavedConfigHash
, hash
, TAG_END
);
3914 psdAddErrorMsg(RETURN_ERROR
, _(MSG_APP_TITLE
), _(MSG_ACTION_PREFS_SAVEDERR
), path
);
3916 MUI_FreeAslRequest(aslreq
);
3923 /* /// "Action_SavePrefs()" */
3924 IPTR
Action_SavePrefs(struct IClass
*cl
, Object
*obj
, Msg msg
)
3926 struct ActionData
*data
= INST_DATA(cl
, obj
);
3928 DoMethod(obj
, MUIM_Action_Cfg_Snd_Changed
);
3929 InternalCreateConfigGUI(data
);
3931 if(!psdSaveCfgToDisk(NULL
, FALSE
))
3933 psdAddErrorMsg(RETURN_ERROR
, _(MSG_APP_TITLE
), _(MSG_ACTION_PREFS_NOTSAVED
));
3935 psdAddErrorMsg(RETURN_OK
, _(MSG_APP_TITLE
), _(MSG_ACTION_PREFS_SAVEDSUCCESS
));
3942 /* /// "Action_Prefs_Changed()" */
3943 IPTR
Action_Prefs_Changed(struct IClass
*cl
, Object
*obj
, Msg msg
)
3947 DoMethod(obj
, MUIM_Action_Cfg_Snd_Changed
);
3948 psdGetAttrs(PGA_STACK
, NULL
,
3949 PA_CurrConfigHash
, &currhash
,
3950 PA_SavedConfigHash
, &oldhash
,
3952 return((IPTR
) (currhash
!= oldhash
));
3956 /* /// "Action_UseQuit()" */
3957 IPTR
Action_UseQuit(struct IClass
*cl
, Object
*obj
, Msg msg
)
3959 struct ActionData
*data
= INST_DATA(cl
, obj
);
3961 //DoMethod(obj, MUIM_Action_Cfg_Snd_Changed);
3962 DoMethod(obj
, MUIM_Action_Use
);
3963 if(DoMethod(obj
, MUIM_Action_Prefs_Changed
))
3965 res
= MUI_RequestA(data
->appobj
, data
->winobj
, 0, NULL
, _(MSG_ACTION_USEQUIT
), _(MSG_ACTION_CONFIGCHANGED
), NULL
);
3972 DoMethod(obj
, MUIM_Action_SavePrefs
);
3975 DoMethod(data
->appobj
, MUIM_Application_ReturnID
, MUIV_Application_ReturnID_Quit
);
3980 /* /// "Action_SaveQuit()" */
3981 IPTR
Action_SaveQuit(struct IClass
*cl
, Object
*obj
, Msg msg
)
3983 struct ActionData
*data
= INST_DATA(cl
, obj
);
3984 DoMethod(obj
, MUIM_Action_Cfg_Snd_Changed
);
3985 DoMethod(obj
, MUIM_Action_Use
);
3986 if(!(psdSaveCfgToDisk(NULL
, FALSE
)))
3988 psdAddErrorMsg(RETURN_ERROR
, _(MSG_APP_TITLE
), _(MSG_ACTION_SAVEQUIT
));
3990 DoMethod(data
->appobj
, MUIM_Application_ReturnID
, MUIV_Application_ReturnID_Quit
);
3996 /* /// "Action_LoadPrefsFrom()" */
3997 IPTR
Action_LoadPrefsFrom(struct IClass
*cl
, Object
*obj
, Msg msg
)
3999 //struct ActionData *data = INST_DATA(cl, obj);
4000 STRPTR path
= (STRPTR
) ((struct opSet
*) msg
)->ops_AttrList
;
4001 if(psdLoadCfgFromDisk(path
))
4003 psdAddErrorMsg(RETURN_OK
, _(MSG_APP_TITLE
), _(MSG_ACTION_PREFS_LOADED
), path
);
4010 /* /// "Action_SavePrefsTo()" */
4011 IPTR
Action_SavePrefsTo(struct IClass
*cl
, Object
*obj
, Msg msg
)
4013 struct ActionData
*data
= INST_DATA(cl
, obj
);
4014 STRPTR path
= (STRPTR
) ((struct opSet
*) msg
)->ops_AttrList
;
4015 InternalCreateConfigGUI(data
);
4016 if(psdSaveCfgToDisk(path
, FALSE
))
4018 psdAddErrorMsg(RETURN_OK
, _(MSG_APP_TITLE
), _(MSG_ACTION_PREFS_SAVED
), path
);
4025 /* /// "Action_Dev_Activate()" */
4026 IPTR
Action_Dev_Activate(struct IClass
*cl
, Object
*obj
, Msg msg
)
4028 struct ActionData
*data
= INST_DATA(cl
, obj
);
4029 struct DevListEntry
*dlnode
;
4032 struct List
*pclist
;
4033 struct List
*piflist
;
4037 IPTR hascfggui
= FALSE
;
4038 IPTR issuspended
= FALSE
;
4039 struct Library
*UsbClsBase
;
4041 DoMethod(data
->devlistobj
, MUIM_List_GetEntry
, MUIV_List_GetEntry_Active
, &dlnode
);
4042 if(CheckDeviceValid(dlnode
))
4044 psdLockReadDevice(dlnode
->pd
);
4045 set(data
->devinfoobj
, MUIA_Disabled
, FALSE
);
4046 psdGetAttrs(PGA_DEVICE
, dlnode
->pd
,
4047 DA_Binding
, &binding
,
4048 DA_BindingClass
, &puc
,
4049 DA_ConfigList
, &pclist
,
4050 DA_IsSuspended
, &issuspended
,
4054 psdGetAttrs(PGA_USBCLASS
, puc
,
4055 UCA_ClassBase
, &UsbClsBase
,
4057 usbGetAttrs(UGA_CLASS
, NULL
,
4058 UCCA_HasBindingCfgGUI
, &hascfggui
,
4061 pc
= pclist
->lh_Head
;
4062 while((!binding
) && pc
->ln_Succ
)
4064 psdGetAttrs(PGA_CONFIG
, pc
,
4065 CA_InterfaceList
, &piflist
,
4067 pif
= piflist
->lh_Head
;
4070 psdGetAttrs(PGA_INTERFACE
, pif
,
4071 IFA_Binding
, &cbind
,
4072 IFA_BindingClass
, &puc
,
4078 if(cbind
&& puc
&& !hascfggui
)
4080 psdGetAttrs(PGA_USBCLASS
, puc
,
4081 UCA_ClassBase
, &UsbClsBase
,
4083 usbGetAttrs(UGA_CLASS
, NULL
,
4084 UCCA_HasBindingCfgGUI
, &hascfggui
,
4091 psdUnlockDevice(dlnode
->pd
);
4092 set(data
->devunbindobj
, MUIA_Disabled
, !binding
);
4093 set(data
->devcfgobj
, MUIA_Disabled
, !hascfggui
);
4094 /*if(dlnode->infowindow) FIXME
4096 DoMethod(obj, MUIM_Action_Dev_If_Activate, dlnode);
4098 set(data
->devsuspendobj
, MUIA_Disabled
, issuspended
);
4099 set(data
->devresumeobj
, MUIA_Disabled
, !issuspended
);
4100 set(data
->devpowercycleobj
, MUIA_Disabled
, FALSE
);
4101 set(data
->devdisableobj
, MUIA_Disabled
, FALSE
);
4102 set(data
->devlistobj
, MUIA_ContextMenu
, data
->mi_classpopup
);
4104 set(data
->devunbindobj
, MUIA_Disabled
, TRUE
);
4105 set(data
->devinfoobj
, MUIA_Disabled
, TRUE
);
4106 set(data
->devcfgobj
, MUIA_Disabled
, TRUE
);
4107 set(data
->devsuspendobj
, MUIA_Disabled
, TRUE
);
4108 set(data
->devresumeobj
, MUIA_Disabled
, TRUE
);
4109 set(data
->devpowercycleobj
, MUIA_Disabled
, TRUE
);
4110 set(data
->devdisableobj
, MUIA_Disabled
, TRUE
);
4111 set(data
->devlistobj
, MUIA_ContextMenu
, NULL
);
4117 /* /// "Action_Dev_Info()" */
4118 IPTR
Action_Dev_Info(struct IClass
*cl
, Object
*obj
, Msg msg
)
4120 struct ActionData
*data
= INST_DATA(cl
, obj
);
4121 struct DevListEntry
*dlnode
;
4123 DoMethod(data
->devlistobj
, MUIM_List_GetEntry
, MUIV_List_GetEntry_Active
, &dlnode
);
4126 if(dlnode
->infowindow
)
4130 dlnode
->infowindow
= NewObject(DevWinClass
->mcc_Class
, 0, MUIA_DevWin_DevEntry
, dlnode
, WindowContents
, VGroup
, End
, TAG_END
);
4131 if(dlnode
->infowindow
)
4133 DoMethod(data
->appobj
, OM_ADDMEMBER
, dlnode
->infowindow
);
4134 DoMethod(dlnode
->infowindow
, MUIM_Notify
, MUIA_Window_CloseRequest
, TRUE
,
4135 data
->appobj
, 5, MUIM_Application_PushMethod
, obj
, 2, MUIM_Action_CloseSubWinReq
, dlnode
);
4136 set(dlnode
->infowindow
, MUIA_Window_Open
, TRUE
);
4143 /* /// "Action_Dev_Bind()" */
4144 IPTR
Action_Dev_Bind(struct IClass
*cl
, Object
*obj
, Msg msg
)
4146 struct ActionData
*data
= INST_DATA(cl
, obj
);
4148 DoMethod(obj
, MUIM_Action_Dev_Activate
);
4149 DoMethod(data
->devlistobj
, MUIM_List_Redraw
, MUIV_List_Redraw_All
);
4154 /* /// "Action_Dev_Unbind()" */
4155 IPTR
Action_Dev_Unbind(struct IClass
*cl
, Object
*obj
, Msg msg
)
4157 struct ActionData
*data
= INST_DATA(cl
, obj
);
4158 struct DevListEntry
*dlnode
;
4160 struct List
*pclist
;
4161 struct List
*piflist
;
4165 DoMethod(data
->devlistobj
, MUIM_List_GetEntry
, MUIV_List_GetEntry_Active
, &dlnode
);
4166 if(CheckDeviceValid(dlnode
))
4168 psdGetAttrs(PGA_DEVICE
, dlnode
->pd
,
4169 DA_Binding
, &binding
,
4170 DA_ConfigList
, &pclist
,
4174 psdReleaseDevBinding(dlnode
->pd
);
4176 pc
= pclist
->lh_Head
;
4179 psdGetAttrs(PGA_CONFIG
, pc
,
4180 CA_InterfaceList
, &piflist
,
4182 pif
= piflist
->lh_Head
;
4185 psdGetAttrs(PGA_INTERFACE
, pif
,
4186 IFA_Binding
, &binding
,
4190 psdReleaseIfBinding(pif
);
4197 set(data
->devunbindobj
, MUIA_Disabled
, TRUE
);
4198 set(data
->devcfgobj
, MUIA_Disabled
, TRUE
);
4199 /*if(dlnode->infowindow) FIXME
4201 DoMethod(obj, MUIM_Action_Dev_If_Activate, dlnode);
4202 DoMethod(dlnode->iflvobj, MUIM_List_Redraw, MUIV_List_Redraw_All);
4205 DoMethod(data
->devlistobj
, MUIM_List_Redraw
, MUIV_List_Redraw_All
);
4210 /* /// "Action_Dev_Suspend()" */
4211 IPTR
Action_Dev_Suspend(struct IClass
*cl
, Object
*obj
, Msg msg
)
4213 struct ActionData
*data
= INST_DATA(cl
, obj
);
4214 struct DevListEntry
*dlnode
;
4216 DoMethod(data
->devlistobj
, MUIM_List_GetEntry
, MUIV_List_GetEntry_Active
, &dlnode
);
4217 if(CheckDeviceValid(dlnode
))
4219 psdSuspendDevice(dlnode
->pd
);
4221 DoMethod(data
->devlistobj
, MUIM_List_Redraw
, MUIV_List_Redraw_All
);
4226 /* /// "Action_Dev_Resume()" */
4227 IPTR
Action_Dev_Resume(struct IClass
*cl
, Object
*obj
, Msg msg
)
4229 struct ActionData
*data
= INST_DATA(cl
, obj
);
4230 struct DevListEntry
*dlnode
;
4232 DoMethod(data
->devlistobj
, MUIM_List_GetEntry
, MUIV_List_GetEntry_Active
, &dlnode
);
4233 if(CheckDeviceValid(dlnode
))
4235 psdResumeDevice(dlnode
->pd
);
4237 DoMethod(data
->devlistobj
, MUIM_List_Redraw
, MUIV_List_Redraw_All
);
4242 /* /// "Action_Dev_PowerCycle()" */
4243 IPTR
Action_Dev_PowerCycle(struct IClass
*cl
, Object
*obj
, Msg msg
)
4245 struct ActionData
*data
= INST_DATA(cl
, obj
);
4246 struct DevListEntry
*dlnode
;
4248 struct Node
*hubpd
= NULL
;
4249 struct Node
*puc
= NULL
;
4250 struct Library
*UsbClsBase
;
4252 DoMethod(data
->devlistobj
, MUIM_List_GetEntry
, MUIV_List_GetEntry_Active
, &dlnode
);
4253 if(CheckDeviceValid(dlnode
))
4255 psdGetAttrs(PGA_DEVICE
, dlnode
->pd
,
4256 DA_HubDevice
, &hubpd
,
4257 DA_AtHubPortNumber
, &hubport
,
4261 psdGetAttrs(PGA_DEVICE
, hubpd
,
4262 DA_BindingClass
, &puc
,
4267 psdGetAttrs(PGA_USBCLASS
, puc
,
4268 UCA_ClassBase
, &UsbClsBase
,
4270 usbDoMethod(UCM_HubPowerCyclePort
, hubpd
, hubport
);
4273 DoMethod(data
->devlistobj
, MUIM_List_Redraw
, MUIV_List_Redraw_All
);
4278 /* /// "Action_Dev_Disable()" */
4279 IPTR
Action_Dev_Disable(struct IClass
*cl
, Object
*obj
, Msg msg
)
4281 struct ActionData
*data
= INST_DATA(cl
, obj
);
4282 struct DevListEntry
*dlnode
;
4284 struct Node
*hubpd
= NULL
;
4285 struct Node
*puc
= NULL
;
4286 struct Library
*UsbClsBase
;
4288 DoMethod(data
->devlistobj
, MUIM_List_GetEntry
, MUIV_List_GetEntry_Active
, &dlnode
);
4289 if(CheckDeviceValid(dlnode
))
4291 psdGetAttrs(PGA_DEVICE
, dlnode
->pd
,
4292 DA_HubDevice
, &hubpd
,
4293 DA_AtHubPortNumber
, &hubport
,
4297 psdGetAttrs(PGA_DEVICE
, hubpd
,
4298 DA_BindingClass
, &puc
,
4303 psdGetAttrs(PGA_USBCLASS
, puc
,
4304 UCA_ClassBase
, &UsbClsBase
,
4306 usbDoMethod(UCM_HubDisablePort
, hubpd
, hubport
);
4310 DoMethod(data
->devlistobj
, MUIM_List_Redraw
, MUIV_List_Redraw_All
);
4315 /* /// "Action_Dev_Configure()" */
4316 IPTR
Action_Dev_Configure(struct IClass
*cl
, Object
*obj
, Msg msg
)
4318 struct ActionData
*data
= INST_DATA(cl
, obj
);
4319 struct DevListEntry
*dlnode
;
4321 struct List
*pclist
;
4322 struct List
*piflist
;
4326 struct Library
*UsbClsBase
;
4328 DoMethod(data
->devlistobj
, MUIM_List_GetEntry
, MUIV_List_GetEntry_Active
, &dlnode
);
4329 if(CheckDeviceValid(dlnode
))
4331 psdLockReadDevice(dlnode
->pd
);
4332 psdGetAttrs(PGA_DEVICE
, dlnode
->pd
,
4333 DA_Binding
, &binding
,
4334 DA_BindingClass
, &puc
,
4335 DA_ConfigList
, &pclist
,
4340 psdGetAttrs(PGA_USBCLASS
, puc
,
4341 UCA_ClassBase
, &UsbClsBase
,
4344 if(binding
&& UsbClsBase
)
4346 usbDoMethod(UCM_OpenBindingCfgWindow
, binding
);
4348 pc
= pclist
->lh_Head
;
4351 psdGetAttrs(PGA_CONFIG
, pc
,
4352 CA_InterfaceList
, &piflist
,
4354 pif
= piflist
->lh_Head
;
4357 psdGetAttrs(PGA_INTERFACE
, pif
,
4358 IFA_Binding
, &binding
,
4359 IFA_BindingClass
, &puc
,
4364 psdGetAttrs(PGA_USBCLASS
, puc
,
4365 UCA_ClassBase
, &UsbClsBase
,
4368 if(binding
&& UsbClsBase
)
4370 usbDoMethod(UCM_OpenBindingCfgWindow
, binding
);
4377 psdUnlockDevice(dlnode
->pd
);
4384 /* /// "Action_Dev_ForceBind()" */
4385 IPTR
Action_Dev_ForceBind(struct IClass
*cl
, Object
*obj
, Msg msg
)
4387 struct ActionData
*data
= INST_DATA(cl
, obj
);
4388 struct DevListEntry
*dlnode
;
4389 Object
*mi
= (Object
*) ((IPTR
*) msg
)[1];
4391 STRPTR devid
= NULL
;
4392 STRPTR devname
= NULL
;
4395 DoMethod(data
->devlistobj
, MUIM_List_GetEntry
, MUIV_List_GetEntry_Active
, &dlnode
);
4396 if(CheckDeviceValid(dlnode
))
4398 get(mi
, MUIA_Menuitem_Title
, &name
);
4399 if(!strcmp(name
, _(MSG_ACTION_DEV_FORCEBIND_NONE
)))
4403 psdGetAttrs(PGA_DEVICE
, dlnode
->pd
,
4404 DA_ProductName
, &devname
,
4405 DA_IDString
, &devid
,
4409 clever
= MUI_RequestA(data
->appobj
, data
->winobj
, 0, NULL
, _(MSG_ACTION_DEV_FORCE_REQ
),_(MSG_ACTION_DEV_FORCE_REQ_TXT
), NULL
);
4415 if(psdSetForcedBinding(name
, devid
, NULL
))
4419 psdAddErrorMsg(RETURN_OK
, _(MSG_APP_TITLE
), _(MSG_ACTION_DEV_FORCE
), devname
, name
);
4421 psdAddErrorMsg(RETURN_OK
, _(MSG_APP_TITLE
), _(MSG_ACTION_DEV_FORCE_REMOVE
), devname
);
4429 /* /// "Action_Cfg_Changed()" */
4430 IPTR
Action_Cfg_Changed(struct IClass
*cl
, Object
*obj
, Msg msg
)
4432 struct ActionData
*data
= INST_DATA(cl
, obj
);
4434 IPTR subtaskpri
= 0;
4441 IPTR popupdeath
= 0;
4442 IPTR popupdelay
= 0;
4443 IPTR popupactivate
= 0;
4444 IPTR popuptofront
= 0;
4445 IPTR autodisablelp
= 0;
4446 IPTR autodisabledead
= 0;
4447 IPTR autorestartdead
= 0;
4448 IPTR powersaving
= 0;
4449 IPTR forcesuspend
= 0;
4450 IPTR suspendtimeout
= 0;
4451 APTR stackcfg
= NULL
;
4453 psdGetAttrs(PGA_STACK
, NULL
, PA_GlobalConfig
, &stackcfg
, TAG_END
);
4454 get(data
->cfgtaskpriobj
, MUIA_Numeric_Value
, &subtaskpri
);
4455 get(data
->cfgbootdelayobj
, MUIA_Numeric_Value
, &bootdelay
);
4456 get(data
->cfgloginfoobj
, MUIA_Selected
, &loginfo
);
4457 get(data
->cfglogwarnobj
, MUIA_Selected
, &logwarn
);
4458 get(data
->cfglogerrobj
, MUIA_Selected
, &logerr
);
4459 get(data
->cfglogfailobj
, MUIA_Selected
, &logfail
);
4460 get(data
->cfgpopupnewobj
, MUIA_Cycle_Active
, &popupnew
);
4461 get(data
->cfgpopupgoneobj
, MUIA_Selected
, &popupgone
);
4462 get(data
->cfgpopupdeathobj
, MUIA_Selected
, &popupdeath
);
4463 get(data
->cfgpopupdelayobj
, MUIA_Numeric_Value
, &popupdelay
);
4464 get(data
->cfgpopupactivateobj
, MUIA_Selected
, &popupactivate
);
4465 get(data
->cfgpopuptofrontobj
, MUIA_Selected
, &popuptofront
);
4466 get(data
->cfgautolpobj
, MUIA_Selected
, &autodisablelp
);
4467 get(data
->cfgautodeadobj
, MUIA_Selected
, &autodisabledead
);
4468 get(data
->cfgautopcobj
, MUIA_Selected
, &autorestartdead
);
4469 get(data
->cfgpowersavingobj
, MUIA_Selected
, &powersaving
);
4470 get(data
->cfgforcesuspendobj
, MUIA_Selected
, &forcesuspend
);
4471 get(data
->cfgsuspendtimeoutobj
, MUIA_Numeric_Value
, &suspendtimeout
);
4473 if(autorestartdead
&& autodisabledead
)
4475 autodisabledead
= FALSE
;
4476 nnset(data
->cfgautodeadobj
, MUIA_Selected
, FALSE
);
4480 nnset(data
->cfgautodeadobj
, MUIA_Disabled
, TRUE
);
4482 nnset(data
->cfgautodeadobj
, MUIA_Disabled
, FALSE
);
4486 psdSetAttrs(PGA_STACKCFG
, stackcfg
,
4487 GCA_SubTaskPri
, subtaskpri
,
4488 GCA_BootDelay
, bootdelay
,
4489 GCA_LogInfo
, loginfo
,
4490 GCA_LogWarning
, logwarn
,
4491 GCA_LogError
, logerr
,
4492 GCA_LogFailure
, logfail
,
4493 GCA_PopupDeviceNew
, popupnew
,
4494 GCA_PopupDeviceGone
, popupgone
,
4495 GCA_PopupDeviceDeath
, popupdeath
,
4496 GCA_PopupCloseDelay
, popupdelay
,
4497 GCA_PopupActivateWin
, popupactivate
,
4498 GCA_PopupWinToFront
, popuptofront
,
4499 GCA_AutoDisableLP
, autodisablelp
,
4500 GCA_AutoDisableDead
, autodisabledead
,
4501 GCA_AutoRestartDead
, autorestartdead
,
4502 GCA_PowerSaving
, powersaving
,
4503 GCA_ForceSuspend
, forcesuspend
,
4504 GCA_SuspendTimeout
, suspendtimeout
,
4511 /* /// "Action_Cfg_Snd_Changed()" */
4512 IPTR
Action_Cfg_Snd_Changed(struct IClass
*cl
, Object
*obj
, Msg msg
)
4514 struct ActionData
*data
= INST_DATA(cl
, obj
);
4515 STRPTR dtxsndfile
= "";
4516 STRPTR remsndfile
= "";
4517 APTR stackcfg
= NULL
;
4519 psdGetAttrs(PGA_STACK
, NULL
, PA_GlobalConfig
, &stackcfg
, TAG_END
);
4520 get(data
->cfgdevdtxsoundobj
, MUIA_String_Contents
, &dtxsndfile
);
4521 get(data
->cfgdevremsoundobj
, MUIA_String_Contents
, &remsndfile
);
4524 psdSetAttrs(PGA_STACKCFG
, stackcfg
,
4525 GCA_InsertionSound
, dtxsndfile
,
4526 GCA_RemovalSound
, remsndfile
,
4533 /* /// "Action_Cls_Activate()" */
4534 IPTR
Action_Cls_Activate(struct IClass
*cl
, Object
*obj
, Msg msg
)
4536 struct ActionData
*data
= INST_DATA(cl
, obj
);
4537 struct ClsListEntry
*clnode
;
4538 DoMethod(data
->clslistobj
, MUIM_List_GetEntry
, MUIV_List_GetEntry_Active
, &clnode
);
4543 IPTR hascfggui
= FALSE
;
4544 struct Library
*UsbClsBase
;
4546 set(data
->clsremobj
, MUIA_Disabled
, FALSE
);
4549 psdGetAttrs(PGA_STACK
, NULL
, PA_ClassList
, &lst
, TAG_END
);
4553 if(puc
== clnode
->puc
)
4555 psdGetAttrs(PGA_USBCLASS
, clnode
->puc
,
4556 UCA_ClassBase
, &UsbClsBase
,
4558 usbGetAttrs(UGA_CLASS
, NULL
,
4559 UCCA_HasClassCfgGUI
, &hascfggui
,
4561 set(data
->clscfgobj
, MUIA_Disabled
, !hascfggui
);
4568 set(data
->clsremobj
, MUIA_Disabled
, TRUE
);
4569 set(data
->clscfgobj
, MUIA_Disabled
, TRUE
);
4575 /* /// "Action_Cls_Add()" */
4576 IPTR
Action_Cls_Add(struct IClass
*cl
, Object
*obj
, Msg msg
)
4578 struct ActionData
*data
= INST_DATA(cl
, obj
);
4579 STRPTR clsname
= "";
4580 get(data
->clsnameobj
, MUIA_String_Contents
, &clsname
);
4581 psdAddClass(clsname
, 0);
4582 InternalCreateConfigGUI(data
);
4587 /* /// "Action_Cls_Remove()" */
4588 IPTR
Action_Cls_Remove(struct IClass
*cl
, Object
*obj
, Msg msg
)
4590 struct ActionData
*data
= INST_DATA(cl
, obj
);
4591 struct ClsListEntry
*clnode
;
4592 DoMethod(data
->clslistobj
, MUIM_List_GetEntry
, MUIV_List_GetEntry_Active
, &clnode
);
4598 psdGetAttrs(PGA_STACK
, NULL
, PA_ClassList
, &lst
, TAG_END
);
4602 if(puc
== clnode
->puc
)
4605 DoMethod(data
->clslistobj
, MUIM_List_Remove
, MUIV_List_Remove_Active
);
4606 FreeClsEntry(data
, clnode
);
4619 InternalCreateConfigGUI(data
);
4624 /* /// "Action_Cls_Scan()" */
4625 IPTR
Action_Cls_Scan(struct IClass
*cl
, Object
*obj
, Msg msg
)
4627 struct ActionData
*data
= INST_DATA(cl
, obj
);
4628 struct ExAllControl
*exall
;
4630 struct ExAllData
*exdata
;
4631 ULONG ents
, namelen
;
4632 struct List
*puclist
;
4634 UBYTE sbuf
[CLASSNAMEMAX
];
4635 BOOL exready
, isvalid
;
4637 psdGetAttrs(PGA_STACK
, NULL
, PA_ClassList
, &puclist
, TAG_END
);
4638 if((exall
= AllocDosObject(DOS_EXALLCONTROL
, NULL
)))
4640 if((lock
= Lock(CLASSPATH
, ACCESS_READ
)))
4642 exall
->eac_LastKey
= 0;
4643 exall
->eac_MatchString
= NULL
;
4644 exall
->eac_MatchFunc
= NULL
;
4647 exready
= ExAll(lock
, (struct ExAllData
*) buf
, 1024, ED_NAME
, exall
);
4648 exdata
= (struct ExAllData
*) buf
;
4649 ents
= exall
->eac_Entries
;
4653 psdSafeRawDoFmt(sbuf
, CLASSNAMEMAX
, CLASSPATH
"/%s", exdata
->ed_Name
);
4655 namelen
= strlen(sbuf
);
4656 if (((namelen
> 4) && (!strcmp(&sbuf
[namelen
-4], ".dbg"))) || ((namelen
> 5) && (!strcmp(&sbuf
[namelen
-5], ".info"))))
4663 if(!strcmp(&sbuf
[namelen
-4], ".elf"))
4665 sbuf
[namelen
-4] = 0;
4668 if(!FindName(puclist
, exdata
->ed_Name
))
4670 psdAddClass(sbuf
, 0);
4673 exdata
= exdata
->ed_Next
;
4677 InternalCreateConfigGUI(data
);
4680 /*errmsg = "Could not lock on SYS:Classes/USB.\n";*/
4682 FreeDosObject(DOS_EXALLCONTROL
, exall
);
4688 /* /// "Action_Cls_Configure()" */
4689 IPTR
Action_Cls_Configure(struct IClass
*cl
, Object
*obj
, Msg msg
)
4691 struct ActionData
*data
= INST_DATA(cl
, obj
);
4692 struct ClsListEntry
*clnode
;
4693 DoMethod(data
->clslistobj
, MUIM_List_GetEntry
, MUIV_List_GetEntry_Active
, &clnode
);
4698 struct Library
*UsbClsBase
;
4701 psdGetAttrs(PGA_STACK
, NULL
, PA_ClassList
, &lst
, TAG_END
);
4705 if(puc
== clnode
->puc
)
4707 psdGetAttrs(PGA_USBCLASS
, clnode
->puc
,
4708 UCA_ClassBase
, &UsbClsBase
,
4710 usbDoMethod(UCM_OpenCfgWindow
);
4723 /* /// "Action_Info_MemPool()" */
4724 IPTR
Action_Info_MemPool(struct IClass
*cl
, Object
*obj
, Msg msg
)
4726 struct ActionData
*data
= INST_DATA(cl
, obj
);
4729 psdGetAttrs(PGA_STACK
, NULL
, PA_MemPoolUsage
, &mem
, TAG_END
);
4730 psdSafeRawDoFmt(buf
, 32, _(MSG_ACTION_MEMPOOL_FORMAT
), (mem
+512)>>10);
4731 set(data
->mempoolobj
, MUIA_Text_Contents
, buf
);
4736 /* /// "Action_Cfg_Activate()" */
4737 IPTR
Action_Cfg_Activate(struct IClass
*cl
, Object
*obj
, Msg msg
)
4739 struct ActionData
*data
= INST_DATA(cl
, obj
);
4740 struct PrefsListEntry
*plnode
;
4741 DoMethod(data
->prefslistobj
, MUIM_List_GetEntry
, MUIV_List_GetEntry_Active
, &plnode
);
4744 BOOL noexport
= FALSE
;
4745 switch(plnode
->chunkid
)
4747 case IFFCHNK_FORCEDBIND
:
4748 case MAKE_ID('P','S','D','L'):
4752 set(data
->prefsremoveobj
, MUIA_Disabled
, plnode
->chunkid
== IFFFORM_STACKCFG
);
4753 set(data
->prefsexportobj
, MUIA_Disabled
, noexport
);
4755 set(data
->prefsremoveobj
, MUIA_Disabled
, TRUE
);
4756 set(data
->prefsexportobj
, MUIA_Disabled
, TRUE
);
4762 /* /// "Action_Cfg_Remove()" */
4763 IPTR
Action_Cfg_Remove(struct IClass
*cl
, Object
*obj
, Msg msg
)
4765 struct ActionData
*data
= INST_DATA(cl
, obj
);
4766 struct PrefsListEntry
*plnode
;
4767 DoMethod(data
->prefslistobj
, MUIM_List_GetEntry
, MUIV_List_GetEntry_Active
, &plnode
);
4772 switch(plnode
->chunkid
)
4774 case IFFFORM_STACKCFG
:
4777 case IFFFORM_DEVICECFG
:
4778 result
= MUI_RequestA(data
->appobj
, data
->winobj
, 0, NULL
, _(MSG_ACTION_CFG_REMOVE
),_(MSG_ACTION_CFG_REMOVE_HELP
), &plnode
->devid
);
4781 pic
= psdFindCfgForm(NULL
, plnode
->chunkid
);
4784 if(psdMatchStringChunk(pic
, IFFCHNK_DEVID
, plnode
->devid
))
4789 pic
= psdNextCfgForm(pic
);
4794 case IFFFORM_CLASSCFG
:
4795 result
= MUI_RequestA(data
->appobj
, data
->winobj
, 0, NULL
, _(MSG_ACTION_CFG_REMOVE
),_(MSG_ACTION_CFG_REMOVE_DEFAULT
), &plnode
->owner
);
4798 pic
= psdFindCfgForm(NULL
, IFFFORM_CLASSCFG
);
4801 if(psdMatchStringChunk(pic
, IFFCHNK_OWNER
, plnode
->owner
))
4806 pic
= psdNextCfgForm(pic
);
4811 case IFFFORM_DEVCFGDATA
:
4812 result
= MUI_Request(data
->appobj
, data
->winobj
, 0, NULL
, _(MSG_ACTION_CFG_REMOVE
),_(MSG_ACTION_CFG_REMOVE_CLASS
), plnode
->owner
, plnode
->devid
);
4815 pic
= psdFindCfgForm(NULL
, IFFFORM_DEVICECFG
);
4818 if(psdMatchStringChunk(pic
, IFFCHNK_DEVID
, plnode
->devid
))
4820 pic
= psdFindCfgForm(pic
, plnode
->chunkid
);
4823 if(psdMatchStringChunk(pic
, IFFCHNK_OWNER
, plnode
->owner
))
4828 pic
= psdNextCfgForm(pic
);
4832 pic
= psdNextCfgForm(pic
);
4837 case IFFFORM_IFCFGDATA
:
4838 result
= MUI_Request(data
->appobj
, data
->winobj
, 0, NULL
, _(MSG_ACTION_CFG_REMOVE
),_(MSG_ACTION_CFG_REMOVE_CLASS_DEF
),
4839 plnode
->owner
, plnode
->ifid
, plnode
->devid
);
4842 pic
= psdFindCfgForm(NULL
, IFFFORM_DEVICECFG
);
4845 if(psdMatchStringChunk(pic
, IFFCHNK_DEVID
, plnode
->devid
))
4847 pic
= psdFindCfgForm(pic
, plnode
->chunkid
);
4850 if(psdMatchStringChunk(pic
, IFFCHNK_IFID
, plnode
->ifid
))
4852 if(psdMatchStringChunk(pic
, IFFCHNK_OWNER
, plnode
->owner
))
4858 pic
= psdNextCfgForm(pic
);
4862 pic
= psdNextCfgForm(pic
);
4867 case IFFCHNK_FORCEDBIND
:
4868 psdSetForcedBinding(NULL
, plnode
->devid
, plnode
->ifid
);
4874 result
= MUI_RequestA(data
->appobj
, data
->winobj
, 0, NULL
, _(MSG_ACTION_CFG_REMOVE
),_(MSG_ACTION_CFG_REMOVE_UNKNOWN
), NULL
);
4877 pic
= psdFindCfgForm(NULL
, plnode
->chunkid
);
4891 /* /// "Action_Cfg_Export()" */
4892 IPTR
Action_Cfg_Export(struct IClass
*cl
, Object
*obj
, Msg msg
)
4894 struct ActionData
*data
= INST_DATA(cl
, obj
);
4895 struct PrefsListEntry
*plnode
;
4896 struct FileRequester
*aslreq
;
4898 struct TagItem asltags
[] = { { ASLFR_InitialFile
, __(MSG_ACTION_CFG_PREFS_FILE
) },
4899 { ASLFR_InitialDrawer
, (IPTR
) "SYS:Prefs/Presets/Poseidon" },
4900 { ASLFR_TitleText
, __(MSG_ACTION_CFG_EXPORT
) },
4901 { ASLFR_DoSaveMode
, (IPTR
) TRUE
},
4902 { TAG_END
, (IPTR
) NULL
} };
4906 DoMethod(data
->prefslistobj
, MUIM_List_GetEntry
, MUIV_List_GetEntry_Active
, &plnode
);
4910 switch(plnode
->chunkid
)
4912 case IFFFORM_STACKCFG
:
4913 asltags
[0].ti_Data
= __(MSG_ACTION_STACKCFG_FILE
);
4914 pic
= psdFindCfgForm(NULL
, plnode
->chunkid
);
4917 case IFFFORM_DEVICECFG
:
4918 asltags
[0].ti_Data
= __(MSG_ACTION_DEVICECFG_FILE
);
4919 pic
= psdFindCfgForm(NULL
, plnode
->chunkid
);
4922 if(psdMatchStringChunk(pic
, IFFCHNK_DEVID
, plnode
->devid
))
4926 pic
= psdNextCfgForm(pic
);
4930 case IFFFORM_CLASSCFG
:
4931 asltags
[0].ti_Data
= __(MSG_ACTION_CLASSCFG_FILE
);
4932 pic
= psdFindCfgForm(NULL
, plnode
->chunkid
);
4935 if(psdMatchStringChunk(pic
, IFFCHNK_OWNER
, plnode
->owner
))
4939 pic
= psdNextCfgForm(pic
);
4943 case IFFFORM_DEVCFGDATA
:
4944 asltags
[0].ti_Data
= __(MSG_ACTION_DEVCFGDATA_FILE
);
4945 pic
= psdFindCfgForm(NULL
, IFFFORM_DEVICECFG
);
4948 if(psdMatchStringChunk(pic
, IFFCHNK_DEVID
, plnode
->devid
))
4950 pic
= psdFindCfgForm(pic
, plnode
->chunkid
);
4953 if(psdMatchStringChunk(pic
, IFFCHNK_OWNER
, plnode
->owner
))
4957 pic
= psdNextCfgForm(pic
);
4961 pic
= psdNextCfgForm(pic
);
4965 case IFFFORM_IFCFGDATA
:
4966 asltags
[0].ti_Data
= __(MSG_ACTION_IFCFGDATA_FILE
);
4967 pic
= psdFindCfgForm(NULL
, IFFFORM_DEVICECFG
);
4970 if(psdMatchStringChunk(pic
, IFFCHNK_DEVID
, plnode
->devid
))
4972 pic
= psdFindCfgForm(pic
, plnode
->chunkid
);
4975 if(psdMatchStringChunk(pic
, IFFCHNK_IFID
, plnode
->ifid
))
4977 if(psdMatchStringChunk(pic
, IFFCHNK_OWNER
, plnode
->owner
))
4982 pic
= psdNextCfgForm(pic
);
4986 pic
= psdNextCfgForm(pic
);
4990 case IFFCHNK_FORCEDBIND
:
4996 pic
= psdFindCfgForm(NULL
, plnode
->chunkid
);
5004 if((aslreq
= MUI_AllocAslRequest(ASL_FileRequest
, asltags
)))
5006 if(MUI_AslRequest(aslreq
, TAG_END
))
5008 strcpy(path
, aslreq
->fr_Drawer
);
5009 AddPart(path
, aslreq
->fr_File
, 256);
5010 fh
= Open(path
, MODE_NEWFILE
);
5013 form
= psdWriteCfg(pic
);
5016 Write(fh
, form
, form
[1]+8);
5021 psdAddErrorMsg(RETURN_FAIL
, _(MSG_APP_TITLE
), _(MSG_ACTION_CFG_FAIL
), path
);
5024 MUI_FreeAslRequest(aslreq
);
5032 /* /// "Action_Cfg_Import()" */
5033 IPTR
Action_Cfg_Import(struct IClass
*cl
, Object
*obj
, Msg msg
)
5035 struct ActionData
*data
= INST_DATA(cl
, obj
);
5036 struct PrefsListEntry
*plnode
;
5037 struct FileRequester
*aslreq
;
5044 struct TagItem asltags
[] = { { ASLFR_InitialDrawer
, (IPTR
) "SYS:Prefs/Presets/Poseidon" },
5045 { ASLFR_TitleText
, __(MSG_ACTION_CFG_IMPORT
) },
5046 { TAG_END
, (IPTR
) NULL
} };
5048 DoMethod(data
->prefslistobj
, MUIM_List_GetEntry
, MUIV_List_GetEntry_Active
, &plnode
);
5050 if((aslreq
= MUI_AllocAslRequest(ASL_FileRequest
, asltags
)))
5052 if(MUI_AslRequest(aslreq
, TAG_END
))
5054 strcpy(path
, aslreq
->fr_Drawer
);
5055 AddPart(path
, aslreq
->fr_File
, 256);
5056 fh
= Open(path
, MODE_OLDFILE
);
5059 Read(fh
, iffhead
, 12);
5060 if(AROS_LONG2BE(iffhead
[0]) == ID_FORM
)
5062 buff
= psdAllocVec(AROS_LONG2BE(iffhead
[1])+8);
5065 buff
[0] = iffhead
[0];
5066 buff
[1] = iffhead
[1];
5067 buff
[2] = iffhead
[2];
5068 if(Read(fh
, &buff
[3], AROS_LONG2BE(iffhead
[1])-4) == AROS_LONG2BE(iffhead
[1])-4)
5072 case IFFFORM_STACKCFG
:
5073 pic
= psdFindCfgForm(NULL
, AROS_LONG2BE(buff
[2]));
5076 psdReadCfg(pic
, buff
);
5078 psdAddCfgEntry(NULL
, buff
);
5082 case IFFFORM_DEVICECFG
:
5083 case IFFFORM_CLASSCFG
:
5084 psdAddCfgEntry(NULL
, buff
);
5087 case IFFFORM_DEVCFGDATA
:
5088 case IFFFORM_IFCFGDATA
:
5091 if((plnode
->chunkid
== AROS_LONG2BE(buff
[2])) ||
5092 (plnode
->chunkid
== IFFFORM_DEVICECFG
) ||
5093 (plnode
->chunkid
== IFFFORM_IFCFGDATA
))
5095 pic
= psdFindCfgForm(NULL
, IFFFORM_DEVICECFG
);
5098 if(psdMatchStringChunk(pic
, IFFCHNK_DEVID
, plnode
->devid
))
5100 psdAddCfgEntry(pic
, buff
);
5103 pic
= psdNextCfgForm(pic
);
5108 MUI_RequestA(data
->appobj
, data
->winobj
, 0, NULL
, _(MSG_ACTION_CFGDATA_OOPS
),_(MSG_ACTION_CFGDATA_OOPS_HELP
), NULL
);
5111 case IFFFORM_PSDCFG
:
5112 psdLoadCfgFromDisk(path
);
5116 MUI_RequestA(data
->appobj
, data
->winobj
, 0, NULL
, _(MSG_ACTION_CFGDATA_OOPS
),_(MSG_ACTION_CFGDATA_ERR
), NULL
);
5120 psdAddErrorMsg(RETURN_ERROR
, _(MSG_APP_TITLE
), _(MSG_ACTION_CFGDATA_ERR_READ
), path
);
5124 psdAddErrorMsg(RETURN_ERROR
, _(MSG_APP_TITLE
), _(MSG_ACTION_CFGDATA_ERR_ALLOC
), path
);
5127 psdAddErrorMsg(RETURN_ERROR
, _(MSG_APP_TITLE
), _(MSG_ACTION_CFGDATA_ERR_IFF
), path
);
5131 psdAddErrorMsg(RETURN_FAIL
, _(MSG_APP_TITLE
), _(MSG_ACTION_CFGDATA_ERR_OPEN
), path
);
5134 MUI_FreeAslRequest(aslreq
);
5140 /* /// "ActionDispatcher()" */
5141 AROS_UFH3(IPTR
, ActionDispatcher
,
5142 AROS_UFHA(struct IClass
*, cl
, A0
),
5143 AROS_UFHA(Object
*, obj
, A2
),
5144 AROS_UFHA(Msg
, msg
, A1
))
5147 // There should never be an uninitialized pointer, but just in case, try to get an mungwall hit if so.
5148 struct ActionData
*data
= (struct ActionData
*) 0xABADCAFE;
5150 // on OM_NEW the obj pointer will be void, so don't try to get the data base in this case.
5151 if(msg
->MethodID
!= OM_NEW
) data
= INST_DATA(cl
, obj
);
5153 switch(msg
->MethodID
)
5156 return((IPTR
) Action_OM_NEW(cl
, obj
, msg
));
5159 return(Action_Setup(cl
, obj
, msg
));
5162 //MUI_RejectIDCMP(obj, IDCMP_INTUITICKS);
5163 while(data
->OnlUpdTask
)
5167 DoMethod(data
->appobj
, MUIM_Application_RemInputHandler
, &data
->eventihn
);
5168 data
->appobj
= NULL
;
5169 data
->winobj
= NULL
;
5170 return(DoSuperMethodA(cl
,obj
,msg
));
5173 Action_OM_DISPOSE(cl
, obj
, msg
);
5176 case MUIM_Action_HandlePsdEvents
:
5180 case MUIM_Action_CloseSubWinReq
:
5182 struct DefListEntry
*winnode
;
5183 winnode
= (struct DefListEntry
*) ((struct opSet
*) msg
)->ops_AttrList
;
5184 if(winnode
->infowindow
)
5186 set(winnode
->infowindow
, MUIA_Window_Open
, FALSE
);
5187 DoMethod(data
->appobj
, OM_REMMEMBER
, winnode
->infowindow
);
5188 DoMethod(winnode
->infowindow
, OM_DISPOSE
);
5189 winnode
->infowindow
= NULL
;
5194 case MUIM_Action_Cfg_Changed
:
5195 return(Action_Cfg_Changed(cl
, obj
, msg
));
5197 case MUIM_Action_Cfg_Snd_Changed
:
5198 return(Action_Cfg_Snd_Changed(cl
, obj
, msg
));
5200 case MUIM_Action_HW_New
:
5201 return(Action_HW_New(cl
, obj
, msg
));
5203 case MUIM_Action_HW_Copy
:
5204 return(Action_HW_Copy(cl
, obj
, msg
));
5206 case MUIM_Action_HW_Del
:
5207 return(Action_HW_Del(cl
, obj
, msg
));
5209 case MUIM_Action_HW_Update
:
5210 return(Action_HW_Update(cl
, obj
, msg
));
5212 case MUIM_Action_HW_Activate
:
5213 return(Action_HW_Activate(cl
, obj
, msg
));
5215 case MUIM_Action_HW_Info
:
5216 return(Action_HW_Info(cl
, obj
, msg
));
5218 case MUIM_Action_HW_Online
:
5219 return(Action_HW_Online(cl
, obj
, msg
));
5221 case MUIM_Action_HW_Offline
:
5222 return(Action_HW_Offline(cl
, obj
, msg
));
5224 case MUIM_Action_Online
:
5225 return(Action_Online(cl
, obj
, msg
));
5227 case MUIM_Action_Offline
:
5228 return(Action_Offline(cl
, obj
, msg
));
5230 case MUIM_Action_Restart
:
5231 return(Action_Restart(cl
, obj
, msg
));
5233 case MUIM_Action_ChgErrLevel
:
5234 return(Action_ChgErrLevel(cl
, obj
, msg
));
5236 case MUIM_Action_SaveErrors
:
5237 return(Action_SaveErrors(cl
, obj
, msg
));
5239 case MUIM_Action_FlushErrors
:
5240 return(Action_FlushErrors(cl
, obj
, msg
));
5242 case MUIM_Action_SaveDeviceList
:
5243 return(Action_SaveDeviceList(cl
, obj
, msg
));
5245 case MUIM_Action_Use
:
5246 InternalCreateConfigGUI(data
);
5247 psdSaveCfgToDisk("ENV:PsdStackloader", TRUE
);
5248 psdSaveCfgToDisk("ENV:Sys/poseidon.prefs", FALSE
);
5251 case MUIM_Action_LoadPrefs
:
5252 return(Action_LoadPrefs(cl
, obj
, msg
));
5254 case MUIM_Action_SavePrefsAs
:
5255 return(Action_SavePrefsAs(cl
, obj
, msg
));
5257 case MUIM_Action_SavePrefs
:
5258 return(Action_SavePrefs(cl
, obj
, msg
));
5260 case MUIM_Action_Prefs_Changed
:
5261 return(Action_Prefs_Changed(cl
, obj
, msg
));
5263 case MUIM_Action_UseQuit
:
5264 return(Action_UseQuit(cl
, obj
, msg
));
5266 case MUIM_Action_SaveQuit
:
5267 return(Action_SaveQuit(cl
, obj
, msg
));
5269 case MUIM_Action_LoadPrefsFrom
:
5270 return(Action_LoadPrefsFrom(cl
, obj
, msg
));
5272 case MUIM_Action_SavePrefsTo
:
5273 return(Action_SavePrefsTo(cl
, obj
, msg
));
5275 case MUIM_Action_Dev_Activate
:
5276 return(Action_Dev_Activate(cl
, obj
, msg
));
5278 case MUIM_Action_Dev_Bind
:
5279 return(Action_Dev_Bind(cl
, obj
, msg
));
5281 case MUIM_Action_Dev_Unbind
:
5282 return(Action_Dev_Unbind(cl
, obj
, msg
));
5284 case MUIM_Action_Dev_Suspend
:
5285 return(Action_Dev_Suspend(cl
, obj
, msg
));
5287 case MUIM_Action_Dev_Resume
:
5288 return(Action_Dev_Resume(cl
, obj
, msg
));
5290 case MUIM_Action_Dev_PowerCycle
:
5291 return(Action_Dev_PowerCycle(cl
, obj
, msg
));
5293 case MUIM_Action_Dev_Disable
:
5294 return(Action_Dev_Disable(cl
, obj
, msg
));
5296 case MUIM_Action_Dev_ForceBind
:
5297 return(Action_Dev_ForceBind(cl
, obj
, msg
));
5299 case MUIM_Action_Dev_Info
:
5300 return(Action_Dev_Info(cl
, obj
, msg
));
5302 case MUIM_Action_Dev_Configure
:
5303 return(Action_Dev_Configure(cl
, obj
, msg
));
5305 case MUIM_Action_Cls_Activate
:
5306 return(Action_Cls_Activate(cl
, obj
, msg
));
5308 case MUIM_Action_Cls_Add
:
5309 return(Action_Cls_Add(cl
, obj
, msg
));
5311 case MUIM_Action_Cls_Remove
:
5312 return(Action_Cls_Remove(cl
, obj
, msg
));
5314 case MUIM_Action_Cls_Scan
:
5315 return(Action_Cls_Scan(cl
, obj
, msg
));
5317 case MUIM_Action_Cls_Configure
:
5318 return(Action_Cls_Configure(cl
, obj
, msg
));
5320 case MUIM_Action_Info_MemPool
:
5321 return(Action_Info_MemPool(cl
, obj
, msg
));
5323 case MUIM_Action_About
:
5324 DoMethod(data
->cfgpagelv
, MUIM_Set
, MUIA_List_Active
, 0);
5327 case MUIM_Action_WakeUp
:
5328 set(data
->appobj
, MUIA_Application_Iconified
, FALSE
);
5329 DoMethod(data
->winobj
, MUIM_Window_ToFront
);
5330 set(data
->winobj
, MUIA_Window_Activate
, TRUE
);
5333 case MUIM_Action_Cfg_Activate
:
5334 return(Action_Cfg_Activate(cl
, obj
, msg
));
5336 case MUIM_Action_Cfg_Remove
:
5337 return(Action_Cfg_Remove(cl
, obj
, msg
));
5339 case MUIM_Action_Cfg_Export
:
5340 return(Action_Cfg_Export(cl
, obj
, msg
));
5342 case MUIM_Action_Cfg_Import
:
5343 return(Action_Cfg_Import(cl
, obj
, msg
));
5346 return(DoSuperMethodA(cl
,obj
,msg
));