What is wxMaxima?
wxMaxima is a full-featured graphical frontend for maxima, a full-featured computer algebra system that will do numeric calculations, if one wants to. But it is specialized in manipulating and solving symbolic equations.
A random screenshot of wxMaxima
Where to start reading the code?
The main starting points would be:
- For everything that happens before the main window is displayed: main.cpp
- For things having to do with the worksheet: MathCtrl
- For things having to do with how text the user input is displayed: EditorCell
- For the items surrounding the work sheet: wxMaximaFrame
- For the general program logic and communication with maxima: wxMaxima.cpp
- For how 2d math items are handled: MathCell and all cells derived from it
- For how math is rendered as bitmap: Bitmap
- For the configuration dialogue: ConfigDialogue
- For how .wxmx files and output from maxima are read (They are in the same format): MathParser
- For how images from plots or images that are included by the users are handled: Image (for the code handling the images), ImageCell (for still images) and SlideshowCell (for animations).
- For printing out data: MathPrintout
The general principle
The main things that are important to know are:
- Maxima is a command-line program that can use a network connection in order to communicate with a frontend.
- In data/wxmathml.lisp wxMaxima teaches maxima to talk in a XML dialect: Maxima's normal output format is human-readable. But it can be tricked into containing strings that look like input or output labels and it doesn't guarantee that there is a way to transform output from maxima into a valid input again that has exactly the same meaning.
- The worksheet is defined in the class MathCtrl.
- It is organized in GroupCells that each can contain a cell containing a list of cells containing a label and the user input and a list of cells containing the output label and 2d math from maxima.
- All cells contain pointers so they can be used as a part of an double-linked list for the logical order they appear in and a second double-linked list that tells which cell to draw next. The latter is needed for handling the fact that some things (like fractions) can be displayed as 2D maths and in a more linear way.
- For every mathematical function, image or piece of text a Cell there is a specialized MathCell type that "knows" how to draw it, how to convert it to a string or how to convert it to Mathml, OOML, RTF or any other data format wxMaxima supports. There is, for example, an AbsCell for the
abs() command, an IntCell representing
integrate, a ParenCell for parenthesis and a FunCell for all the functions no special handling is needed for.
- Configuration is something like a central object keeping the configuration needed for displaying cells.
The Coding Style
Keeping the code more or less homogenous increases the readability. In order to archieve that wxMaxima uses a few naming rules:
- The names of member variables are prefixed with "m_" for "member".
- The names of member functions (aka methods) are written in CamelCase.
- The names of enums do not really matter as they are rarely used and if they are they are used in context where it is opvious that they name an enum type so there aren't any rules for the names of enums right now. There are a few other coding-style rules, as well:
- A "<code>=</code>" as an assignment operator is preceded and followed by a space character.
- And the code is documented in doxygen, which basically means to start every comment that describes the function, object, method or variable that follows the comment with a "!" so Doxygen knows that this comment is meant to end up in the documentation.