00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 #ifndef SPACEBALL_OBJ_H
00024 #define SPACEBALL_OBJ_H
00025 
00026 #include "UIObject.h"
00027 #include "Command.h"
00028 #include "NameList.h"
00029 
00030 #if defined(VMDLIBSBALL) && !defined(VMDSPACEWARE)
00031 #include "sball.h" 
00032 #endif
00033 
00035 class Spaceball : public UIObject {
00036 public:
00038   enum MoveMode { NORMAL, MAXAXIS, SCALING, ANIMATE, TRACKER, USER };
00039 
00041   static const char *get_mode_str(MoveMode mode);
00042 
00043 private:
00044 #if defined(VMDLIBSBALL) && !defined(VMDSPACEWARE)
00045   SBallHandle sball; 
00046 #endif
00047 
00048   MoveMode moveMode; 
00049   float sensitivity; 
00050   int maxstride;     
00051   float transInc;    
00052   float rotInc;      
00053   float scaleInc;    
00054   float animInc;     
00055   int null_region;   
00056   int buttonDown;    
00057 
00059   float trtx;
00060   float trty;
00061   float trtz;
00062   float trrx;
00063   float trry;
00064   float trrz;
00065   int trbuttons;
00066 
00067 public:
00068   Spaceball(VMDApp *);      
00069   virtual ~Spaceball(void); 
00070   
00071   
00072   
00073   
00074    
00076   virtual void reset(void);
00077   
00082   virtual int act_on_command(int, Command *); 
00083   
00085   virtual int check_event(void);
00086 
00088   int move_mode(MoveMode);
00089 
00091   void set_sensitivity(float s) {
00092     sensitivity = s;
00093   }
00094 
00097   void set_null_region(int nr) {
00098     null_region = nr;
00099   }
00100 
00102   void set_max_stride(int ms) {
00103     maxstride = ms;
00104   }
00105 
00108   void get_tracker_status(float &tx, float &ty, float &tz, 
00109                           float &rx, float &ry, float &rz, int &buttons);
00110 };
00111 
00112 
00116 class CmdSpaceballMode : public Command {
00117 public:
00119   CmdSpaceballMode(int mm)
00120   : Command(SPACEBALL_MODE), spaceballMode(mm) {}
00121 
00123   int spaceballMode;
00124 };
00125 
00126 #endif
00127