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

Command.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: Command.h,v $
00013  *    $Author: johns $    $Locker:  $        $State: Exp $
00014  *    $Revision: 1.172 $    $Date: 2019/01/17 21:20:58 $
00015  *
00016  ***************************************************************************
00017  * DESCRIPTION:
00018  *     This file contains the base definition of the Command object.
00019  *  The idea is that all actions should be instantiated as
00020  *  a derivitive of a Command object and placed in a command queue.
00021  *  At every event loop, the commands are read off the current command
00022  *  queue and told to "execute".  When each command
00023  *  is finished, all of the UIs are notified that a command of some 
00024  *  "cmdtype" executed, so that the UI can update its information 
00025  *  if so desired.
00026  *
00027  *    Collections of related commands (i.e. command which all start with
00028  *  the same word, but are different variations) should be placed in files
00029  *  with the names 'Cmd*.C' and 'Cmd*.h'.  These files should define all the
00030  *  specific Command subclasses, as well as provide global 'text callback'
00031  *  functions which are called to process text commands which start with
00032  *  a specific word.
00033  *
00034  ***************************************************************************/
00035 #ifndef COMMAND_H
00036 #define COMMAND_H
00037 
00038 #include "Inform.h"
00039 class CommandQueue;
00040 
00045 class Command {
00046 public:
00047   // ALL the commands types must be in this enumeration.  The last element
00048   // must be "TOTAL" and the sequence must start at zero.  This is because
00049   // we reference Command::TOTAL to figure out how many commands there are.
00050   enum Cmdtype { 
00051     ROTMAT, ROTATE, TRANSLATE, SCALE, ROCKON, ROCKOFF, STOPROT,
00052     ANIM_DIRECTION, ANIM_JUMP, ANIM_SKIP, ANIM_STYLE, ANIM_SPEED,
00053     ANIM_READ, ANIM_WRITE, ANIM_DELETE, ANIM_DUP, ANIM_NEW_FRAME, 
00054     ANIM_NEW_NUM_FRAMES,
00055     ATOMSEL_ADDMACRO, ATOMSEL_DELMACRO,
00056     COLOR_NAME, COLOR_CHANGE, COLOR_SCALE_METHOD, COLOR_SCALE_SETTINGS,
00057     COLOR_SCALE_COLORS,
00058     COLOR_ADD_ITEM,
00059     DISP_BACKGROUNDGRADIENT,
00060     DISP_RESETVIEW, DISP_STEREO, DISP_STEREOSWAP, 
00061     DISP_CACHEMODE, DISP_RENDERMODE, 
00062     DISP_PROJ, DISP_EYESEP, 
00063     DISP_FOCALLEN, DISP_LIGHT_ON, DISP_LIGHT_HL, DISP_LIGHT_ROT,
00064     DISP_LIGHT_MOVE, DISP_FPS,
00065     DISP_CLIP, DISP_DEPTHCUE, DISP_CULLING, 
00066     DISP_ANTIALIAS, CMD_AXES, CMD_STAGE,
00067     DISP_SCRHEIGHT, DISP_SCRDIST, 
00068     DISP_CUESTART, DISP_CUEEND, DISP_CUEDENSITY, DISP_CUEMODE,
00069     DISP_SHADOW,
00070     DISP_AO, DISP_AO_AMBIENT, DISP_AO_DIRECT, 
00071     DISP_DOF, DISP_DOF_FNUMBER, DISP_DOF_FOCALDIST, 
00072     IMD_ATTACH, IMD_SIM, IMD_RATE, IMD_COPYUNITCELL,
00073     INTERP_EVENT,
00074     LABEL_ADD, LABEL_ADDSPRING, LABEL_SHOW, LABEL_DELETE, 
00075     LABEL_TEXTSIZE, LABEL_TEXTTHICKNESS, LABEL_TEXTOFFSET, LABEL_TEXTFORMAT,
00076     MATERIAL_ADD, MATERIAL_RENAME, MATERIAL_CHANGE,
00077     MATERIAL_DELETE, MATERIAL_DEFAULT,
00078     MENU_SHOW, MENU_TK_ADD, MENU_TK_REMOVE,
00079     MOL_NEW, MOL_DEL, MOL_ACTIVE, MOL_FIX, MOL_ON, MOL_TOP,
00080     MOL_SELECT, MOL_REP, MOL_COLOR, MOL_ADDREP, MOL_DELREP,
00081     MOL_MODREPITEM, MOL_MODREP, MOL_MATERIAL, MOL_CANCEL, 
00082     MOL_REANALYZE, MOL_BONDRECALC, MOL_SSRECALC, 
00083     MOL_REPSELUPDATE, MOL_REPCOLORUPDATE, MOL_DRAWFRAMES, 
00084     MOL_SHOWPERIODIC, MOL_NUMPERIODIC, MOL_SCALEMINMAX, MOL_SMOOTHREP,
00085     MOL_VOLUME, MOL_RENAME,
00086     MOL_SHOWREP,
00087     MOUSE_MODE,
00088     PICK_EVENT, PLUGIN_UPDATE,
00089     RENDER, RENDER_OPTION, 
00090     MOBILE_MODE, SPACEBALL_MODE,
00091     TOOL_CREATE, TOOL_CHANGE, TOOL_DELETE, TOOL_SCALE, TOOL_SCALE_FORCE,
00092     TOOL_SCALE_SPRING,
00093     TOOL_OFFSET, TOOL_REP,
00094     TOOL_ADD_DEVICE, TOOL_DELETE_DEVICE, TOOL_CALLBACK,
00095     TOTAL
00096   };
00097 
00098 private:
00099   Cmdtype mytype;     
00100   int hasTextCmd;     
00101 
00102 protected:
00104   Inform *cmdText;
00105 
00108   virtual void create_text() { 
00109     hasTextCmd = 0; 
00110   }
00111 
00112 public:
00116   Command(Cmdtype newtype)
00117       : mytype(newtype), hasTextCmd(1), cmdText((Inform *) 0) {}
00118 
00120   virtual ~Command() {}
00121 
00124   int has_text(Inform *str) {
00125     cmdText = str;
00126     create_text();
00127     return hasTextCmd;
00128   }
00129     
00131   Cmdtype gettype() { 
00132     return mytype; 
00133   }
00134 };
00135 
00136 #endif
00137 

Generated on Fri Oct 4 02:43:49 2024 for VMD (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002