Files
Upsilon/apps/graph/graph/integral_graph_controller.cpp
2018-10-11 16:44:02 +02:00

46 lines
1.4 KiB
C++

#include "integral_graph_controller.h"
#include "../../shared/text_field_delegate.h"
#include <poincare/layout_helper.h>
#include "../app.h"
#include <assert.h>
#include <cmath>
#include <stdlib.h>
using namespace Shared;
using namespace Poincare;
namespace Graph {
IntegralGraphController::IntegralGraphController(Responder * parentResponder, GraphView * graphView, InteractiveCurveViewRange * graphRange, CurveViewCursor * cursor) :
SumGraphController(parentResponder, graphView, graphRange, cursor, Ion::Charset::Integral)
{
}
const char * IntegralGraphController::title() {
return I18n::translate(I18n::Message::Integral);
}
I18n::Message IntegralGraphController::legendMessageAtStep(Step step) {
switch(step) {
case Step::FirstParameter:
return I18n::Message::SelectLowerBound;
case Step::SecondParameter:
return I18n::Message::SelectUpperBound;
default:
return I18n::Message::Default;
}
}
double IntegralGraphController::cursorNextStep(double x, int direction) {
return (direction > 0 ? x + m_graphRange->xGridUnit()/k_numberOfCursorStepsInGradUnit : x - m_graphRange->xGridUnit()/k_numberOfCursorStepsInGradUnit);
}
Layout IntegralGraphController::createFunctionLayout(const char * functionName) {
char buffer[7] = "0(x)dx";
buffer[0] = functionName[0];
return LayoutHelper::String(buffer, strlen(buffer), KDFont::SmallFont);
}
}