[apps/sequence||graph] Improve hiding of copy column functionnality

Change-Id: Ic31734f99c0c223e5865b46c48866b89aa62d383
This commit is contained in:
Émilie Feral
2017-05-02 14:08:34 +02:00
parent 847a8e02e7
commit 4b18d16b2b
7 changed files with 50 additions and 16 deletions

View File

@@ -7,7 +7,9 @@ namespace Graph {
DerivativeParameterController::DerivativeParameterController(ValuesController * valuesController) :
ViewController(valuesController),
m_hideColumn(MessageTableCell(I18n::Message::HideDerivativeColumn)),
// m_copyColumn(MessageTableCellWithChevron(I18n::Message::CopyColumnInList)),
#if COPY_COLUMN
m_copyColumn(MessageTableCellWithChevron(I18n::Message::CopyColumnInList)),
#endif
m_selectableTableView(SelectableTableView(this, this, 0, 1, Metric::CommonTopMargin, Metric::CommonRightMargin,
Metric::CommonBottomMargin, Metric::CommonLeftMargin, this)),
m_function(nullptr),
@@ -50,9 +52,11 @@ bool DerivativeParameterController::handleEvent(Ion::Events::Event event) {
stack->pop();
return true;
}
/* TODO: implement copy column
* case 1:
return true;*/
#if COPY_COLUMN
case 1:
/* TODO: implement function copy column */
return true;
#endif
default:
assert(false);
return false;
@@ -68,7 +72,11 @@ int DerivativeParameterController::numberOfRows() {
HighlightCell * DerivativeParameterController::reusableCell(int index) {
assert(index >= 0);
assert(index < k_totalNumberOfCell);
HighlightCell * cells[] = {&m_hideColumn}; //{&m_hideColumn, &m_copyColumn};
#if COPY_COLUMN
HighlightCell * cells[] = {&m_hideColumn, &m_copyColumn};
#else
HighlightCell * cells[] = {&m_hideColumn};
#endif
return cells[index];
}

View File

@@ -23,11 +23,17 @@ public:
void setFunction(CartesianFunction * function);
private:
constexpr static int k_totalNumberOfCell = 1;//2;
#if COPY_COLUMN
constexpr static int k_totalNumberOfCell = 2;
#else
constexpr static int k_totalNumberOfCell = 1;
#endif
constexpr static int k_maxNumberOfCharsInTitle = 16;
char m_pageTitle[k_maxNumberOfCharsInTitle];
MessageTableCell m_hideColumn;
// MessageTableCellWithChevron m_copyColumn;
#if COPY_COLUMN
MessageTableCellWithChevron m_copyColumn;
#endif
SelectableTableView m_selectableTableView;
CartesianFunction * m_function;
ValuesController * m_valuesController;

View File

@@ -31,9 +31,11 @@ bool FunctionParameterController::handleEvent(Ion::Events::Event event) {
m_selectableTableView.reloadData();
return true;
}
/* TODO: implement copy column
* case 1:
return false;*/
#if COPY_COLUMN
case 1:
/* TODO: implement function copy column */
return true;
#endif
default:
assert(false);
return false;
@@ -49,7 +51,11 @@ int FunctionParameterController::numberOfRows() {
HighlightCell * FunctionParameterController::reusableCell(int index) {
assert(index >= 0);
assert(index < k_totalNumberOfCell);
HighlightCell * cells[] = {&m_displayDerivativeColumn}; // {&m_displayDerivativeColumn, &m_copyColumn};
#if COPY_COLUMN
HighlightCell * cells[] = {&m_displayDerivativeColumn, &m_copyColumn};
#else
HighlightCell * cells[] = {&m_displayDerivativeColumn};
#endif
return cells[index];
}

View File

@@ -18,8 +18,11 @@ public:
void willDisplayCellForIndex(HighlightCell * cell, int index) override;
void setFunction(Shared::Function * function) override;
private:
/* TODO: implement copy column */
constexpr static int k_totalNumberOfCell = 1;//2;
#if COPY_COLUMN
constexpr static int k_totalNumberOfCell = 2;
#else
constexpr static int k_totalNumberOfCell = 1;
#endif
MessageTableCellWithSwitch m_displayDerivativeColumn;
CartesianFunction * m_cartesianFunction;
ValuesController * m_valuesController;

View File

@@ -8,7 +8,9 @@ namespace Sequence {
ValuesController::ValuesController(Responder * parentResponder, SequenceStore * sequenceStore, ButtonRowController * header) :
Shared::ValuesController(parentResponder, header, I18n::Message::NColumn, &m_intervalParameterController),
m_sequenceStore(sequenceStore),
//m_sequenceParameterController(Shared::ValuesFunctionParameterController('n')),
#if COPY_COLUMN
m_sequenceParameterController(Shared::ValuesFunctionParameterController('n')),
#endif
m_intervalParameterController(IntervalParameterController(this, &m_interval))
{
}
@@ -89,7 +91,11 @@ SequenceStore * ValuesController::functionStore() const {
}
Shared::ValuesFunctionParameterController * ValuesController::functionParameterController() {
return nullptr; // TODO: return &m_sequenceParameterController;
#if COPY_COLUMN
return &m_sequenceParameterController;
#else
return nullptr;
#endif
}
View * ValuesController::createView() {

View File

@@ -29,7 +29,9 @@ private:
SequenceStore * m_sequenceStore;
SequenceStore * functionStore() const override;
View * createView() override;
//Shared::ValuesFunctionParameterController m_sequenceParameterController;
#if COPY_COLUMN
Shared::ValuesFunctionParameterController m_sequenceParameterController;
#endif
Shared::ValuesFunctionParameterController * functionParameterController() override;
IntervalParameterController m_intervalParameterController;
};

View File

@@ -262,11 +262,14 @@ void ValuesController::configureAbscissa() {
}
void ValuesController::configureFunction() {
#if COPY_COLUMN
#else
/* Temporary: the sequence value controller does not have a function parameter
* controller yet but it shoult come soon. */
if (functionParameterController() == nullptr) {
return;
}
#endif
functionParameterController()->setFunction(functionAtColumn(selectedColumn()));
StackViewController * stack = stackController();
stack->push(functionParameterController());