Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

Spaceball.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *cr                                                                       
00003  *cr            (C) Copyright 1995-2019 The Board of Trustees of the           
00004  *cr                        University of Illinois                       
00005  *cr                         All Rights Reserved                        
00006  *cr                                                                   
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  * RCS INFORMATION:
00011  *
00012  *      $RCSfile: Spaceball.h,v $
00013  *      $Author: johns $        $Locker:  $             $State: Exp $
00014  *      $Revision: 1.31 $       $Date: 2019/01/17 21:21:01 $
00015  *
00016  ***************************************************************************
00017  * DESCRIPTION:
00018  *
00019  * The Spaceball UI object, which maintains the current state of the 
00020  * spaceball.  This code uses John Stone's spaceball driver library.
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" // spaceball I/O library header
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   // virtual routines for UI init/display
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 

Generated on Mon May 13 04:28:52 2024 for VMD (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002