"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "layer0/Block.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.

Block.cpp  (pymol-open-source-2.2.0):Block.cpp  (pymol-open-source-2.3.0)
skipping to change at line 25 skipping to change at line 25
Z* ------------------------------------------------------------------- Z* -------------------------------------------------------------------
*/ */
#include"os_python.h" #include"os_python.h"
#include"os_predef.h" #include"os_predef.h"
#include"os_gl.h" #include"os_gl.h"
#include"Block.h" #include"Block.h"
#include"main.h" #include"main.h"
#include"CGO.h" #include"CGO.h"
void BlockGetSize(Block * I, int *width, int *height) int Block::getWidth() const {
{ return rect.right - rect.left;
*width = I->rect.right - I->rect.left;
*height = I->rect.top - I->rect.bottom;
} }
/*========================================================================*/ /*========================================================================*/
void BlockInit(PyMOLGlobals * G, Block * I) int Block::getHeight() const {
{ return rect.top - rect.bottom;
I->G = G;
I->BackColor[0] = 0.2F;
I->BackColor[1] = 0.2F;
I->BackColor[2] = 0.2F;
I->TextColor[0] = 1.0F;
I->TextColor[1] = 1.0F;
I->TextColor[2] = 1.0F;
} }
/*========================================================================*/ /*========================================================================*/
void BlockFill(Block * I ORTHOCGOARG) void Block::fill(CGO *orthoCGO)
{ {
PyMOLGlobals *G = I->G; if(m_G->HaveGUI && m_G->ValidContext) {
if(G->HaveGUI && G->ValidContext) {
if (orthoCGO){ if (orthoCGO){
CGOBegin(orthoCGO, GL_TRIANGLE_STRIP); CGOBegin(orthoCGO, GL_TRIANGLE_STRIP);
CGOVertex(orthoCGO, I->rect.right, I->rect.top, 0.f); CGOVertex(orthoCGO, rect.right, rect.top, 0.f);
CGOVertex(orthoCGO, I->rect.right, I->rect.bottom, 0.f); CGOVertex(orthoCGO, rect.right, rect.bottom, 0.f);
CGOVertex(orthoCGO, I->rect.left, I->rect.top, 0.f); CGOVertex(orthoCGO, rect.left, rect.top, 0.f);
CGOVertex(orthoCGO, I->rect.left, I->rect.bottom, 0.f); CGOVertex(orthoCGO, rect.left, rect.bottom, 0.f);
CGOEnd(orthoCGO); CGOEnd(orthoCGO);
} else { } else {
glBegin(GL_POLYGON); glBegin(GL_POLYGON);
glVertex2i(I->rect.right, I->rect.top); glVertex2i(rect.right, rect.top);
glVertex2i(I->rect.right, I->rect.bottom); glVertex2i(rect.right, rect.bottom);
glVertex2i(I->rect.left, I->rect.bottom); glVertex2i(rect.left, rect.bottom);
glVertex2i(I->rect.left, I->rect.top); glVertex2i(rect.left, rect.top);
glEnd(); glEnd();
} }
} }
} }
/*========================================================================*/ /*========================================================================*/
void BlockDrawLeftEdge(Block * I ORTHOCGOARG) void Block::drawLeftEdge(CGO *orthoCGO)
{ {
PyMOLGlobals *G = I->G; if(m_G->HaveGUI && m_G->ValidContext) {
if(G->HaveGUI && G->ValidContext) {
if (orthoCGO){ if (orthoCGO){
CGOColor(orthoCGO, .3f, .3f, .3f); CGOColor(orthoCGO, .3f, .3f, .3f);
CGOBegin(orthoCGO, GL_TRIANGLE_STRIP); CGOBegin(orthoCGO, GL_TRIANGLE_STRIP);
CGOVertex(orthoCGO, I->rect.left, I->rect.bottom, 0.f); CGOVertex(orthoCGO, rect.left, rect.bottom, 0.f);
CGOVertex(orthoCGO, I->rect.left + 1.f, I->rect.bottom, 0.f); CGOVertex(orthoCGO, rect.left + 1.f, rect.bottom, 0.f);
CGOVertex(orthoCGO, I->rect.left, I->rect.top, 0.f); CGOVertex(orthoCGO, rect.left, rect.top, 0.f);
CGOVertex(orthoCGO, I->rect.left + 1.f, I->rect.top, 0.f); CGOVertex(orthoCGO, rect.left + 1.f, rect.top, 0.f);
CGOEnd(orthoCGO); CGOEnd(orthoCGO);
} else { } else {
if(G->HaveGUI && G->ValidContext) { if(m_G->HaveGUI && m_G->ValidContext) {
glColor3f(0.3, 0.3, 0.3); glColor3f(0.3, 0.3, 0.3);
glBegin(GL_LINES); glBegin(GL_LINES);
glVertex2i(I->rect.left, I->rect.bottom); glVertex2i(rect.left, rect.bottom);
glVertex2i(I->rect.left, I->rect.top); glVertex2i(rect.left, rect.top);
glEnd(); glEnd();
} }
} }
} }
} }
/*========================================================================*/ /*========================================================================*/
void BlockDrawTopEdge(Block * I) void Block::drawTopEdge()
{ {
#ifndef PURE_OPENGL_ES_2 #ifndef PURE_OPENGL_ES_2
PyMOLGlobals *G = I->G; if(m_G->HaveGUI && m_G->ValidContext) {
if(G->HaveGUI && G->ValidContext) {
glColor3f(0.3, 0.3, 0.3); glColor3f(0.3, 0.3, 0.3);
glBegin(GL_LINES); glBegin(GL_LINES);
glVertex2i(I->rect.right, I->rect.top); glVertex2i(rect.right, rect.top);
glVertex2i(I->rect.left, I->rect.top); glVertex2i(rect.left, rect.top);
glEnd(); glEnd();
} }
#endif #endif
} }
/*========================================================================*/ /*========================================================================*/
void BlockSetMargin(Block * block, int t, int l, int b, int r) void Block::setMargin(int t, int l, int b, int r)
{ {
block->margin.top = t; margin.top = t;
block->margin.left = l; margin.left = l;
block->margin.bottom = b; margin.bottom = b;
block->margin.right = r; margin.right = r;
} }
/*========================================================================*/ /*========================================================================*/
void BlockReshape(Block * I, int width, int height) void Block::reshape(int width, int height)
{ {
I->rect.top = (height - I->margin.top); rect.top = (height - margin.top);
I->rect.left = I->margin.left; rect.left = margin.left;
I->rect.bottom = I->margin.bottom; rect.bottom = margin.bottom;
I->rect.right = (width - I->margin.right); rect.right = (width - margin.right);
} }
/*========================================================================*/ /*========================================================================*/
void BlockTranslate(Block * I, int dx, int dy) void Block::translate(int dx, int dy)
{ {
I->rect.top += dy; rect.top += dy;
I->rect.left += dx; rect.left += dx;
I->rect.bottom += dy; rect.bottom += dy;
I->rect.right += dx; rect.right += dx;
} }
/*========================================================================*/ /*========================================================================*/
void BlockRecursiveDraw(Block * block ORTHOCGOARG) void Block::recursiveDraw(CGO *orthoCGO)
{ {
if(block) { if (this->next)
if(block->next) next->recursiveDraw(orthoCGO);
BlockRecursiveDraw(block->next ORTHOCGOARGVAR); if (active) {
if(block->active) { draw(orthoCGO);
if(block->fDraw) if (inside)
block->fDraw(block ORTHOCGOARGVAR); inside->recursiveDraw(orthoCGO);
if(block->inside)
BlockRecursiveDraw(block->inside ORTHOCGOARGVAR);
}
} }
} }
/*========================================================================*/ /*========================================================================*/
short BlockRecursiveFastDraw(Block * block ORTHOCGOARG) bool Block::recursiveFastDraw(CGO *orthoCGO)
{ {
short ret = false; bool ret = false;
if(block) { if (next)
if(block->next) ret |= next->recursiveFastDraw(orthoCGO);
ret |= BlockRecursiveFastDraw(block->next ORTHOCGOARGVAR); if (active) {
if(block->active) { ret |= this->fastDraw(orthoCGO);
if(block->fFastDraw) if (inside)
ret |= block->fFastDraw(block ORTHOCGOARGVAR); ret |= inside->recursiveFastDraw(orthoCGO);
if(block->inside)
ret |= BlockRecursiveFastDraw(block->inside ORTHOCGOARGVAR);
}
} }
return ret; return ret;
} }
/*========================================================================*/ /*========================================================================*/
Block *BlockRecursiveFind(Block * block, int x, int y) Block *Block::recursiveFind(int x, int y)
{ {
Block *check; Block *check;
Block *block = this;
if(block) { if(block) {
if(!block->active) if(!block->active)
block = BlockRecursiveFind(block->next, x, y); block = block->next->recursiveFind(x, y);
else if(!((block->rect.top >= y) && else if(!rectXYInside(x, y))
(block->rect.bottom <= y) && block = block->next->recursiveFind(x, y);
(block->rect.left <= x) && (block->rect.right >= x)))
block = BlockRecursiveFind(block->next, x, y);
else if(block->inside) else if(block->inside)
if((check = BlockRecursiveFind(block->inside, x, y))) if((check = block->inside->recursiveFind(x, y)))
block = check; block = check;
} }
return (block); return (block);
} }
int BlockRectXYInside(BlockRect *rect, int x, int y) bool Block::rectXYInside(int x, int y) const
{ {
return ((y <= rect->top) && (y >= rect->bottom) && return ((y <= rect.top) && (y >= rect.bottom) &&
(x <= rect->right) && (x >= rect->left)); (x <= rect.right) && (x >= rect.left));
} }
 End of changes. 30 change blocks. 
85 lines changed or deleted 66 lines changed or added

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