View.cpp (pymol-v1.8.6.0.tar.bz2) | : | View.cpp (pymol-v2.1.0.tar.bz2) | ||
---|---|---|---|---|
skipping to change at line 70 | skipping to change at line 70 | |||
dst = target+i; | dst = target+i; | |||
} else { | } else { | |||
src = index+(count-1)-i; | src = index+(count-1)-i; | |||
dst = target+(count-1)-i; | dst = target+(count-1)-i; | |||
} | } | |||
memcpy(vla + dst, vla + src, sizeof(CViewElem)); | memcpy(vla + dst, vla + src, sizeof(CViewElem)); | |||
memset(vla + src, 0, sizeof(CViewElem)); | memset(vla + src, 0, sizeof(CViewElem)); | |||
} | } | |||
} | } | |||
} | } | |||
} | } | |||
break; | break; | |||
case cViewElemModifyCopy: | case cViewElemModifyCopy: | |||
if((index>=0) && (target>=0) && (index<n_frame) && (target<n_frame)) { | if((index>=0) && (target>=0) && (index<n_frame) && (target<n_frame)) { | |||
if((count>1)||(vla[index].specification_level>1)) { | if((count>1)||(vla[index].specification_level>1)) { | |||
int i; | int i; | |||
for(i=0;i<count;i++) { | for(i=0;i<count;i++) { | |||
if( ((i+index)<n_frame) && ((i+target)<n_frame)) { | if( ((i+index)<n_frame) && ((i+target)<n_frame)) { | |||
int src,dst; | int src,dst; | |||
if(index>target) { | if(index>target) { | |||
skipping to change at line 99 | skipping to change at line 98 | |||
} | } | |||
} | } | |||
} | } | |||
break; | break; | |||
} | } | |||
} | } | |||
*handle = vla; | *handle = vla; | |||
return ok; | return ok; | |||
} | } | |||
int ViewElemXtoFrame(PyMOLGlobals *G, CViewElem * view_elem, BlockRect *rect, in t frames, int x, int nearest) | int ViewElemXtoFrame(BlockRect *rect, int frames, int x, int nearest) | |||
{ | { | |||
int nDrawn = frames; | ||||
int offset = 0; | int offset = 0; | |||
float width = (float) (rect->right - rect->left); | float width = (float) (rect->right - rect->left); | |||
float extra = (nearest ? 0.4999F : 0.0F); | float extra = (nearest ? 0.4999F : 0.0F); | |||
int frame = (int)(extra + (nDrawn * (x - rect->left )) / width + offset); | int frame = (int)(extra + (frames * (x - rect->left )) / width + offset); | |||
return frame; | return frame; | |||
} | } | |||
void ViewElemDrawBox(PyMOLGlobals *G, BlockRect *rect, int first, int last, | void ViewElemDrawBox(PyMOLGlobals *G, BlockRect *rect, int first, int last, | |||
int frames, float *color4,int fill ORTHOCGOARG) | int frames, float *color4,int fill ORTHOCGOARG) | |||
{ | { | |||
if(G->HaveGUI && G->ValidContext && rect) { | if(G->HaveGUI && G->ValidContext && rect) { | |||
int nDrawn = frames; | int nDrawn = frames; | |||
int offset = 0; | int offset = 0; | |||
float width = (float) (rect->right - rect->left); | float width = (float) (rect->right - rect->left); | |||
skipping to change at line 167 | skipping to change at line 165 | |||
} | } | |||
} | } | |||
void ViewElemDraw(PyMOLGlobals *G, CViewElem * view_elem, BlockRect *rect, int f rames, | void ViewElemDraw(PyMOLGlobals *G, CViewElem * view_elem, BlockRect *rect, int f rames, | |||
const char *title ORTHOCGOARG) | const char *title ORTHOCGOARG) | |||
{ | { | |||
if(G->HaveGUI && G->ValidContext && view_elem) { | if(G->HaveGUI && G->ValidContext && view_elem) { | |||
int size = VLAGetSize(view_elem); | int size = VLAGetSize(view_elem); | |||
float width = (float) (rect->right - rect->left); | float width = (float) (rect->right - rect->left); | |||
float start = 0.0F, stop; | float start = 0.0F, stop; | |||
int offset = 0; | const int last = size; | |||
int first = 0; | ||||
int last = size; | ||||
int nDrawn = frames; | ||||
float top = rect->top - 2; | float top = rect->top - 2; | |||
float bot = rect->bottom + 2; | float bot = rect->bottom + 2; | |||
float mid_top = (int)((0.499F + 3 * top + 2 * bot) / 5); | float mid_top = (int)((0.499F + 3 * top + 2 * bot) / 5); | |||
float mid_bot = (int)((0.499F + 2 * top + 3 * bot) / 5); | float mid_bot = (int)((0.499F + 2 * top + 3 * bot) / 5); | |||
float top_color[3] = { 0.6, 0.6, 1.0 }; | float top_color[3] = { 0.6, 0.6, 1.0 }; | |||
float key_color[3] = { 0.4, 0.4, 0.8 }; | float key_color[3] = { 0.4, 0.4, 0.8 }; | |||
float bar_color[3] = { 0.3, 0.3, 0.6 }; | float bar_color[3] = { 0.3, 0.3, 0.6 }; | |||
float bot_color[3] = { 0.2, 0.2, 0.4 }; | float bot_color[3] = { 0.2, 0.2, 0.4 }; | |||
int cur_level = -1, last_level = -1; | int cur_level = -1, last_level = -1; | |||
int cur; | int cur; | |||
for(cur = first; cur <= last; cur++) { | for(cur = 0; cur <= last; cur++) { | |||
if(cur < last) { | if(cur < last) { | |||
if(cur>=size) | ||||
cur_level = -1; | ||||
else | ||||
cur_level = view_elem->specification_level; | cur_level = view_elem->specification_level; | |||
} else { | } else { | |||
cur_level = -1; | cur_level = -1; | |||
} | } | |||
if(cur_level != last_level) { | if(cur_level != last_level) { | |||
stop = (int)(rect->left + (width * (cur - offset)) / nDrawn); | stop = (int)(rect->left + (width * cur) / frames); | |||
switch (last_level) { | switch (last_level) { | |||
case 0: | case 0: | |||
break; | break; | |||
case 1: | case 1: | |||
if (orthoCGO){ | if (orthoCGO){ | |||
CGOColorv(orthoCGO, bar_color); | CGOColorv(orthoCGO, bar_color); | |||
CGOBegin(orthoCGO, GL_TRIANGLE_STRIP); | CGOBegin(orthoCGO, GL_TRIANGLE_STRIP); | |||
CGOVertex(orthoCGO, start, mid_bot, 0.f); | CGOVertex(orthoCGO, start, mid_bot, 0.f); | |||
CGOVertex(orthoCGO, start, mid_top, 0.f); | CGOVertex(orthoCGO, start, mid_top, 0.f); | |||
CGOVertex(orthoCGO, stop, mid_bot, 0.f); | CGOVertex(orthoCGO, stop, mid_bot, 0.f); | |||
skipping to change at line 303 | skipping to change at line 295 | |||
glVertex2f(stop,bot-1); | glVertex2f(stop,bot-1); | |||
glVertex2f(stop,bot); | glVertex2f(stop,bot); | |||
glVertex2f(stop,top); | glVertex2f(stop,top); | |||
glColor3fv(top_color); | glColor3fv(top_color); | |||
glVertex2f(start,top); | glVertex2f(start,top); | |||
glVertex2f(stop,top); | glVertex2f(stop,top); | |||
glVertex2f(start,bot); | glVertex2f(start,bot); | |||
glVertex2f(start,top); | glVertex2f(start,top); | |||
glEnd(); | glEnd(); | |||
} | } | |||
break; | break; | |||
} | } | |||
start = (int)(rect->left + (width * (cur - offset)) / nDrawn); | start = stop; | |||
} | } | |||
last_level = cur_level; | last_level = cur_level; | |||
view_elem++; | view_elem++; | |||
} | } | |||
if(title) | if(title) | |||
TextDrawStrAt(G, title, rect->right + 1, (rect->bottom+rect->top)/2 - 3 OR THOCGOARGVAR); | TextDrawStrAt(G, title, rect->right + 1, (rect->bottom+rect->top)/2 - 3 OR THOCGOARGVAR); | |||
} | } | |||
} | } | |||
skipping to change at line 433 | skipping to change at line 424 | |||
} | } | |||
} | } | |||
return PConvAutoNone(result); | return PConvAutoNone(result); | |||
#endif | #endif | |||
} | } | |||
int ViewElemFromPyList(PyMOLGlobals * G, PyObject * list, CViewElem * view) | int ViewElemFromPyList(PyMOLGlobals * G, PyObject * list, CViewElem * view) | |||
{ | { | |||
#ifdef _PYMOL_NOPY | ||||
return 0; | ||||
#else | ||||
int ok = true; | int ok = true; | |||
ov_size ll = 0; | ov_size ll = 0; | |||
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) | |||
ok = ((ll = PyList_Size(list)) > 11); | ok = ((ll = PyList_Size(list)) > 11); | |||
skipping to change at line 491 | skipping to change at line 478 | |||
if(ok) | if(ok) | |||
ok = PConvPyIntToInt(PyList_GetItem(list, 11), &view->view_mode); | ok = PConvPyIntToInt(PyList_GetItem(list, 11), &view->view_mode); | |||
if(ok) | if(ok) | |||
ok = PConvPyIntToInt(PyList_GetItem(list, 12), &view->specification_level); | ok = PConvPyIntToInt(PyList_GetItem(list, 12), &view->specification_level); | |||
if(ok & (ll > 14)) { | if(ok & (ll > 14)) { | |||
if(ok) | if(ok) | |||
ok = PConvPyIntToInt(PyList_GetItem(list, 13), &view->scene_flag); | ok = PConvPyIntToInt(PyList_GetItem(list, 13), &view->scene_flag); | |||
if(ok && view->scene_flag) { | if(ok && view->scene_flag) { | |||
char *ptr = NULL; | const char *ptr = NULL; | |||
view->scene_flag = false; | view->scene_flag = false; | |||
if(PConvPyStrToStrPtr(PyList_GetItem(list, 14), &ptr)) { | if(PConvPyStrToStrPtr(PyList_GetItem(list, 14), &ptr)) { | |||
OVreturn_word result = OVLexicon_GetFromCString(G->Lexicon, ptr); | OVreturn_word result = OVLexicon_GetFromCString(G->Lexicon, ptr); | |||
if(OVreturn_IS_OK(result)) { | if(OVreturn_IS_OK(result)) { | |||
view->scene_name = result.word; | view->scene_name = result.word; | |||
view->scene_flag = true; | view->scene_flag = true; | |||
} | } | |||
} | } | |||
} | } | |||
} | } | |||
skipping to change at line 527 | skipping to change at line 514 | |||
} | } | |||
if(ok && (ll>20)) { | if(ok && (ll>20)) { | |||
ok = PConvPyIntToInt(PyList_GetItem(list, 19), &view->state_flag); | ok = PConvPyIntToInt(PyList_GetItem(list, 19), &view->state_flag); | |||
if(ok && view->state_flag) { | if(ok && view->state_flag) { | |||
ok = PConvPyIntToInt(PyList_GetItem(list, 20), &view->state); | ok = PConvPyIntToInt(PyList_GetItem(list, 20), &view->state); | |||
} else { | } else { | |||
view->state = 0; | view->state = 0; | |||
} | } | |||
} | } | |||
return ok; | return ok; | |||
#endif | ||||
} | } | |||
int ViewElemVLAFromPyList(PyMOLGlobals * G, PyObject * list, CViewElem ** vla_pt r, | int ViewElemVLAFromPyList(PyMOLGlobals * G, PyObject * list, CViewElem ** vla_pt r, | |||
int nFrame) | int nFrame) | |||
{ | { | |||
#ifdef _PYMOL_NOPY | ||||
return 0; | ||||
#else | ||||
int ok = true; | int ok = true; | |||
CViewElem *vla = NULL; | CViewElem *vla = NULL; | |||
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) | |||
ok = (PyList_Size(list) == nFrame); | ok = (PyList_Size(list) == nFrame); | |||
if(ok) | if(ok) | |||
ok = ((vla = VLACalloc(CViewElem, nFrame)) != NULL); | ok = ((vla = VLACalloc(CViewElem, nFrame)) != NULL); | |||
if(ok) { | if(ok) { | |||
int a; | int a; | |||
skipping to change at line 563 | skipping to change at line 543 | |||
ok = ViewElemFromPyList(G, PyList_GetItem(list, a), vla + a); | ok = ViewElemFromPyList(G, PyList_GetItem(list, a), vla + a); | |||
else | else | |||
break; | break; | |||
} | } | |||
} | } | |||
if(!ok) { | if(!ok) { | |||
VLAFreeP(vla); | VLAFreeP(vla); | |||
} else | } else | |||
*vla_ptr = vla; | *vla_ptr = vla; | |||
return ok; | return ok; | |||
#endif | ||||
} | } | |||
PyObject *ViewElemVLAAsPyList(PyMOLGlobals * G, CViewElem * vla, int nFrame) | PyObject *ViewElemVLAAsPyList(PyMOLGlobals * G, CViewElem * vla, int nFrame) | |||
{ | { | |||
#ifdef _PYMOL_NOPY | #ifdef _PYMOL_NOPY | |||
return NULL; | return NULL; | |||
#else | #else | |||
PyObject *result = NULL; | PyObject *result = NULL; | |||
int a; | int a; | |||
End of changes. 17 change blocks. | ||||
28 lines changed or deleted | 7 lines changed or added |