grub2: bring back build of aros-side grub2 tools
[AROS.git] / workbench / classes / zune / nlist / nlist_mcc / NList_mcc2.c
blob775dad7bba1eb7c35e5b9f80b7841805d4a095b6
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 <clib/alib_protos.h>
29 #include <proto/muimaster.h>
30 #include <proto/intuition.h>
32 #include "private.h"
34 #if !defined(__amigaos4__)
35 #include "newmouse.h"
36 #endif
38 #include "NList_func.h"
39 #include "NListviews_mcp.h"
41 #define MAX_INTUITICKS_WAIT 3
43 #define MinColWidth 2
45 #define _between(a,x,b) ((x)>=(a) && (x)<=(b))
46 #define _isinobject(x,y) (_between(_mleft(obj),(x),_mright(obj)) && _between(_mtop(obj),(y),_mbottom(obj)))
47 #define _isinobject2(x,y) (_between(_left(obj),(x),_right(obj)) && _between(_top(obj),(y),_bottom(obj)))
49 static LONG NL_TestKey(struct NLData *data,LONG KeyTag,UWORD Code,UWORD Qualifier, BOOL force)
51 UWORD qual;
52 LONG i;
53 Qualifier &= KBQUAL_MASK;
55 if (data->NList_Keys && (!(Code & 0x80) || force))
57 for (i = 0 ; data->NList_Keys[i].kb_KeyTag > 0 ; i++)
59 if ((data->NList_Keys[i].kb_KeyTag == (ULONG)KeyTag) &&
60 ((Code == data->NList_Keys[i].kb_Code) ||
61 ((data->NList_Keys[i].kb_Code == (UWORD)~0) && data->NList_Keys[i].kb_Qualifier)))
63 qual = data->NList_Keys[i].kb_Qualifier;
64 if (Qualifier == qual)
65 return (TRUE);
66 if (!Qualifier || !(qual & KBSYM_MASK))
67 continue;
69 if ((qual & KBSYM_SHIFT) && !(Qualifier & KBQUALIFIER_SHIFT))
70 continue;
71 else
72 qual = qual & ~KBQUALIFIER_SHIFT;
74 if ((qual & KBSYM_CAPS) && !(Qualifier & KBQUALIFIER_CAPS))
75 continue;
76 else
77 qual = qual & ~KBQUALIFIER_CAPS;
79 if ((qual & KBSYM_ALT) && !(Qualifier & KBQUALIFIER_ALT))
80 continue;
81 else
82 qual = qual & ~KBQUALIFIER_ALT;
84 if ((Qualifier & qual) == qual)
85 return (TRUE);
89 return (FALSE);
93 static void NL_RequestIDCMP(struct NLData *data,LONG IDCMP_val)
95 if (IDCMP_val & IDCMP_MOUSEMOVE)
96 data->MOUSE_MOVE = TRUE;
97 if (!(data->ehnode.ehn_Events & IDCMP_val))
99 DoMethod(_win(data->this),MUIM_Window_RemEventHandler, &data->ehnode);
100 data->ehnode.ehn_Events |= IDCMP_val;
101 DoMethod(_win(data->this),MUIM_Window_AddEventHandler, &data->ehnode);
106 static void NL_RejectIDCMP(struct NLData *data,LONG IDCMP_val,BOOL really)
108 if (IDCMP_val & IDCMP_MOUSEMOVE)
109 data->MOUSE_MOVE = FALSE;
110 if ((really || !(IDCMP_val & IDCMP_MOUSEMOVE)) &&
111 (data->ehnode.ehn_Events & IDCMP_val))
113 DoMethod(_win(data->this),MUIM_Window_RemEventHandler, &data->ehnode);
114 data->ehnode.ehn_Events &= (~IDCMP_val);
115 DoMethod(_win(data->this),MUIM_Window_AddEventHandler, &data->ehnode);
119 static BOOL GotoPage(struct IClass *cl, Object *obj, ULONG activePage)
121 struct NLData *data = INST_DATA(cl, obj);
122 BOOL changed;
124 ENTER();
126 if(data->NList_Input && !data->NList_TypeSelect && data->EntriesArray != NULL)
127 changed = NL_List_Active(data, activePage, NULL, data->NList_List_Select, FALSE,0);
128 else
129 changed = NL_List_First(data, activePage, NULL);
131 RETURN(changed);
132 return changed;
135 static BOOL Scroll(struct IClass *cl, Object *obj, ULONG direction)
137 struct NLData *data = INST_DATA(cl, obj);
138 BOOL scrolled;
140 ENTER();
142 scrolled = NL_List_Horiz_First(data, direction, NULL);
144 RETURN(scrolled);
145 return scrolled;
148 IPTR mNL_HandleEvent(struct IClass *cl, Object *obj, struct MUIP_HandleInput *msg)
150 struct NLData *data = INST_DATA(cl,obj);
151 IPTR retval = 0;
152 ULONG NotNotify = data->DoNotify;
153 LONG tempbutton;
154 LONG tempbuttonline;
155 LONG tempbuttoncol;
156 LONG tempbuttonstate;
157 LONG tempstorebutton;
159 *if (msg->imsg && (data->markdrawnum == MUIM_NList_Trigger))
161 *LONG ab = (LONG) data->adjustbar;
162 *LONG co = (LONG) msg->imsg->Code;
163 *LONG qu = (LONG) msg->imsg->Qualifier;
164 *LONG mx = (LONG) msg->imsg->MouseX;
165 *LONG my = (LONG) msg->imsg->MouseY;
166 *kprintf("%lx|1ab %ld stop IntuiMessage :\n",obj,ab);
167 *if (msg->imsg->Class == IDCMP_INACTIVEWINDOW)
168 *D(bug(" Class=INACTIVEWINDOW Code=%lx Qualifier=%lx mx=%ld my=%ld\n",co,qu,mx,my));
169 *else if (msg->imsg->Class == IDCMP_ACTIVEWINDOW)
170 *D(bug(" Class=ACTIVEWINDOW Code=%lx Qualifier=%lx mx=%ld my=%ld\n",co,qu,mx,my));
171 *else if (msg->imsg->Class == IDCMP_MOUSEMOVE)
172 *D(bug(" Class=MOUSEMOVE Code=%lx Qualifier=%lx mx=%ld my=%ld\n",co,qu,mx,my));
173 *else if (msg->imsg->Class == IDCMP_INTUITICKS)
174 *D(bug(" Class=INTUITICKS Code=%lx Qualifier=%lx mx=%ld my=%ld\n",co,qu,mx,my));
175 *else if (msg->imsg->Class == IDCMP_MOUSEBUTTONS)
176 *D(bug(" Class=MOUSEBUTTONS Code=%lx Qualifier=%lx mx=%ld my=%ld\n",co,qu,mx,my));
177 *else
178 *D(bug(" Class=%lx Code=%lx Qualifier=%lx mx=%ld my=%ld\n",msg->imsg->Class,co,qu,mx,my));
182 if (!data->SHOW || !data->DRAW)
183 return 0;
184 if (data->NList_First_Incr || data->NList_AffFirst_Incr)
185 return (MUI_EventHandlerRC_Eat);
186 if (data->NList_Disabled)
187 return 0;
189 if ((data->left != _left(obj)) || (data->top != _top(obj)) ||
190 (data->width != _width(obj)) || (data->height != _height(obj)))
191 NL_SetObjInfos(data,FALSE);
193 if(msg->muikey != MUIKEY_NONE && !data->NList_Quiet && !data->NList_Disabled)
195 data->ScrollBarsTime = SCROLLBARSTIME;
197 SHOWVALUE(DBF_ALWAYS, msg->muikey);
198 switch(msg->muikey)
200 case MUIKEY_UP:
202 BOOL changed = GotoPage(cl, obj, MUIV_NList_First_Up);
204 // if we have an object that we should make the new active object
205 // of the window we do so in case this up key action didn't end up in
206 // a real scrolling
207 if(changed == FALSE && data->NList_KeyUpFocus != NULL)
208 set(_win(obj), MUIA_Window_ActiveObject, data->NList_KeyUpFocus);
210 retval = MUI_EventHandlerRC_Eat;
212 break;
214 case MUIKEY_DOWN:
216 BOOL changed = GotoPage(cl, obj, MUIV_NList_First_Down);
218 // if we have an object that we should make the new active object
219 // of the window we do so in case this down key action didn't end up in
220 // a real scrolling
221 if(changed == FALSE && data->NList_KeyDownFocus != NULL)
222 set(_win(obj), MUIA_Window_ActiveObject, data->NList_KeyDownFocus);
224 retval = MUI_EventHandlerRC_Eat;
226 break;
228 case MUIKEY_PAGEUP:
230 GotoPage(cl, obj, MUIV_NList_Active_PageUp);
231 retval = MUI_EventHandlerRC_Eat;
233 break;
235 case MUIKEY_PAGEDOWN:
237 GotoPage(cl, obj, MUIV_NList_Active_PageDown);
238 retval = MUI_EventHandlerRC_Eat;
240 break;
242 case MUIKEY_TOP:
244 GotoPage(cl, obj, MUIV_NList_Active_Top);
245 retval = MUI_EventHandlerRC_Eat;
247 break;
249 case MUIKEY_BOTTOM:
251 GotoPage(cl, obj, MUIV_NList_Active_Bottom);
252 retval = MUI_EventHandlerRC_Eat;
254 break;
256 case MUIKEY_PRESS:
258 if (data->NList_Input && !data->NList_TypeSelect && data->NList_Active >= 0)
260 data->click_x = data->hpos - data->NList_Horiz_First;
261 if ((data->NList_DefClickColumn > 0) && (data->NList_DefClickColumn < data->numcols))
262 data->click_x += data->cols[data->NList_DefClickColumn].c->minx;
263 else
264 data->click_x += data->cols[0].c->minx;
265 if (data->click_x < data->hpos)
266 data->click_x = data->hpos;
267 if (data->click_x >= data->hpos + data->NList_Horiz_Visible)
268 data->click_x = data->hpos + data->NList_Horiz_Visible - 1;
269 data->click_y = data->vpos + ((data->NList_Active-data->NList_First) * data->vinc) + (data->vinc/2);
270 data->click_line = data->NList_Active;
272 DO_NOTIFY(NTF_Doubleclick | NTF_LV_Doubleclick);
274 if (WANTED_NOTIFY(NTF_EntryClick) && !WANTED_NOTIFY(NTF_Doubleclick) && !WANTED_NOTIFY(NTF_LV_Doubleclick))
276 DO_NOTIFY(NTF_EntryClick);
279 retval = MUI_EventHandlerRC_Eat;
282 break;
284 case MUIKEY_TOGGLE:
286 if (data->multiselect && data->NList_Input && !data->NList_TypeSelect && data->EntriesArray)
288 MOREQUIET;
289 NL_List_Select(data,MUIV_NList_Select_Active,MUIV_NList_Active_Off,MUIV_NList_Select_Toggle,NULL);
290 NL_List_Active(data,MUIV_NList_Active_Down,NULL,data->NList_List_Select,FALSE,0);
291 LESSQUIET;
293 retval = MUI_EventHandlerRC_Eat;
296 break;
298 case MUIKEY_LEFT:
300 BOOL scrolled = Scroll(cl, obj, MUIV_NList_Horiz_First_Left);
302 // if we have an object that we should make the new active object
303 // of the window we do so in case this left key action didn't end up in
304 // a real scrolling
305 D(DBF_STARTUP, "KeyLeftFocus: %ld %lx", scrolled, data->NList_KeyLeftFocus);
306 if(scrolled == FALSE && data->NList_KeyLeftFocus != NULL)
307 set(_win(obj), MUIA_Window_ActiveObject, data->NList_KeyLeftFocus);
309 retval = MUI_EventHandlerRC_Eat;
311 break;
313 case MUIKEY_RIGHT:
315 BOOL scrolled = Scroll(cl, obj, MUIV_NList_Horiz_First_Right);
317 // if we have an object that we should make the new active object
318 // of the window we do so in case this right key action didn't end up in
319 // a real scrolling
320 D(DBF_STARTUP, "KeyRightFocus: %ld %lx", scrolled, data->NList_KeyRightFocus);
321 if(scrolled == FALSE && data->NList_KeyRightFocus != NULL)
322 set(_win(obj), MUIA_Window_ActiveObject, data->NList_KeyRightFocus);
324 retval = MUI_EventHandlerRC_Eat;
326 break;
328 case MUIKEY_WORDLEFT :
330 Scroll(cl, obj, MUIV_NList_Horiz_First_PageLeft);
331 retval = MUI_EventHandlerRC_Eat;
333 break;
335 case MUIKEY_WORDRIGHT:
337 Scroll(cl, obj, MUIV_NList_Horiz_First_PageRight);
338 retval = MUI_EventHandlerRC_Eat;
340 break;
342 case MUIKEY_LINESTART:
344 Scroll(cl, obj, MUIV_NList_Horiz_First_Start);
345 retval = MUI_EventHandlerRC_Eat;
347 break;
349 case MUIKEY_LINEEND:
351 Scroll(cl, obj, MUIV_NList_Horiz_First_End);
352 retval = MUI_EventHandlerRC_Eat;
354 break;
357 // return immediately if a key has been "used"
358 if(retval != 0)
359 return retval;
362 /*D(bug("NL: mNL_HandleEvent() /before \n"));*/
364 if (msg->imsg && !data->NList_Quiet && !data->NList_Disabled)
365 { SIPTR tagval,tagval2;
366 LONG drag_ok = FALSE;
367 WORD hfirst = data->NList_Horiz_AffFirst & ~1;
368 WORD hfirsthpos = hfirst - data->hpos;
369 WORD do_draw = FALSE;
370 LONG WheelFastQual = NL_TestKey(data,KEYTAG_QUALIFIER_WHEEL_FAST,msg->imsg->Code,msg->imsg->Qualifier,TRUE);
371 LONG WheelHorizQual = NL_TestKey(data,KEYTAG_QUALIFIER_WHEEL_HORIZ,msg->imsg->Code,msg->imsg->Qualifier,TRUE);
372 LONG BalanceQual = NL_TestKey(data,KEYTAG_QUALIFIER_BALANCE,msg->imsg->Code,msg->imsg->Qualifier,TRUE);
373 LONG DragQual = NL_TestKey(data,KEYTAG_QUALIFIER_DRAG,msg->imsg->Code,msg->imsg->Qualifier,TRUE);
374 LONG MultQual = NL_TestKey(data,KEYTAG_QUALIFIER_MULTISELECT,msg->imsg->Code,msg->imsg->Qualifier,TRUE);
375 LONG Title2Qual = NL_TestKey(data,KEYTAG_QUALIFIER_TITLECLICK2,msg->imsg->Code,msg->imsg->Qualifier,TRUE);
376 if (data->multisel_qualifier && ((msg->imsg->Qualifier & data->multisel_qualifier) == data->multisel_qualifier))
377 MultQual = TRUE;
378 if (data->NList_WheelMMB && (msg->imsg->Qualifier & IEQUALIFIER_MIDBUTTON))
379 WheelFastQual = TRUE;
380 retval = 0;
382 if ((msg->imsg->Class == IDCMP_INTUITICKS) ||
383 (msg->imsg->Class == IDCMP_MOUSEMOVE) ||
384 (msg->imsg->Class == IDCMP_MOUSEBUTTONS))
385 { if ((data->multiclickalone > 0) &&
386 !DoubleClick(data->secs,data->micros,msg->imsg->Seconds,msg->imsg->Micros))
387 { DO_NOTIFY(NTF_MulticlickAlone);
390 switch (msg->imsg->Class)
392 case IDCMP_INACTIVEWINDOW:
393 case IDCMP_ACTIVEWINDOW:
397 *LONG ab = (LONG) data->adjustbar;
398 *LONG co = (LONG) msg->imsg->Code;
399 *LONG qu = (LONG) msg->imsg->Qualifier;
400 *LONG mx = (LONG) msg->imsg->MouseX;
401 *LONG my = (LONG) msg->imsg->MouseY;
402 *D(bug("%lx|1ab %ld stop IntuiMessage :\n",obj,ab));
403 *if (msg->imsg->Class == IDCMP_INACTIVEWINDOW)
404 *D(bug(" Class=INACTIVEWINDOW Code=%lx Qualifier=%lx mx=%ld my=%ld\n",co,qu,mx,my));
405 *else if (msg->imsg->Class == IDCMP_ACTIVEWINDOW)
406 *D(bug(" Class=ACTIVEWINDOW Code=%lx Qualifier=%lx mx=%ld my=%ld\n",co,qu,mx,my));
407 *else
408 *D(bug(" Class=%lx Code=%lx Qualifier=%lx mx=%ld my=%ld\n",msg->imsg->Class,co,qu,mx,my));
411 NL_RejectIDCMP(data,IDCMP_MOUSEMOVE,TRUE);
412 data->selectskiped = FALSE;
413 data->moves = FALSE;
415 if (data->adjustbar != -1)
416 { data->adjustbar = -1;
417 do_draw = TRUE;
418 data->click_line = -2;
421 ** Reset the ShortHelp to the Default for Not Being Over Button
423 if (data->affover>=0)
425 data->affover = -1;
426 nnset(obj,MUIA_ShortHelp,data->NList_ShortHelp);
428 if (data->affbutton >= 0)
430 NL_Changed(data,data->affbuttonline);
431 do_draw = TRUE;
432 data->affbutton = -1;
433 data->affbuttonline = -1;
434 data->affbuttoncol = -1;
435 data->affbuttonstate = 0;
436 data->storebutton = FALSE;
439 mNL_Trigger(cl,obj,NULL);
440 break;
442 case IDCMP_RAWKEY:
444 data->ScrollBarsTime = SCROLLBARSTIME;
446 if(msg->imsg->Code == RAWKEY_PAGEUP)
448 GotoPage(cl, obj, MUIV_NList_Active_PageUp);
449 retval = MUI_EventHandlerRC_Eat;
451 else if(msg->imsg->Code == RAWKEY_PAGEDOWN)
453 GotoPage(cl, obj, MUIV_NList_Active_PageDown);
454 retval = MUI_EventHandlerRC_Eat;
456 else if(msg->imsg->Code == RAWKEY_HOME)
458 GotoPage(cl, obj, MUIV_NList_Active_Top);
459 retval = MUI_EventHandlerRC_Eat;
461 else if(msg->imsg->Code == RAWKEY_END)
463 GotoPage(cl, obj, MUIV_NList_Active_Bottom);
464 retval = MUI_EventHandlerRC_Eat;
466 else
468 #if !defined(__amigaos4__)
469 // check for wheelmouse events first
470 if(_isinobject(msg->imsg->MouseX,msg->imsg->MouseY))
472 if(msg->imsg->Code == NM_WHEEL_UP) /* MOUSE_WHEEL_UP */
474 if(WheelHorizQual && WheelFastQual)
475 NL_List_Horiz_First(data,MUIV_NList_Horiz_First_Left4,NULL);
476 else if(WheelHorizQual)
477 NL_List_Horiz_First(data,MUIV_NList_Horiz_First_Left,NULL);
478 else if(WheelFastQual)
480 int i;
481 for(i=0; i < data->NList_WheelFast; i++)
482 NL_List_First(data,MUIV_NList_First_Up,NULL);
484 else
486 int i;
487 for(i=0; i < data->NList_WheelStep; i++)
488 NL_List_First(data,MUIV_NList_First_Up,NULL);
491 retval = MUI_EventHandlerRC_Eat;
493 else if(msg->imsg->Code == NM_WHEEL_DOWN) /* MOUSE_WHEEL_DOWN */
495 if(WheelHorizQual && WheelFastQual)
496 NL_List_Horiz_First(data,MUIV_NList_Horiz_First_Right4,NULL);
497 else if(WheelHorizQual)
498 NL_List_Horiz_First(data,MUIV_NList_Horiz_First_Right,NULL);
499 else if(WheelFastQual)
501 int i;
502 for(i=0; i < data->NList_WheelFast; i++)
503 NL_List_First(data,MUIV_NList_First_Down,NULL);
505 else
507 int i;
508 for(i=0; i < data->NList_WheelStep; i++)
509 NL_List_First(data,MUIV_NList_First_Down,NULL);
512 retval = MUI_EventHandlerRC_Eat;
514 else if(msg->imsg->Code == NM_WHEEL_LEFT) /* MOUSE_WHEEL_LEFT */
516 NL_List_Horiz_First(data, WheelFastQual ? MUIV_NList_Horiz_First_Left4 : MUIV_NList_Horiz_First_Left, NULL);
518 retval = MUI_EventHandlerRC_Eat;
520 else if(msg->imsg->Code == NM_WHEEL_RIGHT) /* MOUSE_WHEEL_RIGHT */
522 NL_List_Horiz_First(data, WheelFastQual ? MUIV_NList_Horiz_First_Right4 : MUIV_NList_Horiz_First_Right, NULL);
524 retval = MUI_EventHandlerRC_Eat;
527 #endif
529 if((tagval = xget(_win(obj), MUIA_Window_ActiveObject)) &&
530 ((tagval == (SIPTR)data->nlistviewobj) ||
531 (tagval && (tagval2 = xget((Object *)tagval, MUIA_Listview_List)) && (tagval2 == (SIPTR)data->nlistviewobj)) ||
532 (!tagval && (tagval2 = xget(_win(obj), MUIA_Window_DefaultObject)) && (tagval2 == (SIPTR)data->nlistviewobj)))
535 if (data->NList_AutoCopyToClip)
537 if (NL_TestKey(data,KEYTAG_COPY_TO_CLIPBOARD,msg->imsg->Code,msg->imsg->Qualifier,FALSE))
539 NL_CopyTo(data,MUIV_NList_CopyToClip_Selected,NULL,0L,NULL,NULL);
540 if (data->NList_TypeSelect == MUIV_NList_TypeSelect_Char)
541 SelectFirstPoint(data,data->click_x,data->click_y);
542 retval = MUI_EventHandlerRC_Eat;
545 if (NL_TestKey(data,KEYTAG_SELECT_TO_TOP,msg->imsg->Code,msg->imsg->Qualifier,FALSE))
547 if (data->NList_Input && !data->NList_TypeSelect && data->EntriesArray)
549 LONG newactsel = MUIV_NList_Select_On;
551 if (data->NList_Active >= 0 && data->EntriesArray[data->NList_Active]->Select == TE_Select_None)
552 newactsel = MUIV_NList_Select_Off;
553 NL_List_Active(data,MUIV_NList_Active_UntilTop,NULL,newactsel,FALSE,0);
555 retval = MUI_EventHandlerRC_Eat;
557 else if (NL_TestKey(data,KEYTAG_SELECT_TO_BOTTOM,msg->imsg->Code,msg->imsg->Qualifier,FALSE))
559 if (data->NList_Input && !data->NList_TypeSelect && data->EntriesArray)
561 LONG newactsel = MUIV_NList_Select_On;
563 if (data->NList_Active >= 0 && data->EntriesArray[data->NList_Active]->Select == TE_Select_None)
564 newactsel = MUIV_NList_Select_Off;
565 NL_List_Active(data,MUIV_NList_Active_UntilBottom,NULL,newactsel,FALSE,0);
567 retval = MUI_EventHandlerRC_Eat;
569 else if (NL_TestKey(data,KEYTAG_SELECT_TO_PAGE_UP,msg->imsg->Code,msg->imsg->Qualifier,FALSE))
571 /* Page up key pressed */
572 if (data->NList_Input && !data->NList_TypeSelect && data->EntriesArray)
574 LONG newactsel = MUIV_NList_Select_On;
576 if (data->NList_Active >= 0 && data->EntriesArray[data->NList_Active]->Select == TE_Select_None)
577 newactsel = MUIV_NList_Select_Off;
578 NL_List_Active(data,MUIV_NList_Active_UntilPageUp,NULL,newactsel,FALSE,0);
580 retval = MUI_EventHandlerRC_Eat;
582 else if (NL_TestKey(data,KEYTAG_SELECT_TO_PAGE_DOWN,msg->imsg->Code,msg->imsg->Qualifier,FALSE))
584 /* Page down key pressed */
585 if (data->NList_Input && !data->NList_TypeSelect && data->EntriesArray)
587 LONG newactsel = MUIV_NList_Select_On;
589 if (data->NList_Active >= 0 && data->EntriesArray[data->NList_Active]->Select == TE_Select_None)
590 newactsel = MUIV_NList_Select_Off;
591 NL_List_Active(data,MUIV_NList_Active_UntilPageDown,NULL,newactsel,FALSE,0);
593 retval = MUI_EventHandlerRC_Eat;
595 else if (NL_TestKey(data,KEYTAG_SELECT_UP,msg->imsg->Code,msg->imsg->Qualifier,FALSE))
597 /* Up key pressed */
598 if (data->NList_Input && !data->NList_TypeSelect && data->EntriesArray)
600 LONG newactsel = MUIV_NList_Select_On;
602 if (data->NList_Active >= 0 && data->EntriesArray[data->NList_Active]->Select == TE_Select_None)
603 newactsel = MUIV_NList_Select_Off;
604 NL_List_Active(data,MUIV_NList_Active_Up,NULL,newactsel,FALSE,0);
606 retval = MUI_EventHandlerRC_Eat;
608 else if (NL_TestKey(data,KEYTAG_SELECT_DOWN,msg->imsg->Code,msg->imsg->Qualifier,FALSE))
610 /* Down key pressed */
611 if (data->NList_Input && !data->NList_TypeSelect && data->EntriesArray)
613 LONG newactsel = MUIV_NList_Select_On;
615 if (data->NList_Active >= 0 && data->EntriesArray[data->NList_Active]->Select == TE_Select_None)
616 newactsel = MUIV_NList_Select_Off;
617 NL_List_Active(data,MUIV_NList_Active_Down,NULL,newactsel,FALSE,0);
619 retval = MUI_EventHandlerRC_Eat;
621 else if (NL_TestKey(data,KEYTAG_TOGGLE_ACTIVE,msg->imsg->Code,msg->imsg->Qualifier,FALSE))
623 if (data->multiselect && data->NList_Input && !data->NList_TypeSelect && data->EntriesArray)
624 NL_List_Select(data,MUIV_NList_Select_Active,MUIV_NList_Active_Off,MUIV_NList_Select_Toggle,NULL);
625 retval = MUI_EventHandlerRC_Eat;
627 else if (NL_TestKey(data,KEYTAG_DEFAULT_WIDTH_COLUMN,msg->imsg->Code,msg->imsg->Qualifier,FALSE))
629 struct MUI_NList_TestPos_Result res;
631 res.char_number = -2;
632 NL_List_TestPos(data,MUI_MAXMAX,0,&res);
633 if ((res.column >= 0) && (res.column < data->numcols) && !(res.flags & MUI_NLPR_BAR))
635 NL_RejectIDCMP(data,IDCMP_MOUSEMOVE,TRUE);
636 data->selectskiped = FALSE;
637 data->moves = FALSE;
638 if (data->adjustbar != -1)
639 { data->adjustbar = -1;
640 do_draw = TRUE;
641 data->click_line = -2;
643 NL_ColWidth(data,NL_ColumnToCol(data,res.column),MUIV_NList_ColWidth_Default);
646 else if (NL_TestKey(data,KEYTAG_DEFAULT_WIDTH_ALL_COLUMNS,msg->imsg->Code,msg->imsg->Qualifier,FALSE))
647 NL_ColWidth(data,MUIV_NList_ColWidth_All,MUIV_NList_ColWidth_Default);
648 else if (NL_TestKey(data,KEYTAG_DEFAULT_ORDER_COLUMN,msg->imsg->Code,msg->imsg->Qualifier,FALSE))
650 struct MUI_NList_TestPos_Result res;
652 res.char_number = -2;
653 NL_List_TestPos(data,MUI_MAXMAX,0,&res);
654 if ((res.column >= 0) && (res.column < data->numcols) && !(res.flags & MUI_NLPR_BAR))
656 NL_RejectIDCMP(data,IDCMP_MOUSEMOVE,TRUE);
657 data->selectskiped = FALSE;
658 data->moves = FALSE;
659 if (data->adjustbar != -1)
660 { data->adjustbar = -1;
661 do_draw = TRUE;
662 data->click_line = -2;
664 NL_SetCol(data,res.column,MUIV_NList_SetColumnCol_Default);
667 else if (NL_TestKey(data,KEYTAG_DEFAULT_ORDER_ALL_COLUMNS,msg->imsg->Code,msg->imsg->Qualifier,FALSE))
668 NL_SetCol(data,MUIV_NList_SetColumnCol_Default,MUIV_NList_SetColumnCol_Default);
671 * else
672 * { int posraw;
673 * posraw = DeadKeyConvert(data,msg->imsg,data->rawtext,MAXRAWBUF,0L);
674 * if (posraw > 0)
676 * D(bug("RAWKEY BUF=%s \n",data->rawtext));
683 break;
685 #if defined(__amigaos4__)
686 case IDCMP_EXTENDEDMOUSE:
688 if(msg->imsg->Code & IMSGCODE_INTUIWHEELDATA &&
689 _isinobject(msg->imsg->MouseX, msg->imsg->MouseY))
691 struct IntuiWheelData *iwd = (struct IntuiWheelData *)msg->imsg->IAddress;
693 if(iwd->WheelY < 0) // WHEEL_UP
695 if(WheelHorizQual && WheelFastQual)
696 NL_List_Horiz_First(data, MUIV_NList_Horiz_First_Left4, NULL);
697 else if(WheelHorizQual)
698 NL_List_Horiz_First(data, MUIV_NList_Horiz_First_Left, NULL);
699 else if(WheelFastQual)
701 int i;
702 for(i=0; i < data->NList_WheelFast; i++)
703 NL_List_First(data, MUIV_NList_First_Up, NULL);
705 else
707 int i;
708 for(i=0; i < data->NList_WheelStep; i++)
709 NL_List_First(data, MUIV_NList_First_Up, NULL);
712 retval = MUI_EventHandlerRC_Eat;
714 else if(iwd->WheelY > 0) // WHEEL_DOWN
716 if(WheelHorizQual && WheelFastQual)
717 NL_List_Horiz_First(data, MUIV_NList_Horiz_First_Right4, NULL);
718 else if(WheelHorizQual)
719 NL_List_Horiz_First(data, MUIV_NList_Horiz_First_Right, NULL);
720 else if(WheelFastQual)
722 int i;
723 for(i=0; i < data->NList_WheelFast; i++)
724 NL_List_First(data, MUIV_NList_First_Down, NULL);
726 else
728 int i;
729 for(i=0; i < data->NList_WheelStep; i++)
730 NL_List_First(data, MUIV_NList_First_Down, NULL);
733 retval = MUI_EventHandlerRC_Eat;
736 if(iwd->WheelX < 0) // WHEEL_LEFT
738 NL_List_Horiz_First(data, WheelFastQual ? MUIV_NList_Horiz_First_Left4 : MUIV_NList_Horiz_First_Left, NULL);
740 retval = MUI_EventHandlerRC_Eat;
742 else if(iwd->WheelX > 0) // WHEEL_RIGHT
744 NL_List_Horiz_First(data, WheelFastQual ? MUIV_NList_Horiz_First_Right4 : MUIV_NList_Horiz_First_Right, NULL);
746 retval = MUI_EventHandlerRC_Eat;
750 break;
751 #endif
753 case IDCMP_MOUSEBUTTONS:
754 data->ScrollBarsTime = SCROLLBARSTIME;
756 LONG multi = 0;
757 LONG isdoubleclick = 0;
758 if ((data->multiselect != MUIV_NList_MultiSelect_None) &&
759 (MultQual || (data->multiselect == MUIV_NList_MultiSelect_Always)))
760 multi = 1;
761 data->selectskiped = FALSE;
763 // Using _isinobject2() here would also recognize clicks on the list's border
764 // as clicks inside the list. But clicking on the border above the list's title
765 // being interpreted like a click the first entry is not very intuitive. Thus
766 // we restrict ourself to clicks really inside the object here.
767 if(msg->imsg->Code == SELECTDOWN && _isinobject(msg->imsg->MouseX, msg->imsg->MouseY))
769 WORD ly = (msg->imsg->MouseY - data->vpos);
770 WORD ly2 = (msg->imsg->MouseY - data->vdtitlepos);
771 WORD lyl = ly / data->vinc;
772 LONG lyl2 = lyl + data->NList_First;
773 WORD lx = (msg->imsg->MouseX - data->hpos);
774 BOOL do_else = FALSE;
775 BOOL mclick = FALSE;
777 if (lx < 0)
779 NL_List_Horiz_First(data,MUIV_NList_Horiz_First_Left,NULL);
780 data->selectmode = MUIV_NList_Select_None;
781 data->NumIntuiTick = MAX_INTUITICKS_WAIT;
782 data->moves = TRUE;
783 NL_RequestIDCMP(data,IDCMP_MOUSEMOVE);
785 else if (lx >= data->NList_Horiz_Visible)
787 NL_List_Horiz_First(data,MUIV_NList_Horiz_First_Right,NULL);
788 data->selectmode = MUIV_NList_Select_None;
789 data->NumIntuiTick = MAX_INTUITICKS_WAIT;
790 data->moves = TRUE;
791 NL_RequestIDCMP(data,IDCMP_MOUSEMOVE);
793 else if (ly2 < 0)
795 data->selectmode = data->NList_List_Select;
796 if (data->NList_Input && !data->NList_TypeSelect)
797 { if (data->NList_Active > data->NList_First)
798 NL_List_Active(data,MUIV_NList_Active_PageUp,NULL,data->selectmode,FALSE,0);
799 else
800 NL_List_Active(data,MUIV_NList_Active_Up,NULL,data->selectmode,FALSE,0);
802 else
803 NL_List_First(data,MUIV_NList_First_Up,NULL);
804 data->NumIntuiTick = MAX_INTUITICKS_WAIT;
805 data->moves = TRUE;
806 NL_RequestIDCMP(data,IDCMP_MOUSEMOVE);
808 else if ((lyl >= data->NList_Visible) || (lyl2 >= data->NList_Entries))
810 data->selectmode = data->NList_List_Select;
811 if (data->NList_Input && !data->NList_TypeSelect)
812 { if (data->NList_Active < data->NList_First - 1 + data->NList_Visible)
813 NL_List_Active(data,MUIV_NList_Active_PageDown,NULL,data->selectmode,FALSE,0);
814 else
815 NL_List_Active(data,MUIV_NList_Active_Down,NULL,data->selectmode,FALSE,0);
817 else
818 NL_List_First(data,MUIV_NList_First_Down,NULL);
819 data->NumIntuiTick = MAX_INTUITICKS_WAIT;
820 data->moves = TRUE;
821 NL_RequestIDCMP(data,IDCMP_MOUSEMOVE);
823 else
824 do_else = TRUE;
826 if ((lx < 0) || (lx >= data->NList_Horiz_Visible) || (ly2 < 0) || (lyl >= data->NList_Visible) || (lyl2 >= data->NList_Entries))
827 lyl2 = -2;
828 else if ((ly2 >= 0) && (ly < 0))
829 lyl2 = -1;
830 isdoubleclick = DoubleClick(data->secs,data->micros,msg->imsg->Seconds,msg->imsg->Micros);
831 if ((data->click_line == lyl2) && (lyl2 >= -1) &&
832 (abs(data->click_x - msg->imsg->MouseX) < 4) && (abs(data->click_y - msg->imsg->MouseY) < 4) &&
833 isdoubleclick)
835 mclick = TRUE;
837 else
839 BOOL modifyActiveObject = FALSE;
840 BOOL modifyDefaultObject = FALSE;
841 Object *newActiveObject = (Object *)MUIV_Window_ActiveObject_None;
843 data->secs = msg->imsg->Seconds;
844 data->micros = msg->imsg->Micros;
845 data->click_line = lyl2;
846 data->click_x = msg->imsg->MouseX;
847 data->click_y = msg->imsg->MouseY;
848 data->mouse_x = msg->imsg->MouseX;
849 data->mouse_y = msg->imsg->MouseY;
850 data->multiclick = 0;
851 data->multiclickalone = 1;
852 if (data->click_line >= 0)
854 DO_NOTIFY(NTF_EntryClick);
857 if (data->NList_Title && (lx >= 0) && (lx < data->NList_Horiz_Visible) && (ly2 >= 0) && (ly < 0))
859 struct MUI_NList_TestPos_Result res;
861 res.char_number = -2;
862 NL_List_TestPos(data,MUI_MAXMAX,MUI_MAXMAX,&res);
863 if ((res.flags & MUI_NLPR_BAR) && (res.flags & MUI_NLPR_TITLE) && (res.flags & MUI_NLPR_ABOVE) &&
864 (res.column < data->numcols) && (res.column >= 0))
866 WORD minx = data->cols[res.column].c->minx - hfirsthpos
867 + ((data->cols[res.column].c->delta-1) / 2) + MinColWidth;
868 WORD actx = data->cols[res.column].c->maxx - hfirsthpos
869 + ((data->cols[res.column].c->delta-1) / 2);
870 if ((actx < data->mleft) || (actx > data->mright))
871 actx = msg->imsg->MouseX;
872 data->adjustcolumn = res.column;
874 if (actx <= minx)
875 { if (minx >= data->mleft)
876 { data->adjustbar = minx + hfirsthpos;
877 data->adjustbar_last = data->cols[data->adjustcolumn].c->userwidth;
878 do_draw = TRUE;
879 NL_RequestIDCMP(data,IDCMP_MOUSEMOVE);
882 else if (actx > minx)
883 { data->adjustbar = actx + hfirsthpos;
884 data->adjustbar_last = data->cols[data->adjustcolumn].c->userwidth;
885 do_draw = TRUE;
886 NL_RequestIDCMP(data,IDCMP_MOUSEMOVE);
888 if ((data->adjustbar >= 0) && BalanceQual &&
889 ((res.column < data->numcols-2) ||
890 ((res.column == data->numcols-2) && (data->cols[res.column+1].c->userwidth > 0))))
891 { data->adjustbar_last2 = data->cols[res.column+1].c->userwidth;
892 data->adjustbar2 = data->cols[res.column+1].c->maxx;
894 else
895 data->adjustbar2 = -1;
897 data->click_line = -2;
898 data->moves = FALSE;
899 drag_ok = FALSE;
901 else if ((res.flags & MUI_NLPR_ABOVE) && (res.flags & MUI_NLPR_TITLE) &&
902 (res.column < data->numcols) && (res.column >= 0))
904 data->adjustcolumn = res.column;
905 if ((WANTED_NOTIFY(NTF_TitleClick) || WANTED_NOTIFY(NTF_TitleClick2)) && data->cols[res.column].c->titlebutton)
906 { data->adjustbar = -2;
907 do_draw = TRUE;
908 NL_RequestIDCMP(data,IDCMP_MOUSEMOVE);
910 else
911 { if (WANTED_NOTIFY(NTF_TitleClick2) && (Title2Qual || !WANTED_NOTIFY(NTF_TitleClick)))
912 data->TitleClick2 = (LONG) data->cols[res.column].c->col;
913 else
914 data->TitleClick = (LONG) data->cols[res.column].c->col;
915 if ((data->adjustcolumn >= data->NList_MinColSortable) &&
916 ((data->numcols - data->NList_MinColSortable) > 1) &&
917 (NL_OnWindow(data,msg->imsg->MouseX,msg->imsg->MouseY)))
921 *LONG ab = (LONG) data->adjustbar;
922 *LONG co = (LONG) msg->imsg->Code;
923 *LONG qu = (LONG) msg->imsg->Qualifier;
924 *LONG mx = (LONG) msg->imsg->MouseX;
925 *LONG my = (LONG) msg->imsg->MouseY;
926 *D(bug("%lx|1ab0 %ld start col sort IntuiMessage :\n",obj,ab));
927 *if (msg->imsg->Class == IDCMP_MOUSEMOVE)
928 *D(bug(" Class=MOUSEMOVE Code=%lx Qualifier=%lx mx=%ld my=%ld\n",co,qu,mx,my));
929 *else if (msg->imsg->Class == IDCMP_INTUITICKS)
930 *D(bug(" Class=INTUITICKS Code=%lx Qualifier=%lx mx=%ld my=%ld\n",co,qu,mx,my));
931 *else if (msg->imsg->Class == IDCMP_MOUSEBUTTONS)
932 *D(bug(" Class=MOUSEBUTTONS Code=%lx Qualifier=%lx mx=%ld my=%ld\n",co,qu,mx,my));
933 *else
934 *D(bug(" Class=%lx Code=%lx Qualifier=%lx mx=%ld my=%ld\n",msg->imsg->Class,co,qu,mx,my));
937 data->adjustbar = -10;
939 // set a custom mouse pointer
940 ShowCustomPointer(data, PT_MOVE);
943 data->moves = FALSE;
944 drag_ok = FALSE;
947 else if (!data->NList_Title && (lx >= 0) && (lx < data->NList_Horiz_Visible) && (ly < data->vinc/2) && (ly >= 0))
948 { struct MUI_NList_TestPos_Result res;
950 res.char_number = -2;
951 NL_List_TestPos(data,MUI_MAXMAX,MUI_MAXMAX,&res);
952 if ((res.flags & MUI_NLPR_BAR) &&
953 (res.column < data->numcols) && (res.column >= 0))
955 WORD minx = data->cols[res.column].c->minx - hfirsthpos
956 + ((data->cols[res.column].c->delta-1) / 2) + 10;
957 WORD actx = data->cols[res.column].c->maxx - hfirsthpos
958 + ((data->cols[res.column].c->delta-1) / 2);
959 if ((actx < data->mleft) || (actx > data->mright))
960 actx = msg->imsg->MouseX;
961 data->adjustcolumn = res.column;
963 if (actx <= minx)
964 { if (minx >= data->mleft)
965 { data->adjustbar = minx + hfirsthpos;
966 data->adjustbar_last = data->cols[data->adjustcolumn].c->userwidth;
967 do_draw = TRUE;
968 NL_RequestIDCMP(data,IDCMP_MOUSEMOVE);
971 else if (actx > minx)
972 { data->adjustbar = actx + hfirsthpos;
973 data->adjustbar_last = data->cols[data->adjustcolumn].c->userwidth;
974 do_draw = TRUE;
975 NL_RequestIDCMP(data,IDCMP_MOUSEMOVE);
977 if ((data->adjustbar >= 0) && BalanceQual &&
978 ((res.column < data->numcols-2) ||
979 ((res.column == data->numcols-2) && (data->cols[res.column+1].c->userwidth > 0))))
980 { data->adjustbar_last2 = data->cols[res.column+1].c->userwidth;
981 data->adjustbar2 = data->cols[res.column+1].c->maxx;
983 else
984 data->adjustbar2 = -1;
986 data->click_line = -2;
987 data->moves = FALSE;
988 drag_ok = FALSE;
992 if(data->NList_DefaultObjectOnClick == TRUE)
994 IPTR tst = xget(_win(obj), MUIA_Window_ActiveObject);
996 if(tst != MUIV_Window_ActiveObject_None && tst != data->NList_KeepActive && tst != (IPTR)data->nlistviewobj)
998 if(data->NList_MakeActive != (IPTR)NULL)
999 newActiveObject = (Object *)data->NList_MakeActive;
1000 else
1001 newActiveObject = (Object *)MUIV_Window_ActiveObject_None;
1003 modifyActiveObject = TRUE;
1006 modifyDefaultObject = TRUE;
1008 else if(data->NList_MakeActive != (IPTR)NULL)
1010 newActiveObject = (Object *)data->NList_MakeActive;
1011 modifyActiveObject = TRUE;
1014 // now we check if the user wants to set this object
1015 // as the active one or not.
1016 if(data->NList_ActiveObjectOnClick == TRUE && data->isActiveObject == FALSE)
1018 // set our parent NListview object as new active object
1019 newActiveObject = data->nlistviewobj;
1020 modifyActiveObject = TRUE;
1023 // change the window's active object if necessary
1024 if(modifyActiveObject == TRUE)
1026 set(_win(obj), MUIA_Window_ActiveObject, newActiveObject);
1028 else if(modifyDefaultObject == TRUE)
1030 // set our parent NListview object as new default object
1031 set(_win(obj), MUIA_Window_DefaultObject, data->nlistviewobj);
1034 if(data->NList_TypeSelect && (data->adjustbar == -1))
1036 if(MultQual)
1037 SelectSecondPoint(data,data->click_x,data->click_y);
1038 else
1040 data->NList_TypeSelect = MUIV_NList_TypeSelect_Char;
1041 SelectFirstPoint(data,data->click_x,data->click_y);
1046 if (do_else && (data->adjustbar == -1) && (ly >= 0) && (lyl >= 0) && (lyl < data->NList_Visible))
1048 struct MUI_NList_TestPos_Result res;
1050 data->affbutton = -1;
1051 data->affbuttonline = -1;
1052 data->affbuttoncol = -1;
1053 data->affbuttonstate = 0;
1054 data->storebutton = TRUE;
1055 res.char_number = 0;
1056 NL_List_TestPos(data,msg->imsg->MouseX,msg->imsg->MouseY,&res);
1057 data->storebutton = FALSE;
1058 if ((data->affbutton >= 0) && (data->affbuttonline >= 0))
1059 { data->affbuttonstate = -2;
1060 NL_Changed(data,data->affbuttonline);
1061 do_draw = TRUE;
1062 data->moves = FALSE;
1063 drag_ok = FALSE;
1064 mclick = FALSE;
1066 NL_RequestIDCMP(data,IDCMP_MOUSEMOVE);
1069 if(mclick)
1071 data->secs = msg->imsg->Seconds;
1072 data->micros = msg->imsg->Micros;
1073 data->multiclick++;
1074 data->multiclickalone++;
1076 if (data->multiclick == 1)
1078 DO_NOTIFY(NTF_Doubleclick | NTF_LV_Doubleclick);
1080 else if (data->multiclick > 1)
1082 DO_NOTIFY(NTF_Multiclick);
1085 if (data->NList_TypeSelect && (data->adjustbar == -1))
1087 if (MultQual)
1088 { SelectSecondPoint(data,data->click_x,data->click_y);
1089 do_else = FALSE;
1091 else
1093 if ((data->multiclick % 3) == 0)
1094 data->NList_TypeSelect = MUIV_NList_TypeSelect_Char;
1095 else if ((data->multiclick % 3) == 1)
1096 data->NList_TypeSelect = MUIV_NList_TypeSelect_CWord;
1097 else if ((data->multiclick % 3) == 2)
1098 data->NList_TypeSelect = MUIV_NList_TypeSelect_CLine;
1099 SelectFirstPoint(data,data->click_x,data->click_y);
1100 do_else = FALSE;
1105 if (do_else && (data->adjustbar == -1) && (data->affbutton < 0) && (ly >= 0) && (lyl >= 0) && (lyl < data->NList_Visible))
1107 long lactive = lyl + data->NList_First;
1108 if ((lactive >= 0) && (lactive < data->NList_Entries))
1110 if (data->NList_Input && !data->NList_TypeSelect)
1112 if (data->multiselect == MUIV_NList_MultiSelect_None)
1114 data->selectmode = MUIV_NList_Select_On;
1115 NL_List_Active(data,lactive,NULL,data->selectmode,FALSE,0);
1117 else if (!multi)
1119 MOREQUIET;
1120 NL_UnSelectAll(data,lactive);
1121 data->selectmode = MUIV_NList_Select_On;
1122 NL_List_Active(data,lactive,NULL,data->selectmode,TRUE,0);
1123 LESSQUIET;
1124 data->selectskiped = TRUE;
1126 else
1128 if (data->EntriesArray[lactive]->Select == TE_Select_None)
1129 data->selectmode = MUIV_NList_Select_On;
1130 else
1131 data->selectmode = MUIV_NList_Select_Off;
1132 NL_List_Active(data,lactive,NULL,data->selectmode,TRUE,0);
1133 data->selectskiped = TRUE;
1137 data->moves = TRUE;
1138 NL_RequestIDCMP(data,IDCMP_MOUSEMOVE);
1140 if (data->drag_type != MUIV_NList_DragType_None)
1142 if (DragQual)
1143 drag_ok = TRUE;
1144 else if ((data->drag_type == MUIV_NList_DragType_Immediate) || (data->drag_type == MUIV_NList_DragType_Borders))
1145 data->drag_border = TRUE;
1149 // the click happened inside our realm, so signal MUI that we ate that click
1150 retval = MUI_EventHandlerRC_Eat;
1152 else
1154 if((msg->imsg->Code==SELECTDOWN) && data->NList_DefaultObjectOnClick)
1156 /* click was not in _isinobject2() */
1157 ULONG tst = xget(_win(obj), MUIA_Window_DefaultObject);
1159 if(tst == (IPTR)obj)
1160 set(_win(obj), MUIA_Window_DefaultObject, NULL);
1162 // do not return MUI_EventHandlerRC_Eat, because this click happened outside
1163 // of our realm and most probably needs to be handled by another object.
1166 if (!(((msg->imsg->Code==MIDDLEDOWN) || (msg->imsg->Code==MIDDLEUP)) && (data->drag_qualifier & IEQUALIFIER_MIDBUTTON)) &&
1167 !(((msg->imsg->Code==MENUDOWN) || (msg->imsg->Code==MENUUP)) && (data->drag_qualifier & IEQUALIFIER_RBUTTON)))
1170 NL_RejectIDCMP(data,IDCMP_MOUSEMOVE,FALSE);
1171 data->selectskiped = FALSE;
1172 data->moves = FALSE;
1173 drag_ok = FALSE;
1176 if (msg->imsg->Code==SELECTUP)
1178 data->moves = data->selectskiped = FALSE;
1181 *LONG ab = (LONG) data->adjustbar;
1182 *LONG co = (LONG) msg->imsg->Code;
1183 *LONG qu = (LONG) msg->imsg->Qualifier;
1184 *LONG mx = (LONG) msg->imsg->MouseX;
1185 *LONG my = (LONG) msg->imsg->MouseY;
1186 *D(bug("18a Class=%lx Code=%lx Qualifier=%lx mx=%ld my=%ld %ld.%ld (%ld)\n",msg->imsg->Class,co,qu,mx,my,msg->imsg->Seconds,msg->imsg->Micros,data->moves));
1189 if(data->NList_Input == FALSE && (data->NList_TypeSelect == MUIV_NList_TypeSelect_Char) &&
1190 data->NList_AutoClip == TRUE && (data->sel_pt[0].ent >= 0) && (data->sel_pt[1].ent >= 0) && !MultQual)
1192 NL_CopyTo(data,MUIV_NList_CopyToClip_Selected,NULL,0L,NULL,NULL);
1193 SelectFirstPoint(data,data->click_x,data->click_y);
1196 if ((msg->imsg->Code==SELECTUP) && ((data->adjustbar >= 0) || (data->adjustbar_old >= 0)))
1198 if ((data->adjustcolumn < data->numcols) && (data->adjustcolumn >= 0))
1200 WORD userwidth = data->adjustbar
1201 - ((data->cols[data->adjustcolumn].c->delta-1) / 2)
1202 - data->cols[data->adjustcolumn].c->minx;
1204 if (userwidth < MinColWidth)
1205 userwidth = MinColWidth;
1206 if (data->cols[data->adjustcolumn].c->userwidth != userwidth)
1208 data->cols[data->adjustcolumn].c->userwidth = userwidth;
1209 if (data->adjustbar2 >= 0)
1211 userwidth = data->adjustbar2 - data->cols[data->adjustcolumn].c->minx
1212 - userwidth - data->cols[data->adjustcolumn].c->delta;
1213 if (userwidth < MinColWidth)
1214 userwidth = MinColWidth;
1215 data->cols[data->adjustcolumn+1].c->userwidth = userwidth;
1217 data->do_setcols = TRUE;
1218 /*data->ScrollBarsPos = -2;*/
1221 data->adjustbar = -1;
1222 do_draw = TRUE;
1223 NL_RejectIDCMP(data,IDCMP_MOUSEMOVE,TRUE);
1224 data->click_line = -2;
1225 data->moves = FALSE;
1226 drag_ok = FALSE;
1228 else if (((msg->imsg->Code == MENUDOWN) || (msg->imsg->Code == MENUUP)) &&
1229 ((data->adjustbar >= 0) || (data->adjustbar_old >= 0)))
1231 if (data->NList_ColWidthDrag == MUIV_NList_ColWidthDrag_Visual)
1233 data->cols[data->adjustcolumn].c->userwidth = data->adjustbar_last;
1234 if (data->adjustbar2 > 0)
1235 data->cols[data->adjustcolumn+1].c->userwidth = data->adjustbar_last2;
1236 data->do_setcols = TRUE;
1238 data->adjustbar = -1;
1239 data->adjustbar2 = -1;
1240 NL_RejectIDCMP(data,IDCMP_MOUSEMOVE,FALSE);
1241 do_draw = TRUE;
1242 data->click_line = -2;
1243 data->moves = FALSE;
1244 drag_ok = FALSE;
1246 if ((msg->imsg->Code==SELECTUP) && (data->adjustbar >= -4) && (data->adjustbar <= -2))
1247 { NL_RejectIDCMP(data,IDCMP_MOUSEMOVE,TRUE);
1248 data->moves = FALSE;
1249 drag_ok = FALSE;
1250 if ((data->adjustbar > -4) &&
1251 (data->adjustcolumn < data->numcols) && (data->adjustcolumn >= 0) &&
1252 (msg->imsg->MouseX >= data->mleft) &&
1253 (msg->imsg->MouseX <= data->mright) &&
1254 (msg->imsg->MouseY >= data->vdtitlepos) &&
1255 (msg->imsg->MouseY < data->mbottom))
1256 { data->click_line = -2;
1257 if (WANTED_NOTIFY(NTF_TitleClick2) && (Title2Qual || !WANTED_NOTIFY(NTF_TitleClick)))
1258 { data->TitleClick2 = (LONG) data->cols[data->adjustcolumn].c->col;
1259 DO_NOTIFY(NTF_TitleClick2);
1261 else
1262 { data->TitleClick = (LONG) data->cols[data->adjustcolumn].c->col;
1263 DO_NOTIFY(NTF_TitleClick);
1266 data->adjustbar = -1;
1267 do_draw = TRUE;
1269 else if ((msg->imsg->Code==SELECTUP) && (data->adjustbar == -10))
1271 NL_RejectIDCMP(data,IDCMP_MOUSEMOVE,TRUE);
1272 data->moves = FALSE;
1273 drag_ok = FALSE;
1274 data->adjustbar = -1;
1275 do_draw = TRUE;
1276 HideCustomPointer(data);
1278 if (((msg->imsg->Code==SELECTUP) || (msg->imsg->Code==MENUDOWN)) &&
1279 (data->affbutton >= 0))
1281 if ((data->affbuttonstate == 2) || (data->affbuttonstate == -2))
1283 data->NList_ButtonClick = data->affbutton;
1284 DO_NOTIFY(NTF_ButtonClick);
1286 NL_RejectIDCMP(data,IDCMP_MOUSEMOVE,TRUE);
1287 NL_Changed(data,data->affbuttonline);
1288 do_draw = TRUE;
1289 data->affbutton = -1;
1290 data->affbuttonline = -1;
1291 data->affbuttoncol = -1;
1292 data->affbuttonstate = 0;
1293 data->storebutton = FALSE;
1296 //retval = MUI_EventHandlerRC_Eat;
1297 break;
1298 case IDCMP_INTUITICKS:
1300 struct MUI_NList_TestPos_Result res;
1302 ** Store Current Values to Temp Variables
1304 tempbutton = data->affbutton;
1305 tempbuttonline = data->affbuttonline;
1306 tempbuttoncol = data->affbuttoncol;
1307 tempbuttonstate = data->affbuttonstate;
1308 tempstorebutton = data->storebutton;
1309 data->affimage = -1;
1310 data->affbutton = -1;
1311 data->affbuttonline = -1;
1312 data->affbuttoncol = -1;
1313 data->affbuttonstate = 0;
1314 data->storebutton = TRUE;
1315 res.char_number = 0;
1316 NL_List_TestPos(data,msg->imsg->MouseX,msg->imsg->MouseY,&res);
1317 if (data->affbutton>=0) {
1318 if (data->affover!=data->affbutton) {
1320 ** Set the ShortHelp to the Button's for Being Over Button (If ShortHelp Exists)
1322 data->affover = data->affbutton;
1323 if ((data->affimage >= 0) && (data->affimage < data->LastImage) && data->NList_UseImages)
1325 STRPTR shorthelp;
1327 if((shorthelp = (STRPTR)xget(data->NList_UseImages[data->affimage].imgobj, MUIA_ShortHelp)))
1328 nnset(obj,MUIA_ShortHelp,shorthelp);
1332 else {
1333 if (data->affover!=-1) {
1335 ** Reset the ShortHelp to the Default for Not Being Over Button
1337 data->affover = -1;
1338 nnset(obj,MUIA_ShortHelp,data->NList_ShortHelp);
1342 ** Restore Values from Temp Variables
1344 data->affbutton = tempbutton;
1345 data->affbuttonline = tempbuttonline;
1346 data->affbuttoncol = tempbuttoncol;
1347 data->affbuttonstate = tempbuttonstate;
1348 data->storebutton = tempstorebutton;
1349 if(data->NumIntuiTick > 0)
1351 data->NumIntuiTick--;
1352 break;
1356 if(!_isinobject(msg->imsg->MouseX,msg->imsg->MouseY) && data->moves == FALSE)
1357 HideCustomPointer(data);
1359 // walk through to next case...
1361 case IDCMP_MOUSEMOVE:
1363 if((msg->imsg->Class == IDCMP_MOUSEMOVE) && data->MOUSE_MOVE)
1364 data->ScrollBarsTime = SCROLLBARSTIME;
1366 if((msg->imsg->Class == IDCMP_MOUSEMOVE) &&
1367 ((msg->imsg->Qualifier & IEQUALIFIER_LEFTBUTTON) != IEQUALIFIER_LEFTBUTTON) &&
1368 ((msg->imsg->Qualifier & (IEQUALIFIER_LALT|IEQUALIFIER_LCOMMAND)) != (IEQUALIFIER_LALT|IEQUALIFIER_LCOMMAND)))
1372 *LONG ab = (LONG) data->adjustbar;
1373 *LONG co = (LONG) msg->imsg->Code;
1374 *LONG qu = (LONG) msg->imsg->Qualifier;
1375 *LONG mx = (LONG) msg->imsg->MouseX;
1376 *LONG my = (LONG) msg->imsg->MouseY;
1377 *D(bug("%lx|1ab %ld stop IntuiMessage :\n",obj,ab));
1378 *if (msg->imsg->Class == IDCMP_MOUSEMOVE)
1379 *D(bug(" Class=MOUSEMOVE Code=%lx Qualifier=%lx mx=%ld my=%ld\n",co,qu,mx,my));
1380 *else if (msg->imsg->Class == IDCMP_INTUITICKS)
1381 *D(bug(" Class=INTUITICKS Code=%lx Qualifier=%lx mx=%ld my=%ld\n",co,qu,mx,my));
1382 *else
1383 *D(bug(" Class=%lx Code=%lx Qualifier=%lx mx=%ld my=%ld\n",msg->imsg->Class,co,qu,mx,my));
1386 NL_RejectIDCMP(data,IDCMP_MOUSEMOVE,TRUE);
1387 data->selectskiped = FALSE;
1388 data->moves = FALSE;
1390 if (data->adjustbar != -1)
1391 { data->adjustbar = -1;
1392 do_draw = TRUE;
1393 data->click_line = -2;
1395 if (data->affbutton >= 0)
1397 NL_Changed(data,data->affbuttonline);
1398 do_draw = TRUE;
1399 data->affbutton = -1;
1400 data->affbuttonline = -1;
1401 data->affbuttoncol = -1;
1402 data->affbuttonstate = 0;
1403 data->storebutton = FALSE;
1407 if(!data->MOUSE_MOVE && (msg->imsg->Class == IDCMP_MOUSEMOVE))
1408 break;
1410 data->mouse_x = msg->imsg->MouseX;
1411 data->mouse_y = msg->imsg->MouseY;
1413 if ((data->ContextMenu == (LONG)MUIV_NList_ContextMenu_TopOnly) /*&& (data->numcols > 1)*/) /* sba: Contextmenu problem: Disabled */
1414 { if ((data->NList_Title && (msg->imsg->MouseY >= data->vpos)) || (!data->NList_Title && (msg->imsg->MouseY > data->vpos + data->vinc/3)))
1415 { if (data->ContextMenuOn)
1416 notdoset(obj,MUIA_ContextMenu,NULL);
1418 else
1419 { if (!data->ContextMenuOn)
1420 notdoset(obj,MUIA_ContextMenu,MUIV_NList_ContextMenu_TopOnly);
1423 /* else if (((data->ContextMenu & 0x9d510030) == 0x9d510030) && (data->numcols <= 1) && data->ContextMenuOn)
1424 notdoset(obj,MUIA_ContextMenu,NULL);
1425 */ /* sba: Contextmenu problem: Disabled */
1426 if ((data->affbutton >= 0) && (msg->imsg->Class == IDCMP_MOUSEMOVE))
1428 if ((msg->imsg->MouseX >= data->affbuttonpos.Left) &&
1429 (msg->imsg->MouseX < data->affbuttonpos.Left+data->affbuttonpos.Width) &&
1430 (msg->imsg->MouseY >= data->affbuttonpos.Top) &&
1431 (msg->imsg->MouseY < data->affbuttonpos.Top+data->affbuttonpos.Height))
1432 { if ((data->affbuttonstate != -2) && (data->affbuttonstate != 2))
1434 data->affbuttonstate = -2;
1435 NL_Changed(data,data->affbuttonline);
1436 do_draw = TRUE;
1439 else
1440 { if ((data->affbuttonstate == -2) || (data->affbuttonstate == 2))
1442 data->affbuttonstate = -1;
1443 NL_Changed(data,data->affbuttonline);
1444 do_draw = TRUE;
1447 data->moves = FALSE;
1448 drag_ok = FALSE;
1451 if ((data->adjustbar >= 0) && (msg->imsg->Class == IDCMP_MOUSEMOVE))
1452 { WORD ab = msg->imsg->MouseX;
1453 WORD minx = data->cols[data->adjustcolumn].c->minx - hfirsthpos
1454 + ((data->cols[data->adjustcolumn].c->delta-1) / 2) + MinColWidth;
1455 if (ab <= minx)
1456 ab = minx;
1457 if ((ab + hfirsthpos) != data->adjustbar)
1458 { data->adjustbar = ab + hfirsthpos;
1459 do_draw = TRUE;
1460 if (data->NList_ColWidthDrag == MUIV_NList_ColWidthDrag_Visual)
1461 { if ((data->adjustcolumn < data->numcols) && (data->adjustcolumn >= 0))
1462 { WORD userwidth = data->adjustbar
1463 - ((data->cols[data->adjustcolumn].c->delta-1) / 2)
1464 - data->cols[data->adjustcolumn].c->minx;
1465 if (userwidth < MinColWidth)
1466 userwidth = MinColWidth;
1467 if (data->cols[data->adjustcolumn].c->userwidth != userwidth)
1468 { data->cols[data->adjustcolumn].c->userwidth = userwidth;
1469 if (data->adjustbar2 >= 0)
1470 { userwidth = data->adjustbar2 - data->cols[data->adjustcolumn].c->minx
1471 - userwidth - data->cols[data->adjustcolumn].c->delta;
1472 if (userwidth < MinColWidth)
1473 userwidth = MinColWidth;
1474 data->cols[data->adjustcolumn+1].c->userwidth = userwidth;
1476 data->do_setcols = TRUE;
1477 /*data->ScrollBarsPos = -2;*/
1482 if (msg->imsg->MouseX < data->mleft)
1483 { NL_List_Horiz_First(data,MUIV_NList_Horiz_First_Left,NULL);
1484 /* NL_RejectIDCMP(data,IDCMP_MOUSEMOVE,FALSE);*/
1486 else if (msg->imsg->MouseX >= data->mright)
1487 { NL_List_Horiz_First(data,MUIV_NList_Horiz_First_Right,NULL);
1488 /* NL_RejectIDCMP(data,IDCMP_MOUSEMOVE,FALSE);*/
1490 else
1492 NL_RequestIDCMP(data,IDCMP_MOUSEMOVE);
1495 else if ((data->adjustbar >= -4) && (data->adjustbar <= -2) && (msg->imsg->Class == IDCMP_MOUSEMOVE))
1496 { if ((data->adjustcolumn < data->numcols) &&
1497 (data->adjustcolumn >= 0))
1498 { WORD minx = (data->cols[data->adjustcolumn].c->minx - hfirsthpos);
1499 WORD maxx = (data->cols[data->adjustcolumn].c->maxx - hfirsthpos);
1500 WORD maxy = data->vdtitlepos + data->vdtitleheight;
1501 if (!data->NList_TitleSeparator)
1502 maxy--;
1503 if (data->adjustcolumn > 0)
1504 minx -= (data->cols[data->adjustcolumn-1].c->delta - (((data->cols[data->adjustcolumn-1].c->delta-1) / 2) + 1));
1505 maxx += ((data->cols[data->adjustcolumn].c->delta-1) / 2);
1506 if ((data->adjustcolumn >= data->NList_MinColSortable) &&
1507 ((data->numcols - data->NList_MinColSortable) > 1) &&
1508 ((msg->imsg->MouseX < data->click_x - 6) || (msg->imsg->MouseX > data->click_x + 6)) &&
1509 (NL_OnWindow(data,msg->imsg->MouseX,msg->imsg->MouseY)))
1513 *LONG ab = (LONG) data->adjustbar;
1514 *LONG co = (LONG) msg->imsg->Code;
1515 *LONG qu = (LONG) msg->imsg->Qualifier;
1516 *LONG mx = (LONG) msg->imsg->MouseX;
1517 *LONG my = (LONG) msg->imsg->MouseY;
1518 *D(bug("%lx|2ab0 %ld start col sort IntuiMessage :\n",obj,ab));
1519 *if (msg->imsg->Class == IDCMP_MOUSEMOVE)
1520 *D(bug(" Class=MOUSEMOVE Code=%lx Qualifier=%lx mx=%ld my=%ld\n",co,qu,mx,my));
1521 *else if (msg->imsg->Class == IDCMP_INTUITICKS)
1522 *D(bug(" Class=INTUITICKS Code=%lx Qualifier=%lx mx=%ld my=%ld\n",co,qu,mx,my));
1523 *else
1524 *D(bug(" Class=%lx Code=%lx Qualifier=%lx mx=%ld my=%ld\n",msg->imsg->Class,co,qu,mx,my));
1527 data->adjustbar = -10;
1529 // set a custom mouse pointer
1530 ShowCustomPointer(data, PT_MOVE);
1532 data->moves = FALSE;
1533 drag_ok = FALSE;
1534 do_draw = TRUE;
1536 else if ((msg->imsg->MouseX < data->mleft) ||
1537 (msg->imsg->MouseX > data->mright) ||
1538 (msg->imsg->MouseX < minx) ||
1539 (msg->imsg->MouseX > maxx) ||
1540 (msg->imsg->MouseY < data->vdtitlepos) ||
1541 (msg->imsg->MouseY > maxy))
1542 { data->adjustbar = -4;
1543 do_draw = TRUE;
1544 data->click_line = -2;
1546 else if (data->adjustbar == -4)
1547 { data->adjustbar = -2;
1548 do_draw = TRUE;
1549 data->click_line = -2;
1552 else
1556 *LONG ab = (LONG) data->adjustbar;
1557 *LONG co = (LONG) msg->imsg->Code;
1558 *LONG qu = (LONG) msg->imsg->Qualifier;
1559 *LONG mx = (LONG) msg->imsg->MouseX;
1560 *LONG my = (LONG) msg->imsg->MouseY;
1561 *D(bug("%lx|3ab %ld stop IntuiMessage :\n",obj,ab));
1562 *if (msg->imsg->Class == IDCMP_MOUSEMOVE)
1563 *D(bug(" Class=MOUSEMOVE Code=%lx Qualifier=%lx mx=%ld my=%ld\n",co,qu,mx,my));
1564 *else if (msg->imsg->Class == IDCMP_INTUITICKS)
1565 *D(bug(" Class=INTUITICKS Code=%lx Qualifier=%lx mx=%ld my=%ld\n",co,qu,mx,my));
1566 *else
1567 *D(bug(" Class=%lx Code=%lx Qualifier=%lx mx=%ld my=%ld\n",msg->imsg->Class,co,qu,mx,my));
1570 data->adjustbar = -1;
1571 NL_RejectIDCMP(data,IDCMP_MOUSEMOVE,FALSE);
1572 do_draw = TRUE;
1573 data->click_line = -2;
1578 struct MUI_NList_TestPos_Result res;
1580 res.char_number = -2;
1581 NL_List_TestPos(data,msg->imsg->MouseX,msg->imsg->MouseY,&res);
1583 if(data->adjustbar == -10)
1585 if ((res.column >= data->NList_MinColSortable) && (data->adjustcolumn >= 0) &&
1586 (data->adjustcolumn != res.column) && (res.xoffset > 0) &&
1587 (res.xoffset < data->cols[res.column].c->dx) && (res.xoffset < data->cols[data->adjustcolumn].c->dx))
1588 { struct colinfo *tmpc = data->cols[res.column].c;
1589 data->cols[res.column].c = data->cols[data->adjustcolumn].c;
1590 data->cols[data->adjustcolumn].c = tmpc;
1591 data->adjustcolumn = res.column;
1592 data->do_draw_all = data->do_draw_title = data->do_draw = TRUE;
1593 data->do_parse = data->do_setcols = data->do_updatesb = data->do_wwrap = TRUE;
1594 do_draw = TRUE;
1595 /*data->ScrollBarsPos = -2;*/
1596 DO_NOTIFY(NTF_Columns);
1599 else
1601 BOOL overObject = _isinobject(msg->imsg->MouseX, msg->imsg->MouseY);
1603 if (((data->adjustbar >= 0) ||
1604 ((!data->moves) && (data->adjustbar >= -1) &&
1605 (res.flags & MUI_NLPR_BAR) && (res.flags & MUI_NLPR_ONTOP) &&
1606 (res.column < data->numcols) && (res.column >= 0))) &&
1607 (overObject == TRUE))
1609 // set a custom mouse pointer
1610 ShowCustomPointer(data, PT_SIZE);
1612 else if(data->NList_SelectPointer == TRUE &&
1613 data->NList_TypeSelect == MUIV_NList_TypeSelect_Char &&
1614 overObject == TRUE)
1616 // in case the NList object is in charwise selection mode and the mouse
1617 // is above the object itself we show a specialized selection pointer
1618 ShowCustomPointer(data, PT_SELECT);
1620 else
1622 HideCustomPointer(data);
1628 if (data->moves)
1630 WORD ly = (msg->imsg->MouseY - data->vpos);
1631 WORD lyl = ly / data->vinc;
1632 LONG lyl2 = lyl + data->NList_First;
1633 WORD lx = (msg->imsg->MouseX - data->hpos);
1634 WORD sel_x = msg->imsg->MouseX;
1635 WORD sel_y = msg->imsg->MouseY;
1637 data->NumIntuiTick = 0;
1638 if ((ly >= 0) && (lyl >= 0) && (lyl < data->NList_Visible) &&
1639 ((lx < 0) || (lx >= data->NList_Horiz_Visible)))
1640 { if (data->drag_border)
1641 { drag_ok = TRUE;
1643 data->drag_border = FALSE;
1645 if (drag_ok)
1646 { /* do nothing */
1648 else if (lx < 0)
1649 { if (msg->imsg->Class == IDCMP_MOUSEMOVE)
1650 break;
1651 if (msg->imsg->MouseX < data->mleft-40)
1652 { MOREQUIET;
1653 NL_List_Horiz_First(data,MUIV_NList_Horiz_First_Left4,NULL);
1654 NL_List_Horiz_First(data,MUIV_NList_Horiz_First_Left4,NULL);
1655 LESSQUIET;
1657 else if (msg->imsg->MouseX < data->mleft-24)
1658 NL_List_Horiz_First(data,MUIV_NList_Horiz_First_Left4,NULL);
1659 else if (msg->imsg->MouseX < data->mleft-8)
1660 NL_List_Horiz_First(data,MUIV_NList_Horiz_First_Left2,NULL);
1661 else
1662 NL_List_Horiz_First(data,MUIV_NList_Horiz_First_Left,NULL);
1663 data->selectskiped = FALSE;
1664 if (data->NList_TypeSelect && (data->sel_pt[0].ent >= 0))
1665 { sel_x = data->hpos;
1666 data->last_sel_click_x = sel_x +1;
1669 else if (lx >= data->NList_Horiz_Visible)
1670 { if (msg->imsg->Class == IDCMP_MOUSEMOVE)
1671 break;
1672 if (msg->imsg->MouseX > data->mright+40)
1673 { MOREQUIET;
1674 NL_List_Horiz_First(data,MUIV_NList_Horiz_First_Right4,NULL);
1675 NL_List_Horiz_First(data,MUIV_NList_Horiz_First_Right4,NULL);
1676 LESSQUIET;
1678 else if (msg->imsg->MouseX > data->mright+24)
1679 NL_List_Horiz_First(data,MUIV_NList_Horiz_First_Right4,NULL);
1680 else if (msg->imsg->MouseX > data->mright+8)
1681 NL_List_Horiz_First(data,MUIV_NList_Horiz_First_Right2,NULL);
1682 else
1683 NL_List_Horiz_First(data,MUIV_NList_Horiz_First_Right,NULL);
1684 data->selectskiped = FALSE;
1685 if (data->NList_TypeSelect && (data->sel_pt[0].ent >= 0))
1686 { sel_x = data->hpos + data->NList_Horiz_Visible - 1;
1687 data->last_sel_click_x = sel_x -1;
1690 else if (ly < 0)
1692 long lactive = data->NList_First - 1;
1693 if (lactive < 0)
1694 lactive = 0;
1696 if (msg->imsg->Class == IDCMP_MOUSEMOVE)
1697 break;
1698 if (msg->imsg->MouseY < data->vdtpos-40)
1699 { if (data->NList_Input && !data->NList_TypeSelect)
1700 { MOREQUIET;
1701 if (data->multiselect && data->selectskiped && (lactive >= 0) && (lactive != data->lastactived))
1702 { NL_List_Select(data,lactive,data->lastactived,data->selectmode,NULL);
1703 NL_List_Active(data,lactive,NULL,data->selectmode,FALSE,0);
1705 else
1706 NL_List_Active(data,MUIV_NList_Active_Up,NULL,data->selectmode,FALSE,0);
1708 NL_List_Active(data,MUIV_NList_Active_Up,NULL,data->selectmode,FALSE,0);
1709 NL_List_Active(data,MUIV_NList_Active_Up,NULL,data->selectmode,FALSE,0);
1710 NL_List_Active(data,MUIV_NList_Active_Up,NULL,data->selectmode,FALSE,0);
1711 NL_List_Active(data,MUIV_NList_Active_Up,NULL,data->selectmode,FALSE,0);
1712 NL_List_Active(data,MUIV_NList_Active_Up,NULL,data->selectmode,FALSE,0);
1713 NL_List_Active(data,MUIV_NList_Active_Up,NULL,data->selectmode,FALSE,0);
1714 NL_List_Active(data,MUIV_NList_Active_Up,NULL,data->selectmode,FALSE,0);
1715 LESSQUIET;
1717 else
1718 { MOREQUIET;
1719 NL_List_First(data,MUIV_NList_First_Up4,NULL);
1720 NL_List_First(data,MUIV_NList_First_Up4,NULL);
1721 LESSQUIET;
1724 else if (msg->imsg->MouseY < data->vdtpos-24)
1725 { if (data->NList_Input && !data->NList_TypeSelect)
1726 { MOREQUIET;
1727 if (data->multiselect && data->selectskiped && (lactive >= 0) && (lactive != data->lastactived))
1728 { NL_List_Select(data,lactive,data->lastactived,data->selectmode,NULL);
1729 NL_List_Active(data,lactive,NULL,data->selectmode,FALSE,0);
1731 else
1732 NL_List_Active(data,MUIV_NList_Active_Up,NULL,data->selectmode,FALSE,0);
1734 NL_List_Active(data,MUIV_NList_Active_Up,NULL,data->selectmode,FALSE,0);
1735 NL_List_Active(data,MUIV_NList_Active_Up,NULL,data->selectmode,FALSE,0);
1736 NL_List_Active(data,MUIV_NList_Active_Up,NULL,data->selectmode,FALSE,0);
1737 LESSQUIET;
1739 else
1740 NL_List_First(data,MUIV_NList_First_Up4,NULL);
1742 else if (msg->imsg->MouseY < data->vdtpos-8)
1743 { if (data->NList_Input && !data->NList_TypeSelect)
1744 { MOREQUIET;
1745 if (data->multiselect && data->selectskiped && (lactive >= 0) && (lactive != data->lastactived))
1746 { NL_List_Select(data,lactive,data->lastactived,data->selectmode,NULL);
1747 NL_List_Active(data,lactive,NULL,data->selectmode,FALSE,0);
1749 else
1750 NL_List_Active(data,MUIV_NList_Active_Up,NULL,data->selectmode,FALSE,0);
1752 NL_List_Active(data,MUIV_NList_Active_Up,NULL,data->selectmode,FALSE,0);
1753 LESSQUIET;
1755 else
1756 NL_List_First(data,MUIV_NList_First_Up2,NULL);
1758 else
1759 { if (data->NList_Input && !data->NList_TypeSelect)
1760 NL_List_Active(data,MUIV_NList_Active_Up,NULL,data->selectmode,FALSE,0);
1761 else
1762 NL_List_First(data,MUIV_NList_First_Up,NULL);
1764 data->selectskiped = FALSE;
1765 if (data->NList_TypeSelect && (data->sel_pt[0].ent >= 0))
1766 { sel_y = data->vpos;
1767 data->last_sel_click_y = sel_y +1;
1770 else if ((lyl >= data->NList_Visible) || (lyl2 >= data->NList_Entries))
1772 long lactive = data->NList_First + data->NList_Visible;
1773 if (lactive >= data->NList_Entries)
1774 lactive = data->NList_Entries - 1;
1776 if (msg->imsg->Class == IDCMP_MOUSEMOVE)
1777 break;
1779 if (msg->imsg->MouseY > data->vdbpos+40)
1780 { if (data->NList_Input && !data->NList_TypeSelect)
1781 { MOREQUIET;
1782 if (data->multiselect && data->selectskiped && (lactive >= 0) && (lactive != data->lastactived))
1783 { NL_List_Select(data,lactive,data->lastactived,data->selectmode,NULL);
1784 NL_List_Active(data,lactive,NULL,data->selectmode,FALSE,0);
1786 else
1787 NL_List_Active(data,MUIV_NList_Active_Down,NULL,data->selectmode,FALSE,0);
1788 NL_List_Active(data,MUIV_NList_Active_Down,NULL,data->selectmode,FALSE,0);
1789 NL_List_Active(data,MUIV_NList_Active_Down,NULL,data->selectmode,FALSE,0);
1790 NL_List_Active(data,MUIV_NList_Active_Down,NULL,data->selectmode,FALSE,0);
1791 NL_List_Active(data,MUIV_NList_Active_Down,NULL,data->selectmode,FALSE,0);
1792 NL_List_Active(data,MUIV_NList_Active_Down,NULL,data->selectmode,FALSE,0);
1793 NL_List_Active(data,MUIV_NList_Active_Down,NULL,data->selectmode,FALSE,0);
1794 NL_List_Active(data,MUIV_NList_Active_Down,NULL,data->selectmode,FALSE,0);
1795 LESSQUIET;
1797 else
1798 { MOREQUIET;
1799 NL_List_First(data,MUIV_NList_First_Down4,NULL);
1800 NL_List_First(data,MUIV_NList_First_Down4,NULL);
1801 LESSQUIET;
1804 else if (msg->imsg->MouseY > data->vdbpos+24)
1805 { if (data->NList_Input && !data->NList_TypeSelect)
1806 { MOREQUIET;
1807 if (data->multiselect && data->selectskiped && (lactive >= 0) && (lactive != data->lastactived))
1808 { NL_List_Select(data,lactive,data->lastactived,data->selectmode,NULL);
1809 NL_List_Active(data,lactive,NULL,data->selectmode,FALSE,0);
1811 else
1812 NL_List_Active(data,MUIV_NList_Active_Down,NULL,data->selectmode,FALSE,0);
1813 NL_List_Active(data,MUIV_NList_Active_Down,NULL,data->selectmode,FALSE,0);
1814 NL_List_Active(data,MUIV_NList_Active_Down,NULL,data->selectmode,FALSE,0);
1815 NL_List_Active(data,MUIV_NList_Active_Down,NULL,data->selectmode,FALSE,0);
1816 LESSQUIET;
1818 else
1819 NL_List_First(data,MUIV_NList_First_Down4,NULL);
1821 else if (msg->imsg->MouseY > data->vdbpos+8)
1822 { if (data->NList_Input && !data->NList_TypeSelect)
1823 { MOREQUIET;
1824 if (data->multiselect && data->selectskiped && (lactive >= 0) && (lactive != data->lastactived))
1825 { NL_List_Select(data,lactive,data->lastactived,data->selectmode,NULL);
1826 NL_List_Active(data,lactive,NULL,data->selectmode,FALSE,0);
1828 else
1829 NL_List_Active(data,MUIV_NList_Active_Down,NULL,data->selectmode,FALSE,0);
1830 NL_List_Active(data,MUIV_NList_Active_Down,NULL,data->selectmode,FALSE,0);
1831 LESSQUIET;
1833 else
1834 NL_List_First(data,MUIV_NList_First_Down2,NULL);
1836 else
1837 { if (data->NList_Input && !data->NList_TypeSelect)
1838 NL_List_Active(data,MUIV_NList_Active_Down,NULL,data->selectmode,FALSE,0);
1839 else
1840 NL_List_First(data,MUIV_NList_First_Down,NULL);
1842 data->selectskiped = FALSE;
1843 if (data->NList_TypeSelect && (data->sel_pt[0].ent >= 0))
1844 { if (data->NList_First + data->NList_Visible < data->NList_Entries)
1845 sel_y = data->vpos + (data->NList_Visible * data->vinc) - 1;
1846 else
1847 sel_y = data->vpos + ((data->NList_Entries-data->NList_First) * data->vinc) - 1;
1848 data->last_sel_click_y = sel_y -1;
1851 else if ((lyl >= 0) && (lyl < data->NList_Visible))
1853 if (data->NList_Input && !data->NList_TypeSelect)
1855 long lactive = lyl + data->NList_First;
1856 if ((lactive != data->NList_Active) && (lactive >= 0) && (lactive < data->NList_Entries))
1858 if (data->multiselect == MUIV_NList_MultiSelect_None)
1860 NL_List_Select(data,data->lastactived,MUIV_NList_Active_Off,MUIV_NList_Select_Off,NULL);
1861 data->selectmode = MUIV_NList_Select_On;
1863 if (data->multiselect && data->selectskiped)
1865 NL_List_Select(data,lactive,data->lastactived,data->selectmode,NULL);
1866 NL_List_Active(data,lactive,NULL,data->selectmode,FALSE,0);
1868 else if (data->multiselect)
1870 data->selectskiped = TRUE;
1871 NL_List_Active(data,lactive,NULL,data->selectmode,FALSE,0);
1873 else
1875 #if 0
1876 // Is this call really required???
1877 // It causes NList to misbehave if the user clicks in the list while the
1878 // window has MUIA_Window_Sleep set to TRUE. In this case the click seems
1879 // to be "cached" and is applied again as soon as the window is woken up
1880 // again, which is definitely wrong.
1881 // Well's have to see if commenting out this line causes any new misbehaviour.
1882 NL_List_Active(data,lactive,NULL,data->selectmode,FALSE,0);
1883 #endif
1887 if (msg->imsg->Class == IDCMP_INTUITICKS)
1889 NL_RequestIDCMP(data,IDCMP_MOUSEMOVE);
1891 if (data->drag_type != MUIV_NList_DragType_None)
1893 if (DragQual)
1895 drag_ok = TRUE;
1897 else if ((data->drag_type == MUIV_NList_DragType_Immediate) && !data->multiselect && (msg->imsg->Class == IDCMP_MOUSEMOVE))
1899 drag_ok = TRUE;
1901 else if ((data->drag_type == MUIV_NList_DragType_Immediate) || (data->drag_type == MUIV_NList_DragType_Borders))
1902 data->drag_border = TRUE;
1905 if (data->NList_TypeSelect && (data->sel_pt[0].ent >= 0) &&
1906 ((sel_x != data->last_sel_click_x) || (sel_y != data->last_sel_click_y)))
1907 SelectSecondPoint(data,sel_x,sel_y);
1909 /*retval = MUI_EventHandlerRC_Eat;*/
1910 break;
1911 default:
1912 break;
1915 if (do_draw)
1916 { REDRAW;
1917 /* do_notifies(NTF_AllChanges);*/
1921 * if (NEED_NOTIFY(NTF_AllClick))
1922 * { //do_notifies(NTF_AllClick);
1923 * //retval = MUI_EventHandlerRC_Eat;
1926 if (drag_ok && (data->drag_type != MUIV_NList_DragType_None) &&
1927 ((msg->imsg->Class == IDCMP_MOUSEBUTTONS) || (msg->imsg->Class == IDCMP_MOUSEMOVE)) &&
1928 (data->NList_Active >= data->NList_First) &&
1929 (data->NList_Active < data->NList_First + data->NList_Visible))
1931 LONG first,last,ent,numlines,lyl;
1932 /*D(bug("%lx| 17 drag_ok=%ld drag should start\n",obj,drag_ok));*/
1933 if (!data->NList_TypeSelect)
1934 { first = 0;
1935 while ((first < data->NList_Entries) && (data->EntriesArray[first]->Select == TE_Select_None))
1936 first++;
1937 last = data->NList_Entries - 1;
1938 while ((last > 0) && (data->EntriesArray[last]->Select == TE_Select_None))
1939 last--;
1940 { ent = first;
1941 numlines = 0;
1942 while (ent <= last)
1943 { if (data->EntriesArray[ent]->Select != TE_Select_None)
1944 numlines++;
1945 ent++;
1949 else
1950 { first = data->sel_pt[data->min_sel].ent;
1951 last = data->sel_pt[data->max_sel].ent;
1952 if ((data->sel_pt[data->max_sel].column == 0) && (data->sel_pt[data->max_sel].xoffset == PMIN))
1953 last--;
1954 numlines = last - first + 1;
1956 if ((first > 0) && (first < data->NList_Entries) && (data->EntriesArray[first]->Wrap & TE_Wrap_TmpLine))
1957 first -= data->EntriesArray[first]->dnum;
1958 if ((last > 0) && (last < data->NList_Entries) && data->EntriesArray[last]->Wrap)
1959 { if (data->EntriesArray[last]->Wrap & TE_Wrap_TmpLine)
1960 last -= data->EntriesArray[last]->dnum;
1961 if (last > 0)
1962 last += data->EntriesArray[last]->dnum - 1;
1964 retval = MUI_EventHandlerRC_Eat;
1965 if ((first >= 0) && (first <= last) && (last < data->NList_Entries))
1967 LONG dragx;
1968 LONG dragy;
1970 data->DragRPort = NULL;
1972 if ((first < data->NList_First) || (last >= data->NList_First + data->NList_Visible) ||
1973 (numlines != (last - first + 1)) || (data->NList_DragColOnly >= 0) ||
1974 (numlines >= data->NList_DragLines))
1976 data->DragEntry = first;
1977 if ((data->NList_Active >= 0) && (data->NList_Active >= data->NList_First) && (last < data->NList_First + data->NList_Visible))
1978 first = data->NList_Active;
1979 else
1980 first = data->NList_First;
1981 last = first-1;
1983 dragx = msg->imsg->MouseX - data->mleft;
1984 dragy = msg->imsg->MouseY - (data->vpos+(data->vinc * (first - data->NList_First)));
1986 if((data->DragRPort = CreateDragRPort(data,numlines,first,last)))
1988 if (dragx < 0)
1989 dragx = 0;
1990 else if (dragx >= data->DragWidth)
1991 dragx = data->DragWidth-1;
1992 dragy = data->DragHeight;
1994 else
1996 if (first >= data->NList_First + data->NList_Visible)
1997 first = data->NList_First + data->NList_Visible - 1;
1998 if (first < data->NList_First)
1999 first = data->NList_First;
2000 if (last >= data->NList_First + data->NList_Visible)
2001 last = data->NList_First + data->NList_Visible - 1;
2002 if (last < first)
2003 last = first;
2004 lyl = last - first + 1;
2005 _left(obj) = data->mleft;
2006 _top(obj) = data->vpos+(data->vinc * (first - data->NList_First));
2007 _width(obj) = data->mwidth;
2008 _height(obj) = data->vinc * lyl;
2009 dragx = msg->imsg->MouseX - _left(obj);
2010 dragy = msg->imsg->MouseY - _top(obj);
2011 if (dragx < 0)
2012 dragx = 0;
2013 else if (dragx >= _width(obj))
2014 dragx = _width(obj)-1;
2015 if (dragy < 0)
2016 dragy = 0;
2017 else if (dragy >= _height(obj))
2018 dragy = _height(obj)-1;
2019 data->badrport = TRUE;
2021 /*D(bug("%lx| 18 drag_ok=%ld drag start now\n",obj,drag_ok));*/
2022 data->markdrawnum = MUIM_NList_Trigger;
2023 NL_RejectIDCMP(data,IDCMP_INTUITICKS,TRUE);
2024 NL_RejectIDCMP(data,IDCMP_MOUSEMOVE,TRUE);
2025 DoMethod(obj,MUIM_DoDrag,dragx,dragy,0L);
2026 NL_RequestIDCMP(data,IDCMP_INTUITICKS);
2027 data->markdrawnum = 0;
2028 NL_RejectIDCMP(data,IDCMP_MOUSEMOVE,FALSE);
2029 data->selectskiped = FALSE;
2030 data->moves = FALSE;
2031 REDRAW_FORCE;
2035 /*D(bug("NL: mNL_HandleEvent() /after \n"));*/
2036 { ULONG DoNotify = ~NotNotify & data->DoNotify & data->Notify;
2037 if (data->SETUP && DoNotify && !data->pushtrigger)
2038 { data->pushtrigger = 1;
2039 DoMethod(_app(obj),MUIM_Application_PushMethod,obj,1,MUIM_NList_Trigger);
2043 return (retval);
2047 IPTR mNL_CreateDragImage(struct IClass *cl,Object *obj,struct MUIP_CreateDragImage *msg)
2049 struct NLData *data = INST_DATA(cl,obj);
2050 IPTR retval;
2051 if (data->DragRPort)
2052 { _rp(obj) = data->DragRPort;
2053 _left(obj) = 0;
2054 _top(obj) = 0;
2055 _width(obj) = data->DragWidth;
2056 _height(obj) = data->DragHeight;
2057 data->badrport = TRUE;
2059 retval = DoSuperMethodA(cl,obj,(Msg) msg);
2060 if (data->badrport)
2061 { _left(obj) = data->left;
2062 _top(obj) = data->top;
2063 _width(obj) = data->width;
2064 _height(obj) = data->height;
2065 _rp(obj) = data->rp;
2066 data->badrport = FALSE;
2068 return (retval);
2072 IPTR mNL_DeleteDragImage(struct IClass *cl,Object *obj,struct MUIP_DeleteDragImage *msg)
2074 struct NLData *data = INST_DATA(cl,obj);
2075 IPTR retval = DoSuperMethodA(cl,obj,(Msg) msg);
2077 if (data->DragRPort)
2078 DisposeDragRPort(data);
2079 return (retval);
2083 BOOL NL_Prop_First_Adjust(struct NLData *data)
2085 LONG lfirst,lincr;
2086 lfirst = data->NList_Prop_First / data->vinc;
2087 if ((data->NList_Prop_Wait == 0) && data->drawall_bits)
2089 REDRAW;
2091 if ((data->NList_Prop_Wait == 0) && ((lfirst * data->vinc) != data->NList_Prop_First) && (data->NList_Prop_Add != 0))
2093 LONG Notify_VSB = WANTED_NOTIFY(NTF_VSB);
2095 if (data->SHOW && (data->rp->Layer->Flags & LAYERREFRESH))
2096 return (FALSE);
2097 NOWANT_NOTIFY(NTF_VSB);
2098 if (data->NList_Prop_Add > 0)
2100 data->NList_Prop_First += data->NList_Prop_Add;
2101 lincr = data->NList_Prop_First % data->vinc;
2102 if ((data->NList_Prop_First / data->vinc) > lfirst)
2103 { lfirst++;
2104 lincr = 0;
2105 data->NList_Prop_First = lfirst * data->vinc;
2106 data->NList_Prop_Add = 0;
2109 else
2111 data->NList_Prop_First += data->NList_Prop_Add;
2112 lincr = data->NList_Prop_First % data->vinc;
2113 if ((data->NList_Prop_First / data->vinc) < lfirst)
2114 { lincr = 0;
2115 data->NList_Prop_First = lfirst * data->vinc;
2116 data->NList_Prop_Add = 0;
2120 data->ScrollBarsTime = SCROLLBARSTIME;
2122 if ((data->NList_First != lfirst) || (data->NList_First_Incr != lincr))
2124 if (data->NList_First != lfirst)
2126 DO_NOTIFY(NTF_First);
2129 data->NList_First = lfirst;
2130 data->NList_First_Incr = lincr;
2131 REDRAW;
2132 /* do_notifies(NTF_AllChanges|NTF_MinMax);*/
2135 if (Notify_VSB)
2136 WANT_NOTIFY(NTF_VSB);
2138 else if (data->NList_Prop_Wait > 0)
2140 data->NList_Prop_Wait--;
2142 else
2143 data->NList_Prop_Add = 0;
2144 return (FALSE);
2148 IPTR mNL_Trigger(struct IClass *cl, UNUSED Object *obj, UNUSED Msg msg)
2150 struct NLData *data = INST_DATA(cl,obj);
2151 /* attention, can be called with msg = NULL */
2152 if (data->SHOW && data->DRAW && !data->do_draw_all)
2154 NL_Prop_First_Adjust(data);
2155 /*do_notifies(NTF_First|NTF_Entries|NTF_MinMax);*/
2156 if (data->ScrollBarsTime > 0)
2157 data->ScrollBarsTime--;
2158 else
2160 data->ScrollBarsTime = 0;
2161 if (!data->NList_Quiet && !data->NList_Disabled)
2162 NL_UpdateScrollers(data,FALSE);
2163 data->ScrollBarsTime = SCROLLBARSTIME;
2167 if (data->SHOW && data->DRAW && !data->NList_Quiet && !data->NList_Disabled)
2168 { data->pushtrigger = 2;
2169 if (data->DRAW > 1)
2170 data->DRAW = 1;
2172 if(data->do_draw_all || data->do_draw)
2174 // JL: here it is important that we force do_draw_all = FALSE or otherwise the following
2175 // REDRAW will result in a flickering if we have more than one NList object in a window.
2176 data->do_draw_all = FALSE;
2177 REDRAW;
2180 data->pushtrigger = 0;
2182 if (data->SETUP && (data->DoNotify & data->Notify))
2183 do_notifies(NTF_All|NTF_MinMax);
2185 return(TRUE);