home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
372.lha
/
PopUpMenu_3.2
/
Source
/
InputHandler.a
< prev
next >
Wrap
Text File
|
1990-05-06
|
4KB
|
141 lines
INCLUDE "exec/types.i"
INCLUDE "intuition/intuition.i"
INCLUDE "intuition/screens.i"
INCLUDE "devices/inputevent.i"
INCLUDE "PopUpMenu.i"
QUALIFIERS EQU IEQUALIFIER_LSHIFT+IEQUALIFIER_RSHIFT+IEQUALIFIER_CONTROL+IEQUALIFIER_LALT+IEQUALIFIER_RALT+IEQUALIFIER_LCOMMAND+IEQUALIFIER_RCOMMAND+IEQUALIFIER_MIDBUTTON+IEQUALIFIER_LEFTBUTTON
_LVOSignal EQU -$144
AbsExecBase EQU 4
FALSE EQU 0
TRUE EQU 1
xdef @PopUpHandler
xref _IntuitionBase
section text,code
@PopUpHandler: MOVEM.L D2/A2-A6,-(A7)
MOVEA.L A0,A3 *A3 = Events
MOVEA.L A1,A2 *A2 = MySignals
MOVEA.L A3,A4 *A4 = Event
SUB.L A5,A5 *A5 = LastEvent
MOVEA.L AbsExecBase.W,A6
MOVE.W sd_Down(A2),D2
BEQ.B NoMoveSignal
* ------------ Tell the task we are living.
MOVEA.L (A2),A1 *sd_PopUpMenuTask
MOVE.L sd_MouseMovedSig(A2),D0
JSR _LVOSignal(A6)
* ------------ No more events ?
NoMoveSignal:
MoreEvents: MOVE.L A4,D0
BEQ.W Done
* ------------ Mouseevent ?
MOVEQ.L #IECLASS_RAWMOUSE,D0
CMP.B ie_Class(A4),D0
BNE.W KeepEvent * Don't care about this message.
MOVE.W ie_Code(A4),D1
* ------------ Is menubutton already pressed.
TST.W D2
BNE.B MouseIsDown * Yes
* ------------ Menubutton pressed ?
MOVEQ.L #MENUDOWN,D0
CMP.W D1,D0
BNE.B KeepEvent * No
* ------------ Is any qualifierkey also pressed ?
MOVE.W #QUALIFIERS,D0
AND.W ie_Qualifier(A4),D0
BNE.B KeepEvent * Yes
* ------------ Is any screen active ?
MOVEA.L _IntuitionBase,A1
MOVEA.L ib_ActiveScreen(A1),A0
MOVE.L A0,D0
BEQ.B KeepEvent * No
* ------------ Is the mouse in the titlebar ?
MOVE.B sc_BarHeight(A0),D0
EXT.W D0
CMP.W sc_MouseY(A0),D0
BGT.B KeepEvent * Yes
* ------------ Is any window active ?
MOVEA.L ib_ActiveWindow(A1),A0
MOVE.L A0,D0
BEQ.B KeepEvent * No
* ------------ Is any requester blocking the window ?
TST.W wd_ReqCount(A0)
BNE.B KeepEvent * Yes
* ------------ Does the window have menues ?
TST.L wd_MenuStrip(A0)
BEQ.B KeepEvent * No
* ------------ Is the RMBTRAP flag set ?
MOVEQ.L #1,D0
AND.W wd_Flags(A0),D0
BNE.B KeepEvent * Yes
MOVEQ.L #TRUE,D2
* ------------ Tell task to popup the menues.
MOVE.L sd_MenuDownSig(A2),D0
BRA.B SigAndRemove
* ------------ Check out if the user has selected something.
MouseIsDown: CMPI.W #MENUUP,D1 *Is menubutton released ?
BNE.B 1$
MOVEQ.L #FALSE,D2
MOVE.L sd_MenuUpSig(A2),D0
BRA.B SigAndRemove
* ------------ Multiple select ?
1$: CMPI.W #SELECTDOWN,D1
BNE.B CheckSelUp
MOVE.L sd_SelectDownSig(A2),D0
SigAndRemove: MOVEA.L (A2),A1 *sd_PopUpMenuTask(A2)
JSR _LVOSignal(A6)
BRA.B RemoveEvent
* ------------ SELECTUP isn't used but remove the event anyway.
CheckSelUp: CMPI.W #SELECTUP,D1
BNE.B KeepEvent
* ------------ Remove the event from the list.
RemoveEvent: MOVE.L A5,D0 * First event in list ?
BNE.B 1$ * No
MOVEA.L (A4),A3 *ie_NextEvent(A4)
BRA.B NextEvent
1$: MOVE.L (A4),(A5) *ie_NextEvent(A4),ie_NextEvent(A5)
BRA.B NextEvent
* ------------ Keep this message.
KeepEvent: MOVE.L A4,A5
* ------------ Check out the next event.
NextEvent: MOVE.L (A4),A4 *ie_NextEvent(A4)
BRA.W MoreEvents
Done MOVE.W D2,sd_Down(A2)
MOVE.L A3,D0
MOVEM.L (A7)+,D2/A2-A6
RTS
END