#include <MathSystem.h>
Inheritance diagram for mcMathSystemHelpers:
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 mcElement & | data_GetConstChild (int n) const |
Returns the n-th tree node attached to this element. | |
mcElement & | data_Get (int n) |
const mcElement & | data_Get (int n) const |
mcElement & | data_GetLast () |
const mcElement & | data_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. | |
mcElement & | gui_GetFocus () |
const mcElement & | gui_GetFocus () const |
mcDoubleBufferedElement * | gui_Get (int n) |
const mcDoubleBufferedElement * | gui_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 | |
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 | |
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 | |
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. |
|
Definition at line 89 of file MathSystem.h. |
|
Definition at line 90 of file MathSystem.h. |
|
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(). |
|
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(). |
|
Definition at line 128 of file MathSystem.h. References data_GetConstChild(). |
|
|
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(). |
|
Returns the n-th tree node attached to this element. You can use this function to traverse the entire tree:
mcElement rootnode = [...]; MyWalkerFnc(rootnode); void MyWalkerFnc(mcElement p) { // do what you want on the "p" node... for (int i=0; i < p.data_GetChildrenCount(); i++) MyWalkerFnc(p.data_GetChild(i)); }
Reimplemented 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(). |
|
|
Definition at line 132 of file MathSystem.h. References data_Get(), and data_GetCount(). |
|
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(). |
|
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. |
|
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.
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. |
|
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.
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(). |
|
Draws this line on the given DC using the bitmap.
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. |
|
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(). |
|
Draws the connector symbols of this system *without* drawing the elements contained.
Implemented in mcMathAndSystemHelpers, and mcMathOrSystemHelpers. Referenced by gui_Draw(), and gui_DrawBmp(). |
|
Implemented in mcMathAndSystemHelpers, and mcMathOrSystemHelpers. Referenced by gui_GetYOf(), and gui_GetYOfSymbol(). |
|
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. |
|
Definition at line 168 of file MathSystem.h. References mcElement::chlp(), and data_Get(). |
|
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(). |
|
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. |
|
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. |
|
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(). |
|
Definition at line 163 of file MathSystem.h. References data_Get(), and mgui_nSel. |
|
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(). |
|
Returns the index of the currently selected line.
Definition at line 258 of file MathSystem.h. References mgui_nSel. Referenced by gui_GetRelCursorPos(). |
|
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(). |
|
Returns the height of the cursor and the (x;y) position of the cursor (in the given pointer) relative to the top-left point of this element. The function must fill the wxPoint pointer using coordinates relative to the top-left point of its bounding rectangle. When this function is called, the cursor is always inside the element.
Implements mcElementHelpers. Definition at line 501 of file MathSystem.cpp. References gui_GetFocus(), gui_GetFocusIdx(), mcElement::gui_GetRelCursorPos(), gui_GetXOf(), and gui_GetYOf(). |
|
Returns the top-left position of the cursor.
Definition at line 510 of file MathSystem.cpp. References gui_GetFocus(), gui_GetFocusIdx(), mcElement::gui_GetRelCursorPos(), gui_GetXOf(), and gui_GetYOf(). |
|
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. |
|
Implemented in mcMathAndSystemHelpers, and mcMathOrSystemHelpers. Referenced by gui_DoRecalcSize(), and gui_GetYOf(). |
|
Implemented in mcMathAndSystemHelpers, and mcMathOrSystemHelpers. Referenced by gui_DoRecalcSize(), gui_GetXOf(), gui_GetXOfSymbol(), gui_GetYOf(), and gui_GetYOfSymbol(). |
|
Implemented in mcMathAndSystemHelpers, and mcMathOrSystemHelpers. Referenced by gui_DoRecalcSize(), and gui_GetXOf(). |
|
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(). |
|
Slow function used to retrieve the x relative coord. of the n-th line.
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(). |
|
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(). |
|
Slow function used to retrieve the y relative coord. of the n-th line
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(). |
|
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(). |
|
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. |
|
This function is called when the cursor is inside the element and the user presses a key (which is not the element's end tag). The way the element should process the given character is dependent to the element type: a mcNumber will insert vk next to the cursor position if vk is a digit. If vk is not acceptable, the function should call the MathCore error-handler function, mcMathCore::Get()->SyntaxError. This function should return one of the values defined for mcInputRes: mcIR_OKAY, mcIR_DELETE_THIS, mcIR_DIRECT_DELETE, mcIR_DELETE_NEXT.
Implements mcElementHelpers. Definition at line 388 of file MathSystem.cpp. References gui_GetFocus(), mcElement::gui_Input(), and mcElementHelpers::gui_RecalcSize(). |
|
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. |
|
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.
Implements mcElementHelpers. Definition at line 282 of file MathSystem.h. |
|
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
Implements mcElementHelpers. Definition at line 284 of file MathSystem.h. |
|
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(). |
|
This function is called to move the cursor which is inside the element, one 'step' left, right, up or down (when flag=mcMCF_LEFT/mcMCF_RIGHT/mcMCF_UP/mcMCF_DOWN). Elements which cannot move the cursor in the given direction, should call mcMathCore::Get()->SyntaxError() function. If the cursor must 'exit' the element (because its at the end, for example) the function must return mcMCR_SETFOCUS_PREVIOUS or mcMCR_SETFOCUS_NEXT. This function must always return the code mcMCR_SETFOCUS_* or mcMCR_OKAY. When this function is called, cursor is always inside the element.
Implements mcElementHelpers. 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. |
|
Moves the cursor inside this element in the closest available position to the given point. The function must use the given point to set its internal cursor-position variables (when this function is called, the given point is always inside the bounding rectangle of the element, but maybe the cursor is not).
Implements mcElementHelpers. 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. |
|
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. |
|
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(). |
|
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(). |
|
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(). |
|
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. |
|
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(). |
|
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(). |
|
Updates the bitmap in the mcMathLineHelpers structure, calling the mcMathMng::gui_Draw function.
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. |
|
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(). |
|
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(). |
|
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(). |
|
Returns a string separed by.
Definition at line 689 of file MathSystem.cpp. References io_GetInlinedExprOfLogicalOperator(), and mcLO_MAX. |
|
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. |
|
Implemented in mcMathAndSystemHelpers, and mcMathOrSystemHelpers. Referenced by io_GetInlinedExpr(), io_GetInlinedExprOfAllLogicalOp(), and io_ImportInlinedExpr(). |
|
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(). |
|
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(). |
|
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(). |
|
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(). |
|
Implemented in mcMathAndSystemHelpers, and mcMathOrSystemHelpers. Referenced by io_ImportInlinedExpr(). |
|
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. |
|
Returns a positive value if the given MathML content tag marks the begin of this element; FALSE otherwise. The begin tag cannot be dependent from any variable; it must be always the same.
Implements mcElementHelpers. Definition at line 469 of file MathSystem.h. |
|
Sums or subtracts this element with the given A unique function for add/subtract operations is used because the algorithms used to handle this two operations are usually almost identic and thus this avoids a lot of repetitions. If the two elements cannot be summed, then an ASSERT should fail since before using this function, the caller should always use the math_CanBeAddedWith() function.
The function returns one of mcBasicOpRes values, eventually using the Implements mcElementHelpers. Definition at line 821 of file MathSystem.cpp. References mcElementHelpers::math_SimpleAdd(), and mcMATHSYSTEM_SIMPLE_PROPAGATION. |
|
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. |
|
Works like #math_CanBemath_AddeWith(), just for divisions.
Implements mcElementHelpers. Definition at line 410 of file MathSystem.h. |
|
Works like #math_CanBemath_AddeWith(), just for multiplication.
Implements mcElementHelpers. Definition at line 409 of file MathSystem.h. |
|
Compares *this element with the given one and then compare the children of *this and the children of the given element, too. If they are the same, then the function returns TRUE; FALSE otherwise. This function is different from #math_hasSameContentOf() because it doesn't work on MaxSimply()ed copies. This function tipically uses the math_CompareThisOnly() function. Implements mcElementHelpers. 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(). |
|
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. |
|
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. |
|
Evaluates the n-th line and returns the result. If the given index is -1, then the selected line is used. |
|
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(). |
|
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(). |
|
Implements mcElementHelpers. Definition at line 413 of file MathSystem.h. References mcEmptyMonomial. |
|
Returns the LCM between *this and the given element.
Implements mcElementHelpers. Definition at line 412 of file MathSystem.h. References mcEmptyMonomial. |
|
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. |
|
|
|
Returns the type of this math system as a mcMathOrSystemType enumeration value.
Implemented in mcMathAndSystemHelpers, and mcMathOrSystemHelpers. Referenced by math_GetLenght(). |
|
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(). |
|
Returns the order position for this element.
Implements mcElementHelpers. Definition at line 406 of file MathSystem.h. |
|
|
|
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. |
|
Raises *this element to the given polynomial. Returns mcBOR_INVALID if the operation could not be performed (this is typically because the base is negative), or mcBOR_REMOVE_OPERAND if the operation was okay.
Implements mcElementHelpers. Definition at line 827 of file MathSystem.cpp. References data_Get(), data_GetCount(), mcElement::math_SimpleRaiseTo(), and mcBOR_REMOVE_OPERAND. |
|
Simplifies this element one "step"; that is, after one call to this function the element must be slightly changed. For example, this monomial requires three calls to math_Simplify to be completely reduced in a basic form: 12ax*3 + 4a/(x^-1) . first call to math_Simplify 36ax + 4a/(1/x) . second call 36ax + 4ax . third call 40ax
Implements mcElementHelpers. Definition at line 917 of file MathSystem.cpp. References math_ExpSimAllLines(). |
|
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. |
|
The font which is used to draw the main system symbol.
Definition at line 80 of file MathSystem.h. Referenced by data_DeepCopy(). |
|
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(). |
|
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(). |
|
The width before last size change.
Definition at line 83 of file MathSystem.h. Referenced by gui_Init(). |
|
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(). |
|
The size of one of the connector symbols.
Definition at line 76 of file MathSystem.h. Referenced by data_DeepCopy(), and gui_GetSymbolSize(). |
[ Top ] |