2 Copyright © 2003-2006, The AROS Development Team. All rights reserved.
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>
18 #include <proto/alib.h>
21 #include "zunestuff.h"
25 /* #include <aros/debug.h> */
27 extern struct Library
*MUIMasterBase
;
29 struct MUI_StringsPData
31 Object
*string_popframe
;
32 Object
*popup_popimage
;
33 Object
*popfile_popimage
;
34 Object
*popdrawer_popimage
;
35 Object
*inactive_bg_popimage
;
36 Object
*inactive_text_poppen
;
37 Object
*active_bg_popimage
;
38 Object
*active_text_poppen
;
39 Object
*cursor_poppen
;
40 Object
*marked_bg_poppen
;
41 Object
*marked_text_poppen
;
44 Object
*MakePopupPopimage(CONST_STRPTR title
)
49 MUIA_Imageadjust_Type
, MUIV_Imageadjust_Type_Image
,
53 MUIA_Imagedisplay_FreeHoriz
, FALSE
,
54 MUIA_Imagedisplay_FreeVert
, FALSE
,
55 MUIA_Window_Title
, (IPTR
)title
,
60 static IPTR
StringsP_New(struct IClass
*cl
, Object
*obj
, struct opSet
*msg
)
62 struct MUI_StringsPData
*data
;
63 struct MUI_StringsPData d
;
65 obj
= (Object
*) DoSuperNewTags
68 MUIA_Group_Horiz
, FALSE
,
72 GroupFrameT(_(MSG_STRING_FRAME
)),
73 Child
, (IPTR
) (d
.string_popframe
= MakePopframe()),
76 GroupFrameT(_(MSG_SPECIAL_POPUP_BUTTONS
)),
77 MUIA_Group_SameWidth
, TRUE
,
79 MUIA_Group_VertSpacing
, 1,
80 Child
, (IPTR
) (d
.popup_popimage
= MakePopupPopimage(_(MSG_POPUP
))),
81 Child
, (IPTR
) CLabel(_(MSG_DEFAULT
)),
84 MUIA_Group_VertSpacing
, 1,
85 Child
, (IPTR
) (d
.popfile_popimage
= MakePopupPopimage(_(MSG_POPUP_FILE
))),
86 Child
, (IPTR
) CLabel(_(MSG_FILE
)),
89 MUIA_Group_VertSpacing
, 1,
90 Child
, (IPTR
) (d
.popdrawer_popimage
= MakePopupPopimage(_(MSG_POPUP_DRAWER
))),
91 Child
, (IPTR
) CLabel(_(MSG_DRAWER
)),
93 End
, // Special Popup Buttons
97 GroupFrameT(_(MSG_INACTIVE_STRING_COLORS
)),
98 MUIA_Group_SameWidth
, TRUE
,
100 MUIA_Group_VertSpacing
, 1,
101 Child
, (IPTR
) (d
.inactive_bg_popimage
= MakeBackgroundPopimage()),
102 Child
, (IPTR
) CLabel(_(MSG_BACKGROUND
)),
104 Child
, (IPTR
) VGroup
,
105 MUIA_Group_VertSpacing
, 1,
106 Child
, (IPTR
) (d
.inactive_text_poppen
= MakePoppen()),
107 Child
, (IPTR
) CLabel(_(MSG_TEXT
)),
109 End
, // Inactive String Colors
111 GroupFrameT(_(MSG_ACTIVE_STRING_COLORS
)),
112 MUIA_Group_SameWidth
, TRUE
,
113 Child
, (IPTR
) VGroup
,
114 MUIA_Group_VertSpacing
, 1,
115 Child
, (IPTR
) (d
.active_bg_popimage
= MakeBackgroundPopimage()),
116 Child
, (IPTR
) CLabel(_(MSG_BACKGROUND
)),
118 Child
, (IPTR
) VGroup
,
119 MUIA_Group_VertSpacing
, 1,
120 Child
, (IPTR
) (d
.active_text_poppen
= MakePoppen()),
121 Child
, (IPTR
) CLabel(_(MSG_TEXT
)),
123 End
, // Inactive String Colors
126 GroupFrameT(_(MSG_CURSOR
)),
127 Child
, (IPTR
) (d
.cursor_poppen
= MakePoppen()),
130 GroupFrameT(_(MSG_MARKED_STRING_COLORS
)),
131 MUIA_Group_SameWidth
, TRUE
,
132 Child
, (IPTR
) VGroup
,
133 MUIA_Group_VertSpacing
, 1,
134 Child
, (IPTR
) (d
.marked_bg_poppen
= MakePoppen()),
135 Child
, (IPTR
) CLabel(_(MSG_BACKGROUND
)),
137 Child
, (IPTR
) VGroup
,
138 MUIA_Group_VertSpacing
, 1,
139 Child
, (IPTR
) (d
.marked_text_poppen
= MakePoppen()),
140 Child
, (IPTR
) CLabel(_(MSG_TEXT
)),
142 End
, // Marked String Colors
143 End
, // Cursor + Marked
147 Child
, (IPTR
) StringObject
,
150 MUIA_String_Contents
, _(MSG_EXAMPLE_STRING_GADGET
),
151 MUIA_String_Format
, MUIV_String_Format_Center
,
153 TAG_MORE
, (IPTR
) msg
->ops_AttrList
);
155 if (!obj
) return FALSE
;
157 data
= INST_DATA(cl
, obj
);
165 * MUIM_Settingsgroup_ConfigToGadgets
167 static IPTR
StringsP_ConfigToGadgets(struct IClass
*cl
, Object
*obj
,
168 struct MUIP_Settingsgroup_ConfigToGadgets
*msg
)
170 struct MUI_StringsPData
*data
= INST_DATA(cl
, obj
);
174 spec
= (STRPTR
)DoMethod(msg
->configdata
, MUIM_Configdata_GetString
,
175 MUICFG_Frame_String
);
176 set(data
->string_popframe
, MUIA_Framedisplay_Spec
, (IPTR
)spec
);
179 spec
= (STRPTR
)DoMethod(msg
->configdata
, MUIM_Configdata_GetString
,
181 set(data
->popup_popimage
, MUIA_Imagedisplay_Spec
, (IPTR
)spec
);
182 spec
= (STRPTR
)DoMethod(msg
->configdata
, MUIM_Configdata_GetString
,
183 MUICFG_Image_PopFile
);
184 set(data
->popfile_popimage
, MUIA_Imagedisplay_Spec
, (IPTR
)spec
);
185 spec
= (STRPTR
)DoMethod(msg
->configdata
, MUIM_Configdata_GetString
,
186 MUICFG_Image_PopDrawer
);
187 set(data
->popdrawer_popimage
, MUIA_Imagedisplay_Spec
, (IPTR
)spec
);
190 spec
= (STRPTR
)DoMethod(msg
->configdata
, MUIM_Configdata_GetString
,
191 MUICFG_String_Background
);
192 set(data
->inactive_bg_popimage
, MUIA_Imagedisplay_Spec
, (IPTR
)spec
);
193 spec
= (STRPTR
)DoMethod(msg
->configdata
, MUIM_Configdata_GetString
,
195 set(data
->inactive_text_poppen
, MUIA_Pendisplay_Spec
, (IPTR
)spec
);
197 spec
= (STRPTR
)DoMethod(msg
->configdata
, MUIM_Configdata_GetString
,
198 MUICFG_String_ActiveBackground
);
199 set(data
->active_bg_popimage
, MUIA_Imagedisplay_Spec
, (IPTR
)spec
);
200 spec
= (STRPTR
)DoMethod(msg
->configdata
, MUIM_Configdata_GetString
,
201 MUICFG_String_ActiveText
);
202 set(data
->active_text_poppen
, MUIA_Pendisplay_Spec
, (IPTR
)spec
);
204 spec
= (STRPTR
)DoMethod(msg
->configdata
, MUIM_Configdata_GetString
,
205 MUICFG_String_Cursor
);
206 set(data
->cursor_poppen
, MUIA_Pendisplay_Spec
, (IPTR
)spec
);
208 spec
= (STRPTR
)DoMethod(msg
->configdata
, MUIM_Configdata_GetString
,
209 MUICFG_String_MarkedText
);
210 set(data
->marked_text_poppen
, MUIA_Pendisplay_Spec
, (IPTR
)spec
);
212 spec
= (STRPTR
)DoMethod(msg
->configdata
, MUIM_Configdata_GetString
,
213 MUICFG_String_MarkedBackground
);
214 set(data
->marked_bg_poppen
, MUIA_Pendisplay_Spec
, (IPTR
)spec
);
220 * MUIM_Settingsgroup_ConfigToGadgets
222 static IPTR
StringsP_GadgetsToConfig(struct IClass
*cl
, Object
*obj
,
223 struct MUIP_Settingsgroup_GadgetsToConfig
*msg
)
225 struct MUI_StringsPData
*data
= INST_DATA(cl
, obj
);
229 str
= (STRPTR
)XGET(data
->string_popframe
, MUIA_Framedisplay_Spec
);
230 DoMethod(msg
->configdata
, MUIM_Configdata_SetFramespec
, MUICFG_Frame_String
,
234 str
= (STRPTR
)XGET(data
->popup_popimage
, MUIA_Imagedisplay_Spec
);
235 DoMethod(msg
->configdata
, MUIM_Configdata_SetImspec
, MUICFG_Image_PopUp
,
237 str
= (STRPTR
)XGET(data
->popfile_popimage
, MUIA_Imagedisplay_Spec
);
238 DoMethod(msg
->configdata
, MUIM_Configdata_SetImspec
, MUICFG_Image_PopFile
,
240 str
= (STRPTR
)XGET(data
->popdrawer_popimage
, MUIA_Imagedisplay_Spec
);
241 DoMethod(msg
->configdata
, MUIM_Configdata_SetImspec
, MUICFG_Image_PopDrawer
,
245 str
= (STRPTR
)XGET(data
->inactive_bg_popimage
, MUIA_Imagedisplay_Spec
);
246 DoMethod(msg
->configdata
, MUIM_Configdata_SetPenspec
,
247 MUICFG_String_Background
, (IPTR
)str
);
248 str
= (STRPTR
)XGET(data
->inactive_text_poppen
, MUIA_Pendisplay_Spec
);
249 DoMethod(msg
->configdata
, MUIM_Configdata_SetPenspec
,
250 MUICFG_String_Text
, (IPTR
)str
);
252 str
= (STRPTR
)XGET(data
->active_bg_popimage
, MUIA_Imagedisplay_Spec
);
253 DoMethod(msg
->configdata
, MUIM_Configdata_SetPenspec
,
254 MUICFG_String_ActiveBackground
, (IPTR
)str
);
255 str
= (STRPTR
)XGET(data
->active_text_poppen
, MUIA_Pendisplay_Spec
);
256 DoMethod(msg
->configdata
, MUIM_Configdata_SetPenspec
,
257 MUICFG_String_ActiveText
, (IPTR
)str
);
259 str
= (STRPTR
)XGET(data
->cursor_poppen
, MUIA_Pendisplay_Spec
);
260 DoMethod(msg
->configdata
, MUIM_Configdata_SetPenspec
,
261 MUICFG_String_Cursor
, (IPTR
)str
);
263 str
= (STRPTR
)XGET(data
->marked_text_poppen
, MUIA_Pendisplay_Spec
);
264 DoMethod(msg
->configdata
, MUIM_Configdata_SetPenspec
,
265 MUICFG_String_MarkedText
, (IPTR
)str
);
267 str
= (STRPTR
)XGET(data
->marked_bg_poppen
, MUIA_Pendisplay_Spec
);
268 DoMethod(msg
->configdata
, MUIM_Configdata_SetPenspec
,
269 MUICFG_String_MarkedBackground
, (IPTR
)str
);
275 BOOPSI_DISPATCHER(IPTR
, StringsP_Dispatcher
, cl
, obj
, msg
)
277 switch (msg
->MethodID
)
279 case OM_NEW
: return StringsP_New(cl
, obj
, (struct opSet
*)msg
);
280 case MUIM_Settingsgroup_ConfigToGadgets
: return StringsP_ConfigToGadgets(cl
,obj
,(APTR
)msg
);break;
281 case MUIM_Settingsgroup_GadgetsToConfig
: return StringsP_GadgetsToConfig(cl
,obj
,(APTR
)msg
);break;
284 return DoSuperMethodA(cl
, obj
, msg
);
286 BOOPSI_DISPATCHER_END
291 const struct __MUIBuiltinClass _MUIP_Strings_desc
= {
294 sizeof(struct MUI_StringsPData
),
295 (void*)StringsP_Dispatcher