Skip to content

Commit

Permalink
minor fixes (switch off muparser unicode + others)
Browse files Browse the repository at this point in the history
  • Loading branch information
narunlifescience committed Apr 17, 2020
1 parent 21165bd commit 3c15f68
Show file tree
Hide file tree
Showing 10 changed files with 50 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
28 changes: 17 additions & 11 deletions 3rdparty/muparser/muParserDef.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion alphaplot.pro.user
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.9.1, 2020-04-15T05:51:13. -->
<!-- Written by QtCreator 4.9.1, 2020-04-17T08:21:55. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
Expand Down
13 changes: 13 additions & 0 deletions alphaplot/src/2Dplot/Axis2D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(); }
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions alphaplot/src/2Dplot/Axis2D.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion alphaplot/src/2Dplot/AxisRect2D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1843,6 +1843,7 @@ bool AxisRect2D::load(XmlStreamReader *xmlreader, QList<Table *> 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<double> *xdata = new QVector<double>();
Expand All @@ -1869,7 +1870,6 @@ bool AxisRect2D::load(XmlStreamReader *xmlreader, QList<Table *> 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;
Expand Down Expand Up @@ -2139,6 +2139,7 @@ bool AxisRect2D::load(XmlStreamReader *xmlreader, QList<Table *> tabs,
}
} else
xmlreader->raiseError(tr("Bar2D type not found error"));
bar->setName(legend);
// stackgap
int stackgap = xmlreader->readAttributeInt("stackgap", &ok);
if (ok) {
Expand Down
8 changes: 8 additions & 0 deletions alphaplot/src/2Dplot/widgets/propertyeditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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_);
Expand Down Expand Up @@ -2115,6 +2117,10 @@ void PropertyEditor::valueChange(QtProperty *prop, const int value) {
Axis2D *axis = getgraph2dobject<Axis2D>(objectbrowser_->currentItem());
axis->setlabelpadding_axis(value);
axis->layer()->replot();
} else if (prop->compare(axispropertytickcountitem_)) {
Axis2D *axis = getgraph2dobject<Axis2D>(objectbrowser_->currentItem());
axis->settickscount_axis(value);
axis->layer()->replot();
} else if (prop->compare(axispropertyticklengthinitem_)) {
Axis2D *axis = getgraph2dobject<Axis2D>(objectbrowser_->currentItem());
axis->setticklengthin_axis(value);
Expand Down Expand Up @@ -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_,
Expand Down Expand Up @@ -5058,6 +5065,7 @@ void PropertyEditor::setObjectPropertyId() {
// Axis Properties Ticks sub block
axispropertytickvisibilityitem_->setPropertyId(
"axispropertytickvisibilityitem_");
axispropertytickcountitem_->setPropertyId("axispropertytickcountitem_");
axispropertyticklengthinitem_->setPropertyId("axispropertyticklengthinitem_");
axispropertyticklengthoutitem_->setPropertyId(
"axispropertyticklengthoutitem_");
Expand Down
1 change: 1 addition & 0 deletions alphaplot/src/2Dplot/widgets/propertyeditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_;
Expand Down
1 change: 1 addition & 0 deletions alphaplot/src/future/table/future_Table.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
#include <QtDebug>
#include <QtGlobal>
#include <climits> // for RAND_MAX
#include <cmath>

#include "TeXTableExportDialog.h"
#include "TeXTableSettings.h"
Expand Down
7 changes: 4 additions & 3 deletions alphaplot/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include "globals.h"

#ifdef Q_OS_WIN
#include <Windows.h>
#include <windows.h>
#endif // Q_OS_WIN

/*page style Coding Style
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 3c15f68

Please sign in to comment.