Debian Codegraph @

eacDlg.h

raw symbols SCIP
1
2 /****************************************************************************
3 **
4 ** Copyright (C) 2011 Christian B. Huebschle & George M. Sheldrick
5 ** All rights reserved.
6 ** Contact: [email protected]
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 <QOpenGLWidget>
23 #include <QCheckBox>
24 #include <QComboBox>
25 #include <QDialog>
26 #include <QSpinBox>
27 #include <QGridLayout>
28 //#include <>
29 #include <QScrollArea>
30 #include "molecule.h"
31 #include "psewidget.h"
32 #include "opengltestwidget.h"
33
34 /*! \brief EacGLW is the QGLWidget of the Edit Atom Styles Dialog EacDlg.
35 *
36 * EacGLW displays a sp3 like molecule. The 'molecule' consists of a central atom with anisotrop ADP and a neighboring atom without ADP
37 * (displayed as a ball) both are from the same changeable type. Attached to the central atom are also 3 hydrogen atoms. The molecule
38 * rotates continously around its own axis which itself rotates as well. This widget demonstates the look and feel of an atom specific
39 * setting which can be changed in the EacDlg. 3 Q-Peaks are displayed arround the molecule.
40 */
41 /*
42 class EacGLW: public QOpenGLWidget {
43 Q_OBJECT
44 public:
45 explicit EacGLW( Molecule *externMole,QWidget * parent = 0);
46
47 QOpenGLShaderProgram *saveProgram;
48 Molecule *mol;//!< pointer to ShelXle's Molecule object.
49 double exmin,//!< Minimal Q-Peak electron density value of shelXle to be restored when the dialog is closed.
50 exmax;//!< Maximal Q-Peak electron density value of shelXle to be restored when the dialog is closed.
51 CEnvironment xd;//!< MyAtom list of the molecule
52 Connection bonds;//!< MyBond list of the molecule
53 int proba;//!< probability level of the ellipsoids.
54 //EacGLW(const MyAtom *atom,Molecule *externMole);
55 QFont myFont;//!< a font for the atom labels
56 //QStringList pse;
57 PSEWidget *psew;
58 QSettings *einstellung;
59 void qglColor(const QColor c);
60 void renderText(double x, double y, double z, const QString &str);
61 void setMSAA(bool);
62 inline QString glError2String(GLenum err){
63 switch (err) {
64 case GL_NO_ERROR: return QString("GL_NO_ERROR: No OpenGL error."); break;
65 case GL_INVALID_ENUM: return QString("GL_INVALID_ENUM: An enumeration parameter is not a legal enumeration for that function."); break;
66 case GL_INVALID_VALUE: return QString("GL_INVALID_VALUE: Given when a value parameter is not a legal value for that function."); break;
67 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;
68 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;
69 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;
70 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;
71 default : return QString("Some other OpenGL error."); break;
72 }
73 }
74 protected:
75 void initializeGL();
76 void resizeGL(int width, int height);
77 void paintGL();
78 public slots:
79 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
80 void colorDLG();//!< changes the color of an atom type
81 void wallA(int st);//!< wallA changes the state of the ellipsoid wall. @param st is the checkbox state of the calling QCheckBox.
82 void ringA(int st);//!< ringA changes the state of the principal ellipses. @param st is the checkbox state of the calling QCheckBox.
83 void spheA(int st);//!< spheA changes the state of the ellipsoid surface. @param st is the checkbox state of the calling QCheckBox.
84 void soldA(int st);//!< soldA changes the transparence state of the ellipsoid surface. @param st is the checkbox state of the calling QCheckBox.
85 void nolaA(int st);//!< nolaA changes the state of the atom labels @param st is the checkbox state of the calling QCheckBox.
86 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.
87 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.
88 private:
89 GLint vp[4];
90 void draw();
91 double retinafktr = 1;
92 void project(double x, double y, double z, GLdouble &tx, GLdouble &ty);
93 static inline void transform_point(GLdouble out[4], const GLdouble m[16], const GLdouble in[4]);
94 static inline bool posTo2D(V3 obj, const GLdouble model[16], const GLdouble proj[16],
95 const GLint viewport[4], GLdouble &winx, GLdouble &winy,double retinafktr);
96 QColor backGroundColor;
97 QColor labelColor;
98 };
99 */
100
101
102 /*! \brief MultiStyle a small dialog called in EacDlg to change the style of multiple elements at once.
103 */
104 class MultiStyle: public QDialog {
105 Q_OBJECT
106 public:
107 MultiStyle(Molecule *externMole);
108 QCheckBox *walbx; //!<Draw intersecting planes
109 QCheckBox *rinbx; //!<Draw principal ellipses
110 QCheckBox *sphbx; //!<Draw ellipsoid surface
111 QCheckBox *sldbx; //!<Solid ellipsoid
112 QCheckBox *nlabx; //!<No label
113 QCheckBox *metalic;//!<Dashed Bonds to others
114 QComboBox *start; //!<First element from which the style should be changed
115 QComboBox *end; //!<Last element from which the style should be changed
116
117 public slots:
118 void checkWall();
119 void checkSolid();
120 void checkBall();
121 void commonDefault();
122 private:
123 Molecule *mol;
124 };
125 /*! \brief EacDlg is the Edit Atom Styles Dialog of ShelXle which is used to control various settings of how molecules are drawn.
126 */
127 class EacDlg: public QDialog {
128 Q_OBJECT
129 public:
130 explicit EacDlg(Molecule *externMole);
131 PlayOpenGL *ogl;
132 void storeColors(){
133 einstellung->beginGroup("Colors");
134 einstellung->setValue("LabelColor",ogl->labelColor);
135 einstellung->setValue("LabelBGColor",ogl->labelBGColor);
136 einstellung->setValue("focusedLabelBGColor", ogl->focusedLabelBGColor);;
137 einstellung->setValue("focusedLabelColor", ogl->focusedLabelColor);
138 einstellung->setValue("selectedLabelBGColor", ogl->selectedLabelBGColor);;
139 einstellung->setValue("selectedLabelColor", ogl->selectedLabelColor);
140 einstellung->setValue("BackGroundColor",ogl->backGroundColor);
141 einstellung->endGroup();
142 update();
143 ogl->makeLabels();
144 ogl->update();
145 }
146 bool areLabelsShort(){return ogl->shortLabels->isChecked();}
147 //EacDlg(MyAtom *onlyThisAtom,Molecule *externMole);
148 signals:
149 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
150 void statesChanged();
151 public slots:
152 void colorDLG2();//!< opens the bond color dialog.
153 void colorDLGLabel();
154 void colorDLGFLabel();
155 void colorDLGSLabel();
156 void bgColorDLGLabel();
157 void bgColorDLGFLabel();
158 void bgColorDLGSLabel();
159 void labelColorAlpha(int a);
160 void slabelColorAlpha(int a);
161 void flabelColorAlpha(int a);
162 void labelBGColorAlpha(int a);
163 void slabelBGColorAlpha(int a);
164 void flabelBGColorAlpha(int a);
165 void changeLabelFont();
166
167 void colorDLGenvibon();
168 void colorDLGenvidef();
169 void colorDLGenvihbo();
170 void colorchange(QColor bgcolor);//!< changes the color of the current element to bgcolor. Changes the color of the corresponding button.
171 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
172 void checkWall();//!< when solid is checked then solid is unchecked.
173 //void checkShader(bool b);
174 void checkSolid();//!< when walls are checked solid is unchecked.
175 void checkBall();//!< when ellipsoid surface is unchecked the solid checkbox is diabled.
176 void doMulti();//!< calls MultiStyle dialog
177 void unicolor(bool b);//!< the bonds shall have a uniq color.
178 void woADP(bool b);//!< the elemen shall be shown without ADP ellispoids.
179 void probaChanged(int ix);//!< The ellipsoid probability is changed to ix.
180 void strengthChanged(double d);//!< the bond thicknes is changed to d.
181 void qStrengthChanged(double d);//!< the bond thicknes is changed to d.
182 void QPeakRadChanged(double d);//!< QPeak size is changed to d.
183 void lodChanged(int d);//!< the level of detail is changed to d.
184 void kradChanged(double d);//!< the colvalent radius is changed to d.
185 void radChanged(double d);//!< the ball radius used in ball stick mode is changed to d.
186 void exportSettings();//!< export settings to a specified ini file.
187 void importSettings();//!< import settings from a specified ini file.
188 void hbdistChanged(double);//!< maximal length for H-bonds
189 void hbanglChanged(double);//!< maximal angle for H-bonds
190 void updateHBElemnts();//!< H-bond accepor or donor list has changed
191 void makedemomol();
192 void updateShaders();
193 void toggleRotation(bool b){
194 if ((b)&&(!timer->isActive())) timer->start(20);
195 else timer->stop();
196 ogl->update();
197 }
198
199
200 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
201 void colorDLG();//!< changes the color of an atom type
202 void wallA(int st);//!< wallA changes the state of the ellipsoid wall. @param st is the checkbox state of the calling QCheckBox.
203 void ringA(int st);//!< ringA changes the state of the principal ellipses. @param st is the checkbox state of the calling QCheckBox.
204 void spheA(int st);//!< spheA changes the state of the ellipsoid surface. @param st is the checkbox state of the calling QCheckBox.
205 void soldA(int st);//!< soldA changes the transparence state of the ellipsoid surface. @param st is the checkbox state of the calling QCheckBox.
206 void nolaA(int st);//!< nolaA changes the state of the atom labels @param st is the checkbox state of the calling QCheckBox.
207 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.
208 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.
209
210 protected slots:
211 void accept () ;
212 void reject () ;
213 private:
214 //EacGLW *eacGLW;//!<The QGLWidget displaying an example molecule.
215 void createOGL();
216 QTimer *timer=nullptr;//!< a timer for the molecule rotation
217 bool pause4LE = false;
218 QString theIconPath;
219 QToolBar *vito;
220 QPeakView *qpv;
221 Molecule *mol;
222 CEnvironment demo;
223 CEnvironment exmol;
224 Connection demobonds;
225 Connection exbond;
226 QSettings *einstellung;
227 //MyAtom *otm;
228 QCheckBox *shaderUse;
229 QDoubleSpinBox *bondStrength;
230 QDoubleSpinBox *q_bondWidth;
231 QSpinBox *lodSpinBox;
232 QComboBox *eacProba;
233 PSEWidget *psew;
234 QPushButton *colorbut, *colorbut2,*colorbutEhb,*colorbutEbo,*colorbutEdf,*impbut,*expbut;
235 QLineEdit *donLE, *accLE;
236 QGridLayout *eacGLO;
237 //QComboBox *eacCB;
238 QDoubleSpinBox *eacRAD;
239 QDoubleSpinBox *eacKRAD;
240 QDoubleSpinBox *eacHBDist;
241 QDoubleSpinBox *eacHBAngl;
242 QCheckBox *walbx;
243 QCheckBox *rinbx;
244 QCheckBox *sphbx;
245 QCheckBox *sldbx;
246 QCheckBox *nlabx;
247 QCheckBox *metalic;
248 QCheckBox *idlerot;
249 QPushButton *colorbutlab;
250 QPushButton *bgcolorbutlab;
251 QPushButton *colorbutflab;
252 QPushButton *bgcolorbutflab;
253 QPushButton *colorbutslab;
254 QPushButton *bgcolorbutslab;
255
256 QCheckBox *noadp;
257 QComboBox* demoMoleculeBox;
258 };
259 #endif