Control.cpp (pymol-open-source-2.2.0) | : | Control.cpp (pymol-open-source-2.3.0) | ||
---|---|---|---|---|
skipping to change at line 50 | skipping to change at line 50 | |||
#define cControlInnerMargin DIP2PIXEL(4) | #define cControlInnerMargin DIP2PIXEL(4) | |||
#define cControlSpread DIP2PIXEL(6) | #define cControlSpread DIP2PIXEL(6) | |||
#define cControlSize DIP2PIXEL(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 : public Block { | |||
::Block *Block; | bool DragFlag {}; | |||
int DragFlag; | int LastPos {}; | |||
int LastPos; | int ExtraSpace {}; | |||
int ExtraSpace; | float ButtonColor[3] { 0.5f, 0.5f, 0.5f }; | |||
float ButtonColor[3]; | float ActiveColor[3] { 0.65f, 0.65f, 0.65f }; | |||
float ActiveColor[3]; | int Pressed { -1 }; | |||
int Pressed, Active; | int Active { -1 }; | |||
int SaveWidth; | int SaveWidth { 0 }; | |||
double LastClickTime; | double LastClickTime {}; | |||
int SkipRelease; | int SkipRelease {}; | |||
int NButton; | int NButton { 9 }; | |||
/* not saved */ | /* not saved */ | |||
int sdofActive; | int sdofActive {}; | |||
double sdofLastIterTime; | double sdofLastIterTime {}; | |||
int sdofMode; | int sdofMode {}; | |||
float sdofTrans[3]; | float sdofTrans[3] {}; | |||
float sdofRot[3]; | float sdofRot[3] {}; | |||
unsigned int sdofWroteTo, sdofReadFrom; /* queue synchronization fields | unsigned int sdofWroteTo {}, sdofReadFrom {}; /* queue synchronization f | |||
*/ | ields */ | |||
float sdofBuffer[(SDOF_QUEUE_MASK + 1) * 6]; | float sdofBuffer[(SDOF_QUEUE_MASK + 1) * 6] {}; | |||
CControl(PyMOLGlobals * G) : Block(G) {}; | ||||
int click(int button, int x, int y, int mod) override; | ||||
void draw(CGO* ortho) override; | ||||
int drag(int x, int y, int mod) override; | ||||
int release(int button, int x, int y, int mod) override; | ||||
void reshape(int width, int height) override; | ||||
}; | }; | |||
int ControlSdofButton(PyMOLGlobals * G, int button) | int ControlSdofButton(PyMOLGlobals * G, int button) | |||
{ | { | |||
CControl *I = G->Control; | CControl *I = G->Control; | |||
if(I) { | if(I) { | |||
if(button == 1) { /* LEFT */ | if(button == 1) { /* LEFT */ | |||
if(I->sdofMode != SDOF_DRAG_MODE) { | if(I->sdofMode != SDOF_DRAG_MODE) { | |||
I->sdofMode = SDOF_DRAG_MODE; | I->sdofMode = SDOF_DRAG_MODE; | |||
OrthoAddOutput(G, " SDOF: Drag mode.\n"); | OrthoAddOutput(G, " SDOF: Drag mode.\n"); | |||
skipping to change at line 217 | skipping to change at line 225 | |||
} | } | |||
int ControlRocking(PyMOLGlobals * G) | int ControlRocking(PyMOLGlobals * G) | |||
{ | { | |||
if(G->Interrupt) { | if(G->Interrupt) { | |||
SettingSetGlobal_b(G, cSetting_rock, false); | SettingSetGlobal_b(G, cSetting_rock, false); | |||
} | } | |||
return SettingGetGlobal_b(G, cSetting_rock); | return SettingGetGlobal_b(G, cSetting_rock); | |||
} | } | |||
static void ControlReshape(Block * block, int width, int height) | void CControl::reshape(int width, int height) | |||
{ | { | |||
PyMOLGlobals *G = block->G; | PyMOLGlobals *G = m_G; | |||
CControl *I = G->Control; | CControl *I = G->Control; | |||
BlockReshape(block, width, height); | Block::reshape(width, height); | |||
/* this is a pragmatic workaround for mac X11 where the nub gets | /* this is a pragmatic workaround for mac X11 where the nub gets | |||
hidden by the window expansion tab */ | hidden by the window expansion tab */ | |||
if((block->rect.right - block->rect.left) < 20) { | if((rect.right - rect.left) < 20) { | |||
block->rect.top = block->rect.top + 10; | rect.top = rect.top + 10; | |||
} | } | |||
I->ExtraSpace = ((block->rect.right - block->rect.left) - cControlSize); | I->ExtraSpace = ((rect.right - rect.left) - cControlSize); | |||
if(I->ExtraSpace < 0) | if(I->ExtraSpace < 0) | |||
I->ExtraSpace = 0; | I->ExtraSpace = 0; | |||
} | } | |||
static int which_button(CControl * I, int x, int y) | static int which_button(CControl * I, int x, int y) | |||
{ | { | |||
int result = -1; | int result = -1; | |||
x -= I->Block->rect.left + cControlLeftMargin; | x -= I->rect.left + cControlLeftMargin; | |||
y -= I->Block->rect.top - cControlTopMargin; | y -= I->rect.top - cControlTopMargin; | |||
if(x >= 0) | if(x >= 0) | |||
if((y <= 0) && (y > (-cControlBoxSize))) { | if((y <= 0) && (y > (-cControlBoxSize))) { | |||
int control_width = | int control_width = | |||
I->Block->rect.right - (I->Block->rect.left + cControlLeftMargin); | I->rect.right - (I->rect.left + cControlLeftMargin); | |||
result = (I->NButton * x) / control_width; | result = (I->NButton * x) / control_width; | |||
} | } | |||
return result; | return result; | |||
} | } | |||
static int ControlDrag(Block * block, int x, int y, int mod) | int CControl::drag(int x, int y, int mod) | |||
{ | { | |||
int delta; | int delta; | |||
int gui_width; | int gui_width; | |||
PyMOLGlobals *G = block->G; | PyMOLGlobals *G = m_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); | 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; | |||
skipping to change at line 279 | skipping to change at line 287 | |||
I->Active = which_button(I, x, y); | I->Active = which_button(I, x, y); | |||
if(I->Active != I->Pressed) | if(I->Active != I->Pressed) | |||
I->Active = -1; | I->Active = -1; | |||
OrthoInvalidateDoDraw(G); | OrthoInvalidateDoDraw(G); | |||
OrthoDirty(G); | OrthoDirty(G); | |||
} | } | |||
} | } | |||
return (1); | return (1); | |||
} | } | |||
static int ControlRelease(Block * block, int button, int x, int y, int mod) | int CControl::release(int button, int x, int y, int mod) | |||
{ | { | |||
PyMOLGlobals *G = block->G; | PyMOLGlobals *G = m_G; | |||
CControl *I = G->Control; | CControl *I = G->Control; | |||
int sel = 0; | int sel = 0; | |||
I->LastPos = x; | I->LastPos = x; | |||
sel = which_button(I, x, y); | sel = which_button(I, x, y); | |||
if(!I->SkipRelease) { | if(!I->SkipRelease) { | |||
switch (sel) { | switch (sel) { | |||
case 0: | case 0: | |||
SceneSetFrame(G, 4, 0); | SceneSetFrame(G, 4, 0); | |||
skipping to change at line 384 | skipping to change at line 392 | |||
I->Active = -1; | I->Active = -1; | |||
I->Pressed = -1; | I->Pressed = -1; | |||
} | } | |||
return (1); | return (1); | |||
} | } | |||
Block *ControlGetBlock(PyMOLGlobals * G) | Block *ControlGetBlock(PyMOLGlobals * G) | |||
{ | { | |||
CControl *I = G->Control; | CControl *I = G->Control; | |||
{ | { | |||
return (I->Block); | return (I); | |||
} | } | |||
} | } | |||
/*========================================================================*/ | /*========================================================================*/ | |||
int ControlIdling(PyMOLGlobals * G) | int ControlIdling(PyMOLGlobals * G) | |||
{ | { | |||
CControl *I = G->Control; | CControl *I = G->Control; | |||
return (I->sdofActive || | return (I->sdofActive || | |||
MoviePlaying(G) || | MoviePlaying(G) || | |||
SettingGetGlobal_b(G, cSetting_rock) || SettingGetGlobal_b(G, cSetting _sculpting)); | SettingGetGlobal_b(G, cSetting_rock) || SettingGetGlobal_b(G, cSetting _sculpting)); | |||
skipping to change at line 408 | skipping to change at line 416 | |||
void ControlInterrupt(PyMOLGlobals * G) | void ControlInterrupt(PyMOLGlobals * G) | |||
{ | { | |||
/* register CControl *I=G->Control; */ | /* register CControl *I=G->Control; */ | |||
MoviePlay(G, cMovieStop); | MoviePlay(G, cMovieStop); | |||
ExecutiveDrawNow(G); | ExecutiveDrawNow(G); | |||
} | } | |||
/*========================================================================*/ | /*========================================================================*/ | |||
void ControlFree(PyMOLGlobals * G) | void ControlFree(PyMOLGlobals * G) | |||
{ | { | |||
CControl *I = G->Control; | ||||
OrthoFreeBlock(G, I->Block); | DeleteP(G->Control); | |||
FreeP(G->Control); | ||||
} | } | |||
/*========================================================================*/ | /*========================================================================*/ | |||
int ControlRock(PyMOLGlobals * G, int mode) | int ControlRock(PyMOLGlobals * G, int mode) | |||
{ | { | |||
switch (mode) { | switch (mode) { | |||
case -2: | case -2: | |||
break; | break; | |||
case -1: | case -1: | |||
SettingSetGlobal_b(G, cSetting_rock, !SettingGetGlobal_b(G, cSetting_rock)); | SettingSetGlobal_b(G, cSetting_rock, !SettingGetGlobal_b(G, cSetting_rock)); | |||
skipping to change at line 441 | skipping to change at line 448 | |||
break; | break; | |||
} | } | |||
if(mode != -2) { | if(mode != -2) { | |||
SceneRestartFrameTimer(G); | SceneRestartFrameTimer(G); | |||
OrthoDirty(G); | OrthoDirty(G); | |||
} | } | |||
return SettingGetGlobal_b(G, cSetting_rock); | return SettingGetGlobal_b(G, cSetting_rock); | |||
} | } | |||
/*========================================================================*/ | /*========================================================================*/ | |||
static int ControlClick(Block * block, int button, int x, int y, int mod) | int CControl::click(int button, int x, int y, int mod) | |||
{ | { | |||
PyMOLGlobals *G = block->G; | PyMOLGlobals *G = m_G; | |||
CControl *I = G->Control; | CControl *I = G->Control; | |||
I->SkipRelease = false; | I->SkipRelease = false; | |||
if(x < (I->Block->rect.left + cControlLeftMargin)) { | if(x < (I->rect.left + cControlLeftMargin)) { | |||
y -= I->Block->rect.top - cControlTopMargin; | y -= I->rect.top - cControlTopMargin; | |||
if((y <= 0) && (y > (-cControlBoxSize))) { | if((y <= 0) && (y > (-cControlBoxSize))) { | |||
double now = UtilGetSeconds(block->G); | double now = UtilGetSeconds(m_G); | |||
if((now - I->LastClickTime) < 0.35) { | if((now - I->LastClickTime) < 0.35) { | |||
if(I->SaveWidth) { | if(I->SaveWidth) { | |||
SettingSetGlobal_i(G, cSetting_internal_gui_width, I->SaveWidth); | SettingSetGlobal_i(G, cSetting_internal_gui_width, I->SaveWidth); | |||
OrthoReshape(G, -1, -1, false); | OrthoReshape(G, -1, -1, false); | |||
I->SaveWidth = 0; | I->SaveWidth = 0; | |||
} else { | } else { | |||
I->SaveWidth = SettingGetGlobal_i(G, cSetting_internal_gui_width); | I->SaveWidth = SettingGetGlobal_i(G, cSetting_internal_gui_width); | |||
SettingSetGlobal_i(G, cSetting_internal_gui_width, cControlMinWidth); | SettingSetGlobal_i(G, cSetting_internal_gui_width, cControlMinWidth); | |||
OrthoReshape(G, -1, -1, false); | OrthoReshape(G, -1, -1, false); | |||
} | } | |||
I->SkipRelease = true; | I->SkipRelease = true; | |||
} else { | } else { | |||
I->LastPos = x; | I->LastPos = x; | |||
OrthoGrab(G, block); | OrthoGrab(G, this); | |||
I->DragFlag = true; | I->DragFlag = true; | |||
I->LastClickTime = UtilGetSeconds(G); | I->LastClickTime = UtilGetSeconds(G); | |||
} | } | |||
} | } | |||
} else { | } else { | |||
I->Pressed = which_button(I, x, y); | I->Pressed = which_button(I, x, y); | |||
I->Active = I->Pressed; | I->Active = I->Pressed; | |||
if(I->Pressed) | if(I->Pressed) | |||
OrthoGrab(G, block); | OrthoGrab(G, this); | |||
OrthoDirty(G); | OrthoDirty(G); | |||
} | } | |||
return (1); | return (1); | |||
} | } | |||
static void draw_button(int x2, int y2, int w, int h, float *light, float *dark, | static void draw_button(int x2, int y2, int w, int h, float *light, float *dark, | |||
float *inside ORTHOCGOARG) | float *inside ORTHOCGOARG) | |||
{ | { | |||
if (orthoCGO){ | if (orthoCGO){ | |||
CGOColorv(orthoCGO, light); | CGOColorv(orthoCGO, light); | |||
skipping to change at line 533 | skipping to change at line 540 | |||
glBegin(GL_POLYGON); | glBegin(GL_POLYGON); | |||
glVertex2i(x2 + 1, y2 + 1); | glVertex2i(x2 + 1, y2 + 1); | |||
glVertex2i(x2 + 1, y2 + h - 1); | glVertex2i(x2 + 1, y2 + h - 1); | |||
glVertex2i(x2 + w - 1, y2 + h - 1); | glVertex2i(x2 + w - 1, y2 + h - 1); | |||
glVertex2i(x2 + w - 1, y2 + 1); | glVertex2i(x2 + w - 1, y2 + 1); | |||
glEnd(); | glEnd(); | |||
} | } | |||
} | } | |||
/*========================================================================*/ | /*========================================================================*/ | |||
static void ControlDraw(Block * block ORTHOCGOARG) | void CControl::draw(CGO* orthoCGO) | |||
{ | { | |||
PyMOLGlobals *G = block->G; | PyMOLGlobals *G = m_G; | |||
CControl *I = G->Control; | CControl *I = this; // TODO: Remove I during Control refactor | |||
int x, y; | int x, y; | |||
int nButton = I->NButton; | int nButton = I->NButton; | |||
int but_num; | int but_num; | |||
float lightEdge[3] = { 0.65F, 0.65F, 0.65F }; | float lightEdge[3] = { 0.65F, 0.65F, 0.65F }; | |||
float darkEdge[3] = { 0.3F, 0.3F, 0.3F }; | float darkEdge[3] = { 0.3F, 0.3F, 0.3F }; | |||
float pushed[3] = { 0.8F, 0.8F, 0.8F }; | float pushed[3] = { 0.8F, 0.8F, 0.8F }; | |||
if(G->HaveGUI && G->ValidContext) { | if(G->HaveGUI && G->ValidContext) { | |||
int control_width = I->Block->rect.right - (I->Block->rect.left + cControlLe ftMargin); | int control_width = rect.right - (rect.left + cControlLeftMargin); | |||
if (orthoCGO) | if (orthoCGO) | |||
CGOColorv(orthoCGO, I->Block->BackColor); | CGOColorv(orthoCGO, BackColor); | |||
#ifndef PURE_OPENGL_ES_2 | ||||
else | else | |||
glColor3fv(I->Block->BackColor); | glColor3fv(BackColor); | |||
BlockFill(I->Block ORTHOCGOARGVAR); | #endif | |||
fill(orthoCGO); | ||||
if (orthoCGO) | if (orthoCGO) | |||
CGOColorv(orthoCGO, I->Block->TextColor); | CGOColorv(orthoCGO, TextColor); | |||
#ifndef PURE_OPENGL_ES_2 | ||||
else | else | |||
glColor3fv(I->Block->TextColor); | glColor3fv(TextColor); | |||
#endif | ||||
{ | { | |||
int top, left, bottom, right; | int top, left, bottom, right; | |||
left = I->Block->rect.left + 1; | left = rect.left + 1; | |||
bottom = I->Block->rect.bottom + 1; | bottom = rect.bottom + 1; | |||
top = I->Block->rect.top - (cControlTopMargin - 1); | top = rect.top - (cControlTopMargin - 1); | |||
right = left + DIP2PIXEL(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); | |||
skipping to change at line 619 | skipping to change at line 629 | |||
glColor3fv(I->ButtonColor); | glColor3fv(I->ButtonColor); | |||
glBegin(GL_POLYGON); | glBegin(GL_POLYGON); | |||
glVertex2i(right - 1, top - 1); | glVertex2i(right - 1, top - 1); | |||
glVertex2i(right - 1, bottom + 1); | glVertex2i(right - 1, bottom + 1); | |||
glVertex2i(left + 1, bottom + 1); | glVertex2i(left + 1, bottom + 1); | |||
glVertex2i(left + 1, top - 1); | glVertex2i(left + 1, top - 1); | |||
glEnd(); | glEnd(); | |||
} | } | |||
y = I->Block->rect.top - cControlTopMargin; | y = rect.top - cControlTopMargin; | |||
for(but_num = 0; but_num < nButton; but_num++) { | for(but_num = 0; but_num < nButton; but_num++) { | |||
int but_width; | int but_width; | |||
int but_left; | int but_left; | |||
int but_bottom; | int but_bottom; | |||
int but_height; | int but_height; | |||
but_left = | but_left = | |||
I->Block->rect.left + cControlLeftMargin + (but_num * control_width) / n Button; | rect.left + cControlLeftMargin + (but_num * control_width) / nButton; | |||
but_width = | but_width = | |||
(((but_num + 1) * control_width / nButton) - | (((but_num + 1) * control_width / nButton) - | |||
((but_num) * control_width / nButton)) - 1; | ((but_num) * control_width / nButton)) - 1; | |||
but_bottom = y - (cControlBoxSize - 1); | but_bottom = y - (cControlBoxSize - 1); | |||
but_height = cControlBoxSize; | but_height = cControlBoxSize; | |||
if(but_num == I->Active) { | if(but_num == I->Active) { | |||
draw_button(but_left, but_bottom, | draw_button(but_left, but_bottom, | |||
but_width, but_height, lightEdge, darkEdge, pushed ORTHOCGOA RGVAR); | but_width, but_height, lightEdge, darkEdge, pushed ORTHOCGOA RGVAR); | |||
skipping to change at line 653 | skipping to change at line 663 | |||
but_width, but_height, lightEdge, darkEdge, I->ActiveColor O RTHOCGOARGVAR); | but_width, but_height, lightEdge, darkEdge, I->ActiveColor O RTHOCGOARGVAR); | |||
} else { | } else { | |||
draw_button(but_left, but_bottom, | draw_button(but_left, but_bottom, | |||
but_width, but_height, lightEdge, darkEdge, I->ButtonColor O RTHOCGOARGVAR); | but_width, but_height, lightEdge, darkEdge, I->ButtonColor O RTHOCGOARGVAR); | |||
} | } | |||
if(control_width > 100) { | if(control_width > 100) { | |||
x = but_left + (but_width - cControlBoxSize) / 2; | x = but_left + (but_width - cControlBoxSize) / 2; | |||
if (orthoCGO) | if (orthoCGO) | |||
CGOColorv(orthoCGO, I->Block->TextColor); | CGOColorv(orthoCGO, TextColor); | |||
#ifndef PURE_OPENGL_ES_2 | ||||
else | else | |||
glColor3fv(I->Block->TextColor); | glColor3fv(TextColor); | |||
#endif | ||||
switch (but_num) { | switch (but_num) { | |||
case 0: | case 0: | |||
if (orthoCGO){ | if (orthoCGO){ | |||
CGOBegin(orthoCGO, GL_TRIANGLES); | CGOBegin(orthoCGO, GL_TRIANGLES); | |||
CGOVertex(orthoCGO, x + (cControlBoxSize - 1) - cControlInnerMargin, | CGOVertex(orthoCGO, x + (cControlBoxSize - 1) - cControlInnerMargin, | |||
y - cControlInnerMargin, 0.f); | y - cControlInnerMargin, 0.f); | |||
CGOVertex(orthoCGO, x + (cControlBoxSize - 1) - cControlInnerMargin, | CGOVertex(orthoCGO, x + (cControlBoxSize - 1) - cControlInnerMargin, | |||
y - (cControlBoxSize - 1) + cControlInnerMargin, 0.f); | y - (cControlBoxSize - 1) + cControlInnerMargin, 0.f); | |||
CGOVertex(orthoCGO, x + cControlInnerMargin, y - (cControlBoxSize / 2 ), 0.f); | CGOVertex(orthoCGO, x + cControlInnerMargin, y - (cControlBoxSize / 2 ), 0.f); | |||
CGOEnd(orthoCGO); | CGOEnd(orthoCGO); | |||
skipping to change at line 810 | skipping to change at line 822 | |||
glEnd(); | glEnd(); | |||
glBegin(GL_LINES); | glBegin(GL_LINES); | |||
glVertex2i(x + (cControlBoxSize - 1) - cControlInnerMargin, | glVertex2i(x + (cControlBoxSize - 1) - cControlInnerMargin, | |||
y - cControlInnerMargin); | y - cControlInnerMargin); | |||
glVertex2i(x + (cControlBoxSize - 1) - cControlInnerMargin, | glVertex2i(x + (cControlBoxSize - 1) - cControlInnerMargin, | |||
y - (cControlBoxSize - 1) + cControlInnerMargin); | y - (cControlBoxSize - 1) + cControlInnerMargin); | |||
glEnd(); | glEnd(); | |||
} | } | |||
break; | break; | |||
case 6: | case 6: | |||
TextSetColor(G, TextColor); | ||||
TextDrawStrAt(G, "S", x + cControlInnerMargin, | TextDrawStrAt(G, "S", x + cControlInnerMargin, | |||
y - cControlBoxSize + cControlInnerMargin + 1 ORTHOCGOAR GVAR); | y - cControlBoxSize + cControlInnerMargin + 1 ORTHOCGOAR GVAR); | |||
break; | break; | |||
case 7: | case 7: | |||
if (orthoCGO){ | if (orthoCGO){ | |||
CGOBegin(orthoCGO, GL_TRIANGLES); | CGOBegin(orthoCGO, GL_TRIANGLES); | |||
CGOVertex(orthoCGO, x + (cControlBoxSize / 2) + cControlSpread, y - c ControlInnerMargin, 0.f); | CGOVertex(orthoCGO, x + (cControlBoxSize / 2) + cControlSpread, y - c ControlInnerMargin, 0.f); | |||
CGOVertex(orthoCGO, x + (cControlBoxSize / 2), | CGOVertex(orthoCGO, x + (cControlBoxSize / 2), | |||
y - (cControlBoxSize) + cControlInnerMargin, 0.f); | y - (cControlBoxSize) + cControlInnerMargin, 0.f); | |||
CGOVertex(orthoCGO, x + (cControlBoxSize / 2) - cControlSpread, y - c ControlInnerMargin, 0.f); | CGOVertex(orthoCGO, x + (cControlBoxSize / 2) - cControlSpread, y - c ControlInnerMargin, 0.f); | |||
skipping to change at line 831 | skipping to change at line 844 | |||
} else { | } else { | |||
glBegin(GL_POLYGON); | glBegin(GL_POLYGON); | |||
glVertex2i(x + (cControlBoxSize / 2) + cControlSpread, y - cControlIn nerMargin); | glVertex2i(x + (cControlBoxSize / 2) + cControlSpread, y - cControlIn nerMargin); | |||
glVertex2i(x + (cControlBoxSize / 2), | glVertex2i(x + (cControlBoxSize / 2), | |||
y - (cControlBoxSize) + cControlInnerMargin); | y - (cControlBoxSize) + cControlInnerMargin); | |||
glVertex2i(x + (cControlBoxSize / 2) - cControlSpread, y - cControlIn nerMargin); | glVertex2i(x + (cControlBoxSize / 2) - cControlSpread, y - cControlIn nerMargin); | |||
glEnd(); | glEnd(); | |||
} | } | |||
break; | break; | |||
case 8: | case 8: | |||
TextSetColor(G, I->Block->TextColor); | TextSetColor(G, TextColor); | |||
TextDrawStrAt(G, "F", x + cControlInnerMargin, | TextDrawStrAt(G, "F", x + cControlInnerMargin, | |||
y - cControlBoxSize + cControlInnerMargin + 1 ORTHOCGOAR GVAR); | y - cControlBoxSize + cControlInnerMargin + 1 ORTHOCGOAR GVAR); | |||
break; | break; | |||
} | } | |||
} | } | |||
} | } | |||
} | } | |||
} | } | |||
} | } | |||
/*========================================================================*/ | /*========================================================================*/ | |||
int ControlInit(PyMOLGlobals * G) | int ControlInit(PyMOLGlobals * G) | |||
{ | { | |||
CControl *I = NULL; | CControl *I = NULL; | |||
if((I = (G->Control = new CControl(G)))) { | ||||
if((I = (G->Control = Calloc(CControl, 1)))) { | I->active = true; | |||
I->TextColor[0] = 1.0; | ||||
I->Block = OrthoNewBlock(G, NULL); | I->TextColor[1] = 0.75; | |||
I->Block->fClick = ControlClick; | I->TextColor[2] = 0.75; | |||
I->Block->fDraw = ControlDraw; | OrthoAttach(G, I, cOrthoTool); | |||
I->Block->fDrag = ControlDrag; | ||||
I->Block->fRelease = ControlRelease; | ||||
I->Block->fReshape = ControlReshape; | ||||
I->Block->active = true; | ||||
I->Block->TextColor[0] = 1.0; | ||||
I->Block->TextColor[1] = 0.75; | ||||
I->Block->TextColor[2] = 0.75; | ||||
I->ButtonColor[0] = 0.5F; | ||||
I->ButtonColor[1] = 0.5F; | ||||
I->ButtonColor[2] = 0.5F; | ||||
I->ActiveColor[0] = 0.65F; | ||||
I->ActiveColor[1] = 0.65F; | ||||
I->ActiveColor[2] = 0.65F; | ||||
I->Pressed = -1; | ||||
I->Active = -1; | ||||
OrthoAttach(G, I->Block, cOrthoTool); | ||||
I->SaveWidth = 0; | ||||
I->LastClickTime = UtilGetSeconds(G); | I->LastClickTime = UtilGetSeconds(G); | |||
I->NButton = 9; | ||||
return 1; | return 1; | |||
} else | } else | |||
return 0; | return 0; | |||
} | } | |||
End of changes. 37 change blocks. | ||||
86 lines changed or deleted | 81 lines changed or added |