Editor.cpp (pymol-v1.8.6.0.tar.bz2) | : | Editor.cpp (pymol-v2.1.0.tar.bz2) | ||
---|---|---|---|---|
skipping to change at line 401 | skipping to change at line 401 | |||
} | } | |||
int EditorIsBondMode(PyMOLGlobals * G) | int EditorIsBondMode(PyMOLGlobals * G) | |||
{ | { | |||
CEditor *I = G->Editor; | CEditor *I = G->Editor; | |||
return (I->BondMode); | return (I->BondMode); | |||
} | } | |||
PyObject *EditorAsPyList(PyMOLGlobals * G) | PyObject *EditorAsPyList(PyMOLGlobals * G) | |||
{ | { | |||
#ifdef _PYMOL_NOPY | ||||
return NULL; | ||||
#else | ||||
PyObject *result = NULL; | PyObject *result = NULL; | |||
CEditor *I = G->Editor; | CEditor *I = G->Editor; | |||
if(!EditorActive(G)) { | if(!EditorActive(G)) { | |||
result = PyList_New(0); /* not editing? return null list */ | result = PyList_New(0); /* not editing? return null list */ | |||
} else { | } else { | |||
result = PyList_New(3); | result = PyList_New(3); | |||
PyList_SetItem(result, 0, PyString_FromString("")); | PyList_SetItem(result, 0, PyString_FromString("")); | |||
PyList_SetItem(result, 1, PyInt_FromLong(I->ActiveState)); | PyList_SetItem(result, 1, PyInt_FromLong(I->ActiveState)); | |||
PyList_SetItem(result, 2, PyInt_FromLong(I->BondMode)); | PyList_SetItem(result, 2, PyInt_FromLong(I->BondMode)); | |||
} | } | |||
return (PConvAutoNone(result)); | return (PConvAutoNone(result)); | |||
#endif | ||||
} | } | |||
int EditorFromPyList(PyMOLGlobals * G, PyObject * list) | int EditorFromPyList(PyMOLGlobals * G, PyObject * list) | |||
{ | { | |||
#ifdef _PYMOL_NOPY | ||||
return 0; | ||||
#else | ||||
int ok = true; | int ok = true; | |||
int active_flag = false; | int active_flag = false; | |||
int active_state; | int active_state; | |||
WordType obj_name; | WordType obj_name; | |||
int ll = 0; | int ll = 0; | |||
int bond_mode = true; | int bond_mode = true; | |||
if(ok) | if(ok) | |||
ok = (list != NULL); | ok = (list != NULL); | |||
if(ok) | if(ok) | |||
skipping to change at line 462 | skipping to change at line 454 | |||
EditorActivate(G, active_state, bond_mode); | EditorActivate(G, active_state, bond_mode); | |||
EditorDefineExtraPks(G); | EditorDefineExtraPks(G); | |||
} else { | } else { | |||
EditorInactivate(G); | EditorInactivate(G); | |||
} | } | |||
} | } | |||
if(!ok) { | if(!ok) { | |||
EditorInactivate(G); | EditorInactivate(G); | |||
} | } | |||
return (ok); | return (ok); | |||
#endif | ||||
} | } | |||
int EditorActive(PyMOLGlobals * G) | int EditorActive(PyMOLGlobals * G) | |||
{ | { | |||
CEditor *I = G->Editor; | CEditor *I = G->Editor; | |||
return (I->Active); | return (I->Active); | |||
} | } | |||
CObject *EditorDragObject(PyMOLGlobals * G) | CObject *EditorDragObject(PyMOLGlobals * G) | |||
{ | { | |||
skipping to change at line 912 | skipping to change at line 903 | |||
} | } | |||
} | } | |||
} | } | |||
/*========================================================================*/ | /*========================================================================*/ | |||
void EditorAttach(PyMOLGlobals * G, const char *elem, int geom, int valence, | void EditorAttach(PyMOLGlobals * G, const char *elem, int geom, int valence, | |||
const char *name, int quiet) | const char *name, int quiet) | |||
{ | { | |||
int i0; | int i0; | |||
int sele0, sele1; | int sele0, sele1; | |||
int state; | ||||
AtomInfoType *ai; | AtomInfoType *ai; | |||
ObjectMolecule *obj0 = NULL, *obj1 = NULL; | ObjectMolecule *obj0 = NULL, *obj1 = NULL; | |||
int ok = true; | int ok = true; | |||
ai = (AtomInfoType *) VLAMalloc(1, sizeof(AtomInfoType), 1, true); | ai = (AtomInfoType *) VLAMalloc(1, sizeof(AtomInfoType), 1, true); | |||
if(EditorActive(G)) { | if(EditorActive(G)) { | |||
sele0 = SelectorIndexByName(G, cEditorSele1); | sele0 = SelectorIndexByName(G, cEditorSele1); | |||
if(sele0 >= 0) { | if(sele0 >= 0) { | |||
sele1 = SelectorIndexByName(G, cEditorSele2); | sele1 = SelectorIndexByName(G, cEditorSele2); | |||
obj0 = SelectorGetFastSingleObjectMolecule(G, sele0); | obj0 = SelectorGetFastSingleObjectMolecule(G, sele0); | |||
obj1 = SelectorGetFastSingleObjectMolecule(G, sele1); | obj1 = SelectorGetFastSingleObjectMolecule(G, sele1); | |||
if(obj0) { | if(obj0) { | |||
if(obj0->DiscreteFlag) { | if(obj0->DiscreteFlag) { | |||
ErrMessage(G, "Remove", "Can't attach atoms onto discrete objects."); | ErrMessage(G, "Remove", "Can't attach atoms onto discrete objects."); | |||
} else { | } else { | |||
ObjectMoleculeVerifyChemistry(obj0, -1); /* remember chemistry fo r later */ | ObjectMoleculeVerifyChemistry(obj0, -1); /* remember chemistry fo r later */ | |||
state = SceneGetState(G); | ||||
if(obj1) { | if(obj1) { | |||
if(obj0 == obj1) { | if(obj0 == obj1) { | |||
/* bond mode - behave like replace */ | /* bond mode - behave like replace */ | |||
EditorReplace(G, elem, geom, valence, name, quiet); | EditorReplace(G, elem, geom, valence, name, quiet); | |||
} | } | |||
} else { | } else { | |||
/* atom mode */ | /* atom mode */ | |||
i0 = ObjectMoleculeGetAtomIndex(obj0, sele0); /* slow */ | i0 = ObjectMoleculeGetAtomIndex(obj0, sele0); /* slow */ | |||
if(i0 >= 0) { | if(i0 >= 0) { | |||
UtilNCopy(ai->elem, elem, sizeof(ElemName)); | UtilNCopy(ai->elem, elem, sizeof(ElemName)); | |||
skipping to change at line 1086 | skipping to change at line 1075 | |||
ExecutiveFixHydrogens(G, sele, quiet); | ExecutiveFixHydrogens(G, sele, quiet); | |||
} | } | |||
} | } | |||
/*========================================================================*/ | /*========================================================================*/ | |||
void EditorReplace(PyMOLGlobals * G, const char *elem, int geom, int valence, co nst char *name, | void EditorReplace(PyMOLGlobals * G, const char *elem, int geom, int valence, co nst char *name, | |||
int quiet) | int quiet) | |||
{ | { | |||
int i0; | int i0; | |||
int sele0; | int sele0; | |||
int state; | ||||
AtomInfoType ai; | AtomInfoType ai; | |||
ObjectMolecule *obj0 = NULL; | ObjectMolecule *obj0 = NULL; | |||
int ok = true; | int ok = true; | |||
UtilZeroMem(&ai, sizeof(AtomInfoType)); | UtilZeroMem(&ai, sizeof(AtomInfoType)); | |||
if(EditorActive(G)) { | if(EditorActive(G)) { | |||
sele0 = SelectorIndexByName(G, cEditorSele1); | sele0 = SelectorIndexByName(G, cEditorSele1); | |||
obj0 = SelectorGetFastSingleObjectMolecule(G, sele0); | obj0 = SelectorGetFastSingleObjectMolecule(G, sele0); | |||
if(obj0->DiscreteFlag) { | if(obj0->DiscreteFlag) { | |||
ErrMessage(G, "Remove", "Can't attach atoms onto discrete objects."); | ErrMessage(G, "Remove", "Can't attach atoms onto discrete objects."); | |||
} else { | } else { | |||
ObjectMoleculeVerifyChemistry(obj0, -1); /* remember chemistry for later */ | ObjectMoleculeVerifyChemistry(obj0, -1); /* remember chemistry for later */ | |||
state = SceneGetState(G); | ||||
if(sele0 >= 0) { | if(sele0 >= 0) { | |||
i0 = ObjectMoleculeGetAtomIndex(obj0, sele0); /* slow */ | i0 = ObjectMoleculeGetAtomIndex(obj0, sele0); /* slow */ | |||
if(i0 >= 0) { | if(i0 >= 0) { | |||
UtilNCopy(ai.elem, elem, sizeof(ElemName)); | UtilNCopy(ai.elem, elem, sizeof(ElemName)); | |||
if(name[0]) | if(name[0]) | |||
LexAssign(G, ai.name, name); | LexAssign(G, ai.name, name); | |||
ai.geom = geom; | ai.geom = geom; | |||
ai.valence = valence; | ai.valence = valence; | |||
if (ok) | if (ok) | |||
ok &= ObjectMoleculePrepareAtom(obj0, i0, &ai); | ok &= ObjectMoleculePrepareAtom(obj0, i0, &ai); | |||
skipping to change at line 1560 | skipping to change at line 1545 | |||
if(EditorActive(G)) { | if(EditorActive(G)) { | |||
int use_shader = SettingGetGlobal_b(G, cSetting_use_shaders); | int use_shader = SettingGetGlobal_b(G, cSetting_use_shaders); | |||
if (use_shader){ | if (use_shader){ | |||
if (!I->shaderCGO){ | if (!I->shaderCGO){ | |||
shaderCGO = CGONew(G); | shaderCGO = CGONew(G); | |||
} else { | } else { | |||
CGORenderGL(I->shaderCGO, NULL, NULL, NULL, NULL, NULL); | CGORenderGL(I->shaderCGO, NULL, NULL, NULL, NULL, NULL); | |||
return; | return; | |||
} | } | |||
} else if (I->shaderCGO) { | } else { | |||
CGOFree(I->shaderCGO); | CGOFree(I->shaderCGO); | |||
I->shaderCGO = NULL; | ||||
} | } | |||
PRINTFD(G, FB_Editor) | PRINTFD(G, FB_Editor) | |||
" EditorRender-Debug: rendering...\n" ENDFD; | " EditorRender-Debug: rendering...\n" ENDFD; | |||
if(G->HaveGUI && G->ValidContext) { | if(G->HaveGUI && G->ValidContext) { | |||
sele1 = SelectorIndexByName(G, cEditorSele1); | sele1 = SelectorIndexByName(G, cEditorSele1); | |||
sele2 = SelectorIndexByName(G, cEditorSele2); | sele2 = SelectorIndexByName(G, cEditorSele2); | |||
sele3 = SelectorIndexByName(G, cEditorSele3); | sele3 = SelectorIndexByName(G, cEditorSele3); | |||
skipping to change at line 2380 | skipping to change at line 2364 | |||
/*========================================================================*/ | /*========================================================================*/ | |||
void EditorFree(PyMOLGlobals * G) | void EditorFree(PyMOLGlobals * G) | |||
{ | { | |||
CEditor *I = G->Editor; | CEditor *I = G->Editor; | |||
VLAFreeP(I->PosVLA); | VLAFreeP(I->PosVLA); | |||
FreeP(G->Editor); | FreeP(G->Editor); | |||
} | } | |||
void EditorInvalidateShaderCGO(PyMOLGlobals * G){ | void EditorInvalidateShaderCGO(PyMOLGlobals * G){ | |||
CEditor *I = G->Editor; | CEditor *I = G->Editor; | |||
if (I->shaderCGO){ | CGOFree(I->shaderCGO); | |||
CGOFree(I->shaderCGO); | ||||
I->shaderCGO = NULL; | ||||
} | ||||
} | } | |||
End of changes. 11 change blocks. | ||||
21 lines changed or deleted | 2 lines changed or added |