2 Copyright © 2002-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 <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>
19 #include <proto/alib.h>
22 #include "zunestuff.h"
26 /* #include <aros/debug.h> */
28 extern struct Library
*MUIMasterBase
;
30 struct MUI_ListviewsPData
33 Object
*refresh_cycle
;
34 Object
*smooth_checkmark
;
35 Object
*smooth_slider
;
37 Object
*fonts_normal_string
;
38 Object
*fonts_fixed_string
;
39 Object
*fonts_leading_slider
;
41 Object
*input_popframe
;
42 Object
*input_popimage
;
43 Object
*readonly_popframe
;
44 Object
*readonly_popimage
;
46 Object
*active_popimage
;
47 Object
*selected_popimage
;
48 Object
*activeselected_popimage
;
51 static CONST_STRPTR multi_labels
[3];
52 static CONST_STRPTR refresh_labels
[3];
54 static Object
*MakeListviewspSlider (void)
56 Object
*obj
= MUI_MakeObject(MUIO_Slider
, (IPTR
)"", 0, 9);
57 set(obj
, MUIA_CycleChain
, 1);
61 static IPTR
ListviewsP_New(struct IClass
*cl
, Object
*obj
, struct opSet
*msg
)
63 struct MUI_ListviewsPData
*data
;
64 struct MUI_ListviewsPData d
;
66 multi_labels
[0] = _(MSG_SHIFTED
);
67 multi_labels
[1] = _(MSG_ALWAYS
);
69 refresh_labels
[0] = _(MSG_LINEAR
);
70 refresh_labels
[1] = _(MSG_MIXED
);
72 obj
= (Object
*) DoSuperNewTags
76 MUIA_Group_Columns
, 2,
77 MUIA_Group_SameSize
, TRUE
,
79 GroupFrameT(_(MSG_CONTROL
)),
80 MUIA_Group_VertSpacing
, 0,
81 Child
, (IPTR
) VSpace(0),
82 Child
, (IPTR
) ColGroup(2),
83 MUIA_Group_VertSpacing
, 2,
84 Child
, (IPTR
) Label(_(MSG_MULTI
)),
85 Child
, (IPTR
) (d
.multi_cycle
= MakeCycle(_(MSG_MULTI
), multi_labels
)),
86 Child
, (IPTR
) Label(_(MSG_REFRESH
)),
87 Child
, (IPTR
) (d
.refresh_cycle
= MakeCycle(_(MSG_REFRESH
), refresh_labels
)),
88 Child
, (IPTR
) Label(_(MSG_SMOOTH
)),
90 MUIA_Group_HorizSpacing
, 4,
91 Child
, (IPTR
) (d
.smooth_checkmark
= MakeCheck(NULL
)),
92 Child
, (IPTR
) (d
.smooth_slider
= MakeListviewspSlider()),
95 Child
, (IPTR
) VSpace(0),
96 End
, /* Control VGroup */
99 GroupFrameT(_(MSG_FONTS
)),
100 MUIA_Group_VertSpacing
, 0,
101 Child
, (IPTR
) VSpace(0),
102 Child
, (IPTR
) ColGroup(2),
103 MUIA_Group_VertSpacing
, 2,
104 Child
, (IPTR
) Label(_(MSG_NORMAL_COLON
)),
105 Child
, (IPTR
) (d
.fonts_normal_string
= MakePopfont(FALSE
)),
106 Child
, (IPTR
) Label(_(MSG_FIXED
)),
107 Child
, (IPTR
) (d
.fonts_fixed_string
= MakePopfont(TRUE
)),
108 Child
, (IPTR
) Label(_(MSG_LEADING
)),
109 Child
, (IPTR
) (d
.fonts_leading_slider
= MakeListviewspSlider()),
112 Child
, (IPTR
) VSpace(0),
115 Child
, (IPTR
) ColGroup(3),
116 GroupFrameT(_(MSG_DESIGN
)),
117 MUIA_Group_VertSpacing
, 2,
118 Child
, (IPTR
) FreeLabel(_(MSG_INPUT_LISTS
)),
119 Child
, (IPTR
) (d
.input_popframe
= MakePopframe()),
120 Child
, (IPTR
) (d
.input_popimage
= MakeBackgroundPopimage()),
121 Child
, (IPTR
) FreeLabel(_(MSG_READONLY_LISTS
)),
122 Child
, (IPTR
) (d
.readonly_popframe
= MakePopframe()),
123 Child
, (IPTR
) (d
.readonly_popimage
= MakeBackgroundPopimage()),
124 Child
, (IPTR
) VSpace(0),
125 Child
, (IPTR
) CLabel(_(MSG_FRAME
)),
126 Child
, (IPTR
) CLabel(_(MSG_BACKGROUND
)),
127 End
, /* Design ColGroup(3) */
129 Child
, (IPTR
) ColGroup(3),
130 GroupFrameT(_(MSG_CURSOR
)),
131 MUIA_Group_VertSpacing
, 2,
132 MUIA_Group_SameSize
, TRUE
,
133 Child
, (IPTR
) FreeLabel(_(MSG_ACTIVE
)),
134 Child
, (IPTR
) (d
.active_popimage
= MakeBackgroundPopimage()),
135 Child
, (IPTR
) VGroup
,
136 Child
, (IPTR
) HVSpace
,
137 Child
, (IPTR
) CLabel(_(MSG_ACTIVE_SELECTED
)),
139 Child
, (IPTR
) FreeLabel(_(MSG_SELECTED
)),
140 Child
, (IPTR
) (d
.selected_popimage
= MakeBackgroundPopimage()),
141 Child
, (IPTR
) (d
.activeselected_popimage
= MakeBackgroundPopimage()),
142 End
, /* Cursor ColGroup */
144 TAG_MORE
, (IPTR
) msg
->ops_AttrList
147 if (!obj
) return FALSE
;
149 data
= INST_DATA(cl
, obj
);
151 set(data
->refresh_cycle
, MUIA_CycleChain
, 1);
152 set(data
->multi_cycle
, MUIA_CycleChain
, 1);
156 d
.smooth_checkmark
, MUIM_Notify
, MUIA_Selected
, MUIV_EveryTime
,
157 (IPTR
) d
.smooth_slider
, 3, MUIM_Set
, MUIA_Disabled
, MUIV_NotTriggerValue
164 static IPTR
ListviewsP_ConfigToGadgets(struct IClass
*cl
, Object
*obj
,
165 struct MUIP_Settingsgroup_ConfigToGadgets
*msg
)
167 struct MUI_ListviewsPData
*data
= INST_DATA(cl
, obj
);
171 spec
= (STRPTR
)DoMethod(msg
->configdata
, MUIM_Configdata_GetString
,
172 MUICFG_Background_List
);
173 set(data
->input_popimage
, MUIA_Imagedisplay_Spec
, (IPTR
)spec
);
175 spec
= (STRPTR
)DoMethod(msg
->configdata
, MUIM_Configdata_GetString
,
176 MUICFG_Background_ReadList
);
177 set(data
->readonly_popimage
, MUIA_Imagedisplay_Spec
, (IPTR
)spec
);
179 spec
= (STRPTR
)DoMethod(msg
->configdata
, MUIM_Configdata_GetString
,
180 MUICFG_Background_ListCursor
);
181 set(data
->active_popimage
, MUIA_Imagedisplay_Spec
, (IPTR
)spec
);
183 spec
= (STRPTR
)DoMethod(msg
->configdata
, MUIM_Configdata_GetString
,
184 MUICFG_Background_ListSelect
);
185 set(data
->selected_popimage
, MUIA_Imagedisplay_Spec
, (IPTR
)spec
);
187 spec
= (STRPTR
)DoMethod(msg
->configdata
, MUIM_Configdata_GetString
,
188 MUICFG_Background_ListSelCur
);
189 set(data
->activeselected_popimage
, MUIA_Imagedisplay_Spec
, (IPTR
)spec
);
192 spec
= (STRPTR
)DoMethod(msg
->configdata
, MUIM_Configdata_GetString
,
193 MUICFG_Frame_InputList
);
194 set(data
->input_popframe
, MUIA_Framedisplay_Spec
, (IPTR
)spec
);
196 spec
= (STRPTR
)DoMethod(msg
->configdata
, MUIM_Configdata_GetString
,
197 MUICFG_Frame_ReadList
);
198 set(data
->readonly_popframe
, MUIA_Framedisplay_Spec
, (IPTR
)spec
);
201 setstring(data
->fonts_normal_string
, (IPTR
)FindFont(MUICFG_Font_List
));
202 setstring(data
->fonts_fixed_string
, (IPTR
)FindFont(MUICFG_Font_Fixed
));
205 setslider(data
->smooth_slider
,
206 DoMethod(msg
->configdata
, MUIM_Configdata_GetULong
,
207 MUICFG_Listview_SmoothVal
));
208 setslider(data
->fonts_leading_slider
,
209 DoMethod(msg
->configdata
, MUIM_Configdata_GetULong
,
210 MUICFG_Listview_Font_Leading
));
213 setcheckmark(data
->smooth_checkmark
,
214 DoMethod(msg
->configdata
, MUIM_Configdata_GetULong
,
215 MUICFG_Listview_Smoothed
));
217 setcycle(data
->multi_cycle
,
218 DoMethod(msg
->configdata
, MUIM_Configdata_GetULong
,
219 MUICFG_Listview_Multi
));
221 setcycle(data
->refresh_cycle
,
222 DoMethod(msg
->configdata
, MUIM_Configdata_GetULong
,
223 MUICFG_Listview_Refresh
));
229 static IPTR
ListviewsP_GadgetsToConfig(struct IClass
*cl
, Object
*obj
,
230 struct MUIP_Settingsgroup_GadgetsToConfig
*msg
)
232 struct MUI_ListviewsPData
*data
= INST_DATA(cl
, obj
);
236 str
= getstring(data
->fonts_normal_string
);
237 DoMethod(msg
->configdata
, MUIM_Configdata_SetFont
, MUICFG_Font_List
, (IPTR
)str
);
239 str
= getstring(data
->fonts_fixed_string
);
240 DoMethod(msg
->configdata
, MUIM_Configdata_SetFont
, MUICFG_Font_Fixed
, (IPTR
)str
);
243 str
= (STRPTR
)XGET(data
->input_popframe
, MUIA_Framedisplay_Spec
);
244 DoMethod(msg
->configdata
, MUIM_Configdata_SetFramespec
, MUICFG_Frame_InputList
,
247 str
= (STRPTR
)XGET(data
->readonly_popframe
, MUIA_Framedisplay_Spec
);
248 DoMethod(msg
->configdata
, MUIM_Configdata_SetFramespec
, MUICFG_Frame_ReadList
,
252 str
= (STRPTR
)XGET(data
->input_popimage
, MUIA_Imagedisplay_Spec
);
253 DoMethod(msg
->configdata
, MUIM_Configdata_SetImspec
, MUICFG_Background_List
,
256 str
= (STRPTR
)XGET(data
->readonly_popimage
, MUIA_Imagedisplay_Spec
);
257 DoMethod(msg
->configdata
, MUIM_Configdata_SetImspec
, MUICFG_Background_ReadList
,
260 str
= (STRPTR
)XGET(data
->active_popimage
, MUIA_Imagedisplay_Spec
);
261 DoMethod(msg
->configdata
, MUIM_Configdata_SetImspec
, MUICFG_Background_ListCursor
,
264 str
= (STRPTR
)XGET(data
->selected_popimage
, MUIA_Imagedisplay_Spec
);
265 DoMethod(msg
->configdata
, MUIM_Configdata_SetImspec
, MUICFG_Background_ListSelect
,
268 str
= (STRPTR
)XGET(data
->activeselected_popimage
, MUIA_Imagedisplay_Spec
);
269 DoMethod(msg
->configdata
, MUIM_Configdata_SetImspec
, MUICFG_Background_ListSelCur
,
273 DoMethod(msg
->configdata
, MUIM_Configdata_SetULong
, MUICFG_Listview_SmoothVal
,
274 XGET(data
->smooth_slider
, MUIA_Numeric_Value
));
276 DoMethod(msg
->configdata
, MUIM_Configdata_SetULong
, MUICFG_Listview_Font_Leading
,
277 XGET(data
->fonts_leading_slider
, MUIA_Numeric_Value
));
280 DoMethod(msg
->configdata
, MUIM_Configdata_SetULong
, MUICFG_Listview_Smoothed
,
281 XGET(data
->smooth_checkmark
, MUIA_Selected
));
284 DoMethod(msg
->configdata
, MUIM_Configdata_SetULong
, MUICFG_Listview_Multi
,
285 XGET(data
->multi_cycle
, MUIA_Cycle_Active
));
287 DoMethod(msg
->configdata
, MUIM_Configdata_SetULong
, MUICFG_Listview_Refresh
,
288 XGET(data
->refresh_cycle
, MUIA_Cycle_Active
));
294 BOOPSI_DISPATCHER(IPTR
, ListviewsP_Dispatcher
, cl
, obj
, msg
)
296 switch (msg
->MethodID
)
298 case OM_NEW
: return ListviewsP_New(cl
, obj
, (struct opSet
*)msg
);
299 case MUIM_Settingsgroup_ConfigToGadgets
: return ListviewsP_ConfigToGadgets(cl
,obj
,(APTR
)msg
);break;
300 case MUIM_Settingsgroup_GadgetsToConfig
: return ListviewsP_GadgetsToConfig(cl
,obj
,(APTR
)msg
);break;
303 return DoSuperMethodA(cl
, obj
, msg
);
305 BOOPSI_DISPATCHER_END
310 const struct __MUIBuiltinClass _MUIP_Listviews_desc
= {
313 sizeof(struct MUI_ListviewsPData
),
314 (void*)ListviewsP_Dispatcher
318 static const UBYTE icon32
[] =
320 0x00, 0x00, 0x00, 0x18, // width
321 0x00, 0x00, 0x00, 0x13, // height
323 0x00, 0x00, 0x00, 0x5c, // number of bytes
325 0x42, 0x5a, 0x68, 0x39, 0x31, 0x41, 0x59, 0x26, 0x53, 0x59, 0x80, 0xa2,
326 0xd8, 0x11, 0x00, 0x01, 0xb6, 0xd5, 0x02, 0xa2, 0x00, 0x20, 0x20, 0x02,
327 0x00, 0x00, 0x04, 0x42, 0x40, 0x00, 0x00, 0xa0, 0x00, 0x70, 0x40, 0x0c,
328 0x02, 0x92, 0x94, 0xd1, 0x89, 0xe9, 0x1a, 0x68, 0xb6, 0x95, 0xd6, 0xe6,
329 0x9a, 0x61, 0xf9, 0x09, 0xe1, 0x51, 0xe9, 0x51, 0xe7, 0x55, 0x4e, 0xf9,
330 0x39, 0xb9, 0xb1, 0xb3, 0x89, 0x18, 0xf3, 0xbf, 0x95, 0x4e, 0xc8, 0x7b,
331 0x20, 0xe0, 0x8e, 0x4e, 0x6d, 0x36, 0xd3, 0x6d, 0x57, 0xf1, 0x77, 0x24,
332 0x53, 0x85, 0x09, 0x08, 0x0a, 0x2d, 0x81, 0x10,
336 Object
*listviewsclass_get_icon(void)
338 return RawimageObject
,
339 MUIA_Rawimage_Data
, icon32
,