"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "layer5/main.cpp" between
pymol-open-source-2.2.0.tar.gz and pymol-open-source-2.3.0.tar.gz

About: PyMOL is a Python-enhanced molecular graphics tool. It excels at 3D visualization of proteins, small molecules, density, surfaces, and trajectories. It also includes molecular editing, ray tracing, and movies. Open Source version.

main.cpp  (pymol-open-source-2.2.0):main.cpp  (pymol-open-source-2.3.0)
skipping to change at line 92 skipping to change at line 92
void MainUnlockAPIAsGlut() void MainUnlockAPIAsGlut()
{ {
PyMOLGlobals *G = SingletonPyMOLGlobals; PyMOLGlobals *G = SingletonPyMOLGlobals;
PUnlockAPIAsGlut(G); PUnlockAPIAsGlut(G);
} }
int MainFeedbackOut(char *st) int MainFeedbackOut(char *st)
{ {
PyMOLGlobals *G = SingletonPyMOLGlobals; PyMOLGlobals *G = SingletonPyMOLGlobals;
return OrthoFeedbackOut(G, st); return OrthoFeedbackOut(G, *G->Ortho);
} }
void MainRunCommand(const char *str1) void MainRunCommand(const char *str1)
{ {
PyMOLGlobals *G = SingletonPyMOLGlobals; PyMOLGlobals *G = SingletonPyMOLGlobals;
if(PLockAPIAsGlut(G, true)) { if(PLockAPIAsGlut(G, true)) {
if(str1[0] != '_') { /* suppress internal call-backs */ if(str1[0] != '_') { /* suppress internal call-backs */
if(strncmp(str1, "cmd._", 5)) { if(strncmp(str1, "cmd._", 5)) {
skipping to change at line 236 skipping to change at line 236
PyObject *result = NULL; PyObject *result = NULL;
result = PYOBJECT_CALLFUNCTION(G->P_inst->complete, "s", str); result = PYOBJECT_CALLFUNCTION(G->P_inst->complete, "s", str);
return (result); return (result);
} }
#endif #endif
#else #else
void MainFree(void); void MainFree(void);
void MainReshape(int width, int height); static void MainReshape(int width, int height);
static void MainDrawLocked(void); static void MainDrawLocked(void);
static void MainDrag(int x, int y); static void MainDrag(int x, int y);
static CPyMOL *PyMOLInstance = NULL; /* eliminate */ static CPyMOL *PyMOLInstance = NULL; /* eliminate */
struct _CMain { struct _CMain {
int IdleMode; int IdleMode;
double IdleTime; double IdleTime;
int IdleCount; int IdleCount;
int Modifiers; int Modifiers;
skipping to change at line 262 skipping to change at line 262
int DrawGovernorActive, DrawDeferred, DrawSignalled; int DrawGovernorActive, DrawDeferred, DrawSignalled;
int DrawnFlag, DeferReshapeDeferral; int DrawnFlag, DeferReshapeDeferral;
int MaximizeCheck; int MaximizeCheck;
CPyMOLOptions *OwnedOptions; CPyMOLOptions *OwnedOptions;
/* if Main owns a reference to a copy of the startup options that /* if Main owns a reference to a copy of the startup options that
needs to be freed upon shutdown to fully scrub the heap */ needs to be freed upon shutdown to fully scrub the heap */
}; };
/* global options */ /* global options */
static
void MainOnExit(void); void MainOnExit(void);
static void MainPushValidContext(PyMOLGlobals * G) static void MainPushValidContext(PyMOLGlobals * G)
{ {
PLockStatus(G); PLockStatus(G);
PyMOL_PushValidContext(G->PyMOL); PyMOL_PushValidContext(G->PyMOL);
PUnlockStatus(G); PUnlockStatus(G);
} }
static void MainPopValidContext(PyMOLGlobals * G) static void MainPopValidContext(PyMOLGlobals * G)
skipping to change at line 438 skipping to change at line 439
/*========================================================================*/ /*========================================================================*/
static void MainButton(int button, int state, int x, int y) static void MainButton(int button, int state, int x, int y)
{ {
PyMOLGlobals *G = SingletonPyMOLGlobals; PyMOLGlobals *G = SingletonPyMOLGlobals;
int glMod; int glMod;
CMain *I = G->Main; CMain *I = G->Main;
#ifdef WIN32
// fix wheel x/y on Windows (PYMOL-2173)
switch(button) {
case P_GLUT_BUTTON_SCROLL_FORWARD:
case P_GLUT_BUTTON_SCROLL_BACKWARD:
x -= p_glutGet(P_GLUT_WINDOW_X);
y -= p_glutGet(P_GLUT_WINDOW_Y);
}
#endif
glMod = p_glutGetModifiers(); glMod = p_glutGetModifiers();
if(PLockAPIAsGlut(G, false)) { if(PLockAPIAsGlut(G, false)) {
I->IdleMode = 0; /* restore responsiveness */ I->IdleMode = 0; /* restore responsiveness */
if(PyMOL_GetPassive(PyMOLInstance, (button < 3) ? true : false)) { if(PyMOL_GetPassive(PyMOLInstance, (button < 3) ? true : false)) {
MainDrag(x, y); MainDrag(x, y);
} else { } else {
/* stay blocked here because Clicks->SexFrame->PParse */ /* stay blocked here because Clicks->SexFrame->PParse */
y = G->Option->winY - y; y = G->Option->winY - y;
I->Modifiers = ((glMod & P_GLUT_ACTIVE_SHIFT) ? cOrthoSHIFT : 0) | I->Modifiers = ((glMod & P_GLUT_ACTIVE_SHIFT) ? cOrthoSHIFT : 0) |
((glMod & P_GLUT_ACTIVE_CTRL) ? cOrthoCTRL : 0) | ((glMod & P_GLUT_ACTIVE_CTRL) ? cOrthoCTRL : 0) |
((glMod & P_GLUT_ACTIVE_ALT) ? cOrthoALT : 0); ((glMod & P_GLUT_ACTIVE_ALT) ? cOrthoALT : 0);
switch (button) {
case P_GLUT_BUTTON_SCROLL_FORWARD:
case P_GLUT_BUTTON_SCROLL_BACKWARD:
x = G->Option->winX / 2;
y = G->Option->winY / 2; /* force into scene */
break;
}
PyMOL_Button(PyMOLInstance, button, state, x, y, I->Modifiers); PyMOL_Button(PyMOLInstance, button, state, x, y, I->Modifiers);
} }
PUnlockAPIAsGlut(G); PUnlockAPIAsGlut(G);
} }
} }
/*========================================================================*/ /*========================================================================*/
static void MainPassive(int x, int y) static void MainPassive(int x, int y)
{ {
skipping to change at line 944 skipping to change at line 948
} }
if(PyMOLInstance) if(PyMOLInstance)
PyMOL_Reshape(PyMOLInstance, width, height, false); PyMOL_Reshape(PyMOLInstance, width, height, false);
PUnlockAPIAsGlut(G); PUnlockAPIAsGlut(G);
} }
} }
/*========================================================================*/ /*========================================================================*/
void MainDoReshape(int width, int height) void MainDoReshape(int width, int height)
{ /* called internally */ { /* called internally */
int h, w;
int internal_feedback; int internal_feedback;
int force = false; int force = false;
PyMOLGlobals *G = SingletonPyMOLGlobals; PyMOLGlobals *G = SingletonPyMOLGlobals;
if(G) { if(G) {
/* if width and height are negative and we are in full screen, don't reshape window */ /* if width and height are negative and we are in full screen, don't reshape window */
bool keep_fullscreen = (width < 0 && height < 0 && ExecutiveIsFullScreen(G)) ; bool keep_fullscreen = (width < 0 && height < 0 && ExecutiveIsFullScreen(G)) ;
/* if width is negative, force a reshape based on the current width */ /* if width is negative, force a reshape based on the current width */
if(width < 0) { if(width < 0) {
BlockGetSize(SceneGetBlock(G), &width, &h); width = SceneGetBlock(G)->getWidth();
if(SettingGetGlobal_b(G, cSetting_internal_gui)) if(SettingGetGlobal_b(G, cSetting_internal_gui))
width += SettingGetGlobal_i(G, cSetting_internal_gui_width); width += SettingGetGlobal_i(G, cSetting_internal_gui_width);
force = true; force = true;
} }
/* 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) {
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 + cOrthoBottomScene Margin; height += (internal_feedback - 1) * cOrthoLineHeight + cOrthoBottomScene Margin;
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);
force = true; force = true;
} }
skipping to change at line 1055 skipping to change at line 1058
int theWindow = G->Main->TheWindow; int theWindow = G->Main->TheWindow;
#endif #endif
/* END PROPRIETARY CODE SEGMENT */ /* END PROPRIETARY CODE SEGMENT */
FreeP(G->Main); FreeP(G->Main);
if(owned_options) if(owned_options)
PyMOLOptions_Free(owned_options); /* clean up launch options if we're supp osed to */ PyMOLOptions_Free(owned_options); /* clean up launch options if we're supp osed to */
MemoryDebugDump(); /* this is a no-op unless memory debugging is en
abled */
if(show_message) { if(show_message) {
printf(" PyMOL: normal program termination.\n"); printf(" PyMOL: normal program termination.\n");
} }
/* BEGIN PROPRIETARY CODE SEGMENT (see disclaimer in "os_proprietary.h") */ /* BEGIN PROPRIETARY CODE SEGMENT (see disclaimer in "os_proprietary.h") */
#ifdef WIN32 #ifdef WIN32
if(haveGUI) if(haveGUI)
p_glutDestroyWindow(theWindow); p_glutDestroyWindow(theWindow);
TerminateProcess(GetCurrentProcess(), 0); /* only way to avoid a crash */ TerminateProcess(GetCurrentProcess(), 0); /* only way to avoid a crash */
#endif #endif
skipping to change at line 1685 skipping to change at line 1686
} }
} }
return 0; return 0;
} }
#endif #endif
/*========================================================================*/ /*========================================================================*/
PyObject *MainAsPyList(void); PyObject *MainAsPyList(PyMOLGlobals *G)
PyObject *MainAsPyList(void)
{ {
#ifdef _PYMOL_NOPY #ifdef _PYMOL_NOPY
return NULL; return NULL;
#else #else
PyMOLGlobals *G = SingletonPyMOLGlobals;
PyObject *result = NULL; PyObject *result = NULL;
int width, height; int width, height;
result = PyList_New(2); result = PyList_New(2);
BlockGetSize(SceneGetBlock(G), &width, &height); width = SceneGetBlock(G)->getWidth();
height = SceneGetBlock(G)->getHeight();
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);
PyList_SetItem(result, 0, PyInt_FromLong(width)); PyList_SetItem(result, 0, PyInt_FromLong(width));
PyList_SetItem(result, 1, PyInt_FromLong(height)); PyList_SetItem(result, 1, PyInt_FromLong(height));
return (PConvAutoNone(result)); return (PConvAutoNone(result));
#endif #endif
} }
int MainFromPyList(PyObject * list); int MainFromPyList(PyMOLGlobals *G, PyObject * list)
int MainFromPyList(PyObject * list)
{ {
#ifdef _PYMOL_NOPY #ifdef _PYMOL_NOPY
return 0; return 0;
#else #else
int ok = true; int ok = true;
int win_x, win_y; int win_x, win_y;
int ll = 0; int ll = 0;
PyMOLGlobals *G = SingletonPyMOLGlobals;
OrthoLineType buffer; OrthoLineType buffer;
if(ok) if(ok)
ok = (list != NULL); ok = (list != NULL);
if(ok) if(ok)
ok = PyList_Check(list); ok = PyList_Check(list);
if(ok) if(ok)
ll = PyList_Size(list); ll = PyList_Size(list);
if(ok && (ll >= 2)) { if(ok && (ll >= 2)) {
if(!G->Option->presentation && if(!G->Option->presentation &&
 End of changes. 14 change blocks. 
24 lines changed or deleted 19 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)