1 // $Id: DRAWxtlViewUI.h 1090 2010-11-30 22:43:30Z martin $
2 //
3 // DRAWxtl V5.5 main window header
4 // initial version generated by Fast Light User Interface Designer (fluid) version 1.0104
5 // Coded using the FLTK 1.1.6 widget set
6 //
7 //     Larry W. Finger, Martin Kroeker and Brian Toby
8 //
9 
10 #ifndef DRAWxtlViewUI_h
11 #define DRAWxtlViewUI_h
12 #include <FL/Fl.H>
13 #include <FL/Fl_Window.H>
14 #include <FL/Fl_Double_Window.H>
15 #include <FL/Fl_Text_Display.H>
16 #include <FL/Fl_Check_Button.H>
17 #include <FL/Fl_Menu_.H>
18 #include <FL/Fl_Menu_Bar.H>
19 #include <FL/Fl_Group.H>
20 #include <FL/Fl_Box.H>
21 #include <FL/Fl_Progress.H>
22 #include <FL/Fl_Browser.H>
23 #include <FL/x.H>
24 #include "drawxtl.h"
25 #include "CrystalView.h"
26 #include "Draw_Fl_Input.h"
27 
28 #include "DRAWxtl_proto.h"
29 
30 enum
31 {
32     LIST1 = 1 << 0,
33     LIST2 = 1 << 1,
34     LIST3 = 1 << 2,
35     HELP = 1 << 3,
36     HELP1 = 1 << 4,
37     TEXTWIN = 1 << 5,
38     SPHERE = 1 << 6,
39     ELLIPSOID = 1 << 7,
40     LONEPAIR = 1 << 8,
41     TEXT1 = 1 << 9
42 };
43 
44 class DRAWxtl_Window:public Fl_Double_Window
45 {
46   public:
47     void resize (int X, int Y, int W, int H);
48     DRAWxtl_Window (int x, int y, int w, int h, const char *l = 0):
Fl_Double_Window(x,y,w,h,l)49     Fl_Double_Window (x, y, w, h, l) {
50     };
51 
draw(void)52     void draw (void)
53     {
54 	Fl_Window::draw ();
55     };
56 };
57 
58 class DRAWxtlViewUI
59 {
60   public:
61     void show (int, char **);
62     void draw (void);
63       DRAWxtlViewUI ();		// constructor
64 
65 // pointers to widgets
66 
67     DRAWxtl_Window *mainWindow;
68     Fl_Text_Display *mainLabel;
69     Fl_Multiline_Output *Cursor_pos;
70     Fl_Browser *Cursor_posW;
71     Fl_Choice *Cursor_reset;
72     Fl_Output *CurDirBuf;
73     Fl_Output *CurStrBuf;
74     Fl_Text_Buffer *CutoutColorBuf;
75     Fl_Check_Button *Use_Clipping;
76     Flu_Spinner *X_Min;
77     Flu_Spinner *Y_Min;
78     Flu_Spinner *Z_Min;
79     Flu_Spinner *X_Max;
80     Flu_Spinner *Y_Max;
81     Flu_Spinner *Z_Max;
82     Flu_Spinner *X_Min_clip;
83     Flu_Spinner *Y_Min_clip;
84     Flu_Spinner *Z_Min_clip;
85     Flu_Spinner *X_Max_clip;
86     Flu_Spinner *Y_Max_clip;
87     Flu_Spinner *Z_Max_clip;
88     Draw_Fl_Input *Origin_X;
89     Draw_Fl_Input *Origin_Y;
90     Draw_Fl_Input *Origin_Z;
91     Draw_Fl_Input *X_Rot;
92     Draw_Fl_Input *Y_Rot;
93     Draw_Fl_Input *Z_Rot;
94     Fl_Output *CurFile;
95     Fl_Output *CurDir;
96     Fl_Check_Button *Generate_VRML1;
97     Fl_Output *Origin1_Msg;
98     Fl_Check_Button *Orthographic_View;
99     Fl_Check_Button *Show_Vector_Triple;
100     static Fl_Menu_Item drawxtl_menu[];
101     Flu_Combo_List *Frame_No;
102     CrystalView *crystal;
103 
104 // variables used in drawing
105 
106     GLuint crystalDL;
107     int destroy;		// window destructor flag variable
108     char col_cell[40];		/* color and properties of framebars */
109     int Str_File_Changed;	// set true (==1) if contents of str file changed
110     float X_Boxlim;		// X box limit read from command line
111     float Y_Boxlim;		// Y box limit read from command line
112     float Z_Boxlim;		// Z box limit read from command line
113     float X_Origin;		// X origin read from command line
114     float Y_Origin;		// Y origin read from command line
115     float Z_Origin;		// Z origin read from command line
116     float lookat_v1[3], lookat_v2[3];	// "lookat" vectors "
117     float label_scale;		// relative scaling of text labels
118     int noshadow;		// if true, no shadows in POV
119     float ambient;		// POV lighting options
120     float diffuse;		//
121     float specular;		//
122     float roughness;		//
123     int automation;		// TRUE if automation in progress
124     char *automate_name;	// pointer to current name
125     int Stereo;			// TRUE for stereo views
126     int cross_eyed;		// TRUE for "cross-eyed" viewing
127     float stereo_base;		// separation wanted
128     float Trans[3];		// translation of virtual trackball
129 #if !defined (WIN32) && !defined (__APPLE__)
130     Pixmap icon;		// icon used only for Linux/Unix
131 #endif
132 
133 // symmetry variables
134 
135 #define MXSYM 192
136     char spg[3][4];		// space group code
137     int ss[MXSYM][3][3];	// rotation operators for symmetry
138     float rss[MXSYM][3][3];	// unitary rotation operators for symmetry
139     float rssC[MXSYM][3][3];	// crystallographic rotation operators for symmetry
140     float lat_pos[4][3];	// coordinates of lattice points
141     float ts[MXSYM][3];		// translation operators
142     int sym_op_no[MXSYM];	// saved symmetry operation number
143     int sym_op_signed[MXSYM];	// saved symmetry operation number, signed
144     float cell_xyz[MXSYM][3];	// storage for generated equiv. positions
145     int sys;			// crystal system indicator
146     int nbr;			// Bravais lattice indicator
147     int acentric;		// true if non-centric space group
148     int ng;			// number of rotation operations to specify group
149     int nlat;			// number of lattice positions
150     float xyzoff[3];		// offset between origin and center of symmetry
151     int xyzoff_read;		// true if xyzoff line read
152     int origin1_flag;		// true if space group has alternate origin setting
153     float origin_offset[3];	// offset vector between settings
154 
155 // lattice constant variables
156 
157     float lat_con[6];		// lattice constants
158     float rec_lat_con[6];	// reciprocal lengths and cosines of angles
159     double b_mat[3][3];		// metric tensor
160     float ginv[3][3];		// direct space metric tensor
161 
162 // lattice parameters of cutout box
163 
164     float slab_con[6];		// lattice constants
165     float slab_off[3];		// offset
166     float slab_rot[3];		// rotation angles
167 
168 // variables for atom lists
169 
170     int verts_alloc;		// number of vertices allocated
171     struct atom_struct *atoms;	// pointer where atom data is stored
172     int atom_alloc;		// number of atoms allocated
173     int *atom_no;		// master list atom and symmetry number
174     int *atom_so;		// atom symmetry number including inversion flag
175     int *orig_atom_no;		// saved atom number
176 
177 // atom list variables for modulated structures
178     struct mod_gbl_struct *modulate_gbl;	// pointer to gloabal modulation parameters
179     struct mod_x_struct *modulate_x;	// pointer to X modulation parameters
180     struct mod_3x_struct *modulate_3x;	// pointer to 3X modulation parameters
181     struct mod_3t_struct *modulate_3t;	// pointer to TF modulation
182     int mod_gbl_alloc;		// number of global modulations allocated
183     int mod_x_alloc;		// number of X modulations allocated
184     int mod_3x_alloc;		// number of 3X modulations allocated
185     int mod_3t_alloc;		// number of 3T modulations allocated
186     int modulated;		// flag for modulated or conventional/average structure
187     int no_mod_vectors;		// number of atom_site_fourier_wave_vectors
188     int no_site_displace;	// number of atom_site_displace_fourier terms
189     int no_site_U_terms;	// number of atom_site_U_fourier_terms
190     int no_site_occ;		// number of atom_site_occ_fourier terms
191     int no_cell_vec;		// number of cell_wave_vectors
192     float cell_vec[3][3];	// cell_wave_vectors
193     int no_subsys;		// number of subsystems
194     float subsys_ref_volume;	// reference reciprocal volume
195     float subsys_vol[10];	// reciprocal volume for each of the subsystems
196     float subsys_fact[10][3][3];	// place to save relationship between main and subsystem cells
197     float phaseshift[3];	// modulation phase offset t for each modulation
198     float *vert_occ;		// occupancy at individual sites (for radius scaling)
199     float ts_m[MXSYM][3];	// translational component of superspace symmetry
200     int ss_m[MXSYM][3][3];	// rotational component of superspace symmetry
201 
202 
203 // cone parameters
204 
205     int ncone;			// number of different types of lonepair cones
206     int ncone_alloc;		// number of lonepairs currently allocated
207     struct cone_struct *cones;	// place to allocate cone space
208 
209 // magnetic arrow parameters
210 
211     int nmag;			// number of magnetic moments
212     int nmag_alloc;		// number of moments currently allocated
213     float mag_matrix[3][3];	// transformation between magnetic and nuclear cell
214     struct arrow_struct *arrows;	// place to allocate arrow space
215 
216 // polyhedra parameters
217 
218     int npoly;			// number of different types of polyhedra
219     int npoly_alloc;		// number of polyhedra that have been allocated
220     float polylimit;		// should be close to zero to allow only regular polygonal faces
221     struct poly_struct *polyhedra;	// place to allocate polyhedra space
222     char col_edge[40];		// default color for edge
223     float rad_edge;		// default radius for edge
224     int nedges;			// number of different edge settings
225     int nedge_alloc;		// number of edge parameter sets currently allocated
226     struct edge_struct *polyedges;
227 
228 // plane parameters
229 
230     int nplane;			// number of different types of planes
231     int nplane_alloc;		// number of planes allocated
232     struct plane_struct *planes;	// place to allocate space for planes
233 
234 // bond parameters
235 
236     int nbond;			// number of different types of bonds
237     int nbond_alloc;		// number of bond types allocated
238     struct bond_struct *bonds;	// pointer to bond storage
239     float Bond_Mult;		// Multiplier for Bond Size
240     float BndMult;		// Bond multiplier initialization
241     float mol_d;		// intramolecular distance for molecular and polyhedral completion
242 
243 // sphere parameters
244 
245     int nsphere;		// number of different types of spheres
246     int nsphere_alloc;		// number allocated
247     struct sphere_struct *spheres;	// pointer to sphere allocation
248     float Sphere_Mult;		// Multiplier for Sphere Size
249     float SpMult;		// initialization for Sphere_Mult
250 
251 
252 // background parameters
253 
254     char col_bg[40];		// Background color in POV file
255     float glback[3];		// Background RGB values for openGL
256 
257 // ellipsoid parameters
258 
259     int auto_ellipse;		// true if ellipsoids should be automatically generated
260     struct ellips_struct *ellips;	// pointer to where ellipsoid data are stored
261     int ellips_alloc;		// number of ellipsoids allocated
262     float Phong_Value;		// reflectivity value for Phong highlighting
263     float Phong_Size;		// Phong highlighting size
264     char Cutout_color[40];	// color of cutout section
265     char Ellipaxis_color[40];	/* color of principal axes */
266     int n_ellips;		// no. of aniso. atoms in asymmetric unit
267     int do_ellipsoids;		// non-zero if ellipsoids to be drawn
268     int El_Cutout;		// True if ellipsoids to have an octant removed
269     float Ellipsoid_Prob;	/* Fraction of electron dens enclosed by ellipsoid */
270     float Ellipsoid_Scale;	/* Scaling needed to get probability */
271     float Ellipaxis_width;	/* linewidth of principal axes */
272 
273 // text label parameters
274 
275     int nlabel;			// number of textual labels
276     int nlabel_alloc;		// amount of space allocated
277     struct label_struct *labels;	// pointer to label storage
278     float saved_x_label[2][4][3];	// place to save coordinates of each type of label
279     int labels_inited;		// set to true when labels initialized
280     int triple[4];		// label numbers of the parts of the triple vector
281     int autolabel;		// set to true when import adds atom labels
282 
283 // least squares plane parameters
284 
285     int nbplane;		// number of least squares planes
286     int nbplane_alloc;		// number of least-squares planes allocated
287     struct bplane_struct *bplanes;	// pointer to allocated storage
288 
289 // miscellaneous variables
290 
291     double Old_Xrot;		// Used to determine if str file changed
292     double Old_Yrot;		// Used to determine if str file changed
293     double Old_Zrot;		// Used to determine if str file changed
294     float cur_step;		// Graphics cursor step size
295     int cur_reset;		//
296     char *table;		// used to store miscellaneous character data
297     char *msgbuffer	;	// used to accumulate warning messages
298 
299 // Fourier Map parameters
300 
301     int numOfFourierContours;
302     int num_Fourier_alloc;	// number allocated
303     struct map_struct *fourier;	// pointer to dynamic Fourier storage
304     bool Fourier2d;		// true if 2d Fourier
305     int Slice;			// >0 if 2d slice through 3d set
306     float mapslice[3];		// coordinates of a point in the slice plane
307     float mapnorm[3];		// normal of the 2d slice plane
308     float mapplane[4];		// parameters of plane equation
309 
310 // Bader Surface parameters
311 
312 #define MAX_SURF 5
313     int nsurf;
314     char surfatom[MAX_SURF][5];
315     char surfcolor[MAX_SURF][40];
316     char surffile[MAX_SURF][255];
317     int surfnum[MAX_SURF];
318     int surftype[MAX_SURF];
319     int ntet[MAX_SURF];
320     int nphi[MAX_SURF];
321     float *surfx[MAX_SURF];
322     float *surfy[MAX_SURF];
323     float *surfz[MAX_SURF];
324 
325 // atomic property parameters
326 
327     int natprop;		// number of different types of property definitions
328     int natprop_alloc;		// number allocated
329     struct atprop_struct *atprops;	// pointer to allocation
330 
331 // void or solvent accessible surface parameters
332     char ***voidmap;
333     int voidgrid[3];
334     float probesize;
335     char voidcolor[40];
336     signed char voidflag;
337     char *voiddata1;
338     char *voiddata2;
339 
340 // frame variables
341 
342     int frame_no;		// number of frame being processed
343     int max_frame;		// maximum number of frames used
344     int frame_alloc;		// number of frames allocated
345     struct frame_struct *frames;	// pointer to frame data
346 
347 // file variables
348 
349     FILE *fpin, *flout;
350     FILE *fpoutv;
351     FILE *fpoutp;
352     FILE *fpouta;
353     FILE *fcns;
354     char Cur_Console[1024];	// file strings
355     char Cur_Dir[1024];
356     char Cur_File[1024];
357     char Cur_Temp[1024];
358     char Cur_Listing[1024];
359     char Cur_Root[1024];
360     char DRAWxtl_Path[1024];
361     char EditName[1024];
362     char FileViewName[1024];
363     char POV_Include[1024];
364     char POV_Options[1024];
365     char POV_Path[1024];
366     char MSMS_Path[1024];
367     char Mencoder_Path[1024];
368     char FFmpeg_Path[1024];
369     char DefaultFinish[1024];
370     char VRML_Path[1024];
371     char LoadOnStartup[128];
372     char ProgramPath[1024];
373 };
374 
375 #endif
376