Movie.cpp (pymol-open-source-2.2.0) | : | Movie.cpp (pymol-open-source-2.3.0) | ||
---|---|---|---|---|
skipping to change at line 75 | skipping to change at line 75 | |||
double accumTiming; | double accumTiming; | |||
double timing; | double timing; | |||
int complete; | int complete; | |||
int file_missing; | int file_missing; | |||
int format; | int format; | |||
int quiet; | int quiet; | |||
OrthoLineType fname; | OrthoLineType fname; | |||
} CMovieModal; | } CMovieModal; | |||
struct _CMovie { | struct CMovie : public Block { | |||
::Block *Block; | std::vector<std::shared_ptr<pymol::Image>> Image; | |||
ImageType **Image; | int *Sequence { nullptr }; | |||
int *Sequence; | MovieCmdType *Cmd { nullptr }; | |||
MovieCmdType *Cmd; | int NImage { 0 }, NFrame { 0 }; | |||
int NImage, NFrame; | int MatrixFlag { false }; | |||
int MatrixFlag; | SceneViewType Matrix {}; | |||
SceneViewType Matrix; | int Playing { false }; | |||
int Playing; | int Locked {}; | |||
int Locked; | int CacheSave {}; | |||
int CacheSave; | int OverlaySave {}; | |||
int OverlaySave; | CViewElem *ViewElem { nullptr }; | |||
CViewElem *ViewElem; | bool RecursionFlag { false }; | |||
int RecursionFlag; | bool RealtimeFlag { true }; | |||
int RealtimeFlag; | CMovieModal Modal {}; | |||
CMovieModal Modal; | int Width {}, Height {}; | |||
int Width, Height; | ScrollBar m_ScrollBar; | |||
struct CScrollBar *ScrollBar; | int DragMode {}; | |||
int DragMode; | int Dragging {}; | |||
int Dragging; | CObject *DragObj {}; /* if not dragging all */ | |||
CObject *DragObj; /* if not dragging all */ | BlockRect DragRect {}; | |||
BlockRect DragRect; | int DragX {}, DragY {}, DragMenu {}; | |||
int DragX, DragY, DragMenu; | int DragStartFrame {}, DragCurFrame {}, DragNearest {}, DragDraw {}; | |||
int DragStartFrame, DragCurFrame, DragNearest, DragDraw; | int DragColumn {}; | |||
int DragColumn; | int LabelIndent {}; | |||
int LabelIndent; | int PanelActive {}; | |||
int PanelActive; | ||||
CMovie(PyMOLGlobals* G) : Block(G), m_ScrollBar(G, true) {} | ||||
int release(int button, int x, int y, int mod) override; | ||||
int click(int button, int x, int y, int mod) override; | ||||
int drag(int x, int y, int mod) override; | ||||
void draw(CGO* orthoCGO) override; | ||||
bool fastDraw(CGO* orthoCGO) override; | ||||
void reshape(int width, int height) override; | ||||
}; | }; | |||
void MovieViewReinterpolate(PyMOLGlobals *G) | void MovieViewReinterpolate(PyMOLGlobals *G) | |||
{ | { | |||
float power = SettingGetGlobal_f(G, cSetting_motion_power); | float power = SettingGetGlobal_f(G, cSetting_motion_power); | |||
float bias = SettingGetGlobal_f(G, cSetting_motion_bias); | float bias = SettingGetGlobal_f(G, cSetting_motion_bias); | |||
float linear = SettingGetGlobal_f(G, cSetting_motion_linear); | float linear = SettingGetGlobal_f(G, cSetting_motion_linear); | |||
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...*/ | |||
skipping to change at line 274 | skipping to change at line 282 | |||
SettingSetGlobal_i(G, cSetting_overlay, 5); | SettingSetGlobal_i(G, cSetting_overlay, 5); | |||
nFrame = I->NFrame; | nFrame = I->NFrame; | |||
if(!nFrame) { | if(!nFrame) { | |||
nFrame = SceneGetNFrame(G, NULL); | nFrame = SceneGetNFrame(G, NULL); | |||
} | } | |||
start = 0; | start = 0; | |||
stop = nFrame; | stop = nFrame; | |||
if((start != 0) || (stop != (nFrame + 1))) | if((start != 0) || (stop != (nFrame + 1))) | |||
SceneSetFrame(G, 0, 0); | SceneSetFrame(G, 0, 0); | |||
MoviePlay(G, cMoviePlay); | MoviePlay(G, cMoviePlay); | |||
VLACheck(I->Image, ImageType *, nFrame); | VecCheck(I->Image, nFrame); | |||
SceneGetWidthHeight(G, width, height); | SceneGetWidthHeight(G, width, height); | |||
{ | { | |||
int uniform_height = -1; | int uniform_height = -1; | |||
int uniform_width = -1; | int uniform_width = -1; | |||
int uniform_flag = false; | int uniform_flag = false; | |||
int scene_match = true; | int scene_match = true; | |||
int a; | int a; | |||
ImageType *image; | ||||
/* make sure all the movie frames match the screen size or are pre-rendered and are already the same size */ | /* make sure all the movie frames match the screen size or are pre-rendered and are already the same size */ | |||
for(a = 0; a < nFrame; a++) { | for(a = 0; a < nFrame; a++) { | |||
image = I->Image[a]; | const pymol::Image* image = I->Image[a].get(); | |||
if(image) { | if(image) { | |||
if((image->height != *height) || (image->width != *width)) { | if((image->getHeight() != *height) || (image->getWidth() != *width)) { | |||
scene_match = false; | scene_match = false; | |||
if(uniform_height < 0) { | if(uniform_height < 0) { | |||
uniform_height = image->height; | uniform_height = image->getHeight(); | |||
uniform_width = image->width; | uniform_width = image->getWidth(); | |||
} else { | } else { | |||
if((image->height != uniform_height) || (image->width != uniform_wid th)) | if((image->getHeight() != uniform_height) || (image->getWidth() != u niform_width)) | |||
uniform_flag = false; | uniform_flag = false; | |||
} | } | |||
} | } | |||
} else | } else | |||
uniform_flag = false; /* missing at least one image, so not uniform */ | uniform_flag = false; /* missing at least one image, so not uniform */ | |||
} | } | |||
if(!scene_match) { | if(!scene_match) { | |||
if(uniform_flag) { | if(uniform_flag) { | |||
*height = uniform_height; | *height = uniform_height; | |||
*width = uniform_width; | *width = uniform_width; | |||
skipping to change at line 339 | skipping to change at line 346 | |||
nFrame = SceneGetNFrame(G, NULL); | nFrame = SceneGetNFrame(G, NULL); | |||
} | } | |||
if((frame < nFrame) && (ptr)) { | if((frame < nFrame) && (ptr)) { | |||
int a = frame; | int a = frame; | |||
int i; | int i; | |||
SceneSetFrame(G, 0, a); | SceneSetFrame(G, 0, a); | |||
MovieDoFrameCommand(G, a); | MovieDoFrameCommand(G, a); | |||
MovieFlushCommands(G); | MovieFlushCommands(G); | |||
i = MovieFrameToImage(G, a); | i = MovieFrameToImage(G, a); | |||
VLACheck(I->Image, ImageType *, i); | VecCheck(I->Image, i); | |||
if(!I->Image[i]) { | if(!I->Image[i]) { | |||
SceneUpdate(G, false); | SceneUpdate(G, false); | |||
SceneMakeMovieImage(G, false, false, cSceneImage_Default); | SceneMakeMovieImage(G, false, false, cSceneImage_Default); | |||
} | } | |||
if(!I->Image[i]) { | if(!I->Image[i]) { | |||
PRINTFB(G, FB_Movie, FB_Errors) | PRINTFB(G, FB_Movie, FB_Errors) | |||
"MoviePNG-Error: Missing rendered image.\n" ENDFB(G); | "MoviePNG-Error: Missing rendered image.\n" ENDFB(G); | |||
} else { | } else { | |||
if((I->Image[i]->height == height) && (I->Image[i]->width == width)) { | if((I->Image[i]->getHeight() == height) && (I->Image[i]->getWidth() == wid | |||
unsigned char *srcImage = (unsigned char *) I->Image[i]->data; | th)) { | |||
unsigned char *srcImage = I->Image[i]->bits(); | ||||
int i, j; | int i, j; | |||
for(i = 0; i < height; i++) { | for(i = 0; i < height; i++) { | |||
unsigned char *dst = ((unsigned char *) ptr) + i * rowbytes; | unsigned char *dst = ((unsigned char *) ptr) + i * rowbytes; | |||
unsigned char *src = srcImage + ((height - 1) - i) * width * 4; | unsigned char *src = srcImage + ((height - 1) - i) * width * 4; | |||
for(j = 0; j < width; j++) { | for(j = 0; j < width; j++) { | |||
*dst++ = src[3]; | *dst++ = src[3]; | |||
*dst++ = src[0]; | *dst++ = src[0]; | |||
*dst++ = src[1]; | *dst++ = src[1]; | |||
*dst++ = src[2]; | *dst++ = src[2]; | |||
src += 4; | src += 4; | |||
skipping to change at line 373 | skipping to change at line 380 | |||
} else { | } else { | |||
/* mismatched dimensions, so furnish a white image */ | /* mismatched dimensions, so furnish a white image */ | |||
memset(ptr, 0xFF, 4 * height * width); | memset(ptr, 0xFF, 4 * height * width); | |||
} | } | |||
ExecutiveDrawNow(G); | ExecutiveDrawNow(G); | |||
if(G->HaveGUI) | if(G->HaveGUI) | |||
PyMOL_SwapBuffers(G->PyMOL); | PyMOL_SwapBuffers(G->PyMOL); | |||
} | } | |||
if(!I->CacheSave) { | if(!I->CacheSave) { | |||
if(I->Image[i]) { | if(I->Image[i]) { | |||
FreeP(I->Image[i]->data); | I->Image[i] = nullptr; | |||
FreeP(I->Image[i]); | ||||
} | } | |||
} | } | |||
} | } | |||
return result; | return result; | |||
} | } | |||
int MoviePurgeFrame(PyMOLGlobals * G, int frame) | int MoviePurgeFrame(PyMOLGlobals * G, int frame) | |||
{ | { | |||
CMovie *I = G->Movie; | CMovie *I = G->Movie; | |||
int result = false; | int result = false; | |||
int nFrame; | int nFrame; | |||
int i; | int i; | |||
nFrame = I->NFrame; | nFrame = I->NFrame; | |||
if(!nFrame) { | if(!nFrame) { | |||
nFrame = SceneGetNFrame(G, NULL); | nFrame = SceneGetNFrame(G, NULL); | |||
} | } | |||
if(!I->CacheSave) { | if(!I->CacheSave) { | |||
if(frame < nFrame) { | if(frame < nFrame) { | |||
int a = frame; | int a = frame; | |||
i = MovieFrameToImage(G, a); | i = MovieFrameToImage(G, a); | |||
VLACheck(I->Image, ImageType *, i); | VecCheck(I->Image, i); | |||
if(I->Image[i]) { | if(I->Image[i]) { | |||
FreeP(I->Image[i]->data); | I->Image[i] = nullptr; | |||
FreeP(I->Image[i]); | ||||
I->Image[i] = NULL; | ||||
result = true; | result = true; | |||
} | } | |||
} | } | |||
} | } | |||
return result; | return result; | |||
} | } | |||
void MovieCopyFinish(PyMOLGlobals * G) | void MovieCopyFinish(PyMOLGlobals * G) | |||
{ | { | |||
CMovie *I = G->Movie; | CMovie *I = G->Movie; | |||
skipping to change at line 579 | skipping to change at line 583 | |||
PyList_SetItem(result, 5, MovieCmdAsPyList(G)); | PyList_SetItem(result, 5, MovieCmdAsPyList(G)); | |||
} else { | } else { | |||
PyList_SetItem(result, 5, PConvAutoNone(NULL)); | PyList_SetItem(result, 5, PConvAutoNone(NULL)); | |||
} | } | |||
if(I->ViewElem) { | if(I->ViewElem) { | |||
PyList_SetItem(result, 6, ViewElemVLAAsPyList(G, I->ViewElem, I->NFrame)); | PyList_SetItem(result, 6, ViewElemVLAAsPyList(G, I->ViewElem, I->NFrame)); | |||
} else { | } else { | |||
PyList_SetItem(result, 6, PConvAutoNone(NULL)); | PyList_SetItem(result, 6, PConvAutoNone(NULL)); | |||
} | } | |||
/* ImageType *Image; | /* pymol::Image *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)); | |||
} | } | |||
skipping to change at line 707 | skipping to change at line 711 | |||
if(M->stop > M->nFrame) | if(M->stop > M->nFrame) | |||
M->stop = M->nFrame; | M->stop = M->nFrame; | |||
{ | { | |||
OrthoLineType buffer; | OrthoLineType buffer; | |||
sprintf(buffer, "Creating movie (%d frames)...", M->nFrame); | sprintf(buffer, "Creating movie (%d frames)...", M->nFrame); | |||
OrthoBusyMessage(G, buffer); | OrthoBusyMessage(G, buffer); | |||
} | } | |||
if((M->start != 0) || (M->stop != (M->nFrame + 1))) | if((M->start != 0) || (M->stop != (M->nFrame + 1))) | |||
SceneSetFrame(G, 0, 0); | SceneSetFrame(G, 0, 0); | |||
MoviePlay(G, cMoviePlay); | MoviePlay(G, cMoviePlay); | |||
VLACheck(I->Image, ImageType *, M->nFrame); | VecCheck(I->Image, M->nFrame); | |||
M->frame = 0; | M->frame = 0; | |||
M->stage = 1; | M->stage = 1; | |||
if(G->Interrupt) { | if(G->Interrupt) { | |||
M->stage = 5; /* abort */ | M->stage = 5; /* abort */ | |||
} | } | |||
break; | break; | |||
case 1: /* RENDER LOOP: advance a frame */ | case 1: /* RENDER LOOP: advance a frame */ | |||
if(M->frame < M->nFrame) { | if(M->frame < M->nFrame) { | |||
M->file_missing = true; | M->file_missing = true; | |||
skipping to change at line 756 | skipping to change at line 760 | |||
M->stage = 2; | M->stage = 2; | |||
if(G->Interrupt) { | if(G->Interrupt) { | |||
M->stage = 5; /* abort */ | M->stage = 5; /* abort */ | |||
} | } | |||
} | } | |||
break; | break; | |||
} | } | |||
switch (M->stage) { | switch (M->stage) { | |||
case 2: /* IN RENDER LOOP: create the image */ | case 2: /* IN RENDER LOOP: create the image */ | |||
VLACheck(I->Image, ImageType *, M->image); | VecCheck(I->Image, M->image); | |||
if((M->frame >= M->start) && /* only render frames in the specified i nterval... */ | if((M->frame >= M->start) && /* only render frames in the specified i nterval... */ | |||
(M->frame <= M->stop) && (M->file_missing)) { /* ...that don't already exist */ | (M->frame <= M->stop) && (M->file_missing)) { /* ...that don't already exist */ | |||
if(!I->Image[M->image]) { | if(!I->Image[M->image]) { | |||
SceneUpdate(G, false); | SceneUpdate(G, false); | |||
if(SceneMakeMovieImage(G, false, M->modal, M->mode, M->width, M->height) | if(SceneMakeMovieImage(G, false, M->modal, M->mode, M->width, M->height) | |||
|| !M->modal) { | || !M->modal) { | |||
M->stage = 3; | M->stage = 3; | |||
} else { | } else { | |||
/* didn't get an image... */ | /* didn't get an image... */ | |||
PRINTFB(G, FB_Movie, FB_Errors) | PRINTFB(G, FB_Movie, FB_Errors) | |||
skipping to change at line 788 | skipping to change at line 792 | |||
} | } | |||
break; | break; | |||
} | } | |||
switch (M->stage) { | switch (M->stage) { | |||
case 3: /* IN RENDER LOOP: have image, so write to file * / | case 3: /* IN RENDER LOOP: have image, so write to file * / | |||
if(!I->Image[M->image]) { | if(!I->Image[M->image]) { | |||
PRINTFB(G, FB_Movie, FB_Errors) | PRINTFB(G, FB_Movie, FB_Errors) | |||
"MoviePNG-Error: Missing rendered image.\n" ENDFB(G); | "MoviePNG-Error: Missing rendered image.\n" ENDFB(G); | |||
} else { | } else { | |||
if(!MyPNGWrite(G, M->fname, I->Image[M->image]->data, | if (!MyPNGWrite(M->fname, *I->Image[M->image], | |||
I->Image[M->image]->width, | SettingGetGlobal_f(G, cSetting_image_dots_per_inch), M->format, | |||
I->Image[M->image]->height, | M->quiet, SettingGetGlobal_f(G, cSetting_png_screen_gamma), | |||
SettingGetGlobal_f(G, cSetting_image_dots_per_inch), | SettingGetGlobal_f(G, cSetting_png_file_gamma))) { | |||
M->format, M->quiet)) { | ||||
PRINTFB(G, FB_Movie, FB_Errors) | PRINTFB(G, FB_Movie, FB_Errors) | |||
" MoviePNG-Error: unable to write '%s'\n", M->fname ENDFB(G); | " MoviePNG-Error: unable to write '%s'\n", M->fname ENDFB(G); | |||
} | } | |||
ExecutiveDrawNow(G); | ExecutiveDrawNow(G); | |||
OrthoBusySlow(G, M->frame, M->nFrame); | OrthoBusySlow(G, M->frame, M->nFrame); | |||
if(G->HaveGUI) | if(G->HaveGUI) | |||
PyMOL_SwapBuffers(G->PyMOL); | PyMOL_SwapBuffers(G->PyMOL); | |||
PRINTFB(G, FB_Movie, FB_Debugging) | PRINTFB(G, FB_Movie, FB_Debugging) | |||
" MoviePNG-DEBUG: i = %d, I->Image[image] = %p\n", M->image, | " MoviePNG-DEBUG: i = %d, I->Image[image] = %p\n", M->image, | |||
I->Image[M->image]->data ENDFB(G); | I->Image[M->image]->bits() ENDFB(G); | |||
} | } | |||
if(I->Image[M->image]) { | if(I->Image[M->image]) { | |||
FreeP(I->Image[M->image]->data); | I->Image[M->image] = nullptr; | |||
FreeP(I->Image[M->image]); | ||||
} | } | |||
M->timing = UtilGetSeconds(G) - M->timing; | M->timing = UtilGetSeconds(G) - M->timing; | |||
M->accumTiming += M->timing; | M->accumTiming += M->timing; | |||
{ | { | |||
double est1 = (M->nFrame - M->frame) * M->timing; | double est1 = (M->nFrame - M->frame) * M->timing; | |||
double est2 = ((M->nFrame - M->frame) / (float) (M->frame + 1)) * M->accum Timing; | double est2 = ((M->nFrame - M->frame) / (float) (M->frame + 1)) * M->accum Timing; | |||
PRINTFB(G, FB_Movie, FB_Details) | PRINTFB(G, FB_Movie, FB_Details) | |||
" Movie: frame %4d of %4d, %4.2f sec. (%d:%02d:%02d - %d:%02d:%02d to go ).\n", | " Movie: frame %4d of %4d, %4.2f sec. (%d:%02d:%02d - %d:%02d:%02d to go ).\n", | |||
M->frame + 1, M->nFrame, | M->frame + 1, M->nFrame, | |||
skipping to change at line 994 | skipping to change at line 996 | |||
} | } | |||
} | } | |||
I->NFrame = c; | I->NFrame = c; | |||
} else if(!str[0]) { | } else if(!str[0]) { | |||
I->NFrame = start_from; | I->NFrame = start_from; | |||
} | } | |||
// fixes PYMOL-2710 | // fixes PYMOL-2710 | |||
MovieClearImages(G); | MovieClearImages(G); | |||
VLASize(I->Image, ImageType *, I->NFrame); | I->Image.resize(I->NFrame); | |||
PRINTFB(G, FB_Movie, FB_Debugging) | PRINTFB(G, FB_Movie, FB_Debugging) | |||
" MovieSequence: leaving... I->NFrame%d\n", I->NFrame ENDFB(G); | " MovieSequence: leaving... I->NFrame%d\n", I->NFrame ENDFB(G); | |||
if(!freeze) { | if(!freeze) { | |||
if(SettingGetGlobal_b(G,cSetting_movie_auto_interpolate)) | if(SettingGetGlobal_b(G,cSetting_movie_auto_interpolate)) | |||
ExecutiveMotionReinterpolate(G); | ExecutiveMotionReinterpolate(G); | |||
} | } | |||
ExecutiveCountMotions(G); | ExecutiveCountMotions(G); | |||
} | } | |||
skipping to change at line 1036 | skipping to change at line 1038 | |||
} | } | |||
if(I->ViewElem && I->ViewElem[frame].state_flag) { | if(I->ViewElem && I->ViewElem[frame].state_flag) { | |||
return I->ViewElem[frame].state; | return I->ViewElem[frame].state; | |||
} | } | |||
return (I->Sequence[frame]); | return (I->Sequence[frame]); | |||
} else { | } else { | |||
return (frame); | return (frame); | |||
} | } | |||
} | } | |||
/*========================================================================*/ | /*========================================================================*/ | |||
void MovieSetImage(PyMOLGlobals * G, int index, ImageType * image) | void MovieSetImage(PyMOLGlobals * G, int index, std::shared_ptr<pymol::Image> im age) | |||
{ | { | |||
CMovie *I = G->Movie; | CMovie *I = G->Movie; | |||
PRINTFB(G, FB_Movie, FB_Blather) | PRINTFB(G, FB_Movie, FB_Blather) | |||
" MovieSetImage: setting movie image %d\n", index + 1 ENDFB(G); | " MovieSetImage: setting movie image %d\n", index + 1 ENDFB(G); | |||
VLACheck(I->Image, ImageType *, index); | VecCheck(I->Image, index); | |||
if(I->Image[index]) | ||||
FreeP(I->Image[index]); | ||||
I->Image[index] = image; | I->Image[index] = image; | |||
if(I->NImage < (index + 1)) | if(I->NImage < (index + 1)) | |||
I->NImage = index + 1; | I->NImage = index + 1; | |||
} | } | |||
int MovieSeekScene(PyMOLGlobals * G, int loop) | int MovieSeekScene(PyMOLGlobals * G, int loop) | |||
{ | { | |||
CMovie *I = G->Movie; | CMovie *I = G->Movie; | |||
int result = -1; | int result = -1; | |||
OVreturn_word ret; | OVreturn_word ret; | |||
skipping to change at line 1447 | skipping to change at line 1447 | |||
I->Cmd[frame][cur_len + a] = command[a]; | I->Cmd[frame][cur_len + a] = command[a]; | |||
I->Cmd[frame][cur_len + len] = 0; | I->Cmd[frame][cur_len + len] = 0; | |||
} else { | } else { | |||
PRINTFB(G, FB_Movie, FB_Errors) | PRINTFB(G, FB_Movie, FB_Errors) | |||
" Movie-Error: frame %d does not exist. Use 'mset' to define movie first. \n", | " Movie-Error: frame %d does not exist. Use 'mset' to define movie first. \n", | |||
frame + 1 ENDFB(G); | frame + 1 ENDFB(G); | |||
} | } | |||
} | } | |||
/*========================================================================*/ | /*========================================================================*/ | |||
ImageType *MovieGetImage(PyMOLGlobals * G, int index) | std::shared_ptr<pymol::Image> MovieGetImage(PyMOLGlobals * G, int index) | |||
{ | { | |||
CMovie *I = G->Movie; | CMovie *I = G->Movie; | |||
if((index >= 0) && (index < I->NImage)) | if((index >= 0) && (index < I->NImage)) | |||
return (I->Image[index]); | return I->Image[index]; | |||
else | else | |||
return (NULL); | return nullptr; | |||
} | } | |||
/*========================================================================*/ | /*========================================================================*/ | |||
int MovieDefined(PyMOLGlobals * G) | int MovieDefined(PyMOLGlobals * G) | |||
{ | { | |||
CMovie *I = G->Movie; | CMovie *I = G->Movie; | |||
return (I->NFrame > 0); | return (I->NFrame > 0); | |||
} | } | |||
/*========================================================================*/ | /*========================================================================*/ | |||
skipping to change at line 1483 | skipping to change at line 1483 | |||
} | } | |||
/*========================================================================*/ | /*========================================================================*/ | |||
void MovieClearImages(PyMOLGlobals * G) | void MovieClearImages(PyMOLGlobals * G) | |||
{ | { | |||
CMovie *I = G->Movie; | CMovie *I = G->Movie; | |||
int a; | int a; | |||
PRINTFB(G, FB_Movie, FB_Blather) | PRINTFB(G, FB_Movie, FB_Blather) | |||
" MovieClearImages: clearing...\n" ENDFB(G); | " MovieClearImages: clearing...\n" ENDFB(G); | |||
if(I->Image) { | I->Image.clear(); | |||
for(a = 0; a < I->NImage; a++) { | ||||
if(I->Image[a]) { | ||||
FreeP(I->Image[a]->data); | ||||
FreeP(I->Image[a]); | ||||
I->Image[a] = NULL; | ||||
} | ||||
} | ||||
} | ||||
I->NImage = 0; | I->NImage = 0; | |||
SceneInvalidate(G); | SceneInvalidate(G); | |||
SceneSuppressMovieFrame(G); | SceneSuppressMovieFrame(G); | |||
} | } | |||
/*========================================================================*/ | /*========================================================================*/ | |||
void MovieReset(PyMOLGlobals * G) | void MovieReset(PyMOLGlobals * G) | |||
{ | { | |||
CMovie *I = G->Movie; | CMovie *I = G->Movie; | |||
MovieClearImages(G); | MovieClearImages(G); | |||
skipping to change at line 1518 | skipping to change at line 1510 | |||
I->MatrixFlag = false; | I->MatrixFlag = false; | |||
I->Locked = false; | I->Locked = false; | |||
I->Playing = false; | I->Playing = false; | |||
} | } | |||
/*========================================================================*/ | /*========================================================================*/ | |||
void MovieFree(PyMOLGlobals * G) | void MovieFree(PyMOLGlobals * G) | |||
{ | { | |||
CMovie *I = G->Movie; | CMovie *I = G->Movie; | |||
MovieClearImages(G); | MovieClearImages(G); | |||
VLAFree(I->Image); | ||||
VLAFreeP(I->ViewElem); | VLAFreeP(I->ViewElem); | |||
VLAFreeP(I->Cmd); | VLAFreeP(I->Cmd); | |||
VLAFreeP(I->Sequence); | VLAFreeP(I->Sequence); | |||
ScrollBarFree(I->ScrollBar); | DeleteP(G->Movie); | |||
OrthoFreeBlock(G, I->Block); | ||||
FreeP(G->Movie); | ||||
} | } | |||
Block *MovieGetBlock(PyMOLGlobals * G) | Block *MovieGetBlock(PyMOLGlobals * G) | |||
{ | { | |||
CMovie *I = G->Movie; | return G->Movie; | |||
return (I->Block); | ||||
} | } | |||
void MoviePrepareDrag(PyMOLGlobals *G, BlockRect * rect, | void MoviePrepareDrag(PyMOLGlobals *G, BlockRect * rect, | |||
CObject * obj, int mode, int x, int y, int nearest) | CObject * obj, int mode, int x, int y, int nearest) | |||
{ | { | |||
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->rect.top - 1; | |||
I->DragRect.bottom = I->Block->rect.bottom + 1; | I->DragRect.bottom = I->rect.bottom + 1; | |||
} | } | |||
I->DragStartFrame = ViewElemXtoFrame(rect,MovieGetLength(G),x,nearest); | 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(rect,MovieGetLength(G),x,nearest); | 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) | int CMovie::click(int button, int x, int y, int mod) | |||
{ | { | |||
PyMOLGlobals *G = block->G; | PyMOLGlobals *G = m_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 tmpRect = rect; | |||
rect.right -= I->LabelIndent; | tmpRect.right -= I->LabelIndent; | |||
switch(button) { | switch(button) { | |||
case P_GLUT_RIGHT_BUTTON: | case P_GLUT_RIGHT_BUTTON: | |||
{ | { | |||
int n_frame = MovieGetLength(G); | int n_frame = MovieGetLength(G); | |||
if(mod == (cOrthoCTRL | cOrthoSHIFT)) | if(mod == (cOrthoCTRL | cOrthoSHIFT)) | |||
I->DragColumn = true; | I->DragColumn = true; | |||
if(mod == (cOrthoSHIFT)) | if(mod == (cOrthoSHIFT)) | |||
ExecutiveMotionClick(G,&rect,cMovieDragModeCopyKey,count,x,y,false); | ExecutiveMotionClick(G,&tmpRect,cMovieDragModeCopyKey,count,x,y,false); | |||
else | else | |||
ExecutiveMotionClick(G,&rect,cMovieDragModeMoveKey,count,x,y,false); | ExecutiveMotionClick(G,&tmpRect,cMovieDragModeMoveKey,count,x,y,false); | |||
if(I->DragStartFrame<n_frame) { | if(I->DragStartFrame<n_frame) { | |||
I->DragDraw = true; | I->DragDraw = true; | |||
I->DragMenu = true; | I->DragMenu = true; | |||
OrthoDirty(G); | OrthoDirty(G); | |||
} else { | } else { | |||
ExecutiveMotionMenuActivate(G,&rect,count,false,x,y,I->DragColumn); | ExecutiveMotionMenuActivate(G,&tmpRect,count,false,x,y,I->DragColumn); | |||
} | } | |||
} | } | |||
break; | break; | |||
case P_GLUT_LEFT_BUTTON: | case P_GLUT_LEFT_BUTTON: | |||
{ | { | |||
switch(mod) { | switch(mod) { | |||
case cOrthoSHIFT: /* TEMPORAL SELECTIONS -- TO COME in PYMOL 1.3+ */ | case cOrthoSHIFT: /* TEMPORAL SELECTIONS -- TO COME in PYMOL 1.3+ */ | |||
break; | break; | |||
case (cOrthoSHIFT | cOrthoCTRL): | case (cOrthoSHIFT | cOrthoCTRL): | |||
I->DragColumn = true; | I->DragColumn = true; | |||
ExecutiveMotionClick(G,&rect,cMovieDragModeInsDel,count,x,y, true); | ExecutiveMotionClick(G,&tmpRect,cMovieDragModeInsDel,count,x,y, true); | |||
I->DragDraw = true; | I->DragDraw = true; | |||
OrthoDirty(G); | OrthoDirty(G); | |||
break; | break; | |||
case cOrthoCTRL: | case cOrthoCTRL: | |||
ExecutiveMotionClick(G,&rect,cMovieDragModeInsDel,count,x,y, true); | ExecutiveMotionClick(G,&tmpRect,cMovieDragModeInsDel,count,x,y, true); | |||
I->DragDraw = true; | I->DragDraw = true; | |||
OrthoDirty(G); | OrthoDirty(G); | |||
break; | break; | |||
default: | default: | |||
ScrollBarDoClick(I->ScrollBar, button, x, y, mod); | I->m_ScrollBar.click(button, x, y, mod); | |||
{ | { | |||
float scroll_value = ScrollBarGetValue(I->ScrollBar); | SceneSetFrame(G, 7, I->m_ScrollBar.getValue()); | |||
SceneSetFrame(G, 7, scroll_value); | ||||
} | } | |||
break; | break; | |||
} | } | |||
} | } | |||
break; | break; | |||
case P_GLUT_MIDDLE_BUTTON: | case P_GLUT_MIDDLE_BUTTON: | |||
{ | { | |||
switch(mod) { | switch(mod) { | |||
case (cOrthoCTRL | cOrthoSHIFT): | case (cOrthoCTRL | cOrthoSHIFT): | |||
I->DragColumn = true; | I->DragColumn = true; | |||
/* intentional fall-through */ | /* intentional fall-through */ | |||
case cOrthoCTRL: | case cOrthoCTRL: | |||
I->DragDraw = true; | I->DragDraw = true; | |||
ExecutiveMotionClick(G,&rect,cMovieDragModeOblate,count,x,y,false); | ExecutiveMotionClick(G,&tmpRect,cMovieDragModeOblate,count,x,y,false); | |||
break; | break; | |||
default: | default: | |||
ScrollBarDoClick(I->ScrollBar, button, x, y, mod); | I->m_ScrollBar.click(button, x, y, mod); | |||
break; | break; | |||
} | } | |||
} | } | |||
break; | break; | |||
case P_GLUT_BUTTON_SCROLL_FORWARD: | case P_GLUT_BUTTON_SCROLL_FORWARD: | |||
scrolldir = -1; | scrolldir = -1; | |||
case P_GLUT_BUTTON_SCROLL_BACKWARD: | case P_GLUT_BUTTON_SCROLL_BACKWARD: | |||
switch(mod) { | switch(mod) { | |||
case (cOrthoCTRL | cOrthoSHIFT): | case (cOrthoCTRL | cOrthoSHIFT): | |||
SettingSetGlobal_i(G, cSetting_movie_panel_row_height, | SettingSetGlobal_i(G, cSetting_movie_panel_row_height, | |||
skipping to change at line 1640 | skipping to change at line 1627 | |||
OrthoReshape(G,-1,-1,true); | OrthoReshape(G,-1,-1,true); | |||
break; | break; | |||
default: | default: | |||
SceneSetFrame(G, 5, scrolldir); | SceneSetFrame(G, 5, scrolldir); | |||
} | } | |||
break; | break; | |||
} | } | |||
return 1; | return 1; | |||
} | } | |||
static int MovieDrag(Block * block, int x, int y, int mod) | int CMovie::drag(int x, int y, int mod) | |||
{ | { | |||
PyMOLGlobals *G = block->G; | PyMOLGlobals *G = m_G; | |||
CMovie *I = G->Movie; | CMovie *I = this; // TODO: Remove all I's in Movie refactor | |||
if(I->DragMode) { | if(I->DragMode) { | |||
I->DragDraw = ((y < (block->rect.top + 50)) && (y > (block->rect.bottom - 50 ))); | I->DragDraw = ((y < (rect.top + 50)) && (y > (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(&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; | |||
skipping to change at line 1675 | skipping to change at line 1662 | |||
break; | break; | |||
case cMovieDragModeInsDel: | case cMovieDragModeInsDel: | |||
I->DragCurFrame = ViewElemXtoFrame(&I->DragRect,MovieGetLength(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) | int CMovie::release(int button, int x, int y, int mod) | |||
{ | { | |||
PyMOLGlobals *G = block->G; | PyMOLGlobals *G = m_G; | |||
CMovie *I = G->Movie; | CMovie *I = G->Movie; | |||
ScrollBarDoRelease(I->ScrollBar, button, x, y, mod); | I->m_ScrollBar.release(button, x, y, mod); | |||
if(I->DragMode) { | if(I->DragMode) { | |||
OrthoLineType buffer = ""; | OrthoLineType buffer = ""; | |||
OrthoLineType extra = ""; | OrthoLineType extra = ""; | |||
int n_frame = MovieGetLength(G); | int n_frame = MovieGetLength(G); | |||
if(I->DragColumn) { | if(I->DragColumn) { | |||
sprintf(extra,",object=''"); | sprintf(extra,",object=''"); | |||
} else if(I->DragObj && ExecutiveValidateObjectPtr(G,I->DragObj,0)) { | } else if(I->DragObj && ExecutiveValidateObjectPtr(G,I->DragObj,0)) { | |||
sprintf(extra,",object='%s'",I->DragObj->Name); | sprintf(extra,",object='%s'",I->DragObj->Name); | |||
} else { | } else { | |||
sprintf(extra,",object='none'"); | sprintf(extra,",object='none'"); | |||
} | } | |||
switch(I->DragMode) { | switch(I->DragMode) { | |||
case cMovieDragModeMoveKey: | case cMovieDragModeMoveKey: | |||
if((I->DragCurFrame == I->DragStartFrame) && (I->DragMenu)) { | if((I->DragCurFrame == I->DragStartFrame) && (I->DragMenu)) { | |||
int count = ExecutiveCountMotions(G); | int count = ExecutiveCountMotions(G); | |||
BlockRect rect = block->rect; | BlockRect tmpRect = rect; | |||
rect.right -= I->LabelIndent; | tmpRect.right -= I->LabelIndent; | |||
ExecutiveMotionMenuActivate(G,&rect,count,true,x,y,I->DragColumn); | ExecutiveMotionMenuActivate(G,&tmpRect,count,true,x,y,I->DragColumn); | |||
I->DragMenu = false; | I->DragMenu = false; | |||
} else if(I->DragDraw && | } else if(I->DragDraw && | |||
(I->DragCurFrame!=I->DragStartFrame) && | (I->DragCurFrame!=I->DragStartFrame) && | |||
(I->DragCurFrame >= 0) && | (I->DragCurFrame >= 0) && | |||
(I->DragCurFrame < n_frame)) { | (I->DragCurFrame < n_frame)) { | |||
sprintf(buffer,"cmd.mmove(%d,%d,%d%s)", 1+I->DragCurFrame, 1+I->DragStar tFrame, 1, extra); | sprintf(buffer,"cmd.mmove(%d,%d,%d%s)", 1+I->DragCurFrame, 1+I->DragStar tFrame, 1, extra); | |||
} | } | |||
break; | break; | |||
case cMovieDragModeCopyKey: | case cMovieDragModeCopyKey: | |||
if((I->DragCurFrame == I->DragStartFrame) && (I->DragMenu)) { | if((I->DragCurFrame == I->DragStartFrame) && (I->DragMenu)) { | |||
int count = ExecutiveCountMotions(G); | int count = ExecutiveCountMotions(G); | |||
BlockRect rect = block->rect; | BlockRect tmpRect = rect; | |||
rect.right -= I->LabelIndent; | tmpRect.right -= I->LabelIndent; | |||
ExecutiveMotionMenuActivate(G,&rect,count,true,x,y,I->DragColumn); | ExecutiveMotionMenuActivate(G,&tmpRect,count,true,x,y,I->DragColumn); | |||
I->DragMenu = false; | I->DragMenu = false; | |||
} else if(I->DragDraw && | } else if(I->DragDraw && | |||
(I->DragCurFrame!=I->DragStartFrame) && | (I->DragCurFrame!=I->DragStartFrame) && | |||
(I->DragCurFrame >= 0) && | (I->DragCurFrame >= 0) && | |||
(I->DragCurFrame < n_frame)) { | (I->DragCurFrame < n_frame)) { | |||
sprintf(buffer,"cmd.mcopy(%d,%d,%d%s)", 1+I->DragCurFrame, 1+I->DragStar tFrame, 1, extra); | sprintf(buffer,"cmd.mcopy(%d,%d,%d%s)", 1+I->DragCurFrame, 1+I->DragStar tFrame, 1, extra); | |||
} | } | |||
break; | break; | |||
case cMovieDragModeOblate: | case cMovieDragModeOblate: | |||
if(I->DragDraw) { | if(I->DragDraw) { | |||
skipping to change at line 1802 | skipping to change at line 1789 | |||
} | } | |||
void MovieDrawViewElem(PyMOLGlobals *G, BlockRect *rect,int frames ORTHOCGOARG) | void MovieDrawViewElem(PyMOLGlobals *G, BlockRect *rect,int frames ORTHOCGOARG) | |||
{ | { | |||
CMovie *I = G->Movie; | CMovie *I = G->Movie; | |||
if(I->ViewElem) { | if(I->ViewElem) { | |||
ViewElemDraw(G,I->ViewElem,rect,frames,"camera" ORTHOCGOARGVAR); | ViewElemDraw(G,I->ViewElem,rect,frames,"camera" ORTHOCGOARGVAR); | |||
} | } | |||
} | } | |||
static short MovieFastDraw(Block * block ORTHOCGOARG) | bool CMovie::fastDraw(CGO* orthoCGO) | |||
{ | { | |||
PyMOLGlobals *G = block->G; | PyMOLGlobals *G = m_G; | |||
CMovie *I = G->Movie; | CMovie *I = G->Movie; | |||
// ScrollBarDrawHandle(I->ScrollBar, 0.35F ORTHOCGOARGVAR); | I->m_ScrollBar.drawNoFill(orthoCGO); | |||
ScrollBarDoDrawNoFill(I->ScrollBar ORTHOCGOARGVAR); | I->m_ScrollBar.drawHandle(0.35F, orthoCGO); | |||
ScrollBarDrawHandle(I->ScrollBar, 0.35F ORTHOCGOARGVAR); | ||||
return true; | return true; | |||
} | } | |||
static void MovieDraw(Block * block ORTHOCGOARG) | void CMovie::draw(CGO* orthoCGO) | |||
{ | { | |||
PyMOLGlobals *G = block->G; | PyMOLGlobals *G = m_G; | |||
CMovie *I = G->Movie; | CMovie *I = G->Movie; | |||
if(I->PanelActive) { | if(I->PanelActive) { | |||
int n_frame = MovieGetLength(G); | int n_frame = MovieGetLength(G); | |||
int frame = SceneGetFrame(G); | int frame = SceneGetFrame(G); | |||
int count = ExecutiveCountMotions(G); | int count = ExecutiveCountMotions(G); | |||
BlockRect rect = block->rect; | BlockRect tmpRect = rect; | |||
if(count) { | if(count) { | |||
rect.right -= I->LabelIndent; | tmpRect.right -= I->LabelIndent; | |||
if(G->HaveGUI && G->ValidContext) { | if(G->HaveGUI && G->ValidContext) { | |||
float black[3] = {0.0F,0.0F,0.0F}; | float black[3] = {0.0F,0.0F,0.0F}; | |||
if (orthoCGO){ | if (orthoCGO){ | |||
CGOColorv(orthoCGO, black); | CGOColorv(orthoCGO, black); | |||
CGOBegin(orthoCGO, GL_TRIANGLE_STRIP); | CGOBegin(orthoCGO, GL_TRIANGLE_STRIP); | |||
CGOVertex(orthoCGO, rect.right, rect.bottom, 0.f); | CGOVertex(orthoCGO, tmpRect.right, tmpRect.bottom, 0.f); | |||
CGOVertex(orthoCGO, rect.right, rect.top, 0.f); | CGOVertex(orthoCGO, tmpRect.right, tmpRect.top, 0.f); | |||
CGOVertex(orthoCGO, block->rect.right, rect.bottom, 0.f); | CGOVertex(orthoCGO, rect.right, tmpRect.bottom, 0.f); | |||
CGOVertex(orthoCGO, block->rect.right, rect.top, 0.f); | CGOVertex(orthoCGO, rect.right, tmpRect.top, 0.f); | |||
CGOEnd(orthoCGO); | CGOEnd(orthoCGO); | |||
} else { | } else { | |||
glColor3fv(black); | glColor3fv(black); | |||
glBegin(GL_POLYGON); | glBegin(GL_POLYGON); | |||
glVertex2f(rect.right, rect.bottom); | glVertex2f(tmpRect.right, tmpRect.bottom); | |||
glVertex2f(rect.right, rect.top); | glVertex2f(tmpRect.right, tmpRect.top); | |||
glVertex2f(block->rect.right, rect.top); | glVertex2f(rect.right, tmpRect.top); | |||
glVertex2f(block->rect.right, rect.bottom); | glVertex2f(rect.right, tmpRect.bottom); | |||
glEnd(); | glEnd(); | |||
} | } | |||
} | } | |||
if(!n_frame) { | if(!n_frame) { | |||
ScrollBarSetLimits(I->ScrollBar, 1, 1); | I->m_ScrollBar.setLimits(1, 1); | |||
ScrollBarSetValue(I->ScrollBar, 0); | I->m_ScrollBar.setValue(0); | |||
} else { | } else { | |||
float scroll_value = ScrollBarGetValue(I->ScrollBar); | float scroll_value = I->m_ScrollBar.getValue(); | |||
int new_frame = (int) (scroll_value + 0.5F); | int new_frame = (int) (scroll_value + 0.5F); | |||
if(ScrollBarGrabbed(I->ScrollBar)) { | if(I->m_ScrollBar.grabbed()) { | |||
if(new_frame != frame) { | if(new_frame != frame) { | |||
frame = new_frame; | frame = new_frame; | |||
SceneSetFrame(G, 7, frame); | SceneSetFrame(G, 7, frame); | |||
} | } | |||
} else { | ||||
ScrollBarSetValue(I->ScrollBar, frame); | ||||
} | } | |||
ScrollBarSetLimits(I->ScrollBar, n_frame, 1); | I->m_ScrollBar.setLimits(n_frame, 1); | |||
} | } | |||
ScrollBarSetBox(I->ScrollBar, rect.top, | I->m_ScrollBar.setBox(tmpRect.top, tmpRect.left, | |||
rect.left, rect.bottom, rect.right); | tmpRect.bottom, tmpRect.right); | |||
if (orthoCGO){ | if (orthoCGO){ | |||
ScrollBarFill(I->ScrollBar ORTHOCGOARGVAR); | I->m_ScrollBar.fill(orthoCGO); | |||
ExecutiveMotionDraw(G,&rect,count ORTHOCGOARGVAR); | ExecutiveMotionDraw(G,&tmpRect,count ORTHOCGOARGVAR); | |||
} else { | } else { | |||
ScrollBarDoDraw(I->ScrollBar ORTHOCGOARGVAR); | I->m_ScrollBar.draw(orthoCGO); | |||
ExecutiveMotionDraw(G,&rect,count ORTHOCGOARGVAR); | ExecutiveMotionDraw(G,&tmpRect,count ORTHOCGOARGVAR); | |||
ScrollBarDrawHandle(I->ScrollBar, 0.35F ORTHOCGOARGVAR); | I->m_ScrollBar.drawHandle(0.35F, orthoCGO); | |||
} | } | |||
/* drag selection box */ | /* drag selection box */ | |||
if(I->DragDraw) { | if(I->DragDraw) { | |||
float white[4] = {1.0F, 1.0F, 1.0F,0.5F}; | float white[4] = {1.0F, 1.0F, 1.0F,0.5F}; | |||
switch(I->DragMode) { | switch(I->DragMode) { | |||
case cMovieDragModeMoveKey: | case cMovieDragModeMoveKey: | |||
case cMovieDragModeCopyKey: | case cMovieDragModeCopyKey: | |||
skipping to change at line 1924 | skipping to change at line 1908 | |||
} | } | |||
} | } | |||
} | } | |||
} | } | |||
} | } | |||
void MovieSetScrollBarFrame(PyMOLGlobals * G, int frame) | void MovieSetScrollBarFrame(PyMOLGlobals * G, int frame) | |||
{ | { | |||
CMovie *I = G->Movie; | CMovie *I = G->Movie; | |||
if(!ScrollBarGrabbed(I->ScrollBar)) { | if(!I->m_ScrollBar.grabbed()) { | |||
ScrollBarSetValue(I->ScrollBar, frame); | I->m_ScrollBar.setValue(frame); | |||
} | } | |||
} | } | |||
static void MovieReshape(Block * block, int width, int height) | void CMovie::reshape(int width, int height) | |||
{ | { | |||
PyMOLGlobals *G = block->G; | PyMOLGlobals *G = m_G; | |||
CMovie *I = G->Movie; | CMovie *I = G->Movie; | |||
BlockReshape(block, width, height); | Block::reshape(width, height); | |||
I->Width = block->rect.right - block->rect.left + 1; | I->Width = rect.right - rect.left + 1; | |||
I->Height = block->rect.top - block->rect.bottom + 1; | I->Height = rect.top - 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 = DIP2PIXEL(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 = new CMovie(G)))) { | |||
int a; | int a; | |||
I->Block = OrthoNewBlock(G, NULL); | I->active = true; | |||
I->Block->fRelease = MovieRelease; | OrthoAttach(G, I, cOrthoTool); | |||
I->Block->fClick = MovieClick; | ||||
I->Block->fDrag = MovieDrag; | ||||
I->Block->fDraw = MovieDraw; | ||||
I->Block->fFastDraw = MovieFastDraw; | ||||
I->Block->fReshape = MovieReshape; | ||||
I->Block->active = true; | ||||
I->ScrollBar = ScrollBarNew(G, true); | ||||
OrthoAttach(G, I->Block, cOrthoTool); | ||||
I->Playing = false; | ||||
I->Image = VLACalloc(ImageType *, 10); /* auto-zero */ | ||||
I->Sequence = NULL; | ||||
I->Cmd = NULL; | ||||
I->ViewElem = NULL; | ||||
I->NImage = 0; | ||||
I->NFrame = 0; | ||||
I->RecursionFlag = false; | ||||
I->RealtimeFlag = true; | ||||
for(a = 0; a < 16; a++) | for(a = 0; a < 16; a++) | |||
I->Matrix[a] = 0.0F; | I->Matrix[a] = 0.0F; | |||
I->MatrixFlag = false; | ||||
return 1; | return 1; | |||
} else { | } else { | |||
return 0; | return 0; | |||
} | } | |||
} | } | |||
End of changes. 75 change blocks. | ||||
165 lines changed or deleted | 132 lines changed or added |