<> <> <> <> <> DIRECTORY Cubic, Complex, FitState USING [defaultHandle], JaM, FitJaM, FitBasic, Real, Rope, Seq, Vector; FitPointEditJaM: CEDAR PROGRAM IMPORTS Complex, JaM, Real, Rope, Vector, FitState, FitJaM = { GetVec: PROC [state: JaM.State] RETURNS [z:Complex.Vec] = { z.y _ JaM.PopReal[state]; z.x _ JaM.PopReal[state]; }; SelectSa: PROC [state: JaM.State] = {OPEN FitState.defaultHandle^; closest: FitBasic.SampleHandle; z: Complex.Vec; z.y _ JaM.PopReal[state]; z.x _ JaM.PopReal[state]; [closest,] _ FindSa[z]; IF closest#NIL THEN slist.selectedSample _ closest; }; TheSa: PROC [state: JaM.State] = {OPEN FitState.defaultHandle^; JaM.PushReal[state,slist.selectedSample.xy.x]; JaM.PushReal[state,slist.selectedSample.xy.y]; }; FindSa: PROC [z: Complex.Vec] RETURNS[found: FitBasic.SampleHandle, index: NAT] = {OPEN FitState.defaultHandle^; closest,d: REAL _ 10.0E+30; i: NAT _ 0; found _ NIL; FOR s: FitBasic.SampleHandle _ slist.header.next, s.next UNTIL s=slist.header DO p: Complex.Vec _ XForm[s.xy]; IF ABS[p.x-z.x]> JaM.Register[state,".selectsa", SelectSa]; -- x y => . Selects a sample point for editing JaM.Register[state,".thesa", TheSa]; -- => x y . Returns the current sample JaM.Register[state,".thetan", TheTan]; -- => x y boolean . Returns the tangent of the current sample, and whether it is a node JaM.Register[state,".deletesa", DeleteSa]; -- => . Deletes the current sample JaM.Register[state,".insertsa", InsertSa]; -- x y => . Inserts before the current sample JaM.Register[state,".insertbetween", InsertBetween]; -- x y => . Inserts between the current sample and the neighbor nearest the new point JaM.Register[state,".nodesa", NodeSa]; -- boolean => . Makes or unmakes a node JaM.Register[state,".tansa", TanSa]; -- deltax deltay => . Sets the tangent at a sample JaM.Register[state,".cuspsa", CuspSa]; -- boolean => . Makes or unmakes a cusp JaM.Register[state,".cuspnode", CuspNode]; -- boolean => . Makes or unmakes a cusp ONLY on a node JaM.Register[state,".tanoutsa", TanOutSa]; -- deltax deltay => . Sets the outgoing tangent JaM.Register[state,".homesa", HomeSa]; -- => . Selects the header JaM.Register[state,".makefirstsa", MakeFirstSa]; -- => . Selects the header JaM.Register[state,".nextsa", NextSa]; -- => x y . Moves selection to the next sample JaM.Register[state,".prevsa", PrevSa]; -- => x y . Moves selection to the previous sample JaM.Register[state,".scalesa", ScaleSa]; -- x y => . Scales/rotates all samples by multiplying by x+iy JaM.Register[state,".transa", TranSa]; -- x y => . Translates all samples by adding x+iy JaM.Register[state,".subrange", Subrange]; -- change CurrentSamples so it returns a subrange JaM.Register[state,".allsa", NoSubrange]; -- remove the subrange JaM.Register[state,".resetnodes", ResetDefaultNodes]; -- remove the nodes JaM.Register[state,".resetcusps", ResetDefaultCusps]; -- remove the cusps }; FitJaM.RegisterInit[$FitPointEditJaM, Init]; }.