Wizard.cpp (pymol-v2.1.0.tar.bz2) | : | Wizard.cpp (pymol-open-source-2.2.0) | ||
---|---|---|---|---|
skipping to change at line 134 | skipping to change at line 134 | |||
ov_diff a; | ov_diff a; | |||
CWizard *I = G->Wizard; | CWizard *I = G->Wizard; | |||
blocked = PAutoBlock(G); | blocked = PAutoBlock(G); | |||
for(a = I->Stack; a >= 0; a--) | for(a = I->Stack; a >= 0; a--) | |||
Py_XDECREF(I->Wiz[a]); | Py_XDECREF(I->Wiz[a]); | |||
I->Stack = -1; | I->Stack = -1; | |||
PAutoUnblock(G, blocked); | PAutoUnblock(G, blocked); | |||
#endif | #endif | |||
} | } | |||
int WizardDoSelect(PyMOLGlobals * G, char *name) | int WizardDoSelect(PyMOLGlobals * G, char *name, int state) | |||
{ | { | |||
/** | /** | |||
* Run when user selects something with the mouse, in a wizard | * Run when user selects something with the mouse, in a wizard | |||
*/ | */ | |||
#ifdef _PYMOL_NOPY | #ifdef _PYMOL_NOPY | |||
return 0; | return 0; | |||
#else | #else | |||
/* grab 'this' */ | /* grab 'this' */ | |||
OrthoLineType buf; | OrthoLineType buf; | |||
CWizard *I = G->Wizard; | CWizard *I = G->Wizard; | |||
skipping to change at line 156 | skipping to change at line 156 | |||
/* if the event is a selection and we're listening for selections */ | /* if the event is a selection and we're listening for selections */ | |||
if(I->EventMask & cWizEventSelect) | if(I->EventMask & cWizEventSelect) | |||
if(I->Stack >= 0) | if(I->Stack >= 0) | |||
if(I->Wiz[I->Stack]) { | if(I->Wiz[I->Stack]) { | |||
/* log if necessary */ | /* log if necessary */ | |||
sprintf(buf, "cmd.get_wizard().do_select('''%s''')", name); | sprintf(buf, "cmd.get_wizard().do_select('''%s''')", name); | |||
PLog(G, buf, cPLog_pym); | PLog(G, buf, cPLog_pym); | |||
/* block and call (in Python) the wizard's do_select */ | /* block and call (in Python) the wizard's do_select */ | |||
PBlock(G); | PBlock(G); | |||
if(PyObject_HasAttrString(I->Wiz[I->Stack], "do_pick_state")) { | ||||
result = PTruthCallStr1i(I->Wiz[I->Stack], "do_pick_state", state + 1) | ||||
; | ||||
if(PyErr_Occurred()) | ||||
PyErr_Print(); | ||||
} | ||||
if(PyObject_HasAttrString(I->Wiz[I->Stack], "do_select")) { | if(PyObject_HasAttrString(I->Wiz[I->Stack], "do_select")) { | |||
result = PTruthCallStr(I->Wiz[I->Stack], "do_select", name); | result = PTruthCallStr(I->Wiz[I->Stack], "do_select", name); | |||
if(PyErr_Occurred()) | if(PyErr_Occurred()) | |||
PyErr_Print(); | PyErr_Print(); | |||
} | } | |||
PUnblock(G); | PUnblock(G); | |||
} | } | |||
return result; | return result; | |||
#endif | #endif | |||
} | } | |||
skipping to change at line 319 | skipping to change at line 324 | |||
/*========================================================================*/ | /*========================================================================*/ | |||
Block *WizardGetBlock(PyMOLGlobals * G) | Block *WizardGetBlock(PyMOLGlobals * G) | |||
{ | { | |||
CWizard *I = G->Wizard; | CWizard *I = G->Wizard; | |||
{ | { | |||
return (I->Block); | return (I->Block); | |||
} | } | |||
} | } | |||
/*========================================================================*/ | /*========================================================================*/ | |||
int WizardDoPick(PyMOLGlobals * G, int bondFlag) | int WizardDoPick(PyMOLGlobals * G, int bondFlag, int state) | |||
{ | { | |||
/** | /** | |||
* Run when user picks something | * Run when user picks something | |||
*/ | */ | |||
#ifdef _PYMOL_NOPY | #ifdef _PYMOL_NOPY | |||
return 0; | return 0; | |||
#else | #else | |||
CWizard *I = G->Wizard; | CWizard *I = G->Wizard; | |||
int result = false; | int result = false; | |||
skipping to change at line 342 | skipping to change at line 347 | |||
if(I->Stack >= 0) | if(I->Stack >= 0) | |||
if(I->Wiz[I->Stack]) { | if(I->Wiz[I->Stack]) { | |||
if(bondFlag) | if(bondFlag) | |||
PLog(G, "cmd.get_wizard().do_pick(1)", cPLog_pym); | PLog(G, "cmd.get_wizard().do_pick(1)", cPLog_pym); | |||
else | else | |||
PLog(G, "cmd.get_wizard().do_pick(0)", cPLog_pym); | PLog(G, "cmd.get_wizard().do_pick(0)", cPLog_pym); | |||
PBlock(G); | PBlock(G); | |||
if(I->Stack >= 0) | if(I->Stack >= 0) | |||
if(I->Wiz[I->Stack]) { | if(I->Wiz[I->Stack]) { | |||
if(PyObject_HasAttrString(I->Wiz[I->Stack], "do_pick_state")) { | ||||
result = PTruthCallStr1i(I->Wiz[I->Stack], "do_pick_state", state | ||||
+ 1); | ||||
if(PyErr_Occurred()) | ||||
PyErr_Print(); | ||||
} | ||||
if(PyObject_HasAttrString(I->Wiz[I->Stack], "do_pick")) { | if(PyObject_HasAttrString(I->Wiz[I->Stack], "do_pick")) { | |||
result = PTruthCallStr1i(I->Wiz[I->Stack], "do_pick", bondFlag); | result = PTruthCallStr1i(I->Wiz[I->Stack], "do_pick", bondFlag); | |||
if(PyErr_Occurred()) | if(PyErr_Occurred()) | |||
PyErr_Print(); | PyErr_Print(); | |||
} | } | |||
} | } | |||
PUnblock(G); | PUnblock(G); | |||
} | } | |||
return result; | return result; | |||
#endif | #endif | |||
skipping to change at line 802 | skipping to change at line 812 | |||
glEnd(); | glEnd(); | |||
} | } | |||
} | } | |||
} | } | |||
static void draw_text(PyMOLGlobals * G, char *c, int xx, int yy, float *color OR THOCGOARG) | static void draw_text(PyMOLGlobals * G, char *c, int xx, int yy, float *color OR THOCGOARG) | |||
{ | { | |||
TextSetColor(G, color); | TextSetColor(G, color); | |||
while(*c) { | while(*c) { | |||
if(*c == '\\') | if(TextSetColorFromCode(G, c, color)) { | |||
if(*(c + 1)) | c += 4; | |||
if(*(c + 2)) | } | |||
if(*(c + 3)) { | ||||
if(*(c + 1) == '-') { | ||||
TextSetColor(G, color); | ||||
c += 4; | ||||
} else { | ||||
TextSetColor3f(G, (*(c + 1) - '0') / 9.0F, (*(c + 2) - '0') / 9.0F | ||||
, | ||||
(*(c + 3) - '0') / 9.0F); | ||||
c += 4; | ||||
} | ||||
} | ||||
TextSetPos2i(G, xx, yy); | TextSetPos2i(G, xx, yy); | |||
TextDrawChar(G, *(c++) ORTHOCGOARGVAR); | TextDrawChar(G, *(c++) ORTHOCGOARGVAR); | |||
xx = xx + DIP2PIXEL(8); | xx = xx + DIP2PIXEL(8); | |||
} | } | |||
} | } | |||
/*========================================================================*/ | /*========================================================================*/ | |||
static void WizardDraw(Block * block ORTHOCGOARG) | static void WizardDraw(Block * block ORTHOCGOARG) | |||
{ | { | |||
PyMOLGlobals *G = block->G; | PyMOLGlobals *G = block->G; | |||
End of changes. 5 change blocks. | ||||
16 lines changed or deleted | 17 lines changed or added |