Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

mcExpElementHelpers Class Reference

#include <ExpElement.h>

Inheritance diagram for mcExpElementHelpers:

Inheritance graph
[legend]
Collaboration diagram for mcExpElementHelpers:

Collaboration graph
[legend]
List of all members.

Detailed Description

A little class containing the DATA, MATH, GUI and IO sections of this element (as instances and not pointers).

This is entirely defined & implemented through macros.

Definition at line 161 of file ExpElement.h.

Public Member Functions

 mcExpElementHelpers ()
virtual ~mcExpElementHelpers ()
int data_GetChildrenCount () const
 Returns the number of children attached to this tree node.
const mcElementdata_GetConstChild (int n) const
 Returns the n-th tree node attached to this element.
void data_SetChild (int n, const mcElement &newchild)
 math_Replaces the idx-th child of this element with a copy of the given one.
void data_DeepCopy (const mcElementHelpers *p)
 Deep copies the given mcExpElementHelpers, removing the exponent from this if it is not present in p or deep-copying it otherwise.
void data_DeepCopyExpSub (bool exp, const mcExpElementHelpers *)
 An helper function of data_DeepCopy: works deep-copying only the exp/sub of the given mcExpElementHelpers class.
virtual void data_CreateExpSub (bool exp)
 The exponent/subscript is mcEmptyElement as default (to avoid wasting memory allocating exp/sub which won't never be used...).
virtual void data_DestroyExpSub (bool exp)
 Destroys the exponent if present.
mcElementdata_GetExp ()
 Returns a pointer to the current exponent: the return value could be NULL.
const mcElementdata_GetExp () const
mcElementdata_GetSub ()
 Returns a pointer to the current subscript: the return value could be NULL.
const mcElementdata_GetSub () const
mcElementdata_Get (bool bExp)
const mcElementdata_Get (bool bExp) const
virtual void data_SetExpSub (bool exp, const mcElement &p)
 Destroys the old exponent (if present) and replace it with the given element.
bool math_hasExp () const
 Returns TRUE if this element has a working exponent.
bool math_hasSub () const
const mcPolynomialmath_GetConstExp () const
 Returns a CONST pointer to the exponent of this element.
mcPolynomialmath_GetExp ()
const mcPolynomialmath_GetExp () const
mcTextmath_GetSub () const
 See math_GetExp().
const mcTextmath_GetConstSub () const
 See math_GetExp().
void math_SetExp (const mcPolynomial &pol)
 Sets the exponent of this element to match the given polynomial.
mcBasicOpRes math_RaiseTo (const mcPolynomial &p)
 Raises *this element to the given polynomial.
mcRealValue math_EvaluateExp () const
bool math_CompareExp (const mcExpElement &, long flags) const
bool math_CompareSub (const mcExpElement &, long flags) const
mcBasicOpRes math_MultOrDiv (const mcElement &, mcElement *, bool mult)
virtual wxXml2Node io_GetBaseMathML (bool bGetPresentation) const =0
 Returns a MathML tree with the presentation math markup language regarding the base.
virtual wxXml2Node io_GetMathML (bool bGetPresentation) const
 Returns the MathML tree which describes this element and, eventually, its exponent and its subscript.
virtual wxString io_GetInlinedExpr () const
 Returns the inlined expression for this element as a wxString.
virtual wxString io_GetBaseInlinedExpr () const =0
virtual bool io_ImportInlinedExpr (const wxString &str, int *count, wxString &pErr)
 Imports an inlined expression.
virtual bool io_ImportBaseInlinedExpr (const wxString &, int *, wxString &)=0
Exponent & subscript handlers
The following are the functions implemented by mcExpElement class.

They shouldn't be used by derived-classes except for special reasons: mcExpElement will use them as appropriate when necessary.

bool gui_isExpSubEndKey (bool, const mcKey &) const
 Returns TRUE if the given char is the end char for the exponent and the cursor is actually editing the exponent.
bool gui_isExpSubEndKeyHelper (bool exp, const mcKey &ev) const
int gui_ExpSubDraw (bool, wxDC &, int, int, long flags, const wxPoint &) const
 Works exactly as mcElementHelpers::sgui_Draw, just on the exponent, checking, before drawing, if the exponent is visible.
wxSize gui_GetExpSubSize (bool)
 This function returns only the exponent size (which should be different from element size).
wxSize gui_GetExpSubSize (bool) const
void gui_RecalcExpSubSize (bool)
 Forces the recalculation of exponent's size.
virtual int gui_GetExpSubOffsety (bool) const
 Returns the y-offset of the exponent (usually zero).
virtual int gui_GetExpSubOffsetx (bool) const
 Returns the offset (respect to the top-left point of the bounding box of the element) for the x coord.
virtual int gui_GetExpSubRelCursorPos (bool, wxDC &, wxPoint *) const
 Returns the height of the cursor (or mcECL_NOTINSIDEEXP flag) and its position (using the given pointer) in coordinates relative to the top-left point of the bounding rect of the entire element.
virtual mcMoveCursorRes gui_ExpSubMoveCursor (bool, mcMoveCursorFlag, long)
 Handles the movements of the cursor when it's inside the exponent (if the cursor is not in the exponent, the function returns mcECL_NOTINSIDEEXP).
int gui_ExpSubMoveCursorUsingPoint (bool, wxDC &dc, const wxPoint &p)
void gui_GetExpSubCursorPos (bool, mcCursorPos &) const
 Returns the Cursor Position flag (mcCP_***) if the cursor is inside the exponent.
void gui_SetExpSubCursorPos (bool, const mcCursorPos &code)
 If the exponent is placed on the right of the element, handles the mcCP_END flag, setting cursor position at the end of the exponent; if the exponent is placed on the left, handles the mcCP_BEGIN flag.
virtual mcInputRes gui_ExpSubInput (bool, const mcKey &ev, mcElement *pnew)
 Handles input when cursor is inside the exponent; this function returns mcECL_NOTINSIDEEXP if cursor is not inside exponent, mcIR_OKAY otherwise.
void gui_EditExpSub (bool)
 Sets the cursor inside the exponent (if the exponent doesn't exist or it is not visible, the function will create it or make it visible).
void gui_DeleteExpSub (bool)
 Deletes the exponent from this element as if it has never been created.
virtual void gui_CheckExpSub (bool)
 Checks the contents of the exponent and eventually reset them.
virtual void gui_CreateExpSub (bool)
 Creates the exponent and inits it with an empty monomial.
Base handlers
These functions must be provided by derived class; they must work as their respective mcElement versions, but only for the base of the element.

Derived classes must also implement the abstract functions not covered by mcExpElement (because they do not apply to exponents): mcElement::gui_Split(), mcElement::io_isBeginChar...

virtual bool gui_isBaseEndKey (const mcKey &ev) const =0
 This function should work as mcElement::isEndChar function, but it should care only for the base; this means that the element should not handle the mcEXPELEM_**** cursor positions, but it will probably still need to check for exp/sub presence to choose if the given keyevent is the end key.
virtual int gui_DrawBase (wxDC &dc, int x, int y, long flags, const wxPoint &pt) const =0
 Identical to mcElement::gui_Draw, but just for the base.
virtual void gui_DoRecalcBaseSize ()=0
 Calculates (in the m_szBase variable) the size of the base only.
virtual void gui_SetBaseCursorPos (const mcCursorPos &)=0
 Sets the cursor position of the element.
virtual void gui_EditBase ()=0
 Called when the cursor is switching from the exp/sub to the base; it should set the cursor inside the base: the correct position will be set using the gui_SetBaseCursorPos.
virtual void gui_EditBaseAndSetPos (const mcCursorPos &cp)
 Works as gui_EditBase() but this function also sets the cursor position inside the base with the given flag.
virtual void gui_GetBaseCursorPos (mcCursorPos &) const =0
 Returns one of the cursor position flags (called only when cursor is inside the base).
virtual mcCursorPos gui_GetBaseCursorPos () const
virtual mcInputRes gui_BaseInput (const mcKey &ev, mcElement *pnew)=0
 Handles the input when the cursor is editing the base; an useful function, to avoid repetitions inside gui_BaseInput(), could be the gui_HandleSubExpEditKeys() function...
virtual mcInsertRes gui_BaseInsert (const mcElement &, mcElement *)=0
virtual mcMoveCursorRes gui_BaseMoveCursor (mcMoveCursorFlag, long modifiers)=0
 Handles cursor movements when the cursor is editing the base.
virtual int gui_BaseMoveCursorUsingPoint (wxDC &, const wxPoint &)=0
 Moves the cursor inside the base using the given point and, eventually the given DC for calculations.
virtual int gui_GetBaseRelCursorPos (wxDC &, wxPoint *) const =0
 Returns the height of the cursor and it's position (in the given pointer and in coordinates relatives to the top-left point of the base), when the cursor is editing the base.
virtual bool gui_DrawAsActiveOverBase () const =0
 Returns TRUE if the mcExpElement functions must draw as active the entire element when the cursor is over the base of the element.
virtual int gui_GetBaseOffsety () const
 Uses mcMathCore::gui_GetBaseOffsety() function to get the amount of y-pixels to leave before drawing the base: the y-offset of the base.
virtual int gui_GetBaseOffsetx () const
 Returns the offset of the x-coord.
virtual wxSize gui_GetBaseSize ()
 Returns the size of the base only.
virtual wxSize gui_GetBaseSize () const
 Returns the size of the base only (see the difference between the const and non-const version of mcElementHelpers::sgui_GetSize).
virtual void gui_OnBaseSelect (wxDC &dc, wxRect &rc)
 Handles selections for the base only.
virtual bool gui_hasBaseSthOnRightSide () const
 Returns TRUE if the exponent or the subscribt is visible on the right side of the element.
virtual bool gui_hasBaseSthOnLeftSide () const
 Returns TRUE if the exponent is visible on the left side of the element.
virtual bool gui_isOnRight (bool exp) const
 Returns TRUE if the exponent/subscript if placed on the right.
virtual mcElement gui_GetBaseSelection () const
 Returns the selected part of the base.
Utility functions
Functions which can be used both in base, exp and subscript handler functions.

int gui_HandleSubExpEditKeys (const mcKey &ev)
 Handles the mcMathCore::Get()->m_pgui_EditExpKey and the mcMathCore::Get()-> m_pgui_EditSubscriptKey keypresses, calling gui_EditExp() or gui_EditSub().
wxSize gui_GetBaseAndSubSize () const
 Returns the size of the base summed with the size of the subscript, if present.
virtual void gui_DrawNonActive (wxDC &dc, wxPoint &base, wxPoint &exp, wxPoint &sub) const
 gui_Draws as non active both the base, the exponent and the subscript.
virtual void gui_DrawActivationRect (wxDC &dc, int x, int y) const
 gui_Draws the activation rectangle of the entire element (base + exp + sub).
virtual void gui_DrawAllActive (wxDC &dc, wxPoint &orig, wxPoint &base, wxPoint &exp, wxPoint &sub) const
 gui_Draws the activation rectangle under the element and then draws both the base and the exponent (they should be both drawn as transparent).
bool gui_isCursorInExpSub (bool, bool bCheckBeginEndExp=TRUE) const
 Returns TRUE if the cursor is inside exp (and if exp is allocated and visible).
bool gui_isCursorInBase () const
 Returns TRUE if the cursor is inside the base.
Standard mcElement functions (overridables)
Override these functions only if you really need it; they call in the right order and with the right arguments the base and the exponent versions of the various functions.

Note that all the documentation reported is copied by Doxygen from mcElement functions.

virtual mcMoveCursorRes gui_MoveCursor (mcMoveCursorFlag flag, long modifiers)
 This function is called to move the cursor which is inside the element, one 'step' left, right, up or down (when flag=mcMCF_LEFT/mcMCF_RIGHT/mcMCF_UP/mcMCF_DOWN).
virtual mcInputRes gui_Input (const mcKey &ev, mcElement *newelem)
 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 &, mcElement *)
 Inserts the given element at the right of the cursor position.
virtual void gui_GetCursorPos (mcCursorPos &) const
 Returns the cursor position as Cursor Position flag.
virtual void gui_OnSelect (wxDC &dc, 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 void gui_SetCursorPos (const mcCursorPos &code)
 Sets the cursor position inside the element using Cursor Position flags.
virtual void gui_DoRecalcSize ()
 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 void gui_UpdateExpDepth ()
 Called by mcElement's standard functions to update the exponent depth of member classes.
virtual int gui_Draw (wxDC &dc, int x, int y, long flags, const wxPoint &pt) const
 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 int gui_GetRelCursorPos (wxDC &dc, wxPoint *pt) const
 Returns the height of the cursor and the (x;y) position of the cursor (in the given pointer) relative to the top-left point of this element.
virtual int gui_MoveCursorUsingPoint (wxDC &dc, const wxPoint &p)
 Moves the cursor inside this element in the closest available position to the given point.
virtual int gui_GetYAnchor () const
 Returns the y amount of this mcElement to subtract from the center line to draw this element.
virtual bool gui_isEndKey (const mcKey &ev) const
 Returns TRUE if the given character marks the end of this element; this function is always called before calling ::gui_Input function.
virtual mcElement gui_GetSelection () const
 Returns the selected portion of this element.
Math engine functions
Basic implementation.

virtual bool math_Compare (const mcElement &p, long flags) const
 Compares *this element with the given one and then compare the children of *this and the children of the given element, too.
mcRealValue math_GetLenght () const
 The raise-to-power operation has a little degree of complexity.
virtual mcRealValue math_Evaluate () const
 Evaluates the numeric value of this element and then returns it.
virtual mcBasicOpRes math_MakeReciprocal (mcElement *)
 Calculates the reciprocal of this element; tipically, this function creates a mcFraction whose numerator is 1 and the denominator contains *this.
virtual mcBasicOpRes math_MultiplyBy (const mcElement &, mcElement *)
 Multiplies two mcElements of the same type and stores the result in this object.
virtual mcBasicOpRes math_DivideBy (const mcElement &, mcElement *)
 Divides two mcElements of the same type and stores the result in this object.
virtual mcExpSimRes math_Simplify (long flags, mcElement *newelem)
 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)
 Expands this element one "step".
virtual mcMathType math_GetMathType () const
 A powerful recognizer function which automatically classifies the type of the math data contained in this class and returns the respective identifier.
Abstract BASE functions
Math functions regarding the base and not the exponent.

virtual mcMathType math_GetBaseMathType () const =0
virtual mcRealValue math_GetBaseLenght () const
virtual mcRealValue math_EvaluateBase () const =0
virtual mcExpSimRes math_ExpandBase (long flags, mcElement *newelem)=0
virtual mcExpSimRes math_SimplifyBase (long flags, mcElement *newelem)=0
virtual mcExpSimRes math_SimplifyBaseExp (long flags, mcElement *pnew)
virtual mcBasicOpRes math_MultiplyBaseOnlyBy (const mcElement &, mcElement *)=0
virtual mcBasicOpRes math_DivideBaseOnlyBy (const mcElement &, mcElement *)=0
virtual mcBasicOpRes math_MultiplyBaseBy (const mcElement &, mcElement *)
virtual mcBasicOpRes math_DivideBaseBy (const mcElement &, mcElement *)
mcMonomial math_GetLCM (const mcElement &) const
 Returns the LCM between *this and the given element.
mcMonomial math_GetGCD (const mcElement &) const
virtual mcMonomial math_GetBaseLCM (const mcElement &p) const
virtual mcMonomial math_GetBaseGCD (const mcElement &p) const

Static Public Member Functions

static bool io_ImportExpSub (const wxString &str, int *count, wxString &pErr)
static void io_GetExpSubInlinedToken (wxString &subexp)
 Returns the token containing the string to use to import the exponent/subscript found while importing an inlined expression.

Static Public Attributes

static bool smath_bConvertToRadicalWhenPossible = FALSE
 If TRUE, then the math_SimplifyExp function will convert this element to a mcRadical when the exponent is in the (0,1) range.

Protected Member Functions

void gui_Init ()
 Inits this section of the element.
mcExpSimRes math_SimplifyExp (long flags, mcElement *)
 Called by math_Simplify() when the exponent is ready to be simplified.

Protected Attributes

mcElement mdata_pExp
 The exponent handled by this class.
mcElement mdata_pSub
 The subscript handled by this class.
bool mdata_bExpEnabled
 If TRUE, the user can edit the exponent associated; if FALSE, the mcMathCore::Get()->m_pgui_EditExpKey will be rejected.
bool mdata_bSubEnabled
 If TRUE, the user can edit the subscript associated; if FALSE, the mcMathCore::Get()->m_pgui_EditSubscriptKey will be rejected.
bool mgui_bExpRight
 Defines the position of the 'exponent': this class, in fact, can be used not only to implement exponents, but also to implement the indexes of the radicals; just set to FALSE mgui_bExpRight (default is TRUE) to make the exponent placed on the left of the element.
bool mgui_bSubRight
 Defines the position of the 'subscript'.
wxSize mgui_szBase
 The size of the base only.
mcExpElemCursorLocation mgui_nCursorLoc
 The cursor position.


Constructor & Destructor Documentation

mcExpElementHelpers::mcExpElementHelpers  )  [inline]
 

Definition at line 231 of file ExpElement.h.

References mdata_bExpEnabled, mdata_bSubEnabled, mdata_pExp, and mdata_pSub.

virtual mcExpElementHelpers::~mcExpElementHelpers  )  [inline, virtual]
 

Definition at line 236 of file ExpElement.h.

References data_DestroyExpSub().


Member Function Documentation

void mcExpElementHelpers::data_CreateExpSub bool  exp  )  [virtual]
 

The exponent/subscript is mcEmptyElement as default (to avoid wasting memory allocating exp/sub which won't never be used...).

This function creates it (deleting the eventually present old exp/sub) and sets correctly its exponent level.

Definition at line 144 of file ExpElement.cpp.

References mcElementHelpers::data_AddProperty(), data_DestroyExpSub(), data_Get(), mcElement::data_isOk(), mcObject::data_SetRefData(), mcElement::gui_SetAsExpOf(), mcASSERT, mcEP_HAS(), mcLOG, mcTXTTHIS, mdata_bExpEnabled, mdata_bSubEnabled, mdata_pExp, and mdata_pSub.

Referenced by data_DeepCopyExpSub(), data_SetExpSub(), mcSymbolHelpers::data_SetSubscript(), gui_CreateExpSub(), mcRadicalHelpers::io_ImportBaseInlinedExpr(), mcFunctionHelpers::io_ImportInlinedExpr(), io_ImportInlinedExpr(), and math_GetExp().

void mcExpElementHelpers::data_DeepCopy const mcElementHelpers p  )  [virtual]
 

Deep copies the given mcExpElementHelpers, removing the exponent from this if it is not present in p or deep-copying it otherwise.

The same checks are performed on the subscript.

Reimplemented from mcElementHelpers.

Reimplemented in mcExpContainerHelpers, mcFunctionHelpers, mcNumberHelpers, and mcSymbolHelpers.

Definition at line 217 of file ExpElement.cpp.

References data_DeepCopyExpSub(), mdata_bExpEnabled, mdata_bSubEnabled, mgui_bExpRight, mgui_bSubRight, mgui_nCursorLoc, and mgui_szBase.

Referenced by mcSymbolHelpers::data_DeepCopy(), mcNumberHelpers::data_DeepCopy(), mcFunctionHelpers::data_DeepCopy(), and mcExpContainerHelpers::data_DeepCopy().

void mcExpElementHelpers::data_DeepCopyExpSub bool  exp,
const mcExpElementHelpers
 

An helper function of data_DeepCopy: works deep-copying only the exp/sub of the given mcExpElementHelpers class.

Definition at line 202 of file ExpElement.cpp.

References data_CreateExpSub(), mcElement::data_DeepCopy(), data_DestroyExpSub(), data_Get(), and mcEmptyElement.

Referenced by data_DeepCopy().

void mcExpElementHelpers::data_DestroyExpSub bool  exp  )  [virtual]
 

Destroys the exponent if present.

This function is called very few times: in fact, exponents, once created are usually hidden, not destroyed.

Definition at line 188 of file ExpElement.cpp.

References mcElementHelpers::data_RemoveProperty(), mcEmptyElement, mcEP_HAS(), mdata_pExp, and mdata_pSub.

Referenced by data_CreateExpSub(), mcFunctionHelpers::data_CreateSub(), data_DeepCopyExpSub(), mcSymbolHelpers::data_SetSubscript(), gui_DeleteExpSub(), mcBracketHelpers::math_RemoveExp(), math_Simplify(), mcNumberHelpers::math_SimplifyBaseExp(), mcExpContainerHelpers::math_SimplifyBaseExp(), math_SimplifyExp(), and ~mcExpElementHelpers().

const mcElement& mcExpElementHelpers::data_Get bool  bExp  )  const [inline]
 

Definition at line 337 of file ExpElement.h.

References mdata_pExp, and mdata_pSub.

mcElement& mcExpElementHelpers::data_Get bool  bExp  )  [inline]
 

Definition at line 335 of file ExpElement.h.

References mdata_pExp, and mdata_pSub.

Referenced by data_CreateExpSub(), data_DeepCopyExpSub(), data_SetExpSub(), gui_CreateExpSub(), gui_EditExpSub(), gui_ExpSubDraw(), gui_ExpSubInput(), gui_ExpSubMoveCursor(), gui_ExpSubMoveCursorUsingPoint(), gui_GetExpSubCursorPos(), gui_GetExpSubRelCursorPos(), gui_GetExpSubSize(), gui_isExpSubEndKey(), and gui_RecalcExpSubSize().

int mcExpElementHelpers::data_GetChildrenCount  )  const [inline, virtual]
 

Returns the number of children attached to this tree node.

This function can be used on *any* mcElement node because this is a virtual function which is overridden by container classes which thus return the correct number of children.

This function is used by various mcElement functions like data_Check() const data_GetElemFromID(), ... which must call some standard mcElement functions on all nodes attached to this element.

Reimplemented from mcElementHelpers.

Reimplemented in mcExpContainerHelpers, and mcFunctionHelpers.

Definition at line 277 of file ExpElement.h.

References mcElementHelpers::data_GetChildrenCount(), data_GetExp(), and data_GetSub().

Referenced by mcFunctionHelpers::data_GetChildrenCount(), mcExpContainerHelpers::data_GetChildrenCount(), and io_GetInlinedExpr().

const mcElement& mcExpElementHelpers::data_GetConstChild int  n  )  const [inline, virtual]
 

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));
     }

Parameters:
n The n-th child of this object.

Reimplemented from mcElementHelpers.

Reimplemented in mcExpContainerHelpers, and mcFunctionHelpers.

Definition at line 283 of file ExpElement.h.

References data_GetExp(), data_GetSub(), mcEmptyElement, and mcRETURN_ELEMENT_CHILD.

const mcElement& mcExpElementHelpers::data_GetExp  )  const [inline]
 

Definition at line 329 of file ExpElement.h.

References mdata_pExp.

mcElement& mcExpElementHelpers::data_GetExp  )  [inline]
 

Returns a pointer to the current exponent: the return value could be NULL.

Definition at line 328 of file ExpElement.h.

References mdata_pExp.

Referenced by data_GetChildrenCount(), data_GetConstChild(), data_SetChild(), gui_CheckExpSub(), gui_Draw(), mcFunctionHelpers::gui_ExpMoveCursor(), gui_GetSelection(), gui_Insert(), gui_MoveCursorUsingPoint(), gui_OnSelect(), gui_UpdateExpDepth(), mcRadicalHelpers::io_GetInlinedExpr(), io_GetInlinedExpr(), mcRadicalHelpers::io_GetMathML(), io_GetMathML(), mcRadicalHelpers::io_ImportBaseInlinedExpr(), mcFunctionHelpers::io_ImportInlinedExpr(), io_ImportInlinedExpr(), math_EvaluateExp(), math_GetConstExp(), math_GetExp(), math_hasExp(), math_MultOrDiv(), math_Simplify(), mcNumberHelpers::math_SimplifyBaseExp(), and math_SimplifyExp().

const mcElement& mcExpElementHelpers::data_GetSub  )  const [inline]
 

Definition at line 333 of file ExpElement.h.

References mdata_pSub.

mcElement& mcExpElementHelpers::data_GetSub  )  [inline]
 

Returns a pointer to the current subscript: the return value could be NULL.

Definition at line 332 of file ExpElement.h.

References mdata_pSub.

Referenced by data_GetChildrenCount(), data_GetConstChild(), data_SetChild(), mcSymbolHelpers::data_SetSubscript(), mcFunctionHelpers::gui_CheckSub(), gui_Insert(), mcSymbolHelpers::gui_SubInput(), mcFunctionHelpers::gui_SubMoveCursor(), gui_UpdateExpDepth(), mcFunctionHelpers::io_GetBaseInlinedExpr(), io_GetInlinedExpr(), io_GetMathML(), mcFunctionHelpers::io_ImportInlinedExpr(), io_ImportInlinedExpr(), math_CompareSub(), math_GetConstSub(), math_GetSub(), and math_hasSub().

void mcExpElementHelpers::data_SetChild int  n,
const mcElement newchild
[inline, virtual]
 

math_Replaces the idx-th child of this element with a copy of the given one.

Reimplemented from mcElementHelpers.

Reimplemented in mcExpContainerHelpers, and mcFunctionHelpers.

Definition at line 296 of file ExpElement.h.

References data_GetExp(), data_GetSub(), data_SetExpSub(), and mcSET_ELEMENT_CHILD.

void mcExpElementHelpers::data_SetExpSub bool  exp,
const mcElement p
[virtual]
 

Destroys the old exponent (if present) and replace it with the given element.

Definition at line 179 of file ExpElement.cpp.

References data_CreateExpSub(), mcElement::data_DeepCopy(), and data_Get().

Referenced by data_SetChild(), math_GetExp(), and math_SetExp().

virtual mcInputRes mcExpElementHelpers::gui_BaseInput const mcKey ev,
mcElement pnew
[pure virtual]
 

Handles the input when the cursor is editing the base; an useful function, to avoid repetitions inside gui_BaseInput(), could be the gui_HandleSubExpEditKeys() function...

Implemented in mcBracketHelpers, mcExpContainerHelpers, mcFunctionHelpers, mcNumberHelpers, and mcSymbolHelpers.

Referenced by gui_Input().

virtual mcInsertRes mcExpElementHelpers::gui_BaseInsert const mcElement ,
mcElement
[pure virtual]
 

Implemented in mcExpContainerHelpers, mcFunctionHelpers, mcNumberHelpers, and mcSymbolHelpers.

Referenced by gui_Insert().

virtual mcMoveCursorRes mcExpElementHelpers::gui_BaseMoveCursor mcMoveCursorFlag  ,
long  modifiers
[pure virtual]
 

Handles cursor movements when the cursor is editing the base.

This function should work ABSOLUTELY without care about the exponent or subscript presence or absence: if the cursor is placed on the rightmost point of the base, and the function is called with the mcMCF_RIGHT flag, then the function should return mcMCR_SETFOCUS_NEXT without any check: the mcExpElement::gui_MoveCursor function will check the return value of this function and will corerctly handle it !!!

Implemented in mcExpContainerHelpers, mcFunctionHelpers, mcNumberHelpers, and mcSymbolHelpers.

Referenced by gui_MoveCursor().

virtual int mcExpElementHelpers::gui_BaseMoveCursorUsingPoint wxDC &  ,
const wxPoint & 
[pure virtual]
 

Moves the cursor inside the base using the given point and, eventually the given DC for calculations.

Implemented in mcExpContainerHelpers, mcFunctionHelpers, mcNumberHelpers, and mcSymbolHelpers.

Referenced by gui_MoveCursorUsingPoint().

void mcExpElementHelpers::gui_CheckExpSub bool   )  [virtual]
 

Checks the contents of the exponent and eventually reset them.

This function is called by #gui_EditExp(). If you do not use as exponent a mcPolynomial, you must override this function (see mcExpElementData).

Definition at line 1263 of file ExpElement.cpp.

References data_GetExp(), mcElementArray::data_isArrayEmpty(), mcPolynomial::gui_AddNewEmptyMonomial(), and mcElementHelpers::gui_RecalcSize().

Referenced by gui_EditExpSub().

void mcExpElementHelpers::gui_CreateExpSub bool   )  [virtual]
 

Creates the exponent and inits it with an empty monomial.

Definition at line 254 of file ExpElement.cpp.

References data_CreateExpSub(), data_Get(), mcElementHelpers::data_GetType(), and mcET_POLYNOMIAL.

Referenced by gui_EditExpSub().

void mcExpElementHelpers::gui_DeleteExpSub bool   ) 
 

Deletes the exponent from this element as if it has never been created.

Definition at line 1306 of file ExpElement.cpp.

References data_DestroyExpSub(), mcElementHelpers::data_RemoveProperty(), gui_EditBase(), gui_SetBaseCursorPos(), mcCP_END, and mcEP_HAS().

Referenced by gui_ExpSubInput().

virtual void mcExpElementHelpers::gui_DoRecalcBaseSize  )  [pure virtual]
 

Calculates (in the m_szBase variable) the size of the base only.

It's very important not to modify the m_sz variable: m_sz is handled by mcExpElement functions: the base must modify ONLY *m_szBase*.

Implemented in mcBracketHelpers, mcFunctionHelpers, mcNumberHelpers, mcRadicalHelpers, and mcSymbolHelpers.

Referenced by gui_DoRecalcSize(), and gui_GetBaseSize().

void mcExpElementHelpers::gui_DoRecalcSize  )  [virtual]
 

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.

Note:
It's very important, to maintain the size member updated, to call, in the other mcElement functions, gui_RecalcSize() every time size could have changed (for example, in gui_Input(), mcElementData setters...).

Implements mcElementHelpers.

Definition at line 281 of file ExpElement.cpp.

References gui_DoRecalcBaseSize(), gui_GetBaseAndSubSize(), gui_GetBaseOffsety(), gui_GetBaseSize(), gui_GetExpSubOffsetx(), gui_GetExpSubSize(), gui_RecalcExpSubSize(), and mcMAX.

int mcExpElementHelpers::gui_Draw wxDC &  dc,
int  x,
int  y,
long  flags,
const wxPoint &  pt
const [virtual]
 

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.

Returns:
The ID of the element marked as active (the element which is drawn with mcElementHelpers::sgui_m_pActivationBrush as background), or mcDRW_NOACTIVEELEM flag if this element does not contain the mouse cursor.

Implements mcElementHelpers.

Definition at line 334 of file ExpElement.cpp.

References data_GetExp(), mcElementHelpers::data_GetID(), mcElementHelpers::data_hasProperty(), gui_DrawAllActive(), gui_DrawAsActiveOverBase(), gui_DrawBase(), gui_DrawNonActive(), gui_ExpSubDraw(), gui_GetBaseOffsetx(), gui_GetBaseOffsety(), gui_GetBaseSize(), gui_GetExpSubOffsetx(), gui_GetExpSubOffsety(), mcElementHelpers::gui_GetSize(), mcASSERT, mcDRW_ALLACTIVE, mcDRW_ALLOW_TOTAL_SELECTION, mcDRW_NOACTIVEELEM, mcDRW_NONACTIVE, mcDRW_USEPOINT, mcEP_HASEXPONENT, mcEP_HASSUBSCRIPT, mcGUILOG, and mcTXTTHIS.

void mcExpElementHelpers::gui_DrawActivationRect wxDC &  dc,
int  x,
int  y
const [virtual]
 

gui_Draws the activation rectangle of the entire element (base + exp + sub).

This function should be called BEFORE you draw the base and the exponent, because it fills the background with the activation brush.

Definition at line 303 of file ExpElement.cpp.

References mcElementHelpers::gui_GetSize().

Referenced by gui_DrawAllActive().

void mcExpElementHelpers::gui_DrawAllActive wxDC &  dc,
wxPoint &  orig,
wxPoint &  base,
wxPoint &  exp,
wxPoint &  sub
const [virtual]
 

gui_Draws the activation rectangle under the element and then draws both the base and the exponent (they should be both drawn as transparent).

Parameters:
dc The DC where the base and the exp will be drawn
x,y The position of this element on the given DC
w The exponent offsetx, or -1 to let this function calculate it
h The exponent offsety, or -1 to let this function calculate it

Definition at line 325 of file ExpElement.cpp.

References gui_DrawActivationRect(), and gui_DrawNonActive().

Referenced by gui_Draw().

virtual bool mcExpElementHelpers::gui_DrawAsActiveOverBase  )  const [pure virtual]
 

Returns TRUE if the mcExpElement functions must draw as active the entire element when the cursor is over the base of the element.

If this function returns FALSE, then the exponent is not drawn as active when cursor is inside the base.

This function should always return TRUE if the base is *not* a container of other elements (e.g. mcSymbol and mcNumber always return TRUE); in this way when the cursor is inside the base, the mcExpElement::gui_DrawActivationRect() will always be called and the gui_DrawBase() function will never be called with a pt != mcDRW_NONACTIVE. On the other hand, if the base contains other elements (e.g. mcBracket), this function should return FALSE, so that the gui_DrawBase() function is called with a valid pointer to the cursor position, if the mouse is inside the base. In this way, the container element can send the mouse cursor position to the contained elements, highligthing them only.

Implemented in mcExpContainerHelpers, mcFunctionHelpers, mcNumberHelpers, and mcSymbolHelpers.

Referenced by gui_Draw().

virtual int mcExpElementHelpers::gui_DrawBase wxDC &  dc,
int  x,
int  y,
long  flags,
const wxPoint &  pt
const [pure virtual]
 

Identical to mcElement::gui_Draw, but just for the base.

You have to draw it at the given point (x,y) without take care of the exp/sub, just do everything as they wouldn't exist. The given pointer to a wxPoint class can be mcDRW_NONACTIVE or a valid pointer value (in this case, the cursor is always inside the base). You can be sure that it will never be mcDRW_ALLACTIVE: this flag is completely handled by mcExpElement. If all the base must be drawn as active, the subscript should be too... you can use the #GetBaseAndSubSize function to make the task easier.

Parameters:
dc The DC where the base must be drawn
x,y The position on the DC where the base must be drawn
pt mcDRW_NONACTIVE or a valid pointer to the mouse position;
Returns:
The ID of the element which is placed under the given cursor position (this is typically hlp()->data_GetID(), but in some cases, like for mcBracket, it can be different) or mcDRW_NOACTIVELEM, if the mouse cursor is placed over empty space.

Implemented in mcExpContainerHelpers, mcFunctionHelpers, mcNumberHelpers, and mcSymbolHelpers.

Referenced by gui_Draw(), and gui_DrawNonActive().

void mcExpElementHelpers::gui_DrawNonActive wxDC &  dc,
wxPoint &  base,
wxPoint &  exp,
wxPoint &  sub
const [virtual]
 

gui_Draws as non active both the base, the exponent and the subscript.

Definition at line 316 of file ExpElement.cpp.

References gui_DrawBase(), gui_ExpSubDraw(), and mcDRW_NONACTIVE.

Referenced by gui_Draw(), and gui_DrawAllActive().

virtual void mcExpElementHelpers::gui_EditBase  )  [pure virtual]
 

Called when the cursor is switching from the exp/sub to the base; it should set the cursor inside the base: the correct position will be set using the gui_SetBaseCursorPos.

Implemented in mcExpContainerHelpers, mcFunctionHelpers, mcNumberHelpers, and mcSymbolHelpers.

Referenced by gui_DeleteExpSub(), gui_EditBaseAndSetPos(), and gui_ExpSubMoveCursor().

void mcExpElementHelpers::gui_EditBaseAndSetPos const mcCursorPos cp  )  [virtual]
 

Works as gui_EditBase() but this function also sets the cursor position inside the base with the given flag.

Reimplemented in mcFunctionHelpers.

Definition at line 1253 of file ExpElement.cpp.

References gui_EditBase(), and gui_SetBaseCursorPos().

Referenced by gui_ExpSubMoveCursor().

void mcExpElementHelpers::gui_EditExpSub bool   ) 
 

Sets the cursor inside the exponent (if the exponent doesn't exist or it is not visible, the function will create it or make it visible).

This function will set cursor position correctly only if the exponent was hidden before this call; if the exponent was already visible the cursor position inside the exponent is untouched.

Definition at line 1203 of file ExpElement.cpp.

References mcElementHelpers::data_AddProperty(), data_Get(), mcElementHelpers::data_hasProperty(), mcMathCore::Get(), gui_CheckExpSub(), gui_CreateExpSub(), mcElementHelpers::gui_RecalcSize(), mcElement::gui_SetCursorPos(), mcElementHelpers::math_isExpAllowed(), mcElementHelpers::math_isSubAllowed(), mcCP_END, mcECL_INSIDE(), mcEmptyElement, mcEP_HAS(), mgui_nCursorLoc, and mcMathCore::SyntaxError().

Referenced by mcFunctionHelpers::gui_BaseMoveCursor(), gui_ExpSubInput(), gui_ExpSubMoveCursor(), gui_HandleSubExpEditKeys(), mcFunctionHelpers::gui_MoveCursor(), and gui_MoveCursor().

int mcExpElementHelpers::gui_ExpSubDraw bool  ,
wxDC &  ,
int  ,
int  ,
long  flags,
const wxPoint & 
const
 

Works exactly as mcElementHelpers::sgui_Draw, just on the exponent, checking, before drawing, if the exponent is visible.

Definition at line 877 of file ExpElement.cpp.

References data_Get(), mcElementHelpers::data_hasProperty(), mcElement::gui_Draw(), mcDRW_NOACTIVEELEM, and mcEP_HAS().

Referenced by gui_Draw(), and gui_DrawNonActive().

mcInputRes mcExpElementHelpers::gui_ExpSubInput bool  ,
const mcKey ev,
mcElement pnew
[virtual]
 

Handles input when cursor is inside the exponent; this function returns mcECL_NOTINSIDEEXP if cursor is not inside exponent, mcIR_OKAY otherwise.

You can override this function to intercept exponent changes.

Definition at line 1152 of file ExpElement.cpp.

References data_Get(), gui_DeleteExpSub(), gui_EditExpSub(), gui_ExpSubMoveCursor(), mcElement::gui_Input(), mcElementHelpers::gui_RecalcSize(), mcASSERT, mcECL_BEGIN(), mcECL_END(), mcECL_INSIDE(), mcGetEditKey(), mcIR_DELETE_PREVIOUS, mcIR_DELETE_THIS, mcIR_OKAY, mcMCF_LEFT, mcMCF_NOMODIFIERS, and mgui_nCursorLoc.

Referenced by gui_Input(), and mcSymbolHelpers::gui_SubInput().

mcMoveCursorRes mcExpElementHelpers::gui_ExpSubMoveCursor bool  ,
mcMoveCursorFlag  ,
long 
[virtual]
 

Handles the movements of the cursor when it's inside the exponent (if the cursor is not in the exponent, the function returns mcECL_NOTINSIDEEXP).

Definition at line 1003 of file ExpElement.cpp.

References data_Get(), gui_EditBase(), gui_EditBaseAndSetPos(), gui_EditExpSub(), gui_isOnRight(), mcElement::gui_MoveCursor(), mcElement::gui_SetCursorPos(), mcASSERT, mcCP_BEGIN, mcCP_END, mcECL_BEGIN(), mcECL_END(), mcECL_INSIDE(), mcMCF_DOWN, mcMCF_LEFT, mcMCF_RIGHT, mcMCF_UP, mcMCR_OKAY, mcMCR_SETFOCUS_ABOVE, mcMCR_SETFOCUS_BELOW, mcMCR_SETFOCUS_NEXT, mcMCR_SETFOCUS_PREVIOUS, and mgui_nCursorLoc.

Referenced by gui_ExpSubInput(), mcFunctionHelpers::gui_MoveCursor(), and gui_MoveCursor().

int mcExpElementHelpers::gui_ExpSubMoveCursorUsingPoint bool  ,
wxDC &  dc,
const wxPoint &  p
 

Definition at line 1143 of file ExpElement.cpp.

References data_Get(), gui_isCursorInExpSub(), mcElement::gui_MoveCursorUsingPoint(), and mcNotInside().

Referenced by gui_MoveCursorUsingPoint().

wxSize mcExpElementHelpers::gui_GetBaseAndSubSize  )  const
 

Returns the size of the base summed with the size of the subscript, if present.

The function doesn't really sum up the two sizes: it must use the #gui_GetSubOffsety() and #gui_GetSubOffsetx() functions....

Definition at line 797 of file ExpElement.cpp.

References mcElementHelpers::data_hasProperty(), gui_GetBaseOffsety(), gui_GetBaseSize(), gui_GetExpSubOffsety(), gui_GetExpSubSize(), mcEP_HASSUBSCRIPT, and mcMAX.

Referenced by gui_DoRecalcSize(), and mcSymbolHelpers::gui_DrawBase().

virtual mcCursorPos mcExpElementHelpers::gui_GetBaseCursorPos  )  const [inline, virtual]
 

Definition at line 522 of file ExpElement.h.

Referenced by gui_GetCursorPos(), and gui_isEndKey().

virtual void mcExpElementHelpers::gui_GetBaseCursorPos mcCursorPos  )  const [pure virtual]
 

Returns one of the cursor position flags (called only when cursor is inside the base).

Implemented in mcExpContainerHelpers, mcFunctionHelpers, mcNumberHelpers, and mcSymbolHelpers.

int mcExpElementHelpers::gui_GetBaseOffsetx  )  const [virtual]
 

Returns the offset of the x-coord.

of the base: override if you want some special effect (default value is zero).

Definition at line 927 of file ExpElement.cpp.

Referenced by gui_Draw(), and gui_GetRelCursorPos().

int mcExpElementHelpers::gui_GetBaseOffsety  )  const [virtual]
 

Uses mcMathCore::gui_GetBaseOffsety() function to get the amount of y-pixels to leave before drawing the base: the y-offset of the base.

Reimplemented in mcRadicalHelpers.

Definition at line 924 of file ExpElement.cpp.

References mcElementHelpers::gui_GetBaseOffsety(), and gui_GetExpSubSize().

Referenced by gui_DoRecalcSize(), gui_Draw(), gui_GetBaseAndSubSize(), mcSymbolHelpers::gui_GetBaseRelCursorPos(), gui_GetExpSubOffsety(), gui_GetRelCursorPos(), gui_GetYAnchor(), mcExpContainerHelpers::gui_GetYAnchor(), gui_MoveCursorUsingPoint(), and gui_OnSelect().

virtual int mcExpElementHelpers::gui_GetBaseRelCursorPos wxDC &  ,
wxPoint * 
const [pure virtual]
 

Returns the height of the cursor and it's position (in the given pointer and in coordinates relatives to the top-left point of the base), when the cursor is editing the base.

Implemented in mcExpContainerHelpers, mcFunctionHelpers, mcNumberHelpers, and mcSymbolHelpers.

Referenced by gui_GetRelCursorPos().

virtual mcElement mcExpElementHelpers::gui_GetBaseSelection  )  const [inline, virtual]
 

Returns the selected part of the base.

Reimplemented in mcExpContainerHelpers.

Definition at line 615 of file ExpElement.h.

References mcEmptyElement.

Referenced by gui_GetSelection().

virtual wxSize mcExpElementHelpers::gui_GetBaseSize  )  const [inline, virtual]
 

Returns the size of the base only (see the difference between the const and non-const version of mcElementHelpers::sgui_GetSize).

Definition at line 587 of file ExpElement.h.

References mgui_szBase.

virtual wxSize mcExpElementHelpers::gui_GetBaseSize  )  [inline, virtual]
 

Returns the size of the base only.

The standard implementation of this function checks if the m_szBase variable is okay; if not it calls the gui_DoRecalcBaseSize. Override only if you need.

Definition at line 579 of file ExpElement.h.

References gui_DoRecalcBaseSize(), and mgui_szBase.

Referenced by gui_DoRecalcSize(), gui_Draw(), mcNumberHelpers::gui_DrawBase(), mcRadicalHelpers::gui_DrawContainer(), gui_GetBaseAndSubSize(), mcSymbolHelpers::gui_GetBaseRelCursorPos(), mcExpContainerHelpers::gui_GetBaseRelCursorPos(), gui_GetExpSubOffsetx(), gui_GetExpSubOffsety(), mcFunctionHelpers::gui_GetNameOffsety(), gui_GetYAnchor(), and gui_MoveCursorUsingPoint().

void mcExpElementHelpers::gui_GetCursorPos mcCursorPos  )  const [virtual]
 

Returns the cursor position as Cursor Position flag.

It must return mcCP_BEGIN if cursor is at the leftmost point of the element, mcCP_END if the cursor is at the rightmost point of the element, mcCP_INSIDE otherwise. When this function is called the cursor is always inside the element.

Implements mcElementHelpers.

Definition at line 688 of file ExpElement.cpp.

References gui_GetBaseCursorPos(), gui_GetExpSubCursorPos(), gui_hasBaseSthOnLeftSide(), gui_hasBaseSthOnRightSide(), gui_isCursorInExpSub(), mcCursorPos::gui_Push(), mcCursorPos::isBegin(), mcCursorPos::isEnd(), mcCP_BEGIN, mcCP_END, and mgui_nCursorLoc.

void mcExpElementHelpers::gui_GetExpSubCursorPos bool  ,
mcCursorPos
const
 

Returns the Cursor Position flag (mcCP_***) if the cursor is inside the exponent.

Definition at line 1289 of file ExpElement.cpp.

References data_Get(), mcElementHelpers::data_hasProperty(), mcElement::gui_GetCursorPos(), mcCP_BEGIN, mcCP_END, mcCP_UNDEFINED, mcECL_BEGIN(), mcECL_END(), mcECL_INSIDE(), mcEP_HAS(), and mgui_nCursorLoc.

Referenced by gui_GetCursorPos().

int mcExpElementHelpers::gui_GetExpSubOffsetx bool   )  const [virtual]
 

Returns the offset (respect to the top-left point of the bounding box of the element) for the x coord.

used to draw the exponent. This function usually returns the width of the base (and it's exactly what standard implementation does); if you need to do something else, override it.

Definition at line 945 of file ExpElement.cpp.

References gui_GetBaseSize(), and gui_isOnRight().

Referenced by gui_DoRecalcSize(), gui_Draw(), mcFunctionHelpers::gui_GetArgOffsetx(), gui_GetExpSubRelCursorPos(), and gui_OnSelect().

int mcExpElementHelpers::gui_GetExpSubOffsety bool   )  const [virtual]
 

Returns the y-offset of the exponent (usually zero).

Definition at line 935 of file ExpElement.cpp.

References gui_GetBaseOffsety(), gui_GetBaseSize(), and mcElementHelpers::gui_GetSubscriptOffsety().

Referenced by gui_Draw(), gui_GetBaseAndSubSize(), and gui_GetExpSubRelCursorPos().

int mcExpElementHelpers::gui_GetExpSubRelCursorPos bool  ,
wxDC &  ,
wxPoint * 
const [virtual]
 

Returns the height of the cursor (or mcECL_NOTINSIDEEXP flag) and its position (using the given pointer) in coordinates relative to the top-left point of the bounding rect of the entire element.

Definition at line 961 of file ExpElement.cpp.

References data_Get(), gui_GetExpSubOffsetx(), gui_GetExpSubOffsety(), mcElementHelpers::gui_GetHeight(), mcElement::gui_GetRelCursorPos(), mcElementHelpers::gui_GetWidth(), mcECL_BEGIN(), mcECL_END(), mcECL_INSIDE(), mcNotInside(), and mgui_nCursorLoc.

Referenced by gui_GetRelCursorPos().

wxSize mcExpElementHelpers::gui_GetExpSubSize bool   )  const
 

Definition at line 901 of file ExpElement.cpp.

References data_Get(), mcElementHelpers::data_hasProperty(), mcElement::gui_GetSize(), and mcEP_HAS().

wxSize mcExpElementHelpers::gui_GetExpSubSize bool   ) 
 

This function returns only the exponent size (which should be different from element size).

Definition at line 888 of file ExpElement.cpp.

References data_Get(), mcElementHelpers::data_hasProperty(), mcElement::gui_GetSize(), and mcEP_HAS().

Referenced by mcRadicalHelpers::gui_DoRecalcBaseSize(), gui_DoRecalcSize(), mcRadicalHelpers::gui_DrawContainer(), mcFunctionHelpers::gui_GetArgOffsetx(), gui_GetBaseAndSubSize(), gui_GetBaseOffsety(), mcRadicalHelpers::gui_GetContentOffsetX(), and mcRadicalHelpers::gui_GetVWidth().

int mcExpElementHelpers::gui_GetRelCursorPos wxDC &  dc,
wxPoint *  pt
const [virtual]
 

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.

Parameters:
dc The device context where the element was drawn last time.
pt The coordinates, relative to the element (assume the element placed at 0;0), indicating the top-left point of the cursor.

Implements mcElementHelpers.

Definition at line 712 of file ExpElement.cpp.

References gui_GetBaseOffsetx(), gui_GetBaseOffsety(), gui_GetBaseRelCursorPos(), gui_GetExpSubRelCursorPos(), and gui_isCursorInExpSub().

mcElement mcExpElementHelpers::gui_GetSelection  )  const [virtual]
 

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 from mcElementHelpers.

Definition at line 515 of file ExpElement.cpp.

References data_GetExp(), mcElementHelpers::data_hasProperty(), gui_GetBaseSelection(), mcElement::gui_GetSelection(), mcElementHelpers::gui_isAllSelected(), mcElementHelpers::gui_isSelected(), mcElementHelpers::mcElement, and mcEP_HASEXPONENT.

int mcExpElementHelpers::gui_GetYAnchor  )  const [virtual]
 

Returns the y amount of this mcElement to subtract from the center line to draw this element.

Reimplemented from mcElementHelpers.

Reimplemented in mcExpContainerHelpers.

Definition at line 730 of file ExpElement.cpp.

References gui_GetBaseOffsety(), and gui_GetBaseSize().

int mcExpElementHelpers::gui_HandleSubExpEditKeys const mcKey ev  ) 
 

Handles the mcMathCore::Get()->m_pgui_EditExpKey and the mcMathCore::Get()-> m_pgui_EditSubscriptKey keypresses, calling gui_EditExp() or gui_EditSub().

If the given keypress is not the EDITEXP or EDITSUBSCRIPT key, then the function returns a value which is not mcIR_OKAY.

Definition at line 776 of file ExpElement.cpp.

References gui_EditExpSub(), mcIR_OKAY, mdata_bExpEnabled, and mdata_bSubEnabled.

Referenced by mcSymbolHelpers::gui_BaseInput(), mcNumberHelpers::gui_BaseInput(), mcFunctionHelpers::gui_BaseInput(), and mcExpContainerHelpers::gui_BaseInput().

bool mcExpElementHelpers::gui_hasBaseSthOnLeftSide  )  const [virtual]
 

Returns TRUE if the exponent is visible on the left side of the element.

Default implementation checks if the exponent is placed on the left of the element and it's visible.

Definition at line 769 of file ExpElement.cpp.

References mcElementHelpers::data_hasProperty(), gui_isOnRight(), and mcEP_HASEXPONENT.

Referenced by gui_GetCursorPos(), gui_isEndKey(), and gui_SetCursorPos().

bool mcExpElementHelpers::gui_hasBaseSthOnRightSide  )  const [virtual]
 

Returns TRUE if the exponent or the subscribt is visible on the right side of the element.

Default implementation checks it the exponent is placed on the right and the exponent or the subscript are visible...

Reimplemented in mcFunctionHelpers.

Definition at line 761 of file ExpElement.cpp.

References mcElementHelpers::data_hasProperty(), gui_isOnRight(), mcEP_HASEXPONENT, and mcEP_HASSUBSCRIPT.

Referenced by gui_GetCursorPos(), gui_isEndKey(), and gui_SetCursorPos().

void mcExpElementHelpers::gui_Init  )  [inline, protected, virtual]
 

Inits this section of the element.

Acts like a constructor (it's called by mcElementHelpers).

Reimplemented from mcElementHelpers.

Reimplemented in mcExpContainerHelpers, mcFunctionHelpers, mcNumberHelpers, and mcSymbolHelpers.

Definition at line 243 of file ExpElement.h.

References mcElementHelpers::gui_Init(), mcECL_INSIDEBASE, mgui_bExpRight, mgui_bSubRight, and mgui_nCursorLoc.

Referenced by mcSymbolHelpers::gui_Init(), mcNumberHelpers::gui_Init(), mcFunctionHelpers::gui_Init(), and mcExpContainerHelpers::gui_Init().

mcInputRes mcExpElementHelpers::gui_Input const mcKey ev,
mcElement newelem
[virtual]
 

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.

Parameters:
ev The wxWidgets key event for the keypress. It contains the untraslated code for the input key; see wxWidgets KeyCodes for more info.
newelem If the function returns mcIR_REPLACE_THIS, the caller will use this pointer as a substitute for this element (which will be deleted).

Implements mcElementHelpers.

Definition at line 450 of file ExpElement.cpp.

References gui_BaseInput(), gui_ExpSubInput(), and gui_isCursorInExpSub().

mcInsertRes mcExpElementHelpers::gui_Insert const mcElement ,
mcElement
[virtual]
 

Inserts the given element at the right of the cursor position.

Implements mcElementHelpers.

Definition at line 459 of file ExpElement.cpp.

References data_GetExp(), data_GetSub(), gui_BaseInsert(), mcElement::gui_Insert(), and gui_isCursorInExpSub().

virtual bool mcExpElementHelpers::gui_isBaseEndKey const mcKey ev  )  const [pure virtual]
 

This function should work as mcElement::isEndChar function, but it should care only for the base; this means that the element should not handle the mcEXPELEM_**** cursor positions, but it will probably still need to check for exp/sub presence to choose if the given keyevent is the end key.

When the cursor is inside the exp/sub, this function is never called. Derived classes must also implement the mcElementHelpers::gui_isBeginChar function.

Implemented in mcExpContainerHelpers, mcFunctionHelpers, mcNumberHelpers, and mcSymbolHelpers.

Referenced by gui_isEndKey().

bool mcExpElementHelpers::gui_isCursorInBase  )  const
 

Returns TRUE if the cursor is inside the base.

Definition at line 753 of file ExpElement.cpp.

References mcECL_INSIDEBASE, and mgui_nCursorLoc.

Referenced by mcFunctionHelpers::gui_MoveCursor(), and gui_MoveCursor().

bool mcExpElementHelpers::gui_isCursorInExpSub bool  ,
bool  bCheckBeginEndExp = TRUE
const
 

Returns TRUE if the cursor is inside exp (and if exp is allocated and visible).

Parameters:
bCheckBeginEndExp If TRUE, the function will return TRUE even if the cursor is set to mcEXPELEM_EXPBEGIN or mcEXPELEM_EXPEND.

Definition at line 820 of file ExpElement.cpp.

References mcElementHelpers::data_hasProperty(), mcECL_END(), mcECL_EXPONENTBEGIN, mcECL_INSIDE(), mcEP_HAS(), and mgui_nCursorLoc.

Referenced by gui_ExpSubMoveCursorUsingPoint(), gui_GetCursorPos(), gui_GetRelCursorPos(), gui_Input(), gui_Insert(), gui_isEndKey(), mcFunctionHelpers::gui_MoveCursor(), and gui_MoveCursor().

bool mcExpElementHelpers::gui_isEndKey const mcKey ev  )  const [virtual]
 

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

Parameters:
ev The wxWidgets key event for the keypress. It contains the untraslated code for the input key; see wxWidgets KeyCodes for more info.

Implements mcElementHelpers.

Definition at line 262 of file ExpElement.cpp.

References gui_GetBaseCursorPos(), gui_hasBaseSthOnLeftSide(), gui_hasBaseSthOnRightSide(), gui_isBaseEndKey(), gui_isCursorInExpSub(), and gui_isExpSubEndKey().

bool mcExpElementHelpers::gui_isExpSubEndKey bool  ,
const mcKey
const
 

Returns TRUE if the given char is the end char for the exponent and the cursor is actually editing the exponent.

If cursor is not inside the exponent, if will always return FALSE.

Definition at line 840 of file ExpElement.cpp.

References data_Get(), mcElement::gui_isEndKey(), mcECL_BEGIN(), mcECL_END(), mcECL_INSIDE(), mcGetEditKey(), and mgui_nCursorLoc.

Referenced by gui_isEndKey().

bool mcExpElementHelpers::gui_isExpSubEndKeyHelper bool  exp,
const mcKey ev
const
 

virtual bool mcExpElementHelpers::gui_isOnRight bool  exp  )  const [inline, virtual]
 

Returns TRUE if the exponent/subscript if placed on the right.

Definition at line 611 of file ExpElement.h.

References mgui_bExpRight, and mgui_bSubRight.

Referenced by gui_ExpSubMoveCursor(), gui_GetExpSubOffsetx(), gui_hasBaseSthOnLeftSide(), gui_hasBaseSthOnRightSide(), gui_MoveCursor(), gui_SetCursorPos(), and gui_SetExpSubCursorPos().

mcMoveCursorRes mcExpElementHelpers::gui_MoveCursor mcMoveCursorFlag  flag,
long  modifiers
[virtual]
 

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.

Parameters:
flag One of the Move Cursor flags (see MathTypes.h)

Implements mcElementHelpers.

Reimplemented in mcFunctionHelpers.

Definition at line 532 of file ExpElement.cpp.

References mcElementHelpers::data_hasProperty(), gui_BaseMoveCursor(), gui_EditExpSub(), gui_ExpSubMoveCursor(), gui_isCursorInBase(), gui_isCursorInExpSub(), gui_isOnRight(), mcEP_HASEXPONENT, mcEP_HASSUBSCRIPT, mcMCR_CANNOT_SETFOCUS, mcMCR_OKAY, mcMCR_SETFOCUS_ABOVE, mcMCR_SETFOCUS_BELOW, mcMCR_SETFOCUS_NEXT, and mcMCR_SETFOCUS_PREVIOUS.

int mcExpElementHelpers::gui_MoveCursorUsingPoint wxDC &  dc,
const wxPoint &  p
[virtual]
 

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).

Parameters:
dc The device context where the element was drawn last time
p a valid pointer to a wxPoint (containing coord. relative to the top-left point of the element) which must be used to find the selected subelement; otherwise this is a NULL value

Implements mcElementHelpers.

Definition at line 603 of file ExpElement.cpp.

References data_GetExp(), mcElementHelpers::data_hasProperty(), gui_BaseMoveCursorUsingPoint(), gui_ExpSubMoveCursorUsingPoint(), gui_GetBaseOffsety(), gui_GetBaseSize(), mcElement::gui_GetSize(), mcECL_INSIDEBASE, mcECL_INSIDEEXPONENT, mcEP_HASEXPONENT, mcMCR_CANNOT_SETFOCUS, mcMCR_OKAY, and mgui_nCursorLoc.

virtual void mcExpElementHelpers::gui_OnBaseSelect wxDC &  dc,
wxRect &  rc
[inline, virtual]
 

Handles selections for the base only.

Called when the base (or the empty space) bounding box only intersects the selection rectangle, this function should call the mcElement::gui_Select() function or, for container classes, call the appropriate gui_OnSelect function of the children elements. The standard implementation if or basic classes and just calls the mcElement::gui_Select() function. Override only if you need.

Reimplemented in mcExpContainerHelpers.

Definition at line 595 of file ExpElement.h.

References mcElementHelpers::gui_SelectAll().

Referenced by gui_OnSelect().

void mcExpElementHelpers::gui_OnSelect wxDC &  dc,
wxRect &  rc
[virtual]
 

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 from mcElementHelpers.

Definition at line 471 of file ExpElement.cpp.

References data_GetExp(), mcElementHelpers::data_hasProperty(), mcElementHelpers::gui_DeSelect(), gui_GetBaseOffsety(), gui_GetExpSubOffsetx(), mcElementHelpers::gui_GetSize(), mcElementHelpers::gui_isSelected(), gui_OnBaseSelect(), mcElement::gui_OnSelect(), mcElementHelpers::gui_Select(), mcElementHelpers::gui_SelectAll(), mcEP_HASEXPONENT, and mgui_szBase.

void mcExpElementHelpers::gui_RecalcExpSubSize bool   ) 
 

Forces the recalculation of exponent's size.

Definition at line 911 of file ExpElement.cpp.

References data_Get(), mcElement::gui_RecalcSize(), and mcEmptyElement.

Referenced by gui_DoRecalcSize().

virtual void mcExpElementHelpers::gui_SetBaseCursorPos const mcCursorPos  )  [pure virtual]
 

Sets the cursor position of the element.

When this function is called with the mcCP_BEGIN flag, it must set the cursor at the leftmost point of the base; when this function is called with mcCP_END flag, the function must set the cursor at the rightmost point of the base. It should never check exponent/subscript presence: everything is handled by mcExpElement.

Implemented in mcExpContainerHelpers, mcFunctionHelpers, mcNumberHelpers, and mcSymbolHelpers.

Referenced by gui_DeleteExpSub(), gui_EditBaseAndSetPos(), and gui_SetCursorPos().

void mcExpElementHelpers::gui_SetCursorPos const mcCursorPos code  )  [virtual]
 

Sets the cursor position inside the element using Cursor Position flags.

When it's called to set the cursor at the end of the base, code==mcCP_END and data_hasProperty(mcEP_HASEXPONENT) == FALSE, when it's called to set the cursor at the beginning of the base, code==mcCP_BEGIN. The function doesnt need to care for the third Cursor Position flag: mcCP_INSIDE, actually this function will never be called with this code.

Implements mcElementHelpers.

Reimplemented in mcFunctionHelpers.

Definition at line 655 of file ExpElement.cpp.

References mcElementHelpers::data_hasProperty(), gui_hasBaseSthOnLeftSide(), gui_hasBaseSthOnRightSide(), gui_isOnRight(), gui_SetBaseCursorPos(), gui_SetExpSubCursorPos(), mcASSERT, mcEP_HASEXPONENT, and mcEP_HASSUBSCRIPT.

void mcExpElementHelpers::gui_SetExpSubCursorPos bool  ,
const mcCursorPos code
 

If the exponent is placed on the right of the element, handles the mcCP_END flag, setting cursor position at the end of the exponent; if the exponent is placed on the left, handles the mcCP_BEGIN flag.

Definition at line 1278 of file ExpElement.cpp.

References mcElementHelpers::data_hasProperty(), gui_isOnRight(), mcECL_BEGIN(), mcECL_END(), mcEP_HAS(), and mgui_nCursorLoc.

Referenced by gui_SetCursorPos().

void mcExpElementHelpers::gui_UpdateExpDepth  )  [virtual]
 

Called by mcElement's standard functions to update the exponent depth of member classes.

Override this function if you need to update member variables when the exponent level of this element changes (this happens each time gui_SetExpDepth() function is called; thus this happens each time gui_SetAsExpOf or gui_SetAtSameLevelOf functions are called).

Note:
This function DOES NOT call the gui_RecalcSize() function, even if probably it is required after such function.

Reimplemented from mcElementHelpers.

Reimplemented in mcExpContainerHelpers.

Definition at line 739 of file ExpElement.cpp.

References data_GetExp(), data_GetSub(), mcElement::gui_SetAsExpOf(), mcElementHelpers::gui_UpdateExpDepth(), and mcEmptyElement.

Referenced by mcExpContainerHelpers::gui_UpdateExpDepth().

virtual wxString mcExpElementHelpers::io_GetBaseInlinedExpr  )  const [pure virtual]
 

Implemented in mcBracketHelpers, mcFunctionHelpers, mcNumberHelpers, mcRadicalHelpers, and mcSymbolHelpers.

Referenced by io_GetInlinedExpr().

virtual wxXml2Node mcExpElementHelpers::io_GetBaseMathML bool  bGetPresentation  )  const [pure virtual]
 

Returns a MathML tree with the presentation math markup language regarding the base.

This function should work exactly as the hononymous mcElement function.

Parameters:
bGetPresentation If TRUE, this function returns the presentation MathML, otherwise it returns the content markup.

Implemented in mcExpContainerHelpers, mcFunctionHelpers, mcNumberHelpers, mcRadicalHelpers, and mcSymbolHelpers.

Referenced by io_GetMathML().

void mcExpElementHelpers::io_GetExpSubInlinedToken wxString &  subexp  )  [static]
 

Returns the token containing the string to use to import the exponent/subscript found while importing an inlined expression.

Reimplemented in mcFunctionHelpers.

Definition at line 1436 of file ExpElement.cpp.

References GetLastRightBracketIdx().

Referenced by mcParenthesisHelpers::io_ImportInlinedExpr(), and io_ImportInlinedExpr().

wxString mcExpElementHelpers::io_GetInlinedExpr  )  const [virtual]
 

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:

  • "^" introduces an exponent
  • "_" introduces a subscript Some examples of inlined expressions are: "4x^2+5a*sin(x/4)", "cos^2(PI/2)+ (123ax+b)/c >= 0", ....

Implements mcElementHelpers.

Reimplemented in mcRadicalHelpers.

Definition at line 1388 of file ExpElement.cpp.

References data_GetChildrenCount(), data_GetExp(), data_GetSub(), mcElementHelpers::data_GetType(), mcElementHelpers::data_hasProperty(), io_GetBaseInlinedExpr(), mcElement::io_GetInlinedExpr(), mcEP_HASEXPONENT, mcEP_HASSUBSCRIPT, and mcET_BRACKET.

wxXml2Node mcExpElementHelpers::io_GetMathML bool  bGetPresentation  )  const [virtual]
 

Returns the MathML tree which describes this element and, eventually, its exponent and its subscript.

Implements mcElementHelpers.

Reimplemented in mcFunctionHelpers, and mcRadicalHelpers.

Definition at line 1334 of file ExpElement.cpp.

References data_GetExp(), data_GetSub(), mcElementHelpers::data_hasProperty(), io_GetBaseMathML(), mcASSERT, mcEP_HASEXPONENT, and mcEP_HASSUBSCRIPT.

virtual bool mcExpElementHelpers::io_ImportBaseInlinedExpr const wxString &  ,
int *  ,
wxString & 
[pure virtual]
 

Implemented in mcBracketHelpers, mcFunctionHelpers, mcNumberHelpers, mcRadicalHelpers, and mcSymbolHelpers.

Referenced by io_ImportInlinedExpr().

static bool mcExpElementHelpers::io_ImportExpSub const wxString &  str,
int *  count,
wxString &  pErr
[static]
 

bool mcExpElementHelpers::io_ImportInlinedExpr const wxString &  str,
int *  count,
wxString &  pErr
[virtual]
 

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 count parameter which must *absolutely* be set by this function.

Parameters:
str The string containing the inlined expression to import.
count A pointer where is stored the number of characters of str imported by this function.
pErr The string where the error description is placed, if the function returns FALSE.
Returns:
TRUE on success: the first (and eventually the following) characters of the given string represent an encoded inline expression of this element and they were successfully recognized and imported.

Implements mcElementHelpers.

Reimplemented in mcFunctionHelpers.

Definition at line 1464 of file ExpElement.cpp.

References data_CreateExpSub(), data_GetExp(), data_GetSub(), io_GetExpSubInlinedToken(), io_ImportBaseInlinedExpr(), and mcIOLOG.

Referenced by mcRadicalHelpers::io_ImportBaseInlinedExpr().

bool mcExpElementHelpers::math_Compare const mcElement p,
long  flags
const [virtual]
 

Compares *this element with the given one and then compare the children of *this and the children of the given element, too.

If they are the same, then the function returns TRUE; FALSE otherwise. This function is different from #math_hasSameContentOf() because it doesn't work on MaxSimply()ed copies. This function tipically uses the math_CompareThisOnly() function.

Implements mcElementHelpers.

Definition at line 1752 of file ExpElement.cpp.

References mcElementHelpers::data_GetType(), math_CompareExp(), math_CompareSub(), and mcElementHelpers::math_CompareThisOnly().

bool mcExpElementHelpers::math_CompareExp const mcExpElement ,
long  flags
const
 

Definition at line 1733 of file ExpElement.cpp.

References mcElement::math_Compare(), and math_GetExp().

Referenced by math_Compare().

bool mcExpElementHelpers::math_CompareSub const mcExpElement ,
long  flags
const
 

Definition at line 1743 of file ExpElement.cpp.

References data_GetSub(), and mcElement::math_Compare().

Referenced by math_Compare().

virtual mcBasicOpRes mcExpElementHelpers::math_DivideBaseBy const mcElement ,
mcElement
[inline, virtual]
 

Reimplemented in mcNumberHelpers.

Definition at line 819 of file ExpElement.h.

References mcBOR_REMOVE_OPERAND.

Referenced by math_MultOrDiv().

virtual mcBasicOpRes mcExpElementHelpers::math_DivideBaseOnlyBy const mcElement ,
mcElement
[pure virtual]
 

Implemented in mcExpContainerHelpers, mcFunctionHelpers, mcNumberHelpers, and mcSymbolHelpers.

Referenced by math_MultOrDiv().

mcBasicOpRes mcExpElementHelpers::math_DivideBy const mcElement ,
mcElement
[virtual]
 

Divides two mcElements of the same type and stores the result in this object.

Parameters:
p A pointer to a mcElement of the same type of this mcElement, which will be used to divide this mcElement.

Implements mcElementHelpers.

Definition at line 1856 of file ExpElement.cpp.

References mcElementHelpers::math_CanBeDivBy(), math_MultOrDiv(), and mcASSERT.

mcRealValue mcExpElementHelpers::math_Evaluate  )  const [virtual]
 

Evaluates the numeric value of this element and then returns it.

The evaluation can proceed *only* if this element does _not_ contain any parameter or unknown; in case it contains one of these, then the returned value is *mcRealValue::pNAN.

Implements mcElementHelpers.

Reimplemented in mcRadicalHelpers.

Definition at line 1621 of file ExpElement.cpp.

References mcValue::isNAN(), math_EvaluateBase(), math_EvaluateExp(), and mcRealValue::pow().

Referenced by mcNumberHelpers::math_GetGCD(), mcNumberHelpers::math_MultiplyBaseBy(), and mcFunctionHelpers::math_SimplifyBase().

virtual mcRealValue mcExpElementHelpers::math_EvaluateBase  )  const [pure virtual]
 

Implemented in mcExpContainerHelpers, mcFunctionHelpers, mcNumberHelpers, and mcSymbolHelpers.

Referenced by math_Evaluate().

mcRealValue mcExpElementHelpers::math_EvaluateExp  )  const
 

Definition at line 1609 of file ExpElement.cpp.

References data_GetExp(), mcElement::math_Evaluate(), and math_hasExp().

Referenced by math_Evaluate().

mcExpSimRes mcExpElementHelpers::math_Expand long  flags,
mcElement newelem
[virtual]
 

Expands this element one "step".

expanding means that the aim of this function is exactly the opposite of math_Simplify: instead making the function body shorter, it tries to make it as long as possible:

(x - 2)^3 . first call to math_Expand x^3 - 6x^2 + 12x -8

Implements mcElementHelpers.

Definition at line 1669 of file ExpElement.cpp.

References math_ExpandBase().

virtual mcExpSimRes mcExpElementHelpers::math_ExpandBase long  flags,
mcElement newelem
[pure virtual]
 

Implemented in mcExpContainerHelpers, mcFunctionHelpers, mcNumberHelpers, and mcSymbolHelpers.

Referenced by math_Expand().

mcMonomial mcExpElementHelpers::math_GetBaseGCD const mcElement p  )  const [virtual]
 

Definition at line 1969 of file ExpElement.cpp.

References mcElementArray::data_AddElements(), math_hasExp(), and mcASSERT.

Referenced by math_GetGCD().

mcMonomial mcExpElementHelpers::math_GetBaseLCM const mcElement p  )  const [virtual]
 

Reimplemented in mcNumberHelpers.

Definition at line 1883 of file ExpElement.cpp.

References mcElementArray::data_AddElements(), and mcElement::math_SimpleMultiplyBy().

Referenced by mcNumberHelpers::math_GetBaseLCM(), and math_GetLCM().

virtual mcRealValue mcExpElementHelpers::math_GetBaseLenght  )  const [inline, virtual]
 

Reimplemented in mcBracketHelpers, mcExpContainerHelpers, mcNumberHelpers, and mcSymbolHelpers.

Definition at line 806 of file ExpElement.h.

Referenced by math_GetLenght().

virtual mcMathType mcExpElementHelpers::math_GetBaseMathType  )  const [pure virtual]
 

Implemented in mcExpContainerHelpers, mcFunctionHelpers, mcNumberHelpers, mcRadicalHelpers, and mcSymbolHelpers.

Referenced by math_GetMathType().

const mcPolynomial & mcExpElementHelpers::math_GetConstExp  )  const
 

Returns a CONST pointer to the exponent of this element.

This function has a different name from #GetExp() since not only the returned type is different, also the way it works is very different: if this element has an exponent, then this function returns a pointer to it like #GetExp; but if this element does not have an exponent, then it does not create anything but returns mcPolynomial::math_pOne.

Definition at line 1552 of file ExpElement.cpp.

References data_GetExp(), mcElement::data_GetType(), mcASSERT, mcEmptyElement, and mcET_POLYNOMIAL.

Referenced by math_GetExp(), math_MultOrDiv(), and math_SimplifyExp().

const mcText & mcExpElementHelpers::math_GetConstSub  )  const
 

See math_GetExp().

Definition at line 1578 of file ExpElement.cpp.

References data_GetSub(), mcElement::data_GetType(), mcASSERT, mcEmptyElement, and mcET_TEXT.

const mcPolynomial& mcExpElementHelpers::math_GetExp  )  const [inline]
 

Definition at line 745 of file ExpElement.h.

References math_GetConstExp().

mcPolynomial & mcExpElementHelpers::math_GetExp  ) 
 

Definition at line 1569 of file ExpElement.cpp.

References data_CreateExpSub(), data_GetExp(), data_SetExpSub(), and mcEmptyElement.

Referenced by mcRadicalHelpers::io_ImportBaseInlinedExpr(), math_CompareExp(), math_GetGCD(), math_GetLCM(), math_GetMathType(), mcExpContainerHelpers::math_GetRaisedContents(), math_MakeReciprocal(), math_MultOrDiv(), math_RaiseTo(), mcBracketHelpers::math_RemoveExp(), and mcExpContainerHelpers::math_SimplifyBaseExp().

mcMonomial mcExpElementHelpers::math_GetGCD const mcElement  )  const [virtual]
 

Implements mcElementHelpers.

Reimplemented in mcNumberHelpers.

Definition at line 1932 of file ExpElement.cpp.

References mcElementArray::data_AddElements(), mcExpElement::data_CreateExpSub(), mcElementHelpers::data_GetType(), mcElementHelpers::math_CompareThisOnly(), math_GetBaseGCD(), mcExpElement::math_GetExp(), math_GetExp(), mcExpElement::math_hasExp(), and math_hasExp().

Referenced by mcNumberHelpers::math_GetGCD().

mcMonomial mcExpElementHelpers::math_GetLCM const mcElement  )  const [virtual]
 

Returns the LCM between *this and the given element.

Implements mcElementHelpers.

Definition at line 1895 of file ExpElement.cpp.

References mcElementArray::data_AddElements(), mcExpElement::data_GetExp(), mcExpElement::data_SetExpSub(), mcElementHelpers::math_CompareThisOnly(), math_GetBaseLCM(), math_GetExp(), mcElement::math_GetLCM(), mcExpElement::math_hasExp(), mcMATHLOG, mcTXT, and mcTXTTHIS.

mcRealValue mcExpElementHelpers::math_GetLenght  )  const [inline, virtual]
 

The raise-to-power operation has a little degree of complexity.

In this way we can force our simplify routines to transform an expression like: 9^2 into 81 lenght=2.5 lenght=2

The exponent/subscript of this element will be taken in count by the math_GetTotalLenght() function.

Implements mcElementHelpers.

Reimplemented in mcFunctionHelpers.

Definition at line 782 of file ExpElement.h.

References math_GetBaseLenght(), and math_hasExp().

mcMathType mcExpElementHelpers::math_GetMathType  )  const [virtual]
 

A powerful recognizer function which automatically classifies the type of the math data contained in this class and returns the respective identifier.

Implements mcElementHelpers.

Definition at line 1870 of file ExpElement.cpp.

References math_GetBaseMathType(), math_GetExp(), mcElement::math_GetMathType(), math_hasExp(), and mcMathType::math_RaiseTo().

mcText& mcExpElementHelpers::math_GetSub  )  const [inline]
 

See math_GetExp().

Definition at line 750 of file ExpElement.h.

References data_GetSub().

bool mcExpElementHelpers::math_hasExp  )  const
 

Returns TRUE if this element has a working exponent.

Definition at line 1538 of file ExpElement.cpp.

References data_GetExp(), mcElementHelpers::data_hasProperty(), mcEmptyElement, and mcEP_HASEXPONENT.

Referenced by math_EvaluateExp(), math_GetBaseGCD(), math_GetGCD(), math_GetLenght(), math_GetMathType(), mcExpContainerHelpers::math_GetRaisedContents(), mcBracketHelpers::math_RemoveExp(), and math_Simplify().

bool mcExpElementHelpers::math_hasSub  )  const
 

Definition at line 1545 of file ExpElement.cpp.

References data_GetSub(), mcElementHelpers::data_hasProperty(), mcEmptyElement, and mcEP_HASSUBSCRIPT.

mcBasicOpRes mcExpElementHelpers::math_MakeReciprocal mcElement  )  [virtual]
 

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.

Note:
The math_RaiseTo function could be used instead of this one but this function should be preferred over math_RaiseTo(mcPolynomial(-1)); because this function ?????????? FIXME

Reimplemented from mcElementHelpers.

Reimplemented in mcBracketHelpers, and mcNumberHelpers.

Definition at line 1777 of file ExpElement.cpp.

References mcPolynomial::math_ChangeAllSigns(), math_GetExp(), and mcBOR_REMOVE_OPERAND.

virtual mcBasicOpRes mcExpElementHelpers::math_MultiplyBaseBy const mcElement ,
mcElement
[inline, virtual]
 

Reimplemented in mcNumberHelpers.

Definition at line 817 of file ExpElement.h.

References mcBOR_REMOVE_OPERAND.

Referenced by math_MultOrDiv().

virtual mcBasicOpRes mcExpElementHelpers::math_MultiplyBaseOnlyBy const mcElement ,
mcElement
[pure virtual]
 

Implemented in mcExpContainerHelpers, mcFunctionHelpers, mcNumberHelpers, and mcSymbolHelpers.

Referenced by math_MultOrDiv().

mcBasicOpRes mcExpElementHelpers::math_MultiplyBy const mcElement ,
mcElement
[virtual]
 

Multiplies two mcElements of the same type and stores the result in this object.

Parameters:
p A pointer to a mcElement of the same type of this mcElement, which will be multiplied with this mcElement.

Implements mcElementHelpers.

Definition at line 1863 of file ExpElement.cpp.

References mcElementHelpers::math_CanBeMultWith(), math_MultOrDiv(), and mcASSERT.

mcBasicOpRes mcExpElementHelpers::math_MultOrDiv const mcElement ,
mcElement ,
bool  mult
 

Definition at line 1786 of file ExpElement.cpp.

References data_GetExp(), mcElement::math_CanBeAddedWith(), mcElement::math_Compare(), mcElementHelpers::math_CompareThisOnly(), math_DivideBaseBy(), math_DivideBaseOnlyBy(), mcExpElement::math_GetConstExp(), math_GetConstExp(), math_GetExp(), mcExpElement::math_hasExp(), math_MultiplyBaseBy(), math_MultiplyBaseOnlyBy(), mcElementArray::math_ResetToZero(), mcElement::math_SimpleAdd(), mcElement::math_SimpleMultiplyBy(), mcElement::math_SimpleSubtract(), mcASSERT, mcBOR_REMOVE_OPERAND, mcMATHLOG, mcTXT, and mcTXTTHIS.

Referenced by math_DivideBy(), and math_MultiplyBy().

mcBasicOpRes mcExpElementHelpers::math_RaiseTo const mcPolynomial p  )  [virtual]
 

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.

Note:
All MathCore elements must implement this function, not only mcExpElement-derived classes because this operation *must* be feasible on every element: those elements which do not hold an exponent, must raise their children directly. mcFraction, for example, must implement this operation directly raising the numerator & denominator.

Implements mcElementHelpers.

Definition at line 1724 of file ExpElement.cpp.

References math_GetExp(), mcElement::math_SimpleMultiplyBy(), mcBOR_REMOVE_OPERAND, mcMATHLOG, mcTXT, and mcTXTTHIS.

void mcExpElementHelpers::math_SetExp const mcPolynomial pol  )  [inline, virtual]
 

Sets the exponent of this element to match the given polynomial.

As for math_RaiseTo, for elements which do not have an exponent by their own, this function should just call the children's math_SetExp functions.

Reimplemented from mcElementHelpers.

Definition at line 755 of file ExpElement.h.

References data_SetExpSub().

mcExpSimRes mcExpElementHelpers::math_Simplify long  flags,
mcElement newelem
[virtual]
 

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

Returns:
Returns TRUE if the element is completely simplied and thus, the following calls to math_Simplify won't have effect.

Implements mcElementHelpers.

Definition at line 1634 of file ExpElement.cpp.

References data_DestroyExpSub(), data_GetExp(), math_hasExp(), mcElement::math_Simplify(), math_SimplifyBase(), math_SimplifyExp(), mcASSERT, mcESR_DELETE_THIS, mcESR_DISTRIBUTE, mcESR_DONE, mcESR_INVALID_DATA, mcESR_NOTFINISHED, mcESR_REPLACE_THIS, mcEXPSIM_NOFLAGS, mcMATHLOG, and mcTXTTHIS.

virtual mcExpSimRes mcExpElementHelpers::math_SimplifyBase long  flags,
mcElement newelem
[pure virtual]
 

Implemented in mcExpContainerHelpers, mcFunctionHelpers, mcNumberHelpers, and mcSymbolHelpers.

Referenced by math_Simplify().

virtual mcExpSimRes mcExpElementHelpers::math_SimplifyBaseExp long  flags,
mcElement pnew
[inline, virtual]
 

Reimplemented in mcExpContainerHelpers, mcNumberHelpers, and mcSymbolHelpers.

Definition at line 812 of file ExpElement.h.

References mcESR_DONE.

Referenced by math_SimplifyExp().

mcExpSimRes mcExpElementHelpers::math_SimplifyExp long  flags,
mcElement
[protected]
 

Called by math_Simplify() when the exponent is ready to be simplified.

If it can be evaluated, then this functions tries to apply some default simplification (e.g. if the exponent is in the 0;1 range, converts this into a mcRadical...). If the exponent cannot be evaluate, calls math_SimplifyBaseExp.

Definition at line 1676 of file ExpElement.cpp.

References data_DestroyExpSub(), mcExpElement::data_DestroyExpSub(), mcElementArray::data_Get(), mcExpContainer::data_GetContent(), mcElementArray::data_GetCount(), data_GetExp(), mcElement::data_GetType(), mcElement::math_Evaluate(), math_GetConstExp(), math_SimplifyBaseExp(), mcElementArray::math_WrapSimple(), mcESR_DONE, mcESR_REPLACE_THIS, mcET_MONOMIAL, mcET_NUMBER, and smath_bConvertToRadicalWhenPossible.

Referenced by math_Simplify().


Member Data Documentation

bool mcExpElementHelpers::mdata_bExpEnabled [protected]
 

If TRUE, the user can edit the exponent associated; if FALSE, the mcMathCore::Get()->m_pgui_EditExpKey will be rejected.

Definition at line 182 of file ExpElement.h.

Referenced by data_CreateExpSub(), data_DeepCopy(), gui_HandleSubExpEditKeys(), and mcExpElementHelpers().

bool mcExpElementHelpers::mdata_bSubEnabled [protected]
 

If TRUE, the user can edit the subscript associated; if FALSE, the mcMathCore::Get()->m_pgui_EditSubscriptKey will be rejected.

Definition at line 186 of file ExpElement.h.

Referenced by data_CreateExpSub(), data_DeepCopy(), gui_HandleSubExpEditKeys(), and mcExpElementHelpers().

mcElement mcExpElementHelpers::mdata_pExp [protected]
 

The exponent handled by this class.

It is allocated only when required (performance optimization). This class is able to handle with the GUI functions any type of mcElement-derived class but MATH functions expect this to be a mcPolynomial.

Definition at line 171 of file ExpElement.h.

Referenced by data_CreateExpSub(), data_DestroyExpSub(), data_Get(), data_GetExp(), and mcExpElementHelpers().

mcElement mcExpElementHelpers::mdata_pSub [protected]
 

The subscript handled by this class.

It is allocated only when required (performance optimization). This is usually a mcText even if GUI and IO functions should work with each type of mcElement-derived class. MATH functions will simply ignore it.

Definition at line 178 of file ExpElement.h.

Referenced by data_CreateExpSub(), data_DestroyExpSub(), data_Get(), data_GetSub(), and mcExpElementHelpers().

bool mcExpElementHelpers::mgui_bExpRight [protected]
 

Defines the position of the 'exponent': this class, in fact, can be used not only to implement exponents, but also to implement the indexes of the radicals; just set to FALSE mgui_bExpRight (default is TRUE) to make the exponent placed on the left of the element.

Definition at line 198 of file ExpElement.h.

Referenced by data_DeepCopy(), gui_Init(), and gui_isOnRight().

bool mcExpElementHelpers::mgui_bSubRight [protected]
 

Defines the position of the 'subscript'.

See mgui_bExpRight for more info.

Definition at line 202 of file ExpElement.h.

Referenced by data_DeepCopy(), gui_Init(), and gui_isOnRight().

mcExpElemCursorLocation mcExpElementHelpers::mgui_nCursorLoc [protected]
 

The cursor position.

mcExpElement derived classes must track cursor position using this variable; derived classes should define other own values for the other possible cursor positions.

Definition at line 213 of file ExpElement.h.

Referenced by data_DeepCopy(), gui_EditExpSub(), gui_ExpSubInput(), gui_ExpSubMoveCursor(), gui_GetCursorPos(), gui_GetExpSubCursorPos(), gui_GetExpSubRelCursorPos(), gui_Init(), gui_isCursorInBase(), gui_isCursorInExpSub(), gui_isExpSubEndKey(), gui_MoveCursorUsingPoint(), and gui_SetExpSubCursorPos().

wxSize mcExpElementHelpers::mgui_szBase [protected]
 

The size of the base only.

Note:
None of the base functions should modify the m_sz variable; they can modify only this variable.

Definition at line 207 of file ExpElement.h.

Referenced by data_DeepCopy(), gui_GetBaseSize(), and gui_OnSelect().

bool mcExpElementHelpers::smath_bConvertToRadicalWhenPossible = FALSE [static]
 

If TRUE, then the math_SimplifyExp function will convert this element to a mcRadical when the exponent is in the (0,1) range.

Definition at line 59 of file ExpElement.cpp.

Referenced by math_SimplifyExp().


The documentation for this class was generated from the following files:

Documentation generated with Doxygen on Sun Feb 6 17:12:36 2005
Visit MathStudio home page for more info

[ Top ]