1 2 /**************************************************************************** 3 ** 4 ** Copyright (C) 2011 Christian B. Huebschle & George M. Sheldrick 5 ** All rights reserved. 6 ** Contact: chuebsch@moliso.de 7 ** 8 ** This file is part of the ShelXle 9 ** 10 ** This file may be used under the terms of the GNU Lesser 11 ** General Public License version 2.1 as published by the Free Software 12 ** Foundation and appearing in the file COPYING included in the 13 ** packaging of this file. Please review the following information to 14 ** ensure the GNU Lesser General Public License version 2.1 requirements 15 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 16 ** 17 ** 18 ****************************************************************************/ 19 #ifndef EACDLG_H 20 #define EACDLG_H 21 #include <QtGui> 22 #include "molecule.h" 23 #include "psewidget.h" 24 /*! \brief EacGLW is the QGLWidget of the Edit Atom Styles Dialog EacDlg. 25 * 26 * EacGLW displays a sp3 like molecule. The 'molecule' consists of a central atom with anisotrop ADP and a neighboring atom without ADP 27 * (displayed as a ball) both are from the same changeable type. Attached to the central atom are also 3 hydrogen atoms. The molecule 28 * rotates continously around its own axis which itself rotates as well. This widget demonstates the look and feel of an atom specific 29 * setting which can be changed in the EacDlg. 3 Q-Peaks are displayed arround the molecule. 30 */ 31 32 class EacGLW: public QGLWidget { 33 Q_OBJECT 34 public: 35 36 QGLShaderProgram *saveProgram; 37 Molecule *mol;//!< pointer to ShelXle's Molecule object. 38 double exmin,//!< Minimal Q-Peak electron density value of shelXle to be restored when the dialog is closed. 39 exmax;//!< Maximal Q-Peak electron density value of shelXle to be restored when the dialog is closed. 40 CEnvironment xd;//!< MyAtom list of the molecule 41 Connection bonds;//!< MyBond list of the molecule 42 int proba;//!< probability level of the ellipsoids. 43 EacGLW( Molecule *externMole,QWidget * parent = 0); 44 //EacGLW(const MyAtom *atom,Molecule *externMole); 45 QFont myFont;//!< a font for the atom labels 46 //QStringList pse; 47 QTimer *timer;//!< a timer for the molecule rotation 48 void setMSAA(bool); 49 signals: 50 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 51 protected: 52 void initializeGL(); 53 void resizeGL(int width, int height); 54 void paintGL(); 55 public slots: 56 void changeAtom(int OZ);//!< changes the atom type of the central atom in OZ @param OZ atomic number (staring from zero) of the new atom 57 void colorDLG();//!< changes the color of an atom type 58 void wallA(int st);//!< wallA changes the state of the ellipsoid wall. @param st is the checkbox state of the calling QCheckBox. 59 void ringA(int st);//!< ringA changes the state of the principal ellipses. @param st is the checkbox state of the calling QCheckBox. 60 void spheA(int st);//!< spheA changes the state of the ellipsoid surface. @param st is the checkbox state of the calling QCheckBox. 61 void soldA(int st);//!< soldA changes the transparence state of the ellipsoid surface. @param st is the checkbox state of the calling QCheckBox. 62 void nolaA(int st);//!< nolaA changes the state of the atom labels @param st is the checkbox state of the calling QCheckBox. 63 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. 64 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. 65 private: 66 GLint vp[4]; 67 void draw(); 68 }; 69 /*! \brief MultiStyle a small dialog called in EacDlg to change the style of multiple elements at once. 70 */ 71 class MultiStyle: public QDialog { 72 Q_OBJECT 73 public: 74 MultiStyle(Molecule *externMole); 75 QCheckBox *walbx; //!<Draw intersecting planes 76 QCheckBox *rinbx; //!<Draw principal ellipses 77 QCheckBox *sphbx; //!<Draw ellipsoid surface 78 QCheckBox *sldbx; //!<Solid ellipsoid 79 QCheckBox *nlabx; //!<No label 80 QCheckBox *metalic;//!<Dashed Bonds to others 81 QComboBox *start; //!<First element from which the style should be changed 82 QComboBox *end; //!<Last element from which the style should be changed 83 84 public slots: 85 void checkWall(); 86 void checkSolid(); 87 void checkBall(); 88 private: 89 Molecule *mol; 90 }; 91 /*! \brief EacDlg is the Edit Atom Styles Dialog of ShelXle which is used to control various settings of how molecules are drawn. 92 */ 93 class EacDlg: public QDialog { 94 Q_OBJECT 95 public: 96 EacDlg(Molecule *externMole); 97 //EacDlg(MyAtom *onlyThisAtom,Molecule *externMole); 98 EacGLW *eacGLW;//!<The QGLWidget displaying an example molecule. 99 public slots: 100 void colorDLG2();//!< opens the bond color dialog. 101 void colorDLGenvibon(); 102 void colorDLGenvidef(); 103 void colorDLGenvihbo(); 104 void colorchange(QColor bgcolor);//!< changes the color of the current element to bgcolor. Changes the color of the corresponding button. 105 void updateLEs(int OZ);//!< 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 106 void checkWall();//!< when solid is checked then solid is unchecked. 107 void checkShader(bool b);//!< when solid is checked then solid is unchecked. 108 void checkSolid();//!< when walls are checked solid is unchecked. 109 void checkBall();//!< when ellipsoid surface is unchecked the solid checkbox is diabled. 110 void doMulti();//!< calls MultiStyle dialog 111 void unicolor(bool b);//!< the bonds shall have a uniq color. 112 void woADP(bool b);//!< the elemen shall be shown without ADP ellispoids. 113 void probaChanged(int ix);//!< The ellipsoid probability is changed to ix. 114 void strengthChanged(double d);//!< the bond thicknes is changed to d. 115 void QPeakRadChanged(double d);//!< QPeak size is changed to d. 116 void lodChanged(int d);//!< the level of detail is changed to d. 117 void kradChanged(double d);//!< the colvalent radius is changed to d. 118 void radChanged(double d);//!< the ball radius used in ball stick mode is changed to d. 119 void exportSettings();//!< export settings to a specified ini file. 120 void importSettings();//!< import settings from a specified ini file. 121 void hbdistChanged(double);//!< maximal length for H-bonds 122 void hbanglChanged(double);//!< maximal angle for H-bonds 123 void updateHBElemnts();//!< H-bond accepor or donor list has changed 124 protected slots: 125 void accept () ; 126 void reject () ; 127 private: 128 Molecule *mol; 129 //MyAtom *otm; 130 131 QCheckBox *shaderUse; 132 QDoubleSpinBox *bondStrength; 133 QSpinBox *lodSpinBox; 134 QComboBox *eacProba; 135 PSEWidget *psew; 136 QPushButton *colorbut, *colorbut2,*colorbutEhb,*colorbutEbo,*colorbutEdf,*impbut,*expbut; 137 QLineEdit *donLE, *accLE; 138 QGridLayout *eacGLO; 139 //QComboBox *eacCB; 140 QDoubleSpinBox *eacRAD; 141 QDoubleSpinBox *eacKRAD; 142 QDoubleSpinBox *eacHBDist; 143 QDoubleSpinBox *eacHBAngl; 144 QCheckBox *walbx; 145 QCheckBox *rinbx; 146 QCheckBox *sphbx; 147 QCheckBox *sldbx; 148 QCheckBox *nlabx; 149 QCheckBox *metalic; 150 151 QCheckBox *noadp; 152 }; 153 #endif 154