[shared] Rename methods

This commit is contained in:
Gabriel Ozouf
2020-12-03 16:42:02 +01:00
committed by LeaNumworks
parent 1f8ab10ae5
commit ffebd2e987
8 changed files with 11 additions and 11 deletions

View File

@@ -20,8 +20,8 @@ public:
// InteractiveCurveViewRangeDelegate
bool defaultRangeIsNormalized() const override { return functionStore()->displaysNonCartesianFunctions(); }
void interestingRanges(InteractiveCurveViewRange * range) override { InterestingRangesHelper(range, context(), functionStore(), Ratio()); }
float addMargin(float x, float range, bool isVertical, bool isMin) override { return AddMarginHelper(x, range, isVertical, isMin, k_topMargin, k_bottomMargin, k_leftMargin, k_rightMargin); }
void interestingRanges(InteractiveCurveViewRange * range) override { DefaultInterestingRanges(range, context(), functionStore(), Ratio()); }
float addMargin(float x, float range, bool isVertical, bool isMin) override { return DefaultAddMargin(x, range, isVertical, isMin, k_topMargin, k_bottomMargin, k_leftMargin, k_rightMargin); }
void updateZoomButtons() override {}
private:

View File

@@ -10,7 +10,7 @@ public:
CurveViewRange(Shared::InteractiveCurveViewRangeDelegate * delegate = nullptr);
void normalize(bool forceChangeY = false) override;
private:
virtual bool defaultRangeCriteria() const override { return false; }
virtual bool hasDefaultRange() const override { return false; }
constexpr static float k_displayLeftMarginRatio = 0.1f;
};

View File

@@ -155,7 +155,7 @@ int FunctionGraphController::numberOfCurves() const {
void FunctionGraphController::interestingRanges(InteractiveCurveViewRange * range) {
float ratio = InteractiveCurveViewRange::NormalYXRatio() / (1 + cursorTopMarginRatio() + cursorBottomMarginRatio());
InterestingRangesHelper(range, textFieldDelegateApp()->localContext(), functionStore(), ratio);
DefaultInterestingRanges(range, textFieldDelegateApp()->localContext(), functionStore(), ratio);
}
}

View File

@@ -41,7 +41,7 @@ InteractiveCurveViewController::InteractiveCurveViewController(Responder * paren
}
float InteractiveCurveViewController::addMargin(float y, float range, bool isVertical, bool isMin) {
return AddMarginHelper(y, range, isVertical, isMin, cursorTopMarginRatio(), cursorBottomMarginRatio(), cursorLeftMarginRatio(), cursorRightMarginRatio());
return DefaultAddMargin(y, range, isVertical, isMin, cursorTopMarginRatio(), cursorBottomMarginRatio(), cursorLeftMarginRatio(), cursorRightMarginRatio());
}
void InteractiveCurveViewController::updateZoomButtons() {

View File

@@ -183,7 +183,7 @@ void InteractiveCurveViewRange::setDefault() {
m_delegate->interestingRanges(this);
/* If the horizontal bounds are integers, they are preset values and should
* not be changed. */
bool isDefaultRange = defaultRangeCriteria();
bool isDefaultRange = hasDefaultRange();
// Add margins, then round limits.
float newXMin = xMin(), newXMax = xMax();

View File

@@ -78,7 +78,7 @@ protected:
* 2 * 1 unit -> 10.0mm
* So normalizedYHalfRange = 43.2mm * 170/240 * 1 unit / 10.0mm */
constexpr static float NormalizedYHalfRange(float unit) { return 3.06f * unit; }
virtual bool defaultRangeCriteria() const { return (xMin() == std::round(xMin())) && (xMax() == std::round(xMax())); }
virtual bool hasDefaultRange() const { return (xMin() == std::round(xMin())) && (xMax() == std::round(xMax())); }
InteractiveCurveViewRangeDelegate * m_delegate;
private:

View File

@@ -5,7 +5,7 @@
namespace Shared {
void InteractiveCurveViewRangeDelegate::InterestingRangesHelper(InteractiveCurveViewRange * range, Poincare::Context * context, FunctionStore * functionStore, float targetRatio) {
void InteractiveCurveViewRangeDelegate::DefaultInterestingRanges(InteractiveCurveViewRange * range, Poincare::Context * context, FunctionStore * functionStore, float targetRatio) {
constexpr int maxLength = 10;
float xMins[maxLength], xMaxs[maxLength], yMins[maxLength], yMaxs[maxLength];
int length = functionStore->numberOfActiveFunctions();
@@ -26,7 +26,7 @@ void InteractiveCurveViewRangeDelegate::InterestingRangesHelper(InteractiveCurve
range->setYMax(yMax);
}
float InteractiveCurveViewRangeDelegate::AddMarginHelper(float x, float range, bool isVertical, bool isMin, float top, float bottom, float left, float right) {
float InteractiveCurveViewRangeDelegate::DefaultAddMargin(float x, float range, bool isVertical, bool isMin, float top, float bottom, float left, float right) {
/* The provided min or max range limit y is altered by adding a margin.
* In pixels, the view's height occupied by the vertical range is equal to
* viewHeight - topMargin - bottomMargin.

View File

@@ -13,8 +13,8 @@ class InteractiveCurveViewRangeDelegate {
public:
static constexpr float k_defaultXHalfRange = 10.0f;
static void InterestingRangesHelper(InteractiveCurveViewRange * range, Poincare::Context * context, FunctionStore * functionStore, float targetRatio);
static float AddMarginHelper(float x, float range, bool isVertical, bool isMin, float top, float bottom, float left, float right);
static void DefaultInterestingRanges(InteractiveCurveViewRange * range, Poincare::Context * context, FunctionStore * functionStore, float targetRatio);
static float DefaultAddMargin(float x, float range, bool isVertical, bool isMin, float top, float bottom, float left, float right);
virtual float interestingXMin() const { return -k_defaultXHalfRange; }
virtual bool defaultRangeIsNormalized() const { return false; }