mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-18 16:27:34 +01:00
[apps/calculation] Factorize some code
This commit is contained in:
@@ -41,8 +41,7 @@ Calculation * Calculation::next() const {
|
||||
void Calculation::tidy() {
|
||||
/* Reset height memoization (the complex format could have changed when
|
||||
* re-entering Calculation app which would impact the heights). */
|
||||
m_height = -1;
|
||||
m_expandedHeight = -1;
|
||||
resetHeightMemoization();
|
||||
}
|
||||
|
||||
const char * Calculation::approximateOutputText(NumberOfSignificantDigits numberOfSignificantDigits) const {
|
||||
@@ -193,9 +192,9 @@ Calculation::DisplayOutput Calculation::displayOutput(Context * context) {
|
||||
void Calculation::forceDisplayOutput(DisplayOutput d) {
|
||||
m_displayOutput = d;
|
||||
// Reset heights memoization as it might have changed when we modify the display output
|
||||
m_height = -1;
|
||||
m_expandedHeight = -1;
|
||||
resetHeightMemoization();
|
||||
}
|
||||
|
||||
bool Calculation::shouldOnlyDisplayExactOutput() {
|
||||
/* If the input is a "store in a function", do not display the approximate
|
||||
* result. This prevents x->f(x) from displaying x = undef. */
|
||||
@@ -290,4 +289,9 @@ Calculation::AdditionalInformationType Calculation::additionalInformationType(Co
|
||||
return AdditionalInformationType::None;
|
||||
}
|
||||
|
||||
void Calculation::resetHeightMemoization() {
|
||||
m_height = -1;
|
||||
m_expandedHeight = -1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -99,6 +99,7 @@ private:
|
||||
static constexpr int k_numberOfExpressions = 4;
|
||||
static constexpr KDCoordinate k_heightComputationFailureHeight = 50;
|
||||
static constexpr const char * k_maximalIntegerWithAdditionalInformation = "10000000000000000";
|
||||
void resetHeightMemoization();
|
||||
/* Buffers holding text expressions have to be longer than the text written
|
||||
* by user (of maximum length TextField::maxBufferSize()) because when we
|
||||
* print an expression we add omitted signs (multiplications, parenthesis...) */
|
||||
|
||||
Reference in New Issue
Block a user