added concrete implementations of putc(), getc(), getchar() and gets()
[tangerine.git] / workbench / prefs / Zune / groupsp.c
bloba485a6639b186d27c54492ce1a15bf569c899fa0
1 /*
2 Copyright © 2002-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 <proto/exec.h>
12 #include <proto/graphics.h>
13 #include <proto/utility.h>
14 #include <proto/intuition.h>
15 #include <proto/muimaster.h>
17 #ifdef __AROS__
18 #include <proto/alib.h>
19 #endif
21 #include "zunestuff.h"
22 #include <string.h>
24 /* #define DEBUG 1 */
25 /* #include <aros/debug.h> */
27 extern struct Library *MUIMasterBase;
29 struct MUI_GroupsPData
31 Object *background_register_popimage;
32 Object *background_framed_popimage;
33 Object *background_page_popimage;
34 Object *spacing_vert_slider;
35 Object *spacing_horiz_slider;
36 Object *truncate_titles_checkmark;
37 Object *font_title_string;
38 Object *normal_popframe;
39 Object *virtual_popframe;
40 Object *title_position_cycle;
41 Object *title_color_cycle;
44 static CONST_STRPTR positions_labels[3];
45 static CONST_STRPTR color_labels[5];
47 static IPTR GroupsP_New(struct IClass *cl, Object *obj, struct opSet *msg)
49 struct MUI_GroupsPData *data;
50 struct MUI_GroupsPData d;
52 positions_labels[0] = _(MSG_ABOVE);
53 positions_labels[1] = _(MSG_CENTERED);
55 color_labels[0] = _(MSG_STANDARD);
56 color_labels[1] = _(MSG_HILITE);
57 color_labels[2] = _(MSG_3D);
58 color_labels[3] = _(MSG_OUTLINE);
60 obj = (Object *) DoSuperNewTags
62 cl, obj, NULL,
64 MUIA_Group_SameWidth, TRUE,
65 MUIA_Group_Horiz, TRUE,
66 Child, (IPTR) VGroup,
67 Child, (IPTR) VGroup,
68 GroupFrameT(_(MSG_TITLE)),
69 Child, (IPTR) VSpace(0),
70 Child, (IPTR) ColGroup(2),
71 MUIA_Group_VertSpacing, 2,
72 Child, (IPTR) Label(_(MSG_POSITION)),
73 Child, (IPTR) (d.title_position_cycle =
74 MakeCycle(_(MSG_POSITION), positions_labels)),
75 Child, (IPTR) Label(_(MSG_COLOR)),
76 Child, (IPTR) (d.title_color_cycle =
77 MakeCycle(_(MSG_COLOR), color_labels)),
78 Child, (IPTR) Label(_(MSG_FONT)),
79 Child, (IPTR) (d.font_title_string = MakePopfont(FALSE)),
80 End, /* Title */
81 Child, (IPTR) VSpace(0),
82 End,
83 Child, (IPTR) VGroup,
84 GroupFrameT(_(MSG_SPACING)),
85 Child, (IPTR) VSpace(0),
86 Child, (IPTR) ColGroup(2),
87 MUIA_Group_VertSpacing, 2,
88 Child, (IPTR) Label(_(MSG_HORIZONTAL)),
89 Child, (IPTR) (d.spacing_horiz_slider = (Object*)MakeSpacingSlider()),
90 Child, (IPTR) Label(_(MSG_VERTICAL)),
91 Child, (IPTR) (d.spacing_vert_slider = (Object*)MakeSpacingSlider()),
92 End, /* Spacing */
93 Child, (IPTR) VSpace(0),
94 End,
95 Child, (IPTR) VGroup,
96 GroupFrameT(_(MSG_REGISTER)),
97 Child, (IPTR) VSpace(0),
98 Child, (IPTR) HGroup,
99 Child, (IPTR) HSpace(0),
100 Child, (IPTR) Label1(_(MSG_DEFAULT_SIZE_TRUNCATE_TITLES)),
101 Child, (IPTR) (d.truncate_titles_checkmark = MakeCheck(NULL)),
102 End, /* HGroup recessed CM */
103 Child, (IPTR) VSpace(0),
104 End,
105 End,
106 Child, (IPTR) VGroup,
107 Child, (IPTR) HGroup,
108 GroupFrameT(_(MSG_FRAME)),
109 MUIA_Group_SameWidth, TRUE,
110 Child, (IPTR) VGroup,
111 MUIA_Group_VertSpacing, 1,
112 Child, (IPTR) (d.normal_popframe = MakePopframe()),
113 Child, (IPTR) CLabel(_(MSG_NORMAL)),
114 End,
115 Child, (IPTR) VGroup,
116 MUIA_Group_VertSpacing, 1,
117 Child, (IPTR) (d.virtual_popframe = MakePopframe()),
118 Child, (IPTR) CLabel(_(MSG_VIRTUAL)),
119 End,
120 End, /* Frame */
121 Child, (IPTR) HGroup,
122 GroupFrameT(_(MSG_BACKGROUND)),
123 MUIA_Group_SameWidth, TRUE,
124 Child, (IPTR) VGroup,
125 MUIA_Group_VertSpacing, 1,
126 Child, (IPTR) (d.background_framed_popimage = MakeBackgroundPopimage()),
127 Child, (IPTR) CLabel(_(MSG_FRAMED)),
128 End,
129 Child, (IPTR) VGroup,
130 MUIA_Group_VertSpacing, 1,
131 Child, (IPTR) (d.background_page_popimage = MakeBackgroundPopimage()),
132 Child, (IPTR) CLabel(_(MSG_PAGE)),
133 End,
134 Child, (IPTR) VGroup,
135 MUIA_Group_VertSpacing, 1,
136 Child, (IPTR) (d.background_register_popimage = MakeBackgroundPopimage()),
137 Child, (IPTR) CLabel(_(MSG_REGISTER)),
138 End,
139 End, /* Background */
140 End,
141 TAG_MORE, (IPTR) msg->ops_AttrList
144 if (!obj) return FALSE;
146 data = INST_DATA(cl, obj);
147 *data = d;
149 return (IPTR)obj;
153 static IPTR GroupsP_ConfigToGadgets(struct IClass *cl, Object *obj,
154 struct MUIP_Settingsgroup_ConfigToGadgets *msg)
156 struct MUI_GroupsPData *data = INST_DATA(cl, obj);
157 STRPTR spec;
159 /* Fonts */
160 setstring(data->font_title_string, (IPTR)FindFont(MUICFG_Font_Title));
162 /* Backgrounds */
163 spec = (STRPTR)DoMethod(msg->configdata, MUIM_Configdata_GetString,
164 MUICFG_Background_Framed);
165 set(data->background_framed_popimage,MUIA_Imagedisplay_Spec, (IPTR)spec);
167 spec = (STRPTR)DoMethod(msg->configdata, MUIM_Configdata_GetString,
168 MUICFG_Background_Register);
169 set(data->background_register_popimage,MUIA_Imagedisplay_Spec, (IPTR)spec);
171 spec = (STRPTR)DoMethod(msg->configdata, MUIM_Configdata_GetString,
172 MUICFG_Background_Page);
173 set(data->background_page_popimage,MUIA_Imagedisplay_Spec, (IPTR)spec);
175 /* Frames */
176 spec = (STRPTR)DoMethod(msg->configdata, MUIM_Configdata_GetString,
177 MUICFG_Frame_Group);
178 set(data->normal_popframe, MUIA_Framedisplay_Spec, (IPTR)spec);
180 spec = (STRPTR)DoMethod(msg->configdata, MUIM_Configdata_GetString,
181 MUICFG_Frame_Virtual);
182 set(data->virtual_popframe, MUIA_Framedisplay_Spec, (IPTR)spec);
184 /* Spacing */
185 setslider(data->spacing_horiz_slider,
186 DoMethod(msg->configdata, MUIM_Configdata_GetULong,
187 MUICFG_Group_HSpacing));
188 setslider(data->spacing_vert_slider,
189 DoMethod(msg->configdata, MUIM_Configdata_GetULong,
190 MUICFG_Group_VSpacing));
192 /* Checkmark */
193 setcheckmark(data->truncate_titles_checkmark,
194 DoMethod(msg->configdata, MUIM_Configdata_GetULong,
195 MUICFG_Register_TruncateTitles));
197 /* Title (Cycles) */
198 set(data->title_position_cycle, MUIA_Cycle_Active,
199 DoMethod(msg->configdata, MUIM_Configdata_GetULong, MUICFG_GroupTitle_Position));
200 set(data->title_color_cycle, MUIA_Cycle_Active,
201 DoMethod(msg->configdata, MUIM_Configdata_GetULong, MUICFG_GroupTitle_Color));
203 return 1;
207 static IPTR GroupsP_GadgetsToConfig(struct IClass *cl, Object *obj,
208 struct MUIP_Settingsgroup_GadgetsToConfig *msg)
210 struct MUI_GroupsPData *data = INST_DATA(cl, obj);
211 STRPTR str;
213 /* Fonts */
214 str = getstring(data->font_title_string);
215 DoMethod(msg->configdata, MUIM_Configdata_SetFont, MUICFG_Font_Title, (IPTR)str);
217 /* Backgrounds */
218 str = (STRPTR)XGET(data->background_framed_popimage,MUIA_Imagedisplay_Spec);
219 DoMethod(msg->configdata, MUIM_Configdata_SetImspec, MUICFG_Background_Framed,
220 (IPTR)str);
222 str = (STRPTR)XGET(data->background_register_popimage,MUIA_Imagedisplay_Spec);
223 DoMethod(msg->configdata, MUIM_Configdata_SetImspec, MUICFG_Background_Register,
224 (IPTR)str);
226 str = (STRPTR)XGET(data->background_page_popimage,MUIA_Imagedisplay_Spec);
227 DoMethod(msg->configdata, MUIM_Configdata_SetImspec, MUICFG_Background_Page,
228 (IPTR)str);
230 /* Frames */
231 str = (STRPTR)XGET(data->normal_popframe, MUIA_Framedisplay_Spec);
232 DoMethod(msg->configdata, MUIM_Configdata_SetFramespec, MUICFG_Frame_Group,
233 (IPTR)str);
234 str = (STRPTR)XGET(data->virtual_popframe, MUIA_Framedisplay_Spec);
235 DoMethod(msg->configdata, MUIM_Configdata_SetFramespec, MUICFG_Frame_Virtual,
236 (IPTR)str);
238 /* Spacing */
239 DoMethod(msg->configdata, MUIM_Configdata_SetULong, MUICFG_Group_HSpacing,
240 XGET(data->spacing_horiz_slider, MUIA_Numeric_Value));
241 DoMethod(msg->configdata, MUIM_Configdata_SetULong, MUICFG_Group_VSpacing,
242 XGET(data->spacing_vert_slider, MUIA_Numeric_Value));
244 /* Checkmark */
245 DoMethod(msg->configdata, MUIM_Configdata_SetULong, MUICFG_Register_TruncateTitles,
246 XGET(data->truncate_titles_checkmark, MUIA_Selected));
248 /* Title (Cycles) */
249 DoMethod(msg->configdata, MUIM_Configdata_SetULong, MUICFG_GroupTitle_Position,
250 XGET(data->title_position_cycle, MUIA_Cycle_Active));
251 DoMethod(msg->configdata, MUIM_Configdata_SetULong, MUICFG_GroupTitle_Color,
252 XGET(data->title_color_cycle, MUIA_Cycle_Active));
254 return TRUE;
258 BOOPSI_DISPATCHER(IPTR, GroupsP_Dispatcher, cl, obj, msg)
260 switch (msg->MethodID)
262 case OM_NEW: return GroupsP_New(cl, obj, (struct opSet *)msg);
263 case MUIM_Settingsgroup_ConfigToGadgets: return GroupsP_ConfigToGadgets(cl,obj,(APTR)msg);break;
264 case MUIM_Settingsgroup_GadgetsToConfig: return GroupsP_GadgetsToConfig(cl,obj,(APTR)msg);break;
267 return DoSuperMethodA(cl, obj, msg);
269 BOOPSI_DISPATCHER_END
272 * Class descriptor.
274 const struct __MUIBuiltinClass _MUIP_Groups_desc = {
275 "Groups",
276 MUIC_Group,
277 sizeof(struct MUI_GroupsPData),
278 (void*)GroupsP_Dispatcher