a2-chemi-gs-1993/tools.asm

1 line
9.6 KiB
NASM
Raw Normal View History

2017-10-22 14:30:14 +00:00
keep TOOLS **************************************************************** * ChemiGS * **************************************************************** * A Drawing Program for Chemical Structures * * (c) 1992-93 by Urs Hochstrasser * * Buendtenweg 6 * * 5105 AUENSTEIN (SWITZERLAND) * **************************************************************** * Module TOOLS **************************************************************** * * USES ... * mcopy tools.macros copy equates.asm **************************************************************** * * SUBROUTINES * CrossCursor start using Globals move4 gCrossCur,gEditCursor rts MarqueeCursor entry move4 gMarqueeCur,gEditCursor rts HandCursor entry move4 gHandCur,gEditCursor rts TextCursor entry move4 gTextCur,gEditCursor rts EraseCursor entry move4 gEraseCur,gEditCursor rts ArrowCursor entry move4 gArrowCur,gEditCursor AdjustCursor entry brl pastname procedure name to be displayed dc i2'$7771' by GSBug... dw 'AdjustCursor' pastname anop lda newCursor sta oldCursor stz newCursor ph4 #0 ~FrontWindow pl4 theWindow cmp4 theWindow,gDataWin beq x0 Edit Win not in front brl l2 x0 ph4 #0 ~GetContentRgn gDataWin pl4 contentRgn pha ~PtInRgn #gMainEvt+owhere,contentRgn * ~PtInRect #gMainEvt+owhere,#myRect pla beq l2 Cursor not in edit window ~StartDrawing gDataWin move4 gMainEvt+owhere,myPoint ***new ~GlobalToLocal #myPoint ***new pha ~PtInRect #myPoint,#gContentRect pla beq l2 inc newCursor ~SetOrigin #0,#0 l2 anop lda oldCursor cmp newCursor beq exit lda newCursor beq l3 ~SetCursor gEditCursor bra exit l3 ~InitCursor exit anop rts contentRgn ds 4 oldCursor ds 2 newCursor entry ds 2 theWindow ds 4 myPoint ds 4 myRect dc i2'20,20,220,120' end ********************************************************************* * Tool handlers * doHand start using Globals using TransData rts doErase entry rts doSingleB entry ~MoveTo xx,yy ~LineTo xx2,yy2 rts doDoubleB entry jsr MakeMatrix move4 #doubleBData+2,0 ldx doubleBData dloop stx count ~BlockMove 0,#px,#8 jsr TransForm ~MoveTo pxx,pyy add4 0,#8 ~BlockMove 0,#px,#8 jsr TransForm ~LineTo pxx,pyy add4 0,#8 ldx count dbne x,dloop rts doHatchB entry jsr MakeMatrix move4 #hatchData+2,0 ldx hatchData hloop stx count * ~BlockMove 0,#px,#8 ldy #0 * hloop2 lda [0],y * sta px,y * iny * Special Agent Cooper iny * cpy #8 * bcc hloop2 * jsr TransForm ~MoveTo pxx,pyy add4 0,#8 ~BlockMove 0,#px,#8 jsr TransForm ~LineTo pxx,pyy add4 0,#8 ldx count dbne x,hloop rts doWedgeB entry a somewhat different procedure... jsr MakeMatrix move4 #wedgeBData+2,0 ~BlockMove 0,#px,#8 jsr TransForm ph4 #0 ~OpenPoly pl4 myPoly ~MoveTo pxx,pyy add4 0,#8 ldx wedgeBData dwloop stx count ~BlockMove 0,#px,#8 jsr TransForm ~LineTo pxx,pyy add4 0,#8 ldx count dbne x,dwloop ~ClosePoly ~PaintPoly myPoly ~FramePoly myPoly rts myPoly ds 4 doCycloPropane entry jsr MarqueeCursor rts doCycloPentane entry jsr MarqueeCursor rts doCycloHexane entry jsr MarqueeCursor rts doBenzene entry jsr MarqueeCursor rts doSeat entry jsr MarqueeCursor rts doMarquee entry jsr dragRect rts doText entry lda fTextFlag beq firstTime * test jsr EndText save old LE-text before making new firstTime anop lda #1 sta fTextFlag ph4 #0 ~LoadResource #kPicResID,#kToolPicID pl4 toolBar * _SetField LEditH,#$c8,#KeyFilter,#4 * bra gaga _Deref LEditH,LEditPtr **** new lda LEditPtr * sta <0 * lda LEditPtr+2 * sta <2 * ldy #$c8 * lda #<KeyFilter * sta [0],y * iny * iny * lda #^KeyFilter * sta [0],y * _Unlock LeditH **** end new ph4 #0 * ~NewHandle #2,gMyID,#0,#0 * pl4 outH **** new end gaga anop lda gDataWin ldx gDataWin+2 jsr GrowClip ~SysBeep ~ShowControl LEditH ~DrawPicture toolBar,#destRect * lda gDataWin * ldx gDataWin+2 * jsr ShrinkClip *** Get Text from Loc, if necessary... *** Edit text... exit rts toolBa