Numworks Epsilon  1.4.1
Graphing Calculator Operating System
interval_parameter_controller.cpp
Go to the documentation of this file.
2 #include <cmath>
3 
4 using namespace Shared;
5 
6 namespace Sequence {
7 
9  Shared::IntervalParameterController(parentResponder, interval)
10 {
11 }
12 
14  if (index == numberOfRows()-1) {
15  return;
16  }
18  I18n::Message labels[k_totalNumberOfCell] = {I18n::Message::NStart, I18n::Message::NEnd, I18n::Message::Step};
19  myCell->setMessage(labels[index]);
20  FloatParameterController::willDisplayCellForIndex(cell, index);
21 }
22 
23 bool IntervalParameterController::setParameterAtIndex(int parameterIndex, double f) {
24  if (f < 0) {
25  app()->displayWarning(I18n::Message::ForbiddenValue);
26  return false;
27  }
28  double parameter = std::round(f);
29  if (parameterIndex == 2 && parameter == 0.0f) {
30  parameter = 1.0f;
31  }
32  return Shared::IntervalParameterController::setParameterAtIndex(parameterIndex, parameter);
33 }
34 
35 }
36 
void willDisplayCellForIndex(HighlightCell *cell, int index) override
bool setParameterAtIndex(int parameterIndex, double f) override
void displayWarning(I18n::Message warningMessage)
Definition: app.cpp:97
#define round(x)
Definition: math.h:192
void setMessage(I18n::Message message)
Definition: app.cpp:7
IntervalParameterController(Responder *parentResponder, Interval *interval)
App * app()
Definition: responder.cpp:77
bool setParameterAtIndex(int parameterIndex, double f) override