diff --git a/apps/graph/graph/calculation_graph_controller.cpp b/apps/graph/graph/calculation_graph_controller.cpp index 91f0823d4..0f745fe7f 100644 --- a/apps/graph/graph/calculation_graph_controller.cpp +++ b/apps/graph/graph/calculation_graph_controller.cpp @@ -63,7 +63,7 @@ void CalculationGraphController::setRecord(Ion::Storage::Record record) { void CalculationGraphController::reloadBannerView() { m_bannerView->setNumberOfSubviews(2); - reloadBannerViewForCursorOnFunction(m_cursor, m_record, functionStore(), 'x'); + reloadBannerViewForCursorOnFunction(m_cursor, m_record, functionStore(), StorageCartesianFunctionStore::Symbol()); } bool CalculationGraphController::moveCursor(int direction) { diff --git a/apps/graph/graph/graph_controller_helper.cpp b/apps/graph/graph/graph_controller_helper.cpp index 78d8d1964..67f52f61d 100644 --- a/apps/graph/graph/graph_controller_helper.cpp +++ b/apps/graph/graph/graph_controller_helper.cpp @@ -23,7 +23,7 @@ void GraphControllerHelper::reloadDerivativeInBannerViewForCursorOnFunction(Shar constexpr size_t bufferSize = FunctionBannerDelegate::k_maxNumberOfCharacters+PrintFloat::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits); char buffer[bufferSize]; const char * space = " "; - int numberOfChar = function->derivativeNameWithArgument(buffer, bufferSize, 'x'); + int numberOfChar = function->derivativeNameWithArgument(buffer, bufferSize, StorageCartesianFunctionStore::Symbol()); const char * legend = "="; numberOfChar += strlcpy(buffer+numberOfChar, legend, bufferSize-numberOfChar); double y = function->approximateDerivative(cursor->x(), app->localContext()); diff --git a/apps/graph/graph/integral_graph_controller.cpp b/apps/graph/graph/integral_graph_controller.cpp index a64e24c0a..36d7491b9 100644 --- a/apps/graph/graph/integral_graph_controller.cpp +++ b/apps/graph/graph/integral_graph_controller.cpp @@ -40,7 +40,7 @@ Layout IntegralGraphController::createFunctionLayout(StorageFunction * function) constexpr size_t bufferSize = SymbolAbstract::k_maxNameSize+5; // f(x)dx char buffer[bufferSize]; const char * dx = "dx"; - int numberOfChars = function->nameWithArgument(buffer, bufferSize-strlen(dx), 'x'); + int numberOfChars = function->nameWithArgument(buffer, bufferSize-strlen(dx), StorageCartesianFunctionStore::Symbol()); strlcpy(buffer+numberOfChars, dx, bufferSize-numberOfChars); return LayoutHelper::String(buffer, strlen(buffer), KFont::SmallFont); } diff --git a/apps/graph/graph/intersection_graph_controller.cpp b/apps/graph/graph/intersection_graph_controller.cpp index 16c831aca..caf58fcd5 100644 --- a/apps/graph/graph/intersection_graph_controller.cpp +++ b/apps/graph/graph/intersection_graph_controller.cpp @@ -18,18 +18,18 @@ const char * IntersectionGraphController::title() { void IntersectionGraphController::reloadBannerView() { m_bannerView->setNumberOfSubviews(2); - reloadBannerViewForCursorOnFunction(m_cursor, m_record, functionStore(), 'x'); + reloadBannerViewForCursorOnFunction(m_cursor, m_record, functionStore(), StorageCartesianFunctionStore::Symbol()); constexpr size_t bufferSize = FunctionBannerDelegate::k_maxNumberOfCharacters+Poincare::PrintFloat::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits); char buffer[bufferSize]; const char * space = " "; const char * legend = "="; // 'f(x)=g(x)=', keep 2 chars for '=' StorageCartesianFunction * f = functionStore()->modelForRecord(m_record); - int numberOfChar = f->nameWithArgument(buffer, bufferSize-2, 'x'); + int numberOfChar = f->nameWithArgument(buffer, bufferSize-2, StorageCartesianFunctionStore::Symbol()); numberOfChar += strlcpy(buffer+numberOfChar, legend, bufferSize-numberOfChar); // keep 1 char for '='; StorageCartesianFunction * g = functionStore()->modelForRecord(m_intersectedRecord); - numberOfChar += g->nameWithArgument(buffer, bufferSize-numberOfChar-1, 'x'); + numberOfChar += g->nameWithArgument(buffer, bufferSize-numberOfChar-1, StorageCartesianFunctionStore::Symbol()); numberOfChar += strlcpy(buffer+numberOfChar, legend, bufferSize-numberOfChar); numberOfChar += PoincareHelpers::ConvertFloatToText(m_cursor->y(), buffer+numberOfChar, bufferSize-numberOfChar, Constant::MediumNumberOfSignificantDigits); strlcpy(buffer+numberOfChar, space, bufferSize-numberOfChar); diff --git a/apps/graph/graph/tangent_graph_controller.cpp b/apps/graph/graph/tangent_graph_controller.cpp index 8947b146c..9f6a01c1e 100644 --- a/apps/graph/graph/tangent_graph_controller.cpp +++ b/apps/graph/graph/tangent_graph_controller.cpp @@ -40,7 +40,7 @@ void TangentGraphController::reloadBannerView() { return; } App * myApp = static_cast(app()); - StorageFunctionBannerDelegate::reloadBannerViewForCursorOnFunction(m_cursor, m_record, myApp->functionStore(), 'x'); + StorageFunctionBannerDelegate::reloadBannerViewForCursorOnFunction(m_cursor, m_record, myApp->functionStore(), StorageCartesianFunctionStore::Symbol()); GraphControllerHelper::reloadDerivativeInBannerViewForCursorOnFunction(m_cursor, m_record, myApp); constexpr size_t bufferSize = FunctionBannerDelegate::k_maxNumberOfCharacters+PrintFloat::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits); char buffer[bufferSize]; diff --git a/apps/graph/storage_cartesian_function_store.h b/apps/graph/storage_cartesian_function_store.h index 8875acf26..c23a8a129 100644 --- a/apps/graph/storage_cartesian_function_store.h +++ b/apps/graph/storage_cartesian_function_store.h @@ -11,7 +11,8 @@ namespace Graph { class StorageCartesianFunctionStore : public Shared::StorageFunctionStore { public: Shared::StorageCartesianFunction * modelForRecord(Ion::Storage::Record record) const override { return static_cast(Shared::StorageFunctionStore::modelForRecord(record)); } - char symbol() const override { return 'x'; } + static char Symbol() { return 'x'; } + char symbol() const override { return Symbol(); } private: Ion::Storage::Record::ErrorStatus addEmptyModel() override; const char * modelExtension() const override { return Shared::GlobalContext::funcExtension; } diff --git a/apps/graph/values/storage_derivative_parameter_controller.cpp b/apps/graph/values/storage_derivative_parameter_controller.cpp index 021476cd2..067033b61 100644 --- a/apps/graph/values/storage_derivative_parameter_controller.cpp +++ b/apps/graph/values/storage_derivative_parameter_controller.cpp @@ -18,7 +18,7 @@ StorageDerivativeParameterController::StorageDerivativeParameterController(Stora } const char * StorageDerivativeParameterController::title() { - functionStore()->modelForRecord(m_record)->derivativeNameWithArgument(m_pageTitle, k_maxNumberOfCharsInTitle, 'x'); + functionStore()->modelForRecord(m_record)->derivativeNameWithArgument(m_pageTitle, k_maxNumberOfCharsInTitle, StorageCartesianFunctionStore::Symbol()); return m_pageTitle; } diff --git a/apps/graph/values/storage_function_parameter_controller.cpp b/apps/graph/values/storage_function_parameter_controller.cpp index 0d914a0c1..767ab9fbe 100644 --- a/apps/graph/values/storage_function_parameter_controller.cpp +++ b/apps/graph/values/storage_function_parameter_controller.cpp @@ -8,7 +8,7 @@ using namespace Shared; namespace Graph { StorageFunctionParameterController::StorageFunctionParameterController(StorageValuesController * valuesController) : - StorageValuesFunctionParameterController('x'), + StorageValuesFunctionParameterController(StorageCartesianFunctionStore::Symbol()), m_displayDerivativeColumn(I18n::Message::DerivativeFunctionColumn), m_valuesController(valuesController) { diff --git a/apps/graph/values/storage_values_controller.cpp b/apps/graph/values/storage_values_controller.cpp index 7f47a9b64..76f666804 100644 --- a/apps/graph/values/storage_values_controller.cpp +++ b/apps/graph/values/storage_values_controller.cpp @@ -45,9 +45,9 @@ void StorageValuesController::willDisplayCellAtLocation(HighlightCell * cell, in const size_t bufferNameSize = Shared::StorageFunction::k_maxNameWithArgumentSize + 1; char bufferName[bufferNameSize]; if (isDerivativeColumn(i)) { - function->derivativeNameWithArgument(bufferName, bufferNameSize, 'x'); + function->derivativeNameWithArgument(bufferName, bufferNameSize, StorageCartesianFunctionStore::Symbol()); } else { - function->nameWithArgument(bufferName, bufferNameSize, 'x'); + function->nameWithArgument(bufferName, bufferNameSize, StorageCartesianFunctionStore::Symbol()); } myFunctionCell->setText(bufferName); myFunctionCell->setColor(function->color()); diff --git a/apps/variable_box_controller.cpp b/apps/variable_box_controller.cpp index 318186ce9..8a0711e99 100644 --- a/apps/variable_box_controller.cpp +++ b/apps/variable_box_controller.cpp @@ -3,6 +3,7 @@ #include "shared/poincare_helpers.h" #include "shared/storage_function.h" #include "shared/storage_cartesian_function.h" +#include "graph/storage_cartesian_function_store.h" #include "constant.h" #include #include @@ -91,7 +92,7 @@ void VariableBoxController::willDisplayCellForIndex(HighlightCell * cell, int in } else { assert(m_currentPage == Page::Function); StorageCartesianFunction f(record); - symbolLength = f.nameWithArgument(symbolName, Shared::StorageFunction::k_maxNameWithArgumentSize, 'x'); + symbolLength = f.nameWithArgument(symbolName, Shared::StorageFunction::k_maxNameWithArgumentSize, Graph::StorageCartesianFunctionStore::Symbol()); } Layout symbolLayout = LayoutHelper::String(symbolName, symbolLength); myCell->setLayout(symbolLayout); diff --git a/apps/variable_box_empty_controller.cpp b/apps/variable_box_empty_controller.cpp index 96b115858..4fda1f659 100644 --- a/apps/variable_box_empty_controller.cpp +++ b/apps/variable_box_empty_controller.cpp @@ -1,5 +1,6 @@ #include "variable_box_empty_controller.h" #include +#include "graph/storage_cartesian_function_store.h" #include "i18n.h" #include @@ -88,7 +89,7 @@ void VariableBoxEmptyController::setType(Type type) { case Type::Functions: { message = I18n::Message::EmptyFunctionBox; - char storeFunction[] = {'3', '+', 'x', Ion::Charset::Sto, 'f', '(', 'x', ')', 0}; + char storeFunction[] = {'3', '+', Graph::StorageCartesianFunctionStore::Symbol(), Ion::Charset::Sto, 'f', '(', Graph::StorageCartesianFunctionStore::Symbol(), ')', 0}; layout = LayoutHelper::String(storeFunction, sizeof(storeFunction)-1, KDText::FontSize::Small); break; }