a2-chemi-gs-1993/draw.asm

1 line
6.5 KiB
NASM
Raw Permalink Normal View History

2017-10-22 14:30:14 +00:00
keep DRAW **************************************************************** * ChemiGS * **************************************************************** * A Drawing Program for Chemical Structures * * (c) 1992-93 by Urs Hochstrasser * * Buendtenweg 6 * * 5105 AUENSTEIN (SWITZERLAND) * **************************************************************** * Module DRAW **************************************************************** * * USES ... * mcopy draw.macros copy equates.asm DisplayData start using Globals ~StartDrawing gDataWin jsr displayIt ~SetOrigin #0,#0 rts displayIt entry ph4 #0 ~GetPort pl4 theWindow ~GetPortRect #dPortRect ph4 #0 ~GetWRefCon theWindow pl4 theHandle ~HandToPtr theHandle,#theData,#miniFInfo ************************ CONTROL POSITIONING STUFF ********************* lda dPortRect+6 Stuff to position the ctls... sec sbc dPortRect+2 sta winW lda dPortRect+4 sec sbc dPortRect sta winH sec winH still in A-reg lda winH sbc #12 heigth of size box -1 sta myY sta gViewH lda winW sec sbc #24 width of size box -2 sta myX sta gViewW ~MoveControl myX,myY,sizeBox ~MoveControl #0,myY,Mountn lda myX sta vsRect+2 ctlRect.left lda myY inc a sta vsRect+4 lda winW inc a inc a sta vsRect+6 ~DisposeControl vScroll ph4 #0 ~NewControl2 theWindow,#0,#vScrollBar pl4 vScroll ~SetCtlParams docH,myY,vScroll lda myY sta hsRect lda winH inc a sta hsRect+4 lda myX inc a inc a sta hsRect+6 ~DisposeControl hScroll ph4 #0 ~NewControl2 theWindow,#0,#hScrollBar pl4 hScroll ~SetCtlParams docW,myX,hScroll lda myY dec a sta contRect+4 lda myX sta contRect+6 cmp4 theWindow,gDataWin bne pass move4 contRect+4,gContentRect+4 pass anop lda theWindow ldx theWindow+2 jsr GrowClip ***************************** ToolBar redraw lda fTextFlag beq noText ~HideControl TBarH ph4 #0 ~LoadResource #kPicResID,#kToolPicID pl4 toolBar ~DrawPicture toolBar,#destRect brl isText noText ~ShowControl TBarH isText anop ****************************END ToolBar Stuff ~DrawControls theWindow ~PenNormal ~MoveTo #0,#17 draw ruler's border line ~LineTo #640,#17 lda theWindow ldx theWindow+2 jsr ShrinkClip lda fcacheWins beq noOff ************************ IF YOU GET HERE, WIN CACHING IS ON ************ ~PPToPort pixImage,#srcRect,#0,#18,modeCopy brl exit ************************ CONTENT DRAW STUFF **************************** * new stuff here: noOff ph4 #0 ~GetVisHandle pl4 visHandle loop ~HandToPtr theData,#TheSegment,#segSize * new stuff continued tests if part of rect built sub2 yy,yOffset *** even more recent! sub2 yy2,yOffset *** Doc -> Window sub2 xx,xOffset *** sub2 xx2,xOffset *** move4 yy,myRect with the two endpoints has move4 yy2,myRect+4 any points in common with lda yy the visrgn. cmp yy2 Result: Same problem as bcc yOK testing the individual points sta myRect+4 last chance to speed things up: lda yy2 test against the hit region of sta myRect the line segment!!!! yOK lda xx (pretty cool, eh?) cmp xx2 bcc xOK here's how: sta myRect+6 SectRgn rg1Hndl,rg2Hndl,destRHndl lda xx2 bool:=EmptyRgn rgnHndl sta myRect+2 xOK inc myRect+4 Problem with RectInVisRgn: h+v inc myRect+6 Problem with PtInPortRect: v stz fSkip *** pha ~RectInRgn #myRect,visHandle pla bne doit * brl l4 skip this line segment inc fSkip ** * end new stuff ************************ ACTUAL CONTENT DRAW ROUTINE ******************* doit ~SetPenSize sPenSize+2,sPenSize lda sCMD bne l7 brl exit l7 cmp #6 bcs l1 asl a tax lda fSkip *** bne l4 *** jsr (toolTable,x) brl l4 l1 cmp #11 bcs l2 bra exit l2 cmp #17 bcc l3 bra exit l3 sec sbc #11 asl a tax lda fSkip *** bne l4 *** jsr (toolTable2,x) l4 move4 sLink,theData lda theData ora theData+2 beq exit brl loop exit anop lda theWindow *** TEST... ldx theWindow+2 jsr GrowClip *** TEST ... lda rts ************************** MINI FILE INFO: 52 BYTES *************************** theData ds 4 Handle to linked segment list theTex