mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-26 17:20:53 +01:00
[apps] Substitute "app()->container()" by "AppsContainer::sharedAppsContainer()"
This commit is contained in:
committed by
EmilieNumworks
parent
268ad3f3ba
commit
eb3da7f395
@@ -90,7 +90,7 @@ void ConsoleController::terminateInputLoop() {
|
||||
}
|
||||
|
||||
const char * ConsoleController::inputText(const char * prompt) {
|
||||
AppsContainer * a = (AppsContainer *)(app()->container());
|
||||
AppsContainer * appsContainer = AppsContainer::sharedAppsContainer();
|
||||
m_inputRunLoopActive = true;
|
||||
|
||||
const char * promptText = prompt;
|
||||
@@ -119,10 +119,10 @@ const char * ConsoleController::inputText(const char * prompt) {
|
||||
// Reload the history
|
||||
m_selectableTableView.reloadData();
|
||||
m_selectableTableView.selectCellAtLocation(0, m_consoleStore.numberOfLines());
|
||||
a->redrawWindow();
|
||||
appsContainer->redrawWindow();
|
||||
|
||||
// Launch a new input loop
|
||||
a->runWhile([](void * a){
|
||||
appsContainer->runWhile([](void * a){
|
||||
ConsoleController * c = static_cast<ConsoleController *>(a);
|
||||
return c->inputRunLoopActive();
|
||||
}, this);
|
||||
|
||||
@@ -121,7 +121,7 @@ bool MenuController::handleEvent(Ion::Events::Event event) {
|
||||
void MenuController::renameSelectedScript() {
|
||||
assert(m_selectableTableView.selectedRow() >= 0);
|
||||
assert(m_selectableTableView.selectedRow() < m_scriptStore->numberOfScripts());
|
||||
static_cast<AppsContainer *>(const_cast<Container *>(app()->container()))->setShiftAlphaStatus(Ion::Events::ShiftAlphaStatus::AlphaLock);
|
||||
AppsContainer::sharedAppsContainer()->setShiftAlphaStatus(Ion::Events::ShiftAlphaStatus::AlphaLock);
|
||||
m_selectableTableView.selectCellAtLocation(0, (m_selectableTableView.selectedRow()));
|
||||
ScriptNameCell * myCell = static_cast<ScriptNameCell *>(m_selectableTableView.selectedCell());
|
||||
app()->setFirstResponder(myCell);
|
||||
@@ -338,7 +338,7 @@ bool MenuController::textFieldDidFinishEditing(TextField * textField, const char
|
||||
m_selectableTableView.selectedCell()->setHighlighted(true);
|
||||
reloadConsole();
|
||||
app()->setFirstResponder(&m_selectableTableView);
|
||||
static_cast<AppsContainer *>(const_cast<Container *>(app()->container()))->setShiftAlphaStatus(Ion::Events::ShiftAlphaStatus::Default);
|
||||
AppsContainer::sharedAppsContainer()->setShiftAlphaStatus(Ion::Events::ShiftAlphaStatus::Default);
|
||||
return true;
|
||||
} else if (error == Script::ErrorStatus::NameTaken) {
|
||||
app()->displayWarning(I18n::Message::NameTaken);
|
||||
@@ -422,7 +422,7 @@ bool MenuController::privateTextFieldDidAbortEditing(TextField * textField, bool
|
||||
m_selectableTableView.selectCellAtLocation(m_selectableTableView.selectedColumn(), m_selectableTableView.selectedRow());
|
||||
app()->setFirstResponder(&m_selectableTableView);
|
||||
}
|
||||
static_cast<AppsContainer *>(const_cast<Container *>(app()->container()))->setShiftAlphaStatus(Ion::Events::ShiftAlphaStatus::Default);
|
||||
AppsContainer::sharedAppsContainer()->setShiftAlphaStatus(Ion::Events::ShiftAlphaStatus::Default);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ bool SandboxController::handleEvent(Ion::Events::Event event) {
|
||||
}
|
||||
|
||||
void SandboxController::redrawWindow() {
|
||||
static_cast<AppsContainer *>(const_cast<Container *>(app()->container()))->redrawWindow();
|
||||
AppsContainer::sharedAppsContainer()->redrawWindow();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -47,8 +47,7 @@ bool ExamPopUpController::handleEvent(Ion::Events::Event event) {
|
||||
|
||||
ExamPopUpController::ContentView::ContentView(Responder * parentResponder) :
|
||||
m_cancelButton(parentResponder, I18n::Message::Cancel, Invocation([](void * context, void * sender) {
|
||||
ExamPopUpController * controller = (ExamPopUpController *)context;
|
||||
Container * container = (Container *)controller->app()->container();
|
||||
AppsContainer * container = AppsContainer::sharedAppsContainer();
|
||||
container->activeApp()->dismissModalViewController();
|
||||
return true;
|
||||
}, parentResponder), KDFont::SmallFont),
|
||||
@@ -56,7 +55,7 @@ ExamPopUpController::ContentView::ContentView(Responder * parentResponder) :
|
||||
ExamPopUpController * controller = (ExamPopUpController *)context;
|
||||
GlobalPreferences::ExamMode nextExamMode = controller->isActivatingExamMode() ? GlobalPreferences::ExamMode::Activate : GlobalPreferences::ExamMode::Deactivate;
|
||||
GlobalPreferences::sharedGlobalPreferences()->setExamMode(nextExamMode);
|
||||
AppsContainer * container = (AppsContainer *)controller->app()->container();
|
||||
AppsContainer * container = AppsContainer::sharedAppsContainer();
|
||||
if (controller->isActivatingExamMode()) {
|
||||
container->reset();
|
||||
Ion::LED::setColor(KDColorRed);
|
||||
|
||||
@@ -38,7 +38,7 @@ void ListController::renameSelectedFunction() {
|
||||
computeTitlesColumnWidth(true);
|
||||
selectableTableView()->reloadData();
|
||||
|
||||
static_cast<AppsContainer *>(const_cast<Container *>(app()->container()))->setShiftAlphaStatus(Ion::Events::ShiftAlphaStatus::AlphaLock);
|
||||
AppsContainer::sharedAppsContainer()->setShiftAlphaStatus(Ion::Events::ShiftAlphaStatus::AlphaLock);
|
||||
TextFieldFunctionTitleCell * selectedTitleCell = (TextFieldFunctionTitleCell *)(selectableTableView()->selectedCell());
|
||||
selectedTitleCell->setHorizontalAlignment(1.0f);
|
||||
app()->setFirstResponder(selectedTitleCell);
|
||||
@@ -91,7 +91,7 @@ bool ListController::textFieldDidFinishEditing(TextField * textField, const char
|
||||
if (selectTab) {
|
||||
m_selectableTableView.parentResponder()->handleEvent(event);
|
||||
}
|
||||
static_cast<AppsContainer *>(const_cast<Container *>(app()->container()))->setShiftAlphaStatus(Ion::Events::ShiftAlphaStatus::Default);
|
||||
AppsContainer::sharedAppsContainer()->setShiftAlphaStatus(Ion::Events::ShiftAlphaStatus::Default);
|
||||
return true;
|
||||
} else if (error == Ion::Storage::Record::ErrorStatus::NameTaken) {
|
||||
app()->displayWarning(I18n::Message::NameTaken);
|
||||
@@ -122,7 +122,7 @@ bool ListController::textFieldDidAbortEditing(TextField * textField) {
|
||||
setFunctionNameInTextField(function, textField);
|
||||
m_selectableTableView.selectedCell()->setHighlighted(true);
|
||||
app()->setFirstResponder(&m_selectableTableView);
|
||||
static_cast<AppsContainer *>(const_cast<Container *>(app()->container()))->setShiftAlphaStatus(Ion::Events::ShiftAlphaStatus::Default);
|
||||
AppsContainer::sharedAppsContainer()->setShiftAlphaStatus(Ion::Events::ShiftAlphaStatus::Default);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -39,8 +39,7 @@ PopUpController::ContentView::ContentView(Responder * parentResponder) :
|
||||
return true;
|
||||
}, this), KDFont::SmallFont),
|
||||
m_okButton(this, I18n::Message::Ok, Invocation([](void * context, void * sender) {
|
||||
PopUpController::ContentView * view = (PopUpController::ContentView *)context;
|
||||
AppsContainer * appsContainer = (AppsContainer *)view->app()->container();
|
||||
AppsContainer * appsContainer = AppsContainer::sharedAppsContainer();
|
||||
bool switched = appsContainer->switchTo(appsContainer->hardwareTestAppSnapshot());
|
||||
assert(switched);
|
||||
(void) switched; // Silence compilation warning about unused variable.
|
||||
|
||||
@@ -17,7 +17,7 @@ void LanguageController::reinitOnBoarding() {
|
||||
|
||||
bool LanguageController::handleEvent(Ion::Events::Event event) {
|
||||
if (Shared::LanguageController::handleEvent(event)) {
|
||||
AppsContainer * appsContainer = (AppsContainer *)app()->container();
|
||||
AppsContainer * appsContainer = AppsContainer::sharedAppsContainer();
|
||||
#ifdef EPSILON_BOOT_PROMPT
|
||||
app()->displayModalViewController(appsContainer->promptController(), 0.5f, 0.5f);
|
||||
#else
|
||||
|
||||
@@ -53,7 +53,7 @@ PopUpController::PopUpController(I18n::Message * messages, KDColor * colors, uin
|
||||
bool PopUpController::handleEvent(Ion::Events::Event event) {
|
||||
if (event != Ion::Events::Back && event != Ion::Events::OnOff && event != Ion::Events::USBPlug && event != Ion::Events::USBEnumeration) {
|
||||
app()->dismissModalViewController();
|
||||
AppsContainer * appsContainer = (AppsContainer *)app()->container();
|
||||
AppsContainer * appsContainer = AppsContainer::sharedAppsContainer();
|
||||
if (appsContainer->activeApp()->snapshot() == appsContainer->onBoardingAppSnapshot()) {
|
||||
bool switched = appsContainer->switchTo(appsContainer->appSnapshotAtIndex(0));
|
||||
assert(switched);
|
||||
|
||||
@@ -203,7 +203,7 @@ void CalculationController::willDisplayCellAtLocation(HighlightCell * cell, int
|
||||
Model::Type modelType = m_store->seriesRegressionType(seriesNumber);
|
||||
|
||||
// Put dashes if regression is not defined
|
||||
Poincare::Context * globContext = const_cast<AppsContainer *>(static_cast<const AppsContainer *>(app()->container()))->globalContext();
|
||||
Poincare::Context * globContext = AppsContainer::sharedAppsContainer()->globalContext();
|
||||
double * coefficients = m_store->coefficientsForSeries(seriesNumber, globContext);
|
||||
bool coefficientsAreDefined = true;
|
||||
int numberOfCoefs = m_store->modelForSeries(seriesNumber)->numberOfCoefficients();
|
||||
|
||||
@@ -40,7 +40,7 @@ double GoToParameterController::parameterAtIndex(int index) {
|
||||
bool GoToParameterController::setParameterAtIndex(int parameterIndex, double f) {
|
||||
assert(parameterIndex == 0);
|
||||
int series = m_graphController->selectedSeriesIndex();
|
||||
Poincare::Context * globContext = const_cast<AppsContainer *>(static_cast<const AppsContainer *>(app()->container()))->globalContext();
|
||||
Poincare::Context * globContext = AppsContainer::sharedAppsContainer()->globalContext();
|
||||
double unknown = m_xPrediction ?
|
||||
m_store->yValueForXValue(series, f, globContext) :
|
||||
m_store->xValueForYValue(series, f, globContext);
|
||||
|
||||
@@ -97,7 +97,7 @@ void GraphController::selectRegressionCurve() {
|
||||
// Private
|
||||
|
||||
Poincare::Context * GraphController::globalContext() {
|
||||
return const_cast<AppsContainer *>(static_cast<const AppsContainer *>(app()->container()))->globalContext();
|
||||
return AppsContainer::sharedAppsContainer()->globalContext();
|
||||
}
|
||||
|
||||
// SimpleInteractiveCurveViewController
|
||||
|
||||
@@ -22,11 +22,11 @@ void GraphView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
drawGrid(ctx, rect);
|
||||
drawAxes(ctx, rect);
|
||||
simpleDrawBothAxesLabels(ctx, rect);
|
||||
Poincare::Context * globContext = AppsContainer::sharedAppsContainer()->globalContext();
|
||||
for (int series = 0; series < Store::k_numberOfSeries; series++) {
|
||||
if (!m_store->seriesIsEmpty(series)) {
|
||||
KDColor color = Palette::DataColor[series];
|
||||
Model * seriesModel = m_store->modelForSeries(series);
|
||||
Poincare::Context * globContext = const_cast<AppsContainer *>(static_cast<const AppsContainer *>(m_controller->app()->container()))->globalContext();
|
||||
drawCurve(ctx, rect, [](float abscissa, void * model, void * context) {
|
||||
Model * regressionModel = static_cast<Model *>(model);
|
||||
double * regressionCoefficients = static_cast<double *>(context);
|
||||
|
||||
@@ -19,7 +19,7 @@ StoreController::StoreController(Responder * parentResponder, InputEventHandlerD
|
||||
}
|
||||
|
||||
StoreContext * StoreController::storeContext() {
|
||||
m_regressionContext.setParentContext(const_cast<AppsContainer *>(static_cast<const AppsContainer *>(app()->container()))->globalContext());
|
||||
m_regressionContext.setParentContext(AppsContainer::sharedAppsContainer()->globalContext());
|
||||
return &m_regressionContext;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,8 +24,7 @@ bool ExamModeController::handleEvent(Ion::Events::Event event) {
|
||||
if (GlobalPreferences::sharedGlobalPreferences()->examMode() == GlobalPreferences::ExamMode::Activate) {
|
||||
return false;
|
||||
}
|
||||
AppsContainer * container = (AppsContainer *)(app()->container());
|
||||
container->displayExamModePopUp(true);
|
||||
AppsContainer::sharedAppsContainer()->displayExamModePopUp(true);
|
||||
return true;
|
||||
}
|
||||
return GenericSubController::handleEvent(event);
|
||||
|
||||
@@ -30,8 +30,7 @@ bool PreferencesController::handleEvent(Ion::Events::Event event) {
|
||||
/* Generic behaviour of preference menu*/
|
||||
assert(m_messageTreeModel->label() != I18n::Message::DisplayMode || selectedRow() != numberOfRows()-1); // In that case, events OK and EXE are handled by the cell
|
||||
setPreferenceWithValueIndex(m_messageTreeModel->label(), selectedRow());
|
||||
AppsContainer * myContainer = (AppsContainer * )app()->container();
|
||||
myContainer->refreshPreferences();
|
||||
AppsContainer::sharedAppsContainer()->refreshPreferences();
|
||||
StackViewController * stack = stackController();
|
||||
stack->pop();
|
||||
return true;
|
||||
|
||||
@@ -43,8 +43,7 @@ bool LanguageController::handleEvent(Ion::Events::Event event) {
|
||||
GlobalPreferences::sharedGlobalPreferences()->setLanguage((I18n::Language)(selectedRow()+1));
|
||||
/* We need to reload the whole title bar in order to translate both the
|
||||
* "Settings" title and the degree preference. */
|
||||
AppsContainer * myContainer = (AppsContainer * )app()->container();
|
||||
myContainer->reloadTitleBarView();
|
||||
AppsContainer::sharedAppsContainer()->reloadTitleBarView();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -258,7 +258,7 @@ bool StoreController::privateFillColumnWithFormula(Expression formula, Expressio
|
||||
constexpr static int k_maxSizeOfStoreSymbols = 3; // "V1", "N1", "X1", "Y1"
|
||||
char variables[Expression::k_maxNumberOfVariables][k_maxSizeOfStoreSymbols];
|
||||
variables[0][0] = 0;
|
||||
AppsContainer * appsContainer = (AppsContainer *)app()->container();
|
||||
AppsContainer * appsContainer = AppsContainer::sharedAppsContainer();
|
||||
int nbOfVariables = formula.getVariables(*(appsContainer->globalContext()), isVariable, (char *)variables, k_maxSizeOfStoreSymbols);
|
||||
(void) nbOfVariables; // Remove compilation warning of nused variable
|
||||
assert(nbOfVariables >= 0);
|
||||
|
||||
@@ -22,7 +22,7 @@ StoreController::StoreController(Responder * parentResponder, InputEventHandlerD
|
||||
}
|
||||
|
||||
StoreContext * StoreController::storeContext() {
|
||||
m_statisticsContext.setParentContext(const_cast<AppsContainer *>(static_cast<const AppsContainer *>(app()->container()))->globalContext());
|
||||
m_statisticsContext.setParentContext(AppsContainer::sharedAppsContainer()->globalContext());
|
||||
return &m_statisticsContext;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user