diff --git a/apps/calculation/edit_expression_controller.cpp b/apps/calculation/edit_expression_controller.cpp index 9f09c8b2d..cdd01e69f 100644 --- a/apps/calculation/edit_expression_controller.cpp +++ b/apps/calculation/edit_expression_controller.cpp @@ -82,8 +82,7 @@ bool EditExpressionController::textFieldDidReceiveEvent(::TextField * textField, bool EditExpressionController::textFieldDidFinishEditing(::TextField * textField, const char * text) { App * calculationApp = (App *)app(); - AppsContainer * appsContainer = (AppsContainer *)calculationApp->container(); - m_calculationStore->push(textBody(), calculationApp->localContext(), appsContainer->preferences()); + m_calculationStore->push(textBody(), calculationApp->localContext(), calculationApp->container()->preferences()); m_historyController->reload(); m_contentView.mainView()->scrollToCell(0, m_historyController->numberOfRows()-1); m_contentView.textField()->setText(""); diff --git a/apps/calculation/history_controller.cpp b/apps/calculation/history_controller.cpp index fd986e0ce..567738137 100644 --- a/apps/calculation/history_controller.cpp +++ b/apps/calculation/history_controller.cpp @@ -71,8 +71,7 @@ bool HistoryController::handleEvent(Ion::Events::Event event) { } m_selectableTableView.deselectTable(); App * calculationApp = (App *)app(); - AppsContainer * appsContainer = (AppsContainer *)calculationApp->container(); - m_calculationStore->push(text, calculationApp->localContext(), appsContainer->preferences()); + m_calculationStore->push(text, calculationApp->localContext(), calculationApp->container()->preferences()); reload(); m_selectableTableView.scrollToCell(0, numberOfRows()-1); app()->setFirstResponder(editController); diff --git a/apps/graph/graph/goto_parameter_controller.cpp b/apps/graph/graph/goto_parameter_controller.cpp index bcc5657ad..e488f218a 100644 --- a/apps/graph/graph/goto_parameter_controller.cpp +++ b/apps/graph/graph/goto_parameter_controller.cpp @@ -28,8 +28,7 @@ float GoToParameterController::parameterAtIndex(int index) { void GoToParameterController::setParameterAtIndex(int parameterIndex, float f) { assert(parameterIndex == 0); App * graphApp = (Graph::App *)app(); - AppsContainer * container = (AppsContainer *)graphApp->container(); - float y = m_function->evaluateAtAbscissa(f, graphApp->localContext(), container->preferences()->angleUnit()); + float y = m_function->evaluateAtAbscissa(f, graphApp->localContext(), graphApp->container()->preferences()->angleUnit()); m_graphRange->centerAxisAround(CurveViewRange::Axis::X, f); m_graphRange->centerAxisAround(CurveViewRange::Axis::Y, y); m_cursor->moveTo(f, y); diff --git a/apps/graph/graph/graph_controller.cpp b/apps/graph/graph/graph_controller.cpp index 930c3b9df..1b25de9df 100644 --- a/apps/graph/graph/graph_controller.cpp +++ b/apps/graph/graph/graph_controller.cpp @@ -44,8 +44,7 @@ void GraphController::didBecomeFirstResponder() { if (m_view.context() == nullptr) { App * graphApp = (Graph::App *)app(); m_view.setContext(graphApp->localContext()); - AppsContainer * container = (AppsContainer *)graphApp->container(); - m_view.setPreferences(container->preferences()); + m_view.setPreferences(graphApp->container()->preferences()); } InteractiveCurveViewController::didBecomeFirstResponder(); } @@ -55,7 +54,6 @@ bool GraphController::didChangeRange(InteractiveCurveViewRange * interactiveCurv return false; } App * graphApp = (Graph::App *)app(); - AppsContainer * myContainer = (AppsContainer *)graphApp->container(); if (m_functionStore->numberOfActiveFunctions() <= 0) { return false; } @@ -69,7 +67,7 @@ bool GraphController::didChangeRange(InteractiveCurveViewRange * interactiveCurv float y = 0.0f; for (int i = 0; i <= Ion::Display::Width; i++) { float x = xMin + i*step; - y = f->evaluateAtAbscissa(x, graphApp->localContext(), myContainer->preferences()->angleUnit()); + y = f->evaluateAtAbscissa(x, graphApp->localContext(), graphApp->container()->preferences()->angleUnit()); if (!isnan(y) && !isinf(y)) { min = min < y ? min : y; max = max > y ? max : y; @@ -113,13 +111,12 @@ bool GraphController::handleEnter() { } void GraphController::reloadBannerView() { - App * myApp = (App *)app(); - AppsContainer * myContainer = (AppsContainer *)myApp->container(); + App * graphApp = (App *)app(); char buffer[k_maxNumberOfCharacters+Complex::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits)]; const char * legend = "x = "; int legendLength = strlen(legend); strlcpy(buffer, legend, legendLength+1); - Complex::convertFloatToText(m_cursor.x(), buffer+ legendLength, Complex::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits), Constant::LargeNumberOfSignificantDigits, myContainer->preferences()->displayMode()); + Complex::convertFloatToText(m_cursor.x(), buffer+ legendLength, Complex::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits), Constant::LargeNumberOfSignificantDigits, graphApp->container()->preferences()->displayMode()); m_bannerView.setLegendAtIndex(buffer, 0); legend = "00(x) = "; @@ -127,15 +124,15 @@ void GraphController::reloadBannerView() { strlcpy(buffer, legend, legendLength+1); Function * f = m_functionStore->activeFunctionAtIndex(m_indexFunctionSelectedByCursor); buffer[1] = f->name()[0]; - Complex::convertFloatToText(m_cursor.y(), buffer+legendLength, Complex::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits), Constant::LargeNumberOfSignificantDigits, myContainer->preferences()->displayMode()); + Complex::convertFloatToText(m_cursor.y(), buffer+legendLength, Complex::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits), Constant::LargeNumberOfSignificantDigits, graphApp->container()->preferences()->displayMode()); m_bannerView.setLegendAtIndex(buffer+1, 1); if (m_bannerView.displayDerivative()) { buffer[0] = f->name()[0]; buffer[1] = '\''; App * graphApp = (Graph::App *)app(); - float y = f->approximateDerivative(m_cursor.x(), graphApp->localContext(), myContainer->preferences()->angleUnit()); - Complex::convertFloatToText(y, buffer + legendLength, Complex::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits), Constant::LargeNumberOfSignificantDigits, myContainer->preferences()->displayMode()); + float y = f->approximateDerivative(m_cursor.x(), graphApp->localContext(), graphApp->container()->preferences()->angleUnit()); + Complex::convertFloatToText(y, buffer + legendLength, Complex::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits), Constant::LargeNumberOfSignificantDigits, graphApp->container()->preferences()->displayMode()); m_bannerView.setLegendAtIndex(buffer, 2); } } @@ -150,12 +147,11 @@ void GraphController::initCursorParameters() { float x = (m_graphRange.xMin()+m_graphRange.xMax())/2.0f; m_indexFunctionSelectedByCursor = 0; App * graphApp = (Graph::App *)app(); - AppsContainer * myContainer = (AppsContainer *)graphApp->container(); int functionIndex = 0; float y = 0; do { Function * firstFunction = m_functionStore->activeFunctionAtIndex(functionIndex++); - y = firstFunction->evaluateAtAbscissa(x, graphApp->localContext(), myContainer->preferences()->angleUnit()); + y = firstFunction->evaluateAtAbscissa(x, graphApp->localContext(), graphApp->container()->preferences()->angleUnit()); } while (isnan(y) && functionIndex < m_functionStore->numberOfActiveFunctions()); m_cursor.moveTo(x, y); m_graphRange.panToMakePointVisible(x, y, k_cursorTopMarginRatio, k_cursorRightMarginRatio, k_cursorBottomMarginRatio, k_cursorLeftMarginRatio); @@ -167,8 +163,7 @@ bool GraphController::moveCursorHorizontally(int direction) { xCursorPosition - m_graphRange.xGridUnit()/k_numberOfCursorStepsInGradUnit; Function * f = m_functionStore->activeFunctionAtIndex(m_indexFunctionSelectedByCursor); App * graphApp = (Graph::App *)app(); - AppsContainer * myContainer = (AppsContainer *)graphApp->container(); - float y = f->evaluateAtAbscissa(x, graphApp->localContext(), myContainer->preferences()->angleUnit()); + float y = f->evaluateAtAbscissa(x, graphApp->localContext(), graphApp->container()->preferences()->angleUnit()); m_cursor.moveTo(x, y); m_graphRange.panToMakePointVisible(x, y, k_cursorTopMarginRatio, k_cursorRightMarginRatio, k_cursorBottomMarginRatio, k_cursorLeftMarginRatio); return true; @@ -177,13 +172,12 @@ bool GraphController::moveCursorHorizontally(int direction) { bool GraphController::moveCursorVertically(int direction) { Function * actualFunction = m_functionStore->activeFunctionAtIndex(m_indexFunctionSelectedByCursor); App * graphApp = (Graph::App *)app(); - AppsContainer * myContainer = (AppsContainer *)graphApp->container(); - float y = actualFunction->evaluateAtAbscissa(m_cursor.x(), graphApp->localContext(), myContainer->preferences()->angleUnit()); + float y = actualFunction->evaluateAtAbscissa(m_cursor.x(), graphApp->localContext(), graphApp->container()->preferences()->angleUnit()); Function * nextFunction = actualFunction; float nextY = direction > 0 ? FLT_MAX : -FLT_MAX; for (int i = 0; i < m_functionStore->numberOfActiveFunctions(); i++) { Function * f = m_functionStore->activeFunctionAtIndex(i); - float newY = f->evaluateAtAbscissa(m_cursor.x(), graphApp->localContext(), myContainer->preferences()->angleUnit()); + float newY = f->evaluateAtAbscissa(m_cursor.x(), graphApp->localContext(), graphApp->container()->preferences()->angleUnit()); bool isNextFunction = direction > 0 ? (newY > y && newY < nextY) : (newY < y && newY > nextY); if (isNextFunction) { m_indexFunctionSelectedByCursor = i; diff --git a/apps/graph/graph/initialisation_parameter_controller.cpp b/apps/graph/graph/initialisation_parameter_controller.cpp index 76f6f9bf1..9a0556520 100644 --- a/apps/graph/graph/initialisation_parameter_controller.cpp +++ b/apps/graph/graph/initialisation_parameter_controller.cpp @@ -1,4 +1,5 @@ #include "initialisation_parameter_controller.h" +#include "../app.h" #include "../../apps_container.h" #include #include @@ -31,8 +32,8 @@ void InitialisationParameterController::didBecomeFirstResponder() { bool InitialisationParameterController::handleEvent(Ion::Events::Event event) { if (event == Ion::Events::OK) { if (m_selectableTableView.selectedRow() == 0) { - AppsContainer * container = (AppsContainer *)app()->container(); - m_graphRange->setTrigonometric(container->preferences()->angleUnit()); + App * graphApp = (App *)app(); + m_graphRange->setTrigonometric(graphApp->container()->preferences()->angleUnit()); } else { RangeMethodPointer rangeMethods[k_totalNumberOfCells-1] = {&InteractiveCurveViewRange::roundAbscissa, &InteractiveCurveViewRange::normalize, &InteractiveCurveViewRange::setDefault}; diff --git a/apps/graph/values/values_controller.cpp b/apps/graph/values/values_controller.cpp index 7bc7da8cb..32ef229c4 100644 --- a/apps/graph/values/values_controller.cpp +++ b/apps/graph/values/values_controller.cpp @@ -40,8 +40,8 @@ const char * ValuesController::title() const { } View * ValuesController::view() { - AppsContainer * myContainer = (AppsContainer *)app()->container(); - Expression::DisplayMode displayMode = myContainer->preferences()->displayMode(); + App * graphApp = (App *)app(); + Expression::DisplayMode displayMode = graphApp->container()->preferences()->displayMode(); if (displayMode != m_displayModeVersion) { m_selectableTableView.reloadData(); m_displayModeVersion = displayMode; @@ -136,8 +136,8 @@ int ValuesController::numberOfColumns() { } void ValuesController::willDisplayCellAtLocation(TableViewCell * cell, int i, int j) { - AppsContainer * myContainer = (AppsContainer *)app()->container(); - willDisplayCellAtLocationWithDisplayMode(cell, i, j, myContainer->preferences()->displayMode()); + App * graphApp = (App *)app(); + willDisplayCellAtLocationWithDisplayMode(cell, i, j, graphApp->container()->preferences()->displayMode()); if (cellAtLocationIsEditable(i, j)) { return; } @@ -179,12 +179,11 @@ void ValuesController::willDisplayCellAtLocation(TableViewCell * cell, int i, in // The cell is a value cell EvenOddBufferTextCell * myValueCell = (EvenOddBufferTextCell *)cell; Function * function = functionAtColumn(i); - App * graphApp = (Graph::App *)app(); float x = m_interval.element(j-1); if (isDerivativeColumn(i)) { - Complex::convertFloatToText(function->approximateDerivative(x, graphApp->localContext(), myContainer->preferences()->angleUnit()), buffer, Complex::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits), Constant::LargeNumberOfSignificantDigits, myContainer->preferences()->displayMode()); + Complex::convertFloatToText(function->approximateDerivative(x, graphApp->localContext(), graphApp->container()->preferences()->angleUnit()), buffer, Complex::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits), Constant::LargeNumberOfSignificantDigits, graphApp->container()->preferences()->displayMode()); } else { - Complex::convertFloatToText(function->evaluateAtAbscissa(x, graphApp->localContext(), myContainer->preferences()->angleUnit()), buffer, Complex::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits), Constant::LargeNumberOfSignificantDigits, myContainer->preferences()->displayMode()); + Complex::convertFloatToText(function->evaluateAtAbscissa(x, graphApp->localContext(), graphApp->container()->preferences()->angleUnit()), buffer, Complex::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits), Constant::LargeNumberOfSignificantDigits, graphApp->container()->preferences()->displayMode()); } myValueCell->setText(buffer); } diff --git a/apps/probability/calculation_controller.cpp b/apps/probability/calculation_controller.cpp index 0367da281..5983e80c0 100644 --- a/apps/probability/calculation_controller.cpp +++ b/apps/probability/calculation_controller.cpp @@ -204,9 +204,9 @@ bool CalculationController::textFieldDidReceiveEvent(TextField * textField, Ion: } bool CalculationController::textFieldDidFinishEditing(TextField * textField, const char * text) { - AppsContainer * appsContainer = (AppsContainer *)app()->container(); - Context * globalContext = appsContainer->globalContext(); - float floatBody = Expression::parse(text)->approximate(*globalContext, appsContainer->preferences()->angleUnit()); + App * probaApp = (App *)app(); + Context * globalContext = probaApp->container()->globalContext(); + float floatBody = Expression::parse(text)->approximate(*globalContext, probaApp->container()->preferences()->angleUnit()); m_calculation->setParameterAtIndex(floatBody, m_highlightedSubviewIndex-1); for (int k = 0; k < m_calculation->numberOfParameters(); k++) { m_contentView.willDisplayEditableCellAtIndex(k); diff --git a/apps/regression/calculation_controller.cpp b/apps/regression/calculation_controller.cpp index 6e3784a21..9237c3a3a 100644 --- a/apps/regression/calculation_controller.cpp +++ b/apps/regression/calculation_controller.cpp @@ -127,7 +127,7 @@ void CalculationController::willDisplayCellAtLocation(TableViewCell * cell, int myCell->setText(titles[j-1]); return; } - AppsContainer * container = (AppsContainer *)app()->container(); + App * regApp = (App *)app(); if (i == 1 && j > 0 && j < 6) { ArgCalculPointer calculationMethods[(k_totalNumberOfRows-1)/2] = {&Store::meanOfColumn, &Store::sumOfColumn, &Store::squaredValueSumOfColumn, &Store::standardDeviationOfColumn, &Store::varianceOfColumn}; @@ -135,9 +135,9 @@ void CalculationController::willDisplayCellAtLocation(TableViewCell * cell, int float calculation2 = (m_store->*calculationMethods[j-1])(1); EvenOddDoubleBufferTextCell * myCell = (EvenOddDoubleBufferTextCell *)cell; char buffer[Complex::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits)]; - Complex::convertFloatToText(calculation1, buffer, Complex::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits), Constant::LargeNumberOfSignificantDigits, container->preferences()->displayMode()); + Complex::convertFloatToText(calculation1, buffer, Complex::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits), Constant::LargeNumberOfSignificantDigits, regApp->container()->preferences()->displayMode()); myCell->setFirstText(buffer); - Complex::convertFloatToText(calculation2, buffer, Complex::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits), Constant::LargeNumberOfSignificantDigits, container->preferences()->displayMode()); + Complex::convertFloatToText(calculation2, buffer, Complex::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits), Constant::LargeNumberOfSignificantDigits, regApp->container()->preferences()->displayMode()); myCell->setSecondText(buffer); return; } @@ -147,7 +147,7 @@ void CalculationController::willDisplayCellAtLocation(TableViewCell * cell, int float calculation = (m_store->*calculationMethods[j-6])(); EvenOddBufferTextCell * myCell = (EvenOddBufferTextCell *)cell; char buffer[Complex::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits)]; - Complex::convertFloatToText(calculation, buffer, Complex::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits), Constant::LargeNumberOfSignificantDigits, container->preferences()->displayMode()); + Complex::convertFloatToText(calculation, buffer, Complex::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits), Constant::LargeNumberOfSignificantDigits, regApp->container()->preferences()->displayMode()); myCell->setText(buffer); return; } diff --git a/apps/regression/graph_controller.cpp b/apps/regression/graph_controller.cpp index 4bc84da37..13e6eaf8d 100644 --- a/apps/regression/graph_controller.cpp +++ b/apps/regression/graph_controller.cpp @@ -57,7 +57,7 @@ bool GraphController::handleEnter() { } void GraphController::reloadBannerView() { - AppsContainer * container = (AppsContainer *)app()->container(); + AppsContainer * container = ((App *)app())->container(); m_bannerView.setLegendAtIndex((char *)"y = ax+b", 0); char buffer[k_maxNumberOfCharacters + Complex::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits)]; const char * legend = "a = "; diff --git a/apps/shared/editable_cell_table_view_controller.cpp b/apps/shared/editable_cell_table_view_controller.cpp index 77b0fbd2f..165aa7b09 100644 --- a/apps/shared/editable_cell_table_view_controller.cpp +++ b/apps/shared/editable_cell_table_view_controller.cpp @@ -25,7 +25,7 @@ bool EditableCellTableViewController::textFieldDidReceiveEvent(TextField * textF } bool EditableCellTableViewController::textFieldDidFinishEditing(TextField * textField, const char * text) { - AppsContainer * appsContainer = (AppsContainer *)app()->container(); + AppsContainer * appsContainer = ((TextFieldDelegateApp *)app())->container(); Context * globalContext = appsContainer->globalContext(); float floatBody = Expression::parse(text)->approximate(*globalContext, appsContainer->preferences()->angleUnit()); setDataAtLocation(floatBody, m_selectableTableView.selectedColumn(), m_selectableTableView.selectedRow()); diff --git a/apps/shared/float_parameter_controller.cpp b/apps/shared/float_parameter_controller.cpp index c5f60fc19..47723eb92 100644 --- a/apps/shared/float_parameter_controller.cpp +++ b/apps/shared/float_parameter_controller.cpp @@ -36,7 +36,7 @@ void FloatParameterController::willDisplayCellForIndex(TableViewCell * cell, int } bool FloatParameterController::textFieldDidFinishEditing(TextField * textField, const char * text) { - AppsContainer * appsContainer = (AppsContainer *)app()->container(); + AppsContainer * appsContainer = ((TextFieldDelegateApp *)app())->container(); Context * globalContext = appsContainer->globalContext(); float floatBody = Expression::parse(text)->approximate(*globalContext, appsContainer->preferences()->angleUnit()); setParameterAtIndex(m_selectableTableView.selectedRow(), floatBody); diff --git a/apps/shared/interactive_curve_view_controller.cpp b/apps/shared/interactive_curve_view_controller.cpp index 8397e51a0..4c009091d 100644 --- a/apps/shared/interactive_curve_view_controller.cpp +++ b/apps/shared/interactive_curve_view_controller.cpp @@ -1,4 +1,5 @@ #include "interactive_curve_view_controller.h" +#include "text_field_delegate_app.h" #include "../apps_container.h" #include #include @@ -38,7 +39,7 @@ const char * InteractiveCurveViewController::title() const { } View * InteractiveCurveViewController::view() { - AppsContainer * myContainer = (AppsContainer *)app()->container(); + AppsContainer * myContainer = ((TextFieldDelegateApp *)app())->container(); Expression::DisplayMode displayMode = myContainer->preferences()->displayMode(); if (displayMode != m_displayModeVersion) { reloadBannerView(); diff --git a/apps/shared/range_parameter_controller.cpp b/apps/shared/range_parameter_controller.cpp index 3c757f2c6..31a196361 100644 --- a/apps/shared/range_parameter_controller.cpp +++ b/apps/shared/range_parameter_controller.cpp @@ -1,4 +1,5 @@ #include "range_parameter_controller.h" +#include "text_field_delegate_app.h" #include "../apps_container.h" #include @@ -36,7 +37,7 @@ void RangeParameterController::willDisplayCellForIndex(TableViewCell * cell, int } bool RangeParameterController::textFieldDidFinishEditing(TextField * textField, const char * text) { - AppsContainer * appsContainer = (AppsContainer *)app()->container(); + AppsContainer * appsContainer = ((TextFieldDelegateApp *)app())->container(); Context * globalContext = appsContainer->globalContext(); float floatBody = Expression::parse(text)->approximate(*globalContext, appsContainer->preferences()->angleUnit()); setParameterAtIndex(m_selectableTableView.selectedRow(), floatBody); diff --git a/apps/shared/text_field_delegate_app.cpp b/apps/shared/text_field_delegate_app.cpp index d072bc905..bca6eab07 100644 --- a/apps/shared/text_field_delegate_app.cpp +++ b/apps/shared/text_field_delegate_app.cpp @@ -13,8 +13,11 @@ TextFieldDelegateApp::TextFieldDelegateApp(Container * container, ViewController } Context * TextFieldDelegateApp::localContext() { - AppsContainer * appsContainer = (AppsContainer *)app()->container(); - return appsContainer->globalContext(); + return container()->globalContext(); +} + +AppsContainer * TextFieldDelegateApp::container() { + return (AppsContainer *)app()->container(); } } diff --git a/apps/shared/text_field_delegate_app.h b/apps/shared/text_field_delegate_app.h index a15f45b1f..9d2783b49 100644 --- a/apps/shared/text_field_delegate_app.h +++ b/apps/shared/text_field_delegate_app.h @@ -4,12 +4,15 @@ #include #include "expression_text_field_delegate.h" +class AppsContainer; + namespace Shared { class TextFieldDelegateApp : public ::App, public ExpressionTextFieldDelegate { public: TextFieldDelegateApp(Container * container, ViewController * rootViewController, const char * name = nullptr, const char * upperName = nullptr, const Image * icon = nullptr); virtual Poincare::Context * localContext() override; + AppsContainer * container(); }; } diff --git a/apps/statistics/box_controller.cpp b/apps/statistics/box_controller.cpp index 346db09ca..648572d93 100644 --- a/apps/statistics/box_controller.cpp +++ b/apps/statistics/box_controller.cpp @@ -1,5 +1,6 @@ #include "box_controller.h" #include "../apps_container.h" +#include "app.h" #include using namespace Poincare; @@ -21,7 +22,7 @@ const char * BoxController::title() const { } View * BoxController::view() { - AppsContainer * myContainer = (AppsContainer *)app()->container(); + AppsContainer * myContainer = ((App *)app())->container(); Expression::DisplayMode displayMode = myContainer->preferences()->displayMode(); if (displayMode != m_displayModeVersion) { reloadBannerView(); @@ -79,7 +80,7 @@ void BoxController::reloadBannerView() { CalculPointer calculationMethods[5] = {&Store::minValue, &Store::firstQuartile, &Store::median, &Store::thirdQuartile, &Store::maxValue}; float calculation = (m_store->*calculationMethods[(int)m_view.selectedQuantile()])(); - AppsContainer * container = (AppsContainer *)app()->container(); + AppsContainer * container = ((App *)app())->container(); Complex::convertFloatToText(calculation, buffer, Complex::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits), Constant::LargeNumberOfSignificantDigits, container->preferences()->displayMode()); m_boxBannerView.setLegendAtIndex(buffer, 1); } diff --git a/apps/statistics/calculation_controller.cpp b/apps/statistics/calculation_controller.cpp index 8199e4e46..e2e9efe9c 100644 --- a/apps/statistics/calculation_controller.cpp +++ b/apps/statistics/calculation_controller.cpp @@ -1,6 +1,7 @@ #include "calculation_controller.h" #include "../constant.h" #include "../apps_container.h" +#include "app.h" #include #include @@ -90,7 +91,7 @@ void CalculationController::willDisplayCellAtLocation(TableViewCell * cell, int float calculation = (m_store->*calculationMethods[j])(); EvenOddBufferTextCell * myCell = (EvenOddBufferTextCell *)cell; char buffer[Complex::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits)]; - AppsContainer * container = (AppsContainer *)app()->container(); + AppsContainer * container = ((App *)app())->container(); Complex::convertFloatToText(calculation, buffer, Complex::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits), Constant::LargeNumberOfSignificantDigits, container->preferences()->displayMode()); myCell->setText(buffer); } diff --git a/apps/statistics/histogram_controller.cpp b/apps/statistics/histogram_controller.cpp index 093fa1709..ac3d36698 100644 --- a/apps/statistics/histogram_controller.cpp +++ b/apps/statistics/histogram_controller.cpp @@ -1,5 +1,6 @@ #include "histogram_controller.h" #include "../apps_container.h" +#include "app.h" #include #include #include @@ -31,8 +32,8 @@ const char * HistogramController::title() const { } View * HistogramController::view() { - AppsContainer * myContainer = (AppsContainer *)app()->container(); - Expression::DisplayMode displayMode = myContainer->preferences()->displayMode(); + AppsContainer * container = ((App *)app())->container(); + Expression::DisplayMode displayMode = container->preferences()->displayMode(); if (displayMode != m_displayModeVersion) { reloadBannerView(); m_view.reload(); @@ -135,7 +136,7 @@ Responder * HistogramController::tabController() const { } void HistogramController::reloadBannerView() { - AppsContainer * container = (AppsContainer *)app()->container(); + AppsContainer * container = ((App *)app())->container(); char buffer[k_maxNumberOfCharacters+ Complex::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits)*2]; const char * legend = "Interval ["; int legendLength = strlen(legend);