From f21d5eb2d03f46b1c5c731f041c2a8392d3122fd Mon Sep 17 00:00:00 2001 From: nemu Date: Thu, 28 Jan 2010 05:52:15 +0000 Subject: [PATCH] newly added. Essentially a port of musrgui (Qt3.x) to Qt4.6. A lot of revisioning is still nedded. Code only partilly working. --- src/musredit/PAdmin.cpp | 374 +++ src/musredit/PAdmin.h | 145 ++ src/musredit/PFileWatcher.cpp | 115 + src/musredit/PFileWatcher.h | 74 + src/musredit/PFindDialog.cpp | 104 + src/musredit/PFindDialog.h | 55 + src/musredit/PFitOutputHandler.cpp | 160 ++ src/musredit/PFitOutputHandler.h | 68 + src/musredit/PGetAsymmetryRunBlockDialog.cpp | 270 ++ src/musredit/PGetAsymmetryRunBlockDialog.h | 63 + src/musredit/PGetDefaultDialog.cpp | 108 + src/musredit/PGetDefaultDialog.h | 63 + src/musredit/PGetFourierBlockDialog.cpp | 135 + src/musredit/PGetFourierBlockDialog.h | 57 + src/musredit/PGetFunctionsBlockDialog.cpp | 112 + src/musredit/PGetFunctionsBlockDialog.h | 54 + src/musredit/PGetNonMusrRunBlockDialog.cpp | 156 ++ src/musredit/PGetNonMusrRunBlockDialog.h | 56 + src/musredit/PGetParameterBlockDialog.cpp | 220 ++ src/musredit/PGetParameterBlockDialog.h | 54 + src/musredit/PGetPlotBlockDialog.cpp | 187 ++ src/musredit/PGetPlotBlockDialog.h | 54 + .../PGetSingleHistoRunBlockDialog.cpp | 271 ++ src/musredit/PGetSingleHistoRunBlockDialog.h | 67 + src/musredit/PGetTheoryBlockDialog.cpp | 129 + src/musredit/PGetTheoryBlockDialog.h | 57 + src/musredit/PGetTitleBlockDialog.cpp | 58 + src/musredit/PGetTitleBlockDialog.h | 53 + src/musredit/PMsr2DataDialog.cpp | 251 ++ src/musredit/PMsr2DataDialog.h | 65 + src/musredit/PMusrEditAbout.cpp | 47 + src/musredit/PMusrEditAbout.h | 48 + src/musredit/PPrefsDialog.cpp | 103 + src/musredit/PPrefsDialog.h | 57 + src/musredit/PReplaceConfirmationDialog.cpp | 43 + src/musredit/PReplaceConfirmationDialog.h | 49 + src/musredit/PReplaceDialog.cpp | 106 + src/musredit/PReplaceDialog.h | 55 + src/musredit/PSubTextEdit.cpp | 602 +++++ src/musredit/PSubTextEdit.h | 73 + src/musredit/PTextEdit.cpp | 2257 +++++++++++++++++ src/musredit/PTextEdit.h | 159 ++ src/musredit/asymDefault.msr | 59 + src/musredit/forms/PFindDialog.ui | 246 ++ .../forms/PGetAsymmetryRunBlockDialog.ui | 707 ++++++ src/musredit/forms/PGetDefaultDialog.ui | 312 +++ src/musredit/forms/PGetFourierBlockDialog.ui | 391 +++ .../forms/PGetFunctionsBlockDialog.ui | 253 ++ .../forms/PGetNonMusrRunBlockDialog.ui | 462 ++++ .../forms/PGetParameterBlockDialog.ui | 344 +++ src/musredit/forms/PGetPlotBlockDialog.ui | 300 +++ .../forms/PGetSingleHistoRunBlockDialog.ui | 654 +++++ src/musredit/forms/PGetTheoryBlockDialog.ui | 261 ++ src/musredit/forms/PGetTitleBlockDialog.ui | 163 ++ src/musredit/forms/PMsr2DataDialog.ui | 630 +++++ src/musredit/forms/PMusrEditAbout.ui | 105 + src/musredit/forms/PPrefsDialog.ui | 203 ++ .../forms/PReplaceConfirmationDialog.ui | 136 + src/musredit/forms/PReplaceDialog.ui | 300 +++ src/musredit/images/editcopy.xpm | 36 + src/musredit/images/editcut.xpm | 32 + src/musredit/images/editfind.xpm | 202 ++ src/musredit/images/editnext.xpm | 49 + src/musredit/images/editpaste.xpm | 36 + src/musredit/images/editprevious.xpm | 45 + src/musredit/images/editredo.xpm | 36 + src/musredit/images/editundo.xpm | 36 + src/musredit/images/filenew.xpm | 36 + src/musredit/images/fileopen.xpm | 36 + src/musredit/images/fileprint.xpm | 117 + src/musredit/images/filereload.xpm | 172 ++ src/musredit/images/filesave.xpm | 36 + src/musredit/images/musrasym.xpm | 29 + src/musredit/images/musrcalcchisq.xpm | 28 + src/musredit/images/musrfit.xpm | 28 + src/musredit/images/musrmsr2data.xpm | 28 + src/musredit/images/musrprefs.xpm | 28 + src/musredit/images/musrsinglehisto.xpm | 29 + src/musredit/images/musrswap.xpm | 28 + src/musredit/images/musrt0.xpm | 28 + src/musredit/images/musrview.xpm | 28 + src/musredit/latex_images/abragam.png | Bin 0 -> 918 bytes src/musredit/latex_images/abragam.tex | 9 + src/musredit/latex_images/asymmetry.png | Bin 0 -> 139 bytes src/musredit/latex_images/asymmetry.tex | 9 + src/musredit/latex_images/bessel.png | Bin 0 -> 770 bytes src/musredit/latex_images/bessel.tex | 9 + src/musredit/latex_images/combiLGKT.png | Bin 0 -> 603 bytes src/musredit/latex_images/combiLGKT.tex | 9 + src/musredit/latex_images/generalExp.png | Bin 0 -> 532 bytes src/musredit/latex_images/generalExp.tex | 9 + src/musredit/latex_images/internalBessel.png | Bin 0 -> 1331 bytes src/musredit/latex_images/internalBessel.tex | 9 + src/musredit/latex_images/internalField.png | Bin 0 -> 928 bytes src/musredit/latex_images/internalField.tex | 9 + src/musredit/latex_images/polynom.png | Bin 0 -> 806 bytes src/musredit/latex_images/polynom.tex | 9 + src/musredit/latex_images/simpleExp.png | Bin 0 -> 418 bytes src/musredit/latex_images/simpleExp.tex | 9 + src/musredit/latex_images/simpleGauss.png | Bin 0 -> 624 bytes src/musredit/latex_images/simpleGauss.tex | 9 + src/musredit/latex_images/statExpKT.png | Bin 0 -> 740 bytes src/musredit/latex_images/statExpKT.tex | 9 + src/musredit/latex_images/statGssKT.png | Bin 0 -> 986 bytes src/musredit/latex_images/statGssKT.tex | 9 + src/musredit/latex_images/textogif | 233 ++ src/musredit/latex_images/tfCos.png | Bin 0 -> 560 bytes src/musredit/latex_images/tfCos.tex | 9 + src/musredit/main.cpp | 65 + src/musredit/musredit.h | 68 + src/musredit/musredit.pro | 89 + src/musredit/musredit.qrc | 39 + src/musredit/musredit_startup.xml | 181 ++ src/musredit/singleHistoDefault.msr | 60 + 114 files changed, 14735 insertions(+) create mode 100644 src/musredit/PAdmin.cpp create mode 100644 src/musredit/PAdmin.h create mode 100644 src/musredit/PFileWatcher.cpp create mode 100644 src/musredit/PFileWatcher.h create mode 100644 src/musredit/PFindDialog.cpp create mode 100644 src/musredit/PFindDialog.h create mode 100644 src/musredit/PFitOutputHandler.cpp create mode 100644 src/musredit/PFitOutputHandler.h create mode 100644 src/musredit/PGetAsymmetryRunBlockDialog.cpp create mode 100644 src/musredit/PGetAsymmetryRunBlockDialog.h create mode 100644 src/musredit/PGetDefaultDialog.cpp create mode 100644 src/musredit/PGetDefaultDialog.h create mode 100644 src/musredit/PGetFourierBlockDialog.cpp create mode 100644 src/musredit/PGetFourierBlockDialog.h create mode 100644 src/musredit/PGetFunctionsBlockDialog.cpp create mode 100644 src/musredit/PGetFunctionsBlockDialog.h create mode 100644 src/musredit/PGetNonMusrRunBlockDialog.cpp create mode 100644 src/musredit/PGetNonMusrRunBlockDialog.h create mode 100644 src/musredit/PGetParameterBlockDialog.cpp create mode 100644 src/musredit/PGetParameterBlockDialog.h create mode 100644 src/musredit/PGetPlotBlockDialog.cpp create mode 100644 src/musredit/PGetPlotBlockDialog.h create mode 100644 src/musredit/PGetSingleHistoRunBlockDialog.cpp create mode 100644 src/musredit/PGetSingleHistoRunBlockDialog.h create mode 100644 src/musredit/PGetTheoryBlockDialog.cpp create mode 100644 src/musredit/PGetTheoryBlockDialog.h create mode 100644 src/musredit/PGetTitleBlockDialog.cpp create mode 100644 src/musredit/PGetTitleBlockDialog.h create mode 100644 src/musredit/PMsr2DataDialog.cpp create mode 100644 src/musredit/PMsr2DataDialog.h create mode 100644 src/musredit/PMusrEditAbout.cpp create mode 100644 src/musredit/PMusrEditAbout.h create mode 100644 src/musredit/PPrefsDialog.cpp create mode 100644 src/musredit/PPrefsDialog.h create mode 100644 src/musredit/PReplaceConfirmationDialog.cpp create mode 100644 src/musredit/PReplaceConfirmationDialog.h create mode 100644 src/musredit/PReplaceDialog.cpp create mode 100644 src/musredit/PReplaceDialog.h create mode 100644 src/musredit/PSubTextEdit.cpp create mode 100644 src/musredit/PSubTextEdit.h create mode 100644 src/musredit/PTextEdit.cpp create mode 100644 src/musredit/PTextEdit.h create mode 100644 src/musredit/asymDefault.msr create mode 100644 src/musredit/forms/PFindDialog.ui create mode 100644 src/musredit/forms/PGetAsymmetryRunBlockDialog.ui create mode 100644 src/musredit/forms/PGetDefaultDialog.ui create mode 100644 src/musredit/forms/PGetFourierBlockDialog.ui create mode 100644 src/musredit/forms/PGetFunctionsBlockDialog.ui create mode 100644 src/musredit/forms/PGetNonMusrRunBlockDialog.ui create mode 100644 src/musredit/forms/PGetParameterBlockDialog.ui create mode 100644 src/musredit/forms/PGetPlotBlockDialog.ui create mode 100644 src/musredit/forms/PGetSingleHistoRunBlockDialog.ui create mode 100644 src/musredit/forms/PGetTheoryBlockDialog.ui create mode 100644 src/musredit/forms/PGetTitleBlockDialog.ui create mode 100644 src/musredit/forms/PMsr2DataDialog.ui create mode 100644 src/musredit/forms/PMusrEditAbout.ui create mode 100644 src/musredit/forms/PPrefsDialog.ui create mode 100644 src/musredit/forms/PReplaceConfirmationDialog.ui create mode 100644 src/musredit/forms/PReplaceDialog.ui create mode 100644 src/musredit/images/editcopy.xpm create mode 100644 src/musredit/images/editcut.xpm create mode 100644 src/musredit/images/editfind.xpm create mode 100644 src/musredit/images/editnext.xpm create mode 100644 src/musredit/images/editpaste.xpm create mode 100644 src/musredit/images/editprevious.xpm create mode 100644 src/musredit/images/editredo.xpm create mode 100644 src/musredit/images/editundo.xpm create mode 100644 src/musredit/images/filenew.xpm create mode 100644 src/musredit/images/fileopen.xpm create mode 100644 src/musredit/images/fileprint.xpm create mode 100644 src/musredit/images/filereload.xpm create mode 100644 src/musredit/images/filesave.xpm create mode 100644 src/musredit/images/musrasym.xpm create mode 100644 src/musredit/images/musrcalcchisq.xpm create mode 100644 src/musredit/images/musrfit.xpm create mode 100644 src/musredit/images/musrmsr2data.xpm create mode 100644 src/musredit/images/musrprefs.xpm create mode 100644 src/musredit/images/musrsinglehisto.xpm create mode 100644 src/musredit/images/musrswap.xpm create mode 100644 src/musredit/images/musrt0.xpm create mode 100644 src/musredit/images/musrview.xpm create mode 100644 src/musredit/latex_images/abragam.png create mode 100644 src/musredit/latex_images/abragam.tex create mode 100644 src/musredit/latex_images/asymmetry.png create mode 100644 src/musredit/latex_images/asymmetry.tex create mode 100644 src/musredit/latex_images/bessel.png create mode 100644 src/musredit/latex_images/bessel.tex create mode 100644 src/musredit/latex_images/combiLGKT.png create mode 100644 src/musredit/latex_images/combiLGKT.tex create mode 100644 src/musredit/latex_images/generalExp.png create mode 100644 src/musredit/latex_images/generalExp.tex create mode 100644 src/musredit/latex_images/internalBessel.png create mode 100644 src/musredit/latex_images/internalBessel.tex create mode 100644 src/musredit/latex_images/internalField.png create mode 100644 src/musredit/latex_images/internalField.tex create mode 100644 src/musredit/latex_images/polynom.png create mode 100644 src/musredit/latex_images/polynom.tex create mode 100644 src/musredit/latex_images/simpleExp.png create mode 100644 src/musredit/latex_images/simpleExp.tex create mode 100644 src/musredit/latex_images/simpleGauss.png create mode 100644 src/musredit/latex_images/simpleGauss.tex create mode 100644 src/musredit/latex_images/statExpKT.png create mode 100644 src/musredit/latex_images/statExpKT.tex create mode 100644 src/musredit/latex_images/statGssKT.png create mode 100644 src/musredit/latex_images/statGssKT.tex create mode 100644 src/musredit/latex_images/textogif create mode 100644 src/musredit/latex_images/tfCos.png create mode 100644 src/musredit/latex_images/tfCos.tex create mode 100644 src/musredit/main.cpp create mode 100644 src/musredit/musredit.h create mode 100644 src/musredit/musredit.pro create mode 100644 src/musredit/musredit.qrc create mode 100644 src/musredit/musredit_startup.xml create mode 100644 src/musredit/singleHistoDefault.msr diff --git a/src/musredit/PAdmin.cpp b/src/musredit/PAdmin.cpp new file mode 100644 index 00000000..a6d5634f --- /dev/null +++ b/src/musredit/PAdmin.cpp @@ -0,0 +1,374 @@ +/**************************************************************************** + + PAdmin.cpp + + Author: Andreas Suter + e-mail: andreas.suter@psi.ch + + $Id$ + +*****************************************************************************/ + +/*************************************************************************** + * Copyright (C) 2010 by Andreas Suter * + * andreas.suter@psi.ch * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include + +#include + +#include "PAdmin.h" + +//-------------------------------------------------------------------------- +// implementation of PAdminXMLParser class +//-------------------------------------------------------------------------- +/** + *

XML Parser class for the musredit administration file. + * + * \param admin pointer to an admin class instance. + */ +PAdminXMLParser::PAdminXMLParser(PAdmin *admin) : fAdmin(admin) +{ + fKeyWord = eEmpty; + fFunc = false; +} + +//-------------------------------------------------------------------------- +/** + *

Routine called at the beginning of the XML parsing process. + */ +bool PAdminXMLParser::startDocument() +{ + return true; +} + +//-------------------------------------------------------------------------- +/** + *

Routine called when a new XML tag is found. Here it is used + * to set a tag for filtering afterwards the content. + * + * \param qName name of the XML tag. + */ +bool PAdminXMLParser::startElement( const QString&, const QString&, + const QString& qName, + const QXmlAttributes& ) +{ + if (qName == "font_name") { + fKeyWord = eFontName; + } else if (qName == "font_size") { + fKeyWord = eFontSize; + } else if (qName == "exec_path") { + fKeyWord = eExecPath; + } else if (qName == "default_save_path") { + fKeyWord = eDefaultSavePath; + } else if (qName == "title_from_data_file") { + fKeyWord = eTitleFromDataFile; + } else if (qName == "enable_musrt0") { + fKeyWord = eEnableMusrT0; + } else if (qName == "beamline") { + fKeyWord = eBeamline; + } else if (qName == "institute") { + fKeyWord = eInstitute; + } else if (qName == "file_format") { + fKeyWord = eFileFormat; + } else if (qName == "lifetime_correction") { + fKeyWord = eLifetimeCorrection; + } else if (qName == "msr_default_file_path") { + fKeyWord = eMsrDefaultFilePath; + } else if (qName == "help_main") { + fKeyWord = eHelpMain; + } else if (qName == "func_pixmap_path") { + fKeyWord = eTheoFuncPixmapPath; + } else if (qName == "func") { + fKeyWord = eFunc; + fFunc = true; + // init theory item + fTheoryItem.name = ""; + fTheoryItem.comment = ""; + fTheoryItem.label = ""; + fTheoryItem.pixmapName = ""; + fTheoryItem.pixmap = 0; + fTheoryItem.params = -1; + } else if (qName == "name") { + fKeyWord = eFuncName; + } else if (qName == "comment") { + fKeyWord = eFuncComment; + } else if (qName == "label") { + fKeyWord = eFuncLabel; + } else if (qName == "pixmap") { + fKeyWord = eFuncPixmap; + } else if (qName == "params") { + fKeyWord = eFuncParams; + } + + return true; +} + +//-------------------------------------------------------------------------- +/** + *

Routine called when the end XML tag is found. It is used to + * put the filtering tag to 'empty'. + */ +bool PAdminXMLParser::endElement( const QString&, const QString&, const QString &qName ) +{ + fKeyWord = eEmpty; + + if (qName == "func") { + fFunc = false; + fAdmin->addTheoryItem(fTheoryItem); + } + + return true; +} + +//-------------------------------------------------------------------------- +/** + *

This routine delivers the content of an XML tag. It fills the + * content into the load data structure. + */ +bool PAdminXMLParser::characters(const QString& str) +{ + QString help; + bool flag, ok; + int ival; + + switch (fKeyWord) { + case eFontName: + fAdmin->setFontName(QString(str.toLatin1()).trimmed()); + break; + case eFontSize: + ival = QString(str.toLatin1()).trimmed().toInt(&ok); + if (ok) + fAdmin->setFontSize(ival); + break; + case eExecPath: + fAdmin->setExecPath(QString(str.toLatin1()).trimmed()); + break; + case eDefaultSavePath: + fAdmin->setDefaultSavePath(QString(str.toLatin1()).trimmed()); + break; + case eTitleFromDataFile: + if (str == "y") + flag = true; + else + flag = false; + fAdmin->setTitleFromDataFileFlag(flag); + break; + case eEnableMusrT0: + if (str == "y") + flag = true; + else + flag = false; + fAdmin->setEnableMusrT0Flag(flag); + break; + case eBeamline: + fAdmin->setBeamline(QString(str.toLatin1()).trimmed()); + break; + case eInstitute: + fAdmin->setInstitute(QString(str.toLatin1()).trimmed()); + break; + case eFileFormat: + fAdmin->setFileFormat(QString(str.toLatin1()).trimmed()); + break; + case eLifetimeCorrection: + if (str == "y") + flag = true; + else + flag = false; + fAdmin->setLifetimeCorrectionFlag(flag); + break; + case eMsrDefaultFilePath: + fAdmin->setMsrDefaultFilePath(QString(str.toLatin1()).trimmed()); + break; + case eHelpMain: + help = str; + help.replace(">", ">"); + help.replace("<", "<"); + fAdmin->setHelpMain(help); + break; + case eTheoFuncPixmapPath: + fAdmin->setTheoFuncPixmapPath(QString(str.toLatin1()).trimmed()); + break; + default: + break; + } + + if (fFunc) { + bool ok; + switch (fKeyWord) { + case eFuncName: + fTheoryItem.name = QString(str.toLatin1()).trimmed(); + break; + case eFuncComment: + fTheoryItem.comment = QString(str.toLatin1()).trimmed(); + break; + case eFuncLabel: + fTheoryItem.label = QString(str.toLatin1()).trimmed(); + break; + case eFuncPixmap: + fTheoryItem.pixmapName = QString(str.toLatin1()).trimmed(); + break; + case eFuncParams: + fTheoryItem.params = str.toInt(&ok); + if (!ok) + return false; + break; + default: + break; + } + } + + return true; +} + +//-------------------------------------------------------------------------- +/** + *

Called at the end of the XML parse process. + */ +bool PAdminXMLParser::endDocument() +{ + // check if all necessary items are found + QString str; + + if (fAdmin->getExecPath().indexOf('$') >= 0) { + str = expandPath(fAdmin->getExecPath()); + if (!str.isEmpty()) + fAdmin->setExecPath(str); + } + + if (fAdmin->getDefaultSavePath().indexOf('$') >= 0) { + str = expandPath(fAdmin->getDefaultSavePath()); + if (!str.isEmpty()) + fAdmin->setDefaultSavePath(str); + } + + if (fAdmin->getMsrDefaultFilePath().indexOf('$') >= 0) { + str = expandPath(fAdmin->getMsrDefaultFilePath()); + if (!str.isEmpty()) + fAdmin->setMsrDefaultFilePath(str); + } + + if (fAdmin->getTheoFuncPixmapPath().indexOf('$') >=0) { + str = expandPath(fAdmin->getTheoFuncPixmapPath()); + if (!str.isEmpty()) + fAdmin->setTheoFuncPixmapPath(str); + } + + return true; +} + +//-------------------------------------------------------------------------- +/** + *

Called at the end of the XML parse process. + */ +QString PAdminXMLParser::expandPath(const QString &str) +{ + QString token; + QString path; + QString msg; + QString newStr=""; + + QStringList list = str.split("/"); + + for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { + token = *it; + if (token.contains("$")) { + token.remove('$'); + path = std::getenv(token.toLatin1()); + if (path.isEmpty()) { + msg = QString("Couldn't expand '%1'. Some things might not work properly").arg(token); + QMessageBox::warning(0, "**WARNING**", msg, QMessageBox::Ok, QMessageBox::NoButton); + newStr = ""; + break; + } + newStr += path; + } else { + newStr += "/" + token; + } + } + + return newStr; +} + +//-------------------------------------------------------------------------- +// implementation of PAdmin class +//-------------------------------------------------------------------------- +/** + *

+ */ +PAdmin::PAdmin() +{ + fFontName = QString("Courier"); // default font + fFontSize = 11; // default font size + + fExecPath = QString(""); + fDefaultSavePath = QString(""); + fMsrDefaultFilePath = QString(""); + fTheoFuncPixmapPath = QString(""); + + fBeamline = QString(""); + fInstitute = QString(""); + fFileFormat = QString(""); + + fHelpMain = QString(""); + + fTitleFromDataFile = false; + fEnableMusrT0 = false; + fLifetimeCorrection = true; + + // XML Parser part + QString fln = "./musredit_startup.xml"; + if (!QFile::exists(fln)) { + QString path = std::getenv("MUSRFITPATH"); + QString rootsys = std::getenv("ROOTSYS"); + if (path.isEmpty()) + path = rootsys + "/bin"; + fln = path + "/musredit_startup.xml"; + } + if (QFile::exists(fln)) { // administration file present + PAdminXMLParser handler(this); + QFile xmlFile(fln); + QXmlInputSource source( &xmlFile ); + QXmlSimpleReader reader; + reader.setContentHandler( &handler ); + reader.parse( source ); + } else { + QMessageBox::critical(0, "ERROR", + "Couldn't find the musredit_startup.xml settings file.\nProbably a few things will not work porperly.\nPlease fix this first.", + QMessageBox::Ok, QMessageBox::NoButton); + } +} + +//-------------------------------------------------------------------------- +// implementation of PAdmin class +//-------------------------------------------------------------------------- +/** + *

+ */ +PTheory* PAdmin::getTheoryItem(const unsigned int idx) +{ + if (idx > (unsigned int)fTheory.size()) + return 0; + else + return &fTheory[idx]; +} + +//-------------------------------------------------------------------------- +// END +//-------------------------------------------------------------------------- diff --git a/src/musredit/PAdmin.h b/src/musredit/PAdmin.h new file mode 100644 index 00000000..2db2025c --- /dev/null +++ b/src/musredit/PAdmin.h @@ -0,0 +1,145 @@ +/**************************************************************************** + + PAdmin.h + + Author: Andreas Suter + e-mail: andreas.suter@psi.ch + + $Id$ + +*****************************************************************************/ + +/*************************************************************************** + * Copyright (C) 2010 by Andreas Suter * + * andreas.suter@psi.ch * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef _PADMIN_H_ +#define _PADMIN_H_ + +#include +#include +#include +#include + +class PAdmin; + +//--------------------------------------------------------------------------- +typedef struct { + QString name; + QString comment; + QString label; + QString pixmapName; + QPixmap pixmap; + int params; +} PTheory; + +//--------------------------------------------------------------------------- +class PAdminXMLParser : public QXmlDefaultHandler +{ + public: + PAdminXMLParser(PAdmin*); + virtual ~PAdminXMLParser() {} + + private: + enum EAdminKeyWords {eEmpty, eFontName, eFontSize, eExecPath, eDefaultSavePath, eTitleFromDataFile, eEnableMusrT0, + eBeamline, eInstitute, eFileFormat, eLifetimeCorrection, eMsrDefaultFilePath, + eHelpMain, eTheoFuncPixmapPath, eFunc, eFuncName, eFuncComment, eFuncLabel, + eFuncPixmap, eFuncParams}; + + bool startDocument(); + bool startElement( const QString&, const QString&, const QString& , + const QXmlAttributes& ); + bool endElement( const QString&, const QString&, const QString& ); + + bool characters(const QString&); + bool endDocument(); + + QString expandPath(const QString&); + + EAdminKeyWords fKeyWord; + bool fFunc; + PTheory fTheoryItem; + PAdmin *fAdmin; +}; + +//--------------------------------------------------------------------------- +class PAdmin +{ + public: + PAdmin(); + virtual ~PAdmin() {} + + QString getFontName() { return fFontName; } + int getFontSize() { return fFontSize; } + QString getExecPath() { return fExecPath; } + QString getDefaultSavePath() { return fDefaultSavePath; } + bool getTitleFromDataFileFlag() { return fTitleFromDataFile; } + bool getEnableMusrT0Flag() { return fEnableMusrT0; } + QString getBeamline() { return fBeamline; } + QString getInstitute() { return fInstitute; } + QString getFileFormat() { return fFileFormat; } + bool getLifetimeCorrectionFlag() { return fLifetimeCorrection; } + QString getMsrDefaultFilePath() { return fMsrDefaultFilePath; } + QString getHelpMain() { return fHelpMain; } + QString getTheoFuncPixmapPath() { return fTheoFuncPixmapPath; } + unsigned int getTheoryCounts() { return fTheory.size(); } + PTheory* getTheoryItem(const unsigned int idx); + + void setFontName(const QString str) { fFontName = str; } + void setFontSize(const int ival) { fFontSize = ival; } + + protected: + void setExecPath(const QString str) { fExecPath = str; } + void setDefaultSavePath(const QString str) { fDefaultSavePath = str; } + void setTitleFromDataFileFlag(const bool flag) { fTitleFromDataFile = flag; } + void setEnableMusrT0Flag(const bool flag) { fEnableMusrT0 = flag; } + void setBeamline(const QString str) { fBeamline = str; } + void setInstitute(const QString str) { fInstitute = str; } + void setFileFormat(const QString str) { fFileFormat = str; } + void setLifetimeCorrectionFlag(const bool flag) { fLifetimeCorrection = flag; } + void setMsrDefaultFilePath(const QString str) { fMsrDefaultFilePath = str; } + void setHelpMain(const QString str) { fHelpMain = str; } + void setTheoFuncPixmapPath (const QString str) { fTheoFuncPixmapPath = str; } + void addTheoryItem(const PTheory theo) { fTheory.push_back(theo); } + + private: + friend class PAdminXMLParser; + + QString fFontName; + int fFontSize; + + QString fExecPath; + QString fDefaultSavePath; + QString fMsrDefaultFilePath; + QString fTheoFuncPixmapPath; + + bool fTitleFromDataFile; + bool fEnableMusrT0; + + QString fBeamline; + QString fInstitute; + QString fFileFormat; + bool fLifetimeCorrection; + + QString fHelpMain; + + QVector fTheory; +}; + +#endif // _PADMIN_H_ diff --git a/src/musredit/PFileWatcher.cpp b/src/musredit/PFileWatcher.cpp new file mode 100644 index 00000000..c06dbffd --- /dev/null +++ b/src/musredit/PFileWatcher.cpp @@ -0,0 +1,115 @@ +/**************************************************************************** + + PFileWatcher.cpp + + Author: Andreas Suter + e-mail: andreas.suter@psi.ch + + $Id$ + +*****************************************************************************/ + +/*************************************************************************** + * Copyright (C) 2010 by Andreas Suter * + * andreas.suter@psi.ch * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include + +#include "PFileWatcher.h" + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +PFileWatcher::PFileWatcher(const QString &fileName, const QDateTime &lastModified) : fFileName(fileName), fLastModified(lastModified) +{ + fFileInfo = 0; + fFileInfo = new QFileInfo(fFileName); + if (!fFileInfo) { + fValid = false; + } +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +PFileWatcher::~PFileWatcher() +{ + if (fFileInfo) { + delete fFileInfo; + fFileInfo = 0; + } +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +bool PFileWatcher::modified() +{ + bool result = false; + + fFileInfo->refresh(); + + if (fFileInfo->lastModified() > fLastModified) { + fLastModified = fFileInfo->lastModified(); + result = true; + } + + return result; +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PFileWatcher::modified(int timeout) +{ + fTimerCheck = new QTimer(this); + + connect( fTimerCheck, SIGNAL(timeout()), this, SLOT(checkIfModified()) ); + QTimer::singleShot(timeout * 1000, this, SLOT(stopFileCheck())); + + fTimerCheck->start(1000); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PFileWatcher::checkIfModified() +{ + fFileInfo->refresh(); + + if (fFileInfo->lastModified() > fLastModified) { + fLastModified = fFileInfo->lastModified(); + fTimerCheck->stop(); + emit changed(); + } +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PFileWatcher::stopFileCheck() +{ + fTimerCheck->stop(); +} diff --git a/src/musredit/PFileWatcher.h b/src/musredit/PFileWatcher.h new file mode 100644 index 00000000..9a50b1b1 --- /dev/null +++ b/src/musredit/PFileWatcher.h @@ -0,0 +1,74 @@ +/**************************************************************************** + + PFileWatcher.h + + Author: Andreas Suter + e-mail: andreas.suter@psi.ch + + $Id$ + +*****************************************************************************/ + +/*************************************************************************** + * Copyright (C) 2010 by Andreas Suter * + * andreas.suter@psi.ch * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +/* + CHECK IF THIS IS STILL NEEDED!! AS FAR AS I KNOW, STARTING FROM Qt4.x THERE IS A PROPER Qt-WAY TO DO THIS!! +*/ + + +#ifndef _PFILEWATCHER_H_ +#define _PFILEWATCHER_H_ + +#include +#include +#include +#include +#include + +class PFileWatcher : public QObject +{ + Q_OBJECT + + public: + PFileWatcher(const QString &fileName, const QDateTime &lastModified); + virtual ~PFileWatcher(); + + virtual bool isValid() { return fValid; } + virtual bool modified(); + virtual void modified(int timeout); + + signals: + void changed(); + + private slots: + void checkIfModified(); + void stopFileCheck(); + + private: + bool fValid; + QString fFileName; + QFileInfo *fFileInfo; + QDateTime fLastModified; + + QTimer *fTimerCheck; +}; + +#endif // _PFILEWATCHER_H_ diff --git a/src/musredit/PFindDialog.cpp b/src/musredit/PFindDialog.cpp new file mode 100644 index 00000000..25043e88 --- /dev/null +++ b/src/musredit/PFindDialog.cpp @@ -0,0 +1,104 @@ +/**************************************************************************** + + PFindDialog.cpp + + Author: Andreas Suter + e-mail: andreas.suter@psi.ch + + $Id: PFindDialog.cpp 3917 2009-05-13 07:49:49Z nemu $ + +*****************************************************************************/ + +/*************************************************************************** + * Copyright (C) 2009 by Andreas Suter * + * andreas.suter@psi.ch * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include +#include +#include + +#include + +#include "PFindDialog.h" + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +PFindDialog::PFindDialog(PFindReplaceData *data, const bool selection, QWidget *parent, Qt::WindowFlags f) : + QDialog(parent, f), fData(data) +{ + setupUi(this); + + setModal(true); + + // if only empty text, disable find button + if (fData->findText == "") { + fFind_pushButton->setEnabled(false); + } + + // if there is no selection, disable that option + if (!selection) { + fSelectedText_checkBox->setChecked(false); + fSelectedText_checkBox->setEnabled(false); + } + + fFind_comboBox->setItemText(0, fData->findText); + fCaseSensitive_checkBox->setChecked(fData->caseSensitive); + fWholeWordsOnly_checkBox->setChecked(fData->wholeWordsOnly); + fFromCursor_checkBox->setChecked(fData->fromCursor); + fFindBackwards_checkBox->setChecked(fData->findBackwards); + + if (selection) { + fSelectedText_checkBox->setChecked(fData->selectedText); + } +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +PFindReplaceData* PFindDialog::getData() +{ + fData->findText = fFind_comboBox->currentText(); + fData->caseSensitive = fCaseSensitive_checkBox->isChecked(); + fData->wholeWordsOnly = fWholeWordsOnly_checkBox->isChecked(); + fData->fromCursor = fFromCursor_checkBox->isChecked(); + fData->findBackwards = fFindBackwards_checkBox->isChecked(); + if (fSelectedText_checkBox->isEnabled()) + fData->selectedText = fSelectedText_checkBox->isChecked(); + + return fData; +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PFindDialog::onFindTextAvailable(const QString&) +{ + if (fFind_comboBox->currentText() != "") + fFind_pushButton->setEnabled(true); + else + fFind_pushButton->setEnabled(false); +} + +//---------------------------------------------------------------------------------------------------- +// END +//---------------------------------------------------------------------------------------------------- diff --git a/src/musredit/PFindDialog.h b/src/musredit/PFindDialog.h new file mode 100644 index 00000000..e134afda --- /dev/null +++ b/src/musredit/PFindDialog.h @@ -0,0 +1,55 @@ +/**************************************************************************** + + PFindDialog.h + + Author: Andreas Suter + e-mail: andreas.suter@psi.ch + + $Id$ + +*****************************************************************************/ + +/*************************************************************************** + * Copyright (C) 2010 by Andreas Suter * + * andreas.suter@psi.ch * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef _PFINDDIALOG_H_ +#define _PFINDDIALOG_H_ + +#include "musredit.h" +#include "ui_PFindDialog.h" + +class PFindDialog : public QDialog, private Ui::PFindDialog +{ + Q_OBJECT + + public: + PFindDialog(PFindReplaceData *data, const bool selection, QWidget *parent = 0, Qt::WindowFlags f = 0); + virtual ~PFindDialog() {} + + virtual PFindReplaceData *getData(); + + protected slots: + virtual void onFindTextAvailable(const QString&); + + private: + PFindReplaceData *fData; +}; + +#endif // _PFINDDIALOG_H_ diff --git a/src/musredit/PFitOutputHandler.cpp b/src/musredit/PFitOutputHandler.cpp new file mode 100644 index 00000000..49ff6e3f --- /dev/null +++ b/src/musredit/PFitOutputHandler.cpp @@ -0,0 +1,160 @@ +/**************************************************************************** + + PFitOutputHandler.cpp + + Author: Andreas Suter + e-mail: andreas.suter@psi.ch + + $Id: PFitOutputHandler.cpp 4148 2009-09-11 12:37:01Z nemu $ + +*****************************************************************************/ + +/*************************************************************************** + * Copyright (C) 2009 by Andreas Suter * + * andreas.suter@psi.ch * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include + +#include + +#include "PFitOutputHandler.h" + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +PFitOutputHandler::PFitOutputHandler(QString workingDirectory, QVector &cmd) +{ + if (cmd.empty()) + return; + + // Layout + fVbox = new QVBoxLayout( this ); +//Qt.3x fVbox->resize(800, 500); + fOutput = new QTextEdit(); + fVbox->addWidget(fOutput); + fOutput->setMinimumSize(800, 455); + fOutput->setReadOnly(true); + fQuitButton = new QPushButton( tr("Fitting...") ); + fVbox->addWidget(fQuitButton); + connect( fQuitButton, SIGNAL( clicked() ), this, SLOT( quitButtonPressed() ) ); + resize( 800, 500 ); + fQuitButton->setFocus(); + + // QProcess related code + fProc = new QProcess( this ); + + fProc->setWorkingDirectory(workingDirectory); + + // Set up the command and arguments. + QString program = cmd[0]; + QStringList arguments; + for (int i=1; istart(program, arguments); + if ( !fProc->waitForStarted() ) { + // error handling + QString msg(tr("Could not execute the output command: ")+cmd[0]); + QMessageBox::critical( 0, + tr("Fatal error"), + msg, + tr("Quit") ); + done(0); + } +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +PFitOutputHandler::~PFitOutputHandler() +{ + if (fProc->state() == QProcess::Running) { + qDebug() << "fProc still running" << endl; + fProc->kill(); + } +/* + if (fProc->isRunning()) { + QString msg = "fProc still running ..."; + qDebug(msg); + } +*/ + if (fProc) { + delete fProc; + fProc = 0; + } +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PFitOutputHandler::readFromStdOut() +{ + // Read and process the data. + // Bear in mind that the data might be output in chunks. + fOutput->append( fProc->readAllStandardOutput() ); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PFitOutputHandler::readFromStdErr() +{ + // Read and process the data. + // Bear in mind that the data might be output in chunks. + fOutput->append( fProc->readAllStandardError() ); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PFitOutputHandler::processDone(int exitCode, QProcess::ExitStatus exitStatus) +{ + if (exitStatus == QProcess::CrashExit) + qDebug() << "**ERROR** PFitOutputHandler::processDone: exitCode = " << exitCode << endl; + fQuitButton->setText("Done"); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PFitOutputHandler::quitButtonPressed() +{ + // if the fitting is still taking place, kill it + if (fProc->state() == QProcess::Running) { + fProc->terminate(); + if (!fProc->waitForFinished()) + fProc->kill(); + } + + accept(); +} + +//---------------------------------------------------------------------------------------------------- +// END +//---------------------------------------------------------------------------------------------------- diff --git a/src/musredit/PFitOutputHandler.h b/src/musredit/PFitOutputHandler.h new file mode 100644 index 00000000..31d837a2 --- /dev/null +++ b/src/musredit/PFitOutputHandler.h @@ -0,0 +1,68 @@ +/**************************************************************************** + + PFitOutputHandler.h + + Author: Andreas Suter + e-mail: andreas.suter@psi.ch + + $Id$ + +*****************************************************************************/ + +/*************************************************************************** + * Copyright (C) 2010 by Andreas Suter * + * andreas.suter@psi.ch * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef _PFITOUTPUTHANDLER_H_ +#define _PFITOUTPUTHANDLER_H_ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +class PFitOutputHandler : public QDialog +{ + Q_OBJECT + + public: + PFitOutputHandler(QString workingDirectory, QVector &cmd); + virtual ~PFitOutputHandler(); + + private slots: + virtual void readFromStdOut(); + virtual void readFromStdErr(); + virtual void quitButtonPressed(); + virtual void processDone(int exitCode, QProcess::ExitStatus exitStatus); + +private: + QProcess *fProc; + + QVBoxLayout *fVbox; + QTextEdit *fOutput; + QPushButton *fQuitButton; +}; + +#endif // _PFITOUTPUTHANDLER_H_ diff --git a/src/musredit/PGetAsymmetryRunBlockDialog.cpp b/src/musredit/PGetAsymmetryRunBlockDialog.cpp new file mode 100644 index 00000000..ed025aa0 --- /dev/null +++ b/src/musredit/PGetAsymmetryRunBlockDialog.cpp @@ -0,0 +1,270 @@ +/**************************************************************************** + + PGetAsymmetryRunBlockDialog.cpp + + Author: Andreas Suter + e-mail: andreas.suter@psi.ch + + $Id: PGetAsymmetryRunBlockDialog.cpp 3800 2009-03-22 16:19:08Z nemu $ + +*****************************************************************************/ + +/*************************************************************************** + * Copyright (C) 2009 by Andreas Suter * + * andreas.suter@psi.ch * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include +#include +#include +#include + +#include "PGetAsymmetryRunBlockDialog.h" + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +PGetAsymmetryRunBlockDialog::PGetAsymmetryRunBlockDialog(const QString help, QWidget *parent, Qt::WindowFlags f) : + QDialog(parent, f), + fHelp(help) +{ + setupUi(this); + + setModal(true); + + fForwardHistoNo_lineEdit->setValidator( new QIntValidator(fForwardHistoNo_lineEdit) ); + fBackwardHistoNo_lineEdit->setValidator( new QIntValidator(fBackwardHistoNo_lineEdit) ); + fDataForwardStart_lineEdit->setValidator( new QIntValidator(fDataForwardStart_lineEdit) ); + fDataForwardEnd_lineEdit->setValidator( new QIntValidator(fDataForwardEnd_lineEdit) ); + fDataBackwardStart_lineEdit->setValidator( new QIntValidator(fDataBackwardStart_lineEdit) ); + fDataBackwardEnd_lineEdit->setValidator( new QIntValidator(fDataBackwardEnd_lineEdit) ); + fBackgroundForwardStart_lineEdit->setValidator( new QIntValidator(fBackgroundForwardStart_lineEdit) ); + fBackgroundForwardEnd_lineEdit->setValidator( new QIntValidator(fBackgroundForwardEnd_lineEdit) ); + fBackgroundBackwardStart_lineEdit->setValidator( new QIntValidator(fBackgroundBackwardStart_lineEdit) ); + fBackgroundBackwardEnd_lineEdit->setValidator( new QIntValidator(fBackgroundBackwardEnd_lineEdit) ); + fBackgroundForwardFix_lineEdit->setValidator( new QDoubleValidator(fBackgroundForwardFix_lineEdit) ); + fBackgroundBackwardFix_lineEdit->setValidator( new QDoubleValidator(fBackgroundBackwardFix_lineEdit) ); + fFitRangeStart_lineEdit->setValidator( new QDoubleValidator(fFitRangeStart_lineEdit) ); + fFitRangeEnd_lineEdit->setValidator( new QDoubleValidator(fFitRangeEnd_lineEdit) ); + fPacking_lineEdit->setValidator( new QIntValidator(fPacking_lineEdit) ); + fAlpha_lineEdit->setValidator( new QIntValidator(fAlpha_lineEdit) ); + fBeta_lineEdit->setValidator( new QIntValidator(fBeta_lineEdit) ); + fT0Forward_lineEdit->setValidator( new QIntValidator(fT0Forward_lineEdit) ); + fT0Backward_lineEdit->setValidator( new QIntValidator(fT0Backward_lineEdit) ); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +QString PGetAsymmetryRunBlockDialog::getRunHeaderInfo() +{ + QString str; + + str = "RUN " + fRunFileName_lineEdit->text() + " "; + str += fBeamline_lineEdit->text().toUpper() + " "; + str += fInstitute_comboBox->currentText() + " "; + str += fFileFormat_comboBox->currentText() + " (name beamline institute data-file-format)\n"; + + return str; +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +QString PGetAsymmetryRunBlockDialog::getAlphaParameter(bool &present) +{ + QString str = "alpha " + fAlpha_lineEdit->text() + "\n"; + + if (str.isEmpty()) + present = false; + else + present = true; + + return str; +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +QString PGetAsymmetryRunBlockDialog::getBetaParameter(bool &present) +{ + QString str = "beta " + fBeta_lineEdit->text() + "\n"; + + if (str.isEmpty()) + present = false; + else + present = true; + + return str; +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +QString PGetAsymmetryRunBlockDialog::getMap(bool &valid) +{ + QString str = fMap_lineEdit->text().trimmed().remove(" "); + + // check if potentially proper map line + for (int i=0; itext() + "\n"; + + return str; +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +QString PGetAsymmetryRunBlockDialog::getBackground(bool &valid) +{ + QString str = ""; + + valid = true; + + // check that either backgr.fix or background is given, but not both + if (fBackgroundForwardStart_lineEdit->text().isEmpty() && fBackgroundForwardEnd_lineEdit->text().isEmpty() && + fBackgroundBackwardStart_lineEdit->text().isEmpty() && fBackgroundBackwardEnd_lineEdit->text().isEmpty() && + fBackgroundForwardFix_lineEdit->text().isEmpty() && fBackgroundBackwardFix_lineEdit->text().isEmpty()) { + valid = false; + str = "background 0 10 0 10\n"; + } else { + if (!fBackgroundForwardStart_lineEdit->text().isEmpty()) { // assume the rest is given, not fool prove but ... + str = "background "; + str += fBackgroundForwardStart_lineEdit->text() + " "; + str += fBackgroundForwardEnd_lineEdit->text() + " "; + str += fBackgroundBackwardStart_lineEdit->text() + " "; + str += fBackgroundBackwardEnd_lineEdit->text() + "\n"; + } + if (!fBackgroundForwardFix_lineEdit->text().isEmpty()) { // assume the rest is given, not fool prove but ... + str = "backgr.fix "; + str += fBackgroundForwardFix_lineEdit->text() + " "; + str += fBackgroundBackwardFix_lineEdit->text() + "\n"; + } + } + + return str; +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +QString PGetAsymmetryRunBlockDialog::getData(bool &valid) +{ + QString str = ""; + + if (fDataForwardStart_lineEdit->text().isEmpty() || fDataForwardEnd_lineEdit->text().isEmpty() || + fDataBackwardStart_lineEdit->text().isEmpty() || fDataBackwardEnd_lineEdit->text().isEmpty()) { + valid = false; + } else { + str = "data "; + str += fDataForwardStart_lineEdit->text() + " "; + str += fDataForwardEnd_lineEdit->text() + " "; + str += fDataBackwardStart_lineEdit->text() + " "; + str += fDataBackwardEnd_lineEdit->text() + "\n"; + valid = true; + } + + return str; +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +QString PGetAsymmetryRunBlockDialog::getT0(bool &present) +{ + QString str = ""; + + if (!fT0Forward_lineEdit->text().isEmpty() && !fT0Forward_lineEdit->text().isEmpty()) { + str = "t0 "; + str += fT0Forward_lineEdit->text() + " "; + str += fT0Backward_lineEdit->text() + "\n"; + present = true; + } else { + present = false; + } + + return str; +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +QString PGetAsymmetryRunBlockDialog::getFitRange(bool &valid) +{ + QString str = ""; + + if (fFitRangeStart_lineEdit->text().isEmpty() || fFitRangeEnd_lineEdit->text().isEmpty()) { + str += "fit 0.0 10.0\n"; + valid = false; + } else { + str += "fit "; + str += fFitRangeStart_lineEdit->text() + " "; + str += fFitRangeEnd_lineEdit->text() + "\n"; + valid = true; + } + + return str; +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +QString PGetAsymmetryRunBlockDialog::getPacking(bool &present) +{ + QString str = ""; + + if (fPacking_lineEdit->text().isEmpty()) { + present = false; + str += "packing 1\n"; + } else { + present = true; + str += "packing " + fPacking_lineEdit->text() + "\n\n"; + } + + return str; +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PGetAsymmetryRunBlockDialog::helpContent() +{ + QMessageBox::information(this, "helpContents", + fHelp, QMessageBox::Ok); +} + +//---------------------------------------------------------------------------------------------------- +// END +//---------------------------------------------------------------------------------------------------- diff --git a/src/musredit/PGetAsymmetryRunBlockDialog.h b/src/musredit/PGetAsymmetryRunBlockDialog.h new file mode 100644 index 00000000..c31cf308 --- /dev/null +++ b/src/musredit/PGetAsymmetryRunBlockDialog.h @@ -0,0 +1,63 @@ +/**************************************************************************** + + PGetAsymmetryRunBlockDialog.h + + Author: Andreas Suter + e-mail: andreas.suter@psi.ch + + $Id: PGetAsymmetryRunBlockDialog.h 3788 2009-03-19 07:58:16Z nemu $ + +*****************************************************************************/ + +/*************************************************************************** + * Copyright (C) 2009 by Andreas Suter * + * andreas.suter@psi.ch * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef _PGETASYMMETRYRUNBLOCKDIALOG_H_ +#define _PGETASYMMETRYRUNBLOCKDIALOG_H_ + +#include "ui_PGetAsymmetryRunBlockDialog.h" + +class PGetAsymmetryRunBlockDialog : public QDialog, private Ui::PGetAsymmetryRunBlockDialog +{ + Q_OBJECT + + public: + PGetAsymmetryRunBlockDialog(const QString help = "", QWidget * parent = 0, Qt::WindowFlags f = 0); + + QString getRunHeaderInfo(); + QString getAlphaParameter(bool &present); + QString getBetaParameter(bool &present); + QString getMap(bool &valid); + QString getForward() { return QString("forward " + fForwardHistoNo_lineEdit->text() + "\n"); } + QString getBackward() { return QString("backward " + fBackwardHistoNo_lineEdit->text() + "\n"); } + QString getBackground(bool &valid); + QString getData(bool &valid); + QString getT0(bool &present); + QString getFitRange(bool &valid); + QString getPacking(bool &present); + + private slots: + void helpContent(); + + private: + QString fHelp; +}; + +#endif // _PGETASYMMETRYRUNBLOCKDIALOG_H_ diff --git a/src/musredit/PGetDefaultDialog.cpp b/src/musredit/PGetDefaultDialog.cpp new file mode 100644 index 00000000..dbb6fd2c --- /dev/null +++ b/src/musredit/PGetDefaultDialog.cpp @@ -0,0 +1,108 @@ +/**************************************************************************** + + PGetDefaultDialog.cpp + + Author: Andreas Suter + e-mail: andreas.suter@psi.ch + + $Id: PGetDefaultDialog.cpp 3807 2009-03-25 09:49:32Z nemu $ + +*****************************************************************************/ + +/*************************************************************************** + * Copyright (C) 2009 by Andreas Suter * + * andreas.suter@psi.ch * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include +#include +#include + +#include "PGetDefaultDialog.h" + +#define INSTITUTE_PSI 0 +#define INSTITUTE_RAL 1 +#define INSTITUTE_TRIUMF 2 +#define INSTITUTE_JPARC 3 + +#define FILE_FORMAT_NEXUS 0 +#define FILE_FORMAT_ROOT_NPP 1 +#define FILE_FORMAT_ROOT_PPC 2 +#define FILE_FORMAT_PSIBIN 3 +#define FILE_FORMAT_MUD 4 +#define FILE_FORMAT_WKM 5 +#define FILE_FORMAT_ASCII 6 +#define FILE_FORMAT_DB 7 + + +//--------------------------------------------------------------------------- +/** + *

+ */ +PGetDefaultDialog::PGetDefaultDialog(QWidget *parent, Qt::WindowFlags f) : + QDialog(parent, f) +{ + setupUi(this); + + setModal(true); +} + + +//--------------------------------------------------------------------------- +/** + *

+ */ +void PGetDefaultDialog::setInstitute(const QString &str) { + + for (int i=0; icount(); i++) { + if (fInstitute_comboBox->itemText(i).toLower() == str.toLower()) { + fInstitute_comboBox->setCurrentIndex(i); + break; + } + } + +} + +//--------------------------------------------------------------------------- +/** + *

+ */ +void PGetDefaultDialog::setFileFormat(const QString &str) +{ + + for (int i=0; icount(); i++) { + if (fFileFormat_comboBox->itemText(i).toLower() == str.toLower()) { + fFileFormat_comboBox->setCurrentIndex(i); + break; + } + } + +} + +//--------------------------------------------------------------------------- +/** + *

+ */ +void PGetDefaultDialog::helpContent() +{ + QMessageBox::information(this, "Help", "will eventually show help information."); +} + +//--------------------------------------------------------------------------- +// END +//--------------------------------------------------------------------------- diff --git a/src/musredit/PGetDefaultDialog.h b/src/musredit/PGetDefaultDialog.h new file mode 100644 index 00000000..d19ad0a2 --- /dev/null +++ b/src/musredit/PGetDefaultDialog.h @@ -0,0 +1,63 @@ +/**************************************************************************** + + PGetDefaultDialog.h + + Author: Andreas Suter + e-mail: andreas.suter@psi.ch + + $Id$ + +*****************************************************************************/ + +/*************************************************************************** + * Copyright (C) 2010 by Andreas Suter * + * andreas.suter@psi.ch * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef _PGETDEFAULTDIALOG_H_ +#define _PGETDEFAULTDIALOG_H_ + +#include +#include +#include +#include + +#include "ui_PGetDefaultDialog.h" + +class PGetDefaultDialog : public QDialog, private Ui::PGetDefaultDialog +{ + Q_OBJECT + + public: + PGetDefaultDialog(QWidget *parent = 0, Qt::WindowFlags f = 0); + virtual ~PGetDefaultDialog() {} + + virtual const QString getRunFileName() const { return fRunFileName_lineEdit->text(); } + virtual const QString getBeamline() const { return fBeamline_lineEdit->text(); } + virtual const QString getInstitute() const { return fInstitute_comboBox->currentText(); } + virtual const QString getFileFormat() const { return fFileFormat_comboBox->currentText(); } + + virtual void setBeamline(const QString &str) { fBeamline_lineEdit->setText(str); } + virtual void setInstitute(const QString &str); + virtual void setFileFormat(const QString &str); + + protected slots: + virtual void helpContent(); +}; + +#endif // _PGETDEFAULTDIALOG_H_ diff --git a/src/musredit/PGetFourierBlockDialog.cpp b/src/musredit/PGetFourierBlockDialog.cpp new file mode 100644 index 00000000..35c8b1d1 --- /dev/null +++ b/src/musredit/PGetFourierBlockDialog.cpp @@ -0,0 +1,135 @@ +/**************************************************************************** + + PGetFourierBlockDialog.cpp + + Author: Andreas Suter + e-mail: andreas.suter@psi.ch + + $Id: PGetFourierBlockDialog.cpp 3978 2009-06-09 11:16:39Z nemu $ + +*****************************************************************************/ + +/*************************************************************************** + * Copyright (C) 2009 by Andreas Suter * + * andreas.suter@psi.ch * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include +#include +#include +#include +#include +#include + +#include "PGetFourierBlockDialog.h" + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +PGetFourierBlockDialog::PGetFourierBlockDialog() +{ + setupUi(this); + + setModal(true); + + fFourierBlock = ""; + fFourierPower_lineEdit->setValidator( new QIntValidator(fFourierPower_lineEdit) ); + fPhaseCorrectionRangeLow_lineEdit->setValidator( new QDoubleValidator(fPhaseCorrectionRangeLow_lineEdit) ); + fPhaseCorrectionRangeUp_lineEdit->setValidator( new QDoubleValidator(fPhaseCorrectionRangeUp_lineEdit) ); + fRangeLow_lineEdit->setValidator( new QDoubleValidator(fRangeLow_lineEdit) ); + fRangeUp_lineEdit->setValidator( new QDoubleValidator(fRangeUp_lineEdit) ); + + connect( fPhase_lineEdit, SIGNAL( lostFocus() ), this, SLOT( checkPhaseParameter() ) ); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PGetFourierBlockDialog::checkPhaseParameter() +{ + QString str = fPhase_lineEdit->text(); + + if (str.isEmpty()) + return; + + bool ok; + int ival; + + ival = str.toInt(&ok); + if (!ok) { // i.e. the phase entry is not a number. Check for parXX + str.trimmed(); + if (str.startsWith("par")) { // + str.remove("par"); + ival = str.toInt(&ok); + if (!ok) { + fPhase_lineEdit->clear(); + QMessageBox::critical(this, "**ERROR**", + "Allowed phase entries are either a parameter number,\n or an parXX entry, where XX is a parameter number", + QMessageBox::Ok, QMessageBox::NoButton); + fPhase_lineEdit->setFocus(); + } + } else { // neither a parXX nor a number + fPhase_lineEdit->clear(); + QMessageBox::critical(this, "**ERROR**", + "Allowed phase entries are either a parameter number,\n or an parXX entry, where XX is a parameter number", + QMessageBox::Ok, QMessageBox::NoButton); + fPhase_lineEdit->setFocus(); + } + } +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PGetFourierBlockDialog::fillFourierBlock() +{ + fFourierBlock = "###############################################################\n"; + fFourierBlock += "FOURIER\n"; + fFourierBlock += "units " + fUnits_comboBox->currentText() + "\n"; + QString str = fFourierPower_lineEdit->text(); + if (!str.isEmpty()) + fFourierBlock += "fourier_power " + str + "\n"; + fFourierBlock += "apodization " + fApodization_comboBox->currentText() + "\n"; + fFourierBlock += "plot " + fPlot_comboBox->currentText() + "\n"; + str = fPhase_lineEdit->text(); + if (!str.isEmpty()) + fFourierBlock += "phase " + str + "\n"; + if (!fPhaseCorrectionRangeLow_lineEdit->text().isEmpty() && !fPhaseCorrectionRangeUp_lineEdit->text().isEmpty()) { + fFourierBlock += "range_for_phase_correction " + fPhaseCorrectionRangeLow_lineEdit->text() + " " + + fPhaseCorrectionRangeUp_lineEdit->text() + "\n"; + } + if (!fRangeLow_lineEdit->text().isEmpty() && !fRangeUp_lineEdit->text().isEmpty()) { + fFourierBlock += "range " + fRangeLow_lineEdit->text() + " " + fRangeUp_lineEdit->text() + "\n"; + } +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PGetFourierBlockDialog::helpContent() +{ + QMessageBox::information(this, "**HELP**", "Will eventually show a help."); +} + +//---------------------------------------------------------------------------------------------------- +// END +//---------------------------------------------------------------------------------------------------- diff --git a/src/musredit/PGetFourierBlockDialog.h b/src/musredit/PGetFourierBlockDialog.h new file mode 100644 index 00000000..eef05511 --- /dev/null +++ b/src/musredit/PGetFourierBlockDialog.h @@ -0,0 +1,57 @@ +/**************************************************************************** + + PGetFourierBlockDialog.h + + Author: Andreas Suter + e-mail: andreas.suter@psi.ch + + $Id: PGetFourierBlockDialog.h 3978 2009-06-09 11:16:39Z nemu $ + +*****************************************************************************/ + +/*************************************************************************** + * Copyright (C) 2009 by Andreas Suter * + * andreas.suter@psi.ch * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef _PGETFOURIERBLOCKDIALOG_H_ +#define _PGETFOURIERBLOCKDIALOG_H_ + +#include + +#include "ui_PGetFourierBlockDialog.h" + +class PGetFourierBlockDialog : public QDialog, private Ui::PGetFourierBlockDialog +{ + Q_OBJECT + + public: + PGetFourierBlockDialog(); + + QString getFourierBlock() { return fFourierBlock; } + + private slots: + void checkPhaseParameter(); + void fillFourierBlock(); + void helpContent(); + + private: + QString fFourierBlock; +}; + +#endif // _PGETFOURIERBLOCKDIALOG_H_ diff --git a/src/musredit/PGetFunctionsBlockDialog.cpp b/src/musredit/PGetFunctionsBlockDialog.cpp new file mode 100644 index 00000000..1bd2f60a --- /dev/null +++ b/src/musredit/PGetFunctionsBlockDialog.cpp @@ -0,0 +1,112 @@ +/**************************************************************************** + + PGetFunctionsBlockDialog.cpp + + Author: Andreas Suter + e-mail: andreas.suter@psi.ch + + $Id: PGetFunctionsBlockDialog.cpp 3865 2009-04-20 07:46:50Z nemu $ + +*****************************************************************************/ + +/*************************************************************************** + * Copyright (C) 2009 by Andreas Suter * + * andreas.suter@psi.ch * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include +#include +#include +#include +#include + +#include + +#include "PGetFunctionsBlockDialog.h" + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +PGetFunctionsBlockDialog::PGetFunctionsBlockDialog(const QString help, QWidget *parent, Qt::WindowFlags f) : + QDialog(parent, f), fHelp(help) +{ + setupUi(this); + + setModal(true); + + fFunctionInput_lineEdit->setFocus(); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PGetFunctionsBlockDialog::addFunction() +{ + QString str = fFunctionInput_lineEdit->text(); + + if (str.isEmpty()) + return; + + // validation + + // check that the function string starts with 'fun' + if (!str.trimmed().startsWith("fun")) { + QMessageBox::critical(this, "addFunction", + "a function has to start with 'funX' (X a number).\nNeeds to be fixed.", + QMessageBox::Ok, QMessageBox::NoButton); + return; + } + + // check if function string contains 'funX =' + if (str.indexOf( QRegExp("fun\\d+\\s*=") ) == -1) { + QMessageBox::critical(this, "addFunction", + "a function has to start with 'funX =' (X a positive number).\nNeeds to be fixed.", + QMessageBox::Ok, QMessageBox::NoButton); + return; + } + + // check if function string contains more than one 'funX' + if (str.trimmed().lastIndexOf("fun", -1, Qt::CaseInsensitive) > 0) { + QMessageBox::critical(this, "addFunction", + "a function cannot contain more than one function,\ni.e. fun2 = fun1 + par1 is not OK.", + QMessageBox::Ok, QMessageBox::NoButton); + return; + } + + // add to Functions block + fFunctionBlock_plainTextEdit->appendPlainText(str); + + // clear functions input text + fFunctionInput_lineEdit->clear(); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PGetFunctionsBlockDialog::helpContent() +{ + QMessageBox::information(this, "helpContents", + fHelp, QMessageBox::Ok); +} + +//---------------------------------------------------------------------------------------------------- +// END +//---------------------------------------------------------------------------------------------------- diff --git a/src/musredit/PGetFunctionsBlockDialog.h b/src/musredit/PGetFunctionsBlockDialog.h new file mode 100644 index 00000000..0f44ad93 --- /dev/null +++ b/src/musredit/PGetFunctionsBlockDialog.h @@ -0,0 +1,54 @@ +/**************************************************************************** + + PGetFunctionsBlockDialog.h + + Author: Andreas Suter + e-mail: andreas.suter@psi.ch + + $Id: PGetFunctionsBlockDialog.h 3794 2009-03-20 18:07:52Z nemu $ + +*****************************************************************************/ + +/*************************************************************************** + * Copyright (C) 2009 by Andreas Suter * + * andreas.suter@psi.ch * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef _PGETFUNCTIONSBLOCKDIALOG_H_ +#define _PGETFUNCTIONSBLOCKDIALOG_H_ + +#include "ui_PGetFunctionsBlockDialog.h" + +class PGetFunctionsBlockDialog : public QDialog, private Ui::PGetFunctionsBlockDialog +{ + Q_OBJECT + + public: + PGetFunctionsBlockDialog(const QString help = "", QWidget * parent = 0, Qt::WindowFlags f = 0); + + QString getFunctionsBlock() { return fFunctionBlock_plainTextEdit->toPlainText(); } + + private slots: + void addFunction(); + void helpContent(); + + private: + QString fHelp; +}; + +#endif // _PGETFUNCTIONSBLOCKDIALOG_H_ diff --git a/src/musredit/PGetNonMusrRunBlockDialog.cpp b/src/musredit/PGetNonMusrRunBlockDialog.cpp new file mode 100644 index 00000000..e360fa18 --- /dev/null +++ b/src/musredit/PGetNonMusrRunBlockDialog.cpp @@ -0,0 +1,156 @@ +/**************************************************************************** + + PGetNonMusrRunBlockDialog.cpp + + Author: Andreas Suter + e-mail: andreas.suter@psi.ch + + $Id: PGetNonMusrRunBlockDialog.cpp 3790 2009-03-19 15:29:21Z nemu $ + +*****************************************************************************/ + +/*************************************************************************** + * Copyright (C) 2009 by Andreas Suter * + * andreas.suter@psi.ch * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include +#include +#include +#include + +#include "PGetNonMusrRunBlockDialog.h" + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +PGetNonMusrRunBlockDialog::PGetNonMusrRunBlockDialog(const QString help, QWidget *parent, Qt::WindowFlags f) : + QDialog(parent, f), + fHelp(help) +{ + setupUi(this); + + setModal(true); + + fFitRangeStart_lineEdit->setValidator( new QDoubleValidator(fFitRangeStart_lineEdit) ); + fFitRangeEnd_lineEdit->setValidator( new QDoubleValidator(fFitRangeEnd_lineEdit) ); + + int idx = -1; + for (int i=0; icount(); i++) { + if (fFileFormat_comboBox->itemText(i) == "DB") { + idx = i; + break; + } + } + if (idx >= 0) { + fFileFormat_comboBox->setCurrentIndex(idx); + } +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +QString PGetNonMusrRunBlockDialog::getRunHeaderInfo() +{ + QString str; + + str = "RUN " + fRunFileName_lineEdit->text() + " "; + str += fBeamline_lineEdit->text().toUpper() + " "; + str += fInstitute_comboBox->currentText() + " "; + str += fFileFormat_comboBox->currentText() + " (name beamline institute data-file-format)\n"; + + return str; +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +QString PGetNonMusrRunBlockDialog::getMap(bool &valid) +{ + QString str = fMap_lineEdit->text().trimmed().remove(" "); + + // check if potentially proper map line + for (int i=0; itext() + "\n"; + + return str; +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +QString PGetNonMusrRunBlockDialog::getXYData(bool &valid) +{ + QString str = ""; + + if (fXData_lineEdit->text().isEmpty() || fYData_lineEdit->text().isEmpty()) { + valid = false; + } else { + str = "xy-data "; + str += fXData_lineEdit->text() + " "; + str += fYData_lineEdit->text() + "\n"; + valid = true; + } + + return str; +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +QString PGetNonMusrRunBlockDialog::getFitRange(bool &valid) +{ + QString str = ""; + + if (fFitRangeStart_lineEdit->text().isEmpty() || fFitRangeEnd_lineEdit->text().isEmpty()) { + str += "fit 0.0 10.0\n"; + valid = false; + } else { + str += "fit "; + str += fFitRangeStart_lineEdit->text() + " "; + str += fFitRangeEnd_lineEdit->text() + "\n"; + valid = true; + } + + return str; +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PGetNonMusrRunBlockDialog::helpContent() +{ + QMessageBox::information(this, "helpContent", + fHelp, QMessageBox::Ok); +} + +//---------------------------------------------------------------------------------------------------- +// END +//---------------------------------------------------------------------------------------------------- diff --git a/src/musredit/PGetNonMusrRunBlockDialog.h b/src/musredit/PGetNonMusrRunBlockDialog.h new file mode 100644 index 00000000..6d5cca8f --- /dev/null +++ b/src/musredit/PGetNonMusrRunBlockDialog.h @@ -0,0 +1,56 @@ +/**************************************************************************** + + PGetNonMusrRunBlockDialog.h + + Author: Andreas Suter + e-mail: andreas.suter@psi.ch + + $Id: PGetNonMusrRunBlockDialog.h 3790 2009-03-19 15:29:21Z nemu $ + +*****************************************************************************/ + +/*************************************************************************** + * Copyright (C) 2009 by Andreas Suter * + * andreas.suter@psi.ch * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef _PGETNONMUSRRUNBLOCKDIALOG_H_ +#define _PGETNONMUSRRUNBLOCKDIALOG_H_ + +#include "ui_PGetNonMusrRunBlockDialog.h" + +class PGetNonMusrRunBlockDialog : public QDialog, private Ui::PGetNonMusrRunBlockDialog +{ + Q_OBJECT + + public: + PGetNonMusrRunBlockDialog(const QString help = "", QWidget * parent = 0, Qt::WindowFlags f = 0); + + QString getRunHeaderInfo(); + QString getMap(bool &valid); + QString getXYData(bool &valid); + QString getFitRange(bool &valid); + + private slots: + void helpContent(); + + private: + QString fHelp; +}; + +#endif // _PGETNONMUSRRUNBLOCKDIALOG_H_ diff --git a/src/musredit/PGetParameterBlockDialog.cpp b/src/musredit/PGetParameterBlockDialog.cpp new file mode 100644 index 00000000..adf4fdf5 --- /dev/null +++ b/src/musredit/PGetParameterBlockDialog.cpp @@ -0,0 +1,220 @@ +/**************************************************************************** + + PGetParameterBlockDialog.cpp + + Author: Andreas Suter + e-mail: andreas.suter@psi.ch + + $Id: PGetParameterBlockDialog.cpp 3864 2009-04-20 06:50:06Z nemu $ + +*****************************************************************************/ + +/*************************************************************************** + * Copyright (C) 2009 by Andreas Suter * + * andreas.suter@psi.ch * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include + +#include "PGetParameterBlockDialog.h" + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +PGetParameterBlockDialog::PGetParameterBlockDialog() +{ + setupUi(this); + + setModal(true); + + // setup event filter + installEventFilter(this); + + fValue_lineEdit->setValidator( new QDoubleValidator(fValue_lineEdit) ); + fStep_lineEdit->setValidator( new QDoubleValidator(fStep_lineEdit) ); + + fParam_plainTextEdit->setFont(QFont("Courier", 10)); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

This event filter is filtering out the return key, and if present adds the current parameters + * to the parameter list. + */ +bool PGetParameterBlockDialog::eventFilter( QObject *obj, QEvent *ev ) +{ + if (obj == this) { + if (ev->type() == QEvent::KeyPress) { + QKeyEvent *k = (QKeyEvent*)ev; + if (k->key() == Qt::Key_Return) { + paramAdd(); + return true; + } else { + return false; + } + } else { + return false; + } + } else { + return false; + } +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PGetParameterBlockDialog::paramAdd() +{ + QString param, str, spaces; + + // get No + str = fParamNo_spinBox->text(); + if (str.toInt() < 10) + param = " " + str + " "; + else + param = " " + str + " "; + + // get name + str = fName_lineEdit->text(); + if (str.isEmpty()) { + QMessageBox::critical(this, "**ERROR**", + "empty parameter name not allowed!", + QMessageBox::Ok, QMessageBox::NoButton); + return; + } else { + param += str; + if (str.length() < 13) + param += spaces.fill(' ', 13-str.length()); + else + param += " "; + } + + // get value + str = fValue_lineEdit->text(); + if (str.isEmpty()) { + QMessageBox::critical(this, "**ERROR**", + "empty parameter value not allowed!", + QMessageBox::Ok, QMessageBox::NoButton); + return; + } else { + param += str; + if (str.length() < 10) + param += spaces.fill(' ', 10-str.length()); + else + param += " "; + } + + // get step + str = fStep_lineEdit->text(); + if (str.isEmpty()) { + QMessageBox::critical(this, "**ERROR**", + "empty parameter step not allowed!", + QMessageBox::Ok, QMessageBox::NoButton); + return; + } else { + param += str; + if (str.length() < 10) + param += spaces.fill(' ', 10-str.length()); + else + param += " "; + } + + // add positive error none + param += "none "; + + if ((fLower_lineEdit->text() != "none") || (fUpper_lineEdit->text() != "none")) { + // get lower boundary + str = fLower_lineEdit->text(); + bool ok; + double val = str.toDouble(&ok); + if (!ok && (str != "none")) { + QMessageBox::critical(this, "**ERROR**", + "invalid lower boundary! Must be a double are the key word 'none'", + QMessageBox::Ok, QMessageBox::NoButton); + return; + } else { + param += str; + if (str.length() < 10) + param += spaces.fill(' ', 10-str.length()); + else + param += " "; + } + + // get upper boundary + str = fUpper_lineEdit->text(); + val = str.toDouble(&ok); + if (!ok && (str != "none")) { + QMessageBox::critical(this, "**ERROR**", + "invalid upper boundary! Must be a double are the key word 'none'", + QMessageBox::Ok, QMessageBox::NoButton); + return; + } else { + param += str; + if (str.length() < 10) + param += spaces.fill(' ', 10-str.length()); + else + param += " "; + } + } + +// param += "\n"; + + // write parameter string into fParam_textEdit + fParam_plainTextEdit->appendPlainText(param); + + // increment No counter in spinBox + fParamNo_spinBox->stepUp(); + + // reset name lineEdit + fName_lineEdit->setText(""); + + // reset value lineEdit + fValue_lineEdit->setText(""); + + // reset step lineEdit + fStep_lineEdit->setText(""); + + // reset lower boundary lineEdit + fLower_lineEdit->setText("none"); + + // reset upper boundary lineEdit + fUpper_lineEdit->setText("none"); + + fName_lineEdit->setFocus(); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PGetParameterBlockDialog::helpContent() +{ + QMessageBox::information(this, "**INFO**", "Will eventually show a help window"); +} + +//---------------------------------------------------------------------------------------------------- +// END +//---------------------------------------------------------------------------------------------------- diff --git a/src/musredit/PGetParameterBlockDialog.h b/src/musredit/PGetParameterBlockDialog.h new file mode 100644 index 00000000..9eb6390c --- /dev/null +++ b/src/musredit/PGetParameterBlockDialog.h @@ -0,0 +1,54 @@ +/**************************************************************************** + + PGetParameterBlockDialog.h + + Author: Andreas Suter + e-mail: andreas.suter@psi.ch + + $Id: PGetParameterBlockDialog.h 3864 2009-04-20 06:50:06Z nemu $ + +*****************************************************************************/ + +/*************************************************************************** + * Copyright (C) 2009 by Andreas Suter * + * andreas.suter@psi.ch * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef _PGETPARAMETERBLOCKDIALOG_H_ +#define _PGETPARAMETERBLOCKDIALOG_H_ + +#include "ui_PGetParameterBlockDialog.h" + +class PGetParameterBlockDialog : public QDialog, private Ui::PGetParameterBlockDialog +{ + Q_OBJECT + + public: + PGetParameterBlockDialog(); + + QString getParams() { return fParam_plainTextEdit->toPlainText(); } + + protected: + bool eventFilter( QObject *obj, QEvent *ev ); + + private slots: + void paramAdd(); + void helpContent(); +}; + +#endif // _PGETPARAMETERBLOCKDIALOG_H_ diff --git a/src/musredit/PGetPlotBlockDialog.cpp b/src/musredit/PGetPlotBlockDialog.cpp new file mode 100644 index 00000000..b5a18bfc --- /dev/null +++ b/src/musredit/PGetPlotBlockDialog.cpp @@ -0,0 +1,187 @@ +/**************************************************************************** + + PGetPlotBlockDialog.cpp + + Author: Andreas Suter + e-mail: andreas.suter@psi.ch + + $Id: PGetPlotBlockDialog.cpp 3930 2009-05-20 12:51:17Z nemu $ + +*****************************************************************************/ + +/*************************************************************************** + * Copyright (C) 2009 by Andreas Suter * + * andreas.suter@psi.ch * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include +#include +#include +#include +#include +#include + +#include "PGetPlotBlockDialog.h" + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +PGetPlotBlockDialog::PGetPlotBlockDialog() +{ + setupUi(this); + + setModal(true); + + // setup event filter + installEventFilter(this); + + fXRangeLow_lineEdit->setValidator( new QDoubleValidator(fXRangeLow_lineEdit) ); + fXRangeUp_lineEdit->setValidator( new QDoubleValidator(fXRangeUp_lineEdit) ); + fYRangeLow_lineEdit->setValidator( new QDoubleValidator(fYRangeLow_lineEdit) ); + fYRangeUp_lineEdit->setValidator( new QDoubleValidator(fYRangeUp_lineEdit) ); + + fPlot_plainTextEdit->setFont(QFont("Courier", 10)); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PGetPlotBlockDialog::addPlot() +{ + QString param = ""; + QString str = ""; + QString spaces; + + // add begining of plot block if fPlot_plainTextEdit is still empty + if (fPlot_plainTextEdit->toPlainText().isEmpty()) { + param = "###############################################################\n"; + } + + // write type + param += "PLOT "; + if (fType_comboBox->currentText() == "Single Histo") { + param += "0 (single histo plot)\n"; + } else if (fType_comboBox->currentText() == "Asymmetry") { + param += "2 (asymmetry plot)\n"; + } else if (fType_comboBox->currentText() == "MuMinus") { + param += "4 (mu minus plot)\n"; + } else if (fType_comboBox->currentText() == "NonMusr") { + param += "8 (non muSR plot)\n"; + } + + // write runs + param += "runs " + fRunList_lineEdit->text() + "\n"; + + // write range + param += "range "; + // lower x-/time range + str = fXRangeLow_lineEdit->text(); + if (str.isEmpty()) { + QMessageBox::critical(this, "**ERROR**", + "empty lower time-/x-range name not allowed!", + QMessageBox::Ok, QMessageBox::NoButton); + return; + } + param += str; + if (str.length() < 8) + param += spaces.fill(' ', 8 - str.length()); + else + param += " "; + + // upper x-/time range + str = fXRangeUp_lineEdit->text(); + if (str.isEmpty()) { + QMessageBox::critical(this, "**ERROR**", + "empty upper time-/x-range name not allowed!", + QMessageBox::Ok, QMessageBox::NoButton); + return; + } + param += str; + if (str.length() < 8) + param += spaces.fill(' ', 8 - str.length()); + else + param += " "; + + // check y-range: either none given or both + if ((fYRangeLow_lineEdit->text().isEmpty() && !fYRangeUp_lineEdit->text().isEmpty()) || + (!fYRangeLow_lineEdit->text().isEmpty() && fYRangeUp_lineEdit->text().isEmpty())) { + QMessageBox::critical(this, "**ERROR**", + "Only fully empty y-range, or give lower AND upper y-range is acceptable!\n Will ignore the y-range", + QMessageBox::Ok, QMessageBox::NoButton); + } else if (!fYRangeLow_lineEdit->text().isEmpty() && !fYRangeUp_lineEdit->text().isEmpty()) { + str = fYRangeLow_lineEdit->text(); + param += str; + if (str.length() < 8) + param += spaces.fill(' ', 8 - str.length()); + else + param += " "; + param += fYRangeUp_lineEdit->text() + "\n"; + } else { + param += "\n"; + } + param += "\n"; + + fPlot_plainTextEdit->appendPlainText(param); + + // clean input + fRunList_lineEdit->clear(); + fXRangeLow_lineEdit->clear(); + fXRangeUp_lineEdit->clear(); + fYRangeLow_lineEdit->clear(); + fYRangeUp_lineEdit->clear(); + fRunList_lineEdit->setFocus(); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PGetPlotBlockDialog::helpContent() +{ + QMessageBox::information(this, "helpContents", + "Will eventually show a help", QMessageBox::Ok); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

This event filter is filtering out the return key, and if present adds the current plot. + */ +bool PGetPlotBlockDialog::eventFilter( QObject *obj, QEvent *ev ) +{ + if (obj == this) { + if (ev->type() == QEvent::KeyPress) { + QKeyEvent *k = (QKeyEvent*)ev; + if (k->key() == Qt::Key_Return) { + addPlot(); + return true; + } else { + return false; + } + } else { + return false; + } + } else { + return false; + } +} + +//---------------------------------------------------------------------------------------------------- +// END +//---------------------------------------------------------------------------------------------------- diff --git a/src/musredit/PGetPlotBlockDialog.h b/src/musredit/PGetPlotBlockDialog.h new file mode 100644 index 00000000..c773a6db --- /dev/null +++ b/src/musredit/PGetPlotBlockDialog.h @@ -0,0 +1,54 @@ +/**************************************************************************** + + PGetPlotBlockDialog.h + + Author: Andreas Suter + e-mail: andreas.suter@psi.ch + + $Id$ + +*****************************************************************************/ + +/*************************************************************************** + * Copyright (C) 2009 by Andreas Suter * + * andreas.suter@psi.ch * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef _PGETPLOTBLOCKDIALOG_H_ +#define _PGETPLOTBLOCKDIALOG_H_ + +#include "ui_PGetPlotBlockDialog.h" + +class PGetPlotBlockDialog : public QDialog, private Ui::PGetPlotBlockDialog +{ + Q_OBJECT + + public: + PGetPlotBlockDialog(); + + QString getPlotBlock() { return fPlot_plainTextEdit->toPlainText(); } + + public slots: + void addPlot(); + void helpContent(); + + protected: + bool eventFilter( QObject *obj, QEvent *ev ); +}; + +#endif // _PGETPLOTBLOCKDIALOG_H_ diff --git a/src/musredit/PGetSingleHistoRunBlockDialog.cpp b/src/musredit/PGetSingleHistoRunBlockDialog.cpp new file mode 100644 index 00000000..a5adaa27 --- /dev/null +++ b/src/musredit/PGetSingleHistoRunBlockDialog.cpp @@ -0,0 +1,271 @@ +/**************************************************************************** + + PGetSingleHistoRunBlockDialog.cpp + + Author: Andreas Suter + e-mail: andreas.suter@psi.ch + + $Id: PGetSingleHistoRunBlockDialog.cpp 3788 2009-03-19 07:58:16Z nemu $ + +*****************************************************************************/ + +/*************************************************************************** + * Copyright (C) 2009 by Andreas Suter * + * andreas.suter@psi.ch * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include +#include +#include +#include +#include + +#include "PGetSingleHistoRunBlockDialog.h" + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +PGetSingleHistoRunBlockDialog::PGetSingleHistoRunBlockDialog(const QString help, + const bool lifetimeCorrection, + QWidget * parent, + Qt::WindowFlags f) : + QDialog(parent, f), + fHelp(help) +{ + setupUi(this); + + setModal(true); + + fForwardHistoNo_lineEdit->setValidator( new QIntValidator(fForwardHistoNo_lineEdit) ); + fNorm_lineEdit->setValidator( new QIntValidator(fNorm_lineEdit) ); + fDataStart_lineEdit->setValidator( new QIntValidator(fDataStart_lineEdit) ); + fDataEnd_lineEdit->setValidator( new QIntValidator(fDataEnd_lineEdit) ); + fBackgroundFix_lineEdit->setValidator( new QDoubleValidator(fBackgroundFix_lineEdit) ); + fBackgroundFit_lineEdit->setValidator( new QIntValidator(fBackgroundFit_lineEdit) ); + fBackgroundStart_lineEdit->setValidator( new QIntValidator(fBackgroundStart_lineEdit) ); + fBackgroundEnd_lineEdit->setValidator( new QIntValidator(fBackgroundEnd_lineEdit) ); + fFitRangeStart_lineEdit->setValidator( new QDoubleValidator(fFitRangeStart_lineEdit) ); + fFitRangeEnd_lineEdit->setValidator( new QDoubleValidator(fFitRangeEnd_lineEdit) ); + fPacking_lineEdit->setValidator( new QIntValidator(fPacking_lineEdit) ); + fT0_lineEdit->setValidator( new QIntValidator(fT0_lineEdit) ); + fLifetime_lineEdit->setValidator( new QIntValidator(fLifetime_lineEdit) ); + fLifetimeCorrection_checkBox->setChecked(lifetimeCorrection); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +QString PGetSingleHistoRunBlockDialog::getRunHeaderInfo() +{ + QString str=""; + + str = "RUN " + fRunFileName_lineEdit->text() + " "; + str += fBeamline_lineEdit->text().toUpper() + " "; + str += fInstitute_comboBox->currentText() + " "; + str += fFileFormat_comboBox->currentText() + " (name beamline institute data-file-format)\n"; + + return str; +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +QString PGetSingleHistoRunBlockDialog::getMap(bool &valid) +{ + QString str = fMap_lineEdit->text().trimmed().remove(" "); + + // check if potentially proper map line + for (int i=0; itext() + "\n"; + + return str; +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +QString PGetSingleHistoRunBlockDialog::getData(bool &valid) +{ + QString str=""; + + if (fDataStart_lineEdit->text().isEmpty() || fDataEnd_lineEdit->text().isEmpty()) { + valid = false; + } else { + str = "data "; + str += fDataStart_lineEdit->text() + " "; + str += fDataEnd_lineEdit->text() + "\n"; + valid = true; + } + + return str; +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +QString PGetSingleHistoRunBlockDialog::getBackground(bool &valid) +{ + QString str=""; + + valid = true; + + // check that either backgr.fix or background is given, but not both + if (fBackgroundStart_lineEdit->text().isEmpty() && fBackgroundEnd_lineEdit->text().isEmpty() && + fBackgroundFix_lineEdit->text().isEmpty() && + fBackgroundFit_lineEdit->text().isEmpty()) { + valid = false; + str = "background 0 10\n"; + } else { + if (!fBackgroundStart_lineEdit->text().isEmpty()) { // assume the rest is given, not fool prove but ... + str = "background "; + str += fBackgroundStart_lineEdit->text() + " "; + str += fBackgroundEnd_lineEdit->text() + "\n"; + } + if (!fBackgroundFix_lineEdit->text().isEmpty()) { + str = "backgr.fix "; + str += fBackgroundFix_lineEdit->text() + "\n"; + } + if (!fBackgroundFit_lineEdit->text().isEmpty()) { + str = "backgr.fit "; + str += fBackgroundFit_lineEdit->text() + "\n"; + } + } + + return str; +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +QString PGetSingleHistoRunBlockDialog::getFitRange(bool &valid) +{ + QString str=""; + + if (fFitRangeStart_lineEdit->text().isEmpty() || fFitRangeEnd_lineEdit->text().isEmpty()) { + str += "fit 0.0 10.0\n"; + valid = false; + } else { + str += "fit "; + str += fFitRangeStart_lineEdit->text() + " "; + str += fFitRangeEnd_lineEdit->text() + "\n"; + valid = true; + } + + return str; +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +QString PGetSingleHistoRunBlockDialog::getPacking(bool &present) +{ + QString str=""; + + if (fPacking_lineEdit->text().isEmpty()) { + present = false; + str += "packing 1\n"; + } else { + present = true; + str += "packing " + fPacking_lineEdit->text() + "\n\n"; + } + + return str; +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +QString PGetSingleHistoRunBlockDialog::getT0(bool &present) +{ + QString str=""; + + if (!fT0_lineEdit->text().isEmpty()) { + str = "t0 "; + str += fT0_lineEdit->text() + "\n"; + present = true; + } else { + present = false; + } + + return str; +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +QString PGetSingleHistoRunBlockDialog::getMuonLifetimeParam(bool &present) +{ + QString str=""; + + if (!fLifetime_lineEdit->text().isEmpty()) { + str = "lifetime "; + str += fLifetime_lineEdit->text() + "\n"; + present = true; + } else { + present = false; + } + + return str; +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +QString PGetSingleHistoRunBlockDialog::getLifetimeCorrection(bool &present) +{ + QString str=""; + + if (fLifetimeCorrection_checkBox->isChecked()) { + str = "lifetimecorrection\n"; + present = true; + } else { + present = false; + } + + return str; +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PGetSingleHistoRunBlockDialog::helpContent() +{ + QMessageBox::information(this, "helpContents", + fHelp, QMessageBox::Ok); +} + +//---------------------------------------------------------------------------------------------------- +// END +//---------------------------------------------------------------------------------------------------- diff --git a/src/musredit/PGetSingleHistoRunBlockDialog.h b/src/musredit/PGetSingleHistoRunBlockDialog.h new file mode 100644 index 00000000..11b4e32a --- /dev/null +++ b/src/musredit/PGetSingleHistoRunBlockDialog.h @@ -0,0 +1,67 @@ +/**************************************************************************** + + PGetSingleHistoRunBlockDialog.h + + Author: Andreas Suter + e-mail: andreas.suter@psi.ch + + $Id: PGetSingleHistoRunBlockDialog.h 3788 2009-03-19 07:58:16Z nemu $ + +*****************************************************************************/ + +/*************************************************************************** + * Copyright (C) 2009 by Andreas Suter * + * andreas.suter@psi.ch * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef _PGETSINGLEHISTORUNBLOCKDIALOG_H_ +#define _PGETSINGLEHISTORUNBLOCKDIALOG_H_ + +#include +#include + +#include "ui_PGetSingleHistoRunBlockDialog.h" + +class PGetSingleHistoRunBlockDialog : public QDialog, private Ui::PGetSingleHistoRunBlockDialog +{ + Q_OBJECT + + public: + PGetSingleHistoRunBlockDialog(const QString help = "", const bool lifetimeCorrection = true, + QWidget * parent = 0, Qt::WindowFlags f = 0); + + QString getRunHeaderInfo(); + QString getMap(bool &valid); + QString getForward() { return QString("forward " + fForwardHistoNo_lineEdit->text() + "\n"); } + QString getNorm() { return QString("norm " + fNorm_lineEdit->text() + "\n"); } + QString getData(bool &valid); + QString getBackground(bool &valid); + QString getFitRange(bool &valid); + QString getPacking(bool &present); + QString getT0(bool &present); + QString getMuonLifetimeParam(bool &present); + QString getLifetimeCorrection(bool &present); + + private slots: + void helpContent(); + + private: + QString fHelp; +}; + +#endif // _PGETSINGLEHISTORUNBLOCKDIALOG_H_ diff --git a/src/musredit/PGetTheoryBlockDialog.cpp b/src/musredit/PGetTheoryBlockDialog.cpp new file mode 100644 index 00000000..4e5c7078 --- /dev/null +++ b/src/musredit/PGetTheoryBlockDialog.cpp @@ -0,0 +1,129 @@ +/**************************************************************************** + + PGetTheoryBlockDialog.cpp + + Author: Andreas Suter + e-mail: andreas.suter@psi.ch + + $Id: PGetTheoryBlockDialog.cpp 3802 2009-03-23 08:29:57Z nemu $ + +*****************************************************************************/ + +/*************************************************************************** + * Copyright (C) 2009 by Andreas Suter * + * andreas.suter@psi.ch * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include +#include +#include +#include +#include + +#include + +#include "PGetTheoryBlockDialog.h" + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +PGetTheoryBlockDialog::PGetTheoryBlockDialog(PAdmin *admin, QWidget * parent, Qt::WindowFlags f) : + QDialog(parent, f), + fAdmin(admin) +{ + setupUi(this); + + setModal(true); + + // feed theory function combo box + PTheory *theoItem; + QIcon icon; + QString iconName; + for (unsigned int i=0; igetTheoryCounts(); i++) { + theoItem = fAdmin->getTheoryItem(i); + if (theoItem->pixmapName.length() > 0) { + iconName = QString(":/latex_images/") + theoItem->pixmapName; + icon.addPixmap(QPixmap(iconName)); + fTheoryFunction_comboBox->insertItem(i, icon, theoItem->label); + } else { + fTheoryFunction_comboBox->insertItem(i, theoItem->label); + } + } +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +QString PGetTheoryBlockDialog::getTheoFuncString() +{ + QString str = "????"; + int idx = fTheoryFunction_comboBox->currentIndex(); + PTheory *theoItem = fAdmin->getTheoryItem(idx); + if (theoItem == 0) + return str; + + // add theory function name + str = theoItem->name + " "; + if (theoItem->name == "userFcn") { + str += "libMyLibrary.so TMyFunction "; + } + // add pseudo parameters + for (int i=0; iparams; i++) { + str += QString("%1").arg(i+1) + " "; + } + // add comment + str += theoItem->comment; + + return str; +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PGetTheoryBlockDialog::addPlus() +{ + QString str = getTheoFuncString() + "\n+"; + fTheoryBlock_plainTextEdit->appendPlainText(str); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PGetTheoryBlockDialog::addMultiply() +{ + QString str = getTheoFuncString(); + fTheoryBlock_plainTextEdit->appendPlainText(str); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PGetTheoryBlockDialog::helpContent() +{ + QMessageBox::information(this, "helpContents", + fAdmin->getHelpMain(), QMessageBox::Ok); +} + +//---------------------------------------------------------------------------------------------------- +// END +//---------------------------------------------------------------------------------------------------- diff --git a/src/musredit/PGetTheoryBlockDialog.h b/src/musredit/PGetTheoryBlockDialog.h new file mode 100644 index 00000000..fbbf461a --- /dev/null +++ b/src/musredit/PGetTheoryBlockDialog.h @@ -0,0 +1,57 @@ +/**************************************************************************** + + PGetTheoryBlockDialog.h + + Author: Andreas Suter + e-mail: andreas.suter@psi.ch + + $Id: PGetTheoryBlockDialog.h 3799 2009-03-22 15:52:11Z nemu $ + +*****************************************************************************/ + +/*************************************************************************** + * Copyright (C) 2009 by Andreas Suter * + * andreas.suter@psi.ch * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef _PGETTHEORYBLOCKDIALOG_H_ +#define _PGETTHEORYBLOCKDIALOG_H_ + +#include "PAdmin.h" +#include "ui_PGetTheoryBlockDialog.h" + +class PGetTheoryBlockDialog : public QDialog, private Ui::PGetTheoryBlockDialog +{ + Q_OBJECT + + public: + PGetTheoryBlockDialog(PAdmin *admin = 0, QWidget * parent = 0, Qt::WindowFlags f = 0); + + QString getTheoryBlock() { return fTheoryBlock_plainTextEdit->toPlainText(); } + + private slots: + QString getTheoFuncString(); + void addPlus(); + void addMultiply(); + void helpContent(); + + private: + PAdmin *fAdmin; +}; + +#endif // _PGETTHEORYBLOCKDIALOG_H_ diff --git a/src/musredit/PGetTitleBlockDialog.cpp b/src/musredit/PGetTitleBlockDialog.cpp new file mode 100644 index 00000000..5515d0fe --- /dev/null +++ b/src/musredit/PGetTitleBlockDialog.cpp @@ -0,0 +1,58 @@ +/**************************************************************************** + + PGetTitleBlockDialog.cpp + + Author: Andreas Suter + e-mail: andreas.suter@psi.ch + + $Id$ + +*****************************************************************************/ + +/*************************************************************************** + * Copyright (C) 2010 by Andreas Suter * + * andreas.suter@psi.ch * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include + +#include "PGetTitleBlockDialog.h" + +//--------------------------------------------------------------------------- +/** + *

+ */ +PGetTitleBlockDialog::PGetTitleBlockDialog(QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f) +{ + setupUi(this); + + setModal(true); +} + +//--------------------------------------------------------------------------- +/** + *

+ */ +void PGetTitleBlockDialog::helpContent() +{ + QMessageBox::information(this, "**INFO**", "Will eventually show a help window"); +} + +//--------------------------------------------------------------------------- +// END +//--------------------------------------------------------------------------- diff --git a/src/musredit/PGetTitleBlockDialog.h b/src/musredit/PGetTitleBlockDialog.h new file mode 100644 index 00000000..f3f6c199 --- /dev/null +++ b/src/musredit/PGetTitleBlockDialog.h @@ -0,0 +1,53 @@ +/**************************************************************************** + + PGetTitleBlockDialog.h + + Author: Andreas Suter + e-mail: andreas.suter@psi.ch + + $Id$ + +*****************************************************************************/ + +/*************************************************************************** + * Copyright (C) 2010 by Andreas Suter * + * andreas.suter@psi.ch * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef _PGETTITLEBLOCKDIALOG_H_ +#define _PGETTITLEBLOCKDIALOG_H_ + +#include "musredit.h" +#include "ui_PGetTitleBlockDialog.h" + +class PGetTitleBlockDialog : public QDialog, private Ui::PGetTitleBlockDialog +{ + Q_OBJECT + + public: + PGetTitleBlockDialog(QWidget *parent = 0, Qt::WindowFlags f = 0); + virtual ~PGetTitleBlockDialog() {} + + QString getTitle() { return fTitle_lineEdit->text(); } + + private slots: + void helpContent(); + +}; + +#endif // _PGETTITLEBLOCKDIALOG_H_ diff --git a/src/musredit/PMsr2DataDialog.cpp b/src/musredit/PMsr2DataDialog.cpp new file mode 100644 index 00000000..406bb085 --- /dev/null +++ b/src/musredit/PMsr2DataDialog.cpp @@ -0,0 +1,251 @@ +/**************************************************************************** + + PMsr2DataDialog.cpp + + Author: Andreas Suter + e-mail: andreas.suter@psi.ch + + $Id: PMsr2DataDialog.cpp 4328 2010-01-06 06:27:10Z nemu $ + +*****************************************************************************/ + +/*************************************************************************** + * Copyright (C) 2009 by Andreas Suter * + * andreas.suter@psi.ch * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include +#include +#include +#include +#include + +#include "PMsr2DataDialog.h" + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +PMsr2DataDialog::PMsr2DataDialog(PMsr2DataParam *msr2DataParam) : fMsr2DataParam(msr2DataParam) +{ + setupUi(this); + + setModal(true); + + QString str; + + fRunTag = -1; + + fFirst_lineEdit->setValidator( new QIntValidator(fFirst_lineEdit) ); + if (fMsr2DataParam->firstRun != -1) { + str = QString("%1").arg(fMsr2DataParam->firstRun); + fFirst_lineEdit->setText(str); + } + + fLast_lineEdit->setValidator( new QIntValidator(fLast_lineEdit) ); + if (fMsr2DataParam->lastRun != -1) { + str = QString("%1").arg(fMsr2DataParam->lastRun); + fLast_lineEdit->setText(str); + } + + if (!fMsr2DataParam->runListFileName.isEmpty()) { + fRunListFileName_lineEdit->setText(fMsr2DataParam->runListFileName); + } + + if (!fMsr2DataParam->runList.isEmpty()) { + fRunList_lineEdit->setText(fMsr2DataParam->runList); + } + + if (!fMsr2DataParam->msrFileExtension.isEmpty()) { + fMsrFileExtension_lineEdit->setText(fMsr2DataParam->msrFileExtension); + } + + fTemplateRunNumber_lineEdit->setValidator( new QIntValidator(fTemplateRunNumber_lineEdit) ); + if (fMsr2DataParam->templateRunNo != -1) { + str = QString("%1").arg(fMsr2DataParam->templateRunNo); + fTemplateRunNumber_lineEdit->setText(str); + } + + if (!fMsr2DataParam->dbOutputFileName.isEmpty()) { + fDataOutputFileName_lineEdit->setText(fMsr2DataParam->dbOutputFileName); + } + + fWriteDataHeader_checkBox->setChecked(fMsr2DataParam->writeDbHeader); + fSummaryPresent_checkBox->setChecked(fMsr2DataParam->summaryFilePresent); + fKeepMinuit2Output_checkBox->setChecked(fMsr2DataParam->keepMinuit2Output); + fWriteColumnData_checkBox->setChecked(fMsr2DataParam->writeColumnData); + fRecreateDataFile_checkBox->setChecked(fMsr2DataParam->recreateDbFile); + fChainFit_checkBox->setChecked(fMsr2DataParam->chainFit); + fOpenFilesAfterFitting_checkBox->setChecked(fMsr2DataParam->openFilesAfterFitting); + fTitleFromData_checkBox->setChecked(fMsr2DataParam->titleFromDataFile); + fCreateMsrFileOnly_checkBox->setChecked(fMsr2DataParam->createMsrFileOnly); + fFitOnly_checkBox->setChecked(fMsr2DataParam->fitOnly); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +PMsr2DataParam* PMsr2DataDialog::getMsr2DataParam() +{ + if (fFirst_lineEdit->text().isEmpty()) { + fMsr2DataParam->firstRun = -1; + } else { + fMsr2DataParam->firstRun = fFirst_lineEdit->text().toInt(); + } + if (fLast_lineEdit->text().isEmpty()) { + fMsr2DataParam->lastRun = -1; + } else { + fMsr2DataParam->lastRun = fLast_lineEdit->text().toInt(); + } + fMsr2DataParam->runList = fRunList_lineEdit->text(); + fMsr2DataParam->runListFileName = fRunListFileName_lineEdit->text(); + fMsr2DataParam->msrFileExtension = fMsrFileExtension_lineEdit->text(); + if (fTemplateRunNumber_lineEdit->text().isEmpty()) { + fMsr2DataParam->templateRunNo = -1; + } else { + fMsr2DataParam->templateRunNo = fTemplateRunNumber_lineEdit->text().toInt(); + } + fMsr2DataParam->dbOutputFileName = fDataOutputFileName_lineEdit->text(); + fMsr2DataParam->writeDbHeader = fWriteDataHeader_checkBox->isChecked(); + fMsr2DataParam->summaryFilePresent = fSummaryPresent_checkBox->isChecked(); + fMsr2DataParam->keepMinuit2Output = fKeepMinuit2Output_checkBox->isChecked(); + fMsr2DataParam->writeColumnData = fWriteColumnData_checkBox->isChecked(); + fMsr2DataParam->recreateDbFile = fRecreateDataFile_checkBox->isChecked(); + fMsr2DataParam->chainFit = fChainFit_checkBox->isChecked(); + fMsr2DataParam->openFilesAfterFitting = fOpenFilesAfterFitting_checkBox->isChecked(); + fMsr2DataParam->titleFromDataFile = fTitleFromData_checkBox->isChecked(); + fMsr2DataParam->createMsrFileOnly = fCreateMsrFileOnly_checkBox->isChecked(); + fMsr2DataParam->fitOnly = fFitOnly_checkBox->isChecked(); + + return fMsr2DataParam; +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PMsr2DataDialog::runFirstEntered(const QString &str) +{ + + if (str.length() == 0) + return; + + fRunTag = 0; + + if (!fRunList_lineEdit->text().isEmpty()) + fRunList_lineEdit->clear(); + if (!fRunListFileName_lineEdit->text().isEmpty()) + fRunListFileName_lineEdit->clear(); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PMsr2DataDialog::runLastEntered(const QString &str) +{ + if (str.length() == 0) + return; + + fRunTag = 0; + + if (!fRunList_lineEdit->text().isEmpty()) + fRunList_lineEdit->clear(); + if (!fRunListFileName_lineEdit->text().isEmpty()) + fRunListFileName_lineEdit->clear(); + + if (fLast_lineEdit->text().length() == 1) + fLast_lineEdit->update(); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PMsr2DataDialog::runListEntered(const QString &str) +{ + if (str.length() == 0) + return; + + fRunTag = 1; + + if (!fFirst_lineEdit->text().isEmpty()) + fFirst_lineEdit->clear(); + if (!fLast_lineEdit->text().isEmpty()) + fLast_lineEdit->clear(); + if (!fRunListFileName_lineEdit->text().isEmpty()) + fRunListFileName_lineEdit->clear(); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PMsr2DataDialog::runListFileNameEntered(const QString &str) +{ + if (str.length() == 0) + return; + + fRunTag = 2; + + if (!fFirst_lineEdit->text().isEmpty()) + fFirst_lineEdit->clear(); + if (!fLast_lineEdit->text().isEmpty()) + fLast_lineEdit->clear(); + if (!fRunList_lineEdit->text().isEmpty()) + fRunList_lineEdit->clear(); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PMsr2DataDialog::templateRunEntered(const QString &str) +{ + if (!str.isEmpty()) + fFitOnly_checkBox->setChecked(false); + fTemplateRunNumber_lineEdit->setText(str); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PMsr2DataDialog::createMsrFileOnlyChanged(int buttonState) +{ + if (buttonState == Qt::Checked) { + fFitOnly_checkBox->setChecked(false); + } +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PMsr2DataDialog::fitOnlyChanged(int buttonState) +{ + if (buttonState == Qt::Checked) { + fCreateMsrFileOnly_checkBox->setChecked(false); + fTemplateRunNumber_lineEdit->clear(); + } +} + +//---------------------------------------------------------------------------------------------------- +// END +//---------------------------------------------------------------------------------------------------- diff --git a/src/musredit/PMsr2DataDialog.h b/src/musredit/PMsr2DataDialog.h new file mode 100644 index 00000000..cc19b69d --- /dev/null +++ b/src/musredit/PMsr2DataDialog.h @@ -0,0 +1,65 @@ +/**************************************************************************** + + PMsr2DataDialog.h + + Author: Andreas Suter + e-mail: andreas.suter@psi.ch + + $Id$ + +*****************************************************************************/ + +/*************************************************************************** + * Copyright (C) 2010 by Andreas Suter * + * andreas.suter@psi.ch * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef _PMSR2DATADIALOG_H_ +#define _PMSR2DATADIALOG_H_ + +#include +#include + +#include "musredit.h" +#include "ui_PMsr2DataDialog.h" + +class PMsr2DataDialog : public QDialog, private Ui::PMsr2DataDialog +{ + Q_OBJECT + + public: + PMsr2DataDialog(PMsr2DataParam *msr2DataParam); + + virtual int getRunTag() { return fRunTag; } + virtual PMsr2DataParam* getMsr2DataParam(); + + public slots: + void runFirstEntered(const QString&); + void runLastEntered(const QString&); + void runListEntered(const QString&); + void runListFileNameEntered(const QString&); + void templateRunEntered(const QString&); + void createMsrFileOnlyChanged(int); + void fitOnlyChanged(int); + + private: + int fRunTag; // -1 = not valid, 0 = first last, 1 = run list, 2 = run list file name + PMsr2DataParam *fMsr2DataParam; +}; + +#endif // _PMSR2DATADIALOG_H_ diff --git a/src/musredit/PMusrEditAbout.cpp b/src/musredit/PMusrEditAbout.cpp new file mode 100644 index 00000000..d7b8fbdf --- /dev/null +++ b/src/musredit/PMusrEditAbout.cpp @@ -0,0 +1,47 @@ +/**************************************************************************** + + PMusrEditAbout.cpp + + Author: Andreas Suter + e-mail: andreas.suter@psi.ch + + $Id$ + +*****************************************************************************/ + +/*************************************************************************** + * Copyright (C) 2010 by Andreas Suter * + * andreas.suter@psi.ch * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include "PMusrEditAbout.h" + +//--------------------------------------------------------------------------- +/** + *

+ */ +PMusrEditAbout::PMusrEditAbout(QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f) +{ + setupUi(this); + + setModal(true); +} + +//--------------------------------------------------------------------------- +// END +//--------------------------------------------------------------------------- diff --git a/src/musredit/PMusrEditAbout.h b/src/musredit/PMusrEditAbout.h new file mode 100644 index 00000000..2ab26db3 --- /dev/null +++ b/src/musredit/PMusrEditAbout.h @@ -0,0 +1,48 @@ +/**************************************************************************** + + PMusrEditAbout.h + + Author: Andreas Suter + e-mail: andreas.suter@psi.ch + + $Id$ + +*****************************************************************************/ + +/*************************************************************************** + * Copyright (C) 2010 by Andreas Suter * + * andreas.suter@psi.ch * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef _PMUSREDITABOUT_H_ +#define _PMUSREDITABOUT_H_ + +#include "musredit.h" +#include "ui_PMusrEditAbout.h" + +class PMusrEditAbout : public QDialog, private Ui::PMusrEditAbout +{ + Q_OBJECT + + public: + PMusrEditAbout(QWidget *parent = 0, Qt::WindowFlags f = 0); + virtual ~PMusrEditAbout() {} + +}; + +#endif // _PMUSREDITABOUT_H_ diff --git a/src/musredit/PPrefsDialog.cpp b/src/musredit/PPrefsDialog.cpp new file mode 100644 index 00000000..135bbaca --- /dev/null +++ b/src/musredit/PPrefsDialog.cpp @@ -0,0 +1,103 @@ +/**************************************************************************** + + PPrefsDialog.cpp + + Author: Andreas Suter + e-mail: andreas.suter@psi.ch + + $Id: PPrefsDialog.cpp 4032 2009-06-26 05:31:33Z nemu $ + +*****************************************************************************/ + +/*************************************************************************** + * Copyright (C) 2009 by Andreas Suter * + * andreas.suter@psi.ch * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include "PPrefsDialog.h" + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +PPrefsDialog::PPrefsDialog(const bool keep_mn2_output, const int dump_tag, const bool title_from_data_file, + const bool enable_musrt0) +{ + setupUi(this); + + setModal(true); + + if (keep_mn2_output) + fKeepMn2Output_checkBox->setChecked(true); + else + fKeepMn2Output_checkBox->setChecked(false); + + if (dump_tag == 1) { + fDumpAscii_checkBox->setChecked(true); + fDumpRoot_checkBox->setChecked(false); + } else if (dump_tag == 2) { + fDumpAscii_checkBox->setChecked(false); + fDumpRoot_checkBox->setChecked(true); + } else { + fDumpAscii_checkBox->setChecked(false); + fDumpRoot_checkBox->setChecked(false); + } + + fTitleFromData_checkBox->setChecked(title_from_data_file); + fEnableMusrT0_checkBox->setChecked(enable_musrt0); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +int PPrefsDialog::getDump() +{ + int result = 0; + + if (fDumpAscii_checkBox->isChecked()) + result = 1; + else if (fDumpRoot_checkBox->isChecked()) + result = 2; + + return result; +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PPrefsDialog::dumpAscii() +{ + if (fDumpAscii_checkBox->isChecked()) + fDumpRoot_checkBox->setChecked(false); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PPrefsDialog::dumpRoot() +{ + if (fDumpRoot_checkBox->isChecked()) + fDumpAscii_checkBox->setChecked(false); +} + +//---------------------------------------------------------------------------------------------------- +// END +//---------------------------------------------------------------------------------------------------- diff --git a/src/musredit/PPrefsDialog.h b/src/musredit/PPrefsDialog.h new file mode 100644 index 00000000..36ecd79f --- /dev/null +++ b/src/musredit/PPrefsDialog.h @@ -0,0 +1,57 @@ +/**************************************************************************** + + PPrefsDialog.h + + Author: Andreas Suter + e-mail: andreas.suter@psi.ch + + $Id$ + +*****************************************************************************/ + +/*************************************************************************** + * Copyright (C) 2010 by Andreas Suter * + * andreas.suter@psi.ch * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef _PPREFSDIALOG_H_ +#define _PPREFSDIALOG_H_ + +#include + +#include "ui_PPrefsDialog.h" + +class PPrefsDialog : public QDialog, private Ui::PPrefsDialog +{ + Q_OBJECT + + public: + PPrefsDialog(const bool keep_mn2_output, const int dump_tag, const bool title_from_data_file, + const bool enable_musrt0); + + bool getKeepMinuit2OutputFlag() { return fKeepMn2Output_checkBox->isChecked(); } + bool getTitleFromDataFileFlag() { return fTitleFromData_checkBox->isChecked(); } + bool getEnableMusrT0Flag() { return fEnableMusrT0_checkBox->isChecked(); } + int getDump(); + + public slots: + void dumpAscii(); + void dumpRoot(); +}; + +#endif // _PPREFSDIALOG_H_ diff --git a/src/musredit/PReplaceConfirmationDialog.cpp b/src/musredit/PReplaceConfirmationDialog.cpp new file mode 100644 index 00000000..39353303 --- /dev/null +++ b/src/musredit/PReplaceConfirmationDialog.cpp @@ -0,0 +1,43 @@ +/**************************************************************************** + + PReplaceConfirmationDialog.cpp + + Author: Andreas Suter + e-mail: andreas.suter@psi.ch + + $Id$ + +*****************************************************************************/ + +/*************************************************************************** + * Copyright (C) 2010 by Andreas Suter * + * andreas.suter@psi.ch * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include "PReplaceConfirmationDialog.h" + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +PReplaceConfirmationDialog::PReplaceConfirmationDialog(QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f) +{ + setupUi(this); + + setModal(true); +} diff --git a/src/musredit/PReplaceConfirmationDialog.h b/src/musredit/PReplaceConfirmationDialog.h new file mode 100644 index 00000000..e6c0402f --- /dev/null +++ b/src/musredit/PReplaceConfirmationDialog.h @@ -0,0 +1,49 @@ +/**************************************************************************** + + PReplaceConfirmationDialog.h + + Author: Andreas Suter + e-mail: andreas.suter@psi.ch + + $Id$ + +*****************************************************************************/ + +/*************************************************************************** + * Copyright (C) 2010 by Andreas Suter * + * andreas.suter@psi.ch * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef _PREPLACECONFIRMATIONDIALOG_H_ +#define _PREPLACECONFIRMATIONDIALOG_H_ + +#include +#include + +#include "ui_PReplaceConfirmationDialog.h" + +class PReplaceConfirmationDialog : public QDialog, public Ui::PReplaceConfirmationDialog +{ + Q_OBJECT + + public: + PReplaceConfirmationDialog(QWidget *parent = 0, Qt::WindowFlags f = 0); + virtual ~PReplaceConfirmationDialog() {} +}; + +#endif // _PREPLACECONFIRMATIONDIALOG_H_ diff --git a/src/musredit/PReplaceDialog.cpp b/src/musredit/PReplaceDialog.cpp new file mode 100644 index 00000000..335795d4 --- /dev/null +++ b/src/musredit/PReplaceDialog.cpp @@ -0,0 +1,106 @@ +/**************************************************************************** + + PReplaceDialog.cpp + + Author: Andreas Suter + e-mail: andreas.suter@psi.ch + + $Id: PReplaceDialog.cpp 3918 2009-05-14 19:26:30Z nemu $ + +*****************************************************************************/ + +/*************************************************************************** + * Copyright (C) 2009 by Andreas Suter * + * andreas.suter@psi.ch * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include +#include +#include + +#include "PReplaceDialog.h" + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +PReplaceDialog::PReplaceDialog(PFindReplaceData *data, const bool selection, QWidget *parent, Qt::WindowFlags f) : + QDialog(parent, f), fData(data) +{ + setupUi(this); + + setModal(true); + + // if only empty text, disable find button + if (fData->findText == "") { + fReplace_pushButton->setEnabled(false); + } + + // if there is no selection, disable that option + if (!selection) { + fSelectedText_checkBox->setChecked(false); + fSelectedText_checkBox->setEnabled(false); + } + + fFind_comboBox->setItemText(0, fData->findText); + fReplacementText_comboBox->setItemText(0, fData->replaceText); + fCaseSensitive_checkBox->setChecked(fData->caseSensitive); + fWholeWordsOnly_checkBox->setChecked(fData->wholeWordsOnly); + fFromCursor_checkBox->setChecked(fData->fromCursor); + fFindBackwards_checkBox->setChecked(fData->findBackwards); + fPromptOnReplace_checkBox->setChecked(fData->promptOnReplace); + + if (selection) { + fSelectedText_checkBox->setChecked(fData->selectedText); + } +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +PFindReplaceData* PReplaceDialog::getData() +{ + fData->findText = fFind_comboBox->currentText(); + fData->replaceText = fReplacementText_comboBox->currentText(); + fData->caseSensitive = fCaseSensitive_checkBox->isChecked(); + fData->wholeWordsOnly = fWholeWordsOnly_checkBox->isChecked(); + fData->fromCursor = fFromCursor_checkBox->isChecked(); + fData->findBackwards = fFindBackwards_checkBox->isChecked(); + if (fSelectedText_checkBox->isEnabled()) + fData->selectedText = fSelectedText_checkBox->isChecked(); + fData->promptOnReplace = fPromptOnReplace_checkBox->isChecked(); + + return fData; +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PReplaceDialog::onFindTextAvailable(const QString&) +{ + if (fFind_comboBox->currentText() != "") + fReplace_pushButton->setEnabled(true); + else + fReplace_pushButton->setEnabled(false); +} + +//---------------------------------------------------------------------------------------------------- +// END +//---------------------------------------------------------------------------------------------------- diff --git a/src/musredit/PReplaceDialog.h b/src/musredit/PReplaceDialog.h new file mode 100644 index 00000000..feb94bf8 --- /dev/null +++ b/src/musredit/PReplaceDialog.h @@ -0,0 +1,55 @@ +/**************************************************************************** + + PReplaceDialog.h + + Author: Andreas Suter + e-mail: andreas.suter@psi.ch + + $Id$ + +*****************************************************************************/ + +/*************************************************************************** + * Copyright (C) 2010 by Andreas Suter * + * andreas.suter@psi.ch * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef _PREPLACEDIALOG_H_ +#define _PREPLACEDIALOG_H_ + +#include "musredit.h" +#include "ui_PReplaceDialog.h" + +class PReplaceDialog : public QDialog, private Ui::PReplaceDialog +{ + Q_OBJECT + + public: + PReplaceDialog(PFindReplaceData *data, const bool selection, QWidget *parent = 0, Qt::WindowFlags f = 0); + virtual ~PReplaceDialog() {} + + virtual PFindReplaceData *getData(); + + protected slots: + virtual void onFindTextAvailable(const QString&); + + private: + PFindReplaceData *fData; +}; + +#endif // _PREPLACEDIALOG_H_ diff --git a/src/musredit/PSubTextEdit.cpp b/src/musredit/PSubTextEdit.cpp new file mode 100644 index 00000000..8624aee7 --- /dev/null +++ b/src/musredit/PSubTextEdit.cpp @@ -0,0 +1,602 @@ +/**************************************************************************** + + PSubTextEdit.cpp + + Author: Andreas Suter + e-mail: andreas.suter@psi.ch + + $Id: PSubTextEdit.cpp 3936 2009-05-22 11:38:21Z nemu $ + +*****************************************************************************/ + +/*************************************************************************** + * Copyright (C) 2009 by Andreas Suter * + * andreas.suter@psi.ch * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "PAdmin.h" +#include "PSubTextEdit.h" +#include "PGetTitleBlockDialog.h" +#include "PGetParameterBlockDialog.h" +#include "PGetTheoryBlockDialog.h" +#include "PGetFunctionsBlockDialog.h" +#include "PGetAsymmetryRunBlockDialog.h" +#include "PGetSingleHistoRunBlockDialog.h" +#include "PGetNonMusrRunBlockDialog.h" +#include "PGetFourierBlockDialog.h" +#include "PGetPlotBlockDialog.h" + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +PSubTextEdit::PSubTextEdit(PAdmin *admin, QWidget *parent) : + QPlainTextEdit(parent), + fAdmin(admin) +{ +// fLastModified = QDateTime::fromString("1900-01-01 00:00:00"); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +QMenu* PSubTextEdit::createPopupMenu(const QPoint &pos) +{ + QMenu *menu = new QMenu( this ); + QMenu *theoryFunctions = new QMenu( menu ); + + QAction *a; + a = new QAction( tr("insert Title"), this); + a->setStatusTip( tr("insert a title") ); + connect(a, SIGNAL( activated() ), this, SLOT( insertTitle() )); + menu->addAction(a); + + a = new QAction(tr("insert Parameter Block"), this); + a->setStatusTip( tr("insert a parameter block") ); + connect(a, SIGNAL( activated() ), this, SLOT( insertParameterBlock() )); + menu->addAction(a); + + // feed the theoryFunctions popup menu + for (unsigned int i=0; igetTheoryCounts(); i++) { + PTheory *theoryItem = fAdmin->getTheoryItem(i); + a = new QAction( theoryItem->label, this); + theoryFunctions->addAction(a); + } + theoryFunctions->setTitle( tr("insert theory function") ); + menu->addMenu(theoryFunctions); + connect(theoryFunctions, SIGNAL( activated(int) ), this, SLOT( insertTheoryFunction(int) )); + + a = new QAction(tr("insert Theory Block"), this); + a->setStatusTip( tr("insert a theory block") ); + connect(a, SIGNAL( activated() ), this, SLOT( insertTheoryBlock() )); + menu->addAction(a); + + a = new QAction(tr("insert Function Block"), this); + a->setStatusTip( tr("insert a function block") ); + connect(a, SIGNAL( activated() ), this, SLOT( insertFunctionBlock() )); + menu->addAction(a); + + menu->addSeparator(); + + a = new QAction(tr("insert Asymmetry Run Block"), this); + a->setStatusTip( tr("insert an asymmetry run block") ); + connect(a, SIGNAL( activated() ), this, SLOT( insertAsymRunBlock() )); + menu->addAction(a); + + a = new QAction(tr("insert Single Histo Run Block"), this); + a->setStatusTip( tr("insert a single histo run block") ); + connect(a, SIGNAL( activated() ), this, SLOT( insertSingleHistRunBlock() )); + menu->addAction(a); + + a = new QAction(tr("insert NonMusr Block"), this); + a->setStatusTip( tr("insert a NonMusr run block") ); + connect(a, SIGNAL( activated() ), this, SLOT( insertNonMusrRunBlock() )); + menu->addAction(a); + + menu->addSeparator(); + + a = new QAction(tr("insert Command Block"), this); + a->setStatusTip( tr("insert a command block") ); + connect(a, SIGNAL( activated() ), this, SLOT( insertCommandBlock() )); + menu->addAction(a); + + a = new QAction(tr("insert Fourier Block"), this); + a->setStatusTip( tr("insert a Fourier block") ); + connect(a, SIGNAL( activated() ), this, SLOT( insertFourierBlock() )); + menu->addAction(a); + + a = new QAction(tr("insert Plot Block"), this); + a->setStatusTip( tr("insert a plot block") ); + connect(a, SIGNAL( activated() ), this, SLOT( insertPlotBlock() )); + menu->addAction(a); + + a = new QAction(tr("insert Statistic Block"), this); + a->setStatusTip( tr("insert a statistic block") ); + connect(a, SIGNAL( activated() ), this, SLOT( insertStatisticBlock() )); + menu->addAction(a); + + return menu; +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PSubTextEdit::insertTitle() +{ + PGetTitleBlockDialog *dlg = new PGetTitleBlockDialog(); + + if (dlg == 0) + return; + + if (dlg->exec() == QDialog::Accepted) { + QString title = dlg->getTitle(); + insertPlainText(title+"\n"); + } + + delete dlg; +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PSubTextEdit::insertParameterBlock() +{ + PGetParameterBlockDialog *dlg = new PGetParameterBlockDialog(); + + if (dlg == 0) + return; + + if (dlg->exec() == QDialog::Accepted) { + insertPlainText(dlg->getParams()); + } + + delete dlg; +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PSubTextEdit::insertTheoryFunction(int idx) +{ + if (idx < 300) + return; + + int index = idx - 300; + + if (index >= (int)fAdmin->getTheoryCounts()) + return; + + QString str = "????"; + PTheory *theoItem = fAdmin->getTheoryItem(index); + if (theoItem == 0) + return; + + // add theory function name + str = theoItem->name + " "; + if (theoItem->name == "userFcn") { + str += "libMyLibrary.so TMyFunction "; + } + + // add pseudo parameters + for (int i=0; iparams; i++) { + str += QString("%1").arg(i+1) + " "; + } + + // add comment + str += theoItem->comment; + + // add newline + str += "\n"; + + insertPlainText(str); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PSubTextEdit::insertTheoryBlock() +{ + PGetTheoryBlockDialog *dlg = new PGetTheoryBlockDialog(fAdmin); + + if (dlg == 0) + return; + + if (dlg->exec() == QDialog::Accepted) { + insertPlainText(dlg->getTheoryBlock()); + insertPlainText("\n"); + } + + delete dlg; +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PSubTextEdit::insertFunctionBlock() +{ + PGetFunctionsBlockDialog *dlg = new PGetFunctionsBlockDialog(fAdmin->getHelpMain()); + + if (dlg == 0) + return; + + if (dlg->exec() == QDialog::Accepted) { + insertPlainText(dlg->getFunctionsBlock()); + insertPlainText("\n\n"); + } + + delete dlg; +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PSubTextEdit::insertAsymRunBlock() +{ + PGetAsymmetryRunBlockDialog *dlg = new PGetAsymmetryRunBlockDialog(fAdmin->getHelpMain()); + + if (dlg == 0) + return; + + if (dlg->exec() == QDialog::Accepted) { + QString str, workStr; + bool valid = true, present = true; + // check if there is already a run block present, necessary because of the '####' line + // STILL MISSING + + // add run line + str += dlg->getRunHeaderInfo(); + + // add fittype + str += "fittype 2 (asymmetry fit)\n"; + + // add alpha if present + workStr = dlg->getAlphaParameter(present); + if (present) { + str += workStr; + } + + // add beta if present + workStr = dlg->getBetaParameter(present); + if (present) { + str += workStr; + } + + // add map + workStr = dlg->getMap(valid); + if (valid) { + str += workStr; + } else { + QMessageBox::critical(this, "**ERROR**", + "Given map not valid, will add a default map line", + QMessageBox::Ok, QMessageBox::NoButton); + str += "map 0 0 0 0 0 0 0 0 0 0\n"; + } + + // add forward + str += dlg->getForward(); + + // add backward + str += dlg->getBackward(); + + // add background or backgr.fix + workStr = dlg->getBackground(valid); + str += workStr; + if (!valid) { + QMessageBox::critical(this, "**ERROR**", + "Either background or backgr.fix is needed!\nWill set background to 0..10, please correct!", + QMessageBox::Ok, QMessageBox::NoButton); + } + + // add data + workStr = dlg->getData(valid); + if (valid) { + str += workStr; + } else { + QMessageBox::critical(this, "**ERROR**", + "Not all Data entries are present.Fix is needed!\nWill not set anything!", + QMessageBox::Ok, QMessageBox::NoButton); + } + + // add t0 if present + workStr = dlg->getT0(present); + if (present) { + str += workStr; + } else { + QMessageBox::warning(this, "**ERROR**", + "T0's not given, assume that they are present in the data file!", + QMessageBox::Ok, QMessageBox::NoButton); + } + + // add fit range + workStr = dlg->getFitRange(valid); + str += workStr; + if (!valid) { + QMessageBox::critical(this, "**ERROR**", + "No valid fit range is given.Fix is needed!\nWill add a default one!", + QMessageBox::Ok, QMessageBox::NoButton); + } + + // add packing + workStr = dlg->getPacking(present); + str += workStr; + if (!present) { + QMessageBox::critical(this, "**ERROR**", + "No valid packing/binning is given.Fix is needed!\nWill add a default one!", + QMessageBox::Ok, QMessageBox::NoButton); + } + + // insert Asymmetry Run Block at the current cursor position + insertPlainText(str); + } + + delete dlg; +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PSubTextEdit::insertSingleHistRunBlock() +{ + PGetSingleHistoRunBlockDialog *dlg = new PGetSingleHistoRunBlockDialog(fAdmin->getHelpMain()); + + if (dlg == 0) + return; + + if (dlg->exec() == QDialog::Accepted) { + QString str, workStr; + bool valid = true, present = true; + // check if there is already a run block present, necessary because of the '####' line + // STILL MISSING + + // add run line + str += dlg->getRunHeaderInfo(); + + // add fittype + str += "fittype 0 (single histogram fit)\n"; + + // add map + workStr = dlg->getMap(valid); + if (valid) { + str += workStr; + } else { + QMessageBox::critical(this, "**ERROR**", + "Given map not valid, will add a default map line", + QMessageBox::Ok, QMessageBox::NoButton); + str += "map 0 0 0 0 0 0 0 0 0 0\n"; + } + + // add forward + str += dlg->getForward(); + + // add norm + str += dlg->getNorm(); + + // add lifetime parameter + workStr = dlg->getMuonLifetimeParam(present); + if (present) { + str += workStr; + } + + // add lifetime correction flag if present + workStr = dlg->getLifetimeCorrection(present); + if (present) { + str += workStr; + } + + // add background, backgr.fix or backgr.fit + workStr = dlg->getBackground(valid); + str += workStr; + if (!valid) { + QMessageBox::critical(this, "**ERROR**", + "Either background, backgr.fix, or backgr.fit is needed!\nWill set background to 0..10, please correct!", + QMessageBox::Ok, QMessageBox::NoButton); + } + + // add t0 if present + workStr = dlg->getT0(present); + if (present) { + str += workStr; + } else { + QMessageBox::warning(this, "**ERROR**", + "T0's not given, assume that they are present in the data file!", + QMessageBox::Ok, QMessageBox::NoButton); + } + + // add data + workStr = dlg->getData(valid); + if (valid) { + str += workStr; + } else { + QMessageBox::critical(this, "**ERROR**", + "Not all Data entries are present.Fix is needed!\nWill not set anything!", + QMessageBox::Ok, QMessageBox::NoButton); + } + + // add fit range + workStr = dlg->getFitRange(valid); + str += workStr; + if (!valid) { + QMessageBox::critical(this, "**ERROR**", + "No valid fit range is given.Fix is needed!\nWill add a default one!", + QMessageBox::Ok, QMessageBox::NoButton); + } + + // add packing + workStr = dlg->getPacking(present); + str += workStr; + if (!present) { + QMessageBox::critical(this, "**ERROR**", + "No valid packing/binning is given.Fix is needed!\nWill add a default one!", + QMessageBox::Ok, QMessageBox::NoButton); + } + + // insert Single Histogram Run Block at the current cursor position + insertPlainText(str); + } + + delete dlg; +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PSubTextEdit::insertNonMusrRunBlock() +{ + PGetNonMusrRunBlockDialog *dlg = new PGetNonMusrRunBlockDialog(fAdmin->getHelpMain()); + + if (dlg == 0) + return; + + if (dlg->exec() == QDialog::Accepted) { + QString str, workStr; + bool valid = true; + // check if there is already a run block present, necessary because of the '####' line + // STILL MISSING + + // add run line + str += dlg->getRunHeaderInfo(); + + // add fittype + str += "fittype 8 (non musr fit)\n"; + + // add map + workStr = dlg->getMap(valid); + if (valid) { + str += workStr; + } else { + QMessageBox::critical(this, "**ERROR**", + "Given map not valid, will add a default map line", + QMessageBox::Ok, QMessageBox::NoButton); + str += "map 0 0 0 0 0 0 0 0 0 0\n"; + } + + // add xy-data + workStr = dlg->getXYData(valid); + if (valid) { + str += workStr; + } else { + QMessageBox::critical(this, "**ERROR**", + "Not all xy-data entries are present.Fix is needed!\nWill not set anything!", + QMessageBox::Ok, QMessageBox::NoButton); + } + + // add fit range + workStr = dlg->getFitRange(valid); + str += workStr; + if (!valid) { + QMessageBox::critical(this, "**ERROR**", + "No valid fit range is given.Fix is needed!\nWill add a default one!", + QMessageBox::Ok, QMessageBox::NoButton); + } + + // add packing + str += "packing 1\n"; + + // insert NonMusr Run Block at the current cursor position + insertPlainText(str); + } + + delete dlg; +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PSubTextEdit::insertCommandBlock() +{ + insertPlainText("###############################################################\n"); + insertPlainText("COMMANDS\n"); + insertPlainText("SET BATCH\n"); + insertPlainText("STRATEGY 1\n"); + insertPlainText("MINIMIZE\n"); + insertPlainText("#MINOS\n"); + insertPlainText("SAVE\n"); + insertPlainText("END RETURN\n\n"); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PSubTextEdit::insertFourierBlock() +{ + PGetFourierBlockDialog *dlg = new PGetFourierBlockDialog(); + + if (dlg == 0) + return; + + if (dlg->exec() == QDialog::Accepted) { + insertPlainText(dlg->getFourierBlock()+"\n"); + } + + delete dlg; +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PSubTextEdit::insertPlotBlock() +{ + PGetPlotBlockDialog *dlg = new PGetPlotBlockDialog(); + + if (dlg == 0) + return; + + if (dlg->exec() == QDialog::Accepted) { + insertPlainText(dlg->getPlotBlock()+"\n"); + } + + delete dlg; +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PSubTextEdit::insertStatisticBlock() +{ + QDateTime dt = QDateTime::currentDateTime(); + insertPlainText("###############################################################\n"); + insertPlainText("STATISTIC --- " + dt.toString("yyyy-MM-dd hh:mm:ss") + "\n"); + insertPlainText("chisq = ????, NDF = ????, chisq/NDF = ????\n\n"); +} + +//---------------------------------------------------------------------------------------------------- +// END +//---------------------------------------------------------------------------------------------------- diff --git a/src/musredit/PSubTextEdit.h b/src/musredit/PSubTextEdit.h new file mode 100644 index 00000000..f78a7a0d --- /dev/null +++ b/src/musredit/PSubTextEdit.h @@ -0,0 +1,73 @@ +/**************************************************************************** + + PSubTextEdit.h + + Author: Andreas Suter + e-mail: andreas.suter@psi.ch + + $Id: PSubTextEdit.h 3936 2009-05-22 11:38:21Z nemu $ + +*****************************************************************************/ + +/*************************************************************************** + * Copyright (C) 2009 by Andreas Suter * + * andreas.suter@psi.ch * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef _PSUBTEXTEDIT_H_ +#define _PSUBTEXTEDIT_H_ + +#include +#include + +#include "PAdmin.h" + +class PSubTextEdit : public QPlainTextEdit +{ + Q_OBJECT + + public: + PSubTextEdit(PAdmin *admin = 0, QWidget *parent = 0); + virtual ~PSubTextEdit() {} + + void setLastModified(const QDateTime &lastModified) { fLastModified = lastModified; } + QDateTime getLastModified() const { return fLastModified; } + + public slots: + void insertTitle(); + void insertParameterBlock(); + void insertTheoryFunction(int idx); + void insertTheoryBlock(); + void insertFunctionBlock(); + void insertAsymRunBlock(); + void insertSingleHistRunBlock(); + void insertNonMusrRunBlock(); + void insertCommandBlock(); + void insertFourierBlock(); + void insertPlotBlock(); + void insertStatisticBlock(); + + protected: + virtual QMenu *createPopupMenu( const QPoint &pos); + + private: + PAdmin *fAdmin; + QDateTime fLastModified; +}; + +#endif // _PSUBTEXTEDIT_H_ diff --git a/src/musredit/PTextEdit.cpp b/src/musredit/PTextEdit.cpp new file mode 100644 index 00000000..11ff593c --- /dev/null +++ b/src/musredit/PTextEdit.cpp @@ -0,0 +1,2257 @@ +/**************************************************************************** + + PTextEdit.cpp + + Author: Andreas Suter + e-mail: andreas.suter@psi.ch + + $Id$ + +*****************************************************************************/ + +/*************************************************************************** + * Copyright (C) 2010 by Andreas Suter * + * andreas.suter@psi.ch * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include +using namespace std; + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "PTextEdit.h" +//#include "PFileWatcher.h" +#include "PSubTextEdit.h" +#include "PAdmin.h" +#include "PFindDialog.h" +#include "PReplaceDialog.h" +#include "PReplaceConfirmationDialog.h" +#include "PFitOutputHandler.h" +#include "PPrefsDialog.h" +#include "PGetDefaultDialog.h" +#include "PMusrEditAbout.h" +#include "PMsr2DataDialog.h" + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +PTextEdit::PTextEdit( QWidget *parent, Qt::WindowFlags f ) + : QMainWindow( parent, f ) +{ + fAdmin = new PAdmin(); + + fMusrT0Action = 0; + + fMsr2DataParam = 0; + fFindReplaceData = 0, + +// fFileWatcher = 0; + + fKeepMinuit2Output = false; + fTitleFromDataFile = fAdmin->getTitleFromDataFileFlag(); + fEnableMusrT0 = fAdmin->getEnableMusrT0Flag(); + fDump = 0; // 0 = no dump, 1 = ascii dump, 2 = root dump + + setupFileActions(); + setupEditActions(); + setupTextActions(); + setupMusrActions(); + setupHelpActions(); + + fTabWidget = new QTabWidget( this ); + setCentralWidget( fTabWidget ); + + textFamily(fAdmin->getFontName()); + textSize(QString("%1").arg(fAdmin->getFontSize())); + + QPixmap image0(":/images/musrfit.xpm"); + setWindowIcon( image0 ); + + if ( qApp->argc() != 1 ) { + for ( int i = 1; i < qApp->argc(); ++i ) + load( qApp->argv()[ i ] ); + } else { + fileNew(); + } + + connect( fTabWidget, SIGNAL( currentChanged(QWidget*) ), this, SLOT( checkIfModified(QWidget*) )); + connect( fTabWidget, SIGNAL( currentChanged(QWidget*) ), this, SLOT( applyFontSettings(QWidget*) )); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +PTextEdit::~PTextEdit() +{ + if (fAdmin) { + delete fAdmin; + fAdmin = 0; + } + if (fMusrT0Action) { + delete fMusrT0Action; + fMusrT0Action = 0; + } + if (fMsr2DataParam) { + delete fMsr2DataParam; + fMsr2DataParam = 0; + } + if (fFindReplaceData) { + delete fFindReplaceData; + fFindReplaceData = 0; + } +/* + if (fFileWatcher) { + delete fFileWatcher; + fFileWatcher = 0; + } +*/ +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::setupFileActions() +{ + QToolBar *tb = new QToolBar( this ); + tb->setWindowTitle( "File Actions" ); + addToolBar( tb ); + + QMenu *menu = new QMenu( tr( "F&ile" ), this ); + menuBar()->addMenu( menu ); + + QAction *a; + + a = new QAction( QIcon( QPixmap(":/images/filenew.xpm") ), tr( "&New..." ), this ); + a->setShortcut( tr("Ctrl+N") ); + a->setStatusTip( tr("Create a new msr-file") ); + connect( a, SIGNAL( triggered() ), this, SLOT( fileNew() ) ); + tb->addAction(a); + menu->addAction(a); + + a = new QAction( QIcon( QPixmap(":/images/fileopen.xpm" ) ), tr( "&Open..." ), this ); + a->setShortcut( tr("Ctrl+O") ); + a->setStatusTip( tr("Opens a msr-file") ); + connect( a, SIGNAL( triggered() ), this, SLOT( fileOpen() ) ); + tb->addAction(a); + menu->addAction(a); + + a = new QAction( QIcon( QPixmap(":/images/filereload.xpm") ), tr( "Reload..." ), this ); + a->setShortcut( tr("F5") ); + a->setStatusTip( tr("Reload msr-file") ); + connect( a, SIGNAL( triggered() ), this, SLOT( fileReload() ) ); + tb->addAction(a); + menu->addAction(a); + + menu->addSeparator(); + + a = new QAction( QIcon( QPixmap(":/images/filesave.xpm") ), tr( "&Save..." ), this ); + a->setShortcut( tr("Ctrl+S") ); + a->setStatusTip( tr("Save msr-file") ); + connect( a, SIGNAL( triggered() ), this, SLOT( fileSave() ) ); + tb->addAction(a); + menu->addAction(a); + + a = new QAction( tr( "Save &As..." ), this ); + a->setStatusTip( tr("Save msr-file As") ); + connect( a, SIGNAL( triggered() ), this, SLOT( fileSaveAs() ) ); + menu->addAction(a); + + menu->addSeparator(); + + a = new QAction( QIcon( QPixmap(":/images/fileprint.xpm") ), tr( "&Print..." ), this ); + a->setShortcut( tr("Ctrl+P") ); + a->setStatusTip( tr("Print msr-file") ); + connect( a, SIGNAL( triggered() ), this, SLOT( filePrint() ) ); + tb->addAction(a); + menu->addAction(a); + + menu->addSeparator(); + + a = new QAction( tr( "&Close" ), this ); + a->setShortcut( tr("Ctrl+W") ); + a->setStatusTip( tr("Close msr-file") ); + connect( a, SIGNAL( triggered() ), this, SLOT( fileClose() ) ); + menu->addAction(a); + + a = new QAction( tr( "Close &All" ), this ); + connect( a, SIGNAL( triggered() ), this, SLOT( fileCloseAll() ) ); + menu->addAction(a); + + a = new QAction( tr( "Clo&se All Others" ), this ); + a->setShortcut( tr("Ctrl+Shift+W") ); + a->setStatusTip( tr("Close All Other Tabs") ); + connect( a, SIGNAL( triggered() ), this, SLOT( fileCloseAllOthers() ) ); + menu->addAction(a); + + menu->addSeparator(); + + a = new QAction( tr( "E&xit" ), this ); + a->setShortcut( tr("Ctrl+Q") ); + a->setStatusTip( tr("Exit Program") ); + connect( a, SIGNAL( triggered() ), this, SLOT( fileExit() ) ); + menu->addAction(a); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::setupEditActions() +{ + QToolBar *tb = new QToolBar( this ); + tb->setWindowTitle( "Edit Actions" ); + addToolBar( tb ); + + QMenu *menu = new QMenu( tr( "&Edit" ), this ); + menuBar()->addMenu( menu ); + + QAction *a; + + a = new QAction( QIcon( QPixmap( ":/images/editundo.xpm" ) ), tr( "&Undo" ), this ); + a->setShortcut( tr("Ctrl+Z") ); + a->setStatusTip( tr("Edit Undo") ); + connect( a, SIGNAL( triggered() ), this, SLOT( editUndo() ) ); + tb->addAction(a); + menu->addAction(a); + + a = new QAction( QIcon( QPixmap( ":/images/editredo.xpm" ) ), tr( "&Redo" ), this ); + a->setShortcut( tr("Ctrl+Y") ); + a->setStatusTip( tr("Edit Redo") ); + connect( a, SIGNAL( triggered() ), this, SLOT( editRedo() ) ); + tb->addAction(a); + menu->addAction(a); + menu->addSeparator(); + + a = new QAction( tr( "Select &All" ), this ); + a->setShortcut( tr("Ctrl+A") ); + a->setStatusTip( tr("Edit Select All") ); + connect( a, SIGNAL( triggered() ), this, SLOT( editSelectAll() ) ); + menu->addAction(a); + + menu->addSeparator(); + tb->addSeparator(); + + a = new QAction( QIcon( QPixmap( ":/images/editcopy.xpm" ) ), tr( "&Copy" ), this ); + a->setShortcut( tr("Ctrl+C") ); + a->setStatusTip( tr("Edit Copy") ); + connect( a, SIGNAL( triggered() ), this, SLOT( editCopy() ) ); + tb->addAction(a); + menu->addAction(a); + + a = new QAction( QIcon( QPixmap( ":/images/editcut.xpm" ) ), tr( "Cu&t" ), this ); + a->setShortcut( tr("Ctrl+X") ); + a->setStatusTip( tr("Edit Cut") ); + connect( a, SIGNAL( triggered() ), this, SLOT( editCut() ) ); + tb->addAction(a); + menu->addAction(a); + + a = new QAction( QIcon( QPixmap( ":/images/editpaste.xpm" ) ), tr( "&Paste" ), this ); + a->setShortcut( tr("Ctrl+V") ); + a->setStatusTip( tr("Edit Paste") ); + connect( a, SIGNAL( triggered() ), this, SLOT( editPaste() ) ); + tb->addAction(a); + menu->addAction(a); + + menu->addSeparator(); + tb->addSeparator(); + + a = new QAction( QIcon( QPixmap( ":/images/editfind.xpm" ) ), tr( "&Find" ), this ); + a->setShortcut( tr("Ctrl+F") ); + a->setStatusTip( tr("Edit Find") ); + connect( a, SIGNAL( triggered() ), this, SLOT( editFind() ) ); + tb->addAction(a); + menu->addAction(a); + + a = new QAction( QIcon( QPixmap( ":/images/editnext.xpm" ) ), tr( "Find &Next" ), this ); + a->setShortcut( tr("F3") ); + a->setStatusTip( tr("Edit Find Next") ); + connect( a, SIGNAL( triggered() ), this, SLOT( editFindNext() ) ); + tb->addAction(a); + menu->addAction(a); + + a = new QAction( QIcon( QPixmap( ":/images/editprevious.xpm" ) ) , tr( "Find Pre&vious" ), this ); + a->setShortcut( tr("Shift+F4") ); + a->setStatusTip( tr("Edit Find Previous") ); + connect( a, SIGNAL( triggered() ), this, SLOT( editFindPrevious() ) ); + tb->addAction(a); + menu->addAction(a); + + a = new QAction( tr( "Replace..." ), this ); + a->setShortcut( tr("Ctrl+R") ); + a->setStatusTip( tr("Edit Replace") ); + connect( a, SIGNAL( triggered() ), this, SLOT( editFindAndReplace() ) ); + menu->addAction(a); + menu->addSeparator(); + + QMenu *addSubMenu = new QMenu( tr ("Add Block"), this); + + a = new QAction( tr("Title Block"), this ); + a->setStatusTip( tr("Invokes MSR Title Block Dialog") ); + connect( a, SIGNAL( triggered() ), this, SLOT( insertTitle() )); + addSubMenu->addAction(a); + + a = new QAction( tr("Parameter Block"), this ); + a->setStatusTip( tr("Invokes MSR Parameter Block Dialog") ); + connect( a, SIGNAL( triggered() ), this, SLOT( insertParameterBlock() )); + addSubMenu->addAction(a); + + a = new QAction( tr("Theory Block"), this ); + a->setStatusTip( tr("Invokes MSR Theory Block Dialog") ); + connect( a, SIGNAL( triggered() ), this, SLOT( insertTheoryBlock() )); + addSubMenu->addAction(a); + + a = new QAction( tr("Function Block"), this ); + a->setStatusTip( tr("Invokes MSR Function Block Dialog") ); + connect( a, SIGNAL( triggered() ), this, SLOT( insertFunctionBlock() )); + addSubMenu->addAction(a); + + a = new QAction( tr("Asymmetry Run Block"), this ); + a->setStatusTip( tr("Invokes MSR Asymmetry Run Block Dialog") ); + connect( a, SIGNAL( triggered() ), this, SLOT( insertAsymRunBlock() )); + addSubMenu->addAction(a); + + a = new QAction( tr("Single Histo Run Block"), this ); + a->setStatusTip( tr("Invokes MSR Single Histo Run Block Dialog") ); + connect( a, SIGNAL( triggered() ), this, SLOT( insertSingleHistRunBlock() )); + addSubMenu->addAction(a); + + a = new QAction( tr("NonMuSR Run Block"), this ); + a->setStatusTip( tr("Invokes MSR NonMuSR Run Block Dialog") ); + connect( a, SIGNAL( triggered() ), this, SLOT( insertNonMusrRunBlock() )); + addSubMenu->addAction(a); + + a = new QAction( tr("Command Block"), this ); + a->setStatusTip( tr("Invokes MSR Command Block Dialog") ); + connect( a, SIGNAL( triggered() ), this, SLOT( insertCommandBlock() )); + addSubMenu->addAction(a); + + a = new QAction( tr("Fourier Block"), this ); + a->setStatusTip( tr("Invokes MSR Fourier Block Dialog") ); + connect( a, SIGNAL( triggered() ), this, SLOT( insertFourierBlock() )); + addSubMenu->addAction(a); + + a = new QAction( tr("Plot Block"), this ); + a->setStatusTip( tr("Invokes MSR Plot Block Dialog") ); + connect( a, SIGNAL( triggered() ), this, SLOT( insertPlotBlock() )); + addSubMenu->addAction(a); + + a = new QAction( tr("Statistic Block"), this ); + a->setStatusTip( tr("Invokes MSR Statistic Block Dialog") ); + connect( a, SIGNAL( triggered() ), this, SLOT( insertStatisticBlock() )); + addSubMenu->addAction(a); + + menu->addMenu(addSubMenu); + menu->addSeparator(); + + a = new QAction( tr( "(Un)Co&mment" ), this ); + a->setShortcut( tr("Ctrl+M") ); + a->setStatusTip( tr("Edit (Un)Comment Selected Lines") ); + connect( a, SIGNAL( triggered() ), this, SLOT( editComment() ) ); + menu->addAction(a); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::setupTextActions() +{ + QToolBar *tb = new QToolBar( this ); + tb->setWindowTitle( "Format Actions" ); + addToolBar( tb ); + + fComboFont = new QComboBox(); + fComboFont->setEditable(true); + QFontDatabase db; + fComboFont->addItems( db.families() ); + connect( fComboFont, SIGNAL( activated( const QString & ) ), + this, SLOT( textFamily( const QString & ) ) ); + QLineEdit *edit = fComboFont->lineEdit(); + if (edit == 0) { + qDebug() << endl << "**ERROR** PTextEdit::setupTextActions(): cannot edit fComboFont" << endl; + return; + } + edit->setText( fAdmin->getFontName() ); + tb->addWidget(fComboFont); + + fComboSize = new QComboBox( tb ); + fComboSize->setEditable(true); + QList sizes = db.standardSizes(); + QList::Iterator it = sizes.begin(); + for ( ; it != sizes.end(); ++it ) + fComboSize->addItem( QString::number( *it ) ); + connect( fComboSize, SIGNAL( activated( const QString & ) ), + this, SLOT( textSize( const QString & ) ) ); + edit = fComboSize->lineEdit(); + if (edit == 0) { + qDebug() << endl << "**ERROR** PTextEdit::setupTextActions(): cannot edit fComboSize" << endl; + return; + } + edit->setText( QString("%1").arg(fAdmin->getFontSize()) ); + tb->addWidget(fComboSize); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::setupMusrActions() +{ + addToolBarBreak(); + + QToolBar *tb = new QToolBar( this ); + tb->setWindowTitle( "Musr Actions" ); + addToolBar( tb ); + + QMenu *menu = new QMenu( tr( "&MusrFit" ), this ); + menuBar()->addMenu( menu ); + + QAction *a; + a = new QAction( QIcon( QPixmap( ":/images/musrasym.xpm" ) ), tr( "&Asymmetry Default" ), this ); + a->setShortcut( tr("Alt+A") ); + a->setStatusTip( tr("Get Default Asymmetry msr-file") ); + connect( a, SIGNAL( triggered() ), this, SLOT( musrGetAsymmetryDefault() ) ); + tb->addAction(a); + menu->addAction(a); + + a = new QAction( QIcon( QPixmap( ":/images/musrsinglehisto.xpm" ) ), tr( "Single &Histogram Default" ), this ); + a->setShortcut( tr("Alt+H") ); + a->setStatusTip( tr("Get Default Single Histogram msr-file") ); + connect( a, SIGNAL( triggered() ), this, SLOT( musrGetSingleHistoDefault() ) ); + tb->addAction(a); + menu->addAction(a); + + menu->addSeparator(); + tb->addSeparator(); + + a = new QAction( QIcon( QPixmap( ":/images/musrcalcchisq.xpm" ) ), tr( "Calculate Chisq" ), this ); + a->setShortcut( tr("Alt+C") ); + a->setStatusTip( tr("Calculate Chi Square (Log Max Likelihood)") ); + connect( a, SIGNAL( triggered() ), this, SLOT( musrCalcChisq() ) ); + tb->addAction(a); + menu->addAction(a); + + a = new QAction( QIcon( QPixmap( ":/images/musrfit.xpm" ) ), tr( "&Fit" ), this ); + a->setShortcut( tr("Alt+F") ); + a->setStatusTip( tr("Fit") ); + connect( a, SIGNAL( triggered() ), this, SLOT( musrFit() ) ); + tb->addAction(a); + menu->addAction(a); + + a = new QAction( QIcon( QPixmap( ":/images/musrswap.xpm" ) ), tr( "&Swap Msr <-> Mlog" ), this ); + a->setShortcut( tr("Alt+S") ); + a->setStatusTip( tr("Swap msr-file <-> mlog-file") ); + connect( a, SIGNAL( triggered() ), this, SLOT( musrSwapMsrMlog() ) ); + tb->addAction(a); + menu->addAction(a); + + a = new QAction( QIcon( QPixmap( ":/images/musrmsr2data.xpm" ) ), tr( "&Msr2Data" ), this ); + a->setShortcut( tr("Alt+M") ); + a->setStatusTip( tr("Start msr2data interface") ); + connect( a, SIGNAL( triggered() ), this, SLOT( musrMsr2Data() ) ); + tb->addAction(a); + menu->addAction(a); + + menu->addSeparator(); + tb->addSeparator(); + + a = new QAction( QIcon( QPixmap( ":/images/musrview.xpm" ) ), tr( "&View" ), this ); + a->setShortcut( tr("Alt+V") ); + a->setStatusTip( tr("Start musrview") ); + connect( a, SIGNAL( triggered() ), this, SLOT( musrView() ) ); + tb->addAction(a); + menu->addAction(a); + + fMusrT0Action = new QAction( QIcon( QPixmap( ":/images/musrt0.xpm" ) ), tr( "&T0" ), this ); + a->setStatusTip( tr("Start musrt0") ); + connect( fMusrT0Action, SIGNAL( triggered() ), this, SLOT( musrT0() ) ); + tb->addAction(fMusrT0Action); + menu->addAction(fMusrT0Action); + fMusrT0Action->setEnabled(fEnableMusrT0); + + a = new QAction( QIcon( QPixmap( ":/images/musrprefs.xpm" ) ), tr( "&Preferences" ), this ); + a->setStatusTip( tr("Show Preferences") ); + connect( a, SIGNAL( triggered() ), this, SLOT( musrPrefs() ) ); + tb->addAction(a); + menu->addAction(a); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::setupHelpActions() +{ + QMenu *menu = new QMenu( tr( "&Help" ), this ); + menuBar()->addMenu( menu); + + QAction *a; + a = new QAction(tr( "Contents ..." ), this ); + a->setStatusTip( tr("Help Contents") ); + connect( a, SIGNAL( triggered() ), this, SLOT( helpContents() )); + menu->addAction(a); + + a = new QAction(tr( "About ..." ), this ); + a->setStatusTip( tr("Help About") ); + connect( a, SIGNAL( triggered() ), this, SLOT( helpAbout() )); + menu->addAction(a); + + a = new QAction(tr( "About Qt..." ), this ); + a->setStatusTip( tr("Help About Qt") ); + connect( a, SIGNAL( triggered() ), this, SLOT( helpAboutQt() )); + menu->addAction(a); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::load( const QString &f, const int index ) +{ + if ( !QFile::exists( f ) ) + return; + + QFileInfo info(f); + + PSubTextEdit *edit = new PSubTextEdit( fAdmin ); + edit->setLastModified(info.lastModified()); +// edit->setAcceptRichText( false ); +// edit->setFontFamily(fAdmin->getFontName()); +// edit->setFontPointSize(fAdmin->getFontSize()); + edit->setFont(QFont(fAdmin->getFontName(), fAdmin->getFontSize())); + + if (index == -1) + fTabWidget->addTab( edit, QFileInfo( f ).fileName() ); + else + fTabWidget->insertTab( index, edit, QFileInfo( f ).fileName() ); + QFile file( f ); + if ( !file.open( QIODevice::ReadOnly ) ) + return; + + QTextStream ts( &file ); + QString txt = ts.readAll(); + edit->setPlainText( txt ); + doConnections( edit ); + + fTabWidget->setCurrentIndex(fTabWidget->indexOf(edit)); + edit->viewport()->setFocus(); + fFilenames.remove( edit ); + fFilenames.insert( edit, f ); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +PSubTextEdit *PTextEdit::currentEditor() const +{ + if ( fTabWidget->currentWidget() && fTabWidget->currentWidget()->inherits( "PSubTextEdit" ) ) { + return (PSubTextEdit*)fTabWidget->currentWidget(); + } + + return 0; +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::doConnections( PSubTextEdit *e ) +{ +// connect( e, SIGNAL( currentFontChanged( const QFont & ) ), +// this, SLOT( fontChanged( const QFont & ) ) ); + + connect( e, SIGNAL( textChanged() ), this, SLOT( textChanged() )); + + connect( e, SIGNAL( cursorPositionChanged() ), this, SLOT( currentCursorPosition() )); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +bool PTextEdit::validRunList(const QString runList) +{ + bool success = true; + + int i = 0; + QString subStr; + bool done = false; + int val; + bool ok; + while (!done) { + subStr = runList.section(' ', i, i); + if (subStr.isEmpty()) { + done = true; + continue; + } + i++; + val = subStr.toInt(&ok); + if (!ok) { + done = true; + success = false; + } + } + + if (i == 0) { // no token found + success = false; + } + + return success; +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::insertTitle() +{ + currentEditor()->insertTitle(); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::insertParameterBlock() +{ + currentEditor()->insertParameterBlock(); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::insertTheoryBlock() +{ + currentEditor()->insertTheoryBlock(); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::insertFunctionBlock() +{ + currentEditor()->insertFunctionBlock(); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::insertAsymRunBlock() +{ + currentEditor()->insertAsymRunBlock(); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::insertSingleHistRunBlock() +{ + currentEditor()->insertSingleHistRunBlock(); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::insertNonMusrRunBlock() +{ + currentEditor()->insertNonMusrRunBlock(); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::insertCommandBlock() +{ + currentEditor()->insertCommandBlock(); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::insertFourierBlock() +{ + currentEditor()->insertFourierBlock(); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::insertPlotBlock() +{ + currentEditor()->insertPlotBlock(); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::insertStatisticBlock() +{ + currentEditor()->insertStatisticBlock(); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::fileNew() +{ + PSubTextEdit *edit = new PSubTextEdit( fAdmin ); +// edit->setAcceptRichText( false ); +// edit->setFontFamily(fAdmin->getFontName()); +// edit->setFontPointSize(fAdmin->getFontSize()); + edit->setFont(QFont(fAdmin->getFontName(), fAdmin->getFontSize())); + doConnections( edit ); + fTabWidget->addTab( edit, tr( "noname" ) ); + fTabWidget->setCurrentIndex(fTabWidget->indexOf(edit)); + fFilenames.insert(edit, tr("noname")); + edit->viewport()->setFocus(); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::fileOpen() +{ + QStringList flns = QFileDialog::getOpenFileNames( this, tr("Open msr-/mlog-File"), + fAdmin->getDefaultSavePath(), + tr( "msr-Files (*.msr);;msr-Files (*.msr *.mlog);;All Files (*)" )); + + QStringList::Iterator it = flns.begin(); + QFileInfo finfo1, finfo2; + QString tabFln; + bool alreadyOpen = false; + + while( it != flns.end() ) { + // check if the file is not already open + finfo1.setFile(*it); + for (int i=0; icount(); i++) { + tabFln = *fFilenames.find( dynamic_cast(fTabWidget->widget(i))); + qDebug() << endl << "tabFln=" << tabFln; + finfo2.setFile(tabFln); + if (finfo1.absoluteFilePath() == finfo2.absoluteFilePath()) { + alreadyOpen = true; + fTabWidget->setCurrentIndex(i); + break; + } + } + + if (!alreadyOpen) + load(*it); + else + fileReload(); + + ++it; + } +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::fileReload() +{ + if ( fFilenames.find( currentEditor() ) == fFilenames.end() ) { + QMessageBox::critical(this, "**ERROR**", "Cannot reload a file not previously saved ;-)"); + } else { + int index = fTabWidget->currentIndex(); + QString fln = *fFilenames.find( currentEditor() ); + fileClose(false); + load(fln, index); + } + +/* + // clean up file watcher object if present + if (fFileWatcher) { + delete fFileWatcher; + fFileWatcher = 0; + } +*/ +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::fileSave() +{ + if ( !currentEditor() ) + return; + + if ( *fFilenames.find( currentEditor() ) == QString("noname") ) { + fileSaveAs(); + } else { + QFile file( *fFilenames.find( currentEditor() ) ); + if ( !file.open( QIODevice::WriteOnly ) ) + return; + QTextStream ts( &file ); + ts << currentEditor()->toPlainText(); + + // remove trailing '*' modification indicators + QString fln = *fFilenames.find( currentEditor() ); + fTabWidget->setTabText(fTabWidget->indexOf( currentEditor() ), QFileInfo(fln).fileName()); + } +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::fileSaveAs() +{ + if ( !currentEditor() ) + return; + + QString fn = QFileDialog::getSaveFileName( this, + tr( "Save msr-/mlog-file As" ), QString::null, + tr( "msr-Files (*.msr *.mlog);;All Files (*)" ) ); + if ( !fn.isEmpty() ) { + fFilenames.remove( currentEditor() ); + fFilenames.insert( currentEditor(), fn ); + fileSave(); + fTabWidget->setTabText(fTabWidget->indexOf( currentEditor() ), QFileInfo(fn).fileName()); + } +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::filePrint() +{ + if ( !currentEditor() ) + return; +#ifndef QT_NO_PRINTER + QPrinter printer( QPrinter::HighResolution ); + printer.setFullPage(true); + QPrintDialog dialog(&printer, this); + if (dialog.exec()) { // printer dialog + statusBar()->showMessage( "Printing..." ); + + QPainter p( &printer ); + // Check that there is a valid device to print to. + if ( !p.device() ) + return; + + QFont font( currentEditor()->QWidget::font() ); + font.setPointSize( 10 ); // we define 10pt to be a nice base size for printing + p.setFont( font ); + + int yPos = 0; // y-position for each line + QFontMetrics fm = p.fontMetrics(); + int dpiy = printer.logicalDpiY(); + int margin = (int) ( (2/2.54)*dpiy ); // 2 cm margins + + // print msr-file + QStringList strList = currentEditor()->toPlainText().split("\n"); + for (QStringList::Iterator it = strList.begin(); it != strList.end(); ++it) { + // new page needed? + if ( margin + yPos > printer.height() - margin ) { + printer.newPage(); // no more room on this page + yPos = 0; // back to top of page + } + + // print data + p.drawText(margin, margin+yPos, printer.width(), fm.lineSpacing(), + Qt::TextExpandTabs | Qt::TextDontClip, *it); + yPos += fm.lineSpacing(); + } + + p.end(); + } +#endif +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::fileClose(const bool check) +{ + // check if the has modification + int idx = fTabWidget->currentIndex(); + if ((fTabWidget->tabText(idx).indexOf("*")>0) && check) { + int result = QMessageBox::warning(this, "**WARNING**", + "Do you really want to close this file.\nChanges will be lost", + "Close", "Cancel"); + if (result == 1) // Cancel + return; + } + + delete currentEditor(); + if ( currentEditor() ) + currentEditor()->viewport()->setFocus(); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::fileCloseAll() +{ + // check if any editor tab is present, if not: get out of here + if ( !currentEditor() ) + return; + + // check if there are any unsaved tabs + for (int i=0; icount(); i++) { + if (fTabWidget->tabText(i).indexOf("*") > 0) { + int result = QMessageBox::warning(this, "**WARNING**", + "Do you really want to close all files.\nChanges of unsaved files will be lost", + "Close", "Cancel"); + if (result == 1) // Cancel + return; + break; + } + } + + // close all editor tabs + do { + delete currentEditor(); + if ( currentEditor() ) + currentEditor()->viewport()->setFocus(); + } while ( currentEditor() ); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::fileCloseAllOthers() +{ + // check if any editor tab is present, if not: get out of here + if ( !currentEditor() ) + return; + + // check if there are any unsaved tabs + for (int i=0; icount(); i++) { + if (fTabWidget->tabText(i).indexOf("*") > 0) { + int result = QMessageBox::warning(this, "**WARNING**", + "Do you really want to close all files.\nChanges of unsaved files will be lost", + "Close", "Cancel"); + if (result == 1) // Cancel + return; + break; + } + } + + // keep label of the current editor + QString label = fTabWidget->tabText(fTabWidget->currentIndex()); + + // check if only the current editor is present. If yes: nothing to be done + if (fTabWidget->count() == 1) + return; + + // close all editor tabs + int i=0; + do { + if (fTabWidget->tabText(i) != label) + delete fTabWidget->widget(i); + else + i++; + } while ( fTabWidget->count() > 1 ); + + currentEditor()->viewport()->setFocus(); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::fileExit() +{ + // check if there are still some modified files open + for (int i=0; i < fTabWidget->count(); i++) { + if (fTabWidget->tabText(i).indexOf("*") > 0) { + int result = QMessageBox::warning(this, "**WARNING**", + "Do you really want to exit from the applcation.\nChanges will be lost", + "Exit", "Cancel"); + if (result == 1) // Cancel + return; + break; + } + } + + qApp->quit(); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::editUndo() +{ + if ( !currentEditor() ) + return; + currentEditor()->undo(); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::editRedo() +{ + if ( !currentEditor() ) + return; + currentEditor()->redo(); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::editSelectAll() +{ + if ( !currentEditor() ) + return; + currentEditor()->selectAll(); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::editCut() +{ + if ( !currentEditor() ) + return; + currentEditor()->cut(); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::editCopy() +{ + if ( !currentEditor() ) + return; + currentEditor()->copy(); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::editPaste() +{ + if ( !currentEditor() ) + return; + currentEditor()->paste(); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::editFind() +{ + if ( !currentEditor() ) + return; + + // check if first time called, and if yes create find and replace data structure + if (fFindReplaceData == 0) { + fFindReplaceData = new PFindReplaceData(); + fFindReplaceData->findText = QString(""); + fFindReplaceData->replaceText = QString(""); + fFindReplaceData->caseSensitive = true; + fFindReplaceData->wholeWordsOnly = false; + fFindReplaceData->fromCursor = true; + fFindReplaceData->findBackwards = false; + fFindReplaceData->selectedText = false; + fFindReplaceData->promptOnReplace = true; + } + + if (fFindReplaceData == 0) { + QMessageBox::critical(this, "**ERROR**", "Couldn't invoke find data structure, sorry :-(", QMessageBox::Ok, QMessageBox::NoButton); + return; + } + + PFindDialog *dlg = new PFindDialog(fFindReplaceData, currentEditor()->textCursor().hasSelection()); + if (dlg == 0) { + QMessageBox::critical(this, "**ERROR**", "Couldn't invoke find dialog, sorry :-(", QMessageBox::Ok, QMessageBox::NoButton); + return; + } + + dlg->exec(); + + if (dlg->result() != QDialog::Accepted) { + delete dlg; + return; + } + + fFindReplaceData = dlg->getData(); + + delete dlg; + dlg = 0; + + // try to find the search text + if (!fFindReplaceData->fromCursor) + currentEditor()->textCursor().setPosition(0); + + QTextDocument::FindFlags flags = 0; + if (fFindReplaceData->caseSensitive) + flags |= QTextDocument::FindCaseSensitively; + else if (fFindReplaceData->findBackwards) + flags |= QTextDocument::FindBackward; + else if (fFindReplaceData->wholeWordsOnly) + flags |= QTextDocument::FindWholeWords; + + currentEditor()->find(fFindReplaceData->findText, flags); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::editFindNext() +{ + QTextDocument::FindFlags flags = 0; + if (fFindReplaceData->caseSensitive) + flags |= QTextDocument::FindCaseSensitively; + else if (fFindReplaceData->wholeWordsOnly) + flags |= QTextDocument::FindWholeWords; + + currentEditor()->find(fFindReplaceData->findText, flags); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::editFindPrevious() +{ + QTextDocument::FindFlags flags = 0; + if (fFindReplaceData->caseSensitive) + flags |= QTextDocument::FindCaseSensitively; + else if (fFindReplaceData->wholeWordsOnly) + flags |= QTextDocument::FindWholeWords; + + flags |= QTextDocument::FindBackward; + + currentEditor()->find(fFindReplaceData->findText, flags); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::editFindAndReplace() +{ + if ( !currentEditor() ) + return; + + // check if first time called, and if yes create find and replace data structure + if (fFindReplaceData == 0) { + fFindReplaceData = new PFindReplaceData(); + fFindReplaceData->findText = QString(""); + fFindReplaceData->replaceText = QString(""); + fFindReplaceData->caseSensitive = true; + fFindReplaceData->wholeWordsOnly = false; + fFindReplaceData->fromCursor = true; + fFindReplaceData->findBackwards = false; + fFindReplaceData->selectedText = false; + fFindReplaceData->promptOnReplace = true; + } + + if (fFindReplaceData == 0) { + QMessageBox::critical(this, "**ERROR**", "Couldn't invoke find&replace data structure, sorry :-(", QMessageBox::Ok, QMessageBox::NoButton); + return; + } + + PReplaceDialog *dlg = new PReplaceDialog(fFindReplaceData, currentEditor()->textCursor().hasSelection()); + if (dlg == 0) { + QMessageBox::critical(this, "**ERROR**", "Couldn't invoke find&replace dialog, sorry :-(", QMessageBox::Ok, QMessageBox::NoButton); + return; + } + + dlg->exec(); + + if (dlg->result() != QDialog::Accepted) { + delete dlg; + return; + } + + fFindReplaceData = dlg->getData(); + + delete dlg; + dlg = 0; + + editFindNext(); + + PReplaceConfirmationDialog confirmDlg(this); + + // connect all the necessary signals/slots + QObject::connect(confirmDlg.fReplace_pushButton, SIGNAL(clicked()), this, SLOT(replace())); + QObject::connect(confirmDlg.fReplaceAndClose_pushButton, SIGNAL(clicked()), this, SLOT(replaceAndClose())); + QObject::connect(confirmDlg.fReplaceAll_pushButton, SIGNAL(clicked()), this, SLOT(replaceAll())); + QObject::connect(confirmDlg.fFindNext_pushButton, SIGNAL(clicked()), this, SLOT(editFindNext())); + QObject::connect(this, SIGNAL(close()), &confirmDlg, SLOT(accept())); + + confirmDlg.exec(); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::editComment() +{ + if ( !currentEditor() ) + return; + +// NEEDS TO BE REWORKED. Qt4.6 far too different compared to Qt3.x +/* + QString str; + if (currentEditor()->textCursor().hasSelection()) { // selected text present + int paraFrom, paraTo; + int indexFrom, indexTo; + // get selection + currentEditor()->getSelection(¶From, &indexFrom, ¶To, &indexTo); + // check that indexFrom == 0, if not change the selection accordingly + if (indexFrom != 0) { + indexFrom = 0; + currentEditor()->setSelection(paraFrom, indexFrom, paraTo, indexTo); + } + // check that cursor is not in next line without selecting anything + if (indexTo == 0) { + paraTo--; + indexTo++; + } + // check that indexTo == end of line of paraTo + if ((indexTo != (int)currentEditor()->text(paraTo).length()) && (indexTo != 0)) { + indexTo = currentEditor()->text(paraTo).length(); + currentEditor()->setSelection(paraFrom, indexFrom, paraTo, indexTo); + } + // get selection text + str = currentEditor()->selectedText(); + // check line by line if (un)comment is needed + QStringList strList = QStringList::split("\n", str, TRUE); + for (QStringList::Iterator it = strList.begin(); it != strList.end(); ++it) { + str = *it; + if (str.trimmed().startsWith("#")) { // comment -> uncomment it + int idx = -1; + for (unsigned int i=0; i<(*it).length(); i++) { + if ((*it)[i] == '#') { + idx = i; + break; + } + } + (*it).remove(idx,1); + if ((*it)[idx] == ' ') { + (*it).remove(idx,1); + } + } else { // no comment -> comment it + (*it).prepend("# "); + } + } + str = strList.join("\n"); + currentEditor()->insert(str); + // set the cursor position + currentEditor()->setCursorPosition(++paraTo, 0); + } else { // no text selected + int para, index; + currentEditor()->getCursorPosition(¶, &index); + // get current text line + str = currentEditor()->text(para); + // check if it is a comment line or not + if (str.trimmed().startsWith("#")) { // comment -> uncomment it + str = currentEditor()->text(para); + int idx = -1; + for (unsigned int i=0; i comment it + if (!str.isEmpty()) + str.prepend("# "); + } + // select current line + currentEditor()->setSelection(para, 0, para, currentEditor()->text(para).length()); + // insert altered text + currentEditor()->insert(str); + // set the cursor position + currentEditor()->setCursorPosition(para, 0); + } +*/ +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::textFamily( const QString &f ) +{ + fAdmin->setFontName(f); + + if ( !currentEditor() ) + return; + + currentEditor()->setFont(QFont(f,fAdmin->getFontSize())); + currentEditor()->viewport()->setFocus(); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::textSize( const QString &p ) +{ + fAdmin->setFontSize(p.toInt()); + + if ( !currentEditor() ) + return; + + currentEditor()->setFont(QFont(fAdmin->getFontName(), p.toInt())); + currentEditor()->viewport()->setFocus(); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::musrGetAsymmetryDefault() +{ + QString runFileName, beamline, institute, fileFormat; + + PGetDefaultDialog *dlg = new PGetDefaultDialog(); + + if (dlg == 0) { + QMessageBox::critical(this, "**ERROR**", "Couldn't invoke get default dialog, sorry :-(", QMessageBox::Ok, QMessageBox::NoButton); + return; + } + + // set defaults + dlg->setBeamline(fAdmin->getBeamline()); + dlg->setInstitute(fAdmin->getInstitute()); + dlg->setFileFormat(fAdmin->getFileFormat()); + + dlg->exec(); + + if (dlg->result() != QDialog::Accepted) { + delete dlg; + dlg = 0; + return; + } + + runFileName = dlg->getRunFileName(); + beamline = dlg->getBeamline(); + institute = dlg->getInstitute(); + fileFormat = dlg->getFileFormat(); + delete dlg; + dlg = 0; + + QFile file(fAdmin->getMsrDefaultFilePath()+"/asymDefault.msr"); + if (file.open(QIODevice::ReadOnly)) { + // make a new file tab + fileNew(); + QTextStream ts( &file ); + QString line; + while ( !ts.atEnd() ) { + line = ts.readLine(); // line of text excluding '\n' + if (line.startsWith("RUN")) { + QString runHeader = "RUN " + runFileName + " " + beamline.toUpper() + " " + institute + " " + fileFormat.toUpper() + " (name beamline institute data-file-format)\n"; + currentEditor()->insertPlainText(runHeader); + } else { // just copy the text + currentEditor()->insertPlainText(line+"\n"); + } + } + currentEditor()->textCursor().setPosition(0); + + file.close(); + } else { + QMessageBox::critical(this, "**ERROR**", + "Couldn't find default asymmetry file template :-(", + QMessageBox::Ok, QMessageBox::NoButton); + } + +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::musrGetSingleHistoDefault() +{ + QString runFileName, beamline, institute, fileFormat; + + PGetDefaultDialog *dlg = new PGetDefaultDialog(); + + if (dlg == 0) { + QMessageBox::critical(this, "**ERROR**", "Couldn't invoke get default dialog, sorry :-(", QMessageBox::Ok, QMessageBox::NoButton); + return; + } + + // set defaults + dlg->setBeamline(fAdmin->getBeamline()); + dlg->setInstitute(fAdmin->getInstitute().toLower()); + dlg->setFileFormat(fAdmin->getFileFormat().toLower()); + + dlg->exec(); + + if (dlg->result() != QDialog::Accepted) { + delete dlg; + dlg = 0; + return; + } + + runFileName = dlg->getRunFileName(); + beamline = dlg->getBeamline(); + institute = dlg->getInstitute(); + fileFormat = dlg->getFileFormat(); + delete dlg; + dlg = 0; + + QFile file(fAdmin->getMsrDefaultFilePath()+"/singleHistoDefault.msr"); + if (file.open(QIODevice::ReadOnly)) { + // make a new file tab + fileNew(); + QTextStream ts( &file ); + QString line; + while ( !ts.atEnd() ) { + line = ts.readLine(); // line of text excluding '\n' + if (line.startsWith("RUN")) { + QString runHeader = "RUN " + runFileName + " " + beamline.toUpper() + " " + institute + " " + fileFormat.toUpper() + " (name beamline institute data-file-format)\n"; + currentEditor()->insertPlainText(runHeader); + } else { // just copy the text + currentEditor()->insertPlainText(line+"\n"); + } + } + currentEditor()->textCursor().setPosition(0); + + file.close(); + } else { + QMessageBox::critical(this, "**ERROR**", + "Couldn't find default single histogram file template :-(", + QMessageBox::Ok, QMessageBox::NoButton); + } + +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::musrCalcChisq() +{ + if ( !currentEditor() ) + return; + + QString tabLabel = fTabWidget->tabText(fTabWidget->currentIndex()); + if (tabLabel == "noname") { + QMessageBox::critical(this, "**ERROR**", "For a fit a real msr-file is needed."); + return; + } else if (tabLabel == "noname*") { + fileSaveAs(); + } else if (tabLabel.indexOf("*") > 0) { + fileSave(); + } + + QVector cmd; + QString str; + str = fAdmin->getExecPath() + "/musrfit"; + + cmd.append(str); + cmd.append(QFileInfo(*fFilenames.find( currentEditor())).fileName() ); + cmd.append("--chisq-only"); + PFitOutputHandler fitOutputHandler(QFileInfo(*fFilenames.find( currentEditor() )).absolutePath(), cmd); + fitOutputHandler.setModal(true); + fitOutputHandler.exec(); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::musrFit() +{ + if ( !currentEditor() ) + return; + + QString tabLabel = fTabWidget->tabText(fTabWidget->currentIndex()); + if (tabLabel == "noname") { + QMessageBox::critical(this, "**ERROR**", "For a fit a real msr-file is needed."); + return; + } else if (tabLabel == "noname*") { + fileSaveAs(); + } else if (tabLabel.indexOf("*") > 0) { + fileSave(); + } + + QVector cmd; + QString str; + str = fAdmin->getExecPath() + "/musrfit"; + + cmd.append(str); + cmd.append(QFileInfo(*fFilenames.find( currentEditor())).fileName() ); + + // check if keep minuit2 output is wished + if (fKeepMinuit2Output) + cmd.append("--keep-mn2-output"); + + // check if title of the data file should be used to replace the msr-file title + if (fTitleFromDataFile) + cmd.append("--title-from-data-file"); + + // check if dump files are wished + switch (fDump) { + case 1: // ascii dump + cmd.append("--dump"); + cmd.append("ascii"); + break; + case 2: // root dump + cmd.append("--dump"); + cmd.append("root"); + break; + default: + break; + } + + PFitOutputHandler fitOutputHandler(QFileInfo(*fFilenames.find( currentEditor() )).absolutePath(), cmd); + fitOutputHandler.setModal(true); + fitOutputHandler.exec(); + + // handle the reloading of the files + + // get current file name + QString currentFileName = *fFilenames.find( currentEditor() ); + QString complementFileName; + // check if it is a msr-, mlog-, or another file + int idx; + if ((idx = currentFileName.indexOf(".msr")) > 0) { // msr-file + complementFileName = currentFileName; + complementFileName.replace(idx, 5, ".mlog"); + } else if ((idx = currentFileName.indexOf(".mlog")) > 0) { // mlog-file + complementFileName = currentFileName; + complementFileName.replace(idx, 5, ".msr "); + complementFileName = complementFileName.trimmed(); + } else { // neither a msr- nor a mlog-file + QMessageBox::information( this, "musrFit", + "This is neither a msr- nor a mlog-file, hence no idea what to be done.\n", + QMessageBox::Ok ); + return; + } + + int currentIdx = fTabWidget->currentIndex(); + + // reload current file + fileClose(); + load(currentFileName, currentIdx); + + // check if swap file is open as well, and if yes, reload it + idx = -1; + for (int i=0; icount(); i++) { + if (fTabWidget->tabText(i).indexOf(complementFileName) >= 0) { + idx = i; + break; + } + } + if (idx >= 0) { // complement file is open + fTabWidget->setCurrentIndex(idx); + fileClose(); + load(complementFileName, idx); + fTabWidget->setCurrentIndex(currentIdx); + } +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::musrMsr2Data() +{ +/* + if ( !currentEditor() ) + return; +*/ + + if (fMsr2DataParam == 0) { + fMsr2DataParam = new PMsr2DataParam(); + // init fMsr2DataParam + fMsr2DataParam->firstRun = -1; + fMsr2DataParam->lastRun = -1; + fMsr2DataParam->runList = QString(""); + fMsr2DataParam->runListFileName = QString(""); + fMsr2DataParam->msrFileExtension = QString(""); + fMsr2DataParam->templateRunNo = -1; + fMsr2DataParam->dbOutputFileName = QString(""); + fMsr2DataParam->writeDbHeader = false; + fMsr2DataParam->summaryFilePresent = false; + fMsr2DataParam->keepMinuit2Output = fKeepMinuit2Output; + fMsr2DataParam->writeColumnData = false; + fMsr2DataParam->recreateDbFile = false; + fMsr2DataParam->chainFit = true; + fMsr2DataParam->openFilesAfterFitting = false; + fMsr2DataParam->titleFromDataFile = fTitleFromDataFile; + fMsr2DataParam->createMsrFileOnly = false; + fMsr2DataParam->fitOnly = false; + } + + PMsr2DataDialog *dlg = new PMsr2DataDialog(fMsr2DataParam); + + if (dlg == 0) { + QMessageBox::critical(this, "**ERROR**", "Couldn't invoke msr2data dialog, sorry :-(", QMessageBox::Ok, QMessageBox::NoButton); + return; + } + + if (dlg->exec() == QDialog::Accepted) { + QString first, last; + QString runList; + QString runListFileName; + QFileInfo fi; + QString str; + int i, end; + + fMsr2DataParam = dlg->getMsr2DataParam(); + + // analyze parameters + switch (dlg->getRunTag()) { + case -1: // not valid + QMessageBox::critical(this, "**ERROR**", + "No valid run list input found :-(\nCannot do anything.", + QMessageBox::Ok, QMessageBox::NoButton); + return; + break; + case 0: // first last + first = QString("%1").arg(fMsr2DataParam->firstRun); + last = QString("%1").arg(fMsr2DataParam->lastRun); + if (first.isEmpty() || last.isEmpty()) { + QMessageBox::critical(this, "**ERROR**", + "If you choose the first/last option,\nfirst AND last needs to be provided.", + QMessageBox::Ok, QMessageBox::NoButton); + return; + } + break; + case 1: // run list + runList = fMsr2DataParam->runList; + if (!validRunList(runList)) { + QMessageBox::critical(this, "**ERROR**", + "Invalid Run List!\nThe run list needs to be a space separated list of run numbers.", + QMessageBox::Ok, QMessageBox::NoButton); + return; + } + break; + case 2: // run list file name + runListFileName = fMsr2DataParam->runListFileName; + fi = runListFileName; + if (!fi.exists()) { + str = QString("Run List File '%1' doesn't exist.").arg(runListFileName); + QMessageBox::critical(this, "**ERROR**", + str, QMessageBox::Ok, QMessageBox::NoButton); + return; + } + break; + default: // never should reach this point + QMessageBox::critical(this, "**ERROR**", + "No idea how you could reach this point.\nPlease contact the developers.", + QMessageBox::Ok, QMessageBox::NoButton); + return; + break; + } + + // form command + QVector cmd; + + str = fAdmin->getExecPath() + "/msr2data"; + cmd.append(str); + + // run list argument + switch (dlg->getRunTag()) { + case 0: + cmd.append(first); + cmd.append(last); + break; + case 1: + end = 0; + while (!runList.section(' ', end, end).isEmpty()) { + end++; + } + // first element + if (end == 1) { + str = "[" + runList + "]"; + cmd.append(str); + } else { + str = "[" + runList.section(' ', 0, 0); + cmd.append(str); + // middle elements + for (i=1; imsrFileExtension; + if (str.isEmpty()) + cmd.append(""); + else + cmd.append(str); + + // options + + // no header flag? + if (!fMsr2DataParam->writeDbHeader) + cmd.append("noheader"); + + // no summary flag? + if (!fMsr2DataParam->summaryFilePresent) + cmd.append("nosummary"); + + // template run no fitting but: (i) no fit only flag, (ii) no create msr-file only flag + if ((fMsr2DataParam->templateRunNo != -1) && !fMsr2DataParam->fitOnly && !fMsr2DataParam->createMsrFileOnly) { + str = QString("%1").arg(fMsr2DataParam->templateRunNo); + str = "fit-" + str; + if (!fMsr2DataParam->chainFit) { + str += "!"; + } + cmd.append(str); + } + + // template run no AND create msr-file only flag + if ((fMsr2DataParam->templateRunNo != -1) && fMsr2DataParam->createMsrFileOnly) { + str = QString("%1").arg(fMsr2DataParam->templateRunNo); + str = "msr-" + str; + cmd.append(str); + } + + // fit only + if (fMsr2DataParam->fitOnly) { + str = "fit"; + cmd.append(str); + } + + // keep minuit2 output + if (fMsr2DataParam->keepMinuit2Output) { + cmd.append("-k"); + } + + // replace msr-file title by data file title + if (fMsr2DataParam->titleFromDataFile) { + cmd.append("-t"); + } + + // DB output wished + if (!fMsr2DataParam->dbOutputFileName.isEmpty()) { + str = "-o" + fMsr2DataParam->dbOutputFileName; + cmd.append(str); + } + + // write column data + if (fMsr2DataParam->writeColumnData) { + cmd.append("data"); + } + + // recreate db file + if (fMsr2DataParam->recreateDbFile) { + if (!QFile::remove(fMsr2DataParam->dbOutputFileName)) { + str = QString("Couldn't delete db-file '%1'. Will **NOT** proceed.").arg(fMsr2DataParam->dbOutputFileName); + QMessageBox::critical(this, "**ERROR**", str, + QMessageBox::Ok, QMessageBox::NoButton); + return; + } + } + +/* +for (unsigned int i=0; i> " << cmd[i].toLatin1(); +} +cout << endl; +*/ + + PFitOutputHandler fitOutputHandler(QFileInfo(*fFilenames.find( currentEditor() )).absolutePath(), cmd); + fitOutputHandler.setModal(true); + fitOutputHandler.exec(); + + // check if it is necessary to load msr-files + if (fMsr2DataParam->openFilesAfterFitting) { + QString fln; + QFile *file; + QTextStream *stream; + + switch(dlg->getRunTag()) { + case 0: // first run / last run list + if (fMsr2DataParam->firstRun != -1) { + for (int i=fMsr2DataParam->firstRun; i<=fMsr2DataParam->lastRun; i++) { + if (fMsr2DataParam->msrFileExtension.isEmpty()) + fln = QString("%1").arg(i) + ".msr"; + else + fln = QString("%1").arg(i) + fMsr2DataParam->msrFileExtension + ".msr"; + + load(fln); + } + } + break; + case 1: // run list + end = 0; + while (!runList.section(' ', end, end).isEmpty()) { + end++; + } + for (int i=0; imsrFileExtension.isEmpty()) + fln += ".msr"; + else + fln += fMsr2DataParam->msrFileExtension + ".msr"; + + load(fln); + } + break; + case 2: // run list file + file = new QFile(fMsr2DataParam->runListFileName); + if (!file->open(QIODevice::ReadOnly)) { + str = QString("Couldn't open run list file %1, sorry.").arg(fMsr2DataParam->runListFileName); + QMessageBox::critical(this, "**ERROR**", str.toLatin1(), QMessageBox::Ok, QMessageBox::NoButton); + return; + } + + stream = new QTextStream(file); + while ( !stream->atEnd() ) { + str = stream->readLine(); // line of text excluding '\n' + str.trimmed(); + if (!str.isEmpty() && !str.startsWith("#")) { + fln = str.section(' ', 0, 0); + if (fMsr2DataParam->msrFileExtension.isEmpty()) + fln += ".msr"; + else + fln += fMsr2DataParam->msrFileExtension + ".msr"; + + load(fln); + } + } + + file->close(); + + // clean up + delete stream; + delete file; + break; + default: + break; + } + } + } + + delete dlg; + dlg = 0; +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::musrView() +{ + if ( !currentEditor() ) + return; + + QString tabLabel = fTabWidget->tabText(fTabWidget->currentIndex()); + if (tabLabel == "noname") { + QMessageBox::critical(this, "**ERROR**", "For a view a real mlog/msr-file is needed."); + return; + } else if (tabLabel == "noname*") { + fileSaveAs(); + } else if (tabLabel.indexOf("*") > 0) { + fileSave(); + } + + QString cmd; + QString str; + + str = fAdmin->getExecPath() + "/musrview"; + cmd = str + " \""; + + str = *fFilenames.find( currentEditor() ); + cmd += str + "\" &"; + + system(cmd.toLatin1()); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::musrT0() +{ + if ( !currentEditor() ) + return; + + QString tabLabel = fTabWidget->tabText(fTabWidget->currentIndex()); + if (tabLabel == "noname") { + QMessageBox::critical(this, "**ERROR**", "For a view a real mlog/msr-file is needed."); + return; + } else if (tabLabel == "noname*") { + fileSaveAs(); + } else if (tabLabel.indexOf("*") > 0) { + fileSave(); + } + + QString cmd; + QString str; + + str = fAdmin->getExecPath() + "/musrt0"; + cmd = str + " \""; + + str = *fFilenames.find( currentEditor() ); + cmd += str + "\" &"; + + system(cmd.toLatin1()); + + QString fln = *fFilenames.find( currentEditor() ); +/* + fFileWatcher = new PFileWatcher(fln, currentEditor()->getLastModified()); + fFileWatcher->modified(3600); + connect(fFileWatcher, SIGNAL( changed() ), this, SLOT( fileReload() )); +*/ +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::musrPrefs() +{ + PPrefsDialog *dlg = new PPrefsDialog(fKeepMinuit2Output, fDump, fTitleFromDataFile, fEnableMusrT0); + if (dlg == 0) { + QMessageBox::critical(this, "**ERROR** musrPrefs", "Couldn't invoke Preferences Dialog."); + return; + } + + if (dlg->exec() == QDialog::Accepted) { + fKeepMinuit2Output = dlg->getKeepMinuit2OutputFlag(); + fTitleFromDataFile = dlg->getTitleFromDataFileFlag(); + fEnableMusrT0 = dlg->getEnableMusrT0Flag(); + fMusrT0Action->setEnabled(fEnableMusrT0); + fDump = dlg->getDump(); + } + + delete dlg; + dlg = 0; +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::musrSwapMsrMlog() +{ + if ( !currentEditor() ) + return; + + // get current file name + QString currentFileName = *fFilenames.find( currentEditor() ); + QString swapFileName; + QString tempFileName = QString("__swap__.msr"); + + // check if it is a msr-, mlog-, or another file + int idx; + if ((idx = currentFileName.indexOf(".msr")) > 0) { // msr-file + swapFileName = currentFileName; + swapFileName.replace(idx, 5, ".mlog"); + } else if ((idx = currentFileName.indexOf(".mlog")) > 0) { // mlog-file + swapFileName = currentFileName; + swapFileName.replace(idx, 5, ".msr "); + swapFileName = swapFileName.trimmed(); + } else { // neither a msr- nor a mlog-file + QMessageBox::information( this, "musrSwapMsrMlog", + "This is neither a msr- nor a mlog-file, hence nothing to be swapped.\n", + QMessageBox::Ok ); + return; + } + + // check if the swapFile exists + if (!QFile::exists(swapFileName)) { + QString msg = "swap file '" + swapFileName + "' doesn't exist.\nCannot swap anything."; + QMessageBox::warning( this, "musrSwapMsrMlog", + msg, QMessageBox::Ok, QMessageBox::NoButton ); + return; + } + + // check if the file needs to be saved + if (fTabWidget->tabText(fTabWidget->currentIndex()).indexOf("*") > 0) { // needs to be saved first + fileSave(); + } + + // swap files + QString cmd; + cmd = QString("cp \"") + currentFileName + QString("\" \"") + tempFileName + QString("\""); + system(cmd.toLatin1()); + cmd = QString("cp \"") + swapFileName + QString("\" \"") + currentFileName + QString("\""); + system(cmd.toLatin1()); + cmd = QString("cp \"") + tempFileName + QString("\" \"") + swapFileName + QString("\""); + system(cmd.toLatin1()); + cmd = QString("rm \"") + tempFileName + QString("\""); + system(cmd.toLatin1()); + + int currentIdx = fTabWidget->currentIndex(); + + // reload current file + fileClose(); + load(currentFileName); + + // check if swap file is open as well, and if yes, reload it + idx = -1; + for (int i=0; icount(); i++) { + if (fTabWidget->tabText(i).indexOf(swapFileName) >= 0) { + idx = i; + break; + } + } + if (idx >= 0) { // swap file is open + fTabWidget->setCurrentIndex(idx); + fileClose(); + load(swapFileName); + fTabWidget->setCurrentIndex(currentIdx); + } +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::helpContents() +{ + QMessageBox::information( this, "helpContents", + fAdmin->getHelpMain(), + QMessageBox::Ok ); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::helpAbout() +{ + PMusrEditAbout *about = new PMusrEditAbout(); + about->show(); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::helpAboutQt() +{ + QMessageBox::aboutQt(this); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::fontChanged( const QFont &f ) +{ + fFontChanging = true; + fComboFont->lineEdit()->setText( f.family() ); + fComboSize->lineEdit()->setText( QString::number( f.pointSize() ) ); + currentEditor()->setFont(f); + currentEditor()->setWindowModified(false); + currentEditor()->viewport()->setFocus(); + fFontChanging = false; +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::textChanged(const bool forced) +{ + if (!currentEditor()) + return; + + if (fFontChanging) + return; + + QString tabLabel = fTabWidget->tabText(fTabWidget->currentIndex()); + + if ((fTabWidget->tabText(fTabWidget->currentIndex()).indexOf("*") > 0) && + !currentEditor()->document()->isModified()) { + tabLabel.truncate(tabLabel.length()-1); + fTabWidget->setTabText(fTabWidget->indexOf(fTabWidget), tabLabel); + } + + if ((fTabWidget->tabText(fTabWidget->currentIndex()).indexOf("*") < 0) && + currentEditor()->document()->isModified()) + fTabWidget->setTabText(fTabWidget->indexOf(fTabWidget), tabLabel+"*"); + + if ((fTabWidget->tabText(fTabWidget->currentIndex()).indexOf("*") < 0) && + forced) + fTabWidget->setTabText(fTabWidget->indexOf(fTabWidget), tabLabel+"*"); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::currentCursorPosition() +{ + QString str; + int line=0, pos=0; + + pos = currentEditor()->textCursor().columnNumber(); + line = currentEditor()->textCursor().blockNumber(); + + str = QString("cursor pos: %1, %2").arg(line+1).arg(pos+1); + statusBar()->showMessage(str); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::replace() +{ + currentEditor()->insertPlainText(fFindReplaceData->replaceText); + + editFindNext(); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::replaceAndClose() +{ + currentEditor()->insertPlainText(fFindReplaceData->replaceText); + + emit close(); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::replaceAll() +{ +// NEEDS TO BE REWRITTEN SINCE Qt4.6 IS FAR TOO DIFFERENT TO Qt3.x +/* + int currentPara, currentIndex; + currentEditor()->getCursorPosition(¤tPara, ¤tIndex); + + currentEditor()->setCursorPosition(0,0); + + int para = 1, index = 1; + while (currentEditor()->find(fFindReplaceData->findText, + fFindReplaceData->caseSensitive, + fFindReplaceData->wholeWordsOnly, + true, + ¶, &index)) { + // set cursor to the correct position + currentEditor()->setCursorPosition(para, index); + + // replace the text + currentEditor()->insert(fFindReplaceData->replaceText); + + index++; + } + + emit close(); + + currentEditor()->setCursorPosition(currentPara, currentIndex); +*/ +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::applyFontSettings(QWidget*) +{ + QFont font(fAdmin->getFontName(), fAdmin->getFontSize()); + fontChanged(font); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::checkIfModified(QWidget*) +{ + /* + if ( fTabWidget->currentWidget() && fTabWidget->currentWidget()->inherits( "PSubTextEdit" ) ) { + QString fln = *fFilenames.find( currentEditor() ); + PFileWatcher fw(fln, currentEditor()->getLastModified()); + if (fw.isValid()) { + if (fw.modified()) { + int result = QMessageBox::information( this, "**INFO**", + "File modified on disk. Do you want to reload it?", + QMessageBox::Yes, QMessageBox::No); + if (result == QMessageBox::Yes) { + fileReload(); + } else { + textChanged(true); + } + } + } + } + */ +} + +//---------------------------------------------------------------------------------------------------- +// END +//---------------------------------------------------------------------------------------------------- diff --git a/src/musredit/PTextEdit.h b/src/musredit/PTextEdit.h new file mode 100644 index 00000000..5da096f8 --- /dev/null +++ b/src/musredit/PTextEdit.h @@ -0,0 +1,159 @@ +/**************************************************************************** + + PTextEdit.h + + Author: Andreas Suter + e-mail: andreas.suter@psi.ch + + $Id$ + +*****************************************************************************/ + +/*************************************************************************** + * Copyright (C) 2010 by Andreas Suter * + * andreas.suter@psi.ch * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef _PTEXTEDIT_H_ +#define _PTEXTEDIT_H_ + +#include +#include + +#include "musredit.h" +//#include "PFileWatcher.h" + +class PSubTextEdit; +class PAdmin; +class QAction; +class QComboBox; +class QTabWidget; +class QTextEdit; +class QMenu; + +class PTextEdit : public QMainWindow +{ + Q_OBJECT + +public: + PTextEdit( QWidget *parent = 0, Qt::WindowFlags f = 0 ); + virtual ~PTextEdit(); + +signals: + void close(); + +private: + void setupFileActions(); + void setupEditActions(); + void setupTextActions(); + void setupMusrActions(); + void setupHelpActions(); + void load( const QString &f, const int index=-1 ); + PSubTextEdit *currentEditor() const; + void doConnections( PSubTextEdit *e ); + bool validRunList(const QString runList); + +private slots: + void insertTitle(); + void insertParameterBlock(); + void insertTheoryBlock(); + void insertFunctionBlock(); + void insertAsymRunBlock(); + void insertSingleHistRunBlock(); + void insertNonMusrRunBlock(); + void insertCommandBlock(); + void insertFourierBlock(); + void insertPlotBlock(); + void insertStatisticBlock(); + + void fileNew(); + void fileOpen(); + void fileReload(); + void fileSave(); + void fileSaveAs(); + void filePrint(); + void fileClose( const bool check = true ); + void fileCloseAll(); + void fileCloseAllOthers(); + void fileExit(); + + void editUndo(); + void editRedo(); + void editSelectAll(); + void editCut(); + void editCopy(); + void editPaste(); + void editFind(); + void editFindNext(); + void editFindPrevious(); + void editFindAndReplace(); + void editComment(); + + void textFamily( const QString &f ); + void textSize( const QString &p ); + + void musrGetAsymmetryDefault(); + void musrGetSingleHistoDefault(); + void musrCalcChisq(); + void musrFit(); + void musrMsr2Data(); + void musrView(); + void musrT0(); + void musrPrefs(); + void musrSwapMsrMlog(); + + void helpContents(); + void helpAboutQt(); + void helpAbout(); + + void fontChanged( const QFont &f ); + void textChanged(const bool forced = false); + void currentCursorPosition(); + + void replace(); + void replaceAndClose(); + void replaceAll(); + + void applyFontSettings(QWidget*); + void checkIfModified(QWidget*); + +private: + PAdmin *fAdmin; + + QAction *fMusrT0Action; + + bool fKeepMinuit2Output; + bool fTitleFromDataFile; + bool fEnableMusrT0; + int fDump; + + PMsr2DataParam *fMsr2DataParam; + PFindReplaceData *fFindReplaceData; + + QComboBox *fComboFont; + QComboBox *fComboSize; + bool fFontChanging; ///< flag needed to prevent some textChanged feature to occure when only the font changed + + QTabWidget *fTabWidget; + QMap fFilenames; + +// PFileWatcher *fFileWatcher; +}; + + +#endif // _PTEXTEDIT_H_ diff --git a/src/musredit/asymDefault.msr b/src/musredit/asymDefault.msr new file mode 100644 index 00000000..b486c1ba --- /dev/null +++ b/src/musredit/asymDefault.msr @@ -0,0 +1,59 @@ +TITLE +############################################################### +FITPARAMETER +# Nr. Name Value Step Pos_Error Boundaries + 1 alpha 0.989765 1.0 none 0 none + 2 asy 0.26 0.1 none 0 0.33 + 3 phase 8.5 1.0 none + 4 field 100.0 0.1 none 0 none + 5 rate 0.36 0.02 none 0 100 + +############################################################### +THEORY +asymmetry 2 +TFieldCos 3 fun1 (phase frequency) +simplExpo 5 + +############################################################### +FUNCTIONS +fun1 = par4 * gamma_mu + +############################################################### +RUN lem07_his_0147 MUE4 PSI ROOT-NPP (name beamline institute data-file-format) +fittype 2 (asymmetry fit) +alpha 1 +map 0 0 0 0 0 0 0 0 0 0 +forward 1 +backward 3 +background 65000 66500 65000 66500 +data 3413 63000 3413 63000 +t0 3413 3413 +fit 0.00 8.00 (fw bw) +packing 75 + +############################################################### +COMMANDS +SET BATCH +MINIMIZE +MINOS +SAVE +END RETURN + +############################################################### +FOURIER +units Gauss # fourier in field units +fourier_power 12 +apodization NONE # NONE, WEAK, MEDIUM, STRONG +plot power +phase 8.5 +#range_for_phase_correction 50.0 70.0 +range 0.0 200.0 + +############################################################### +PLOT 2 (asymmetry plot) +runs 1 +range 0.00 8.00 -0.30 0.30 + +############################################################### +STATISTIC --- 2008-04-04 07:44:31 + chisq = 569.50931, NDF = 542, chisq/NDF = 1.05075518 diff --git a/src/musredit/forms/PFindDialog.ui b/src/musredit/forms/PFindDialog.ui new file mode 100644 index 00000000..7df2bfca --- /dev/null +++ b/src/musredit/forms/PFindDialog.ui @@ -0,0 +1,246 @@ + + + PFindDialog + + + + 0 + 0 + 345 + 237 + + + + Find Text - musredit + + + + :/images/musrfit.xpm:/images/musrfit.xpm + + + + + 0 + 0 + 341 + 81 + + + + Find + + + + + 10 + 20 + 91 + 16 + + + + Text to find: + + + + + + 10 + 40 + 321 + 31 + + + + true + + + + + + + 190 + 210 + 71 + 25 + + + + &Find + + + + + + 270 + 210 + 71 + 25 + + + + &Close + + + + + + 0 + 80 + 341 + 121 + + + + Options + + + Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft + + + + + 10 + 30 + 141 + 23 + + + + C&ase Sensitive + + + + + + 10 + 60 + 141 + 23 + + + + &Whole words only + + + + + + 10 + 90 + 141 + 23 + + + + From c&ursor + + + + + + 180 + 30 + 141 + 23 + + + + Find &backwards + + + + + + 180 + 60 + 141 + 23 + + + + &Selected text + + + + + + + 0 + 200 + 351 + 16 + + + + Qt::Horizontal + + + + + fFind_comboBox + fCaseSensitive_checkBox + fWholeWordsOnly_checkBox + fFromCursor_checkBox + fFindBackwards_checkBox + fSelectedText_checkBox + fFind_pushButton + fClose_pushButton + + + + + + + fClose_pushButton + clicked() + PFindDialog + reject() + + + 287 + 205 + + + 344 + 228 + + + + + fFind_pushButton + clicked() + PFindDialog + accept() + + + 208 + 211 + + + 171 + 211 + + + + + fFind_comboBox + editTextChanged(QString) + PFindDialog + onFindTextAvailable(QString) + + + 126 + 58 + + + 105 + 218 + + + + + + onFindTextAvailable(QString) + + diff --git a/src/musredit/forms/PGetAsymmetryRunBlockDialog.ui b/src/musredit/forms/PGetAsymmetryRunBlockDialog.ui new file mode 100644 index 00000000..87430f83 --- /dev/null +++ b/src/musredit/forms/PGetAsymmetryRunBlockDialog.ui @@ -0,0 +1,707 @@ + + + PGetAsymmetryRunBlockDialog + + + Qt::WindowModal + + + + 0 + 0 + 446 + 503 + + + + Get Asymmetry Run Block Parameters + + + + :/images/musrfit.xpm:/images/musrfit.xpm + + + + + 0 + 0 + 441 + 121 + + + + Run Header Info + + + + + 20 + 30 + 91 + 16 + + + + Run File Name + + + + + + 20 + 60 + 71 + 16 + + + + Beamline + + + + + + 20 + 90 + 56 + 16 + + + + Institute + + + + + + 260 + 90 + 91 + 16 + + + + File Format + + + + + + 120 + 26 + 311 + 26 + + + + + + + 120 + 56 + 113 + 26 + + + + + + + 120 + 86 + 77 + 25 + + + + + PSI + + + + + RAL + + + + + TRIUMF + + + + + JPARC + + + + + + + 336 + 86 + 91 + 25 + + + + + NeXuS + + + + + ROOT-NPP + + + + + ROOT-PPC + + + + + PSI-BIN + + + + + PSI-MDU + + + + + MUD + + + + + MDU-ASCII + + + + + ASCII + + + + + DB + + + + + + + + 0 + 120 + 441 + 241 + + + + Required Entries + + + + + 20 + 30 + 56 + 16 + + + + Map + + + + + + 20 + 60 + 111 + 16 + + + + Forward Histo No + + + + + + 240 + 60 + 121 + 16 + + + + Backward Histo No + + + + + + 20 + 90 + 81 + 16 + + + + Data Range + + + + + + 20 + 120 + 111 + 16 + + + + Background Fix + + + + + + 310 + 120 + 31 + 16 + + + + + 75 + true + + + + OR + + + + + + 20 + 150 + 121 + 16 + + + + Background Range + + + + + + 20 + 180 + 71 + 16 + + + + Fit Range + + + + + + 60 + 26 + 371 + 26 + + + + 0 0 0 0 0 0 0 0 0 + + + + + + 150 + 56 + 71 + 26 + + + + + + + 360 + 56 + 71 + 26 + + + + + + + 150 + 86 + 71 + 26 + + + + + + + 220 + 86 + 71 + 26 + + + + + + + 290 + 86 + 71 + 26 + + + + + + + 360 + 86 + 71 + 26 + + + + + + + 150 + 116 + 71 + 26 + + + + + + + 220 + 116 + 71 + 26 + + + + + + + 150 + 146 + 71 + 26 + + + + + + + 220 + 146 + 71 + 26 + + + + + + + 290 + 146 + 71 + 26 + + + + + + + 360 + 146 + 71 + 26 + + + + + + + 150 + 176 + 71 + 26 + + + + + + + 220 + 176 + 71 + 26 + + + + + + + 150 + 206 + 71 + 26 + + + + 1 + + + + + + 20 + 210 + 111 + 16 + + + + Packing/Binning + + + + + + + 0 + 360 + 441 + 91 + + + + Optional Entries + + + + + 20 + 30 + 131 + 16 + + + + Alpha (default = 1.0) + + + + + + 240 + 30 + 121 + 16 + + + + Beta (default = 1.0) + + + + + + 20 + 60 + 241 + 16 + + + + t0 (reqired if not given in the data file) + + + + + + 150 + 26 + 71 + 26 + + + + + + + + + + 360 + 26 + 71 + 26 + + + + + + + + + + 290 + 56 + 71 + 26 + + + + + + + 360 + 56 + 71 + 26 + + + + + + + + 0 + 460 + 441 + 36 + + + + + + + Qt::Horizontal + + + + + + + + + &Help + + + + + + + Qt::Horizontal + + + + 188 + 20 + + + + + + + + &OK + + + + + + + &Cancel + + + + + + + + + + + + + + fCancel_pushButton + clicked() + PGetAsymmetryRunBlockDialog + reject() + + + 458 + 434 + + + 471 + 415 + + + + + fOk_pushButton + clicked() + PGetAsymmetryRunBlockDialog + accept() + + + 394 + 438 + + + 407 + 406 + + + + + fHelp_pushButton + clicked() + PGetAsymmetryRunBlockDialog + helpContent() + + + 47 + 437 + + + 70 + 398 + + + + + + helpContent() + + diff --git a/src/musredit/forms/PGetDefaultDialog.ui b/src/musredit/forms/PGetDefaultDialog.ui new file mode 100644 index 00000000..a635a699 --- /dev/null +++ b/src/musredit/forms/PGetDefaultDialog.ui @@ -0,0 +1,312 @@ + + + PGetDefaultDialog + + + + 0 + 0 + 400 + 168 + + + + Run + + + + :/images/musrfit.xpm:/images/musrfit.xpm + + + + + 10 + 130 + 381 + 25 + + + + + + + &Help + + + + + + + Qt::Horizontal + + + + 118 + 20 + + + + + + + + &OK + + + + + + + &Cancel + + + + + + + + + 10 + 10 + 381 + 22 + + + + + + + Run File Name + + + + + + + + + + + + 10 + 40 + 381 + 22 + + + + + + + + 68 + 0 + + + + Beamline + + + + + + + + + + + + 10 + 70 + 156 + 22 + + + + + + + + 68 + 0 + + + + Institute + + + + + + + + 80 + 0 + + + + + PSI + + + + + RAL + + + + + TRIUMF + + + + + JPARC + + + + + + + + + + 10 + 100 + 156 + 22 + + + + + + + + 68 + 0 + + + + File Format + + + + + + + + NeXuS + + + + + ROOT-NPP + + + + + ROOT-PPC + + + + + PSI-BIN + + + + + MDU + + + + + MDU-ASCII + + + + + MUD + + + + + WKM + + + + + ASCII + + + + + DB + + + + + + + + + fOk_pushButton + fCancel_pushButton + fHelp_pushButton + + + + + + + fCancel_pushButton + clicked() + PGetDefaultDialog + reject() + + + 337 + 272 + + + 355 + 225 + + + + + fOk_pushButton + clicked() + PGetDefaultDialog + accept() + + + 286 + 265 + + + 243 + 227 + + + + + fHelp_pushButton + clicked() + PGetDefaultDialog + helpContent() + + + 50 + 273 + + + 115 + 221 + + + + + + helpContent() + + diff --git a/src/musredit/forms/PGetFourierBlockDialog.ui b/src/musredit/forms/PGetFourierBlockDialog.ui new file mode 100644 index 00000000..fd24e506 --- /dev/null +++ b/src/musredit/forms/PGetFourierBlockDialog.ui @@ -0,0 +1,391 @@ + + + PGetFourierBlockDialog + + + + 0 + 0 + 400 + 300 + + + + Get Fourier + + + + :/images/musrfit.xpm:/images/musrfit.xpm + + + + + 10 + 260 + 381 + 32 + + + + + + + &Help + + + + + + + Qt::Horizontal + + + + 118 + 20 + + + + + + + + &OK + + + + + + + &Cancel + + + + + + + + + 40 + 20 + 61 + 17 + + + + Units + + + + + + 30 + 40 + 151 + 17 + + + + Fourier Power + + + + + + 40 + 70 + 141 + 17 + + + + Apodization + + + + + + 50 + 100 + 61 + 17 + + + + Plot + + + + + + 40 + 140 + 61 + 17 + + + + Phase + + + + + + 30 + 170 + 111 + 41 + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> +<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Lucida Grande'; font-size:8pt;">Phase Correction</span></p> +<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Lucida Grande'; font-size:8pt;">Range</span></p></body></html> + + + + + + 30 + 220 + 61 + 17 + + + + Range + + + + + + 170 + 10 + 111 + 26 + + + + + Gauss + + + + + MHz + + + + + Mc/s + + + + + + + 170 + 40 + 113 + 22 + + + + + + + 170 + 70 + 111 + 26 + + + + + None + + + + + Weak + + + + + Medium + + + + + Strong + + + + + + + 160 + 100 + 111 + 26 + + + + + Power + + + + + Real + + + + + Imag + + + + + Real & Imag + + + + + Phase + + + + + + + 160 + 140 + 113 + 22 + + + + + + + 150 + 170 + 113 + 22 + + + + + + + 270 + 170 + 113 + 22 + + + + + + + 150 + 210 + 113 + 22 + + + + + + + 280 + 210 + 113 + 22 + + + + + + fOk_pushButton + fCancel_pushButton + fHelp_pushButton + + + + + + + fCancel_pushButton + clicked() + PGetFourierBlockDialog + reject() + + + 337 + 272 + + + 355 + 225 + + + + + fOk_pushButton + clicked() + PGetFourierBlockDialog + accept() + + + 286 + 265 + + + 243 + 227 + + + + + fHelp_pushButton + clicked() + PGetFourierBlockDialog + helpContent() + + + 50 + 273 + + + 115 + 221 + + + + + fOk_pushButton + clicked() + PGetFourierBlockDialog + fillFourierBlock() + + + 247 + 274 + + + 175 + 264 + + + + + + helpContent() + fillFourierBlock() + + diff --git a/src/musredit/forms/PGetFunctionsBlockDialog.ui b/src/musredit/forms/PGetFunctionsBlockDialog.ui new file mode 100644 index 00000000..dc8efe8a --- /dev/null +++ b/src/musredit/forms/PGetFunctionsBlockDialog.ui @@ -0,0 +1,253 @@ + + + PGetFunctionsBlockDialog + + + + 0 + 0 + 636 + 604 + + + + Get Functions + + + + :/images/musrfit.xpm:/images/musrfit.xpm + + + + + 0 + 570 + 631 + 32 + + + + + + + &Help + + + + + + + Qt::Horizontal + + + + 118 + 20 + + + + + + + + &OK + + + + + + + &Cancel + + + + + + + + + 0 + 10 + 631 + 201 + + + + true + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans'; font-size:10pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Lucida Grande';">Supported basic arithmetics: </span><span style=" font-family:'Courier New,courier';">+, -, *, /, ()</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Lucida Grande';">Supported built-in functions; </span><span style=" font-family:'Courier New,courier';">cos(), sin(), tan(), acos(), asin(), atan(), cosh(), sinh(), tanh(), acosh(), asinh(), atanh(), exp(), log(), ln()</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Lucida Grande';">Supported pre-defined constants</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">gamma_mu = 0.0135538817 (MHz/G)</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">pi = 3.1415926535897932846</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Lucida Grande';">Parameters and Maps are reached via parX, mapY, where X, Y are numbers, e.g. par1, map3</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Lucida Grande';">Examples:</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">fun1 = gamma_mu * par3</span><span style=" font-family:'Lucida Grande';"> valid</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">fun2 = par2/map4 * sin(par3*par5)</span><span style=" font-family:'Lucida Grande';"> valid</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">fun3 = fun1 + par6</span><span style=" font-family:'Lucida Grande';"> invalid, since functions cannot be used with the functions definition</span></p></body></html> + + + + + + 0 + 210 + 631 + 101 + + + + Input + + + + + 90 + 30 + 521 + 22 + + + + + + + 20 + 30 + 71 + 17 + + + + Function: + + + + + + 500 + 60 + 113 + 32 + + + + Add + + + + + + + 0 + 310 + 631 + 251 + + + + ##################################################### +FUNCTIONS + + + + + fOk_pushButton + fCancel_pushButton + fHelp_pushButton + + + + + + + fCancel_pushButton + clicked() + PGetFunctionsBlockDialog + reject() + + + 629 + 584 + + + 368 + 565 + + + + + fOk_pushButton + clicked() + PGetFunctionsBlockDialog + accept() + + + 538 + 577 + + + 265 + 583 + + + + + fHelp_pushButton + clicked() + PGetFunctionsBlockDialog + helpContent() + + + 41 + 585 + + + 111 + 582 + + + + + fAdd_pushButton + clicked() + PGetFunctionsBlockDialog + addFunction() + + + 555 + 289 + + + 410 + 591 + + + + + fFunctionInput_lineEdit + returnPressed() + PGetFunctionsBlockDialog + addFunction() + + + 399 + 252 + + + 413 + 570 + + + + + + helpContent() + addFunction() + + diff --git a/src/musredit/forms/PGetNonMusrRunBlockDialog.ui b/src/musredit/forms/PGetNonMusrRunBlockDialog.ui new file mode 100644 index 00000000..06cd0514 --- /dev/null +++ b/src/musredit/forms/PGetNonMusrRunBlockDialog.ui @@ -0,0 +1,462 @@ + + + PGetNonMusrRunBlockDialog + + + + 0 + 0 + 402 + 300 + + + + Get NonMusr Run Block Parameters + + + + :/images/musrfit.xpm:/images/musrfit.xpm + + + + + 0 + 0 + 401 + 131 + + + + Run Header Info + + + + + 10 + 30 + 381 + 28 + + + + + + + Run File Name + + + + + + + + + + + + 11 + 60 + 381 + 28 + + + + + + + Beamline + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 23 + 20 + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + 10 + 91 + 381 + 27 + + + + + + + Institute + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 34 + 20 + + + + + + + + + PSI + + + + + RAL + + + + + TRIUMF + + + + + JPARC + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + File Format + + + + + + + + ASCII + + + + + DB + + + + + + + + + + + 0 + 130 + 401 + 131 + + + + Required Entries + + + + + 10 + 30 + 381 + 28 + + + + + + + Map + + + + + + + 0 0 0 0 0 0 0 0 0 0 + + + + + + + + + 11 + 60 + 281 + 28 + + + + + + + xy-Data + + + + + + + Qt::Horizontal + + + + 37 + 20 + + + + + + + + + + + + + + + + 10 + 92 + 291 + 28 + + + + + + + + 0 + 0 + + + + Fit Range + + + + + + + + 0 + 0 + + + + + 105 + 0 + + + + + 105 + 16777215 + + + + + + + + + 0 + 0 + + + + + 105 + 0 + + + + + 105 + 16777215 + + + + + + + + + + + 10 + 270 + 381 + 27 + + + + + + + &Help + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + &OK + + + + + + + &Cancel + + + + + + + + fRunFileName_lineEdit + fBeamline_lineEdit + fInstitute_comboBox + fFileFormat_comboBox + fMap_lineEdit + fXData_lineEdit + fYData_lineEdit + fFitRangeStart_lineEdit + fFitRangeEnd_lineEdit + fOk_pushButton + fCancel_pushButton + fHelp_pushButton + + + + + + + fCancel_pushButton + clicked() + PGetNonMusrRunBlockDialog + reject() + + + 337 + 281 + + + 364 + 216 + + + + + fOk_pushButton + clicked() + PGetNonMusrRunBlockDialog + accept() + + + 289 + 277 + + + 238 + 220 + + + + + fHelp_pushButton + clicked() + PGetNonMusrRunBlockDialog + helpContent() + + + 37 + 286 + + + 78 + 229 + + + + + + helpContent() + + diff --git a/src/musredit/forms/PGetParameterBlockDialog.ui b/src/musredit/forms/PGetParameterBlockDialog.ui new file mode 100644 index 00000000..686a5c62 --- /dev/null +++ b/src/musredit/forms/PGetParameterBlockDialog.ui @@ -0,0 +1,344 @@ + + + PGetParameterBlockDialog + + + + 0 + 0 + 656 + 476 + + + + Get Parameter + + + + :/images/musrfit.xpm:/images/musrfit.xpm + + + + + 10 + 430 + 631 + 32 + + + + + + + &Help + + + + + + + Qt::Horizontal + + + + 118 + 20 + + + + + + + + &OK + + + + + + + &Cancel + + + + + + + + + 10 + 90 + 631 + 331 + + + + ############################################################### +FITPARAMETER +# Nr. Name Value Step Pos_Error Boundaries + + + + + + 560 + 50 + 75 + 23 + + + + &Add + + + + + + 10 + 30 + 31 + 13 + + + + No. + + + + + + 60 + 30 + 46 + 13 + + + + Name + + + + + + 180 + 30 + 46 + 13 + + + + Value + + + + + + 270 + 30 + 46 + 13 + + + + Step + + + + + + 370 + 10 + 171 + 71 + + + + Boundaries + + + + + 10 + 20 + 46 + 13 + + + + Lower + + + + + + 90 + 20 + 46 + 13 + + + + Upper + + + + + + 10 + 40 + 71 + 20 + + + + none + + + + + + 90 + 40 + 71 + 20 + + + + none + + + + + + + 10 + 50 + 42 + 22 + + + + 1 + + + 999 + + + + + + 60 + 50 + 113 + 20 + + + + + + + 180 + 50 + 81 + 20 + + + + + + + 270 + 50 + 81 + 20 + + + + + + fParamNo_spinBox + fName_lineEdit + fValue_lineEdit + fStep_lineEdit + fLower_lineEdit + fUpper_lineEdit + fAdd_pushButton + fOk_pushButton + fCancel_pushButton + fParam_plainTextEdit + fHelp_pushButton + + + + + + + fCancel_pushButton + clicked() + PGetParameterBlockDialog + reject() + + + 639 + 434 + + + 338 + 429 + + + + + fOk_pushButton + clicked() + PGetParameterBlockDialog + accept() + + + 548 + 436 + + + 448 + 438 + + + + + fAdd_pushButton + clicked() + PGetParameterBlockDialog + paramAdd() + + + 594 + 59 + + + 562 + 16 + + + + + fHelp_pushButton + clicked() + PGetParameterBlockDialog + helpContent() + + + 62 + 447 + + + 148 + 443 + + + + + + helpContent() + paramAdd() + + diff --git a/src/musredit/forms/PGetPlotBlockDialog.ui b/src/musredit/forms/PGetPlotBlockDialog.ui new file mode 100644 index 00000000..c3f30adf --- /dev/null +++ b/src/musredit/forms/PGetPlotBlockDialog.ui @@ -0,0 +1,300 @@ + + + PGetPlotBlockDialog + + + + 0 + 0 + 594 + 349 + + + + Get Plot + + + + :/musredit/musrfit.xpm:/musredit/musrfit.xpm + + + + + 10 + 310 + 571 + 29 + + + + + + + &Help + + + + + + + Qt::Horizontal + + + + 118 + 20 + + + + + + + + &OK + + + + + + + &Cancel + + + + + + + + + 10 + 70 + 571 + 231 + + + + + + + 10 + 15 + 46 + 13 + + + + Type + + + + + + 60 + 10 + 141 + 22 + + + + + Single Histo + + + + + Asymmetry + + + + + MuMinus + + + + + NonMusr + + + + + + + 10 + 45 + 46 + 13 + + + + Run List + + + + + + 60 + 40 + 141 + 20 + + + + + + + 220 + 15 + 91 + 13 + + + + Time-/x-Range + + + + + + 320 + 10 + 81 + 20 + + + + + + + 410 + 10 + 81 + 20 + + + + + + + 220 + 45 + 61 + 13 + + + + y-Range + + + + + + 320 + 40 + 81 + 20 + + + + + + + 410 + 40 + 81 + 20 + + + + + + + 500 + 25 + 75 + 23 + + + + &Add + + + + + fOk_pushButton + fCancel_pushButton + fHelp_pushButton + + + + + + + fCancel_pushButton + clicked() + PGetPlotBlockDialog + reject() + + + 579 + 311 + + + 355 + 225 + + + + + fOk_pushButton + clicked() + PGetPlotBlockDialog + accept() + + + 488 + 311 + + + 243 + 227 + + + + + fHelp_pushButton + clicked() + PGetPlotBlockDialog + helpContent() + + + 51 + 311 + + + 115 + 221 + + + + + fAdd_pushButton + clicked() + PGetPlotBlockDialog + addPlot() + + + 536 + 36 + + + 291 + 316 + + + + + + helpContent() + addPlot() + + diff --git a/src/musredit/forms/PGetSingleHistoRunBlockDialog.ui b/src/musredit/forms/PGetSingleHistoRunBlockDialog.ui new file mode 100644 index 00000000..ea57afaf --- /dev/null +++ b/src/musredit/forms/PGetSingleHistoRunBlockDialog.ui @@ -0,0 +1,654 @@ + + + PGetSingleHistoRunBlockDialog + + + Qt::WindowModal + + + + 0 + 0 + 424 + 586 + + + + Get Single Histogram Run Block Parameters + + + + :/images/musrfit.xpm:/images/musrfit.xpm + + + + + 0 + 0 + 421 + 121 + + + + Run Header Info + + + + + 20 + 30 + 91 + 16 + + + + Run File Name + + + + + + 20 + 60 + 71 + 16 + + + + Beamline + + + + + + 20 + 90 + 56 + 16 + + + + Institute + + + + + + 240 + 90 + 91 + 16 + + + + File Format + + + + + + 120 + 26 + 291 + 26 + + + + + + + 120 + 56 + 113 + 26 + + + + + + + 120 + 86 + 77 + 25 + + + + + PSI + + + + + RAL + + + + + TRIUMF + + + + + JPARC + + + + + + + 316 + 86 + 91 + 25 + + + + + NeXuS + + + + + ROOT-NPP + + + + + ROOT-PPC + + + + + PSI-BIN + + + + + PSI-MDU + + + + + MUD + + + + + MDU-ASCII + + + + + ASCII + + + + + DB + + + + + + + + 0 + 120 + 421 + 301 + + + + Required Entries + + + + + 20 + 30 + 56 + 16 + + + + Map + + + + + + 20 + 60 + 111 + 20 + + + + Forward Histo No + + + + + + 20 + 120 + 81 + 16 + + + + Data Range + + + + + + 20 + 150 + 111 + 16 + + + + Background Fix + + + + + + 240 + 150 + 31 + 16 + + + + + 75 + true + + + + OR + + + + + + 20 + 210 + 121 + 16 + + + + Background Range + + + + + + 20 + 240 + 71 + 16 + + + + Fit Range + + + + + + 60 + 26 + 351 + 26 + + + + 0 0 0 0 0 0 0 0 0 + + + + + + 150 + 56 + 71 + 26 + + + + + + + 150 + 116 + 71 + 26 + + + + + + + 220 + 116 + 71 + 26 + + + + + + + 150 + 146 + 71 + 26 + + + + + + + 150 + 206 + 71 + 26 + + + + + + + 220 + 206 + 71 + 26 + + + + + + + 150 + 236 + 71 + 26 + + + + + + + 220 + 236 + 71 + 26 + + + + + + + 150 + 266 + 71 + 26 + + + + 1 + + + + + + 20 + 270 + 111 + 16 + + + + Packing/Binning + + + + + + 20 + 90 + 56 + 20 + + + + Norm + + + + + + 150 + 86 + 71 + 26 + + + + + + + 20 + 180 + 101 + 16 + + + + Background Fit + + + + + + 150 + 176 + 71 + 26 + + + + + + + + 0 + 410 + 421 + 121 + + + + Optional Entries + + + + + 20 + 30 + 241 + 16 + + + + t0 (reqired if not given in the data file) + + + + + + 260 + 26 + 71 + 26 + + + + + + + 20 + 60 + 211 + 16 + + + + Muon Lifetime Parameter + + + + + + 180 + 56 + 71 + 26 + + + + + + + 18 + 90 + 151 + 23 + + + + Lifetime Correction + + + + + + + 0 + 545 + 421 + 36 + + + + + + + Qt::Horizontal + + + + + + + + + &Help + + + + + + + Qt::Horizontal + + + + 188 + 20 + + + + + + + + &OK + + + + + + + &Cancel + + + + + + + + + + + + + + fCancel_pushButton + clicked() + PGetSingleHistoRunBlockDialog + reject() + + + 458 + 434 + + + 471 + 415 + + + + + fOk_pushButton + clicked() + PGetSingleHistoRunBlockDialog + accept() + + + 394 + 438 + + + 407 + 406 + + + + + fHelp_pushButton + clicked() + PGetSingleHistoRunBlockDialog + helpContent() + + + 47 + 437 + + + 70 + 398 + + + + + + helpContent() + + diff --git a/src/musredit/forms/PGetTheoryBlockDialog.ui b/src/musredit/forms/PGetTheoryBlockDialog.ui new file mode 100644 index 00000000..8fc9515e --- /dev/null +++ b/src/musredit/forms/PGetTheoryBlockDialog.ui @@ -0,0 +1,261 @@ + + + PGetTheoryBlockDialog + + + Qt::WindowModal + + + + 0 + 0 + 550 + 529 + + + + Get Theory + + + + :/images/musrfit.xpm:/images/musrfit.xpm + + + + + 0 + 10 + 541 + 211 + + + + true + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans'; font-size:10pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif'; font-size:9pt;">Every theory function has to be written on a single line. It starts with the theory function name or its abbreviation followed by the parameters. Consecutive lines of theory functions will be multiplied. If theory functions need to be added, a line with a '+' has to separate them. The parameters are given as the numbers assigned to them in the FITPARAMETER-block.</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif'; font-size:9pt;"></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif'; font-size:9pt;">Example:</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif'; font-size:9pt;">asymmetry 2</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif'; font-size:9pt;">simplExpo 3</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif'; font-size:9pt;">TFieldCos map1 fun2</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif'; font-size:9pt;">+</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif'; font-size:9pt;">asymmetry 6</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif'; font-size:9pt;">simplExpo 7</span></p></body></html> + + + + + + 0 + 220 + 541 + 71 + + + + Theory Input Line + + + + + 10 + 30 + 381 + 25 + + + + + + + 420 + 30 + 51 + 25 + + + + + + + + + + + 480 + 30 + 51 + 25 + + + + * + + + + + + + 0 + 290 + 541 + 201 + + + + ##################################################### +THEORY + + + + + + 0 + 500 + 541 + 29 + + + + + + + &Help + + + + + + + Qt::Horizontal + + + + 178 + 20 + + + + + + + + &OK + + + + + + + &Cancel + + + + + + + + fTheoryFunction_comboBox + fPlus_pushButton + fMultiply_pushButton + fTheoryBlock_plainTextEdit + fOk_pushButton + fCancel_pushButton + fHelp_pushButton + fDescription_textEdit + + + + + + + fCancel_pushButton + clicked() + PGetTheoryBlockDialog + reject() + + + 539 + 502 + + + 492 + 411 + + + + + fOk_pushButton + clicked() + PGetTheoryBlockDialog + accept() + + + 458 + 502 + + + 380 + 472 + + + + + fHelp_pushButton + clicked() + PGetTheoryBlockDialog + helpContent() + + + 45 + 502 + + + 90 + 440 + + + + + fPlus_pushButton + clicked() + PGetTheoryBlockDialog + addPlus() + + + 434 + 257 + + + 173 + 500 + + + + + fMultiply_pushButton + clicked() + PGetTheoryBlockDialog + addMultiply() + + + 500 + 263 + + + 256 + 504 + + + + + + helpContent() + addPlus() + addMultiply() + + diff --git a/src/musredit/forms/PGetTitleBlockDialog.ui b/src/musredit/forms/PGetTitleBlockDialog.ui new file mode 100644 index 00000000..2385e5fe --- /dev/null +++ b/src/musredit/forms/PGetTitleBlockDialog.ui @@ -0,0 +1,163 @@ + + + PGetTitleBlockDialog + + + + 0 + 0 + 555 + 84 + + + + Get Title + + + + :/images/musrfit.xpm:/images/musrfit.xpm + + + + + 10 + 10 + 31 + 16 + + + + Title + + + + + + 50 + 6 + 501 + 26 + + + + + + + 10 + 40 + 541 + 47 + + + + + + + Qt::Horizontal + + + + + + + + + &Help + + + + + + + Qt::Horizontal + + + + 138 + 20 + + + + + + + + &OK + + + + + + + &Cancel + + + + + + + + + + fTitle_lineEdit + fOk_pushButton + fCancel_pushButton + fHelp_pushButton + + + + + + + fOk_pushButton + clicked() + PGetTitleBlockDialog + accept() + + + 467 + 78 + + + 286 + 221 + + + + + fCancel_pushButton + clicked() + PGetTitleBlockDialog + reject() + + + 548 + 78 + + + 350 + 219 + + + + + fHelp_pushButton + clicked() + PGetTitleBlockDialog + helpContent() + + + 59 + 64 + + + 149 + 49 + + + + + + helpContent() + + diff --git a/src/musredit/forms/PMsr2DataDialog.ui b/src/musredit/forms/PMsr2DataDialog.ui new file mode 100644 index 00000000..a4d5db54 --- /dev/null +++ b/src/musredit/forms/PMsr2DataDialog.ui @@ -0,0 +1,630 @@ + + + PMsr2DataDialog + + + + 0 + 0 + 542 + 522 + + + + msr2data input + + + + :/images/musrmsr2data.xpm:/images/musrmsr2data.xpm + + + + + 0 + 0 + 541 + 131 + + + + + 50 + false + + + + Run List Input + + + false + + + false + + + + + 10 + 30 + 511 + 94 + + + + + + + + + First + + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 40 + 20 + + + + + + + + Last + + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 200 + 20 + + + + + + + + <b>OR</b> + + + Qt::AutoText + + + + + + + + + + + Run List + + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Minimum + + + + 28 + 20 + + + + + + + + <b>OR</b> + + + Qt::AutoText + + + + + + + + + + + Run List File Name + + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 52 + 20 + + + + + + + + + + + + + 0 + 130 + 541 + 71 + + + + msr File Extension + + + + + 10 + 30 + 511 + 28 + + + + + + + Extension + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + 0 + 200 + 541 + 80 + + + + Template Run Input + + + + + 10 + 30 + 511 + 28 + + + + + + + Template Run Number + + + + + + + + + + Chain Fit + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + 0 + 280 + 541 + 80 + + + + Data Ouput File Name + + + + + 10 + 30 + 511 + 28 + + + + + + + Data Output File Name + + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Preferred + + + + 40 + 20 + + + + + + + + + + + 0 + 360 + 541 + 111 + + + + Options + + + + + 10 + 30 + 521 + 81 + + + + + + + + + Write Data Header + + + + + + + Summary Files Present + + + + + + + Keep Minuit2 Output + + + + + + + + + + + Write Column Data + + + + + + + Recreate Data File + + + + + + + Open Files after Fitting + + + + + + + + + + + Take Data File Title + + + + + + + Create msr-File only + + + + + + + Fit Only + + + + + + + + + + + + 0 + 470 + 541 + 51 + + + + + + + Qt::Horizontal + + + + + + + + + &Help + + + + + + + Qt::Horizontal + + + + 178 + 20 + + + + + + + + &OK + + + + + + + &Cancel + + + + + + + + + + fFirst_lineEdit + fLast_lineEdit + fRunList_lineEdit + fRunListFileName_lineEdit + fMsrFileExtension_lineEdit + fTemplateRunNumber_lineEdit + fChainFit_checkBox + fDataOutputFileName_lineEdit + fWriteDataHeader_checkBox + fSummaryPresent_checkBox + fKeepMinuit2Output_checkBox + fWriteColumnData_checkBox + fRecreateDataFile_checkBox + fOpenFilesAfterFitting_checkBox + fTitleFromData_checkBox + fCreateMsrFileOnly_checkBox + fFitOnly_checkBox + fOk_pushButton + fCancel_pushButton + fHelp_pushButton + + + + + + + fCancel_pushButton + clicked() + PMsr2DataDialog + reject() + + + 538 + 488 + + + 508 + 358 + + + + + fOk_pushButton + clicked() + PMsr2DataDialog + accept() + + + 457 + 488 + + + 380 + 364 + + + + + fHelp_pushButton + clicked() + PMsr2DataDialog + helpContent() + + + 57 + 488 + + + 96 + 370 + + + + + fFitOnly_checkBox + stateChanged(int) + PMsr2DataDialog + fitOnlyChanged(int) + + + 363 + 457 + + + 301 + 484 + + + + + fCreateMsrFileOnly_checkBox + stateChanged(int) + PMsr2DataDialog + createMsrFileOnlyChanged(int) + + + 377 + 429 + + + 150 + 487 + + + + + + helpContent() + fitOnlyChanged(int) + createMsrFileOnlyChanged(int) + + diff --git a/src/musredit/forms/PMusrEditAbout.ui b/src/musredit/forms/PMusrEditAbout.ui new file mode 100644 index 00000000..53d434a7 --- /dev/null +++ b/src/musredit/forms/PMusrEditAbout.ui @@ -0,0 +1,105 @@ + + + PMusrEditAbout + + + + 0 + 0 + 395 + 176 + + + + Musr Edit About + + + + :/images/musrfit.xpm:/images/musrfit.xpm + + + + + 11 + 11 + 371 + 161 + + + + + + + + 24 + 50 + true + false + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:24pt; font-weight:400; font-style:italic;"> +<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">musredit ...</p></body></html> + + + + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:10pt; font-weight:400; font-style:normal;"> +<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">by Andreas Suter</p> +<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">andreas.suter@psi.ch</p> +<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Paul Scherrer Institute</p> +<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Switzerland</p></body></html> + + + + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:10pt; font-weight:400; font-style:normal;"> +<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">$Id$</p></body></html> + + + + + + + &OK + + + + + + + + + + + + fOk_pushButton + clicked() + PMusrEditAbout + accept() + + + 178 + 271 + + + 226 + 228 + + + + + diff --git a/src/musredit/forms/PPrefsDialog.ui b/src/musredit/forms/PPrefsDialog.ui new file mode 100644 index 00000000..9fff9087 --- /dev/null +++ b/src/musredit/forms/PPrefsDialog.ui @@ -0,0 +1,203 @@ + + + PPrefsDialog + + + Qt::WindowModal + + + + 0 + 0 + 455 + 168 + + + + Preferences + + + + :/images/musrfit.xpm:/images/musrfit.xpm + + + + + 0 + 5 + 451 + 161 + + + + + + + 0 + + + + musrfit + + + + + 10 + 10 + 161 + 23 + + + + keep minuit2 output + + + + + + 10 + 35 + 151 + 23 + + + + dump ascii + + + + + + 10 + 60 + 131 + 23 + + + + dump root + + + + + + 170 + 10 + 171 + 23 + + + + take title from data file + + + + + + musrt0 + + + + + 10 + 10 + 131 + 23 + + + + enable it + + + + + + + + + + + &Help + + + + + + + Qt::Horizontal + + + + 88 + 20 + + + + + + + + &OK + + + + + + + &Cancel + + + + + + + + + + fTabWidget + fKeepMn2Output_checkBox + fDumpAscii_checkBox + fDumpRoot_checkBox + fTitleFromData_checkBox + fOk_pushButton + fCancel_pushButton + fHelp_pushButton + + + + + + + fCancel_pushButton + clicked() + PPrefsDialog + reject() + + + 391 + 198 + + + 422 + 142 + + + + + fOk_pushButton + clicked() + PPrefsDialog + accept() + + + 331 + 199 + + + 293 + 144 + + + + + diff --git a/src/musredit/forms/PReplaceConfirmationDialog.ui b/src/musredit/forms/PReplaceConfirmationDialog.ui new file mode 100644 index 00000000..3765321c --- /dev/null +++ b/src/musredit/forms/PReplaceConfirmationDialog.ui @@ -0,0 +1,136 @@ + + + PReplaceConfirmationDialog + + + Qt::WindowModal + + + + 0 + 0 + 513 + 65 + + + + Replace Confirmation - musredit + + + + :/images/musrfit.xpm:/images/musrfit.xpm + + + + + 10 + 10 + 461 + 16 + + + + Found an occurrence of your search term.What do you want to do? + + + + + + 7 + 20 + 521 + 20 + + + + Qt::Horizontal + + + + + + 7 + 35 + 81 + 25 + + + + &Replace + + + + + + 87 + 35 + 131 + 25 + + + + Re&place and Close + + + + + + 217 + 35 + 97 + 25 + + + + Replace &All + + + + + + 317 + 35 + 91 + 25 + + + + &Find Next + + + + + + 407 + 35 + 97 + 25 + + + + &Close + + + + + + + + + fClose_pushButton + clicked() + PReplaceConfirmationDialog + reject() + + + 457 + 58 + + + 468 + 71 + + + + + diff --git a/src/musredit/forms/PReplaceDialog.ui b/src/musredit/forms/PReplaceDialog.ui new file mode 100644 index 00000000..11131623 --- /dev/null +++ b/src/musredit/forms/PReplaceDialog.ui @@ -0,0 +1,300 @@ + + + PReplaceDialog + + + + 0 + 0 + 345 + 315 + + + + Replace Text - musredit + + + + :/images/musrfit.xpm:/images/musrfit.xpm + + + + + 0 + 0 + 341 + 81 + + + + Find + + + + + 10 + 20 + 91 + 16 + + + + Text to find: + + + + + + 10 + 40 + 321 + 31 + + + + true + + + + + + + 190 + 290 + 71 + 25 + + + + &Replace + + + + + + 270 + 290 + 71 + 25 + + + + &Close + + + + + + 0 + 160 + 341 + 121 + + + + Options + + + Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft + + + + + 10 + 30 + 141 + 23 + + + + C&ase Sensitive + + + + + + 10 + 60 + 141 + 23 + + + + &Whole words only + + + + + + 10 + 90 + 141 + 23 + + + + From c&ursor + + + + + + 180 + 30 + 141 + 23 + + + + Find &backwards + + + + + + 180 + 60 + 141 + 23 + + + + &Selected text + + + + + + 180 + 90 + 151 + 23 + + + + &Prompt on replace + + + + + + + 0 + 280 + 351 + 16 + + + + Qt::Horizontal + + + + + + 0 + 80 + 341 + 81 + + + + Replace With + + + + + 10 + 20 + 111 + 16 + + + + Replacement text: + + + + + + 10 + 40 + 321 + 31 + + + + true + + + + + + fFind_comboBox + fReplacementText_comboBox + fCaseSensitive_checkBox + fWholeWordsOnly_checkBox + fFromCursor_checkBox + fFindBackwards_checkBox + fSelectedText_checkBox + fPromptOnReplace_checkBox + fReplace_pushButton + fClose_pushButton + + + + + + + fClose_pushButton + clicked() + PReplaceDialog + reject() + + + 287 + 205 + + + 344 + 228 + + + + + fReplace_pushButton + clicked() + PReplaceDialog + accept() + + + 208 + 211 + + + 171 + 211 + + + + + fFind_comboBox + editTextChanged(QString) + PReplaceDialog + onFindTextAvailable(QString) + + + 183 + 63 + + + 90 + 298 + + + + + + onFindTextAvailable(QString) + + diff --git a/src/musredit/images/editcopy.xpm b/src/musredit/images/editcopy.xpm new file mode 100644 index 00000000..cc6fb7a6 --- /dev/null +++ b/src/musredit/images/editcopy.xpm @@ -0,0 +1,36 @@ +/* XPM */ +static char *magick[] = { +/* columns rows colors chars-per-pixel */ +"22 22 8 1", +" c Gray100", +". c #8b8bfd", +"X c #3c3cfd", +"o c #000082", +"O c Gray0", +"+ c None", +"@ c Gray0", +"# c Gray0", +/* pixels */ +"++++++++++++++++++++++", +"++++++++++++++++++++++", +"OOOOOOOO++++++++++++++", +"O OO+++++++++++++", +"O OOOO O O++++++++++++", +"O O O+++++++++++", +"O OOOO Ooooooooo++++++", +"O Oo oo+++++", +"O OOOOO o OOOO oXo++++", +"O o o.Xo+++", +"O OOOOO o OOOO o .Xo++", +"O o oooooo+", +"O OOOOO o OOOO o+", +"O o o+", +"O OOOOO o OOOOOOOOO o+", +"O o o+", +"OOOOOOOOo OOOOOOOOO o+", +"++++++++o o+", +"++++++++o OOOOOOOOO o+", +"++++++++o o+", +"++++++++ooooooooooooo+", +"++++++++++++++++++++++" +}; diff --git a/src/musredit/images/editcut.xpm b/src/musredit/images/editcut.xpm new file mode 100644 index 00000000..2391adda --- /dev/null +++ b/src/musredit/images/editcut.xpm @@ -0,0 +1,32 @@ +/* XPM */ +static char *magick[] = { +/* columns rows colors chars-per-pixel */ +"22 22 4 1", +" c Gray100", +". c #000082", +"X c Gray0", +"o c None", +/* pixels */ +"oooooooooooooooooooooo", +"oooooooXoooooXoooooooo", +"oooooooXoooooXoooooooo", +"oooooooXoooooXoooooooo", +"oooooooXooooXXoooooooo", +"oooooooXXoooXooooooooo", +"ooooooooXoooXooooooooo", +"ooooooooXXoXXooooooooo", +"oooooooooXXXoooooooooo", +"oooooooooXXXoooooooooo", +"ooooooooooXooooooooooo", +"ooooooooo.X.oooooooooo", +"oooooooo..o...oooooooo", +"ooooooo.o.o.oo.ooooooo", +"oooooo.oo.o.ooo.oooooo", +"ooooo.ooo.o.oooo.ooooo", +"oooo.oooo.o.oooo.ooooo", +"oooo.oooo.oo.ooo.ooooo", +"oooo.oooo.oo.oo.oooooo", +"oooo.ooo.oooo..ooooooo", +"ooooo...oooooooooooooo", +"oooooooooooooooooooooo" +}; diff --git a/src/musredit/images/editfind.xpm b/src/musredit/images/editfind.xpm new file mode 100644 index 00000000..f5790f34 --- /dev/null +++ b/src/musredit/images/editfind.xpm @@ -0,0 +1,202 @@ +/* XPM */ +static char * editfind_xpm[] = { +"22 22 177 2", +" c None", +". c #59595A", +"+ c #3B3B3C", +"@ c #3E3E3F", +"# c #3C3C3D", +"$ c #404041", +"% c #585859", +"& c #979797", +"* c #5B5B5B", +"= c #FFFFFF", +"- c #5D5D5E", +"; c #49494A", +"> c #868787", +", c #AFB4B4", +"' c #BBC4C6", +") c #BBC5C6", +"! c #B2B7B7", +"~ c #7A7A7B", +"{ c #1D1D1D", +"] c #474747", +"^ c #3D3D3D", +"/ c #444445", +"( c #7B7879", +"_ c #CFDADA", +": c #E5F0F2", +"< c #DCF2F5", +"[ c #DDF4FA", +"} c #D7F3F8", +"| c #CCEFF7", +"1 c #DCE7E9", +"2 c #6F6F70", +"3 c #434343", +"4 c #E4E4E4", +"5 c #4C4C4D", +"6 c #7D7E7D", +"7 c #E9F8FA", +"8 c #C6EDF5", +"9 c #BDE7F0", +"0 c #A5DCEA", +"a c #9BD6E2", +"b c #BBE7EE", +"c c #444444", +"d c #8A8A8A", +"e c #767676", +"f c #C5CFD2", +"g c #B1E2EC", +"h c #9DD9E6", +"i c #8ACDD9", +"j c #81C9D6", +"k c #AFE1EC", +"l c #CED9D9", +"m c #29292A", +"n c #818181", +"o c #6C6C6C", +"p c #4A4A4A", +"q c #5C5C5C", +"r c #A2A7A7", +"s c #E5F4F8", +"t c #C3E9F0", +"u c #ACE0EB", +"v c #99D8E6", +"w c #87CDDC", +"x c #6CBACB", +"y c #7BC4D4", +"z c #9DA2A1", +"A c #626262", +"B c #727272", +"C c #535353", +"D c #494949", +"E c #BAC0C1", +"F c #E7F3F6", +"G c #CBE9F2", +"H c #86D1E1", +"I c #6CC3D9", +"J c #50A6B9", +"K c #6AB5C3", +"L c #B2C7CB", +"M c #454545", +"N c #4F4F4F", +"O c #4B4B4B", +"P c #373737", +"Q c #E3F2F4", +"R c #C5E7EC", +"S c #A8E1EB", +"T c #96D7E7", +"U c #74C8DD", +"V c #5BB1C4", +"W c #4399A8", +"X c #54ACB9", +"Y c #0C0C0C", +"Z c #D3D3D3", +"` c #464646", +" . c #434344", +".. c #A6ABAA", +"+. c #D8EDF1", +"@. c #B1DBE4", +"#. c #96D5E5", +"$. c #4DBACE", +"%. c #449AA9", +"&. c #3D8996", +"*. c #63B5C4", +"=. c #ABDFEA", +"-. c #232323", +";. c #FCFCFC", +">. c #78C3D3", +",. c #68BDCF", +"'. c #4CB7CB", +"). c #4298A7", +"!. c #398491", +"~. c #489EAD", +"{. c #404647", +"]. c #484848", +"^. c #797A79", +"/. c #D7F0F4", +"(. c #A4DBE9", +"_. c #79BFCC", +":. c #60B3C5", +"<. c #52A7B3", +"[. c #4496A5", +"}. c #50A3B5", +"|. c #8ACFE1", +"1. c #000000", +"2. c #8E8E8E", +"3. c #5C5D5C", +"4. c #BAE4EF", +"5. c #99D4E0", +"6. c #87CAD6", +"7. c #BDE6F0", +"8. c #414648", +"9. c #AC993F", +"0. c #6C6D6C", +"a. c #7B7C7B", +"b. c #79989C", +"c. c #A9C7CE", +"d. c #B3CAD0", +"e. c #88A8AD", +"f. c #6B7274", +"g. c #DECE9D", +"h. c #635920", +"i. c #4D4D4E", +"j. c #595959", +"k. c #737374", +"l. c #757576", +"m. c #717172", +"n. c #707071", +"o. c #424849", +"p. c #414748", +"q. c #BDA44C", +"r. c #717171", +"s. c #686868", +"t. c #928237", +"u. c #747475", +"v. c #767677", +"w. c #373738", +"x. c #939393", +"y. c #E3E3E3", +"z. c #363637", +"A. c #777778", +"B. c #E1E1E1", +"C. c #39393A", +"D. c #3B3B3B", +"E. c #DCDCDC", +"F. c #828282", +"G. c #CECECE", +"H. c #3A3F40", +"I. c #727273", +"J. c #313131", +"K. c #575757", +"L. c #393939", +"M. c #EEEEEE", +"N. c #3D3D3E", +"O. c #9D9D9D", +"P. c #FEFEFE", +"Q. c #323233", +"R. c #7F7F80", +"S. c #0B0B0B", +"T. c #4D4D4D", +" . + @ # $ % & * = ", +" - ; > , ' ) ! ~ { ] * ^ = & ", +" / ( _ : < [ } | [ 1 2 3 4 4 * ", +" 5 6 1 7 = 7 8 9 0 a b 1 6 c d e = ", +" ; f 7 = = = 7 g h i j k l m n o * p = ", +"q r 1 < s = 7 t u v w x y k z A B * C D = ", +"; E F G G 7 t k v H I J K g L M N O M P ", +"; ' Q R b g S T H U V W X S L Y Z ` P = ", +" ...+.@.a v #.H U $.%.&.*.=.r -. ;.= ", +"o 6 _ k i j >.,.'.).!.~.#._ {.] ", +" ].^./.(._.:.<.[.&.}.|.+.z 1. ", +" 2.3.6 +.4.5.6.>.w 7.+.6 8.1.9. ", +" * 0.a.b.c.R R d.e.f.8.1.= g.h. ", +" q i.j.k.l.m.n.o.p.1.q.g.= k.$ ", +" r.i.N p D s. h.t.o.u.= v.w. ", +" x.C y. h.z.o.A.B.~ C. ", +" * D.E.F.M G. z.z.H.I.G.2 J. ", +" = = K.L.M. 1.z.o.n.G.n.N.", +"O.d e P.y. Q.z.o.n.R.$ ", +"n o * ].4 & * = 1.z.o.S.$ ", +"e * C D 4 * ^ = 1.1.$ ", +"K.T.M P = = = "}; diff --git a/src/musredit/images/editnext.xpm b/src/musredit/images/editnext.xpm new file mode 100644 index 00000000..383761ec --- /dev/null +++ b/src/musredit/images/editnext.xpm @@ -0,0 +1,49 @@ +/* XPM */ +static char * editnext_xpm[] = { +"24 24 22 1", +" c None", +". c #000000", +"+ c #FFFFFF", +"@ c #E6E6E6", +"# c #FAFAFA", +"$ c #AEAEAE", +"% c #F6F6F6", +"& c #C9C9C9", +"* c #666666", +"= c #ACACAC", +"- c #F3F3F3", +"; c #FDFDFD", +"> c #676767", +", c #AAAAAA", +"' c #888888", +") c #A5A5A5", +"! c #F0F0F0", +"~ c #525252", +"{ c #5E5E5E", +"] c #696969", +"^ c #FCFCFC", +"/ c #F9F9F9", +" ", +" ", +" ........+ ", +" . ........+ ", +" .@. . #++++++++ ", +" .@$%. .. ..........+ ", +".&$*=%..@. -;+++++++++ ", +" .>$*=&@,. ....+ ", +" .>$*')>. !;+++ ", +" .~${{>. .......+ ", +" .@']]>. !^++++++ ", +" .@,>>>>. ", +" ......... ..........+ ", +" ..........+ ", +" /++++++++++ ", +" ....+ ", +" +++++ ", +" ......+ ", +" +++++++ ", +" ........+ ", +" +++++++++ ", +" ", +" ", +" "}; diff --git a/src/musredit/images/editpaste.xpm b/src/musredit/images/editpaste.xpm new file mode 100644 index 00000000..3f775920 --- /dev/null +++ b/src/musredit/images/editpaste.xpm @@ -0,0 +1,36 @@ +/* XPM */ +static char *magick[] = { +/* columns rows colors chars-per-pixel */ +"22 22 8 1", +" c Gray100", +". c Yellow", +"X c #c6c3c6", +"o c #848284", +"O c #848200", +"+ c #000084", +"@ c Gray0", +"# c None", +/* pixels */ +"######################", +"#######@@@@@##########", +"##@@@@@@...@@@@@@#####", +"#@@@@@@.....@@@@@@####", +"@@oOo@@.@@@.@@oOo@@###", +"@oOo@XXXXXXXXX@oOo@###", +"@OoO@XXXXXXXXX@OoO@###", +"@oOo@@@@@@@@@@@oOo@###", +"@OoOoOoOoOoOoOoOoO@###", +"@oOoOoOoOoOoOoOoOo@###", +"@OoOoOoO++++++++++@###", +"@oOoOoOo+ + +###", +"@OoOoOoO+ +++++ + +##", +"@oOoOoOo+ + +#", +"@OoOoOoO+ +++++ + +", +"@oOoOoOo+ ++++++", +"@OoOoOoO+ +++++ +", +"@oOoOoOo+ +", +"@OoOoOoO+ ++++++++++ +", +"#@@@@@@@+ +", +"########++++++++++++++", +"######################" +}; diff --git a/src/musredit/images/editprevious.xpm b/src/musredit/images/editprevious.xpm new file mode 100644 index 00000000..6dba0c52 --- /dev/null +++ b/src/musredit/images/editprevious.xpm @@ -0,0 +1,45 @@ +/* XPM */ +static char * editprevious_xpm[] = { +"24 22 20 1", +" c None", +". c #000000", +"+ c #FFFFFF", +"@ c #D6D6D6", +"# c #F0F0F0", +"$ c #FDFDFD", +"% c #B1B1B1", +"& c #969696", +"* c #696969", +"= c #FEFEFE", +"- c #A8A8A8", +"; c #888888", +"> c #5E5E5E", +", c #F7F7F7", +"' c #666666", +") c #ACACAC", +"! c #A0A0A0", +"~ c #AEAEAE", +"{ c #3B3B3B", +"] c #4C4C4C", +" ", +" ", +"........+ ", +"........+ ......... ", +"+++++++++ .@@###@. ", +"..........$ .%&*&@. ", +"++++++++++= .-;>&,. ", +"....+ .-;;'),. ", +"+++++ .!~{~'),. ", +".......+ .~..{~'),. ", +"++++++++ .. .{~]. ", +" . .{. ", +"..........$ . ", +"..........+ ", +"+++++++++++ ", +"....+ ", +"+++++ ", +"......+ ", +"+++++++ ", +"........+ ", +"+++++++++ ", +" "}; diff --git a/src/musredit/images/editredo.xpm b/src/musredit/images/editredo.xpm new file mode 100644 index 00000000..46dc0331 --- /dev/null +++ b/src/musredit/images/editredo.xpm @@ -0,0 +1,36 @@ +/* XPM */ +static char *magick[] = { +/* columns rows colors chars-per-pixel */ +"22 22 8 1", +" c Gray100", +". c #848284", +"X c #000084", +"o c Gray0", +"O c None", +"+ c Gray0", +"@ c Gray0", +"# c Gray0", +/* pixels */ +"OOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOO", +"OOOO.XXXXXXOOOOOOOOOOO", +"OOOXXXXXXXXXXOOOOOOXOO", +"OO.XXOOOOOOXXXXOOOXXOO", +"OOXXOOOOOOOOOXXXOXXXOO", +"OOXXOOOOOOOOOOXXXXXXOO", +"OOXXOOOOOOOOOOOXXXXXOO", +"OOXXOOOOOOOOOOXXXXXXOO", +"OOXXOOOOOOOOOXXXXXXXOO", +"OO.XXOOOOOOOXXXXXXXXOO", +"OOOXXX.OOOOOOOOOOOOOOO", +"OOOOXXXOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOO" +}; diff --git a/src/musredit/images/editundo.xpm b/src/musredit/images/editundo.xpm new file mode 100644 index 00000000..229c1636 --- /dev/null +++ b/src/musredit/images/editundo.xpm @@ -0,0 +1,36 @@ +/* XPM */ +static char *magick[] = { +/* columns rows colors chars-per-pixel */ +"22 22 8 1", +" c Gray100", +". c #848284", +"X c #000084", +"o c Gray0", +"O c None", +"+ c Gray0", +"@ c Gray0", +"# c Gray0", +/* pixels */ +"OOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOXXXXXX.OOOO", +"OOXOOOOOOXXXXXXXXXXOOO", +"OOXXOOOXXXXOOOOOOXX.OO", +"OOXXXOXXXOOOOOOOOOXXOO", +"OOXXXXXXOOOOOOOOOOXXOO", +"OOXXXXXOOOOOOOOOOOXXOO", +"OOXXXXXXOOOOOOOOOOXXOO", +"OOXXXXXXXOOOOOOOOOXXOO", +"OOXXXXXXXXOOOOOOOXX.OO", +"OOOOOOOOOOOOOOO.XXXOOO", +"OOOOOOOOOOOOOOOXXXOOOO", +"OOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOO" +}; diff --git a/src/musredit/images/filenew.xpm b/src/musredit/images/filenew.xpm new file mode 100644 index 00000000..884d7cbb --- /dev/null +++ b/src/musredit/images/filenew.xpm @@ -0,0 +1,36 @@ +/* XPM */ +static char *magick[] = { +/* columns rows colors chars-per-pixel */ +"22 22 8 1", +" c Gray100", +". c Gray76", +"X c Gray53", +"o c Gray36", +"O c Gray18", +"+ c Gray0", +"@ c None", +"# c Gray0", +/* pixels */ +"@@@@@@@@@@@@@@@@@@@@@@", +"@@@@++++++++++@@@@@@@@", +"@@@@+ +O+@@@@@@@", +"@@@@+ +oO+@@@@@@", +"@@@@+ +XoO+@@@@@", +"@@@@+ +.XoO+@@@@", +"@@@@+ + .XoO+@@@", +"@@@@+ +++++++@@@", +"@@@@+ +@@@", +"@@@@+ +@@@", +"@@@@+ +@@@", +"@@@@+ +@@@", +"@@@@+ +@@@", +"@@@@+ +@@@", +"@@@@+ +@@@", +"@@@@+ +@@@", +"@@@@+ +@@@", +"@@@@+ +@@@", +"@@@@+ +@@@", +"@@@@+++++++++++++++@@@", +"@@@@@@@@@@@@@@@@@@@@@@", +"@@@@@@@@@@@@@@@@@@@@@@" +}; diff --git a/src/musredit/images/fileopen.xpm b/src/musredit/images/fileopen.xpm new file mode 100644 index 00000000..82effcf7 --- /dev/null +++ b/src/musredit/images/fileopen.xpm @@ -0,0 +1,36 @@ +/* XPM */ +static char *magick[] = { +/* columns rows colors chars-per-pixel */ +"22 22 8 1", +" c Gray100", +". c Yellow", +"X c #848200", +"o c Gray0", +"O c None", +"+ c Gray0", +"@ c Gray0", +"# c Gray0", +/* pixels */ +"OOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOooooOOOOoO", +"OOOOOOOOOOOoOOOOooOooO", +"OOOOOOOOOOOOOOOOOOoooO", +"OOOOOOOOOOOOOOOOOooooO", +"OooooOOOOOOOOOOOoooooO", +"o. . ooooooooooOOOOOOO", +"o . . . . . . oOOOOOOO", +"o. . . . . . .oOOOOOOO", +"o . . . . . . oOOOOOOO", +"o. . . ooooooooooooooo", +"o . . ooXXXXXXXXXXXXoo", +"o. . ooXXXXXXXXXXXXooO", +"o . ooXXXXXXXXXXXXooOO", +"o. ooXXXXXXXXXXXXooOOO", +"o ooXXXXXXXXXXXXooOOOO", +"oooXXXXXXXXXXXXooOOOOO", +"ooXXXXXXXXXXXXooOOOOOO", +"oooooooooooooooOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOO" +}; diff --git a/src/musredit/images/fileprint.xpm b/src/musredit/images/fileprint.xpm new file mode 100644 index 00000000..8701d460 --- /dev/null +++ b/src/musredit/images/fileprint.xpm @@ -0,0 +1,117 @@ +/* XPM */ +static char *magick[] = { +/* columns rows colors chars-per-pixel */ +"22 22 89 1", +" c Gray0", +". c #101008081010", +"X c #101010101010", +"o c #101010101818", +"O c #181810101818", +"+ c #181818181818", +"@ c #181818182121", +"# c #212118182121", +"$ c Gray13", +"% c #212121212929", +"& c #292921212929", +"* c Gray16", +"= c #292929293131", +"- c #313129293131", +"; c #313131313131", +": c #313131313939", +"> c #393931313939", +", c #393939393939", +"< c #393939394242", +"1 c #424239394242", +"2 c Gray26", +"3 c #4a4a4a4a5252", +"4 c #5a5a52525a5a", +"5 c #5a5a5a5a6363", +"6 c #6b6b63636b6b", +"7 c Gray42", +"8 c #6b6b6b6b7373", +"9 c #73736b6b7373", +"0 c #7b7b73737b7b", +"q c #7b7b73738484", +"w c #0808ffff0808", +"e c #2929ffff2929", +"r c #3131ffff3131", +"t c #5a5acece5a5a", +"y c #6b6bffff6363", +"u c #7b7bffff7b7b", +"i c #84847b7b8484", +"p c #84847b7b8c8c", +"a c #8c8c7b7b9494", +"s c #848484848c8c", +"d c #8c8c84848c8c", +"f c Gray55", +"g c #8c8c84849494", +"h c #8c8c8c8c9494", +"j c #94948c8c9494", +"k c #94948c8c9c9c", +"l c Gray58", +"z c #949494949c9c", +"x c #9c9c94949c9c", +"c c Gray61", +"v c #9c9c9494a5a5", +"b c #9c9c9c9ca5a5", +"n c #a5a59c9ca5a5", +"m c #a5a59c9cadad", +"M c #adad9c9cadad", +"N c #a5a5a5a5a5a5", +"B c #a5a5a5a5adad", +"V c #adada5a5adad", +"C c Gray68", +"Z c #adadadadb5b5", +"A c #b5b5adadb5b5", +"S c Gray71", +"D c Gray74", +"F c #9494c6c69494", +"G c #9c9ccecea5a5", +"H c #bdbdd6d6bdbd", +"J c #c0c0c0c0c0c0", +"K c #c6c6c6c6c6c6", +"L c #cecec6c6cece", +"P c #cececececece", +"I c #cecececed6d6", +"U c #d6d6ceced6d6", +"Y c #d6d6cecedede", +"T c Gray84", +"R c #d6d6d6d6dede", +"E c #deded6d6dede", +"W c Gray87", +"Q c #deded6d6e7e7", +"! c #dedededee7e7", +"~ c #d6d6ffffd6d6", +"^ c #e7e7dedee7e7", +"/ c #e7e7e7e7e7e7", +"( c #e7e7e7e7efef", +") c #efefe7e7efef", +"_ c #efefefefefef", +"` c #e7e7ffffe7e7", +"' c Gray97", +"] c Gray100", +"[ c None", +/* pixels */ +"[[[[[[SDPPPPKKDDCD[[[[", +"[[[[[[D_/////___WD[[[[", +"[[[[[[DKKKPPKKKKDK[[[[", +"[[[[[[SDDDDSDDSSCD[[[[", +"[[[[[KCKDKKKDDDKS[[[[[", +"[[[[[DDSDDDDDDKKS[[[[[", +"[[[[[DSKDDDDDKDKC[[[[[", +"[[[[[KDDDDDDDDDDS[[[[[", +"[[[[[CP/WWWWWWTWNNZ[[[", +"[[[Dc9STPTPTPTWWj427S[", +"[[Dziq0000000pag8<%@2N", +"[DcE(!ERRRRUYGtFn2##O<", +"Db)]]]]]]]]]~ewePa;@X#", +"V']]]]]]]]]]`yru]Q0@ #", +"BRILITRRW^!E!RHUILhO @", +"jAZVBmBnmmNmnmMvzh6o #", +"jZZmBnnnbnbbbbvxxg6o +", +"lmmnbnbbbvcvxxxvjs6O 3", +"jBnnvcvxvcvxvxzjhd8o+C", +"lsdgfgdhgdhhjhjkhg6+l[", +"S9%@$%&&&=--::>>:-:l[[", +"[[C511,:;;;**%++.2c[[[" +}; diff --git a/src/musredit/images/filereload.xpm b/src/musredit/images/filereload.xpm new file mode 100644 index 00000000..23bedb11 --- /dev/null +++ b/src/musredit/images/filereload.xpm @@ -0,0 +1,172 @@ +/* XPM */ +static char * editreload_xpm[] = { +"22 22 147 2", +" c None", +". c #215017", +"+ c #225118", +"@ c #1C3F10", +"# c #1C4110", +"$ c #213B14", +"% c #1A330D", +"& c #141400", +"* c #1D4613", +"= c #2A732F", +"- c #65C284", +"; c #D8F0D6", +"> c #B9E4BD", +", c #82CD91", +"' c #3D8F4B", +") c #477D40", +"! c #417036", +"~ c #1E4917", +"{ c #1B3E0F", +"] c #32A85D", +"^ c #FFFFFF", +"/ c #B8E2BE", +"( c #46B670", +"_ c #2F833C", +": c #112405", +"< c #121600", +"[ c #212106", +"} c #142B0A", +"| c #B2E0B8", +"1 c #47B671", +"2 c #50854A", +"3 c #686868", +"4 c #6E6E6E", +"5 c #101800", +"6 c #CBE9CB", +"7 c #63C284", +"8 c #337F3A", +"9 c #17320C", +"0 c #747474", +"a c #2A6F2B", +"b c #A3DAAE", +"c c #31843E", +"d c #676767", +"e c #7B7B7B", +"f c #296C27", +"g c #E0F3DD", +"h c #63C385", +"i c #46914F", +"j c #142908", +"k c #6D6D6D", +"l c #284919", +"m c #305020", +"n c #2FA057", +"o c #BEE5C1", +"p c #55BD7A", +"q c #32843F", +"r c #192C0B", +"s c #161600", +"t c #2C7F39", +"u c #B0E1B5", +"v c #DFF3DD", +"w c #D4F4D4", +"x c #6FC386", +"y c #419652", +"z c #378843", +"A c #7DCB8F", +"B c #CEECCE", +"C c #2C813A", +"D c #16310C", +"E c #000000", +"F c #171717", +"G c #366D2F", +"H c #32A65C", +"I c #34B464", +"J c #319E52", +"K c #3A924C", +"L c #64C280", +"M c #256022", +"N c #A0A0A0", +"O c #474747", +"P c #191919", +"Q c #2F8F46", +"R c #33B364", +"S c #6AC684", +"T c #5A5A5A", +"U c #B8B8B8", +"V c #848484", +"W c #454545", +"X c #151515", +"Y c #407438", +"Z c #2F8B40", +"` c #2D823B", +" . c #C3C3C3", +".. c #383838", +"+. c #484848", +"@. c #8D8D8D", +"#. c #4C4C4C", +"$. c #B5B5B5", +"%. c #6F6F6F", +"&. c #353535", +"*. c #222222", +"=. c #292929", +"-. c #4D4D4D", +";. c #464646", +">. c #282828", +",. c #9B9B9B", +"'. c #2A2A2A", +"). c #2F2F2F", +"!. c #2E2E2E", +"~. c #717171", +"{. c #2C2C2C", +"]. c #0A0A0A", +"^. c #030303", +"/. c #757575", +"(. c #3C3C3C", +"_. c #515151", +":. c #242424", +"<. c #010101", +"[. c #898989", +"}. c #414141", +"|. c #575757", +"1. c #252525", +"2. c #A3A3A3", +"3. c #3B3B3B", +"4. c #1A1A1A", +"5. c #AFAFAF", +"6. c #6A6A6A", +"7. c #434343", +"8. c #404040", +"9. c #070707", +"0. c #424242", +"a. c #141414", +"b. c #080808", +"c. c #0B0B0B", +"d. c #1C1C1C", +"e. c #797979", +"f. c #828282", +"g. c #505050", +"h. c #1F1F1F", +"i. c #4B4B4B", +"j. c #818181", +"k. c #A5A5A5", +"l. c #5E5E5E", +"m. c #0D0D0D", +"n. c #121212", +"o. c #212121", +"p. c #1D1D1D", +" . + @ # $ % & ", +" * = - ; > , ' ) ! ~ { ", +" * ] ^ / ( _ * : < [ & ~ } ", +" = ^ | 1 2 & & 3 4 & } 5 ", +" * - 6 7 8 9 3 0 } & ", +" 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 C M & E N O P ", +" & G Q R S C M & T E U k V W X ", +" & Y Z ` M & E .4 ..+.@.#.P ", +" & G M & E $.%.&.*.=.-.@.;.X ", +" & & >.,.3 W W '.).!.;.~.{.].", +" E E ^.E /.(._.:.<.E E E ", +" E [.}.|.1. ", +" E E 2.3._.4. ", +" E E E 5.6.7.8.9. ", +" E E E E E 5.V 0.+.a. ", +" b.*.c.d.E E e.5.f.g.g.{.9. ", +" E h.i.6.j.k.l.0.g.m.E ", +" ].n.P h.o.p.E "}; diff --git a/src/musredit/images/filesave.xpm b/src/musredit/images/filesave.xpm new file mode 100644 index 00000000..71cbd331 --- /dev/null +++ b/src/musredit/images/filesave.xpm @@ -0,0 +1,36 @@ +/* XPM */ +static char *magick[] = { +/* columns rows colors chars-per-pixel */ +"22 22 8 1", +" c Gray100", +". c #cab5d1", +"X c #c1c1c1", +"o c #848200", +"O c Gray0", +"+ c None", +"@ c Gray0", +"# c Gray0", +/* pixels */ +"++++++++++++++++++++++", +"+OOOOOOOOOOOOOOOOOOOO+", +"+OooOXXXXXXXXXXXXOXXO+", +"+OooOXXXXXXXXXXXXOXXO+", +"+OooOXXXXXXXXX.XXOOOO+", +"+OooOXXX..XXXXXXXOooO+", +"+OooOXXX..XXXXXXXOooO+", +"+OooOXXXXXXXXXXXXOooO+", +"+OooOXXXXXXXXXXXXOooO+", +"+OooOXXXXXXXXXXXXOooO+", +"+OooOXXXXXXXXXXXXOooO+", +"+OoooOOOOOOOOOOOOoooO+", +"+OooooooooooooooooooO+", +"+OooooooooooooooooooO+", +"+OoooOOOOOOOOOOOOOooO+", +"+OoooOOOOOOOOOXXXOooO+", +"+OoooOOOOOOOOOXXXOooO+", +"+OoooOOOOOOOOOXXXOooO+", +"+OoooOOOOOOOOOXXXOooO+", +"+OoooOOOOOOOOOXXXOooO+", +"++OOOOOOOOOOOOOOOOOO++", +"++++++++++++++++++++++" +}; diff --git a/src/musredit/images/musrasym.xpm b/src/musredit/images/musrasym.xpm new file mode 100644 index 00000000..64bfb2f4 --- /dev/null +++ b/src/musredit/images/musrasym.xpm @@ -0,0 +1,29 @@ +/* XPM */ +static char * musrasym_xpm[] = { +"22 22 4 1", +" c None", +". c #3D20CF", +"+ c #FF0000", +"@ c #000000", +" ", +" . .. . . . .", +" . . . . . . .. ..", +". . . . . . . .", +". . .. . . . .", +"..... . . . .", +". . . . . . .", +". . .. . . .", +" ", +" ++ ", +"+ + ", +" + ", +" + ", +" + ", +" + ++ ", +" + + + +", +"@@@@@@@+@@@@+@@@@+@@+ ", +" + + ++ ", +" ++ ", +" ", +" ", +" "}; diff --git a/src/musredit/images/musrcalcchisq.xpm b/src/musredit/images/musrcalcchisq.xpm new file mode 100644 index 00000000..63088af1 --- /dev/null +++ b/src/musredit/images/musrcalcchisq.xpm @@ -0,0 +1,28 @@ +/* XPM */ +static char * musrcalcchisq_xpm[] = { +"22 22 3 1", +" c None", +". c #FF0000", +"+ c #000000", +" ... ", +" +... . ", +" .+ ...+. ", +" ... . ... ", +" ... ... ", +" ... ... ", +"+ . . ", +" . ", +" +++ ", +" ++..+ ", +" + ..+ . ", +" .+.+ . ", +"++ + +. + ... ", +"+++ ++ + ...++... ", +" ++ ++ +++++.. ... ", +" +++ ... .+ ", +" ++ . ", +" ++ ...", +" +++ ...", +" ++ + ...", +" ++ +++ . ", +"++ +++ "}; diff --git a/src/musredit/images/musrfit.xpm b/src/musredit/images/musrfit.xpm new file mode 100644 index 00000000..de1b652d --- /dev/null +++ b/src/musredit/images/musrfit.xpm @@ -0,0 +1,28 @@ +/* XPM */ +static char * musrfit_xpm[] = { +"22 22 3 1", +" c None", +". c #FF0000", +"+ c #000000", +" ... ", +" +... . ", +" .+ ...+. ", +" ... . ... ", +" ... ... ", +" ... ... ", +"+ . .+ ", +" .+ ", +" . ", +" ... ", +" ... . ", +" ...+ . ", +" . + ... ", +" ...++... ", +"++++ + +++++... ... ", +"+ + + ... .+ ", +"+ + + . ", +"++++ + + ...", +"+ + + ...", +"+ + + ...", +"+ + + . ", +" "}; diff --git a/src/musredit/images/musrmsr2data.xpm b/src/musredit/images/musrmsr2data.xpm new file mode 100644 index 00000000..4aa1bd07 --- /dev/null +++ b/src/musredit/images/musrmsr2data.xpm @@ -0,0 +1,28 @@ +/* XPM */ +static char * musrmlog2db_xpm[] = { +"22 22 3 1", +" c None", +". c #000000", +"+ c #FF0000", +" .... . ..... ", +".... . . . ", +" . . . ", +".... ... . . ", +" . . . ", +"....... . . . ", +" . . . ", +".... ", +" + ", +"... + ", +" + ", +"...... + + + ", +" +++ ", +".... + ", +" ", +".... +++ +++ ", +" + + + + ", +"..... + + + + ", +" + + +++ ", +"...... + + + + ", +" + + + + ", +".... +++ +++ "}; diff --git a/src/musredit/images/musrprefs.xpm b/src/musredit/images/musrprefs.xpm new file mode 100644 index 00000000..f52e3e32 --- /dev/null +++ b/src/musredit/images/musrprefs.xpm @@ -0,0 +1,28 @@ +/* XPM */ +static char * musrprefs_xpm[] = { +"22 22 3 1", +" c None", +". c #3D20CF", +"+ c #000000", +"... ... ... ... ... ", +". . . . . . . ", +"... ... ... ... ... ", +". . . . . . ", +". . . ... . ... ", +" ", +" + + ", +" + + + ", +"+ ++++ ++ + ", +" + + + + ", +" + + ", +" ", +" + + ", +" + + + ++ ++ + ", +"+ + +++ + + + + + ", +" + + + + ", +" + + ", +" ", +" + + + ", +" + + + + + ", +"+ + +++++++++ + ++ +", +" + ++ ++ + + "}; diff --git a/src/musredit/images/musrsinglehisto.xpm b/src/musredit/images/musrsinglehisto.xpm new file mode 100644 index 00000000..bc1e3ec2 --- /dev/null +++ b/src/musredit/images/musrsinglehisto.xpm @@ -0,0 +1,29 @@ +/* XPM */ +static char * musrsinglehisto_xpm[] = { +"22 22 4 1", +" c None", +". c #3D20CF", +"+ c #FF0000", +"@ c #000000", +" ", +". . . .. ..... ... ", +".++ . . . . . . .", +". + . . . . . .", +"..... . .. . . .", +". +. . . . . .", +". . . . . . . .", +". .+. .. . ... ", +"@ + ", +"@ + ", +"@ + ", +"@ ++ ", +"@ + ", +"@ + ", +"@ + ", +"@ + ", +"@ ++ ", +"@ + ", +"@ ++ ", +"@ ++ ", +"@ ++ ", +"@@@@@@@@@@@@@@@@@@@+++"}; diff --git a/src/musredit/images/musrswap.xpm b/src/musredit/images/musrswap.xpm new file mode 100644 index 00000000..b95e4e9f --- /dev/null +++ b/src/musredit/images/musrswap.xpm @@ -0,0 +1,28 @@ +/* XPM */ +static char * musrswap_xpm[] = { +"22 22 3 1", +" c None", +". c #000000", +"+ c #FF0000", +".. .. .... .... ", +".. .. . . . . ", +". . . . . . . ", +". ... . ... . . ", +". . . .. .... ", +". . . . . ", +". . . . . . ", +". . .+.. . . ", +" +++ ", +" +++++ ", +" ++ + ++ ", +" + ", +" ++ + ++ ", +" +++++ ", +".. .. .+++... ... ", +".. .. . +.. .. .. ..", +". . . . . . . . .", +". ... . . . . . ", +". . . . . . . ...", +". . . . . . .", +". . . .. .. .. ..", +". . ....... ... "}; diff --git a/src/musredit/images/musrt0.xpm b/src/musredit/images/musrt0.xpm new file mode 100644 index 00000000..6a14ac0e --- /dev/null +++ b/src/musredit/images/musrt0.xpm @@ -0,0 +1,28 @@ +/* XPM */ +static char * musrt0_xpm[] = { +"22 22 3 1", +" c None", +". c #3D20CF", +"+ c #000000", +"..... .. ", +" . . . ", +" . . . ", +" . . . ", +" . + . . ++ ", +" . + . .+ ++ ", +" . + .. + + ", +" + + +++ ", +" + + + ", +" + + ++ ", +" + + + ", +" + + + ", +" + + ++ ", +" + + ++++ ", +" + + + ", +" + + ++", +" + + ", +" + + ", +" + + ", +" + ++ + ", +"++ + + ", +" "}; diff --git a/src/musredit/images/musrview.xpm b/src/musredit/images/musrview.xpm new file mode 100644 index 00000000..fad71c57 --- /dev/null +++ b/src/musredit/images/musrview.xpm @@ -0,0 +1,28 @@ +/* XPM */ +static char * musrview_xpm[] = { +"22 22 3 1", +" c None", +". c #000000", +"+ c #FF0000", +" .. ... .. ", +" ", +"......................", +" . ", +" . . ... ", +" ++ . ", +" ++ . ..... ", +" + + . ", +" + ... . ..... ", +" + . + . . ", +" +. + . . . ....", +" +. + . . ", +" + . + . . ... . ", +" + . + . . ", +" +. + . . ", +" +. + ... ", +" ++ . ", +" . ", +"......................", +" ", +" ....... .... .... ", +" "}; diff --git a/src/musredit/latex_images/abragam.png b/src/musredit/latex_images/abragam.png new file mode 100644 index 0000000000000000000000000000000000000000..d3ced8e4ed25cdab19b96cb3a1c613cc96b110ba GIT binary patch literal 918 zcmV;H18Mw;P)mMc0&lvBpqns=1AS165nUxgs2AZyRHPA+a0V^GRfxng5iQF!g|b$< zXiIl>tu7QbsQif4l}bYsMar*LpWZohKIWV~t1I-dGxN?n?>zIobLPxh1;A^#ps3*w zzyJn;QQe`jn^4?QdZcBInZ|LY&SxfT&Ks}J}RH7H0V8+7q>>(_l8@$Y$uZp zjaFbLUxk-U8O$A5Ze%%8#p^o5TSR*PH**w_BSE6->VaL5k3<_hcMDXdV4)DQI zx6t-v^*J`$JDPomypda`J0*|jqd~LN2CiyVmaTg=qqD%1fWrBXfFALjNtcT~I0t+s z^EBEZ=7c(-Qq`o0Nwmq z5FIs3M3*AbMV!RbOBMXM}U!0cqlad$@KN~H%P*(iexv+Ry# z&ts)qBrE!9u<1n9H26hYEnM~37@FB`dQfz?u`Cm;8UO$Q07*qoM6N<$g29QhNdN!< literal 0 HcmV?d00001 diff --git a/src/musredit/latex_images/abragam.tex b/src/musredit/latex_images/abragam.tex new file mode 100644 index 00000000..372a9a38 --- /dev/null +++ b/src/musredit/latex_images/abragam.tex @@ -0,0 +1,9 @@ +\documentclass[12pt]{article} +\pagestyle{empty} +\begin{document} + +\begin{displaymath} +\exp\left[ -(\sigma/\gamma)^2 \left( e^{-\gamma t} - 1 + \gamma t\right) \right] +\end{displaymath} + +\end{document} \ No newline at end of file diff --git a/src/musredit/latex_images/asymmetry.png b/src/musredit/latex_images/asymmetry.png new file mode 100644 index 0000000000000000000000000000000000000000..2f6a8fb8d5c156374eb1a759d343d70d73eb7477 GIT binary patch literal 139 zcmeAS@N?(olHy`uVBq!ia0vp^oFL2rBp5gS&5Q!lL7py-AsjQ4fBc`naAD&^dk#C6 zM_g_H19?7kN&fp^&mr`Rotueq!ihP@KGff;SNQnJ-k$mR|LHObo&W#xTvqVX`seN# nagdjHm%_D|TOH0h|NGByCf1%;QD!?M&~ye*S3j3^P6qEH|7u9)UmwX`ONQ&Tp@m=G#M z3q;K#NMgDa8J1d^PR*(FV{@kN|LffUw)}6IbRW(+_k8?*_ndn#gK{xw>(KxhFBiZq zv7pepQ;m2aj_fFgemJK}6J~K$#O7-_C&e?fB~};&Xjftb?w}yXgz&OwLe<|sq!S>x zfLm~;FSSsG!voklrVXeTfht@B(u*v!U{Wa52z*e$4bpdD^q2#o-p#CEKBZkeh&klC zR!$*{LDJU^!wJM-bqdr^YpiI6i;fa?R#&$M_)5I!U*DaHY)H(VgZW3qvEBNtu(SMg ze6Vc=YW`SxVpi+GfHdem7jPaG!Xlgg5if!3p_353Kmmq}R9gHXQ{!ujTn;?%y zWR|JyZxXJ2LMfm}TpzRq5zfZaz!3&a_D)r3Fyk(P6{z6Hc_kV#cfip_l?G8!+HMjR zjA3UnmLq{W8#E`Nd%f7Ssbx^RGq>l&kE3O__oP2M1NOx-xXRq`g1ElYirOppN8K2oQzJc?jso;^%3yI zLirJ%&^?vY+o((n1yg+sSQ>>_6O{A4mPEQ9a9kImd@Ybu4!q1|s2(rizN9dxtbXjD zZSFH$DkjO^Yr}NvN^{0vunQ>-o#wWfFZCnFu5RI2kw+&e)>@)>N(B0qhp2&)Eu&jj?u z#|}as)DiP}FTEiC7QXBL-{s9y?xfs*q|tT%2CMB&Ss#9IO#lD@07*qoM6N<$f{f;6 ABLDyZ literal 0 HcmV?d00001 diff --git a/src/musredit/latex_images/bessel.tex b/src/musredit/latex_images/bessel.tex new file mode 100644 index 00000000..0b372d7b --- /dev/null +++ b/src/musredit/latex_images/bessel.tex @@ -0,0 +1,9 @@ +\documentclass[12pt]{article} +\pagestyle{empty} +\begin{document} + +\begin{displaymath} +j_0(2\pi\nu t + \phi \pi/180) +\end{displaymath} + +\end{document} \ No newline at end of file diff --git a/src/musredit/latex_images/combiLGKT.png b/src/musredit/latex_images/combiLGKT.png new file mode 100644 index 0000000000000000000000000000000000000000..84b01e9aceb17ef26edb13443b29a59e324d09c8 GIT binary patch literal 603 zcmV-h0;K(kP)oMQ z+XH0w1ZigPf2IZeu7E4wvKODuEva+4lCgVJ)TfnYBJN1y* zWGgmjXXk2^6vrc(cc5Bjh@wY!aAozI=i)qUTwIAp4B@Dui8?F9@;xa$jjh5Q_DDq_ExkZg@~kh8lt}!&*G>{h*Akv9bdkKYpoh_D z7ph^bL5mnHXbv;GCQbW^Ge|j$e7F{b(1K=ux>kk2=K_k%N%U&xYa8HHkV>amM{$3? z7XxA6y!Va!YFr0>dbl3}zVCp78xC0qqep+panI2+9WAw52m{Q_Z-bSz95 z5%OVK5k{m~i+<=soSZTeLOz}Q-m|$g??nS0c=z6O=JUSid+&YY0HP1B<9e@j{xF$y zh@!r7E*2rPUl)HW*s;nX1AE1i$-H}%8eWfLx?UJ}c|k>0p2Eg%F{QF1ay3d{Gt}HC z*0?zyOT4Xd1pXr0a_A==N*JUA-P7_ek%8+YxHV&>B zl?D71Uk4>0?!w85Ou?~U&5Bta+Lt4RB?;qwq~H&qybGsqn`O#6hl;y1JH^qO=l-CW zu5sp8+`}bRSRH}&&Y5qXSAz{i zqd^h0n9!C09j$^(3q25>%^TN&y<}|_niOOSYM&!!X02a#4(tK(BdseQiSrn+TeFfBsL%@%A}L0Me4R7lqV$rPxS5l(8$$&wdK5ePuXpi zkJ6TA1+mv24Nnl9+krb&y&vrDy@o6n%A2xH*^CMJat%-MiykJPoR_!E> zts5mejO|5(>>GhjH{x?mGRy5tAxu8&;R_#lqkHyiF^oAzJG8eFZV1cs7@0%Sc#O_4rnf#wJ zCJem){y|BysJJx_1Vx_}Z#BLJr<{?*Z+cTA%R2(mxdQ>{(km;{t z8*H8mW*$gIjASS_i+u-l5#TJeztMS$keV6>VM6Z($s7Pe92wbtm4K9QYP!12uy|B+_+9O zL+Gq%YzP3pNcmexW}4vsh*OI?xzDb$=DS+0K-Gh`L2j#0(#+hay=f%UFu)B3KZ;gZ&)@Sf>ZVn$D*k3B{Q^`a4r zhv^wGEgo#gQmFif{KL4=IWg?IINWWj9qAG;Aji0Og61*Jw&>wftkL#Uxhw>vH>Wc) zR}5uKB4+)^SgdWphQWl7t@bW@x)Y{u0FimnGymXtHuuM?79edZc~T^43h_PM zi7MtF7Q^__N#}2!2Qll|T4`vpoaMawX^tS`XoEp5m@};yJT@ZI~8G_912GtZ{~Z`V}N7xS;=);gw(?lN#RQmPbGu2;>e5;)h|_kb9W z)#w|lqKwDQbo$B@Se0{W_|fC2CB)>;=~&4LBSgW+$tt5=6bYg4b_~*ntmO^wPzX=% zXFvepquj65gv9-xQ<56e(FcmQlDh(M1WSR3aX(EUnWw^#{VyGLC=Z3MZ{2y~#a?7XfWjmF| zwj1z-BGKcWRY&?lx+uahY&@zrdNx!&EnSA$=N)Ak`kjEFezjaR^=2AB)i5=4C2xV! z6|0@Wf?Y~aJ=hnJL=7Sg$Db~jY$Nrvrr|poN$m|^YqeoRCMUIlE@VEcA7iY)ZvE{P9Zu zOJ_%aq7GdX2-3C*^C-EsRphUn$*WGK>GT~2+x~QqX9lK zhLoW8y%g{7(!lP0Nqwg3dHV;%nZ&6nnO|282?N-5zchVNuMngZQ?o(^Iu&Aod!h!; zG=f>7s3fZ++SGdiy-|tf6>#r;Ot8#8sqOopbYC*?NELBY6hI#^s+s@XrYT1)7oAe$ zs7$xXBfoVawG%2oU%@RBOcolH!wzpR)AM_up-p`>064r4ch7^1KIqEP)7~{zka?pz>ARd$$R6I};4}^mUG%*n)L9I*Cm=O7?rfM3L9}|#B zpo+$#76jQCA(mf}0vaF)#o7{}t(5XpK4)fkOSh|AqP%3^y!rNf-@KW9vmAIx#!+V> zPhAZQ{lH^_wn9OWBCj0PqM_6(Vy!A3A~Nm}pG%&DbV?Rob8<5}oq{_;cu6a~OO>0X zmQ$~=1#l~nTO5pJh=tB6SK_hLKtFBD2A8hWMQeqCA5oBv=gZVZ=nH4n zr6^fF<;=7=6-3LuO96F6YPj|3idmF+q5%zx9b82*4bs9; zpOO)BV7Z?|LNF3cMYxMGLEU9!43V0)iO}7~@5HCTY?nzVsHz{+c0!sQVo+N%ZMzim zi2(9t1Yj>JtLSy2yBiksED5Gl&yj`XW?AX_lz9dYM#`ac4?`QC;)9~>ht)VnNe6Vq zcId{KZ%73^=7&| z*Y@+P3R+9oJHHsYvVOtyBK3(UN~oti{jC&!JB#3jl`{tMoZ@#6th20Xi!cBm={2yX z5cjB>;a;0)^e-C7{7H6ZqgTftC#H!?H6s!0?Hfbka1|Q*y9b$4ck*2OXjDxF`N7(0 zGiFRmCFA`tgZAE3Q=hZRKbxsvAhXjQK&Sec0!@>Ulya+OCHI4n^m?fB$ohFqd7YLy zGQR9m$;cM8jAFI+t2E<2*F@OjU$bJ{CUz!{hi^%H3ykysu2hgHbgUYSs1>_Wrg`19 kl?+HW$bDJF|HlvEH?|4%KX&#M;{X5v07*qoM6N<$f-63Avj6}9 literal 0 HcmV?d00001 diff --git a/src/musredit/latex_images/polynom.tex b/src/musredit/latex_images/polynom.tex new file mode 100644 index 00000000..cfcdf4b0 --- /dev/null +++ b/src/musredit/latex_images/polynom.tex @@ -0,0 +1,9 @@ +\documentclass[12pt]{article} +\pagestyle{empty} +\begin{document} + +\begin{displaymath} +\sum_{k=0}^n a_k (t-t_0)^k +\end{displaymath} + +\end{document} \ No newline at end of file diff --git a/src/musredit/latex_images/simpleExp.png b/src/musredit/latex_images/simpleExp.png new file mode 100644 index 0000000000000000000000000000000000000000..5936434547d1116065b139592524f7fe50ea955d GIT binary patch literal 418 zcmV;T0bTxyP);u0?H zc;Etz&IdKAp^&mot8%NK_7$sEiYAP!QfIvpb0x7C^OR~FEr1>U4ZMjM+zU~OUjP6A M07*qoM6N<$f_UY;@Bjb+ literal 0 HcmV?d00001 diff --git a/src/musredit/latex_images/simpleExp.tex b/src/musredit/latex_images/simpleExp.tex new file mode 100644 index 00000000..86049aa1 --- /dev/null +++ b/src/musredit/latex_images/simpleExp.tex @@ -0,0 +1,9 @@ +\documentclass[12pt]{article} +\pagestyle{empty} +\begin{document} + +\begin{displaymath} +\exp(-\lambda t) +\end{displaymath} + +\end{document} \ No newline at end of file diff --git a/src/musredit/latex_images/simpleGauss.png b/src/musredit/latex_images/simpleGauss.png new file mode 100644 index 0000000000000000000000000000000000000000..cfb854765da2edb7c59c5d6fe6645abebf70e182 GIT binary patch literal 624 zcmV-$0+0QPP)7)`}2F6iQ6JaIOXf~A0sNn>TExTbBjfhED3T=dq{s1`%yqk%jfXfiS`0)JI z>xzNZ6Yg}+oi_j7XR7>0`F@O`wE{RTOtMgxn@T=U78BK)weAM(_yrXaeHUB+&hX$!3$}6CDPVM=-GQdU20@^)j|i zo6o4UdVvy-+%^WF6~dy@A_Thf=*ul-TH zg_itw4p^xNuIL_ai+g8drN!>-6iyZ$u?2e+Z^X~CyBt(K({qui34KaZEIq!&OB^cR z;e6C7Nt*w(y$%b#9$wkEYq?-??5^k4a^o|B=xeS_t=1;0!sH+Cg@LeR1iy*^0000< KMNUMnLSTY^o+KRr literal 0 HcmV?d00001 diff --git a/src/musredit/latex_images/simpleGauss.tex b/src/musredit/latex_images/simpleGauss.tex new file mode 100644 index 00000000..e8f20339 --- /dev/null +++ b/src/musredit/latex_images/simpleGauss.tex @@ -0,0 +1,9 @@ +\documentclass[12pt]{article} +\pagestyle{empty} +\begin{document} + +\begin{displaymath} +\exp\left[-1/2(\sigma t)^2\right] +\end{displaymath} + +\end{document} \ No newline at end of file diff --git a/src/musredit/latex_images/statExpKT.png b/src/musredit/latex_images/statExpKT.png new file mode 100644 index 0000000000000000000000000000000000000000..0eba451d26066d2a9e71527ce623b25ce81e01c7 GIT binary patch literal 740 zcmVNFvjtmME&Gmx2j2a)KEn zEA3-EQ`W{69M*fgp};Rnh;6#1rH)~I!J(CK@TN{6DiCIBj%p>g41RZI;Y`NueBeN?HD0bv53xx3op2=u?-PX1L*&u2*Z2e9s&l+Ey;yl$i9@`+ z7+Vw0L7gri;M2)&ay33!n-gSY)XPkJF)~i-fKw6RQ|h_)NfiLEAwb)o{7iszCINKG zxddQx2VL};b?l8*Kq|oG2^BK*9lv`0Y+4tfVkX!BvN@ z3sdZaviiDp54G4YL^rchl{{I<4P) zTS!zv7(VYk^jt(QLA^#0^b#CF&@Lp@OD_dM7Wq_J5ka2uvRN(}$rfc26m&7Rj4oK# zrloEfx}>76Sz)3jmbjvM+0?Ip&N*|=oXf7(Q$ILo{@XX-Kl9J53V@88D4w;A zH9!n#Caa$at18(_d}5zUv0j8Gu^w~!s?Bd`i>k3C6gH105ykBAPw=E0Yi0YcD8(gt zXaS}fwD(+Z4cG+d%r!hlkN;SP^4GIdlF@OmU8qy=EKCHo7 z6SURJJgtwp_>Q}sF3`~E^xN_%XH|kiO$VLD3FJFLai8ZMa)3rq7scSmUfydkWBdII z;pG=Cv3vn=#Sh30DkOW#<5oQuA(uS;>JRD->K;y&caJt`r^m`Xm|p4dHxDy?t2Eov zLVwXZpb?Q*Olcsk6wFxRxV@rkVji^Q9MhoUO3mZA<$1O3Jp!1aO!p)!jBj2hT^0 zB*?dV>Kw){=uQ#9zYC1^v(VsqW`>W=b+$KT^Q;=ML7hD5^7`=1h|n;=_OD{s26I=k zUV0;HhKWm;hi8JU;uo6lXDxe&85YHCz_3N$0Iw*<;%O!Z^W8jKDQd?N8pd=rw^Axp z;@QUx=@&dpsN}3#VCxfZ$*Hl5=vilH_b+GVQhoJe!uylU+#Ay%cox$`(!}I*_ubES zm9brMW1eO|3pvkI11kLk*0OPkS9Y*R_%yl7gc`%6HZOoj%zIRlbec7%YW1fq>F&|K zFHXJup$pozz@lREtaq800+aT>e|6k<8D3lR0 +# +# Required Software +# +# This script requires the following software to be installed +# in the standard manner. Version numbers are those used in the +# development and testing of the script. +# +# Perl 5.8.0 (anything later than 4.036 should work) +# TeX 3.14159 (Web2C 7.3.1) +# LaTeX2e <2000/06/01> +# dvips dvipsk 5.86 +# Ghostscript 6.52 (2001-10-20) +# Netpbm 9.24 +# +# +# Default Configuration +# +# The following settings are the defaults used if the -dpi and +# -res options are not specified on the command line. +# +# The parameter $dpi controls how large the equation will appear +# with respect to other inline images and the surrounding text. +# The parameter is expressed in "dots per inch" in the PostScript +# sense. Unfortunately, since there's no standard text size in +# Web browsers (and most allow the user to change fonts and +# point sizes), there's no "right" value for this setting. The +# default of 150 seems about right for most documents. A setting +# of 75 generates equations at half the normal size, while 300 +# doubles the size of equations. The setting of $dpi can always be +# overridden by specifying the "-dpi" command line option. +# + $dpi = 150; +# +# The parameter $res specifies the oversampling as the ratio +# of the final image size to the initial black and white image. +# Smaller values produce smoothing with more levels of grey but +# require (much) more memory and intermediate file space to create +# the image. If you run out of memory or disc space with the +# default value of 0.5, try changing it to 0.75. A $res setting of +# 1.0 disables antialiasing entirely. The setting of $res can +# always be overridden by specifying the "res" command line option. +# + $res = 0.5; +# +# The $background parameter supplies a command, which may be +# void, to be inserted in the image processing pipeline to +# adjust the original black-on-white image so that its background +# agrees with that of the document in which it is to be inserted. +# For a document with the default grey background used by Mosaic +# and old versions of Netscape, use: +# +# $background = "ppmdim 0.7 |"; $transparent = "b2/b2/b2"; +# +# If your document uses a white background, the void specification: +# +# $background = ""; $transparent = "ff/ff/ff"; +# +# should be used. For colour or pattern backgrounds, you'll have +# to hack the code. The reason for adjusting the background is to +# ensure that when the image is resampled and then output with a +# transparent background the edges of the characters will fade +# smoothly into the page background. Otherwise you'll get a +# distracting "halo" around each character. You can override this +# default specification with the -grey command line option. +# + $background = ""; $transparent = "ff/ff/ff"; +# +# Image generation and decoding commands for GIF and PNG output. +# + $cmdGIF = 'ppmtogif'; + $cmdGIFdecode = 'giftopnm'; + $cmdPNG = 'pnmtopng'; + $cmdPNGdecode = 'pngtopnm'; +# +# Default image creation modes +# + $imageCmd = $cmdGIF; + $imageCmdD = $cmdGIFdecode; + $imageExt = 'gif'; + + # + # Command line option processing + # + while ($ARGV[0] =~ m/^-/) { + $_ = shift(@ARGV); + s/^--/-/; # Allow GNU-style -- options + if (m/^-d/) { # -dpi nnn + $dpi = shift(@ARGV); + } elsif (m/^-gi/) { # -gif + $imageCmd = $cmdGIF; + $imageCmdD = $cmdGIFdecode; + $imageExt = 'gif'; + } elsif (m/^-gr/) { # -grey n + $grey = shift(@ARGV); + $background = "ppmdim $grey | "; + $greylev = int(255 * $grey); + $transparent = sprintf("%02x/%02x/%02x", $greylev, $greylev, $greylev); + } elsif (m/^-h/) { # -help + &help(); + exit(0); + } elsif (m/^-p/) { # -png + $imageCmd = $cmdPNG; + $imageCmdD = $cmdPNGdecode; + $imageExt = 'png'; + } elsif (m/^-r/) { # -res nnn + $res = shift(@ARGV); + } elsif (m/^-v/) { # -version + print("Version $version\n"); + exit(0); + } + } + # + # Main file processing loop + # + foreach $f (@ARGV) { + $f =~ s/(.*)\.tex$/$1/; + &syscmd("echo x | latex $f \n"); + &syscmd("dvips -f $f >_temp_$$.ps\n"); + + # Assemble and execute the command pipeline which generates the image. + + # Start by invoking Ghostscript with the pbmraw output device and + # output file set to standard output ("-") and the requested resolution. + # The -q (Quiet) option is required; otherwise Ghostscript will send + # processing information to standard output and corrupt transmission + # of the bitmap to the next component in the pipeline. + $cmd = "echo quit | gs -q -dNOPAUSE -r" . int($dpi / $res). "x". int($dpi / $res) . + " -sOutputFile=- -sDEVICE=pbmraw _temp_$$.ps | " . + + # Next we crop white space surrounding the generated text, promote + # the monochrome bitmap to a grey scale image with 8 bits per pixel, + # apply whatever background adjustment transform is requested, and + # scale the image to the desired size. + "pnmcrop -white | pnmdepth 255 | $background pnmscale " . + $res . " | " . + + # Finally, convert the image to the desired output format and write + # the output file. + "$imageCmd -interlace -transparent rgb:$transparent >$f.$imageExt"; + &syscmd($cmd); + + # Sweep up debris left around by the various intermediate steps + &syscmd("rm $f.dvi $f.aux $f.log _temp_$$.ps"); + + # Print the reference to include this figure, including width and height, + # to standard error. + $r = `$imageCmdD $f.$imageExt | pnmfile`; + $r =~ m/(\d+) by (\d+)/; + print(STDERR "\n"); + } + + # Echo and execute a system command + + sub syscmd { + local ($cmd) = @_; + + print(STDERR "$cmd\n"); + system($cmd) == 0 || die("Error processing command:\n\t$cmd\n\t"); + } + + # Print help text + + sub help { + print <<"EOD" +usage: textogif [ options ] texfile... + Options: + -dpi n Set rendering dots per inch to n (default 150) + -gif Generate GIF image (default) + -grey Grey scale background level: 0 = black, 1 = white (default) + -help Print this message + -png Generate PNG image + -res n Set oversampling ratio, smaller = finer (default 0.5) + -version Print version number +For documentation and the latest version of this program +please visit the Web page: + http://www.fourmilab.ch/webtools/textogif/ +EOD +; + } diff --git a/src/musredit/latex_images/tfCos.png b/src/musredit/latex_images/tfCos.png new file mode 100644 index 0000000000000000000000000000000000000000..ade18c9557020a0a4ca32d619344092cb1084758 GIT binary patch literal 560 zcmV-00?+-4P)TVjF<|k;Ii}@KItnYkDo>+W zjL5HLiOi%Hu0C z_!cS2b`DGJ=M0@oVW06s?yS2enw3`JzI|3N)P`r86dt45e|B#m@fn9ViVq`TY*Bd& zwX^uC=|H6ZG0B~rf(<0Oz+?4Ss%=Q{hTYplIT4vu9?~lttYa#v{8+A?oB}^ zKSy8diy!(@`*>OhV=lkB&x94_z=`ODJg5A0>0Z28EM)EkTF4svdQWjaI@2j%dN3FE y4WKxdu`P%cS&@$Njz61-f0lDF51);qOvGQl2%jAhC$B>Q0000 +using namespace std; + +#include + +#include "PTextEdit.h" +#include "PFitOutputHandler.h" + +int main( int argc, char ** argv ) +{ + Q_INIT_RESOURCE(musredit); + + if (argc == 2) { + if (!strcmp(argv[1], "--help") || !strcmp(argv[1], "-h")) { + cout << endl << "usage: musrgui [] | -h, --help | -v, --version"; + cout << endl << endl; + return 0; + } else if (!strcmp(argv[1], "--version") || !strcmp(argv[1], "-v")) { + cout << endl << "musrgui version: $Id: main.cpp 3728 2009-02-27 11:52:00Z nemu $"; + cout << endl << endl; + return 0; + } + } + + QApplication a( argc, argv ); + + PTextEdit * mw = new PTextEdit(); + mw->setWindowTitle( "MusrFit Editor" ); + mw->resize( 800, 800 ); + mw->show(); + + a.connect( &a, SIGNAL( lastWindowClosed() ), &a, SLOT( quit() ) ); + return a.exec(); +} diff --git a/src/musredit/musredit.h b/src/musredit/musredit.h new file mode 100644 index 00000000..7fd3cf61 --- /dev/null +++ b/src/musredit/musredit.h @@ -0,0 +1,68 @@ +/**************************************************************************** + + musredit.h + + Author: Andreas Suter + e-mail: andreas.suter@psi.ch + + $Id$ + +*****************************************************************************/ + +/*************************************************************************** + * Copyright (C) 2010 by Andreas Suter * + * andreas.suter@psi.ch * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef _MUSREDIT_H_ +#define _MUSREDIT_H_ + +#include + +typedef struct { + int firstRun; + int lastRun; + QString runList; + QString runListFileName; + QString msrFileExtension; + int templateRunNo; + QString dbOutputFileName; + bool writeDbHeader; + bool summaryFilePresent; + bool keepMinuit2Output; + bool writeColumnData; + bool recreateDbFile; + bool chainFit; + bool openFilesAfterFitting; + bool titleFromDataFile; + bool createMsrFileOnly; + bool fitOnly; +} PMsr2DataParam; + +typedef struct { + QString findText; + QString replaceText; + bool caseSensitive; + bool wholeWordsOnly; + bool fromCursor; + bool findBackwards; + bool selectedText; + bool promptOnReplace; +} PFindReplaceData; + +#endif // _MUSREDIT_H_ diff --git a/src/musredit/musredit.pro b/src/musredit/musredit.pro new file mode 100644 index 00000000..4a45acd5 --- /dev/null +++ b/src/musredit/musredit.pro @@ -0,0 +1,89 @@ +TEMPLATE = app +TARGET = musredit +unix:target.path = $(ROOTSYS)/bin +macx:target.path = /Applications +win32:target.path = c:/musrfit/bin + +exists( /usr/bin/cygwin1.dll ) { + QMAKE_LFLAGS_SHAPP = -Wl,--enable-auto-import +} + +INSTALLS += target +QMAKE_CC = gcc +QMAKE_CXX = g++ + +# install path for the XML configuration file +unix:xml.path = $(ROOTSYS)/bin/ +macx:xml.path = $(ROOTSYS)/bin/ +win32:xml.path = c:/musrfit/bin +xml.files = musredit_startup.xml +INSTALLS += xml + +CONFIG += qt \ + warn_on \ + debug + +QT += xml + +HEADERS = musredit.h \ + PTextEdit.h \ + PSubTextEdit.h \ + PAdmin.h \ + PFindDialog.h \ + PReplaceDialog.h \ + PReplaceConfirmationDialog.h \ + PFitOutputHandler.h \ + PPrefsDialog.h \ + PGetDefaultDialog.h \ + PGetTitleBlockDialog.h \ + PGetParameterBlockDialog.h \ + PGetTheoryBlockDialog.h \ + PGetFunctionsBlockDialog.h \ + PGetAsymmetryRunBlockDialog.h \ + PGetSingleHistoRunBlockDialog.h \ + PGetNonMusrRunBlockDialog.h \ + PGetFourierBlockDialog.h \ + PGetPlotBlockDialog.h \ + PMsr2DataDialog.h \ + PMusrEditAbout.h + +SOURCES = PTextEdit.cpp \ + PSubTextEdit.cpp \ + PAdmin.cpp \ + PFindDialog.cpp \ + PReplaceDialog.cpp \ + PReplaceConfirmationDialog.cpp \ + PFitOutputHandler.cpp \ + PPrefsDialog.cpp \ + PGetDefaultDialog.cpp \ + PGetTitleBlockDialog.cpp \ + PGetParameterBlockDialog.cpp \ + PGetTheoryBlockDialog.cpp \ + PGetFunctionsBlockDialog.cpp \ + PGetAsymmetryRunBlockDialog.cpp \ + PGetSingleHistoRunBlockDialog.cpp \ + PGetNonMusrRunBlockDialog.cpp \ + PGetFourierBlockDialog.cpp \ + PGetPlotBlockDialog.cpp \ + PMsr2DataDialog.cpp \ + PMusrEditAbout.cpp \ + main.cpp + +FORMS = forms/PFindDialog.ui \ + forms/PReplaceDialog.ui \ + forms/PReplaceConfirmationDialog.ui \ + forms/PGetDefaultDialog.ui \ + forms/PMusrEditAbout.ui \ + forms/PPrefsDialog.ui \ + forms/PGetTitleBlockDialog.ui \ + forms/PGetParameterBlockDialog.ui \ + forms/PGetTheoryBlockDialog.ui \ + forms/PGetFunctionsBlockDialog.ui \ + forms/PGetAsymmetryRunBlockDialog.ui \ + forms/PGetSingleHistoRunBlockDialog.ui \ + forms/PGetNonMusrRunBlockDialog.ui \ + forms/PGetFourierBlockDialog.ui \ + forms/PGetPlotBlockDialog.ui \ + forms/PMsr2DataDialog.ui + +RESOURCES = musredit.qrc diff --git a/src/musredit/musredit.qrc b/src/musredit/musredit.qrc new file mode 100644 index 00000000..a3cd957f --- /dev/null +++ b/src/musredit/musredit.qrc @@ -0,0 +1,39 @@ + + + images/editcopy.xpm + images/editcut.xpm + images/editfind.xpm + images/editnext.xpm + images/editpaste.xpm + images/editprevious.xpm + images/editredo.xpm + images/editundo.xpm + images/filenew.xpm + images/fileopen.xpm + images/fileprint.xpm + images/filereload.xpm + images/filesave.xpm + images/musrasym.xpm + images/musrcalcchisq.xpm + images/musrfit.xpm + images/musrmsr2data.xpm + images/musrprefs.xpm + images/musrsinglehisto.xpm + images/musrswap.xpm + images/musrt0.xpm + images/musrview.xpm + latex_images/abragam.png + latex_images/asymmetry.png + latex_images/bessel.png + latex_images/combiLGKT.png + latex_images/generalExp.png + latex_images/internalBessel.png + latex_images/internalField.png + latex_images/polynom.png + latex_images/simpleExp.png + latex_images/simpleGauss.png + latex_images/statExpKT.png + latex_images/statGssKT.png + latex_images/tfCos.png + + diff --git a/src/musredit/musredit_startup.xml b/src/musredit/musredit_startup.xml new file mode 100644 index 00000000..be9d1d29 --- /dev/null +++ b/src/musredit/musredit_startup.xml @@ -0,0 +1,181 @@ + + + + $Id$ + This is handling default setting parameters for the musredit. + + + $ROOTSYS/bin + ./ + $HOME/analysis/musrfit/src/musredit + n + n + + + Courier + 12 + + + mue4 + psi + root-npp + y + + + + For a detailed description of the aim and structure of a msr-file see <b>https://wiki.intranet.psi.ch/MUSR/MusrFit</b> + Starting with >= Qt4.2 this will be linked automatically but until then ...; sorry ;-) + + + $HOME/analysis/musrfit/src/musredit/latex_images + + + asymmetry + + + asymmetry.png + 1 + + + simplExpo + (rate) + + simpleExp.png + 1 + + + generExpo + (rate exponent) + + generalExp.png + 2 + + + simpleGss + (rate) + + simpleGauss.png + 1 + + + statGssKT + (rate) + + statGssKT.png + 1 + + + statGssKTLF + (frequency damping) + + + 2 + + + dynGssKTLF + (frequency damping hopping-rate) + + + 3 + + + statExpKT + (rate) + + statExpKT.png + 1 + + + statExpKTLF + (frequency damping) + + + 2 + + + dynExpKTLF + (frequency damping hopping-rate) + + + 3 + + + combiLGKT + (LorentzRate GaussRate) + + combiLGKT.png + 2 + + + spinGlass + (rate hopping-rate order) + + + 3 + + + rdAnisoHf + (frequency rate) + + + 2 + + + abragam + (rate hopping-rate) + + abragam.png + 2 + + + internFld + (fraction phase frequency Trate Lrate) + + internalField.png + 5 + + + TFieldCos + (phase frequency) + + tfCos.png + 2 + + + bessel + (phase frequency) + + bessel.png + 2 + + + internBsl + (fraction phase frequency Trate Lrate) + + internalBessel.png + 5 + + + skewedGss + (phase frequency rate_m rate_p) + + + 4 + + + polynom + (tshift p0 p1 ... pn) + + polynom.png + 4 + + + userFcn + + + + 0 + + + + diff --git a/src/musredit/singleHistoDefault.msr b/src/musredit/singleHistoDefault.msr new file mode 100644 index 00000000..0f0632c1 --- /dev/null +++ b/src/musredit/singleHistoDefault.msr @@ -0,0 +1,60 @@ +TITLE +############################################################### +FITPARAMETER +# Nr. Name Value Step Pos_Error Boundaries + 1 Asy 0.26 0.01 none 0 0.33 + 2 Rate 0.36 0.01 none + 3 Field 100.0 1.0 none 0 200 + 4 N0_L 150.0 0.01 none + 5 Bkg_L 4.9 0.01 none + 6 Phase_L 7.0 1.5 none -50 50 + +############################################################### +THEORY +asymmetry 1 +simplExpo 2 (rate) +TFieldCos map1 fun1 (phase frequency) + +############################################################### +FUNCTIONS +fun1 = par3 * gamma_mu + +############################################################### +RUN lem07_his_0111 MUE4 PSI ROOT-NPP (name beamline institute data-file-format) +fittype 0 (single histogram fit) +norm 4 +backgr.fit 5 +lifetimecorrection +map 6 0 0 0 0 0 0 0 0 0 +forward 1 +data 3413 65000 +t0 3413 +fit 0.20 8.2 +packing 50 + +############################################################### +COMMANDS +SET BATCH +MINIMIZE +MINOS +SAVE +END RETURN + +############################################################### +PLOT 0 (single histo plot) +runs 1 +range 0.00 7.00 -0.30 0.30 + +############################################################### +FOURIER +units Gauss # fourier in field units +fourier_power 12 +apodization NONE # NONE, WEAK, MEDIUM, STRONG +plot power +phase 8.5 +#range_for_phase_correction 50.0 70.0 +range 0.0 200.0 + +############################################################### +STATISTIC --- 2008-06-09 14:09:39 + chisq = 1446.93547, NDF = 1377, chisq/NDF = 1.05078829