revert between 56095 -> 55830 in arch
[AROS.git] / workbench / prefs / Zune / stringsp.c
blob32b99d98b081153f8977e0f329c97c9e31a8ef97
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 struct MUI_StringsPData
32 Object *string_popframe;
33 Object *popup_popimage;
34 Object *popfile_popimage;
35 Object *popdrawer_popimage;
36 Object *inactive_bg_popimage;
37 Object *inactive_text_poppen;
38 Object *active_bg_popimage;
39 Object *active_text_poppen;
40 Object *cursor_poppen;
41 Object *marked_bg_poppen;
42 Object *marked_text_poppen;
45 Object *MakePopupPopimage(CONST_STRPTR title)
47 return MUI_NewObject
49 MUIC_Popimage,
50 MUIA_Imageadjust_Type, MUIV_Imageadjust_Type_Image,
51 MUIA_CycleChain, 1,
52 MUIA_FixWidth, 28,
53 MUIA_MaxHeight, 28,
54 MUIA_Imagedisplay_FreeHoriz, FALSE,
55 MUIA_Imagedisplay_FreeVert, FALSE,
56 MUIA_Window_Title, (IPTR)title,
57 TAG_DONE
61 static IPTR StringsP_New(struct IClass *cl, Object *obj, struct opSet *msg)
63 struct MUI_StringsPData *data;
64 struct MUI_StringsPData d;
66 obj = (Object *) DoSuperNewTags
68 cl, obj, NULL,
69 MUIA_Group_Horiz, FALSE,
70 Child, (IPTR) HGroup,
71 Child, (IPTR) VGroup,
72 Child, (IPTR) HGroup,
73 GroupFrameT(_(MSG_STRING_FRAME)),
74 Child, (IPTR) (d.string_popframe = MakePopframe()),
75 End, // String Frame
76 Child, HGroup,
77 GroupFrameT(_(MSG_SPECIAL_POPUP_BUTTONS)),
78 MUIA_Group_SameWidth, TRUE,
79 Child, (IPTR) VGroup,
80 MUIA_Group_VertSpacing, 1,
81 Child, (IPTR) (d.popup_popimage = MakePopupPopimage(_(MSG_POPUP))),
82 Child, (IPTR) CLabel(_(MSG_DEFAULT)),
83 End,
84 Child, (IPTR) VGroup,
85 MUIA_Group_VertSpacing, 1,
86 Child, (IPTR) (d.popfile_popimage = MakePopupPopimage(_(MSG_POPUP_FILE))),
87 Child, (IPTR) CLabel(_(MSG_FILE)),
88 End,
89 Child, (IPTR) VGroup,
90 MUIA_Group_VertSpacing, 1,
91 Child, (IPTR) (d.popdrawer_popimage = MakePopupPopimage(_(MSG_POPUP_DRAWER))),
92 Child, (IPTR) CLabel(_(MSG_DRAWER)),
93 End,
94 End, // Special Popup Buttons
95 End, // VGroup Left
96 Child, VGroup,
97 Child, HGroup,
98 GroupFrameT(_(MSG_INACTIVE_STRING_COLORS)),
99 MUIA_Group_SameWidth, TRUE,
100 Child, (IPTR) VGroup,
101 MUIA_Group_VertSpacing, 1,
102 Child, (IPTR) (d.inactive_bg_popimage = MakeBackgroundPopimage()),
103 Child, (IPTR) CLabel(_(MSG_BACKGROUND)),
104 End,
105 Child, (IPTR) VGroup,
106 MUIA_Group_VertSpacing, 1,
107 Child, (IPTR) (d.inactive_text_poppen = MakePoppen()),
108 Child, (IPTR) CLabel(_(MSG_TEXT)),
109 End,
110 End, // Inactive String Colors
111 Child, HGroup,
112 GroupFrameT(_(MSG_ACTIVE_STRING_COLORS)),
113 MUIA_Group_SameWidth, TRUE,
114 Child, (IPTR) VGroup,
115 MUIA_Group_VertSpacing, 1,
116 Child, (IPTR) (d.active_bg_popimage = MakeBackgroundPopimage()),
117 Child, (IPTR) CLabel(_(MSG_BACKGROUND)),
118 End,
119 Child, (IPTR) VGroup,
120 MUIA_Group_VertSpacing, 1,
121 Child, (IPTR) (d.active_text_poppen = MakePoppen()),
122 Child, (IPTR) CLabel(_(MSG_TEXT)),
123 End,
124 End, // Inactive String Colors
125 Child, HGroup,
126 Child, HGroup,
127 GroupFrameT(_(MSG_CURSOR)),
128 Child, (IPTR) (d.cursor_poppen = MakePoppen()),
129 End, // Cursor
130 Child, HGroup,
131 GroupFrameT(_(MSG_MARKED_STRING_COLORS)),
132 MUIA_Group_SameWidth, TRUE,
133 Child, (IPTR) VGroup,
134 MUIA_Group_VertSpacing, 1,
135 Child, (IPTR) (d.marked_bg_poppen = MakePoppen()),
136 Child, (IPTR) CLabel(_(MSG_BACKGROUND)),
137 End,
138 Child, (IPTR) VGroup,
139 MUIA_Group_VertSpacing, 1,
140 Child, (IPTR) (d.marked_text_poppen = MakePoppen()),
141 Child, (IPTR) CLabel(_(MSG_TEXT)),
142 End,
143 End, // Marked String Colors
144 End, // Cursor + Marked
146 End,
147 End,
148 Child, (IPTR) StringObject,
149 StringFrame,
150 MUIA_CycleChain, 1,
151 MUIA_String_Contents, _(MSG_EXAMPLE_STRING_GADGET),
152 MUIA_String_Format, MUIV_String_Format_Center,
153 End,
154 TAG_MORE, (IPTR) msg->ops_AttrList);
156 if (!obj) return FALSE;
158 data = INST_DATA(cl, obj);
159 *data = d;
161 return (IPTR)obj;
166 * MUIM_Settingsgroup_ConfigToGadgets
168 static IPTR StringsP_ConfigToGadgets(struct IClass *cl, Object *obj,
169 struct MUIP_Settingsgroup_ConfigToGadgets *msg)
171 struct MUI_StringsPData *data = INST_DATA(cl, obj);
172 STRPTR spec;
174 /* Frames */
175 spec = (STRPTR)DoMethod(msg->configdata, MUIM_Configdata_GetString,
176 MUICFG_Frame_String);
177 set(data->string_popframe, MUIA_Framedisplay_Spec, (IPTR)spec);
179 /* Looks */
180 spec = (STRPTR)DoMethod(msg->configdata, MUIM_Configdata_GetString,
181 MUICFG_Image_PopUp);
182 set(data->popup_popimage, MUIA_Imagedisplay_Spec, (IPTR)spec);
183 spec = (STRPTR)DoMethod(msg->configdata, MUIM_Configdata_GetString,
184 MUICFG_Image_PopFile);
185 set(data->popfile_popimage, MUIA_Imagedisplay_Spec, (IPTR)spec);
186 spec = (STRPTR)DoMethod(msg->configdata, MUIM_Configdata_GetString,
187 MUICFG_Image_PopDrawer);
188 set(data->popdrawer_popimage, MUIA_Imagedisplay_Spec, (IPTR)spec);
190 /* pens & images */
191 spec = (STRPTR)DoMethod(msg->configdata, MUIM_Configdata_GetString,
192 MUICFG_String_Background);
193 set(data->inactive_bg_popimage, MUIA_Imagedisplay_Spec, (IPTR)spec);
194 spec = (STRPTR)DoMethod(msg->configdata, MUIM_Configdata_GetString,
195 MUICFG_String_Text);
196 set(data->inactive_text_poppen, MUIA_Pendisplay_Spec, (IPTR)spec);
198 spec = (STRPTR)DoMethod(msg->configdata, MUIM_Configdata_GetString,
199 MUICFG_String_ActiveBackground);
200 set(data->active_bg_popimage, MUIA_Imagedisplay_Spec, (IPTR)spec);
201 spec = (STRPTR)DoMethod(msg->configdata, MUIM_Configdata_GetString,
202 MUICFG_String_ActiveText);
203 set(data->active_text_poppen, MUIA_Pendisplay_Spec, (IPTR)spec);
205 spec = (STRPTR)DoMethod(msg->configdata, MUIM_Configdata_GetString,
206 MUICFG_String_Cursor);
207 set(data->cursor_poppen, MUIA_Pendisplay_Spec, (IPTR)spec);
209 spec = (STRPTR)DoMethod(msg->configdata, MUIM_Configdata_GetString,
210 MUICFG_String_MarkedText);
211 set(data->marked_text_poppen, MUIA_Pendisplay_Spec, (IPTR)spec);
213 spec = (STRPTR)DoMethod(msg->configdata, MUIM_Configdata_GetString,
214 MUICFG_String_MarkedBackground);
215 set(data->marked_bg_poppen, MUIA_Pendisplay_Spec, (IPTR)spec);
216 return 1;
221 * MUIM_Settingsgroup_ConfigToGadgets
223 static IPTR StringsP_GadgetsToConfig(struct IClass *cl, Object *obj,
224 struct MUIP_Settingsgroup_GadgetsToConfig *msg)
226 struct MUI_StringsPData *data = INST_DATA(cl, obj);
227 STRPTR str;
229 /* Frames */
230 str = (STRPTR)XGET(data->string_popframe, MUIA_Framedisplay_Spec);
231 DoMethod(msg->configdata, MUIM_Configdata_SetFramespec, MUICFG_Frame_String,
232 (IPTR)str);
234 /* Looks */
235 str = (STRPTR)XGET(data->popup_popimage, MUIA_Imagedisplay_Spec);
236 DoMethod(msg->configdata, MUIM_Configdata_SetImspec, MUICFG_Image_PopUp,
237 (IPTR)str);
238 str = (STRPTR)XGET(data->popfile_popimage, MUIA_Imagedisplay_Spec);
239 DoMethod(msg->configdata, MUIM_Configdata_SetImspec, MUICFG_Image_PopFile,
240 (IPTR)str);
241 str = (STRPTR)XGET(data->popdrawer_popimage, MUIA_Imagedisplay_Spec);
242 DoMethod(msg->configdata, MUIM_Configdata_SetImspec, MUICFG_Image_PopDrawer,
243 (IPTR)str);
245 /* pens & images */
246 str = (STRPTR)XGET(data->inactive_bg_popimage, MUIA_Imagedisplay_Spec);
247 DoMethod(msg->configdata, MUIM_Configdata_SetPenspec,
248 MUICFG_String_Background, (IPTR)str);
249 str = (STRPTR)XGET(data->inactive_text_poppen, MUIA_Pendisplay_Spec);
250 DoMethod(msg->configdata, MUIM_Configdata_SetPenspec,
251 MUICFG_String_Text, (IPTR)str);
253 str = (STRPTR)XGET(data->active_bg_popimage, MUIA_Imagedisplay_Spec);
254 DoMethod(msg->configdata, MUIM_Configdata_SetPenspec,
255 MUICFG_String_ActiveBackground, (IPTR)str);
256 str = (STRPTR)XGET(data->active_text_poppen, MUIA_Pendisplay_Spec);
257 DoMethod(msg->configdata, MUIM_Configdata_SetPenspec,
258 MUICFG_String_ActiveText, (IPTR)str);
260 str = (STRPTR)XGET(data->cursor_poppen, MUIA_Pendisplay_Spec);
261 DoMethod(msg->configdata, MUIM_Configdata_SetPenspec,
262 MUICFG_String_Cursor, (IPTR)str);
264 str = (STRPTR)XGET(data->marked_text_poppen, MUIA_Pendisplay_Spec);
265 DoMethod(msg->configdata, MUIM_Configdata_SetPenspec,
266 MUICFG_String_MarkedText, (IPTR)str);
268 str = (STRPTR)XGET(data->marked_bg_poppen, MUIA_Pendisplay_Spec);
269 DoMethod(msg->configdata, MUIM_Configdata_SetPenspec,
270 MUICFG_String_MarkedBackground, (IPTR)str);
272 return TRUE;
276 BOOPSI_DISPATCHER(IPTR, StringsP_Dispatcher, cl, obj, msg)
278 switch (msg->MethodID)
280 case OM_NEW: return StringsP_New(cl, obj, (struct opSet *)msg);
281 case MUIM_Settingsgroup_ConfigToGadgets: return StringsP_ConfigToGadgets(cl,obj,(APTR)msg);break;
282 case MUIM_Settingsgroup_GadgetsToConfig: return StringsP_GadgetsToConfig(cl,obj,(APTR)msg);break;
285 return DoSuperMethodA(cl, obj, msg);
287 BOOPSI_DISPATCHER_END
290 * Class descriptor.
292 const struct __MUIBuiltinClass _MUIP_Strings_desc = {
293 "Strings",
294 MUIC_Group,
295 sizeof(struct MUI_StringsPData),
296 (void*)StringsP_Dispatcher
300 static const UBYTE icon32[] =
302 0x00, 0x00, 0x00, 0x18, // width
303 0x00, 0x00, 0x00, 0x13, // height
304 'B', 'Z', '2', '\0',
305 0x00, 0x00, 0x00, 0x78, // number of bytes
307 0x42, 0x5a, 0x68, 0x39, 0x31, 0x41, 0x59, 0x26, 0x53, 0x59, 0xe5, 0x44,
308 0x0a, 0x8c, 0x00, 0x02, 0x69, 0xf5, 0x22, 0xa2, 0x22, 0x22, 0x00, 0x00,
309 0x20, 0x02, 0x00, 0x20, 0x00, 0x00, 0x40, 0x42, 0x40, 0x00, 0x00, 0xa0,
310 0x00, 0x90, 0x20, 0x00, 0x00, 0x88, 0x94, 0xd4, 0xcd, 0x46, 0xd4, 0xe2,
311 0xaa, 0x6c, 0x15, 0x67, 0x9d, 0xe8, 0xf9, 0x9b, 0xd6, 0x52, 0xa0, 0x3d,
312 0x77, 0x69, 0x68, 0xf4, 0x40, 0x86, 0x79, 0x99, 0x85, 0xe9, 0x81, 0x03,
313 0x67, 0xd1, 0x10, 0x7d, 0x14, 0x43, 0x82, 0x88, 0x69, 0x51, 0x4e, 0x73,
314 0x50, 0x10, 0x80, 0xc8, 0x25, 0xb6, 0x89, 0x14, 0x21, 0x04, 0x08, 0x01,
315 0x54, 0x92, 0xd5, 0x45, 0xb8, 0x20, 0x19, 0x48, 0x84, 0x20, 0x92, 0x42,
316 0x11, 0xfe, 0x2e, 0xe4, 0x8a, 0x70, 0xa1, 0x21, 0xca, 0x88, 0x15, 0x18,
320 Object *stringsclass_get_icon(void)
322 return RawimageObject,
323 MUIA_Rawimage_Data, icon32,
324 End;