[shared] Fix SumGraphController

This commit is contained in:
Émilie Feral
2018-09-06 14:05:43 +02:00
parent 5cc3930a44
commit eeaea93468
4 changed files with 6 additions and 6 deletions

View File

@@ -36,7 +36,7 @@ double IntegralGraphController::cursorNextStep(double x, int direction) {
return (direction > 0 ? x + m_graphRange->xGridUnit()/k_numberOfCursorStepsInGradUnit : x - m_graphRange->xGridUnit()/k_numberOfCursorStepsInGradUnit);
}
ExpressionLayout * IntegralGraphController::createFunctionLayout(const char * functionName) {
LayoutReference IntegralGraphController::createFunctionLayout(const char * functionName) {
char buffer[7] = "0(x)dx";
buffer[0] = functionName[0];
return LayoutHelper::String(buffer, strlen(buffer), KDText::FontSize::Small);

View File

@@ -14,7 +14,7 @@ public:
private:
I18n::Message legendMessageAtStep(Step step) override;
double cursorNextStep(double position, int direction) override;
Poincare::ExpressionLayout * createFunctionLayout(const char * functionName) override;
Poincare::LayoutReference createFunctionLayout(const char * functionName) override;
};
}

View File

@@ -229,8 +229,8 @@ void SumGraphController::LegendView::setEditableZone(double d) {
m_editableZone.setText(buffer);
}
void SumGraphController::LegendView::setSumSymbol(Step step, double start, double end, double result, ExpressionLayout * functionLayout) {
assert(step == Step::Result || functionLayout == nullptr);
void SumGraphController::LegendView::setSumSymbol(Step step, double start, double end, double result, LayoutReference functionLayout) {
assert(step == Step::Result || functionLayout.isUninitialized());
const char sigma[] = {' ', m_sumSymbol};
if (step == Step::FirstParameter) {
m_sumLayoutRef = LayoutHelper::String(sigma, sizeof(sigma));

View File

@@ -39,7 +39,7 @@ private:
constexpr static float k_cursorBottomMarginRatio = 0.28f; // (cursorHeight/2+bannerHeigh)/graphViewHeight
virtual I18n::Message legendMessageAtStep(Step step) = 0;
virtual double cursorNextStep(double position, int direction) = 0;
virtual Poincare::ExpressionLayout * createFunctionLayout(const char * functionName) = 0;
virtual Poincare::LayoutReference createFunctionLayout(const char * functionName) = 0;
Shared::InteractiveCurveViewRange * interactiveCurveViewRange() override { return m_graphRange; }
Shared::CurveView * curveView() override { return m_graphView; }
TextFieldDelegateApp * textFieldDelegateApp() override {
@@ -58,7 +58,7 @@ private:
void drawRect(KDContext * ctx, KDRect rect) const override;
void setLegendMessage(I18n::Message message, Step step);
void setEditableZone(double d);
void setSumSymbol(Step step, double start = NAN, double end = NAN, double result = NAN, Poincare::ExpressionLayout * sequenceName = nullptr);
void setSumSymbol(Step step, double start = NAN, double end = NAN, double result = NAN, Poincare::LayoutReference sequenceName = Poincare::LayoutReference());
private:
constexpr static KDCoordinate k_legendHeight = 35;
constexpr static KDCoordinate k_editableZoneWidth = 12*KDText::charSize(KDText::FontSize::Small).width();