summaryrefslogtreecommitdiff
path: root/wx+/graph.h
diff options
context:
space:
mode:
authorB Stack <bgstack15@gmail.com>2018-09-10 02:46:25 +0000
committerB Stack <bgstack15@gmail.com>2018-09-10 02:46:25 +0000
commit728d32e6da9ce66968f8eef47a59505d613e2c1b (patch)
tree0f0441755ff0e6d65e12222d4502c648bffd6a7c /wx+/graph.h
parent10.3 (diff)
parentpull in latest 10.4 from upstream (diff)
downloadFreeFileSync-10.4.tar.gz
FreeFileSync-10.4.tar.bz2
FreeFileSync-10.4.zip
Merge branch '10.4' into 'master'10.4
pull in latest 10.4 from upstream See merge request opensource-tracking/FreeFileSync!1
Diffstat (limited to 'wx+/graph.h')
-rwxr-xr-xwx+/graph.h29
1 files changed, 14 insertions, 15 deletions
diff --git a/wx+/graph.h b/wx+/graph.h
index e0c2c12b..f1ae5d5a 100755
--- a/wx+/graph.h
+++ b/wx+/graph.h
@@ -14,7 +14,6 @@
#include <wx/settings.h>
#include <wx/bitmap.h>
#include <zen/string_tools.h>
-#include <zen/optional.h>
//elegant 2D graph as wxPanel specialization
@@ -63,8 +62,8 @@ struct SparseCurveData : public CurveData
{
SparseCurveData(bool addSteps = false) : addSteps_(addSteps) {} //addSteps: add points to get a staircase effect or connect points via a direct line
- virtual Opt<CurvePoint> getLessEq (double x) const = 0;
- virtual Opt<CurvePoint> getGreaterEq(double x) const = 0;
+ virtual std::optional<CurvePoint> getLessEq (double x) const = 0;
+ virtual std::optional<CurvePoint> getGreaterEq(double x) const = 0;
private:
std::vector<CurvePoint> getPoints(double minX, double maxX, const wxSize& areaSizePx) const override;
@@ -80,21 +79,21 @@ struct ArrayCurveData : public SparseCurveData
private:
std::pair<double, double> getRangeX() const override { const size_t sz = getSize(); return { 0.0, sz == 0 ? 0.0 : sz - 1.0}; }
- Opt<CurvePoint> getLessEq(double x) const override
+ std::optional<CurvePoint> getLessEq(double x) const override
{
const size_t sz = getSize();
const size_t pos = std::min<ptrdiff_t>(std::floor(x), sz - 1); //[!] expect unsigned underflow if empty!
if (pos < sz)
return CurvePoint(pos, getValue(pos));
- return NoValue();
+ return {};
}
- Opt<CurvePoint> getGreaterEq(double x) const override
+ std::optional<CurvePoint> getGreaterEq(double x) const override
{
const size_t pos = std::max<ptrdiff_t>(std::ceil(x), 0); //[!] use std::max with signed type!
if (pos < getSize())
return CurvePoint(pos, getValue(pos));
- return NoValue();
+ return {};
}
};
@@ -246,7 +245,7 @@ public:
MainAttributes& setMinY(double newMinY) { minY = newMinY; return *this; }
MainAttributes& setMaxY(double newMaxY) { maxY = newMaxY; return *this; }
- MainAttributes& setAutoSize() { minX = maxX = minY = maxY = NoValue(); return *this; }
+ MainAttributes& setAutoSize() { minX = maxX = minY = maxY = {}; return *this; }
MainAttributes& setLabelX(PosLabelX posX, int height = -1, std::shared_ptr<LabelFormatter> newLabelFmt = nullptr)
{
@@ -272,18 +271,18 @@ public:
private:
friend class Graph2D;
- Opt<double> minX; //x-range to visualize
- Opt<double> maxX; //
+ std::optional<double> minX; //x-range to visualize
+ std::optional<double> maxX; //
- Opt<double> minY; //y-range to visualize
- Opt<double> maxY; //
+ std::optional<double> minY; //y-range to visualize
+ std::optional<double> maxY; //
PosLabelX labelposX = LABEL_X_BOTTOM;
- Opt<int> xLabelHeight;
+ std::optional<int> xLabelHeight;
std::shared_ptr<LabelFormatter> labelFmtX = std::make_shared<DecimalNumberFormatter>();
PosLabelY labelposY = LABEL_Y_LEFT;
- Opt<int> yLabelWidth;
+ std::optional<int> yLabelWidth;
std::shared_ptr<LabelFormatter> labelFmtY = std::make_shared<DecimalNumberFormatter>();
std::map<PosCorner, wxString> cornerTexts;
@@ -337,7 +336,7 @@ private:
MainAttributes attr_; //global attributes
- Opt<wxBitmap> doubleBuffer_;
+ std::optional<wxBitmap> doubleBuffer_;
using CurveList = std::vector<std::pair<std::shared_ptr<CurveData>, CurveAttributes>>;
CurveList curves_;
bgstack15