PyMOL.cpp (pymol-open-source-2.2.0) | : | PyMOL.cpp (pymol-open-source-2.3.0) | ||
---|---|---|---|---|
skipping to change at line 30 | skipping to change at line 30 | |||
#include <clocale> | #include <clocale> | |||
#include "MemoryDebug.h" | #include "MemoryDebug.h" | |||
#include "Base.h" | #include "Base.h" | |||
#include "OVContext.h" | #include "OVContext.h" | |||
#include "MemoryDebug.h" | #include "MemoryDebug.h" | |||
#include "MemoryCache.h" | ||||
#include "Err.h" | #include "Err.h" | |||
#include "Util.h" | #include "Util.h" | |||
#include "Selector.h" | #include "Selector.h" | |||
#include "Color.h" | #include "Color.h" | |||
#include "Ortho.h" | #include "Ortho.h" | |||
#include "Scene.h" | #include "Scene.h" | |||
#include "PyMOLObject.h" | #include "PyMOLObject.h" | |||
#include "Executive.h" | #include "Executive.h" | |||
#include "Word.h" | #include "Word.h" | |||
#include "RepMesh.h" | #include "RepMesh.h" | |||
skipping to change at line 1526 | skipping to change at line 1525 | |||
} | } | |||
SelectorFreeTmp(I->G, s1); | SelectorFreeTmp(I->G, s1); | |||
PYMOL_API_UNLOCK return result; | PYMOL_API_UNLOCK return result; | |||
} | } | |||
/* | /* | |||
* Supported file formats and they internal codes | * Supported file formats and they internal codes | |||
*/ | */ | |||
struct { | struct { | |||
const char * name; | const char * name; | |||
int code_buffer; | cLoadType_t code_buffer; | |||
int code_filename; | cLoadType_t code_filename; | |||
} const ContentTypeTable[] = { | } const ContentTypeTable[] = { | |||
// molecules | // molecules | |||
{"pdb", cLoadTypePDBStr, cLoadTypePDB}, | {"pdb", cLoadTypePDBStr, cLoadTypePDB}, | |||
{"vdb", cLoadTypeVDBStr, -1}, | {"vdb", cLoadTypeVDBStr, cLoadTypeUnknown}, | |||
{"cif", cLoadTypeCIFStr, cLoadTypeCIF}, | {"cif", cLoadTypeCIFStr, cLoadTypeCIF}, | |||
{"mmtf", cLoadTypeMMTFStr, cLoadTypeMMTF}, | {"mmtf", cLoadTypeMMTFStr, cLoadTypeMMTF}, | |||
{"mae", cLoadTypeMAEStr, cLoadTypeMAE}, | {"mae", cLoadTypeMAEStr, cLoadTypeMAE}, | |||
{"sdf", cLoadTypeSDF2Str, cLoadTypeSDF2}, | {"sdf", cLoadTypeSDF2Str, cLoadTypeSDF2}, | |||
{"mol", cLoadTypeMOLStr, cLoadTypeMOL}, | {"mol", cLoadTypeMOLStr, cLoadTypeMOL}, | |||
{"mol2", cLoadTypeMOL2Str, cLoadTypeMOL2}, | {"mol2", cLoadTypeMOL2Str, cLoadTypeMOL2}, | |||
{"xyz", cLoadTypeXYZStr, cLoadTypeXYZ}, | {"xyz", cLoadTypeXYZStr, cLoadTypeXYZ}, | |||
{"pqr", -1, cLoadTypePQR}, | {"pqr", cLoadTypeUnknown, cLoadTypePQR}, | |||
{"macromodel", cLoadTypeMMDStr, cLoadTypeMMD}, | {"macromodel", cLoadTypeMMDStr, cLoadTypeMMD}, | |||
// maps | // maps | |||
{"ccp4", cLoadTypeCCP4Str, -1}, | {"ccp4", cLoadTypeCCP4Str, cLoadTypeUnknown}, | |||
{"xplor", cLoadTypeXPLORStr, cLoadTypeXPLORMap}, | {"xplor", cLoadTypeXPLORStr, cLoadTypeXPLORMap}, | |||
{"phi", cLoadTypePHIStr, cLoadTypePHIMap}, | {"phi", cLoadTypePHIStr, cLoadTypePHIMap}, | |||
{"dx", -1, cLoadTypeDXMap}, | {"dx", cLoadTypeUnknown, cLoadTypeDXMap}, | |||
// special | // special | |||
{"cgo", cLoadTypeCGO, -1}, | {"cgo", cLoadTypeCGO, cLoadTypeUnknown}, | |||
{NULL, -1, -1} | {NULL, cLoadTypeUnknown, cLoadTypeUnknown} | |||
}; | }; | |||
/* | /* | |||
* Proxy for "ExecutiveLoad" with string "content_format" (and "content_type") | * Proxy for "ExecutiveLoad" with string "content_format" (and "content_type") | |||
* argument. | * argument. | |||
* | * | |||
* content: Either file name or file contents, depending on "content_type" | * content: Either file name or file contents, depending on "content_type" | |||
* content_type: "filename", "string", "raw", or "cgo" | * content_type: "filename", "string", "raw", or "cgo" | |||
* content_length: Length of "content", if it's not a file name or a | * content_length: Length of "content", if it's not a file name or a | |||
* null-terminated string (pass -1). | * null-terminated string (pass -1). | |||
skipping to change at line 1621 | skipping to change at line 1620 | |||
q = obj_name; | q = obj_name; | |||
while(p < stop) { | while(p < stop) { | |||
*(q++) = *(p++); | *(q++) = *(p++); | |||
} | } | |||
*q = 0; | *q = 0; | |||
object_name = obj_name; | object_name = obj_name; | |||
} | } | |||
} | } | |||
} | } | |||
{ | { | |||
int pymol_content_type = cLoadTypeUnknown; | cLoadType_t pymol_content_type = cLoadTypeUnknown; | |||
for (auto it = ContentTypeTable; it->name; ++it) { | for (auto it = ContentTypeTable; it->name; ++it) { | |||
if (strcmp(it->name, content_format) == 0) { | if (strcmp(it->name, content_format) == 0) { | |||
pymol_content_type = content_is_filename ? | pymol_content_type = content_is_filename ? | |||
it->code_filename : it->code_buffer; | it->code_filename : it->code_buffer; | |||
break; | break; | |||
} | } | |||
} | } | |||
if (pymol_content_type == cLoadTypeUnknown) { | if (pymol_content_type == cLoadTypeUnknown) { | |||
skipping to change at line 2041 | skipping to change at line 2040 | |||
G->Lexicon = OVLexicon_New(G->Context->heap); | G->Lexicon = OVLexicon_New(G->Context->heap); | |||
if(OVreturn_IS_ERROR(PyMOL_InitAPI(I))) { | if(OVreturn_IS_ERROR(PyMOL_InitAPI(I))) { | |||
printf("ERROR: PyMOL internal C API initialization failed.\n"); | printf("ERROR: PyMOL internal C API initialization failed.\n"); | |||
} | } | |||
// global lexicon "constants" | // global lexicon "constants" | |||
#define LEX_CONSTANTS_IMPL | #define LEX_CONSTANTS_IMPL | |||
#include "lex_constants.h" | #include "lex_constants.h" | |||
MemoryCacheInit(G); | ||||
FeedbackInit(G, G->Option->quiet); | FeedbackInit(G, G->Option->quiet); | |||
WordInit(G); | WordInit(G); | |||
UtilInit(G); | UtilInit(G); | |||
ColorInit(G); | ColorInit(G); | |||
CGORendererInit(G); | CGORendererInit(G); | |||
ShaderMgrInit(G); | ShaderMgrInit(G); | |||
SettingInitGlobal(G, true, true, false); | SettingInitGlobal(G, true, true, false); | |||
SettingSetGlobal_i(G, cSetting_internal_gui, G->Option->internal_gui); | SettingSetGlobal_i(G, cSetting_internal_gui, G->Option->internal_gui); | |||
SettingSetGlobal_i(G, cSetting_internal_feedback, G->Option->internal_feedback ); | SettingSetGlobal_i(G, cSetting_internal_feedback, G->Option->internal_feedback ); | |||
TextureInit(G); | TextureInit(G); | |||
skipping to change at line 2145 | skipping to change at line 2143 | |||
#endif | #endif | |||
void PyMOL_Stop(CPyMOL * I) | void PyMOL_Stop(CPyMOL * I) | |||
{ | { | |||
PyMOLGlobals *G = I->G; | PyMOLGlobals *G = I->G; | |||
G->Terminating = true; | G->Terminating = true; | |||
TetsurfFree(G); | TetsurfFree(G); | |||
IsosurfFree(G); | IsosurfFree(G); | |||
WizardFree(G); | WizardFree(G); | |||
SceneCleanupStereo(G); | ||||
EditorFree(G); | EditorFree(G); | |||
ExecutiveFree(G); | ExecutiveFree(G); | |||
VFontFree(G); | VFontFree(G); | |||
SculptCacheFree(G); | SculptCacheFree(G); | |||
AtomInfoFree(G); | AtomInfoFree(G); | |||
ButModeFree(G); | ButModeFree(G); | |||
ControlFree(G); | ControlFree(G); | |||
SeekerFree(G); | SeekerFree(G); | |||
SeqFree(G); | SeqFree(G); | |||
SelectorFree(G); | SelectorFree(G); | |||
skipping to change at line 2174 | skipping to change at line 2171 | |||
TypeFree(G); | TypeFree(G); | |||
TextureFree(G); | TextureFree(G); | |||
SphereFree(G); | SphereFree(G); | |||
PlugIOManagerFree(G); | PlugIOManagerFree(G); | |||
PFree(G); | PFree(G); | |||
CGORendererFree(G); | CGORendererFree(G); | |||
ColorFree(G); | ColorFree(G); | |||
UtilFree(G); | UtilFree(G); | |||
WordFree(G); | WordFree(G); | |||
FeedbackFree(G); | FeedbackFree(G); | |||
MemoryCacheDone(G); | ||||
PyMOL_PurgeAPI(I); | PyMOL_PurgeAPI(I); | |||
/* printf("%d \n", OVLexicon_GetNActive(G->Lexicon)); */ | /* printf("%d \n", OVLexicon_GetNActive(G->Lexicon)); */ | |||
OVLexicon_Del(G->Lexicon); | OVLexicon_Del(G->Lexicon); | |||
OVContext_Del(G->Context); | OVContext_Del(G->Context); | |||
} | } | |||
void PyMOL_Free(CPyMOL * I) | void PyMOL_Free(CPyMOL * I) | |||
{ | { | |||
#if !defined(_PYMOL_ACTIVEX) && !defined(_MACPYMOL_XCODE) | #if !defined(_PYMOL_ACTIVEX) && !defined(_MACPYMOL_XCODE) | |||
skipping to change at line 2466 | skipping to change at line 2462 | |||
I->RedisplayFlag = false; | I->RedisplayFlag = false; | |||
OrthoBusyPrime(G); | OrthoBusyPrime(G); | |||
ExecutiveDrawNow(G); | ExecutiveDrawNow(G); | |||
if(I->ImageRequestedFlag) { | if(I->ImageRequestedFlag) { | |||
if(SceneHasImage(G)) { | if(SceneHasImage(G)) { | |||
I->ImageReadyFlag = true; | I->ImageReadyFlag = true; | |||
I->ImageRequestedFlag = false; | I->ImageRequestedFlag = false; | |||
{ | ||||
int w, h; | ||||
SceneGetImageSize(I->G, &w, &h); | ||||
} | ||||
} else { | } else { | |||
I->ImageReadyFlag = false; | I->ImageReadyFlag = false; | |||
} | } | |||
} else if(I->ImageReadyFlag) { | } else if(I->ImageReadyFlag) { | |||
if(!SceneHasImage(G)) | if(!SceneHasImage(G)) | |||
I->ImageReadyFlag = false; | I->ImageReadyFlag = false; | |||
} | } | |||
if(G->HaveGUI) | if(G->HaveGUI) | |||
PyMOL_PopValidContext(I); | PyMOL_PopValidContext(I); | |||
skipping to change at line 2657 | skipping to change at line 2648 | |||
I->SwapFlag = true; | I->SwapFlag = true; | |||
} | } | |||
void PyMOL_NeedReshape(CPyMOL * I, int mode, int x, int y, int width, int height ) | void PyMOL_NeedReshape(CPyMOL * I, int mode, int x, int y, int width, int height ) | |||
{ | { | |||
PyMOLGlobals *G = I->G; | PyMOLGlobals *G = I->G; | |||
if(width < 0) { | if(width < 0) { | |||
if (!G->HaveGUI) | if (!G->HaveGUI) | |||
return; | return; | |||
int h; | width = SceneGetBlock(G)->getWidth(); | |||
BlockGetSize(SceneGetBlock(G), &width, &h); | ||||
if(SettingGetGlobal_b(G, cSetting_internal_gui)) | if(SettingGetGlobal_b(G, cSetting_internal_gui)) | |||
width += DIP2PIXEL(SettingGetGlobal_i( G, cSetting_internal_gui_width)); | width += DIP2PIXEL(SettingGetGlobal_i( G, cSetting_internal_gui_width)); | |||
} | } | |||
/* if height is negative, force a reshape based on the current height */ | /* if height is negative, force a reshape based on the current height */ | |||
if(height < 0) { | if(height < 0) { | |||
int w; | ||||
int internal_feedback; | int internal_feedback; | |||
BlockGetSize(SceneGetBlock(G), &w, &height); | height = SceneGetBlock(G)->getHeight(); | |||
internal_feedback = SettingGetGlobal_i(G, cSetting_internal_feedback); | internal_feedback = SettingGetGlobal_i(G, cSetting_internal_feedback); | |||
if(internal_feedback) | if(internal_feedback) | |||
height += (internal_feedback - 1) * cOrthoLineHeight + cOrthoBottomSceneMa rgin; | height += (internal_feedback - 1) * cOrthoLineHeight + cOrthoBottomSceneMa rgin; | |||
if(SettingGetGlobal_b(G, cSetting_seq_view) | if(SettingGetGlobal_b(G, cSetting_seq_view) | |||
&& !SettingGetGlobal_b(G, cSetting_seq_view_overlay)) { | && !SettingGetGlobal_b(G, cSetting_seq_view_overlay)) { | |||
height += SeqGetHeight(G); | height += SeqGetHeight(G); | |||
} | } | |||
height += MovieGetPanelHeight(G); | height += MovieGetPanelHeight(G); | |||
} | } | |||
skipping to change at line 2869 | skipping to change at line 2858 | |||
return result; | return result; | |||
} | } | |||
PyMOLreturn_int_array PyMOL_GetImageInfo(CPyMOL * I) | PyMOLreturn_int_array PyMOL_GetImageInfo(CPyMOL * I) | |||
{ | { | |||
PyMOLreturn_int_array result = { PyMOLstatus_SUCCESS, 2, NULL }; | PyMOLreturn_int_array result = { PyMOLstatus_SUCCESS, 2, NULL }; | |||
PYMOL_API_LOCK result.array = VLAlloc(int, 2); | PYMOL_API_LOCK result.array = VLAlloc(int, 2); | |||
if(!result.array) { | if(!result.array) { | |||
result.status = PyMOLstatus_FAILURE; | result.status = PyMOLstatus_FAILURE; | |||
} else { | } else { | |||
SceneGetImageSize(I->G, result.array, result.array + 1); | std::tie(result.array[0], result.array[1]) = SceneGetImageSize(I->G); | |||
} | } | |||
PYMOL_API_UNLOCK return result; | PYMOL_API_UNLOCK return result; | |||
} | } | |||
int PyMOL_GetImageData(CPyMOL * I, | int PyMOL_GetImageData(CPyMOL * I, | |||
int width, int height, | int width, int height, | |||
int row_bytes, void *buffer, int mode, int reset) | int row_bytes, void *buffer, int mode, int reset) | |||
{ | { | |||
int ok = true; | int ok = true; | |||
PYMOL_API_LOCK if(reset) | PYMOL_API_LOCK if(reset) | |||
End of changes. 16 change blocks. | ||||
23 lines changed or deleted | 12 lines changed or added |