Commit Graph

752 Commits

Author SHA1 Message Date
Hugo Saint-Vignes
e09bd0a18c [poincare] Factorize reduce and removeUnit methods 2020-12-22 17:32:40 +01:00
Hugo Saint-Vignes
6ba88921b9 [apps/calculation] Add Unknown NullStatus Todo
Change-Id: Ic67eca0b95350c72167057c40f18ae969793ef18
2020-11-04 15:58:34 +01:00
Hugo Saint-Vignes
4a3f749cc6 [poincare] Add NullStatus for expressions
Change-Id: Ibaba72e3e3589ba259c7b22d402e2b27937f27c1
2020-11-04 15:58:34 +01:00
Hugo Saint-Vignes
98499f6c9f [poincare] Rename isRationalZero to isNumberZero
Change-Id: I554dd5e9b9ab3af4364ca23cde590f9e0a458ef8
2020-11-04 15:58:33 +01:00
Roberta Rabotti
8a5ed92a56 [IT] Translation changes: Prime factors 2020-11-04 15:33:04 +01:00
Serenela Moreira
59b2a64830 [pt] corrected prime factors
And improved translation of another detail
2020-11-04 15:33:04 +01:00
Martijn Oost
388d1a785e [apps/calculation] Update NL translation
Change NL definition in additional results
2020-11-04 15:33:03 +01:00
Gabriel Ozouf
4ba0603e0c [apps/calculation] Duplicate additional result
Fix duplicate additional results on units by comparing serialization.

Change-Id: Ia360ae7846716a801253b60fcf000240834528bc
2020-11-04 15:33:01 +01:00
Gabriel Ozouf
b8544e3708 [apps/shared/text_field_delegate_app] Refuse Equal
The Equal sign now triggers a syntax error in all apps but Solver. This
make its behaviour symmetrical with that of < and >.

Change-Id: Ia886c547a315d5627a69f3f2acac2cbce0e202c2
2020-11-04 15:32:58 +01:00
Arthur Camouseigt
3dca515441 [VariableBox] Added sequences to the variable box
It is now possible to call the value of a defined sequence anywhere.

Change-Id: I1990e93c50f9add175b7ea274e07004ba63289e5
2020-11-04 15:32:58 +01:00
Martijn Oost
338968a493 improved translations in toolbox and the calculation, python and functions app 2020-11-04 15:30:53 +01:00
Gabriel Ozouf
504223612d [apps/apps_container] Add timer to circuit breaker
poincareCircuitBreaker requires the Back key to be pressed for at least
50 ms before interrupting a computation.
This is effectively invisible for the user, but fixes a bug in
Calculation :
  - When leaving the additional results for a result using units by
    pressing the Back key, a reduction preceding a call to removeUnits
    would be interrupted, causing an undefined behaviour.

Change-Id: Iec667ae964f190de2171850cc22e1726959e6cb5
2020-11-04 15:11:45 +01:00
Gabriel Ozouf
860ce558c2 [poincare/unit] Remove some additional results
Imperial additional results now only appear when the selected unit
system is Imperial.

Change-Id: Icc314d0148810bea67e4d729179393f1fceaf214
2020-11-04 15:11:45 +01:00
Gabriel Ozouf
52dcd8e749 [poincare/unit] Restructure Unit
1. Information about a unit's dimension now uses inheritance.
   _m is an instance of DistanceAlias, which is derived from Alias.
   A UnitNode now keeps a pointer to an Alias and one to a Prefix.
   All aliases are still defined as constexpr.
   This cleans up a lot of the code used namely for computing the
   additional outputs in Calculation.

2. Instead of being defined with a string, each unit is described by its
   ratio with the base SI unit (ex: _L is 0.001 instead of "0.001_m^3").
   This greatly speeds up the calculations using units, as the algorithm
   to find the best unit used to parse the definition.

Change-Id: I4d6ed6ad4cb967026a3f01a335aec270066e2b9f
2020-11-04 15:11:45 +01:00
Gabriel Ozouf
fad375c11c [poincare] Add unitFormat to ReductionContext
Change-Id: I1d3fcd2f47c973c041e1be84e9a902dd58de3562
2020-11-04 15:11:44 +01:00
Gabriel Ozouf
6c676782aa [apps/calculation] New additional results on units
The additional results on units now include conversions into both unit
systems (metric and imperial).

Change-Id: Ie0f12eb3735e775560b66c2cbd78bc9a659145bb
2020-11-04 15:11:44 +01:00
Gabriel Ozouf
9e3470436a [apps/calculation] Move input memoization
Calculation's input is now only saved and restored when the app truly
closes or opens, instead of whenever the EditExpressionController enters
or leaves the responder chain (which also happens when the user switches
to the history or the toolbox, or triggers a syntax error).

Change-Id: I8404f1bc5619bcbc03272b406962d284fe25f7e2
2020-11-04 15:07:20 +01:00
Hugo Saint-Vignes
d027d99597 [apps/calculation] Reset highlighted cells in additional results
Change-Id: I517e7d3dd025413f405fed605631dad830540e76
2020-11-04 15:07:20 +01:00
Hugo Saint-Vignes
e27c668c40 [apps,escher,kandinsky,poincare,python] Replace every "grey" with "gray"
Change-Id: I60a232849dce90f70e6977b6024d6e9b1ce1b731
2020-11-04 15:07:20 +01:00
Hugo Saint-Vignes
4331686818 [apps/toolbox] Update toolbox and additional result text for matrices
Change-Id: I59e1561dcb97c75e57f0c24cfe1953ff594daf92
2020-11-04 15:07:20 +01:00
Hugo Saint-Vignes
3bfc0c83d8 [poincare] Factorize Echelon Form classes
Change-Id: I7ec7290a4d94b9bd1224ad4c53be8b4662bd32d5
2020-11-04 15:07:20 +01:00
Hugo Saint-Vignes
f00c135b69 [apps/calculation] Add additional outputs for matrix
Change-Id: Ia4b285eb0f28eaed838d32a1fdfb785d13664f65
2020-11-04 15:07:20 +01:00
Gabriel Ozouf
de681705e6 [escher/expression_field] Renamed dumpLayout
Changed dumpLayout's name to moveCursorAndDumpContent, as the name
suggested the method was only usable on layouts (while it also works on
text). The method is also no longer marked const, and the previous name
could imply that it had no side effects.
Likewise, renamed restoreLayout to restoreContent.

Change-Id: I46b320e74c07b48e256dc2146f9ecc15af38a8e6
2020-11-04 15:07:19 +01:00
Gabriel Ozouf
e295516928 [apps/calculation] Remember input layout
When leaving the Calculation app, the layout currently being edited is
now stored in a buffer, to be restored when the app resumes.

Change-Id: I59c16e18f7193bdcbb36888b54cb2722897f85f5
2020-11-04 14:45:35 +01:00
Gabriel Ozouf
0927ffca29 [apps/calculation] Moved input buffer to snapshot
The cacheBuffer from EditExpressionController has been moved in the
snapshot, to act as a zone where layout information can be kept while
the app is inactive.

Change-Id: If9206abf77f37d6b984826e5f09658848381a75f
2020-11-04 14:45:35 +01:00
Arthur
d77e924014 [Apps/Calculation] Modified the calculationStore of additional results
-Additional results are now stored in smaller calculationStores

Change-Id: I7d09bfb09e57cbb80e9385668adeb29a31398bc0
2020-11-04 14:45:34 +01:00
Arthur
d7a0914d13 [Apps/CalculationStore] Changed the way to store calculations
-No more limit to the number of calculations
-All calculations are memoized
-Added tests to test/calculation_store.cpp

Change-Id: Ia10e2b009576eaf4496ba44a0c88f6e7e76f6cef
2020-11-04 14:45:34 +01:00
Hugo Saint-Vignes
0b683b6994 [apps/shared] Handle identical layout in MinimalSizeForOptimalDisplay
Change-Id: I99a523e9e88ea9c3064e4367d96b01edb0020df9
2020-08-11 17:06:07 +02:00
Léa Saviot
b885098963 [apps/calculation] Fix additionalInformationType
If an expression hasUnits and is then reduced, it might not have units
anymore for instance if it was replaced with undefined).
Scenario: Enter "[5000000000000000]^20 _s" in the calculation app
2020-07-29 10:13:19 +02:00
Émilie Feral
22549d4d50 [apps/calculation] CalculationStore: change name CalculationHeight -->
HeightComputer
2020-07-16 14:37:38 +02:00
Émilie Feral
83ecefda00 [apps/calculation] Fix tests 2020-07-16 14:37:38 +02:00
Émilie Feral
1fb8c09714 [apps/calculation] Remove old TODOs 2020-07-16 14:37:38 +02:00
Émilie Feral
df74c2c551 [apps/calculation] The heights (common and expanded) of calculation cells are
computed when the calculation is added to the store and don't change afterwards.
Otherwise, if their heights change when scrolling (due to a modification of the
display output type - ExactOnly, ApproximateOnly...), it generates crashes.
2020-07-16 14:37:38 +02:00
Émilie Feral
c2db00cc88 [apps/calculation] When leaving calculation app, do not invalid
calculation height memoization. They're computed from the layouts which
don't depend on the complex format (or any other settings parameters
which could have changed).
2020-07-16 14:37:38 +02:00
Émilie Feral
c92b3d49e9 [apps/calculation] HistoryController: reload the subview selection when
deleting row

This fixes the following bug: input 1, OK, 1.2 OK, delete the row whose
input is '1' with the selection on the output view. The output of 1.2
does not toggle and it should.
2020-07-16 09:48:22 +02:00
Charlotte THOMAS
b5f9deb169 Update calculation.cpp
removed white
2020-07-15 10:28:15 +02:00
Charlotte THOMAS
f1dab081e1 Fix: CI test 2020-07-15 10:28:15 +02:00
Charlotte THOMAS
9d8b62894f Fix: Changed "IS" to "SI" because even in english the short for "International System of Units" is "SI" 2020-07-15 10:28:15 +02:00
Léa Saviot
d8f17da04e [apps/calculation] Add TODO comments about factorization 2020-07-07 09:55:20 +02:00
Léa Saviot
cc4ff3d40d [apps/calculation] Apply fix about Height computation
There was a problem with the way of computing Height, see
Calculation::HistoryViewCell. We did not encounter a problemeatic
scenario here, but there is no reason it would have been safe before.
2020-07-07 09:55:20 +02:00
Léa Saviot
982b467268 [apps/calculation] Fix scrolling
If the last cell is too big to fit entirely, we would scroll to the top
of the calculation, instead of the bottom
2020-07-07 09:46:26 +02:00
Léa Saviot
1128134c37 [apps/calculation] Raise exception if row height miscomputed
Scenario:
Put the complex mode to exponential, then go back to Calculation and:
Toolbox, Down, Down, Down, Down, OK, OK, Two, Plus, Imaginary,
Toolbox, Down, Down, Down, Down, OK, Down, OK, Two, Plus,
Imaginary, OK, Toolbox, Down, Down, Down, Down, Down, OK,
Down, OK, Up, OK, Right, Zero, OK, OK, Toolbox, Down,
Down, OK, Toolbox, Back, Up, Zero, Up, OK, Zero, Up, Up, Up
2020-07-07 09:46:26 +02:00
Léa Saviot
924e235ba8 [apps/calculation] Factorize some code 2020-07-06 17:16:22 +02:00
Léa Saviot
35f20c4312 [apps/calculation] Comment possible failed height computation 2020-07-06 16:35:35 +02:00
Gabriel Ozouf
e78c5c02d3 [apps/calculation] Fixed history scroll
Fixed a bug involving mishandled negative offsets in
CalculationSelectableTableView::scrollToSubviewOfTypeOfCellAtLocation
and cleaned up the function.

Change-Id: I4394ca9dc9748e8b761e7f722e41014d71d3373f
2020-06-30 15:41:56 +02:00
Émilie Feral
96c7d84633 [apps/calculation] Factorize code to avoid selecting ellipsis on cell
where ellipsis is not displayed
2020-06-26 17:48:31 +02:00
Émilie Feral
1281a4a508 [apps/calculation] HistoryController: avoid duplicate code when handling
backspace event. Keep the same selected subview.
2020-06-26 17:48:31 +02:00
Émilie Feral
94d3ac9828 [apps/calculation] HistoryController: fix order of actions in Backspace
handle event

This fixes the following bug: input 1/2/3/4/5/6/7/8, OK, OK, input 1,
OK, up, backspace. The selection disappeared.
2020-06-26 17:48:31 +02:00
Émilie Feral
aef804d149 [apps/calculation] HistoryController: avoid 2 calls to
setSelectedSubviewType in tableViewDidChangeSelectionAndDidScroll
2020-06-26 17:48:31 +02:00
Émilie Feral
457fa6a925 [apps/calculation] When EditExpressionController becomes the first
responder, scroll to the bottom of the table (and not the last cell).
Indeed, the last cell might be to big to be displayed and scroll to it
might scroll to its top.

This fixes the following bug: input 1/2/3/4/5/6/7/8, OK, up, down. We
did not scroll to the bottom of the table.
2020-06-26 17:48:31 +02:00