7b2aa4e46983f33f2f00a3a2d764ff8168e2743e
[alexxy/gromacs.git] / src / ngmx / manager.h
1 /*
2  * 
3  *                This source code is part of
4  * 
5  *                 G   R   O   M   A   C   S
6  * 
7  *          GROningen MAchine for Chemical Simulations
8  * 
9  *                        VERSION 3.2.0
10  * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
11  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
12  * Copyright (c) 2001-2004, The GROMACS development team,
13  * check out http://www.gromacs.org for more information.
14
15  * This program is free software; you can redistribute it and/or
16  * modify it under the terms of the GNU General Public License
17  * as published by the Free Software Foundation; either version 2
18  * of the License, or (at your option) any later version.
19  * 
20  * If you want to redistribute modifications, please consider that
21  * scientific software is very special. Version control is crucial -
22  * bugs must be traceable. We will be happy to consider code for
23  * inclusion in the official distribution, but derived work must not
24  * be called official GROMACS. Details are found in the README & COPYING
25  * files - if they are missing, get the official version at www.gromacs.org.
26  * 
27  * To help us fund GROMACS development, we humbly ask that you cite
28  * the papers on the package - you can find them in the top README file.
29  * 
30  * For more info, check our website at http://www.gromacs.org
31  * 
32  * And Hey:
33  * Gyas ROwers Mature At Cryogenic Speed
34  */
35
36 #ifndef _manager_h
37 #define _manager_h
38
39 #include <stdio.h>
40 #include "typedefs.h"
41 #include "x11.h"
42 #include "xutil.h"
43 #include "3dview.h"
44 #include "nleg.h"
45 #include "buttons.h"
46 #include "statutil.h"
47 #include "rmpbc.h"
48
49 /* Some window sizes */
50 #define EWIDTH          200
51 #define EHEIGHT           0
52 #define LDHEIGHT          0
53 #define LEGHEIGHT        60
54
55 typedef enum { eOSingle, eOBond, eOHBond, eONR } eObject;
56
57 typedef enum { eVNormal, eVSpecial, eVHidden, evNR } eVisible;
58
59 enum { eBThin, eBFat, eBVeryFat, eBSpheres, eBNR };
60
61 enum { esbNone, esbRect, esbTri, esbTrunc, esbNR };
62
63 typedef struct {
64   t_windata wd;                 /* Mol window structure                 */
65   gmx_bool      bShowHydrogen;  /* Show Hydrogens?                      */
66   int       bond_type;          /* Show one of the above bondtypes      */
67   int       ePBC;               /* PBC type                             */
68   int       boxtype;            /* Rectangular, Tric, TruncOct (display)*/
69   int       realbox;            /* Property of the real box             */
70 } t_molwin;
71
72 typedef struct {
73   eObject       eO;             /* The type of object                   */
74   eVisible      eV;             /* Visibility status of the object      */
75   unsigned long         color;          /* The color (only when eV==evSpecial)  */
76   atom_id       ai,aj;          /* The atom_id for i (and j if bond)    */
77   real          z;              /* The Z-coordinate for depht cueing    */
78 } t_object;
79
80 typedef struct {
81   t_blocka *grps;               /* Blocks with atom numbers             */
82   char    **grpnames;           /* The names of the groups              */
83   gmx_bool    *bDisable;            /* Group indexes out of natoms in TRX   */
84   gmx_bool    *bShow;           /* Show a group ?                       */
85 } t_filter;
86
87 /*
88  * t_manager structure:
89  *
90  * This structure manages the display area for the gmx program.
91  * It reads the status file and sends messages when windows need to
92  * be updated.
93  *
94  */
95 typedef struct {
96   t_trxstatus *status;
97   const char  *trajfile;
98   int       natom;              /* The number of atoms                  */
99   t_topology top;               /* topology                             */
100   rvec      box_size;
101   real      time;               /* The actual time                      */
102   rvec      *x;                 /* The coordinates                      */
103   iv2       *ix;                /* The coordinates after projection     */
104   real      *zz;                /* Z-coords                             */
105   matrix    box;                /* The box                              */
106   int       nobj;               /* The number of objects                */
107   t_object  *obj;               /* The objects on screen                */
108   gmx_bool      *bHydro;                /* TRUE for hydrogen atoms              */
109   gmx_bool      *bLabel;            /* Show a label on atom i?              */
110   char      **szLab;            /* Array of pointers to labels          */
111   unsigned long *col;           /* The colour of the atoms              */
112   int       *size;              /* The size of the atoms                */
113   real      *vdw;               /* The VDWaals radius of the atoms      */
114   gmx_bool      *bVis;              /* visibility of atoms                  */
115   gmx_bool      bPbc;               /* Remove Periodic boundary             */
116   gmx_bool      bAnimate;               /* Animation going on?                  */
117   gmx_bool      bEof;               /* End of file reached?                 */
118   gmx_bool      bStop;              /* Stopped by user?                     */
119   gmx_bool      bSort;          /* Sort the coordinates                 */
120   gmx_bool      bPlus;          /* Draw plus for single atom            */
121   int       nSkip;              /* Skip n steps after each frame        */
122   int       nWait;              /* Wait n ms after each frame           */
123   gmx_rmpbc_t gpbc;             /* For removing peridiocity             */
124   
125   t_windata   wd;               /* The manager subwindow                */
126   t_windata   title;            /* Title window                         */
127   t_3dview    *view;            /* The 3d struct                        */
128   t_molwin    *molw;            /* The molecule window                  */
129   t_butbox    *vbox;            /* The video box                        */
130   t_butbox    *bbox;            /* The button box                       */
131   t_legendwin *legw;            /* The legend window                    */
132
133   output_env_t oenv;            /* output env data */
134 } t_manager;
135
136 extern t_manager *init_man(t_x11 *x11,Window Parent,
137                            int x,int y,int width,int height,
138                            unsigned long fg,unsigned long bg,
139                            int ePBC,matrix box, const output_env_t oenv);
140 /* Initiate the display manager */
141
142 extern void move_man(t_x11 *x11,t_manager *man,int width,int height);
143 /* Set the right size for this window */
144
145 extern void step_message(t_x11 *x11,t_manager *man);
146 /* Send a message to the manager */
147
148 extern void set_file(t_x11 *x11,t_manager *man,const char *trajectory,
149                      const char *status);
150 /* Read a new trajectory and topology */
151
152 extern void map_man(t_x11 *x11,t_manager *man);
153
154 extern void move_man(t_x11 *x11,t_manager *man,int width,int height);
155
156 extern gmx_bool toggle_animate (t_x11 *x11,t_manager *man);
157
158 extern gmx_bool toggle_pbc (t_manager *man);
159
160 extern void no_labels(t_x11 *x11,t_manager *man);
161 /* Turn off all labels */
162
163 extern void done_man(t_x11 *x11,t_manager *man);
164 /* Clean up man struct */
165
166 extern void draw_mol(t_x11 *x11,t_manager *man);
167
168 extern void create_visibility(t_manager *man);
169
170 extern void do_filter(t_x11 *x11,t_manager *man,t_filter *filter);
171
172 #endif