[apps] Don't forget to call viewWillAppear

At the moment ViewController::viewWillAppear doesn't do anything, so
there is no real impact. But if we want to use it it needs to be called
from subclasses.
This commit is contained in:
Romain Goyet
2020-02-13 15:51:53 -05:00
committed by Ecco
parent c23ad0c882
commit 7f43b73049
21 changed files with 21 additions and 0 deletions

View File

@@ -37,6 +37,7 @@ void HistoryController::reload() {
}
void HistoryController::viewWillAppear() {
ViewController::viewWillAppear();
reload();
}

View File

@@ -162,6 +162,7 @@ const char * ConsoleController::inputText(const char * prompt) {
}
void ConsoleController::viewWillAppear() {
ViewController::viewWillAppear();
loadPythonEnvironment();
if (m_importScriptsWhenViewAppears) {
m_importScriptsWhenViewAppears = false;

View File

@@ -59,6 +59,7 @@ void EditorController::didBecomeFirstResponder() {
}
void EditorController::viewWillAppear() {
ViewController::viewWillAppear();
m_editorView.loadSyntaxHighlighter();
m_editorView.setCursorLocation(m_editorView.text() + strlen(m_editorView.text()));
}

View File

@@ -79,6 +79,7 @@ void MenuController::didBecomeFirstResponder() {
}
void MenuController::viewWillAppear() {
ViewController::viewWillAppear();
updateAddScriptRowDisplay();
}

View File

@@ -61,6 +61,7 @@ bool ScriptParameterController::handleEvent(Ion::Events::Event event) {
}
void ScriptParameterController::viewWillAppear() {
ViewController::viewWillAppear();
m_selectableTableView.reloadData();
m_selectableTableView.selectCellAtLocation(0,0);
}

View File

@@ -19,6 +19,7 @@ CalculationGraphController::CalculationGraphController(Responder * parentRespond
}
void CalculationGraphController::viewWillAppear() {
Shared::SimpleInteractiveCurveViewController::viewWillAppear();
assert(!m_record.isNull());
Coordinate2D<double> pointOfInterest = computeNewPointOfInterestFromAbscissa(m_graphRange->xMin(), 1);
if (std::isnan(pointOfInterest.x1())) {

View File

@@ -33,6 +33,7 @@ View * CalculationParameterController::view() {
}
void CalculationParameterController::viewWillAppear() {
ViewController::viewWillAppear();
m_selectableTableView.reloadData();
}

View File

@@ -77,6 +77,7 @@ int CurveParameterController::reusableCellCount() const {
}
void CurveParameterController::viewWillAppear() {
Shared::FunctionCurveParameterController::viewWillAppear();
m_selectableTableView.reloadData();
}

View File

@@ -23,6 +23,7 @@ const char * TangentGraphController::title() {
}
void TangentGraphController::viewWillAppear() {
Shared::SimpleInteractiveCurveViewController::viewWillAppear();
m_graphRange->panToMakePointVisible(m_cursor->x(), m_cursor->y(), cursorTopMarginRatio(), k_cursorRightMarginRatio, cursorBottomMarginRatio(), k_cursorLeftMarginRatio);
m_graphView->drawTangent(true);
m_graphView->setOkView(nullptr);

View File

@@ -42,6 +42,7 @@ const char * TypeParameterController::title() {
}
void TypeParameterController::viewWillAppear() {
ViewController::viewWillAppear();
App * myApp = App::app();
assert(!m_record.isNull());
Shared::ExpiringPointer<Shared::ContinuousFunction> function = myApp->functionStore()->modelForRecord(m_record);

View File

@@ -72,6 +72,7 @@ DistributionController::DistributionController(Responder * parentResponder, Dist
}
void Probability::DistributionController::viewWillAppear() {
ViewController::viewWillAppear();
selectRow((int)m_distribution->type());
}

View File

@@ -197,6 +197,7 @@ void MainController::willDisplayCellForIndex(HighlightCell * cell, int index) {
}
void MainController::viewWillAppear() {
ViewController::viewWillAppear();
m_selectableTableView.reloadData();
}

View File

@@ -27,6 +27,7 @@ void GenericSubController::didBecomeFirstResponder() {
}
void GenericSubController::viewWillAppear() {
ViewController::viewWillAppear();
/* This can't be done in didEnterResponderChain because we don't want it to
* be done everytime the pop-up disappears. For example, if we are editing a
* field and a pop-up shows up with a warning, we don't want to reload the

View File

@@ -34,6 +34,7 @@ void FloatParameterController<T>::didBecomeFirstResponder() {
template<typename T>
void FloatParameterController<T>::viewWillAppear() {
ViewController::viewWillAppear();
if (selectedRow() == -1 || selectedRow() == numberOfRows()-1) {
selectCellAtLocation(0, 0);
} else {

View File

@@ -38,6 +38,7 @@ FunctionListController::FunctionListController(Responder * parentResponder, Butt
/* TableViewDataSource */
void FunctionListController::viewWillAppear() {
ExpressionModelListController::viewWillAppear();
computeTitlesColumnWidth();
}

View File

@@ -133,6 +133,7 @@ Responder * InteractiveCurveViewController::defaultController() {
}
void InteractiveCurveViewController::viewWillAppear() {
SimpleInteractiveCurveViewController::viewWillAppear();
uint32_t newModelVersion = modelVersion();
if (*m_modelVersion != newModelVersion) {
if (*m_modelVersion == 0 || numberOfCurves() == 1 || shouldSetDefaultOnModelChange()) {

View File

@@ -35,6 +35,7 @@ void LanguageController::didBecomeFirstResponder() {
}
void LanguageController::viewWillAppear() {
ViewController::viewWillAppear();
resetSelection();
}

View File

@@ -26,6 +26,7 @@ SumGraphController::SumGraphController(Responder * parentResponder, InputEventHa
}
void SumGraphController::viewWillAppear() {
SimpleInteractiveCurveViewController::viewWillAppear();
m_graphRange->panToMakePointVisible(m_cursor->x(), m_cursor->y(), cursorTopMarginRatio(), k_cursorRightMarginRatio, cursorBottomMarginRatio(), k_cursorLeftMarginRatio);
m_graphView->setBannerView(&m_legendView);
m_graphView->setCursorView(&m_cursorView);

View File

@@ -12,6 +12,7 @@ void TabTableController::didBecomeFirstResponder() {
}
void TabTableController::viewWillAppear() {
ViewController::viewWillAppear();
selectableTableView()->reloadData();
}

View File

@@ -55,6 +55,7 @@ bool ZoomParameterController::handleEvent(Ion::Events::Event event) {
}
void ZoomParameterController::viewWillAppear() {
ViewController::viewWillAppear();
m_contentView.curveView()->setOkView(nullptr);
/* We need to change the curve range to keep the same visual aspect of the
* view. */

View File

@@ -27,6 +27,7 @@ Responder * MultipleDataViewController::defaultController() {
}
void MultipleDataViewController::viewWillAppear() {
ViewController::viewWillAppear();
if (*m_selectedSeriesIndex < 0 || m_store->sumOfOccurrences(*m_selectedSeriesIndex) == 0) {
*m_selectedSeriesIndex = multipleDataView()->seriesOfSubviewAtIndex(0);
}