mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-29 03:29:58 +02:00
[apps/shared] Factorize go to parameter controllers in parent class
(used in regression, graph, sequence) Change-Id: I5e54bca17f9de7b21aeb705ea87818b064662904
This commit is contained in:
@@ -6,17 +6,12 @@ namespace Shared {
|
||||
|
||||
GoToParameterController::GoToParameterController(Responder * parentResponder, InteractiveCurveViewRange * graphRange, CurveViewCursor * cursor, I18n::Message symbol) :
|
||||
FloatParameterController(parentResponder),
|
||||
m_abscisseCell(MessageTableCellWithEditableText(&m_selectableTableView, this, m_draftTextBuffer, symbol)),
|
||||
m_graphRange(graphRange),
|
||||
m_cursor(cursor),
|
||||
m_function(nullptr)
|
||||
m_abscisseCell(MessageTableCellWithEditableText(&m_selectableTableView, this, m_draftTextBuffer, symbol)),
|
||||
m_graphRange(graphRange)
|
||||
{
|
||||
}
|
||||
|
||||
const char * GoToParameterController::title() {
|
||||
return I18n::translate(I18n::Message::Goto);
|
||||
}
|
||||
|
||||
void GoToParameterController::viewWillAppear() {
|
||||
m_previousParameter = parameterAtIndex(0);
|
||||
FloatParameterController::viewWillAppear();
|
||||
@@ -31,23 +26,6 @@ float GoToParameterController::previousParameterAtIndex(int index) {
|
||||
return m_previousParameter;
|
||||
}
|
||||
|
||||
float GoToParameterController::parameterAtIndex(int index) {
|
||||
assert(index == 0);
|
||||
return m_cursor->x();
|
||||
}
|
||||
|
||||
bool GoToParameterController::setParameterAtIndex(int parameterIndex, float f) {
|
||||
assert(parameterIndex == 0);
|
||||
TextFieldDelegateApp * myApp = (TextFieldDelegateApp *)app();
|
||||
float y = m_function->evaluateAtAbscissa(f, myApp->localContext());
|
||||
if (fabsf(f) > k_maxDisplayableFloat || fabsf(y) > k_maxDisplayableFloat) {
|
||||
app()->displayWarning(I18n::Message::ForbiddenValue);
|
||||
return false;
|
||||
}
|
||||
m_cursor->moveTo(f, y);
|
||||
return true;
|
||||
}
|
||||
|
||||
HighlightCell * GoToParameterController::reusableParameterCell(int index, int type) {
|
||||
assert(index == 0);
|
||||
return &m_abscisseCell;
|
||||
@@ -57,10 +35,6 @@ int GoToParameterController::reusableParameterCellCount(int type) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
void GoToParameterController::setFunction(Function * function) {
|
||||
m_function = function;
|
||||
}
|
||||
|
||||
void GoToParameterController::buttonAction() {
|
||||
m_graphRange->centerAxisAround(CurveViewRange::Axis::X, m_cursor->x());
|
||||
m_graphRange->centerAxisAround(CurveViewRange::Axis::Y, m_cursor->y());
|
||||
|
||||
Reference in New Issue
Block a user