mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[VariableBoxController] Changed the way sequences appear
Change-Id: I45a1cb01ab9c5aefd298c40050e69850a4cc5c71
This commit is contained in:
committed by
Émilie Feral
parent
1d71a14d2c
commit
fa0e8de0a9
@@ -4,12 +4,15 @@
|
||||
#include <escher/metric.h>
|
||||
#include <ion/unicode/utf8_decoder.h>
|
||||
#include <poincare/exception_checkpoint.h>
|
||||
#include <poincare/expression.h>
|
||||
#include <poincare/layout_helper.h>
|
||||
#include <poincare/matrix_layout.h>
|
||||
#include <poincare/preferences.h>
|
||||
#include <assert.h>
|
||||
#include <algorithm>
|
||||
#include <apps/shared/sequence.h>
|
||||
#include <apps/apps_container.h>
|
||||
#include "global_preferences.h"
|
||||
|
||||
using namespace Poincare;
|
||||
using namespace Shared;
|
||||
@@ -104,6 +107,7 @@ void MathVariableBoxController::willDisplayCellForIndex(HighlightCell * cell, in
|
||||
Storage::Record record = recordAtIndex(index);
|
||||
char symbolName[Shared::Function::k_maxNameWithArgumentSize];
|
||||
size_t symbolLength = 0;
|
||||
Layout symbolLayout;
|
||||
if (m_currentPage == Page::Expression) {
|
||||
static_assert(Shared::Function::k_maxNameWithArgumentSize > Poincare::SymbolAbstract::k_maxNameSize, "Forgot argument's size?");
|
||||
symbolLength = SymbolAbstract::TruncateExtension(symbolName, record.fullName(), SymbolAbstract::k_maxNameSize);
|
||||
@@ -120,8 +124,12 @@ void MathVariableBoxController::willDisplayCellForIndex(HighlightCell * cell, in
|
||||
symbolName,
|
||||
Shared::Sequence::k_maxNameWithArgumentSize
|
||||
);
|
||||
Expression symbolExpression = Expression::ParseAndSimplify(symbolName, AppsContainer::sharedAppsContainer()->globalContext(), Poincare::Preferences::sharedPreferences()->complexFormat(), Poincare::Preferences::sharedPreferences()->angleUnit(), GlobalPreferences::sharedGlobalPreferences()->unitFormat());
|
||||
symbolLayout = symbolExpression.createLayout(Poincare::Preferences::sharedPreferences()->displayMode(), Poincare::Preferences::sharedPreferences()->numberOfSignificantDigits());
|
||||
}
|
||||
if (symbolLayout.isUninitialized()) {
|
||||
symbolLayout = LayoutHelper::String(symbolName, symbolLength);
|
||||
}
|
||||
Layout symbolLayout = LayoutHelper::String(symbolName, symbolLength);
|
||||
myCell->setLayout(symbolLayout);
|
||||
myCell->setAccessoryLayout(expressionLayoutForRecord(record, index));
|
||||
myCell->reloadScroll();
|
||||
@@ -201,7 +209,7 @@ bool MathVariableBoxController::selectLeaf(int selectedRow) {
|
||||
char nameToHandle[nameToHandleMaxSize];
|
||||
size_t nameLength = SymbolAbstract::TruncateExtension(nameToHandle, record.fullName(), nameToHandleMaxSize);
|
||||
|
||||
if (m_currentPage == Page::Function) {
|
||||
if (m_currentPage == Page::Function || m_currentPage == Page::Sequence) {
|
||||
// Add parentheses to a function name
|
||||
assert(nameLength < nameToHandleMaxSize);
|
||||
nameLength += UTF8Decoder::CodePointToChars('(', nameToHandle+nameLength, nameToHandleMaxSize - nameLength);
|
||||
|
||||
Reference in New Issue
Block a user