1 2 /* 3 A* ------------------------------------------------------------------- 4 B* This file contains source code for the PyMOL computer program 5 C* copyright 1998-2000 by Warren Lyford Delano of DeLano Scientific. 6 D* ------------------------------------------------------------------- 7 E* It is unlawful to modify or remove this copyright notice. 8 F* ------------------------------------------------------------------- 9 G* Please see the accompanying LICENSE file for further information. 10 H* ------------------------------------------------------------------- 11 I* Additional authors of this source file include: 12 -* 13 -* 14 -* 15 Z* ------------------------------------------------------------------- 16 */ 17 #ifndef _H_Rep 18 #define _H_Rep 19 20 #include"Base.h" 21 #include"Ray.h" 22 23 #define cCartoon_skip -1 24 #define cCartoon_auto 0 25 #define cCartoon_loop 1 26 #define cCartoon_rect 2 27 #define cCartoon_oval 3 28 #define cCartoon_tube 4 29 #define cCartoon_arrow 5 30 #define cCartoon_dumbbell 6 31 #define cCartoon_putty 7 32 #define cCartoon_dash 8 33 34 #define cCartoon_skip_helix -2 35 #define cRepAll -1 36 #define cRepNone -2 37 38 // show/hide/... codes 39 enum { 40 cVis_HIDE, // 0 41 cVis_SHOW, // 1 42 cVis_AS, // 2 43 cVis_TOGGLE, // 3 44 }; 45 46 /* WARNING: don't change these -- you'll break sessions! 47 (you can add to them however, I think) */ 48 49 enum { 50 cRepCyl, // 0 51 cRepSphere, // 1 52 cRepSurface, // 2 53 cRepLabel, // 3 54 cRepNonbondedSphere, // 4 55 cRepCartoon, // 5 56 cRepRibbon, // 6 57 cRepLine, // 7 58 cRepMesh, // 8 59 cRepDot, // 9 60 cRepDash, // 10 61 cRepNonbonded, // 11 62 cRepCell, // 12 63 cRepCGO, // 13 64 cRepCallback, // 14 65 cRepExtent, // 15 66 cRepSlice, // 16 67 cRepAngle, // 17 68 cRepDihedral, // 18 69 cRepEllipsoid, // 19 70 cRepVolume, // 20 71 // rep count 72 cRepCnt 73 }; 74 75 #define cRepCylBit (1 << 0) 76 #define cRepSphereBit (1 << 1) 77 #define cRepSurfaceBit (1 << 2) 78 #define cRepLabelBit (1 << 3) 79 #define cRepNonbondedSphereBit (1 << 4) 80 #define cRepCartoonBit (1 << 5) 81 #define cRepRibbonBit (1 << 6) 82 #define cRepLineBit (1 << 7) 83 #define cRepMeshBit (1 << 8) 84 #define cRepDotBit (1 << 9) 85 #define cRepDashBit (1 << 10) 86 #define cRepNonbondedBit (1 << 11) 87 #define cRepCellBit (1 << 12) 88 #define cRepCGOBit (1 << 13) 89 #define cRepCallbackBit (1 << 14) 90 #define cRepExtentBit (1 << 15) 91 #define cRepSliceBit (1 << 16) 92 #define cRepAngleBit (1 << 17) 93 #define cRepDihedralBit (1 << 18) 94 #define cRepEllipsoidBit (1 << 19) 95 #define cRepVolumeBit (1 << 20) 96 97 /* Add other reps here. Don't forget to 98 * update modules/constants.py::repres{} 99 * update modules/constants.py::fb_module, if needed 100 * update modules/viewing.py::rep_list 101 * create your RepXYZ.h and RepXYZ.c 102 */ 103 104 #define cRepBitmask ((1 << cRepCnt) - 1) 105 106 // all reps which can be shown for atoms 107 const int cRepsAtomMask = (cRepCylBit | cRepSphereBit | cRepSurfaceBit | \ 108 cRepLabelBit | cRepNonbondedSphereBit | cRepCartoonBit | cRepRibbonBit | \ 109 cRepLineBit | cRepMeshBit | cRepDotBit | cRepNonbondedBit | cRepEllipsoidBit); 110 111 // all reps which can be shown for objects 112 const int cRepsObjectMask = (cRepSurfaceBit | cRepMeshBit | cRepDotBit | \ 113 cRepCellBit | cRepCGOBit | cRepCallbackBit | cRepExtentBit | cRepSliceBit | \ 114 cRepAngleBit | cRepDihedralBit | cRepVolumeBit | cRepDashBit); 115 116 /* Hierarchical invalidation scheme - 117 * each higher level event implies all of the lower levels 118 * These used to be used just for graphics, but are now 119 * used by the molecular editor as well */ 120 121 122 /* invalite display (list) */ 123 124 #define cRepInvDisplay 1 125 126 /* precomputed extents (can change if matrix changes) */ 127 #define cRepInvExtents 5 128 129 /* invalidate pickable atoms */ 130 #define cRepInvPick 9 131 132 /* invalidate external atom colors */ 133 #define cRepInvExtColor 10 134 135 /* invalidate atom colors */ 136 #define cRepInvColor 15 137 138 /* invalidate label text */ 139 #define cRepInvText 16 140 141 /* invalidate visible atoms */ 142 #define cRepInvVisib 20 143 #define cRepInvVisib2 21 144 145 /* invalidate atomic properties */ 146 #define cRepInvProp 22 147 148 /* invalidate coordinates */ 149 #define cRepInvCoord 30 150 151 /* invalidate graphic representation */ 152 #define cRepInvRep 35 153 154 /* don't call ObjectMoleculeUpdateNonbonded */ 155 #define cRepInvBondsNoNonbonded 38 156 157 /* invalidate bond structure */ 158 #define cRepInvBonds 40 159 160 /* invalidate atomic structure */ 161 #define cRepInvAtoms 50 162 163 /* invalidate everything about a structure */ 164 #define cRepInvAll 100 165 166 /* invalidate and furthermore, purge existing representations */ 167 #define cRepInvPurge 110 168 169 struct CoordSet; 170 struct Object; 171 172 typedef struct Rep { 173 PyMOLGlobals *G; 174 void (*fRender) (struct Rep * I, RenderInfo * info); 175 struct Rep *(*fUpdate) (struct Rep * I, struct CoordSet * cs, int state, int rep); 176 void (*fInvalidate) (struct Rep * I, struct CoordSet * cs, int level); 177 void (*fFree) (struct Rep * I); 178 int MaxInvalid, Active; 179 CObject *obj; 180 struct CoordSet *cs; 181 Pickable *P; 182 PickContext context; 183 /* private */ 184 void (*fRecolor) (struct Rep * I, struct CoordSet * cs); 185 int (*fSameVis) (struct Rep * I, struct CoordSet * cs); 186 int (*fSameColor) (struct Rep * I, struct CoordSet * cs); 187 struct Rep *(*fRebuild) (struct Rep * I, struct CoordSet * cs, int state, int rep); 188 struct Rep *(*fNew) (struct CoordSet * cs, int state); 189 } Rep; 190 191 void RepInit(PyMOLGlobals * G, Rep * I); 192 void RepPurge(Rep * I); 193 void RepInvalidate(struct Rep *I, struct CoordSet *cs, int level); 194 195 int RepGetAutoShowMask(PyMOLGlobals * G); 196 197 class RepIterator { 198 int end; 199 200 public: 201 int rep; 202 203 RepIterator(PyMOLGlobals * G, int rep_); 204 next()205 bool next() { 206 return (++rep < end); 207 }; 208 }; 209 210 #endif 211