/**************************************************************************** ** ** Copyright (C) 2011 Christian B. Huebschle & George M. Sheldrick ** All rights reserved. ** Contact: chuebsch@moliso.de ** ** This file is part of the ShelXle ** ** This file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file COPYING included in the ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** ****************************************************************************/ #ifndef EACDLG_H #define EACDLG_H #include #include #include #include #include #include #include //#include <> #include #include "molecule.h" #include "psewidget.h" #include "opengltestwidget.h" /*! \brief EacGLW is the QGLWidget of the Edit Atom Styles Dialog EacDlg. * * EacGLW displays a sp3 like molecule. The 'molecule' consists of a central atom with anisotrop ADP and a neighboring atom without ADP * (displayed as a ball) both are from the same changeable type. Attached to the central atom are also 3 hydrogen atoms. The molecule * rotates continously around its own axis which itself rotates as well. This widget demonstates the look and feel of an atom specific * setting which can be changed in the EacDlg. 3 Q-Peaks are displayed arround the molecule. */ /* class EacGLW: public QOpenGLWidget { Q_OBJECT public: explicit EacGLW( Molecule *externMole,QWidget * parent = 0); QOpenGLShaderProgram *saveProgram; Molecule *mol;//!< pointer to ShelXle's Molecule object. double exmin,//!< Minimal Q-Peak electron density value of shelXle to be restored when the dialog is closed. exmax;//!< Maximal Q-Peak electron density value of shelXle to be restored when the dialog is closed. CEnvironment xd;//!< MyAtom list of the molecule Connection bonds;//!< MyBond list of the molecule int proba;//!< probability level of the ellipsoids. //EacGLW(const MyAtom *atom,Molecule *externMole); QFont myFont;//!< a font for the atom labels //QStringList pse; PSEWidget *psew; QSettings *einstellung; void qglColor(const QColor c); void renderText(double x, double y, double z, const QString &str); void setMSAA(bool); inline QString glError2String(GLenum err){ switch (err) { case GL_NO_ERROR: return QString("GL_NO_ERROR: No OpenGL error."); break; case GL_INVALID_ENUM: return QString("GL_INVALID_ENUM: An enumeration parameter is not a legal enumeration for that function."); break; case GL_INVALID_VALUE: return QString("GL_INVALID_VALUE: Given when a value parameter is not a legal value for that function."); break; case GL_INVALID_OPERATION: return QString("GL_INVALID_OPERATION: Given when the set of state for a command is not legal for the parameters given to that command."); break; case GL_STACK_OVERFLOW: return QString("GL_STACK_OVERFLOW: Given when a stack pushing operation cannot be done because it would overflow the limit of that stack's size."); break; case GL_STACK_UNDERFLOW: return QString("GL_STACK_UNDERFLOW: Given when a stack popping operation cannot be done because the stack is already at its lowest point."); break; case GL_OUT_OF_MEMORY: return QString("GL_OUT_OF_MEMORY: Given when performing an operation that can allocate memory, and the memory cannot be allocated."); break; default : return QString("Some other OpenGL error."); break; } } protected: void initializeGL(); void resizeGL(int width, int height); void paintGL(); public slots: void changeAtom(int OZ, bool HisD);//!< changes the atom type of the central atom in OZ @param OZ atomic number (staring from zero) of the new atom void colorDLG();//!< changes the color of an atom type void wallA(int st);//!< wallA changes the state of the ellipsoid wall. @param st is the checkbox state of the calling QCheckBox. void ringA(int st);//!< ringA changes the state of the principal ellipses. @param st is the checkbox state of the calling QCheckBox. void spheA(int st);//!< spheA changes the state of the ellipsoid surface. @param st is the checkbox state of the calling QCheckBox. void soldA(int st);//!< soldA changes the transparence state of the ellipsoid surface. @param st is the checkbox state of the calling QCheckBox. void nolaA(int st);//!< nolaA changes the state of the atom labels @param st is the checkbox state of the calling QCheckBox. void whitA(int st);//!< whitA changes the color of the principal ellipses from black to white. @param st is the checkbox state of the calling QCheckBox. void metalA(int st);//!< metalA changes the state of the bond to without this feature checked on into stipled style @param st is the checkbox state of the calling QCheckBox. private: GLint vp[4]; void draw(); double retinafktr = 1; void project(double x, double y, double z, GLdouble &tx, GLdouble &ty); static inline void transform_point(GLdouble out[4], const GLdouble m[16], const GLdouble in[4]); static inline bool posTo2D(V3 obj, const GLdouble model[16], const GLdouble proj[16], const GLint viewport[4], GLdouble &winx, GLdouble &winy,double retinafktr); QColor backGroundColor; QColor labelColor; }; */ /*! \brief MultiStyle a small dialog called in EacDlg to change the style of multiple elements at once. */ class MultiStyle: public QDialog { Q_OBJECT public: MultiStyle(Molecule *externMole); QCheckBox *walbx; //!beginGroup("Colors"); einstellung->setValue("LabelColor",ogl->labelColor); einstellung->setValue("LabelBGColor",ogl->labelBGColor); einstellung->setValue("focusedLabelBGColor", ogl->focusedLabelBGColor);; einstellung->setValue("focusedLabelColor", ogl->focusedLabelColor); einstellung->setValue("selectedLabelBGColor", ogl->selectedLabelBGColor);; einstellung->setValue("selectedLabelColor", ogl->selectedLabelColor); einstellung->setValue("BackGroundColor",ogl->backGroundColor); einstellung->endGroup(); update(); ogl->makeLabels(); ogl->update(); } bool areLabelsShort(){return ogl->shortLabels->isChecked();} //EacDlg(MyAtom *onlyThisAtom,Molecule *externMole); signals: void colorchanged(QColor bgcolor);//!< colorchanged is emitted by the color dialog colorDLG to change the color of a chemical element. @param bgcolor the new color void statesChanged(); public slots: void colorDLG2();//!< opens the bond color dialog. void colorDLGLabel(); void colorDLGFLabel(); void colorDLGSLabel(); void bgColorDLGLabel(); void bgColorDLGFLabel(); void bgColorDLGSLabel(); void labelColorAlpha(int a); void slabelColorAlpha(int a); void flabelColorAlpha(int a); void labelBGColorAlpha(int a); void slabelBGColorAlpha(int a); void flabelBGColorAlpha(int a); void changeLabelFont(); void colorDLGenvibon(); void colorDLGenvidef(); void colorDLGenvihbo(); void colorchange(QColor bgcolor);//!< changes the color of the current element to bgcolor. Changes the color of the corresponding button. void updateLEs(int OZ = 5, bool HisD = false);//!< when the current element changes the settings of this element are loaded and applied to the EacGLW widget and the PSEWidget. @param OZ atomic number (staring from zero) of the new atom void checkWall();//!< when solid is checked then solid is unchecked. //void checkShader(bool b); void checkSolid();//!< when walls are checked solid is unchecked. void checkBall();//!< when ellipsoid surface is unchecked the solid checkbox is diabled. void doMulti();//!< calls MultiStyle dialog void unicolor(bool b);//!< the bonds shall have a uniq color. void woADP(bool b);//!< the elemen shall be shown without ADP ellispoids. void probaChanged(int ix);//!< The ellipsoid probability is changed to ix. void strengthChanged(double d);//!< the bond thicknes is changed to d. void qStrengthChanged(double d);//!< the bond thicknes is changed to d. void QPeakRadChanged(double d);//!< QPeak size is changed to d. void lodChanged(int d);//!< the level of detail is changed to d. void kradChanged(double d);//!< the colvalent radius is changed to d. void radChanged(double d);//!< the ball radius used in ball stick mode is changed to d. void exportSettings();//!< export settings to a specified ini file. void importSettings();//!< import settings from a specified ini file. void hbdistChanged(double);//!< maximal length for H-bonds void hbanglChanged(double);//!< maximal angle for H-bonds void updateHBElemnts();//!< H-bond accepor or donor list has changed void makedemomol(); void updateShaders(); void toggleRotation(bool b){ if ((b)&&(!timer->isActive())) timer->start(20); else timer->stop(); ogl->update(); } void changeAtom(int OZ, bool HisD);//!< changes the atom type of the central atom in OZ @param OZ atomic number (staring from zero) of the new atom void colorDLG();//!< changes the color of an atom type void wallA(int st);//!< wallA changes the state of the ellipsoid wall. @param st is the checkbox state of the calling QCheckBox. void ringA(int st);//!< ringA changes the state of the principal ellipses. @param st is the checkbox state of the calling QCheckBox. void spheA(int st);//!< spheA changes the state of the ellipsoid surface. @param st is the checkbox state of the calling QCheckBox. void soldA(int st);//!< soldA changes the transparence state of the ellipsoid surface. @param st is the checkbox state of the calling QCheckBox. void nolaA(int st);//!< nolaA changes the state of the atom labels @param st is the checkbox state of the calling QCheckBox. void whitA(int st);//!< whitA changes the color of the principal ellipses from black to white. @param st is the checkbox state of the calling QCheckBox. void metalA(int st);//!< metalA changes the state of the bond to without this feature checked on into stipled style @param st is the checkbox state of the calling QCheckBox. protected slots: void accept () ; void reject () ; private: //EacGLW *eacGLW;//!