Files
Upsilon/apps/shared/go_to_parameter_controller.cpp
Émilie Feral e76cab75c1 [apps/shared] Factorize go to parameter controllers in parent class
(used in regression, graph, sequence)

Change-Id: I5e54bca17f9de7b21aeb705ea87818b064662904
2017-03-30 16:08:40 +02:00

47 lines
1.3 KiB
C++

#include "go_to_parameter_controller.h"
#include "text_field_delegate_app.h"
#include <assert.h>
namespace Shared {
GoToParameterController::GoToParameterController(Responder * parentResponder, InteractiveCurveViewRange * graphRange, CurveViewCursor * cursor, I18n::Message symbol) :
FloatParameterController(parentResponder),
m_cursor(cursor),
m_abscisseCell(MessageTableCellWithEditableText(&m_selectableTableView, this, m_draftTextBuffer, symbol)),
m_graphRange(graphRange)
{
}
void GoToParameterController::viewWillAppear() {
m_previousParameter = parameterAtIndex(0);
FloatParameterController::viewWillAppear();
}
int GoToParameterController::numberOfRows() {
return 2;
}
float GoToParameterController::previousParameterAtIndex(int index) {
assert(index == 0);
return m_previousParameter;
}
HighlightCell * GoToParameterController::reusableParameterCell(int index, int type) {
assert(index == 0);
return &m_abscisseCell;
}
int GoToParameterController::reusableParameterCellCount(int type) {
return 1;
}
void GoToParameterController::buttonAction() {
m_graphRange->centerAxisAround(CurveViewRange::Axis::X, m_cursor->x());
m_graphRange->centerAxisAround(CurveViewRange::Axis::Y, m_cursor->y());
StackViewController * stack = (StackViewController *)parentResponder();
stack->pop();
stack->pop();
}
}