home *** CD-ROM | disk | FTP | other *** search
/ The CDPD Public Domain Collection for CDTV 3 / CDPDIII.bin / pd / graphics / 3d / icoons / source / center.c < prev    next >
C/C++ Source or Header  |  1992-10-04  |  2KB  |  81 lines

  1. /* :ts=8 */
  2. #include <stdio.h>
  3. #include <string.h>
  4. #include <ctype.h>
  5. #include <math.h>
  6.  
  7. #include "general.h"
  8. #include "globals.h"
  9. #include "intui.h"
  10. #include "normal.h"
  11. #include "spl_math.h"
  12. #include "spl_util.h"
  13.  
  14. static 
  15. void  Center_Select_Down(short X, short Y)
  16. /************************************************************************/
  17. /*                                                                      */
  18. /* Function called when mouse is selected to mark a new center.        */
  19. /* X, Y are the actual coordinates in the active window 'Win'.        */
  20. /*                                                                      */
  21. /************************************************************************/
  22. {
  23.     short      View_Id;
  24.  
  25.     View_Id = Screen_To_World(X, Y, Current_Pos);
  26.     if (View_Id < 0) return;
  27.  
  28.     Set_Offset(Current_Pos, View_Id);
  29.  
  30.     Compute_Splines();
  31.     Set_Mode_Normal();
  32.     Redraw_Mask |= What_All;
  33.  
  34. } /* Center_Select_Down */
  35.  
  36.  
  37. Boolean_T Center_Handle_Event(struct IntuiMessage *Msg)
  38. /************************************************************************/
  39. /*                                                                      */
  40. /*                                                                      */
  41. /************************************************************************/
  42. {
  43.  
  44.     switch (Msg->Class) {
  45.  
  46.  
  47.     case IDCMP_MOUSEBUTTONS:
  48.         /* Msg->Code contain id of button pressed         */
  49.         /* Msg->MouseX and Msg->MouseY contain mouse position     */
  50.  
  51.     switch (Msg->Code) {
  52.  
  53.     case SELECTDOWN:
  54.         Center_Select_Down(Msg->MouseX, Msg->MouseY);
  55.         return(TRUE);
  56.  
  57.     } /* switch (Msg->Code) */
  58.     break;
  59.  
  60.  
  61.     } /* switch (Msg->Class) */
  62.  
  63.     return(FALSE);
  64.  
  65. } /* Center_Handle_Event */
  66.  
  67. void Set_Mode_Center()
  68. /************************************************************************/
  69. /*                                                                      */
  70. /*                                                                      */
  71. /************************************************************************/
  72. {
  73.  
  74.     State.Handle_Event        = Center_Handle_Event;
  75.     State.Redraw        = Normal_Redraw;
  76.  
  77.     Display_Status("Center");
  78.  
  79.  
  80. } /* Set_Mode_Center */
  81.