wxMaxima
Loading...
Searching...
No Matches
Worksheet.h
Go to the documentation of this file.
1// -*- mode: c++; c-file-style: "linux"; c-basic-offset: 2; indent-tabs-mode: nil -*-
2//
3// Copyright (C) 2004-2015 Andrej Vodopivec <andrej.vodopivec@gmail.com>
4// (C) 2012-2013 Doug Ilijev <doug.ilijev@gmail.com>
5// (C) 2015 Gunter Königsmann <wxMaxima@physikbuch.de>
6//
7// This program is free software; you can redistribute it and/or modify
8// it under the terms of the GNU General Public License as published by
9// the Free Software Foundation; either version 2 of the License, or
10// (at your option) any later version.
11//
12// This program is distributed in the hope that it will be useful,
13// but WITHOUT ANY WARRANTY; without even the implied warranty of
14// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15// GNU General Public License for more details.
16//
17//
18// You should have received a copy of the GNU General Public License
19// along with this program; if not, write to the Free Software
20// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21//
22// SPDX-License-Identifier: GPL-2.0+
23
30#ifndef WORKSHEET_H
31#define WORKSHEET_H
32
33#include <functional>
34#include <optional>
36#include "precomp.h"
37#include "MaximaManual.h"
38#include "EventIDs.h"
39#include "RecentDocuments.h"
40#include "WheelSteps.h"
41#include <wx/wx.h>
42#include <wx/xml/xml.h>
43#include <wx/aui/aui.h>
44#include <wx/textfile.h>
45#include <wx/fdrepdlg.h>
46#include <wx/dc.h>
47#include <vector>
48#include <utility>
49#include <memory>
50#include <list>
51#include "CellPointers.h"
53#include "Notification.h"
54#include "cells/Cell.h"
55#include "cells/EditorCell.h"
56#include "cells/ImgCell.h"
57#include "cells/ImgCellBase.h"
58#include "cells/AnimationCell.h"
59#include "cells/GroupCell.h"
60#include "cells/MatrCell.h"
61#include "TreeUndoManager.h"
62#include "WorksheetCursor.h"
63#include "WorksheetDocument.h"
65#include "WorksheetSearch.h"
66#include "WorksheetLayout.h"
67#include "MatrixScrollbars.h"
68#include "ClipboardContents.h"
69#include "OutputNavigation.h"
70#include "cells/TextCell.h"
71#include "EvaluationQueue.h"
73#include "Autocomplete.h"
74#include "AutocompletePopup.h"
76#include "ToolBar.h"
77#include <thread>
78
121class Worksheet : public wxScrolled<wxWindow>, public WorksheetView,
123{
124public:
125 // WorksheetView: the narrow window surface the layout pipeline
126 // (WorksheetLayout) drives; each forwards to the wxScrolled base.
127 void GetViewClientSize(int *width, int *height) const override
128 { GetClientSize(width, height); }
129 int GetViewScrollUnitY() const override
130 { int x, y; GetViewStart(&x, &y); return y; }
131 void SetViewVirtualSize(int width, int height) override
132 { SetVirtualSize(width, height); }
133 void SetViewScrollRate(int rate) override { SetScrollRate(rate, rate); }
134 void GetViewPosition(int *x, int *y) const override
135 { const wxPoint p = GetPosition(); *x = p.x; *y = p.y; }
148 void ScrollViewToUnitY(int unitY) override
149 { Freeze(); Scroll(-1, unitY); Thaw(); RequestRedraw(); }
156 long GetStalePaintCount() const { return m_stalePaints; }
157
158 // WorksheetDocumentView: how m_document tells this window that a structural
159 // edit happened; each forwards to the real layout/redraw/save machinery.
160 void NotifyRecalculation(GroupCell *start) override
161 { RequestRecalculation(start); }
162 void NotifyRedraw(GroupCell *start) override { RequestRedraw(start); }
163 void NotifyAdjustSizeNeeded() override { m_layout.RequestAdjustSize(); }
164 void NotifySavedStateChanged() override { m_updateControls = true; }
165
167 RecentDocuments &UnsavedDocuments() { return m_unsavedDocuments; }
168private:
169 RecentDocuments m_unsavedDocuments;
170public:
172 bool UpdateControlsNeeded(){bool result = m_updateControls; m_updateControls = false; return result;}
173 void UpdateControlsNeeded(bool updateControlsNeeded){m_updateControls = updateControlsNeeded;}
174private:
176 wxString m_maximaDocDir;
178 bool m_updateControls = true;
180 bool m_scrollToCaret = false;
181 // The x position to scroll to
182 int m_newxPosition = -1;
183 // The y position to scroll to
184 int m_newyPosition = -1;
186 double m_zoomAtGestureStart = 1.0;
188 bool m_scrollToTopOfCell = false;
190 bool m_windowActive = true;
192 wxRegion m_regionToRefresh;
197 wxClientDC m_dc;
199 CellPtr<GroupCell> m_redrawStart;
201 bool m_fullRedrawRequested = false;
207 bool RedrawStartBelowView() const;
209 long m_stalePaints = 0;
211
213 static wxDataFormat m_wxmFormat;
219 static wxDataFormat m_xmlFormat;
221 static wxDataFormat m_mathmlFormat;
223 static wxDataFormat m_mathmlFormat2;
225 static wxDataFormat m_rtfFormat;
227 static wxDataFormat m_rtfFormat2;
231 static wxDataFormat m_rtfFormat3;
232
235 class MathMLDataObject : public wxCustomDataObject
236 {
237 public:
238 explicit MathMLDataObject(const wxString &data);
239
240 MathMLDataObject();
241
242 private:
243 wxCharBuffer m_databuf;
244 };
245
247 class wxmDataObject : public wxCustomDataObject
248 {
249 public:
250 explicit wxmDataObject(const wxString &data);
251
252 wxmDataObject();
253
254 private:
255 wxCharBuffer m_databuf;
256 };
257
258 class MathMLDataObject2 : public wxCustomDataObject
259 {
260 public:
261 explicit MathMLDataObject2(const wxString &data);
262
263 MathMLDataObject2();
264
265 private:
266 wxCharBuffer m_databuf;
267 };
268
271 class RtfDataObject : public wxCustomDataObject
272 {
273 public:
274 explicit RtfDataObject(const wxString &data);
275
276 RtfDataObject();
277
278 private:
279 wxCharBuffer m_databuf;
280 };
281
282 class RtfDataObject2 : public wxCustomDataObject
283 {
284 public:
285 explicit RtfDataObject2(const wxString &data);
286
287 RtfDataObject2();
288
289 private:
290 wxCharBuffer m_databuf;
291 };
292
295 class RtfDataObject3 : public wxCustomDataObject
296 {
297 public:
298 explicit RtfDataObject3(const wxString &data);
299
300 RtfDataObject3();
301
302 private:
303 wxCharBuffer m_databuf;
304 };
305
307 bool m_hasFocus = true;
309 long m_lastTop = 0;
311 long m_lastBottom = 0;
333 // TreeUndoAction/UndoActions live in TreeUndoAction.h and the undo/redo
334 // state (the two stacks + the active-cell snapshot) is owned by the
335 // TreeUndoManager below; only the tree surgery of applying an action
336 // remains a Worksheet responsibility.
337
338private:
340 TreeUndoManager &GetTreeUndo() { return m_document.GetTreeUndo(); }
341 const TreeUndoManager &GetTreeUndo() const { return m_document.GetTreeUndo(); }
342
343public:
346
349
351 void TreeUndo_AppendAction() { GetTreeUndo().AppendAction(); }
352
358 bool TreeUndo(UndoActions *sourcelist, UndoActions *undoForThisOperation);
359
363 bool TreeUndoTextChange(UndoActions *sourcelist, UndoActions *undoForThisOperation);
367 bool TreeUndoCellDeletion(UndoActions *sourcelist, UndoActions *undoForThisOperation);
371 bool TreeUndoCellAddition(UndoActions *sourcelist, UndoActions *undoForThisOperation);
375 bool TreeUndoFold(UndoActions *sourcelist, UndoActions *undoForThisOperation);
376
378 bool TreeUndo()
379 { return TreeUndo(&GetTreeUndo().UndoStack(), &GetTreeUndo().RedoStack()); }
380
382 bool TreeRedo()
383 { return TreeUndo(&GetTreeUndo().RedoStack(), &GetTreeUndo().UndoStack()); }
384
386 bool CanTreeUndo() const;
387
389 bool CanTreeRedo() const;
390
394
397 void TreeUndo_CellLeft();
398
407 void TreeUndo_MarkCellsAsAdded(GroupCell *start, GroupCell *end, UndoActions *undoBuffer);
408
409
415 void TreeUndo_MarkCellsAsAdded(GroupCell *parentOfStart, GroupCell *end);
417
418
419private:
420 bool m_scrolledAwayFromEvaluation = false;
421public:
422
425 {
426 CLICK_TYPE_NONE,
427 CLICK_TYPE_GROUP_SELECTION,
428 CLICK_TYPE_INPUT_SELECTION,
429 CLICK_TYPE_INPUT_LABEL_SELECTION,
430 CLICK_TYPE_OUTPUT_SELECTION
431 };
432
435 {
436 TIMER_ID,
437 CARET_TIMER_ID,
438 DISPLAY_TIMEOUT_ID
439 };
440
446 std::unique_ptr<Cell> CopySelection(bool asData = false) const;
447
454 std::unique_ptr<MatrCell> CopySelectedMatrixBlock() const;
455
464 bool MatrixEntriesSelected() const;
474 static wxString SelectionRTFBody(const Cell *cells, bool matrixEntries);
475
487 void SelectOutputRect(GroupCell *group, wxPoint down, wxPoint up);
488
506 std::optional<std::size_t> SelectedOutputResult() const;
508 void SelectOutputResult(GroupCell *group, std::size_t index);
515 bool StepOutputResult(int keyCode);
522
530 std::optional<OutputNavigation::Item> SelectedOutputItem() const;
552 bool NavigateOutput(int keyCode, bool shift);
554
566 bool StepSelectedMatrixBlock(int keyCode);
567
576 std::unique_ptr<Cell> CopySelection(Cell *start, Cell *end, bool asData = false) const;
577
579 void GetMaxPoint(int *width, int *height) { m_layout.GetMaxPoint(width, height); }
580
582 void OnTimer(wxTimerEvent &event);
583
585 void OnZoom(wxZoomGestureEvent &event);
586
587 void OnMouseExit(wxMouseEvent &event);
588
589 void OnMouseEnter(wxMouseEvent &event);
590
603 void OnPaint(wxPaintEvent &event);
605 void DrawGroupCell(wxDC &dc, wxDC &adc, GroupCell &cell);
613 void DrawGroupCell_UsingBitmap(wxDC *dc, GroupCell *cell);
614
616 void PrepareDrawGC(wxDC &dc) const;
617
618 void OnSize(wxSizeEvent &event);
619
620 void OnMouseRightDown(wxMouseEvent &event);
626 void OnContextMenuKey(wxContextMenuEvent &event);
627
628 void OnSidebarKey(wxCommandEvent &event);
630 void InsertSymbol(const wxString &symbol);
631
632 void OnMouseLeftUp(wxMouseEvent &event);
633
635 void OnMouseCaptureLost(wxMouseCaptureLostEvent &event);
636
637 void OnMouseLeftDown(wxMouseEvent &event);
638
639 void OnMouseLeftInGcCell(wxMouseEvent &event, GroupCell *clickedInGC);
640
641 void OnMouseLeftInGcLeft(wxMouseEvent &event, GroupCell *clickedInGC);
642
643 void OnMouseLeftInGc(wxMouseEvent &event, GroupCell *clickedInGC);
644
645 void OnMouseMotion(wxMouseEvent &event);
646
648 void OnDoubleClick(wxMouseEvent &event);
656 bool OpenMatrixViewerAt(wxPoint position);
657
659 void OnCharInActive(wxKeyEvent &event);
660
662 void OnCharNoActive(wxKeyEvent &event);
663
665 void SelectEditable(EditorCell *editor, bool up);
666
673 void SelectWithChar(int ccode);
682 bool SelectWholeCellsFromOutput(int ccode);
683
698 void ClickNDrag(wxPoint down, wxPoint up);
699
700 // Select all group cells inside the given rectangle;
701 void SelectGroupCells(wxPoint down, wxPoint up);
702
703public:
710 static bool OpenLink(const wxString &url);
711
713 wxString LinkUnderPointer();
720 wxString GetLinkAt(wxPoint point);
721
723 const wxString &GetContextMenuLink() const { return m_contextMenuLink; }
725 void SetContextMenuLink(const wxString &link) { m_contextMenuLink = link; }
726
728 void AdjustSize() { m_layout.AdjustSize(); }
729
731 void OnEraseBackground(wxEraseEvent& WXUNUSED(event))
732 {}
733
734 void CheckUnixCopy();
735
736 void OnMouseMiddleUp(wxMouseEvent &event);
737
738 static bool IsLesserGCType(int type, int comparedTo);
739
742
745
747 void OnComplete(wxCommandEvent &event);
748
753 void EraseBackground(wxEraseEvent &event);
754
755private:
757 wxPoint m_leftDownPosition;
758 wxPoint m_down;
759 wxPoint m_up;
760 wxPoint m_mousePoint;
769 WorksheetCursor &GetHCaretCursor() { return m_document.GetCursor(); }
770 const WorksheetCursor &GetHCaretCursor() const { return m_document.GetCursor(); }
771 bool m_leftDown = false;
773 wxm::WheelSteps m_zoomWheelSteps;
775 wxm::WheelSteps m_animationWheelSteps;
781 const AnimationCell *m_wheelAnimation = nullptr;
783 bool m_followEvaluation = true;
784 bool m_mouseDrag = false;
785 bool m_mouseOutside = false;
786
787public:
790private:
791 int m_clickType = CLICK_TYPE_NONE;
792 CellPtr<GroupCell> m_clickInGC;
799 CellPtr<GroupCell> m_asyncOutputTarget;
801 int m_outputBatchDepth = 0;
807 std::vector<std::pair<CellPtr<GroupCell>, bool>> m_outputBatchGroups;
812 void LayOutAppendedOutput(GroupCell *cell, bool async);
814 void FinishBatchedOutput();
821 CellPtr<Cell> m_outputRunAnchor;
823 bool m_blinkDisplayCaret = true;
825 bool m_hCaretBlinkVisible = true;
827 wxTimer m_timer;
829 wxTimer m_caretTimer;
830 std::vector<wxString> m_completions;
831 bool m_autocompleteTemplates = true;
832 AutocompletePopup *m_autocompletePopup;
833
834public:
836 bool IsEmpty() const
837 { return !GetTree() || (!GetTree()->GetNext() && GetTree()->GetEditable()->GetValue().Length() <= 1); }
840 {
841 if(m_autocompletePopup != nullptr)
842 m_autocompletePopup->Destroy();
843 }
844
850 void OnChar(wxKeyEvent &event);
851
856 void OnKeyDown(wxKeyEvent &event);
859
861 void NumberSections() const;
862
864 bool SectioningMoveIn(GroupCell *parent);
866 bool SectioningMoveOut(GroupCell *parent);
868 std::optional<Notification> &GetNotification() { return m_notificationMessage; }
869private:
871 std::optional<Notification> m_notificationMessage;
873 std::function<void(bool)> m_attentionCallback;
874public:
876 void WindowActive(bool active){m_windowActive = active;}
878 void ClearNotification();
883 void SetNotification(const wxString &message, int flags = wxICON_INFORMATION);
891 void SetAttentionCallback(std::function<void(bool)> callback)
892 { m_attentionCallback = std::move(callback); }
893
895 void OnActivate(wxActivateEvent &event);
896private:
899 std::unique_ptr<GroupCell> &TreeOwner() { return m_document.TreeOwner(); }
900 CellPtr<GroupCell> &LastCache() const { return m_document.LastCache(); }
901// std::vector<std::jthread> m_drawThreads;
902 static std::mutex m_drawDCLock;
905 Configuration *m_configuration = nullptr;
915 mutable std::weak_ptr<ClipboardContents> m_clipboardContents;
922 WorksheetLayout m_layout;
928 MatrixScrollbars m_matrixScrollbars{this};
929public:
931 MatrixScrollbars &GetMatrixScrollbars() { return m_matrixScrollbars; }
932 void FocusFindDialogue()
933 {
935 pane->SetFocus();
936 }
943 AutoComplete &GetAutocomplete() { return m_autocomplete; }
944private:
945 AutoComplete m_autocomplete;
946public:
947
948 Configuration *GetConfig() const { return m_configuration; }
949
952
956
957 EditorCell *MouseSelectionStart() const
959
960 EditorCell *SearchStart() const
961 { return GetViewCellPointers().SearchStart(); }
962
963 int IndexSearchStartedAt() const
965
972
974 TextCell *GetCurrentTextCell() const { return GetDocumentCellPointers().GetCurrentTextCell(); }
975 void SetCurrentTextCell(TextCell *cell) { GetDocumentCellPointers().SetCurrentTextCell(cell); }
976 void SetWorkingGroup(GroupCell *group) { GetDocumentCellPointers().SetWorkingGroup(group); }
977
984
1002 {
1003 m_redrawStart = nullptr;
1004 m_fullRedrawRequested = false;
1005 }
1006
1011 bool RedrawIfRequested();
1012
1025 void RequestRedraw(GroupCell *start = nullptr);
1035 void RequestRedraw(wxRect rect);
1036
1039 {
1040 RequestRedraw();
1042 }
1043
1046
1049 m_configuration->ReadConfig();
1052 Refresh();
1053 }
1054
1064
1066 const wxString &GetCurrentFile() const { return m_document.GetCurrentFile(); }
1068 void SetCurrentFile(const wxString &file) { m_document.SetCurrentFile(file); }
1069
1086 const wxString UnicodeToMaxima(wxString s) const
1087 { return UnicodeToMaxima(std::move(s), m_configuration); }
1089 static wxString UnicodeToMaxima(wxString s, const Configuration *configuration);
1090
1092 void ScrollToStart() { Scroll(0, 0); }
1093
1095 void ScrollToError();
1096
1103
1105 bool HCaretActive() const { return GetHCaretCursor().IsActive(); }
1107 void DeactivateHCaret() { GetHCaretCursor().Deactivate(); }
1108
1115
1116 bool CanUndo() const;
1117
1118 bool CanRedo() const;
1119
1120 void Undo();
1121
1122 void Redo();
1123
1128 void TreeUndo_ClearBuffers();
1129
1139 Worksheet(wxWindow *parent, int id, Configuration *config,
1140 wxPoint pos = wxDefaultPosition, wxSize size = wxDefaultSize,
1141 bool reactToEvents = true);
1142
1144 ~Worksheet() override;
1145
1147 wxTimer &KeyboardInactiveTimer() { return m_keyboardInactiveTimer; }
1148private:
1149 wxTimer m_keyboardInactiveTimer;
1150public:
1151
1153 void DestroyTree();
1154
1156 std::unique_ptr<GroupCell> CopyTree() const;
1157
1169 GroupCell *InsertGroupCells(std::unique_ptr<GroupCell> &&cells, GroupCell *where,
1170 UndoActions *undoBuffer);
1171
1177 GroupCell *InsertGroupCells(std::unique_ptr<GroupCell> &&cells, GroupCell *where = nullptr);
1178
1184 void InsertLine(std::unique_ptr<Cell> &&newCell, bool forceNewLine = false);
1185
1199 public:
1200 explicit OutputBatch(Worksheet *worksheet) : m_worksheet(worksheet) {
1201 if (m_worksheet)
1202 m_worksheet->m_outputBatchDepth++;
1203 }
1204 ~OutputBatch() {
1205 if (m_worksheet && (--m_worksheet->m_outputBatchDepth == 0))
1206 m_worksheet->FinishBatchedOutput();
1207 }
1208 OutputBatch(const OutputBatch &) = delete;
1209 OutputBatch &operator=(const OutputBatch &) = delete;
1210 private:
1211 Worksheet *m_worksheet;
1212 };
1213
1220
1229 bool ScrollAnchorVisible();
1230
1241
1243 GroupCell *GetInsertGroup() const;
1244
1251 GroupCell *FindGroupCellByUUID(const wxString &uuid) const;
1252
1261 void SetAsyncOutputTarget(GroupCell *cell) { m_asyncOutputTarget = cell; }
1263 GroupCell *GetAsyncOutputTarget() const { return m_asyncOutputTarget; }
1264
1269 public:
1270 AsyncOutputTarget(Worksheet *worksheet, GroupCell *cell)
1271 : m_worksheet(worksheet) {
1272 if (m_worksheet)
1273 m_worksheet->SetAsyncOutputTarget(cell);
1274 }
1276 if (m_worksheet)
1277 m_worksheet->SetAsyncOutputTarget(nullptr);
1278 }
1279 AsyncOutputTarget(const AsyncOutputTarget &) = delete;
1280 AsyncOutputTarget &operator=(const AsyncOutputTarget &) = delete;
1281 private:
1282 Worksheet *m_worksheet;
1283 };
1284
1300 bool RecalculateIfNeeded(bool timeout = false, long timeSliceMs = 50)
1301 { return m_layout.RecalculateIfNeeded(timeout, timeSliceMs); }
1302
1313 void RequestRecalculation(Cell *start) { m_layout.RequestRecalculation(start); }
1314
1325
1327 int GetLastCellsVisited() const { return m_layout.GetLastCellsVisited(); }
1329 int GetLastCellsRecalculated() const { return m_layout.GetLastCellsRecalculated(); }
1330
1335 void ClearDocument();
1336
1337 void ResetInputPrompts();
1338
1339 bool CanCopy() const
1340 {
1344 }
1345
1354 bool CanCopyAsMathML() const;
1355
1357 bool CanCopyCSV() const;
1362 wxString SelectionToCSV() const;
1370 static wxString CSVDelimiter();
1371
1372 bool CanPaste() const
1373 { return GetDocumentCellPointers().GetActiveCell() || GetHCaretCursor().IsActive(); }
1374
1375 bool CanCut() const
1376 {
1379 }
1380
1382 void SelectAll();
1383
1386
1397 void DeleteRegion(
1398 GroupCell *start,
1399 GroupCell *end,
1400 UndoActions *undoBuffer
1401 );
1402
1409 void DeleteRegion(
1410 GroupCell *start,
1411 GroupCell *end
1412 );
1413
1419 void DeleteSelection();
1420
1421 void TOCdnd(GroupCell *dndStart, GroupCell *dndEnd);
1422
1424 bool CanDeleteRegion(GroupCell *start, const GroupCell *end) const;
1425
1428
1433 void DeleteCurrentCell();
1434
1437 {
1439 return nullptr;
1440 return dynamic_cast<AnimationCell *>(GetSelectionStart());
1441 }
1442
1461 bool ScrollSelectedMatrix(const wxMouseEvent &event);
1462private:
1464 wxPoint m_matrixWheelRemainder;
1465public:
1466
1469 {
1471 return nullptr;
1472 return dynamic_cast<ImgCell *>(GetSelectionStart());
1473 }
1474
1477 {
1479 return nullptr;
1480 return dynamic_cast<ImgCellBase *>(GetSelectionStart());
1481 }
1482
1485 {
1487 return nullptr;
1488 return dynamic_cast<TextCell *>(GetSelectionStart());
1489 }
1490
1492 bool CanAnimate() const
1493 {
1495 (dynamic_cast<AnimationCell *>(GetSelectionStart()) != nullptr);
1496 }
1497
1504 void Animate(bool run = true) const;
1505
1506 void DivideCell();
1507
1508 void MergeCells();
1509
1510 void SetLastQuestion(const wxString &lastQuestion){m_document.SetLastQuestion(lastQuestion);}
1511 wxString GetLastQuestion() const {return m_document.GetLastQuestion();}
1512
1514 bool CutToClipboard();
1515
1522 void PasteFromClipboard(bool primary = false);
1523
1533 bool PasteMathAsMaxima();
1534
1544 static constexpr bool HasPrimarySelection() {
1545#if defined(__UNIX__) && !defined(__APPLE__)
1546 return true;
1547#else
1548 return false;
1549#endif
1550 }
1551
1558 bool Copy(bool astext = false) const;
1559
1567 std::unique_ptr<wxDataObject> CreateSelectionDataObject() const;
1568
1570 bool CopyCells() const;
1571
1578 std::unique_ptr<wxDataObject> CreateCellsDataObject() const;
1579
1581 bool CopyMatlab() const;
1582
1584 bool CopyCSV() const;
1585
1587 bool CopyText() const;
1588
1590 bool CopyTeX() const;
1591
1593 wxString ConvertSelectionToMathML() const;
1594
1596 static wxString CellsToMathML(const Cell *cells);
1597
1614
1620 static std::unique_ptr<wxDataObject>
1622
1625
1627 bool CopyMathML() const;
1628
1630 bool CopyBitmap() const;
1631
1633 bool CopyAnimation() const;
1634
1636 bool CopySVG() const;
1637
1638#if wxUSE_ENH_METAFILE
1640 bool CopyEMF() const;
1641#endif
1642
1644 bool CopyRTF() const;
1645
1649 bool CopyHTML() const;
1650
1658 wxString SelectionToSelfContainedHTML() const;
1659
1660 wxSize CopyToFile(const wxString &file) const;
1661
1662 wxSize CopyToFile(const wxString &file, Cell *start, Cell *end, bool asData = false, double scale = 1) const;
1663
1675 int ExportSelectionOutputToDir(const wxString &dir, bool svg);
1676
1681 bool ExportToHTML(const wxString &file);
1682
1684 bool ExportToMAC(const wxString &file);
1685
1687 wxString RTFStart() const;
1688
1690 wxString RTFEnd() const;
1691
1693 bool ExportToTeX(const wxString &file);
1694
1701 bool ExportToPDF(const wxString &file,
1702 const PdfExport::Options &options = PdfExport::Options());
1703
1709 wxString GetString(bool lb = false) const;
1710
1711 GroupCell *GetTree() const { return m_document.GetTree(); }
1712 std::unique_ptr<GroupCell> *GetTreeAddress() { return &m_document.TreeOwner(); }
1713
1720
1727
1729 void ClearSelection() { SetSelection(nullptr, nullptr); }
1730
1732 void SetSelection(Cell *sel) { SetSelection(sel, sel); }
1733
1735 void SetSelection(Cell *start, Cell *end);
1736
1738 Cell *FindCellByUUID(const wxString &uuid);
1739
1742
1745 bool CanEdit() const { return m_document.CanEdit(); }
1746
1747 bool ActivatePrevInput() { return ActivateInput(-1); }
1748 bool ActivateNextInput() { return ActivateInput(+1); }
1749 wxString GetStatusText() const {return m_statusText;}
1750 bool StatusTextChangedHas() {
1751 bool retval = (m_statusTextHas != m_statusTextHas_old) ||
1752 (m_statusText != m_statusText_old);
1753 m_statusText_old = m_statusText;
1754 m_statusTextHas_old = m_statusTextHas;
1755 return retval;
1756 }
1757 bool StatusTextHas() const {return m_statusTextHas;}
1758private:
1764 void UpdateOutputSelectionString();
1765 /* ! A timer that tells us to urgently update the display
1766
1767 Normally we prioritize tasks: If there are GUI actions to process we do so.
1768 If not we look if there is data from maxima to process. If not we
1769 If not we recalculate the worksheet element sizes and positions and if
1770 there still is no pressing task we update the display. This way we
1771 respond quickly to the most important inputs.
1772
1773 This timer, if expired, tells us that if we don't update the screen now
1774 maxima feels like not being responsive.
1775 */
1776 wxTimer m_displayTimeoutTimer;
1777
1778 template <class T_SRC, class T_DEST>
1779 inline std::unique_ptr<T_DEST> unique_cast(std::unique_ptr<T_SRC> &&src)
1780 {
1781 if (!src) return std::unique_ptr<T_DEST>();
1782
1783 T_DEST *dest_ptr = &dynamic_cast<T_DEST &>(*src.get());
1784
1785 (void) src.release();
1786 return std::unique_ptr<T_DEST>(dest_ptr);
1787 }
1788 wxString m_statusText;
1789 wxString m_statusText_old;
1790 bool m_statusTextHas = false;
1791 bool m_statusTextHas_old = false;
1792 void StatusText(const wxString &text){m_statusText = text; m_statusTextHas = true;}
1793 void UnsetStatusText(){m_statusTextHas = false;}
1794 bool ActivateInput(int direction);
1795
1796public:
1799 {
1801 m_scrollToCaret = true;
1802 }
1803
1805 bool ScrollToCaretIfNeeded();
1806
1808 void ScrollToCellIfNeeded();
1809
1811 void ScheduleScrollToCell(Cell *cell, bool scrollToTop = true)
1812 {
1813 GetViewCellPointers().ScrollToCell(cell);
1814 m_scrollToTopOfCell = scrollToTop;
1815 m_scrollToCaret = false;
1816
1818 }
1819
1821 bool PointVisibleIs(wxPoint point);
1822
1824 bool CaretVisibleIs();
1825
1828
1842 void ShowPoint(wxPoint point);
1843
1845 void OnSetFocus(wxFocusEvent &event);
1846
1848 void OnKillFocus(wxFocusEvent &event);
1849
1851 bool IsSelected(CellType type) const { return m_document.IsSelected(type); }
1852
1859 void StepAnimation(int change = 1);
1860
1862 bool IsActiveInLast() const
1864
1867 {
1868 return GetLastCellInWorksheet();
1869 }
1870
1873
1874 void SetActiveCell(EditorCell *cell);
1875
1879 void SetDefaultHCaret();
1880
1885 void SetHCaret(GroupCell *where); // call with false, when manually refreshing
1888
1890 void OpenHCaret(const wxString &txt = {})
1891 {
1892 if(m_mainToolBar == nullptr)
1893 OpenHCaret(txt, GC_TYPE_CODE);
1894 else
1896 }
1897
1899 void OpenHCaret(const wxString &txt, GroupType type);
1900
1902 void ShowHCaret();
1903
1909
1917 bool HasTextFormat(TextFormat::Format flag) const;
1919 bool CanFormatText() const;
1920
1921 void UndoInsideCell();
1922
1928
1929 void RedoInsideCell();
1930
1940 void FollowEvaluation(bool followEvaluation);
1941
1943 bool FollowEvaluation() const
1944 { return m_followEvaluation; }
1945
1951 void ScrolledAwayFromEvaluation(bool ScrolledAway);
1952
1953 bool ScrolledAwayFromEvaluation() const
1954 { return m_scrolledAwayFromEvaluation; }
1955
1956 void SaveValue();
1957
1958 bool IsSaved() const
1959 { return m_document.IsSaved(); }
1960
1961 void SetSaved(bool saved)
1962 { m_document.SetSaved(saved); }
1963
1964 void OutputChanged()
1966
1968 void RemoveAllOutput();
1969
1977 void RemoveAllOutput(GroupCell *cell);
1978 // methods related to evaluation queue
1979
1985 void Evaluate();
1986
1988 void AddToEvaluationQueue(GroupCell *cell);
1989
1990 void AddDocumentToEvaluationQueue();
1991
1994
1997
2000
2003
2006
2009
2012
2015
2016 void FoldOccurred();
2017
2018 // methods for folding
2020 GroupCell *Fold(GroupCell *which) { return m_document.Fold(which); }
2021
2023 GroupCell *Unfold(GroupCell *which) { return m_document.Unfold(which); }
2024
2027
2028 GroupCell *ToggleFoldAll(GroupCell *which) { return m_document.ToggleFoldAll(which); }
2029
2030 void FoldAll() { m_document.FoldAll(); }
2031
2032 void UnfoldAll() { m_document.UnfoldAll(); }
2033
2034 // methods for zooming the document in and out
2035 void SetZoomFactor(double newzoom);
2036
2037 void CommentSelection();
2038
2043 void OnScrollChanged(wxScrollEvent &ev);
2044 void OnScrollEvent(wxScrollWinEvent &ev);
2045 void CheckIfActiveCellScrolledOut();
2050 void OnMouseWheel(wxMouseEvent &event);
2051
2057 bool FindIncremental(const wxString &str, bool down, bool ignoreCase, bool searchInInput = true, bool searchInOutput = true);
2058 bool FindIncremental_RegEx(const wxString &str, bool down, bool searchInInput = true, bool searchInOutput = true);
2059
2060private:
2064 WorksheetSearch::SearchStart FindStart(bool down);
2070 bool ApplyFindResult(const WorksheetSearch::SearchTarget &target, bool warn);
2071public:
2078 bool FindNext(const wxString &str, bool down, bool ignoreCase, bool searchInInput = true, bool searchInOutput = true, bool warn = true);
2079 bool FindNext_Regex(const wxString &str, const bool &down, bool searchInInput = true, bool searchInOutput = true, bool warn = true);
2080
2085 void Replace(const wxString &oldString, const wxString &newString, bool ignoreCase);
2086 void Replace_RegEx(const wxString &oldString, const wxString &newString);
2087
2092 int ReplaceAll(const wxString &oldString, const wxString &newString, bool ignoreCase, bool searchInInput = true, bool searchInOutput = true);
2093 int ReplaceAll_RegEx(const wxString &oldString, const wxString &newString, bool searchInInput = true, bool searchInOutput = true);
2094
2105 void AnonymizeCodeCells();
2106
2117 std::size_t ForgetKnownAnswers();
2118
2119 wxString GetInputAboveCaret();
2120
2121 wxString GetOutputAboveCaret();
2122
2124 void LoadSymbols();
2125
2126 bool Autocomplete(AutoComplete::autoCompletionType type = AutoComplete::command);
2127
2129 void AddSymbol(const wxString &fun, AutoComplete::autoCompletionType type = AutoComplete::command)
2130 { m_autocomplete.AddSymbol(fun, type); }
2131
2133 void AddSymbols(const wxString &xml)
2134 { m_autocomplete.AddSymbols(xml); }
2136 void AddSymbols(const wxXmlDocument& xml)
2137 { m_autocomplete.AddSymbols(xml); }
2138
2139 void SetActiveCellText(const wxString &text);
2140
2141 bool InsertText(const wxString &text);
2142
2143 void OpenNextOrCreateCell();
2144
2146 void OnFollow();
2147
2150
2152 void SelectGroupCell(GroupCell *cell);
2153
2158 void SetAnswer(const wxString &answer);
2160 void QuestionAnswered();
2161
2166 bool QuestionPending() const
2167 { return m_document.QuestionPending(); }
2169
2173 void QuestionPending(bool pending)
2174 { m_document.SetQuestionPending(pending); }
2175
2176 void SetMaximaDocDir(const wxString &dir)
2177 {
2178 m_maximaDocDir = dir;
2179 }
2180 const wxString &GetMaximaDocDir() const { return m_maximaDocDir; }
2181
2183 bool GCContainsCurrentQuestion(const GroupCell *cell);
2184
2187 bool OpenQuestionCaret(const wxString &txt = {});
2188
2197 bool WillAutoAnswer() const;
2198 void UpdateScrollPos();
2199
2205 GroupCell *GetWorkingGroup(bool resortToLast = false) const;
2207 void LoadHelpFileAnchors(const wxString &docdir, const wxString &maximaVersion)
2208 {m_maximaManual.LoadHelpFileAnchors(docdir, maximaVersion);}
2209 wxString GetHelpfileAnchorName(const wxString &keyword)
2210 {return m_maximaManual.GetHelpfileAnchorName(keyword);}
2211 wxString GetHelpfileURL(const wxString &keyword)
2212 {return m_maximaManual.GetHelpfileURL(keyword);}
2213
2215 std::vector<wxString> m_replacementsForCurrentWord;
2216#if wxUSE_ACCESSIBILITY
2217 int GetAccessibilityId(Cell *cell) const;
2218#endif
2219
2220#if wxUSE_ACCESSIBILITY
2221 class AccessibilityInfo: public wxAccessible
2222 {
2223 public:
2224 AccessibilityInfo(wxWindow *parent, Worksheet *worksheet);
2225 wxAccStatus GetName (int childId, wxString *name);
2226 wxAccStatus GetChildCount (int *childCount);
2227 wxAccStatus GetChild (int childId, wxAccessible **child);
2228 wxAccStatus GetDefaultAction(int childId, wxString *actionName);
2229 wxAccStatus GetParent (wxAccessible ** parent);
2230 wxAccStatus GetFocus (int *childId, wxAccessible **child);
2231 wxAccStatus GetLocation (wxRect &rect, int elementId);
2232 wxAccStatus HitTest (const wxPoint &pt,
2233 int *childId, wxAccessible **childObject);
2234 wxAccStatus GetDescription(int childId, wxString *description);
2235 wxAccStatus GetRole(int childId, wxAccRole *role);
2236 wxAccStatus GetState(int childId, long *state);
2237 private:
2238 wxWindow *m_parent = nullptr;
2239 Worksheet *m_worksheet = nullptr;
2240
2241 class CaretAccessibilityInfo : public wxAccessible {
2242 public:
2243 CaretAccessibilityInfo(AccessibilityInfo* parent, Worksheet* worksheet)
2244 : wxAccessible(worksheet->GetTargetWindow()), m_parent(parent), m_worksheet(worksheet) {}
2245
2246 wxAccStatus GetName(int childId, wxString *name) override;
2247 wxAccStatus GetDescription(int WXUNUSED(childId), wxString *description) override;
2248 wxAccStatus GetParent(wxAccessible **parent) override;
2249 wxAccStatus GetChildCount(int *childCount) override;
2250 wxAccStatus GetChild(int childId, wxAccessible **child) override;
2251 wxAccStatus GetRole(int childId, wxAccRole *role) override;
2252 private:
2253 AccessibilityInfo* m_parent;
2254 Worksheet* m_worksheet;
2255 };
2256 CaretAccessibilityInfo* m_caretAccessible = nullptr;
2257
2264 class SelectionAccessibilityInfo : public wxAccessible {
2265 public:
2266 SelectionAccessibilityInfo(AccessibilityInfo* parent, Worksheet* worksheet)
2267 : wxAccessible(worksheet->GetTargetWindow()), m_parent(parent), m_worksheet(worksheet) {}
2268
2269 wxAccStatus GetName(int childId, wxString *name) override;
2270 wxAccStatus GetParent(wxAccessible **parent) override;
2271 wxAccStatus GetChildCount(int *childCount) override;
2272 wxAccStatus GetChild(int childId, wxAccessible **child) override;
2273 wxAccStatus GetRole(int childId, wxAccRole *role) override;
2274 wxAccStatus GetState(int childId, long *state) override;
2275 private:
2276 AccessibilityInfo* m_parent;
2277 Worksheet* m_worksheet;
2278 };
2279 SelectionAccessibilityInfo* m_selectionAccessible = nullptr;
2281 int SelectionChildId() const;
2282 public:
2284 static bool HasOutputSelection(const Worksheet *worksheet);
2285 };
2286#endif
2287 MaximaManual m_maximaManual;
2288 MaximaManual *GetMaximaManual() {return &m_maximaManual;}
2289protected:
2290 void FocusTextControl();
2300 wxBitmap m_memory;
2301 wxSize DoGetBestClientSize() const override;
2302#if wxUSE_ACCESSIBILITY
2303 AccessibilityInfo *m_accessibilityInfo = nullptr;
2304#endif
2306 int m_pointer_x = -1;
2308 int m_pointer_y = -1;
2310 bool m_mouseMotionWas = false;
2312 bool m_pointerCmdDown = false;
2314 bool m_linkCursorShown = false;
2316 static wxString LinkToolTip(const wxString &link);
2318 void UpdateLinkCursor(bool overLink);
2322 bool m_inPopupMenu = false;
2323};
2324
2325wxDECLARE_EVENT(TOC_UPDATE_NEEDED_EVENT, wxCommandEvent);
2326
2327#endif // WORKSHEET_H
This file declares the class AnimationCell.
The first number that is open for dynamic ID assignment.
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
Clipboard formats that are only rendered once a program asks for them (GH #2030).
This file contains the definition of the class EditorCell.
The evaluation queue.
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:43
This file declares the class MaximaManual.
This file defines the class Notification.
The output of a cell as a tree the keyboard can walk through (GH #2382).
Declares PdfExport, which writes a worksheet to a tagged (accessible) PDF.
The definition of the class RecentDocuments that provides a recent files mechanism that is extensible...
std::uint8_t Format
The formatting of one character: a combination of the flags below.
Definition: TextFormat.h:68
int group
Neighbouring sections of the same group aren't separated.
Definition: ToolBarSections.cpp:45
This file declares the class ToolBar that represents wxMaxima's main tool bar.
std::list< TreeUndoAction > UndoActions
The type of the list of tree actions that can be undone.
Definition: TreeUndoAction.h:141
Declares TreeUndoManager: the owner of the cell-tree undo/redo state.
This file contains the definition of the class Unicodesidebar that allows to select arbitrary unicode...
The file that contains the "variables" sidepane.
Turns mouse wheel rotation into whole wheel steps.
The worksheet's "between the cells" cursor (the horizontally drawn caret).
The narrow "something in the document changed" surface a WorksheetDocument needs to poke its view.
The document half of the worksheet: the state and commands that describe the edited document itself,...
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:136
void AddSymbol(wxString fun, autoCompletionType type=command)
Manually add an autocompletable symbol to our symbols lists.
Definition: Autocomplete.cpp:728
Definition: AutocompletePopup.h:47
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
GroupCell * GetGroup() const
Returns the group cell this cell belongs to.
Definition: Cell.cpp:290
CellType GetType() const
Returns the type of this cell.
Definition: Cell.h:579
The configuration storage for the current worksheet.
Definition: Configuration.h:102
void ReadConfig()
Read the config from the wxConfig object.
Definition: Configuration.cpp:633
A list of editor cells containing error messages.
Definition: CellPointers.h:58
The document-model half of the cell-pointer registry.
Definition: CellPointers.h:54
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:97
const CellPtr< Cell > & GetSelectionEnd() const
The last cell of the currently selected range of cells, or null.
Definition: CellPointers.h:99
void SetCurrentTextCell(TextCell *cell)
Set the text cell maxima's incoming text is being appended to (may be null).
Definition: CellPointers.cpp:137
bool HasCellsSelected() const
Are any whole cells (as opposed to text inside an editor) selected?
Definition: CellPointers.h:92
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:244
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:67
const wxString & GetValue() const override
Returns the text contained in this cell.
Definition: EditorCell.h:237
bool CanCopy() const override
Select Can we copy the editable text of this cell?
Definition: EditorCell.h:535
A simple FIFO queue with manual removal of elements.
Definition: EvaluationQueue.h:44
The find+replace dialog.
Definition: FindReplaceDialog.h:42
The find+replace pane.
Definition: FindReplacePane.h:47
A cell grouping input (and, if there is one, also the output) cell to a foldable item.
Definition: GroupCell.h:88
GroupCell * GetNext() const
Get the next GroupCell in the list.
Definition: GroupCell.h:305
Definition: ImgCellBase.h:44
Definition: ImgCell.h:35
A Cell that displays a matrix.
Definition: MatrCell.h:107
The native scrollbars of the matrices a worksheet shows in a viewport.
Definition: MatrixScrollbars.h:64
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:548
A class that maintains a list of recent documents.
Definition: RecentDocuments.h:42
A Text cell.
Definition: TextCell.h:40
Definition: ToolBar.h:44
GroupType GetCellType()
Get the cell style for new cells.
Definition: ToolBar.cpp:612
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
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 view/interaction half of the cell-pointer registry.
Definition: CellPointers.h:341
const CellPtr< EditorCell > & MouseSelectionStart() const
The EditorCell a mouse selection was started in, or null.
Definition: CellPointers.h:368
int IndexSearchStartedAt() const
The cursor position an incremental search was started at (-1 = none).
Definition: CellPointers.h:356
const CellPtr< EditorCell > & KeyboardSelectionStart() const
The EditorCell a keyboard selection was started in, or null.
Definition: CellPointers.h:377
const CellPtr< EditorCell > & SearchStart() const
The EditorCell an incremental search was started in, or null.
Definition: CellPointers.h:354
void SetScrollToCellScheduled(bool scheduled)
Schedule (or cancel) scrolling to CellToScrollTo().
Definition: CellPointers.h:351
The between-the-cells cursor: active flag, position, selection anchors.
Definition: WorksheetCursor.h:49
void Deactivate()
Deactivate; the position is kept for a later re-activation.
Definition: WorksheetCursor.h:56
bool IsActive() const
Is this (rather than the in-cell text cursor) the active cursor?
Definition: WorksheetCursor.h:52
The view notifications a WorksheetDocument emits when it edits itself.
Definition: WorksheetDocumentView.h:50
The view-independent state and commands of an edited worksheet document.
Definition: WorksheetDocument.h:61
bool CanMergeSelection() const
Can the current selection (of more than one cell) be merged into one?
Definition: WorksheetDocument.cpp:361
CellPtr< GroupCell > & LastCache() const
The cached pointer to the document's last GroupCell (<0 = unknown).
Definition: WorksheetDocument.h:93
bool CanRedoInsideCell() const
Can the active cell's own (intra-cell) redo be invoked right now?
Definition: WorksheetDocument.cpp:390
void SetSaved(bool saved)
Record whether the document is in its saved state.
Definition: WorksheetDocument.cpp:34
void FoldAll()
Recursively folds every foldable cell in the document.
Definition: WorksheetDocument.cpp:317
void UnfoldAll()
Recursively unfolds every folded cell in the document.
Definition: WorksheetDocument.cpp:326
bool QuestionPending() const
Is Maxima currently waiting for an answer to a question?
Definition: WorksheetDocument.h:215
bool CanUndoInsideCell() const
Can the active cell's own (intra-cell) undo be invoked right now?
Definition: WorksheetDocument.cpp:386
bool IsSaved() const
True while the document has no unsaved changes.
Definition: WorksheetDocument.h:226
void SetCurrentFile(const wxString &file)
Record the file this document is associated with.
Definition: WorksheetDocument.h:205
EvaluationQueue & GetEvaluationQueue()
The list of cells scheduled to be sent to Maxima for evaluation.
Definition: WorksheetDocument.h:64
GroupCell * Unfold(GroupCell *which)
Unfold which; see GroupCell::Unfold(). Mirrors Fold().
Definition: WorksheetDocument.cpp:277
bool IsSelectionInWorkingGroup() const
Is the selection start inside the group Maxima is currently evaluating?
Definition: WorksheetDocument.cpp:381
DocumentCellPointers & GetCellPointers()
The document-model half of the cell-pointer registry (selection, the active/answer/current-text cell,...
Definition: WorksheetDocument.h:221
bool IsSelected(CellType type) const
Is the selection exactly one cell of the given type?
Definition: WorksheetDocument.cpp:374
GroupCell * ToggleFold(GroupCell *which)
Fold or unfold which, whichever it currently isn't; see GroupCell::Fold()/Unfold().
Definition: WorksheetDocument.cpp:292
TreeUndoManager & GetTreeUndo()
The document's undo/redo history of tree-structure edits.
Definition: WorksheetDocument.h:69
const wxString & GetCurrentFile() const
The file this document was last loaded from / saved to (empty if none).
Definition: WorksheetDocument.h:203
std::unique_ptr< GroupCell > & TreeOwner()
Mutable access to the owning pointer of the cell tree.
Definition: WorksheetDocument.h:87
const wxString & GetLastQuestion() const
The text of the Maxima question the user is currently being asked.
Definition: WorksheetDocument.h:208
bool CanDeleteSelection() const
Can the current selection be deleted right now (see CanRemoveCells())?
Definition: WorksheetDocument.cpp:353
bool CanEdit() const
Is exactly one cell selected, and does it directly follow Maxima's own input prompt (as opposed to be...
Definition: WorksheetDocument.cpp:335
void SetQuestionPending(bool pending)
Record whether Maxima is waiting for an answer to a question.
Definition: WorksheetDocument.h:217
WorksheetCursor & GetCursor()
The between-cells cursor (the h-caret) and its group-level selection.
Definition: WorksheetDocument.h:74
GroupCell * GetTree() const
The first GroupCell of the document (null when the document is empty).
Definition: WorksheetDocument.h:79
void SetLastQuestion(const wxString &lastQuestion)
Remember the text of the question Maxima is currently asking.
Definition: WorksheetDocument.h:210
GroupCell * ToggleFoldAll(GroupCell *which)
Like ToggleFold(), but folds/unfolds which's whole subtree.
Definition: WorksheetDocument.cpp:299
void OutputChanged()
Note that a cell's output changed.
Definition: WorksheetDocument.h:241
GroupCell * Fold(GroupCell *which)
Fold which; see GroupCell::Fold().
Definition: WorksheetDocument.cpp:262
The layout/recalculation engine of a worksheet.
Definition: WorksheetLayout.h:54
void RequestFullRecalculation()
Schedule a recalculation of the whole worksheet.
Definition: WorksheetLayout.cpp:330
void RequestAdjustSize()
Flag the virtual (scroll) size as needing re-adjustment.
Definition: WorksheetLayout.h:143
void RequestRecalculation(Cell *start)
Schedule a recalculation of the worksheet starting with the cell start.
Definition: WorksheetLayout.cpp:272
void GetMaxPoint(int *width, int *height)
Get the coordinates of the bottom right point of the worksheet.
Definition: WorksheetLayout.cpp:352
void UpdateConfigurationClientSize()
Inform the configuration about the view's current client size.
Definition: WorksheetLayout.cpp:339
int GetLastCellsVisited() const
GroupCells walked by the most recent RecalculateIfNeeded() pass (visited includes cheap reposition-on...
Definition: WorksheetLayout.h:231
void AdjustSize()
Adjust the virtual size and scrollbars to the document's extent.
Definition: WorksheetLayout.cpp:398
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:239
Scoped SetAsyncOutputTarget(), so an early return or a throw while appending can't leave every subseq...
Definition: Worksheet.h:1268
Lays out the output of all lines appended in this scope once, at its end.
Definition: Worksheet.h:1198
The canvas that contains the spreadsheet the whole program is about.
Definition: Worksheet.h:123
void OnContextMenuKey(wxContextMenuEvent &event)
Opens the right-click menu for the selection from the keyboard (GH #2382)
Definition: Worksheet.cpp:1470
static constexpr bool HasPrimarySelection()
Does this platform have a primary selection?
Definition: Worksheet.h:1544
bool IsActiveInLast() const
Is the editor active in the last cell of the worksheet?
Definition: Worksheet.h:1862
bool RenderClipboardContents()
Replace this worksheet's lazily rendered clipboard data by data that no longer needs the worksheet (G...
Definition: Worksheet.cpp:3149
GroupCell * ToggleFold(GroupCell *which)
Fold or unfold a cell.
Definition: Worksheet.h:2026
void OnTimer(wxTimerEvent &event)
Is executed if a timer associated with Worksheet has expired.
Definition: Worksheet.cpp:4525
void ClearSelection()
Clear the selection - make it empty, i.e. no selection.
Definition: Worksheet.h:1729
void RequestRedraw(GroupCell *start=nullptr)
Request the worksheet to be redrawn.
Definition: Worksheet.cpp:544
bool CanMergeSelection() const
Can we merge the selected cells into one?
Definition: Worksheet.h:1114
bool IsSelectionInWorkingGroup() const
Is the selection in the current working group?
Definition: Worksheet.h:1872
void InsertSymbol(const wxString &symbol)
Types a symbol from a sidebar button or a symbol's keyboard shortcut.
Definition: Worksheet.cpp:313
int GetLastCellsRecalculated() const
How many cells the last layout pass truly recalculated. See WorksheetLayout.
Definition: Worksheet.h:1329
void SetViewScrollRate(int rate) override
Set the scroll granularity (device pixels per scroll unit) on both axes.
Definition: Worksheet.h:133
ImgCellBase * GetSelectedImgCellBase() const
Returns the selected cell - or nullptr, if the selection isn't image nor animation.
Definition: Worksheet.h:1476
MatrCell * GetSelectedScrollingMatrix() const
The scrolling matrix the selection lies in, or nullptr (GH #2479)
Definition: Worksheet.cpp:1872
void KeepCursorStillOnScreen()
Keep the cursor where it is on screen while a cell's output changes.
Definition: Worksheet.cpp:1168
wxString RTFStart() const
The start of a RTF document.
Definition: Worksheet.cpp:7517
int m_pointer_x
The x position of the mouse pointer.
Definition: Worksheet.h:2306
void SetDefaultHCaret()
Set the HCaret to its default location, at the end of the document.
Definition: Worksheet.cpp:6273
bool CanDeleteRegion(GroupCell *start, const GroupCell *end) const
Is it possible to delete the cells between start and end?
Definition: Worksheet.cpp:3194
void AddSectionToEvaluationQueue(GroupCell *start)
Adds a chapter, a section or a subsection to the evaluation queue.
Definition: Worksheet.cpp:5312
void AddSymbols(const wxString &xml)
Add a xml-encoded list of symbols to the autocompletion list.
Definition: Worksheet.h:2133
void SelectOutputRect(GroupCell *group, wxPoint down, wxPoint up)
Select what a rectangle dragged across a cell's output covers.
Definition: Worksheet.cpp:2131
bool CutToClipboard()
Add the currently selected cells to the clipboard and delete them.
Definition: Worksheet.cpp:5889
void SelectOutputItem(const OutputNavigation::Item &item)
Select a node of the output tree, scroll to it and announce it.
Definition: Worksheet.cpp:2230
void GetViewPosition(int *x, int *y) const override
The view's position within its parent, in device pixels (wxWindow::GetPosition).
Definition: Worksheet.h:134
WorksheetDocument m_document
The view-independent document state (file, current question, ...) that Worksheet's document accessors...
Definition: Worksheet.h:2294
FindReplacePane * m_findPane
The dockable find-and-replace sidebar (GH #2249), set once by wxMaximaFrame at startup and never dest...
Definition: Worksheet.h:1102
std::optional< std::size_t > SelectedOutputResult() const
Which result of its cell's output is selected, if exactly one is.
Definition: Worksheet.cpp:2197
std::unique_ptr< wxDataObject > CreateCellsDataObject() const
Build the multi-format clipboard object for a whole-cell selection.
Definition: Worksheet.cpp:3011
GroupCell * GetInsertGroup() const
The group that the line's cells will belong to - used by InsertLine.
Definition: Worksheet.cpp:1076
void OnCharNoActive(wxKeyEvent &event)
Key pressed and no cell was active.
Definition: Worksheet.cpp:4031
bool QuestionPending() const
Does maxima wait for the answer of a question?
Definition: Worksheet.h:2166
void AddEntireDocumentToEvaluationQueue()
Schedule all cells in the document for evaluation.
Definition: Worksheet.cpp:5303
WorksheetLayout::ScrollAnchor GetScrollAnchor() const
Where the cursor is, as the layout engine's scroll compensation needs it.
Definition: Worksheet.cpp:1160
static wxString CellsToMathML(const Cell *cells)
A MathML document showing a list of cells, nicely indented.
Definition: Worksheet.cpp:2744
bool CopyCSV() const
Copy the selected matrix, or block of one, to the clipboard as CSV.
Definition: Worksheet.cpp:2824
GroupCell * FirstVisibleGC()
The first groupCell that is currently visible.
Definition: Worksheet.cpp:1744
static std::unique_ptr< wxDataObject > CreateIndependentDataObject(const ClipboardContents &contents)
The data RenderClipboardContents() puts on the clipboard.
Definition: Worksheet.cpp:3116
bool HasTextFormat(TextFormat::Format flag) const
Is this character format on where the cursor is? (For the toolbar.)
Definition: Worksheet.cpp:6349
bool NavigateOutput(int keyCode, bool shift)
Walk through the parts of the selected output with the keyboard.
Definition: Worksheet.cpp:2318
bool CanFormatText() const
Is the cursor in a cell whose text can be formatted?
Definition: Worksheet.cpp:6354
void SetAsyncOutputTarget(GroupCell *cell)
Routes output to one specific cell instead of the one being evaluated.
Definition: Worksheet.h:1261
void UpdateConfigurationClientSize()
Inform the configuration about the current client size.
Definition: Worksheet.h:1741
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:6772
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:2207
bool ExportToHTML(const wxString &file)
Export the file to an html document.
Definition: Worksheet.cpp:4919
void OpenHCaret(const wxString &txt={})
Place the cursor into a new cell where the horizontal cursor is.
Definition: Worksheet.h:1890
void NotifyAdjustSizeNeeded() override
The scrollable size will need re-adjusting once cell positions settle.
Definition: Worksheet.h:163
void ApplyOverlayScrollbarsSetting()
Apply the configuration's OverlayScrollbars() choice to this window.
Definition: Worksheet.cpp:572
TextCell * GetSelectedTextCell() const
Returns the selected cell - or nullptr, if the selection isn't a text cell.
Definition: Worksheet.h:1484
void SetAttentionCallback(std::function< void(bool)> callback)
Is called with true when a notification is raised and with false once it is cleared,...
Definition: Worksheet.h:891
void ScrollToError()
Unfold the cell that produced the error, if necessary and, if requested, scroll to it.
Definition: Worksheet.cpp:998
bool HCaretActive() const
Is the vertically-drawn cursor active?
Definition: Worksheet.h:1105
void OnEraseBackground(wxEraseEvent &WXUNUSED(event))
Cannot be static as it is called using a function pointer to an object.
Definition: Worksheet.h:731
void ClearDocument()
Empties the current document.
Definition: Worksheet.cpp:1300
~Worksheet() override
The destructor.
Definition: Worksheet.cpp:597
wxString RTFEnd() const
The end of a RTF document.
Definition: Worksheet.cpp:7521
ViewCellPointers m_viewCellPointers
The transient view-state half of the cell-pointer registry (hover, selection anchors,...
Definition: Worksheet.h:2298
void UpdateTableOfContents()
Update the table of contents.
Definition: Worksheet.cpp:7920
void RemoveAllOutput()
Remove all output cells from the whole worksheet.
Definition: Worksheet.cpp:6373
Cell * GetSelectionEnd() const
Return the last of the currently selected cells.
Definition: Worksheet.h:1725
void QuestionPending(bool pending)
Does maxima currently wait for the answer of a question?
Definition: Worksheet.h:2173
void ClickNDrag(wxPoint down, wxPoint up)
Select the rectangle surrounded by down and up.
Definition: Worksheet.cpp:2064
FindReplacePane * GetActiveFindPane() const
Whichever find/replace UI is actually in use right now: the dockable sidebar (GH #2249) if Configurat...
Definition: Worksheet.cpp:6578
DocumentCellPointers & GetDocumentCellPointers()
The document-model half of the cell-pointer registry (owned by m_document).
Definition: Worksheet.h:967
const wxString & GetCurrentFile() const
The name of the currently-opened file.
Definition: Worksheet.h:1066
void SetCurrentFile(const wxString &file)
Set the name of the currently-opened file.
Definition: Worksheet.h:1068
RecentDocuments & UnsavedDocuments()
The list of unsaved (autosaved) documents offered for recovery.
Definition: Worksheet.h:167
static bool OpenLink(const wxString &url)
Opens a link from a text cell in the user's web browser (GH #2396).
Definition: Worksheet.cpp:1942
bool CopyHTML() const
Copy a self-contained HTML version (inline CSS, base64-embedded images – see WorksheetExport::Selecti...
Definition: Worksheet.cpp:4726
void DeleteCurrentCell()
Delete the currently active cell - or the cell above this one.
Definition: Worksheet.cpp:3179
AutoComplete & GetAutocomplete()
The storage for the autocompletion feature.
Definition: Worksheet.h:943
AnimationCell * GetSelectedAnimation() const
Returns the selected cell - or nullptr, if the selection isn't an animation.
Definition: Worksheet.h:1436
void Replace(const wxString &oldString, const wxString &newString, bool ignoreCase)
Replace the current occurrence of a string.
Definition: Worksheet.cpp:6738
bool CopyMatlab() const
Copy a Matlab representation of the current selection to the clipboard.
Definition: Worksheet.cpp:2885
bool CopyText() const
Copy a textual representation of the current selection to the clipboard.
Definition: Worksheet.cpp:2962
wxString GetLinkAt(wxPoint point)
The link drawn at a point in worksheet coordinates, or "".
Definition: Worksheet.cpp:1967
bool StepOutputResult(int keyCode)
Move between results with the Up or Down key while no editor is active.
Definition: Worksheet.cpp:2260
bool m_inPopupMenu
Is there an active popup menu?
Definition: Worksheet.h:2322
EvaluationQueue & GetEvaluationQueue()
The list of cells that have to be evaluated.
Definition: Worksheet.h:2014
bool PasteMathAsMaxima()
Paste LaTeX or MathML maths from the clipboard as a Maxima command.
Definition: Worksheet.cpp:5916
void Animate(bool run=true) const
Animate the current slide show.
Definition: Worksheet.cpp:6250
static GroupCell * StartOfSectioningUnit(GroupCell *start)
Finds the start of the current chapter/section/...
Definition: Worksheet.cpp:3588
bool CopyRTF() const
Copy a rtf version of the current selection to the clipboard.
Definition: Worksheet.cpp:4670
void UpdateConfig()
Re-read the configuration.
Definition: Worksheet.h:1048
int m_pointer_y
The y position of the mouse pointer.
Definition: Worksheet.h:2308
MatrixScrollbars & GetMatrixScrollbars()
The native scrollbars of matrices shown in a scrolling viewport.
Definition: Worksheet.h:931
std::size_t ForgetKnownAnswers()
Forget the answers to Maxima's questions remembered by some cells (GH #1018)
Definition: Worksheet.cpp:6856
bool Copy(bool astext=false) const
Copy the current selection to the clipboard.
Definition: Worksheet.cpp:2546
bool CopyAnimation() const
Copy the current animation to the clipboard.
Definition: Worksheet.cpp:4648
const wxString UnicodeToMaxima(wxString s) const
Make a few unicode characters interpretable by maxima.
Definition: Worksheet.h:1086
void StepAnimation(int change=1)
Set the slide of the currently selected animation or advance it by one step.
Definition: Worksheet.cpp:4499
GroupCell * Unfold(GroupCell *which)
Unfold a cell (see WorksheetDocument::Unfold())
Definition: Worksheet.h:2023
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:4000
void SetAnswer(const wxString &answer)
Handling questions from and answers for maxima.
Definition: Worksheet.cpp:3307
bool CanCopyCSV() const
Is the selection a matrix, or a block of one, that "Copy as CSV" can copy?
Definition: Worksheet.cpp:2801
wxString m_contextMenuLink
The link the last context menu was opened on, see GetContextMenuLink().
Definition: Worksheet.h:2320
ViewCellPointers & GetViewCellPointers()
The transient view-state half of the cell-pointer registry (owned here).
Definition: Worksheet.h:970
void OnChar(wxKeyEvent &event)
Key for a printable character pressed.
Definition: Worksheet.cpp:4385
bool ScrollSelectedMatrix(const wxMouseEvent &event)
Lets a mouse wheel event scroll the selected scrolling matrix (GH #2479)
Definition: Worksheet.cpp:1893
void SelectWithChar(int ccode)
Handle selecting text using the keyboard Is called when the all of the following is true:
Definition: Worksheet.cpp:3863
void AddSelectionToEvaluationQueue()
Schedule all cells in the selection to be evaluated.
Definition: Worksheet.cpp:5341
bool HasCellsSelected() const
Is at least one entire cell selected?
Definition: Worksheet.h:1385
bool ScrollAnchorVisible()
Is the cursor on screen?
Definition: Worksheet.cpp:1185
long GetStalePaintCount() const
How many paints drew for another scroll position than the one they ended with.
Definition: Worksheet.h:156
std::optional< Notification > & GetNotification()
The error notification message, if any.
Definition: Worksheet.h:868
void OnSetFocus(wxFocusEvent &event)
What to do if the worksheet is in the input focus.
Definition: Worksheet.cpp:6212
void SetNotification(const wxString &message, int flags=wxICON_INFORMATION)
Inform the user that something happened in a non-active window.
Definition: Worksheet.cpp:4372
bool ExportToPDF(const wxString &file, const PdfExport::Options &options=PdfExport::Options())
Export to a tagged PDF file, see PdfExport.
Definition: Worksheet.cpp:4948
bool IsSelected(CellType type) const
Does the selection start with a cell of the type "type".
Definition: Worksheet.h:1851
GroupCell * GetAsyncOutputTarget() const
The cell async output is currently being routed to, if any.
Definition: Worksheet.h:1263
void ScheduleScrollToCell(Cell *cell, bool scrollToTop=true)
Schedules scrolling to a given cell.
Definition: Worksheet.h:1811
int GetViewScrollUnitY() const override
The current vertical scroll position, in scroll units (not pixels).
Definition: Worksheet.h:129
GroupCell * InsertGroupCells(std::unique_ptr< GroupCell > &&cells, GroupCell *where, UndoActions *undoBuffer)
Insert group cells into the worksheet.
Definition: Worksheet.cpp:978
void AddDocumentTillHereToEvaluationQueue()
Schedule all cells stopping with the one the caret is in for evaluation.
Definition: Worksheet.cpp:5357
void OnComplete(wxCommandEvent &event)
Is called if an action from the autocomplete menu is selected.
Definition: Worksheet.cpp:7257
bool CanAnimate() const
Does it make sense to enable the "Play" button and the slider now?
Definition: Worksheet.h:1492
bool RecalculateIfNeeded(bool timeout=false, long timeSliceMs=50)
Actually recalculate the worksheet.
Definition: Worksheet.h:1300
bool m_mouseMotionWas
Was there a mouse motion we didn't react to until now?
Definition: Worksheet.h:2310
void SelectAll()
Select the whole document.
Definition: Worksheet.cpp:6135
void DeactivateHCaret()
Hides the horizontal cursor, e.g. in a worksheet nothing can be inserted into.
Definition: Worksheet.h:1107
void OnKillFocus(wxFocusEvent &event)
What to do if the worksheet looses the input focus.
Definition: Worksheet.cpp:6224
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:1093
void ClearNotification()
Clears the notification message from SetNotification.
Definition: Worksheet.cpp:4362
void OnPaint(wxPaintEvent &event)
Is called by wxWidgets when it wants to redraw the worksheet or a part of it.
Definition: Worksheet.cpp:643
void OnFollow()
Called when the "Scroll to currently evaluated" button is pressed.
Definition: Worksheet.cpp:7441
void PrepareDrawGC(wxDC &dc) const
All that has need to be done before drawing a GroupCell in a DC.
Definition: Worksheet.cpp:833
void OnCharInActive(wxKeyEvent &event)
Key pressed inside a cell.
Definition: Worksheet.cpp:3632
Cell * GetSelectionStart() const
Return the first of the currently selected cells.
Definition: Worksheet.h:1718
void FoldOccurred()
Call when a fold action was detected, to update the state in response to a fold occurring.
Definition: Worksheet.cpp:1388
void OnMouseCaptureLost(wxMouseCaptureLostEvent &event)
Is called if we loose the mouse connection whilst selecting text/cells.
Definition: Worksheet.cpp:7525
wxTimer & KeyboardInactiveTimer()
The timer that tells us when the keyboard is inactive so an autosave isn't disrupting.
Definition: Worksheet.h:1147
ClickType
An enum for all classes of items one can click on.
Definition: Worksheet.h:425
ImgCell * GetSelectedImgCell() const
Returns the selected cell - or nullptr, if the selection isn't an image.
Definition: Worksheet.h:1468
Cell * FindCellByUUID(const wxString &uuid)
Find a cell by its UUID.
Definition: Worksheet.cpp:5405
void EraseBackground(wxEraseEvent &event)
Is called if wxWidgets wants to erase the worksheet's background.
Definition: Worksheet.cpp:335
bool StepSelectedMatrixBlock(int keyCode)
Grow or shrink the selected block of a matrix's entries (GH #2370)
Definition: Worksheet.cpp:2451
bool CanDeleteSelection() const
Is it possible to delete the currently selected cells?
Definition: Worksheet.h:1427
ToolBar * m_mainToolBar
The toolbar of the main window: We need to access it and therefore have it defined here.
Definition: Worksheet.h:2149
bool CaretVisibleIs()
Is the caret (hcaret or vcaret) currently visible on the worksheet?
Definition: Worksheet.cpp:6674
EditorCell * GetActiveCell() const
Get the currently active EditorCell.
Definition: Worksheet.h:951
bool UpdateControlsNeeded()
Is an update of the worksheet controls needed?
Definition: Worksheet.h:172
bool CopyCells() const
Copy the selection to the clipboard as it would appear in a .wxm file.
Definition: Worksheet.cpp:2995
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:3322
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:6515
GroupCell * GetLastCell()
Returns the last cell of the worksheet.
Definition: Worksheet.h:1866
GroupCell * GetHCaret()
The cell the horizontal cursor is above. nullptr means at the start of the document.
Definition: Worksheet.cpp:6256
wxString ConvertSelectionToMathML() const
Convert the current selection to MathML.
Definition: Worksheet.cpp:2733
bool CanUndoInsideCell() const
Is it possible to issue an undo in the currently selected cell?
Definition: Worksheet.h:1908
void PasteFromClipboard(bool primary=false)
Paste into the worksheet.
Definition: Worksheet.cpp:5978
void SetHCaret(GroupCell *where)
Set the HCaret at the location of the given Cell.
Definition: Worksheet.cpp:6283
bool CanRedoInsideCell() const
Is it possible to issue an undo in the currently selected cell?
Definition: Worksheet.h:1927
bool GCContainsCurrentQuestion(const GroupCell *cell)
Does the GroupCell cell points to contain the question currently asked by maxima?
Definition: Worksheet.cpp:3560
const wxString & GetContextMenuLink() const
The link the last context menu was opened on, or an empty string.
Definition: Worksheet.h:723
bool WillAutoAnswer() const
Execute all collected scroll events in one go.
Definition: Worksheet.cpp:3315
void ToggleTextFormat(TextFormat::Format flag)
Switch a character format (bold, ...) of the active text cell on or off.
Definition: Worksheet.cpp:6332
bool IsEmpty() const
Is this worksheet empty?
Definition: Worksheet.h:836
void NumberSections() const
Renumber all sections.
Definition: Worksheet.cpp:1333
std::optional< OutputNavigation::Item > SelectedOutputItem() const
The selected part of an output, as a node of OutputNavigation's tree.
Definition: Worksheet.cpp:2217
void SetViewVirtualSize(int width, int height) override
Set the scrollable (virtual) area, in device pixels.
Definition: Worksheet.h:131
static wxString SelectionRTFBody(const Cell *cells, bool matrixEntries)
The RTF for a copy of the selection, without RTFStart() and RTFEnd()
Definition: Worksheet.cpp:2507
void OnKeyDown(wxKeyEvent &event)
A special key has been pressed.
Definition: Worksheet.cpp:3447
GroupCell * FindGroupCellByUUID(const wxString &uuid) const
Finds a GroupCell by its UUID, or nullptr if no cell has that UUID.
Definition: Worksheet.cpp:1058
EditorCell * KeyboardSelectionStart() const
Tells us which cell the keyboard selection has started in.
Definition: Worksheet.h:954
void SetSelection(Cell *sel)
Select the cell sel.
Definition: Worksheet.h:1732
void AddCellToEvaluationQueue(GroupCell *gc)
Schedule this cell for evaluation.
Definition: Worksheet.cpp:5375
void SetCellStyle(GroupCell *group, GroupType style)
Change the style of a cell.
Definition: Worksheet.cpp:3236
bool Autocomplete(AutoComplete::autoCompletionType type=AutoComplete::command)
Definition: Worksheet.cpp:7004
wxString SelectionToCSV() const
The selected matrix, or selected block of one, as CSV (GH #2364)
Definition: Worksheet.cpp:2815
wxBitmap m_memory
A memory we can manually buffer the contents of the area that is to be redrawn in.
Definition: Worksheet.h:2300
void LoadSymbols()
Compile a list of known autocompletion symbols.
Definition: Worksheet.cpp:4958
void SelectGroupCell(GroupCell *cell)
Set this cell as the currently selected one.
Definition: Worksheet.cpp:7427
void AddSymbols(const wxXmlDocument &xml)
Add a xml-encoded list of symbols to the autocompletion list.
Definition: Worksheet.h:2136
void ShowPoint(wxPoint point)
Scrolls to a point on the worksheet.
Definition: Worksheet.cpp:5840
void WindowActive(bool active)
Is this window active?
Definition: Worksheet.h:876
bool ExportToTeX(const wxString &file)
export to a LaTeX file
Definition: Worksheet.cpp:4941
void AdjustSize()
Adjust the virtual size and scrollbars; see WorksheetLayout::AdjustSize().
Definition: Worksheet.h:728
void ScrollViewToUnitY(int unitY) override
Scroll without showing any frame in between (the scroll compensation)
Definition: Worksheet.h:148
void ShowHCaret()
Activates the horizontal cursor.
Definition: Worksheet.cpp:6315
bool SelectWholeCellsFromOutput(int ccode)
Shift+Up/Down with something inside a cell's output selected.
Definition: Worksheet.cpp:3960
TimerIDs
An enum of individual IDs for all timers this class handles.
Definition: Worksheet.h:435
static wxString LinkToolTip(const wxString &link)
The tooltip for the pointer being over link: its address and how to open it.
Definition: Worksheet.cpp:1951
void CodeCellVisibilityChanged()
To be called after enabling or disabling the visibility of code cells.
Definition: Worksheet.cpp:4929
void UpdateLinkCursor(bool overLink)
Shows the hand cursor while the pointer is over a link and Ctrl is held.
Definition: Worksheet.cpp:1959
void ScrollToCaret()
Request to scroll to the cursor as soon as wxMaxima is idle.
Definition: Worksheet.h:1798
bool OpenMatrixViewerAt(wxPoint position)
Opens a MatrixViewer if there is a partially shown matrix at this point.
Definition: Worksheet.cpp:5223
wxString LinkUnderPointer()
The link a text cell or the output draws under the mouse pointer, or "".
Definition: Worksheet.cpp:1978
void MarkRefreshAsDone()
Handle redrawing the worksheet or of parts of it.
Definition: Worksheet.h:1001
bool CopyMathML() const
Copy the MathML representation of the current selection to the clipboard.
Definition: Worksheet.cpp:2858
bool CopyBitmap() const
Copy a bitmap of the current selection to the clipboard.
Definition: Worksheet.cpp:4642
bool CanCopyAsMathML() const
Would "Copy as MathML" of the current selection produce actual math?
Definition: Worksheet.cpp:2839
void GetViewClientSize(int *width, int *height) const override
The visible client area, in device pixels.
Definition: Worksheet.h:127
GroupCell * Fold(GroupCell *which)
Fold a cell (see WorksheetDocument::Fold())
Definition: Worksheet.h:2020
bool PointVisibleIs(wxPoint point)
Is the point currently visible on the worksheet?
Definition: Worksheet.cpp:5819
std::unique_ptr< Cell > CopySelection(bool asData=false) const
Copy the currently selected cells.
Definition: Worksheet.cpp:4839
bool EnterOutputFromInput()
Down at the end of a cell's input: select the output's first result.
Definition: Worksheet.cpp:2304
GroupCell * GetLastCellInWorksheet() const
Returns a pointer to the last cell of this worksheet.
Definition: Worksheet.cpp:2059
void ScrollToStart()
Scroll to the start of the worksheet.
Definition: Worksheet.h:1092
void NotifyRecalculation(GroupCell *start) override
Schedule a re-layout of the document starting at start (null = all).
Definition: Worksheet.h:160
void SetContextMenuLink(const wxString &link)
Remembers the link the context menu is being opened on.
Definition: Worksheet.h:725
void AddSymbol(const wxString &fun, AutoComplete::autoCompletionType type=AutoComplete::command)
Add a symbol to the autocompletion list.
Definition: Worksheet.h:2129
bool CanEdit() const
We can edit the input if the we have the whole input in selection!
Definition: Worksheet.h:1745
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:6608
bool MatrixEntriesSelected() const
Are the entries of a matrix selected, rather than the matrix? (GH #959)
Definition: Worksheet.cpp:2503
bool SectioningMoveIn(GroupCell *parent)
Make this chapter/section/... a section/subsection/... changing its subheadings, too.
Definition: Worksheet.cpp:7294
wxBitmap ConvertSelectionToBitmap() const
Convert the current selection to a bitmap.
bool RedrawIfRequested()
Redraw the worksheet if RequestRedraw() has been called.
Definition: Worksheet.cpp:347
bool ExportToMAC(const wxString &file)
Export the file to a text file maxima's load command can read.
Definition: Worksheet.cpp:5118
wxString SelectionToSelfContainedHTML() const
What CopyHTML() puts on the clipboard, without touching the clipboard.
Definition: Worksheet.cpp:4708
void OnZoom(wxZoomGestureEvent &event)
Handle pinch-to-zoom-events using the gesture interface.
Definition: Worksheet.cpp:4488
bool m_linkCursorShown
Does the worksheet currently show the hand cursor for a link?
Definition: Worksheet.h:2314
void SetActiveCell(EditorCell *cell)
Mark an editor cell as the active one.
Definition: Worksheet.cpp:5735
FindReplaceDialog * m_findDialog
The find-and-replace-dialog.
Definition: Worksheet.h:1098
void DrawGroupCell(wxDC &dc, wxDC &adc, GroupCell &cell)
Draws a groupcell on the DC.
Definition: Worksheet.cpp:899
void QuestionAnswered()
Mark the current question from maxima as "answered"..
Definition: Worksheet.cpp:3564
void DeleteRegion(GroupCell *start, GroupCell *end, UndoActions *undoBuffer)
Definition: Worksheet.cpp:3271
void SelectOutputResult(GroupCell *group, std::size_t index)
Select one result of a cell's output, scroll to it and announce it.
Definition: Worksheet.cpp:2209
bool ScrollToCaretIfNeeded()
Scrolls to the cursor, if requested.
Definition: Worksheet.cpp:6708
void NotifyRedraw(GroupCell *start) override
Schedule a redraw of the document starting at start (null = all).
Definition: Worksheet.h:162
std::unique_ptr< GroupCell > CopyTree() const
Copies the worksheet's entire contents.
Definition: Worksheet.cpp:4638
GroupCell * EndOfSectioningUnit(GroupCell *start)
Finds the end of the current chapter/section/...
Definition: Worksheet.cpp:3605
std::vector< wxString > m_replacementsForCurrentWord
Suggestions for how the word that was right-clicked on could continue.
Definition: Worksheet.h:2215
int ExportSelectionOutputToDir(const wxString &dir, bool svg)
Write each selected group cell's output to an image file in a folder.
Definition: Worksheet.cpp:4784
void ForceRedraw()
Redraw the window now and mark any pending redraw request as "handled".
Definition: Worksheet.h:1038
bool CopyTeX() const
Copy the TeX representation of the current selection to the clipboard.
Definition: Worksheet.cpp:2917
void AddRestToEvaluationQueue()
Add all cells below the cursor to the evaluation queue.
Definition: Worksheet.cpp:5321
bool m_pointerCmdDown
Was Ctrl (Cmd on macOS) held during the last mouse motion?
Definition: Worksheet.h:2312
void ScrollToCellIfNeeded()
Scrolls to the cell given by ScheduleScrollToCell; Is called once we have time to do so.
Definition: Worksheet.cpp:5427
static wxString CSVDelimiter()
What separates the values "Copy as CSV" writes.
Definition: Worksheet.cpp:2809
void DrawGroupCell_UsingBitmap(wxDC *dc, GroupCell *cell)
Draws a groupcell in a bitmap and then blits it onto the DC.
Definition: Worksheet.cpp:848
void GetMaxPoint(int *width, int *height)
Get the coordinates of the bottom right point of the worksheet.
Definition: Worksheet.h:579
void OnMouseWheel(wxMouseEvent &event)
Called if the mouse wheel sents events.
Definition: Worksheet.cpp:1778
void RequestRecalculation()
Schedule a recalculation of the whole worksheet.
Definition: Worksheet.h:1324
void CloseAutoCompletePopup()
Close the autocompletion pop-up if it is currently open.
Definition: Worksheet.h:839
bool SectioningMoveOut(GroupCell *parent)
Make this section/subsection/... a chapter/section/... changing its subheadings, too.
Definition: Worksheet.cpp:7336
bool FollowEvaluation() const
Query if we want to automatically scroll to the cell that is currently evaluated.
Definition: Worksheet.h:1943
void DestroyTree()
Clear the whole worksheet.
Definition: Worksheet.cpp:4629
wxString GetString(bool lb=false) const
Convert the current selection to a string.
Definition: Worksheet.cpp:2522
void NotifySavedStateChanged() override
The document's saved-state flipped; refresh the controls that show it.
Definition: Worksheet.h:164
int GetLastCellsVisited() const
How many cells the last layout pass visited. See WorksheetLayout.
Definition: Worksheet.h:1327
std::unique_ptr< wxDataObject > CreateSelectionDataObject() const
Build the multi-format clipboard object for a non-cell selection.
Definition: Worksheet.cpp:2628
GroupCell * GetWorkingGroup(bool resortToLast=false) const
Returns the cell maxima currently works on.
Definition: Worksheet.cpp:1036
bool CopySVG() const
Copy a svg of the current selection to the clipboard.
Definition: Worksheet.cpp:4656
void Evaluate()
Trigger the evaluation of the current cell(s)
Definition: Worksheet.cpp:3438
void OnScrollChanged(wxScrollEvent &ev)
Called if the user is using the scrollbar for scrolling through the document.
Definition: Worksheet.cpp:6441
void OnDoubleClick(wxMouseEvent &event)
Is called on double click on a cell.
Definition: Worksheet.cpp:5194
void OnActivate(wxActivateEvent &event)
Is called if this element looses or gets the focus.
Definition: Worksheet.cpp:6275
void AddToEvaluationQueue(GroupCell *cell)
Adds a group cell to the evaluation queue marking its contents as "outdated".
Definition: Worksheet.cpp:5296
std::unique_ptr< MatrCell > CopySelectedMatrixBlock() const
The selected sub-matrix, as a new matrix, or null (GH #2345)
Definition: Worksheet.cpp:2493
void RequestRecalculation(Cell *start)
Schedule a recalculation of the worksheet starting with the cell start.
Definition: Worksheet.h:1313
void AnonymizeCodeCells()
Anonymize the code cells in the current selection for a bug report (GH #1339).
Definition: Worksheet.cpp:6880
Definition: CellPointers.h:36
Definition: WheelSteps.h:40
bool CanTreeRedo() const
Can we redo a tree operation?
Definition: Worksheet.cpp:5546
void TreeUndo_CellEntered()
The cursor has entered one cell => save the value to see if it has changed.
Definition: Worksheet.cpp:3227
void TreeUndo_AppendAction()
Add another action to this undo action.
Definition: Worksheet.h:351
bool TreeUndoTextChange(UndoActions *sourcelist, UndoActions *undoForThisOperation)
Undo a text change.
Definition: Worksheet.cpp:5640
bool TreeUndo()
Undo a tree operation.
Definition: Worksheet.h:378
void TreeUndo_ClearRedoActionList()
Clear the list of actions for which an undo can be undone.
Definition: Worksheet.h:345
bool CanTreeUndo() const
Can we undo a tree operation?
Definition: Worksheet.cpp:5542
void TreeUndo_CellLeft()
The cursor is about to leave the current cell => Store the change if the value has changed.
Definition: Worksheet.cpp:3212
void TreeUndo_ClearUndoActionList()
Clear the list of actions for which undo can undo.
Definition: Worksheet.h:348
bool TreeUndoCellAddition(UndoActions *sourcelist, UndoActions *undoForThisOperation)
Undo adding cells.
Definition: Worksheet.cpp:5574
bool TreeUndoCellDeletion(UndoActions *sourcelist, UndoActions *undoForThisOperation)
Undo a call deletion.
Definition: Worksheet.cpp:5561
bool TreeRedo()
Redo an undone tree operation.
Definition: Worksheet.h:382
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:3203
bool TreeUndoFold(UndoActions *sourcelist, UndoActions *undoForThisOperation)
Undo a fold or unfold (GH #266)
Definition: Worksheet.cpp:5609
Everything one copy operation puts on the clipboard.
Definition: ClipboardContents.h:153
One node of the tree: a run of sibling cells, or one entry of a matrix.
Definition: OutputNavigation.h:73
What goes into the PDF besides the worksheet.
Definition: PdfExport.h:66
The point of the worksheet the cursor sits at, for ArmScrollCompensation().
Definition: WorksheetLayout.h:159
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
Definition: gen_corpora.c:58