grub2: bring back build of aros-side grub2 tools
[AROS.git] / workbench / classes / zune / nlist / nlist_mcc / NList_mcc3.c
blob9aba6072b7b2fa31fc81cc21e1d04edf2c348b70
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 <stdlib.h>
28 #include <graphics/gfxmacros.h>
29 #undef GetOutlinePen
31 #include <clib/alib_protos.h>
32 #include <proto/muimaster.h>
33 #include <proto/graphics.h>
34 #include <proto/layers.h>
35 #include <proto/intuition.h>
37 #include "private.h"
39 #include "NList_func.h"
40 #include "NListviews_mcp.h"
42 void NL_SetObjInfos(struct NLData *data,BOOL setall)
44 Object *obj = data->this;
45 WORD vdheight;
47 if (data->do_draw_all || data->format_chge || data->do_setcols || (data->rp != _rp(obj)) ||
48 (data->left != _left(obj)) || (data->top != _top(obj)) || (data->MinImageHeight > data->vinc) ||
49 (data->width != _width(obj)) || (data->height != _height(obj)))
51 WORD vpos = data->vpos;
52 WORD mtop = data->mtop;
53 WORD mleft = data->mleft;
54 WORD mheight = data->mheight;
55 WORD mwidth = data->mwidth;
56 WORD vtop = data->vtop;
57 WORD vleft = data->vleft;
58 WORD vheight = data->vheight;
59 WORD vwidth = data->vwidth;
60 WORD vinc = data->vinc;
62 data->rp = _rp(obj);
63 data->font = _font(obj);
64 data->pens = _pens(obj);
66 data->left = _left(obj);
67 data->top = _top(obj);
68 data->width = _width(obj);
69 data->height = _height(obj);
71 data->vinc = data->font->tf_YSize + data->addvinc;
72 if (data->NList_MinLineHeight > data->vinc)
73 data->vinc = data->NList_MinLineHeight;
74 if (data->MinImageHeight > data->vinc)
75 { data->vinc = data->MinImageHeight;
76 mheight = -1;
78 if (data->vinc < 2)
79 data->vinc = 2;
80 if ((vinc > 1) && (vinc != data->vinc))
81 { DO_NOTIFY(NTF_MinMax | NTF_LineHeight);
84 data->voff = data->font->tf_Baseline + (data->vinc - data->font->tf_YSize + 1)/2;
86 if (setall)
88 struct TextExtent te;
90 ReSetFont;
91 data->hinc = 0;
92 SetSoftStyle(data->rp, FSF_BOLD|FSF_ITALIC, STYLE_MASK);
93 TextExtent(data->rp, "m", 1, &te);
94 if (data->hinc < te.te_Width)
95 data->hinc = te.te_Width;
96 SetSoftStyle(data->rp, FSF_BOLD|FSF_ITALIC, STYLE_MASK);
97 TextExtent(data->rp, "M", 1, &te);
98 if (data->hinc < te.te_Width)
99 data->hinc = te.te_Width;
100 SetSoftStyle(data->rp, FSF_BOLD|FSF_ITALIC, STYLE_MASK);
101 TextExtent(data->rp, "w", 1, &te);
102 if (data->hinc < te.te_Width)
103 data->hinc = te.te_Width;
104 SetSoftStyle(data->rp, FSF_BOLD|FSF_ITALIC, STYLE_MASK);
105 TextExtent(data->rp, "W", 1, &te);
106 if (data->hinc < te.te_Width)
107 data->hinc = te.te_Width;
108 SetSoftStyle(data->rp, 0, STYLE_MASK);
109 TextExtent(data->rp, " ", 1, &te);
110 data->spacesize = te.te_Width;
112 data->tabsize = data->spacesize * data->NList_TabSize;
113 if (data->tabsize < 4)
114 data->tabsize = 4;
116 if (data->NList_PartialChar)
117 data->NList_PartialChar = (data->hinc > 0) ? data->hinc : 10;
119 data->mleft = _mleft(obj);
120 data->mright = _mright(obj);
121 data->mwidth = _mwidth(obj);
122 data->mtop = _mtop(obj);
123 data->mbottom = _mbottom(obj);
125 if (data->VirtGroup)
127 Object *o = data->VirtGroup;
128 struct IClass *ocl;
130 data->vleft = _mleft(o);
131 data->vright = _mright(o);
132 data->vtop = _mtop(o);
133 data->vbottom = _mbottom(o);
135 data->vdx = -data->mleft;
136 data->vdy = -data->mtop;
138 /* (mri_Flags & 0x20000000) if in a virtgroup */
139 /* (mri_Flags & 0x40000000) if it is a virtgroup */
140 o = data->VirtGroup2;
141 if(o == data->VirtGroup)
142 o = (Object *)xget(o, MUIA_Parent);
144 while(o)
146 ocl = OCLASS(o);
148 while (ocl)
150 if (ocl == data->VirtClass)
152 if (data->VirtGroup2 == data->VirtGroup)
153 data->VirtGroup2 = o;
155 if (data->vleft < _mleft(o)) data->vleft = _mleft(o);
156 if (data->vright > _mright(o)) data->vright = _mright(o);
157 if (data->vtop < _mtop(o)) data->vtop = _mtop(o);
158 if (data->vbottom > _mbottom(o)) data->vbottom = _mbottom(o);
159 ocl = NULL;
161 else
162 ocl = ocl->cl_Super;
165 if(o)
166 o = (Object *)xget(o, MUIA_Parent);
169 if (data->VirtGroup2 == data->VirtGroup)
170 data->VirtGroup2 = NULL;
171 if (data->vleft < data->mleft) data->vleft = data->mleft;
172 if (data->vright > data->mright) data->vright = data->mright;
173 if (data->vtop < data->mtop) data->vtop = data->mtop;
174 if (data->vbottom > data->mbottom) data->vbottom = data->mbottom;
175 data->vwidth = data->vright - data->vleft + 1;
176 data->vheight = data->vbottom - data->vtop + 1;
178 else
180 data->vleft = _mleft(obj);
181 data->vright = _mright(obj);
182 data->vtop = _mtop(obj);
183 data->vbottom = _mbottom(obj);
184 data->vwidth = _mwidth(obj);
185 data->vheight = _mheight(obj);
186 data->vdx = 0;
187 data->vdy = 0;
190 data->hpos = data->mleft;
191 data->hvisible = data->mright - data->mleft;
192 data->mheight = _mheight(obj);
193 if (data->NList_Title)
194 { data->mheight -= data->vinc;
195 if (data->NList_TitleSeparator)
196 data->mheight -= 2;
199 data->lvisible = data->mheight / data->vinc;
200 vdheight = (data->mheight - data->lvisible * data->vinc);
202 /* Set vertical delta top, if text should be centered vertically */
203 if (data->NList_VerticalCenteredText)
204 data->vdt = vdheight / 2;
205 else
206 data->vdt = 0;
208 data->vdb = vdheight - data->vdt;
209 data->vdtpos = data->mtop;
210 if (data->NList_Title)
212 data->vdtitlepos = data->vdtpos;
213 data->vdtitleheight = data->vdt + data->vinc;
214 } else
216 data->vdtitlepos = data->vdtpos + data->vdt;
217 data->vdtitleheight = data->vinc / 3;
219 data->vdbpos = data->mbottom + 1 - data->vdb;
221 /* calculate the vertical top position of the first line of the list */
222 data->vpos = data->mtop + data->vdt;
223 if (data->NList_Title)
225 data->vpos += data->vinc;
226 if (data->NList_TitleSeparator)
227 data->vpos += 2;
230 data->badrport = FALSE;
231 data->NList_Visible = data->lvisible;
233 if ((mwidth != data->mwidth))
234 data->do_wwrap = data->force_wwrap = TRUE;
236 if ((mwidth != data->mwidth) || data->format_chge || data->do_draw_all)
238 data->do_draw_all = data->do_draw = data->do_draw_title = data->do_updatesb = TRUE;
239 data->do_setcols = TRUE;
240 data->Title_PixLen = -1;
241 data->ScrollBarsPos = -2;
242 if (data->NList_AdjustWidth)
243 data->NList_AdjustWidth = -1;
244 NOWANT_NOTIFY(NTF_MinMaxNoDraw);
246 else
248 if (WANTED_NOTIFY(NTF_MinMaxNoDraw) && (vpos == data->vpos) &&
249 (mtop == data->mtop) && (mleft == data->mleft) &&
250 (vtop == data->vtop) && (vleft == data->vleft) &&
251 (vheight == data->vheight) && (vwidth == data->vwidth))
254 else if (mheight != data->mheight)
256 data->do_draw_all = data->do_draw = data->do_draw_title = data->do_updatesb = TRUE;
257 data->Title_PixLen = -1;
258 data->ScrollBarsPos = -2;
259 NOWANT_NOTIFY(NTF_MinMaxNoDraw);
262 data->drawall_bits = 0;
263 data->format_chge = 0;
268 static void DrawAdjustBar(struct NLData *data,WORD draw)
270 WORD hfirst = data->NList_Horiz_AffFirst & ~1;
271 WORD hfirsthpos = hfirst - data->hpos;
272 WORD adjbar;
273 Object *obj = data->this;
275 if (draw)
277 if ((data->adjustbar == -2) || ((data->adjustbar == -3) && (draw == 2)))
279 if (data->NList_Title && (data->adjustcolumn < data->numcols) && (data->adjustcolumn >= 0))
281 WORD minx = (data->cols[data->adjustcolumn].c->minx - hfirsthpos);
282 WORD maxx = (data->cols[data->adjustcolumn].c->maxx - hfirsthpos);
283 WORD maxy = data->vdtitlepos + data->vdtitleheight;
284 BOOL draw_left = TRUE;
285 BOOL draw_right = TRUE;
287 if (!data->NList_TitleSeparator)
288 maxy--;
289 if (data->adjustcolumn > 0)
290 minx -= (data->cols[data->adjustcolumn-1].c->delta - (((data->cols[data->adjustcolumn-1].c->delta-1) / 2) + 1));
291 maxx += ((data->cols[data->adjustcolumn].c->delta-1) / 2);
292 if (data->adjustcolumn == data->numcols-1)
293 maxx--;
294 if (minx < data->mleft)
296 minx = data->mleft;
297 draw_left = FALSE;
299 if (maxx > data->mright)
301 maxx = data->mright;
302 if (IS_BAR(data->adjustcolumn,data->cols[data->adjustcolumn].c) || (maxx < (data->Title_PixLen - hfirsthpos)))
303 draw_right = FALSE;
305 if ((maxx - minx) >= 1)
307 SetAPen(data->rp,data->pens[MPEN_SHINE]);
308 Move(data->rp, minx, maxy);
309 Draw(data->rp, maxx, maxy);
310 if (draw_right)
311 Draw(data->rp, maxx, data->vdtitlepos + 1);
312 SetAPen(data->rp,data->pens[MPEN_SHADOW]);
313 Move(data->rp, maxx, data->vdtitlepos);
314 Draw(data->rp, minx, data->vdtitlepos);
315 if (draw_left)
316 Draw(data->rp, minx, maxy);
317 SetAPen(data->rp,data->pens[MPEN_SHINE]);
318 data->adjustbar_old = data->adjustbar;
319 data->adjustbar = -3;
323 else if ((data->adjustbar >= 0) && ((data->adjustbar_old == -1) || (draw == 2)))
325 adjbar = data->adjustbar - hfirsthpos;
326 if ((adjbar < data->mleft) || (adjbar >= data->mright))
327 data->adjustbar_old = -1;
328 else
330 if (data->NList_ColWidthDrag == MUIV_NList_ColWidthDrag_Visual)
333 else if (data->NList_ColWidthDrag == MUIV_NList_ColWidthDrag_All)
335 SetAPen(data->rp,data->pens[MPEN_SHADOW]);
336 Move(data->rp, adjbar+1, data->vdtitlepos);
337 Draw(data->rp, adjbar+1, data->vdbpos - 1);
338 SetAPen(data->rp,data->pens[MPEN_SHINE]);
339 Move(data->rp, adjbar, data->vdtitlepos);
340 Draw(data->rp, adjbar, data->vdbpos - 1);
342 else if (data->NList_Title)
344 SetAPen(data->rp,data->pens[MPEN_SHADOW]);
345 Move(data->rp, adjbar+1, data->vdtitlepos);
346 Draw(data->rp, adjbar+1, data->vdtitlepos + data->vdtitleheight - 1);
347 SetAPen(data->rp,data->pens[MPEN_SHINE]);
348 Move(data->rp, adjbar, data->vdtitlepos);
349 Draw(data->rp, adjbar, data->vdtitlepos + data->vdtitleheight - 1);
351 else
353 SetAPen(data->rp,data->pens[MPEN_SHADOW]);
354 Move(data->rp, adjbar+1, data->vpos);
355 Draw(data->rp, adjbar+1, data->vpos + data->vinc - 1);
356 SetAPen(data->rp,data->pens[MPEN_SHINE]);
357 Move(data->rp, adjbar, data->vpos);
358 Draw(data->rp, adjbar, data->vpos + data->vinc - 1);
360 data->adjustbar_old = data->adjustbar;
364 else
366 APTR clippinghandle = NULL;
368 if (data->NList_Title && (data->adjustbar_old <= -2) && ((data->adjustbar == -1) || (data->adjustbar <= -4)))
370 if ((data->adjustcolumn < data->numcols) && (data->adjustcolumn >= 0))
372 WORD minx = (data->cols[data->adjustcolumn].c->minx - hfirsthpos);
373 WORD maxx = (data->cols[data->adjustcolumn].c->maxx - hfirsthpos);
375 if (data->adjustcolumn > 0)
376 minx -= (data->cols[data->adjustcolumn-1].c->delta - (((data->cols[data->adjustcolumn-1].c->delta-1) / 2) + 1));
377 maxx += ((data->cols[data->adjustcolumn].c->delta-1) / 2);
378 if (minx < data->mleft)
379 minx = data->mleft;
380 if (maxx > data->mright)
381 maxx = data->mright;
382 if ((maxx - minx) > 0)
384 WORD height = data->vdtitleheight;
386 maxx++;
387 if (data->NList_TitleSeparator)
388 height++;
389 clippinghandle = MUI_AddClipping(muiRenderInfo(obj),(WORD) minx,data->vdtitlepos,(WORD) (maxx-minx),height);
390 DrawTitle(data,minx,maxx,hfirst);
391 MUI_RemoveClipping(muiRenderInfo(obj),clippinghandle);
394 data->adjustbar_old = -1;
396 else if (data->adjustbar_old >= 0)
398 adjbar = data->adjustbar_old - hfirsthpos;
399 if (adjbar < data->mleft)
401 adjbar = data->mleft;
402 data->adjustbar_old = adjbar + hfirsthpos;
404 else if (adjbar >= data->mright)
406 adjbar = data->mright - 1;
407 data->adjustbar_old = adjbar + hfirsthpos;
409 if (data->NList_ColWidthDrag == MUIV_NList_ColWidthDrag_Visual)
412 else if (data->NList_ColWidthDrag == MUIV_NList_ColWidthDrag_All)
414 clippinghandle = MUI_AddClipping(muiRenderInfo(obj),(WORD) adjbar,data->vdtitlepos,(WORD) 2,(WORD) (data->vdbpos - data->vdtitlepos));
415 DrawLines(data,data->NList_AffFirst,data->NList_AffFirst+data->NList_Visible,adjbar,adjbar+2,hfirst,0,1,TRUE,0);
416 if (data->NList_Title)
417 DrawTitle(data,adjbar,adjbar+2,hfirst);
418 MUI_RemoveClipping(muiRenderInfo(obj),clippinghandle);
420 else if (data->NList_Title)
422 clippinghandle = MUI_AddClipping(muiRenderInfo(obj),(WORD) adjbar,data->vdtitlepos,(WORD) 2,data->vdtitleheight);
423 DrawTitle(data,adjbar,adjbar+2,hfirst);
424 MUI_RemoveClipping(muiRenderInfo(obj),clippinghandle);
426 else
428 clippinghandle = MUI_AddClipping(muiRenderInfo(obj),(WORD) adjbar,data->vpos,(WORD) 2,data->vinc);
429 DrawLines(data,data->NList_AffFirst,data->NList_AffFirst+1,adjbar,adjbar+2,hfirst,0,1,TRUE,0);
430 MUI_RemoveClipping(muiRenderInfo(obj),clippinghandle);
432 data->adjustbar_old = -1;
439 * struct ClipRect *cr;
440 * struct RegionRectangle *rr;
441 * struct Region *reg;
442 * LONG MinX,MinY,MaxX,MaxY;
443 * LONG mleft,mright,mtop,mbottom;
445 * mleft = data->mleft + ((LONG) _window(obj)->LeftEdge);
446 * mright = data->mright + ((LONG) _window(obj)->LeftEdge);
447 * mtop = data->mtop + ((LONG) _window(obj)->TopEdge);
448 * mbottom = data->mbottom + ((LONG) _window(obj)->TopEdge);
449 * D(bug("%lx|Object >(%ld,%ld / %ld,%ld)\n",obj,mleft,mtop,mright,mbottom));
451 * cr = _window(obj)->WLayer->ClipRect;
452 * while (cr)
453 * { MinX = (LONG) cr->bounds.MinX;MinY = (LONG) cr->bounds.MinY;MaxX = (LONG) cr->bounds.MaxX;MaxY = (LONG) cr->bounds.MaxY;
454 * D(bug("%lx|CR %ld %ld,%ld / %ld,%ld\n",obj,one_more,MinX,MinY,MaxX,MaxY));
455 * one_more++;cr = cr->Next;
457 * one_more = 0;
459 * cr = _window(obj)->WLayer->_cliprects;
460 * while (cr)
461 * { MinX = (LONG) cr->bounds.MinX;MinY = (LONG) cr->bounds.MinY;MaxX = (LONG) cr->bounds.MaxX;MaxY = (LONG) cr->bounds.MaxY;
462 * D(bug("%lx|_cr %ld %ld,%ld / %ld,%ld\n",obj,one_more,MinX,MinY,MaxX,MaxY));
463 * one_more++;cr = cr->Next;
465 * one_more = 0;
467 * cr = _window(obj)->WLayer->SuperClipRect;
468 * while (cr)
469 * { MinX = (LONG) cr->bounds.MinX;MinY = (LONG) cr->bounds.MinY;MaxX = (LONG) cr->bounds.MaxX;MaxY = (LONG) cr->bounds.MaxY;
470 * D(bug("%lx|SuperClipRect %ld>%ld,%ld / %ld,%ld\n",obj,one_more,MinX,MinY,MaxX,MaxY));
471 * one_more++;cr = cr->Next;
473 * one_more = 0;
475 * reg = _window(obj)->WLayer->ClipRegion;
476 * if (reg)
477 * { MinX = (LONG) reg->bounds.MinX;MinY = (LONG) reg->bounds.MinY;MaxX = (LONG) reg->bounds.MaxX;MaxY = (LONG) reg->bounds.MaxY;
478 * D(bug("%lx|ClipRegion %ld>%ld,%ld / %ld,%ld\n",obj,one_more,MinX,MinY,MaxX,MaxY));
479 * one_more++;rr = reg->RegionRectangle;
480 * while (rr)
481 * { MinX = (LONG) rr->bounds.MinX;MinY = (LONG) rr->bounds.MinY;MaxX = (LONG) rr->bounds.MaxX;MaxY = (LONG) rr->bounds.MaxY;
482 * D(bug("%lx|ClipRegion %ld>%ld,%ld / %ld,%ld\n",obj,one_more,MinX,MinY,MaxX,MaxY));
483 * one_more++;rr = rr->Next;
486 * one_more = 0;
489 #define LayerDamaged(l) ((l)->DamageList && (l)->DamageList->RegionRectangle)
491 #define LayerCovered(l) ((!(l)->ClipRect) || ((l)->ClipRect->bounds.MaxX != (l)->bounds.MaxX) ||\
492 ((l)->ClipRect->bounds.MinX != (l)->bounds.MinX) ||\
493 ((l)->ClipRect->bounds.MaxY != (l)->bounds.MaxY) ||\
494 ((l)->ClipRect->bounds.MinY != (l)->bounds.MinY))
497 static ULONG DrawRefresh(struct NLData *data)
499 Object *obj = data->this;
500 APTR clippinghandle = NULL;
501 struct RegionRectangle *rr;
502 struct Region *reg;
503 WORD sX,sY,MinX,MinY,MaxX,MaxY;
504 WORD mleft,mright,mtop,mbottom,mwidth,mheight;
505 WORD hfirst = data->NList_Horiz_AffFirst & ~1;
508 * if ((data->left != _left(obj)) || (data->top != _top(obj)) ||
509 * (data->width != _width(obj)) || (data->height != _height(obj)))
511 * LONG ml = (LONG) _mleft(obj);
512 * LONG mt = (LONG) _top(obj);
513 * D(bug("%lx|ml=%ld (%ld) mt=%ld (%ld)\n",obj,ml,data->mleft,mt,data->top));
514 * NL_SetObjInfos(data,FALSE);
518 LockLayer( 0, _window(obj)->WLayer );
519 reg = _window(obj)->WLayer->DamageList;
520 if (reg)
521 { sX = reg->bounds.MinX;
522 sY = reg->bounds.MinY;
523 mleft = reg->bounds.MaxX;
524 mtop = reg->bounds.MaxY;
525 mright = sX;
526 mbottom = sY;
527 rr = reg->RegionRectangle;
528 while (rr)
529 { MinX = sX + rr->bounds.MinX;
530 MinY = sY + rr->bounds.MinY;
531 MaxX = sX + rr->bounds.MaxX;
532 MaxY = sY + rr->bounds.MaxY;
533 if ((MinX < data->mright) || (MaxX > data->mleft) ||
534 (MinY < data->mbottom) || (MaxY > data->mtop))
536 if (MinX < mleft) mleft = MinX;
537 if (MinY < mtop) mtop = MinY;
538 if (MaxX > mright) mright = MaxX;
539 if (MaxY > mbottom) mbottom = MaxY;
541 rr = rr->Next;
543 UnlockLayer( _window(obj)->WLayer );
545 if ((mleft < data->mright) || (mright > data->mleft) ||
546 (mtop < data->mbottom) || (mbottom > data->mtop))
547 { if (mleft < data->mleft) mleft = data->mleft;
548 if (mtop < data->mtop) mtop = data->mtop;
549 if (mright > data->mright) mright = data->mright;
550 if (mbottom > data->mbottom) mbottom = data->mbottom;
552 if ((mleft <= mright) && (mtop <= mbottom))
554 BOOL clipped = FALSE;
555 WORD ly1, ly2;
556 WORD lyl1=0;
557 WORD lyl2=0;
559 mright++;
560 mbottom++;
562 mwidth = mright - mleft;
563 mheight = mbottom - mtop;
565 ly1 = (mtop - data->vpos);
566 ly2 = (mbottom - data->vpos);
567 if (ly2 > 0)
569 lyl1 = ly1 / data->vinc;
570 lyl2 = ly2 / data->vinc;
571 if (data->NList_PartialChar ||
572 ((data->NList_First_Incr) && ((lyl1 <= 0) || (lyl2 >= data->NList_Visible))))
573 { clippinghandle = MUI_AddClipping(muiRenderInfo(obj),(WORD) data->mleft,mtop,(WORD) data->mwidth,mheight);
574 clipped = TRUE;
576 if (lyl1 < 0) lyl1 = 0;
577 if (lyl2 >= data->NList_Visible)
578 lyl2 = data->NList_Visible - 1;
579 if (data->NList_First_Incr)
580 lyl2++;
581 lyl2++;
582 lyl1 += data->NList_First;
583 lyl2 += data->NList_First;
585 ReSetFont;
586 SetBackGround(data->NList_ListBackGround)
587 if ((data->vdt > 0) && !data->NList_Title && (ly1 < 0))
588 DrawBackground(obj, mleft, data->vdtpos, mwidth, data->vdt, data->vdx, data->vdy);
589 if (data->vdb > 0)
590 DrawBackground(obj, mleft, data->vdbpos, mwidth, data->vdb, data->vdx, data->vdy);
591 if (data->NList_Title && (ly1 < 0))
592 DrawTitle(data,mleft,mright,hfirst);
595 if (ly2 > 0)
596 DrawLines(data,lyl1,lyl2,mleft,mright,hfirst,0,1,TRUE,0);
598 if (clipped)
599 MUI_RemoveClipping(muiRenderInfo(obj),clippinghandle);
600 DrawAdjustBar(data,2);
601 SetBackGround(data->NList_ListBackGround);
604 * else
605 * D(bug("%lx|no usable rect\n",obj));
609 else
610 UnlockLayer( _window(obj)->WLayer );
612 return(0);
616 IPTR mNL_Draw(struct IClass *cl,Object *obj,struct MUIP_Draw *msg)
618 struct NLData *data = INST_DATA(cl,obj);
620 if (data->drawsuper)
622 struct MUIP_Draw mymsg;
623 mymsg.MethodID = MUIM_Draw;
624 mymsg.flags = 0;
625 /*D(bug("%lx|drawsuper1 %lx %lx %lx\n",obj,msg->flags,muiAreaData(obj)->mad_Flags,muiAreaData(data->drawsuper)->mad_Flags));*/
626 DoMethodA((Object *)data->drawsuper, (Msg)(void*)&mymsg);
627 /*D(bug("%lx|drawsuper2 %lx %lx %lx\n",obj,msg->flags,muiAreaData(obj)->mad_Flags,muiAreaData(data->drawsuper)->mad_Flags));*/
628 msg->flags = 0;
629 return(0);
632 if (data->nodraw || !data->SHOW)
634 /*D(bug("%lx|nodraw \n",obj));*/
635 msg->flags = 0;
636 return(0);
639 if (WANTED_NOTIFY(NTF_MinMaxNoDraw) && !data->do_draw_all && !data->do_draw)
641 NL_SetObjInfos(data,FALSE);
642 if (WANTED_NOTIFY(NTF_MinMaxNoDraw))
644 msg->flags = 0;
645 return(0);
649 /*D(bug("%lx|draw1=%ld\n",obj,data->DRAW));*/
650 if (data->actbackground == -1)
651 { SetBackGround(data->NList_ListBackGround);
654 if (data->NList_Disabled)
655 { data->DRAW = 1;
656 data->do_draw = FALSE;
657 data->do_draw_all = FALSE;
658 data->do_draw_active = FALSE;
659 data->do_draw_title = FALSE;
660 data->first_change = LONG_MAX;
661 data->last_change = LONG_MIN;
662 data->minx_change_entry = -1;
663 data->maxx_change_entry = -1;
664 if ((muiAreaData(obj)->mad_Flags & MADF_DRAWOBJECT) ||
665 (data->NList_Disabled < 2))
667 NL_SetObjInfos(data,FALSE);
668 data->NList_Disabled = 2;
669 DoSuperMethodA(cl,obj,(Msg)msg);
672 return (0);
675 if (data->DragRPort && (data->DragText || (data->DragEntry >= 0)))
677 DrawDragText(data,TRUE);
678 msg->flags = 0;
679 return (0);
682 data->DRAW++;
684 if(/*(data->refreshing != 2) && (data->DRAW > 1) &&*/
685 ((data->refreshing) ||
686 (muiRenderInfo(obj)->mri_Flags & MUIMRI_REFRESHMODE)))
687 // || (data->rp->Layer->Flags & LAYERREFRESH)))
688 // ((data->rp->Layer->Flags & LAYERREFRESH) && !(data->do_draw_all && data->do_draw))))
690 /*D(bug("%lx|Refresh %ld %ld %ld %ld %lx %lx\n",obj,data->DRAW,data->do_draw_all,data->do_draw,(LONG)data->refreshing,(LONG)(muiRenderInfo(obj)->mri_Flags & MUIMRI_REFRESHMODE),(LONG)(data->rp->Layer->Flags & LAYERREFRESH)));*/
691 /* Avoid Superclass to draw anything *in* the object */
692 if (muiRenderInfo(obj)->mri_Flags & MUIMRI_REFRESHMODE)
694 #ifndef __AROS__
695 muiAreaData(obj)->mad_Flags &= ~0x00000001;
696 #else
697 /* "AROS: FIXME: No frame drawn if doing: muiAreaData(obj)->mad_Flags &= ~0x00000001;" This is still valid 16.01.2012 */
698 #endif
699 DoSuperMethodA(cl,obj,(Msg) msg);
701 DrawRefresh(data);
703 * data->do_draw = FALSE;
704 * data->do_draw_all = FALSE;
705 * data->do_draw_active = FALSE;
706 * data->do_draw_title = FALSE;
707 * data->first_change = LONG_MAX;
708 * data->last_change = LONG_MIN;
709 * data->minx_change_entry = -1;
710 * data->maxx_change_entry = -1;
712 if (data->DRAW > 1)
713 data->DRAW--;
714 return (0);
717 *else if (data->refreshing)
718 *D(bug("%lx|Refresh rejected %ld %ld %ld %ld %lx %lx\n",obj,data->DRAW,data->do_draw_all,data->do_draw,(LONG)data->refreshing,(LONG)(muiRenderInfo(obj)->mri_Flags & MUIMRI_REFRESHMODE),(LONG)(data->rp->Layer->Flags & LAYERREFRESH)));
721 if (muiAreaData(obj)->mad_Flags & MADF_DRAWOBJECT)
722 data->do_draw_all = TRUE;
724 if (NL_UpdateScrollers(data,FALSE))
725 { msg->flags = 0;
726 if (data->DRAW > 1)
727 data->DRAW--;
728 return (0);
730 data->UpdateScrollersRedrawn = TRUE;
733 /* Avoid Superclass to draw anything *in* the object */
734 #ifndef __AROS__
735 muiAreaData(obj)->mad_Flags &= ~0x00000001;
736 #else
737 /* "AROS: FIXME: No frame drawn if doing: muiAreaData(obj)->mad_Flags &= ~0x00000001;" This is still valid 16.01.2012 */
738 #endif
739 DoSuperMethodA(cl,obj,(Msg) msg);
741 /*D(bug("%lx|Draw %lx %lx\n",obj,msg->flags,muiAreaData(obj)->mad_Flags));*/
744 LONG ent, ent2;
745 APTR fullclippinghandle = NULL;
746 APTR clippinghandle = NULL;
747 WORD hmax,linelen,hfirst;
748 LONG LPFirst,LPVisible,LPEntries;
749 LONG one_more = 0;
751 * LONG vfyl,vlyl;
753 BOOL need_refresh = FALSE;
754 BOOL draw_all_force;
755 BOOL fullclipped = FALSE;
757 if (data->do_draw_all)
758 draw_all_force = TRUE;
759 else
760 draw_all_force = FALSE;
762 if (!(msg->flags & MADF_DRAWOBJECT) && !(msg->flags & MADF_DRAWUPDATE) && !data->do_draw_all)
763 { if (data->DRAW > 1)
764 data->DRAW--;
765 return (0);
769 * if (muiRenderInfo(obj)->mri_Flags & MUIMRI_REFRESHMODE)
770 * D(bug("MUIMRI_REFRESHMODE (do_draw_all=%ld)\n",data->do_draw_all));
773 ReSetFont;
775 if (data->do_draw_all)
777 /*data->do_draw_all = TRUE;*/
778 data->do_draw_title = TRUE;
779 data->drawall_bits = 0;
780 data->NList_First_Incr = 0;
781 data->minx_change_entry = -1;
782 data->maxx_change_entry = -1;
784 else if ((data->rp->Layer->Flags & LAYERREFRESH) || (msg->flags & MADF_DRAWOBJECT))
786 data->do_draw_all = TRUE;
787 data->do_draw_title = TRUE;
788 data->drawall_bits = 0;
789 data->minx_change_entry = -1;
790 data->maxx_change_entry = -1;
793 if ((data->NList_First_Incr < 0) || (data->NList_First_Incr >= data->vinc))
794 data->NList_First_Incr = 0;
796 LPFirst = data->NList_First * data->vinc;
797 LPVisible = data->lvisible * data->vinc;
798 LPEntries = data->NList_Entries * data->vinc;
799 if (LPFirst + LPVisible > LPEntries)
800 LPEntries = LPFirst + LPVisible;
802 if (LPEntries != data->NList_Prop_Entries)
803 data->NList_Prop_Entries = LPEntries;
804 if (LPVisible != data->NList_Prop_Visible)
805 data->NList_Prop_Visible = LPVisible;
806 if (data->NList_First != data->NList_Prop_First / data->vinc)
807 { data->NList_Prop_First_Real = LPFirst;
808 data->NList_Prop_First_Prec = LPFirst;
809 data->NList_Prop_First = LPFirst;
812 if (data->NList_Horiz_First >= data->NList_Horiz_Entries)
813 data->NList_Horiz_First = data->NList_Horiz_Entries;
814 else if (data->NList_Horiz_First < 0)
815 data->NList_Horiz_First = 0;
816 hfirst = data->NList_Horiz_First & ~1;
818 if (!data->do_draw_all)
819 { if (data->markerase && (data->markerasenum >= 0))
820 { if (data->markerasenum < data->first_change)
821 data->first_change = data->markerasenum;
822 if (data->markerasenum > data->last_change)
823 data->last_change = data->markerasenum;
825 data->last_change += 1;
826 if (data->first_change < data->last_change)
827 { if ((data->NList_First != data->NList_AffFirst) ||
828 (data->NList_First_Incr != data->NList_AffFirst_Incr) ||
829 (hfirst != data->NList_Horiz_AffFirst))
830 { data->do_draw_all = TRUE;
831 data->NList_First_Incr = 0;
834 else if (((data->NList_First != data->NList_AffFirst) ||
835 (data->NList_First_Incr != data->NList_AffFirst_Incr)) &&
836 (hfirst != data->NList_Horiz_AffFirst))
837 { data->do_draw_all = TRUE;
838 data->NList_First_Incr = 0;
839 data->do_draw_title = TRUE;
841 else if ((data->NList_First != data->NList_AffFirst) || (data->NList_First_Incr != data->NList_AffFirst_Incr))
842 { if (data->NList_Prop_Visible < 180)
843 hmax = (data->NList_Visible * 7 / 8);
844 else if (data->NList_Prop_Visible < 360)
845 hmax = (data->NList_Visible * 6 / 8);
846 else
847 hmax = (data->NList_Visible * 5 / 8);
848 if (abs(data->NList_First - data->NList_AffFirst) > hmax)
849 { data->do_draw_all = TRUE;
850 data->NList_First_Incr = 0;
853 else if (hfirst != data->NList_Horiz_AffFirst)
854 { if (data->NList_Horiz_Visible < 180)
855 hmax = (data->NList_Horiz_Visible * 7 / 8);
856 else if (data->NList_Horiz_Visible < 360)
857 hmax = (data->NList_Horiz_Visible * 6 / 8);
858 else
859 hmax = (data->NList_Horiz_Visible * 5 / 8);
860 if (abs(hfirst - data->NList_Horiz_AffFirst) > hmax)
861 { data->do_draw_all = TRUE;
862 data->NList_First_Incr = 0;
863 data->do_draw_title = TRUE;
868 if (data->do_draw_all)
869 { data->NList_First_Incr = 0;
870 data->first_change = data->NList_First;
871 data->last_change = data->NList_First + data->NList_Visible;
874 if (data->NList_First_Incr)
875 one_more = 1;
877 NL_UpdateScrollersValues(data);
880 * if (data->first_change < data->last_change)
881 * D(bug("NL: mNL_Draw(%ld to %ld) \n",data->first_change,data->last_change));
882 * if (data->do_draw_all)
883 * D(bug("NL: mNL_Draw(do_draw_all) \n"));
884 * else if (data->do_draw_active)
885 * D(bug("NL: mNL_Draw(do_draw_active) \n"));
886 * else if (data->do_draw_title)
887 * D(bug("NL: mNL_Draw(do_draw_title) \n"));
888 * else if (data->NList_First != data->NList_AffFirst)
889 * D(bug("NL: mNL_Draw(NList_First) \n"));
890 * else if (hfirst != data->NList_Horiz_AffFirst)
891 * D(bug("NL: mNL_Draw(NList_Horiz_First) \n"));
892 * else
893 * D(bug("NL: mNL_Draw(redraw???) \n"));
896 if (data->NList_PartialChar)
898 fullclipped = TRUE;
899 fullclippinghandle = MUI_AddClipping(muiRenderInfo(obj),(WORD) data->vleft,(WORD) data->vtop,
900 (WORD) data->vwidth,(WORD) data->vheight);
903 if ((data->NList_Active != data->NList_AffActive) && !data->NList_TypeSelect)
905 data->do_draw_active = TRUE;
907 if (!(msg->flags & MADF_DRAWOBJECT))
909 LONG old_one_more = 0;
910 BOOL clipped = FALSE;
912 if(data->NList_AffFirst_Incr)
913 old_one_more = 1;
915 ent = data->NList_AffActive;
916 if((ent >= data->NList_AffFirst) && (ent < data->NList_AffFirst + data->NList_Visible + old_one_more))
918 if ((data->NList_AffFirst_Incr) && ((ent <= data->NList_AffFirst) || (ent >= data->NList_AffFirst + data->NList_Visible)))
920 clipped = TRUE;
921 clippinghandle = MUI_AddClipping(muiRenderInfo(obj),
922 (WORD) data->mleft,
923 (WORD) data->vpos,
924 (WORD) data->mwidth,
925 (WORD) (data->NList_Visible*data->vinc));
927 DrawOldLine(data,ent,PMIN,PMAX,hfirst);
929 if (clipped)
930 MUI_RemoveClipping(muiRenderInfo(obj),clippinghandle);
935 if (!data->do_draw_all && data->drawall_bits)
937 LONG tmp_hfirst = hfirst;
938 LONG tmp_NList_First = data->NList_First;
939 LONG tmp_NList_First_Incr = data->NList_First_Incr;
941 hfirst = data->NList_Horiz_AffFirst & ~1;
942 data->NList_First = data->NList_AffFirst;
943 data->NList_First_Incr = data->NList_AffFirst_Incr;
944 hmax = DrawLines(data,data->NList_First,data->NList_First + data->NList_Visible,PMIN,PMAX,hfirst,0,0,FALSE,data->drawall_bits);
945 data->drawall_bits = 0;
946 data->drawall_dobit = 0;
947 hfirst = tmp_hfirst;
948 data->NList_First = tmp_NList_First;
949 data->NList_First_Incr = tmp_NList_First_Incr;
951 data->ScrollBarsTime = SCROLLBARSTIME;
952 if (hmax > data->NList_Horiz_Entries)
953 data->NList_Horiz_Entries = hmax;
957 * vfyl = (data->vtop - data->vpos) / data->vinc;
958 * vlyl = ((data->vbottom - data->vpos) / data->vinc) + 1;
961 if (data->do_draw_all && data->do_draw_title && data->NList_Title/* && (vfyl <= 0)*/)
963 data->Title_PixLen = DrawTitle(data,PMIN,PMAX,hfirst);
965 if(data->Title_PixLen > data->NList_Horiz_Entries)
966 data->NList_Horiz_Entries = data->Title_PixLen;
968 data->do_draw_title = FALSE;
971 * if (data->first_change < data->last_change)
972 * { if (vfyl > data->first_change)
973 * data->first_change = vfyl;
974 * if (vlyl < data->last_change)
975 * data->last_change = vlyl;
978 if (data->first_change < data->last_change)
980 WORD not_all = 0;
981 BOOL clipped = FALSE;
983 data->drawall_bits = 0;
984 if(data->do_draw_all)
986 SetBackGround(data->NList_ListBackGround)
988 if((data->vdt > 0) && !data->NList_Title)
989 DrawBackground(obj, data->mleft, data->vdtpos, data->mwidth, data->vdt, data->vdx, data->vdy);
990 if(data->vdb > 0)
991 DrawBackground(obj, data->mleft, data->vdbpos, data->mwidth, data->vdb, data->vdx, data->vdy);
993 if(!data->dropping && !draw_all_force &&
994 ((abs(data->NList_First - data->NList_AffFirst) > (120 / data->vinc)) ||
995 (abs(hfirst - data->NList_Horiz_AffFirst) > 120)))
997 if (data->drawall_dobit == 1)
999 not_all = 2;
1000 data->drawall_dobit = 0;
1001 data->drawall_bits = 1;
1003 else if (data->drawall_dobit == 2)
1005 not_all = data->drawall_dobit = 1;
1006 data->drawall_bits = 2;
1010 else
1012 if (data->first_change < data->NList_First)
1013 data->first_change = data->NList_First;
1015 if (data->last_change >= data->NList_First + data->NList_Visible + one_more)
1016 data->last_change = data->NList_First + data->NList_Visible + one_more;
1019 if ((data->NList_First_Incr) && ((data->first_change <= data->NList_First) || (data->last_change >= data->NList_First + data->NList_Visible)))
1021 clipped = TRUE;
1022 clippinghandle = MUI_AddClipping(muiRenderInfo(obj),
1023 (WORD) data->mleft,
1024 (WORD) data->vpos,
1025 (WORD) data->mwidth,
1026 (WORD) (data->NList_Visible*data->vinc));
1029 hmax = DrawLines(data,data->first_change,data->last_change,PMIN,PMAX,hfirst,0,0,FALSE,not_all);
1031 if (clipped)
1032 MUI_RemoveClipping(muiRenderInfo(obj),clippinghandle);
1034 if (data->NList_Title && (data->Title_PixLen > hmax))
1035 hmax = data->Title_PixLen;
1036 if (hfirst + data->hvisible > hmax)
1037 hmax = hfirst + data->hvisible;
1038 if (data->do_draw_all)
1040 if ((data->drawall_bits) && (hmax != data->NList_Horiz_Entries))
1041 { data->NList_Horiz_Entries = hmax;
1042 data->ScrollBarsTime = SCROLLBARSTIME;
1044 else if (hmax != data->NList_Horiz_Entries)
1045 data->NList_Horiz_Entries = hmax;
1047 if (data->hvisible != data->NList_Horiz_Visible)
1048 data->NList_Horiz_Visible = data->hvisible;
1050 else
1052 if (hmax > data->NList_Horiz_Entries)
1053 data->NList_Horiz_Entries = hmax;
1056 data->NList_Horiz_AffFirst = hfirst;
1057 data->NList_AffFirst = data->NList_First;
1058 data->NList_AffFirst_Incr = data->NList_First_Incr;
1060 else if ((data->NList_First != data->NList_AffFirst) || (data->NList_First_Incr != data->NList_AffFirst_Incr))
1062 /*WORD dyl,fyl,lyl,dy,yl1,yl2,vpos;*/
1063 LONG dyl,fyl,lyl,dy,y1,y2,vpos,vbot;
1065 dyl = data->NList_First - data->NList_AffFirst;
1066 dy = dyl*data->vinc + (data->NList_First_Incr - data->NList_AffFirst_Incr);
1067 vpos = data->vpos;
1068 vbot = data->vpos + (data->NList_Visible * data->vinc) - 1;
1069 if (data->vtop > vpos)
1071 vpos = data->vtop;
1072 y1 = (vpos + data->NList_First_Incr - data->vpos);
1073 fyl = y1 / data->vinc;
1075 else
1077 y1 = data->NList_First_Incr;
1078 fyl = 0;
1081 if (data->vbottom < vbot)
1083 vbot = data->vbottom;
1084 y2 = (vbot + data->NList_First_Incr - data->vpos);
1085 lyl = y2 / data->vinc;
1087 else
1089 y2 = (vbot + data->NList_First_Incr - data->vpos);
1090 lyl = y2 / data->vinc;
1093 if (dy < 0)
1095 lyl = (y1 - dy) / data->vinc;
1097 else
1099 fyl = (y2 - dy) / data->vinc;
1101 lyl++;
1102 fyl += data->NList_First;
1103 lyl += data->NList_First;
1105 if (fyl <= lyl)
1108 * if ((_window(obj)->Flags & WFLG_REFRESHBITS) == WFLG_SIMPLE_REFRESH)
1109 * WaitTOF();
1111 ScrollVert(data,dy,LPVisible);
1112 need_refresh = TRUE;
1114 if (data->NList_First_Incr || data->NList_AffFirst_Incr)
1116 WORD dy2;
1118 if (dy < 0)
1120 dy2 = -dy;
1121 clippinghandle = MUI_AddClipping(muiRenderInfo(obj),
1122 (WORD) data->mleft,
1123 (WORD) vpos,
1124 (WORD) data->mwidth,
1125 (WORD) dy2);
1127 else
1129 dy2 = dy;
1130 clippinghandle = MUI_AddClipping(muiRenderInfo(obj),
1131 (WORD) data->mleft,
1132 (WORD) vbot + 1 - dy2,
1133 (WORD) data->mwidth,
1134 (WORD) dy2);
1136 DrawLines(data,fyl,lyl,PMIN,PMAX,hfirst,0,2,TRUE,0);
1137 MUI_RemoveClipping(muiRenderInfo(obj),clippinghandle);
1139 else
1140 DrawLines(data,fyl,lyl,PMIN,PMAX,hfirst,0,2,FALSE,0);
1142 hmax = 0;
1143 ent2 = data->NList_First + data->NList_Visible;
1144 if (ent2 > data->NList_Entries)
1145 ent2 = data->NList_Entries;
1146 ent = data->NList_First;
1147 while (ent < ent2)
1149 linelen = data->EntriesArray[ent]->PixLen;
1150 if (linelen > hmax)
1151 hmax = linelen;
1152 ent++;
1154 if (data->NList_Title && (data->Title_PixLen > hmax))
1155 hmax = data->Title_PixLen;
1156 if (hfirst + data->hvisible > hmax)
1157 hmax = hfirst + data->hvisible;
1158 if (hmax != data->NList_Horiz_Entries)
1159 data->NList_Horiz_Entries = hmax;
1160 if (data->hvisible != data->NList_Horiz_Visible)
1161 data->NList_Horiz_Visible = data->hvisible;
1162 data->NList_AffFirst = data->NList_First;
1163 data->NList_AffFirst_Incr = data->NList_First_Incr;
1166 else if (hfirst != data->NList_Horiz_AffFirst)
1168 LONG fyl,lyl;
1169 WORD dx,fx,lx;
1170 BOOL clipped = FALSE;
1172 dx = hfirst - data->NList_Horiz_AffFirst;
1173 if (dx < 0)
1175 fx = data->vleft;
1176 lx = fx - dx;
1177 if (lx > data->vright + 1) lx = data->vright + 1;
1179 else
1181 lx = data->vright + 1;
1182 fx = lx - dx;
1183 if (fx < data->vleft) fx = data->vleft;
1186 fyl = data->NList_First;
1187 lyl = data->NList_First+data->NList_Visible+one_more;
1189 * if (vfyl > fyl)
1190 * fyl = vfyl;
1191 * if (vlyl < lyl)
1192 * lyl = vlyl;
1193 * if ((fyl < lyl) || ((data->vdtitlepos < data->vbottom) && ((data->vdtitlepos + data->vdtitleheight) > data->vtop)))
1197 * if ((_window(obj)->Flags & WFLG_REFRESHBITS) == WFLG_SIMPLE_REFRESH)
1198 * WaitTOF();
1200 ScrollHoriz(data,dx,LPVisible);
1201 need_refresh = TRUE;
1203 if (data->NList_Title)
1204 data->Title_PixLen = DrawTitle(data,fx,lx,hfirst);
1206 /* if (fyl < lyl)*/
1208 if (data->NList_First_Incr)
1210 clipped = TRUE;
1211 clippinghandle = MUI_AddClipping(muiRenderInfo(obj),
1212 (WORD) data->mleft,
1213 (WORD) data->vpos,
1214 (WORD) data->mwidth,
1215 (WORD) (data->NList_Visible*data->vinc));
1218 hmax = DrawLines(data,fyl,lyl,fx,lx,hfirst,0,1,FALSE,0);
1220 if (clipped)
1221 MUI_RemoveClipping(muiRenderInfo(obj),clippinghandle);
1223 if (data->NList_Title && (data->Title_PixLen > hmax))
1224 hmax = data->Title_PixLen;
1225 if (hfirst + data->hvisible > hmax)
1226 hmax = hfirst + data->hvisible;
1227 if (hmax != data->NList_Horiz_Entries)
1228 data->NList_Horiz_Entries = hmax;
1229 if (data->hvisible != data->NList_Horiz_Visible)
1230 data->NList_Horiz_Visible = data->hvisible;
1231 data->NList_Horiz_AffFirst = hfirst;
1236 if (!data->NList_TypeSelect && data->do_draw_active)
1238 BOOL clipped = FALSE;
1240 ent = data->NList_Active;
1241 if ((ent >= data->NList_First) && (ent < data->NList_First + data->NList_Visible + one_more)/* && (vfyl <= ent) && (ent <= vlyl)*/)
1243 if ((data->NList_First_Incr) && ((ent <= data->NList_First) || (ent >= data->NList_First + data->NList_Visible)))
1245 clipped = TRUE;
1246 clippinghandle = MUI_AddClipping(muiRenderInfo(obj),
1247 (WORD) data->mleft,
1248 (WORD) data->vpos,
1249 (WORD) data->mwidth,
1250 (WORD) (data->NList_Visible*data->vinc));
1253 DrawLines(data,ent,ent+1,PMIN,PMAX,hfirst,0,0,FALSE,0);
1255 if (clipped)
1256 MUI_RemoveClipping(muiRenderInfo(obj),clippinghandle);
1259 if (data->do_draw_title && data->NList_Title/* && (vfyl <= 0)*/)
1261 data->Title_PixLen = DrawTitle(data,PMIN,PMAX,hfirst);
1262 if (data->Title_PixLen > data->NList_Horiz_Entries)
1263 data->NList_Horiz_Entries = data->Title_PixLen;
1266 if (fullclipped)
1268 MUI_RemoveClipping(muiRenderInfo(obj),fullclippinghandle);
1269 fullclipped = FALSE;
1272 if (data->markdraw)
1274 LONG mdy;
1276 data->markerasenum = -1;
1277 if ((data->markdrawnum >= data->NList_First) && (data->markdrawnum < data->NList_First + data->NList_Visible))
1279 mdy = data->vpos + (data->vinc * (data->markdrawnum - data->NList_First));
1280 DoMethod(obj,MUIM_NList_DropDraw, data->markdrawnum,data->marktype,
1281 data->mleft,data->mright,mdy,mdy+data->vinc-1);
1282 data->markerasenum = data->markdrawnum;
1285 data->markdraw = FALSE;
1286 data->markerase = FALSE;
1288 data->NList_AffFirst = data->NList_First;
1289 data->NList_AffFirst_Incr = data->NList_First_Incr;
1290 data->NList_AffActive = data->NList_Active;
1292 if (!data->refreshing && need_refresh && (data->rp->Layer->Flags & LAYERREFRESH))
1294 SetBackGround(data->NList_ListBackGround);
1295 if (MUI_BeginRefresh(muiRenderInfo(obj),0))
1297 Object *o = (Object *)xget(_win(obj), MUIA_Window_RootObject);
1299 if(o)
1301 data->refreshing = TRUE;
1302 MUI_Redraw(o,MADF_DRAWOBJECT); /* MADF_DRAWALL */
1303 data->refreshing = FALSE;
1304 MUI_EndRefresh(muiRenderInfo(obj),0);
1308 DrawAdjustBar(data,0);
1309 DrawAdjustBar(data,1);
1311 SetBackGround(data->NList_ListBackGround);
1313 data->do_draw = FALSE;
1314 data->do_draw_all = FALSE;
1315 data->do_draw_active = FALSE;
1316 data->do_draw_title = FALSE;
1317 data->first_change = LONG_MAX;
1318 data->last_change = LONG_MIN;
1319 data->minx_change_entry = -1;
1320 data->maxx_change_entry = -1;
1322 NL_UpdateScrollersValues(data);
1323 /*do_notifies(NTF_First|NTF_Entries|NTF_MinMax);*/
1325 if (data->drawall_dobit != 1)
1326 data->drawall_dobit = 0;
1328 if (data->DRAW > 1)
1329 data->DRAW--;
1330 else
1331 data->DRAW = 1;
1333 /*if (msg->flags & MADF_DRAWOBJECT) D(bug("NL: mNL_Draw(MADF_DRAWOBJECT) /after \n"));*/
1336 return(0);
1340 IPTR mNL_DropDraw(struct IClass *cl,Object *obj,struct MUIP_NList_DropDraw *msg)
1342 struct NLData *data = INST_DATA(cl,obj);
1344 SetABPenDrMd(data->rp,data->pens[MPEN_SHINE],data->pens[MPEN_SHADOW],JAM2);
1345 SetDrPt(data->rp,0xF0F0);
1346 if ((msg->type & MUIV_NList_DropType_Mask) == MUIV_NList_DropType_Above)
1347 { Move(data->rp, msg->minx, msg->miny);
1348 Draw(data->rp, msg->maxx, msg->miny);
1350 else if ((msg->type & MUIV_NList_DropType_Mask) == MUIV_NList_DropType_Below)
1351 { Move(data->rp, msg->minx, msg->maxy);
1352 Draw(data->rp, msg->maxx, msg->maxy);
1354 else if ((msg->type & MUIV_NList_DropType_Mask) == MUIV_NList_DropType_Onto)
1355 { Move(data->rp, msg->minx, msg->miny);
1356 Draw(data->rp, msg->maxx, msg->miny);
1357 Move(data->rp, msg->minx, msg->maxy);
1358 Draw(data->rp, msg->maxx, msg->maxy);
1359 Move(data->rp, msg->minx, msg->miny);
1360 Draw(data->rp, msg->minx, msg->maxy);
1361 Move(data->rp, msg->maxx, msg->miny);
1362 Draw(data->rp, msg->maxx, msg->maxy);
1364 SetDrPt(data->rp,(UWORD)~0);
1365 SetABPenDrMd(data->rp,data->pens[MPEN_TEXT],data->pens[MPEN_BACKGROUND],JAM1);
1367 return(0);