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

mcFunctionHelpers Class Reference

#include <Function.h>

Inheritance diagram for mcFunctionHelpers:

Inheritance graph
[legend]
Collaboration diagram for mcFunctionHelpers:

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 79 of file Function.h.

Public Member Functions

virtual int gui_GetSpaceAboveBelow () const
virtual int gui_GetSpaceLeftRight () const
 mcFunctionHelpers ()
virtual ~mcFunctionHelpers ()
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.
bool data_isSameAs (const mcElementHelpers *p) const
 Performs a deep comparison of the data hold by this class and the data hold by the given mcElementHelpers object.
void data_CreateSub ()
 mcFunctionData doesn't use the default subscript: mcText.
wxString data_GetName () const
 Returns the name of this function.
void data_CheckName ()
 Checks if the function name matches with the name of this type of fnc.
void data_SetName (const wxString &str)
 Sets the name of this function.
mcTextdata_GetNameObj ()
 Returns a pointer to the mcText containing the name of this function.
const mcTextdata_GetNameObj () const
mcTextHelpersdata_GetNameObjHlp ()
const mcTextHelpersdata_GetNameObjHlp () const
mcBracketdata_GetArgObj ()
 Returns a pointer to the mcBracket containing the argument of this function.
const mcBracketdata_GetArgObj () const
mcBracketHelpersdata_GetArgObjHlp ()
const mcBracketHelpersdata_GetArgObjHlp () const
void data_SetNameObj (const mcText &p)
void data_SetArgObj (const mcBracket &p)
bool data_isRegistered () const
 Returns TRUE if this function is registered in the mcFunction array.
void data_SetFncType (int n)
int data_GetFncType () const
wxScriptFunction * data_GetScript () const
 Returns the script associated with this function, if any.
bool math_CanBeAddedWith (const mcElement &p) const
 Returns TRUE if this element can be added with the given element.
bool math_CanBeMultWith (const mcElement &p) const
 Works like #math_CanBemath_AddeWith(), just for multiplication.
bool math_CanBeDivBy (const mcElement &p) const
 Works like #math_CanBemath_AddeWith(), just for divisions.
virtual mcBasicOpRes math_Add (const mcElement &, mcElement *p, bool add)
 Sums or subtracts this element with the given e element.
virtual mcBasicOpRes math_Subtract (const mcElement &, mcElement *p)
 math_s two mcElements of the same type and stores the result in this object.
virtual mcBasicOpRes math_MultiplyBaseOnlyBy (const mcElement &, mcElement *p)
virtual mcBasicOpRes math_DivideBaseOnlyBy (const mcElement &, mcElement *p)
mcMathType math_GetBaseMathType () const
bool math_CompareThisOnly (const mcElement &p) const
mcRealValue math_EvaluateBase () const
mcRealValue math_GetLenght () const
 The raise-to-power operation has a little degree of complexity.
int math_GetOrderPos () const
 Returns the order position for this element.
mcExpSimRes math_SimplifyBase (long flags, mcElement *newelem)
mcExpSimRes math_ExpandBase (long flags, mcElement *newelem)
bool io_isBeginTag (const wxXml2Node &tag) const
 Returns a positive value if the given MathML content tag marks the begin of this element; FALSE otherwise.
bool io_isBeginChar (const wxString &str) const
 Returns a positive value if the given inlined expression marks the begin of this element; FALSE otherwise.
wxXml2Node io_GetBaseMathML (bool bGetPresentation) const
 Returns a MathML tree with the presentation math markup language regarding the base.
wxXml2Node io_GetMathML (bool bGetPresentation) const
 Returns the MathML tree which describes this element and, eventually, its exponent and its subscript.
wxString io_GetBaseInlinedExpr () const
bool io_ImportPresentationMathML (wxXml2Node tag, wxString &pErr)
 Imports presentation MathML reading the contents of the given XML node (without modifying it).
bool io_ImportInlinedExpr (const wxString &str, int *count, wxString &pErr)
 Imports an inlined expression.
bool io_ImportBaseInlinedExpr (const wxString &, int *, wxString &)
 This function is not used by mcFunction::io_ImportInlinedExpr.
virtual void io_GetExpSubInlinedToken (wxString &subexp)
 Overloading mcExpElementHelpers function is required since.
Utility functions
Utility functions used to get the size, offsets, etc of the contained objects.

int gui_GetArgOffsetx () const
int gui_GetArgOffsety () const
int gui_GetNameOffsetx () const
int gui_GetNameOffsety () const
void gui_Setup (int functiontype)
wxSize gui_GetSizeOfArg () const
wxSize gui_GetSizeOfName () const
mcExpElement overloaded BASE functions
These functions handle the base of the function; the exp/sub is handled by mcExpElement functions.

bool gui_isBeginKey (const mcKey &key) const
 Returns a positive value if the given character marks the begin of this element; FALSE otherwise.
bool gui_isBaseEndKey (const mcKey &ev) const
 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.
bool gui_DrawAsActiveOverBase () const
 Returns TRUE if the mcExpElement functions must draw as active the entire element when the cursor is over the base of the element.
int gui_DrawBase (wxDC &dc, int x, int y, long flags, const wxPoint &pt) const
 Identical to mcElement::gui_Draw, but just for the base.
int gui_BaseMoveCursorUsingPoint (wxDC &dc, const wxPoint &)
 Moves the cursor inside the base using the given point and, eventually the given DC for calculations.
int gui_GetBaseRelCursorPos (wxDC &dc, wxPoint *pt) const
 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.
mcMoveCursorRes gui_BaseMoveCursor (mcMoveCursorFlag, long modifiers)
 Handles cursor movements when the cursor is editing the base.
mcMoveCursorRes gui_MoveCursor (mcMoveCursorFlag, 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).
mcInputRes gui_BaseInput (const mcKey &key, mcElement *pnew)
 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...
mcInsertRes gui_BaseInsert (const mcElement &, mcElement *)
void gui_GetBaseCursorPos (mcCursorPos &) const
 Returns one of the cursor position flags (called only when cursor is inside the base).
int gui_GetExpOffsetx () const
int gui_GetExpOffsety () const
int gui_GetSubOffsetx () const
int gui_GetSubOffsety () const
void gui_SetCursorPos (const mcCursorPos &code)
 Sets the cursor position inside the element using Cursor Position flags.
void gui_SetBaseCursorPos (const mcCursorPos &)
 Sets the cursor position of the element.
void gui_DoRecalcBaseSize ()
 Calculates (in the m_szBase variable) the size of the base only.
void gui_EditBase ()
 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.
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.
bool gui_hasBaseSthOnRightSide () const
 mcFunction doesn't have the exponent placed on the right: it is in the middle, so we need to return always FALSE from this function...
mcMoveCursorRes gui_ExpMoveCursor (mcMoveCursorFlag, long)
 This function is overloaded by mcExpElementGUI to remove the EXPELEM_EXPEND cursor position which is otherwise automatically enabled for elements with the exponent placed on the right.
mcMoveCursorRes gui_SubMoveCursor (mcMoveCursorFlag, long)
void gui_CheckSub ()
 We do not use the standard mcText object as subscript, so we need to overload this function.

Static Public Member Functions

static wxArrayString io_ImportArgument (const wxString &str, int *count, wxString &pErr)
static bool io_isFunctionBeginChar (const wxString &str)

Static Public Attributes

static int sgui_nSpaceAboveBelow = 0
static int sgui_nSpaceLeftRight = 0
static mcKeysgui_pNewFunction = NULL
 The key to use to create this element.

Protected Member Functions

void gui_Init ()
 Inits this section of the element.

Protected Attributes

mcBracket mdata_eArg
 The argument of this function.
mcText mdata_eName
 The name of this function.
int mdata_nFncType
 The type of this function.
int mgui_nCursorPos

Private Member Functions

 mcDEFINE_REFERENCE_DATA (mcFunction, mcET_FUNCTION)


Constructor & Destructor Documentation

mcFunctionHelpers::mcFunctionHelpers  )  [inline]
 

Definition at line 132 of file Function.h.

References mcElementHelpers::data_Init(), mcText::data_SetFilter(), data_SetFncType(), mcFUNCTION_TYPE_NOTSET, and mdata_eName.

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

Definition at line 142 of file Function.h.


Member Function Documentation

void mcFunctionHelpers::data_CheckName  ) 
 

Checks if the function name matches with the name of this type of fnc.

Definition at line 215 of file Function.cpp.

References data_GetName(), mcASSERT, and mdata_nFncType.

void mcFunctionHelpers::data_CreateSub  ) 
 

mcFunctionData doesn't use the default subscript: mcText.

In fact, the subscript of the function, if allowed, is usually the base of the function (think to log and ln): another mcPolynomial is required...

Definition at line 179 of file Function.cpp.

References mcExpElementHelpers::data_DestroyExpSub(), and mcElement::gui_SetAsExpOf().

void mcFunctionHelpers::data_DeepCopy const mcElementHelpers p  )  [inline, 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 mcExpElementHelpers.

Definition at line 185 of file Function.h.

References mcExpElementHelpers::data_DeepCopy(), mcElement::data_DeepCopy(), mdata_eArg, mdata_eName, and mdata_nFncType.

const mcBracket& mcFunctionHelpers::data_GetArgObj  )  const [inline]
 

Definition at line 230 of file Function.h.

References mdata_eArg.

mcBracket& mcFunctionHelpers::data_GetArgObj  )  [inline]
 

Returns a pointer to the mcBracket containing the argument of this function.

Definition at line 229 of file Function.h.

References mdata_eArg.

Referenced by data_GetConstChild(), gui_BaseInput(), gui_BaseMoveCursor(), gui_DoRecalcBaseSize(), gui_DrawBase(), gui_GetBaseCursorPos(), gui_GetBaseRelCursorPos(), gui_GetSizeOfArg(), gui_SetCursorPos(), gui_Setup(), io_GetBaseInlinedExpr(), io_GetMathML(), io_ImportInlinedExpr(), math_EvaluateBase(), math_ExpandBase(), math_GetBaseMathType(), and math_SimplifyBase().

const mcBracketHelpers* mcFunctionHelpers::data_GetArgObjHlp  )  const [inline]
 

Definition at line 232 of file Function.h.

References mdata_eArg.

mcBracketHelpers* mcFunctionHelpers::data_GetArgObjHlp  )  [inline]
 

Definition at line 231 of file Function.h.

References mdata_eArg.

int mcFunctionHelpers::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 mcExpElementHelpers.

Definition at line 162 of file Function.h.

References mcExpElementHelpers::data_GetChildrenCount().

const mcElement& mcFunctionHelpers::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 mcExpElementHelpers.

Definition at line 168 of file Function.h.

References data_GetArgObj(), data_GetNameObj(), mcEmptyElement, and mcRETURN_ELEMENT_CHILD.

int mcFunctionHelpers::data_GetFncType  )  const [inline]
 

Definition at line 249 of file Function.h.

References mdata_nFncType.

Referenced by data_GetScript(), and io_ImportInlinedExpr().

wxString mcFunctionHelpers::data_GetName  )  const
 

Returns the name of this function.

Definition at line 208 of file Function.cpp.

References data_GetNameObj(), and mcText::data_GetText().

Referenced by data_CheckName(), gui_BaseInput(), and io_ImportInlinedExpr().

const mcText& mcFunctionHelpers::data_GetNameObj  )  const [inline]
 

Definition at line 223 of file Function.h.

References mdata_eName.

mcText& mcFunctionHelpers::data_GetNameObj  )  [inline]
 

Returns a pointer to the mcText containing the name of this function.

Definition at line 222 of file Function.h.

References mdata_eName.

Referenced by data_GetConstChild(), data_GetName(), gui_BaseInput(), gui_BaseMoveCursor(), gui_DoRecalcBaseSize(), gui_DrawBase(), gui_EditBaseAndSetPos(), gui_GetBaseCursorPos(), gui_GetBaseRelCursorPos(), gui_GetSizeOfName(), gui_SetCursorPos(), io_GetBaseInlinedExpr(), and io_GetBaseMathML().

const mcTextHelpers* mcFunctionHelpers::data_GetNameObjHlp  )  const [inline]
 

Definition at line 225 of file Function.h.

References mdata_eName.

mcTextHelpers* mcFunctionHelpers::data_GetNameObjHlp  )  [inline]
 

Definition at line 224 of file Function.h.

References mdata_eName.

wxScriptFunction * mcFunctionHelpers::data_GetScript  )  const
 

Returns the script associated with this function, if any.

Definition at line 225 of file Function.cpp.

References data_GetFncType().

Referenced by math_EvaluateBase().

bool mcFunctionHelpers::data_isRegistered  )  const [inline]
 

Returns TRUE if this function is registered in the mcFunction array.

Definition at line 239 of file Function.h.

References mcFUNCTION_TYPE_NOTSET, and mdata_nFncType.

Referenced by gui_DrawBase().

bool mcFunctionHelpers::data_isSameAs const mcElementHelpers p  )  const [inline, virtual]
 

Performs a deep comparison of the data hold by this class and the data hold by the given mcElementHelpers object.

Reimplemented from mcElementHelpers.

Definition at line 194 of file Function.h.

References mdata_eArg, and mdata_eName.

void mcFunctionHelpers::data_SetArgObj const mcBracket p  )  [inline]
 

Definition at line 235 of file Function.h.

References mcElement::data_DeepCopy(), and mdata_eArg.

Referenced by data_SetChild().

void mcFunctionHelpers::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 mcExpElementHelpers.

Definition at line 175 of file Function.h.

References data_SetArgObj(), data_SetNameObj(), mcASSERT, mcET_BRACKET, mcET_TEXT, and mcSET_ELEMENT_CHILD.

void mcFunctionHelpers::data_SetFncType int  n  ) 
 

Todo:
Define relations between mcFunction & script much better: we need to know a lot of things more from a scriptfunction: its math properties, its domain ....

Definition at line 188 of file Function.cpp.

References data_SetName(), mcFUNCTION_TYPE_NOTSET, and mdata_nFncType.

Referenced by gui_BaseInput(), gui_Setup(), io_ImportInlinedExpr(), and mcFunctionHelpers().

void mcFunctionHelpers::data_SetName const wxString &  str  )  [inline]
 

Sets the name of this function.

Definition at line 217 of file Function.h.

References mcText::data_SetText(), and mdata_eName.

Referenced by data_SetFncType().

void mcFunctionHelpers::data_SetNameObj const mcText p  )  [inline]
 

Definition at line 234 of file Function.h.

References mcElement::data_DeepCopy(), and mdata_eName.

Referenced by data_SetChild().

mcInputRes mcFunctionHelpers::gui_BaseInput const mcKey key,
mcElement pnew
[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...

Implements mcExpElementHelpers.

Definition at line 257 of file Function.cpp.

References data_GetArgObj(), mcFunction::data_GetFunctionType(), data_GetName(), data_GetNameObj(), mcElementHelpers::data_hasProperty(), data_SetFncType(), mcMathCore::Get(), mcExpElementHelpers::gui_HandleSubExpEditKeys(), mcElement::gui_Input(), gui_isBeginKey(), mcElementHelpers::gui_RecalcSize(), mcElementHelpers::Init(), mcASSERT, mcEP_INITIALIZED, mcFUNCTION_INSIDEARG, mcFUNCTION_INSIDENAME, mcFUNCTION_TYPE_NOTFOUND, mcIR_DELETE_NEXT, mcIR_DELETE_PREVIOUS, mcIR_DELETE_THIS, mcIR_DIRECT_DELETE, mcIR_DISTRIBUTE, mcIR_OKAY, mcIR_REPLACE_THIS, mdata_nFncType, mgui_nCursorPos, and mcMathCore::SyntaxError().

mcInsertRes mcFunctionHelpers::gui_BaseInsert const mcElement ,
mcElement
[virtual]
 

Implements mcExpElementHelpers.

Definition at line 379 of file Function.cpp.

References mcINSR_OKAY.

mcMoveCursorRes mcFunctionHelpers::gui_BaseMoveCursor mcMoveCursorFlag  ,
long  modifiers
[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 !!!

Implements mcExpElementHelpers.

Definition at line 384 of file Function.cpp.

References data_GetArgObj(), data_GetNameObj(), mcElementHelpers::data_hasProperty(), mcExpElementHelpers::gui_EditExpSub(), mcElementHelpers::gui_GetCursorPos(), mcElement::gui_MoveCursor(), mcElement::gui_SetCursorPos(), mcASSERT, mcCP_BEGIN, mcCP_END, mcEP_HASEXPONENT, mcEP_HASSUBSCRIPT, mcFUNCTION_INSIDEARG, mcFUNCTION_INSIDENAME, mcMCF_RIGHT, mcMCR_OKAY, mcMCR_SETFOCUS_ABOVE, mcMCR_SETFOCUS_BELOW, mcMCR_SETFOCUS_NEXT, mcMCR_SETFOCUS_PREVIOUS, and mgui_nCursorPos.

Referenced by gui_MoveCursor().

int mcFunctionHelpers::gui_BaseMoveCursorUsingPoint wxDC &  dc,
const wxPoint & 
[virtual]
 

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

Implements mcExpElementHelpers.

Definition at line 519 of file Function.cpp.

References mcMCR_CANNOT_SETFOCUS.

void mcFunctionHelpers::gui_CheckSub  ) 
 

We do not use the standard mcText object as subscript, so we need to overload this function.

See mcFunction::data_CreateSub for more info.

Definition at line 731 of file Function.cpp.

References mcExpElementHelpers::data_GetSub(), mcElementArray::data_isArrayEmpty(), and mcPolynomial::gui_AddNewEmptyMonomial().

void mcFunctionHelpers::gui_DoRecalcBaseSize  )  [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*.

Implements mcExpElementHelpers.

Definition at line 242 of file Function.cpp.

References data_GetArgObj(), data_GetNameObj(), gui_GetArgOffsetx(), gui_GetArgOffsety(), gui_GetNameOffsetx(), gui_GetNameOffsety(), gui_GetSizeOfArg(), gui_GetSizeOfName(), mcElement::gui_RecalcSize(), and mcMAX.

bool mcFunctionHelpers::gui_DrawAsActiveOverBase  )  const [inline, 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.

Implements mcExpElementHelpers.

Definition at line 310 of file Function.h.

int mcFunctionHelpers::gui_DrawBase wxDC &  dc,
int  x,
int  y,
long  flags,
const wxPoint &  pt
const [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.

Implements mcExpElementHelpers.

Definition at line 334 of file Function.cpp.

References data_GetArgObj(), mcElementHelpers::data_GetID(), data_GetNameObj(), data_isRegistered(), mcElement::gui_Draw(), mcText::gui_Draw(), gui_GetArgOffsetx(), gui_GetArgOffsety(), gui_GetNameOffsetx(), gui_GetNameOffsety(), gui_GetSizeOfArg(), gui_GetSizeOfName(), mcDRW_NONACTIVE, and mcDRW_USEPOINT.

void mcFunctionHelpers::gui_EditBase  )  [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.

Implements mcExpElementHelpers.

Definition at line 588 of file Function.cpp.

References mcECL_INSIDEBASE, mcFUNCTION_INSIDENAME, and mgui_nCursorPos.

Referenced by gui_EditBaseAndSetPos().

void mcFunctionHelpers::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 from mcExpElementHelpers.

Definition at line 595 of file Function.cpp.

References data_GetNameObj(), gui_EditBase(), and mcElement::gui_SetCursorPos().

mcMoveCursorRes mcFunctionHelpers::gui_ExpMoveCursor mcMoveCursorFlag  ,
long 
 

This function is overloaded by mcExpElementGUI to remove the EXPELEM_EXPEND cursor position which is otherwise automatically enabled for elements with the exponent placed on the right.

Definition at line 710 of file Function.cpp.

References mcExpElementHelpers::data_GetExp(), mcElement::gui_MoveCursor(), HANDLE_EXPSUB, mcASSERT, mcECL_INSIDEEXPONENT, mcMCR_OKAY, and mgui_nCursorPos.

int mcFunctionHelpers::gui_GetArgOffsetx  )  const
 

Definition at line 649 of file Function.cpp.

References mcExpElementHelpers::gui_GetExpSubOffsetx(), mcExpElementHelpers::gui_GetExpSubSize(), and mcMAX.

Referenced by gui_DoRecalcBaseSize(), gui_DrawBase(), and gui_GetBaseRelCursorPos().

int mcFunctionHelpers::gui_GetArgOffsety  )  const
 

Definition at line 653 of file Function.cpp.

Referenced by gui_DoRecalcBaseSize(), gui_DrawBase(), and gui_GetBaseRelCursorPos().

void mcFunctionHelpers::gui_GetBaseCursorPos mcCursorPos  )  const [virtual]
 

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

Implements mcExpElementHelpers.

Definition at line 570 of file Function.cpp.

References data_GetArgObj(), data_GetNameObj(), mcElementHelpers::gui_GetCursorPos(), mcCursorPos::gui_Push(), mcCP_BEGIN, mcCP_END, mcFUNCTION_INSIDEARG, mcFUNCTION_INSIDENAME, and mgui_nCursorPos.

int mcFunctionHelpers::gui_GetBaseRelCursorPos wxDC &  dc,
wxPoint *  pt
const [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.

Implements mcExpElementHelpers.

Definition at line 546 of file Function.cpp.

References data_GetArgObj(), data_GetNameObj(), gui_GetArgOffsetx(), gui_GetArgOffsety(), gui_GetNameOffsetx(), gui_GetNameOffsety(), mcElement::gui_GetRelCursorPos(), mcASSERT, mcFUNCTION_INSIDEARG, mcFUNCTION_INSIDENAME, and mgui_nCursorPos.

int mcFunctionHelpers::gui_GetExpOffsetx  )  const
 

Definition at line 671 of file Function.cpp.

References gui_GetSizeOfName().

Referenced by gui_GetSubOffsetx().

int mcFunctionHelpers::gui_GetExpOffsety  )  const
 

Definition at line 674 of file Function.cpp.

References gui_GetNameOffsety().

int mcFunctionHelpers::gui_GetNameOffsetx  )  const
 

Definition at line 661 of file Function.cpp.

Referenced by gui_DoRecalcBaseSize(), gui_DrawBase(), and gui_GetBaseRelCursorPos().

int mcFunctionHelpers::gui_GetNameOffsety  )  const
 

Definition at line 664 of file Function.cpp.

References mcExpElementHelpers::gui_GetBaseSize(), and gui_GetSizeOfName().

Referenced by gui_DoRecalcBaseSize(), gui_DrawBase(), gui_GetBaseRelCursorPos(), gui_GetExpOffsety(), and gui_GetSubOffsety().

wxSize mcFunctionHelpers::gui_GetSizeOfArg  )  const
 

Definition at line 638 of file Function.cpp.

References data_GetArgObj(), and mcElement::gui_GetSize().

Referenced by gui_DoRecalcBaseSize(), and gui_DrawBase().

wxSize mcFunctionHelpers::gui_GetSizeOfName  )  const
 

Definition at line 641 of file Function.cpp.

References data_GetNameObj(), and mcElement::gui_GetSize().

Referenced by gui_DoRecalcBaseSize(), gui_DrawBase(), gui_GetExpOffsetx(), gui_GetNameOffsety(), and gui_GetSubOffsety().

virtual int mcFunctionHelpers::gui_GetSpaceAboveBelow  )  const [inline, virtual]
 

Definition at line 105 of file Function.h.

References sgui_nSpaceAboveBelow.

virtual int mcFunctionHelpers::gui_GetSpaceLeftRight  )  const [inline, virtual]
 

Definition at line 106 of file Function.h.

References sgui_nSpaceLeftRight.

int mcFunctionHelpers::gui_GetSubOffsetx  )  const
 

Definition at line 682 of file Function.cpp.

References gui_GetExpOffsetx().

int mcFunctionHelpers::gui_GetSubOffsety  )  const
 

Definition at line 685 of file Function.cpp.

References gui_GetNameOffsety(), and gui_GetSizeOfName().

bool mcFunctionHelpers::gui_hasBaseSthOnRightSide  )  const [inline, virtual]
 

mcFunction doesn't have the exponent placed on the right: it is in the middle, so we need to return always FALSE from this function...

Reimplemented from mcExpElementHelpers.

Definition at line 336 of file Function.h.

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

Inits this section of the element.

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

Reimplemented from mcExpElementHelpers.

Definition at line 146 of file Function.h.

References mcExpElementHelpers::gui_Init(), mcFUNCTION_INSIDEARG, mdata_eName, and mgui_nCursorPos.

bool mcFunctionHelpers::gui_isBaseEndKey const mcKey ev  )  const [inline, 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.

Implements mcExpElementHelpers.

Definition at line 292 of file Function.h.

References mcText::data_isToReject(), mcElement::gui_GetCursorPos(), mcElement::gui_isEndKey(), mcFUNCTION_INSIDEARG, mcFUNCTION_INSIDENAME, mdata_eArg, mdata_eName, and mgui_nCursorPos.

bool mcFunctionHelpers::gui_isBeginKey const mcKey key  )  const [inline, virtual]
 

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.

Parameters:
ev The wxWidgets key event for the keypress. It contains the untraslated code for the input key; see wxWidgets KeyCodes for more info.
Returns:
A value identifying the subclass of this element that matched the given character; if the element has no subclasses it should return a null value when the given character is the begin character of the element. See MathCore::NewElem for more info.

Implements mcElementHelpers.

Definition at line 285 of file Function.h.

References sgui_pNewFunction.

Referenced by gui_BaseInput().

mcMoveCursorRes mcFunctionHelpers::gui_MoveCursor mcMoveCursorFlag  ,
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)

Reimplemented from mcExpElementHelpers.

Definition at line 470 of file Function.cpp.

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

void mcFunctionHelpers::gui_SetBaseCursorPos const mcCursorPos  )  [inline, 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.

Implements mcExpElementHelpers.

Definition at line 328 of file Function.h.

void mcFunctionHelpers::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.

Reimplemented from mcExpElementHelpers.

Definition at line 601 of file Function.cpp.

References data_GetArgObj(), data_GetNameObj(), mcElement::gui_SetCursorPos(), mcCP_BEGIN, mcCP_END, mcFUNCTION_INSIDEARG, mcFUNCTION_INSIDENAME, and mgui_nCursorPos.

void mcFunctionHelpers::gui_Setup int  functiontype  ) 
 

Definition at line 619 of file Function.cpp.

References mcElementHelpers::data_AddProperty(), data_GetArgObj(), mcExpContainer::data_GetContent(), data_SetFncType(), mcPolynomial::gui_AddNewEmptyMonomial(), mcElementHelpers::gui_RecalcSize(), mcASSERT, and mcEP_INITIALIZED.

mcMoveCursorRes mcFunctionHelpers::gui_SubMoveCursor mcMoveCursorFlag  ,
long 
 

Definition at line 738 of file Function.cpp.

References mcExpElementHelpers::data_GetSub(), mcElement::gui_MoveCursor(), HANDLE_EXPSUB, mcASSERT, mcECL_INSIDESUBSCRIPT, mcMCR_OKAY, and mgui_nCursorPos.

wxString mcFunctionHelpers::io_GetBaseInlinedExpr  )  const [virtual]
 

Implements mcExpElementHelpers.

Definition at line 845 of file Function.cpp.

References data_GetArgObj(), data_GetNameObj(), mcExpElementHelpers::data_GetSub(), mcElementHelpers::data_hasProperty(), mcElement::io_GetInlinedExpr(), mcEP_HASEXPONENT, and mcEP_HASSUBSCRIPT.

wxXml2Node mcFunctionHelpers::io_GetBaseMathML bool  bGetPresentation  )  const [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.

Implements mcExpElementHelpers.

Definition at line 794 of file Function.cpp.

References data_GetNameObj(), and mcElement::io_GetMathML().

void mcFunctionHelpers::io_GetExpSubInlinedToken wxString &  subexp  )  [virtual]
 

Overloading mcExpElementHelpers function is required since.

Reimplemented from mcExpElementHelpers.

Definition at line 881 of file Function.cpp.

Referenced by io_ImportInlinedExpr().

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

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

Reimplemented from mcExpElementHelpers.

Definition at line 805 of file Function.cpp.

References data_GetArgObj().

wxArrayString mcFunctionHelpers::io_ImportArgument const wxString &  str,
int *  count,
wxString &  pErr
[static]
 

Definition at line 895 of file Function.cpp.

Referenced by mcRadicalHelpers::io_ImportBaseInlinedExpr(), and io_ImportInlinedExpr().

bool mcFunctionHelpers::io_ImportBaseInlinedExpr const wxString &  ,
int *  ,
wxString & 
[inline, virtual]
 

This function is not used by mcFunction::io_ImportInlinedExpr.

However, it must still be present.

Implements mcExpElementHelpers.

Definition at line 413 of file Function.h.

bool mcFunctionHelpers::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.

Reimplemented from mcExpElementHelpers.

Definition at line 930 of file Function.cpp.

References mcExpElementHelpers::data_CreateExpSub(), data_GetArgObj(), mcExpElementHelpers::data_GetExp(), data_GetFncType(), data_GetName(), mcExpElementHelpers::data_GetSub(), data_SetFncType(), io_GetExpSubInlinedToken(), io_ImportArgument(), mcElementHelpers::io_PostProcessChildren(), mcASSERT, mcIOLOG, and mcTXTTHIS.

bool mcFunctionHelpers::io_ImportPresentationMathML wxXml2Node  tag,
wxString &  pErr
[virtual]
 

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

Parameters:
pTag The wxXML_***_NODE class to parse.
pErr The string where the error description is placed, if the function returns FALSE.
Returns:
TRUE on success (no mismatched or invalid tags).

Implements mcElementHelpers.

Definition at line 875 of file Function.cpp.

References mcASSERT.

bool mcFunctionHelpers::io_isBeginChar const wxString &  str  )  const [virtual]
 

Returns a positive value if the given inlined expression marks the begin of this element; FALSE otherwise.

The begin tag cannot be dependent from any variable; it must be always the same.

Implements mcElementHelpers.

Definition at line 765 of file Function.cpp.

References io_isFunctionBeginChar().

bool mcFunctionHelpers::io_isBeginTag const wxXml2Node &  tag  )  const [inline, virtual]
 

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.

Parameters:
tag The string containing the TAG to test.
Returns:
A value identifying the subclass of this element that matched the given character; if the element has no subclasses it should return a null value when the given character is the begin character of the element. See MathCore::NewElem for more info

Implements mcElementHelpers.

Definition at line 392 of file Function.h.

bool mcFunctionHelpers::io_isFunctionBeginChar const wxString &  str  )  [static]
 

Definition at line 771 of file Function.cpp.

References mcFunction::data_GetFunctionType().

Referenced by mcMonomialHelpers::io_ImportInlinedExpr(), and io_isBeginChar().

virtual mcBasicOpRes mcFunctionHelpers::math_Add const mcElement ,
mcElement p,
bool  add
[inline, virtual]
 

Sums or subtracts this element with the given e element.

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 pp pointer to store the replacement element which will be used by the caller in case this function returns mcBOR_REPLACE_OPERAND or mcBOR_REPLACE_BOTH.

Implements mcElementHelpers.

Definition at line 365 of file Function.h.

References mcBOR_REMOVE_OPERAND.

bool mcFunctionHelpers::math_CanBeAddedWith const mcElement p  )  const [inline, virtual]
 

Returns TRUE if this element can be added with the given element.

If the function returns TRUE, then the math_Add() function should return one of mcBOR_REMOVE_OPERAND, mcBOR_REPLACE_BOTH or mcBOR_REPLACE_OPERAND.

Implements mcElementHelpers.

Definition at line 360 of file Function.h.

bool mcFunctionHelpers::math_CanBeDivBy const mcElement p  )  const [inline, virtual]
 

Works like #math_CanBemath_AddeWith(), just for divisions.

Implements mcElementHelpers.

Definition at line 362 of file Function.h.

bool mcFunctionHelpers::math_CanBeMultWith const mcElement p  )  const [inline, virtual]
 

Works like #math_CanBemath_AddeWith(), just for multiplication.

Implements mcElementHelpers.

Definition at line 361 of file Function.h.

bool mcFunctionHelpers::math_CompareThisOnly const mcElement p  )  const [inline]
 

Definition at line 372 of file Function.h.

virtual mcBasicOpRes mcFunctionHelpers::math_DivideBaseOnlyBy const mcElement ,
mcElement p
[inline, virtual]
 

Implements mcExpElementHelpers.

Definition at line 368 of file Function.h.

References mcBOR_REMOVE_OPERAND.

mcRealValue mcFunctionHelpers::math_EvaluateBase  )  const [virtual]
 

Implements mcExpElementHelpers.

Definition at line 1007 of file Function.cpp.

References data_GetArgObj(), data_GetScript(), mcRealValue::GetDouble(), mcValue::isValid(), and mcElement::math_Evaluate().

mcExpSimRes mcFunctionHelpers::math_ExpandBase long  flags,
mcElement newelem
[virtual]
 

Implements mcExpElementHelpers.

Definition at line 1052 of file Function.cpp.

References data_GetArgObj(), and mcElement::math_Expand().

mcMathType mcFunctionHelpers::math_GetBaseMathType  )  const [virtual]
 

Implements mcExpElementHelpers.

Definition at line 1059 of file Function.cpp.

References data_GetArgObj(), and mcElement::math_GetMathType().

mcRealValue mcFunctionHelpers::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.

Reimplemented from mcExpElementHelpers.

Definition at line 377 of file Function.h.

int mcFunctionHelpers::math_GetOrderPos  )  const [inline, virtual]
 

Returns the order position for this element.

Implements mcElementHelpers.

Definition at line 379 of file Function.h.

virtual mcBasicOpRes mcFunctionHelpers::math_MultiplyBaseOnlyBy const mcElement ,
mcElement p
[inline, virtual]
 

Implements mcExpElementHelpers.

Definition at line 367 of file Function.h.

References mcBOR_REMOVE_OPERAND.

mcExpSimRes mcFunctionHelpers::math_SimplifyBase long  flags,
mcElement newelem
[virtual]
 

Implements mcExpElementHelpers.

Definition at line 1030 of file Function.cpp.

References data_GetArgObj(), mcExpElementHelpers::math_Evaluate(), mcElementHelpers::math_isConstant(), mcElement::math_Simplify(), mcESR_DONE, and mcESR_REPLACE_THIS.

virtual mcBasicOpRes mcFunctionHelpers::math_Subtract const mcElement ,
mcElement p
[inline, virtual]
 

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

Reimplemented from mcElementHelpers.

Definition at line 366 of file Function.h.

References mcBOR_REMOVE_OPERAND.

mcFunctionHelpers::mcDEFINE_REFERENCE_DATA mcFunction  ,
mcET_FUNCTION 
[private]
 


Member Data Documentation

mcBracket mcFunctionHelpers::mdata_eArg [protected]
 

The argument of this function.

Definition at line 87 of file Function.h.

Referenced by data_DeepCopy(), data_GetArgObj(), data_GetArgObjHlp(), data_isSameAs(), data_SetArgObj(), and gui_isBaseEndKey().

mcText mcFunctionHelpers::mdata_eName [protected]
 

The name of this function.

Definition at line 90 of file Function.h.

Referenced by data_DeepCopy(), data_GetNameObj(), data_GetNameObjHlp(), data_isSameAs(), data_SetName(), data_SetNameObj(), gui_Init(), gui_isBaseEndKey(), and mcFunctionHelpers().

int mcFunctionHelpers::mdata_nFncType [protected]
 

The type of this function.

Definition at line 93 of file Function.h.

Referenced by data_CheckName(), data_DeepCopy(), data_GetFncType(), data_isRegistered(), data_SetFncType(), and gui_BaseInput().

int mcFunctionHelpers::mgui_nCursorPos [protected]
 

Definition at line 119 of file Function.h.

Referenced by gui_BaseInput(), gui_BaseMoveCursor(), gui_EditBase(), gui_ExpMoveCursor(), gui_GetBaseCursorPos(), gui_GetBaseRelCursorPos(), gui_Init(), gui_isBaseEndKey(), gui_SetCursorPos(), and gui_SubMoveCursor().

int mcFunctionHelpers::sgui_nSpaceAboveBelow = 0 [static]
 

Definition at line 63 of file Function.cpp.

Referenced by gui_GetSpaceAboveBelow().

int mcFunctionHelpers::sgui_nSpaceLeftRight = 0 [static]
 

Definition at line 62 of file Function.cpp.

Referenced by gui_GetSpaceLeftRight().

mcKey * mcFunctionHelpers::sgui_pNewFunction = NULL [static]
 

The key to use to create this element.

Definition at line 77 of file Function.cpp.

Referenced by gui_isBeginKey().


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

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

[ Top ]