From a6ce2e2c1c7a9f14f3894283cd11a8d849dad56f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Mon, 2 Jan 2017 16:58:53 +0100 Subject: [PATCH] [apps] Move the zoom parameter controller from apps/raph/graph to apps to use it with the regression graph Change-Id: Ia86cd9d085f990b329db55e7e841c9ea2571a2be --- apps/Makefile | 1 + apps/graph/Makefile | 1 - apps/graph/graph/graph_controller.h | 2 +- .../graph => }/zoom_parameter_controller.cpp | 18 ++++++--------- .../graph => }/zoom_parameter_controller.h | 22 ++++++++----------- 5 files changed, 18 insertions(+), 26 deletions(-) rename apps/{graph/graph => }/zoom_parameter_controller.cpp (84%) rename apps/{graph/graph => }/zoom_parameter_controller.h (68%) diff --git a/apps/Makefile b/apps/Makefile index e82535894..618ae8552 100644 --- a/apps/Makefile +++ b/apps/Makefile @@ -32,6 +32,7 @@ app_objs += $(addprefix apps/,\ variable_box_controller.o\ variable_box_leaf_cell.o\ window_parameter_controller.o\ + zoom_parameter_controller.o\ ) # Tracking which source file uses which image is painful. But we need to ensure diff --git a/apps/graph/Makefile b/apps/graph/Makefile index 51ddd89db..bff3915e2 100644 --- a/apps/graph/Makefile +++ b/apps/graph/Makefile @@ -10,7 +10,6 @@ app_objs += $(addprefix apps/graph/,\ graph/graph_controller.o\ graph/graph_view.o\ graph/initialisation_parameter_controller.o\ - graph/zoom_parameter_controller.o\ list/function_expression_view.o\ list/new_function_cell.o\ list/list_controller.o\ diff --git a/apps/graph/graph/graph_controller.h b/apps/graph/graph/graph_controller.h index 451075a6f..9ea1e46a8 100644 --- a/apps/graph/graph/graph_controller.h +++ b/apps/graph/graph/graph_controller.h @@ -7,7 +7,7 @@ #include "../../window_parameter_controller.h" #include "curve_parameter_controller.h" #include "initialisation_parameter_controller.h" -#include "zoom_parameter_controller.h" +#include "../../zoom_parameter_controller.h" #include "../function_store.h" namespace Graph { diff --git a/apps/graph/graph/zoom_parameter_controller.cpp b/apps/zoom_parameter_controller.cpp similarity index 84% rename from apps/graph/graph/zoom_parameter_controller.cpp rename to apps/zoom_parameter_controller.cpp index 3a91f001e..8a46ff5f2 100644 --- a/apps/graph/graph/zoom_parameter_controller.cpp +++ b/apps/zoom_parameter_controller.cpp @@ -2,13 +2,11 @@ #include #include -namespace Graph { - constexpr KDColor ZoomParameterController::ContentView::LegendView::k_legendBackgroundColor; /* Zoom Parameter Controller */ -ZoomParameterController::ZoomParameterController(Responder * parentResponder, GraphWindow * graphWindow, GraphView * graphView) : +ZoomParameterController::ZoomParameterController(Responder * parentResponder, CurveViewWindowWithCursor * graphWindow, CurveViewWithBannerAndCursor * graphView) : ViewController(parentResponder), m_contentView(ContentView(graphView)), m_graphWindow(graphWindow) @@ -35,22 +33,22 @@ bool ZoomParameterController::handleEvent(Ion::Events::Event event) { return true; } if (event == Ion::Events::Up) { - m_graphWindow->translateWindow(GraphWindow::Direction::Up); + m_graphWindow->translateWindow(CurveViewWindowWithCursor::Direction::Up); m_contentView.graphView()->reload(); return true; } if (event == Ion::Events::Down) { - m_graphWindow->translateWindow(GraphWindow::Direction::Down); + m_graphWindow->translateWindow(CurveViewWindowWithCursor::Direction::Down); m_contentView.graphView()->reload(); return true; } if (event == Ion::Events::Left) { - m_graphWindow->translateWindow(GraphWindow::Direction::Left); + m_graphWindow->translateWindow(CurveViewWindowWithCursor::Direction::Left); m_contentView.graphView()->reload(); return true; } if (event == Ion::Events::Right) { - m_graphWindow->translateWindow(GraphWindow::Direction::Right); + m_graphWindow->translateWindow(CurveViewWindowWithCursor::Direction::Right); m_contentView.graphView()->reload(); return true; } @@ -64,7 +62,7 @@ void ZoomParameterController::didBecomeFirstResponder() { /* Content View */ -ZoomParameterController::ContentView::ContentView(GraphView * graphView) : +ZoomParameterController::ContentView::ContentView(CurveViewWithBannerAndCursor * graphView) : m_graphView(graphView) { } @@ -86,7 +84,7 @@ void ZoomParameterController::ContentView::layoutSubviews() { m_legendView.setFrame(KDRect(0, bounds().height() - k_legendHeight, bounds().width(), k_legendHeight)); } -GraphView * ZoomParameterController::ContentView::graphView() { +CurveViewWithBannerAndCursor * ZoomParameterController::ContentView::graphView() { return m_graphView; } @@ -129,5 +127,3 @@ void ZoomParameterController::ContentView::LegendView::layoutSubviews() { m_legends[3+row].setFrame(KDRect(width/2, row*heigth/3, width/2 - k_tokenWidth, heigth/3)); } } - -} \ No newline at end of file diff --git a/apps/graph/graph/zoom_parameter_controller.h b/apps/zoom_parameter_controller.h similarity index 68% rename from apps/graph/graph/zoom_parameter_controller.h rename to apps/zoom_parameter_controller.h index f620f0144..47b7c6303 100644 --- a/apps/graph/graph/zoom_parameter_controller.h +++ b/apps/zoom_parameter_controller.h @@ -1,15 +1,13 @@ -#ifndef GRAPH_GRAPH_ZOOM_PARAMETER_CONTROLLER_H -#define GRAPH_GRAPH_ZOOM_PARAMETER_CONTROLLER_H +#ifndef APPS_ZOOM_PARAMETER_CONTROLLER_H +#define APPS_ZOOM_PARAMETER_CONTROLLER_H #include -#include "graph_window.h" -#include "graph_view.h" - -namespace Graph { +#include "curve_view_window_with_cursor.h" +#include "curve_view_with_banner_and_cursor.h" class ZoomParameterController : public ViewController { public: - ZoomParameterController(Responder * parentResponder, GraphWindow * graphWindow, GraphView * graphView); + ZoomParameterController(Responder * parentResponder, CurveViewWindowWithCursor * graphWindow, CurveViewWithBannerAndCursor * graphView); const char * title() const override; View * view() override; bool handleEvent(Ion::Events::Event event) override; @@ -17,9 +15,9 @@ public: private: class ContentView : public View { public: - ContentView(GraphView * graphView); + ContentView(CurveViewWithBannerAndCursor * graphView); void layoutSubviews() override; - GraphView * graphView(); + CurveViewWithBannerAndCursor * graphView(); private: class LegendView : public View { public: @@ -36,14 +34,12 @@ private: }; int numberOfSubviews() const override; View * subviewAtIndex(int index) override; - GraphView * m_graphView; + CurveViewWithBannerAndCursor * m_graphView; LegendView m_legendView; constexpr static KDCoordinate k_legendHeight = 50; }; ContentView m_contentView; - GraphWindow * m_graphWindow; + CurveViewWindowWithCursor * m_graphWindow; }; -} - #endif