Files
Upsilon/apps/graph/graph/graph_controller.h
Émilie Feral 23026b6718 [apps/shared] Namespace shared
Change-Id: I6dec7ce900bb4e801a25c567fe5e242cb744cf29
2017-02-13 17:15:06 +01:00

58 lines
2.3 KiB
C++

#ifndef GRAPH_GRAPH_CONTROLLER_H
#define GRAPH_GRAPH_CONTROLLER_H
#include <escher.h>
#include "graph_view.h"
#include "banner_view.h"
#include "curve_parameter_controller.h"
#include "initialisation_parameter_controller.h"
#include "../../shared/interactive_curve_view_controller.h"
#include "../function_store.h"
namespace Graph {
class GraphController : public Shared::InteractiveCurveViewController, public Shared::InteractiveCurveViewRangeDelegate {
public:
GraphController(Responder * parentResponder, FunctionStore * functionStore, HeaderViewController * header);
void didBecomeFirstResponder() override;
ViewController * initialisationParameterController() override;
bool isEmpty() const override;
const char * emptyMessage() override;
bool didChangeRange(Shared::InteractiveCurveViewRange * interactiveCurveViewRange) override;
private:
constexpr static float k_cursorTopMarginRatio = 0.025f; // (cursorHeight/2)/graphViewHeight
constexpr static float k_cursorRightMarginRatio = 0.015f; // (cursorWidth/2)/graphViewWidth
constexpr static float k_cursorBottomMarginRatio = 0.11f; // (cursorHeight/2+bannerHeigh)/graphViewHeight
constexpr static float k_cursorLeftMarginRatio = 0.015f; // (cursorWidth/2)/graphViewWidth
/* When y auto is ticked, we use a display margin to be ensure that the user
* can move the cursor along the curve without panning the window */
constexpr static float k_displayTopMarginRatio = 0.03f;
constexpr static float k_displayBottomMarginRatio = 0.13f;
constexpr static int k_maxNumberOfCharacters = 8;
BannerView * bannerView() override;
bool handleEnter() override;
void reloadBannerView() override;
void initRangeParameters() override;
void initCursorParameters() override;
bool moveCursorHorizontally(int direction) override;
bool moveCursorVertically(int direction) override;
uint32_t modelVersion() override;
uint32_t rangeVersion() override;
Shared::InteractiveCurveViewRange * interactiveCurveViewRange() override;
Shared::CurveView * curveView() override;
BannerView m_bannerView;
GraphView m_view;
Shared::InteractiveCurveViewRange m_graphRange;
InitialisationParameterController m_initialisationParameterController;
CurveParameterController m_curveParameterController;
FunctionStore * m_functionStore;
int m_indexFunctionSelectedByCursor;
};
}
#endif