1 
2 
3 /*
4 A* -------------------------------------------------------------------
5 B* This file contains source code for the PyMOL computer program
6 C* Copyright (c) Schrodinger, LLC.
7 D* -------------------------------------------------------------------
8 E* It is unlawful to modify or remove this copyright notice.
9 F* -------------------------------------------------------------------
10 G* Please see the accompanying LICENSE file for further information.
11 H* -------------------------------------------------------------------
12 I* Additional authors of this source file include:
13 -*
14 -*
15 -*
16 Z* -------------------------------------------------------------------
17 */
18 #ifndef _H_PyMOLGlobals
19 #define _H_PyMOLGlobals
20 
21 namespace pymol
22 {
23 class cif_file;
24 class cif_data;
25 }; // namespace pymol
26 
27 /* retina scale factor for ortho gui */
28 extern int _gScaleFactor;
DIP2PIXEL(int v)29 inline int DIP2PIXEL(int v) { return v * _gScaleFactor; }
DIP2PIXEL(float v)30 inline float DIP2PIXEL(float v) { return v * _gScaleFactor; }
31 
32 /* all of the private singleton classes associated with a PyMOL instance */
33 
34 
35 /* this gets included in virtually every PyMOL source file, so keep it
36    short and sweet */
37 
38 typedef int lexidx_t;
39 typedef int lexborrow_t;
40 
41 typedef struct _CMemoryCache CMemoryCache;
42 struct CIsosurf;
43 typedef struct _CTetsurf CTetsurf;
44 typedef struct _CSphere CSphere;
45 class CFeedback;
46 typedef struct _CUtil CUtil;
47 struct CColor;
48 struct CMovie;
49 struct CControl;
50 struct CButMode;
51 class COrtho;
52 typedef struct _CWord CWord;
53 typedef struct _CCGORenderer CCGORenderer;
54 typedef struct _CCharacter CCharacter;
55 struct CPop;
56 class CScene;
57 struct CSeq;
58 typedef struct _CSetting CSetting;
59 typedef struct _CSettingUnique CSettingUnique;
60 struct CText;
61 struct CWizard;
62 typedef struct _CAtomInfo CAtomInfo;
63 typedef struct _CSculptCache CSculptCache;
64 typedef struct _CVFont CVFont;
65 typedef struct _CEditor CEditor;
66 struct CExecutive;
67 typedef struct _CSeeker CSeeker;
68 struct CSelector;
69 struct CSelectorManager;
70 typedef struct _CTexture CTexture;
71 typedef struct _CType CType;
72 typedef struct _CMain CMain;
73 typedef struct _CPlugIOManager CPlugIOManager;
74 struct COpenVR;
75 struct ObjectMolecule;
76 
77 class CShaderMgr;
78 class CMovieScenes;
79 
80 #ifndef _PYMOL_NOPY
81 typedef struct _CP_inst CP_inst;
82 #endif
83 
84 #ifndef OVLexicon_DEFINED
85 typedef struct _OVLexicon OVLexicon;
86 #define OVLexicon_DEFINED
87 #endif
88 
89 #ifndef CPyMOLOptions_DEFINED
90 typedef struct _CPyMOLOptions CPyMOLOptions;
91 #define CPyMOLOptions_DEFINED
92 #endif
93 
94 #ifndef OVCONTEXT_DEFINED
95 typedef struct _OVContext OVContext;
96 #define OVCONTEXT_DEFINED
97 #endif
98 
99 #ifndef OVONETOONE_DEFINED
100 typedef struct _OVOneToOne OVOneToOne;
101 #define OVONETOONE_DEFINED
102 #endif
103 
104 
105 struct CObject;
106 
107 #ifndef CPyMOL_DEFINED
108 typedef struct _CPyMOL CPyMOL;
109 #define CPyMOL_DEFINED
110 #endif
111 
112 #ifndef CGO_DEFINED
113 class CGO;
114 #define CGO_DEFINED
115 #endif
116 
117 #define cPyMOLGlobals_LaunchStatus_StereoFailed 0x1
118 #define cPyMOLGlobals_LaunchStatus_MultisampleFailed 0x2
119 
120 typedef struct _PyMOLGlobals PyMOLGlobals;
121 struct _PyMOLGlobals {
122 
123   /* singleton objects */
124 
125   CMemoryCache *MemoryCache;    /* could probably eliminate this... */
126   CIsosurf *Isosurf;
127   CTetsurf *Tetsurf;
128   CSphere *Sphere;
129   CFeedback *Feedback;
130   CUtil *Util;
131   CColor *Color;
132   CMovie *Movie;
133   CControl *Control;
134   CButMode *ButMode;
135   COrtho *Ortho;
136   CWord *Word;
137   CCGORenderer *CGORenderer;
138   CCharacter *Character;
139   CPop *Pop;
140   CScene *Scene;
141   CGO *DebugCGO;                /* for debugging rendering */
142   CSeq *Seq;
143   CSetting *Setting, *Default;
144   CSettingUnique *SettingUnique;
145   CText *Text;
146   CWizard *Wizard;
147   CAtomInfo *AtomInfo;
148   CSculptCache *SculptCache;
149   CVFont *VFont;
150   CEditor *Editor;
151   CExecutive *Executive;
152   CSeeker *Seeker;
153   CSelectorManager* SelectorMgr;
154   CSelector *Selector;
155   CTexture *Texture;
156   CType *Type;
157   OVContext *Context;
158   CMain *Main;                  /* host/platform-specific "main" code */
159   CPyMOLOptions *Option;
160   CPyMOL *PyMOL;                /* the instance */
161   OVLexicon *Lexicon;           /* lexicon for data (e.g. label) strings */
162   CPlugIOManager *PlugIOManager;
163   CShaderMgr* ShaderMgr;
164   COpenVR* OpenVR;
165 
166 #ifndef _PYMOL_NOPY
167   CP_inst *P_inst;
168 #endif
169 
170   /* global variables */
171 
172   int HaveGUI;                  /* do we have an OpenGL graphics window or are we
173                                  * command-line only? */
174 
175   int ValidContext;             /* are we guaranteed to have a valid OpenGL
176                                  * context at this exact moment? */
177 
178   int Ready;                    /* is the program fully initialized and ready to receive
179                                  * messages? */
180 
181   int Interrupt;                /* set when we are attempting to abort time-consuming calculations */
182 
183   int Terminating;              /* is the program shutting down? */
184 
185   /* note that the following four options are also contained in
186    * PyMOLOption global -- they exist here as independent globals only
187    * because changes haven't yet been made throughout code */
188 
189   int StereoCapable;            /* the current graphics context quad buffered? */
190 
191   int LaunchStatus;             /* to enable deferred output regarding launch status */
192 
193   int Security;                 /* do we warn before potentially executing any
194                                  * Python code and ask for their informed consent? */
195 
196   int DragDirtyFlag;            /* do we need an extra callback to handle a mouse drag? */
197 
198 #ifdef _PYMOL_LIB
199   void *CallbackObject;
200   void (*enabledCallback)(void *, const char *, int );
201 #endif
202 
203   // user defined scenes
204   CMovieScenes * scenes;
205 
206   // for glDrawBuffer (e.g. GL_BACK, unless we're using QOpenGLWidget)
207   int DRAW_BUFFER0;
208 
209   struct { lexidx_t
210 #include "lex_constants.h"
211     _; } lex_const;
212 };
213 
214 
215 /* if we're running PyMOL as a global singleton (old way / backward
216    compatible) then this global variable will contain a pointer to
217    PyMOL global state variables */
218 
219 #ifndef _PYMOL_NOPY
220 extern PyMOLGlobals *SingletonPyMOLGlobals;
221 #endif
222 
223 #define ORTHOCGOARG , CGO *orthoCGO
224 #define ORTHOCGOARGB  orthoCGO
225 #define ORTHOCGOARGVAR , orthoCGO
226 #define ORTHOFASTCGOARGVAR , orthoFastCGO
227 #define ORTHOCGOARGNULL , NULL
228 
229 #endif
230