#include <Decoration.h>
Inheritance diagram for mcDecorationHelpers:
This is entirely defined & implemented through macros.
Definition at line 54 of file Decoration.h.
Public Member Functions | |
const mcElement & | data_GetConstChild (int n) const |
mcDecorationHelpers have no children (by default). | |
mcDecorationHelpers () | |
virtual | ~mcDecorationHelpers () |
void | data_DeepCopy (const mcElementHelpers *p) |
Deep copies all the info contained in this class. | |
mcExpSimRes | math_Simplify (long flags, mcElement *) |
Simplifies this element one "step"; that is, after one call to this function the element must be slightly changed. | |
mcExpSimRes | math_Expand (long flags, mcElement *) |
Expands this element one "step". | |
bool | math_CanBeAddedWith (const mcElement &p) const |
Returns TRUE if this element can be added with the given element. | |
bool | math_CanBeMultWith (const mcElement &p) const |
Works like #math_CanBemath_AddeWith(), just for multiplication. | |
bool | math_CanBeDivBy (const mcElement &p) const |
Works like #math_CanBemath_AddeWith(), just for divisions. | |
virtual mcBasicOpRes | math_Add (const mcElement &, mcElement *p, bool add) |
Sums or subtracts this element with the given e element. | |
virtual mcBasicOpRes | math_Subtract (const mcElement &, mcElement *p) |
math_s two mcElements of the same type and stores the result in this object. | |
virtual mcBasicOpRes | math_MultiplyBy (const mcElement &, mcElement *p) |
Multiplies two mcElements of the same type and stores the result in this object. | |
virtual mcBasicOpRes | math_DivideBy (const mcElement &, mcElement *p) |
Divides two mcElements of the same type and stores the result in this object. | |
void | math_SetExp (const mcPolynomial &p) |
Sets the exponent of this element to match the given polynomial. | |
mcBasicOpRes | math_MakeReciprocal (mcElement *e) |
Calculates the reciprocal of this element; tipically, this function creates a mcFraction whose numerator is 1 and the denominator contains *this. | |
mcBasicOpRes | math_RaiseTo (const mcPolynomial &) |
Raises *this element to the given polynomial. | |
mcMathType | math_GetMathType () const |
A powerful recognizer function which automatically classifies the type of the math data contained in this class and returns the respective identifier. | |
bool | math_Compare (const mcElement &p, long flags) const |
Compares *this element with the given one and then compare the children of *this and the children of the given element, too. | |
mcRealValue | math_Evaluate () const |
Evaluates the numeric value of this element and then returns it. | |
mcRealValue | math_GetLenght () const |
Returns the 'lenght' of this element without taking in count its children. | |
int | math_GetOrderPos () const |
Returns the order position for this element. | |
mcMonomial | math_GetLCM (const mcElement &) const |
Returns the LCM between *this and the given element. | |
mcMonomial | math_GetGCD (const mcElement &) const |
bool | io_isBeginTag (const wxXml2Node &tag) const |
Returns a positive value if the given MathML content tag marks the begin of this element; FALSE otherwise. | |
bool | io_isBeginChar (const wxString &str) const |
Returns a positive value if the given inlined expression marks the begin of this element; FALSE otherwise. | |
wxXml2Node | io_GetMathML (bool bGetPresentation) const |
Returns the MathML code for this element as presentation markup (http://www.w3.org/TR/MathML2/chapter3.html) or as content markup (http://www.w3.org/TR/MathML2/chapter4.html). | |
wxString | io_GetInlinedExpr () const |
Returns the inlined expression for this element as a wxString. | |
bool | io_ImportPresentationMathML (wxXml2Node tag, wxString &pErr) |
Imports presentation MathML reading the contents of the given XML node (without modifying it). | |
bool | io_ImportInlinedExpr (const wxString &str, int *count, wxString &pErr) |
Imports an inlined expression. | |
mcElementGUI overloaded functions | |
Implements the behaviour of a general decoration element. | |
bool | gui_isBeginKey (const mcKey &key) const |
Always returns FALSE: decorations generally are created by the program itself... | |
bool | gui_isEndKey (const mcKey &key) const |
Always returns FALSE: mcEmptyBox::gui_Input function handles all the keypresses returning mcIR_DELETE_this-> Empty boxes infact, should always be replaced by a new class. | |
mcInputRes | gui_Input (const mcKey &key, mcElement *pnew) |
This function is called when the cursor is inside the element and the user presses a key (which is not the element's end tag). | |
mcMoveCursorRes | gui_MoveCursor (mcMoveCursorFlag flag, long modifiers) |
This function is called to move the cursor which is inside the element, one 'step' left, right, up or down (when flag=mcMCF_LEFT/mcMCF_RIGHT/mcMCF_UP/mcMCF_DOWN). | |
mcInsertRes | gui_Insert (const mcElement &, mcElement *) |
Inserts the given element at the right of the cursor position. | |
int | gui_MoveCursorUsingPoint (wxDC &dc, const wxPoint &p) |
Moves the cursor inside this element in the closest available position to the given point. | |
int | gui_GetRelCursorPos (wxDC &dc, wxPoint *pt) const |
Returns the height of the cursor and the (x;y) position of the cursor (in the given pointer) relative to the top-left point of this element. | |
void | gui_SetCursorPos (const mcCursorPos &code) |
Sets the cursor position inside the element using Cursor Position flags. | |
void | gui_GetCursorPos (mcCursorPos &) const |
Returns the cursor position as Cursor Position flag. | |
mcCursorPos | gui_GetCursorPos () const |
Returns the cursor position after creating mcCursorPos. | |
Protected Member Functions | |
void | gui_Init () |
Inits this section of the element. | |
Protected Attributes | |
int | mgui_nCursorPos |
|
Definition at line 80 of file Decoration.h. |
|
Definition at line 81 of file Decoration.h. |
|
Deep copies all the info contained in this class. The mcElement implementation should be enough because all the element's data should be contained inside the associated mcElementData derived class. In fact, mcElementData does not provide a standard implementation of the DeepCopy() function. mcElement-derived classes, instead, should not contain any other variable, so this function should be enough.... Reimplemented from mcElementHelpers. Reimplemented in mcOperatorHelpers, mcParenthesisHelpers, and mcTextHelpers. Definition at line 97 of file Decoration.h. References mcElementHelpers::data_DeepCopy(), and mgui_nCursorPos. Referenced by mcParenthesisHelpers::data_DeepCopy(), and mcOperatorHelpers::data_DeepCopy(). |
|
mcDecorationHelpers have no children (by default).
Reimplemented from mcElementHelpers. Reimplemented in mcTextHelpers. Definition at line 60 of file Decoration.h. References mcEmptyElement. |
|
Returns the cursor position after creating mcCursorPos. This function uses the gui_GetCursorPos but it is a little slower since it allocates a mcCursorPos oject while the other overload uses an already existing object given by the caller. Reimplemented from mcElementHelpers. Definition at line 139 of file Decoration.h. References mcElementHelpers::gui_GetCursorPos(). Referenced by gui_GetRelCursorPos(), and gui_MoveCursor(). |
|
Returns the cursor position as Cursor Position flag. It must return mcCP_BEGIN if cursor is at the leftmost point of the element, mcCP_END if the cursor is at the rightmost point of the element, mcCP_INSIDE otherwise. When this function is called the cursor is always inside the element. Implements mcElementHelpers. Reimplemented in mcEmptyBoxHelpers, mcOperatorHelpers, and mcTextHelpers. Definition at line 136 of file Decoration.cpp. References mcCursorPos::gui_Push(), mcCP_BEGIN, mcCP_END, mcDECORATION_LEFT, mcDECORATION_RIGHT, and mgui_nCursorPos. |
|
Returns the height of the cursor and the (x;y) position of the cursor (in the given pointer) relative to the top-left point of this element. The function must fill the wxPoint pointer using coordinates relative to the top-left point of its bounding rectangle. When this function is called, the cursor is always inside the element.
Implements mcElementHelpers. Reimplemented in mcEmptyBoxHelpers, mcOperatorHelpers, and mcTextHelpers. Definition at line 116 of file Decoration.cpp. References gui_GetCursorPos(), mcElementHelpers::gui_GetHeight(), mcElementHelpers::gui_GetWidth(), and mcCursorPos::isBegin(). |
|
Inits this section of the element. Acts like a constructor (it's called by mcElementHelpers). Reimplemented from mcElementHelpers. Reimplemented in mcTextHelpers. Definition at line 86 of file Decoration.h. References mcElementHelpers::gui_Init(), and mcDECORATION_RIGHT. Referenced by mcTextHelpers::gui_Init(). |
|
This function is called when the cursor is inside the element and the user presses a key (which is not the element's end tag). The way the element should process the given character is dependent to the element type: a mcNumber will insert vk next to the cursor position if vk is a digit. If vk is not acceptable, the function should call the MathCore error-handler function, mcMathCore::Get()->SyntaxError. This function should return one of the values defined for mcInputRes: mcIR_OKAY, mcIR_DELETE_THIS, mcIR_DIRECT_DELETE, mcIR_DELETE_NEXT.
Implements mcElementHelpers. Reimplemented in mcEmptyBoxHelpers, mcOperatorHelpers, mcParenthesisHelpers, and mcTextHelpers. Definition at line 69 of file Decoration.cpp. References mcElementHelpers::data_AddProperty(), mcElementHelpers::data_hasProperty(), mcMathCore::Get(), mcElementHelpers::gui_RecalcSize(), mcMathCore::m_pCancelKey, mcKey::MatchKey(), mcEP_INITIALIZED, mcIR_DELETE_THIS, and mcIR_OKAY. Referenced by mcParenthesisHelpers::gui_Input(). |
|
Inserts the given element at the right of the cursor position.
Implements mcElementHelpers. Reimplemented in mcEmptyBoxHelpers. Definition at line 133 of file Decoration.h. References mcINSR_OKAY. |
|
Always returns FALSE: decorations generally are created by the program itself...
Implements mcElementHelpers. Reimplemented in mcEmptyBoxHelpers, mcMultDivOpHelpers, mcOperatorHelpers, mcParenthesisHelpers, and mcTextHelpers. Definition at line 122 of file Decoration.h. |
|
Always returns FALSE: mcEmptyBox::gui_Input function handles all the keypresses returning mcIR_DELETE_this-> Empty boxes infact, should always be replaced by a new class.
Implements mcElementHelpers. Reimplemented in mcEmptyBoxHelpers, mcOperatorHelpers, and mcTextHelpers. Definition at line 62 of file Decoration.cpp. |
|
This function is called to move the cursor which is inside the element, one 'step' left, right, up or down (when flag=mcMCF_LEFT/mcMCF_RIGHT/mcMCF_UP/mcMCF_DOWN). Elements which cannot move the cursor in the given direction, should call mcMathCore::Get()->SyntaxError() function. If the cursor must 'exit' the element (because its at the end, for example) the function must return mcMCR_SETFOCUS_PREVIOUS or mcMCR_SETFOCUS_NEXT. This function must always return the code mcMCR_SETFOCUS_* or mcMCR_OKAY. When this function is called, cursor is always inside the element.
Implements mcElementHelpers. Reimplemented in mcEmptyBoxHelpers, mcOperatorHelpers, and mcTextHelpers. Definition at line 90 of file Decoration.cpp. References gui_GetCursorPos(), mcDECORATION_LEFT, mcDECORATION_RIGHT, mcMCF_DOWN, mcMCF_LEFT, mcMCF_RIGHT, mcMCF_UP, mcMCR_OKAY, mcMCR_SETFOCUS_ABOVE, mcMCR_SETFOCUS_BELOW, mcMCR_SETFOCUS_NEXT, mcMCR_SETFOCUS_PREVIOUS, and mgui_nCursorPos. |
|
Moves the cursor inside this element in the closest available position to the given point. The function must use the given point to set its internal cursor-position variables (when this function is called, the given point is always inside the bounding rectangle of the element, but maybe the cursor is not).
Implements mcElementHelpers. Reimplemented in mcEmptyBoxHelpers, mcOperatorHelpers, and mcTextHelpers. Definition at line 107 of file Decoration.cpp. References mcDECORATION_LEFT, mcDECORATION_RIGHT, mcMCR_OKAY, and mgui_nCursorPos. |
|
Sets the cursor position inside the element using Cursor Position flags. When it's called to set the cursor at the end of the base, code==mcCP_END and data_hasProperty(mcEP_HASEXPONENT) == FALSE, when it's called to set the cursor at the beginning of the base, code==mcCP_BEGIN. The function doesnt need to care for the third Cursor Position flag: mcCP_INSIDE, actually this function will never be called with this code. Implements mcElementHelpers. Reimplemented in mcEmptyBoxHelpers, mcOperatorHelpers, and mcTextHelpers. Definition at line 128 of file Decoration.cpp. References mcDECORATION_LEFT, mcDECORATION_RIGHT, and mgui_nCursorPos. |
|
Returns the inlined expression for this element as a wxString. "Inlined expression" means a math representation of the data in a single line: to allow such a restriction (everything must be on one text line), some standard conventions (and many brackets !!!) are used:
Implements mcElementHelpers. Reimplemented in mcEmptyBoxHelpers, mcOperatorHelpers, and mcTextHelpers. Definition at line 161 of file Decoration.cpp. |
|
Returns the MathML code for this element as presentation markup (http://www.w3.org/TR/MathML2/chapter3.html) or as content markup (http://www.w3.org/TR/MathML2/chapter4.html).
Implements mcElementHelpers. Reimplemented in mcEmptyBoxHelpers, mcMultDivOpHelpers, mcOperatorHelpers, and mcTextHelpers. Definition at line 152 of file Decoration.cpp. References mcUNUSED. |
|
Imports an inlined expression.
"Inlined expression" means a string containing an encoded representation of math data: 234^2*ax+6y/2=0 is an inlined expression. This is the form which is used to input and output math data by a lot of math programs. Compability with these programs is crucial. However, because of the nature of this representation, the algorithm which recognizes (through io_isBeginChar functions) the elements to create, needs to know the lenght of the token which encodes this element; this is accomplished with the
Implements mcElementHelpers. Reimplemented in mcOperatorHelpers, mcParenthesisHelpers, and mcTextHelpers. Definition at line 180 of file Decoration.cpp. |
|
Imports presentation MathML reading the contents of the given XML node (without modifying it).
This function is called only if io_isBeginTag function returns a positive value for the name of parent tag of
Implements mcElementHelpers. Reimplemented in mcEmptyBoxHelpers, mcMultDivOpHelpers, mcOperatorHelpers, mcParenthesisHelpers, and mcTextHelpers. Definition at line 167 of file Decoration.cpp. References mcASSERT. |
|
Returns a positive value if the given inlined expression marks the begin of this element; FALSE otherwise. The begin tag cannot be dependent from any variable; it must be always the same. Implements mcElementHelpers. Reimplemented in mcOperatorHelpers, mcParenthesisHelpers, and mcTextHelpers. Definition at line 196 of file Decoration.h. |
|
Returns a positive value if the given MathML content tag marks the begin of this element; FALSE otherwise. The begin tag cannot be dependent from any variable; it must be always the same.
Implements mcElementHelpers. Reimplemented in mcEmptyBoxHelpers, mcOperatorHelpers, mcParenthesisHelpers, and mcTextHelpers. Definition at line 190 of file Decoration.h. |
|
Sums or subtracts this element with the given A unique function for add/subtract operations is used because the algorithms used to handle this two operations are usually almost identic and thus this avoids a lot of repetitions. If the two elements cannot be summed, then an ASSERT should fail since before using this function, the caller should always use the math_CanBeAddedWith() function.
The function returns one of mcBasicOpRes values, eventually using the Implements mcElementHelpers. Definition at line 158 of file Decoration.h. References mcBOR_REMOVE_OPERAND. |
|
Returns TRUE if this element can be added with the given element. If the function returns TRUE, then the math_Add() function should return one of mcBOR_REMOVE_OPERAND, mcBOR_REPLACE_BOTH or mcBOR_REPLACE_OPERAND. Implements mcElementHelpers. Definition at line 154 of file Decoration.h. |
|
Works like #math_CanBemath_AddeWith(), just for divisions.
Implements mcElementHelpers. Definition at line 156 of file Decoration.h. |
|
Works like #math_CanBemath_AddeWith(), just for multiplication.
Implements mcElementHelpers. Definition at line 155 of file Decoration.h. |
|
Compares *this element with the given one and then compare the children of *this and the children of the given element, too. If they are the same, then the function returns TRUE; FALSE otherwise. This function is different from #math_hasSameContentOf() because it doesn't work on MaxSimply()ed copies. This function tipically uses the math_CompareThisOnly() function. Implements mcElementHelpers. Reimplemented in mcOperatorHelpers. Definition at line 170 of file Decoration.h. |
|
Divides two mcElements of the same type and stores the result in this object.
Implements mcElementHelpers. Definition at line 161 of file Decoration.h. References mcBOR_REMOVE_OPERAND. |
|
Evaluates the numeric value of this element and then returns it. The evaluation can proceed *only* if this element does _not_ contain any parameter or unknown; in case it contains one of these, then the returned value is *mcRealValue::pNAN. Implements mcElementHelpers. Definition at line 173 of file Decoration.h. |
|
Expands this element one "step". expanding means that the aim of this function is exactly the opposite of math_Simplify: instead making the function body shorter, it tries to make it as long as possible: (x - 2)^3 . first call to math_Expand x^3 - 6x^2 + 12x -8 Implements mcElementHelpers. Definition at line 151 of file Decoration.h. References mcESR_DONE. |
|
Implements mcElementHelpers. Definition at line 195 of file Decoration.cpp. References mcEmptyElement. |
|
Returns the LCM between *this and the given element.
Implements mcElementHelpers. Definition at line 198 of file Decoration.cpp. References mcEmptyElement. |
|
Returns the 'lenght' of this element without taking in count its children. The wxT('lenght') of this element is the 'complexity' represented by the data placed in the mcElementData of this element. This is a key function for the simplify and expand routines of MathCore because through the use of this value, the system is able to decide if an operation determines a simplification or a complication. The simple example below shows how this can be done:
mcPolynomial mypol(NULL); mypol.Init("2^16"); mcRealValue n1 = mypol.math_GetTotalLenght(); */ (The math_GetTotalLenght() function works using this function !) The default implementation returns zero. This is a valid behaviour only for container elements, that is, for those elements where only the children carry information. For simple elements and for those containers which stand for an operation (like mcFraction which implies a division), the default implementation must be overridden. A lenght/complexity of 1 means that this element would require only a single byte of memory if stored in an ASCII string. An element long 2 units (like mcBracket) would require 2 bytes (one for the left parenthesis and one for the right one)... Implements mcElementHelpers. Reimplemented in mcOperatorHelpers. Definition at line 174 of file Decoration.h. |
|
A powerful recognizer function which automatically classifies the type of the math data contained in this class and returns the respective identifier.
Implements mcElementHelpers. Definition at line 167 of file Decoration.h. References mcMTL1_POLYNOMIAL, mcMTL2_ALGEBRAIC, and mcMTL3_CONSTANT. |
|
Returns the order position for this element.
Implements mcElementHelpers. Definition at line 177 of file Decoration.h. |
|
Calculates the reciprocal of this element; tipically, this function creates a mcFraction whose numerator is 1 and the denominator contains *this. This should be the default behaviour. A simple multiplication of the current exponent by -1 should be avoided when possible.
Reimplemented from mcElementHelpers. Definition at line 164 of file Decoration.h. References mcBOR_REMOVE_OPERAND. |
|
Multiplies two mcElements of the same type and stores the result in this object.
Implements mcElementHelpers. Definition at line 160 of file Decoration.h. References mcBOR_REMOVE_OPERAND. |
|
Raises *this element to the given polynomial. Returns mcBOR_INVALID if the operation could not be performed (this is typically because the base is negative), or mcBOR_REMOVE_OPERAND if the operation was okay.
Implements mcElementHelpers. Definition at line 165 of file Decoration.h. References mcBOR_REMOVE_OPERAND. |
|
Sets the exponent of this element to match the given polynomial. As for math_RaiseTo, for elements which do not have an exponent by their own, this function should just call the children's math_SetExp functions. Reimplemented from mcElementHelpers. Definition at line 163 of file Decoration.h. |
|
Simplifies this element one "step"; that is, after one call to this function the element must be slightly changed. For example, this monomial requires three calls to math_Simplify to be completely reduced in a basic form: 12ax*3 + 4a/(x^-1) . first call to math_Simplify 36ax + 4a/(1/x) . second call 36ax + 4ax . third call 40ax
Implements mcElementHelpers. Definition at line 150 of file Decoration.h. References mcESR_DONE. |
|
math_s two mcElements of the same type and stores the result in this object.
Reimplemented from mcElementHelpers. Definition at line 159 of file Decoration.h. References mcBOR_REMOVE_OPERAND. |
|
Reimplemented in mcTextHelpers. Definition at line 69 of file Decoration.h. Referenced by data_DeepCopy(), gui_GetCursorPos(), gui_MoveCursor(), gui_MoveCursorUsingPoint(), and gui_SetCursorPos(). |
[ Top ] |