revert between 56095 -> 55830 in arch
[AROS.git] / workbench / prefs / Zune / specialp.c
blob7dba831603302ec2e004218ca688967defc7f653
1 /*
2 Copyright © 2003-2006, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <graphics/gfx.h>
7 #include <graphics/view.h>
8 #include <clib/alib_protos.h>
9 #include <libraries/asl.h>
10 #include <libraries/mui.h>
11 #include <mui/Rawimage_mcc.h>
12 #include <proto/exec.h>
13 #include <proto/graphics.h>
14 #include <proto/utility.h>
15 #include <proto/intuition.h>
16 #include <proto/muimaster.h>
18 #ifdef __AROS__
19 #include <proto/alib.h>
20 #endif
22 #include "zunestuff.h"
23 #include <string.h>
25 /* #define DEBUG 1 */
26 /* #include <aros/debug.h> */
28 extern struct Library *MUIMasterBase;
30 #define NBIMAGES 14
32 struct MUI_SpecialPData
34 Object *text_popframe;
35 Object *text_popimage;
36 Object *gauge_popframe;
37 Object *gauge;
38 Object *popimage[NBIMAGES];
41 ULONG Imagecfg[NBIMAGES] =
43 MUICFG_Image_Drawer,
44 MUICFG_Image_HardDisk,
45 MUICFG_Image_Disk,
46 MUICFG_Image_Chip,
47 MUICFG_Image_Volume,
48 MUICFG_Image_Network,
49 MUICFG_Image_Assign,
50 MUICFG_Image_TapePlay,
51 MUICFG_Image_TapePlayBack,
52 MUICFG_Image_TapePause,
53 MUICFG_Image_TapeStop,
54 MUICFG_Image_TapeRecord,
55 MUICFG_Image_TapeUp,
56 MUICFG_Image_TapeDown,
59 static Object *MakeSpecialPopimage(CONST_STRPTR title)
61 return MUI_NewObject
63 MUIC_Popimage,
64 MUIA_Imageadjust_Type, MUIV_Imageadjust_Type_Image,
65 MUIA_CycleChain, 1,
66 MUIA_MaxWidth, 28,
67 MUIA_MaxHeight, 28,
68 MUIA_Imagedisplay_FreeHoriz, FALSE,
69 MUIA_Imagedisplay_FreeVert, FALSE,
70 MUIA_Window_Title, (IPTR)title,
71 TAG_DONE
75 static IPTR SpecialP_New(struct IClass *cl, Object *obj, struct opSet *msg)
77 struct MUI_SpecialPData *data;
78 struct MUI_SpecialPData d;
80 obj = (Object *) DoSuperNewTags
82 cl, obj, NULL,
83 MUIA_Group_Horiz, FALSE,
84 Child, (IPTR) ColGroup(2),
86 Child, (IPTR) VGroup,
87 GroupFrameT(_(MSG_TEXT_FIELDS)),
88 Child, (IPTR) HGroup,
89 MUIA_Group_SameWidth, TRUE,
90 Child, (IPTR) VGroup,
91 MUIA_Group_VertSpacing, 1,
92 Child, (IPTR) (d.text_popframe = MakePopframe()),
93 Child, (IPTR) CLabel(_(MSG_FRAME)),
94 End, // VGroup
95 Child, (IPTR) VGroup,
96 MUIA_Group_VertSpacing, 1,
97 Child, (IPTR) (d.text_popimage = MakeBackgroundPopimage()),
98 Child, (IPTR) CLabel(_(MSG_BACKGROUND)),
99 End, // VGroup
100 End, // HGroup
101 Child, (IPTR) TextObject,
102 TextFrame,
103 MUIA_Background, MUII_TextBack,
104 MUIA_Text_PreParse, (IPTR) "\33c",
105 MUIA_Text_Contents, (IPTR) _(MSG_EXAMPLE_TEXTFIELD),
106 End, // TextObject
107 End, // VGroup
108 Child, (IPTR) ColGroup(2),
109 GroupFrameT(_(MSG_PROGRESS_INDICATOR)),
110 Child, (IPTR) FreeLabel(_(MSG_FRAME_COLON)),
111 Child, (IPTR) (d.gauge_popframe = MakePopframe()),
112 Child, (IPTR) Label(_(MSG_EXAMPLE)),
113 Child, (IPTR) (d.gauge = GaugeObject, MUIA_Gauge_InfoText, "%ld %%",
114 GaugeFrame, MUIA_Gauge_Horiz, TRUE, End),
115 Child, (IPTR) VSpace(0),
116 Child, (IPTR) ScaleObject, End,
117 End, // Progress Indicator
118 End, // HGroup
119 Child, (IPTR) HGroup,
120 GroupFrameT(_(MSG_DEVICE_IMAGES)),
121 Child, (IPTR) HSpace(0),
122 Child, d.popimage[0] = MakeSpecialPopimage(_(MSG_DRAWER)),
123 Child, d.popimage[1] = MakeSpecialPopimage(_(MSG_HARDDISK)),
124 Child, d.popimage[2] = MakeSpecialPopimage(_(MSG_DISK)),
125 Child, d.popimage[3] = MakeSpecialPopimage(_(MSG_RAM)),
126 Child, d.popimage[4] = MakeSpecialPopimage(_(MSG_VOLUME)),
127 Child, d.popimage[5] = MakeSpecialPopimage(_(MSG_NETWORK)),
128 Child, d.popimage[6] = MakeSpecialPopimage(_(MSG_ASSIGN)),
129 Child, (IPTR) HSpace(0),
130 End, // Device Images
131 Child, (IPTR) HGroup,
132 GroupFrameT(_(MSG_TAPE_IMAGES)),
133 Child, (IPTR) HSpace(0),
134 Child, d.popimage[7] = MakeSpecialPopimage(_(MSG_TAPE_PLAY)),
135 Child, d.popimage[8] = MakeSpecialPopimage(_(MSG_TAPE_PLAYBACK)),
136 Child, d.popimage[9] = MakeSpecialPopimage(_(MSG_TAPE_PAUSE)),
137 Child, d.popimage[10] = MakeSpecialPopimage(_(MSG_TAPE_STOP)),
138 Child, d.popimage[11] = MakeSpecialPopimage(_(MSG_TAPE_RECORD)),
139 Child, d.popimage[12] = MakeSpecialPopimage(_(MSG_TAPE_UP)),
140 Child, d.popimage[13] = MakeSpecialPopimage(_(MSG_TAPE_DOWN)),
141 Child, (IPTR) HSpace(0),
142 End, // Tape Images
144 TAG_MORE, (IPTR) msg->ops_AttrList);
146 if (!obj) return FALSE;
148 data = INST_DATA(cl, obj);
149 *data = d;
151 return (IPTR)obj;
156 * MUIM_Settingsgroup_ConfigToGadgets
158 static IPTR SpecialP_ConfigToGadgets(struct IClass *cl, Object *obj,
159 struct MUIP_Settingsgroup_ConfigToGadgets *msg)
161 struct MUI_SpecialPData *data = INST_DATA(cl, obj);
162 STRPTR spec;
163 int i;
165 /* Frames */
166 spec = (STRPTR)DoMethod(msg->configdata, MUIM_Configdata_GetString,
167 MUICFG_Frame_Text);
168 set(data->text_popframe, MUIA_Framedisplay_Spec, (IPTR)spec);
169 spec = (STRPTR)DoMethod(msg->configdata, MUIM_Configdata_GetString,
170 MUICFG_Frame_Gauge);
171 set(data->gauge_popframe, MUIA_Framedisplay_Spec, (IPTR)spec);
173 /* Looks */
174 spec = (STRPTR)DoMethod(msg->configdata, MUIM_Configdata_GetString,
175 MUICFG_Background_Text);
176 set(data->text_popimage, MUIA_Imagedisplay_Spec, (IPTR)spec);
178 for (i = 0; i < NBIMAGES; i++)
180 spec = (STRPTR)DoMethod(msg->configdata, MUIM_Configdata_GetString,
181 Imagecfg[i]);
182 set(data->popimage[i], MUIA_Imagedisplay_Spec, (IPTR)spec);
185 return 1;
190 * MUIM_Settingsgroup_ConfigToGadgets
192 static IPTR SpecialP_GadgetsToConfig(struct IClass *cl, Object *obj,
193 struct MUIP_Settingsgroup_GadgetsToConfig *msg)
195 struct MUI_SpecialPData *data = INST_DATA(cl, obj);
196 STRPTR str;
197 int i;
199 /* Frames */
200 str = (STRPTR)XGET(data->text_popframe, MUIA_Framedisplay_Spec);
201 DoMethod(msg->configdata, MUIM_Configdata_SetFramespec, MUICFG_Frame_Text,
202 (IPTR)str);
203 str = (STRPTR)XGET(data->gauge_popframe, MUIA_Framedisplay_Spec);
204 DoMethod(msg->configdata, MUIM_Configdata_SetFramespec, MUICFG_Frame_Gauge,
205 (IPTR)str);
207 /* Looks */
208 str = (STRPTR)XGET(data->text_popimage, MUIA_Imagedisplay_Spec);
209 DoMethod(msg->configdata, MUIM_Configdata_SetImspec, MUICFG_Background_Text,
210 (IPTR)str);
212 for (i = 0; i < NBIMAGES; i++)
214 str = (STRPTR)XGET(data->popimage[i], MUIA_Imagedisplay_Spec);
215 DoMethod(msg->configdata, MUIM_Configdata_SetImspec, Imagecfg[i],
216 (IPTR)str);
218 return TRUE;
222 BOOPSI_DISPATCHER(IPTR, SpecialP_Dispatcher, cl, obj, msg)
224 switch (msg->MethodID)
226 case OM_NEW: return SpecialP_New(cl, obj, (struct opSet *)msg);
227 case MUIM_Settingsgroup_ConfigToGadgets: return SpecialP_ConfigToGadgets(cl,obj,(APTR)msg);break;
228 case MUIM_Settingsgroup_GadgetsToConfig: return SpecialP_GadgetsToConfig(cl,obj,(APTR)msg);break;
231 return DoSuperMethodA(cl, obj, msg);
233 BOOPSI_DISPATCHER_END
236 * Class descriptor.
238 const struct __MUIBuiltinClass _MUIP_Special_desc = {
239 "Special",
240 MUIC_Group,
241 sizeof(struct MUI_SpecialPData),
242 (void*)SpecialP_Dispatcher
246 static const UBYTE icon32[] =
248 0x00, 0x00, 0x00, 0x18, // width
249 0x00, 0x00, 0x00, 0x13, // height
250 'B', 'Z', '2', '\0',
251 0x00, 0x00, 0x00, 0x9c, // number of bytes
253 0x42, 0x5a, 0x68, 0x39, 0x31, 0x41, 0x59, 0x26, 0x53, 0x59, 0x4b, 0x3c,
254 0xe9, 0x24, 0x00, 0x03, 0x3b, 0xd3, 0x36, 0xa0, 0x02, 0x20, 0x00, 0x40,
255 0x00, 0x00, 0x07, 0x30, 0x00, 0x4a, 0x00, 0x00, 0x42, 0x42, 0x40, 0x00,
256 0x00, 0xb0, 0x00, 0xd8, 0x81, 0x26, 0x92, 0x9e, 0xa8, 0x06, 0x80, 0x53,
257 0x4c, 0x8c, 0x4c, 0x4c, 0x40, 0xa5, 0x22, 0x44, 0x68, 0xf4, 0x87, 0xea,
258 0x9c, 0x2a, 0xde, 0x2d, 0xe5, 0x6b, 0x29, 0x74, 0xa1, 0x79, 0x3e, 0x0d,
259 0x9e, 0x88, 0xf4, 0x46, 0x93, 0xe7, 0x22, 0xfb, 0x1d, 0x8d, 0x0f, 0xc3,
260 0xf4, 0xd1, 0xfc, 0x94, 0x38, 0x94, 0x34, 0xaa, 0x1b, 0x76, 0x18, 0xe7,
261 0x39, 0xd6, 0x6b, 0x5d, 0x2c, 0x18, 0xcc, 0xc1, 0x65, 0x82, 0xd3, 0x17,
262 0xd4, 0x25, 0xaa, 0xb0, 0x60, 0x52, 0x9a, 0x69, 0xc1, 0x9a, 0x5a, 0x40,
263 0xd6, 0x96, 0xc2, 0x0a, 0x48, 0x26, 0x1b, 0x81, 0x89, 0x11, 0x22, 0x84,
264 0x52, 0x70, 0xc2, 0x05, 0x91, 0x52, 0xb5, 0x24, 0x24, 0x7a, 0x01, 0x95,
265 0x3f, 0x8b, 0xb9, 0x22, 0x9c, 0x28, 0x48, 0x25, 0x9e, 0x74, 0x92, 0x00,
269 Object *specialclass_get_icon(void)
271 return RawimageObject,
272 MUIA_Rawimage_Data, icon32,
273 End;