From aa066bdd4622d4f6824fee864f6be6806813f04d Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 30 Oct 2015 07:37:41 +0100 Subject: move to subdirectory-based build system Closes #224 --- spline-widget/functionconfig.h | 75 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 spline-widget/functionconfig.h (limited to 'spline-widget/functionconfig.h') diff --git a/spline-widget/functionconfig.h b/spline-widget/functionconfig.h new file mode 100644 index 00000000..6d76d0de --- /dev/null +++ b/spline-widget/functionconfig.h @@ -0,0 +1,75 @@ +/* Copyright (c) 2012-2015, Stanislaw Halik + + * Permission to use, copy, modify, and/or distribute this + * software for any purpose with or without fee is hereby granted, + * provided that the above copyright notice and this permission + * notice appear in all copies. + */ + +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include "opentrack-compat/qcopyable-mutex.hpp" + +class Map { +private: + static constexpr int value_count = 10000; + + struct State { + QList input; + std::vector data; + }; + + int precision() const; + void reload(); + float getValueInternal(int x); + + MyMutex _mutex; + QPointF last_input_value; + volatile bool activep; + double max_x; + double max_y; + + State cur, saved; +public: + double maxInput() const { return max_x; } + double maxOutput() const { return max_y; } + Map(); + Map(double maxx, double maxy) + { + setMaxInput(maxx); + setMaxOutput(maxy); + reload(); + } + + float getValue(float x); + bool getLastPoint(QPointF& point); + void removePoint(int i); + void removeAllPoints() { + QMutexLocker foo(&_mutex); + cur.input.clear(); + reload(); + } + + void addPoint(QPointF pt); + void movePoint(int idx, QPointF pt); + const QList getPoints(); + void setMaxInput(double MaxInput) { + max_x = MaxInput; + } + void setMaxOutput(double MaxOutput) { + max_y = MaxOutput; + } + + void saveSettings(QSettings& settings, const QString& title); + void loadSettings(QSettings& settings, const QString& title); + void invalidate_unsaved_settings(); + + void setTrackingActive(bool blnActive); +}; -- cgit v1.2.3