Next: Suggestions for future changes/additions
Up: Method of use
 Previous: Using a Command object:
 
 The following
`checklist' should be followed when creating a new type of command:
-  Identify the `type' of command ... to affect the display, the
  molecules, the on-screen forms, or whatever.  There are several Cmd*
  files, find one where it belongs, or create a new one of the form
  CmdXXXX.h and .C
 -  Create a text equivalent of the commands.  Text commands in VMD\
  consist of one or more words separated by whitespace, and terminated
  by a newline.  The first word of the command should be an `identifying'
  word to indicate the general type of action to be performed, and the
  other words should be arguments to describe exactly what action to do
  in the general category.
 -  Put a new code in the Cmdtype enumeration in Command.h
 -  Create the class definition in CmdXXXX.h.  The only functions that
  are needed are the constructor/destructor, and the virtual functions
  do_execute and create_text.  If the command does not have
  a text equivalent, you do not need to provide a version of the latter.
 -  Put the member functions in the file CmdXXXX.C.  The easiest thing
  to do is to follow the patters in the Cmd*.C files.
 -  All commands must be understood by the text parser (UIText).
  The parser reads in new commands, looks at the first word, and calls
  a text callback function to process that command.  If the new command
  is just a variant of another existing command (i.e. the first word of this
  new command is the same as some existing command), then it should be put
  in an existing Cmd* file, and the function 'text_cmd_WWWW' at the top
  of the respective .C file (where WWWW is the first word of the command)
  should be updated to understand the new command.  Add code to look for
  the proper strings, to create a new instance of the new command, and to
  add it to the given CommandQueue.  If this command contains instead
  a new word for the VMD vocabulary, go on the next step, otherwise the
  next step can be skipped.
 -  For commands which contain a new starting word, so that they are
  placed in new files CmdXXXX.h and .C, two things must be done to allow
  VMD to be aware of the text versions of these commands and to be able
  to execute them:
  
-  At the beginning of CmdXXX.h and .C, a new function
    `text_cmd_WWWW(int argc, char **argv, CommandQueue *cq, int id)'
    must be defined and written.  This routine must know how to examine
    the text command (as provided in token form in argc and argv) and
    create instances of the proper Command object to be added to
    the command queue.  Other Cmd* files contain examples.
 -  In the file UIText.C, there is a section where all the words
    that are at the beginning of VMD commands are `registered', with
    the callback function to call when that word is seen.  Add a line
    similar to the others in this section, to register the new word and
    to specify the new function `text_cmd_WWWW'.
  
 
 -  If other user interfaces (other than the text interface) are to
  have the ability to execute this same command, add this ability to them
  as well.
 -  Finally, update the on-line help file vmd_help.html, and
  the User's Guide.
 
 
 
 
  
 Next: Suggestions for future changes/additions
Up: Method of use
 Previous: Using a Command object:
Justin Gullingsrud 
Tue Apr  6 09:26:48 CDT 1999