Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[python] Turtle module #748

Merged
merged 59 commits into from Jan 8, 2019
Merged
Changes from 1 commit
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
464c1a5
[python] Initial turtle module
boricj Oct 27, 2018
0a05b94
[python] Turtle module improvements
boricj Oct 28, 2018
ca589b9
[python] Fix turtle icon dependency
boricj Oct 28, 2018
3a7ae27
[python] Fix turtle icon dependency (for real)
boricj Oct 28, 2018
9e24370
[python] Clean up turtle code and samples
boricj Oct 28, 2018
0c94f44
[python] Return value for turtle.pensize()
boricj Oct 30, 2018
fcf7cc3
[python] Implement turtle.position()
boricj Oct 30, 2018
c89a369
[python] Add getters for turtle module
boricj Oct 30, 2018
34f5aba
[python] Add turtle toolbox
boricj Oct 30, 2018
efaa87d
Merge branch 'master' into python_turtle
Ecco Nov 16, 2018
82f0b71
[python/turtle] Use micropython_port_interruptible_msleep
Ecco Nov 16, 2018
22a39a2
[python/turtle] Use a dedicated folder
Ecco Nov 16, 2018
fe076d0
[python/turtle] Use mp_float_t
Ecco Nov 16, 2018
a9091c9
[python/turtle] Use a Turtle class
Ecco Nov 16, 2018
7fc34fe
[python/turtle] Use an init method to reset the turtle
Ecco Nov 16, 2018
5748521
[python/turtle] Try to play well with uPy's GC
Ecco Nov 16, 2018
467ae9c
[python/turtle] Fix small typos
Ecco Nov 16, 2018
05a2491
[python/turtle] Fix the heading
Ecco Nov 16, 2018
49e8a50
[python] Fix micropython_port_interruptible_msleep
LeaNumworks Dec 5, 2018
1e78f20
[python] Return after interruption in possibly long turtle methods
LeaNumworks Dec 6, 2018
4b3ce7a
[python/turtle] Fix Turtle::setSpeed
LeaNumworks Dec 6, 2018
e769255
[python/turtle] Default pen size is 1
LeaNumworks Dec 6, 2018
d530637
[python/turtle] Fix speed type
LeaNumworks Dec 6, 2018
432e259
[python/turtle] Speed max and min should produce the same behavior
LeaNumworks Dec 6, 2018
3ca1790
[python/turtle] The Y axis is oriented upwards
LeaNumworks Dec 6, 2018
9c9355d
[python/turtle] Use Escher::Metric values instead of copying them
LeaNumworks Dec 6, 2018
cc3beb6
[python/turtle] Turtle::reset() method
LeaNumworks Dec 6, 2018
c8a5972
[python/turtle] Turtle::circle(radius, angle)
LeaNumworks Dec 7, 2018
e836593
[kandinsky] In KDContext::getPixels: beware of rects crossing the screen
LeaNumworks Dec 7, 2018
c95e291
[python/turtle] First icon redesign
LeaNumworks Dec 7, 2018
3b33425
[python/turlte] Move the turtle paws to mimic crawling
LeaNumworks Dec 10, 2018
3249ccb
[python/turtle] "back()" shortcut for "backwards()"
LeaNumworks Dec 10, 2018
fa0e93e
[python/turtle] Fix Turtle::circle for negative angles
LeaNumworks Dec 10, 2018
7efb48a
[python/turtle] Turtle::circle's angle argument is optional
LeaNumworks Dec 10, 2018
d545c45
[python/turtle] When speed = 0, do not draw the turtle during "goTo"
LeaNumworks Dec 10, 2018
23e3038
[python/turtle] Remove waitForVBlank before drawings
LeaNumworks Dec 10, 2018
62cda01
[python/turtle] color and pencolor can take various arguments
LeaNumworks Dec 11, 2018
3bd3e64
[python/turtle] Order the qstr
LeaNumworks Dec 11, 2018
99d71bb
[python/turtle] Clean Turtle::setColor
LeaNumworks Dec 12, 2018
8ac6098
[python/turtle] Remove old turtle icon
LeaNumworks Dec 12, 2018
91c4fea
[python/turtle] Clean Turtle::PawPosition
LeaNumworks Dec 12, 2018
306869e
[python/turtle] Tune values of the turtle speed
LeaNumworks Dec 11, 2018
609740b
[apps/code] Order catalog.universal.i18n
LeaNumworks Dec 17, 2018
8a3aa1a
[apps/code] Add turtle functions in th python toolbox
LeaNumworks Dec 17, 2018
b058b02
[apps/code] Add turtle functions in the toolbox catalog
LeaNumworks Dec 17, 2018
b3c11f2
[apps/code] Put turtle module higher in Python toolbox
LeaNumworks Dec 17, 2018
62de89c
[apps/code] Fix 'blue', 'red', ... python command insertion
LeaNumworks Dec 17, 2018
101370c
[escher] Change ToolboxMessageTree constructors
LeaNumworks Dec 17, 2018
ad745f7
[python/turtle] Add speed() methods without args
LeaNumworks Dec 17, 2018
ed19d19
Merge branch 'master' into python_turtle
LeaNumworks Dec 17, 2018
4b30679
[python/turtle] Turtle::m_drawn is false if sandbox not displayed
LeaNumworks Dec 17, 2018
de6646a
[build/emscripten] Add turtle symbols to the whitelist
LeaNumworks Dec 18, 2018
5a941bc
[python/turtle] Clean circle code
LeaNumworks Dec 21, 2018
c2dbe9f
[python/turtle] Fix line drawing glitches
LeaNumworks Dec 21, 2018
df2b9c4
[escher/apps] Get children count via template in ToolboxMessageTree::…
LeaNumworks Dec 21, 2018
03f300a
[python/turtle] Add showturtle and hideturtle to the toolbox
LeaNumworks Dec 27, 2018
384fa04
[apps/code] Change the default scripts: squares instead of factorial
LeaNumworks Dec 27, 2018
9b07f19
[apps/code] Squares script template: start by resetting the turtle
LeaNumworks Jan 3, 2019
4f4ae4e
Merge branch 'master' into python_turtle
LeaNumworks Jan 8, 2019
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

[escher/apps] Get children count via template in ToolboxMessageTree::…

…Node
  • Loading branch information...
LeaNumworks committed Dec 21, 2018
commit df2b9c4d81649b052bec17d87df0c360550194e1
@@ -8,43 +8,26 @@ extern "C" {

namespace Code {

static constexpr int catalogChildrenCount = 125;
static constexpr int MathModuleChildrenCount = 43;
static constexpr int KandinskyModuleChildrenCount = 7;
static constexpr int CMathModuleChildrenCount = 13;
static constexpr int RandomModuleChildrenCount = 10;
static constexpr int TurtleModuleChildrenCount = 30;

static constexpr int conditionsChildrenCount = 9;
static constexpr int forLoopChildrenCount = 4;
static constexpr int functionsChildrenCount = 2;
static constexpr int ifStatementChildrenCount = 5;
static constexpr int loopsAndTestsChildrenCount = 4;
static constexpr int menuChildrenCount = 4;
static constexpr int modulesChildrenCount = 5;
static constexpr int whileLoopChildrenCount = 1;


const ToolboxMessageTree forLoopChildren[forLoopChildrenCount] = {
const ToolboxMessageTree forLoopChildren[] = {
ToolboxMessageTree::Leaf(I18n::Message::ForInRange1ArgLoopWithArg, I18n::Message::Default, false, I18n::Message::ForInRange1ArgLoop),
ToolboxMessageTree::Leaf(I18n::Message::ForInRange2ArgsLoopWithArg, I18n::Message::Default, false, I18n::Message::ForInRange2ArgsLoop),
ToolboxMessageTree::Leaf(I18n::Message::ForInRange3ArgsLoopWithArg, I18n::Message::Default, false, I18n::Message::ForInRange3ArgsLoop),
ToolboxMessageTree::Leaf(I18n::Message::ForInListLoopWithArg, I18n::Message::Default, false, I18n::Message::ForInListLoop)
};

const ToolboxMessageTree ifStatementChildren[ifStatementChildrenCount] = {
const ToolboxMessageTree ifStatementChildren[] = {
ToolboxMessageTree::Leaf(I18n::Message::IfElseStatementWithArg, I18n::Message::Default, false, I18n::Message::IfElseStatement),
ToolboxMessageTree::Leaf(I18n::Message::IfThenStatementWithArg, I18n::Message::Default, false, I18n::Message::IfThenStatement),
ToolboxMessageTree::Leaf(I18n::Message::IfElifElseStatementWithArg, I18n::Message::Default, false, I18n::Message::IfElifElseStatement),
ToolboxMessageTree::Leaf(I18n::Message::IfAndIfElseStatementWithArg, I18n::Message::Default, false, I18n::Message::IfAndIfElseStatement),
ToolboxMessageTree::Leaf(I18n::Message::IfOrIfElseStatementWithArg, I18n::Message::Default, false, I18n::Message::IfOrIfElseStatement)
};

const ToolboxMessageTree whileLoopChildren[whileLoopChildrenCount] = {
const ToolboxMessageTree whileLoopChildren[] = {
ToolboxMessageTree::Leaf(I18n::Message::WhileLoopWithArg, I18n::Message::Default, false, I18n::Message::WhileLoop)
};

const ToolboxMessageTree conditionsChildren[conditionsChildrenCount] = {
const ToolboxMessageTree conditionsChildren[] = {
ToolboxMessageTree::Leaf(I18n::Message::EqualityConditionWithArg, I18n::Message::Default, false, I18n::Message::EqualityCondition),
ToolboxMessageTree::Leaf(I18n::Message::NonEqualityConditionWithArg, I18n::Message::Default, false, I18n::Message::NonEqualityCondition),
ToolboxMessageTree::Leaf(I18n::Message::SuperiorStrictConditionWithArg, I18n::Message::Default, false, I18n::Message::SuperiorStrictCondition),
@@ -56,14 +39,14 @@ const ToolboxMessageTree conditionsChildren[conditionsChildrenCount] = {
ToolboxMessageTree::Leaf(I18n::Message::ConditionNot, I18n::Message::Default, false)
};

const ToolboxMessageTree loopsAndTestsChildren[loopsAndTestsChildrenCount] = {
ToolboxMessageTree::Node(I18n::Message::ForLoopMenu, forLoopChildren, forLoopChildrenCount),
ToolboxMessageTree::Node(I18n::Message::IfStatementMenu, ifStatementChildren, ifStatementChildrenCount),
ToolboxMessageTree::Node(I18n::Message::WhileLoopMenu, whileLoopChildren, whileLoopChildrenCount),
ToolboxMessageTree::Node(I18n::Message::ConditionsMenu, conditionsChildren, conditionsChildrenCount)
const ToolboxMessageTree loopsAndTestsChildren[] = {
ToolboxMessageTree::Node(I18n::Message::ForLoopMenu, forLoopChildren),
ToolboxMessageTree::Node(I18n::Message::IfStatementMenu, ifStatementChildren),
ToolboxMessageTree::Node(I18n::Message::WhileLoopMenu, whileLoopChildren),
ToolboxMessageTree::Node(I18n::Message::ConditionsMenu, conditionsChildren)
};

const ToolboxMessageTree MathModuleChildren[MathModuleChildrenCount] = {
const ToolboxMessageTree MathModuleChildren[] = {
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandImportMath, I18n::Message::PythonImportMath, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandImportFromMath, I18n::Message::PythonImportFromMath, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandMathFunction, I18n::Message::PythonMathFunction, false, I18n::Message::PythonCommandMathFunctionWithoutArg),
@@ -109,7 +92,7 @@ const ToolboxMessageTree MathModuleChildren[MathModuleChildrenCount] = {
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandLgamma, I18n::Message::PythonLgamma)
};

const ToolboxMessageTree KandinskyModuleChildren[KandinskyModuleChildrenCount] = {
const ToolboxMessageTree KandinskyModuleChildren[] = {
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandImportKandinsky, I18n::Message::PythonImportKandinsky, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandImportFromKandinsky, I18n::Message::PythonImportFromKandinsky, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandKandinskyFunction, I18n::Message::PythonKandinskyFunction, false),
@@ -119,7 +102,7 @@ const ToolboxMessageTree KandinskyModuleChildren[KandinskyModuleChildrenCount] =
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandDrawString, I18n::Message::PythonDrawString)
};

const ToolboxMessageTree RandomModuleChildren[RandomModuleChildrenCount] = {
const ToolboxMessageTree RandomModuleChildren[] = {
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandImportRandom, I18n::Message::PythonImportRandom, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandImportFromRandom, I18n::Message::PythonImportFromRandom, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandRandomFunction, I18n::Message::PythonRandomFunction, false, I18n::Message::PythonCommandRandomFunctionWithoutArg),
@@ -132,7 +115,7 @@ const ToolboxMessageTree RandomModuleChildren[RandomModuleChildrenCount] = {
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandUniform, I18n::Message::PythonUniform)
};

const ToolboxMessageTree CMathModuleChildren[CMathModuleChildrenCount] = {
const ToolboxMessageTree CMathModuleChildren[] = {
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandImportCmath, I18n::Message::PythonImportCmath, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandImportFromCmath, I18n::Message::PythonImportFromCmath, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandCmathFunction, I18n::Message::PythonCmathFunction, false, I18n::Message::PythonCommandCmathFunctionWithoutArg),
@@ -148,7 +131,7 @@ const ToolboxMessageTree CMathModuleChildren[CMathModuleChildrenCount] = {
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandSinComplex, I18n::Message::PythonSin)
};

const ToolboxMessageTree TurtleModuleChildren[TurtleModuleChildrenCount] = {
const ToolboxMessageTree TurtleModuleChildren[] = {
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandImportTurtle, I18n::Message::PythonImportTurtle, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandImportFromTurtle, I18n::Message::PythonImportFromTurtle, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandTurtleFunction, I18n::Message::PythonTurtleFunction, false, I18n::Message::PythonCommandTurtleFunctionWithoutArg),
@@ -181,15 +164,15 @@ const ToolboxMessageTree TurtleModuleChildren[TurtleModuleChildrenCount] = {
ToolboxMessageTree::Leaf(I18n::Message::PythonTurtleCommandGrey, I18n::Message::PythonTurtleGrey, false)
};

const ToolboxMessageTree modulesChildren[modulesChildrenCount] = {
ToolboxMessageTree::Node(I18n::Message::MathModule, MathModuleChildren, MathModuleChildrenCount),
ToolboxMessageTree::Node(I18n::Message::CmathModule, CMathModuleChildren, CMathModuleChildrenCount),
ToolboxMessageTree::Node(I18n::Message::RandomModule, RandomModuleChildren, RandomModuleChildrenCount),
ToolboxMessageTree::Node(I18n::Message::TurtleModule, TurtleModuleChildren, TurtleModuleChildrenCount),
ToolboxMessageTree::Node(I18n::Message::KandinskyModule, KandinskyModuleChildren, KandinskyModuleChildrenCount)
const ToolboxMessageTree modulesChildren[] = {
ToolboxMessageTree::Node(I18n::Message::MathModule, MathModuleChildren),
ToolboxMessageTree::Node(I18n::Message::CmathModule, CMathModuleChildren),
ToolboxMessageTree::Node(I18n::Message::RandomModule, RandomModuleChildren),
ToolboxMessageTree::Node(I18n::Message::TurtleModule, TurtleModuleChildren),
ToolboxMessageTree::Node(I18n::Message::KandinskyModule, KandinskyModuleChildren)
};

const ToolboxMessageTree catalogChildren[catalogChildrenCount] = {
const ToolboxMessageTree catalogChildren[] = {
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandPound, I18n::Message::PythonPound, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandPercent, I18n::Message::PythonPercent, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommand1J, I18n::Message::Python1J, false),
@@ -317,19 +300,19 @@ const ToolboxMessageTree catalogChildren[catalogChildrenCount] = {
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandReal, I18n::Message::PythonReal, false, I18n::Message::PythonCommandRealWithoutArg)
};

const ToolboxMessageTree functionsChildren[functionsChildrenCount] = {
const ToolboxMessageTree functionsChildren[] = {
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandDefWithArg, I18n::Message::Default, false, I18n::Message::PythonCommandDef),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandReturn, I18n::Message::Default)
};

const ToolboxMessageTree menu[menuChildrenCount] = {
ToolboxMessageTree::Node(I18n::Message::LoopsAndTests, loopsAndTestsChildren, loopsAndTestsChildrenCount),
ToolboxMessageTree::Node(I18n::Message::Modules, modulesChildren, modulesChildrenCount),
ToolboxMessageTree::Node(I18n::Message::Catalog, catalogChildren, catalogChildrenCount),
ToolboxMessageTree::Node(I18n::Message::Functions, functionsChildren, functionsChildrenCount)
const ToolboxMessageTree menu[] = {
ToolboxMessageTree::Node(I18n::Message::LoopsAndTests, loopsAndTestsChildren),
ToolboxMessageTree::Node(I18n::Message::Modules, modulesChildren),
ToolboxMessageTree::Node(I18n::Message::Catalog, catalogChildren),
ToolboxMessageTree::Node(I18n::Message::Functions, functionsChildren)
};

const ToolboxMessageTree toolboxModel = ToolboxMessageTree::Node(I18n::Message::Toolbox, menu, menuChildrenCount);
const ToolboxMessageTree toolboxModel = ToolboxMessageTree::Node(I18n::Message::Toolbox, menu);


PythonToolbox::PythonToolbox() :
@@ -5,33 +5,31 @@

using namespace Poincare;

/* TODO: find a shorter way to initialize tree models
* We create one model tree: each node keeps the label of the row it refers to
/* We create one model tree: each node keeps the label of the row it refers to
* and the text which would be edited by clicking on the row. When the node is a
* subtree, the edited text is set at I18n::Message::Default. */


const ToolboxMessageTree calculChildren[4] = {
const ToolboxMessageTree calculChildren[] = {
ToolboxMessageTree::Leaf(I18n::Message::DiffCommandWithArg, I18n::Message::DerivateNumber, false, I18n::Message::DiffCommand),
ToolboxMessageTree::Leaf(I18n::Message::IntCommandWithArg, I18n::Message::Integral, false, I18n::Message::IntCommand),
ToolboxMessageTree::Leaf(I18n::Message::SumCommandWithArg, I18n::Message::Sum, false, I18n::Message::SumCommand),
ToolboxMessageTree::Leaf(I18n::Message::ProductCommandWithArg, I18n::Message::Product, false, I18n::Message::ProductCommand)
};

const ToolboxMessageTree complexChildren[5] = {
const ToolboxMessageTree complexChildren[] = {
ToolboxMessageTree::Leaf(I18n::Message::AbsCommandWithArg,I18n::Message::ComplexAbsoluteValue),
ToolboxMessageTree::Leaf(I18n::Message::ArgCommandWithArg, I18n::Message::Agument),
ToolboxMessageTree::Leaf(I18n::Message::ReCommandWithArg, I18n::Message::RealPart),
ToolboxMessageTree::Leaf(I18n::Message::ImCommandWithArg, I18n::Message::ImaginaryPart),
ToolboxMessageTree::Leaf(I18n::Message::ConjCommandWithArg, I18n::Message::Conjugate)
};

const ToolboxMessageTree probabilityChildren[2] = {
const ToolboxMessageTree probabilityChildren[] = {
ToolboxMessageTree::Leaf(I18n::Message::BinomialCommandWithArg, I18n::Message::Combination),
ToolboxMessageTree::Leaf(I18n::Message::PermuteCommandWithArg, I18n::Message::Permutation)
};

const ToolboxMessageTree arithmeticChildren[5] = {
const ToolboxMessageTree arithmeticChildren[] = {
ToolboxMessageTree::Leaf(I18n::Message::GcdCommandWithArg, I18n::Message::GreatCommonDivisor),
ToolboxMessageTree::Leaf(I18n::Message::LcmCommandWithArg, I18n::Message::LeastCommonMultiple),
ToolboxMessageTree::Leaf(I18n::Message::FactorCommandWithArg, I18n::Message::PrimeFactorDecomposition),
@@ -40,7 +38,7 @@ const ToolboxMessageTree arithmeticChildren[5] = {
};

#if MATRICES_ARE_DEFINED
const ToolboxMessageTree matricesChildren[6] = {
const ToolboxMessageTree matricesChildren[] = {
ToolboxMessageTree::Leaf(I18n::Message::MatrixCommandWithArg, I18n::Message::NewMatrix, false, I18n::Message::MatrixCommand),
ToolboxMessageTree::Leaf(I18n::Message::InverseCommandWithArg, I18n::Message::Inverse),
ToolboxMessageTree::Leaf(I18n::Message::DeterminantCommandWithArg, I18n::Message::Determinant),
@@ -51,7 +49,7 @@ const ToolboxMessageTree matricesChildren[6] = {
#endif

#if LIST_ARE_DEFINED
const ToolboxMessageTree listesChildren[5] = {
const ToolboxMessageTree listsChildren[] = {
ToolboxMessageTree::Leaf(I18n::Message::SortCommandWithArg, I18n::Message::Sort),
ToolboxMessageTree::Leaf(I18n::Message::InvSortCommandWithArg, I18n::Message::InvSort),
ToolboxMessageTree::Leaf(I18n::Message::MaxCommandWithArg, I18n::Message::Maximum),
@@ -60,57 +58,46 @@ const ToolboxMessageTree listesChildren[5] = {
};
#endif

const ToolboxMessageTree randomAndApproximationChildren[6] = {
const ToolboxMessageTree randomAndApproximationChildren[] = {
ToolboxMessageTree::Leaf(I18n::Message::RandomCommandWithArg, I18n::Message::RandomFloat),
ToolboxMessageTree::Leaf(I18n::Message::RandintCommandWithArg, I18n::Message::RandomInteger),
ToolboxMessageTree::Leaf(I18n::Message::FloorCommandWithArg, I18n::Message::Floor),
ToolboxMessageTree::Leaf(I18n::Message::FracCommandWithArg, I18n::Message::FracPart),
ToolboxMessageTree::Leaf(I18n::Message::CeilCommandWithArg, I18n::Message::Ceiling),
ToolboxMessageTree::Leaf(I18n::Message::RoundCommandWithArg, I18n::Message::Rounding)};

const ToolboxMessageTree trigonometryChildren[6] = {
const ToolboxMessageTree trigonometryChildren[] = {
ToolboxMessageTree::Leaf(I18n::Message::CoshCommandWithArg, I18n::Message::HyperbolicCosine),
ToolboxMessageTree::Leaf(I18n::Message::SinhCommandWithArg, I18n::Message::HyperbolicSine),
ToolboxMessageTree::Leaf(I18n::Message::TanhCommandWithArg, I18n::Message::HyperbolicTangent),
ToolboxMessageTree::Leaf(I18n::Message::AcoshCommandWithArg, I18n::Message::InverseHyperbolicCosine),
ToolboxMessageTree::Leaf(I18n::Message::AsinhCommandWithArg, I18n::Message::InverseHyperbolicSine),
ToolboxMessageTree::Leaf(I18n::Message::AtanhCommandWithArg, I18n::Message::InverseHyperbolicTangent)};

const ToolboxMessageTree predictionChildren[3] = {
const ToolboxMessageTree predictionChildren[] = {
ToolboxMessageTree::Leaf(I18n::Message::Prediction95CommandWithArg, I18n::Message::Prediction95),
ToolboxMessageTree::Leaf(I18n::Message::PredictionCommandWithArg, I18n::Message::Prediction),
ToolboxMessageTree::Leaf(I18n::Message::ConfidenceCommandWithArg, I18n::Message::Confidence)};

#if LIST_ARE_DEFINED
const ToolboxMessageTree menu[12] = {
#elif MATRICES_ARE_DEFINED
const ToolboxMessageTree menu[11] = {
#else
const ToolboxMessageTree menu[10] = {
#endif
const ToolboxMessageTree menu[] = {
ToolboxMessageTree::Leaf(I18n::Message::AbsCommandWithArg, I18n::Message::AbsoluteValue),
ToolboxMessageTree::Leaf(I18n::Message::RootCommandWithArg, I18n::Message::NthRoot),
ToolboxMessageTree::Leaf(I18n::Message::LogCommandWithArg, I18n::Message::BasedLogarithm),
ToolboxMessageTree::Node(I18n::Message::Calculation, calculChildren, 4),
ToolboxMessageTree::Node(I18n::Message::ComplexNumber, complexChildren, 5),
ToolboxMessageTree::Node(I18n::Message::Probability, probabilityChildren, 2),
ToolboxMessageTree::Node(I18n::Message::Arithmetic, arithmeticChildren, 5),
ToolboxMessageTree::Node(I18n::Message::Calculation, calculChildren),
ToolboxMessageTree::Node(I18n::Message::ComplexNumber, complexChildren),
ToolboxMessageTree::Node(I18n::Message::Probability, probabilityChildren),
ToolboxMessageTree::Node(I18n::Message::Arithmetic, arithmeticChildren),
#if MATRICES_ARE_DEFINED
ToolboxMessageTree::Node(I18n::Message::Matrices, matricesChildren, 6),
ToolboxMessageTree::Node(I18n::Message::Matrices, matricesChildren),
#endif
#if LIST_ARE_DEFINED
ToolboxMessageTree::Node(I18n::Message::Lists,listesChildren, 5),
#endif
ToolboxMessageTree::Node(I18n::Message::RandomAndApproximation, randomAndApproximationChildren, 6),
ToolboxMessageTree::Node(I18n::Message::HyperbolicTrigonometry, trigonometryChildren, 6),
ToolboxMessageTree::Node(I18n::Message::Fluctuation, predictionChildren, 3)};
#if LIST_ARE_DEFINED
const ToolboxMessageTree toolboxModel = ToolboxMessageTree::Node(I18n::Message::Toolbox, menu, 12);
#elif MATRICES_ARE_DEFINED
const ToolboxMessageTree toolboxModel = ToolboxMessageTree::Node(I18n::Message::Toolbox, menu, 11);
#else
const ToolboxMessageTree toolboxModel = ToolboxMessageTree::Node(I18n::Message::Toolbox, menu, 10);
ToolboxMessageTree::Node(I18n::Message::Lists,listsChildren),
#endif
ToolboxMessageTree::Node(I18n::Message::RandomAndApproximation, randomAndApproximationChildren),
ToolboxMessageTree::Node(I18n::Message::HyperbolicTrigonometry, trigonometryChildren),
ToolboxMessageTree::Node(I18n::Message::Fluctuation, predictionChildren)};

const ToolboxMessageTree toolboxModel = ToolboxMessageTree::Node(I18n::Message::Toolbox, menu);

MathToolbox::MathToolbox() :
Toolbox(nullptr, rootModel()->label())
@@ -14,13 +14,14 @@ class ToolboxMessageTree : public MessageTree {
0,
stripInsertedText);
};
constexpr static ToolboxMessageTree Node(I18n::Message label, const ToolboxMessageTree * children, int numberOfChildren) {
template <int N>
constexpr static ToolboxMessageTree Node(I18n::Message label, const ToolboxMessageTree (&children)[N]) {
return ToolboxMessageTree(
label,
(I18n::Message)0,
(I18n::Message)0,
children,
numberOfChildren,
N,
true);
}
const MessageTree * children(int index) const override { return &m_children[index]; }
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.