Control.cpp (pymol-v1.8.6.0.tar.bz2) | : | Control.cpp (pymol-v2.1.0.tar.bz2) | ||
---|---|---|---|---|
skipping to change at line 36 | skipping to change at line 36 | |||
#include "Executive.h" | #include "Executive.h" | |||
#include "Setting.h" | #include "Setting.h" | |||
#include "P.h" | #include "P.h" | |||
#include "Seq.h" | #include "Seq.h" | |||
#include"Movie.h" | #include"Movie.h" | |||
#include "Text.h" | #include "Text.h" | |||
#include "Util.h" | #include "Util.h" | |||
#include "Ortho.h" | #include "Ortho.h" | |||
#include "CGO.h" | #include "CGO.h" | |||
#define cControlBoxSize 17 | #define cControlBoxSize DIP2PIXEL(17) | |||
#define cControlLeftMargin 8 | #define cControlLeftMargin DIP2PIXEL(8) | |||
#define cControlTopMargin 2 | #define cControlTopMargin DIP2PIXEL(2) | |||
#define cControlSpacing 2 | #define cControlSpacing DIP2PIXEL(2) | |||
#define cControlInnerMargin 4 | #define cControlInnerMargin DIP2PIXEL(4) | |||
#define cControlSpread 6 | #define cControlSpread DIP2PIXEL(6) | |||
#define cControlSize 160 | #define cControlSize DIP2PIXEL(160) | |||
#define cControlButtons 7 | #define cControlButtons 7 | |||
#define cControlMinWidth 5 | #define cControlMinWidth 5 | |||
#define SDOF_QUEUE_MASK 0x1F | #define SDOF_QUEUE_MASK 0x1F | |||
struct _CControl { | struct _CControl { | |||
::Block *Block; | ::Block *Block; | |||
int DragFlag; | int DragFlag; | |||
skipping to change at line 107 | skipping to change at line 107 | |||
return 1; | return 1; | |||
} | } | |||
int ControlSdofUpdate(PyMOLGlobals * G, float tx, float ty, float tz, float rx, float ry, | int ControlSdofUpdate(PyMOLGlobals * G, float tx, float ty, float tz, float rx, float ry, | |||
float rz) | float rz) | |||
{ | { | |||
/* may be called asynchronously anytime after CControl has been initialized */ | /* may be called asynchronously anytime after CControl has been initialized */ | |||
CControl *I = G->Control; | CControl *I = G->Control; | |||
if(I) { | if(I) { | |||
if(((I->sdofWroteTo - I->sdofReadFrom) & SDOF_QUEUE_MASK) < SDOF_QUEUE_MASK) | float tol = 0.0001; | |||
{ | bool active = | |||
/* a free slot exists */ | fabs(tx) >= tol || fabs(ty) >= tol || fabs(tz) >= tol || | |||
fabs(rx) >= tol || fabs(ry) >= tol || fabs(rz) >= tol; | ||||
if(active) { | ||||
int slot = (I->sdofWroteTo + 1) & SDOF_QUEUE_MASK; | int slot = (I->sdofWroteTo + 1) & SDOF_QUEUE_MASK; | |||
float *buffer = I->sdofBuffer + (6 * slot); | float *buffer = I->sdofBuffer + (6 * slot); | |||
buffer[0] = tx; | buffer[0] = tx; | |||
buffer[1] = ty; | buffer[1] = ty; | |||
buffer[2] = tz; | buffer[2] = tz; | |||
buffer[3] = rx; | buffer[3] = rx; | |||
buffer[4] = ry; | buffer[4] = ry; | |||
buffer[5] = rz; | buffer[5] = rz; | |||
I->sdofWroteTo = slot; | I->sdofWroteTo = slot; | |||
{ | { | |||
float tol = 0.0001; | if(!I->sdofActive) { | |||
int active = (fabs(buffer[0]) >= tol) || (fabs(buffer[1]) >= tol) | ||||
|| (fabs(buffer[2]) >= tol) | ||||
|| (fabs(buffer[3]) >= tol) || (fabs(buffer[4]) >= tol) | ||||
|| (fabs(buffer[5]) >= tol); | ||||
if(active && !I->sdofActive) { | ||||
I->sdofLastIterTime = UtilGetSeconds(G); | I->sdofLastIterTime = UtilGetSeconds(G); | |||
} | } | |||
I->sdofActive = active; | ||||
} | } | |||
/*printf("wrote %8.3f %8.3f %8.3f %8.3f %8.3f %8.3f %d %d %d\n",tx,ty,tz,r x,ry,rz,I->sdofReadFrom,I->sdofWroteTo,slot); */ | /*printf("wrote %8.3f %8.3f %8.3f %8.3f %8.3f %8.3f %d %d %d\n",tx,ty,tz,r x,ry,rz,I->sdofReadFrom,I->sdofWroteTo,slot); */ | |||
} | } | |||
I->sdofActive = active; | ||||
} | } | |||
return 1; | return 1; | |||
} | } | |||
int ControlSdofIterate(PyMOLGlobals * G) | int ControlSdofIterate(PyMOLGlobals * G) | |||
{ | { | |||
CControl *I = G->Control; | CControl *I = G->Control; | |||
if(I->sdofWroteTo != I->sdofReadFrom) { | if(I->sdofWroteTo != I->sdofReadFrom && I->sdofActive) { | |||
int slot = I->sdofWroteTo; | int slot = I->sdofWroteTo; | |||
/* new data available */ | /* new data available */ | |||
float *buffer = I->sdofBuffer + (6 * slot); | float *buffer = I->sdofBuffer + (6 * slot); | |||
I->sdofTrans[0] = buffer[0]; | I->sdofTrans[0] = buffer[0]; | |||
I->sdofTrans[1] = buffer[1]; | I->sdofTrans[1] = buffer[1]; | |||
I->sdofTrans[2] = buffer[2]; | I->sdofTrans[2] = buffer[2]; | |||
I->sdofRot[0] = buffer[3]; | I->sdofRot[0] = buffer[3]; | |||
I->sdofRot[1] = buffer[4]; | I->sdofRot[1] = buffer[4]; | |||
I->sdofRot[2] = buffer[5]; | I->sdofRot[2] = buffer[5]; | |||
I->sdofReadFrom = slot; | I->sdofReadFrom = slot; | |||
} | ||||
if(I->sdofActive) { | ||||
double now = UtilGetSeconds(G); | double now = UtilGetSeconds(G); | |||
double delta = now - I->sdofLastIterTime; | double delta = now - I->sdofLastIterTime; | |||
I->sdofLastIterTime = now; | I->sdofLastIterTime = now; | |||
{ | { | |||
/* suppress small amounts of combined motion using a truncated switching f unction */ | /* suppress small amounts of combined motion using a truncated switching f unction */ | |||
float len_rot = length3f(I->sdofRot); | float len_rot = length3f(I->sdofRot); | |||
float len_trans = length3f(I->sdofTrans); | float len_trans = length3f(I->sdofTrans); | |||
float *dom, *sub; | float *dom, *sub; | |||
skipping to change at line 258 | skipping to change at line 256 | |||
} | } | |||
static int ControlDrag(Block * block, int x, int y, int mod) | static int ControlDrag(Block * block, int x, int y, int mod) | |||
{ | { | |||
int delta; | int delta; | |||
int gui_width; | int gui_width; | |||
PyMOLGlobals *G = block->G; | PyMOLGlobals *G = block->G; | |||
CControl *I = G->Control; | CControl *I = G->Control; | |||
if(!I->SkipRelease) { | if(!I->SkipRelease) { | |||
delta = x - I->LastPos; | delta = x - I->LastPos; | |||
delta /= DIP2PIXEL(1); | ||||
if(I->DragFlag) { | if(I->DragFlag) { | |||
if(delta) { | if(delta) { | |||
gui_width = SettingGetGlobal_i(G, cSetting_internal_gui_width) - delta; | gui_width = SettingGetGlobal_i(G, cSetting_internal_gui_width) - delta; | |||
if(gui_width < cControlMinWidth) | if(gui_width < cControlMinWidth) | |||
gui_width = cControlMinWidth; | gui_width = cControlMinWidth; | |||
delta = SettingGetGlobal_i(G, cSetting_internal_gui_width) - gui_width; | delta = SettingGetGlobal_i(G, cSetting_internal_gui_width) - gui_width; | |||
I->LastPos = x; | I->LastPos = x; | |||
I->SaveWidth = 0; | I->SaveWidth = 0; | |||
SettingSetGlobal_i(G, cSetting_internal_gui_width, gui_width); | SettingSetGlobal_i(G, cSetting_internal_gui_width, gui_width); | |||
OrthoReshape(G, -1, -1, false); | OrthoReshape(G, -1, -1, false); | |||
skipping to change at line 565 | skipping to change at line 564 | |||
if (orthoCGO) | if (orthoCGO) | |||
CGOColorv(orthoCGO, I->Block->TextColor); | CGOColorv(orthoCGO, I->Block->TextColor); | |||
else | else | |||
glColor3fv(I->Block->TextColor); | glColor3fv(I->Block->TextColor); | |||
{ | { | |||
int top, left, bottom, right; | int top, left, bottom, right; | |||
left = I->Block->rect.left + 1; | left = I->Block->rect.left + 1; | |||
bottom = I->Block->rect.bottom + 1; | bottom = I->Block->rect.bottom + 1; | |||
top = I->Block->rect.top - (cControlTopMargin - 1); | top = I->Block->rect.top - (cControlTopMargin - 1); | |||
right = left + 5; | right = left + DIP2PIXEL(5); | |||
/* This draws the separator on the left side of the movie control buttons */ | /* This draws the separator on the left side of the movie control buttons */ | |||
if (orthoCGO){ | if (orthoCGO){ | |||
CGOColor(orthoCGO, 0.8F, 0.8F, 0.8F); | CGOColor(orthoCGO, 0.8F, 0.8F, 0.8F); | |||
CGOBegin(orthoCGO, GL_TRIANGLE_STRIP); | CGOBegin(orthoCGO, GL_TRIANGLE_STRIP); | |||
CGOVertex(orthoCGO, right, top, 0.f); | CGOVertex(orthoCGO, right, top, 0.f); | |||
CGOVertex(orthoCGO, right, bottom, 0.f); | CGOVertex(orthoCGO, right, bottom, 0.f); | |||
CGOVertex(orthoCGO, left, top, 0.f); | CGOVertex(orthoCGO, left, top, 0.f); | |||
CGOVertex(orthoCGO, left, bottom, 0.f); | CGOVertex(orthoCGO, left, bottom, 0.f); | |||
CGOEnd(orthoCGO); | CGOEnd(orthoCGO); | |||
End of changes. 10 change blocks. | ||||
21 lines changed or deleted | 19 lines changed or added |