wxMaxima
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
GroupCell Class Referencefinal

#include <GroupCell.h>

Inheritance diagram for GroupCell:
Inheritance graph
[legend]
Collaboration diagram for GroupCell:
Collaboration graph
[legend]

Public Member Functions

 GroupCell (Configuration **config, GroupType groupType, const wxString &initString={})
 
 GroupCell (GroupCell const &cell)
 
 GroupCell (GroupCell *group, const GroupCell &cell)
 
std::unique_ptr< CellCopy () const
 
std::unique_ptr< CellCopy (GroupCell *group) const override
 
const CellTypeInfoGetInfo () override
 Returns the information about this cell's type.
 
std::unique_ptr< GroupCellCopyList () const
 
GroupCellfirst () const
 
GroupCelllast () const
 
const wxString & GetAnswer (int answer) const
 
const wxString & GetAnswer (const wxString &question) const
 
bool ContainsSavedAnswers ()
 Does this GroupCell know the answer to any of maxima's questions?
 
bool AutoAnswer () const
 Does this GroupCell save the answer to a question?
 
void SetAutoAnswer (bool autoAnswer)
 
void MarkNeedsRecalculate ()
 
void SetAnswer (const wxString &question, const wxString &answer)
 Add a new answer to the cell.
 
int GetInnerCellCount () const override
 The number of inner cells - for use by the iterators.
 
CellGetInnerCell (int index) const override
 
GroupCellGetLastWorkingGroup () const
 
void CellUnderPointer (GroupCell *cell)
 
const wxString & GetToolTip (wxPoint point) const override
 
GroupType GetGroupType () const
 
void SetGroupType (GroupType type)
 
Range GetInnerCellsInRect (const wxRect &rect) const override
 Select the cells inside this cell described by the rectangle rect.
 
Range GetCellsInOutput () const
 
Range GetCellsInOutputRect (const wxRect &rect, wxPoint one, wxPoint two) const
 
bool SetEditableContent (const wxString &text)
 
void AppendOutput (std::unique_ptr< Cell > &&cell)
 
void RemoveOutput ()
 
AFontSize EditorFontSize () const
 
void UpdateConfusableCharWarnings ()
 GroupCells warn if they contain both greek and latin lookalike chars.
 
wxString ToTeX (wxString imgDir, wxString filename, int *imgCounter) const
 
wxString ToRTF () const override
 
wxString ToTeXCodeCell (wxString imgDir, wxString filename, int *imgCounter) const
 
wxString ToTeX () const override
 Convert this cell to its LaTeX representation.
 
wxString ToXML () const override
 Convert this cell to a representation fit for saving in a .wxmx file.
 
void Hide (bool hide) override
 
void SwitchHide ()
 
wxRect HideRect ()
 
void SetInput (std::unique_ptr< Cell > &&input)
 
void SetOutput (std::unique_ptr< Cell > &&output)
 
void AppendInput (std::unique_ptr< Cell > &&cell)
 
GroupCellGetPrevious () const
 Get the previous GroupCell in the list.
 
GroupCellGetNext () const
 Get the next GroupCell in the list.
 
CellGetPrompt () const
 
EditorCellGetEditable () const
 
CellGetLabel () const
 
CellGetOutput () const
 
wxRect GetOutputRect () const
 Determine which rectangle is occupied by this GroupCell.
 
void Recalculate (AFontSize WXUNUSED(fontsize)) override
 
void Recalculate ()
 
wxPoint CalculateInputPosition ()
 
void RecalculateInput ()
 Recalculate the height of the input part of the cell.
 
wxRect GetRect (bool all=false) const override
 
void RecalculateOutput ()
 
bool BreakUpCells (Cell *cell)
 
bool UnBreakUpCells (Cell *cell)
 Undo a BreakUpCells.
 
void BreakLines ()
 Break this cell into lines.
 
void ResetInputLabel ()
 
void ResetInputLabelList ()
 Call ResetInputLabel() on all cells in the list of cells this GroupCell starts with.
 
bool IsMainInput (Cell *active) const
 
bool IsHeading () const
 
bool SectioningCanMoveIn () const
 Can this chapter/section/... converted to a 'smaller' cell, e.g. section->subsection, paragraph->subparagraph, ...?
 
bool SectioningCanMoveOut () const
 Can this chapter/section/... converted to a 'larger' cell, e.g. subsection->section, subparagraph->paragraph, ...?
 
GroupCellSectioningUnitGetEndOf () const
 Get the end of this section/subsection/...
 
void Number (int &section, int &subsection, int &subsubsection, int &heading5, int &heading6, int &image) const
 Return this cell's section- or image number.
 
void Draw (wxPoint point) override
 
bool AddEnding () override
 
void DrawBracket ()
 Draw the bracket of this cell.
 
bool Empty () const
 Is this list of cells empty?
 
bool Contains (GroupCell *cell) const
 Does this tree contain the cell "cell"?
 
wxString ToString () const override
 A textual representation of this cell.
 
void InEvaluationQueue (bool inQueue)
 Is this cell part of the evaluation Queue?
 
void LastInEvaluationQueue (bool last)
 Is this cell the last cell in the evaluation Queue?
 
void OnSize ()
 Called on MathCtrl resize.
 
void InputHeightChanged ()
 Reset the data when the input size changes.
 
 WX_DECLARE_STRING_HASH_MAP (wxString, StringHash)
 
void UpdateYPosition ()
 Recalculate the cell's y position using the position and height of the last one.
 
void UpdateOutputPositions ()
 
void UpdateYPositionList ()
 
bool GetSuppressTooltipMarker () const
 
void SetSuppressTooltipMarker (bool suppress)
 
bool IsFoldable () const
 folding and unfolding More...
 
GroupCellGetHiddenTree () const
 Get the tree of cells that got hidden by folding this cell.
 
bool HideTree (std::unique_ptr< GroupCell > &&tree)
 
std::unique_ptr< GroupCellUnhideTree ()
 Unfold the current cell.
 
bool RevealHidden ()
 
void SetHiddenTreeParent (GroupCell *parent)
 Set the parent cell of hidden cells. More...
 
GroupCellFold ()
 
GroupCellUnfold ()
 
GroupCellFoldAll ()
 
GroupCellUnfoldAll ()
 
bool IsLesserGCType (GroupType comparedTo) const
 
- Public Member Functions inherited from Cell
 Cell (GroupCell *group, Configuration **config)
 
int Scale_Px (double px) const
 
AFontSize Scale_Px (AFontSize size) const
 
virtual ~Cell ()
 Delete this list of cells.
 
int CellsInListRecursive () const
 How many cells does this cell contain? More...
 
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?
 
bool SoftLineBreak (bool breakLine=true)
 Do we want this cell to start with a linebreak?
 
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 ()
 
bool ContainsRect (const wxRect &sm, bool all=true) const
 
bool ContainsPoint (wxPoint point) const
 
virtual void ClearCache ()
 
void ClearCacheList ()
 
void SetConfigurationList (Configuration **config)
 
virtual void SetConfiguration (Configuration **config)
 
ConfigurationGetConfiguration ()
 
void Draw ()
 
void DrawList (wxPoint point)
 
void DrawList ()
 
virtual void DrawBoundingBox (wxDC &WXUNUSED(dc), bool all=false)
 
bool DrawThisCell (wxPoint point)
 
bool DrawThisCell ()
 
void ForceBreakLine (bool force=true)
 
int GetHeight () const
 
int GetWidth () const
 
int GetCenter () const
 
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?
 
int GetDrop () const
 
CellType GetType () const
 
int GetMaxDrop () const
 
int GetCenterList () const
 
int GetHeightList () const
 
int GetFullWidth () const
 How many pixels is this list of cells wide, if we don't break it into lines?
 
int GetLineWidth () const
 
int GetCurrentX () const
 
int GetCurrentY () const
 
virtual wxString GetDiffPart () const
 
virtual void Recalculate (AFontSize fontsize)
 
void RecalculateList (AFontSize fontsize)
 
void FontsChangedList ()
 Tell a whole list of cells that their fonts have changed.
 
void ClearNeedsToRecalculateWidths ()
 
void ResetData ()
 Mark all cached size information as "to be calculated". More...
 
void ResetDataList ()
 
void ResetSize ()
 Mark the cached height and width information as "to be calculated".
 
void ResetCellListSizes ()
 Mark the line and cell list widths and heights as "to be calculated".
 
void ResetCellListSizesList ()
 Mark the line and cell list widths and heights as "to be calculated".
 
void SetZeroSize ()
 
void ResetSizeList ()
 Mark the cached height information of the whole list of cells as "to be calculated".
 
void SetBigSkip (bool skip)
 
bool HasBigSkip () const
 
virtual void SetType (CellType type)
 Sets the text style according to the type.
 
TextStyle GetStyle () const
 
void SetPen (double lineWidth=1.0) const
 Sets the drawing pen to the cell's default foreground color.
 
void SetBrush () 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 SetExponentFlag ()
 
virtual void SetValue (const wxString &WXUNUSED(text))
 
virtual const wxString & GetValue () 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
 
Range GetListCellsInRect (const wxRect &rect) const
 
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
 
GroupCellGetGroup () const
 Returns the group cell this cell belongs to.
 
virtual wxString ListToString () const
 Returns the list's representation as a string.
 
wxString VariablesAndFunctionsList () const
 
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
 
virtual wxString ToMatlab () const
 Convert this cell to its Matlab representation.
 
virtual wxString ToMathML () const
 Convert this cell to a representation fit for saving in a .wxmx file.
 
virtual void Unbreak ()
 
virtual void UnbreakList ()
 
CellGetPrevious () const
 
CellGetNext () const
 Get the next cell in the list.
 
CellGetNextToDraw () const
 
virtual void SetNextToDraw (Cell *next)
 
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)
 
bool IsComment () const
 
bool IsHidden () const
 
bool IsEditable (bool input=false) const
 
virtual bool CanPopOut () const
 Can this cell be popped out interactively in gnuplot?
 
virtual wxString GnuplotSource () const
 
virtual void ProcessEvent (wxKeyEvent &WXUNUSED(event))
 Processes a key event.
 
virtual void SelectPointText (wxPoint point)
 
virtual void SelectRectText (wxPoint one, wxPoint two)
 
virtual void PasteFromClipboard (bool primary=false)
 
virtual bool CopyToClipboard () const
 
virtual bool CutToClipboard ()
 
virtual void SelectAll ()
 
virtual bool CanCopy () const
 
virtual wxPoint PositionToPoint (int WXUNUSED(pos)=-1)
 
virtual bool IsDirty () const
 
virtual void SwitchCaretDisplay ()
 
virtual void SetFocus (bool WXUNUSED(focus))
 
void SetForeground ()
 Sets the foreground color.
 
virtual bool IsActive () const
 
virtual void SetStyle (TextStyle style)
 Sets the TextStyle of this cell.
 
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 (wxString &&toolTip)
 Set the tooltip to a given temporary string - the cell will move from it.
 
void SetToolTip (const wxString *tooltip)
 
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
 
bool GetSuppressMultiplicationDot () const
 
void SetSuppressMultiplicationDot (bool val)
 
bool GetHidableMultSign () const
 Whether this is a hidable multiplication sign.
 
void SetHidableMultSign (bool val)
 
virtual void SetAltCopyText (const wxString &text)
 
virtual const wxString & GetAltCopyText () const
 Get the text set using SetAltCopyText - may be empty.
 
const wxString & GetLocalToolTip () const
 
- Public Member Functions inherited from Observed
bool IsNull () const
 
bool HasControlBlock () const
 
bool HasOneCellPtr () const
 

Static Public Member Functions

static wxString ToTeXImage (Cell *tmp, wxString imgDir, wxString filename, int *imgCounter)
 
static wxString TexEscapeOutputCell (wxString Input)
 
- Static Public Member Functions inherited from Cell
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 std::unique_ptr< CellMakeVisiblyInvalidCell (GroupCell *group, Configuration **config)
 
- Static Public Member Functions inherited from Observed
static size_t GetLiveInstanceCount ()
 
static size_t GetLiveControlBlockInstanceCount ()
 

Public Attributes

StringHash m_knownAnswers
 A list of answers provided by the user.
 

Protected Member Functions

bool NeedsRecalculation (AFontSize fontSize) const override
 True, if something that affects the cell size has changed.
 
int GetInputIndent ()
 
int GetLineIndent (Cell *cell)
 
void UpdateCellsInGroup ()
 
void InitBitFields ()
 
- Protected Member Functions inherited from Cell
void BreakUpAndMark ()
 Break up the internal cells of this cell, and mark it as broken up.
 
std::unique_ptr< CellMakeVisiblyInvalidCell () const
 
WorksheetGetWorksheet () const
 
virtual void FontsChanged ()
 To be called if the font has changed.
 
CellPointersGetCellPointers () const
 
void InvalidateMaxDrop ()
 

Protected Attributes

wxRect m_outputRect {-1, -1, 0, 0}
 
CellPointers *const m_cellPointers = GetCellPointers()
 
std::unique_ptr< GroupCellm_hiddenTree
 here hidden (folded) tree of GCs is stored
 
GroupCellm_hiddenTreeParent = {}
 store linkage to the parent of the fold
 
std::unique_ptr< Cellm_inputLabel
 The input label of this cell. Is followed by the input of the cell.
 
std::unique_ptr< Cellm_output
 The maxima output this cell contains.
 
int m_labelWidth_cached = 0
 
int m_inputWidth
 
int m_inputHeight
 
int16_t m_cellsInGroup = 1
 The number of cells the current group contains (-1, if no GroupCell)
 
int16_t m_numberedAnswersCount = 0
 
AFontSize m_mathFontSize
 
GroupType m_groupType = {}
 Which type this cell is of?
 
bool m_autoAnswer: 1
 Does this GroupCell automatically fill in the answer to questions?
 
bool m_inEvaluationQueue: 1
 
bool m_lastInEvaluationQueue: 1
 
bool m_updateConfusableCharWarnings: 1
 
bool m_suppressTooltipMarker: 1
 Suppress the yellow ToolTip marker?
 
bool m_cellsAppended: 1
 
- Protected Attributes inherited from Cell
wxPoint m_currentPoint {-1, -1}
 
CellPtr< GroupCellm_group
 
CellPtr< Cellm_nextToDraw
 
Configuration ** m_configuration
 
const wxString * m_toolTip
 
int m_height = -1
 The height of this cell.
 
int m_width = -1
 The width of this cell; is recalculated by RecalculateHeight.
 
int m_center = -1
 
AFontSize m_fontSize_Scaled = {}
 The font size is smaller in super- and subscripts.
 
CellType m_type = MC_TYPE_DEFAULT
 
TextStyle m_textStyle = TS_DEFAULT
 

Static Protected Attributes

static wxString m_lookalikeChars
 

Detailed Description

A cell grouping input (and, if there is one, also the output) cell to a foldable item

Items where a list of groupcells can be folded include

This GroupCell stores the currently hidden cells in the GroupCell m_hiddenTree. This tree has the parent m_hiddenTreeParent.

232 bytes

Member Function Documentation

◆ AddEnding()

bool GroupCell::AddEnding ( )
overridevirtual

Add a semicolon to a code cell, if needed.

Defined in GroupCell and EditorCell

Reimplemented from Cell.

◆ BreakUpCells()

bool GroupCell::BreakUpCells ( Cell cell)

Attempt to split math objects that are wider than the screen into multiple lines.

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

◆ CellUnderPointer()

void GroupCell::CellUnderPointer ( GroupCell cell)

Marks the cell that is under the mouse pointer.

Is kept in GroupCell so every GroupCell can decide it is no more under the pointer once it has been deleted from the worksheet.

◆ Copy()

std::unique_ptr<Cell> GroupCell::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.

◆ Draw()

void GroupCell::Draw ( wxPoint  point)
overridevirtual

Draw this GroupCell

Also assigns all output cells contained in this GroupCell a y coordinate.

Attention
The height the output has needs to be in sync with the height calculation done during RecalculateAppended() and during RecalculateOutput().
The y position used here must be in sync with the one calculated by RecalculateOutput().

Reimplemented from Cell.

◆ Fold()

GroupCell * GroupCell::Fold ( )

Fold this cell

Returns
the cell's address if folding was successful, else NULL

◆ FoldAll()

GroupCell * GroupCell::FoldAll ( )

Fold all cells

Returns
the cell's address if folding was successful, else NULL

◆ GetInnerCell()

Cell* GroupCell::GetInnerCell ( int  index) const
inlineoverridevirtual

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

Reimplemented from Cell.

◆ GetLabel()

Cell* GroupCell::GetLabel ( ) const
inline

Returns the list of cells the output consists of, starting with the label.

See also GetOutput();

◆ GetLastWorkingGroup()

GroupCell * GroupCell::GetLastWorkingGroup ( ) const

Which GroupCell was the last maxima was working on?

Must be kept in GroupCell as on deletion a GroupCell will unlink itself from this pointer.

◆ GetOutput()

Cell* GroupCell::GetOutput ( ) const
inline

Returns the list of cells the output consists of, starting after the label.

See also GetLabel()

◆ GetRect()

wxRect GroupCell::GetRect ( bool  all = false) const
overridevirtual

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 from Cell.

◆ GetToolTip()

const wxString & GroupCell::GetToolTip ( wxPoint  point) const
overridevirtual

Returns the tooltip for the element at the position point.

wxEmptyString means: No toolTip.

Reimplemented from Cell.

◆ HideTree()

bool GroupCell::HideTree ( std::unique_ptr< GroupCell > &&  tree)

Fold the current cell

Returns
  • false, if the cell already was folded when this function was called
  • true, if the cell was folded by this function call.

◆ IsFoldable()

bool GroupCell::IsFoldable ( ) const

folding and unfolding

Is this cell foldable?

◆ IsLesserGCType()

bool GroupCell::IsLesserGCType ( GroupType  comparedTo) const

Document structure: Can this cell type be part of the contents of comparedTo?

For example ordinary text cells can be part of a chapter and sections can be part of a chapter, too.

◆ Recalculate()

void GroupCell::Recalculate ( AFontSize   WXUNUSEDfontsize)
inlineoverride

Recalculates the size of this GroupCell and all cells inside it if needed.

This command will also assign the GroupCell a y coordinate it is plotted at. The y coordinate of all output cells of this GroupCell is assigned during GroupCell::Draw() by providing Cell::Draw() with the cell's coordinates.

◆ RecalculateOutput()

void GroupCell::RecalculateOutput ( )

Recalculate the height of the output part of the cell

Attention
Needs to be in sync with the height calculation done during Draw() and during RecalculateAppended.

◆ RemoveOutput()

void GroupCell::RemoveOutput ( )

Remove all output cells attached to this one

If called on an image cell it will not remove the image attached to it (even if the image technically is the first output cell attached to an image cell) but it will remove eventual error messages attached to the image.

◆ ResetInputLabel()

void GroupCell::ResetInputLabel ( )

Reset the input label of the current cell.

Won't do nothing if the cell isn't a code cell and therefore isn't equipped with an input label.

◆ RevealHidden()

bool GroupCell::RevealHidden ( )

Unfold all that is needed to make the current cell seen

Returns
  • false, if the cell already was visible on calling this function
  • true, if cells were unfolded by this function call

Unfold a tree from the bottom up, when a hidden cell needs to be seen.

Returns
true if any cells were unfolded.

◆ SetHiddenTreeParent()

void GroupCell::SetHiddenTreeParent ( GroupCell parent)

Set the parent cell of hidden cells.

For every cell in this GroupCell, set m_hiddenTreeParent to parent. This way, the field can be used to traverse up the tree no matter which child we are on. In other words, every child knows its parent node.

◆ ToRTF()

wxString GroupCell::ToRTF ( ) const
overridevirtual

Returns the cell's representation as RTF.

If this method returns wxEmptyString this might mean that this cell is better handled in OMML.

Reimplemented from Cell.

◆ ToTeX()

wxString GroupCell::ToTeX ( wxString  imgDir,
wxString  filename,
int *  imgCounter 
) const

Convert the cell to TeX code

Parameters
imgDirThe directory eventual images should be stored in
filenameThe base filename for all images
imgCounterThe location of the counter that tells how many unique image filenames we have already generated. NULL means: This TeX export doesn't contain other GroupCells that can export images and therefore need to enumerate them.

◆ Unfold()

GroupCell * GroupCell::Unfold ( )

Unfold this cell

Returns
the last cell that was unfolded.

◆ UnfoldAll()

GroupCell * GroupCell::UnfoldAll ( )

Unfold all cells

Returns
the last unfolded cell's address if unfolding was successful, else NULL

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