/****************************************************************************
**
** 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.
**
**
****************************************************************************/
//äöüß needed to keep this file UTF8 QString::fromUtf8("»")
int Revision=1551;
#include "window.h"
#include "scatt.h"
#include "includeeditor.h"
#include "exportccdlg.h"
#include "deprecation.h"
#include "partcolor.h"
#include "highlighter.h"
#include "eacDlg.h"
//#include "dragdropatomsdlg.h"
#include "savehistorywidget.h"
#include "fcvsfo.h"
#include "rename_selected.h"
//QString datum=QString(__TIME__ " " __DATE__);
#ifdef __x86_64__
const int BitWidth=64;
#else
#ifdef _WIN64
const int BitWidth=64;
#else
const int BitWidth=32;// "
This is a 32 bit Version.
"
#endif
#endif
const QFileDialog::Options noneopt = QFileDialog::Options();
QString latestRev="no network available, or you disabled checking";
QString lstpatternfile=":lst_and_output_style.ini";
QString inspatternfile=":ins_res_style.ini";
QString lstpatternfile_dark=":lst_and_output_style_dark.ini";
QString inspatternfile_dark=":ins_res_style_dark.ini";
void Window::dragEnterEvent(QDragEnterEvent *event) {
if (event->mimeData()->hasFormat("text/uri-list"))
event->acceptProposedAction();
}
void Window::toggleFullScreen(){
if (QString(PROGRAM_NAME).compare("shelXle")) return;
fullscreen=!fullscreen;
if (fullscreen) {
showFullScreen();
updateStatusBar("+++PRESS F11 to exit full screen mode.+++PRESS F11 to exit full screen mode.+++PRESS F11 to exit full screen mode.+++PRESS F11 to exit full screen mode.+++PRESS F11 to exit full screen mode.+++");
}
else showNormal();
}
void Window::dropEvent(QDropEvent *event) {
QList drops = event->mimeData()->urls();
QString path=drops.first().path();
#if defined Q_WS_WIN || defined Q_OS_WIN
path.remove(QRegularExpression("^/"));
#endif
if ((path.endsWith(".res",Qt::CaseInsensitive))||(path.endsWith(".ins",Qt::CaseInsensitive))){
loadFile(path);
event->acceptProposedAction();
}
}
void Window::qinitres() {
if (!QString(PROGRAM_NAME).compare("shelXle")){
printf("init resorce: %s\n",PROGRAM_NAME);
Q_INIT_RESOURCE(icons);
}else{
printf("init resorce: %s\n",PROGRAM_NAME);
Q_INIT_RESOURCE(bicons);
Q_INIT_RESOURCE(shaders);
}
}
Window::Window(PlayOpenGL *_chgl){
/*! \brief the constructor of the main window rather lengthy but most widgets are created and placed here.
*
*/
fullscreen=false;
setObjectName("The Main Window");
oldFileName=popel=QString("");
extraIndex = -1;
wght_max_cycls = 10;
calcmenu=nullptr;
printf("QT_VERSION %x \n",QT_VERSION);
setAcceptDrops(true);
mole.mynewnameis=QString(PROGRAM_NAME);
if (!QString(PROGRAM_NAME).compare("shelXle")){
theIconPath=QString(":/xle-icons/");
}else{
theIconPath=QString(":/bicons/");
}
int qtmajor=(QT_VERSION&0xff0000)>>16;
if (PROGRAM_NAME[0]=='s') {
mole.mynewnameis= QString("%1-%2-%3").arg(PROGRAM_NAME).arg(BitWidth).arg(qtmajor);//each version should get ist new ini file because qt5 seems to be
//incompatible in windows state
QSettings *testset = new QSettings( QSettings::IniFormat, QSettings::UserScope ,PROGRAM_NAME, mole.mynewnameis );
QSettings *oldset = new QSettings( QSettings::IniFormat, QSettings::UserScope ,PROGRAM_NAME, PROGRAM_NAME);
if ((!QFile::exists(testset->fileName()))&&(QFile::exists(oldset->fileName()))){
QFile::copy(oldset->fileName(),testset->fileName());
}
testset->deleteLater();
oldset->deleteLater();
}
einstellung = new QSettings( QSettings::IniFormat, QSettings::UserScope ,PROGRAM_NAME, mole.mynewnameis );
//QFontDatabase::addApplicationFont(":/xle-icons/droid-sans-mono.ttf");
falschAtom=-1;
CurrentCellString=QString();
MaxNumberOfPeaks=100;
altExtraIconPath="";
calcmenu=NULL;//if not needed it will be not created.
dsr=NULL;
qsaPNG=nullptr;
nowaste=true;
focusSet=true;
doNotAnnoyMe=false;
#if (QT_VERSION >=0x050000)
screen = QGuiApplication::screens().at(0);
hhh = screen->availableGeometry().height();
#else
hhh = qApp->desktop()->availableGeometry(-1).height();
#endif
printf("available height %d\n",hhh);
shxPath=shxOptions=NULL;
machPlatz=false;
char *ENUS=setlocale(LC_ALL,"C");
if (!ENUS)ENUS=setlocale(LC_ALL,"en_US.UTF-8");
//printf("%s\n",ENUS);
FFTErrorString="";
range=3.0;
mode=0;
weight=1.0;
//scroller=false;
setDockNestingEnabled(true);
otherOpenFiles=false;
QFontDatabase::addApplicationFont(theIconPath+"SourceCodePro-Bold.ttf");
QFontDatabase::addApplicationFont(theIconPath+"SourceCodePro-Italic.ttf");
int id = QFontDatabase::addApplicationFont(theIconPath+"SourceCodePro-Regular.ttf");
QString family = QFontDatabase::applicationFontFamilies(id).at(0);
QFont font(family);
{//initialize Edidor
navibox = new QGroupBox(this);
nlt = new QHBoxLayout(navibox);
//nlt->setMargin(0);
selectPart = new QCheckBox("Select Part",navibox);
selectPart->setChecked(false);
spinSelectPart = new QSpinBox(navibox);
spinSelectPart->setMinimum(1);
spinSelectPart->setMaximum(2);
spinSelectPart->setVisible(false);
inculdePartNull = new QCheckBox("incl. Pt. 0",navibox);
inculdePartNull->setToolTip("Include part 0 in selection");
inculdePartNull->setChecked(true);
inculdePartNull->setVisible(false);
QToolButton *nothing=new QToolButton(navibox);
nothing->setIcon(QIcon(theIconPath+"nospell.svg"));
nothing->setText("no errors");
nothing->setIconSize(QSize(22,22));
nothing->setToolButtonStyle(Qt::ToolButtonIconOnly);
spellCheckact = new QToolButton(navibox);
spellCheckact->setIcon(QIcon(theIconPath+"spell.svg"));
spellCheckact->setText("Jump to error");
spellCheckact->setIconSize(QSize(22,22));
spellCheckact->setToolTip("Jump to first error in file.");
spellCheckact->setToolButtonStyle(Qt::ToolButtonIconOnly);
lineColumn = new QLabel("",navibox);
nlt->addWidget(selectPart);
nlt->addWidget(spinSelectPart);
nlt->addWidget(inculdePartNull);
connect(selectPart,SIGNAL(toggled(bool)),spinSelectPart,SLOT(setVisible(bool)));
connect(selectPart,SIGNAL(toggled(bool)),inculdePartNull,SLOT(setVisible(bool)));
connect(selectPart,SIGNAL(stateChanged(int)),this,SLOT(selectParts()));
connect(inculdePartNull,SIGNAL(toggled(bool)),this,SLOT(selectParts()));
connect(spinSelectPart,SIGNAL(valueChanged(int)),this,SLOT(selectParts()));
nlt->addStretch(10);
nlt->addWidget(lineColumn);
navibox->setLayout(nlt);
editor = new CodeEditor(this);
editor->setObjectName("ShelXleEditor");
QApplication::setCursorFlashTime(700);
editor->setCursorWidth(2);
nlt->addWidget(editor->resiFinder);
nlt->addWidget(spellCheckact);
nlt->addWidget(nothing);
connect(spellCheckact,SIGNAL(clicked()),editor,SLOT(jumpToError()));
completer = new QCompleter(this);
{
QStringList keywords;
keywords << "ACTA"<<"AFIX"<<"ANIS"<<"BASF"<<"BIND"<<"BLOC"<<"BOND"<<
"BUMP"<<"CELL"<<"CGLS"<<"CHIV"<<"CONF"<<"CONN"<<"DAMP"<<"DANG"<<
"DEFS"<<"DELU"<<"DFIX"<<"DISP"<<"EADP"<<"END "<<"EQIV"<<
"EXTI"<<"EXYZ"<<"FEND"<<"FLAT"<<"FMAP"<<"FRAG"<<"FREE"<<
"FVAR"<<"GRID"<<"HFIX"<<"HKLF"<<"HOPE"<<"HTAB"<<"ISOR"<<
"LATT"<<"LAUE"<<"LIST"<<"L.S."<<"MERG"<<"MOLE"<<
"MORE"<<"MOVE"<<"MPLA"<<"NCSY"<<"OMIT"<<"PART"<<"PLAN"<<
"REM "<<"RESI"<<"RTAB"<<"SADI"<<"SAME"<<"SFAC"<<"SHEL"<<
"SIMU"<<"SIZE"<<"SPEC"<<"STIR"<<"SUMP"<<"SWAT"<<"SYMM"<<
"TEMP"<<"TIME"<<"TITL"<<"TWIN"<<"UNIT"<<"VECT"<<
"WPDB"<<"WGHT"<<"ZERR"<<
// New Shelxl commands!
"XNPD"</83
"REST"</84
"CHAN"</85
"RIGU"</86
"FLAP"</87
"RNUM"</88
"SOCC"</89
"PRIG"</90
"WIGL"</91
"RANG"</92
"TANG"</93
"ADDA"</94
"STAG"</;//95
"ABIN"</96
"ANSC"</97
"ANSR"</98
"NOTR"</99
"NEUT"</100
"TWST";//<<101
keywords.sort();
completer->setModel(new QStringListModel(keywords, completer));
}
completer->setModelSorting(QCompleter::CaseInsensitivelySortedModel);
completer->setCaseSensitivity(Qt::CaseInsensitive);
completer->setWrapAround(false);
editor->setCompleter(completer);
shxEditorDock = new QDockWidget("SHELXL Editor",this,Qt::Widget);//Qt::Window//Qt::Tool
shxEditorDock->setObjectName("Editor");
shxEditorDock->setFeatures(
QDockWidget::DockWidgetMovable|
QDockWidget::DockWidgetFloatable|
QDockWidget::DockWidgetClosable);
connect(shxEditorDock,SIGNAL(visibilityChanged(bool)),this,SLOT(editorIsVisible(bool)));
shxMW = new QMainWindow(this);
shx_group = new QWidget(this);
shxMW->setCentralWidget(shx_group);
shx_group->setContentsMargins(0,0,0,0);
sss = new QVBoxLayout(shx_group);
sss->addWidget(navibox);
sss->addWidget(editor);
sss->addWidget(editor->suchbox);
shx_group->setLayout(sss);
shxEditorDock->setWidget(shxMW);
connect(shxEditorDock,SIGNAL(visibilityChanged(bool)),this,SLOT(shxActUpdate(bool)));
editor->setFont(font);
editor->setLineWrapMode(QPlainTextEdit::NoWrap);
addDockWidget(Qt::RightDockWidgetArea, shxEditorDock );
}
{//init shelx output viewer
xlPutor = new CodeEditor();
xlPutor->setObjectName("shelx output viewer");
xlPutor->setReadOnly(true);
xlPutor->setFont(font);
xlPutor->setLineWrapMode(QPlainTextEdit::NoWrap);
shxOutputDock = new QDockWidget("SHELXL output",this,Qt::Widget);
shxOutputDock->setObjectName("Output");
shxOutputDock->setFeatures(
QDockWidget::DockWidgetMovable|
QDockWidget::DockWidgetFloatable|
QDockWidget::DockWidgetClosable);
shxOutputDock->hide();
connect(shxOutputDock,SIGNAL(visibilityChanged(bool)),this,SLOT(outputIsVisible(bool)));
buttomLt = new QHBoxLayout();
loadRes = new QPushButton(QIcon(theIconPath+"open.svg"), "Load refinement results", this);
withdraw = new QPushButton(QIcon(theIconPath+"cancel.svg"), "Discard results", this);
showLst = new QPushButton("Show output listing file",this);
connect(loadRes,SIGNAL(pressed()),this,SLOT(loadrefres()));
connect(withdraw,SIGNAL(pressed()),this,SLOT(withdrawres()));
connect(showLst,SIGNAL(pressed()),this,SLOT(loadLst()));
pro7 = new QPushButton("Visualize output");
connect(pro7,SIGNAL(pressed()),this,SLOT(raiseTaff()));
connect(pro7,SIGNAL(pressed()),this,SLOT(displayDisagreeableRestraints()));
buttomLt->addWidget(loadRes);
buttomLt->addWidget(withdraw);
buttomLt->addStretch(10);
buttomLt->addWidget(showLst);
stoppRefinement = new QPushButton(QIcon(theIconPath+"cancel.svg"),"STOP refinement!",this);
stoppRefinement->hide();
finishRefinement = new QPushButton(QIcon(theIconPath+"cancel.svg"),"Finish Gracefully.",this);
finishRefinement->hide();
refineButtonBox = new QGroupBox();
refineButtonBox->setLayout(buttomLt);
vlt = new QVBoxLayout();
vlt->addWidget(xlPutor);
vlt->addWidget(xlPutor->suchbox);
vlt->addWidget(refineButtonBox);
vlt->addWidget(stoppRefinement);
vlt->addWidget(finishRefinement);
vlt->addWidget(pro7);
refineButtonBox->hide();
pro7->hide();
gp = new QGroupBox("");
gp->setFlat(true);
gp->setLayout(vlt);
shxOutputDock->setWidget(gp);
addDockWidget(Qt::RightDockWidgetArea, shxOutputDock);
tabifyDockWidget (shxEditorDock,shxOutputDock);
connect(shxOutputDock,SIGNAL(visibilityChanged(bool)),this,SLOT(shxOPTUpdate(bool)));
}
{//infotainment widget
vis_settings = new QSettings(QSettings::IniFormat, QSettings::UserScope, PROGRAM_NAME, mole.mynewnameis);
vis_settings->beginGroup("infotaiment");
if (!vis_settings->contains("info_as_default")) {
vis_settings->setValue("info_as_default", false);
}
vis_settings->endGroup();
infotainmentDock = new QDockWidget("Visual Refinement output",this,Qt::Widget);
infotainmentDock->setObjectName("Painment");
infotainmentDock->setFeatures(
QDockWidget::DockWidgetMovable|
QDockWidget::DockWidgetFloatable|
QDockWidget::DockWidgetClosable);
infotainmentDock->hide();
resid_label = new QTextEdit(); // shows residuals from refinement output
resid_label->setAlignment(Qt::AlignTop);
resid_label->setStyleSheet("QLabel { background-color : white; border: 1px solid lightgray;}");
resid_label->setWordWrapMode(QTextOption::NoWrap); // prevents word wrap in the table
restr_table = new QTextEdit();
restr_table->setAlignment(Qt::AlignBottom);
restr_table->setReadOnly(true);
resid_label->setReadOnly(true);
resid_layout = new QVBoxLayout();
resid_layout->addWidget(resid_label, 4); // residuals
resid_layout->addWidget(restr_table, 2); // list of most disagreeable restraints
refineButtonBox2 = new QGroupBox();
loadRes2 = new QPushButton(QIcon(theIconPath+"open.svg"),"Load refinement results",this);
withdraw2 = new QPushButton(QIcon(theIconPath+"cancel.svg"),"Discard results",this);
connect(loadRes2,SIGNAL(pressed()),this,SLOT(loadrefres()));
connect(withdraw2,SIGNAL(pressed()),this,SLOT(withdrawres()));
QHBoxLayout *buttomLt2 = new QHBoxLayout();
buttomLt2->addWidget(loadRes2);
buttomLt2->addWidget(withdraw2);
QPushButton *arte= new QPushButton("show text output");
connect(arte,SIGNAL(pressed()),this,SLOT(raiseTaz()));
refineButtonBox2->setLayout(buttomLt2);
stoppRefinement2 = new QPushButton(QIcon(theIconPath+"cancel.svg"),"STOP refinement!",this);
stoppRefinement2->hide();
finishRefinement2 = new QPushButton(QIcon(theIconPath+"cancel.svg"),"Finish Gracefully",this);
finishRefinement2->hide();
resid_layout->addWidget(refineButtonBox2, 1);
resid_layout->addWidget(stoppRefinement2, 1);
resid_layout->addWidget(finishRefinement2, 1);
resid_layout->addWidget(arte);
refineButtonBox2->hide();
restr_table->setMinimumSize(150, 50);
restr_table->setToolTip("The error of a parameter should generally not be higher than 3sigma. A higher\n"
"value means that the assumption of the target value is not met. \n"
"The reason for this can be either, for example, a distorted molecular geometry \n"
"or systematic errors in the data.\n"
"\n"
"Disagreeable restraints will be highlighted in yellow if the error is above \n"
"2.5sigma. They will be highlighted in red if the error is above 3.5sigma.\n");
resid_gb = new QGroupBox("");
resid_gb->setFlat(true);
resid_gb->setLayout(resid_layout);
infotainmentDock->setWidget(resid_gb);
addDockWidget(Qt::RightDockWidgetArea, infotainmentDock);
tabifyDockWidget (shxEditorDock,infotainmentDock);
}
dock = new QDockWidget("Information Window",this);
dock->setObjectName("Info");
dock->setAllowedAreas(Qt::AllDockWidgetAreas);
infoKanal = new QTextBrowser(dock);
infoKanal->setLineWrapMode(QTextEdit::NoWrap);
dock->setFeatures(QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable|QDockWidget::DockWidgetClosable);
dock->setWidget(infoKanal);
dock->hide();
addDockWidget(Qt::RightDockWidgetArea, dock);
// resize(qApp->desktop()->screenGeometry().width(),qApp->desktop()->screenGeometry().height());
//rename dock
renamDock = new QDockWidget("Rename Mode");
renamDock->setObjectName("Rename");
enterRenameMode = renamDock->toggleViewAction ();
enterRenameMode->setShortcut(Qt::ALT|Qt::Key_R);
QShortcut *altplus = new QShortcut(Qt::CTRL|Qt::ALT|Qt::Key_Plus,renamDock);
connect(altplus, SIGNAL(activated()),this, SLOT(incResiNr()));
QShortcut *altminus = new QShortcut(Qt::CTRL|Qt::ALT|Qt::Key_Minus,renamDock);
connect(altminus, SIGNAL(activated()),this, SLOT(decResiNr()));
connect(enterRenameMode,SIGNAL(triggered(bool)),this,SLOT(renamUpdate(bool)));
//connect(enterRenameMode,SIGNAL(triggered(bool)),enterRenameMode,SLOT(setVisible(bool)));
renamDock->setFeatures(
QDockWidget::DockWidgetMovable|
QDockWidget::DockWidgetFloatable|
QDockWidget::DockWidgetClosable);
renameBox = new QGroupBox();
rnla = new QVBoxLayout();
rnla->setObjectName("Rename Layout");
nliL = new QLabel("You are in 'rename mode' now.");
nliL->setFont(QFont("Helvetica",18,QFont::Bold));
spellCheckact2 = new QToolButton(renameBox);
spellCheckact2->setIcon(QIcon(theIconPath+"spell.svg"));
spellCheckact2->setText("Oops! I made a mistake! Sorry! Please check!");
spellCheckact2->setIconSize(QSize(22,22));
spellCheckact2->setToolTip("Jump to first error in file.");
spellCheckact2->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
connect(spellCheckact2,SIGNAL(clicked()),shxEditorDock,SLOT(raise()));
connect(spellCheckact2,SIGNAL(clicked()),renamDock,SLOT(hide()));
connect(spellCheckact2,SIGNAL(clicked()),editor,SLOT(jumpToError()));
rnla->addWidget(spellCheckact2);
rnla->addWidget(nliL);
hintL = new QLabel("
Hint: It is wise to save often. Especially after renaming a couple of Q-Peaks. "
" Saving synchronizes the visualized structure and the editor content. Before you start renaming and after "
"you are finished renaming you should SAVE!Click here to hide this hint for ever.
");
hintL->setWordWrap(true);
rnla->addWidget(hintL);
hintL->setOpenExternalLinks(true);
connect(hintL,SIGNAL(linkActivated(const QString &)), this ,SLOT(hintLhide()));
rufModeBox = new QCheckBox("Automatically jump to first unused label");
rufModeBox->setChecked(false);
connect(rufModeBox,SIGNAL(stateChanged(int)),this,SLOT(rufmode()));
partSpinL = new QLabel("Part:");
partSpin = new QSpinBox();
partSpin->setMinimum(-99);
partSpin->setMaximum(99);
partSpin->setValue(0);
connect(partSpin,SIGNAL(valueChanged(int)),this,SLOT(updateLabel()));
resiNrSpinL = new QLabel("Residue Nr:");
resiNrSpin = new QSpinBox();
resiNrSpin->setMinimum(0);
resiNrSpin->setMaximum(9999);
resiNrSpin->setValue(0);
connect(resiNrSpin,SIGNAL(valueChanged(int)),this,SLOT(renameRNchanged(int)));
resiResiClassL = new QLabel("Residue Class:");
resiResiClass = new QLineEdit("");
resiResiClass->setMaxLength(4);
resiResiClass->setValidator(new QRegularExpressionValidator(QRegularExpression("^[A-Za-z]\\w{0,3}"),resiResiClass));
resiResiClass->setMinimumWidth(100);
connect(resiResiClass,SIGNAL(textEdited(const QString&)),this,SLOT(grossRC(const QString&)));
resiResiClass->setEnabled(false);
resiResiClassCB = new QComboBox(this);
resiResiClassCB->setLineEdit(resiResiClass);
resiResiClassCB->setEditable(true);
resiResiClassCB->setMinimumWidth(150);
rhla = new QHBoxLayout();
rhla->addWidget(partSpinL);
rhla->addWidget(partSpin);
rhla->addWidget(resiNrSpinL);
rhla->addWidget(resiNrSpin);
rhla->addWidget(resiResiClassL);
rhla->addWidget(resiResiClassCB);
rnla->addLayout(rhla);
rhla2 = new QHBoxLayout();
tieOccL = new QLabel("Tie occupancy to: ");
tieOccL->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
tieType = new QComboBox();
tieType->addItem("its fixed value",0);
tieType->addItem("fv(n)",1);
tieType->addItem("1-fv(n)",-1);
tieFVNrL = new QLabel("n = ");
tieFVNrL->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
tieFVNr = new QSpinBox();
tieFVNr->setMinimum(1);
tieFVNr->setMaximum(9999);
tieFVNr->setValue(2);
tieUsedL = new QLabel("fv(2) is 0x used");
tieFix = new QDoubleSpinBox(this);
tieFix->setDecimals(1);
tieFix->setMinimum(0.0);
tieFix->setMaximum(1.0);
tieFix->setValue(1.0);
tieFix->setSingleStep(0.1);
tieFix->hide();
connect(tieType,SIGNAL(currentIndexChanged(int)),this,SLOT(updateTieFreeVar()));
connect(tieFVNr,SIGNAL(valueChanged(int)),this,SLOT(updateTieFreeVar()));
connect(partSpin,SIGNAL(valueChanged(int)),this,SLOT(updateTieFreeVar()));
rhla2->addWidget(tieOccL);
rhla2->addWidget(tieType);
rhla2->addWidget(tieFix);
rhla2->addWidget(tieFVNrL);
rhla2->addWidget(tieFVNr);
rhla2->addWidget(tieUsedL);
rhla2->setEnabled ( false );
rnla->addLayout(rhla2);
indexla = new QHBoxLayout();
indexIncr = new QCheckBox("Increment Suffix ");
indexIncr->setChecked(false);
indexL = new QLabel("Number");
indexSpin = new QSpinBox();
indexSpin->setMinimum(-1);
indexSpin->setMaximum(999);
indexSpin->setValue(labelIndex);
connect(indexSpin,SIGNAL(valueChanged(int )),this,SLOT(changeIndexofLabel(int )));
sufixBox = new QComboBox();
sufixL =new QLabel("Suffix");
QFont dlg2fnt=sufixL->font();
alpha<<"'"<<""<<"A"<<"B"<<"C"<<"D"<<"E"<<"F"<<"G"<<"H"<<"I"<<"J"<<"K"
<<"L"<<"M"<<"N"<<"O"<<"P"<<"Q"<<"R"<<"S"<<"T"<<"U"<<"V"<<"W"<<"X"<<"Y"<<"Z"
<<"A'"<<"B'"<<"C'"<<"D'"<<"E'"<<"F'"<<"G'"<<"H'"<<"I'"<<"J'"<<"K'"<<"L'"<<"M'"
<<"N'"<<"O'"<<"P'"<<"Q'"<<"R'"<<"S'"<<"T'"<<"U'"<<"V'"<<"W'"<<"X'"<<"Y'"<<"Z'";
sufixBox->addItems(alpha);
sufixBox->setCurrentIndex(1);
sufixBox->setEditable(true);
connect(sufixBox,SIGNAL( currentIndexChanged (int)),this,SLOT(changeSuffixofLabel(int )));
indexla->addWidget(indexL);
indexla->addWidget(indexSpin);
indexla->addWidget(sufixL);
indexla->addWidget(sufixBox);
rnla->addLayout(indexla);
labelSuffix="";
nextLabel="C1";
labelIndex=1;
labelPSE="C";
sfacBox = new QGroupBox("Scattering factors");
sfacBox->setFixedSize(110*52,70);
sfacla = new QHBoxLayout();
dsm= new QSignalMapper(this);
sfacla->addWidget(pserbt[0] = new QRadioButton("any"));
/*
QString pth=QDir::homePath()+"/QRadioButtonFont.txt";
FILE *frbf=fopen(pth.toStdString().c_str(),"wt");
fprintf(frbf, "%d %s\n", pserbt[0]->fontInfo().pointSize(), pserbt[0]->fontInfo().family().toStdString().c_str());
fclose(frbf);
*/
dlg2fnt.setPointSize(10);
pserbt[0]->setFont(dlg2fnt);
dsm->setMapping(pserbt[0],"any");
connect(pserbt[0], SIGNAL(clicked()), dsm, SLOT(map()));
for (int i=1; i<109; i++){
sfacla->addWidget(pserbt[i] = new QRadioButton(mole.pse(i-1)));
pserbt[i]->setFont(dlg2fnt);
dsm->setMapping(pserbt[i],mole.pse(i-1));
connect(pserbt[i], SIGNAL(clicked()), dsm, SLOT(map()));
pserbt[i]->hide();
}
sfacla->addWidget(pserbt[110] = new QRadioButton("D"));
pserbt[110]->setFont(dlg2fnt);
dsm->setMapping(pserbt[110],"D");
connect(pserbt[110], SIGNAL(clicked()), dsm, SLOT(map()));
pserbt[110]->hide();
//connect(dsm, SIGNAL(mappedString(const QString &)), this, SLOT(changeElemetofLabel(const QString &)));
#if (QT_VERSION >= 0x050f00)
connect(dsm, &QSignalMapper::mappedString, this, &Window::changeElemetofLabel);
#else
connect(dsm, SIGNAL(mapped(const QString &)), this, SLOT(changeElemetofLabel(const QString &)));
#endif
sfacBox->setLayout(sfacla);
qsa =new QScrollArea();
qsa->setWidget(sfacBox);
qsa->setMaximumHeight(100);
QHBoxLayout *rufla= new QHBoxLayout();
rufla->addWidget(rufModeBox);
rufla->addWidget(indexIncr);
rnla->addLayout(rufla);
nextNameL = new QLabel("Next Label is: C1");
nextNameL->setFont(QFont("Helvetica",16,QFont::Bold));
rnla->addWidget(nextNameL);
rnla->addWidget(qsa);
psew = new PSEWidget(&mole,this);
psew->selection=0;
psew->setVisible(false);
rnla->addWidget(psew);
willpse = new QPushButton("more scattering factors");
willpse->setStyleSheet(
QString(
"QPushButton {"
"border: 1px solid #000000;"
"border-radius: 9px;"
"background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 %1, stop: 0.5 %3, stop: 1 %2);"
"}"
"QPushButton:hover {"
"background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 %2, stop: 0.5 %1, stop: 1 %2);"
"}"
"QPushButton:flat {"
" border: none; /* no border for a flat push button */"
"}"
).arg("#dedede").arg("#eeeeee").arg("#aeaeae"));
connect(willpse,SIGNAL(clicked()),psew,SLOT(show()));
hidwillpse=new QTimer(this);
hidwillpse->setSingleShot(true);
hidwillpse->setInterval(100);
connect(willpse,SIGNAL(clicked()),hidwillpse,SLOT(start()));
connect(hidwillpse,SIGNAL(timeout()),willpse,SLOT(hide()));
connect(psew,SIGNAL(pseSelected(int, bool)),psew,SLOT(hide()));
connect(psew,SIGNAL(pseSelected(int, bool)),willpse,SLOT(show()));
connect(psew,SIGNAL(pseSelected(int, bool)),this,SLOT(addNewScatteringFactor(int,bool)));
rnla->addWidget(willpse);
buttonBoxRN = new QDialogButtonBox( QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
buttonBoxRN->hide();
rnla->addWidget(buttonBoxRN);
renameBox->setLayout(rnla);
renamDock->setWidget(renameBox);
addDockWidget(Qt::RightDockWidgetArea, renamDock);
renamDock->hide();
tabifyDockWidget (shxEditorDock,renamDock);
//rename dock
//
qPeakDock = new QDockWidget("Q-Peak-Legend");
qPeakDock->setObjectName("Peak");
qPeakDock->hide();
qPeakDock->setFixedWidth(50);
qPeakDock->setToolTip("Click or scroll here to reduce the number of Q-peaks shown.");
qPeakDock->setFeatures(QDockWidget::DockWidgetClosable);
showQPeakLegend = qPeakDock->toggleViewAction ();
connect(showQPeakLegend, SIGNAL(toggled(bool )),this,SLOT(setMonoQ(bool )));
showQPeakLegend->setIcon(QIcon(theIconPath+"qlegend.svg"));
qpv = new QPeakView();
qPeakDock->setWidget(qpv);
addDockWidget(Qt::LeftDockWidgetArea,qPeakDock);
//HISTORY
histDock = new QDockWidget("Refinement History");
histDock->setObjectName("History");
hw = new HistoryWidget();
qsa2 =new QScrollArea();
hwl = new QVBoxLayout();
hwl->addWidget(hw);
qsa2->setLayout(hwl);
qsa2->setWidget(hw);
qsa2->setAlignment(Qt::AlignBottom|Qt::AlignLeft);
histDock->hide();
histDock->setFeatures(QDockWidget::DockWidgetMovable|
QDockWidget::DockWidgetFloatable|
QDockWidget::DockWidgetClosable);
histDock->setWidget(qsa2);
histDock->setMinimumSize(100,150);
addDockWidget(Qt::RightDockWidgetArea,histDock);
connect(hw, SIGNAL(message(const QString&)), this, SLOT(updateStatusBar(const QString&)));
connect(hw, SIGNAL(lofi(const QString&)), this, SLOT(loadFile(const QString&)));
connect(hw, SIGNAL(saveHist()), this, SLOT(openSaveHistory()));
//HISTORY
scalePic=1.0;
if ((Revision%666)==0)
setWindowTitle(QString("%1 - A clumsy GUI for sHELLxl (Rev: %2)(easteregg) ")
.arg(PROGRAM_NAME)
.arg(Revision));
else
setWindowTitle(QString("%1 - A Qt GUI for SHELXL (Rev: %2)(%3bit)(Qt%4)").arg(PROGRAM_NAME).arg(Revision)
.arg(BitWidth)
.arg(qtmajor)
);
//printf("line %d %p\n", __LINE__, _chgl);
chgl = new PlayOpenGL(&mole);
#if defined (Q_OS_MAC)
static QWidget *container = QWidget::createWindowContainer(chgl);
container->setObjectName("The Main Window");
#endif
//printf("line %d %p\n", __LINE__, chgl,container);
chgl->setMolecule(&mole);
chgl->QPeakLegend = showQPeakLegend;
editor->setgl(chgl);
xlPutor->setgl(chgl);
connect(qpv,SIGNAL(cutOffChanged(double)),chgl,SLOT(setQpeakCutoff(double)));
connect(qpv,SIGNAL(findQP(double)),chgl,SLOT(highliteQPeak(double)));
connect(chgl,SIGNAL(qpfoci(double)),qpv,SLOT(qpeaksInFocus(double)));
connect(renamDock,SIGNAL(visibilityChanged(bool)),chgl,SLOT(setReNaMo(bool)));
connect(renamDock,SIGNAL(visibilityChanged(bool)),this,SLOT(updateLabel()));
connect(renamDock,SIGNAL(visibilityChanged(bool)),this,SLOT(renamUpdate(bool)));
connect(chgl,SIGNAL(message(const QString&)),this,SLOT(updateStatusBar(const QString&)));
connect(chgl,SIGNAL(bigmessage(const QString&)),this,SLOT(infoKanalNews(const QString&)));
connect(chgl,SIGNAL(jumpit(int)),this ,SLOT(jumpToAtom(int)));
connect(chgl,SIGNAL(insertDFIX(double,double,QList,QString)), editor,SLOT(insertDFIX(double,double,QList,QString)));
connect(chgl,SIGNAL(bindthem()),editor,SLOT(insertBind()));
connect(chgl,SIGNAL(insertDANG(double,double,QList,QString)), editor,SLOT(insertDANG(double,double,QList,QString)));
connect(chgl,SIGNAL(insertFLAT(double,QList,QString)), editor,SLOT(insertFLAT(double,QList,QString)));
connect(chgl,SIGNAL(insertEXYZ(QList)), editor, SLOT(insertEXYZ(QList)));
connect(chgl,SIGNAL(insertEADP(QList)), editor, SLOT(insertEADP(QList)));
connect(chgl,SIGNAL(insertSADI(int)), this, SLOT(insertSADI(int)));
connect(chgl,SIGNAL(insertDELU(double, double, QList,QString)), editor,SLOT(insertDELU(double,double,QList,QString)));
connect(chgl,SIGNAL(insertSIMU(double,double,double,QList,QString)), editor,SLOT(insertSIMU(double,double,double,QList,QString)));
connect(chgl,SIGNAL(insertISOR(double,double,QList,QString)), editor,SLOT(insertISOR(double,double,QList,QString)));
connect(chgl,SIGNAL(insertRIGU(double, double, QList,QString)), editor,SLOT(insertRIGU(double,double,QList,QString)));
connect(chgl,SIGNAL(insertCHIV(double, double, QList,QString)), editor,SLOT(insertCHIV(double,double,QList,QString)));
connect(chgl,SIGNAL(insertANIS(QList)), editor, SLOT(insertANIS(QList)));
QAction *sma =new QAction("Show matrices (for debugging)",this);
sma->setShortcut(tr("Alt+F1"));
connect(sma,SIGNAL(triggered()),chgl,SLOT(showMatrix()));
for (int i = 0; i < MaxRecentFiles; ++i) {
recentFileActs[i] = new QAction(this);
recentFileActs[i]->setVisible(false);
connect(recentFileActs[i], SIGNAL(triggered()),
this, SLOT(openRecentFile()));
}
fileMenu = new QMenu(tr("File"), this);
//printf("line %d\n",__LINE__);
chgl->sfacMenu = new QMenu(tr("Change element to..."));
chgl->selSfacMenu = new QMenu(tr("Change elements of selection to..."));
editMenu = new QMenu(tr("Edit"),this);
dialogMenu = new QMenu(tr("Settings"), this);
viewMenu = new QMenu(tr("View"), this);
runMenu = new QMenu(tr("SHELX"),this);
runMenu->setObjectName("SHELX");
packMenu = new QMenu(tr("Pack"),this);
packMenu->setEnabled(false);
QMenu *fcoMenu = new QMenu("Tools");
//printf("line %d\n",__LINE__);
{
QAction *a = symmElementsAct = packMenu->addAction("Show Symmetry Elements", this, SLOT(symmElements(bool)));
a->setCheckable(true);
a->setChecked(false);
//a->setVisible(false);
}
extraMenu = new QMenu(tr("Extra"),this);
{
QAction *a;
a = switch2HKLF5 = runMenu->addAction("Switch to HKLF 5 refinement.", this, SLOT(go2hklf5()));
a->setVisible(false);
switch2HKLF5->setObjectName("switch2HKLF5");
a = switch2HKLF4 = runMenu->addAction("Switch to HKLF 4 refinement.", this, SLOT(go2hklf4()));
a->setVisible(false);
a = refineAct = runMenu->addAction(QIcon(theIconPath+"refine.svg"),"Copy current file to instruction file and run shelxl",this,SLOT(runShelXL()));
a->setShortcut(QKeySequence("F2"));
a->setData(0);
refineAct->setVisible(false);
refineAct->setEnabled(false);
a->setObjectName("refineAct");
a = refineActAnis = runMenu->addAction(QIcon(theIconPath+"refineanis.svg"),"Insert ANIS and run shelxl",this,SLOT(runShelXL()));
a->setShortcut(QKeySequence("Alt+F2"));
a->setData(1);
refineActAnis->setVisible(false);
refineActAnis->setEnabled(false);
a->setObjectName("refineActAnis");
a = refineActActa = runMenu->addAction(QIcon(theIconPath+"refineacta.svg"),"Insert ACTA and run shelxl",this,SLOT(runShelXL()));
a->setData(2);
refineActActa->setVisible(false);
refineActActa->setEnabled(false);
a = refineActExti = runMenu->addAction("Insert EXTI and run shelxl",this,SLOT(runShelXL()));
a->setData(3);
refineActExti->setVisible(false);
refineActExti->setEnabled(false);
a = refineActConf = runMenu->addAction("Insert CONF and run shelxl",this,SLOT(runShelXL()));
a->setData(4);
refineActConf->setVisible(false);
refineActConf->setEnabled(false);
wghtRefineAct=runMenu->addAction(QIcon(theIconPath+"wghtref.svg"),QString("Try to refine until WGHT converges (max %1 runs)").arg(wght_max_cycls),this,SLOT(convergeWght()));
if (canWeSqueeze()) {
squeezeAct=a=fcoMenu->addAction(QIcon(theIconPath+"squeeze.svg"),"PLATON SQUEEZE this data",this,SLOT(runSqueeze()));
}
else squeezeAct=nullptr;
QIcon icke = QIcon(theIconPath+"autohfix.svg");
a=actionHFix=runMenu->addAction(icke,
tr("Automatic H-Fi&x"),this,SLOT(autoHFix()));
a->setObjectName("actionHFix");
a=runMenu->addAction("DISPersion from WAVElength", editor, SLOT(dispFromWave()));
a=runMenu->addAction("Replace SFAC by elastic electron atomic scattering factors",editor,SLOT(insertElectronSFACs()));
a=actionUniq=runMenu->addAction("Move centers of gravity into unit cell",this,SLOT(uniq()));
a->setObjectName("actionUniq");
runMenu->addAction("UNIQue ", this, SLOT(unique()));
runMenu->addAction("Update UNIT instruction", editor, SLOT(updateUnit()));
runMenu->addAction("Weed unused SFAC numbers ", editor, SLOT(weedEmptySfacs()));
wghtAct=runMenu->addAction("Update WGHT instruction",editor,SLOT(updateWght()));
wghtAct->setEnabled(false);
runMenu->addAction("Invert structure", this, SLOT(invert()));
runMenu->addAction("Fix some parameters", this, SLOT(fixIt()));
sinaAct = runMenu->addAction(QIcon(theIconPath+"sina.svg"),"Make (selected or all) atoms isotropic (ISOT)",this,SLOT(sina()));
sinaAct->setObjectName("sinaAct");
sinaAct->setData(-1);
fcoMenu->addAction("Create Q-Peaks from Fo-Fc map",this, SLOT(addMoreQPeaks()));
actionQPeakLimit = fcoMenu->addAction(QString("Change maximum number of created Q-peaks (%1)").arg(MaxNumberOfPeaks),this,SLOT(changeQPeakLimit()));
fcoMenu->addAction("Most Disagreeable Reflections",this,SLOT(worstReflections()));
fcoMenu->addAction("Split rotate molecule branch",this,SLOT(splitRotate()));
a=fcoMenu->addAction("test for merohedral twinning");
twinDlg=nullptr;
connect(a,SIGNAL(triggered() ),this,SLOT(testMerohedral()));
runMenu->addAction(QIcon(theIconPath+"aula.svg"),"Automatic Labeling", this, SLOT(aula()));
runMenu->addSeparator();
editor->sortierWeise=1;
soact=runMenu->addAction("Sort atoms in file.",editor ,SLOT(sortAtoms()));
runMenu->addSeparator();
a=runMenu->addAction("...find more functions in Menu->Tools");
a->setDisabled(true);
runMenu->addSeparator();
runMenu->addAction("Specify SHELXL runtime options",this , SLOT(setShelxlOptions()));
}
{
QToolBar *tb =fito= new QToolBar(this);
tb->setWindowTitle(tr("File Tools"));
tb->setObjectName("FileTB");
addToolBar(tb);
QAction *a;
openAct=a=fileMenu->addAction(QIcon(theIconPath+"open.svg"),
tr("&Open..."), this, SLOT(openFile() ),QKeySequence(tr("Ctrl+O", "File|Open")));
tb->addAction(a);
actionSave = new QAction(QIcon(theIconPath+"filesave.svg"),tr("&Save"), this);
actionSave->setShortcut(QKeySequence::Save);
connect(actionSave, SIGNAL(triggered()), this, SLOT(fileSave()));
actionSave->setEnabled(false);
tb->addAction(actionSave);
fileMenu->addAction(actionSave);
actionSaveAs = new QAction(QIcon(theIconPath+"filesave.svg"),tr("&Save as ..."), this);
actionSaveAs->setShortcut(tr("Shift+Alt+S"));
connect(actionSaveAs, SIGNAL(triggered()), this, SLOT(fileSaveAs()));
actionSaveAs->setEnabled(true);
fileMenu->addAction(actionSaveAs);
fileMenu->addAction(tr("Open save history"),this,SLOT(openSaveHistory()));
fileMenu->addAction("Shred a CIF and load its res",this,SLOT(shredCIF()));
fileMenu->addSeparator();
screenshotAct=a=fileMenu->addAction(QIcon(theIconPath+"diskette.svg"),
tr("&ScreenShot"), this, SLOT(saveScene()), QKeySequence(tr("F7","File|ScreenShot")));
//tb->addAction(a);
actionPovRay=a=fileMenu->addAction(QIcon(theIconPath+"POV-Ray.ico"),"Export Scene to Pov-Ray",this, SLOT(savePovRay()));
a->setShortcut(Qt::ALT|Qt::Key_P);
tb->addAction(a);
objExport=a=fileMenu->addAction(QIcon(theIconPath+"obj.svg"),"Export Wafefront .obj file",this,SLOT(obj()));
tb->addAction(a);
a->setShortcut(Qt::ALT|Qt::Key_O);
fileMenu->addAction("Export Fourier Maps",this,SLOT(exportFMaps()));
fileMenu->addAction("Export visible atoms ...",this,SLOT(exportCoordinates()));
actionExportCC=fileMenu->addAction("Export for computational chemistry programs",this, SLOT(exportCC()));
fileMenu->addSeparator();
for (int i = 0; i < MaxRecentFiles; ++i)
fileMenu->addAction(recentFileActs[i]);
fileMenu->addSeparator();
fileMenu->addAction("Set default path",this,SLOT(setDefaultPath()));
fileMenu->addSeparator();
a=fileMenu->addAction(QIcon(theIconPath+"cancel.svg"), tr("&Quit") ,
this, SLOT(close()),QKeySequence(tr("Ctrl+Q", "File|Quit")));
tb->addAction(a);
}
//printf("line %d\n", __LINE__);
backColor = new QAction(tr("Change background color"), this);
labelColor = new QAction(tr("Change label color"), this);
backColor->setShortcut (tr("Shift+Alt+B"));
labelColor->setShortcut(tr("Shift+Alt+T"));
connect(backColor, SIGNAL (triggered ()), chgl, SLOT(changeBColor()));
connect(labelColor, SIGNAL (triggered ()), chgl, SLOT(changeTColor()));
dialogMenu->addAction("Change tool bar icon size",this,SLOT(changeIconSize()));
QAction *adoptAct=
dialogMenu->addAction("Edit tool bar is attached to Editor",this,SLOT(adoptEditToolBar(bool)));
adoptAct->setCheckable(true);
adoptAct->setChecked(false);
dialogMenu->addAction("Change screen shot resolution",this,SLOT(changeScalefactor()));
dialogMenu->addAction("Number of atoms in asymmetric unit to skip automatic distance calculation on loading",this, SLOT(setSDMLimit()));
dialogMenu->addAction("Number of max cycles in WGHT refine", this ,SLOT(setMaxWGHTCycls()));
separateLabelFile= dialogMenu->addAction("Render labels in a separate file");
separateLabelFile->setCheckable(true);
separateLabelFile->setChecked(false);
dialogMenu->addAction(backColor);
dialogMenu->addAction(labelColor);
dialogMenu->addAction(tr("Change label font"), this, SLOT(changeLabelFont()));
dialogMenu->addAction(tr("Change editor font"), this, SLOT(changeEditorFont()));
astdlg = dialogMenu->addAction(QIcon(theIconPath+"eac.svg"),"Atom Styles", this,SLOT(styleDialog()),QKeySequence("Alt+Shift+A"));
dialogMenu->addAction("Save current orientation matrix",chgl,SLOT(saveOrientation()));
dialogMenu->addAction("Load orientation matrix",chgl,SLOT(loadOrientation()));
editMenu->addAction(enterRenameMode);
{
QToolBar *tb = editToolBar = new QToolBar(this);
tb->setObjectName("EditTB");
tb->setWindowTitle(tr("Editor Tools"));
QAction *a;
actionEP=a=viewMenu->addAction(QIcon(theIconPath+"efplus.svg"), "Increase editor fontsize");
actionEP->setShortcut(QKeySequence(QKeySequence::ZoomIn));
connect(actionEP,SIGNAL(triggered()), editor, SLOT(increaseEdtiorFont()));
connect(actionEP,SIGNAL(triggered()), xlPutor,SLOT(increaseEdtiorFont()));
tb->addAction(a);
actionEM=a=viewMenu->addAction(QIcon(theIconPath+"efminus.svg"), "Decrease editor fontsize");
actionEM->setShortcut(QKeySequence(QKeySequence::ZoomOut));
connect(actionEM,SIGNAL(triggered()), editor, SLOT(decreaseEdtiorFont()));
connect(actionEM,SIGNAL(triggered()), xlPutor, SLOT(decreaseEdtiorFont()));
tb->addAction(a);
a = actionUndo = new QAction(QIcon( theIconPath+"editundo.svg"),tr("&Undo"), this);
a->setShortcut(QKeySequence::Undo);
a->setEnabled(false);
tb->addAction(a);
editMenu->addAction(a);
a = actionRedo = new QAction(QIcon( theIconPath+"editredo.svg"),tr("&Redo"), this);
a->setShortcut(QKeySequence::Redo);
a->setEnabled(false);
tb->addAction(a);
editMenu->addAction(a);
editMenu->addSeparator();
a = actionCut = new QAction(QIcon(theIconPath+"editcut.svg"),tr("Cu&t"), this);
a->setShortcut(QKeySequence::Cut);
a->setEnabled(false);
tb->addAction(a);
editMenu->addAction(a);
a = actionCopy = new QAction(QIcon(theIconPath+"editcopy.svg"),tr("&Copy"), this);
a->setShortcut(QKeySequence::Copy);
a->setEnabled(false);
tb->addAction(a);
editMenu->addAction(a);
a = actionPaste = new QAction(QIcon(theIconPath+"editpaste.svg"),tr("&Paste"), this);
a->setShortcut(QKeySequence::Paste);
a->setEnabled(false);
tb->addAction(a);
editMenu->addAction(a);
//printf("line %d\n",__LINE__);
#ifndef QT_NO_CLIPBOARD
actionPaste->setEnabled(!QApplication::clipboard()->text().isEmpty());
connect(QApplication::clipboard(), SIGNAL(dataChanged()), this, SLOT(clipboardDataChanged()));
#endif
a=actionSearch=editMenu->addAction(QIcon(theIconPath+"search.svg"),
"&Find in Text",this,SLOT(showSearch()),QKeySequence(tr("Ctrl+F", "Edit|Find")));
tb->addAction(a);
a->setEnabled(false);
a=actionNext=editMenu->addAction(QIcon(theIconPath+"moveright.svg"),
tr("Find &Next"),this ,SLOT(findNext()),QKeySequence(tr("F3","Edit|Next")));
a->setEnabled(false);
a=actionPrev=editMenu->addAction(QIcon(theIconPath+"moveleft.svg"),
tr("Find &Previous"),this, SLOT(findPrev()), QKeySequence(tr("Shift+F3", "Edit|Previous")));
a->setEnabled(false);
editToolBar->hide();
//printf("line %d\n",__LINE__);
}
{
QToolBar *tb = refineToolBar = new QToolBar(this);
tb->setObjectName("RefineTB");
tb->setWindowTitle(tr("Refinement Tools"));
addToolBar(tb);
tb->addAction(actionHFix);
QIcon icke=QIcon(theIconPath+"killqs.svg");
QAction *a;
a=killQs=editMenu->addAction(icke,
tr("Delete all Q-peaks"), this, SLOT(deleteAllQ()), QKeySequence(tr("Meta+Shift+Q")));
tb->addAction(a);
icke=QIcon(theIconPath+"killhs.svg");
a=killHs=editMenu->addAction(icke, tr("Delete all Hydrogen atoms"),this,SLOT(deleteAllH()), QKeySequence(tr("Meta+Shift+H")));
tb->addAction(a);
tb->addAction(refineAct);
tb->addAction(refineActAnis);
tb->addAction(wghtRefineAct);
if (squeezeAct!=nullptr) tb->addAction(squeezeAct);
refineToolBar->hide();
}
//printf("line %d\n",__LINE__);
{
//QToolBar *tb =
vito = new QToolBar(this);
vito->setWindowTitle(tr("View Tools"));
vito->setObjectName("ViewTB");
addToolBar(vito);
QAction *a;
/*
stereoMenu = new QMenu("&3D Stereo Options");
//zm_stereo = stereoMenu->addAction("&Zalman Monitor 3D");
pe_stereo = stereoMenu->addAction("&Parallel Eye Side by Side Stereo");
xe_stereo = stereoMenu->addAction("&Crossed Eye Side by Side Stereo");
an_stereo = stereoMenu->addAction("&Anaglyph Stereo red left blue right(testing)");
//hw_stereo = stereoMenu->addAction("&Hardware Stereo (testing)");
//printf("line %d\n",__LINE__);
//hw_stereo->setEnabled(chgl->context()->format().stereo());
//printf("line %d\n",__LINE__);
no_stereo = stereoMenu->addAction("Stereo &Mode off");
//connect(zm_stereo,SIGNAL(triggered()),chgl,SLOT(zalman()));
connect(pe_stereo,SIGNAL(triggered()),chgl,SLOT(parallel()));
connect(xe_stereo,SIGNAL(triggered()),chgl,SLOT(crosseye()));
connect(an_stereo,SIGNAL(triggered()),chgl,SLOT(anaglyphRedCyan()));
//connect(hw_stereo,SIGNAL(triggered()),chgl,SLOT(hardwareStereo()));
connect(no_stereo,SIGNAL(triggered()),chgl,SLOT(nostereo()));
stereoGroup = new QActionGroup(this);
//stereoGroup->addAction(zm_stereo);
stereoGroup->addAction(pe_stereo);
stereoGroup->addAction(xe_stereo);
stereoGroup->addAction(an_stereo);
//stereoGroup->addAction(hw_stereo);
stereoGroup->addAction(no_stereo);
//zm_stereo->setCheckable(true);
pe_stereo->setCheckable(true);
xe_stereo->setCheckable(true);
an_stereo->setCheckable(true);
//hw_stereo->setCheckable(true);
no_stereo->setCheckable(true);
no_stereo->setChecked(true);
viewMenu->insertMenu(actionEP,stereoMenu);
viewMenu->insertSeparator(actionEP);
*/
moveMenu = new QMenu("Move Menu");
moveMenu->addAction(tr("Zoom in") ,this,SLOT(zoomin ()), QKeySequence(Qt::ALT | Qt::Key_PageUp) );
moveMenu->addAction(tr("Zoom out") ,this,SLOT(zoomout()), QKeySequence(Qt::ALT | Qt::Key_PageDown));
moveMenu->addAction(tr("Rotate left") ,this,SLOT(rotl ()), QKeySequence(Qt::ALT | Qt::Key_Left) );
moveMenu->addAction(tr("Rotate right") ,this,SLOT(rotr ()), QKeySequence(Qt::ALT | Qt::Key_Right) );
moveMenu->addAction(tr("Rotate upwards") ,this,SLOT(rotu ()), QKeySequence(Qt::ALT | Qt::Key_Up) );
moveMenu->addAction(tr("Rotate downwards") ,this,SLOT(rotd ()), QKeySequence(Qt::ALT | Qt::Key_Down) );
moveMenu->addAction(sma);
moveMenu->addAction("test test 1 2",this, SLOT(testOGL()),QKeySequence(Qt::META|Qt::SHIFT|Qt::Key_A) );
//printf("line %d\n",__LINE__);
moveMenu->addAction("Zoom out", chgl, SLOT(zoomOut()), QKeySequence(Qt::ALT | Qt::CTRL | Qt::Key_Z));
moveMenu->addAction("View along z direction",chgl,SLOT(along001()));
viewMenu->insertMenu(actionEP,moveMenu);
//printf("line %d\n",__LINE__);
QIcon icke=QIcon(theIconPath+"ideal.svg");
chgl->hideBeLo=viewMenu->addAction(icke,"Toggle BEDE and LONE objects (IDEAL)",chgl,SLOT(update()));
chgl->hideBeLo->setCheckable(true);
chgl->hideBeLo->setChecked(true);
chgl->hideBeLo->setVisible(false);
belocube = viewMenu->addAction("Compute and visualize BODD in direct space (IDEAL)" ,this,SLOT(beloWriteCube()));
belocube->setVisible(false);
belocube->setObjectName("BeLoCube");
belocube->setShortcut(Qt::CTRL|Qt::Key_I);
a=dialogMenu->addAction("HFIX only on suitable atoms", this, SLOT(toggleHFSAO(bool)));
a->setCheckable(true);
a->setChecked(mole.HFixSuitableAtomsOnly);
//printf("line %d\n",__LINE__);
dialogMenu->addAction("Style BEDE and LONE objects (IDEAL)",this,SLOT(configBeLos()));
chgl->shortLabels=viewMenu->addAction("Short Labels",chgl,SLOT(makeLabels()));
chgl->shortLabels->setCheckable(true);
chgl->shortLabels->setChecked(true);
chgl->shortLabels->setShortcut(Qt::SHIFT | Qt::ALT | Qt::Key_L);
vito->addAction(astdlg);
a=togAtom =viewMenu->addAction(QIcon(theIconPath+"atoms.svg"),
tr("Toggle Atoms"), chgl, SLOT(setAtoms(bool)), QKeySequence("Alt+A"));
a->setCheckable(true);
a->setChecked(true);
vito->addAction(a);
a=chgl->tubes = vito->addAction(QIcon(theIconPath+"tubes.svg"),"Tubes",chgl,SLOT(update()));
a=chgl->ballStick = vito->addAction(QIcon(theIconPath+"ballstick.svg"),"Ball-Stick",chgl,SLOT(update()));
tubeGroup = new QActionGroup(this);
tubeGroup->addAction(chgl->tubes);
tubeGroup->addAction(chgl->ballStick);
chgl->ballStick->setCheckable(true);
chgl->ballStick->setChecked(true);
connect(chgl->ballStick, SIGNAL(triggered()), chgl, SLOT(makeLegendAtoms()));
chgl->tubes->setCheckable(true);
chgl->tubes->setChecked(false);
connect(chgl->tubes, SIGNAL(triggered()), chgl, SLOT(makeLegendAtoms()));
//printf("line %d\n",__LINE__);
{
QIcon icke=QIcon(theIconPath+"adp.svg");
//icke.addFile(theIconPath+"adp23.svg");
a=chgl->adp =viewMenu->addAction(icke, tr("Toggle ADPs"), chgl, SLOT(update()), QKeySequence("Alt+E"));
connect(chgl->adp, SIGNAL(triggered()), chgl, SLOT(makeLegendAtoms()));
}
a->setCheckable(true);
a->setChecked(true);
vito->addAction(a);
a=togBond =viewMenu->addAction(QIcon(theIconPath+"bonds.svg"),
tr("Toggle Bonds"), chgl, SLOT(setBonds(bool)), QKeySequence("Alt+B"));
a->setCheckable(true);
a->setChecked(true);
vito->addAction(a);
a=togLabel=viewMenu->addAction(QIcon(theIconPath+"labels.svg"),
tr("Toggle Labels"),chgl,SLOT(setLabels(bool)),QKeySequence("Alt+L"));
a->setCheckable(true);
a->setChecked(true);
vito->addAction(a);
//printf("line %d\n",__LINE__);
/*
a=viewMenu->addAction(QIcon(theIconPath+"laplus.svg"),
tr("Increase label fontsize"),chgl,SLOT(incFontSize()),
QKeySequence("Alt++"));
a=viewMenu->addAction(QIcon(theIconPath+"laminus.svg"),
tr("Decrease label fontsize"),chgl,SLOT(decFontSize()),
QKeySequence("Alt+-"));*/
//printf("line %d\n", __LINE__);
a=chgl->togUnit =viewMenu->addAction(QIcon(theIconPath+"unitcell.svg"),
tr("Toggle Unit Cell"),chgl,SLOT(update()),QKeySequence("Alt+C"));
a->setCheckable(true);
a->setChecked(false);
vito->addAction(a);
//printf("line %d %p\n", __LINE__,viewMenu,chgl->h_bonds);
a=chgl->h_bonds=viewMenu->addAction(QIcon(theIconPath+"hbrs.svg"),
tr("Toggle H-bonds"),chgl,SLOT(update()),QKeySequence("Alt+H"));
a->setCheckable(true);
a->setChecked(true);
vito->addAction(a);
//printf("line %d %p %d\n", __LINE__, chgl->h_bonds, chgl->h_bonds->isVisible());
a=chgl->atomLegend=viewMenu->addAction(QIcon(theIconPath+"legend.svg"),
tr("Toggle Atom Legend"),chgl,SLOT(update()), QKeySequence("Alt+K"));
a->setCheckable(true);
a->setChecked(true);
vito->addAction(a);
//printf("line %d\n",__LINE__);
fxle= new FourXle(&mole, chgl, vito);
//printf("line %d\n",__LINE__);
fxle->mapcontrol=dialogMenu->addAction(QIcon(theIconPath+"mapcontrol.svg"),tr("Open Map Control"), fxle, SLOT(openMapControl()));
vito->addAction(fxle->mapcontrol);
fxle->mapcontrol->setVisible(false);
connect(chgl,SIGNAL(destroyed()),fxle ,SLOT(killFourXleFirst()));//maybe tidy up before die
connect(fxle,SIGNAL(reloadRes()),this ,SLOT(loadAFile()));
connect(fxle->jnkButton,SIGNAL(pressed()),this,SLOT(jnk()));
fxle->keepiso = dialogMenu->addAction("Keep Map Iso Values Fixed", fxle, SLOT(keepIsoValues(bool )));
fxle->keepiso->setCheckable(true);
fxle->keepiso->setChecked(fxle->keepIso->isChecked());//diffent CaSe !
/*a=viewMenu->addAction(tr("Toggle MSAA"),chgl,SLOT(setMSAA(bool)),QKeySequence("F4"));
a->setCheckable(true);
a->setChecked(true);*/
a=equivHighlighting=viewMenu->addAction("Highlight Symmetry Equivalents",this,SLOT(toggleEQHighlighting(bool)));
equivHighlighting->setCheckable(true);
equivHighlighting->setChecked(true);
a=togBackGr=viewMenu->addAction(tr("Toggle Background Gradient"), chgl, SLOT(setBGGradient(bool)), QKeySequence("F6"));
a->setCheckable(true);
a->setChecked(true);
viewMenu->addAction(dock->toggleViewAction());
viewMenu->addAction(shxEditorDock->toggleViewAction());
//viewMenu->addAction(chgl->wireButt);
viewMenu->addAction(chgl->rainbowPlot);
/*=togDepthCueing=viewMenu->addAction(tr("toggle DepthCueing (mist)"),chgl,SLOT(setDepthCueing(bool)), QKeySequence(Qt::ALT | Qt::Key_M));//=togDepthCueing
a->setCheckable(true);
a->setChecked(false);*/
//printf("line %d\n",__LINE__);
viewMenu->addSeparator();
ydleStart=viewMenu->addAction("Start rotation", this, SLOT(idleRotStart()), QKeySequence(Qt::ALT | Qt::Key_Y));
ydleStop=viewMenu->addAction("Stop rotation", this, SLOT(idleRotStop()), QKeySequence(Qt::CTRL | Qt::ALT | Qt::Key_Space));
ydleStop->setVisible(false);
QAction *moviMaker = viewMenu->addAction("Create a Rotation Movie", this,SLOT(makeRotMovi()));
moviMaker->setShortcut(Qt::CTRL | Qt::Key_M);
viewMenu->addSeparator();
viewMenu->addAction("Redraw Structure", this, SLOT(effuenf()), QKeySequence("F5"));
viewMenu->addAction("Reload Structure From Current File", this,SLOT(loadAFile()), QKeySequence("Ctrl+F5"));
{
QAction *a=
viewMenu->addAction("Create Voronoi Polyeders of Asymmetric Unit",this,SLOT(makeVoro()));
a->setData(-1);
}
{
QAction *a=clearVoro=
viewMenu->addAction("Remove Voronoi Polyeder(s) ",this,SLOT(clearVoros()));
a->setData(-1);
clearVoro->setVisible(false);
}
//viewMenu->addAction("hide me!",this, SLOT(hide()),QKeySequence("F12"));
//viewMenu->addAction("show must go on!",this, SLOT(show()),QKeySequence("F10"));
if (!QString(PROGRAM_NAME).compare("shelXle"))//olny in standalone shelXle
viewMenu->addAction("Fullscreen Mode", this, SLOT(toggleFullScreen()), QKeySequence("F11"));
}
{
QAction *a;
QToolBar *tb=bottomToolBar= new QToolBar("Atom Selection Tools",this);
tb->setObjectName("AtomTB");
tb->setMovable(false);
tb->setAllowedAreas(Qt::BottomToolBarArea|Qt::TopToolBarArea);
tb->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
QMenu *m= new QMenu("Configure selection toolbar");
a=m->addAction("Text Only",this,SLOT(configureBottomToolbar()));
a->setData(Qt::ToolButtonTextOnly);
a=m->addAction("Icon Only",this,SLOT(configureBottomToolbar()));
a->setData(Qt::ToolButtonIconOnly);
a=m->addAction("Text Beside Icon",this,SLOT(configureBottomToolbar()));
a->setData(Qt::ToolButtonTextBesideIcon);
a=m->addAction("Text Under Icon",this,SLOT(configureBottomToolbar()));
a->setData(Qt::ToolButtonTextUnderIcon);
m->addSeparator();
a=m->addAction("Place on Top",this,SLOT(configureBottomToolbar()));
a->setData(static_cast(Qt::TopToolBarArea) + 32);
a=m->addAction("Place on Bottom",this,SLOT(configureBottomToolbar()));
a->setData(static_cast(Qt::BottomToolBarArea) + 32);
useNativeDlg=dialogMenu->addAction("Use Native Dialog for File Open/Save",this,SLOT(fileNative()));
useNativeDlg->setCheckable(true);
useNativeDlg->setChecked(true);
darkTheme=dialogMenu->addAction("Use Dark Colors Theme",this,SLOT(darkEdit()));
darkTheme->setCheckable(true);
darkTheme->setChecked(false);
if (QString(PROGRAM_NAME).compare("shelXle")){
darkTheme->setVisible(false);
}
a=dialogMenu->addAction(QIcon(theIconPath+"configure-toolbars.svg"),"Configure Selection Toolbar");
a->setToolTip("Configure Selection Toolbar icon/text style");
a->setMenu(m);
chgl->toggleDockWidgets= a = tb->addAction(QIcon(theIconPath+"hidedockwdg.svg"), "Hide Text Windows",this,SLOT(toggDocWid(bool)));
a->setCheckable(true);
a->setChecked(false);
a->setVisible(false);
chgl->toggleOrthoView = a = tb->addAction(QIcon(theIconPath+"ortho.svg"), "Ortho-projection",this,SLOT(toggleOrtho(bool)));
a->setCheckable(true);
a->setChecked(false);
a->setToolTip("toggle Orthographic Projection / Central Perspective Projection");
chgl->grow=a=tb->addAction(QIcon(theIconPath+"grow.svg"),"GROW ",this,SLOT(grow()));
a->setShortcut(Qt::ALT | Qt::Key_G);
packMenu->addAction(a);
a->setToolTip("Complete the Molecule(s)");
a->setVisible(false);
chgl->fuse=a=tb->addAction(QIcon(theIconPath+"fuse.svg"),"FUSE ",this,SLOT(fuse()));
a->setShortcut(Qt::ALT | Qt::Key_F);
packMenu->addAction(a);
a->setVisible(false);
a->setToolTip("Show the Asymmetric Unit Only");
recalcSDM=a=packMenu->addAction(QIcon(theIconPath+"grow.svg"),"Recalculate Distance Matrices",this,SLOT(sdm()));
recalcSDM->setShortcut(Qt::CTRL | Qt::Key_R);
QToolBar *sptb=new QToolBar();
sptb->addAction(recalcSDM);
renamUpdateAct=sptb->addAction("Update RESIdue Class ComboBox",this,SLOT(renamUpdate(bool)));
renamUpdateAct->setCheckable(true);
renamUpdateAct->setChecked(false);
chgl->pickRadSpin=new QDoubleSpinBox(sptb);
chgl->pickRadSpin->setMinimum(5.0);
chgl->pickRadSpin->setMaximum(50.0);
chgl->pickRadSpin->setDecimals(0);
chgl->pickRadSpin->setValue(chgl->pickRad());
chgl->pickRadSpin->setPrefix("pick radius");
chgl->pickRadSpin->setSuffix("px");
connect(chgl->pickRadSpin,SIGNAL(valueChanged(double)),chgl,SLOT(setPickRad(double)));
sptb->addWidget(chgl->pickRadSpin);
rnla->addWidget(sptb);
a=packMenu->addAction("Symmetry Manager",this,SLOT(symmetryManager()));
a->setShortcut(Qt::ALT | Qt::SHIFT | Qt::Key_M);
tb->addAction(enterRenameMode);
enterRenameMode->setIcon(QIcon(theIconPath+"rename.svg"));
enterRenameMode->setVisible(false);
tb->addAction(showQPeakLegend);
showQPeakLegend->setVisible(false);
//printf("line %d\n",__LINE__);
a=tb->addAction(QIcon(theIconPath+"qbond.svg"),"Q-Peak-Bonds",chgl,SLOT(update()));
a->setCheckable(true);
a->setChecked(true);
a->setVisible(false);
chgl->qPeakBonds=a;
sinaAct->setVisible(false);
chgl->addBond=a=tb->addAction(QIcon(theIconPath+"bind.svg"),"Bind Selected Atoms",editor,SLOT(insertBind()));
a->setVisible(false);
chgl->killBond=a=tb->addAction(QIcon(theIconPath+"free.svg"),"Free Selected Atoms",editor,SLOT(insertFree()));
a->setVisible(false);
chgl->clearSelection=a=tb->addAction(QIcon(theIconPath+"deselect.svg"),"Deselect",chgl,SLOT(disSelection()));
a->setVisible(false);
chgl->centroid=a=tb->addAction(QIcon(theIconPath+"centroid.svg"), "Create Centroid", this , SLOT(createCentroid()));
a->setVisible(false);
chgl->cntrPlot = a = tb->addAction(QIcon(theIconPath+"cont.svg"),"Create Contour Plot",this, SLOT(contourPlot()));
a->setVisible(false);
chgl->nocntrPlot = a = tb->addAction(QIcon(theIconPath+"nocont.svg"),"Remove Contour Plot",this, SLOT(nocontourPlot()));
a->setVisible(false);
chgl->centerSelection=a=tb->addAction(QIcon(theIconPath+"center.svg"),"Center Selected Atoms",chgl,SLOT(homeXY()));
a->setCheckable(true);
a->setChecked(false);
a->setVisible(false);
chgl->invSelection=a=tb->addAction(QIcon(theIconPath+"invsel.svg"),"Invert Selection",chgl,SLOT(invertSelection()));
a->setVisible(false);
chgl->hideNotSelection=a=tb->addAction(QIcon(theIconPath+"hide.svg"),"Hide Other Atoms",chgl,SLOT(hideNonSelected()));
a->setVisible(false);
a=chgl->hideHydrogen=tb->addAction(QIcon(theIconPath+"hideh.svg"),"Hide Hydrogen Atoms",chgl,SLOT(hideHydrogens()));
a->setVisible(false);
chgl->unhide=a=tb->addAction(QIcon(theIconPath+"show.svg"),"Show All Hidden",chgl,SLOT(showHidden()));
connect(a,SIGNAL(triggered()),qpv,SLOT(unhide()));
a->setVisible(false);
chgl->invhide=a=tb->addAction(QIcon(theIconPath+"invshow.svg"),"Toggle Visibility ",chgl,SLOT(invertHidden()));
a->setVisible(false);
chgl->shpm1=a=tb->addAction(QIcon(theIconPath+"part-1.svg"),"Hide PART -N Ghost",chgl,SLOT(hidePartMinusOne(bool )));
a->setCheckable(true);
a->setChecked(false);
a->setVisible(false);
a->setToolTip("Hide PART -N symmetry equivalent as ghost Atoms");
//printf("line %d\n",__LINE__);
chgl->highlightParts=a=tb->addAction(QIcon(theIconPath+"parts.svg"),"Highlight PARTs",chgl,SLOT(update()));
a->setCheckable(true);
a->setChecked(false);
a->setVisible(false);
a=chgl->delSelAt = tb->addAction(QIcon(theIconPath+"killselected.svg"),"Delete Selected Atoms",this,SLOT(deleteSelectedAtoms()));
a->setData(-1);
a->setShortcut(Qt::CTRL|Qt::Key_Delete);
a->setVisible(false);
addToolBarBreak();
addToolBar(Qt::TopToolBarArea,tb);
}
{
QAction *a;
a=packMenu->addAction("Pack cell",this,SLOT(fillCell()));
a->setShortcut(Qt::ALT | Qt::SHIFT | Qt::Key_U);
a=packMenu->addAction("Expand all contacts",this,SLOT(expandAll()));
a->setShortcut(Qt::ALT | Qt::SHIFT | Qt::Key_X);
//a=packMenu->addAction("Complete asymmetric unit" ,this,SLOT(grow_plus()));
a=packMenu->addAction("Complete" ,this,SLOT(complete()));
a->setShortcut(Qt::ALT | Qt::SHIFT | Qt::Key_C);
a=packMenu->addAction("Pack inside given limits",this,SLOT(packInLimits()));
a->setShortcut(Qt::ALT | Qt::SHIFT | Qt::Key_I);
}
menuBar()->addMenu(fileMenu);
menuBar()->addMenu(editMenu);
menuBar()->addMenu(dialogMenu);
menuBar()->addMenu(viewMenu);
menuBar()->addMenu(packMenu);
menuBar()->addMenu(runMenu);
menuBar()->addMenu(extraMenu);
fcvsfoAct=fcoMenu->addAction("Fc vs Fo",this,SLOT(foversusfc()));
fcvsfoAct->setDisabled(true);
calcAct=fcoMenu->addAction("Crystallographic Calculator",this,SLOT(calculator()));
calcAct->setEnabled(true);
fcoMenu->addAction("Fractal Dimension Analysis (Henn-Meindl-plot)",this,SLOT(jnk()));
fcoMenu->addAction("Plot Atomic Scattering Factors SFAC ", editor, SLOT(plotSFAC()));
dsrAct = fcoMenu->addAction("DSR Plugin",this,SLOT(create_DSRGui()));
dsrAct->setEnabled(true);
dsrAct->setShortcut(Qt::ALT | Qt::Key_D);
menuBar()->addMenu(fcoMenu);
//printf("line %d\n",__LINE__);
{
helpMenu = new QMenu(tr("Help"), this);
menuBar()->addMenu(helpMenu);
helpMenu->addAction("Help ", this, SLOT(linkHelp()));
helpMenu->addAction(QWhatsThis::createAction(this));
helpMenu->addAction(tr("About"), this, SLOT(aboutXLE()));
helpMenu->addAction(tr("About &Qt"), qApp, SLOT(aboutQt()));
//helpMenu->addAction("Check for New Versions Now",this,SLOT(checkForUpdates()));
helpMenu->addAction("Show Key Bindings", this, SLOT(hereAreMyKeys()));
}
chgl->rCenter = new QToolButton();
chgl->rCenter->setText("Reset Rotation Center");
connect(chgl->rCenter,SIGNAL(clicked()), chgl,SLOT( rotCenter()));
chgl->rCenter->hide();
chgl->invertMouseZoom = new QToolButton(this);
chgl->invertMouseZoom->setIcon(QIcon(theIconPath+"invzoom.svg"));
chgl->invertMouseZoom->setCheckable(true);
chgl->invertMouseZoom->setChecked(false);
chgl->invertMouseZoom->setText("Invert Mouse Zoom");
chgl->invertMouseZoom->setToolTip("invert mouse zoom (right mouse click and drag up or down");
//*
quickReLoadButton = new QToolButton(this);
QIcon qrlic =QIcon();
qrlic.addFile(theIconPath+"quick-re-load.png",QSize(), QIcon::Normal, QIcon::Off );
qrlic.addFile(theIconPath+"quick-re-load_on.png",QSize(), QIcon::Normal, QIcon::On );
quickReLoadButton->setIcon(qrlic);
quickReLoadButton->setCheckable(true);
//Too many problems with this feature 11.03.2021
quickReLoadButton->setChecked(false);
quickReLoadButton->hide();
quickReLoadButton->setText("Enable QuickReLoad");
quickReLoadButton->setToolTip("QuickReLoad updates the structure instead of fresh reloading it");
//*/
homeMe = new QToolButton(this);
homeMe->setIcon(QIcon(theIconPath+"home.svg"));
homeMe->setText("home");
homeMe->setToolTip("move molecules home");
connect(homeMe,SIGNAL(clicked()),chgl,SLOT(homeXY()));
qGrowPeak = new QCheckBox("grow Q-peaks");
connect(qGrowPeak,SIGNAL(toggled(bool)),this,SLOT(growQPeaks(bool)));
search4duplicates = new QCheckBox("search for duplicates");
search4duplicates->setChecked(true);
connect(search4duplicates,SIGNAL(toggled(bool)),this,SLOT(duplicates()));
//printf("line %d\n",__LINE__);
sLabel = new QLabel;
sLabel->setFrameStyle(QFrame::Panel );
sLabel->setLineWidth(2);
sLabel->setText(QString("%1").arg(PROGRAM_NAME));
zoomIn = new QToolButton (this);
zoomIn-> setIcon(QIcon(theIconPath+"zoom-in.svg"));
zoomIn->setText("Zoom +");
zoomIn->setToolTip("Zoom +");
zoomIn->setAutoRepeat(true);
zoomIn->setAutoRepeatDelay(150);
zoomIn->setAutoRepeatInterval(3);
zoomOut = new QToolButton(this);
zoomOut->setIcon(QIcon(theIconPath+"zoom-out.svg"));
zoomOut->setText("Zoom -");
zoomOut->setToolTip("Zoom -");
zoomOut->setAutoRepeat(true);
zoomOut->setAutoRepeatDelay(150);
zoomOut->setAutoRepeatInterval(3);
connect(zoomIn,SIGNAL(pressed ()),this,SLOT(zoomin()));
connect(zoomOut,SIGNAL(pressed ()),this,SLOT(zoomout()));
//connect(chgl,SIGNAL(no_hw_st()),no_stereo,SLOT(toggle()));
fvused = new QLabel("");
QCheckBox *autoupdate = new QCheckBox("?FPS?");
autoupdate->setChecked(false);
connect(autoupdate, &QCheckBox::stateChanged, chgl, &PlayOpenGL::toggleAutoUpdate);
lodsp = new QSpinBox();
lodsp->setPrefix("LOD = ");
lodsp->setRange(2, 8);
lodsp->setValue(chgl->mol->LOD);
#if (QT_VERSION >= 0x050f10)
connect(lodsp, &QSpinBox::valueChanged, chgl, &PlayOpenGL::setLOD);
#else
connect(lodsp, SIGNAL(valueChanged(int)), chgl, SLOT(setLOD(int)));
#endif
statusBar();
statusBar()->addPermanentWidget(fvused);
statusBar()->addPermanentWidget(autoupdate);
statusBar()->addPermanentWidget(lodsp);
//statusBar()->addPermanentWidget(chgl->pickRadSpin);
statusBar()->addPermanentWidget(chgl->rCenter);
statusBar()->addPermanentWidget(chgl->enviButt);
statusBar()->addPermanentWidget(chgl->enviSelect);
statusBar()->addPermanentWidget(qGrowPeak);
statusBar()->addPermanentWidget(search4duplicates);
statusBar()->addPermanentWidget(zoomIn);
statusBar()->addPermanentWidget(zoomOut);
statusBar()->addPermanentWidget(homeMe);
statusBar()->addPermanentWidget(chgl->invertMouseZoom);
statusBar()->addPermanentWidget(quickReLoadButton);
statusBar()->addPermanentWidget(fxle->keepIso);
statusBar()->addPermanentWidget(fxle->doMaps);
statusBar()->addPermanentWidget(fxle->ownfcf6);
QCheckBox *hideToolBars = new QCheckBox("Hide Tool Bars");
hideToolBars->setChecked(false);
connect(hideToolBars,SIGNAL(toggled(bool)),this,SLOT(hideToolz(bool)));
statusBar()->addPermanentWidget(hideToolBars);
statusBar()->addPermanentWidget(sLabel);
connect(fxle,SIGNAL(bigmessage(const QString&)),this,SLOT(infoKanalNews(const QString&)));
shxEditorDock->hide();
printf("now settings\n");
////////////////////////////// SETTINGS /////////////////////////////////////////////////////////////////////////
mole.loadSettings();
einstellung->beginGroup("Window");
useNativeDlg->setChecked(einstellung->value("nativeDialogs",true).toBool());
chgl->invertMouseZoom->setChecked( einstellung->value("InvertMouseZoom").toBool());
//Too many issues with this feature 11.03.2021
//quickReLoadButton->setChecked( einstellung->value("QuickReLoad",true).toBool());
//connect(quickReLoadButton, SIGNAL(toggled(bool)), this, SLOT(loadAFile()));
bool bbb=true;
chgl->SDM_Limit=einstellung->value("SDM-LIMIT", 350).toInt();
if (einstellung->contains("HighlightEquivalents")){
bool bb;
equivHighlighting->setChecked(bb=einstellung->value("HighlightEquivalents").toBool());
mole.highlightEquivalents=bb;
}
//printf("line %d\n",__LINE__);
if (einstellung->contains("ADPs"))
chgl->adp->setChecked(bbb=einstellung->value("ADPs").toBool());
if (einstellung->contains("Tubes"))
chgl->tubes->setChecked(bbb=einstellung->value("Tubes").toBool());
if (einstellung->contains("Legend"))
chgl->atomLegend->setChecked(einstellung->value("Legend").toBool());
if (einstellung->contains("ShowLabels"))
togLabel->setChecked(bbb=einstellung->value("ShowLabels").toBool());
chgl->setLabels(togLabel->isChecked());
//printf("line %d\n",__LINE__);
if (einstellung->contains("ShortLabels"))
chgl->shortLabels->setChecked(bbb=einstellung->value("ShortLabels").toBool());
if (einstellung->contains("BackGroundGradient"))
togBackGr->setChecked(bbb=einstellung->value("BackGroundGradient").toBool());
chgl->setBGGradient(togBackGr->isChecked());
/*
if (einstellung->contains("WireModelOnRotate"))
chgl->wireButt->setChecked(einstellung->value("WireModelOnRotate").toBool());
*/
shelxlPath="shelxl";
if (einstellung->contains("SHELXL-PATH"))
shelxlPath=einstellung->value("SHELXL-PATH").toString();
shelxlArgs="";
if (einstellung->contains("SHELXL-OPTION"))
shelxlArgs=einstellung->value("SHELXL-OPTION").toString();
useMyBArray = false; // If true, ShelXle does not override b-array value
if (einstellung->contains("SHELXL-BARRAY")) {
useMyBArray=einstellung->value("SHELXL-BARRAY").toBool();
}
einstellung->endGroup();
//printf("line %d\n",__LINE__);
einstellung->beginGroup("Files");
dirName = einstellung->value("lastFile").toString();
QStringList files = einstellung->value("recentFileList").toStringList();
foreach (QWidget *widget, QApplication::topLevelWidgets()) {
Window *mainWin = qobject_cast(widget);
if (mainWin)
mainWin->updateRecentFileActions();
}
einstellung->endGroup();
einstellung->beginGroup("Colors");
chgl->backGroundColor=einstellung->value("BackGroundColor",QColor("lightskyblue")).value();
chgl->labelColor=einstellung->value("LabelColor").value();
chgl->labelBGColor = einstellung->value("LabelBGColor", QColor(0,0,0,0)).value();
chgl->focusedLabelBGColor = einstellung->value("focusedLabelBGColor", QColor(0,0,0,10)).value();
chgl->focusedLabelColor = einstellung->value("focusedLabelColor", QColor(255,255,0,255)).value();
chgl->selectedLabelBGColor = einstellung->value("selectedLabelBGColor", QColor(0,0,0,51)).value();
chgl->selectedLabelColor = einstellung->value("selectedLabelColor", QColor(135, 206, 235 ,255)).value();
/*printf("alphas %x %x %x %x %x %X",
chgl->labelBGColor.alpha(),
chgl->focusedLabelBGColor.alpha(),
chgl->selectedLabelBGColor.alpha(),
chgl->selectedLabelColor.alpha(),
chgl->focusedLabelColor.alpha(),
QColor(0u).alpha());*/
if (QString(PROGRAM_NAME).compare("shelXle")==0){
darkTheme->setChecked(einstellung->value("darkTheme","false").toBool());
}
darkEdit();
einstellung->endGroup();
int ignore=QMessageBox::No;
einstellung->beginGroup("Updates");
if (einstellung->contains("IgnoreUpdates"))
ignore=einstellung->value("IgnoreUpdates").toInt();
einstellung->endGroup();
net = new QNetworkAccessManager(this);
if (ignore!=QMessageBox::No){
checkForUpdates();
//connect(net, SIGNAL(finished(QNetworkReply*)), this, SLOT(replyFinished(QNetworkReply*)));
//reply = net->get(QNetworkRequest(QUrl("http://shelxle.org/shelx/revision.php")));
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
extraProgramNames.clear();
extraProgramPaths.clear();
extraArguments.clear();
extraExtensions.clear();
extraResIns.clear();
extraOpenFileDialogBefore.clear();
extraIconOverlay.clear();
extraOverlayPointSize.clear();
einstellung->beginGroup("Extra");
int siz=0;
siz=einstellung->beginReadArray("ProgramNames");
for (int i = 0; i < siz; i++) {
einstellung->setArrayIndex(i);
extraProgramNames.append(einstellung->value("Name","").toString());
}
einstellung->endArray();
einstellung->endGroup();
einstellung->beginGroup("Extra");
einstellung->beginReadArray("ProgramPaths");
for (int i = 0; i < siz; i++) {
einstellung->setArrayIndex(i);
extraProgramPaths.append(einstellung->value("Path","").toString());
}
einstellung->endArray();
einstellung->endGroup();
einstellung->beginGroup("Extra");
einstellung->beginReadArray("ProgramArgs");
for (int i = 0; i < siz; i++) {
einstellung->setArrayIndex(i);
extraArguments.append((Qt::CheckState) einstellung->value("Arg").toInt());
}
einstellung->endArray();
einstellung->endGroup();
einstellung->beginGroup("Extra");
einstellung->beginReadArray("ProgramExtensions");
for (int i = 0; i < siz; i++) {
einstellung->setArrayIndex(i);
extraExtensions.append((Qt::CheckState)einstellung->value("Ext",0).toInt());
}
einstellung->endArray();
einstellung->endGroup();
einstellung->beginGroup("Extra");
einstellung->beginReadArray("ProgramResIns");
for (int i = 0; i < siz; i++) {
einstellung->setArrayIndex(i);
extraResIns.append((Qt::CheckState)einstellung->value("Res2Ins",0).toInt());
}
einstellung->endArray();
einstellung->endGroup();
einstellung->beginGroup("Extra");
einstellung->beginReadArray("FileDialog");
for (int i = 0; i < siz; i++) {
einstellung->setArrayIndex(i);
extraOpenFileDialogBefore.append((Qt::CheckState)einstellung->value("fd",0).toInt());
}
einstellung->endArray();
einstellung->endGroup();
einstellung->beginGroup("Extra");
einstellung->beginReadArray("IconOverlay");
for (int i = 0; i < siz; i++) {
einstellung->setArrayIndex(i);
extraIconOverlay.append((Qt::CheckState)einstellung->value("icov",2).toInt());
}
einstellung->endArray();
einstellung->endGroup();
einstellung->beginGroup("Extra");
einstellung->beginReadArray("OverlayPointSize");
for (int i = 0; i < siz; i++) {
einstellung->setArrayIndex(i);
extraOverlayPointSize.append(einstellung->value("icov",36).toInt());
}
einstellung->endArray();
einstellung->endGroup();
einstellung->beginGroup("Extra");
einstellung->beginReadArray("AltExtraIconPaths");
for (int i = 0; i < siz; i++) {
einstellung->setArrayIndex(i);
altExtraIconPaths.append(einstellung->value("altIcon","").toString());
}
einstellung->endArray();
einstellung->endGroup();
einstellung->beginGroup("Extra");
einstellung->beginReadArray("ProgramDetached");
for (int i = 0; i < siz; i++) {
einstellung->setArrayIndex(i);
extraDetach.append((Qt::CheckState)einstellung->value("Detach",0).toInt());
}
einstellung->endArray();
einstellung->endGroup();
einstellung->beginGroup("Extra");
einstellung->beginReadArray("AlternativeExtensions");
for (int i = 0; i < siz; i++) {
einstellung->setArrayIndex(i);
extraExt2.append(einstellung->value("ext","").toString());
}
einstellung->endArray();
einstellung->endGroup();
einstellung->beginGroup("Extra");
einstellung->beginReadArray("CommandLineOptions");
for (int i = 0; i < siz; i++) {
einstellung->setArrayIndex(i);
extraOptions.append(einstellung->value("opt","").toString());
}
einstellung->endArray();
einstellung->endGroup();
einstellung->beginGroup("Extra");
einstellung->beginReadArray("AbsolutePathRequired");
for (int i = 0; i < siz; i++) {
einstellung->setArrayIndex(i);
extraAbsolutePath.append(static_cast(einstellung->value("absolute",0).toInt()));
}
einstellung->endArray();
einstellung->endGroup();
/*
einstellung->beginGroup("SaveHint");
if (einstellung->contains("ShowRenameHint"))
hintL->setVisible(einstellung->value("ShowRenameHint").toBool());
einstellung->endGroup();
*/
hintL->hide();
{
extraMenu->addAction("add or remove external programs",this,SLOT(extraSettings()));
}
if (extraProgramNames.size()) extraMenu->addSeparator();
QFileIconProvider *epic = new QFileIconProvider();
extraTB= new QToolBar("External Program Tool Bar",this);
extraTB->setObjectName("ExtraTB");
extraTB->setToolButtonStyle(Qt::ToolButtonIconOnly);
for (int i=0; iicon(QFileInfo(icopa));
//qDebug()<setPen(QPen(QColor("#FFFFFF")));
QFont ifont=chgl->myFont;
ifont.setPixelSize(qMax(extraOverlayPointSize.at(i)*fmap.height()/64,2));
paint->setFont(ifont);
paint->drawText(1,fmap.height()-5,extraProgramNames.at(i));
paint->setPen(QPen(QColor("#000000")));
paint->drawText(0,fmap.height()-4,extraProgramNames.at(i));
paint->end();
}
extraIcon=QIcon(fmap);
a=extraMenu->addAction(extraIcon,QString("run %1 !").arg(extraProgramNames.at(i)),this,SLOT(runExtra()));
a->setData(i);
extraTB->addAction(a);
}
delete epic;
addToolBar(extraTB);
extraOutput = new QDialog(this);
lt = new QVBoxLayout();
extraOutPut = new QTextEdit();
QFont mospfo(FONTFAM);
extraOutPut->setFont(mospfo);
#if (QT_VERSION >=0x050000)
extraOutput->setMinimumWidth(
QFontMetrics(extraOutPut->font())
.horizontalAdvance("###########################################################################################"));
#else
extraOutput->setMinimumWidth(
QFontMetrics(extraOutPut->font())
.width("###########################################################################################"));
#endif
extraOutPut->setLineWrapMode(QTextEdit::NoWrap);
lt->addWidget(extraOutPut);
extraOutput->setLayout(lt);
#if defined (Q_OS_MAC)
//printf("%d\n",__LINE__);
setCentralWidget(container);
#else
setCentralWidget(chgl);
#endif
//chgl->setMSAA(true);
// chgl->update();
//printf("%d\n",__LINE__);
einstellung->beginGroup("Window");
bool EditorHasOwnToolBar = einstellung->value("EditorHasOwnToolBar",false).toBool();
if (EditorHasOwnToolBar) shxMW->addToolBar(editToolBar);
else addToolBar(editToolBar);
adoptAct->setChecked(EditorHasOwnToolBar);
QByteArray ba,ba_state = einstellung->value("state").toByteArray();
bool ba_state_ok = false;
if (!ba_state.isEmpty()) ba_state_ok = restoreState(ba_state);
printf("ba_state_ok ? %d \n",ba_state_ok);
QByteArray estate = einstellung->value("EditorState").toByteArray();
if (!estate.isEmpty()) {
printf("<< %s %d\n",editor->font().family().toStdString().c_str(),editor->font().pointSize());
shxMW->restoreState(estate);
printf(">> %s %d\n",editor->font().family().toStdString().c_str(),editor->font().pointSize());
printf("state: %d\n", estate.size());
//qDebug()<value("geometry").toByteArray();
//qDebug()<=0x050000)
size=QSize(screen->geometry().width()-2,screen->geometry().height()-2);
#else
size=QSize(QApplication::desktop()->screenGeometry().width()-2,QApplication::desktop()->screenGeometry().height()-2);
#endif
ediSize=QSize(640,480);
ediPos=QPoint(0,0);
if ((size.height())<45||(size.width()<108)) size=QSize(640,480);
QPoint pos;
pos=QPoint(1,1);
move(pos);
if(size.isNull())
resize(640, 480);
else
resize(size);
}
einstellung->endGroup();
//printf("%d\n",__LINE__);
einstellung->beginGroup("Fonts");
if (einstellung->contains("LabelFont")){
chgl->myFont = einstellung->value("LabelFont").value();
chgl->myFont.setPointSize(einstellung->value("LabelFontSize", 24).toInt());
}
if (einstellung->contains("EditorFont")){
QFont fnt;
int id = QFontDatabase::addApplicationFont(theIconPath+"SourceCodePro-Regular.ttf");
QString family = QFontDatabase::applicationFontFamilies(id).at(0);
fnt = QFont(family);
fnt = einstellung->value("EditorFont").value();
//editor->setFont(fnt);
//QFontInfo finfo(fnt);
/*if (!fnt.exactMatch()){
printf("Font family; Point size; Pixel size; Style hint; Font weight; Font style; "
"Underline; Strike out; Fixed pitch; Always 0; Capitalization; Letter spacing; "
"Word spacing; Stretch; Style strategy; Font style (omitted when unavailable)\n");
printf("Font: %s\nFont: %s\n", fnt.toString().toStdString().c_str(), editor->font().toString().toStdString().c_str());
//qDebug()<font().toString().toStdString().c_str());
}else printf("font fits\n"); */
int fosi = einstellung->value("EditorFontSize", 10).toInt();
fnt.setPointSize(fosi);
//#if (QT_VERSION >= 0x040700)
// fnt.setStyleStrategy(QFont::ForceIntegerMetrics);//not a member anymore
//#endif
editor->setFont(fnt);
printf("Font: %s\nFont: %s\n", fnt.toString().toStdString().c_str(), editor->font().toString().toStdString().c_str());
xlPutor->setFont(fnt);
printf("Font from settings %s %d\n", fnt.family().toStdString().c_str(),fnt.pointSize());
}
einstellung->endGroup();
einstellung->beginGroup("ToolBar");
if (einstellung->contains("SelectionToolBarStyle"))
bottomToolBar->setToolButtonStyle((Qt::ToolButtonStyle) einstellung->value("SelectionToolBarStyle").toInt());
einstellung->endGroup();
einstellung->beginGroup("DoNotAskFileSave");
if (einstellung->contains("DoNotAnnoyMe"))
doNotAnnoyMe=einstellung->value("DoNotAnnoyMe",false).toBool();
einstellung->endGroup();
einstellung->beginGroup("Sorting");
if (einstellung->contains("SortingOption")){
editor->sortierWeise = einstellung->value("SortingOption").toInt();
}
einstellung->endGroup();
//printf("%d\n",__LINE__);
{
sortGroup = new QActionGroup(this);
sortMenu = new QMenu("Change sort order",this);
QAction *a = sortMenu->addAction("label number > atomic number > label suffix");
sortGroup->addAction(a);
a->setCheckable(true);
if (editor->sortierWeise==1)a->setChecked(true);
a->setData(1);
a = sortMenu->addAction("atomic number > label number > label suffix");
sortGroup->addAction(a);
a->setCheckable(true);
if (editor->sortierWeise==2)a->setChecked(true);
a->setData(2);
a = sortMenu->addAction("SFAC number > label number > label suffix");
sortGroup->addAction(a);
a->setCheckable(true);
if (editor->sortierWeise==3)a->setChecked(true);
a->setData(3);
a = sortMenu->addAction("label suffix > atomic number > label number");
sortGroup->addAction(a);
a->setCheckable(true);
if (editor->sortierWeise==4)a->setChecked(true);
a->setData(4);
a = sortMenu->addAction("fragment> atomic number > label number > label suffix");
sortGroup->addAction(a);
a->setCheckable(true);
if (editor->sortierWeise==5)a->setChecked(true);
a->setData(5);
a = sortMenu->addAction("U equivalent");
sortGroup->addAction(a);
a->setCheckable(true);
if (editor->sortierWeise==6)a->setChecked(true);
a->setData(6);
connect(sortGroup,SIGNAL(triggered(QAction*)), editor,SLOT(changeSortierWeise(QAction*)));
runMenu->insertMenu(soact,sortMenu);
}
einstellung->beginGroup("Labeling");
if (einstellung->contains("AutoUnused")){
rufModeBox->setChecked(einstellung->value("AutoUnused").toBool());
}
einstellung->endGroup();
tbiconSize=32;
einstellung->beginGroup("ToolBarIcons");
if (einstellung->contains("ToolBarIconSize")){
tbiconSize=einstellung->value("ToolBarIconSize").toInt();
}
einstellung->endGroup();
tbiconSize=qMin(tbiconSize,96);
tbiconSize=qMax(tbiconSize,16);
fito->setIconSize(QSize(tbiconSize,tbiconSize));
editToolBar->setIconSize(QSize(tbiconSize,tbiconSize));
refineToolBar->setIconSize(QSize(tbiconSize,tbiconSize));
vito->setIconSize(QSize(tbiconSize,tbiconSize));
extraTB->setIconSize(QSize(tbiconSize,tbiconSize));
bottomToolBar->setIconSize(QSize(tbiconSize,tbiconSize));
chgl->invertMouseZoom->setIconSize(QSize(tbiconSize,tbiconSize));
quickReLoadButton->setIconSize(QSize(tbiconSize,tbiconSize));
homeMe->setIconSize(QSize(tbiconSize,tbiconSize));
zoomIn->setIconSize(QSize(tbiconSize,tbiconSize));
zoomOut->setIconSize(QSize(tbiconSize,tbiconSize));
///
{
scalDlg = new QDialog(this);
scalDlg->setWindowTitle("Change screen-shot scalefactor");
scalla = new QGridLayout();
scalwla = new QLabel("Width: ");
scalhla = new QLabel("Height: ");
scalsla = new QLabel("Scalefactor: ");
widthBox = new QSpinBox();
heightBox = new QSpinBox();
scalefBox = new QDoubleSpinBox();
widthBox->setMinimum(32);
widthBox->setMaximum(10000);
widthBox->setSuffix(" pixels");
widthBox->setObjectName("widthBox");
heightBox->setMinimum(32);
heightBox->setMaximum(10000);
heightBox->setSuffix(" pixels");
heightBox->setObjectName("heightBox");
scalefBox->setMinimum(1);
scalefBox->setMaximum(400.0);
scalefBox->setSuffix(" %");
scalefBox->setValue(scalePic*100.0);
scalefBox->setObjectName("scalefBox");
header = new QLabel("
Change screen-shot scalefactor
");
scalla->addWidget(header ,0,0,1,3);
scalla->addWidget(scalwla ,1,0);
scalla->addWidget(widthBox ,1,1);
scalla->addWidget(scalhla ,2,0);
scalla->addWidget(heightBox,2,1);
scalla->addWidget(scalsla ,3,0);
scalla->addWidget(scalefBox,3,1);
scalDlg->setLayout(scalla);
scalDlg->hide();
connect(widthBox,SIGNAL(valueChanged(int)),this,SLOT(updateScaleDlg()));
connect(heightBox,SIGNAL(valueChanged(int)),this,SLOT(updateScaleDlg()));
connect(scalefBox,SIGNAL(valueChanged(double)),this,SLOT(updateScaleDlg()));
}
/////////////
toggDocWid(true);
raise();
double vang=0;
#if (QT_VERSION >= 0x040600)
dirName = (QProcessEnvironment::systemEnvironment ().value("PWD",dirName));
#else
{
QStringList env = QProcess::systemEnvironment();
int da = env.indexOf(QRegularExpression("^PWD=.*$"));
if (da>-1) {
dirName = QString(env.at(da)).remove(0,4);
}
}
#endif
QString ffna="";
startFused=false;
int argc=QCoreApplication::arguments().size();
if (argc>1){
for (int i=1;iMYFCF=true;
if ((QCoreApplication::arguments().at(i).endsWith(".ins",Qt::CaseInsensitive)) ||
(QCoreApplication::arguments().at(i).endsWith(".res",Qt::CaseInsensitive)))
ffna=QCoreApplication::arguments().at(i);
if ((QCoreApplication::arguments().at(i)=="-fused")) startFused=true;
if ((QCoreApplication::arguments().at(i)=="-HKLMAX")) fxle->HKLMX = QCoreApplication::arguments().at(i+1).toInt();
if ((QCoreApplication::arguments().at(i)=="-viewangle")) vang = QCoreApplication::arguments().at(i+1).toDouble();
if ((QCoreApplication::arguments().at(i)=="-voxel")) fxle->voxelstr = QCoreApplication::arguments().at(i+1);
if ((QCoreApplication::arguments().at(i)=="-shaderInfo")) shaderInfo=true;
//if ((QCoreApplication::arguments().at(i)=="-wt")) { chgl->dratpause = QCoreApplication::arguments().at(i+1).toInt();}
}
}
//printf("%d\n",__LINE__);
//chgl->update();
//if (vang>0.0) chgl->setViewAngle(vang);
einstellung->beginGroup("ViewSettings");
if (einstellung->contains("OrthographicProjection")) {
bool b=einstellung->value("OrthographicProjection").toBool();
chgl->toggleOrthoView->setChecked(b);
chgl->toggleOrtho(b);
//toggleOrtho(b);
}
einstellung->endGroup();
//printf("%d\n",__LINE__);
qPeakDock->setVisible(true);
shxEditorDock->hide();
shxOutputDock->hide();
if (!ffna.isEmpty()) {
dirName=ffna;
printf("I will load this: %s.\n",ffna.toStdString().c_str());
//connect(chgl, SIGNAL(initialized()), this, SLOT(loadAFile()));
connect(chgl, SIGNAL(initialized()), this, SLOT(delayedLoad()));
}
printf("Window constructor finished.\n");
#include "WhatsThisAndWhere.h"
lastDirName="";
//printf("%d\n",__LINE__);
}
Window::~Window() {
//printf("close?? this %p calcmenu %p dsr %p sortmenu%p hidwillpse %p fxle%p chgl%p\n", this,calcmenu,dsr,sortMenu,hidwillpse,fxle,chgl);
if (fxle!=NULL) delete fxle;
//printf("OK!%d\n",__LINE__);
if (calcmenu!=NULL) {
calcmenu->close();
delete calcmenu;//only delete it if it has been created. (seg fault)
}
if (dsr!=NULL) {
dsr->close();
delete dsr;
}
//printf("OK!%d\n",__LINE__);
}
int Window::Version(){
return Revision;
}
void Window::hereAreMyKeys(){
actionInfo.clear();
actionInfo.append("
");
QWidgetList wl = QApplication::allWidgets();
QStringList shorts;
for (int i=0; i acs = wl.at(i)->actions();
for (int j=0; jshortcut().toString();
QIcon ic=acs.at(j)->icon();
if (!st.isEmpty()){
QString kb=acs.at(j)->shortcut().toString().replace(QRegularExpression("\\+"),"] + [");
kb=kb.replace("+ [] + [","+ [+");
#if defined (Q_OS_MAC)
kb=kb.replace("Ctrl","⌘");//clover CMD
kb=kb.replace("Meta","⌃");//Ctrl
kb=kb.replace("Alt","⌥");//Opt
kb=kb.replace("Shift","⇧");//shift/
#endif
QString ac=acs.at(j)->text();
int und=ac.indexOf('&');
if (und!=-1) {
ac=ac.insert(und+2,"");
ac=ac.replace('&',"");
}
ac[0]=ac[0].toUpper();
ac=ac.replace(' '," ");
shorts.append(QString("