home *** CD-ROM | disk | FTP | other *** search
-
- #import <appkit/View.h>
-
- /**********************************************************************/
-
- #define MINANGLEINC ( 0 )
- #define MAXANGLEINC ( 90 )
-
- #define MINNUMSPINS ( 1 )
- #define MAXNUMSPINS ( 20 ) // If you want to change this one, you'll also
- // have to increase the size of userPathOps[]
- // in SpinViewPart.m. Statically filling that
- // array with drawing ops seems faster than
- // writing a function to load it up at runtime
- // or filling it on the fly. (which is the way
- // I've seen it done most often.)
- #define MINTAILLEN ( 1 )
- #define MAXTAILLEN ( 300 )
-
- #define MINRADIUS ( 10 )
- #define MAXRADIUS ( 300 )
-
- #define MINXINC ( 0.0 )
- #define MAXXINC ( 20.0 )
-
- #define MINYINC ( 0.0 )
- #define MAXYINC ( 20.0 )
-
- #define OWNER "SpinView" // Owner of defaults.
-
- /**********************************************************************/
-
- typedef struct
- {
- float x; // Current center X coord.
- float y; // Current center Y coord.
- int a; // Current angle.
-
- float ix; // Amount to move center in x direction.
- float iy; // Amount to move center in y direction.
-
- int dx; // Current x direction. ( LEFT or RIGHT )
- int dy; // Current y direction. ( UP or DOWN )
- }
- SPINNER;
-
- /*********************************************************************/
-
- @interface SpinView : View
- {
- SPINNER headSpin[ MAXNUMSPINS ];
- SPINNER tailSpin[ MAXNUMSPINS ];
-
- int CurNumSpins; // Current number of spinners on screen.
- int CurAngleInc; // Current angle increment between line draws.
- int CurRadius; // Current line radius from center point.
- int CurTailLen; // Current number of "shadow" lines before
- // lines begin to be erased.
-
- float CurXInc; // Current x increment. Amount to move spinner
- // in x direction between line draws.
- float CurYInc; // Current y increment. Amount to move spinner
- // in y direction between line draws.
-
- float Bbox[ 4 ]; // Bounding box for user path operations. I really
- // cheat on this one. :->
-
- float r; // These are for color drawing, they
- float g; // are taken from bbum's module LizardSaver.
- float b; // (Some slight modifications, per Sam Streeper,
- // and some tiding up from me.)
-
-
- id inspectPanel; // Panel that holds the inspector controls.
- id mainInspectBox; // Box that contains it all. The
- // inspector: method returns the
- // content view of this box.
- id xIncField;
- id xIncSlider;
-
- id yIncField;
- id yIncSlider;
-
- id angleSlider;
- id angleField;
-
- id numSpinSlider;
- id numSpinField;
-
- id radiusSlider;
- id radiusField;
-
- id tailSlider;
- id tailField;
- }
-
- /*********************************************************************/
-
- - (const char *) windowTitle;
- - ( void ) getAngleInc;
- - ( void ) getNumSpinners;
- - ( void ) getRadius;
- - ( void ) getTailLength;
- - ( void ) getXIncrement;
- - ( void ) getYIncrement;
- - ( void ) resetSpinners;
- - initFrame : ( const NXRect * ) frameRect;
- - newWindow;
- - sizeTo : ( NXCoord ) width : ( NXCoord ) height;
- - ( void ) setStartPoints;
- - ( void ) resetSpinners;
- - ( void ) moveSpinner : ( SPINNER * ) spin;
- - ( void ) drawSpinners : ( SPINNER * ) spin;
- - oneStep;
- - drawSelf : ( NXRect * ) r : ( int ) count;
-
- @end
-
- @interface SpinView(inspect)
-
- - inspector : sender;
- - ( void ) connectInspector;
- - setAngle : sender;
- - setXInc : sender;
- - setYInc : sender;
- - setNumSpins : sender;
- - setRadius : sender;
- - setTailLength : sender;
-
- @end