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

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