wxMaxima
Loading...
Searching...
No Matches
Data Structures | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
EditorCell Class Referencefinal

This class defines what the user sees as input cell. More...

#include <EditorCell.h>

Inheritance diagram for EditorCell:
[legend]
Collaboration diagram for EditorCell:
[legend]

Data Structures

class  History
 The undo history of this cell. More...
 

Public Member Functions

 EditorCell (GroupCell *group, Configuration *config, wxString text={})
 The constructor.
 
 EditorCell (GroupCell *group, const EditorCell &cell)
 
void UpdateSelectionString ()
 
void SetSelection (size_t start, size_t end)
 
bool SelectionActive () const
 
void ClearSelection ()
 
void SelectionStart (size_t start)
 
void SelectionEnd (size_t end)
 
size_t SelectionStart () const
 
size_t SelectionEnd () const
 
size_t SelectionLeft () const
 
size_t SelectionRight () const
 
size_t SelectionLength () const
 
void SelectionLength (size_t length)
 
void CursorMove (long long increment)
 
size_t CursorPosition () const
 
void CursorPosition (size_t pos)
 
const CellTypeInfoGetInfo () override
 Returns the information about this cell's type.
 
std::unique_ptr< CellCopy (GroupCell *group) const override
 Create a copy of this cell.
 
EditorCellGetPrevious () const
 Get the previous EditorCell in the list.
 
EditorCellGetNext () const
 Get the next EditorCell in the list.
 
void InsertEscCommand (const wxString &txt)
 Insert the symbol that corresponds to the ESC command txt.
 
wxString GetFullCommandUnderCursor ()
 Get the whole maxima command that is currently under the cursor (including all arguments)
 
void AddDrawParameter (wxString param)
 Add a new parameter to a draw- or similar command including the comma, if needed.
 
void AutoAnswer (bool autoAnswer)
 May this Editor Cell contain the answer to a question?
 
void SearchStartedHere (size_t index) const
 Remember that this is the cell the search was started in.
 
void SearchStartedHere () const
 Remember that this is the cell the search was started in.
 
void MouseSelectionStartedHere () const
 Remember that this is the cell the mouse selection was started in.
 
void KeyboardSelectionStartedHere () const
 Remember that this is the cell the keyboard selection was started in.
 
const auto & GetWordList () const
 A list of words that might be applicable to the autocomplete function.
 
void Recalculate (AFontSize fontsize) override
 Recalculate the size of the cell and the difference between top and center.
 
virtual void Draw (wxPoint point, wxDC *dc, wxDC *antialiassingDC) override
 Draw this cell.
 
wxString ToHTML () const
 Convert the current cell to HTML code.
 
wxString ToMatlab () const override
 Convert this cell to its Matlab representation.
 
wxString ToMatlab (bool dontLimitToSelection) const
 Convert the current cell to a string.
 
wxString ToRTF () const override
 Convert the current cell to RTF code.
 
wxString ToString () const override
 Returns the cell's representation as a string.
 
wxString ToString (bool dontLimitToSelection) const
 
wxString ToTeX () const override
 Convert the current cell to LaTeX code.
 
wxString ToXML () const override
 Convert the current cell to XML code for inclusion in a .wxmx file.
 
const wxFont & GetFont () const
 Get the font that matches this cell's formatting.
 
void SetFont (wxDC *dc) const
 Set the currently used font to the one that matches this cell's formatting.
 
void SetForeground (wxDC *dc)
 Sets the current color to this cell's foreground color.
 
void SetValue (const wxString &text) override
 Sets the text that is to be displayed.
 
const wxString & GetValue () const override
 Returns the text contained in this cell.
 
void StyleText ()
 Converts m_text to a list of styled text snippets that will later be displayed by draw().
 
void StyleTextCode ()
 Is Called by StyleText() if this is a code cell.
 
void StyleTextTexts ()
 
void Reset ()
 
void ProcessEvent (wxKeyEvent &event) override
 Decide what to do if the user pressed a key when this cell was selected.
 
bool ActivateCursor ()
 Activate the blinking cursor in this cell.
 
void DeactivateCursor ()
 Deactivate the blinking cursor in the EditorCell it is in.
 
size_t BeginningOfLine (size_t pos) const
 Return the index of the 1st char of the line containing the letter pos.
 
size_t EndOfLine (size_t pos)
 Return the index of the last char of the line containing the letter #pos,.
 
bool AddEnding () override
 Adds a ";" to the end of the last command in this cell in case that it doesn't end in $ or ;.
 
void PositionToXY (size_t position, size_t *x, size_t *y)
 Determines which line and column the pos'th char is at.
 
size_t XYToPosition (size_t x, size_t y)
 Determines which index the char at the position "x chars left, y chars down" is at.
 
wxPoint PositionToPoint (size_t pos) override
 The screen coordinates of the cursor.
 
wxPoint PositionToPoint () override
 Locates the cursor in the editable text of this cell.
 
void SelectPointText (wxPoint point) override
 Sets the cursor to the screen coordinate point.
 
void SelectRectText (wxPoint one, wxPoint two) override
 Selects the text between the screen coordinates one and two.
 
wxString SelectWordUnderCaret (bool selectParens=true, bool toRight=true, bool includeDoubleQuotes=false)
 Selects the word the cursor is currently at.
 
bool IsPointInSelection (wxPoint point)
 Is the point point inside the currently selected text?
 
bool CopyToClipboard () const override
 Copy this cell's editable contents to the clipboard.
 
bool CutToClipboard () override
 Cut this cell's editable contents to the clipboard.
 
void PasteFromClipboard (bool primary=false) override
 Paste from the clipboard into this cell.
 
size_t GetSelectionStart () const
 Get the character position the selection has been started with.
 
long GetSelectionEnd () const
 Get the character position the selection has been ended with.
 
void SelectAll () override
 Select the whole text contained in this Cell.
 
bool AllSelected () const
 Does the selection currently span the whole cell?
 
void SelectNone ()
 Unselect everything.
 
bool CanCopy () const override
 Select Can we copy the editable text of this cell?
 
bool FindMatchingQuotes ()
 For a given quotation mark ("), find a matching quote.
 
void FindMatchingParens ()
 
wxCoord GetLineWidth (size_t line, size_t pos)
 
bool IsDirty () const override
 true, if this cell's width has to be recalculated.
 
void SwitchCaretDisplay () override
 Toggles the visibility of the cursor which is used to make it blink.
 
void SetFocus (bool focus) override
 
bool IsActive () const override
 Is this editor cell focused?
 
bool CaretAtStart () const
 Is the cursor at the start of this cell?
 
void CaretToStart ()
 Move the cursor to the start of this cell.
 
bool CaretAtEnd () const
 Is the cursor at the end of this cell?
 
void CaretToEnd ()
 Move the cursor to the end of this cell.
 
void CaretToPosition (size_t pos)
 Move the cursor to a certain position in the cell.
 
bool CanUndo () const
 True, if there is undo information for this cell.
 
void Undo ()
 Issue an undo command.
 
bool CanRedo () const
 True, if a redo can be done for this cell.
 
void Redo ()
 Issu a redo command.
 
void SaveValue (History::Action action=History::Action::any)
 Save the current contents of this cell in the undo buffer.
 
wxString DivideAtCaret ()
 DivideAtCaret Returns the string from caret to end and modifies the m_text so it contains only the string from beginning to caret Used for 'Divide Cell', called from MathCtrl.
 
void CommentSelection ()
 
bool ContainsChanges () const
 Query if this cell needs to be re-evaluated by maxima.
 
void ContainsChanges (bool changes)
 Set the information if this cell needs to be re-evaluated by maxima.
 
bool CheckChanges ()
 
size_t ReplaceAll (wxString oldString, const wxString &newString, bool ignoreCase)
 Replaces all occurrences of a given string.
 
size_t ReplaceAll_RegEx (const wxString &oldString, const wxString &newString)
 
bool FindNext (wxString str, const bool &down, const bool &ignoreCase)
 Finds the next occurrences of a string.
 
bool FindNext_RegEx (wxString str, const bool &down)
 
bool IsSelectionChanged () const
 
void GetSelection (size_t *start, size_t *end) const
 
bool ReplaceSelection (const wxString &oldStr, const wxString &newString, bool keepSelected=false, bool ignoreCase=false, bool replaceMaximaString=false)
 Replace the current selection with a string.
 
bool ReplaceSelection_RegEx (const wxString &oldStr, const wxString &newString)
 
wxString GetSelectionString () const
 Convert the current selection to a string.
 
TextStyle GetSelectionStyle () const
 Try to determine the selection's text style.
 
wxString GetWordUnderCaret ()
 The word the cursor currently is at.
 
wxString GetCurrentCommand () const
 Get the command the cursor is in the arguments for.
 
void SetErrorIndex (size_t index)
 Sets the index the error is at.
 
void ClearErrorIndex ()
 Clears the index the error is at.
 
bool ErrorIndexSet () const
 
void GotoError ()
 
void ProcessNewline (bool keepCursorAtStartOfLine=true)
 Start a new line and optionally auto-indent it.
 
size_t GetCaretPosition () const
 Get the cursor's current position inside the cell.
 
void ConvertNumToUNicodeChar ()
 Convert a number to unicode chars.
 
void SetCaretPosition (size_t pos)
 Set the cursor's current position inside the cell.
 
bool FindNextTemplate (bool left=false)
 
void InsertText (wxString text)
 
wxString TextInFrontOfSelection () const
 
void ReturnToSelectionFromTop ()
 Return to the selection after the cell has been left upwards.
 
void SetType (CellType type) override
 Sets the text style according to the type.
 
void SetStyle (TextStyle style) override
 Sets the TextStyle of this cell.
 
bool NeedsRecalculation (AFontSize fontSize) const override
 True, if something that affects the cell size has changed.
 
void ReturnToSelectionFromBot ()
 Return to the selection after the cell has been left downwards.
 
const MaximaTokenizer::TokenList & GetDisplayedTokens ()
 Get the list of commands, parenthesis, strings and whitespaces in a code cell.
 
const MaximaTokenizer::TokenList & GetAllTokens ()
 Get the list of commands, parenthesis, strings and whitespaces including hidden ones.
 
wxCoord Scale_Px (double px) const
 Scale font sizes and line widths according to the zoom factor.
 
AFontSize Scale_Px (AFontSize size) const
 Scale font sizes and line widths according to the zoom factor.
 
virtual const wxString GetToolTip (wxPoint point) const
 Returns the ToolTip this cell provides at a given point.
 
unsigned long CellsInListRecursive () const
 How many cells does this cell contain?
 
wxRect CropToUpdateRegion (wxRect rect) const
 The part of the rectangle rect that is in the region that is currently drawn.
 
bool InUpdateRegion () const
 Is this cell inside the region that is currently drawn?
 
void SoftLineBreak (bool breakLine=true)
 Do we want this cell to start with a linebreak?
 
bool BreakUpCells ()
 Cell list: Convert 2d math objects bigger than the screen width into linear form.
 
bool UnBreakUpCells ()
 Convert all maths objects in this call list into their 2D form.
 
void BreakLines_List ()
 
int GetLineIndent () const
 If this were the beginning of a line: How far do we need to indent it?
 
bool BreakLineHere () const
 Are we allowed to break a line here?
 
bool HasHardLineBreak () const
 Does this cell begin with a manual linebreak?
 
virtual bool BreakUp ()
 Try to split this command into lines to make it fit on the screen.
 
bool ContainsRect (const wxRect &sm, bool all=true) const
 Is a part of this cell inside a certain rectangle?
 
bool ContainsPoint (wxPoint point) const
 Is a given point inside this cell?
 
virtual void ClearCache ()
 Clears memory from cached items automatically regenerated when the cell is drawn.
 
void ClearCacheList ()
 Clears the cache of the whole list of cells starting with this one.
 
void SetConfigurationList (Configuration *config)
 Tell this cell list to use the configuration object config.
 
virtual void SetConfiguration (Configuration *config)
 Tell this cell to use the configuration object config.
 
ConfigurationGetConfiguration ()
 Which configuration object is responsible for this cell?
 
void DrawList (wxPoint point, wxDC *dc, wxDC *adc)
 Draw this list of cells.
 
void DrawList (wxDC *dc, wxDC *adc)
 
virtual void DrawBoundingBox (wxDC &WXUNUSED(dc), bool all=false)
 Draw a rectangle that marks this cell or this list of cells as selected.
 
bool DrawThisCell (wxPoint point)
 Is this cell currently visible in the window?
 
bool DrawThisCell ()
 Is this cell currently visible in the window?
 
void ForceBreakLine (bool force=true)
 Insert (or remove) a forced linebreak at the beginning of this cell.
 
wxCoord GetHeight () const
 Get the height of this cell.
 
int GetWidth () const
 Get the width of this cell.
 
wxCoord GetCenter () const
 Get the distance between the top and the center of this cell.
 
bool HasValidSize () const
 Is the size valid and not pending a recalculation?
 
bool HasStaleSize () const
 Is the size valid, whether a recalculation is pending or not?
 
bool HasValidPosition () const
 Is the position valid?
 
wxCoord GetDrop () const
 Get the distance between the center and the bottom of this cell.
 
CellType GetType () const
 Returns the type of this cell.
 
wxCoord GetMaxDrop () const
 Returns the maximum distance between center and bottom of this line.
 
wxCoord GetCenterList () const
 Returns the maximum distance between top and center of this line.
 
wxCoord GetHeightList () const
 Returns the total height of this line.
 
wxCoord GetFullWidth () const
 How many pixels is this list of cells wide, if we don't break it into lines?
 
wxCoord GetLineWidth () const
 How many pixels is the current line of this list of cells wide?
 
wxCoord GetCurrentX () const
 Get the x position of the top left of this cell.
 
wxCoord GetCurrentY () const
 Get the y position of the top left of this cell.
 
virtual wxRect GetRect (bool wholeList=false) const
 Get the smallest rectangle this cell fits in.
 
void ScheduleRecalculation ()
 Cause this cell to be recalculated the next time.
 
bool ConfigChanged () const
 Has the configuration changed since the last recalculation of this cell?
 
virtual wxString GetDiffPart () const
 Get the part for diff tag support.
 
void RecalculateList (AFontSize fontsize)
 Recalculate both width and height of this list of cells.
 
void FontsChangedList ()
 Tell a whole list of cells that their fonts have changed.
 
void ResetSize_Recursively ()
 Mark all cached size information as "to be calculated".
 
void ResetSize_RecursivelyList ()
 Mark all cached size information of this cell list as "to be calculated".
 
void ResetSize ()
 Mark the cached height and width information as "to be calculated".
 
void ResetSizeList ()
 Mark the cached height information of the whole list of cells as "to be calculated".
 
void SetBigSkip (bool skip)
 Tell this cell to cause an additional vertical space.
 
bool HasBigSkip () const
 Does this cell come with an additional vertical space.
 
const TextStyleGetTextStyle () const
 Get the text style.
 
void SetPen (wxDC *dc, double lineWidth=1.0) const
 Sets the drawing pen to the cell's default foreground color.
 
void SetBrush (wxDC *dc) const
 Sets the fill brush to the cell's default foreground color.
 
wxColour GetForegroundColor () const
 
void SetHighlight (bool highlight)
 Mark this cell as highlighted (e.G. being in a maxima box)
 
bool GetHighlight () const
 Is this cell highlighted (e.G. inside a maxima box)
 
virtual void SetIsExponent ()
 Tell this cell to be an exponent.
 
virtual void SetIsExponentList ()
 Tell this list of cells to be an exponent.
 
virtual void SetValue (const wxString &WXUNUSED(text))
 Allows to change the text a TextCell contains.
 
virtual const wxString GetDisplayedString () const
 
Cellfirst () const
 Get the first cell in this list of cells.
 
Celllast () const
 Get the last cell in this list of cells.
 
Range GetCellsInRect (const wxRect &rect) const
 Returns the first and last cells within the given rectangle, recursing into the inner cells.
 
Range GetListCellsInRect (const wxRect &rect) const
 Returns the first and last cells within the given rectangle, without recursing into the inner cells.
 
virtual Range GetInnerCellsInRect (const wxRect &rect) const
 Select the cells inside this cell described by the rectangle rect.
 
virtual bool IsOperator () const
 Is this cell an operator?
 
bool IsCompound () const
 Do we have an operator in this line - draw () in frac...
 
virtual bool IsShortNum () const
 True if this cell represents a short number.
 
GroupCellGetGroup () const
 Returns the group cell this cell belongs to.
 
virtual wxString ListToString () const
 Returns this cell list's representation as a string.
 
wxString VariablesAndFunctionsList () const
 Returns all variable and function names used inside this list of cells.
 
virtual wxString ListToMatlab () const
 Convert this list to its LaTeX representation.
 
virtual wxString ListToTeX () const
 Convert this list to its LaTeX representation.
 
virtual wxString ListToXML () const
 Convert this list to a representation fit for saving in a .wxmx file.
 
virtual wxString ListToMathML (bool startofline=false) const
 Convert this list to a MathML representation.
 
virtual wxString ListToOMML (bool startofline=false) const
 Convert this list to an OMML representation.
 
virtual wxString ListToRTF (bool startofline=false) const
 Convert this list to an RTF representation.
 
virtual wxString ToOMML () const
 Returns the cell's representation as OMML.
 
virtual wxString ToMathML () const
 Convert this cell to a representation fit for saving in a .wxmx file.
 
virtual void Unbreak ()
 Undo breaking this cell into multiple lines.
 
virtual void UnbreakList ()
 Unbreak this line.
 
CellGetNextToDraw () const
 Get the next cell that needs to be drawn.
 
virtual void SetNextToDraw (Cell *next)
 Tells this cell which one should be the next cell to be drawn.
 
template<typename T , typename Del , typename std::enable_if< std::is_base_of< Cell, T >::value, bool >::type = true>
void SetNextToDraw (const std::unique_ptr< T, Del > &ptr)
 Tells this cell which one should be the next cell to be drawn.
 
bool IsComment () const
 Determine if this cell contains text that isn't code.
 
bool IsHidden () const
 Whether this cell is not to be drawn.
 
virtual bool FirstLineOnlyEditor ()
 True, if this GroupCell is folded and its editor shows only its first line.
 
virtual void Hide (bool hide=true)
 Hide this cell. See IsHidden() for details.
 
bool IsEditable (bool input=false) const
 Is this cell editable?
 
virtual bool CanPopOut () const
 Can this cell be popped out interactively in gnuplot?
 
virtual wxString GnuplotSource () const
 Retrieve the gnuplot source data for this image.
 
virtual void ProcessEvent (wxKeyEvent &WXUNUSED(event))
 Processes a key event.
 
virtual wxPoint PositionToPoint (size_t WXUNUSED(pos))
 Locates a char in the editable text of this cell.
 
virtual void SetFocus (bool WXUNUSED(focus))
 Focus this editor cell.
 
void SetTextColor (wxDC *dc)
 Sets the text color.
 
bool IsMath () const
 Is this cell possibly output of maxima?
 
virtual int GetImageBorderWidth () const
 0 for ordinary cells, 1 for slide shows and diagrams displayed with a 1-pixel border
 
void CopyCommonData (const Cell &cell)
 Copy common data (used when copying a cell)
 
std::unique_ptr< CellCopyList (GroupCell *group) const
 Return a copy of the list of cells beginning with this one.
 
void ClearToolTip ()
 Remove this cell's tooltip.
 
void SetToolTip (const wxString &tooltip)
 Set the tooltip to a given string.
 
void SetToolTip (const wxString *toolTip)
 Set the tooltip of this math cell - it must be exist at least as long as the cell does. Translation results behave that way. I.e. it must be a static string!
 
void AddToolTip (const wxString &tip)
 Add another tooltip to this cell.
 
virtual void SetCurrentPoint (wxPoint point)
 Tells this cell where it is placed on the worksheet.
 
void SetCurrentPoint (int x, int y)
 Tells this cell where it is placed on the worksheet.
 
wxPoint GetCurrentPoint () const
 Where is this cell placed on the worksheet?
 
bool IsBrokenIntoLines () const
 Whether this cell is broken into two or more lines.
 
bool GetSuppressMultiplicationDot () const
 Do we want to begin this cell with a center dot if it is part of a product?
 
void SetSuppressMultiplicationDot (bool val)
 
bool GetHidableMultSign () const
 Whether this is a hidable multiplication sign.
 
void SetHidableMultSign (bool val)
 
virtual void SetAltCopyText (const wxString &text)
 What should end up if placing this cell on the clipboard?
 
virtual const wxString & GetAltCopyText () const
 Get the text set using SetAltCopyText - may be empty.
 
const wxString & GetLocalToolTip () const
 
bool IsNull () const
 
bool HasControlBlock () const
 
bool HasOneCellPtr () const
 

Static Public Member Functions

static wxString TabExpand (const wxString &input_, size_t posInLine)
 Expand all tabulators.
 
static wxString EscapeHTMLChars (wxString input)
 Escape all chars that cannot be used in HTML otherwise.
 
static wxString PrependNBSP (wxString input)
 Convert all but the first of a row of multiple spaces to non-breakable.
 
static wxString OMML2RTF (wxXmlNode *node)
 Converts an OMML tag to the corresponding RTF snippet.
 
static wxString OMML2RTF (wxString ommltext)
 Converts OMML math to RTF math.
 
static wxString RTFescape (wxString, bool MarkDown=false)
 Escape a string for RTF.
 
static wxString XMLescape (wxString)
 Escape a string for XML.
 
static std::unique_ptr< CellCopyList (GroupCell *group, const Cell *cell)
 Return a copy of the given list of cells.
 
static wxString wxColor2HtmlString (wxColor col)
 
static std::unique_ptr< CellMakeVisiblyInvalidCell (GroupCell *group, Configuration *config)
 
static size_t GetLiveInstanceCount ()
 
static size_t GetLiveControlBlockInstanceCount ()
 

Protected Member Functions

void BreakUpAndMark ()
 Break up the internal cells of this cell, and mark it as broken up.
 
wxBitmap BitmapFromSVG (wxString svgData, wxSize size)
 Renders a bitmap from svgData at the requested size.
 
std::unique_ptr< CellMakeVisiblyInvalidCell () const
 
virtual size_t GetInnerCellCount () const
 The number of inner cells - for use by the iterators.
 
virtual CellGetInnerCell (size_t index) const
 Retrieve an inner cell with given index which must be less than GetInnerCellCount.
 
WorksheetGetWorksheet () const
 
CellPointersGetCellPointers () const
 

Protected Attributes

wxPoint m_currentPoint {-1, -1}
 The point in the work sheet at which this cell begins.
 
CellPtr< GroupCellm_group
 The GroupCell this list of cells belongs to.
 
CellPtr< Cellm_nextToDraw
 The next cell in the draw list. This has been factored into Cell temporarily to reduce the change "noise" when it will be subsequently removed.
 
Configurationm_configuration
 A pointer to the configuration responsible for this worksheet.
 
const wxString * m_toolTip
 This tooltip is owned by us when m_ownsToolTip is true. Otherwise, it points to a "static" string.
 
wxCoord m_height = -1
 The height of this cell.
 
wxCoord m_width = -1
 The width of this cell; is recalculated by RecalculateHeight.
 
wxCoord m_center = -1
 The distance between the top and the insertion point of this cell.
 
AFontSize m_fontSize_Scaled = {}
 The font size is smaller in super- and subscripts.
 
CellType m_type = MC_TYPE_DEFAULT
 
TextStyle m_textStyle = TS_MATH
 

Detailed Description

This class defines what the user sees as input cell.

This class handles input cells including:

Since Unicode doesn't provide us with a "soft linebreak" letter we use \r as a marker that this line has to be broken here if we don't want it to extend beyond the right margin of the screen.

In a few places we use wxString::const_iterator instead of accessing individual letters within the string using the [] operator. This might look overly complicated. But in UTF-8 all non-standard-ASCII-characters use more than one byte making iterating over every single char of the string the only way of determining which address char n is at. An iterator is the only way of not having to determine the address of every single char independently.

Todo:
Draw only tokens that are in the redraw region.

Member Function Documentation

◆ ActivateCursor()

bool EditorCell::ActivateCursor ( )

Activate the blinking cursor in this cell.

Automatically calls DeactivateCursor on an eventual cell the cursor currently is in. Normally Mathctrl::SetActiveCell() is used in order to get this function called.

Returns
true, if recalculation is needed.

◆ AddEnding()

bool EditorCell::AddEnding ( )
overridevirtual

Adds a ";" to the end of the last command in this cell in case that it doesn't end in $ or ;.

Reimplemented from Cell.

◆ BreakUp()

bool Cell::BreakUp ( )
virtualinherited

Try to split this command into lines to make it fit on the screen.

Return values
true= This cell was split into lines.

Reimplemented in AbsCell, BoxCell, ConjugateCell, DiffCell, ExptCell, FracCell, FunCell, IntCell, IntervalCell, LimitCell, ListCell, LongNumberCell, NamedBoxCell, ParenCell, SqrtCell, and SumCell.

◆ BreakUpAndMark()

void Cell::BreakUpAndMark ( )
protectedinherited

Break up the internal cells of this cell, and mark it as broken up.

Sets the cell's size to 0, as in broken up state the contents of the cell will be displayed in 1D mode while this cell won't be displayed, at all.

◆ BreakUpCells()

bool Cell::BreakUpCells ( )
inherited

Cell list: Convert 2d math objects bigger than the screen width into linear form.

Return values
true,ifthis action has changed the height of cells.

◆ CanCopy()

bool EditorCell::CanCopy ( ) const
inlineoverridevirtual

Select Can we copy the editable text of this cell?

Reimplemented from Cell.

◆ CanPopOut()

virtual bool Cell::CanPopOut ( ) const
inlinevirtualinherited

Can this cell be popped out interactively in gnuplot?

Reimplemented in AnimationCell, ImgCell, and ImgCellBase.

◆ CellsInListRecursive()

unsigned long Cell::CellsInListRecursive ( ) const
inherited

How many cells does this cell contain?

The number of cells the current group contains (-1, if no GroupCell)

◆ ClearCache()

virtual void Cell::ClearCache ( )
inlinevirtualinherited

Clears memory from cached items automatically regenerated when the cell is drawn.

The scaled version of the image will be recreated automatically once it is needed.

Reimplemented in AnimationCell, ImgCell, and ImgCellBase.

◆ ClearCacheList()

void Cell::ClearCacheList ( )
inherited

Clears the cache of the whole list of cells starting with this one.

For details see ClearCache().

◆ ContainsPoint()

bool Cell::ContainsPoint ( wxPoint  point) const
inlineinherited

Is a given point inside this cell?

Parameters
pointThe point to test for collision with this cell

◆ ContainsRect()

bool Cell::ContainsRect ( const wxRect &  sm,
bool  all = true 
) const
inherited

Is a part of this cell inside a certain rectangle?

Parameters
smThe rectangle to test for collision with this cell
all
  • true means test this cell and the ones that are following it in the list
  • false means test this cell only.

◆ Copy()

std::unique_ptr< Cell > EditorCell::Copy ( GroupCell group) const
overridevirtual

Create a copy of this cell.

This method is purely virtual, which means every child class has to define its own Copy() method.

Implements Cell.

◆ CopyToClipboard()

bool EditorCell::CopyToClipboard ( ) const
overridevirtual

Copy this cell's editable contents to the clipboard.

Only interesting for EditorCells

Reimplemented from Cell.

◆ CutToClipboard()

bool EditorCell::CutToClipboard ( )
overridevirtual

Cut this cell's editable contents to the clipboard.

Only interesting for EditorCells

Reimplemented from Cell.

◆ Draw()

void EditorCell::Draw ( wxPoint  point,
wxDC *  dc,
wxDC *  antialiassingDC 
)
overridevirtual

Draw this cell.

Draw this cell to dc.

Parameters
pointThe x and y position this cell is drawn at: All top-level cells get their position during recalculation. But for the cells within them the position needs a second step after determining the dimension of the contents of the top-level cell.

Example: The position of the denominator of a fraction can only be determined after the height of denominator and numerator are known.

To make this work each derived class must draw the content of the cell and then call MathCell::Draw(...).

Reimplemented from Cell.

◆ DrawBoundingBox()

void Cell::DrawBoundingBox ( wxDC &  WXUNUSEDdc,
bool  all = false 
)
virtualinherited

Draw a rectangle that marks this cell or this list of cells as selected.

Parameters
all
  • true: Draw the bounding box around this list of cells
  • false: Draw the bounding box around this cell only
dcThe drawing context the box is drawn in.

◆ DrawList()

void Cell::DrawList ( wxPoint  point,
wxDC *  dc,
wxDC *  adc 
)
inherited

Draw this list of cells.

Parameters
pointThe x and y position this cell is drawn at

◆ DrawThisCell()

bool Cell::DrawThisCell ( wxPoint  point)
inherited

Is this cell currently visible in the window?

Parameters
pointThe point to place this cell at

◆ FindMatchingQuotes()

bool EditorCell::FindMatchingQuotes ( )

For a given quotation mark ("), find a matching quote.

Since there are no nested quotes, an odd-numbered, non-escaped quote is an opening quote, and an even-numbered non-escaped quote is a closing quote.

Returns
true if matching quotation marks were found; false otherwise

◆ FindNext()

bool EditorCell::FindNext ( wxString  str,
const bool &  down,
const bool &  ignoreCase 
)

Finds the next occurrences of a string.

Parameters
strThe string to search for
down
  • true: search downwards
  • false: search upwards
ignoreCase
  • true: Case-insensitive search
  • false: Case-sensitive search

◆ FirstLineOnlyEditor()

bool Cell::FirstLineOnlyEditor ( )
virtualinherited

True, if this GroupCell is folded and its editor shows only its first line.

Reimplemented in GroupCell.

◆ ForceBreakLine()

void Cell::ForceBreakLine ( bool  force = true)
inlineinherited

Insert (or remove) a forced linebreak at the beginning of this cell.

Parameters
force
  • true: Insert a forced linebreak
  • false: Remove the forced linebreak

◆ GetAltCopyText()

virtual const wxString & Cell::GetAltCopyText ( ) const
inlinevirtualinherited

Get the text set using SetAltCopyText - may be empty.

Reimplemented in ExptCell, FunCell, LabelCell, SubCell, SubSupCell, SumCell, and TextCell.

◆ GetCenter()

wxCoord Cell::GetCenter ( ) const
inlineinherited

Get the distance between the top and the center of this cell.

Remember that (for example with double fractions) the center does not have to be in the middle of a cell even if this object is — by definition — center-aligned.

◆ GetCenterList()

int Cell::GetCenterList ( ) const
inherited

Returns the maximum distance between top and center of this line.

Note that the center doesn't need to be exactly in the middle of an object. For a fraction for example the center is exactly at the middle of the horizontal line.

◆ GetCurrentX()

wxCoord Cell::GetCurrentX ( ) const
inlineinherited

Get the x position of the top left of this cell.

See m_currentPoint for more details.

◆ GetCurrentY()

wxCoord Cell::GetCurrentY ( ) const
inlineinherited

Get the y position of the top left of this cell.

See m_currentPoint for more details.

◆ GetDiffPart()

wxString Cell::GetDiffPart ( ) const
virtualinherited

Get the part for diff tag support.

only ExptCell and SubSupCell override this - and this function seems to be used by fractions that represent an diff() command.

Reimplemented in ExptCell, and SubSupCell.

◆ GetDrop()

wxCoord Cell::GetDrop ( ) const
inlineinherited

Get the distance between the center and the bottom of this cell.

Remember that (for example with double fractions) the center does not have to be in the middle of an output cell even if the current object is — by definition — center-aligned.

This value is recalculated by Recalculate

◆ GetHeight()

wxCoord Cell::GetHeight ( ) const
inlineinherited

Get the height of this cell.

This value is recalculated by Recalculate()

◆ GetHeightList()

int Cell::GetHeightList ( ) const
inherited

Returns the total height of this line.

Returns GetCenterList()+GetMaxDrop()

◆ GetInfo()

const CellTypeInfo & EditorCell::GetInfo ( )
overridevirtual

Returns the information about this cell's type.

Implements Cell.

◆ GetInnerCell()

Cell * Cell::GetInnerCell ( size_t  index) const
protectedvirtualinherited

Retrieve an inner cell with given index which must be less than GetInnerCellCount.

Reimplemented in AbsCell, AtCell, BoxCell, ConjugateCell, DiffCell, ExptCell, FracCell, FunCell, GroupCell, IntCell, IntervalCell, LimitCell, ListCell, LongNumberCell, MatrCell, NamedBoxCell, ParenCell, SqrtCell, SubCell, SubSupCell, and SumCell.

◆ GetInnerCellCount()

size_t Cell::GetInnerCellCount ( ) const
protectedvirtualinherited

◆ GetInnerCellsInRect()

Cell::Range Cell::GetInnerCellsInRect ( const wxRect &  rect) const
virtualinherited

Select the cells inside this cell described by the rectangle rect.

Reimplemented in GroupCell.

◆ GetLineWidth()

int Cell::GetLineWidth ( ) const
inherited

How many pixels is the current line of this list of cells wide?

This command returns the real line width when all line breaks are really performed. See GetFullWidth().

◆ GetMaxDrop()

int Cell::GetMaxDrop ( ) const
inherited

Returns the maximum distance between center and bottom of this line.

Note that the center doesn't need to be exactly in the middle of an object. For a fraction for example the center is exactly at the middle of the horizontal line.

◆ GetNextToDraw()

Cell * Cell::GetNextToDraw ( ) const
inlineinherited

Get the next cell that needs to be drawn.

In case of potential 2d objects like fractions either the fraction needs to be drawn as a single 2D object or the nominator, the cell containing the "/" and the denominator are pointed to by GetNextToDraw() as single separate objects.

◆ GetRect()

wxRect Cell::GetRect ( bool  wholeList = false) const
virtualinherited

Get the smallest rectangle this cell fits in.

Parameters
all
  • true: Get the rectangle for this cell and the ones that follow it in the list of cells
  • false: Get the rectangle for this cell only.

Reimplemented in GroupCell.

◆ GetSuppressMultiplicationDot()

bool Cell::GetSuppressMultiplicationDot ( ) const
inlineinherited

Do we want to begin this cell with a center dot if it is part of a product?

Maxima will represent a product like (a*b*c) by a list like the following: [*,a,b,c]. This would result us in converting (a*b*c) to the following LaTeX code: \left(\cdot a ß\cdot b \cdot c\right) which obviously is one \cdot too many => we need parenthesis cells to set this flag for the first cell in their "inner cell" list.

◆ GetToolTip()

const wxString Cell::GetToolTip ( wxPoint  point) const
virtualinherited

Returns the ToolTip this cell provides at a given point.

Parameters
pointThe point in worksheet coordinates, must be inside the cell or else an empty string is returned.
Returns
the tooltip text, or empty string if none.

Reimplemented in AnimationCell, GroupCell, ImgCell, and ImgCellBase.

◆ GetValue()

const wxString & EditorCell::GetValue ( ) const
inlineoverridevirtual

Returns the text contained in this cell.

Naturally all soft line breaks are converted back to spaces beforehand.

Reimplemented from Cell.

◆ GetWidth()

int Cell::GetWidth ( ) const
inlineinherited

Get the width of this cell.

This value is recalculated by Recalculate()

◆ GnuplotSource()

virtual wxString Cell::GnuplotSource ( ) const
inlinevirtualinherited

Retrieve the gnuplot source data for this image.

wxEmptyString means: No such data.

Reimplemented in AnimationCell, ImgCell, and ImgCellBase.

◆ Hide()

virtual void Cell::Hide ( bool  hide = true)
inlinevirtualinherited

Hide this cell. See IsHidden() for details.

Reimplemented in GroupCell.

◆ IsActive()

bool EditorCell::IsActive ( ) const
overridevirtual

Is this editor cell focused?

Reimplemented from Cell.

◆ IsBrokenIntoLines()

bool Cell::IsBrokenIntoLines ( ) const
inlineinherited

Whether this cell is broken into two or more lines.

Long abs(), conjugate(), fraction and similar cells can be displayed as 2D objects, but will be displayed in their linear form (and therefore broken into lines) if they end up to be wider than the screen. In this case m_isBrokenIntoLines is true.

◆ IsComment()

bool Cell::IsComment ( ) const
inlineinherited

Determine if this cell contains text that isn't code.

Returns
true, if this is a text cell, a title cell, a section, a subsection or a sub(n)section cell.

◆ IsDirty()

bool EditorCell::IsDirty ( ) const
inlineoverridevirtual

true, if this cell's width has to be recalculated.

Reimplemented from Cell.

◆ IsEditable()

bool Cell::IsEditable ( bool  input = false) const
inlineinherited

Is this cell editable?

Editable cells include comments, code, captions and questions from maxima.

◆ IsHidden()

bool Cell::IsHidden ( ) const
inlineinherited

Whether this cell is not to be drawn.

Currently the following items fall into this category:

  • parenthesis around fractions or similar things that clearly can be recognized as atoms
  • plus signs within numbers
  • The output in folded GroupCells

Additionally folded GroupCells are marked as "hidden".

◆ IsOperator()

virtual bool Cell::IsOperator ( ) const
inlinevirtualinherited

Is this cell an operator?

Reimplemented in FracCell, and TextCell.

◆ IsShortNum()

virtual bool Cell::IsShortNum ( ) const
inlinevirtualinherited

True if this cell represents a short number.

Reimplemented in TextCell.

◆ NeedsRecalculation()

bool EditorCell::NeedsRecalculation ( AFontSize  fontSize) const
overridevirtual

True, if something that affects the cell size has changed.

Reimplemented from Cell.

◆ PasteFromClipboard()

void EditorCell::PasteFromClipboard ( bool  primary = false)
overridevirtual

Paste from the clipboard into this cell.

Parameters
primaryLinux has two clipboards: One that automatically stores all selected test and that is pasted on middle-click (true) and the traditional copy-and-paste one (false). This parameter tells which clipboard to use.

Reimplemented from Cell.

◆ PositionToPoint()

wxPoint EditorCell::PositionToPoint ( )
inlineoverridevirtual

Locates the cursor in the editable text of this cell.

Reimplemented from Cell.

◆ Recalculate()

void EditorCell::Recalculate ( AFontSize  fontsize)
overridevirtual

Recalculate the size of the cell and the difference between top and center.

Must set: m_height, m_width, m_center.

Parameters
fontsizeIn exponents, super- and subscripts the font size is reduced. This cell therefore needs to know which font size it has to be drawn at.

Reimplemented from Cell.

◆ RecalculateList()

void Cell::RecalculateList ( AFontSize  fontsize)
inherited

Recalculate both width and height of this list of cells.

Is faster than a RecalculateHeightList();RecalculateWidths();.

◆ ReplaceSelection()

bool EditorCell::ReplaceSelection ( const wxString &  oldStr,
const wxString &  newString,
bool  keepSelected = false,
bool  ignoreCase = false,
bool  replaceMaximaString = false 
)

Replace the current selection with a string.

Parameters
oldStrThe old string in the selection. If this string doesn't match the selection this function doesn't replace it.
newStringThe new string oldStr has to be replaced by
keepSelected
  • true = we want the new string to be selected afterwards
  • false = the selection is cleared after replacing the string and moving the cursor to its end.
ignoreCasetrue = ignore the case of the string to replace
replaceMaximaStringtrue = replace strings including the double quotes.

◆ ResetSize_Recursively()

void Cell::ResetSize_Recursively ( )
inherited

Mark all cached size information as "to be calculated".

Resets remembered size and position info for this cell and all cells inside it.

Resets cached data like width and the height of the current cell as well as the vertical position of the center. Then repeats this with

◆ Scale_Px() [1/2]

AFontSize Cell::Scale_Px ( AFontSize  size) const
inlineinherited

Scale font sizes and line widths according to the zoom factor.

Is used for displaying/printing/exporting of text/maths

◆ Scale_Px() [2/2]

wxCoord Cell::Scale_Px ( double  px) const
inlineinherited

Scale font sizes and line widths according to the zoom factor.

Is used for displaying/printing/exporting of text/maths

◆ SearchStartedHere()

void EditorCell::SearchStartedHere ( size_t  index) const

Remember that this is the cell the search was started in.

Parameters
indexThe index of the character the search was started at.

◆ SelectAll()

void EditorCell::SelectAll ( )
inlineoverridevirtual

Select the whole text contained in this Cell.

Reimplemented from Cell.

◆ SelectPointText()

void EditorCell::SelectPointText ( wxPoint  point)
overridevirtual

Sets the cursor to the screen coordinate point.

Reimplemented from Cell.

◆ SelectRectText()

void EditorCell::SelectRectText ( wxPoint  one,
wxPoint  two 
)
overridevirtual

Selects the text between the screen coordinates one and two.

Reimplemented from Cell.

◆ SetAltCopyText()

void Cell::SetAltCopyText ( const wxString &  text)
virtualinherited

What should end up if placing this cell on the clipboard?

AltCopyTexts for example make sense for subCells: a_n looks like a[n], even if both are lookalikes and the cell therefore needs to know what to put on the clipboard if this cell were copied. They also make sense in many other places we may never have thought about. But since we seriously want to save memory space on the ubiuitous TextCells it might be scary to apply this principle to them, at least if you know that text you copy from the internet to a terminal might contain additional commands with TextSize=0...

Reimplemented in ExptCell, FunCell, SubCell, SubSupCell, SumCell, and TextCell.

◆ SetConfiguration()

void Cell::SetConfiguration ( Configuration config)
virtualinherited

Tell this cell to use the configuration object config.

Reimplemented in AnimationCell.

◆ SetIsExponent()

void Cell::SetIsExponent ( )
virtualinherited

Tell this cell to be an exponent.

Fractions in exponents are displayed as 1D maths

Reimplemented in FracCell.

◆ SetIsExponentList()

void Cell::SetIsExponentList ( )
virtualinherited

Tell this list of cells to be an exponent.

Fractions in exponents are displayed as 1D maths

◆ SetNextToDraw() [1/2]

virtual void Cell::SetNextToDraw ( Cell next)
inlinevirtualinherited

Tells this cell which one should be the next cell to be drawn.

If the cell is displayed as 2d object this sets the pointer to the next cell.

If the cell is broken into lines this sets the pointer of the last of the list of cells this cell is displayed as.

Reimplemented in AbsCell, BoxCell, ConjugateCell, DiffCell, FracCell, FunCell, IntCell, IntervalCell, LimitCell, ListCell, LongNumberCell, NamedBoxCell, ParenCell, SqrtCell, and SumCell.

◆ SetNextToDraw() [2/2]

template<typename T , typename Del , typename std::enable_if< std::is_base_of< Cell, T >::value, bool >::type = true>
void Cell::SetNextToDraw ( const std::unique_ptr< T, Del > &  ptr)
inlineinherited

Tells this cell which one should be the next cell to be drawn.

If the cell is displayed as 2d object this sets the pointer to the next cell.

If the cell is broken into lines this sets the pointer of the last of the list of cells this cell is displayed as.

◆ SetStyle()

void EditorCell::SetStyle ( TextStyle  style)
overridevirtual

Sets the TextStyle of this cell.

Reimplemented from Cell.

◆ SetType()

void EditorCell::SetType ( CellType  type)
overridevirtual

Sets the text style according to the type.

Reimplemented from Cell.

◆ SetValue() [1/2]

void EditorCell::SetValue ( const wxString &  text)
override

Sets the text that is to be displayed.

Automatically calls StyleText().

◆ SetValue() [2/2]

virtual void Cell::SetValue ( const wxString &  WXUNUSEDtext)
inlinevirtualinherited

Allows to change the text a TextCell contains.

Todo:
Do we ever use this function?

◆ StyleText()

void EditorCell::StyleText ( )

Converts m_text to a list of styled text snippets that will later be displayed by draw().

This function also generates a wordlist for this EditorCell so Autocompletion can learn about variable names contained in lists or cells that still haven't been evaluated.

For cells containing text instead of code this function adds a \r as a marker that this line is to be broken here until the window's width changes.

◆ SwitchCaretDisplay()

void EditorCell::SwitchCaretDisplay ( )
inlineoverridevirtual

Toggles the visibility of the cursor which is used to make it blink.

Reimplemented from Cell.

◆ TabExpand()

wxString EditorCell::TabExpand ( const wxString &  input_,
size_t  posInLine 
)
static

Expand all tabulators.

Parameters
inputThe string the tabulators should be expanded in
posInLineThe number of characters that come before the input in the same line
Todo:
Implement the actual TAB expansion

◆ ToMathML()

wxString Cell::ToMathML ( ) const
virtualinherited

Convert this cell to a representation fit for saving in a .wxmx file.

Reimplemented in AbsCell, AtCell, DiffCell, ExptCell, FracCell, FunCell, IntCell, IntervalCell, LimitCell, ListCell, MatrCell, ParenCell, SqrtCell, SubCell, SubSupCell, SumCell, and TextCell.

◆ ToMatlab() [1/2]

wxString EditorCell::ToMatlab ( ) const
overridevirtual

Convert this cell to its Matlab representation.

Reimplemented from Cell.

◆ ToMatlab() [2/2]

wxString EditorCell::ToMatlab ( bool  dontLimitToSelection) const

Convert the current cell to a string.

Parameters
dontLimitToSelection
  • false: If text is selected return only the selected text
  • true: Always return all text in this text cell Convert the current cell to Matlab code

◆ ToOMML()

wxString Cell::ToOMML ( ) const
virtualinherited

Returns the cell's representation as OMML.

If this method returns wxEmptyString this might mean that this cell is better handled in RTF; The OOML can later be translated to the respective RTF maths commands using OMML2RTF.

Don't know why OMML was implemented in a world that already knows MathML, though.

Reimplemented in AbsCell, AtCell, DiffCell, ExptCell, FracCell, FunCell, IntCell, IntervalCell, LimitCell, ListCell, MatrCell, ParenCell, SqrtCell, SubCell, SubSupCell, SumCell, and TextCell.

◆ ToRTF()

wxString EditorCell::ToRTF ( ) const
overridevirtual

Convert the current cell to RTF code.

Reimplemented from Cell.

◆ ToString()

wxString EditorCell::ToString ( ) const
overridevirtual

Returns the cell's representation as a string.

Reimplemented from Cell.

◆ ToTeX()

wxString EditorCell::ToTeX ( ) const
overridevirtual

Convert the current cell to LaTeX code.

Reimplemented from Cell.

◆ ToXML()

wxString EditorCell::ToXML ( ) const
overridevirtual

Convert the current cell to XML code for inclusion in a .wxmx file.

Reimplemented from Cell.

◆ Unbreak()

void Cell::Unbreak ( )
virtualinherited

Undo breaking this cell into multiple lines.

Some cells have different representations when they contain a line break. Examples for this are fractions or a set of parenthesis.

This function tries to return a cell to the single-line form.

Reimplemented in SumCell.

◆ UnbreakList()

void Cell::UnbreakList ( )
virtualinherited

Unbreak this line.

Some cells have different representations when they contain a line break. Examples for this are fractions or a set of parenthesis.

This function tries to return a list of cells to the single-line form.

◆ VariablesAndFunctionsList()

wxString Cell::VariablesAndFunctionsList ( ) const
inherited

Returns all variable and function names used inside this list of cells.

Used for detecting lookalike chars in function and variable names.

Field Documentation

◆ m_center

wxCoord Cell::m_center = -1
protectedinherited

The distance between the top and the insertion point of this cell.

◆ m_currentPoint

wxPoint Cell::m_currentPoint {-1, -1}
protectedinherited

The point in the work sheet at which this cell begins.

The begin of a cell is defined as

  • x=the left border of the cell
  • y=the vertical center of the cell. Which (per example in the case of a fraction) might not be the physical center but the vertical position of the horizontal line between numerator and denominator.

The current point is recalculated

  • for GroupCells by GroupCell::RecalculateHeight
  • for EditorCells by it's GroupCell's RecalculateHeight and
  • for Cells when they are drawn.

◆ m_height

wxCoord Cell::m_height = -1
protectedinherited

The height of this cell.


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