mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[calculation] Calculation: discard Calculation::toggleDisplayExact (this
feature will be developed later)
This commit is contained in:
@@ -20,8 +20,7 @@ Calculation::Calculation() :
|
||||
m_approximateOutputText(),
|
||||
m_height(-1),
|
||||
m_selectedHeight(-1),
|
||||
m_equalSign(EqualSign::Unknown),
|
||||
m_toggleDisplayExact(false)
|
||||
m_equalSign(EqualSign::Unknown)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -66,10 +65,10 @@ KDCoordinate Calculation::height(Context * context, bool isSelected) {
|
||||
DisplayOutput display = displayOutput(context);
|
||||
Layout inputLayout = createInputLayout();
|
||||
KDCoordinate inputHeight = inputLayout.layoutSize().height();
|
||||
if (display == DisplayOutput::ExactOnly || (!isSelected && display == DisplayOutput::ExactAndApproximateToggle && m_toggleDisplayExact)) {
|
||||
if (display == DisplayOutput::ExactOnly) {
|
||||
KDCoordinate exactOutputHeight = createExactOutputLayout().layoutSize().height();
|
||||
*memoizedHeight = inputHeight+exactOutputHeight;
|
||||
} else if (display == DisplayOutput::ApproximateOnly || (!isSelected && display == DisplayOutput::ExactAndApproximateToggle && !m_toggleDisplayExact)) {
|
||||
} else if (display == DisplayOutput::ApproximateOnly || (!isSelected && display == DisplayOutput::ExactAndApproximateToggle)) {
|
||||
KDCoordinate approximateOutputHeight = createApproximateOutputLayout(context).layoutSize().height();
|
||||
*memoizedHeight = inputHeight+approximateOutputHeight;
|
||||
} else {
|
||||
|
||||
@@ -43,8 +43,6 @@ public:
|
||||
bool isEmpty();
|
||||
void tidy();
|
||||
DisplayOutput displayOutput(Poincare::Context * context);
|
||||
bool toggleDisplayExact() const { return m_toggleDisplayExact; }
|
||||
void setToggleDisplayExact(bool displayExact) { m_toggleDisplayExact = displayExact; }
|
||||
bool shouldOnlyDisplayExactOutput();
|
||||
EqualSign exactAndApproximateDisplayedOutputsAreEqual(Poincare::Context * context);
|
||||
private:
|
||||
@@ -58,7 +56,6 @@ private:
|
||||
KDCoordinate m_height;
|
||||
KDCoordinate m_selectedHeight;
|
||||
EqualSign m_equalSign;
|
||||
bool m_toggleDisplayExact;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -80,10 +80,10 @@ void HistoryViewCell::cellDidSelectSubview(HistoryViewCellDataSource::SubviewTyp
|
||||
if (type == HistoryViewCellDataSource::SubviewType::Output) {
|
||||
/* Select the right output according to the calculation display output. This
|
||||
* will reload the scroll to display the selected output. */
|
||||
if (display == Calculation::DisplayOutput::ExactAndApproximate || (display == Calculation::DisplayOutput::ExactAndApproximateToggle && m_calculation.toggleDisplayExact())) {
|
||||
if (display == Calculation::DisplayOutput::ExactAndApproximate) {
|
||||
m_scrollableOutputView.setSelectedSubviewPosition(Shared::ScrollableExactApproximateExpressionsView::SubviewPosition::Left);
|
||||
} else {
|
||||
assert(display == Calculation::DisplayOutput::ApproximateOnly || (display == Calculation::DisplayOutput::ExactAndApproximateToggle && !m_calculation.toggleDisplayExact()) || display == Calculation::DisplayOutput::ExactOnly);
|
||||
assert(display == Calculation::DisplayOutput::ApproximateOnly || (display == Calculation::DisplayOutput::ExactAndApproximateToggle) || display == Calculation::DisplayOutput::ExactOnly);
|
||||
m_scrollableOutputView.setSelectedSubviewPosition(Shared::ScrollableExactApproximateExpressionsView::SubviewPosition::Right);
|
||||
}
|
||||
}
|
||||
@@ -143,7 +143,7 @@ void HistoryViewCell::setCalculation(Calculation * calculation, bool isSelected)
|
||||
* layout, calling to layoutSubviews() would fail. */
|
||||
Poincare::Layout leftOutputLayout = Poincare::Layout();
|
||||
Poincare::Layout rightOutputLayout;
|
||||
if (display == Calculation::DisplayOutput::ExactOnly || (display == Calculation::DisplayOutput::ExactAndApproximateToggle && !isSelected && calculation->toggleDisplayExact())) {
|
||||
if (display == Calculation::DisplayOutput::ExactOnly) {
|
||||
rightOutputLayout = calculation->createExactOutputLayout();
|
||||
} else {
|
||||
rightOutputLayout = calculation->createApproximateOutputLayout(calculationApp->localContext());
|
||||
|
||||
Reference in New Issue
Block a user