33#include "stx/optional.hpp"
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"
57#include "cells/TextCell.h"
103 wxString m_maximaDocDir;
105 bool m_updateControls =
true;
107 bool m_scrollToCaret =
false;
111 int m_newxPosition = -1;
113 int m_newyPosition = -1;
115 double m_zoomAtGestureStart = 1.0;
117 bool m_scrollToTopOfCell =
false;
119 bool m_windowActive =
true;
121 wxRegion m_regionToRefresh;
128 int m_scrollUnit = 10;
137 bool m_fullRedrawRequested =
false;
141 static wxDataFormat m_wxmFormat;
143 static wxDataFormat m_mathmlFormat;
145 static wxDataFormat m_mathmlFormat2;
147 static wxDataFormat m_rtfFormat;
149 static wxDataFormat m_rtfFormat2;
153 class MathMLDataObject :
public wxCustomDataObject
156 explicit MathMLDataObject(
const wxString &data);
161 wxCharBuffer m_databuf;
165 class wxmDataObject :
public wxCustomDataObject
168 explicit wxmDataObject(
const wxString &data);
173 wxCharBuffer m_databuf;
176 class MathMLDataObject2 :
public wxCustomDataObject
179 explicit MathMLDataObject2(
const wxString &data);
184 wxCharBuffer m_databuf;
189 class RtfDataObject :
public wxCustomDataObject
192 explicit RtfDataObject(
const wxString &data);
197 wxCharBuffer m_databuf;
200 class RtfDataObject2 :
public wxCustomDataObject
203 explicit RtfDataObject2(
const wxString &data);
208 wxCharBuffer m_databuf;
212 bool m_hasFocus =
true;
216 long m_lastBottom = 0;
244 TreeUndoAction(
GroupCell *start,
const wxString &oldText) :
245 m_start(start), m_oldText(oldText)
247 wxASSERT_MSG(start, _(
"Bug: Trying to record a cell contents change for undo without a cell."));
250 m_start(start), m_newCellsEnd(end)
252 wxASSERT_MSG(start, _(
"Bug: Trying to record a cell contents change for undo without a cell."));
255 m_start(start), m_newCellsEnd(end), m_oldCells(oldCells)
264 bool m_partOfAtomicAction =
false;
277 const wxString m_oldText;
285 GroupCell *
const m_newCellsEnd =
nullptr;
294 std::unique_ptr<GroupCell> m_oldCells;
298 using UndoActions = std::list<TreeUndoAction>;
301 UndoActions treeUndoActions;
304 UndoActions treeRedoActions;
307 wxString m_treeUndo_ActiveCellOldText;
310 void TreeUndo_ClearRedoActionList();
313 void TreeUndo_ClearUndoActionList();
316 static void TreeUndo_DiscardAction(UndoActions *actionList);
319 static void TreeUndo_AppendAction(UndoActions *actionList)
321 if(!actionList->empty())
322 actionList->front().m_partOfAtomicAction =
true;
326 void TreeUndo_AppendAction(){TreeUndo_AppendAction(&treeUndoActions);}
335 void TreeUndo_LimitUndoBuffer();
342 bool TreeUndo(UndoActions *sourcelist, UndoActions *undoForThisOperation);
347 bool TreeUndoTextChange(UndoActions *sourcelist, UndoActions *undoForThisOperation);
351 bool TreeUndoCellDeletion(UndoActions *sourcelist, UndoActions *undoForThisOperation);
355 bool TreeUndoCellAddition(UndoActions *sourcelist, UndoActions *undoForThisOperation);
359 {
return TreeUndo(&treeUndoActions, &treeRedoActions); }
363 {
return TreeUndo(&treeRedoActions, &treeUndoActions); }
366 bool CanTreeUndo()
const;
369 bool CanTreeRedo()
const;
373 void TreeUndo_CellEntered();
377 void TreeUndo_CellLeft();
387 void TreeUndo_MarkCellsAsAdded(
GroupCell *start,
GroupCell *end, UndoActions *undoBuffer);
398 bool m_scrolledAwayFromEvaluation =
false;
404 wxString EscapeHTMLChars(wxString input);
407 wxString PrependNBSP(wxString input);
413 CLICK_TYPE_GROUP_SELECTION,
414 CLICK_TYPE_INPUT_SELECTION,
415 CLICK_TYPE_INPUT_LABEL_SELECTION,
416 CLICK_TYPE_OUTPUT_SELECTION
428 static void AddLineToFile(wxTextFile &output,
const wxString &s);
431 std::unique_ptr<Cell> CopySelection(
bool asData =
false)
const;
441 std::unique_ptr<Cell> CopySelection(
Cell *start,
Cell *end,
bool asData =
false)
const;
444 void GetMaxPoint(
int *width,
int *height);
447 void OnTimer(wxTimerEvent &event);
449#if wxCHECK_VERSION(3, 1, 1)
451 void OnZoom(wxZoomGestureEvent &event);
454 void OnMouseExit(wxMouseEvent &event);
456 void OnMouseEnter(wxMouseEvent &event);
470 void OnPaint(wxPaintEvent &event);
472 void DrawGroupCell(wxDC &dc, wxDC &adc,
GroupCell &cell);
480 void DrawGroupCell_UsingBitmap(wxDC *dc,
GroupCell *cell);
483 void PrepareDrawGC(wxDC &dc)
const;
485 void OnSize(wxSizeEvent &event);
487 void OnMouseRightDown(wxMouseEvent &event);
489 void OnSidebarKey(wxCommandEvent &event);
491 void OnMouseLeftUp(wxMouseEvent &event);
494 void OnMouseCaptureLost(wxMouseCaptureLostEvent &event);
496 void OnMouseLeftDown(wxMouseEvent &event);
498 void OnMouseLeftInGcCell(wxMouseEvent &event,
GroupCell *clickedInGC);
500 void OnMouseLeftInGcLeft(wxMouseEvent &event,
GroupCell *clickedInGC);
502 void OnMouseLeftInGc(wxMouseEvent &event,
GroupCell *clickedInGC);
504 void OnMouseMotion(wxMouseEvent &event);
507 void OnDoubleClick(wxMouseEvent &event);
510 void OnCharInActive(wxKeyEvent &event);
513 void OnCharNoActive(wxKeyEvent &event);
516 void SelectEditable(
EditorCell *editor,
bool up);
524 void SelectWithChar(
int ccode);
540 void ClickNDrag(wxPoint down, wxPoint up);
543 void SelectGroupCells(wxPoint down, wxPoint up);
548 void OnEraseBackground(wxEraseEvent& WXUNUSED(event))
551 void CheckUnixCopy();
553 void OnMouseMiddleUp(wxMouseEvent &event);
555 static bool IsLesserGCType(
int type,
int comparedTo);
564 void OnComplete(wxCommandEvent &event);
570 void EraseBackground(wxEraseEvent &event);
573 wxPoint m_leftDownPosition;
576 wxPoint m_mousePoint;
582 bool m_hCaretActive =
true;
600 bool m_leftDown =
false;
602 bool m_followEvaluation =
true;
603 bool m_mouseDrag =
false;
604 bool m_mouseOutside =
false;
606 mutable bool m_adjustWorksheetSizeNeeded =
false;
608 GroupCell *GetLastCellInWorksheet()
const;
609 int m_clickType = CLICK_TYPE_NONE;
612 bool m_blinkDisplayCaret =
true;
614 bool m_hCaretBlinkVisible =
true;
618 wxTimer m_caretTimer;
621 std::vector<wxString> m_completions;
622 bool m_autocompleteTemplates =
true;
628 {
return !m_tree || (!m_tree->GetNext() && m_tree->GetEditable()->GetValue().Length() <= 1); }
632 if(m_autocompletePopup != NULL)
633 m_autocompletePopup->Destroy();
641 void OnChar(wxKeyEvent &event);
668 void SetNotification(
const wxString &message,
int flags = wxICON_INFORMATION);
674 std::unique_ptr<GroupCell> m_tree;
678 static std::mutex m_drawDCLock;
683 void FocusFindDialogue()
704 int IndexSearchStartedAt()
const
707 CellPointers &GetCellPointers() {
return m_cellPointers; }
739 m_redrawStart = NULL;
740 m_fullRedrawRequested =
false;
818 bool CanUndo()
const;
820 bool CanRedo()
const;
830 void TreeUndo_ClearBuffers();
842 wxPoint pos = wxDefaultPosition, wxSize size = wxDefaultSize,
843 bool reactToEvents =
true);
855 std::unique_ptr<GroupCell>
CopyTree()
const;
869 UndoActions *undoBuffer);
883 void InsertLine(std::unique_ptr<Cell> &&newCell,
bool forceNewLine =
false);
907 void ResetInputPrompts();
916 bool CanPaste()
const
917 {
return m_cellPointers.
m_activeCell || m_hCaretActive; }
944 UndoActions *undoBuffer
963 void DeleteSelection();
1024 void Animate(
bool run =
true)
const;
1030 void SetLastQuestion(
const wxString &lastQuestion){m_lastQuestion = lastQuestion;}
1031 wxString GetLastQuestion()
const {
return m_lastQuestion;}
1036 void PasteFromClipboard();
1044 bool Copy(
bool astext =
false)
const;
1076#if wxUSE_ENH_METAFILE
1078 bool CopyEMF()
const;
1084 wxSize CopyToFile(
const wxString &file)
const;
1086 wxSize CopyToFile(
const wxString &file,
Cell *start,
Cell *end,
bool asData =
false,
double scale = 1)
const;
1088 void CalculateReorderedCellIndices(
GroupCell *tree,
int &cellIndex, std::vector<int> &cellMap);
1101 ExportToMAC(wxTextFile &output,
GroupCell *tree,
bool wxm,
const std::vector<int> &cellMap,
bool fixReorderedIndices);
1120 wxString
GetString(
bool lb =
false)
const;
1122 GroupCell *GetTree()
const {
return m_tree.get(); }
1123 std::unique_ptr<GroupCell> *GetTreeAddress() {
return &m_tree; }
1152 bool ActivatePrevInput() {
return ActivateInput(-1); }
1153 bool ActivateNextInput() {
return ActivateInput(+1); }
1154 wxString GetStatusText()
const {
return m_statusText;}
1155 bool StatusTextChangedHas() {
1156 bool retval = (m_statusTextHas != m_statusTextHas_old) ||
1157 (m_statusText != m_statusText_old);
1158 m_statusText_old = m_statusText;
1159 m_statusTextHas_old = m_statusTextHas;
1162 bool StatusTextHas()
const {
return m_statusTextHas;}
1175 wxTimer m_displayTimeoutTimer;
1177 template <
class T_SRC,
class T_DEST>
1178 inline std::unique_ptr<T_DEST> unique_cast(std::unique_ptr<T_SRC> &&src)
1180 if (!src)
return std::unique_ptr<T_DEST>();
1182 T_DEST *dest_ptr = &
dynamic_cast<T_DEST &
>(*src.get());
1184 (void) src.release();
1185 return std::unique_ptr<T_DEST>(dest_ptr);
1187 wxString m_statusText;
1188 wxString m_statusText_old;
1189 bool m_statusTextHas =
false;
1190 bool m_statusTextHas_old =
false;
1191 void StatusText(
const wxString &text){m_statusText = text; m_statusTextHas =
true;}
1192 void UnsetStatusText(){m_statusTextHas =
false;}
1193 bool ActivateInput(
int direction);
1200 m_scrollToCaret =
true;
1212 m_cellPointers.ScrollToCell(cell);
1213 m_scrollToTopOfCell = scrollToTop;
1214 m_scrollToCaret =
false;
1309 void UndoInsideCell();
1317 void RedoInsideCell();
1332 {
return m_followEvaluation; }
1339 void ScrolledAwayFromEvaluation(
bool ScrolledAway);
1341 bool ScrolledAwayFromEvaluation()
const
1342 {
return m_scrolledAwayFromEvaluation; }
1346 bool IsSaved()
const
1349 void SetSaved(
bool saved)
1350 {
if(m_saved != saved) m_updateControls =
true; m_saved = saved;}
1352 void OutputChanged()
1358 void RemoveAllOutput();
1373 void AddDocumentToEvaluationQueue();
1412 void SetZoomFactor(
double newzoom);
1414 void CommentSelection();
1421 void OnScrollEvent(wxScrollWinEvent &ev);
1433 bool FindIncremental(
const wxString &str,
bool down,
bool ignoreCase);
1434 bool FindIncremental_RegEx(
const wxString &str,
bool down);
1440 bool FindNext(
const wxString &str,
bool down,
bool ignoreCase,
bool warn =
true);
1441 bool FindNext_Regex(
const wxString &str,
const bool &down,
bool warn =
true);
1447 void Replace(
const wxString &oldString,
const wxString &newString,
bool ignoreCase);
1448 void Replace_RegEx(
const wxString &oldString,
const wxString &newString);
1454 int ReplaceAll(
const wxString &oldString,
const wxString &newString,
bool ignoreCase);
1455 int ReplaceAll_RegEx(
const wxString &oldString,
const wxString &newString);
1457 wxString GetInputAboveCaret();
1459 wxString GetOutputAboveCaret();
1477 void SetActiveCellText(
const wxString &text);
1479 bool InsertText(
const wxString &text);
1481 void OpenNextOrCreateCell();
1517 void SetMaximaDocDir(
const wxString &dir)
1519 m_maximaDocDir = dir;
1540 wxString GetHelpfileAnchorName(
const wxString &keyword)
1541 {
return m_maximaManual.GetHelpfileAnchorName(keyword);}
1542 wxString GetHelpfileURL(
const wxString &keyword)
1543 {
return m_maximaManual.GetHelpfileURL(keyword);}
1557 bool isValid()
const
1558 {
return pos <
input.length(); }
1561 inline wxChar operator*()
const
1562 {
return input[pos]; }
1573#if wxUSE_ACCESSIBILITY
1574 class AccessibilityInfo:
public wxAccessible
1577 AccessibilityInfo(wxWindow *parent,
Worksheet *worksheet);
1578 wxAccStatus GetChildCount (
int *childCount);
1579 wxAccStatus GetChild (
int childId, wxAccessible **child);
1580 wxAccStatus GetDefaultAction(
int childId, wxString *actionName);
1581 wxAccStatus GetParent (wxAccessible ** parent);
1583 wxAccStatus GetLocation (wxRect &rect,
int elementId);
1584 wxAccStatus HitTest (
const wxPoint &pt,
1585 int *childId, wxAccessible **childObject);
1586 wxAccStatus GetDescription(
int childId, wxString *description);
1588 wxWindow *m_parent = NULL;
1593 MaximaManual *GetMaximaManual() {
return &m_maximaManual;}
1595 void FocusTextControl();
1596 wxString m_lastQuestion;
1597 int m_virtualWidth_Last = -1;
1598 int m_virtualHeight_Last = -1;
1601 virtual wxSize DoGetBestClientSize()
const override;
1602#if wxUSE_ACCESSIBILITY
1603 AccessibilityInfo *m_accessibilityInfo = NULL;
1605 void UpdateConfigurationClientSize();
1618inline Worksheet *Cell::GetWorksheet()
const
1621 wxASSERT(worksheet != NULL);
1622 return static_cast<Worksheet*
>(worksheet);
1625wxDECLARE_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:64
@ MC_TYPE_GROUP
A group cells that bundles several individual cells together.
Definition: Cell.h:82
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...
The file that contains the "variables" sidepane.
Definition: AnimationCell.h:46
Definition: Autocomplete.h:60
autoCompletionType
All types of things we can autocomplete.
Definition: Autocomplete.h:67
void AddSymbols(wxString xml)
Interprets the XML autocompletable symbol list maxima can send us.
Definition: Autocomplete.cpp:108
void AddSymbol(wxString fun, autoCompletionType type=command)
Manually add an autocompletable symbol to our symbols lists.
Definition: Autocomplete.cpp:553
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:194
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:480
The base class all cell types the worksheet can consist of are derived from.
Definition: Cell.h:142
GroupCell * GetGroup() const
Returns the group cell this cell belongs to.
Definition: Cell.cpp:243
CellType GetType() const
Returns the type of this cell.
Definition: Cell.h:424
Configuration * m_configuration
A pointer to the configuration responsible for this worksheet.
Definition: Cell.h:990
The configuration storage for the current worksheet.
Definition: Configuration.h:84
wxWindow * GetWorkSheet() const
Get the worksheet this configuration storage is valid for.
Definition: Configuration.h:889
void ReadConfig()
Read the config from the wxConfig object.
Definition: Configuration.cpp:619
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:284
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:74
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:521
A class that maintains a list of recent documents.
Definition: RecentDocuments.h:42
A Text cell.
Definition: TextCell.h:38
Definition: Worksheet.h:1551
const wxString & input
reference to input string (must be a reference, so it can be modified)
Definition: Worksheet.h:1570
The canvas that contains the spreadsheet the whole program is about.
Definition: Worksheet.h:95
bool IsActiveInLast() const
Is the editor active in the last cell of the worksheet?
Definition: Worksheet.h:1261
GroupCell * ToggleFold(GroupCell *which)
Fold or unfold a cell.
Definition: Worksheet.cpp:1178
void ClearSelection()
Clear the selection - make it empty, i.e. no selection.
Definition: Worksheet.h:1140
const wxString UnicodeToMaxima(wxString s)
Make a few unicode characters interpretable by maxima.
Definition: Worksheet.cpp:5752
bool CanMergeSelection() const
Can we merge the selected cells into one?
Definition: Worksheet.cpp:6357
ImgCellBase * GetSelectedImgCellBase() const
Returns the selected cell - or NULL, if the selection isn't image nor animation.
Definition: Worksheet.h:996
wxString RTFStart() const
The start of a RTF document.
Definition: Worksheet.cpp:7938
int m_pointer_x
The x position of the mouse pointer.
Definition: Worksheet.h:1609
void SetDefaultHCaret()
Set the HCaret to its default location, at the end of the document.
Definition: Worksheet.cpp:6954
bool CanDeleteRegion(GroupCell *start, const GroupCell *end) const
Is it possible to delete the cells between start and end?
Definition: Worksheet.cpp:2943
void AddSectionToEvaluationQueue(GroupCell *start)
Adds a chapter, a section or a subsection to the evaluation queue.
Definition: Worksheet.cpp:6115
void AddSymbols(const wxString &xml)
Add a xml-encoded list of symbols to the autocompletion list.
Definition: Worksheet.h:1471
void FoldAll()
Recursively folds the whole document.
Definition: Worksheet.cpp:1215
virtual ~Worksheet()
The destructor.
Definition: Worksheet.cpp:412
bool CutToClipboard()
Add the currently selected cells to the clipboard and delete them.
Definition: Worksheet.cpp:6652
GroupCell * GetInsertGroup() const
The group that the line's cells will belong to - used by InsertLine.
Definition: Worksheet.cpp:831
bool QuestionPending() const
Does maxima wait for the answer of a question?
Definition: Worksheet.h:1507
void AddEntireDocumentToEvaluationQueue()
Schedule all cells in the document for evaluation.
Definition: Worksheet.cpp:6106
GroupCell * FirstVisibleGC()
The first groupCell that is currently visible.
Definition: Worksheet.cpp:2327
void AddSymbols(wxXmlDocument xml)
Add a xml-encoded list of symbols to the autocompletion list.
Definition: Worksheet.h:1474
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:1538
bool ExportToHTML(const wxString &file)
Export the file to an html document.
Definition: Worksheet.cpp:4693
void OpenHCaret(const wxString &txt={})
Place the cursor into a new cell where the horizontal cursor is.
Definition: Worksheet.h:1289
TextCell * GetSelectedTextCell() const
Returns the selected cell - or NULL, if the selection isn't a text cell.
Definition: Worksheet.h:1004
void ScrollToError()
Unfold the cell that produced the error, if necessary and, if requested, scroll to it.
Definition: Worksheet.cpp:781
bool HCaretActive() const
Is the vertically-drawn cursor active?
Definition: Worksheet.h:809
void ClearDocument()
Empties the current document.
Definition: Worksheet.cpp:1072
wxString RTFEnd() const
The end of a RTF document.
Definition: Worksheet.cpp:7990
void UnfoldAll()
Recursively unfolds the whole document.
Definition: Worksheet.cpp:1225
void UpdateTableOfContents()
Update the table of contents.
Definition: Worksheet.cpp:8189
Cell * GetSelectionEnd() const
Return the last of the currently selected cells.
Definition: Worksheet.h:1136
void QuestionPending(bool pending)
Does maxima currently wait for the answer of a question?
Definition: Worksheet.h:1514
void DeleteCurrentCell()
Delete the currently active cell - or the cell above this one.
Definition: Worksheet.cpp:2928
AnimationCell * GetSelectedAnimation() const
Returns the selected cell - or NULL, if the selection isn't an animation.
Definition: Worksheet.h:980
void Replace(const wxString &oldString, const wxString &newString, bool ignoreCase)
Replace the current occurrence of a string.
Definition: Worksheet.cpp:7399
bool CopyMatlab() const
Copy a Matlab representation of the current selection to the clipboard.
Definition: Worksheet.cpp:2750
bool CopyText() const
Copy a textual representation of the current selection to the clipboard.
Definition: Worksheet.cpp:2813
bool m_inPopupMenu
Is there an active popup menu?
Definition: Worksheet.h:1615
wxTimer m_keyboardInactiveTimer
The timer that tells us when the keyboard is inactive so an autosave isn't disrupting.
Definition: Worksheet.h:849
int ReplaceAll(const wxString &oldString, const wxString &newString, bool ignoreCase)
Replace all occurrences of a string.
Definition: Worksheet.cpp:7433
void Animate(bool run=true) const
Animate the current slide show.
Definition: Worksheet.cpp:6926
bool CopyRTF() const
Copy a rtf version of the current selection to the clipboard.
Definition: Worksheet.cpp:4453
void UpdateConfig()
Re-read the configuration.
Definition: Worksheet.h:784
int m_pointer_y
The y position of the mouse pointer.
Definition: Worksheet.h:1611
bool Copy(bool astext=false) const
Copy the current selection to the clipboard.
Definition: Worksheet.cpp:2593
bool CopyAnimation() const
Copy the current animation to the clipboard.
Definition: Worksheet.cpp:4431
void StepAnimation(int change=1)
Set the slide of the currently selected animation or advance it by one step.
Definition: Worksheet.cpp:4282
void SetAnswer(const wxString &answer)
Handling questions from and answers for maxima.
Definition: Worksheet.cpp:3118
GroupCell * ToggleFoldAll(GroupCell *which)
Toggles the status of the fold for the given GroupCell and its children.
Definition: Worksheet.cpp:1199
void OnChar(wxKeyEvent &event)
Key for a printable character pressed.
Definition: Worksheet.cpp:4109
void AddSelectionToEvaluationQueue()
Schedule all cells in the selection to be evaluated.
Definition: Worksheet.cpp:6144
bool CanEdit()
We can edit the input if the we have the whole input in selection!
Definition: Worksheet.cpp:5996
bool HasCellsSelected() const
Is at least one entire cell selected?
Definition: Worksheet.h:929
void OnSetFocus(wxFocusEvent &event)
What to do if the worksheet is in the input focus.
Definition: Worksheet.cpp:6879
void SetNotification(const wxString &message, int flags=wxICON_INFORMATION)
Inform the user that something happened in a non-active window.
Definition: Worksheet.cpp:4087
void ScheduleScrollToCell(Cell *cell, bool scrollToTop=true)
Schedules scrolling to a given cell.
Definition: Worksheet.h:1210
GroupCell * InsertGroupCells(std::unique_ptr< GroupCell > &&cells, GroupCell *where, UndoActions *undoBuffer)
Insert group cells into the worksheet.
Definition: Worksheet.cpp:722
void AddDocumentTillHereToEvaluationQueue()
Schedule all cells stopping with the one the caret is in for evaluation.
Definition: Worksheet.cpp:6164
bool CanAnimate() const
Does it make sense to enable the "Play" button and the slider now?
Definition: Worksheet.h:1012
bool m_mouseMotionWas
Was there a mouse motion we didn't react to until now?
Definition: Worksheet.h:1613
void SelectAll()
Select the whole document.
Definition: Worksheet.cpp:6802
void OnKillFocus(wxFocusEvent &event)
What to do if the worksheet looses the input focus.
Definition: Worksheet.cpp:6891
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:840
void ClearNotification()
Clears the notification message from SetNotification.
Definition: Worksheet.cpp:4085
void OnFollow()
Called when the "Scroll to currently evaluated" button is pressed.
Definition: Worksheet.cpp:7872
Cell * GetSelectionStart() const
Return the first of the currently selected cells.
Definition: Worksheet.h:1129
void FoldOccurred()
Call when a fold action was detected, to update the state in response to a fold occurring.
Definition: Worksheet.cpp:1166
ImgCell * GetSelectedImgCell() const
Returns the selected cell - or NULL, if the selection isn't an image.
Definition: Worksheet.h:988
bool CanDeleteSelection() const
Is it possible to delete the currently selected cells?
Definition: Worksheet.cpp:2912
AutoComplete m_autocomplete
The storage for the autocompletion feature.
Definition: Worksheet.h:689
ToolBar * m_mainToolBar
The toolbar of the main window: We need to access it and therefore have it defined here.
Definition: Worksheet.h:1487
bool m_questionPrompt
true = the last reply from maxima was a question
Definition: Worksheet.h:1501
bool CaretVisibleIs()
Is the caret (hcaret or vcaret) currently visible on the worksheet?
Definition: Worksheet.cpp:7344
EditorCell * GetActiveCell() const
Get the currently active EditorCell.
Definition: Worksheet.h:692
bool UpdateControlsNeeded()
Is an update of the worksheet controls needed?
Definition: Worksheet.h:99
bool CopyCells() const
Copy the selection to the clipboard as it would appear in a .wxm file.
Definition: Worksheet.cpp:2842
GroupCell * GetLastCell()
Returns the last cell of the worksheet.
Definition: Worksheet.h:1265
GroupCell * GetHCaret()
The cell the horizontal cursor is above. NULL means at the start of the document.
Definition: Worksheet.cpp:6937
bool IsSelected(CellType type)
Does the selection start with a cell of the type "type".
Definition: Worksheet.cpp:6917
wxString ConvertSelectionToMathML() const
Convert the current selection to MathML.
Definition: Worksheet.cpp:2674
bool CanUndoInsideCell() const
Is it possible to issue an undo in the currently selected cell?
Definition: Worksheet.cpp:7003
bool RecalculateIfNeeded(bool timeout=false)
Actually recalculate the worksheet.
Definition: Worksheet.cpp:912
void SetHCaret(GroupCell *where)
Set the HCaret at the location of the given Cell.
Definition: Worksheet.cpp:6964
bool CanRedoInsideCell() const
Is it possible to issue an undo in the currently selected cell?
Definition: Worksheet.cpp:7017
bool GCContainsCurrentQuestion(const GroupCell *cell)
Does the GroupCell cell points to contain the question currently asked by maxima?
Definition: Worksheet.cpp:3351
bool IsEmpty() const
Is this worksheet empty?
Definition: Worksheet.h:627
void NumberSections() const
Renumber all sections.
Definition: Worksheet.cpp:1105
CellPtr< GroupCell > m_recalculateStart
Where to start recalculation. NULL = No recalculation needed.
Definition: Worksheet.h:1607
void OnKeyDown(wxKeyEvent &event)
A special key has been pressed.
Definition: Worksheet.cpp:3246
EditorCell * KeyboardSelectionStart() const
Tells us which cell the keyboard selection has started in.
Definition: Worksheet.h:695
void ExportToMAC(wxTextFile &output, GroupCell *tree, bool wxm, const std::vector< int > &cellMap, bool fixReorderedIndices)
Export a region of the file to a .wxm or .mac file maxima's load command can read.
Definition: Worksheet.cpp:5876
void SetSelection(Cell *sel)
Select the cell sel.
Definition: Worksheet.h:1143
void AddCellToEvaluationQueue(GroupCell *gc)
Schedule this cell for evaluation.
Definition: Worksheet.cpp:6186
void SetCellStyle(GroupCell *group, GroupType style)
Change the style of a cell.
Definition: Worksheet.cpp:3032
bool Autocomplete(AutoComplete::autoCompletionType type=AutoComplete::command)
Definition: Worksheet.cpp:7492
wxBitmap m_memory
A memory we can manually buffer the contents of the area that is to be redrawn in.
Definition: Worksheet.h:1600
void LoadSymbols()
Compile a list of known autocompletion symbols.
Definition: Worksheet.cpp:5750
void SelectGroupCell(GroupCell *cell)
Set this cell as the currently selected one.
Definition: Worksheet.cpp:7858
void ShowPoint(wxPoint point)
Scrolls to a point on the worksheet.
Definition: Worksheet.cpp:6608
void WindowActive(bool active)
Is this window active?
Definition: Worksheet.h:661
bool ExportToTeX(const wxString &file)
export to a LaTeX file
Definition: Worksheet.cpp:5633
bool IsSelectionInWorkingGroup()
Is the selection in the current working group?
Definition: Worksheet.cpp:6932
void ShowHCaret()
Activates the horizontal cursor.
Definition: Worksheet.cpp:6996
void CodeCellVisibilityChanged()
To be called after enabling or disabling the visibility of code cells.
Definition: Worksheet.cpp:5621
void ScrollToCaret()
Request to scroll to the cursor as soon as wxMaxima is idle.
Definition: Worksheet.h:1197
void 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:3126
void MarkRefreshAsDone()
Handle redrawing the worksheet or of parts of it.
Definition: Worksheet.h:737
bool CopyMathML() const
Copy the MathML representation of the current selection to the clipboard.
Definition: Worksheet.cpp:2723
bool CopyBitmap() const
Copy a bitmap of the current selection to the clipboard.
Definition: Worksheet.cpp:4424
bool PointVisibleIs(wxPoint point)
Is the point currently visible on the worksheet?
Definition: Worksheet.cpp:6587
void ScrollToStart()
Scroll to the start of the worksheet.
Definition: Worksheet.h:800
void Recalculate(Cell *start)
Schedule a recalculation of the worksheet starting with the cell start.
Definition: Worksheet.cpp:977
bool FindIncremental(const wxString &str, bool down, bool ignoreCase)
Do an incremental search from the cursor or the point the last search started at.
Definition: Worksheet.cpp:7148
void AddSymbol(const wxString &fun, AutoComplete::autoCompletionType type=AutoComplete::command)
Add a symbol to the autocompletion list.
Definition: Worksheet.h:1467
bool SectioningMoveIn(GroupCell *parent)
Make this chapter/section/... a section/subsection/... changing its subheadings, too.
Definition: Worksheet.cpp:7729
wxBitmap ConvertSelectionToBitmap() const
Convert the current selection to a bitmap.
void RequestRedraw(GroupCell *start=NULL)
Request the worksheet to be redrawn.
Definition: Worksheet.cpp:384
int GetCellIndex(Cell *cell) const
Returns the index in (i...) or (o...)
Definition: Worksheet.cpp:4596
bool RedrawIfRequested()
Redraw the worksheet if RequestRedraw() has been called.
Definition: Worksheet.cpp:256
void UpdateScrollPos()
Execute all collected scroll events in one go.
Definition: Worksheet.cpp:3368
void SetActiveCell(EditorCell *cell)
Mark an editor cell as the active one.
Definition: Worksheet.cpp:6511
FindReplaceDialog * m_findDialog
The find-and-replace-dialog.
Definition: Worksheet.h:806
void QuestionAnswered()
Mark the current question from maxima as "answered"..
Definition: Worksheet.cpp:3355
void DeleteRegion(GroupCell *start, GroupCell *end, UndoActions *undoBuffer)
Definition: Worksheet.cpp:3056
bool ScrollToCaretIfNeeded()
Scrolls to the cursor, if requested.
Definition: Worksheet.cpp:7371
std::unique_ptr< GroupCell > CopyTree() const
Copies the worksheet's entire contents.
Definition: Worksheet.cpp:4420
std::vector< wxString > m_replacementsForCurrentWord
Suggestions for how the word that was right-clicked on could continue.
Definition: Worksheet.h:1548
EvaluationQueue m_evaluationQueue
The list of cells that have to be evaluated.
Definition: Worksheet.h:1397
void ForceRedraw()
Redraw the window now and mark any pending redraw request as "handled".
Definition: Worksheet.h:774
bool CopyTeX() const
Copy the TeX representation of the current selection to the clipboard.
Definition: Worksheet.cpp:2778
bool FindNext(const wxString &str, bool down, bool ignoreCase, bool warn=true)
Find the next occurrence of a string.
Definition: Worksheet.cpp:7168
void AddRestToEvaluationQueue()
Add all cells below the cursor to the evaluation queue.
Definition: Worksheet.cpp:6124
void ScrollToCellIfNeeded()
Scrolls to the cell given by ScheduleScrollToCell; Is called once we have time to do so.
Definition: Worksheet.cpp:6212
void OnMouseWheel(wxMouseEvent &event)
Called if the mouse wheel sents events.
Definition: Worksheet.cpp:2361
void CloseAutoCompletePopup()
Close the autocompletion pop-up if it is currently open.
Definition: Worksheet.h:630
bool SectioningMoveOut(GroupCell *parent)
Make this section/subsection/... a chapter/section/... changing its subheadings, too.
Definition: Worksheet.cpp:7771
bool FollowEvaluation() const
Query if we want to automatically scroll to the cell that is currently evaluated.
Definition: Worksheet.h:1331
void DestroyTree()
Clear the whole worksheet.
Definition: Worksheet.cpp:4411
wxString GetString(bool lb=false) const
Convert the current selection to a string.
Definition: Worksheet.cpp:2575
stx::optional< Notification > m_notificationMessage
A error notification message.
Definition: Worksheet.h:659
GroupCell * GetWorkingGroup(bool resortToLast=false) const
Returns the cell maxima currently works on.
Definition: Worksheet.cpp:809
bool CopySVG() const
Copy a svg of the current selection to the clipboard.
Definition: Worksheet.cpp:4439
wxString m_currentFile
The name of the currently-opened file.
Definition: Worksheet.h:791
void Evaluate()
Trigger the evaluation of the current cell(s)
Definition: Worksheet.cpp:3237
void OnScrollChanged(wxScrollEvent &ev)
Called if the user is using the scrollbar for scrolling through the document.
Definition: Worksheet.cpp:7105
void OnActivate(wxActivateEvent &event)
Is called if this element looses or gets the focus.
Definition: Worksheet.cpp:6956
void AddToEvaluationQueue(GroupCell *cell)
Adds a group cell to the evaluation queue marking its contents as "outdated".
Definition: Worksheet.cpp:6092