Numworks Epsilon  1.4.1
Graphing Calculator Operating System
values_parameter_controller.cpp
Go to the documentation of this file.
2 #include <assert.h>
3 
4 namespace Shared {
5 
6 ValuesParameterController::ValuesParameterController(Responder * parentResponder, IntervalParameterController * intervalParameterController, I18n::Message title) :
7  ViewController(parentResponder),
8  m_pageTitle(title),
9  m_deleteColumn(I18n::Message::Default),
10 #if COPY_COLUMN
11  m_copyColumn(I18n::Message::Default),
12 #endif
13  m_setInterval(I18n::Message::Default),
14  m_selectableTableView(this, this, this),
15  m_intervalParameterController(intervalParameterController)
16 {
17 }
18 
20  return I18n::translate(m_pageTitle);
21 }
22 
24  return &m_selectableTableView;
25 }
26 
28  MessageTableCell * myCell = (MessageTableCell *)cell;
29 #if COPY_COLUMN
30  I18n::Message labels[k_totalNumberOfCell] = {I18n::Message::ClearColumn, I18n::Message::CopyColumnInList, I18n::Message::IntervalSet};
31 #else
32  I18n::Message labels[k_totalNumberOfCell] = {I18n::Message::ClearColumn, I18n::Message::IntervalSet};
33 #endif
34  myCell->setMessage(labels[index]);
35 }
36 
38  if (selectedRow() < 0) {
40  }
41  app()->setFirstResponder(&m_selectableTableView);
42 }
43 
45 #if COPY_COLUMN
46  if (event == Ion::Events::OK || event == Ion::Events::EXE || (event == Ion::Events::Right && selectedRow() == 2)) {
47 #else
48  if (event == Ion::Events::OK || event == Ion::Events::EXE || (event == Ion::Events::Right && selectedRow() == 1)) {
49 #endif
50  switch (selectedRow()) {
51  case 0:
52  {
53  Interval * interval = m_intervalParameterController->interval();
54  interval->setEnd(0.0);
55  interval->setStep(1.0);
56  interval->setStart(1.0);
58  stack->pop();
59  return true;
60  }
61 #if COPY_COLUMN
62  case 1:
63  /* TODO: implement function copy column */
64  return true;
65  case 2:
66 #else
67  case 1:
68 #endif
69  {
71  stack->push(m_intervalParameterController);
72  return true;
73  }
74  default:
75  assert(false);
76  return false;
77  }
78  }
79  return false;
80 }
81 
83  return k_totalNumberOfCell;
84 };
85 
87  assert(index >= 0);
88  assert(index < k_totalNumberOfCell);
89  HighlightCell * cells[] = {&m_deleteColumn, &m_setInterval}; //{&m_deleteColumn, &m_copyColumn, &m_setInterval};
90  return cells[index];
91 }
92 
94  return k_totalNumberOfCell;
95 }
96 
99 }
100 
101 }
void setStep(double f)
Definition: interval.cpp:56
Definition: i18n.h:6
void willDisplayCellForIndex(HighlightCell *cell, int index) override
#define assert(e)
Definition: assert.h:9
HighlightCell * reusableCell(int index) override
constexpr Event EXE
Definition: events.h:114
int16_t KDCoordinate
Definition: coordinate.h:6
void push(ViewController *vc, KDColor textColor=Palette::SubTab, KDColor backgroundColor=KDColorWhite, KDColor separatorColor=Palette::GreyBright)
Responder * parentResponder() const
Definition: responder.cpp:12
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 setStart(double f)
Definition: interval.cpp:46
ValuesParameterController(Responder *parentResponder, IntervalParameterController *intervalParameterController, I18n::Message title)
void setMessage(I18n::Message message)
static constexpr KDCoordinate ParameterCellHeight
Definition: metric.h:15
void setFirstResponder(Responder *responder)
Definition: app.cpp:62
Definition: view.h:23
constexpr Event Right
Definition: events.h:64
App * app()
Definition: responder.cpp:77
void setEnd(double f)
Definition: interval.cpp:51
constexpr Event OK
Definition: events.h:65