From 3c15f6898df1745b62cf381bad29e717ac03a133 Mon Sep 17 00:00:00 2001 From: narunlifescience Date: Fri, 17 Apr 2020 08:28:23 +0530 Subject: [PATCH] minor fixes (switch off muparser unicode + others) --- .travis.yml | 2 +- 3rdparty/muparser/muParserDef.h | 28 +++++++++++-------- alphaplot.pro.user | 2 +- alphaplot/src/2Dplot/Axis2D.cpp | 13 +++++++++ alphaplot/src/2Dplot/Axis2D.h | 2 ++ alphaplot/src/2Dplot/AxisRect2D.cpp | 3 +- .../src/2Dplot/widgets/propertyeditor.cpp | 8 ++++++ alphaplot/src/2Dplot/widgets/propertyeditor.h | 1 + alphaplot/src/future/table/future_Table.cpp | 1 + alphaplot/src/main.cpp | 7 +++-- 10 files changed, 50 insertions(+), 17 deletions(-) diff --git a/.travis.yml b/.travis.yml index 80252b79..fc8ba4ad 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,7 +8,7 @@ before_install: - sudo add-apt-repository --yes ppa:ubuntu-sdk-team/ppa - sudo apt-get update -qq - sudo apt-get install -y libgsl0-dev - - sudo apt-get install qtbase5-dev qtdeclarative5-dev libqt5webkit5-dev qtscript5-dev + - sudo apt-get install qtbase5-dev qtdeclarative5-dev libqt5webkit5-dev libqt5xmlpatterns5-dev qtscript5-dev - sudo apt-get install qt5-default qttools5-dev-tools libqt5svg5-dev - sudo apt-get install -y zlib1g-dev # add include files path (Linux) diff --git a/3rdparty/muparser/muParserDef.h b/3rdparty/muparser/muParserDef.h index 437f2eaf..33c838b8 100644 --- a/3rdparty/muparser/muParserDef.h +++ b/3rdparty/muparser/muParserDef.h @@ -58,12 +58,12 @@ //#define MUP_USE_OPENMP #if defined(_UNICODE) - /** \brief Definition of the basic parser string type. */ - #define MUP_STRING_TYPE std::wstring +#ifndef _T +#define _T(x) x +#endif - #if !defined(_T) - #define _T(x) L##x - #endif // not defined _T +/** \brief Definition of the basic parser string type. */ +#define MUP_STRING_TYPE std::string #else #ifndef _T #define _T(x) x @@ -107,16 +107,22 @@ namespace mu #if defined(_UNICODE) //------------------------------------------------------------------------------ - /** \brief Encapsulate wcout. */ - inline std::wostream& console() + /** \brief Encapsulate cout. + + Used for supporting UNICODE more easily. + */ + inline std::ostream& console() { - return std::wcout; + return std::cout; } - /** \brief Encapsulate cin. */ - inline std::wistream& console_in() + /** \brief Encapsulate cin. + + Used for supporting UNICODE more easily. + */ + inline std::istream& console_in() { - return std::wcin; + return std::cin; } #else diff --git a/alphaplot.pro.user b/alphaplot.pro.user index 43b1e94c..6dda4ad4 100644 --- a/alphaplot.pro.user +++ b/alphaplot.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId diff --git a/alphaplot/src/2Dplot/Axis2D.cpp b/alphaplot/src/2Dplot/Axis2D.cpp index c3247314..a4de3aa2 100644 --- a/alphaplot/src/2Dplot/Axis2D.cpp +++ b/alphaplot/src/2Dplot/Axis2D.cpp @@ -137,6 +137,8 @@ Qt::PenStyle Axis2D::gettickstrokestyle_axis() const { return tickPen().style(); } +int Axis2D::gettickscount_axis() const { return ticker_->tickCount(); } + bool Axis2D::getsubtickvisibility_axis() const { return subTicks(); } int Axis2D::getsubticklengthin_axis() const { return subTickLengthIn(); } @@ -283,6 +285,11 @@ void Axis2D::settickstrokestyle_axis(const Qt::PenStyle &style) { setTickPen(pen); } +void Axis2D::settickscount_axis(const int count) { + ticker_->setTickCount(count); + setTicker(ticker_); +} + void Axis2D::setsubtickvisibility_axis(const bool value) { setSubTicks(value); } void Axis2D::setsubticklengthin_axis(const int value) { @@ -486,6 +493,7 @@ void Axis2D::save(XmlStreamWriter *xmlwriter) { xmlwriter->writeStartElement("ticks"); (gettickvisibility_axis()) ? xmlwriter->writeAttribute("visible", "true") : xmlwriter->writeAttribute("visible", "false"); + xmlwriter->writeAttribute("count", QString::number(gettickscount_axis())); xmlwriter->writeAttribute("in", QString::number(getticklengthin_axis())); xmlwriter->writeAttribute("out", QString::number(getticklengthout_axis())); xmlwriter->writePen(tickPen()); @@ -674,6 +682,11 @@ bool Axis2D::load(XmlStreamReader *xmlreader) { else xmlreader->raiseWarning( tr("Axis2D tick visible property setting error")); + // Tick count + int count = xmlreader->readAttributeInt("count", &ok); + (ok) ? settickscount_axis(count) + : xmlreader->raiseWarning( + tr("Axis2D Tick count in property setting error")); // Ticks in int in = xmlreader->readAttributeInt("in", &ok); if (ok) diff --git a/alphaplot/src/2Dplot/Axis2D.h b/alphaplot/src/2Dplot/Axis2D.h index 24b7400c..0f0dd365 100644 --- a/alphaplot/src/2Dplot/Axis2D.h +++ b/alphaplot/src/2Dplot/Axis2D.h @@ -81,6 +81,7 @@ class Axis2D : public QCPAxis { QColor gettickstrokecolor_axis() const; double gettickstrokethickness_axis() const; Qt::PenStyle gettickstrokestyle_axis() const; + int gettickscount_axis() const; // Sub-tick properties bool getsubtickvisibility_axis() const; int getsubticklengthin_axis() const; @@ -124,6 +125,7 @@ class Axis2D : public QCPAxis { void settickstrokecolor_axis(const QColor &color); void settickstrokethickness_axis(const double value); void settickstrokestyle_axis(const Qt::PenStyle &style); + void settickscount_axis(const int count); // Sub-tick properties void setsubtickvisibility_axis(const bool value); void setsubticklengthin_axis(const int value); diff --git a/alphaplot/src/2Dplot/AxisRect2D.cpp b/alphaplot/src/2Dplot/AxisRect2D.cpp index d4e06933..d17e40bb 100644 --- a/alphaplot/src/2Dplot/AxisRect2D.cpp +++ b/alphaplot/src/2Dplot/AxisRect2D.cpp @@ -1843,6 +1843,7 @@ bool AxisRect2D::load(XmlStreamReader *xmlreader, QList tabs, if (table && xcolumn && ycolumn && xaxis && yaxis) { curve = addCurve2DPlot(ctype, table, xcolumn, ycolumn, from, to, xaxis, yaxis); + curve->setlegendtext_cplot(legend); } } else if (ok && datatype == "function") { QVector *xdata = new QVector(); @@ -1869,7 +1870,6 @@ bool AxisRect2D::load(XmlStreamReader *xmlreader, QList
tabs, xdata->size() == ydata->size() && xaxis && yaxis) { curve = addFunction2DPlot(xdata, ydata, xaxis, yaxis, legend); curve->setlegendtext_cplot(legend); - // curve->load(xmlreader); } else { xmlreader->raiseError(tr("Curve2D function skipped due to error")); delete xdata; @@ -2139,6 +2139,7 @@ bool AxisRect2D::load(XmlStreamReader *xmlreader, QList
tabs, } } else xmlreader->raiseError(tr("Bar2D type not found error")); + bar->setName(legend); // stackgap int stackgap = xmlreader->readAttributeInt("stackgap", &ok); if (ok) { diff --git a/alphaplot/src/2Dplot/widgets/propertyeditor.cpp b/alphaplot/src/2Dplot/widgets/propertyeditor.cpp index 74a275e5..8ca35e7d 100644 --- a/alphaplot/src/2Dplot/widgets/propertyeditor.cpp +++ b/alphaplot/src/2Dplot/widgets/propertyeditor.cpp @@ -140,6 +140,8 @@ PropertyEditor::PropertyEditor(QWidget *parent) axispropertylabelpaddingitem_ = intManager_->addProperty("Label Padding"); // Axis Properties Ticks sub block axispropertytickvisibilityitem_ = boolManager_->addProperty("Axis Ticks"); + axispropertytickcountitem_ = intManager_->addProperty("Count"); + axispropertytickvisibilityitem_->addSubProperty(axispropertytickcountitem_); axispropertyticklengthinitem_ = intManager_->addProperty("Length In"); axispropertytickvisibilityitem_->addSubProperty( axispropertyticklengthinitem_); @@ -2115,6 +2117,10 @@ void PropertyEditor::valueChange(QtProperty *prop, const int value) { Axis2D *axis = getgraph2dobject(objectbrowser_->currentItem()); axis->setlabelpadding_axis(value); axis->layer()->replot(); + } else if (prop->compare(axispropertytickcountitem_)) { + Axis2D *axis = getgraph2dobject(objectbrowser_->currentItem()); + axis->settickscount_axis(value); + axis->layer()->replot(); } else if (prop->compare(axispropertyticklengthinitem_)) { Axis2D *axis = getgraph2dobject(objectbrowser_->currentItem()); axis->setticklengthin_axis(value); @@ -2913,6 +2919,7 @@ void PropertyEditor::Axis2DPropertyBlock(Axis2D *axis) { axis->getlabelpadding_axis()); boolManager_->setValue(axispropertytickvisibilityitem_, axis->gettickvisibility_axis()); + intManager_->setValue(axispropertytickcountitem_, axis->gettickscount_axis()); intManager_->setValue(axispropertyticklengthinitem_, axis->getticklengthin_axis()); intManager_->setValue(axispropertyticklengthoutitem_, @@ -5058,6 +5065,7 @@ void PropertyEditor::setObjectPropertyId() { // Axis Properties Ticks sub block axispropertytickvisibilityitem_->setPropertyId( "axispropertytickvisibilityitem_"); + axispropertytickcountitem_->setPropertyId("axispropertytickcountitem_"); axispropertyticklengthinitem_->setPropertyId("axispropertyticklengthinitem_"); axispropertyticklengthoutitem_->setPropertyId( "axispropertyticklengthoutitem_"); diff --git a/alphaplot/src/2Dplot/widgets/propertyeditor.h b/alphaplot/src/2Dplot/widgets/propertyeditor.h index f6d08e80..f873e154 100644 --- a/alphaplot/src/2Dplot/widgets/propertyeditor.h +++ b/alphaplot/src/2Dplot/widgets/propertyeditor.h @@ -153,6 +153,7 @@ class PropertyEditor : public QDockWidget { QtProperty *axispropertylabelpaddingitem_; // Axis Properties Ticks sub block QtProperty *axispropertytickvisibilityitem_; + QtProperty *axispropertytickcountitem_; QtProperty *axispropertyticklengthinitem_; QtProperty *axispropertyticklengthoutitem_; QtProperty *axispropertytickstrokecoloritem_; diff --git a/alphaplot/src/future/table/future_Table.cpp b/alphaplot/src/future/table/future_Table.cpp index 0d278202..f9fbf8b1 100644 --- a/alphaplot/src/future/table/future_Table.cpp +++ b/alphaplot/src/future/table/future_Table.cpp @@ -56,6 +56,7 @@ #include #include #include // for RAND_MAX +#include #include "TeXTableExportDialog.h" #include "TeXTableSettings.h" diff --git a/alphaplot/src/main.cpp b/alphaplot/src/main.cpp index dc981d48..e7cc31e8 100644 --- a/alphaplot/src/main.cpp +++ b/alphaplot/src/main.cpp @@ -29,7 +29,7 @@ #include "globals.h" #ifdef Q_OS_WIN -#include +#include #endif // Q_OS_WIN /*page style Coding Style @@ -124,11 +124,12 @@ int main(int argc, char** argv) { #ifdef Q_OS_WIN // solves high density dpi scaling in windows // https://vicrucann.github.io/tutorials/osg-qt-high-dpi/ - SetProcessDPIAware(); // call before the main event loop + // SetProcessDPIAware(); + // call before the main event loop #endif // Q_OS_WIN // https://vicrucann.github.io/tutorials/osg-qt-high-dpi/ - QApplication::setAttribute(Qt::AA_DisableHighDpiScaling); + QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); Application* app = new Application(argc, argv); // icon initiation (mandatory)