home *** CD-ROM | disk | FTP | other *** search
/ Nebula 2 / Nebula Two.iso / Apps / ScreenSavers / BackSpaceViews / SpinView.BackModule / SpinView.h < prev    next >
Encoding:
Text File  |  1995-06-12  |  3.4 KB  |  130 lines

  1.  
  2. #import    <appkit/View.h>
  3.  
  4. /**********************************************************************/
  5.  
  6. #define    MINANGLEINC    (  0 )
  7. #define    MAXANGLEINC    ( 90 )
  8.  
  9. #define    MINNUMSPINS    (  1 )
  10. #define    MAXNUMSPINS    ( 20 )        // If you want to change this one, you'll also
  11.                                 // have to increase the size of userPathOps[]
  12.                                 // in SpinViewPart.m.  Statically filling that
  13.                                 // array with drawing ops seems faster than
  14.                                 // writing a function to load it up at runtime
  15.                                 // or filling it on the fly. (which is the way
  16.                                 // I've seen it done most often.)
  17. #define    MINTAILLEN    (   1 )
  18. #define    MAXTAILLEN    ( 300 )
  19.  
  20. #define    MINRADIUS    (  10 )
  21. #define    MAXRADIUS    ( 300 )
  22.  
  23. #define    MINXINC        (  0.0 )
  24. #define    MAXXINC        ( 20.0 )
  25.  
  26. #define    MINYINC        (  0.0 )
  27. #define    MAXYINC        ( 20.0 )
  28.  
  29. #define    OWNER        "SpinView"    // Owner of defaults.
  30.  
  31. /**********************************************************************/
  32.  
  33. typedef    struct
  34.         {
  35.                 float    x;        // Current center X coord.
  36.                 float    y;        // Current center Y coord.
  37.                 int        a;        // Current angle.
  38.                 
  39.                 float    ix;        // Amount to move center in x direction.
  40.                 float    iy;        // Amount to move center in y direction.
  41.                 
  42.                 int        dx;        // Current x direction. ( LEFT or RIGHT )
  43.                 int        dy;        // Current y direction. ( UP or DOWN )
  44.         }
  45.         SPINNER;
  46.         
  47. /*********************************************************************/
  48.  
  49. @interface SpinView : View
  50. {
  51.     SPINNER    headSpin[ MAXNUMSPINS ];
  52.     SPINNER    tailSpin[ MAXNUMSPINS ];
  53.  
  54.     int        CurNumSpins;    // Current number of spinners on screen.
  55.     int        CurAngleInc;    // Current angle increment between line draws.
  56.     int        CurRadius;        // Current line radius from center point.
  57.     int        CurTailLen;        // Current number of "shadow" lines before
  58.                             // lines begin to be erased.
  59.                             
  60.     float    CurXInc;        // Current x increment.  Amount to move spinner
  61.                             // in x direction between line draws.
  62.     float    CurYInc;        // Current y increment.  Amount to move spinner
  63.                             // in y direction between line draws.
  64.     
  65.     float    Bbox[ 4 ];        // Bounding box for user path operations.  I really
  66.                             // cheat on this one. :->
  67.     
  68.     float    r;                // These are for color drawing, they
  69.     float    g;                // are taken from bbum's module LizardSaver.
  70.     float    b;                // (Some slight modifications, per Sam Streeper,
  71.                             // and some tiding up from me.)
  72.  
  73.     
  74.     id        inspectPanel;        // Panel that holds the inspector controls.
  75.     id        mainInspectBox;        // Box that contains it all.  The 
  76.                                 // inspector: method returns the
  77.                                 // content view of this box.
  78.     id        xIncField;
  79.     id        xIncSlider;
  80.     
  81.     id        yIncField;
  82.     id        yIncSlider;
  83.     
  84.     id        angleSlider;
  85.     id        angleField;
  86.     
  87.     id        numSpinSlider;
  88.     id        numSpinField;
  89.     
  90.     id        radiusSlider;
  91.     id        radiusField;
  92.     
  93.     id        tailSlider;
  94.     id        tailField;
  95. }
  96.  
  97. /*********************************************************************/
  98.  
  99. - (const char *) windowTitle;
  100. - ( void ) getAngleInc;
  101. - ( void ) getNumSpinners;
  102. - ( void ) getRadius;
  103. - ( void ) getTailLength;
  104. - ( void ) getXIncrement;
  105. - ( void ) getYIncrement;
  106. - ( void ) resetSpinners;
  107. - initFrame : ( const NXRect * ) frameRect;
  108. - newWindow;
  109. - sizeTo : ( NXCoord ) width : ( NXCoord ) height;
  110. - ( void ) setStartPoints;
  111. - ( void ) resetSpinners;
  112. - ( void ) moveSpinner : ( SPINNER * ) spin;
  113. - ( void ) drawSpinners : ( SPINNER * ) spin;
  114. - oneStep;
  115. - drawSelf : ( NXRect * ) r : ( int ) count;
  116.  
  117. @end
  118.  
  119. @interface    SpinView(inspect)
  120.  
  121. - inspector : sender;
  122. - ( void ) connectInspector;
  123. - setAngle : sender;
  124. - setXInc : sender;
  125. - setYInc : sender;
  126. - setNumSpins : sender;
  127. - setRadius : sender;
  128. - setTailLength : sender;
  129.  
  130. @end