#include <Element.h>
Inheritance diagram for mcElementHelpers:
This is the base class for the specialized classes containing the instances of their helper mcElementData-, mcElementGUI-, mcElementMath- mcElementIO-derived classes. mcElement-derived do not contain pointers to allocated classes: in this way we would have an enormous number of allocations: 1 due to mcElement + 4 due to helper classes (data, gui, math, io).
Definition at line 116 of file Element.h.
Math engine handy functions. | |
Virtual functions implemented using the abstract mcElementMath functions. | |
virtual mcExpSimRes | math_MaxSimplify (long flags) |
Completely simplifies this element. | |
virtual bool | math_isMaxSimplified (long flags) const |
Returns TRUE if the element is completely simplified; FALSE if calls to math_Simplify(long flags) will make changes to the element. | |
virtual int | math_GetSymbolList (mcSymbol **, int size, const mcSymbol &tofind) const |
Returns the number of symbols identic to the one given (uses #math_CompareWith to perform comparison) and place a pointer to each symbol in the given array of pointers of size 'size' . | |
virtual int | math_GetSymbolList (mcSymbol **, int size, mcSymbolProperties &tofind) const |
virtual bool | math_isConstant () const |
Returns TRUE if this element contains mcSymbol registered as constants and/or mcNumbers only. | |
virtual bool | math_EvaluatesTo (const mcRealValue &val) const |
Returns TRUE if this element can be evaluated (see math_Evaluate()) and its value matches the given one. | |
virtual mcRealValue | math_EvaluateAt (const mcSymbolProperties *sym, const mcRealValue &symval) const |
Returns the result of the math_Evaluate function called on a copy of this element with the given symbol substituted by the given value. | |
virtual bool | math_isFinite () const |
Returns TRUE if this element evaluates to a finite value; returns FALSE if this element could not be evaluated (result is NAN) or this element evaluates to a infinite value. | |
virtual mcRealValue | math_GetTotalLenght () const |
Returns the lenght of this element, taking in count also the children. | |
virtual void | math_SimpleAdd (const mcElement &p, bool add=TRUE) |
Adds the given element to this element using the math_Add() function and then checking that the return value is mcBOR_REMOVE_OPERAND: that is, the operation was completed successfully and *this now contains the result of the operation. | |
virtual void | math_SimpleSubtract (const mcElement &p) |
virtual void | math_SimpleMultiplyBy (const mcElement &p) |
virtual void | math_SimpleDivideBy (const mcElement &p) |
void | math_SimpleRaiseTo (const mcPolynomial &) |
Raises this element to the given mcPolynomial, checking that the return value is mcBOR_REMOVE_OPERAND. | |
bool | math_isValidMath () const |
Returns TRUE if *this element is math consistent, that is, it is not a mcParenthesis or a mcEmptyBox and it does not contain invalid math elements (this function is recursive). | |
virtual bool | math_isListedBeforeOf (const mcElement &p) const |
Returns TRUE if *this should be put before the given element in an ordered math list: this function is used by mcElementArray-derived classes to reorder their elements. | |
static bool | math_isExpAllowed (mcElement p) |
Use the following function to check if the given element can allocate an exponent. | |
static bool | math_isSubAllowed (mcElement p) |
Public Member Functions | |
mcElementHelpers () | |
Default constructor. | |
virtual | ~mcElementHelpers () |
virtual bool | io_Init (const wxString &str) |
Inits this element with the given INLINED expression; for more info about inlined expressions, see the mcElement::io_ImportInlinedExpr function. | |
Properties control functions | |
See the previous section for more info about properties. | |
virtual void | data_AddProperty (int p, void *val1=NULL, void *val2=NULL) |
Adds the given property to this element. | |
virtual void | data_RemoveProperty (int p) |
Removes the given property to this element. | |
virtual bool | data_hasProperty (int p) const |
Returns TRUE if this element has the given property set. | |
Recursive properties control functions | |
See the previous section for more info about properties. | |
virtual void | data_AddRecursiveProperty (mcElementType t, int p, void *val1=NULL, void *val2=NULL) |
math_Adds the given property to this element. | |
virtual void | data_RemoveRecursiveProperty (mcElementType t, int p) |
Removes the given property to this element. | |
virtual bool | data_hasRecursiveProperty (mcElementType t, int p) const |
Returns TRUE if this element has the given property set. | |
Abstract general functions | |
Functions which must be implemented in derived classes. | |
virtual mcElementHelpers * | data_Clone () const =0 |
Returns a pointer to a new object identical to the current element. | |
virtual int | data_GetMemoryInfo () const =0 |
Returns the size of this class and all its helper classes calculated using the sizeof() operator. | |
virtual mcElementType | data_GetType () const =0 |
Returns the identifier code for this class. | |
Standard methods (overridables) | |
Override only if necessary. | |
virtual void | data_DeepCopy (const mcElementHelpers *p) |
Deep copies all the info contained in this class. | |
virtual bool | data_isSameAs (const mcElementHelpers *) const |
Performs a deep comparison of the data hold by this class and the data hold by the given mcElementHelpers object. | |
virtual bool | data_isAllowedBefore (mcElementType type) const |
Returns TRUE if this element is allowed to be directly on the left of the given element type. | |
virtual bool | data_isAllowedAfter (mcElementType type) const |
Returns TRUE if this element is allows to be placed directly on the right of the given element type. | |
virtual mcElement & | data_GetElemFromID (int id) const |
Returns the element with the given ID. | |
virtual void | data_OnNeighborChange () |
Called by parent when neighbors change. | |
virtual void | data_Update () |
Updates this element and all its children (recursive function). | |
wxString | data_Debug (long) const |
Returns simple info about this element. | |
wxString | data_GetDebugName () const |
Functions which MUST be overridden by container classes | |
Functions which _MUST_ be overridden by container classes to ensure a correct behaviour of the element. | |
wxString | data_Check () const |
Does some standard checks on the element integrity. | |
virtual int | data_GetChildrenCount () const |
Returns the number of children attached to this tree node. | |
virtual const mcElement & | data_GetConstChild (int n) const |
Returns the n-th tree node attached to this element. | |
virtual mcElement & | data_GetChild (int n) |
Like data_GetConstChild, but this function returns a non-const pointer. | |
virtual void | data_SetChild (int idx, const mcElement &newchild) |
math_Replaces the idx-th child of this element with a copy of the given one. | |
virtual int | data_GetChildIdx (const mcElement &p) const |
Returns the index of the children which is allocated in the given memory address. | |
virtual bool | data_AddChildrenTo (mcElement p) |
Tries to attach the children of *this to the given element, respecting the math meaning of each one. | |
Standard methods (not overridables) | |
You just cannot override these functions... | |
int | data_GetID () const |
Returns the ID for this element. | |
void | data_Init () |
Inits this class calling the gui_Init, math_Init and io_Init functions, if required. | |
wxString | data_GetDebug (int, long) const |
Returns more complete debug information about this element (using the data_Debug function). | |
mcElement univocal begin and end characters | |
The characters that univocally defines the beginning and the ending of this element. | |
virtual bool | gui_isBeginKey (const mcKey &ev) const =0 |
Returns a positive value if the given character marks the begin of this element; FALSE otherwise. | |
virtual bool | gui_isEndKey (const mcKey &ev) const =0 |
Returns TRUE if the given character marks the end of this element; this function is always called before calling ::gui_Input function. | |
Pure virtual functions | |
Functions which must be implemented in the derived classes. | |
virtual int | gui_Draw (wxDC &dc, int x, int y, long flags, const wxPoint &pt) const =0 |
element must be drawn with mcElementHelpers::sgui_m_pActivationBrush background brush; if this pointer is equal to mcDRW_NONACTIVE, the function must simply draw everything with default transparent mode; if the pointer is not one of the previous values, the function must use the pointer to find the subelement where it lies. | |
virtual void | gui_DoRecalcSize ()=0 |
This function is called by mcElement and non-mcElement functions when the internal size variable must be updated due to a change in the structure of the element. | |
virtual int | gui_GetRelCursorPos (wxDC &dc, wxPoint *pt) const =0 |
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. | |
virtual mcMoveCursorRes | gui_MoveCursor (mcMoveCursorFlag flag, long modifiers)=0 |
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). | |
virtual int | gui_MoveCursorUsingPoint (wxDC &dc, const wxPoint &p)=0 |
Moves the cursor inside this element in the closest available position to the given point. | |
virtual void | gui_GetCursorPos (mcCursorPos &) const =0 |
Returns the cursor position as Cursor Position flag. | |
virtual mcCursorPos | gui_GetCursorPos () const |
Returns the cursor position after creating mcCursorPos. | |
virtual void | gui_SetCursorPos (const mcCursorPos &code)=0 |
Sets the cursor position inside the element using Cursor Position flags. | |
virtual mcInputRes | gui_Input (const mcKey &ev, mcElement *newelem)=0 |
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). | |
virtual mcInsertRes | gui_Insert (const mcElement &toinsert, mcElement *newelem)=0 |
Inserts the given element at the right of the cursor position. | |
Functions which MUST be overridden by container classes | |
Functions which _MUST_ be overridden by container classes to ensure a correct behaviour of the element.
Non-container classes should avoid to overload these functions. | |
virtual void | gui_OnSelect (wxDC &, wxRect &rc) |
This function is called when the bounding box of this element intersects with the selection rectangle created by the user with the mouse cursor. | |
virtual mcElement | gui_GetSelection () const |
Returns the selected portion of this element. | |
virtual void | gui_DeleteSelection () |
Deletes the selected children of this element, without breaking the integrity of this element: a data_Check() constcall after this function should throw no errors. | |
virtual mcElement & | gui_GetActiveElem (int x, int y, const wxPoint &pt) const |
Returns the currently active element; that is, the element currently under the mouse cursor (whose position is given) or NULL if there is no active element inside this one (for container elements). | |
Overrideables functions | |
Functions which can be overridden but that should work without changes. | |
virtual void | gui_SetStyleArray (const mcStyleArray *p) |
Changes recursively the styles of this element and the styles of all its children. | |
virtual void | gui_OnRecalcSize (wxSize old) |
Called by the mcElementHelpers::sgui_RecalcSize. | |
virtual void | gui_OnParentSizeChange () |
Called by parent when parent's size changes. | |
virtual void | gui_DeepRecalcSize () |
Recalculates the size of the elements and all the subelements contained into this one (this is not done normally by gui_RecalcSize). | |
virtual bool | gui_isAllSelected () const |
Returns TRUE only if the element and all its children are completely selected. | |
virtual void | gui_SelectAll () |
gui_Selects the entire element and all its children. | |
virtual void | gui_DeSelect () |
If this element is selected, this function deselects it. | |
virtual bool | gui_Split (mcElement *p) |
gui_Splits this element in two parts. | |
virtual bool | gui_MergeWith (const mcElement &) |
Merges the given element with this object. | |
virtual bool | gui_isSplittable () const |
Returns TRUE if this element supports splitting and, thus, also merging. | |
virtual void | gui_Select () |
Sets this element as selected. | |
virtual bool | gui_isSelected () const |
Returns TRUE if this element is selected (totally or partially). | |
virtual bool | gui_LetInCursor (mcCursorPos code) |
Returns TRUE if this element can accept cursor (and then calls the gui_SetCursorPos() function with the given code) or FALSE if the element, for some reason, cannot accept cursor (in this case this element should be skipped). | |
virtual void | gui_RecalcSize () |
Recalculates the size of the element, calling in any case the mcElement::gui_OnRecalcSize function. | |
int | gui_GetExpDepth () const |
Returns the exponent depth of this element. | |
virtual wxSize | gui_GetSize () const |
Returns the size; the returned size can be not up-to-date (this function cannot update size if it is invalid, because this is a CONST function; use gui_RecalcSize() before calling this function to be sure to get updated results). | |
virtual int | gui_GetWidth () const |
Returns the width of the element. | |
virtual int | gui_GetHeight () const |
Returns the width of the element. | |
virtual wxSize | gui_GetSize () |
Returns the updated size (in pixels) of the element. | |
virtual int | gui_GetWidth () |
Returns the updated width, in pixels, of this element. | |
virtual int | gui_GetHeight () |
Returns the updated height, in pixels, of this element. | |
virtual int | gui_GetYAnchor () const |
Returns the y amount of this mcElement to subtract from the center line to draw this element. | |
Styles non-STATIC functions. | |
Functions which makes style-access easier but requires a THIS pointer. | |
virtual void | gui_UpdateExpDepth () |
Called by mcElement's standard functions to update the exponent depth of member classes. | |
void | gui_SetAsExpOf (const mcElement &p) |
Sets this element as exponent of the given pointer. | |
void | gui_SetAtSameLevelOf (const mcElement &p) |
Sets this element at the same level of the given element. | |
void | gui_SetExpDepth (int n) |
Sets the exponent depth of this element. | |
const mcStyle * | gui_GetStyle (int n) const |
Returns the style associated with the n-th exponent depth using the style array owned by this element. | |
const mcStyleArray * | gui_GetStyleArray () const |
Returns the style array associated with this element. | |
wxSize | gui_GetSizeOfChar (wxDC *dc=NULL, const mcElement &p=mcEmptyElement) const |
Returns the size of a character (assume that fonts used are fixed pitch fonts and thus all characters have the same size) in the style used by the given pointer;. | |
int | gui_GetHeightOfChar (wxDC *, const mcElement &) const |
Returns only the height of gui_GetSizeOfChar. | |
int | gui_GetWidthOfChar (wxDC *, const mcElement &) const |
Returns only the width of gui_GetSizeOfChar. | |
const mcStyle * | gui_GetStyleForThis () const |
The style used to draw each element is chosen using the element's exponent level; use this function to retrieve the style which should be used for the currentelement. | |
void | gui_SelectStyle (wxDC &dc) const |
Automatically selects the style for the given element in the given DC, recognizing its mcElementType. | |
int | gui_GetThickness (wxDC *dc) const |
Returns the thickness (in pixels) the caller should use to draw decoration elements (for example, the fraction line). | |
int | gui_GetBaseOffsety (int h) const |
Use the following function to get the num of pixels between the exponent miny and the base miny; that is, the empty space between the exponent and the base on y axis. | |
int | gui_GetSubscriptOffsety (int h) const |
Returns the num of pixels between the base's bottom border and the subscript's (of the base) bottom border. | |
Search & replace | |
Various versions of math_Find() and math_Replace() functions. | |
mcElement | math_Find (int n, const mcElement &p, long flags=mcFIND_NOFLAGS) const |
Returns the n-th occurrence of an element with the same contents (this function uses #math_CompareWith, not #hasSameContentOf to perform the comparison !) or NULL if there is no an n-th occurrence of such an element. | |
mcElement | math_FindInChildrenOnly (int n, const mcElement &p, long flags=mcFIND_NOFLAGS) const |
Works like math_Find() but its action is limited to the children (recursively) of *this only and not also *this. | |
int | math_NonRecursiveFindInChildren (int n, const mcElement &p, long flags=mcFIND_NOFLAGS) const |
Works like math_FindInChildrenOnly() but this function does not search recursively; that is, this function won't search in the children of the children of *this. | |
virtual int | math_GetCountOf (const mcElement &p, long flags=mcFIND_NOFLAGS) const |
Returns the number of elements with the same contents of the given one contained into this one. | |
virtual int | math_GetCountOfChildrenOnly (const mcElement &p, long flags=mcFIND_NOFLAGS) const |
Works like math_GetCountOf() but does not compare the given element with *this, just with the children of *this. | |
virtual int | math_GetCountOf (const mcSymbolProperties *sym, long flags=mcFIND_NOFLAGS) const |
Returns the number of symbols of the given type contained in *this element and its children (recursive search). | |
virtual int | math_GetCountOf (const mcSymbolArray *arr, long flags=mcFIND_NOFLAGS) const |
Returns the number of symbols belonging to the given mcSymbolArray are contained in *this element and its children (recursive search). | |
virtual int | math_GetCountOfSymbolsType (const mcSymbolArray *arr, long flags=mcFIND_NOFLAGS) const |
Unlike #math_GetCountOf(const mcSymbolArray *, long) this function does not return the total number of symbols contained: it returns how many *types* of symbols of the given array are contained into *this and its children (recursive search). | |
virtual int | math_Replace (const mcElement &tofind, int n, long flags, const mcElement &replacement, bool bAttachChildren) |
Replaces the n-th occurrence of the element 'tofind' with a copy of the element 'replacement'. | |
virtual bool | math_Contains (const mcElement &p, long flags=mcFIND_NOFLAGS) const |
Returns TRUE if the given element is contained inside this one. | |
bool | math_ContainsOneOf (const mcSymbolArray *) const |
Returns TRUE if one of the symbols registered in the given array is contained inside this element. | |
virtual bool | math_ContainsSymbol (const mcSymbolProperties *s, const mcPolynomial &exp=mcEmptyPolynomial) const |
Returns TRUE if this element contains the given type of. | |
virtual bool | math_ContainsNumber (const mcRealValue &n, const mcPolynomial &exp=mcEmptyPolynomial) const |
virtual bool | math_ContainsUnknowns () const |
Returns TRUE if this element contains one or more unknowns. | |
virtual bool | math_ContainsConstants () const |
Like math_ContainsUnknowns() but the array checked is mcSymbol::arrConstants. | |
virtual bool | math_ContainsParameters () const |
Like math_ContainsUnknowns() but the array checked is mcSymbol::arrParameters. | |
virtual bool | math_ContainsSymbols () const |
Returns TRUE if this element contains at least one unknown/constant/parameter. | |
virtual bool | math_ContainsInvalidSymbols () const |
Returns TRUE if this element contains unregistered symbols. | |
Math engine ABSTRACT functions. | |
Abstract functions to implement in mcElementMath-derived classes. | |
virtual mcMathType | math_GetMathType () const =0 |
A powerful recognizer function which automatically classifies the type of the math data contained in this class and returns the respective identifier. | |
virtual mcRealValue | math_GetLenght () const =0 |
Returns the 'lenght' of this element without taking in count its children. | |
virtual mcExpSimRes | math_Simplify (long flags, mcElement *newelem)=0 |
Simplifies this element one "step"; that is, after one call to this function the element must be slightly changed. | |
virtual mcExpSimRes | math_Expand (long flags, mcElement *newelem)=0 |
Expands this element one "step". | |
virtual bool | math_Compare (const mcElement &p, long flags) const =0 |
Compares *this element with the given one and then compare the children of *this and the children of the given element, too. | |
virtual bool | math_CompareThisOnly (const mcElement &p, long flags) const |
Compares this element and the given one and then stops, unlike math_Compare() that compares children too. | |
virtual mcRealValue | math_Evaluate () const =0 |
Evaluates the numeric value of this element and then returns it. | |
virtual int | math_GetOrderPos () const =0 |
Returns the order position for this element. | |
virtual mcMonomial | math_GetFactors () const |
Factores-out everything which can be factored out from this element. | |
BASIC operations | |
Abstract functions defining basic add/sub/mult/div operations. | |
virtual bool | math_CanBeAddedWith (const mcElement &p) const =0 |
Returns TRUE if this element can be added with the given element. | |
virtual bool | math_CanBeMultWith (const mcElement &p) const =0 |
Works like #math_CanBemath_AddeWith(), just for multiplication. | |
virtual bool | math_CanBeDivBy (const mcElement &p) const =0 |
Works like #math_CanBemath_AddeWith(), just for divisions. | |
virtual mcBasicOpRes | math_Add (const mcElement &e, mcElement *pp, bool add=TRUE)=0 |
Sums or subtracts this element with the given e element. | |
mcBasicOpRes | math_Subtract (const mcElement &e, mcElement *pp) |
math_s two mcElements of the same type and stores the result in this object. | |
virtual mcBasicOpRes | math_MultiplyBy (const mcElement &e, mcElement *pp)=0 |
Multiplies two mcElements of the same type and stores the result in this object. | |
virtual mcBasicOpRes | math_DivideBy (const mcElement &e, mcElement *pp)=0 |
Divides two mcElements of the same type and stores the result in this object. | |
virtual mcMonomial | math_GetLCM (const mcElement &) const =0 |
Returns the LCM between *this and the given element. | |
virtual mcMonomial | math_GetGCD (const mcElement &) const =0 |
BASIC operations regarding EXPONENTS | |
Abstract functions defining basic raise/set op on the exp. | |
virtual mcBasicOpRes | math_RaiseTo (const mcPolynomial &)=0 |
Raises *this element to the given polynomial. | |
virtual mcBasicOpRes | math_MakeReciprocal (mcElement *replacement) |
Calculates the reciprocal of this element; tipically, this function creates a mcFraction whose numerator is 1 and the denominator contains *this. | |
virtual void | math_SetExp (const mcPolynomial &) |
Sets the exponent of this element to match the given polynomial. | |
Input & output functions (abstract functions) | |
These functions import or export the element's data. | |
virtual bool | io_isBeginTag (const wxXml2Node &tag) const =0 |
Returns a positive value if the given MathML content tag marks the begin of this element; FALSE otherwise. | |
virtual bool | io_isBeginChar (const wxString &str) const =0 |
Returns a positive value if the given inlined expression marks the begin of this element; FALSE otherwise. | |
virtual wxXml2Node | io_GetMathML (bool bGetPresentation) const =0 |
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). | |
virtual wxString | io_GetInlinedExpr () const =0 |
Returns the inlined expression for this element as a wxString. | |
virtual bool | io_ImportPresentationMathML (wxXml2Node tag, wxString &pErr)=0 |
Imports presentation MathML reading the contents of the given XML node (without modifying it). | |
virtual bool | io_ImportInlinedExpr (const wxString &str, int *count, wxString &pErr)=0 |
Imports an inlined expression. | |
Static Public Member Functions | |
BASIC CLASS SECTION | |
The class identifiers of MathCore classes (the possible values of mcElement::m_nType), and the functions which handle them. | |
static mcElementType | gui_isKeyBeginKey (const mcKey &ev) |
Returns the identifier code (mcET_****) of the class that uses the given char as begin char; mcET_INVALID if the function can't find any result. | |
static mcElementType | io_isCharBeginChar (const wxString &str) |
static mcElementType | io_isTagBeginTag (const wxXml2Node &tag) |
static mcElement | data_NewElem (mcElementType type, const mcElementHelpers *towrap=NULL) |
Allocates a new element of given type and set his parent to the given pointer (which must be NULL only for the root of the tree structure); then, eventually initializes it with the given inlined expression (if IO section is enabled !). | |
static mcElement * | data_GetInstanceOf (mcElementType type) |
Returns a pointer to an instance of the given element type. | |
static wxString | data_GetGlobalMemoryInfo () |
Returns a string containing the sizes of the various mcElement classes. | |
static void | data_UpdateElemArray () |
data_Updates the internal array of elements used by #GetInstanceOf and the isChar/Key/Tag/BeginXXXX() functions. | |
static int | data_GenID (bool bFirstMember=TRUE) |
Generates a unique number in the entire MathCore session, applying a fixed formula based on the current time and the random generator provided by standard libraries. | |
static void | Init () |
Inits all the static data of mcElement. | |
static void | Cleanup () |
Destroys all the static data of mcElement. | |
Styles STATIC functions | |
Defines a lot of attributes which are used to create the graphical output for all MathCore classes. | |
static void | gui_InitDefaultStyles () |
Resets the style array to the defaults, eventually deleting previous styles. | |
static void | gui_DeleteDefaultStyles () |
Removes the allocated styles from the default style array of mcElementGUI. | |
static double | gui_GetPointSize () |
Returns the style for the n-th exponent level. | |
static double | gui_PointSize2Pixels (double pointsize) |
Utility function: use it to convert point size units to pixels units. | |
static double | gui_Pixels2PointSize (double pointsize) |
Utility function: use it to convert pixels to point size units. | |
static wxSize | gui_GetSizeOf (wxDC *dc, const wxString &str) |
Returns the string height and width (using the selected font to determine them). | |
static int | gui_GetHeightOf (wxDC *, const wxString &) |
Returns only the height of ::gui_GetSizeOf. | |
static int | gui_GetWidthOf (wxDC *, const wxString &) |
Returns only the width of ::gui_GetSizeOf. | |
Static Public Attributes | |
static mcElement * | sdata_pElem [mcNUM_ELEMENT_TYPES] |
An array containing one instance of each class type; used by isCharBeginChar(char) function; it uses this array to call the io_isBeginChar() function of each element type to do its work (the pElem array is initialized at the moment of the allocation of the namespace; see MathCore.cpp). | |
static wxBrush * | sgui_pSelectionBrush = NULL |
The brush used to draw the selected portions of the math data. | |
static wxBrush * | sgui_pActivationBrush = NULL |
The brush used to draw active elements (elements which are located under the cursor). | |
static mcStyleArray * | sgui_pDefaultStyles = NULL |
The array of styles used by default by all mcElements. | |
static int | sgui_nAdditionalActivationSpaceLeftRight = 2 |
The additional number of pixels on the left & right of the active element to fill with sgui_pActivationBrush. | |
Protected Member Functions | |
virtual void | gui_Init () |
Inits this section of the element. | |
virtual void | math_Init () |
Initializes the MATH section of this element. | |
virtual mcElement | math_RecursiveFind (int &n, const mcElement &p, long flags) const |
Recursively search the n-th occurrence of the given element both in *this and both in *this' children using math_RecursiveFindInChildrenOnly(). | |
virtual mcElement | math_RecursiveFindInChildrenOnly (int &n, const mcElement &p, long flags) const |
Works exactly like math_RecursiveFind() except that this function does not perform comparison between p and *this. | |
virtual void | io_Init () |
Initializes the IO section of this element. | |
virtual void | io_PostProcess () |
Post-processes this element after the import-process. | |
virtual void | io_PostProcessChildren () |
Calls the io_PostProcess functions of all the children of this element; call this one just before exiting #io_ImportInlinedExpr and #io_ImportPresentationMathML. | |
Protected Attributes | |
int | mdata_nID |
The ID of this element. | |
int | mdata_nProperties |
The properties of this element, stored as bit array (use values defined in Element.h to check and set flags). | |
const mcStyleArray * | mgui_pStyleArray |
Array of MathCore styles; access this array indirectly using the gui_GetStyle() function. | |
bool | mgui_bSelected |
TRUE if the element is selected (totally or partially). | |
wxSize | mgui_sz |
Size of the element (in pixels). | |
int | mgui_nExpDepth |
The exponent level of this element. | |
Friends | |
class | mcElement |
|
Default constructor.
Definition at line 166 of file Element.cpp. References data_GenID(), and mcEP_NOPROPERTIES. |
|
|
|
Destroys all the static data of mcElement.
Definition at line 362 of file Element.cpp. References mcNUM_ELEMENT_TYPES, mcSAFE_DELETE, and sdata_pElem. Referenced by mcMathCore::CleanupMath(). |
|
Tries to attach the children of *this to the given element, respecting the math meaning of each one. If the function does not manage to perform its task, it returns FALSE (for example, when the given element's type and this.data_GetType() do not match). Definition at line 281 of file Element.cpp. References data_GetChild(), data_GetChildrenCount(), data_GetType(), mcElement::data_GetType(), and mcElement::data_SetChild(). |
|
Adds the given property to this element.
Reimplemented in mcElementArrayHelpers. Definition at line 367 of file Element.h. References mdata_nProperties. Referenced by data_AddRecursiveProperty(), mcExpElementHelpers::data_CreateExpSub(), mcSymbolHelpers::gui_BaseInput(), mcExpContainerHelpers::gui_BaseInput(), mcExpElementHelpers::gui_EditExpSub(), mcParenthesisHelpers::gui_Input(), mcFractionHelpers::gui_Input(), mcEmptyBoxHelpers::gui_Input(), mcDecorationHelpers::gui_Input(), mcFunctionHelpers::gui_Setup(), mcSymbolHelpers::io_ImportBaseInlinedExpr(), mcNumberHelpers::io_ImportBaseInlinedExpr(), mcSymbolHelpers::io_ImportPresentationMathML(), and mcNumberHelpers::io_ImportPresentationMathML(). |
|
math_Adds the given property to this element.
Definition at line 240 of file Element.cpp. References data_AddProperty(), mcElement::data_AddRecursiveProperty(), data_GetChild(), data_GetChildrenCount(), and data_GetType(). |
|
|
Returns a pointer to a new object identical to the current element. Derived classes must implement this function creating a new identical mcElement and returning it. See also mcIMPLEMENT_CLONE_FNC macro for a quick way to create this function.
Referenced by mcElement::data_MakePrivateCopy(), and math_isMaxSimplified(). |
|
Returns simple info about this element. It should return something in this form: [class name: 14 char, pad with spaces the end of the name if less than 14 characters][info specific for this element][with final '\n'] For example, for the mcSymbol class defining 'a', default debug output is: "mcSymbol a\n" |
|
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 in mcDecorationHelpers, mcElementArrayHelpers, mcExpContainerHelpers, mcExpElementHelpers, mcFractionHelpers, mcFunctionHelpers, mcMathLineHelpers, mcMathMngHelpers, mcMathSystemHelpers, mcNumberHelpers, mcOperatorHelpers, mcParenthesisHelpers, mcPolynomialHelpers, mcSymbolHelpers, and mcTextHelpers. Definition at line 584 of file Element.cpp. References data_GetType(), mcASSERT, mdata_nProperties, mgui_bSelected, mgui_nExpDepth, mgui_pStyleArray, and mgui_sz. Referenced by mcFractionHelpers::data_DeepCopy(), mcElementArrayHelpers::data_DeepCopy(), and mcDecorationHelpers::data_DeepCopy(). |
|
Generates a unique number in the entire MathCore session, applying a fixed formula based on the current time and the random generator provided by standard libraries. Exists a litte possibility that this function produces two identical values in the same MathCore session, but it's almost impossible.
Definition at line 482 of file Element.cpp. Referenced by mcElementHelpers(). |
|
Like data_GetConstChild, but this function returns a non-const pointer.
Definition at line 300 of file Element.cpp. References data_GetConstChild(). Referenced by data_AddChildrenTo(), data_AddRecursiveProperty(), mcMathSystemHelpers::data_Get(), mcMathAndSystemHelpers::data_GetLine(), mcMathOrSystemHelpers::data_GetSys(), data_RemoveRecursiveProperty(), data_Update(), gui_DeepRecalcSize(), gui_DeleteSelection(), gui_DeSelect(), gui_SelectAll(), gui_SetStyleArray(), io_PostProcessChildren(), and math_SetExp(). |
|
Returns the index of the children which is allocated in the given memory address. If the given pointer does not identify a children of this element, the returned value is -1. Definition at line 291 of file Element.cpp. References data_GetChildrenCount(), and data_GetConstChild(). |
|
|
Returns the n-th tree node attached to this element. You can use this function to traverse the entire tree:
mcElement rootnode = [...]; MyWalkerFnc(rootnode); void MyWalkerFnc(mcElement p) { // do what you want on the "p" node... for (int i=0; i < p.data_GetChildrenCount(); i++) MyWalkerFnc(p.data_GetChild(i)); }
Reimplemented in mcDecorationHelpers, mcElementArrayHelpers, mcExpContainerHelpers, mcExpElementHelpers, mcFractionHelpers, mcFunctionHelpers, mcMathMngHelpers, mcMathSystemHelpers, and mcTextHelpers. Definition at line 303 of file Element.cpp. References mcEmptyElement. Referenced by data_GetChild(), data_GetChildIdx(), data_GetElemFromID(), data_hasRecursiveProperty(), data_isSameAs(), gui_isAllSelected(), math_GetCountOf(), math_GetCountOfChildrenOnly(), math_GetTotalLenght(), math_isValidMath(), math_NonRecursiveFindInChildren(), math_RecursiveFind(), and math_RecursiveFindInChildrenOnly(). |
|
Returns more complete debug information about this element (using the data_Debug function).
|
|
Reimplemented in mcExpContainerHelpers. |
|
Returns the element with the given ID. Non-container classes should just return their ID (which is the default implementation behaviour). Container classes, instead, should search recursively among their children and then return the one which matches with the given ID. If the element with the given ID cannot be found, this function returns NULL. Definition at line 225 of file Element.cpp. References data_GetChildrenCount(), data_GetConstChild(), mcElement::data_GetElemFromID(), and mcEmptyElement. Referenced by gui_GetActiveElem(). |
|
Returns a string containing the sizes of the various mcElement classes.
Definition at line 468 of file Element.cpp. References data_GetMemoryInfo(), mcNUM_ELEMENT_TYPES, and sdata_pElem. |
|
Returns the ID for this element.
Definition at line 606 of file Element.h. References mdata_nID. Referenced by mcTextHelpers::gui_Draw(), mcParenthesisHelpers::gui_Draw(), mcOperatorHelpers::gui_Draw(), mcMultDivOpHelpers::gui_Draw(), mcFractionHelpers::gui_Draw(), mcExpElementHelpers::gui_Draw(), mcEmptyBoxHelpers::gui_Draw(), mcSymbolHelpers::gui_DrawBase(), mcNumberHelpers::gui_DrawBase(), mcFunctionHelpers::gui_DrawBase(), and mcExpContainerHelpers::gui_DrawBase(). |
|
Returns a pointer to an instance of the given element type. The given pointer must not be modified and it is completely unlinked from any tree (no parents, no children). Definition at line 159 of file Element.h. References sdata_pElem. Referenced by mcElementArrayHelpers::math_GetOpBetween(), mcElementArrayHelpers::math_GetOpPreceding(), and mcPolynomialHelpers::math_SimplifySolveOp(). |
|
Returns the size of this class and all its helper classes calculated using the sizeof() operator. See the mcDEFINE_GETMEMORYINFO_FNC macro for a quick way to implement this function. Referenced by data_GetGlobalMemoryInfo(). |
|
|
|
Returns TRUE if this element has the given property set.
Definition at line 250 of file Element.cpp. References data_GetChildrenCount(), data_GetConstChild(), data_GetType(), and mdata_nProperties. |
|
Inits this class calling the gui_Init, math_Init and io_Init functions, if required. This function should called by the last overload of the constructor of the mcElementHelpers-derived class, that is, when the build process is completed and the xxx_Init() functions called are the functions of the derived class. Reimplemented in mcMathMngHelpers. Definition at line 179 of file Element.cpp. References gui_Init(), io_Init(), and math_Init(). Referenced by mcMathMngHelpers::data_Init(), mcBracketHelpers::mcBracketHelpers(), mcFunctionHelpers::mcFunctionHelpers(), mcMathAndSystemHelpers::mcMathAndSystemHelpers(), and mcMathOrSystemHelpers::mcMathOrSystemHelpers(). |
|
Returns TRUE if this element is allows to be placed directly on the right of the given element type. See #isAllowedBefore for more info. Reimplemented in mcNumberHelpers. Definition at line 458 of file Element.h. Referenced by mcMonomialHelpers::data_Repair(). |
|
Returns TRUE if this element is allowed to be directly on the left of the given element type. If this function returns FALSE (default implementation returns TRUE), the container element will interpose a mcMultOp between this element and the following.
Reimplemented in mcNumberHelpers, and mcOperatorHelpers. Definition at line 453 of file Element.h. Referenced by mcMonomialHelpers::data_Repair(), and mcMonomialHelpers::gui_BackInput(). |
|
Performs a deep comparison of the data hold by this class and the data hold by the given mcElementHelpers object.
Reimplemented in mcElementArrayHelpers, mcExpContainerHelpers, mcFractionHelpers, mcFunctionHelpers, mcNumberHelpers, and mcSymbolHelpers. Definition at line 562 of file Element.cpp. References data_GetChildrenCount(), data_GetConstChild(), data_GetType(), and mdata_nProperties. |
|
|
Called by parent when neighbors change. Override this function if you need to do something when neighbor elements change (remember to set up the flag mcEP_NOTIFY_NEIGHBOR_CHANGE in the constructor). Reimplemented in mcParenthesisHelpers. |
|
Removes the given property to this element.
Definition at line 375 of file Element.h. References mdata_nProperties. Referenced by mcExpElementHelpers::data_DestroyExpSub(), and mcExpElementHelpers::gui_DeleteExpSub(). |
|
Removes the given property to this element.
Definition at line 262 of file Element.cpp. References data_GetChild(), data_GetChildrenCount(), data_GetType(), mcElement::data_RemoveRecursiveProperty(), and mdata_nProperties. |
|
math_Replaces the idx-th child of this element with a copy of the given one.
Reimplemented in mcElementArrayHelpers, mcExpContainerHelpers, mcExpElementHelpers, mcFractionHelpers, mcFunctionHelpers, and mcTextHelpers. |
|
Updates this element and all its children (recursive function). Default implementation of data_Update() does nothing: override it if you need to do something else... Reimplemented in mcSymbolHelpers. Definition at line 272 of file Element.cpp. References data_GetChild(), data_GetChildrenCount(), and mcElement::data_Update(). |
|
data_Updates the internal array of elements used by #GetInstanceOf and the isChar/Key/Tag/BeginXXXX() functions. This function is typically used by mcMathCore functions only; however it is public to allow special uses. Definition at line 368 of file Element.cpp. References data_NewElem(), mcElement, mcNUM_ELEMENT_TYPES, mcSAFE_DELETE, and sdata_pElem. Referenced by Init(). |
|
Recalculates the size of the elements and all the subelements contained into this one (this is not done normally by gui_RecalcSize). This function must be obviously overridden by container classes. The standard implementation recalculates the size of this element and the sizes of the children. Definition at line 703 of file Element.cpp. References data_GetChild(), data_GetChildrenCount(), mcElement::gui_DeepRecalcSize(), gui_RecalcSize(), mcGUILOG, and mcTXTTHIS. Referenced by mcPolynomialHelpers::gui_Input(). |
|
Removes the allocated styles from the default style array of mcElementGUI. This function must be called only when styles will no longer be used (like in program shutdown).
Definition at line 895 of file Element.cpp. References mcSAFE_DELETE, and sgui_pDefaultStyles. Referenced by mcMathCore::CleanupGUI(), and gui_InitDefaultStyles(). |
|
Deletes the selected children of this element, without breaking the integrity of this element: a data_Check() constcall after this function should throw no errors. The caller should first check if the element is entirely selected; if it is, the element should be deleted (by the caller) and this function should not be called. This is a recursive function. Reimplemented in mcElementArrayHelpers, mcFractionHelpers, and mcMathMngHelpers. Definition at line 746 of file Element.cpp. References data_GetChild(), data_GetChildrenCount(), mcElement::gui_DeleteSelection(), gui_isAllSelected(), gui_RecalcSize(), and mcASSERT. Referenced by mcFractionHelpers::gui_DeleteSelection(). |
|
If this element is selected, this function deselects it. Use this function to turn off selection; you can't directly access mcElement::mgui_bSelected variable because when selection state change, also derived classes' selection states must change. This function ensures this is done, calling the #data_Updategui_SelectionState() function. To select the element, see gui_OnSelect function(). Definition at line 725 of file Element.cpp. References data_GetChild(), data_GetChildrenCount(), mcElement::gui_DeSelect(), and mgui_bSelected. Referenced by mcElementArrayHelpers::gui_ExOnSelect(), mcMathSystemHelpers::gui_OnSelect(), mcMathMngHelpers::gui_OnSelect(), mcFractionHelpers::gui_OnSelect(), and mcExpElementHelpers::gui_OnSelect(). |
|
This function is called by mcElement and non-mcElement functions when the internal size variable must be updated due to a change in the structure of the element. This function should be as fast and accurate as possible and it must store the new size in the mgui_sz variable.
Implemented in mcElementArrayHelpers, mcEmptyBoxHelpers, mcExpElementHelpers, mcFractionHelpers, mcMathLineHelpers, mcMathMngHelpers, mcMathSystemHelpers, mcMultDivOpHelpers, mcOperatorHelpers, mcParenthesisHelpers, and mcTextHelpers. Referenced by gui_RecalcSize(). |
|
element must be drawn with mcElementHelpers::sgui_m_pActivationBrush background brush; if this pointer is equal to mcDRW_NONACTIVE, the function must simply draw everything with default transparent mode; if the pointer is not one of the previous values, the function must use the pointer to find the subelement where it lies. Then, only the subelement's gui_Draw() function must be called with the initial pointer. The subelements must be called with mcDRW_ALLACTIVE flag only for special reasons.
Implemented in mcElementArrayHelpers, mcEmptyBoxHelpers, mcExpElementHelpers, mcFractionHelpers, mcMathMngHelpers, mcMathSystemHelpers, mcMonomialHelpers, mcMultDivOpHelpers, mcOperatorHelpers, mcParenthesisHelpers, mcPolynomialHelpers, and mcTextHelpers. Referenced by gui_GetActiveElem(). |
|
Returns the currently active element; that is, the element currently under the mouse cursor (whose position is given) or NULL if there is no active element inside this one (for container elements). The default implementation of this function returns the element itself but container classes should return the active subelement. Definition at line 680 of file Element.cpp. References data_GetElemFromID(), gui_Draw(), mcDRW_NOACTIVEELEM, mcDRW_ONSELECTION, mcDRW_USEPOINT, and mcEmptyElement. |
|
Use the following function to get the num of pixels between the exponent miny and the base miny; that is, the empty space between the exponent and the base on y axis. This function should be used every time an exp must be drawn; in this way, we ensure that all the exponents appear always at the same level over the base.
Definition at line 917 of file Element.cpp. Referenced by mcExpElementHelpers::gui_GetBaseOffsety(). |
|
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 in mcDecorationHelpers, and mcElementArrayHelpers. Definition at line 797 of file Element.h. Referenced by mcFunctionHelpers::gui_BaseMoveCursor(), mcFunctionHelpers::gui_GetBaseCursorPos(), mcMathSystemHelpers::gui_GetCursorPos(), mcMathMngHelpers::gui_GetCursorPos(), mcElementArrayHelpers::gui_GetCursorPos(), and mcDecorationHelpers::gui_GetCursorPos(). |
|
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. Implemented in mcDecorationHelpers, mcElementArrayHelpers, mcEmptyBoxHelpers, mcExpElementHelpers, mcFractionHelpers, mcMathMngHelpers, mcMathSystemHelpers, mcOperatorHelpers, and mcTextHelpers. |
|
Returns the exponent depth of this element. This is a positive value; for more info see mgui_nExpDepth. Definition at line 1003 of file Element.h. References mgui_nExpDepth. Referenced by mcOperatorHelpers::gui_DoRecalcSize(), and mcElementArrayHelpers::gui_GetSpaceBetween(). |
|
Returns the updated height, in pixels, of this element.
Definition at line 1043 of file Element.h. References gui_RecalcSize(), and mgui_sz. |
|
|
Returns only the height of ::gui_GetSizeOf.
Definition at line 1020 of file Element.cpp. References gui_GetSizeOf(). Referenced by mcOperatorHelpers::gui_DoRecalcSize(), and mcNumberHelpers::gui_GetBaseRelCursorPos(). |
|
Returns only the height of gui_GetSizeOfChar.
Definition at line 1057 of file Element.cpp. References mcASSERT, and mcGUILOG. Referenced by mcNumberHelpers::gui_BaseMoveCursorUsingPoint(), mcEmptyBoxHelpers::gui_DoRecalcSize(), mcNumberHelpers::gui_GetBaseRelCursorPos(), gui_GetSizeOfChar(), and mcParenthesisHelpers::gui_RebuildFont(). |
|
Returns the style for the n-th exponent level. This function is static, so it can be used in this way:
*/ //| [...] mcElementHelpers::sgui_GetStyle(0).[...] //! /** Returns the number of pixels per point size using the current screen settings to compute them. This is an utility function used by gui_PointSize2Pixels & gui_Pixels2PointSize. Definition at line 876 of file Element.cpp. Referenced by gui_Pixels2PointSize(), and gui_PointSize2Pixels(). |
|
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.
Implemented in mcDecorationHelpers, mcElementArrayHelpers, mcEmptyBoxHelpers, mcExpElementHelpers, mcFractionHelpers, mcMathLineHelpers, mcMathMngHelpers, mcMathSystemHelpers, mcOperatorHelpers, and mcTextHelpers. |
|
Returns the selected portion of this element. If this element is entirely selected (this is the default for non-container elements), the entire element should be returned (this is what the default implementation does). Container elements should override this function returning only the selected elements (in mcMonomials, mcBrackets, mcPolynomials...) or the entire element itself if it is entirely selected. This functions returns an object and not a reference to an object (as for example does gui_GetActiveElem) because the selection cannot be modified through this function. Reimplemented in mcElementArrayHelpers, mcExpElementHelpers, mcFractionHelpers, mcMathAndSystemHelpers, mcMathLineHelpers, mcMathMngHelpers, and mcMathOrSystemHelpers. Definition at line 673 of file Element.cpp. References mcElement. Referenced by mcMathSystemHelpers::gui_GetSelInlinedExpr(). |
|
Returns the updated size (in pixels) of the element.
Definition at line 1023 of file Element.h. References gui_RecalcSize(), and mgui_sz. |
|
Returns the size; the returned size can be not up-to-date (this function cannot update size if it is invalid, because this is a CONST function; use gui_RecalcSize() before calling this function to be sure to get updated results).
Definition at line 1009 of file Element.h. References mgui_sz. Referenced by mcExpContainerHelpers::gui_BaseMoveCursorUsingPoint(), mcFractionHelpers::gui_Draw(), mcExpElementHelpers::gui_Draw(), mcExpElementHelpers::gui_DrawActivationRect(), mcExpContainerHelpers::gui_DrawBase(), mcFractionHelpers::gui_GetRelCursorPos(), gui_GetYAnchor(), mcFractionHelpers::gui_MoveCursorUsingPoint(), mcExpContainerHelpers::gui_OnBaseSelect(), mcFractionHelpers::gui_OnSelect(), and mcExpElementHelpers::gui_OnSelect(). |
|
Returns the string height and width (using the selected font to determine them).
Definition at line 985 of file Element.cpp. References mcASSERT, and mcGUILOG. Referenced by mcSymbolHelpers::gui_DoRecalcBaseSize(), mcNumberHelpers::gui_DoRecalcBaseSize(), mcBracketHelpers::gui_DoRecalcBaseSize(), mcParenthesisHelpers::gui_DoRecalcSize(), gui_GetHeightOf(), gui_GetWidthOf(), mcMathMngHelpers::gui_RecalcSeparatorSize(), mcMathOrSystemHelpers::gui_RecalcSymbolSize(), and mcMathAndSystemHelpers::gui_RecalcSymbolSize(). |
|
Returns the size of a character (assume that fonts used are fixed pitch fonts and thus all characters have the same size) in the style used by the given pointer;.
Definition at line 1024 of file Element.cpp. References gui_GetHeightOfChar(), and gui_GetWidthOfChar(). |
|
Returns the style associated with the n-th exponent depth using the style array owned by this element. If you want to get the default style for the n-th exponent depth, you can use the #gui_GetDefaultStyle() function. Definition at line 940 of file Element.cpp. References mcStyleArray::Get(), and mgui_pStyleArray. Referenced by mcMathMngHelpers::gui_SelectSeparatorStyle(). |
|
Returns the style array associated with this element.
Definition at line 1168 of file Element.h. References mgui_pStyleArray. Referenced by mcOperatorHelpers::gui_DoRecalcSize(). |
|
The style used to draw each element is chosen using the element's exponent level; use this function to retrieve the style which should be used for the currentelement. VERY IMPORTANT: the style shouldn't be stored in any variable; it should be chosen on the fly during draw functions (style could change between two 'steps').
Definition at line 931 of file Element.cpp. References mcStyleArray::gui_GetStyleFor(), and mgui_pStyleArray. Referenced by gui_SelectStyle(). |
|
Returns the num of pixels between the base's bottom border and the subscript's (of the base) bottom border.
Definition at line 924 of file Element.cpp. Referenced by mcExpElementHelpers::gui_GetExpSubOffsety(). |
|
Returns the thickness (in pixels) the caller should use to draw decoration elements (for example, the fraction line).
Definition at line 962 of file Element.cpp. References gui_SelectStyle(), and mcGUILOG. Referenced by mcRadicalHelpers::gui_DoRecalcBaseSize(), mcFractionHelpers::gui_Draw(), mcRadicalHelpers::gui_DrawContainer(), mcRadicalHelpers::gui_GetContentOffsetY(), and mcFractionHelpers::gui_GetYAnchor(). |
|
Returns the updated width, in pixels, of this element.
Definition at line 1034 of file Element.h. References gui_RecalcSize(), and mgui_sz. |
|
|
Returns only the width of ::gui_GetSizeOf.
Definition at line 1016 of file Element.cpp. References gui_GetSizeOf(). Referenced by mcTextHelpers::gui_DoRecalcSize(), mcOperatorHelpers::gui_DoRecalcSize(), mcNumberHelpers::gui_GetBaseRelCursorPos(), and mcTextHelpers::gui_GetRelCursorPos(). |
|
Returns only the width of gui_GetSizeOfChar.
Definition at line 1029 of file Element.cpp. References mcASSERT, and mcGUILOG. Referenced by mcNumberHelpers::gui_BaseMoveCursorUsingPoint(), mcEmptyBoxHelpers::gui_DoRecalcSize(), and gui_GetSizeOfChar(). |
|
Returns the y amount of this mcElement to subtract from the center line to draw this element.
Reimplemented in mcElementArrayHelpers, mcExpContainerHelpers, mcExpElementHelpers, mcFractionHelpers, and mcMathMngHelpers. Definition at line 1051 of file Element.h. References gui_GetSize(). |
|
Inits this section of the element. Acts like a constructor (it's called by mcElementHelpers). Reimplemented in mcDecorationHelpers, mcElementArrayHelpers, mcExpContainerHelpers, mcExpElementHelpers, mcFractionHelpers, mcFunctionHelpers, mcMathLineHelpers, mcMathMngHelpers, mcMathSystemHelpers, mcNumberHelpers, mcPolynomialHelpers, mcSymbolHelpers, and mcTextHelpers. Definition at line 608 of file Element.cpp. References gui_RecalcSize(), mcASSERT, mgui_bSelected, mgui_pStyleArray, mgui_sz, mcStyleArray::Set(), and sgui_pDefaultStyles. Referenced by data_Init(), mcMathSystemHelpers::gui_Init(), mcMathMngHelpers::gui_Init(), mcFractionHelpers::gui_Init(), mcExpElementHelpers::gui_Init(), mcElementArrayHelpers::gui_Init(), and mcDecorationHelpers::gui_Init(). |
|
Resets the style array to the defaults, eventually deleting previous styles. This function should be called at the beginning of the program, before styles are used.
Definition at line 785 of file Element.cpp. References gui_DeleteDefaultStyles(), mcASSERT, mcET_ADDOP, mcET_FUNCTION, mcET_NUMBER, mcET_SYMBOL, mcET_TEXT, mcGUILOG, mcINITWX, mcStyle::Ok(), mcStyleArray::Set(), mcStyle::SetSpecialTextSettings(), mcStyle::SetTextSettingsFor(), and sgui_pDefaultStyles. Referenced by mcMathCore::SetupGUI(). |
|
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.
Implemented in mcDecorationHelpers, mcElementArrayHelpers, mcEmptyBoxHelpers, mcExpElementHelpers, mcFractionHelpers, mcMathMngHelpers, mcMathSystemHelpers, mcMonomialHelpers, mcOperatorHelpers, mcParenthesisHelpers, mcPolynomialHelpers, and mcTextHelpers. |
|
Inserts the given element at the right of the cursor position.
Implemented in mcDecorationHelpers, mcEmptyBoxHelpers, mcExpElementHelpers, mcFractionHelpers, mcMathMngHelpers, mcMathSystemHelpers, mcMonomialHelpers, and mcPolynomialHelpers. |
|
Returns TRUE only if the element and all its children are completely selected. This is a recursive function. Definition at line 735 of file Element.cpp. References data_GetChildrenCount(), data_GetConstChild(), and gui_isSelected(). Referenced by mcElementArrayHelpers::gui_DeleteSelection(), gui_DeleteSelection(), mcExpContainerHelpers::gui_DrawBase(), mcElementArrayHelpers::gui_DrawSelection(), mcPolynomialHelpers::gui_ExOnSelect(), mcFractionHelpers::gui_GetSelection(), and mcExpElementHelpers::gui_GetSelection(). |
|
Returns a positive value if the given character marks the begin of this element; FALSE otherwise. The begin character cannot be dependent from any variable; it must be always the same. The character is given both as ASCII code and as virtual key code.
Implemented in mcBracketHelpers, mcDecorationHelpers, mcEmptyBoxHelpers, mcFractionHelpers, mcFunctionHelpers, mcMathMngHelpers, mcMathSystemHelpers, mcMonomialHelpers, mcMultDivOpHelpers, mcNumberHelpers, mcOperatorHelpers, mcParenthesisHelpers, mcPolynomialHelpers, mcRadicalHelpers, mcSymbolHelpers, and mcTextHelpers. Referenced by mcExpContainerHelpers::gui_BaseInput(), and gui_isKeyBeginKey(). |
|
Returns TRUE if the given character marks the end of this element; this function is always called before calling ::gui_Input function. isEndChar can return values dependent from the cursor position. The character is given both as ASCII code and as virtual key code
Implemented in mcDecorationHelpers, mcElementArrayHelpers, mcEmptyBoxHelpers, mcExpElementHelpers, mcFractionHelpers, mcMathMngHelpers, mcMathSystemHelpers, mcOperatorHelpers, and mcTextHelpers. |
|
Returns the identifier code (mcET_****) of the class that uses the given char as begin char; mcET_INVALID if the function can't find any result. If you specify a pointer for the last argument, and the class found has derived classes, subtype will be set to the subtype identifier code for that class. Definition at line 456 of file Element.cpp. References gui_isBeginKey(), and SCAN_REGISTERED_CLASSES. Referenced by mcPolynomialHelpers::gui_Input(), mcElementArrayHelpers::gui_Input(), mcMonomialHelpers::gui_isArrEndKey(), and mcEmptyBoxHelpers::gui_isEndKey(). |
|
Returns TRUE if this element is selected (totally or partially). This is a very quick function because all the elements owns a specific flag for selection state. Definition at line 978 of file Element.h. References mgui_bSelected. Referenced by mcElementArrayHelpers::gui_ExDraw(), mcElementArrayHelpers::gui_GetActiveElemIndex(), mcMathOrSystemHelpers::gui_GetSelection(), mcMathMngHelpers::gui_GetSelection(), mcMathAndSystemHelpers::gui_GetSelection(), mcExpElementHelpers::gui_GetSelection(), gui_isAllSelected(), mcElementArrayHelpers::gui_MoveCursor(), mcExpContainerHelpers::gui_OnBaseSelect(), mcMathSystemHelpers::gui_OnSelect(), mcMathMngHelpers::gui_OnSelect(), mcFractionHelpers::gui_OnSelect(), and mcExpElementHelpers::gui_OnSelect(). |
|
Returns TRUE if this element supports splitting and, thus, also merging. The default implementation returns FALSE because this is a quite unused feature. Elements which override this function and return TRUE, must override also the gui_Split() and gui_MergeWith() functions to actually do the work... Reimplemented in mcNumberHelpers. Definition at line 961 of file Element.h. Referenced by mcMonomialHelpers::gui_MergeWith(). |
|
Returns TRUE if this element can accept cursor (and then calls the gui_SetCursorPos() function with the given code) or FALSE if the element, for some reason, cannot accept cursor (in this case this element should be skipped). The standard implementation returns TRUE and calls gui_SetCursorPos().
Reimplemented in mcOperatorHelpers. Definition at line 991 of file Element.h. References gui_SetCursorPos(). Referenced by mcElementArrayHelpers::gui_MoveCursorLeft(), and mcElementArrayHelpers::gui_MoveCursorRight(). |
|
Merges the given element with this object. Like splitting, very few elements support merging, but those elements which handles splitting, should also handle merging... see gui_Split(). The function should merge the given element in *this and return TRUE if everything was okay; FALSE if the merging could not be done (because, for example, the given element is not of the right type...). Reimplemented in mcMonomialHelpers, and mcNumberHelpers. |
|
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.
Implemented in mcDecorationHelpers, mcElementArrayHelpers, mcEmptyBoxHelpers, mcExpElementHelpers, mcFractionHelpers, mcFunctionHelpers, mcMathMngHelpers, mcMathSystemHelpers, mcOperatorHelpers, and mcTextHelpers. |
|
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).
Implemented in mcDecorationHelpers, mcElementArrayHelpers, mcEmptyBoxHelpers, mcExpElementHelpers, mcFractionHelpers, mcMathLineHelpers, mcMathMngHelpers, mcMathSystemHelpers, mcOperatorHelpers, and mcTextHelpers. |
|
Called by parent when parent's size changes. Override this function if you need to do something when parent's size changes (remember to set up the flag mcEP_NOTIFY_PARENTSIZE_CHANGE in the constructor). |
|
Called by the mcElementHelpers::sgui_RecalcSize.
Definition at line 200 of file Element.cpp. References mgui_sz. Referenced by gui_RecalcSize(). |
|
This function is called when the bounding box of this element intersects with the selection rectangle created by the user with the mouse cursor. The standard implementation just selects this element. If you are implementing a container element, you must override this function and check contained elements' bounding boxes and then call the gui_OnSelect() function of the contained elements whose bounding boxes intersect the given selection rectangle. Reimplemented in mcElementArrayHelpers, mcExpElementHelpers, mcFractionHelpers, mcMathLineHelpers, mcMathMngHelpers, mcMathSystemHelpers, mcPolynomialHelpers, and mcTextHelpers. Definition at line 852 of file Element.h. References gui_Select(). |
|
Utility function: use it to convert pixels to point size units. Point size units is the type of unit used by wxWidgets font functions. See also the gui_PointSize2Pixels function. Definition at line 911 of file Element.cpp. References gui_GetPointSize(). |
|
Utility function: use it to convert point size units to pixels units. Point size units is the type of unit used by wxWidgets font functions. Definition at line 901 of file Element.cpp. References gui_GetPointSize(). |
|
|
Sets this element as selected. This function doesn't call the #data_Updategui_SelectionState() function because the gui_OnSelect() function should care about setting up the selection states for the member classes. Use this function with attention. Definition at line 969 of file Element.h. References mgui_bSelected. Referenced by mcSymbolHelpers::gui_BaseMoveCursor(), mcElementArrayHelpers::gui_ExOnSelect(), mcElementArrayHelpers::gui_MoveCursor(), mcExpContainerHelpers::gui_OnBaseSelect(), mcMathSystemHelpers::gui_OnSelect(), mcMathMngHelpers::gui_OnSelect(), mcFractionHelpers::gui_OnSelect(), mcExpElementHelpers::gui_OnSelect(), gui_OnSelect(), and gui_SelectAll(). |
|
gui_Selects the entire element and all its children. This is a recursive function. Definition at line 715 of file Element.cpp. References data_GetChild(), data_GetChildrenCount(), gui_Select(), and mcElement::gui_SelectAll(). Referenced by mcExpElementHelpers::gui_OnBaseSelect(), mcFractionHelpers::gui_OnSelect(), and mcExpElementHelpers::gui_OnSelect(). |
|
Automatically selects the style for the given element in the given DC, recognizing its mcElementType.
Definition at line 950 of file Element.cpp. References gui_GetStyleForThis(), mcStyle::gui_Select(), and mcASSERT. Referenced by mcSymbolHelpers::gui_DoRecalcBaseSize(), mcNumberHelpers::gui_DoRecalcBaseSize(), mcTextHelpers::gui_DoRecalcSize(), mcTextHelpers::gui_Draw(), mcParenthesisHelpers::gui_Draw(), mcOperatorHelpers::gui_Draw(), mcMultDivOpHelpers::gui_Draw(), mcSymbolHelpers::gui_DrawBase(), mcNumberHelpers::gui_DrawBase(), mcBracketHelpers::gui_DrawContainer(), mcMathOrSystemHelpers::gui_DrawSystemSymbols(), mcMathAndSystemHelpers::gui_DrawSystemSymbols(), mcNumberHelpers::gui_GetBaseRelCursorPos(), mcTextHelpers::gui_GetRelCursorPos(), gui_GetThickness(), mcTextHelpers::gui_MoveCursorUsingPoint(), mcMathOrSystemHelpers::gui_RecalcSymbolSize(), and mcMathAndSystemHelpers::gui_RecalcSymbolSize(). |
|
Sets this element as exponent of the given pointer. This function automatically calls the gui_UpdateExpDepth() function.
Definition at line 767 of file Element.cpp. References mcElement::gui_GetExpDepth(), gui_UpdateExpDepth(), mcEmptyElement, and mgui_nExpDepth. |
|
Sets this element at the same level of the given element. For 'level', I mean exponent depth. This function is called at least once just after the creation of the element. This function automatically calls the gui_UpdateExpDepth() function.
Definition at line 776 of file Element.cpp. References mcElement::gui_GetExpDepth(), gui_UpdateExpDepth(), mcEmptyElement, and mgui_nExpDepth. |
|
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. Implemented in mcDecorationHelpers, mcElementArrayHelpers, mcEmptyBoxHelpers, mcExpElementHelpers, mcFractionHelpers, mcFunctionHelpers, mcMathMngHelpers, mcMathSystemHelpers, mcOperatorHelpers, mcPolynomialHelpers, and mcTextHelpers. Referenced by gui_LetInCursor(). |
|
Sets the exponent depth of this element. This function automatically calls the gui_UpdateExpDepth() function. Definition at line 1158 of file Element.h. References gui_UpdateExpDepth(), and mgui_nExpDepth. |
|
Changes recursively the styles of this element and the styles of all its children.
Definition at line 212 of file Element.cpp. References data_GetChild(), data_GetChildrenCount(), mcElement::gui_SetStyleArray(), and mgui_pStyleArray. |
|
gui_Splits this element in two parts. The first is stored in this element, the second is returned as a pointer (the caller must then delete it when it's no longer necessary). The split point must be determined using the current cursor position. This function has a sense only for few elements, see as an example mcNumber::gui_Split: when the user tries to insert a new operator like '/' and the cursor is inside a number, the number is split in two parts and this function is used to get the second half. If the cursor is placed in at the leftmost/rightmost point of the element and, thus, the first/second half of the element would be empty, then the function should return NULL. The classes that cannot be splitted should return NULL. This is what the standard implementation does.
Reimplemented in mcMonomialHelpers, and mcNumberHelpers. |
|
|
Inits all the static data of mcElement.
Definition at line 353 of file Element.cpp. References data_UpdateElemArray(), mcNUM_ELEMENT_TYPES, and sdata_pElem. Referenced by mcFunctionHelpers::gui_BaseInput(), and mcMathCore::Init(). |
|
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:
Implemented in mcDecorationHelpers, mcElementArrayHelpers, mcEmptyBoxHelpers, mcExpElementHelpers, mcFractionHelpers, mcMathMngHelpers, mcMathSystemHelpers, mcOperatorHelpers, mcPolynomialHelpers, mcRadicalHelpers, and mcTextHelpers. |
|
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).
Implemented in mcDecorationHelpers, mcEmptyBoxHelpers, mcExpElementHelpers, mcFractionHelpers, mcFunctionHelpers, mcMathMngHelpers, mcMathSystemHelpers, mcMonomialHelpers, mcMultDivOpHelpers, mcOperatorHelpers, mcPolynomialHelpers, mcRadicalHelpers, and mcTextHelpers. |
|
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
Implemented in mcDecorationHelpers, mcExpElementHelpers, mcFractionHelpers, mcFunctionHelpers, mcMathMngHelpers, mcMathSystemHelpers, mcMonomialHelpers, mcOperatorHelpers, mcParenthesisHelpers, mcPolynomialHelpers, and mcTextHelpers. Referenced by io_Init(). |
|
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
Implemented in mcDecorationHelpers, mcEmptyBoxHelpers, mcExpContainerHelpers, mcFractionHelpers, mcFunctionHelpers, mcMathMngHelpers, mcMathSystemHelpers, mcMonomialHelpers, mcMultDivOpHelpers, mcNumberHelpers, mcOperatorHelpers, mcParenthesisHelpers, mcPolynomialHelpers, mcRadicalHelpers, mcSymbolHelpers, and mcTextHelpers. |
|
Inits this element with the given INLINED expression; for more info about inlined expressions, see the mcElement::io_ImportInlinedExpr function. If the given string is not valid for this element as init string, then this function returns FALSE. Definition at line 187 of file Element.cpp. References io_ImportInlinedExpr(), and io_isBeginChar(). |
|
Initializes the IO section of this element.
Definition at line 1672 of file Element.h. Referenced by data_Init(). |
|
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. Implemented in mcBracketHelpers, mcDecorationHelpers, mcElementArrayHelpers, mcFractionHelpers, mcFunctionHelpers, mcMathMngHelpers, mcMathSystemHelpers, mcNumberHelpers, mcOperatorHelpers, mcParenthesisHelpers, mcRadicalHelpers, mcSymbolHelpers, and mcTextHelpers. Referenced by io_Init(), and io_isCharBeginChar(). |
|
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.
Implemented in mcDecorationHelpers, mcElementArrayHelpers, mcEmptyBoxHelpers, mcExpContainerHelpers, mcFractionHelpers, mcFunctionHelpers, mcMathMngHelpers, mcMathSystemHelpers, mcNumberHelpers, mcOperatorHelpers, mcParenthesisHelpers, mcRadicalHelpers, mcSymbolHelpers, and mcTextHelpers. Referenced by io_isTagBeginTag(). |
|
Definition at line 460 of file Element.cpp. References io_isBeginChar(), and SCAN_REGISTERED_CLASSES. Referenced by mcPolynomialHelpers::io_ImportInlinedExpr(), and mcMonomialHelpers::io_ImportInlinedExpr(). |
|
Definition at line 464 of file Element.cpp. References io_isBeginTag(), and SCAN_REGISTERED_CLASSES. Referenced by mcMonomialHelpers::io_ImportPresentationMathML(). |
|
Post-processes this element after the import-process. This function will be called after the entire process performed by io_ImportInlinedExpr and io_ImportPresentationMathML and thus when all the data tree has already been built (from this function you can access neighbor elements, for example). Reimplemented in mcMonomialHelpers. |
|
Calls the io_PostProcess functions of all the children of this element; call this one just before exiting #io_ImportInlinedExpr and #io_ImportPresentationMathML.
Definition at line 1093 of file Element.cpp. References data_GetChild(), and data_GetChildrenCount(). Referenced by mcPolynomialHelpers::io_ImportInlinedExpr(), mcMonomialHelpers::io_ImportInlinedExpr(), mcFunctionHelpers::io_ImportInlinedExpr(), and mcMonomialHelpers::io_ImportPresentationMathML(). |
|
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 Implemented in mcDecorationHelpers, mcExpContainerHelpers, mcFractionHelpers, mcFunctionHelpers, mcMathMngHelpers, mcMathSystemHelpers, mcMonomialHelpers, mcNumberHelpers, mcPolynomialHelpers, and mcSymbolHelpers. Referenced by math_SimpleAdd(), and math_Subtract(). |
|
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. Implemented in mcDecorationHelpers, mcElementArrayHelpers, mcExpContainerHelpers, mcFractionHelpers, mcFunctionHelpers, mcMathMngHelpers, mcMathSystemHelpers, mcMonomialHelpers, mcNumberHelpers, and mcSymbolHelpers. |
|
Works like #math_CanBemath_AddeWith(), just for divisions.
Implemented in mcDecorationHelpers, mcElementArrayHelpers, mcExpContainerHelpers, mcFractionHelpers, mcFunctionHelpers, mcMathMngHelpers, mcMathSystemHelpers, mcNumberHelpers, and mcSymbolHelpers. Referenced by mcExpElementHelpers::math_DivideBy(). |
|
Works like #math_CanBemath_AddeWith(), just for multiplication.
Implemented in mcDecorationHelpers, mcElementArrayHelpers, mcExpContainerHelpers, mcFractionHelpers, mcFunctionHelpers, mcMathMngHelpers, mcMathSystemHelpers, mcNumberHelpers, and mcSymbolHelpers. Referenced by mcExpElementHelpers::math_MultiplyBy(). |
|
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. Implemented in mcDecorationHelpers, mcElementArrayHelpers, mcExpElementHelpers, mcFractionHelpers, mcMathMngHelpers, mcMathSystemHelpers, and mcOperatorHelpers. Referenced by math_GetCountOf(), math_NonRecursiveFindInChildren(), and math_RecursiveFind(). |
|
Compares this element and the given one and then stops, unlike math_Compare() that compares children too.
Reimplemented in mcElementArrayHelpers, mcExpContainerHelpers, mcMathMngHelpers, mcNumberHelpers, mcSymbolHelpers, and mcTextHelpers. Definition at line 1414 of file Element.cpp. References data_GetType(). Referenced by mcMathSystemHelpers::math_Compare(), mcExpElementHelpers::math_Compare(), math_GetCountOf(), mcExpElementHelpers::math_GetGCD(), mcExpElementHelpers::math_GetLCM(), mcExpElementHelpers::math_MultOrDiv(), and math_RecursiveFind(). |
|
Returns TRUE if the given element is contained inside this one. While #hasSameContentOf returns TRUE if the two elements involved have exactly the same contents (nothing more, nothing less), this function returns TRUE even if the given element is only a subset of those contained. This function does *not* work with math_MaxSimplify()ed copies of the two elements involved. Some examples:
Definition at line 1299 of file Element.cpp. References math_Find(), and mcEmptyElement. Referenced by math_ContainsNumber(), math_ContainsOneOf(), math_ContainsSymbol(), and mcPolynomialHelpers::math_GetCoeffOf(). |
|
Like math_ContainsUnknowns() but the array checked is mcSymbol::arrConstants.
Definition at line 1356 of file Element.cpp. References math_ContainsOneOf(). Referenced by math_ContainsSymbols(). |
|
Returns TRUE if this element contains unregistered symbols.
Reimplemented in mcMathMngHelpers. Definition at line 1370 of file Element.cpp. References math_ContainsOneOf(). |
|
Definition at line 1302 of file Element.cpp. References mcExpElement::data_SetExpSub(), math_Contains(), and mcEmptyPolynomial. |
|
Returns TRUE if one of the symbols registered in the given array is contained inside this element.
Definition at line 1327 of file Element.cpp. References mcSymbolProperties::data_GetSafeLinkedSym(), and math_Contains(). Referenced by math_ContainsConstants(), math_ContainsInvalidSymbols(), math_ContainsParameters(), and math_ContainsUnknowns(). |
|
Like math_ContainsUnknowns() but the array checked is mcSymbol::arrParameters.
Definition at line 1359 of file Element.cpp. References math_ContainsOneOf(). Referenced by math_ContainsSymbols(), and math_isConstant(). |
|
Returns TRUE if this element contains the given type of.
Definition at line 1314 of file Element.cpp. References mcExpElement::data_SetExpSub(), math_Contains(), mcASSERT, and mcEmptyPolynomial. Referenced by mcPolynomialHelpers::math_FactoreOut(), mcPolynomialHelpers::math_FactoreOutFreeOf(), and math_GetCountOfSymbolsType(). |
|
Returns TRUE if this element contains at least one unknown/constant/parameter. This function does not check for unregistered symbols... Definition at line 1362 of file Element.cpp. References math_ContainsConstants(), math_ContainsParameters(), and math_ContainsUnknowns(). |
|
Returns TRUE if this element contains one or more unknowns. The unknowns which are checked are those registered in mcSymbol::arrUnknowns. This function performs a recursive search in this element. Definition at line 1353 of file Element.cpp. References math_ContainsOneOf(). Referenced by math_ContainsSymbols(), mcRadicalHelpers::math_GetBaseMathType(), mcFractionHelpers::math_GetMathType(), math_isConstant(), and mcMonomialHelpers::math_RemoveCoeff(). |
|
Divides two mcElements of the same type and stores the result in this object.
Implemented in mcDecorationHelpers, mcExpElementHelpers, mcFractionHelpers, mcMathMngHelpers, mcMathSystemHelpers, mcMonomialHelpers, and mcPolynomialHelpers. Referenced by math_SimpleDivideBy(). |
|
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. Implemented in mcDecorationHelpers, mcElementArrayHelpers, mcExpElementHelpers, mcFractionHelpers, mcMathMngHelpers, mcMathSystemHelpers, and mcRadicalHelpers. Referenced by math_EvaluateAt(), math_EvaluatesTo(), and math_isFinite(). |
|
Returns the result of the math_Evaluate function called on a copy of this element with the given symbol substituted by the given value.
Definition at line 1718 of file Element.cpp. References mcSymbol::data_LinkWith(), mcSymbolProperties::m_bEvaluating, mcSymbolProperties::m_fValue, math_Evaluate(), mcElement::math_Evaluate(), mcElement::math_Replace(), mcMATHLOG, mcTXTP, mcTXTTHIS, and mcTXTV. |
|
Returns TRUE if this element can be evaluated (see math_Evaluate()) and its value matches the given one.
Definition at line 1413 of file Element.h. References math_Evaluate(). Referenced by mcElementArrayHelpers::math_SimplifyRemoveNeutrals(). |
|
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 Implemented in mcDecorationHelpers, mcElementArrayHelpers, mcExpElementHelpers, mcFractionHelpers, mcMathMngHelpers, and mcMathSystemHelpers. |
|
Returns the n-th occurrence of an element with the same contents (this function uses #math_CompareWith, not #hasSameContentOf to perform the comparison !) or NULL if there is no an n-th occurrence of such an element. The element to search is not required to be of the same type of *this, since this function recursively calls itself on the children of *this. Definition at line 1422 of file Element.cpp. References math_RecursiveFind(), and mcASSERT. Referenced by math_Contains(), mcMonomialHelpers::math_GetMaxDegreeFor(), math_GetSymbolList(), and math_Replace(). |
|
Works like math_Find() but its action is limited to the children (recursively) of *this only and not also *this.
Definition at line 1431 of file Element.cpp. References math_RecursiveFindInChildrenOnly(), and mcASSERT. |
|
Returns the number of symbols belonging to the given mcSymbolArray are contained in *this element and its children (recursive search).
Definition at line 1582 of file Element.cpp. References math_GetCountOf(). |
|
Returns the number of symbols of the given type contained in *this element and its children (recursive search).
Definition at line 1574 of file Element.cpp. References math_GetCountOf(), and mcASSERT. |
|
Returns the number of elements with the same contents of the given one contained into this one.
Reimplemented in mcMathMngHelpers. Definition at line 1557 of file Element.cpp. References data_GetChildrenCount(), data_GetConstChild(), math_Compare(), math_CompareThisOnly(), and math_GetCountOfChildrenOnly(). Referenced by math_GetCountOf(), and mcMonomialHelpers::math_GetMaxDegreeFor(). |
|
Works like math_GetCountOf() but does not compare the given element with *this, just with the children of *this.
Definition at line 1547 of file Element.cpp. References data_GetChildrenCount(), data_GetConstChild(), and mcElement::math_GetCountOf(). Referenced by math_GetCountOf(). |
|
Unlike #math_GetCountOf(const mcSymbolArray *, long) this function does not return the total number of symbols contained: it returns how many *types* of symbols of the given array are contained into *this and its children (recursive search). Eg: 4ax^2+bx+x -> math_GetCountOf(mcSymbol::arrUnknowns) = 3 (because "x" is repeated three times) -> math_GetCountOfSymbolsType(mcSymbol::arrUnknowns) = 1 (because only one type of unknown is used, "x") where wxT("x") is registered as unknown and wxT("a") and "b" are not. Definition at line 1593 of file Element.cpp. References math_ContainsSymbol(). |
|
Factores-out everything which can be factored out from this element. Returns a mcPolynomial containing a copy of those elements factored-out. This function is CONST since many times not all the factores which can be taken out will be used and thus is caller's duty the modification of this element, eventually calling the math_DivideBy function. Reimplemented in mcElementArrayHelpers, and mcExpContainerHelpers. Definition at line 1284 of file Element.cpp. References mcElementArray::math_WrapSimple(). |
|
Implemented in mcDecorationHelpers, mcExpElementHelpers, mcFractionHelpers, mcMathMngHelpers, mcMathSystemHelpers, mcMonomialHelpers, mcNumberHelpers, and mcPolynomialHelpers. |
|
Returns the LCM between *this and the given element.
Implemented in mcDecorationHelpers, mcExpElementHelpers, mcFractionHelpers, mcMathMngHelpers, mcMathSystemHelpers, mcMonomialHelpers, and mcPolynomialHelpers. |
|
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)... Implemented in mcDecorationHelpers, mcElementArrayHelpers, mcExpElementHelpers, mcFractionHelpers, mcFunctionHelpers, mcMathMngHelpers, mcMathSystemHelpers, and mcOperatorHelpers. Referenced by math_GetTotalLenght(). |
|
A powerful recognizer function which automatically classifies the type of the math data contained in this class and returns the respective identifier.
Implemented in mcDecorationHelpers, mcElementArrayHelpers, mcExpElementHelpers, mcFractionHelpers, mcMathMngHelpers, and mcMathSystemHelpers. |
|
Returns the order position for this element.
Implemented in mcBracketHelpers, mcDecorationHelpers, mcFractionHelpers, mcFunctionHelpers, mcMathMngHelpers, mcMathSystemHelpers, mcMonomialHelpers, mcNumberHelpers, mcPolynomialHelpers, mcRadicalHelpers, and mcSymbolHelpers. Referenced by math_isListedBeforeOf(). |
|
Definition at line 1406 of file Element.cpp. References mcSymbol::data_LinkWith(), and math_GetSymbolList(). |
|
Returns the number of symbols identic to the one given (uses #math_CompareWith to perform comparison) and place a pointer to each symbol in the given array of pointers of size If the array is too small, then the function returns the number of symbols of the given type which have been found but with a negative sign. If no symbols of the given type are found, then the function returns 0. Definition at line 1384 of file Element.cpp. References math_Find(). Referenced by math_GetSymbolList(). |
|
Returns the lenght of this element, taking in count also the children. Uses the math_GetLenght() function to do the job. Reimplemented in mcMathMngHelpers. Definition at line 1229 of file Element.cpp. References data_GetChildrenCount(), data_GetConstChild(), math_GetLenght(), and mcElement::math_GetTotalLenght(). Referenced by mcNumberHelpers::math_SimplifyBaseExp(). |
|
Initializes the MATH section of this element.
Definition at line 1234 of file Element.h. Referenced by data_Init(). |
|
Returns TRUE if this element contains mcSymbol registered as constants and/or mcNumbers only.
Reimplemented in mcMathMngHelpers. Definition at line 1376 of file Element.cpp. References math_ContainsParameters(), and math_ContainsUnknowns(). Referenced by mcSymbolHelpers::math_GetBaseMathType(), and mcFunctionHelpers::math_SimplifyBase(). |
|
Use the following function to check if the given element can allocate an exponent.
Definition at line 1154 of file Element.cpp. Referenced by mcExpElementHelpers::gui_EditExpSub(). |
|
Returns TRUE if this element evaluates to a finite value; returns FALSE if this element could not be evaluated (result is NAN) or this element evaluates to a infinite value.
Definition at line 1243 of file Element.cpp. References math_Evaluate(), and mcValue::math_isFinite(). |
|
Returns TRUE if *this should be put before the given element in an ordered math list: this function is used by mcElementArray-derived classes to reorder their elements. The default implementation of this function just compares the order position (retrieved through the math_GetOrderPos function) of this with the order position of the given element. Reimplemented in mcSymbolHelpers. Definition at line 1277 of file Element.cpp. References math_GetOrderPos(). Referenced by mcSymbolHelpers::math_isListedBeforeOf(). |
|
Returns TRUE if the element is completely simplified; FALSE if calls to math_Simplify(long flags) will make changes to the element.
Definition at line 1206 of file Element.cpp. References data_Clone(), math_Simplify(), mcELEMENTMATH_MAX_PROCESS_CYCLES, mcESR_DONE, and mcESR_NOTFINISHED. |
|
Definition at line 1162 of file Element.cpp. Referenced by mcExpElementHelpers::gui_EditExpSub(). |
|
Returns TRUE if *this element is math consistent, that is, it is not a mcParenthesis or a mcEmptyBox and it does not contain invalid math elements (this function is recursive).
Definition at line 1251 of file Element.cpp. References data_GetChildrenCount(), data_GetConstChild(), data_GetType(), mcET_EMPTYBOX, mcET_INVALID, mcET_PARENTHESIS, and mcET_TEXT. |
|
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 in mcBracketHelpers, mcDecorationHelpers, mcElementArrayHelpers, mcExpElementHelpers, mcFractionHelpers, and mcNumberHelpers. Definition at line 1178 of file Element.cpp. References mcFraction::data_GetDen(), mcFraction::data_GetNum(), mcElementArray::math_WrapNumber(), mcElementArray::math_WrapSimple(), mcBOR_REPLACE_BOTH, and mcElement. |
|
Completely simplifies this element. This function typically works calling math_Simplify until it does not return mcESR_DONE. Anyway, it doesn't modify the operation counter. Definition at line 1188 of file Element.cpp. References math_Simplify(), mcELEMENTMATH_MAX_PROCESS_CYCLES, mcESR_DONE, and mcESR_NOTFINISHED. |
|
Multiplies two mcElements of the same type and stores the result in this object.
Implemented in mcDecorationHelpers, mcExpElementHelpers, mcFractionHelpers, mcMathMngHelpers, mcMathSystemHelpers, mcMonomialHelpers, and mcPolynomialHelpers. Referenced by math_SimpleMultiplyBy(). |
|
Works like math_FindInChildrenOnly() but this function does not search recursively; that is, this function won't search in the children of the children of *this.
Definition at line 1440 of file Element.cpp. References data_GetChildrenCount(), data_GetConstChild(), math_Compare(), and mcASSERT. Referenced by mcElementArrayHelpers::math_Delete(), mcElementArrayHelpers::math_GetIndexOf(), mcPolynomialHelpers::math_GetNumSign(), and math_RecursiveFindInChildrenOnly(). |
|
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.
Implemented in mcDecorationHelpers, mcExpElementHelpers, mcFractionHelpers, mcMathMngHelpers, mcMathSystemHelpers, mcMonomialHelpers, and mcPolynomialHelpers. Referenced by math_SimpleRaiseTo(). |
|
Recursively search the n-th occurrence of the given element both in *this and both in *this' children using math_RecursiveFindInChildrenOnly().
If this function cannot find in *this or *this' children the n-th occurrence of the given element, then it returns NULL and to
Definition at line 1505 of file Element.cpp. References data_GetChildrenCount(), data_GetConstChild(), math_Compare(), math_CompareThisOnly(), math_RecursiveFindInChildrenOnly(), mcASSERT, mcElement, mcEmptyElement, and mcFIND_PARENT. Referenced by math_Find(), and math_RecursiveFindInChildrenOnly(). |
|
Works exactly like math_RecursiveFind() except that this function does not perform comparison between
Definition at line 1462 of file Element.cpp. References mcElement::chlp(), data_GetChildrenCount(), data_GetConstChild(), math_NonRecursiveFindInChildren(), math_RecursiveFind(), mcASSERT, mcElement, mcEmptyElement, and mcFIND_PARENT. Referenced by math_FindInChildrenOnly(), and math_RecursiveFind(). |
|
Replaces the n-th occurrence of the element 'tofind' with a copy of the element 'replacement'. If n == -1, all the occurrences of the element to find are replaced. If bAttachChildren == TRUE, then this function will try to attach the children of the just replaced element to the copy of 'replacement' using the mcElement::AttachChildrenTo. In any case, this function won't replace *this if *this matches the 'tofind' element.
Reimplemented in mcMathMngHelpers. Definition at line 1607 of file Element.cpp. References mcObjectRefData::data_GetRefCount(), mcObject::data_GetRefData(), math_Find(), mcEmptyElement, mcFIND_PARENT, mcMATHLOG, mcTXT, and mcTXTTHIS. |
|
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 in mcDecorationHelpers, mcExpElementHelpers, and mcFractionHelpers. Definition at line 1168 of file Element.cpp. References data_GetChild(), data_GetChildrenCount(), and mcElement::math_SetExp(). |
|
Adds the given element to this element using the math_Add() function and then checking that the return value is mcBOR_REMOVE_OPERAND: that is, the operation was completed successfully and *this now contains the result of the operation. If the math_Add() function does not return mcBOR_REMOVE_OPERAND then an ASSERT fails: use math_SimpleXXXX functions only when you are sure that the operation can be performed without special operations. Reimplemented in mcElementArrayHelpers. Definition at line 1110 of file Element.cpp. References math_Add(), mcASSERT, mcBOR_REMOVE_OPERAND, mcMATHLOG, mcTXT, mcTXTTHIS, and mcUNUSED. Referenced by mcMathSystemHelpers::math_Add(), mcElementArrayHelpers::math_SimpleAdd(), and math_SimpleSubtract(). |
|
Reimplemented in mcElementArrayHelpers. Definition at line 1132 of file Element.cpp. References math_DivideBy(), mcASSERT, mcBOR_REMOVE_OPERAND, mcMATHLOG, mcTXT, mcTXTTHIS, and mcUNUSED. Referenced by mcMathSystemHelpers::math_DivideBy(), and mcElementArrayHelpers::math_SimpleDivideBy(). |
|
Reimplemented in mcElementArrayHelpers. Definition at line 1121 of file Element.cpp. References math_MultiplyBy(), mcASSERT, mcBOR_REMOVE_OPERAND, mcMATHLOG, mcTXT, mcTXTTHIS, and mcUNUSED. Referenced by mcMathSystemHelpers::math_MultiplyBy(), and mcElementArrayHelpers::math_SimpleMultiplyBy(). |
|
Raises this element to the given mcPolynomial, checking that the return value is mcBOR_REMOVE_OPERAND. If it is not, then a mcASSERT will fail. Definition at line 1143 of file Element.cpp. References math_RaiseTo(), mcASSERT, mcBOR_REMOVE_OPERAND, mcMATHLOG, mcTXT, mcTXTTHIS, and mcUNUSED. |
|
Definition at line 1438 of file Element.h. References math_SimpleAdd(). Referenced by mcMathMngHelpers::gui_AddSubSel(), and mcMathSystemHelpers::math_Subtract(). |
|
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
Implemented in mcDecorationHelpers, mcElementArrayHelpers, mcExpElementHelpers, mcFractionHelpers, mcMathMngHelpers, mcMathSystemHelpers, and mcPolynomialHelpers. Referenced by math_isMaxSimplified(), and math_MaxSimplify(). |
|
math_s two mcElements of the same type and stores the result in this object.
Reimplemented in mcDecorationHelpers, mcFunctionHelpers, mcMathMngHelpers, mcMathSystemHelpers, and mcPolynomialHelpers. Definition at line 1599 of file Element.h. References math_Add(). |
|
|
The ID of this element. This should be a unique value in the entire MathCore session: see MathCore::GenID() for more info about its generation at run-time. This code is used to identify one specific element inside the input data. Definition at line 198 of file Element.h. Referenced by data_GetID(). |
|
The properties of this element, stored as bit array (use values defined in Element.h to check and set flags).
Definition at line 202 of file Element.h. Referenced by data_AddProperty(), data_DeepCopy(), data_hasProperty(), data_hasRecursiveProperty(), data_isSameAs(), data_RemoveProperty(), and data_RemoveRecursiveProperty(). |
|
TRUE if the element is selected (totally or partially). This variable cannot be accessed by derived classes: forcing use of the functions gui_OnSelect() and gui_DeSelect() avoids errors and nasty bugs because when the selection states of member classes' must change... Definition at line 228 of file Element.h. Referenced by data_DeepCopy(), gui_DeSelect(), gui_Init(), gui_isSelected(), and gui_Select(). |
|
The exponent level of this element. A null value means that this element is not an exponent; 1 means this is an exponent; 2 means this is an exponent of an exponent and so on... This variable can't be accessed by derived classes: forcing use of the functions #SetExpDepth() and #GetExpDepth() avoid errors and nasty bugs because when this value changes also the values of derived classes' exponent depth must change...
Definition at line 253 of file Element.h. Referenced by data_DeepCopy(), gui_GetExpDepth(), gui_SetAsExpOf(), gui_SetAtSameLevelOf(), and gui_SetExpDepth(). |
|
Array of MathCore styles; access this array indirectly using the gui_GetStyle() function. example: [...] gui_SelectObject(hDC, gui_GetStyle(this).hFont); SetTextColor(hDC, gui_GetStyle(this).clrText); [...] Definition at line 221 of file Element.h. Referenced by mcMathMngHelpers::data_DeepCopy(), data_DeepCopy(), gui_GetStyle(), gui_GetStyleArray(), gui_GetStyleForThis(), gui_Init(), and gui_SetStyleArray(). |
|
Size of the element (in pixels). It should be always up-to-date; so, if you modify size in some way, call the gui_RecalcSize() function. Definition at line 233 of file Element.h. Referenced by data_DeepCopy(), gui_GetHeight(), gui_GetSize(), gui_GetWidth(), gui_Init(), gui_OnRecalcSize(), and gui_RecalcSize(). |
|
An array containing one instance of each class type; used by isCharBeginChar(char) function; it uses this array to call the io_isBeginChar() function of each element type to do its work (the pElem array is initialized at the moment of the allocation of the namespace; see MathCore.cpp).
Definition at line 69 of file Element.cpp. Referenced by Cleanup(), data_GetGlobalMemoryInfo(), data_GetInstanceOf(), data_UpdateElemArray(), and Init(). |
|
The additional number of pixels on the left & right of the active element to fill with sgui_pActivationBrush. This should be a small value which should be use to adjust the activation rectangle which is drawn too small on some platforms. Definition at line 68 of file Element.cpp. |
|
The brush used to draw active elements (elements which are located under the cursor). All the elements are highlighted when the mouse is moved over them. This is the background colour of the highlight. Definition at line 66 of file Element.cpp. |
|
The array of styles used by default by all mcElements. To change the style of a particular element (and the style of all its children), use the mcElement::SetStyle() function. To change the default style used by all mcElements, change this pointer. Definition at line 67 of file Element.cpp. Referenced by gui_DeleteDefaultStyles(), gui_Init(), and gui_InitDefaultStyles(). |
|
The brush used to draw the selected portions of the math data. When user selects a piece of math data, its background is filled with this colour. Definition at line 65 of file Element.cpp. |
[ Top ] |