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

mcMathSystemHelpers Class Reference

#include <MathSystem.h>

Inheritance diagram for mcMathSystemHelpers:

Inheritance graph
[legend]
Collaboration diagram for mcMathSystemHelpers:

Collaboration graph
[legend]
List of all members.

Detailed Description

The base class of mcMathAndSystem and mcMathOrSystem: provides all the facilities for a class which acts as logical container of mcMathLine objects.

Definition at line 56 of file MathSystem.h.

Public Member Functions

 mcMathSystemHelpers ()
virtual ~mcMathSystemHelpers ()
void gui_Init ()
 Inits this section of the element.
void data_Check () const
 Does some standard checks on the element integrity.
void data_DeepCopy (const mcElementHelpers *p)
 Performs a deep copy of another mcMathOrSystem object.
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.
mcElementdata_Get (int n)
const mcElementdata_Get (int n) const
mcElementdata_GetLast ()
const mcElementdata_GetLast () const
int data_GetCount () const
 Returns the number of objects contained.
GUI getters
Specialized GET functions which returns elements casted to mcDoubleBufferedElements.

Thanks to this cast, many functions related to double buffering can be implemented directly in mcMathSystem.

mcElementgui_GetFocus ()
const mcElementgui_GetFocus () const
mcDoubleBufferedElementgui_Get (int n)
const mcDoubleBufferedElementgui_Get (int n) const
Double buffering functions
The functions which handle double buffering system for better GUI performances.

int gui_UpdateBmp (int x, int y, long flags, const wxPoint &p)
 Updates the bitmap in the mcMathLineHelpers structure, calling the mcMathMng::gui_Draw function.
int gui_ForceBmpUpdate (int x, int y, long flags, const wxPoint &p)
 Forces the update of the internal bitmap used for double buffering.
int gui_DrawBmp (wxDC &dc, int x, int y) const
 Draws this line on the given DC using the bitmap.
void gui_SetMask (const wxColour &col)
 Sets the given colour as the mask which will be used when blitting the bitmap in the given DC in a gui_DrawBmp call.
void gui_SetBmpBackgroundBrush (const wxBrush &)
 Sets the background colour to use to clear the bitmap before each redrawing...
bool gui_NeedsRefresh () const
 Returns TRUE if with the last call to gui_UpdateBmp or gui_ForceBmpUpdate, a redraw is required to keep the output up to date.
GUI ABSTRACT functions
Functions that change the graphical aspects of the math system.

virtual void gui_DrawSystemSymbols (wxDC &dc, int x, int y, long flags) const =0
 Draws the connector symbols of this system *without* drawing the elements contained.
virtual void gui_RecalcSymbolSize ()=0
 Recalculates the size of one of the connectors (they must have all the same size for mcMathSystem algorithms) and puts the result into the mgui_szSymbol variable.
mcMathSystem-specific GUI functions
Functions implemented over mcElement GUI functions.

virtual int gui_GetXOf (int n) const
 Slow function used to retrieve the x relative coord.
virtual int gui_GetYOf (int n) const
 Slow function used to retrieve the y relative coord.
virtual int gui_GetXOfSymbol (int n) const
 Returns the X relative coordinate of the n-th connector symbol.
virtual int gui_GetYOfSymbol (int n) const
 Returns the Y relative coordinate of the n-th connector symbol.
wxRect gui_GetRectOf (int n) const
 Returns the bounding box of the n-th line of the system.
int gui_GetElemContaining (const wxPoint &pt) const
 Returns the index of the element containing the given point (which must be in relative coordinates).
virtual wxSize gui_GetSymbolSize () const
 Returns the size of a connector.
wxPoint gui_GetRelCursorPos (wxDC &dc, int x, int y, int *height) const
 Returns the top-left position of the cursor.
void gui_CheckSelLineIdx ()
 Checks if the selected line is valid or not; in the last case, selects the last valid line.
wxBitmap gui_GetBmp () const
 Returns a bitmap containing the image of the current system.
int gui_GetFocusIdx () const
 Returns the index of the currently selected line.
void gui_SetFocusIdx (int n)
 Selects the n-th math element of this math system: sets it as the destination of the user input & as default input for math operations.
bool gui_isSymbolToDraw () const
 Returns TRUE if this system should be drawn with its special symbol (that represents the logical operation AND or OR) or it can be drawn as a simple mcMathMng object.
mcElement GUI functions
Implements mcElementHelpers abstract GUI 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_isEndKey (const mcKey &key) const
 Returns TRUE if the given character marks the end of this element; this function is always called before calling ::gui_Input function.
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.
void gui_SetCursorPos (const mcCursorPos &code)
 Sets the cursor position inside the element using Cursor Position flags.
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.
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.
int gui_MoveCursorUsingPoint (wxDC &dc, const wxPoint &pos)
 Moves the cursor inside this element in the closest available position to the given point.
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.
void gui_GetCursorPos (mcCursorPos &) const
 Returns the cursor position as Cursor Position flag.
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).
mcInsertRes gui_Insert (const mcElement &, mcElement *)
 Inserts the given element at the right of the cursor position.
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).
void gui_UpdateExpDepth ()
 Sets to zero the exponent of all our children.
GUI+MATH functions
Math functions which work on selected parts of the system.

wxString gui_GetSelInlinedExpr () const
 Returns as inlined expression the current selection.
MATH functions
mcMathOrSystem-specific math functions.

mcBasicOpRes math_MultiplyBy (const mcElement &, mcElement *)
 Multiplies all the mcMathLine contained in this object by the given polynomial.
mcBasicOpRes math_DivideBy (const mcElement &, mcElement *)
 Divides all the mcMathLine contained in this object by the given polynomial.
mcBasicOpRes math_Add (const mcElement &, mcElement *, bool)
 Sums or subtracts this element with the given e element.
mcBasicOpRes math_Subtract (const mcElement &, mcElement *)
 math_s two mcElements of the same type and stores the result in this object.
mcBasicOpRes math_RaiseTo (const mcPolynomial &)
 Raises *this element to the given polynomial.
mcExpSimRes math_Simplify (long flags, mcElement *)
 Simplifies this element one "step"; that is, after one call to this function the element must be slightly changed.
mcExpSimRes math_Expand (long flags, mcElement *)
 Expands this element one "step".
mcRealValue math_Evaluate (int n=-1) const
 Evaluates the n-th line and returns the result.
bool math_isMaxSimplified () const
mcIntegerValue math_GetMathSystemDegreeFor (const mcSymbolProperties *unk) const
mcRealValue math_GetLenght () const
 Returns the 'lenght' of this element without taking in count its children.
virtual mcMathSystemType math_GetMathSystemType () const =0
 Returns the type of this math system as a mcMathOrSystemType enumeration value.
mcMathType math_GetMathType () const
 Returns the mcMathType resulting from the *addition* of the mcMathType returned by each mcMathMng stored in this array.
bool math_Compare (const mcElement &, long flags) const
 Compares *this element with the given one and then compare the children of *this and the children of the given element, too.
mcRealValue math_Evaluate () const
 Evaluates the numeric value of this element and then returns it.
int math_GetOrderPos () const
 Returns the order position for this element.
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.
mcMonomial math_GetLCM (const mcElement &) const
 Returns the LCM between *this and the given element.
mcMonomial math_GetGCD (const mcElement &) const
IO functions
mcMathOrSystem input/output functions.

bool io_ImportInlinedExpr (const wxString &str, int *count, wxString &perr)
 Imports a mcMathOrSystem from the given string.
bool io_ImportInlinedExpr (const wxString &str)
 Works exactly like the standard mcElement io_ImportInlinedExpr but this function does not take the useless "count" argument since a mcMathSystem always import all the given string.
wxString io_GetInlinedExpr () const
 Returns the inlined expression for this system.
wxXml2Node io_GetMathML (bool bGetPresentation) const
 Returns the MathML tree which encodes this current mathsystem.
bool io_ImportPresentationMathML (wxXml2Node pDoc, wxString &pErr)
 Imports a mcMathOrSystem from the given XML tree.
virtual wxString io_GetInlinedExprOfLogicalOperator () const =0
virtual bool io_ImportToken (const wxString &str, wxString *perr)=0
wxString io_GetInlinedExprOfLogicalOperator (mcLogicOperator op, bool shortversion=FALSE) const
 Returns the given logical operator encoded as a string.
wxString io_GetInlinedExprOfAllLogicalOp () const
 Returns a string separed by.
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.

Protected Member Functions

virtual bool gui_DrawHorizontally () const =0
 Returns TRUE if the elements of the array should be oriented horizontally.
virtual bool gui_DrawVertically () const =0
virtual int gui_GetSpaceAboveBelow () const =0
virtual int gui_GetSpaceLeftRight () const =0
virtual int gui_GetSpaceBetween () const =0
mcExpSimRes math_ExpSimAllLines (bool simp=TRUE)
 Calls math_Simplify() or math_Expand() on all the lines of this system and then returns the global result for the entire array.
int io_FilterInlinedExpr (wxString &)
 Filter out the characters not allowed by MathCore inlined expression parsers and returns the number of characters filtered out.

Protected Attributes

int mgui_nSel
 The currently selected element of the array.
int mgui_nLastActive
 The index of the element containing the element which was marked as active before last call to the gui_UpdateBmp() function.
int mgui_nCurrentActive
 The index of the element containing the currently active element.
wxSize mgui_szSymbol
 The size of one of the connector symbols.
wxFont mgui_fLastFont
 The font which is used to draw the main system symbol.
int mgui_nLastWidth
 The width before last size change.


Constructor & Destructor Documentation

mcMathSystemHelpers::mcMathSystemHelpers  )  [inline]
 

Definition at line 89 of file MathSystem.h.

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

Definition at line 90 of file MathSystem.h.


Member Function Documentation

void mcMathSystemHelpers::data_Check  )  const [inline]
 

Does some standard checks on the element integrity.

If something is wrong an mcASSERT fails. Except for some short moments (the element creation/deallocation...) none of the checks done by the function should never fail. This is a recursive function.

Reimplemented from mcElementHelpers.

Definition at line 111 of file MathSystem.h.

Referenced by io_ImportInlinedExpr().

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

Performs a deep copy of another mcMathOrSystem object.

The two copies will be totally indipendent.

Reimplemented from mcElementHelpers.

Definition at line 72 of file MathSystem.cpp.

References mcAbstractArray::data_DeepCopy(), mgui_fLastFont, mgui_nCurrentActive, mgui_nLastActive, mgui_nSel, and mgui_szSymbol.

Referenced by mcMathAndSystemHelpers::math_Merge(), and mcMathOrSystemHelpers::math_OrMerge().

const mcElement& mcMathSystemHelpers::data_Get int  n  )  const [inline]
 

Definition at line 128 of file MathSystem.h.

References data_GetConstChild().

mcElement& mcMathSystemHelpers::data_Get int  n  )  [inline]
 

Definition at line 126 of file MathSystem.h.

References mcElementHelpers::data_GetChild().

Referenced by data_GetLast(), gui_DoRecalcSize(), gui_Draw(), gui_Get(), gui_GetCursorPos(), gui_GetFocus(), gui_GetRectOf(), mcMathOrSystemHelpers::gui_GetSelection(), mcMathAndSystemHelpers::gui_GetSelection(), gui_GetXOf(), gui_GetXOfSymbol(), gui_GetYOf(), gui_GetYOfSymbol(), gui_UpdateExpDepth(), io_GetInlinedExpr(), io_GetMathML(), io_ImportPresentationMathML(), math_Compare(), math_ExpSimAllLines(), math_GetMathType(), and math_RaiseTo().

int mcMathSystemHelpers::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.

Definition at line 119 of file MathSystem.h.

References mcAbstractArray::data_GetCount().

Referenced by data_GetCount().

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

Definition at line 121 of file MathSystem.h.

References mcAbstractArray::data_GetItem().

Referenced by data_Get(), mcMathAndSystemHelpers::data_GetLine(), and mcMathOrSystemHelpers::data_GetSys().

int mcMathSystemHelpers::data_GetCount  )  const [inline]
 

Returns the number of objects contained.

Reimplemented from mcAbstractArray.

Definition at line 134 of file MathSystem.h.

References data_GetChildrenCount().

Referenced by mcMathOrSystemHelpers::data_AddLineToLastAndSystem(), data_GetLast(), mcMathOrSystemHelpers::data_GetLineCount(), mcMathOrSystemHelpers::data_SetFilter(), mcMathAndSystemHelpers::data_SetFilter(), gui_CheckSelLineIdx(), gui_DoRecalcSize(), gui_Draw(), gui_DrawBmp(), mcMathOrSystemHelpers::gui_DrawSystemSymbols(), mcMathAndSystemHelpers::gui_DrawSystemSymbols(), gui_ForceBmpUpdate(), gui_GetCursorPos(), gui_GetElemContaining(), mcMathOrSystemHelpers::gui_GetSelection(), mcMathAndSystemHelpers::gui_GetSelection(), gui_isSymbolToDraw(), gui_MoveCursor(), gui_MoveCursorUsingPoint(), gui_OnSelect(), gui_SetBmpBackgroundBrush(), gui_SetCursorPos(), gui_SetMask(), gui_UpdateExpDepth(), io_GetInlinedExpr(), io_GetMathML(), math_Compare(), math_ExpSimAllLines(), mcMathOrSystemHelpers::math_GetMathSystemType(), mcMathAndSystemHelpers::math_GetMathSystemType(), math_GetMathType(), and math_RaiseTo().

const mcElement& mcMathSystemHelpers::data_GetLast  )  const [inline]
 

Definition at line 132 of file MathSystem.h.

References data_Get(), and data_GetCount().

mcElement& mcMathSystemHelpers::data_GetLast  )  [inline]
 

Definition at line 130 of file MathSystem.h.

References data_Get(), and data_GetCount().

Referenced by mcMathAndSystemHelpers::data_GetLastLine(), mcMathOrSystemHelpers::data_GetLastSys(), gui_GetCursorPos(), and mcMathOrSystemHelpers::io_ImportToken().

void mcMathSystemHelpers::gui_CheckSelLineIdx  ) 
 

Checks if the selected line is valid or not; in the last case, selects the last valid line.

Definition at line 444 of file MathSystem.cpp.

References data_GetCount(), and mgui_nSel.

void mcMathSystemHelpers::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 405 of file MathSystem.cpp.

References data_Get(), data_GetCount(), gui_DrawHorizontally(), mcElement::gui_GetHeight(), gui_GetSpaceAboveBelow(), gui_GetSpaceBetween(), gui_GetSpaceLeftRight(), gui_GetSymbolSize(), mcElement::gui_GetWidth(), gui_RecalcSymbolSize(), and mcMAX.

int mcMathSystemHelpers::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 186 of file MathSystem.cpp.

References data_Get(), data_GetCount(), mcElement::gui_Draw(), gui_DrawSystemSymbols(), mcElementHelpers::gui_GetHeight(), gui_GetRectOf(), mcElementHelpers::gui_GetWidth(), mcDRW_NOACTIVEELEM, and mcDRW_USEPOINT.

Referenced by gui_GetBmp().

int mcMathSystemHelpers::gui_DrawBmp wxDC &  dc,
int  x,
int  y
const [virtual]
 

Draws this line on the given DC using the bitmap.

Parameters:
dc The DC where the line will be drawn
memDC The memory DC to use to blit the bitmap
x The x-coord. where the line will be drawn
y The y-coord. where the line will be drawn
Returns:
The ID of the element currently under mouse cursor.

Implements mcDoubleBufferedElement.

Definition at line 220 of file MathSystem.cpp.

References data_GetCount(), mcDoubleBufferedElement::gui_DrawBmp(), gui_DrawSystemSymbols(), gui_Get(), mcElementHelpers::gui_GetHeight(), mcElementHelpers::gui_GetWidth(), gui_GetXOf(), gui_GetYOf(), and mcDRW_NOACTIVEELEM.

virtual bool mcMathSystemHelpers::gui_DrawHorizontally  )  const [protected, pure virtual]
 

Returns TRUE if the elements of the array should be oriented horizontally.

Implemented in mcMathAndSystemHelpers, and mcMathOrSystemHelpers.

Referenced by gui_DoRecalcSize(), gui_GetXOf(), and gui_GetXOfSymbol().

virtual void mcMathSystemHelpers::gui_DrawSystemSymbols wxDC &  dc,
int  x,
int  y,
long  flags
const [pure virtual]
 

Draws the connector symbols of this system *without* drawing the elements contained.

Implemented in mcMathAndSystemHelpers, and mcMathOrSystemHelpers.

Referenced by gui_Draw(), and gui_DrawBmp().

virtual bool mcMathSystemHelpers::gui_DrawVertically  )  const [protected, pure virtual]
 

Implemented in mcMathAndSystemHelpers, and mcMathOrSystemHelpers.

Referenced by gui_GetYOf(), and gui_GetYOfSymbol().

int mcMathSystemHelpers::gui_ForceBmpUpdate int  x,
int  y,
long  flags,
const wxPoint &  p
[virtual]
 

Forces the update of the internal bitmap used for double buffering.

All the parameters are the same of the gui_UpdateBmp function.

Implements mcDoubleBufferedElement.

Definition at line 234 of file MathSystem.cpp.

References data_GetCount(), mcDoubleBufferedElement::gui_ForceBmpUpdate(), gui_Get(), gui_GetRectOf(), gui_GetXOf(), gui_GetYOf(), mcDRW_NOACTIVEELEM, and mcDRW_USEPOINT.

const mcDoubleBufferedElement* mcMathSystemHelpers::gui_Get int  n  )  const [inline]
 

Definition at line 168 of file MathSystem.h.

References mcElement::chlp(), and data_Get().

mcDoubleBufferedElement* mcMathSystemHelpers::gui_Get int  n  )  [inline]
 

Definition at line 166 of file MathSystem.h.

References data_Get().

Referenced by gui_DrawBmp(), gui_ForceBmpUpdate(), gui_NeedsRefresh(), gui_SetBmpBackgroundBrush(), gui_SetMask(), and gui_UpdateBmp().

wxBitmap mcMathSystemHelpers::gui_GetBmp  )  const
 

Returns a bitmap containing the image of the current system.

The width and the height of the bitmap are set to the bounding box's width and height; the color depth is set to the screen one.

Definition at line 575 of file MathSystem.cpp.

References gui_Draw(), mcElementHelpers::gui_GetHeight(), mcElementHelpers::gui_GetWidth(), and mcDRW_NOFLAGS.

void mcMathSystemHelpers::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 377 of file MathSystem.cpp.

References data_Get(), data_GetCount(), data_GetLast(), mcElement::gui_GetCursorPos(), mcElementHelpers::gui_GetCursorPos(), mcCursorPos::gui_Push(), mcCP_BEGIN, mcCP_END, and mgui_nSel.

int mcMathSystemHelpers::gui_GetElemContaining const wxPoint &  pt  )  const
 

Returns the index of the element containing the given point (which must be in relative coordinates).

Definition at line 590 of file MathSystem.cpp.

References data_GetCount(), and gui_GetRectOf().

Referenced by gui_MoveCursorUsingPoint(), and gui_UpdateBmp().

const mcElement& mcMathSystemHelpers::gui_GetFocus  )  const [inline]
 

Definition at line 163 of file MathSystem.h.

References data_Get(), and mgui_nSel.

mcElement& mcMathSystemHelpers::gui_GetFocus  )  [inline]
 

Definition at line 161 of file MathSystem.h.

References data_Get(), and mgui_nSel.

Referenced by mcMathAndSystemHelpers::gui_GetFocusLine(), mcMathOrSystemHelpers::gui_GetFocusSys(), gui_GetRelCursorPos(), gui_Input(), gui_Insert(), gui_MoveCursor(), gui_MoveCursorUsingPoint(), gui_OnSelect(), and gui_SetCursorPos().

int mcMathSystemHelpers::gui_GetFocusIdx  )  const [inline]
 

Returns the index of the currently selected line.

Definition at line 258 of file MathSystem.h.

References mgui_nSel.

Referenced by gui_GetRelCursorPos().

wxRect mcMathSystemHelpers::gui_GetRectOf int  n  )  const
 

Returns the bounding box of the n-th line of the system.

Definition at line 453 of file MathSystem.cpp.

References data_Get(), mcElementHelpers::gui_GetHeight(), mcElementHelpers::gui_GetWidth(), gui_GetXOf(), and gui_GetYOf().

Referenced by gui_Draw(), gui_ForceBmpUpdate(), gui_GetElemContaining(), and gui_OnSelect().

int mcMathSystemHelpers::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 501 of file MathSystem.cpp.

References gui_GetFocus(), gui_GetFocusIdx(), mcElement::gui_GetRelCursorPos(), gui_GetXOf(), and gui_GetYOf().

wxPoint mcMathSystemHelpers::gui_GetRelCursorPos wxDC &  dc,
int  x,
int  y,
int *  height
const
 

Returns the top-left position of the cursor.

Parameters:
dc The device context where the math system was drawn last time.
x The x-coord. where the system has been drawn
y The y-coord where the system has been drawn
height The pointer where the cursor's height will be stored.

Definition at line 510 of file MathSystem.cpp.

References gui_GetFocus(), gui_GetFocusIdx(), mcElement::gui_GetRelCursorPos(), gui_GetXOf(), and gui_GetYOf().

wxString mcMathSystemHelpers::gui_GetSelInlinedExpr  )  const
 

Returns as inlined expression the current selection.

Definition at line 617 of file MathSystem.cpp.

References mcMathSystem::data_GetCount(), mcElementHelpers::gui_GetSelection(), mcElement::io_GetInlinedExpr(), and mcEmptySystem.

virtual int mcMathSystemHelpers::gui_GetSpaceAboveBelow  )  const [protected, pure virtual]
 

Implemented in mcMathAndSystemHelpers, and mcMathOrSystemHelpers.

Referenced by gui_DoRecalcSize(), and gui_GetYOf().

virtual int mcMathSystemHelpers::gui_GetSpaceBetween  )  const [protected, pure virtual]
 

Implemented in mcMathAndSystemHelpers, and mcMathOrSystemHelpers.

Referenced by gui_DoRecalcSize(), gui_GetXOf(), gui_GetXOfSymbol(), gui_GetYOf(), and gui_GetYOfSymbol().

virtual int mcMathSystemHelpers::gui_GetSpaceLeftRight  )  const [protected, pure virtual]
 

Implemented in mcMathAndSystemHelpers, and mcMathOrSystemHelpers.

Referenced by gui_DoRecalcSize(), and gui_GetXOf().

virtual wxSize mcMathSystemHelpers::gui_GetSymbolSize  )  const [inline, virtual]
 

Returns the size of a connector.

Definition at line 238 of file MathSystem.h.

References mgui_szSymbol.

Referenced by gui_DoRecalcSize(), gui_GetXOf(), gui_GetXOfSymbol(), gui_GetYOf(), and gui_GetYOfSymbol().

int mcMathSystemHelpers::gui_GetXOf int  n  )  const [virtual]
 

Slow function used to retrieve the x relative coord.

of the n-th line.

Parameters:
n The number of the line for which the x coord. is returned
Returns:
The x coord (in pixel) of n-th line, relative to the window

Definition at line 122 of file MathSystem.cpp.

References data_Get(), gui_DrawHorizontally(), gui_GetSpaceBetween(), gui_GetSpaceLeftRight(), gui_GetSymbolSize(), mcElementHelpers::gui_GetWidth(), and mcElement::gui_GetWidth().

Referenced by gui_DrawBmp(), gui_ForceBmpUpdate(), gui_GetRectOf(), gui_GetRelCursorPos(), gui_GetXOfSymbol(), gui_MoveCursorUsingPoint(), and gui_UpdateBmp().

int mcMathSystemHelpers::gui_GetXOfSymbol int  n  )  const [virtual]
 

Returns the X relative coordinate of the n-th connector symbol.

Definition at line 174 of file MathSystem.cpp.

References data_Get(), gui_DrawHorizontally(), gui_GetSpaceBetween(), gui_GetSymbolSize(), mcElementHelpers::gui_GetWidth(), mcElement::gui_GetWidth(), and gui_GetXOf().

Referenced by mcMathOrSystemHelpers::gui_DrawSystemSymbols(), and mcMathAndSystemHelpers::gui_DrawSystemSymbols().

int mcMathSystemHelpers::gui_GetYOf int  n  )  const [virtual]
 

Slow function used to retrieve the y relative coord.

of the n-th line

Parameters:
n The number of the line for which the y coord. is returned
Returns:
The y coord (in pixel) of n-th line, relative to the window

Definition at line 142 of file MathSystem.cpp.

References data_Get(), gui_DrawVertically(), mcElementHelpers::gui_GetHeight(), mcElement::gui_GetHeight(), gui_GetSpaceAboveBelow(), gui_GetSpaceBetween(), and gui_GetSymbolSize().

Referenced by gui_DrawBmp(), gui_ForceBmpUpdate(), gui_GetRectOf(), gui_GetRelCursorPos(), gui_GetYOfSymbol(), gui_MoveCursorUsingPoint(), and gui_UpdateBmp().

int mcMathSystemHelpers::gui_GetYOfSymbol int  n  )  const [virtual]
 

Returns the Y relative coordinate of the n-th connector symbol.

Definition at line 162 of file MathSystem.cpp.

References data_Get(), gui_DrawVertically(), mcElementHelpers::gui_GetHeight(), mcElement::gui_GetHeight(), gui_GetSpaceBetween(), gui_GetSymbolSize(), and gui_GetYOf().

Referenced by mcMathOrSystemHelpers::gui_DrawSystemSymbols(), and mcMathAndSystemHelpers::gui_DrawSystemSymbols().

void mcMathSystemHelpers::gui_Init  )  [inline, virtual]
 

Inits this section of the element.

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

Reimplemented from mcElementHelpers.

Definition at line 92 of file MathSystem.h.

References mcElementHelpers::gui_Init(), mgui_nCurrentActive, mgui_nLastActive, mgui_nLastWidth, and mgui_nSel.

mcInputRes mcMathSystemHelpers::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 388 of file MathSystem.cpp.

References gui_GetFocus(), mcElement::gui_Input(), and mcElementHelpers::gui_RecalcSize().

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

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

Implements mcElementHelpers.

Definition at line 397 of file MathSystem.cpp.

References gui_GetFocus(), mcElement::gui_Insert(), mcElementHelpers::gui_RecalcSize(), and mcINSR_OKAY.

bool mcMathSystemHelpers::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 282 of file MathSystem.h.

bool mcMathSystemHelpers::gui_isEndKey const mcKey key  )  const [inline, 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 284 of file MathSystem.h.

bool mcMathSystemHelpers::gui_isSymbolToDraw  )  const [inline]
 

Returns TRUE if this system should be drawn with its special symbol (that represents the logical operation AND or OR) or it can be drawn as a simple mcMathMng object.

Definition at line 269 of file MathSystem.h.

References data_GetCount().

mcMoveCursorRes mcMathSystemHelpers::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.

Definition at line 522 of file MathSystem.cpp.

References data_GetCount(), gui_GetFocus(), mcElement::gui_MoveCursor(), mcMCR_CANNOT_SETFOCUS, mcMCR_OKAY, mcMCR_SETFOCUS_ABOVE, mcMCR_SETFOCUS_BELOW, mcMCR_SETFOCUS_NEXT, mcMCR_SETFOCUS_PREVIOUS, and mgui_nSel.

int mcMathSystemHelpers::gui_MoveCursorUsingPoint wxDC &  dc,
const wxPoint &  pos
[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 556 of file MathSystem.cpp.

References data_GetCount(), gui_GetElemContaining(), gui_GetFocus(), gui_GetXOf(), gui_GetYOf(), mcElement::gui_MoveCursorUsingPoint(), gui_SetFocusIdx(), mcGUILOG, and mcMCR_CANNOT_SETFOCUS.

bool mcMathSystemHelpers::gui_NeedsRefresh  )  const [virtual]
 

Returns TRUE if with the last call to gui_UpdateBmp or gui_ForceBmpUpdate, a redraw is required to keep the output up to date.

Implements mcDoubleBufferedElement.

Definition at line 311 of file MathSystem.cpp.

References gui_Get(), mcDoubleBufferedElement::gui_NeedsRefresh(), mgui_nCurrentActive, and mgui_nLastActive.

void mcMathSystemHelpers::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 477 of file MathSystem.cpp.

References data_GetCount(), mcElementHelpers::gui_DeSelect(), gui_GetFocus(), gui_GetRectOf(), mcElementHelpers::gui_isSelected(), mcElement::gui_OnSelect(), mcElementHelpers::gui_Select(), and gui_SetFocusIdx().

virtual void mcMathSystemHelpers::gui_RecalcSymbolSize  )  [pure virtual]
 

Recalculates the size of one of the connectors (they must have all the same size for mcMathSystem algorithms) and puts the result into the mgui_szSymbol variable.

Implemented in mcMathAndSystemHelpers, and mcMathOrSystemHelpers.

Referenced by gui_DoRecalcSize().

void mcMathSystemHelpers::gui_SetBmpBackgroundBrush const wxBrush &   )  [virtual]
 

Sets the background colour to use to clear the bitmap before each redrawing...

the typical value is *wxWHITE_BRUSH.

Implements mcDoubleBufferedElement.

Definition at line 333 of file MathSystem.cpp.

References data_GetCount(), gui_Get(), and mcDoubleBufferedElement::gui_SetBmpBackgroundBrush().

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

Definition at line 362 of file MathSystem.cpp.

References data_GetCount(), gui_GetFocus(), mcCursorPos::gui_Pop(), mcElement::gui_SetCursorPos(), and mgui_nSel.

void mcMathSystemHelpers::gui_SetFocusIdx int  n  )  [inline]
 

Selects the n-th math element of this math system: sets it as the destination of the user input & as default input for math operations.

Definition at line 263 of file MathSystem.h.

References mgui_nSel.

Referenced by gui_MoveCursorUsingPoint(), and gui_OnSelect().

void mcMathSystemHelpers::gui_SetMask const wxColour &  col  )  [virtual]
 

Sets the given colour as the mask which will be used when blitting the bitmap in the given DC in a gui_DrawBmp call.

Implements mcDoubleBufferedElement.

Definition at line 326 of file MathSystem.cpp.

References data_GetCount(), gui_Get(), and mcDoubleBufferedElement::gui_SetMask().

int mcMathSystemHelpers::gui_UpdateBmp int  x,
int  y,
long  flags,
const wxPoint &  p
[virtual]
 

Updates the bitmap in the mcMathLineHelpers structure, calling the mcMathMng::gui_Draw function.

Parameters:
memDC The memory DC to use as temporary DC (performance optimization: instead creating each time a new memory DC, allocate one once and then reuse it on each call to data_UpdateLineBmp).
x,y The position where this line is drawn.
p The mouse cursor position (in line coord.) or mcDRW_NONACTIVE, mcDRW_ALLACTIVE flags.
Returns:
The ID of the active element

Implements mcDoubleBufferedElement.

Definition at line 270 of file MathSystem.cpp.

References gui_Get(), gui_GetElemContaining(), gui_GetXOf(), gui_GetYOf(), mcDoubleBufferedElement::gui_UpdateBmp(), mcDRW_NOACTIVEELEM, mcDRW_NONACTIVE, mcDRW_USEPOINT, mgui_nCurrentActive, mgui_nLastActive, and mgui_nSel.

void mcMathSystemHelpers::gui_UpdateExpDepth  )  [virtual]
 

Sets to zero the exponent of all our children.

Reimplemented from mcElementHelpers.

Definition at line 603 of file MathSystem.cpp.

References data_Get(), data_GetCount(), mcElement::gui_SetExpDepth(), and mcElementHelpers::gui_UpdateExpDepth().

int mcMathSystemHelpers::io_FilterInlinedExpr wxString &   )  [protected]
 

Filter out the characters not allowed by MathCore inlined expression parsers and returns the number of characters filtered out.

Definition at line 723 of file MathSystem.cpp.

References mcIOLOG.

Referenced by io_ImportInlinedExpr().

wxString mcMathSystemHelpers::io_GetInlinedExpr  )  const [virtual]
 

Returns the inlined expression for this system.

Implements mcElementHelpers.

Definition at line 653 of file MathSystem.cpp.

References data_Get(), data_GetCount(), mcElement::io_GetInlinedExpr(), and io_GetInlinedExprOfLogicalOperator().

wxString mcMathSystemHelpers::io_GetInlinedExprOfAllLogicalOp  )  const
 

Returns a string separed by.

Definition at line 689 of file MathSystem.cpp.

References io_GetInlinedExprOfLogicalOperator(), and mcLO_MAX.

wxString mcMathSystemHelpers::io_GetInlinedExprOfLogicalOperator mcLogicOperator  op,
bool  shortversion = FALSE
const
 

Returns the given logical operator encoded as a string.

Definition at line 668 of file MathSystem.cpp.

References mcLO_AND, mcLO_MAX, mcLO_NOTSET, and mcLO_OR.

virtual wxString mcMathSystemHelpers::io_GetInlinedExprOfLogicalOperator  )  const [pure virtual]
 

Implemented in mcMathAndSystemHelpers, and mcMathOrSystemHelpers.

Referenced by io_GetInlinedExpr(), io_GetInlinedExprOfAllLogicalOp(), and io_ImportInlinedExpr().

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

Returns the MathML tree which encodes this current mathsystem.

Implements mcElementHelpers.

Definition at line 698 of file MathSystem.cpp.

References data_Get(), data_GetCount(), and mcElement::io_GetMathML().

bool mcMathSystemHelpers::io_ImportInlinedExpr const wxString &  str  )  [inline]
 

Works exactly like the standard mcElement io_ImportInlinedExpr but this function does not take the useless "count" argument since a mcMathSystem always import all the given string.

Definition at line 442 of file MathSystem.h.

References io_ImportInlinedExpr().

bool mcMathSystemHelpers::io_ImportInlinedExpr const wxString &  str,
int *  count,
wxString &  perr
[virtual]
 

Imports a mcMathOrSystem from the given string.

The words OR, AND can be used to separe different lines: "4ax+b^2>0 AND b=1/2x"

Implements mcElementHelpers.

Definition at line 745 of file MathSystem.cpp.

References data_Check(), mcAbstractArray::data_Clear(), io_FilterInlinedExpr(), io_GetInlinedExprOfLogicalOperator(), io_ImportToken(), mcIOLOG, and mcLO_MAX.

Referenced by io_ImportInlinedExpr(), mcMathOrSystemHelpers::io_ImportToken(), and mcMathAndSystemHelpers::io_ImportToken().

bool mcMathSystemHelpers::io_ImportPresentationMathML wxXml2Node  pDoc,
wxString &  pErr
[virtual]
 

Imports a mcMathOrSystem from the given XML tree.

Implements mcElementHelpers.

Definition at line 714 of file MathSystem.cpp.

References mcAbstractArray::data_Clear(), data_Get(), and mcElement::io_ImportPresentationMathML().

virtual bool mcMathSystemHelpers::io_ImportToken const wxString &  str,
wxString *  perr
[pure virtual]
 

Implemented in mcMathAndSystemHelpers, and mcMathOrSystemHelpers.

Referenced by io_ImportInlinedExpr().

bool mcMathSystemHelpers::io_isBeginChar const wxString &  str  )  const [inline, 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 470 of file MathSystem.h.

bool mcMathSystemHelpers::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 469 of file MathSystem.h.

mcBasicOpRes mcMathSystemHelpers::math_Add const mcElement ,
mcElement ,
bool 
[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 821 of file MathSystem.cpp.

References mcElementHelpers::math_SimpleAdd(), and mcMATHSYSTEM_SIMPLE_PROPAGATION.

bool mcMathSystemHelpers::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 408 of file MathSystem.h.

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

Works like #math_CanBemath_AddeWith(), just for divisions.

Implements mcElementHelpers.

Definition at line 410 of file MathSystem.h.

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

Works like #math_CanBemath_AddeWith(), just for multiplication.

Implements mcElementHelpers.

Definition at line 409 of file MathSystem.h.

bool mcMathSystemHelpers::math_Compare const mcElement ,
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 835 of file MathSystem.cpp.

References mcMathSystem::data_Get(), data_Get(), mcMathSystem::data_GetCount(), data_GetCount(), mcElement::math_Compare(), and mcElementHelpers::math_CompareThisOnly().

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

Divides all the mcMathLine contained in this object by the given polynomial.

Implements mcElementHelpers.

Definition at line 818 of file MathSystem.cpp.

References mcElementHelpers::math_SimpleDivideBy(), and mcMATHSYSTEM_SIMPLE_PROPAGATION.

mcRealValue mcMathSystemHelpers::math_Evaluate  )  const [inline, 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.

Definition at line 405 of file MathSystem.h.

mcRealValue mcMathSystemHelpers::math_Evaluate int  n = -1  )  const
 

Evaluates the n-th line and returns the result.

If the given index is -1, then the selected line is used.

mcExpSimRes mcMathSystemHelpers::math_Expand long  flags,
mcElement
[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 925 of file MathSystem.cpp.

References math_ExpSimAllLines().

mcExpSimRes mcMathSystemHelpers::math_ExpSimAllLines bool  simp = TRUE  )  [protected]
 

Calls math_Simplify() or math_Expand() on all the lines of this system and then returns the global result for the entire array.

Definition at line 891 of file MathSystem.cpp.

References data_Get(), data_GetCount(), mcElement::math_Expand(), mcElement::math_Simplify(), mcESR_DONE, mcESR_INVALID_DATA, mcESR_NOTFINISHED, and mcEXPSIM_NOFLAGS.

Referenced by math_Expand(), and math_Simplify().

mcMonomial mcMathSystemHelpers::math_GetGCD const mcElement  )  const [inline, virtual]
 

Implements mcElementHelpers.

Definition at line 413 of file MathSystem.h.

References mcEmptyMonomial.

mcMonomial mcMathSystemHelpers::math_GetLCM const mcElement  )  const [inline, virtual]
 

Returns the LCM between *this and the given element.

Implements mcElementHelpers.

Definition at line 412 of file MathSystem.h.

References mcEmptyMonomial.

mcRealValue mcMathSystemHelpers::math_GetLenght  )  const [virtual]
 

Returns the 'lenght' of this element without taking in count its children.

The wxT('lenght') of this element is the 'complexity' represented by the data placed in the mcElementData of this element. This is a key function for the simplify and expand routines of MathCore because through the use of this value, the system is able to decide if an operation determines a simplification or a complication. The simple example below shows how this can be done:

          mcPolynomial mypol(NULL);
          mypol.Init("2^16");
          mcRealValue n1 = mypol.math_GetTotalLenght(); */

(The math_GetTotalLenght() function works using this function !) The default implementation returns zero. This is a valid behaviour only for container elements, that is, for those elements where only the children carry information. For simple elements and for those containers which stand for an operation (like mcFraction which implies a division), the default implementation must be overridden.

A lenght/complexity of 1 means that this element would require only a single byte of memory if stored in an ASCII string. An element long 2 units (like mcBracket) would require 2 bytes (one for the left parenthesis and one for the right one)...

Implements mcElementHelpers.

Definition at line 933 of file MathSystem.cpp.

References mcMathSystemType::m_tMath1, math_GetMathSystemType(), mcMSTL1_EQUATIONS, mcMSTL1_EXPRESSION, mcMSTL1_INEQUALITIES, mcMSTL1_MIXED, and mcMSTL1_NOT_RECOGNIZED.

mcIntegerValue mcMathSystemHelpers::math_GetMathSystemDegreeFor const mcSymbolProperties unk  )  const
 

virtual mcMathSystemType mcMathSystemHelpers::math_GetMathSystemType  )  const [pure virtual]
 

Returns the type of this math system as a mcMathOrSystemType enumeration value.

Implemented in mcMathAndSystemHelpers, and mcMathOrSystemHelpers.

Referenced by math_GetLenght().

mcMathType mcMathSystemHelpers::math_GetMathType  )  const [virtual]
 

Returns the mcMathType resulting from the *addition* of the mcMathType returned by each mcMathMng stored in this array.

Implements mcElementHelpers.

Definition at line 966 of file MathSystem.cpp.

References data_Get(), data_GetCount(), mcMathType::math_Add(), mcMTL1_POLYNOMIAL, mcMTL2_ALGEBRAIC, and mcMTL3_CONSTANT.

Referenced by mcMathOrSystemHelpers::data_GetDescString().

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

Returns the order position for this element.

Implements mcElementHelpers.

Definition at line 406 of file MathSystem.h.

bool mcMathSystemHelpers::math_isMaxSimplified  )  const
 

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

Multiplies all the mcMathLine contained in this object by the given polynomial.

Implements mcElementHelpers.

Definition at line 815 of file MathSystem.cpp.

References mcElementHelpers::math_SimpleMultiplyBy(), and mcMATHSYSTEM_SIMPLE_PROPAGATION.

mcBasicOpRes mcMathSystemHelpers::math_RaiseTo const mcPolynomial  )  [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 827 of file MathSystem.cpp.

References data_Get(), data_GetCount(), mcElement::math_SimpleRaiseTo(), and mcBOR_REMOVE_OPERAND.

mcExpSimRes mcMathSystemHelpers::math_Simplify long  flags,
mcElement
[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 917 of file MathSystem.cpp.

References math_ExpSimAllLines().

mcBasicOpRes mcMathSystemHelpers::math_Subtract const mcElement pol,
mcElement
 

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

Reimplemented from mcElementHelpers.

Definition at line 824 of file MathSystem.cpp.

References mcElementHelpers::math_SimpleSubtract(), and mcMATHSYSTEM_SIMPLE_PROPAGATION.


Member Data Documentation

wxFont mcMathSystemHelpers::mgui_fLastFont [protected]
 

The font which is used to draw the main system symbol.

Definition at line 80 of file MathSystem.h.

Referenced by data_DeepCopy().

int mcMathSystemHelpers::mgui_nCurrentActive [protected]
 

The index of the element containing the currently active element.

If this is set to -1, then there are no currently active elements.

Definition at line 73 of file MathSystem.h.

Referenced by data_DeepCopy(), gui_Init(), gui_NeedsRefresh(), and gui_UpdateBmp().

int mcMathSystemHelpers::mgui_nLastActive [protected]
 

The index of the element containing the element which was marked as active before last call to the gui_UpdateBmp() function.

If this is set to -1, then there were no active elements.

Definition at line 69 of file MathSystem.h.

Referenced by data_DeepCopy(), gui_Init(), gui_NeedsRefresh(), and gui_UpdateBmp().

int mcMathSystemHelpers::mgui_nLastWidth [protected]
 

The width before last size change.

Definition at line 83 of file MathSystem.h.

Referenced by gui_Init().

int mcMathSystemHelpers::mgui_nSel [protected]
 

The currently selected element of the array.

This is the element which receives keyboard input.

Definition at line 64 of file MathSystem.h.

Referenced by data_DeepCopy(), gui_CheckSelLineIdx(), gui_GetCursorPos(), gui_GetFocus(), gui_GetFocusIdx(), gui_Init(), gui_MoveCursor(), gui_SetCursorPos(), gui_SetFocusIdx(), and gui_UpdateBmp().

wxSize mcMathSystemHelpers::mgui_szSymbol [protected]
 

The size of one of the connector symbols.

Definition at line 76 of file MathSystem.h.

Referenced by data_DeepCopy(), and gui_GetSymbolSize().


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

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

[ Top ]