wip prep commit in lieu of gfx subsystem update changes.
[AROS.git] / workbench / tools / SysExplorer / gfx_window_cl.c
blob8cf13dd6590ca3fd8320df17cbbae51c23e4ab2e
1 /*
2 Copyright (C) 2013-2017, The AROS Development Team.
3 $Id$
4 */
6 #define MUIMASTER_YES_INLINE_STDARG
8 #include <exec/memory.h>
9 #include <hidd/hidd.h>
10 #include <hidd/gfx.h>
11 #include <libraries/mui.h>
12 #include <mui/NFloattext_mcc.h>
13 #include <utility/tagitem.h>
14 #include <utility/hooks.h>
16 #include <proto/alib.h>
17 #include <proto/exec.h>
18 #include <proto/muimaster.h>
19 #include <proto/utility.h>
20 #include <proto/intuition.h>
22 #include <ctype.h>
23 #include <stdio.h>
24 #include <stdlib.h>
26 #include "classes.h"
27 #include "cpuspecific.h"
28 #include "locale.h"
30 #include <zune/customclasses.h>
32 /*** Instance Data **********************************************************/
33 struct GfxWindow_DATA
35 Object *memTotal;
36 Object *memFree;
37 Object *GARTTotal;
38 Object *GARTFree;
39 struct TagItem gfxMemTags[12];
42 static Object *GfxWindow__OM_NEW(Class *cl, Object *self, struct opSet *msg)
44 STRPTR pagetitles[3] =
46 "General",
47 "Capabilities",
48 NULL
50 Object *memTotal, *memFree, *GARTTotal, *GARTFree;
51 IPTR name, driver;
52 OOP_Object *gfxhidd_obj =
53 (OOP_Object *)GetTagData(MUIA_PropertyWin_Object, 0, msg->ops_AttrList);
55 OOP_GetAttr(gfxhidd_obj, aHidd_HardwareName, &name);
56 OOP_GetAttr(gfxhidd_obj, aHidd_Name, &driver);
58 self = (Object *) DoSuperNewTags
60 cl, self, NULL,
61 MUIA_Window_Title, name,
62 MUIA_Window_ID, MAKE_ID('G', 'F', 'X', 'D'),
63 WindowContents, (IPTR)(RegisterObject,
64 MUIA_Register_Titles, (IPTR) pagetitles,
65 Child, (VGroup,
66 Child, (VGroup,
67 GroupFrameT("Details"),
68 Child, ColGroup(2),
69 Child, Label("Device:"),
70 Child, LLabel(name),
71 Child, Label("Manufacturer:"),
72 Child, LLabel(""),
73 Child, Label("Driver:"),
74 Child, LLabel(driver),
75 End,
76 End),
77 Child, (HGroup,
78 GroupFrameT("Memory Information"),
79 Child, (VGroup,
80 Child, Label(""),
81 Child, Label("Video RAM"),
82 Child, Label("GART"),
83 End),
84 Child, (ColGroup(2),
85 Child, Label("Total"),
86 Child, Label("Free"),
87 Child, (IPTR)(memTotal = TextObject, TextFrame, MUIA_Background, MUII_TextBack,
88 MUIA_Text_PreParse, (IPTR)"\33r", MUIA_Text_Contents, (IPTR)"N/A",
89 End),
90 Child, (IPTR)(memFree = TextObject, TextFrame, MUIA_Background, MUII_TextBack,
91 MUIA_Text_PreParse, (IPTR)"\33r", MUIA_Text_Contents, (IPTR)"",
92 End),
93 Child, (IPTR)(GARTTotal = TextObject, TextFrame, MUIA_Background, MUII_TextBack,
94 MUIA_Text_PreParse, (IPTR)"\33r", MUIA_Text_Contents, (IPTR)"N/A",
95 End),
96 Child, (IPTR)(GARTFree = TextObject, TextFrame, MUIA_Background, MUII_TextBack,
97 MUIA_Text_PreParse, (IPTR)"\33r", MUIA_Text_Contents, (IPTR)"",
98 End),
99 End),
100 End),
101 End),
102 Child, (VGroup,
103 Child, HVSpace,
104 End),
105 End),
106 TAG_DONE
109 if (self)
111 struct GfxWindow_DATA *data = INST_DATA(cl, self);
112 char valBuf[20];
113 data->memTotal = memTotal;
114 data->memFree = memFree;
115 data->GARTTotal = GARTTotal;
116 data->GARTFree = GARTFree;
118 data->gfxMemTags[0].ti_Tag = vHidd_Gfx_MemTotal;
119 data->gfxMemTags[1].ti_Tag = vHidd_Gfx_MemFree;
120 data->gfxMemTags[2].ti_Tag = vHidd_Gfx_MemAddressableTotal;
121 data->gfxMemTags[3].ti_Tag = vHidd_Gfx_MemAddressableFree;
122 data->gfxMemTags[4].ti_Tag = vHidd_Gfx_MemClock;
123 data->gfxMemTags[5].ti_Tag = TAG_DONE;
125 OOP_GetAttr(gfxhidd_obj, aHidd_Gfx_MemoryAttribs, &data->gfxMemTags);
127 if (data->gfxMemTags[0].ti_Data)
129 sprintf(valBuf, "%ld", data->gfxMemTags[0].ti_Data);
130 SET(data->memTotal, MUIA_Text_Contents, valBuf);
131 sprintf(valBuf, "%ld", data->gfxMemTags[1].ti_Data);
132 SET(data->memFree, MUIA_Text_Contents, valBuf);
134 if (data->gfxMemTags[2].ti_Data)
136 sprintf(valBuf, "%ld", data->gfxMemTags[2].ti_Data);
137 SET(data->GARTTotal, MUIA_Text_Contents, valBuf);
138 sprintf(valBuf, "%ld", data->gfxMemTags[3].ti_Data);
139 SET(data->GARTFree, MUIA_Text_Contents, valBuf);
142 return self;
145 /*** Setup ******************************************************************/
146 ZUNE_CUSTOMCLASS_1
148 GfxWindow, NULL, MUIC_Window, NULL,
149 OM_NEW, struct opSet *