1 /* Copyright (C) 2000 Damir Zucic */
2 
3 /*=============================================================================
4 
5 				mono.c
6 
7 Purpose:
8 	Execute mono command.
9 
10 Input:
11 	(1) Pointer to MolComplexS structure.
12 	(2) The number of macromolecular complexes.
13 	(3) Pointer to RuntimeS structure.
14 	(4) Pointer to ConfigS structure.
15 	(5) Pointer to GUIS structure.
16 	(6) Pointer to NearestAtomS structure.
17 	(7) The number of pixels in the main window free area.
18 	(8) Pointer to refreshI.
19 
20 Output:
21 	(1) Stereo flag set.
22 	(2) Return value.
23 
24 Return value:
25 	(1) Positive (command) code on success.
26 	(2) Negative (error) code on failure.
27 
28 ========includes:============================================================*/
29 
30 #include <stdio.h>
31 
32 #include <X11/Xlib.h>
33 #include <X11/Xutil.h>
34 #include <X11/Xos.h>
35 #include <X11/Xatom.h>
36 
37 #include "defines.h"
38 #include "commands.h"
39 #include "typedefs.h"
40 
41 /*======function prototypes:=================================================*/
42 
43 int		CalculateParameters_ (ConfigS *, GUIS *);
44 size_t		MainRefresh_ (MolComplexS *, int,
45 			      RuntimeS *, ConfigS *, GUIS *,
46 			      NearestAtomS *, size_t, unsigned int);
47 int		ControlRefresh_ (MolComplexS *, ConfigS *, GUIS *);
48 
49 /*======execute mono command:================================================*/
50 
CommandMono_(MolComplexS * mol_complexSP,int mol_complexesN,RuntimeS * runtimeSP,ConfigS * configSP,GUIS * guiSP,NearestAtomS * nearest_atomSP,size_t pixelsN,unsigned int * refreshIP)51 int CommandMono_ (MolComplexS *mol_complexSP, int mol_complexesN,
52 		  RuntimeS *runtimeSP, ConfigS *configSP, GUIS *guiSP,
53 		  NearestAtomS *nearest_atomSP, size_t pixelsN,
54 		  unsigned int *refreshIP)
55 {
56 int		mol_complexI;
57 
58 /* Set mono mode: */
59 configSP->stereoF = 0;
60 
61 /* Refresh calculated parameters: */
62 if (CalculateParameters_ (configSP, guiSP) < 0) return ERROR_MONO;
63 
64 /* Set the position_changedF flag for each macromolecular complex: */
65 for (mol_complexI = 0; mol_complexI < mol_complexesN; mol_complexI++)
66 	{
67 	(mol_complexSP + mol_complexI)->position_changedF = 1;
68 	}
69 
70 /* Refresh the main window: */
71 (*refreshIP)++;
72 MainRefresh_ (mol_complexSP, mol_complexesN,
73 	      runtimeSP, configSP, guiSP,
74 	      nearest_atomSP, pixelsN, *refreshIP);
75 
76 /* Refresh the control window: */
77 ControlRefresh_ (mol_complexSP + runtimeSP->default_complexI, configSP, guiSP);
78 
79 /* Return the command code: */
80 return COMMAND_MONO;
81 }
82 
83 /*===========================================================================*/
84 
85 
86