Updated PCI IDs to latest snapshot.
[tangerine.git] / workbench / prefs / Zune / navigationp.c
blob5b5ec65f5fd4a6ad3eb8fb443f14b17e63ec6eed
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 <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 #define NSHORTCUTS (MUICFG_Keyboard_Popup - MUICFG_Keyboard_Press + 1)
31 struct MUI_NavigationPData
33 Object *drag_leftbutton_checkmark;
34 Object *drag_leftbutton_string;
35 Object *drag_middlebutton_checkmark;
36 Object *drag_middlebutton_string;
37 Object *drag_autostart_checkmark;
38 Object *drag_autostart_slider;
39 Object *dnd_popframe;
40 Object *drag_look_cycle;
41 Object *balance_look_cycle;
42 Object *active_poppen;
43 Object *keyboard_string[NSHORTCUTS];
46 static CONST_STRPTR dnd_labels[5];
47 static CONST_STRPTR balancing_labels[3];
48 static CONST_STRPTR keyboard_label[NSHORTCUTS];
50 static Object *MakeScrollgroup (struct MUI_NavigationPData *data)
52 int i;
53 struct TagItem tags[NSHORTCUTS * 2 + 1];
55 for (i = 0; i < NSHORTCUTS; i++)
57 tags[2 * i].ti_Tag = Child;
58 tags[2 * i].ti_Data = (IPTR) Label(keyboard_label[i]);
59 tags[2 * i + 1].ti_Tag = Child;
60 tags[2 * i + 1].ti_Data = (IPTR) (data->keyboard_string[i] = MakeString());
62 tags[NSHORTCUTS * 2].ti_Tag = TAG_DONE;
63 tags[NSHORTCUTS * 2].ti_Data = 0;
65 return ScrollgroupObject,
66 MUIA_Scrollgroup_FreeHoriz, FALSE,
67 MUIA_Scrollgroup_Contents, (IPTR) ColGroupV(2),
68 InputListFrame,
69 TAG_MORE, (IPTR) tags,
70 End,
71 End;
75 static IPTR NavigationP_New(struct IClass *cl, Object *obj, struct opSet *msg)
77 struct MUI_NavigationPData *data;
78 struct MUI_NavigationPData d;
80 dnd_labels[0] = _(MSG_ALWAYS_SOLID);
81 dnd_labels[1] = _(MSG_GHOSTED_ON_BOX);
82 dnd_labels[2] = _(MSG_GHOSTED_OUTSIDE_BOX);
83 dnd_labels[3] = _(MSG_ALWAYS_GHOSTED);
85 balancing_labels[0] = _(MSG_SHOW_FRAMES);
86 balancing_labels[1] = _(MSG_SHOW_OBJECTS);
87 keyboard_label[ 0] = _(MSG_KL_PRESS);
88 keyboard_label[ 1] = _(MSG_KL_TOGGLE);
89 keyboard_label[ 2] = _(MSG_KL_UP);
90 keyboard_label[ 3] = _(MSG_KL_DOWN);
91 keyboard_label[ 4] = _(MSG_KL_PAGE_UP);
92 keyboard_label[ 5] = _(MSG_KL_PAGE_DOWN);
93 keyboard_label[ 6] = _(MSG_KL_TOP);
94 keyboard_label[ 7] = _(MSG_KL_BOTTOM);
95 keyboard_label[ 8] = _(MSG_KL_LEFT);
96 keyboard_label[ 9] = _(MSG_KL_RIGHT);
97 keyboard_label[10] = _(MSG_KL_WORD_LEFT);
98 keyboard_label[11] = _(MSG_KL_WORD_RIGHT);
99 keyboard_label[12] = _(MSG_KL_LINE_START);
100 keyboard_label[13] = _(MSG_KL_LINE_END);
101 keyboard_label[14] = _(MSG_KL_NEXT_GADGET);
102 keyboard_label[15] = _(MSG_KL_PREV_GADGET);
103 keyboard_label[16] = _(MSG_KL_GADGET_OFF);
104 keyboard_label[17] = _(MSG_KL_CLOSE_WINDOW);
105 keyboard_label[18] = _(MSG_KL_NEXT_WINDOW);
106 keyboard_label[19] = _(MSG_KL_PREV_WINDOW);
107 keyboard_label[20] = _(MSG_KL_HELP);
108 keyboard_label[21] = _(MSG_KL_POPUP);
110 obj = (Object *) DoSuperNewTags
112 cl, obj, NULL,
113 MUIA_Group_Horiz, TRUE,
114 Child, (IPTR) VGroup,
115 Child, (IPTR) VGroup,
116 GroupFrameT(_(MSG_DRAG_DROP)),
117 Child, (IPTR) ColGroup(3),
118 Child, (IPTR) Label(_(MSG_LEFT_BUTTON)),
119 Child, (IPTR) (d.drag_leftbutton_checkmark = MakeCheck(NULL)),
120 Child, (IPTR) (d.drag_leftbutton_string = MakeString()),
122 Child, (IPTR) Label(_(MSG_MIDDLE_BUTTON)),
123 Child, (IPTR) (d.drag_middlebutton_checkmark = MakeCheck(NULL)),
124 Child, (IPTR) (d.drag_middlebutton_string = MakeString()),
126 Child, (IPTR) Label(_(MSG_AUTOSTART)),
127 Child, (IPTR) (d.drag_autostart_checkmark = MakeCheck(NULL)),
128 Child, (IPTR) (d.drag_autostart_slider = SliderObject,
129 MUIA_CycleChain, 1,
130 MUIA_Numeric_Format, (IPTR) _(MSG_PIXEL),
131 MUIA_Numeric_Min, 1,
132 MUIA_Numeric_Max, 20,
133 End), // Slider
134 End, // ColGroup(3)
135 Child, ColGroup(2),
136 Child, (IPTR) FreeLabel(_(MSG_FRAME_COLON)),
137 Child, (IPTR) (d.dnd_popframe = MakePopframe()),
138 Child, (IPTR) Label(_(MSG_LOOK_COLON)),
139 Child, (IPTR) (d.drag_look_cycle = MakeCycle(NULL, dnd_labels)),
140 End, // ColGroup(2),
141 End, // Drag & Drop
142 Child, VGroup,
143 GroupFrameT(_(MSG_BALANCING_GROUPS)),
144 Child, (IPTR) HVSpace,
145 Child, (IPTR) ColGroup(2),
146 Child, (IPTR) Label(_(MSG_LOOK_COLON)),
147 Child, (IPTR) (d.balance_look_cycle = MakeCycle(NULL, balancing_labels)),
148 Child, (IPTR) Label(_(MSG_EXAMPLE)),
149 Child, (IPTR) HGroup,
150 Child, (IPTR) TextObject,
151 TextFrame,
152 MUIA_Text_SetMin, FALSE,
153 MUIA_Text_PreParse, "\33c",
154 MUIA_Text_Contents, _(MSG_TRY_WITH),
155 End,
156 Child, (IPTR) BalanceObject, End,
157 Child, (IPTR) TextObject,
158 TextFrame,
159 MUIA_Text_SetMin, FALSE,
160 MUIA_Text_PreParse, "\33c",
161 MUIA_Text_Contents, _(MSG_SHIFT),
162 End,
163 Child, (IPTR) BalanceObject, End,
164 Child, (IPTR) TextObject,
165 TextFrame,
166 MUIA_Text_SetMin, FALSE,
167 MUIA_Text_PreParse, "\33c",
168 MUIA_Text_Contents, _(MSG_TOO),
169 End,
170 End, // HGroup
171 End, // ColGroup
172 Child, (IPTR) HVSpace,
173 End, // Balancing Groups
174 End, // VGroup Left
175 Child, (IPTR) VGroup,
176 GroupFrameT(_(MSG_KEYBOARD_CONTROL)),
177 Child, (IPTR) HGroup,
178 Child, (IPTR) VGroup,
179 MUIA_Group_VertSpacing, 0,
180 Child, (IPTR) VSpace(3),
181 Child, (IPTR) Label(_(MSG_COLOR_ACTIVE_OBJ)),
182 Child, (IPTR) VSpace(3),
183 End, // VGroup label
184 Child, (IPTR) (d.active_poppen = MakePoppen()),
185 End, // HGroup
186 Child, (IPTR) MakeScrollgroup(&d),
187 End, // VGroup KB Ctrl
188 TAG_MORE, (IPTR) msg->ops_AttrList);
190 if (!obj) return FALSE;
192 data = INST_DATA(cl, obj);
193 *data = d;
195 DoMethod
197 data->drag_leftbutton_checkmark, MUIM_Notify,
198 MUIA_Selected, MUIV_EveryTime,
199 (IPTR) data->drag_leftbutton_string, 3, MUIM_Set,
200 MUIA_Disabled, MUIV_NotTriggerValue
203 DoMethod
205 data->drag_middlebutton_checkmark, MUIM_Notify,
206 MUIA_Selected, MUIV_EveryTime,
207 (IPTR) data->drag_middlebutton_string, 3, MUIM_Set,
208 MUIA_Disabled, MUIV_NotTriggerValue
211 DoMethod
213 data->drag_autostart_checkmark, MUIM_Notify,
214 MUIA_Selected, MUIV_EveryTime,
215 (IPTR) data->drag_autostart_slider, 3, MUIM_Set,
216 MUIA_Disabled, MUIV_NotTriggerValue
219 return (IPTR)obj;
224 * MUIM_Settingsgroup_ConfigToGadgets
226 static IPTR NavigationP_ConfigToGadgets(struct IClass *cl, Object *obj,
227 struct MUIP_Settingsgroup_ConfigToGadgets *msg)
229 struct MUI_NavigationPData *data = INST_DATA(cl, obj);
230 int i;
232 ConfigToCheckmark(msg->configdata, MUICFG_Drag_LeftButton, data->drag_leftbutton_checkmark);
233 ConfigToString(msg->configdata, MUICFG_Drag_LMBModifier, data->drag_leftbutton_string);
235 ConfigToCheckmark(msg->configdata, MUICFG_Drag_MiddleButton, data->drag_middlebutton_checkmark);
236 ConfigToString(msg->configdata, MUICFG_Drag_MMBModifier, data->drag_middlebutton_string);
238 ConfigToCheckmark(msg->configdata, MUICFG_Drag_Autostart, data->drag_autostart_checkmark);
239 ConfigToSlider(msg->configdata, MUICFG_Drag_Autostart_Length, data->drag_autostart_slider);
241 ConfigToFrame(msg->configdata, MUICFG_Frame_Drag,data->dnd_popframe);
242 ConfigToCycle(msg->configdata, MUICFG_Dragndrop_Look, data->drag_look_cycle);
244 ConfigToCycle(msg->configdata, MUICFG_Balance_Look, data->balance_look_cycle);
246 ConfigToPen(msg->configdata, MUICFG_ActiveObject_Color, data->active_poppen);
248 for (i = 0; i < NSHORTCUTS; i++)
249 ConfigToString(msg->configdata, MUICFG_Keyboard_Press + i, data->keyboard_string[i]);
251 return TRUE;
256 * MUIM_Settingsgroup_ConfigToGadgets
258 static IPTR NavigationP_GadgetsToConfig(struct IClass *cl, Object *obj,
259 struct MUIP_Settingsgroup_GadgetsToConfig *msg)
261 struct MUI_NavigationPData *data = INST_DATA(cl, obj);
262 int i;
264 CheckmarkToConfig(data->drag_leftbutton_checkmark, msg->configdata, MUICFG_Drag_LeftButton);
265 StringToConfig(data->drag_leftbutton_string, msg->configdata, MUICFG_Drag_LMBModifier);
267 CheckmarkToConfig(data->drag_middlebutton_checkmark, msg->configdata, MUICFG_Drag_MiddleButton);
268 StringToConfig(data->drag_middlebutton_string, msg->configdata, MUICFG_Drag_MMBModifier);
270 CheckmarkToConfig(data->drag_autostart_checkmark, msg->configdata, MUICFG_Drag_Autostart);
271 SliderToConfig(data->drag_autostart_slider, msg->configdata, MUICFG_Drag_Autostart_Length);
273 FrameToConfig(data->dnd_popframe, msg->configdata, MUICFG_Frame_Drag);
274 CycleToConfig(data->drag_look_cycle, msg->configdata, MUICFG_Dragndrop_Look);
276 CycleToConfig(data->balance_look_cycle, msg->configdata, MUICFG_Balance_Look);
278 PenToConfig(data->active_poppen, msg->configdata, MUICFG_ActiveObject_Color);
280 for (i = 0; i < NSHORTCUTS; i++)
281 StringToConfig(data->keyboard_string[i], msg->configdata, MUICFG_Keyboard_Press + i);
283 return TRUE;
287 BOOPSI_DISPATCHER(IPTR, NavigationP_Dispatcher, cl, obj, msg)
289 switch (msg->MethodID)
291 case OM_NEW: return NavigationP_New(cl, obj, (struct opSet *)msg);
292 case MUIM_Settingsgroup_ConfigToGadgets: return NavigationP_ConfigToGadgets(cl,obj,(APTR)msg);break;
293 case MUIM_Settingsgroup_GadgetsToConfig: return NavigationP_GadgetsToConfig(cl,obj,(APTR)msg);break;
296 return DoSuperMethodA(cl, obj, msg);
298 BOOPSI_DISPATCHER_END
301 * Class descriptor.
303 const struct __MUIBuiltinClass _MUIP_Navigation_desc = {
304 "Navigation",
305 MUIC_Group,
306 sizeof(struct MUI_NavigationPData),
307 (void*)NavigationP_Dispatcher