From c4e0e7f7502355030fa66fdaf3ec3f388a815ea4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Fri, 30 Dec 2016 17:20:14 +0100 Subject: [PATCH] [apps/graph] Make graph window inherit from window curve view with cursor Change-Id: Ib787e5175e74c41b08bda59d25740a83f726146f --- apps/graph/graph/graph_window.cpp | 11 +---------- apps/graph/graph/graph_window.h | 8 ++------ 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/apps/graph/graph/graph_window.cpp b/apps/graph/graph/graph_window.cpp index 5b46299a0..3b02a0063 100644 --- a/apps/graph/graph/graph_window.cpp +++ b/apps/graph/graph/graph_window.cpp @@ -8,6 +8,7 @@ namespace Graph { GraphWindow::GraphWindow(FunctionStore * functionStore) : + CurveViewWindowWithCursor(), m_xMin(-10.0f), m_xMax(10.0f), m_yMin(-10.0f), @@ -15,8 +16,6 @@ GraphWindow::GraphWindow(FunctionStore * functionStore) : m_yAuto(true), m_xGridUnit(2.0f), m_yGridUnit(2.0f), - m_xCursorPosition(NAN), - m_yCursorPosition(NAN), m_indexFunctionSelectedByCursor(0), m_functionStore(functionStore), m_context(nullptr) @@ -199,14 +198,6 @@ void GraphWindow::setDefault() { setYAuto(true); } -float GraphWindow::xCursorPosition() { - return m_xCursorPosition; -} - -float GraphWindow::yCursorPosition() { - return m_yCursorPosition; -} - float GraphWindow::derivativeAtCursorPosition() { Function * f = m_functionStore->activeFunctionAtIndex(m_indexFunctionSelectedByCursor); return f->approximateDerivative(m_xCursorPosition, m_context); diff --git a/apps/graph/graph/graph_window.h b/apps/graph/graph/graph_window.h index fa36cfdc7..cbbb36012 100644 --- a/apps/graph/graph/graph_window.h +++ b/apps/graph/graph/graph_window.h @@ -2,11 +2,11 @@ #define GRAPH_GRAPH_AXIS_INTERVAL_H #include "../function_store.h" -#include "../../curve_view_window.h" +#include "../../curve_view_window_with_cursor.h" namespace Graph { -class GraphWindow : public CurveViewWindow { +class GraphWindow : public CurveViewWindowWithCursor { public: enum class Direction { Up, @@ -38,8 +38,6 @@ public: void roundAbscissa(); void normalize(); void setDefault(); - float xCursorPosition(); - float yCursorPosition(); float derivativeAtCursorPosition(); Function * functionSelectedByCursor(); void setCursorPositionAtAbscissaWithFunction(float abscissa, Function * function); @@ -60,8 +58,6 @@ private: bool m_yAuto; float m_xGridUnit; float m_yGridUnit; - float m_xCursorPosition; - float m_yCursorPosition; int m_indexFunctionSelectedByCursor; FunctionStore * m_functionStore; Context * m_context;