revert 213 commits (to 56092) from the last month. 10 still need work to resolve...
[AROS.git] / workbench / classes / zune / nlist / nlistviews_mcp / NListviews.c
blobaf6d092d7ab111be5879369d8d9237faaf93d8ad
1 /***************************************************************************
3 NListviews.mcp - New Listview MUI Custom Class Preferences
4 Registered MUI class, Serial Number: 1d51 (0x9d510001 to 0x9d51001F
5 and 0x9d510101 to 0x9d51013F)
7 Copyright (C) 1996-2001 by Gilles Masson
8 Copyright (C) 2001-2014 NList Open Source Team
10 This library is free software; you can redistribute it and/or
11 modify it under the terms of the GNU Lesser General Public
12 License as published by the Free Software Foundation; either
13 version 2.1 of the License, or (at your option) any later version.
15 This library is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Lesser General Public License for more details.
20 NList classes Support Site: http://www.sf.net/projects/nlist-classes
22 $Id$
24 ***************************************************************************/
26 #include <string.h>
27 #include <stdlib.h>
29 #include <devices/inputevent.h>
30 #include <libraries/asl.h>
31 #include <libraries/locale.h>
32 #include <libraries/commodities.h>
33 #include <mui/HotkeyString_mcc.h>
35 #include <clib/alib_protos.h>
36 #include <proto/commodities.h>
37 #include <proto/muimaster.h>
38 #include <proto/intuition.h>
39 #include <proto/console.h>
40 #include <proto/locale.h>
41 #include <proto/exec.h>
43 #include "private.h"
44 #include "version.h"
46 #include "locale.h"
48 #include "muiextra.h"
50 #define INTUIBASEMIN 39
53 #define SimpleButtonCycle(name,helpstring) \
54 (void *)TextObject, \
55 ButtonFrame, \
56 MUIA_CycleChain, 1, \
57 MUIA_Font, MUIV_Font_Button, \
58 MUIA_Text_Contents, name, \
59 MUIA_Text_PreParse, "\33c", \
60 MUIA_InputMode , MUIV_InputMode_RelVerify, \
61 MUIA_Background , MUII_ButtonBack, \
62 MUIA_ShortHelp, helpstring, \
63 End
66 #define ToggleButtonCycle(name,selected,disable,helpstring) \
67 (void *)TextObject, \
68 ButtonFrame, \
69 MUIA_CycleChain, 1, \
70 MUIA_Font, MUIV_Font_Button, \
71 MUIA_Text_Contents, name, \
72 MUIA_Text_PreParse, "\33c", \
73 MUIA_Text_SetMax, TRUE, \
74 MUIA_InputMode , MUIV_InputMode_Toggle, \
75 MUIA_Selected , selected,\
76 MUIA_Background , MUII_ButtonBack, \
77 MUIA_Disabled , disable,\
78 MUIA_ShortHelp, helpstring, \
79 End
82 MUIA_ShowSelState , FALSE,\
84 struct QualifierDef {
85 char *qualstr;
86 LONG qualval;
90 static struct QualifierDef QualTab[] =
92 { "SHIFT", (IEQUALIFIER_LSHIFT|IEQUALIFIER_RSHIFT) },
93 { "LSHIFT", IEQUALIFIER_LSHIFT },
94 { "RSHIFT", IEQUALIFIER_RSHIFT },
95 { "CONTROL", IEQUALIFIER_CONTROL },
96 { "ALT", (IEQUALIFIER_LALT|IEQUALIFIER_RALT) },
97 { "LALT", IEQUALIFIER_LALT },
98 { "RALT", IEQUALIFIER_RALT },
99 { "COMMAND", (IEQUALIFIER_LCOMMAND|IEQUALIFIER_RCOMMAND) },
100 { "LCOMMAND", IEQUALIFIER_LCOMMAND },
101 { "RCOMMAND", IEQUALIFIER_RCOMMAND },
102 { "MIDBUTTON", IEQUALIFIER_MIDBUTTON },
103 { "RBUTTON", IEQUALIFIER_RBUTTON },
104 { "LEFTBUTTON", IEQUALIFIER_LEFTBUTTON },
105 { NULL, 0 }
109 Object *MakeCheck(STRPTR label, STRPTR help, ULONG check)
111 Object *obj = MUI_MakeObject(MUIO_Checkmark, label);
112 if (obj)
114 SetAttrs(obj, MUIA_CycleChain, 1,
115 MUIA_Selected, check,
116 MUIA_ShortHelp, help,
117 TAG_DONE);
120 return (obj);
123 #define String2(contents,maxlen)\
124 (void *)StringObject,\
125 StringFrame,\
126 MUIA_CycleChain, 1,\
127 MUIA_String_MaxLen , maxlen,\
128 MUIA_String_Contents, contents,\
131 #define LOAD_DATALONG(obj,attr,cfg_attr,defaultval) \
133 ULONG *ptrd; \
134 if((ptrd = (ULONG *) DoMethod(msg->configdata, MUIM_Dataspace_Find, cfg_attr))) \
135 set(obj, attr, *ptrd); \
136 else \
137 set(obj, attr, defaultval); \
140 #define SAVE_DATALONG(obj,attr,cfg_attr) \
142 IPTR ptrd=0; \
143 get(obj, attr, &ptrd); \
144 DoMethod(msg->configdata, MUIM_Dataspace_Add, &ptrd, sizeof(ptrd), cfg_attr); \
147 #define LOAD_DATASPEC(obj,attr,cfg_attr,defaultval) \
149 IPTR ptrd; \
150 if((ptrd = DoMethod(msg->configdata, MUIM_Dataspace_Find, cfg_attr))) \
151 set(obj, attr, ptrd); \
152 else \
153 set(obj, attr, defaultval); \
156 #define SAVE_DATASPEC(obj,attr,cfg_attr) \
158 IPTR ptrd=0; \
159 get(obj, attr, &ptrd); \
160 if (ptrd) \
161 DoMethod(msg->configdata, MUIM_Dataspace_Add, ptrd, strlen((char *)ptrd)+1, cfg_attr); \
164 #define SAVE_DATASPEC2(obj,attr,cfg_attr) \
166 IPTR ptrd=0; \
167 get(obj, attr, &ptrd); \
168 if (ptrd) \
169 DoMethod(msg->configdata, MUIM_Dataspace_Add, ptrd, strlen((char *)ptrd)+1, cfg_attr); \
172 #define LOAD_DATAFONT(obj,cfg_attr) \
174 LONG ptrd; \
175 if((ptrd = DoMethod(msg->configdata, MUIM_Dataspace_Find, cfg_attr))) \
176 set(obj, MUIA_String_Contents, ptrd); \
177 else \
178 set(obj, MUIA_String_Contents, ""); \
181 #define SAVE_DATAFONT(obj,cfg_attr) \
183 IPTR ptrd=0; \
184 get(obj, MUIA_String_Contents, &ptrd); \
185 if (ptrd) \
187 LONG dlen = strlen((char *) ptrd) + 1; \
188 if (dlen > 2) \
189 DoMethod(msg->configdata, MUIM_Dataspace_Add, ptrd, dlen, cfg_attr); \
190 else \
191 DoMethod(msg->configdata, MUIM_Dataspace_Remove, cfg_attr); \
195 /* *********************************************************************** */
197 static DEFAULT_KEYS_ARRAY
199 static ULONG keytags[] =
201 KEYTAG_QUALIFIER_MULTISELECT ,
202 KEYTAG_QUALIFIER_DRAG ,
203 KEYTAG_QUALIFIER_BALANCE ,
204 KEYTAG_COPY_TO_CLIPBOARD ,
205 KEYTAG_DEFAULT_WIDTH_COLUMN ,
206 KEYTAG_DEFAULT_WIDTH_ALL_COLUMNS,
207 KEYTAG_DEFAULT_ORDER_COLUMN ,
208 KEYTAG_DEFAULT_ORDER_ALL_COLUMNS,
209 KEYTAG_SELECT_TO_TOP ,
210 KEYTAG_SELECT_TO_BOTTOM ,
211 KEYTAG_SELECT_TO_PAGE_UP ,
212 KEYTAG_SELECT_TO_PAGE_DOWN ,
213 KEYTAG_SELECT_UP ,
214 KEYTAG_SELECT_DOWN ,
215 KEYTAG_TOGGLE_ACTIVE ,
216 KEYTAG_QUALIFIER_WHEEL_FAST ,
217 KEYTAG_QUALIFIER_WHEEL_HORIZ ,
218 KEYTAG_QUALIFIER_TITLECLICK2 ,
224 static struct KeyBinding empty_key = { 0, (UWORD)-1, 0 };
226 /* *********************************************************************** */
229 static const char *MainTextArray[] =
231 "If you have problems, try to increase the stack value,",
232 "in the icon infos if you launch the program from icon,",
233 "stack of CLI if you start it from CLI/Shell,",
234 "and if you launch it from some utility read its docs",
235 "to see how to increase it.",
236 "A stack of 12Kb, 16Kb or 20Kb is most of time a good idea.",
237 " ",
238 "If you still have problems, try to see if they happen with the Demo prog, then tell me.",
239 "\033C",
240 "Latest public release can be found on aminet (dev/mui).",
241 "All releases are available on",
242 "http://www.sourceforge.net/projects/nlist-classes/",
243 "\033C",
244 "\033r\0333(C) 2001-2013 by NList Open Source Team",
245 "\033r\0333(C) 1996-1998 by Gilles Masson",
246 "\033r\0333http://www.sourceforge.net/projects/nlist-classes/",
247 "\033C",
248 "\033cThis new list/listview custom class",
249 "\033chandles its own configurable backgrounds,",
250 "\033cpens, fonts, scrollbars, keys and qualifiers",
251 "\033C",
252 "\033cThe way used to handle cursor with multiselection",
253 "\033cis not exactly as the listview one !",
254 "\033cDrag&Drop is supported, both scrollbars",
255 "\033ccan be configured to disappear automatically",
256 "\033cwhen not needed because all is visible.",
257 "\033cJust try it...",
258 "\033C",
259 "\033cYou can horizontaly scroll with cursor keys,",
260 "\033cor going on the right and left of the list",
261 "\033cwhile selecting with the mouse.",
262 "\033cTry just clicking on the left/right borders !",
263 "\033C",
264 "\033cYou can change columns widths just dragging",
265 "\033cthe vertical separator between columns titles",
266 "\033c(try it using the balancing qualifier too).",
267 "\033C",
268 "\033cYou can change columns order just dragging",
269 "\033cthe column titles.",
270 "\033C",
271 "\033cThere is builtin copy to clipboard stuff",
272 "\033cand classic char selection capability.",
273 "\033C",
274 "\033cTry the Demo program to test all that...",
275 " ",
276 " ",
277 "\033r\033bGive some feedback about it ! :-)",
278 "\033C",
279 "**************************************************************************************************",
280 NULL
284 // static arrays which we fill up later on
285 static const char *Pages[6];
286 static const char *RS_ColWidthDrag[4];
287 static const char *RS_VSB[4];
288 static const char *RS_HSB[5];
289 static const char *RS_Menu[4];
290 static const char *RS_MultiSelects[3];
291 static const char *RS_DragTypes[4];
292 static const char *functions_names[20];
294 static LONG DeadKeyConvert(struct NListviews_MCP_Data *data,struct KeyBinding *key)
296 char *text = data->rawtext;
297 char keystr[8];
298 UWORD qual = key->kb_Qualifier & KBQUAL_MASK;
299 UWORD same = key->kb_Qualifier & KBSYM_MASK;
300 int posraw;
302 text[0] = '\0';
304 if (qual)
305 { if ((qual & KBQUALIFIER_CAPS) && (same & KBSYM_CAPS))
306 strlcat(text, (char *)"caps ", sizeof(data->rawtext));
307 else if ((qual & KBQUALIFIER_SHIFT) && (same & KBSYM_SHIFT))
308 { strlcat(text, (char *)"shift ", sizeof(data->rawtext));
309 if (qual & IEQUALIFIER_CAPSLOCK) strlcat(text, (char *)"capslock ", sizeof(data->rawtext));
311 else
312 { if (qual & IEQUALIFIER_LSHIFT) strlcat(text, (char *)"lshift ", sizeof(data->rawtext));
313 if (qual & IEQUALIFIER_RSHIFT) strlcat(text, (char *)"rshift ", sizeof(data->rawtext));
314 if (qual & IEQUALIFIER_CAPSLOCK) strlcat(text, (char *)"capslock ", sizeof(data->rawtext));
316 if (qual & IEQUALIFIER_CONTROL) strlcat(text, (char *)"control ", sizeof(data->rawtext));
317 if ((qual & KBQUALIFIER_ALT) && (same & KBSYM_ALT))
318 strlcat(text, (char *)"alt ", sizeof(data->rawtext));
319 else
320 { if (qual & IEQUALIFIER_LALT) strlcat(text, (char *)"lalt ", sizeof(data->rawtext));
321 if (qual & IEQUALIFIER_RALT) strlcat(text, (char *)"ralt ", sizeof(data->rawtext));
323 if (qual & IEQUALIFIER_LCOMMAND) strlcat(text, (char *)"lcommand ", sizeof(data->rawtext));
324 if (qual & IEQUALIFIER_RCOMMAND) strlcat(text, (char *)"rcommand ", sizeof(data->rawtext));
325 if (qual & IEQUALIFIER_NUMERICPAD) strlcat(text, (char *)"numpad ", sizeof(data->rawtext));
328 if (!(key->kb_KeyTag & 0x00004000) && (key->kb_Code != (UWORD)~0))
330 switch (key->kb_Code & 0x7F)
332 case 0x40 : strlcat(text,"space", sizeof(data->rawtext)); break;
333 case 0x41 : strlcat(text,"backspace", sizeof(data->rawtext)); break;
334 case 0x42 : strlcat(text,"tab", sizeof(data->rawtext)); break;
335 case 0x43 : strlcat(text,"enter", sizeof(data->rawtext)); break;
336 case 0x44 : strlcat(text,"return", sizeof(data->rawtext)); break;
337 case 0x45 : strlcat(text,"esc", sizeof(data->rawtext)); break;
338 case 0x46 : strlcat(text,"del", sizeof(data->rawtext)); break;
339 case 0x4C : strlcat(text,"up", sizeof(data->rawtext)); break;
340 case 0x4D : strlcat(text,"down", sizeof(data->rawtext)); break;
341 case 0x4E : strlcat(text,"right", sizeof(data->rawtext)); break;
342 case 0x4F : strlcat(text,"left", sizeof(data->rawtext)); break;
343 case 0x50 : strlcat(text,"f1", sizeof(data->rawtext)); break;
344 case 0x51 : strlcat(text,"f2", sizeof(data->rawtext)); break;
345 case 0x52 : strlcat(text,"f3", sizeof(data->rawtext)); break;
346 case 0x53 : strlcat(text,"f4", sizeof(data->rawtext)); break;
347 case 0x54 : strlcat(text,"f5", sizeof(data->rawtext)); break;
348 case 0x55 : strlcat(text,"f6", sizeof(data->rawtext)); break;
349 case 0x56 : strlcat(text,"f7", sizeof(data->rawtext)); break;
350 case 0x57 : strlcat(text,"f8", sizeof(data->rawtext)); break;
351 case 0x58 : strlcat(text,"f9", sizeof(data->rawtext)); break;
352 case 0x59 : strlcat(text,"f10", sizeof(data->rawtext)); break;
353 case 0x5F : strlcat(text,"help", sizeof(data->rawtext)); break;
354 default:
355 data->ievent.ie_NextEvent = NULL;
356 data->ievent.ie_Class = IECLASS_RAWKEY;
357 data->ievent.ie_SubClass = 0;
358 data->ievent.ie_Code = key->kb_Code;
359 data->ievent.ie_Qualifier = 0;
360 data->ievent.ie_position.ie_addr = (APTR) &data->ievent;
361 posraw = RawKeyConvert(&data->ievent, keystr, sizeof(keystr), 0L);
363 if (posraw > 0)
365 keystr[posraw] = '\0';
366 strlcat(text, keystr, sizeof(data->rawtext));
368 break;
372 return ((LONG)strlen(data->rawtext));
376 static LONG NL_SaveKeys(struct NListviews_MCP_Data *data)
378 LONG pos,ne = 0;
379 struct KeyBinding *key;
381 get(data->mcp_listkeys, MUIA_NList_Entries, &ne);
382 ne++;
384 if((data->nlkeys = (struct KeyBinding *)AllocVecShared(ne*sizeof(struct KeyBinding),MEMF_ANY)))
386 pos = 0;
388 while (pos < ne)
390 DoMethod(data->mcp_listkeys,MUIM_NList_GetEntry,pos, &key);
391 if (key)
393 data->nlkeys[pos] = *key;
394 if (data->nlkeys[pos].kb_KeyTag & 0x00004000)
395 data->nlkeys[pos].kb_Code = (UWORD)~0;
397 else
398 break;
399 pos++;
402 data->nlkeys[pos].kb_KeyTag = 0L;
403 data->nlkeys[pos].kb_Code = (UWORD)~0;
404 data->nlkeys[pos].kb_Qualifier = 0;
405 pos++;
406 ne = ((pos * sizeof(struct KeyBinding)) + 3) & 0xFFFFFFFC;
408 return (ne);
411 return (0);
415 static void NL_LoadKeys(Object *list,struct KeyBinding *keys)
417 int i = 0;
419 set(list, MUIA_NList_Quiet, TRUE);
420 DoMethod(list,MUIM_NList_Clear);
421 while (keys[i].kb_KeyTag)
423 DoMethod(list,MUIM_NList_InsertSingle,&keys[i], MUIV_NList_Insert_Bottom);
424 i++;
426 set(list, MUIA_NList_Quiet, FALSE);
430 static void NL_UpdateKeys(Object *list,struct KeyBinding *keys)
432 int i;
433 LONG pos,posmax = -1;
434 struct KeyBinding *key;
435 set(list, MUIA_NList_Quiet, TRUE);
436 get(list,MUIA_NList_Entries,&posmax);
437 for (i = 0; keys[i].kb_KeyTag; i++)
439 for (pos = 0; pos < posmax; pos++)
441 DoMethod(list,MUIM_NList_GetEntry, pos, &key);
442 if (key && (key->kb_KeyTag == keys[i].kb_KeyTag))
443 break;
446 LONG k1 = (LONG) key->kb_KeyTag;
447 LONG k2 = (LONG) keys[i].kb_KeyTag;
448 kprintf("%lx|pos=%ld key=%lx kt=%lx (== %lx)\n",list,pos,key,k1,k2);
450 else
452 LONG k1 = (LONG) key->kb_KeyTag;
453 LONG k2 = (LONG) keys[i].kb_KeyTag;
454 kprintf("%lx|pos=%ld key=%lx kt=%lx (!= %lx)\n",list,pos,key,k1,k2);
458 if (pos >= posmax)
459 DoMethod(list,MUIM_NList_InsertSingle,&keys[i], MUIV_NList_Insert_Bottom);
461 set(list, MUIA_NList_Quiet, FALSE);
464 HOOKPROTONH(StrObjFunc, LONG, Object *pop, Object *str)
466 LONG i = 0;
468 get(str,MUIA_UserData,&i);
469 if (i >= 0)
470 set(pop,MUIA_List_Active,i);
471 else
472 set(pop,MUIA_List_Active,MUIV_List_Active_Off);
473 return(TRUE);
475 MakeStaticHook(StrObjHook, StrObjFunc);
477 HOOKPROTONH(ObjStrFunc, VOID, Object *pop, Object *str)
479 LONG i = -1;
480 get(pop,MUIA_List_Active,&i);
481 if (i >= 0)
483 set(str,MUIA_UserData,i);
484 set(str,MUIA_Text_Contents,functions_names[i]);
486 else
487 { i = -1;
488 set(str,MUIA_UserData,i);
489 set(str,MUIA_Text_Contents,"");
492 MakeStaticHook(ObjStrHook, ObjStrFunc);
495 HOOKPROTONH(WindowFunc, VOID, Object *pop, Object *win)
497 set(win,MUIA_Window_DefaultObject,pop);
499 MakeStaticHook(WindowHook, WindowFunc);
502 HOOKPROTONH(TxtFctFunc, VOID, Object *list, long *val)
504 Object *txtfct = (Object *) val[0];
505 struct KeyBinding *key = NULL;
506 LONG i = -1;
508 get(txtfct,MUIA_UserData,&i);
509 DoMethod(list,MUIM_NList_GetEntry,MUIV_NList_GetEntry_Active, &key);
510 if(key && (i >= 0))
512 key->kb_KeyTag = keytags[i];
513 DoMethod(list,MUIM_NList_Redraw,MUIV_NList_Redraw_Active);
514 get(list,MUIA_NList_Active,&i);
515 set(list,MUIA_NList_Active,i);
518 MakeStaticHook(TxtFctHook, TxtFctFunc);
520 HOOKPROTONH(AckFunc, VOID, Object *list, long *val)
522 Object *stringkey = (Object *) val[0];
523 struct KeyBinding *key = NULL;
524 char *ackstr = NULL;
526 get(stringkey,MUIA_String_Contents, &ackstr);
527 DoMethod(list,MUIM_NList_GetEntry,MUIV_NList_GetEntry_Active, &key);
528 if (ackstr && key)
530 IX ix;
532 ix.ix_Version = IX_VERSION;
533 ParseIX(ackstr,&ix);
534 key->kb_Qualifier = (ix.ix_Qualifier & KBQUAL_MASK) | ((ix.ix_QualSame << 12) & KBSYM_MASK);
535 key->kb_Code = ix.ix_Code;
536 DoMethod(list,MUIM_NList_Redraw,MUIV_NList_Redraw_Active);
539 MakeStaticHook(AckHook, AckFunc);
541 HOOKPROTONH(ActiveFunc, VOID, Object *list, long *val)
543 struct NListviews_MCP_Data *data = (struct NListviews_MCP_Data *) (val[0]);
544 /* Object *win = NULL;*/
545 ULONG active = (ULONG) (val[1]);
546 struct KeyBinding *key = NULL;
548 if((LONG)active >= 0)
550 DoMethod(list,MUIM_NList_GetEntry,MUIV_NList_GetEntry_Active, &key);
552 if (key)
554 LONG i = 0;
556 while ((keytags[i] > 0) && (keytags[i] != key->kb_KeyTag))
557 i++;
558 if (keytags[i] == key->kb_KeyTag)
560 nnset(data->mcp_stringkey,MUIA_HotkeyString_Snoop, FALSE);
561 nnset(data->mcp_stringkey,MUIA_Disabled, FALSE);
562 nnset(data->mcp_snoopkey,MUIA_Disabled, FALSE);
563 nnset(data->mcp_txtfct,MUIA_UserData,i);
564 nnset(data->mcp_txtfct,MUIA_Text_Contents,functions_names[i]);
566 DeadKeyConvert(data,key);
567 nnset(data->mcp_stringkey,MUIA_String_Contents, data->rawtext);
569 get(list, MUIA_WindowObject, &win);
570 if (win)
571 set(win, MUIA_Window_ActiveObject, data->mcp_stringkey);
574 else
575 key = NULL;
578 if (!key)
580 nnset(data->mcp_txtfct,MUIA_UserData,-1);
581 nnset(data->mcp_txtfct,MUIA_Text_Contents,"");
582 nnset(data->mcp_stringkey,MUIA_String_Contents, "");
583 nnset(data->mcp_stringkey,MUIA_Disabled, TRUE);
584 nnset(data->mcp_snoopkey,MUIA_Disabled, TRUE);
587 MakeStaticHook(ActiveHook, ActiveFunc);
590 HOOKPROTONHNP(DefaultFunc, VOID, Object *list)
592 if (list)
593 NL_LoadKeys(list,default_keys);
595 MakeStaticHook(DefaultHook, DefaultFunc);
597 HOOKPROTONHNP(UpdateFunc, VOID, Object *list)
599 if (list)
600 NL_UpdateKeys(list,default_keys);
602 MakeStaticHook(UpdateHook, UpdateFunc);
604 HOOKPROTONHNP(InsertFunc, VOID, Object *list)
606 if (list)
608 struct KeyBinding *key;
609 LONG pos = 0;
611 DoMethod(list,MUIM_NList_GetEntry,MUIV_NList_GetEntry_Active, &key);
612 if (!key)
614 empty_key.kb_KeyTag = keytags[0];
615 key = &empty_key;
617 set(list,MUIA_NList_Quiet,TRUE);
618 DoMethod(list,MUIM_NList_InsertSingle,key, MUIV_NList_Insert_Active);
619 get(list,MUIA_NList_InsertPosition,&pos);
620 set(list,MUIA_NList_Active,pos);
621 set(list,MUIA_NList_Quiet,FALSE);
624 MakeStaticHook(InsertHook, InsertFunc);
626 HOOKPROTONH(DisplayFunc, VOID, Object *obj, struct NList_DisplayMessage *ndm)
628 struct KeyBinding *key = (struct KeyBinding *) ndm->entry;
629 struct NListviews_MCP_Data *data = NULL;
631 get(obj,MUIA_UserData,&data);
633 if (key && data)
635 LONG i;
637 ndm->preparses[0] = (STRPTR)"\033r";
639 DeadKeyConvert(data,key);
640 ndm->strings[0] = data->rawtext;
642 ndm->strings[1] = (STRPTR)"\033c=";
644 i = 0;
645 while ((keytags[i] > 0) && (keytags[i] != key->kb_KeyTag))
646 i++;
647 ndm->strings[2] = (STRPTR)functions_names[i];
649 else
651 ndm->preparses[0] = (STRPTR)"\033r";
652 ndm->strings[0] = (STRPTR)tr(MSG_HOTKEYS_KEY);
653 ndm->strings[1] = (STRPTR)"";
654 ndm->strings[2] = (STRPTR)tr(MSG_HOTKEYS_ACTION);
657 MakeStaticHook(DisplayHook, DisplayFunc);
659 HOOKPROTONHNO(ConstructFunc, APTR, struct NList_ConstructMessage *ncm)
661 struct KeyBinding *key = (struct KeyBinding *) ncm->entry;
662 struct KeyBinding *key2 = (struct KeyBinding *) AllocVecShared(sizeof(struct KeyBinding),0L);
663 if (key2)
665 *key2 = *key;
667 return ((APTR) key2);
669 MakeStaticHook(ConstructHook, ConstructFunc);
671 HOOKPROTONHNO(DestructFunc, VOID, struct NList_DestructMessage *ndm)
673 struct KeyBinding *key = (struct KeyBinding *) ndm->entry;
675 FreeVec((void *) key);
677 MakeStaticHook(DestructHook, DestructFunc);
679 static IPTR mNL_MCP_New(struct IClass *cl,Object *obj,struct opSet *msg)
681 struct NListviews_MCP_Data *data;
682 APTR group1, group2, group3, group4, group5;
683 char *exampleText;
684 BOOL mui39;
685 BOOL safeNotifies;
687 static const char infotext1[] = "\033bNListviews.mcp " LIB_REV_STRING "\033n (" LIB_DATE ")\n"
688 "Copyright (C) 1996-2001 Gilles Masson\n"
689 LIB_COPYRIGHT;
690 static const char infotext2[] = "\n"
691 "Distributed under the terms of the LGPL2.\n"
692 "\n"
693 "For the latest version, check out:\n"
694 "http://www.sf.net/projects/nlist-classes/\n"
695 "\n";
697 if(!(obj = (Object *)DoSuperMethodA(cl, obj,(Msg) msg)))
698 return(0);
700 data = INST_DATA(cl,obj);
702 group1 = group2 = group3 = group4 = group5 = NULL;
704 data->mcp_group = NULL;
705 data->mcp_list1 = NULL;
706 data->mcp_list2 = NULL;
707 data->mcp_PenTitle = NULL;
708 data->mcp_PenList = NULL;
709 data->mcp_PenSelect = NULL;
710 data->mcp_PenCursor = NULL;
711 data->mcp_PenUnselCur = NULL;
712 data->mcp_PenInactive = NULL;
713 data->mcp_BG_Title = NULL;
714 data->mcp_BG_List = NULL;
715 data->mcp_BG_Select = NULL;
716 data->mcp_BG_Cursor = NULL;
717 data->mcp_BG_UnselCur = NULL;
718 data->mcp_BG_Inactive = NULL;
719 data->mcp_R_Multi = NULL;
720 data->mcp_B_MultiMMB = NULL;
721 data->mcp_R_Drag = NULL;
722 data->mcp_SL_VertInc = NULL;
723 data->mcp_R_HSB = NULL;
724 data->mcp_R_VSB = NULL;
725 data->mcp_B_Smooth = NULL;
726 data->mcp_Font = NULL;
727 data->mcp_Font_Little = NULL;
728 data->mcp_Font_Fixed = NULL;
729 data->mcp_ForcePen = NULL;
730 data->mcp_ColWidthDrag = NULL;
731 data->mcp_PartialCol = NULL;
732 data->mcp_List_Select = NULL;
733 data->mcp_NList_Menu = NULL;
734 data->mcp_PartialChar = NULL;
735 data->mcp_SerMouseFix = NULL;
736 data->mcp_DragLines = NULL;
737 data->mcp_WheelStep = NULL;
738 data->mcp_WheelFast = NULL;
739 data->mcp_WheelMMB = NULL;
740 data->mcp_listkeys = NULL;
741 data->mcp_stringkey = NULL;
742 data->mcp_snoopkey = NULL;
743 data->mcp_insertkey = NULL;
744 data->mcp_removekey = NULL;
745 data->mcp_defaultkeys = NULL;
746 data->mcp_updatekeys = NULL;
747 data->mcp_txtfct = NULL;
748 data->mcp_popstrfct = NULL;
749 data->mcp_poplistfct = NULL;
750 data->nlkeys = NULL;
752 data->mcp_stringkey = HotkeyStringObject,
753 StringFrame, MUIA_CycleChain, 1,
754 MUIA_HotkeyString_Snoop, FALSE,
755 MUIA_Disabled,TRUE,
756 End;
758 if(data->mcp_stringkey == NULL)
760 data->mcp_stringkey = StringObject,
761 StringFrame, MUIA_CycleChain, 1,
762 End;
765 // create a duplicate of the translated text
766 if((exampleText = AllocVecShared((strlen(tr(MSG_EXAMPLE_TEXT))+1)*sizeof(char), MEMF_ANY)) != NULL)
768 char *p;
769 LONG numLines = 0;
771 // copy the text
772 strcpy(exampleText, tr(MSG_EXAMPLE_TEXT));
774 // count the number of lines
775 p = exampleText;
776 while((p = strchr(p, '\n')) != NULL)
778 numLines++;
779 p++;
782 // finally split the text into separate lines
783 if((data->exampleText = AllocVecShared((numLines+2)*sizeof(char *), MEMF_ANY|MEMF_CLEAR)) != NULL)
785 LONG line;
787 p = exampleText;
788 for(line = 0; line < numLines; line++)
790 char *q;
792 q = strchr(p, '\n');
793 *q++ = '\0';
794 data->exampleText[line] = AllocVecShared((strlen(p)+1)*sizeof(char), MEMF_ANY);
795 strcpy(data->exampleText[line], p);
796 p = q;
800 FreeVec(exampleText);
803 mui39 = LIB_VERSION_IS_AT_LEAST(MUIMasterBase, 20, 0);
805 group1 = GroupObject,
807 Child, VGroup,
808 GroupFrameT(tr(MSG_GROUP_EXAMPLE)),
810 Child, data->mcp_list1 = NListviewObject,
811 MUIA_CycleChain, 1,
812 MUIA_NList_Title,"\033cNList / NListview",
813 MUIA_NList_TitleSeparator, TRUE,
814 MUIA_NListview_Vert_ScrollBar, MUIV_NListview_VSB_Default,
815 MUIA_NListview_Horiz_ScrollBar, MUIV_NListview_HSB_Default,
816 MUIA_NList_DefaultObjectOnClick, TRUE,
817 MUIA_NList_SourceArray, data->exampleText/*MainTextArray*/,
818 End,
819 End,
821 Child, GroupObject,
822 GroupFrameT(tr(MSG_FONTS)),
823 GroupSpacing(2),
824 MUIA_Group_Columns, 2,
826 MUIA_Weight,(ULONG)30,
827 Child, Label(tr(MSG_NORMAL_FONT)),
828 Child, data->mcp_Font = PopaslObject,
829 MUIA_Popstring_String, String2(0,80),
830 MUIA_Popstring_Button, PopButton(mui39 == TRUE ? MUII_PopFont : MUII_PopUp),
831 MUIA_Popasl_Type, ASL_FontRequest,
832 MUIA_ShortHelp, tr(MSG_NORMAL_FONT_HELP),
833 ASLFO_TitleText, tr(MSG_NORMAL_FONT_ASL),
834 End,
836 Child, Label(tr(MSG_SMALL_FONT)),
837 Child, data->mcp_Font_Little = PopaslObject,
838 MUIA_Popstring_String, String2(0,80),
839 MUIA_Popstring_Button, PopButton(mui39 == TRUE ? MUII_PopFont : MUII_PopUp),
840 MUIA_Popasl_Type, ASL_FontRequest,
841 MUIA_ShortHelp, tr(MSG_SMALL_FONT_HELP),
842 ASLFO_TitleText, tr(MSG_SMALL_FONT_ASL),
843 End,
845 Child, Label(tr(MSG_FIXED_FONT)),
846 Child, data->mcp_Font_Fixed = PopaslObject,
847 MUIA_Popstring_String, String2(0,80),
848 MUIA_Popstring_Button, PopButton(mui39 == TRUE ? MUII_PopFont : MUII_PopUp),
849 MUIA_Popasl_Type, ASL_FontRequest,
850 MUIA_ShortHelp, tr(MSG_FIXED_FONT_HELP),
851 ASLFO_TitleText, tr(MSG_FIXED_FONT_ASL),
852 ASLFO_FixedWidthOnly, TRUE,
853 End,
855 Child, Label(tr(MSG_FONT_MARGIN)),
856 Child, data->mcp_SL_VertInc = SliderObject,
857 MUIA_CycleChain, 1,
858 MUIA_Numeric_Min, 0,
859 MUIA_Numeric_Max, 9,
860 MUIA_Numeric_Value, 1,
861 MUIA_ShortHelp, tr(MSG_FONT_MARGIN_HELP),
862 End,
864 End,
865 End;
867 group2 = VGroup,
868 Child, VGroup,
869 GroupFrameT(tr(MSG_COLORS)),
870 GroupSpacing(2),
871 MUIA_VertWeight, 85,
872 MUIA_Group_Columns, 3,
874 Child, RectangleObject,
875 MUIA_VertWeight, 0,
876 MUIA_Rectangle_HBar, TRUE,
877 MUIA_Rectangle_BarTitle, tr(MSG_TEXTCOLOR),
878 End,
879 Child, HSpace(0),
880 Child, RectangleObject,
881 MUIA_VertWeight, 0,
882 MUIA_Rectangle_HBar, TRUE,
883 MUIA_Rectangle_BarTitle, tr(MSG_BACKGROUNDCOLOR),
884 End,
886 Child, data->mcp_PenTitle = PoppenObject,
887 MUIA_CycleChain, 1,
888 MUIA_Window_Title, tr(MSG_TITLE_PEN_WIN),
889 MUIA_Draggable, TRUE,
890 MUIA_ShortHelp, tr(MSG_TITLE_PEN_HELP),
891 End,
892 Child, VCenter(Label(tr(MSG_PBG_TITLE))),
893 Child, data->mcp_BG_Title = PopimageObject,
894 MUIA_CycleChain, 1,
895 MUIA_Imageadjust_Type, MUIV_Imageadjust_Type_Background,
896 MUIA_Window_Title, tr(MSG_TITLE_BG_WIN),
897 MUIA_Draggable, TRUE,
898 MUIA_ShortHelp, tr(MSG_TITLE_BG_HELP),
899 End,
901 Child, data->mcp_PenList = PoppenObject,
902 MUIA_CycleChain, 1,
903 MUIA_Window_Title, tr(MSG_LIST_PEN_WIN),
904 MUIA_Draggable, TRUE,
905 MUIA_ShortHelp, tr(MSG_LIST_PEN_HELP),
906 End,
907 Child, VCenter(Label(tr(MSG_PBG_LIST))),
908 Child, data->mcp_BG_List = PopimageObject,
909 MUIA_CycleChain, 1,
910 MUIA_Imageadjust_Type, MUIV_Imageadjust_Type_Background,
911 MUIA_Window_Title, tr(MSG_LIST_BG_WIN),
912 MUIA_Draggable, TRUE,
913 MUIA_ShortHelp, tr(MSG_LIST_BG_HELP),
914 End,
916 Child, data->mcp_PenSelect = PoppenObject,
917 MUIA_CycleChain, 1,
918 MUIA_Window_Title, tr(MSG_SELECT_PEN_WIN),
919 MUIA_Draggable, TRUE,
920 MUIA_ShortHelp, tr(MSG_SELECT_PEN_HELP),
921 End,
922 Child, VCenter(Label(tr(MSG_PBG_SELECT))),
923 Child, data->mcp_BG_Select = PopimageObject,
924 MUIA_CycleChain, 1,
925 MUIA_Imageadjust_Type, MUIV_Imageadjust_Type_Background,
926 MUIA_Window_Title, tr(MSG_SELECT_BG_WIN),
927 MUIA_Draggable, TRUE,
928 MUIA_ShortHelp, tr(MSG_SELECT_BG_HELP),
929 End,
931 Child, data->mcp_PenCursor = PoppenObject,
932 MUIA_CycleChain, 1,
933 MUIA_Window_Title, tr(MSG_CURSOR_PEN_WIN),
934 MUIA_Draggable, TRUE,
935 MUIA_ShortHelp, tr(MSG_CURSOR_PEN_HELP),
936 End,
937 Child, VCenter(Label(tr(MSG_PBG_CURSOR))),
938 Child, data->mcp_BG_Cursor = PopimageObject,
939 MUIA_CycleChain, 1,
940 MUIA_Imageadjust_Type, MUIV_Imageadjust_Type_Background,
941 MUIA_Window_Title, tr(MSG_CURSOR_BG_WIN),
942 MUIA_Draggable, TRUE,
943 MUIA_ShortHelp, tr(MSG_CURSOR_BG_HELP),
944 End,
946 Child, data->mcp_PenUnselCur = PoppenObject,
947 MUIA_CycleChain, 1,
948 MUIA_Window_Title, tr(MSG_UNSEL_PEN_WIN),
949 MUIA_Draggable, TRUE,
950 MUIA_ShortHelp, tr(MSG_UNSEL_PEN_HELP),
951 End,
952 Child, VCenter(Label(tr(MSG_PBG_UNSEL))),
953 Child, data->mcp_BG_UnselCur = PopimageObject,
954 MUIA_CycleChain, 1,
955 MUIA_Imageadjust_Type, MUIV_Imageadjust_Type_Background,
956 MUIA_Window_Title, tr(MSG_UNSEL_BG_WIN),
957 MUIA_Draggable, TRUE,
958 MUIA_ShortHelp, tr(MSG_UNSEL_BG_HELP),
959 End,
961 Child, data->mcp_PenInactive = PoppenObject,
962 MUIA_CycleChain, 1,
963 MUIA_Window_Title, tr(MSG_INACT_PEN_WIN),
964 MUIA_Draggable, TRUE,
965 MUIA_ShortHelp, tr(MSG_INACT_PEN_HELP),
966 End,
967 Child, VCenter(Label(tr(MSG_PBG_INACT))),
968 Child, data->mcp_BG_Inactive = PopimageObject,
969 MUIA_CycleChain, 1,
970 MUIA_Imageadjust_Type, MUIV_Imageadjust_Type_Background,
971 MUIA_Window_Title, tr(MSG_INACT_BG_WIN),
972 MUIA_Draggable, TRUE,
973 MUIA_ShortHelp, tr(MSG_INACT_BG_HELP),
974 End,
976 End,
978 Child, VGroup,
979 GroupFrameT(tr(MSG_COLOR_OPTIONS)),
980 MUIA_VertWeight, 15,
982 Child, VSpace(0),
983 Child, HGroup,
984 Child, HSpace(0),
985 Child, data->mcp_ForcePen = ImageObject,
986 ImageButtonFrame,
987 MUIA_InputMode, MUIV_InputMode_Toggle,
988 MUIA_Image_Spec, MUII_CheckMark,
989 MUIA_Image_FreeVert, TRUE,
990 MUIA_Background, MUII_ButtonBack,
991 MUIA_ShowSelState, FALSE,
992 End,
993 Child, Label(tr(MSG_FORCE_SELECT_PEN)),
994 MUIA_ShortHelp, tr(MSG_FORCE_SELECT_PEN_HELP),
995 Child, HSpace(0),
996 End,
997 Child, VSpace(0),
998 End,
999 End;
1001 RS_VSB[0] = tr(MSG_VSB_ALWAYS);
1002 RS_VSB[1] = tr(MSG_VSB_AUTO);
1003 RS_VSB[2] = tr(MSG_VSB_FULLAUTO);
1004 RS_VSB[3] = NULL;
1006 RS_HSB[0] = tr(MSG_HSB_ALWAYS);
1007 RS_HSB[1] = tr(MSG_HSB_AUTO);
1008 RS_HSB[2] = tr(MSG_HSB_FULLAUTO);
1009 RS_HSB[3] = tr(MSG_HSB_NONE);
1010 RS_HSB[4] = NULL;
1012 #if defined(__amigaos3__) || defined(__amigaos4__)
1013 if(LIB_VERSION_IS_AT_LEAST(MUIMasterBase, 20, 5824))
1015 // MUI4 for AmigaOS is safe for V20.5824+
1016 safeNotifies = TRUE;
1018 else if(LIB_VERSION_IS_AT_LEAST(MUIMasterBase, 20, 2346) && LIBREV(MUIMasterBase) < 5000)
1020 // MUI3.9 for AmigaOS is safe for V20.2346+
1021 safeNotifies = TRUE;
1023 else
1025 // MUI 3.8 and older version of MUI 3.9 or MUI4 are definitely unsafe
1026 safeNotifies = FALSE;
1028 #else
1029 // MorphOS and AROS must be considered unsafe unless someone from the
1030 // MorphOS/AROS team confirms that removing notifies in nested OM_SET
1031 // calls is safe.
1032 safeNotifies = FALSE;
1033 #endif
1035 group3 = VGroup,
1037 Child, HGroup,
1038 Child, HGroup,
1039 GroupFrameT(tr(MSG_SB_HORIZONTAL)),
1040 Child, HSpace(0),
1041 Child, VGroup,
1042 Child, VSpace(0),
1043 Child, data->mcp_R_HSB = RadioObject,
1044 MUIA_Radio_Entries, RS_HSB,
1045 MUIA_Disabled, !safeNotifies,
1046 End,
1047 MUIA_ShortHelp, tr(MSG_SB_HORIZONTAL_HELP),
1048 Child, VSpace(0),
1049 End,
1050 Child, HSpace(0),
1051 End,
1053 Child, HGroup,
1054 GroupFrameT(tr(MSG_SB_VERTICAL)),
1055 Child, HSpace(0),
1056 Child, VGroup,
1057 Child, VSpace(0),
1058 Child, data->mcp_R_VSB = RadioObject,
1059 MUIA_Radio_Entries,RS_VSB,
1060 MUIA_Disabled, !safeNotifies,
1061 End,
1062 MUIA_ShortHelp, tr(MSG_SB_VERTICAL_HELP),
1063 Child, VSpace(0),
1064 End,
1065 Child, HSpace(0),
1066 End,
1067 Child, VSpace(0),
1068 End,
1070 Child, VGroup,
1071 GroupFrameT(tr(MSG_SCROLLCONTROL)),
1072 Child, VSpace(0),
1074 Child, ColGroup(2),
1075 Child, HSpace(0),
1076 Child, HGroup,
1077 Child, data->mcp_B_Smooth = ImageObject,
1078 ImageButtonFrame,
1079 MUIA_InputMode, MUIV_InputMode_Toggle,
1080 MUIA_Image_Spec, MUII_CheckMark,
1081 MUIA_Image_FreeVert, TRUE,
1082 MUIA_Background, MUII_ButtonBack,
1083 MUIA_ShowSelState, FALSE,
1084 End,
1085 Child, Label(tr(MSG_SMOOTH_SCROLLING)),
1086 MUIA_ShortHelp, tr(MSG_SMOOTH_SCROLLING_HELP),
1087 Child, HSpace(0),
1088 End,
1090 Child, HSpace(0),
1091 Child, HGroup,
1092 Child, data->mcp_WheelMMB = ImageObject,
1093 ImageButtonFrame,
1094 MUIA_InputMode, MUIV_InputMode_Toggle,
1095 MUIA_Image_Spec, MUII_CheckMark,
1096 MUIA_Image_FreeVert, TRUE,
1097 MUIA_Background, MUII_ButtonBack,
1098 MUIA_ShowSelState, FALSE,
1099 End,
1100 Child, Label(tr(MSG_MMB_FASTWHEEL)),
1101 MUIA_ShortHelp, tr(MSG_MMB_FASTWHEEL_HELP),
1102 Child, HSpace(0),
1103 End,
1105 Child, Label(tr(MSG_WHEEL_STEP)),
1106 Child, data->mcp_WheelStep = SliderObject,
1107 MUIA_CycleChain, 1,
1108 MUIA_Numeric_Min, 1,
1109 MUIA_Numeric_Max, 10,
1110 MUIA_Numeric_Value, DEFAULT_WHEELSTEP,
1111 MUIA_ShortHelp, tr(MSG_WHEEL_STEP_HELP),
1112 End,
1114 Child, Label(tr(MSG_WHEEL_FAST)),
1115 Child, data->mcp_WheelFast = SliderObject,
1116 MUIA_CycleChain, 1,
1117 MUIA_Numeric_Min, 1,
1118 MUIA_Numeric_Max, 10,
1119 MUIA_Numeric_Value, DEFAULT_WHEELFAST,
1120 MUIA_ShortHelp, tr(MSG_WHEEL_FAST_HELP),
1121 End,
1122 End,
1124 Child, VSpace(0),
1125 End,
1128 End;
1131 RS_MultiSelects[0] = tr(MSG_MULTISELECT_QUAL);
1132 RS_MultiSelects[1] = tr(MSG_MULTISELECT_ALWAYS);
1133 RS_MultiSelects[2] = NULL;
1135 RS_DragTypes[0] = tr(MSG_DRAGTYPE_IMMEDIATE);
1136 RS_DragTypes[1] = tr(MSG_DRAGTYPE_BORDERS);
1137 RS_DragTypes[2] = tr(MSG_DRAGTYPE_QUALIFIER);
1138 RS_DragTypes[3] = NULL;
1140 RS_ColWidthDrag[0] = tr(MSG_COLWIDTHDRAG_TITLE);
1141 RS_ColWidthDrag[1] = tr(MSG_COLWIDTHDRAG_FULLBAR);
1142 RS_ColWidthDrag[2] = tr(MSG_COLWIDTHDRAG_VISIBLE);
1143 RS_ColWidthDrag[3] = NULL;
1145 RS_Menu[0] = tr(MSG_CMENU_ALWAYS);
1146 RS_Menu[1] = tr(MSG_CMENU_TOPONLY);
1147 RS_Menu[2] = tr(MSG_CMENU_NEVER);
1148 RS_Menu[3] = NULL;
1150 group4 = VGroup,
1152 Child, HGroup,
1153 Child, VGroup,
1154 Child, HGroup,
1155 GroupFrameT(tr(MSG_MULTISELECT)),
1157 Child, HSpace(0),
1158 Child, VGroup,
1159 Child, VSpace(0),
1161 Child, HGroup,
1162 Child, data->mcp_R_Multi = RadioObject,
1163 MUIA_Radio_Entries, RS_MultiSelects,
1164 MUIA_ShortHelp, tr(MSG_MULTISELECT_HELP),
1165 End,
1166 Child, HSpace(0),
1167 End,
1169 Child, RectangleObject,
1170 MUIA_VertWeight, 0,
1171 MUIA_Rectangle_HBar, TRUE,
1172 End,
1174 Child, HGroup,
1175 Child, data->mcp_List_Select = ImageObject,
1176 ImageButtonFrame,
1177 MUIA_InputMode, MUIV_InputMode_Toggle,
1178 MUIA_Image_Spec, MUII_CheckMark,
1179 MUIA_Image_FreeVert, TRUE,
1180 MUIA_Background, MUII_ButtonBack,
1181 MUIA_ShowSelState, FALSE,
1182 MUIA_Selected, TRUE,
1183 End,
1184 Child, Label(tr(MSG_MULTISEL_MOVEACTIVE)),
1185 MUIA_ShortHelp, tr(MSG_MULTISEL_MOVEACTIVE_HELP),
1186 Child, HSpace(0),
1187 End,
1189 Child, HGroup,
1190 Child, data->mcp_B_MultiMMB = ImageObject,
1191 ImageButtonFrame,
1192 MUIA_InputMode, MUIV_InputMode_Toggle,
1193 MUIA_Image_Spec, MUII_CheckMark,
1194 MUIA_Background, MUII_ButtonBack,
1195 MUIA_ShowSelState, FALSE,
1196 MUIA_Image_FreeVert,TRUE,
1197 End,
1198 Child, Label(tr(MSG_MMB_MULTISEL)),
1199 MUIA_ShortHelp, tr(MSG_MMB_MULTISEL_HELP),
1200 Child, HSpace(0),
1201 End,
1203 Child, VSpace(0),
1204 End,
1205 Child, HSpace(0),
1206 End,
1208 Child, HGroup,
1209 GroupFrameT(tr(MSG_LAYOUT)),
1210 Child, HSpace(0),
1211 Child, VGroup,
1212 Child, VSpace(0),
1213 Child, HGroup,
1214 Child, data->mcp_PartialCol = ImageObject,
1215 ImageButtonFrame,
1216 MUIA_InputMode, MUIV_InputMode_Toggle,
1217 MUIA_Image_Spec, MUII_CheckMark,
1218 MUIA_Image_FreeVert, TRUE,
1219 MUIA_Background, MUII_ButtonBack,
1220 MUIA_ShowSelState, FALSE,
1221 MUIA_Selected, TRUE,
1222 End,
1223 Child, Label(tr(MSG_PARTIAL_COL_MARK)),
1224 MUIA_ShortHelp, tr(MSG_PARTIAL_COL_MARK_HELP),
1225 Child, HSpace(0),
1226 End,
1228 Child, HGroup,
1229 Child, data->mcp_PartialChar = ImageObject,
1230 ImageButtonFrame,
1231 MUIA_InputMode, MUIV_InputMode_Toggle,
1232 MUIA_Image_Spec, MUII_CheckMark,
1233 MUIA_Image_FreeVert, TRUE,
1234 MUIA_Background, MUII_ButtonBack,
1235 MUIA_ShowSelState, FALSE,
1236 MUIA_Selected, FALSE,
1237 End,
1238 Child, Label(tr(MSG_PARTIAL_CHARS_DRAWN)),
1239 MUIA_ShortHelp, tr(MSG_PARTIAL_CHARS_DRAWN_HELP),
1240 Child, HSpace(0),
1241 End,
1243 Child, HGroup,
1244 Child, data->mcp_VerticalCenteredLines = ImageObject,
1245 ImageButtonFrame,
1246 MUIA_InputMode, MUIV_InputMode_Toggle,
1247 MUIA_Image_Spec, MUII_CheckMark,
1248 MUIA_Image_FreeVert, TRUE,
1249 MUIA_Background, MUII_ButtonBack,
1250 MUIA_ShowSelState, FALSE,
1251 MUIA_Selected, FALSE,
1252 End,
1253 Child, Label(tr(MSG_VERT_CENTERED)),
1254 MUIA_ShortHelp, tr(MSG_VERT_CENTERED_HELP),
1255 Child, HSpace(0),
1256 End,
1258 Child, VSpace(0),
1259 End,
1260 Child, HSpace(0),
1261 End,
1263 End,
1265 Child, VGroup,
1267 Child, HGroup,
1268 GroupFrameT(tr(MSG_DRAGDROP)),
1270 Child, VGroup,
1271 Child, VSpace(0),
1273 Child, HGroup,
1274 Child, HSpace(0),
1275 Child, data->mcp_R_Drag = RadioObject,
1276 MUIA_Radio_Entries, RS_DragTypes,
1277 MUIA_ShortHelp, tr(MSG_DRAGTYPE_HELP),
1278 End,
1279 Child, HSpace(0),
1280 End,
1282 Child, RectangleObject,
1283 MUIA_VertWeight, 0,
1284 MUIA_Rectangle_HBar, TRUE,
1285 End,
1287 Child, ColGroup(2),
1289 Child, Label(tr(MSG_DRAG_LINES)),
1290 Child, data->mcp_DragLines = SliderObject,
1291 MUIA_ShortHelp, tr(MSG_DRAG_LINES_HELP),
1292 MUIA_CycleChain, 1,
1293 MUIA_Numeric_Min, 0,
1294 MUIA_Numeric_Max, 20,
1295 MUIA_Numeric_Value, DEFAULT_DRAGLINES,
1296 End,
1298 Child, HSpace(0),
1299 Child, HGroup,
1300 Child, data->mcp_SerMouseFix = ImageObject,
1301 ImageButtonFrame,
1302 MUIA_InputMode, MUIV_InputMode_Toggle,
1303 MUIA_Image_Spec, MUII_CheckMark,
1304 MUIA_Image_FreeVert, TRUE,
1305 MUIA_Background, MUII_ButtonBack,
1306 MUIA_ShowSelState, FALSE,
1307 End,
1308 Child, Label(tr(MSG_SERMOUSE_FIX)),
1309 MUIA_ShortHelp, tr(MSG_SERMOUSE_FIX_HELP),
1310 Child, HSpace(0),
1311 End,
1312 End,
1314 Child, VSpace(0),
1315 End,
1317 End,
1319 Child, HGroup,
1320 GroupFrameT(tr(MSG_BALANCING_COLS)),
1321 Child, HSpace(0),
1322 Child, VGroup,
1323 Child, VSpace(0),
1324 Child, data->mcp_ColWidthDrag = RadioObject,
1325 MUIA_Radio_Entries, RS_ColWidthDrag,
1326 End,
1327 MUIA_ShortHelp, tr(MSG_BALANCING_COLS_HELP),
1328 Child, VSpace(0),
1329 End,
1330 Child, HSpace(0),
1331 End,
1333 End,
1334 End,
1336 Child, VGroup,
1337 GroupFrameT(tr(MSG_GROUP_MISC)),
1338 MUIA_VertWeight, 10,
1340 Child, VSpace(0),
1342 Child, HGroup,
1343 Child, HSpace(0),
1345 Child, VGroup,
1346 Child, HGroup,
1347 Child, data->mcp_SelectPointer = ImageObject,
1348 ImageButtonFrame,
1349 MUIA_InputMode, MUIV_InputMode_Toggle,
1350 MUIA_Image_Spec, MUII_CheckMark,
1351 MUIA_Image_FreeVert, TRUE,
1352 MUIA_Background, MUII_ButtonBack,
1353 MUIA_ShowSelState, FALSE,
1354 End,
1355 Child, Label(tr(MSG_SELECT_POINTER)),
1356 MUIA_ShortHelp, tr(MSG_SELECT_POINTER_HELP),
1357 Child, HSpace(0),
1358 End,
1360 End,
1362 Child, HSpace(0),
1364 Child, HGroup,
1365 Child, VGroup,
1366 Child, VSpace(0),
1367 Child, RectangleObject,
1368 MUIA_VertWeight, 0,
1369 MUIA_Rectangle_HBar, TRUE,
1370 MUIA_Rectangle_BarTitle, tr(MSG_BAR_CONTEXTMENU),
1371 End,
1372 Child, data->mcp_NList_Menu = RadioObject,
1373 MUIA_Radio_Entries,RS_Menu,
1374 MUIA_ShortHelp, tr(MSG_DEFAULT_CONTEXT_MENU_HELP),
1375 End,
1376 Child, VSpace(0),
1377 End,
1378 End,
1380 Child, HSpace(0),
1381 End,
1383 Child, VSpace(0),
1384 End,
1386 End;
1388 functions_names[0] = tr(MSG_FUNC_MULTISELQUAL);
1389 functions_names[1] = tr(MSG_FUNC_DRAGQUAL);
1390 functions_names[2] = tr(MSG_FUNC_BALANCEQUAL);
1391 functions_names[3] = tr(MSG_FUNC_COPYCLIP);
1392 functions_names[4] = tr(MSG_FUNC_DEFCOLWIDTH);
1393 functions_names[5] = tr(MSG_FUNC_DEFALLCOLWIDTH);
1394 functions_names[6] = tr(MSG_FUNC_DEFORDERCOL);
1395 functions_names[7] = tr(MSG_FUNC_DEFALLORDERCOL);
1396 functions_names[8] = tr(MSG_FUNC_SELECTTOP);
1397 functions_names[9] = tr(MSG_FUNC_SELECTBOTTOM);
1398 functions_names[10]= tr(MSG_FUNC_SELECTPAGEUP);
1399 functions_names[11]= tr(MSG_FUNC_SELECTPAGEDOWN);
1400 functions_names[12]= tr(MSG_FUNC_SELECTUP);
1401 functions_names[13]= tr(MSG_FUNC_SELECTDOWN);
1402 functions_names[14]= tr(MSG_FUNC_TOGGLEACTIVE);
1403 functions_names[15]= tr(MSG_FUNC_FASTWHEELQUAL);
1404 functions_names[16]= tr(MSG_FUNC_HORIZWHEELQUAL);
1405 functions_names[17]= tr(MSG_FUNC_TITLECLICKQUAL);
1406 functions_names[18]= "";
1407 functions_names[19]= NULL;
1409 group5 = GroupObject,
1410 Child, NListviewObject,
1411 MUIA_CycleChain, 1,
1412 MUIA_NListview_Vert_ScrollBar, MUIV_NListview_VSB_Always,
1413 MUIA_NListview_Horiz_ScrollBar, MUIV_NListview_HSB_None,
1414 MUIA_NListview_NList, data->mcp_listkeys = NListObject,
1415 MUIA_NList_Title,TRUE,
1416 MUIA_NList_DragSortable, TRUE,
1417 MUIA_NList_Format, "W=100 NOBAR,NOBAR,W=100 NOBAR",
1418 MUIA_NList_DisplayHook2, &DisplayHook,
1419 MUIA_NList_ConstructHook2, &ConstructHook,
1420 MUIA_NList_DestructHook2, &DestructHook,
1421 MUIA_NList_MinColSortable, 10,
1422 End,
1423 End,
1425 Child, GroupObject,MUIA_Group_Horiz,TRUE,
1427 Child, GroupObject,MUIA_Group_Horiz,TRUE,
1428 Child, data->mcp_stringkey,
1429 Child, data->mcp_snoopkey = ToggleButtonCycle(tr(MSG_SNOOP), FALSE, TRUE, tr(MSG_SNOOP_KEY)),
1430 End,
1432 Child, BalanceObject, End,
1434 Child, GroupObject,MUIA_Group_Horiz,TRUE,
1435 Child, TextObject, MUIA_Text_Contents, "=", MUIA_Text_SetMax, TRUE, End,
1436 Child, data->mcp_popstrfct = PopobjectObject,
1437 MUIA_InputMode, MUIV_InputMode_None,
1438 MUIA_Popstring_String, data->mcp_txtfct = TextObject,
1439 TextFrame,
1440 MUIA_Background, MUII_TextBack,
1441 MUIA_Text_Contents, " ",
1442 MUIA_UserData, -1,
1443 End,
1444 MUIA_Popstring_Button, PopButton(MUII_PopUp),
1445 MUIA_Popobject_StrObjHook, &StrObjHook,
1446 MUIA_Popobject_ObjStrHook, &ObjStrHook,
1447 MUIA_Popobject_WindowHook, &WindowHook,
1448 MUIA_Popobject_Object, data->mcp_poplistfct = ListviewObject,
1449 MUIA_Listview_List, ListObject,
1450 InputListFrame,
1451 MUIA_List_SourceArray, functions_names,
1452 End,
1453 End,
1454 End,
1455 End,
1457 End,
1459 Child, GroupObject,MUIA_Group_Horiz,TRUE,
1460 Child, data->mcp_insertkey = SimpleButtonCycle(tr(MSG_BUTTON_INSERT), tr(MSG_BUTTON_INSERT_HELP)),
1461 Child, data->mcp_removekey = SimpleButtonCycle(tr(MSG_BUTTON_REMOVE), tr(MSG_BUTTON_REMOVE_HELP)),
1462 Child, data->mcp_updatekeys = SimpleButtonCycle(tr(MSG_BUTTON_UPDATEKEYS), tr(MSG_BUTTON_UPDATEKEYS_HELP)),
1463 Child, data->mcp_defaultkeys = SimpleButtonCycle(tr(MSG_BUTTON_DEFAULTKEYS), tr(MSG_BUTTON_DEFAULTKEYS_HELP)),
1464 End,
1466 End;
1468 Pages[0] = tr(MSG_PAGE_FONTS);
1469 Pages[1] = tr(MSG_PAGE_COLORS);
1470 Pages[2] = tr(MSG_PAGE_SCROLLING);
1471 Pages[3] = tr(MSG_PAGE_OPTIONS);
1472 Pages[4] = tr(MSG_PAGE_KEYBINDINGS);
1474 data->mcp_group = VGroup,
1476 Child, RegisterObject,
1477 MUIA_Register_Titles, Pages,
1478 MUIA_Register_Frame, TRUE,
1479 Child, group1,
1480 Child, group2,
1481 Child, group3,
1482 Child, group4,
1483 Child, group5,
1484 End,
1486 Child, CrawlingObject,
1487 TextFrame,
1488 MUIA_FixHeightTxt, infotext1,
1489 MUIA_Background, "m1",
1491 Child, TextObject,
1492 MUIA_Text_Copy, FALSE,
1493 MUIA_Text_PreParse, "\033c",
1494 MUIA_Text_Contents, infotext1,
1495 End,
1497 Child, TextObject,
1498 MUIA_Text_Copy, FALSE,
1499 MUIA_Text_PreParse, "\033c",
1500 MUIA_Text_Contents, infotext2,
1501 End,
1503 Child, TextObject,
1504 MUIA_Text_Copy, FALSE,
1505 MUIA_Text_PreParse, "\033c",
1506 MUIA_Text_Contents, infotext1,
1507 End,
1508 End,
1510 End;
1512 if(!data->mcp_group)
1514 CoerceMethod(cl, obj, OM_DISPOSE);
1515 return(0);
1518 DoMethod(obj, OM_ADDMEMBER, data->mcp_group);
1520 set(data->mcp_stringkey,MUIA_String_AttachedList,data->mcp_listkeys);
1521 set(data->mcp_listkeys,MUIA_UserData,data);
1523 DoMethod(data->mcp_listkeys,MUIM_Notify,MUIA_NList_Active, MUIV_EveryTime,
1524 data->mcp_listkeys, 3, MUIM_CallHook, &ActiveHook,data,MUIV_TriggerValue);
1526 DoMethod(data->mcp_listkeys,MUIM_Notify,MUIA_NList_DoubleClick, MUIV_EveryTime,
1527 MUIV_Notify_Window, 3, MUIM_Set, MUIA_Window_ActiveObject, data->mcp_stringkey);
1529 DoMethod(data->mcp_poplistfct,MUIM_Notify,MUIA_Listview_DoubleClick,TRUE,
1530 data->mcp_popstrfct,2,MUIM_Popstring_Close,TRUE);
1532 DoMethod(data->mcp_txtfct, MUIM_Notify, MUIA_Text_Contents, MUIV_EveryTime,
1533 data->mcp_listkeys, 3, MUIM_CallHook, &TxtFctHook,data->mcp_txtfct);
1535 DoMethod(data->mcp_snoopkey, MUIM_Notify, MUIA_Selected, TRUE,
1536 MUIV_Notify_Window, 3, MUIM_Set, MUIA_Window_ActiveObject, data->mcp_stringkey);
1538 DoMethod(data->mcp_snoopkey, MUIM_Notify, MUIA_Selected, MUIV_EveryTime,
1539 data->mcp_stringkey, 3, MUIM_Set, MUIA_HotkeyString_Snoop, MUIV_TriggerValue);
1541 DoMethod(data->mcp_stringkey, MUIM_Notify, MUIA_String_Contents, MUIV_EveryTime,
1542 data->mcp_snoopkey, 3, MUIM_Set, MUIA_Selected, FALSE);
1544 DoMethod(data->mcp_stringkey, MUIM_Notify, MUIA_String_Acknowledge, MUIV_EveryTime,
1545 data->mcp_listkeys, 3, MUIM_CallHook, &AckHook,data->mcp_stringkey);
1547 DoMethod(data->mcp_insertkey,MUIM_Notify, MUIA_Pressed, FALSE,
1548 data->mcp_listkeys, 3, MUIM_CallHook, &InsertHook);
1550 DoMethod(data->mcp_removekey,MUIM_Notify, MUIA_Pressed, FALSE,
1551 data->mcp_listkeys, 2,MUIM_NList_Remove,MUIV_NList_Remove_Active);
1553 DoMethod(data->mcp_defaultkeys,MUIM_Notify, MUIA_Pressed, FALSE,
1554 data->mcp_listkeys, 3, MUIM_CallHook, &DefaultHook);
1556 DoMethod(data->mcp_updatekeys,MUIM_Notify, MUIA_Pressed, FALSE,
1557 data->mcp_listkeys, 3, MUIM_CallHook, &UpdateHook);
1559 // in case we are running for a newer MUI version we can register
1560 // our mcc gadgets accordingly
1561 if(MUIMasterBase->lib_Version >= 20)
1563 DoMethod(obj, MUIM_Mccprefs_RegisterGadget, data->mcp_PenTitle, MUICFG_NList_Pen_Title, 1, tr(MSG_TITLE_PEN_WIN));
1564 DoMethod(obj, MUIM_Mccprefs_RegisterGadget, data->mcp_PenList, MUICFG_NList_Pen_List, 1, tr(MSG_LIST_PEN_WIN));
1565 DoMethod(obj, MUIM_Mccprefs_RegisterGadget, data->mcp_PenSelect, MUICFG_NList_Pen_Select, 1, tr(MSG_SELECT_PEN_WIN));
1566 DoMethod(obj, MUIM_Mccprefs_RegisterGadget, data->mcp_PenCursor, MUICFG_NList_Pen_Cursor, 1, tr(MSG_CURSOR_PEN_WIN));
1567 DoMethod(obj, MUIM_Mccprefs_RegisterGadget, data->mcp_PenUnselCur, MUICFG_NList_Pen_UnselCur, 1, tr(MSG_UNSEL_PEN_WIN));
1568 DoMethod(obj, MUIM_Mccprefs_RegisterGadget, data->mcp_PenInactive, MUICFG_NList_Pen_Inactive, 1, tr(MSG_INACT_PEN_WIN));
1570 DoMethod(obj, MUIM_Mccprefs_RegisterGadget, data->mcp_BG_Title, MUICFG_NList_BG_Title, 1, tr(MSG_TITLE_BG_WIN));
1571 DoMethod(obj, MUIM_Mccprefs_RegisterGadget, data->mcp_BG_List, MUICFG_NList_BG_List, 1, tr(MSG_LIST_BG_WIN));
1572 DoMethod(obj, MUIM_Mccprefs_RegisterGadget, data->mcp_BG_Select, MUICFG_NList_BG_Select, 1, tr(MSG_SELECT_BG_WIN));
1573 DoMethod(obj, MUIM_Mccprefs_RegisterGadget, data->mcp_BG_Cursor, MUICFG_NList_BG_Cursor, 1, tr(MSG_CURSOR_BG_WIN));
1574 DoMethod(obj, MUIM_Mccprefs_RegisterGadget, data->mcp_BG_UnselCur, MUICFG_NList_BG_UnselCur, 1, tr(MSG_UNSEL_BG_WIN));
1575 DoMethod(obj, MUIM_Mccprefs_RegisterGadget, data->mcp_BG_Inactive, MUICFG_NList_BG_Inactive, 1, tr(MSG_INACT_BG_WIN));
1577 DoMethod(obj, MUIM_Mccprefs_RegisterGadget, data->mcp_Font, MUICFG_NList_Font, 1, tr(MSG_NORMAL_FONT));
1578 DoMethod(obj, MUIM_Mccprefs_RegisterGadget, data->mcp_Font_Little, MUICFG_NList_Font_Little, 1, tr(MSG_SMALL_FONT));
1579 DoMethod(obj, MUIM_Mccprefs_RegisterGadget, data->mcp_Font_Fixed, MUICFG_NList_Font_Fixed, 1, tr(MSG_FIXED_FONT));
1581 DoMethod(obj, MUIM_Mccprefs_RegisterGadget, data->mcp_SL_VertInc, MUICFG_NList_VertInc, 1, tr(MSG_FONT_MARGIN));
1582 DoMethod(obj, MUIM_Mccprefs_RegisterGadget, data->mcp_R_Drag, MUICFG_NList_DragType, 1, tr(MSG_DRAGDROP));
1584 DoMethod(obj, MUIM_Mccprefs_RegisterGadget, data->mcp_R_Multi, MUICFG_NList_MultiSelect, 1, tr(MSG_MULTISELECT));
1586 DoMethod(obj, MUIM_Mccprefs_RegisterGadget, data->mcp_R_VSB, MUICFG_NListview_VSB, 1, tr(MSG_SB_VERTICAL));
1587 DoMethod(obj, MUIM_Mccprefs_RegisterGadget, data->mcp_R_HSB, MUICFG_NListview_HSB, 1, tr(MSG_SB_HORIZONTAL));
1589 DoMethod(obj, MUIM_Mccprefs_RegisterGadget, data->mcp_B_Smooth, MUICFG_NList_Smooth, 1, tr(MSG_SMOOTH_SCROLLING));
1590 DoMethod(obj, MUIM_Mccprefs_RegisterGadget, data->mcp_ForcePen, MUICFG_NList_ForcePen, 1, tr(MSG_FORCE_SELECT_PEN));
1591 DoMethod(obj, MUIM_Mccprefs_RegisterGadget, data->mcp_ColWidthDrag, MUICFG_NList_ColWidthDrag, 1, tr(MSG_BALANCING_COLS));
1592 DoMethod(obj, MUIM_Mccprefs_RegisterGadget, data->mcp_PartialCol, MUICFG_NList_PartialCol, 1, tr(MSG_PARTIAL_COL_MARK));
1593 DoMethod(obj, MUIM_Mccprefs_RegisterGadget, data->mcp_List_Select, MUICFG_NList_List_Select, 1, tr(MSG_MULTISEL_MOVEACTIVE));
1594 DoMethod(obj, MUIM_Mccprefs_RegisterGadget, data->mcp_NList_Menu, MUICFG_NList_Menu, 1, tr(MSG_BAR_CONTEXTMENU));
1595 DoMethod(obj, MUIM_Mccprefs_RegisterGadget, data->mcp_PartialChar, MUICFG_NList_PartialChar, 1, tr(MSG_PARTIAL_CHARS_DRAWN));
1597 DoMethod(obj, MUIM_Mccprefs_RegisterGadget, data->mcp_SerMouseFix, MUICFG_NList_SerMouseFix, 1, tr(MSG_SERMOUSE_FIX));
1598 DoMethod(obj, MUIM_Mccprefs_RegisterGadget, data->mcp_listkeys, MUICFG_NList_Keys, 1, tr(MSG_PAGE_KEYBINDINGS));
1599 DoMethod(obj, MUIM_Mccprefs_RegisterGadget, data->mcp_DragLines, MUICFG_NList_DragLines, 1, tr(MSG_DRAG_LINES));
1600 DoMethod(obj, MUIM_Mccprefs_RegisterGadget, data->mcp_VerticalCenteredLines, MUICFG_NList_VCenteredLines, 1, tr(MSG_VERT_CENTERED));
1601 DoMethod(obj, MUIM_Mccprefs_RegisterGadget, data->mcp_SelectPointer,MUICFG_NList_SelectPointer, 1, tr(MSG_SELECT_POINTER));
1603 DoMethod(obj, MUIM_Mccprefs_RegisterGadget, data->mcp_WheelStep, MUICFG_NList_WheelStep, 1, tr(MSG_WHEEL_STEP));
1604 DoMethod(obj, MUIM_Mccprefs_RegisterGadget, data->mcp_WheelFast, MUICFG_NList_WheelFast, 1, tr(MSG_WHEEL_FAST));
1605 DoMethod(obj, MUIM_Mccprefs_RegisterGadget, data->mcp_WheelMMB, MUICFG_NList_WheelMMB, 1, tr(MSG_MMB_FASTWHEEL));
1608 return ((IPTR)obj);
1611 static IPTR mNL_MCP_Dispose(struct IClass *cl, Object *obj, Msg msg)
1613 struct NListviews_MCP_Data *data = INST_DATA(cl, obj);
1615 if(data->exampleText != NULL)
1617 LONG i = 0;
1619 while(data->exampleText[i] != NULL)
1621 FreeVec(data->exampleText[i]);
1622 i++;
1625 FreeVec(data->exampleText);
1628 return DoSuperMethodA(cl, obj, msg);
1631 IPTR mNL_MCP_ConfigToGadgets(struct IClass *cl,Object *obj,struct MUIP_Settingsgroup_ConfigToGadgets *msg)
1633 struct NListviews_MCP_Data *data = INST_DATA(cl, obj);
1635 D(DBF_STARTUP, "configToGadgets");
1637 LOAD_DATASPEC(data->mcp_PenTitle, MUIA_Pendisplay_Spec, MUICFG_NList_Pen_Title, DEFAULT_PEN_TITLE);
1638 LOAD_DATASPEC(data->mcp_PenList, MUIA_Pendisplay_Spec, MUICFG_NList_Pen_List, DEFAULT_PEN_LIST);
1639 LOAD_DATASPEC(data->mcp_PenSelect, MUIA_Pendisplay_Spec, MUICFG_NList_Pen_Select, DEFAULT_PEN_SELECT);
1640 LOAD_DATASPEC(data->mcp_PenCursor, MUIA_Pendisplay_Spec, MUICFG_NList_Pen_Cursor, DEFAULT_PEN_CURSOR);
1641 LOAD_DATASPEC(data->mcp_PenUnselCur,MUIA_Pendisplay_Spec, MUICFG_NList_Pen_UnselCur,DEFAULT_PEN_UNSELCUR);
1642 LOAD_DATASPEC(data->mcp_PenInactive,MUIA_Pendisplay_Spec, MUICFG_NList_Pen_Inactive,DEFAULT_PEN_INACTIVE);
1644 LOAD_DATASPEC(data->mcp_BG_Title, MUIA_Imagedisplay_Spec,MUICFG_NList_BG_Title, DEFAULT_BG_TITLE);
1645 LOAD_DATASPEC(data->mcp_BG_List, MUIA_Imagedisplay_Spec,MUICFG_NList_BG_List, DEFAULT_BG_LIST);
1646 LOAD_DATASPEC(data->mcp_BG_Select, MUIA_Imagedisplay_Spec,MUICFG_NList_BG_Select, DEFAULT_BG_SELECT);
1647 LOAD_DATASPEC(data->mcp_BG_Cursor, MUIA_Imagedisplay_Spec,MUICFG_NList_BG_Cursor, DEFAULT_BG_CURSOR);
1648 LOAD_DATASPEC(data->mcp_BG_UnselCur,MUIA_Imagedisplay_Spec,MUICFG_NList_BG_UnselCur, DEFAULT_BG_UNSELCUR);
1649 LOAD_DATASPEC(data->mcp_BG_Inactive,MUIA_Imagedisplay_Spec,MUICFG_NList_BG_Inactive, DEFAULT_BG_INACTIVE);
1651 LOAD_DATALONG(data->mcp_SL_VertInc, MUIA_Numeric_Value, MUICFG_NList_VertInc, DEFAULT_VERT_INC);
1653 LOAD_DATALONG(data->mcp_B_Smooth, MUIA_Selected, MUICFG_NList_Smooth, DEFAULT_SMOOTHSCROLL);
1655 LOAD_DATAFONT(data->mcp_Font, MUICFG_NList_Font);
1656 LOAD_DATAFONT(data->mcp_Font_Little,MUICFG_NList_Font_Little);
1657 LOAD_DATAFONT(data->mcp_Font_Fixed, MUICFG_NList_Font_Fixed);
1660 LONG *ptrd;
1661 LONG num = DEFAULT_DRAGTYPE;
1662 if((ptrd = (LONG *) DoMethod(msg->configdata, MUIM_Dataspace_Find, MUICFG_NList_DragType)))
1664 if (*ptrd == MUIV_NList_DragType_Qualifier)
1665 num = 2;
1666 else if (*ptrd == MUIV_NList_DragType_Borders)
1667 num = 1;
1668 else
1669 num = 0;
1671 set(data->mcp_R_Drag,MUIA_Radio_Active, num);
1676 LONG *ptrd;
1677 LONG num = DEFAULT_CWD;
1678 if((ptrd = (LONG *) DoMethod(msg->configdata, MUIM_Dataspace_Find, MUICFG_NList_ColWidthDrag)))
1680 if (*ptrd <= 0)
1681 num = 0;
1682 else if (*ptrd == 2)
1683 num = 2;
1684 else
1685 num = 1;
1687 set(data->mcp_ColWidthDrag,MUIA_Radio_Active, num);
1691 LONG *ptrd;
1692 LONG num = DEFAULT_MULTISELECT;
1694 if((ptrd = (LONG *) DoMethod(msg->configdata, MUIM_Dataspace_Find, MUICFG_NList_MultiSelect)))
1695 num = *ptrd;
1697 if ((num & MUIV_NList_MultiSelect_MMB_On) == MUIV_NList_MultiSelect_MMB_On)
1699 set(data->mcp_B_MultiMMB, MUIA_Selected, TRUE);
1701 else
1703 set(data->mcp_B_MultiMMB, MUIA_Selected, FALSE);
1705 num &= 0x0007;
1706 if (num == MUIV_NList_MultiSelect_Always)
1707 num = 1;
1708 else
1709 num = 0;
1710 set(data->mcp_R_Multi,MUIA_Radio_Active, num);
1714 LONG *ptrd;
1715 LONG num = DEFAULT_HSB;
1717 if((ptrd = (LONG *) DoMethod(msg->configdata, MUIM_Dataspace_Find, MUICFG_NListview_HSB)))
1718 num = *ptrd;
1720 if ((num < 1) || (num > 4))
1721 num = DEFAULT_HSB;
1722 num--;
1724 set(data->mcp_R_HSB,MUIA_Radio_Active, num);
1728 LONG *ptrd;
1729 LONG num = DEFAULT_VSB;
1731 if((ptrd = (LONG *) DoMethod(msg->configdata, MUIM_Dataspace_Find, MUICFG_NListview_VSB)))
1732 num = *ptrd;
1734 if ((num < 1) || (num > 3))
1735 num = 1;
1736 num--;
1737 set(data->mcp_R_VSB,MUIA_Radio_Active, num);
1741 LONG *ptrd;
1742 LONG num = DEFAULT_FORCEPEN;
1743 if((ptrd = (LONG *) DoMethod(msg->configdata, MUIM_Dataspace_Find, MUICFG_NList_ForcePen)))
1745 if (*ptrd)
1746 num = TRUE;
1747 else
1748 num = FALSE;
1750 set(data->mcp_ForcePen, MUIA_Selected, num);
1753 LOAD_DATALONG(data->mcp_DragLines, MUIA_Numeric_Value, MUICFG_NList_DragLines, DEFAULT_DRAGLINES);
1754 LOAD_DATALONG(data->mcp_VerticalCenteredLines, MUIA_Selected, MUICFG_NList_VCenteredLines, DEFAULT_VCENTERED);
1755 LOAD_DATALONG(data->mcp_SelectPointer, MUIA_Selected, MUICFG_NList_SelectPointer, DEFAULT_SELECTPOINTER);
1756 LOAD_DATALONG(data->mcp_WheelStep, MUIA_Numeric_Value, MUICFG_NList_WheelStep, DEFAULT_WHEELSTEP);
1757 LOAD_DATALONG(data->mcp_WheelFast, MUIA_Numeric_Value, MUICFG_NList_WheelFast, DEFAULT_WHEELFAST);
1758 LOAD_DATALONG(data->mcp_WheelMMB, MUIA_Selected, MUICFG_NList_WheelMMB, DEFAULT_WHEELMMB);
1761 LONG *ptrd;
1762 LONG num = DEFAULT_SERMOUSEFIX;
1763 if((ptrd = (LONG *) DoMethod(msg->configdata, MUIM_Dataspace_Find, MUICFG_NList_SerMouseFix)))
1765 if (*ptrd)
1766 num = TRUE;
1767 else
1768 num = FALSE;
1770 set(data->mcp_SerMouseFix, MUIA_Selected, num);
1774 LONG *ptrd;
1775 LONG num = DEFAULT_LIST_SELECT;
1776 if((ptrd = (LONG *) DoMethod(msg->configdata, MUIM_Dataspace_Find, MUICFG_NList_List_Select)))
1778 if (*ptrd)
1779 num = TRUE;
1780 else
1781 num = FALSE;
1783 set(data->mcp_List_Select, MUIA_Selected, num);
1787 LONG *ptrd;
1788 LONG num = DEFAULT_PARTIALCOL;
1789 if((ptrd = (LONG *) DoMethod(msg->configdata, MUIM_Dataspace_Find, MUICFG_NList_PartialCol)))
1791 if (*ptrd)
1792 num = TRUE;
1793 else
1794 num = FALSE;
1796 set(data->mcp_PartialCol, MUIA_Selected, num);
1800 LONG *ptrd;
1801 LONG num = DEFAULT_PARTIALCHAR;
1802 if((ptrd = (LONG *) DoMethod(msg->configdata, MUIM_Dataspace_Find, MUICFG_NList_PartialChar)))
1804 if (*ptrd)
1805 num = TRUE;
1806 else
1807 num = FALSE;
1809 set(data->mcp_PartialChar, MUIA_Selected, num);
1813 LONG *ptrd;
1814 LONG num = DEFAULT_CMENU;
1815 if((ptrd = (LONG *)DoMethod(msg->configdata, MUIM_Dataspace_Find, MUICFG_NList_Menu)) != NULL)
1817 if(*ptrd == (LONG)MUIV_NList_ContextMenu_TopOnly)
1818 num = 1;
1819 else if(*ptrd == (LONG)MUIV_NList_ContextMenu_Never)
1820 num = 2;
1822 set(data->mcp_NList_Menu, MUIA_Radio_Active, num);
1826 LONG *ptrd;
1827 struct KeyBinding *keys = default_keys;
1829 if((ptrd = (LONG *) DoMethod(msg->configdata, MUIM_Dataspace_Find, MUICFG_NList_Keys)))
1830 keys = (struct KeyBinding *) ptrd;
1832 NL_LoadKeys(data->mcp_listkeys,keys);
1835 return(0);
1839 IPTR mNL_MCP_GadgetsToConfig(struct IClass *cl,Object *obj,struct MUIP_Settingsgroup_GadgetsToConfig *msg)
1841 struct NListviews_MCP_Data *data = INST_DATA(cl, obj);
1843 D(DBF_STARTUP, "GadgetsToConfig");
1845 SAVE_DATASPEC(data->mcp_PenTitle, MUIA_Pendisplay_Spec, MUICFG_NList_Pen_Title);
1846 SAVE_DATASPEC(data->mcp_PenList, MUIA_Pendisplay_Spec, MUICFG_NList_Pen_List);
1847 SAVE_DATASPEC(data->mcp_PenSelect, MUIA_Pendisplay_Spec, MUICFG_NList_Pen_Select);
1848 SAVE_DATASPEC(data->mcp_PenCursor, MUIA_Pendisplay_Spec, MUICFG_NList_Pen_Cursor);
1849 SAVE_DATASPEC(data->mcp_PenUnselCur,MUIA_Pendisplay_Spec, MUICFG_NList_Pen_UnselCur);
1850 SAVE_DATASPEC(data->mcp_PenInactive,MUIA_Pendisplay_Spec, MUICFG_NList_Pen_Inactive);
1852 SAVE_DATASPEC2(data->mcp_BG_Title, MUIA_Imagedisplay_Spec,MUICFG_NList_BG_Title);
1853 SAVE_DATASPEC2(data->mcp_BG_List, MUIA_Imagedisplay_Spec,MUICFG_NList_BG_List);
1854 SAVE_DATASPEC2(data->mcp_BG_Select, MUIA_Imagedisplay_Spec,MUICFG_NList_BG_Select);
1855 SAVE_DATASPEC2(data->mcp_BG_Cursor, MUIA_Imagedisplay_Spec,MUICFG_NList_BG_Cursor);
1856 SAVE_DATASPEC2(data->mcp_BG_UnselCur,MUIA_Imagedisplay_Spec,MUICFG_NList_BG_UnselCur);
1857 SAVE_DATASPEC2(data->mcp_BG_Inactive,MUIA_Imagedisplay_Spec,MUICFG_NList_BG_Inactive);
1859 SAVE_DATALONG(data->mcp_SL_VertInc, MUIA_Numeric_Value, MUICFG_NList_VertInc);
1861 SAVE_DATALONG(data->mcp_B_Smooth, MUIA_Selected, MUICFG_NList_Smooth);
1863 SAVE_DATAFONT(data->mcp_Font, MUICFG_NList_Font);
1864 SAVE_DATAFONT(data->mcp_Font_Little,MUICFG_NList_Font_Little);
1865 SAVE_DATAFONT(data->mcp_Font_Fixed, MUICFG_NList_Font_Fixed);
1868 LONG ptrd=0,num;
1869 get(data->mcp_R_Drag, MUIA_Radio_Active, &ptrd);
1870 if (ptrd == 2)
1871 num = MUIV_NList_DragType_Qualifier;
1872 else if (ptrd == 1)
1873 num = MUIV_NList_DragType_Borders;
1874 else
1875 num = MUIV_NList_DragType_Immediate;
1876 DoMethod(msg->configdata, MUIM_Dataspace_Add, &num, sizeof(num), MUICFG_NList_DragType);
1880 LONG ptrd=0,num;
1881 get(data->mcp_ColWidthDrag, MUIA_Radio_Active, &ptrd);
1882 num = ptrd;
1883 DoMethod(msg->configdata, MUIM_Dataspace_Add, &num, sizeof(num), MUICFG_NList_ColWidthDrag);
1887 LONG ptrd=0,num;
1888 get(data->mcp_R_Multi, MUIA_Radio_Active, &ptrd);
1889 if (ptrd == 1)
1890 num = MUIV_NList_MultiSelect_Always;
1891 else
1892 num = MUIV_NList_MultiSelect_Shifted;
1893 get(data->mcp_B_MultiMMB, MUIA_Selected, &ptrd);
1894 if (ptrd)
1895 num |= MUIV_NList_MultiSelect_MMB_On;
1896 else
1897 num |= MUIV_NList_MultiSelect_MMB_Off;
1898 DoMethod(msg->configdata, MUIM_Dataspace_Add, &num, sizeof(num), MUICFG_NList_MultiSelect);
1902 LONG ptrd=0,num;
1903 get(data->mcp_R_HSB, MUIA_Radio_Active, &ptrd);
1904 num = ptrd+1;
1905 DoMethod(msg->configdata, MUIM_Dataspace_Add, &num, sizeof(num), MUICFG_NListview_HSB);
1908 LONG ptrd=0,num;
1909 get(data->mcp_R_VSB, MUIA_Radio_Active, &ptrd);
1910 num = ptrd+1;
1911 DoMethod(msg->configdata, MUIM_Dataspace_Add, &num, sizeof(num), MUICFG_NListview_VSB);
1915 LONG ptrd=0,num;
1916 get(data->mcp_ForcePen, MUIA_Selected, &ptrd);
1917 if (ptrd)
1918 num = TRUE;
1919 else
1920 num = FALSE;
1921 DoMethod(msg->configdata, MUIM_Dataspace_Add, &num, sizeof(num), MUICFG_NList_ForcePen);
1924 SAVE_DATALONG(data->mcp_DragLines, MUIA_Numeric_Value, MUICFG_NList_DragLines);
1925 SAVE_DATALONG(data->mcp_VerticalCenteredLines, MUIA_Selected, MUICFG_NList_VCenteredLines);
1926 SAVE_DATALONG(data->mcp_SelectPointer,MUIA_Selected, MUICFG_NList_SelectPointer);
1927 SAVE_DATALONG(data->mcp_WheelStep, MUIA_Numeric_Value, MUICFG_NList_WheelStep);
1928 SAVE_DATALONG(data->mcp_WheelFast, MUIA_Numeric_Value, MUICFG_NList_WheelFast);
1929 SAVE_DATALONG(data->mcp_WheelMMB, MUIA_Selected, MUICFG_NList_WheelMMB);
1932 LONG ptrd=0,num;
1933 get(data->mcp_SerMouseFix, MUIA_Selected, &ptrd);
1934 if (ptrd)
1935 num = TRUE;
1936 else
1937 num = FALSE;
1938 DoMethod(msg->configdata, MUIM_Dataspace_Add, &num, sizeof(num), MUICFG_NList_SerMouseFix);
1942 LONG ptrd=0,num;
1943 get(data->mcp_List_Select, MUIA_Selected, &ptrd);
1944 if (ptrd)
1945 num = TRUE;
1946 else
1947 num = FALSE;
1948 DoMethod(msg->configdata, MUIM_Dataspace_Add, &num, sizeof(num), MUICFG_NList_List_Select);
1952 LONG ptrd=0,num;
1953 get(data->mcp_PartialCol, MUIA_Selected, &ptrd);
1954 if (ptrd)
1955 num = TRUE;
1956 else
1957 num = FALSE;
1958 DoMethod(msg->configdata, MUIM_Dataspace_Add, &num, sizeof(num), MUICFG_NList_PartialCol);
1962 LONG ptrd=0,num;
1963 get(data->mcp_PartialChar, MUIA_Selected, &ptrd);
1964 if (ptrd)
1965 num = TRUE;
1966 else
1967 num = FALSE;
1968 DoMethod(msg->configdata, MUIM_Dataspace_Add, &num, sizeof(num), MUICFG_NList_PartialChar);
1972 LONG ptrd=0,num = MUIV_NList_ContextMenu_Always;
1973 get(data->mcp_NList_Menu, MUIA_Radio_Active, &ptrd);
1974 if (ptrd == 1)
1975 num = MUIV_NList_ContextMenu_TopOnly;
1976 else if (ptrd == 2)
1977 num = MUIV_NList_ContextMenu_Never;
1978 DoMethod(msg->configdata, MUIM_Dataspace_Add, &num, sizeof(num), MUICFG_NList_Menu);
1982 LONG sk = NL_SaveKeys(data);
1983 if (sk > 0)
1985 DoMethod(msg->configdata, MUIM_Dataspace_Add, data->nlkeys, sk, MUICFG_NList_Keys);
1986 FreeVec((void *) data->nlkeys);
1987 data->nlkeys = NULL;
1991 return(0);
1995 static IPTR mNL_MCP_Get(struct IClass *cl,Object *obj,Msg msg)
1997 IPTR *store = ((struct opGet *)msg)->opg_Storage;
1999 switch (((struct opGet *)msg)->opg_AttrID)
2001 case MUIA_Version:
2002 *store = LIB_VERSION;
2003 return(TRUE);
2004 break;
2005 case MUIA_Revision:
2006 *store = LIB_REVISION;
2007 return(TRUE);
2008 break;
2010 return (DoSuperMethodA(cl,obj,msg));
2013 DISPATCHER(_DispatcherP)
2015 switch (msg->MethodID)
2017 case OM_NEW: return(mNL_MCP_New(cl,obj,(APTR)msg));
2018 case OM_DISPOSE: return(mNL_MCP_Dispose(cl,obj,(APTR)msg));
2019 case OM_GET: return(mNL_MCP_Get(cl,obj,(APTR)msg));
2020 case MUIM_Settingsgroup_ConfigToGadgets: return(mNL_MCP_ConfigToGadgets(cl,obj,(APTR)msg));
2021 case MUIM_Settingsgroup_GadgetsToConfig: return(mNL_MCP_GadgetsToConfig(cl,obj,(APTR)msg));
2024 return(DoSuperMethodA(cl,obj,msg));