6 #include <exec/types.h>
7 #include <graphics/rastport.h>
8 #include <utility/hooks.h>
9 #include <intuition/gadgetclass.h>
10 #include <intuition/newmouse.h>
11 #include <workbench/workbench.h>
12 #include <workbench/startup.h>
13 #include <libraries/gadtools.h>
14 #include <libraries/iffparse.h>
15 #include <datatypes/pictureclass.h>
16 #include <dos/dostags.h>
17 #include <guigfx/guigfx.h>
21 #include <proto/dos.h>
22 #include <proto/exec.h>
23 #include <proto/layers.h>
24 #include <proto/intuition.h>
25 #include <proto/graphics.h>
26 #include <proto/utility.h>
27 #include <proto/icon.h>
28 #include <proto/iconobject.h>
29 #include <proto/guigfx.h>
30 #include <proto/datatypes.h>
32 #include <proto/scalos.h>
34 #include <clib/alib_protos.h>
37 #include <datatypes/iconobject.h>
38 #include <scalos/palette.h>
39 #include <scalos/pattern.h>
40 #include <scalos/scalos.h>
46 #include "scalos_structures.h"
47 #include "functions.h"
48 #include "Variables.h"
50 #include "IconImageClass.h"
51 #include "CycleGadgetClass.h"
53 //----------------------------------------------------------------------------
55 // local data structures
57 //----------------------------------------------------------------------------
61 static ULONG
IDCMPMouseButtons(struct internalScaWindowTask
*iwt
, struct IntuiMessage
*iMsg
);
62 static ULONG
IDCMPMouseMove(struct internalScaWindowTask
*iwt
, struct IntuiMessage
*iMsg
);
63 static ULONG
IDCMPGadgetDown(struct internalScaWindowTask
*iwt
, struct IntuiMessage
*iMsg
);
64 static ULONG
IDCMPGadgetUp(struct internalScaWindowTask
*iwt
, struct IntuiMessage
*iMsg
);
65 static ULONG
IDCMPMenuPick(struct internalScaWindowTask
*iwt
, struct IntuiMessage
*iMsg
);
66 static ULONG
IDCMPDiskRemoved(struct internalScaWindowTask
*iwt
, struct IntuiMessage
*iMsg
);
67 static ULONG
IDCMPActiveWindow(struct internalScaWindowTask
*iwt
, struct IntuiMessage
*iMsg
);
68 static ULONG
IDCMPInactiveWindow(struct internalScaWindowTask
*iwt
, struct IntuiMessage
*iMsg
);
69 static ULONG
IDCMPRawKey(struct internalScaWindowTask
*iwt
, struct IntuiMessage
*iMsg
);
70 static ULONG
IDCMPUpdate(struct internalScaWindowTask
*iwt
, struct IntuiMessage
*iMsg
);
71 static ULONG
IDCMPIntuiTicks(struct internalScaWindowTask
*iwt
, struct IntuiMessage
*iMsg
);
72 static ULONG
IDCMPChangeWindow(struct internalScaWindowTask
*iwt
, struct IntuiMessage
*iMsg
);
73 static ULONG
IDCMPNewSize(struct internalScaWindowTask
*iwt
, struct IntuiMessage
*iMsg
);
74 static ULONG
IDCMPGadgetHelp(struct internalScaWindowTask
*iwt
, struct IntuiMessage
*iMsg
);
75 #if defined(IDCMP_EXTENDEDMOUSE)
76 static ULONG
IDCMPExtendedMouse(struct internalScaWindowTask
*iwt
, struct IntuiMessage
*iMsg
);
77 #endif //defined(IDCMP_EXTENDEDMOUSE)
79 static void ArrowRight(struct internalScaWindowTask
*iwt
, struct IntuiMessage
*iMsg
);
80 static void ArrowLeft(struct internalScaWindowTask
*iwt
, struct IntuiMessage
*iMsg
);
81 static void ArrowDown(struct internalScaWindowTask
*iwt
, struct IntuiMessage
*iMsg
);
82 static void ArrowUp(struct internalScaWindowTask
*iwt
, struct IntuiMessage
*iMsg
);
83 static void SetPropBottom(struct internalScaWindowTask
*iwt
);
84 static void SetPropSide(struct internalScaWindowTask
*iwt
);
85 static void MousePress(struct internalScaWindowTask
*iwt
, struct IntuiMessage
*iMsg
);
86 static void MouseRelease(struct internalScaWindowTask
*iwt
, struct IntuiMessage
*iMsg
);
87 static void OldIconsOff(struct internalScaWindowTask
*iwt
, Object
*IconObj
,
88 LONG XOffset
, LONG YOffset
, UWORD Qualifier
, BOOL keepSelected
);
89 static LONG
SafeStrCmp(CONST_STRPTR str1
, CONST_STRPTR str2
);
90 static void IDCMPBeginDrag(struct internalScaWindowTask
*iwt
, struct IntuiMessage
*iMsg
);
92 //----------------------------------------------------------------------------
96 //----------------------------------------------------------------------------
100 const struct IDCMPTableEntry IDCMPFuncTable
[] =
102 // Attention: entries MUST be kept in ascending order, due to use of bsearch()
103 // { IDCMP_SIZEVERIFY, NULL },
104 { IDCMP_NEWSIZE
, IDCMPNewSize
},
105 { IDCMP_REFRESHWINDOW
, IDCMPRefreshWindow
},
106 { IDCMP_MOUSEBUTTONS
, IDCMPMouseButtons
},
107 { IDCMP_MOUSEMOVE
, IDCMPMouseMove
},
108 { IDCMP_GADGETDOWN
, IDCMPGadgetDown
},
109 { IDCMP_GADGETUP
, IDCMPGadgetUp
},
110 // { IDCMP_REQSET, NULL },
111 { IDCMP_MENUPICK
, IDCMPMenuPick
},
112 // { IDCMP_CLOSEWINDOW, NULL },
113 { IDCMP_RAWKEY
, IDCMPRawKey
},
114 // { IDCMP_REQVERIFY, NULL },
115 // { IDCMP_REQCLEAR, NULL },
116 // { IDCMP_MENUVERIFY, NULL },
117 // { IDCMP_NEWPREFS, NULL },
118 { IDCMP_DISKINSERTED
, IDCMPDiskInserted
},
119 { IDCMP_DISKREMOVED
, IDCMPDiskRemoved
},
120 // { IDCMP_WBENCHMESSAGE, NULL },
121 { IDCMP_ACTIVEWINDOW
, IDCMPActiveWindow
},
122 { IDCMP_INACTIVEWINDOW
, IDCMPInactiveWindow
},
123 // { IDCMP_DELTAMOVE, NULL },
124 // { IDCMP_VANILLAKEY, NULL },
125 { IDCMP_INTUITICKS
, IDCMPIntuiTicks
},
126 { IDCMP_IDCMPUPDATE
, IDCMPUpdate
},
127 // { IDCMP_MENUHELP, NULL },
128 { IDCMP_CHANGEWINDOW
, IDCMPChangeWindow
},
129 { IDCMP_GADGETHELP
, IDCMPGadgetHelp
},
130 // { IDCMP_LONELYMESSAGE, NULL },
131 #if defined(IDCMP_EXTENDEDMOUSE)
132 { IDCMP_EXTENDEDMOUSE
, IDCMPExtendedMouse
},
133 #endif //defined(IDCMP_EXTENDEDMOUSE)
136 const size_t IDCMPFuncTableSize
= Sizeof(IDCMPFuncTable
); // number of entries in IDCMPFuncTable[
138 //----------------------------------------------------------------------------
140 ULONG
IDCMPRefreshWindow(struct internalScaWindowTask
*iwt
, struct IntuiMessage
*iMsg
)
142 d1(KPrintF("%s/%s/%ld: START iwt=%08lx <%s> IDCMPWindow=%08lx\n", \
143 __FILE__
, __FUNC__
, __LINE__
, iwt
, iwt
->iwt_WinTitle
, iMsg
->IDCMPWindow
));
145 if (iwt
->iwt_DragFlags
& DRAGFLAGF_WindowLocked
)
147 iwt
->iwt_DragFlags
|= DRAGFLAGF_UpdatePending
;
149 d1(kprintf("%s/%s/%ld: \n", __FILE__
, __FUNC__
, __LINE__
));
153 BeginRefresh(iwt
->iwt_WindowTask
.wt_Window
);
155 if (iwt
->iwt_TextGadFlag
)
156 DoMethod(iwt
->iwt_WindowTask
.mt_MainObject
, SCCM_TextWin_DrawColumnHeaders
);
158 if (iwt
->iwt_WindowTask
.wt_IconList
)
160 struct Rectangle winRect
;
162 winRect
.MinX
= winRect
.MaxX
= iwt
->iwt_InnerLeft
;
163 winRect
.MaxX
+= iwt
->iwt_InnerWidth
- 1;
164 winRect
.MinY
= winRect
.MaxY
= iwt
->iwt_InnerTop
;
165 winRect
.MaxY
+= iwt
->iwt_InnerHeight
- 1;
167 d1(kprintf("%s/%s/%ld: WinRect MinX=%ld MinY=%ld MaxX=%ld MaxY=%ld\n", \
168 __FILE__
, __FUNC__
, __LINE__
, winRect
.MinX
, winRect
.MinY
, winRect
.MaxX
, winRect
.MaxY
));
170 if (NULL
== iwt
->iwt_DamagedRegion
)
171 iwt
->iwt_DamagedRegion
= NewRegion();
173 if (iwt
->iwt_DamagedRegion
)
175 OrRegionRegion(iwt
->iwt_WindowTask
.wt_Window
->WLayer
->DamageList
, iwt
->iwt_DamagedRegion
);
176 AndRectRegion(iwt
->iwt_DamagedRegion
, &winRect
);
178 d1(KPrintF("%s/%s/%ld: iwt=%08lx\n", __FILE__
, __FUNC__
, __LINE__
, iwt
));
180 if (ScalosAttemptLockIconListShared(iwt
))
182 iwt
->iwt_WindowTask
.mt_WindowStruct
->ws_Flags
&= ~WSV_FlagF_RefreshPending
;
184 RefreshIcons(iwt
, iwt
->iwt_DamagedRegion
);
186 DisposeRegion(iwt
->iwt_DamagedRegion
);
187 iwt
->iwt_DamagedRegion
= NULL
;
189 ScalosUnLockIconList(iwt
);
193 // Postpone refresh until next SCCM_Ping
194 d1(KPrintF("%s/%s/%ld: postpone refresh iwt=%08lx\n", __FILE__
, __FUNC__
, __LINE__
, iwt
));
195 iwt
->iwt_WindowTask
.mt_WindowStruct
->ws_Flags
|= WSV_FlagF_RefreshPending
;
200 d1(KPrintF("%s/%s/%ld: WLayer=%08lx Flags=%04lx\n", __FILE__
, __FUNC__
, __LINE__
, iwt
->iwt_WindowTask
.wt_Window
->WLayer
,
201 iwt
->iwt_WindowTask
.wt_Window
->WLayer
->Flags
));
203 #if defined(__MORPHOS__)
204 if (!iInfos
.xii_Layers3D
)
205 RefreshWindowFrame(iwt
->iwt_WindowTask
.wt_Window
);
206 #endif /* __MORPHOS__ */
208 EndRefresh(iwt
->iwt_WindowTask
.wt_Window
, TRUE
);
210 d1(kprintf("%s/%s/%ld: END iwt=%08lx <%s>\n", __FILE__
, __FUNC__
, __LINE__
, iwt
, iwt
->iwt_WinTitle
));
216 static ULONG
IDCMPMouseButtons(struct internalScaWindowTask
*iwt
, struct IntuiMessage
*iMsg
)
218 iwt
->iwt_LockCount
.tv_secs
= iMsg
->Seconds
;
219 iwt
->iwt_LockCount
.tv_micro
= iMsg
->Micros
;
221 d1(KPrintF("%s/%s/%ld: START Code=%04lx\n", __FILE__
, __FUNC__
, __LINE__
, iMsg
->Code
));
228 d1(KPrintF("%s/%s/%ld: SELECTDOWN\n", __FILE__
, __FUNC__
, __LINE__
));
229 MousePress(iwt
, iMsg
);
233 d1(KPrintF("%s/%s/%ld: SELECTUP\n", __FILE__
, __FUNC__
, __LINE__
));
234 MouseRelease(iwt
, iMsg
);
238 d1(KPrintF("%s/%s/%ld: MIDDLEDOWN\n", __FILE__
, __FUNC__
, __LINE__
));
239 if (CurrentPrefs
.pref_MMBMoveFlag
)
243 if (!iwt
->iwt_BackDrop
)
245 iwt
->iwt_MoveGadId
= VGADGETID_MMBMOUSEMOVE
;
247 iwt
->iwt_OldMouse
.X
= iMsg
->MouseX
;
248 iwt
->iwt_OldMouse
.Y
= iMsg
->MouseY
;
250 ModifyIDCMP(iwt
->iwt_WindowTask
.wt_Window
, iwt
->iwt_IDCMPFlags
| IDCMP_MOUSEMOVE
);
256 d1(KPrintF("%s/%s/%ld: MIDDLEUP\n", __FILE__
, __FUNC__
, __LINE__
));
257 if (CurrentPrefs
.pref_MMBMoveFlag
)
259 iwt
->iwt_MoveGadId
= VGADGETID_IDLE
;
261 ModifyIDCMP(iwt
->iwt_WindowTask
.wt_Window
, iwt
->iwt_IDCMPFlags
);
266 d1(KPrintF("%s/%s/%ld: END\n", __FILE__
, __FUNC__
, __LINE__
));
272 static ULONG
IDCMPMouseMove(struct internalScaWindowTask
*iwt
, struct IntuiMessage
*iMsg
)
276 iInfos
.xii_GlobalGadgetUnderPointer
.ggd_iwt
= NULL
;
277 iInfos
.xii_GlobalGadgetUnderPointer
.ggd_Gadget
= NULL
;
278 iInfos
.xii_GlobalGadgetUnderPointer
.ggd_GadgetID
= SGTT_GADGETID_unknown
;
279 iInfos
.xii_GlobalGadgetUnderPointer
.ggd_cgy
= NULL
;
280 iInfos
.xii_GlobalGadgetUnderPointer
.ggd_GadgetTextHook
= NULL
;
282 switch (iwt
->iwt_MoveGadId
)
284 case VGADGETID_WAITFORDRAG
:
285 IDCMPBeginDrag(iwt
, iMsg
);
288 case VGADGETID_DRAGMOUSEMOVE
:
289 IDCMPDragMouseMove(iwt
, iMsg
);
292 case VGADGETID_MMBMOUSEMOVE
:
293 IDCMPMMBMouseMove(iwt
);
296 case GADGETID_HORIZSLIDER
:
300 case GADGETID_VERTSLIDER
:
304 case VGADGETID_LASSO
:
305 if (iwt
->iwt_LassoFlag
)
307 Lasso(iwt
->iwt_OldMouse
.X
, iwt
->iwt_OldMouse
.Y
, LASSOX_FollowLasso
, iwt
);
313 deltaX
= iMsg
->MouseX
- iwt
->iwt_OldMouse
.X
;
314 deltaY
= iMsg
->MouseY
- iwt
->iwt_OldMouse
.Y
;
316 if (abs(deltaX
) > 8 || abs(deltaY
) > 8)
317 BeginLasso(iwt
, iMsg
->Qualifier
);
326 static ULONG
IDCMPGadgetDown(struct internalScaWindowTask
*iwt
, struct IntuiMessage
*iMsg
)
328 struct ExtGadget
*gad
;
333 if (NULL
== iwt
->iwt_WindowTask
.wt_IconList
)
335 iwt
->iwt_MoveGadId
= VGADGETID_IDLE
;
339 gad
= (struct ExtGadget
*) iMsg
->IAddress
;
340 iwt
->iwt_MoveGadId
= gad
->GadgetID
;
342 switch (iwt
->iwt_MoveGadId
)
344 case GADGETID_HORIZSLIDER
:
345 case GADGETID_VERTSLIDER
:
346 ModifyIDCMP(iwt
->iwt_WindowTask
.wt_Window
, iwt
->iwt_IDCMPFlags
| IDCMP_MOUSEMOVE
| IDCMP_INTUITICKS
);
349 case GADGETID_RIGHTBUTTON
:
350 ArrowRight(iwt
, iMsg
);
351 ModifyIDCMP(iwt
->iwt_WindowTask
.wt_Window
, iwt
->iwt_IDCMPFlags
| IDCMP_INTUITICKS
);
354 case GADGETID_LEFTBUTTON
:
355 ArrowLeft(iwt
, iMsg
);
356 ModifyIDCMP(iwt
->iwt_WindowTask
.wt_Window
, iwt
->iwt_IDCMPFlags
| IDCMP_INTUITICKS
);
359 case GADGETID_UPBUTTON
:
361 ModifyIDCMP(iwt
->iwt_WindowTask
.wt_Window
, iwt
->iwt_IDCMPFlags
| IDCMP_INTUITICKS
);
364 case GADGETID_DOWNBUTTON
:
365 ArrowDown(iwt
, iMsg
);
366 ModifyIDCMP(iwt
->iwt_WindowTask
.wt_Window
, iwt
->iwt_IDCMPFlags
| IDCMP_INTUITICKS
);
369 case GADGETID_CONTROLBAR
:
370 //Code = StatusBarQueryGadgetID(iwt, gad, iMsg->MouseX, iMsg->MouseY);
371 d1(KPrintF("%s/%s/%ld: GADGETID_CONTROLBAR Code=%ld\n", __FILE__
, __FUNC__
, __LINE__
, Code
));
374 case GADGETID_STATUSBAR
:
375 //Code = StatusBarQueryGadgetID(iwt, gad, iMsg->MouseX, iMsg->MouseY);
376 d1(KPrintF("%s/%s/%ld: GADGETID_STATUSBAR Code=%ld\n", __FILE__
, __FUNC__
, __LINE__
, Code
));
381 d1(KPrintF("%s/%s/%ld: unknown GadgetID=%ld\n", __FILE__
, __FUNC__
, __LINE__
, gad
->GadgetID
));
389 static ULONG
IDCMPGadgetUp(struct internalScaWindowTask
*iwt
, struct IntuiMessage
*iMsg
)
391 struct ExtGadget
*gad
= (struct ExtGadget
*) iMsg
->IAddress
;
396 d1(KPrintF("%s/%s/%ld: >GadgetID=%ld\n", __FILE__
, __FUNC__
, __LINE__
, gad
->GadgetID
));
398 switch (gad
->GadgetID
)
400 case GADGETID_HORIZSLIDER
:
401 d1(KPrintF("%s/%s/%ld: GADGETID_HORIZSLIDER\n", __FILE__
, __FUNC__
, __LINE__
));
403 DoMethod(iwt
->iwt_WindowTask
.mt_MainObject
, SCCM_IconWin_SetVirtSize
, SETVIRTF_AdjustBottomSlider
);
406 case GADGETID_VERTSLIDER
:
407 d1(KPrintF("%s/%s/%ld: GADGETID_VERTSLIDER\n", __FILE__
, __FUNC__
, __LINE__
));
409 DoMethod(iwt
->iwt_WindowTask
.mt_MainObject
, SCCM_IconWin_SetVirtSize
, SETVIRTF_AdjustRightSlider
);
412 case GADGETID_ICONIFY
:
414 ModifyIDCMP(iwt
->iwt_WindowTask
.wt_Window
, iwt
->iwt_IDCMPFlags
);
415 ReplyMsg(&iMsg
->ExecMessage
);
416 DoMethod(iwt
->iwt_WindowTask
.mt_WindowObject
, SCCM_Window_Iconify
);
418 iwt
->iwt_MoveGadId
= VGADGETID_IDLE
;
423 case GADGETID_CONTROLBAR
:
424 d1(KPrintF("%s/%s/%ld: GADGETID_CONTROLBAR\n", __FILE__
, __FUNC__
, __LINE__
));
425 Code
= ControlBarQueryGadgetType(iwt
, gad
);
426 d1(KPrintF("%s/%s/%ld: code=%ld\n", __FILE__
, __FUNC__
, __LINE__
, code
));
429 case SCPGadgetType_BrowseButton
:
430 d1(KPrintF("%s/%s/%ld: SCPGadgetType_BrowseButton\n", __FILE__
, __FUNC__
, __LINE__
));
431 DoMethod(iwt
->iwt_WindowTask
.mt_MainObject
, SCCM_IconWin_Browse
);
433 case SCPGadgetType_UpButton
:
434 d1(KPrintF("%s/%s/%ld: SCPGadgetType_UpButton\n", __FILE__
, __FUNC__
, __LINE__
));
435 if (!(iwt
->iwt_WindowTask
.mt_WindowStruct
->ws_Flags
& WSV_FlagF_RootWindow
)
436 && iwt
->iwt_WindowTask
.mt_WindowStruct
->ws_Lock
)
440 parentLock
= ParentDir(iwt
->iwt_WindowTask
.mt_WindowStruct
->ws_Lock
);
441 debugLock_d1(parentLock
);
446 ParentName
= AllocPathBuffer();
447 d1(KPrintF("%s/%s/%ld: ParentName=%08lx\n", __FILE__
, __FUNC__
, __LINE__
, ParentName
));
450 if (NameFromLock(parentLock
, ParentName
, Max_PathLen
- 1))
452 d1(KPrintF("%s/%s/%ld: ParentName=<%s>\n", __FILE__
, __FUNC__
, __LINE__
, ParentName
));
453 WindowNewPath(iwt
, ParentName
);
456 FreePathBuffer(ParentName
);
463 case SCPGadgetType_BackButton
:
464 d1(KPrintF("%s/%s/%ld: SCPGadgetType_BackButton\n", __FILE__
, __FUNC__
, __LINE__
));
465 DoMethod(iwt
->iwt_WindowTask
.mt_MainObject
, SCCM_IconWin_History_Back
);
467 case SCPGadgetType_ForwardButton
:
468 d1(KPrintF("%s/%s/%ld: SCPGadgetType_ForwardButton\n", __FILE__
, __FUNC__
, __LINE__
));
469 DoMethod(iwt
->iwt_WindowTask
.mt_MainObject
, SCCM_IconWin_History_Forward
);
471 case SCPGadgetType_ViewBy
:
472 d1(KPrintF("%s/%s/%ld: SCPGadgetType_ViewBy Code=%ld\n", __FILE__
, __FUNC__
, __LINE__
, iMsg
->Code
));
473 ViewWindowBy(iwt
, ControlBarViewModeFromCode(iMsg
->Code
));
475 case SCPGadgetType_ShowMode
:
476 d1(KPrintF("%s/%s/%ld: SCPGadgetType_ShowMode Code=%ld\n", __FILE__
, __FUNC__
, __LINE__
, iMsg
->Code
));
477 SetAttrs(iwt
->iwt_WindowTask
.mt_MainObject
,
478 SCCA_IconWin_ShowType
, (0 == iMsg
->Code
) ? DDFLAGS_SHOWICONS
: DDFLAGS_SHOWALL
,
481 case SCPGadgetType_History
:
482 d1(KPrintF("%s/%s/%ld: SCPGadgetType_History Code=%ld\n", __FILE__
, __FUNC__
, __LINE__
, iMsg
->Code
));
483 ControlBarSwitchHistoryEntry(iwt
);
485 case SCPGadgetType_ActionButton
:
486 d1(KPrintF("%s/%s/%ld: SCPGadgetType_ActionButton Code=%ld\n", __FILE__
, __FUNC__
, __LINE__
, iMsg
->Code
));
487 ControlBarActionButton(iwt
, gad
);
490 d1(KPrintF("%s/%s/%ld: GADGETID_CONTROLBAR unknown Code=%ld\n", __FILE__
, __FUNC__
, __LINE__
, Code
));
495 case GADGETID_STATUSBAR
:
496 //Code = StatusBarQueryGadgetID(iwt, gad, iMsg->MouseX, iMsg->MouseY);
497 d1(KPrintF("%s/%s/%ld: GADGETID_STATUSBAR Code=%ld\n", __FILE__
, __FUNC__
, __LINE__
, Code
));
501 d1(KPrintF("%s/%s/%ld: unknown GadgetID=%ld Code=%ld\n", __FILE__
, __FUNC__
, __LINE__
, gad
->GadgetID
, iMsg
->Code
));
505 ModifyIDCMP(iwt
->iwt_WindowTask
.wt_Window
, iwt
->iwt_IDCMPFlags
);
506 iwt
->iwt_MoveGadId
= VGADGETID_IDLE
;
512 static ULONG
IDCMPMenuPick(struct internalScaWindowTask
*iwt
, struct IntuiMessage
*iMsg
)
514 WORD code
= iMsg
->Code
;
516 d1(KPrintF("%s/%s/%ld: iwt=%08lx iMsg=%08lx code=%04lx\n", \
517 __FILE__
, __FUNC__
, __LINE__
, iwt
, iMsg
, code
));
519 ReplyMsg(&iMsg
->ExecMessage
);
521 while ((WORD
) MENUNULL
!= code
)
523 struct MenuItem
*mItem
= ItemAddress(MainMenu
, code
);
524 struct SCALOS_MENUTREE
*mTree
;
529 mTree
= (struct SCALOS_MENUTREE
*) GTMENUITEM_USERDATA(mItem
);
532 struct AppObject
*appo
= (struct AppObject
*) mTree
;
534 if (ID_SC
== appo
->appo_Kennung
)
536 struct AppMessage
*appMsg
;
537 ULONG NumberOfWbArgs
;
540 NumberOfWbArgs
= SCA_CountWBArgs(NULL
);
541 MsgSize
= sizeof(struct AppMessage
) + NumberOfWbArgs
* sizeof(struct WBArg
);
543 appMsg
= AllocVec(MsgSize
, MEMF_CLEAR
| MEMF_PUBLIC
);
546 appMsg
->am_Message
.mn_ReplyPort
= iInfos
.xii_iinfos
.ii_MainMsgPort
;
547 appMsg
->am_Message
.mn_Length
= MsgSize
;
548 appMsg
->am_Type
= AMTYPE_APPMENUITEM
;
549 appMsg
->am_UserData
= appo
->appo_userdata
;
550 appMsg
->am_ID
= appo
->appo_id
;
551 appMsg
->am_Version
= AM_VERSION
;
552 appMsg
->am_MouseX
= iwt
->iwt_WindowTask
.wt_Window
->MouseX
;
553 appMsg
->am_MouseY
= iwt
->iwt_WindowTask
.wt_Window
->MouseY
;
554 CurrentTime(&appMsg
->am_Seconds
, &appMsg
->am_Micros
);
555 appMsg
->am_Reserved
[0] = ID_APPM
;
556 appMsg
->am_ArgList
= (struct WBArg
*) (appMsg
+ 1); // follows directly after appMsg
558 appMsg
->am_NumArgs
= SCA_MakeWBArgs(appMsg
->am_ArgList
, NULL
, NumberOfWbArgs
);
560 if (0 == appMsg
->am_NumArgs
)
561 appMsg
->am_ArgList
= NULL
;
563 PutMsg(appo
->appo_msgport
, &appMsg
->am_Message
);
568 RunMenuCommand(iwt
, mTree
, NULL
, (mItem
->Flags
& CHECKED
) ? 1 : 0);
572 code
= mItem
->NextSelect
;
579 ULONG
IDCMPDiskInserted(struct internalScaWindowTask
*iwt
, struct IntuiMessage
*iMsg
)
581 d1(KPrintF("%s/%s/%ld: START iwt_DevListObject=%08lx\n", __FILE__
, __FUNC__
, __LINE__
, iwt
->iwt_DevListObject
));
583 if (iwt
->iwt_DevListObject
)
585 struct ScaDeviceIcon
*nodeList
= NULL
;
586 struct ScaDeviceIcon
*di
, *diNext
;
587 struct ScaIconNode
*iconList
= NULL
;
590 DoMethod(iwt
->iwt_DevListObject
, SCCM_DeviceList_Generate
, &nodeList
);
592 for (di
=iwt
->iwt_DevIconList
; di
; di
= (struct ScaDeviceIcon
*) di
->di_Node
.mln_Succ
)
594 di
->di_Flags
|= DIBF_Remove
;
597 for (di
= nodeList
; di
; di
= diNext
)
599 struct ScaDeviceIcon
*di2
, *diNext2
;
601 diNext
= (struct ScaDeviceIcon
*) di
->di_Node
.mln_Succ
;
603 d1(kprintf("%s/%s/%ld: di=%08lx <%s> diNext=%08lx di_Flags=%08lx\n", __FILE__
, __FUNC__
, __LINE__
, di
, di
->di_Device
, diNext
, di
->di_Flags
));
605 for (di2
= iwt
->iwt_DevIconList
; di2
; di2
= diNext2
)
607 diNext2
= (struct ScaDeviceIcon
*) di2
->di_Node
.mln_Succ
;
609 if (di
->di_Handler
== di2
->di_Handler
)
611 d1(kprintf("%s/%s/%ld: di2=%08lx <%s> DiskType=%08lx di_Flags=%08lx\n", \
612 __FILE__
, __FUNC__
, __LINE__
, di2
, di2
->di_Device
, di2
->di_Info
->id_DiskType
, di2
->di_Flags
));
614 if (di
->di_Flags
& DIBF_DontDisplay
)
616 // device di2 is no longer valid
617 // DIBF_Remove stays set
618 d1(kprintf("%s/%s/%ld: invalid di2=%08lx <%s>\n", __FILE__
, __FUNC__
, __LINE__
, di2
, di2
->di_Device
));
620 else if (di2
->di_Flags
& DIBF_DontDisplay
&& !(di
->di_Flags
& DIBF_DontDisplay
))
622 d1(kprintf("%s/%s/%ld: Add di2=%08lx <%s>\n", __FILE__
, __FUNC__
, __LINE__
, di2
, di2
->di_Device
));
624 di2
->di_Flags
&= ~(DIBF_DontDisplay
| DIBF_Remove
);
625 RemoveDeviceIcon(iwt
, di2
, &iconList
);
627 DoMethod(iwt
->iwt_DevListObject
, SCCM_DeviceList_FreeDevNode
, di2
);
628 SCA_FreeNode((struct ScalosNodeList
*)(APTR
) &iwt
->iwt_DevIconList
, &di2
->di_Node
);
632 if (0 == SafeStrCmp(di
->di_Volume
, di2
->di_Volume
)
633 && di
->di_Info
->id_DiskType
== di2
->di_Info
->id_DiskType
)
635 // device is already present in iwt_DevIconList
636 // and there are no changes.
637 // remove new devicenode from nodeList
639 di2
->di_Flags
&= ~DIBF_Remove
;
641 d1(kprintf("%s/%s/%ld: Remove di=%08lx <%s>\n", __FILE__
, __FUNC__
, __LINE__
, di
, di
->di_Device
));
643 DoMethod(iwt
->iwt_DevListObject
, SCCM_DeviceList_FreeDevNode
, di
);
644 SCA_FreeNode((struct ScalosNodeList
*)(APTR
) &nodeList
, &di
->di_Node
);
646 d1(kprintf("%s/%s/%ld: di=%08lx diNext=%08lx\n", __FILE__
, __FUNC__
, __LINE__
, di
, diNext
));
651 // device seems to have changed
652 // move devicenode to iconlist and remember it for re-reading
654 d1(kprintf("%s/%s/%ld: Remove di2=%08lx <%s>\n", __FILE__
, __FUNC__
, __LINE__
, di2
, di2
->di_Device
));
655 RemoveDeviceIcon(iwt
, di2
, &iconList
);
657 d1(kprintf("%s/%s/%ld: di=%08lx diNext=%08lx\n", __FILE__
, __FUNC__
, __LINE__
, di
, diNext
));
661 d1(kprintf("%s/%s/%ld: di=%08lx diNext=%08lx\n", __FILE__
, __FUNC__
, __LINE__
, di
, diNext
));
665 d1(kprintf("%s/%s/%ld: \n", __FILE__
, __FUNC__
, __LINE__
));
667 for (di
= iwt
->iwt_DevIconList
; di
; di
= diNext
)
669 diNext
= (struct ScaDeviceIcon
*) di
->di_Node
.mln_Succ
;
671 d1(kprintf("%s/%s/%ld: di=%08lx <%s> diNext=%08lx di_Flags=%08lx\n", __FILE__
, __FUNC__
, __LINE__
, di
, di
->di_Device
, diNext
, di
->di_Flags
));
673 if (di
->di_Flags
& DIBF_Remove
)
675 d1(kprintf("%s/%s/%ld: Remove icon <%s>\n", __FILE__
, __FUNC__
, __LINE__
, di
->di_Device
));
676 RemoveDeviceIcon(iwt
, di
, &iconList
);
680 d1(kprintf("%s/%s/%ld: iconList=%08lx\n", __FILE__
, __FUNC__
, __LINE__
, iconList
));
684 RemoveIcons(iwt
, &iconList
);
685 FreeIconList(iwt
, &iconList
);
690 struct ScaIconNode
*in
;
692 kprintf("%s/%s/%ld: --------start----------\n", __FILE__
, __FUNC__
, __LINE__
);
694 for (in
=iwt
->iwt_WindowTask
.wt_IconList
; in
; in
=(struct ScaIconNode
*) in
->in_Node
.mln_Succ
)
695 kprintf("%s/%s/%ld: in=%08lx <%s>\n", __FILE__
, __FUNC__
, __LINE__
, in
, GetIconName(in
));
697 kprintf("%s/%s/%ld: ---------end----------\n", __FILE__
, __FUNC__
, __LINE__
);
700 d1(kprintf("%s/%s/%ld: nodeList=%08lx\n", __FILE__
, __FUNC__
, __LINE__
, nodeList
));
704 for (di
= nodeList
; di
; di
= diNext
)
706 diNext
= (struct ScaDeviceIcon
*) di
->di_Node
.mln_Succ
;
708 d1(kprintf("%s/%s/%ld: di=%08lx <%s> diNext=%08lx di_Flags=%08lx\n", __FILE__
, __FUNC__
, __LINE__
, di
, di
->di_Device
, diNext
, di
->di_Flags
));
710 if (!(di
->di_Flags
& (DIBF_DontDisplay
| DIBF_InfoPending
)))
712 d1(kprintf("%s/%s/%ld: add icon di=%08lx <%s> disktype=%08lx\n", \
713 __FILE__
, __FUNC__
, __LINE__
, di
, di
->di_Device
, di
->di_Info
->id_DiskType
));
714 DoMethod(iwt
->iwt_WindowTask
.mt_MainObject
, SCCM_DeviceWin_ReadIcon
, di
);
716 SCA_MoveDevIconNode(&nodeList
, &iwt
->iwt_DevIconList
, di
);
720 DoMethod(iwt
->iwt_WindowTask
.mt_MainObject
, SCCM_IconWin_CleanUp
);
723 // Now remove all unused entries from nodeList
726 d1(kprintf("%s/%s/%ld: free entry nodeList=%08lx <%s> di_Flags=%08lx\n", __FILE__
, __FUNC__
, __LINE__
, nodeList
, nodeList
->di_Device
, nodeList
->di_Flags
));
727 DoMethod(iwt
->iwt_DevListObject
, SCCM_DeviceList_FreeDevNode
, nodeList
);
728 SCA_FreeNode((struct ScalosNodeList
*)(APTR
) &nodeList
, &nodeList
->di_Node
);
731 if (WSV_Type_DeviceWindow
!= iwt
->iwt_WindowTask
.mt_WindowStruct
->ws_WindowType
)
733 struct FileLock
*fLock
= BADDR(iwt
->iwt_WindowTask
.mt_WindowStruct
->ws_Lock
);
735 iwt
->iwt_OldFileSys
= SetFileSysTask(fLock
->fl_Task
);
737 IsReadOnly
= !ClassIsDiskWritable(iwt
->iwt_WindowTask
.mt_WindowStruct
->ws_Lock
);
739 if (IsReadOnly
!= iwt
->iwt_ReadOnly
)
741 SetIconWindowReadOnly(iwt
, IsReadOnly
);
742 iwt
->iwt_ReadOnly
= IsReadOnly
;
747 d1(kprintf("%s/%s/%ld: END\n", __FILE__
, __FUNC__
, __LINE__
));
753 static ULONG
IDCMPDiskRemoved(struct internalScaWindowTask
*iwt
, struct IntuiMessage
*iMsg
)
755 d1(kprintf("%s/%s/%ld: \n", __FILE__
, __FUNC__
, __LINE__
));
757 if (!iwt
->iwt_BackDrop
)
759 iwt
->iwt_WinTitle
= (STRPTR
) DoMethod(iwt
->iwt_TitleObject
, SCCM_Title_Generate
);
760 DoMethod(iwt
->iwt_TitleObject
, SCCM_Window_SetTitle
, iwt
->iwt_WinTitle
);
767 static ULONG
IDCMPActiveWindow(struct internalScaWindowTask
*iwt
, struct IntuiMessage
*iMsg
)
771 if (iwt
->iwt_WindowTask
.mt_WindowStruct
->ws_Flags
& WSV_FlagF_ActivatePending
)
773 d1(kprintf("%s/%s/%ld: iwt_PopupMenuPending=%08lx\n", __FILE__
, __FUNC__
, __LINE__
, iwt
->iwt_PopupMenuPending
));
775 if (iwt
->iwt_PopupMenuPending
)
777 ReplyMsg(&iMsg
->ExecMessage
);
780 // Now show pending popup menu
781 DoMethodA(iwt
->iwt_WindowTask
.mt_MainObject
, (Msg
) iwt
->iwt_PopupMenuPending
);
783 ScalosFree(iwt
->iwt_PopupMenuPending
);
784 iwt
->iwt_PopupMenuPending
= NULL
;
788 SetAttrs(iwt
->iwt_WindowTask
.mt_WindowObject
,
789 SCCA_Window_Transparency
, iwt
->iwt_WindowTask
.mt_WindowStruct
->ws_WindowOpacityActive
,
792 iwt
->iwt_WindowTask
.mt_WindowStruct
->ws_Flags
&= ~WSV_FlagF_ActivatePending
;
800 static ULONG
IDCMPInactiveWindow(struct internalScaWindowTask
*iwt
, struct IntuiMessage
*iMsg
)
802 SetAttrs(iwt
->iwt_WindowTask
.mt_WindowObject
,
803 SCCA_Window_Transparency
, iwt
->iwt_WindowTask
.mt_WindowStruct
->ws_WindowOpacityInactive
,
810 static ULONG
IDCMPRawKey(struct internalScaWindowTask
*iwt
, struct IntuiMessage
*iMsg
)
812 DoMethod(iwt
->iwt_WindowTask
.mt_MainObject
, SCCM_IconWin_RawKey
, iMsg
);
818 static ULONG
IDCMPUpdate(struct internalScaWindowTask
*iwt
, struct IntuiMessage
*iMsg
)
821 struct ControlBarGadgetEntry
*cgy
;
823 d1(KPrintF("%s/%s/%ld: Class=%08lx Code=%ld IAddress=%08lx\n", \
824 __FILE__
, __FUNC__
, __LINE__
, iMsg
->Class
, iMsg
->Code
, iMsg
->IAddress
));
826 GadgetID
= GetTagData(GA_ID
, 0, iMsg
->IAddress
);
827 d1(KPrintF("%s/%s/%ld: GadgetID=%ld Code=%ld\n", __FILE__
, __FUNC__
, __LINE__
, GadgetID
, iMsg
->Code
));
829 cgy
= ControlBarFindGadgetByID(iwt
, GadgetID
);
830 d1(KPrintF("%s/%s/%ld: cgy=%08lx cgy_GadgetType=%ld\n", __FILE__
, __FUNC__
, __LINE__
, cgy
, cgy
? cgy
->cgy_GadgetType
: 0));
835 Code
= GetTagData(SCACYCLE_Active
, 0, iMsg
->IAddress
);
837 switch (cgy
->cgy_GadgetType
)
839 case SCPGadgetType_ViewBy
:
840 d1(KPrintF("%s/%s/%ld: SCPGadgetType_ViewBy Code=%ld\n", __FILE__
, __FUNC__
, __LINE__
, Code
));
841 ViewWindowBy(iwt
, ControlBarViewModeFromCode(Code
));
843 case SCPGadgetType_ShowMode
:
844 d1(KPrintF("%s/%s/%ld: SCPGadgetType_ShowMode Code=%ld\n", __FILE__
, __FUNC__
, __LINE__
, Code
));
845 SetAttrs(iwt
->iwt_WindowTask
.mt_MainObject
,
846 SCCA_IconWin_ShowType
, (0 == Code
) ? DDFLAGS_SHOWICONS
: DDFLAGS_SHOWALL
,
850 d1(KPrintF("%s/%s/%ld: unknown GadgetID=%ld Code=%ld\n", __FILE__
, __FUNC__
, __LINE__
, GadgetID
, Code
));
860 // IntuiTicks are issued about 10 times per second
861 static ULONG
IDCMPIntuiTicks(struct internalScaWindowTask
*iwt
, struct IntuiMessage
*iMsg
)
863 iwt
->iwt_LockCount
.tv_secs
= iMsg
->Seconds
;
864 iwt
->iwt_LockCount
.tv_micro
= iMsg
->Micros
;
866 d1(KPrintF("%s/%s/%ld: Class=%08lx Code=%ld IAddress=%08lx\n", \
867 __FILE__
, __FUNC__
, __LINE__
, iMsg
->Class
, iMsg
->Code
, iMsg
->IAddress
));
869 switch (iwt
->iwt_MoveGadId
)
871 case VGADGETID_WAITFORDRAG
:
874 case VGADGETID_DRAGMOUSEMOVE
:
875 d1(KPrintF("%s/%s/%ld: iwt=%08lx\n", __FILE__
, __FUNC__
, __LINE__
, iwt
));
876 if (iMsg
->Qualifier
& (IEQUALIFIER_RBUTTON
| IEQUALIFIER_MIDBUTTON
))
882 IDCMPDragIntuiTicks(iwt
, iMsg
);
886 case VGADGETID_LASSO
:
887 if (iwt
->iwt_LassoFlag
)
888 Lasso(iwt
->iwt_OldMouse
.X
, iwt
->iwt_OldMouse
.Y
, LASSOX_CrawlLasso
, iwt
);
892 if (iMsg
->Qualifier
& IEQUALIFIER_LEFTBUTTON
)
894 struct Gadget
*gad
= NULL
;
896 if (iwt
->iwt_MoveGadId
> VGADGETID_IDLE
)
898 gad
= iwt
->iwt_WindowTask
.wt_Window
->FirstGadget
;
899 while (gad
&& gad
->GadgetID
!= iwt
->iwt_MoveGadId
)
900 gad
= gad
->NextGadget
;
905 WORD gadLeft
, gadTop
, gadWidth
, gadHeight
;
907 gadLeft
= gad
->LeftEdge
;
908 if (gad
->Flags
& GFLG_RELRIGHT
)
909 gadLeft
+= iwt
->iwt_WindowTask
.wt_Window
->Width
;
911 gadTop
= gad
->TopEdge
;
912 if (gad
->Flags
& GFLG_RELBOTTOM
)
913 gadTop
+= iwt
->iwt_WindowTask
.wt_Window
->Height
;
915 gadWidth
= gad
->Width
;
916 if (gad
->Flags
& GFLG_RELWIDTH
)
917 gadWidth
+= iwt
->iwt_WindowTask
.wt_Window
->Width
;
919 gadHeight
= gad
->Height
;
920 if (gad
->Flags
& GFLG_RELHEIGHT
)
921 gadHeight
+= iwt
->iwt_WindowTask
.wt_Window
->Height
;
923 if (iwt
->iwt_WindowTask
.wt_Window
->MouseX
>= gadLeft
924 && iwt
->iwt_WindowTask
.wt_Window
->MouseX
< gadLeft
+ gadWidth
925 && iwt
->iwt_WindowTask
.wt_Window
->MouseY
>= gadTop
926 && iwt
->iwt_WindowTask
.wt_Window
->MouseY
< gadTop
+ gadHeight
)
928 switch (iwt
->iwt_MoveGadId
)
930 case GADGETID_RIGHTBUTTON
:
931 ArrowRight(iwt
, iMsg
);
933 case GADGETID_LEFTBUTTON
:
934 ArrowLeft(iwt
, iMsg
);
936 case GADGETID_DOWNBUTTON
:
937 ArrowDown(iwt
, iMsg
);
939 case GADGETID_UPBUTTON
:
948 ModifyIDCMP(iwt
->iwt_WindowTask
.wt_Window
, iwt
->iwt_IDCMPFlags
);
957 static ULONG
IDCMPChangeWindow(struct internalScaWindowTask
*iwt
, struct IntuiMessage
*iMsg
)
959 d1(KPrintF("%s/%s/%ld: START iwt=%08lx <%s> IDCMPWindow=%08lx\n", \
960 __FILE__
, __FUNC__
, __LINE__
, iwt
, iwt
->iwt_WinTitle
, iMsg
->IDCMPWindow
));
961 d1(KPrintF("%s/%s/%ld: Class=%08lx Code=%ld IAddress=%08lx\n", \
962 __FILE__
, __FUNC__
, __LINE__
, iMsg
->Class
, iMsg
->Code
, iMsg
->IAddress
));
964 if (CWCODE_MOVESIZE
== iMsg
->Code
)
966 DoMethod(iwt
->iwt_WindowTask
.mt_WindowObject
, SCCM_Window_ChangeWindow
);
968 #if defined(__MORPHOS__)
969 else if (2 == iMsg
->Code
)
971 // MorphOS 2.3 "Enhanced Display Engine" special
972 // dynmic window resizing generates tons of this msg
973 // and application is reponsible to actually change the window size
974 WORD WinX
= ((ULONG
) iMsg
->IAddress
) >> 16;
975 WORD WinY
= ((ULONG
) iMsg
->IAddress
) & 0x0000ffff;
976 UWORD NewWidth
, NewHeight
;
978 d1(KPrintF("%s/%s/%ld: Class=%08lx Code=%ld IAddress=%08lx MouseX=%ld MouseY=%ld\n", \
979 __FILE__
, __FUNC__
, __LINE__
, iMsg
->Class
, iMsg
->Code
, iMsg
->IAddress
,\
980 iMsg
->MouseX
, iMsg
->MouseY
));
982 NewWidth
= iMsg
->MouseX
- WinX
;
983 NewHeight
= iMsg
->MouseY
- WinY
;
985 d1(KPrintF("%s/%s/%ld: NewWidth=%ld NewHeight=%ld\n", __FILE__
, __FUNC__
, __LINE__
, NewWidth
, NewHeight
));
987 if ((abs(NewWidth
- iwt
->iwt_WindowTask
.wt_Window
->Width
) > 2) ||
988 (abs(NewHeight
- iwt
->iwt_WindowTask
.wt_Window
->Height
) > 2) )
990 ChangeWindowBox(iwt
->iwt_WindowTask
.wt_Window
,
996 else if (3 == iMsg
->Code
)
998 // MorphOS 2.3 "Enhanced Display Engine" special
999 // LMB has been released - end of window sizing
1000 d1(KPrintF("%s/%s/%ld: Class=%08lx Code=%ld IAddress=%08lx MouseX=%ld MouseY=%ld\n", \
1001 __FILE__
, __FUNC__
, __LINE__
, iMsg
->Class
, iMsg
->Code
, iMsg
->IAddress
,\
1002 iMsg
->MouseX
, iMsg
->MouseY
));
1004 #endif //defined(__MORPHOS__)
1010 static ULONG
IDCMPNewSize(struct internalScaWindowTask
*iwt
, struct IntuiMessage
*iMsg
)
1012 d1(KPrintF("%s/%s/%ld: START iwt=%08lx <%s> IDCMPWindow=%08lx Code=%04lx\n", \
1013 __FILE__
, __FUNC__
, __LINE__
, iwt
, iwt
->iwt_WinTitle
, iMsg
->IDCMPWindow
, iMsg
->Code
));
1015 if (iwt
->iwt_WindowTask
.mt_WindowStruct
->ws_Width
!= iMsg
->IDCMPWindow
->Width
||
1016 iwt
->iwt_WindowTask
.mt_WindowStruct
->ws_Height
!= iMsg
->IDCMPWindow
->Height
)
1018 WORD OldInnerWidth
= iwt
->iwt_InnerWidth
;
1019 WORD OldInnerHeight
= iwt
->iwt_InnerHeight
;
1021 d1(KPrintF("%s/%s/%ld: iw=%ld ih=%ld\n", __FILE__
, __FUNC__
, __LINE__
, iwt
->iwt_InnerWidth
, iwt
->iwt_InnerHeight
));
1023 RefreshWindowFrame(iwt
->iwt_WindowTask
.wt_Window
);
1025 // Calculate new inner window sizes
1026 DoMethod(iwt
->iwt_WindowTask
.mt_WindowObject
, SCCM_Window_SetInnerSize
);
1028 d1(KPrintF("%s/%s/%ld: iw=%ld ih=%ld\n", __FILE__
, __FUNC__
, __LINE__
, iwt
->iwt_InnerWidth
, iwt
->iwt_InnerHeight
));
1030 RedrawResizedWindow(iwt
, OldInnerWidth
, OldInnerHeight
);
1032 DoMethod(iwt
->iwt_WindowTask
.mt_WindowObject
, SCCM_Window_DynamicResize
);
1035 d1(KPrintF("%s/%s/%ld: END\n", __FILE__
, __FUNC__
, __LINE__
));
1041 static ULONG
IDCMPGadgetHelp(struct internalScaWindowTask
*iwt
, struct IntuiMessage
*iMsg
)
1043 struct Gadget
*gg
= (struct Gadget
*) iMsg
->IAddress
;
1045 d1(KPrintF("%s/%s/%ld: Class=%08lx Code=%04lx Qual=%04lx IAddress=%08lx\n", \
1046 __FILE__
, __FUNC__
, __LINE__
, iMsg
->Class
, iMsg
->Code
, iMsg
->Qualifier
, iMsg
->IAddress
));
1048 iInfos
.xii_GlobalGadgetUnderPointer
.ggd_GadgetTextHook
= NULL
;
1049 iInfos
.xii_GlobalGadgetUnderPointer
.ggd_iwt
= iwt
;
1050 iInfos
.xii_GlobalGadgetUnderPointer
.ggd_Gadget
= gg
;
1054 d1(KPrintF("%s/%s/%ld: GadgetHelp Window\n", __FILE__
, __FUNC__
, __LINE__
));
1055 iInfos
.xii_GlobalGadgetUnderPointer
.ggd_GadgetID
= SGTT_GADGETID_unknown
;
1057 else if (gg
== iwt
->iwt_PropBottom
)
1059 d1(KPrintF("%s/%s/%ld: GadgetHelp PropBottom\n", __FILE__
, __FUNC__
, __LINE__
));
1060 iInfos
.xii_GlobalGadgetUnderPointer
.ggd_GadgetID
= SGTT_GADGETID_BottomScroller
;
1062 else if (gg
== iwt
->iwt_PropSide
)
1064 d1(KPrintF("%s/%s/%ld: GadgetHelp PropSide\n", __FILE__
, __FUNC__
, __LINE__
));
1065 iInfos
.xii_GlobalGadgetUnderPointer
.ggd_GadgetID
= SGTT_GADGETID_RightScroller
;
1067 else if (gg
== iwt
->iwt_GadgetRightArrow
)
1069 d1(KPrintF("%s/%s/%ld: GadgetHelp GadgetRightArrow\n", __FILE__
, __FUNC__
, __LINE__
));
1070 iInfos
.xii_GlobalGadgetUnderPointer
.ggd_GadgetID
= SGTT_GADGETID_RightArrow
;
1072 else if (gg
== iwt
->iwt_GadgetLeftArrow
)
1074 d1(KPrintF("%s/%s/%ld: GadgetHelp GadgetLeftArrow\n", __FILE__
, __FUNC__
, __LINE__
));
1075 iInfos
.xii_GlobalGadgetUnderPointer
.ggd_GadgetID
= SGTT_GADGETID_LeftArrow
;
1077 else if (gg
== iwt
->iwt_GadgetDownArrow
)
1079 d1(KPrintF("%s/%s/%ld: GadgetHelp GadgetDownArrow\n", __FILE__
, __FUNC__
, __LINE__
));
1080 iInfos
.xii_GlobalGadgetUnderPointer
.ggd_GadgetID
= SGTT_GADGETID_DownArrow
;
1082 else if (gg
== iwt
->iwt_GadgetUpArrow
)
1084 d1(KPrintF("%s/%s/%ld: GadgetHelp GadgetUpArrow\n", __FILE__
, __FUNC__
, __LINE__
));
1085 iInfos
.xii_GlobalGadgetUnderPointer
.ggd_GadgetID
= SGTT_GADGETID_UpArrow
;
1087 else if (gg
== iwt
->iwt_IconifyGadget
)
1089 d1(KPrintF("%s/%s/%ld: GadgetHelp Iconify\n", __FILE__
, __FUNC__
, __LINE__
));
1090 iInfos
.xii_GlobalGadgetUnderPointer
.ggd_GadgetID
= SGTT_GADGETID_Iconify
;
1092 else if (gg
== iwt
->iwt_StatusBar
)
1094 UWORD Code
= iMsg
->Code
;
1096 d1(KPrintF("%s/%s/%ld: GadgetHelp StatusBar Code=%04lx\n", __FILE__
, __FUNC__
, __LINE__
, iMsg
->Code
));
1098 if (GADGETID_STATUSBAR
== Code
)
1100 Code
= StatusBarQueryGadgetID(iwt
, (struct ExtGadget
*) gg
, iMsg
->MouseX
, iMsg
->MouseY
);
1101 d1(KPrintF("%s/%s/%ld: Code=%04lx\n", __FILE__
, __FUNC__
, __LINE__
, Code
));
1106 case SBAR_GadgetID_Text
:
1107 d1(kprintf("%s/%s/%ld: GadgetHelp StatusBar Text\n", __FILE__
, __FUNC__
, __LINE__
));
1108 iInfos
.xii_GlobalGadgetUnderPointer
.ggd_GadgetID
= SGTT_GADGETID_StatusBar_Text
;
1110 case SBAR_GadgetID_PadLock
:
1111 d1(kprintf("%s/%s/%ld: GadgetHelp StatusBar Padlock\n", __FILE__
, __FUNC__
, __LINE__
));
1112 iInfos
.xii_GlobalGadgetUnderPointer
.ggd_GadgetID
= SGTT_GADGETID_StatusBar_ReadOnly
;
1114 case SBAR_GadgetID_Reading
:
1115 d1(kprintf("%s/%s/%ld: GadgetHelp StatusBar Reading\n", __FILE__
, __FUNC__
, __LINE__
));
1116 iInfos
.xii_GlobalGadgetUnderPointer
.ggd_GadgetID
= SGTT_GADGETID_StatusBar_Reading
;
1118 case SBAR_GadgetID_Typing
:
1119 d1(kprintf("%s/%s/%ld: GadgetHelp StatusBar Typing\n", __FILE__
, __FUNC__
, __LINE__
));
1120 iInfos
.xii_GlobalGadgetUnderPointer
.ggd_GadgetID
= SGTT_GADGETID_StatusBar_Typing
;
1122 case SBAR_GadgetID_ShowAll
:
1123 d1(kprintf("%s/%s/%ld: GadgetHelp StatusBar ShowAll\n", __FILE__
, __FUNC__
, __LINE__
));
1124 iInfos
.xii_GlobalGadgetUnderPointer
.ggd_GadgetID
= SGTT_GADGETID_StatusBar_ShowAll
;
1126 case SBAR_GadgetID_ThumbnailsAlways
:
1127 d1(kprintf("%s/%s/%ld: GadgetHelp StatusBar ThumbnailsAlways\n", __FILE__
, __FUNC__
, __LINE__
));
1128 iInfos
.xii_GlobalGadgetUnderPointer
.ggd_GadgetID
= SGTT_GADGETID_StatusBar_ThumbnailsAlways
;
1130 case SBAR_GadgetID_ThumbnailsAsDefault
:
1131 d1(kprintf("%s/%s/%ld: GadgetHelp StatusBar ThumbnailsAsDefault\n", __FILE__
, __FUNC__
, __LINE__
));
1132 iInfos
.xii_GlobalGadgetUnderPointer
.ggd_GadgetID
= SGTT_GADGETID_StatusBar_ThumbnailsAsDefault
;
1134 case SBAR_GadgetID_ThumbnailsGenerate
:
1135 d1(kprintf("%s/%s/%ld: GadgetHelp StatusBar ThumbnailsGenerate\n", __FILE__
, __FUNC__
, __LINE__
));
1136 iInfos
.xii_GlobalGadgetUnderPointer
.ggd_GadgetID
= SGTT_GADGETID_StatusBar_ThumbnailsGenerate
;
1140 d1(KPrintF("%s/%s/%ld: unknown StatusBar GadgetID=%ld\n", __FILE__
, __FUNC__
, __LINE__
, Code
));
1141 iInfos
.xii_GlobalGadgetUnderPointer
.ggd_GadgetID
= SGTT_GADGETID_unknown
;
1145 else if (gg
== iwt
->iwt_ControlBar
)
1147 UWORD Code
= iMsg
->Code
;
1149 d1(KPrintF("%s/%s/%ld: GadgetHelp ControlBar Code=%04lx\n", __FILE__
, __FUNC__
, __LINE__
, iMsg
->Code
));
1151 if (GADGETID_CONTROLBAR
== Code
)
1153 iInfos
.xii_GlobalGadgetUnderPointer
.ggd_cgy
= ControlBarFindGadgetByID(iwt
,
1154 StatusBarQueryGadgetID(iwt
, (struct ExtGadget
*)gg
, iMsg
->MouseX
, iMsg
->MouseY
));
1155 iInfos
.xii_GlobalGadgetUnderPointer
.ggd_GadgetID
= SGTT_GADGETID_ControlBar
;
1156 d1(KPrintF("%s/%s/%ld: Code=%04lx\n", __FILE__
, __FUNC__
, __LINE__
, Code
));
1161 d1(KPrintF("%s/%s/%ld: Reading=%08lx Typing=%08lx Text=%08lx ReadAll=%08lx\n", \
1162 __FILE__
, __FUNC__
, __LINE__
, iwt_StatusBarMembers
[STATUSBARGADGET_Reading
], \
1163 iwt
->iwt_StatusBarMembers
[STATUSBARGADGET_Typing
],\
1164 iwt
->iwt_StatusBarMembers
[STATUSBARGADGET_StatusText
], \
1165 iwt
->iwt_StatusBarMembers
[STATUSBARGADGET_ShowAll
]));
1167 d1(KPrintF("%s/%s/%ld: GadgetHelp gg=%08lx\n", __FILE__
, __FUNC__
, __LINE__
));
1169 iInfos
.xii_GlobalGadgetUnderPointer
.ggd_GadgetID
= SGTT_GADGETID_unknown
;
1176 #if defined(IDCMP_EXTENDEDMOUSE)
1177 static ULONG
IDCMPExtendedMouse(struct internalScaWindowTask
*iwt
, struct IntuiMessage
*iMsg
)
1179 const struct IntuiWheelData
*iwd
;
1181 struct IntuiMessage imc
;
1183 d1(KPrintF("%s/%s/%ld: Class=%08lx Code=%04lx Qual=%04lx IAddress=%08lx\n", \
1184 __FILE__
, __FUNC__
, __LINE__
, iMsg
->Class
, iMsg
->Code
, iMsg
->Qualifier
, iMsg
->IAddress
));
1186 iwd
= (const struct IntuiWheelData
*) iMsg
->IAddress
;
1188 d1(KPrintF("%s/%s/%ld: WheelX=%ld WheelY=%ld\n", \
1189 __FILE__
, __FUNC__
, __LINE__
, iwd
->WheelX
, iwd
->WheelY
));
1191 imc
.Class
= IDCMP_RAWKEY
;
1192 imc
.Qualifier
= iMsg
->Qualifier
;
1193 imc
.IAddress
= NULL
;
1194 imc
.MouseX
= iMsg
->MouseX
;
1195 imc
.MouseY
= iMsg
->MouseY
;
1197 if (iwd
->WheelX
< 0)
1199 imc
.Code
= NM_WHEEL_LEFT
;
1200 for (n
= 0; n
< -iwd
->WheelX
; n
++)
1202 DoMethod(iwt
->iwt_WindowTask
.mt_MainObject
, SCCM_IconWin_RawKey
, &imc
);
1205 else if (iwd
->WheelX
> 0)
1207 imc
.Code
= NM_WHEEL_RIGHT
;
1208 for (n
= 0; n
< iwd
->WheelX
; n
++)
1210 DoMethod(iwt
->iwt_WindowTask
.mt_MainObject
, SCCM_IconWin_RawKey
, &imc
);
1213 if (iwd
->WheelY
< 0)
1215 imc
.Code
= NM_WHEEL_UP
;
1216 for (n
= 0; n
< -iwd
->WheelY
; n
++)
1218 DoMethod(iwt
->iwt_WindowTask
.mt_MainObject
, SCCM_IconWin_RawKey
, &imc
);
1221 else if (iwd
->WheelY
> 0)
1223 imc
.Code
= NM_WHEEL_DOWN
;
1224 for (n
= 0; n
< iwd
->WheelY
; n
++)
1226 DoMethod(iwt
->iwt_WindowTask
.mt_MainObject
, SCCM_IconWin_RawKey
, &imc
);
1232 #endif //defined(IDCMP_EXTENDEDMOUSE)
1235 static void ArrowRight(struct internalScaWindowTask
*iwt
, struct IntuiMessage
*iMsg
)
1239 if (iMsg
->Qualifier
& (IEQUALIFIER_LSHIFT
| IEQUALIFIER_RSHIFT
))
1242 // deltaX = (iwt->iwt_InnerWidth + 11) / 12;
1245 DoMethod(iwt
->iwt_WindowTask
.mt_MainObject
, SCCM_IconWin_DeltaMove
, deltaX
, 0);
1246 DoMethod(iwt
->iwt_WindowTask
.mt_MainObject
, SCCM_IconWin_SetVirtSize
, SETVIRTF_AdjustBottomSlider
);
1250 static void ArrowLeft(struct internalScaWindowTask
*iwt
, struct IntuiMessage
*iMsg
)
1254 if (iMsg
->Qualifier
& (IEQUALIFIER_LSHIFT
| IEQUALIFIER_RSHIFT
))
1257 // deltaX = -(iwt->iwt_InnerWidth + 11) / 12;
1260 DoMethod(iwt
->iwt_WindowTask
.mt_MainObject
, SCCM_IconWin_DeltaMove
, deltaX
, 0);
1261 DoMethod(iwt
->iwt_WindowTask
.mt_MainObject
, SCCM_IconWin_SetVirtSize
, SETVIRTF_AdjustBottomSlider
);
1265 static void ArrowDown(struct internalScaWindowTask
*iwt
, struct IntuiMessage
*iMsg
)
1269 if (iMsg
->Qualifier
& (IEQUALIFIER_LSHIFT
| IEQUALIFIER_RSHIFT
))
1272 // deltaY = (iwt->iwt_InnerHeight + 11) / 12;
1275 DoMethod(iwt
->iwt_WindowTask
.mt_MainObject
, SCCM_IconWin_DeltaMove
, 0, deltaY
);
1276 DoMethod(iwt
->iwt_WindowTask
.mt_MainObject
, SCCM_IconWin_SetVirtSize
, SETVIRTF_AdjustRightSlider
);
1280 static void ArrowUp(struct internalScaWindowTask
*iwt
, struct IntuiMessage
*iMsg
)
1284 if (iMsg
->Qualifier
& (IEQUALIFIER_LSHIFT
| IEQUALIFIER_RSHIFT
))
1287 // deltaY = -(iwt->iwt_InnerHeight + 11) / 12;
1290 DoMethod(iwt
->iwt_WindowTask
.mt_MainObject
, SCCM_IconWin_DeltaMove
, 0, deltaY
);
1291 DoMethod(iwt
->iwt_WindowTask
.mt_MainObject
, SCCM_IconWin_SetVirtSize
, SETVIRTF_AdjustRightSlider
);
1295 static void SetPropBottom(struct internalScaWindowTask
*iwt
)
1299 GetAttr(PGA_Top
, (Object
*) iwt
->iwt_PropBottom
, &Top
);
1301 Top
= (Top
<< iwt
->iwt_BottomScrollerScale
) + iwt
->iwt_MinX
;
1303 if (Top
!= iwt
->iwt_WindowTask
.wt_XOffset
)
1305 if (ScalosAttemptLockIconListShared(iwt
))
1307 DoMethod(iwt
->iwt_WindowTask
.mt_MainObject
, SCCM_IconWin_DeltaMove
, Top
- iwt
->iwt_WindowTask
.wt_XOffset
, 0);
1308 DoMethod(iwt
->iwt_WindowTask
.mt_MainObject
, SCCM_IconWin_SetVirtSize
, 0);
1309 ScalosUnLockIconList(iwt
);
1313 struct SM_DeltaMove
*smdm
;
1315 smdm
= (struct SM_DeltaMove
*) SCA_AllocMessage(MTYP_DeltaMove
, 0);
1319 smdm
->smdm_DeltaX
= Top
- iwt
->iwt_WindowTask
.wt_XOffset
;
1320 smdm
->smdm_DeltaY
= 0;
1321 smdm
->smdm_AdjustSlider
= 0;
1323 PutMsg(iwt
->iwt_WindowTask
.mt_WindowStruct
->ws_MessagePort
, &smdm
->ScalosMessage
.sm_Message
);
1330 static void SetPropSide(struct internalScaWindowTask
*iwt
)
1334 GetAttr(PGA_Top
, (Object
*) iwt
->iwt_PropSide
, &Top
);
1336 Top
= (Top
<< iwt
->iwt_SideScrollerScale
) + iwt
->iwt_MinY
;
1338 if (Top
!= iwt
->iwt_WindowTask
.wt_YOffset
)
1340 if (ScalosAttemptLockIconListShared(iwt
))
1342 DoMethod(iwt
->iwt_WindowTask
.mt_MainObject
, SCCM_IconWin_DeltaMove
, 0, Top
- iwt
->iwt_WindowTask
.wt_YOffset
);
1343 DoMethod(iwt
->iwt_WindowTask
.mt_MainObject
, SCCM_IconWin_SetVirtSize
, 0);
1344 ScalosUnLockIconList(iwt
);
1348 struct SM_DeltaMove
*smdm
;
1350 smdm
= (struct SM_DeltaMove
*) SCA_AllocMessage(MTYP_DeltaMove
, 0);
1354 smdm
->smdm_DeltaX
= 0;
1355 smdm
->smdm_DeltaY
= Top
- iwt
->iwt_WindowTask
.wt_YOffset
;
1356 smdm
->smdm_AdjustSlider
= 0;
1358 PutMsg(iwt
->iwt_WindowTask
.mt_WindowStruct
->ws_MessagePort
, &smdm
->ScalosMessage
.sm_Message
);
1365 static void MousePress(struct internalScaWindowTask
*iwt
, struct IntuiMessage
*iMsg
)
1367 d1(KPrintF("%s/%s/%ld: START iwt_MoveGadId=%ld\n", __FILE__
, __FUNC__
, __LINE__
, iwt
->iwt_MoveGadId
));
1369 if (VGADGETID_IDLE
== iwt
->iwt_MoveGadId
)
1371 struct ScaIconNode
*in
;
1375 SCA_ScreenTitleMsg(NULL
, NULL
);
1377 if (ScalosAttemptLockIconListShared(iwt
))
1379 d1(KPrintF("%s/%s/%ld: \n", __FILE__
, __FUNC__
, __LINE__
));
1381 in
= CheckMouseIcon(&iwt
->iwt_WindowTask
.wt_IconList
, iwt
,
1382 iMsg
->MouseX
- iwt
->iwt_InnerLeft
+ iwt
->iwt_WindowTask
.wt_XOffset
,
1383 iMsg
->MouseY
- iwt
->iwt_InnerTop
+ iwt
->iwt_WindowTask
.wt_YOffset
);
1385 d1(KPrintF("%s/%s/%ld: in=%08lx\n", __FILE__
, __FUNC__
, __LINE__
, in
));
1388 struct ExtGadget
*gg
= (struct ExtGadget
*) in
->in_Icon
;
1389 struct ExtGadget
*ggLast
= (struct ExtGadget
*) iwt
->iwt_LastIcon
;
1392 && gg
->LeftEdge
== iwt
->iwt_LastPos
.X
1393 && gg
->TopEdge
== iwt
->iwt_LastPos
.Y
1394 && DoubleClick(iwt
->iwt_LastTime
.tv_secs
, iwt
->iwt_LastTime
.tv_micro
,
1395 iMsg
->Seconds
, iMsg
->Micros
))
1397 // double-click on icon
1398 iwt
->iwt_LastIcon
= NULL
;
1400 d1(KPrintF("%s/%s/%ld: double-click on icon\n", __FILE__
, __FUNC__
, __LINE__
));
1402 // icon doesn' stay selected after double click
1403 OldIconsOff(iwt
, NULL
, iwt
->iwt_WindowTask
.wt_XOffset
,
1404 iwt
->iwt_WindowTask
.wt_YOffset
, iMsg
->Qualifier
, CurrentPrefs
.pref_EasyMultiselectFlag
);
1406 ScalosUnLockIconList(iwt
);
1409 DoMethod(iwt
->iwt_WindowTask
.mt_MainObject
, SCCM_IconWin_Open
, in
, 0L);
1415 d1(KPrintF("%s/%s/%ld: iwt=%08lx <%s> wt_Window=%08lx\n", \
1416 __FILE__
, __FUNC__
, __LINE__
, iwt
, iwt
->iwt_WinTitle
, iwt
->iwt_WindowTask
.wt_Window
));
1418 if (CurrentPrefs
.pref_EasyMultiselectFlag
|| (iMsg
->Qualifier
& (IEQUALIFIER_LSHIFT
| IEQUALIFIER_RSHIFT
)))
1420 // +jl+ 20010318 toggle selection
1421 select
= !(gg
->Flags
& GFLG_SELECTED
);
1424 if (!CurrentPrefs
.pref_EasyMultiselectFlag
)
1426 OldIconsOff(iwt
, in
->in_Icon
, iwt
->iwt_WindowTask
.wt_XOffset
,
1427 iwt
->iwt_WindowTask
.wt_YOffset
, iMsg
->Qualifier
, CurrentPrefs
.pref_EasyMultiDragFlag
);
1430 ClassSelectIcon(iwt
->iwt_WindowTask
.mt_WindowStruct
, in
, select
);
1431 AdjustIconActive(iwt
);
1433 iwt
->iwt_LastIcon
= in
->in_Icon
;
1435 iwt
->iwt_LastPos
.X
= gg
->LeftEdge
;
1436 iwt
->iwt_LastPos
.Y
= gg
->TopEdge
;
1438 iwt
->iwt_LastTime
.tv_secs
= iMsg
->Seconds
;
1439 iwt
->iwt_LastTime
.tv_micro
= iMsg
->Micros
;
1441 iwt
->iwt_OldMouse
.X
= iMsg
->MouseX
;
1442 iwt
->iwt_OldMouse
.Y
= iMsg
->MouseY
;
1444 iwt
->iwt_MoveGadId
= VGADGETID_WAITFORDRAG
;
1445 ModifyIDCMP(iwt
->iwt_WindowTask
.wt_Window
, iwt
->iwt_IDCMPFlags
| IDCMP_MOUSEMOVE
);
1447 ScalosUnLockIconList(iwt
);
1453 struct Region
*oldClipRegion
;
1455 iwt
->iwt_LastIcon
= NULL
;
1457 d1(KPrintF("%s/%s/%ld: \n", __FILE__
, __FUNC__
, __LINE__
));
1459 oldClipRegion
= (struct Region
*) DoMethod(iwt
->iwt_WindowTask
.mt_WindowObject
, SCCM_Window_InitClipRegion
);
1461 OldIconsOff(iwt
, NULL
, iwt
->iwt_WindowTask
.wt_XOffset
,
1462 iwt
->iwt_WindowTask
.wt_YOffset
, iMsg
->Qualifier
, CurrentPrefs
.pref_EasyMultiselectFlag
);
1464 DoMethod(iwt
->iwt_WindowTask
.mt_WindowObject
, SCCM_Window_RemClipRegion
, oldClipRegion
);
1466 iwt
->iwt_MoveGadId
= VGADGETID_LASSO
;
1468 ModifyIDCMP(iwt
->iwt_WindowTask
.wt_Window
, iwt
->iwt_IDCMPFlags
| IDCMP_INTUITICKS
| IDCMP_MOUSEMOVE
);
1470 iwt
->iwt_LockFlag
= TRUE
;
1471 iwt
->iwt_WindowTask
.mt_WindowStruct
->ws_Flags
|= WSV_FlagF_NeedsTimerMsg
;
1473 iwt
->iwt_OldMouse
.X
= iMsg
->MouseX
;
1474 iwt
->iwt_OldMouse
.Y
= iMsg
->MouseY
;
1476 ScalosUnLockIconList(iwt
);
1481 d1(KPrintF("%s/%s/%ld: END\n", __FILE__
, __FUNC__
, __LINE__
));
1485 static void MouseRelease(struct internalScaWindowTask
*iwt
, struct IntuiMessage
*iMsg
)
1487 d1(KPrintF( "%s/%s/%ld: START iwt_MoveGadId=%ld\n", __FILE__
, __FUNC__
, __LINE__
, iwt
->iwt_MoveGadId
));
1489 if (iwt
->iwt_MoveGadId
)
1491 BOOL DragDrop
= FALSE
;
1492 T_TIMEVAL ClickDelay
;
1494 ModifyIDCMP(iwt
->iwt_WindowTask
.wt_Window
, iwt
->iwt_IDCMPFlags
);
1496 switch (iwt
->iwt_MoveGadId
)
1498 case VGADGETID_WAITFORDRAG
:
1499 d1(KPrintF( "%s/%s/%ld: VGADGETID_WAITFORDRAG\n", __FILE__
, __FUNC__
, __LINE__
));
1502 case VGADGETID_DRAGMOUSEMOVE
:
1505 ClickDelay
.tv_secs
= iMsg
->Seconds
- iwt
->iwt_LastTime
.tv_secs
;
1506 ClickDelay
.tv_micro
= iMsg
->Micros
- iwt
->iwt_LastTime
.tv_micro
;
1507 if (iMsg
->Micros
< iwt
->iwt_LastTime
.tv_micro
)
1509 ClickDelay
.tv_micro
+= 1000000;
1510 ClickDelay
.tv_secs
+= 1;
1513 if (((ClickDelay
.tv_secs
> CurrentPrefs
.pref_ClickDelay
.tv_secs
) ||
1514 (((ClickDelay
.tv_secs
== CurrentPrefs
.pref_ClickDelay
.tv_secs
) && (ClickDelay
.tv_micro
> CurrentPrefs
.pref_ClickDelay
.tv_micro
))
1515 && (iwt
->iwt_OldMouse
.X
!= iMsg
->MouseX
|| iwt
->iwt_OldMouse
.Y
!= iMsg
->MouseY
))))
1517 struct Layer
*MouseLayer
;
1519 MouseLayer
= WhichLayer(iwt
->iwt_WindowTask
.wt_Window
->WLayer
->LayerInfo
,
1520 iMsg
->MouseX
+ iwt
->iwt_WindowTask
.wt_Window
->LeftEdge
,
1521 iMsg
->MouseY
+ iwt
->iwt_WindowTask
.wt_Window
->TopEdge
);
1523 if (MouseLayer
&& MouseLayer
->Window
)
1526 DoMethod(iwt
->iwt_WindowTask
.mt_MainObject
, SCCM_IconWin_DragDrop
,
1527 MouseLayer
->Window
, iMsg
->MouseX
, iMsg
->MouseY
, iMsg
->Qualifier
);
1533 IconWin_EndDrag(iwt
);
1534 RestoreDragIcons(iwt
);
1540 case VGADGETID_LASSO
:
1541 d1(KPrintF( "%s/%s/%ld: VGADGETID_LASSO\n", __FILE__
, __FUNC__
, __LINE__
));
1543 d1(KPrintF( "%s/%s/%ld: \n", __FILE__
, __FUNC__
, __LINE__
));
1545 d1(KPrintF( "%s/%s/%ld: \n", __FILE__
, __FUNC__
, __LINE__
));
1548 iwt
->iwt_MoveGadId
= VGADGETID_IDLE
;
1549 iwt
->iwt_LockFlag
= FALSE
;
1551 if (!iwt
->iwt_NeedsTimerFlag
)
1552 iwt
->iwt_WindowTask
.mt_WindowStruct
->ws_Flags
&= ~WSV_FlagF_NeedsTimerMsg
;
1554 d1(KPrintF( "%s/%s/%ld: END\n", __FILE__
, __FUNC__
, __LINE__
));
1558 void AbortFunctions(struct internalScaWindowTask
*iwt
)
1560 d1(kprintf("%s/%s/%ld: iwt_MoveGadId=%ld\n", __FILE__
, __FUNC__
, __LINE__
, iwt
->iwt_MoveGadId
));
1562 switch (iwt
->iwt_MoveGadId
)
1564 case VGADGETID_DRAGMOUSEMOVE
:
1565 ClosePopupWindows(TRUE
);
1567 IconWin_EndDrag(iwt
);
1568 RestoreDragIcons(iwt
);
1572 if (iwt
->iwt_LastIcon
)
1574 ClassSelectIconObj(iwt
->iwt_WindowTask
.mt_WindowStruct
, iwt
->iwt_LastIcon
, FALSE
);
1575 iwt
->iwt_LastIcon
= NULL
;
1579 case VGADGETID_LASSO
:
1587 iwt
->iwt_MoveGadId
= VGADGETID_IDLE
;
1588 iwt
->iwt_LockFlag
= FALSE
;
1590 if (iwt
->iwt_NeedsTimerFlag
)
1591 iwt
->iwt_WindowTask
.mt_WindowStruct
->ws_Flags
&= ~WSV_FlagF_NeedsTimerMsg
;
1593 AdjustIconActive(iwt
);
1596 d1(kprintf("%s/%s/%ld: END\n", __FILE__
, __FUNC__
, __LINE__
));
1600 void RemoveDeviceIcon(struct internalScaWindowTask
*iwt
, struct ScaDeviceIcon
*di
,
1601 struct ScaIconNode
**DeleteableIconList
)
1603 struct ScaIconNode
*in
, *inNext
;
1605 ScalosLockIconListExclusive(iwt
);
1607 d1(kprintf("%s/%s/%ld: Remove DeviceIcon <%s>\n", __FILE__
, __FUNC__
, __LINE__
, di
->di_Device
));
1611 struct ScaIconNode
*in
;
1613 kprintf("%s/%s/%ld: --------start----------\n", __FILE__
, __FUNC__
, __LINE__
);
1615 for (in
=iwt
->iwt_WindowTask
.wt_IconList
; in
; in
=(struct ScaIconNode
*) in
->in_Node
.mln_Succ
)
1616 kprintf("%s/%s/%ld: in=%08lx <%s>\n", __FILE__
, __FUNC__
, __LINE__
, in
, GetIconName(in
));
1618 kprintf("%s/%s/%ld: ---------end----------\n", __FILE__
, __FUNC__
, __LINE__
);
1621 d1(kprintf("%s/%s/%ld:\n", __FILE__
, __FUNC__
, __LINE__
));
1623 for (in
= iwt
->iwt_WindowTask
.wt_IconList
; in
; in
= inNext
)
1625 inNext
= (struct ScaIconNode
*) in
->in_Node
.mln_Succ
;
1627 if (in
->in_Icon
== di
->di_Icon
)
1629 struct ScaBackdropIcon
*sbi
;
1631 d1(kprintf("%s/%s/%ld: Found in=%08lx <%s>\n", __FILE__
, __FUNC__
, __LINE__
, in
, GetIconName(in
)));
1632 d1(kprintf("%s/%s/%ld: innext=%08lx IconList=%08lx\n", __FILE__
, __FUNC__
, __LINE__
, inNext
, in
->in_IconList
));
1634 SCA_MoveIconNode(&iwt
->iwt_WindowTask
.wt_IconList
, DeleteableIconList
, in
);
1636 for (sbi
=in
->in_IconList
; sbi
; sbi
= (struct ScaBackdropIcon
*) sbi
->sbi_Node
.mln_Succ
)
1638 struct ScaIconNode
*in2
, *in2Next
;
1640 d1(kprintf("%s/%s/%ld: sbi=%08lx\n", __FILE__
, __FUNC__
, __LINE__
, sbi
));
1642 for (in2
=iwt
->iwt_WindowTask
.wt_IconList
; in2
; in2
=in2Next
)
1644 in2Next
= (struct ScaIconNode
*) in2
->in_Node
.mln_Succ
;
1646 if (in2
->in_Icon
== sbi
->sbi_Icon
)
1648 // move <in2> to <DeleteableIconList>
1649 d1(kprintf("%s/%s/%ld: in2next=%08lx\n", __FILE__
, __FUNC__
, __LINE__
, in2Next
));
1652 inNext
= (struct ScaIconNode
*) in2
->in_Node
.mln_Succ
;
1654 d1(kprintf("%s/%s/%ld: Found in2=%08lx <%s>\n", __FILE__
, __FUNC__
, __LINE__
, in2
, GetIconName(in2
)));
1655 SCA_MoveIconNode(&iwt
->iwt_WindowTask
.wt_IconList
, DeleteableIconList
, in2
);
1661 in
->in_DeviceIcon
= NULL
;
1663 d1(kprintf("%s/%s/%ld: \n", __FILE__
, __FUNC__
, __LINE__
));
1665 FreeBackdropIconList(&in
->in_IconList
);
1667 DoMethod(iwt
->iwt_DevListObject
, SCCM_DeviceList_FreeDevNode
, di
);
1669 SCA_FreeNode((struct ScalosNodeList
*) &iwt
->iwt_DevIconList
, &di
->di_Node
);
1675 struct ScaIconNode
*in
;
1677 kprintf("%s/%s/%ld: --------start----------\n", __FILE__
, __FUNC__
, __LINE__
);
1679 for (in
=iwt
->iwt_WindowTask
.wt_IconList
; in
; in
=(struct ScaIconNode
*) in
->in_Node
.mln_Succ
)
1680 kprintf("%s/%s/%ld: in=%08lx <%s>\n", __FILE__
, __FUNC__
, __LINE__
, in
, GetIconName(in
));
1682 kprintf("%s/%s/%ld: ---------end----------\n", __FILE__
, __FUNC__
, __LINE__
);
1685 ScalosUnLockIconList(iwt
);
1689 static void OldIconsOff(struct internalScaWindowTask
*iwt
, Object
*IconObj
,
1690 LONG XOffset
, LONG YOffset
, UWORD Qualifier
, BOOL KeepSelected
)
1692 struct ExtGadget
*gg
= (struct ExtGadget
*) IconObj
;
1693 struct ScaWindowStruct
*ws
;
1695 d1(KPrintF("%s/%s/%ld: START\n", __FILE__
, __FUNC__
, __LINE__
));
1697 if (Qualifier
& (IEQUALIFIER_LSHIFT
| IEQUALIFIER_RSHIFT
))
1700 if (KeepSelected
&& gg
&& (gg
->Flags
& GFLG_SELECTED
))
1703 d1(KPrintF("%s/%s/%ld: \n", __FILE__
, __FUNC__
, __LINE__
));
1705 SCA_LockWindowList(SCA_LockWindowList_Shared
);
1707 for (ws
=winlist
.wl_WindowStruct
; ws
; ws
= (struct ScaWindowStruct
*) ws
->ws_Node
.mln_Succ
)
1709 struct internalScaWindowTask
*iwtx
= (struct internalScaWindowTask
*) ws
->ws_WindowTask
;
1711 if (iwtx
->iwt_WindowTask
.wt_Window
)
1713 if (ScalosAttemptLockIconListShared(iwtx
))
1715 struct Region
*oldClipRegion
= NULL
;
1716 BOOL ClipRegionSet
= FALSE
;
1717 struct ScaIconNode
*in
;
1719 for (in
=iwtx
->iwt_WindowTask
.wt_IconList
; in
; in
= (struct ScaIconNode
*) in
->in_Node
.mln_Succ
)
1721 if (in
->in_Icon
!= IconObj
)
1725 oldClipRegion
= (struct Region
*) DoMethod(iwtx
->iwt_WindowTask
.mt_WindowObject
, SCCM_Window_InitClipRegion
);
1726 ClipRegionSet
= TRUE
;
1729 ClassSelectIcon(ws
, in
, FALSE
);
1734 DoMethod(iwtx
->iwt_WindowTask
.mt_WindowObject
, SCCM_Window_RemClipRegion
, oldClipRegion
);
1736 ScalosUnLockIconList(iwtx
);
1739 AdjustIconActive(iwtx
);
1742 SCA_UnLockWindowList();
1744 AdjustIconActive(iwt
);
1748 static LONG
SafeStrCmp(CONST_STRPTR str1
, CONST_STRPTR str2
)
1751 return strcmp(str1
, str2
);
1753 if (NULL
== str1
&& NULL
== str2
)
1760 static void IDCMPBeginDrag(struct internalScaWindowTask
*iwt
, struct IntuiMessage
*iMsg
)
1762 d1(KPrintF("%s/%s/%ld: START\n", __FILE__
, __FUNC__
, __LINE__
));
1764 if (abs(iwt
->iwt_OldMouse
.X
- iMsg
->MouseX
) +
1765 abs(iwt
->iwt_OldMouse
.Y
- iMsg
->MouseY
) > 2)
1767 // mouse has been moved with LMB pressed, so we assume user wants to start dragging an icon
1768 d1(KPrintF("%s/%s/%ld: mouse moved\n", __FILE__
, __FUNC__
, __LINE__
));
1770 if (ScalosAttemptLockIconListExclusive(iwt
))
1772 struct ScaIconNode
*in
;
1774 in
= CheckMouseIcon(&iwt
->iwt_WindowTask
.wt_IconList
, iwt
,
1775 iwt
->iwt_OldMouse
.X
- iwt
->iwt_InnerLeft
+ iwt
->iwt_WindowTask
.wt_XOffset
,
1776 iwt
->iwt_OldMouse
.Y
- iwt
->iwt_InnerTop
+ iwt
->iwt_WindowTask
.wt_YOffset
);
1778 d1(KPrintF("%s/%s/%ld: in=%08lx\n", __FILE__
, __FUNC__
, __LINE__
, in
));
1781 struct ExtGadget
*gg
= (struct ExtGadget
*) in
->in_Icon
;
1783 d1(KPrintF("%s/%s/%ld: SelectRender=%08lx\n", __FILE__
, __FUNC__
, __LINE__
, gg
->SelectRender
));
1784 if (gg
->SelectRender
)
1786 iwt
->iwt_MoveGadId
= VGADGETID_DRAGMOUSEMOVE
;
1787 d1(kprintf("%s/%s/%ld: \n", __FILE__
, __FUNC__
, __LINE__
));
1789 ModifyIDCMP(iwt
->iwt_WindowTask
.wt_Window
, iwt
->iwt_IDCMPFlags
| IDCMP_INTUITICKS
| IDCMP_MOUSEMOVE
);
1791 iwt
->iwt_LockFlag
= TRUE
;
1792 iwt
->iwt_WindowTask
.mt_WindowStruct
->ws_Flags
|= WSV_FlagF_NeedsTimerMsg
;
1794 iwt
->iwt_DragFlags
= 0;
1796 InitDrag(iMsg
, iwt
);
1798 // Keep icon list locked (ahared!) until EndDrag()
1799 ScalosUnLockIconList(iwt
);
1800 ScalosLockIconListShared(iwt
);
1804 ScalosUnLockIconList(iwt
);
1809 // no icon present, leave VGADGETID_WAITFORDRAG state
1810 iwt
->iwt_MoveGadId
= VGADGETID_IDLE
;
1811 ScalosUnLockIconList(iwt
);
1815 d1(KPrintF("%s/%s/%ld: END\n", __FILE__
, __FUNC__
, __LINE__
));