4 ; Support code for dragging operations
6 ; © 1995-1998 Straylight
9 ;----- Licensing note -------------------------------------------------------
11 ; This file is part of Straylight's Sapphire library.
13 ; Sapphire is free software; you can redistribute it and/or modify
14 ; it under the terms of the GNU General Public License as published by
15 ; the Free Software Foundation; either version 2, or (at your option)
18 ; Sapphire is distributed in the hope that it will be useful,
19 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
20 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 ; GNU General Public License for more details.
23 ; You should have received a copy of the GNU General Public License
24 ; along with Sapphire. If not, write to the Free Software Foundation,
25 ; 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27 ;----- Overview -------------------------------------------------------------
38 [ :LNOT::DEF:drag__dfn
43 ; On entry: R0 == window containing the drag
44 ; R1 == flags word (see flags below)
45 ; R2 == pointer to drag routine
46 ; R3 == magic number to pass in R9
47 ; R4 == value to pass to routine in R10
48 ; R5 == value to pass to routine in R12
52 ; Use: Starts a drag operation. Any outstanding drag operation
53 ; is cancelled on the assumption that someone stole our
60 ; On entry: R1 == pointer to window state block
62 ; On exit: R2,R3 == new scroll positions to set
63 ; R14 == R1+20 (pointer to scroll offsets)
65 ; Use: Works out the scroll positions which should be set to auto-
66 ; scroll the window. The algorithm is simple: the window is
67 ; scrolled so that the point beneath the mouse pointer is
68 ; within the window's visible work area.
72 ; --- drag_setDash ---
74 ; On entry: R0 == dash pattern byte
78 ; Use: Sets the dash pattern to be the given value.
88 ; Use: Cancels the current drag operation.
94 ; On entry: R1 == pointer to redraw block
98 ; Use: Redraws the drag box, if the redraw takes place in the
99 ; currently dragging window.
103 ; --- drag_eorColour ---
105 ; On entry: R0 == colour A
110 ; Use: Sets the foreground colour to be an EOR colour such that
111 ; when painted over Wimp colour A, it appears as Wimp colour B.
113 IMPORT drag_eorColour
115 ;----- Flags ----------------------------------------------------------------
117 drFlag_noUpdate EQU (1<<0) ;Don't generate update events
119 ;----- Drag handler events --------------------------------------------------
123 ; The events which request that you draw something are called for each
124 ; rectangle of the draw operation -- i.e. do not call Wimp_GetRectangle
125 ; because this is done for you.
128 drEvent_draw # 1 ;Draw dragged object
129 ;R1 == pointer to redraw blk
130 ;R2,R3 == drag start posn
131 ;R4,R5 == drag current posn
132 ;R6,R7 == window origin
135 drEvent_undraw # 1 ;Undraw dragged object
136 ;Regs as for drEvent_draw
137 ;Normally use the same code
139 drEvent_update # 1 ;Redraw dragged object in
141 ;Regs as for drEvent_draw
142 ;Dash pattern set up so that
143 ;single plot will rotate box,
144 ;so may share code with
147 drEvent_trans # 1 ;Translate coordinates
148 ;R1 == ptr to window state
149 ;R4,R5 == pointer position
150 ;R6,R7 == window origin
151 ;Translate pointer position
152 ;to internal coordinates if
153 ;this is useful to you.
154 ;Return new coords in R4,R5
156 drEvent_getPos # 1 ;Read pointer position
157 ;R1 == ptr to window state
158 ;R2,R3 == start position
159 ;R4,R5 == pointer position
160 ;R6,R7 == window origin
161 ;Used to read pointer posn.
162 ;Do any grid snapping here
163 ;and return with R4,R5 as
166 drEvent_done # 1 ;Drag operation completed
167 ;R1 == ptr to window state
168 ;R2,R3 == drag start posn
169 ;R4,R5 == drag current posn
171 drEvent_cancel # 1 ;Drag operation aborted
172 ;No other registers set up
176 ;----- That's all, folks ----------------------------------------------------