"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "layer4/PopUp.cpp" between
pymol-v2.1.0.tar.bz2 and pymol-open-source-2.2.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.

PopUp.cpp  (pymol-v2.1.0.tar.bz2):PopUp.cpp  (pymol-open-source-2.2.0)
skipping to change at line 72 skipping to change at line 72
double ChildDelay; double ChildDelay;
double DirtyDelay; double DirtyDelay;
double PassiveDelay; double PassiveDelay;
int DirtyDelayFlag; int DirtyDelayFlag;
int NeverDragged; int NeverDragged;
int PlacementAffinity; int PlacementAffinity;
} CPopUp; } CPopUp;
int PopUpRelease(Block * block, int button, int x, int y, int mod); int PopUpRelease(Block * block, int button, int x, int y, int mod);
void PopUpDraw(Block * block ORTHOCGOARG); void PopUpDraw(Block * block ORTHOCGOARG);
int PopUpDrag(Block * block, int x, int y, int mod);
int PopUpConvertY(CPopUp * I, int value, int mode); int PopUpConvertY(CPopUp * I, int value, int mode);
/*======================================================================== /*========================================================================
* If Sub[a] is a list, return it, otherwise assume it's callable so * If Sub[a] is a list, return it, otherwise assume it's callable so
* call it, assign the result to Sub[a] and return the result. * call it, assign the result to Sub[a] and return the result.
* *
* @param Sub : array of lists or callables * @param Sub : array of lists or callables
* @param a : array index * @param a : array index
*/ */
static PyObject * SubGetItem(PyMOLGlobals * G, PyObject ** Sub, const int a) { static PyObject * SubGetItem(PyMOLGlobals * G, PyObject ** Sub, const int a) {
skipping to change at line 187 skipping to change at line 186
I->PlacementAffinity = 0; I->PlacementAffinity = 0;
mx = 1; mx = 1;
cmx = 1; cmx = 1;
for(a = 0; a < I->NLine; a++) { for(a = 0; a < I->NLine; a++) {
elem = PyList_GetItem(PyList_GetItem(list, a), 1); elem = PyList_GetItem(PyList_GetItem(list, a), 1);
l = PyString_Size(elem); l = PyString_Size(elem);
str = PyString_AsString(elem); str = PyString_AsString(elem);
cl = l; cl = l;
c = str; c = str;
while(*c) { while(*c) {
if(*c == '\\') { /* discount the markup */ if(TextStartsWithColorCode(c)) { /* discount the markup */
if((((c != str) && (c[-1]) != '\\')) || ((c == str) && (c[1]) && (c[1] ! c += 3;
= '\\')))
cl -= 4; cl -= 4;
} }
c++; c++;
} }
if(cl > cmx) if(cl > cmx)
cmx = cl; cmx = cl;
if(l > mx) if(l > mx)
mx = l; mx = l;
} }
I->Width = (cmx * cPopUpCharWidth) + 2 * cPopUpCharMargin; I->Width = (cmx * cPopUpCharWidth) + 2 * cPopUpCharMargin;
skipping to change at line 421 skipping to change at line 420
PopUpFree(block); PopUpFree(block);
} }
/*========================================================================*/ /*========================================================================*/
int PopUpRelease(Block * block, int button, int x, int y, int mod) int PopUpRelease(Block * block, int button, int x, int y, int mod)
{ {
PyMOLGlobals *G = block->G; PyMOLGlobals *G = block->G;
CPopUp *I = (CPopUp *) block->reference; CPopUp *I = (CPopUp *) block->reference;
int gone_passive = false; int gone_passive = false;
int scroll_dy = 10;
switch (button) {
case PYMOL_BUTTON_SCROLL_FORWARD:
scroll_dy *= -1;
case PYMOL_BUTTON_SCROLL_REVERSE:
BlockTranslate(block, 0, scroll_dy);
return 1;
}
if(I->NeverDragged) { if(I->NeverDragged) {
if(I->PassiveDelay > UtilGetSeconds(G)) { if(I->PassiveDelay > UtilGetSeconds(G)) {
gone_passive = true; gone_passive = true;
I->PassiveDelay = UtilGetSeconds(G); /* kill any further delay */ I->PassiveDelay = UtilGetSeconds(G); /* kill any further delay */
} }
} }
if(!gone_passive) { if(!gone_passive) {
if(!I->NeverDragged) if(!I->NeverDragged)
PopUpDrag(block, x, y, mod); PopUpDrag(block, x, y, mod);
skipping to change at line 833 skipping to change at line 841
glVertex2i(x + I->Width - 1, y - (cPopUpLineHeight + cPopUpCharMargin)); glVertex2i(x + I->Width - 1, y - (cPopUpLineHeight + cPopUpCharMargin));
glVertex2i(x, y - (cPopUpLineHeight + cPopUpCharMargin)); glVertex2i(x, y - (cPopUpLineHeight + cPopUpCharMargin));
glEnd(); glEnd();
} }
} }
x = I->Block->rect.left + cPopUpCharMargin; x = I->Block->rect.left + cPopUpCharMargin;
y = (I->Block->rect.top - cPopUpLineHeight) - cPopUpCharMargin + 2; y = (I->Block->rect.top - cPopUpLineHeight) - cPopUpCharMargin + 2;
for(a = 0; a < I->NLine; a++) { for(a = 0; a < I->NLine; a++) {
if(a == I->Selected) auto text_color = (a == I->Selected) ? I->Block->BackColor : I->Block->Tex
TextSetColor(G, I->Block->BackColor); tColor;
else TextSetColor(G, text_color);
TextSetColor(G, I->Block->TextColor);
if(I->Code[a]) { if(I->Code[a]) {
c = I->Text[a]; c = I->Text[a];
xx = x; xx = x;
while(*c) { while(*c) {
if(*c == '\\') // note: previously also supported "\\+++red", but was never used
if(*(c + 1)) if(TextSetColorFromCode(G, c, text_color)) {
if(*(c + 2)) c += 4;
if(*(c + 3)) { }
if(*(c + 1) == '-') {
if(a == I->Selected)
TextSetColor(G, I->Block->BackColor);
else
TextSetColor(G, I->Block->TextColor);
c += 4;
} else if(*(c + 1) == '+') {
c += 4;
TextSetColor(G, ColorGetNamed(G, c));
} else {
TextSetColor3f(G, (*(c + 1) - '0') / 9.0F, (*(c + 2) - '0')
/ 9.0F,
(*(c + 3) - '0') / 9.0F);
c += 4;
}
}
TextSetPos2i(G, xx, y + cPopUpCharLift); TextSetPos2i(G, xx, y + cPopUpCharLift);
TextDrawChar(G, *(c++) ORTHOCGOARGVAR); TextDrawChar(G, *(c++) ORTHOCGOARGVAR);
xx = xx + DIP2PIXEL(8); xx = xx + DIP2PIXEL(8);
} }
if(I->Sub[a]) { if(I->Sub[a]) {
if (orthoCGO){ if (orthoCGO){
CGOBegin(orthoCGO, GL_TRIANGLE_STRIP); CGOBegin(orthoCGO, GL_TRIANGLE_STRIP);
 End of changes. 5 change blocks. 
28 lines changed or deleted 18 lines changed or added

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