/**************************************************************************** ** ** 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 WINDOW_H #define WINDOW_H #include #include #include #include "chgl.h" #include "codeeditor.h" #include "qpeakview.h" #include "psewidget.h" #include "historywidget.h" #include "fourxle.h" #include "itsme.h" #include "opengltestwidget.h" #ifndef nullptr #define nullptr NULL #endif #if defined _MSC_VER && _MSC_VER == 1500 #ifndef fmin #define fmin(x, y) (((x) < (y)) ? (x) : (y)) #endif #define round(x) (x<0?ceil((x)-0.5):floor((x)+0.5)) #endif #undef vc7hack1 #ifdef _MSC_VER #include #define std_isfinite _finite #define vc7hack1 1 #else #define std_isfinite std::isfinite #endif #ifndef FONTFAM #if defined Q_WS_WIN || defined Q_OS_WIN #define FONTFAM "Droid Sans Mono" #elif defined Q_WS_MAC || defined Q_OS_MAC #define FONTFAM "Monaco" #else #define FONTFAM "Droid Sans Mono" #endif #endif #include "calculator.h" #include "dsrgui.h" #include "listfile.h" #define SX_LINE_LENGTH 80 /*! \brief Window is the main window class of ShelXle most of the magic happens here ;-) * */ class Window : public QMainWindow { Q_OBJECT public: //Window(ChGL *_chgl); Window(PlayOpenGL *_chgl=nullptr); virtual ~Window(); //bool scroller; static int Version();//!< This return the actual Revision QString theIconPath; QString CurrentCellString; bool restraintsOrConstraints(); int MaxNumberOfPeaks; int wght_max_cycls; static QString programName(){return QString(PROGRAM_NAME);}//!=0x050000) QScreen *screen; #endif QDockWidget *dock, *renamDock, *qPeakDock, *histDock; QDockWidget *shxEditorDock,*shxOutputDock,*infotainmentDock; QAction *enterRenameMode; QAction *showQPeakLegend; QAction *openAct; QAction *screenshotAct; QAction *objExport; QAction *separateLabelFile; //QAction *toggleOrthoView; QAction *belocube; QAction *actionUniq; QAction *actionSearch; QAction *actionNext; QAction *actionPrev; QAction *actionSave; QAction *actionSaveAs; QAction *actionUndo; QAction *actionRedo; QAction *actionCut; QAction *actionCopy; QAction *actionPaste; QAction *actionQPeakLimit; QAction *actionHFix; QAction *wghtRefineAct; QAction *actionEP; QAction *actionEM; QAction *togAtom; QAction *togBond; QAction *togLabel; //QAction *togUnit; //QAction *togElli; //QAction *togHBond; QAction *togBackGr; QAction *togDepthCueing; QAction *actionPovRay; QAction *actionExportCC; QAction *killQs; QAction *killHs; QAction *astdlg; QAction *equivHighlighting; QAction *wghtAct; QAction *sinaAct; QAction *squeezeAct; QAction *recalcSDM; QAction *renamUpdateAct; QAction *cntrPlot; QAction *useNativeDlg; QAction *darkTheme; QAction *switch2HKLF5; QAction *switch2HKLF4; QAction *symmElementsAct; QTextBrowser *brs; QProcess *runffmpeg; QLineEdit *ffmpegedt,*mp4file; QString fffn; QLabel *ffl; QString oldFileName; QProgressBar *bar; QPushButton *closeFF ; QDialog *extraOutput; QToolBar *editToolBar,//!< Edit toolbar (redo undo copy cut and paste...) *refineToolBar,//!< WGHTrefine, autoHFIX, +kill Hs, kill Qs, refine XL and anis refine *bottomToolBar,//!< selection toolbar with context specific content. *fito,//!< File toolbar *vito,//!< View toolbar to toggle bonds atoms etc... *extraTB; //!< External programs can be startet from here. QMenu *runMenu;//!< the SHELX menu where you also run XL and do convientent stuff with the res file. QMenu *fileMenu, //!< file menu including the save history *editMenu, //!< standart edit menu *dialogMenu, //!< settings menu *viewMenu, //!< View menu *packMenu, //!< Packing, growing, fusing etc... *extraMenu;//!< add and start external programs... QCheckBox *qGrowPeak; QCheckBox *search4duplicates; QToolButton *zoomIn; QToolButton *zoomOut; QToolButton *homeMe; QToolButton *quickReLoadButton; QSpinBox *lodsp; QCheckBox *sr_same;//use same restraint for part atoms QCheckBox *sr_simu;//use sumu restraint for part atoms QCheckBox *sr_rigu;//use rigu restarint for part atoms QCheckBox *sr_alter_name;//give alternataive name to 2nd part atoms QCheckBox *sr_ExyzAadp_ifclose; // apply EXYZ and EADP if atoms are very close bool notRefine; bool shaderInfo = false; int tbiconSize; QHash myHash;//!< This Hash connects recent file names with cursor positions. So that files are opened always at the same position. QAction *refineAct; QAction *refineActAnis; QAction *refineActActa; QAction *refineActExti; QAction *refineActConf; QAction *clearVoro; FourXle *fxle;//! orte; // QList normalen,nnn; // QList farben; // int zoff,yoff,xoff; // QList sfac;//! fvar;//! fvarCntr;//! fv); int firstAtomLine; int extraIndex; bool finWasPressed; QAction *ydleStart; QAction *ydleStop; QSpinBox *lpart; QSpinBox *rpart; bool canWeSqueeze(); int cifCheckSum(const QString &block); const QRegularExpression buchstaben = QRegularExpression("[A-Za-z]"); const QRegularExpression vorneweg = QRegularExpression("[^A-Za-z']+"); const QRegularExpression resorins = QRegularExpression("(.res$)|(.ins$)", QRegularExpression::CaseInsensitiveOption); const QRegularExpression punkthkl = QRegularExpression(".hkl$",QRegularExpression::CaseInsensitiveOption); const QRegularExpression unitinst = QRegularExpression("^UNIT",QRegularExpression::CaseInsensitiveOption); const QRegularExpression punktres = QRegularExpression(".res$", QRegularExpression::CaseInsensitiveOption); const QRegularExpression punktins = QRegularExpression(".ins$",QRegularExpression::CaseInsensitiveOption); const QRegularExpression punktpov = QRegularExpression("(.pov)",QRegularExpression::CaseInsensitiveOption); const QRegularExpression leer = QRegularExpression("\\s+"); const QRegularExpression numbers = QRegularExpression("\\d+"); const QRegularExpression startnumbers = QRegularExpression("^[0-9]+"); const QRegularExpression nonumbers = QRegularExpression("\\D+"); const QRegularExpression commaspace = QRegularExpression(", $"); signals: void fileLoaded(void); void pipeStatus(const QString& s); //!ImeanThisAtom) to an other scattering factor (acation->data) void changeSelectedElements(); void changeIconSize();//! previousLine); void dsrClosed(); void aboutXLE();//! undoAtomIndex,redoAtomIndex,gehtMichAn,gehtMichAn2; int altursize; int mode; void getMinMaxSintl(double &smin, double &smax); QMenu *recentFilesMenu,*stereoMenu,*moveMenu,*helpMenu,*sortMenu; QActionGroup *stereoGroup,*tubeGroup,*sortGroup; enum { MaxRecentFiles = 20 }; QAction *recentFileActs[MaxRecentFiles]; bool otherOpenFiles,doNotAnnoyMe; Molecule mole; QSpinBox *widthBox; QSpinBox *heightBox; QDoubleSpinBox *scalefBox; QDoubleSpinBox *cStepBx; QDialog *scalDlg; QTextBrowser *infoKanal; QRadioButton *pserbt[111]; QGroupBox *sfacBox; double scalePic; QString saveName,fvarinfo; QProcess *shelxl,*extraProc; QString shelxlPath, shelxlArgs; bool useMyBArray; //! If set to true, the b-array is not automatically set by ShelXle QStringList extraProgramNames,extraProgramPaths,extraOptions,extraExt2; QList extraArguments,extraExtensions, extraDetach, extraResIns, extraOpenFileDialogBefore, extraIconOverlay, extraAbsolutePath; QLineEdit *extraPath,*extraName,*extraAltExtEdit,*extraArgumentsEdit,*shxPath,*shxOptions; QList extraOverlayPointSize; QSpinBox *iovlPointSize; QComboBox *pgms; QToolButton *extraFakeButton; QString altExtraIconPath; QStringList altExtraIconPaths; QDockWidget *helpDock; // QWebView *hilfe; //QTextBrowser *hilfe; QWidget *shx_group; QMainWindow *shxMW; QVBoxLayout *sss; QVBoxLayout *hwl; QHBoxLayout *nlt; QGroupBox *renameBox ; QVBoxLayout *rnla; QLabel *nliL,*resiResiClassL,*resiNrSpinL,*partSpinL; QHBoxLayout *sfacla; QScrollArea *qsa,*qsa2; //QAction *zm_stereo; QAction *pe_stereo; QAction *xe_stereo; QAction *an_stereo; //QAction *hw_stereo; QAction *no_stereo; QAction *fcvsfoAct, *calcAct, *dsrAct; QAction *soact; QString shredCIFPath; QAction *backColor,*labelColor; QVBoxLayout *lt; QLabel *sLabel, *fvused; QTimer *hidwillpse; QLabel *indexL,*sufixL; QLabel *scalwla, *scalhla, *scalsla, *header; QDialogButtonBox *buttonBoxRN; QHBoxLayout *indexla; QStringList alpha; QGridLayout *scalla; //QHBoxLayout *slt2; QVBoxLayout *vlt, *resid_layout; QTextEdit *resid_label; //! display the refinement residuals QTextEdit *restr_table; //! display the bad restraints //RenderPlot *plot; LstData listf_info; QGroupBox *resid_gb; QGroupBox *gp;QHBoxLayout *rhla,*rhla2; QHBoxLayout *buttomLt; QPushButton *showLst; QIcon extraIcon; QCheckBox *useArgument; QCheckBox *omitExtension; QCheckBox *absolutePath; QCheckBox *detach; QCheckBox *copyResIns; QCheckBox *openFileDialogBefore; QCheckBox *iconOverlay; QSize ediSize; QPoint ediPos; QLabel *lineColumn; QGroupBox *navibox,*refineButtonBox,*refineButtonBox2; QPushButton *stoppRefinement,*finishRefinement; QPushButton *loadRes; QPushButton *withdraw; QPushButton *pro7; QPushButton *stoppRefinement2,*finishRefinement2;// this is for infotainment dock QPushButton *loadRes2; QPushButton *withdraw2; QToolButton *spellCheckact,*spellCheckact2; QSettings *vis_settings; void shx_editor(QString filename);//16.10.2019: title is class glabal variable. no need to give it as parameter her double getNumber(double v,const QList fv,double uiso);//to be changed! double getNumber(double v,const QList fv,int idx,int &fixFlag);//to be changed! MyAtom findOH(V3 donor, V3 acceptor,int dindex,QStringList alab); bool maybeSave(); bool maybeSave2(); bool doWeHaveHKLF5here(QStringList &hk5s); bool startFused; QStringList hklf5files; Calculator *calcmenu; DSRGui *dsr; QString pngName;//output file of povray export QScrollArea *qsaPNG ; QList twinRedundant; QList twinDone; QDialog *twinDlg; double rvalue2beat, wr2value2beat; QVBoxLayout *twinvbl; QGroupBox *twingpx; QLabel *twinpatlab; //QGroupBox *gpx =new QGroupBox("Posible twin laws for this structure:",twinDlg); //QVBoxLayout *vbl = new QVBoxLayout(); //QString selectedRestraintsAtoms(QString buffer, QList selected, QString resiSpec, bool exclude_H=false); }; class AulaWorker : public QThread { Q_OBJECT public: AulaWorker(Window *parent, bool ur){ _w = parent; useResis = ur; rzeit.start(); } void run() override { /* expensive or blocking operation */ aula(); } Window *_w; bool saveruf; int possible; QList chain; void aula(); bool useResis; public slots: void finalize(); signals: void message(const QString &);//!< small text messages to the status bar. void rename(int); private: QElapsedTimer rzeit; QString all; void extendChain(QList &rings, QList ¤tChain, QList > &neighbors,QSet &nogo); void inventNewLabels(QList &result); }; #endif