Paolones's icons for Zune Prefs Editor.
[AROS.git] / workbench / prefs / Zune / navigationp.c
bloba4393e07e4dca4d305fca44b9740a5d76dfc4ef4
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 NSHORTCUTS (MUICFG_Keyboard_Popup - MUICFG_Keyboard_Press + 1)
32 struct MUI_NavigationPData
34 Object *drag_leftbutton_checkmark;
35 Object *drag_leftbutton_string;
36 Object *drag_middlebutton_checkmark;
37 Object *drag_middlebutton_string;
38 Object *drag_autostart_checkmark;
39 Object *drag_autostart_slider;
40 Object *dnd_popframe;
41 Object *drag_look_cycle;
42 Object *balance_look_cycle;
43 Object *active_poppen;
44 Object *keyboard_string[NSHORTCUTS];
47 static CONST_STRPTR dnd_labels[5];
48 static CONST_STRPTR balancing_labels[3];
49 static CONST_STRPTR keyboard_label[NSHORTCUTS];
51 static Object *MakeScrollgroup (struct MUI_NavigationPData *data)
53 int i;
54 struct TagItem tags[NSHORTCUTS * 2 + 1];
56 for (i = 0; i < NSHORTCUTS; i++)
58 tags[2 * i].ti_Tag = Child;
59 tags[2 * i].ti_Data = (IPTR) Label(keyboard_label[i]);
60 tags[2 * i + 1].ti_Tag = Child;
61 tags[2 * i + 1].ti_Data = (IPTR) (data->keyboard_string[i] = MakeString());
63 tags[NSHORTCUTS * 2].ti_Tag = TAG_DONE;
64 tags[NSHORTCUTS * 2].ti_Data = 0;
66 return ScrollgroupObject,
67 MUIA_Scrollgroup_FreeHoriz, FALSE,
68 MUIA_Scrollgroup_Contents, (IPTR) ColGroupV(2),
69 InputListFrame,
70 TAG_MORE, (IPTR) tags,
71 End,
72 End;
76 static IPTR NavigationP_New(struct IClass *cl, Object *obj, struct opSet *msg)
78 struct MUI_NavigationPData *data;
79 struct MUI_NavigationPData d;
81 dnd_labels[0] = _(MSG_ALWAYS_SOLID);
82 dnd_labels[1] = _(MSG_GHOSTED_ON_BOX);
83 dnd_labels[2] = _(MSG_GHOSTED_OUTSIDE_BOX);
84 dnd_labels[3] = _(MSG_ALWAYS_GHOSTED);
86 balancing_labels[0] = _(MSG_SHOW_FRAMES);
87 balancing_labels[1] = _(MSG_SHOW_OBJECTS);
88 keyboard_label[ 0] = _(MSG_KL_PRESS);
89 keyboard_label[ 1] = _(MSG_KL_TOGGLE);
90 keyboard_label[ 2] = _(MSG_KL_UP);
91 keyboard_label[ 3] = _(MSG_KL_DOWN);
92 keyboard_label[ 4] = _(MSG_KL_PAGE_UP);
93 keyboard_label[ 5] = _(MSG_KL_PAGE_DOWN);
94 keyboard_label[ 6] = _(MSG_KL_TOP);
95 keyboard_label[ 7] = _(MSG_KL_BOTTOM);
96 keyboard_label[ 8] = _(MSG_KL_LEFT);
97 keyboard_label[ 9] = _(MSG_KL_RIGHT);
98 keyboard_label[10] = _(MSG_KL_WORD_LEFT);
99 keyboard_label[11] = _(MSG_KL_WORD_RIGHT);
100 keyboard_label[12] = _(MSG_KL_LINE_START);
101 keyboard_label[13] = _(MSG_KL_LINE_END);
102 keyboard_label[14] = _(MSG_KL_NEXT_GADGET);
103 keyboard_label[15] = _(MSG_KL_PREV_GADGET);
104 keyboard_label[16] = _(MSG_KL_GADGET_OFF);
105 keyboard_label[17] = _(MSG_KL_CLOSE_WINDOW);
106 keyboard_label[18] = _(MSG_KL_NEXT_WINDOW);
107 keyboard_label[19] = _(MSG_KL_PREV_WINDOW);
108 keyboard_label[20] = _(MSG_KL_HELP);
109 keyboard_label[21] = _(MSG_KL_POPUP);
111 obj = (Object *) DoSuperNewTags
113 cl, obj, NULL,
114 MUIA_Group_Horiz, TRUE,
115 Child, (IPTR) VGroup,
116 Child, (IPTR) VGroup,
117 GroupFrameT(_(MSG_DRAG_DROP)),
118 Child, (IPTR) ColGroup(3),
119 Child, (IPTR) Label(_(MSG_LEFT_BUTTON)),
120 Child, (IPTR) (d.drag_leftbutton_checkmark = MakeCheck(NULL)),
121 Child, (IPTR) (d.drag_leftbutton_string = MakeString()),
123 Child, (IPTR) Label(_(MSG_MIDDLE_BUTTON)),
124 Child, (IPTR) (d.drag_middlebutton_checkmark = MakeCheck(NULL)),
125 Child, (IPTR) (d.drag_middlebutton_string = MakeString()),
127 Child, (IPTR) Label(_(MSG_AUTOSTART)),
128 Child, (IPTR) (d.drag_autostart_checkmark = MakeCheck(NULL)),
129 Child, (IPTR) (d.drag_autostart_slider = SliderObject,
130 MUIA_CycleChain, 1,
131 MUIA_Numeric_Format, (IPTR) _(MSG_PIXEL),
132 MUIA_Numeric_Min, 1,
133 MUIA_Numeric_Max, 20,
134 End), // Slider
135 End, // ColGroup(3)
136 Child, ColGroup(2),
137 Child, (IPTR) FreeLabel(_(MSG_FRAME_COLON)),
138 Child, (IPTR) (d.dnd_popframe = MakePopframe()),
139 Child, (IPTR) Label(_(MSG_LOOK_COLON)),
140 Child, (IPTR) (d.drag_look_cycle = MakeCycle(NULL, dnd_labels)),
141 End, // ColGroup(2),
142 End, // Drag & Drop
143 Child, VGroup,
144 GroupFrameT(_(MSG_BALANCING_GROUPS)),
145 Child, (IPTR) HVSpace,
146 Child, (IPTR) ColGroup(2),
147 Child, (IPTR) Label(_(MSG_LOOK_COLON)),
148 Child, (IPTR) (d.balance_look_cycle = MakeCycle(NULL, balancing_labels)),
149 Child, (IPTR) Label(_(MSG_EXAMPLE)),
150 Child, (IPTR) HGroup,
151 Child, (IPTR) TextObject,
152 TextFrame,
153 MUIA_Text_SetMin, FALSE,
154 MUIA_Text_PreParse, "\33c",
155 MUIA_Text_Contents, _(MSG_TRY_WITH),
156 End,
157 Child, (IPTR) BalanceObject, End,
158 Child, (IPTR) TextObject,
159 TextFrame,
160 MUIA_Text_SetMin, FALSE,
161 MUIA_Text_PreParse, "\33c",
162 MUIA_Text_Contents, _(MSG_SHIFT),
163 End,
164 Child, (IPTR) BalanceObject, End,
165 Child, (IPTR) TextObject,
166 TextFrame,
167 MUIA_Text_SetMin, FALSE,
168 MUIA_Text_PreParse, "\33c",
169 MUIA_Text_Contents, _(MSG_TOO),
170 End,
171 End, // HGroup
172 End, // ColGroup
173 Child, (IPTR) HVSpace,
174 End, // Balancing Groups
175 End, // VGroup Left
176 Child, (IPTR) VGroup,
177 GroupFrameT(_(MSG_KEYBOARD_CONTROL)),
178 Child, (IPTR) HGroup,
179 Child, (IPTR) VGroup,
180 MUIA_Group_VertSpacing, 0,
181 Child, (IPTR) VSpace(3),
182 Child, (IPTR) Label(_(MSG_COLOR_ACTIVE_OBJ)),
183 Child, (IPTR) VSpace(3),
184 End, // VGroup label
185 Child, (IPTR) (d.active_poppen = MakePoppen()),
186 End, // HGroup
187 Child, (IPTR) MakeScrollgroup(&d),
188 End, // VGroup KB Ctrl
189 TAG_MORE, (IPTR) msg->ops_AttrList);
191 if (!obj) return FALSE;
193 data = INST_DATA(cl, obj);
194 *data = d;
196 DoMethod
198 data->drag_leftbutton_checkmark, MUIM_Notify,
199 MUIA_Selected, MUIV_EveryTime,
200 (IPTR) data->drag_leftbutton_string, 3, MUIM_Set,
201 MUIA_Disabled, MUIV_NotTriggerValue
204 DoMethod
206 data->drag_middlebutton_checkmark, MUIM_Notify,
207 MUIA_Selected, MUIV_EveryTime,
208 (IPTR) data->drag_middlebutton_string, 3, MUIM_Set,
209 MUIA_Disabled, MUIV_NotTriggerValue
212 DoMethod
214 data->drag_autostart_checkmark, MUIM_Notify,
215 MUIA_Selected, MUIV_EveryTime,
216 (IPTR) data->drag_autostart_slider, 3, MUIM_Set,
217 MUIA_Disabled, MUIV_NotTriggerValue
220 return (IPTR)obj;
225 * MUIM_Settingsgroup_ConfigToGadgets
227 static IPTR NavigationP_ConfigToGadgets(struct IClass *cl, Object *obj,
228 struct MUIP_Settingsgroup_ConfigToGadgets *msg)
230 struct MUI_NavigationPData *data = INST_DATA(cl, obj);
231 int i;
233 ConfigToCheckmark(msg->configdata, MUICFG_Drag_LeftButton, data->drag_leftbutton_checkmark);
234 ConfigToString(msg->configdata, MUICFG_Drag_LMBModifier, data->drag_leftbutton_string);
236 ConfigToCheckmark(msg->configdata, MUICFG_Drag_MiddleButton, data->drag_middlebutton_checkmark);
237 ConfigToString(msg->configdata, MUICFG_Drag_MMBModifier, data->drag_middlebutton_string);
239 ConfigToCheckmark(msg->configdata, MUICFG_Drag_Autostart, data->drag_autostart_checkmark);
240 ConfigToSlider(msg->configdata, MUICFG_Drag_Autostart_Length, data->drag_autostart_slider);
242 ConfigToFrame(msg->configdata, MUICFG_Frame_Drag,data->dnd_popframe);
243 ConfigToCycle(msg->configdata, MUICFG_Dragndrop_Look, data->drag_look_cycle);
245 ConfigToCycle(msg->configdata, MUICFG_Balance_Look, data->balance_look_cycle);
247 ConfigToPen(msg->configdata, MUICFG_ActiveObject_Color, data->active_poppen);
249 for (i = 0; i < NSHORTCUTS; i++)
250 ConfigToString(msg->configdata, MUICFG_Keyboard_Press + i, data->keyboard_string[i]);
252 return TRUE;
257 * MUIM_Settingsgroup_ConfigToGadgets
259 static IPTR NavigationP_GadgetsToConfig(struct IClass *cl, Object *obj,
260 struct MUIP_Settingsgroup_GadgetsToConfig *msg)
262 struct MUI_NavigationPData *data = INST_DATA(cl, obj);
263 int i;
265 CheckmarkToConfig(data->drag_leftbutton_checkmark, msg->configdata, MUICFG_Drag_LeftButton);
266 StringToConfig(data->drag_leftbutton_string, msg->configdata, MUICFG_Drag_LMBModifier);
268 CheckmarkToConfig(data->drag_middlebutton_checkmark, msg->configdata, MUICFG_Drag_MiddleButton);
269 StringToConfig(data->drag_middlebutton_string, msg->configdata, MUICFG_Drag_MMBModifier);
271 CheckmarkToConfig(data->drag_autostart_checkmark, msg->configdata, MUICFG_Drag_Autostart);
272 SliderToConfig(data->drag_autostart_slider, msg->configdata, MUICFG_Drag_Autostart_Length);
274 FrameToConfig(data->dnd_popframe, msg->configdata, MUICFG_Frame_Drag);
275 CycleToConfig(data->drag_look_cycle, msg->configdata, MUICFG_Dragndrop_Look);
277 CycleToConfig(data->balance_look_cycle, msg->configdata, MUICFG_Balance_Look);
279 PenToConfig(data->active_poppen, msg->configdata, MUICFG_ActiveObject_Color);
281 for (i = 0; i < NSHORTCUTS; i++)
282 StringToConfig(data->keyboard_string[i], msg->configdata, MUICFG_Keyboard_Press + i);
284 return TRUE;
288 BOOPSI_DISPATCHER(IPTR, NavigationP_Dispatcher, cl, obj, msg)
290 switch (msg->MethodID)
292 case OM_NEW: return NavigationP_New(cl, obj, (struct opSet *)msg);
293 case MUIM_Settingsgroup_ConfigToGadgets: return NavigationP_ConfigToGadgets(cl,obj,(APTR)msg);break;
294 case MUIM_Settingsgroup_GadgetsToConfig: return NavigationP_GadgetsToConfig(cl,obj,(APTR)msg);break;
297 return DoSuperMethodA(cl, obj, msg);
299 BOOPSI_DISPATCHER_END
302 * Class descriptor.
304 const struct __MUIBuiltinClass _MUIP_Navigation_desc = {
305 "Navigation",
306 MUIC_Group,
307 sizeof(struct MUI_NavigationPData),
308 (void*)NavigationP_Dispatcher
312 static const UBYTE icon32[] =
314 0x00, 0x00, 0x00, 0x18, // width
315 0x00, 0x00, 0x00, 0x13, // height
316 'B', 'Z', '2', '\0',
317 0x00, 0x00, 0x00, 0x84, // number of bytes
319 0x42, 0x5a, 0x68, 0x39, 0x31, 0x41, 0x59, 0x26, 0x53, 0x59, 0xb5, 0x28,
320 0xdf, 0x3c, 0x00, 0x02, 0xde, 0x62, 0x42, 0xa2, 0x02, 0x00, 0x20, 0x40,
321 0x00, 0x00, 0x0c, 0x42, 0x40, 0x00, 0x00, 0xb0, 0x00, 0xc0, 0x08, 0x4a,
322 0x44, 0x32, 0x10, 0x0d, 0x34, 0xd0, 0x40, 0x34, 0xd3, 0x47, 0xa8, 0x25,
323 0x09, 0x30, 0x24, 0x9b, 0x63, 0x9d, 0x82, 0x8f, 0xd1, 0x45, 0x3a, 0xe5,
324 0x1d, 0x5d, 0xcf, 0x1b, 0x7c, 0x3a, 0xe8, 0x05, 0xb6, 0xa2, 0x90, 0xf0,
325 0x15, 0x1f, 0x41, 0x51, 0xca, 0x2a, 0xfb, 0xe2, 0x1e, 0xc0, 0x6c, 0x26,
326 0xa9, 0x62, 0x22, 0x03, 0x40, 0x44, 0x94, 0x85, 0x2d, 0x68, 0xcd, 0x28,
327 0x66, 0x12, 0x89, 0x82, 0x48, 0x1d, 0x01, 0x89, 0xa6, 0x92, 0x28, 0xc6,
328 0x0a, 0x45, 0x69, 0xa2, 0x80, 0x42, 0xe0, 0xab, 0x71, 0x82, 0x29, 0xa2,
329 0x17, 0xf8, 0xbb, 0x92, 0x29, 0xc2, 0x84, 0x85, 0xa9, 0x46, 0xf9, 0xe0,
333 Object *navigationclass_get_icon(void)
335 return RawimageObject,
336 MUIA_Rawimage_Data, icon32,
337 End;