4 ; Implementation of arrow icons as dbx controls (MDW)
9 ;----- Standard header ------------------------------------------------------
14 ;----- External dependencies ------------------------------------------------
20 GET sapphire:dbx._dbxMacs
22 ;----- Main code ------------------------------------------------------------
24 AREA |Sapphire$$Code|,CODE,READONLY
26 arrow_event EQU &80000002 ;Click on an arrow button
28 ;R2 == increment value or 0
32 ; Control data: +0 == increment when clicked with Select
39 ; Use: Control type for an arrow button.
47 TST R2,#5 ;Is this a bona fido click?
48 MOVEQS PC,R14 ;No -- then ignore it
49 STMFD R13!,{R0-R3,R14} ;Save some registers away
50 STR R1,arrow__icon ;Save the icon handle
52 ; --- First, select the arrow button ---
54 MOV R0,R10 ;Get the dialogue handle
55 MOV R2,#1 ;Set icon's select state
56 BL dbox_select ;Show the button popped in
58 ; --- Calculate the increment to return ---
60 SUB R13,R13,#20 ;Make some space for a block
61 MOV R1,R13 ;Point to the block
62 SWI Wimp_GetPointerInfo ;Get the current mouse state
63 LDR R14,[R1,#8] ;Load the button status
64 LDR R2,[R9,#0] ;Get the arrow increment
65 CMP R14,#1 ;Is Adjust being clicked?
66 RSBEQ R2,R2,#0 ;Yes -- negate the increment
67 STR R2,arrow__inc ;Save the increment
68 ADD R13,R13,#20 ;Reclaim the stack space
70 ; --- Now set up the repeater ---
72 ADR R0,arrow__repeat ;Point to repeater routine
73 MOV R1,R10 ;Pass dialogue in R10
74 MOV R2,R12 ;And workspace in R12
75 BL repeater ;Set up the repeater
77 LDMFD R13!,{R0-R3,PC}^ ;Return to caller if all OK
83 ; --- arrow__repeat ---
85 ; On entry: R0 == number of repeats, or 0 for end of job
89 ; Use: Handles autorepeating for the arrow button.
93 STMFD R13!,{R0-R3,R14} ;Save some registers
94 CMP R0,#0 ;Is this the end?
95 BEQ %50arrow__repeat ;Yes -- do different things
97 ; --- Send a normal continuation event ---
99 ; To avoid `buffering' effect, remove the MUL R2,R0,R2
102 LDMIA R12,{R1,R2} ;Load increment and icon
103 MUL R2,R0,R2 ;Accumulate lots of ops
104 MOV R0,#arrow_event ;Get the event code
105 BL dbx_sendEvent ;Send the event along nicely
106 LDMFD R13!,{R0-R3,PC}^ ;And return to caller
108 ; --- Send end-of-the-job event ---
110 50arrow__repeat MOV R0,R10 ;Yes -- get the dialogue
111 LDR R1,arrow__icon ;Load the icon handle
112 MOV R2,#0 ;Deselect the button
113 BL dbox_select ;And do the deselect op
115 MOV R0,#arrow_event ;Get the event code
116 BL dbx_sendEvent ;Send the event along nicely
117 LDMFD R13!,{R0-R3,PC}^ ;And return to caller
121 ;----- Workspace ------------------------------------------------------------
126 arrow__icon # 4 ;Icon handle of button
127 arrow__inc # 4 ;Increment to return
129 arrow__wSize EQU {VAR}-arrow__wStart
131 AREA |Sapphire$$LibData|,CODE,READONLY
138 ;----- That's all, folks ----------------------------------------------------