5 INCLUDE "exec/funcdef.i"
6 INCLUDE "exec/exec_lib.i"
7 INCLUDE "intuition/intuitionbase.i"
8 INCLUDE "graphics/rastport.i"
9 INCLUDE "graphics/text.i"
10 INCLUDE "graphics/gfxbase.i"
11 INCLUDE "lvo/graphics_lib.i"
13 INCLUDE "lvo/utility_lib.i"
14 INCLUDE "utility/hooks.i"
16 INCLUDE "libraries/gadtools.i"
18 INCLUDE "intuition/intuition.i"
19 INCLUDE "lvo/intuition_lib.i"
20 INCLUDE "intuition/classes.i"
21 INCLUDE "intuition/classusr.i"
22 INCLUDE "intuition/imageclass.i"
24 INCLUDE "libraries/reqtools.i"
25 INCLUDE "lvo/reqtools_lib.i"
27 INCLUDE "boopsigads.i"
29 XDEF _myBoopsiDispatch
40 _LVODrawBevelBox
equ -$78
42 * int __regargs CatStrLen
(char
*string
);
55 ; bra.b .nextcharnoadd
59 * char __regargs KeyFromStr
(char
*string
, char underchar
);
68 move.l _UtilityBase
(a4
),a6
78 move.l _GfxBase
(a4
),a6
86 ;_LVONewObjectA EQU -636
92 move.l _IntuitionBase
(a4
),a6
93 jsr _LVONewObjectA
(a6
)
97 * myBoopsiDispatch
(Class
*cl, struct Image
*im
, struct impDraw
*msg
)
100 movem.l d1
-d7
/a0
-a6
,-(a7
)
102 move.w cl_InstOffset
(a0
),d7
103 move.l _GfxBase
(a4
),a6
108 * This is DoSuperMethod for prepackaged
"message" packets
114 move.l h_SIZEOF
+4(a0
),a0
; substitute superclass
115 ; --- performs call to hook in A0 and restores a2
118 move.l h_Entry
(a0
),-(a7
)
133 move.l d0
,a2
; DSM returned image pointer
135 * Copy over InitData structure
136 move.l ig_ImageData
(a2
),a0
137 lea lod_IData
(a2
,d7.w
),a1
138 moveq #
(idata_SIZEOF
/4)-1,d0
143 move.l lod_IData
+idata_Label
(a2
,d7.w
),a1
144 move.l lod_IData
+idata_TextAttr
(a2
,d7.w
),a0
145 lea lod_IData
+idata_Underscore
+3(a2
,d7.w
),a3
147 move.w d0
,ig_Width
(a2
)
149 * Calculate text position if we have a gadget
150 move.l lod_IData
+idata_Gadget
(a2
,d7.w
),a0
154 * im
->LeftEdge
= (gad
->Width - im
->Width) / 2;
155 move.w gg_Width
(a0
),d0
156 sub.w ig_Width
(a2
),d0
158 move.w d0
,ig_LeftEdge
(a2
)
160 * im
->TopEdge
= (gad
->Height
- im
->Height
) / 2;
161 move.w gg_Height
(a0
),d0
162 sub.w ig_Height
(a2
),d0
164 move.w d0
,ig_TopEdge
(a2
)
167 move.l a2
,ig_ImageData
(a2
)
168 move.l #BUTTON_MAGIC_LONGWORD
,ig_Width
(a2
)
173 ****** IM_DRAW
******
177 move.l impd_RPort
(a5
),a1
; rp
179 move.l a1
,-(a7
) ; push rastport
181 * Set drawmode to JAM1
185 * Open
and set text font
(or set default font
)
186 move.l lod_IData
+idata_TextAttr
(a2
,d7.w
),a0
188 move.b ta_Style
(a0
),d5
190 move.l d0
,d6
; d6 = font
192 move.l gb_DefaultFont
(a6
),d0
198 * Set style of font
(bold
, underlined
,...
)
202 jsr _LVOSetSoftStyle
(a6
)
203 move.l
(a7
)+,a1
; pos rastport
205 move.w impd_OffsetY
(a5
),d1
; x offset
206 move.w impd_OffsetX
(a5
),d0
; y offset for image only
207 move.l impd_DrInfo
(a5
),a0
208 move.l dri_Pens
(a0
),a0
; a0 points to pens
211 lea defaultpens
(PC
),a0
214 * is image connected to a gadget
?
215 move.l lod_IData
+idata_Gadget
(a2
,d7.w
),a3
; gadget
219 * Get
size of gadget container
220 move.w gg_TopEdge
(a3
),d1
221 move.w gg_LeftEdge
(a3
),d0
223 move.w gg_Height
(a3
),d3
; height
225 move.w gg_Width
(a3
),d2
; width
227 move.l impd_State
(a5
),d4
; d4 = impd_State
229 movem.l d0
-d3
/a1
,-(a7
) ; push gadget coords + rastport
230 ; will be popped when bevelbox is drawn!
232 * draw rectangle
in BACKGROUNDPEN
or FILLPEN
233 movem.l d0
-d3
/a0
-a1
,-(a7
)
235 subq.l #IDS_SELECTED
,d4
; d4 = !selected
237 addq.l #
(BACKGROUNDPEN
-FILLPEN
)*2,a0
240 jsr _LVOSetAPen
(a6
) ; set pen to FILLPEN
241 movem.l
(a7
),d0
-d3
/a0
-a1
246 jsr _LVORectFill
(a6
) ; draw background rectangle
247 movem.l
(a7
),d0
-d3
/a0
-a1
249 * calculate gadget text pen
253 moveq #FILLTEXTPEN
,d0
255 move.b d0
,ig_PlanePick
(a2
)
256 movem.l
(a7
)+,d0
-d3
/a0
-a1
259 * now we have d0
= xpos
, d1
= ypos
, a1
= rp
, a0
= pens
260 * a5
= msg
, a2
= image
262 move.l lod_IData
+idata_Label
(a2
,d7.w
),a3
263 add.w ig_LeftEdge
(a2
),d0
264 add.w ig_TopEdge
(a2
),d1
267 movem.l d0
-d1
/a1
,-(a7
)
269 move.b ig_PlanePick
(a2
),d0
274 movem.l
(a7
),d0
-d1
/a1
276 * move to text position
277 add.w rp_TxBaseline
(a1
),d1
279 movem.l
(a7
),d0
-d1
/a1
281 * draw first part of text
(entire text if no underscore
)
283 move.w lod_UnderOff
(a2
,d7.w
),d5
284 beq.b notextbeforeunderscore
287 notextbeforeunderscore:
288 movem.l
(a7
)+,d0
-d1
/a1
290 * is there an underscore
in text
?
291 tst.b ig_PlaneOnOff
(a2
)
294 * First draw rest of text
295 movem.l d0
-d1
/a1
,-(a7
)
298 move.w rp_cp_x
(a1
),d5
299 move.w lod_RestLen
(a2
,d7.w
),d0
302 movem.l
(a7
)+,d0
-d1
/a1
306 add.w lod_UnderY
(a2
,d7.w
),d1
307 movem.l d0
-d1
/a1
,-(a7
)
309 movem.l
(a7
)+,d0
-d1
/a1
310 add.w lod_UnderWidth
(a2
,d7.w
),d0
315 tst.l lod_IData
+idata_Gadget
(a2
,d7.w
) ; gadget
318 * draw bevelbox around gadget container
(recessed if selected
)
319 movem.l
(a7
)+,d0
-d3
/a0
; pop gadget coords + rastport (in A0!)
321 clr.l
-(a7
) ; TAG_DONE
325 pea GTBB_Recessed
; recessed box
327 move.l lod_IData
+idata_VisualInfo
(a2
,d7.w
),-(a7
) ; visinfo
329 move.l a7
,a1
; tag array
330 move.l _GadToolsBase
(a4
),a6
331 jsr _LVODrawBevelBox
(a6
)
335 * close font we opened
336 tst.l d6
; font opened ?
339 move.l _GfxBase
(a4
),a6
340 jsr _LVOCloseFont
(a6
)
344 movem.l
(a7
)+,d1
-d7
/a0
-a6
350 * pixellen
= myTextLength
(char
*str, struct TextAttr
*attr
,
351 * UBYTE
*underscore
, ULONG do_lod
);
353 * (if D7 is non
-zero
=> A2 must be image pointer
!)
356 movem.l d2
-d5
/d7
/a2
/a5
/a6
,-(a7
)
358 move.l a7
,a5
; a5 points to RastPort
359 move.l _GfxBase
(a4
),a6
365 * Initialize the RastPort
367 jsr _LVOInitRastPort
(a6
)
371 * Open
and set text font
(if supplied
)
373 move.l d0
,d3
; d3 = font
375 move.l gb_DefaultFont
(a6
),d0
382 move.l
(a7
)+,d4
; d4 is label
390 bne.b strlen
; d5 is strlen(label)
392 * Image
and object data variables
395 clr.b ig_PlaneOnOff
(a2
)
396 move.w d5
,lod_UnderOff
(a2
,d7.w
)
397 move.w rp_TxHeight
(a5
),ig_Height
(a2
)
400 * Set the image
width and height
404 jsr _LVOTextLength
(a6
)
408 * Search for
'_' in string
422 move.b
(a0
),ig_PlaneOnOff
(a2
) ; store code of underscored key
423 move.w d0
,lod_UnderOff
(a2
,d7.w
) ; store offset of underscore
426 move.w d5
,lod_RestLen
(a2
,d7.w
) ; store len of remaining string
427 move.w rp_TxBaseline
(a5
),d0
429 move.w d0
,lod_UnderY
(a2
,d7.w
) ; Y position of underscore
433 jsr _LVOTextLength
(a6
)
434 move.w d0
,lod_UnderWidth
(a2
,d7.w
)
440 jsr _LVOTextLength
(a6
)
441 sub.l d0
,(a7
) ; subtract from pixel length
447 jsr _LVOCloseFont
(a6
)
453 add.w #rp_SIZEOF
,a7
; remove rastport from stack
454 movem.l
(a7
)+,d2
-d5
/d7
/a2
/a5
/a6
458 dc.w
1,0,1,2,1,3,1,0,2