mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-18 21:30:38 +01:00
[apps/go_to_param_cntrlr] Change parameter name according to func
This commit is contained in:
@@ -74,7 +74,9 @@ SortCommandWithArg = "sort<(L)"
|
||||
SumCommand = "sum(\x11,n,\x11,\x11)"
|
||||
SumCommandWithArg = "sum(f(n),n,nmin,nmax)"
|
||||
Sxy = "∑xy"
|
||||
T = "t"
|
||||
TanhCommandWithArg = "tanh(x)"
|
||||
Theta = "θ"
|
||||
TMax = "Tmax"
|
||||
TMin = "Tmin"
|
||||
TraceCommandWithArg = "trace(M)"
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include <poincare/serialization_helper.h>
|
||||
#include <escher/palette.h>
|
||||
#include <ion/unicode/utf8_decoder.h>
|
||||
#include <apps/i18n.h>
|
||||
#include <float.h>
|
||||
#include <cmath>
|
||||
|
||||
@@ -93,6 +94,18 @@ Poincare::Expression CartesianFunction::expressionReduced(Poincare::Context * co
|
||||
return result;
|
||||
}
|
||||
|
||||
I18n::Message CartesianFunction::parameterMessageName() const {
|
||||
PlotType type = plotType();
|
||||
if (type == PlotType::Cartesian) {
|
||||
return I18n::Message::X;
|
||||
}
|
||||
if (type == PlotType::Polar) {
|
||||
return I18n::Message::Theta;
|
||||
}
|
||||
assert(plotType() == PlotType::Parametric);
|
||||
return I18n::Message::T;
|
||||
}
|
||||
|
||||
CodePoint CartesianFunction::symbol() const {
|
||||
switch (plotType()) {
|
||||
case PlotType::Cartesian:
|
||||
|
||||
@@ -14,6 +14,7 @@ public:
|
||||
CartesianFunction(Ion::Storage::Record record = Record()) :
|
||||
Function(record)
|
||||
{}
|
||||
I18n::Message parameterMessageName() const override;
|
||||
CodePoint symbol() const override;
|
||||
Poincare::Expression expressionReduced(Poincare::Context * context) const override;
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "poincare/src/parsing/parser.h"
|
||||
#include <ion/unicode/utf8_helper.h>
|
||||
#include <ion/unicode/utf8_decoder.h>
|
||||
#include <apps/i18n.h>
|
||||
#include <string.h>
|
||||
#include <cmath>
|
||||
#include <assert.h>
|
||||
@@ -65,6 +66,10 @@ int Function::printValue(double cursorT, double cursorX, double cursorY, char *
|
||||
return PoincareHelpers::ConvertFloatToText<double>(cursorY, buffer, bufferSize, precision);
|
||||
}
|
||||
|
||||
I18n::Message Function::parameterMessageName() const {
|
||||
return I18n::Message::X;
|
||||
}
|
||||
|
||||
int Function::nameWithArgument(char * buffer, size_t bufferSize) {
|
||||
const char * functionName = fullName();
|
||||
size_t result = SymbolAbstract::TruncateExtension(buffer, functionName, bufferSize);
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <poincare/function.h>
|
||||
#include <poincare/symbol.h>
|
||||
#include <escher/i18n.h>
|
||||
#include "expression_model_handle.h"
|
||||
|
||||
#if __EMSCRIPTEN__
|
||||
@@ -42,6 +43,7 @@ public:
|
||||
// Name
|
||||
int nameWithArgument(char * buffer, size_t bufferSize);
|
||||
virtual int printValue(double cursorT, double cursorX, double cursorY, char * buffer, int bufferSize, int precision, Poincare::Context * context);
|
||||
virtual I18n::Message parameterMessageName() const;
|
||||
|
||||
// Evaluation
|
||||
virtual Poincare::Coordinate2D<float> evaluateXYAtParameter(float t, Poincare::Context * context) const = 0;
|
||||
|
||||
@@ -39,6 +39,9 @@ bool FunctionGoToParameterController::setParameterAtIndex(int parameterIndex, do
|
||||
|
||||
void FunctionGoToParameterController::setRecord(Ion::Storage::Record record) {
|
||||
m_record = record;
|
||||
FunctionApp * myApp = FunctionApp::app();
|
||||
ExpiringPointer<Function> function = myApp->functionStore()->modelForRecord(m_record);
|
||||
setParameterName(function->parameterMessageName());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ public:
|
||||
int numberOfRows() override;
|
||||
bool handleEvent(Ion::Events::Event event) override;
|
||||
protected:
|
||||
void setParameterName(I18n::Message message) { m_abscisseCell.setMessage(message); }
|
||||
CurveViewCursor * m_cursor;
|
||||
InteractiveCurveViewRange * m_graphRange;
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user