mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-18 21:30:38 +01:00
[aps/solver] Reset the solution selection when leaving the view
Solve an equation that has solutions, select a solution, then go back and change the equation. WHen you go to the solutions, the previous solution is still selected, which is a little weird
This commit is contained in:
@@ -94,5 +94,13 @@ bool DisplayModeController::textFieldDidFinishEditing(TextField * textField, con
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
int DisplayModeController::initialSelectedRow() const {
|
||||
int row = selectedRow();
|
||||
/* If the significant number of digits row was selected, keep selecting it,
|
||||
* else select the display mode currently used. */
|
||||
if (row == numberOfRows() - 1) {
|
||||
return row;
|
||||
}
|
||||
return PreferencesController::initialSelectedRow();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,15 +19,10 @@ public:
|
||||
void willDisplayCellForIndex(HighlightCell * cell, int index) override;
|
||||
bool textFieldShouldFinishEditing(TextField * textField, Ion::Events::Event event) override;
|
||||
bool textFieldDidFinishEditing(TextField * textField, const char * text, Ion::Events::Event event) override;
|
||||
|
||||
/* DisplayModeController is different to GenericSubController as it can
|
||||
* display the modal view if there is a syntax error in the text field. We
|
||||
* need to tweak the different Responder methods to handle the modal view
|
||||
* properly. */
|
||||
void didEnterResponderChain(Responder * previousFirstResponder) override {} // Override GenericSubController which reinitializes the selected cell
|
||||
private:
|
||||
static constexpr int k_resultFormatType = 0;
|
||||
static constexpr int k_significantDigitsType = 1;
|
||||
int initialSelectedRow() const override;
|
||||
MessageTableCellWithEditableTextWithSeparator m_editableCell;
|
||||
};
|
||||
|
||||
|
||||
@@ -16,9 +16,9 @@ public:
|
||||
KDCoordinate rowHeight(int j) override;
|
||||
protected:
|
||||
constexpr static int k_totalNumberOfCell = 3;
|
||||
int initialSelectedRow() const override { return valueIndexForPreference(m_messageTreeModel->label()); }
|
||||
private:
|
||||
constexpr static const KDFont * k_layoutFont = KDFont::SmallFont;
|
||||
int initialSelectedRow() const override { return valueIndexForPreference(m_messageTreeModel->label()); }
|
||||
Poincare::Layout layoutForPreferences(I18n::Message message);
|
||||
void setPreferenceWithValueIndex(I18n::Message message, int valueIndex);
|
||||
int valueIndexForPreference(I18n::Message message) const;
|
||||
|
||||
@@ -121,9 +121,11 @@ void SolutionsController::viewWillAppear() {
|
||||
}
|
||||
m_contentView.setWarning(requireWarning);
|
||||
m_contentView.selectableTableView()->reloadData();
|
||||
if (selectedRow() < 0) {
|
||||
selectCellAtLocation(0, 0);
|
||||
}
|
||||
selectCellAtLocation(0, 0);
|
||||
}
|
||||
|
||||
void SolutionsController::viewDidDisappear() {
|
||||
selectCellAtLocation(-1, -1);
|
||||
}
|
||||
|
||||
void SolutionsController::didEnterResponderChain(Responder * previousFirstResponder) {
|
||||
|
||||
@@ -17,6 +17,7 @@ public:
|
||||
const char * title() override;
|
||||
View * view() override { return &m_contentView; }
|
||||
void viewWillAppear() override;
|
||||
void viewDidDisappear() override;
|
||||
void didEnterResponderChain(Responder * previousFirstResponder) override;
|
||||
/* AlternateEmptyViewDefaultDelegate */
|
||||
bool isEmpty() const override;
|
||||
|
||||
Reference in New Issue
Block a user