[apps/shared] SumGraphController keeps 2 text buffers for its editable

zone (to be able to abort editing and find back the previous text)
This commit is contained in:
Émilie Feral
2019-08-12 11:53:13 +02:00
parent fc84b15214
commit a2059432bd
2 changed files with 7 additions and 2 deletions

View File

@@ -157,9 +157,11 @@ SumGraphController::LegendView::LegendView(SumGraphController * controller, Inpu
m_sum(0.0f, 0.5f, KDColorBlack, Palette::GreyMiddle),
m_sumLayout(),
m_legend(k_font, I18n::Message::Default, 0.0f, 0.5f, KDColorBlack, Palette::GreyMiddle),
m_editableZone(controller, nullptr, TextField::maxBufferSize(), TextField::maxBufferSize(), inputEventHandlerDelegate, controller, k_font, 0.0f, 0.5f, KDColorBlack, Palette::GreyMiddle),
m_editableZone(controller, m_textBuffer, k_editableZoneBufferSize, TextField::maxBufferSize(), inputEventHandlerDelegate, controller, k_font, 0.0f, 0.5f, KDColorBlack, Palette::GreyMiddle),
m_sumSymbol(sumSymbol)
{}
{
m_textBuffer[0] = 0;
}
void SumGraphController::LegendView::drawRect(KDContext * ctx, KDRect rect) const {
ctx->fillRect(bounds(), Palette::GreyMiddle);

View File

@@ -2,6 +2,7 @@
#define SHARED_SUM_GRAPH_CONTROLLER_H
#include <escher.h>
#include <poincare/print_float.h>
#include "function_graph_view.h"
#include "vertical_cursor_view.h"
#include "simple_interactive_curve_view_controller.h"
@@ -56,6 +57,7 @@ private:
void setEditableZone(double d);
void setSumSymbol(Step step, double start, double end, double result, Poincare::Layout functionLayout);
private:
constexpr static KDCoordinate k_editableZoneBufferSize = Poincare::PrintFloat::k_maxFloatBufferSize;
constexpr static KDCoordinate k_legendHeight = 35;
constexpr static const KDFont * k_font = KDFont::SmallFont;
static KDCoordinate editableZoneWidth() { return 12*k_font->glyphSize().width(); }
@@ -70,6 +72,7 @@ private:
Poincare::Layout m_sumLayout;
MessageTextView m_legend;
TextField m_editableZone;
char m_textBuffer[k_editableZoneBufferSize];
CodePoint m_sumSymbol;
};
FunctionGraphView * m_graphView;