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 #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
;
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
)
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),
69 TAG_MORE
, (IPTR
) tags
,
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
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
,
130 MUIA_Numeric_Format
, (IPTR
) _(MSG_PIXEL
),
132 MUIA_Numeric_Max
, 20,
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
)),
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
,
152 MUIA_Text_SetMin
, FALSE
,
153 MUIA_Text_PreParse
, "\33c",
154 MUIA_Text_Contents
, _(MSG_TRY_WITH
),
156 Child
, (IPTR
) BalanceObject
, End
,
157 Child
, (IPTR
) TextObject
,
159 MUIA_Text_SetMin
, FALSE
,
160 MUIA_Text_PreParse
, "\33c",
161 MUIA_Text_Contents
, _(MSG_SHIFT
),
163 Child
, (IPTR
) BalanceObject
, End
,
164 Child
, (IPTR
) TextObject
,
166 MUIA_Text_SetMin
, FALSE
,
167 MUIA_Text_PreParse
, "\33c",
168 MUIA_Text_Contents
, _(MSG_TOO
),
172 Child
, (IPTR
) HVSpace
,
173 End
, // Balancing Groups
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),
184 Child
, (IPTR
) (d
.active_poppen
= MakePoppen()),
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
);
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
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
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
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
);
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
]);
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
);
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
);
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
303 const struct __MUIBuiltinClass _MUIP_Navigation_desc
= {
306 sizeof(struct MUI_NavigationPData
),
307 (void*)NavigationP_Dispatcher