mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-18 16:27:34 +01:00
[Apps/Calculation] Modified the calculationStore of additional results
-Additional results are now stored in smaller calculationStores Change-Id: I7d09bfb09e57cbb80e9385668adeb29a31398bc0
This commit is contained in:
@@ -11,6 +11,7 @@ namespace Calculation {
|
||||
|
||||
IllustratedListController::IllustratedListController(EditExpressionController * editExpressionController) :
|
||||
ListController(editExpressionController, this),
|
||||
m_calculationStore(m_calculationStoreBuffer, k_calculationStoreBufferSize),
|
||||
m_additionalCalculationCells{}
|
||||
{
|
||||
for (int i = 0; i < k_maxNumberOfAdditionalCalculations; i++) {
|
||||
|
||||
@@ -39,7 +39,10 @@ protected:
|
||||
private:
|
||||
int textAtIndex(char * buffer, size_t bufferSize, int index) override;
|
||||
virtual CodePoint expressionSymbol() const = 0;
|
||||
// Set the size of the buffer needed to store the additional calculation
|
||||
constexpr static int k_maxNumberOfAdditionalCalculations = 4;
|
||||
constexpr static int k_calculationStoreBufferSize = k_maxNumberOfAdditionalCalculations * (sizeof(Calculation) + Calculation::k_numberOfExpressions * Constant::MaxSerializedExpressionSize + sizeof(Calculation *));
|
||||
char m_calculationStoreBuffer[k_calculationStoreBufferSize];
|
||||
// Cells
|
||||
virtual HighlightCell * illustrationCell() = 0;
|
||||
ScrollableThreeExpressionsCell m_additionalCalculationCells[k_maxNumberOfAdditionalCalculations];
|
||||
|
||||
@@ -34,6 +34,10 @@ App::Descriptor * App::Snapshot::descriptor() {
|
||||
return &descriptor;
|
||||
}
|
||||
|
||||
App::Snapshot::Snapshot() : m_calculationStore(m_calculationBuffer, k_calculationBufferSize)
|
||||
{
|
||||
}
|
||||
|
||||
App::App(Snapshot * snapshot) :
|
||||
ExpressionFieldDelegateApp(snapshot, &m_editExpressionController),
|
||||
m_historyController(&m_editExpressionController, snapshot->calculationStore()),
|
||||
|
||||
@@ -19,12 +19,16 @@ public:
|
||||
};
|
||||
class Snapshot : public ::App::Snapshot {
|
||||
public:
|
||||
Snapshot();
|
||||
App * unpack(Container * container) override;
|
||||
void reset() override;
|
||||
Descriptor * descriptor() override;
|
||||
CalculationStore * calculationStore() { return &m_calculationStore; }
|
||||
private:
|
||||
CalculationStore m_calculationStore;
|
||||
// Set the size of the buffer needed to store the calculations
|
||||
static constexpr int k_calculationBufferSize = 10 * (sizeof(Calculation) + Calculation::k_numberOfExpressions * Constant::MaxSerializedExpressionSize + sizeof(Calculation *));
|
||||
char m_calculationBuffer[k_calculationBufferSize];
|
||||
};
|
||||
static App * app() {
|
||||
return static_cast<App *>(Container::activeApp());
|
||||
@@ -34,6 +38,7 @@ public:
|
||||
bool layoutFieldDidReceiveEvent(::LayoutField * layoutField, Ion::Events::Event event) override;
|
||||
// TextFieldDelegateApp
|
||||
bool isAcceptableExpression(const Poincare::Expression expression) override;
|
||||
|
||||
private:
|
||||
App(Snapshot * snapshot);
|
||||
HistoryController m_historyController;
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#include "../shared/text_field_delegate.h"
|
||||
#include "../shared/layout_field_delegate.h"
|
||||
#include "history_controller.h"
|
||||
#include "calculation_store.h"
|
||||
#include "selectable_table_view.h"
|
||||
|
||||
namespace Calculation {
|
||||
|
||||
Reference in New Issue
Block a user