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>
35#include "precomp.h"
36#include "MaximaManual.h"
37#include "EventIDs.h"
38#include "RecentDocuments.h"
39#include "WheelSteps.h"
40#include <wx/wx.h>
41#include <wx/xml/xml.h>
42#include <wx/aui/aui.h>
43#include <wx/textfile.h>
44#include <wx/fdrepdlg.h>
45#include <wx/dc.h>
46#include <vector>
47#include <utility>
48#include <memory>
49#include <list>
50#include "CellPointers.h"
52#include "Notification.h"
53#include "cells/Cell.h"
54#include "cells/EditorCell.h"
55#include "cells/ImgCell.h"
56#include "cells/ImgCellBase.h"
57#include "cells/AnimationCell.h"
58#include "cells/GroupCell.h"
59#include "cells/MatrCell.h"
60#include "TreeUndoManager.h"
61#include "WorksheetCursor.h"
62#include "WorksheetDocument.h"
64#include "WorksheetSearch.h"
65#include "WorksheetLayout.h"
66#include "MatrixScrollbars.h"
67#include "ClipboardContents.h"
68#include "OutputNavigation.h"
69#include "cells/TextCell.h"
70#include "EvaluationQueue.h"
72#include "Autocomplete.h"
73#include "AutocompletePopup.h"
75#include "ToolBar.h"
76#include <thread>
77
120class Worksheet : public wxScrolled<wxWindow>, public WorksheetView,
122{
123public:
124 // WorksheetView: the narrow window surface the layout pipeline
125 // (WorksheetLayout) drives; each forwards to the wxScrolled base.
126 void GetViewClientSize(int *width, int *height) const override
127 { GetClientSize(width, height); }
128 int GetViewScrollUnitY() const override
129 { int x, y; GetViewStart(&x, &y); return y; }
130 void SetViewVirtualSize(int width, int height) override
131 { SetVirtualSize(width, height); }
132 void SetViewScrollRate(int rate) override { SetScrollRate(rate, rate); }
133 void GetViewPosition(int *x, int *y) const override
134 { const wxPoint p = GetPosition(); *x = p.x; *y = p.y; }
147 void ScrollViewToUnitY(int unitY) override
148 { Freeze(); Scroll(-1, unitY); Thaw(); RequestRedraw(); }
155 long GetStalePaintCount() const { return m_stalePaints; }
156
157 // WorksheetDocumentView: how m_document tells this window that a structural
158 // edit happened; each forwards to the real layout/redraw/save machinery.
159 void NotifyRecalculation(GroupCell *start) override
160 { RequestRecalculation(start); }
161 void NotifyRedraw(GroupCell *start) override { RequestRedraw(start); }
162 void NotifyAdjustSizeNeeded() override { m_layout.RequestAdjustSize(); }
163 void NotifySavedStateChanged() override { m_updateControls = true; }
164
166 RecentDocuments &UnsavedDocuments() { return m_unsavedDocuments; }
167private:
168 RecentDocuments m_unsavedDocuments;
169public:
171 bool UpdateControlsNeeded(){bool result = m_updateControls; m_updateControls = false; return result;}
172 void UpdateControlsNeeded(bool updateControlsNeeded){m_updateControls = updateControlsNeeded;}
173private:
175 wxString m_maximaDocDir;
177 bool m_updateControls = true;
179 bool m_scrollToCaret = false;
180 // The x position to scroll to
181 int m_newxPosition = -1;
182 // The y position to scroll to
183 int m_newyPosition = -1;
185 double m_zoomAtGestureStart = 1.0;
187 bool m_scrollToTopOfCell = false;
189 bool m_windowActive = true;
191 wxRegion m_regionToRefresh;
196 wxClientDC m_dc;
198 CellPtr<GroupCell> m_redrawStart;
200 bool m_fullRedrawRequested = false;
206 bool RedrawStartBelowView() const;
208 long m_stalePaints = 0;
210
212 static wxDataFormat m_wxmFormat;
218 static wxDataFormat m_xmlFormat;
220 static wxDataFormat m_mathmlFormat;
222 static wxDataFormat m_mathmlFormat2;
224 static wxDataFormat m_rtfFormat;
226 static wxDataFormat m_rtfFormat2;
230 static wxDataFormat m_rtfFormat3;
231
234 class MathMLDataObject : public wxCustomDataObject
235 {
236 public:
237 explicit MathMLDataObject(const wxString &data);
238
239 MathMLDataObject();
240
241 private:
242 wxCharBuffer m_databuf;
243 };
244
246 class wxmDataObject : public wxCustomDataObject
247 {
248 public:
249 explicit wxmDataObject(const wxString &data);
250
251 wxmDataObject();
252
253 private:
254 wxCharBuffer m_databuf;
255 };
256
257 class MathMLDataObject2 : public wxCustomDataObject
258 {
259 public:
260 explicit MathMLDataObject2(const wxString &data);
261
262 MathMLDataObject2();
263
264 private:
265 wxCharBuffer m_databuf;
266 };
267
270 class RtfDataObject : public wxCustomDataObject
271 {
272 public:
273 explicit RtfDataObject(const wxString &data);
274
275 RtfDataObject();
276
277 private:
278 wxCharBuffer m_databuf;
279 };
280
281 class RtfDataObject2 : public wxCustomDataObject
282 {
283 public:
284 explicit RtfDataObject2(const wxString &data);
285
286 RtfDataObject2();
287
288 private:
289 wxCharBuffer m_databuf;
290 };
291
294 class RtfDataObject3 : public wxCustomDataObject
295 {
296 public:
297 explicit RtfDataObject3(const wxString &data);
298
299 RtfDataObject3();
300
301 private:
302 wxCharBuffer m_databuf;
303 };
304
306 bool m_hasFocus = true;
308 long m_lastTop = 0;
310 long m_lastBottom = 0;
332 // TreeUndoAction/UndoActions live in TreeUndoAction.h and the undo/redo
333 // state (the two stacks + the active-cell snapshot) is owned by the
334 // TreeUndoManager below; only the tree surgery of applying an action
335 // remains a Worksheet responsibility.
336
337private:
339 TreeUndoManager &GetTreeUndo() { return m_document.GetTreeUndo(); }
340 const TreeUndoManager &GetTreeUndo() const { return m_document.GetTreeUndo(); }
341
342public:
345
348
350 void TreeUndo_AppendAction() { GetTreeUndo().AppendAction(); }
351
357 bool TreeUndo(UndoActions *sourcelist, UndoActions *undoForThisOperation);
358
362 bool TreeUndoTextChange(UndoActions *sourcelist, UndoActions *undoForThisOperation);
366 bool TreeUndoCellDeletion(UndoActions *sourcelist, UndoActions *undoForThisOperation);
370 bool TreeUndoCellAddition(UndoActions *sourcelist, UndoActions *undoForThisOperation);
374 bool TreeUndoFold(UndoActions *sourcelist, UndoActions *undoForThisOperation);
375
377 bool TreeUndo()
378 { return TreeUndo(&GetTreeUndo().UndoStack(), &GetTreeUndo().RedoStack()); }
379
381 bool TreeRedo()
382 { return TreeUndo(&GetTreeUndo().RedoStack(), &GetTreeUndo().UndoStack()); }
383
385 bool CanTreeUndo() const;
386
388 bool CanTreeRedo() const;
389
393
396 void TreeUndo_CellLeft();
397
406 void TreeUndo_MarkCellsAsAdded(GroupCell *start, GroupCell *end, UndoActions *undoBuffer);
407
408
414 void TreeUndo_MarkCellsAsAdded(GroupCell *parentOfStart, GroupCell *end);
416
417
418private:
419 bool m_scrolledAwayFromEvaluation = false;
420public:
421
424 {
425 CLICK_TYPE_NONE,
426 CLICK_TYPE_GROUP_SELECTION,
427 CLICK_TYPE_INPUT_SELECTION,
428 CLICK_TYPE_INPUT_LABEL_SELECTION,
429 CLICK_TYPE_OUTPUT_SELECTION
430 };
431
434 {
435 TIMER_ID,
436 CARET_TIMER_ID,
437 DISPLAY_TIMEOUT_ID
438 };
439
445 std::unique_ptr<Cell> CopySelection(bool asData = false) const;
446
453 std::unique_ptr<MatrCell> CopySelectedMatrixBlock() const;
454
463 bool MatrixEntriesSelected() const;
473 static wxString SelectionRTFBody(const Cell *cells, bool matrixEntries);
474
486 void SelectOutputRect(GroupCell *group, wxPoint down, wxPoint up);
487
505 std::optional<std::size_t> SelectedOutputResult() const;
507 void SelectOutputResult(GroupCell *group, std::size_t index);
514 bool StepOutputResult(int keyCode);
521
529 std::optional<OutputNavigation::Item> SelectedOutputItem() const;
551 bool NavigateOutput(int keyCode, bool shift);
553
565 bool StepSelectedMatrixBlock(int keyCode);
566
575 std::unique_ptr<Cell> CopySelection(Cell *start, Cell *end, bool asData = false) const;
576
578 void GetMaxPoint(int *width, int *height) { m_layout.GetMaxPoint(width, height); }
579
581 void OnTimer(wxTimerEvent &event);
582
584 void OnZoom(wxZoomGestureEvent &event);
585
586 void OnMouseExit(wxMouseEvent &event);
587
588 void OnMouseEnter(wxMouseEvent &event);
589
602 void OnPaint(wxPaintEvent &event);
604 void DrawGroupCell(wxDC &dc, wxDC &adc, GroupCell &cell);
612 void DrawGroupCell_UsingBitmap(wxDC *dc, GroupCell *cell);
613
615 void PrepareDrawGC(wxDC &dc) const;
616
617 void OnSize(wxSizeEvent &event);
618
619 void OnMouseRightDown(wxMouseEvent &event);
625 void OnContextMenuKey(wxContextMenuEvent &event);
626
627 void OnSidebarKey(wxCommandEvent &event);
629 void InsertSymbol(const wxString &symbol);
630
631 void OnMouseLeftUp(wxMouseEvent &event);
632
634 void OnMouseCaptureLost(wxMouseCaptureLostEvent &event);
635
636 void OnMouseLeftDown(wxMouseEvent &event);
637
638 void OnMouseLeftInGcCell(wxMouseEvent &event, GroupCell *clickedInGC);
639
640 void OnMouseLeftInGcLeft(wxMouseEvent &event, GroupCell *clickedInGC);
641
642 void OnMouseLeftInGc(wxMouseEvent &event, GroupCell *clickedInGC);
643
644 void OnMouseMotion(wxMouseEvent &event);
645
647 void OnDoubleClick(wxMouseEvent &event);
655 bool OpenMatrixViewerAt(wxPoint position);
656
658 void OnCharInActive(wxKeyEvent &event);
659
661 void OnCharNoActive(wxKeyEvent &event);
662
664 void SelectEditable(EditorCell *editor, bool up);
665
672 void SelectWithChar(int ccode);
681 bool SelectWholeCellsFromOutput(int ccode);
682
697 void ClickNDrag(wxPoint down, wxPoint up);
698
699 // Select all group cells inside the given rectangle;
700 void SelectGroupCells(wxPoint down, wxPoint up);
701
702public:
709 static bool OpenLink(const wxString &url);
710
712 wxString LinkUnderPointer();
719 wxString GetLinkAt(wxPoint point);
720
722 const wxString &GetContextMenuLink() const { return m_contextMenuLink; }
724 void SetContextMenuLink(const wxString &link) { m_contextMenuLink = link; }
725
727 void AdjustSize() { m_layout.AdjustSize(); }
728
730 void OnEraseBackground(wxEraseEvent& WXUNUSED(event))
731 {}
732
733 void CheckUnixCopy();
734
735 void OnMouseMiddleUp(wxMouseEvent &event);
736
737 static bool IsLesserGCType(int type, int comparedTo);
738
741
744
746 void OnComplete(wxCommandEvent &event);
747
752 void EraseBackground(wxEraseEvent &event);
753
754private:
756 wxPoint m_leftDownPosition;
757 wxPoint m_down;
758 wxPoint m_up;
759 wxPoint m_mousePoint;
768 WorksheetCursor &GetHCaretCursor() { return m_document.GetCursor(); }
769 const WorksheetCursor &GetHCaretCursor() const { return m_document.GetCursor(); }
770 bool m_leftDown = false;
772 wxm::WheelSteps m_zoomWheelSteps;
774 wxm::WheelSteps m_animationWheelSteps;
780 const AnimationCell *m_wheelAnimation = nullptr;
782 bool m_followEvaluation = true;
783 bool m_mouseDrag = false;
784 bool m_mouseOutside = false;
785
786public:
789private:
790 int m_clickType = CLICK_TYPE_NONE;
791 CellPtr<GroupCell> m_clickInGC;
798 CellPtr<GroupCell> m_asyncOutputTarget;
800 int m_outputBatchDepth = 0;
806 std::vector<std::pair<CellPtr<GroupCell>, bool>> m_outputBatchGroups;
811 void LayOutAppendedOutput(GroupCell *cell, bool async);
813 void FinishBatchedOutput();
820 CellPtr<Cell> m_outputRunAnchor;
822 bool m_blinkDisplayCaret = true;
824 bool m_hCaretBlinkVisible = true;
826 wxTimer m_timer;
828 wxTimer m_caretTimer;
829 std::vector<wxString> m_completions;
830 bool m_autocompleteTemplates = true;
831 AutocompletePopup *m_autocompletePopup;
832
833public:
835 bool IsEmpty() const
836 { return !GetTree() || (!GetTree()->GetNext() && GetTree()->GetEditable()->GetValue().Length() <= 1); }
839 {
840 if(m_autocompletePopup != nullptr)
841 m_autocompletePopup->Destroy();
842 }
843
849 void OnChar(wxKeyEvent &event);
850
855 void OnKeyDown(wxKeyEvent &event);
858
860 void NumberSections() const;
861
863 bool SectioningMoveIn(GroupCell *parent);
865 bool SectioningMoveOut(GroupCell *parent);
867 std::optional<Notification> &GetNotification() { return m_notificationMessage; }
868private:
870 std::optional<Notification> m_notificationMessage;
872 std::function<void(bool)> m_attentionCallback;
873public:
875 void WindowActive(bool active){m_windowActive = active;}
877 void ClearNotification();
882 void SetNotification(const wxString &message, int flags = wxICON_INFORMATION);
890 void SetAttentionCallback(std::function<void(bool)> callback)
891 { m_attentionCallback = std::move(callback); }
892
894 void OnActivate(wxActivateEvent &event);
895private:
898 std::unique_ptr<GroupCell> &TreeOwner() { return m_document.TreeOwner(); }
899 CellPtr<GroupCell> &LastCache() const { return m_document.LastCache(); }
900// std::vector<std::jthread> m_drawThreads;
901 static std::mutex m_drawDCLock;
904 Configuration *m_configuration = nullptr;
914 mutable std::weak_ptr<ClipboardContents> m_clipboardContents;
921 WorksheetLayout m_layout;
927 MatrixScrollbars m_matrixScrollbars{this};
928public:
930 MatrixScrollbars &GetMatrixScrollbars() { return m_matrixScrollbars; }
931 void FocusFindDialogue()
932 {
934 pane->SetFocus();
935 }
942 AutoComplete &GetAutocomplete() { return m_autocomplete; }
943private:
944 AutoComplete m_autocomplete;
945public:
946
947 Configuration *GetConfig() const { return m_configuration; }
948
951
955
956 EditorCell *MouseSelectionStart() const
958
959 EditorCell *SearchStart() const
960 { return GetViewCellPointers().SearchStart(); }
961
962 int IndexSearchStartedAt() const
964
971
973 TextCell *GetCurrentTextCell() const { return GetDocumentCellPointers().GetCurrentTextCell(); }
974 void SetCurrentTextCell(TextCell *cell) { GetDocumentCellPointers().SetCurrentTextCell(cell); }
975 void SetWorkingGroup(GroupCell *group) { GetDocumentCellPointers().SetWorkingGroup(group); }
976
983
1001 {
1002 m_redrawStart = nullptr;
1003 m_fullRedrawRequested = false;
1004 }
1005
1010 bool RedrawIfRequested();
1011
1024 void RequestRedraw(GroupCell *start = nullptr);
1034 void RequestRedraw(wxRect rect);
1035
1038 {
1039 RequestRedraw();
1041 }
1042
1045
1048 m_configuration->ReadConfig();
1051 Refresh();
1052 }
1053
1063
1065 const wxString &GetCurrentFile() const { return m_document.GetCurrentFile(); }
1067 void SetCurrentFile(const wxString &file) { m_document.SetCurrentFile(file); }
1068
1085 const wxString UnicodeToMaxima(wxString s) const
1086 { return UnicodeToMaxima(std::move(s), m_configuration); }
1088 static wxString UnicodeToMaxima(wxString s, const Configuration *configuration);
1089
1091 void ScrollToStart() { Scroll(0, 0); }
1092
1094 void ScrollToError();
1095
1102
1104 bool HCaretActive() const { return GetHCaretCursor().IsActive(); }
1106 void DeactivateHCaret() { GetHCaretCursor().Deactivate(); }
1107
1114
1115 bool CanUndo() const;
1116
1117 bool CanRedo() const;
1118
1119 void Undo();
1120
1121 void Redo();
1122
1127 void TreeUndo_ClearBuffers();
1128
1138 Worksheet(wxWindow *parent, int id, Configuration *config,
1139 wxPoint pos = wxDefaultPosition, wxSize size = wxDefaultSize,
1140 bool reactToEvents = true);
1141
1143 ~Worksheet() override;
1144
1146 wxTimer &KeyboardInactiveTimer() { return m_keyboardInactiveTimer; }
1147private:
1148 wxTimer m_keyboardInactiveTimer;
1149public:
1150
1152 void DestroyTree();
1153
1155 std::unique_ptr<GroupCell> CopyTree() const;
1156
1168 GroupCell *InsertGroupCells(std::unique_ptr<GroupCell> &&cells, GroupCell *where,
1169 UndoActions *undoBuffer);
1170
1176 GroupCell *InsertGroupCells(std::unique_ptr<GroupCell> &&cells, GroupCell *where = nullptr);
1177
1183 void InsertLine(std::unique_ptr<Cell> &&newCell, bool forceNewLine = false);
1184
1198 public:
1199 explicit OutputBatch(Worksheet *worksheet) : m_worksheet(worksheet) {
1200 if (m_worksheet)
1201 m_worksheet->m_outputBatchDepth++;
1202 }
1203 ~OutputBatch() {
1204 if (m_worksheet && (--m_worksheet->m_outputBatchDepth == 0))
1205 m_worksheet->FinishBatchedOutput();
1206 }
1207 OutputBatch(const OutputBatch &) = delete;
1208 OutputBatch &operator=(const OutputBatch &) = delete;
1209 private:
1210 Worksheet *m_worksheet;
1211 };
1212
1219
1228 bool ScrollAnchorVisible();
1229
1240
1242 GroupCell *GetInsertGroup() const;
1243
1250 GroupCell *FindGroupCellByUUID(const wxString &uuid) const;
1251
1260 void SetAsyncOutputTarget(GroupCell *cell) { m_asyncOutputTarget = cell; }
1262 GroupCell *GetAsyncOutputTarget() const { return m_asyncOutputTarget; }
1263
1268 public:
1269 AsyncOutputTarget(Worksheet *worksheet, GroupCell *cell)
1270 : m_worksheet(worksheet) {
1271 if (m_worksheet)
1272 m_worksheet->SetAsyncOutputTarget(cell);
1273 }
1275 if (m_worksheet)
1276 m_worksheet->SetAsyncOutputTarget(nullptr);
1277 }
1278 AsyncOutputTarget(const AsyncOutputTarget &) = delete;
1279 AsyncOutputTarget &operator=(const AsyncOutputTarget &) = delete;
1280 private:
1281 Worksheet *m_worksheet;
1282 };
1283
1299 bool RecalculateIfNeeded(bool timeout = false, long timeSliceMs = 50)
1300 { return m_layout.RecalculateIfNeeded(timeout, timeSliceMs); }
1301
1312 void RequestRecalculation(Cell *start) { m_layout.RequestRecalculation(start); }
1313
1324
1326 int GetLastCellsVisited() const { return m_layout.GetLastCellsVisited(); }
1328 int GetLastCellsRecalculated() const { return m_layout.GetLastCellsRecalculated(); }
1329
1334 void ClearDocument();
1335
1336 void ResetInputPrompts();
1337
1338 bool CanCopy() const
1339 {
1343 }
1344
1353 bool CanCopyAsMathML() const;
1354
1356 bool CanCopyCSV() const;
1361 wxString SelectionToCSV() const;
1369 static wxString CSVDelimiter();
1370
1371 bool CanPaste() const
1372 { return GetDocumentCellPointers().GetActiveCell() || GetHCaretCursor().IsActive(); }
1373
1374 bool CanCut() const
1375 {
1378 }
1379
1381 void SelectAll();
1382
1385
1396 void DeleteRegion(
1397 GroupCell *start,
1398 GroupCell *end,
1399 UndoActions *undoBuffer
1400 );
1401
1408 void DeleteRegion(
1409 GroupCell *start,
1410 GroupCell *end
1411 );
1412
1418 void DeleteSelection();
1419
1420 void TOCdnd(GroupCell *dndStart, GroupCell *dndEnd);
1421
1423 bool CanDeleteRegion(GroupCell *start, const GroupCell *end) const;
1424
1427
1432 void DeleteCurrentCell();
1433
1436 {
1438 return nullptr;
1439 return dynamic_cast<AnimationCell *>(GetSelectionStart());
1440 }
1441
1460 bool ScrollSelectedMatrix(const wxMouseEvent &event);
1461private:
1463 wxPoint m_matrixWheelRemainder;
1464public:
1465
1468 {
1470 return nullptr;
1471 return dynamic_cast<ImgCell *>(GetSelectionStart());
1472 }
1473
1476 {
1478 return nullptr;
1479 return dynamic_cast<ImgCellBase *>(GetSelectionStart());
1480 }
1481
1484 {
1486 return nullptr;
1487 return dynamic_cast<TextCell *>(GetSelectionStart());
1488 }
1489
1491 bool CanAnimate() const
1492 {
1494 (dynamic_cast<AnimationCell *>(GetSelectionStart()) != nullptr);
1495 }
1496
1503 void Animate(bool run = true) const;
1504
1505 void DivideCell();
1506
1507 void MergeCells();
1508
1509 void SetLastQuestion(const wxString &lastQuestion){m_document.SetLastQuestion(lastQuestion);}
1510 wxString GetLastQuestion() const {return m_document.GetLastQuestion();}
1511
1513 bool CutToClipboard();
1514
1521 void PasteFromClipboard(bool primary = false);
1522
1532 bool PasteMathAsMaxima();
1533
1543 static constexpr bool HasPrimarySelection() {
1544#if defined(__UNIX__) && !defined(__APPLE__)
1545 return true;
1546#else
1547 return false;
1548#endif
1549 }
1550
1557 bool Copy(bool astext = false) const;
1558
1566 std::unique_ptr<wxDataObject> CreateSelectionDataObject() const;
1567
1569 bool CopyCells() const;
1570
1577 std::unique_ptr<wxDataObject> CreateCellsDataObject() const;
1578
1580 bool CopyMatlab() const;
1581
1583 bool CopyCSV() const;
1584
1586 bool CopyText() const;
1587
1589 bool CopyTeX() const;
1590
1592 wxString ConvertSelectionToMathML() const;
1593
1595 static wxString CellsToMathML(const Cell *cells);
1596
1613
1619 static std::unique_ptr<wxDataObject>
1621
1624
1626 bool CopyMathML() const;
1627
1629 bool CopyBitmap() const;
1630
1632 bool CopyAnimation() const;
1633
1635 bool CopySVG() const;
1636
1637#if wxUSE_ENH_METAFILE
1639 bool CopyEMF() const;
1640#endif
1641
1643 bool CopyRTF() const;
1644
1648 bool CopyHTML() const;
1649
1657 wxString SelectionToSelfContainedHTML() const;
1658
1659 wxSize CopyToFile(const wxString &file) const;
1660
1661 wxSize CopyToFile(const wxString &file, Cell *start, Cell *end, bool asData = false, double scale = 1) const;
1662
1674 int ExportSelectionOutputToDir(const wxString &dir, bool svg);
1675
1680 bool ExportToHTML(const wxString &file);
1681
1683 bool ExportToMAC(const wxString &file);
1684
1686 wxString RTFStart() const;
1687
1689 wxString RTFEnd() const;
1690
1692 bool ExportToTeX(const wxString &file);
1693
1699 wxString GetString(bool lb = false) const;
1700
1701 GroupCell *GetTree() const { return m_document.GetTree(); }
1702 std::unique_ptr<GroupCell> *GetTreeAddress() { return &m_document.TreeOwner(); }
1703
1710
1717
1719 void ClearSelection() { SetSelection(nullptr, nullptr); }
1720
1722 void SetSelection(Cell *sel) { SetSelection(sel, sel); }
1723
1725 void SetSelection(Cell *start, Cell *end);
1726
1728 Cell *FindCellByUUID(const wxString &uuid);
1729
1732
1735 bool CanEdit() const { return m_document.CanEdit(); }
1736
1737 bool ActivatePrevInput() { return ActivateInput(-1); }
1738 bool ActivateNextInput() { return ActivateInput(+1); }
1739 wxString GetStatusText() const {return m_statusText;}
1740 bool StatusTextChangedHas() {
1741 bool retval = (m_statusTextHas != m_statusTextHas_old) ||
1742 (m_statusText != m_statusText_old);
1743 m_statusText_old = m_statusText;
1744 m_statusTextHas_old = m_statusTextHas;
1745 return retval;
1746 }
1747 bool StatusTextHas() const {return m_statusTextHas;}
1748private:
1754 void UpdateOutputSelectionString();
1755 /* ! A timer that tells us to urgently update the display
1756
1757 Normally we prioritize tasks: If there are GUI actions to process we do so.
1758 If not we look if there is data from maxima to process. If not we
1759 If not we recalculate the worksheet element sizes and positions and if
1760 there still is no pressing task we update the display. This way we
1761 respond quickly to the most important inputs.
1762
1763 This timer, if expired, tells us that if we don't update the screen now
1764 maxima feels like not being responsive.
1765 */
1766 wxTimer m_displayTimeoutTimer;
1767
1768 template <class T_SRC, class T_DEST>
1769 inline std::unique_ptr<T_DEST> unique_cast(std::unique_ptr<T_SRC> &&src)
1770 {
1771 if (!src) return std::unique_ptr<T_DEST>();
1772
1773 T_DEST *dest_ptr = &dynamic_cast<T_DEST &>(*src.get());
1774
1775 (void) src.release();
1776 return std::unique_ptr<T_DEST>(dest_ptr);
1777 }
1778 wxString m_statusText;
1779 wxString m_statusText_old;
1780 bool m_statusTextHas = false;
1781 bool m_statusTextHas_old = false;
1782 void StatusText(const wxString &text){m_statusText = text; m_statusTextHas = true;}
1783 void UnsetStatusText(){m_statusTextHas = false;}
1784 bool ActivateInput(int direction);
1785
1786public:
1789 {
1791 m_scrollToCaret = true;
1792 }
1793
1795 bool ScrollToCaretIfNeeded();
1796
1798 void ScrollToCellIfNeeded();
1799
1801 void ScheduleScrollToCell(Cell *cell, bool scrollToTop = true)
1802 {
1803 GetViewCellPointers().ScrollToCell(cell);
1804 m_scrollToTopOfCell = scrollToTop;
1805 m_scrollToCaret = false;
1806
1808 }
1809
1811 bool PointVisibleIs(wxPoint point);
1812
1814 bool CaretVisibleIs();
1815
1818
1832 void ShowPoint(wxPoint point);
1833
1835 void OnSetFocus(wxFocusEvent &event);
1836
1838 void OnKillFocus(wxFocusEvent &event);
1839
1841 bool IsSelected(CellType type) const { return m_document.IsSelected(type); }
1842
1849 void StepAnimation(int change = 1);
1850
1852 bool IsActiveInLast() const
1854
1857 {
1858 return GetLastCellInWorksheet();
1859 }
1860
1863
1864 void SetActiveCell(EditorCell *cell);
1865
1869 void SetDefaultHCaret();
1870
1875 void SetHCaret(GroupCell *where); // call with false, when manually refreshing
1878
1880 void OpenHCaret(const wxString &txt = {})
1881 {
1882 if(m_mainToolBar == nullptr)
1883 OpenHCaret(txt, GC_TYPE_CODE);
1884 else
1886 }
1887
1889 void OpenHCaret(const wxString &txt, GroupType type);
1890
1892 void ShowHCaret();
1893
1899
1907 bool HasTextFormat(TextFormat::Format flag) const;
1909 bool CanFormatText() const;
1910
1911 void UndoInsideCell();
1912
1918
1919 void RedoInsideCell();
1920
1930 void FollowEvaluation(bool followEvaluation);
1931
1933 bool FollowEvaluation() const
1934 { return m_followEvaluation; }
1935
1941 void ScrolledAwayFromEvaluation(bool ScrolledAway);
1942
1943 bool ScrolledAwayFromEvaluation() const
1944 { return m_scrolledAwayFromEvaluation; }
1945
1946 void SaveValue();
1947
1948 bool IsSaved() const
1949 { return m_document.IsSaved(); }
1950
1951 void SetSaved(bool saved)
1952 { m_document.SetSaved(saved); }
1953
1954 void OutputChanged()
1956
1958 void RemoveAllOutput();
1959
1967 void RemoveAllOutput(GroupCell *cell);
1968 // methods related to evaluation queue
1969
1975 void Evaluate();
1976
1978 void AddToEvaluationQueue(GroupCell *cell);
1979
1980 void AddDocumentToEvaluationQueue();
1981
1984
1987
1990
1993
1996
1999
2002
2005
2006 void FoldOccurred();
2007
2008 // methods for folding
2010 GroupCell *Fold(GroupCell *which) { return m_document.Fold(which); }
2011
2013 GroupCell *Unfold(GroupCell *which) { return m_document.Unfold(which); }
2014
2017
2018 GroupCell *ToggleFoldAll(GroupCell *which) { return m_document.ToggleFoldAll(which); }
2019
2020 void FoldAll() { m_document.FoldAll(); }
2021
2022 void UnfoldAll() { m_document.UnfoldAll(); }
2023
2024 // methods for zooming the document in and out
2025 void SetZoomFactor(double newzoom);
2026
2027 void CommentSelection();
2028
2033 void OnScrollChanged(wxScrollEvent &ev);
2034 void OnScrollEvent(wxScrollWinEvent &ev);
2035 void CheckIfActiveCellScrolledOut();
2040 void OnMouseWheel(wxMouseEvent &event);
2041
2047 bool FindIncremental(const wxString &str, bool down, bool ignoreCase, bool searchInInput = true, bool searchInOutput = true);
2048 bool FindIncremental_RegEx(const wxString &str, bool down, bool searchInInput = true, bool searchInOutput = true);
2049
2050private:
2054 WorksheetSearch::SearchStart FindStart(bool down);
2060 bool ApplyFindResult(const WorksheetSearch::SearchTarget &target, bool warn);
2061public:
2068 bool FindNext(const wxString &str, bool down, bool ignoreCase, bool searchInInput = true, bool searchInOutput = true, bool warn = true);
2069 bool FindNext_Regex(const wxString &str, const bool &down, bool searchInInput = true, bool searchInOutput = true, bool warn = true);
2070
2075 void Replace(const wxString &oldString, const wxString &newString, bool ignoreCase);
2076 void Replace_RegEx(const wxString &oldString, const wxString &newString);
2077
2082 int ReplaceAll(const wxString &oldString, const wxString &newString, bool ignoreCase, bool searchInInput = true, bool searchInOutput = true);
2083 int ReplaceAll_RegEx(const wxString &oldString, const wxString &newString, bool searchInInput = true, bool searchInOutput = true);
2084
2095 void AnonymizeCodeCells();
2096
2107 std::size_t ForgetKnownAnswers();
2108
2109 wxString GetInputAboveCaret();
2110
2111 wxString GetOutputAboveCaret();
2112
2114 void LoadSymbols();
2115
2116 bool Autocomplete(AutoComplete::autoCompletionType type = AutoComplete::command);
2117
2119 void AddSymbol(const wxString &fun, AutoComplete::autoCompletionType type = AutoComplete::command)
2120 { m_autocomplete.AddSymbol(fun, type); }
2121
2123 void AddSymbols(const wxString &xml)
2124 { m_autocomplete.AddSymbols(xml); }
2126 void AddSymbols(const wxXmlDocument& xml)
2127 { m_autocomplete.AddSymbols(xml); }
2128
2129 void SetActiveCellText(const wxString &text);
2130
2131 bool InsertText(const wxString &text);
2132
2133 void OpenNextOrCreateCell();
2134
2136 void OnFollow();
2137
2140
2142 void SelectGroupCell(GroupCell *cell);
2143
2148 void SetAnswer(const wxString &answer);
2150 void QuestionAnswered();
2151
2156 bool QuestionPending() const
2157 { return m_document.QuestionPending(); }
2159
2163 void QuestionPending(bool pending)
2164 { m_document.SetQuestionPending(pending); }
2165
2166 void SetMaximaDocDir(const wxString &dir)
2167 {
2168 m_maximaDocDir = dir;
2169 }
2170 const wxString &GetMaximaDocDir() const { return m_maximaDocDir; }
2171
2173 bool GCContainsCurrentQuestion(const GroupCell *cell);
2174
2177 bool OpenQuestionCaret(const wxString &txt = {});
2178
2187 bool WillAutoAnswer() const;
2188 void UpdateScrollPos();
2189
2195 GroupCell *GetWorkingGroup(bool resortToLast = false) const;
2197 void LoadHelpFileAnchors(const wxString &docdir, const wxString &maximaVersion)
2198 {m_maximaManual.LoadHelpFileAnchors(docdir, maximaVersion);}
2199 wxString GetHelpfileAnchorName(const wxString &keyword)
2200 {return m_maximaManual.GetHelpfileAnchorName(keyword);}
2201 wxString GetHelpfileURL(const wxString &keyword)
2202 {return m_maximaManual.GetHelpfileURL(keyword);}
2203
2205 std::vector<wxString> m_replacementsForCurrentWord;
2206#if wxUSE_ACCESSIBILITY
2207 int GetAccessibilityId(Cell *cell) const;
2208#endif
2209
2210#if wxUSE_ACCESSIBILITY
2211 class AccessibilityInfo: public wxAccessible
2212 {
2213 public:
2214 AccessibilityInfo(wxWindow *parent, Worksheet *worksheet);
2215 wxAccStatus GetName (int childId, wxString *name);
2216 wxAccStatus GetChildCount (int *childCount);
2217 wxAccStatus GetChild (int childId, wxAccessible **child);
2218 wxAccStatus GetDefaultAction(int childId, wxString *actionName);
2219 wxAccStatus GetParent (wxAccessible ** parent);
2220 wxAccStatus GetFocus (int *childId, wxAccessible **child);
2221 wxAccStatus GetLocation (wxRect &rect, int elementId);
2222 wxAccStatus HitTest (const wxPoint &pt,
2223 int *childId, wxAccessible **childObject);
2224 wxAccStatus GetDescription(int childId, wxString *description);
2225 wxAccStatus GetRole(int childId, wxAccRole *role);
2226 wxAccStatus GetState(int childId, long *state);
2227 private:
2228 wxWindow *m_parent = nullptr;
2229 Worksheet *m_worksheet = nullptr;
2230
2231 class CaretAccessibilityInfo : public wxAccessible {
2232 public:
2233 CaretAccessibilityInfo(AccessibilityInfo* parent, Worksheet* worksheet)
2234 : wxAccessible(worksheet->GetTargetWindow()), m_parent(parent), m_worksheet(worksheet) {}
2235
2236 wxAccStatus GetName(int childId, wxString *name) override;
2237 wxAccStatus GetDescription(int WXUNUSED(childId), wxString *description) override;
2238 wxAccStatus GetParent(wxAccessible **parent) override;
2239 wxAccStatus GetChildCount(int *childCount) override;
2240 wxAccStatus GetChild(int childId, wxAccessible **child) override;
2241 wxAccStatus GetRole(int childId, wxAccRole *role) override;
2242 private:
2243 AccessibilityInfo* m_parent;
2244 Worksheet* m_worksheet;
2245 };
2246 CaretAccessibilityInfo* m_caretAccessible = nullptr;
2247
2254 class SelectionAccessibilityInfo : public wxAccessible {
2255 public:
2256 SelectionAccessibilityInfo(AccessibilityInfo* parent, Worksheet* worksheet)
2257 : wxAccessible(worksheet->GetTargetWindow()), m_parent(parent), m_worksheet(worksheet) {}
2258
2259 wxAccStatus GetName(int childId, wxString *name) override;
2260 wxAccStatus GetParent(wxAccessible **parent) override;
2261 wxAccStatus GetChildCount(int *childCount) override;
2262 wxAccStatus GetChild(int childId, wxAccessible **child) override;
2263 wxAccStatus GetRole(int childId, wxAccRole *role) override;
2264 wxAccStatus GetState(int childId, long *state) override;
2265 private:
2266 AccessibilityInfo* m_parent;
2267 Worksheet* m_worksheet;
2268 };
2269 SelectionAccessibilityInfo* m_selectionAccessible = nullptr;
2271 int SelectionChildId() const;
2272 public:
2274 static bool HasOutputSelection(const Worksheet *worksheet);
2275 };
2276#endif
2277 MaximaManual m_maximaManual;
2278 MaximaManual *GetMaximaManual() {return &m_maximaManual;}
2279protected:
2280 void FocusTextControl();
2290 wxBitmap m_memory;
2291 wxSize DoGetBestClientSize() const override;
2292#if wxUSE_ACCESSIBILITY
2293 AccessibilityInfo *m_accessibilityInfo = nullptr;
2294#endif
2296 int m_pointer_x = -1;
2298 int m_pointer_y = -1;
2300 bool m_mouseMotionWas = false;
2302 bool m_pointerCmdDown = false;
2304 bool m_linkCursorShown = false;
2306 static wxString LinkToolTip(const wxString &link);
2308 void UpdateLinkCursor(bool overLink);
2312 bool m_inPopupMenu = false;
2313};
2314
2315wxDECLARE_EVENT(TOC_UPDATE_NEEDED_EVENT, wxCommandEvent);
2316
2317#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).
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:563
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:95
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:1267
Lays out the output of all lines appended in this scope once, at its end.
Definition: Worksheet.h:1197
The canvas that contains the spreadsheet the whole program is about.
Definition: Worksheet.h:122
void OnContextMenuKey(wxContextMenuEvent &event)
Opens the right-click menu for the selection from the keyboard (GH #2382)
Definition: Worksheet.cpp:1468
static constexpr bool HasPrimarySelection()
Does this platform have a primary selection?
Definition: Worksheet.h:1543
bool IsActiveInLast() const
Is the editor active in the last cell of the worksheet?
Definition: Worksheet.h:1852
bool RenderClipboardContents()
Replace this worksheet's lazily rendered clipboard data by data that no longer needs the worksheet (G...
Definition: Worksheet.cpp:3124
GroupCell * ToggleFold(GroupCell *which)
Fold or unfold a cell.
Definition: Worksheet.h:2016
void OnTimer(wxTimerEvent &event)
Is executed if a timer associated with Worksheet has expired.
Definition: Worksheet.cpp:4500
void ClearSelection()
Clear the selection - make it empty, i.e. no selection.
Definition: Worksheet.h:1719
void RequestRedraw(GroupCell *start=nullptr)
Request the worksheet to be redrawn.
Definition: Worksheet.cpp:542
bool CanMergeSelection() const
Can we merge the selected cells into one?
Definition: Worksheet.h:1113
bool IsSelectionInWorkingGroup() const
Is the selection in the current working group?
Definition: Worksheet.h:1862
void InsertSymbol(const wxString &symbol)
Types a symbol from a sidebar button or a symbol's keyboard shortcut.
Definition: Worksheet.cpp:311
int GetLastCellsRecalculated() const
How many cells the last layout pass truly recalculated. See WorksheetLayout.
Definition: Worksheet.h:1328
void SetViewScrollRate(int rate) override
Set the scroll granularity (device pixels per scroll unit) on both axes.
Definition: Worksheet.h:132
ImgCellBase * GetSelectedImgCellBase() const
Returns the selected cell - or nullptr, if the selection isn't image nor animation.
Definition: Worksheet.h:1475
MatrCell * GetSelectedScrollingMatrix() const
The scrolling matrix the selection lies in, or nullptr (GH #2479)
Definition: Worksheet.cpp:1870
void KeepCursorStillOnScreen()
Keep the cursor where it is on screen while a cell's output changes.
Definition: Worksheet.cpp:1166
wxString RTFStart() const
The start of a RTF document.
Definition: Worksheet.cpp:7482
int m_pointer_x
The x position of the mouse pointer.
Definition: Worksheet.h:2296
void SetDefaultHCaret()
Set the HCaret to its default location, at the end of the document.
Definition: Worksheet.cpp:6238
bool CanDeleteRegion(GroupCell *start, const GroupCell *end) const
Is it possible to delete the cells between start and end?
Definition: Worksheet.cpp:3169
void AddSectionToEvaluationQueue(GroupCell *start)
Adds a chapter, a section or a subsection to the evaluation queue.
Definition: Worksheet.cpp:5277
void AddSymbols(const wxString &xml)
Add a xml-encoded list of symbols to the autocompletion list.
Definition: Worksheet.h:2123
void SelectOutputRect(GroupCell *group, wxPoint down, wxPoint up)
Select what a rectangle dragged across a cell's output covers.
Definition: Worksheet.cpp:2129
bool CutToClipboard()
Add the currently selected cells to the clipboard and delete them.
Definition: Worksheet.cpp:5854
void SelectOutputItem(const OutputNavigation::Item &item)
Select a node of the output tree, scroll to it and announce it.
Definition: Worksheet.cpp:2228
void GetViewPosition(int *x, int *y) const override
The view's position within its parent, in device pixels (wxWindow::GetPosition).
Definition: Worksheet.h:133
WorksheetDocument m_document
The view-independent document state (file, current question, ...) that Worksheet's document accessors...
Definition: Worksheet.h:2284
FindReplacePane * m_findPane
The dockable find-and-replace sidebar (GH #2249), set once by wxMaximaFrame at startup and never dest...
Definition: Worksheet.h:1101
std::optional< std::size_t > SelectedOutputResult() const
Which result of its cell's output is selected, if exactly one is.
Definition: Worksheet.cpp:2195
std::unique_ptr< wxDataObject > CreateCellsDataObject() const
Build the multi-format clipboard object for a whole-cell selection.
Definition: Worksheet.cpp:2993
GroupCell * GetInsertGroup() const
The group that the line's cells will belong to - used by InsertLine.
Definition: Worksheet.cpp:1074
void OnCharNoActive(wxKeyEvent &event)
Key pressed and no cell was active.
Definition: Worksheet.cpp:4006
bool QuestionPending() const
Does maxima wait for the answer of a question?
Definition: Worksheet.h:2156
void AddEntireDocumentToEvaluationQueue()
Schedule all cells in the document for evaluation.
Definition: Worksheet.cpp:5268
WorksheetLayout::ScrollAnchor GetScrollAnchor() const
Where the cursor is, as the layout engine's scroll compensation needs it.
Definition: Worksheet.cpp:1158
static wxString CellsToMathML(const Cell *cells)
A MathML document showing a list of cells, nicely indented.
Definition: Worksheet.cpp:2726
bool CopyCSV() const
Copy the selected matrix, or block of one, to the clipboard as CSV.
Definition: Worksheet.cpp:2806
GroupCell * FirstVisibleGC()
The first groupCell that is currently visible.
Definition: Worksheet.cpp:1742
static std::unique_ptr< wxDataObject > CreateIndependentDataObject(const ClipboardContents &contents)
The data RenderClipboardContents() puts on the clipboard.
Definition: Worksheet.cpp:3091
bool HasTextFormat(TextFormat::Format flag) const
Is this character format on where the cursor is? (For the toolbar.)
Definition: Worksheet.cpp:6314
bool NavigateOutput(int keyCode, bool shift)
Walk through the parts of the selected output with the keyboard.
Definition: Worksheet.cpp:2316
bool CanFormatText() const
Is the cursor in a cell whose text can be formatted?
Definition: Worksheet.cpp:6319
void SetAsyncOutputTarget(GroupCell *cell)
Routes output to one specific cell instead of the one being evaluated.
Definition: Worksheet.h:1260
void UpdateConfigurationClientSize()
Inform the configuration about the current client size.
Definition: Worksheet.h:1731
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:6737
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:2197
bool ExportToHTML(const wxString &file)
Export the file to an html document.
Definition: Worksheet.cpp:4894
void OpenHCaret(const wxString &txt={})
Place the cursor into a new cell where the horizontal cursor is.
Definition: Worksheet.h:1880
void NotifyAdjustSizeNeeded() override
The scrollable size will need re-adjusting once cell positions settle.
Definition: Worksheet.h:162
void ApplyOverlayScrollbarsSetting()
Apply the configuration's OverlayScrollbars() choice to this window.
Definition: Worksheet.cpp:570
TextCell * GetSelectedTextCell() const
Returns the selected cell - or nullptr, if the selection isn't a text cell.
Definition: Worksheet.h:1483
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:890
void ScrollToError()
Unfold the cell that produced the error, if necessary and, if requested, scroll to it.
Definition: Worksheet.cpp:996
bool HCaretActive() const
Is the vertically-drawn cursor active?
Definition: Worksheet.h:1104
void OnEraseBackground(wxEraseEvent &WXUNUSED(event))
Cannot be static as it is called using a function pointer to an object.
Definition: Worksheet.h:730
void ClearDocument()
Empties the current document.
Definition: Worksheet.cpp:1298
~Worksheet() override
The destructor.
Definition: Worksheet.cpp:595
wxString RTFEnd() const
The end of a RTF document.
Definition: Worksheet.cpp:7486
ViewCellPointers m_viewCellPointers
The transient view-state half of the cell-pointer registry (hover, selection anchors,...
Definition: Worksheet.h:2288
void UpdateTableOfContents()
Update the table of contents.
Definition: Worksheet.cpp:7885
void RemoveAllOutput()
Remove all output cells from the whole worksheet.
Definition: Worksheet.cpp:6338
Cell * GetSelectionEnd() const
Return the last of the currently selected cells.
Definition: Worksheet.h:1715
void QuestionPending(bool pending)
Does maxima currently wait for the answer of a question?
Definition: Worksheet.h:2163
void ClickNDrag(wxPoint down, wxPoint up)
Select the rectangle surrounded by down and up.
Definition: Worksheet.cpp:2062
FindReplacePane * GetActiveFindPane() const
Whichever find/replace UI is actually in use right now: the dockable sidebar (GH #2249) if Configurat...
Definition: Worksheet.cpp:6543
DocumentCellPointers & GetDocumentCellPointers()
The document-model half of the cell-pointer registry (owned by m_document).
Definition: Worksheet.h:966
const wxString & GetCurrentFile() const
The name of the currently-opened file.
Definition: Worksheet.h:1065
void SetCurrentFile(const wxString &file)
Set the name of the currently-opened file.
Definition: Worksheet.h:1067
RecentDocuments & UnsavedDocuments()
The list of unsaved (autosaved) documents offered for recovery.
Definition: Worksheet.h:166
static bool OpenLink(const wxString &url)
Opens a link from a text cell in the user's web browser (GH #2396).
Definition: Worksheet.cpp:1940
bool CopyHTML() const
Copy a self-contained HTML version (inline CSS, base64-embedded images – see WorksheetExport::Selecti...
Definition: Worksheet.cpp:4701
void DeleteCurrentCell()
Delete the currently active cell - or the cell above this one.
Definition: Worksheet.cpp:3154
AutoComplete & GetAutocomplete()
The storage for the autocompletion feature.
Definition: Worksheet.h:942
AnimationCell * GetSelectedAnimation() const
Returns the selected cell - or nullptr, if the selection isn't an animation.
Definition: Worksheet.h:1435
void Replace(const wxString &oldString, const wxString &newString, bool ignoreCase)
Replace the current occurrence of a string.
Definition: Worksheet.cpp:6703
bool CopyMatlab() const
Copy a Matlab representation of the current selection to the clipboard.
Definition: Worksheet.cpp:2867
bool CopyText() const
Copy a textual representation of the current selection to the clipboard.
Definition: Worksheet.cpp:2944
wxString GetLinkAt(wxPoint point)
The link drawn at a point in worksheet coordinates, or "".
Definition: Worksheet.cpp:1965
bool StepOutputResult(int keyCode)
Move between results with the Up or Down key while no editor is active.
Definition: Worksheet.cpp:2258
bool m_inPopupMenu
Is there an active popup menu?
Definition: Worksheet.h:2312
EvaluationQueue & GetEvaluationQueue()
The list of cells that have to be evaluated.
Definition: Worksheet.h:2004
bool PasteMathAsMaxima()
Paste LaTeX or MathML maths from the clipboard as a Maxima command.
Definition: Worksheet.cpp:5881
void Animate(bool run=true) const
Animate the current slide show.
Definition: Worksheet.cpp:6215
static GroupCell * StartOfSectioningUnit(GroupCell *start)
Finds the start of the current chapter/section/...
Definition: Worksheet.cpp:3563
bool CopyRTF() const
Copy a rtf version of the current selection to the clipboard.
Definition: Worksheet.cpp:4645
void UpdateConfig()
Re-read the configuration.
Definition: Worksheet.h:1047
int m_pointer_y
The y position of the mouse pointer.
Definition: Worksheet.h:2298
MatrixScrollbars & GetMatrixScrollbars()
The native scrollbars of matrices shown in a scrolling viewport.
Definition: Worksheet.h:930
std::size_t ForgetKnownAnswers()
Forget the answers to Maxima's questions remembered by some cells (GH #1018)
Definition: Worksheet.cpp:6821
bool Copy(bool astext=false) const
Copy the current selection to the clipboard.
Definition: Worksheet.cpp:2544
bool CopyAnimation() const
Copy the current animation to the clipboard.
Definition: Worksheet.cpp:4623
const wxString UnicodeToMaxima(wxString s) const
Make a few unicode characters interpretable by maxima.
Definition: Worksheet.h:1085
void StepAnimation(int change=1)
Set the slide of the currently selected animation or advance it by one step.
Definition: Worksheet.cpp:4474
GroupCell * Unfold(GroupCell *which)
Unfold a cell (see WorksheetDocument::Unfold())
Definition: Worksheet.h:2013
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:3975
void SetAnswer(const wxString &answer)
Handling questions from and answers for maxima.
Definition: Worksheet.cpp:3282
bool CanCopyCSV() const
Is the selection a matrix, or a block of one, that "Copy as CSV" can copy?
Definition: Worksheet.cpp:2783
wxString m_contextMenuLink
The link the last context menu was opened on, see GetContextMenuLink().
Definition: Worksheet.h:2310
ViewCellPointers & GetViewCellPointers()
The transient view-state half of the cell-pointer registry (owned here).
Definition: Worksheet.h:969
void OnChar(wxKeyEvent &event)
Key for a printable character pressed.
Definition: Worksheet.cpp:4360
bool ScrollSelectedMatrix(const wxMouseEvent &event)
Lets a mouse wheel event scroll the selected scrolling matrix (GH #2479)
Definition: Worksheet.cpp:1891
void SelectWithChar(int ccode)
Handle selecting text using the keyboard Is called when the all of the following is true:
Definition: Worksheet.cpp:3838
void AddSelectionToEvaluationQueue()
Schedule all cells in the selection to be evaluated.
Definition: Worksheet.cpp:5306
bool HasCellsSelected() const
Is at least one entire cell selected?
Definition: Worksheet.h:1384
bool ScrollAnchorVisible()
Is the cursor on screen?
Definition: Worksheet.cpp:1183
long GetStalePaintCount() const
How many paints drew for another scroll position than the one they ended with.
Definition: Worksheet.h:155
std::optional< Notification > & GetNotification()
The error notification message, if any.
Definition: Worksheet.h:867
void OnSetFocus(wxFocusEvent &event)
What to do if the worksheet is in the input focus.
Definition: Worksheet.cpp:6177
void SetNotification(const wxString &message, int flags=wxICON_INFORMATION)
Inform the user that something happened in a non-active window.
Definition: Worksheet.cpp:4347
bool IsSelected(CellType type) const
Does the selection start with a cell of the type "type".
Definition: Worksheet.h:1841
GroupCell * GetAsyncOutputTarget() const
The cell async output is currently being routed to, if any.
Definition: Worksheet.h:1262
void ScheduleScrollToCell(Cell *cell, bool scrollToTop=true)
Schedules scrolling to a given cell.
Definition: Worksheet.h:1801
int GetViewScrollUnitY() const override
The current vertical scroll position, in scroll units (not pixels).
Definition: Worksheet.h:128
GroupCell * InsertGroupCells(std::unique_ptr< GroupCell > &&cells, GroupCell *where, UndoActions *undoBuffer)
Insert group cells into the worksheet.
Definition: Worksheet.cpp:976
void AddDocumentTillHereToEvaluationQueue()
Schedule all cells stopping with the one the caret is in for evaluation.
Definition: Worksheet.cpp:5322
void OnComplete(wxCommandEvent &event)
Is called if an action from the autocomplete menu is selected.
Definition: Worksheet.cpp:7222
bool CanAnimate() const
Does it make sense to enable the "Play" button and the slider now?
Definition: Worksheet.h:1491
bool RecalculateIfNeeded(bool timeout=false, long timeSliceMs=50)
Actually recalculate the worksheet.
Definition: Worksheet.h:1299
bool m_mouseMotionWas
Was there a mouse motion we didn't react to until now?
Definition: Worksheet.h:2300
void SelectAll()
Select the whole document.
Definition: Worksheet.cpp:6100
void DeactivateHCaret()
Hides the horizontal cursor, e.g. in a worksheet nothing can be inserted into.
Definition: Worksheet.h:1106
void OnKillFocus(wxFocusEvent &event)
What to do if the worksheet looses the input focus.
Definition: Worksheet.cpp:6189
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:1091
void ClearNotification()
Clears the notification message from SetNotification.
Definition: Worksheet.cpp:4337
void OnPaint(wxPaintEvent &event)
Is called by wxWidgets when it wants to redraw the worksheet or a part of it.
Definition: Worksheet.cpp:641
void OnFollow()
Called when the "Scroll to currently evaluated" button is pressed.
Definition: Worksheet.cpp:7406
void PrepareDrawGC(wxDC &dc) const
All that has need to be done before drawing a GroupCell in a DC.
Definition: Worksheet.cpp:831
void OnCharInActive(wxKeyEvent &event)
Key pressed inside a cell.
Definition: Worksheet.cpp:3607
Cell * GetSelectionStart() const
Return the first of the currently selected cells.
Definition: Worksheet.h:1708
void FoldOccurred()
Call when a fold action was detected, to update the state in response to a fold occurring.
Definition: Worksheet.cpp:1386
void OnMouseCaptureLost(wxMouseCaptureLostEvent &event)
Is called if we loose the mouse connection whilst selecting text/cells.
Definition: Worksheet.cpp:7490
wxTimer & KeyboardInactiveTimer()
The timer that tells us when the keyboard is inactive so an autosave isn't disrupting.
Definition: Worksheet.h:1146
ClickType
An enum for all classes of items one can click on.
Definition: Worksheet.h:424
ImgCell * GetSelectedImgCell() const
Returns the selected cell - or nullptr, if the selection isn't an image.
Definition: Worksheet.h:1467
Cell * FindCellByUUID(const wxString &uuid)
Find a cell by its UUID.
Definition: Worksheet.cpp:5370
void EraseBackground(wxEraseEvent &event)
Is called if wxWidgets wants to erase the worksheet's background.
Definition: Worksheet.cpp:333
bool StepSelectedMatrixBlock(int keyCode)
Grow or shrink the selected block of a matrix's entries (GH #2370)
Definition: Worksheet.cpp:2449
bool CanDeleteSelection() const
Is it possible to delete the currently selected cells?
Definition: Worksheet.h:1426
ToolBar * m_mainToolBar
The toolbar of the main window: We need to access it and therefore have it defined here.
Definition: Worksheet.h:2139
bool CaretVisibleIs()
Is the caret (hcaret or vcaret) currently visible on the worksheet?
Definition: Worksheet.cpp:6639
EditorCell * GetActiveCell() const
Get the currently active EditorCell.
Definition: Worksheet.h:950
bool UpdateControlsNeeded()
Is an update of the worksheet controls needed?
Definition: Worksheet.h:171
bool CopyCells() const
Copy the selection to the clipboard as it would appear in a .wxm file.
Definition: Worksheet.cpp:2977
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:3297
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:6480
GroupCell * GetLastCell()
Returns the last cell of the worksheet.
Definition: Worksheet.h:1856
GroupCell * GetHCaret()
The cell the horizontal cursor is above. nullptr means at the start of the document.
Definition: Worksheet.cpp:6221
wxString ConvertSelectionToMathML() const
Convert the current selection to MathML.
Definition: Worksheet.cpp:2715
bool CanUndoInsideCell() const
Is it possible to issue an undo in the currently selected cell?
Definition: Worksheet.h:1898
void PasteFromClipboard(bool primary=false)
Paste into the worksheet.
Definition: Worksheet.cpp:5943
void SetHCaret(GroupCell *where)
Set the HCaret at the location of the given Cell.
Definition: Worksheet.cpp:6248
bool CanRedoInsideCell() const
Is it possible to issue an undo in the currently selected cell?
Definition: Worksheet.h:1917
bool GCContainsCurrentQuestion(const GroupCell *cell)
Does the GroupCell cell points to contain the question currently asked by maxima?
Definition: Worksheet.cpp:3535
const wxString & GetContextMenuLink() const
The link the last context menu was opened on, or an empty string.
Definition: Worksheet.h:722
bool WillAutoAnswer() const
Execute all collected scroll events in one go.
Definition: Worksheet.cpp:3290
void ToggleTextFormat(TextFormat::Format flag)
Switch a character format (bold, ...) of the active text cell on or off.
Definition: Worksheet.cpp:6297
bool IsEmpty() const
Is this worksheet empty?
Definition: Worksheet.h:835
void NumberSections() const
Renumber all sections.
Definition: Worksheet.cpp:1331
std::optional< OutputNavigation::Item > SelectedOutputItem() const
The selected part of an output, as a node of OutputNavigation's tree.
Definition: Worksheet.cpp:2215
void SetViewVirtualSize(int width, int height) override
Set the scrollable (virtual) area, in device pixels.
Definition: Worksheet.h:130
static wxString SelectionRTFBody(const Cell *cells, bool matrixEntries)
The RTF for a copy of the selection, without RTFStart() and RTFEnd()
Definition: Worksheet.cpp:2505
void OnKeyDown(wxKeyEvent &event)
A special key has been pressed.
Definition: Worksheet.cpp:3422
GroupCell * FindGroupCellByUUID(const wxString &uuid) const
Finds a GroupCell by its UUID, or nullptr if no cell has that UUID.
Definition: Worksheet.cpp:1056
EditorCell * KeyboardSelectionStart() const
Tells us which cell the keyboard selection has started in.
Definition: Worksheet.h:953
void SetSelection(Cell *sel)
Select the cell sel.
Definition: Worksheet.h:1722
void AddCellToEvaluationQueue(GroupCell *gc)
Schedule this cell for evaluation.
Definition: Worksheet.cpp:5340
void SetCellStyle(GroupCell *group, GroupType style)
Change the style of a cell.
Definition: Worksheet.cpp:3211
bool Autocomplete(AutoComplete::autoCompletionType type=AutoComplete::command)
Definition: Worksheet.cpp:6969
wxString SelectionToCSV() const
The selected matrix, or selected block of one, as CSV (GH #2364)
Definition: Worksheet.cpp:2797
wxBitmap m_memory
A memory we can manually buffer the contents of the area that is to be redrawn in.
Definition: Worksheet.h:2290
void LoadSymbols()
Compile a list of known autocompletion symbols.
Definition: Worksheet.cpp:4923
void SelectGroupCell(GroupCell *cell)
Set this cell as the currently selected one.
Definition: Worksheet.cpp:7392
void AddSymbols(const wxXmlDocument &xml)
Add a xml-encoded list of symbols to the autocompletion list.
Definition: Worksheet.h:2126
void ShowPoint(wxPoint point)
Scrolls to a point on the worksheet.
Definition: Worksheet.cpp:5805
void WindowActive(bool active)
Is this window active?
Definition: Worksheet.h:875
bool ExportToTeX(const wxString &file)
export to a LaTeX file
Definition: Worksheet.cpp:4916
void AdjustSize()
Adjust the virtual size and scrollbars; see WorksheetLayout::AdjustSize().
Definition: Worksheet.h:727
void ScrollViewToUnitY(int unitY) override
Scroll without showing any frame in between (the scroll compensation)
Definition: Worksheet.h:147
void ShowHCaret()
Activates the horizontal cursor.
Definition: Worksheet.cpp:6280
bool SelectWholeCellsFromOutput(int ccode)
Shift+Up/Down with something inside a cell's output selected.
Definition: Worksheet.cpp:3935
TimerIDs
An enum of individual IDs for all timers this class handles.
Definition: Worksheet.h:434
static wxString LinkToolTip(const wxString &link)
The tooltip for the pointer being over link: its address and how to open it.
Definition: Worksheet.cpp:1949
void CodeCellVisibilityChanged()
To be called after enabling or disabling the visibility of code cells.
Definition: Worksheet.cpp:4904
void UpdateLinkCursor(bool overLink)
Shows the hand cursor while the pointer is over a link and Ctrl is held.
Definition: Worksheet.cpp:1957
void ScrollToCaret()
Request to scroll to the cursor as soon as wxMaxima is idle.
Definition: Worksheet.h:1788
bool OpenMatrixViewerAt(wxPoint position)
Opens a MatrixViewer if there is a partially shown matrix at this point.
Definition: Worksheet.cpp:5188
wxString LinkUnderPointer()
The link a text cell or the output draws under the mouse pointer, or "".
Definition: Worksheet.cpp:1976
void MarkRefreshAsDone()
Handle redrawing the worksheet or of parts of it.
Definition: Worksheet.h:1000
bool CopyMathML() const
Copy the MathML representation of the current selection to the clipboard.
Definition: Worksheet.cpp:2840
bool CopyBitmap() const
Copy a bitmap of the current selection to the clipboard.
Definition: Worksheet.cpp:4617
bool CanCopyAsMathML() const
Would "Copy as MathML" of the current selection produce actual math?
Definition: Worksheet.cpp:2821
void GetViewClientSize(int *width, int *height) const override
The visible client area, in device pixels.
Definition: Worksheet.h:126
GroupCell * Fold(GroupCell *which)
Fold a cell (see WorksheetDocument::Fold())
Definition: Worksheet.h:2010
bool PointVisibleIs(wxPoint point)
Is the point currently visible on the worksheet?
Definition: Worksheet.cpp:5784
std::unique_ptr< Cell > CopySelection(bool asData=false) const
Copy the currently selected cells.
Definition: Worksheet.cpp:4814
bool EnterOutputFromInput()
Down at the end of a cell's input: select the output's first result.
Definition: Worksheet.cpp:2302
GroupCell * GetLastCellInWorksheet() const
Returns a pointer to the last cell of this worksheet.
Definition: Worksheet.cpp:2057
void ScrollToStart()
Scroll to the start of the worksheet.
Definition: Worksheet.h:1091
void NotifyRecalculation(GroupCell *start) override
Schedule a re-layout of the document starting at start (null = all).
Definition: Worksheet.h:159
void SetContextMenuLink(const wxString &link)
Remembers the link the context menu is being opened on.
Definition: Worksheet.h:724
void AddSymbol(const wxString &fun, AutoComplete::autoCompletionType type=AutoComplete::command)
Add a symbol to the autocompletion list.
Definition: Worksheet.h:2119
bool CanEdit() const
We can edit the input if the we have the whole input in selection!
Definition: Worksheet.h:1735
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:6573
bool MatrixEntriesSelected() const
Are the entries of a matrix selected, rather than the matrix? (GH #959)
Definition: Worksheet.cpp:2501
bool SectioningMoveIn(GroupCell *parent)
Make this chapter/section/... a section/subsection/... changing its subheadings, too.
Definition: Worksheet.cpp:7259
wxBitmap ConvertSelectionToBitmap() const
Convert the current selection to a bitmap.
bool RedrawIfRequested()
Redraw the worksheet if RequestRedraw() has been called.
Definition: Worksheet.cpp:345
bool ExportToMAC(const wxString &file)
Export the file to a text file maxima's load command can read.
Definition: Worksheet.cpp:5083
wxString SelectionToSelfContainedHTML() const
What CopyHTML() puts on the clipboard, without touching the clipboard.
Definition: Worksheet.cpp:4683
void OnZoom(wxZoomGestureEvent &event)
Handle pinch-to-zoom-events using the gesture interface.
Definition: Worksheet.cpp:4463
bool m_linkCursorShown
Does the worksheet currently show the hand cursor for a link?
Definition: Worksheet.h:2304
void SetActiveCell(EditorCell *cell)
Mark an editor cell as the active one.
Definition: Worksheet.cpp:5700
FindReplaceDialog * m_findDialog
The find-and-replace-dialog.
Definition: Worksheet.h:1097
void DrawGroupCell(wxDC &dc, wxDC &adc, GroupCell &cell)
Draws a groupcell on the DC.
Definition: Worksheet.cpp:897
void QuestionAnswered()
Mark the current question from maxima as "answered"..
Definition: Worksheet.cpp:3539
void DeleteRegion(GroupCell *start, GroupCell *end, UndoActions *undoBuffer)
Definition: Worksheet.cpp:3246
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:2207
bool ScrollToCaretIfNeeded()
Scrolls to the cursor, if requested.
Definition: Worksheet.cpp:6673
void NotifyRedraw(GroupCell *start) override
Schedule a redraw of the document starting at start (null = all).
Definition: Worksheet.h:161
std::unique_ptr< GroupCell > CopyTree() const
Copies the worksheet's entire contents.
Definition: Worksheet.cpp:4613
GroupCell * EndOfSectioningUnit(GroupCell *start)
Finds the end of the current chapter/section/...
Definition: Worksheet.cpp:3580
std::vector< wxString > m_replacementsForCurrentWord
Suggestions for how the word that was right-clicked on could continue.
Definition: Worksheet.h:2205
int ExportSelectionOutputToDir(const wxString &dir, bool svg)
Write each selected group cell's output to an image file in a folder.
Definition: Worksheet.cpp:4759
void ForceRedraw()
Redraw the window now and mark any pending redraw request as "handled".
Definition: Worksheet.h:1037
bool CopyTeX() const
Copy the TeX representation of the current selection to the clipboard.
Definition: Worksheet.cpp:2899
void AddRestToEvaluationQueue()
Add all cells below the cursor to the evaluation queue.
Definition: Worksheet.cpp:5286
bool m_pointerCmdDown
Was Ctrl (Cmd on macOS) held during the last mouse motion?
Definition: Worksheet.h:2302
void ScrollToCellIfNeeded()
Scrolls to the cell given by ScheduleScrollToCell; Is called once we have time to do so.
Definition: Worksheet.cpp:5392
static wxString CSVDelimiter()
What separates the values "Copy as CSV" writes.
Definition: Worksheet.cpp:2791
void DrawGroupCell_UsingBitmap(wxDC *dc, GroupCell *cell)
Draws a groupcell in a bitmap and then blits it onto the DC.
Definition: Worksheet.cpp:846
void GetMaxPoint(int *width, int *height)
Get the coordinates of the bottom right point of the worksheet.
Definition: Worksheet.h:578
void OnMouseWheel(wxMouseEvent &event)
Called if the mouse wheel sents events.
Definition: Worksheet.cpp:1776
void RequestRecalculation()
Schedule a recalculation of the whole worksheet.
Definition: Worksheet.h:1323
void CloseAutoCompletePopup()
Close the autocompletion pop-up if it is currently open.
Definition: Worksheet.h:838
bool SectioningMoveOut(GroupCell *parent)
Make this section/subsection/... a chapter/section/... changing its subheadings, too.
Definition: Worksheet.cpp:7301
bool FollowEvaluation() const
Query if we want to automatically scroll to the cell that is currently evaluated.
Definition: Worksheet.h:1933
void DestroyTree()
Clear the whole worksheet.
Definition: Worksheet.cpp:4604
wxString GetString(bool lb=false) const
Convert the current selection to a string.
Definition: Worksheet.cpp:2520
void NotifySavedStateChanged() override
The document's saved-state flipped; refresh the controls that show it.
Definition: Worksheet.h:163
int GetLastCellsVisited() const
How many cells the last layout pass visited. See WorksheetLayout.
Definition: Worksheet.h:1326
std::unique_ptr< wxDataObject > CreateSelectionDataObject() const
Build the multi-format clipboard object for a non-cell selection.
Definition: Worksheet.cpp:2617
GroupCell * GetWorkingGroup(bool resortToLast=false) const
Returns the cell maxima currently works on.
Definition: Worksheet.cpp:1034
bool CopySVG() const
Copy a svg of the current selection to the clipboard.
Definition: Worksheet.cpp:4631
void Evaluate()
Trigger the evaluation of the current cell(s)
Definition: Worksheet.cpp:3413
void OnScrollChanged(wxScrollEvent &ev)
Called if the user is using the scrollbar for scrolling through the document.
Definition: Worksheet.cpp:6406
void OnDoubleClick(wxMouseEvent &event)
Is called on double click on a cell.
Definition: Worksheet.cpp:5159
void OnActivate(wxActivateEvent &event)
Is called if this element looses or gets the focus.
Definition: Worksheet.cpp:6240
void AddToEvaluationQueue(GroupCell *cell)
Adds a group cell to the evaluation queue marking its contents as "outdated".
Definition: Worksheet.cpp:5261
std::unique_ptr< MatrCell > CopySelectedMatrixBlock() const
The selected sub-matrix, as a new matrix, or null (GH #2345)
Definition: Worksheet.cpp:2491
void RequestRecalculation(Cell *start)
Schedule a recalculation of the worksheet starting with the cell start.
Definition: Worksheet.h:1312
void AnonymizeCodeCells()
Anonymize the code cells in the current selection for a bug report (GH #1339).
Definition: Worksheet.cpp:6845
Definition: CellPointers.h:36
Definition: WheelSteps.h:40
bool CanTreeRedo() const
Can we redo a tree operation?
Definition: Worksheet.cpp:5511
void TreeUndo_CellEntered()
The cursor has entered one cell => save the value to see if it has changed.
Definition: Worksheet.cpp:3202
void TreeUndo_AppendAction()
Add another action to this undo action.
Definition: Worksheet.h:350
bool TreeUndoTextChange(UndoActions *sourcelist, UndoActions *undoForThisOperation)
Undo a text change.
Definition: Worksheet.cpp:5605
bool TreeUndo()
Undo a tree operation.
Definition: Worksheet.h:377
void TreeUndo_ClearRedoActionList()
Clear the list of actions for which an undo can be undone.
Definition: Worksheet.h:344
bool CanTreeUndo() const
Can we undo a tree operation?
Definition: Worksheet.cpp:5507
void TreeUndo_CellLeft()
The cursor is about to leave the current cell => Store the change if the value has changed.
Definition: Worksheet.cpp:3187
void TreeUndo_ClearUndoActionList()
Clear the list of actions for which undo can undo.
Definition: Worksheet.h:347
bool TreeUndoCellAddition(UndoActions *sourcelist, UndoActions *undoForThisOperation)
Undo adding cells.
Definition: Worksheet.cpp:5539
bool TreeUndoCellDeletion(UndoActions *sourcelist, UndoActions *undoForThisOperation)
Undo a call deletion.
Definition: Worksheet.cpp:5526
bool TreeRedo()
Redo an undone tree operation.
Definition: Worksheet.h:381
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:3178
bool TreeUndoFold(UndoActions *sourcelist, UndoActions *undoForThisOperation)
Undo a fold or unfold (GH #266)
Definition: Worksheet.cpp:5574
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
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