"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "layer1/Movie.cpp" between
pymol-v1.8.6.0.tar.bz2 and pymol-v2.1.0.tar.bz2

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.

Movie.cpp  (pymol-v1.8.6.0.tar.bz2):Movie.cpp  (pymol-v2.1.0.tar.bz2)
skipping to change at line 119 skipping to change at line 119
int hand = SettingGetGlobal_i(G, cSetting_motion_hand); int hand = SettingGetGlobal_i(G, cSetting_motion_hand);
MovieView(G, 3, -1, -1, power, bias, 1, /* note simple always = 1 for camera m otion...*/ MovieView(G, 3, -1, -1, power, bias, 1, /* note simple always = 1 for camera m otion...*/
linear, linear,
SettingGetGlobal_b(G,cSetting_movie_loop) ? 1 : 0 , SettingGetGlobal_b(G,cSetting_movie_loop) ? 1 : 0 ,
hand, 5, 1, NULL, 0.5, -1, 1); hand, 5, 1, NULL, 0.5, -1, 1);
} }
int MovieXtoFrame(PyMOLGlobals *G, BlockRect *rect, int frames, int x, int neare st) int MovieXtoFrame(PyMOLGlobals *G, BlockRect *rect, int frames, int x, int neare st)
{ {
CMovie *I = G->Movie; return ViewElemXtoFrame(rect,frames,x,nearest);
return ViewElemXtoFrame(G,I->ViewElem,rect,frames,x,nearest);
} }
void MovieViewTrim(PyMOLGlobals *G,int n_frame) void MovieViewTrim(PyMOLGlobals *G,int n_frame)
{ {
CMovie *I = G->Movie; CMovie *I = G->Movie;
if(n_frame>=0) { if(n_frame>=0) {
if(!I->Sequence) { if(!I->Sequence) {
I->Sequence = VLACalloc(int, n_frame); I->Sequence = VLACalloc(int, n_frame);
} else { } else {
VLASize(I->Sequence, int, n_frame); VLASize(I->Sequence, int, n_frame);
skipping to change at line 461 skipping to change at line 460
sprintf(buffer, "%5d: %s\n", a + 1, I->Cmd[a]); sprintf(buffer, "%5d: %s\n", a + 1, I->Cmd[a]);
OrthoAddOutput(G, buffer); OrthoAddOutput(G, buffer);
} }
} }
} else { } else {
PRINTFB(G, FB_Movie, FB_Results) PRINTFB(G, FB_Movie, FB_Results)
" Movie: No movie commands are defined.\n" ENDFB(G); " Movie: No movie commands are defined.\n" ENDFB(G);
} }
} }
/*========================================================================*/
#ifndef _PYMOL_NOPY
static int MovieCmdFromPyList(PyMOLGlobals * G, PyObject * list, int *warning) static int MovieCmdFromPyList(PyMOLGlobals * G, PyObject * list, int *warning)
{ {
CMovie *I = G->Movie; CMovie *I = G->Movie;
int ok = true; int ok = true;
int a; int a;
int warn = false; int warn = false;
if(ok) if(ok)
ok = (list != NULL); ok = (list != NULL);
skipping to change at line 486 skipping to change at line 483
for(a = 0; a < I->NFrame; a++) { for(a = 0; a < I->NFrame; a++) {
if(ok) if(ok)
ok = PConvPyStrToStr(PyList_GetItem(list, a), I->Cmd[a], OrthoLineLength); ok = PConvPyStrToStr(PyList_GetItem(list, a), I->Cmd[a], OrthoLineLength);
if(ok) if(ok)
warn = (warn || I->Cmd[a][0]); warn = (warn || I->Cmd[a][0]);
} }
*warning = warn; *warning = warn;
return (ok); return (ok);
} }
#endif
/*========================================================================*/ /*========================================================================*/
int MovieFromPyList(PyMOLGlobals * G, PyObject * list, int *warning) int MovieFromPyList(PyMOLGlobals * G, PyObject * list, int *warning)
{ {
#ifdef _PYMOL_NOPY
return 0;
#else
int ok = true; int ok = true;
CMovie *I = G->Movie; CMovie *I = G->Movie;
int ll = 0; int ll = 0;
MovieReset(G); MovieReset(G);
if(ok) if(ok)
ok = PyList_Check(list); ok = PyList_Check(list);
if(ok) if(ok)
ll = PyList_Size(list); ll = PyList_Size(list);
/* TO SUPPORT BACKWARDS COMPATIBILITY... /* TO SUPPORT BACKWARDS COMPATIBILITY...
skipping to change at line 538 skipping to change at line 530
VLAFreeP(I->ViewElem); VLAFreeP(I->ViewElem);
I->ViewElem = NULL; I->ViewElem = NULL;
tmp = PyList_GetItem(list, 6); tmp = PyList_GetItem(list, 6);
if(tmp && !(tmp == Py_None)) if(tmp && !(tmp == Py_None))
ok = ViewElemVLAFromPyList(G, tmp, &I->ViewElem, I->NFrame); ok = ViewElemVLAFromPyList(G, tmp, &I->ViewElem, I->NFrame);
} }
if(!ok) { if(!ok) {
MovieReset(G); MovieReset(G);
} else if(MovieDefined(G)) { } else if(MovieDefined(G)) {
OrthoReshape(G,-1,-1,true); OrthoReshape(G,-1,-1,true);
SceneCountFrames(G);
} }
return (ok); return (ok);
#endif
} }
/*========================================================================*/ /*========================================================================*/
#ifndef _PYMOL_NOPY
static PyObject *MovieCmdAsPyList(PyMOLGlobals * G) static PyObject *MovieCmdAsPyList(PyMOLGlobals * G)
{ {
CMovie *I = G->Movie; CMovie *I = G->Movie;
PyObject *result = NULL; PyObject *result = NULL;
int a; int a;
result = PyList_New(I->NFrame); result = PyList_New(I->NFrame);
if(result) if(result)
for(a = 0; a < I->NFrame; a++) { for(a = 0; a < I->NFrame; a++) {
PyList_SetItem(result, a, PyString_FromString(I->Cmd[a])); PyList_SetItem(result, a, PyString_FromString(I->Cmd[a]));
} }
return (PConvAutoNone(result)); return (PConvAutoNone(result));
} }
#endif
/*========================================================================*/ /*========================================================================*/
PyObject *MovieAsPyList(PyMOLGlobals * G) PyObject *MovieAsPyList(PyMOLGlobals * G)
{ {
#ifdef _PYMOL_NOPY
return NULL;
#else
CMovie *I = G->Movie; CMovie *I = G->Movie;
PyObject *result = NULL; PyObject *result = NULL;
result = PyList_New(7); result = PyList_New(7);
PyList_SetItem(result, 0, PyInt_FromLong(I->NFrame)); PyList_SetItem(result, 0, PyInt_FromLong(I->NFrame));
PyList_SetItem(result, 1, PyInt_FromLong(I->MatrixFlag)); PyList_SetItem(result, 1, PyInt_FromLong(I->MatrixFlag));
PyList_SetItem(result, 2, PConvFloatArrayToPyList(I->Matrix, cSceneViewSize)); PyList_SetItem(result, 2, PConvFloatArrayToPyList(I->Matrix, cSceneViewSize));
PyList_SetItem(result, 3, PyInt_FromLong(I->Playing)); PyList_SetItem(result, 3, PyInt_FromLong(I->Playing));
if(I->Sequence) { if(I->Sequence) {
PyList_SetItem(result, 4, PConvIntArrayToPyList(I->Sequence, I->NFrame)); PyList_SetItem(result, 4, PConvIntArrayToPyList(I->Sequence, I->NFrame));
skipping to change at line 603 skipping to change at line 589
/* ImageType *Image; /* ImageType *Image;
int *Sequence; int *Sequence;
MovieCmdType *Cmd; MovieCmdType *Cmd;
int NImage,NFrame; int NImage,NFrame;
unsigned Width,Height; unsigned Width,Height;
int MatrixFlag; int MatrixFlag;
float Matrix[16]; float Matrix[16];
int Playing; int Playing;
*/ */
return (PConvAutoNone(result)); return (PConvAutoNone(result));
#endif
} }
/*========================================================================*/ /*========================================================================*/
int MoviePlaying(PyMOLGlobals * G) int MoviePlaying(PyMOLGlobals * G)
{ {
CMovie *I = G->Movie; CMovie *I = G->Movie;
if(I->Locked) if(I->Locked)
return false; return false;
if(I->Playing && G->Interrupt) { if(I->Playing && G->Interrupt) {
I->Playing = false; I->Playing = false;
skipping to change at line 899 skipping to change at line 884
/* assumes locked api, blocked threads, and master thread on entry */ /* assumes locked api, blocked threads, and master thread on entry */
CMovie *I = G->Movie; CMovie *I = G->Movie;
/* new routine allows PyMOL to workaround XP and Vista Windowing /* new routine allows PyMOL to workaround XP and Vista Windowing
issues */ issues */
CMovieModal *M = &I->Modal; CMovieModal *M = &I->Modal;
UtilZeroMem(M, sizeof(CMovieModal)); UtilZeroMem(M, sizeof(CMovieModal));
mode = SceneValidateImageMode(G, mode, width || height);
/* default behavior is to go modal unless we're ray tracing */
if(modal < 0 && mode == cSceneImage_Ray) {
modal = 0;
}
UtilNCopy(M->prefix, prefix, sizeof(OrthoLineType)); UtilNCopy(M->prefix, prefix, sizeof(OrthoLineType));
M->save = save; M->save = save;
M->start = start; M->start = start;
M->stop = stop; M->stop = stop;
M->missing_only = missing_only; M->missing_only = missing_only;
M->stage = 0; M->stage = 0;
M->format = format; M->format = format;
M->mode = mode; M->mode = mode;
M->quiet = quiet; M->quiet = quiet;
M->width = width; M->width = width;
skipping to change at line 920 skipping to change at line 912
if(SettingGetGlobal_b(G, cSetting_seq_view)) { if(SettingGetGlobal_b(G, cSetting_seq_view)) {
PRINTFB(G, FB_Movie, FB_Warnings) PRINTFB(G, FB_Movie, FB_Warnings)
" MoviePNG-Warning: disabling seq_view, may conflict with movie export\n" ENDFB(G); " MoviePNG-Warning: disabling seq_view, may conflict with movie export\n" ENDFB(G);
SettingSetGlobal_b(G, cSetting_seq_view, 0); SettingSetGlobal_b(G, cSetting_seq_view, 0);
// force viewport update // force viewport update
SeqChanged(G); SeqChanged(G);
OrthoDoDraw(G, 0); OrthoDoDraw(G, 0);
} }
if(modal < 0) {
/* default behavior is to go modal unless we're ray tracing */
if((mode < cSceneImage_Ray) || (!SettingGetGlobal_b(G, cSetting_ray_trace_fr
ames))) {
modal = 1;
}
}
M->modal = modal; M->modal = modal;
if(modal) { if(modal) {
PyMOL_SetModalDraw(G->PyMOL, (PyMOLModalDrawFn *) MovieModalDraw); PyMOL_SetModalDraw(G->PyMOL, (PyMOLModalDrawFn *) MovieModalDraw);
} else { } else {
while(!M->complete) { while(!M->complete) {
MovieModalPNG(G, I, &I->Modal); MovieModalPNG(G, I, &I->Modal);
} }
} }
return true; return true;
skipping to change at line 1560 skipping to change at line 1546
CMovie *I = G->Movie; CMovie *I = G->Movie;
I->DragMode = mode; I->DragMode = mode;
I->DragObj = obj; I->DragObj = obj;
I->DragX = x; I->DragX = x;
I->DragY = y; I->DragY = y;
I->DragRect = *rect; I->DragRect = *rect;
if(I->DragColumn) { if(I->DragColumn) {
I->DragRect.top = I->Block->rect.top - 1; I->DragRect.top = I->Block->rect.top - 1;
I->DragRect.bottom = I->Block->rect.bottom + 1; I->DragRect.bottom = I->Block->rect.bottom + 1;
} }
I->DragStartFrame = ViewElemXtoFrame(G,I->ViewElem,rect,MovieGetLength(G),x,ne arest); I->DragStartFrame = ViewElemXtoFrame(rect,MovieGetLength(G),x,nearest);
if(I->DragStartFrame > MovieGetLength(G)) if(I->DragStartFrame > MovieGetLength(G))
I->DragStartFrame = MovieGetLength(G); I->DragStartFrame = MovieGetLength(G);
I->DragCurFrame = ViewElemXtoFrame(G,I->ViewElem,rect,MovieGetLength(G),x,near est); I->DragCurFrame = ViewElemXtoFrame(rect,MovieGetLength(G),x,nearest);
I->DragNearest = nearest; I->DragNearest = nearest;
} }
static int MovieClick(Block * block, int button, int x, int y, int mod) static int MovieClick(Block * block, int button, int x, int y, int mod)
{ {
PyMOLGlobals *G = block->G; PyMOLGlobals *G = block->G;
CMovie *I = G->Movie; CMovie *I = G->Movie;
int count = ExecutiveCountMotions(G); int count = ExecutiveCountMotions(G);
short scrolldir = 1; short scrolldir = 1;
BlockRect rect = block->rect; BlockRect rect = block->rect;
skipping to change at line 1666 skipping to change at line 1652
PyMOLGlobals *G = block->G; PyMOLGlobals *G = block->G;
CMovie *I = G->Movie; CMovie *I = G->Movie;
if(I->DragMode) { if(I->DragMode) {
I->DragDraw = ((y < (block->rect.top + 50)) && (y > (block->rect.bottom - 50 ))); I->DragDraw = ((y < (block->rect.top + 50)) && (y > (block->rect.bottom - 50 )));
switch(I->DragMode) { switch(I->DragMode) {
case cMovieDragModeMoveKey: case cMovieDragModeMoveKey:
case cMovieDragModeCopyKey: case cMovieDragModeCopyKey:
{ {
int n_frame = MovieGetLength(G); int n_frame = MovieGetLength(G);
I->DragCurFrame = ViewElemXtoFrame(G,I->ViewElem,&I->DragRect,n_frame,x, false); I->DragCurFrame = ViewElemXtoFrame(&I->DragRect,n_frame,x,false);
if(I->DragStartFrame<n_frame) { if(I->DragStartFrame<n_frame) {
if((abs(x-I->DragX)>3) || if((abs(x-I->DragX)>3) ||
(abs(y-I->DragY)>5)) { (abs(y-I->DragY)>5)) {
I->DragMenu = false; I->DragMenu = false;
} }
OrthoDirty(G); OrthoDirty(G);
} }
} }
break; break;
case cMovieDragModeOblate: case cMovieDragModeOblate:
I->DragCurFrame = ViewElemXtoFrame(G,I->ViewElem,&I->DragRect,MovieGetLeng th(G),x,false); I->DragCurFrame = ViewElemXtoFrame(&I->DragRect,MovieGetLength(G),x,false) ;
OrthoDirty(G); OrthoDirty(G);
break; break;
case cMovieDragModeInsDel: case cMovieDragModeInsDel:
I->DragCurFrame = ViewElemXtoFrame(G,I->ViewElem,&I->DragRect,MovieGetLeng th(G),x,true); I->DragCurFrame = ViewElemXtoFrame(&I->DragRect,MovieGetLength(G),x,true);
OrthoDirty(G); OrthoDirty(G);
break; break;
} }
} }
return 1; return 1;
} }
static int MovieRelease(Block * block, int button, int x, int y, int mod) static int MovieRelease(Block * block, int button, int x, int y, int mod)
{ {
PyMOLGlobals *G = block->G; PyMOLGlobals *G = block->G;
skipping to change at line 1794 skipping to change at line 1780
CMovie *I = G->Movie; CMovie *I = G->Movie;
if(movie_panel != 0) { if(movie_panel != 0) {
if(MovieGetLength(G)) { if(MovieGetLength(G)) {
movie_panel = 1; movie_panel = 1;
} else { } else {
movie_panel = 0; movie_panel = 0;
} }
} }
if(movie_panel) { if(movie_panel) {
int row_height = SettingGetGlobal_i(G,cSetting_movie_panel_row_height); int row_height = DIP2PIXEL(SettingGetGlobal_i(G,cSetting_movie_panel_row_hei ght));
I->PanelActive = true; I->PanelActive = true;
if(SettingGetGlobal_b(G, cSetting_presentation)) { if(SettingGetGlobal_b(G, cSetting_presentation)) {
/* show camera line only when in presentation mode */ /* show camera line only when in presentation mode */
return row_height; return row_height;
} else { } else {
return row_height * ExecutiveCountMotions(G); return row_height * ExecutiveCountMotions(G);
} }
} else { } else {
I->PanelActive = false; I->PanelActive = false;
return 0; return 0;
skipping to change at line 1953 skipping to change at line 1939
static void MovieReshape(Block * block, int width, int height) static void MovieReshape(Block * block, int width, int height)
{ {
PyMOLGlobals *G = block->G; PyMOLGlobals *G = block->G;
CMovie *I = G->Movie; CMovie *I = G->Movie;
BlockReshape(block, width, height); BlockReshape(block, width, height);
I->Width = block->rect.right - block->rect.left + 1; I->Width = block->rect.right - block->rect.left + 1;
I->Height = block->rect.top - block->rect.bottom + 1; I->Height = block->rect.top - block->rect.bottom + 1;
if(SettingGetGlobal_b(G, cSetting_presentation)) { if(SettingGetGlobal_b(G, cSetting_presentation)) {
I->LabelIndent = 0; I->LabelIndent = 0;
} else { } else {
I->LabelIndent = 8 * 8; I->LabelIndent = DIP2PIXEL(8 * 8);
} }
} }
/*========================================================================*/ /*========================================================================*/
int MovieInit(PyMOLGlobals * G) int MovieInit(PyMOLGlobals * G)
{ {
CMovie *I = NULL; CMovie *I = NULL;
if((I = (G->Movie = Calloc(CMovie, 1)))) { if((I = (G->Movie = Calloc(CMovie, 1)))) {
int a; int a;
 End of changes. 19 change blocks. 
31 lines changed or deleted 16 lines changed or added

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