//**************************************************
//	Digit Widgets Stroke Module
// 	Stroke Manipulation Control
//	Made to be called from Hyperlinked Digit_Widgets Script
//
// Version 3.0 - 09/12/01 - Added Animation Script to Widgets
//	Version 3.1 - 09/15/01 - Updated with Advanced and Standard Animation Scripts
//**************************************************
<zscriptinsert,"Digit_Widgets_Common_Std.txt">
//****************************
// Stroke Definitions
//****************************
[VarDef,maxAvailableStrokes,10] 
[varDef,strokesList(maxAvailableStrokes+1)]  
[varDef,multistrokesList(maxAvailableStrokes+1)]
[varDef,theStroke,0]
[varDef,theStrokes,0]
[VarDef,currlen,0]
[varDef,currfile,1]
[varDef,currmultifile,1]
[VarDef,fil]
[varDef,PosX,0]
[varDef,PosY,0]
[VarDef,originalH,0]
[VarDef,originalV,0]
[varDef,rot,90]
[varDef,scal,1]
[varDef,hoff,0]
[varDef,voff,0]
[varDef,turns,0]
[VarDef,tempcounter,0]
[VarDef,numpts,0]
[VarDef,ox,0]
[VarDef,oy,0]
[VarDef,ex,0]
[VarDef,ey,0]
[VarDef,XD1,0]
[VarDef,YD1,0]
[VarDef,ZD1,0]
[VarDef,ypt,0]
[VarDef,xpt,0]
[VarDef,zpt,0]

[PD]
//***************************************************
[PD]
[iSlider,"OriginX  ",0,1,0,DocWidth,"Place Origin X",[varSet,PosX,zscript:OriginX],0,[TextCalcWidth,Distance1453]]
[iSlider,"OriginY  ",0,1,0,DocHeight,"PlaceOrigin Y",[varSet,PosY,zscript:OriginY],0,[TextCalcWidth,Distance1453]]

//***************************************************
//Use Marker it is neccesary script merged with Marker Routines
//***************************************************
[iSwitch,"UseCurrentMark",1,"Use Current Position Marker"] 
[IButton,"Place Stroke","Place Stroke then erase if necessary",
	[VarSet,theStroke,[StrokeGetLast]] //get the last drawn stroke
	// we now want the stroke to be drawn at PosX,PosY regardless of it original position
	// to do so, we interogate the stroke data and get its start position
	// then we can add the appropriate offset in order to have drawn at 100,100
	[VarSet,originalH,[StrokeGetInfo,theStroke,1,0]] // get start H position
	[VarSet,originalV,[StrokeGetInfo,theStroke,2,0]] // get start V position
	// now  we draw the stroke with rotation=0, scaling=1, and calculated delta offset.
	[if,[iGet,zscript:UseCurrentMark],
		[CanvasStroke,theStroke,0,0,1,1,MarkX(MarkIndex)-originalH,MarkY(MarkIndex)-originalV]
	, //else
		[CanvasStroke,theStroke,0,0,1,1,PosX-originalH,PosY-originalV]
	]//endif
]//end place stroke
[PD]
//**************************************************************************
//****************Do Single Stroke Select recorded or lastStroke************
//**************************************************************************
[iSlider,"Rotateit",90,1,0,360,"Rotate Degrees", 	[varSet,rot,zscript:Rotateit],0,[TextCalcWidth,Distance1453]]
[iSlider,"Scaleit",1,.1,1,10,"Scale Sroke",		[varSet,scal,zscript:Scaleit],0,[TextCalcWidth,Distance1453]]
[iSlider,"OffsetH",0,1,-500,500,"Offset Horiz",	[varSet,hoff,zscript:OffsetH],0,[TextCalcWidth,Distance1453]]
[iSlider,"OffsetV",0,1,-500,500,"Offset Vert",	[varSet,voff,zscript:OffsetV],0,[TextCalcWidth,Distance1453]]
[iSwitch,"Circle",1,"Complete a 360 circle"] 
[iSwitch,"UseStrokes",1,"Use Stroke File"] 
[iSlider,"LengthS  ",0,1,-500,500,"Radius of Stroke",[varSet,currlen,zscript:LengthS]]

[iButton," LastStroke ","Repeat last Brush Stroke",
	[varSet,turns,1]
	[if,[iGet,zscript:Circle],
		[varSet,turns,360/rot]
	] //endif
	//not sure why tempCounter here but Pixolator wrote the usestrokes one
	[VarSet,tempCounter,1]

	[loop,turns,
		[if,[iGet,zscript:UseStrokes], 
			[CanvasStroke,strokesList(currfile),0,rot*tempCounter,scal,scal,hoff*tempCounter/turns,voff*tempCounter/turns]
			[VarInc,tempCounter]
		,//else
			[CanvasStroke,[StrokeGetLast],0,rot,scal,scal,hoff*tempCounter/turns,voff*tempCounter/turns]
		] // endif

	] //end loop
	[varSet,currlen,[StrokeGetInfo,[StrokeGetLast],8]]
	[ISet,zscript:LengthS,currlen]
]//end LastStroke

//**************************************************************************
//****************Do Multi Stroke ************
//**************************************************************************
[PD]
[FontSetColor,255,200,0]Multi Stroke Utility[FontSetColor,160,160,160]
[PD]
[PD]
[iSlider,"MultiRotateit",90,1,0,360,"Rotate Degrees", 	[varSet,rot,zscript:MultiRotateit],0,[TextCalcWidth,Distance1453]]
[iSlider,"MultiScaleit",1,.1,1,10,"Scale Sroke",	[varSet,scal,zscript:MultiScaleit],0,[TextCalcWidth,Distance1453]]
[iSlider,"MultiOffsetH",0,1,-500,500,"Offset Horiz",	[varSet,hoff,zscript:MultiOffsetH],0,[TextCalcWidth,Distance1453]]
[iSlider,"MultiOffsetV",0,1,-500,500,"Offset Vert",	[varSet,voff,zscript:MultiOffsetV],0,[TextCalcWidth,Distance1453]]
[iSwitch,"MultiCircle",1,"Complete a 360 circle"] 

[iButton," MultiLastStroke ","Repeat last Brush Strokes",
	[varSet,turns,1]
	[if,[iGet,zscript:MultiCircle],
		[varSet,turns,360/rot]
	] //endif
	//not sure why tempCounter here but Pixolator wrote the usestrokes one
	[VarSet,tempCounter,1]

	[loop,turns,
			[CanvasStrokes,multistrokesList(currmultifile),0,rot*tempCounter,scal,scal,hoff*tempCounter/turns,voff*tempCounter/turns]
			[VarInc,tempCounter]

	] //end loop
]//end MultiLastStroke
//**************************************************************************
//**********************Select Strokefile Number*****************************
//**************************************************************************
[PD]
[FontSetColor,255,200,0]Load Strokes[FontSetColor,160,160,160]

[iSlider,"Filenumber ",1,1,1,10,"Select a Single Strokefile",
	[varSet,currfile,zscript:Filenumber]
	[varSet,fil,[FileNameMake,"stroke.txt",currfile,1]]
	[VarSet,strokesList(currfile),[StrokeLoad,fil]],
	0,[TextCalcWidth,Filenumberxxx]  
]
[iSlider,"FilenumberMulti ",1,1,1,10,"Select a Multiple Strokefile",
	[varSet,currmultifile,zscript:FilenumberMulti]
	[varSet,fil,[FileNameMake,"strokes.txt",currmultifile,1]]
	[VarSet,multistrokesList(currmultifile),[StrokesLoad,fil]],
	0,[TextCalcWidth,FilenumberMultixxx]  
]
[PD]
[PD]
<zscriptinsert,"Widgets_Index_Include_Std.txt">
[pd][penMove,0,8]
\C00e0e0About This ZScript:\Cc0c0c0
This script will allow you to use either recorded brush strokes or the \Cffa000Last Drawn Brush Stroke\Cc0c0c0 and draw them around a center point at a specified \Cffa000Rotateit\Cc0c0c0 Angle. Press \Cffa000Circle\Cc0c0c0 to complete a 360 degree circle of the strokes at the Rotate angle. 
[PD]
Recall brush strokes from the disk by using the \Cffa000Filenumber\Cc0c0c0 for single stroke files named Stroke1.txt .... Stroke9.txt or use \Cffa000FilenumberMulti\Cc0c0c0 to recall Multiple Recorded Strokes named Strokes1.txt ..... Strokes9.txt. These strokes are saved to disk in the Stoke Pallete to be used by this routine. You can use the Stroke Palette to create these strokes and name them as above to reuse them over and over. If you want to just use the \Cffa000Last Drawn Stroke\Cc0c0c0 then be sure to turn the \Cffa000UseStrokes\Cc0c0c0 switch off otherwise it will use the recorded stroke file.
[PD]
[fontSetSizeSmall]Standard Digit Widget Stroke Revision 1.0, created by Digits
