grub2: bring back build of aros-side grub2 tools
[AROS.git] / workbench / classes / zune / nlist / nlist_mcc / NList_func.c
blob08316b9b52ab6f2bb7b7b90220e610f632ada0c2
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
22 $Id$
24 ***************************************************************************/
26 #include <clib/alib_protos.h>
27 #include <proto/intuition.h>
29 #include "private.h"
31 #include "NList_func.h"
33 // static functions in this file
34 static BOOL NL_List_Jump(struct NLData *data, LONG pos);
35 static BOOL NL_List_GetPos(struct NLData *data, APTR entry, LONG *pos);
37 /* Extent the selection between ent1 and ent2.
38 Make the first_change and last_change optimal for redrawing optimiztion */
39 void NL_SegChanged(struct NLData *data,LONG ent1,LONG ent2)
41 // D(bug("ent1=%ld ent2=%ld\n",ent1,ent2));
42 // D(bug("first_change=%ld last_change=%ld\n",data->first_change,data->last_change));
43 if (ent1 < data->first_change)
44 { if (ent1 >= data->NList_First)
45 { data->first_change = ent1;
46 if (data->last_change < data->first_change)
47 data->last_change = data->first_change;
49 else if (ent2 >= data->NList_First)
50 { data->first_change = data->NList_First;
51 if (data->last_change < data->first_change)
52 data->last_change = data->first_change;
55 if (ent2 > data->last_change)
56 { if (ent2 < data->NList_First+data->NList_Visible)
57 { data->last_change = ent2;
58 if (data->first_change > data->last_change)
59 data->first_change = data->last_change;
61 else if (ent1 < data->NList_First+data->NList_Visible)
62 { data->last_change = data->NList_First+data->NList_Visible;
63 if (data->first_change > data->last_change)
64 data->first_change = data->last_change;
67 // D(bug("NL_SegChanged: first_change=%ld last_change=%ld\n",data->first_change,data->last_change));
70 /* Extent the selection by this entry optimal */
71 void NL_Changed(struct NLData *data,LONG ent)
73 // D(bug("ent=%ld\n",ent));
74 // D(bug("first_change=%ld last_change=%ld\n",data->first_change,data->last_change));
75 if ((ent < data->first_change) && (ent >= data->NList_First))
76 { data->first_change = ent;
77 if (data->last_change < data->first_change)
78 data->last_change = data->first_change;
80 if ((ent > data->last_change) && (ent < data->NList_First+data->NList_Visible))
81 { data->last_change = ent;
82 if (data->first_change > data->last_change)
83 data->first_change = data->last_change;
85 // D(bug("first_change=%ld last_change=%ld\n",data->first_change,data->last_change));
89 void NL_UnSelectAll(struct NLData *data,LONG untouch_ent)
91 LONG ent;
93 DONE_NOTIFY(NTF_Select | NTF_LV_Select);
94 ent = 0;
95 while (ent < data->NList_Entries)
96 { if (ent != untouch_ent)
97 { SELECT2_CHGE(ent,TE_Select_None);
98 data->lastselected = MUIV_NList_Active_Off;
99 data->lastactived = MUIV_NList_Active_Off;
101 ent++;
103 REDRAW;
104 /* do_notifies(NTF_AllChanges|NTF_MinMax);*/
108 void UnSelectCharSel(struct NLData *data,BOOL redraw)
110 if (data->NList_TypeSelect && !data->UpdatingScrollbars)
112 if ((data->sel_pt[data->min_sel].ent >= 0) && (data->sel_pt[data->max_sel].ent >= 0))
113 NL_SegChanged(data,data->sel_pt[data->min_sel].ent,data->sel_pt[data->max_sel].ent);
115 data->sel_pt[1].ent = -1;
116 data->min_sel = 1;
117 data->max_sel = 1;
118 if (redraw)
119 REDRAW;
124 void SelectFirstPoint(struct NLData *data,WORD x,WORD y)
126 struct MUI_NList_TestPos_Result res;
127 LONG e1 = data->sel_pt[data->min_sel].ent;
128 LONG e1x = data->sel_pt[data->min_sel].xoffset;
129 LONG e2 = data->sel_pt[data->max_sel].ent;
130 LONG e2x = data->sel_pt[data->max_sel].xoffset;
131 res.char_number = 0;
132 data->last_sel_click_x = x;
133 data->last_sel_click_y = y;
134 NL_List_TestPos(data,x,y,&res);
135 if ((res.column < 0) || (res.column >= data->numcols))
136 return;
137 if ((e1 >= 0) && (e2 >= 0))
138 { if ((e2 > e1) && (e2x == PMIN))
139 NL_SegChanged(data,e1,e2-1);
140 else
141 NL_SegChanged(data,e1,e2);
143 if ((data->NList_TypeSelect == MUIV_NList_TypeSelect_CLine) && (res.entry >= 0))
145 data->sel_pt[2].column = 0;
146 data->sel_pt[2].xoffset = PMIN;
147 data->sel_pt[2].colpos = -1;
148 data->sel_pt[2].ent = res.entry;
149 data->sel_pt[3] = data->sel_pt[2];
150 data->sel_pt[3].ent = res.entry+1;
151 data->sel_pt[0] = data->sel_pt[2];
152 data->sel_pt[1] = data->sel_pt[3];
153 data->min_sel = 0;
154 data->max_sel = 1;
155 NL_Changed(data,res.entry);
156 data->minx_change_entry = res.entry;
157 data->minx_change_offset = PMIN;
158 data->maxx_change_entry = res.entry+1;
159 data->maxx_change_offset = PMIN;
160 REDRAW;
163 * else if ((data->NList_TypeSelect == MUIV_NList_TypeSelect_CWord) && (res.entry >= 0))
165 * data->sel_pt[0].column = res.column;
166 * data->sel_pt[0].xoffset = res.xoffset;
167 * data->sel_pt[0].colpos = res.char_number;
168 * data->sel_pt[0].ent = res.entry;
169 * data->sel_pt[1] = data->sel_pt[0];
170 * data->min_sel = 0;
171 * data->max_sel = 1;
172 * if (res.char_number == -1)
173 * { if (res.char_xoffset < 0)
174 * { if (res.column == 0)
175 * { data->sel_pt[0].xoffset = PMIN;
176 * data->sel_pt[1].xoffset += data->cols[res.column].c->minx - res.char_xoffset;
177 * data->sel_pt[1].colpos = 0;
179 * else
180 * { data->sel_pt[0].xoffset = data->cols[res.column].c->minx;
181 * data->sel_pt[1].xoffset += data->cols[res.column].c->minx - res.char_xoffset;
182 * data->sel_pt[1].colpos = 0;
185 * else if (res.char_xoffset >= 0)
186 * { if (res.column == data->numcols-1)
187 * { data->sel_pt[0].xoffset += data->cols[res.column].c->minx - res.char_xoffset;
188 * data->sel_pt[0].colpos = -2;
189 * data->sel_pt[1].column = 0;
190 * data->sel_pt[1].xoffset = PMIN;
191 * data->sel_pt[1].colpos = -1;
192 * data->sel_pt[1].ent++;
194 * else
195 * { data->sel_pt[0].xoffset += data->cols[res.column].c->minx - res.char_xoffset;
196 * data->sel_pt[0].colpos = -2;
197 * data->sel_pt[1].xoffset = data->cols[res.column].c->maxx;
198 * data->sel_pt[1].colpos = -2;
202 * else
204 * data->sel_pt[0].xoffset += data->cols[res.column].c->minx - res.char_xoffset;
205 * data->sel_pt[1].xoffset = data->sel_pt[0].xoffset + data->hinc;
206 * if (res.char_xoffset < 0)
207 * data->sel_pt[0].colpos++;
208 * data->sel_pt[1].colpos = data->sel_pt[0].colpos + 1;
210 * data->sel_pt[2] = data->sel_pt[0];
211 * data->sel_pt[3] = data->sel_pt[1];
213 * NL_Changed(data,res.entry);
214 * data->minx_change_entry = data->sel_pt[0].ent;
215 * data->minx_change_offset = data->sel_pt[0].xoffset;
216 * data->maxx_change_entry = data->sel_pt[1].ent;
217 * data->maxx_change_offset = data->sel_pt[1].xoffset;
218 * REDRAW;
221 else
222 { if (res.char_number == -1)
223 { if (res.char_xoffset < 0)
224 { if (res.column == 0)
225 res.xoffset = PMIN;
226 else
227 res.xoffset = data->cols[res.column].c->minx;
229 else if (res.char_xoffset >= 0)
230 { if (res.column == data->numcols-1)
231 { res.xoffset = PMAX; /* when on full right, go full left of next line */
233 // The last releases had these lines while the one above had been commented out.
234 // The problem with these 4 lines is, that the beginning of then next line will
235 // be copied as well if the line is marked until the very right position, which
236 // is definitely wrong (see bugs #1190788 and #1720456). I hope this fix does
237 // not have any other negative side effects.
238 res.column=0;
239 res.xoffset = PMIN;
240 res.char_xoffset = PMIN;
241 res.entry++;
244 else
245 res.xoffset = data->cols[res.column].c->maxx;
246 res.char_number = -2;
249 else
250 { res.xoffset += data->cols[res.column].c->minx - res.char_xoffset;
251 if (res.char_xoffset < 0)
252 res.char_number++;
254 data->sel_pt[0].column = res.column;
255 data->sel_pt[0].xoffset = res.xoffset;
256 data->sel_pt[0].colpos = res.char_number;
257 data->sel_pt[0].ent = res.entry;
258 data->sel_pt[1].ent = -1;
259 data->min_sel = 1;
260 data->max_sel = 1;
261 if ((e1 >= 0) && (e2 >= 0))
262 { data->minx_change_entry = e1;
263 data->minx_change_offset = e1x;
264 data->maxx_change_entry = e2;
265 data->maxx_change_offset = e2x;
267 REDRAW;
272 void SelectSecondPoint(struct NLData *data,WORD x,WORD y)
274 struct MUI_NList_TestPos_Result res;
275 LONG e1 = data->sel_pt[1].ent;
276 LONG e1x = data->sel_pt[1].xoffset;
277 LONG e2,e2x,e3,e3x;
278 data->last_sel_click_x = x;
279 data->last_sel_click_y = y;
280 res.char_number = 0;
281 NL_List_TestPos(data,x,y,&res);
282 if ((res.column < 0) || (res.column >= data->numcols))
283 return;
284 if ((data->NList_TypeSelect == MUIV_NList_TypeSelect_CLine) && (res.entry >= 0))
285 { data->sel_pt[1].column = 0;
286 data->sel_pt[1].xoffset = PMIN;
287 data->sel_pt[1].colpos = -1;
288 data->min_sel = 0;
289 data->max_sel = 1;
290 if (res.entry > data->sel_pt[2].ent)
291 { e3 = 2;
292 data->sel_pt[1].ent = res.entry+1;
294 else if (res.entry < data->sel_pt[2].ent)
295 { e3 = 3;
296 data->sel_pt[1].ent = res.entry;
297 data->min_sel = 1;
298 data->max_sel = 0;
300 else
301 { e3 = 2;
302 data->sel_pt[1] = data->sel_pt[3];
304 data->sel_pt[0] = data->sel_pt[e3];
305 e2 = data->sel_pt[1].ent;
306 if (e1 != e2)
307 { if (e1 > e2) { e3 = e1; e1 = e2; e2 = e3; }
308 data->minx_change_entry = e1;
309 data->minx_change_offset = PMIN;
310 data->maxx_change_entry = e2;
311 data->maxx_change_offset = PMIN;
312 if (e2 > e1)
313 e2--;
314 NL_SegChanged(data,e1,e2);
315 REDRAW;
319 * else if ((data->NList_TypeSelect == MUIV_NList_TypeSelect_CWord) && (res.entry >= 0))
321 * LONG e0 = data->sel_pt[0].ent;
322 * LONG e0x = data->sel_pt[0].xoffset;
323 * data->sel_pt[0].column = res.column;
324 * data->sel_pt[0].xoffset = res.xoffset;
325 * data->sel_pt[0].colpos = res.char_number;
326 * data->sel_pt[0].ent = res.entry;
327 * data->sel_pt[1] = data->sel_pt[0];
328 * data->min_sel = 0;
329 * data->max_sel = 1;
330 * if (res.char_number == -1)
331 * { if (res.char_xoffset < 0)
332 * { if (res.column == 0)
333 * { data->sel_pt[0].xoffset = PMIN;
334 * data->sel_pt[1].xoffset += data->cols[res.column].c->minx - res.char_xoffset;
335 * data->sel_pt[1].colpos = 0;
337 * else
338 * { data->sel_pt[0].xoffset = data->cols[res.column].c->minx;
339 * data->sel_pt[1].xoffset += data->cols[res.column].c->minx - res.char_xoffset;
340 * data->sel_pt[1].colpos = 0;
343 * else if (res.char_xoffset >= 0)
344 * { if (res.column == data->numcols-1)
345 * { data->sel_pt[0].xoffset += data->cols[res.column].c->minx - res.char_xoffset;
346 * data->sel_pt[0].colpos = -2;
347 * data->sel_pt[1].column = 0;
348 * data->sel_pt[1].xoffset = PMIN;
349 * data->sel_pt[1].colpos = -1;
350 * data->sel_pt[1].ent++;
352 * else
353 * { data->sel_pt[0].xoffset += data->cols[res.column].c->minx - res.char_xoffset;
354 * data->sel_pt[0].colpos = -2;
355 * data->sel_pt[1].xoffset = data->cols[res.column].c->maxx;
356 * data->sel_pt[1].colpos = -2;
360 * else
362 * data->sel_pt[0].xoffset += data->cols[res.column].c->minx - res.char_xoffset;
363 * data->sel_pt[1].xoffset = data->sel_pt[0].xoffset + data->hinc;
364 * if (res.char_xoffset < 0)
365 * data->sel_pt[0].colpos++;
366 * data->sel_pt[1].colpos = data->sel_pt[0].colpos + 1;
369 * if ( (data->sel_pt[0].ent > data->sel_pt[2].ent) ||
370 * ( (data->sel_pt[0].ent == data->sel_pt[2].ent) &&
371 * ( (data->sel_pt[0].column > data->sel_pt[2].column) ||
372 * ( (data->sel_pt[0].column == data->sel_pt[2].column) &&
373 * (data->sel_pt[0].xoffset > data->sel_pt[2].xoffset)
378 * { data->sel_pt[0] = data->sel_pt[2];
379 * if ((e1 < data->sel_pt[1].ent) || (e1x < data->sel_pt[1].xoffset))
380 * { data->minx_change_entry = e1;
381 * data->minx_change_offset = e1x;
382 * data->maxx_change_entry = data->sel_pt[1].ent;
383 * data->maxx_change_offset = data->sel_pt[1].xoffset;
384 * NL_SegChanged(data,e1,data->sel_pt[1].ent);
386 * else
387 * { data->minx_change_entry = data->sel_pt[1].ent;
388 * data->minx_change_offset = data->sel_pt[1].xoffset;
389 * data->maxx_change_entry = e1;
390 * data->maxx_change_offset = e1x;
391 * NL_SegChanged(data,data->sel_pt[1].ent,e1);
394 * else if ( (data->sel_pt[1].ent < data->sel_pt[3].ent) ||
395 * ( (data->sel_pt[1].ent == data->sel_pt[3].ent) &&
396 * ( (data->sel_pt[1].column < data->sel_pt[3].column) ||
397 * ( (data->sel_pt[1].column == data->sel_pt[3].column) &&
398 * (data->sel_pt[1].xoffset < data->sel_pt[3].xoffset)
403 * { data->sel_pt[1] = data->sel_pt[3];
404 * if ((e0 < data->sel_pt[0].ent) || (e0x < data->sel_pt[0].xoffset))
405 * { data->minx_change_entry = e0;
406 * data->minx_change_offset = e0x;
407 * data->maxx_change_entry = data->sel_pt[0].ent;
408 * data->maxx_change_offset = data->sel_pt[0].xoffset;
409 * NL_SegChanged(data,e0,data->sel_pt[0].ent);
411 * else
412 * { data->minx_change_entry = data->sel_pt[0].ent;
413 * data->minx_change_offset = data->sel_pt[0].xoffset;
414 * data->maxx_change_entry = e0;
415 * data->maxx_change_offset = e0x;
416 * NL_SegChanged(data,data->sel_pt[0].ent,e0);
419 * REDRAW;
422 else if (res.entry >= 0)
424 if (res.char_number == -1)
425 { if (res.char_xoffset < 0)
426 { if (res.column == 0)
427 res.xoffset = PMIN;
428 else
429 res.xoffset = data->cols[res.column].c->minx;
431 else if (res.char_xoffset >= 0)
433 if (res.column == data->numcols-1)
435 res.xoffset = PMAX; /* when on full right, go full left of next line */
437 // before this part was active while the assignment above was inactive
438 // see bugs #1190788 and #1720456
439 res.column=0;
440 res.xoffset = PMIN;
441 res.char_xoffset = PMIN;
442 res.entry++;
445 else
446 res.xoffset = data->cols[res.column].c->maxx;
447 res.char_number = -2;
450 else
452 res.xoffset += data->cols[res.column].c->minx - res.char_xoffset;
453 if (res.char_xoffset < 0)
454 res.char_number++;
456 if ((data->sel_pt[1].ent != res.entry) || (data->sel_pt[1].column != res.column) || (data->sel_pt[1].xoffset != res.xoffset))
458 data->sel_pt[1].column = res.column;
459 data->sel_pt[1].xoffset = res.xoffset;
460 data->sel_pt[1].colpos = res.char_number;
461 data->sel_pt[1].ent = res.entry;
462 data->min_sel = 0;
463 data->max_sel = 1;
464 if ( (data->sel_pt[0].ent > data->sel_pt[1].ent) ||
465 ( (data->sel_pt[0].ent == data->sel_pt[1].ent) &&
466 ( (data->sel_pt[0].column > data->sel_pt[1].column) ||
467 ( (data->sel_pt[0].column == data->sel_pt[1].column) &&
468 (data->sel_pt[0].xoffset > data->sel_pt[1].xoffset)
473 { data->min_sel = 1;
474 data->max_sel = 0;
476 else if ((data->sel_pt[0].ent == data->sel_pt[1].ent) &&
477 (data->sel_pt[0].column == data->sel_pt[1].column) &&
478 (data->sel_pt[0].xoffset == data->sel_pt[1].xoffset))
479 { data->min_sel = 1;
480 data->max_sel = 1;
481 data->sel_pt[1].ent = -1;
484 e2 = data->sel_pt[1].ent;
485 e2x = data->sel_pt[1].xoffset;
486 if (e1 < 0)
487 { e1 = data->sel_pt[0].ent;
488 e1x = data->sel_pt[0].xoffset;
490 else if (e2 < 0)
491 { e2 = data->sel_pt[0].ent;
492 e2x = data->sel_pt[0].xoffset;
494 if ((e2 < e1) || ((e2 == e1) && (e2x < e1x)))
495 { e3 = e2; e2 = e1; e1 = e3; e3x = e2x; e2x = e1x; e1x = e3x; }
496 if ((e1 >= 0) && (e2 >= 0))
497 { NL_SegChanged(data,e1,e2);
498 data->minx_change_entry = e1;
499 data->minx_change_offset = e1x;
500 data->maxx_change_entry = e2;
501 data->maxx_change_offset = e2x;
503 REDRAW;
509 BOOL NL_List_First(struct NLData *data,LONG lf,struct TagItem *tag)
511 struct TagItem ltag;
512 BOOL scrolled = FALSE;
514 ENTER();
516 if (!tag)
517 tag = &ltag;
519 if((data->NList_Entries > 0) && (lf != data->NList_First))
521 switch (lf)
523 case MUIV_NList_First_Top:
524 lf = 0;
525 break;
527 case MUIV_NList_First_Bottom:
529 lf = data->NList_Entries - data->NList_Visible;
530 if (lf < 0)
531 lf = 0;
533 break;
535 case MUIV_NList_First_Up:
537 lf = data->NList_First - 1;
538 if (lf < 0)
539 lf = 0;
541 break;
543 case MUIV_NList_First_Down:
545 lf = data->NList_First + 1;
546 if (lf + data->NList_Visible >= data->NList_Entries)
547 lf = data->NList_Entries - data->NList_Visible;
548 if (lf < 0)
549 lf = 0;
551 break;
553 case MUIV_NList_First_PageUp:
555 lf = data->NList_First - data->NList_Visible + 1;
556 if (lf < 0)
557 lf = 0;
559 break;
561 case MUIV_NList_First_PageDown:
563 lf = data->NList_First + data->NList_Visible - 1;
564 if (lf + data->NList_Visible >= data->NList_Entries)
565 lf = data->NList_Entries - data->NList_Visible;
566 if (lf < 0)
567 lf = 0;
569 break;
571 case MUIV_NList_First_Up2:
573 lf = data->NList_First - 2;
574 if (lf < 0)
575 lf = 0;
577 break;
579 case MUIV_NList_First_Down2:
581 lf = data->NList_First + 2;
582 if (lf + data->NList_Visible >= data->NList_Entries)
583 lf = data->NList_Entries - data->NList_Visible;
584 if (lf < 0)
585 lf = 0;
587 break;
589 case MUIV_NList_First_Up4:
591 lf = data->NList_First - 4;
592 if (lf < 0)
593 lf = 0;
595 break;
597 case MUIV_NList_First_Down4 :
599 lf = data->NList_First + 4;
600 if (lf + data->NList_Visible >= data->NList_Entries)
601 lf = data->NList_Entries - data->NList_Visible;
602 if (lf < 0)
603 lf = 0;
605 break;
608 if ((lf >= 0) && (lf < data->NList_Entries))
610 if (data->NList_First != lf)
612 DO_NOTIFY(NTF_First);
613 scrolled = TRUE;
616 data->NList_First = lf;
617 REDRAW;
618 /* do_notifies(NTF_AllChanges|NTF_MinMax);*/
619 tag->ti_Data = lf;
621 else
622 tag->ti_Tag = TAG_IGNORE;
624 else
625 tag->ti_Tag = TAG_IGNORE;
627 RETURN(scrolled);
628 return scrolled;
632 BOOL NL_List_Active(struct NLData *data, LONG la, struct TagItem *tag, LONG newactsel, LONG acceptsame, ULONG flags)
634 struct TagItem ltag;
635 struct TagItem *tag2 = tag;
636 LONG ent;
637 BOOL changed = FALSE;
639 ENTER();
641 //D(DBF_STARTUP, "NL_List_Active: 0x%lx la=%ld newactsel=%ld acceptsame=%ld data->pad1=%ld",obj,la,newactsel,acceptsame,data->pad1);
643 if (data->NList_TypeSelect || !data->NList_Input)
645 if (tag2)
646 tag->ti_Data = MUIV_NList_Active_Off;
648 if((la == MUIV_NList_Active_Off) || (data->NList_Entries <= 0))
650 data->pad1 = MUIV_NList_Active_Off;
652 RETURN(TRUE);
653 return TRUE;
655 else if (la < 0)
657 if(tag2 == NULL)
659 changed = NL_List_First(data,la,tag);
661 RETURN(changed);
662 return changed;
664 else if (data->NList_Entries > 0)
666 switch (la)
668 case MUIV_NList_Active_Top :
669 case MUIV_NList_Active_UntilTop :
670 la = 0;
671 break;
672 case MUIV_NList_Active_Bottom :
673 case MUIV_NList_Active_UntilBottom :
674 la = data->pad1 - 1;
675 break;
676 case MUIV_NList_Active_Up :
677 if (data->NList_Active != MUIV_NList_Active_Off)
678 la = data->pad1 - 1;
679 else
680 la = data->NList_First - 1 + data->NList_Visible;
681 break;
682 case MUIV_NList_Active_Down :
683 if (data->pad1 != MUIV_NList_Active_Off)
684 la = data->pad1 + 1;
685 else
686 la = data->NList_First;
687 break;
688 case MUIV_NList_Active_PageUp :
689 case MUIV_NList_Active_UntilPageUp :
690 if (data->pad1 == data->NList_First)
691 la = data->pad1 + 1 - data->NList_Visible;
692 else
693 la = data->NList_First;
694 break;
695 case MUIV_NList_Active_PageDown :
696 case MUIV_NList_Active_UntilPageDown :
697 if (data->pad1 == data->NList_First - 1 + data->NList_Visible)
698 la = data->pad1 - 1 + data->NList_Visible;
699 else
700 la = data->NList_First - 1 + data->NList_Visible;
701 break;
706 if (la < 0)
707 la = 0;
708 else if (la >= data->NList_Entries)
709 la = data->NList_Entries - 1;
711 data->pad1 = la;
713 // if the SetActive_Jump_Center flag is active we make sure
714 // the new active entry will be centered
715 if(isFlagSet(flags, MUIV_NList_SetActive_Jump_Center))
716 la = MUIV_NList_Jump_Active_Center;
718 // make sure the entry is visible
719 if(NL_List_Jump(data, la) == TRUE)
721 DO_NOTIFY(NTF_First);
722 REDRAW;
724 changed = TRUE;
727 RETURN(changed);
728 return changed;
731 if (!tag)
732 tag = &ltag;
734 if(data->NList_Entries > 0)
736 ent = -2;
738 switch (la)
740 case MUIV_NList_Active_Top :
741 la = 0;
742 break;
743 case MUIV_NList_Active_Bottom :
744 la = data->NList_Entries - 1;
745 break;
746 case MUIV_NList_Active_Up :
747 if (data->NList_Active != MUIV_NList_Active_Off)
748 la = data->NList_Active - 1;
749 else
750 la = data->NList_First - 1 + data->NList_Visible;
751 if (la < 0)
752 la = 0;
753 if (la >= data->NList_Entries)
754 la = data->NList_Entries - 1;
755 break;
756 case MUIV_NList_Active_Down :
757 if (data->NList_Active != MUIV_NList_Active_Off)
758 la = data->NList_Active + 1;
759 else
760 la = data->NList_First;
761 if (la >= data->NList_Entries)
762 la = data->NList_Entries - 1;
763 break;
764 case MUIV_NList_Active_PageUp :
765 if (data->NList_Active == data->NList_First)
766 la = data->NList_Active + 1 - data->NList_Visible;
767 else
768 la = data->NList_First;
769 if (la < 0)
770 la = 0;
771 break;
772 case MUIV_NList_Active_PageDown :
773 if (data->NList_Active == data->NList_First - 1 + data->NList_Visible)
774 la = data->NList_Active - 1 + data->NList_Visible;
775 else
776 la = data->NList_First - 1 + data->NList_Visible;
777 if (la >= data->NList_Entries)
778 la = data->NList_Entries - 1;
779 break;
780 case MUIV_NList_Active_UntilPageUp :
781 if (data->NList_Active == data->NList_First)
782 la = data->NList_Active + 1 - data->NList_Visible;
783 else
784 la = data->NList_First;
785 if (la < 0)
786 la = 0;
787 ent = data->NList_Active;
788 break;
789 case MUIV_NList_Active_UntilPageDown :
790 if (data->NList_Active == data->NList_First - 1 + data->NList_Visible)
791 la = data->NList_Active - 1 + data->NList_Visible;
792 else
793 la = data->NList_First - 1 + data->NList_Visible;
794 if (la >= data->NList_Entries)
795 la = data->NList_Entries - 1;
796 ent = data->NList_Active;
797 break;
798 case MUIV_NList_Active_UntilTop :
799 la = 0;
800 ent = data->NList_Active;
801 break;
802 case MUIV_NList_Active_UntilBottom :
803 la = data->NList_Entries - 1;
804 ent = data->NList_Active;
805 break;
806 case MUIV_NList_Active_Off :
807 la = MUIV_NList_Active_Off;
808 break;
811 if ((la != data->NList_Active) || (acceptsame &&
812 !((newactsel == MUIV_NList_Select_On) && (la >= 0) && (la < data->NList_Entries) &&
813 (data->EntriesArray[la]->Select != TE_Select_None))))
815 if ((la >= 0) && (la < data->NList_Entries))
817 if ((data->NList_MultiSelect == MUIV_NList_MultiSelect_None) && (la != data->NList_Active))
819 DO_NOTIFY(NTF_Select | NTF_LV_Select);
821 if ((data->NList_Active >= 0) && (data->NList_Active < data->NList_Entries))
822 SELECT2(data->NList_Active,TE_Select_None);
825 if ((data->NList_MultiSelect != MUIV_NList_MultiSelect_None) && (newactsel == MUIV_NList_Select_List))
827 DO_NOTIFY(NTF_Select | NTF_LV_Select);
828 if((data->NList_Active >= 0) && (data->NList_Active < data->NList_Entries))
830 if (data->EntriesArray[data->NList_Active]->Select != TE_Select_None)
831 SELECT2(data->NList_Active,TE_Select_None);
832 else
833 SELECT(data->NList_Active,TE_Select_Line);
835 data->lastselected = data->NList_Active;
836 data->lastactived = data->NList_Active;
840 if((ent < -1) || (data->multiselect == MUIV_NList_MultiSelect_None))
841 ent = la;
843 if (ent < 0)
844 ent = 0;
845 else if (ent >= data->NList_Entries)
846 ent = data->NList_Entries - 1;
848 set_Active(la);
849 changed = TRUE;
851 if (ent < la)
852 NL_SegChanged(data,ent,la-1);
853 else if (ent > la)
854 NL_SegChanged(data,la+1,ent);
858 if (ent < la)
859 ent++;
860 else if (ent > la)
861 ent--;
862 switch (newactsel)
863 { case MUIV_NList_Select_Off :
864 SELECT2(ent,TE_Select_None);
865 data->lastselected = ent;
866 data->lastactived = ent;
867 break;
868 case MUIV_NList_Select_On :
869 SELECT(ent,TE_Select_Line);
870 data->lastselected = ent;
871 data->lastactived = ent;
872 break;
873 case MUIV_NList_Select_Toggle :
874 if (data->EntriesArray[ent]->Select != TE_Select_None)
875 { SELECT2(ent,TE_Select_None);
877 else
878 { SELECT(ent,TE_Select_Line);
880 data->lastselected = ent;
881 data->lastactived = ent;
882 break;
884 case MUIV_NList_Select_List :
885 if (data->NList_MultiSelect != MUIV_NList_MultiSelect_None)
886 { ent = la;
887 if (data->EntriesArray[ent]->Select != TE_Select_None)
888 { SELECT2(ent,TE_Select_None);
890 else
891 { SELECT(ent,TE_Select_Line);
893 data->lastselected = ent;
894 data->lastactived = ent;
895 break;
898 default:
899 if (data->NList_MultiSelect == MUIV_NList_MultiSelect_None)
900 { SELECT(ent,TE_Select_Line);
901 data->lastselected = ent;
902 data->lastactived = ent;
904 break;
906 } while (ent != la);
908 tag->ti_Data = la;
909 data->do_draw_active = TRUE;
911 // if the SetActive_Jump_Center flag is active we make sure
912 // the new active entry will be centered
913 if(isFlagSet(flags, MUIV_NList_SetActive_Jump_Center))
914 la = MUIV_NList_Jump_Active_Center;
916 // make sure the entry is visible
917 if(NL_List_Jump(data, la) == TRUE)
919 DO_NOTIFY(NTF_First);
922 // redraw at all means
923 REDRAW;
925 else if (la == MUIV_NList_Active_Off)
927 if ((data->NList_MultiSelect == MUIV_NList_MultiSelect_None) && (la != data->NList_Active))
929 DO_NOTIFY(NTF_Select | NTF_LV_Select);
930 if ((data->NList_Active >= 0) && (data->NList_Active < data->NList_Entries))
931 SELECT2(data->NList_Active,TE_Select_None);
934 set_Active(MUIV_NList_Active_Off);
935 tag->ti_Data = MUIV_NList_Active_Off;
936 REDRAW;
938 changed = TRUE;
940 else
941 tag->ti_Tag = TAG_IGNORE;
943 else
944 tag->ti_Tag = TAG_IGNORE;
946 else
948 set_Active(MUIV_NList_Active_Off);
949 tag->ti_Data = MUIV_NList_Active_Off;
950 if (la >= 0)
951 tag->ti_Tag = TAG_IGNORE;
953 /* do_notifies(NTF_AllChanges|NTF_MinMax);*/
955 RETURN(changed);
956 return changed;
960 BOOL NL_List_Horiz_First(struct NLData *data,LONG hf,struct TagItem *tag)
962 BOOL scrolled = FALSE;
964 ENTER();
966 if(data->NList_Horiz_First != hf)
968 struct TagItem ltag;
969 BOOL tagnul = FALSE;
971 if(!tag)
973 tag = &ltag;
974 tagnul = TRUE;
977 switch (hf)
979 case MUIV_NList_Horiz_First_Start :
980 hf = 0;
981 break;
983 case MUIV_NList_Horiz_First_End :
985 hf = data->NList_Horiz_Entries - data->NList_Horiz_Visible;
986 if(hf < 0)
987 hf = 0;
989 break;
991 case MUIV_NList_Horiz_First_Left :
993 hf = data->NList_Horiz_First - _font(data->this)->tf_XSize;
994 if (hf < 0)
995 hf = 0;
997 break;
999 case MUIV_NList_Horiz_First_Right :
1001 hf = data->NList_Horiz_First + _font(data->this)->tf_XSize;
1002 if(hf > data->NList_Horiz_Entries - data->NList_Horiz_Visible)
1003 hf = data->NList_Horiz_Entries - data->NList_Horiz_Visible;
1005 break;
1007 case MUIV_NList_Horiz_First_PageLeft :
1009 hf = data->NList_Horiz_First - data->NList_Horiz_Visible / 2;
1010 if (hf < 0)
1011 hf = 0;
1013 break;
1015 case MUIV_NList_Horiz_First_PageRight :
1017 hf = data->NList_Horiz_First + data->NList_Horiz_Visible / 2;
1018 if (hf > data->NList_Horiz_Entries - data->NList_Horiz_Visible)
1019 hf = data->NList_Horiz_Entries - data->NList_Horiz_Visible;
1021 break;
1023 case MUIV_NList_Horiz_First_Left2 :
1025 hf = data->NList_Horiz_First - _font(data->this)->tf_XSize*2;
1026 if (hf < 0)
1027 hf = 0;
1029 break;
1031 case MUIV_NList_Horiz_First_Right2 :
1033 hf = data->NList_Horiz_First + _font(data->this)->tf_XSize*2;
1034 if (hf > data->NList_Horiz_Entries - data->NList_Horiz_Visible)
1035 hf = data->NList_Horiz_Entries - data->NList_Horiz_Visible;
1037 break;
1039 case MUIV_NList_Horiz_First_Left4 :
1041 hf = data->NList_Horiz_First - _font(data->this)->tf_XSize*4;
1042 if (hf < 0)
1043 hf = 0;
1045 break;
1047 case MUIV_NList_Horiz_First_Right4 :
1049 hf = data->NList_Horiz_First + _font(data->this)->tf_XSize*4;
1050 if (hf > data->NList_Horiz_Entries - data->NList_Horiz_Visible)
1051 hf = data->NList_Horiz_Entries - data->NList_Horiz_Visible;
1053 break;
1056 if(data->NList_Horiz_First != hf)
1058 if((hf >= 0) && (hf < data->NList_Horiz_Entries))
1060 if(hf > data->NList_Horiz_Entries - data->NList_Horiz_Visible)
1061 hf = data->NList_Horiz_Entries - data->NList_Horiz_Visible;
1063 data->NList_Horiz_First = hf;
1064 REDRAW;
1066 tag->ti_Data = hf;
1067 if (tagnul /*&& data->Notify_HSB*/)
1068 notdoset(data->this,MUIA_NList_Horiz_First,hf);
1070 scrolled = TRUE;
1072 else
1073 tag->ti_Tag = TAG_IGNORE;
1075 else
1076 tag->ti_Tag = TAG_IGNORE;
1079 RETURN(scrolled);
1080 return scrolled;
1084 ULONG NL_List_SelectChar(struct NLData *data,LONG pos,LONG seltype,LONG *state)
1086 LONG ent,ent2;
1088 if (seltype == MUIV_NList_Select_None)
1089 return (TRUE);
1091 if (data->NList_TypeSelect)
1093 if (seltype == MUIV_NList_Select_Ask)
1094 { LONG first = data->sel_pt[data->min_sel].ent;
1095 LONG last = data->sel_pt[data->max_sel].ent;
1096 if ((data->sel_pt[data->max_sel].column == 0) && (data->sel_pt[data->max_sel].xoffset == PMIN))
1097 last--;
1098 if (state)
1099 *state = (LONG) (last - first + 1);
1101 else if (seltype == MUIV_NList_Select_Off)
1102 UnSelectCharSel(data,TRUE);
1103 else if ((seltype == MUIV_NList_Select_On) && (data->NList_Entries > 0))
1105 UnSelectCharSel(data,FALSE);
1106 if (pos == MUIV_NList_Select_All)
1107 { ent = 0;
1108 ent2 = data->NList_Entries;
1110 else
1111 { if (pos == MUIV_NList_Select_Active)
1112 ent = data->NList_Active;
1113 else
1114 ent = pos;
1115 if (ent < 0)
1116 ent = 0;
1117 else if (ent >= data->NList_Entries)
1118 ent = data->NList_Entries - 1;
1119 ent2 = ent + 1;
1121 data->sel_pt[0].column = 0;
1122 data->sel_pt[0].xoffset = PMIN;
1123 data->sel_pt[0].colpos = -1;
1124 data->sel_pt[0].ent = ent;
1125 data->sel_pt[1].column = 0;
1126 data->sel_pt[1].xoffset = PMIN;
1127 data->sel_pt[1].colpos = -1;
1128 data->sel_pt[1].ent = ent2;
1129 data->min_sel = 0;
1130 data->max_sel = 1;
1131 NL_SegChanged(data,ent,ent2);
1132 data->minx_change_entry = ent;
1133 data->minx_change_offset = PMIN;
1134 data->maxx_change_entry = ent2;
1135 data->maxx_change_offset = PMIN;
1136 REDRAW;
1138 return (TRUE);
1141 return(FALSE);
1145 ULONG NL_List_Select(struct NLData *data,LONG pos,LONG pos2,LONG seltype,LONG *state)
1147 LONG ent,ent2,ent3;
1148 /* DONE_NOTIFY(NTF_Select | NTF_LV_Select);*/
1149 if ((seltype == MUIV_NList_Select_None) || data->NList_TypeSelect || !data->NList_Input)
1150 return (TRUE);
1151 if ((pos == MUIV_NList_Select_All) && data->multiselect && data->NList_Input)
1152 { LONG num = 0;
1153 ent = 0;
1154 switch (seltype)
1155 { case MUIV_NList_Select_Off :
1156 while (ent < data->NList_Entries)
1157 { if ((data->NList_List_Select == MUIV_NList_Select_List) && (ent == data->NList_Active))
1158 { SELECT2_CHGE(ent,TE_Select_Line);
1159 num++;
1161 else
1162 { SELECT2_CHGE(ent,TE_Select_None);
1164 ent++;
1166 if (state)
1167 *state = num;
1168 REDRAW;
1169 break;
1170 case MUIV_NList_Select_On :
1171 while (ent < data->NList_Entries)
1172 { SELECT_CHGE(ent,TE_Select_Line);
1173 num++;
1174 ent++;
1176 if (state)
1177 *state = num;
1178 REDRAW;
1179 break;
1180 case MUIV_NList_Select_Toggle :
1181 while (ent < data->NList_Entries)
1182 { if ((data->NList_List_Select == MUIV_NList_Select_List) && (ent == data->NList_Active))
1183 { SELECT2_CHGE(ent,TE_Select_Line);
1184 num++;
1186 else if (data->EntriesArray[ent]->Select != TE_Select_None)
1187 { SELECT2_CHGE(ent,TE_Select_None);
1189 else
1190 { SELECT_CHGE(ent,TE_Select_Line);
1191 num++;
1193 ent++;
1195 if (state)
1196 *state = num;
1197 REDRAW;
1198 break;
1199 default : /* MUIV_NList_Select_Ask */
1200 while (ent < data->NList_Entries)
1201 { if (data->EntriesArray[ent]->Select != TE_Select_None)
1202 num++;
1203 ent++;
1205 if (state)
1206 *state = num;
1207 break;
1209 data->lastselected = MUIV_NList_Active_Off;
1210 /* do_notifies(NTF_AllChanges|NTF_MinMax);*/
1211 return (TRUE);
1213 else if ((data->multiselect || (seltype == MUIV_NList_Select_Ask)) && data->NList_Input)
1214 { if (pos == MUIV_NList_Select_Active)
1215 ent = data->NList_Active;
1216 else
1217 ent = pos;
1218 if ((ent < 0) || (ent >= data->NList_Entries))
1219 return (FALSE);
1221 if (seltype != MUIV_NList_Select_Ask)
1222 data->lastselected = ent;
1224 * if ((data->NList_List_Select == MUIV_NList_Select_List) && (ent == data->NList_Active) && (seltype == MUIV_NList_Select_Ask))
1225 * seltype = MUIV_NList_Select_On;
1227 ent2 = pos2;
1228 if ((ent2 < 0) || (ent2 >= data->NList_Entries))
1229 ent2 = ent;
1230 if (ent2 < ent)
1231 { ent3 = ent;
1232 ent = ent2 + 1;
1233 ent2 = ent3 + 1;
1235 else if (ent2 == ent)
1236 ent2++;
1237 while (ent < ent2)
1238 { switch (seltype)
1239 { case MUIV_NList_Select_Off :
1240 if (state) *state = MUIV_NList_Select_Off;
1241 SELECT2_CHGE(ent,TE_Select_None);
1242 break;
1243 case MUIV_NList_Select_On :
1244 if (state) *state = MUIV_NList_Select_On;
1245 SELECT_CHGE(ent,TE_Select_Line);
1246 break;
1247 case MUIV_NList_Select_Toggle :
1248 if (data->EntriesArray[ent]->Select == TE_Select_None)
1249 { if (state) *state = MUIV_NList_Select_On;
1250 SELECT_CHGE(ent,TE_Select_Line);
1252 else
1253 { if (state) *state = MUIV_NList_Select_Off;
1254 SELECT2_CHGE(ent,TE_Select_None);
1256 break;
1257 default : /* MUIV_NList_Select_Ask */
1258 if (data->EntriesArray[ent]->Select != TE_Select_None)
1259 { if (state) *state = MUIV_NList_Select_On; }
1260 else
1261 { if (state) *state = MUIV_NList_Select_Off; }
1262 break;
1264 ent++;
1266 if (ASKED_NOTIFY(NTF_Select | NTF_LV_Select))
1267 { REDRAW;
1269 /* do_notifies(NTF_AllChanges|NTF_MinMax);*/
1270 return (TRUE);
1272 return (FALSE);
1276 ULONG NL_List_TestPos(struct NLData *data,LONG x,LONG y,struct MUI_NList_TestPos_Result *res)
1278 if ((x == MUI_MAXMAX) && (y == MUI_MAXMAX))
1280 x = data->click_x;
1281 y = data->click_y;
1283 else if ((x == MUI_MAXMAX) && (y == 0))
1285 x = data->mouse_x;
1286 y = data->mouse_y;
1288 if (res)
1290 WORD ly = (y - data->vpos);
1291 WORD lyl = ly / data->vinc;
1292 WORD lx = (x - data->hpos);
1293 res->entry = -1;
1294 res->column = -1;
1295 res->flags = 0;
1296 res->xoffset = 0;
1297 res->yoffset = 0;
1298 res->preparse = 0;
1299 if (res->char_number != -2)
1300 res->char_number = -1;
1301 res->char_xoffset = 0;
1302 if ((lx >= 0) && (lx < data->NList_Horiz_Visible) &&
1303 (ly >= 0) && (lyl < data->NList_Visible))
1304 { LONG line = lyl + data->NList_First;
1305 if (!data->NList_Title && (ly < data->vinc/2))
1306 res->flags |= MUI_NLPR_ONTOP;
1307 lx += data->NList_Horiz_First;
1308 if ((line >= 0) && ((line < data->NList_First + data->NList_Visible) || (line < data->NList_Entries)))
1309 { if (data->cols)
1310 { res->column = 1;
1311 while (res->column < data->numcols)
1312 { if (data->cols[res->column].c->minx > lx)
1313 break;
1314 res->column++;
1316 res->column--;
1317 if ((res->column == data->numcols-1) && (lx > data->cols[res->column].c->maxx+data->cols[res->column].c->delta))
1318 res->column = -1;
1319 else
1321 if ((lx > data->cols[res->column].c->maxx-2) && (res->column < data->numcols-1))
1322 res->flags |= MUI_NLPR_BAR;
1323 else if ((res->column == data->numcols-1) && IS_BAR(res->column,data->cols[res->column].c) &&
1324 (lx > data->cols[res->column].c->maxx-4) && (lx <= data->cols[res->column].c->maxx+data->cols[res->column].c->delta))
1325 res->flags |= MUI_NLPR_BAR;
1326 else if ((res->column > 0) && (res->column == data->numcols-1) &&
1327 (data->NList_Horiz_First + data->NList_Horiz_Visible >= data->NList_Horiz_Entries) &&
1328 (x >= data->mright - 2) && (res->flags & MUI_NLPR_ONTOP))
1329 res->flags |= MUI_NLPR_BAR;
1330 lx -= data->cols[res->column].c->minx;
1333 else
1334 res->column = -1;
1336 if ((res->column >= 0) && (line >= 0) && (line < data->NList_Entries))
1337 { res->entry = line;
1338 res->xoffset = lx;
1339 res->yoffset = ly - ((lyl * data->vinc) + (data->vinc / 2));
1340 if (res->char_number != -2)
1341 FindCharInColumn(data,line,res->column,lx,&res->char_xoffset,&res->char_number);
1342 if (res->char_number < -PREPARSE_OFFSET_ENTRY)
1343 { res->char_number += PREPARSE_OFFSET_COL;
1344 res->preparse = 2;
1346 else if (res->char_number < -1)
1347 { res->char_number += PREPARSE_OFFSET_ENTRY;
1348 res->preparse = 1;
1351 else
1352 { if (line < 0)
1353 res->flags |= MUI_NLPR_ABOVE;
1354 if (line >= data->NList_Entries)
1355 res->flags |= MUI_NLPR_BELOW;
1358 else if (data->NList_Title && (lx >= 0) && (lx < data->NList_Horiz_Visible) &&
1359 (ly < 0) && (y >= data->vdtitlepos))
1360 { res->flags = MUI_NLPR_ABOVE | MUI_NLPR_TITLE | MUI_NLPR_ONTOP;
1361 lx += data->NList_Horiz_First;
1362 if (data->cols)
1363 { res->column = 1;
1364 while (res->column < data->numcols)
1365 { if (data->cols[res->column].c->minx > lx)
1366 break;
1367 res->column++;
1369 res->column--;
1370 if ((res->column == data->numcols-1) && (lx > data->cols[res->column].c->maxx+data->cols[res->column].c->delta))
1371 res->column = -1;
1372 else
1374 if ((lx > data->cols[res->column].c->maxx-2) && (res->column < data->numcols-1))
1375 res->flags |= MUI_NLPR_BAR;
1376 else if ((res->column == data->numcols-1) && IS_BAR(res->column,data->cols[res->column].c) &&
1377 (lx > data->cols[res->column].c->maxx-4) && (lx <= data->cols[res->column].c->maxx+data->cols[res->column].c->delta))
1378 res->flags |= MUI_NLPR_BAR;
1379 else if ((res->column > 0) && (res->column == data->numcols-1) &&
1380 (data->NList_Horiz_First + data->NList_Horiz_Visible >= data->NList_Horiz_Entries) &&
1381 (x >= data->mright - 2))
1382 res->flags |= MUI_NLPR_BAR;
1383 lx -= data->cols[res->column].c->minx;
1386 else
1387 res->column = -1;
1388 res->xoffset = lx;
1389 res->yoffset = y - ((data->vdtitlepos + data->vpos) / 2);
1391 else
1392 { if (lx < 0)
1393 res->flags |= MUI_NLPR_LEFT;
1394 else if (lx >= data->NList_Horiz_Visible)
1395 res->flags |= MUI_NLPR_RIGHT;
1396 if (ly < 0)
1397 res->flags |= MUI_NLPR_ABOVE;
1398 else if (lyl >= data->NList_Visible)
1399 res->flags |= MUI_NLPR_BELOW;
1401 return (TRUE);
1403 return (FALSE);
1407 ULONG NL_List_TestPosOld(struct NLData *data,LONG x,LONG y,struct MUI_List_TestPos_Result *res)
1409 if (res)
1411 WORD ly = (y - data->vpos);
1412 WORD lyl = ly / data->vinc;
1413 WORD lx = (x - data->hpos);
1414 res->entry = -1;
1415 res->column = -1;
1416 res->flags = 0;
1417 res->xoffset = 0;
1418 res->yoffset = 0;
1419 if ((lx >= 0) && (lx < data->NList_Horiz_Visible) &&
1420 (ly >= 0) && (lyl < data->NList_Visible))
1421 { LONG line = lyl + data->NList_First;
1422 if ((line >= 0) && (line < data->NList_Entries))
1423 { res->entry = line;
1424 lx += data->NList_Horiz_First;
1425 if (data->cols)
1426 { res->column = 1;
1427 while (res->column < data->numcols)
1428 { if (data->cols[res->column].c->minx > lx)
1429 break;
1430 res->column++;
1432 res->column--;
1433 lx -= data->cols[res->column].c->minx;
1435 else
1436 res->column = 0;
1437 res->xoffset = lx;
1438 res->yoffset = ly - ((lyl * data->vinc) + (data->vinc / 2));
1440 else
1441 { if (line < 0)
1442 res->flags |= MUI_NLPR_ABOVE;
1443 if (line >= data->NList_Entries)
1444 res->flags |= MUI_NLPR_BELOW;
1447 else
1448 { if (lx < 0)
1449 res->flags |= MUI_NLPR_LEFT;
1450 else if (lx >= data->NList_Horiz_Visible)
1451 res->flags |= MUI_NLPR_RIGHT;
1452 if (ly < 0)
1453 res->flags |= MUI_NLPR_ABOVE;
1454 else if (lyl >= data->NList_Visible)
1455 res->flags |= MUI_NLPR_BELOW;
1457 return (TRUE);
1459 return (FALSE);
1463 IPTR mNL_List_GetEntry(struct IClass *cl,Object *obj,struct MUIP_NList_GetEntry *msg)
1465 struct NLData *data = INST_DATA(cl,obj);
1466 LONG ent = msg->pos;
1467 APTR entry = NULL;
1469 if(ent == MUIV_NList_GetEntry_Active)
1470 ent = data->NList_Active;
1472 if(ent >= 0 && ent < data->NList_Entries && isFlagSet(data->EntriesArray[ent]->Wrap, TE_Wrap_TmpLine))
1473 ent -= data->EntriesArray[ent]->dnum;
1475 if(ent >= 0 && ent < data->NList_Entries)
1476 entry = data->EntriesArray[ent]->Entry;
1478 // return the entry in the message if we got a valid pointer to store it
1479 if(msg->entry != NULL)
1480 *msg->entry = entry;
1482 // return the entry as a normal return value in any case
1483 return (IPTR)entry;
1487 IPTR mNL_List_GetEntryInfo(struct IClass *cl,Object *obj,struct MUIP_NList_GetEntryInfo *msg)
1489 struct NLData *data = INST_DATA(cl,obj);
1490 LONG line,ent2,ent = msg->res->pos;
1491 /*DoSuperMethodA(cl,obj,(Msg) msg);*/
1493 if (ent == MUIV_NList_GetEntryInfo_Line)
1494 { ent = line = 0;
1495 ent2 = msg->res->line;
1496 while (ent < data->NList_Entries)
1497 { if (!(data->EntriesArray[ent]->Wrap & TE_Wrap_TmpLine))
1498 { if (line == ent2)
1499 break;
1500 line++;
1502 ent++;
1504 if ((ent >= 0) && (ent < data->NList_Entries))
1505 { msg->res->entry_pos = ent;
1506 msg->res->entry = data->EntriesArray[ent]->Entry;
1507 msg->res->wrapcol = (LONG) data->EntriesArray[ent]->Wrap;
1508 msg->res->charpos = (LONG) data->EntriesArray[ent]->pos;
1509 msg->res->charlen = (LONG) data->EntriesArray[ent]->len;
1511 else
1512 { msg->res->line = -1;
1513 msg->res->entry_pos = -1;
1514 msg->res->entry = NULL;
1515 msg->res->wrapcol = (LONG) 0;
1516 msg->res->charpos = (LONG) 0;
1517 msg->res->charlen = (LONG) 0;
1520 else
1521 { if (ent == MUIV_NList_GetEntry_Active)
1522 ent = data->NList_Active;
1524 if (ent == -3 ) /* Magic number to get the last inserted entry <aphaso> */
1526 if ( data->NList_LastInserted == -1 )
1527 ent = (data->NList_Entries - 1);
1528 else
1529 ent = data->NList_LastInserted;
1532 ent2 = ent;
1533 if ((ent >= 0) && (ent < data->NList_Entries) && (data->EntriesArray[ent]->Wrap & TE_Wrap_TmpLine))
1534 ent -= data->EntriesArray[ent]->dnum;
1535 if ((ent >= 0) && (ent < data->NList_Entries))
1537 if (msg->res->line == -2) /* Magic number to receive the NList entry pointer, not the supplied! <aphaso> */
1539 msg->res->entry_pos = ent;
1540 msg->res->entry = data->EntriesArray[ent];
1542 else
1544 msg->res->entry_pos = ent;
1545 msg->res->entry = data->EntriesArray[ent]->Entry;
1546 msg->res->wrapcol = (LONG) data->EntriesArray[ent2]->Wrap;
1547 msg->res->charpos = (LONG) data->EntriesArray[ent2]->pos;
1548 msg->res->charlen = (LONG) data->EntriesArray[ent2]->len;
1549 ent2 = line = 0;
1550 while (ent2 < ent)
1551 { if (!(data->EntriesArray[ent2]->Wrap & TE_Wrap_TmpLine))
1552 line++;
1553 ent2++;
1555 msg->res->line = line;
1558 else
1559 { msg->res->line = -1;
1560 msg->res->entry_pos = -1;
1561 msg->res->entry = NULL;
1562 msg->res->wrapcol = (LONG) 0;
1563 msg->res->charpos = (LONG) 0;
1564 msg->res->charlen = (LONG) 0;
1567 return (TRUE);
1570 static BOOL NL_List_Jump(struct NLData *data, LONG pos)
1572 BOOL result = FALSE;
1573 ENTER();
1575 switch(pos)
1577 case MUIV_NList_Jump_Top:
1579 pos = 0;
1581 break;
1583 case MUIV_NList_Jump_Bottom:
1585 pos = data->NList_Entries - 1;
1587 break;
1589 case MUIV_NList_Jump_Active:
1591 pos = data->NList_Active;
1593 break;
1595 case MUIV_NList_Jump_Up:
1597 pos = data->NList_First - 1;
1599 break;
1601 case MUIV_NList_Jump_Down:
1603 pos = data->NList_First + data->NList_Visible;
1605 break;
1607 case MUIV_NList_Jump_Active_Center:
1609 // center the item in the visible area
1610 LONG first = data->NList_Active - data->NList_Visible/2;
1612 // make sure that the last item is displayed in the last line
1613 while(first + data->NList_Visible > data->NList_Entries)
1614 first--;
1616 if(first < 0)
1617 first = 0;
1619 data->NList_First = first;
1621 result = TRUE;
1622 pos = -1;
1624 break;
1627 if(pos >= 0 && pos < data->NList_Entries)
1629 // old style jump, just make the requested item visible
1630 if(pos < data->NList_First)
1632 data->NList_First = pos;
1634 result = TRUE;
1636 else if(pos >= data->NList_First + data->NList_Visible)
1638 data->NList_First = pos - data->NList_Visible + 1;
1640 // make sure that the last item is displayed in the last line
1641 while(data->NList_First + data->NList_Visible > data->NList_Entries)
1642 data->NList_First--;
1644 if(data->NList_First < 0)
1645 data->NList_First = 0;
1647 result = TRUE;
1651 RETURN(result);
1652 return result;
1655 IPTR mNL_List_Jump(struct IClass *cl, Object *obj, struct MUIP_NList_Jump *msg)
1657 struct NLData *data = INST_DATA(cl,obj);
1659 ENTER();
1661 if(NL_List_Jump(data, msg->pos) == TRUE)
1663 DO_NOTIFY(NTF_First);
1664 REDRAW;
1667 /* do_notifies(NTF_AllChanges|NTF_MinMax);*/
1669 RETURN(TRUE);
1670 return TRUE;
1673 IPTR mNL_List_SetActive(struct IClass *cl, Object *obj, struct MUIP_NList_SetActive *msg)
1675 BOOL result = FALSE;
1676 struct NLData *data = INST_DATA(cl,obj);
1677 LONG pos = (LONG)(SIPTR)msg->pos;
1679 ENTER();
1681 // check if the user used msg->pos for specifying the entry position (integer)
1682 // or by using the entry address
1683 if(isFlagSet(msg->flags, MUIV_NList_SetActive_Entry))
1685 pos = MUIV_NList_GetPos_Start;
1686 NL_List_GetPos(data, (APTR)msg->pos, &pos);
1689 result = NL_List_Active(data, pos, NULL, data->NList_List_Select, FALSE, msg->flags);
1690 if(result == TRUE)
1692 DO_NOTIFY(NTF_Active | NTF_L_Active);
1695 RETURN(result);
1696 return result;
1699 IPTR mNL_List_Select(struct IClass *cl,Object *obj,struct MUIP_NList_Select *msg)
1701 struct NLData *data = INST_DATA(cl,obj);
1702 /*DoSuperMethodA(cl,obj,(Msg) msg);*/
1703 if (data->NList_TypeSelect)
1704 return (NL_List_SelectChar(data,msg->pos,msg->seltype,msg->state));
1705 else
1706 return (NL_List_Select(data,msg->pos,msg->pos,msg->seltype,msg->state));
1707 return (0);
1711 IPTR mNL_List_TestPos(struct IClass *cl,Object *obj,struct MUIP_NList_TestPos *msg)
1713 struct NLData *data = INST_DATA(cl,obj);
1714 /*DoSuperMethodA(cl,obj,(Msg) msg);*/
1715 return (NL_List_TestPos(data,msg->x,msg->y,msg->res));
1719 IPTR mNL_List_TestPosOld(struct IClass *cl,Object *obj,struct MUIP_List_TestPos *msg)
1721 struct NLData *data = INST_DATA(cl,obj);
1722 /*DoSuperMethodA(cl,obj,(Msg) msg);*/
1723 return (NL_List_TestPosOld(data,msg->x,msg->y,msg->res));
1727 IPTR mNL_List_Redraw(struct IClass *cl,Object *obj,struct MUIP_NList_Redraw *msg)
1729 struct NLData *data = INST_DATA(cl,obj);
1730 long ent;
1732 ENTER();
1734 /*DoSuperMethodA(cl,obj,(Msg) msg);*/
1735 ent = msg->pos;
1736 data->display_ptr = NULL;
1737 data->parse_column = -1;
1739 /*D(bug("%lx|List_Redraw1 pos=%ld Q=%ld D=%ld S=%ld\n",obj,msg->pos,data->NList_Quiet,data->DRAW,data->SETUP));*/
1741 if(data->DRAW > 1)
1743 // defer the redraw process
1744 /*D(bug("%lx|List_Redraw no! %ld %ld (push it)\n",obj,msg->pos,data->DRAW));*/
1745 DoMethod(_app(obj), MUIM_Application_PushMethod, obj, 2, msg->MethodID, msg->pos);
1747 else
1749 if(msg->MethodID == MUIM_List_Redraw && msg->pos == MUIV_NList_Redraw_All)
1750 msg->pos = -6;
1752 switch(msg->pos)
1754 case -6:
1756 if(data->DRAW)
1758 NL_SetColsAdd(data,-2,TRUE);
1759 DoMethod(_app(obj), MUIM_Application_PushMethod, obj, 2, MUIM_NList_Redraw, MUIV_NList_Redraw_All);
1762 break;
1764 case MUIV_NList_Redraw_All:
1766 // redraw all entries
1767 if(data->DRAW)
1769 NL_SetColsAdd(data,-2,TRUE);
1770 for(ent = 0; ent < data->NList_Entries; ent++)
1771 data->EntriesArray[ent]->PixLen = -1;
1773 data->Title_PixLen = -1;
1774 data->do_draw_title = TRUE;
1775 data->do_parse = TRUE;
1776 data->do_setcols = TRUE;
1777 data->do_updatesb = TRUE;
1778 data->force_wwrap = TRUE;
1779 REDRAW_ALL;
1781 break;
1783 case MUIV_NList_Redraw_VisibleCols:
1785 // redraw visible columns only
1786 if(data->DRAW)
1787 NL_SetColsAdd(data, -3, TRUE);
1789 break;
1791 case MUIV_NList_Redraw_Selected:
1793 // redraw selected entries only
1794 if(data->DRAW)
1796 BOOL doDraw = FALSE;
1798 if(data->NList_TypeSelect == MUIV_NList_TypeSelect_Line)
1800 for(ent=0; ent < data->NList_Entries; ent++)
1802 // mark the selected entries as "to be redrawn"
1803 if(data->EntriesArray[ent]->Select != TE_Select_None)
1805 NL_SetColsAdd(data, ent, TRUE);
1806 data->EntriesArray[ent]->PixLen = -1;
1807 NL_Changed(data, ent);
1808 doDraw = TRUE;
1812 else
1814 NL_SegChanged(data,data->sel_pt[data->min_sel].ent,data->sel_pt[data->max_sel].ent);
1815 doDraw = TRUE;
1818 if(doDraw == TRUE)
1820 // at least one entry must be redrawn
1821 data->display_ptr = NULL;
1822 data->do_draw = TRUE;
1823 REDRAW;
1827 break;
1829 case MUIV_NList_Redraw_Title:
1831 // redraw title only
1832 if(data->DRAW)
1834 NL_SetColsAdd(data, -1, TRUE);
1835 data->Title_PixLen = -1;
1837 data->do_draw_title = TRUE;
1838 data->do_setcols = TRUE;
1839 REDRAW;
1841 break;
1843 case MUIV_NList_Redraw_Active:
1845 // redraw the active entry only
1846 ent = data->NList_Active;
1848 // fall through to the default redraw
1850 default:
1852 // redraw a specific entry
1853 if(ent >= 0 && ent < data->NList_Entries)
1855 if(data->DRAW)
1857 NL_SetColsAdd(data, ent, TRUE);
1858 data->EntriesArray[ent]->PixLen = -1;
1860 NL_Changed(data, ent);
1861 REDRAW;
1864 break;
1867 /*D(bug("%lx|List_Redraw2 pos=%ld Q=%ld D=%ld S=%ld\n",obj,msg->pos,data->NList_Quiet,data->DRAW,data->SETUP));*/
1870 RETURN(TRUE);
1871 return TRUE;
1875 IPTR mNL_List_RedrawEntry(struct IClass *cl,Object *obj,struct MUIP_NList_RedrawEntry *msg)
1877 struct NLData *data = INST_DATA(cl,obj);
1878 LONG ent = 0;
1879 BOOL dodraw = FALSE;
1880 if (!msg->entry)
1881 return (FALSE);
1882 while (ent < data->NList_Entries)
1883 { if (data->EntriesArray[ent]->Entry == msg->entry)
1884 { data->EntriesArray[ent]->PixLen = -1;
1885 NL_Changed(data,ent);
1886 dodraw = TRUE;
1888 ent++;
1890 if (dodraw)
1892 /* sba: This enforces redrawing the entry completly */
1893 data->display_ptr = NULL;
1895 data->do_draw = TRUE;
1896 REDRAW;
1898 return (TRUE);
1900 return (FALSE);
1904 IPTR mNL_List_NextSelected(struct IClass *cl,Object *obj,struct MUIP_NList_NextSelected *msg)
1906 struct NLData *data = INST_DATA(cl,obj);
1907 long ent = *msg->pos;
1908 /*DoSuperMethodA(cl,obj,(Msg) msg);*/
1909 if ((ent == MUIV_NList_NextSelected_Start) || (ent < 0))
1910 ent = 0;
1911 else
1912 ent++;
1913 if (data->NList_TypeSelect)
1915 if (ent < data->sel_pt[data->min_sel].ent)
1916 ent = data->sel_pt[data->min_sel].ent;
1917 else if (ent > data->sel_pt[data->max_sel].ent)
1918 ent = MUIV_NList_NextSelected_End;
1919 else if ((ent == data->sel_pt[data->max_sel].ent) &&
1920 (data->sel_pt[data->max_sel].column == 0) &&
1921 (data->sel_pt[data->max_sel].xoffset == PMIN))
1922 ent = MUIV_NList_NextSelected_End;
1924 else
1925 { while ((ent < data->NList_Entries) && (data->EntriesArray[ent]->Select == TE_Select_None))
1926 ent++;
1927 if (ent >= data->NList_Entries)
1928 ent = MUIV_NList_NextSelected_End;
1930 *msg->pos = ent;
1931 return (TRUE);
1935 IPTR mNL_List_PrevSelected(struct IClass *cl,Object *obj,struct MUIP_NList_PrevSelected *msg)
1937 struct NLData *data = INST_DATA(cl,obj);
1938 long ent = *msg->pos;
1939 /*DoSuperMethodA(cl,obj,(Msg) msg);*/
1940 if ((ent == MUIV_NList_PrevSelected_Start) || (ent < 0) || (ent >= data->NList_Entries))
1941 ent = data->NList_Entries - 1;
1942 else
1943 ent--;
1944 if (data->NList_TypeSelect)
1946 if (ent < data->sel_pt[data->min_sel].ent)
1947 ent = MUIV_NList_PrevSelected_End;
1948 else if ((ent == data->sel_pt[data->max_sel].ent) &&
1949 (data->sel_pt[data->max_sel].column == 0) &&
1950 (data->sel_pt[data->max_sel].xoffset == PMIN))
1951 ent = data->sel_pt[data->max_sel].ent - 1;
1952 else if (ent > data->sel_pt[data->max_sel].ent)
1953 ent = data->sel_pt[data->max_sel].ent;
1955 else
1956 { while ((ent > 0) && (data->EntriesArray[ent]->Select == TE_Select_None))
1957 ent--;
1958 if (ent < 0)
1959 ent = MUIV_NList_PrevSelected_End;
1961 *msg->pos = ent;
1962 return (TRUE);
1966 IPTR mNL_List_GetSelectInfo(struct IClass *cl,Object *obj,struct MUIP_NList_GetSelectInfo *msg)
1968 struct NLData *data = INST_DATA(cl,obj);
1969 LONG ent;
1971 msg->res->start = 1;
1972 msg->res->vstart = -1;
1973 msg->res->end = 1;
1974 msg->res->vend = -1;
1975 msg->res->num = -1;
1976 msg->res->vnum = 0;
1977 msg->res->start_column = -1;
1978 msg->res->end_column = -1;
1979 msg->res->start_pos= -1;
1980 msg->res->end_pos = -1;
1982 if(data->NList_TypeSelect == MUIV_NList_TypeSelect_Line)
1984 ent = 0;
1986 while(ent < data->NList_Entries)
1988 if(data->EntriesArray[ent] != NULL && data->EntriesArray[ent]->Select != TE_Select_None)
1990 if(msg->res->start == -1)
1991 msg->res->start = ent;
1993 msg->res->end = ent;
1994 msg->res->vnum++;
1996 ent++;
1998 msg->res->vstart = msg->res->start;
1999 msg->res->vend = msg->res->end;
2001 else
2003 msg->res->start_column = data->sel_pt[data->min_sel].column;
2004 msg->res->start_pos = data->sel_pt[data->min_sel].colpos;
2005 msg->res->end_column = data->sel_pt[data->max_sel].column;
2006 msg->res->end_pos = data->sel_pt[data->max_sel].colpos;
2007 msg->res->start = data->sel_pt[data->min_sel].ent;
2008 msg->res->end = data->sel_pt[data->max_sel].ent;
2009 msg->res->vstart = msg->res->start;
2010 msg->res->vend = msg->res->end;
2012 if((msg->res->vstart >= 0) && (msg->res->vend >= msg->res->vstart))
2013 msg->res->vnum = msg->res->vend - msg->res->vstart + 1;
2016 if (msg->res->start >= 0 && msg->res->start < data->NList_Entries && data->EntriesArray[msg->res->start] != NULL && data->EntriesArray[msg->res->start]->Wrap)
2018 if (data->EntriesArray[msg->res->start]->Wrap & TE_Wrap_TmpLine)
2019 msg->res->start -= data->EntriesArray[msg->res->start]->dnum;
2022 if (msg->res->end >= 0 && msg->res->end < data->NList_Entries && data->EntriesArray[msg->res->end] != NULL && data->EntriesArray[msg->res->end]->Wrap)
2024 if (data->EntriesArray[msg->res->end]->Wrap & TE_Wrap_TmpLine)
2025 msg->res->end -= data->EntriesArray[msg->res->end]->dnum;
2028 return (TRUE);
2032 IPTR mNL_List_DoMethod(struct IClass *cl,Object *obj,struct MUIP_NList_DoMethod *msg)
2034 struct NLData *data = INST_DATA(cl,obj);
2035 LONG ent = msg->pos;
2036 APTR dest = msg->DestObj;
2038 if((msg->FollowParams >= 1) && (msg->FollowParams < 40) &&
2039 ((msg->pos == MUIV_NList_DoMethod_Active) ||
2040 (msg->pos == MUIV_NList_DoMethod_Selected) ||
2041 (msg->pos == MUIV_NList_DoMethod_All) ||
2042 ((msg->pos >= 0) && (msg->pos < data->NList_Entries))))
2044 LONG *table1 = (LONG *)&msg->FollowParams;
2045 struct
2047 STACKED ULONG MethodID;
2048 SIPTR params[64]; /* MAXIMUM 40 (see docs) <aphaso> */
2049 } newMsg;
2051 if(msg->FollowParams > 63) /* MAXIMUM 40 (see docs) <aphaso> */
2053 msg->FollowParams = 63;
2054 newMsg.params[63] = 0;
2057 if((IPTR)msg->DestObj == (IPTR)MUIV_NList_DoMethod_Self)
2058 dest = (APTR) obj;
2059 else if((IPTR)msg->DestObj == (IPTR)MUIV_NList_DoMethod_App)
2061 if(data->SETUP)
2062 dest = (APTR) _app(obj);
2063 else
2064 dest = NULL;
2066 if(msg->pos == MUIV_NList_DoMethod_Active)
2067 ent = MUIV_NList_DoMethod_Active;
2068 else if(msg->pos == MUIV_NList_DoMethod_Selected)
2070 if(data->NList_TypeSelect)
2071 ent = data->sel_pt[data->min_sel].ent;
2072 else
2074 ent = 0;
2075 while((ent < data->NList_Entries) && (data->EntriesArray[ent]->Select == TE_Select_None))
2076 ent++;
2079 else if(msg->pos == MUIV_NList_DoMethod_All)
2080 ent = 0;
2081 while((ent >= 0) && (ent < data->NList_Entries))
2083 if((IPTR) msg->DestObj == (IPTR)MUIV_NList_DoMethod_Entry)
2084 dest = data->EntriesArray[ent]->Entry;
2085 if(dest)
2087 ULONG num;
2089 newMsg.MethodID = table1[1];
2091 for(num = 1;num < msg->FollowParams;num++)
2093 switch(table1[num+1])
2095 case MUIV_NList_EntryValue:
2096 newMsg.params[num] = (SIPTR)data->EntriesArray[ent]->Entry;
2097 break;
2098 case MUIV_NList_EntryPosValue:
2099 newMsg.params[num] = (LONG)ent;
2100 break;
2101 case MUIV_NList_SelfValue:
2102 newMsg.params[num] = (SIPTR)obj;
2103 break;
2104 case MUIV_NList_AppValue:
2105 if (data->SETUP)
2106 newMsg.params[num] = (SIPTR)_app(obj);
2107 else
2108 newMsg.params[num] = 0;
2109 break;
2110 default:
2111 newMsg.params[num] = table1[num+1];
2112 break;
2116 DoMethodA(dest, (Msg)((APTR)&newMsg));
2118 ent++;
2119 if(msg->pos == MUIV_NList_DoMethod_Selected)
2121 if(data->NList_TypeSelect)
2123 if((ent > data->sel_pt[data->max_sel].ent) ||
2124 ((ent == data->sel_pt[data->max_sel].ent) &&
2125 (data->sel_pt[data->max_sel].column == 0) &&
2126 (data->sel_pt[data->max_sel].xoffset == PMIN)))
2127 break;
2129 else
2131 while((ent < data->NList_Entries) && (data->EntriesArray[ent]->Select == TE_Select_None))
2132 ent++;
2135 else if(msg->pos != MUIV_NList_DoMethod_All)
2136 break;
2139 return (TRUE);
2142 static BOOL NL_List_GetPos(struct NLData *data, APTR entry, LONG *pos)
2144 BOOL result = FALSE;
2146 ENTER();
2148 if(entry != NULL)
2150 if((IPTR)entry == (IPTR)-2)
2152 if(data->NList_LastInserted == -1)
2153 *pos = (data->NList_Entries - 1);
2154 else
2155 *pos = data->NList_LastInserted;
2157 result = TRUE;
2159 else
2161 LONG ent = *pos + 1;
2163 while(ent < data->NList_Entries)
2165 if(data->EntriesArray[ent]->Entry == entry)
2167 *pos = ent;
2169 result = TRUE;
2170 break;
2172 ent++;
2177 if(result == FALSE)
2179 *pos = MUIV_NList_GetPos_End;
2182 RETURN(result);
2183 return result;
2186 IPTR mNL_List_GetPos(struct IClass *cl,Object *obj,struct MUIP_NList_GetPos *msg)
2188 struct NLData *data = INST_DATA(cl,obj);
2189 BOOL result;
2191 result = NL_List_GetPos(data, msg->entry, msg->pos);
2193 return result;