Create fileio module
[alexxy/gromacs.git] / src / programs / view / 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 #include "gromacs/fileio/trxio.h"
49
50 /* Some window sizes */
51 #define EWIDTH      200
52 #define EHEIGHT       0
53 #define LDHEIGHT      0
54 #define LEGHEIGHT    60
55
56 enum eObject {
57     eOSingle, eOBond, eOHBond, eONR
58 };
59
60 enum eVisible {
61     eVNormal, eVSpecial, eVHidden, evNR
62 };
63
64 enum eBwidth {
65     eBThin, eBFat, eBVeryFat, eBSpheres, eBNR
66 };
67
68 enum esBox {
69     esbNone, esbRect, esbTri, esbTrunc, esbNR
70 };
71
72 typedef struct {
73     t_windata     wd;            /* Mol window structure                        */
74     bool          bShowHydrogen; /* Show Hydrogens?                     */
75     int           bond_type;     /* Show one of the above bondtypes      */
76     int           ePBC;          /* PBC type                             */
77     int           boxtype;       /* Rectangular, Tric, TruncOct (display)*/
78     int           realbox;       /* Property of the real box             */
79 } t_molwin;
80
81 typedef struct {
82     eObject           eO;     /* The type of object                     */
83     eVisible          eV;     /* Visibility status of the object        */
84     unsigned long     color;  /* The color (only when eV==evSpecial)    */
85     atom_id           ai, aj; /* The atom_id for i (and j if bond)      */
86     real              z;      /* The Z-coordinate for depht cueing      */
87 } t_object;
88
89 typedef struct {
90     t_blocka    *grps;     /* Blocks with atom numbers          */
91     char       **grpnames; /* The names of the groups           */
92     bool        *bDisable; /* Group indexes out of natoms in TRX   */
93     bool        *bShow;    /* Show a group ?                    */
94 } t_filter;
95
96 /*
97  * t_manager structure:
98  *
99  * This structure manages the display area for the gmx program.
100  * It reads the status file and sends messages when windows need to
101  * be updated.
102  *
103  */
104 typedef struct {
105     t_trxstatus   *status;
106     const char    *trajfile;
107     int            natom;    /* The number of atoms                     */
108     t_topology     top;      /* topology                             */
109     rvec           box_size;
110     real           time;     /* The actual time                      */
111     rvec          *x;        /* The coordinates                 */
112     iv2           *ix;       /* The coordinates after projection        */
113     real          *zz;       /* Z-coords                             */
114     matrix         box;      /* The box                         */
115     int            nobj;     /* The number of objects           */
116     t_object      *obj;      /* The objects on screen           */
117     bool          *bHydro;   /* true for hydrogen atoms         */
118     bool          *bLabel;   /* Show a label on atom i?              */
119     char         **szLab;    /* Array of pointers to labels          */
120     unsigned long *col;      /* The colour of the atoms         */
121     int           *size;     /* The size of the atoms           */
122     real          *vdw;      /* The VDWaals radius of the atoms */
123     bool          *bVis;     /* visibility of atoms                  */
124     bool           bPbc;     /* Remove Periodic boundary             */
125     bool           bAnimate; /* Animation going on?                     */
126     bool           bEof;     /* End of file reached?                 */
127     bool           bStop;    /* Stopped by user?                     */
128     bool           bSort;    /* Sort the coordinates                    */
129     bool           bPlus;    /* Draw plus for single atom               */
130     int            nSkip;    /* Skip n steps after each frame   */
131     int            nWait;    /* Wait n ms after each frame           */
132     gmx_rmpbc_t    gpbc;     /* For removing peridiocity             */
133
134     t_windata      wd;       /* The manager subwindow                */
135     t_windata      title;    /* Title window                            */
136     t_3dview      *view;     /* The 3d struct                        */
137     t_molwin      *molw;     /* The molecule window                     */
138     t_butbox      *vbox;     /* The video box                   */
139     t_butbox      *bbox;     /* The button box                  */
140     t_legendwin   *legw;     /* The legend window                       */
141
142     output_env_t   oenv;     /* output env data */
143 } t_manager;
144
145 extern t_manager *init_man(t_x11 *x11, Window Parent,
146                            int x, int y, int width, int height,
147                            unsigned long fg, unsigned long bg,
148                            int ePBC, matrix box, const output_env_t oenv);
149 /* Initiate the display manager */
150
151 extern void move_man(t_x11 *x11, t_manager *man, int width, int height);
152 /* Set the right size for this window */
153
154 extern void step_message(t_x11 *x11, t_manager *man);
155 /* Send a message to the manager */
156
157 extern void set_file(t_x11 *x11, t_manager *man, const char *trajectory,
158                      const char *status);
159 /* Read a new trajectory and topology */
160
161 extern void map_man(t_x11 *x11, t_manager *man);
162
163 extern void move_man(t_x11 *x11, t_manager *man, int width, int height);
164
165 extern bool toggle_animate (t_x11 *x11, t_manager *man);
166
167 extern bool toggle_pbc (t_manager *man);
168
169 extern void no_labels(t_x11 *x11, t_manager *man);
170 /* Turn off all labels */
171
172 extern void done_man(t_x11 *x11, t_manager *man);
173 /* Clean up man struct */
174
175 extern void draw_mol(t_x11 *x11, t_manager *man);
176
177 extern void create_visibility(t_manager *man);
178
179 extern void do_filter(t_x11 *x11, t_manager *man, t_filter *filter);
180
181 #endif