[poincare] Clean Expression and Layout builders

Before: Opposite(Opposite(Rational(1))) misleadingly created the
expression "-1"; now, Opposite::Builder(Opposite::Builder(Rational(1)))
creates "--1"
This commit is contained in:
Émilie Feral
2019-01-28 17:44:08 +01:00
committed by LeaNumworks
parent b3d15d7e7f
commit ac6f23684d
113 changed files with 779 additions and 743 deletions

View File

@@ -76,20 +76,20 @@ void SequenceToolbox::buildExtraCellsLayouts(const char * sequenceName, int recu
const char * otherSequenceName = SequenceStore::k_sequenceNames[1-sequenceIndex];
for (int j = 0; j < recurrenceDepth; j++) {
const char * indice = j == 0 ? "n" : "n+1";
m_addedCellLayout[j] = HorizontalLayout(
m_addedCellLayout[j] = HorizontalLayout::Builder(
CharLayout(sequenceName[0], KDFont::LargeFont),
VerticalOffsetLayout(LayoutHelper::String(indice, strlen(indice), KDFont::LargeFont), VerticalOffsetLayoutNode::Type::Subscript)
VerticalOffsetLayout::Builder(LayoutHelper::String(indice, strlen(indice), KDFont::LargeFont), VerticalOffsetLayoutNode::Type::Subscript)
);
m_addedCellLayout[j+recurrenceDepth] = HorizontalLayout(
m_addedCellLayout[j+recurrenceDepth] = HorizontalLayout::Builder(
CharLayout(otherSequenceName[0], KDFont::LargeFont),
VerticalOffsetLayout(LayoutHelper::String(indice, strlen(indice), KDFont::LargeFont), VerticalOffsetLayoutNode::Type::Subscript)
VerticalOffsetLayout::Builder(LayoutHelper::String(indice, strlen(indice), KDFont::LargeFont), VerticalOffsetLayoutNode::Type::Subscript)
);
}
if (recurrenceDepth < 2) {
const char * indice = recurrenceDepth == 0 ? "n" : (recurrenceDepth == 1 ? "n+1" : "n+2");
m_addedCellLayout[2*recurrenceDepth] = HorizontalLayout(
m_addedCellLayout[2*recurrenceDepth] = HorizontalLayout::Builder(
CharLayout(otherSequenceName[0], KDFont::LargeFont),
VerticalOffsetLayout(LayoutHelper::String(indice, strlen(indice), KDFont::LargeFont), VerticalOffsetLayoutNode::Type::Subscript)
VerticalOffsetLayout::Builder(LayoutHelper::String(indice, strlen(indice), KDFont::LargeFont), VerticalOffsetLayoutNode::Type::Subscript)
);
}
}