mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[escher] Just replace the layout when clearing it in LayoutField
This commit is contained in:
@@ -13,7 +13,7 @@ namespace Calculation {
|
||||
EditExpressionController::ContentView::ContentView(Responder * parentResponder, TableView * subview, TextFieldDelegate * textFieldDelegate, LayoutFieldDelegate * layoutFieldDelegate) :
|
||||
View(),
|
||||
m_mainView(subview),
|
||||
m_expressionField(parentResponder, m_textBody, k_bufferLength, Poincare::HorizontalLayoutRef(), textFieldDelegate, layoutFieldDelegate)
|
||||
m_expressionField(parentResponder, m_textBody, k_bufferLength, textFieldDelegate, layoutFieldDelegate)
|
||||
{
|
||||
m_textBody[0] = 0;
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
class ExpressionField : public Responder, public View {
|
||||
public:
|
||||
ExpressionField(Responder * parentResponder, char * textBuffer, int textBufferLength, Poincare::LayoutRef layout, TextFieldDelegate * textFieldDelegate, LayoutFieldDelegate * layoutFieldDelegate);
|
||||
ExpressionField(Responder * parentResponder, char * textBuffer, int textBufferLength, TextFieldDelegate * textFieldDelegate, LayoutFieldDelegate * layoutFieldDelegate);
|
||||
|
||||
void setEditing(bool isEditing, bool reinitDraftBuffer = true);
|
||||
bool isEditing() const;
|
||||
|
||||
@@ -47,7 +47,6 @@ private:
|
||||
ExpressionField * expressionField() { return &m_expressionField; }
|
||||
private:
|
||||
static constexpr int k_bufferLength = TextField::maxBufferSize();
|
||||
Poincare::LayoutRef m_layout;
|
||||
char m_textBuffer[k_bufferLength];
|
||||
ExpressionField m_expressionField;
|
||||
};
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
|
||||
class LayoutField : public ScrollableView, public ScrollViewDataSource {
|
||||
public:
|
||||
LayoutField(Responder * parentResponder, Poincare::LayoutRef layoutR, LayoutFieldDelegate * delegate = nullptr) :
|
||||
LayoutField(Responder * parentResponder, LayoutFieldDelegate * delegate = nullptr) :
|
||||
ScrollableView(parentResponder, &m_contentView, this),
|
||||
m_contentView(layoutR),
|
||||
m_contentView(),
|
||||
m_delegate(delegate)
|
||||
{}
|
||||
void setDelegate(LayoutFieldDelegate * delegate) { m_delegate = delegate; }
|
||||
@@ -65,15 +65,7 @@ private:
|
||||
|
||||
class ContentView : public View {
|
||||
public:
|
||||
ContentView(Poincare::LayoutRef layoutR) :
|
||||
m_cursor(layoutR, Poincare::LayoutCursor::Position::Right),
|
||||
m_expressionView(0.0f, 0.5f, KDColorBlack, KDColorWhite),
|
||||
m_cursorView(),
|
||||
m_isEditing(false)
|
||||
{
|
||||
m_expressionView.setLayoutRef(layoutR);
|
||||
}
|
||||
|
||||
ContentView();
|
||||
bool isEditing() const { return m_isEditing; }
|
||||
void setEditing(bool isEditing) {
|
||||
m_isEditing = isEditing;
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
#include <poincare/preferences.h>
|
||||
#include <assert.h>
|
||||
|
||||
ExpressionField::ExpressionField(Responder * parentResponder, char * textBuffer, int textBufferLength, Poincare::LayoutRef layout, TextFieldDelegate * textFieldDelegate, LayoutFieldDelegate * layoutFieldDelegate) :
|
||||
ExpressionField::ExpressionField(Responder * parentResponder, char * textBuffer, int textBufferLength, TextFieldDelegate * textFieldDelegate, LayoutFieldDelegate * layoutFieldDelegate) :
|
||||
Responder(parentResponder),
|
||||
View(),
|
||||
m_textField(parentResponder, textBuffer, textBuffer, textBufferLength, textFieldDelegate, false, KDText::FontSize::Large, 0.0f, 0.5f, KDColorBlack, KDColorWhite),
|
||||
m_layoutField(parentResponder, layout, layoutFieldDelegate),
|
||||
m_layoutField(parentResponder, layoutFieldDelegate),
|
||||
m_textBuffer(textBuffer),
|
||||
m_textBufferLength(textBufferLength)
|
||||
{
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
#include <escher/input_view_controller.h>
|
||||
#include <escher/app.h>
|
||||
#include <escher/palette.h>
|
||||
#include <poincare/horizontal_layout_node.h>
|
||||
#include <assert.h>
|
||||
|
||||
InputViewController::ExpressionFieldController::ExpressionFieldController(Responder * parentResponder, TextFieldDelegate * textFieldDelegate, LayoutFieldDelegate * layoutFieldDelegate) :
|
||||
ViewController(parentResponder),
|
||||
m_layout(Poincare::HorizontalLayoutRef()),
|
||||
m_expressionField(this, m_textBuffer, k_bufferLength, m_layout, textFieldDelegate, layoutFieldDelegate)
|
||||
m_expressionField(this, m_textBuffer, k_bufferLength, textFieldDelegate, layoutFieldDelegate)
|
||||
{
|
||||
m_textBuffer[0] = 0;
|
||||
}
|
||||
|
||||
@@ -3,11 +3,21 @@
|
||||
#include <escher/clipboard.h>
|
||||
#include <escher/text_field.h>
|
||||
#include <poincare/expression.h>
|
||||
#include <poincare/horizontal_layout_node.h>
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
|
||||
using namespace Poincare;
|
||||
|
||||
LayoutField::ContentView::ContentView() :
|
||||
m_cursor(),
|
||||
m_expressionView(0.0f, 0.5f, KDColorBlack, KDColorWhite),
|
||||
m_cursorView(),
|
||||
m_isEditing(false)
|
||||
{
|
||||
clearLayout();
|
||||
}
|
||||
|
||||
void LayoutField::ContentView::layoutCursorSubview() {
|
||||
if (!m_isEditing) {
|
||||
m_cursorView.setFrame(KDRectZero);
|
||||
|
||||
Reference in New Issue
Block a user