mirror of
https://github.com/antoinevignau/source.git
synced 2025-01-06 01:31:57 +00:00
1 line
12 KiB
Plaintext
1 line
12 KiB
Plaintext
|
LOAD 'Macros.dump'
INCLUDE 'SS.equ'
INCLUDE 'Driver.equ'
INCLUDE 'Heap.aii.i'
;------------------------------------------
;
; Equates from procedure S_PieData
;
;------------------------------------------
S_MaxPieCount equ 24
S_PieColWd equ 180
;-----------------------------------------------
;
; Imported addresses
;
;-----------------------------------------------
IMPORT D_ClosePicture
IMPORT D_AlertBox
IMPORT D_CheckPurge
IMPORT D_Deref
IMPORT D_DrawString
IMPORT D_FastMult
IMPORT D_KillFont
IMPORT D_NeedHand
IMPORT D_SelectFont
IMPORT D_Set4Pat
IMPORT X_FormatValue
IMPORT S_ChartTitleLoc
IMPORT S_MissingSlice
IMPORT S_SliceStr
IMPORT S_BadNum
IMPORT S_BigPie
IMPORT S_ChartColors
IMPORT S_Cur2Heap
IMPORT S_GetCellPtr
IMPORT S_ItzaBar
IMPORT S_NoData
IMPORT S_NormalizeRange
IMPORT S_PictRect
IMPORT S_PieRect
IMPORT S_TraverseRange
IMPORT S_GetMinMax
IMPORT S_NoINF
;-----------------------------------------------
;
; Forward addresses and entries
;
;-----------------------------------------------
ENTRY AngleToPt
ENTRY S_Pie360
ENTRY S_PieArray
ENTRY S_PieDiv
ENTRY S_PieLegend
ENTRY S_PieNegFlag
ENTRY S_PieOffset
ENTRY S_PieOne
ENTRY S_PiePict
ENTRY S_PieSliceCount
ENTRY S_PieSum
ENTRY S_PieTotal
ENTRY S_PieTwo
ENTRY S_PieZero
ENTRY S_SlicePie
;---------------------------------------------------------------------------
;
; S_MakePie
;
;
S_MakePie PROC EXPORT
;Using S_CurrentData2
;Using S_ChartData
;Using S_PieData
;Using SANEEQUS
input charthdl:l
output pict:l
local arrayhdl:l,chart:l
local color:w,OldClip:l
local col:w,items:l
local tmp:l,topl:l,botr:l
error err
begin
stz err
H_GetBlockPtr charthdl,chart
call S_NormalizeRange,in=([chart]:#S_CRange:l,[chart]:#S_CRange+4:l)
pulllong botr
pulllong topl
call S_GetMinMax,in=(topl:l,botr:l,#1:w),out=(:l)
tool FCLASSX,in=(:l)
txa
asl a
cmp #2*FCINF
beq @INF
call S_GetMinMax,in=(topl:l,botr:l,#0:w),out=(:l)
tool FCLASSX,in=(:l)
txa
asl a
cmp #2*FCINF
bne @dopie
@INF call D_AlertBox,in=(#1:w,#S_NoINF:l),out=(a:w)
dec err
brl exit
@dopie
subword botr,topl,a
ina
sta tmp
subword botr+2,topl+2,a
ina
sta tmp+2
tool _Multiply,in=(tmp:w,tmp+2:w),out=(items:l)
movelong items,tmp
mull4 tmp
tool _NewRgn,out=(OldClip:l),err=(err)
jcs exit
tool _GetClip,in=(OldClip:l)
tool _ClipRect,in=(#S_PictRect:l)
call D_NeedHand,in=(tmp:l),out=(arrayhdl:l),err=(err)
jcs whoops2
rcall D_Deref,in=(arrayhdl:ax),out=(S_PieArray:ax)
moveX S_PieZero,S_PieTotal
stz S_PieOffset
stz S_PieNegFlag
call S_TraverseRange,in=(topl:l,botr:l,#S_PieSum:l),err=(err)
jcs whoops
lda S_PieOffset
beq @nodata
tool FCMPX,in=(#S_PieTotal:l,#S_PieZero:l) ; any real data?
bvs OpenIt
@nodata call D_AlertBox,in=(#1:w,#S_NoData:l),out=(a:w)
dec err
brl whoops
OpenIt cmpw S_PieOffset,#S_MaxPieCount+1
blt ReallyOpen
call D_AlertBox,in=(#1:w,#S_BigPie:l),out=(a:w)
dec err
brl whoops
ReallyOpen tool _OpenPicture,in=(#S_Pictrect:l),out=(pict:l)
movelong pict,S_PiePict
moveword S_PieOffset,S_PieSliceCount
stz S_PieOffset
stz S_MissingSlice
tool _PicComment,in=(#picLParen:w,#0:w,#0:l)
call S_TraverseRange,in=(topl:l,botr:l,#S_PieDiv:l)
tool _PicComment,in=(#picRParen:w,#0:w,#0:l)
call S_SlicePie,in=(S_PieOffset:w,S_PieArray:l)
; Draw the title, at the bottom...
tool _MoveTo,in=(S_ChartTitleLoc:l)
_PenNormal ; necess. for #'s in case of 0's ==> no colour
jsl D_KillFont
rcall D_SelectFont,in=(#$FFFE:a,#$0800:x,#0:y)
H_GetBlockPtr charthdl,chart
addlong chart,#S_CName,s
Call D_DrawString,in=(:l)
jsl D_ClosePicture
bcs @picErr
call D_CheckPurge
bcs KillIt
lda S_MissingSlice
beq Done
call D_AlertBox,in=(#1:w,#S_SliceStr:l),out=(a:w)
bra exit
@picErr
KillIt tool _KillPicture,in=(pict:l)
call D_CheckPurge
dec err
; cmpl items,#25
;
|