revert 213 commits (to 56092) from the last month. 10 still need work to resolve...
[AROS.git] / workbench / tools / SysExplorer / Modules / ATA / atabus_window_cl.c
blob6d272912803f2f3d8ec03b98059f4036ac39d081
1 /*
2 Copyright (C) 2013-2019, The AROS Development Team.
3 $Id: ata_window_cl.c 51417 2016-01-25 18:10:16Z NicJA $
4 */
6 #include <aros/debug.h>
8 #define MUIMASTER_YES_INLINE_STDARG
10 #include <proto/sysexp.h>
12 #include <proto/alib.h>
13 #include <proto/exec.h>
14 #include <proto/muimaster.h>
15 #include <proto/utility.h>
16 #include <proto/intuition.h>
18 #include <exec/memory.h>
19 #include <libraries/mui.h>
20 #include <zune/customclasses.h>
21 #include <mui/NFloattext_mcc.h>
22 #include <utility/tagitem.h>
23 #include <utility/hooks.h>
25 #include <hidd/ata.h>
27 #include "locale.h"
29 #include "ata_classes.h"
30 #include "ata_intern.h"
32 #include <ctype.h>
33 #include <stdio.h>
34 #include <stdlib.h>
36 extern OOP_AttrBase HiddATABusAB;
38 /*** Instance Data **********************************************************/
39 struct ATABusWindow_DATA
41 /* Nothing to add */
44 static inline void SetCheckState(Object *img, OOP_Object *dev, ULONG attr)
46 LONG state = OOP_GET(dev, attr) ? IDS_SELECTED : IDS_NORMAL;
48 SET(img, MUIA_Image_State, state);
51 static Object *ATABusWindow__OM_NEW(Class *cl, Object *self, struct opSet *msg)
53 struct SysexpATABase *AtaBase = (struct SysexpATABase *)cl->cl_UserData;
54 OOP_Object *dev = (OOP_Object *)GetTagData(MUIA_PropertyWin_Object, 0, msg->ops_AttrList);
55 LONG ioalt, pio32, use80wire, dma;
57 D(bug("[ata.sysexp] %s: cl @ %p\n", __func__, cl));
59 if ((!AtaBase) || (!dev))
60 return NULL;
62 ioalt = OOP_GET(dev, aHidd_ATABus_UseIOAlt) ? IDS_SELECTED : IDS_NORMAL;
63 pio32 = OOP_GET(dev, aHidd_ATABus_Use32Bit) ? IDS_SELECTED : IDS_NORMAL;
64 use80wire = OOP_GET(dev, aHidd_ATABus_Use80Wire) ? IDS_SELECTED : IDS_NORMAL;
65 dma = OOP_GET(dev, aHidd_ATABus_UseDMA) ? IDS_SELECTED : IDS_NORMAL;
67 return (Object *) DoSuperNewTags
69 cl, self, NULL,
70 Child, (IPTR)(ColGroup(3),
71 MUIA_Group_SameSize, TRUE,
72 MUIA_FrameTitle, (IPTR)"IDE/ATA",
73 GroupFrame,
74 MUIA_Background, MUII_GroupBack,
75 Child, (IPTR)Label(_(MSG_USE_IOALT)),
76 Child, (IPTR)(ImageObject,
77 MUIA_Image_Spec, MUII_CheckMark,
78 MUIA_Image_State, ioalt,
79 TextFrame,
80 MUIA_CycleChain, 1,
81 MUIA_Background, MUII_TextBack,
82 End),
83 Child, (IPTR)HSpace(0),
84 Child, (IPTR)Label(_(MSG_USE_32BIT)),
85 Child, (IPTR)(ImageObject,
86 MUIA_Image_Spec, MUII_CheckMark,
87 MUIA_Image_State, pio32,
88 TextFrame,
89 MUIA_CycleChain, 1,
90 MUIA_Background, MUII_TextBack,
91 End),
92 Child, (IPTR)HSpace(0),
93 Child, (IPTR)Label(_(MSG_USE_80WIRE)),
94 Child, (IPTR)(ImageObject,
95 MUIA_Image_Spec, MUII_CheckMark,
96 MUIA_Image_State, use80wire,
97 TextFrame,
98 MUIA_CycleChain, 1,
99 MUIA_Background, MUII_TextBack,
100 End),
101 Child, (IPTR)HSpace(0),
102 Child, (IPTR)Label(_(MSG_USE_DMA)),
103 Child, (IPTR)(ImageObject,
104 MUIA_Image_Spec, MUII_CheckMark,
105 MUIA_Image_State, dma,
106 TextFrame,
107 MUIA_CycleChain, 1,
108 MUIA_Background, MUII_TextBack,
109 End),
110 Child, (IPTR)HSpace(0),
111 End),
112 TAG_MORE, (IPTR) msg->ops_AttrList,
113 TAG_DONE
117 /*** Setup ******************************************************************/
118 BOOPSI_DISPATCHER_PROTO(IPTR, ATABusWindow_Dispatcher, __class, __self, __msg);
119 BOOPSI_DISPATCHER(IPTR, ATABusWindow_Dispatcher, __class, __self, __msg)
121 switch (__msg->MethodID)
123 case OM_NEW:
124 return (IPTR) ATABusWindow__OM_NEW(__class, __self, (struct opSet *)__msg);
126 default:
127 return DoSuperMethodA(__class, __self, __msg);
130 return (IPTR) NULL;
132 BOOPSI_DISPATCHER_END
134 int ATABusWindow_Initialize(struct SysexpBase *SysexpBase)
136 struct SysexpATABase *AtaBase = GetBase("ATA.Module");
137 struct MUI_CustomClass *SBWClass;
139 D(bug("[ata.sysexp] %s: AtaBase @ %p\n", __func__, AtaBase));
141 if (AtaBase)
143 SBWClass = GetBase("StorageBusWindow.Class");
144 D(bug("[ata.sysexp] %s: StorageBusWindow.Class @ %p\n", __func__, SBWClass));
145 AtaBase->seab_ATABusWindowCLASS = MUI_CreateCustomClass
147 NULL, NULL, SBWClass,
148 sizeof(struct ATABusWindow_DATA), (APTR) ATABusWindow_Dispatcher
150 if (AtaBase->seab_ATABusWindowCLASS)
152 D(bug("[ata.sysexp] %s: ATABusWindowCLASS @ %p\n", __func__, AtaBase->seab_ATABusWindowCLASS));
153 AtaBase->seab_ATABusWindowCLASS->mcc_Class->cl_UserData = (IPTR)AtaBase;
156 if (!AtaBase || !AtaBase->seab_ATABusWindowCLASS)
158 __showerror
159 ( (char *)
160 "Failed to create `ATABusWindow' custom class.", NULL
163 return 0;
166 return 1;
169 void ATABusWindow_Deinitialize(struct SysexpBase *SysexpBase)
171 struct SysexpATABase *AtaBase = GetBase("ATA.Module");
172 MUI_DeleteCustomClass(AtaBase->seab_ATABusWindowCLASS);