home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
basic
/
library
/
tb
/
mousetb
/
mousebox.inc
< prev
next >
Wrap
Text File
|
1993-07-29
|
11KB
|
390 lines
'┌────────────────────────────────────────────────────────────────────────────┐
'│ MOUSEBOX.INC, Version 1.1 │
'│ Routinen zur Unterstützung der Microsoft Maus │
'│ (oder einer hierzu kompatiblen Maus) │
'├────────────────────────────────────────────────────────────────────────────┤
'│ Copyright (c) 1988,89, 90 by Ralf Krause │
'│ Leuchtenberger Str. 7a, D-8480 Weiden i. d. Opf. │
'├────────────────────────────────────────────────────────────────────────────┤
'│ Prozeduren/Funktionen und deren Syntax: │
'│ │
'│ InitMouse a = FN InitMouse │
'│ ResetMouse CALL ResetMouse │
'│ ShowCursor CALL ShowCursor │
'│ HideCursor CALL HideCursor │
'│ GetXPosition x = FN GetXPosition │
'│ GetYPosition y = FN GetYPosition │
'│ GetXTextPosition x = FN GetXTextPosition │
'│ GetYTextPosition y = FN GetYTextPosition │
'│ LeftButton a = FN LeftButton │
'│ RightButton a = FN RightButton │
'│ MiddleButton a = FN MiddleButton │
'│ MouseMoved a = FN MouseMoved │
'│ MouseLeftMoved a = FN MouseLeftMoved │
'│ MouseRightMoved a = FN MouseRightMoved │
'│ MouseUpMoved a = FN MouseUpMoved │
'│ MouseDownMoved a = FN MouseDownMoved │
'│ SetXYMouse CALL SetXYMouse(x, y) │
'│ LeftButtonPressed a = FN LeftButtonPressed │
'│ RightButtonPressed a = FN RightButtonPressed │
'│ MiddleButtonPressed a = FN MiddleButtonPressed │
'│ LeftButtonReleased a = FN LeftButtonReleased │
'│ RightButtonReleased a = FN RightButtonReleased │
'│ MiddleButtonReleased a = FN MiddleButtonReleased │
'│ SetXRange CALL SetXRange(x) │
'│ SetYRange CALL SetYRange(y) │
'│ SetGraphicCursor CALL SetGraphicCursor(Cursor%(),_ │
'│ XHotSpot%, YHotSpot%) │
'│ SetTextCursor CALL SetTextCursor(Typ%, TextScreenMask%,_ │
'│ TextCursorMask%) │
'│ GetXMickey x = FN GetXMickey │
'│ GetYMickey y = FN GetYMickey │
'│ SetXYMickey CALL SetXYMickey(x, y) │
'│ SetMouseSpeed CALL SetMouseSpeed(s) │
'│ │
'└────────────────────────────────────────────────────────────────────────────┘
DEFINT i
%MouseIntr = &H33 ' Mouse-Interrupt
'
' InitMouse --> Maustreiber initialisieren
'
DEF FN InitMouse
REG 1, 0
CALL INTERRUPT %MouseIntr
IF REG(1) = - 1 THEN
FN InitMouse = - 1 ' Mouse-Treiber vorhanden
ELSE
FN InitMouse = 0 ' Mouse-Treiber nicht vorhanden
END IF
END DEF
'
' ResetMouse --> Maustreiber zurücksetzen
'
SUB ResetMouse
REG 1, 0
CALL INTERRUPT %MouseIntr
END SUB
'
' ShowCursor --> Mauscursor einschalten
'
SUB ShowCursor
REG 1, 1
CALL INTERRUPT %MouseIntr
END SUB
'
' HideCursor --> Mauscursor ausschalten
'
SUB HideCursor
REG 1, 2
CALL INTERRUPT %MouseIntr
END SUB
'
' FN GetXPosition --> ermittelt horizontale X-Position,
'
DEF FN GetXPosition
REG 1, 3
CALL INTERRUPT %MouseIntr
FN GetXPosition = REG(3)
END DEF
'
' FN GetYPosition --> ermittelt vertikale Y-Position,
'
DEF FN GetYPosition
REG 1, 3
CALL INTERRUPT %MouseIntr
FN GetYPosition = REG(4)
END DEF
'
' FN GetXTextPosition --> ermittelt horizontale X-Position, es werden
' Werte zwischen 1 und 80 zurückgegeben
'
DEF FN GetXTextPosition
REG 1, 3
CALL INTERRUPT %MouseIntr
FN GetXTextPosition = (REG(3) + 8) \ 8
END DEF
'
' FN GetYTextPosition --> ermittelt vertikale Y-Position, es werden
' Werte zwischen 1 und 25 zurückgegeben
'
DEF FN GetYTextPosition
REG 1, 3
CALL INTERRUPT %MouseIntr
FN GetYTextPosition = (REG(4) + 8) \ 8
END DEF
'
' FN LeftButton --> testet ob die linke Taste gedrückt ist
'
DEF FN LeftButton
REG 1, 5
REG 2, 0
CALL INTERRUPT %MouseIntr
IF (REG(1) = 1) THEN
FN LeftButton = -1
ELSE
FN LeftButton = 0
END IF
END DEF
'
' FN RightButton --> testet ob die rechte Taste gedrückt ist
'
DEF FN RightButton
REG 1, 5
REG 2, 1
CALL INTERRUPT %MouseIntr
IF (REG(1) = 2) THEN
FN RightButton = -1
ELSE
FN RightButton = 0
END IF
END DEF
'
' FN MiddleButton --> testet ob die mittlere Taste gedrückt ist
'
DEF FN MiddleButton
REG 1, 5
REG 2, 2
CALL INTERRUPT %MouseIntr
IF (REG(1) = 3) THEN
FN MiddleButton = -1
ELSE
FN MiddleButton = 0
END IF
END DEF
'
' FN MouseMoved --> testet ob die Mouse bewegt wurde
'
DEF FN MouseMoved
REG 1, 11
CALL INTERRUPT %MouseIntr
IF (REG(3) <> 0) OR (REG(4) <> 0) THEN
FN MouseMoved = -1
ELSE
FN MouseMoved = 0
END IF
END DEF
'
' FN MouseLeftMoved --> testet ob die Mouse nach links bewegt wurde
'
DEF FN MouseLeftMoved
REG 1, 11
CALL INTERRUPT %MouseIntr
IF (REG(3) < 0) THEN
FN MouseLeftMoved = -1
ELSE
FN MouseLeftMoved = 0
END IF
END DEF
'
' FN MouseRightMoved --> testet ob die Mouse nach rechts bewegt wurde
'
DEF FN MouseRightMoved
REG 1, 11
CALL INTERRUPT %MouseIntr
IF (REG(3) > 0) THEN
FN MouseRightMoved = -1
ELSE
FN MouseRightMoved = 0
END IF
END DEF
'
' FN MouseUpMoved --> testet ob die Mouse nach oben bewegt wurde
'
DEF FN MouseUpMoved
REG 1, 11
CALL INTERRUPT %MouseIntr
IF (REG(4) < 0) THEN
FN MouseUpMoved = -1
ELSE
FN MouseUpMoved = 0
END IF
END DEF
'
' FN MouseDownMoved --> testet ob die Mouse nach unten bewegt wurde
'
DEF FN MouseDownMoved
REG 1, 11
CALL INTERRUPT %MouseIntr
IF (REG(4) > 0) THEN
FN MouseDownMoved = -1
ELSE
FN MouseDownMoved = 0
END IF
END DEF
'
' SetXYMouse --> Mauscursor positionieren
'
SUB SetXYMouse(iX,iY)
REG 1, 4
REG 3, iX
REG 4, iY
CALL INTERRUPT %MouseIntr
END SUB
'
' LeftButtonPressed --> ermittelt wie oft die linke Mouse-Taste
' seit der letzten Abfrage gedrückt wurde
'
DEF FN LeftButtonPressed
REG 1, 5
REG 2, 0
CALL INTERRUPT %MouseIntr
FN LeftButtonPressed = REG(2)
END DEF
'
' RightButtonPressed --> ermittelt wie oft die rechte Mouse-Taste
' seit der letzten Abfrage gedrückt wurde
'
DEF FN RightButtonPressed
REG 1, 5
REG 2, 1
CALL INTERRUPT %MouseIntr
FN RightButtonPressed = REG(2)
END DEF
'
' MiddleButtonPressed --> ermittelt wie oft die mittlere Mouse-Taste
' seit der letzten Abfrage gedrückt wurde
'
DEF FN MiddleButtonPressed
REG 1, 5
REG 2, 2
CALL INTERRUPT %MouseIntr
FN MiddleButtonPressed = REG(2)
END DEF
'
' LeftButtonReleased --> ermittelt wie oft die linke Mouse-Taste
' seit der letzten Abfrage losgelassen wurde
'
DEF FN LeftButtonReleased
REG 1, 6
REG 2, 0
CALL INTERRUPT %MouseIntr
FN LeftButtonReleased = REG(2)
END DEF
'
' RightButtonReleased --> ermittelt wie oft die rechte Mouse-Taste
' seit der letzten Abfrage losgelassen wurde
'
DEF FN RightButtonReleased
REG 1, 6
REG 2, 1
CALL INTERRUPT %MouseIntr
FN RightButtonReleased = REG(2)
END DEF
'
' MiddleButtonReleased --> ermittelt wie oft die mittlere Mouse-Taste
' seit der letzten Abfrage losgelassen wurde
'
DEF FN MiddleButtonReleased
REG 1, 6
REG 2, 2
CALL INTERRUPT %MouseIntr
FN MiddleButtonReleased = REG(2)
END DEF
'
' SetXRange --> minimale und maximale X-Position setzen
'
SUB SetXRange(iXMin, iXMax)
REG 1, 7
REG 3, iXMin
REG 4, iXMax
CALL INTERRUPT %MouseIntr
END SUB
'
' SetYRange --> minimale und maximale Y-Position setzen
'
SUB SetYRange(iYMin, iYMax)
REG 1, 8
REG 3, iYMin
REG 4, iYMax
CALL INTERRUPT %MouseIntr
END SUB
'
' SetGraphicCursor --> Graphic Cursor definieren
'
SUB SetGraphicCursor(iGraphicCursor(2), iXHotSpot, iYHotSpot)
REG 1, 9
REG 2, iXHotSpot
REG 3, iYHotSpot
REG 4, VARPTR(iGraphicCursor(0,0))
REG 9, VARSEG(iGraphicCursor(0,0))
CALL INTERRUPT %MouseIntr
END SUB
'
' SetTextCursor --> Text Cursor definieren
'
SUB SetTextCursor(iCursorType, iTextScreenMask, iTextCursorMask)
REG 1, 10
REG 2, iCursorType
REG 3, iTextScreenMask
REG 4, iTextCursorMask
CALL INTERRUPT %MouseIntr
END SUB
'
' FN GetXMickey --> horizontalen Mausbewegungs-(Mickey-)Zähler lesen
'
DEF FN GetXMickey
REG 1, 11
CALL INTERRUPT %MouseIntr
FN GetXMickey = REG(3)
END DEF
'
' FN GetYMickey --> vertikalen Mausbewegungs-(Mickey-)Zähler lesen
'
DEF FN GetYMickey
REG 1, 11
CALL INTERRUPT %MouseIntr
FN GetYMickey = REG(4)
END DEF
'
' SetXYMickey --> horizontale und vertikale Mickey-Einheit definieren
'
SUB SetXYMickey(iXMickey, iYMickey)
REG 1, 15
REG 3, iXMickey
REG 4, iYMickey
CALL INTERRUPT %MouseIntr
END SUB
'
' SetMouseSpeed --> Schwellenwert für doppelte Cursor-Geschwindigkeit in
' Mickeys/Sekunde festlegen
'
SUB SetMouseSpeed(iSpeed)
REG 1, 19
REG 4, iSpeed
CALL INTERRUPT %MouseIntr
END SUB
'──────────────────────────────────────────────────────────────────────────────