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 ***************************************************************************/
29 #include <clib/alib_protos.h>
30 #include <proto/exec.h>
31 #include <proto/intuition.h>
32 #include <proto/graphics.h>
36 #include "NList_func.h"
39 /* #define DETAILPEN (0x0000) // compatible Intuition rendering pens */
40 /* #define BLOCKPEN (0x0001) // compatible Intuition rendering pens */
41 /* #define TEXTPEN (0x0002) // text on background */
42 /* #define SHINEPEN (0x0003) // bright edge on 3D objects */
43 /* #define SHADOWPEN (0x0004) // dark edge on 3D objects */
44 /* #define FILLPEN (0x0005) // active-window/selected-gadget fill */
45 /* #define FILLTEXTPEN (0x0006) // text over FILLPEN */
46 /* #define BACKGROUNDPEN (0x0007) // always color 0 */
47 /* #define HIGHLIGHTTEXTPEN (0x0008) // special color text, on background */
49 /* #define BARDETAILPEN (0x0009) // text/detail in screen-bar/menus */
50 /* #define BARBLOCKPEN (0x000A) // screen-bar/menus fill */
51 /* #define BARTRIMPEN (0x000B) // trim under screen-bar */
54 /* #define MPEN_SHINE 0 */
55 /* #define MPEN_HALFSHINE 1 */
56 /* #define MPEN_BACKGROUND 2 */
57 /* #define MPEN_HALFSHADOW 3 */
58 /* #define MPEN_SHADOW 4 */
59 /* #define MPEN_TEXT 5 */
60 /* #define MPEN_FILL 6 */
61 /* #define MPEN_MARK 7 */
62 /* #define MPEN_COUNT 8 */
66 * SetABPenDrMd is V39+ !!!!
67 * SetABPenDrMd(data->rp,data->pens[MPEN_TEXT],data->pens[MPEN_BACKGROUND],JAM1);
68 * SetABPenDrMd(data->rp,_dri(obj)->dri_Pens[TEXTPEN],_dri(obj)->dri_Pens[BACKGROUNDPEN],JAM1);
69 * replace with for < V39:
70 * SetAPen(data->rp,data->pens[MPEN_SHINE]);
71 * SetBPen(data->rp,data->pens[MPEN_SHADOW]);
72 * SetDrMd(data->rp,JAM2);
77 * \t Tabulation. Go to the next tab boundary of the column.
78 * tab positions are separated by 8 spaces by default.
79 * ESC - Disable text engine, following chars will be printed
80 * without further parsing.
81 * ESC u Set the soft style to underline.
82 * ESC b Set the soft style to bold.
83 * ESC i Set the soft style to italic.
84 * ESC n Set the soft style back to normal.
85 * ESC <n> Use pen number n (2..9) as front pen. n must be a valid
86 * DrawInfo pen as specified in "intuition/screens.h".
87 * ESC c Center current line. only valid at the beginning.
88 * ESC r Right justify current line. only valid at the beginning.
89 * ESC l Left justify current line. only valid at the beginning.
91 * These ones are new or modified :
93 * ESC j Justify left and right current line. only at beginning.
94 * ESC I[<s>] (ESC I[<s>|<width>|<height>])
95 * Draw MUI image with specification <s>.
96 * See Image.mui/MUIA_Image_Spec for image spec definition.
97 * <width> and <height> should be omited because NList
98 * draw the image to its standard size himself now.
99 * ESC O[<p>] Draw the MUIM_NList_CreateImage at adress <p>.
100 * (<p> should be an 8 hex digits number).
101 * ESC o[<n>] Draw the MUIM_NList_UseImage number <n>. If the <n> UseImage
102 * don't exist or has been set to NULL, no image is drawn.
103 * ESC P[] Use default front pen.
104 * ESC P[<n>] Use pen number <n>. (it's a direct pen number, so you must
105 * make MUI_ObtainPen and MUI_ReleasePen for it yourself,
106 * best to do it is in Setup() and Cleanup() of a subclass).
107 * ESC T Draw horizontal line on top of the entry for the column.
108 * ESC C Draw horizontal line centered in the entry for the column.
109 * ESC B Draw horizontal line on bottom of the entry for the column
110 * ESC E Draw horizontal line centered in the entry for the column,
111 * but only on the left and right of the line contents.
115 * "0:<x>" where <x> is between MUII_BACKGROUND and
116 * MUII_FILLBACK2 identifying a builtin pattern.
118 * "1:<x>" where <x> identifies a builtin standard image.
119 * Don't use this, use "6:<x>" instead.
121 * "2:<r>,<g>,<b>" where <r>, <g> and <b> are 32-bit RGB
122 * color values specified as 8-digit hex
123 * string (e.g. 00000000 or ffffffff).
124 * Kick 2.x users will get an empty image.
126 * "3:<n>" where <n> is the name of an external boopsi
129 * "4:<n>" where <n> is the name of an external MUI brush.
131 * "5:<n>" where <n> is the name of an external picture
132 * file that should be loaded with datatypes.
133 * Kick 2.x users will get an empty image.
135 * "6:<x>" where <x> is between MUII_WindowBack and
136 * MUII_Count-1 identifying a preconfigured
141 BOOL
DontDoColumn(struct NLData
*data
,LONG ent
,WORD column
)
143 if ((ent
>= 0) && (ent
< data
->NList_Entries
) && (column
>= 0) && (column
< data
->numcols
) &&
144 (data
->cols
[column
].c
->col
< 8) &&
145 (data
->EntriesArray
[ent
]->Wrap
& TE_Wrap_TmpLine
) &&
146 !(data
->EntriesArray
[ent
]->Wrap
& (1 << data
->cols
[column
].c
->col
)))
153 void FreeAffInfo(struct NLData
*data
)
157 FreeVecPooled(data
->Pool
, data
->aff_infos
);
158 data
->aff_infos
= NULL
;
160 data
->numaff_infos
= 0;
164 BOOL
NeedAffInfo(struct NLData
*data
,WORD niask
)
166 struct affinfo
*affinfotmp
;
169 if (data
->numaff_infos
-1 < niask
)
170 { LONG num
= niask
+ niask
/2;
174 //D(bug( "Adding %ld aff infos.\n", num ));
176 if((affinfotmp
= (struct affinfo
*)AllocVecPooled(data
->Pool
, sizeof(struct affinfo
)*num
)) != NULL
)
179 while (ni
< data
->numaff_infos
)
180 { affinfotmp
[ni
].strptr
= data
->aff_infos
[ni
].strptr
;
181 affinfotmp
[ni
].pos
= data
->aff_infos
->pos
;
182 affinfotmp
[ni
].addchar
= data
->aff_infos
[ni
].addchar
;
183 affinfotmp
[ni
].addinfo
= data
->aff_infos
[ni
].addinfo
;
184 affinfotmp
[ni
].pen
= data
->aff_infos
[ni
].pen
;
185 affinfotmp
[ni
].len
= data
->aff_infos
[ni
].len
;
186 affinfotmp
[ni
].style
= data
->aff_infos
[ni
].style
;
190 { affinfotmp
[ni
].strptr
= NULL
;
191 affinfotmp
[ni
].pos
= 0;
192 affinfotmp
[ni
].addchar
= 0;
193 affinfotmp
[ni
].addinfo
= 0;
194 affinfotmp
[ni
].pen
= 0;
195 affinfotmp
[ni
].len
= 0;
196 affinfotmp
[ni
].style
= 0;
200 data
->aff_infos
= affinfotmp
;
201 data
->numaff_infos
= num
;
210 void NL_GetDisplayArray(struct NLData
*data
, SIPTR ent
)
216 if(ent
>= 0 && ent
< data
->NList_Entries
)
218 data
->parse_ent
= ent
;
220 if(data
->EntriesArray
[ent
]->Wrap
& TE_Wrap_TmpLine
)
222 if(data
->EntriesArray
[ent
]->len
< -1)
228 ent
-= data
->EntriesArray
[data
->parse_ent
]->dnum
;
230 if(ent
< 0 || ent
>= data
->NList_Entries
)
233 useptr
= (char *)data
->EntriesArray
[ent
]->Entry
;
238 useptr
= (char *)data
->EntriesArray
[ent
]->Entry
;
243 useptr
= (char *)data
->NList_Title
;
244 data
->display_ptr
= NULL
;
245 data
->parse_ent
= -1;
249 if(data
->display_ptr
== NULL
|| useptr
!= data
->display_ptr
|| ent
!= (SIPTR
)data
->DisplayArray
[1])
251 char **display_array
= &data
->DisplayArray
[2];
254 data
->display_ptr
= useptr
;
255 data
->DisplayArray
[1] = (char *)ent
;
257 // set up the string and preparses pointers
258 for(column
= 0; column
< data
->numcols
; column
++)
260 display_array
[data
->cols
[column
].c
->col
] = NULL
;
261 display_array
[data
->cols
[column
].c
->col
+ DISPLAY_ARRAY_MAX
] = NULL
;
265 display_array
[0] = useptr
;
267 if(ent
< 0 || ent
>= data
->NList_Entries
)
270 // invoke the display method
271 // if this method is not catched by a subclass our own implementation will
272 // correctly choose one of the two possible hook functions as default
273 data
->DisplayArray
[0] = (char *)useptr
;
274 DoMethod(data
->this, MUIM_NList_Display
, data
->DisplayArray
[0], data
->DisplayArray
[1], &data
->DisplayArray
[2], &data
->DisplayArray
[2+DISPLAY_ARRAY_MAX
]);
276 data
->parse_column
= -1;
283 void ParseColumn(struct NLData
*data
,WORD column
,IPTR mypen
)
285 struct colinfo
*cinfo
= data
->cols
[column
].c
;
286 struct affinfo
*afinfo
;
287 char *ptr1
,*ptr2
,*ptro
,*ptrs
;
288 char **display_array
= &data
->DisplayArray
[2];
290 LONG col
,ent
= data
->parse_ent
,maxlen
= 300;
291 WORD ni
,style
,do_format
,prep
,dx
,there_is_char
;
293 LONG numimg
= 0; // RHP: Added for Special ShortHelp
296 /* if (data->parse_column == column) return;*/
298 data
->parse_column
= column
;
299 col
= NL_ColumnToCol(data
,column
);
308 afinfo
= &data
->aff_infos
[ni
];
314 if ((ent
>= 0) && data
->EntriesArray
[ent
]->Wrap
)
315 { UBYTE colmask
= (UBYTE
) ((1 << col
) & TE_Wrap_TmpMask
);
316 if (data
->EntriesArray
[ent
]->Wrap
& TE_Wrap_TmpLine
)
318 if (data
->EntriesArray
[ent
]->Wrap
& colmask
)
319 { tmppos
= data
->EntriesArray
[ent
]->pos
;
320 cinfo
->style
= style
= data
->EntriesArray
[ent
]->style
;
321 if (IS_FIXPEN(style
))
322 pen
= (IPTR
)data
->EntriesArray
[ent
]->Entry
;
323 if (data
->EntriesArray
[ent
]->len
>= 0)
324 maxlen
= data
->EntriesArray
[ent
]->len
;
329 else if (data
->EntriesArray
[ent
]->Wrap
& colmask
)
330 { cinfo
->style
= style
= data
->EntriesArray
[ent
]->style
;
331 if (data
->EntriesArray
[ent
]->len
>= 0)
332 maxlen
= data
->EntriesArray
[ent
]->len
;
335 ptrs
= ptr1
= display_array
[cinfo
->col
];
337 while ((prep
>=0) && NeedAffInfo(data
,ni
+1))
339 if ((prep
== 1) && !display_array
[cinfo
->col
+DISPLAY_ARRAY_MAX
])
342 { ptr1
= cinfo
->preparse
;
343 ptrs
= ptr1
+ PREPARSE_OFFSET_COL
;
350 { ptr1
= display_array
[cinfo
->col
+DISPLAY_ARRAY_MAX
];
351 ptrs
= ptr1
+ PREPARSE_OFFSET_ENTRY
;
357 else if ((ent
>= 0) && (data
->EntriesArray
[ent
]->Wrap
& TE_Wrap_TmpLine
))
358 { ptrs
= ptr1
= display_array
[cinfo
->col
];
360 ptr2
= ptr1
+ maxlen
;
363 { ptrs
= ptr1
= display_array
[cinfo
->col
];
364 ptr2
= ptr1
+ maxlen
;
369 afinfo
= &data
->aff_infos
[ni
];
376 afinfo
->imgnum
= -1; // RHP: Added for Special ShortHelp
377 afinfo
->style
= style
;
378 afinfo
->strptr
= ptr1
;
379 afinfo
->pos
= (WORD
) (ptr1
- ptrs
);
381 //D(bug( "%ld - Setting aff info %ld: %15.15s - pos: %ld, len: %ld, style: %ld.\n", __LINE__, ni, afinfo->strptr, afinfo->pos, afinfo->len, afinfo->style ));
383 while (ptr1
&& (ptr1
<ptr2
) && (ptr1
[0] != '\0') && (ptr1
[0] != '\n') && (ptr1
[0] != '\r') && (good
= NeedAffInfo(data
,ni
+2)))
385 if (data
->NList_SkipChars
)
386 { char *sc
= data
->NList_SkipChars
;
387 while (sc
[0] && (sc
[0] != ptr1
[0]))
393 afinfo
= &data
->aff_infos
[ni
];
401 afinfo
->imgnum
= -1; // RHP: Added for Special ShortHelp
402 afinfo
->style
= style
;
403 afinfo
->strptr
= ptr1
;
404 afinfo
->pos
= (WORD
) (ptr1
- ptrs
);
406 //D(bug( "%ld - Setting aff info %ld: %15.15s - pos: %ld, len: %ld, style: %ld.\n", __LINE__, ni, afinfo->strptr, afinfo->pos, afinfo->len, afinfo->style ));
411 if (do_format
&& (ptr1
[0] == '\033'))
420 { SET_ALIGN_CENTER(cinfo
->style
); SET_ALIGN_CENTER(style
); ptr1
++; }
421 else if (ptr1
[0] == 'r')
422 { SET_ALIGN_RIGHT(cinfo
->style
); SET_ALIGN_RIGHT(style
); ptr1
++; }
423 else if (ptr1
[0] == 'l')
424 { SET_ALIGN_LEFT(cinfo
->style
); SET_ALIGN_LEFT(style
); ptr1
++; }
425 else if (ptr1
[0] == 'j')
426 { SET_ALIGN_JUSTIFY(cinfo
->style
); SET_ALIGN_JUSTIFY(style
); ptr1
++; }
427 else if (ptr1
[0] == 'u')
428 { SET_STYLE_UNDERLINE(style
); ptr1
++; }
429 else if (ptr1
[0] == 'b')
430 { SET_STYLE_BOLD(style
); ptr1
++; }
431 else if (ptr1
[0] == 'i')
432 { SET_STYLE_ITALIC(style
); ptr1
++; }
433 else if (ptr1
[0] == 'n')
434 { SET_STYLE_NORMAL(style
); ptr1
++; }
435 else if (ptr1
[0] == '-')
436 { do_format
= FALSE
; ptr1
++; }
437 else if (ptr1
[0] == '2')
438 { if (data
->SHOW
) { pen
= _dri(data
->this)->dri_Pens
[2]; SET_FIXPEN(style
); } ptr1
++; }
439 else if (ptr1
[0] == '3')
440 { if (data
->SHOW
) { pen
= _dri(data
->this)->dri_Pens
[3]; SET_FIXPEN(style
); } ptr1
++; }
441 else if (ptr1
[0] == '4')
442 { if (data
->SHOW
) { pen
= _dri(data
->this)->dri_Pens
[4]; SET_FIXPEN(style
); } ptr1
++; }
443 else if (ptr1
[0] == '5')
444 { if (data
->SHOW
) { pen
= _dri(data
->this)->dri_Pens
[5]; SET_FIXPEN(style
); } ptr1
++; }
445 else if (ptr1
[0] == '6')
446 { if (data
->SHOW
) { pen
= _dri(data
->this)->dri_Pens
[6]; SET_FIXPEN(style
); } ptr1
++; }
447 else if (ptr1
[0] == '7')
448 { if (data
->SHOW
) { pen
= _dri(data
->this)->dri_Pens
[7]; SET_FIXPEN(style
); } ptr1
++; }
449 else if (ptr1
[0] == '8')
450 { if (data
->SHOW
) { pen
= _dri(data
->this)->dri_Pens
[8]; SET_FIXPEN(style
); } ptr1
++; }
451 else if (ptr1
[0] == '9')
452 { if (data
->SHOW
) { pen
= _dri(data
->this)->dri_Pens
[9]; SET_FIXPEN(style
); } ptr1
++; }
453 else if (ptr1
[0] == 'T')
454 { SET_HLINE_T(cinfo
->style
); SET_HLINE_T(style
); ptr1
++; }
455 else if (ptr1
[0] == 'C')
456 { SET_HLINE_C(cinfo
->style
); SET_HLINE_C(style
); ptr1
++; }
457 else if (ptr1
[0] == 'B')
458 { SET_HLINE_B(cinfo
->style
); SET_HLINE_B(style
); ptr1
++; }
459 else if (ptr1
[0] == 'E')
460 { SET_HLINE_E(cinfo
->style
); SET_HLINE_E(style
); ptr1
++; }
461 else if (ptr1
[0] == 't')
462 { SET_HLINE_thick(cinfo
->style
);
463 SET_HLINE_thick(style
);
464 if (muiRenderInfo(data
->this) && _pens(data
->this))
465 data
->HLINE_thick_pen
= MUIPEN(_pens(data
->this)[MPEN_FILL
]);
467 data
->HLINE_thick_pen
= 3;
474 { SET_HLINE_nothick(cinfo
->style
);
475 SET_HLINE_nothick(style
);
476 if (muiRenderInfo(data
->this) && _pens(data
->this))
477 data
->HLINE_thick_pen
= MUIPEN(_pens(data
->this)[MPEN_SHADOW
]);
479 data
->HLINE_thick_pen
= 1;
482 if ((ptr1
[np2
] == 'M') || (ptr1
[np2
] == 'I'))
485 while ((ptr1
[np
] != '\0') && (ptr1
[np
] != '\n') && (ptr1
[np
] != '\r') && (ptr1
[np
] != ']'))
492 else if (ptr1
[np2
] == 'M')
494 pnum
= atol(&ptr1
[np2
+1]);
495 if ((pnum
>= 0) && (pnum
<= 8) && muiRenderInfo(data
->this) && _pens(data
->this))
496 data
->HLINE_thick_pen
= MUIPEN(_pens(data
->this)[pnum
]);
498 else if (ptr1
[np2
] == 'I')
500 pnum
= atol(&ptr1
[np2
+1]);
501 if ((pnum
>= 0) && (pnum
<= 11))
505 if ((pnum
>= 0) && muiRenderInfo(data
->this) && _dri(data
->this) && _dri(data
->this)->dri_Pens
)
506 data
->HLINE_thick_pen
= _dri(data
->this)->dri_Pens
[pnum
];
510 data
->HLINE_thick_pen
= atol(&ptr1
[np2
]);
518 else if (ptr1
[0] == 'P')
525 while ((ptr1
[np
] != '\0') && (ptr1
[np
] != '\n') && (ptr1
[np
] != '\r') && (ptr1
[np
] != ']'))
536 pen
= atol(&ptr1
[1]);
546 else if (ptr1
[0] == 'I')
551 LONG dx
= -1, dy
= -1;
552 LONG minx
= -1, button
= -1;
553 ULONG tag
=0L, tagval
=0L;
556 // skip everything until we find the final closing brace
557 while(ptr1
[np
] != '\0' && ptr1
[np
] != ']')
564 afinfo
= &data
->aff_infos
[ni
];
567 afinfo
->tagval
= tagval
;
568 afinfo
->button
= button
;
569 afinfo
->imgnum
= -1; // RHP: Added for Special ShortHelp
572 afinfo
->style
= STYLE_IMAGE
;
573 strlcpy(data
->imagebuf
, &ptr1
[1], MIN(np
, sizeof(data
->imagebuf
)));
574 afinfo
->pos
= (WORD
) (ptro
- ptrs
);
575 D(DBF_DRAW
, "image spec '%s' tag %ld, tagval %ld, button %08lx, dx %ld, dy %ld, minx %ld", data
->imagebuf
, tag
, tagval
, button
, dx
, dy
, minx
);
576 if (data
->imagebuf
[0] == '\0')
577 afinfo
->strptr
= NULL
;
579 afinfo
->strptr
= (APTR
) GetNImage(data
,data
->imagebuf
);
582 dx
= ((struct NImgList
*) afinfo
->strptr
)->width
;
584 dy
= ((struct NImgList
*) afinfo
->strptr
)->height
;
593 afinfo
->pen
= ((dy
& 0x0000FFFF) << 16) + (dx
& 0x0000FFFF);
595 //D(bug( "%ld - Setting aff info %ld: %15.15s - pos: %ld, len: %ld, style: %ld.\n", __LINE__, ni, afinfo->strptr, afinfo->pos, afinfo->len, afinfo->style ));
597 if (afinfo
->strptr
|| (data
->imagebuf
[0] == '\0')) {
606 else if ((ptr1
[0] == 'O') || (ptr1
[0] == 'o'))
608 char imgtype
= ptr1
[0];
613 LONG minx
= -1,minx2
= -1,button
= -1;
614 ULONG tag
=0L,tagval
=0L;
619 while ((ptr1
[np
] != '\0') && (ptr1
[np
] != '\n') && (ptr1
[np
] != '\r') && (ptr1
[np
] != ']') && (ptr1
[np
] != ';') && (ptr1
[np
] != '|') && (ptr1
[np
] != ',') && (ptr1
[np
] != '@'))
623 button
= atol(&ptr1
[np
]);
624 while ((ptr1
[np
] != '\0') && (ptr1
[np
] != '\n') && (ptr1
[np
] != '\r') && (ptr1
[np
] != ']') && (ptr1
[np
] != ';') && (ptr1
[np
] != '|') && (ptr1
[np
] != ','))
627 while (ptr1
[np
] == ';')
630 tag
= strtoul(&ptr1
[np
],NULL
,16);
632 tagval
= strtoul(&ptr1
[np
],NULL
,16);
633 while ((ptr1
[np
] != '\0') && (ptr1
[np
] != '\n') && (ptr1
[np
] != '\r') && (ptr1
[np
] != ']') && (ptr1
[np
] != ';') && (ptr1
[np
] != ','))
638 minx2
= minx
= atol(&ptr1
[np
]);
639 while ((ptr1
[np
] != '\0') && (ptr1
[np
] != '\n') && (ptr1
[np
] != '\r') && (ptr1
[np
] != ']') && (ptr1
[np
] != '|'))
644 if ((ptr1
[np
] != '\0') && (ptr1
[np
] != '\n') && (ptr1
[np
] != '\r') && (ptr1
[np
] != '|') && (ptr1
[np
] != ']') && (ptr1
[np
] != ','))
645 dx
= atol(&ptr1
[np
]);
646 while ((ptr1
[np
] != '\0') && (ptr1
[np
] != '\n') && (ptr1
[np
] != '\r') && (ptr1
[np
] != '|') && (ptr1
[np
] != ']') && (ptr1
[np
] != ','))
650 if ((ptr1
[np
] != '\0') && (ptr1
[np
] != '\n') && (ptr1
[np
] != '\r') && (ptr1
[np
] != ']') && (ptr1
[np
] != ','))
651 dy2
= dy
= atol(&ptr1
[np
]);
652 while ((ptr1
[np
] != '\0') && (ptr1
[np
] != '\n') && (ptr1
[np
] != '\r') && (ptr1
[np
] != ']') && (ptr1
[np
] != ','))
659 minx2
= minx
= atol(&ptr1
[np
]);
660 while ((ptr1
[np
] != '\0') && (ptr1
[np
] != '\n') && (ptr1
[np
] != '\r') && (ptr1
[np
] != ']'))
665 struct BitMapImage
*bitmapimage
= NULL
;
669 bitmapimage
= (struct BitMapImage
*) strtoul(&ptr1
[1],NULL
,16);
672 numimg
= atol(&ptr1
[1]); // RHP: Changed for Special ShortHelp
673 if ((numimg
>= 0) && (numimg
< data
->LastImage
) && data
->NList_UseImages
)
674 bitmapimage
= data
->NList_UseImages
[numimg
].bmimg
;
676 if (bitmapimage
!= NULL
&& (bitmapimage
->control
== MUIA_Image_Spec
))
681 afinfo
= &data
->aff_infos
[ni
];
684 afinfo
->tagval
= tagval
;
685 afinfo
->button
= button
;
686 afinfo
->imgnum
= numimg
; // RHP: Added for Special ShortHelp
689 afinfo
->style
= STYLE_IMAGE
;
690 afinfo
->strptr
= (APTR
) GetNImage2(data
,bitmapimage
->obtainpens
);
691 afinfo
->pos
= (WORD
) (ptro
- ptrs
);
692 if ((afinfo
->strptr
) && !(((struct NImgList
*) afinfo
->strptr
)->NImgObj
))
693 afinfo
->strptr
= NULL
;
698 dx
= ((struct NImgList
*) afinfo
->strptr
)->width
;
700 dy
= ((struct NImgList
*) afinfo
->strptr
)->height
;
704 if ((dy2
!= -1) && ((dy
<= 0) || ((minx2
>= 0) && (dx2
== -1))))
708 if ((dx
< minx
) && (minx2
>= 0) && (dx2
== -1))
711 afinfo
->pen
= ((dy
& 0x0000FFFF) << 16) + (dx
& 0x0000FFFF);
713 D(DBF_DRAW
, "Setting aff info %ld: %15.15s - pos: %ld, len: %ld, style: %ld", ni
, afinfo
->strptr
, afinfo
->pos
, afinfo
->len
, afinfo
->style
);
722 if (bitmapimage
== NULL
|| (bitmapimage
->control
!= MUIM_NList_CreateImage
))
725 if (bitmapimage
!= NULL
|| (minx
> 0))
730 afinfo
= &data
->aff_infos
[ni
];
734 dx
= bitmapimage
->width
;
737 if ((dy
> bitmapimage
->height
) || (dy
< 0))
738 dy
= bitmapimage
->height
;
748 afinfo
->imgnum
= -1; // RHP: Added for Special ShortHelp
749 afinfo
->pen
= ((dy
& 0x0000FFFF) << 16) + (dx
& 0x0000FFFF);
750 afinfo
->style
= STYLE_IMAGE2
;
751 afinfo
->strptr
= (APTR
) bitmapimage
;
752 afinfo
->pos
= (WORD
) (ptro
- ptrs
);
754 //D(bug( "%ld - Setting aff info %ld: %15.15s - pos: %ld, len: %ld, style: %ld.\n", __LINE__, ni, afinfo->strptr, afinfo->pos, afinfo->len, afinfo->style ));
770 afinfo
= &data
->aff_infos
[ni
];
777 afinfo
->imgnum
= -1; // RHP: Added for Special ShortHelp
778 afinfo
->style
= style
;
779 afinfo
->strptr
= ptr1
;
780 afinfo
->pos
= (WORD
) (ptr1
- ptrs
);
782 //D(bug( "%ld - Setting aff info %ld: %15.15s - pos: %ld, len: %ld, style: %ld.\n", __LINE__, ni, afinfo->strptr, afinfo->pos, afinfo->len, afinfo->style ));
784 else if ((ptr1
[0] == '\t' && (data
->NList_IgnoreSpecialChars
== NULL
|| strchr(data
->NList_IgnoreSpecialChars
, '\t') == 0)) ||
785 (((unsigned char)ptr1
[0]) == 0xA0 && (data
->NList_IgnoreSpecialChars
== NULL
|| strchr(data
->NList_IgnoreSpecialChars
, 0xa0) == 0)))
790 afinfo
= &data
->aff_infos
[ni
];
796 afinfo
->imgnum
= -1; // RHP: Added for Special ShortHelp
797 afinfo
->strptr
= ptr1
;
798 afinfo
->pos
= (WORD
) (ptr1
- ptrs
);
800 { afinfo
->style
= STYLE_TAB
;
803 else if (((unsigned char)ptr1
[0]) == 0xA0)
804 { afinfo
->style
= STYLE_FIXSPACE
;
805 afinfo
->len
= data
->spacesize
;
808 { afinfo
->style
= STYLE_SPACE
;
809 afinfo
->len
= data
->spacesize
;
812 //D(bug( "%ld - Setting aff info %ld: %15.15s - pos: %ld, len: %ld, style: %ld.\n", __LINE__, ni, afinfo->strptr, afinfo->pos, afinfo->len, afinfo->style ));
815 afinfo
= &data
->aff_infos
[ni
];
823 afinfo
->imgnum
= -1; // RHP: Added for Special ShortHelp
824 afinfo
->style
= style
;
825 afinfo
->strptr
= ptr1
;
826 afinfo
->pos
= (WORD
) (ptr1
- ptrs
);
828 //D(bug( "%ld - Setting aff info %ld: %15.15s - pos: %ld, len: %ld, style: %ld.\n", __LINE__, ni, afinfo->strptr, afinfo->pos, afinfo->len, afinfo->style ));
838 if (!there_is_char
&& IS_HLINE_E(style
))
839 { SET_HLINE_C(cinfo
->style
); SET_HLINE_C(style
); }
841 if (NeedAffInfo(data
,ni
+1))
843 afinfo
= &data
->aff_infos
[ni
];
846 afinfo
->style
= style
;
848 afinfo
->imgnum
= -1; // RHP: Added for Special ShortHelp
850 afinfo
->pos
= (WORD
) (ptr1
- ptrs
);
852 //D(bug( "%ld - Setting aff info %ld: %15.15s - pos: %ld, len: %ld, style: %ld.\n", __LINE__, ni, afinfo->strptr, afinfo->pos, afinfo->len, afinfo->style ));
857 static void ParseColumns(struct NLData
*data
,LONG ent
)
861 NL_GetDisplayArray(data
,ent
);
862 for (column
= 0;column
< data
->numcols
;column
++)
863 { if (DontDoColumn(data
,ent
,column
))
865 ParseColumn(data
,column
,0);
870 * void OneParseColumns(Object *obj,struct NLData *data,LONG ent)
872 * if ((ent >= -1) && (ent < data->NList_Entries))
874 * if (!data->do_parse || data->NList_Quiet || data->NList_Disabled)
877 * { if (data->adding_member != 2)
878 * data->adding_member = 1;
881 * data->adding_member = 3;
882 * data->parse_column = -1;
883 * ParseColumns(obj,data,ent);
884 * data->parse_column = -1;
885 * GetNImage_End(data);
886 * data->do_parse = FALSE;
891 void AllParseColumns(struct NLData
*data
)
894 if (!data
->do_parse
|| data
->NList_Quiet
|| data
->NList_Disabled
)
897 { if (data
->adding_member
!= 2)
898 data
->adding_member
= 1;
901 data
->adding_member
= 3;
902 data
->do_images
= TRUE
;
903 data
->display_ptr
= NULL
;
904 data
->parse_column
= -1;
905 if (data
->NList_Title
)
906 ParseColumns(data
,-1);
907 for (ent
= 0;ent
< data
->NList_Entries
;ent
++)
908 ParseColumns(data
,ent
);
909 data
->display_ptr
= NULL
;
910 data
->parse_column
= -1;
912 data
->do_parse
= FALSE
;
916 static WORD
AddSpaceInfos(struct NLData
*data
,WORD column
,WORD ni1
)
918 struct colinfo
*cinfo
= data
->cols
[column
].c
;
919 struct affinfo
*afinfo
;
924 if (!data
->DRAW
|| data
->do_setcols
)
928 ni
= ni1
; afinfo
= &data
->aff_infos
[ni
];
929 while ((ni
<= cinfo
->ninfo
) && (afinfo
->len
> 0))
930 { if (!(afinfo
->style
& STYLE_STRMASK
))
931 { str
= (char *) afinfo
->strptr
;
933 while ((curlen
< afinfo
->len
) && (str
[curlen
] != ' '))
936 if ((curlen
< afinfo
->len
) && NeedAffInfo(data
,cinfo
->ninfo
+1))
937 { ni2
= cinfo
->ninfo
++;
939 { data
->aff_infos
[ni2
+1].strptr
= data
->aff_infos
[ni2
].strptr
;
940 data
->aff_infos
[ni2
+1].pen
= data
->aff_infos
[ni2
].pen
;
941 data
->aff_infos
[ni2
+1].len
= data
->aff_infos
[ni2
].len
;
942 data
->aff_infos
[ni2
+1].style
= data
->aff_infos
[ni2
].style
;
943 data
->aff_infos
[ni2
+1].pos
= data
->aff_infos
[ni2
].pos
;
944 data
->aff_infos
[ni2
+1].addchar
= data
->aff_infos
[ni2
].addchar
;
945 data
->aff_infos
[ni2
+1].addinfo
= data
->aff_infos
[ni2
].addinfo
;
948 afinfo
->len
= curlen
;
950 ni
++; afinfo
= &data
->aff_infos
[ni
];
952 afinfo
->len
-= curlen
;
953 afinfo
->strptr
= &str
[curlen
];
954 afinfo
->pos
+= curlen
;
958 ni
++; afinfo
= &data
->aff_infos
[ni
];
961 ni
++; afinfo
= &data
->aff_infos
[ni
];
967 void WidthColumn(struct NLData
*data
,WORD column
,WORD updinfo
)
969 struct colinfo
*cinfo
= data
->cols
[column
].c
;
970 struct affinfo
*afinfo
;
975 struct TextExtent te
;
976 BOOL text_last
= FALSE
;
977 BOOL is_text
= FALSE
;
981 { cinfo
->colwidthbiggest
= -2;
982 cinfo
->colwidthbiggest2
= -2;
983 cinfo
->colwidthbiggestptr
= -2;
984 cinfo
->colwidthbiggestptr2
= -2;
985 if (cinfo
->userwidth
== -1)
986 data
->do_setcols
= TRUE
;
987 data
->do_images
= TRUE
;
998 afinfo
= &data
->aff_infos
[ni
];
1000 while ((ni
<= cinfo
->ninfo
) && (afinfo
->len
> 0))
1003 if (afinfo
->style
== STYLE_IMAGE
)
1004 curlen
+= afinfo
->len
+ 2;
1005 else if (afinfo
->style
== STYLE_IMAGE2
)
1006 curlen
+= afinfo
->len
+ 2;
1007 else if (afinfo
->style
== STYLE_TAB
)
1008 { curlen
= ((((curlen
-1) / data
->tabsize
) + 1) * data
->tabsize
) + 1;
1013 else if ((afinfo
->style
== STYLE_FIXSPACE
) || (afinfo
->style
== STYLE_SPACE
))
1014 { curlen
+= afinfo
->len
;
1019 { SetSoftStyle(data
->rp
, GET_STYLE(afinfo
->style
), STYLE_MASK
);
1020 TextExtent(data
->rp
, afinfo
->strptr
, afinfo
->len
, &te
);
1021 curlen
+= te
.te_Width
;
1022 if ((ni
== 0) && (te
.te_Extent
.MinX
< 0))
1023 curlen
-= te
.te_Extent
.MinX
;
1024 numchar
+= afinfo
->len
;
1029 afinfo
= &data
->aff_infos
[ni
];
1032 { if (text_last
&& (te
.te_Extent
.MaxX
> te
.te_Width
))
1033 curlen
+= (te
.te_Extent
.MaxX
- te
.te_Width
);
1035 cinfo
->colwidth
= curlen
;
1037 cinfo
->colwidth
= curlen
;
1038 SetSoftStyle(data
->rp
, 0, STYLE_MASK
);
1040 if (!data
->DRAW
|| data
->do_setcols
)
1042 else if (IS_ALIGN_CENTER(cinfo
->style
))
1043 cinfo
->xoffset
= (cinfo
->dx
- cinfo
->colwidth
)/2;
1044 else if (IS_ALIGN_RIGHT(cinfo
->style
))
1045 cinfo
->xoffset
= cinfo
->dx
- 1 - cinfo
->colwidth
;
1046 else if (IS_ALIGN_JUSTIFY(cinfo
->style
))
1047 { WORD diff
= cinfo
->dx
- 1 - cinfo
->colwidth
;
1050 { UBYTE addchar
= 0;
1053 if ((numchar
> 0) && (numinfo
> 0))
1054 numinfo
+= AddSpaceInfos(data
,column
,ni1
);
1058 if ((diff
> numinfo
) && (numinfo
> 0))
1063 if ((diff
> numinfo
) && (numinfo
> 0))
1068 if ((diff
> numchar
) && (numchar
> 0) && (addchar
< data
->hinc
/3) && (addchar
< data
->spacesize
))
1073 if ((diff
> numinfo
) && (numinfo
> 0))
1078 if ((diff
> numchar
) && (numchar
> 0) && (addchar
< data
->hinc
/3) && (addchar
< data
->spacesize
))
1084 if ((addchar
> 0) || (addinfo
> 0) || (diff
> 0))
1085 { ni
= ni1
; afinfo
= &data
->aff_infos
[ni
];
1086 while ((ni
<= cinfo
->ninfo
) && (afinfo
->len
> 0))
1087 { afinfo
->addchar
= addchar
;
1088 if (ni
< cinfo
->ninfo
)
1089 { afinfo
->addinfo
= addinfo
;
1095 ni
++; afinfo
= &data
->aff_infos
[ni
];
1098 cinfo
->colwidth
+= (numchar
* addchar
) + (numinfo
* addinfo
);
1103 if (cinfo
->xoffset
< 0)
1105 colwidth
= cinfo
->colwidth
+ 2;
1106 if ((data
->parse_ent
== -1) &&
1107 (((data
->NList_TitleMark
& MUIV_NList_TitleMark_TypeMask
) != MUIV_NList_TitleMark_None
) ||
1108 ((data
->NList_TitleMark2
& MUIV_NList_TitleMark2_TypeMask
) != MUIV_NList_TitleMark2_None
)))
1111 if (colwidth
> cinfo
->colwidthmax
)
1112 cinfo
->colwidthmax
= colwidth
;
1118 if ((colwidth
> cinfo
->colwidthbiggest
) && (cinfo
->colwidthbiggest
>= -1))
1119 { cinfo
->colwidthbiggest2
= cinfo
->colwidthbiggest
;
1120 cinfo
->colwidthbiggestptr2
= cinfo
->colwidthbiggestptr
;
1121 cinfo
->colwidthbiggest
= colwidth
;
1122 cinfo
->colwidthbiggestptr
= (IPTR
) data
->display_ptr
;
1123 if (((cinfo
->width
== -1) || (cinfo
->minwidth
== -1)) && (cinfo
->userwidth
== -1))
1124 data
->do_setcols
= TRUE
;
1126 else if ((colwidth
> cinfo
->colwidthbiggest2
) && (cinfo
->colwidthbiggest2
>= -1))
1127 { cinfo
->colwidthbiggest2
= colwidth
;
1128 cinfo
->colwidthbiggestptr2
= (SIPTR
) data
->display_ptr
;
1133 if (((colwidth
> cinfo
->colwidthbiggest
) && (cinfo
->colwidthbiggest
>= -1)) ||
1134 (cinfo
->colwidthbiggestptr
== (SIPTR
) data
->display_ptr
))
1136 cinfo
->colwidthbiggestptr
= cinfo
->colwidthbiggestptr2
;
1137 cinfo
->colwidthbiggest
= cinfo
->colwidthbiggest2
;
1138 cinfo
->colwidthbiggestptr2
= -2;
1139 cinfo
->colwidthbiggest2
= -2;
1140 if (((cinfo
->width
== -1) || (cinfo
->minwidth
== -1)) && (cinfo
->userwidth
== -1))
1141 { if (cinfo
->colwidthbiggest
< 0)
1142 { cinfo
->colwidthbiggestptr
= -2;
1143 cinfo
->colwidthbiggest
= -2;
1145 data
->do_setcols
= TRUE
;
1148 else if ((IPTR
)cinfo
->colwidthbiggestptr2
== (IPTR
) data
->display_ptr
)
1150 cinfo
->colwidthbiggest2
= -2;
1151 cinfo
->colwidthbiggestptr2
= -2;
1158 void FindCharInColumn(struct NLData
*data
,LONG ent
,WORD column
,WORD xoffset
,WORD
*charxoffset
,WORD
*charnum
)
1160 struct colinfo
*cinfo
= data
->cols
[column
].c
;
1161 struct affinfo
*afinfo
;
1163 struct TextExtent te
;
1165 if (DontDoColumn(data
,ent
,column
) || !data
->DRAW
|| data
->do_setcols
)
1167 *charxoffset
= xoffset
;
1171 NL_GetDisplayArray(data
,ent
);
1172 ParseColumn(data
,column
,0);
1173 WidthColumn(data
,column
,0);
1175 curx
= cinfo
->xoffset
;
1178 afinfo
= &data
->aff_infos
[ni
];
1182 *charxoffset
= xoffset
- curx
;
1185 while ((ni
<= cinfo
->ninfo
) && (afinfo
->len
> 0))
1187 if (afinfo
->style
== STYLE_IMAGE
)
1188 { curx
+= afinfo
->len
+ afinfo
->addinfo
+ 2;
1190 { *charnum
= afinfo
->pos
;
1191 *charxoffset
= xoffset
- curx2
;
1192 if (*charxoffset
> afinfo
->len
/2)
1193 *charxoffset
= xoffset
- curx
;
1194 if (data
->storebutton
&& ((LONG
)afinfo
->button
>= 0))
1196 data
->affimage
= afinfo
->imgnum
; // RHP: Added for Special Shorthelp
1197 data
->affbutton
= afinfo
->button
;
1198 data
->affbuttonline
= ent
;
1199 data
->affbuttoncol
= column
;
1200 data
->affbuttonstate
= 0;
1201 data
->storebutton
= FALSE
;
1206 else if (afinfo
->style
== STYLE_IMAGE2
)
1207 { curx
+= afinfo
->len
+ afinfo
->addinfo
+ 2;
1209 { *charnum
= afinfo
->pos
;
1210 *charxoffset
= xoffset
- curx2
;
1211 if (*charxoffset
> afinfo
->len
/2)
1212 *charxoffset
= xoffset
- curx
;
1213 if (data
->storebutton
&& ((LONG
)afinfo
->button
>= 0))
1215 data
->affimage
= afinfo
->imgnum
; // RHP: Added for Special Shorthelp
1216 data
->affbutton
= afinfo
->button
;
1217 data
->affbuttonline
= ent
;
1218 data
->affbuttoncol
= column
;
1219 data
->affbuttonstate
= 0;
1220 data
->storebutton
= FALSE
;
1225 else if (afinfo
->style
== STYLE_TAB
)
1226 { curx
= ((((curx
-cinfo
->xoffset
) / data
->tabsize
) + 1) * data
->tabsize
) + cinfo
->xoffset
;
1228 { *charnum
= afinfo
->pos
;
1229 *charxoffset
= xoffset
- curx2
;
1230 if (*charxoffset
> curx
- xoffset
)
1231 *charxoffset
= xoffset
- curx
;
1235 else if ((afinfo
->style
== STYLE_FIXSPACE
) || (afinfo
->style
== STYLE_SPACE
))
1236 { curx
+= afinfo
->len
+ afinfo
->addinfo
+ afinfo
->addchar
;
1238 { *charnum
= afinfo
->pos
;
1239 *charxoffset
= xoffset
- curx2
;
1240 if (*charxoffset
> afinfo
->len
/2)
1241 *charxoffset
= xoffset
- curx
;
1246 { SetSoftStyle(data
->rp
, GET_STYLE(afinfo
->style
), STYLE_MASK
);
1247 data
->rp
->TxSpacing
= afinfo
->addchar
;
1248 TextExtent(data
->rp
, afinfo
->strptr
, afinfo
->len
, &te
);
1249 curx
+= te
.te_Width
+ afinfo
->addinfo
;
1250 if ((ni
== 0) && (te
.te_Extent
.MinX
< 0))
1251 { curx
-= te
.te_Extent
.MinX
;
1252 curx2
-= te
.te_Extent
.MinX
;
1255 { WORD curx3
= curx2
;
1258 strptr
= (char *) afinfo
->strptr
;
1259 while (pos
< afinfo
->len
)
1261 TextExtent(data
->rp
, &strptr
[pos
], 1, &te
);
1262 curx3
+= te
.te_Width
;
1263 if (xoffset
< curx3
)
1264 { *charnum
= afinfo
->pos
+ pos
;
1265 *charxoffset
= xoffset
- curx2
;
1266 if (*charxoffset
> curx3
- xoffset
)
1267 *charxoffset
= xoffset
- curx3
;
1268 data
->rp
->TxSpacing
= 0;
1273 *charnum
= afinfo
->pos
+ pos
;
1274 *charxoffset
= xoffset
- curx
;
1275 data
->rp
->TxSpacing
= 0;
1278 data
->rp
->TxSpacing
= 0;
1281 afinfo
= &data
->aff_infos
[ni
];
1283 SetSoftStyle(data
->rp
, 0, STYLE_MASK
);
1285 *charxoffset
= xoffset
- curx
;
1289 static LONG
NL_DoWrapLine(struct NLData
*data
,LONG ent
,BOOL force
)
1291 struct colinfo
*cinfo
;
1292 struct affinfo
*afinfo
;
1293 struct TextExtent te
;
1294 LONG ent1
= ent
,selects
,column
,col
= 0;
1295 WORD curlen
,endpos
,ni
,colwidth
,style
;
1303 if ((ent
< 0) || !data
->EntriesArray
[ent
]->Wrap
||
1304 (data
->EntriesArray
[ent
]->Wrap
& TE_Wrap_TmpLine
))
1307 if ((data
->EntriesArray
[ent
]->len
>= 0) && !force
&& (data
->EntriesArray
[ent1
]->dnum
> 0))
1309 ent
+= data
->EntriesArray
[ent1
]->dnum
;
1313 colmask
= data
->EntriesArray
[ent
]->Wrap
& TE_Wrap_TmpMask
;
1314 while((colmask
= colmask
>> 1))
1316 column
= NL_ColToColumn(data
,col
);
1318 if (data
->EntriesArray
[ent
]->len
< 0)
1319 selects
= data
->EntriesArray
[ent
]->pos
;
1321 selects
= NL_GetSelects(data
,ent
);
1323 data
->EntriesArray
[ent
]->PixLen
= -1;
1324 data
->EntriesArray
[ent
]->Wrap
&= TE_Wrap_TmpMask
;
1325 data
->EntriesArray
[ent
]->pos
= (WORD
) selects
;
1326 data
->EntriesArray
[ent
]->len
= -1;
1327 data
->EntriesArray
[ent
]->dnum
= 1;
1328 if (((selects
& 0x0001) && data
->multiselect
) || ((ent
== data
->NList_Active
) && (data
->multiselect
== MUIV_NList_MultiSelect_None
)))
1329 data
->EntriesArray
[ent
]->Select
= TE_Select_Line
;
1331 data
->EntriesArray
[ent
]->Select
= TE_Select_None
;
1333 if ((column
< 0) || (column
>= data
->numcols
))
1336 data
->EntriesArray
[ent
]->pos
= 0;
1338 cinfo
= data
->cols
[column
].c
;
1339 /*colwidth = cinfo->colwidth;*/
1340 colwidth
= cinfo
->dx
- 4;
1341 if (colwidth
< 3*data
->hinc
)
1342 colwidth
= 3*data
->hinc
;
1344 colmask
= data
->EntriesArray
[ent
]->Wrap
| TE_Wrap_TmpLine
;
1349 style
= data
->EntriesArray
[ent
]->style
;
1353 data
->EntriesArray
[ent
]->len
= -1;
1354 NL_GetDisplayArray(data
,ent
);
1355 ParseColumn(data
,column
,pen
);
1356 NL_Changed(data
,ent
);
1358 afinfo
= &data
->aff_infos
[ni
];
1363 while ((ni
<= cinfo
->ninfo
) && (afinfo
->len
> 0))
1365 if (curlen
> colwidth
)
1367 if (afinfo
->style
== STYLE_IMAGE
)
1368 curlen
+= afinfo
->len
+ 2;
1369 else if (afinfo
->style
== STYLE_IMAGE2
)
1370 curlen
+= afinfo
->len
+ 2;
1371 else if (afinfo
->style
== STYLE_TAB
)
1374 curlen
= ((((curlen
-1) / data
->tabsize
) + 1) * data
->tabsize
) + 1;
1375 if ((curlen
> colwidth
) && (ni
> 0) && (ni
< cinfo
->ninfo
))
1378 afinfo
= &data
->aff_infos
[ni
];
1382 else if ((afinfo
->style
== STYLE_FIXSPACE
) || (afinfo
->style
== STYLE_SPACE
))
1385 curlen
+= afinfo
->len
;
1386 if ((curlen
> colwidth
) && (ni
> 0) && (ni
< cinfo
->ninfo
))
1389 afinfo
= &data
->aff_infos
[ni
];
1395 WORD clen
= afinfo
->len
;
1396 WORD blanklen
= clen
;
1397 WORD oldcurlen
,difflen
;
1400 strptr
= (char *) afinfo
->strptr
;
1402 style
= afinfo
->style
;
1403 SetSoftStyle(data
->rp
, GET_STYLE(style
), STYLE_MASK
);
1404 TextExtent(data
->rp
, strptr
, clen
, &te
);
1405 if ((ni
== 0) && (te
.te_Extent
.MinX
< 0))
1406 curlen
-= te
.te_Extent
.MinX
;
1408 curlen
+= te
.te_Width
;
1409 if (te
.te_Extent
.MaxX
> te
.te_Width
)
1410 difflen
= te
.te_Extent
.MaxX
- te
.te_Width
;
1413 if ((clen
> 0) && ((curlen
+ difflen
) >= colwidth
))
1415 if (afinfo
->pos
< 0)
1422 while ((clen
> 0) && (curlen
>= colwidth
))
1425 while ((clen
> 0) && (strptr
[clen
] != ' '))
1431 TextExtent(data
->rp
, strptr
, clen
, &te
);
1432 if (te
.te_Extent
.MaxX
> te
.te_Width
)
1433 curlen
= oldcurlen
+ te
.te_Extent
.MaxX
;
1435 curlen
= oldcurlen
+ te
.te_Width
;
1437 if ((clen
<= 0) && (ni
== 0) && (blanklen
> 0))
1440 TextExtent(data
->rp
, strptr
, clen
, &te
);
1441 if (te
.te_Extent
.MaxX
> te
.te_Width
)
1442 curlen
= oldcurlen
+ te
.te_Extent
.MaxX
;
1444 curlen
= oldcurlen
+ te
.te_Width
;
1445 while ((clen
> 0) && (curlen
>= colwidth
))
1450 TextExtent(data
->rp
, strptr
, clen
, &te
);
1451 if (te
.te_Extent
.MaxX
> te
.te_Width
)
1452 curlen
= oldcurlen
+ te
.te_Extent
.MaxX
;
1454 curlen
= oldcurlen
+ te
.te_Width
;
1456 afinfo
->pos
+= clen
;
1460 endpos
= afinfo
->pos
+ clen
;
1462 afinfo
->pos
+= (clen
+ 1);
1468 if ((curlen
> colwidth
) && (ni
> 0))
1471 afinfo
= &data
->aff_infos
[ni
];
1474 if (afinfo
->pos
<= 0)
1475 data
->EntriesArray
[ent
]->len
= 0;
1476 else if (endpos
>= 0)
1477 data
->EntriesArray
[ent
]->len
= endpos
- data
->EntriesArray
[ent
]->pos
;
1479 data
->EntriesArray
[ent
]->len
= afinfo
->pos
- data
->EntriesArray
[ent
]->pos
;
1483 if ((ni
> cinfo
->ninfo
) || (afinfo
->len
<= 0) || (afinfo
->pos
< 0))
1485 if (IS_ALIGN_JUSTIFY(data
->EntriesArray
[ent
]->style
))
1487 SET_ALIGN_LEFT(data
->EntriesArray
[ent
]->style
);
1495 if ((ent
>= data
->NList_Entries
) || !(data
->EntriesArray
[ent
]->Wrap
& TE_Wrap_TmpLine
))
1497 if (!NL_InsertTmpLine(data
,ent
))
1502 selects
= selects
>> 1;
1503 if (((selects
& 0x0001) && data
->multiselect
) || ((ent
== data
->NList_Active
) && (data
->multiselect
== MUIV_NList_MultiSelect_None
)))
1504 data
->EntriesArray
[ent
]->Select
= TE_Select_Line
;
1506 data
->EntriesArray
[ent
]->Select
= TE_Select_None
;
1507 data
->EntriesArray
[ent
]->PixLen
= -1;
1508 data
->EntriesArray
[ent
]->Wrap
= colmask
;
1509 data
->EntriesArray
[ent
]->pos
= afinfo
->pos
;
1510 data
->EntriesArray
[ent
]->len
= -2;
1511 data
->EntriesArray
[ent
]->style
= style
;
1512 data
->EntriesArray
[ent
]->Entry
= (APTR
)pen
;
1513 data
->EntriesArray
[ent
]->dnum
= dnum
;
1515 data
->EntriesArray
[ent1
]->dnum
= dnum
;
1516 SetSoftStyle(data
->rp
, 0, STYLE_MASK
);
1517 while ((ent
< data
->NList_Entries
) && (data
->EntriesArray
[ent
]->Wrap
& TE_Wrap_TmpLine
))
1518 NL_DeleteTmpLine(data
,ent
);
1524 void NL_DoWrapAll(struct NLData
*data
,BOOL force
,BOOL update
)
1526 LONG entorig
= data
->NList_Entries
;
1529 if (!data
->do_wwrap
|| !data
->EntriesArray
|| data
->do_setcols
)
1531 else if (!data
->SHOW
|| !data
->DRAW
|| data
->NList_Quiet
|| data
->NList_Disabled
)
1535 while (ent
< data
->NList_Entries
)
1537 if (data
->EntriesArray
[ent
]->Wrap
& TE_Wrap_TmpLine
)
1540 data
->EntriesArray
[ent
]->len
= -2;
1542 else if (data
->EntriesArray
[ent
]->Wrap
)
1543 len
= data
->EntriesArray
[ent
]->len
;
1550 else if (!data
->DRAW
)
1553 if (data
->force_wwrap
)
1556 while (ent
< data
->NList_Entries
)
1558 if (data
->EntriesArray
[ent
]->Wrap
& TE_Wrap_TmpLine
)
1560 NL_DeleteTmpLine(data
,ent
);
1561 NL_SegChanged(data
,ent
,data
->NList_Entries
);
1562 data
->do_draw
= TRUE
;
1564 else if (data
->EntriesArray
[ent
]->Wrap
)
1566 if ((data
->EntriesArray
[ent
]->len
< 0) || force
|| (data
->EntriesArray
[ent
]->dnum
< 1))
1568 ent
= NL_DoWrapLine(data
,ent
,force
);
1569 if (data
->NList_Entries
!= entorig
)
1570 NL_SegChanged(data
,ent
,data
->NList_Entries
);
1571 data
->do_draw
= TRUE
;
1574 ent
+= data
->EntriesArray
[ent
]->dnum
;
1579 if (data
->NList_Entries
!= entorig
)
1581 data
->do_updatesb
= TRUE
;
1582 DO_NOTIFY(NTF_Entries
|NTF_MinMax
);
1584 if ((data
->NList_First
> 0) && (data
->NList_First
+ data
->NList_Visible
>= data
->NList_Entries
))
1586 data
->NList_First
= data
->NList_Entries
- data
->NList_Visible
;
1587 if (data
->NList_First
< 0)
1588 data
->NList_First
= 0;
1589 DO_NOTIFY(NTF_First
);
1591 data
->do_wwrap
= data
->force_wwrap
= FALSE
;
1594 data
->do_updatesb
= TRUE
;
1596 /* do_notifies(NTF_AllChanges|NTF_MinMax);*/
1601 static void WidthColumns(struct NLData
*data
,LONG ent
,WORD updinfo
)
1605 //D(bug( "%ld - Calling NL_GDA() width %ld entries!\n", __LINE__, ent ));
1607 /* sba: was > 1 but in this case the images weren't parsed */
1608 if ( data
->numcols
> 0 )
1610 NL_GetDisplayArray(data
,ent
);
1612 for (column
= 0;column
< data
->numcols
;column
++) /* sba: was (data->numcols-1) */
1613 { if (DontDoColumn(data
,ent
,column
))
1616 ParseColumn(data
,column
,0);
1618 WidthColumn(data
,column
,updinfo
);
1624 void AllWidthColumns(struct NLData
*data
)
1630 ** We must omit this, because floattext will be broken if not.
1632 //if ( data->numcols > 1 )
1634 data
->display_ptr
= NULL
;
1635 data
->parse_column
= -1;
1636 for (column
= 0;column
< data
->numcols
;column
++)
1637 //for (column = 0;column < ( data->numcols - 1 );column++)
1638 { data
->cols
[column
].c
->colwidthmax
= 4;
1639 data
->cols
[column
].c
->dx
= 4;
1641 if (data
->NList_Title
)
1642 WidthColumns(data
,-1,0);
1643 if (data
->EntriesArray
)
1644 { for (ent
= 0;ent
< data
->NList_Entries
;ent
++)
1645 WidthColumns(data
,ent
,0);
1647 data
->display_ptr
= NULL
;
1648 data
->parse_column
= -1;
1653 void NL_SetColsAdd(struct NLData
*data
,LONG ent
,WORD addimages
)
1657 //if ( !data->NList_Pause )
1660 { if (data
->adding_member
!= 2)
1661 data
->adding_member
= 1;
1664 data
->adding_member
= 3;
1666 data
->display_ptr
= NULL
;
1667 data
->parse_column
= -1;
1668 if ((ent
== -2) || (ent
== -3))
1669 { for (column
= 0;column
< data
->numcols
;column
++)
1670 { data
->cols
[column
].c
->colwidthbiggest
= -1;
1671 data
->cols
[column
].c
->colwidthbiggest2
= -1;
1672 data
->cols
[column
].c
->colwidthbiggestptr
= -2;
1673 data
->cols
[column
].c
->colwidthbiggestptr2
= -2;
1674 data
->cols
[column
].c
->colwidthmax
= 4;
1675 data
->cols
[column
].c
->dx
= 4;
1676 data
->Title_PixLen
= -1;
1677 if (((data
->cols
[column
].c
->width
== -1) || (data
->cols
[column
].c
->minwidth
== -1)) && (data
->cols
[column
].c
->userwidth
== -1))
1678 data
->do_setcols
= TRUE
;
1681 if (data
->NList_Title
)
1682 WidthColumns(data
,-1,1);
1684 if (data
->EntriesArray
)
1688 for (ent
= 0;ent
< data
->NList_Entries
;ent
++)
1689 WidthColumns(data
,ent
,1);
1691 else /* -3 == Recalculate only visible (cs@aphaso.de) */
1693 for (ent
= data
->NList_First
; ent
< ( data
->NList_First
+ data
->NList_Visible
); ent
++ )
1694 WidthColumns(data
,ent
,1);
1697 data
->display_ptr
= NULL
;
1698 data
->parse_column
= -1;
1702 //D(bug( "%ld - Calling WidthColumns() width entry %ld!\n", __LINE__, ent ));
1703 if (data
->SETUP
!= 3)
1704 WidthColumns(data
,ent
,1);
1708 GetNImage_End(data
);
1710 data
->do_images
= TRUE
;
1712 data
->do_setcols
= TRUE
;
1717 void NL_SetColsRem(struct NLData
*data
,LONG ent
)
1721 //if ( !data->NList_Pause )
1723 if (!data
->SHOW
|| (ent
== -2))
1724 { data
->parse_column
= -1;
1725 data
->display_ptr
= NULL
;
1726 for (column
= 0;column
< data
->numcols
;column
++)
1727 { data
->cols
[column
].c
->colwidthbiggest
= -1;
1728 data
->cols
[column
].c
->colwidthbiggest2
= -1;
1729 data
->cols
[column
].c
->colwidthbiggestptr
= -2;
1730 data
->cols
[column
].c
->colwidthbiggestptr2
= -2;
1731 data
->cols
[column
].c
->colwidthmax
= 4;
1732 data
->cols
[column
].c
->dx
= 4;
1733 data
->Title_PixLen
= -1;
1734 if (((data
->cols
[column
].c
->width
== -1) || (data
->cols
[column
].c
->minwidth
== -1)) && (data
->cols
[column
].c
->userwidth
== -1))
1735 data
->do_setcols
= TRUE
;
1738 data
->do_setcols
= TRUE
;
1742 //D(bug( "%ld - Calling WidthColumns() width entry %ld!\n", __LINE__, ent ));
1744 if (data
->SETUP
!= 3)
1745 WidthColumns(data
,ent
,2);
1748 data
->Title_PixLen
= -1;