24#ifndef WXMAXIMA_CELLPOINTERS_H
25#define WXMAXIMA_CELLPOINTERS_H
28#include "cells/MatrixBlock.h"
60 bool Empty()
const {
return m_errors.empty(); }
72 void Clear() { m_errors.clear(); }
75 std::vector<CellPtr<GroupCell>> m_errors;
121 bool wholeMatrix =
false) {
122 m_selectionStart = matrix;
123 m_selectionEnd = matrix;
124 m_blockMatrix = matrix;
125 m_blockAnchor = anchor;
126 m_blockCorner = corner;
127 m_blockIsWholeMatrix = wholeMatrix;
137 if (IsBlockMatrixSelected() && !m_blockIsWholeMatrix)
154 if (IsBlockMatrixSelected())
231 bool m_blockIsWholeMatrix =
false;
233 bool IsBlockMatrixSelected()
const {
234 return m_blockMatrix && (m_selectionStart == m_blockMatrix) &&
235 (m_selectionEnd == m_blockMatrix);
242 wxString m_selectionString;
244 ErrorList m_errorList;
262 void ScrollToCell(
Cell *cell) { m_cellToScrollTo = cell; }
263 Cell *CellToScrollTo() {
return m_cellToScrollTo; }
280 m_cellSearchStartedIn = {};
281 m_indexSearchStartedAt = -1;
286 {
return m_cellMouseSelectionStartedIn; }
291 { m_cellMouseSelectionStartedIn = {}; }
295 {
return m_cellKeyboardSelectionStartedIn; }
300 { m_cellKeyboardSelectionStartedIn = {}; }
302 void SetTimerIdForCell(
Cell *cell,
int timerId);
303 int GetTimerIdForCell(
Cell *cell)
const;
304 Cell *GetCellForTimerId(
int timerId)
const;
305 void RemoveTimerIdForCell(
const Cell *
const cell);
318 void WXMXResetCounter() { m_wxmxImgCounter = 0; }
319 wxString WXMXGetNewFileName();
320 std::size_t WXMXImageCount()
const {
return m_wxmxImgCounter; }
336 int m_indexSearchStartedAt = -1;
338 bool m_scrollToCell =
false;
347 CellTimerId() =
default;
348 CellTimerId(
Cell *cell,
int timerId) : cell(cell), timerId(timerId) {}
351 std::vector<CellTimerId> m_timerIds;
357 std::size_t m_wxmxImgCounter = 0;
The definition of the base class of all cells the worksheet consists of.
A weak non-owning pointer that becomes null whenever the observed object is destroyed.
Definition: CellPtr.h:539
The base class all cell types the worksheet can consist of are derived from.
Definition: Cell.h:148
A list of editor cells containing error messages.
Definition: CellPointers.h:56
void Clear()
Empty the list of GroupCells with errors.
Definition: CellPointers.h:72
void Remove(GroupCell *cell)
Remove one specific GroupCell from the list of errors.
Definition: CellPointers.cpp:104
bool Empty() const
Is the list of errors empty?
Definition: CellPointers.h:60
bool Contains(GroupCell *cell) const
Does the list of GroupCell with errors contain cell?
Definition: CellPointers.cpp:108
void Add(GroupCell *cell)
Mark this GroupCell as containing errors.
Definition: CellPointers.cpp:112
GroupCell * FirstError() const
The first GroupCell with error that is still in the list.
Definition: CellPointers.cpp:116
GroupCell * LastError() const
The last GroupCell with errors in the list.
Definition: CellPointers.cpp:120
The document-model half of the cell-pointer registry.
Definition: CellPointers.h:52
void SetSelectionEnd(Cell *cell)
Set the last cell of the selected range (may be null). Forgets any selected matrix block,...
Definition: CellPointers.h:103
TextCell * GetCurrentTextCell() const
The text cell the text maxima is currently sending us is being appended to.
Definition: CellPointers.cpp:133
const CellPtr< Cell > & GetSelectionStart() const
The first cell of the currently selected range of cells, or null. Returned by reference so callers ke...
Definition: CellPointers.h:95
void SetAnswerCell(EditorCell *cell)
Set the editor cell maxima's current question is answered in.
Definition: CellPointers.cpp:126
void ClearAnswerCell()
Forget the editor cell that held maxima's current question.
Definition: CellPointers.h:167
const CellPtr< Cell > & GetSelectionEnd() const
The last cell of the currently selected range of cells, or null.
Definition: CellPointers.h:97
void ClearActiveCell()
Forget the editor cell the text cursor was in.
Definition: CellPointers.h:182
void SetCurrentTextCell(TextCell *cell)
Set the text cell maxima's incoming text is being appended to (may be null).
Definition: CellPointers.cpp:137
void ClearSelectionString()
Forget the currently selected string.
Definition: CellPointers.h:189
GroupCell * GetLastWorkingGroup() const
The last group cell maxima was working on (regardless of the current one).
Definition: CellPointers.h:87
void ClearAnswerCellIfInGroup(GroupCell *group)
Forget the question editor if it belongs to group, e.g. because that group's output is being reset or...
Definition: CellPointers.cpp:128
EditorCell * GetAnswerCell() const
The editor cell maxima's current question is being answered in, or null.
Definition: CellPointers.cpp:124
std::optional< MatrixBlock > GetSelectedMatrixBlock() const
The selected block of a matrix's entries, if only a block is selected.
Definition: CellPointers.h:136
void SetSelectionString(const wxString &str)
Set the currently selected string.
Definition: CellPointers.h:187
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)
Definition: CellPointers.h:119
GroupCell * GetWorkingGroup(bool resortToLast=false) const
Returns the cell maxima currently works on. nullptr if there isn't such a cell.
Definition: CellPointers.cpp:151
void SetSelectionStart(Cell *cell)
Set the first cell of the selected range (may be null). Forgets any selected matrix block,...
Definition: CellPointers.h:100
bool HasCellsSelected() const
Are any whole cells (as opposed to text inside an editor) selected?
Definition: CellPointers.h:90
void SetWorkingGroup(GroupCell *group)
Sets the cell maxima currently works on. nullptr if there isn't such a cell.
Definition: CellPointers.cpp:145
ErrorList & GetErrorList()
The list of cells maxima has complained about errors in.
Definition: CellPointers.h:192
void SetActiveCell(EditorCell *cell)
Set the editor cell the blinking text cursor is in (may be null).
Definition: CellPointers.cpp:143
const wxString & GetSelectionString() const
The currently selected string, or empty.
Definition: CellPointers.h:185
std::optional< BlockCorners > GetSelectedMatrixBlockCorners() const
The corners of the selected block, even if it has grown to the whole matrix.
Definition: CellPointers.h:153
const ErrorList & GetErrorList() const
The list of cells maxima has complained about errors in (read-only view).
Definition: CellPointers.h:194
EditorCell * GetActiveCell() const
The editor cell the blinking text cursor is in, or null.
Definition: CellPointers.cpp:141
This class defines what the user sees as input cell.
Definition: EditorCell.h:62
A cell grouping input (and, if there is one, also the output) cell to a foldable item.
Definition: GroupCell.h:88
A Text cell.
Definition: TextCell.h:38
The view/interaction half of the cell-pointer registry.
Definition: CellPointers.h:258
void SetSearchStart(EditorCell *cell, int index)
Record where an incremental search started (its cell and cursor index). Out-of-line: assigning the ra...
Definition: CellPointers.cpp:79
void SetGroupCellUnderPointer(GroupCell *cell)
Set the GroupCell under the mouse pointer (may be null).
Definition: CellPointers.cpp:96
void ResetKeyboardSelectionStart()
Forget where the keyboard selection was started.
Definition: CellPointers.h:299
void ClearCellUnderPointer()
Forget which cell was under the mouse pointer.
Definition: CellPointers.h:316
void SetMouseSelectionStart(EditorCell *cell)
Record the EditorCell a mouse selection started in (out-of-line: see above).
Definition: CellPointers.cpp:84
const CellPtr< EditorCell > & MouseSelectionStart() const
The EditorCell a mouse selection was started in, or null.
Definition: CellPointers.h:285
void ResetSearchStart()
Forget where the search was started.
Definition: CellPointers.h:278
void ResetMouseSelectionStart()
Forget where the mouse selection was started.
Definition: CellPointers.h:290
int IndexSearchStartedAt() const
The cursor position an incremental search was started at (-1 = none).
Definition: CellPointers.h:273
GroupCell * GetGroupCellUnderPointer() const
The GroupCell currently under the mouse pointer, or null.
Definition: CellPointers.cpp:92
bool ScrollToCellScheduled() const
Is a scroll to CellToScrollTo() currently scheduled?
Definition: CellPointers.h:266
const CellPtr< EditorCell > & KeyboardSelectionStart() const
The EditorCell a keyboard selection was started in, or null.
Definition: CellPointers.h:294
void SetCellUnderPointer(Cell *cell)
Set the cell under the mouse pointer (may be null).
Definition: CellPointers.h:314
void SetKeyboardSelectionStart(EditorCell *cell)
Record the EditorCell a keyboard selection started in (out-of-line: see above).
Definition: CellPointers.cpp:88
Cell * GetCellUnderPointer() const
The cell currently under the mouse pointer, or null.
Definition: CellPointers.h:312
const CellPtr< EditorCell > & SearchStart() const
The EditorCell an incremental search was started in, or null.
Definition: CellPointers.h:271
void SetScrollToCellScheduled(bool scheduled)
Schedule (or cancel) scrolling to CellToScrollTo().
Definition: CellPointers.h:268
The two corners of a selected block: the anchor first, then the moving one.
Definition: CellPointers.h:143
static MatrixBlock Spanning(const MatrixEntry &a, const MatrixEntry &b)
The smallest block holding both entries: the rectangle they are corners of.
Definition: MatrixBlock.h:62
One entry of a matrix, by its zero-based row and column.
Definition: MatrixBlock.h:30