Pop.cpp (pymol-open-source-2.2.0) | : | Pop.cpp (pymol-open-source-2.3.0) | ||
---|---|---|---|---|
skipping to change at line 26 | skipping to change at line 26 | |||
*/ | */ | |||
#include"os_std.h" | #include"os_std.h" | |||
#include"os_predef.h" | #include"os_predef.h" | |||
#include"Base.h" | #include"Base.h" | |||
#include"Ortho.h" | #include"Ortho.h" | |||
#include"Pop.h" | #include"Pop.h" | |||
#include"MemoryDebug.h" | #include"MemoryDebug.h" | |||
#define cPopMargin 3 | #define cPopMargin 3 | |||
struct _CPop { | struct CPop : public Block { | |||
::Block *Block; | CPop(PyMOLGlobals * G) : Block(G){} | |||
}; | ||||
void PopReshape(Block * I, int width, int height); | void reshape(int width, int height) override; | |||
}; | ||||
/*========================================================================*/ | /*========================================================================*/ | |||
void PopReshape(Block * I, int width, int height) | void CPop::reshape(int width, int height) | |||
{ | { | |||
I->rect.top = height; | rect.top = height; | |||
I->rect.right = width; | rect.right = width; | |||
} | } | |||
/*========================================================================*/ | /*========================================================================*/ | |||
Block *PopGetBlock(PyMOLGlobals * G) | Block *PopGetBlock(PyMOLGlobals * G) | |||
{ | { | |||
CPop *I = G->Pop; | CPop *I = G->Pop; | |||
{ | { | |||
return (I->Block); | return (I); | |||
} | } | |||
} | } | |||
/*========================================================================*/ | /*========================================================================*/ | |||
void PopFree(PyMOLGlobals * G) | void PopFree(PyMOLGlobals * G) | |||
{ | { | |||
CPop *I = G->Pop; | CPop *I = G->Pop; | |||
OrthoFreeBlock(G, I->Block); | DeleteP(G->Pop); | |||
FreeP(G->Pop); | ||||
} | } | |||
/*========================================================================*/ | /*========================================================================*/ | |||
int PopInit(PyMOLGlobals * G) | int PopInit(PyMOLGlobals * G) | |||
{ | { | |||
CPop *I = NULL; | CPop *I = NULL; | |||
if((I = (G->Pop = Calloc(CPop, 1)))) { | if((I = (G->Pop = new CPop(G)))) { | |||
I->active = false; | ||||
I->Block = OrthoNewBlock(G, NULL); | I->rect.top = 10; | |||
I->Block->fReshape = PopReshape; | I->rect.bottom = 14; | |||
I->Block->active = false; | I->rect.left = 0; | |||
I->rect.right = 10; | ||||
I->Block->rect.top = 10; | ||||
I->Block->rect.bottom = 14; | ||||
I->Block->rect.left = 0; | ||||
I->Block->rect.right = 10; | ||||
OrthoAttach(G, I->Block, cOrthoHidden); | OrthoAttach(G, I, cOrthoHidden); | |||
return 1; | return 1; | |||
} else | } else | |||
return 0; | return 0; | |||
} | } | |||
/*========================================================================*/ | /*========================================================================*/ | |||
void PopFitBlock(Block * block) | void PopFitBlock(Block * block) | |||
{ | { | |||
CPop *I = block->G->Pop; | CPop *I = block->m_G->Pop; // TODO: Three indirections for a 'this' lol | |||
int delta; | int delta; | |||
if((block->rect.bottom - cPopMargin) < (I->Block->rect.bottom)) { | if((block->rect.bottom - cPopMargin) < (I->rect.bottom)) { | |||
delta = (I->Block->rect.bottom - block->rect.bottom) + cPopMargin; | delta = (I->rect.bottom - block->rect.bottom) + cPopMargin; | |||
block->rect.top += delta; | block->rect.top += delta; | |||
block->rect.bottom += delta; | block->rect.bottom += delta; | |||
} | } | |||
if((block->rect.right + cPopMargin) > (I->Block->rect.right)) { | if((block->rect.right + cPopMargin) > (I->rect.right)) { | |||
delta = (block->rect.right - (I->Block->rect.right)) + cPopMargin; | delta = (block->rect.right - (I->rect.right)) + cPopMargin; | |||
block->rect.left -= delta; | block->rect.left -= delta; | |||
block->rect.right -= delta; | block->rect.right -= delta; | |||
} | } | |||
if((block->rect.left - cPopMargin) < (I->Block->rect.left)) { | if((block->rect.left - cPopMargin) < (I->rect.left)) { | |||
delta = (I->Block->rect.left - block->rect.left) + cPopMargin; | delta = (I->rect.left - block->rect.left) + cPopMargin; | |||
block->rect.right += delta; | block->rect.right += delta; | |||
block->rect.left += delta; | block->rect.left += delta; | |||
} | } | |||
if((block->rect.top + cPopMargin) > (I->Block->rect.top)) { | if((block->rect.top + cPopMargin) > (I->rect.top)) { | |||
delta = (block->rect.top - (I->Block->rect.top)) + cPopMargin; | delta = (block->rect.top - (I->rect.top)) + cPopMargin; | |||
block->rect.top -= delta; | block->rect.top -= delta; | |||
block->rect.bottom -= delta; | block->rect.bottom -= delta; | |||
} | } | |||
} | } | |||
/*========================================================================*/ | /*========================================================================*/ | |||
int PopPlaceChild(Block * block, int left_x, int right_x, int row_y, int affinit y) | int PopPlaceChild(Block * block, int left_x, int right_x, int row_y, int affinit y) | |||
{ | { | |||
int width = block->rect.right - block->rect.left; | int width = block->rect.right - block->rect.left; | |||
End of changes. 14 change blocks. | ||||
29 lines changed or deleted | 26 lines changed or added |