[apps/graph/graph] Define PreimageParameterController class

This commit is contained in:
Ruben Dashyan
2019-04-02 11:41:52 +02:00
committed by Émilie Feral
parent e0774cba4b
commit 23fd28b3b4
3 changed files with 85 additions and 0 deletions

View File

@@ -0,0 +1,53 @@
#include "preimage_parameter_controller.h"
#include "../app.h"
#include <assert.h>
namespace Graph {
PreimageParameterController::PreimageParameterController(
Responder * parentResponder,
InputEventHandlerDelegate * inputEventHandlerDelegate,
Shared::InteractiveCurveViewRange * graphRange,
Shared::CurveViewCursor * cursor,
PreimageGraphController * preimageGraphController
) :
Shared::GoToParameterController(
parentResponder,
inputEventHandlerDelegate,
graphRange,
cursor,
I18n::Message::Y
),
m_preimageGraphController(preimageGraphController)
{
}
const char * PreimageParameterController::title() {
return I18n::translate(I18n::Message::Preimage);
}
void PreimageParameterController::viewWillAppear() {
m_preimageGraphController->setImage(m_cursor->y());
Shared::GoToParameterController::viewWillAppear();
}
void PreimageParameterController::buttonAction() {
m_preimageGraphController->setRecord(m_record);
StackViewController * stack = static_cast<StackViewController *>(parentResponder());
stack->pop();
stack->pop();
stack->pop();
stack->push(m_preimageGraphController);
}
double PreimageParameterController::parameterAtIndex(int index) {
assert(index == 0);
return m_preimageGraphController->image();
}
bool PreimageParameterController::setParameterAtIndex(int parameterIndex, double f) {
assert(parameterIndex == 0);
m_preimageGraphController->setImage(f);
return true;
}
}