File: PyMOLGlobals.h

package info (click to toggle)
pymol 3.1.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 74,084 kB
  • sloc: cpp: 482,660; python: 89,328; ansic: 29,512; javascript: 6,792; sh: 84; makefile: 25
file content (229 lines) | stat: -rw-r--r-- 6,037 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229


/* 
A* -------------------------------------------------------------------
B* This file contains source code for the PyMOL computer program
C* Copyright (c) Schrodinger, LLC. 
D* -------------------------------------------------------------------
E* It is unlawful to modify or remove this copyright notice.
F* -------------------------------------------------------------------
G* Please see the accompanying LICENSE file for further information. 
H* -------------------------------------------------------------------
I* Additional authors of this source file include:
-* 
-* 
-*
Z* -------------------------------------------------------------------
*/
#ifndef _H_PyMOLGlobals
#define _H_PyMOLGlobals

namespace pymol
{
class cif_file;
class cif_data;
}; // namespace pymol

/* retina scale factor for ortho gui */
extern int _gScaleFactor;
inline int DIP2PIXEL(int v) { return v * _gScaleFactor; }
inline float DIP2PIXEL(float v) { return v * _gScaleFactor; }

/* all of the private singleton classes associated with a PyMOL instance */


/* this gets included in virtually every PyMOL source file, so keep it
   short and sweet */

typedef int lexidx_t;
typedef int lexborrow_t;


constexpr unsigned int OrthoLineLength = 1024u;
using OrthoLineType = char[OrthoLineLength];

constexpr unsigned int WordLength = 256u;
using WordType = char[WordLength];

using SelectorID_t = int;
using SelectorMemberOffset_t = int;

using StateIndex_t = int; ///< 0-based state index (C/C++/JavaScript)
using StateIndexPython_t = int; ///< 1-based state index (Python/Settings)

constexpr StateIndex_t cStateAll = -1;
constexpr StateIndex_t cStateCurrent = -2;

typedef struct _CMemoryCache CMemoryCache;
struct CIsosurf;
typedef struct _CTetsurf CTetsurf;
typedef struct _CSphere CSphere;
class CFeedback;
typedef struct _CUtil CUtil;
struct CColor;
struct CMovie;
struct CControl;
struct CButMode;
class COrtho;
typedef struct _CWord CWord;
struct CCGORenderer;
typedef struct _CCharacter CCharacter;
struct CPop;
class CScene;
struct CSeq;
struct CSetting;
struct CSettingUnique;
struct CText;
struct CWizard;
struct CAtomInfo;
typedef struct _CSculptCache CSculptCache;
typedef struct _CVFont CVFont;
typedef struct _CEditor CEditor;
struct CExecutive;
struct CSeeker;
struct CSelector;
struct CSelectorManager;
struct CTexture;
typedef struct _CType CType;
typedef struct _CMain CMain;
struct CPlugIOManager;
struct COpenVR;
struct ObjectMolecule;

class CShaderMgr;
class CMovieScenes;

#ifndef _PYMOL_NOPY
typedef struct _CP_inst CP_inst;
#endif

#ifndef OVLexicon_DEFINED
typedef struct _OVLexicon OVLexicon;
#define OVLexicon_DEFINED
#endif

#ifndef CPyMOLOptions_DEFINED
typedef struct _CPyMOLOptions CPyMOLOptions;
#define CPyMOLOptions_DEFINED
#endif

#ifndef OVCONTEXT_DEFINED
typedef struct _OVContext OVContext;
#define OVCONTEXT_DEFINED
#endif

#ifndef CPyMOL_DEFINED
struct CPyMOL;
#define CPyMOL_DEFINED
#endif

#ifndef CGO_DEFINED
class CGO;
#define CGO_DEFINED
#endif

class GFXManager;

#define cPyMOLGlobals_LaunchStatus_StereoFailed 0x1
#define cPyMOLGlobals_LaunchStatus_MultisampleFailed 0x2

struct PyMOLGlobals {

  /* singleton objects */

  CMemoryCache *MemoryCache;    /* could probably eliminate this... */
  CIsosurf *Isosurf;
  CTetsurf *Tetsurf;
  CSphere *Sphere;
  CFeedback *Feedback;
  CUtil *Util;
  CColor *Color;
  CMovie *Movie;
  CControl *Control;
  CButMode *ButMode;
  COrtho *Ortho;
  CWord *Word;
  CCGORenderer *CGORenderer;
  CCharacter *Character;
  CPop *Pop;
  CScene *Scene;
  CGO *DebugCGO;                /* for debugging rendering */
  CSeq *Seq;
  CSetting *Setting, *Default;
  CSettingUnique *SettingUnique;
  CText *Text;
  CWizard *Wizard;
  CAtomInfo *AtomInfo;
  CSculptCache *SculptCache;
  CVFont *VFont;
  CEditor *Editor;
  CExecutive *Executive;
  CSeeker *Seeker;
  CSelectorManager* SelectorMgr;
  CSelector *Selector;
  CTexture *Texture;
  CType *Type;
  OVContext *Context;
  CMain *Main;                  /* host/platform-specific "main" code */
  CPyMOLOptions *Option;
  CPyMOL *PyMOL;                /* the instance */
  OVLexicon *Lexicon;           /* lexicon for data (e.g. label) strings */
  CPlugIOManager *PlugIOManager;
  CShaderMgr* ShaderMgr;
  COpenVR* OpenVR;
  GFXManager* GFXMgr;
#ifndef _PYMOL_NOPY
  CP_inst *P_inst;
#endif

  /* global variables */

  int HaveGUI;                  /* do we have an OpenGL graphics window or are we
                                 * command-line only? */

  int ValidContext;             /* are we guaranteed to have a valid OpenGL
                                 * context at this exact moment? */

  int Ready;                    /* is the program fully initialized and ready to receive
                                 * messages? */

  int Interrupt;                /* set when we are attempting to abort time-consuming calculations */

  int Terminating;              /* is the program shutting down? */

  /* note that the following four options are also contained in
   * PyMOLOption global -- they exist here as independent globals only
   * because changes haven't yet been made throughout code */

  int StereoCapable;            /* the current graphics context quad buffered? */

  int LaunchStatus;             /* to enable deferred output regarding launch status */

  int Security;                 /* do we warn before potentially executing any
                                 * Python code and ask for their informed consent? */

  int DragDirtyFlag;            /* do we need an extra callback to handle a mouse drag? */

#ifdef _PYMOL_LIB
  void *CallbackObject;
  void (*enabledCallback)(void *, const char *, int );
#endif

  // user defined scenes
  CMovieScenes * scenes;

  struct { lexidx_t
#include "lex_constants.h"
    _; } lex_const;
};


/* if we're running PyMOL as a global singleton (old way / backward
   compatible) then this global variable will contain a pointer to
   PyMOL global state variables */

#ifndef _PYMOL_NOPY
extern PyMOLGlobals *SingletonPyMOLGlobals;
#endif

#endif