Executive.cpp (pymol-v2.1.0.tar.bz2) | : | Executive.cpp (pymol-open-source-2.2.0) | ||
---|---|---|---|---|
skipping to change at line 45 | skipping to change at line 45 | |||
#include"ObjectSlice.h" | #include"ObjectSlice.h" | |||
#include"ObjectAlignment.h" | #include"ObjectAlignment.h" | |||
#include"ObjectGroup.h" | #include"ObjectGroup.h" | |||
#include"ObjectVolume.h" | #include"ObjectVolume.h" | |||
#include"ObjectCallback.h" | #include"ObjectCallback.h" | |||
#include"ObjectMap.h" | #include"ObjectMap.h" | |||
#include"ListMacros.h" | #include"ListMacros.h" | |||
#include"MyPNG.h" | #include"MyPNG.h" | |||
#include"Ortho.h" | #include"Ortho.h" | |||
#include"Scene.h" | #include"Scene.h" | |||
#include"ScenePicking.h" | ||||
#include"SceneRay.h" | ||||
#include"Selector.h" | #include"Selector.h" | |||
#include"Vector.h" | #include"Vector.h" | |||
#include"Color.h" | #include"Color.h" | |||
#include"Setting.h" | #include"Setting.h" | |||
#include"Matrix.h" | #include"Matrix.h" | |||
#include"P.h" | #include"P.h" | |||
#include"PConv.h" | #include"PConv.h" | |||
#include"Match.h" | #include"Match.h" | |||
#include"ObjectCGO.h" | #include"ObjectCGO.h" | |||
#include"Util.h" | #include"Util.h" | |||
#include"Util2.h" | ||||
#include"Wizard.h" | #include"Wizard.h" | |||
#include"ScrollBar.h" | #include"ScrollBar.h" | |||
#include"Movie.h" | #include"Movie.h" | |||
#include"ObjectGadgetRamp.h" | #include"ObjectGadgetRamp.h" | |||
#include"SculptCache.h" | #include"SculptCache.h" | |||
#include"Control.h" | #include"Control.h" | |||
#include"Menu.h" | #include"Menu.h" | |||
#include"Map.h" | #include"Map.h" | |||
#include"Editor.h" | #include"Editor.h" | |||
#include"RepDot.h" | #include"RepDot.h" | |||
skipping to change at line 1846 | skipping to change at line 1849 | |||
int ignore_case = SettingGetGlobal_b(G, cSetting_ignore_case); | int ignore_case = SettingGetGlobal_b(G, cSetting_ignore_case); | |||
while(ListIterate(I->Spec, rec, next)) { | while(ListIterate(I->Spec, rec, next)) { | |||
if(WordMatchExact(G, name, rec->name, ignore_case)) { | if(WordMatchExact(G, name, rec->name, ignore_case)) { | |||
result = rec; | result = rec; | |||
break; | break; | |||
} | } | |||
} | } | |||
return (result); | return (result); | |||
} | } | |||
/* | ||||
* Scroll the i'th match in the object menu panel to the top. | ||||
* Scroll to last match if i < 0 and to first match if i > #-1. | ||||
* Open groups if hit is inside. | ||||
* Highlight the hit (same as mouse click highlight). | ||||
* | ||||
* Returns the number of hits | ||||
*/ | ||||
int ExecutiveScrollTo(PyMOLGlobals * G, const char * name, int i) { | ||||
CExecutive *I = G->Executive; | ||||
PanelRec *panel = NULL; | ||||
int pos = 0, numhits = 0; | ||||
ObjectGroup *group; | ||||
SpecRec *tmp, *spec = NULL, *first = NULL; | ||||
int ignore_case = SettingGetGlobal_b(G, cSetting_ignore_case); | ||||
int j, lendiff, plen = strlen(name); | ||||
ok_assert(1, I->Spec); | ||||
// i'th substring match, skip the "all" item | ||||
for(tmp = I->Spec->next; tmp; tmp = tmp->next) { | ||||
lendiff = strlen(tmp->name) - plen; | ||||
for(j = 0; j <= lendiff; j++) | ||||
if(WordMatchNoWild(G, name, tmp->name + j, ignore_case)) { | ||||
if(numhits++ == i || i < 0) | ||||
spec = tmp; | ||||
if(!first) | ||||
first = tmp; | ||||
break; | ||||
} | ||||
tmp->hilight = 0; | ||||
} | ||||
// if i was out of range | ||||
if(!spec) | ||||
spec = first; | ||||
ok_assert(1, spec); | ||||
// flash button until panel is clicked for the next time | ||||
spec->hilight = 1; | ||||
// open parent groups | ||||
for(tmp = spec->group; tmp; tmp = tmp->group) { | ||||
if(!(tmp->type == cExecObject && | ||||
tmp->obj->type == cObjectGroup)) | ||||
break; | ||||
group = (ObjectGroup *) tmp->obj; | ||||
if(!group->OpenOrClosed) { | ||||
group->OpenOrClosed = 1; | ||||
ExecutiveInvalidatePanelList(G); | ||||
} | ||||
} | ||||
// in case any parent got opened | ||||
ExecutiveUpdatePanelList(G); | ||||
// scroll that record to the top | ||||
while(ListIterate(I->Panel, panel, next)) { | ||||
if(panel->spec == spec) { | ||||
ScrollBarSetValueNoCheck(I->ScrollBar, pos); | ||||
return numhits; | ||||
} | ||||
pos++; | ||||
} | ||||
ok_except1: | ||||
return numhits; | ||||
} | ||||
void ExecutiveUpdateColorDepends(PyMOLGlobals * G, ObjectMolecule * mol) | void ExecutiveUpdateColorDepends(PyMOLGlobals * G, ObjectMolecule * mol) | |||
{ | { | |||
CExecutive *I = G->Executive; | CExecutive *I = G->Executive; | |||
SpecRec *rec = NULL; | SpecRec *rec = NULL; | |||
while(ListIterate(I->Spec, rec, next)) { | while(ListIterate(I->Spec, rec, next)) { | |||
if(rec->type == cExecObject) { | if(rec->type == cExecObject) { | |||
if(rec->obj->type == cObjectGadget) { | if(rec->obj->type == cObjectGadget) { | |||
ObjectGadget *gadget = (ObjectGadget *) rec->obj; | ObjectGadget *gadget = (ObjectGadget *) rec->obj; | |||
if(gadget->GadgetType == cGadgetRamp) { | if(gadget->GadgetType == cGadgetRamp) { | |||
skipping to change at line 2500 | skipping to change at line 2573 | |||
if(source_mode < 0) | if(source_mode < 0) | |||
source_mode = matrix_mode; | source_mode = matrix_mode; | |||
if(target_mode < 0) | if(target_mode < 0) | |||
target_mode = matrix_mode; | target_mode = matrix_mode; | |||
if(source_name[0] == 0) { | if(source_name[0] == 0) { | |||
source_mode = 3; | source_mode = 3; | |||
target_undo = 0; | target_undo = 0; | |||
} else | } else | |||
src_rec = ExecutiveFindSpec(G, source_name); | src_rec = ExecutiveFindSpec(G, source_name); | |||
if (source_mode != 3 && !src_rec) { | ||||
PRINTFB(G, FB_Executive, FB_Warnings) | ||||
" %s-Warning: Can't find source object '%s'.\n", __FUNCTION__, source_name | ||||
ENDFB(G); | ||||
} | ||||
int list_id = ExecutiveGetNamesListFromPattern(G, target_name, true, cExecExpa | ||||
ndKeepGroups); | ||||
if (!list_id) { | ||||
PRINTFB(G, FB_Executive, FB_Warnings) | ||||
" %s-Warning: No match for target '%s'.\n", __FUNCTION__, target_name | ||||
ENDFB(G); | ||||
} | ||||
switch (source_mode) { | switch (source_mode) { | |||
case 0: /* txf history is the source matrix */ | case 0: /* txf history is the source matrix */ | |||
{ | { | |||
double *history = NULL; | double *history = NULL; | |||
int found = ExecutiveGetObjectMatrix(G, source_name, source_state, &histor y, false); | int found = ExecutiveGetObjectMatrix(G, source_name, source_state, &histor y, false); | |||
if(found) { | if(found) { | |||
int list_id = ExecutiveGetNamesListFromPattern(G, target_name, | ||||
true, cExecExpandKeepGrou | ||||
ps); | ||||
int iter_id = TrackerNewIter(I_Tracker, 0, list_id); | int iter_id = TrackerNewIter(I_Tracker, 0, list_id); | |||
SpecRec *rec; | SpecRec *rec; | |||
while(TrackerIterNextCandInList(I_Tracker, iter_id, | while(TrackerIterNextCandInList(I_Tracker, iter_id, | |||
(TrackerRef **) (void *) &rec)) { | (TrackerRef **) (void *) &rec)) { | |||
if(rec && (rec != src_rec)) { | if(rec && (rec != src_rec)) { | |||
switch (rec->type) { | switch (rec->type) { | |||
case cExecObject: | case cExecObject: | |||
switch (target_mode) { | switch (target_mode) { | |||
skipping to change at line 2575 | skipping to change at line 2660 | |||
/* to do: logging, return values, etc. */ | /* to do: logging, return values, etc. */ | |||
break; | break; | |||
case 2: /* applying changes to the state matrix */ | case 2: /* applying changes to the state matrix */ | |||
ok = ExecutiveSetObjectMatrix(G, rec->name, target_state, histor y); | ok = ExecutiveSetObjectMatrix(G, rec->name, target_state, histor y); | |||
break; | break; | |||
} | } | |||
break; | break; | |||
} | } | |||
} | } | |||
} | } | |||
TrackerDelList(I_Tracker, list_id); | ||||
TrackerDelIter(I_Tracker, iter_id); | TrackerDelIter(I_Tracker, iter_id); | |||
} | } | |||
} | } | |||
break; | break; | |||
case 1: /* from the TTT matrix */ | case 1: /* from the TTT matrix */ | |||
{ | { | |||
/* note that for now we're forcing states to be -1 */ | /* note that for now we're forcing states to be -1 */ | |||
/* in the future, we may have per-state TTTs -- though right now the | /* in the future, we may have per-state TTTs -- though right now the | |||
view matrices serve that purpose */ | view matrices serve that purpose */ | |||
const float *tttf; | const float *tttf; | |||
int found = ExecutiveGetObjectTTT(G, source_name, &tttf, -1, quiet); | int found = ExecutiveGetObjectTTT(G, source_name, &tttf, -1, quiet); | |||
if(found) { | if(found) { | |||
int list_id = ExecutiveGetNamesListFromPattern(G, target_name, true, | ||||
cExecExpandKeepGroups); | ||||
int iter_id = TrackerNewIter(I_Tracker, 0, list_id); | int iter_id = TrackerNewIter(I_Tracker, 0, list_id); | |||
SpecRec *rec; | SpecRec *rec; | |||
while(TrackerIterNextCandInList(I_Tracker, iter_id, | while(TrackerIterNextCandInList(I_Tracker, iter_id, | |||
(TrackerRef **) (void *) &rec)) { | (TrackerRef **) (void *) &rec)) { | |||
if(rec && (rec != src_rec)) { | if(rec && (rec != src_rec)) { | |||
switch (rec->type) { | switch (rec->type) { | |||
case cExecObject: | case cExecObject: | |||
skipping to change at line 2623 | skipping to change at line 2705 | |||
ok = ExecutiveSetObjectMatrix(G, rec->name, -1, homo); | ok = ExecutiveSetObjectMatrix(G, rec->name, -1, homo); | |||
} else { | } else { | |||
ok = ExecutiveSetObjectMatrix(G, rec->name, -1, NULL); | ok = ExecutiveSetObjectMatrix(G, rec->name, -1, NULL); | |||
} | } | |||
break; | break; | |||
} | } | |||
} | } | |||
} | } | |||
} | } | |||
TrackerDelList(I_Tracker, list_id); | ||||
TrackerDelIter(I_Tracker, iter_id); | TrackerDelIter(I_Tracker, iter_id); | |||
} | } | |||
} | } | |||
break; | break; | |||
case 2: /* from the state matrix */ | case 2: /* from the state matrix */ | |||
{ | { | |||
double *homo; | double *homo; | |||
int found = ExecutiveGetObjectMatrix(G, source_name, source_state, &homo, false); | int found = ExecutiveGetObjectMatrix(G, source_name, source_state, &homo, false); | |||
if(found) { | if(found) { | |||
int list_id = | ||||
ExecutiveGetNamesListFromPattern(G, target_name, true, cExecExpandKeep | ||||
Groups); | ||||
int iter_id = TrackerNewIter(I_Tracker, 0, list_id); | int iter_id = TrackerNewIter(I_Tracker, 0, list_id); | |||
SpecRec *rec; | SpecRec *rec; | |||
while(TrackerIterNextCandInList(I_Tracker, iter_id, | while(TrackerIterNextCandInList(I_Tracker, iter_id, | |||
(TrackerRef **) (void *) &rec)) { | (TrackerRef **) (void *) &rec)) { | |||
if(rec && (rec != src_rec)) { | if(rec && (rec != src_rec)) { | |||
switch (rec->type) { | switch (rec->type) { | |||
case cExecObject: | case cExecObject: | |||
switch (target_mode) { | switch (target_mode) { | |||
skipping to change at line 2672 | skipping to change at line 2751 | |||
int found = ExecutiveGetObjectTTT(G, source_name, &tttf, -1, q uiet); | int found = ExecutiveGetObjectTTT(G, source_name, &tttf, -1, q uiet); | |||
if(found) { | if(found) { | |||
ExecutiveSetObjectTTT(G, rec->name, tttf, -1, quiet, -1); | ExecutiveSetObjectTTT(G, rec->name, tttf, -1, quiet, -1); | |||
} | } | |||
} | } | |||
break; | break; | |||
} | } | |||
} | } | |||
} | } | |||
} | } | |||
TrackerDelList(I_Tracker, list_id); | ||||
TrackerDelIter(I_Tracker, iter_id); | TrackerDelIter(I_Tracker, iter_id); | |||
} | } | |||
} | } | |||
break; | break; | |||
case 3: /* camera */ | case 3: /* camera */ | |||
{ | { | |||
SceneViewType view; | SceneViewType view; | |||
double homo[16], *history; | double homo[16], *history; | |||
int list_id = ExecutiveGetNamesListFromPattern(G, target_name, | ||||
true, cExecExpandKeepGroups | ||||
); | ||||
int iter_id = TrackerNewIter(I_Tracker, 0, list_id); | int iter_id = TrackerNewIter(I_Tracker, 0, list_id); | |||
SpecRec *rec; | SpecRec *rec; | |||
SceneGetView(G, view); | SceneGetView(G, view); | |||
homo[0] = view[0]; | homo[0] = view[0]; | |||
homo[1] = view[4]; | homo[1] = view[4]; | |||
homo[2] = view[8]; | homo[2] = view[8]; | |||
homo[3] = -(view[0] * view[19] + view[4] * view[20] + view[8] * view[21]); | homo[3] = -(view[0] * view[19] + view[4] * view[20] + view[8] * view[21]); | |||
homo[4] = view[1]; | homo[4] = view[1]; | |||
homo[5] = view[5]; | homo[5] = view[5]; | |||
homo[6] = view[9]; | homo[6] = view[9]; | |||
skipping to change at line 2757 | skipping to change at line 2833 | |||
} | } | |||
/* to do: logging, return values, etc. */ | /* to do: logging, return values, etc. */ | |||
break; | break; | |||
case 2: /* applying changes to the state matrix */ | case 2: /* applying changes to the state matrix */ | |||
ok = ExecutiveSetObjectMatrix(G, rec->name, target_state, history) ; | ok = ExecutiveSetObjectMatrix(G, rec->name, target_state, history) ; | |||
break; | break; | |||
} | } | |||
break; | break; | |||
} | } | |||
} | } | |||
TrackerDelList(I_Tracker, list_id); | ||||
TrackerDelIter(I_Tracker, iter_id); | TrackerDelIter(I_Tracker, iter_id); | |||
} | } | |||
} | } | |||
break; | break; | |||
} | } | |||
TrackerDelList(I_Tracker, list_id); | ||||
SceneInvalidate(G); | SceneInvalidate(G); | |||
return ok; | return ok; | |||
} | } | |||
static void ExecutiveInvalidateMapDependents(PyMOLGlobals * G, const char *map_n ame, const char * new_name = NULL) | static void ExecutiveInvalidateMapDependents(PyMOLGlobals * G, const char *map_n ame, const char * new_name = NULL) | |||
{ | { | |||
CExecutive *I = G->Executive; | CExecutive *I = G->Executive; | |||
SpecRec *rec = NULL; | SpecRec *rec = NULL; | |||
while(ListIterate(I->Spec, rec, next)) { | while(ListIterate(I->Spec, rec, next)) { | |||
if(rec->type == cExecObject) { | if(rec->type == cExecObject) { | |||
skipping to change at line 5935 | skipping to change at line 6013 | |||
if(have_active) | if(have_active) | |||
ExecutiveSetObjVisib(G, active, true, false); | ExecutiveSetObjVisib(G, active, true, false); | |||
} | } | |||
OVOneToOne_DEL_AUTO_NULL(G->SettingUnique->old2new); | OVOneToOne_DEL_AUTO_NULL(G->SettingUnique->old2new); | |||
if(incomplete) { | if(incomplete) { | |||
PRINTFB(G, FB_Executive, FB_Warnings) | PRINTFB(G, FB_Executive, FB_Warnings) | |||
"ExectiveSetSession-Warning: restore may be incomplete.\n" ENDFB(G); | "ExectiveSetSession-Warning: restore may be incomplete.\n" ENDFB(G); | |||
} | } | |||
CShaderMgr_Set_Reload_Bits(G, RELOAD_SHADERS_UPDATE_FOR_BACKGROUND); | G->ShaderMgr->Set_Reload_Bits(RELOAD_ALL_SHADERS); | |||
OrthoBackgroundTextureNeedsUpdate(G); | OrthoBackgroundTextureNeedsUpdate(G); | |||
ExecutiveInvalidateSelectionIndicatorsCGO(G); | ExecutiveInvalidateSelectionIndicatorsCGO(G); | |||
OrthoInvalidateDoDraw(G); | ||||
SceneChanged(G); | SceneChanged(G); | |||
return (ok); | return (ok); | |||
} | } | |||
#define ExecScrollBarMargin DIP2PIXEL(1) | #define ExecScrollBarMargin DIP2PIXEL(1) | |||
#define ExecScrollBarWidth DIP2PIXEL(13) | #define ExecScrollBarWidth DIP2PIXEL(13) | |||
void ExecutiveObjMolSeleOp(PyMOLGlobals * G, int sele, ObjectMoleculeOpRec * op) ; | void ExecutiveObjMolSeleOp(PyMOLGlobals * G, int sele, ObjectMoleculeOpRec * op) ; | |||
static CObject **ExecutiveSeleToObjectVLA(PyMOLGlobals * G, const char *s1) | static CObject **ExecutiveSeleToObjectVLA(PyMOLGlobals * G, const char *s1) | |||
skipping to change at line 7192 | skipping to change at line 7271 | |||
SceneGetCenter(G, pos); | SceneGetCenter(G, pos); | |||
center[3] = 1.0F / center[3]; | center[3] = 1.0F / center[3]; | |||
scale3f(center, center[3], center); | scale3f(center, center[3], center); | |||
center[7] = 1.0F / center[7]; | center[7] = 1.0F / center[7]; | |||
scale3f(center + 4, center[7], center + 4); | scale3f(center + 4, center[7], center + 4); | |||
subtract3f(center, center + 4, center); | subtract3f(center, center + 4, center); | |||
add3f(pos, center, center); | add3f(pos, center, center); | |||
ExecutiveCenter(G, NULL, -1, true, false, center, true); | ExecutiveCenter(G, NULL, -1, true, false, center, true); | |||
} | } | |||
} | } | |||
if (active){ | ||||
EditorInvalidateShaderCGO(G); | ||||
} | ||||
return (active); | return (active); | |||
} | } | |||
/*========================================================================*/ | /*========================================================================*/ | |||
float ExecutiveSculptIterate(PyMOLGlobals * G, const char *name, int state, int n_cycle) | float ExecutiveSculptIterate(PyMOLGlobals * G, const char *name, int state, int n_cycle) | |||
{ | { | |||
CObject *obj = ExecutiveFindObjectByName(G, name); | CObject *obj = ExecutiveFindObjectByName(G, name); | |||
CExecutive *I = G->Executive; | CExecutive *I = G->Executive; | |||
SpecRec *rec = NULL; | SpecRec *rec = NULL; | |||
ObjectMolecule *objMol; | ObjectMolecule *objMol; | |||
skipping to change at line 8096 | skipping to change at line 8178 | |||
int ExecutiveCartoon(PyMOLGlobals * G, int type, const char *s1) | int ExecutiveCartoon(PyMOLGlobals * G, int type, const char *s1) | |||
{ | { | |||
SelectorTmp tmpsele1(G, s1); | SelectorTmp tmpsele1(G, s1); | |||
int sele1 = tmpsele1.getIndex(); | int sele1 = tmpsele1.getIndex(); | |||
ObjectMoleculeOpRec op1; | ObjectMoleculeOpRec op1; | |||
ObjectMoleculeOpRecInit(&op1); | ObjectMoleculeOpRecInit(&op1); | |||
op1.i2 = 0; | op1.i2 = 0; | |||
if(sele1 >= 0) { | if(sele1 >= 0) { | |||
op1.code = OMOP_INVA; | ||||
op1.i1 = cRepCartoon; | ||||
op1.i2 = cRepInvRep; | ||||
ExecutiveObjMolSeleOp(G, sele1, &op1); | ||||
op1.code = OMOP_Cartoon; | op1.code = OMOP_Cartoon; | |||
op1.i1 = type; | op1.i1 = type; | |||
op1.i2 = 0; | op1.i2 = 0; | |||
op1.i3 = 0; | op1.i3 = 0; | |||
ExecutiveObjMolSeleOp(G, sele1, &op1); | ExecutiveObjMolSeleOp(G, sele1, &op1); | |||
if (op1.i3>0){ | if (op1.i3>0){ | |||
op1.code = OMOP_INVA; | op1.code = OMOP_INVA; | |||
op1.i1 = cRepCartoonBit; | op1.i1 = cRepCartoonBit; | |||
op1.i2 = cRepInvRep; | op1.i2 = cRepInvRep; | |||
ExecutiveObjMolSeleOp(G, sele1, &op1); | ExecutiveObjMolSeleOp(G, sele1, &op1); | |||
skipping to change at line 8416 | skipping to change at line 8494 | |||
void ExecutiveInvalidateSelectionIndicatorsCGO(PyMOLGlobals *G){ | void ExecutiveInvalidateSelectionIndicatorsCGO(PyMOLGlobals *G){ | |||
CExecutive *I = G->Executive; | CExecutive *I = G->Executive; | |||
SpecRec *rec = NULL; | SpecRec *rec = NULL; | |||
if (I){ | if (I){ | |||
if (I->selIndicatorsCGO){ | if (I->selIndicatorsCGO){ | |||
CGOFree(I->selIndicatorsCGO); | CGOFree(I->selIndicatorsCGO); | |||
I->selIndicatorsCGO = 0; | I->selIndicatorsCGO = 0; | |||
} | } | |||
while(ListIterate(I->Spec, rec, next)) { | while(ListIterate(I->Spec, rec, next)) { | |||
if(rec->type == cExecObject) { | if(rec->type == cExecObject) { | |||
if (rec->gridSlotSelIndicatorsCGO){ | ||||
CGOFree(rec->gridSlotSelIndicatorsCGO); | CGOFree(rec->gridSlotSelIndicatorsCGO); | |||
rec->gridSlotSelIndicatorsCGO = NULL; | ||||
} | ||||
} | } | |||
} | } | |||
} | } | |||
} | } | |||
static void ExecutiveRegenerateTextureForSelector(PyMOLGlobals *G, int round_poi nts, int *widths_arg){ | static void ExecutiveRegenerateTextureForSelector(PyMOLGlobals *G, int round_poi nts, int *widths_arg){ | |||
CExecutive *I = G->Executive; | CExecutive *I = G->Executive; | |||
unsigned char *temp_buffer = Alloc(unsigned char, widths_arg[0] * widths_arg[0 ] * 4); | unsigned char *temp_buffer = Alloc(unsigned char, widths_arg[0] * widths_arg[0 ] * 4); | |||
int a, b; | int a, b; | |||
float mid_point, disty, distx, dist, wminusd; | float mid_point, disty, distx, dist, wminusd; | |||
skipping to change at line 8513 | skipping to change at line 8588 | |||
widths_arg[0], widths_arg[0], GL_RGBA, GL_UNSIGNED_BYTE, temp_b uffer); | widths_arg[0], widths_arg[0], GL_RGBA, GL_UNSIGNED_BYTE, temp_b uffer); | |||
FreeP(temp_buffer); | FreeP(temp_buffer); | |||
} | } | |||
static void ExecutiveRenderIndicatorCGO(PyMOLGlobals * G, CGO *selIndicatorsCGO) { | static void ExecutiveRenderIndicatorCGO(PyMOLGlobals * G, CGO *selIndicatorsCGO) { | |||
CExecutive *I = G->Executive; | CExecutive *I = G->Executive; | |||
CShaderPrg *shaderPrg; | CShaderPrg *shaderPrg; | |||
float text_texture_dim = TextureGetTextTextureSize(G); | float text_texture_dim = TextureGetTextTextureSize(G); | |||
float textureScale; | float textureScale; | |||
int no_depth = (int) SettingGetGlobal_f(G, cSetting_selection_overlay); | int no_depth = (int) SettingGetGlobal_f(G, cSetting_selection_overlay); | |||
shaderPrg = CShaderPrg_Enable_IndicatorShader(G); | shaderPrg = G->ShaderMgr->Enable_IndicatorShader(); | |||
if (!shaderPrg)return; | if (!shaderPrg)return; | |||
glEnable(GL_POINT_SPRITE); | glEnable(GL_POINT_SPRITE); | |||
glEnable(GL_VERTEX_PROGRAM_POINT_SIZE); | glEnable(GL_VERTEX_PROGRAM_POINT_SIZE); | |||
CShaderPrg_SetLightingEnabled(shaderPrg, 0); | shaderPrg->SetLightingEnabled(0); | |||
CShaderPrg_SetAttrib4fLocation(shaderPrg, "a_Color", 1.f, 1.f, 1.f, 1.f); | shaderPrg->SetAttrib4fLocation("a_Color", 1.f, 1.f, 1.f, 1.f); | |||
CShaderPrg_Set1f(shaderPrg, "g_pointSize", DIP2PIXEL(I->selectorTextureSize)); | shaderPrg->Set1f("g_pointSize", DIP2PIXEL(I->selectorTextureSize)); | |||
CShaderPrg_Set2f(shaderPrg, "textureLookup", I->selectorTexturePosX/text_textu | shaderPrg->Set2f("textureLookup", I->selectorTexturePosX/text_texture_dim, I-> | |||
re_dim, I->selectorTexturePosY/text_texture_dim); | selectorTexturePosY/text_texture_dim); | |||
textureScale = I->selectorTextureSize/text_texture_dim ; | textureScale = I->selectorTextureSize/text_texture_dim ; | |||
CShaderPrg_Set2f(shaderPrg, "textureScale", textureScale, textureScale); | shaderPrg->Set2f("textureScale", textureScale, textureScale); | |||
int v[4]; | ||||
glGetIntegerv(GL_VIEWPORT, v); | ||||
shaderPrg->Set4f("viewport", v[0], v[1], v[2], v[3]); | ||||
if(no_depth) | if(no_depth) | |||
glDisable(GL_DEPTH_TEST); | glDisable(GL_DEPTH_TEST); | |||
CGORenderGL(selIndicatorsCGO, NULL, NULL, NULL, NULL, NULL); | CGORenderGL(selIndicatorsCGO, NULL, NULL, NULL, NULL, NULL); | |||
if(no_depth) | if(no_depth) | |||
glEnable(GL_DEPTH_TEST); | glEnable(GL_DEPTH_TEST); | |||
glDisable(GL_VERTEX_PROGRAM_POINT_SIZE); | glDisable(GL_VERTEX_PROGRAM_POINT_SIZE); | |||
glDisable(GL_POINT_SPRITE); | glDisable(GL_POINT_SPRITE); | |||
CShaderPrg_Disable(shaderPrg); | shaderPrg->Disable(); | |||
} | } | |||
static void ExecutiveSetupIndicatorPassGLImmediate(PyMOLGlobals * G, SpecRec *re c, int pass, float gl_width, int width){ | static void ExecutiveSetupIndicatorPassGLImmediate(PyMOLGlobals * G, SpecRec *re c, int pass, float gl_width, int width){ | |||
#ifndef PURE_OPENGL_ES_2 | #ifndef PURE_OPENGL_ES_2 | |||
switch (pass){ | switch (pass){ | |||
case 0: | case 0: | |||
if(rec->sele_color < 0) | if(rec->sele_color < 0) | |||
glColor3f(1.0F, 0.2F, 0.6F); | glColor3f(1.0F, 0.2F, 0.6F); | |||
else | else | |||
glColor3fv(ColorGet(G, rec->sele_color)); | glColor3fv(ColorGet(G, rec->sele_color)); | |||
skipping to change at line 8640 | skipping to change at line 8718 | |||
rec = NULL; | rec = NULL; | |||
} else if (I->selIndicatorsCGO){ | } else if (I->selIndicatorsCGO){ | |||
ExecutiveRenderIndicatorCGO(G, I->selIndicatorsCGO); | ExecutiveRenderIndicatorCGO(G, I->selIndicatorsCGO); | |||
return; | return; | |||
} | } | |||
} | } | |||
} else { | } else { | |||
inv_indicators = true; | inv_indicators = true; | |||
} | } | |||
if (inv_indicators){ | if (inv_indicators){ | |||
if (I->selIndicatorsCGO){ | ||||
CGOFree(I->selIndicatorsCGO); | CGOFree(I->selIndicatorsCGO); | |||
I->selIndicatorsCGO = NULL; | ||||
} | ||||
if (slot){ | if (slot){ | |||
while(ListIterate(I->Spec, rec, next)) { | while(ListIterate(I->Spec, rec, next)) { | |||
if(rec->type == cExecObject) { | if(rec->type == cExecObject) { | |||
if (SceneGetDrawFlagGrid(G, grid, rec->obj->grid_slot)){ | if (SceneGetDrawFlagGrid(G, grid, rec->obj->grid_slot)){ | |||
if (rec->gridSlotSelIndicatorsCGO){ | ||||
CGOFree(rec->gridSlotSelIndicatorsCGO); | CGOFree(rec->gridSlotSelIndicatorsCGO); | |||
rec->gridSlotSelIndicatorsCGO = NULL; | ||||
} | ||||
} | } | |||
} | } | |||
} | } | |||
} | } | |||
} | } | |||
while(ListIterate(I->Spec, rec, next)) { | while(ListIterate(I->Spec, rec, next)) { | |||
if(rec->type == cExecSelection) { | if(rec->type == cExecSelection) { | |||
if (rec->visible) { | if (rec->visible) { | |||
any_active = true; | any_active = true; | |||
break; | break; | |||
skipping to change at line 8780 | skipping to change at line 8852 | |||
CGO *drawArrayCGO = NULL; | CGO *drawArrayCGO = NULL; | |||
rec1->gridSlotSelIndicatorsCGO = CGONew(G); | rec1->gridSlotSelIndicatorsCGO = CGONew(G); | |||
CGODotwidth(rec1->gridSlotSelIndicatorsCGO, gl_width) ; | CGODotwidth(rec1->gridSlotSelIndicatorsCGO, gl_width) ; | |||
CGOBegin(rec1->gridSlotSelIndicatorsCGO, GL_POINTS); | CGOBegin(rec1->gridSlotSelIndicatorsCGO, GL_POINTS); | |||
ObjectMoleculeRenderSele((ObjectMolecule *) rec1->obj , curState, sele, | ObjectMoleculeRenderSele((ObjectMolecule *) rec1->obj , curState, sele, | |||
vis_only, rec1->gridSlotSelI ndicatorsCGO); | vis_only, rec1->gridSlotSelI ndicatorsCGO); | |||
CGOEnd(rec1->gridSlotSelIndicatorsCGO); | CGOEnd(rec1->gridSlotSelIndicatorsCGO); | |||
CGOStop(rec1->gridSlotSelIndicatorsCGO); | CGOStop(rec1->gridSlotSelIndicatorsCGO); | |||
drawArrayCGO = CGOCombineBeginEnd(rec1->gridSlotSelIn dicatorsCGO, 0); | drawArrayCGO = CGOCombineBeginEnd(rec1->gridSlotSelIn dicatorsCGO, 0); | |||
CGOFree(rec1->gridSlotSelIndicatorsCGO); | CGOFree(rec1->gridSlotSelIndicatorsCGO); | |||
rec1->gridSlotSelIndicatorsCGO = CGOOptimizeToVBONotI ndexed(drawArrayCGO, 0); | rec1->gridSlotSelIndicatorsCGO = CGOOptimizeToVBONotI ndexedNoShader(drawArrayCGO, 0); | |||
CGOFree(drawArrayCGO); | CGOFree(drawArrayCGO); | |||
rec1->gridSlotSelIndicatorsCGO->use_shader = true; | rec1->gridSlotSelIndicatorsCGO->use_shader = true; | |||
ExecutiveRenderIndicatorCGO(G, rec1->gridSlotSelIndic atorsCGO); | ExecutiveRenderIndicatorCGO(G, rec1->gridSlotSelIndic atorsCGO); | |||
} | } | |||
} | } | |||
} else if (rec1->gridSlotSelIndicatorsCGO){ | } else { | |||
CGOFree(rec1->gridSlotSelIndicatorsCGO); | CGOFree(rec1->gridSlotSelIndicatorsCGO); | |||
rec1->gridSlotSelIndicatorsCGO = NULL; | ||||
} | } | |||
} | } | |||
} | } | |||
} | } | |||
if (use_shader){ | if (use_shader){ | |||
if (!slot){ | if (!slot){ | |||
CGO *drawArrayCGO = NULL; | CGO *drawArrayCGO = NULL; | |||
CGOEnd(I->selIndicatorsCGO); | CGOEnd(I->selIndicatorsCGO); | |||
CGOStop(I->selIndicatorsCGO); | CGOStop(I->selIndicatorsCGO); | |||
drawArrayCGO = CGOCombineBeginEnd(I->selIndicatorsCGO, 0); | drawArrayCGO = CGOCombineBeginEnd(I->selIndicatorsCGO, 0); | |||
CGOFree(I->selIndicatorsCGO); | CGOFree(I->selIndicatorsCGO); | |||
I->selIndicatorsCGO = CGOOptimizeToVBONotIndexed(drawArrayCGO , 0); | I->selIndicatorsCGO = CGOOptimizeToVBONotIndexedNoShader(draw ArrayCGO, 0); | |||
CGOFree(drawArrayCGO); | CGOFree(drawArrayCGO); | |||
if (I->selIndicatorsCGO){ | if (I->selIndicatorsCGO){ | |||
I->selIndicatorsCGO->use_shader = true; | I->selIndicatorsCGO->use_shader = true; | |||
return ExecutiveRenderSelections(G, curState, slot, grid); | return ExecutiveRenderSelections(G, curState, slot, grid); | |||
} else | } else | |||
return; | return; | |||
} | } | |||
} else { | } else { | |||
glEnd(); | glEnd(); | |||
} | } | |||
skipping to change at line 9729 | skipping to change at line 9800 | |||
} | } | |||
} | } | |||
/*========================================================================*/ | /*========================================================================*/ | |||
int ExecutiveStereo(PyMOLGlobals * G, int flag) | int ExecutiveStereo(PyMOLGlobals * G, int flag) | |||
{ | { | |||
int ok = 1; | int ok = 1; | |||
int stereo_mode; | int stereo_mode; | |||
switch (flag) { | switch (flag) { | |||
case -3: | ||||
SettingSet(G, cSetting_chromadepth, 1); | ||||
SceneSetStereo(G, 0); | ||||
break; | ||||
case -1: | case -1: | |||
SettingSetGlobal_f(G, cSetting_stereo_shift, -SettingGetGlobal_f(G, cSetting _stereo_shift)); | SettingSetGlobal_f(G, cSetting_stereo_shift, -SettingGetGlobal_f(G, cSetting _stereo_shift)); | |||
break; | break; | |||
default: /* -2 */ | default: /* -2 */ | |||
if(G->HaveGUI) { | SettingSet(G, cSetting_chromadepth, 0); | |||
{ | ||||
stereo_mode = SettingGetGlobal_i(G, cSetting_stereo_mode); | stereo_mode = SettingGetGlobal_i(G, cSetting_stereo_mode); | |||
switch (stereo_mode) { | switch (stereo_mode) { | |||
case 0: /* off */ | case 0: /* off */ | |||
break; | break; | |||
case cStereo_quadbuffer: /* hardware stereo-in-a-window * / | case cStereo_quadbuffer: /* hardware stereo-in-a-window * / | |||
SceneSetStereo(G, flag); | SceneSetStereo(G, flag); | |||
#ifndef _PYMOL_NOPY | #ifndef _PYMOL_NOPY | |||
PSGIStereo(G, flag); /* does this have any effect anymore? */ | PSGIStereo(G, flag); /* does this have any effect anymore? */ | |||
#endif | #endif | |||
break; | break; | |||
default: | default: | |||
SceneSetStereo(G, flag); | SceneSetStereo(G, flag); | |||
break; | break; | |||
} | } | |||
} | } | |||
} | } | |||
// for chromadepth | ||||
G->ShaderMgr->Set_Reload_Bits(RELOAD_VARIABLES); | ||||
SceneDirty(G); | SceneDirty(G); | |||
return (ok); | return (ok); | |||
} | } | |||
/*========================================================================*/ | /*========================================================================*/ | |||
int ExecutiveRevalence(PyMOLGlobals * G, const char *s1, const char *s2, const c har *src, | int ExecutiveRevalence(PyMOLGlobals * G, const char *s1, const char *s2, const c har *src, | |||
int target_state, int source_state, int reset, int quiet) | int target_state, int source_state, int reset, int quiet) | |||
{ | { | |||
/* register CExecutive *I=G->Executive; */ | /* register CExecutive *I=G->Executive; */ | |||
int ok = true; | int ok = true; | |||
skipping to change at line 9927 | skipping to change at line 10007 | |||
ok_except1: | ok_except1: | |||
SelectorFreeTmp(G, sname1); | SelectorFreeTmp(G, sname1); | |||
SelectorFreeTmp(G, sname2); | SelectorFreeTmp(G, sname2); | |||
return ok; | return ok; | |||
} | } | |||
/*========================================================================*/ | /*========================================================================*/ | |||
int ExecutiveAngle(PyMOLGlobals * G, float *result, const char *nam, | int ExecutiveAngle(PyMOLGlobals * G, float *result, const char *nam, | |||
const char *s1, const char *s2, const char *s3, int mode, | const char *s1, const char *s2, const char *s3, int mode, | |||
int labels, int reset, int zoom, int quiet, int state) | int labels, int reset, int zoom, int quiet, int state, | |||
int state1, int state2, int state3) | ||||
{ | { | |||
SelectorTmp tmpsele1(G, s1); | SelectorTmp tmpsele1(G, s1); | |||
SelectorTmp tmpsele2(G, s2); | SelectorTmp tmpsele2(G, s2); | |||
SelectorTmp tmpsele3(G, s3); | SelectorTmp tmpsele3(G, s3); | |||
int sele1 = tmpsele1.getIndex(); | int sele1 = tmpsele1.getIndex(); | |||
int sele2 = (WordMatchExact(G, s2, cKeywordSame, true)) ? sele1 : tmpsele2.get Index(); | int sele2 = (WordMatchExact(G, s2, cKeywordSame, true)) ? sele1 : tmpsele2.get Index(); | |||
int sele3 = (WordMatchExact(G, s3, cKeywordSame, true)) ? sele2 : tmpsele3.get Index(); | int sele3 = (WordMatchExact(G, s3, cKeywordSame, true)) ? sele2 : tmpsele3.get Index(); | |||
ObjectDist *obj; | ObjectDist *obj; | |||
CObject *anyObj = NULL; | CObject *anyObj = NULL; | |||
skipping to change at line 9951 | skipping to change at line 10032 | |||
anyObj = ExecutiveFindObjectByName(G, nam); | anyObj = ExecutiveFindObjectByName(G, nam); | |||
if(anyObj) { | if(anyObj) { | |||
if(anyObj->type != cObjectMeasurement) { | if(anyObj->type != cObjectMeasurement) { | |||
ExecutiveDelete(G, nam); | ExecutiveDelete(G, nam); | |||
anyObj = NULL; | anyObj = NULL; | |||
} | } | |||
} | } | |||
obj = ObjectDistNewFromAngleSele(G, (ObjectDist *) anyObj, | obj = ObjectDistNewFromAngleSele(G, (ObjectDist *) anyObj, | |||
sele1, sele2, sele3, | sele1, sele2, sele3, | |||
mode, labels, result, reset, state); | mode, labels, result, reset, state, | |||
state1, state2, state3); | ||||
if(!obj) { | if(!obj) { | |||
if(!quiet) | if(!quiet) | |||
ErrMessage(G, "ExecutiveAngle", "No angles found."); | ErrMessage(G, "ExecutiveAngle", "No angles found."); | |||
} else { | } else { | |||
*result = rad_to_deg(*result); | *result = rad_to_deg(*result); | |||
if(!anyObj) { | if(!anyObj) { | |||
ObjectSetName((CObject *) obj, nam); | ObjectSetName((CObject *) obj, nam); | |||
ExecutiveManageObject(G, (CObject *) obj, zoom, quiet); | ExecutiveManageObject(G, (CObject *) obj, zoom, quiet); | |||
ExecutiveSetRepVisib(G, nam, cRepLine, 1); | ExecutiveSetRepVisib(G, nam, cRepLine, 1); | |||
if(!labels) | if(!labels) | |||
skipping to change at line 10049 | skipping to change at line 10131 | |||
* Create a distance measurement object | * Create a distance measurement object | |||
* | * | |||
* result: output pointer for measured distance in Angstrom | * result: output pointer for measured distance in Angstrom | |||
* nam: name of measurement object to create or add to | * nam: name of measurement object to create or add to | |||
* s1: selection expression | * s1: selection expression | |||
* s2: selection expression or "same" keyword (shortcut for s1 = s2) | * s2: selection expression or "same" keyword (shortcut for s1 = s2) | |||
* mode: 0 (any), 1 (bonds), 2 (hbonds), 3 (distance_exclusion), 4 (centroids) | * mode: 0 (any), 1 (bonds), 2 (hbonds), 3 (distance_exclusion), 4 (centroids) | |||
*/ | */ | |||
int ExecutiveDist(PyMOLGlobals * G, float *result, const char *nam, | int ExecutiveDist(PyMOLGlobals * G, float *result, const char *nam, | |||
const char *s1, const char *s2, int mode, float cutoff, | const char *s1, const char *s2, int mode, float cutoff, | |||
int labels, int quiet, int reset, int state, int zoom) | int labels, int quiet, int reset, int state, int zoom, | |||
int state1, int state2) | ||||
{ | { | |||
SelectorTmp tmpsele1(G, s1); | SelectorTmp tmpsele1(G, s1); | |||
SelectorTmp tmpsele2(G, s2); | SelectorTmp tmpsele2(G, s2); | |||
int sele1 = tmpsele1.getIndex(); | int sele1 = tmpsele1.getIndex(); | |||
int sele2 = (WordMatchExact(G, s2, cKeywordSame, true)) ? sele1 : tmpsele2.get Index(); | int sele2 = (WordMatchExact(G, s2, cKeywordSame, true)) ? sele1 : tmpsele2.get Index(); | |||
ObjectDist *obj; | ObjectDist *obj; | |||
CObject *anyObj = NULL; | CObject *anyObj = NULL; | |||
*result = -1.0F; | *result = -1.0F; | |||
/* if the distance 'name' we provided exists, overwrite it, by deleting it by its base class */ | /* if the distance 'name' we provided exists, overwrite it, by deleting it by its base class */ | |||
if((sele1 >= 0) && (sele2 >= 0)) { | if((sele1 >= 0) && (sele2 >= 0)) { | |||
anyObj = ExecutiveFindObjectByName(G, nam); | anyObj = ExecutiveFindObjectByName(G, nam); | |||
if(anyObj) | if(anyObj) | |||
if(reset || anyObj->type != cObjectMeasurement) { | if(reset || anyObj->type != cObjectMeasurement) { | |||
ExecutiveDelete(G, nam); | ExecutiveDelete(G, nam); | |||
anyObj = NULL; | anyObj = NULL; | |||
} | } | |||
/* create a new distance from the two selections */ | /* create a new distance from the two selections */ | |||
obj = ObjectDistNewFromSele(G, (ObjectDist *) anyObj, | obj = ObjectDistNewFromSele(G, (ObjectDist *) anyObj, | |||
sele1, sele2, mode, cutoff, labels, reset, resul | sele1, sele2, mode, cutoff, labels, reset, resul | |||
t, state); | t, state, | |||
state1, state2); | ||||
/* could insert obj into sele1's mol's object's DistList and sele2's mol's o bject's DistList */ | /* could insert obj into sele1's mol's object's DistList and sele2's mol's o bject's DistList */ | |||
/* if the distance was created, add it to the object list and manage it | /* if the distance was created, add it to the object list and manage it | |||
* otherwise, complain and do nothing */ | * otherwise, complain and do nothing */ | |||
if(!obj) { | if(!obj) { | |||
if(!quiet) | if(!quiet) | |||
ErrMessage(G, "ExecutiveDistance", "No such distances found."); | ErrMessage(G, "ExecutiveDistance", "No such distances found."); | |||
} else { | } else { | |||
ObjectSetName((CObject *) obj, nam); | ObjectSetName((CObject *) obj, nam); | |||
ExecutiveManageObject(G, (CObject *) obj, zoom, quiet); | ExecutiveManageObject(G, (CObject *) obj, zoom, quiet); | |||
ExecutiveSetRepVisib(G, nam, cRepLine, 1); | ExecutiveSetRepVisib(G, nam, cRepLine, 1); | |||
skipping to change at line 10188 | skipping to change at line 10272 | |||
} else if(obj->type != cObjectAlignment) { | } else if(obj->type != cObjectAlignment) { | |||
ErrMessage(G, " Executive", "invalid object type."); | ErrMessage(G, " Executive", "invalid object type."); | |||
} else { | } else { | |||
ObjectAlignmentAsStrVLA(G, (ObjectAlignment *) obj, state, format, &result ); | ObjectAlignmentAsStrVLA(G, (ObjectAlignment *) obj, state, format, &result ); | |||
} | } | |||
} | } | |||
return (result); | return (result); | |||
} | } | |||
/*========================================================================*/ | /*========================================================================*/ | |||
#ifndef _PYMOL_NOPY | ||||
// obsolete by MoleculeExporter | ||||
char *ExecutiveSeleToPDBStr(PyMOLGlobals * G, const char *s1, int state, int con | ||||
ectFlag, | ||||
int mode, const char *ref_object, int ref_state, | ||||
ObjectMolecule * single_object, int quiet) | ||||
{ | ||||
char *result = NULL; | ||||
ObjectMoleculeOpRec op1; | ||||
int sele1; | ||||
char end_str[] = "END\n"; | ||||
int model_count = 1; | ||||
int actual_state = 0; | ||||
int n_state = 1; | ||||
int a; | ||||
char model_record[50]; | ||||
int count = 0, *counter = NULL; | ||||
double matrix[16], inverse[16], *ref_mat = NULL; | ||||
CObject *base = NULL; | ||||
PDBInfoRec pdb_info; | ||||
ObjectMolecule *obj = NULL; | ||||
if(ref_object) { | ||||
base = ExecutiveFindObjectByName(G, ref_object); | ||||
if(base) { | ||||
if(ref_state < -1) { | ||||
ref_state = state; | ||||
} | ||||
if(ref_state < 0) { | ||||
ref_state = ObjectGetCurrentState(base, true); | ||||
} | ||||
if(ObjectGetTotalMatrix(base, ref_state, true, matrix)) { | ||||
invert_special44d44d(matrix, inverse); | ||||
ref_mat = inverse; | ||||
} | ||||
} | ||||
} | ||||
UtilZeroMem((void *) &pdb_info, sizeof(PDBInfoRec)); | ||||
ObjectMoleculeOpRecInit(&op1); | ||||
sele1 = SelectorIndexByName(G, s1); | ||||
if(sele1 >= 0) { | ||||
if(!single_object) | ||||
obj = SelectorGetSingleObjectMolecule(G, sele1); | ||||
else | ||||
obj = single_object; | ||||
if(obj) | ||||
if(obj->DiscreteFlag) { | ||||
counter = &count; /* discrete objects need atom counters between s | ||||
tates */ | ||||
} | ||||
} | ||||
op1.i2 = 0; | ||||
op1.charVLA = VLAlloc(char, 10000); | ||||
if(state == -1) { /* multimodel PDB */ | ||||
n_state = ExecutiveCountStates(G, s1); | ||||
sprintf(model_record, "NUMMDL %-4d\n", n_state); | ||||
{ | ||||
ov_size len = op1.i2; | ||||
UtilConcatVLA(&op1.charVLA, &len, model_record); | ||||
op1.i2 = len; | ||||
} | ||||
} | ||||
if(mode == 1) { | ||||
pdb_info.variant = PDB_VARIANT_PQR; | ||||
pdb_info.pqr_workarounds = SettingGetGlobal_b(G, cSetting_pqr_workarounds); | ||||
} | ||||
for(a = 0; a < n_state; a++) { | ||||
switch (state) { | ||||
case -1: /* multimodel */ | ||||
sprintf(model_record, "MODEL %4d\n", model_count++); | ||||
{ | ||||
ov_size len = op1.i2; | ||||
UtilConcatVLA(&op1.charVLA, &len, model_record); | ||||
op1.i2 = len; | ||||
} | ||||
actual_state = a; | ||||
break; | ||||
case -2: /* single state */ | ||||
actual_state = SceneGetState(G); | ||||
if((actual_state != 0) && (sele1 >= 0) | ||||
&& SettingGetGlobal_b(G, cSetting_static_singletons)) { | ||||
if(SelectorCountStates(G, sele1) == 1) { | ||||
actual_state = 0; | ||||
} | ||||
} | ||||
break; | ||||
default: | ||||
actual_state = state; | ||||
break; | ||||
} | ||||
if(conectFlag) { | ||||
op1.i2 = SelectorGetPDB(G, &op1.charVLA, op1.i2, sele1, | ||||
actual_state, conectFlag, &pdb_info, counter, ref_ | ||||
mat, | ||||
single_object); | ||||
} else { | ||||
op1.i3 = 0; /* atIndex */ | ||||
if(sele1 >= 0) { | ||||
op1.code = OMOP_PDB1; | ||||
op1.i1 = actual_state; | ||||
ExecutiveObjMolSeleOp(G, sele1, &op1); | ||||
} | ||||
} | ||||
switch (state) { | ||||
case -1: | ||||
{ | ||||
ov_size len = op1.i2; | ||||
UtilConcatVLA(&op1.charVLA, &len, "ENDMDL\n"); | ||||
op1.i2 = len; | ||||
} | ||||
break; | ||||
} | ||||
} | ||||
if((!(SettingGetGlobal_i(G, cSetting_pdb_no_end_record))) | ||||
&& !(pdb_info.is_pqr_file())) | ||||
/* terminate with END */ | ||||
{ | ||||
ov_size len = op1.i2; | ||||
UtilConcatVLA(&op1.charVLA, &len, end_str); | ||||
op1.i2 = len; | ||||
} | ||||
/* terminate (just in case) */ | ||||
VLACheck(op1.charVLA, char, op1.i2 + 1); | ||||
op1.charVLA[op1.i2] = 0; | ||||
op1.i2++; | ||||
result = Alloc(char, op1.i2); | ||||
memcpy(result, op1.charVLA, op1.i2); | ||||
VLAFreeP(op1.charVLA); | ||||
return (result); | ||||
} | ||||
#endif | ||||
/*========================================================================*/ | ||||
int ExecutiveSeleToObject(PyMOLGlobals * G, const char *name, const char *s1, | int ExecutiveSeleToObject(PyMOLGlobals * G, const char *name, const char *s1, | |||
int source, int target, | int source, int target, | |||
int discrete, int zoom, int quiet, int singletons, int copy_properties) | int discrete, int zoom, int quiet, int singletons, int copy_properties) | |||
{ | { | |||
SelectorTmp tmpsele1(G, s1); | SelectorTmp tmpsele1(G, s1); | |||
int sele1 = tmpsele1.getIndex(); | int sele1 = tmpsele1.getIndex(); | |||
int ok = false; | int ok = false; | |||
ObjectNameType valid_name; | ObjectNameType valid_name; | |||
skipping to change at line 10864 | skipping to change at line 10808 | |||
#ifdef _WEBGL | #ifdef _WEBGL | |||
#else | #else | |||
op1.s1 = expr; | op1.s1 = expr; | |||
op1.py_ob1 = space; | op1.py_ob1 = space; | |||
#endif | #endif | |||
op1.i2 = state; | op1.i2 = state; | |||
op1.i3 = read_only; | op1.i3 = read_only; | |||
op1.i4 = atomic_props; | op1.i4 = atomic_props; | |||
ExecutiveObjMolSeleOp(G, sele1, &op1); | ExecutiveObjMolSeleOp(G, sele1, &op1); | |||
} | } | |||
if(!read_only) { | ||||
#ifndef _PYMOL_NO_UNDO | ||||
#endif | ||||
// for dynamic_measures | ||||
ExecutiveUpdateCoordDepends(G, NULL); | ||||
} | ||||
if(!quiet) { | if(!quiet) { | |||
if(!read_only) { | if(!read_only) { | |||
PRINTFB(G, FB_Executive, FB_Actions) | PRINTFB(G, FB_Executive, FB_Actions) | |||
" AlterState: modified %i atom coordinate states.\n", op1.i1 ENDFB(G); | " AlterState: modified %i atom coordinate states.\n", op1.i1 ENDFB(G); | |||
} else { | } else { | |||
PRINTFB(G, FB_Executive, FB_Actions) | PRINTFB(G, FB_Executive, FB_Actions) | |||
" IterateState: iterated over %i atom coordinate states.\n", op1.i1 EN DFB(G); | " IterateState: iterated over %i atom coordinate states.\n", op1.i1 EN DFB(G); | |||
} | } | |||
} | } | |||
return op1.i1; | return op1.i1; | |||
skipping to change at line 11941 | skipping to change at line 11891 | |||
if((mode == 0) && G->HaveGUI && SettingGetGlobal_b(G, cSetting_auto_copy_image s)) { | if((mode == 0) && G->HaveGUI && SettingGetGlobal_b(G, cSetting_auto_copy_image s)) { | |||
/* force deferred behavior if copying image to clipboard */ | /* force deferred behavior if copying image to clipboard */ | |||
defer = 1; | defer = 1; | |||
} | } | |||
ExecutiveUpdateSceneMembers(G); | ExecutiveUpdateSceneMembers(G); | |||
if(defer && (mode == 0)) { | if(defer && (mode == 0)) { | |||
SceneDeferRay(G, width, height, mode, angle, shift, quiet, true, antialias); | SceneDeferRay(G, width, height, mode, angle, shift, quiet, true, antialias); | |||
} else { | } else { | |||
SceneDoRay(G, width, height, mode, NULL, NULL, angle, shift, quiet, NULL, tr ue, | SceneRay(G, width, height, mode, NULL, NULL, angle, shift, quiet, NULL, true , | |||
antialias); | antialias); | |||
} | } | |||
return 1; | return 1; | |||
} | } | |||
/*========================================================================*/ | /*========================================================================*/ | |||
int *ExecutiveGetG3d(PyMOLGlobals * G) | int *ExecutiveGetG3d(PyMOLGlobals * G) | |||
{ | { | |||
int *result = NULL; | int *result = NULL; | |||
SceneRay(G, 0, 0, 3, NULL, NULL, 0.0F, 0.0F, true, (G3dPrimitive **) (void *) &result, | SceneRay(G, 0, 0, 3, NULL, NULL, 0.0F, 0.0F, true, (G3dPrimitive **) (void *) &result, | |||
skipping to change at line 12319 | skipping to change at line 12269 | |||
for(; bi != bi_end; ++bi) { | for(; bi != bi_end; ++bi) { | |||
if(!bi->has_setting) | if(!bi->has_setting) | |||
continue; | continue; | |||
ai1 = ai + bi->index[0]; | ai1 = ai + bi->index[0]; | |||
ai2 = ai + bi->index[1]; | ai2 = ai + bi->index[1]; | |||
if((SelectorIsMember(G, ai1->selEntry, sele1) && | if((SelectorIsMember(G, ai1->selEntry, sele1) && | |||
SelectorIsMember(G, ai2->selEntry, sele2)) || | SelectorIsMember(G, ai2->selEntry, sele2)) || | |||
(SelectorIsMember(G, ai2->selEntry, sele1) && | (SelectorIsMember(G, ai2->selEntry, sele1) && | |||
SelectorIsMember(G, ai1->selEntry, sele2))) { | SelectorIsMember(G, ai1->selEntry, sele2))) { | |||
int uid = AtomInfoCheckUniqueBondID(G, bi); | int uid = AtomInfoCheckUniqueBondID(G, bi); | |||
if(!SettingUniqueSetTypedValue(G, uid, index, cSetting_blank, NULL )) | if(!SettingUniqueUnset(G, uid, index)) | |||
continue; | continue; | |||
if(updates) | if(updates) | |||
side_effects = true; | side_effects = true; | |||
nSet++; | nSet++; | |||
} | } | |||
} | } | |||
if(nSet && !quiet) { | if(nSet && !quiet) { | |||
SettingGetName(G, index, name); | SettingGetName(G, index, name); | |||
PRINTF | PRINTF | |||
" Setting: %s unset for %d bonds in object \"%s\".\n", | " Setting: %s unset for %d bonds in object \"%s\".\n", | |||
skipping to change at line 12466 | skipping to change at line 12416 | |||
case cSetting_int: | case cSetting_int: | |||
*(op.ii1) = PyInt_AsLong(value); | *(op.ii1) = PyInt_AsLong(value); | |||
op.i2 = cSetting_int; | op.i2 = cSetting_int; | |||
have_atomic_value = true; | have_atomic_value = true; | |||
break; | break; | |||
case cSetting_float: | case cSetting_float: | |||
*(float *) op.ii1 = (float) PyFloat_AsDouble(value); | *(float *) op.ii1 = (float) PyFloat_AsDouble(value); | |||
op.i2 = cSetting_float; | op.i2 = cSetting_float; | |||
have_atomic_value = true; | have_atomic_value = true; | |||
break; | break; | |||
case cSetting_float3: | ||||
{ | ||||
PConvPyListOrTupleToFloatArrayInPlace(value, op.ttt, 3); | ||||
op.mat1 = op.ttt; // for passing (float**) | ||||
op.ii1 = (int*) &op.mat1; | ||||
op.i2 = cSetting_float3; | ||||
have_atomic_value = true; | ||||
} | ||||
break; | ||||
case cSetting_color: | case cSetting_color: | |||
{ | { | |||
int color_index = | int color_index = | |||
ColorGetIndex(G, PyString_AsString(value)); | ColorGetIndex(G, PyString_AsString(value)); | |||
if((color_index < 0) && (color_index > cColorExtCutoff)) { | if((color_index < 0) && (color_index > cColorExtCutoff)) { | |||
switch (color_index) { | switch (color_index) { | |||
case cColorAtomic: | case cColorAtomic: | |||
color_index = -1; | color_index = -1; | |||
break; | break; | |||
case cColorFront: | case cColorFront: | |||
skipping to change at line 15129 | skipping to change at line 15088 | |||
int pass = false; | int pass = false; | |||
int skip; | int skip; | |||
int ExecLineHeight = DIP2PIXEL(SettingGetGlobal_i(G, cSetting_internal_gui_con trol_size)); | int ExecLineHeight = DIP2PIXEL(SettingGetGlobal_i(G, cSetting_internal_gui_con trol_size)); | |||
int hide_underscore = SettingGetGlobal_b(G, cSetting_hide_underscore_names); | int hide_underscore = SettingGetGlobal_b(G, cSetting_hide_underscore_names); | |||
int op_cnt = get_op_cnt(G); | int op_cnt = get_op_cnt(G); | |||
if(y < I->HowFarDown) { | if(y < I->HowFarDown) { | |||
if(SettingGetGlobal_b(G, cSetting_internal_gui_mode) == 1) | if(SettingGetGlobal_b(G, cSetting_internal_gui_mode) == 1) | |||
return SceneDeferClick(SceneGetBlock(G), button, x, y, mod); | return SceneDeferClick(SceneGetBlock(G), button, x, y, mod); | |||
} | } | |||
switch(button) { | ||||
case P_GLUT_BUTTON_SCROLL_FORWARD: | ||||
ScrollBarMoveBy(I->ScrollBar, -1); | ||||
return 1; | ||||
case P_GLUT_BUTTON_SCROLL_BACKWARD: | ||||
ScrollBarMoveBy(I->ScrollBar, 1); | ||||
return 1; | ||||
} | ||||
n = ((I->Block->rect.top - y) - (ExecTopMargin + ExecClickMargin)) / ExecLineH eight; | n = ((I->Block->rect.top - y) - (ExecTopMargin + ExecClickMargin)) / ExecLineH eight; | |||
a = n; | a = n; | |||
xx = (x - I->Block->rect.left); | xx = (x - I->Block->rect.left); | |||
if(I->ScrollBarActive) { | if(I->ScrollBarActive) { | |||
if((x - I->Block->rect.left) < | if((x - I->Block->rect.left) < | |||
(ExecScrollBarWidth + ExecScrollBarMargin + ExecToggleMargin)) { | (ExecScrollBarWidth + ExecScrollBarMargin + ExecToggleMargin)) { | |||
pass = 1; | pass = 1; | |||
ScrollBarDoClick(I->ScrollBar, button, x, y, mod); | ScrollBarDoClick(I->ScrollBar, button, x, y, mod); | |||
} | } | |||
xx -= (ExecScrollBarWidth + ExecScrollBarMargin); | xx -= (ExecScrollBarWidth + ExecScrollBarMargin); | |||
skipping to change at line 16503 | skipping to change at line 16472 | |||
c = rec->obj->fGetCaption(rec->obj, ch, WordLength); | c = rec->obj->fGetCaption(rec->obj, ch, WordLength); | |||
} | } | |||
/* now print the caption */ | /* now print the caption */ | |||
if(c && c[0] && nChar > 1 && strcmp(c, rec->obj->Name) != 0) { | if(c && c[0] && nChar > 1 && strcmp(c, rec->obj->Name) != 0) { | |||
TextSetColor(G, captionColor); | TextSetColor(G, captionColor); | |||
TextSetPos2i(G, x + DIP2PIXEL(2) + DIP2PIXEL(8) * (max_char - nC har), y2 + text_lift); | TextSetPos2i(G, x + DIP2PIXEL(2) + DIP2PIXEL(8) * (max_char - nC har), y2 + text_lift); | |||
if((nChar--) > 0) | if((nChar--) > 0) | |||
TextDrawChar(G, ' ' ORTHOCGOARGVAR); | TextDrawChar(G, ' ' ORTHOCGOARGVAR); | |||
while(*c && nChar > 0) { | while(*c && nChar > 0) { | |||
/* allow color encoding for names */ | /* allow color encoding for names */ | |||
if((*c == '\\') && (*(c + 1)) && (*(c + 2)) && (*(c + 3))) { | if(TextSetColorFromCode(G, c, captionColor)) { | |||
TextSetColor3f(G, (*(c + 1) - '0') / 9.0F, (*(c + 2) - '0') | ||||
/ 9.0F, | ||||
(*(c + 3) - '0') / 9.0F); | ||||
c += 4; | c += 4; | |||
} else { | } else { | |||
TextDrawChar(G, *(c++) ORTHOCGOARGVAR); | TextDrawChar(G, *(c++) ORTHOCGOARGVAR); | |||
--nChar; | --nChar; | |||
} | } | |||
} | } | |||
} | } | |||
} | } | |||
} | } | |||
skipping to change at line 16590 | skipping to change at line 16557 | |||
if(pattern && (!pattern[0])) | if(pattern && (!pattern[0])) | |||
pattern = NULL; | pattern = NULL; | |||
if(!pattern) { | if(!pattern) { | |||
switch (what) { | switch (what) { | |||
case 0: /* everything */ | case 0: /* everything */ | |||
ExecutiveDelete(G, cKeywordAll); | ExecutiveDelete(G, cKeywordAll); | |||
ColorReset(G); | ColorReset(G); | |||
SettingInitGlobal(G, false, false, true); | SettingInitGlobal(G, false, false, true); | |||
ColorUpdateFrontFromSettings(G); | ||||
MovieReset(G); | MovieReset(G); | |||
EditorInactivate(G); | EditorInactivate(G); | |||
ControlRock(G, 0); | ControlRock(G, 0); | |||
OrthoReshape(G, -1, -1, false); | OrthoReshape(G, -1, -1, false); | |||
MovieScenesInit(G); | MovieScenesInit(G); | |||
#ifndef _PYMOL_NOPY | #ifndef _PYMOL_NOPY | |||
blocked = PAutoBlock(G); | blocked = PAutoBlock(G); | |||
PRunStringInstance(G, "cmd.view('*','clear')"); | PRunStringInstance(G, "cmd.view('*','clear')"); | |||
PRunStringInstance(G, "cmd.config_mouse(\"three_button\")"); | PRunStringInstance(G, "cmd.config_mouse(\"three_button\")"); | |||
End of changes. 46 change blocks. | ||||
196 lines changed or deleted | 158 lines changed or added |