Make PBC type enumeration into PbcType enum class
[alexxy/gromacs.git] / src / programs / view / manager.h
1 /*
2  * This file is part of the GROMACS molecular simulation package.
3  *
4  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
5  * Copyright (c) 2001-2004, The GROMACS development team.
6  * Copyright (c) 2013,2014,2015,2019,2020, by the GROMACS development team, led by
7  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
8  * and including many others, as listed in the AUTHORS file in the
9  * top-level source directory and at http://www.gromacs.org.
10  *
11  * GROMACS is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU Lesser General Public License
13  * as published by the Free Software Foundation; either version 2.1
14  * of the License, or (at your option) any later version.
15  *
16  * GROMACS is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19  * Lesser General Public License for more details.
20  *
21  * You should have received a copy of the GNU Lesser General Public
22  * License along with GROMACS; if not, see
23  * http://www.gnu.org/licenses, or write to the Free Software Foundation,
24  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA.
25  *
26  * If you want to redistribute modifications to GROMACS, please
27  * consider that scientific software is very special. Version
28  * control is crucial - bugs must be traceable. We will be happy to
29  * consider code for inclusion in the official distribution, but
30  * derived work must not be called official GROMACS. Details are found
31  * in the README & COPYING files - if they are missing, get the
32  * official version at http://www.gromacs.org.
33  *
34  * To help us fund GROMACS development, we humbly ask that you cite
35  * the research papers on the package. Check out http://www.gromacs.org.
36  */
37
38 #ifndef _manager_h
39 #define _manager_h
40
41 #include <stdio.h>
42
43 #include "gromacs/fileio/trxio.h"
44 #include "gromacs/pbcutil/rmpbc.h"
45 #include "gromacs/topology/topology.h"
46 #include "gromacs/utility/real.h"
47
48 #include "3dview.h"
49 #include "buttons.h"
50 #include "nleg.h"
51 #include "x11.h"
52 #include "xutil.h"
53
54 struct gmx_output_env_t;
55 enum class PbcType : int;
56
57 /* Some window sizes */
58 #define EWIDTH 200
59 #define EHEIGHT 0
60 #define LDHEIGHT 0
61 #define LEGHEIGHT 60
62
63 enum eObject
64 {
65     eOSingle,
66     eOBond,
67     eOHBond,
68     eONR
69 };
70
71 enum eVisible
72 {
73     eVNormal,
74     eVSpecial,
75     eVHidden,
76     evNR
77 };
78
79 enum eBwidth
80 {
81     eBThin,
82     eBFat,
83     eBVeryFat,
84     eBSpheres,
85     eBNR
86 };
87
88 enum esBox
89 {
90     esbNone,
91     esbRect,
92     esbTri,
93     esbTrunc,
94     esbNR
95 };
96
97 typedef struct
98 {
99     t_windata wd;            /* Mol window structure                    */
100     bool      bShowHydrogen; /* Show Hydrogens?                 */
101     int       bond_type;     /* Show one of the above bondtypes      */
102     PbcType   pbcType;       /* PBC type                             */
103     int       boxtype;       /* Rectangular, Tric, TruncOct (display)*/
104     int       realbox;       /* Property of the real box             */
105 } t_molwin;
106
107 typedef struct
108 {
109     eObject       eO;     /* The type of object                 */
110     eVisible      eV;     /* Visibility status of the object    */
111     unsigned long color;  /* The color (only when eV==evSpecial)    */
112     int           ai, aj; /* The int for i (and j if bond)      */
113     real          z;      /* The Z-coordinate for depht cueing  */
114 } t_object;
115
116 typedef struct
117 {
118     t_blocka* grps;     /* Blocks with atom numbers             */
119     char**    grpnames; /* The names of the groups              */
120     bool*     bDisable; /* Group indexes out of natoms in TRX   */
121     bool*     bShow;    /* Show a group ?                       */
122 } t_filter;
123
124 /*
125  * t_manager structure:
126  *
127  * This structure manages the display area for the gmx program.
128  * It reads the status file and sends messages when windows need to
129  * be updated.
130  *
131  */
132 typedef struct
133 {
134     t_trxstatus*   status;
135     const char*    trajfile;
136     int            natom; /* The number of atoms                        */
137     t_topology     top;   /* topology                             */
138     rvec           box_size;
139     real           time;     /* The actual time                      */
140     rvec*          x;        /* The coordinates                 */
141     iv2*           ix;       /* The coordinates after projection        */
142     real*          zz;       /* Z-coords                             */
143     matrix         box;      /* The box                         */
144     int            nobj;     /* The number of objects           */
145     t_object*      obj;      /* The objects on screen           */
146     bool*          bHydro;   /* true for hydrogen atoms         */
147     bool*          bLabel;   /* Show a label on atom i?              */
148     char**         szLab;    /* Array of pointers to labels          */
149     unsigned long* col;      /* The colour of the atoms         */
150     int*           size;     /* The size of the atoms           */
151     real*          vdw;      /* The VDWaals radius of the atoms */
152     bool*          bVis;     /* visibility of atoms                  */
153     bool           bPbc;     /* Remove Periodic boundary             */
154     bool           bAnimate; /* Animation going on?                     */
155     bool           bEof;     /* End of file reached?                 */
156     bool           bStop;    /* Stopped by user?                     */
157     bool           bSort;    /* Sort the coordinates                    */
158     bool           bPlus;    /* Draw plus for single atom               */
159     int            nSkip;    /* Skip n steps after each frame   */
160     int            nWait;    /* Wait n ms after each frame           */
161     gmx_rmpbc_t    gpbc;     /* For removing peridiocity             */
162
163     t_windata    wd;    /* The manager subwindow                */
164     t_windata    title; /* Title window                         */
165     t_3dview*    view;  /* The 3d struct                        */
166     t_molwin*    molw;  /* The molecule window                  */
167     t_butbox*    vbox;  /* The video box                        */
168     t_butbox*    bbox;  /* The button box                       */
169     t_legendwin* legw;  /* The legend window                    */
170
171     gmx_output_env_t* oenv; /* output env data */
172 } t_manager;
173
174 extern t_manager* init_man(t_x11*            x11,
175                            Window            Parent,
176                            int               x,
177                            int               y,
178                            int               width,
179                            int               height,
180                            unsigned long     fg,
181                            unsigned long     bg,
182                            PbcType           pbcType,
183                            matrix            box,
184                            gmx_output_env_t* oenv);
185 /* Initiate the display manager */
186
187 extern void move_man(t_x11* x11, t_manager* man, int width, int height);
188 /* Set the right size for this window */
189
190 extern void step_message(t_x11* x11, t_manager* man);
191 /* Send a message to the manager */
192
193 extern void set_file(t_x11* x11, t_manager* man, const char* trajectory, const char* status);
194 /* Read a new trajectory and topology */
195
196 extern void map_man(t_x11* x11, t_manager* man);
197
198
199 extern bool toggle_animate(t_x11* x11, t_manager* man);
200
201 extern bool toggle_pbc(t_manager* man);
202
203 extern void no_labels(t_x11* x11, t_manager* man);
204 /* Turn off all labels */
205
206 extern void done_man(t_x11* x11, t_manager* man);
207 /* Clean up man struct */
208
209 extern void draw_mol(t_x11* x11, t_manager* man);
210
211 extern void do_filter(t_x11* x11, t_manager* man, t_filter* filter);
212
213 #endif