Numworks Epsilon  1.4.1
Graphing Calculator Operating System
derivative_parameter_controller.cpp
Go to the documentation of this file.
2 #include "values_controller.h"
3 #include <assert.h>
4 
5 namespace Graph {
6 
8  ViewController(valuesController),
9  m_hideColumn(I18n::Message::HideDerivativeColumn),
10 #if COPY_COLUMN
11  m_copyColumn(I18n::Message::CopyColumnInList),
12 #endif
13  m_selectableTableView(this),
14  m_function(nullptr),
15  m_valuesController(valuesController)
16 {
17 }
18 
20  strlcpy(m_pageTitle, I18n::translate(I18n::Message::DerivativeColumn), k_maxNumberOfCharsInTitle);
21  for (int currentChar = 0; currentChar < k_maxNumberOfCharsInTitle; currentChar++) {
22  if (m_pageTitle[currentChar] == '(') {
23  m_pageTitle[currentChar-2] = *m_function->name();
24  break;
25  }
26  }
27  return m_pageTitle;
28 }
29 
31  return &m_selectableTableView;
32 }
33 
35  m_function = function;
36 }
37 
40  app()->setFirstResponder(&m_selectableTableView);
41 }
42 
44  if (event == Ion::Events::OK || event == Ion::Events::EXE) {
45  switch (selectedRow()) {
46  case 0:
47  {
48  m_valuesController->selectCellAtLocation(m_valuesController->selectedColumn()-1, m_valuesController->selectedRow());
49  m_function->setDisplayDerivative(false);
51  stack->pop();
52  return true;
53  }
54 #if COPY_COLUMN
55  case 1:
56  /* TODO: implement function copy column */
57  return true;
58 #endif
59  default:
60  assert(false);
61  return false;
62  }
63  }
64  return false;
65 }
66 
68  return k_totalNumberOfCell;
69 };
70 
72  assert(index >= 0);
73  assert(index < k_totalNumberOfCell);
74 #if COPY_COLUMN
75  HighlightCell * cells[] = {&m_hideColumn, &m_copyColumn};
76 #else
77  HighlightCell * cells[] = {&m_hideColumn};
78 #endif
79  return cells[index];
80 }
81 
83  return k_totalNumberOfCell;
84 }
85 
88 }
89 
90 }
Definition: i18n.h:6
#define assert(e)
Definition: assert.h:9
constexpr Event EXE
Definition: events.h:114
int16_t KDCoordinate
Definition: coordinate.h:6
void setDisplayDerivative(bool display)
Responder * parentResponder() const
Definition: responder.cpp:12
size_t strlcpy(char *dst, const char *src, size_t len)
Definition: strlcpy.c:3
DerivativeParameterController(ValuesController *valuesController)
Definition: app.cpp:9
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
const char * name() const
Definition: function.cpp:68
HighlightCell * reusableCell(int index) override
static constexpr KDCoordinate ParameterCellHeight
Definition: metric.h:15
void setFirstResponder(Responder *responder)
Definition: app.cpp:62
Definition: view.h:23
App * app()
Definition: responder.cpp:77
constexpr Event OK
Definition: events.h:65