wxMaxima
Loading...
Searching...
No Matches
Data Structures | Public Member Functions
DocumentCellPointers Class Reference

The document-model half of the cell-pointer registry. More...

#include <CellPointers.h>

Data Structures

struct  BlockCorners
 The two corners of a selected block: the anchor first, then the moving one. More...
 
class  ErrorList
 A list of editor cells containing error messages. More...
 

Public Member Functions

GroupCell * GetWorkingGroup (bool resortToLast=false) const
 Returns the cell maxima currently works on. nullptr if there isn't such a cell.
 
void SetWorkingGroup (GroupCell *group)
 Sets the cell maxima currently works on. nullptr if there isn't such a cell.
 
GroupCell * GetLastWorkingGroup () const
 The last group cell maxima was working on (regardless of the current one).
 
bool HasCellsSelected () const
 Are any whole cells (as opposed to text inside an editor) selected?
 
const CellPtr< Cell > & GetSelectionStart () const
 The first cell of the currently selected range of cells, or null. Returned by reference so callers keep the CellPtr conveniences (CastAs<>, auto-nulling) without a raw-pointer copy.
 
const CellPtr< Cell > & GetSelectionEnd () const
 The last cell of the currently selected range of cells, or null.
 
void SetSelectionStart (Cell *cell)
 Set the first cell of the selected range (may be null). Forgets any selected matrix block, see SetSelectedMatrixBlock().
 
void SetSelectionEnd (Cell *cell)
 Set the last cell of the selected range (may be null). Forgets any selected matrix block, see SetSelectedMatrixBlock().
 
void SetSelectedMatrixBlock (Cell *matrix, const MatrixEntry &anchor, const MatrixEntry &corner, bool wholeMatrix=false)
 Narrow the selection to a block of one matrix's entries (GH #2345)
 
std::optional< MatrixBlock > GetSelectedMatrixBlock () const
 The selected block of a matrix's entries, if only a block is selected.
 
std::optional< BlockCorners > GetSelectedMatrixBlockCorners () const
 The corners of the selected block, even if it has grown to the whole matrix.
 
EditorCell * GetAnswerCell () const
 The editor cell maxima's current question is being answered in, or null.
 
void SetAnswerCell (EditorCell *cell)
 Set the editor cell maxima's current question is answered in.
 
void ClearAnswerCell ()
 Forget the editor cell that held maxima's current question.
 
void ClearAnswerCellIfInGroup (GroupCell *group)
 Forget the question editor if it belongs to group, e.g. because that group's output is being reset or the group is going away.
 
TextCell * GetCurrentTextCell () const
 The text cell the text maxima is currently sending us is being appended to.
 
void SetCurrentTextCell (TextCell *cell)
 Set the text cell maxima's incoming text is being appended to (may be null).
 
EditorCell * GetActiveCell () const
 The editor cell the blinking text cursor is in, or null.
 
void SetActiveCell (EditorCell *cell)
 Set the editor cell the blinking text cursor is in (may be null).
 
void ClearActiveCell ()
 Forget the editor cell the text cursor was in.
 
const wxString & GetSelectionString () const
 The currently selected string, or empty.
 
void SetSelectionString (const wxString &str)
 Set the currently selected string.
 
void ClearSelectionString ()
 Forget the currently selected string.
 
ErrorList & GetErrorList ()
 The list of cells maxima has complained about errors in.
 
const ErrorList & GetErrorList () const
 The list of cells maxima has complained about errors in (read-only view).
 

Detailed Description

The document-model half of the cell-pointer registry.

These pointers describe the edited document itself: what is selected, which editor is active or answering maxima's question, which text cell maxima's incoming output is appended to, which group cell maxima is working on, and which group cells hold errors. None of them depend on how the document is displayed, so this half will eventually be owned by WorksheetDocument.

Every stored pointer is a CellPtr, which auto-nulls when its cell is destroyed, so a stale reference reads as null instead of dangling.

Member Function Documentation

◆ GetSelectedMatrixBlock()

std::optional< MatrixBlock > DocumentCellPointers::GetSelectedMatrixBlock ( ) const
inline

The selected block of a matrix's entries, if only a block is selected.

Valid only while the selection is exactly the matrix the block was chosen in. Changing the selection in any way forgets the block, so a matrix selected later – or the same one, selected as a whole – never picks up a stale one.

◆ GetSelectedMatrixBlockCorners()

std::optional< BlockCorners > DocumentCellPointers::GetSelectedMatrixBlockCorners ( ) const
inline

The corners of the selected block, even if it has grown to the whole matrix.

What the keyboard needs in order to grow or shrink the block (GH #2370). Valid under the same condition as GetSelectedMatrixBlock(), except that it is also returned while the block covers the whole matrix.

◆ GetWorkingGroup()

GroupCell * DocumentCellPointers::GetWorkingGroup ( bool  resortToLast = false) const

Returns the cell maxima currently works on. nullptr if there isn't such a cell.

Parameters
resortToLasttrue = if we already have set the cell maxima works on to nullptr use the last cell maxima was known to work on.

◆ SetSelectedMatrixBlock()

void DocumentCellPointers::SetSelectedMatrixBlock ( Cell *  matrix,
const MatrixEntry &  anchor,
const MatrixEntry &  corner,
bool  wholeMatrix = false 
)
inline

Narrow the selection to a block of one matrix's entries (GH #2345)

Selects matrix – which must be a MatrCell – and remembers that only the block with the corners anchor and corner is meant. Every copy of the selection then copies just that sub-matrix.

The anchor is the corner that stays put: where a drag started. The other corner is the one Shift+arrow keys move (GH #2370).

Parameters
wholeMatrixtrue if the block covers every entry. The selection is then an ordinary whole-matrix one – GetSelectedMatrixBlock() returns nothing – but the corners are still remembered, so the keyboard can shrink it back into a block.

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