1 /***************************************************************************
3 NList.mcc - New List MUI Custom Class
4 Registered MUI class, Serial Number: 1d51 0x9d510030 to 0x9d5100A0
5 0x9d5100C0 to 0x9d5100FF
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
24 ***************************************************************************/
30 #include <exec/memory.h>
31 #include <libraries/iffparse.h>
32 #include <proto/console.h>
33 #include <proto/utility.h>
34 #include <proto/exec.h>
35 #include <proto/dos.h>
36 #include <proto/iffparse.h>
40 #include "NList_func.h"
42 IPTR
MyCallHookPkt(Object
*obj
,BOOL hdata
,struct Hook
*hook
,APTR object
,APTR message
)
46 APTR h_Data
= hook
->h_Data
;
49 retval
= CallHookPkt(hook
,object
,message
);
51 hook
->h_Data
= h_Data
;
55 return (CallHookPkt(hook
,object
,message
));
59 /* AROS uses a macro to handle this */
61 IPTR STDARGS VARARGS68K
MyCallHookPktA(Object
*obj
, struct Hook
*hook
, ...)
67 ret
= CallHookPkt(hook
, obj
, VA_ARG(va
, APTR
));
74 LONG
DeadKeyConvert(struct NLData
*data
,struct IntuiMessage
*msg
,STRPTR buf
,LONG bufsize
,struct KeyMap
*kmap
)
76 int posraw
,pos
,postext
= 0;
79 if (msg
->Class
!= IDCMP_RAWKEY
)
86 * if (msg->Qualifier & IEQUALIFIER_LSHIFT) D(bug("lshift "));
87 * if (msg->Qualifier & IEQUALIFIER_RSHIFT) D(bug("rshift "));
88 * if (msg->Qualifier & IEQUALIFIER_CAPSLOCK) D(bug("capslock "));
89 * if (msg->Qualifier & IEQUALIFIER_CONTROL) D(bug("ctrl "));
90 * if (msg->Qualifier & IEQUALIFIER_LALT) D(bug("lalt "));
91 * if (msg->Qualifier & IEQUALIFIER_RALT) D(bug("ralt "));
92 * if (msg->Qualifier & IEQUALIFIER_LCOMMAND) D(bug("lcommand "));
93 * if (msg->Qualifier & IEQUALIFIER_RCOMMAND) D(bug("rcommand "));
94 * if (msg->Qualifier & IEQUALIFIER_NUMERICPAD) D(bug("numpad "));
95 * if (msg->Qualifier & IEQUALIFIER_REPEAT) D(bug("repeat "));
96 * if (msg->Qualifier & IEQUALIFIER_MIDBUTTON) D(bug("mbutton "));
97 * if (msg->Qualifier & IEQUALIFIER_RBUTTON) D(bug("rbutton "));
98 * if (msg->Qualifier & IEQUALIFIER_LEFTBUTTON) D(bug("lbutton "));
102 switch (msg
->Code
& 0x7F)
104 case 0x41 : strlcpy(text
,"bs", bufsize
); break;
105 case 0x42 : strlcpy(text
,"tab", bufsize
); break;
106 case 0x43 : strlcpy(text
,"enter", bufsize
); break;
107 case 0x44 : strlcpy(text
,"return", bufsize
); break;
108 case 0x45 : strlcpy(text
,"esc", bufsize
); break;
109 case 0x46 : strlcpy(text
,"del", bufsize
); break;
110 case 0x4C : strlcpy(text
,"up", bufsize
); break;
111 case 0x4D : strlcpy(text
,"down", bufsize
); break;
112 case 0x4E : strlcpy(text
,"right", bufsize
); break;
113 case 0x4F : strlcpy(text
,"left", bufsize
); break;
114 case 0x50 : strlcpy(text
,"f1", bufsize
); break;
115 case 0x51 : strlcpy(text
,"f2", bufsize
); break;
116 case 0x52 : strlcpy(text
,"f3", bufsize
); break;
117 case 0x53 : strlcpy(text
,"f4", bufsize
); break;
118 case 0x54 : strlcpy(text
,"f5", bufsize
); break;
119 case 0x55 : strlcpy(text
,"f6", bufsize
); break;
120 case 0x56 : strlcpy(text
,"f7", bufsize
); break;
121 case 0x57 : strlcpy(text
,"f8", bufsize
); break;
122 case 0x58 : strlcpy(text
,"f9", bufsize
); break;
123 case 0x59 : strlcpy(text
,"f10", bufsize
); break;
124 case 0x5F : strlcpy(text
,"help", bufsize
); break;
126 data
->ievent
.ie_NextEvent
= NULL
;
127 data
->ievent
.ie_Class
= IECLASS_RAWKEY
;
128 data
->ievent
.ie_SubClass
= 0;
129 data
->ievent
.ie_Code
= msg
->Code
;
130 data
->ievent
.ie_Qualifier
= 0;
131 data
->ievent
.ie_position
.ie_addr
= *((APTR
*) msg
->IAddress
);
132 posraw
= RawKeyConvert(&data
->ievent
,text
,bufsize
-postext
-1,kmap
);
134 text
[posraw
+postext
] = '\0';
138 data
->rawtext
[posraw
] = '\0';
139 for (pos
= 0; pos
< posraw
; pos
++)
141 realc
= data
->rawtext
[pos
];
142 /*D(bug("RAWKEY KEY=%ld \n",realc));*/
143 if ((realc
<= 0x1F)||((realc
>= 0x80)&&(realc
< 0xa0)))
144 data
->rawtext
[pos
] = 0x7f;
149 return ((LONG
)strlen(buf
));
153 /*static char *stpncpy_noesc(char *to,const char *from,int len)*/
154 static char *stpncpy_noesc(char *to
,char *from
,int len
)
156 register char *to2
= to
;
158 while (*from
&& (len
> 0))
159 { if (*from
== '\033')
162 if ((*from
== 'P') || (*from
== 'I') || (*from
== 'O') || (*from
== 'o'))
166 { while ((*from
) && (*from
!= ']'))
190 #define FORMAT_TEMPLATE "DELTA=D/N,PREPARSE=P/K,COL=C/N,BAR/S,TBAR/S,NOBAR=NB/S,SIMPLEBAR=SBAR/S,"\
191 "NOTITLEBUTTON=NOTB/S,WEIGHT=W/N,MINWIDTH=MIW/N,MAXWIDTH=MAW/N,"\
192 "COLWIDTH=CW/N,MINCOLWIDTH=MICW/N,MAXCOLWIDTH=MACW/N,"\
193 "PIXWIDTH=PW/N,MINPIXWIDTH=MIPW/N,MAXPIXWIDTH=MAPW/N,"\
194 "PARTCOLSUBST=PCS/K\n"
219 void NL_Free_Format(struct NLData
*data
)
223 while (column
< data
->numcols
)
225 if(data
->cols
[column
].preparse
!= NULL
)
226 FreeVecPooled(data
->Pool
, data
->cols
[column
].preparse
);
230 FreeVecPooled(data
->Pool
, data
->cols
);
233 data
->numcols
= data
->numcols2
= 0;
234 data
->format_chge
= 1;
238 BOOL
NL_Read_Format(struct NLData
*data
,char *strformat
,BOOL oldlist
)
240 LONG column
,colmax
,pos1
,pos2
,col
= 0;
242 struct RDArgs
*rdargs
,*ptr
;
243 struct parse_format Line
;
244 struct colinfo
*tmpcols
;
246 if (strformat
&& (sf
= AllocVecPooled(data
->Pool
, strlen(strformat
)+4)) != NULL
)
248 if((ptr
= AllocDosObject(DOS_RDARGS
, NULL
)))
252 while (strformat
[pos2
] != '\0')
253 { if (strformat
[pos2
] == ',')
257 if ((colmax
> 0) && (colmax
< DISPLAY_ARRAY_MAX
) && (tmpcols
= AllocVecPooled(data
->Pool
, (colmax
+1)*sizeof(struct colinfo
))) != NULL
)
259 NL_Free_Format(data
);
260 data
->cols
= tmpcols
;
261 data
->numcols
= data
->numcols2
= colmax
;
263 while (column
< colmax
)
265 data
->cols
[column
].c
= &(data
->cols
[column
]);
266 data
->cols
[column
].preparse
= NULL
;
267 data
->cols
[column
].colwidthmax
= (WORD
) -1;
268 data
->cols
[column
].colwidthbiggest
= (WORD
) -1;
269 data
->cols
[column
].colwidthbiggestptr
= (LONG
) -2;
270 data
->cols
[column
].delta
= (WORD
) 4;
271 data
->cols
[column
].col
= (WORD
) column
;
272 data
->cols
[column
].userwidth
= (WORD
) -1;
273 data
->cols
[column
].titlebutton
= (WORD
) TRUE
;
274 if ((column
== colmax
-1) && !(oldlist
&& (column
== 0)))
275 data
->cols
[column
].width
= (WORD
) 100;
277 data
->cols
[column
].width
= (WORD
) -1;
278 data
->cols
[column
].minwidth
= (WORD
) 5;
279 data
->cols
[column
].maxwidth
= (WORD
) 0;
280 data
->cols
[column
].mincolwidth
= (WORD
) 0;
281 data
->cols
[column
].maxcolwidth
= (WORD
) 0;
282 data
->cols
[column
].minpixwidth
= (WORD
) 6;
283 data
->cols
[column
].maxpixwidth
= (WORD
) 0;
284 data
->cols
[column
].bar
= (BYTE
) 2;
285 data
->cols
[column
].width_type
= (BYTE
) CI_PERCENT
;
286 data
->cols
[column
].partcolsubst
= PCS_DISABLED
;
291 while (strformat
[pos2
] && (column
< colmax
))
293 while ((strformat
[pos2
] != ',') && (strformat
[pos2
] != '\0'))
294 sf
[pos1
++] = strformat
[pos2
++];
297 if (strformat
[pos2
] != '\0')
299 /*D(bug("col %ld ->%s",column,sf));*/
301 ptr
->RDA_Source
.CS_Buffer
= sf
;
302 ptr
->RDA_Source
.CS_Length
= strlen(sf
);
303 ptr
->RDA_Source
.CS_CurChr
= 0;
305 ptr
->RDA_Buffer
= NULL
;
306 ptr
->RDA_BufSiz
= 0L;
307 ptr
->RDA_ExtHelp
= NULL
;
310 // clear the Line structure
311 memset(&Line
, 0, sizeof(Line
));
313 if((rdargs
= ReadArgs(FORMAT_TEMPLATE
, (APTR
)&Line
, ptr
)))
315 if (Line
.delta
) data
->cols
[column
].delta
= (WORD
) *Line
.delta
;
318 int len
= strlen((char *)Line
.preparse
)+2;
319 if((data
->cols
[column
].preparse
= AllocVecPooled(data
->Pool
,len
)) != NULL
)
320 strlcpy(data
->cols
[column
].preparse
, (char *)Line
.preparse
, len
);
322 if (Line
.col
) data
->cols
[column
].col
= (WORD
) *Line
.col
;
323 if (Line
.tbar
) data
->cols
[column
].bar
= (WORD
) 2;
324 if (Line
.bar
) data
->cols
[column
].bar
= (WORD
) 1;
325 if (Line
.nobar
) data
->cols
[column
].bar
= (WORD
) 0;
326 if (Line
.sbar
) data
->cols
[column
].bar
|= (WORD
) 4;
327 if (Line
.notb
) data
->cols
[column
].titlebutton
= (WORD
) FALSE
;
331 data
->cols
[column
].width
= (WORD
) *Line
.weight
;
332 data
->cols
[column
].width_type
= (BYTE
) CI_PERCENT
;
333 if ((column
== colmax
-1) && !(oldlist
&& (column
== 0)) && (data
->cols
[column
].width
== -1))
334 data
->cols
[column
].width
= (WORD
) 100;
335 else if (data
->cols
[column
].width
< 0)
336 data
->cols
[column
].width
= (WORD
) -1;
339 { data
->cols
[column
].width
= (WORD
) *Line
.colwidth
;
340 data
->cols
[column
].width_type
= (BYTE
) CI_COL
;
341 if (data
->cols
[column
].width
< 1)
342 data
->cols
[column
].width
= 1;
345 { data
->cols
[column
].width
= (WORD
) *Line
.pixwidth
;
346 data
->cols
[column
].width_type
= (BYTE
) CI_PIX
;
347 if (data
->cols
[column
].width
< 4)
348 data
->cols
[column
].width
= 4;
352 data
->cols
[column
].minwidth
= (WORD
) *Line
.minwidth
;
354 data
->cols
[column
].maxwidth
= (WORD
) *Line
.maxwidth
;
356 if (Line
.mincolwidth
)
357 data
->cols
[column
].mincolwidth
= (WORD
) *Line
.mincolwidth
;
358 if (Line
.maxcolwidth
)
359 data
->cols
[column
].maxcolwidth
= (WORD
) *Line
.maxcolwidth
;
361 if (Line
.minpixwidth
)
362 data
->cols
[column
].minpixwidth
= (WORD
) *Line
.minpixwidth
;
363 if (Line
.maxpixwidth
)
364 data
->cols
[column
].maxpixwidth
= (WORD
) *Line
.maxpixwidth
;
366 if(Line
.partcolsubst
)
368 char c
= toupper(((char *)Line
.partcolsubst
)[0]);
373 data
->cols
[column
].partcolsubst
= PCS_DISABLED
;
377 data
->cols
[column
].partcolsubst
= PCS_RIGHT
;
381 data
->cols
[column
].partcolsubst
= PCS_LEFT
;
385 data
->cols
[column
].partcolsubst
= PCS_CENTER
;
390 data
->cols
[column
].minx
= (WORD
) -1;
391 data
->cols
[column
].maxx
= (WORD
) -1;
392 data
->cols
[column
].dx
= (WORD
) 4;
396 if (data
->cols
[column
].width
< 1)
399 if ((column == colmax-1) && (data->cols[column].width >= -1))
400 data->cols[column].width = (WORD) 100;
403 data
->cols
[column
].width
= (WORD
) -1;
404 data
->cols
[column
].width_type
= (BYTE
) CI_PERCENT
;
406 if (data
->cols
[column
].delta
< 0) data
->cols
[column
].delta
= 0;
407 if ((data
->cols
[column
].bar
!= 0) &&
408 (data
->cols
[column
].delta
< 2)) data
->cols
[column
].delta
+= 2;
409 if (data
->cols
[column
].minwidth
< 1)
412 if ((column == colmax-1) && (data->cols[column].minwidth >= -1))
413 data->cols[column].minwidth = 5;
416 data
->cols
[column
].minwidth
= -1;
418 if (data
->cols
[column
].maxwidth
<= 4) data
->cols
[column
].maxwidth
= 1000;
419 if (data
->cols
[column
].mincolwidth
< 0) data
->cols
[column
].mincolwidth
= 0;
420 if (data
->cols
[column
].maxcolwidth
<= 0) data
->cols
[column
].maxcolwidth
= 5000;
421 if (data
->cols
[column
].minpixwidth
< 6) data
->cols
[column
].minpixwidth
= 6;
422 if (data
->cols
[column
].maxpixwidth
<= 5) data
->cols
[column
].maxpixwidth
= 20000;
423 if (data
->cols
[column
].col
> col
) col
= data
->cols
[column
].col
;
426 /* data->cols[colmax-1].width = (WORD) 100;*/
428 FreeDosObject(DOS_RDARGS
, ptr
);
429 FreeVecPooled(data
->Pool
, sf
);
433 while (column
< data
->numcols
)
436 while (colmax
< column
)
437 { if (data
->cols
[column
].col
== data
->cols
[colmax
].col
)
439 while (colmax
< data
->numcols
)
440 { if (col
== data
->cols
[colmax
].col
)
442 if (col
>= DISPLAY_ARRAY_MAX
)
449 data
->cols
[column
].col
= col
++;
450 if (col
>= DISPLAY_ARRAY_MAX
)
461 while (column
< data
->numcols
)
462 { data
->column
[column
] = data
->cols
[column
].col
;
463 data
->cols
[column
].c
= &(data
->cols
[column
]);
466 data
->numcols2
= data
->numcols
;
468 data
->format_chge
= 1;
469 data
->do_setcols
= data
->do_updatesb
= data
->do_wwrap
= TRUE
;
470 data
->display_ptr
= NULL
;
471 /*D(bug("%lx|NL_Read_Format >%s<\n",obj,strformat));*/
475 NL_SetObjInfos(data
,TRUE
);
480 FreeDosObject(DOS_RDARGS
, ptr
);
482 FreeVecPooled(data
->Pool
,sf
);
489 static BOOL
CCB_string(struct NLData
*data
, char **cbstr
, char *str
, LONG len
, char lc
, BOOL skipesc
)
499 tmpcblen
+= strlen(*cbstr
);
501 if((tmpcb
= AllocVecPooled(data
->Pool
, tmpcblen
)) != NULL
)
507 tmp
+= strlcpy(tmp
, *cbstr
, tmpcblen
);
508 FreeVecPooled(data
->Pool
, *cbstr
);
512 tmp
= stpncpy_noesc(tmp
,str
,len
);
514 tmp
+= strlcpy(tmp
, str
, len
);
531 static BOOL
CCB_entry(struct NLData
*data
,char **cbstr
,APTR entptr
,SIPTR ent
,struct Hook
*hook
,SIPTR c1
,SIPTR p1
,SIPTR c2
,SIPTR p2
)
533 char **display_array
= &data
->DisplayArray
[2];
535 SIPTR pos1
,pos2
,len
,prep1
,prep2
;
538 WORD colwrap
,wrap
= 0;
540 if ((ent
>= 0) && data
->EntriesArray
[ent
]->Wrap
)
544 if (data
->EntriesArray
[ent
]->Wrap
& TE_Wrap_TmpLine
)
545 ent1
-= data
->EntriesArray
[ent
]->dnum
;
546 entptr
= data
->EntriesArray
[ent1
]->Entry
;
547 wrap
= data
->EntriesArray
[ent
]->Wrap
;
549 if (p1
< -PREPARSE_OFFSET_ENTRY
) /* begin in general column preparse string */
551 p1
+= PREPARSE_OFFSET_COL
;
556 p1
+= PREPARSE_OFFSET_ENTRY
; /* begin in display hook column preparse string */
559 else if (p1
== -1) /* begin at beginning of column */
564 if (p2
< -PREPARSE_OFFSET_ENTRY
) /* end in general column preparse string */
565 { p2
+= PREPARSE_OFFSET_COL
;
570 p2
+= PREPARSE_OFFSET_ENTRY
; /* end in display hook column preparse string */
573 else if (p2
== -1) /* end at beginning of column */
581 hook
= data
->NList_CopyEntryToClipHook
;
583 { display_array
[0] = (char *) entptr
;
584 data
->DisplayArray
[0] = (char *) data
->NList_PrivateData
;
585 data
->DisplayArray
[1] = (char *) ent
;
586 display_array
[1] = (char *) c1
;
587 display_array
[2] = (char *) p1
;
588 display_array
[3] = (char *) c2
;
589 display_array
[4] = (char *) p2
;
590 display_array
[5] = (char *) prep1
;
591 display_array
[6] = (char *) prep2
;
592 if (c1
<= 0) display_array
[1] = (char *) -1;
593 if (c1
>= data
->numcols
-1) display_array
[1] = (char *) -2;
594 if (c2
<= 0) display_array
[3] = (char *) -1;
595 if (c2
>= data
->numcols
-1) display_array
[3] = (char *) -2;
596 if (data
->NList_CopyEntryToClipHook2
)
597 { data
->DisplayArray
[0] = (char *) entptr
;
598 MyCallHookPkt(data
->this,FALSE
,hook
,data
->this,data
->DisplayArray
);
601 MyCallHookPkt(data
->this,TRUE
,hook
,display_array
,entptr
);
602 data
->display_ptr
= NULL
;
603 return (CCB_string(data
,cbstr
,display_array
[0],strlen(display_array
[0]),'\0',FALSE
));
607 WORD column
,col1
,col2
;
609 NL_GetDisplayArray(data
,ent
);
611 if ((c1
== -2) || (c1
>= data
->numcols
-1))
612 col1
= data
->numcols
-1;
618 if ((c2
== -2) || (c2
>= data
->numcols
-1))
620 col2
= data
->numcols
-1;
628 for (column
= col1
;column
<= col2
;column
++)
630 colwrap
= (1 << data
->cols
[column
].c
->col
) & TE_Wrap_TmpMask
;
631 str
= display_array
[data
->cols
[column
].c
->col
];
646 if ((wrap
& TE_Wrap_TmpLine
) && !(wrap
& colwrap
))
647 { if (!CCB_string(data
,cbstr
,str
,0,lc
,TRUE
))
651 if (wrap
&& (wrap
& colwrap
))
653 pos1
= data
->EntriesArray
[ent
]->pos
;
655 pos2
= data
->EntriesArray
[ent
]->pos
+ data
->EntriesArray
[ent
]->len
;
657 if (data
->NList_CopyColumnToClipHook
)
658 { display_array
[0] = (char *) str
;
659 data
->DisplayArray
[0] = (char *) data
->NList_PrivateData
;
660 data
->DisplayArray
[1] = (char *) ent
;
661 display_array
[1] = (char *) pos1
;
662 display_array
[2] = (char *) pos2
;
663 if (data
->NList_CopyColumnToClipHook2
)
664 { data
->DisplayArray
[0] = (char *) str
;
665 MyCallHookPkt(data
->this,FALSE
,data
->NList_CopyColumnToClipHook
,data
->this,data
->DisplayArray
);
668 MyCallHookPkt(data
->this,TRUE
,data
->NList_CopyColumnToClipHook
,display_array
,(APTR
) str
);
669 data
->display_ptr
= NULL
;
670 len
= (SIPTR
) display_array
[1];
673 if (!CCB_string(data
,cbstr
,display_array
[0],len
,lc
,FALSE
))
678 while ((str
[len
] != '\0') && (str
[len
] != '\n'))
694 if (!CCB_string(data
,cbstr
,&str
[pos1
],len
,lc
,TRUE
/* FALSE */ ))
706 #define CCB_ENTRY_PTR_HOOK(ep,h) \
707 ok = CCB_entry(data,&clipstr,ep,-1,h,-1,-1,-2,-2);
709 #define CCB_ENTRY_PTR(ep) \
710 ok = CCB_entry(data,&clipstr,ep,-1,NULL,-1,-1,-2,-2);
712 #define CCB_ENTRY(e) \
713 { if ((e >= 0) && (e < data->NList_Entries)) \
714 ok = CCB_entry(data,&clipstr,data->EntriesArray[e]->Entry,e,NULL,-1,-1,-2,-2); \
717 #define CCB_ENTRY_START_END(e,c1,p1,c2,p2) \
718 { if ((e >= 0) && (e < data->NList_Entries)) \
719 ok = CCB_entry(data,&clipstr,data->EntriesArray[e]->Entry,e,NULL,c1,p1,c2,p2); \
722 static LONG
CopyToFile(STRPTR filename
, STRPTR buffer
)
724 LONG result
= MUIV_NLCT_Failed
;
732 if((file
= Open(filename
, MODE_NEWFILE
)) != 0)
735 LONG lstr
= strlen(buffer
);
738 while(lstr
> 0 && (ret
= Write(file
, &buffer
[pstr
], lstr
)) >= 0)
745 result
= MUIV_NLCT_WriteErr
;
747 result
= MUIV_NLCT_Success
;
752 result
= MUIV_NLCT_OpenErr
;
759 SIPTR
NL_CopyTo(struct NLData
*data
,LONG pos
,char *filename
,ULONG clipnum
,APTR
*entries
,struct Hook
*hook
)
762 char *clipstr
= NULL
;
770 case MUIV_NList_CopyToClip_Active
:
771 CCB_ENTRY(data
->NList_Active
);
774 case MUIV_NList_CopyToClip_Selected
:
776 if(!data
->NList_TypeSelect
)
779 while (ok
&& (ent
< data
->NList_Entries
))
781 if (data
->EntriesArray
[ent
]->Select
!= TE_Select_None
)
791 c1
= data
->sel_pt
[data
->min_sel
].column
;
792 p1
= data
->sel_pt
[data
->min_sel
].colpos
;
793 c2
= data
->sel_pt
[data
->max_sel
].column
;
794 p2
= data
->sel_pt
[data
->max_sel
].colpos
;
795 ent
= data
->sel_pt
[data
->min_sel
].ent
;
796 D(DBF_STARTUP
, "ok=%d ent=%d mincol=%d maxcol=%d minpos=%d maxpos=%d", ok
, ent
, c1
, c2
, p1
, p2
);
797 if (ok
&& (ent
>= 0) && (ent
< data
->NList_Entries
))
799 if (ent
== data
->sel_pt
[data
->max_sel
].ent
)
801 CCB_ENTRY_START_END(ent
,c1
,p1
,c2
,p2
);
806 CCB_ENTRY_START_END(ent
,c1
,p1
,-2,-2);
810 while (ok
&& (ent
>= 0) && (ent
< data
->sel_pt
[data
->max_sel
].ent
) && (ent
< data
->NList_Entries
))
815 if (ok
&& (ent
>= 0) && (ent
== data
->sel_pt
[data
->max_sel
].ent
) && (ent
< data
->NList_Entries
))
817 CCB_ENTRY_START_END(ent
,-1,-1,c2
,p2
);
824 case MUIV_NList_CopyToClip_All
:
826 while (ok
&& (ent
< data
->NList_Entries
))
833 case MUIV_NList_CopyToClip_Entries
:
835 APTR
*array
= (APTR
*) entries
;
837 while (ok
&& array
[ent
])
839 CCB_ENTRY_PTR(array
[ent
]);
844 case MUIV_NList_CopyToClip_Entry
:
845 CCB_ENTRY_PTR(entries
);
848 case MUIV_NList_CopyToClip_Strings
:
850 APTR
*array
= (APTR
*) entries
;
852 while (ok
&& array
[ent
])
854 CCB_ENTRY_PTR_HOOK(array
[ent
],hook
);
860 case MUIV_NList_CopyToClip_String
:
861 CCB_ENTRY_PTR_HOOK(entries
,hook
);
871 ok
= CopyToFile(filename
, clipstr
);
873 else if((LONG
)clipnum
>= 0)
875 ok
= StringToClipboard(clipnum
, clipstr
);
879 int len
= strlen(clipstr
) + 1;
881 if((retstr
= (char *)AllocVecShared(len
, 0L)) != NULL
)
882 strlcpy(retstr
, clipstr
, len
);
887 FreeVecPooled(data
->Pool
, clipstr
);
894 IPTR
mNL_CopyToClip(struct IClass
*cl
,Object
*obj
,struct MUIP_NList_CopyToClip
*msg
)
896 struct NLData
*data
= INST_DATA(cl
,obj
);
897 /*DoSuperMethodA(cl,obj,(Msg) msg);*/
899 if((LONG
)msg
->clipnum
< 0)
902 return ((IPTR
) NL_CopyTo(data
,msg
->pos
,NULL
,msg
->clipnum
,msg
->entries
,msg
->hook
));
906 IPTR
mNL_CopyTo(struct IClass
*cl
,Object
*obj
,struct MUIP_NList_CopyTo
*msg
)
908 struct NLData
*data
= INST_DATA(cl
,obj
);
910 /*DoSuperMethodA(cl,obj,(Msg) msg);*/
911 res
= NL_CopyTo(data
,msg
->pos
,msg
->filename
,-1,msg
->entries
,NULL
);
912 *msg
->result
= (APTR
) res
;