Skip to content

Commit

Permalink
[apps/shared] Always change display values derivative when changing d…
Browse files Browse the repository at this point in the history
…isplay plot derivative
  • Loading branch information
PiaNumworks authored and GabrielNumworks committed Apr 18, 2024
1 parent 00e7fe6 commit 464065f
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 19 deletions.
4 changes: 0 additions & 4 deletions apps/graph/shared/derivatives_parameter_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@ void DerivativesParameterController::toggleSwitch(int row) {
case k_indexOfFirstDerivativePlot:
function()->setDisplayPlotFirstDerivative(
!function()->displayPlotFirstDerivative());
function()->setDisplayValueFirstDerivative(
function()->displayPlotFirstDerivative());
break;
case k_indexOfSecondDerivativeValue:
function()->setDisplayValueSecondDerivative(
Expand All @@ -88,8 +86,6 @@ void DerivativesParameterController::toggleSwitch(int row) {
assert(row == k_indexOfSecondDerivativePlot);
function()->setDisplayPlotSecondDerivative(
!function()->displayPlotSecondDerivative());
function()->setDisplayValueSecondDerivative(
function()->displayPlotSecondDerivative());
break;
}
updateSwitchs();
Expand Down
18 changes: 16 additions & 2 deletions apps/shared/continuous_function.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,13 +261,27 @@ void ContinuousFunction::updateModel(Context *context, bool wasCartesian) {
setTAuto(true);
}
if (!canDisplayDerivative()) {
setDisplayValueFirstDerivative(false);
// No need to setDisplayValues, it is already included in setDisplayPlot
setDisplayPlotFirstDerivative(false);
setDisplayValueSecondDerivative(false);
setDisplayPlotSecondDerivative(false);
}
}

void ContinuousFunction::setDisplayValueFirstDerivative(bool display) {
recordData()->setDisplayValueFirstDerivative(display);
}
void ContinuousFunction::setDisplayPlotFirstDerivative(bool display) {
recordData()->setDisplayPlotFirstDerivative(display);
recordData()->setDisplayValueFirstDerivative(display);
}
void ContinuousFunction::setDisplayValueSecondDerivative(bool display) {
recordData()->setDisplayValueSecondDerivative(display);
}
void ContinuousFunction::setDisplayPlotSecondDerivative(bool display) {
recordData()->setDisplayPlotSecondDerivative(display);
recordData()->setDisplayValueSecondDerivative(display);
}

int ContinuousFunction::derivationOrderFromRelativeIndex(
int relativeIndex, DerivativeDisplayType type) const {
bool displayFirstDerivative, displaySecondDerivative;
Expand Down
16 changes: 4 additions & 12 deletions apps/shared/continuous_function.h
Original file line number Diff line number Diff line change
Expand Up @@ -186,18 +186,10 @@ class ContinuousFunction : public Function {
return recordData()->displayPlotSecondDerivative();
}
// Set derivative display status
void setDisplayValueFirstDerivative(bool display) {
return recordData()->setDisplayValueFirstDerivative(display);
}
void setDisplayPlotFirstDerivative(bool display) {
return recordData()->setDisplayPlotFirstDerivative(display);
}
void setDisplayValueSecondDerivative(bool display) {
return recordData()->setDisplayValueSecondDerivative(display);
}
void setDisplayPlotSecondDerivative(bool display) {
return recordData()->setDisplayPlotSecondDerivative(display);
}
void setDisplayValueFirstDerivative(bool display);
void setDisplayPlotFirstDerivative(bool display);
void setDisplayValueSecondDerivative(bool display);
void setDisplayPlotSecondDerivative(bool display);

enum class DerivativeDisplayType : bool { Plot, Value };
int derivationOrderFromRelativeIndex(int relativeIndex,
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
D9E589AC
4867BCEC

0 comments on commit 464065f

Please sign in to comment.