39#include <wx/xml/xml.h>
40#include <wx/aui/aui.h>
41#include <wx/textfile.h>
42#include <wx/fdrepdlg.h>
48#include "CellPointers.h"
53#include "cells/ImgCell.h"
54#include "cells/ImgCellBase.h"
61#include "cells/TextCell.h"
118 { GetClientSize(width, height); }
120 {
int x, y; GetViewStart(&x, &y);
return y; }
122 { SetVirtualSize(width, height); }
125 {
const wxPoint p = GetPosition(); *x = p.x; *y = p.y; }
137 wxString m_maximaDocDir;
139 bool m_updateControls =
true;
141 bool m_scrollToCaret =
false;
145 int m_newxPosition = -1;
147 int m_newyPosition = -1;
149 double m_zoomAtGestureStart = 1.0;
151 bool m_scrollToTopOfCell =
false;
153 bool m_windowActive =
true;
155 wxRegion m_regionToRefresh;
164 bool m_fullRedrawRequested =
false;
168 static wxDataFormat m_wxmFormat;
170 static wxDataFormat m_mathmlFormat;
172 static wxDataFormat m_mathmlFormat2;
174 static wxDataFormat m_rtfFormat;
176 static wxDataFormat m_rtfFormat2;
180 class MathMLDataObject :
public wxCustomDataObject
183 explicit MathMLDataObject(
const wxString &data);
188 wxCharBuffer m_databuf;
192 class wxmDataObject :
public wxCustomDataObject
195 explicit wxmDataObject(
const wxString &data);
200 wxCharBuffer m_databuf;
203 class MathMLDataObject2 :
public wxCustomDataObject
206 explicit MathMLDataObject2(
const wxString &data);
211 wxCharBuffer m_databuf;
216 class RtfDataObject :
public wxCustomDataObject
219 explicit RtfDataObject(
const wxString &data);
224 wxCharBuffer m_databuf;
227 class RtfDataObject2 :
public wxCustomDataObject
230 explicit RtfDataObject2(
const wxString &data);
235 wxCharBuffer m_databuf;
239 bool m_hasFocus =
true;
243 long m_lastBottom = 0;
349 bool m_scrolledAwayFromEvaluation =
false;
356 CLICK_TYPE_GROUP_SELECTION,
357 CLICK_TYPE_INPUT_SELECTION,
358 CLICK_TYPE_INPUT_LABEL_SELECTION,
359 CLICK_TYPE_OUTPUT_SELECTION
371 std::unique_ptr<Cell>
CopySelection(
bool asData =
false)
const;
387 void OnTimer(wxTimerEvent &event);
389#if wxCHECK_VERSION(3, 1, 1)
391 void OnZoom(wxZoomGestureEvent &event);
394 void OnMouseExit(wxMouseEvent &event);
396 void OnMouseEnter(wxMouseEvent &event);
410 void OnPaint(wxPaintEvent &event);
425 void OnSize(wxSizeEvent &event);
427 void OnMouseRightDown(wxMouseEvent &event);
429 void OnSidebarKey(wxCommandEvent &event);
431 void OnMouseLeftUp(wxMouseEvent &event);
436 void OnMouseLeftDown(wxMouseEvent &event);
438 void OnMouseLeftInGcCell(wxMouseEvent &event,
GroupCell *clickedInGC);
440 void OnMouseLeftInGcLeft(wxMouseEvent &event,
GroupCell *clickedInGC);
442 void OnMouseLeftInGc(wxMouseEvent &event,
GroupCell *clickedInGC);
444 void OnMouseMotion(wxMouseEvent &event);
483 void SelectGroupCells(wxPoint down, wxPoint up);
493 void CheckUnixCopy();
495 void OnMouseMiddleUp(wxMouseEvent &event);
497 static bool IsLesserGCType(
int type,
int comparedTo);
516 wxPoint m_leftDownPosition;
519 wxPoint m_mousePoint;
528 bool m_leftDown =
false;
530 bool m_followEvaluation =
true;
531 bool m_mouseDrag =
false;
532 bool m_mouseOutside =
false;
538 int m_clickType = CLICK_TYPE_NONE;
541 bool m_blinkDisplayCaret =
true;
543 bool m_hCaretBlinkVisible =
true;
547 wxTimer m_caretTimer;
550 std::vector<wxString> m_completions;
551 bool m_autocompleteTemplates =
true;
557 {
return !m_tree || (!m_tree->GetNext() && m_tree->GetEditable()->GetValue().Length() <= 1); }
561 if(m_autocompletePopup != NULL)
562 m_autocompletePopup->Destroy();
570 void OnChar(wxKeyEvent &event);
591 std::optional<Notification> m_notificationMessage;
601 void SetNotification(
const wxString &message,
int flags = wxICON_INFORMATION);
607 std::unique_ptr<GroupCell> m_tree;
611 static std::mutex m_drawDCLock;
623 void FocusFindDialogue()
649 int IndexSearchStartedAt()
const
652 CellPointers &GetCellPointers() {
return m_cellPointers; }
684 m_redrawStart = NULL;
685 m_fullRedrawRequested =
false;
740 wxString m_currentFile;
768 bool CanUndo()
const;
770 bool CanRedo()
const;
780 void TreeUndo_ClearBuffers();
792 wxPoint pos = wxDefaultPosition, wxSize size = wxDefaultSize,
793 bool reactToEvents =
true);
801 wxTimer m_keyboardInactiveTimer;
808 std::unique_ptr<GroupCell>
CopyTree()
const;
836 void InsertLine(std::unique_ptr<Cell> &&newCell,
bool forceNewLine =
false);
880 void ResetInputPrompts();
889 bool CanPaste()
const
936 void DeleteSelection();
997 void Animate(
bool run =
true)
const;
1003 void SetLastQuestion(
const wxString &lastQuestion){m_lastQuestion = lastQuestion;}
1004 wxString GetLastQuestion()
const {
return m_lastQuestion;}
1009 void PasteFromClipboard();
1017 bool Copy(
bool astext =
false)
const;
1049#if wxUSE_ENH_METAFILE
1051 bool CopyEMF()
const;
1057 wxSize CopyToFile(
const wxString &file)
const;
1059 wxSize CopyToFile(
const wxString &file,
Cell *start,
Cell *end,
bool asData =
false,
double scale = 1)
const;
1084 wxString
GetString(
bool lb =
false)
const;
1086 GroupCell *GetTree()
const {
return m_tree.get(); }
1087 std::unique_ptr<GroupCell> *GetTreeAddress() {
return &m_tree; }
1122 bool ActivatePrevInput() {
return ActivateInput(-1); }
1123 bool ActivateNextInput() {
return ActivateInput(+1); }
1124 wxString GetStatusText()
const {
return m_statusText;}
1125 bool StatusTextChangedHas() {
1126 bool retval = (m_statusTextHas != m_statusTextHas_old) ||
1127 (m_statusText != m_statusText_old);
1128 m_statusText_old = m_statusText;
1129 m_statusTextHas_old = m_statusTextHas;
1132 bool StatusTextHas()
const {
return m_statusTextHas;}
1145 wxTimer m_displayTimeoutTimer;
1147 template <
class T_SRC,
class T_DEST>
1148 inline std::unique_ptr<T_DEST> unique_cast(std::unique_ptr<T_SRC> &&src)
1150 if (!src)
return std::unique_ptr<T_DEST>();
1152 T_DEST *dest_ptr = &
dynamic_cast<T_DEST &
>(*src.get());
1154 (void) src.release();
1155 return std::unique_ptr<T_DEST>(dest_ptr);
1157 wxString m_statusText;
1158 wxString m_statusText_old;
1159 bool m_statusTextHas =
false;
1160 bool m_statusTextHas_old =
false;
1161 void StatusText(
const wxString &text){m_statusText = text; m_statusTextHas =
true;}
1162 void UnsetStatusText(){m_statusTextHas =
false;}
1163 bool ActivateInput(
int direction);
1170 m_scrollToCaret =
true;
1182 m_cellPointers.ScrollToCell(cell);
1183 m_scrollToTopOfCell = scrollToTop;
1184 m_scrollToCaret =
false;
1279 void UndoInsideCell();
1287 void RedoInsideCell();
1302 {
return m_followEvaluation; }
1309 void ScrolledAwayFromEvaluation(
bool ScrolledAway);
1311 bool ScrolledAwayFromEvaluation()
const
1312 {
return m_scrolledAwayFromEvaluation; }
1316 bool IsSaved()
const
1319 void SetSaved(
bool saved)
1320 {
if(m_saved != saved) m_updateControls =
true; m_saved = saved;}
1322 void OutputChanged()
1324 if(m_currentFile.EndsWith(
".wxmx"))
1328 void RemoveAllOutput();
1343 void AddDocumentToEvaluationQueue();
1385 void SetZoomFactor(
double newzoom);
1387 void CommentSelection();
1394 void OnScrollEvent(wxScrollWinEvent &ev);
1395 void CheckIfActiveCellScrolledOut();
1407 bool FindIncremental(
const wxString &str,
bool down,
bool ignoreCase,
bool searchInInput =
true,
bool searchInOutput =
true);
1408 bool FindIncremental_RegEx(
const wxString &str,
bool down,
bool searchInInput =
true,
bool searchInOutput =
true);
1428 bool FindNext(
const wxString &str,
bool down,
bool ignoreCase,
bool searchInInput =
true,
bool searchInOutput =
true,
bool warn =
true);
1429 bool FindNext_Regex(
const wxString &str,
const bool &down,
bool searchInInput =
true,
bool searchInOutput =
true,
bool warn =
true);
1435 void Replace(
const wxString &oldString,
const wxString &newString,
bool ignoreCase);
1436 void Replace_RegEx(
const wxString &oldString,
const wxString &newString);
1442 int ReplaceAll(
const wxString &oldString,
const wxString &newString,
bool ignoreCase,
bool searchInInput =
true,
bool searchInOutput =
true);
1443 int ReplaceAll_RegEx(
const wxString &oldString,
const wxString &newString,
bool searchInInput =
true,
bool searchInOutput =
true);
1445 wxString GetInputAboveCaret();
1447 wxString GetOutputAboveCaret();
1456 { m_autocomplete.
AddSymbol(fun, type); }
1465 void SetActiveCellText(
const wxString &text);
1467 bool InsertText(
const wxString &text);
1469 void OpenNextOrCreateCell();
1490 bool m_questionPrompt =
false;
1498 {
return m_questionPrompt; }
1505 { m_questionPrompt = pending; }
1507 void SetMaximaDocDir(
const wxString &dir)
1509 m_maximaDocDir = dir;
1511 const wxString &GetMaximaDocDir()
const {
return m_maximaDocDir; }
1530 wxString GetHelpfileAnchorName(
const wxString &keyword)
1531 {
return m_maximaManual.GetHelpfileAnchorName(keyword);}
1532 wxString GetHelpfileURL(
const wxString &keyword)
1533 {
return m_maximaManual.GetHelpfileURL(keyword);}
1537#if wxUSE_ACCESSIBILITY
1538 int GetAccessibilityId(
Cell *cell)
const;
1541#if wxUSE_ACCESSIBILITY
1542 class AccessibilityInfo:
public wxAccessible
1545 AccessibilityInfo(wxWindow *parent,
Worksheet *worksheet);
1546 wxAccStatus GetName (
int childId, wxString *name);
1547 wxAccStatus GetChildCount (
int *childCount);
1548 wxAccStatus GetChild (
int childId, wxAccessible **child);
1549 wxAccStatus GetDefaultAction(
int childId, wxString *actionName);
1550 wxAccStatus GetParent (wxAccessible ** parent);
1551 wxAccStatus GetFocus (
int *childId, wxAccessible **child);
1552 wxAccStatus GetLocation (wxRect &rect,
int elementId);
1553 wxAccStatus HitTest (
const wxPoint &pt,
1554 int *childId, wxAccessible **childObject);
1555 wxAccStatus GetDescription(
int childId, wxString *description);
1556 wxAccStatus GetRole(
int childId, wxAccRole *role);
1557 wxAccStatus GetState(
int childId,
long *state);
1559 wxWindow *m_parent = NULL;
1562 class CaretAccessibilityInfo :
public wxAccessible {
1564 CaretAccessibilityInfo(AccessibilityInfo* parent,
Worksheet* worksheet)
1565 : wxAccessible(worksheet->GetTargetWindow()), m_parent(parent), m_worksheet(worksheet) {}
1567 wxAccStatus GetName(
int childId, wxString *name)
override;
1568 wxAccStatus GetDescription(
int WXUNUSED(childId), wxString *description)
override;
1569 wxAccStatus GetParent(wxAccessible **parent)
override;
1570 wxAccStatus GetChildCount(
int *childCount)
override;
1571 wxAccStatus GetChild(
int childId, wxAccessible **child)
override;
1572 wxAccStatus GetRole(
int childId, wxAccRole *role)
override;
1574 AccessibilityInfo* m_parent;
1577 CaretAccessibilityInfo* m_caretAccessible =
nullptr;
1581 MaximaManual *GetMaximaManual() {
return &m_maximaManual;}
1583 void FocusTextControl();
1584 wxString m_lastQuestion;
1587 virtual wxSize DoGetBestClientSize()
const override;
1588#if wxUSE_ACCESSIBILITY
1589 AccessibilityInfo *m_accessibilityInfo = NULL;
1601wxDECLARE_EVENT(TOC_UPDATE_NEEDED_EVENT, wxCommandEvent);
This file declares the class AnimationCell.
This file declares the class AutoComplete.
The definition of the base class of all cells the worksheet consists of.
CellType
The supported types of math cells.
Definition: Cell.h:63
@ MC_TYPE_GROUP
A group cells that bundles several individual cells together.
Definition: Cell.h:81
This file contains the definition of the class EditorCell.
This file declares the class EventIDs that contains unique IDs for many events wxMaxima needs.
This file defines the class FindReplaceDialog.
This file defines the class GroupCell that bundles input and output in the worksheet.
GroupType
All types a GroupCell can be of.
Definition: GroupCell.h:42
This file declares the class MaximaManual.
This file defines the class Notification.
The definition of the class RecentDocuments that provides a recent files mechanism that is extensible...
std::list< TreeUndoAction > UndoActions
The type of the list of tree actions that can be undone.
Definition: TreeUndoAction.h:120
Declares TreeUndoManager: the owner of the cell-tree undo/redo state.
The file that contains the "variables" sidepane.
The worksheet's "between the cells" cursor (the horizontally drawn caret).
The worksheet's layout engine: scheduling, the recalculation walk and the virtual-size update,...
The worksheet's search engine.
Definition: AnimationCell.h:46
Definition: Autocomplete.h:61
autoCompletionType
All types of things we can autocomplete.
Definition: Autocomplete.h:68
void AddSymbols(wxString xml)
Interprets the XML autocompletable symbol list maxima can send us.
Definition: Autocomplete.cpp:135
void AddSymbol(wxString fun, autoCompletionType type=command)
Manually add an autocompletable symbol to our symbols lists.
Definition: Autocomplete.cpp:647
A list of editor cells containing error messages.
Definition: CellPointers.h:70
The storage for pointers to cells.
Definition: CellPointers.h:45
ErrorList m_errorList
The list of cells maxima has complained about errors in.
Definition: CellPointers.h:93
bool m_scrollToCell
Is scrolling to a cell scheduled?
Definition: CellPointers.h:199
CellPtr< EditorCell > m_activeCell
Which EditCell the blinking cursor is in?
Definition: CellPointers.h:103
CellPtr< EditorCell > m_cellKeyboardSelectionStartedIn
The EditorCell the keyboard selection has started in.
Definition: CellPointers.h:97
void SetWorkingGroup(GroupCell *group)
Sets the cell maxima currently works on. NULL if there isn't such a cell.
Definition: CellPointers.cpp:90
CellPtr< Cell > m_selectionStart
The first cell of the currently selected range of Cells.
Definition: CellPointers.h:147
int m_indexSearchStartedAt
Which cursor position incremental search has started at?
Definition: CellPointers.h:101
CellPtr< EditorCell > m_cellMouseSelectionStartedIn
The EditorCell the mouse selection has started in.
Definition: CellPointers.h:95
CellPtr< EditorCell > m_cellSearchStartedIn
The EditorCell the search was started in.
Definition: CellPointers.h:99
CellPtr< TextCell > m_currentTextCell
The textcell the text maxima is sending us was ending in.
Definition: CellPointers.h:111
CellPtr< Cell > m_selectionEnd
The last cell of the currently selected range of Cells.
Definition: CellPointers.h:168
A weak non-owning pointer that becomes null whenever the observed object is destroyed.
Definition: CellPtr.h:511
The base class all cell types the worksheet can consist of are derived from.
Definition: Cell.h:141
GroupCell * GetGroup() const
Returns the group cell this cell belongs to.
Definition: Cell.cpp:282
CellType GetType() const
Returns the type of this cell.
Definition: Cell.h:452
The configuration storage for the current worksheet.
Definition: Configuration.h:97
void ReadConfig()
Read the config from the wxConfig object.
Definition: Configuration.cpp:581
This class defines what the user sees as input cell.
Definition: EditorCell.h:59
bool CanCopy() const override
Select Can we copy the editable text of this cell?
Definition: EditorCell.h:345
A simple FIFO queue with manual removal of elements.
Definition: EvaluationQueue.h:43
The find+replace dialog.
Definition: FindReplaceDialog.h:42
A cell grouping input (and, if there is one, also the output) cell to a foldable item.
Definition: GroupCell.h:87
Definition: ImgCellBase.h:42
Definition: MaximaManual.h:59
void LoadHelpFileAnchors(const wxString &docdir, const wxString &maximaVersion)
Search maxima's help file for command and variable names.
Definition: MaximaManual.cpp:538
A class that maintains a list of recent documents.
Definition: RecentDocuments.h:42
A Text cell.
Definition: TextCell.h:38
Owns the cell-tree undo/redo stacks and the active-cell snapshot.
Definition: TreeUndoManager.h:51
void ClearUndoActionList()
Clear the list of actions that can be undone.
Definition: TreeUndoManager.h:94
UndoActions & UndoStack()
The list of tree actions that can be undone.
Definition: TreeUndoManager.h:54
UndoActions & RedoStack()
The list of undone tree actions that can be redone.
Definition: TreeUndoManager.h:58
void ClearRedoActionList()
Clear the list of actions that can be redone.
Definition: TreeUndoManager.h:87
static void AppendAction(UndoActions *actionList)
Mark the newest action of the list as part of the following atomic action.
Definition: TreeUndoManager.h:77
The between-the-cells cursor: active flag, position, selection anchors.
Definition: WorksheetCursor.h:49
bool IsActive() const
Is this (rather than the in-cell text cursor) the active cursor?
Definition: WorksheetCursor.h:52
The layout/recalculation engine of a worksheet.
Definition: WorksheetLayout.h:54
void RequestRecalculation(Cell *start)
Schedule a recalculation of the worksheet starting with the cell start.
Definition: WorksheetLayout.cpp:136
void GetMaxPoint(int *width, int *height)
Get the coordinates of the bottom right point of the worksheet.
Definition: WorksheetLayout.cpp:178
void UpdateConfigurationClientSize()
Inform the configuration about the view's current client size.
Definition: WorksheetLayout.cpp:165
void AdjustSize()
Adjust the virtual size and scrollbars to the document's extent.
Definition: WorksheetLayout.cpp:224
bool RecalculateIfNeeded(bool timeout=false, long timeSliceMs=50)
Perform the scheduled recalculation, if one is pending.
Definition: WorksheetLayout.cpp:41
The narrow view surface the worksheet's layout pipeline needs.
Definition: WorksheetSizeMath.h:172
The canvas that contains the spreadsheet the whole program is about.
Definition: Worksheet.h:113
bool IsActiveInLast() const
Is the editor active in the last cell of the worksheet?
Definition: Worksheet.h:1231
GroupCell * ToggleFold(GroupCell *which)
Fold or unfold a cell.
Definition: Worksheet.cpp:1111
void OnTimer(wxTimerEvent &event)
Is executed if a timer associated with Worksheet has expired.
Definition: Worksheet.cpp:3363
void ClearSelection()
Clear the selection - make it empty, i.e. no selection.
Definition: Worksheet.h:1104
const wxString UnicodeToMaxima(wxString s)
Make a few unicode characters interpretable by maxima.
Definition: Worksheet.cpp:3652
bool CanMergeSelection() const
Can we merge the selected cells into one?
Definition: Worksheet.cpp:4242
void SetViewScrollRate(int rate) override
Set the scroll granularity (device pixels per scroll unit) on both axes.
Definition: Worksheet.h:123
ImgCellBase * GetSelectedImgCellBase() const
Returns the selected cell - or NULL, if the selection isn't image nor animation.
Definition: Worksheet.h:969
wxString RTFStart() const
The start of a RTF document.
Definition: Worksheet.cpp:5888
int m_pointer_x
The x position of the mouse pointer.
Definition: Worksheet.h:1592
void SetDefaultHCaret()
Set the HCaret to its default location, at the end of the document.
Definition: Worksheet.cpp:4873
bool CanDeleteRegion(GroupCell *start, const GroupCell *end) const
Is it possible to delete the cells between start and end?
Definition: Worksheet.cpp:2085
void AddSectionToEvaluationQueue(GroupCell *start)
Adds a chapter, a section or a subsection to the evaluation queue.
Definition: Worksheet.cpp:3971
void AddSymbols(const wxString &xml)
Add a xml-encoded list of symbols to the autocompletion list.
Definition: Worksheet.h:1459
void FoldAll()
Recursively folds the whole document.
Definition: Worksheet.cpp:1148
virtual ~Worksheet()
The destructor.
Definition: Worksheet.cpp:447
bool CutToClipboard()
Add the currently selected cells to the clipboard and delete them.
Definition: Worksheet.cpp:4561
void GetViewPosition(int *x, int *y) const override
The view's position within its parent, in device pixels (wxWindow::GetPosition).
Definition: Worksheet.h:124
GroupCell * GetInsertGroup() const
The group that the line's cells will belong to - used by InsertLine.
Definition: Worksheet.cpp:876
void OnCharNoActive(wxKeyEvent &event)
Key pressed and no cell was active.
Definition: Worksheet.cpp:2886
bool QuestionPending() const
Does maxima wait for the answer of a question?
Definition: Worksheet.h:1497
void AddEntireDocumentToEvaluationQueue()
Schedule all cells in the document for evaluation.
Definition: Worksheet.cpp:3962
GroupCell * FirstVisibleGC()
The first groupCell that is currently visible.
Definition: Worksheet.cpp:1474
void UpdateConfigurationClientSize()
Inform the configuration about the current client size.
Definition: Worksheet.h:1116
int ReplaceAll(const wxString &oldString, const wxString &newString, bool ignoreCase, bool searchInInput=true, bool searchInOutput=true)
Replace all occurrences of a string.
Definition: Worksheet.cpp:5337
void AddSymbols(wxXmlDocument xml)
Add a xml-encoded list of symbols to the autocompletion list.
Definition: Worksheet.h:1462
void LoadHelpFileAnchors(const wxString &docdir, const wxString &maximaVersion)
Tries to parse maxima's manual in order to find out which anchors it contains.
Definition: Worksheet.h:1528
bool ExportToHTML(const wxString &file)
Export the file to an html document.
Definition: Worksheet.cpp:3622
void OpenHCaret(const wxString &txt={})
Place the cursor into a new cell where the horizontal cursor is.
Definition: Worksheet.h:1259
TextCell * GetSelectedTextCell() const
Returns the selected cell - or NULL, if the selection isn't a text cell.
Definition: Worksheet.h:977
void ScrollToError()
Unfold the cell that produced the error, if necessary and, if requested, scroll to it.
Definition: Worksheet.cpp:826
bool HCaretActive() const
Is the vertically-drawn cursor active?
Definition: Worksheet.h:759
void OnEraseBackground(wxEraseEvent &WXUNUSED(event))
Cannot be static as it is called using a function pointer to an object.
Definition: Worksheet.h:490
void ClearDocument()
Empties the current document.
Definition: Worksheet.cpp:1005
wxString RTFEnd() const
The end of a RTF document.
Definition: Worksheet.cpp:5892
void UnfoldAll()
Recursively unfolds the whole document.
Definition: Worksheet.cpp:1158
void UpdateTableOfContents()
Update the table of contents.
Definition: Worksheet.cpp:6217
Cell * GetSelectionEnd() const
Return the last of the currently selected cells.
Definition: Worksheet.h:1100
void QuestionPending(bool pending)
Does maxima currently wait for the answer of a question?
Definition: Worksheet.h:1504
void ClickNDrag(wxPoint down, wxPoint up)
Select the rectangle surrounded by down and up.
Definition: Worksheet.cpp:1630
const wxString & GetCurrentFile() const
The name of the currently-opened file.
Definition: Worksheet.h:736
void SetCurrentFile(const wxString &file)
Set the name of the currently-opened file.
Definition: Worksheet.h:738
RecentDocuments & UnsavedDocuments()
The list of unsaved (autosaved) documents offered for recovery.
Definition: Worksheet.h:128
void DeleteCurrentCell()
Delete the currently active cell - or the cell above this one.
Definition: Worksheet.cpp:2070
AutoComplete & GetAutocomplete()
The storage for the autocompletion feature.
Definition: Worksheet.h:629
AnimationCell * GetSelectedAnimation() const
Returns the selected cell - or NULL, if the selection isn't an animation.
Definition: Worksheet.h:953
void Replace(const wxString &oldString, const wxString &newString, bool ignoreCase)
Replace the current occurrence of a string.
Definition: Worksheet.cpp:5303
bool CopyMatlab() const
Copy a Matlab representation of the current selection to the clipboard.
Definition: Worksheet.cpp:1892
bool CopyText() const
Copy a textual representation of the current selection to the clipboard.
Definition: Worksheet.cpp:1955
bool m_inPopupMenu
Is there an active popup menu?
Definition: Worksheet.h:1598
EvaluationQueue & GetEvaluationQueue()
The list of cells that have to be evaluated.
Definition: Worksheet.h:1367
void Animate(bool run=true) const
Animate the current slide show.
Definition: Worksheet.cpp:4845
static GroupCell * StartOfSectioningUnit(GroupCell *start)
Finds the start of the current chapter/section/...
Definition: Worksheet.cpp:2501
bool CopyRTF() const
Copy a rtf version of the current selection to the clipboard.
Definition: Worksheet.cpp:3509
void UpdateConfig()
Re-read the configuration.
Definition: Worksheet.h:729
int m_pointer_y
The y position of the mouse pointer.
Definition: Worksheet.h:1594
bool Copy(bool astext=false) const
Copy the current selection to the clipboard.
Definition: Worksheet.cpp:1735
bool CopyAnimation() const
Copy the current animation to the clipboard.
Definition: Worksheet.cpp:3487
void StepAnimation(int change=1)
Set the slide of the currently selected animation or advance it by one step.
Definition: Worksheet.cpp:3337
void SelectEditable(EditorCell *editor, bool up)
Is called when a hCursor is active and we have a WXK_UP/WXK_DOWN event.
Definition: Worksheet.cpp:2855
void SetAnswer(const wxString &answer)
Handling questions from and answers for maxima.
Definition: Worksheet.cpp:2235
GroupCell * ToggleFoldAll(GroupCell *which)
Toggles the status of the fold for the given GroupCell and its children.
Definition: Worksheet.cpp:1132
void OnChar(wxKeyEvent &event)
Key for a printable character pressed.
Definition: Worksheet.cpp:3221
void SelectWithChar(int ccode)
Handle selecting text using the keyboard Is called when the all of the following is true:
Definition: Worksheet.cpp:2770
void AddSelectionToEvaluationQueue()
Schedule all cells in the selection to be evaluated.
Definition: Worksheet.cpp:4000
bool CanEdit()
We can edit the input if the we have the whole input in selection!
Definition: Worksheet.cpp:3852
bool HasCellsSelected() const
Is at least one entire cell selected?
Definition: Worksheet.h:902
std::optional< Notification > & GetNotification()
The error notification message, if any.
Definition: Worksheet.h:588
void OnSetFocus(wxFocusEvent &event)
What to do if the worksheet is in the input focus.
Definition: Worksheet.cpp:4798
void SetNotification(const wxString &message, int flags=wxICON_INFORMATION)
Inform the user that something happened in a non-active window.
Definition: Worksheet.cpp:3199
void ScheduleScrollToCell(Cell *cell, bool scrollToTop=true)
Schedules scrolling to a given cell.
Definition: Worksheet.h:1180
int GetViewScrollUnitY() const override
The current vertical scroll position, in scroll units (not pixels).
Definition: Worksheet.h:119
GroupCell * InsertGroupCells(std::unique_ptr< GroupCell > &&cells, GroupCell *where, UndoActions *undoBuffer)
Insert group cells into the worksheet.
Definition: Worksheet.cpp:756
void AddDocumentTillHereToEvaluationQueue()
Schedule all cells stopping with the one the caret is in for evaluation.
Definition: Worksheet.cpp:4020
void OnComplete(wxCommandEvent &event)
Is called if an action from the autocomplete menu is selected.
Definition: Worksheet.cpp:5638
bool CanAnimate() const
Does it make sense to enable the "Play" button and the slider now?
Definition: Worksheet.h:985
bool RecalculateIfNeeded(bool timeout=false, long timeSliceMs=50)
Actually recalculate the worksheet.
Definition: Worksheet.h:856
bool m_mouseMotionWas
Was there a mouse motion we didn't react to until now?
Definition: Worksheet.h:1596
void SelectAll()
Select the whole document.
Definition: Worksheet.cpp:4721
void OnKillFocus(wxFocusEvent &event)
What to do if the worksheet looses the input focus.
Definition: Worksheet.cpp:4810
void InsertLine(std::unique_ptr< Cell > &&newCell, bool forceNewLine=false)
Add a new line to the output cell of the working group.
Definition: Worksheet.cpp:885
void ClearNotification()
Clears the notification message from SetNotification.
Definition: Worksheet.cpp:3197
void OnPaint(wxPaintEvent &event)
Is called by wxWidgets when it wants to redraw the worksheet or a part of it.
Definition: Worksheet.cpp:481
void OnFollow()
Called when the "Scroll to currently evaluated" button is pressed.
Definition: Worksheet.cpp:5822
void PrepareDrawGC(wxDC &dc) const
All that has need to be done before drawing a GroupCell in a DC.
Definition: Worksheet.cpp:632
void OnCharInActive(wxKeyEvent &event)
Key pressed inside a cell.
Definition: Worksheet.cpp:2545
Cell * GetSelectionStart() const
Return the first of the currently selected cells.
Definition: Worksheet.h:1093
void FoldOccurred()
Call when a fold action was detected, to update the state in response to a fold occurring.
Definition: Worksheet.cpp:1099
void OnMouseCaptureLost(wxMouseCaptureLostEvent &event)
Is called if we loose the mouse connection whilst selecting text/cells.
Definition: Worksheet.cpp:5896
wxTimer & KeyboardInactiveTimer()
The timer that tells us when the keyboard is inactive so an autosave isn't disrupting.
Definition: Worksheet.h:799
ClickType
An enum for all classes of items one can click on.
Definition: Worksheet.h:354
ImgCell * GetSelectedImgCell() const
Returns the selected cell - or NULL, if the selection isn't an image.
Definition: Worksheet.h:961
Cell * FindCellByUUID(const wxString &uuid)
Find a cell by its UUID.
Definition: Worksheet.cpp:4072
void EraseBackground(wxEraseEvent &event)
Is called if wxWidgets wants to erase the worksheet's background.
Definition: Worksheet.cpp:250
bool CanDeleteSelection() const
Is it possible to delete the currently selected cells?
Definition: Worksheet.cpp:2054
ToolBar * m_mainToolBar
The toolbar of the main window: We need to access it and therefore have it defined here.
Definition: Worksheet.h:1475
bool CaretVisibleIs()
Is the caret (hcaret or vcaret) currently visible on the worksheet?
Definition: Worksheet.cpp:5246
EditorCell * GetActiveCell() const
Get the currently active EditorCell.
Definition: Worksheet.h:637
bool UpdateControlsNeeded()
Is an update of the worksheet controls needed?
Definition: Worksheet.h:133
bool CopyCells() const
Copy the selection to the clipboard as it would appear in a .wxm file.
Definition: Worksheet.cpp:1984
bool OpenQuestionCaret(const wxString &txt={})
Move the cursor to the question maxima currently asks and if needed add a cell for user input.
Definition: Worksheet.cpp:2243
bool FindIncremental(const wxString &str, bool down, bool ignoreCase, bool searchInInput=true, bool searchInOutput=true)
Do an incremental search from the cursor or the point the last search started at.
Definition: Worksheet.cpp:5093
GroupCell * GetLastCell()
Returns the last cell of the worksheet.
Definition: Worksheet.h:1235
GroupCell * GetHCaret()
The cell the horizontal cursor is above. NULL means at the start of the document.
Definition: Worksheet.cpp:4856
bool IsSelected(CellType type)
Does the selection start with a cell of the type "type".
Definition: Worksheet.cpp:4836
wxString ConvertSelectionToMathML() const
Convert the current selection to MathML.
Definition: Worksheet.cpp:1816
bool CanUndoInsideCell() const
Is it possible to issue an undo in the currently selected cell?
Definition: Worksheet.cpp:4922
void SetHCaret(GroupCell *where)
Set the HCaret at the location of the given Cell.
Definition: Worksheet.cpp:4883
bool CanRedoInsideCell() const
Is it possible to issue an undo in the currently selected cell?
Definition: Worksheet.cpp:4936
bool GCContainsCurrentQuestion(const GroupCell *cell)
Does the GroupCell cell points to contain the question currently asked by maxima?
Definition: Worksheet.cpp:2473
bool IsEmpty() const
Is this worksheet empty?
Definition: Worksheet.h:556
void NumberSections() const
Renumber all sections.
Definition: Worksheet.cpp:1038
void SetViewVirtualSize(int width, int height) override
Set the scrollable (virtual) area, in device pixels.
Definition: Worksheet.h:121
void OnKeyDown(wxKeyEvent &event)
A special key has been pressed.
Definition: Worksheet.cpp:2368
EditorCell * KeyboardSelectionStart() const
Tells us which cell the keyboard selection has started in.
Definition: Worksheet.h:640
void SetSelection(Cell *sel)
Select the cell sel.
Definition: Worksheet.h:1107
void AddCellToEvaluationQueue(GroupCell *gc)
Schedule this cell for evaluation.
Definition: Worksheet.cpp:4042
void SetCellStyle(GroupCell *group, GroupType style)
Change the style of a cell.
Definition: Worksheet.cpp:2142
bool Autocomplete(AutoComplete::autoCompletionType type=AutoComplete::command)
Definition: Worksheet.cpp:5397
wxBitmap m_memory
A memory we can manually buffer the contents of the area that is to be redrawn in.
Definition: Worksheet.h:1586
void LoadSymbols()
Compile a list of known autocompletion symbols.
Definition: Worksheet.cpp:3650
void SelectGroupCell(GroupCell *cell)
Set this cell as the currently selected one.
Definition: Worksheet.cpp:5808
void ShowPoint(wxPoint point)
Scrolls to a point on the worksheet.
Definition: Worksheet.cpp:4516
void WindowActive(bool active)
Is this window active?
Definition: Worksheet.h:594
bool ExportToTeX(const wxString &file)
export to a LaTeX file
Definition: Worksheet.cpp:3644
bool IsSelectionInWorkingGroup()
Is the selection in the current working group?
Definition: Worksheet.cpp:4851
void AdjustSize()
Adjust the virtual size and scrollbars; see WorksheetLayout::AdjustSize().
Definition: Worksheet.h:487
void ShowHCaret()
Activates the horizontal cursor.
Definition: Worksheet.cpp:4915
TimerIDs
An enum of individual IDs for all timers this class handles.
Definition: Worksheet.h:364
void CodeCellVisibilityChanged()
To be called after enabling or disabling the visibility of code cells.
Definition: Worksheet.cpp:3632
void ScrollToCaret()
Request to scroll to the cursor as soon as wxMaxima is idle.
Definition: Worksheet.h:1167
void MarkRefreshAsDone()
Handle redrawing the worksheet or of parts of it.
Definition: Worksheet.h:682
bool CopyMathML() const
Copy the MathML representation of the current selection to the clipboard.
Definition: Worksheet.cpp:1865
bool CopyBitmap() const
Copy a bitmap of the current selection to the clipboard.
Definition: Worksheet.cpp:3480
void GetViewClientSize(int *width, int *height) const override
The visible client area, in device pixels.
Definition: Worksheet.h:117
bool PointVisibleIs(wxPoint point)
Is the point currently visible on the worksheet?
Definition: Worksheet.cpp:4495
std::unique_ptr< Cell > CopySelection(bool asData=false) const
Copy the currently selected cells.
Definition: Worksheet.cpp:3559
GroupCell * GetLastCellInWorksheet() const
Returns a pointer to the last cell of this worksheet.
Definition: Worksheet.cpp:1620
void ScrollToStart()
Scroll to the start of the worksheet.
Definition: Worksheet.h:750
void AddSymbol(const wxString &fun, AutoComplete::autoCompletionType type=AutoComplete::command)
Add a symbol to the autocompletion list.
Definition: Worksheet.h:1455
bool FindNext(const wxString &str, bool down, bool ignoreCase, bool searchInInput=true, bool searchInOutput=true, bool warn=true)
Find the next occurrence of a string.
Definition: Worksheet.cpp:5180
bool SectioningMoveIn(GroupCell *parent)
Make this chapter/section/... a section/subsection/... changing its subheadings, too.
Definition: Worksheet.cpp:5675
wxBitmap ConvertSelectionToBitmap() const
Convert the current selection to a bitmap.
void RequestRedraw(GroupCell *start=NULL)
Request the worksheet to be redrawn.
Definition: Worksheet.cpp:419
bool RedrawIfRequested()
Redraw the worksheet if RequestRedraw() has been called.
Definition: Worksheet.cpp:262
bool ExportToMAC(const wxString &file)
Export the file to a text file maxima's load command can read.
Definition: Worksheet.cpp:3776
void UpdateScrollPos()
Execute all collected scroll events in one go.
Definition: Worksheet.cpp:2490
void SetActiveCell(EditorCell *cell)
Mark an editor cell as the active one.
Definition: Worksheet.cpp:4411
FindReplaceDialog * m_findDialog
The find-and-replace-dialog.
Definition: Worksheet.h:756
void DrawGroupCell(wxDC &dc, wxDC &adc, GroupCell &cell)
Draws a groupcell on the DC.
Definition: Worksheet.cpp:698
void QuestionAnswered()
Mark the current question from maxima as "answered"..
Definition: Worksheet.cpp:2477
void DeleteRegion(GroupCell *start, GroupCell *end, UndoActions *undoBuffer)
Definition: Worksheet.cpp:2172
bool ScrollToCaretIfNeeded()
Scrolls to the cursor, if requested.
Definition: Worksheet.cpp:5273
std::unique_ptr< GroupCell > CopyTree() const
Copies the worksheet's entire contents.
Definition: Worksheet.cpp:3476
GroupCell * EndOfSectioningUnit(GroupCell *start)
Finds the end of the current chapter/section/...
Definition: Worksheet.cpp:2518
std::vector< wxString > m_replacementsForCurrentWord
Suggestions for how the word that was right-clicked on could continue.
Definition: Worksheet.h:1536
void ForceRedraw()
Redraw the window now and mark any pending redraw request as "handled".
Definition: Worksheet.h:719
bool CopyTeX() const
Copy the TeX representation of the current selection to the clipboard.
Definition: Worksheet.cpp:1920
void AddRestToEvaluationQueue()
Add all cells below the cursor to the evaluation queue.
Definition: Worksheet.cpp:3980
void ScrollToCellIfNeeded()
Scrolls to the cell given by ScheduleScrollToCell; Is called once we have time to do so.
Definition: Worksheet.cpp:4094
void DrawGroupCell_UsingBitmap(wxDC *dc, GroupCell *cell)
Draws a groupcell in a bitmap and then blits it onto the DC.
Definition: Worksheet.cpp:647
void GetMaxPoint(int *width, int *height)
Get the coordinates of the bottom right point of the worksheet.
Definition: Worksheet.h:384
void OnMouseWheel(wxMouseEvent &event)
Called if the mouse wheel sents events.
Definition: Worksheet.cpp:1508
void RequestRecalculation()
Schedule a recalculation of the whole worksheet. See RequestRecalculation(Cell*).
Definition: Worksheet.h:872
void CloseAutoCompletePopup()
Close the autocompletion pop-up if it is currently open.
Definition: Worksheet.h:559
bool SectioningMoveOut(GroupCell *parent)
Make this section/subsection/... a chapter/section/... changing its subheadings, too.
Definition: Worksheet.cpp:5717
bool FollowEvaluation() const
Query if we want to automatically scroll to the cell that is currently evaluated.
Definition: Worksheet.h:1301
void DestroyTree()
Clear the whole worksheet.
Definition: Worksheet.cpp:3467
wxString GetString(bool lb=false) const
Convert the current selection to a string.
Definition: Worksheet.cpp:1717
GroupCell * GetWorkingGroup(bool resortToLast=false) const
Returns the cell maxima currently works on.
Definition: Worksheet.cpp:854
bool CopySVG() const
Copy a svg of the current selection to the clipboard.
Definition: Worksheet.cpp:3495
void Evaluate()
Trigger the evaluation of the current cell(s)
Definition: Worksheet.cpp:2359
void OnScrollChanged(wxScrollEvent &ev)
Called if the user is using the scrollbar for scrolling through the document.
Definition: Worksheet.cpp:5019
void OnDoubleClick(wxMouseEvent &event)
Is called on double click on a cell.
Definition: Worksheet.cpp:3870
void OnActivate(wxActivateEvent &event)
Is called if this element looses or gets the focus.
Definition: Worksheet.cpp:4875
void AddToEvaluationQueue(GroupCell *cell)
Adds a group cell to the evaluation queue marking its contents as "outdated".
Definition: Worksheet.cpp:3948
void RequestRecalculation(Cell *start)
Schedule a recalculation of the worksheet starting with the cell start.
Definition: Worksheet.h:869
void TreeUndo_LimitUndoBuffer()
Drop actions from the back of the undo list until it is within the undo limit.
Definition: Worksheet.cpp:4197
bool CanTreeRedo() const
Can we redo a tree operation?
Definition: Worksheet.cpp:4216
void TreeUndo_CellEntered()
The cursor has entered one cell => save the value to see if it has changed.
Definition: Worksheet.cpp:2133
void TreeUndo_AppendAction()
Add another action to this undo action.
Definition: Worksheet.h:282
bool TreeUndoTextChange(UndoActions *sourcelist, UndoActions *undoForThisOperation)
Undo a text change.
Definition: Worksheet.cpp:4298
bool TreeUndo()
Undo a tree operation.
Definition: Worksheet.h:308
void TreeUndo_ClearRedoActionList()
Clear the list of actions for which an undo can be undone.
Definition: Worksheet.h:276
bool CanTreeUndo() const
Can we undo a tree operation?
Definition: Worksheet.cpp:4201
void TreeUndo_CellLeft()
The cursor is about to leave the current cell => Store the change if the value has changed.
Definition: Worksheet.cpp:2117
void TreeUndo_ClearUndoActionList()
Clear the list of actions for which undo can undo.
Definition: Worksheet.h:279
bool TreeUndoCellAddition(UndoActions *sourcelist, UndoActions *undoForThisOperation)
Undo adding cells.
Definition: Worksheet.cpp:4268
bool TreeUndoCellDeletion(UndoActions *sourcelist, UndoActions *undoForThisOperation)
Undo a call deletion.
Definition: Worksheet.cpp:4255
bool TreeRedo()
Redo an undone tree operation.
Definition: Worksheet.h:312
void TreeUndo_MarkCellsAsAdded(GroupCell *start, GroupCell *end, UndoActions *undoBuffer)
Remember that these cells were just added so this addition can be undone.
Definition: Worksheet.cpp:2107
Where a search starts: a group plus what the cursor is doing there.
Definition: WorksheetSearch.h:113
A search match: the group it is in and the matching part.
Definition: WorksheetSearch.h:97