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 ***************************************************************************/
26 #include <graphics/gfxmacros.h>
29 #include <dos/dosextens.h>
31 #include <libraries/gadtools.h>
32 #include <clib/alib_protos.h>
33 #include <proto/muimaster.h>
34 #include <proto/graphics.h>
35 #include <proto/layers.h>
36 #include <proto/intuition.h>
40 #include "NList_func.h"
41 #include "NListview_mcc.h"
43 /*#define DO_CLIPBLIT TRUE*/
45 static struct NewMenu MenuData
[] =
47 { NM_TITLE
, (STRPTR
)"Column", 0 ,0 ,0 ,(APTR
) MUIV_NList_ContextMenu_Never
},
48 { NM_ITEM
, (STRPTR
)"Default Width: this", 0 ,0 ,0 ,(APTR
) MUIV_NList_Menu_DefWidth_This
},
49 { NM_ITEM
, (STRPTR
)"Default Width: all", 0 ,0 ,0 ,(APTR
) MUIV_NList_Menu_DefWidth_All
},
50 { NM_ITEM
, (STRPTR
)"Default Order: this", 0 ,0 ,0 ,(APTR
) MUIV_NList_Menu_DefOrder_This
},
51 { NM_ITEM
, (STRPTR
)"Default Order: all", 0 ,0 ,0 ,(APTR
) MUIV_NList_Menu_DefOrder_All
},
53 { NM_END
,NULL
,0,0,0,(APTR
)0 },
57 void NL_SetCols(struct NLData
*data
)
64 LONG weight
,weight_all
,weight_num
,width
,width_all
,colx
,minwidth
,maxwidth
,mincolwidth
,maxcolwidth
;
65 BOOL do_colwidthmax
= FALSE
;
69 width_all
= data
->mwidth
;
71 while (column
< data
->numcols
)
73 if (data
->cols
[column
].c
->userwidth
>= 0)
74 width_all
-= data
->cols
[column
].c
->userwidth
;
75 else if (data
->cols
[column
].c
->width_type
== CI_PIX
)
76 width_all
-= data
->cols
[column
].c
->width
;
77 else if (data
->cols
[column
].c
->width_type
== CI_COL
)
78 width_all
-= data
->cols
[column
].c
->width
* data
->hinc
+1;
79 else if (data
->cols
[column
].c
->width
== -1)
80 { if (!do_colwidthmax
)
81 { if (data
->cols
[column
].c
->colwidthbiggestptr
== -2)
83 NL_SetColsAdd(data
,-2,TRUE
);
84 do_colwidthmax
= TRUE
;
87 { data
->cols
[column
].c
->colwidthmax
= data
->cols
[column
].c
->colwidthbiggest
;
90 width_all
-= data
->cols
[column
].c
->colwidthmax
;
93 { weight_all
+= data
->cols
[column
].c
->width
;
96 if (column
< data
->numcols
-1)
97 width_all
-= data
->cols
[column
].c
->delta
;
100 if (weight_all
<= (column
*5))
101 weight_all
= (column
*5)+1;
104 while (column
< data
->numcols
)
105 { weight
= (LONG
) data
->cols
[column
].c
->width
;
106 if (data
->cols
[column
].c
->userwidth
>= 0)
107 width
= data
->cols
[column
].c
->userwidth
;
108 else if (data
->cols
[column
].c
->width_type
== CI_PIX
)
110 else if (data
->cols
[column
].c
->width_type
== CI_COL
)
111 width
= weight
* data
->hinc
;
112 else if (weight
== -1)
113 width
= data
->cols
[column
].c
->colwidthmax
;
116 width
= (weight
* width_all
) / weight_all
;
117 minwidth
= (LONG
) data
->cols
[column
].c
->minwidth
;
119 { if (!do_colwidthmax
&& (data
->cols
[column
].c
->colwidthbiggestptr
== -2))
121 NL_SetColsAdd(data
,-2,TRUE
);
122 do_colwidthmax
= TRUE
;
124 minwidth
= data
->cols
[column
].c
->colwidthmax
;
127 minwidth
= (minwidth
* ((LONG
) data
->mwidth
)) / 100L;
128 maxwidth
= (LONG
) data
->cols
[column
].c
->maxwidth
;
129 maxwidth
= (maxwidth
* ((LONG
) data
->mwidth
)) / 100L;
131 mincolwidth
= (LONG
) data
->cols
[column
].c
->mincolwidth
;
132 mincolwidth
= mincolwidth
* ((LONG
) data
->hinc
) + 1;
133 maxcolwidth
= (LONG
) data
->cols
[column
].c
->maxcolwidth
;
134 maxcolwidth
= maxcolwidth
* ((LONG
) data
->hinc
) + 1;
136 if (mincolwidth
> minwidth
)
137 minwidth
= mincolwidth
;
138 if (data
->cols
[column
].c
->minpixwidth
> minwidth
)
139 minwidth
= data
->cols
[column
].c
->minpixwidth
;
141 if (maxcolwidth
< maxwidth
)
142 maxwidth
= maxcolwidth
;
143 if (data
->cols
[column
].c
->maxpixwidth
< maxwidth
)
144 maxwidth
= data
->cols
[column
].c
->maxpixwidth
;
146 if ((maxwidth
> 10) && (width
> maxwidth
))
149 if (width
< minwidth
)
156 weight_all
-= data
->cols
[column
].c
->width
;
160 if (data
->cols
[column
].c
->dx
!= (WORD
) width
)
161 { data
->do_wwrap
= data
->force_wwrap
= data
->do_draw_all
= TRUE
;
162 data
->cols
[column
].c
->dx
= (WORD
) width
;
163 if (data
->NList_TypeSelect
)
164 UnSelectCharSel(data
,FALSE
);
166 if (data
->cols
[column
].c
->minx
!= (WORD
) colx
)
167 { data
->do_wwrap
= data
->force_wwrap
= data
->do_draw_all
= TRUE
;
168 data
->cols
[column
].c
->minx
= (WORD
) colx
;
169 if (data
->NList_TypeSelect
)
170 UnSelectCharSel(data
,FALSE
);
173 if (data
->cols
[column
].c
->maxx
!= (WORD
) colx
)
174 { if (column
< data
->numcols
-1)
175 { data
->do_wwrap
= data
->force_wwrap
= data
->do_draw_all
= TRUE
;
177 data
->cols
[column
].c
->maxx
= (WORD
) colx
;
179 if (column
< data
->numcols
-1)
180 colx
+= data
->cols
[column
].c
->delta
;
181 else if (data
->cols
[column
].c
->userwidth
>= 0)
183 while (data
->EntriesArray
&& (ent
< data
->NList_Entries
))
184 { data
->EntriesArray
[ent
]->PixLen
= -1;
188 if (!IS_BAR(column
,data
->cols
[column
].c
))
189 data
->cols
[column
].c
->maxx
= MUI_MAXMAX
;
193 data
->do_setcols
= FALSE
;
199 LONG
NL_DoNotifies(struct NLData
*data
,LONG which
)
201 if (data
->NList_Quiet
|| data
->NList_Disabled
)
204 /* notify ButtonClick */
205 if(NEED_NOTIFY(NTF_ButtonClick
) & which
)
207 DONE_NOTIFY(NTF_ButtonClick
);
208 notdoset(data
->this,MUIA_NList_ButtonClick
,data
->NList_ButtonClick
);
211 /* notify TitleClick */
212 if(NEED_NOTIFY(NTF_TitleClick
) & which
)
214 DONE_NOTIFY(NTF_TitleClick
);
215 notdoset(data
->this,MUIA_NList_TitleClick
,data
->TitleClick
);
218 /* notify TitleClick2 */
219 if(NEED_NOTIFY(NTF_TitleClick2
) & which
)
221 DONE_NOTIFY(NTF_TitleClick2
);
222 notdoset(data
->this,MUIA_NList_TitleClick2
,data
->TitleClick2
);
225 /* notify EntryClick */
226 if(NEED_NOTIFY(NTF_EntryClick
) & which
)
228 DONE_NOTIFY(NTF_EntryClick
);
229 notdoset(data
->this,MUIA_NList_EntryClick
,data
->click_line
);
232 /* notify Doubleclick */
233 if(NEED_NOTIFY(NTF_Doubleclick
) & which
)
235 DONE_NOTIFY(NTF_Doubleclick
);
236 notdoset(data
->this,MUIA_NList_DoubleClick
,data
->click_line
);
239 if(NEED_NOTIFY(NTF_LV_Doubleclick
) & which
)
241 DONE_NOTIFY(NTF_LV_Doubleclick
);
242 if(data
->listviewobj
!= NULL
)
243 DoMethod(data
->listviewobj
, MUIM_Set
, MUIA_Listview_DoubleClick
, (LONG
)TRUE
);
245 set(data
->this,MUIA_Listview_DoubleClick
,(LONG
) TRUE
);
248 /* notify Multiclick */
249 if(NEED_NOTIFY(NTF_Multiclick
) & which
)
251 DONE_NOTIFY(NTF_Multiclick
);
252 notdoset(data
->this,MUIA_NList_MultiClick
,data
->multiclick
+ 1);
255 /* notify Multiclick */
256 if(NEED_NOTIFY(NTF_MulticlickAlone
) & which
)
258 DONE_NOTIFY(NTF_MulticlickAlone
);
259 if (data
->multiclickalone
> 0)
260 data
->multiclickalone
= -data
->multiclickalone
;
261 notdoset(data
->this,MUIA_NList_MultiClickAlone
,-data
->multiclickalone
);
265 if(NEED_NOTIFY(NTF_Active
) & which
)
267 DONE_NOTIFY(NTF_Active
);
268 NOTIFY_START(NTF_Active
);
269 notdoset(data
->this,MUIA_NList_Active
,data
->NList_Active
);
270 NOTIFY_END(NTF_Active
);
272 if(NEED_NOTIFY(NTF_L_Active
) & which
)
274 DONE_NOTIFY(NTF_L_Active
);
275 NOTIFY_START(NTF_L_Active
);
276 notdoset(data
->this,MUIA_List_Active
,data
->NList_Active
);
277 NOTIFY_END(NTF_L_Active
);
281 if(NEED_NOTIFY(NTF_Select
) & which
)
283 DONE_NOTIFY(NTF_Select
);
284 set(data
->this,MUIA_NList_SelectChange
,(LONG
) TRUE
);
287 if(NEED_NOTIFY(NTF_LV_Select
) & which
)
289 DONE_NOTIFY(NTF_LV_Select
);
290 if(data
->listviewobj
!= NULL
)
291 DoMethod(data
->listviewobj
, MUIM_Set
, MUIA_Listview_SelectChange
, (LONG
)TRUE
);
293 set(data
->this,MUIA_Listview_SelectChange
,(LONG
) TRUE
);
297 if(NEED_NOTIFY(NTF_First
) & which
)
299 DONE_NOTIFY(NTF_First
);
300 notdoset(data
->this,MUIA_NList_First
,data
->NList_First
);
304 if(NEED_NOTIFY(NTF_Entries
) & which
)
306 DONE_NOTIFY(NTF_Entries
);
307 notdoset(data
->this,MUIA_NList_Entries
,data
->NList_Entries
);
308 notdoset(data
->this,MUIA_List_Entries
,data
->NList_Entries
);
311 /* notify LineHeight */
312 if(NEED_NOTIFY(NTF_LineHeight
) & which
)
314 DONE_NOTIFY(NTF_LineHeight
);
315 notdoset(data
->this,MUIA_NList_LineHeight
,data
->vinc
);
318 /* notify NTF_DragSortInsert */
319 if(NEED_NOTIFY(NTF_DragSortInsert
) & which
)
321 DONE_NOTIFY(NTF_Insert
|NTF_DragSortInsert
);
322 notdoset(data
->this,MUIA_NList_DragSortInsert
,data
->vinc
);
326 if(NEED_NOTIFY(NTF_Insert
) & which
)
328 DONE_NOTIFY(NTF_Insert
);
329 notdoset(data
->this,MUIA_NList_InsertPosition
,data
->vinc
);
333 if(!data
->do_wwrap
&& !data
->force_wwrap
&&
334 (ASKED_NOTIFY(NTF_MinMax
) & which
))
336 DONE_NOTIFY(NTF_MinMax
);
341 if(NEED_NOTIFY(NTF_Columns
) & which
)
343 DONE_NOTIFY(NTF_Columns
);
344 notdoset(data
->this,MUIA_NList_Columns
,(IPTR
) NL_Columns(data
,NULL
));
351 void NL_UpdateScrollersValues(struct NLData
*data
)
353 Object
*obj
= data
->this;
355 if((data
->NList_Quiet
> 0 || data
->NList_Disabled
) && !data
->do_draw_all
)
358 if(WANTED_NOTIFY(NTF_VSB
))
360 LONG entries
= data
->NList_Prop_First
+ data
->NList_Prop_Visible
;
362 if(entries
< data
->NList_Prop_Entries
)
363 entries
= data
->NList_Prop_Entries
;
365 if(entries
!= data
->old_prop_entries
||
366 data
->NList_Prop_Visible
!= data
->old_prop_visible
||
367 data
->NList_Prop_First
!= data
->old_prop_first
||
368 data
->vinc
!= data
->old_prop_delta
)
371 (entries
!= data
->old_prop_entries
) ? MUIA_NList_Prop_Entries
: TAG_IGNORE
, entries
,
372 (data
->NList_Prop_Visible
!= data
->old_prop_visible
) ? MUIA_NList_Prop_Visible
: TAG_IGNORE
, data
->NList_Prop_Visible
,
373 (data
->NList_Prop_First
!= data
->old_prop_first
) ? MUIA_NList_Prop_First
: TAG_IGNORE
, data
->NList_Prop_First
,
374 (data
->vinc
!= data
->old_prop_delta
) ? MUIA_NList_VertDeltaFactor
: TAG_IGNORE
, data
->vinc
,
378 if(WANTED_NOTIFY(NTF_HSB
))
380 if(data
->NList_Horiz_Entries
!= data
->old_horiz_entries
||
381 data
->NList_Horiz_Visible
!= data
->old_horiz_visible
||
382 data
->hinc
!= data
->old_horiz_delta
)
385 (data
->NList_Horiz_Entries
!= data
->old_horiz_entries
) ? MUIA_NList_Horiz_Entries
: TAG_IGNORE
, data
->NList_Horiz_Entries
,
386 (data
->NList_Horiz_Visible
!= data
->old_horiz_visible
) ? MUIA_NList_Horiz_Visible
: TAG_IGNORE
, data
->NList_Horiz_Visible
,
387 (data
->hinc
!= data
->old_horiz_delta
) ? MUIA_NList_HorizDeltaFactor
: TAG_IGNORE
, data
->hinc
,
391 if(data
->NList_Horiz_First
!= data
->old_horiz_first
)
392 notdoset(obj
, MUIA_NList_Horiz_First
, data
->NList_Horiz_First
);
397 ULONG
NL_UpdateScrollers(struct NLData
*data
,BOOL force
)
399 if (!data
->SHOW
|| !data
->DRAW
)
402 if (data
->UpdatingScrollbars
)
404 BOOL lastact
= (data
->NList_Active
== (data
->NList_First
+ data
->NList_Visible
- 1));
406 NL_SetObjInfos(data
,TRUE
);
407 data
->NList_Prop_Visible
= data
->lvisible
* data
->vinc
;
408 data
->NList_Horiz_Visible
= data
->mright
- data
->mleft
;
409 data
->NList_Prop_Entries
= data
->NList_Entries
* data
->vinc
;
410 if (lastact
&& (data
->NList_Active
== (data
->NList_First
+ data
->NList_Visible
)))
413 NL_DoWrapAll(data
,FALSE
,FALSE
);
414 NL_UpdateScrollersValues(data
);
418 if (data
->do_draw_all
|| data
->do_parse
|| data
->do_images
|| data
->do_setcols
|| data
->do_updatesb
|| data
->format_chge
)
420 if (data
->ScrollBarsTime
<= 0)
421 { data
->do_updatesb
= TRUE
;
422 data
->ScrollBarsTime
= SCROLLBARSTIME
;
425 if (!data
->do_draw_all
&& !data
->do_updatesb
&& !force
&& (data
->NList_Quiet
|| data
->NList_Disabled
))
427 data
->ScrollBarsTime
= SCROLLBARSTIME
;
431 NL_SetObjInfos(data
,TRUE
);
435 GetNImage_Sizes(data
);
439 AllParseColumns(data
);
440 GetNImage_Sizes(data
);
444 NL_DoWrapAll(data
,FALSE
,FALSE
);
446 if (data
->do_draw_all
|| force
)
448 LONG ent
,ent2
,hmax
,linelen
,hfirst
;
450 data
->NList_Prop_Visible
= data
->lvisible
* data
->vinc
;
451 data
->NList_Horiz_Visible
= data
->mright
- data
->mleft
;
452 data
->NList_Prop_Entries
= data
->NList_Entries
* data
->vinc
;
454 hfirst
= data
->NList_Horiz_First
& ~1;
455 ent
= data
->NList_First
;
456 ent2
= data
->NList_First
+ data
->NList_Visible
;
457 if (ent2
> data
->NList_Entries
)
458 ent2
= data
->NList_Entries
;
459 while (data
->EntriesArray
&& (ent
< ent2
))
461 linelen
= data
->EntriesArray
[ent
]->PixLen
;
462 if (((linelen
< 1) || data
->do_draw_all
) && (data
->numcols
> 0) && !DontDoColumn(data
,ent
,data
->numcols
-1))
464 data
->display_ptr
= NULL
;
465 data
->parse_column
= -1;
466 if (data
->cols
[data
->numcols
-1].c
->userwidth
> 0)
467 linelen
= data
->cols
[data
->numcols
-1].c
->userwidth
+ data
->cols
[data
->numcols
-1].c
->minx
- 1;
470 NL_GetDisplayArray(data
,ent
);
471 ParseColumn(data
,data
->numcols
-1,0);
472 WidthColumn(data
,data
->numcols
-1,0);
473 linelen
= data
->cols
[data
->numcols
-1].c
->colwidth
+ data
->cols
[data
->numcols
-1].c
->minx
+ data
->cols
[data
->numcols
-1].c
->xoffset
;
474 if (IS_ALIGN_CENTER(data
->cols
[data
->numcols
-1].c
->style
) && (data
->cols
[data
->numcols
-1].c
->dx
> data
->cols
[data
->numcols
-1].c
->colwidth
))
475 linelen
= data
->cols
[data
->numcols
-1].c
->minx
+ data
->cols
[data
->numcols
-1].c
->dx
- 1;
476 data
->display_ptr
= NULL
;
477 data
->parse_column
= -1;
479 data
->EntriesArray
[ent
]->PixLen
= linelen
;
485 if (data
->NList_Title
)
487 if ((data
->Title_PixLen
< 0) || data
->do_draw_all
)
489 data
->do_draw_title
= TRUE
;
490 data
->display_ptr
= NULL
;
491 data
->parse_column
= -1;
492 if (data
->cols
[data
->numcols
-1].c
->userwidth
> 0)
493 data
->Title_PixLen
= data
->cols
[data
->numcols
-1].c
->userwidth
+ data
->cols
[data
->numcols
-1].c
->minx
- 1;
496 NL_GetDisplayArray(data
,-1);
497 ParseColumn(data
,data
->numcols
-1,0);
498 WidthColumn(data
,data
->numcols
-1,0);
499 data
->Title_PixLen
= data
->cols
[data
->numcols
-1].c
->colwidth
+ data
->cols
[data
->numcols
-1].c
->minx
+ data
->cols
[data
->numcols
-1].c
->xoffset
;
500 if (IS_ALIGN_CENTER(data
->cols
[data
->numcols
-1].c
->style
) && (data
->cols
[data
->numcols
-1].c
->dx
> data
->cols
[data
->numcols
-1].c
->colwidth
))
501 data
->Title_PixLen
= data
->cols
[data
->numcols
-1].minx
+ data
->cols
[data
->numcols
-1].dx
- 1;
502 data
->display_ptr
= NULL
;
503 data
->parse_column
= -1;
506 if (data
->Title_PixLen
> hmax
)
507 hmax
= data
->Title_PixLen
;
509 if (hfirst
+ data
->hvisible
> hmax
)
510 hmax
= hfirst
+ data
->hvisible
;
511 data
->NList_Horiz_Entries
= hmax
;
512 NL_UpdateScrollersValues(data
);
515 data
->ScrollBarsTime
= SCROLLBARSTIME
;
516 if (data
->do_updatesb
&& (data
->NList_Quiet
<= 0) && !data
->NList_Disabled
&& WANTED_NOTIFY(NTF_SB
))
518 data
->do_updatesb
= FALSE
;
519 data
->ScrollBars
= (data
->ScrollBarsOld
& ~MUIV_NListview_HSB_On
) | MUIV_NListview_HSB_Off
;
521 if (data
->ScrollBarsPos
!= data
->NList_First
)
522 data
->ScrollBars
= MUIV_NListview_HSB_Off
| MUIV_NListview_VSB_Off
;
524 if ((data
->NList_Prop_Entries
> data
->NList_Prop_Visible
) || (data
->NList_First
> 0))
525 data
->ScrollBars
|= MUIV_NListview_VSB_On
;
527 if (data
->NList_Horiz_Entries
> data
->NList_Horiz_Visible
)
528 data
->ScrollBars
|= MUIV_NListview_HSB_On
;
531 LONG ent
= data
->NList_First
+ data
->NList_Visible
;
533 if ((ent
< data
->NList_Entries
) && data
->EntriesArray
&&
534 ((data
->ScrollBarsOld
& MUIV_NListview_HSB_On
) == MUIV_NListview_HSB_On
))
536 LONG hsb
,lastent
,hsbheight
,vsbwidth
=0;
538 // check if we got a HSB_Height attribute
539 if(data
->scrollersobj
&& GetAttr(MUIA_NListview_HSB_Height
, data
->scrollersobj
, (IPTR
*)&hsbheight
) != FALSE
)
541 hsbheight
+= data
->vdt
+ data
->vdb
;
542 lastent
= ent
+ (hsbheight
/ data
->vinc
) + 1;
547 if(data
->scrollersobj
)
548 vsbwidth
= xget(data
->scrollersobj
, MUIA_NListview_VSB_Width
);
551 while ((ent
< lastent
) && (ent
< data
->NList_Entries
))
553 if (((data
->EntriesArray
[ent
]->PixLen
< 1) || data
->do_draw_all
) && (data
->numcols
> 0) && !DontDoColumn(data
,ent
,data
->numcols
-1))
555 data
->display_ptr
= NULL
;
556 data
->parse_column
= -1;
557 if (data
->cols
[data
->numcols
-1].c
->userwidth
> 0)
558 data
->EntriesArray
[ent
]->PixLen
= data
->cols
[data
->numcols
-1].c
->userwidth
+ data
->cols
[data
->numcols
-1].c
->minx
- 1;
561 NL_GetDisplayArray(data
,ent
);
562 ParseColumn(data
,data
->numcols
-1,0);
563 WidthColumn(data
,data
->numcols
-1,0);
564 data
->EntriesArray
[ent
]->PixLen
= data
->cols
[data
->numcols
-1].c
->colwidth
+ data
->cols
[data
->numcols
-1].c
->minx
+ data
->cols
[data
->numcols
-1].c
->xoffset
;
565 if (IS_ALIGN_CENTER(data
->cols
[data
->numcols
-1].c
->style
) && (data
->cols
[data
->numcols
-1].c
->dx
> data
->cols
[data
->numcols
-1].c
->colwidth
))
566 data
->EntriesArray
[ent
]->PixLen
= data
->cols
[data
->numcols
-1].c
->minx
+ data
->cols
[data
->numcols
-1].c
->dx
- 1;
567 data
->display_ptr
= NULL
;
568 data
->parse_column
= -1;
572 if (data
->EntriesArray
[ent
]->PixLen
+ vsbwidth
> data
->NList_Horiz_Visible
)
573 { hsb
|= MUIV_NListview_HSB_On
;
578 data
->ScrollBars
|= hsb
;
582 if (force
|| (data
->ScrollBars
!= data
->ScrollBarsOld
))
584 data
->ScrollBarsOld
= data
->ScrollBars
;
585 data
->ScrollBarsPos
= data
->NList_First
;
587 data
->UpdatingScrollbars
= TRUE
;
588 data
->UpdateScrollersRedrawn
= FALSE
;
589 set(data
->this,MUIA_NListview_Horiz_ScrollBar
,data
->ScrollBars
);
590 data
->UpdatingScrollbars
= FALSE
;
592 NL_UpdateScrollersValues(data
);
594 if ((data
->ScrollBars
& MUIV_NListview_VSB_On
) != MUIV_NListview_VSB_On
)
595 data
->ScrollBarsPos
= -2;
597 return (data
->UpdateScrollersRedrawn
);
600 data
->do_updatesb
= FALSE
;
605 static LONG
DoRefresh(struct NLData
*data
)
607 if (data
->SHOW
&& data
->DRAW
)
609 Object
*obj
= data
->this;
613 data
->pushtrigger
= 1;
614 DoMethod(_app(obj
),MUIM_Application_PushMethod
,obj
,1,MUIM_NList_Trigger
);
617 if (!(muiRenderInfo(obj
)->mri_Flags
& MUIMRI_REFRESHMODE
) && !data
->refreshing
&&
618 (data
->rp
->Layer
->Flags
& LAYERREFRESH
))
619 /*&& ((_window(obj)->Flags & WFLG_REFRESHBITS) == WFLG_SIMPLE_REFRESH) )*/
621 SetBackGround(data
->NList_ListBackGround
);
622 if (MUI_BeginRefresh(muiRenderInfo(obj
),0))
624 Object
*o
= (Object
*)xget(_win(obj
),MUIA_Window_RootObject
);
628 data
->refreshing
= TRUE
;
630 * if (data->do_draw_all && data->do_draw)
631 * data->refreshing = 2;
633 MUI_Redraw(o
,MADF_DRAWOBJECT
); /* MADF_DRAWALL */
634 data
->refreshing
= FALSE
;
635 MUI_EndRefresh(muiRenderInfo(obj
),0);
639 if ((data
->pushtrigger
== 2) ||
640 (!(data
->rp
->Layer
->Flags
& LAYERREFRESH
) &&
641 !(muiRenderInfo(obj
)->mri_Flags
& MUIMRI_REFRESHMODE
) && !data
->refreshing
))
645 else if (!data
->pushtrigger
)
647 data
->pushtrigger
= 1;
648 DoMethod(_app(obj
),MUIM_Application_PushMethod
,obj
,1,MUIM_NList_Trigger
);
655 * if (!(data->rp->Layer->Flags & LAYERREFRESH) || (data->pushtrigger == 2))
658 * else if (!data->pushtrigger)
659 * { data->pushtrigger = 1;
660 * DoMethod(_app(obj),MUIM_Application_PushMethod,obj,1,MUIM_NList_Trigger);
665 void NL_DrawQuietBG(struct NLData
*data
,LONG dowhat
,LONG bg
)
667 if (data
->do_draw_all
)
669 if ((dowhat
== 0) || (dowhat
== 4))
671 else if (dowhat
== 3)
677 case 0 : /* REDRAW_IF */
679 if (!data
->NList_Quiet
&& !data
->NList_Disabled
&& data
->SHOW
&& data
->DRAW
)
683 if (data
->do_draw_all
)
685 ULONG mad_Flags
= muiAreaData(data
->this)->mad_Flags
;
688 OCLASS(data
->this) = data
->ncl
;
689 nnset(data
->this,MUIA_Background
,(IPTR
)"0:128");
690 OCLASS(data
->this) = data
->ocl
;
692 muiAreaData(data
->this)->mad_Flags
= mad_Flags
;
693 data
->actbackground
= -1;
694 MUI_Redraw(data
->this,MADF_DRAWUPDATE
);
696 else if (data
->do_draw
)
697 MUI_Redraw(data
->this,MADF_DRAWUPDATE
);
702 case 1 : /* REDRAW_ALL_FORCE */
704 data
->do_draw
= data
->do_draw_all
= TRUE
;
705 if (data
->SHOW
&& data
->DRAW
)
709 ULONG mad_Flags
= muiAreaData(data
->this)->mad_Flags
;
712 OCLASS(data
->this) = data
->ncl
;
713 nnset(data
->this,MUIA_Background
,(IPTR
)"0:128");
714 OCLASS(data
->this) = data
->ocl
;
716 muiAreaData(data
->this)->mad_Flags
= mad_Flags
;
717 data
->actbackground
= -1;
718 MUI_Redraw(data
->this,MADF_DRAWALL
);
723 case 2 : /* REDRAW_ALL */
725 data
->do_draw
= data
->do_draw_all
= TRUE
;
726 if (!data
->NList_Quiet
&& !data
->NList_Disabled
&& data
->SHOW
&& data
->DRAW
)
730 ULONG mad_Flags
= muiAreaData(data
->this)->mad_Flags
;
733 OCLASS(data
->this) = data
->ncl
;
734 nnset(data
->this,MUIA_Background
,(IPTR
)"0:128");
735 OCLASS(data
->this) = data
->ocl
;
737 muiAreaData(data
->this)->mad_Flags
= mad_Flags
;
738 data
->actbackground
= -1;
739 MUI_Redraw(data
->this,MADF_DRAWOBJECT
);
744 case 3 : /* REDRAW_FORCE */
746 data
->do_draw
= TRUE
;
747 if (data
->SHOW
&& data
->DRAW
)
751 if (data
->do_draw_all
)
753 ULONG mad_Flags
= muiAreaData(data
->this)->mad_Flags
;
756 OCLASS(data
->this) = data
->ncl
;
757 nnset(data
->this,MUIA_Background
,(IPTR
)"0:128");
758 OCLASS(data
->this) = data
->ocl
;
760 muiAreaData(data
->this)->mad_Flags
= mad_Flags
;
761 data
->actbackground
= -1;
762 MUI_Redraw(data
->this,MADF_DRAWUPDATE
);
765 MUI_Redraw(data
->this,MADF_DRAWUPDATE
);
770 case 4 : /* REDRAW */
772 data
->do_draw
= TRUE
;
773 if (!data
->NList_Quiet
&& !data
->NList_Disabled
&& data
->SHOW
&& data
->DRAW
)
777 if (data
->do_draw_all
)
779 ULONG mad_Flags
= muiAreaData(data
->this)->mad_Flags
;
782 OCLASS(data
->this) = data
->ncl
;
783 nnset(data
->this,MUIA_Background
,(IPTR
)"0:128");
784 OCLASS(data
->this) = data
->ocl
;
786 muiAreaData(data
->this)->mad_Flags
= mad_Flags
;
787 data
->actbackground
= -1;
788 MUI_Redraw(data
->this,MADF_DRAWUPDATE
);
791 MUI_Redraw(data
->this,MADF_DRAWUPDATE
);
796 case 5 : /* ENDQUIET */
798 data
->NList_Quiet
= 0;
803 if (data
->do_draw_all
)
805 ULONG mad_Flags
= muiAreaData(data
->this)->mad_Flags
;
808 OCLASS(data
->this) = data
->ncl
;
809 nnset(data
->this,MUIA_Background
,(IPTR
)"0:128");
810 OCLASS(data
->this) = data
->ocl
;
812 muiAreaData(data
->this)->mad_Flags
= mad_Flags
;
813 data
->actbackground
= -1;
814 /*MUI_Redraw(data->this,MADF_DRAWOBJECT);*/
815 MUI_Redraw(data
->this,MADF_DRAWOBJECT
);
817 else if (data
->do_draw
)
818 MUI_Redraw(data
->this,MADF_DRAWUPDATE
);
820 /* do_notifies(NTF_All);*/
824 case 6 : /* LESSQUIET */
826 if (data
->NList_Quiet
> 0)
828 if (!data
->NList_Quiet
&& !data
->NList_Disabled
&& data
->SHOW
)
832 if (data
->do_draw_all
)
834 ULONG mad_Flags
= muiAreaData(data
->this)->mad_Flags
;
837 OCLASS(data
->this) = data
->ncl
;
838 nnset(data
->this,MUIA_Background
,(IPTR
)"0:128");
839 OCLASS(data
->this) = data
->ocl
;
841 muiAreaData(data
->this)->mad_Flags
= mad_Flags
;
842 data
->actbackground
= -1;
843 /*MUI_Redraw(data->this,MADF_DRAWOBJECT);*/
844 MUI_Redraw(data
->this,MADF_DRAWUPDATE
);
846 else if (data
->do_draw
)
847 MUI_Redraw(data
->this,MADF_DRAWUPDATE
);
849 /* do_notifies(NTF_All);*/
853 case 7 : /* SetBackGround */
856 ULONG mad_Flags
= muiAreaData(data
->this)->mad_Flags
;
858 data
->actbackground
= bg
;
860 OCLASS(data
->this) = data
->ncl
;
861 nnset(data
->this,MUIA_Background
,bg
);
862 OCLASS(data
->this) = data
->ocl
;
864 muiAreaData(data
->this)->mad_Flags
= mad_Flags
;
869 case 8 : /* Make_Active_Visible */
871 if ((data
->NList_AutoVisible
) && (data
->NList_Active
>= 0) && (data
->NList_Active
< data
->NList_Entries
))
873 if (data
->NList_Active
< data
->NList_First
)
875 data
->NList_First
= data
->NList_Active
;
876 DO_NOTIFY(NTF_First
);
878 else if (data
->NList_Active
>= data
->NList_First
+ data
->NList_Visible
)
880 data
->NList_First
= data
->NList_Active
- data
->NList_Visible
+ 1;
881 if (data
->NList_First
< 0)
882 data
->NList_First
= 0;
883 DO_NOTIFY(NTF_First
);
888 case 9 : /* ForceMinMax */
890 DONE_NOTIFY(NTF_MinMax
);
891 if (!WANTED_NOTIFY(NTF_MinMax
) && data
->SHOW
&& data
->DRAW
&& data
->NL_Group
&& data
->VirtGroup
&& data
->NList_AdjustHeight
)
893 ULONG mad_Flags
= muiAreaData(data
->this)->mad_Flags
;
895 WANT_NOTIFY(NTF_MinMax
|NTF_MinMaxNoDraw
);
896 if (DoMethod(data
->VirtGroup
,MUIM_Group_InitChange
))
898 DoMethod(data
->VirtGroup
,MUIM_Group_ExitChange
);
899 muiAreaData(data
->this)->mad_Flags
= mad_Flags
;
900 NL_UpdateScrollersValues(data
);
903 NOWANT_NOTIFY(NTF_MinMax
|NTF_MinMaxNoDraw
);
904 DONE_NOTIFY(NTF_MinMax
);
911 #define SELECTABLE(ent) \
912 ((!data->NList_MultiTestHook) ||\
913 (MyCallHookPkt(data->this,FALSE,data->NList_MultiTestHook,data->this,data->EntriesArray[ent]->Entry)))
916 void NL_Select(struct NLData
*data
,LONG dowhat
,LONG ent
,BYTE sel
)
918 /* D(bug("%lx dowhat=%ld ent=%ld sel=%ld\n",obj,dowhat,ent,sel));*/
921 case 0 : /* SELECT(ent,sel) */
922 if (!data
->NList_TypeSelect
&& SELECTABLE(ent
))
923 { if (data
->EntriesArray
[ent
]->Select
!= sel
)
924 { data
->EntriesArray
[ent
]->Select
= sel
;
925 DO_NOTIFY(NTF_Select
| NTF_LV_Select
);
927 DoMethod( data
->this, MUIM_NList_SelectChange
, ent
, MUIV_NList_Select_On
, 0 );
932 case 1 : /* SELECT2(ent,sel) */
933 if (!data
->NList_TypeSelect
&& (data
->EntriesArray
[ent
]->Select
!= sel
))
934 { data
->EntriesArray
[ent
]->Select
= sel
;
935 DO_NOTIFY(NTF_Select
| NTF_LV_Select
);
937 DoMethod( data
->this, MUIM_NList_SelectChange
, ent
, MUIV_NList_Select_Off
, 0 );
941 case 2 : /* SELECT_CHGE(ent,sel) */
942 if (!data
->NList_TypeSelect
&& SELECTABLE(ent
))
943 { if (data
->EntriesArray
[ent
]->Select
!= sel
)
944 { data
->EntriesArray
[ent
]->Select
= sel
;
945 NL_Changed(data
,ent
);
946 DO_NOTIFY(NTF_Select
| NTF_LV_Select
);
948 DoMethod( data
->this, MUIM_NList_SelectChange
, ent
, MUIV_NList_Select_On
, MUIV_NList_SelectChange_Flag_Multi
);
953 case 3 : /* SELECT2_CHGE(ent,sel) */
954 if (!data
->NList_TypeSelect
&& (data
->EntriesArray
[ent
]->Select
!= sel
))
955 { data
->EntriesArray
[ent
]->Select
= sel
;
956 NL_Changed(data
,ent
);
957 DO_NOTIFY(NTF_Select
| NTF_LV_Select
);
959 DoMethod( data
->this, MUIM_NList_SelectChange
, ent
, MUIV_NList_Select_Off
, MUIV_NList_SelectChange_Flag_Multi
);
963 case 4 : /* set_Active(ent) */
964 { if (data
->NList_Active
!= (ent
))
966 data
->NList_Active
= (ent
);
967 DO_NOTIFY(NTF_Active
| NTF_L_Active
);
969 DoMethod( data
->this, MUIM_NList_SelectChange
, ent
, MUIV_NList_Select_Active
, 0 );
982 * if ((w->Flags & WFLG_REFRESHBITS) == WFLG_SIMPLE_REFRESH)
984 * struct Layer *lay, *l = w->WLayer;
985 * WORD mleft,mright,mtop,mbottom;
986 * mleft = w->LeftEdge + data->mleft;
987 * mright = w->LeftEdge + data->mright;
988 * mtop = w->TopEdge + data->mtop;
989 * mbottom = w->TopEdge + data->mbottom;
990 * lay = w->WLayer->front;
992 * { if ((lay->bounds.MaxX > mleft) &&
993 * (lay->bounds.MinX < mright) &&
994 * (lay->bounds.MaxY > mtop) &&
995 * (lay->bounds.MinY < mbottom))
996 * { data->do_draw_all = TRUE;
997 * data->NList_First_Incr = 0;
1005 #define LayerCovered(l) ((!(l)->ClipRect) || ((l)->ClipRect->bounds.MaxX != (l)->bounds.MaxX) ||\
1006 ((l)->ClipRect->bounds.MinX != (l)->bounds.MinX) ||\
1007 ((l)->ClipRect->bounds.MaxY != (l)->bounds.MaxY) ||\
1008 ((l)->ClipRect->bounds.MinY != (l)->bounds.MinY))
1010 #define LayerDamaged(l) ((l)->DamageList && (l)->DamageList->RegionRectangle)
1012 #define ABS(x) (((x) >= 0) ? (x) : -(x))
1014 void ScrollVert(struct NLData
*data
,WORD dy
,LONG LPVisible
)
1016 WORD y1
= data
->vpos
;
1017 WORD y2
= data
->vpos
+ LPVisible
- 1;
1019 if (data
->vwidth
<= 0)
1021 if (y1
< data
->vtop
) y1
= data
->vtop
;
1022 if (y2
> data
->vbottom
) y2
= data
->vbottom
;
1023 if ((y2
- y1
) <= ABS(dy
))
1027 if (LIBVER(GfxBase
) >= 39)
1029 struct Hook
*oldbackfilhook
;
1031 oldbackfilhook
= InstallLayerHook(data
->rp
->Layer
, LAYERS_NOBACKFILL
);
1032 ScrollRasterBF(data
->rp
,0,dy
,data
->vleft
,y1
,data
->vright
,y2
);
1033 InstallLayerHook(data
->rp
->Layer
, oldbackfilhook
);
1038 struct Window
*w
= _window(data
->this);
1039 struct Layer
*l
= w
->WLayer
;
1042 ClipBlit(data
->rp
,data
->vleft
,y1
+dy
,data
->rp
,data
->vleft
,y1
,data
->vwidth
,y2
-y1
+1-dy
,0xC0);
1044 ClipBlit(data
->rp
,data
->vleft
,y1
,data
->rp
,data
->vleft
,y1
-dy
,data
->vwidth
,y2
-y1
+1+dy
,0xC0);
1045 if (((w
->Flags
& WFLG_REFRESHBITS
) == WFLG_SIMPLE_REFRESH
) &&
1046 (LayerCovered(l
) || LayerDamaged(l
)))
1048 UBYTE oldmask
= data
->rp
->Mask
;
1050 SetWrMsk(data
->rp
,0);
1051 ScrollRaster(data
->rp
,0,dy
,data
->vleft
,y1
,data
->vright
,y2
);
1052 SetWrMsk(data
->rp
,oldmask
);
1058 void ScrollHoriz(struct NLData
*data
,WORD dx
,LONG LPVisible
)
1060 WORD y1
= data
->vpos
;
1061 WORD y2
= data
->vpos
+ LPVisible
- 1;
1063 if (data
->vwidth
<= ABS(dx
))
1065 if (data
->NList_Title
)
1066 y1
= data
->vdtitlepos
;
1067 if (y1
< data
->vtop
) y1
= data
->vtop
;
1068 if (y2
> data
->vbottom
) y2
= data
->vbottom
;
1073 if (LIBVER(GfxBase
) >= 39)
1075 struct Hook
*oldbackfilhook
;
1077 oldbackfilhook
= InstallLayerHook(data
->rp
->Layer
, LAYERS_NOBACKFILL
);
1078 ScrollRasterBF(data
->rp
,dx
,0,data
->vleft
,y1
,data
->vright
,y2
);
1079 InstallLayerHook(data
->rp
->Layer
, oldbackfilhook
);
1084 struct Window
*w
= _window(data
->this);
1085 struct Layer
*l
= w
->WLayer
;
1088 ClipBlit(data
->rp
,data
->vleft
+dx
,y1
,data
->rp
,data
->vleft
,y1
,data
->vwidth
-dx
,y2
-y1
+1,0xC0);
1090 ClipBlit(data
->rp
,data
->vleft
,y1
,data
->rp
,data
->vleft
-dx
,y1
,data
->vwidth
+dx
,y2
-y1
+1,0xC0);
1091 if (((w
->Flags
& WFLG_REFRESHBITS
) == WFLG_SIMPLE_REFRESH
) &&
1092 (LayerCovered(l
) || LayerDamaged(l
)))
1094 UBYTE oldmask
= data
->rp
->Mask
;
1096 SetWrMsk(data
->rp
,0);
1097 ScrollRaster(data
->rp
,dx
,0,data
->vleft
,y1
,data
->vright
,y2
);
1098 SetWrMsk(data
->rp
,oldmask
);
1104 LONG
NL_ColToColumn(struct NLData
*data
,LONG col
)
1108 if ((col
>= 0) && (col
< DISPLAY_ARRAY_MAX
))
1110 for (column
= 0; column
< data
->numcols
; column
++)
1112 if (data
->cols
[column
].c
->col
== col
)
1120 LONG
NL_ColumnToCol(struct NLData
*data
,LONG column
)
1122 if ((column
>= 0) && (column
< data
->numcols
))
1123 return ((LONG
) data
->cols
[column
].c
->col
);
1128 LONG
NL_SetCol(struct NLData
*data
,LONG column
,LONG col
)
1129 { LONG column2d
= -1;
1130 if ((column
== MUIV_NList_SetColumnCol_Default
) && (col
== MUIV_NList_SetColumnCol_Default
))
1131 { for (column
= 0; column
< data
->numcols
; column
++)
1132 { if (data
->cols
[column
].c
!= &data
->cols
[column
])
1133 data
->do_setcols
= TRUE
;
1134 data
->cols
[column
].c
= &data
->cols
[column
];
1136 if (data
->do_setcols
)
1137 { DO_NOTIFY(NTF_Columns
);
1142 else if ((col
== MUIV_NList_SetColumnCol_Default
) &&
1143 (column
>= 0) && (column
< data
->numcols
))
1144 { for (column2d
= 0; column2d
< data
->numcols
; column2d
++)
1145 { if (data
->cols
[column
].c
== &data
->cols
[column2d
])
1146 { column
= column2d
;
1151 else if ((col
>= 0) && (col
< DISPLAY_ARRAY_MAX
))
1152 { for (column2d
= 0; column2d
< data
->numcols
; column2d
++)
1153 { if (data
->cols
[column2d
].col
== col
)
1154 { if (column
== MUIV_NList_SetColumnCol_Default
)
1161 if ((column
>= 0) && (column
< data
->numcols
) &&
1162 (column2d
>= 0) && (column2d
< data
->numcols
) &&
1163 (data
->cols
[column
].c
!= &data
->cols
[column2d
]))
1165 for (column2
= 0; column2
< data
->numcols
; column2
++)
1166 { if (data
->cols
[column2
].c
== &data
->cols
[column2d
])
1169 if ((column2
>= 0) && (column2
< data
->numcols
))
1170 { data
->cols
[column2
].c
= data
->cols
[column
].c
;
1171 data
->cols
[column
].c
= &data
->cols
[column2d
];
1173 * data->do_draw_all = data->do_draw_title = data->do_draw = TRUE;
1174 * data->do_parse = data->do_setcols = data->do_updatesb = data->do_wwrap = TRUE;
1177 data
->do_setcols
= TRUE
;
1178 DO_NOTIFY(NTF_Columns
);
1186 LONG
NL_ColWidth(struct NLData
*data
,LONG col
,LONG width
)
1188 LONG column
= NL_ColToColumn(data
,col
);
1189 WORD userwidth
= (WORD
) width
;
1191 if (userwidth
< 4) /* < 4 is considered as MUIV_NList_ColWidth_Default */
1193 if (userwidth
> 2000)
1195 if (width
== MUIV_NList_ColWidth_Get
)
1197 if ((column
>= 0) && (column
< data
->numcols
))
1198 return ((LONG
) data
->cols
[column
].c
->userwidth
);
1200 else if (col
== MUIV_NList_ColWidth_All
)
1202 for (column
= 0;column
< data
->numcols
;column
++)
1204 if (data
->cols
[column
].c
->userwidth
!= userwidth
)
1207 data
->cols
[column
].c
->colwidthbiggestptr
= -2;
1208 data
->cols
[column
].c
->userwidth
= userwidth
;
1209 data
->do_setcols
= TRUE
;
1212 if (data
->do_setcols
)
1217 else if ((column
>= 0) && (column
< data
->numcols
) && (data
->cols
[column
].c
->userwidth
!= userwidth
))
1220 data
->cols
[column
].c
->colwidthbiggestptr
= -2;
1221 data
->cols
[column
].c
->userwidth
= userwidth
;
1222 data
->do_setcols
= TRUE
;
1230 BYTE
*NL_Columns(struct NLData
*data
,BYTE
*columns
)
1234 while ((column
< data
->numcols
) && (columns
[column
] != -1))
1236 NL_SetCol(data
,column
,columns
[column
]);
1240 for (column
= 0; column
< data
->numcols
; column
++)
1241 { data
->column
[column
] = data
->cols
[column
].c
->col
;
1243 data
->column
[column
] = -1;
1244 return (data
->column
);
1248 IPTR
mNL_ColToColumn(struct IClass
*cl
,Object
*obj
,struct MUIP_NList_ColToColumn
*msg
)
1250 struct NLData
*data
= INST_DATA(cl
,obj
);
1251 return ((IPTR
) NL_ColToColumn(data
,msg
->col
));
1255 IPTR
mNL_ColumnToCol(struct IClass
*cl
,Object
*obj
,struct MUIP_NList_ColumnToCol
*msg
)
1257 struct NLData
*data
= INST_DATA(cl
,obj
);
1258 return ((IPTR
) NL_ColumnToCol(data
,msg
->column
));
1262 IPTR
mNL_SetColumnCol(struct IClass
*cl
,Object
*obj
,struct MUIP_NList_SetColumnCol
*msg
)
1264 struct NLData
*data
= INST_DATA(cl
,obj
);
1266 retval
= NL_SetCol(data
,msg
->column
,msg
->col
);
1267 DONE_NOTIFY(NTF_Columns
);
1268 return ((IPTR
) retval
);
1272 IPTR
mNL_List_ColWidth(struct IClass
*cl
,Object
*obj
,struct MUIP_NList_ColWidth
*msg
)
1274 struct NLData
*data
= INST_DATA(cl
,obj
);
1275 return ((IPTR
) NL_ColWidth(data
,msg
->col
,msg
->width
));
1280 IPTR
mNL_ContextMenuBuild(struct IClass
*cl
,Object
*obj
,struct MUIP_ContextMenuBuild
*msg
)
1282 struct NLData
*data
= INST_DATA(cl
,obj
);
1283 Object
*MenuObj
= NULL
;
1287 BOOL order_it
= FALSE
;
1289 if (data
->NList_Disabled
)
1292 if((mo
= xget(obj
, MUIA_ContextMenu
)))
1294 if ((mo
& 0x9d510030) != 0x9d510030)
1297 { MUI_DisposeObject(data
->MenuObj
);
1298 data
->MenuObj
= NULL
;
1300 return(DoSuperMethodA(cl
,obj
,(Msg
) msg
));
1302 else if (mo
== (LONG
)MUIV_NList_ContextMenu_Never
)
1304 data
->ContextMenuOn
= FALSE
;
1305 data
->NList_ContextMenu
= MUIV_NList_ContextMenu_Never
;
1306 nnset(obj
,MUIA_ContextMenu
,NULL
);
1308 for (column
= 0;column
< data
->numcols
;column
++)
1310 if (data
->cols
[column
].c
->userwidth
>= 0)
1312 if (data
->cols
[column
].c
!= &data
->cols
[column
])
1316 /* sba: Contextmenu problem: Disabled */
1317 /* if (data->numcols > 1) */
1318 if (data
->numcols
> 0)
1319 { Object
*mithis
= NULL
;
1320 struct MUI_NList_TestPos_Result res
;
1323 data
->click_x
= msg
->mx
;
1324 data
->click_y
= msg
->my
;
1325 res
.char_number
= -2;
1326 NL_List_TestPos(data
,MUI_MAXMAX
,0,&res
);
1327 column
= (LONG
) res
.column
;
1328 flags
= (LONG
) res
.flags
;
1329 if (res
.flags
& MUI_NLPR_TITLE
)
1334 MenuObj
= (Object
*) DoMethod(obj
,MUIM_NList_ContextMenuBuild
,msg
->mx
,msg
->my
,res
.entry
,column
,flags
,ontop
);
1336 if ((IPTR
)MenuObj
== (IPTR
)-1)
1340 { if (!data
->MenuObj
)
1341 data
->MenuObj
= MUI_MakeObject(MUIO_MenustripNM
,MenuData
,0);
1342 MenuObj
= data
->MenuObj
;
1345 if (MenuObj
&& (mithis
= (Object
*) DoMethod(MenuObj
,MUIM_FindUData
,MUIV_NList_Menu_DefWidth_This
)))
1347 if ((res
.column
>= 0) && (res
.column
< data
->numcols
) &&
1348 !(res
.flags
& MUI_NLPR_BAR
) && (data
->cols
[res
.column
].c
->userwidth
> 0))
1349 { nnset(mithis
,MUIA_Menuitem_Enabled
,TRUE
);
1352 { nnset(mithis
,MUIA_Menuitem_Enabled
,FALSE
);
1355 if (MenuObj
&& (mithis
= (Object
*) DoMethod(MenuObj
,MUIM_FindUData
,MUIV_NList_Menu_DefWidth_All
)))
1357 { nnset(mithis
,MUIA_Menuitem_Enabled
,TRUE
);
1360 { nnset(mithis
,MUIA_Menuitem_Enabled
,FALSE
);
1363 if (MenuObj
&& (mithis
= (Object
*) DoMethod(MenuObj
,MUIM_FindUData
,MUIV_NList_Menu_DefOrder_This
)))
1365 if ((res
.column
>= 0) && (res
.column
< data
->numcols
) &&
1366 !(res
.flags
& MUI_NLPR_BAR
) && (data
->cols
[res
.column
].c
!= &data
->cols
[res
.column
]))
1367 { nnset(mithis
,MUIA_Menuitem_Enabled
,TRUE
);
1370 { nnset(mithis
,MUIA_Menuitem_Enabled
,FALSE
);
1373 if (MenuObj
&& (mithis
= (Object
*) DoMethod(MenuObj
,MUIM_FindUData
,MUIV_NList_Menu_DefOrder_All
)))
1375 { nnset(mithis
,MUIA_Menuitem_Enabled
,TRUE
);
1378 { nnset(mithis
,MUIA_Menuitem_Enabled
,FALSE
);
1381 return ((IPTR
) MenuObj
);
1390 IPTR
mNL_ContextMenuChoice(struct IClass
*cl
,Object
*obj
,struct MUIP_ContextMenuChoice
*msg
)
1392 struct NLData
*data
= INST_DATA(cl
,obj
);
1394 if (data
->NList_Disabled
)
1399 if (muiUserData(msg
->item
) == MUIV_NList_Menu_DefWidth_This
)
1401 struct MUI_NList_TestPos_Result res
;
1403 res
.char_number
= -2;
1404 NL_List_TestPos(data
,MUI_MAXMAX
,0,&res
);
1405 if ((res
.column
>= 0) && (res
.column
< data
->numcols
) && !(res
.flags
& MUI_NLPR_BAR
))
1406 NL_ColWidth(data
,NL_ColumnToCol(data
,res
.column
),MUIV_NList_ColWidth_Default
);
1408 else if (muiUserData(msg
->item
) == MUIV_NList_Menu_DefWidth_All
)
1409 NL_ColWidth(data
,MUIV_NList_ColWidth_All
,MUIV_NList_ColWidth_Default
);
1410 else if (muiUserData(msg
->item
) == MUIV_NList_Menu_DefOrder_This
)
1412 struct MUI_NList_TestPos_Result res
;
1414 res
.char_number
= -2;
1415 NL_List_TestPos(data
,MUI_MAXMAX
,0,&res
);
1416 if ((res
.column
>= 0) && (res
.column
< data
->numcols
) && !(res
.flags
& MUI_NLPR_BAR
))
1417 NL_SetCol(data
,res
.column
,MUIV_NList_SetColumnCol_Default
);
1419 else if (muiUserData(msg
->item
) == MUIV_NList_Menu_DefOrder_All
)
1420 NL_SetCol(data
,MUIV_NList_SetColumnCol_Default
,MUIV_NList_SetColumnCol_Default
);
1422 return(DoSuperMethodA(cl
,obj
,(Msg
) msg
));