mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-18 21:30:38 +01:00
Merge branch 'upsilon-dev-latex'
This commit is contained in:
@@ -23,6 +23,7 @@ class LayoutCursor final {
|
||||
friend class MatrixLayoutNode;
|
||||
friend class NthRootLayoutNode;
|
||||
friend class SequenceLayoutNode;
|
||||
friend class VectorLayoutNode;
|
||||
friend class VerticalOffsetLayoutNode;
|
||||
public:
|
||||
constexpr static KDCoordinate k_cursorWidth = 1;
|
||||
|
||||
@@ -40,6 +40,7 @@ public:
|
||||
RightParenthesisLayout,
|
||||
RightSquareBracketLayout,
|
||||
SumLayout,
|
||||
VectorLayout,
|
||||
VectorNormLayout,
|
||||
VerticalOffsetLayout
|
||||
};
|
||||
|
||||
53
poincare/include/poincare/vector_layout.h
Normal file
53
poincare/include/poincare/vector_layout.h
Normal file
@@ -0,0 +1,53 @@
|
||||
#ifndef POINCARE_VECTOR_LAYOUT_NODE_H
|
||||
#define POINCARE_VECTOR_LAYOUT_NODE_H
|
||||
|
||||
#include <poincare/layout.h>
|
||||
#include <poincare/layout_cursor.h>
|
||||
#include <poincare/serialization_helper.h>
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
class VectorLayoutNode final : public LayoutNode {
|
||||
public:
|
||||
// Layout
|
||||
Type type() const override { return Type::VectorLayout; }
|
||||
|
||||
// SerializationHelperInterface
|
||||
int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override {
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, "vector", true, 0);
|
||||
}
|
||||
|
||||
virtual void moveCursorLeft(LayoutCursor * cursor, bool * shouldRecomputeLayout, bool forSelection = false);
|
||||
virtual void moveCursorRight(LayoutCursor * cursor, bool * shouldRecomputeLayout, bool forSelection = false);
|
||||
|
||||
// TreeNode
|
||||
size_t size() const override { return sizeof(VectorLayoutNode); }
|
||||
int numberOfChildren() const override { return 1; }
|
||||
#if POINCARE_TREE_LOG
|
||||
void logNodeName(std::ostream & stream) const override {
|
||||
stream << "VectorLayout";
|
||||
}
|
||||
#endif
|
||||
|
||||
constexpr static KDCoordinate k_arrowWidth = 5;
|
||||
constexpr static KDCoordinate k_arrowHeight = 9;
|
||||
protected:
|
||||
virtual KDSize computeSize();
|
||||
virtual KDCoordinate computeBaseline();
|
||||
virtual KDPoint positionOfChild(LayoutNode * child);
|
||||
private:
|
||||
virtual void render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor, Layout * selectionStart = nullptr, Layout * selectionEnd = nullptr, KDColor selectionColor = KDColorRed);
|
||||
constexpr static KDCoordinate k_sideMargin = 2;
|
||||
constexpr static KDCoordinate k_topMargin = 1;
|
||||
constexpr static KDCoordinate k_arrowLineHeight = 1; // k_arrowHeight - k_arrowLineHeight must be even
|
||||
};
|
||||
|
||||
class VectorLayout final : public Layout {
|
||||
public:
|
||||
static VectorLayout Builder(Layout child) { return TreeHandle::FixedArityBuilder<VectorLayout, VectorLayoutNode>({child}); }
|
||||
VectorLayout() = delete;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <poincare/right_square_bracket_layout.h>
|
||||
#include <poincare/square_bracket_layout.h>
|
||||
#include <poincare/sum_layout.h>
|
||||
#include <poincare/vector_layout.h>
|
||||
#include <poincare/vector_norm_layout.h>
|
||||
#include <poincare/vertical_offset_layout.h>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user