mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[apps/sequence][apps/graph] fix behaviour when deleting functions
Change-Id: Ieccc85887fa0077446aaf57fee105b7fd2f3bff9
This commit is contained in:
@@ -223,6 +223,17 @@ bool Sequence::isDefined() {
|
||||
}
|
||||
}
|
||||
|
||||
bool Sequence::isEmpty() {
|
||||
switch (m_type) {
|
||||
case Type::Explicite:
|
||||
return Function::isEmpty();
|
||||
case Type::SingleRecurrence:
|
||||
return Function::isEmpty() && strlen(m_firstInitialConditionText) == 0;
|
||||
default:
|
||||
return Function::isEmpty() && strlen(m_firstInitialConditionText) == 0 && strlen(m_secondInitialConditionText) == 0;
|
||||
}
|
||||
}
|
||||
|
||||
float Sequence::evaluateAtAbscissa(float x, Poincare::Context * context) const {
|
||||
float n = roundf(x);
|
||||
switch (m_type) {
|
||||
|
||||
@@ -35,6 +35,7 @@ public:
|
||||
Poincare::ExpressionLayout * firstInitialConditionName();
|
||||
Poincare::ExpressionLayout * secondInitialConditionName();
|
||||
bool isDefined() override;
|
||||
bool isEmpty() override;
|
||||
float evaluateAtAbscissa(float x, Poincare::Context * context) const override;
|
||||
float sumOfTermsBetweenAbscissa(float start, float end, Poincare::Context * context);
|
||||
private:
|
||||
|
||||
@@ -83,6 +83,10 @@ void Function::setActive(bool active) {
|
||||
m_active = active;
|
||||
}
|
||||
|
||||
bool Function::isEmpty() {
|
||||
return strlen(m_text) == 0;
|
||||
}
|
||||
|
||||
float Function::evaluateAtAbscissa(float x, Poincare::Context * context) const {
|
||||
Poincare::VariableContext variableContext = Poincare::VariableContext(symbol(), context);
|
||||
Poincare::Symbol xSymbol = Poincare::Symbol(symbol());
|
||||
|
||||
@@ -23,6 +23,7 @@ public:
|
||||
virtual bool isDefined();
|
||||
bool isActive();
|
||||
void setActive(bool active);
|
||||
virtual bool isEmpty();
|
||||
virtual void setContent(const char * c);
|
||||
void setColor(KDColor m_color);
|
||||
virtual float evaluateAtAbscissa(float x, Poincare::Context * context) const;
|
||||
|
||||
@@ -208,7 +208,7 @@ bool ListController::handleEvent(Ion::Events::Event event) {
|
||||
if (event == Ion::Events::Backspace && selectedRow() >= 0 &&
|
||||
(selectedRow() < numberOfRows() - 1 || m_functionStore->numberOfFunctions() == m_functionStore->maxNumberOfFunctions())) {
|
||||
Shared::Function * function = m_functionStore->functionAtIndex(functionIndexForRow(selectedRow()));
|
||||
if (selectedColumn() == 1) {
|
||||
if (selectedColumn() == 1 && !function->isEmpty()) {
|
||||
reinitExpression(function);
|
||||
} else {
|
||||
removeFunctionRow(function);
|
||||
|
||||
Reference in New Issue
Block a user