Skip to content

Commit

Permalink
stick_round_nub, UTF-8, display_scale_factor, ...
Browse files Browse the repository at this point in the history
* stick_round_nub for COLLADA export
* UTF-8 in feedback
* display_scale_factor (ported from Incentive PyMOL)
* dx map import: support "type float" and skewed delta
  • Loading branch information
speleo3 committed Feb 28, 2018
1 parent e2df29a commit 4bbe425
Show file tree
Hide file tree
Showing 109 changed files with 1,535 additions and 1,183 deletions.
10 changes: 10 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@
CHANGE LOG
=========================================================================

2018-02-28 Thomas Holder <[email protected]>

* stick_round_nub for COLLADA export

* UTF-8 in feedback

* display_scale_factor (ported from Incentive PyMOL)

* dx map import: support "type float" and skewed delta

2018-02-07 Thomas Holder <[email protected]>

* new selection keywords: polymer.protein polymer.nucleic
Expand Down
20 changes: 4 additions & 16 deletions layer0/Base.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,6 @@ Z* -------------------------------------------------------------------
#include"os_limits.h"
#include"os_types.h"

#ifndef true
#define true 1
#endif

#ifndef false
#define false 0
#endif

#ifndef NULL
#define NULL ((void*)0)
#endif
Expand All @@ -37,13 +29,9 @@ Z* -------------------------------------------------------------------
#define PI 3.14159265358979323846
#endif

#ifndef uchar
#define uchar unsigned char
#endif
typedef unsigned char uchar;

#ifndef uint
#define uint unsigned int
#endif
typedef unsigned int uint;

#define MAX_VDW 2.5F /* this has to go */

Expand All @@ -60,7 +48,7 @@ Z* -------------------------------------------------------------------
#endif

typedef struct {
int index; /* atom index.
unsigned int index; /* atom index.
NOTE: that first record contains the list count...not pick info */
int bond; /* bond index,
>=0 for bond
Expand Down Expand Up @@ -125,7 +113,7 @@ typedef struct _CRay CRay;
/* likewise */

#ifndef CGO_DEFINED
typedef struct _CGO CGO;
class CGO;
#define CGO_DEFINED
#endif

Expand Down
9 changes: 0 additions & 9 deletions layer0/Crystal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ Z* -------------------------------------------------------------------

PyObject *CrystalAsPyList(CCrystal * I)
{
#ifdef _PYMOL_NOPY
return NULL;
#else
PyObject *result = NULL;

if(I) {
Expand All @@ -42,14 +39,10 @@ PyObject *CrystalAsPyList(CCrystal * I)
PyList_SetItem(result, 1, PConvFloatArrayToPyList(I->Angle, 3));
}
return (PConvAutoNone(result));
#endif
}

int CrystalFromPyList(CCrystal * I, PyObject * list)
{
#ifdef _PYMOL_NOPY
return 0;
#else
int ok = true, rok = true;
int ll = 0;
if(ok)
Expand All @@ -70,8 +63,6 @@ int CrystalFromPyList(CCrystal * I, PyObject * list)
Always check ll when adding new PyList_GetItem's */

return (rok);
#endif

}

void CrystalFree(CCrystal * I)
Expand Down
2 changes: 1 addition & 1 deletion layer0/Crystal.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Z* -------------------------------------------------------------------
#define _H_Crystal

#include"Vector.h"
#include"CGOStruct.h"
#include"Base.h"
#include"os_python.h"

typedef struct {
Expand Down
10 changes: 3 additions & 7 deletions layer0/Err.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,11 @@ void ErrFatal(const PyMOLGlobals *, const char *where, const char *what)

int ErrMessage(PyMOLGlobals * G, const char *where, const char *what)
{
char buffer[1024];
if(Feedback(G, FB_Executive, FB_Errors)) {

/* unclassified errors are assigned to the Executive catch-all */

sprintf(buffer, "%s-Error: %s\n", where, what);
OrthoAddOutput(G, buffer);
OrthoRestorePrompt(G);
}
PRINTFB(G, FB_Executive, FB_Errors)
"%s-Error: %s\n", where, what
ENDFB(G);
return (0);
}

Expand Down
7 changes: 6 additions & 1 deletion layer0/Feedback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,15 @@ void FeedbackEnable(PyMOLGlobals * G, unsigned int sysmod, unsigned char mask)
void FeedbackAutoAdd(PyMOLGlobals * G, unsigned int sysmod, unsigned char mask, const char *str)
{
if(Feedback(G, sysmod, mask))
OrthoAddOutput(G, str);
FeedbackAddColored(G, str, mask);
}

void FeedbackAdd(PyMOLGlobals * G, const char *str)
{
OrthoAddOutput(G, str);
}

void FeedbackAddColored(PyMOLGlobals * G, const char *str, unsigned char mask)
{
FeedbackAdd(G, str);
}
1 change: 1 addition & 0 deletions layer0/Feedback.h
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ void FeedbackPop(PyMOLGlobals * G);
void FeedbackAutoAdd(PyMOLGlobals * G, unsigned int sysmod, unsigned char mask,
const char *str);
void FeedbackAdd(PyMOLGlobals * G, const char *str);
void FeedbackAddColored(PyMOLGlobals * G, const char *str, unsigned char mask);

void FeedbackSetMask(PyMOLGlobals * G, unsigned int sysmod, unsigned char mask);
void FeedbackDisable(PyMOLGlobals * G, unsigned int sysmod, unsigned char mask);
Expand Down
27 changes: 26 additions & 1 deletion layer0/File.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
* Basic file IO.
*/

#ifdef _WIN32
#include <vector>
#include <Windows.h>
#endif

#include <stdio.h>
#include <stdlib.h>

Expand Down Expand Up @@ -44,13 +49,33 @@ static char * fgetcontents(FILE *fp, long *size) {
return contents;
}

#ifdef _WIN32
FILE * pymol_fopen(const char * filename, const char * mode) {
FILE *fp = fopen(filename, mode);

if (!fp) {
size_t len_filename = strlen(filename);
std::vector<wchar_t> wfilename(len_filename + 1);
std::vector<wchar_t> wmode(mode, mode + strlen(mode) + 1);

if (!MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS,
filename, len_filename, wfilename.data(), wfilename.size()))
return NULL;

fp = _wfopen(wfilename.data(), wmode.data());
}

return fp;
}
#endif

/*
* Allocate memory and read the entire file for the given filename.
* The file size is stored into the size pointer if not NULL.
*/
char * FileGetContents(const char *filename, long *size) {
char *contents;
FILE *fp = fopen(filename, "rb");
FILE *fp = pymol_fopen(filename, "rb");

if (!fp)
return NULL;
Expand Down
6 changes: 6 additions & 0 deletions layer0/File.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
#ifndef _H_File
#define _H_File

#ifdef _WIN32
FILE * pymol_fopen(const char * filename, const char * mode);
#else
#define pymol_fopen fopen
#endif

char * FileGetContents(const char *filename, long *size);

#endif
3 changes: 1 addition & 2 deletions layer0/Matrix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1176,7 +1176,7 @@ float MatrixFitRMSTTTf(PyMOLGlobals * G, int n, const float *v1, const float *v2

/* Primary iteration scheme to determine rotation matrix for molecule 2 */
double sg, bb, cc;
int iters, ix, iy, iz, unchanged = 0;
int iters, iy, iz, unchanged = 0;
double sig, gam;
double tmp;
double save[3][3];
Expand All @@ -1196,7 +1196,6 @@ float MatrixFitRMSTTTf(PyMOLGlobals * G, int n, const float *v1, const float *v2
/* IX, IY, and IZ rotate 1-2-3, 2-3-1, 3-1-2, etc. */
iz = (iters + 1) % 3;
iy = (iz + 1) % 3;
ix = (iy + 1) % 3;
sig = aa[iz][iy] - aa[iy][iz];
gam = aa[iy][iy] + aa[iz][iz];

Expand Down
Loading

0 comments on commit 4bbe425

Please sign in to comment.