store_parameter_controller.cpp
2.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#include "store_parameter_controller.h"
#include <assert.h>
namespace Shared {
StoreParameterController::StoreParameterController(Responder * parentResponder, FloatPairStore * store) :
ViewController(parentResponder),
m_deleteColumn(I18n::Message::ClearColumn),
#if COPY_IMPORT_LIST
m_copyColumn(I18n::Message::CopyColumnInList),
m_importList(I18n::Message::ImportList),
#endif
m_selectableTableView(this, this, 0, 1, Metric::CommonTopMargin, Metric::CommonRightMargin,
Metric::CommonBottomMargin, Metric::CommonLeftMargin, this),
m_store(store),
m_xColumnSelected(true)
{
}
void StoreParameterController::selectXColumn(bool xColumnSelected) {
m_xColumnSelected = xColumnSelected;
}
const char * StoreParameterController::title() {
return I18n::translate(I18n::Message::ColumnOptions);
}
View * StoreParameterController::view() {
return &m_selectableTableView;
}
void StoreParameterController::didBecomeFirstResponder() {
selectCellAtLocation(0, 0);
app()->setFirstResponder(&m_selectableTableView);
}
bool StoreParameterController::handleEvent(Ion::Events::Event event) {
if (event == Ion::Events::OK || event == Ion::Events::EXE) {
switch (selectedRow()) {
case 0:
{
if (m_xColumnSelected) {
m_store->deleteAllPairs();
} else {
m_store->resetColumn(!m_xColumnSelected);
}
StackViewController * stack = ((StackViewController *)parentResponder());
stack->pop();
return true;
}
#if COPY_IMPORT_LIST
/* TODO: implement copy column and import list */
case 1:
return true;
case 2:
return true;
#endif
default:
assert(false);
return false;
}
}
return false;
}
int StoreParameterController::numberOfRows() {
return k_totalNumberOfCell;
};
HighlightCell * StoreParameterController::reusableCell(int index) {
assert(index >= 0);
assert(index < k_totalNumberOfCell);
HighlightCell * cells[] = {&m_deleteColumn};// {&m_deleteColumn, &m_copyColumn, &m_importList};
return cells[index];
}
int StoreParameterController::reusableCellCount() {
return k_totalNumberOfCell;
}
KDCoordinate StoreParameterController::cellHeight() {
return Metric::ParameterCellHeight;
}
}