fix some flag usage in mmakefiles. provide suitable names for amiga hardware devices...
[AROS.git] / workbench / tools / SysExplorer / Modules / Storage / storageunit_window_cl.c
blobbf3f6db5c78ad9ca3e342175a8afb367a455a781
1 /*
2 Copyright (C) 2018, The AROS Development Team.
3 $Id$
4 */
6 #include <aros/debug.h>
8 #define MUIMASTER_YES_INLINE_STDARG
10 #include <proto/alib.h>
11 #include <proto/exec.h>
12 #include <proto/muimaster.h>
13 #include <proto/utility.h>
14 #include <proto/intuition.h>
16 #include <exec/memory.h>
17 #include <libraries/mui.h>
18 #include <zune/customclasses.h>
19 #include <mui/NFloattext_mcc.h>
20 #include <utility/tagitem.h>
21 #include <utility/hooks.h>
23 #include "locale.h"
25 #include "storage_classes.h"
26 #include "storage_intern.h"
28 #include <ctype.h>
29 #include <stdio.h>
30 #include <stdlib.h>
32 #if (1) // TODO : Move into libbase
33 extern OOP_AttrBase HiddStorageUnitAB;
34 #endif
36 /*** Instance Data **********************************************************/
37 struct StorageUnitWindow_DATA
39 /* Nothing to add */
42 static const char *const unitTypeNames[] =
44 "Unknown" ,
45 "Raid Array" ,
46 "Fixed Disk" ,
47 "Solid State Disk" ,
48 "Optical Disc" ,
49 "Magnetic Tape" ,
50 NULL
53 static Object *StorageUnitWindow__OM_NEW(Class *cl, Object *self, struct opSet *msg)
55 OOP_Object *dev = (OOP_Object *)GetTagData(MUIA_PropertyWin_Object, 0, msg->ops_AttrList);
56 IPTR model, revision, serial;
57 IPTR unitdev, val;
58 char unit_str[32];
59 const char *type;
60 LONG removable;
62 if (!dev)
63 return NULL;
65 /* Generic Storage attributes ... */
66 OOP_GetAttr(dev, aHidd_StorageUnit_Type, &val);
67 if (val < 6)
68 type = unitTypeNames[val];
69 else
70 type = unitTypeNames[0];
72 OOP_GetAttr(dev, aHidd_StorageUnit_Model , &model);
73 OOP_GetAttr(dev, aHidd_StorageUnit_Revision, &revision);
74 OOP_GetAttr(dev, aHidd_StorageUnit_Serial , &serial);
76 removable = OOP_GET(dev, aHidd_StorageUnit_Removable) ? IDS_SELECTED : IDS_NORMAL;
78 OOP_GetAttr(dev, aHidd_StorageUnit_Device, &unitdev);
79 OOP_GetAttr(dev, aHidd_StorageUnit_Number, &val);
80 snprintf(unit_str, sizeof(unit_str), "%s/%ld", (char *)unitdev, val);
82 return (Object *) DoSuperNewTags
84 cl, self, NULL,
85 MUIA_Window_Title, "Unit Properties",
86 MUIA_Window_ID, MAKE_ID('S', 'U', 'N', 'P'),
87 WindowContents, (IPTR)MUI_NewObject(MUIC_Group,
88 MUIA_Group_SameSize, TRUE,
89 Child, (IPTR)(ColGroup(2),
90 MUIA_Group_SameSize, TRUE,
91 MUIA_FrameTitle, __(MSG_GENERAL),
92 GroupFrame,
93 MUIA_Background, MUII_GroupBack,
94 Child, (IPTR)Label("Unit"),
95 Child, (IPTR)(TextObject,
96 TextFrame,
97 MUIA_Background, MUII_TextBack,
98 MUIA_CycleChain, 1,
99 MUIA_Text_Contents, (IPTR)unit_str,
100 End),
101 Child, (IPTR)Label("Type"),
102 Child, (IPTR)(TextObject,
103 TextFrame,
104 MUIA_Background, MUII_TextBack,
105 MUIA_CycleChain, 1,
106 MUIA_Text_Contents, (IPTR)type,
107 End),
108 Child, (IPTR)Label(_(MSG_MODEL)),
109 Child, (IPTR)(TextObject,
110 TextFrame,
111 MUIA_Background, MUII_TextBack,
112 MUIA_CycleChain, 1,
113 MUIA_Text_Contents, model,
114 End),
115 Child, (IPTR)Label(_(MSG_REVISION)),
116 Child, (IPTR)(TextObject,
117 TextFrame,
118 MUIA_Background, MUII_TextBack,
119 MUIA_CycleChain, 1,
120 MUIA_Text_Contents, revision,
121 End),
122 Child, (IPTR)Label(_(MSG_SERIAL)),
123 Child, (IPTR)(TextObject,
124 TextFrame,
125 MUIA_Background, MUII_TextBack,
126 MUIA_CycleChain, 1,
127 MUIA_Text_Contents, serial,
128 End),
129 Child, (IPTR)Label(_(MSG_REMOVABLE)),
130 Child, (IPTR)(HGroup,
131 Child, (IPTR)(ImageObject,
132 MUIA_Image_Spec, MUII_CheckMark,
133 MUIA_Image_State, removable,
134 TextFrame,
135 MUIA_CycleChain, 1,
136 MUIA_Background, MUII_TextBack,
137 End),
138 Child, (IPTR)HSpace(0),
139 End),
140 End),
141 TAG_MORE, (IPTR) msg->ops_AttrList,
142 TAG_DONE),
143 TAG_DONE
147 /*** Setup ******************************************************************/
148 ZUNE_CUSTOMCLASS_1
150 StorageUnitWindow, NULL, MUIC_Window, NULL,
151 OM_NEW, struct opSet *