Numworks Epsilon  1.4.1
Graphing Calculator Operating System
curve_parameter_controller.cpp
Go to the documentation of this file.
2 #include "graph_controller.h"
3 #include "../../i18n.h"
4 #include <assert.h>
5 
6 using namespace Shared;
7 
8 namespace Graph {
9 
10 CurveParameterController::CurveParameterController(InteractiveCurveViewRange * graphRange, BannerView * bannerView, CurveViewCursor * cursor, GraphView * graphView, GraphController * graphController, CartesianFunctionStore * functionStore) :
11  FunctionCurveParameterController(graphRange, cursor),
12  m_goToParameterController(this, graphRange, cursor, I18n::Message::X),
13  m_graphController(graphController),
14  m_calculationCell(I18n::Message::Compute),
15  m_derivativeCell(I18n::Message::DerivateNumber),
16  m_calculationParameterController(this, graphView, bannerView, graphRange, cursor, functionStore)
17 {
18 }
19 
21  return I18n::translate(I18n::Message::PlotOptions);
22 }
23 
25  if (cell == &m_derivativeCell) {
26  SwitchView * switchView = (SwitchView *)m_derivativeCell.accessoryView();
27  switchView->setState(m_graphController->displayDerivativeInBanner());
28  }
29 }
30 
32 #if FUNCTION_CALCULATE_MENU
33  if (event == Ion::Events::OK || event == Ion::Events::EXE || (event == Ion::Events::Right && (selectedRow() == 0 || selectedRow() == 1))) {
34 #else
35  if (event == Ion::Events::OK || event == Ion::Events::EXE || (event == Ion::Events::Right && selectedRow() == 0)) {
36 #endif
37  switch (selectedRow()) {
38  case 0:
39  {
40  m_calculationParameterController.setFunction(static_cast<CartesianFunction *>(m_function));
42  stack->push(&m_calculationParameterController);
43  return true;
44  }
45  case 1:
46  return handleGotoSelection();
47  case 2:
48  {
49  m_graphController->setDisplayDerivativeInBanner(!m_graphController->displayDerivativeInBanner());
51  return true;
52  }
53  default:
54  return false;
55  }
56  }
57  return false;
58 }
59 
61  return k_totalNumberOfCells;
62 };
63 
65  assert(index >= 0);
66  assert(index < k_totalNumberOfCells);
67  HighlightCell * cells[] = {&m_calculationCell, &m_goToCell, &m_derivativeCell};
68  return cells[index];
69 }
70 
72  return k_totalNumberOfCells;
73 }
74 
75 FunctionGoToParameterController * CurveParameterController::goToParameterController() {
76  return &m_goToParameterController;
77 }
78 
79 }
Definition: i18n.h:6
#define assert(e)
Definition: assert.h:9
bool displayDerivativeInBanner() const
constexpr Event EXE
Definition: events.h:114
void push(ViewController *vc, KDColor textColor=Palette::SubTab, KDColor backgroundColor=KDColorWhite, KDColor separatorColor=Palette::GreyBright)
Responder * parentResponder() const
Definition: responder.cpp:12
Definition: app.cpp:9
void reloadData(bool setFirstResponder=true)
enum Message uint16_t enum Language uint16_t const char * translate(Message m, Language l=(Language) 0)
Definition: i18n.cpp:5
bool handleEvent(Ion::Events::Event event) override
void setDisplayDerivativeInBanner(bool displayDerivative)
HighlightCell * reusableCell(int index) override
constexpr Event Right
Definition: events.h:64
constexpr Event OK
Definition: events.h:65
void setState(bool state)
Definition: switch_view.cpp:45
void willDisplayCellForIndex(HighlightCell *cell, int index) override