grub2: bring back build of aros-side grub2 tools
[AROS.git] / workbench / utilities / MultiView / aboutclass.c
blob50f2ebc70ce9ed9cbb19a679456551dfaf6cc99d
2 #include "global.h"
4 #include <stdio.h>
5 #include <string.h>
7 static char * templBase = "%s\n%s\n%s";
9 void aboutfmt_Picture(char *fmtbuff)
11 sprintf(fmtbuff, "%s", templBase);
14 void getColorString(char **colorString, UBYTE Depth, ULONG Colors, ULONG ModeID)
16 if (Colors > 0)
18 if ((ModeID & (HAM_KEY|EXTRAHALFBRITE_KEY)) == 0)
20 *colorString = AllocVec(24, MEMF_ANY);
21 sprintf(*colorString, " Colors: %d", (int)Colors);
23 else
25 char *modeStr;
26 if (ModeID & HAM_KEY)
28 modeStr = "HAMx";
29 modeStr[3] = Depth + '0';
31 else
32 modeStr = "EHB";
34 *colorString = AllocVec(28 + strlen(modeStr), MEMF_ANY);
35 sprintf(*colorString, " Colors: %d (%s)", (int)Colors, modeStr);
38 else
40 *colorString = AllocVec(26, MEMF_ANY);
42 if (Depth > 24)
43 strcpy(*colorString, " Colors: Deepcolor");
44 else if (Depth > 16)
45 strcpy(*colorString, " Colors: Truecolor");
46 else
47 strcpy(*colorString, " Colors: Hi-color");
51 void about_Picture(Object *picture, char *details[])
53 struct BitMapHeader *pictBMH;
54 IPTR pictCols, pictMode;
56 if (GetDTAttrs(dto,
57 PDTA_ModeID, &pictMode,
58 PDTA_BitMapHeader, &pictBMH,
59 PDTA_NumColors, &pictCols, TAG_DONE))
61 details[0] = AllocVec(36, MEMF_ANY);
62 sprintf(details[0], " Dimensions: %dx%dx%d", pictBMH->bmh_Width, pictBMH->bmh_Height, pictBMH->bmh_Depth);
63 getColorString(&details[1], pictBMH->bmh_Depth, pictCols, pictMode);
64 details[2] = "";
68 void about_PicDisp(char *details[])
70 FreeVec(details[0]);
71 FreeVec(details[1]);
74 void aboutfmt_Animation(char *fmtbuff)
76 sprintf(fmtbuff, "%s", templBase);
79 void about_Animation(Object *picture, char *details[])
81 IPTR animWidth, animHeight, animDepth,
82 animCols, animMode,
83 animFrames, animFPS;
85 if (GetDTAttrs(dto,
86 ADTA_Width, &animWidth,
87 ADTA_Height, &animHeight,
88 ADTA_Depth, &animDepth,
89 ADTA_NumColors, &animCols,
90 ADTA_ModeID, &animMode,
91 ADTA_Frames, &animFrames,
92 ADTA_FramesPerSecond, &animFPS, TAG_DONE))
94 details[0] = AllocVec(36, MEMF_ANY);
95 sprintf(details[0], " Dimensions: %dx%dx%d", (int)animWidth, (int)animHeight, (int)animDepth);
96 getColorString(&details[1], animDepth, animCols, animMode);
98 details[2] = AllocVec(32, MEMF_ANY);
99 sprintf(details[2], " %d frames @ %dfps", (int)animFrames, (int)animFPS);
103 void about_AnimDisp(char *details[])
105 FreeVec(details[0]);
106 FreeVec(details[1]);
107 FreeVec(details[2]);
110 void aboutfmt_Sample(char *fmtbuff)
112 sprintf(fmtbuff, "%s", templBase);
115 void about_Sample(Object *picture, char *details[])
117 details[0] = "";
118 details[1] = "";
119 details[2] = "";
122 void about_SampDisp(char *details[])
126 void aboutfmt_Binary(char *fmtbuff)
128 sprintf(fmtbuff, "%s", templBase);
131 void about_Binary(Object *picture, char *details[])
133 details[0] = "";
134 details[1] = "";
135 details[2] = "";
138 void about_BinDisp(char *details[])
142 struct DTClassInfo DTClassAbout[] =
144 { GID_PICTURE, aboutfmt_Picture, about_Picture, about_PicDisp, 10, 3 },
145 { GID_ANIMATION, aboutfmt_Animation, about_Animation, about_AnimDisp, 10, 3 },
146 { GID_SOUND, aboutfmt_Sample, about_Sample, about_SampDisp, 10, 3 },
147 { ID_BINARY, aboutfmt_Binary, about_Binary, about_BinDisp, 10, 3 },
148 { 0 }
151 struct DTClassInfo *FindClassInfo(ULONG classid)
153 struct DTClassInfo *curHandler;
154 int i;
155 for (i = 0; (DTClassAbout[i].classID != 0); i++)
157 curHandler = &DTClassAbout[i];
158 if (classid == curHandler->classID)
160 return curHandler;
163 return NULL;