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
;
959 ni
++; afinfo
= &data
->aff_infos
[ni
];
964 ni
++; afinfo
= &data
->aff_infos
[ni
];
971 void WidthColumn(struct NLData
*data
,WORD column
,WORD updinfo
)
973 struct colinfo
*cinfo
= data
->cols
[column
].c
;
974 struct affinfo
*afinfo
;
979 struct TextExtent te
;
980 BOOL text_last
= FALSE
;
981 BOOL is_text
= FALSE
;
985 { cinfo
->colwidthbiggest
= -2;
986 cinfo
->colwidthbiggest2
= -2;
987 cinfo
->colwidthbiggestptr
= -2;
988 cinfo
->colwidthbiggestptr2
= -2;
989 if (cinfo
->userwidth
== -1)
990 data
->do_setcols
= TRUE
;
991 data
->do_images
= TRUE
;
1002 afinfo
= &data
->aff_infos
[ni
];
1004 while ((ni
<= cinfo
->ninfo
) && (afinfo
->len
> 0))
1007 if (afinfo
->style
== STYLE_IMAGE
)
1008 curlen
+= afinfo
->len
+ 2;
1009 else if (afinfo
->style
== STYLE_IMAGE2
)
1010 curlen
+= afinfo
->len
+ 2;
1011 else if (afinfo
->style
== STYLE_TAB
)
1012 { curlen
= ((((curlen
-1) / data
->tabsize
) + 1) * data
->tabsize
) + 1;
1017 else if ((afinfo
->style
== STYLE_FIXSPACE
) || (afinfo
->style
== STYLE_SPACE
))
1018 { curlen
+= afinfo
->len
;
1023 { SetSoftStyle(data
->rp
, GET_STYLE(afinfo
->style
), STYLE_MASK
);
1024 TextExtent(data
->rp
, afinfo
->strptr
, afinfo
->len
, &te
);
1025 curlen
+= te
.te_Width
;
1026 if ((ni
== 0) && (te
.te_Extent
.MinX
< 0))
1027 curlen
-= te
.te_Extent
.MinX
;
1028 numchar
+= afinfo
->len
;
1033 afinfo
= &data
->aff_infos
[ni
];
1036 { if (text_last
&& (te
.te_Extent
.MaxX
> te
.te_Width
))
1037 curlen
+= (te
.te_Extent
.MaxX
- te
.te_Width
);
1039 cinfo
->colwidth
= curlen
;
1041 cinfo
->colwidth
= curlen
;
1042 SetSoftStyle(data
->rp
, 0, STYLE_MASK
);
1044 if (!data
->DRAW
|| data
->do_setcols
)
1046 else if (IS_ALIGN_CENTER(cinfo
->style
))
1047 cinfo
->xoffset
= (cinfo
->dx
- cinfo
->colwidth
)/2;
1048 else if (IS_ALIGN_RIGHT(cinfo
->style
))
1049 cinfo
->xoffset
= cinfo
->dx
- 1 - cinfo
->colwidth
;
1050 else if (IS_ALIGN_JUSTIFY(cinfo
->style
))
1051 { WORD diff
= cinfo
->dx
- 1 - cinfo
->colwidth
;
1054 { UBYTE addchar
= 0;
1057 if ((numchar
> 0) && (numinfo
> 0))
1058 numinfo
+= AddSpaceInfos(data
,column
,ni1
);
1062 if ((diff
> numinfo
) && (numinfo
> 0))
1067 if ((diff
> numinfo
) && (numinfo
> 0))
1072 if ((diff
> numchar
) && (numchar
> 0) && (addchar
< data
->hinc
/3) && (addchar
< data
->spacesize
))
1077 if ((diff
> numinfo
) && (numinfo
> 0))
1082 if ((diff
> numchar
) && (numchar
> 0) && (addchar
< data
->hinc
/3) && (addchar
< data
->spacesize
))
1088 if ((addchar
> 0) || (addinfo
> 0) || (diff
> 0))
1089 { ni
= ni1
; afinfo
= &data
->aff_infos
[ni
];
1090 while ((ni
<= cinfo
->ninfo
) && (afinfo
->len
> 0))
1091 { afinfo
->addchar
= addchar
;
1092 if (ni
< cinfo
->ninfo
)
1093 { afinfo
->addinfo
= addinfo
;
1099 ni
++; afinfo
= &data
->aff_infos
[ni
];
1102 cinfo
->colwidth
+= (numchar
* addchar
) + (numinfo
* addinfo
);
1107 if (cinfo
->xoffset
< 0)
1109 colwidth
= cinfo
->colwidth
+ 2;
1110 if ((data
->parse_ent
== -1) &&
1111 (((data
->NList_TitleMark
& MUIV_NList_TitleMark_TypeMask
) != MUIV_NList_TitleMark_None
) ||
1112 ((data
->NList_TitleMark2
& MUIV_NList_TitleMark2_TypeMask
) != MUIV_NList_TitleMark2_None
)))
1115 if (colwidth
> cinfo
->colwidthmax
)
1116 cinfo
->colwidthmax
= colwidth
;
1122 if ((colwidth
> cinfo
->colwidthbiggest
) && (cinfo
->colwidthbiggest
>= -1))
1123 { cinfo
->colwidthbiggest2
= cinfo
->colwidthbiggest
;
1124 cinfo
->colwidthbiggestptr2
= cinfo
->colwidthbiggestptr
;
1125 cinfo
->colwidthbiggest
= colwidth
;
1126 cinfo
->colwidthbiggestptr
= (IPTR
) data
->display_ptr
;
1127 if (((cinfo
->width
== -1) || (cinfo
->minwidth
== -1)) && (cinfo
->userwidth
== -1))
1128 data
->do_setcols
= TRUE
;
1130 else if ((colwidth
> cinfo
->colwidthbiggest2
) && (cinfo
->colwidthbiggest2
>= -1))
1131 { cinfo
->colwidthbiggest2
= colwidth
;
1132 cinfo
->colwidthbiggestptr2
= (SIPTR
) data
->display_ptr
;
1137 if (((colwidth
> cinfo
->colwidthbiggest
) && (cinfo
->colwidthbiggest
>= -1)) ||
1138 (cinfo
->colwidthbiggestptr
== (SIPTR
) data
->display_ptr
))
1140 cinfo
->colwidthbiggestptr
= cinfo
->colwidthbiggestptr2
;
1141 cinfo
->colwidthbiggest
= cinfo
->colwidthbiggest2
;
1142 cinfo
->colwidthbiggestptr2
= -2;
1143 cinfo
->colwidthbiggest2
= -2;
1144 if (((cinfo
->width
== -1) || (cinfo
->minwidth
== -1)) && (cinfo
->userwidth
== -1))
1145 { if (cinfo
->colwidthbiggest
< 0)
1146 { cinfo
->colwidthbiggestptr
= -2;
1147 cinfo
->colwidthbiggest
= -2;
1149 data
->do_setcols
= TRUE
;
1152 else if ((IPTR
)cinfo
->colwidthbiggestptr2
== (IPTR
) data
->display_ptr
)
1154 cinfo
->colwidthbiggest2
= -2;
1155 cinfo
->colwidthbiggestptr2
= -2;
1162 void FindCharInColumn(struct NLData
*data
,LONG ent
,WORD column
,WORD xoffset
,WORD
*charxoffset
,WORD
*charnum
)
1164 struct colinfo
*cinfo
= data
->cols
[column
].c
;
1165 struct affinfo
*afinfo
;
1167 struct TextExtent te
;
1169 if (DontDoColumn(data
,ent
,column
) || !data
->DRAW
|| data
->do_setcols
)
1171 *charxoffset
= xoffset
;
1175 NL_GetDisplayArray(data
,ent
);
1176 ParseColumn(data
,column
,0);
1177 WidthColumn(data
,column
,0);
1179 curx
= cinfo
->xoffset
;
1182 afinfo
= &data
->aff_infos
[ni
];
1186 *charxoffset
= xoffset
- curx
;
1189 while ((ni
<= cinfo
->ninfo
) && (afinfo
->len
> 0))
1191 if (afinfo
->style
== STYLE_IMAGE
)
1192 { curx
+= afinfo
->len
+ afinfo
->addinfo
+ 2;
1194 { *charnum
= afinfo
->pos
;
1195 *charxoffset
= xoffset
- curx2
;
1196 if (*charxoffset
> afinfo
->len
/2)
1197 *charxoffset
= xoffset
- curx
;
1198 if (data
->storebutton
&& ((LONG
)afinfo
->button
>= 0))
1200 data
->affimage
= afinfo
->imgnum
; // RHP: Added for Special Shorthelp
1201 data
->affbutton
= afinfo
->button
;
1202 data
->affbuttonline
= ent
;
1203 data
->affbuttoncol
= column
;
1204 data
->affbuttonstate
= 0;
1205 data
->storebutton
= FALSE
;
1210 else if (afinfo
->style
== STYLE_IMAGE2
)
1211 { curx
+= afinfo
->len
+ afinfo
->addinfo
+ 2;
1213 { *charnum
= afinfo
->pos
;
1214 *charxoffset
= xoffset
- curx2
;
1215 if (*charxoffset
> afinfo
->len
/2)
1216 *charxoffset
= xoffset
- curx
;
1217 if (data
->storebutton
&& ((LONG
)afinfo
->button
>= 0))
1219 data
->affimage
= afinfo
->imgnum
; // RHP: Added for Special Shorthelp
1220 data
->affbutton
= afinfo
->button
;
1221 data
->affbuttonline
= ent
;
1222 data
->affbuttoncol
= column
;
1223 data
->affbuttonstate
= 0;
1224 data
->storebutton
= FALSE
;
1229 else if (afinfo
->style
== STYLE_TAB
)
1230 { curx
= ((((curx
-cinfo
->xoffset
) / data
->tabsize
) + 1) * data
->tabsize
) + cinfo
->xoffset
;
1232 { *charnum
= afinfo
->pos
;
1233 *charxoffset
= xoffset
- curx2
;
1234 if (*charxoffset
> curx
- xoffset
)
1235 *charxoffset
= xoffset
- curx
;
1239 else if ((afinfo
->style
== STYLE_FIXSPACE
) || (afinfo
->style
== STYLE_SPACE
))
1240 { curx
+= afinfo
->len
+ afinfo
->addinfo
+ afinfo
->addchar
;
1242 { *charnum
= afinfo
->pos
;
1243 *charxoffset
= xoffset
- curx2
;
1244 if (*charxoffset
> afinfo
->len
/2)
1245 *charxoffset
= xoffset
- curx
;
1250 { SetSoftStyle(data
->rp
, GET_STYLE(afinfo
->style
), STYLE_MASK
);
1251 data
->rp
->TxSpacing
= afinfo
->addchar
;
1252 TextExtent(data
->rp
, afinfo
->strptr
, afinfo
->len
, &te
);
1253 curx
+= te
.te_Width
+ afinfo
->addinfo
;
1254 if ((ni
== 0) && (te
.te_Extent
.MinX
< 0))
1255 { curx
-= te
.te_Extent
.MinX
;
1256 curx2
-= te
.te_Extent
.MinX
;
1259 { WORD curx3
= curx2
;
1262 strptr
= (char *) afinfo
->strptr
;
1263 while (pos
< afinfo
->len
)
1265 TextExtent(data
->rp
, &strptr
[pos
], 1, &te
);
1266 curx3
+= te
.te_Width
;
1267 if (xoffset
< curx3
)
1268 { *charnum
= afinfo
->pos
+ pos
;
1269 *charxoffset
= xoffset
- curx2
;
1270 if (*charxoffset
> curx3
- xoffset
)
1271 *charxoffset
= xoffset
- curx3
;
1272 data
->rp
->TxSpacing
= 0;
1277 *charnum
= afinfo
->pos
+ pos
;
1278 *charxoffset
= xoffset
- curx
;
1279 data
->rp
->TxSpacing
= 0;
1282 data
->rp
->TxSpacing
= 0;
1285 afinfo
= &data
->aff_infos
[ni
];
1287 SetSoftStyle(data
->rp
, 0, STYLE_MASK
);
1289 *charxoffset
= xoffset
- curx
;
1293 static LONG
NL_DoWrapLine(struct NLData
*data
,LONG ent
,BOOL force
)
1295 struct colinfo
*cinfo
;
1296 struct affinfo
*afinfo
;
1297 struct TextExtent te
;
1298 LONG ent1
= ent
,selects
,column
,col
= 0;
1299 WORD curlen
,endpos
,ni
,colwidth
,style
;
1307 if ((ent
< 0) || !data
->EntriesArray
[ent
]->Wrap
||
1308 (data
->EntriesArray
[ent
]->Wrap
& TE_Wrap_TmpLine
))
1311 if ((data
->EntriesArray
[ent
]->len
>= 0) && !force
&& (data
->EntriesArray
[ent1
]->dnum
> 0))
1313 ent
+= data
->EntriesArray
[ent1
]->dnum
;
1317 colmask
= data
->EntriesArray
[ent
]->Wrap
& TE_Wrap_TmpMask
;
1318 while((colmask
= colmask
>> 1))
1320 column
= NL_ColToColumn(data
,col
);
1322 if (data
->EntriesArray
[ent
]->len
< 0)
1323 selects
= data
->EntriesArray
[ent
]->pos
;
1325 selects
= NL_GetSelects(data
,ent
);
1327 data
->EntriesArray
[ent
]->PixLen
= -1;
1328 data
->EntriesArray
[ent
]->Wrap
&= TE_Wrap_TmpMask
;
1329 data
->EntriesArray
[ent
]->pos
= (WORD
) selects
;
1330 data
->EntriesArray
[ent
]->len
= -1;
1331 data
->EntriesArray
[ent
]->dnum
= 1;
1332 if (((selects
& 0x0001) && data
->multiselect
) || ((ent
== data
->NList_Active
) && (data
->multiselect
== MUIV_NList_MultiSelect_None
)))
1333 data
->EntriesArray
[ent
]->Select
= TE_Select_Line
;
1335 data
->EntriesArray
[ent
]->Select
= TE_Select_None
;
1337 if ((column
< 0) || (column
>= data
->numcols
))
1340 data
->EntriesArray
[ent
]->pos
= 0;
1342 cinfo
= data
->cols
[column
].c
;
1343 /*colwidth = cinfo->colwidth;*/
1344 colwidth
= cinfo
->dx
- 4;
1345 if (colwidth
< 3*data
->hinc
)
1346 colwidth
= 3*data
->hinc
;
1348 colmask
= data
->EntriesArray
[ent
]->Wrap
| TE_Wrap_TmpLine
;
1353 style
= data
->EntriesArray
[ent
]->style
;
1357 data
->EntriesArray
[ent
]->len
= -1;
1358 NL_GetDisplayArray(data
,ent
);
1359 ParseColumn(data
,column
,pen
);
1360 NL_Changed(data
,ent
);
1362 afinfo
= &data
->aff_infos
[ni
];
1367 while ((ni
<= cinfo
->ninfo
) && (afinfo
->len
> 0))
1369 if (curlen
> colwidth
)
1371 if (afinfo
->style
== STYLE_IMAGE
)
1372 curlen
+= afinfo
->len
+ 2;
1373 else if (afinfo
->style
== STYLE_IMAGE2
)
1374 curlen
+= afinfo
->len
+ 2;
1375 else if (afinfo
->style
== STYLE_TAB
)
1378 curlen
= ((((curlen
-1) / data
->tabsize
) + 1) * data
->tabsize
) + 1;
1379 if ((curlen
> colwidth
) && (ni
> 0) && (ni
< cinfo
->ninfo
))
1382 afinfo
= &data
->aff_infos
[ni
];
1386 else if ((afinfo
->style
== STYLE_FIXSPACE
) || (afinfo
->style
== STYLE_SPACE
))
1389 curlen
+= afinfo
->len
;
1390 if ((curlen
> colwidth
) && (ni
> 0) && (ni
< cinfo
->ninfo
))
1393 afinfo
= &data
->aff_infos
[ni
];
1399 WORD clen
= afinfo
->len
;
1400 WORD blanklen
= clen
;
1401 WORD oldcurlen
,difflen
;
1404 strptr
= (char *) afinfo
->strptr
;
1406 style
= afinfo
->style
;
1407 SetSoftStyle(data
->rp
, GET_STYLE(style
), STYLE_MASK
);
1408 TextExtent(data
->rp
, strptr
, clen
, &te
);
1409 if ((ni
== 0) && (te
.te_Extent
.MinX
< 0))
1410 curlen
-= te
.te_Extent
.MinX
;
1412 curlen
+= te
.te_Width
;
1413 if (te
.te_Extent
.MaxX
> te
.te_Width
)
1414 difflen
= te
.te_Extent
.MaxX
- te
.te_Width
;
1417 if ((clen
> 0) && ((curlen
+ difflen
) >= colwidth
))
1419 if (afinfo
->pos
< 0)
1426 while ((clen
> 0) && (curlen
>= colwidth
))
1429 while ((clen
> 0) && (strptr
[clen
] != ' '))
1435 TextExtent(data
->rp
, strptr
, clen
, &te
);
1436 if (te
.te_Extent
.MaxX
> te
.te_Width
)
1437 curlen
= oldcurlen
+ te
.te_Extent
.MaxX
;
1439 curlen
= oldcurlen
+ te
.te_Width
;
1441 if ((clen
<= 0) && (ni
== 0) && (blanklen
> 0))
1444 TextExtent(data
->rp
, strptr
, clen
, &te
);
1445 if (te
.te_Extent
.MaxX
> te
.te_Width
)
1446 curlen
= oldcurlen
+ te
.te_Extent
.MaxX
;
1448 curlen
= oldcurlen
+ te
.te_Width
;
1449 while ((clen
> 0) && (curlen
>= colwidth
))
1454 TextExtent(data
->rp
, strptr
, clen
, &te
);
1455 if (te
.te_Extent
.MaxX
> te
.te_Width
)
1456 curlen
= oldcurlen
+ te
.te_Extent
.MaxX
;
1458 curlen
= oldcurlen
+ te
.te_Width
;
1460 afinfo
->pos
+= clen
;
1464 endpos
= afinfo
->pos
+ clen
;
1466 afinfo
->pos
+= (clen
+ 1);
1472 if ((curlen
> colwidth
) && (ni
> 0))
1475 afinfo
= &data
->aff_infos
[ni
];
1478 if (afinfo
->pos
<= 0)
1479 data
->EntriesArray
[ent
]->len
= 0;
1480 else if (endpos
>= 0)
1481 data
->EntriesArray
[ent
]->len
= endpos
- data
->EntriesArray
[ent
]->pos
;
1483 data
->EntriesArray
[ent
]->len
= afinfo
->pos
- data
->EntriesArray
[ent
]->pos
;
1487 if ((ni
> cinfo
->ninfo
) || (afinfo
->len
<= 0) || (afinfo
->pos
< 0))
1489 if (IS_ALIGN_JUSTIFY(data
->EntriesArray
[ent
]->style
))
1491 SET_ALIGN_LEFT(data
->EntriesArray
[ent
]->style
);
1499 if ((ent
>= data
->NList_Entries
) || !(data
->EntriesArray
[ent
]->Wrap
& TE_Wrap_TmpLine
))
1501 if (!NL_InsertTmpLine(data
,ent
))
1506 selects
= selects
>> 1;
1507 if (((selects
& 0x0001) && data
->multiselect
) || ((ent
== data
->NList_Active
) && (data
->multiselect
== MUIV_NList_MultiSelect_None
)))
1508 data
->EntriesArray
[ent
]->Select
= TE_Select_Line
;
1510 data
->EntriesArray
[ent
]->Select
= TE_Select_None
;
1511 data
->EntriesArray
[ent
]->PixLen
= -1;
1512 data
->EntriesArray
[ent
]->Wrap
= colmask
;
1513 data
->EntriesArray
[ent
]->pos
= afinfo
->pos
;
1514 data
->EntriesArray
[ent
]->len
= -2;
1515 data
->EntriesArray
[ent
]->style
= style
;
1516 data
->EntriesArray
[ent
]->Entry
= (APTR
)pen
;
1517 data
->EntriesArray
[ent
]->dnum
= dnum
;
1519 data
->EntriesArray
[ent1
]->dnum
= dnum
;
1520 SetSoftStyle(data
->rp
, 0, STYLE_MASK
);
1521 while ((ent
< data
->NList_Entries
) && (data
->EntriesArray
[ent
]->Wrap
& TE_Wrap_TmpLine
))
1522 NL_DeleteTmpLine(data
,ent
);
1528 void NL_DoWrapAll(struct NLData
*data
,BOOL force
,BOOL update
)
1530 LONG entorig
= data
->NList_Entries
;
1533 if (!data
->do_wwrap
|| !data
->EntriesArray
|| data
->do_setcols
)
1535 else if (!data
->SHOW
|| !data
->DRAW
|| data
->NList_Quiet
|| data
->NList_Disabled
)
1539 while (ent
< data
->NList_Entries
)
1541 if (data
->EntriesArray
[ent
]->Wrap
& TE_Wrap_TmpLine
)
1544 data
->EntriesArray
[ent
]->len
= -2;
1546 else if (data
->EntriesArray
[ent
]->Wrap
)
1547 len
= data
->EntriesArray
[ent
]->len
;
1554 else if (!data
->DRAW
)
1557 if (data
->force_wwrap
)
1560 while (ent
< data
->NList_Entries
)
1562 if (data
->EntriesArray
[ent
]->Wrap
& TE_Wrap_TmpLine
)
1564 NL_DeleteTmpLine(data
,ent
);
1565 NL_SegChanged(data
,ent
,data
->NList_Entries
);
1566 data
->do_draw
= TRUE
;
1568 else if (data
->EntriesArray
[ent
]->Wrap
)
1570 if ((data
->EntriesArray
[ent
]->len
< 0) || force
|| (data
->EntriesArray
[ent
]->dnum
< 1))
1572 ent
= NL_DoWrapLine(data
,ent
,force
);
1573 if (data
->NList_Entries
!= entorig
)
1574 NL_SegChanged(data
,ent
,data
->NList_Entries
);
1575 data
->do_draw
= TRUE
;
1578 ent
+= data
->EntriesArray
[ent
]->dnum
;
1583 if (data
->NList_Entries
!= entorig
)
1585 data
->do_updatesb
= TRUE
;
1586 DO_NOTIFY(NTF_Entries
|NTF_MinMax
);
1588 if ((data
->NList_First
> 0) && (data
->NList_First
+ data
->NList_Visible
>= data
->NList_Entries
))
1590 data
->NList_First
= data
->NList_Entries
- data
->NList_Visible
;
1591 if (data
->NList_First
< 0)
1592 data
->NList_First
= 0;
1593 DO_NOTIFY(NTF_First
);
1595 data
->do_wwrap
= data
->force_wwrap
= FALSE
;
1598 data
->do_updatesb
= TRUE
;
1600 /* do_notifies(NTF_AllChanges|NTF_MinMax);*/
1605 static void WidthColumns(struct NLData
*data
,LONG ent
,WORD updinfo
)
1609 //D(bug( "%ld - Calling NL_GDA() width %ld entries!\n", __LINE__, ent ));
1611 /* sba: was > 1 but in this case the images weren't parsed */
1612 if ( data
->numcols
> 0 )
1614 NL_GetDisplayArray(data
,ent
);
1616 for (column
= 0;column
< data
->numcols
;column
++) /* sba: was (data->numcols-1) */
1617 { if (DontDoColumn(data
,ent
,column
))
1620 ParseColumn(data
,column
,0);
1622 WidthColumn(data
,column
,updinfo
);
1628 void AllWidthColumns(struct NLData
*data
)
1634 ** We must omit this, because floattext will be broken if not.
1636 //if ( data->numcols > 1 )
1638 data
->display_ptr
= NULL
;
1639 data
->parse_column
= -1;
1640 for (column
= 0;column
< data
->numcols
;column
++)
1641 //for (column = 0;column < ( data->numcols - 1 );column++)
1642 { data
->cols
[column
].c
->colwidthmax
= 4;
1643 data
->cols
[column
].c
->dx
= 4;
1645 if (data
->NList_Title
)
1646 WidthColumns(data
,-1,0);
1647 if (data
->EntriesArray
)
1648 { for (ent
= 0;ent
< data
->NList_Entries
;ent
++)
1649 WidthColumns(data
,ent
,0);
1651 data
->display_ptr
= NULL
;
1652 data
->parse_column
= -1;
1657 void NL_SetColsAdd(struct NLData
*data
,LONG ent
,WORD addimages
)
1661 //if ( !data->NList_Pause )
1664 { if (data
->adding_member
!= 2)
1665 data
->adding_member
= 1;
1668 data
->adding_member
= 3;
1670 data
->display_ptr
= NULL
;
1671 data
->parse_column
= -1;
1672 if ((ent
== -2) || (ent
== -3))
1673 { for (column
= 0;column
< data
->numcols
;column
++)
1674 { data
->cols
[column
].c
->colwidthbiggest
= -1;
1675 data
->cols
[column
].c
->colwidthbiggest2
= -1;
1676 data
->cols
[column
].c
->colwidthbiggestptr
= -2;
1677 data
->cols
[column
].c
->colwidthbiggestptr2
= -2;
1678 data
->cols
[column
].c
->colwidthmax
= 4;
1679 data
->cols
[column
].c
->dx
= 4;
1680 data
->Title_PixLen
= -1;
1681 if (((data
->cols
[column
].c
->width
== -1) || (data
->cols
[column
].c
->minwidth
== -1)) && (data
->cols
[column
].c
->userwidth
== -1))
1682 data
->do_setcols
= TRUE
;
1685 if (data
->NList_Title
)
1686 WidthColumns(data
,-1,1);
1688 if (data
->EntriesArray
)
1692 for (ent
= 0;ent
< data
->NList_Entries
;ent
++)
1693 WidthColumns(data
,ent
,1);
1695 else /* -3 == Recalculate only visible (cs@aphaso.de) */
1697 for (ent
= data
->NList_First
; ent
< ( data
->NList_First
+ data
->NList_Visible
); ent
++ )
1698 WidthColumns(data
,ent
,1);
1701 data
->display_ptr
= NULL
;
1702 data
->parse_column
= -1;
1706 //D(bug( "%ld - Calling WidthColumns() width entry %ld!\n", __LINE__, ent ));
1707 if (data
->SETUP
!= 3)
1708 WidthColumns(data
,ent
,1);
1712 GetNImage_End(data
);
1714 data
->do_images
= TRUE
;
1716 data
->do_setcols
= TRUE
;
1721 void NL_SetColsRem(struct NLData
*data
,LONG ent
)
1725 //if ( !data->NList_Pause )
1727 if (!data
->SHOW
|| (ent
== -2))
1728 { data
->parse_column
= -1;
1729 data
->display_ptr
= NULL
;
1730 for (column
= 0;column
< data
->numcols
;column
++)
1731 { data
->cols
[column
].c
->colwidthbiggest
= -1;
1732 data
->cols
[column
].c
->colwidthbiggest2
= -1;
1733 data
->cols
[column
].c
->colwidthbiggestptr
= -2;
1734 data
->cols
[column
].c
->colwidthbiggestptr2
= -2;
1735 data
->cols
[column
].c
->colwidthmax
= 4;
1736 data
->cols
[column
].c
->dx
= 4;
1737 data
->Title_PixLen
= -1;
1738 if (((data
->cols
[column
].c
->width
== -1) || (data
->cols
[column
].c
->minwidth
== -1)) && (data
->cols
[column
].c
->userwidth
== -1))
1739 data
->do_setcols
= TRUE
;
1742 data
->do_setcols
= TRUE
;
1746 //D(bug( "%ld - Calling WidthColumns() width entry %ld!\n", __LINE__, ent ));
1748 if (data
->SETUP
!= 3)
1749 WidthColumns(data
,ent
,2);
1752 data
->Title_PixLen
= -1;