"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "layer3/Executive.cpp" between
pymol-v1.8.6.0.tar.bz2 and pymol-v2.1.0.tar.bz2

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.

Executive.cpp  (pymol-v1.8.6.0.tar.bz2):Executive.cpp  (pymol-v2.1.0.tar.bz2)
skipping to change at line 24 skipping to change at line 24
Z* ------------------------------------------------------------------- Z* -------------------------------------------------------------------
*/ */
#include"os_python.h" #include"os_python.h"
#include"os_predef.h" #include"os_predef.h"
#include"os_std.h" #include"os_std.h"
#include"os_gl.h" #include"os_gl.h"
#include <set> #include <set>
#include <algorithm> #include <algorithm>
#include <map> #include <map>
#include <clocale>
#include"Version.h" #include"Version.h"
#include"main.h" #include"main.h"
#include"Base.h" #include"Base.h"
#include"OOMac.h" #include"OOMac.h"
#include"Executive.h" #include"Executive.h"
#include"SpecRec.h"
#include"ObjectMesh.h" #include"ObjectMesh.h"
#include"ObjectDist.h" #include"ObjectDist.h"
#include"ObjectSurface.h" #include"ObjectSurface.h"
#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"
skipping to change at line 102 skipping to change at line 104
#endif #endif
#define cExecObject 0 #define cExecObject 0
#define cExecSelection 1 #define cExecSelection 1
#define cExecAll 2 #define cExecAll 2
#define cTempRectSele "_rect" #define cTempRectSele "_rect"
#define cLeftButSele "lb" #define cLeftButSele "lb"
#define cIndicateSele "indicate" #define cIndicateSele "indicate"
/*
* Specification record (a row in the object menu panel)
*/
class SpecRec {
public:
/* NOTE: must zero-init with CALLOC */
int type;
WordType name; /*only used for selections */
CObject *obj;
SpecRec *next;
int visible; /* This is actually when object is "Enabled", not visi
ble */
ObjectNameType group_name;
/* not pickled */
int sele_color;
int hilight; /* 0 = none, 1 = name, 2 = group control (if any
) */
int previous;
int cand_id;
SpecRec *group;
int group_member_list_id;
int in_scene, is_hidden;
int in_panel;
int grid_slot;
CGO *gridSlotSelIndicatorsCGO;
};
typedef struct PanelRec { typedef struct PanelRec {
SpecRec *spec; SpecRec *spec;
int nest_level; int nest_level;
int is_group; int is_group;
int is_open; int is_open;
struct PanelRec *next; struct PanelRec *next;
} PanelRec; } PanelRec;
typedef struct { typedef struct {
int list_id; int list_id;
skipping to change at line 199 skipping to change at line 174
ExecutiveSculptDeactivate ExecutiveSculptDeactivate
ExecutiveRenameObjectAtoms ExecutiveRenameObjectAtoms
ExecutiveSpheroid ExecutiveSpheroid
*/ */
static int ExecutiveGetNamesListFromPattern(PyMOLGlobals * G, const char *name, static int ExecutiveGetNamesListFromPattern(PyMOLGlobals * G, const char *name,
int allow_partial, int expand_groups ); int allow_partial, int expand_groups );
static void ExecutiveSpecEnable(PyMOLGlobals * G, SpecRec * rec, int parents, in t log); static void ExecutiveSpecEnable(PyMOLGlobals * G, SpecRec * rec, int parents, in t log);
static void ExecutiveSetAllRepVisib(PyMOLGlobals * G, int rep, int state); static void ExecutiveSetAllRepVisMask(PyMOLGlobals * G, int repmask, int state);
static SpecRec *ExecutiveFindSpec(PyMOLGlobals * G, const char *name); static SpecRec *ExecutiveFindSpec(PyMOLGlobals * G, const char *name);
static int ExecutiveDrag(Block * block, int x, int y, int mod); static int ExecutiveDrag(Block * block, int x, int y, int mod);
static void ExecutiveSpecSetVisibility(PyMOLGlobals * G, SpecRec * rec, static void ExecutiveSpecSetVisibility(PyMOLGlobals * G, SpecRec * rec,
int new_vis, int mod, int parents); int new_vis, int mod, int parents);
static int ExecutiveSetObjectMatrix2(PyMOLGlobals * G, CObject * obj, int state, static int ExecutiveSetObjectMatrix2(PyMOLGlobals * G, CObject * obj, int state,
double *matrix); double *matrix);
static int ExecutiveGetObjectMatrix2(PyMOLGlobals * G, CObject * obj, int state, static int ExecutiveGetObjectMatrix2(PyMOLGlobals * G, CObject * obj, int state,
double **matrix, int incl_ttt); double **matrix, int incl_ttt);
int ExecutiveTransformObjectSelection2(PyMOLGlobals * G, CObject * obj, int stat e, int ExecutiveTransformObjectSelection2(PyMOLGlobals * G, CObject * obj, int stat e,
const char *s1, int log, float *matrix, i nt homogenous, const char *s1, int log, float *matrix, i nt homogenous,
skipping to change at line 237 skipping to change at line 212
if (rec->type != cExecObject) if (rec->type != cExecObject)
return next(); return next();
return true; return true;
} }
CObject * ObjectIterator::getObject() { CObject * ObjectIterator::getObject() {
return rec->obj; return rec->obj;
} }
/*
* True if `rec` and all its parent groups are enabled
*/
static bool SpecRecIsEnabled(const SpecRec * rec) {
while (rec->visible && (rec = rec->group)) {}
return !rec;
}
/* ======================================================= */ /* ======================================================= */
static void ReportEnabledChange(PyMOLGlobals * G, SpecRec *rec){ static void ReportEnabledChange(PyMOLGlobals * G, SpecRec *rec){
#ifdef _PYMOL_LIB #ifdef _PYMOL_LIB
if (G->CallbackObject && G->enabledCallback){ if (G->CallbackObject && G->enabledCallback){
G->enabledCallback(G->CallbackObject, rec->name, rec->visible); G->enabledCallback(G->CallbackObject, rec->name, rec->visible);
} }
#endif #endif
OrthoInvalidateDoDraw(G); OrthoInvalidateDoDraw(G);
ExecutiveInvalidateSelectionIndicatorsCGO(G); ExecutiveInvalidateSelectionIndicatorsCGO(G);
skipping to change at line 2012 skipping to change at line 1995
CWordMatchOptions options; CWordMatchOptions options;
CTracker *I_Tracker = I->Tracker; CTracker *I_Tracker = I->Tracker;
const char *wildcard = SettingGetGlobal_s(G, cSetting_wildcard); const char *wildcard = SettingGetGlobal_s(G, cSetting_wildcard);
int iter_id = TrackerNewIter(I_Tracker, 0, I->all_names_list_id); int iter_id = TrackerNewIter(I_Tracker, 0, I->all_names_list_id);
int cand_id; int cand_id;
int group_found = false; int group_found = false;
SpecRec *rec; SpecRec *rec;
if (!name) if (!name)
return -1; return -1;
// sanity check: name patterns are not object selections, bail if
// parenthesis or operators in pattern
if (strchr(name, '(') || strchr(name, ')') || strchr(name, '|')) {
PRINTFB(G, FB_Executive, FB_Errors)
" Names-Pattern-Error: Pattern looks like an atom selection"
" (has parenthesis or operators), this is not supported for"
" object name patterns.\n" ENDFB(G);
return -1;
}
// special case: allow "not ..."
bool match_not = false;
if (WordMatchNoWild(G, "not ", name, false)) {
match_not = true;
name += 4;
} else if (name[0] == '!') {
match_not = true;
name += 1;
}
// skip whitespace
while (name[0] == ' ') {
++name;
}
bool match_enabled = WordMatchExact(G, "enabled", name, false);
// ignore % and ? prefixes // ignore % and ? prefixes
while(name[0] && (name[0] == '%' || name[0] == '?')) while(name[0] && (name[0] == '%' || name[0] == '?'))
name++; name++;
WordMatchOptionsConfigNameList(&options, WordMatchOptionsConfigNameList(&options,
*wildcard, SettingGetGlobal_b(G, cSetting_ignor e_case)); *wildcard, SettingGetGlobal_b(G, cSetting_ignor e_case));
matcher = WordMatcherNew(G, name, &options, false); matcher = WordMatcherNew(G, name, &options, /* force= */ match_not);
if(matcher) { if(matcher || match_enabled) {
if(iter_id) { if(iter_id) {
while((cand_id = TrackerIterNextCandInList(I_Tracker, iter_id, while((cand_id = TrackerIterNextCandInList(I_Tracker, iter_id,
(TrackerRef **) (void *) &rec)) ) { (TrackerRef **) (void *) &rec)) ) {
if(rec && !(rec->type == cExecAll)) { if(rec && !(rec->type == cExecAll)) {
if(WordMatcherMatchAlpha(matcher, rec->name)) { bool test = match_enabled ? SpecRecIsEnabled(rec) :
WordMatcherMatchAlpha(matcher, rec->name);
if(test ^ match_not) {
if((rec->type == cExecObject) && (rec->obj->type == cObjectGroup)) if((rec->type == cExecObject) && (rec->obj->type == cObjectGroup))
group_found = true; group_found = true;
if(!result) if(!result)
result = TrackerNewList(I_Tracker, NULL); result = TrackerNewList(I_Tracker, NULL);
if(result) { if(result) {
TrackerLink(I_Tracker, cand_id, result, 1); TrackerLink(I_Tracker, cand_id, result, 1);
} }
} }
} }
} }
skipping to change at line 3156 skipping to change at line 3169
op.obj1VLA = (ObjectMolecule **) VLAlloc(ObjectMolecule *, 10); op.obj1VLA = (ObjectMolecule **) VLAlloc(ObjectMolecule *, 10);
op.i1 = 0; op.i1 = 0;
ExecutiveObjMolSeleOp(G, s1, &op); ExecutiveObjMolSeleOp(G, s1, &op);
result = (ObjectMolecule **) op.obj1VLA; result = (ObjectMolecule **) op.obj1VLA;
VLASize(result, ObjectMolecule *, op.i1); VLASize(result, ObjectMolecule *, op.i1);
} }
return result; return result;
} }
/* #define ExecLineHeight 18 */ /* #define ExecLineHeight 18 */
#define ExecClickMargin 2 #define ExecClickMargin DIP2PIXEL(2)
#define ExecTopMargin 0 #define ExecTopMargin 0
#define ExecToggleMargin 2 #define ExecToggleMargin DIP2PIXEL(2)
#define ExecLeftMargin 1 #define ExecLeftMargin DIP2PIXEL(1)
#define ExecRightMargin 0 #define ExecRightMargin 0
#define ExecToggleWidth 17 #define ExecToggleWidth DIP2PIXEL(17)
#define ExecToggleSize 16 #define ExecToggleSize DIP2PIXEL(16)
#define ExecToggleTextShift 4 #define ExecToggleTextShift DIP2PIXEL(4)
typedef struct { typedef struct {
M4XAnnoType m4x; M4XAnnoType m4x;
ObjectMolecule *obj; ObjectMolecule *obj;
} ProcPDBRec; } ProcPDBRec;
int ExecutiveSetDrag(PyMOLGlobals * G, const char *name, int quiet,int mode) int ExecutiveSetDrag(PyMOLGlobals * G, const char *name, int quiet,int mode)
{ {
char drag_name[] = cEditorDrag; char drag_name[] = cEditorDrag;
int set_flag = false; int set_flag = false;
skipping to change at line 3560 skipping to change at line 3573
* atom_props: names of atom properties to load * atom_props: names of atom properties to load
*/ */
int ExecutiveLoad(PyMOLGlobals * G, int ExecutiveLoad(PyMOLGlobals * G,
const char *content, int content_length, const char *content, int content_length,
int content_format, int content_format,
const char *object_name_proposed, const char *object_name_proposed,
int state, int zoom, int state, int zoom,
int discrete, int finish, int multiplex, int quiet, int discrete, int finish, int multiplex, int quiet,
const char * plugin_arg, const char * plugin_arg,
const char * object_props, const char * object_props,
const char * atom_props) const char * atom_props,
bool mimic)
{ {
int ok = true; int ok = true;
const char * fname = content; const char * fname = content;
char * buffer = NULL; char * buffer = NULL;
long size = (long) content_length; long size = (long) content_length;
OrthoLineType buf = ""; OrthoLineType buf = "";
char plugin[16] = ""; char plugin[16] = "";
CObject *obj = NULL; CObject *obj = NULL;
CObject *origObj = NULL; CObject *origObj = NULL;
int pdb_variant = PDB_VARIANT_DEFAULT; int pdb_variant = PDB_VARIANT_DEFAULT;
// validate proposed object name // validate proposed object name
ObjectNameType object_name = ""; ObjectNameType object_name = "";
ExecutiveProcessObjectName(G, object_name_proposed, object_name); ExecutiveProcessObjectName(G, object_name_proposed, object_name);
// Ensure correct float parsing with scanf. It's possible to change this from
// Python, so don't rely on a persistent global value.
std::setlocale(LC_NUMERIC, "C");
if (!object_props) object_props = SettingGetGlobal_s(G, cSetting_load_object_p
rops_default);
if (!atom_props) atom_props = SettingGetGlobal_s(G, cSetting_load_atom_pro
ps_default);
// multiplex -2 -> "multiplex" setting // multiplex -2 -> "multiplex" setting
// multiplex -1 -> file type dependant default // multiplex -1 -> file type dependant default
// multiplex 1 -> split entries (don't try to load into existing object) // multiplex 1 -> split entries (don't try to load into existing object)
if(multiplex == -2) { if(multiplex == -2) {
multiplex = SettingGetGlobal_i(G, cSetting_multiplex); multiplex = SettingGetGlobal_i(G, cSetting_multiplex);
} }
switch (content_format) { switch (content_format) {
// string loading functions // string loading functions
case cLoadTypePDBStr: case cLoadTypePDBStr:
skipping to change at line 3673 skipping to change at line 3694
} }
if (plugin[0]) { if (plugin[0]) {
content_format = cLoadTypePlugin; content_format = cLoadTypePlugin;
} }
if (multiplex != 1) { if (multiplex != 1) {
origObj = ExecutiveGetExistingCompatible(G, object_name, content_format); origObj = ExecutiveGetExistingCompatible(G, object_name, content_format);
} }
#ifndef PYMOL_EDU #ifndef _PYMOL_NO_UNDO
#endif #endif
// file type dependent multiplex and discrete default // file type dependent multiplex and discrete default
if(discrete < 0) { if(discrete < 0) {
if(multiplex == 1) { if(multiplex == 1) {
discrete = 0; discrete = 0;
} else { } else {
switch (content_format) { switch (content_format) {
case cLoadTypeMOL2: case cLoadTypeMOL2:
case cLoadTypeMOL2Str: case cLoadTypeMOL2Str:
skipping to change at line 3885 skipping to change at line 3906
sprintf(buf, " CmdLoad: loaded as \"%s\".\n", obj->Name); sprintf(buf, " CmdLoad: loaded as \"%s\".\n", obj->Name);
} }
mfree(buffer); mfree(buffer);
if(!quiet && buf[0]) { if(!quiet && buf[0]) {
PRINTFB(G, FB_Executive, FB_Actions) PRINTFB(G, FB_Executive, FB_Actions)
"%s", buf ENDFB(G); "%s", buf ENDFB(G);
} }
#ifndef PYMOL_EDU #ifndef _PYMOL_NO_UNDO
#endif #endif
return (ok); return (ok);
} }
/* ExecutiveGetExistingCompatible /* ExecutiveGetExistingCompatible
* *
* PARAMS * PARAMS
* oname -- object name * oname -- object name
skipping to change at line 4848 skipping to change at line 4869
op.i3 = 0; op.i3 = 0;
op.i4 = byres; op.i4 = byres;
op.ii1 = color_index; op.ii1 = color_index;
op.ff1 = value; op.ff1 = value;
op.f1 = min; op.f1 = min;
op.f2 = range; op.f2 = range;
ExecutiveObjMolSeleOp(G, sele1, &op); ExecutiveObjMolSeleOp(G, sele1, &op);
op.code = OMOP_INVA; op.code = OMOP_INVA;
op.i1 = cRepAll; op.i1 = cRepBitmask;
op.i2 = cRepInvColor; op.i2 = cRepInvColor;
ExecutiveObjMolSeleOp(G, sele1, &op); ExecutiveObjMolSeleOp(G, sele1, &op);
} }
} }
ok_except1: ok_except1:
FreeP(color_index); FreeP(color_index);
FreeP(value); FreeP(value);
} }
skipping to change at line 5459 skipping to change at line 5480
Py_XDECREF(tmp); Py_XDECREF(tmp);
tmp = MovieAsPyList(G); tmp = MovieAsPyList(G);
PyDict_SetItemString(dict, "movie", tmp); PyDict_SetItemString(dict, "movie", tmp);
Py_XDECREF(tmp); Py_XDECREF(tmp);
tmp = EditorAsPyList(G); tmp = EditorAsPyList(G);
PyDict_SetItemString(dict, "editor", tmp); PyDict_SetItemString(dict, "editor", tmp);
Py_XDECREF(tmp); Py_XDECREF(tmp);
#ifndef _PYMOL_NO_MAIN
tmp = MainAsPyList(); tmp = MainAsPyList();
PyDict_SetItemString(dict, "main", tmp); PyDict_SetItemString(dict, "main", tmp);
Py_XDECREF(tmp); Py_XDECREF(tmp);
#endif
#ifdef PYMOL_EVAL #ifdef PYMOL_EVAL
ExecutiveEvalMessage(G, dict); ExecutiveEvalMessage(G, dict);
#endif #endif
} }
if(Feedback(G, FB_Executive, FB_Errors)) { if(Feedback(G, FB_Executive, FB_Errors)) {
if(PyErr_Occurred()) { if(PyErr_Occurred()) {
PRINTF PRINTF
skipping to change at line 5607 skipping to change at line 5626
} }
if(ok) { if(ok) {
tmp = PyDict_GetItemString(session, "version"); tmp = PyDict_GetItemString(session, "version");
if(tmp) { if(tmp) {
ok = PConvPyIntToInt(tmp, &version); ok = PConvPyIntToInt(tmp, &version);
if(ok) { if(ok) {
version_full = version; version_full = version;
while (version_full < 210) /* any version less than 2.1 (account for nex t major version 2) should be 4 digits, otherwise 3 */ while (version_full < 210) /* any version less than 2.1 (account for nex t major version 2) should be 4 digits, otherwise 3 */
version_full *= 10; version_full *= 10;
float version_float = version_full / (version >= 1000000 ? 1000000.f : 1 000.f);
if(version > _PyMOL_VERSION_int) { if(version > _PyMOL_VERSION_int) {
if(!quiet) { if(!quiet) {
PRINTFB(G, FB_Executive, FB_Errors) PRINTFB(G, FB_Executive, FB_Errors)
"Warning: This session was created with a newer version of PyMOL ( "Warning: This session was created with a newer version of PyMOL (
%1.3f).\n", %1.6f).\n",
version_full / 1000. ENDFB(G); version_float ENDFB(G);
if(SettingGetGlobal_i(G, cSetting_session_version_check)) { if(SettingGetGlobal_i(G, cSetting_session_version_check)) {
PRINTFB(G, FB_Executive, FB_Errors) PRINTFB(G, FB_Executive, FB_Errors)
"Error: Please update first -- see http://www.pymol.org\n" ENDFB (G); "Error: Please update first -- see http://www.pymol.org\n" ENDFB (G);
ok = false; ok = false;
} else { } else {
PRINTFB(G, FB_Executive, FB_Errors) PRINTFB(G, FB_Executive, FB_Errors)
"Warning: Some content may not load completely.\n" ENDFB(G); "Warning: Some content may not load completely.\n" ENDFB(G);
} }
} }
} else { } else {
if(!quiet) { if(!quiet) {
PRINTFB(G, FB_Executive, FB_Details) PRINTFB(G, FB_Executive, FB_Details)
" Executive: Loading version %1.3f session...\n", version_full / 1 000.0 ENDFB(G); " Executive: Loading version %1.6f session...\n", version_float EN DFB(G);
} }
} }
} }
} }
} }
#ifndef PYMOL_EVAL #ifndef PYMOL_EVAL
if(ok) { if(ok) {
tmp = PyDict_GetItemString(session, "eval_nag"); tmp = PyDict_GetItemString(session, "eval_nag");
if(tmp) { if(tmp) {
ok = PyString_Check(tmp); ok = PyString_Check(tmp);
if(ok) { if(ok) {
char *st = PyString_AsString(tmp); const char *st = PyString_AsString(tmp);
if(st) { if(st) {
if(Feedback(G, FB_Nag, FB_Warnings)) { if(Feedback(G, FB_Nag, FB_Warnings)) {
OrthoAddOutput(G, st); OrthoAddOutput(G, st);
} }
} }
} }
} }
} }
#endif #endif
skipping to change at line 5860 skipping to change at line 5880
incomplete = true; incomplete = true;
ok = true; /* keep trying...don't give up */ ok = true; /* keep trying...don't give up */
} }
} }
} }
if(ok) { /* update mouse in GUI */ if(ok) { /* update mouse in GUI */
PParse(G, "cmd.mouse(quiet=1)"); PParse(G, "cmd.mouse(quiet=1)");
if(!G->Option->presentation && !SettingGetGlobal_b(G, cSetting_suspend_updat es)) if(!G->Option->presentation && !SettingGetGlobal_b(G, cSetting_suspend_updat es))
PParse(G, "viewport"); /* refresh window/internal_gui status */ PParse(G, "viewport"); /* refresh window/internal_gui status */
} }
#ifndef _PYMOL_NO_MAIN
// Do not load viewport size when we have a GUI // Do not load viewport size when we have a GUI
if(ok && !G->HaveGUI) { if(ok) {
tmp = PyDict_GetItemString(session, "main"); tmp = PyDict_GetItemString(session, "main");
if(tmp) { if(tmp) {
ok = MainFromPyList(tmp); /* main just stores the viewport size */ if (!G->HaveGUI &&
/* PYMOL-775 added suspend_updates check, but does it make sense? */
!SettingGetGlobal_b(G, cSetting_suspend_updates) &&
!partial_restore) {
ok = MainFromPyList(tmp);
#ifndef _PYMOL_NOPY
} else if (!quiet) {
int viewport[2];
PConvPyListToIntArrayInPlace(tmp, viewport, 2);
PRINTFB(G, FB_Executive, FB_Actions)
" Session was saved with: viewport %d, %d\n",
viewport[0], viewport[1] ENDFB(G);
#endif
}
} }
if(tmp || (!(partial_restore | partial_session))) { /* ignore missing if par tial restore */ if(tmp || (!(partial_restore | partial_session))) { /* ignore missing if par tial restore */
if(PyErr_Occurred()) { if(PyErr_Occurred()) {
PyErr_Print(); PyErr_Print();
ok = false; ok = false;
} }
if(!ok) { if(!ok) {
PRINTFB(G, FB_Executive, FB_Errors) PRINTFB(G, FB_Executive, FB_Errors)
"ExectiveSetSession-Error: after main.\n" ENDFB(G); "ExectiveSetSession-Error: after main.\n" ENDFB(G);
} }
if(!ok) { if(!ok) {
incomplete = true; incomplete = true;
ok = true; /* keep trying...don't give up */ ok = true; /* keep trying...don't give up */
} }
} }
} }
#endif
if(ok && migrate_sessions) { /* migrate sessions */ if(ok && migrate_sessions) { /* migrate sessions */
tmp = PyDict_GetItemString(session, "version"); tmp = PyDict_GetItemString(session, "version");
if(tmp) { if(tmp) {
ok = PConvPyIntToInt(tmp, &version); ok = PConvPyIntToInt(tmp, &version);
if(ok) { if(ok) {
ExecutiveMigrateSession(G, version); ExecutiveMigrateSession(G, version);
} }
} }
} }
skipping to change at line 5911 skipping to change at line 5942
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); CShaderMgr_Set_Reload_Bits(G, RELOAD_SHADERS_UPDATE_FOR_BACKGROUND);
OrthoBackgroundTextureNeedsUpdate(G); OrthoBackgroundTextureNeedsUpdate(G);
ExecutiveInvalidateSelectionIndicatorsCGO(G); ExecutiveInvalidateSelectionIndicatorsCGO(G);
SceneChanged(G); SceneChanged(G);
return (ok); return (ok);
} }
#define ExecScrollBarMargin 1 #define ExecScrollBarMargin DIP2PIXEL(1)
#define ExecScrollBarWidth 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)
{ {
/* return VLA containing list of atoms references by selection */ /* return VLA containing list of atoms references by selection */
CObject **result = NULL; CObject **result = NULL;
CExecutive *I = G->Executive; CExecutive *I = G->Executive;
SpecRec *rec = NULL; SpecRec *rec = NULL;
skipping to change at line 8076 skipping to change at line 8107
op1.i1 = cRepCartoon; op1.i1 = cRepCartoon;
op1.i2 = cRepInvRep; op1.i2 = cRepInvRep;
ExecutiveObjMolSeleOp(G, sele1, &op1); 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 = cRepCartoon; op1.i1 = cRepCartoonBit;
op1.i2 = cRepInvRep; op1.i2 = cRepInvRep;
ExecutiveObjMolSeleOp(G, sele1, &op1); ExecutiveObjMolSeleOp(G, sele1, &op1);
} }
} else { } else {
ErrMessage(G, "Cartoon", "Invalid selection."); ErrMessage(G, "Cartoon", "Invalid selection.");
} }
return (op1.i2); return (op1.i2);
} }
/*========================================================================*/ /*========================================================================*/
skipping to change at line 8488 skipping to change at line 8519
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 = CShaderPrg_Enable_IndicatorShader(G);
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); CShaderPrg_SetLightingEnabled(shaderPrg, 0);
CShaderPrg_SetAttrib4fLocation(shaderPrg, "a_Color", 1.f, 1.f, 1.f, 1.f); CShaderPrg_SetAttrib4fLocation(shaderPrg, "a_Color", 1.f, 1.f, 1.f, 1.f);
CShaderPrg_Set1f(shaderPrg, "g_pointSize", I->selectorTextureSize); CShaderPrg_Set1f(shaderPrg, "g_pointSize", DIP2PIXEL(I->selectorTextureSize));
CShaderPrg_Set2f(shaderPrg, "textureLookup", I->selectorTexturePosX/text_textu re_dim, I->selectorTexturePosY/text_texture_dim); CShaderPrg_Set2f(shaderPrg, "textureLookup", I->selectorTexturePosX/text_textu re_dim, I->selectorTexturePosY/text_texture_dim);
textureScale = I->selectorTextureSize/text_texture_dim ; textureScale = I->selectorTextureSize/text_texture_dim ;
CShaderPrg_Set2f(shaderPrg, "textureScale", textureScale, textureScale); CShaderPrg_Set2f(shaderPrg, "textureScale", textureScale, textureScale);
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);
skipping to change at line 9236 skipping to change at line 9267
#define tmp_fuse_sele "tmp_fuse_sele" #define tmp_fuse_sele "tmp_fuse_sele"
SelectorTmp tmpsele0(G, s0); SelectorTmp tmpsele0(G, s0);
SelectorTmp tmpsele1(G, s1); SelectorTmp tmpsele1(G, s1);
sele0 = tmpsele0.getIndex(); sele0 = tmpsele0.getIndex();
sele1 = tmpsele1.getIndex(); sele1 = tmpsele1.getIndex();
if(sele0 < 0 || sele1 < 0) { if(sele0 < 0 || sele1 < 0) {
ErrMessage(G, "Fuse", "Need two selections"); ErrMessage(G, "Fuse", "Need two selections");
} else { } else {
#ifndef PYMOL_EDU #ifndef _PYMOL_NO_UNDO
#endif #endif
{ {
EditorInactivate(G); EditorInactivate(G);
obj0 = SelectorGetSingleObjectMolecule(G, sele0); obj0 = SelectorGetSingleObjectMolecule(G, sele0);
obj1 = SelectorGetSingleObjectMolecule(G, sele1); obj1 = SelectorGetSingleObjectMolecule(G, sele1);
if(obj0) if(obj0)
i0 = ObjectMoleculeGetAtomIndex(obj0, sele0); i0 = ObjectMoleculeGetAtomIndex(obj0, sele0);
if(obj1) if(obj1)
i1 = ObjectMoleculeGetAtomIndex(obj1, sele1); i1 = ObjectMoleculeGetAtomIndex(obj1, sele1);
if(obj0 && obj1 && (i0 >= 0) && (i1 >= 0) && (obj0 != obj1)) { if(obj0 && obj1 && (i0 >= 0) && (i1 >= 0) && (obj0 != obj1)) {
skipping to change at line 9431 skipping to change at line 9462
if((rec->type == cExecObject) && (rec->obj->type == cObjectMolecule) ) { if((rec->type == cExecObject) && (rec->obj->type == cObjectMolecule) ) {
obj = (ObjectMolecule *) rec->obj; obj = (ObjectMolecule *) rec->obj;
if (ok) if (ok)
ok &= ObjectMoleculeSort(obj); ok &= ObjectMoleculeSort(obj);
if (ok){ if (ok){
changed = true; changed = true;
sele = SelectorIndexByName(G, rec->name); sele = SelectorIndexByName(G, rec->name);
if(sele >= 0) { if(sele >= 0) {
ObjectMoleculeOpRecInit(&op); ObjectMoleculeOpRecInit(&op);
op.code = OMOP_INVA; op.code = OMOP_INVA;
op.i1 = cRepAll; op.i1 = cRepCartoonBit | cRepRibbonBit;
op.i2 = cRepInvRep; op.i2 = cRepInvRep;
ExecutiveObjMolSeleOp(G, sele, &op); ExecutiveObjMolSeleOp(G, sele, &op);
} }
} }
} }
} }
break; break;
case cExecSelection: case cExecSelection:
sele = SelectorIndexByName(G, rec->name); sele = SelectorIndexByName(G, rec->name);
if(sele >= 0) { if(sele >= 0) {
op.code = OMOP_Sort; op.code = OMOP_Sort;
ExecutiveObjMolSeleOp(G, sele, &op); ExecutiveObjMolSeleOp(G, sele, &op);
ObjectMoleculeOpRecInit(&op); ObjectMoleculeOpRecInit(&op);
op.code = OMOP_INVA; op.code = OMOP_INVA;
op.i1 = cRepAll; op.i1 = cRepCartoonBit | cRepRibbonBit;
op.i2 = cRepInvRep; op.i2 = cRepInvRep;
ExecutiveObjMolSeleOp(G, sele, &op); ExecutiveObjMolSeleOp(G, sele, &op);
ObjectMoleculeOpRecInit(&op); ObjectMoleculeOpRecInit(&op);
} }
break; break;
case cExecObject: case cExecObject:
if(rec->obj->type == cObjectMolecule) { if(rec->obj->type == cObjectMolecule) {
obj = (ObjectMolecule *) rec->obj; obj = (ObjectMolecule *) rec->obj;
if (ok) if (ok)
ok &= ObjectMoleculeSort(obj); ok &= ObjectMoleculeSort(obj);
changed = true; changed = true;
sele = SelectorIndexByName(G, rec->name); sele = SelectorIndexByName(G, rec->name);
if(sele >= 0) { if(sele >= 0) {
ObjectMoleculeOpRecInit(&op); ObjectMoleculeOpRecInit(&op);
op.code = OMOP_INVA; op.code = OMOP_INVA;
op.i1 = cRepAll; op.i1 = cRepCartoonBit | cRepRibbonBit;
op.i2 = cRepInvRep; op.i2 = cRepInvRep;
ExecutiveObjMolSeleOp(G, sele, &op); ExecutiveObjMolSeleOp(G, sele, &op);
} }
} }
break; break;
} }
} }
} }
TrackerDelList(I_Tracker, list_id); TrackerDelList(I_Tracker, list_id);
TrackerDelIter(I_Tracker, iter_id); TrackerDelIter(I_Tracker, iter_id);
skipping to change at line 9518 skipping to change at line 9549
op.i1, obj->Obj.Name ENDFB(G); op.i1, obj->Obj.Name ENDFB(G);
} }
} }
} }
} }
} }
} }
} }
/*========================================================================*/ /*========================================================================*/
void ExecutiveAddHydrogens(PyMOLGlobals * G, const char *s1, int quiet) void ExecutiveAddHydrogens(PyMOLGlobals * G, const char *s1, int quiet, int stat e, bool legacy)
{ {
ObjectMoleculeOpRec op; ObjectMoleculeOpRec op;
/* Needs 4 passes */ /* Needs 4 passes */
for (int cnt = 0; cnt < 4; ++cnt) { int passes = legacy ? 4 : 1;
for (int cnt = 0; cnt < passes; ++cnt) {
SelectorTmp tmpsele1(G, s1); SelectorTmp tmpsele1(G, s1);
int sele1 = tmpsele1.getIndex(); int sele1 = tmpsele1.getIndex();
ObjectMoleculeOpRecInit(&op); ObjectMoleculeOpRecInit(&op);
op.code = OMOP_AddHydrogens; /* 4 passes completes the job */ op.code = OMOP_AddHydrogens; /* 4 passes completes the job */
op.i1 = state;
op.i2 = legacy;
ExecutiveObjMolSeleOp(G, sele1, &op); ExecutiveObjMolSeleOp(G, sele1, &op);
} }
} }
/*========================================================================*/ /*========================================================================*/
void ExecutiveFixHydrogens(PyMOLGlobals * G, const char *s1, int quiet) void ExecutiveFixHydrogens(PyMOLGlobals * G, const char *s1, int quiet)
{ {
int sele1; int sele1;
ObjectMoleculeOpRec op; ObjectMoleculeOpRec op;
skipping to change at line 9682 skipping to change at line 9716
if(mode) { if(mode) {
PRINTF " Mask: %d atoms masked (cannot be picked or selected).\n", PRINTF " Mask: %d atoms masked (cannot be picked or selected).\n",
op.i2 ENDF(G); op.i2 ENDF(G);
} else { } else {
PRINTF " Mask: %d atoms unmasked.\n", op.i2 ENDF(G); PRINTF " Mask: %d atoms unmasked.\n", op.i2 ENDF(G);
} }
} }
} }
} }
op.code = OMOP_INVA; /* need to invalidate all pickable representatio ns */ op.code = OMOP_INVA; /* need to invalidate all pickable representatio ns */
op.i1 = cRepAll; op.i1 = cRepsAtomMask;
op.i2 = cRepInvPick; op.i2 = cRepInvPick;
ExecutiveObjMolSeleOp(G, sele1, &op); ExecutiveObjMolSeleOp(G, sele1, &op);
} }
} }
/*========================================================================*/ /*========================================================================*/
int ExecutiveStereo(PyMOLGlobals * G, int flag) int ExecutiveStereo(PyMOLGlobals * G, int flag)
{ {
int ok = 1; int ok = 1;
int stereo_mode; int stereo_mode;
skipping to change at line 9704 skipping to change at line 9738
switch (flag) { switch (flag) {
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) { if(G->HaveGUI) {
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 1: /* 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;
} }
} }
skipping to change at line 10492 skipping to change at line 10526
sele1 = SelectorIndexByName(G, s1); sele1 = SelectorIndexByName(G, s1);
if(sele1 >= 0) { if(sele1 >= 0) {
ObjectMoleculeOpRecInit(&op1); ObjectMoleculeOpRecInit(&op1);
op1.code = OMOP_LABL; op1.code = OMOP_LABL;
op1.s1 = expr; op1.s1 = expr;
op1.i1 = 0; op1.i1 = 0;
op1.i2 = eval_mode; op1.i2 = eval_mode;
ExecutiveObjMolSeleOp(G, sele1, &op1); ExecutiveObjMolSeleOp(G, sele1, &op1);
cnt = op1.i1; cnt = op1.i1;
op1.code = OMOP_VISI; op1.code = OMOP_VISI;
op1.i1 = cRepLabel; op1.i1 = cRepLabelBit;
op1.i2 = 1; op1.i2 = cVis_SHOW;
ExecutiveObjMolSeleOp(G, sele1, &op1); ExecutiveObjMolSeleOp(G, sele1, &op1);
op1.code = OMOP_INVA; op1.code = OMOP_INVA;
op1.i1 = cRepLabel;
op1.i2 = cRepInvVisib; op1.i2 = cRepInvVisib;
ExecutiveObjMolSeleOp(G, sele1, &op1); ExecutiveObjMolSeleOp(G, sele1, &op1);
if(!quiet) { if(!quiet) {
{ {
const char *unlabelledstr = ""; const char *unlabelledstr = "";
if (cnt<0){ /* if negative, say unlabelled */ if (cnt<0){ /* if negative, say unlabelled */
cnt = -cnt; cnt = -cnt;
unlabelledstr = "un"; unlabelledstr = "un";
} }
skipping to change at line 10724 skipping to change at line 10757
int sele0 = SelectorIndexByName(G, name); int sele0 = SelectorIndexByName(G, name);
PyObject *entry = NULL; PyObject *entry = NULL;
ObjectMolecule *obj = NULL; ObjectMolecule *obj = NULL;
if(sele0 >= 0) if(sele0 >= 0)
obj = SelectorGetSingleObjectMolecule(G, sele0); obj = SelectorGetSingleObjectMolecule(G, sele0);
if(obj) { if(obj) {
int n_atom = obj->NAtom; int n_atom = obj->NAtom;
int list_len = 0; int list_len = 0;
int a; int a;
int index = 0; int index = 0;
char *expr = NULL; const char *expr = NULL;
if(ok) if(ok)
ok = PyList_Check(list); ok = PyList_Check(list);
if(ok) { if(ok) {
list_len = PyList_Size(list); list_len = PyList_Size(list);
for(a = 0; a < list_len; a++) { for(a = 0; a < list_len; a++) {
if(ok) if(ok)
entry = PyList_GetItem(list, a); entry = PyList_GetItem(list, a);
if(ok) if(ok)
ok = PyList_Check(entry); ok = PyList_Check(entry);
if(ok) if(ok)
skipping to change at line 11360 skipping to change at line 11393
f1 += 3; f1 += 3;
f2 += 3; f2 += 3;
if(ai1 && ai2) { /* make sure we keep track of which atom s are aligned */ if(ai1 && ai2) { /* make sure we keep track of which atom s are aligned */
*(ai1++) = op1.ai1VLA[a]; *(ai1++) = op1.ai1VLA[a];
*(ai2++) = op2.ai1VLA[a]; *(ai2++) = op2.ai1VLA[a];
} }
} }
} }
if(!quiet && (n_next != n_pair)) { if(!quiet && (n_next != n_pair)) {
PRINTFB(G, FB_Executive, FB_Actions) PRINTFB(G, FB_Executive, FB_Actions)
" ExecutiveRMS: %d atoms rejected during cycle %d (RMS=%0.2f ).\n", " ExecutiveRMS: %d atoms rejected during cycle %d (RMSD=%0.2 f).\n",
n_pair - n_next, b, rms ENDFB(G); n_pair - n_next, b, rms ENDFB(G);
} }
n_pair = n_next; n_pair = n_next;
FreeP(flag); FreeP(flag);
if(n_pair) { if(n_pair) {
rms = MatrixFitRMSTTTf(G, n_pair, op1.vv1, op2.vv1, NULL, op2. ttt); rms = MatrixFitRMSTTTf(G, n_pair, op1.vv1, op2.vv1, NULL, op2. ttt);
if(rms_info) { if(rms_info) {
rms_info->n_cycles_run = b; rms_info->n_cycles_run = b;
rms_info->final_n_atom = n_pair; rms_info->final_n_atom = n_pair;
rms_info->final_rms = rms; rms_info->final_rms = rms;
skipping to change at line 11394 skipping to change at line 11427
} }
if(!n_pair) { if(!n_pair) {
PRINTFB(G, FB_Executive, FB_Results) PRINTFB(G, FB_Executive, FB_Results)
" Executive: Error -- no atoms left after refinement!\n" ENDFB(G); " Executive: Error -- no atoms left after refinement!\n" ENDFB(G);
ok = false; ok = false;
} }
if(ok) { if(ok) {
if(!quiet) { if(!quiet) {
PRINTFB(G, FB_Executive, FB_Results) PRINTFB(G, FB_Executive, FB_Results)
" Executive: RMS = %8.3f (%d to %d atoms)\n", rms, n_pair, n_pair EN DFB(G); " Executive: RMSD = %8.3f (%d to %d atoms)\n", rms, n_pair, n_pair E NDFB(G);
} }
if(oname && oname[0]) { if(oname && oname[0]) {
int align_state = state2; int align_state = state2;
ObjectMolecule *trg_obj = SelectorGetSingleObjectMolecule(G, sele2); ObjectMolecule *trg_obj = SelectorGetSingleObjectMolecule(G, sele2);
if(align_state < 0) { if(align_state < 0) {
align_state = SceneGetState(G); align_state = SceneGetState(G);
} }
/* we're going to create/update an alignment object */ /* we're going to create/update an alignment object */
skipping to change at line 11701 skipping to change at line 11734
if(op1.nvv1 != op2.nvv1) { if(op1.nvv1 != op2.nvv1) {
sprintf(buffer, "Atom counts between selection sets don't match (%d != %d) .", sprintf(buffer, "Atom counts between selection sets don't match (%d != %d) .",
op1.nvv1, op2.nvv1); op1.nvv1, op2.nvv1);
ErrMessage(G, "ExecutiveRMS", buffer); ErrMessage(G, "ExecutiveRMS", buffer);
} else if(op1.nvv1) { } else if(op1.nvv1) {
if(mode != 0) if(mode != 0)
rms = MatrixFitRMSTTTf(G, op1.nvv1, op1.vv1, op2.vv1, NULL, op2.ttt); rms = MatrixFitRMSTTTf(G, op1.nvv1, op1.vv1, op2.vv1, NULL, op2.ttt);
else else
rms = MatrixGetRMS(G, op1.nvv1, op1.vv1, op2.vv1, NULL); rms = MatrixGetRMS(G, op1.nvv1, op1.vv1, op2.vv1, NULL);
PRINTFB(G, FB_Executive, FB_Results) PRINTFB(G, FB_Executive, FB_Results)
" ExecutiveRMS: RMS = %8.3f (%d to %d atoms)\n", rms, op1.nvv1, op2.nvv1 ENDFB(G); " ExecutiveRMS: RMSD = %8.3f (%d to %d atoms)\n", rms, op1.nvv1, op2.nvv 1 ENDFB(G);
op2.code = OMOP_TTTF; op2.code = OMOP_TTTF;
SelectorGetTmp(G, combi, s1); SelectorGetTmp(G, combi, s1);
sele1 = SelectorIndexByName(G, s1); sele1 = SelectorIndexByName(G, s1);
ExecutiveObjMolSeleOp(G, sele1, &op2); ExecutiveObjMolSeleOp(G, sele1, &op2);
SelectorFreeTmp(G, s1); SelectorFreeTmp(G, s1);
} else { } else {
ErrMessage(G, "ExecutiveRMS", "No atoms selected."); ErrMessage(G, "ExecutiveRMS", "No atoms selected.");
} }
} }
skipping to change at line 12101 skipping to change at line 12134
(SelectorIsMember(G, ai2->selEntry, sele1) && (SelectorIsMember(G, ai2->selEntry, sele1) &&
SelectorIsMember(G, ai1->selEntry, sele2))) { SelectorIsMember(G, ai1->selEntry, sele2))) {
PyObject *pyBondInfo = PyList_New(3); PyObject *pyBondInfo = PyList_New(3);
PyObject *bond_setting_value = NULL; PyObject *bond_setting_value = NULL;
if (!pyObjList){ if (!pyObjList){
pyObjList = PyList_New(2); pyObjList = PyList_New(2);
pyBondList = PyList_New(0); pyBondList = PyList_New(0);
PyList_SetItem(pyObjList, 0, PyString_FromString(obj->Obj.Name)); PyList_SetItem(pyObjList, 0, PyString_FromString(obj->Obj.Name));
PyList_SetItem(pyObjList, 1, pyBondList); PyList_SetItem(pyObjList, 1, pyBondList);
PyList_Append(result, pyObjList); PyList_Append(result, pyObjList);
Py_DECREF(pyObjList);
} }
PyList_SetItem(pyBondInfo, 0, PyInt_FromLong((long)bi->index[0]+1)) ; PyList_SetItem(pyBondInfo, 0, PyInt_FromLong((long)bi->index[0]+1)) ;
PyList_SetItem(pyBondInfo, 1, PyInt_FromLong((long)bi->index[1]+1)) ; PyList_SetItem(pyBondInfo, 1, PyInt_FromLong((long)bi->index[1]+1)) ;
if (bi->has_setting){ if (bi->has_setting){
int uid = AtomInfoCheckUniqueBondID(G, bi); int uid = AtomInfoCheckUniqueBondID(G, bi);
bond_setting_value = SettingUniqueGetPyObject(G, uid, index); bond_setting_value = SettingUniqueGetPyObject(G, uid, index);
} }
PyList_SetItem(pyBondInfo, 2, PConvAutoNone(bond_setting_value)); PyList_SetItem(pyBondInfo, 2, PConvAutoNone(bond_setting_value));
PyList_Append(pyBondList, pyBondInfo); PyList_Append(pyBondList, pyBondInfo);
Py_DECREF(pyBondInfo);
nSet++; nSet++;
} }
bi++; bi++;
} }
if(nSet && !quiet) { if(nSet && !quiet) {
SettingGetName(G, index, name); SettingGetName(G, index, name);
PRINTF PRINTF
" Getting: %s for %d bonds in object \"%s\".\n", " Getting: %s for %d bonds in object \"%s\".\n",
name, nSet, obj->Obj.Name ENDF(G); name, nSet, obj->Obj.Name ENDF(G);
} }
skipping to change at line 12328 skipping to change at line 12363
SpecRec *rec = NULL; SpecRec *rec = NULL;
ObjectMolecule *obj = NULL; ObjectMolecule *obj = NULL;
int sele1; int sele1;
ObjectMoleculeOpRec op; ObjectMoleculeOpRec op;
OrthoLineType value; OrthoLineType value;
CSetting **handle = NULL; CSetting **handle = NULL;
SettingName name = ""; SettingName name = "";
int nObj = 0; int nObj = 0;
int unblock; int unblock;
int ok = true; int ok = true;
PRINTFD(G, FB_Executive) PRINTFD(G, FB_Executive)
" ExecutiveSetSetting: entered. sele \"%s\" updates=%d index=%d\n", sele, up dates, index ENDFD; " ExecutiveSetSetting: entered. sele \"%s\" updates=%d index=%d\n", sele, up dates, index ENDFD;
if(!quiet) { if(!quiet) {
SettingGetName(G, index, name); SettingGetName(G, index, name);
} }
unblock = PAutoBlock(G); unblock = PAutoBlock(G);
if((!sele) || (sele[0] == 0)) { /* global setting */ if((!sele) || (sele[0] == 0)) { /* global setting */
ok = SettingSetFromTuple(G, NULL, index, tuple); ok = SettingSetFromTuple(G, NULL, index, tuple);
skipping to change at line 13012 skipping to change at line 13048
ObjectMoleculeOpRec op; ObjectMoleculeOpRec op;
if(sele >= 0) { if(sele >= 0) {
ok = true; ok = true;
ObjectMoleculeOpRecInit(&op); ObjectMoleculeOpRecInit(&op);
op.code = OMOP_COLR; op.code = OMOP_COLR;
op.i1 = col_ind; op.i1 = col_ind;
op.i2 = n_atm; op.i2 = n_atm;
ExecutiveObjMolSeleOp(G, sele, &op); ExecutiveObjMolSeleOp(G, sele, &op);
n_atm = op.i2; n_atm = op.i2;
op.code = OMOP_INVA; op.code = OMOP_INVA;
op.i1 = cRepAll; op.i1 = cRepBitmask;
op.i2 = cRepInvColor; op.i2 = cRepInvColor;
ExecutiveObjMolSeleOp(G, sele, &op); ExecutiveObjMolSeleOp(G, sele, &op);
} }
} }
} }
break; break;
} }
switch (rec->type) { /* sets object color */ switch (rec->type) { /* sets object color */
case cExecObject: case cExecObject:
skipping to change at line 13881 skipping to change at line 13917
tRec->visible = !tRec->visible; tRec->visible = !tRec->visible;
ReportEnabledChange(G, rec); ReportEnabledChange(G, rec);
} else { } else {
if((!suppress_hidden) || (!hide_underscore) || (!tRec->is_hi dden)) { if((!suppress_hidden) || (!hide_underscore) || (!tRec->is_hi dden)) {
tRec->in_scene = SceneObjectAdd(G, tRec->obj); tRec->in_scene = SceneObjectAdd(G, tRec->obj);
ExecutiveInvalidateSceneMembers(G); ExecutiveInvalidateSceneMembers(G);
tRec->visible = !tRec->visible; tRec->visible = !tRec->visible;
ReportEnabledChange(G, rec); ReportEnabledChange(G, rec);
} }
} }
} else if((tRec->type != cExecSelection) || (!onoff)) /* hide all selections, but show all */ } else if((tRec->type != cExecSelection) || (!onoff)) { /* hide all selections, but show all */
tRec->visible = !tRec->visible; tRec->visible = !tRec->visible;
ReportEnabledChange(G, rec); ReportEnabledChange(G, rec);
}
} }
} }
} }
break; break;
case cExecObject: case cExecObject:
/* /*
if(rec->visible!=onoff) { if(rec->visible!=onoff) {
if(rec->visible) { if(rec->visible) {
rec->in_scene = SceneObjectDel(G,rec->obj); rec->in_scene = SceneObjectDel(G,rec->obj);
ExecutiveInvalidateSceneMembers(G); ExecutiveInvalidateSceneMembers(G);
skipping to change at line 14023 skipping to change at line 14060
#endif #endif
} }
} }
#endif #endif
PyMOL_NeedReshape(G->PyMOL, flag, 0, 0, 0, 0); PyMOL_NeedReshape(G->PyMOL, flag, 0, 0, 0, 0);
SceneChanged(G); SceneChanged(G);
} }
/*========================================================================*/ /*========================================================================*/
void ExecutiveSetAllVisib(PyMOLGlobals * G, int state) static
{ void fInvalidateRepMask(CObject * obj, int repmask, int state=-1) {
ObjectMoleculeOpRec op; if(obj->fInvalidate) {
ObjectMolecule *obj; for(int a = 0; a < cRepCnt; a++) {
int rep; if ((1 << a) & repmask)
int sele; obj->fInvalidate(obj, a, cRepInvVisib, state);
CExecutive *I = G->Executive;
SpecRec *rec = NULL;
PRINTFD(G, FB_Executive)
" ExecutiveSetAllVisib: entered.\n" ENDFD;
while(ListIterate(I->Spec, rec, next)) {
if(rec->type == cExecObject) {
switch (rec->obj->type) {
case cObjectMolecule:
obj = (ObjectMolecule *) rec->obj;
sele = SelectorIndexByName(G, obj->Obj.Name);
ObjectMoleculeOpRecInit(&op);
op.code = OMOP_VISI;
op.i1 = -1;
op.i2 = state;
ObjectMoleculeSeleOp(obj, sele, &op);
op.code = OMOP_INVA;
op.i1 = -1;
op.i2 = cRepInvVisib;
ObjectMoleculeSeleOp(obj, sele, &op);
break;
default:
for(rep = 0; rep < cRepCnt; rep++) {
ObjectSetRepVis(rec->obj, rep, state);
if(rec->obj->fInvalidate)
rec->obj->fInvalidate(rec->obj, rep, cRepInvVisib, state);
}
SceneInvalidate(G);
break;
}
} }
} }
PRINTFD(G, FB_Executive)
" ExecutiveSetAllVisib: leaving...\n" ENDFD;
} }
/*========================================================================*/ /*========================================================================*/
int ExecutiveToggleRepVisib(PyMOLGlobals * G, const char *name, int rep) int ExecutiveToggleRepVisib(PyMOLGlobals * G, const char *name, int rep)
{ {
int ok = true; int ok = true;
int sele = -1; int sele = -1;
SpecRec *tRec; SpecRec *tRec;
ObjectMoleculeOpRec op; ObjectMoleculeOpRec op;
OrthoLineType tmpname; OrthoLineType tmpname;
skipping to change at line 14093 skipping to change at line 14095
// special case: toggle object visibility (should that be in this function?) // special case: toggle object visibility (should that be in this function?)
if(tRec) { if(tRec) {
ExecutiveSetObjVisib(G, name, !tRec->visible, 0); ExecutiveSetObjVisib(G, name, !tRec->visible, 0);
} else { } else {
PRINTFB(G, FB_Executive, FB_Errors) PRINTFB(G, FB_Executive, FB_Errors)
" ExecutiveToggleRepVisib-Error: '%s' not found\n", name ENDFB(G); " ExecutiveToggleRepVisib-Error: '%s' not found\n", name ENDFB(G);
} }
} else if(tRec && tRec->type == cExecObject && } else if(tRec && tRec->type == cExecObject &&
tRec->obj->type != cObjectMolecule) { tRec->obj->type != cObjectMolecule) {
// non-atom object // non-atom object
ObjectToggleRepVis(tRec->obj, rep); tRec->obj->visRep ^= rep;
if(tRec->obj->fInvalidate) fInvalidateRepMask(tRec->obj, rep, 0);
tRec->obj->fInvalidate(tRec->obj, rep, cRepInvVisib, 0);
SceneChanged(G); SceneChanged(G);
} else if(SelectorGetTmp(G, name, tmpname) >= 0) { } else if(SelectorGetTmp(G, name, tmpname) >= 0) {
// atom selection // atom selection
sele = SelectorIndexByName(G, tmpname); sele = SelectorIndexByName(G, tmpname);
if(sele >= 0) { if(sele >= 0) {
ObjectMoleculeOpRecInit(&op); ObjectMoleculeOpRecInit(&op);
op.code = OMOP_CheckVis; op.code = OMOP_CheckVis;
op.i1 = rep; op.i1 = rep;
op.i2 = false; op.i2 = false;
ExecutiveObjMolSeleOp(G, sele, &op); ExecutiveObjMolSeleOp(G, sele, &op);
op.i2 = !op.i2; op.i2 = !op.i2;
if(tRec && tRec->type == cExecObject)
ObjectSetRepVis(tRec->obj, rep, op.i2);
op.code = OMOP_VISI; op.code = OMOP_VISI;
op.i1 = rep; op.i1 = rep;
ExecutiveObjMolSeleOp(G, sele, &op); ExecutiveObjMolSeleOp(G, sele, &op);
op.code = OMOP_INVA; op.code = OMOP_INVA;
op.i2 = cRepInvVisib; op.i2 = cRepInvVisib;
ExecutiveObjMolSeleOp(G, sele, &op); ExecutiveObjMolSeleOp(G, sele, &op);
} }
SelectorFreeTmp(G, tmpname); SelectorFreeTmp(G, tmpname);
} }
PRINTFD(G, FB_Executive) PRINTFD(G, FB_Executive)
" ExecutiveToggleRepVisib: leaving...\n" ENDFD; " ExecutiveToggleRepVisib: leaving...\n" ENDFD;
return (ok); return (ok);
} }
/*========================================================================*/ /*========================================================================*/
void ExecutiveSetRepVisib(PyMOLGlobals * G, const char *name, int rep, int state ) void ExecutiveSetRepVisib(PyMOLGlobals * G, const char *name, int rep, int state )
{ {
int repmask = (rep == cRepAll) ? cRepBitmask : (1 << rep);
ExecutiveSetRepVisMask(G, name, repmask, state);
}
void ExecutiveSetRepVisMask(PyMOLGlobals * G, const char *name, int repmask, int
state)
{
PRINTFD(G, FB_Executive) PRINTFD(G, FB_Executive)
" ExecutiveSetRepVisib: entered.\n" ENDFD; " ExecutiveSetRepVisib: entered.\n" ENDFD;
{ {
CExecutive *I = G->Executive; CExecutive *I = G->Executive;
CTracker *I_Tracker = I->Tracker; CTracker *I_Tracker = I->Tracker;
SpecRec *rec = NULL; SpecRec *rec = NULL;
int list_id = ExecutiveGetNamesListFromPattern(G, name, true, true); int list_id = ExecutiveGetNamesListFromPattern(G, name, true, true);
int iter_id = TrackerNewIter(I_Tracker, 0, list_id); int iter_id = TrackerNewIter(I_Tracker, 0, list_id);
while(TrackerIterNextCandInList(I_Tracker, iter_id, (TrackerRef **) (void *) &rec)) { while(TrackerIterNextCandInList(I_Tracker, iter_id, (TrackerRef **) (void *) &rec)) {
skipping to change at line 14152 skipping to change at line 14156
switch (rec->type) { switch (rec->type) {
case cExecSelection: case cExecSelection:
case cExecObject: case cExecObject:
{ {
int sele = SelectorIndexByName(G, rec->name); int sele = SelectorIndexByName(G, rec->name);
if(sele >= 0) { if(sele >= 0) {
ObjectMoleculeOpRec op; ObjectMoleculeOpRec op;
ObjectMoleculeOpRecInit(&op); ObjectMoleculeOpRecInit(&op);
op.code = OMOP_VISI; op.code = OMOP_VISI;
op.i1 = rep; op.i1 = repmask;
op.i2 = state; op.i2 = state;
ExecutiveObjMolSeleOp(G, sele, &op); ExecutiveObjMolSeleOp(G, sele, &op);
op.code = OMOP_INVA; op.code = OMOP_INVA;
if (state == cVis_AS)
op.i1 = cRepBitmask;
op.i2 = cRepInvVisib; op.i2 = cRepInvVisib;
ExecutiveObjMolSeleOp(G, sele, &op); ExecutiveObjMolSeleOp(G, sele, &op);
} }
} }
break; break;
} }
/* per-object/name */ /* per-object/name */
switch (rec->type) { switch (rec->type) {
case cExecObject: case cExecObject:
if(rep >= 0) { ObjectSetRepVisMask(rec->obj, repmask, state);
ObjectSetRepVis(rec->obj, rep, state); fInvalidateRepMask(rec->obj, repmask, 0);
if(rec->obj->fInvalidate)
rec->obj->fInvalidate(rec->obj, rep, cRepInvVisib, 0);
} else {
int a;
for(a = 0; a < cRepCnt; a++) {
ObjectSetRepVis(rec->obj, a, state);
if(rec->obj->fInvalidate)
rec->obj->fInvalidate(rec->obj, a, cRepInvVisib, 0);
}
}
SceneChanged(G); SceneChanged(G);
break; break;
case cExecAll: case cExecAll:
ExecutiveSetAllRepVisib(G, rep, state); ExecutiveSetAllRepVisMask(G, repmask, state);
break; break;
} }
} }
} }
TrackerDelList(I_Tracker, list_id); TrackerDelList(I_Tracker, list_id);
TrackerDelIter(I_Tracker, iter_id); TrackerDelIter(I_Tracker, iter_id);
} }
PRINTFD(G, FB_Executive) PRINTFD(G, FB_Executive)
" ExecutiveSetRepVisib: leaving...\n" ENDFD; " ExecutiveSetRepVisib: leaving...\n" ENDFD;
skipping to change at line 14220 skipping to change at line 14216
op.code = OMOP_OnOff; op.code = OMOP_OnOff;
op.i1 = onoff; op.i1 = onoff;
ExecutiveObjMolSeleOp(G, sele, &op); ExecutiveObjMolSeleOp(G, sele, &op);
} }
} }
return 1; return 1;
} }
/*========================================================================*/ /*========================================================================*/
static void ExecutiveSetAllRepVisib(PyMOLGlobals * G, int rep, int state) /*
* repmask: rep bit mask
* state: 0 (hide), 1 (show), 2 (as)
*/
static void ExecutiveSetAllRepVisMask(PyMOLGlobals * G, int repmask, int state)
{ {
ObjectMoleculeOpRec op; ObjectMoleculeOpRec op;
ObjectMolecule *obj; ObjectMolecule *obj;
int sele; int sele;
int a;
CExecutive *I = G->Executive; CExecutive *I = G->Executive;
SpecRec *rec = NULL; SpecRec *rec = NULL;
PRINTFD(G, FB_Executive) PRINTFD(G, FB_Executive)
" ExecutiveSetAllRepVisib: entered.\n" ENDFD; " ExecutiveSetAllRepVisib: entered.\n" ENDFD;
while(ListIterate(I->Spec, rec, next)) { while(ListIterate(I->Spec, rec, next)) {
if(rec->type == cExecObject) { if(rec->type == cExecObject) {
if(rec->type == cExecObject) { if(rec->type == cExecObject) {
switch (rec->obj->type) { switch (rec->obj->type) {
case cObjectMolecule: case cObjectMolecule:
obj = (ObjectMolecule *) rec->obj; obj = (ObjectMolecule *) rec->obj;
sele = SelectorIndexByName(G, obj->Obj.Name); sele = SelectorIndexByName(G, obj->Obj.Name);
ObjectMoleculeOpRecInit(&op); ObjectMoleculeOpRecInit(&op);
op.code = OMOP_VISI; op.code = OMOP_VISI;
op.i1 = rep; op.i1 = repmask;
op.i2 = state; op.i2 = state;
ObjectMoleculeSeleOp(obj, sele, &op); ObjectMoleculeSeleOp(obj, sele, &op);
op.code = OMOP_INVA; op.code = OMOP_INVA;
if (state == cVis_AS)
op.i1 = cRepBitmask;
op.i2 = cRepInvVisib; op.i2 = cRepInvVisib;
ObjectMoleculeSeleOp(obj, sele, &op); ObjectMoleculeSeleOp(obj, sele, &op);
break; break;
default: default:
if(rep >= 0) { ObjectSetRepVisMask(rec->obj, repmask, state);
ObjectSetRepVis(rec->obj, rep, state); fInvalidateRepMask(rec->obj, repmask, -1);
if(rec->obj->fInvalidate)
rec->obj->fInvalidate(rec->obj, rep, cRepInvVisib, state);
} else {
for(a = 0; a < cRepCnt; a++) {
ObjectSetRepVis(rec->obj, a, state);
if(rec->obj->fInvalidate)
rec->obj->fInvalidate(rec->obj, rep, cRepInvVisib, state);
}
}
SceneInvalidate(G); SceneInvalidate(G);
break; break;
} }
} }
} }
} }
PRINTFD(G, FB_Executive) PRINTFD(G, FB_Executive)
" ExecutiveSetAllRepVisib: leaving...\n" ENDFD; " ExecutiveSetAllRepVisib: leaving...\n" ENDFD;
} }
skipping to change at line 14294 skipping to change at line 14286
while(TrackerIterNextCandInList(I_Tracker, iter_id, (TrackerRef **) (void *) &rec)) { while(TrackerIterNextCandInList(I_Tracker, iter_id, (TrackerRef **) (void *) &rec)) {
if(rec) { if(rec) {
switch (rec->type) { switch (rec->type) {
case cExecSelection: case cExecSelection:
case cExecObject: case cExecObject:
{ {
int sele = SelectorIndexByName(G, rec->name); int sele = SelectorIndexByName(G, rec->name);
if(sele >= 0) { if(sele >= 0) {
ObjectMoleculeOpRecInit(&op); ObjectMoleculeOpRecInit(&op);
op.code = OMOP_INVA; op.code = OMOP_INVA;
op.i1 = rep; op.i1 = (rep == cRepAll) ? cRepBitmask : (1 << rep);
op.i2 = level; op.i2 = level;
ExecutiveObjMolSeleOp(G, sele, &op); ExecutiveObjMolSeleOp(G, sele, &op);
} else if(rec->obj->fInvalidate) { } else if(rec->obj->fInvalidate) {
rec->obj->fInvalidate(rec->obj, rep, level, -1); rec->obj->fInvalidate(rec->obj, rep, level, -1);
} }
} }
break; break;
case cExecAll: case cExecAll:
rec = NULL; rec = NULL;
while(ListIterate(I->Spec, rec, next)) { while(ListIterate(I->Spec, rec, next)) {
skipping to change at line 14737 skipping to change at line 14729
} }
PRINTFD(G, FB_Executive) PRINTFD(G, FB_Executive)
" ExecutiveSymExp: leaving...\n" ENDFD; " ExecutiveSymExp: leaving...\n" ENDFD;
SettingSetGlobal_i(G, cSetting_auto_zoom, auto_save); SettingSetGlobal_i(G, cSetting_auto_zoom, auto_save);
} }
static void ExecutivePurgeSpec(PyMOLGlobals * G, SpecRec * rec) static void ExecutivePurgeSpec(PyMOLGlobals * G, SpecRec * rec)
{ {
CExecutive *I = G->Executive; CExecutive *I = G->Executive;
if (rec->gridSlotSelIndicatorsCGO){
CGOFree(rec->gridSlotSelIndicatorsCGO); CGOFree(rec->gridSlotSelIndicatorsCGO);
rec->gridSlotSelIndicatorsCGO = NULL;
}
if(rec->group_name[0]) { if(rec->group_name[0]) {
/* cascade group members up to the surrounding group */ /* cascade group members up to the surrounding group */
SpecRec *rec2 = NULL; SpecRec *rec2 = NULL;
while(ListIterate(I->Spec, rec2, next)) { while(ListIterate(I->Spec, rec2, next)) {
if((rec2->group == rec) || WordMatchExact(G, rec->name, rec2->group_name, true)) { if((rec2->group == rec) || WordMatchExact(G, rec->name, rec2->group_name, true)) {
strcpy(rec2->group_name, rec->group_name); strcpy(rec2->group_name, rec->group_name);
} }
} }
} else if((rec->type == cExecObject) && (rec->obj->type == cObjectGroup)) { } else if((rec->type == cExecObject) && (rec->obj->type == cObjectGroup)) {
/* and/or delete their group membership */ /* and/or delete their group membership */
skipping to change at line 14833 skipping to change at line 14823
break; break;
} }
} }
SelectorDefragment(G); SelectorDefragment(G);
break; break;
} }
} }
} }
TrackerDelList(I_Tracker, list_id); TrackerDelList(I_Tracker, list_id);
TrackerDelIter(I_Tracker, iter_id); TrackerDelIter(I_Tracker, iter_id);
// fix for PYMOL-757 - Note: This should probably go somewhere else, but we
// couldn't figure out the correct place so far
ExecutiveUpdateGroups(G, false); ExecutiveUpdateGroups(G, false);
} }
/*========================================================================*/ /*========================================================================*/
void ExecutiveDump(PyMOLGlobals * G, const char *fname, const char *obj) void ExecutiveDump(PyMOLGlobals * G, const char *fname, const char *obj)
{ {
SpecRec *rec = NULL; SpecRec *rec = NULL;
CExecutive *I = G->Executive; CExecutive *I = G->Executive;
SceneUpdate(G, false); SceneUpdate(G, false);
skipping to change at line 15128 skipping to change at line 15121
static int ExecutiveClick(Block * block, int button, int x, int y, int mod) static int ExecutiveClick(Block * block, int button, int x, int y, int mod)
{ {
PyMOLGlobals *G = block->G; PyMOLGlobals *G = block->G;
CExecutive *I = G->Executive; CExecutive *I = G->Executive;
int n, a; int n, a;
SpecRec *rec = NULL; SpecRec *rec = NULL;
PanelRec *panel = NULL; PanelRec *panel = NULL;
int t, xx; int t, xx;
int pass = false; int pass = false;
int skip; int skip;
int ExecLineHeight = SettingGetGlobal_i(G, cSetting_internal_gui_control_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);
} }
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);
skipping to change at line 15391 skipping to change at line 15384
case cObjectMesh: case cObjectMesh:
MenuActivate(G, mx, my, x, y, false, "obj_motion", namesele) ; MenuActivate(G, mx, my, x, y, false, "obj_motion", namesele) ;
break; break;
} }
break; break;
} }
break; break;
} }
} else { /* clicked in variable area */ } else { /* clicked in variable area */
if(((panel->is_group) && (((xx) - 1) / 8) > (panel->nest_level + 1 if(((panel->is_group) && (((xx) - 1) / DIP2PIXEL(8)) > (panel->nes
)) || t_level + 1)) ||
((!panel->is_group) && (((xx) - 1) / 8) > panel->nest_level)) { ((!panel->is_group) && (((xx) - 1) / DIP2PIXEL(8)) > panel->nes
t_level)) {
/* clicked on name */ /* clicked on name */
rec->hilight = 1; rec->hilight = 1;
switch (button) { switch (button) {
case P_GLUT_LEFT_BUTTON: case P_GLUT_LEFT_BUTTON:
I->Pressed = n; I->Pressed = n;
I->OldVisibility = rec->visible; I->OldVisibility = rec->visible;
I->Over = n; I->Over = n;
I->DragMode = 1; I->DragMode = 1;
I->ToggleMode = 0; I->ToggleMode = 0;
skipping to change at line 15669 skipping to change at line 15662
/*while(ListIterate(I->Spec,rec,next)) { */ /*while(ListIterate(I->Spec,rec,next)) { */
while(ListIterate(I->Panel, panel, next)) { while(ListIterate(I->Panel, panel, next)) {
rec = panel->spec; rec = panel->spec;
if((rec->name[0] != '_') || (!hide_underscore)) { if((rec->name[0] != '_') || (!hide_underscore)) {
if(skip) { if(skip) {
skip--; skip--;
} else { } else {
if((I->PressedWhat == 1) && if((I->PressedWhat == 1) &&
(((panel->is_group) && ((xx - 1) / 8) > (panel->nest_level + 1)) (((panel->is_group) && ((xx - 1) / DIP2PIXEL(8)) > (panel->nest_l
|| evel + 1)) ||
((!panel->is_group) && ((xx - 1) / 8) > panel->nest_level))) { ((!panel->is_group) && ((xx - 1) / DIP2PIXEL(8)) > panel->nest_l
evel))) {
/* over name */ /* over name */
if(rec->hilight == 1) { if(rec->hilight == 1) {
if(rec->type == cExecSelection) { if(rec->type == cExecSelection) {
ExecutiveSpecSetVisibility(G, rec, !I->OldVisibility, 0, false ); ExecutiveSpecSetVisibility(G, rec, !I->OldVisibility, 0, false );
} else { } else {
ExecutiveSpecSetVisibility(G, rec, !I->OldVisibility, mod, tru e); ExecutiveSpecSetVisibility(G, rec, !I->OldVisibility, mod, tru e);
} }
} }
} else if((I->PressedWhat == 2) && (panel->is_group)) { } else if((I->PressedWhat == 2) && (panel->is_group)) {
if(rec->hilight == 2) { if(rec->hilight == 2) {
skipping to change at line 15726 skipping to change at line 15719
PyMOL_NeedRedisplay(G->PyMOL); PyMOL_NeedRedisplay(G->PyMOL);
return (1); return (1);
} }
/*========================================================================*/ /*========================================================================*/
static int ExecutiveDrag(Block * block, int x, int y, int mod) static int ExecutiveDrag(Block * block, int x, int y, int mod)
{ {
PyMOLGlobals *G = block->G; PyMOLGlobals *G = block->G;
CExecutive *I = G->Executive; CExecutive *I = G->Executive;
int xx, t; int xx, t;
int ExecLineHeight = SettingGetGlobal_i(G, cSetting_internal_gui_control_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);
ExecutiveUpdateGroups(G, false); ExecutiveUpdateGroups(G, false);
ExecutiveUpdatePanelList(G); ExecutiveUpdatePanelList(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 SceneDeferDrag(SceneGetBlock(G), x, y, mod); return SceneDeferDrag(SceneGetBlock(G), x, y, mod);
} }
skipping to change at line 15774 skipping to change at line 15767
int row = 0; int row = 0;
while(ListIterate(I->Panel, panel, next)) { while(ListIterate(I->Panel, panel, next)) {
rec = panel->spec; rec = panel->spec;
if((rec->name[0] != '_') || (!hide_underscore)) { if((rec->name[0] != '_') || (!hide_underscore)) {
if(skip) { if(skip) {
skip--; skip--;
} else { } else {
if(rec == I->RecoverPressed) { if(rec == I->RecoverPressed) {
I->Pressed = row; I->Pressed = row;
I->RecoverPressed = false; I->RecoverPressed = NULL;
} }
row++; row++;
} }
} }
} }
} }
if(I->PressedWhat == 2) { if(I->PressedWhat == 2) {
I->OverWhat = 0; I->OverWhat = 0;
} }
skipping to change at line 15807 skipping to change at line 15800
if((rec->name[0] != '_') || (!hide_underscore)) { if((rec->name[0] != '_') || (!hide_underscore)) {
if(skip) { if(skip) {
skip--; skip--;
} else { } else {
rec->hilight = 0; rec->hilight = 0;
if((I->PressedWhat == 1) && /* name button */ if((I->PressedWhat == 1) && /* name button */
(((row >= I->Over) && (row <= I->Pressed)) || (((row >= I->Over) && (row <= I->Pressed)) ||
((row >= I->Pressed) && (row <= I->Over)))) { ((row >= I->Pressed) && (row <= I->Over)))) {
if(((panel->is_group) && ((xx - 1) / 8) > (panel->nest_level + if(((panel->is_group) && ((xx - 1) / DIP2PIXEL(8)) > (panel->n
1)) || est_level + 1)) ||
((!panel->is_group) && ((xx - 1) / 8) > panel->nest_level)) ((!panel->is_group) && ((xx - 1) / DIP2PIXEL(8)) > panel->n
{ est_level)) {
/* dragged over name */ /* dragged over name */
I->OverWhat = 1; I->OverWhat = 1;
switch (I->ToggleMode) { switch (I->ToggleMode) {
case 0: case 0:
if(row || (row == I->Pressed)) if(row || (row == I->Pressed))
rec->hilight = 1; rec->hilight = 1;
break; break;
case 1: case 1:
skipping to change at line 15843 skipping to change at line 15836
if(rec != I->LastZoomed) if(rec != I->LastZoomed)
ExecutiveWindowZoom(G, rec->name, 0.0F, -1, false, - 1.0F, ExecutiveWindowZoom(G, rec->name, 0.0F, -1, false, - 1.0F,
true); true);
I->LastZoomed = rec; I->LastZoomed = rec;
} }
} }
break; break;
} }
} }
} else if((row == I->Pressed) && (I->PressedWhat == 2)) { } else if((row == I->Pressed) && (I->PressedWhat == 2)) {
if(!((panel->is_group) && ((xx - 1) / 8) > (panel->nest_level + 1))) { if(!((panel->is_group) && ((xx - 1) / DIP2PIXEL(8)) > (panel-> nest_level + 1))) {
/* on group control */ /* on group control */
I->OverWhat = 2; I->OverWhat = 2;
if(I->PressedWhat == I->OverWhat) { if(I->PressedWhat == I->OverWhat) {
rec->hilight = 2; rec->hilight = 2;
} }
} else { } else {
I->OverWhat = 0; I->OverWhat = 0;
} }
skipping to change at line 16168 skipping to change at line 16161
float toggleColor3[3] = { 0.6F, 0.6F, 0.8F }; float toggleColor3[3] = { 0.6F, 0.6F, 0.8F };
#endif #endif
SpecRec *rec = NULL; SpecRec *rec = NULL;
PanelRec *panel = NULL; PanelRec *panel = NULL;
CExecutive *I = G->Executive; CExecutive *I = G->Executive;
int n_ent; int n_ent;
int n_disp; int n_disp;
int skip = 0; int skip = 0;
int row = -1; int row = -1;
int ExecLineHeight = SettingGetGlobal_i(G, cSetting_internal_gui_control_size) int ExecLineHeight = DIP2PIXEL(SettingGetGlobal_i(G, cSetting_internal_gui_con
; trol_size));
int text_lift = (ExecLineHeight / 2) - 5; int text_lift = (ExecLineHeight / 2) - DIP2PIXEL(5);
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);
int full_names = SettingGetGlobal_b(G, cSetting_group_full_member_names); int full_names = SettingGetGlobal_b(G, cSetting_group_full_member_names);
int arrows = SettingGetGlobal_b(G, cSetting_group_arrow_prefix); int arrows = SettingGetGlobal_b(G, cSetting_group_arrow_prefix);
ExecutiveUpdatePanelList(G); ExecutiveUpdatePanelList(G);
/* if we're running with a GUI and have a valid panel */ /* if we're running with a GUI and have a valid panel */
if(G->HaveGUI && G->ValidContext && ((block->rect.right - block->rect.left) > 6) if(G->HaveGUI && G->ValidContext && ((block->rect.right - block->rect.left) > 6)
&& I->ValidPanel) { && I->ValidPanel) {
skipping to change at line 16228 skipping to change at line 16221
I->NSkip = 0; I->NSkip = 0;
} }
/* determination of longest string based on internal_gui_size, etc... */ /* determination of longest string based on internal_gui_size, etc... */
max_char = max_char =
(((I->Block->rect.right - I->Block->rect.left) - (((I->Block->rect.right - I->Block->rect.left) -
(ExecLeftMargin + ExecRightMargin + 4)) - (op_cnt * ExecToggleWidth)); (ExecLeftMargin + ExecRightMargin + 4)) - (op_cnt * ExecToggleWidth));
if(I->ScrollBarActive) { if(I->ScrollBarActive) {
max_char -= (ExecScrollBarMargin + ExecScrollBarWidth); max_char -= (ExecScrollBarMargin + ExecScrollBarWidth);
} }
max_char /= 8; max_char /= DIP2PIXEL(8);
/* fill and outline the entire block */ /* fill and outline the entire block */
if(SettingGetGlobal_b(G, cSetting_internal_gui_mode) == 0) { if(SettingGetGlobal_b(G, cSetting_internal_gui_mode) == 0) {
if (orthoCGO) if (orthoCGO)
CGOColorv(orthoCGO, I->Block->BackColor); CGOColorv(orthoCGO, I->Block->BackColor);
else else
glColor3fv(I->Block->BackColor); glColor3fv(I->Block->BackColor);
BlockFill(I->Block ORTHOCGOARGVAR); BlockFill(I->Block ORTHOCGOARGVAR);
BlockDrawLeftEdge(I->Block ORTHOCGOARGVAR); BlockDrawLeftEdge(I->Block ORTHOCGOARGVAR);
} }
skipping to change at line 16370 skipping to change at line 16363
} }
} }
/* end ASHLC */ /* end ASHLC */
#endif #endif
{ {
int x3 = x; int x3 = x;
int hidden_prefix = false; int hidden_prefix = false;
TextSetColor(G, I->Block->TextColor); TextSetColor(G, I->Block->TextColor);
TextSetPos2i(G, x3 + 2, y2 + text_lift); TextSetPos2i(G, x3 + DIP2PIXEL(2), y2 + text_lift);
if((rec->type == cExecObject) || if((rec->type == cExecObject) ||
(rec->type == cExecAll) || (rec->type == cExecSelection)) { (rec->type == cExecAll) || (rec->type == cExecSelection)) {
y2 = y; y2 = y;
x2 = xx; x2 = xx;
if((x - ExecToggleMargin) - (xx - ExecToggleMargin) > -10) { if((x - ExecToggleMargin) - (xx - ExecToggleMargin) > DIP2PIXEL(-1
x2 = x + 10; 0)) {
x2 = x + DIP2PIXEL(10);
} }
x3 += panel->nest_level * 8; x3 += panel->nest_level * DIP2PIXEL(8);
TextSetPos2i(G, x3 + 2, y2 + text_lift); TextSetPos2i(G, x3 + DIP2PIXEL(2), y2 + text_lift);
nChar -= panel->nest_level; nChar -= panel->nest_level;
{ {
int but_width = (x2 - x3) - 1; int but_width = (x2 - x3) - 1;
/* drawing a group +/- NAME */ /* drawing a group +/- NAME */
if(panel->is_group) { if(panel->is_group) {
const int button_width = DIP2PIXEL(15);
if((rec->hilight == 2) && (I->Over == I->Pressed)) { if((rec->hilight == 2) && (I->Over == I->Pressed)) {
draw_button(x3, y2, 15, (ExecLineHeight - 1), lightEdge, dar kEdge, draw_button(x3, y2, button_width, (ExecLineHeight - 1), ligh tEdge, darkEdge,
pressedColor ORTHOCGOARGVAR); pressedColor ORTHOCGOARGVAR);
} else if(panel->is_open) { } else if(panel->is_open) {
draw_button(x3, y2, 15, (ExecLineHeight - 1), lightEdge, dar kEdge, draw_button(x3, y2, button_width, (ExecLineHeight - 1), ligh tEdge, darkEdge,
disabledColor ORTHOCGOARGVAR); disabledColor ORTHOCGOARGVAR);
} else { } else {
draw_button(x3, y2, 15, (ExecLineHeight - 1), lightEdge, dar kEdge, draw_button(x3, y2, button_width, (ExecLineHeight - 1), ligh tEdge, darkEdge,
disabledColor ORTHOCGOARGVAR); disabledColor ORTHOCGOARGVAR);
} }
TextSetPos2i(G, x3 + DIP2PIXEL(4), y2 + text_lift);
#define cControlBoxSize 17
#define cControlLeftMargin 8
#define cControlTopMargin 2
#define cControlSpacing 2
#define cControlInnerMargin 4
#define cControlSpread 6
#define cControlSize 160
TextSetPos2i(G, x3 + 4, y2 + text_lift);
if(panel->is_open) { if(panel->is_open) {
TextDrawChar(G, '-' ORTHOCGOARGVAR); TextDrawChar(G, '-' ORTHOCGOARGVAR);
} else { } else {
TextDrawChar(G, '+' ORTHOCGOARGVAR); TextDrawChar(G, '+' ORTHOCGOARGVAR);
} }
but_width -= 16; but_width -= DIP2PIXEL(16);
x3 += 16; x3 += DIP2PIXEL(16);
nChar -= 2; nChar -= 2;
TextSetPos2i(G, x3 + 2, y2 + text_lift); TextSetPos2i(G, x3 + DIP2PIXEL(2), y2 + text_lift);
} }
if((rec->hilight == 1) || ((row == I->Over) && (I->OverWhat == 1 ))) { if((rec->hilight == 1) || ((row == I->Over) && (I->OverWhat == 1 ))) {
/* button hull */ /* button hull */
draw_button(x3, y2, but_width, (ExecLineHeight - 1), lightEdge , draw_button(x3, y2, but_width, (ExecLineHeight - 1), lightEdge ,
darkEdge, pressedColor ORTHOCGOARGVAR); darkEdge, pressedColor ORTHOCGOARGVAR);
} else if(rec->visible) { } else if(rec->visible) {
int enabled = true; int enabled = true;
SpecRec *group_rec = rec->group; SpecRec *group_rec = rec->group;
while(enabled && group_rec) { while(enabled && group_rec) {
skipping to change at line 16480 skipping to change at line 16465
if((nChar--) > 0) { if((nChar--) > 0) {
TextDrawChar(G, '(' ORTHOCGOARGVAR); TextDrawChar(G, '(' ORTHOCGOARGVAR);
} }
} }
if(c) { if(c) {
if(hidden_prefix) { if(hidden_prefix) {
/* ^.name */ /* ^.name */
if(arrows && ((nChar--) > 0)) { if(arrows && ((nChar--) > 0)) {
TextDrawChar(G, '^' ORTHOCGOARGVAR); TextDrawChar(G, '^' ORTHOCGOARGVAR);
TextSetPos2i(G, x3 + 2, y2 + text_lift); TextSetPos2i(G, x3 + DIP2PIXEL(2), y2 + text_lift);
TextDrawChar(G, '|' ORTHOCGOARGVAR); TextDrawChar(G, '|' ORTHOCGOARGVAR);
} }
} }
/* draw the object name, char by char */ /* draw the object name, char by char */
while(*c) { while(*c) {
if((nChar--) > 0) { if((nChar--) > 0) {
TextDrawChar(G, *(c++) ORTHOCGOARGVAR); TextDrawChar(G, *(c++) ORTHOCGOARGVAR);
} }
else else
skipping to change at line 16513 skipping to change at line 16498
/* OBJECTS: output any label captions, like state number, state title */ /* OBJECTS: output any label captions, like state number, state title */
if(rec->type == cExecObject) { if(rec->type == cExecObject) {
if(rec->obj->fGetCaption) { if(rec->obj->fGetCaption) {
/* get this object's "caption" that goes on its title line, /* get this object's "caption" that goes on its title line,
* currently, this is "state-title [curState/nState]" */ * currently, this is "state-title [curState/nState]" */
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 + 2 + 8 * (max_char - nChar), 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) while(*c && nChar > 0) {
if((nChar--) > 0) {
/* allow color encoding for names */ /* allow color encoding for names */
if((*c == '\\') && (*(c + 1)) && (*(c + 2)) && (*(c + 3))) { if((*c == '\\') && (*(c + 1)) && (*(c + 2)) && (*(c + 3))) {
TextSetColor3f(G, (*(c + 1) - '0') / 9.0F, (*(c + 2) - '0') / 9.0F, TextSetColor3f(G, (*(c + 1) - '0') / 9.0F, (*(c + 2) - '0') / 9.0F,
(*(c + 3) - '0') / 9.0F); (*(c + 3) - '0') / 9.0F);
c += 4; c += 4;
} } else {
TextDrawChar(G, *(c++) ORTHOCGOARGVAR); TextDrawChar(G, *(c++) ORTHOCGOARGVAR);
--nChar;
} }
else }
break;
} }
/* I added this to fix a string clearing problem,
* but it then caused an issue with groups. Interestingly,
* removing this fixes the bug and no longer makes the other bug */
/* c[0] = 0; */
} }
} }
y -= ExecLineHeight; y -= ExecLineHeight;
if(y < (I->Block->rect.bottom)) if(y < (I->Block->rect.bottom))
break; break;
} }
} }
} }
I->HowFarDown = y; I->HowFarDown = y;
skipping to change at line 16761 skipping to change at line 16741
} else } else
return 0; return 0;
} }
/*========================================================================*/ /*========================================================================*/
void ExecutiveFree(PyMOLGlobals * G) void ExecutiveFree(PyMOLGlobals * G)
{ {
CExecutive *I = G->Executive; CExecutive *I = G->Executive;
SpecRec *rec = NULL; SpecRec *rec = NULL;
if (I->selIndicatorsCGO)
CGOFree(I->selIndicatorsCGO); CGOFree(I->selIndicatorsCGO);
I->selIndicatorsCGO = NULL;
while(ListIterate(I->Spec, rec, next)) { while(ListIterate(I->Spec, rec, next)) {
if(rec->type == cExecObject) if(rec->type == cExecObject)
rec->obj->fFree(rec->obj); rec->obj->fFree(rec->obj);
} }
ListFree(I->Spec, next, SpecRec); ListFree(I->Spec, next, SpecRec);
ListFree(I->Panel, next, PanelRec); ListFree(I->Panel, next, PanelRec);
if(I->Tracker) if(I->Tracker)
TrackerFree(I->Tracker); TrackerFree(I->Tracker);
if(I->ScrollBar) if(I->ScrollBar)
ScrollBarFree(I->ScrollBar); ScrollBarFree(I->ScrollBar);
 End of changes. 97 change blocks. 
208 lines changed or deleted 190 lines changed or added

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