3 #include "../../constant.h" 12 m_functionTitleCells{},
14 m_functionStore(functionStore),
15 m_functionParameterController(
this),
16 m_intervalParameterController(
this, m_interval),
17 m_derivativeParameterController(
this)
24 configureDerivativeFunction();
33 if (j == 0 && i == 0) {
39 if (j == 0 && i > 0) {
42 char bufferName[6] = {0, 0,
'(',
'x',
')', 0};
43 const char * name =
nullptr;
44 if (isDerivativeColumn(i)) {
45 bufferName[0] = *
function->name();
49 bufferName[1] = *
function->name();
50 name = &bufferName[1];
53 myFunctionCell->
setColor(function->color());
59 return I18n::Message::NoFunction;
61 return I18n::Message::NoActivatedFunction;
65 return &m_intervalParameterController;
89 bool ValuesController::isDerivativeColumn(
int i) {
110 void ValuesController::configureDerivativeFunction() {
111 CartesianFunction *
function = functionAtColumn(
selectedColumn());
112 m_derivativeParameterController.
setFunction(
function);
114 stack->
push(&m_derivativeParameterController);
117 int ValuesController::maxNumberOfCells() {
118 return k_maxNumberOfCells;
121 int ValuesController::maxNumberOfFunctions() {
122 return k_maxNumberOfFunctions;
126 assert(j >= 0 && j < k_maxNumberOfFunctions);
127 return m_functionTitleCells[j];
131 assert(j >= 0 && j < k_maxNumberOfCells);
132 return m_floatCells[j];
135 CartesianFunctionStore * ValuesController::functionStore()
const {
136 return m_functionStore;
139 FunctionParameterController * ValuesController::functionParameterController() {
140 return &m_functionParameterController;
143 double ValuesController::evaluationOfAbscissaAtColumn(
double abscissa,
int columnIndex) {
144 CartesianFunction *
function = functionAtColumn(columnIndex);
146 if (isDerivativeColumn(columnIndex)) {
147 return function->approximateDerivative(abscissa, myApp->
localContext());
149 return function->evaluateAtAbscissa(abscissa, myApp->
localContext());
152 View * ValuesController::loadView() {
153 for (
int i = 0; i < k_maxNumberOfFunctions; i++) {
156 for (
int i = 0; i < k_maxNumberOfCells; i++) {
162 void ValuesController::unloadView(
View * view) {
163 for (
int i = 0; i < k_maxNumberOfCells; i++) {
164 delete m_floatCells[i];
165 m_floatCells[i] =
nullptr;
167 for (
int i = 0; i < k_maxNumberOfFunctions; i++) {
168 delete m_functionTitleCells[i];
169 m_functionTitleCells[i] =
nullptr;
View * loadView() override
StackViewController * stackController() const
void push(ViewController *vc, KDColor textColor=Palette::SubTab, KDColor backgroundColor=KDColorWhite, KDColor separatorColor=Palette::GreyBright)
void setColor(KDColor color) override
virtual void willDisplayCellAtLocation(HighlightCell *cell, int i, int j) override
ValuesController(Responder *parentResponder, ButtonRowController *header, I18n::Message parameterTitle, IntervalParameterController *intervalParameterController, Interval *interval)
void willDisplayCellAtLocation(HighlightCell *cell, int i, int j) override
virtual Poincare::Context * localContext()
void updateNumberOfColumns() override
virtual bool handleEvent(Ion::Events::Event event) override
I18n::Message emptyMessage() override
void setFunction(CartesianFunction *function)
void setText(const char *textContent)
Shared::IntervalParameterController * intervalParameterController() override
bool handleEvent(Ion::Events::Event event) override
void setMessage(I18n::Message textContent, KDColor textColor=KDColorBlack)
int numberOfActiveFunctions()
int numberOfDefinedFunctions()
CartesianFunction * activeFunctionAtIndex(int i) override
CartesianFunction * definedFunctionAtIndex(int i) override
void unloadView(View *view) override