Compare commits

..

858 Commits

Author SHA1 Message Date
M4x1m3
6f797833b2 [omega] 1.22.1 2021-03-21 20:31:06 +01:00
M4x1m3
44d745eff3 [apps] Updates atomic 2021-03-21 20:24:23 +01:00
Cyprien Méjat
4e7a846540 [config.mak] Dev Branch 1.22 incrementation (#517) 2021-03-21 18:24:46 +01:00
M4x1m3
a35fb141c4 [ion] Made username volatile
This ensures the compiler doesn't assume that the username is fixed, allowing
us top change it before flashing, to let the user change his username.
2021-03-20 20:14:12 +01:00
Cyprien Méjat
4242c77d64 [themes] Omega Atomic dark theme (#516)
* update dark mode in atomic

* Fix mistake

* update atomic epsilon dark
2021-03-16 23:55:44 +01:00
Quentin Guidée
58ff19858f [omega] 1.22.0 2021-03-15 21:54:08 +01:00
M4x1m3
f1d15022aa [apps/code] Removed keys from HU catalog 2021-03-15 21:46:56 +01:00
Maxime FRIESS
fc3986f65a Merge pull request #513 from RedGl0w/IonToolboxEpsilon
[Code] Added ion keys submenu
2021-03-15 21:42:50 +01:00
Maxime FRIESS
b795834c63 Merge branch 'omega-dev' into IonToolboxEpsilon 2021-03-15 21:23:35 +01:00
M4x1m3
9c8112658e Fixed device build 2021-03-15 21:05:52 +01:00
Maxime FRIESS
ed86abebde Merge pull request #511 from RedGl0w/strcmp
Strcmp
2021-03-15 20:49:52 +01:00
M4x1m3
671321db10 Merge branch 'RedGl0w-kmat' into omega-dev 2021-03-15 20:48:54 +01:00
M4x1m3
3ccd7d0fb7 Merge branch 'kmat' of https://github.com/RedGl0w/epsilon into RedGl0w-kmat 2021-03-15 20:48:43 +01:00
Maxime FRIESS
4f34cd17a1 Merge pull request #510 from RedGl0w/patch-12
[Calculation/expression_field] EE add Ans
2021-03-15 20:28:00 +01:00
M4x1m3
5cd22c9429 Merge branch '0b101-epsilon-appShortcuts' into omega-dev 2021-03-15 20:24:45 +01:00
M4x1m3
893539b76e Merge branch 'epsilon-appShortcuts' of https://github.com/0b101/Omega into 0b101-epsilon-appShortcuts 2021-03-15 20:24:33 +01:00
Joachim LF
b2e2f3c5a6 [Code] Added ion keys submenu 2021-03-15 20:10:54 +01:00
Maxime FRIESS
48ec836129 Merge pull request #508 from RedGl0w/CRLF
[Ion/clipboard] Remove CR when there's LF next
2021-03-15 19:52:51 +01:00
M4x1m3
3d320b2768 Merge branch 'Lauryy06-master' into omega-dev 2021-03-15 19:50:33 +01:00
M4x1m3
134456267b Merge branch 'master' of https://github.com/Lauryy06/epsilon into Lauryy06-master 2021-03-15 19:50:10 +01:00
Maxime FRIESS
d2df42bc35 Merge pull request #506 from RedGl0w/DrawStringFont
Draw string font
2021-03-15 19:34:39 +01:00
Maxime FRIESS
20d7094352 Merge branch 'omega-dev' into DrawStringFont 2021-03-15 19:31:16 +01:00
Maxime FRIESS
d95b50abef Merge pull request #505 from numworks/master
Pull epsilon master
2021-03-15 19:29:12 +01:00
Maxime FRIESS
32f567c60a Merge pull request #504 from quentinguidee/omega-dev-atomic-theme
[themes] Change Atomic app theme
2021-03-13 23:55:47 +01:00
Quentin Guidée
83e6fc9579 [themes] Change atomic theme 2021-03-13 23:43:45 +01:00
M4x1m3
73585d9f48 Changed from Atom to Atomic in README 2021-03-12 18:16:12 +01:00
M4x1m3
8a400b7871 Updated atomic 2021-03-12 18:11:46 +01:00
Laury
297fbd3c00 [python] Add a draw_line function in kandinsky 2021-03-11 19:47:22 +01:00
Joachim LF
8feb8e3ea2 [Python/kandinsky] Added font constant 2021-03-08 18:03:15 +01:00
Joachim LF
7b57f31fbf [Python/kandinsky] Added in draw_string choice of font 2021-03-08 17:56:49 +01:00
Émilie Feral
6b8db108d2 [build] Add comment to dfu.py 2021-03-08 10:53:01 +01:00
Joachim LF
cf8ecfb438 [pyUSB] Update to V1.1.1 a54ebc7 2021-03-08 10:53:01 +01:00
Joachim LF
5605515fa1 [Ion/clipboard] Remove CR when there's LF next 2021-03-05 10:42:15 +01:00
Yolwoocle
ca6a0bdcb6 [apps/code] Fix French translation mistakes (#500)
Corrected a few French translation issues in Python catalogue (lis -> lit; écris -> écrit)
2021-03-03 09:19:59 +01:00
Maxime FRIESS
35c4c7fa2e Merge pull request #499 from M4xi1m3/patch-151
Fixed issues with settings
2021-03-02 16:31:53 +01:00
M4x1m3
b08f793776 [apps/settings] Fix #151 2021-03-02 16:16:23 +01:00
M4x1m3
9f380bf424 [apps/settings] Fixed broken about submenu 2021-03-02 16:09:09 +01:00
Joachim Le Fournis
d7f7bbe862 [Inliner] Use png_destroy_read_struct 2021-03-02 09:56:10 +01:00
Joachim Le Fournis
4718ff8016 [Inliner] Fixed memory leak 2021-03-02 09:56:10 +01:00
Maxime FRIESS
a25ebc516a Merge pull request #498 from A2drien/credit-name
Update contributor and tester names (Omega 1.21)
2021-03-01 23:19:12 +01:00
A2drien
cabc1a9564 credit name update 2021-03-01 23:12:20 +01:00
Maxime FRIESS
acd80f06ed Merge pull request #495 from M4xi1m3/omega-atomic
[apps] Replaced atom with atomic
2021-03-01 21:52:37 +01:00
M4x1m3
c988233b84 [apps] Replaced atom with atomic 2021-03-01 20:10:58 +01:00
Maxime FRIESS
b3bba17306 Merge pull request #469 from RedGl0w/omegaSingleQuote
[Poincare/parser] support ' as derivative
2021-03-01 13:55:27 +01:00
Maxime FRIESS
668bd6ba48 Merge pull request #491 from RedGl0w/omegaUsernameHidden
[Settings] Always compile with empty username, and don't dipslay
2021-03-01 13:40:28 +01:00
Maxime FRIESS
af1be64644 Merge pull request #474 from M4xi1m3/units
Fixed python in debug and -j build issues
2021-02-28 09:38:02 +01:00
Maxime FRIESS
ea71a83143 Merge pull request #493 from M4xi1m3/patch-492
[external] Fixed #492
2021-02-27 23:52:04 +01:00
M4x1m3
30f1d8464c [external] Fixed #492 2021-02-27 23:42:06 +01:00
Joachim LF
6072307e34 [Settings] Always compile with empty username, and don't dipslay 2021-02-26 08:19:50 +01:00
Maxime FRIESS
4926e273ed Merge pull request #479 from Calvineries/omega-dev
ScriptSize French Translation
2021-02-25 15:25:28 +01:00
Maxime FRIESS
27ea26b03f Merge pull request #490 from M4xi1m3/jni-crash
[ion/android] Fix #489
2021-02-25 11:19:36 +01:00
M4x1m3
f274b34939 [ion/android] Fix #489 2021-02-25 10:00:44 +01:00
Quentin Guidée
9eff895a95 [omega] 1.21.0 2021-02-24 22:25:36 +01:00
Maxime FRIESS
6e7cf88e3f Merge pull request #487 from M4xi1m3/magnify-fix
[apps] Fixed #456
2021-02-24 21:53:42 +01:00
M4x1m3
ba6ee3f1b9 [apps] Fixed #456 2021-02-24 21:47:29 +01:00
ArtichautCosmique
41554caf27 [ion] Icon for the AUR repo (#484)
flat design this time
2021-02-21 18:59:52 +01:00
ArtichautCosmique
0a807c3b69 [ion] Brand new icon for the Windows simulator (#483) 2021-02-21 15:09:32 +01:00
ArtichautCosmique
73017819ac [ion] New icon for the macOS simulator (#464)
* New icon for the macOS simulator!!

* Added a shadow to the macOS icon
2021-02-19 19:04:21 +01:00
Maxime FRIESS
d0e0ee610c Merge pull request #470 from RedGl0w/omegaCIFix
Fix tests with omega and inf new symbol
2021-02-18 19:22:51 +01:00
Maxime FRIESS
a540ef8153 Merge pull request #480 from M4xi1m3/omega-dev
[ion/web] Fixed emscripten EGL error
2021-02-18 15:48:06 +01:00
M4x1m3
a77028a36b [ion/web] Fixed emscripten EGL error 2021-02-18 14:04:04 +01:00
Calvineries
1838024934 ScriptSize French Translation 2021-02-17 01:35:01 +01:00
Maxime FRIESS
0250ad8520 Merge pull request #473 from M4xi1m3/omega-dev
[external] Fixed #454
2021-02-16 18:32:10 +01:00
lapingenieur
fcc803d7c5 [readme] Added French README (#475)
Co-authored-by: Quentin <quentin.guidee@gmail.com>
Co-authored-by: Maxime FRIESS <M4x1me@protonmail.com>
2021-02-16 10:01:00 +01:00
Maxime FRIESS
d83e712256 Merge pull request #477 from gkelly/posix-shells
[build] Remove bash-ismes
2021-02-15 19:57:23 +01:00
M4x1m3
7c51ab2130 [apps] Fixed build issue when too much cores 2021-02-15 14:57:04 +01:00
M4x1m3
6628b54218 [py] Fixed Illegal Instruction when building in debug 2021-02-15 14:56:41 +01:00
M4x1m3
6f3cb70f64 [external] Fixed memory leak #454 2021-02-15 12:23:09 +01:00
Maxime FRIESS
77ec00bc50 Merge pull request #471 from M4xi1m3/mk-app-check
[build] Throw an error when user is missing apps
2021-02-13 22:13:46 +01:00
M4x1m3
085c90353d [build] Throw an error when user is missing apps 2021-02-13 22:01:27 +01:00
Joachim LF
b09da48748 [calculation/tests] Fix tests on omega 2021-02-12 10:21:42 +01:00
Joachim LF
ef3682b904 [Poincare/tests] Added infinity symbols 2021-02-12 09:05:41 +01:00
Joachim LF
135a56b6b3 [Poincare/tests] Fix ∞ tests 2021-02-12 09:05:15 +01:00
Joachim LF
491c873c90 [Poincare/parser] support ' as derivative 2021-02-12 08:36:57 +01:00
Maxime FRIESS
f6c9bb23c6 Merge pull request #468 from M4xi1m3/i18n-fix
[i18n] Fixed missing / duplicate entries.
2021-02-10 21:26:13 +01:00
M4x1m3
17284985f7 [i18n] Fixed missing / duplicate entries. 2021-02-10 21:11:10 +01:00
lapingenieur
76e1bf8822 [*.hu.i18n] Improved Hungarian translations 2021-02-10 20:03:36 +01:00
Maxime FRIESS
540c87c71f Merge pull request #465 from LeGmask/infinity
[poincare/parser] Use infinity symbol
2021-02-10 17:28:48 +01:00
Evann DREUMONT
391904900a [apps/toolbox] Add infinity in maths/calcul toolbox 2021-02-10 17:21:12 +01:00
Evann DREUMONT
763ce87d14 [poincare/parser] Use infinity symbol
- Use infinity symbol
- Parse inf, oo, infity
2021-02-10 17:20:14 +01:00
Joachim Le Fournis
37f78c5d4d [makefiles] Fix epsilon_run on windows 2021-02-08 18:02:15 -05:00
Maxime FRIESS
a60d47bd2e [ion/3ds] Changed launch logo to Homebrew 2021-02-07 18:08:29 +01:00
Maxime FRIESS
875b7b3734 Merge pull request #462 from M4xi1m3/3ds-simu-fix
[ion/3ds] Works again, added CIA target
2021-02-06 18:46:14 +01:00
M4x1m3
9773c09eba [ci] Build 3ds CIA 2021-02-06 18:38:01 +01:00
M4x1m3
fda0848036 [ion/3ds] Added CIA target 2021-02-06 18:34:53 +01:00
M4x1m3
7733378bdc [ion/3ds] Make simulator work again 2021-02-06 17:00:14 +01:00
Maxime FRIESS
3e3a6347a6 Merge pull request #460 from RedGl0w/omegaHomeFix
[Fix] Select last app with incomplete row in home
2021-02-06 16:27:03 +01:00
Maxime FRIESS
3227e7ca8a Merge pull request #452 from ArtichOwO/omega-dev
[themes] Wrong colors in Omega Dark
2021-02-06 16:25:46 +01:00
Maxime FRIESS
51ef7d7404 Merge pull request #461 from M4xi1m3/fix-ci
[Fix] Make CI work again
2021-02-06 16:16:52 +01:00
M4x1m3
da3c4a48d0 [ci] Fixed invalid YML 2021-02-06 16:05:37 +01:00
M4x1m3
ec0e72fcb8 [ci] Made CI run on push 2021-02-06 16:05:37 +01:00
M4x1m3
8a45b3d552 [ci] Moved unit tests to separate workflow 2021-02-06 16:05:27 +01:00
M4x1m3
d35e93901c [ci] Reintroduced 3DS with toggle switch 2021-02-06 15:11:54 +01:00
M4x1m3
8f380adc4f [ci] Fixed checkout and wrong makefile 2021-02-06 10:27:27 +01:00
Joachim LF
61a015b6f1 [Fix] Select last app with incomplete row in home 2021-02-06 09:28:56 +01:00
0b101
aa51661aa7 Added app shortcuts 2021-02-05 16:58:55 -06:00
ArtichOwO
66ea24584c [Theme] Wrong colors in Omega Dark 2021-01-30 11:22:13 +01:00
Quentin
859976423f Merge pull request #451 from RedGl0w/someFixOnOmega21
Added env var for omega state
2021-01-29 12:26:27 +01:00
Quentin
f052ad7bf8 [.github/issue_template] New issue templates 2021-01-29 12:22:16 +01:00
Joachim LF
61646ccabc Added env var for omega state 2021-01-29 12:21:40 +01:00
Quentin Guidée
116cbf7df4 [.github/issue_template] Remove issue templates temporarily 2021-01-29 12:13:23 +01:00
Quentin Guidée
1354b3e4f3 [apps/settings] Add Omega to exam mode warnings 2021-01-29 11:48:55 +01:00
Quentin
5e91b12836 Merge pull request #449 from RedGl0w/someFixOnOmega21
Some fix on omega21
2021-01-29 10:34:50 +01:00
Cyprien Méjat
3b74553ed7 [escher] Fix color of the "auto" and "equal" axes buttons (#450) 2021-01-28 22:23:26 +01:00
Joachim LF
44fc94469e [code] Fix movement in input 2021-01-28 20:02:45 +01:00
Joachim LF
40b81313cb [Exam] Fixed exam mode to omega one 2021-01-28 20:02:31 +01:00
Quentin
0c01ccb13e Merge pull request #446 from RedGl0w/omegaE15
Fix home external apps display and accessibility
2021-01-23 15:30:31 +01:00
Joachim LF
71449239c8 Fix external apps display 2021-01-22 18:39:21 +01:00
Joachim LF
917e753426 Fix display issue 2021-01-22 17:56:58 +01:00
Quentin Guidée
134f1da4b0 [build/config] Fix Epsilon Version in settings 2021-01-22 15:06:52 +01:00
Quentin Guidée
0a3754aa23 [apps/*.i18n] Fixes for E15 2021-01-22 13:56:35 +01:00
Quentin Guidée
cb9f9e0e40 [.submodules] Update RPN submodule 2021-01-22 13:33:43 +01:00
Quentin
11f41a97d4 Merge pull request #445 from RedGl0w/omegaE15
[Update] Epsilon 15.3.1
2021-01-22 13:09:26 +01:00
Joachim LF
738a477b66 [Theme] Fix button_state 2021-01-21 19:56:22 +01:00
Joachim LF
9b17d1b882 [Update] Epsilon 15.3.1 2021-01-21 19:56:06 +01:00
Émilie Feral
11ef4bd996 build: Version 15.3.1 2021-01-07 12:47:23 +01:00
Émilie Feral
ed2d5e3b2d [simulator/android] Bump targetSdkVersion 2021-01-07 12:46:43 +01:00
Émilie Feral
49b74fb475 build: Version 15.3.0 2021-01-06 16:31:07 +01:00
Émilie Feral
e8887a4e70 [poincare] Remove unused variable 2021-01-06 16:30:07 +01:00
Hugo Saint-Vignes
5e7d93b331 [apps/statistics] Update and replace comment 2021-01-05 16:43:01 +01:00
Hugo Saint-Vignes
83722342f7 [apps/statistics] Reload CurveView before drawing histogram labels 2021-01-05 16:43:01 +01:00
Hugo Saint-Vignes
a42208f773 [apps/shared] Handle null labelStep in numberOfLabels 2021-01-05 16:33:48 +01:00
Hugo Saint-Vignes
9f0c7a87fd [apps/shared] Use sizeof data 2021-01-05 11:38:21 +01:00
Hugo Saint-Vignes
990c45b661 [apps/shared] Prevent label method from being called on uninitialized chars 2021-01-05 11:38:21 +01:00
Gabriel Ozouf
5b106f091d [interactive_curve_view_range] Fix isOrthonormal when using Navigate
The method isOrthonormal takes into account the "offscreen" portion of
the Y axis. This fixes a bug where zooming when using the Navigate
option would remove the orthonormality marker while the graph was still
orthonormal.
2021-01-05 11:01:45 +01:00
Gabriel Ozouf
878685b83c [interactive_curve_view_range] Test isOrthonormal 2021-01-05 11:01:45 +01:00
Gabriel Ozouf
abefc800d9 [interactive_curve_view_range] Fix variable type 2021-01-05 11:01:45 +01:00
Gabriel Ozouf
89c50509d8 [shared] InteractiveCurveViewRange::isOrthonormal
The old method isOrthonormal has been split into two :
  - shouldBeNormalized tests whether the range is close enough to a
    normal range
  - isOrthonormal tests whether the range is strictly orthonormal, but
    takes into account imprecisions of floating-point arithmetic
2021-01-05 11:01:45 +01:00
Roberta Rabotti
89107da1ae Update toolbox.it.i18n 2021-01-05 10:15:12 +01:00
Gabriel Ozouf
d022231a3a [statistics] Fix use of uninitialized variable 2021-01-05 10:12:02 +01:00
Martijn Oost
f449db62c3 [NL] fix omission sigma in toolbox
While changing from using sigma squared to just sigma I guess we deleted one character too much.
2021-01-04 15:14:38 +01:00
Martijn Oost
7a6c0e6e7d [NL] fix translations 2021-01-04 15:14:38 +01:00
Gabriel Ozouf
f6c91f7dbe [poincare/function] Add tests on getVariables 2020-12-29 17:20:09 +01:00
Gabriel Ozouf
4209f0a26c [poincare/function] getVariables always gets the argument
When applied to a function f(x) = constant, the method getVariables
would not find any, as the search is performed on the function's
definition.
Thus, when using the "Fill with formula" tool in Statistics, if the
formula to fill V1 is "V1=f(V2)", the formula will be considered
constant and applied to all values in V1. However, if V1 is longer than
V2, the program will attempt to read undefined values of V2.
With this change, the formula will only be applied to lines in V1 for
which there is a corresponding line in V2.
2020-12-29 17:20:09 +01:00
Gabriel Ozouf
d26ba0250b [statistics] Missing include 2020-12-29 13:34:35 +01:00
Gabriel Ozouf
48d93584e7 [poincare/parametered_expression] Fix variables detection
The method getVariables would not correctly remove the parameter from
the list of variables.
e.g. In the expression "box+y×int(z,x,0,1)", when trying to remove x
from the list of variables, the letter x would be removed from the name
"box" instead.
2020-12-29 13:34:09 +01:00
Gabriel Ozouf
fff514d410 [poincare/unit] Fix temperature conversion
The program would crash when trying to evaluate a unit conversion of the
form "x→_U" where U was a unit of temperature and x did not have any
unit.
2020-12-29 09:51:47 +01:00
Gabriel Ozouf
5ce5f4fbac [statistics] Fix glitch with histogram parameters
In the window to change the histogram parameters, it was possible to set
a rectangle width that was considered valid, but would make the starting
abscissa invalid, while triggering no error message. The message would
only show if the user closed the window and opened it again.
e.g. : Set a series with only one value 1e10
       Change its starting abscissa to 0
       Change its rectangle width to 1, confirm and close the menu
       Re-open the menu, a message appears, and stays onscreen when
leaving the menu.
2020-12-29 09:50:24 +01:00
Gabriel Ozouf
ea4770fc81 [shared/interactive_curve_view_range] Change normalization tolerance
The loss of significance that occurs when subtracting the bounds of the
axes must be taken into account when asserting whether the range is
orthonormal.
2020-12-29 09:47:29 +01:00
Hugo Saint-Vignes
e09bd0a18c [poincare] Factorize reduce and removeUnit methods 2020-12-22 17:32:40 +01:00
Hugo Saint-Vignes
7146eff7ee [poincare/src] Use reduce before removeUnit
With deepReduce(), when a simplifiaction was interrupted, expression could
contain Undefined children, which would trigger the assert in
removeUnit(). With reduce(), if a simplification is interrupted, the
entire expression becomes Undefined, which is handled by removeUnits().
2020-12-22 17:32:40 +01:00
Gabriel Ozouf
5bc9579db6 [shared/interactive_curve_view_range] Test zoom method 2020-12-22 17:22:33 +01:00
Gabriel Ozouf
e9c953fd6e [shared/interact_curve_view_range] Check orthonormality after zoom
Zooming in and out on a graph usually preserves orthonormality. However,
if the window has its bounds close to the limits for the values on the
axes, zooming can change the ratio.
2020-12-22 17:22:33 +01:00
Gabriel Ozouf
02d7a02a93 [poincare/unit] Add test 2020-12-22 17:21:37 +01:00
Gabriel Ozouf
9b3f7edfcd [poincare/unit] Handle kelvin with prefix
Units derived from kelvin (mK, cK, ...) were handled like Celsius and
Fahrenheit, causing a bug where multiplications such as 2*pi*_cK to
simplify as undef.
2020-12-22 17:21:37 +01:00
Hugo Saint-Vignes
fa523c25c9 [apps] Split italian text into two lines in variable box 2020-12-22 10:16:27 +01:00
Hugo Saint-Vignes
1939293cd2 [apps/shared] Add margin to avoid visible approximation errors 2020-12-21 16:12:27 +01:00
Léa Saviot
60f875220e build: Version 15.2.0 2020-12-17 17:10:56 +01:00
Gabriel Ozouf
24456780e6 [regression] Invalidate cursor when selected dot does not exist 2020-12-17 17:10:56 +01:00
Hugo Saint-Vignes
af3b2d4de4 [apps/shared] Tidy model name on sequence type change 2020-12-17 17:10:56 +01:00
Hugo Saint-Vignes
479f34502f [apps/shared] Rename methods and Factorize comparison logic 2020-12-16 16:16:26 +01:00
Hugo Saint-Vignes
10c296e671 [apps/shared] Add comment for isCursorHanging method 2020-12-16 16:16:26 +01:00
Hugo Saint-Vignes
b7bbb258a8 [apps/regression] Fix NaN comparison in isCursorHanging method 2020-12-16 16:16:26 +01:00
Hugo Saint-Vignes
7646f13ca8 [apps/shared] Fix NaN comparison in isCursorHanging method 2020-12-16 16:16:26 +01:00
Hugo Saint-Vignes
56a6917cfd [apps/shared] Fix context pointer when sorting rows 2020-12-16 11:40:54 +01:00
Gabriel Ozouf
efbbbe94ff [poincare/expression] Comment and variable names 2020-12-14 10:20:09 +01:00
Gabriel Ozouf
c7b758f536 [poincare/expression] Fix solutions to e^x=0
Because of the limitations of the floating-point representation, e^x is
null for x <= 710, causing the nextRoot functions to find roots for it.
To prevent this, we looking for places where a function changes sign, we
actually require the function to take two non-null values of different
signs.
2020-12-14 10:20:09 +01:00
Maxime FRIESS
f202a4f902 [mpy/files] Fixed append implementation (#434) 2020-12-10 21:30:54 +01:00
Hugo Saint-Vignes
78cb340065 [apps/regression] Only uniformize c if needed 2020-12-10 16:42:59 +01:00
Hugo Saint-Vignes
6e318593ae [apps/regression] Code review fixes 2020-12-10 16:42:59 +01:00
Hugo Saint-Vignes
79e59f525e [apps/regression] Ensure unicity for trigonometric regression 2020-12-10 16:42:59 +01:00
Gabriel Ozouf
94b2da8e60 [poincare/zoom] Comment on the representation of ranges 2020-12-10 13:45:56 +01:00
Gabriel Ozouf
185c780215 [poincare/zoom] Handle NAN in ExpandSparseWindow 2020-12-10 13:45:56 +01:00
Gabriel Ozouf
35bfb8ec16 [poincare/zoom] Method ExpandSparseWindow
This method is used to remove extraneous empty sapce in the middle of
the window for functions that are discontinuous between their points of
interest.
2020-12-10 13:45:56 +01:00
Gabriel Ozouf
625a89e610 [poincare/zoom] RefinedYRangeForDisplay signature 2020-12-10 13:45:56 +01:00
Gabriel Ozouf
3cdb076c2c [shared/interactive_curve_view_range] Factor zoom
The zoom method to zoom in and out on a curve view make use of the
SetZoom method in Poincare::Zoom.
2020-12-10 13:45:56 +01:00
Gabriel Ozouf
71070ee052 [poincare/zoom] Helper method SetZoom
Create a method SetZoom to zoom in and out on a window.
2020-12-10 13:45:56 +01:00
Hugo Saint-Vignes
c28a5198d6 [apps/regression/test] Add a test case, factorize logic 2020-12-09 17:31:14 +01:00
Hugo Saint-Vignes
a08e3e1024 [apps/regression] Update comment 2020-12-09 17:31:14 +01:00
Hugo Saint-Vignes
357db4493d [apps/regression] Add TODO to improve coefficient update 2020-12-09 17:31:14 +01:00
Hugo Saint-Vignes
e17ff842b5 [apps/regression/test] Update trigonometric tests 2020-12-09 17:31:14 +01:00
Hugo Saint-Vignes
d0f40f0177 [apps/regression] Set coefficient c initial value to 0 2020-12-09 17:31:14 +01:00
Émilie Feral
fe4e2e3e9d Misc. clang static analyzer fixes 2020-12-09 13:34:36 +01:00
Martijn Oost
c3ceb0074f [NL] fix translation mistakes 2020-12-09 13:31:15 +01:00
Émilie Feral
0f95b579a4 build: Version 15.1.0 2020-12-07 17:13:14 +01:00
Gabriel Ozouf
55f21f127c [poincare/zoom] Fix array overflow 2020-12-07 16:45:54 +01:00
Gabriel Ozouf
89979b4f50 [poincare/zoom] Comment on the RangeWithRatio method 2020-12-07 15:58:56 +01:00
Gabriel Ozouf
71be09b4e7 [poincare, graph] Factor helper function 2020-12-07 15:58:56 +01:00
Gabriel Ozouf
ffebd2e987 [shared] Rename methods 2020-12-07 15:58:56 +01:00
Gabriel Ozouf
1f8ab10ae5 [graph] Update tests on automatic zoom 2020-12-07 15:58:56 +01:00
Gabriel Ozouf
8726bbda3e [poincare/zoom] Update tests 2020-12-07 15:58:56 +01:00
Gabriel Ozouf
072fdda6b8 [poincare/zoom] Redraft search of orthonormal range
To find the optimal range with a specified ratio, we compute the values
of the function on a default range, then center the Y axis to display
the maximum number of points of the function.
2020-12-07 15:58:56 +01:00
Gabriel Ozouf
316d054935 [sequence] Restore margins on the sequence graph 2020-12-07 15:58:56 +01:00
Gabriel Ozouf
f3b770cb29 [graph] Add tests for the full range computation
Change-Id: I040a36c035ec75ee950f1998667b70a417dea2f3
2020-12-07 15:58:56 +01:00
Gabriel Ozouf
a9aeae94df [shared] Create helper functions for ranges
These functions are used to test the full algorithm used to compute
ranges.

Change-Id: I48069e245aa6e879f66aecc29709fc6f992f5220
2020-12-07 15:58:56 +01:00
Gabriel Ozouf
1e7babadb8 [solver] Change angle unit before test
A test in equation_solve relies on the angle unit being set to Degree,
but doesn't actually set it. Changing the angle unit to another one in a
test prior would break this test.

Change-Id: I6785b087f171d46226d484ebaa3ebdc9e791cedc
2020-12-07 15:58:56 +01:00
Gabriel Ozouf
7f63daa28e [poincare/zoom] Change weight function in RangeWithRatioForDisplay
Change-Id: I21520d8220083b40baa2e4928632632f2b73cb9b
2020-12-07 15:58:56 +01:00
Gabriel Ozouf
b1da6031c6 [shared] Do not compute range for convoluted functions
Evaluating a function containing a sequence, an integral or a
derivative, is time consuming. Computing a range requires a plethora of
evaluations, as such ranges for these functions cannot be evaluated in a
timely fashion.

Change-Id: I088a0e896dbc26e6563291cafdfe9ceba36dd5d0
2020-12-07 15:58:56 +01:00
Gabriel Ozouf
c89a7bc496 [graph] Take margins into account for normalization
When building an orthonormal range for the automatic zoom, we provide a
ratio for the screen without the margins. This way, adding the margins
will make the graph orthonormal, and the banner cannot cover the
function.

Change-Id: If3a3f799d4e7e3e81ab77c6b418d70b734a6fbca
2020-12-07 15:58:56 +01:00
Gabriel Ozouf
a8858023ba [shared] Remove const qualifiers from interestingRanges
Change-Id: I794aa144af9dc9eab3090eea7fd54a7cdac2fd68
2020-12-07 15:58:56 +01:00
Gabriel Ozouf
ff220b7103 [graph] Preserve default X range
When computing the automatic zoom, if the X axis has integer bounds
(most likely because the range has been built to be orthonormal), do not
add margins to the X axis, so that it keeps user friendly values.

Change-Id: I49d99b79c68fbd8a49e5c2521b250c40aad75d48
2020-12-07 15:58:56 +01:00
Gabriel Ozouf
6e9195fafa [shared] Add forceChangeY parameter to normalize()
Change-Id: Iff5417cd765f3fd09825b81cb41f883530b39233
2020-12-07 15:58:56 +01:00
Gabriel Ozouf
bd302bb67b [poincare/unreal] Type in derivate method
Unreal's derivate method returns true, to signify that it is unchanged
by the derivation operation. This implementation mostly exists for
documentation, as an Unreal derivand will be handled by the
defaultShallowReduce method.
2020-12-07 15:01:52 +01:00
Gabriel Ozouf
7ae03975cc [poincare/derivative] Derivate special numbers
Derivate the numbers Undefined, Unreal, Infinity symbolically :
  Undefined -> Undefined
  Unreal    -> Unreal
  Infinity  -> Undefined
2020-12-07 15:01:52 +01:00
Martijn Oost
76eb155ed5 [NL] translation fixes 2020-12-07 14:12:29 +01:00
Gabriel Ozouf
3f6e4444a5 [poincare/derivative] Reduce before replacing symbol
The general formula for deriving a power makes use of the logarithm,
which often disappears at simplification. However, replacing the symbol
before simplifying can lead to applying an invalid argument to the
logarithm, making the whole expression invalid.

e.g. diff(1/x,x,-2)
     If x is replaced by -2 before reducing the power derivative, ln(-2)
will reduce to Unreal, as will the rest of the expression.
2020-12-07 14:06:24 +01:00
Gabriel Ozouf
1a47207bee [poincare/trigonometry] Add comments 2020-12-04 11:59:12 +01:00
Gabriel Ozouf
1f0a18f94c [poincare/derivative] Update tests for trigonometric derivatives 2020-12-04 11:59:12 +01:00
Gabriel Ozouf
a113801ec2 [poincare/derivative] Fix derivative of trigonometric functions
The classic differentiation forumals for trigonometric functions assume
a variable in radians. A multiplicative constant must be added when
another unit is used.

Change-Id: Iec428acd7d93e415fddb184300437ae09d1d997c
2020-12-04 11:59:12 +01:00
Gabriel Ozouf
64208a7f3c [poincare/trigonometry] Method UnitConversionFactor
Change-Id: I4ef3e4404071a305354b572e15e5199040f9bf48
2020-12-04 11:59:12 +01:00
Gabriel Ozouf
f329ca825f [poincare] Add ReductionContext to unaryFunctionDifferential
Change-Id: I99ba90f8c38cab5d8fe2139f49e4f94c1d52d296
2020-12-04 11:59:12 +01:00
Hugo Saint-Vignes
f54c5a8172 [apps/statistics] Update wording
Change-Id: I4e3a042e1da6c7264932ff87fba0529f7aa1091d
2020-12-03 16:09:46 +01:00
Hugo Saint-Vignes
8cd3fe679f [escher/src] Add TODO comment 2020-12-02 17:20:32 +01:00
Hugo Saint-Vignes
636e863323 [escher] Moved repetition factor logic up in Escher from poincare
Change-Id: I7c8f932e3e7d04c928ca881113ba6b5df05b94e7
2020-12-02 17:20:32 +01:00
Gabriel Ozouf
b69f06b772 [poincare/logarithm] Comment clarity 2020-12-02 16:54:09 +01:00
Gabriel Ozouf
1531f96bb8 [poincare/derivative] Update test on derivation 2020-12-02 16:54:09 +01:00
Gabriel Ozouf
764d14fed1 [poincare/constant] Constants differentiate to 0 2020-12-02 16:54:09 +01:00
Gabriel Ozouf
a178c88e54 [poincare/logarithm] Fix derivative domain of definition
The logarithm function is undefined for negative numbers, but its
derivative, the inverse function, is defined everywhere. We thus need to
virtually limit the domain of definition of the derivative.
2020-12-02 16:54:09 +01:00
Gabriel Ozouf
591f47d6a9 [continuous_function_cache] Coding style 2020-12-02 16:50:17 +01:00
Gabriel Ozouf
937979503a [shared/continous_function] Detach cache of inactive function
When a function that had previously been cached is deactivated, its
cache can be used by another function. When the function is reactivated,
if it tries to reuse its previous cache, it will be filled with values
from another function, and will not be cleared. By detaching the cache
of a function that becomes inactive, we ensure that the next time this
function is cached, the chache will be cleared.

e.g. Define to functions f(x)=x, g(x)=-x, draw them both.
     Deactivate f, the redraw the graph
     Reactivate f, the draw again
2020-12-02 16:50:17 +01:00
Gabriel Ozouf
3501146e35 [shared/continuous_function_cache] Detach cache from function
When three functions or more, the third function and later don't use
caching. But it is still possible for them to have been linked to a
cache (for instance if previous functions had been deactivated earlier).
To avoid a function tapping into another function's cache, we reset the
cache.

e.g. Define 3 functions f(x)=1, g(x)=2, h(x)=3, and deactivate f.
     Draw the graph, come back, reactivate f, then draw again.
---> The space between y=2 and y=3 will be filled with the color of h,
as h "remembers" using cache n°2, wich currently contains the values of
function g.
2020-12-02 16:50:17 +01:00
Gabriel Ozouf
48bd7b6a77 [poincare/logarithm] Factor corner case log(x,0) and log(x,1) 2020-12-02 16:49:09 +01:00
Gabriel Ozouf
f09f06d7ac [poincare/logarithm] Update tests 2020-12-02 16:49:09 +01:00
Gabriel Ozouf
9775953142 [poincare/logarithm] ln(0) = undef
As a consequence, log(x,0) = ln(x)/ln(0) = undef
2020-12-02 16:49:09 +01:00
Gabriel Ozouf
71ac56f8a7 [ion/simulator] Update calculator keyboard image
Remove the "sto" from the x^y/sto->/F key, and add the % symbol to the
Backspace key.
2020-12-01 09:37:09 -05:00
Hugo Saint-Vignes
e295e9ead0 [github/workflows] Update Metrics to remove NumWorksBot
Change-Id: Icfd19cbad5472f6bf81a2a1accb88e79ab7a115b
2020-11-30 14:01:12 +01:00
Joachim Le Fournis
36742789b0 [py] Support round on int 2020-11-30 14:01:12 +01:00
Émilie Feral
312c02fd69 [.github/workflows] ci-workflows: update setup-emscripten 2020-11-30 14:01:12 +01:00
Romain Goyet
bd22c06d98 Use semantic branches on setup-arm-toolchain 2020-11-30 14:01:12 +01:00
ThePythonGuy
b343c5a02c [base.es.i18n] Translated some missing stuff to Spanish (#430)
* Update base.es.i18n

* Update base.es.i18n

* Update base.es.i18n

* Update base.es.i18n

* Update base.es.i18n

* Update apps/home/base.es.i18n

Co-authored-by: Quentin <quentin.guidee@gmail.com>

Co-authored-by: Quentin <quentin.guidee@gmail.com>
2020-11-28 22:40:43 +01:00
Quentin
1f05547437 [github] Update README.md to fix n0100 compilation (#429) 2020-11-27 16:51:08 +01:00
Quentin Guidée
68397ad0a6 [.github/workflows] Fix metrics 2020-11-27 16:42:07 +01:00
Quentin
f0ecb4c833 Merge pull request #428 from Omega-Numworks/omega-bot-for-workflows
[github/workflows] Omega-Robot for workflows
2020-11-27 14:25:01 +01:00
Quentin Guidée
5bbba6cf80 [github/workflows] Reintroduce OmegaRobot 2020-11-27 13:56:02 +01:00
Quentin
7f488b45f1 Merge pull request #427 from quentinguidee/merge-upstream
[upstream] Update
2020-11-27 13:52:03 +01:00
Quentin Guidée
ff029ea785 Merge branch 'omega-dev' into merge-upstream 2020-11-27 13:24:57 +01:00
Quentin Guidée
1347b1a20c [upstream] Update 2020-11-27 13:23:07 +01:00
Hugo Saint-Vignes
1fd970fe50 [apps/regression] Remove TODO and update comment
Change-Id: I049645e03c82e953dde14f363d113b718408efd5
2020-11-26 17:52:42 +01:00
Hugo Saint-Vignes
e9662e4c45 [apps/regression] Compute numberOfPoints automatically
Change-Id: I35a1902aeda06cc80ae8808d886b3e161bae8ad9
2020-11-26 17:52:42 +01:00
Hugo Saint-Vignes
72e8ac7d02 [apps/regression] Add tests for Trigonometric regressions
Change-Id: Ie4363d79a53c09369b24924b35bf26a66e9a8f93
2020-11-26 17:52:42 +01:00
Hugo Saint-Vignes
06d7104776 [apps/regression] Improve initial coefficient value
Change-Id: I2026b8de7e031f7e22921be2def800fa71d7a4e4
2020-11-26 17:52:42 +01:00
Hugo Saint-Vignes
1025fd9937 [apps/regression] Use cmath for sin and cos functions
Change-Id: I670eda49a73d9bf1d1d75194178344adda9b1014
2020-11-26 17:52:42 +01:00
Hugo Saint-Vignes
c55eb6b028 [apps/regression] Fix angleUnit dependent coefficients for trigonometric model
Change-Id: I8027c131b0fd7b020eb502168ac068a0b84da1e4
2020-11-26 17:52:42 +01:00
Gabriel Ozouf
2ba1941270 [poincare/zoom] Float litterals
Change-Id: Ifea5f356b9cee271c43b3d9b9168fd38db78d87a
2020-11-26 17:51:40 +01:00
Gabriel Ozouf
ddfde60982 [poincare/zoom] Update tests for the device
Change-Id: Ied73829ff294dc243ca177c5c2acfb374a7446b9
2020-11-26 17:51:40 +01:00
Gabriel Ozouf
746a781016 [poincare/zoom] Fix coding style
Change-Id: I263e1a95023f650376bf6a1c4bb45426d52d5e4c
2020-11-26 17:51:40 +01:00
Gabriel Ozouf
fdcccde996 [poincare/zoom] Update unit tests
Change-Id: Ic108bfbacd54d43ef6c721589ada813ca648e88e
2020-11-26 17:51:40 +01:00
Gabriel Ozouf
4869383263 [poincare/zoom] Better handling of single points of interest
Functions with a single point of inerest used to be drawn on a tiny
interval around this point.
Now, an orthonormal window is built around the point of interest, giving
a much nicer view.

Change-Id: I7793797aead2695532ddea44d93d62bb7ef870f4
2020-11-26 17:51:40 +01:00
Gabriel Ozouf
229865aff8 [poincare/zoom] Rework unit tests
Change-Id: Id0ff36517d14710701f6a4c1cec8817442b6f946
2020-11-26 17:51:40 +01:00
Gabriel Ozouf
291b400595 [poincare/zoom] Ignore imprecise float value
When looking for extrema in a function, we need to discard results where
the function growth rate is smaller than the precision of the float type
itself : these results are likely to be too noisy, and can cause false
positives.
e.g. : The sqrt(x^2+1)-x function

Change-Id: I6e2c002d7308b41a4c226d274cbb5d9efe4ea7db
2020-11-26 17:51:40 +01:00
Gabriel Ozouf
adf28345b1 [poincare/zoom] Reduce zoom artifact
Do not use the bounds of the interval when computing a refined range.
As the bounds are often integers, the zoom would give strange result on
some non-continuous functions (e.g. f(x) = x!).

Change-Id: Ie127fe15191cb3951cff223adc8dc3172188c789
2020-11-26 17:51:40 +01:00
Gabriel Ozouf
a418602763 [poincare/zoom] Remember points of interest when refining
Change-Id: I229cbffa2577d23bfa0a4c0632bc9ec32ae338e7
2020-11-26 17:51:40 +01:00
Gabriel Ozouf
ca9cb63909 [poincare/zoom] Reduce the step for searching points of interest
The algorithm to search for points of interest will miss some. We reduce
the step to make it more precise, so that tan(x) and tan(x-90) have the
same profile.

Change-Id: Ia1bac1d4e7b98d2d6f36f8ce12ed9dac67d40198
2020-11-26 17:51:40 +01:00
Gabriel Ozouf
540209f1a9 [poincare/zoom] Preserve standard bound when normalizing
Change-Id: I6d736e945eda6982ad26836763feded8a55134a0
2020-11-26 17:51:40 +01:00
Gabriel Ozouf
e4162976e4 [poincare/zoom] Method NextUnit
Change-Id: I8200c38fd44b662dcffa8e9850fc272f3e2dc7e8
2020-11-26 17:51:40 +01:00
Hugo Saint-Vignes
cfc37f1bac [apps/sequence] Factorize sequence row index offsets
Change-Id: Id6fa632521858c48fe7d3daf35fd846bf24a05eb
2020-11-24 13:26:55 +01:00
Hugo Saint-Vignes
387d3c9aa1 [apps/sequence] Fix row offset when returning to previous menu
Change-Id: Ic3eee6bb1ecb991b97dc9190fab95774938d294e
2020-11-24 13:26:55 +01:00
Hugo Saint-Vignes
b08a29cab4 [apps/sequence] Fix typo
Change-Id: Ic34b84073ef268eaddfe4224c3171c9aaa7ca395
2020-11-24 13:26:55 +01:00
Hugo Saint-Vignes
110f333122 [github/workflows] Update Metrics to remove NumWorksBot
Change-Id: Icfd19cbad5472f6bf81a2a1accb88e79ab7a115b
2020-11-24 10:41:59 +01:00
Gabriel Ozouf
4aa19ccd78 [i18n] Fix PT translation for imperial units
Pint -> "Pinto"
Cup -> "Copo"

Change-Id: I96dea0c6f1551db617f017d2121aaf0f2b6d0095
2020-11-24 10:40:56 +01:00
Gabriel Ozouf
56e03aae0c [shared] Remove angleUnitVersion
The angleUnitVersion check is no longer needed, as changing the angle
unit with a trigonometric function set would leave the cursor hanging.

Change-Id: I17d99c05daeacfec953865158cdfe7706635cd32
2020-11-24 09:55:22 +01:00
Gabriel Ozouf
5e679b7bc8 [graph] Change cursor initial position
The cursor now initially aligns with the grid, and tries to avoid points
where the function is not defined.

Change-Id: Ie3b304281f5848102c2f3c0aa5c031b351418186
2020-11-24 09:55:22 +01:00
Joachim Le Fournis
bd5cdb0f65 [py] Support round on int 2020-11-23 12:12:46 +01:00
Émilie Feral
99e63ec30b [.github/workflows] ci-workflows: update setup-emscripten 2020-11-23 11:26:01 +01:00
Hugo Saint-Vignes
962136ce8f [ion/simulator] Temporarly increase stack size on simulator
Change-Id: I0f27277ea704f81e316c7ff78fb7bed8c70ff4ae
2020-11-23 11:26:01 +01:00
Émilie Feral
5eaea62073 [.github/workflows] CI: use msys2/setup-msys2 instead of
numworks/setup-msys2
2020-11-23 11:26:01 +01:00
Hugo Saint-Vignes
3ac3fba468 [poincare] Prevent system parenthesis text insertion
Change-Id: I5963d2fda37ed9776059b29edced75f88b4ccb2b
2020-11-20 13:33:00 +01:00
Romain Goyet
0de5c89d9b Use semantic branches on setup-arm-toolchain 2020-11-20 11:19:40 +01:00
Hugo Saint-Vignes
d8527b02ad [poincare] Add a vector type for matrix product and norm operations
Change-Id: I28b0956273f8c0a3a9bdc4389956caa106d6b8af
2020-11-19 11:41:29 +01:00
Hugo Saint-Vignes
522456677a [poincare] Add an Array class to factorize Matrix and Grid methods
Change-Id: Ia61caf0bf182c1111119740d43d957f203c0975c
2020-11-19 11:41:29 +01:00
Hugo Saint-Vignes
c0413709b7 [poincare] Require same vector orientation for dot and cross products
Change-Id: I4cf248cf564899314a1efb1c5e39a041395ba583
2020-11-19 11:41:29 +01:00
Hugo Saint-Vignes
cb54e22272 [poincare/test] Add tests on horizontal vectors
Change-Id: If2d6293ede044ffe71e632212eff155b80ad683f
2020-11-19 11:41:29 +01:00
Hugo Saint-Vignes
bee8d8531b [poincare] Handle horizontal vectors
Change-Id: I98088b2b9f2dbc0549795a5c3eed4787fea70068
2020-11-19 11:41:29 +01:00
Martijn Oost
0ecfa0012c [nl] improved translation statistics 2020-11-17 14:06:18 +01:00
Gabriel Ozouf
0c44deb35f [poincare/matrix_layout] Change comparison order
Change-Id: Iaa048d82005a7dfa380357e80bbac447c0976e55
2020-11-17 11:42:55 +01:00
Gabriel Ozouf
323e72a50c [poincare/matrix_layout] Remove columns with backspace
Allow removing empty columns with backspace, the same way one can remove
empty rows. This allows deleting the internal columns that are not
automatically deleted.

Change-Id: I52def7939257942a8396721d01c4d1531ef90361
2020-11-17 11:42:55 +01:00
Gabriel Ozouf
7184202a6e [poincare/matrix_layout] Keep median rows and columns
Empty columns and rows are only removed automatically when they are the
last row/column. This way, the user can edit a median row/column without
the matrix collapsing.

Change-Id: If611fa0133f270d785809d433ae879879b6b093f
2020-11-17 11:42:55 +01:00
Gabriel Ozouf
62e2a71da1 [poincare/matrix_layout] Remove empty rows
Empty columns are automatically removed ; the same is now done to empty
rows.

Change-Id: Ib66dfe83f1ea712d3f9a450eedd7ade709296413
2020-11-17 11:42:55 +01:00
Hugo Saint-Vignes
04b2683af2 [poincare] Replaced an escape case with an assert only
Change-Id: I5ea501beeb42577a25dd752f8b9492210abd38fc
2020-11-16 17:12:42 +01:00
Hugo Saint-Vignes
73b5b0775a [poincare] Avoid nullptr context on non-Numbers sign and nullStatus methods
Change-Id: I3361344c1e0b50cdbe999d6ea50025022a51f603
2020-11-16 17:12:42 +01:00
Hugo Saint-Vignes
a0497d3bd7 [poincare] Prevent Bad access on abstract symbol context
Change-Id: I3077db5fdc2430ee11ceb1c6eb651e4331fb2ba0
2020-11-16 17:12:42 +01:00
Gabriel Ozouf
41778433b1 [graph] Fix a bug when zooming
When entering the Navigate menu, a portion of the Y axis is memoized to
preserve the grid units.
However, this portion was not modified when zooming, causing some
glitches.

Change-Id: I06b4ee044eaa75d48b8f338c9ef6ea33bb299e39
2020-11-16 16:50:21 +01:00
Quentin
83b4d9390d Merge pull request #402 from RedGl0w/patch-4
[Python] Change heap (32 to 100K)
2020-11-13 20:50:22 +01:00
Quentin
3252bad547 Merge pull request #415 from RedGl0w/patch-9
[Ion/usb] Changed URL in order to have easier update
2020-11-13 20:42:51 +01:00
Gabriel Ozouf
ea3e3287dc [graph] Keep Auto when opening and closing Navigate
If the user opens the Navigate menu, then closes it immediately, the
Auto status is not turned off.

Change-Id: I2d1ca0cfdae1b9c957dede7bf9f3c2890dea1bb0
2020-11-13 17:32:08 +01:00
Gabriel Ozouf
4233f197d3 [shared] Keep graph units when using navigation
When using the Navigate menu on graphs, the grid units are computed
using the normal graph's range, so that the units won't change.

Change-Id: I8ff8853868e5c90319619a6271d6a7d87ae82ab0
2020-11-13 10:50:31 +01:00
Émilie Feral
80f3af389f [build] Add %_run targets to linux, macos and windows platforms 2020-11-12 14:49:12 +01:00
Émilie Feral
0dcb4e9aff [docs] Improve SDK doc: executables are not in the root folder anymore 2020-11-12 14:49:12 +01:00
Roberta Rabotti
6c508d9c29 [IT]translation changes: imperial units
Change translation Imperial units
2020-11-09 17:49:47 +01:00
Martijn Oost
f42b7e4b20 [nl] fix imperial unit translation 2020-11-09 17:31:23 +01:00
Léa Saviot
4df996cfd2 [poincare/expression_node] TODO: use ReductionContext via pointers 2020-11-09 15:50:27 +01:00
Léa Saviot
5df60e946a [poincare] shallowBeautify can modify the reduction context
UnitConvert must set UnitConversion to None, otherwise the unit asked
for in the conversion might get changed after being properly set in
UnitConvert::shallowBeautify.
2020-11-09 15:50:27 +01:00
Léa Saviot
3a0796d3c5 [poincare/test] Add tests about negtive unit convert simplification 2020-11-09 15:50:27 +01:00
Martijn Oost
d7f83eca1c [nl] fix spelling mistakes 2020-11-09 10:48:01 +01:00
Émilie Feral
6e0528deac [apps] it i18n: ortogonale --> ortonormale 2020-11-09 10:34:00 +01:00
Quentin Guidée
78beafe3f1 [ion] Fix web simulator 2020-11-06 23:53:51 +01:00
Émilie Feral
d789e8da97 [poincare] In Multiplication::shallowBeautify, when extracting the unit,
reduce without changing the unit in order to extract the right unit.

This fixes the following bug: simplify "πππ23*_cK"
2020-11-06 14:51:49 +01:00
Émilie Feral
50bc31fcfa [poincare] Test: add a simplification test regarding unit 2020-11-06 14:51:49 +01:00
Léa Saviot
e00cb91f74 [ion/utf8_helper] Reuse strlen value 2020-11-05 13:23:21 +01:00
Léa Saviot
f96e4e92ce [ion/utf8_helper] Fix bad variable use 2020-11-05 13:23:21 +01:00
Joachim Le Fournis
5f34d07e53 [Calculation/expression_field] EE add Ans 2020-11-05 11:39:29 +01:00
Émilie Feral
7acec88006 [python] Port: we used the wrong variable
Found by clang-analyzer
2020-11-05 10:28:24 +01:00
Émilie Feral
5afdec00b8 [poincare] Avoid reading "garbage" value: result variable can be
read in the while condition without being set to an initial value
(if the first ridderApproximation was undefined for instance)

Found by clang-analyzer
2020-11-05 10:28:24 +01:00
Romain Goyet
d9b5acc70d [fuzzer] Invoke Python3 2020-11-04 17:32:45 +01:00
Romain Goyet
55615c10e3 [fuzzer] Always keep assert() when building with AFL 2020-11-04 17:32:45 +01:00
Romain Goyet
cca750a1c4 [fuzzer] The fuzzer detects the number of CPUs 2020-11-04 17:32:45 +01:00
Romain Goyet
7030159530 [fuzzer] make the afl.py script executable 2020-11-04 17:32:45 +01:00
Émilie Feral
4f9c37e96b build: Version 15.0.0 2020-11-04 16:14:28 +01:00
Léa Saviot
7f6a3f0fc1 [apps/curve_view] Fix KDCoordinate overflow
Scenario: (with the current auto zoom algorithm)
Graph f(x) = x! -> Auto axes are x=[-13,17647;13,17647],
y=[3628793;2628807]
Press "0" "EXE" to go to x = 0 -> Axes are x=[-13,17647;13,17647],
y=[-0.8612717;13.13873]
Press auto
Press "0" "EXE" to go to x = 0 -> the assertion about KDCoordinates
breaks.
2020-11-04 15:58:43 +01:00
Émilie Feral
95aa47625c [.github] ci-workflow: missing line 2020-11-04 15:58:43 +01:00
Émilie Feral
c7711b74c2 [poincare] Sequence: reorder condition (optimization) 2020-11-04 15:58:43 +01:00
Émilie Feral
a7b55776d6 [sequence] Remove unused function 2020-11-04 15:58:42 +01:00
Émilie Feral
c5beb6fdd2 [app/sequence] Test: avoid duplicating sequence stores and ensure to
tidy it (empty the Poincare Pool) between quiz_cases
2020-11-04 15:58:42 +01:00
Émilie Feral
5e83bee589 [apps/shared] ExpressionModel: expressionReduced can call itself so it
need to keep a valid m_expression
2020-11-04 15:58:42 +01:00
Émilie Feral
cf2cbd109e [apps/sequence] Add breaking test 2020-11-04 15:58:42 +01:00
Émilie Feral
4cc3542a99 [poincare] Sequence: when approximating within a reduce routine, escape to avoid
infinite loop
2020-11-04 15:58:41 +01:00
Émilie Feral
7142f9545e [poincare] Finish replacing approximateContext 2020-11-04 15:58:41 +01:00
Léa Saviot
f8b3156f19 [poincare] Start replacing approximateContext 2020-11-04 15:58:41 +01:00
Léa Saviot
644cf4dcf3 [poincare] Step II: create ApproximateContext 2020-11-04 15:58:40 +01:00
Émilie Feral
75dc415e27 [poincare] Step I: add a parameter to approximation routines to indicate
if we're within a reduction routine
2020-11-04 15:58:40 +01:00
Gabriel Ozouf
58867b66ca [sequence] Add tests on self referencing sequences
Change-Id: I031f0e8f166aa2d017c0f86679bc9e13e6a432bd
2020-11-04 15:58:40 +01:00
Émilie Feral
291941f4e2 [.github/workflows] CI: use msys2/setup-msys2 instead of
numworks/setup-msys2
2020-11-04 15:58:39 +01:00
Émilie Feral
547b4b2d71 [.github/workflows] CI: trigger CI manually or on PR only 2020-11-04 15:58:39 +01:00
Martijn Oost
bf79d4e438 [nl] stats definitions improved 2020-11-04 15:58:39 +01:00
Léa Saviot
fbf38f891d [apps/shared] Rephrase "Pan" -> "Navigate", "Move" -> "Pan" 2020-11-04 15:58:39 +01:00
Gabriel Ozouf
6f21310e08 [ion/events] Add comment about defaultText method
Change-Id: Ief2b53395a7921d85b116ded935c9dfeb10d08fd
2020-11-04 15:58:38 +01:00
Gabriel Ozouf
993de56d59 [ion/events] Remove method defaultIsDefined
Change-Id: Ic5c057a451bfc49d99f4b2a70ec5dbff16844a86
2020-11-04 15:58:38 +01:00
Gabriel Ozouf
0185e0562c [escher/run_loop] Move kandinksy include
To check whether an ExternalText could be written with Epsilon's fonts,
UTF8Helper made a reference to Kandinsky, which is prohibited. This
check is now done in Escher, before dispatching the event.

Change-Id: I55e9db1ba43c3115775499db47b90a6bdd7cc7b3
2020-11-04 15:58:38 +01:00
Hugo Saint-Vignes
d5e810f2b8 [ion/shared] Remove contexpr array definition in header
Change-Id: I620e977b000ee53c3db97510e666dfda30f4db30
2020-11-04 15:58:38 +01:00
Hugo Saint-Vignes
8dc6391e92 [apps/shared] Prevent Array index overflow
Change-Id: I67ffcb71d0d62a3e67e6d63d2b30b0696800cb42
2020-11-04 15:58:37 +01:00
Gabriel Ozouf
fe950386a0 [interactive_curve_view_range] Fix assert
Change-Id: I2ff3cfe90f10b33db3e18b321cf931c9f0946479
2020-11-04 15:58:37 +01:00
Gabriel Ozouf
9e9033537c [WIP][interactive_curve_view_range] Tweak tolerance
Change-Id: Iacfb7de81a4ab8a7fb73770053e189d596016201
2020-11-04 15:58:37 +01:00
Gabriel Ozouf
ad7890a19c [interactive_curve_view_range] Missing refresh
Fixes the following bug :
  - Plot ln(x) (or any other curve that's normlalized by default)
  - Go back and replace ln(x) with log(x) (or any other curve that's NOT
    normalized by default)
--> The 'Equal Axes' button is still on.

Change-Id: I0ef50dc9866e908894bd4f5c3ade198f9b3ea318
2020-11-04 15:58:37 +01:00
Hugo Saint-Vignes
f789bb156d [ion/keyboard] Fix const const array
Change-Id: I75cfc94ed36493a78bd104f8c4734f2ecd3d042d
2020-11-04 15:58:36 +01:00
Hugo Saint-Vignes
aa50a5eb7c [apps/shared] Silence warning for unused variable
Change-Id: I1df4a8c111688e00a82d4448d47fd571fec738e4
2020-11-04 15:58:36 +01:00
Gabriel Ozouf
eb5f4b333a [ion/clipboard] Update comments 2
Change-Id: Ib628a888f6712ad6ea62ccb20192845d19e84986
2020-11-04 15:58:36 +01:00
Gabriel Ozouf
8bb0b47b9f [ion/clipboard] Update comments
Change-Id: I320f8130b7bc897b6e8e3bf7d79cfcda837a9984
2020-11-04 15:58:35 +01:00
Gabriel Ozouf
f66bde6d31 [ion/clipboard] Rework clipboard handling
Change the way the clipboard is fetched, so as to preserve the
Poincare/Python translation feature, and remove the cap on the length of
text being imported into the simulator.

Change-Id: I0f3e83c0c8aa4b64eb08d882aa6891b31f191e22
2020-11-04 15:58:35 +01:00
Gabriel Ozouf
010b474f77 [ion/clipboard] Add support for web simulator
Wrote methods for accessing the system clipboard from the web
simulator, as the methods in SDL_Clipboard do not work when the video
device uses emscripten.

Change-Id: Ib2e66530a6b013eca0cf69fb52372e9e3a21c8bb
2020-11-04 15:58:35 +01:00
Gabriel Ozouf
b9c34ace3a [ion/clipboard] Use system clipboard on simulator
Add methods to interface Epsilon's clipboard with the system's when
running a simulator.
Note that the clipboard still uses a buffer located in the
Escher::Clipboard class, as some features require a buffer to execute
computations on the clipboard's content.

Change-Id: I14c19615805d38735e64d481c617863db22db9bc
2020-11-04 15:58:35 +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
42f20fb58d [poincare] Add NullStatus and sign for more complex expressions
Change-Id: Ic593517bf7a983985fe3c521e10c19ab0bca4191
2020-11-04 15:58:34 +01:00
Hugo Saint-Vignes
61d33be2a7 [poincare] Add NullStatus and sign for more expressions
Change-Id: I4443a28532f5b728afe169a3d2a70d9026bc1909
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
b2945c3f8b [poincare] Add isNumberZero tests
Change-Id: Ia8906e27c5c28f96c87ed39f522f4b1028ad80b8
2020-11-04 15:58:33 +01:00
Hugo Saint-Vignes
98499f6c9f [poincare] Rename isRationalZero to isNumberZero
Change-Id: I554dd5e9b9ab3af4364ca23cde590f9e0a458ef8
2020-11-04 15:58:33 +01:00
Hugo Saint-Vignes
58114255e5 [poincare] implement isRationalZero for other numbers
Change-Id: I40f61958f9e51adb376407b2a512097962979417
2020-11-04 15:58:33 +01:00
Hugo Saint-Vignes
9d077c672d [poincare/test] Add tests for multiplication reduction
Change-Id: I54186c0a7c12f7fb0122c0a67f4a6d0d462feb82
2020-11-04 15:58:32 +01:00
Hugo Saint-Vignes
0d883bfb19 [poincare] Handle division by 0 when combining powers
Change-Id: I108ba8131ef2f8d3d210a769322a815121311f6b
2020-11-04 15:58:32 +01:00
Hugo Saint-Vignes
aba09e1a1f [poincare] Fix multiplication.cpp comment typos
Change-Id: I1553144fb45f45cbdb4e021b14ef20cb319984cc
2020-11-04 15:58:32 +01:00
Gabriel Ozouf
3b24f9c2c3 [interactive_curve_view_range] Check auto status
Deactivate Auto status every time the range effectively changes.

Change-Id: I695b840d5e72061a73a229a6e726433660bdfdbf
2020-11-04 15:58:31 +01:00
Gabriel Ozouf
5a5955b513 [interactive_curve_view_range] Status unchanged
Only notify the delegate to the refresh the button when the status has
changed.

Change-Id: I6689d2c292ff96039a68cd1b437b18df5fb98829
2020-11-04 15:58:31 +01:00
Gabriel Ozouf
82a77df088 [interactive_curve_view_range] Missing resets
Added some missing resets of the Auto and Normalize statuses

Change-Id: I5514a2566c1f6ba73d04b526402b428b2edce4b4
2020-11-04 15:58:31 +01:00
Hugo Saint-Vignes
f2ba5daab9 [apps/regression] Comment assert that cannot be satisfied
Change-Id: Iaae5ee4292e33f923f47590ee4520bac44c5d750
2020-11-04 15:58:31 +01:00
Hugo Saint-Vignes
f58633b03c [apps/regression] Add escape case if data is not suitable for regression
Change-Id: Ie2e028a5030e1b0d3f133efdde971645d5b4687b
2020-11-04 15:58:31 +01:00
Hugo Saint-Vignes
b2d7ee800a [apps/statistics] Add pop-up to confirm parameter discard
Change-Id: I0d0d7dca0e167cfcb40f4b26d8208e12056ebf40
2020-11-04 15:58:30 +01:00
Hugo Saint-Vignes
a922e44558 [apps/statistics] Add temporary parameters for histogram
Change-Id: I67c21d59263b7eddd7ee8ee9e61c168e6b013d13
2020-11-04 15:58:30 +01:00
Hugo Saint-Vignes
cab22fcbce [apps/shared] Set buttonAction method as protected
Change-Id: Iaef80fdbb6083be688fadc2b5fc515dbbd0d004c
2020-11-04 15:58:30 +01:00
Gabriel Ozouf
aadf8f5716 [ion/events] Fix ExternalText buffer size
The size of the ExternalText events shared buffer is now defined as the
size of the SDL_TextInputEvent 'text' field, as it should.
Also fix a wrong parameter being passed to a strlcpy.

Change-Id: I6a57d49d61fec8a009c4711efce564c65544e571
2020-11-04 15:58:29 +01:00
Gabriel Ozouf
b0b6fe33c9 [ion/events] Factor includes of layout_events.h
Change-Id: Id7f68f4dfb4727453a02437a0b824492a8c94730
2020-11-04 15:58:29 +01:00
Gabriel Ozouf
4ea8263185 [ion/simulator/events_keyboard] Serve ExternalText
Generate an ExternalText event when catching a SDL_TextInputEvent whose
text cannot be boiled down to one of the regular events.

Change-Id: I036fa2a153c8351979521d7f8cba6b62aa64604b
2020-11-04 15:58:29 +01:00
Gabriel Ozouf
8181753553 [ion/utf8_helper] Method to check text compliance
Change-Id: I9683a8ba819b1a4aad18bcc4759160509e424d4e
2020-11-04 15:58:29 +01:00
Gabriel Ozouf
96b8e1859a [ion/events] Create event ExternalText
Added an event to represent the typing of text that is not on the
device's keyboard. ExternalText event's text is read from a buffer, that
will be filled when the event is generated.

ExternalText only exists on the simulator.

Change-Id: Ie78d2c7c2de91da986a1ce2130a5ecd123db48ee
2020-11-04 15:58:28 +01:00
Gabriel Ozouf
65156c8e5a [poincare/zoom] Add test for x*ln(x)
Change-Id: Ia28a7ffb826a9b6e3618b222b6ed9d0d43de308a
2020-11-04 15:58:28 +01:00
Hugo Saint-Vignes
93b5a3f63a [poincare] Handle equal negative numbers in GCD LCM
Change-Id: Ia46966270418a339f8a37e8a1971a7f7dd046034
2020-11-04 15:58:28 +01:00
Gabriel Ozouf
82c4fe2190 [poincare/zoom] Limit explosion detection
Do not take strong variations into account if they would erase more
interesting variations.

Change-Id: I6299a64bed449a611f90eda4234af10a183958d1
2020-11-04 15:58:28 +01:00
Gabriel Ozouf
3a90ed6109 [ion/events_keyboard] Fix selection on long press
A previous fix to prevent AlphaLock from interfering with the long press
feature broke the long press selection. Revert the changes and find
another solution to the previous problem.
We compare the alpha status to both the state of the Alpha key and the
Lock, which makes sense : Lock is supposed to mimic Alpha being
continuously pressed.

Change-Id: I1349eb83f8971d3a5efcb10de020bb6c0aed64a1
2020-11-04 15:58:27 +01:00
Hugo Saint-Vignes
2740056472 [apps/statiastics] Rename i18n messages accurately
Change-Id: If88f91d6e925dbb2ad293b537661eb3d137ea826
2020-11-04 15:58:27 +01:00
Hugo Saint-Vignes
81616950f3 [apps/statistics] Fix horizontal alignement for size legend
Change-Id: I834444aee7dd547c71254df4658c0db05eb101d7
2020-11-04 15:58:27 +01:00
Martijn Oost
6628e76d36 [NL] adjust translation in python app 2020-11-04 15:58:27 +01:00
Martijn Oost
52adea0c1f [NL] correct spelling mistake 2020-11-04 15:58:27 +01:00
Hugo Saint-Vignes
14e2f6247a [apps/shared] Update translation size -> frequency
Change-Id: I841bd22077cccacc7d2a4a541cca2e463f13925b
2020-11-04 15:58:26 +01:00
Hugo Saint-Vignes
bb8a28ade0 [poincare/zoom] Simplify plot ranges after adding margins
Change-Id: If8904ca4e7d306376de785a125fe5fba168de718
2020-11-04 15:58:26 +01:00
Hugo Saint-Vignes
3f25a37cc8 [i18n] Update Graph view parameters wording
Change-Id: Icd65c4e19b78cd8751d6b1b583c112abb08c9237
2020-11-04 15:58:26 +01:00
Hugo Saint-Vignes
2f97dab6d1 [apps/shared] Add toggle buttons in Graph view
Change-Id: I7548d11fb114b2605ce34d3bda0776277b79ff9d
2020-11-04 15:58:25 +01:00
Gabriel Ozouf
a76e54642c [poincare/zoom] Change struct to class
Change-Id: I06d1850074b266a694d74e4db4c754ff156c8098
2020-11-04 15:58:25 +01:00
Gabriel Ozouf
194cd0491c [sequence] Format comment
Change-Id: Iaff562cca9af3eb903d6cc8a529c730184235e4b
2020-11-04 15:58:25 +01:00
Gabriel Ozouf
29f47124b1 [poincare/zoom] Use std::min & max
Change-Id: If3983c16d3bfa0de31aefe8a3f5c650e1858f822
2020-11-04 15:58:25 +01:00
Gabriel Ozouf
3a87e47de5 [interactive_curve_view_controller] Zoom button
Renamed zoom button

Change-Id: I476c0991d5ab88c6642b793fbe10debbcca4e014
2020-11-04 15:58:24 +01:00
Gabriel Ozouf
0e4de43b8f [shared] Rename ZoomParameterController
Change-Id: I64a6500b66db4455217920a1e73efd5848216411
2020-11-04 15:58:24 +01:00
Gabriel Ozouf
f491be2db5 [poincare/zoom] Accelerate normal range search
Change-Id: I4a7f2e024ca82a3996ad3e395c8f62ca4170ec9e
2020-11-04 15:58:24 +01:00
Gabriel Ozouf
31e694f41a [poincare/zoom] Add tests
Change-Id: Ia7229d790ef1d2039071e35accb102804c94cb01
2020-11-04 15:58:23 +01:00
Gabriel Ozouf
9c320185dd [poincare/zoom] Return value for boring curve
Change-Id: Iad983da0aa3066f5be0c75c5b8e38e62a907d5a1
2020-11-04 15:58:23 +01:00
Gabriel Ozouf
c647bfe566 [poincare/zoom] Clean up and comment API
Change-Id: I58347d7188551471817fb334bcb54d5c5b398f72
2020-11-04 15:58:23 +01:00
Gabriel Ozouf
91e1154bb8 [sequence/curve_view_range] Fix normalize
Change-Id: I1e4aa49dd84f12fe4e0f2ab59912fc68fe00b2fa
2020-11-04 15:58:23 +01:00
Gabriel Ozouf
6f8d80f8ae [regression/store] Sanitize default range
Add range sanitation and checks for orthonormal ranges in setDefault.

Change-Id: I733a8808e944a477573a76b52fef479853b8ad6d
2020-11-04 15:58:22 +01:00
Gabriel Ozouf
c4cd3ecffa [poincare/zoom] Factor range sanitation
Checking wether the range that has been computed is suitable is now
done in Poincare::Zoom by SanitizeRange.

Change-Id: Ib7ff73a3beae29996b1a773744021ad85c6ba946
2020-11-04 15:58:22 +01:00
Gabriel Ozouf
b10be2c60c [poincare/zoom] Method SanitizeRange
Create a method to clean up an ill-formed range, ie a range whose bounds
are not finite, or where max <= min.

Change-Id: If4525e65f95385cfa970be72bbcc21ad84286bfa
2020-11-04 15:58:22 +01:00
Gabriel Ozouf
71e7070657 [function_graph_controller] Remove yRangeForCursorFirstMove
This method, that prevented the graph from panning when moving the
cursor for the first time, caused more problems than it solved.
For instance, the graph for 1/(1-x) was not symmetrical because of it.

Change-Id: Ibb22e38ec0ace6b219c0e42dda481c98b5f717f0
2020-11-04 15:58:21 +01:00
Gabriel Ozouf
3ba4f974f7 [interactive_curve_view_range] Move status update
The methods setDefault and normalize now update the zoomAuto and
zoomNormalize status.

Change-Id: I0400c22816c17d38fd1b3dee5c8a2f1ccfa79340
2020-11-04 15:58:21 +01:00
Gabriel Ozouf
958b172d08 [poincare/zoom] Handle undefined functions
Rework the logic so that :
  - an undefined function will be displayed with a clealry defined
    null range.
  - display both an undefined function and a correct function at the
    same time will not affect the correct range.

Change-Id: Ife9dc0d2ace667cab5a6b8826347078fca33e4d5
2020-11-04 15:58:21 +01:00
Gabriel Ozouf
20cbefad41 [function_graph_controller] Fix y for first move
Method yForCursorFirstMove is supposed to expand the window so that the
first move of the cursor won't cause it to pan. It now filters extreme
values to prevent the original window to be totally squashed, such as
with the drawing of e^x and (x-100)(x+10) at the same time.

Change-Id: Icd6c26b01475a112c4231f293e03ab31d80d5e51
2020-11-04 15:58:20 +01:00
Gabriel Ozouf
0a6ac0b40b [apps/graph] Remove tests on ranges
As zooming has moved to Poincare, so will the tests.

Change-Id: I6c1fe581edc903369779e46a295447273a89e517
2020-11-04 15:58:20 +01:00
Gabriel Ozouf
1bfeeb5842 [poincare/zoom] Detect explosions
Add a clause in InterestingRangesForDisplay to detect strong variations.
This improve the graph for x^x or x^2+x+1 for instance.

Change-Id: I74214c2382cfe4b0e2603556dd8c6cbd450effc0
2020-11-04 15:58:20 +01:00
Gabriel Ozouf
8ce9f363ad [interactive_curve_view_range] Force equal axes
Added a tolerance when checking orthonormality, so that ranges that are
nearly orthonormal will be made orthonormal.

Change-Id: Ie3bf076086561e3ff6374e7daa9dd1a884c52d5a
2020-11-04 15:58:19 +01:00
Gabriel Ozouf
482ca10363 [poincare/zoom] Improve null range
When displaying f(x) = undef, the range now defaults to an orthonormal
range, centered on the origin, with axis unit 1.

Change-Id: Ie3515be0572af4849b8ebd113449f4444755b34f
2020-11-04 15:58:19 +01:00
Gabriel Ozouf
190568ea84 [interactive_curve_view_controller] Fix Cursor
Restore the permanence of the cursor between accesses to the graph
window.
The cursor used to be reset when the models had been modified. As there
is no longer a system in place to track these modifications, we manually
check if there is a curve beneath the cursor before reseting it.

Change-Id: I6f71fc17744b5bf1ee552c82126bb4a08b823629
2020-11-04 15:58:19 +01:00
Gabriel Ozouf
16707aa518 [poincare/zoom] Tweak orthonormal range
Change some parameters to improve the output of
RangeWithRatioForDisplay. Notably, change how the size of the range is
weighed.

Change-Id: I7695c61c3f93482f3fed9c7d2183642573b02cff
2020-11-04 15:58:18 +01:00
Gabriel Ozouf
6be5e7d62c [apps/shared] Change Zoom API
Moved some code around to decrease redundancy and put more of the logic
into Poincare::Zoom

Change-Id: I4804cf39493ac7f2f0b3c4eb554e5c15c3cef1c9
2020-11-04 15:58:18 +01:00
Gabriel Ozouf
8572f4953c [poincare/zoom] Method CombineRanges
The logic behind combining several ranges will be handled by the Zoom
class directly.

Change-Id: I4de3f020d94b9bc1a21953b0c416158c65beb606
2020-11-04 15:58:18 +01:00
Gabriel Ozouf
81e425eb04 [poincare/zoom] Method FullRange
Change-Id: Ibfaa0b694afecab312199b20b102a57901f34ae7
2020-11-04 15:58:17 +01:00
Gabriel Ozouf
09c061e871 [poincare/zoom] Method RangeFromSingleValue
This method adds margins to a range whose bounds are equal.

Change-Id: I2b2fe26fe431deda112389060d401f738a75b1ae
2020-11-04 15:58:17 +01:00
Gabriel Ozouf
a525c35ebb [poincare/zoom] Factor constants
The mantissas {1, 2, 5} used in CurveViewRange to compute the grid units
can be factored in Zoom.

Change-Id: I2bcc9b9df1ff6b6df82092a5d78ed3db132bf63a
2020-11-04 15:58:17 +01:00
Gabriel Ozouf
88ea32bd0d [poincare/zoom] Change range forms for fixed ratio
When looking for a range with a certain ratio using
RangeWithRatioForDisplay, instead of looking for ranges of the form
0.01*1.1^n, search for ranges of the form a*10^k, with a being either 1,
  2, or 5.

Change-Id: I2eaa229574a9a6aa4afa6eb1a3d57365d3d52801
2020-11-04 15:58:17 +01:00
Gabriel Ozouf
43f50b7b2d [interactive_curve_view_range] Missing refresh
The normalized status would not be refreshed after a call to setDefault
triggered by InteractiveCurveViewController::viewWillAppear.

Change-Id: I923ef3ca0585dbcc1f32b992d7dd1f4a3a206532
2020-11-04 15:58:16 +01:00
Gabriel Ozouf
bcb4b3095b [function_graph_controller] Fix Y range expansion
The method FunctionGraphController::yRangeForCursorFirstMove expands the
Y range to include the values of the first cursor moves on the left and
the right of the center. It has been modified to preserve
orthonormality.

Change-Id: I898ab9721e45e2acde261f8b94b80cab81b39a92
2020-11-04 15:58:16 +01:00
Gabriel Ozouf
f54b15b9c8 [interactive_curve_view_range] Preserve ratio
Preserve orthonormality when adding margins to a default range.

Change-Id: Iaa1da8d36812e2dad1be3894198ee0fabcd3020f
2020-11-04 15:58:16 +01:00
Gabriel Ozouf
5d9c7b0c1f [interactive_curve_view_range] isOrthonormal
Change-Id: I154487908d1a2a11e01b2a4e51ef867e235babab
2020-11-04 15:58:15 +01:00
Gabriel Ozouf
29714b401e [shared/function] Create an orthonormal range
When the function does not have any points of interest, fall back to an
orthonormal range.

Change-Id: I90e4bcfae80ebd37f95d404a4a63121c93cf7cff
2020-11-04 15:58:15 +01:00
Gabriel Ozouf
d642339963 [interactive_curve_view_range] Normal ratio
The method NormaRatio returns the screen ratio for an orthonormal
range.

Change-Id: Ib834f9934232866646da16c78447782cdbdc0af2
2020-11-04 15:58:15 +01:00
Gabriel Ozouf
403315f6ac [poincare/zoom] Find range with specific ratio
Change-Id: Id0c816c42e3fa93519241bf53f920c333e204af1
2020-11-04 15:58:15 +01:00
Gabriel Ozouf
08c96c5107 [poincare/zoom] Method SetToRatio
Added a method to Zoom to set a range to a specific ratio. This method
is used by InteractiveCurveViewRange::normalize.

Change-Id: Id3029439294ece02ea19fb6c6de90b9edc85d771
2020-11-04 15:58:14 +01:00
Gabriel Ozouf
c4aad1641e [poincare/zoom] Rename k_defaultMaxInterval
Bring it in line with k_minimalDistance which as a similar role.

Change-Id: Ifc3ad793e8b5ff1e7f2598d0665abdd5c954e61f
2020-11-04 15:58:14 +01:00
Gabriel Ozouf
0465cec924 [poincare/zoom] Remove rounding of abscissa
As margins are added later in InteractiveCurveViewRange::setDefault,
rounding abscissa at this point is premature.

Change-Id: I411dd014b712649efd55cb995ed7a9c5c14a7f43
2020-11-04 15:58:14 +01:00
Gabriel Ozouf
ad6edffc07 [poincare/zoom] Remove tuneXRange argument
The ability to perform a range search without changing the X range was
only there to accomodate the Yauto feature.

Change-Id: I8c2b61b447fbd3dc1f4e303dff06d1a8d6e7a4f2
2020-11-04 15:58:14 +01:00
Gabriel Ozouf
07c52139b9 [apps/shared] InteractiveCurveViewRangeDelegate
Clean up the class by removing some unused methods and structures.

Change-Id: Ife38a9a0ed4bfb84986227d1f57fe3f5d2c4ff2a
2020-11-04 15:58:13 +01:00
Gabriel Ozouf
26754a3230 [graph] Force same grid unit on orthonormal graphs
Change-Id: I2abca9eb1c4a14057323ee97e1044715f89620ff
2020-11-04 15:58:13 +01:00
Gabriel Ozouf
7322751453 [regression] Compute Y range for curve
Regression's automatic Y range used to rely on the Yauto feature. Since
it has been removed, it is now done in Store::setDefault.

Change-Id: I1b6653bb8ebe0ba99decff05bae29bd5a69a9f6c
2020-11-04 15:58:13 +01:00
Gabriel Ozouf
0f1e27b2b6 [apps/sequence] Add Y range to interestingRanges
The computation of Sequence's graph default Y range used to rely on
Yauto. As this feature does not exist anymore, this work is now done int
Sequence::GraphController::interestingRanges.

Change-Id: Idba8560d5f25d0bf34dd0e1dd98c2af67f427709
2020-11-04 15:58:12 +01:00
Gabriel Ozouf
1d4d56a7dd [apps/range_parameter_controller] Change margins
Reduce the top and bottom margin of the table view to better see the
Confirm button.

Change-Id: I71df479400c44a10fe75b8beaae1c81be305cdfd
2020-11-04 15:58:12 +01:00
Gabriel Ozouf
f0cd0694a6 [apps/shared] Activating Auto zoom resets cursor
Change-Id: Ib815286e1316e20f72b31d3d9206aa032b06eff4
2020-11-04 15:58:11 +01:00
Gabriel Ozouf
bf76b56f90 [apps/shared] Change Zoom button in curves
Zoom is now called navigate, and its button is placed before the Axes
button.

Change-Id: Ied194c20438e573a237ce36f221b9be87cfd4bab
2020-11-04 15:58:11 +01:00
Gabriel Ozouf
43d21180bc [apps/shared] Deactivate zoomAuto on pan and zoom
The Auto mode for curve ranges must be deactivated when moving the
cursor outside the screen and when activating navigation (formerly
Zoom).

Change-Id: I281a1d069c2ebcc30e7ead469c4f48438054d7c2
2020-11-04 15:58:11 +01:00
Gabriel Ozouf
5c67f92d18 [apps/interactive_curve_view_controller] Buttons
Add two new buttons to toggle Auto and Normalized modes for curves.

Change-Id: Ib583d087ce5ae779d24f6a8bbc72ab7140752dd5
2020-11-04 15:58:10 +01:00
Gabriel Ozouf
cc22b0d298 [apps/shared] Reset curve range to default in Auto
When the range is set to ZoomAuto, the range is recomputed before
displaying the curve.
2020-11-04 15:58:10 +01:00
Gabriel Ozouf
e2725c8e61 [apps/interactive_curve_view_range] Status markers
Add member variable m_zoomAuto and m_zoomNormalized to remember the
interactive range's status.

Change-Id: I77c43ddd683d3c6011742801139d23f5e20c99fe
2020-11-04 15:58:10 +01:00
Gabriel Ozouf
13d1b7077c [apps/shared] Removed method computeYRange
This method of InteractiveCurveViewRangeDelegate was only used to
compute the Y range when Yauto was on.

Change-Id: I9b688a87e16fc58c7d2b00eb071076b98f945df6
2020-11-04 15:58:09 +01:00
Gabriel Ozouf
8970e294aa [apps] Remove modelVersion from curves apps
The graph range used to be reset to default whenever all functions were
modified. As we no longer want to reset the range without the user's
input, we do not need to track whether the functions changed at all.

/!\ As of this commit, there is no longer a way to restore the default
zoom, until a new automatic zoom button is added.

Change-Id: Ie74e8fd61e13055fa6ce2b2d1e883182d4ecffce
2020-11-04 15:58:09 +01:00
Gabriel Ozouf
1a5661fd4c [apps/range_parameter_controller] Remove YAuto
This allows for a great deal of simplifications in the class
RangeParamterController.

Change-Id: I5de55d4e8e1f598eb13b08fb8f042907f55b2fa8
2020-11-04 15:58:08 +01:00
Gabriel Ozouf
5a07db3452 [apps] Remove "Preadjustments" menu for curves
Change-Id: I1a30efd502c5db36325d87fa0f1dffacc37a4f1c
2020-11-04 15:58:08 +01:00
Gabriel Ozouf
d2b36be846 [poincare/zoom] Move automatic zoom to Poincare
Change-Id: I7a70ab54b33b9150682cc4f999ff4999a8288b7f
2020-11-04 15:58:07 +01:00
Hugo Saint-Vignes
7499a9e0a4 [apps] Set Country from language in main.cpp
Change-Id: I09f6733fa36e8f0c7870bc26eb8662cda79ae715
2020-11-04 15:58:07 +01:00
Hugo Saint-Vignes
5339d9e7b4 [apps/shared] Add static assert for cache steps
Change-Id: I77498775b4caf3d97522219d2a7c979601b985e8
2020-11-04 15:58:07 +01:00
Hugo Saint-Vignes
4acbf3346b [apps/shared] Add comments and minimize threshold
Change-Id: Ieb56513ea0a7fab35acf15531277aec5cd6071ca
2020-11-04 15:58:03 +01:00
Hugo Saint-Vignes
ebe207d67d [apps/shared] Fix cache overlap when plotting polar curves
Change-Id: I4b1d6dccdedc5b3cea455e2ad2038336b4b48064
2020-11-04 15:55:40 +01:00
Arthur Camouseigt
b567a09103 [VariableBox] Allowing sequences to display their type
Change-Id: I2929f7d9f3a266fbff81100a39f793fe6200da1d
2020-11-04 15:33:05 +01:00
Léa Saviot
ad80c2c4d7 [ion/keyboard] Do not define constexpr arrays in headers
They are duplicated in each compilation unit where they are called
2020-11-04 15:33:05 +01:00
Hugo Saint-Vignes
697f727429 [apps/shared] Add discard confirmation on range parameters
Change-Id: I609acbd136cb0bc84899777810f4c1497832952f
2020-11-04 15:33:05 +01:00
Hugo Saint-Vignes
3705ce4f92 [apps/graph] Add discard confirmation on domain parameters
Change-Id: I61043aa195f10038bbcfb6c091f08e684db20849
2020-11-04 15:33:04 +01:00
Hugo Saint-Vignes
150a5bfa5a [apps/shared] Add discard confirmation on table intervals
Change-Id: Id152577c570febf06b4d829fd2723c2a30c3ccd9
2020-11-04 15:33:04 +01:00
Hugo Saint-Vignes
bd23135198 [apps/shared] Add Discard confirmation pop-up
Change-Id: Ida3878894090ecfa99145618b8e1ff0bbcb4743a
2020-11-04 15:33:04 +01:00
Arthur Camouseigt
91dc5eb5ec [Sequence Graph] Fixing the banner to display u(n)
The banner used to display u(n+1)/u(n+2) if the sequences were not
explicit. This was incorrect and fixed

Change-Id: I59100942b51f4170d9662a6fd7b82d0f7e50ae6f
2020-11-04 15:33:04 +01:00
Arthur Camouseigt
bf95b460c3 [Sequence] Fixed computation error and asan fails
Change-Id: Ib3a619d29bee5cc6f10b939ee066459a5b135c5d
2020-11-04 15:33:04 +01:00
Arthur Camouseigt
86d0c19293 [ok view] Fixing the grey tone of the ok symbol
Change-Id: Id65a4e37c41e1b675178d3220c15ebfe26b1e71e
2020-11-04 15:33:04 +01:00
Arthur Camouseigt
bf0f6c7a33 [Global Context] Fixed rank approximation error for sequences
Change-Id: I29c0a55956aee8764e50650b229a49aa8a0f9336
2020-11-04 15:33:04 +01:00
Émilie Feral
f64a650ef6 [apps] I18n: localize Dutch exam mode messages 2020-11-04 15:33:04 +01:00
Martijn Oost
8f117e9d4e [NL] correct spelling mistake 2020-11-04 15:33:04 +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
Gabriel Ozouf
25ab4b2a52 [shared/localization_controller] Table cropping
Forced the top cell of the country table to be cropped in the middle,
cutting the text, to avoid the cell looking squashed.

Change-Id: I4d126ed19249f47652bd7f2001384b2491cfe6f8
2020-11-04 15:33:03 +01:00
Hugo Saint-Vignes
b051242f2b [test] Avoid high precision number approximation
Change-Id: I88537653cea2a399581e9686bd027c9d20953667
2020-11-04 15:33:03 +01:00
Hugo Saint-Vignes
a326a1f9ff [poincare] Fix approximation test
Change-Id: I0951e01acf7266e33d05f40de3119b73c656b9a2
2020-11-04 15:33:03 +01:00
Hugo Saint-Vignes
d224778330 [ion/simulator] Temporarly increase stack size on simulator
Change-Id: I0f27277ea704f81e316c7ff78fb7bed8c70ff4ae
2020-11-04 15:33:03 +01:00
Hugo Saint-Vignes
fa9c9c1567 [apps/regression] Add todos for logistic regressions
Change-Id: If2ddc0527d8be89970803de240a6760d037570e2
2020-11-04 15:33:03 +01:00
Hugo Saint-Vignes
e517128a9e [apps/regression] Compute R2 better when dealing with constant regression
Change-Id: Ic724d8d96cb723718a1ce57e72132972a782fc5e
2020-11-04 15:33:03 +01:00
Hugo Saint-Vignes
3f43504398 [poincare] Check for nan values when inverting matrix
Change-Id: Idb542682003348da151975e635958cf909010d16
2020-11-04 15:33:03 +01:00
Gabriel Ozouf
ab864d10d8 [ion/events] Compare event for repetition
This fixes the following bug :
  (Anywhere with a movable cursor, like a table, a text field or a curve)
  - press Alpha (once, or twice to activate the lock)
  - keep pressing a direction
--> The cursor would only move once.

Change-Id: I46115d1a31ced244615bfdfe08f37dfe7e918d6e
2020-11-04 15:33:03 +01:00
Gabriel Ozouf
d8e6b63a2e [sequence] Type stays selected in menu
- Create a first-order recursive sequence
  - Select u_n -> Sequence type
--> The second line will be selected, as expected.

Change-Id: I2025ebaa9a7b49ee33ff5e63a4c767a858b46850
2020-11-04 15:33:03 +01:00
Émilie Feral
7168188a44 [ion] Simulator apple: fix rule_label for assets 2020-11-04 15:33:03 +01:00
Martijn Oost
388d1a785e [apps/calculation] Update NL translation
Change NL definition in additional results
2020-11-04 15:33:03 +01:00
Émilie Feral
64ff5b4c70 [app/shared] CurveView: simplify implementation of
pixelLengthToFloatLength (avoid avoidable overflows)
2020-11-04 15:33:03 +01:00
Émilie Feral
5b4fc6ff84 [apps/shared] CurveView: implement CurveView::pixelLength(Axis) 2020-11-04 15:33:03 +01:00
Émilie Feral
d6751e6e03 [apps/shared] CurveView: improve floatLengthToPixelLength to avoid
useless computations (and potential overflowing)

This fixes the drawing of arrow(100,100,0.1,3) in matplotlib module of
python
2020-11-04 15:33:02 +01:00
Gabriel Ozouf
5d3069ff34 [code/catalog] Capitalize 'line feed' in EN
Change-Id: I91b8c4b613b9e9dece13fbb0e9635b4aa8dbfd4a
2020-11-04 15:33:02 +01:00
Gabriel Ozouf
c1b0465ca4 [apps/i18n] Add 'Metric' message
'Metric' is used to label the toolbox sub-menus containing metric units
when the selected country uses the imperial system.

Change-Id: I6f40bcd3151be614a5a02cdd17c70ea4a91bfc00
2020-11-04 15:33:02 +01:00
Gabriel Ozouf
bad0c81bf0 [apps/math_toolbox] Rearrange unit toolbox
The layout of the unit toolbox changes depending on the unit system in
the selected country.
All units have been rearranged by increasing order of magnitude.

Change-Id: Ib51759cca88fd6b6122dd5a3a25b8ed04024aaf3
2020-11-04 15:33:02 +01:00
Gabriel Ozouf
2e2845370a [apps/math_toolbox] Add fork nodes in tree
Some nodes of the ToolboxMessageTree can be marked as "forks",
dispatching one branch or the other depending on preferences.
They are used in the Unit menu to provide a different toolbox depending
on the unit system.

Change-Id: I591f7abc3d24e682e827a540a9defac1877871b5
2020-11-04 15:33:02 +01:00
Gabriel Ozouf
6105f44a46 [escher/toolbox_message_tree] Add indirection
The children of a ToolboxMessageTree object can be stored as a simple
pointer, representing an array of all the children stored consecutively,
or as a double pointer, representing an array storing the addresses of
all children.

Change-Id: I10134684963aaafc635aaf9a2374d0f3c32d3d0c
2020-11-04 15:33:02 +01:00
Gabriel Ozouf
f777cad3f7 [kandinsky/font] Degree symbol
Aligned the top of the degree symbol ° with the top of capital C and F,
and reduced its right margin.

Change-Id: I63f50654afd965186400e451d71be41add9556c8
2020-11-04 15:33:02 +01:00
Gabriel Ozouf
0c1d0195cd [poincare/unit] Check uninitialized expressions
In Calculation, keeping the BACK key pressed can lead to iffy
simplifications and uninitialized expressions beign passed to
ShouldDisplayAdditionalOutputs and SetAdditionalExpressions methods.

Change-Id: If248ab193c471ff433828fc841e01a391e0c052d
2020-11-04 15:33:02 +01:00
Gabriel Ozouf
bc7ca057a0 [apps/calculation] Add Joules to results on energy
Change-Id: Ib775b1bd2bac1fd3bf755a9a4d3d5b3739a67cfa
2020-11-04 15:33:02 +01:00
Gabriel Ozouf
10f8e2f507 [poicare/unit] Rename method
hasAdditionalExpressions -> hasSpecialAdditionalExpressions

Change-Id: Ia5200402b23ab5adf0f94dabe027955a86d1174d
2020-11-04 15:33:02 +01:00
Gabriel Ozouf
ddbe76fec5 [poincare/unit] Add missing additonal results
Additional results are proposed for all units combinations that include
a non-base unit, in addition to units with special results.

Change-Id: I91f2a1a43c72bad0327132396534a223e87b06a2
2020-11-04 15:33:01 +01:00
Gabriel Ozouf
4e771fdb54 [poincare/unit] Missing prefix reset
When tuning the representative without tuning the prefix, the prefix
would not be reset to its default value, causing a problem for masses,
whose base prefix depend on the representative (k for grams, none for
the rest).
Fixes a crash when typing sqrt(_N) with country set to US.

Change-Id: Iade900de5fb31e06fdfafef34ae27da3f36983fa
2020-11-04 15:33:01 +01:00
Gabriel Ozouf
d862d5503c [poincare/unit] Fix rational exponent rounding
In metric, sqrt(N) would be simplified to _N_kg^-0.5_m^-0.5_s instead of
_kg^0.5_m^0.5_s^-1.
We solve this issue by preventing simplification using derived units
in presence of rational exponents.

Change-Id: I97118bb32c963809c8d176b7b297d1682965e9af
2020-11-04 15:33:01 +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
4d0950fa1e [ion/simulator] Handle typing % on simulator
Change-Id: Ib47786659e710e473f75d1c6887a9794fad0a75f
2020-11-04 15:33:01 +01:00
Gabriel Ozouf
ac2dd9cdf0 [i18n] Translated "Tonne" to "Metric Ton"
Change-Id: I515d78445065a94cc387781ee87a5fa23b3c2df2
2020-11-04 15:33:01 +01:00
Gabriel Ozouf
586e53bb42 [i18n] Set International as default country
When launching a firmware without onboarding, starts with International
selected by default instead of Canada.

Change-Id: Ice5cde4210c4c2934c909d97296460707343773f
2020-11-04 15:33:01 +01:00
Hugo Saint-Vignes
073893ae48 [poincare] Exact undef results with GCD and LCM
Change-Id: Iba39cd6140d8ef5b3fd24e0f53c9e28fbd57d438
2020-11-04 15:33:01 +01:00
Hugo Saint-Vignes
a89878a24d [poincare] Allow more BinomialCoefficient exact results
Change-Id: I9dbbf9471ee6d9e12fe4861a5b11990858382562
2020-11-04 15:33:01 +01:00
Gabriel Ozouf
857ca4eecd [poincare/trigonometry] Fix wrong use of pi
In Trigonometry::shallowReduceInverseFunction, the reduction of
atan(1/x) used the hard value of pi instead of its equivalent in the
selected angle unit.
This fixes a bug causing atan(1/tan(40°)) to be equal to π/2-40 instead
of 50.

Change-Id: Ifd7df5cd168fadf3146eee168c0bc2136ea15a7b
2020-11-04 15:33:01 +01:00
Hugo Saint-Vignes
91d9438421 [poincare] Fix forbidden array access
Change-Id: I3de76c114f6712ee08007601766577d87ed96877
2020-11-04 15:33:01 +01:00
Hugo Saint-Vignes
7e5ddcd36b [python/turtle] Prevent position overflow from turtle
Change-Id: Ieb8a7b64bab1ce6fac23ca4c8dcb43467b8d4d5c
2020-11-04 15:33:01 +01:00
Gabriel Ozouf
6a9a5dbe27 [i18n] Factor duplicate messages in universal
Units with the same name in all available languages have been moved to
the new file toolbox.universal.i18n.

Change-Id: I82ef362ca335dc61da5f3bca67714a9ae409793d
2020-11-04 15:33:01 +01:00
Gabriel Ozouf
63076758a3 [i18n] Check for redundancy in localized messages
After parsing the .i18n files, compare the messages and raise an error
if some of them could be factored into a universal file.

Change-Id: I0dcfe309dc4c310555a0ea16b6d1680e51a8e87d
2020-11-04 15:33:00 +01:00
Arthur Camouseigt
3019609946 [Sequence] Fixing display issue in sequence graphs
Change-Id: I1b914c31cf2e7a84329e86486e30f3a7244f235d
2020-11-04 15:33:00 +01:00
Gabriel Ozouf
64e7057d50 [apps/on_boarding] Remember language choice
When choosing a language and then pressing back from the country menu to
get back to the language menu, the previously selected language remains
selected.

Change-Id: I018c51cce09d47b15bb4864c135d381a94b2a72f
2020-11-04 15:33:00 +01:00
Gabriel Ozouf
54c28fc87f [escher/modal_view_controller] Hide regular view
Do not display the regular view when the main view takes up all the
frame.
This fixes a bug causing the language menu to be briefly visible before
the logo on start-up.

Change-Id: Ia2de44de52ac6f852e0eca05101587042f02913b
2020-11-04 15:33:00 +01:00
Gabriel Ozouf
77ac333e11 [on_boarding/i18n] Localize contact email address
Change-Id: I19ae4299e09b63c373734ddff835fedcabb6749c
2020-11-04 15:33:00 +01:00
Arthur Camouseigt
6a84ba2523 [global_context.cpp] Fixing sequence bug
u(n+2) = u(n+1) + u(n) + u(2)
u(0) = 2
u(1) = 2
Crashed because the global context was not checking if the sequence was
badly referencing itself

Change-Id: I97f694955e15518bb088db50deb761d7ee09d75f
2020-11-04 15:33:00 +01:00
Gabriel Ozouf
d5ce234d4d [probability] Align snapshot buffers
char buffers m_distribution and m_calculation had too weak an alignment,
causing a crash when starting the web simulator.

Change-Id: Ibfd3c2582bc4de97beb4d6cc51b9fb86300edb5e
2020-11-04 15:33:00 +01:00
Gabriel Ozouf
4bde3ed4b0 [poincare/solver] Fix type ambiguity warning
Change-Id: I9248080520d6fa6430dddb8811dbd0120fc08d79
2020-11-04 15:33:00 +01:00
Gabriel Ozouf
28d18dd6a5 [ion/utf8_helper] Signedness and capitalization
Change-Id: I3451a206fbd45a490eea0115621c07abb868344a
2020-11-04 15:33:00 +01:00
Gabriel Ozouf
bd068312d9 [apps/continuous_function_cache] Clear on bad step
Cache did not check that the step was the same before panning, causing
old values to remains cached.
e.g. :
  - Type f(x) = x, and plot it.
  - Go to Axes, and set Xmax = 0.
  - Confirm

Change-Id: Ie8ed10c336cf517a65f19b05bd14866daf8128c2
2020-11-04 15:33:00 +01:00
Gabriel Ozouf
3f19d66c78 [poincare/unit] Change temperature symbols
Celsius and Fahrenheit now use the degree symbol °.
  _Cel -> _°C
  _Fah -> _°F

Change-Id: Ic5935d3a6263a556692bebb6254b6b6d4de48431
2020-11-04 15:33:00 +01:00
Gabriel Ozouf
67e6e38825 [poincare/parsing] Parse degree sign ° in units
Change-Id: I518aba17214b049dfa8fd3b89f4ce124dbd6b41a
2020-11-04 15:33:00 +01:00
Gabriel Ozouf
d37540f032 [poincare/unit] Add Celsius and Fahrenheit
Temperatures can be converted to and from degree Celsius and Fahrenheit.
When used in non-trivial calculations, they are always reduced to undef,
as the rules for manipulating relative scales are not well defined.

Change-Id: If59e224a0e7f940b421bc894bbe2279c90f38d04
2020-11-04 15:33:00 +01:00
Arthur Camouseigt
4274b558b6 [Sequences] Changing the name of CacheContext to SequenceCacheContext
Change-Id: If2d542748f6f7b2363d6c1443f88c058475945eb
2020-11-04 15:32:59 +01:00
Arthur Camouseigt
960335c330 [Sequences] Fixed a few crashes
Change-Id: Ib929bbae0f9ca06409706336ff799075e1288694
2020-11-04 15:32:59 +01:00
Gabriel Ozouf
26bbdead7d [apps/shared] Allow movement from undef curve
Fix a bug preventing the cursor from moving to other curves using UP and
DOWN when the y value was undef.
To reproduce :
  - In Graph, define f(x) = 1 and g(x) = ln(x), then draw the curves
  - Press DOWN to select g
  - Press LEFT until g is not defined anymore
--> Pressing UP or DOWN won't allow you to select f

Change-Id: I79ed4a57b78ac0b8dac3f66e722e358bd4be18d9
2020-11-04 15:32:59 +01:00
Hugo Saint-Vignes
c130f8e881 [apps/shared] Prevent KDPoint overlfowed translation on cursorFrame
Change-Id: Ifc32eefaf4241d59d7567cadb9b2962ba5efb4d9
2020-11-04 15:32:59 +01:00
Arthur Camouseigt
ea36c6e5d7 [Clipboard] Changed the general copy/paste
Fixed issues due to copy/paste of empty formulas. When pasted, empty
formulas are now recognized by the parser and apear with the
correct layout

Without this process, copying an empty integral then pasting it gives :
int((), x, (), ()) instead of drawing an empty integral

Change-Id: I680aaf4eea953149e2d57efa8153ab4d3f93e2a7
2020-11-04 15:32:59 +01:00
Arthur Camouseigt
8f97a332f6 [Python] Modified the paste effect in script and shell area
When a formula is pasted in a script or in the shell, some symbols are
replaced by their equivalent in python :
x turns into *
^ turns into **
√ turns into sqrt
etc
Change-Id: If6f2a22d4f3c148c2655e0892023b0e28058a9a6
2020-11-04 15:32:59 +01:00
Gabriel Ozouf
4b965a0ff6 [shared/localization_controller] Add top border
When selecting a country, the table would be cropped by the text, with
no separator between the white of the cropped cell and the background
color.

Change-Id: Ia6be40bce40b7cdb3efa064989d45ef5c046e364
2020-11-04 15:32:59 +01:00
Arthur Camouseigt
913c81a0d3 [solver] Modified the way to solve some equations
The solutions of equations that need numerical approximations to be
solved are now computed base on the undeveloped equation (instead of
fully the expended one used to identify polynomials)

This allow (x-10)^7=0 to yield x=10 as result (9.95 before)
Change-Id: Ia8acbe57a9cfebf0b5016e9c896d21c8ddac7a64
2020-11-04 15:32:59 +01:00
Gabriel Ozouf
6e9a5a010f [poincare/integer] Add tests on euclidean division
This commit also adds tests on mixed fractions.

Change-Id: I0fee88eb00febccaa9445230f8f2bbb92cd1ba98
2020-11-04 15:32:59 +01:00
Gabriel Ozouf
bad21f0ab5 [poincare/integer] Fix negative mixed fraction
Mixed fractions for negative rational numbers are now computed as the
opposite of their opposite's mixed fraction, as is conventionnal.
ex : -9/5 is now decomposed as -1-4/5 instead of -2+1/5

Change-Id: I6df3dce585ccadd1bcd7cc562576995face98f9c
2020-11-04 15:32:59 +01:00
Hugo Saint-Vignes
b92c819ea2 [escher/src/text_area] Add char limit in text_area line
Change-Id: I9284936f0202d788edc785aa3f7c82b45ab34cf5
2020-11-04 15:32:59 +01:00
Arthur Camouseigt
51002066e9 [sequence] Fixed crash due to undefined sequence
Change-Id: Ie67ff4aa9a53eb8b04535e3b61737e11c9049316
2020-11-04 15:32:59 +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
fa0e8de0a9 [VariableBoxController] Changed the way sequences appear
Change-Id: I45a1cb01ab9c5aefd298c40050e69850a4cc5c71
2020-11-04 15:32:58 +01:00
Arthur Camouseigt
1d71a14d2c [Context] Modifying context method signature for sequences
This allows sequences to be used in functions by calling u(x)

Change-Id: I336e84a19bf9b3dd0f2e435d1aaebda3c9e71ec8
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
Arthur Camouseigt
c006ed7b10 [Sequence & Shared] Changed the location of various files
Moved sequences files to shared in order to allow the system to compile
without the app sequence.

Change-Id: Ia8349814a72776244acc41af964059f24e58cff0
2020-11-04 15:32:58 +01:00
Arthur Camouseigt
ed358590ce [Sequence] Changed the way sequences are parsed
Change-Id: If19b46a317e4f336ac857690827ab08e147ac75a
2020-11-04 15:32:58 +01:00
Arthur Camouseigt
8434da60ef [sequence] Changed sequences behavior
Sequences can now be defined using specific terms form other sequences :
Un = n
Vn = u(3)

Initial values can also depend on other sequences.
Should there be a circular dependency, the sequences concerned will
display "undef" as value

Change-Id: I6fe1f3ff7b500f35d480ddefb42de729c327432e
2020-11-04 15:32:58 +01:00
Hugo Saint-Vignes
688394abce [ion] Set stack pointer when testing as well
Change-Id: Ibeae7961535208c224f9ac51f4cf33e3978665b3
2020-11-04 15:32:58 +01:00
Hugo Saint-Vignes
e199143412 [apps/shared/curve_view] Small binary code size optimization
Change-Id: I4b61506edb434cb901a6fb92ef5c145f43c51035
2020-11-04 15:32:57 +01:00
Hugo Saint-Vignes
8fdec305c4 [apps/graph/test] Fix caching test
Change-Id: I536d1422ca6c9ecded66f7876ae019aaf5742005
2020-11-04 15:30:54 +01:00
Hugo Saint-Vignes
70a628f2c8 [apps] Fix Python assert crash on malloc free
Change-Id: I48f86422f7d6af5227e2556e6ef531dfad696da4
2020-11-04 15:30:53 +01:00
Gabriel Ozouf
d917b2e1c9 [poincare/unit_convert] Fix improper reduction
In UnitConvert::shallowBeautify, an orphan expression would be reduced
without reaffecting the reduction's result. The reduction not being
taken into account would cause problem when handling undef values.
ex : Try to calculate i->_min

Change-Id: I4e53afa40ba838fed8c2fba9944c9c9ed1dc95b4
2020-11-04 15:30:53 +01:00
Arthur Camouseigt
1995781a9f [Poincare/IEEE754] Changed methods to use std function
Implemented std::nextafter to replace hand made one.
Methods next and previous are no longer making the difference between -0
and +0

Change-Id: I42e1a073623b70656d9df954694803840cf3088c
2020-11-04 15:30:53 +01:00
Martijn Oost
338968a493 improved translations in toolbox and the calculation, python and functions app 2020-11-04 15:30:53 +01:00
Arthur Camouseigt
ae43ec0cc9 [Poincare/layouts] Fixed a crash due to infinite loop
Change-Id: Ieb6563dd978c5c363326163b983b40ed13dab913
2020-11-04 15:30:53 +01:00
Gabriel Ozouf
a6db9688cd [apps/function] Factorize zoom in Function class
The new zoom implemented for ContinuousFunction is now factorized inside
Function to benefit the Sequence class. The same things is done to code
added to Graph::GraphController, which is moved into
FunctionGraphController.
This removes the reimplementation of several methods, most notably
computeYRange, as the implementation for function is general enough to
work on sequences.

Change-Id: I9b8211354064f46c3fa3dde3191dcb39d627a1d2
2020-11-04 15:30:53 +01:00
Gabriel Ozouf
33f9bb50a3 [apps/continuous_function] Forced X axis display
The auto zoom did not display the X axis when drawing positive curves
with roots, such as sqrt(x).

Change-Id: Ic80fd3207691dc917f7b64c07d7745ab5df1daa3
2020-11-04 15:30:53 +01:00
Gabriel Ozouf
a1aefb0cb2 [apps/graph] Added tests on graph ranges
Change-Id: I6c080f40c934cd31083be3d19aa0a4d0bb33c5cc
2020-11-04 15:30:53 +01:00
Gabriel Ozouf
17f39e5e39 [apps/graph] Take cursor into account for Y range
Additional checks have been added to ensure that the first move of the
cursor from the center of the graph would not cause the window to pan up
or down.

Change-Id: I44d7e86223941076cbf03db7a221e9c0427a64e4
2020-11-04 15:30:53 +01:00
Gabriel Ozouf
0ed0cc56e9 [poincare] Remove characteristicXHalfRange
Method characteristicXHalfRange was used to compute the range on which
to display cartesian function in Graph. With the new zoom algorithm,
this method is deprecated.

Change-Id: Ic681fab8d58d0f5628a94302a7b49dacaaa1a6a3
2020-11-04 15:30:53 +01:00
Gabriel Ozouf
8104caea50 [apps/shared] New automatic zoom on curves
Initial zoom for displaying curves is computed according to the
following rules :
  - For polar and parametric curves, the algorithm has not changed.
    Vertical and horizontal ranges are chosen in order to display the
    full curve with orthonormal graduations.
  - For cartesian curves, the horizontal range is chosen in order to
    display all points of interest (roots, extrema, asymptotes...).
    The vertical range is fitted to be able to display those points, but
    also cuts out points outside of the function's order of magnitude.

Change-Id: Idf8233fc2e6586b85d34c4da152c83e75513d85c
2020-11-04 15:30:53 +01:00
Gabriel Ozouf
1917999f6d [poincare/unit] Fix crash with Units in Graph
In Graph, the weak ReductionTarget would cause _X^0 to not be simplified
to 1, and would break an assertion in
Unit::chooseBestRepresentativeAndPrefix.

Change-Id: I8167a472802baf0a73bf48513f492e78517107ef
2020-11-04 15:30:53 +01:00
Gabriel Ozouf
9be5e7671c [apps/settings] Fix broken assert
Pressing OK or EXE with the brightness setting selected would cause a
crash because of a mishandling of the events for this cell.

Change-Id: I4978b4f749b5f19bc1e49ec05b60a32044d86638
2020-11-04 15:30:53 +01:00
Gabriel Ozouf
d6c7b2b1ac [poincare/multiplication] Factoring undef power
When factoring 1^inf * 1^-inf with Multiplication::factorizeBase, an
Undef factor would appear an be carried into the reduced multiplication.
We escape early in this situation by returning Undef.

Change-Id: Id826ad3cc131349e5bb460f7a8c82fe606294b97
2020-11-04 15:30:53 +01:00
Hugo Saint-Vignes
59d5adace3 [apps/shared] Optimize polar curve range display
Change-Id: Ic1b044212711d1f73e147cb0857084ff9d61fbd9
2020-11-04 15:30:53 +01:00
Hugo Saint-Vignes
0e11760f08 [apps/shared/curve_view] Improving performances for non cartesian curves
Change-Id: Ie1a9a6450e8f92ceaf93c5fe78711640be175e9e
2020-11-04 15:16:55 +01:00
Hugo Saint-Vignes
d937bc692b [apps/code] Fix crashes on full buffer
Change-Id: If9297f1ca29015cad0cc1cdda3ad610fd1493392
2020-11-04 15:11:45 +01:00
Hugo Saint-Vignes
aba135bc8b [escher] Add textArea line number limit
Change-Id: Ia0d9a9136282efc87c0996c141c0852ed75892f9
2020-11-04 15:11:45 +01:00
Hugo Saint-Vignes
52f83eb682 [apps/shared] Halve k_parametricStepFactor to maximise cache hits
Change-Id: Ibe3c441e4af88277d1e4594801b805336a1f3e0b
2020-11-04 15:11:45 +01:00
Gabriel Ozouf
db4a1b0265 [poincare/tests] Add tests on power layout
Change-Id: Ic7b0fbf87eec528221a4f836d34e1736e219ab96
2020-11-04 15:11:45 +01:00
Gabriel Ozouf
7c27440916 [poincare/layout] Tracking issue in addSibling
The addSibling method sometimes did not take into account the offset
introduced by adding parentheses, leading to some issues :
  - Type 2 SQUARE RIGHTPARENTHESIS LEFT SQUARE. Parentheses are added
    but the new square should be outside, between the two right
    parentheses.

Change-Id: Ifbc49cee2cd03c4511fc5a678d6d5d42243f4a22
2020-11-04 15:11:45 +01:00
Gabriel Ozouf
be8e452285 [poincare/layout_cursor] Fix cursor after Square
When typing Square in 2D Edition mode, the cursor would not be
repositionned correctly, leading to some issues :
  - Typing 2 POW 3, pressing RIGHT to return to the baseline, then
    typing POW again adds parentheses around 2^3, as is mathematically
    correct. Typing 2 SQUARE, then POW, would show 2^2^_, while
    the user really typed (2^2)^_.

Change-Id: I29c01d964924907a1866490189ea56e40771521d
2020-11-04 15:11:45 +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
df6383d2d8 [apps/i18n] Added default country for languages
After choosing a language at onboarding, the country menu now has a
specific country selected by default (Spain for Spanish, Italy for
Italian...)
Default countries are specified in apps/language_preferences.csv

Change-Id: Ia6392aceb9bebf7e62a692c5a79eb8c4d7b71a9d
2020-11-04 15:11:45 +01:00
Gabriel Ozouf
ec6ee82b81 [poincare/multiplication] Imperial volume display
With the imperial system selected, volumes are expressed as volume in
Calculation's results, instead of cubic lengths.

Change-Id: Ib6c0a1a595dce8ae8db6371b41af818b3fdc6236
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
801c61549c [poincare/unit] Change units for volume split
In additional outputs, a volume is now splitted as :
  _gal+_qt+_pt+_cup
instead of :
  _gal+_cup+_floz

Change-Id: I5020afbab23be6331d8a8742fd6295db178f0b37
2020-11-04 15:11:45 +01:00
Gabriel Ozouf
5e06f62ff6 [poincare/unit] Symbols for cup and tablespoon
_cp   -> _cup
_Tbsp -> _tbsp

Change-Id: Ied3e1624edc980f76c2f775cbb9e6028db8a83c5
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
e48e826536 [poincare/test] Updated tests on units
Change-Id: I7c146174bcedcccc3ed31a298c9720aa2a5ba3a9
2020-11-04 15:11:45 +01:00
Gabriel Ozouf
1f3c4b66a0 [poincare/unit] Changed imperial units definitions
Imperial units are now defined directly from the base unit, instead of
building on one another.

Change-Id: Ieb020643983ef49092d2d3033a7cc2135c646015
2020-11-04 15:11:45 +01:00
Gabriel Ozouf
87dd1b6310 [apps/i18n] Translate imperial units
Change-Id: I8f586b752c0c2114dfb656e34c9b9d928c5b6c59
2020-11-04 15:11:44 +01:00
Gabriel Ozouf
f288573db0 [apps/unit] Add short and long tons
Change-Id: Ib48c6a7c773e9e1d18c9f55e6dda5330fe0a28f9
2020-11-04 15:11:44 +01:00
Gabriel Ozouf
284c501532 [apps/unit] Add restriction to some input prefixes
The symbol for pint (_pt) conflicts with the symbol for pico-tonne. To
solve that, prefixes for tonnes are now restricted to the positive
prefixes : k, M, G, T.

Change-Id: Ie968374bbb5e0ebd2c0f08e4b1bdc1708eb6a041
2020-11-04 15:11:44 +01:00
Gabriel Ozouf
b2f81db4a9 [apps/home] Apps placement defined by country
Instead of relying on the order in which the apps are passed at compile
time, the look of the Home app is defined in a config file, and depends
on the country chosen.

Change-Id: If7f56a284e0001d6d75ece1e7efdf5fd1d0a9978
2020-11-04 15:11:44 +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
3ff25fb5c1 [poincare/unit] Standard unit methods
Added methods to return the standard format for each dimension,
depending on the chosen unit system.

Change-Id: I3591a806beca315674cc09093b57e8753db5db6a
2020-11-04 15:11:44 +01:00
Gabriel Ozouf
9f40e45b20 [poincare/unit] Split for several dimensions
A split (such as _h+_min+_s) can now be generated for distances, volumes
and masses using imperial units.

Change-Id: Ib3ad63614979eddd02fbe0e99f16cf09dcf7c1fc
2020-11-04 15:11:44 +01:00
Gabriel Ozouf
4d9f3aae97 [poincare/unit] Generalized BuildTimeSplit method
BuildTimesplit (used to create expressions of the form h+min+s) is now
based on the more general BuildSplit.

Change-Id: I3e55359cc6b9735269140942b29bd1d364fc35e7
2020-11-04 15:11:44 +01:00
Gabriel Ozouf
5a31a6c1e2 [poincare/unit] Output units based on region
When the country is USA, the units will be simplified to common imperial
units rather than metric.

Change-Id: Ia533527a429ac26526380e324b9543b359f3b400
2020-11-04 15:11:44 +01:00
Gabriel Ozouf
62f598110e [apps/shared] Created LocalizationController
Classes LanguageController and CountryController have been fused into
one class LocalizationController, as they were very similar. This allows
the Settings and OnBoarding apps to only keep one controller for both
functions.

Change-Id: Ic23f300c37122249d34caaf18a633b5815240a78
2020-11-04 15:11:44 +01:00
Gabriel Ozouf
5749d871b0 [apps/i18n] Moved country preferences
Instead of being hardcoded in the python script, preferences specific to
each country are defined in the country_preferences.h and .csv files.

Change-Id: I71e276341e1586935b4d5814be5b1be80fa170a0
2020-11-04 15:11:44 +01:00
Gabriel Ozouf
8121400cf2 [apps/i18n.py] Method for printing lists
New methods print_block_from_list factors code used to generate enum
classes and arrays.

Change-Id: I4ce7d22c3ffca4f12b9439f88ce288fcf9b85090
2020-11-04 15:11:44 +01:00
Gabriel Ozouf
2b59509fdd [apps/i18n] Derive preferences from country
Each country comes with an set of preferences, built at compile time by
apps/i18n.py, used to define :
  - the exam mode
  - the method for computing quartiles
  - the unit system in which to output the results with units
Functions to access those preferences are available in
via sharedGlobalPreferences.

Change-Id: I220ebaa9b9e8954dfe33cd51936f47505b98978d
2020-11-04 15:11:44 +01:00
Gabriel Ozouf
e2a6edd78f [poincare/preferences] Added UnitFormat preference
The UnitFormat can either be Imperial (for the US) or Metric (for the
rest of the world.

Change-Id: Ic698e6732f1fa225d88a14e61751b775fe70f1ab
2020-11-04 15:11:44 +01:00
Gabriel Ozouf
4d6682e211 [poincare/unit] Added imperial units
The new units are :
  distance    mile, yard, foot, inch
  mass        pound, ounce
  volume      gallon, quart, pint, cup, fluid ounce
              table spoon, tea spoon

Change-Id: I6864067a1822a077764ed3b61fc46004732e9447
2020-11-04 15:11:44 +01:00
Gabriel Ozouf
ea127cdfa9 [apps/statistics] Added tests for all countries
As some definitions now depend on the selected country, tests for the
statistics app now check that the right method is used for each country,
and that each method yields the correct results.

Change-Id: Ia5ad091136746f3284f7524376301fac0c582364
2020-11-04 15:11:44 +01:00
Gabriel Ozouf
86f7a87d45 [apps/statistics] International quartiles
Implemented a new method for computing quartiles, used for all countries
except France and Italy. Quartiles are now computed as the medians of
the lower half and upper half of the dataset.

Change-Id: Idfb89a617799eca1d23326ebbcfbbea58e6236b8
2020-11-04 15:11:44 +01:00
Gabriel Ozouf
8d362ef4de [apps/settings] Added message to country menu
Change-Id: Iec064d0ac86f54a10cf63236b6f958d53cecb2e2
2020-11-04 15:11:44 +01:00
Gabriel Ozouf
b35cdca9bb [apps/exam_mode] Country-locked Dutch exam mode
The Dutch exam mode is now only accessible when the selected country is
Netherlands on an official firmware.

Change-Id: I6d70f79b6e728482d8c7d86ef6a2e5c53ee18a39
2020-11-04 15:11:44 +01:00
Gabriel Ozouf
509a7e4628 [apps/on_boarding] Added country to onboarding
Change-Id: I55c50330baf226826e44467756bcd9e5c89d4262
2020-11-04 15:11:44 +01:00
Gabriel Ozouf
a96b5d1bc4 [escher] Typo in StackViewController
Change-Id: I13bdd05759fd2f0bc6911adafe8950e46c2bfe85
2020-11-04 15:11:44 +01:00
Gabriel Ozouf
fe25118d04 [apps/shared] Sorted countries in menu
Country names now appear in alphabetical order in the menu, depending on
the chosen language.

Change-Id: I57b8ce0a7120a3c8a433ce1b05628842c4d0aeb5
2020-11-04 15:11:44 +01:00
Gabriel Ozouf
51747d3d36 [apps/settings] Added country to settings
Refactored Settings::MainController::handleEvent

Change-Id: Id8ad604183a64520dd785356514e87fddc50354c
2020-11-04 15:11:44 +01:00
Gabriel Ozouf
1642276678 [apps/shared] CountryController
Created a CountryController class to chose the country in the settings
and at onboarding.

Change-Id: I6787e8b45744a8a98e83f59e5d2c4760364635cb
2020-11-04 15:11:44 +01:00
Gabriel Ozouf
3f9b8f03af [apps/global_preferences] Added country preference
Change-Id: Ifbe09e2a24b4e1b9386f323bd5ebd9bed7fc8440
2020-11-04 15:11:44 +01:00
Gabriel Ozouf
d156c8c99e [apps/i18n] Added country support
Added a list of supported countries to I18n, and created messages for
each country's names in each language.

Change-Id: I1b887d75da980d99e21f89cc151249e42c78de88
2020-11-04 15:11:44 +01:00
Gabriel Ozouf
87591369b8 [apps/regression] Model stays selected in menu
When opening the window for choosing the regression model, the row
corresponding to the currently selected model will be highlighted.

Change-Id: I65772186fc302c3706a5571f98ecff620e4a8ca9
2020-11-04 15:11:44 +01:00
Gabriel Ozouf
0a7833ec3d [poincare/test] Added 0*inf*π = undef test
Change-Id: Ie18e75c3cfd2a39f8436405f1061ba8fc5317b7f
2020-11-04 15:11:44 +01:00
Gabriel Ozouf
206013f2db [poincare/multiplication] Return Undef early
Multiplication::privateShallowReduce can create an Undef node by
multiplying 0 and inf. In this case, we set the whole multiplication to
undef, to avoid things such as undef*π.
This fixes the following bug :
  - In Graph, enter i*inf*π as one of the bounds. An assertion fails in
    Multiplication::removeUnit.

Change-Id: Ie9d0d561d6e310f52220b98541f22a4b5e56762c
2020-11-04 15:11:44 +01:00
Hugo Saint-Vignes
aa14a6a82e [apps/apps_conainer] Add Home and PowerOn/Off to interrupt computations
Change-Id: I3951cda606760843fb0703864b9da078bf7fd887
2020-11-04 15:11:44 +01:00
Arthur Camouseigt
58b69c2779 [AbsoluteValue] Adding formal derivate to absolute value
This will prevent diff(|x|, x, 0) to be evaluated to 0 instead of undef
This fixes issue #1393
Change-Id: I73f40aa29f04c373cd3e9edbbd4fbe7be6d7a988
2020-11-04 15:11:44 +01:00
Hugo Saint-Vignes
f562886a7e [poincare] Fixed crash due to infinite loop with horizontal layout
Change-Id: I00106525b29ce441e10a6d88766efdecd80d8291
2020-11-04 15:11:44 +01:00
Hugo Saint-Vignes
74a2211a6a [poincare] Use default methods for GCD and LCM instead of n_ary ones
Change-Id: Id353e4367bcb6700bae2f9c121af93b9379a8051
2020-11-04 15:11:44 +01:00
Émilie Feral
ec0e766c94 [apps/graph] text_field_function_title_cell: fix read of uninitialized buffer
This fixes the following crash: when reloading the cell before
initializing the m_textFieldBuffer, TextField::ContentView::text() will
use the content of the uninitialized m_textFieldBuffer to compute the
minimalSizeForOptimalDisplay.
2020-11-04 15:11:44 +01:00
Hugo Saint-Vignes
5b82b94c20 [poincare] Prevent forbidden ChildAtIndex call in fraction_layout
Change-Id: I00d282a6dd3618f669aaeb0202d6495ae8035f12
2020-11-04 15:11:44 +01:00
Arthur Camouseigt
edcc1f6e80 [Poincare/integral_layout.cpp] Fixed crash due to infinite loop
Changed previousNestedIntegral method to prevent integrals located in
integral bounds to be considered as nested.

Change-Id: Id8cc4369f53c278ac59039fde1c2818af2ccacab
2020-11-04 15:11:44 +01:00
Hugo Saint-Vignes
685b2a8d6d [poincare] Reduce Abs layout verticalMargin
Change-Id: I3edacc192b0274d73fd787bb81b0c895e29ddda3
2020-11-04 15:11:43 +01:00
Hugo Saint-Vignes
2512425868 [poincare] Factorize bracket pair rendering
Change-Id: I80f2d04c8833352f4097bcfdcf90b5ec147dc19f
2020-11-04 15:11:43 +01:00
Hugo Saint-Vignes
3aa5e8bcd6 [poincare] Add Vector Norm Layout
Change-Id: Iae5bbeabaa0ca627ae6651f187d1a42b970df37d
2020-11-04 15:11:43 +01:00
Hugo Saint-Vignes
8d2af7e77f [poincare/test] Add VectorOperation tests, tidy rref tests
Change-Id: I4072bee6b2d3bf1ad17045149bff8dcdb6a2f238
2020-11-04 15:11:43 +01:00
Hugo Saint-Vignes
6db02ea122 [poincare/vectors] Implement Vectors operations
Change-Id: Ib5aa2f5951f4eabe3b04078eab8b7d3a4d3769e7
2020-11-04 15:11:43 +01:00
Hugo Saint-Vignes
ca91b7c43d [apps/toolbox] Add Vector operation toolbox menus
Change-Id: Iab8faa45a3f30be979f7d705ac169e8f2b801da9
2020-11-04 15:11:43 +01:00
Hugo Saint-Vignes
8688fd5b95 [apps/shared] Add template for privateEvaluateXYAtParameter
Change-Id: I97b4165307f57e52924e321cb85154cb32ba1008
2020-11-04 15:11:43 +01:00
Hugo Saint-Vignes
56a9e8d74b [poincare] Fix LCM GCD bug on device compilation
Change-Id: I5ac11b7e72ede335db503b1d0f9c0be00710cd0b
2020-11-04 15:11:43 +01:00
Hugo Saint-Vignes
53e204db3a [liba] Add abs function for int
Change-Id: Ic133ff2f34c7ff24ecbec69d5f31e447a72ae4fe
2020-11-04 15:11:43 +01:00
Arthur Camouseigt
0a92499dd7 [Poincare/unit] Changing the value of AU
The value of astronomical unit was wrong. This fixes issue #1637

Change-Id: I175c8fae9044beb1e863ddbf3a260224a9c60bd6
2020-11-04 15:11:43 +01:00
Hugo Saint-Vignes
cbd26e69d1 [apps/graph/list] Apply changes on confirm with function interval selection
Change-Id: I0ec1ae54788f1c72fc8277544ed51a85ba4474d5
2020-11-04 15:11:43 +01:00
Hugo Saint-Vignes
cce1fa0c90 [poincare/test] Add tests for LCM and GCD
Change-Id: If91c1ef863c9810e1ab87525a5ed2b4c7ed45656
2020-11-04 15:11:43 +01:00
Hugo Saint-Vignes
cafb1c1c05 [poincare] LCM and GCD accept set of numbers
Change-Id: I367ff5e48fa2856e976aa020ac0d172216f3a421
2020-11-04 15:11:43 +01:00
Hugo Saint-Vignes
0322a1a6a7 [apps/shared] Fix draw curve issues when tStep << tStart
Change-Id: Iaf054cff1f78f3c800564a0e6c133192bdfab260
2020-11-04 15:11:43 +01:00
Arthur Camouseigt
22a15f5ed6 [Shared/store_parameter_controler] Fixed a bug
In stats when selecting an action on a column, all actions listed after
the one selected were applied. Adding breaks to the switch solved the
issue

Change-Id: I4a2f8a41f734a209abb17e76388eed551bf1769c
2020-11-04 15:07:20 +01:00
Hugo Saint-Vignes
9e12b61849 [apps/graph] Round x before evaluating graph cursor on scroll
Change-Id: I13500669963eb8130e188a898bed0bf63655add6
2020-11-04 15:07:20 +01:00
Hugo Saint-Vignes
bd2609bcba [apps/graph] Remove horizontal margins when panning on some graph calculations
Change-Id: I1a28555c5b4f04986b223617ab15110711a74841
2020-11-04 15:07:20 +01:00
Gabriel Ozouf
c04a7af22f [escher/layout_field] Change cursor behavior
Some code to prevent the input field from scrolling when switching to
the history in layout mode causes problems :
  - With a calculation in the history, type an empty matrix or fraction.
    Then with the cursor on an empty square, go to the history. The
    square will appear shifted to the right.

Change-Id: I72ebee675215dc3c3a3f8432890f6fee820ef5c9
2020-11-04 15:07:20 +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
Gabriel Ozouf
44da25dd64 [poincare/number] Fixed typo
Change-Id: Id691ade099f09c8479582751aaab6dbd7f077711
2020-11-04 15:07:20 +01:00
Gabriel Ozouf
891366c51d [poincare/expression_node] Added Double type
Float<float> and Float<double> used to share the same expression type
(Float), and the distinction was made by comparing their size. However,
due to padding, their size could be the same, leading to some issues :
  - On the simulator, in Calculation, type 1_mm^3 and go to the
    additional outputs. One of the results would be -0.0003081979_µm^3.

Change-Id: Ic8f9328bf462104776fbab636c34d0d152cd7e58
2020-11-04 15:07:20 +01:00
Arthur Camouseigt
1e82d5012b [Stats] Moved sort messages to shared+NL translation
This allows compilation without stats app

Change-Id: I0f564ee46756420f0cff5da91ed77677b22cdee0
2020-11-04 15:07:20 +01:00
Arthur Camouseigt
f9a1f1a1b7 [Poincare/test/approximation.cpp] Fixed broken test
Change-Id: I6d851abf9626d282133f143afa2a16ca2d8bec7e
2020-11-04 15:07:20 +01:00
Arthur Camouseigt
b7bfc253eb [poincare/trigonometry] Modified shallowReduceInverseFunction
This fixes issues #1541. Formulas as asin(sin(X)) with X a large number
were failling to simplify themselves into the image interval of asin
ex : previous version asin(sin(6)) = 6
     new version asin(sin(6)) = -2pi+6

Change-Id: Ia6200b67914224cecd2cd943bcf9bc2ff6e0447a
2020-11-04 15:07:20 +01:00
Arthur Camouseigt
5569ba92a2 [poincare/approximation_helper] Changed the way to approximate
To prevent incorrect approximations, such as cos(1.5707963267949) = 0, we lowered the precision value. This way,
  the approximation is more selective. However, when ploting functions such as e^(i.pi+x), the float approximation fails
  and therefore, the function appears "undef".
  As a result we created two functions Epsilon that behave differently according to the number's type. When it is a double,
  we want a maximal precision -> epsilon_double = 1x10^(-15), and when it is a float, we accept more agressive approximations
 -> epsilon_float = 10 x 1x10^(-7).

Change-Id: I844ac52ade665f51fe6888db38f4485c193286d9
2020-11-04 15:07:20 +01:00
Hugo Saint-Vignes
1f9d0b5810 [apps/code] Reorder rows due to color name change
Change-Id: I1c8f3e9d015cf55ec8fc38082f60e957b19b196d
2020-11-04 15:07:20 +01:00
Hugo Saint-Vignes
641186d89c [python] Accept "grey" color
Change-Id: Ia9b70eb3b4205ae9571eb4269410c30cfbdd1214
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
c4018d0648 [poincare] Update rowCanonize pivot selection for more consistent ref results
Change-Id: Id7e856f57ccd3d990077b0f6753089bc6edcc03b
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
Hugo Saint-Vignes
007c38652f [poincare] Add ref and rref matrix functions
Change-Id: Id0e57a4f85d551ca5320c4b6e3c0baadae70946d
2020-11-04 15:07:20 +01:00
Arthur Camouseigt
997c103fba [Toolbox] Changed the required parameters for normal_distributions
Changed the parameter σ2 to σ. This is now consistant with the
probability app

Change-Id: I96101ba158cebef972e536cfa5cc1b2da71b543d
2020-11-04 15:07:19 +01:00
Arthur Camouseigt
6072ffd848 [poincare/normal_distribution.cpp] Fixed approximation error
Removed limitation in calculation of normal_distribution. It was used to
speed-up computation but yielded 0 for small values.
Previously P(X<5) with X->N(7,0.3162) gave 0 as a result
now it gives 1.26e-10

Change-Id: I3f1c997dfe2ba6424b372a0a82af6d9871443657
2020-11-04 15:07:19 +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
67af3a5b4e [apps/calculation] Fixed grey and yellow squares
When closing and reopening Calculation, if the cursor was on an
EmptyLayout, this layout would be invisible, instead of being denoted by
its usual yellow square.
This also fixes a bug that would leave the grey squares in matrices when
leaving and reopening the app, causing a failed assertion on the simulator.

Change-Id: Ib723797c079f1441f5cde174aa5c492ad4226335
2020-11-04 15:07:19 +01:00
Gabriel Ozouf
e49dc08759 [escher/expression_field] Fixed dumpLayout
Closing the Calculation app because of a full pool would crash the
device, by attempting to dump a layout with no node.

Change-Id: Ic926da61ae93f47eb576848788e1de5e3f94f5bb
2020-11-04 15:07:19 +01:00
Hugo Saint-Vignes
433639c471 [ion] Implement dynamic scroll speed profile
Change-Id: Ib3ec2ef63d19bfb88b627f06bcc185fa1b232223
2020-11-04 15:07:19 +01:00
Gabriel Ozouf
2bfdc482a6 [apps/continuous_function] Cut clearCache method
Inlined call to ContinuousFunction::clearCache and removed the method,
as its name was confusing.

Change-Id: I54454fb0b06167e01249afaa5b23932451125f2e
2020-11-04 15:07:19 +01:00
Gabriel Ozouf
1de6ac702d [apps/continuous_function_cache] abs -> fabs
Replaced abs calls on float with fabs.

Change-Id: I26eda164416ca8b2d601431a59171fd7b00ed33f
2020-11-04 15:07:19 +01:00
Gabriel Ozouf
15988f0fae [liba/float] Redefined FLT_EPSILON
FLT_EPSILON is now compliant with the definition : the difference
between 1 and the next representable float.

Change-Id: I4f79c3eee93447e76893d850bd84265c9d45aca5
2020-11-04 15:07:19 +01:00
Gabriel Ozouf
aea9176f86 [apps/graph] Added tests for graph caching
Wrote some tests to check that the caching process does not lead to
aberrant values.

Change-Id: I28137e66f430dbcf4417733d1274319dbadfc9af
2020-11-04 15:07:19 +01:00
Gabriel Ozouf
b0533e6836 [apps/graph] Changed cache tolerance
This fixes a bug where, when drawing 1/x, a vertical bar would appear on
0, because of false positive cache hits.

Change-Id: I2eafeac5e254c8a556769a41c8edc532db44383a
2020-11-04 15:07:19 +01:00
Gabriel Ozouf
beb228fa78 [apps/graph] Fixed cache step quirks
Change-Id: I5b630301ab2a4b17a5a4d77c7d9a05120449e55e
2020-11-04 15:07:19 +01:00
Gabriel Ozouf
1bee23cf4f [apps/graph] Reworked function caching
Instead of being memoized all at once before display, functions values
are now stored at evaluation time. Fixed some quirks with caching
preparation.

Change-Id: I5d212c271c8c41a6dc9074a15c720f0bccf8ac40
2020-11-04 15:07:19 +01:00
Gabriel Ozouf
42fcf557b8 [apps/graph] Limited number of cached functions
The caches used for function values memoization are now stored in
ContinuousFunctionStore : there are now only a fixed number, instead of
one per function. This effectively enables caching only for the first
few functions on screen, while reducing the memory usage.

Change-Id: I2ade091717f73a14a756fe527c773db8e8627be7
2020-11-04 15:04:24 +01:00
Gabriel Ozouf
95fef86ec0 [apps/graph] Activated caching for graph drawing
Added a default argument to CurveView::drawCurve : a function to initiate the
memoization of continuous functions. The function is implemented in
ContinuousFunctionCache and provided by GraphView. This should be invisible
to other types of curves that rely on CurveView::drawCurve.

Change-Id: I59aa55d67154b6d4bf9614b7ed87c48408773d86
2020-11-04 15:00:43 +01:00
Gabriel Ozouf
c70b545ba1 [apps/shared] Cache lookup on function evaluation
When evaluating a ContinuousFunction for a float value, the function
will first try to ask its cache (if it has been filled beforehand).

Change-Id: I519d2d3dcf344ba63e30a0f011db2306c7141315
2020-11-04 14:45:35 +01:00
Gabriel Ozouf
a9c633a540 [apps/shared] Functions cache clears on change
Added several triggers to clear the cache when the function's type,
range or content is changed.

Change-Id: I4f49a90bb6571e335a4a601723d7715b8de1e25e
2020-11-04 14:45:35 +01:00
Gabriel Ozouf
552dca9494 [apps/shared] Implemented function memoization
ContinuousFunction now has an attribute of type ContinuousFunctionCache,
implementing methods to store and retrieve 320 float values, in order to
speed up function display in Graph.

Change-Id: I6f7ccdf3ae3c6dd8b08b93d786c8d0be7aa4dee8
2020-11-04 14:45:35 +01:00
Gabriel Ozouf
0308b18400 [liba/float.h] Comment on FLT_EPSILON's definition
Change-Id: Iac2da58d9a2f8e4b1bb131255341696db99df188
2020-11-04 14:45:35 +01:00
Gabriel Ozouf
4007f4d452 [apps] Tweaked panning for better cache alignement
Method InteractiveCurveViewRange::panToMakePointVisible now moves the
range of a whole number of pixels when panning horizontally. This allows
the cache of cartesian functions not to be invalidated.

Change-Id: Idb9904fef134dd13458e1f2287b0fe5145e8aec7
2020-11-04 14:45:35 +01:00
Hugo Saint-Vignes
5bc19af196 [apps/shared] Revert to pack record
It appeared that without the packed keyword, the compiler did not handle
access to unaligned record data members, which leads to crashes on the
device.

Change-Id: I401f075e7f62458a4733baa8d81983d4be34b730
2020-11-04 14:45:35 +01:00
Hugo Saint-Vignes
969fea7494 [poincare] Improve float variables usage
Change-Id: I965c425cbe70c0a201c504565d5d0991618ce0b9
2020-11-04 14:45:35 +01:00
Hugo Saint-Vignes
10de970814 [poincare] Remove unnecessary unit norm code
Change-Id: I7d7abf88d1dcc10fb4ae0f6b3570ebfe4b4af311
2020-11-04 14:45:35 +01:00
Hugo Saint-Vignes
9f2c4bccdf [apps/math_toolbox] Reorder toolbox units
Change-Id: I2a599c90ce221c173bd05bfa2d31e908c6bdbbdf
2020-11-04 14:45:35 +01:00
Hugo Saint-Vignes
a5a57c4076 [poincare] Improve prefixes for mass and inductance unities
Change-Id: Ic9eb7b5adff7b172452b4c73bd7ddc5c59761219
2020-11-04 14:45:35 +01:00
Hugo Saint-Vignes
11e41bb4dc [poincare] Add comments and alternative algorithm to beautify units
Change-Id: I4b1ce9528d9d6796fe08f8566ee5d1efafa1d87d
2020-11-04 14:45:35 +01:00
Hugo Saint-Vignes
51f1cdb076 [poincare] Handle rational unit exponents
Change-Id: Id710702dbed19d34992da90978d5823d68abb80a
2020-11-04 14:45:35 +01:00
Arthur Camouseigt
09e39ad890 [Stat+Reg] Allowing lists of values to be sorted
Change-Id: I181bb55443bf87356d127eb6c56ff6140806fdea
2020-11-04 14:45:35 +01:00
Arthur Camouseigt
018dd91ca1 [Probability] Changed distribution parameter's type to double
Plots are still rendered in float but computations are now in double

Change-Id: I7e0a38effb780861b1443ee92a097cd319de3bc8
2020-11-04 14:45:35 +01:00
Arthur Camouseigt
082f9819e9 [Poincare] Changed ConvertFloatToText to prevent conversion error
We now compute the value of the mantissa in double (instead of float)
to limit conversion error occuring for big numbers.

Change-Id: Ia61c052f0bc4a9196c53e2c7900eb48e3343d39c
2020-11-04 14:45:35 +01:00
Hugo Saint-Vignes
776edd4dd8 [apps/shared] Extend function table view to 101 cells
Increasing the lenght of graph table view to give users more
possibilities

Change-Id: I4023a5f81974b8302bf81b56d2610908e207241f
2020-11-04 14:45:35 +01:00
Arthur
6380bf7885 [poincare/integral_layout] Changing the integral layout and behavior
Should there be multiple integrals in a row,
they now all have the same height.

Change-Id: I106c4e2cb2671f6518f1d916f414f6e9349f83dc
2020-11-04 14:45:35 +01:00
Arthur
02af868274 [poincare/sum_layout.cpp] Modified the look of the sigma symbol
Change-Id: Ib79414eed96aedacc51b89dce22a14a4e7891cdf
2020-11-04 14:45:35 +01:00
Arthur
bd74ab9718 [poincare/sequence_layout] Modified the height of sigma and product signs
Because of their previous even height, those symbols were not aligned with fractions. Now that they have an uneven size, they line up correctly.
2020-11-04 14:45:35 +01:00
Arthur
45db7f1d48 [poincare/integral_layout.cpp] Reduced the gap between integral sign and integrand
The gap between the integral sign and the integrand has been reduced. It looks more natural this way.
2020-11-04 14:45:35 +01:00
Arthur Camouseigt
9998f9b578 [apps/shared/ok_view.cpp] Changed the look of the OK symbol
New look for the ok symbol. The updated version is antialiazed.

Change-Id: I1ee0e4b6680a7582f6216854a5e5cfe308801669
2020-11-04 14:45:35 +01:00
Arthur Camouseigt
92f56445fe [poincare/sum_layout] Modified the way to draw sigma
New way of drawing sigma sign. Only a single branch is stored. The full
symbol is created by mirroring half a symbol.

Change-Id: I0fc32393203e51578c88b01125a907d402291534
2020-11-04 14:45:35 +01:00
Arthur Camouseigt
1e0449791d [poincare/integral_layout] Changing the integral symbol
Changed the look of the integral symbol and the positions of the upper
and lower bounds. Added a drawing of the window to explain the meaning
of various margins.

Change-Id: I3ffc07848dc9ad68dce3c0e01853d548e31dd152
2020-11-04 14:45:35 +01:00
Arthur Camouseigt
653b7d0ac4 [poincare] Bigger product and sum signs
Replacing the product and sum signs with bigger and antialiased ones.
2020-11-04 14:45:35 +01:00
Gabriel Ozouf
abb662b606 [poincare/test] Added tests on fraction layouts
Change-Id: I351d707c03b96c93e090e2e74c1841ebe9d7a691
2020-11-04 14:45:35 +01:00
Gabriel Ozouf
4ca4d4f45e [poincare/layout] Factored Parenthesis collapsing
Parenthesis collapsing is no longer handled by LeftParenthesisLayout and
RightParenthesisLayout, but by ParenthesisLayout itself.

Change-Id: I6797cd40ee02881544e01e9b88f31a597c51d179
2020-11-04 14:45:35 +01:00
Gabriel Ozouf
e2e062e128 [poincare/layout] Changed Fraction collapsing
Fraction are now only collapsed if they are the first thing to be
collapsed or if a parenthesis is open.

Change-Id: Ie7f3a99498b9981dff70221efd7de6bee6d0c379
2020-11-04 14:45:35 +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
8ab23f66b5 [escher/expression_field] Methods on layout
Added some methods to manipulate the layout of a LayoutField from an
ExpressionField, like storing into and restoring from a buffer.

Change-Id: I7b7b5b53626f19237a5215bd196e897a518e9577
2020-11-04 14:45:35 +01:00
Gabriel Ozouf
9527894b25 [poincare] Function LayoutFromAddress
Created function Layout::LayoutFromAddress, which creates in the pool a layout
that has been stored in a buffer. Functionally identical to
Expression::ExpressionFromAddress.

Change-Id: I204e6b7d42f259ef2732563aa2a168a644060867
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
Hugo Saint-Vignes
3db1cad18b [poincare] Move IsApproximatelyEqual to a better helper
Change-Id: I056a96b3721005e01c6ef3f166a80a08195ff338
2020-11-04 14:45:34 +01:00
Gabriel Ozouf
9f4aafd6b6 [apps/graph] FunctionTitleCell reload
Changed TextFieldFunctionTitleCell::reloadCell to solve an issue with
the alignment of a function's name and definition when changing the
expression :
  - typing u_n = (1/3)/2 then changing to u_n = 1/(2/3) without erasing
    the formula first. u_n would no longer be aligned with the = sign.

Change-Id: Ib58e4220dc67c77639272c7ea784418bddffb432
2020-11-04 14:45:34 +01:00
Gabriel Ozouf
43fc937469 [apps/sequence] SequenceTitleCell reload
SequenceTitleCell::reloadCell now triggers a layoutSubviews, causing the
vertical alignment to be recomputed. This solves issues regarding the
alignment of a sequence's name and definition, such as :
  - typing u_n = v_n ; v_n would be displayed above u_n
  - typing u_n = (1/3)/2 then changing to u_n = 1/(2/3) without erasing
    the formula first. u_n would no longer be aligned with the = sign.

Change-Id: I4a771d96ea79e42e2f4822e93f9f1cbbcf867610
2020-11-04 14:45:34 +01:00
Gabriel Ozouf
e03bb7432e [escher] Tweaked LayoutField event handling
LayoutField does no redraw its content on every occasion anymore. This
allows the input window in Calculation to not scroll to the beginning
when writing an overly long formula.

Change-Id: I14276828884035463b0a6438bfca4dd76c7f5057
2020-11-04 14:45:34 +01:00
Gabriel Ozouf
41cf0aaac6 [apps] Stopped battery warning when plugged
Change-Id: Id4f0d5d730c6045bf69cfadd724dc8ad819494d5
2020-11-04 14:45:34 +01:00
Hugo Saint-Vignes
735fc6e1bb [poincare] Generalize Binomial Coefficient n to any real
Change-Id: I3cda882e67db4becfe232c6428e14905e922662b
2020-11-04 14:45:34 +01:00
Hugo Saint-Vignes
ada369bf08 [apps/shared] Add comment for selectNonHiddenCellAtClippedLocation
Change-Id: I0e0f7963274688facb467caa934f410e66c9f859
2020-11-04 14:45:34 +01:00
Hugo Saint-Vignes
af32f33141 [ion] Remove unused function and rename longRepetitionScrollSpeed
Change-Id: I11268eb34060c74eb8770ba0eb999f84737c76d8
2020-11-04 14:45:34 +01:00
Hugo Saint-Vignes
70cd166da5 [escher] Scroll speed increase for long repetition in layout fields
Change-Id: I9460cb44631f0b225598804334da5a0e74029915
2020-11-04 14:45:34 +01:00
Hugo Saint-Vignes
70830e0b74 [escher] Scroll speed increase for long repetition in selectable table
Change-Id: Idfc3edcedff5a933b6f2168b475e22ea56ea0ab0
2020-11-04 14:45:34 +01:00
Hugo Saint-Vignes
e35f2cc938 [escher] Scroll speed increase for long repetition in text area
Change-Id: Ia468bd3ae3f247937127228a11e3d51653dd2ae2
2020-11-04 14:45:34 +01:00
Hugo Saint-Vignes
c9964e69c2 [escher] Scroll speed increase for long repetition in scrollable views.
Change-Id: Ie7671ced53da1a144068756f6b584dbb287f9e0e
2020-11-04 14:45:34 +01:00
Hugo Saint-Vignes
b60c67ff88 [apps] Factorize scrolling speed for long repetition
Change-Id: I5fcfaf04e418942664641c4b1cd044cda7f5aebb
2020-11-04 14:45:34 +01:00
Hugo Saint-Vignes
241a217f58 [apps/graph] Add fast scroll for regression and sequence graph views
Change-Id: I6b36e929234ec5dc161b0eefb20eb84aa360fe3b
2020-11-04 14:45:34 +01:00
Hugo Saint-Vignes
1879eb36d8 [ion/test] Typo Fix
Change-Id: I49d041dea6333a7f7f1a179e2ffcff2391dbaa28
2020-11-04 14:45:34 +01:00
Hugo Saint-Vignes
0a2ededfcf [apps/shared] Remove packed data members for RecordDataBuffer
Change-Id: I04ea5ccb4c15bda975bf5af178f07092c0387312
2020-11-04 14:45:34 +01:00
Gabriel Ozouf
78a1350f15 [poincare/test/derivative.cpp] Added context-aware tests.
New tests compute derivatives while replacing symbols with their definitions or undefined, as the device does.

Change-Id: I99179bf6540182ff929938fb96a00a1ed2fbcf49
2020-11-04 14:45:34 +01:00
Gabriel Ozouf
a9c94236c2 [poincare] Implemented further derivation methods and updated tests.
Derivation now works on tangents and the three hyperbolic functions.

Change-Id: I62049e79c661c3c4a031be0a93c403fb936d611b
2020-11-04 14:45:34 +01:00
Gabriel Ozouf
eab8167a56 [poicare/logarithm] Implemented didDerivate and unaryFunctionDifferential for Logarithm
Derivation now computes as expected on logarithms, as long as their base is not a function of the derivation variable.

Change-Id: Ia56da1c1151c0ddf3887be84ddb4bd02664c5188
2020-11-04 14:45:34 +01:00
Gabriel Ozouf
407d4bce6e [poincare/cosine] Implemented didDerivate and unaryFunctionDifferential for Cosine
Derivation now propagates as expected on cosines.

Change-Id: I6f5af48ac7462c5b8e77ff1a6428a65bf6c0c7de
2020-11-04 14:45:34 +01:00
Gabriel Ozouf
5cf85368ea [poincare] Added framework to derivate unary functions, and implemented it for Sine
Added a method unaryFunctionDifferential to ExpressionNode and Expression, to be implemented by subclasses representing unary functions.
Added a function derivateUnaryFunction to Derivative, to factor (f°g)' -> g' * f'°g.

Change-Id: Id1780f1082ccd001f1282fe4ddfff2b7055d3a27
2020-11-04 14:45:34 +01:00
Gabriel Ozouf
648cdbaa29 [poincare] Implemented didDerivate method for Power
Derivation now propagates to powers as expected, whether the base, the exponent, or both are functions of the variable. This also makes division derive as intended.

Change-Id: I51cbd5f7ec9f6aaa1df068625bbda1437941fa08
2020-11-04 14:45:34 +01:00
Gabriel Ozouf
6f378ef3ef [poincare] Implemented didDerivate for Multiplication
Derivation propagates as expected on multiplications (but not power). Some tests involving diff had to be updated to reflect that behaviour.

Change-Id: Ifa32031bc37a156c18d296757bcdd6ccdb0ea43e
2020-11-04 14:45:34 +01:00
Gabriel Ozouf
c65687e9f6 [poincare] Implemented didDerivate methods for Number, Symbol and Addition
Number's subclasses, with the exception of Undefined and Unreal, derive as zero. Symbols derive as expected. Derivation propagates as expected on additions.

Change-Id: Icedbb1dfac8099347a19c14bf2537011b2e8b199
2020-11-04 14:45:34 +01:00
Gabriel Ozouf
051e608835 [poincare] Added method didDerivate to Expression and ExpressionNode
This method is to be implemented by derivable expression subclasses, for use in Derivative::shallowReduce. It performs the calculation for the derivative, and returns whether calculations happened.

Change-Id: I13cdb131e2044578392f5178a9f389314c1c4c8a
2020-11-04 14:45:34 +01:00
Hugo Saint-Vignes
eed1648363 [apps/statistics] Improve variance accuracy for statistics
Change-Id: Ie8f6f93c8e95940662e72a23619b53ac4ab0d6b6
2020-11-04 14:45:34 +01:00
Hugo Saint-Vignes
29b0e86225 [quiz] Improve test possibilities for regression and statistics
Change-Id: I4414fad24e10dcbd56cd9aff1e35e00ba66dda2c
2020-11-04 14:45:34 +01:00
Hugo Saint-Vignes
d16e49fc5f [apps/regression] Improve Variance precision
Change-Id: Ia9e406b14c0baec76835e226a7801ba73ff9174e
2020-11-04 14:45:34 +01:00
Hugo Saint-Vignes
db69f6a6f5 [regression] Implement R2 computation using evaluated values
Change-Id: Iecf8cb84f092c2ec8a9bc17bc0265d7dddaac36c
2020-11-04 14:45:34 +01:00
Hugo Saint-Vignes
5c95cbd1d3 [regression] Add r2 to any regression stats
Change-Id: I3088dd66b1c3f48973b8a9277de687bdd24e094b
2020-11-04 14:45:34 +01:00
Hugo Saint-Vignes
d3727dde97 [regression] Add unit tests for regression metrics
Change-Id: I25d7fd89053a1bd5fb369c8c145dba92d188f550
2020-11-04 14:45:34 +01:00
Gabriel Ozouf
e8505d79e7 [ion/device/exam_mode] Fixed missing parentheses in assertion
Change-Id: If10b6ea98ed224d79cfa50f38f9e229331d0f9f9
2020-11-04 14:45:34 +01:00
Gabriel Ozouf
0454b65a94 [ion/device/usb] Fixed missing static member definitions
Change-Id: Iedf6ce51d3213f9265fec247c7bdfda4e3304d3a
2020-11-04 14:45:34 +01:00
Gabriel Ozouf
1d74a8f757 [poincare/power] Fixed missing template definitions
Change-Id: I9e7db458c97cc1fba29689690b67c3c678976405
2020-11-04 14:45:34 +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
Quentin Guidée
715ff95cf1 [epsilon] Fix upstream merge 2020-11-03 19:49:43 +01:00
Quentin Guidée
5d50c80604 Merge remote-tracking branch 'upstream/master' into omega-dev 2020-11-03 19:35:37 +01:00
Joachim LF
8e4187fb60 [Poincare] Added kmat() 2020-10-31 10:58:39 +01:00
Joachim LF
a680539b7c [Apps/main] Added comments 2020-10-28 19:49:09 +01:00
Joachim LF
69a708fd1b [Apps/main] Removed strcmp (see #1695) 2020-10-28 19:45:05 +01:00
Émilie Feral
e0dcdcea28 [build] Add a target flasher.verbose.flash 2020-10-27 08:50:05 +01:00
Émilie Feral
1f81c97371 [ion] USB::DFU takes an argument specifying if the DFU mode should be
leavable from keyboard
2020-10-27 08:50:05 +01:00
Émilie Feral
2d71e98b52 [ion] n0100 Console: fix pin alternate function 2020-10-27 08:45:41 +01:00
Gabriel Ozouf
c71b2dee99 [curve_view] Factor bounding box code for joinDots
Change-Id: Iae974aa2bee12e6c56bad84fd3b45093fb2a856f
2020-10-23 08:56:56 +02:00
Gabriel Ozouf
26fdfcd25c [curve_view] Fixed variable names
Change-Id: I8aad13c6bce719ba8f3a30cd86f06f7c89ec041e
2020-10-23 08:56:56 +02:00
Gabriel Ozouf
fe8e490ac0 [curve_view] Filter unwanted vertical asymptotes
Change-Id: Ia603a2fb1553b6dfc038d2a28472ce48e41936db
2020-10-23 08:56:56 +02:00
Gabriel Ozouf
106916e7bf [curve_view] Add double evaluation
Add the possibility to use a double-typed evaluator when tracing a
curve, useful when errors caused by float approximation mess with the
drawing.

Change-Id: I3ab410deec4823149239b0a26b1885fd2a493226
2020-10-23 08:56:56 +02:00
Quentin Guidée
3c9bf7456e Merge branch 'omega-hotfix' into omega-dev 2020-10-18 09:59:17 +02:00
Quentin
a812b52fee Merge pull request #416 from RedGl0w/SDLHotfix
[Ion/SDL] Fix conflicts with master
2020-10-18 09:56:30 +02:00
Émilie Feral
c91c2a6e3f [app/shared] CurveView: Avoid dashSize overflow in
drawHorizontalOrVerticalSegment
2020-10-12 09:48:55 +02:00
Émilie Feral
8e025b0823 [apps/shared] CurveView: avoid overflowing KDCoordinate
This fixes the following bug: add the sequence, u(n)=2^n. On the graph,
go to "sum of terms" and try to sum terms from 0 to 18 by moving the
cursor. It hangs.
2020-10-12 09:48:55 +02:00
Joachim LF
ab906da53d [Ion/SDL] Fix conflicts with master 2020-10-11 12:37:44 +02:00
Joachim Le Fournis
f2edb0a033 [Ion/usb] Changed URL in order to have easier update 2020-10-11 09:08:48 +02:00
Quentin Guidée
e8b86ca6a1 [upstream] Update 2020-10-10 02:28:33 +02:00
Émilie Feral
17fd1aea29 [ion] Haptics implementation are on all simulators but
Ion::Haptics::isEnabled is per platform.
2020-09-30 17:30:34 +02:00
Émilie Feral
0c0510599d [ion] Simulator: haptics feedback are only implemented on Android and
depends on the System settings
2020-09-30 17:30:34 +02:00
Émilie Feral
9786db308a [ion] Haptics events don't depend on SCREEN_ONLY 2020-09-30 17:30:34 +02:00
Émilie Feral
979c227d54 [ion] web: improve key highlight positions 2020-09-30 17:30:34 +02:00
Émilie Feral
595532e0a5 [ion] Remove useless variables 2020-09-30 17:30:34 +02:00
Émilie Feral
42cedf5b10 [ion] Windows: improve resgen.py script 2020-09-30 17:30:34 +02:00
Émilie Feral
f4b9635fee [ion] Change variable name 2020-09-30 17:30:34 +02:00
Émilie Feral
560c4b3821 [ion] Linux: improve incbin.py script 2020-09-30 17:30:34 +02:00
Émilie Feral
5da82d8423 [ion] Add comment 2020-09-30 17:30:34 +02:00
Émilie Feral
33425e04c0 [ion] Coding style 2020-09-30 17:30:34 +02:00
Émilie Feral
7535abc298 [ion] Change name of variable in Makefile 2020-09-30 17:30:34 +02:00
Émilie Feral
308b321ead [ion] Clean windows flag 2020-09-30 17:30:34 +02:00
Émilie Feral
8976ebfc41 [ion] Makefile linux: simplify build system by generating a header 2020-09-30 17:30:34 +02:00
Émilie Feral
4620aa8aa8 [ion] Remove useless comment 2020-09-30 17:30:34 +02:00
Émilie Feral
c96efa76b9 [ion] Windows Makefile: build .rc from the list of assets 2020-09-30 17:30:34 +02:00
Émilie Feral
40392fff9c [ion] Simulator: assets declaration is common to all targets 2020-09-30 17:30:34 +02:00
Émilie Feral
815a06adad [ion] Avoid unhighlighting key when the mouse is still on it.
Distinguish with smartphones behaviour.
2020-09-30 17:30:34 +02:00
Émilie Feral
22b585057d [ion] Simulator: key layouts assets are PNG instead of JPG V (fix windows) 2020-09-30 17:30:34 +02:00
Émilie Feral
165b129385 [ion] Simulator: key layouts assets are PNG instead of JPG IV (fix linux) 2020-09-30 17:30:34 +02:00
Émilie Feral
1946c68ef8 [ion] Simulator: key layouts assets are PNG instead of JPG III (fix ios) 2020-09-30 17:30:34 +02:00
Émilie Feral
d2632bff4f [ion] Simulator: key layouts assets are PNG instead of JPG II (fix
android)
2020-09-30 17:30:34 +02:00
Émilie Feral
d4b7b6baf0 [ion] Simulator: key layouts assets are PNG instead of JPG I (fix macos) 2020-09-30 17:30:34 +02:00
Émilie Feral
11236c67cb [ion] Improve key positions 2020-09-30 17:30:34 +02:00
Émilie Feral
0b114abb95 [ion] Simulator windows: fix pixel format typo 2020-09-30 17:30:34 +02:00
Émilie Feral
8000ff733e [ion] Simulator: improve key center positions 2020-09-30 17:30:34 +02:00
Émilie Feral
8b5caeb394 [ion] IonSimulatorLoadImage returns a Texture (otherwise the pixels data
which needs to be deleted when freeing the surface is hard to retrieve)
2020-09-30 17:30:34 +02:00
Émilie Feral
02b648e36d [ion] IonSimulatorLoadImage returns a surface instead of a texture: this
way we can set a transparent color key before turning it into a texture.
2020-09-30 17:30:34 +02:00
Émilie Feral
674703f4dc [ion] Missing include 2020-09-30 17:30:34 +02:00
Émilie Feral
64bcbd708a [ion] Linux: fix images: get the asset addresses instead of consecutive
table addresses
2020-09-30 17:30:34 +02:00
Émilie Feral
2236dcdbed [ion] Fix: unhighlight the key on mouse up event (when you clicked on the key
on a smartphone, you want the key to be deselected)
2020-09-30 17:30:34 +02:00
Émilie Feral
af544a95d1 [ion] Windows: IonSimulatorLoadImage can now load any resource. Enable
to use key layouts jpg files in C/C++ code.
2020-09-30 17:30:34 +02:00
Émilie Feral
22250b4234 [ion] linux: enable to use key layouts jpg files in C/C++ code 2020-09-30 17:30:34 +02:00
Émilie Feral
a27122802d [ion] Macos Makefile: add depencies on keys layouts jpg images 2020-09-30 17:30:34 +02:00
Émilie Feral
ad1ef783ce [ion][escher] Revert previous commit: move inliner back to escher 2020-09-30 17:30:34 +02:00
Émilie Feral
4ae39f56fd [ion] Simulator: Layout uses jpg images instead of image built by the
inliner
2020-09-30 17:30:34 +02:00
Émilie Feral
652d2e6bac TODOs 2020-09-30 17:30:34 +02:00
Émilie Feral
50031c4836 [ion] Unhighlight the key on mouse up event (when you clicked on the key
on a smartphone, you want the key to be deselected)
2020-09-30 17:30:34 +02:00
Émilie Feral
ef363c57ac [ion] Reset the highlighted key once it has been drawn 2020-09-30 17:30:34 +02:00
Émilie Feral
ded2174578 [ion] simulator/shared: fix macro EPSILON_SDL_SCREEN_ONLY 2020-09-30 17:30:34 +02:00
Émilie Feral
c5add52e61 [ion] simulator: move key_layouts to ion/src/simulator/assets 2020-09-30 17:30:34 +02:00
Émilie Feral
1ad55139b4 [ion] simulator/shared/key_layouts: udpate png files 2020-09-30 17:30:34 +02:00
Émilie Feral
db1874fdac [ion] simulator/shared/layout: update the center of keys to centered the
highlight keys
2020-09-30 17:30:34 +02:00
Émilie Feral
23a542e639 [ion/simulator/shared/layout] Round instead of truncate when converting
relative to absolute coordinates
2020-09-30 17:30:34 +02:00
Émilie Feral
a8c318f90f [ion] simulator: move background render methods to layout 2020-09-30 17:30:34 +02:00
Émilie Feral
a3ef7c9234 [ion] simulator: fix magic number in display 2020-09-30 17:30:34 +02:00
Émilie Feral
649fb0bebe [ion] Simulator: highlight keys when the mouse is over 2020-09-30 17:30:34 +02:00
Émilie Feral
94851da7f9 [ion] Add drafts of images reprensenting key shapes 2020-09-30 17:30:34 +02:00
Émilie Feral
fcf4c011cb [ion] simulator/layout: change signature of makeAbsolute 2020-09-30 17:30:34 +02:00
Émilie Feral
8f8f42edd5 [ion] simulator: add forgotten Display::quit 2020-09-30 17:30:34 +02:00
Émilie Feral
f7479e0cf5 [ion][escher] Move image inliner to ion 2020-09-30 17:30:34 +02:00
Émilie Feral
ca56ba6327 [ion] Fix include 2020-09-30 17:30:34 +02:00
Émilie Feral
158afa7a27 [ion] simulator: the key detection distance threshold is responsive to
the frame dimension
2020-09-30 17:30:34 +02:00
Léa Saviot
b020cb2f98 [ion/simulator] Add haptic feedback 2020-09-30 17:30:34 +02:00
Émilie Feral
1c0f6a7913 [ion] Keyboard: don't detect a key down when the mouse is too far away
from a key
2020-09-30 17:30:34 +02:00
Joachim Le Fournis
aeb22bf35d [external] change heapSize 2020-09-05 11:20:15 +02:00
Joachim Le Fournis
befcfd10b7 [Python] Change heap 2020-09-05 11:16:25 +02:00
Quentin
ae41a19fb2 Merge pull request #401 from quentinguidee/merge-omega-themes-submodule
Merge omega-themes submodule in the main repository
2020-09-04 14:43:31 +02:00
Émilie Feral
4c41b1699d [docs] Add/remove dependencies in windows SDK 2020-09-03 15:36:21 +02:00
Quentin Guidée
ff7a72eca8 [themes] Remove submodule dependency 2020-09-03 14:59:55 +02:00
Quentin Guidée
28fe0e31b1 [github] Update README.md 2020-09-02 16:14:13 +02:00
Quentin Guidée
be931445ac [themes] Update submodule 2020-09-02 15:35:54 +02:00
Quentin
4c10ad471b Merge pull request #396 from quentinguidee/omega-dev-doc-design
[build/doc] Better Doxygen design
2020-09-02 11:57:15 +02:00
Quentin Guidée
9233422b1a [build/doc] Some design improvements 2020-09-02 11:41:53 +02:00
Gabriel Ozouf
b7c7695707 [apps/code] Remove interruption check
A check for interruption in ConsoleController::printText caused script
to immediately stop when launched after an interrupted script.
This check was used to break out of infinite print loop, but now
becomes redundant with how micropython_port_vm_hook_loop was changed.

Change-Id: Ifa8d415e1b2c2406ad67300eb14ce46889af296f
2020-08-31 15:32:02 +02:00
Gabriel Ozouf
7dcf1662b0 [python/helpers] Change interrupt check delay
Keyboard interruption used to be checked once every 20000 calls to
micropython_port_vm_hook_loop. However, if costly functions were
executed in between calls to this method, the delay for activating
interruptions would increase.
Now, keyboard interruption is checked after a fixed amount of time has
passed. This way, if the process waits a long time between two calls
to micropython_port_vm_hook_loop, it is still interrupted in a timely
manner.

Change-Id: I37ca3bd4a996fa086078f504340dd857526e356a
2020-08-31 15:32:02 +02:00
Gabriel Ozouf
34ebf1e6e0 [python/kandinsky] Remove additional interrupt
Additional checks for interruptions were making the kandinsky module
slower.
/!\ Some scripts are now very difficult to interrupt

Change-Id: I4c18273d8895deaac68084411a52556c8459d52b
2020-08-31 15:32:02 +02:00
Quentin Guidée
46658f7077 [omega] 1.20.3 2020-08-26 14:17:23 +02:00
Gabriel Ozouf
0a493d1f34 [kandinsky/color] Update comment on blend method
Change-Id: I5fb68608657d2f604c8cb7c9294382ed4a8603ff
2020-08-25 15:51:58 +02:00
Gabriel Ozouf
e33543aacb [kandinsky/color] Add tests on color blending
Change-Id: If1792bd9ec44052238632d28b806f5582b190fe9
2020-08-25 15:51:58 +02:00
Gabriel Ozouf
078bba2fb9 [kandinsky/color] Fix blend method
When computing the barycenter between two colors, the some of the two
factors a and (1-a) was equal to 255/256 instead of 1.

Change-Id: Ia9a779d43470ef42d9430ad730e842da0f007140
2020-08-25 15:51:58 +02:00
Gabriel Ozouf
38e15da5d0 [kandinsky/color] Blend identical colors
KDColor::blend used to produce different colors when blending two
identical colors (ex : use draw_string in Python to print white text on
a white background).
blend now escapes early when its two color arguments are identical.

Change-Id: I01dc5a0d5e4e6a20e09fee0f346dafc313dae97b
2020-08-25 15:51:58 +02:00
Joachim Le Fournis
d154611023 [Ion] Fix broken link 2020-08-24 16:37:03 -04:00
Charlotte THOMAS
cf5cd35bc9 [Change] Constants based on the CODATA 2018 (#398) 2020-08-17 21:52:39 +02:00
Quentin
fa5bfaf15d Merge pull request #347 from boricj/feature/rtcBringup
[Feature] Real-time clock
2020-08-16 17:57:43 +02:00
Jean-Baptiste Boric
eff8f09dda [apps] Settings for date/time 2020-08-16 15:49:40 +02:00
Jean-Baptiste Boric
43376996a1 [python] Add RTC functions in time module 2020-08-16 15:49:40 +02:00
Jean-Baptiste Boric
93e6daec6b [apps] Show clock in titlebar 2020-08-16 15:49:40 +02:00
Jean-Baptiste Boric
2fd15b7d7f [ion] Add RTC subsystem 2020-08-16 15:49:40 +02:00
Hugo Saint-Vignes
7eb694822d [python] Add magenta color
Change-Id: I7a5e12f6f3d79da802149a6aeef88387941ccdd8
2020-08-11 17:08:23 +02:00
Hugo Saint-Vignes
0b683b6994 [apps/shared] Handle identical layout in MinimalSizeForOptimalDisplay
Change-Id: I99a523e9e88ea9c3064e4367d96b01edb0020df9
2020-08-11 17:06:07 +02:00
Quentin Guidée
60f871c29c [build/doc] Fix CSS indentation 2020-08-10 21:27:40 +02:00
Quentin
07da4831b1 Merge pull request #395 from M4xi1m3/omega-dev-doc
[build/doc] Custom CSS, for the pleasure of your eyes.
2020-08-10 16:02:00 +02:00
M4x1m3
dbc0e94c91 [build/doc] Custom CSS, for the pleasure of your eyes. 2020-08-10 15:57:02 +02:00
Quentin Guidée
b987d22419 Merge branch 'omega-hotfix' into omega-dev 2020-08-09 13:28:57 +02:00
Quentin Guidée
a74a5ac796 [fix] conflicts 2020-08-09 13:28:22 +02:00
Quentin Guidée
e2dfb9fc4f Merge branch 'omega-hotfix' into omega-dev 2020-08-06 15:24:58 +02:00
Quentin Guidée
4f30089d47 Revert "Merge pull request #393 from RedGl0w/MenuFix"
This reverts commit a9d75c6c7a, reversing
changes made to ebc9384131.
2020-08-06 15:23:08 +02:00
Quentin Guidée
d0de9b4af2 [omega] Set version to 1.21.0 2020-08-05 10:44:08 +02:00
Quentin Guidée
7a40497a9f Merge branch 'omega-hotfix' into omega-dev 2020-08-04 10:36:11 +02:00
Léa Saviot
edafa0e155 [poincare/multiplication] Assert no child is undef in removeUnit 2020-07-29 10:13:19 +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
Léa Saviot
f3628f368f [poincare/expression] Return undef if simplification interrupted
Without this change, we would get weird "reduced" expression, such as
multiplication(undef, _s), but we do not always check
sSimplificationHasBeenInterrupted afterwards.
2020-07-29 10:13:19 +02:00
Hugo Saint-Vignes
5c75cc55d3 [apps/shared] Apply changes on confirm with GoTo functions
Change-Id: I6ebec412b4b6612710476274a8665375d21f9ef8
2020-07-29 10:07:07 +02:00
Hugo Saint-Vignes
61792058d3 [apps/shared] Fix typos for Interval and curve view temporary params
Change-Id: I610726ed5966d353397be923b76dd003297940a7
2020-07-29 10:07:07 +02:00
Joachim LF
d37bf9e344 [Apps/Shared] Fixed interval and curve view exit 2020-07-29 10:07:07 +02:00
Émilie Feral
b4a3dd10e1 [apps/shared] ToolBoxHelpers: don't overflow buffer
If the commandLength is > than the buffer size, we have to escape at
some point to avoid overflowing the buffer.
2020-07-29 09:43:51 +02:00
Quentin
a9d75c6c7a Merge pull request #393 from RedGl0w/MenuFix
[Apps/home] Change menu behaviour with incomplete lines
2020-07-27 16:45:30 +02:00
Joachim LF
c57f8d257b [Apps/home] Change menu behaviour with incomplete lines 2020-07-27 16:41:01 +02:00
Quentin
ebc9384131 Merge pull request #392 from RedGl0w/KeyDown
[ion/src/simulator] Visual keyboard only change state on keydown
2020-07-27 13:25:20 +02:00
Quentin
b478c98fe0 Merge pull request #391 from quentinguidee/omega-rename-username
[username] Change USERNAME to OMEGA_USERNAME
2020-07-24 10:27:12 +02:00
Quentin Guidée
93f4281bdc [themes] Update submodule 2020-07-24 09:05:01 +02:00
Quentin Guidée
7b07a2e3ac [username] Change USERNAME to OMEGA_USERNAME 2020-07-24 08:24:12 +02:00
Quentin
d2a2925746 Merge pull request #390 from quentinguidee/omega-hotfix
[apps/settings] remove LEDS_CHOICE
2020-07-24 00:03:03 +02:00
Quentin Guidée
7fc145d455 [apps/settings] remove LEDS_CHOICE 2020-07-23 23:22:31 +02:00
Quentin Guidée
2f246ad604 [android] Change SDK version to 29 2020-07-23 20:15:24 +02:00
Quentin Guidée
d1aaa7c125 Merge branch 'omega-hotfix' into omega-dev 2020-07-23 18:24:39 +02:00
Quentin Guidée
0235de8010 [omega] 1.20.2 2020-07-23 18:23:30 +02:00
Quentin Guidée
636c5c1d24 Merge branch 'omega-hotfix' into omega-master 2020-07-23 18:23:11 +02:00
Quentin
36bcd138d8 Merge pull request #389 from M4xi1m3/omega-hotfix
Omega 1.20.2
2020-07-23 18:07:37 +02:00
Quentin Guidée
22415c1bc3 [ion/src/simulator] Update background.jpg 2020-07-23 18:06:27 +02:00
M4x1m3
12fb82b028 [apps/code] Added os in toolbox 2020-07-23 17:13:40 +02:00
M4x1m3
c5500eee06 [mpy/os] Removes useless file 2020-07-23 11:12:31 +02:00
M4x1m3
587ea39aaf [app/code] Wipe scripts when adding one with opt 2020-07-23 11:12:31 +02:00
M4x1m3
f582ce0e6d [simu] Added shadow to logo 2020-07-23 11:12:31 +02:00
M4x1m3
b11c58f11c [simu] Persistant script store (and other stuff) 2020-07-23 11:12:27 +02:00
Quentin Guidée
7bdd973ddc Merge branch 'omega-hotfix' into omega-dev 2020-07-21 22:38:03 +02:00
Quentin Guidée
32be8854c9 [omega] 1.20.1 2020-07-21 22:37:29 +02:00
Quentin Guidée
4af76cc3ae [omega] 1.20.1 2020-07-21 22:32:19 +02:00
Quentin
93c431be04 Merge pull request #387 from M4xi1m3/omega-hotfix
[mpy] Fix crash on append on new file, new os module
2020-07-21 22:30:32 +02:00
M4x1m3
63acf7b0ee [app/code] Changed color of mandelbrot script 2020-07-21 22:27:04 +02:00
M4x1m3
14a3ea51c4 [mpy/os] listdir 2020-07-21 22:27:04 +02:00
M4x1m3
18ccc0c771 [mpy/os] rename 2020-07-21 22:27:04 +02:00
M4x1m3
f65881420c [mpy/file] Fixed concurency issues 2020-07-21 22:27:04 +02:00
M4x1m3
8eeae5f161 [mpy/os] Added remove 2020-07-21 22:27:04 +02:00
M4x1m3
2dce8a1343 [mpy/os] uname 2020-07-21 22:27:00 +02:00
M4x1m3
b9a6298ffa [mpy] Added os module 2020-07-21 18:00:12 +02:00
M4x1m3
2040a2cd5b [mpy/files] Fixed crash with new files in append mode 2020-07-21 16:57:57 +02:00
Quentin Guidée
a38297f8d0 [github] Fix README.md 2020-07-21 09:41:07 +02:00
Quentin
f3067ccfee [Fix] Conflicts 2020-07-21 09:41:07 +02:00
Quentin Guidée
73037e3faf [github] Fix README.md 2020-07-21 09:32:14 +02:00
Léa Saviot
3e6e1729a2 [ion/device] Add screen id for gamma calibration 2020-07-20 10:35:59 +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
Léa Saviot
708477dece [apps/i18n] Fix missing upper case 2020-07-16 11:53:12 +02:00
Léa Saviot
b4dd4b5e7e [apps/code/i18n] Make italian wording fit 2020-07-16 11:53:12 +02:00
Léa Saviot
c20261940f [poincare] Handle removeUnit that create Undefined expressions
UnitConvert::removeUnit replaces the unit ocnvert with an undefined.
2020-07-16 11:46:23 +02:00
Léa Saviot
3a046f5bcb [poincare/multiplication] Fix Multiplication::removeUnit
Scenario:
f(x) = 0->_A
evaluate 0f(0)
2020-07-16 11:46:23 +02:00
Léa Saviot
36bc70aaee [poincare/power] Better Power::shallowReduce
Take care of an undefined index that arrived during the remove unit
2020-07-16 11:46:23 +02:00
Léa Saviot
9e94304db0 [poincre/test] Rename assert_simplify -> assert_reduce
And assert_expression_simplify -> assert_expression_reduce
2020-07-16 11:46:23 +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
Joachim LF
4a5681576c Visual keyboard only change state on keydown 2020-07-09 19:17:36 +02:00
Garret Kelly
668bc95f15 [build] Don't invoke bash-specific '[['
'[[' isn't available when $SHELL isn't set to bash, so use expr from
coreutils to check for the presence of the device in DFU mode.
2020-01-15 22:34:39 -05:00
1044 changed files with 23124 additions and 9262 deletions

View File

@@ -2,13 +2,26 @@
name: Bug report
about: Omega is not working like it should? Let us know!
title: ''
labels: Bug, Triage
labels: 'Status: Triage, Type: Bug'
assignees: ''
---
#### Describe the bug
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
#### Environment
- Omega Version: {go to settings > about > Omega Version and type the version here}
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Desktop (please complete the following information):**
- Omega Version: [go to settings > about > Omega Version and type the version here]

View File

@@ -1 +0,0 @@
blank_issues_enabled: false

View File

@@ -1,10 +1,17 @@
---
name: Feature request
about: Suggest an idea for an improvement of Omega
about: Suggest an idea for Omega
title: ''
labels: Feature, Triage
labels: 'Status: Triage, Type: Feature'
assignees: ''
---
#### What I want to see in the next version of Omega
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Additional context**
Add any other context or screenshots about the feature request here.

View File

@@ -0,0 +1,28 @@
---
name: OMEGA BETA ONLY - Bug report
about: Omega 1.21 is not working like it should? Let us know!
title: "[BETA-1.21] …"
labels: 'Status: Triage, Type: Bug'
assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Desktop (please complete the following information):**
- Omega Version: [go to settings > about > Omega Version and type the version here]
- Discord username: ..........#....

View File

@@ -1,8 +1,8 @@
---
name: Other
about: A question? A problem? ...
about: A question? A problem?
title: ''
labels: Triage
labels: 'Status: Triage'
assignees: ''
---

View File

@@ -2,18 +2,18 @@
name: Problems during installation
about: Need help to install Omega?
title: ''
labels: Installation issue, Triage
labels: 'Status: Triage, Type: Installation issue'
assignees: ''
---
#### Describe the problem
**Describe the problem**
#### Logs
**Logs**
```
Copy/paste the logs here (If you have some)
```
#### Environment
**Environment**
- Omega Version: {go to settings > about > Omega Version and type the version here}

View File

@@ -1,31 +1,54 @@
name: Continuous integration
on: [pull_request, push]
#on: [pull_request, push]
on:
push:
pull_request:
workflow_dispatch:
inputs:
triggerIos:
description: 'Run iOS tests'
required: true
default: 'no'
triggerMacos:
description: 'Run macOS tests'
required: true
default: 'no'
trigger3DS:
description: 'Run 3DS tests'
required: true
default: 'no'
jobs:
# nintendo_3ds:
# runs-on: ubuntu-latest
# steps:
# - run: wget https://github.com/devkitPro/pacman/releases/download/v1.0.2/devkitpro-pacman.amd64.deb -O /tmp/devkitpro-pacman.deb
# - run: yes | sudo dpkg -i /tmp/devkitpro-pacman.deb
# - run: yes | sudo dkp-pacman -Syu --needed devkitARM 3dstools libctru
# - run: echo ::set-env name=DEVKITPRO::/opt/devkitpro
# - run: echo ::set-env name=DEVKITARM::/opt/devkitpro/devkitARM
# - run: echo ::set-env name=PATH::$DEVKITPRO/tools/bin:$DEVKITARM/bin:$PATH
# - uses: actions/checkout@v1
# with:
# submodules: true
# - run: make -j2 PLATFORM=simulator TARGET=3ds
# - uses: actions/upload-artifact@master
# with:
# name: epsilon-3ds.3dsx
# path: output/release/simulator/3ds/epsilon.3dsx
android:
nintendo_3ds:
if: github.event.inputs.trigger3DS == 'yes'
runs-on: ubuntu-latest
steps:
- run: wget https://github.com/devkitPro/pacman/releases/download/v1.0.2/devkitpro-pacman.amd64.deb -O /tmp/devkitpro-pacman.deb
- run: yes | sudo dpkg -i /tmp/devkitpro-pacman.deb
- run: yes | sudo dkp-pacman -Syu --needed devkitARM 3dstools libctru
- run: echo ::set-env name=DEVKITPRO::/opt/devkitpro
- run: echo ::set-env name=DEVKITARM::/opt/devkitpro/devkitARM
- run: echo ::set-env name=PATH::$DEVKITPRO/tools/bin:$DEVKITARM/bin:$PATH
- uses: actions/checkout@v1
with:
submodules: true
- run: make -j2 PLATFORM=simulator TARGET=3ds
- run: make -j2 PLATFORM=simulator TARGET=3ds epsilon.cia
- uses: actions/upload-artifact@master
with:
name: epsilon-3ds.3dsx
path: output/release/simulator/3ds/epsilon.3dsx
- uses: actions/upload-artifact@master
with:
name: epsilon-3ds.cia
path: output/release/simulator/3ds/epsilon.cia
android:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- run: make -j2 PLATFORM=simulator TARGET=android
- uses: actions/upload-artifact@master
with:
@@ -35,10 +58,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- run: sudo apt-get install build-essential imagemagick libfreetype6-dev libjpeg-dev libpng-dev pkg-config
- uses: numworks/setup-arm-toolchain@v1
- uses: actions/checkout@v1
- uses: numworks/setup-arm-toolchain@2020-q2
- uses: actions/checkout@v2
with:
submodules: true
submodules: 'recursive'
- run: mkdir final-output
- run: make -j2 MODEL=n0100 EPSILON_I18N=en output/release/device/n0100/epsilon.onboarding.two_binaries
- run: mv output/release/device/n0100/epsilon.onboarding.internal.bin final-output/epsilon.onboarding.internal.en.bin
@@ -76,10 +99,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- run: sudo apt-get install build-essential imagemagick libfreetype6-dev libjpeg-dev libpng-dev pkg-config
- uses: numworks/setup-arm-toolchain@v1
- uses: actions/checkout@v1
- uses: numworks/setup-arm-toolchain@2020-q2
- uses: actions/checkout@v2
with:
submodules: true
submodules: 'recursive'
- run: make -j2 epsilon.dfu
- run: make -j2 epsilon.onboarding.dfu
- run: make -j2 epsilon.onboarding.update.dfu
@@ -94,15 +117,31 @@ jobs:
with:
name: epsilon-binpack-n0110.tgz
path: output/release/device/n0110/binpack-n0110.tgz
windows:
runs-on: windows-latest
defaults:
run:
shell: msys2 {0}
steps:
- uses: msys2/setup-msys2@v2
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- run: pacman -S --noconfirm mingw-w64-x86_64-gcc mingw-w64-x86_64-freetype mingw-w64-x86_64-pkg-config make mingw-w64-x86_64-python3 mingw-w64-x86_64-libjpeg-turbo mingw-w64-x86_64-libpng
- run: make -j2 PLATFORM=simulator
- uses: actions/upload-artifact@master
with:
name: epsilon-windows.exe
path: output/release/simulator/windows/epsilon.exe
web:
runs-on: ubuntu-latest
steps:
- uses: numworks/setup-emscripten@v2
- uses: numworks/setup-emscripten@v1
with:
sdk: latest-upstream
- uses: actions/checkout@v1
- uses: actions/checkout@v2
with:
submodules: true
submodules: 'recursive'
- run: make -j2 PLATFORM=simulator TARGET=web
- uses: actions/upload-artifact@master
with:
@@ -112,12 +151,41 @@ jobs:
runs-on: ubuntu-latest
steps:
- run: sudo apt-get install build-essential imagemagick libfreetype6-dev libjpeg-dev libpng-dev pkg-config
- uses: actions/checkout@v1
- uses: actions/checkout@v2
with:
submodules: true
submodules: 'recursive'
- run: make -j2 PLATFORM=simulator
- uses: actions/upload-artifact@master
with:
name: epsilon-linux.bin
path: output/release/simulator/linux/epsilon.bin
- run: make -j2 PLATFORM=simulator test.headless.bin
macos:
if: github.event.inputs.triggerMacos == 'yes'
runs-on: macOS-latest
steps:
- run: brew install numworks/tap/epsilon-sdk
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- run: make -j2 PLATFORM=simulator
- uses: actions/upload-artifact@master
with:
name: epsilon-macos.zip
path: output/release/simulator/macos/epsilon.app
ios:
if: github.event.inputs.triggerIos == 'yes'
runs-on: macOS-latest
steps:
- run: brew install numworks/tap/epsilon-sdk
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- run: make -j2 PLATFORM=simulator TARGET=ios EPSILON_TELEMETRY=0
- run: make -j2 PLATFORM=simulator TARGET=ios EPSILON_TELEMETRY=0 APPLE_PLATFORM=ios-simulator
- uses: actions/upload-artifact@master
with:
name: epsilon-ios.ipa
path: output/release/simulator/ios/epsilon.ipa
env:
ACCEPT_OFFICIAL_TOS: 1

View File

@@ -1,5 +1,5 @@
name: Metrics
on: [pull_request]
on: [pull_request_target]
jobs:
binary-size:
@@ -8,7 +8,7 @@ jobs:
- name: Install dependencies
run: sudo apt-get install build-essential imagemagick libfreetype6-dev libjpeg-dev libpng-dev pkg-config
- name: Install ARM toolchain
uses: numworks/setup-arm-toolchain@v1
uses: numworks/setup-arm-toolchain@2020-q2
- name: Checkout PR base
uses: actions/checkout@v2
with:
@@ -28,11 +28,14 @@ jobs:
- name: Retrieve binary size analysis
id: binary_size
run: echo "::set-output name=table::$(python3 head/build/metrics/binary_size.py base/output/release/device/n0110/epsilon.elf head/output/release/device/n0110/epsilon.elf --labels Base Head --sections .text .rodata .bss .data --custom 'Total (RAM)' .data .bss --custom 'Total (ROM)' .text .rodata .data --escape)"
- name: Prepare comment auth
run: echo "::set-env name=GITHUB_TOKEN::$(echo YjgxYTk1YTQ4YzYxNjU4ZTA3YWQzNDYwNTk3ZTI2MTlkODU5MThlOQo= | base64 --decode)"
- name: Add comment
uses: actions/github@v1.0.0
env:
GITHUB_TOKEN: ${{ env.GITHUB_TOKEN }}
uses: actions/github-script@v3.0.0
with:
args: comment ${{ steps.binary_size.outputs.table }}
github-token: ${{ secrets.OMEGA_ROBOT_TOKEN }}
script: |
await github.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.pull_request.number,
body: `${{ steps.binary_size.outputs.table }}`,
});

14
.github/workflows/unit-workflow.yml vendored Normal file
View File

@@ -0,0 +1,14 @@
name: Unit tests
on: [pull_request_target]
jobs:
units:
runs-on: ubuntu-latest
steps:
- run: sudo apt-get install build-essential imagemagick libfreetype6-dev libjpeg-dev libpng-dev pkg-config
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- run: make -j2 PLATFORM=simulator test.headless.bin
- run: output/release/simulator/linux/test.headless.bin

9
.gitmodules vendored
View File

@@ -1,9 +1,6 @@
[submodule "apps/rpn"]
path = apps/rpn
url = https://github.com/Omega-Numworks/Omega-RPN.git
[submodule "apps/atom"]
path = apps/atom
url = https://github.com/Omega-Numworks/Omega-Atom.git
[submodule "themes"]
path = themes
url = https://github.com/Omega-Numworks/Omega-Themes.git
[submodule "apps/atomic"]
path = apps/atomic
url = https://github.com/Omega-Numworks/Omega-Atomic.git

View File

@@ -40,7 +40,6 @@ info:
@echo "BUILD_DIR = $(BUILD_DIR)"
@echo "PLATFORM" = $(PLATFORM)
@echo "DEBUG" = $(DEBUG)
@echo "LEDS_CHOICE" = $(LEDS_CHOICE)
@echo "EPSILON_GETOPT" = $(EPSILON_GETOPT)
@echo "ESCHER_LOG_EVENTS_BINARY" = $(ESCHER_LOG_EVENTS_BINARY)
@echo "QUIZ_USE_CONSOLE" = $(QUIZ_USE_CONSOLE)
@@ -178,7 +177,7 @@ cleanandcompile:
.PHONY: start
start:
@echo "INFO Starting output/$(BUILD_TYPE)/simulator/$(HOST)/epsilon.$(EXE)"
@$(Q) output/$(BUILD_TYPE)/simulator/$(HOST)/epsilon.$(EXE)
@$(Q) output/$(BUILD_TYPE)/simulator/$(HOST)/epsilon.$(EXE) -v
.PHONY: clean_run
clean_run: cleanandcompile

177
README.fr.md Normal file
View File

@@ -0,0 +1,177 @@
<p align="center"><img src="https://user-images.githubusercontent.com/12123721/111199951-80bd3d00-85c1-11eb-936c-28cf590208b8.png" /></p>
<p align="center">
<a href="https://creativecommons.org/licenses/by-nc-sa/4.0/"><img alt="cc by-nc-sa 4.0" src="https://img.shields.io/badge/License-CC%20BY--NC--SA%204.0-525252.svg?labelColor=292929&logo=creative%20commons&style=for-the-badge" /></a>
<a href="https://github.com/Omega-Numworks/Omega/issues"><img alt="Issues" src="https://img.shields.io/github/issues/Omega-Numworks/Omega.svg?labelColor=292929&logo=git&style=for-the-badge" /></a>
<br/>
<a href="https://discord.gg/X2TWhh9"><img alt="Discord" src="https://img.shields.io/discord/663420259851567114?color=blue&labelColor=292929&label=chat%20-%20discord&logo=discord&style=for-the-badge" /></a>
</p>
> Don't understand french ? speak english ? here's the [english README](./README.md) !
## À propos
Omega est un fork d'Epsilon, l'OS de Numworks tournant sur les calculatrices du même nom, qui apporte beaucoup de fonctionnalités en plus. Omega est fait pour ceux qui aimeraient ajouter certaines fonctionnalités ayant été rejetées par Numworks à leurs calculatrices (pour des raisons 100% compréhensibles !). [Essayez en ligne](https://getomega.web.app/simulator).
### Quelques fonctionnalités supplémentaires
- Retour du calcul littéral
- Une application RPN
- Application Externes
- Des thèmes
- Python amélioré (module os, méthode open...)
- Un tableau périodique et toutes les masses molaires des éléments dans la toolbox
- *Ainsi que d'autres à découvrir...* [Changelogs complets](https://github.com/Omega-Numworks/Omega/wiki/Changelog) | [Fonctionnalités princpales & captures d'écran](https://github.com/Omega-Numworks/Omega/wiki/Main-features).
## Installation
### Automatique
Vous pouvez installer Omega automatiquement depuis [notre site](https://getomega.web.app/) sur la page "installer".
<a href="https://getomega.web.app"><p align="center"><img alt="Omega Banner Discord" src="https://user-images.githubusercontent.com/12123721/86352956-e9000480-bc66-11ea-82b7-79fd7e56fa27.png" /></p></a>
### Manuelle
Tout d'abord, suivez **la première étape** [ici](https://www.numworks.com/resources/engineering/software/build/), puis :
<details>
<summary><b>Modèle n0100</b></summary>
(note : vous pouvez changer `EPSILON_I18N=fr` en `en`, `nl`, `pt`, `it`, `de`, `es` ou `hu`).
```bash
git clone --recursive https://github.com/Omega-Numworks/Omega.git
cd Omega
git checkout omega-master
make MODEL=n0100 clean
make MODEL=n0100 EPSILON_I18N=fr OMEGA_USERNAME="{Votre nom ici, 15 caractères max}" -j4
make MODEL=n0100 epsilon_flash
```
Important : N'oubliez pas l'argument `--recursive`, Omega a besoin de sous-modules.
Vous pouvez aussi changer le nombre de processus parallèles pendant la compilation en changeant la valeur suivant `-j`.
</details>
<details>
<summary><b>Modèle n0110</b></summary>
```bash
git clone --recursive https://github.com/Omega-Numworks/Omega.git
cd Omega
git checkout omega-master
make clean
make OMEGA_USERNAME="{Votre nom ici, 15 caractères max}" -j4
make epsilon_flash
```
Important : N'oubliez pas l'argument `--recursive`, Omega a besoin de sous-modules.
Vous pouvez aussi changer le nombre de processus parallèles pendant la compilation en changeant la valeur suivant `-j`.
</details>
<details>
<summary><b>Fichiers binaires</b></summary>
Ces fichiers peuvent être utilisés pour distribuer Omega (pour que tout le monde puisse le flasher via [Webdfu_Numworks](https://ti-planet.github.io/webdfu_numworks/)).
```bash
git clone --recursive https://github.com/Omega-Numworks/Omega.git
cd Omega
git checkout omega-master
make clean
make MODEL=n0100 OMEGA_USERNAME="" -j8
make MODEL=n0100 OMEGA_USERNAME="" binpack -j8
make OMEGA_USERNAME="" -j8
make OMEGA_USERNAME="" binpack -j8
```
Important : N'oubliez pas l'argument `--recursive`, Omega a besoin de sous-modules.
Vous pouvez aussi changer le nombre de processus parallèles pendant la compilation en changeant la valeur suivant `-j`.
</details>
<details>
<summary><b>Simulateur web</b></summary>
D'abord, installez emsdk :
```bash
git clone https://github.com/emscripten-core/emsdk.git
cd emsdk
./emsdk install latest-fastcomp
./emsdk activate latest-fastcomp
source emsdk_env.sh
```
Puis, compilez Omega :
```bash
git clone --recursive https://github.com/Omega-Numworks/Omega.git
cd Omega
git checkout omega-master
make clean
make PLATFORM=simulator TARGET=web OMEGA_USERNAME="{Votre nom ici, 15 caractères max}" -j4
```
Le simulateur se trouve dans `output/release/simulator/web/simulator.zip`
Important : N'oubliez pas l'argument `--recursive`, Omega a besoin de sous-modules.
Vous pouvez aussi changer le nombre de processus parallèles pendant la compilation en changeant la valeur suivant `-j`.
</details>
<details>
<summary><b>Simulateur 3DS</b></summary>
Vous aurez besoin de devkitPro et de devkitARM disponible dans votre `$PATH` (instructions [ici](https://devkitpro.org/wiki/Getting_Started) (en anglais))
```bash
git clone --recursive https://github.com/Omega-Numworks/Omega.git
cd Omega
git checkout --recursive omega-dev
make PLATFORM=simulator TARGET=3ds -j
```
Vous pouvez ensuite copier epsilon.3dsx sur une carte SD pour l'exécuter depuis le HBC ou utiliser 3dslink pour le lancer via le réseau :
```bash
3dslink output/release/simulator/3ds/epsilon.3dsx -a <ADRESSE IP 3DS>
```
</details>
Si vous avez besoin d'aide, n'hésitez pas à rejoindre notre serveur discord : https://discord.gg/X2TWhh9
<a href="https://discord.gg/X2TWhh9"><p align="center"><img alt="Omega Banner Discord" src="https://user-images.githubusercontent.com/12123721/86287349-54ef5800-bbe8-11ea-80c1-34eb1f93eebd.png" /></p></a>
---
## Contribution
Pour contribuer, merci de lire le [Wiki](https://github.com/Omega-Numworks/Omega/wiki/Contributing)
## Nos autres projets
* [Omega Themes](https://github.com/Omega-Numworks/Omega-Themes)
* [Omega Website](https://github.com/Omega-Numworks/Omega-Website)
* [Omega RPN `APP`](https://github.com/Omega-Numworks/Omega-RPN)
* [Omega Atomic `APP`](https://github.com/Omega-Numworks/Omega-Atomic)
* [Omega Design](https://github.com/Omega-Numworks/Omega-Design)
* [Omega Discord Bot](https://github.com/Omega-Numworks/Omega-Discord-Bot)
* [Omega App Template `BETA`](https://github.com/Omega-Numworks/Omega-App-Template)
* [External Apps](https://github.com/Omega-Numworks/External-Apps)
## À propos d'Epsilon
Omega est un fork d'Epsilon, un système d'exploitation performant pour calculatrices graphiques. Il inclut huit applications pour les mathématiques de lycée et d'études supérieurs
Vous pouvez essayer Epsilon depuis votre navigateur sur le [simulateur en ligne](https://www.numworks.com/simulator/).
## Licence
NumWorks est une marque déposée de NumWorks SAS, 24 Rue Godot de Mauroy, 75009 Paris, France.
Nintendo est Nintendo 3DS sont des marques déposées de Nintendo of America Inc, 4600 150th Ave NE, Redmond, WA 98052, Etats-Unis.
NumWorks SAS et Nintendo of America Inc ne sont en aucun cas associés avec ce projet.
* NumWorks Epsilon est disponible sous [Lisense CC BY-NC-SA](https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode).
* Omega est disponible sous [Lisense CC BY-NC-SA](https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode).

View File

@@ -1,4 +1,4 @@
<p align="center"><img src="https://user-images.githubusercontent.com/12123721/87953533-75a22380-caab-11ea-8cde-c40291c4a9ae.png" /></p>
<p align="center"><img src="https://user-images.githubusercontent.com/12123721/111199951-80bd3d00-85c1-11eb-936c-28cf590208b8.png" /></p>
<p align="center">
<a href="https://creativecommons.org/licenses/by-nc-sa/4.0/"><img alt="cc by-nc-sa 4.0" src="https://img.shields.io/badge/License-CC%20BY--NC--SA%204.0-525252.svg?labelColor=292929&logo=creative%20commons&style=for-the-badge" /></a>
@@ -7,19 +7,20 @@
<a href="https://discord.gg/X2TWhh9"><img alt="Discord" src="https://img.shields.io/discord/663420259851567114?color=blue&labelColor=292929&label=chat%20-%20discord&logo=discord&style=for-the-badge" /></a>
</p>
> Vous ne comprenez pas l'anglais ? vous êtes francophone ? Regardez le [*LISEZ-MOI* français](./README.fr.md) !
## About
Omega is a fork of Numworks' Epsilon, the OS that runs on their calculator, which brings many features to it. Omega is for the people who want to add features to the calculator, but cannot because they have been rejected by Numworks (for reasons that are 100% understandable!).
Omega is a fork of Numworks' Epsilon, the OS that runs on their calculator, which brings many features to it. Omega is for the people who want to add features to the calculator, but cannot because they have been rejected by Numworks (for reasons that are 100% understandable!). [Try it online](https://getomega.web.app/simulator).
## Some new features
### Some new features
- Adding symbolic calculation back into the calculator
- An app for RPN
- Exernal apps
- A theme engine
- New python features (os module, open method...)
- A periodic table app + all of the molar masses for the elements in the toolbox
- More steps for brightness (16 instead of 5)
- ~~32 KB Python heap instead of 16 KB~~ Now available on Epsilon `>=13.2.0`!
- And more...
The main new features are listed [here](https://github.com/Omega-Numworks/Omega/wiki/Main-features), and the complete changelog can be found [here](https://github.com/Omega-Numworks/Omega/wiki/Complete-changelog).
- *And much more to discover...* [Complete changelog](https://github.com/Omega-Numworks/Omega/wiki/Changelog) | [Main new features + screenshots](https://github.com/Omega-Numworks/Omega/wiki/Main-features).
## Installation
@@ -36,12 +37,14 @@ First of all, follow **step 1** [here](https://www.numworks.com/resources/engine
<details>
<summary><b>Model n0100</b></summary>
```
(note: you can change the `EPSILON_I18N=en` flag to `fr`, `nl`, `pt`, `it`, `de`, `es` or `hu`).
```bash
git clone --recursive https://github.com/Omega-Numworks/Omega.git
cd Omega
git checkout omega-master
make MODEL=n0100 clean
make MODEL=n0100 USERNAME="{Your name, max 15 characters}" -j4
make MODEL=n0100 EPSILON_I18N=en OMEGA_USERNAME="{Your name, max 15 characters}" -j4
make MODEL=n0100 epsilon_flash
```
@@ -53,12 +56,12 @@ Also, you can change the number of processes that run in parallel during the bui
<details>
<summary><b>Model n0110</b></summary>
```
```bash
git clone --recursive https://github.com/Omega-Numworks/Omega.git
cd Omega
git checkout omega-master
make clean
make USERNAME="{Your name, max 15 characters}" -j4
make OMEGA_USERNAME="{Your name, max 15 characters}" -j4
make epsilon_flash
```
@@ -72,15 +75,15 @@ Also, you can change the number of processes that run in parallel during the bui
These can be used to distribute Omega (so that it can be flashed by anyone with [Webdfu_Numworks](https://ti-planet.github.io/webdfu_numworks/)).
```
```bash
git clone --recursive https://github.com/Omega-Numworks/Omega.git
cd Omega
git checkout omega-master
make clean
make MODEL=n0100 USERNAME="" -j8
make MODEL=n0100 USERNAME="" binpack -j8
make USERNAME="" -j8
make USERNAME="" binpack -j8
make MODEL=n0100 OMEGA_USERNAME="" -j8
make MODEL=n0100 OMEGA_USERNAME="" binpack -j8
make OMEGA_USERNAME="" -j8
make OMEGA_USERNAME="" binpack -j8
```
Important: Don't forget the `--recursive` tag, because Omega relies on submodules.
@@ -93,7 +96,7 @@ Also, you can change the number of processes that run in parallel during the bui
First, install emsdk :
```
```bash
git clone https://github.com/emscripten-core/emsdk.git
cd emsdk
./emsdk install latest-fastcomp
@@ -103,12 +106,12 @@ source emsdk_env.sh
Then, compile Omega :
```
```bash
git clone --recursive https://github.com/Omega-Numworks/Omega.git
cd Omega
git checkout omega-master
make clean
make PLATFORM=simulator TARGET=web USERNAME="{Your name, max 15 characters}" -j4
make PLATFORM=simulator TARGET=web OMEGA_USERNAME="{Your name, max 15 characters}" -j4
```
The simulator is now in `output/release/simulator/web/simulator.zip`
@@ -122,14 +125,16 @@ Also, you can change the number of processes that run in parallel during the bui
<summary><b>3DS Simulator</b></summary>
You need devkitPro and devkitARM installed and in your path (instructions [here](https://devkitpro.org/wiki/Getting_Started))
```
```bash
git clone --recursive https://github.com/Omega-Numworks/Omega.git
cd Omega
git checkout --recursive omega-dev
make PLATFORM=simulator TARGET=3ds -j
```
You can then put epsilon.3dsx on a SD card to run it from the HBC or use 3dslink to launch it over the network:
```
```bash
3dslink output/release/simulator/3ds/epsilon.3dsx -a <3DS' IP ADDRESS>
```
@@ -144,20 +149,16 @@ If you need help, you can join our Discord server here : https://discord.gg/X2TW
To contribute, please refer to the [Wiki](https://github.com/Omega-Numworks/Omega/wiki/Contributing)
## Branches
* `omega-master` : stable releases
* `omega-dev` : beta releases
* `omega-hotfix` : developers only, branch to fix issues
## Related repositories
* [Omega Themes](https://github.com/Omega-Numworks/Omega-Themes)
* [Omega Website](https://github.com/Omega-Numworks/Omega-Website)
* [Omega RPN `APP`](https://github.com/Omega-Numworks/Omega-RPN)
* [Omega Atom `APP`](https://github.com/Omega-Numworks/Omega-Atom)
* [Omega Atomic `APP`](https://github.com/Omega-Numworks/Omega-Atomic)
* [Omega Design](https://github.com/Omega-Numworks/Omega-Design)
* [Omega Discord Bot](https://github.com/Omega-Numworks/Omega-Discord-Bot)
* [Omega App Template `BETA`](https://github.com/Omega-Numworks/Omega-App-Template)
* [External Apps](https://github.com/Omega-Numworks/External-Apps)
## About Epsilon

View File

@@ -11,6 +11,25 @@ apps =
# (path to the apps header).
$(foreach i,${apps_list},${eval include apps/$(i)/Makefile})
app_equals = $(and $(findstring $(1),$(2)),$(findstring $(2),$(1)))
# We list all the apps that are missing
apps_missing = $(foreach i, ${apps_list}, $(if $(call app_equals, apps/$(i)/Makefile, $(wildcard apps/$(i)/Makefile)),, $(i) ) )
# If the two doesn't match, we got an error.
ifneq ($(strip $(apps_missing)),)
miss_modules = 0
# Check if the missing apps are one that are supposed to be submodules
$(foreach i, $(SUBMODULES_APPS), $(if $(call app_equals, $(filter $(i), $(apps_missing)), $(i)), $(eval miss_modules=1)))
ifeq ($(miss_modules), 1)
PLS_IGNORE := $(shell >&2 printf "\nSome submodules apps seem to be missing. To download them, assumming you git clone'd the repo, do\n")
PLS_IGNORE := $(shell >&2 printf " git submodule init\n")
PLS_IGNORE := $(shell >&2 printf " git submodule update\n\n")
endif
$(error Missing apps: $(strip $(apps_missing)))
endif
apps_src += $(addprefix apps/,\
alternate_empty_nested_menu_controller.cpp \
apps_container.cpp \
@@ -25,6 +44,7 @@ apps_src += $(addprefix apps/,\
backlight_dimming_timer.cpp \
battery_timer.cpp \
battery_view.cpp \
clock_timer.cpp \
empty_battery_window.cpp \
exam_pop_up_controller.cpp \
exam_mode_configuration_official.cpp:+official \
@@ -41,7 +61,10 @@ apps_src += $(addprefix apps/,\
title_bar_view.cpp \
)
tests_src += apps/exam_mode_configuration_non_official.cpp
tests_src += $(addprefix apps/,\
exam_mode_configuration_non_official.cpp \
)
snapshots_declaration = $(foreach i,$(apps),$(i)::Snapshot m_snapshot$(subst :,,$(i))Snapshot;)
apps_declaration = $(foreach i,$(apps),$(i) m_$(subst :,,$(i));)
@@ -51,10 +74,13 @@ snapshots_count = $(words $(apps))
snapshot_includes = $(foreach i,$(app_headers),-include $(i) )
epsilon_app_names = '$(foreach i,${apps_list},"$(i)", )'
$(call object_for,apps/apps_container_storage.cpp apps/apps_container.cpp apps/main.cpp): CXXFLAGS += $(snapshot_includes) -DAPPS_CONTAINER_APPS_DECLARATION="$(apps_declaration)" -DAPPS_CONTAINER_SNAPSHOT_DECLARATIONS="$(snapshots_declaration)" -DAPPS_CONTAINER_SNAPSHOT_CONSTRUCTORS="$(snapshots_construction)" -DAPPS_CONTAINER_SNAPSHOT_LIST="$(snapshots_list)" -DAPPS_CONTAINER_SNAPSHOT_COUNT=$(snapshots_count) -DEPSILON_APPS_NAMES=$(epsilon_app_names) -DUSERNAME="$(USERNAME)"
$(call object_for,apps/apps_container_storage.cpp apps/apps_container.cpp apps/main.cpp): CXXFLAGS += $(snapshot_includes) -DAPPS_CONTAINER_APPS_DECLARATION="$(apps_declaration)" -DAPPS_CONTAINER_SNAPSHOT_DECLARATIONS="$(snapshots_declaration)" -DAPPS_CONTAINER_SNAPSHOT_CONSTRUCTORS="$(snapshots_construction)" -DAPPS_CONTAINER_SNAPSHOT_LIST="$(snapshots_list)" -DAPPS_CONTAINER_SNAPSHOT_COUNT=$(snapshots_count) -DEPSILON_APPS_NAMES=$(epsilon_app_names) -DOMEGA_USERNAME="$(OMEGA_USERNAME)"
# I18n file generation
country_preferences = apps/country_preferences.csv
language_preferences = apps/language_preferences.csv
# The header is refered to as <apps/i18n.h> so make sure it's findable this way
SFLAGS += -I$(BUILD_DIR)
@@ -64,14 +90,14 @@ i18n_files += $(addprefix apps/language_,$(addsuffix _iso6391.universal.i18n, $(
endif
i18n_files += $(call i18n_with_universal_for,shared)
i18n_files += $(call i18n_without_universal_for,toolbox)
i18n_files += $(call i18n_with_universal_for,toolbox)
i18n_files += $(call i18n_without_universal_for,variables)
$(eval $(call rule_for, \
I18N, \
apps/i18n.cpp, \
$(i18n_files), \
$$(PYTHON) apps/i18n.py --codepoints $(code_points) --header $$(subst .cpp,.h,$$@) --implementation $$@ --locales $$(EPSILON_I18N) --files $$^ --generateISO6391locales $$(EPSILON_GETOPT), \
$$(PYTHON) apps/i18n.py --codepoints $(code_points) --countrypreferences $(country_preferences) --languagepreferences $(language_preferences) --header $$(subst .cpp,.h,$$@) --implementation $$@ --locales $$(EPSILON_I18N) --countries $$(EPSILON_COUNTRIES) --files $$^ --generateISO6391locales $$(EPSILON_GETOPT), \
global \
))
@@ -84,9 +110,10 @@ $(BUILD_DIR)/apps/i18n.h: $(BUILD_DIR)/apps/i18n.cpp
$(eval $(call depends_on_image,apps/title_bar_view.cpp,apps/exam_icon.png))
$(call object_for,$(apps_src) $(tests_src)): $(BUILD_DIR)/apps/i18n.h
$(call object_for,$(apps_src) $(tests_src)): $(BUILD_DIR)/apps/home/apps_layout.h
$(call object_for,$(apps_src) $(tests_src)): $(BUILD_DIR)/python/port/genhdr/qstrdefs.generated.h
apps_tests_src = $(app_calculation_test_src) $(app_code_test_src) $(app_probability_test_src) $(app_regression_test_src) $(app_sequence_test_src) $(app_shared_test_src) $(app_statistics_test_src) $(app_settings_test_src) $(app_solver_test_src)
apps_tests_src = $(app_calculation_test_src) $(app_code_test_src) $(app_graph_test_src) $(app_probability_test_src) $(app_regression_test_src) $(app_sequence_test_src) $(app_shared_test_src) $(app_statistics_test_src) $(app_settings_test_src) $(app_solver_test_src)
apps_tests_src += $(addprefix apps/,\
alternate_empty_nested_menu_controller.cpp \

View File

@@ -8,6 +8,8 @@
#include <ion/backlight.h>
#include <poincare/preferences.h>
#include <algorithm>
extern "C" {
#include <assert.h>
}
@@ -31,6 +33,7 @@ AppsContainer::AppsContainer() :
m_batteryTimer(),
m_suspendTimer(),
m_backlightDimmingTimer(),
m_clockTimer(ClockTimer(this)),
m_homeSnapshot(),
m_onBoardingSnapshot(),
m_hardwareTestSnapshot(),
@@ -58,8 +61,23 @@ AppsContainer::AppsContainer() :
}
bool AppsContainer::poincareCircuitBreaker() {
constexpr uint64_t minimalPressDuration = 20;
static uint64_t beginningOfInterruption = 0;
Ion::Keyboard::State state = Ion::Keyboard::scan();
return state.keyDown(Ion::Keyboard::Key::Back);
bool interrupt = state.keyDown(Ion::Keyboard::Key::Back) || state.keyDown(Ion::Keyboard::Key::Home) || state.keyDown(Ion::Keyboard::Key::OnOff);
if (!interrupt) {
beginningOfInterruption = 0;
return false;
}
if (beginningOfInterruption == 0) {
beginningOfInterruption = Ion::Timing::millis();
return false;
}
if (Ion::Timing::millis() - beginningOfInterruption > minimalPressDuration) {
beginningOfInterruption = 0;
return true;
}
return false;
}
App::Snapshot * AppsContainer::hardwareTestAppSnapshot() {
@@ -202,6 +220,13 @@ bool AppsContainer::dispatchEvent(Ion::Events::Event event) {
return didProcessEvent || alphaLockWantsRedraw;
}
static constexpr Ion::Events::Event switch_events[] = {
Ion::Events::ShiftSeven, Ion::Events::ShiftEight, Ion::Events::ShiftNine,
Ion::Events::ShiftFour, Ion::Events::ShiftFive, Ion::Events::ShiftSix,
Ion::Events::ShiftOne, Ion::Events::ShiftTwo, Ion::Events::ShiftThree,
Ion::Events::ShiftZero, Ion::Events::ShiftDot, Ion::Events::ShiftEE
};
bool AppsContainer::processEvent(Ion::Events::Event event) {
// Warning: if the window is dirtied, you need to call window()->redraw()
if (event == Ion::Events::USBPlug) {
@@ -226,6 +251,15 @@ bool AppsContainer::processEvent(Ion::Events::Event event) {
switchTo(appSnapshotAtIndex(1));
return true;
}
for(int i = 0; i < std::min((int) (sizeof(switch_events) / sizeof(Ion::Events::Event)), APPS_CONTAINER_SNAPSHOT_COUNT); i++) {
if (event == switch_events[i]) {
m_window.redraw(true);
switchTo(appSnapshotAtIndex(i+1));
return true;
}
}
if (event == Ion::Events::OnOff) {
suspend(true);
return true;
@@ -304,6 +338,10 @@ void AppsContainer::run() {
switchTo(nullptr);
}
bool AppsContainer::updateClock() {
return m_window.updateClock();
}
bool AppsContainer::updateBatteryState() {
bool batteryLevelUpdated = m_window.updateBatteryLevel();
bool pluggedStateUpdated = m_window.updatePluggedState();
@@ -336,7 +374,7 @@ void AppsContainer::shutdownDueToLowBattery() {
* case. */
return;
}
while (Ion::Battery::level() == Ion::Battery::Charge::EMPTY) {
while (Ion::Battery::level() == Ion::Battery::Charge::EMPTY && !Ion::USB::isPlugged()) {
Ion::Backlight::setBrightness(0);
if (!GlobalPreferences::sharedGlobalPreferences()->isInExamMode()) {
/* Unless the LED is lit up for the exam mode, switch off the LED. IF the
@@ -360,7 +398,7 @@ bool AppsContainer::updateAlphaLock() {
return m_window.updateAlphaLock();
}
OnBoarding::PopUpController * AppsContainer::promptController() {
OnBoarding::PromptController * AppsContainer::promptController() {
if (k_promptNumberOfMessages == 0) {
return nullptr;
}
@@ -374,30 +412,7 @@ void AppsContainer::redrawWindow(bool force) {
void AppsContainer::activateExamMode(GlobalPreferences::ExamMode examMode) {
assert(examMode != GlobalPreferences::ExamMode::Off && examMode != GlobalPreferences::ExamMode::Unknown);
reset();
Preferences * preferences = Preferences::sharedPreferences();
switch ((int)preferences->colorOfLED()) {
case 0:
Ion::LED::setColor(KDColorRed);
break;
case 1:
Ion::LED::setColor(KDColorWhite);
break;
case 2:
Ion::LED::setColor(KDColorGreen);
break;
case 3:
Ion::LED::setColor(KDColorBlue);
break;
case 4:
Ion::LED::setColor(KDColorYellow);
break;
case 5:
Ion::LED::setColor(KDColorPurple);
break;
case 6:
Ion::LED::setColor(KDColorOrange);
break;
}
Ion::LED::setColor(KDColorRed);
/* The Dutch exam mode LED is supposed to be orange but we can only make
* blink "pure" colors: with RGB leds on or off (as the PWM is used for
* blinking). The closest "pure" color is Yellow. Moreover, Orange LED is
@@ -432,11 +447,11 @@ Window * AppsContainer::window() {
}
int AppsContainer::numberOfContainerTimers() {
return 3;
return 4;
}
Timer * AppsContainer::containerTimerAtIndex(int i) {
Timer * timers[3] = {&m_batteryTimer, &m_suspendTimer, &m_backlightDimmingTimer};
Timer * timers[4] = {&m_batteryTimer, &m_suspendTimer, &m_backlightDimmingTimer, &m_clockTimer};
return timers[i];
}

View File

@@ -16,7 +16,8 @@
#include "global_preferences.h"
#include "backlight_dimming_timer.h"
#include "shared/global_context.h"
#include "on_boarding/pop_up_controller.h"
#include "clock_timer.h"
#include "on_boarding/prompt_controller.h"
#include <ion/events.h>
@@ -39,13 +40,14 @@ public:
bool dispatchEvent(Ion::Events::Event event) override;
bool switchTo(App::Snapshot * snapshot) override;
void run() override;
bool updateClock();
bool updateBatteryState();
void refreshPreferences();
void reloadTitleBarView();
void displayExamModePopUp(GlobalPreferences::ExamMode mode);
void shutdownDueToLowBattery();
void setShiftAlphaStatus(Ion::Events::ShiftAlphaStatus newStatus);
OnBoarding::PopUpController * promptController();
OnBoarding::PromptController * promptController();
void redrawWindow(bool force = false);
void activateExamMode(GlobalPreferences::ExamMode examMode);
// Exam pop-up controller delegate
@@ -72,10 +74,11 @@ private:
MathToolbox m_mathToolbox;
MathVariableBoxController m_variableBoxController;
ExamPopUpController m_examPopUpController;
OnBoarding::PopUpController m_promptController;
OnBoarding::PromptController m_promptController;
BatteryTimer m_batteryTimer;
SuspendTimer m_suspendTimer;
BacklightDimmingTimer m_backlightDimmingTimer;
ClockTimer m_clockTimer;
Home::App::Snapshot m_homeSnapshot;
OnBoarding::App::Snapshot m_onBoardingSnapshot;
HardwareTest::App::Snapshot m_hardwareTestSnapshot;

View File

@@ -3,6 +3,7 @@
extern "C" {
#include <assert.h>
}
#include <ion/rtc.h>
AppsWindow::AppsWindow() :
Window(),
@@ -19,6 +20,11 @@ bool AppsWindow::updateBatteryLevel() {
return m_titleBarView.setChargeState(Ion::Battery::level());
}
bool AppsWindow::updateClock() {
Ion::RTC::DateTime dateTime = Ion::RTC::dateTime();
return m_titleBarView.setClock(dateTime.tm_hour, dateTime.tm_min, Ion::RTC::mode() != Ion::RTC::Mode::Disabled);
}
bool AppsWindow::updateIsChargingState() {
return m_titleBarView.setIsCharging(Ion::Battery::isCharging());
}

View File

@@ -9,6 +9,7 @@ public:
AppsWindow();
void setTitle(I18n::Message title);
bool updateBatteryLevel();
bool updateClock();
bool updateIsChargingState();
bool updatePluggedState();
void refreshPreferences();

Submodule apps/atom deleted from 8f710a9d3f

1
apps/atomic Submodule

Submodule apps/atomic added at 64f2e38ed1

View File

@@ -9,7 +9,7 @@ BatteryTimer::BatteryTimer() :
bool BatteryTimer::fire() {
AppsContainer * container = AppsContainer::sharedAppsContainer();
bool needRedrawing = container->updateBatteryState();
if (Ion::Battery::level() == Ion::Battery::Charge::EMPTY) {
if (Ion::Battery::level() == Ion::Battery::Charge::EMPTY && !Ion::USB::isPlugged()) {
container->shutdownDueToLowBattery();
}
return needRedrawing;

View File

@@ -17,6 +17,7 @@ app_calculation_src = $(addprefix apps/calculation/,\
additional_outputs/integer_list_controller.cpp \
additional_outputs/scrollable_three_expressions_cell.cpp \
additional_outputs/list_controller.cpp \
additional_outputs/matrix_list_controller.cpp \
additional_outputs/rational_list_controller.cpp \
additional_outputs/trigonometry_graph_cell.cpp \
additional_outputs/trigonometry_list_controller.cpp \

View File

@@ -26,10 +26,10 @@ void ComplexListController::setExpression(Poincare::Expression e) {
}
Poincare::Context * context = App::app()->localContext();
// Fill Calculation Store
m_calculationStore.push("im(z)", context);
m_calculationStore.push("re(z)", context);
m_calculationStore.push("arg(z)", context);
m_calculationStore.push("abs(z)", context);
m_calculationStore.push("im(z)", context, CalculationHeight);
m_calculationStore.push("re(z)", context, CalculationHeight);
m_calculationStore.push("arg(z)", context, CalculationHeight);
m_calculationStore.push("abs(z)", context, CalculationHeight);
// Set Complex illustration
// Compute a and b as in Expression::hasDefinedComplexApproximation to ensure the same defined result

View File

@@ -11,7 +11,7 @@ ExpressionsListController::ExpressionsListController(EditExpressionController *
ListController(editExpressionController),
m_cells{}
{
for (int i = 0; i < k_maxNumberOfCells; i++) {
for (int i = 0; i < k_maxNumberOfRows; i++) {
m_cells[i].setParentResponder(m_listController.selectableTableView());
}
}
@@ -21,15 +21,20 @@ void ExpressionsListController::didEnterResponderChain(Responder * previousFirst
}
int ExpressionsListController::reusableCellCount(int type) {
return k_maxNumberOfCells;
return k_maxNumberOfRows;
}
void ExpressionsListController::viewDidDisappear() {
ListController::viewDidDisappear();
// Reset cell memoization to avoid taking extra space in the pool
for (int i = 0; i < k_maxNumberOfCells; i++) {
// Reset layout and cell memoization to avoid taking extra space in the pool
for (int i = 0; i < k_maxNumberOfRows; i++) {
m_cells[i].setLayout(Layout());
/* By reseting m_layouts, numberOfRow will go down to 0, and the highlighted
* cells won't be unselected. Therefore we unselect them here. */
m_cells[i].setHighlighted(false);
m_layouts[i] = Layout();
}
m_expression = Expression();
}
HighlightCell * ExpressionsListController::reusableCell(int index, int type) {
@@ -43,24 +48,34 @@ KDCoordinate ExpressionsListController::rowHeight(int j) {
}
void ExpressionsListController::willDisplayCellForIndex(HighlightCell * cell, int index) {
/* Note : To further optimize memoization space in the pool, layout
* serialization could be memoized instead, and layout would be recomputed
* here, when setting cell's layout. */
ExpressionTableCellWithPointer * myCell = static_cast<ExpressionTableCellWithPointer *>(cell);
myCell->setLayout(layoutAtIndex(index));
myCell->setAccessoryMessage(messageAtIndex(index));
myCell->reloadScroll();
}
int ExpressionsListController::numberOfRows() const {
int nbOfRows = 0;
for (size_t i = 0; i < k_maxNumberOfRows; i++) {
if (!m_layouts[i].isUninitialized()) {
nbOfRows++;
}
}
return nbOfRows;
}
void ExpressionsListController::setExpression(Poincare::Expression e) {
// Reinitialize memoization
for (int i = 0; i < k_maxNumberOfCells; i++) {
for (int i = 0; i < k_maxNumberOfRows; i++) {
m_layouts[i] = Layout();
}
m_expression = e;
}
Poincare::Layout ExpressionsListController::layoutAtIndex(int index) {
if (m_layouts[index].isUninitialized()) {
computeLayoutAtIndex(index);
}
assert(!m_layouts[index].isUninitialized());
return m_layouts[index];
}

View File

@@ -22,22 +22,22 @@ public:
KDCoordinate rowHeight(int j) override;
int typeAtLocation(int i, int j) override { return 0; }
void willDisplayCellForIndex(HighlightCell * cell, int index) override;
int numberOfRows() const override;
// IllustratedListController
void setExpression(Poincare::Expression e) override;
protected:
constexpr static int k_maxNumberOfCells = 4;
constexpr static int k_maxNumberOfRows = 5;
int textAtIndex(char * buffer, size_t bufferSize, int index) override;
Poincare::Expression m_expression;
// Memoization of layouts
mutable Poincare::Layout m_layouts[k_maxNumberOfCells];
mutable Poincare::Layout m_layouts[k_maxNumberOfRows];
private:
Poincare::Layout layoutAtIndex(int index);
virtual void computeLayoutAtIndex(int index) = 0;
virtual I18n::Message messageAtIndex(int index) = 0;
// Cells
ExpressionTableCellWithPointer m_cells[k_maxNumberOfCells];
ExpressionTableCellWithPointer m_cells[k_maxNumberOfRows];
};
}

View File

@@ -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++) {
@@ -80,16 +81,7 @@ KDCoordinate IllustratedListController::rowHeight(int j) {
}
Shared::ExpiringPointer<Calculation> calculation = m_calculationStore.calculationAtIndex(calculationIndex);
constexpr bool expanded = true;
KDCoordinate result = calculation->memoizedHeight(expanded);
if (result < 0) {
result = ScrollableThreeExpressionsCell::Height(calculation.pointer());
if (result < 0) {
// Raise, because Height modified the calculation and failed.
Poincare::ExceptionCheckpoint::Raise();
}
calculation->setMemoizedHeight(expanded, result);
}
return result + Metric::CellSeparatorThickness;
return calculation->height(expanded) + Metric::CellSeparatorThickness;
}
int IllustratedListController::typeAtLocation(int i, int j) {
@@ -98,7 +90,6 @@ int IllustratedListController::typeAtLocation(int i, int j) {
void IllustratedListController::willDisplayCellForIndex(HighlightCell * cell, int index) {
if (index == 0) {
// TODO ?
return;
}
Poincare::Context * context = App::app()->localContext();
@@ -106,7 +97,6 @@ void IllustratedListController::willDisplayCellForIndex(HighlightCell * cell, in
Calculation * c = m_calculationStore.calculationAtIndex(index-1).pointer();
myCell->setCalculation(c);
myCell->setDisplayCenter(c->displayOutput(context) != Calculation::DisplayOutput::ApproximateOnly);
//myCell->setHighlighted(myCell->isHighlighted()); //TODO??
}
void IllustratedListController::tableViewDidChangeSelection(SelectableTableView * t, int previousSelectedCellX, int previousSelectedCellY, bool withinTemporarySelection) {

View File

@@ -10,8 +10,6 @@
namespace Calculation {
class IllustratedListController : public ListController, public SelectableTableViewDelegate {
/* TODO There is factorizable code between this and
* Calculation::HistoryController (at least rowHeight). */
public:
IllustratedListController(EditExpressionController * editExpressionController);
@@ -35,12 +33,16 @@ public:
constexpr static KDCoordinate k_illustrationHeight = 120;
protected:
static KDCoordinate CalculationHeight(Calculation * c, bool expanded) { return ScrollableThreeExpressionsCell::Height(c); }
Poincare::Expression m_savedExpression;
CalculationStore m_calculationStore;
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];

View File

@@ -11,10 +11,6 @@ using namespace Shared;
namespace Calculation {
int IntegerListController::numberOfRows() const {
return 3 + factorExpressionIsComputable();
}
Integer::Base baseAtIndex(int index) {
switch (index) {
case 0:
@@ -27,12 +23,20 @@ Integer::Base baseAtIndex(int index) {
}
}
void IntegerListController::computeLayoutAtIndex(int index) {
assert(m_expression.type() == ExpressionNode::Type::BasedInteger);
// For index = k_indexOfFactorExpression, the layout is assumed to be alreday memoized because it is needed to compute the numberOfRows
assert(index < k_indexOfFactorExpression);
Integer i = static_cast<BasedInteger &>(m_expression).integer();
m_layouts[index] = i.createLayout(baseAtIndex(index));
void IntegerListController::setExpression(Poincare::Expression e) {
ExpressionsListController::setExpression(e);
static_assert(k_maxNumberOfRows >= k_indexOfFactorExpression + 1, "k_maxNumberOfRows must be greater than k_indexOfFactorExpression");
assert(!m_expression.isUninitialized() && m_expression.type() == ExpressionNode::Type::BasedInteger);
Integer integer = static_cast<BasedInteger &>(m_expression).integer();
for (int index = 0; index < k_indexOfFactorExpression; ++index) {
m_layouts[index] = integer.createLayout(baseAtIndex(index));
}
// Computing factorExpression
Expression factor = Factor::Builder(m_expression.clone());
PoincareHelpers::Simplify(&factor, App::app()->localContext(), ExpressionNode::ReductionTarget::User);
if (!factor.isUndefined()) {
m_layouts[k_indexOfFactorExpression] = PoincareHelpers::CreateLayout(factor);
}
}
I18n::Message IntegerListController::messageAtIndex(int index) {
@@ -48,20 +52,4 @@ I18n::Message IntegerListController::messageAtIndex(int index) {
}
}
bool IntegerListController::factorExpressionIsComputable() const {
if (!m_layouts[k_indexOfFactorExpression].isUninitialized()) {
// The factor expression is already memoized
return !m_layouts[k_indexOfFactorExpression].isEmpty();
}
Poincare::Context * context = App::app()->localContext();
Expression factor = Factor::Builder(m_expression.clone());
PoincareHelpers::Simplify(&factor, context, ExpressionNode::ReductionTarget::User);
if (!factor.isUndefined()) {
m_layouts[k_indexOfFactorExpression] = PoincareHelpers::CreateLayout(factor);
return true;
}
m_layouts[k_indexOfFactorExpression] = EmptyLayout::Builder();
return false;
}
}

View File

@@ -10,13 +10,11 @@ public:
IntegerListController(EditExpressionController * editExpressionController) :
ExpressionsListController(editExpressionController) {}
//ListViewDataSource
int numberOfRows() const override;
void setExpression(Poincare::Expression e) override;
private:
static constexpr int k_indexOfFactorExpression = 3;
void computeLayoutAtIndex(int index) override;
I18n::Message messageAtIndex(int index) override;
bool factorExpressionIsComputable() const;
};
}

View File

@@ -0,0 +1,106 @@
#include "matrix_list_controller.h"
#include "../app.h"
#include "../../shared/poincare_helpers.h"
#include <apps/global_preferences.h>
#include <poincare_nodes.h>
#include <poincare/matrix.h>
#include <string.h>
using namespace Poincare;
using namespace Shared;
namespace Calculation {
void MatrixListController::setExpression(Poincare::Expression e) {
ExpressionsListController::setExpression(e);
assert(!m_expression.isUninitialized());
static_assert(k_maxNumberOfRows >= k_maxNumberOfOutputRows, "k_maxNumberOfRows must be greater than k_maxNumberOfOutputRows");
Poincare::Preferences * preferences = Poincare::Preferences::sharedPreferences();
Poincare::Preferences::ComplexFormat currentComplexFormat = preferences->complexFormat();
if (currentComplexFormat == Poincare::Preferences::ComplexFormat::Real) {
/* Temporary change complex format to avoid all additional expressions to be
* "unreal" (with [i] for instance). As additional results are computed from
* the output, which is built taking ComplexFormat into account, there are
* no risks of displaying additional results on an unreal output. */
preferences->setComplexFormat(Poincare::Preferences::ComplexFormat::Cartesian);
}
Context * context = App::app()->localContext();
ExpressionNode::ReductionContext reductionContext(
context,
preferences->complexFormat(),
preferences->angleUnit(),
GlobalPreferences::sharedGlobalPreferences()->unitFormat(),
ExpressionNode::ReductionTarget::SystemForApproximation,
ExpressionNode::SymbolicComputation::ReplaceAllSymbolsWithDefinitionsOrUndefined);
// The expression must be reduced to call methods such as determinant or trace
assert(m_expression.type() == ExpressionNode::Type::Matrix);
bool mIsSquared = (static_cast<Matrix &>(m_expression).numberOfRows() == static_cast<Matrix &>(m_expression).numberOfColumns());
size_t index = 0;
size_t messageIndex = 0;
// 1. Matrix determinant if square matrix
if (mIsSquared) {
/* Determinant is reduced so that a null determinant can be detected.
* However, some exceptions remain such as cos(x)^2+sin(x)^2-1 which will
* not be reduced to a rational, but will be null in theory. */
Expression determinant = Determinant::Builder(m_expression.clone()).reduce(reductionContext);
m_indexMessageMap[index] = messageIndex++;
m_layouts[index++] = getLayoutFromExpression(determinant, context, preferences);
// 2. Matrix inverse if invertible matrix
// A squared matrix is invertible if and only if determinant is non null
if (!determinant.isUndefined() && determinant.nullStatus(context) != ExpressionNode::NullStatus::Null) {
// TODO: Handle ExpressionNode::NullStatus::Unknown
m_indexMessageMap[index] = messageIndex++;
m_layouts[index++] = getLayoutFromExpression(MatrixInverse::Builder(m_expression.clone()), context, preferences);
}
}
// 3. Matrix row echelon form
messageIndex = 2;
Expression rowEchelonForm = MatrixRowEchelonForm::Builder(m_expression.clone());
m_indexMessageMap[index] = messageIndex++;
m_layouts[index++] = getLayoutFromExpression(rowEchelonForm, context, preferences);
/* 4. Matrix reduced row echelon form
* it can be computed from row echelon form to save computation time.*/
m_indexMessageMap[index] = messageIndex++;
m_layouts[index++] = getLayoutFromExpression(MatrixReducedRowEchelonForm::Builder(rowEchelonForm), context, preferences);
// 5. Matrix trace if square matrix
if (mIsSquared) {
m_indexMessageMap[index] = messageIndex++;
m_layouts[index++] = getLayoutFromExpression(MatrixTrace::Builder(m_expression.clone()), context, preferences);
}
// Reset complex format as before
preferences->setComplexFormat(currentComplexFormat);
}
Poincare::Layout MatrixListController::getLayoutFromExpression(Expression e, Context * context, Poincare::Preferences * preferences) {
assert(!e.isUninitialized());
// Simplify or approximate expression
Expression approximateExpression;
Expression simplifiedExpression;
e.simplifyAndApproximate(&simplifiedExpression, &approximateExpression, context,
preferences->complexFormat(), preferences->angleUnit(), GlobalPreferences::sharedGlobalPreferences()->unitFormat(),
ExpressionNode::SymbolicComputation::ReplaceAllSymbolsWithDefinitionsOrUndefined);
// simplify might have been interrupted, in which case we use approximate
if (simplifiedExpression.isUninitialized()) {
assert(!approximateExpression.isUninitialized());
return Shared::PoincareHelpers::CreateLayout(approximateExpression);
}
return Shared::PoincareHelpers::CreateLayout(simplifiedExpression);
}
I18n::Message MatrixListController::messageAtIndex(int index) {
// Message index is mapped in setExpression because it depends on the Matrix.
assert(index < k_maxNumberOfOutputRows && index >=0);
I18n::Message messages[k_maxNumberOfOutputRows] = {
I18n::Message::AdditionalDeterminant,
I18n::Message::AdditionalInverse,
I18n::Message::AdditionalRowEchelonForm,
I18n::Message::AdditionalReducedRowEchelonForm,
I18n::Message::AdditionalTrace};
return messages[m_indexMessageMap[index]];
}
}

View File

@@ -0,0 +1,27 @@
#ifndef CALCULATION_ADDITIONAL_OUTPUTS_MATRIX_LIST_CONTROLLER_H
#define CALCULATION_ADDITIONAL_OUTPUTS_MATRIX_LIST_CONTROLLER_H
#include "expressions_list_controller.h"
namespace Calculation {
class MatrixListController : public ExpressionsListController {
public:
MatrixListController(EditExpressionController * editExpressionController) :
ExpressionsListController(editExpressionController) {}
void setExpression(Poincare::Expression e) override;
private:
I18n::Message messageAtIndex(int index) override;
Poincare::Layout getLayoutFromExpression(Poincare::Expression e, Poincare::Context * context, Poincare::Preferences * preferences);
// Map from cell index to message index
constexpr static int k_maxNumberOfOutputRows = 5;
int m_indexMessageMap[k_maxNumberOfOutputRows];
};
}
#endif

View File

@@ -9,34 +9,31 @@ using namespace Shared;
namespace Calculation {
int RationalListController::numberOfRows() const {
return 2;
}
Integer extractInteger(const Expression e) {
assert(e.type() == ExpressionNode::Type::BasedInteger);
return static_cast<const BasedInteger &>(e).integer();
}
void RationalListController::computeLayoutAtIndex(int index) {
void RationalListController::setExpression(Poincare::Expression e) {
ExpressionsListController::setExpression(e);
assert(!m_expression.isUninitialized());
static_assert(k_maxNumberOfRows >= 2, "k_maxNumberOfRows must be greater than 2");
bool negative = false;
Expression div = m_expression;
if (m_expression.type() == ExpressionNode::Type::Opposite) {
negative = true;
div = m_expression.childAtIndex(0);
}
assert(div.type() == ExpressionNode::Type::Division);
Integer numerator = extractInteger(div.childAtIndex(0));
numerator.setNegative(negative);
Integer denominator = extractInteger(div.childAtIndex(1));
Expression e;
if (index == 0) {
e = Integer::CreateMixedFraction(numerator, denominator);
} else {
assert(index == 1);
e = Integer::CreateEuclideanDivision(numerator, denominator);
}
m_layouts[index] = PoincareHelpers::CreateLayout(e);
int index = 0;
m_layouts[index++] = PoincareHelpers::CreateLayout(Integer::CreateMixedFraction(numerator, denominator));
m_layouts[index++] = PoincareHelpers::CreateLayout(Integer::CreateEuclideanDivision(numerator, denominator));
}
I18n::Message RationalListController::messageAtIndex(int index) {

View File

@@ -10,10 +10,9 @@ public:
RationalListController(EditExpressionController * editExpressionController) :
ExpressionsListController(editExpressionController) {}
//ListViewDataSource
int numberOfRows() const override;
void setExpression(Poincare::Expression e) override;
private:
void computeLayoutAtIndex(int index) override;
I18n::Message messageAtIndex(int index) override;
int textAtIndex(char * buffer, size_t bufferSize, int index) override;
};

View File

@@ -8,8 +8,8 @@ void ScrollableThreeExpressionsView::resetMemoization() {
setLayouts(Poincare::Layout(), Poincare::Layout(), Poincare::Layout());
}
void ScrollableThreeExpressionsView::setCalculation(Calculation * calculation, bool * didForceOutput) {
assert(!didForceOutput || *didForceOutput == false);
// TODO: factorize with HistoryViewCell!
void ScrollableThreeExpressionsView::setCalculation(Calculation * calculation, bool canChangeDisplayOutput) {
Poincare::Context * context = App::app()->localContext();
// Clean the layouts to make room in the pool
@@ -24,13 +24,10 @@ void ScrollableThreeExpressionsView::setCalculation(Calculation * calculation, b
bool couldNotCreateExactLayout = false;
exactOutputLayout = calculation->createExactOutputLayout(&couldNotCreateExactLayout);
if (couldNotCreateExactLayout) {
if (calculation->displayOutput(context) == ::Calculation::Calculation::DisplayOutput::ExactOnly) {
Poincare::ExceptionCheckpoint::Raise();
} else {
if (canChangeDisplayOutput && calculation->displayOutput(context) != ::Calculation::Calculation::DisplayOutput::ExactOnly) {
calculation->forceDisplayOutput(::Calculation::Calculation::DisplayOutput::ApproximateOnly);
if (didForceOutput) {
*didForceOutput = true;
}
} else {
Poincare::ExceptionCheckpoint::Raise();
}
}
}
@@ -44,21 +41,18 @@ void ScrollableThreeExpressionsView::setCalculation(Calculation * calculation, b
bool couldNotCreateApproximateLayout = false;
approximateOutputLayout = calculation->createApproximateOutputLayout(context, &couldNotCreateApproximateLayout);
if (couldNotCreateApproximateLayout) {
if (calculation->displayOutput(context) == ::Calculation::Calculation::DisplayOutput::ApproximateOnly) {
Poincare::ExceptionCheckpoint::Raise();
} else {
if (canChangeDisplayOutput && calculation->displayOutput(context) != ::Calculation::Calculation::DisplayOutput::ApproximateOnly) {
/* Set the display output to ApproximateOnly, make room in the pool by
* erasing the exact layout, and retry to create the approximate layout */
calculation->forceDisplayOutput(::Calculation::Calculation::DisplayOutput::ApproximateOnly);
if (didForceOutput) {
*didForceOutput = true;
}
exactOutputLayout = Poincare::Layout();
couldNotCreateApproximateLayout = false;
approximateOutputLayout = calculation->createApproximateOutputLayout(context, &couldNotCreateApproximateLayout);
if (couldNotCreateApproximateLayout) {
Poincare::ExceptionCheckpoint::Raise();
}
} else {
Poincare::ExceptionCheckpoint::Raise();
}
}
@@ -74,16 +68,7 @@ void ScrollableThreeExpressionsView::setCalculation(Calculation * calculation, b
KDCoordinate ScrollableThreeExpressionsCell::Height(Calculation * calculation) {
ScrollableThreeExpressionsCell cell;
bool didForceOutput = false;
cell.setCalculation(calculation, &didForceOutput);
if (didForceOutput) {
/* We could not compute the height of the calculation as it is (the display
* output was forced to another value during the height computation).
* Warning: the display output of calculation was actually changed, so it
* will cause problems if we already did some computations with another
* display value. */
return -1;
}
cell.setCalculation(calculation, true);
KDRect leftFrame = KDRectZero;
KDRect centerFrame = KDRectZero;
KDRect approximateSignFrame = KDRectZero;
@@ -103,8 +88,8 @@ void ScrollableThreeExpressionsCell::reinitSelection() {
m_view.reloadScroll();
}
void ScrollableThreeExpressionsCell::setCalculation(Calculation * calculation, bool * didForceOutput) {
m_view.setCalculation(calculation, didForceOutput);
void ScrollableThreeExpressionsCell::setCalculation(Calculation * calculation, bool canChangeDisplayOutput) {
m_view.setCalculation(calculation, canChangeDisplayOutput);
layoutSubviews();
}

View File

@@ -20,7 +20,7 @@ public:
setBackgroundColor(Palette::BackgroundApps);
}
void resetMemoization();
void setCalculation(Calculation * calculation, bool * didForceOutput = nullptr);
void setCalculation(Calculation * calculation, bool canChangeDisplayOutput);
void subviewFrames(KDRect * leftFrame, KDRect * centerFrame, KDRect * approximateSignFrame, KDRect * rightFrame) {
return m_contentCell.subviewFrames(leftFrame, centerFrame, approximateSignFrame, rightFrame);
}
@@ -61,7 +61,7 @@ public:
void setHighlighted(bool highlight) override { m_view.evenOddCell()->setHighlighted(highlight); }
void resetMemoization() { m_view.resetMemoization(); }
void setCalculation(Calculation * calculation, bool * didForceOutput = nullptr);
void setCalculation(Calculation * calculation, bool canChangeDisplayOutput = false);
void setDisplayCenter(bool display);
ScrollableThreeExpressionsView::SubviewPosition selectedSubviewPosition() { return m_view.selectedSubviewPosition(); }
void setSelectedSubviewPosition(ScrollableThreeExpressionsView::SubviewPosition subviewPosition) { m_view.setSelectedSubviewPosition(subviewPosition); }

View File

@@ -11,9 +11,9 @@ void TrigonometryListController::setExpression(Poincare::Expression e) {
// Fill calculation store
Poincare::Context * context = App::app()->localContext();
m_calculationStore.push("sin(θ)", context);
m_calculationStore.push("cos(θ)", context);
m_calculationStore.push("θ", context);
m_calculationStore.push("sin(θ)", context, CalculationHeight);
m_calculationStore.push("cos(θ)", context, CalculationHeight);
m_calculationStore.push("θ", context, CalculationHeight);
// Set trigonometry illustration
float angle = Shared::PoincareHelpers::ApproximateToScalar<float>(m_calculationStore.calculationAtIndex(0)->approximateOutput(context, Calculation::NumberOfSignificantDigits::Maximal), context);

View File

@@ -15,112 +15,62 @@ namespace Calculation {
void UnitListController::setExpression(Poincare::Expression e) {
ExpressionsListController::setExpression(e);
assert(!m_expression.isUninitialized());
// Reinitialize m_memoizedExpressions
for (size_t i = 0; i < k_maxNumberOfCells; i++) {
m_memoizedExpressions[i] = Expression();
static_assert(k_maxNumberOfRows >= 3, "k_maxNumberOfRows must be greater than 3");
Poincare::Expression expressions[k_maxNumberOfRows];
// Initialize expressions
for (size_t i = 0; i < k_maxNumberOfRows; i++) {
expressions[i] = Expression();
}
size_t numberOfMemoizedExpressions = 0;
// 1. First rows: miscellaneous classic units for some dimensions
/* 1. First rows: miscellaneous classic units for some dimensions, in both
* metric and imperial units. */
Expression copy = m_expression.clone();
Expression units;
// Reduce to be able to recognize units
PoincareHelpers::Reduce(&copy, App::app()->localContext(), ExpressionNode::ReductionTarget::User);
copy = copy.removeUnit(&units);
bool requireSimplification = false;
bool canChangeUnitPrefix = false;
PoincareHelpers::ReduceAndRemoveUnit(&copy, App::app()->localContext(), ExpressionNode::ReductionTarget::User, &units);
double value = Shared::PoincareHelpers::ApproximateToScalar<double>(copy, App::app()->localContext());
ExpressionNode::ReductionContext reductionContext(
App::app()->localContext(),
Preferences::sharedPreferences()->complexFormat(),
Preferences::sharedPreferences()->angleUnit(),
GlobalPreferences::sharedGlobalPreferences()->unitFormat(),
ExpressionNode::ReductionTarget::User,
ExpressionNode::SymbolicComputation::ReplaceAllSymbolsWithDefinitionsOrUndefined);
int numberOfExpressions = Unit::SetAdditionalExpressions(units, value, expressions, k_maxNumberOfRows, reductionContext);
if (Unit::IsSISpeed(units)) {
// 1.a. Turn speed into km/h
m_memoizedExpressions[numberOfMemoizedExpressions++] = UnitConvert::Builder(
m_expression.clone(),
Multiplication::Builder(
Unit::Kilometer(),
Power::Builder(
Unit::Hour(),
Rational::Builder(-1)
)
)
);
requireSimplification = true; // Simplify the conversion
} else if (Unit::IsSIVolume(units)) {
// 1.b. Turn volume into L
m_memoizedExpressions[numberOfMemoizedExpressions++] = UnitConvert::Builder(
m_expression.clone(),
Unit::Liter()
);
requireSimplification = true; // Simplify the conversion
canChangeUnitPrefix = true; // Pick best prefix (mL)
} else if (Unit::IsSIEnergy(units)) {
// 1.c. Turn energy into Wh
m_memoizedExpressions[numberOfMemoizedExpressions++] = UnitConvert::Builder(
m_expression.clone(),
Multiplication::Builder(
Unit::Watt(),
Unit::Hour()
)
);
m_memoizedExpressions[numberOfMemoizedExpressions++] = UnitConvert::Builder(
m_expression.clone(),
Unit::ElectronVolt()
);
requireSimplification = true; // Simplify the conversion
canChangeUnitPrefix = true; // Pick best prefix (kWh)
} else if (Unit::IsSITime(units)) {
// Turn time into ? year + ? month + ? day + ? h + ? min + ? s
double value = Shared::PoincareHelpers::ApproximateToScalar<double>(copy, App::app()->localContext());
m_memoizedExpressions[numberOfMemoizedExpressions++] = Unit::BuildTimeSplit(value, App::app()->localContext(), Preferences::sharedPreferences()->complexFormat(), Preferences::sharedPreferences()->angleUnit());
}
// 1.d. Simplify and tune prefix of all computed expressions
size_t currentExpressionIndex = 0;
while (currentExpressionIndex < numberOfMemoizedExpressions) {
assert(!m_memoizedExpressions[currentExpressionIndex].isUninitialized());
if (requireSimplification) {
Shared::PoincareHelpers::Simplify(&m_memoizedExpressions[currentExpressionIndex], App::app()->localContext(), ExpressionNode::ReductionTarget::User);
}
if (canChangeUnitPrefix) {
Expression newUnits;
// Reduce to be able to removeUnit
PoincareHelpers::Reduce(&m_memoizedExpressions[currentExpressionIndex], App::app()->localContext(), ExpressionNode::ReductionTarget::User);
m_memoizedExpressions[currentExpressionIndex] = m_memoizedExpressions[currentExpressionIndex].removeUnit(&newUnits);
double value = Shared::PoincareHelpers::ApproximateToScalar<double>(m_memoizedExpressions[currentExpressionIndex], App::app()->localContext());
ExpressionNode::ReductionContext reductionContext(
App::app()->localContext(),
Preferences::sharedPreferences()->complexFormat(),
Preferences::sharedPreferences()->angleUnit(),
ExpressionNode::ReductionTarget::User,
ExpressionNode::SymbolicComputation::ReplaceAllSymbolsWithDefinitionsOrUndefined);
Unit::ChooseBestPrefixForValue(&newUnits, &value, reductionContext);
m_memoizedExpressions[currentExpressionIndex] = Multiplication::Builder(Number::FloatNumber(value), newUnits);
}
currentExpressionIndex++;
}
// 2. SI units only
assert(numberOfExpressions < k_maxNumberOfRows - 1);
expressions[numberOfExpressions] = m_expression.clone();
Shared::PoincareHelpers::Simplify(&expressions[numberOfExpressions], App::app()->localContext(), ExpressionNode::ReductionTarget::User, Poincare::ExpressionNode::SymbolicComputation::ReplaceAllDefinedSymbolsWithDefinition, Poincare::ExpressionNode::UnitConversion::InternationalSystem);
numberOfExpressions++;
// 2. IS units only
assert(numberOfMemoizedExpressions < k_maxNumberOfCells - 1);
m_memoizedExpressions[numberOfMemoizedExpressions] = m_expression.clone();
Shared::PoincareHelpers::Simplify(&m_memoizedExpressions[numberOfMemoizedExpressions], App::app()->localContext(), ExpressionNode::ReductionTarget::User, Poincare::ExpressionNode::SymbolicComputation::ReplaceAllDefinedSymbolsWithDefinition, Poincare::ExpressionNode::UnitConversion::InternationalSystem);
numberOfMemoizedExpressions++;
// 3. Get rid of duplicates
/* 3. Get rid of duplicates
* We find duplicates by comparing the serializations, to eliminate
* expressions that only differ by the types of their number nodes. */
Expression reduceExpression = m_expression.clone();
// Make m_expression compareable to m_memoizedExpressions (turn BasedInteger into Rational for instance)
// Make m_expression comparable to expressions (turn BasedInteger into Rational for instance)
Shared::PoincareHelpers::Simplify(&reduceExpression, App::app()->localContext(), ExpressionNode::ReductionTarget::User, Poincare::ExpressionNode::SymbolicComputation::ReplaceAllDefinedSymbolsWithDefinition, Poincare::ExpressionNode::UnitConversion::None);
currentExpressionIndex = 1;
while (currentExpressionIndex < numberOfMemoizedExpressions) {
int currentExpressionIndex = 0;
while (currentExpressionIndex < numberOfExpressions) {
bool duplicateFound = false;
for (size_t i = 0; i < currentExpressionIndex + 1; i++) {
// Compare the currentExpression to all previous memoized expressions and to m_expression
Expression comparedExpression = i == currentExpressionIndex ? reduceExpression : m_memoizedExpressions[i];
constexpr int buffersSize = Constant::MaxSerializedExpressionSize;
char buffer1[buffersSize];
int size1 = PoincareHelpers::Serialize(expressions[currentExpressionIndex], buffer1, buffersSize);
for (int i = 0; i < currentExpressionIndex + 1; i++) {
// Compare the currentExpression to all previous expressions and to m_expression
Expression comparedExpression = i == currentExpressionIndex ? reduceExpression : expressions[i];
assert(!comparedExpression.isUninitialized());
if (comparedExpression.isIdenticalTo(m_memoizedExpressions[currentExpressionIndex])) {
numberOfMemoizedExpressions--;
char buffer2[buffersSize];
int size2 = PoincareHelpers::Serialize(comparedExpression, buffer2, buffersSize);
if (size1 == size2 && strcmp(buffer1, buffer2) == 0) {
numberOfExpressions--;
// Shift next expressions
for (size_t j = currentExpressionIndex; j < numberOfMemoizedExpressions; j++) {
m_memoizedExpressions[j] = m_memoizedExpressions[j+1];
for (int j = currentExpressionIndex; j < numberOfExpressions; j++) {
expressions[j] = expressions[j+1];
}
// Remove last expression
m_memoizedExpressions[numberOfMemoizedExpressions] = Expression();
expressions[numberOfExpressions] = Expression();
// The current expression has been discarded, no need to increment the current index
duplicateFound = true;
break;
@@ -131,21 +81,12 @@ void UnitListController::setExpression(Poincare::Expression e) {
currentExpressionIndex++;
}
}
}
int UnitListController::numberOfRows() const {
int nbOfRows = 0;
for (size_t i = 0; i < k_maxNumberOfCells; i++) {
if (!m_memoizedExpressions[i].isUninitialized()) {
nbOfRows++;
// Memoize layouts
for (size_t i = 0; i < k_maxNumberOfRows; i++) {
if (!expressions[i].isUninitialized()) {
m_layouts[i] = Shared::PoincareHelpers::CreateLayout(expressions[i]);
}
}
return nbOfRows;
}
void UnitListController::computeLayoutAtIndex(int index) {
assert(!m_memoizedExpressions[index].isUninitialized());
m_layouts[index] = Shared::PoincareHelpers::CreateLayout(m_memoizedExpressions[index]);
}
I18n::Message UnitListController::messageAtIndex(int index) {

View File

@@ -12,13 +12,8 @@ public:
void setExpression(Poincare::Expression e) override;
//ListViewDataSource
int numberOfRows() const override;
private:
void computeLayoutAtIndex(int index) override;
I18n::Message messageAtIndex(int index) override;
// Memoization of expressions
mutable Poincare::Expression m_memoizedExpressions[k_maxNumberOfCells];
};
}

View File

@@ -31,6 +31,8 @@ App * App::Snapshot::unpack(Container * container) {
void App::Snapshot::reset() {
m_calculationStore.deleteAll();
m_cacheBuffer[0] = 0;
m_cacheBufferInformation = 0;
}
App::Descriptor * App::Snapshot::descriptor() {
@@ -38,14 +40,14 @@ App::Descriptor * App::Snapshot::descriptor() {
return &descriptor;
}
void App::Snapshot::tidy() {
m_calculationStore.tidy();
App::Snapshot::Snapshot() : m_calculationStore(m_calculationBuffer, k_calculationBufferSize)
{
}
App::App(Snapshot * snapshot) :
ExpressionFieldDelegateApp(snapshot, &m_editExpressionController),
m_historyController(&m_editExpressionController, snapshot->calculationStore()),
m_editExpressionController(&m_modalViewController, this, &m_historyController, snapshot->calculationStore())
m_editExpressionController(&m_modalViewController, this, snapshot->cacheBuffer(), snapshot->cacheBufferInformationAddress(), &m_historyController, snapshot->calculationStore())
{
}
@@ -70,7 +72,17 @@ bool App::isAcceptableExpression(const Poincare::Expression expression) {
return false;
}
}
return !expression.isUninitialized();
return !(expression.isUninitialized() || expression.type() == ExpressionNode::Type::Equal);
}
void App::didBecomeActive(Window * window) {
m_editExpressionController.restoreInput();
Shared::ExpressionFieldDelegateApp::didBecomeActive(window);
}
void App::willBecomeInactive() {
m_editExpressionController.memoizeInput();
Shared::ExpressionFieldDelegateApp::willBecomeInactive();
}
}

View File

@@ -6,6 +6,7 @@
#include "history_controller.h"
#include "../shared/text_field_delegate_app.h"
#include <escher.h>
#include "../shared/shared_app.h"
namespace Calculation {
@@ -18,15 +19,22 @@ public:
App::Descriptor::ExaminationLevel examinationLevel() override;
const Image * icon() override;
};
class Snapshot : public ::App::Snapshot {
class Snapshot : public ::SharedApp::Snapshot {
public:
Snapshot();
App * unpack(Container * container) override;
void reset() override;
Descriptor * descriptor() override;
CalculationStore * calculationStore() { return &m_calculationStore; }
char * cacheBuffer() { return m_cacheBuffer; }
size_t * cacheBufferInformationAddress() { return &m_cacheBufferInformation; }
private:
void tidy() override;
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];
char m_cacheBuffer[EditExpressionController::k_cacheBufferSize];
size_t m_cacheBufferInformation;
};
static App * app() {
return static_cast<App *>(Container::activeApp());
@@ -36,9 +44,12 @@ 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;
void didBecomeActive(Window * window) override;
void willBecomeInactive() override;
EditExpressionController m_editExpressionController;
};

View File

@@ -7,3 +7,8 @@ BinaryBase = "Binär"
PrimeFactors = "Primfaktoren"
MixedFraction = "Gemischte Zahl"
EuclideanDivision = "Division mit Rest"
AdditionalDeterminant = "Determinante"
AdditionalInverse = "Inverse"
AdditionalRowEchelonForm = "Stufenform"
AdditionalReducedRowEchelonForm = "Reduzierte Stufenform"
AdditionalTrace = "Spur"

View File

@@ -7,3 +7,8 @@ BinaryBase = "Binary"
PrimeFactors = "Prime factors"
MixedFraction = "Mixed fraction"
EuclideanDivision = "Euclidean division"
AdditionalDeterminant = "Determinant"
AdditionalInverse = "Inverse"
AdditionalRowEchelonForm = "Row echelon form"
AdditionalReducedRowEchelonForm = "Reduced row echelon form"
AdditionalTrace = "Trace"

View File

@@ -7,3 +7,8 @@ BinaryBase = "Binario"
PrimeFactors = "Factores primos"
MixedFraction = "Fracción mixta"
EuclideanDivision = "División euclidiana"
AdditionalDeterminant = "Determinante"
AdditionalInverse = "Inversa"
AdditionalRowEchelonForm = "Matriz escalonada"
AdditionalReducedRowEchelonForm = "Matriz escalonada reducida"
AdditionalTrace = "Traza"

View File

@@ -7,3 +7,8 @@ BinaryBase = "Binaire"
PrimeFactors = "Facteurs premiers"
MixedFraction = "Fraction mixte"
EuclideanDivision = "Division euclidienne"
AdditionalDeterminant = "Déterminant"
AdditionalInverse = "Inverse"
AdditionalRowEchelonForm = "Forme échelonnée"
AdditionalReducedRowEchelonForm = "Forme échelonnée réduite"
AdditionalTrace = "Trace"

View File

@@ -3,7 +3,12 @@ CalculAppCapital = "SZÁMOLÁS"
AdditionalResults = "További eredmények"
DecimalBase = "Decimális"
HexadecimalBase = "Hexadecimális"
BinaryBase = "Kétkomponensü"
BinaryBase = "Bináris"
PrimeFactors = "Alapvetö tényezök"
MixedFraction = "Vegyes frakció"
EuclideanDivision = "Euklideszi osztás"
AdditionalDeterminant = "Meghatározó"
AdditionalInverse = "inverz"
AdditionalRowEchelonForm = "Sor echelon forma"
AdditionalReducedRowEchelonForm = "Csökkentett sorú Echelon forma"
AdditionalTrace = "Nyomkövetés"

View File

@@ -4,6 +4,11 @@ AdditionalResults = "Risultati complementari"
DecimalBase = "Decimale"
HexadecimalBase = "Esadecimale"
BinaryBase = "Binario"
PrimeFactors = "Fattori primi"
PrimeFactors = "Fattorizzazione"
MixedFraction = "Frazione mista"
EuclideanDivision = "Divisione euclidea"
AdditionalDeterminant = "Determinante"
AdditionalInverse = "Inversa"
AdditionalRowEchelonForm = "Matrice a scalini"
AdditionalReducedRowEchelonForm = "Matrice ridotta a scalini"
AdditionalTrace = "Traccia"

View File

@@ -1,9 +1,14 @@
CalculApp = "Calculatie"
CalculAppCapital = "CALCULATIE"
AdditionalResults = "Bijkomende resultaten"
CalculApp = "Rekenen"
CalculAppCapital = "REKENEN"
AdditionalResults = "Aanvullende resultaten"
DecimalBase = "Decimaal"
HexadecimalBase = "Hexadecimaal"
BinaryBase = "Binaire"
PrimeFactors = "Priemfactoren"
BinaryBase = "Binair"
PrimeFactors = "Ontbinding"
MixedFraction = "Gemengde breuk"
EuclideanDivision = "Geheeltallige deling"
AdditionalDeterminant = "Determinant"
AdditionalInverse = "Inverse"
AdditionalRowEchelonForm = "Echelonvorm"
AdditionalReducedRowEchelonForm = "Gereduceerde echelonvorm"
AdditionalTrace = "Spoor"

View File

@@ -4,6 +4,11 @@ AdditionalResults = "Resultados adicionais"
DecimalBase = "Decimal"
HexadecimalBase = "Hexadecimal"
BinaryBase = "Binário"
PrimeFactors = "Fatores primos"
PrimeFactors = "Fatorização"
MixedFraction = "Fração mista"
EuclideanDivision = "Divisão euclidiana"
AdditionalDeterminant = "Determinante"
AdditionalInverse = "Matriz inversa"
AdditionalRowEchelonForm = "Matriz escalonada"
AdditionalReducedRowEchelonForm = "Matriz escalonada reduzida"
AdditionalTrace = "Traço"

View File

@@ -38,12 +38,6 @@ Calculation * Calculation::next() const {
return reinterpret_cast<Calculation *>(const_cast<char *>(result));
}
void Calculation::tidy() {
/* Reset height memoization (the complex format could have changed when
* re-entering Calculation app which would impact the heights). */
resetHeightMemoization();
}
const char * Calculation::approximateOutputText(NumberOfSignificantDigits numberOfSignificantDigits) const {
const char * exactOutput = exactOutputText();
const char * approximateOutputTextWithMaxNumberOfDigits = exactOutput + strlen(exactOutput) + 1;
@@ -126,12 +120,15 @@ Layout Calculation::createApproximateOutputLayout(Context * context, bool * coul
}
}
void Calculation::setMemoizedHeight(bool expanded, KDCoordinate height) {
if (expanded) {
m_expandedHeight = height;
} else {
m_height = height;
}
KDCoordinate Calculation::height(bool expanded) {
KDCoordinate h = expanded ? m_expandedHeight : m_height;
assert(h >= 0);
return h;
}
void Calculation::setHeights(KDCoordinate height, KDCoordinate expandedHeight) {
m_height = height;
m_expandedHeight = expandedHeight;
}
Calculation::DisplayOutput Calculation::displayOutput(Context * context) {
@@ -172,7 +169,8 @@ Calculation::DisplayOutput Calculation::displayOutput(Context * context) {
ExpressionNode::Type::Sum,
ExpressionNode::Type::Derivative,
ExpressionNode::Type::ConfidenceInterval,
ExpressionNode::Type::PredictionInterval
ExpressionNode::Type::PredictionInterval,
ExpressionNode::Type::Sequence
};
return e.isOfType(approximateOnlyTypes, sizeof(approximateOnlyTypes)/sizeof(ExpressionNode::Type));
}, context)
@@ -190,9 +188,9 @@ Calculation::DisplayOutput Calculation::displayOutput(Context * context) {
}
void Calculation::forceDisplayOutput(DisplayOutput d) {
// Heights haven't been computed yet
assert(m_height == -1 && m_expandedHeight == -1);
m_displayOutput = d;
// Reset heights memoization as it might have changed when we modify the display output
resetHeightMemoization();
}
bool Calculation::shouldOnlyDisplayExactOutput() {
@@ -219,8 +217,9 @@ Calculation::EqualSign Calculation::exactAndApproximateDisplayedOutputsAreEqual(
Poincare::ExceptionCheckpoint ecp;
if (ExceptionRun(ecp)) {
Preferences * preferences = Preferences::sharedPreferences();
// TODO: complex format should not be needed here (as it is not used to create layouts)
Preferences::ComplexFormat complexFormat = Expression::UpdatedComplexFormatWithTextInput(preferences->complexFormat(), m_inputText);
m_equalSign = Expression::ParsedExpressionsAreEqual(exactOutputText(), approximateOutputText(NumberOfSignificantDigits::UserDefined), context, complexFormat, preferences->angleUnit()) ? EqualSign::Equal : EqualSign::Approximation;
m_equalSign = Expression::ParsedExpressionsAreEqual(exactOutputText(), approximateOutputText(NumberOfSignificantDigits::UserDefined), context, complexFormat, preferences->angleUnit(), GlobalPreferences::sharedGlobalPreferences()->unitFormat()) ? EqualSign::Equal : EqualSign::Approximation;
return m_equalSign;
} else {
/* Do not override m_equalSign in case there is enough room in the pool
@@ -256,25 +255,9 @@ Calculation::AdditionalInformationType Calculation::additionalInformationType(Co
}
if (o.hasUnit()) {
Expression unit;
PoincareHelpers::Reduce(&o, App::app()->localContext(), ExpressionNode::ReductionTarget::User,ExpressionNode::SymbolicComputation::ReplaceAllSymbolsWithDefinitionsOrUndefined, ExpressionNode::UnitConversion::None);
o = o.removeUnit(&unit);
if (Unit::IsSI(unit)) {
if (Unit::IsSISpeed(unit) || Unit::IsSIVolume(unit) || Unit::IsSIEnergy(unit)) {
/* All these units will provide misc. classic representatives in
* addition to the SI unit in additional information. */
return AdditionalInformationType::Unit;
}
if (Unit::IsSITime(unit)) {
/* If the number of seconds is above 60s, we can write it in the form
* of an addition: 23_min + 12_s for instance. */
double value = Shared::PoincareHelpers::ApproximateToScalar<double>(o, App::app()->localContext());
if (value > Unit::SecondsPerMinute) {
return AdditionalInformationType::Unit;
}
}
return AdditionalInformationType::None;
}
return AdditionalInformationType::Unit;
PoincareHelpers::ReduceAndRemoveUnit(&o, App::app()->localContext(), ExpressionNode::ReductionTarget::User, &unit, ExpressionNode::SymbolicComputation::ReplaceAllSymbolsWithDefinitionsOrUndefined, ExpressionNode::UnitConversion::None);
double value = PoincareHelpers::ApproximateToScalar<double>(o, App::app()->localContext());
return (Unit::ShouldDisplayAdditionalOutputs(value, unit, GlobalPreferences::sharedGlobalPreferences()->unitFormat())) ? AdditionalInformationType::Unit : AdditionalInformationType::None;
}
if (o.isBasedIntegerCappedBy(k_maximalIntegerWithAdditionalInformation)) {
return AdditionalInformationType::Integer;
@@ -286,12 +269,10 @@ Calculation::AdditionalInformationType Calculation::additionalInformationType(Co
if (o.hasDefinedComplexApproximation(context, complexFormat, preferences->angleUnit())) {
return AdditionalInformationType::Complex;
}
if (o.type() == ExpressionNode::Type::Matrix) {
return AdditionalInformationType::Matrix;
}
return AdditionalInformationType::None;
}
void Calculation::resetHeightMemoization() {
m_height = -1;
m_expandedHeight = -1;
}
}

View File

@@ -21,6 +21,7 @@ class CalculationStore;
class Calculation {
friend CalculationStore;
public:
static constexpr int k_numberOfExpressions = 4;
enum class EqualSign : uint8_t {
Unknown,
Approximation,
@@ -40,6 +41,7 @@ public:
Rational,
Trigonometry,
Unit,
Matrix,
Complex
};
static bool DisplaysExact(DisplayOutput d) { return d != DisplayOutput::ApproximateOnly; }
@@ -48,7 +50,7 @@ public:
* calculations instead of clearing less space, then fail to serialize, clear
* more space, fail to serialize, clear more space, etc., until reaching
* sufficient free space. */
static int MinimalSize() { return sizeof(uint8_t) + 2*sizeof(KDCoordinate) + sizeof(uint8_t) + 3*Constant::MaxSerializedExpressionSize; }
static int MinimalSize() { return sizeof(uint8_t) + 2*sizeof(KDCoordinate) + sizeof(uint8_t) + 3*Constant::MaxSerializedExpressionSize + sizeof(Calculation *); }
Calculation() :
m_displayOutput(DisplayOutput::Unknown),
@@ -61,8 +63,6 @@ public:
bool operator==(const Calculation& c);
Calculation * next() const;
void tidy();
// Texts
enum class NumberOfSignificantDigits {
Maximal,
@@ -83,9 +83,8 @@ public:
Poincare::Layout createExactOutputLayout(bool * couldNotCreateExactLayout);
Poincare::Layout createApproximateOutputLayout(Poincare::Context * context, bool * couldNotCreateApproximateLayout);
// Memoization of height
KDCoordinate memoizedHeight(bool expanded) { return expanded ? m_expandedHeight : m_height; }
void setMemoizedHeight(bool expanded, KDCoordinate height);
// Heights
KDCoordinate height(bool expanded);
// Displayed output
DisplayOutput displayOutput(Poincare::Context * context);
@@ -96,11 +95,11 @@ public:
// Additional Information
AdditionalInformationType additionalInformationType(Poincare::Context * context);
private:
static constexpr int maxWidth = 314;
static constexpr int k_numberOfExpressions = 4;
static constexpr KDCoordinate k_heightComputationFailureHeight = 50;
static constexpr const char * k_maximalIntegerWithAdditionalInformation = "10000000000000000";
void resetHeightMemoization();
void setHeights(KDCoordinate height, KDCoordinate expandedHeight);
/* 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...) */

View File

@@ -12,58 +12,47 @@ using namespace Shared;
namespace Calculation {
CalculationStore::CalculationStore() :
m_bufferEnd(m_buffer),
m_numberOfCalculations(0),
m_slidedBuffer(false),
m_indexOfFirstMemoizedCalculationPointer(0)
CalculationStore::CalculationStore(char * buffer, int size) :
m_buffer(buffer),
m_bufferSize(size),
m_calculationAreaEnd(m_buffer),
m_numberOfCalculations(0)
{
resetMemoizedModelsAfterCalculationIndex(-1);
assert(m_buffer != nullptr);
assert(m_bufferSize > 0);
}
// Returns an expiring pointer to the calculation of index i
ExpiringPointer<Calculation> CalculationStore::calculationAtIndex(int i) {
assert(!m_slidedBuffer);
assert(i >= 0 && i < m_numberOfCalculations);
assert(m_indexOfFirstMemoizedCalculationPointer >= 0);
if (i >= m_indexOfFirstMemoizedCalculationPointer && i < m_indexOfFirstMemoizedCalculationPointer + k_numberOfMemoizedCalculationPointers) {
// The calculation is within the range of memoized calculations
Calculation * c = m_memoizedCalculationPointers[i-m_indexOfFirstMemoizedCalculationPointer];
if (c != nullptr) {
// The pointer was memoized
return ExpiringPointer<Calculation>(c);
}
c = bufferCalculationAtIndex(i);
m_memoizedCalculationPointers[i-m_indexOfFirstMemoizedCalculationPointer] = c;
return c;
// m_buffer is the adress of the oldest calculation in calculation store
Calculation * c = (Calculation *) m_buffer;
if (i != m_numberOfCalculations-1) {
// The calculation we want is not the oldest one so we get its pointer
c = *reinterpret_cast<Calculation**>(addressOfPointerToCalculationOfIndex(i+1));
}
// Slide the memoization buffer
if (i >= m_indexOfFirstMemoizedCalculationPointer) {
// Slide the memoization buffer to the left
memmove(m_memoizedCalculationPointers, m_memoizedCalculationPointers+1, (k_numberOfMemoizedCalculationPointers - 1) * sizeof(Calculation *));
m_memoizedCalculationPointers[k_numberOfMemoizedCalculationPointers - 1] = nullptr;
m_indexOfFirstMemoizedCalculationPointer++;
} else {
// Slide the memoization buffer to the right
memmove(m_memoizedCalculationPointers+1, m_memoizedCalculationPointers, (k_numberOfMemoizedCalculationPointers - 1) * sizeof(Calculation *));
m_memoizedCalculationPointers[0] = nullptr;
m_indexOfFirstMemoizedCalculationPointer--;
}
return calculationAtIndex(i);
return ExpiringPointer<Calculation>(c);
}
ExpiringPointer<Calculation> CalculationStore::push(const char * text, Context * context) {
/* Compute ans now, before the buffer is slided and before the calculation
// Pushes an expression in the store
ExpiringPointer<Calculation> CalculationStore::push(const char * text, Context * context, HeightComputer heightComputer) {
/* Compute ans now, before the buffer is updated and before the calculation
* might be deleted */
Expression ans = ansExpression(context);
// Prepare the buffer for the new calculation
int minSize = Calculation::MinimalSize();
assert(k_bufferSize > minSize);
while (remainingBufferSize() < minSize || m_numberOfCalculations > k_maxNumberOfCalculations) {
deleteLastCalculation();
/* Prepare the buffer for the new calculation
*The minimal size to store the new calculation is the minimal size of a calculation plus the pointer to its end */
int minSize = Calculation::MinimalSize() + sizeof(Calculation *);
assert(m_bufferSize > minSize);
while (remainingBufferSize() < minSize) {
// If there is no more space to store a calculation, we delete the oldest one
deleteOldestCalculation();
}
char * newCalculationsLocation = slideCalculationsToEndOfBuffer();
char * nextSerializationLocation = m_buffer;
// Getting the adresses of the limits of the free space
char * beginingOfFreeSpace = (char *)m_calculationAreaEnd;
char * endOfFreeSpace = beginingOfMemoizationArea();
char * previousCalc = beginingOfFreeSpace;
// Add the beginning of the calculation
{
@@ -71,23 +60,23 @@ ExpiringPointer<Calculation> CalculationStore::push(const char * text, Context *
* available, so this memmove will not overide anything. */
Calculation newCalc = Calculation();
size_t calcSize = sizeof(newCalc);
memmove(nextSerializationLocation, &newCalc, calcSize);
nextSerializationLocation += calcSize;
memcpy(beginingOfFreeSpace, &newCalc, calcSize);
beginingOfFreeSpace += calcSize;
}
/* Add the input expression.
* We do not store directly the text entered by the user because we do not
* want to keep Ans symbol in the calculation store. */
const char * inputSerialization = nextSerializationLocation;
const char * inputSerialization = beginingOfFreeSpace;
{
Expression input = Expression::Parse(text, context).replaceSymbolWithExpression(Symbol::Ans(), ans);
if (!pushSerializeExpression(input, nextSerializationLocation, &newCalculationsLocation)) {
if (!pushSerializeExpression(input, beginingOfFreeSpace, &endOfFreeSpace)) {
/* If the input does not fit in the store (event if the current
* calculation is the only calculation), just replace the calculation with
* undef. */
return emptyStoreAndPushUndef(context);
return emptyStoreAndPushUndef(context, heightComputer);
}
nextSerializationLocation += strlen(nextSerializationLocation) + 1;
beginingOfFreeSpace += strlen(beginingOfFreeSpace) + 1;
}
// Compute and serialize the outputs
@@ -110,65 +99,73 @@ ExpiringPointer<Calculation> CalculationStore::push(const char * text, Context *
if (i == numberOfOutputs - 1) {
numberOfSignificantDigits = Poincare::Preferences::sharedPreferences()->numberOfSignificantDigits();
}
if (!pushSerializeExpression(outputs[i], nextSerializationLocation, &newCalculationsLocation, numberOfSignificantDigits)) {
if (!pushSerializeExpression(outputs[i], beginingOfFreeSpace, &endOfFreeSpace, numberOfSignificantDigits)) {
/* If the exat/approximate output does not fit in the store (event if the
* current calculation is the only calculation), replace the output with
* undef if it fits, else replace the whole calcualtion with undef. */
Expression undef = Undefined::Builder();
if (!pushSerializeExpression(undef, nextSerializationLocation, &newCalculationsLocation)) {
return emptyStoreAndPushUndef(context);
if (!pushSerializeExpression(undef, beginingOfFreeSpace, &endOfFreeSpace)) {
return emptyStoreAndPushUndef(context, heightComputer);
}
}
nextSerializationLocation += strlen(nextSerializationLocation) + 1;
beginingOfFreeSpace += strlen(beginingOfFreeSpace) + 1;
}
}
// Storing the pointer of the end of the new calculation
memcpy(endOfFreeSpace-sizeof(Calculation*),&beginingOfFreeSpace,sizeof(beginingOfFreeSpace));
// Restore the other calculations
size_t slideSize = m_buffer + k_bufferSize - newCalculationsLocation;
memcpy(nextSerializationLocation, newCalculationsLocation, slideSize);
m_slidedBuffer = false;
// The new calculation is now stored
m_numberOfCalculations++;
m_bufferEnd+= nextSerializationLocation - m_buffer;
// Clean the memoization
resetMemoizedModelsAfterCalculationIndex(-1);
return ExpiringPointer<Calculation>(reinterpret_cast<Calculation *>(m_buffer));
// The end of the calculation storage area is updated
m_calculationAreaEnd += beginingOfFreeSpace - previousCalc;
ExpiringPointer<Calculation> calculation = ExpiringPointer<Calculation>(reinterpret_cast<Calculation *>(previousCalc));
/* Heights are computed now to make sure that the display output is decided
* accordingly to the remaining size in the Poincare pool. Once it is, it
* can't change anymore: the calculation heights are fixed which ensures that
* scrolling computation is right. */
calculation->setHeights(
heightComputer(calculation.pointer(), false),
heightComputer(calculation.pointer(), true));
return calculation;
}
// Delete the calculation of index i
void CalculationStore::deleteCalculationAtIndex(int i) {
assert(i >= 0 && i < m_numberOfCalculations);
assert(!m_slidedBuffer);
ExpiringPointer<Calculation> calcI = calculationAtIndex(i);
char * nextCalc = reinterpret_cast<char *>(calcI->next());
assert(m_bufferEnd >= nextCalc);
size_t slidingSize = m_bufferEnd - nextCalc;
memmove((char *)(calcI.pointer()), nextCalc, slidingSize);
m_bufferEnd -= (nextCalc - (char *)(calcI.pointer()));
m_numberOfCalculations--;
resetMemoizedModelsAfterCalculationIndex(i);
}
void CalculationStore::deleteAll() {
/* We might call deleteAll because the app closed due to a pool allocation
* failure, so we cannot assert that m_slidedBuffer is false. */
m_slidedBuffer = false;
m_bufferEnd = m_buffer;
m_numberOfCalculations = 0;
resetMemoizedModelsAfterCalculationIndex(-1);
}
void CalculationStore::tidy() {
if (m_slidedBuffer) {
deleteAll();
if (i == 0) {
ExpiringPointer<Calculation> lastCalculationPointer = calculationAtIndex(0);
m_calculationAreaEnd = (char *)(lastCalculationPointer.pointer());
m_numberOfCalculations--;
return;
}
resetMemoizedModelsAfterCalculationIndex(-1);
for (Calculation * c : *this) {
c->tidy();
}
char * calcI = (char *)calculationAtIndex(i).pointer();
char * nextCalc = (char *) calculationAtIndex(i-1).pointer();
assert(m_calculationAreaEnd >= nextCalc);
size_t slidingSize = m_calculationAreaEnd - nextCalc;
// Slide the i-1 most recent calculations right after the i+1'th
memmove(calcI, nextCalc, slidingSize);
m_calculationAreaEnd -= nextCalc - calcI;
// Recompute pointer to calculations after the i'th
recomputeMemoizedPointersAfterCalculationIndex(i);
m_numberOfCalculations--;
}
// Delete the oldest calculation in the store and returns the amount of space freed by the operation
size_t CalculationStore::deleteOldestCalculation() {
char * oldBufferEnd = (char *) m_calculationAreaEnd;
deleteCalculationAtIndex(numberOfCalculations()-1);
char * newBufferEnd = (char *) m_calculationAreaEnd;
return oldBufferEnd - newBufferEnd;
}
// Delete all calculations
void CalculationStore::deleteAll() {
m_calculationAreaEnd = m_buffer;
m_numberOfCalculations = 0;
}
// Replace "Ans" by its expression
Expression CalculationStore::ansExpression(Context * context) {
if (numberOfCalculations() == 0) {
return Rational::Builder(0);
@@ -187,92 +184,42 @@ Expression CalculationStore::ansExpression(Context * context) {
return mostRecentCalculation->exactOutput();
}
Calculation * CalculationStore::bufferCalculationAtIndex(int i) {
int currentIndex = 0;
for (Calculation * c : *this) {
if (currentIndex == i) {
return c;
}
currentIndex++;
}
assert(false);
return nullptr;
}
// Push converted expression in the buffer
bool CalculationStore::pushSerializeExpression(Expression e, char * location, char * * newCalculationsLocation, int numberOfSignificantDigits) {
assert(m_slidedBuffer);
assert(*newCalculationsLocation <= m_buffer + k_bufferSize);
assert(*newCalculationsLocation <= m_buffer + m_bufferSize);
bool expressionIsPushed = false;
while (true) {
size_t locationSize = *newCalculationsLocation - location;
expressionIsPushed = (PoincareHelpers::Serialize(e, location, locationSize, numberOfSignificantDigits) < (int)locationSize-1);
if (expressionIsPushed || *newCalculationsLocation >= m_buffer + k_bufferSize) {
if (expressionIsPushed || *newCalculationsLocation >= m_buffer + m_bufferSize) {
break;
}
*newCalculationsLocation = *newCalculationsLocation + deleteLastCalculation();
assert(*newCalculationsLocation <= m_buffer + k_bufferSize);
*newCalculationsLocation = *newCalculationsLocation + deleteOldestCalculation();
assert(*newCalculationsLocation <= m_buffer + m_bufferSize);
}
return expressionIsPushed;
}
char * CalculationStore::slideCalculationsToEndOfBuffer() {
int calculationsSize = m_bufferEnd - m_buffer;
char * calculationsNewPosition = m_buffer + k_bufferSize - calculationsSize;
memmove(calculationsNewPosition, m_buffer, calculationsSize);
m_slidedBuffer = true;
return calculationsNewPosition;
}
size_t CalculationStore::deleteLastCalculation(const char * calculationsStart) {
assert(m_numberOfCalculations > 0);
size_t result;
if (!m_slidedBuffer) {
assert(calculationsStart == nullptr);
const char * previousBufferEnd = m_bufferEnd;
m_bufferEnd = lastCalculationPosition(m_buffer);
assert(previousBufferEnd > m_bufferEnd);
result = previousBufferEnd - m_bufferEnd;
} else {
assert(calculationsStart != nullptr);
const char * lastCalc = lastCalculationPosition(calculationsStart);
assert(*lastCalc == 0);
result = m_buffer + k_bufferSize - lastCalc;
memmove(const_cast<char *>(calculationsStart + result), calculationsStart, m_buffer + k_bufferSize - calculationsStart - result);
}
m_numberOfCalculations--;
resetMemoizedModelsAfterCalculationIndex(-1);
return result;
}
const char * CalculationStore::lastCalculationPosition(const char * calculationsStart) const {
assert(calculationsStart >= m_buffer && calculationsStart < m_buffer + k_bufferSize);
Calculation * c = reinterpret_cast<Calculation *>(const_cast<char *>(calculationsStart));
int calculationIndex = 0;
while (calculationIndex < m_numberOfCalculations - 1) {
c = c->next();
calculationIndex++;
}
return reinterpret_cast<const char *>(c);
}
Shared::ExpiringPointer<Calculation> CalculationStore::emptyStoreAndPushUndef(Context * context) {
Shared::ExpiringPointer<Calculation> CalculationStore::emptyStoreAndPushUndef(Context * context, HeightComputer heightComputer) {
/* We end up here as a result of a failed calculation push. The store
* attributes are not necessarily clean, so we need to reset them. */
m_slidedBuffer = false;
deleteAll();
return push(Undefined::Name(), context);
return push(Undefined::Name(), context, heightComputer);
}
void CalculationStore::resetMemoizedModelsAfterCalculationIndex(int index) {
if (index < m_indexOfFirstMemoizedCalculationPointer) {
memset(&m_memoizedCalculationPointers, 0, k_numberOfMemoizedCalculationPointers * sizeof(Calculation *));
return;
}
if (index >= m_indexOfFirstMemoizedCalculationPointer + k_numberOfMemoizedCalculationPointers) {
return;
}
for (int i = index - m_indexOfFirstMemoizedCalculationPointer; i < k_numberOfMemoizedCalculationPointers; i++) {
m_memoizedCalculationPointers[i] = nullptr;
// Recompute memoized pointers to the calculations after index i
void CalculationStore::recomputeMemoizedPointersAfterCalculationIndex(int index) {
assert(index < m_numberOfCalculations);
// Clear pointer and recompute new ones
Calculation * c = calculationAtIndex(index).pointer();
Calculation * nextCalc;
while (index != 0) {
nextCalc = c->next();
memcpy(addressOfPointerToCalculationOfIndex(index), &nextCalc, sizeof(Calculation *));
c = nextCalc;
index--;
}
}

View File

@@ -7,36 +7,45 @@
namespace Calculation {
/* To optimize the storage space, we use one big buffer for all calculations.
*
* The previous solution was to keep 10 calculations, each containing 3 buffers
* (for input and outputs). To optimize the storage, we then wanted to put all
* outputs in a cache where they could be deleted to add a new entry, and
* recomputed on cache miss. However, the computation depends too much on the
* state of the memory for this to be possible. For instance:
* 6->a
* a+1
* Perform some big computations that remove a+1 from the cache
* Delete a from the variable box.
* Scroll up to display a+1 : a does not exist anymore so the outputs won't be
* recomputed correctly.
*
* Now we do not cap the number of calculations and just delete the oldests to
* create space for a new calculation. */
/*
To optimize the storage space, we use one big buffer for all calculations.
The calculations are stored one after another while pointers to the end of each
calculation are stored at the end of the buffer, in the opposite direction.
By doing so, we can memoize every calculation entered while not limiting
the number of calculation stored in the buffer.
If the remaining space is too small for storing a new calculation, we
delete the oldest one.
Memory layout :
<- Available space for new calculations ->
+--------------------------------------------------------------------------------------------------------------------+
| | | | | | | | | |
| Calculation 3 | Calculation 2 | Calculation 1 | Calculation O | |p0|p1|p2|p3|
| Oldest | | | | | | | | |
+--------------------------------------------------------------------------------------------------------------------+
^ ^ ^ ^ ^ ^
m_buffer p3 p2 p1 p0 a
m_calculationAreaEnd = p0
a = addressOfPointerToCalculation(0)
*/
class CalculationStore {
public:
CalculationStore();
CalculationStore(char * buffer, int size);
Shared::ExpiringPointer<Calculation> calculationAtIndex(int i);
Shared::ExpiringPointer<Calculation> push(const char * text, Poincare::Context * context);
typedef KDCoordinate (*HeightComputer)(Calculation * c, bool expanded);
Shared::ExpiringPointer<Calculation> push(const char * text, Poincare::Context * context, HeightComputer heightComputer);
void deleteCalculationAtIndex(int i);
void deleteAll();
int remainingBufferSize() const { assert(m_calculationAreaEnd >= m_buffer); return m_bufferSize - (m_calculationAreaEnd - m_buffer) - m_numberOfCalculations*sizeof(Calculation*); }
int numberOfCalculations() const { return m_numberOfCalculations; }
Poincare::Expression ansExpression(Poincare::Context * context);
void tidy();
int bufferSize() { return m_bufferSize; }
private:
static constexpr int k_maxNumberOfCalculations = 25;
static constexpr int k_bufferSize = 10 * Calculation::k_numberOfExpressions * Constant::MaxSerializedExpressionSize;
class CalculationIterator {
public:
@@ -52,26 +61,22 @@ private:
};
CalculationIterator begin() const { return CalculationIterator(m_buffer); }
CalculationIterator end() const { return CalculationIterator(m_bufferEnd); }
CalculationIterator end() const { return CalculationIterator(m_calculationAreaEnd); }
Calculation * bufferCalculationAtIndex(int i);
int remainingBufferSize() const { assert(m_bufferEnd >= m_buffer); return k_bufferSize - (m_bufferEnd - m_buffer); }
bool pushSerializeExpression(Poincare::Expression e, char * location, char * * newCalculationsLocation, int numberOfSignificantDigits = Poincare::PrintFloat::k_numberOfStoredSignificantDigits);
char * slideCalculationsToEndOfBuffer(); // returns the new position of the calculations
size_t deleteLastCalculation(const char * calculationsStart = nullptr);
const char * lastCalculationPosition(const char * calculationsStart) const;
Shared::ExpiringPointer<Calculation> emptyStoreAndPushUndef(Poincare::Context * context);
Shared::ExpiringPointer<Calculation> emptyStoreAndPushUndef(Poincare::Context * context, HeightComputer heightComputer);
char m_buffer[k_bufferSize];
const char * m_bufferEnd;
char * m_buffer;
int m_bufferSize;
const char * m_calculationAreaEnd;
int m_numberOfCalculations;
bool m_slidedBuffer;
size_t deleteOldestCalculation();
char * addressOfPointerToCalculationOfIndex(int i) {return m_buffer + m_bufferSize - (m_numberOfCalculations - i)*sizeof(Calculation *);}
// Memoization
static constexpr int k_numberOfMemoizedCalculationPointers = 10;
void resetMemoizedModelsAfterCalculationIndex(int index);
int m_indexOfFirstMemoizedCalculationPointer;
mutable Calculation * m_memoizedCalculationPointers[k_numberOfMemoizedCalculationPointers];
char * beginingOfMemoizationArea() {return addressOfPointerToCalculationOfIndex(0);};
void recomputeMemoizedPointersAfterCalculationIndex(int index);
};
}

View File

@@ -38,13 +38,14 @@ void EditExpressionController::ContentView::reload() {
markRectAsDirty(bounds());
}
EditExpressionController::EditExpressionController(Responder * parentResponder, InputEventHandlerDelegate * inputEventHandlerDelegate, HistoryController * historyController, CalculationStore * calculationStore) :
EditExpressionController::EditExpressionController(Responder * parentResponder, InputEventHandlerDelegate * inputEventHandlerDelegate, char * cacheBuffer, size_t * cacheBufferInformation, HistoryController * historyController, CalculationStore * calculationStore) :
ViewController(parentResponder),
m_cacheBuffer(cacheBuffer),
m_cacheBufferInformation(cacheBufferInformation),
m_historyController(historyController),
m_calculationStore(calculationStore),
m_contentView(this, static_cast<CalculationSelectableTableView *>(m_historyController->view()), inputEventHandlerDelegate, this, this)
{
m_cacheBuffer[0] = 0;
}
void EditExpressionController::insertTextBody(const char * text) {
@@ -58,6 +59,15 @@ void EditExpressionController::didBecomeFirstResponder() {
Container::activeApp()->setFirstResponder(m_contentView.expressionField());
}
void EditExpressionController::restoreInput() {
m_contentView.expressionField()->restoreContent(m_cacheBuffer, *m_cacheBufferInformation);
clearCacheBuffer();
}
void EditExpressionController::memoizeInput() {
*m_cacheBufferInformation = m_contentView.expressionField()->moveCursorAndDumpContent(m_cacheBuffer, k_cacheBufferSize);
}
void EditExpressionController::viewWillAppear() {
m_historyController->viewWillAppear();
}
@@ -122,13 +132,13 @@ bool EditExpressionController::inputViewDidReceiveEvent(Ion::Events::Event event
if (!myApp->isAcceptableText(m_cacheBuffer)) {
return true;
}
m_calculationStore->push(m_cacheBuffer, myApp->localContext());
m_calculationStore->push(m_cacheBuffer, myApp->localContext(), HistoryViewCell::Height);
m_historyController->reload();
return true;
}
if (event == Ion::Events::Up) {
if (m_calculationStore->numberOfCalculations() > 0) {
m_cacheBuffer[0] = 0;
clearCacheBuffer();
m_contentView.expressionField()->setEditing(false, false);
Container::activeApp()->setFirstResponder(m_historyController);
}
@@ -145,7 +155,7 @@ bool EditExpressionController::inputViewDidFinishEditing(const char * text, Layo
} else {
layoutR.serializeParsedExpression(m_cacheBuffer, k_cacheBufferSize, context);
}
m_calculationStore->push(m_cacheBuffer, context);
m_calculationStore->push(m_cacheBuffer, context, HistoryViewCell::Height);
m_historyController->reload();
m_contentView.expressionField()->setEditing(true, true);
telemetryReportEvent("Input", m_cacheBuffer);

View File

@@ -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 {
@@ -15,11 +14,23 @@ namespace Calculation {
/* TODO: implement a split view */
class EditExpressionController : public ViewController, public Shared::TextFieldDelegate, public Shared::LayoutFieldDelegate {
public:
EditExpressionController(Responder * parentResponder, InputEventHandlerDelegate * inputEventHandlerDelegate, HistoryController * historyController, CalculationStore * calculationStore);
EditExpressionController(Responder * parentResponder, InputEventHandlerDelegate * inputEventHandlerDelegate, char * cacheBuffer, size_t * cacheBufferInformation, HistoryController * historyController, CalculationStore * calculationStore);
/* k_layoutBufferMaxSize dictates the size under which the expression being
* edited can be remembered when the user leaves Calculation. */
static constexpr int k_layoutBufferMaxSize = 1024;
/* k_cacheBufferSize is the size of the array to which m_cacheBuffer points.
* It is used both as a way to buffer expression when pushing them the
* CalculationStore, and as a storage for the current input when leaving the
* application. */
static constexpr int k_cacheBufferSize = (k_layoutBufferMaxSize < Constant::MaxSerializedExpressionSize) ? Constant::MaxSerializedExpressionSize : k_layoutBufferMaxSize;
View * view() override { return &m_contentView; }
void didBecomeFirstResponder() override;
void viewWillAppear() override;
void insertTextBody(const char * text);
void restoreInput();
void memoizeInput();
/* TextFieldDelegate */
bool textFieldDidReceiveEvent(::TextField * textField, Ion::Events::Event event) override;
@@ -47,11 +58,12 @@ private:
ExpressionField m_expressionField;
};
void reloadView();
void clearCacheBuffer() { m_cacheBuffer[0] = 0; *m_cacheBufferInformation = 0; }
bool inputViewDidReceiveEvent(Ion::Events::Event event, bool shouldDuplicateLastCalculation);
bool inputViewDidFinishEditing(const char * text, Poincare::Layout layoutR);
bool inputViewDidAbortEditing(const char * text);
static constexpr int k_cacheBufferSize = Constant::MaxSerializedExpressionSize;
char m_cacheBuffer[k_cacheBufferSize];
char * m_cacheBuffer;
size_t * m_cacheBufferInformation;
HistoryController * m_historyController;
CalculationStore * m_calculationStore;
ContentView m_contentView;

View File

@@ -17,7 +17,8 @@ bool ExpressionField::handleEvent(Ion::Events::Event event) {
event == Ion::Events::Power ||
event == Ion::Events::Square ||
event == Ion::Events::Division ||
event == Ion::Events::Sto)) {
event == Ion::Events::Sto ||
event == Ion::Events::EE)) {
handleEventWithText(Poincare::Symbol::k_ans);
}
return(::ExpressionField::handleEvent(event));

View File

@@ -17,7 +17,8 @@ HistoryController::HistoryController(EditExpressionController * editExpressionCo
m_integerController(editExpressionController),
m_rationalController(editExpressionController),
m_trigonometryController(editExpressionController),
m_unitController(editExpressionController)
m_unitController(editExpressionController),
m_matrixController(editExpressionController)
{
for (int i = 0; i < k_maxNumberOfDisplayedRows; i++) {
m_calculationHistory[i].setParentResponder(&m_selectableTableView);
@@ -110,6 +111,8 @@ bool HistoryController::handleEvent(Ion::Events::Event event) {
vc = &m_rationalController;
} else if (additionalInfoType == Calculation::AdditionalInformationType::Unit) {
vc = &m_unitController;
} else if (additionalInfoType == Calculation::AdditionalInformationType::Matrix) {
vc = &m_matrixController;
}
if (vc) {
vc->setExpression(e);
@@ -129,7 +132,9 @@ bool HistoryController::handleEvent(Ion::Events::Event event) {
return true;
}
m_selectableTableView.selectCellAtLocation(0, focusRow > 0 ? focusRow - 1 : 0);
setSelectedSubviewType(subviewType, true, 0, selectedRow());
/* The parameters 'sameCell' and 'previousSelectedY' are chosen to enforce
* toggling of the output when necessary. */
setSelectedSubviewType(subviewType, false, 0, (subviewType == SubviewType::Input) ? selectedRow() : -1);
return true;
}
if (event == Ion::Events::Clear) {
@@ -204,20 +209,7 @@ KDCoordinate HistoryController::rowHeight(int j) {
}
Shared::ExpiringPointer<Calculation> calculation = calculationAtIndex(j);
bool expanded = j == selectedRow() && selectedSubviewType() == SubviewType::Output;
KDCoordinate result = calculation->memoizedHeight(expanded);
if (result < 0) {
result = HistoryViewCell::Height(calculation.pointer(), expanded);
if (result < 0) {
// Raise, because Height modified the calculation and failed.
Poincare::ExceptionCheckpoint::Raise();
}
calculation->setMemoizedHeight(expanded, result);
}
/* We might want to put an assertion here to check the memoization:
* assert(result == HistoryViewCell::Height(calculation.pointer(), expanded));
* However, Height might fail due to pool memory exhaustion, in which case the
* assertion fails even if "result" had the right value. */
return result;
return calculation->height(expanded);
}
int HistoryController::typeAtLocation(int i, int j) {

View File

@@ -10,6 +10,7 @@
#include "additional_outputs/rational_list_controller.h"
#include "additional_outputs/trigonometry_list_controller.h"
#include "additional_outputs/unit_list_controller.h"
#include "additional_outputs/matrix_list_controller.h"
namespace Calculation {
@@ -48,6 +49,7 @@ private:
RationalListController m_rationalController;
TrigonometryListController m_trigonometryController;
UnitListController m_unitController;
MatrixListController m_matrixController;
};
}

View File

@@ -36,16 +36,7 @@ void HistoryViewCellDataSource::setSelectedSubviewType(SubviewType subviewType,
KDCoordinate HistoryViewCell::Height(Calculation * calculation, bool expanded) {
HistoryViewCell cell(nullptr);
bool didForceOutput = false;
cell.setCalculation(calculation, expanded, &didForceOutput);
if (didForceOutput) {
/* We could not compute the height of the calculation as it is (the display
* output was forced to another value during the height computation).
* Warning: the display output of calculation was actually changed, so it
* will cause problems if we already did some computations with another
* display value. */
return -1;
}
cell.setCalculation(calculation, expanded, true);
KDRect ellipsisFrame = KDRectZero;
KDRect inputFrame = KDRectZero;
KDRect outputFrame = KDRectZero;
@@ -246,8 +237,7 @@ void HistoryViewCell::resetMemoization() {
m_calculationCRC32 = 0;
}
void HistoryViewCell::setCalculation(Calculation * calculation, bool expanded, bool * didForceOutput) {
assert(!didForceOutput || *didForceOutput == false);
void HistoryViewCell::setCalculation(Calculation * calculation, bool expanded, bool canChangeDisplayOutput) {
uint32_t newCalculationCRC = Ion::crc32Byte((const uint8_t *)calculation, ((char *)calculation->next()) - ((char *) calculation));
if (newCalculationCRC == m_calculationCRC32 && m_calculationExpanded == expanded) {
return;
@@ -273,11 +263,8 @@ void HistoryViewCell::setCalculation(Calculation * calculation, bool expanded, b
bool couldNotCreateExactLayout = false;
exactOutputLayout = calculation->createExactOutputLayout(&couldNotCreateExactLayout);
if (couldNotCreateExactLayout) {
if (calculation->displayOutput(context) != ::Calculation::Calculation::DisplayOutput::ExactOnly) {
if (canChangeDisplayOutput && calculation->displayOutput(context) != ::Calculation::Calculation::DisplayOutput::ExactOnly) {
calculation->forceDisplayOutput(::Calculation::Calculation::DisplayOutput::ApproximateOnly);
if (didForceOutput) {
*didForceOutput = true;
}
} else {
/* We should only display the exact result, but we cannot create it
* -> raise an exception. */
@@ -294,27 +281,25 @@ void HistoryViewCell::setCalculation(Calculation * calculation, bool expanded, b
bool couldNotCreateApproximateLayout = false;
approximateOutputLayout = calculation->createApproximateOutputLayout(context, &couldNotCreateApproximateLayout);
if (couldNotCreateApproximateLayout) {
if (calculation->displayOutput(context) == ::Calculation::Calculation::DisplayOutput::ApproximateOnly) {
Poincare::ExceptionCheckpoint::Raise();
} else {
if (canChangeDisplayOutput && calculation->displayOutput(context) != ::Calculation::Calculation::DisplayOutput::ApproximateOnly) {
/* Set the display output to ApproximateOnly, make room in the pool by
* erasing the exact layout, and retry to create the approximate layout */
calculation->forceDisplayOutput(::Calculation::Calculation::DisplayOutput::ApproximateOnly);
if (didForceOutput) {
*didForceOutput = true;
}
exactOutputLayout = Poincare::Layout();
couldNotCreateApproximateLayout = false;
approximateOutputLayout = calculation->createApproximateOutputLayout(context, &couldNotCreateApproximateLayout);
if (couldNotCreateApproximateLayout) {
Poincare::ExceptionCheckpoint::Raise();
}
} else {
Poincare::ExceptionCheckpoint::Raise();
}
}
}
m_calculationDisplayOutput = calculation->displayOutput(context);
// We must set which subviews are displayed before setLayouts to mark the right rectangle as dirty
m_scrollableOutputView.setDisplayableCenter(m_calculationDisplayOutput == Calculation::DisplayOutput::ExactAndApproximate || m_calculationDisplayOutput == Calculation::DisplayOutput::ExactAndApproximateToggle);
m_scrollableOutputView.setDisplayCenter(m_calculationDisplayOutput == Calculation::DisplayOutput::ExactAndApproximate || m_calculationExpanded);
m_scrollableOutputView.setLayouts(Poincare::Layout(), exactOutputLayout, approximateOutputLayout);
I18n::Message equalMessage = calculation->exactAndApproximateDisplayedOutputsAreEqual(context) == Calculation::EqualSign::Equal ? I18n::Message::Equal : I18n::Message::AlmostEqual;

View File

@@ -51,7 +51,7 @@ public:
Poincare::Layout layout() const override;
KDColor backgroundColor() const override { return m_even ? Palette::CalculationBackgroundEven : Palette::CalculationBackgroundOdd; }
void resetMemoization();
void setCalculation(Calculation * calculation, bool expanded, bool * didForceOutput = nullptr);
void setCalculation(Calculation * calculation, bool expanded, bool canChangeDisplayOutput = false);
int numberOfSubviews() const override { return 2 + displayedEllipsis(); }
View * subviewAtIndex(int index) override;
void layoutSubviews(bool force = false) override;

View File

@@ -5,124 +5,149 @@
#include <assert.h>
#include "../calculation_store.h"
typedef ::Calculation::Calculation::DisplayOutput DisplayOutput;
typedef ::Calculation::Calculation::EqualSign EqualSign ;
typedef ::Calculation::Calculation::NumberOfSignificantDigits NumberOfSignificantDigits;
using namespace Poincare;
using namespace Calculation;
static constexpr int calculationBufferSize = 10 * (sizeof(::Calculation::Calculation) + ::Calculation::Calculation::k_numberOfExpressions * ::Constant::MaxSerializedExpressionSize + sizeof(::Calculation::Calculation *));
char calculationBuffer[calculationBufferSize];
void assert_store_is(CalculationStore * store, const char * * result) {
for (int i = 0; i < store->numberOfCalculations(); i++) {
quiz_assert(strcmp(store->calculationAtIndex(i)->inputText(), result[i]) == 0);
}
}
KDCoordinate dummyHeight(::Calculation::Calculation * c, bool expanded) { return 0; }
QUIZ_CASE(calculation_store) {
Shared::GlobalContext globalContext;
CalculationStore store;
CalculationStore store(calculationBuffer,calculationBufferSize);
// Store is now {9, 8, 7, 6, 5, 4, 3, 2, 1, 0}
const char * result[] = {"9", "8", "7", "6", "5", "4", "3", "2", "1", "0"};
for (int i = 0; i < 10; i++) {
char text[2] = {(char)(i+'0'), 0};
store.push(text, &globalContext);
store.push(text, &globalContext, dummyHeight);
quiz_assert(store.numberOfCalculations() == i+1);
}
assert_store_is(&store, result);
for (int i = 9; i > 0; i = i-2) {
store.deleteCalculationAtIndex(i);
store.deleteCalculationAtIndex(i);
}
// Store is now {9, 7, 5, 3, 1}
const char * result2[] = {"9", "7", "5", "3", "1"};
assert_store_is(&store, result2);
store.deleteAll();
// Checking if the store handles correctly the delete of the oldest calculation when full
static int minSize = ::Calculation::Calculation::MinimalSize();
char text[2] = {'0', 0};
while (store.remainingBufferSize() > minSize) {
store.push(text, &globalContext, dummyHeight);
}
int numberOfCalculations1 = store.numberOfCalculations();
/* The buffer is now to full to push a new calculation.
* Trying to push a new one should delete the oldest one*/
store.push(text, &globalContext, dummyHeight);
int numberOfCalculations2 = store.numberOfCalculations();
// The numberOfCalculations should be the same
quiz_assert(numberOfCalculations1 == numberOfCalculations2);
store.deleteAll();
quiz_assert(store.remainingBufferSize() == store.bufferSize());
}
QUIZ_CASE(calculation_ans) {
Shared::GlobalContext globalContext;
CalculationStore store;
CalculationStore store(calculationBuffer,calculationBufferSize);
store.push("1+3/4", &globalContext);
store.push("ans+2/3", &globalContext);
store.push("1+3/4", &globalContext, dummyHeight);
store.push("ans+2/3", &globalContext, dummyHeight);
Shared::ExpiringPointer<::Calculation::Calculation> lastCalculation = store.calculationAtIndex(0);
quiz_assert(lastCalculation->displayOutput(&globalContext) == ::Calculation::Calculation::DisplayOutput::ExactAndApproximate);
quiz_assert(lastCalculation->displayOutput(&globalContext) == DisplayOutput::ExactAndApproximate);
quiz_assert(strcmp(lastCalculation->exactOutputText(),"29/12") == 0);
store.push("ans+0.22", &globalContext);
store.push("ans+0.22", &globalContext, dummyHeight);
lastCalculation = store.calculationAtIndex(0);
quiz_assert(lastCalculation->displayOutput(&globalContext) == ::Calculation::Calculation::DisplayOutput::ExactAndApproximateToggle);
quiz_assert(strcmp(lastCalculation->approximateOutputText(::Calculation::Calculation::NumberOfSignificantDigits::Maximal),"2.6366666666667") == 0);
quiz_assert(lastCalculation->displayOutput(&globalContext) == DisplayOutput::ExactAndApproximateToggle);
quiz_assert(strcmp(lastCalculation->approximateOutputText(NumberOfSignificantDigits::Maximal),"2.6366666666667") == 0);
store.deleteAll();
}
void assertCalculationIs(const char * input, ::Calculation::Calculation::DisplayOutput display, ::Calculation::Calculation::EqualSign sign, const char * exactOutput, const char * displayedApproximateOutput, const char * storedApproximateOutput, Context * context, CalculationStore * store) {
store->push(input, context);
void assertCalculationIs(const char * input, DisplayOutput display, EqualSign sign, const char * exactOutput, const char * displayedApproximateOutput, const char * storedApproximateOutput, Context * context, CalculationStore * store) {
store->push(input, context, dummyHeight);
Shared::ExpiringPointer<::Calculation::Calculation> lastCalculation = store->calculationAtIndex(0);
quiz_assert(lastCalculation->displayOutput(context) == display);
if (sign != ::Calculation::Calculation::EqualSign::Unknown) {
if (sign != EqualSign::Unknown) {
quiz_assert(lastCalculation->exactAndApproximateDisplayedOutputsAreEqual(context) == sign);
}
if (exactOutput) {
quiz_assert_print_if_failure(strcmp(lastCalculation->exactOutputText(), exactOutput) == 0, input);
}
if (displayedApproximateOutput) {
quiz_assert_print_if_failure(strcmp(lastCalculation->approximateOutputText(::Calculation::Calculation::NumberOfSignificantDigits::UserDefined), displayedApproximateOutput) == 0, input);
quiz_assert_print_if_failure(strcmp(lastCalculation->approximateOutputText(NumberOfSignificantDigits::UserDefined), displayedApproximateOutput) == 0, input);
}
if (storedApproximateOutput) {
quiz_assert_print_if_failure(strcmp(lastCalculation->approximateOutputText(::Calculation::Calculation::NumberOfSignificantDigits::Maximal), storedApproximateOutput) == 0, input);
quiz_assert_print_if_failure(strcmp(lastCalculation->approximateOutputText(NumberOfSignificantDigits::Maximal), storedApproximateOutput) == 0, input);
}
store->deleteAll();
}
QUIZ_CASE(calculation_significant_digits) {
Shared::GlobalContext globalContext;
CalculationStore store;
CalculationStore store(calculationBuffer,calculationBufferSize);
assertCalculationIs("123456789", ::Calculation::Calculation::DisplayOutput::ExactAndApproximate, ::Calculation::Calculation::EqualSign::Approximation, "123456789", "1.234568ᴇ8", "123456789", &globalContext, &store);
assertCalculationIs("1234567", ::Calculation::Calculation::DisplayOutput::ApproximateOnly, ::Calculation::Calculation::EqualSign::Equal, "1234567", "1234567", "1234567", &globalContext, &store);
assertCalculationIs("123456789", DisplayOutput::ExactAndApproximate, EqualSign::Approximation, "123456789", "1.234568ᴇ8", "123456789", &globalContext, &store);
assertCalculationIs("1234567", DisplayOutput::ApproximateOnly, EqualSign::Equal, "1234567", "1234567", "1234567", &globalContext, &store);
}
QUIZ_CASE(calculation_display_exact_approximate) {
Shared::GlobalContext globalContext;
CalculationStore store;
CalculationStore store(calculationBuffer,calculationBufferSize);
assertCalculationIs("1/2", ::Calculation::Calculation::DisplayOutput::ExactAndApproximate, ::Calculation::Calculation::EqualSign::Equal, nullptr, nullptr, nullptr, &globalContext, &store);
assertCalculationIs("1/3", ::Calculation::Calculation::DisplayOutput::ExactAndApproximate, ::Calculation::Calculation::EqualSign::Approximation, nullptr, nullptr, nullptr, &globalContext, &store);
assertCalculationIs("1/0", ::Calculation::Calculation::DisplayOutput::ApproximateOnly, ::Calculation::Calculation::EqualSign::Unknown, "undef", "undef", "undef", &globalContext, &store);
assertCalculationIs("2x-x", ::Calculation::Calculation::DisplayOutput::ApproximateOnly, ::Calculation::Calculation::EqualSign::Unknown, "undef", "undef", "undef", &globalContext, &store);
assertCalculationIs("[[1,2,3]]", ::Calculation::Calculation::DisplayOutput::ApproximateOnly, ::Calculation::Calculation::EqualSign::Unknown, nullptr, nullptr, nullptr, &globalContext, &store);
assertCalculationIs("[[1,x,3]]", ::Calculation::Calculation::DisplayOutput::ApproximateOnly, ::Calculation::Calculation::EqualSign::Unknown, nullptr, "undef", "undef", &globalContext, &store);
assertCalculationIs("28^7", ::Calculation::Calculation::DisplayOutput::ExactAndApproximate, ::Calculation::Calculation::EqualSign::Unknown, nullptr, nullptr, nullptr, &globalContext, &store);
assertCalculationIs("3+√(2)→a", ::Calculation::Calculation::DisplayOutput::ExactAndApproximate, ::Calculation::Calculation::EqualSign::Approximation, "√(2)+3", nullptr, nullptr, &globalContext, &store);
assertCalculationIs("1/2", DisplayOutput::ExactAndApproximate, EqualSign::Equal, nullptr, nullptr, nullptr, &globalContext, &store);
assertCalculationIs("1/3", DisplayOutput::ExactAndApproximate, EqualSign::Approximation, nullptr, nullptr, nullptr, &globalContext, &store);
assertCalculationIs("1/0", DisplayOutput::ExactOnly, EqualSign::Unknown, "undef", "undef", "undef", &globalContext, &store);
assertCalculationIs("2x-x", DisplayOutput::ExactOnly, EqualSign::Unknown, "x", "undef", "undef", &globalContext, &store);
assertCalculationIs("[[1,2,3]]", DisplayOutput::ApproximateOnly, EqualSign::Unknown, nullptr, nullptr, nullptr, &globalContext, &store);
assertCalculationIs("[[1,x,3]]", DisplayOutput::ExactAndApproximate, EqualSign::Unknown, nullptr, "[[1,undef,3]]", "[[1,undef,3]]", &globalContext, &store);
assertCalculationIs("28^7", DisplayOutput::ExactAndApproximate, EqualSign::Unknown, nullptr, nullptr, nullptr, &globalContext, &store);
assertCalculationIs("3+√(2)→a", DisplayOutput::ExactAndApproximate, EqualSign::Approximation, "√(2)+3", nullptr, nullptr, &globalContext, &store);
Ion::Storage::sharedStorage()->recordNamed("a.exp").destroy();
assertCalculationIs("3+2→a", ::Calculation::Calculation::DisplayOutput::ApproximateOnly, ::Calculation::Calculation::EqualSign::Equal, "5", "5", "5", &globalContext, &store);
assertCalculationIs("3+2→a", DisplayOutput::ApproximateOnly, EqualSign::Equal, "5", "5", "5", &globalContext, &store);
Ion::Storage::sharedStorage()->recordNamed("a.exp").destroy();
assertCalculationIs("3→a", ::Calculation::Calculation::DisplayOutput::ApproximateOnly, ::Calculation::Calculation::EqualSign::Equal, "3", "3", "3", &globalContext, &store);
assertCalculationIs("3→a", DisplayOutput::ApproximateOnly, EqualSign::Equal, "3", "3", "3", &globalContext, &store);
Ion::Storage::sharedStorage()->recordNamed("a.exp").destroy();
assertCalculationIs("3+x→f(x)", ::Calculation::Calculation::DisplayOutput::ExactOnly, ::Calculation::Calculation::EqualSign::Unknown, "x+3", nullptr, nullptr, &globalContext, &store);
assertCalculationIs("3+x→f(x)", DisplayOutput::ExactOnly, EqualSign::Unknown, "x+3", nullptr, nullptr, &globalContext, &store);
Ion::Storage::sharedStorage()->recordNamed("f.func").destroy();
assertCalculationIs("1+1+random()", ::Calculation::Calculation::DisplayOutput::ApproximateOnly, ::Calculation::Calculation::EqualSign::Unknown, nullptr, nullptr, nullptr, &globalContext, &store);
assertCalculationIs("1+1+round(1.343,2)", ::Calculation::Calculation::DisplayOutput::ApproximateOnly, ::Calculation::Calculation::EqualSign::Unknown, nullptr, "3.34", "3.34", &globalContext, &store);
assertCalculationIs("randint(2,2)+3", ::Calculation::Calculation::DisplayOutput::ApproximateOnly, ::Calculation::Calculation::EqualSign::Unknown, "5", "5", "5", &globalContext, &store);
assertCalculationIs("confidence(0.5,2)+3", ::Calculation::Calculation::DisplayOutput::ApproximateOnly, ::Calculation::Calculation::EqualSign::Unknown, nullptr, nullptr, nullptr, &globalContext, &store);
assertCalculationIs("prediction(0.5,2)+3", ::Calculation::Calculation::DisplayOutput::ApproximateOnly, ::Calculation::Calculation::EqualSign::Unknown, nullptr, nullptr, nullptr, &globalContext, &store);
assertCalculationIs("prediction95(0.5,2)+3", ::Calculation::Calculation::DisplayOutput::ApproximateOnly, ::Calculation::Calculation::EqualSign::Unknown, nullptr, nullptr, nullptr, &globalContext, &store);
assertCalculationIs("1+1+random()", DisplayOutput::ApproximateOnly, EqualSign::Unknown, nullptr, nullptr, nullptr, &globalContext, &store);
assertCalculationIs("1+1+round(1.343,2)", DisplayOutput::ApproximateOnly, EqualSign::Unknown, nullptr, "3.34", "3.34", &globalContext, &store);
assertCalculationIs("randint(2,2)+3", DisplayOutput::ApproximateOnly, EqualSign::Unknown, "5", "5", "5", &globalContext, &store);
assertCalculationIs("confidence(0.5,2)+3", DisplayOutput::ExactOnly, EqualSign::Unknown, nullptr, nullptr, nullptr, &globalContext, &store);
assertCalculationIs("prediction(0.5,2)+3", DisplayOutput::ExactOnly, EqualSign::Unknown, nullptr, nullptr, nullptr, &globalContext, &store);
assertCalculationIs("prediction95(0.5,2)+3", DisplayOutput::ExactOnly, EqualSign::Unknown, nullptr, nullptr, nullptr, &globalContext, &store);
}
QUIZ_CASE(calculation_symbolic_computation) {
Shared::GlobalContext globalContext;
CalculationStore store;
CalculationStore store(calculationBuffer,calculationBufferSize);
assertCalculationIs("x+x+1+3+√(π)", ::Calculation::Calculation::DisplayOutput::ApproximateOnly, ::Calculation::Calculation::EqualSign::Unknown, "undef", "undef", "undef", &globalContext, &store);
assertCalculationIs("f(x)", ::Calculation::Calculation::DisplayOutput::ApproximateOnly, ::Calculation::Calculation::EqualSign::Unknown, "undef", "undef", "undef", &globalContext, &store);
assertCalculationIs("1+x→f(x)", ::Calculation::Calculation::DisplayOutput::ExactOnly, ::Calculation::Calculation::EqualSign::Unknown, "x+1", nullptr, nullptr, &globalContext, &store);
assertCalculationIs("f(x)", ::Calculation::Calculation::DisplayOutput::ApproximateOnly, ::Calculation::Calculation::EqualSign::Unknown, "undef", "undef", "undef", &globalContext, &store);
assertCalculationIs("f(2)", ::Calculation::Calculation::DisplayOutput::ApproximateOnly, ::Calculation::Calculation::EqualSign::Equal, "3", "3", "3", &globalContext, &store);
assertCalculationIs("2→x", ::Calculation::Calculation::DisplayOutput::ApproximateOnly, ::Calculation::Calculation::EqualSign::Equal, "2", nullptr, nullptr, &globalContext, &store);
assertCalculationIs("f(x)", ::Calculation::Calculation::DisplayOutput::ApproximateOnly, ::Calculation::Calculation::EqualSign::Equal, "3", nullptr, nullptr, &globalContext, &store);
assertCalculationIs("x+x+1+3+√(π)", ::Calculation::Calculation::DisplayOutput::ExactAndApproximate, ::Calculation::Calculation::EqualSign::Approximation, "√(π)+8", nullptr, nullptr, &globalContext, &store);
assertCalculationIs("x+x+1+3+√(π)", DisplayOutput::ExactOnly, EqualSign::Unknown, "2×x+√(π)+4", "undef", "undef", &globalContext, &store);
assertCalculationIs("f(x)", DisplayOutput::ExactOnly, EqualSign::Unknown, "f×x", "undef", "undef", &globalContext, &store);
assertCalculationIs("1+x→f(x)", DisplayOutput::ExactOnly, EqualSign::Unknown, "x+1", nullptr, nullptr, &globalContext, &store);
assertCalculationIs("f(x)", DisplayOutput::ExactOnly, EqualSign::Unknown, "x+1", "undef", "undef", &globalContext, &store);
assertCalculationIs("f(2)", DisplayOutput::ApproximateOnly, EqualSign::Equal, "3", "3", "3", &globalContext, &store);
assertCalculationIs("2→x", DisplayOutput::ApproximateOnly, EqualSign::Equal, "2", nullptr, nullptr, &globalContext, &store);
assertCalculationIs("f(x)", DisplayOutput::ApproximateOnly, EqualSign::Equal, "3", nullptr, nullptr, &globalContext, &store);
assertCalculationIs("x+x+1+3+√(π)", DisplayOutput::ExactAndApproximate, EqualSign::Approximation, "√(π)+8", nullptr, nullptr, &globalContext, &store);
Ion::Storage::sharedStorage()->recordNamed("f.func").destroy();
Ion::Storage::sharedStorage()->recordNamed("x.exp").destroy();
@@ -130,18 +155,18 @@ QUIZ_CASE(calculation_symbolic_computation) {
QUIZ_CASE(calculation_symbolic_computation_and_parametered_expressions) {
Shared::GlobalContext globalContext;
CalculationStore store;
CalculationStore store(calculationBuffer,calculationBufferSize);
assertCalculationIs("int((^(-x))-x^(0.5), x, 0, 3)", ::Calculation::Calculation::DisplayOutput::ApproximateOnly, ::Calculation::Calculation::EqualSign::Unknown, nullptr, nullptr, nullptr, &globalContext, &store); // Tests a bug with symbolic computation
assertCalculationIs("int(x,x,0,2)", ::Calculation::Calculation::DisplayOutput::ApproximateOnly, ::Calculation::Calculation::EqualSign::Unknown, nullptr, "2", "2", &globalContext, &store);
assertCalculationIs("sum(x,x,0,2)", ::Calculation::Calculation::DisplayOutput::ApproximateOnly, ::Calculation::Calculation::EqualSign::Unknown, nullptr, "3", "3", &globalContext, &store);
assertCalculationIs("product(x,x,1,2)", ::Calculation::Calculation::DisplayOutput::ApproximateOnly, ::Calculation::Calculation::EqualSign::Unknown, nullptr, "2", "2", &globalContext, &store);
assertCalculationIs("diff(x^2,x,3)", ::Calculation::Calculation::DisplayOutput::ApproximateOnly, ::Calculation::Calculation::EqualSign::Unknown, nullptr, "6", "6", &globalContext, &store);
assertCalculationIs("2→x", ::Calculation::Calculation::DisplayOutput::ApproximateOnly, ::Calculation::Calculation::EqualSign::Unknown, nullptr, nullptr, nullptr, &globalContext, &store);
assertCalculationIs("int(x,x,0,2)", ::Calculation::Calculation::DisplayOutput::ApproximateOnly, ::Calculation::Calculation::EqualSign::Unknown, nullptr, "2", "2", &globalContext, &store);
assertCalculationIs("sum(x,x,0,2)", ::Calculation::Calculation::DisplayOutput::ApproximateOnly, ::Calculation::Calculation::EqualSign::Unknown, nullptr, "3", "3", &globalContext, &store);
assertCalculationIs("product(x,x,1,2)", ::Calculation::Calculation::DisplayOutput::ApproximateOnly, ::Calculation::Calculation::EqualSign::Unknown, nullptr, "2", "2", &globalContext, &store);
assertCalculationIs("diff(x^2,x,3)", ::Calculation::Calculation::DisplayOutput::ApproximateOnly, ::Calculation::Calculation::EqualSign::Unknown, nullptr, "6", "6", &globalContext, &store);
assertCalculationIs("int((^(-x))-x^(0.5), x, 0, 3)", DisplayOutput::ApproximateOnly, EqualSign::Unknown, nullptr, nullptr, nullptr, &globalContext, &store); // Tests a bug with symbolic computation
assertCalculationIs("int(x,x,0,2)", DisplayOutput::ApproximateOnly, EqualSign::Unknown, nullptr, "2", "2", &globalContext, &store);
assertCalculationIs("sum(x,x,0,2)", DisplayOutput::ApproximateOnly, EqualSign::Unknown, nullptr, "3", "3", &globalContext, &store);
assertCalculationIs("product(x,x,1,2)", DisplayOutput::ApproximateOnly, EqualSign::Unknown, nullptr, "2", "2", &globalContext, &store);
assertCalculationIs("diff(x^2,x,3)", DisplayOutput::ApproximateOnly, EqualSign::Unknown, nullptr, "6", "6", &globalContext, &store);
assertCalculationIs("2→x", DisplayOutput::ApproximateOnly, EqualSign::Unknown, nullptr, nullptr, nullptr, &globalContext, &store);
assertCalculationIs("int(x,x,0,2)", DisplayOutput::ApproximateOnly, EqualSign::Unknown, nullptr, "2", "2", &globalContext, &store);
assertCalculationIs("sum(x,x,0,2)", DisplayOutput::ApproximateOnly, EqualSign::Unknown, nullptr, "3", "3", &globalContext, &store);
assertCalculationIs("product(x,x,1,2)", DisplayOutput::ApproximateOnly, EqualSign::Unknown, nullptr, "2", "2", &globalContext, &store);
assertCalculationIs("diff(x^2,x,3)", DisplayOutput::ApproximateOnly, EqualSign::Unknown, nullptr, "6", "6", &globalContext, &store);
Ion::Storage::sharedStorage()->recordNamed("x.exp").destroy();
}
@@ -149,34 +174,34 @@ QUIZ_CASE(calculation_symbolic_computation_and_parametered_expressions) {
QUIZ_CASE(calculation_complex_format) {
Shared::GlobalContext globalContext;
CalculationStore store;
CalculationStore store(calculationBuffer,calculationBufferSize);
Poincare::Preferences::sharedPreferences()->setComplexFormat(Poincare::Preferences::ComplexFormat::Real);
assertCalculationIs("1+𝐢", ::Calculation::Calculation::DisplayOutput::ApproximateOnly, ::Calculation::Calculation::EqualSign::Unknown, nullptr, "1+𝐢", "1+𝐢", &globalContext, &store);
assertCalculationIs("√(-1)", ::Calculation::Calculation::DisplayOutput::ApproximateOnly, ::Calculation::Calculation::EqualSign::Unknown, "unreal", nullptr, nullptr, &globalContext, &store);
assertCalculationIs("ln(-2)", ::Calculation::Calculation::DisplayOutput::ApproximateOnly, ::Calculation::Calculation::EqualSign::Unknown, nullptr, "unreal", "unreal", &globalContext, &store);
assertCalculationIs("√(-1)×√(-1)", ::Calculation::Calculation::DisplayOutput::ApproximateOnly, ::Calculation::Calculation::EqualSign::Unknown, nullptr, "unreal", "unreal", &globalContext, &store);
assertCalculationIs("(-8)^(1/3)", ::Calculation::Calculation::DisplayOutput::ApproximateOnly, ::Calculation::Calculation::EqualSign::Unknown, nullptr, "-2", "-2", &globalContext, &store);
assertCalculationIs("(-8)^(2/3)", ::Calculation::Calculation::DisplayOutput::ApproximateOnly, ::Calculation::Calculation::EqualSign::Unknown, nullptr, "4", "4", &globalContext, &store);
assertCalculationIs("(-2)^(1/4)", ::Calculation::Calculation::DisplayOutput::ApproximateOnly, ::Calculation::Calculation::EqualSign::Unknown, nullptr, "unreal", "unreal", &globalContext, &store);
assertCalculationIs("1+𝐢", DisplayOutput::ApproximateOnly, EqualSign::Unknown, nullptr, "1+𝐢", "1+𝐢", &globalContext, &store);
assertCalculationIs("√(-1)", DisplayOutput::ApproximateOnly, EqualSign::Unknown, "unreal", nullptr, nullptr, &globalContext, &store);
assertCalculationIs("ln(-2)", DisplayOutput::ApproximateOnly, EqualSign::Unknown, nullptr, "unreal", "unreal", &globalContext, &store);
assertCalculationIs("√(-1)×√(-1)", DisplayOutput::ApproximateOnly, EqualSign::Unknown, nullptr, "unreal", "unreal", &globalContext, &store);
assertCalculationIs("(-8)^(1/3)", DisplayOutput::ApproximateOnly, EqualSign::Unknown, nullptr, "-2", "-2", &globalContext, &store);
assertCalculationIs("(-8)^(2/3)", DisplayOutput::ApproximateOnly, EqualSign::Unknown, nullptr, "4", "4", &globalContext, &store);
assertCalculationIs("(-2)^(1/4)", DisplayOutput::ApproximateOnly, EqualSign::Unknown, nullptr, "unreal", "unreal", &globalContext, &store);
Poincare::Preferences::sharedPreferences()->setComplexFormat(Poincare::Preferences::ComplexFormat::Cartesian);
assertCalculationIs("1+𝐢", ::Calculation::Calculation::DisplayOutput::ApproximateOnly, ::Calculation::Calculation::EqualSign::Unknown, nullptr, "1+𝐢", "1+𝐢", &globalContext, &store);
assertCalculationIs("√(-1)", ::Calculation::Calculation::DisplayOutput::ApproximateOnly, ::Calculation::Calculation::EqualSign::Unknown, nullptr, "𝐢", "𝐢", &globalContext, &store);
assertCalculationIs("ln(-2)", ::Calculation::Calculation::DisplayOutput::ExactAndApproximate, ::Calculation::Calculation::EqualSign::Approximation, "ln(-2)", nullptr, nullptr, &globalContext, &store);
assertCalculationIs("√(-1)×√(-1)", ::Calculation::Calculation::DisplayOutput::ApproximateOnly, ::Calculation::Calculation::EqualSign::Unknown, nullptr, "-1", "-1", &globalContext, &store);
assertCalculationIs("(-8)^(1/3)", ::Calculation::Calculation::DisplayOutput::ExactAndApproximate, ::Calculation::Calculation::EqualSign::Approximation, "1+√(3)×𝐢", nullptr, nullptr, &globalContext, &store);
assertCalculationIs("(-8)^(2/3)", ::Calculation::Calculation::DisplayOutput::ExactAndApproximate, ::Calculation::Calculation::EqualSign::Approximation, "-2+2×√(3)×𝐢", nullptr, nullptr, &globalContext, &store);
assertCalculationIs("(-2)^(1/4)", ::Calculation::Calculation::DisplayOutput::ExactAndApproximate, ::Calculation::Calculation::EqualSign::Approximation, "root(8,4)/2+root(8,4)/2×𝐢", nullptr, nullptr, &globalContext, &store);
assertCalculationIs("1+𝐢", DisplayOutput::ApproximateOnly, EqualSign::Unknown, nullptr, "1+𝐢", "1+𝐢", &globalContext, &store);
assertCalculationIs("√(-1)", DisplayOutput::ApproximateOnly, EqualSign::Unknown, nullptr, "𝐢", "𝐢", &globalContext, &store);
assertCalculationIs("ln(-2)", DisplayOutput::ExactAndApproximate, EqualSign::Approximation, "ln(-2)", nullptr, nullptr, &globalContext, &store);
assertCalculationIs("√(-1)×√(-1)", DisplayOutput::ApproximateOnly, EqualSign::Unknown, nullptr, "-1", "-1", &globalContext, &store);
assertCalculationIs("(-8)^(1/3)", DisplayOutput::ExactAndApproximate, EqualSign::Approximation, "1+√(3)×𝐢", nullptr, nullptr, &globalContext, &store);
assertCalculationIs("(-8)^(2/3)", DisplayOutput::ExactAndApproximate, EqualSign::Approximation, "-2+2×√(3)×𝐢", nullptr, nullptr, &globalContext, &store);
assertCalculationIs("(-2)^(1/4)", DisplayOutput::ExactAndApproximate, EqualSign::Approximation, "root(8,4)/2+root(8,4)/2×𝐢", nullptr, nullptr, &globalContext, &store);
Poincare::Preferences::sharedPreferences()->setComplexFormat(Poincare::Preferences::ComplexFormat::Polar);
assertCalculationIs("1+𝐢", ::Calculation::Calculation::DisplayOutput::ExactAndApproximate, ::Calculation::Calculation::EqualSign::Approximation, "√(2)×^\u0012π/4×𝐢\u0013", nullptr, nullptr, &globalContext, &store);
assertCalculationIs("√(-1)", ::Calculation::Calculation::DisplayOutput::ExactAndApproximate, ::Calculation::Calculation::EqualSign::Approximation, "^\u0012π/2×𝐢\u0013", nullptr, nullptr, &globalContext, &store);
assertCalculationIs("ln(-2)", ::Calculation::Calculation::DisplayOutput::ExactAndApproximate, ::Calculation::Calculation::EqualSign::Approximation, "ln(-2)", nullptr, nullptr, &globalContext, &store);
assertCalculationIs("√(-1)×√(-1)", ::Calculation::Calculation::DisplayOutput::ExactAndApproximate, ::Calculation::Calculation::EqualSign::Unknown, nullptr, "^\u00123.141593×𝐢\u0013", "^\u00123.1415926535898×𝐢\u0013", &globalContext, &store);
assertCalculationIs("(-8)^(1/3)", ::Calculation::Calculation::DisplayOutput::ExactAndApproximate, ::Calculation::Calculation::EqualSign::Approximation, "2×^\u0012π/3×𝐢\u0013", nullptr, nullptr, &globalContext, &store);
assertCalculationIs("(-8)^(2/3)", ::Calculation::Calculation::DisplayOutput::ExactAndApproximate, ::Calculation::Calculation::EqualSign::Approximation, "4×^\u0012\u00122×π\u0013/3×𝐢\u0013", nullptr, nullptr, &globalContext, &store);
assertCalculationIs("(-2)^(1/4)", ::Calculation::Calculation::DisplayOutput::ExactAndApproximate, ::Calculation::Calculation::EqualSign::Approximation, "root(2,4)×^\u0012π/4×𝐢\u0013", nullptr, nullptr, &globalContext, &store);
assertCalculationIs("1+𝐢", DisplayOutput::ExactAndApproximate, EqualSign::Approximation, "√(2)×^\u0012π/4×𝐢\u0013", nullptr, nullptr, &globalContext, &store);
assertCalculationIs("√(-1)", DisplayOutput::ExactAndApproximate, EqualSign::Approximation, "^\u0012π/2×𝐢\u0013", nullptr, nullptr, &globalContext, &store);
assertCalculationIs("ln(-2)", DisplayOutput::ExactAndApproximate, EqualSign::Approximation, "ln(-2)", nullptr, nullptr, &globalContext, &store);
assertCalculationIs("√(-1)×√(-1)", DisplayOutput::ExactAndApproximate, EqualSign::Unknown, nullptr, "^\u00123.141593×𝐢\u0013", "^\u00123.1415926535898×𝐢\u0013", &globalContext, &store);
assertCalculationIs("(-8)^(1/3)", DisplayOutput::ExactAndApproximate, EqualSign::Approximation, "2×^\u0012π/3×𝐢\u0013", nullptr, nullptr, &globalContext, &store);
assertCalculationIs("(-8)^(2/3)", DisplayOutput::ExactAndApproximate, EqualSign::Approximation, "4×^\u0012\u00122×π\u0013/3×𝐢\u0013", nullptr, nullptr, &globalContext, &store);
assertCalculationIs("(-2)^(1/4)", DisplayOutput::ExactAndApproximate, EqualSign::Approximation, "root(2,4)×^\u0012π/4×𝐢\u0013", nullptr, nullptr, &globalContext, &store);
Poincare::Preferences::sharedPreferences()->setComplexFormat(Poincare::Preferences::ComplexFormat::Cartesian);
}

12
apps/clock_timer.cpp Normal file
View File

@@ -0,0 +1,12 @@
#include "clock_timer.h"
#include "apps_container.h"
ClockTimer::ClockTimer(AppsContainer * container) :
Timer(1),
m_container(container)
{
}
bool ClockTimer::fire() {
return m_container->updateClock();
}

16
apps/clock_timer.h Normal file
View File

@@ -0,0 +1,16 @@
#ifndef APPS_CLOCK_TIMER_H
#define APPS_CLOCK_TIMER_H
#include <escher.h>
class AppsContainer;
class ClockTimer : public Timer {
public:
ClockTimer(AppsContainer * container);
private:
bool fire() override;
AppsContainer * m_container;
};
#endif

View File

@@ -15,6 +15,7 @@ app_code_src = $(addprefix apps/code/,\
sandbox_controller.cpp \
script_name_cell.cpp \
script_parameter_controller.cpp \
toolbox_ion_keys.cpp \
)
app_code_test_src = $(addprefix apps/code/,\

View File

@@ -25,6 +25,7 @@ const Image * App::Descriptor::icon() {
App::Snapshot::Snapshot() :
#if EPSILON_GETOPT
m_lockOnConsole(false),
m_hasBeenWiped(false),
#endif
m_scriptStore()
{
@@ -49,10 +50,12 @@ bool App::Snapshot::lockOnConsole() const {
}
void App::Snapshot::setOpt(const char * name, const char * value) {
if (strcmp(name, "wipe") == 0) {
m_scriptStore.deleteAllScripts();
}
if (strcmp(name, "script") == 0) {
if (!m_hasBeenWiped) {
m_hasBeenWiped = true;
m_scriptStore.deleteAllScripts();
}
char * separator = const_cast<char *>(UTF8Helper::CodePointSearch(value, ':'));
if (*separator == 0) {
return;
@@ -86,16 +89,18 @@ App::App(Snapshot * snapshot) :
, snapshot->lockOnConsole()
#endif
),
m_listFooter(&m_codeStackViewController, &m_menuController, &m_menuController, ButtonRowController::Position::Bottom, ButtonRowController::Style::EmbossedGrey, ButtonRowController::Size::Large),
m_listFooter(&m_codeStackViewController, &m_menuController, &m_menuController, ButtonRowController::Position::Bottom, ButtonRowController::Style::EmbossedGray, ButtonRowController::Size::Large),
m_menuController(&m_listFooter, this, snapshot->scriptStore(), &m_listFooter),
m_codeStackViewController(&m_modalViewController, &m_listFooter),
m_variableBoxController(snapshot->scriptStore())
{
Clipboard::sharedClipboard()->enterPython();
}
App::~App() {
assert(!m_consoleController.inputRunLoopActive());
deinitPython();
Clipboard::sharedClipboard()->exitPython();
}
bool App::handleEvent(Ion::Events::Event event) {
@@ -119,6 +124,10 @@ Toolbox * App::toolboxForInputEventHandler(InputEventHandler * textInput) {
return &m_toolbox;
}
Code::toolboxIonKeys * App::toolboxIonKeys() {
return &m_toolboxIonKeys;
}
VariableBoxController * App::variableBoxForInputEventHandler(InputEventHandler * textInput) {
return &m_variableBoxController;
}

View File

@@ -9,6 +9,8 @@
#include "script_store.h"
#include "python_toolbox.h"
#include "variable_box_controller.h"
#include "../shared/shared_app.h"
#include "toolbox_ion_keys.h"
namespace Code {
@@ -21,7 +23,7 @@ public:
App::Descriptor::ExaminationLevel examinationLevel() override;
const Image * icon() override;
};
class Snapshot : public ::App::Snapshot {
class Snapshot : public SharedApp::Snapshot {
public:
Snapshot();
App * unpack(Container * container) override;
@@ -34,6 +36,7 @@ public:
private:
#if EPSILON_GETOPT
bool m_lockOnConsole;
bool m_hasBeenWiped;
#endif
ScriptStore m_scriptStore;
};
@@ -73,7 +76,9 @@ public:
VariableBoxController * variableBoxController() { return &m_variableBoxController; }
static constexpr int k_pythonHeapSize = 32768;
static constexpr int k_pythonHeapSize = 100000;
Code::toolboxIonKeys * toolboxIonKeys();
private:
/* Python delegate:
@@ -91,6 +96,7 @@ private:
StackViewController m_codeStackViewController;
PythonToolbox m_toolbox;
VariableBoxController m_variableBoxController;
Code::toolboxIonKeys m_toolboxIonKeys;
};
}

View File

@@ -12,4 +12,4 @@ ImportedModulesAndScripts = "Módulos y archivos importados"
NoWordAvailableHere = "No hay ninguna palabra disponible aquí."
ScriptInProgress = "Archivo en curso"
ScriptOptions = "Opciones del archivo"
ScriptSize = "Script size"
ScriptSize = "Tamaño del script"

View File

@@ -12,4 +12,4 @@ ImportedModulesAndScripts = "Modules et scripts importés"
NoWordAvailableHere = "Aucun mot disponible à cet endroit."
ScriptInProgress = "Script en cours"
ScriptOptions = "Options de script"
ScriptSize = "Script size"
ScriptSize = "Taille du script"

View File

@@ -1,15 +1,15 @@
AddScript = "Script hozzadáadása"
AddScript = "Script hozzáadása"
AllowedCharactersaz09 = "Engedélyezett karakterek: a-z, 0-9, _"
Autocomplete = "Autocomplete"
Autocomplete = "Önkiegészítés"
AutoImportScript = "Script automata importálása"
BuiltinsAndKeywords = "Builtins and keywords"
BuiltinsAndKeywords = "Beépített fonkciók és szókincs"
Console = "Konzol"
DeleteScript = "Script törlése"
DuplicateScript = "Script másolása"
ExecuteScript = "Script indítása"
FunctionsAndVariables = "Függvények és változók"
ImportedModulesAndScripts = "Imported modules and scripts"
NoWordAvailableHere = "No word available here."
ScriptInProgress = "Script in progress"
FunctionsAndVariables = "Fonktiók és változók"
ImportedModulesAndScripts = "Importált scriptek és modulok"
NoWordAvailableHere = "Nincs rendelkezésre álló szó."
ScriptInProgress = "Script müködésben"
ScriptOptions = "Script beállítások"
ScriptSize = "Script size"
ScriptSize = "Script mérete"

View File

@@ -1,7 +1,7 @@
AddScript = "Aggiungere script"
AllowedCharactersaz09 = "Caratteri consentiti : a-z, 0-9, _"
Autocomplete = "Autocompletamento"
AutoImportScript = "Importazione automatica dello script"
AutoImportScript = "Auto importazione nella console"
BuiltinsAndKeywords = "Funzioni native e parole chiave"
Console = "Console d'esecuzione"
DeleteScript = "Eliminare lo script"

View File

@@ -30,8 +30,8 @@ PythonColor = "Definiere eine RGB-Farbe"
PythonColorBlack = "Black color"
PythonColorBlue = "Blue color"
PythonColorBrown = "Brown color"
PythonColorGray = "Gray color"
PythonColorGreen = "Green color"
PythonColorGrey = "Grey color"
PythonColorOrange = "Orange color"
PythonColorPink = "Pink color"
PythonColorPurple = "Purple color"
@@ -45,6 +45,7 @@ PythonCosh = "Hyperbolic cosine"
PythonCount = "Zählt wie oft x vorkommt"
PythonDegrees = "x von Radian zu Grad umwandeln"
PythonDivMod = "Quotient und Rest"
PythonDrawLine = "Draw a line"
PythonDrawString = "Schreibt Text bei (x,y)"
PythonErf = "Fehlerfunktion"
PythonErfc = "Complementary error function"
@@ -69,6 +70,11 @@ PythonImportKandinsky = "kandinsky Modul importieren"
PythonImportRandom = "random Modul importieren"
PythonImportMath = "math Modul importieren"
PythonImportMatplotlibPyplot = "Import matplotlib.pyplot module"
PythonImportOs = "os Modul importieren"
PythonOsUname = "Informieren Sie sich über das System"
PythonOsRemove = "Datei namens Dateiname entfernen"
PythonOsRename = "Datei mit altem Namen in neuen Namen umbenennen"
PythonOsListdir = "Dateien im Speicher auflisten"
PythonImportTime = "time Modul importieren"
PythonImportTurtle = "turtle Modul importieren"
PythonIndex = "Index, bei dem x zuerst vorkommt"
@@ -81,52 +87,6 @@ PythonIsInfinite = "Prüft ob x unendlich ist"
PythonIsNaN = "Prüft ob x NaN ist"
PythonIsKeyDown = "true wenn k gedrückt ist"
PythonKandinskyFunction = "kandinsky module function prefix"
PythonKeyLeft = "Linke Pfeiltaste"
PythonKeyUp = "Pfeiltaste nach oben"
PythonKeyDown = "Pfeiltaste nach unten"
PythonKeyRight = "Rechte Pfeiltaste"
PythonKeyOk = "OK Taste"
PythonKeyBack = "ZURÜCK Taste"
PythonKeyHome = "HOME Taste"
PythonKeyOnOff = "AN/AUS Taste"
PythonKeyShift = "SHIFT Taste"
PythonKeyAlpha = "ALPHA Taste"
PythonKeyXnt = "X,N,T Taste"
PythonKeyVar = "VAR Taste"
PythonKeyToolbox = "WERKZEUGBOX Taste"
PythonKeyBackspace = "LÖSCHEN Taste"
PythonKeyExp = "EXPONENTIAL Taste"
PythonKeyLn = "NATURAL LOGARITHM Taste"
PythonKeyLog = "DECIMAL LOGARITHM Taste"
PythonKeyImaginary = "IMAGINÄRES I Taste"
PythonKeyComma = "KOMMA Taste"
PythonKeyPower = "HOCH Taste"
PythonKeySine = "SINUS Taste"
PythonKeyCosine = "COSINUS Taste"
PythonKeyTangent = "TANGENZ Taste"
PythonKeyPi = "PI Taste"
PythonKeySqrt = "WURZEL Taste"
PythonKeySquare = "QUADRAT Taste"
PythonKeySeven = "7 Taste"
PythonKeyEight = "8 Taste"
PythonKeyNine = "9 Taste"
PythonKeyLeftParenthesis = "LEFT PARENTHESIS key"
PythonKeyRightParenthesis = "RIGHT PARENTHESIS key"
PythonKeyFour = "4 Taste"
PythonKeyFive = "5 Taste"
PythonKeySix = "6 Taste"
PythonKeyMultiplication = "MULTIPLIKATIONSTASTE"
PythonKeyDivision = "DIVISIONSTASTE"
PythonKeyOne = "1 Taste"
PythonKeyTwo = "2 Taste"
PythonKeyThree = "3 Taste"
PythonKeyPlus = "PLUS Taste"
PythonKeyMinus = "MINUS Taste"
PythonKeyZero = "0 Taste"
PythonKeyDot = "PUNKT Taste"
PythonKeyEe = "10 HOCH X Taste"
PythonKeyAns = "ANS Taste"
PythonKeyExe = "EXE Taste"
PythonLdexp = "Return x*(2**i), inverse of frexp"
PythonLength = "Length of an object"
PythonLgamma = "Log-gamma function"

View File

@@ -1,7 +1,7 @@
PythonPound = "Comment"
PythonPercent = "Modulo"
Python1J = "Imaginary i"
PythonLF = "line feed"
PythonLF = "Line feed"
PythonTab = "Tabulation"
PythonAmpersand = "Bitwise and"
PythonSymbolExp = "Bitwise exclusive or"
@@ -30,8 +30,8 @@ PythonColor = "Define a rgb color"
PythonColorBlack = "Black color"
PythonColorBlue = "Blue color"
PythonColorBrown = "Brown color"
PythonColorGray = "Gray color"
PythonColorGreen = "Green color"
PythonColorGrey = "Grey color"
PythonColorOrange = "Orange color"
PythonColorPink = "Pink color"
PythonColorPurple = "Purple color"
@@ -45,6 +45,7 @@ PythonCosh = "Hyperbolic cosine"
PythonCount = "Count the occurrences of x"
PythonDegrees = "Convert x from radians to degrees"
PythonDivMod = "Quotient and remainder"
PythonDrawLine = "Draw a line"
PythonDrawString = "Display a text from pixel (x,y)"
PythonErf = "Error function"
PythonErfc = "Complementary error function"
@@ -81,52 +82,6 @@ PythonIsInfinite = "Check if x is infinity"
PythonIsKeyDown = "Return True if the k key is down"
PythonIsNaN = "Check if x is a NaN"
PythonKandinskyFunction = "kandinsky module function prefix"
PythonKeyLeft = "LEFT ARROW key"
PythonKeyUp = "UP ARROW key"
PythonKeyDown = "DOWN ARROW key"
PythonKeyRight = "RIGHT ARROW key"
PythonKeyOk = "OK key"
PythonKeyBack = "BACK key"
PythonKeyHome = "HOME key"
PythonKeyOnOff = "ON/OFF key"
PythonKeyShift = "SHIFT key"
PythonKeyAlpha = "ALPHA key"
PythonKeyXnt = "X,N,T key"
PythonKeyVar = "VAR key"
PythonKeyToolbox = "TOOLBOX key"
PythonKeyBackspace = "BACKSPACE key"
PythonKeyExp = "EXPONENTIAL key"
PythonKeyLn = "NATURAL LOGARITHM key"
PythonKeyLog = "DECIMAL LOGARITHM key"
PythonKeyImaginary = "IMAGINARY I key"
PythonKeyComma = "COMMA key"
PythonKeyPower = "POWER key"
PythonKeySine = "SINE key"
PythonKeyCosine = "COSINE key"
PythonKeyTangent = "TANGENT key"
PythonKeyPi = "PI key"
PythonKeySqrt = "SQUARE ROOT key"
PythonKeySquare = "SQUARE key"
PythonKeySeven = "7 key"
PythonKeyEight = "8 key"
PythonKeyNine = "9 key"
PythonKeyLeftParenthesis = "LEFT PARENTHESIS key"
PythonKeyRightParenthesis = "RIGHT PARENTHESIS key"
PythonKeyFour = "4 key"
PythonKeyFive = "5 key"
PythonKeySix = "6 key"
PythonKeyMultiplication = "MULTIPLICATION key"
PythonKeyDivision = "DIVISION key"
PythonKeyOne = "1 key"
PythonKeyTwo = "2 key"
PythonKeyThree = "3 key"
PythonKeyPlus = "PLUS key"
PythonKeyMinus = "MINUS key"
PythonKeyZero = "0 key"
PythonKeyDot = "DOT key"
PythonKeyEe = "10 POWER X key"
PythonKeyAns = "ANS key"
PythonKeyExe = "EXE key"
PythonLdexp = "Return x*(2**i), inverse of frexp"
PythonLength = "Length of an object"
PythonLgamma = "Log-gamma function"
@@ -196,6 +151,11 @@ PythonTurtleSpeed = "Drawing speed between 0 and 10"
PythonTurtleWrite = "Display a text"
PythonUniform = "Floating point number in [a,b]"
PythonImportTime = "Import time module"
PythonImportOs = "Import os module"
PythonOsUname = "Get infos about the system"
PythonOsRemove = "Remove file named filename"
PythonOsRename = "Rename file oldname to newname"
PythonOsListdir = "List files in memory"
PythonTimePrefix = "time module function prefix"
PythonTimeSleep = "Wait for n second"
PythonMonotonic = "Return monotonic time"

View File

@@ -30,8 +30,8 @@ PythonColor = "Define a rgb color"
PythonColorBlack = "Black color"
PythonColorBlue = "Blue color"
PythonColorBrown = "Brown color"
PythonColorGray = "Gray color"
PythonColorGreen = "Green color"
PythonColorGrey = "Grey color"
PythonColorOrange = "Orange color"
PythonColorPink = "Pink color"
PythonColorPurple = "Purple color"
@@ -45,6 +45,7 @@ PythonCosh = "Hyperbolic cosine"
PythonCount = "Count the occurrences of x"
PythonDegrees = "Convert x from radians to degrees"
PythonDivMod = "Quotient and remainder"
PythonDrawLine = "Draw a line"
PythonDrawString = "Display a text from pixel (x,y)"
PythonErf = "Error function"
PythonErfc = "Complementary error function"
@@ -81,52 +82,6 @@ PythonIsInfinite = "Check if x is infinity"
PythonIsKeyDown = "Return True if the k key is down"
PythonIsNaN = "Check if x is a NaN"
PythonKandinskyFunction = "kandinsky module function prefix"
PythonKeyLeft = "LEFT ARROW key"
PythonKeyUp = "UP ARROW key"
PythonKeyDown = "DOWN ARROW key"
PythonKeyRight = "RIGHT ARROW key"
PythonKeyOk = "OK key"
PythonKeyBack = "BACK key"
PythonKeyHome = "HOME key"
PythonKeyOnOff = "ON/OFF key"
PythonKeyShift = "SHIFT key"
PythonKeyAlpha = "ALPHA key"
PythonKeyXnt = "X,N,T key"
PythonKeyVar = "VAR key"
PythonKeyToolbox = "TOOLBOX key"
PythonKeyBackspace = "BACKSPACE key"
PythonKeyExp = "EXPONENTIAL key"
PythonKeyLn = "NATURAL LOGARITHM key"
PythonKeyLog = "DECIMAL LOGARITHM key"
PythonKeyImaginary = "IMAGINARY I key"
PythonKeyComma = "COMMA key"
PythonKeyPower = "POWER key"
PythonKeySine = "SINE key"
PythonKeyCosine = "COSINE key"
PythonKeyTangent = "TANGENT key"
PythonKeyPi = "PI key"
PythonKeySqrt = "SQUARE ROOT key"
PythonKeySquare = "SQUARE key"
PythonKeySeven = "7 key"
PythonKeyEight = "8 key"
PythonKeyNine = "9 key"
PythonKeyLeftParenthesis = "LEFT PARENTHESIS key"
PythonKeyRightParenthesis = "RIGHT PARENTHESIS key"
PythonKeyFour = "4 key"
PythonKeyFive = "5 key"
PythonKeySix = "6 key"
PythonKeyMultiplication = "MULTIPLICATION key"
PythonKeyDivision = "DIVISION key"
PythonKeyOne = "1 key"
PythonKeyTwo = "2 key"
PythonKeyThree = "3 key"
PythonKeyPlus = "PLUS key"
PythonKeyMinus = "MINUS key"
PythonKeyZero = "0 key"
PythonKeyDot = "DOT key"
PythonKeyEe = "10 POWER X key"
PythonKeyAns = "ANS key"
PythonKeyExe = "EXE key"
PythonLdexp = "Return x*(2**i), inverse of frexp"
PythonLength = "Length of an object"
PythonLgamma = "Log-gamma function"
@@ -196,6 +151,11 @@ PythonTurtleSpeed = "Drawing speed between 0 and 10"
PythonTurtleWrite = "Display a text"
PythonUniform = "Floating point number in [a,b]"
PythonImportTime = "Import time module"
PythonImportOs = "Import os module"
PythonOsUname = " Información del sistema "
PythonOsRemove = "Eliminar un archivo"
PythonOsRename = "Renombrar archivo"
PythonOsListdir = "Archivos de la lista"
PythonTimePrefix = "time module function prefix"
PythonTimeSleep = "Esperar n segundos"
PythonMonotonic = "Tiempo monótono de retorno"

View File

@@ -30,8 +30,8 @@ PythonColor = "Définit une couleur rvb"
PythonColorBlack = "Couleur noire"
PythonColorBlue = "Couleur bleue"
PythonColorBrown = "Couleur marron"
PythonColorGray = "Couleur grise"
PythonColorGreen = "Couleur verte"
PythonColorGrey = "Couleur grise"
PythonColorOrange = "Couleur orange"
PythonColorPink = "Couleur rose"
PythonColorPurple = "Couleur violette"
@@ -45,6 +45,7 @@ PythonCosh = "Cosinus hyperbolique"
PythonCount = "Compte les occurrences de x"
PythonDegrees = "Conversion de radians en degrés"
PythonDivMod = "Quotient et reste"
PythonDrawLine = "Trace une ligne"
PythonDrawString = "Affiche un texte au pixel (x,y)"
PythonErf = "Fonction d'erreur"
PythonErfc = "Fonction d'erreur complémentaire"
@@ -81,52 +82,6 @@ PythonIsInfinite = "Teste si x est infini"
PythonIsKeyDown = "Renvoie True si touche k enfoncée"
PythonIsNaN = "Teste si x est NaN"
PythonKandinskyFunction = "Préfixe fonction module kandinsky"
PythonKeyLeft = "Touche FLECHE GAUCHE"
PythonKeyUp = "Touche FLECHE HAUT"
PythonKeyDown = "Touche FLECHE BAS"
PythonKeyRight = "Touche FLECHE DROITE"
PythonKeyOk = "Touche OK"
PythonKeyBack = "Touche RETOUR"
PythonKeyHome = "Touche HOME"
PythonKeyOnOff = "Touche ON/OFF"
PythonKeyShift = "Touche SHIFT"
PythonKeyAlpha = "Touche ALPHA"
PythonKeyXnt = "Touche X,N,T"
PythonKeyVar = "Touche VAR"
PythonKeyToolbox = "Touche BOITE A OUTILS"
PythonKeyBackspace = "Touche EFFACER"
PythonKeyExp = "Touche EXPONENTIELLE"
PythonKeyLn = "Touche LOGARITHME NEPERIEN"
PythonKeyLog = "Touche LOGARITHME DECIMAL"
PythonKeyImaginary = "Touche I IMAGINAIRE"
PythonKeyComma = "Touche VIRGULE"
PythonKeyPower = "Touche PUISSANCE"
PythonKeySine = "Touche SINUS"
PythonKeyCosine = "Touche COSINUS"
PythonKeyTangent = "Touche TANGENTE"
PythonKeyPi = "Touche PI"
PythonKeySqrt = "Touche RACINE CARREE"
PythonKeySquare = "Touche CARRE"
PythonKeySeven = "Touche 7"
PythonKeyEight = "Touche 8"
PythonKeyNine = "Touche 9"
PythonKeyLeftParenthesis = "Touche PARENTHESE GAUCHE"
PythonKeyRightParenthesis = "Touche PARENTHESE DROITE"
PythonKeyFour = "Touche 4"
PythonKeyFive = "Touche 5"
PythonKeySix = "Touche 6"
PythonKeyMultiplication = "Touche MULTIPLICATION"
PythonKeyDivision = "Touche DIVISION"
PythonKeyOne = "Touche 1"
PythonKeyTwo = "Touche 2"
PythonKeyThree = "Touche 3"
PythonKeyPlus = "Touche PLUS"
PythonKeyMinus = "Touche MOINS"
PythonKeyZero = "Touche 0"
PythonKeyDot = "Touche POINT"
PythonKeyEe = "Touche 10 PUISSANCE X"
PythonKeyAns = "Touche ANS"
PythonKeyExe = "Touche EXE"
PythonLdexp = "Inverse de frexp : x*(2**i)"
PythonLength = "Longueur d'un objet"
PythonLgamma = "Logarithme de la fonction gamma"
@@ -196,21 +151,26 @@ PythonTurtleSpeed = "Vitesse du tracé entre 0 et 10"
PythonTurtleWrite = "Affiche un texte"
PythonUniform = "Nombre décimal dans [a,b]"
PythonImportTime = "Importation du module temps"
PythonImportOs = "Importation du module os"
PythonOsUname = "Donne des infos sur le système"
PythonOsRemove = "Supprime le fichier nommé filename"
PythonOsRename = "Renomme oldname en newname"
PythonOsListdir = "Liste les fichiers"
PythonTimePrefix = "Préfixe fonction du module temps"
PythonTimeSleep = "Attendre n secondes"
PythonMonotonic = "Retourne le temps monotonic"
PythonMonotonic = "Retourne le temps monotone"
PythonFileOpen = "Ouvre un fichier"
PythonFileSeekable = "Indique si seek peut être utilisé"
PythonFileSeek = "Déplace le curseur interne"
PythonFileTell = "Donne la posititon du curseur"
PythonFileClose = "Ferme un fichier"
PythonFileClosed = "True si le fichier a été fermé"
PythonFileRead = "Lis jusqu'à size bytes"
PythonFileWrite = "Écris b dans le fichier"
PythonFileReadline = "Lis une ligne ou jusqu'à size bytes"
PythonFileReadlines = "Lis une liste de lignes"
PythonFileRead = "Lit jusqu'à size bytes"
PythonFileWrite = "Écrit b dans le fichier"
PythonFileReadline = "Lit une ligne ou jusqu'à size bytes"
PythonFileReadlines = "Lit une liste de lignes"
PythonFileTruncate = "Redimensionne le fichier"
PythonFileWritelines = "Écris une liste de lignes"
PythonFileWritelines = "Écrit une liste de lignes"
PythonFileName = "Nom du fichier"
PythonFileMode = "Mode d'ouverture du fichier"
PythonFileReadable = "Indique si read peut être utilisé"

View File

@@ -1,217 +1,177 @@
PythonPound = "Megjegyzés"
PythonPercent = "Modulo"
Python1J = "Képzeletbeli i"
PythonLF = "Line feed"
PythonLF = "Enter"
PythonTab = "Táblázat"
PythonAmpersand = "Bitwise és"
PythonSymbolExp = "Bitwise exkluzív vagy"
PythonVerticalBar = "Bitwise vagy"
PythonAmpersand = "Logikus és"
PythonSymbolExp = "logikus exkluzív vagy pedig"
PythonVerticalBar = "logikus vagy pedig"
PythonImag = "z képzeletbeli része"
PythonReal = "z valódi része"
PythonSingleQuote = "Egyetlen idézet"
PythonAbs = "Abszolút érték / nagyság"
PythonAcos = "Arc koszinusz"
PythonAcosh = "Íves hiperbolikus koszinusz"
PythonAppend = "x hozzáadása a lista végéhez"
PythonArrow = "Arrow from (x,y) to (x+dx,y+dy)"
PythonAsin = "Arc szinusz"
PythonAsinh = "Íves hiperbolikus szinusz"
PythonAtan = "Arc érintö"
PythonAtan2 = "Visszatérés atan (y / x)"
PythonAtanh = "Arc hiperbolikus érintö"
PythonAxis = "Set axes to (xmin,xmax,ymin,ymax)"
PythonBar = "Draw a bar plot with x values"
PythonSingleQuote = "apostróf"
PythonAbs = "Abszolút érték/nagyság"
PythonAcos = "Ív (arc) koszinusz"
PythonAcosh = "Hiperbolikus arc koszinusz"
PythonAppend = "Lista végére hozzáadni x-et"
PythonArrow = "(x,y) nyíla (x+dx,y+dy) nyílához"
PythonAsin = "Ív (arc) szinusz"
PythonAsinh = "Hiperbolikus ív (arc) szinusz"
PythonAtan = "Ív (arc) érintö (tan)"
PythonAtan2 = "atan(y/x) sámolása"
PythonAtanh = "Hiperbolikus ív (arc) érintö (atan)"
PythonAxis = "Tengelyeket (xmin,xmax,ymin,ymax)-ra állitani"
PythonBar = "Az x lista oszlopdiagramja"
PythonBin = "Egész szám konvertálása binárisra"
PythonCeil = "Mennyezet"
PythonChoice = "Véletlenszerü szám a listában"
PythonClear = "A lista ürítése"
PythonCmathFunction = "cmath modul funkció elötag"
PythonColor = "Rgb szín meghatározása"
PythonColor = "Rgb (pzk) szín allítása"
PythonColorBlack = "Fekete szín"
PythonColorBlue = "Kék szín"
PythonColorBrown = "Barna szín"
PythonColorGreen = "Zöld szín"
PythonColorGrey = "Szürke szín"
PythonColorGray = "Szürke szín"
PythonColorOrange = "Narancssárga szín"
PythonColorPink = "Rózsaszín szín"
PythonColorPurple = "Lila szín"
PythonColorRed = "Piros szín"
PythonColorWhite = "White color"
PythonColorWhite = "Fehér szín"
PythonColorYellow = "Sárga szín"
PythonComplex = "A + ib visszaadása"
PythonCopySign = "Visszatérés x-val y jelével"
PythonCopySign = "X visszaadása y jelével"
PythonCos = "Koszinusz"
PythonCosh = "Hiperbolikus koszinusz"
PythonCount = "Számolja az x elöfordulását"
PythonDegrees = "x konvertálása x-röl radiánokra fokokra"
PythonDegrees = "x konvertálása radiánokrol fokokra"
PythonDivMod = "Hányados és maradék"
PythonDrawString = "Szöveg megjelenítése pixelböl (x, y)"
PythonDrawLine = "Húzzon egy vonalat "
PythonDrawString = "Szöveg megjelenítése (x, y)-en"
PythonErf = "Hiba funkció"
PythonErfc = "Kiegészítö hibafunkció"
PythonErfc = "Kiegészítö hiba funkció"
PythonEval = "Visszaadja az értékelt kifejezést"
PythonExp = "Exponenciális függvény"
PythonExpm1 = "Számítsuk ki az exp (x) -1-et"
PythonExpm1 = "exp(x)-1 sámitása"
PythonFabs = "Abszolút érték"
PythonFillRect = "Töltsön meg egy téglalapot pixelnél (x, y)"
PythonFloat = "x konvertálása float-ra"
PythonFloor = "Emelet"
PythonFillRect = "Téglalap töltése"
PythonFloat = "Konvertálása tizedes számra"
PythonFloor = "Egész része"
PythonFmod = "a modulo b"
PythonFrExp = "Mantissa és az x exponense"
PythonFrExp = "X mantissája és kiállítója"
PythonGamma = "Gamma funkció"
PythonGetPixel = "Visszatérési pixel (x, y) szín"
PythonGetrandbits = "Egész szám k véletlen bittel"
PythonGrid = "Toggle the visibility of the grid"
PythonHex = "Egész szám konvertálása hexadecimálisra"
PythonHist = "Draw the histogram of x"
PythonGetPixel = "Visszatéríti (x,y) színét"
PythonGetrandbits = "Váletlenszám visszatérítése k biten"
PythonGrid = "Rács megjelenítése/elrejtése"
PythonHex = "Decimális szám konvertálása hexadecimális számra"
PythonHist = "x hisztográmiája"
PythonImportCmath = "cmath modul importálása"
PythonImportIon = "Ion modul importálása"
PythonImportKandinsky = "Kandinsky modul importálása"
PythonImportRandom = "Véletlenszerü modul importálása"
PythonImportMath = "Import matematikai modul"
PythonImportMatplotlibPyplot = "Import matplotlib.pyplot module"
PythonImportTime = "Idömodul importálása"
PythonImportTurtle = "Import teknös modul"
PythonImportMath = "math modul importálása"
PythonImportMatplotlibPyplot = "matplotlib.pyplot modul importálása"
PythonImportTurtle = "turtle modul importálása"
PythonImportTime = "time modul importálása"
PythonIndex = "Az elsö x esemény indexe"
PythonInput = "Érték kérése"
PythonInsert = "Helyezzen x-t az i indexbe a listában"
PythonInt = "x konvertálása egész számra"
PythonInput = "Irjon egy értéket (számot)"
PythonInsert = "x-et i. pozícióra helyezze a listában"
PythonInt = "egész számra konvertálás"
PythonIonFunction = "ion modul funkció elötag"
PythonIsFinite = "Ellenörizze, hogy x véges-e"
PythonIsInfinite = "Ellenörizze, hogy x végtelen-e"
PythonIsKeyDown = "True true, ha a k gomb le van nyomva"
PythonIsNaN = "Ellenörizze, hogy x nem NaN"
PythonKandinskyFunction = "kandinsky modul function prefix"
PythonKeyLeft = "Balra nyíl gomb"
PythonKeyUp = "FEL NYÍL gomb"
PythonKeyDown = "LE nyíl gomb"
PythonKeyRight = "JOBB NYÍL gomb"
PythonKeyOk = "OK gomb"
PythonKeyBack = "VISSZA kulcs"
PythonKeyHome = "HOME kulcs"
PythonKeyOnOff = "BE / KI gomb"
PythonKeyShift = "SHIFT kulcs"
PythonKeyAlpha = "ALPHA kulcs"
PythonKeyXnt = "X, N, T kulcs"
PythonKeyVar = "VAR kulcs"
PythonKeyToolbox = "TOOLBOX kulcs"
PythonKeyBackspace = "BACKSPACE kulcs"
PythonKeyExp = "EXPONENTIAL kulcs"
PythonKeyLn = "NATURAL LOGARITHM kulcs"
PythonKeyLog = "DECIMAL LOGARITHM kulcs"
PythonKeyImaginary = "IMAGINÁRIS I kulcs"
PythonKeyComma = "COMMA kulcs"
PythonKeyPower = "POWER kulcs"
PythonKeySine = "SINE kulcs"
PythonKeyCosine = "KOSZIN kulcs"
PythonKeyTangent = "TANGENT kulcs"
PythonKeyPi = "PI kulcs"
PythonKeySqrt = "SQUARE ROOT kulcs"
PythonKeySquare = "SQUARE kulcs"
PythonKeySeven = "7 kulcs"
PythonKeyEight = "8 kulcs"
PythonKeyNine = "9 kulcs"
PythonKeyLeftParenthesis = "Bal oldali PARENTHESIS kulcs"
PythonKeyRightParenthesis = "JOGOS SZÜLETÉS kulcs"
PythonKeyFour = "4 kulcs"
PythonKeyFive = "5 kulcs"
PythonKeySix = "6 kulcs"
PythonKeyMultiplication = "TÖBB MüKÖDÉS kulcs"
PythonKeyDivision = "DIVISION kulcs"
PythonKeyOne = "1 kulcs"
PythonKeyTwo = "2 kulcs"
PythonKeyThree = "3 kulcs"
PythonKeyPlus = "PLUS kulcs"
PythonKeyMinus = "MINUS kulcs"
PythonKeyZero = "0 kulcs"
PythonKeyDot = "DOT kulcs"
PythonKeyEe = "10 POWER X kulcs"
PythonKeyAns = "ANS kulcs"
PythonKeyExe = "EXE kulcs"
PythonLdexp = "Visszatérés x * (2 ** i), inverz a frexp értékhez"
PythonLength = "Objektum hossza"
PythonLgamma = "Log-gamma funkció"
PythonLog = "Logaritmus az alap"
PythonLog10 = "Logaritmus az alaphoz 10"
PythonLog2 = "Logaritmus az alaphoz 2"
PythonMathFunction = "matematikai modul funkció elötag"
PythonMatplotlibPyplotFunction = "matplotlib.pyplot module prefix"
PythonIsFinite = "x véges-e"
PythonIsInfinite = "x végtelen-e"
PythonIsKeyDown = "True-t válaszol ha a k gomb le van nyomva"
PythonIsNaN = "Ellenörizze hogy x nem NaN"
PythonKandinskyFunction = "kandinsky modul funkció elötag"
PythonLdexp = "frexp ellentéte : x*(2**i)"
PythonLength = "Egy targy hossza"
PythonLgamma = "Gamma funkció logaritmusa"
PythonLog = "a alapú logaritmus"
PythonLog10 = "Decimális logaritmus"
PythonLog2 = "Bináris logaritmus"
PythonMathFunction = "math modul funkció elötag"
PythonMatplotlibPyplotFunction = "matplotlib.pyplot elötag"
PythonMax = "Maximum"
PythonMin = "Minimum"
PythonModf = "Az x tört és egész részei"
PythonMonotonic = "A monoton óra értéke"
PythonOct = "Egész szám konvertálása oktális értékre"
PythonPhase = "z fázis"
PythonPlot = "Plot y versus x as lines"
PythonPolar = "z poláris koordinátákban"
PythonPop = "Az utolsó elem eltávolítása és visszaküldése"
PythonPower = "x emelve az y teljesítményre"
PythonPrint = "Objektum nyomtatása"
PythonRadians = "x konvertálása x fokról radiánra"
PythonRandint = "Véletlen egész szám [a, b] -ben"
PythonRandom = "Lebegöpontos szám [0,1-ben ["
PythonRandomFunction = "véletlenszerü modul funkció elötag"
PythonRandrange = "Véletlen szám a tartományban (start, stop)"
PythonRangeStartStop = "Lista az elejétöl a stop-1-ig"
PythonRangeStop = "Lista 0-tól stop-1-ig"
PythonRect = "z derékszögü koordinátákban"
PythonRemove = "Távolítsa el az x elsö elöfordulását"
PythonReverse = "A lista elemeinek megfordítása"
PythonRound = "N számjegyre kerekítve"
PythonScatter = "Draw a scatter plot of y versus x"
PythonSeed = "Inicializálja a véletlenszám-generátort"
PythonSetPixel = "Színes pixel (x, y)"
PythonShow = "Display the figure"
PythonSin = "Sine"
PythonModf = "x-nek tört és egész részei"
PythonMonotonic = "Az óra értékét adja vissza"
PythonOct = "Decimális szám konvertálása octális számra"
PythonPhase = "z fázisa"
PythonPlot = "y-t jelöli x függvényében"
PythonPolar = "Verctorizálni"
PythonPop = "Az utolsó elemet el törölni"
PythonPower = "x y. kitevö"
PythonPrint = "Ki irni a elemeket"
PythonRadians = "Fokról radiánra konvertálni"
PythonRandint = "Véletlen egész szám [a;b] -ban"
PythonRandom = "Decimális szám [0;1] -ban"
PythonRandomFunction = "random modul funkció elötag"
PythonRandrange = "Véletlen szám range(start,stop)-ban"
PythonRangeStartStop = "start-tol stop-ig listája"
PythonRangeStop = "0 tol stop-ig lista"
PythonRect = "Algebrai számra konvertálni"
PythonRemove = "Elsö x elöfordulását törolni"
PythonReverse = "A lista elemeit megfordítani (másik irány)"
PythonRound = "N számjegyre kerekítni"
PythonScatter = "(x,y) halmaza"
PythonSeed = "Inicializálni a véletlenszám-választót"
PythonSetPixel = "Az (x,y) pixel-t ki szinezni"
PythonShow = "Mutassa az ábrát"
PythonSin = "Szinusz"
PythonSinh = "Hiperbolikus szinusz"
PythonSleep = "A végrehajtás felfüggesztése t másodpercre"
PythonSort = "A lista rendezése"
PythonSleep = "t másodpercre meg állitani a programmot"
PythonSort = "A listát rendezni"
PythonSqrt = "Négyzetgyök"
PythonSum = "Összegzi a lista elemeit"
PythonTan = "Érintö"
PythonTanh = "Hiperbolikus érintö"
PythonText = "Display a text at (x,y) coordinates"
PythonTimeFunction = "idömodul funkció elötag"
PythonTrunc = "x egészre csonkítva"
PythonTurtleBackward = "Visszalépés x pixelrel"
PythonTurtleCircle = "r pixel sugarú kör"
PythonTurtleColor = "Állítsa be az toll színét"
PythonTurtleColorMode = "Set the color mode to 1.0 or 255"
PythonTurtleForward = "Ugrás x pixelrel"
PythonTurtleFunction = "teknös modul funkció elötag"
PythonTurtleGoto = "Mozgatás (x, y) koordinátákra"
PythonTurtleHeading = "Visszaadja az aktuális címsort"
PythonSum = "Összeadni a lista elemeit"
PythonTan = "Érintö (tan)"
PythonTanh = "Hiperbolikus érintö (tan)"
PythonText = "(x,y) nél egy szöveget irni"
PythonTimeFunction = "time funkció elötag"
PythonTrunc = "Egész csonka (?)"
PythonTurtleBackward = "x pixelt hátra"
PythonTurtleCircle = "r pixel sugarú kört rajzolni"
PythonTurtleColor = "Toll szinét beállitani"
PythonTurtleColorMode = "Szin módot 1.0-ra vagy 255-ra állitani"
PythonTurtleForward = "x pixelt elölre"
PythonTurtleFunction = "turtle modul funkció elötag"
PythonTurtleGoto = "Menjen a (x,y) koordinátákra"
PythonTurtleHeading = "Visszaadja az aktuális irányt"
PythonTurtleHideturtle = "A teknös elrejtése"
PythonTurtleIsdown = "Visszatérés igazhoz, ha az toll lefelé"
PythonTurtleLeft = "Forduljon fokkal balra"
PythonTurtleIsdown = "True-t válaszol ha a toll irás pozícióban van"
PythonTurtleLeft = "a fokkot forduljon balra"
PythonTurtlePendown = "Húzza le a tollat"
PythonTurtlePensize = "Állítsa a vonalvastagságot x pixelre"
PythonTurtlePenup = "Húzza fel a tollat"
PythonTurtlePosition = "Az aktuális (x, y) hely visszaadása"
PythonTurtleReset = "A rajz visszaállítása"
PythonTurtleRight = "Forduljon fokkal jobbra"
PythonTurtleSetheading = "Állítsa be a tájolást fokokra"
PythonTurtleSetposition = "A helymeghatározás"
PythonTurtleShowturtle = "Mutasd a teknösöt"
PythonTurtlePosition = "Az aktuális (x,y) pozíciót visszaadása"
PythonTurtleReset = "Visszaállitani a rajzot (torléssel)"
PythonTurtleRight = "a fokkot forduljon jobbra"
PythonTurtleSetheading = "a fokokra állítja be az irányt"
PythonTurtleSetposition = "A teknös pozicioját allitja"
PythonTurtleShowturtle = "A teknöst meg mutatni"
PythonTurtleSpeed = "Rajzolási sebesség 0 és 10 között"
PythonTurtleWrite = "Display a text"
PythonUniform = "Lebegöpontos szám [a, b] -ben"
PythonImportTime = "Idömodul importálása"
PythonTimePrefix = "idömodul funkció elötag"
PythonTimeSleep = "Várj n másodpercet"
PythonMonotonic = "Vissza a monoton idö"
PythonTurtleWrite = "Szöveg irás"
PythonUniform = "Lebegöpontos szám [a,b] -ban"
PythonImportTime = "time modul importálása"
PythonTimePrefix = "time funkció elötag"
PythonTimeSleep = "n másodpercet várni"
PythonMonotonic = "Meg fordítani a monoton idö"
PythonFileOpen = "Fájl megnyitása"
PythonFileSeekable = "A fájl kereshető?"
PythonFileSeek = "A fájl kurzorának áthelyezése"
PythonFileTell = "A fájl kurzorának helye"
PythonFileClose = "Bezár egy fájlt"
PythonFileClosed = "Igaz, ha a fájl bezárt"
PythonFileRead = "Olvasson méretbájtig"
PythonFileWrite = "B beírása fájlba"
PythonFileReadline = "Olvas egy sort"
PythonFileReadlines = "Olvassa a sorok listáját"
PythonFileTruncate = "A fájl átméretezése méretre"
PythonFileWritelines = "Sorok listáját írja"
PythonFileName = "a fájl neve"
PythonFileMode = "a fájl nyitott módja"
PythonFileReadable = "A fájl olvasható?"
PythonFileWritable = "A fájl írható?"
PythonFileSeekable = "Seek-et lehete használni"
PythonFileSeek = "A kurzort áthelyezni"
PythonFileTell = "Visszaadja a kurzor helye"
PythonFileClose = "Bezárni egy fájlt"
PythonFileClosed = "True ha a fájl bezárva"
PythonFileRead = "Olvas 16 bájtig"
PythonFileWrite = "b-t irjon a fájlba"
PythonFileReadline = "Olvas egy sort vagy 16 bájtig"
PythonFileReadlines = "Olvas több sort"
PythonFileTruncate = "A fájl átméretezése"
PythonFileWritelines = "Irjon több sort"
PythonFileName = "A fájl neve"
PythonFileMode = "A fájl nyitott módja"
PythonFileReadable = "read-et lehete használni"
PythonFileWritable = "write-ot lehete használni"
PythonImportOs = "os modul importálása"
PythonOsUname = "Rendszer informaciók"
PythonOsRemove = "Fájl törlése"
PythonOsRename = "Fájl átnevezése"
PythonOsListdir = "Fájlok listája"

View File

@@ -30,8 +30,8 @@ PythonColor = "Definisci un colore rvb"
PythonColorBlack = "Colore nero"
PythonColorBlue = "Colore blu"
PythonColorBrown = "Colore marrone"
PythonColorGray = "Colore grigio"
PythonColorGreen = "Colore verde"
PythonColorGrey = "Colore grigio"
PythonColorOrange = "Colore arancione"
PythonColorPink = "Colore rosa"
PythonColorPurple = "Colore viola"
@@ -45,6 +45,7 @@ PythonCosh = "Coseno iperbolico"
PythonCount = "Conta le ricorrenze di x"
PythonDegrees = "Conversione di radianti in gradi"
PythonDivMod = "Quoziente e resto"
PythonDrawLine = "Disegna una linea"
PythonDrawString = "Visualizza il testo dal pixel x,y"
PythonErf = "Funzione d'errore"
PythonErfc = "Funzione d'errore complementare"
@@ -71,6 +72,11 @@ PythonImportMath = "Importa modulo math"
PythonImportMatplotlibPyplot = "Importa modulo matplotlib.pyplot"
PythonImportTurtle = "Importa del modulo turtle"
PythonImportTime = "Importa del modulo time"
PythonImportOs = "Importa modulo os"
PythonOsUname = "Ottieni informazioni sul sistema"
PythonOsRemove = "Rimuovere un file"
PythonOsRename = "Rinomina file"
PythonOsListdir = "Elenca file"
PythonIndex = "Indice prima occorrenza di x"
PythonInput = "Inserire un valore"
PythonInsert = "Inserire x in posizione i-esima"
@@ -81,52 +87,6 @@ PythonIsInfinite = "Testa se x est infinito"
PythonIsKeyDown = "Restituisce True premendo tasto k"
PythonIsNaN = "Testa se x è NaN"
PythonKandinskyFunction = "Prefisso funzione modulo kandinsky"
PythonKeyLeft = "Tasto FRECCIA SINISTRA"
PythonKeyUp = "Tasto FRECCIA ALTO"
PythonKeyDown = "Tasto FRECCIA BASSO"
PythonKeyRight = "Tasto FRECCIA DESTRA"
PythonKeyOk = "Tasto OK"
PythonKeyBack = "Tasto INDIETRO"
PythonKeyHome = "Tasto CASA"
PythonKeyOnOff = "Tasto ON/OFF"
PythonKeyShift = "Tasto SHIFT"
PythonKeyAlpha = "Tasto ALPHA"
PythonKeyXnt = "Tasto X,N,T"
PythonKeyVar = "Tasto VAR"
PythonKeyToolbox = "Tasto TOOLBOX"
PythonKeyBackspace = "Tasto CANCELLA"
PythonKeyExp = "Tasto ESPONENZIALE"
PythonKeyLn = "Tasto LOGARITMO NEPERIANO"
PythonKeyLog = "Tasto LOGARITMO DECIMALE"
PythonKeyImaginary = "Tasto I IMMAGINE"
PythonKeyComma = "Tasto VIRGOLA"
PythonKeyPower = "Tasto POTENZA"
PythonKeySine = "Tasto SENO"
PythonKeyCosine = "Tasto COSENO"
PythonKeyTangent = "Tasto TANGENTE"
PythonKeyPi = "Tasto PI"
PythonKeySqrt = "Tasto RADICE QUADRATA"
PythonKeySquare = "Tasto QUADRATO"
PythonKeySeven = "Tasto 7"
PythonKeyEight = "Tasto 8"
PythonKeyNine = "Tasto 9"
PythonKeyLeftParenthesis = "Tasto PARENTESI SINISTRA"
PythonKeyRightParenthesis = "Tasto PARENTESI DESTRA"
PythonKeyFour = "Tasto 4"
PythonKeyFive = "Tasto 5"
PythonKeySix = "Tasto 6"
PythonKeyMultiplication = "Tasto MOLTIPLICAZIONE"
PythonKeyDivision = "Tasto DIVISIONE"
PythonKeyOne = "Tasto 1"
PythonKeyTwo = "Tasto 2"
PythonKeyThree = "Tasto 3"
PythonKeyPlus = "Tasto PIÙ"
PythonKeyMinus = "Tasto MENO"
PythonKeyZero = "Tasto 0"
PythonKeyDot = "Tasto PUNTO"
PythonKeyEe = "Tasto 10 POTENZA X"
PythonKeyAns = "Tasto ANS"
PythonKeyExe = "Tasto EXE"
PythonLdexp = "Inversa di frexp : x*(2**i)"
PythonLength = "Longhezza di un oggetto"
PythonLgamma = "Logaritmo della funzione gamma"

View File

@@ -13,14 +13,14 @@ PythonAbs = "Absolute waarde"
PythonAcos = "Arccosinus"
PythonAcosh = "Arccosinus hyperbolicus"
PythonAppend = "Voeg x toe aan het eind van je lijst"
PythonArrow = "Arrow from (x,y) to (x+dx,y+dy)"
PythonArrow = "Pijl van (x,y) naar (x+dx,y+dy)"
PythonAsin = "Arcsinus"
PythonAsinh = "Arcsinus hyperbolicus"
PythonAtan = "Arctangens"
PythonAtan2 = "Geeft atan(y/x)"
PythonAtanh = "Arctangens hyperbolicus"
PythonAxis = "Set the axes to (xmin,xmax,ymin,ymax)"
PythonBar = "Draw a bar plot with x values"
PythonAxis = "Stel de assen in (xmin,xmax,ymin,ymax)"
PythonBar = "Teken staafdiagram met x-waarden"
PythonBin = "Zet integer om in een binair getal"
PythonCeil = "Plafond"
PythonChoice = "Geeft willek. getal van de lijst"
@@ -30,8 +30,8 @@ PythonColor = "Definieer een rgb kleur"
PythonColorBlack = "Zwarte kleur"
PythonColorBlue = "Blauwe kleur"
PythonColorBrown = "Bruine kleur"
PythonColorGray = "Grijze kleur"
PythonColorGreen = "Groene kleur"
PythonColorGrey = "Grijze kleur"
PythonColorOrange = "Oranje kleur"
PythonColorPink = "Roze kleur"
PythonColorPurple = "Paarse kleur"
@@ -45,6 +45,7 @@ PythonCosh = "Cosinus hyperbolicus"
PythonCount = "Tel voorkomen van x"
PythonDegrees = "Zet x om van radialen naar graden"
PythonDivMod = "Quotiënt en rest"
PythonDrawLine = "Teken een lijn"
PythonDrawString = "Geef een tekst weer van pixel (x,y)"
PythonErf = "Error functie"
PythonErfc = "Complementaire error functie"
@@ -60,16 +61,21 @@ PythonFrExp = "Mantisse en exponent van x: (m,e)"
PythonGamma = "Gammafunctie"
PythonGetPixel = "Geef pixel (x,y) kleur (rgb)"
PythonGetrandbits = "Integer met k willekeurige bits"
PythonGrid = "Toggle the visibility of the grid"
PythonGrid = "Verander zichtbaarheid raster"
PythonHex = "Zet integer om in hexadecimaal"
PythonHist = "Draw the histogram of x"
PythonHist = "Teken het histogram van x"
PythonImportCmath = "Importeer cmath module"
PythonImportIon = "Importeer ion module"
PythonImportKandinsky = "Importeer kandinsky module"
PythonImportRandom = "Importeer random module"
PythonImportMath = "Importeer math module"
PythonImportMatplotlibPyplot = "Import matplotlib.pyplot module"
PythonImportMatplotlibPyplot = "Importeer matplotlib.pyplot module"
PythonImportTime = "Importeer time module"
PythonImportOs = "Importeer os module"
PythonOsUname = " Krijg systeeminfo"
PythonOsRemove = "Een bestand verwijderen"
PythonOsRename = "Hernoem bestand"
PythonOsListdir = "Lijstbestanden"
PythonImportTurtle = "Importeer turtle module"
PythonIndex = "Index van de eerste x aanwezigheden"
PythonInput = "Wijs een waarde toe"
@@ -79,54 +85,8 @@ PythonIonFunction = "ion module voorvoegsel"
PythonIsFinite = "Controleer of x eindig is"
PythonIsInfinite = "Controleer of x oneindig is"
PythonIsKeyDown = "Geef True als k toets omlaag is"
PythonIsNaN = "Controleer of x geen nummer is"
PythonIsNaN = "Controleer of x geen getal is"
PythonKandinskyFunction = "kandinsky module voorvoegsel"
PythonKeyLeft = "PIJL NAAR LINKS toets"
PythonKeyUp = "PIJL OMHOOG toets"
PythonKeyDown = "PIJL OMLAAG toets"
PythonKeyRight = "PIJL NAAR RECHTS toets"
PythonKeyOk = "OK toets"
PythonKeyBack = "TERUG toets"
PythonKeyHome = "HOME toets"
PythonKeyOnOff = "AAN/UIT toets"
PythonKeyShift = "SHIFT toets"
PythonKeyAlpha = "ALPHA toets"
PythonKeyXnt = "X,N,T toets"
PythonKeyVar = "VAR toets"
PythonKeyToolbox = "TOOLBOX toets"
PythonKeyBackspace = "BACKSPACE toets"
PythonKeyExp = "EXPONENTIEEL toets"
PythonKeyLn = "NATUURLIJKE LOGARITME toets"
PythonKeyLog = "BRIGGSE LOGARITME toets"
PythonKeyImaginary = "IMAGINAIRE I toets"
PythonKeyComma = "KOMMA toets"
PythonKeyPower = "MACHT toets"
PythonKeySine = "SINUS toets"
PythonKeyCosine = "COSINUS toets"
PythonKeyTangent = "TANGENS toets"
PythonKeyPi = "PI toets"
PythonKeySqrt = "VIERKANTSWORTEL toets"
PythonKeySquare = "KWADRAAT toets"
PythonKeySeven = "7 toets"
PythonKeyEight = "8 toets"
PythonKeyNine = "9 toets"
PythonKeyLeftParenthesis = "HAAKJE OPENEN toets"
PythonKeyRightParenthesis = "HAAKJE SLUITEN toets"
PythonKeyFour = "4 toets"
PythonKeyFive = "5 toets"
PythonKeySix = "6 toets"
PythonKeyMultiplication = "VERMENIGVULDIGEN toets"
PythonKeyDivision = "DELEN toets"
PythonKeyOne = "1 toets"
PythonKeyTwo = "2 toets"
PythonKeyThree = "3 toets"
PythonKeyPlus = "PLUS toets"
PythonKeyMinus = "MIN toets"
PythonKeyZero = "0 toets"
PythonKeyDot = "PUNT toets"
PythonKeyEe = "10 TOT DE MACHT X toets"
PythonKeyAns = "ANS toets"
PythonKeyExe = "EXE toets"
PythonLdexp = "Geeft x*(2**i), inversie van frexp"
PythonLength = "Lengte van een object"
PythonLgamma = "Log-gammafunctie"
@@ -141,14 +101,14 @@ PythonModf = "Fractionele en gehele delen van x"
PythonMonotonic = "Waarde van een monotone klok"
PythonOct = "Integer omzetten naar octaal"
PythonPhase = "Fase van z in radialen"
PythonPlot = "Plot y versus x as lines"
PythonPlot = "Plot y versus x als lijnen"
PythonPolar = "z in poolcoördinaten"
PythonPop = "Verwijder en breng het laatste item terug"
PythonPower = "x tot de macht y"
PythonPrint = "Print object"
PythonRadians = "Zet x om van graden naar radialen"
PythonRandint = "Geeft willek. integer in [a,b]"
PythonRandom = "Een willekeurig getal in [0,1["
PythonRandom = "Een willekeurig getal in [0,1)"
PythonRandomFunction = "random module voorvoegsel"
PythonRandrange = "Willek. getal in range(start, stop)"
PythonRangeStartStop = "Lijst van start tot stop-1"
@@ -157,10 +117,10 @@ PythonRect = "z in cartesiaanse coördinaten"
PythonRemove = "Verwijder het eerste voorkomen van x"
PythonReverse = "Keer de elementen van de lijst om"
PythonRound = "Rond af op n cijfers"
PythonScatter = "Draw a scatter plot of y versus x"
PythonScatter = "Teken scatterplot van y versus x"
PythonSeed = "Start willek. getallengenerator"
PythonSetPixel = "Kleur pixel (x,y)"
PythonShow = "Display the figure"
PythonShow = "Figuur weergeven"
PythonSin= "Sinus"
PythonSinh = "Sinus hyperbolicus"
PythonSleep = "Stel executie voor t seconden uit"
@@ -169,7 +129,7 @@ PythonSqrt = "Vierkantswortel"
PythonSum = "Sommeer de items van een lijst"
PythonTan = "Tangens"
PythonTanh = "Tangens hyperbolicus"
PythonText = "Display a text at (x,y) coordinates"
PythonText = "Geef tekst weer op coördinaten (x,y)"
PythonTimeFunction = "time module voorvoegsel"
PythonTrunc = "x afgeknot tot een integer"
PythonTurtleBackward = "Ga achterwaarts met x pixels"
@@ -194,7 +154,7 @@ PythonTurtleSetposition = "Plaats de schildpad"
PythonTurtleShowturtle = "Laat de schildpad zien"
PythonTurtleSpeed = "Tekensnelheid tussen 0 and 10"
PythonTurtleWrite = "Display a text"
PythonUniform = "Zwevendekommagetal in [a,b]"
PythonUniform = "Decimaal getal in [a,b]"
PythonImportTime = "Import time module"
PythonTimePrefix = "time module function prefix"
PythonTimeSleep = "Wait for n second"

View File

@@ -30,8 +30,8 @@ PythonColor = "Define uma cor rgb"
PythonColorBlack = "Cor preta"
PythonColorBlue = "Cor azul"
PythonColorBrown = "Cor castanha"
PythonColorGray = "Cor cinzenta"
PythonColorGreen = "Cor verde"
PythonColorGrey = "Cor cinzenta"
PythonColorOrange = "Cor laranja"
PythonColorPink = "Cor rosa"
PythonColorPurple = "Cor roxa"
@@ -45,6 +45,7 @@ PythonCosh = "Cosseno hiperbólico"
PythonCount = "Contar as ocorrências de x"
PythonDegrees = "Converter x de radianos para graus"
PythonDivMod = "Quociente e resto"
PythonDrawLine = "Desenhe uma linha"
PythonDrawString = "Mostrar o texto do pixel (x,y)"
PythonErf = "Função erro"
PythonErfc = "Função erro complementar"
@@ -81,52 +82,6 @@ PythonIsInfinite = "Verificar se x é infinito"
PythonIsKeyDown = "Devolve True se tecla k pressionada"
PythonIsNaN = "Verificar se x é um NaN"
PythonKandinskyFunction = "Prefixo da função do módulo kandinsky"
PythonKeyLeft = "tecla SETA ESQUERDA"
PythonKeyUp = "tecla SETA CIMA "
PythonKeyDown = "tecla SETA BAIXO"
PythonKeyRight = "tecla SETA DIREITA"
PythonKeyOk = "tecla OK"
PythonKeyBack = "tecla VOLTAR"
PythonKeyHome = "tecla HOME"
PythonKeyOnOff = "tecla ON/OFF"
PythonKeyShift = "tecla SHIFT"
PythonKeyAlpha = "tecla ALPHA"
PythonKeyXnt = "tecla X,N,T"
PythonKeyVar = "tecla VAR"
PythonKeyToolbox = "tecla CAIXA DE FERRAMENTAS"
PythonKeyBackspace = "tecla APAGAR"
PythonKeyExp = "tecla EXPONENCIAL"
PythonKeyLn = "tecla LOGARITMO NATURAL"
PythonKeyLog = "tecla LOGARITMO DECIMAL"
PythonKeyImaginary = "tecla I IMAGINÁRIO"
PythonKeyComma = "tecla VÍRGULA"
PythonKeyPower = "tecla EXPOENTE"
PythonKeySine = "tecla SENO"
PythonKeyCosine = "tecla COSSENO"
PythonKeyTangent = "tecla TANGENTE"
PythonKeyPi = "tecla PI"
PythonKeySqrt = "tecla RAIZ QUADRADA"
PythonKeySquare = "tecla AO QUADRADO"
PythonKeySeven = "tecla 7"
PythonKeyEight = "tecla 8"
PythonKeyNine = "tecla 9"
PythonKeyLeftParenthesis = "tecla PARÊNTESE ESQUERDO"
PythonKeyRightParenthesis = "tecla PARÊNTESE DIREITO"
PythonKeyFour = "tecla 4"
PythonKeyFive = "tecla 5"
PythonKeySix = "tecla 6"
PythonKeyMultiplication = "tecla MULTIPLICAÇÃO"
PythonKeyDivision = "tecla DIVISÃO"
PythonKeyOne = "tecla 1"
PythonKeyTwo = "tecla 2"
PythonKeyThree = "tecla 3"
PythonKeyPlus = "tecla MAIS"
PythonKeyMinus = "tecla MENOS"
PythonKeyZero = "tecla 0"
PythonKeyDot = "tecla PONTO"
PythonKeyEe = "tecla 10 expoente X"
PythonKeyAns = "tecla ANS"
PythonKeyExe = "tecla EXE"
PythonLdexp = "Devolve x*(2**i), inverso de frexp"
PythonLength = "Comprimento de um objeto"
PythonLgamma = "Logaritmo da função gama"
@@ -196,6 +151,11 @@ PythonTurtleSpeed = "Velocidade do desenho entre 0 e 10"
PythonTurtleWrite = "Mostrar um texto"
PythonUniform = "Número decimal em [a,b]"
PythonImportTime = "Import time module"
PythonImportOs = "Import os module"
PythonOsUname = " Obter informações do sistema"
PythonOsRemove = "Remover um ficheiro"
PythonOsRename = "Renomear ficheiro"
PythonOsListdir = "Listar ficheiros"
PythonTimePrefix = "time module function prefix"
PythonTimeSleep = "Wait for n second"
PythonMonotonic = "Return monotonic time"

View File

@@ -32,8 +32,8 @@ PythonCommandColor = "color(r,g,b)"
PythonCommandColorBlack = "'black'"
PythonCommandColorBlue = "'blue'"
PythonCommandColorBrown = "'brown'"
PythonCommandColorGray = "'gray'"
PythonCommandColorGreen = "'green'"
PythonCommandColorGrey = "'grey'"
PythonCommandColorOrange = "'orange'"
PythonCommandColorPink = "'pink'"
PythonCommandColorPurple = "'purple'"
@@ -50,6 +50,7 @@ PythonCommandCount = "list.count(x)"
PythonCommandCountWithoutArg = ".count(\x11)"
PythonCommandDegrees = "degrees(x)"
PythonCommandDivMod = "divmod(a,b)"
PythonCommandDrawLine = "draw_line(x1,y1,x2,y2,color)"
PythonCommandDrawString = "draw_string(\"text\",x,y)"
PythonCommandConstantE = "e"
PythonCommandErf = "erf(x)"
@@ -86,6 +87,8 @@ PythonCommandImportKandinsky = "import kandinsky"
PythonCommandImportMath = "import math"
PythonCommandImportMatplotlibPyplot = "import matplotlib.pyplot"
PythonCommandImportRandom = "import random"
PythonCommandImportOs = "import os"
PythonCommandImportFromOs = "from os import *"
PythonCommandImportTime = "import time"
PythonCommandImportTurtle = "import turtle"
PythonCommandIndex = "list.index(x)"
@@ -212,6 +215,12 @@ PythonCommandTurtleFunctionWithoutArg = "turtle.\x11"
PythonCommandUniform = "uniform(a,b)"
PythonConstantE = "2.718281828459045"
PythonConstantPi = "3.141592653589793"
PythonOsCommandUname = "uname()"
PythonOsCommandRemove = "remove(filename)"
PythonOsCommandRename = "rename(oldname, newname)"
PythonOsCommandRemoveWithoutArg = "remove(\x11)"
PythonOsCommandRenameWithoutArg = "rename(\x11,)"
PythonOsCommandListdir = "listdir()"
PythonTurtleCommandBackward = "backward(x)"
PythonTurtleCommandCircle = "circle(r)"
PythonTurtleCommandColor = "color('c')"

View File

@@ -451,30 +451,6 @@ void ConsoleController::printText(const char * text, size_t length) {
flushOutputAccumulationBufferToStore();
micropython_port_vm_hook_refresh_print();
}
// #if __EMSCRIPTEN__
/* If we called micropython_port_interrupt_if_needed here, we would need to
* put in the WHITELIST all the methods that call
* ConsoleController::printText, which means all the MicroPython methods that
* call print... This is a lot of work + might reduce the performance as
* emterpreted code is slower.
*
* We thus do not allow print interruption on the web simulator. It would be
* better to allow it, but the biggest problem was on the device anyways
* -> It is much quicker to interrupt Python on the web simulator than on the
* device.
*
* TODO: Allow print interrpution on emscripten -> maybe by using WASM=1 ? */
/*
* This can be run in Omega, since it uses WebASM.
*/
// #else
/* micropython_port_vm_hook_loop is not enough to detect user interruptions,
* because it calls micropython_port_interrupt_if_needed every 20000
* operations, and a print operation is quite long. We thus explicitely call
* micropython_port_interrupt_if_needed here. */
micropython_port_interrupt_if_needed();
// #endif
}
void ConsoleController::autoImportScript(Script script, bool force) {

View File

@@ -23,7 +23,7 @@ void EditorController::setScript(Script script, int scriptIndex) {
m_script = script;
m_scriptIndex = scriptIndex;
/* We edit the script direclty in the storage buffer. We thus put all the
/* We edit the script directly in the storage buffer. We thus put all the
* storage available space at the end of the current edited script and we set
* its size.
*
@@ -36,8 +36,8 @@ void EditorController::setScript(Script script, int scriptIndex) {
*
* */
size_t newScriptSize = Ion::Storage::sharedStorage()->putAvailableSpaceAtEndOfRecord(m_script);
m_editorView.setText(const_cast<char *>(m_script.content()), newScriptSize - Script::StatusSize());
Ion::Storage::sharedStorage()->putAvailableSpaceAtEndOfRecord(m_script);
m_editorView.setText(const_cast<char *>(m_script.content()), m_script.contentSize());
}
void EditorController::willExitApp() {

View File

@@ -67,11 +67,19 @@ void EditorView::GutterView::drawRect(KDContext * ctx, KDRect rect) const {
KDCoordinate firstLine = m_offset / glyphSize.height();
KDCoordinate firstLinePixelOffset = m_offset - firstLine * glyphSize.height();
char lineNumber[4];
char lineNumber[k_lineNumberCharLength];
int numberOfLines = bounds().height() / glyphSize.height() + 1;
for (int i=0; i<numberOfLines; i++) {
Poincare::Integer line(i + firstLine + 1);
line.serialize(lineNumber, 4);
// Only the first two digits are displayed
int lineNumberValue = (i + firstLine + 1) % 100;
Poincare::Integer line(lineNumberValue);
if (firstLine < 10 || lineNumberValue >= 10) {
line.serialize(lineNumber, k_lineNumberCharLength);
} else {
// Add a leading "0"
lineNumber[0] = '0';
line.serialize(lineNumber + 1, k_lineNumberCharLength - 1);
}
KDCoordinate leftPadding = (2 - strlen(lineNumber)) * glyphSize.width();
ctx->drawString(
lineNumber,

View File

@@ -42,6 +42,7 @@ private:
KDSize minimalSizeForOptimalDisplay() const override;
private:
static constexpr KDCoordinate k_margin = 2;
static constexpr int k_lineNumberCharLength = 3;
const KDFont * m_font;
KDCoordinate m_offset;
};

View File

@@ -1,44 +1,20 @@
#include "helpers.h"
#include <string.h>
#include <ion/unicode/code_point.h>
#include <ion.h>
#include <escher/clipboard.h>
namespace Code {
namespace Helpers {
class EventTextPair {
public:
constexpr EventTextPair(Ion::Events::Event event, const char * text) : m_event(event), m_text(text) {}
Ion::Events::Event event() const { return m_event; }
const char * text() const { return m_text; }
private:
const Ion::Events::Event m_event;
const char * m_text;
};
static_assert('\x11' == UCodePointEmpty, "Unicode error");
static constexpr EventTextPair sEventTextMap[] = {
EventTextPair(Ion::Events::XNT, "x"),
EventTextPair(Ion::Events::Exp, "exp(\x11)"),
EventTextPair(Ion::Events::Ln, "log(\x11)"),
EventTextPair(Ion::Events::Log, "log10(\x11)"),
EventTextPair(Ion::Events::Imaginary, "1j"),
EventTextPair(Ion::Events::Power, "**"),
EventTextPair(Ion::Events::Pi, "pi"),
EventTextPair(Ion::Events::Sqrt, "sqrt(\x11)"),
EventTextPair(Ion::Events::Square, "**2"),
EventTextPair(Ion::Events::Multiplication, "*"),
EventTextPair(Ion::Events::EE, "e"),
};
const char * PythonTextForEvent(Ion::Events::Event event) {
for (size_t i=0; i<sizeof(sEventTextMap)/sizeof(sEventTextMap[0]); i++) {
if (event == sEventTextMap[i].event()) {
return sEventTextMap[i].text();
for (size_t i=0; i<NumberOfPythonTextPairs; i++) {
UTF8Helper::TextPair pair = PythonTextPairs[i];
if (event.text() == pair.firstString()) {
return pair.secondString();
}
if (event == Ion::Events::XNT) {
return "x";
}
}
return nullptr;
}
}
}

View File

@@ -440,9 +440,7 @@ void PythonTextArea::addAutocompletion() {
const int scriptIndex = m_contentView.pythonDelegate()->menuController()->editedScriptIndex();
m_contentView.pythonDelegate()->variableBoxController()->loadFunctionsAndVariables(scriptIndex, autocompletionTokenBeginning, autocompletionLocation - autocompletionTokenBeginning);
if (addAutocompletionTextAtIndex(0)) {
m_contentView.setAutocompleting(true);
}
addAutocompletionTextAtIndex(0);
}
bool PythonTextArea::addAutocompletionTextAtIndex(int nextIndex, int * currentIndexToUpdate) {
@@ -467,6 +465,7 @@ bool PythonTextArea::addAutocompletionTextAtIndex(int nextIndex, int * currentIn
return false;
}
autocompletionLocation += textToInsertLength;
m_contentView.setAutocompleting(true);
m_contentView.setAutocompletionEnd(autocompletionLocation);
}
@@ -479,8 +478,9 @@ bool PythonTextArea::addAutocompletionTextAtIndex(int nextIndex, int * currentIn
if (addParentheses && m_contentView.insertTextAtLocation(parentheses, const_cast<char *>(autocompletionLocation), parenthesesLength)) {
m_contentView.setAutocompleting(true);
m_contentView.setAutocompletionEnd(autocompletionLocation + parenthesesLength);
return true;
}
return true;
return (textToInsertLength > 0);
}
void PythonTextArea::cycleAutocompletion(bool downwards) {

View File

@@ -5,6 +5,7 @@ extern "C" {
#include <string.h>
#include <ctype.h>
}
#include "app.h"
namespace Code {
@@ -131,7 +132,7 @@ const ToolboxMessageTree MatplotlibPyplotModuleChildren[] = {
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandColorPink, I18n::Message::PythonColorPink, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandColorOrange, I18n::Message::PythonColorOrange, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandColorPurple, I18n::Message::PythonColorPurple, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandColorGrey, I18n::Message::PythonColorGrey, false)
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandColorGray, I18n::Message::PythonColorGray, false)
};
const ToolboxMessageTree TurtleModuleChildren[] = {
@@ -168,7 +169,7 @@ const ToolboxMessageTree TurtleModuleChildren[] = {
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandColorPink, I18n::Message::PythonColorPink, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandColorOrange, I18n::Message::PythonColorOrange, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandColorPurple, I18n::Message::PythonColorPurple, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandColorGrey, I18n::Message::PythonColorGrey, false)
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandColorGray, I18n::Message::PythonColorGray, false)
};
const ToolboxMessageTree RandomModuleChildren[] = {
@@ -192,6 +193,7 @@ const ToolboxMessageTree KandinskyModuleChildren[] = {
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandSetPixel, I18n::Message::PythonSetPixel),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandColor, I18n::Message::PythonColor),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandDrawString, I18n::Message::PythonDrawString),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandDrawLine, I18n::Message::PythonDrawLine),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandFillRect, I18n::Message::PythonFillRect)
};
@@ -200,52 +202,7 @@ const ToolboxMessageTree IonModuleChildren[] = {
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandImportFromIon, I18n::Message::PythonImportIon, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandIonFunction, I18n::Message::PythonIonFunction, false, I18n::Message::PythonCommandIonFunctionWithoutArg),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandIsKeyDown, I18n::Message::PythonIsKeyDown),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandKeyLeft, I18n::Message::PythonKeyLeft, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandKeyUp, I18n::Message::PythonKeyUp, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandKeyDown, I18n::Message::PythonKeyDown, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandKeyRight, I18n::Message::PythonKeyRight, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandKeyOk, I18n::Message::PythonKeyOk, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandKeyBack, I18n::Message::PythonKeyBack, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandKeyHome, I18n::Message::PythonKeyHome, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandKeyOnOff, I18n::Message::PythonKeyOnOff, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandKeyShift, I18n::Message::PythonKeyShift, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandKeyAlpha, I18n::Message::PythonKeyAlpha, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandKeyXnt, I18n::Message::PythonKeyXnt, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandKeyVar, I18n::Message::PythonKeyVar, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandKeyToolbox, I18n::Message::PythonKeyToolbox, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandKeyBackspace, I18n::Message::PythonKeyBackspace, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandKeyExp, I18n::Message::PythonKeyExp, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandKeyLn, I18n::Message::PythonKeyLn, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandKeyLog, I18n::Message::PythonKeyLog, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandKeyImaginary, I18n::Message::PythonKeyImaginary, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandKeyComma, I18n::Message::PythonKeyComma, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandKeyPower, I18n::Message::PythonKeyPower, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandKeySine, I18n::Message::PythonKeySine, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandKeyCosine, I18n::Message::PythonKeyCosine, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandKeyTangent, I18n::Message::PythonKeyTangent, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandKeyPi, I18n::Message::PythonKeyPi, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandKeySqrt, I18n::Message::PythonKeySqrt, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandKeySquare, I18n::Message::PythonKeySquare, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandKeySeven, I18n::Message::PythonKeySeven, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandKeyEight, I18n::Message::PythonKeyEight, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandKeyNine, I18n::Message::PythonKeyNine, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandKeyLeftParenthesis, I18n::Message::PythonKeyLeftParenthesis, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandKeyRightParenthesis, I18n::Message::PythonKeyRightParenthesis, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandKeyFour, I18n::Message::PythonKeyFour, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandKeyFive, I18n::Message::PythonKeyFive, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandKeySix, I18n::Message::PythonKeySix, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandKeyMultiplication, I18n::Message::PythonKeyMultiplication, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandKeyDivision, I18n::Message::PythonKeyDivision, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandKeyOne, I18n::Message::PythonKeyOne, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandKeyTwo, I18n::Message::PythonKeyTwo, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandKeyThree, I18n::Message::PythonKeyThree, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandKeyPlus, I18n::Message::PythonKeyPlus, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandKeyMinus, I18n::Message::PythonKeyMinus, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandKeyZero, I18n::Message::PythonKeyZero, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandKeyDot, I18n::Message::PythonKeyDot, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandKeyEe, I18n::Message::PythonKeyEe, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandKeyAns, I18n::Message::PythonKeyAns, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandKeyExe, I18n::Message::PythonKeyExe, false)
ToolboxMessageTree::Leaf(I18n::Message::IonSelector, I18n::Message::IonSelector)
};
const ToolboxMessageTree TimeModuleChildren[] = {
@@ -256,6 +213,15 @@ const ToolboxMessageTree TimeModuleChildren[] = {
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandSleep, I18n::Message::PythonSleep)
};
const ToolboxMessageTree OsModuleChildren[] = {
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandImportOs, I18n::Message::PythonImportOs, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandImportFromOs, I18n::Message::PythonImportOs, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonOsCommandUname, I18n::Message::PythonOsUname, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonOsCommandRemove, I18n::Message::PythonOsRemove, false, I18n::Message::PythonOsCommandRemoveWithoutArg),
ToolboxMessageTree::Leaf(I18n::Message::PythonOsCommandRename, I18n::Message::PythonOsRename, false, I18n::Message::PythonOsCommandRenameWithoutArg),
ToolboxMessageTree::Leaf(I18n::Message::PythonOsCommandListdir, I18n::Message::PythonOsListdir, false)
};
const ToolboxMessageTree modulesChildren[] = {
ToolboxMessageTree::Node(I18n::Message::MathModule, MathModuleChildren),
ToolboxMessageTree::Node(I18n::Message::CmathModule, CMathModuleChildren),
@@ -264,6 +230,7 @@ const ToolboxMessageTree modulesChildren[] = {
ToolboxMessageTree::Node(I18n::Message::RandomModule, RandomModuleChildren),
ToolboxMessageTree::Node(I18n::Message::KandinskyModule, KandinskyModuleChildren),
ToolboxMessageTree::Node(I18n::Message::IonModule, IonModuleChildren),
ToolboxMessageTree::Node(I18n::Message::OsModule, OsModuleChildren),
ToolboxMessageTree::Node(I18n::Message::TimeModule, TimeModuleChildren)
};
@@ -305,6 +272,7 @@ const ToolboxMessageTree catalogChildren[] = {
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandCosh, I18n::Message::PythonCosh),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandDegrees, I18n::Message::PythonDegrees),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandDivMod, I18n::Message::PythonDivMod),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandDrawLine, I18n::Message::PythonDrawLine),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandDrawString, I18n::Message::PythonDrawString),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandConstantE, I18n::Message::PythonConstantE, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandErf, I18n::Message::PythonErf),
@@ -331,8 +299,8 @@ const ToolboxMessageTree catalogChildren[] = {
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandGetPixel, I18n::Message::PythonGetPixel),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandGetrandbits, I18n::Message::PythonGetrandbits),
ToolboxMessageTree::Leaf(I18n::Message::PythonTurtleCommandGoto, I18n::Message::PythonTurtleGoto),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandColorGray, I18n::Message::PythonColorGray, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandColorGreen, I18n::Message::PythonColorGreen, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandColorGrey, I18n::Message::PythonColorGrey, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandGrid, I18n::Message::PythonGrid),
ToolboxMessageTree::Leaf(I18n::Message::PythonTurtleCommandHeading, I18n::Message::PythonTurtleHeading, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandHex, I18n::Message::PythonHex),
@@ -526,6 +494,11 @@ KDCoordinate PythonToolbox::rowHeight(int j) {
bool PythonToolbox::selectLeaf(int selectedRow) {
m_selectableTableView.deselectTable();
ToolboxMessageTree * node = (ToolboxMessageTree *)m_messageTreeModel->childAtIndex(selectedRow);
if(node->insertedText() == I18n::Message::IonSelector){
App::app()->toolboxIonKeys()->setSender(sender());
Container::activeApp()->displayModalViewController(static_cast<ViewController*>(App::app()->toolboxIonKeys()), 0.f, 0.f, Metric::PopUpTopMargin, Metric::PopUpLeftMargin, 0, Metric::PopUpRightMargin);
return true;
}
const char * editedText = I18n::translate(node->insertedText());
// strippedEditedText array needs to be in the same scope as editedText
char strippedEditedText[k_maxMessageSize];

View File

@@ -49,6 +49,7 @@ public:
bool autoImportationStatus() const;
void toggleAutoimportationStatus();
const char * content() const;
size_t contentSize() { return value().size - k_statusSize; }
/* Fetched status */
bool fetchedFromConsole() const;

View File

@@ -13,7 +13,7 @@ void ScriptNodeCell::ScriptNodeView::drawRect(KDContext * ctx, KDRect rect) cons
// If it exists, draw the description name.
const char * descriptionName = m_scriptNode->description();
if (descriptionName != nullptr) {
ctx->drawString(descriptionName, KDPoint(0, m_frame.height() - k_bottomMargin - k_font->glyphSize().height()), k_font, Palette::GreyDark, backgroundColor);
ctx->drawString(descriptionName, KDPoint(0, m_frame.height() - k_bottomMargin - k_font->glyphSize().height()), k_font, Palette::GrayDark, backgroundColor);
}
// Draw the node name

View File

@@ -36,7 +36,7 @@ def mandelbrot(N_iteration):
z = z*z+c
# Choose the color of the dot from the Mandelbrot sequence
rgb = int(255*i/N_iteration)
col = kandinsky.color(int(rgb),int(rgb*0.75),int(rgb*0.25))
col = kandinsky.color(int(rgb*0.82),int(rgb*0.13),int(rgb*0.18))
# Draw a pixel colored in 'col' at position (x,y)
kandinsky.set_pixel(x,y,col))");

View File

@@ -1,6 +1,6 @@
Functions = "Funzioni"
Catalog = "Catalogo"
Modules = "Moduli"
LoopsAndTests = "Loops e test"
LoopsAndTests = "Cicli e test"
Files = "Files"
Exceptions = "Exceptions"

View File

@@ -1,6 +1,6 @@
Functions = "Functies"
Catalog = "Catalogus"
Modules = "Modules"
LoopsAndTests = "Loops and tests"
LoopsAndTests = "Herhalingen en testen"
Files = "Files"
Exceptions = "Exceptions"

View File

@@ -3,6 +3,7 @@ IonModule = "ion"
KandinskyModule = "kandinsky"
MathModule = "math"
MatplotlibPyplotModule = "matplotlib.pyplot"
OsModule = "os"
TimeModule = "time"
TurtleModule = "turtle"
ForLoopMenu = "For"
@@ -56,3 +57,5 @@ PythonCommandDef = "def \x11():\n "
PythonCommandDefWithArg = "def function(x):"
PythonCommandReturn = "return "
RandomModule = "random"
IonSelector = "Key selector"
PressAKey = "Press a key"

View File

@@ -0,0 +1,50 @@
#include "toolbox_ion_keys.h"
#include <apps/apps_container.h>
#include <assert.h>
#include <ion.h>
extern "C" {
#include <py/obj.h>
#include <py/objfun.h>
}
extern const mp_rom_map_elem_t modion_module_globals_table[48];
namespace Code {
toolboxIonKeys::toolboxIonKeys() :
ViewController(nullptr),
m_view()
{
}
bool toolboxIonKeys::handleEvent(Ion::Events::Event e) {
Ion::Keyboard::State state = Ion::Keyboard::scan();
for(uint16_t i = 0; i < sizeof(modion_module_globals_table)/sizeof(_mp_rom_map_elem_t); i++){
_mp_rom_map_elem_t element = modion_module_globals_table[i];
if(mp_obj_is_small_int(element.value)){
int key = mp_obj_get_int(element.value);
if(state.keyDown(static_cast<Ion::Keyboard::Key>(key))){
m_sender->handleEventWithText(qstr_str(MP_OBJ_QSTR_VALUE(element.key)), true);
}
}
}
Container::activeApp()->dismissModalViewController();
AppsContainer::sharedAppsContainer()->redrawWindow();
return true;
}
toolboxIonKeys::toolboxIonView::toolboxIonView():
View()
{
}
void toolboxIonKeys::toolboxIonView::drawRect(KDContext * ctx, KDRect rect) const {
ctx->fillRect(rect, Palette::GrayBright);
ctx->strokeRect(rect, Palette::GrayDark);
ctx->drawString(I18n::translate(I18n::Message::PressAKey),KDPoint(rect.left()+80, rect.top()+20));
}
View * toolboxIonKeys::view(){
return &m_view;
}
}

View File

@@ -0,0 +1,21 @@
#include <escher.h>
namespace Code {
class toolboxIonKeys : public ViewController {
public :
toolboxIonKeys();
View * view() override;
bool handleEvent(Ion::Events::Event e) override;
void setSender(InputEventHandler * sender) { m_sender = sender; }
private :
class toolboxIonView : public View {
public :
toolboxIonView();
void drawRect(KDContext * ctx, KDRect rect) const override;
};
toolboxIonView m_view;
InputEventHandler * m_sender;
};
}

View File

@@ -45,7 +45,7 @@ VariableBoxController::VariableBoxController(ScriptStore * scriptStore) :
{
for (int i = 0; i < k_scriptOriginsCount; i++) {
m_subtitleCells[i].setBackgroundColor(Palette::WallScreen);
m_subtitleCells[i].setTextColor(Palette::BlueishGrey);
m_subtitleCells[i].setTextColor(Palette::SecondaryText);
}
}

View File

@@ -0,0 +1,11 @@
CountryCode,CountryPreferences::AvailableExamModes,CountryPreferences::MethodForQuartiles,Poincare::Preferences::UnitFormat,CountryPreferences::HomeAppsLayout
WW,StandardOnly,MedianOfSublist,Metric,Default
CA,StandardOnly,MedianOfSublist,Metric,Default
DE,StandardOnly,MedianOfSublist,Metric,Default
ES,StandardOnly,MedianOfSublist,Metric,Default
FR,StandardOnly,CumulatedFrequency,Metric,Default
GB,StandardOnly,MedianOfSublist,Metric,Default
IT,StandardOnly,CumulatedFrequency,Metric,Default
NL,All,MedianOfSublist,Metric,Default
PT,StandardOnly,MedianOfSublist,Metric,Default
US,StandardOnly,MedianOfSublist,Imperial,HidePython
1 CountryCode CountryPreferences::AvailableExamModes CountryPreferences::MethodForQuartiles Poincare::Preferences::UnitFormat CountryPreferences::HomeAppsLayout
2 WW StandardOnly MedianOfSublist Metric Default
3 CA StandardOnly MedianOfSublist Metric Default
4 DE StandardOnly MedianOfSublist Metric Default
5 ES StandardOnly MedianOfSublist Metric Default
6 FR StandardOnly CumulatedFrequency Metric Default
7 GB StandardOnly MedianOfSublist Metric Default
8 IT StandardOnly CumulatedFrequency Metric Default
9 NL All MedianOfSublist Metric Default
10 PT StandardOnly MedianOfSublist Metric Default
11 US StandardOnly MedianOfSublist Imperial HidePython

View File

@@ -0,0 +1,42 @@
#ifndef COUNTRY_PREFERENCES_H
#define COUNTRY_PREFERENCES_H
#include <poincare/preferences.h>
class CountryPreferences {
public:
enum class AvailableExamModes : uint8_t {
StandardOnly,
All
};
enum class MethodForQuartiles : uint8_t {
MedianOfSublist,
CumulatedFrequency
};
enum class HomeAppsLayout : uint8_t {
Default,
HidePython,
};
constexpr CountryPreferences(AvailableExamModes availableExamModes, MethodForQuartiles methodForQuartiles, Poincare::Preferences::UnitFormat unitFormat, HomeAppsLayout homeAppsLayout) :
m_availableExamModes(availableExamModes),
m_methodForQuartiles(methodForQuartiles),
m_unitFormat(unitFormat),
m_homeAppsLayout(homeAppsLayout)
{}
constexpr AvailableExamModes availableExamModes() const { return m_availableExamModes; }
constexpr MethodForQuartiles methodForQuartiles() const { return m_methodForQuartiles; }
constexpr Poincare::Preferences::UnitFormat unitFormat() const { return m_unitFormat; }
constexpr HomeAppsLayout homeAppsLayout() const { return m_homeAppsLayout; }
private:
const AvailableExamModes m_availableExamModes;
const MethodForQuartiles m_methodForQuartiles;
const Poincare::Preferences::UnitFormat m_unitFormat;
const HomeAppsLayout m_homeAppsLayout;
};
#endif

View File

@@ -8,11 +8,7 @@
namespace ExamModeConfiguration {
// Settings menu
#if LEDS_CHOICE
extern const Shared::SettingsMessageTree s_modelExamChildren[3];
#else
extern const Shared::SettingsMessageTree s_modelExamChildren[2];
#endif
int numberOfAvailableExamMode();
GlobalPreferences::ExamMode examModeAtIndex(int index);
I18n::Message examModeActivationMessage(int index);

View File

@@ -3,19 +3,10 @@
using namespace Poincare;
constexpr Shared::SettingsMessageTree s_examModeMode[] = {Shared::SettingsMessageTree(I18n::Message::ExamModeModeStandard), Shared::SettingsMessageTree(I18n::Message::ExamModeModeNoSym), Shared::SettingsMessageTree(I18n::Message::ExamModeModeNoSymNoText)};
#if LEDS_CHOICE
constexpr Shared::SettingsMessageTree s_ledColorChildren[] = {Shared::SettingsMessageTree(I18n::Message::ColorRed), Shared::SettingsMessageTree(I18n::Message::ColorWhite), Shared::SettingsMessageTree(I18n::Message::ColorGreen), Shared::SettingsMessageTree(I18n::Message::ColorBlue), Shared::SettingsMessageTree(I18n::Message::ColorYellow), Shared::SettingsMessageTree(I18n::Message::ColorPurple), Shared::SettingsMessageTree(I18n::Message::ColorOrange)};
constexpr Shared::SettingsMessageTree ExamModeConfiguration::s_modelExamChildren[] = {Shared::SettingsMessageTree(I18n::Message::LEDColor, s_ledColorChildren), Shared::SettingsMessageTree(I18n::Message::ExamModeMode, s_examModeMode), Shared::SettingsMessageTree(I18n::Message::ActivateExamMode)};
#else
constexpr Shared::SettingsMessageTree ExamModeConfiguration::s_modelExamChildren[] = {Shared::SettingsMessageTree(I18n::Message::ExamModeMode, s_examModeMode), Shared::SettingsMessageTree(I18n::Message::ActivateExamMode)};
#endif
int ExamModeConfiguration::numberOfAvailableExamMode() {
#if LEDS_CHOICE
return 3;
#else
return 2;
#endif
}
GlobalPreferences::ExamMode ExamModeConfiguration::examModeAtIndex(int index) {
@@ -38,24 +29,7 @@ I18n::Message ExamModeConfiguration::examModeActivationWarningMessage(GlobalPref
KDColor ExamModeConfiguration::examModeColor(GlobalPreferences::ExamMode mode) {
assert(mode == GlobalPreferences::ExamMode::Standard || mode == GlobalPreferences::ExamMode::NoSym || mode == GlobalPreferences::ExamMode::NoSymNoText);
Preferences * preferences = Preferences::sharedPreferences();
switch((int) preferences->colorOfLED()) {
case 1:
return KDColorWhite;
case 2:
return KDColorGreen;
case 3:
return KDColorBlue;
case 4:
return KDColorYellow;
case 5:
return KDColorPurple;
case 6:
return KDColorOrange;
default:
return KDColorRed;
}
return KDColorRed;
}
bool ExamModeConfiguration::appIsForbiddenInExamMode(App::Descriptor::ExaminationLevel appExaminationLevel, GlobalPreferences::ExamMode mode) {
@@ -67,4 +41,4 @@ bool ExamModeConfiguration::appIsForbiddenInExamMode(App::Descriptor::Examinatio
bool ExamModeConfiguration::exactExpressionsAreForbidden(GlobalPreferences::ExamMode mode) {
return mode == GlobalPreferences::ExamMode::NoSymNoText ? true : false;
}
}

View File

@@ -1,16 +1,32 @@
#include "exam_pop_up_controller.h"
#include "apps_container.h"
#include "exam_mode_configuration.h"
#include <apps/i18n.h>
#include "global_preferences.h"
#include <assert.h>
#include <poincare/preferences.h>
using namespace Poincare;
ExamPopUpController::ExamPopUpController(ExamPopUpControllerDelegate * delegate) :
ViewController(nullptr),
m_contentView(this),
PopUpController(
k_numberOfLines,
Invocation(
[](void * context, void * sender) {
ExamPopUpController * controller = (ExamPopUpController *)context;
GlobalPreferences::ExamMode mode = controller->targetExamMode();
assert(mode != GlobalPreferences::ExamMode::Unknown);
GlobalPreferences::sharedGlobalPreferences()->setExamMode(mode);
AppsContainer * container = AppsContainer::sharedAppsContainer();
if (mode == GlobalPreferences::ExamMode::Off) {
Ion::LED::setColor(KDColorBlack);
Ion::LED::updateColorWithPlugAndCharge();
} else {
container->activateExamMode(mode);
}
container->refreshPreferences();
Container::activeApp()->dismissModalViewController();
return true;
}, this)
),
m_targetExamMode(GlobalPreferences::ExamMode::Unknown),
m_delegate(delegate)
{
@@ -18,11 +34,9 @@ ExamPopUpController::ExamPopUpController(ExamPopUpControllerDelegate * delegate)
void ExamPopUpController::setTargetExamMode(GlobalPreferences::ExamMode mode) {
m_targetExamMode = mode;
m_contentView.setMessagesForExamMode(mode);
}
View * ExamPopUpController::view() {
return &m_contentView;
for (int i = 0; i < k_numberOfLines; i++) {
m_contentView.setMessage(i, ExamModeConfiguration::examModeActivationWarningMessage(mode, i));
}
}
void ExamPopUpController::viewDidDisappear() {
@@ -30,103 +44,3 @@ void ExamPopUpController::viewDidDisappear() {
m_delegate->examDeactivatingPopUpIsDismissed();
}
}
void ExamPopUpController::didBecomeFirstResponder() {
m_contentView.setSelectedButton(0);
}
bool ExamPopUpController::handleEvent(Ion::Events::Event event) {
if (event == Ion::Events::Left && m_contentView.selectedButton() == 1) {
m_contentView.setSelectedButton(0);
return true;
}
if (event == Ion::Events::Right && m_contentView.selectedButton() == 0) {
m_contentView.setSelectedButton(1);
return true;
}
return false;
}
ExamPopUpController::ContentView::ContentView(Responder * parentResponder) :
m_cancelButton(parentResponder, I18n::Message::Cancel, Invocation([](void * context, void * sender) {
Container::activeApp()->dismissModalViewController();
return true;
}, parentResponder), KDFont::SmallFont),
m_okButton(parentResponder, I18n::Message::Ok, Invocation([](void * context, void * sender) {
ExamPopUpController * controller = (ExamPopUpController *)context;
GlobalPreferences::ExamMode mode = controller->targetExamMode();
assert(mode != GlobalPreferences::ExamMode::Unknown);
GlobalPreferences::sharedGlobalPreferences()->setExamMode(mode);
AppsContainer * container = AppsContainer::sharedAppsContainer();
if (mode == GlobalPreferences::ExamMode::Off) {
Ion::LED::setColor(KDColorBlack);
Ion::LED::updateColorWithPlugAndCharge();
} else {
container->activateExamMode(mode);
}
container->refreshPreferences();
Container::activeApp()->dismissModalViewController();
return true;
}, parentResponder), KDFont::SmallFont),
m_warningTextView(KDFont::SmallFont, I18n::Message::Warning, 0.5, 0.5, KDColorWhite, KDColorBlack),
m_messageTextViews{}
{
for (int i = 0; i < k_maxNumberOfLines; i++) {
m_messageTextViews[i].setFont(KDFont::SmallFont);
m_messageTextViews[i].setAlignment(0.5f, 0.5f);
m_messageTextViews[i].setBackgroundColor(KDColorBlack);
m_messageTextViews[i].setTextColor(KDColorWhite);
}
}
void ExamPopUpController::ContentView::drawRect(KDContext * ctx, KDRect rect) const {
ctx->fillRect(bounds(), KDColorBlack);
}
void ExamPopUpController::ContentView::setSelectedButton(int selectedButton) {
m_cancelButton.setHighlighted(selectedButton == 0);
m_okButton.setHighlighted(selectedButton == 1);
Container::activeApp()->setFirstResponder(selectedButton == 0 ? &m_cancelButton : &m_okButton);
}
int ExamPopUpController::ContentView::selectedButton() {
if (m_cancelButton.isHighlighted()) {
return 0;
}
return 1;
}
void ExamPopUpController::ContentView::setMessagesForExamMode(GlobalPreferences::ExamMode mode) {
for (int i = 0; i < k_maxNumberOfLines; i++) {
m_messageTextViews[i].setMessage(ExamModeConfiguration::examModeActivationWarningMessage(mode, i));
}
}
int ExamPopUpController::ContentView::numberOfSubviews() const {
return 6;
}
View * ExamPopUpController::ContentView::subviewAtIndex(int index) {
switch (index) {
case 0:
return &m_warningTextView;
case 4:
return &m_cancelButton;
case 5:
return &m_okButton;
default:
return &m_messageTextViews[index-1];
}
}
void ExamPopUpController::ContentView::layoutSubviews(bool force) {
KDCoordinate height = bounds().height();
KDCoordinate width = bounds().width();
KDCoordinate textHeight = KDFont::SmallFont->glyphSize().height();
m_warningTextView.setFrame(KDRect(0, k_topMargin, width, textHeight), force);
for (int i = 0; i < k_maxNumberOfLines; i++) {
m_messageTextViews[i].setFrame(KDRect(0, k_topMargin+k_paragraphHeight+(i+1)*textHeight, width, textHeight), force);
}
m_cancelButton.setFrame(KDRect(k_buttonMargin, height-k_buttonMargin-k_buttonHeight, (width-3*k_buttonMargin)/2, k_buttonHeight), force);
m_okButton.setFrame(KDRect(2*k_buttonMargin+(width-3*k_buttonMargin)/2, height-k_buttonMargin-k_buttonHeight, (width-3*k_buttonMargin)/2, k_buttonHeight), force);
}

View File

@@ -1,53 +1,20 @@
#ifndef APPS_EXAM_POP_UP_CONTROLLER_H
#define APPS_EXAM_POP_UP_CONTROLLER_H
#include <escher.h>
#include <escher/pop_up_controller.h>
#include "exam_pop_up_controller_delegate.h"
#include "global_preferences.h"
class HighContrastButton : public Button {
public:
using Button::Button;
KDColor highlightedBackgroundColor() const override { return Palette::ButtonBackgroundSelectedHighContrast; }
};
class ExamPopUpController : public ViewController {
class ExamPopUpController : public PopUpController {
public:
ExamPopUpController(ExamPopUpControllerDelegate * delegate);
void setTargetExamMode(GlobalPreferences::ExamMode mode);
GlobalPreferences::ExamMode targetExamMode() const { return m_targetExamMode; }
// View Controller
View * view() override;
void viewDidDisappear() override;
// Responder
void didBecomeFirstResponder() override;
bool handleEvent(Ion::Events::Event event) override;
private:
class ContentView : public View {
public:
ContentView(Responder * parentResponder);
void drawRect(KDContext * ctx, KDRect rect) const override;
void setSelectedButton(int selectedButton);
int selectedButton();
void setMessagesForExamMode(GlobalPreferences::ExamMode mode);
private:
constexpr static KDCoordinate k_buttonMargin = 10;
constexpr static KDCoordinate k_buttonHeight = 20;
constexpr static KDCoordinate k_topMargin = 12;
constexpr static KDCoordinate k_paragraphHeight = 20;
int numberOfSubviews() const override;
View * subviewAtIndex(int index) override;
void layoutSubviews(bool force = false) override;
HighContrastButton m_cancelButton;
HighContrastButton m_okButton;
MessageTextView m_warningTextView;
constexpr static int k_maxNumberOfLines = 3;
MessageTextView m_messageTextViews[k_maxNumberOfLines];
};
ContentView m_contentView;
constexpr static int k_numberOfLines = 3;
GlobalPreferences::ExamMode m_targetExamMode;
ExamPopUpControllerDelegate * m_delegate;
};
#endif

Some files were not shown because too many files have changed in this diff Show More