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 <optional>
34#include "precomp.h"
35#include "MaximaManual.h"
36#include "EventIDs.h"
37#include "RecentDocuments.h"
38#include "WheelSteps.h"
39#include <wx/wx.h>
40#include <wx/xml/xml.h>
41#include <wx/aui/aui.h>
42#include <wx/textfile.h>
43#include <wx/fdrepdlg.h>
44#include <wx/dc.h>
45#include <vector>
46#include <utility>
47#include <memory>
48#include <list>
49#include "CellPointers.h"
51#include "Notification.h"
52#include "cells/Cell.h"
53#include "cells/EditorCell.h"
54#include "cells/ImgCell.h"
55#include "cells/ImgCellBase.h"
56#include "cells/AnimationCell.h"
57#include "cells/GroupCell.h"
58#include "cells/MatrCell.h"
59#include "TreeUndoManager.h"
60#include "WorksheetCursor.h"
61#include "WorksheetDocument.h"
63#include "WorksheetSearch.h"
64#include "WorksheetLayout.h"
65#include "MatrixScrollbars.h"
66#include "ClipboardContents.h"
67#include "OutputNavigation.h"
68#include "cells/TextCell.h"
69#include "EvaluationQueue.h"
71#include "Autocomplete.h"
72#include "AutocompletePopup.h"
74#include "ToolBar.h"
75#include <thread>
76
119class Worksheet : public wxScrolled<wxWindow>, public WorksheetView,
121{
122public:
123 // WorksheetView: the narrow window surface the layout pipeline
124 // (WorksheetLayout) drives; each forwards to the wxScrolled base.
125 void GetViewClientSize(int *width, int *height) const override
126 { GetClientSize(width, height); }
127 int GetViewScrollUnitY() const override
128 { int x, y; GetViewStart(&x, &y); return y; }
129 void SetViewVirtualSize(int width, int height) override
130 { SetVirtualSize(width, height); }
131 void SetViewScrollRate(int rate) override { SetScrollRate(rate, rate); }
132 void GetViewPosition(int *x, int *y) const override
133 { const wxPoint p = GetPosition(); *x = p.x; *y = p.y; }
134 void ScrollViewToUnitY(int unitY) override
135 { Scroll(-1, unitY); RequestRedraw(); }
136
137 // WorksheetDocumentView: how m_document tells this window that a structural
138 // edit happened; each forwards to the real layout/redraw/save machinery.
139 void NotifyRecalculation(GroupCell *start) override
140 { RequestRecalculation(start); }
141 void NotifyRedraw(GroupCell *start) override { RequestRedraw(start); }
142 void NotifyAdjustSizeNeeded() override { m_layout.RequestAdjustSize(); }
143 void NotifySavedStateChanged() override { m_updateControls = true; }
144
146 RecentDocuments &UnsavedDocuments() { return m_unsavedDocuments; }
147private:
148 RecentDocuments m_unsavedDocuments;
149public:
151 bool UpdateControlsNeeded(){bool result = m_updateControls; m_updateControls = false; return result;}
152 void UpdateControlsNeeded(bool updateControlsNeeded){m_updateControls = updateControlsNeeded;}
153private:
155 wxString m_maximaDocDir;
157 bool m_updateControls = true;
159 bool m_scrollToCaret = false;
160 // The x position to scroll to
161 int m_newxPosition = -1;
162 // The y position to scroll to
163 int m_newyPosition = -1;
165 double m_zoomAtGestureStart = 1.0;
167 bool m_scrollToTopOfCell = false;
169 bool m_windowActive = true;
171 wxRegion m_regionToRefresh;
176 wxClientDC m_dc;
178 CellPtr<GroupCell> m_redrawStart;
180 bool m_fullRedrawRequested = false;
182
184 static wxDataFormat m_wxmFormat;
190 static wxDataFormat m_xmlFormat;
192 static wxDataFormat m_mathmlFormat;
194 static wxDataFormat m_mathmlFormat2;
196 static wxDataFormat m_rtfFormat;
198 static wxDataFormat m_rtfFormat2;
202 static wxDataFormat m_rtfFormat3;
203
206 class MathMLDataObject : public wxCustomDataObject
207 {
208 public:
209 explicit MathMLDataObject(const wxString &data);
210
211 MathMLDataObject();
212
213 private:
214 wxCharBuffer m_databuf;
215 };
216
218 class wxmDataObject : public wxCustomDataObject
219 {
220 public:
221 explicit wxmDataObject(const wxString &data);
222
223 wxmDataObject();
224
225 private:
226 wxCharBuffer m_databuf;
227 };
228
229 class MathMLDataObject2 : public wxCustomDataObject
230 {
231 public:
232 explicit MathMLDataObject2(const wxString &data);
233
234 MathMLDataObject2();
235
236 private:
237 wxCharBuffer m_databuf;
238 };
239
242 class RtfDataObject : public wxCustomDataObject
243 {
244 public:
245 explicit RtfDataObject(const wxString &data);
246
247 RtfDataObject();
248
249 private:
250 wxCharBuffer m_databuf;
251 };
252
253 class RtfDataObject2 : public wxCustomDataObject
254 {
255 public:
256 explicit RtfDataObject2(const wxString &data);
257
258 RtfDataObject2();
259
260 private:
261 wxCharBuffer m_databuf;
262 };
263
266 class RtfDataObject3 : public wxCustomDataObject
267 {
268 public:
269 explicit RtfDataObject3(const wxString &data);
270
271 RtfDataObject3();
272
273 private:
274 wxCharBuffer m_databuf;
275 };
276
278 bool m_hasFocus = true;
280 long m_lastTop = 0;
282 long m_lastBottom = 0;
304 // TreeUndoAction/UndoActions live in TreeUndoAction.h and the undo/redo
305 // state (the two stacks + the active-cell snapshot) is owned by the
306 // TreeUndoManager below; only the tree surgery of applying an action
307 // remains a Worksheet responsibility.
308
309private:
311 TreeUndoManager &GetTreeUndo() { return m_document.GetTreeUndo(); }
312 const TreeUndoManager &GetTreeUndo() const { return m_document.GetTreeUndo(); }
313
314public:
317
320
322 void TreeUndo_AppendAction() { GetTreeUndo().AppendAction(); }
323
329 bool TreeUndo(UndoActions *sourcelist, UndoActions *undoForThisOperation);
330
334 bool TreeUndoTextChange(UndoActions *sourcelist, UndoActions *undoForThisOperation);
338 bool TreeUndoCellDeletion(UndoActions *sourcelist, UndoActions *undoForThisOperation);
342 bool TreeUndoCellAddition(UndoActions *sourcelist, UndoActions *undoForThisOperation);
346 bool TreeUndoFold(UndoActions *sourcelist, UndoActions *undoForThisOperation);
347
349 bool TreeUndo()
350 { return TreeUndo(&GetTreeUndo().UndoStack(), &GetTreeUndo().RedoStack()); }
351
353 bool TreeRedo()
354 { return TreeUndo(&GetTreeUndo().RedoStack(), &GetTreeUndo().UndoStack()); }
355
357 bool CanTreeUndo() const;
358
360 bool CanTreeRedo() const;
361
365
368 void TreeUndo_CellLeft();
369
378 void TreeUndo_MarkCellsAsAdded(GroupCell *start, GroupCell *end, UndoActions *undoBuffer);
379
380
386 void TreeUndo_MarkCellsAsAdded(GroupCell *parentOfStart, GroupCell *end);
388
389
390private:
391 bool m_scrolledAwayFromEvaluation = false;
392public:
393
396 {
397 CLICK_TYPE_NONE,
398 CLICK_TYPE_GROUP_SELECTION,
399 CLICK_TYPE_INPUT_SELECTION,
400 CLICK_TYPE_INPUT_LABEL_SELECTION,
401 CLICK_TYPE_OUTPUT_SELECTION
402 };
403
406 {
407 TIMER_ID,
408 CARET_TIMER_ID,
409 DISPLAY_TIMEOUT_ID
410 };
411
417 std::unique_ptr<Cell> CopySelection(bool asData = false) const;
418
425 std::unique_ptr<MatrCell> CopySelectedMatrixBlock() const;
426
437 void SelectOutputRect(GroupCell *group, wxPoint down, wxPoint up);
438
456 std::optional<std::size_t> SelectedOutputResult() const;
458 void SelectOutputResult(GroupCell *group, std::size_t index);
465 bool StepOutputResult(int keyCode);
472
480 std::optional<OutputNavigation::Item> SelectedOutputItem() const;
502 bool NavigateOutput(int keyCode, bool shift);
504
516 bool StepSelectedMatrixBlock(int keyCode);
517
526 std::unique_ptr<Cell> CopySelection(Cell *start, Cell *end, bool asData = false) const;
527
529 void GetMaxPoint(int *width, int *height) { m_layout.GetMaxPoint(width, height); }
530
532 void OnTimer(wxTimerEvent &event);
533
535 void OnZoom(wxZoomGestureEvent &event);
536
537 void OnMouseExit(wxMouseEvent &event);
538
539 void OnMouseEnter(wxMouseEvent &event);
540
553 void OnPaint(wxPaintEvent &event);
555 void DrawGroupCell(wxDC &dc, wxDC &adc, GroupCell &cell);
563 void DrawGroupCell_UsingBitmap(wxDC *dc, GroupCell *cell);
564
566 void PrepareDrawGC(wxDC &dc) const;
567
568 void OnSize(wxSizeEvent &event);
569
570 void OnMouseRightDown(wxMouseEvent &event);
576 void OnContextMenuKey(wxContextMenuEvent &event);
577
578 void OnSidebarKey(wxCommandEvent &event);
579
580 void OnMouseLeftUp(wxMouseEvent &event);
581
583 void OnMouseCaptureLost(wxMouseCaptureLostEvent &event);
584
585 void OnMouseLeftDown(wxMouseEvent &event);
586
587 void OnMouseLeftInGcCell(wxMouseEvent &event, GroupCell *clickedInGC);
588
589 void OnMouseLeftInGcLeft(wxMouseEvent &event, GroupCell *clickedInGC);
590
591 void OnMouseLeftInGc(wxMouseEvent &event, GroupCell *clickedInGC);
592
593 void OnMouseMotion(wxMouseEvent &event);
594
596 void OnDoubleClick(wxMouseEvent &event);
604 bool OpenMatrixViewerAt(wxPoint position);
605
607 void OnCharInActive(wxKeyEvent &event);
608
610 void OnCharNoActive(wxKeyEvent &event);
611
613 void SelectEditable(EditorCell *editor, bool up);
614
621 void SelectWithChar(int ccode);
630 bool SelectWholeCellsFromOutput(int ccode);
631
646 void ClickNDrag(wxPoint down, wxPoint up);
647
648 // Select all group cells inside the given rectangle;
649 void SelectGroupCells(wxPoint down, wxPoint up);
650
651public:
658 static bool OpenLink(const wxString &url);
659
661 wxString LinkUnderPointer();
668 wxString GetLinkAt(wxPoint point);
669
671 const wxString &GetContextMenuLink() const { return m_contextMenuLink; }
673 void SetContextMenuLink(const wxString &link) { m_contextMenuLink = link; }
674
676 void AdjustSize() { m_layout.AdjustSize(); }
677
679 void OnEraseBackground(wxEraseEvent& WXUNUSED(event))
680 {}
681
682 void CheckUnixCopy();
683
684 void OnMouseMiddleUp(wxMouseEvent &event);
685
686 static bool IsLesserGCType(int type, int comparedTo);
687
690
693
695 void OnComplete(wxCommandEvent &event);
696
701 void EraseBackground(wxEraseEvent &event);
702
703private:
705 wxPoint m_leftDownPosition;
706 wxPoint m_down;
707 wxPoint m_up;
708 wxPoint m_mousePoint;
717 WorksheetCursor &GetHCaretCursor() { return m_document.GetCursor(); }
718 const WorksheetCursor &GetHCaretCursor() const { return m_document.GetCursor(); }
719 bool m_leftDown = false;
721 wxm::WheelSteps m_zoomWheelSteps;
723 wxm::WheelSteps m_animationWheelSteps;
729 const AnimationCell *m_wheelAnimation = nullptr;
731 bool m_followEvaluation = true;
732 bool m_mouseDrag = false;
733 bool m_mouseOutside = false;
734
735public:
738private:
739 int m_clickType = CLICK_TYPE_NONE;
740 CellPtr<GroupCell> m_clickInGC;
747 CellPtr<GroupCell> m_asyncOutputTarget;
754 CellPtr<Cell> m_outputRunAnchor;
756 bool m_blinkDisplayCaret = true;
758 bool m_hCaretBlinkVisible = true;
760 wxTimer m_timer;
762 wxTimer m_caretTimer;
763 std::vector<wxString> m_completions;
764 bool m_autocompleteTemplates = true;
765 AutocompletePopup *m_autocompletePopup;
766
767public:
769 bool IsEmpty() const
770 { return !GetTree() || (!GetTree()->GetNext() && GetTree()->GetEditable()->GetValue().Length() <= 1); }
773 {
774 if(m_autocompletePopup != nullptr)
775 m_autocompletePopup->Destroy();
776 }
777
783 void OnChar(wxKeyEvent &event);
784
789 void OnKeyDown(wxKeyEvent &event);
792
794 void NumberSections() const;
795
797 bool SectioningMoveIn(GroupCell *parent);
799 bool SectioningMoveOut(GroupCell *parent);
801 std::optional<Notification> &GetNotification() { return m_notificationMessage; }
802private:
804 std::optional<Notification> m_notificationMessage;
805public:
807 void WindowActive(bool active){m_windowActive = active;}
809 void ClearNotification();
814 void SetNotification(const wxString &message, int flags = wxICON_INFORMATION);
815
817 void OnActivate(wxActivateEvent &event);
818private:
821 std::unique_ptr<GroupCell> &TreeOwner() { return m_document.TreeOwner(); }
822 CellPtr<GroupCell> &LastCache() const { return m_document.LastCache(); }
823// std::vector<std::jthread> m_drawThreads;
824 static std::mutex m_drawDCLock;
827 Configuration *m_configuration = nullptr;
837 mutable std::weak_ptr<ClipboardContents> m_clipboardContents;
844 WorksheetLayout m_layout;
850 MatrixScrollbars m_matrixScrollbars{this};
851public:
853 MatrixScrollbars &GetMatrixScrollbars() { return m_matrixScrollbars; }
854 void FocusFindDialogue()
855 {
857 pane->SetFocus();
858 }
865 AutoComplete &GetAutocomplete() { return m_autocomplete; }
866private:
867 AutoComplete m_autocomplete;
868public:
869
870 Configuration *GetConfig() const { return m_configuration; }
871
874
878
879 EditorCell *MouseSelectionStart() const
881
882 EditorCell *SearchStart() const
883 { return GetViewCellPointers().SearchStart(); }
884
885 int IndexSearchStartedAt() const
887
894
896 TextCell *GetCurrentTextCell() const { return GetDocumentCellPointers().GetCurrentTextCell(); }
897 void SetCurrentTextCell(TextCell *cell) { GetDocumentCellPointers().SetCurrentTextCell(cell); }
898 void SetWorkingGroup(GroupCell *group) { GetDocumentCellPointers().SetWorkingGroup(group); }
899
906
924 {
925 m_redrawStart = nullptr;
926 m_fullRedrawRequested = false;
927 }
928
933 bool RedrawIfRequested();
934
947 void RequestRedraw(GroupCell *start = nullptr);
957 void RequestRedraw(wxRect rect);
958
961 {
964 }
965
968
971 m_configuration->ReadConfig();
974 Refresh();
975 }
976
986
988 const wxString &GetCurrentFile() const { return m_document.GetCurrentFile(); }
990 void SetCurrentFile(const wxString &file) { m_document.SetCurrentFile(file); }
991
1008 const wxString UnicodeToMaxima(wxString s) const
1009 { return UnicodeToMaxima(std::move(s), m_configuration); }
1011 static wxString UnicodeToMaxima(wxString s, const Configuration *configuration);
1012
1014 void ScrollToStart() { Scroll(0, 0); }
1015
1017 void ScrollToError();
1018
1025
1027 bool HCaretActive() const { return GetHCaretCursor().IsActive(); }
1029 void DeactivateHCaret() { GetHCaretCursor().Deactivate(); }
1030
1037
1038 bool CanUndo() const;
1039
1040 bool CanRedo() const;
1041
1042 void Undo();
1043
1044 void Redo();
1045
1050 void TreeUndo_ClearBuffers();
1051
1061 Worksheet(wxWindow *parent, int id, Configuration *config,
1062 wxPoint pos = wxDefaultPosition, wxSize size = wxDefaultSize,
1063 bool reactToEvents = true);
1064
1066 virtual ~Worksheet();
1067
1069 wxTimer &KeyboardInactiveTimer() { return m_keyboardInactiveTimer; }
1070private:
1071 wxTimer m_keyboardInactiveTimer;
1072public:
1073
1075 void DestroyTree();
1076
1078 std::unique_ptr<GroupCell> CopyTree() const;
1079
1091 GroupCell *InsertGroupCells(std::unique_ptr<GroupCell> &&cells, GroupCell *where,
1092 UndoActions *undoBuffer);
1093
1099 GroupCell *InsertGroupCells(std::unique_ptr<GroupCell> &&cells, GroupCell *where = nullptr);
1100
1106 void InsertLine(std::unique_ptr<Cell> &&newCell, bool forceNewLine = false);
1107
1114
1123 bool ScrollAnchorVisible();
1124
1135
1137 GroupCell *GetInsertGroup() const;
1138
1145 GroupCell *FindGroupCellByUUID(const wxString &uuid) const;
1146
1155 void SetAsyncOutputTarget(GroupCell *cell) { m_asyncOutputTarget = cell; }
1157 GroupCell *GetAsyncOutputTarget() const { return m_asyncOutputTarget; }
1158
1163 public:
1164 AsyncOutputTarget(Worksheet *worksheet, GroupCell *cell)
1165 : m_worksheet(worksheet) {
1166 if (m_worksheet)
1167 m_worksheet->SetAsyncOutputTarget(cell);
1168 }
1170 if (m_worksheet)
1171 m_worksheet->SetAsyncOutputTarget(nullptr);
1172 }
1173 AsyncOutputTarget(const AsyncOutputTarget &) = delete;
1174 AsyncOutputTarget &operator=(const AsyncOutputTarget &) = delete;
1175 private:
1176 Worksheet *m_worksheet;
1177 };
1178
1194 bool RecalculateIfNeeded(bool timeout = false, long timeSliceMs = 50)
1195 { return m_layout.RecalculateIfNeeded(timeout, timeSliceMs); }
1196
1207 void RequestRecalculation(Cell *start) { m_layout.RequestRecalculation(start); }
1208
1219
1221 int GetLastCellsVisited() const { return m_layout.GetLastCellsVisited(); }
1223 int GetLastCellsRecalculated() const { return m_layout.GetLastCellsRecalculated(); }
1224
1229 void ClearDocument();
1230
1231 void ResetInputPrompts();
1232
1233 bool CanCopy() const
1234 {
1238 }
1239
1248 bool CanCopyAsMathML() const;
1249
1251 bool CanCopyCSV() const;
1256 wxString SelectionToCSV() const;
1264 static wxString CSVDelimiter();
1265
1266 bool CanPaste() const
1267 { return GetDocumentCellPointers().GetActiveCell() || GetHCaretCursor().IsActive(); }
1268
1269 bool CanCut() const
1270 {
1273 }
1274
1276 void SelectAll();
1277
1280
1291 void DeleteRegion(
1292 GroupCell *start,
1293 GroupCell *end,
1294 UndoActions *undoBuffer
1295 );
1296
1303 void DeleteRegion(
1304 GroupCell *start,
1305 GroupCell *end
1306 );
1307
1313 void DeleteSelection();
1314
1315 void TOCdnd(GroupCell *dndStart, GroupCell *dndEnd);
1316
1318 bool CanDeleteRegion(GroupCell *start, const GroupCell *end) const;
1319
1322
1327 void DeleteCurrentCell();
1328
1331 {
1333 return nullptr;
1334 return dynamic_cast<AnimationCell *>(GetSelectionStart());
1335 }
1336
1355 bool ScrollSelectedMatrix(const wxMouseEvent &event);
1356private:
1358 wxPoint m_matrixWheelRemainder;
1359public:
1360
1363 {
1365 return nullptr;
1366 return dynamic_cast<ImgCell *>(GetSelectionStart());
1367 }
1368
1371 {
1373 return nullptr;
1374 return dynamic_cast<ImgCellBase *>(GetSelectionStart());
1375 }
1376
1379 {
1381 return nullptr;
1382 return dynamic_cast<TextCell *>(GetSelectionStart());
1383 }
1384
1386 bool CanAnimate() const
1387 {
1389 (dynamic_cast<AnimationCell *>(GetSelectionStart()) != nullptr);
1390 }
1391
1398 void Animate(bool run = true) const;
1399
1400 void DivideCell();
1401
1402 void MergeCells();
1403
1404 void SetLastQuestion(const wxString &lastQuestion){m_document.SetLastQuestion(lastQuestion);}
1405 wxString GetLastQuestion() const {return m_document.GetLastQuestion();}
1406
1408 bool CutToClipboard();
1409
1416 void PasteFromClipboard(bool primary = false);
1417
1427 static constexpr bool HasPrimarySelection() {
1428#if defined(__UNIX__) && !defined(__APPLE__)
1429 return true;
1430#else
1431 return false;
1432#endif
1433 }
1434
1441 bool Copy(bool astext = false) const;
1442
1450 std::unique_ptr<wxDataObject> CreateSelectionDataObject() const;
1451
1453 bool CopyCells() const;
1454
1461 std::unique_ptr<wxDataObject> CreateCellsDataObject() const;
1462
1464 bool CopyMatlab() const;
1465
1467 bool CopyCSV() const;
1468
1470 bool CopyText() const;
1471
1473 bool CopyTeX() const;
1474
1476 wxString ConvertSelectionToMathML() const;
1477
1479 static wxString CellsToMathML(const Cell *cells);
1480
1497
1503 static std::unique_ptr<wxDataObject>
1505
1508
1510 bool CopyMathML() const;
1511
1513 bool CopyBitmap() const;
1514
1516 bool CopyAnimation() const;
1517
1519 bool CopySVG() const;
1520
1521#if wxUSE_ENH_METAFILE
1523 bool CopyEMF() const;
1524#endif
1525
1527 bool CopyRTF() const;
1528
1532 bool CopyHTML() const;
1533
1541 wxString SelectionToSelfContainedHTML() const;
1542
1543 wxSize CopyToFile(const wxString &file) const;
1544
1545 wxSize CopyToFile(const wxString &file, Cell *start, Cell *end, bool asData = false, double scale = 1) const;
1546
1558 int ExportSelectionOutputToDir(const wxString &dir, bool svg);
1559
1564 bool ExportToHTML(const wxString &file);
1565
1567 bool ExportToMAC(const wxString &file);
1568
1570 wxString RTFStart() const;
1571
1573 wxString RTFEnd() const;
1574
1576 bool ExportToTeX(const wxString &file);
1577
1583 wxString GetString(bool lb = false) const;
1584
1585 GroupCell *GetTree() const { return m_document.GetTree(); }
1586 std::unique_ptr<GroupCell> *GetTreeAddress() { return &m_document.TreeOwner(); }
1587
1594
1601
1603 void ClearSelection() { SetSelection(nullptr, nullptr); }
1604
1606 void SetSelection(Cell *sel) { SetSelection(sel, sel); }
1607
1609 void SetSelection(Cell *start, Cell *end);
1610
1612 Cell *FindCellByUUID(const wxString &uuid);
1613
1616
1619 bool CanEdit() const { return m_document.CanEdit(); }
1620
1621 bool ActivatePrevInput() { return ActivateInput(-1); }
1622 bool ActivateNextInput() { return ActivateInput(+1); }
1623 wxString GetStatusText() const {return m_statusText;}
1624 bool StatusTextChangedHas() {
1625 bool retval = (m_statusTextHas != m_statusTextHas_old) ||
1626 (m_statusText != m_statusText_old);
1627 m_statusText_old = m_statusText;
1628 m_statusTextHas_old = m_statusTextHas;
1629 return retval;
1630 }
1631 bool StatusTextHas() const {return m_statusTextHas;}
1632private:
1638 void UpdateOutputSelectionString();
1639 /* ! A timer that tells us to urgently update the display
1640
1641 Normally we prioritize tasks: If there are GUI actions to process we do so.
1642 If not we look if there is data from maxima to process. If not we
1643 If not we recalculate the worksheet element sizes and positions and if
1644 there still is no pressing task we update the display. This way we
1645 respond quickly to the most important inputs.
1646
1647 This timer, if expired, tells us that if we don't update the screen now
1648 maxima feels like not being responsive.
1649 */
1650 wxTimer m_displayTimeoutTimer;
1651
1652 template <class T_SRC, class T_DEST>
1653 inline std::unique_ptr<T_DEST> unique_cast(std::unique_ptr<T_SRC> &&src)
1654 {
1655 if (!src) return std::unique_ptr<T_DEST>();
1656
1657 T_DEST *dest_ptr = &dynamic_cast<T_DEST &>(*src.get());
1658
1659 (void) src.release();
1660 return std::unique_ptr<T_DEST>(dest_ptr);
1661 }
1662 wxString m_statusText;
1663 wxString m_statusText_old;
1664 bool m_statusTextHas = false;
1665 bool m_statusTextHas_old = false;
1666 void StatusText(const wxString &text){m_statusText = text; m_statusTextHas = true;}
1667 void UnsetStatusText(){m_statusTextHas = false;}
1668 bool ActivateInput(int direction);
1669
1670public:
1673 {
1675 m_scrollToCaret = true;
1676 }
1677
1679 bool ScrollToCaretIfNeeded();
1680
1682 void ScrollToCellIfNeeded();
1683
1685 void ScheduleScrollToCell(Cell *cell, bool scrollToTop = true)
1686 {
1687 GetViewCellPointers().ScrollToCell(cell);
1688 m_scrollToTopOfCell = scrollToTop;
1689 m_scrollToCaret = false;
1690
1692 }
1693
1695 bool PointVisibleIs(wxPoint point);
1696
1698 bool CaretVisibleIs();
1699
1702
1716 void ShowPoint(wxPoint point);
1717
1719 void OnSetFocus(wxFocusEvent &event);
1720
1722 void OnKillFocus(wxFocusEvent &event);
1723
1725 bool IsSelected(CellType type) const { return m_document.IsSelected(type); }
1726
1733 void StepAnimation(int change = 1);
1734
1736 bool IsActiveInLast() const
1738
1741 {
1742 return GetLastCellInWorksheet();
1743 }
1744
1747
1748 void SetActiveCell(EditorCell *cell);
1749
1753 void SetDefaultHCaret();
1754
1759 void SetHCaret(GroupCell *where); // call with false, when manually refreshing
1762
1764 void OpenHCaret(const wxString &txt = {})
1765 {
1766 if(m_mainToolBar == nullptr)
1767 OpenHCaret(txt, GC_TYPE_CODE);
1768 else
1770 }
1771
1773 void OpenHCaret(const wxString &txt, GroupType type);
1774
1776 void ShowHCaret();
1777
1783
1791 bool HasTextFormat(TextFormat::Format flag) const;
1793 bool CanFormatText() const;
1794
1795 void UndoInsideCell();
1796
1802
1803 void RedoInsideCell();
1804
1814 void FollowEvaluation(bool followEvaluation);
1815
1817 bool FollowEvaluation() const
1818 { return m_followEvaluation; }
1819
1825 void ScrolledAwayFromEvaluation(bool ScrolledAway);
1826
1827 bool ScrolledAwayFromEvaluation() const
1828 { return m_scrolledAwayFromEvaluation; }
1829
1830 void SaveValue();
1831
1832 bool IsSaved() const
1833 { return m_document.IsSaved(); }
1834
1835 void SetSaved(bool saved)
1836 { m_document.SetSaved(saved); }
1837
1838 void OutputChanged()
1840
1842 void RemoveAllOutput();
1843
1851 void RemoveAllOutput(GroupCell *cell);
1852 // methods related to evaluation queue
1853
1859 void Evaluate();
1860
1862 void AddToEvaluationQueue(GroupCell *cell);
1863
1864 void AddDocumentToEvaluationQueue();
1865
1868
1871
1874
1877
1880
1883
1886
1889
1890 void FoldOccurred();
1891
1892 // methods for folding
1894 GroupCell *Fold(GroupCell *which) { return m_document.Fold(which); }
1895
1897 GroupCell *Unfold(GroupCell *which) { return m_document.Unfold(which); }
1898
1901
1902 GroupCell *ToggleFoldAll(GroupCell *which) { return m_document.ToggleFoldAll(which); }
1903
1904 void FoldAll() { m_document.FoldAll(); }
1905
1906 void UnfoldAll() { m_document.UnfoldAll(); }
1907
1908 // methods for zooming the document in and out
1909 void SetZoomFactor(double newzoom);
1910
1911 void CommentSelection();
1912
1917 void OnScrollChanged(wxScrollEvent &ev);
1918 void OnScrollEvent(wxScrollWinEvent &ev);
1919 void CheckIfActiveCellScrolledOut();
1924 void OnMouseWheel(wxMouseEvent &event);
1925
1931 bool FindIncremental(const wxString &str, bool down, bool ignoreCase, bool searchInInput = true, bool searchInOutput = true);
1932 bool FindIncremental_RegEx(const wxString &str, bool down, bool searchInInput = true, bool searchInOutput = true);
1933
1934private:
1938 WorksheetSearch::SearchStart FindStart(bool down);
1944 bool ApplyFindResult(const WorksheetSearch::SearchTarget &target, bool warn);
1945public:
1952 bool FindNext(const wxString &str, bool down, bool ignoreCase, bool searchInInput = true, bool searchInOutput = true, bool warn = true);
1953 bool FindNext_Regex(const wxString &str, const bool &down, bool searchInInput = true, bool searchInOutput = true, bool warn = true);
1954
1959 void Replace(const wxString &oldString, const wxString &newString, bool ignoreCase);
1960 void Replace_RegEx(const wxString &oldString, const wxString &newString);
1961
1966 int ReplaceAll(const wxString &oldString, const wxString &newString, bool ignoreCase, bool searchInInput = true, bool searchInOutput = true);
1967 int ReplaceAll_RegEx(const wxString &oldString, const wxString &newString, bool searchInInput = true, bool searchInOutput = true);
1968
1979 void AnonymizeCodeCells();
1980
1981 wxString GetInputAboveCaret();
1982
1983 wxString GetOutputAboveCaret();
1984
1986 void LoadSymbols();
1987
1988 bool Autocomplete(AutoComplete::autoCompletionType type = AutoComplete::command);
1989
1991 void AddSymbol(const wxString &fun, AutoComplete::autoCompletionType type = AutoComplete::command)
1992 { m_autocomplete.AddSymbol(fun, type); }
1993
1995 void AddSymbols(const wxString &xml)
1996 { m_autocomplete.AddSymbols(xml); }
1998 void AddSymbols(wxXmlDocument xml)
1999 { m_autocomplete.AddSymbols(xml); }
2000
2001 void SetActiveCellText(const wxString &text);
2002
2003 bool InsertText(const wxString &text);
2004
2005 void OpenNextOrCreateCell();
2006
2008 void OnFollow();
2009
2012
2014 void SelectGroupCell(GroupCell *cell);
2015
2020 void SetAnswer(const wxString &answer);
2022 void QuestionAnswered();
2023
2028 bool QuestionPending() const
2029 { return m_document.QuestionPending(); }
2031
2035 void QuestionPending(bool pending)
2036 { m_document.SetQuestionPending(pending); }
2037
2038 void SetMaximaDocDir(const wxString &dir)
2039 {
2040 m_maximaDocDir = dir;
2041 }
2042 const wxString &GetMaximaDocDir() const { return m_maximaDocDir; }
2043
2045 bool GCContainsCurrentQuestion(const GroupCell *cell);
2046
2049 bool OpenQuestionCaret(const wxString &txt = {});
2050
2059 bool WillAutoAnswer() const;
2060 void UpdateScrollPos();
2061
2067 GroupCell *GetWorkingGroup(bool resortToLast = false) const;
2069 void LoadHelpFileAnchors(const wxString &docdir, const wxString &maximaVersion)
2070 {m_maximaManual.LoadHelpFileAnchors(docdir, maximaVersion);}
2071 wxString GetHelpfileAnchorName(const wxString &keyword)
2072 {return m_maximaManual.GetHelpfileAnchorName(keyword);}
2073 wxString GetHelpfileURL(const wxString &keyword)
2074 {return m_maximaManual.GetHelpfileURL(keyword);}
2075
2077 std::vector<wxString> m_replacementsForCurrentWord;
2078#if wxUSE_ACCESSIBILITY
2079 int GetAccessibilityId(Cell *cell) const;
2080#endif
2081
2082#if wxUSE_ACCESSIBILITY
2083 class AccessibilityInfo: public wxAccessible
2084 {
2085 public:
2086 AccessibilityInfo(wxWindow *parent, Worksheet *worksheet);
2087 wxAccStatus GetName (int childId, wxString *name);
2088 wxAccStatus GetChildCount (int *childCount);
2089 wxAccStatus GetChild (int childId, wxAccessible **child);
2090 wxAccStatus GetDefaultAction(int childId, wxString *actionName);
2091 wxAccStatus GetParent (wxAccessible ** parent);
2092 wxAccStatus GetFocus (int *childId, wxAccessible **child);
2093 wxAccStatus GetLocation (wxRect &rect, int elementId);
2094 wxAccStatus HitTest (const wxPoint &pt,
2095 int *childId, wxAccessible **childObject);
2096 wxAccStatus GetDescription(int childId, wxString *description);
2097 wxAccStatus GetRole(int childId, wxAccRole *role);
2098 wxAccStatus GetState(int childId, long *state);
2099 private:
2100 wxWindow *m_parent = nullptr;
2101 Worksheet *m_worksheet = nullptr;
2102
2103 class CaretAccessibilityInfo : public wxAccessible {
2104 public:
2105 CaretAccessibilityInfo(AccessibilityInfo* parent, Worksheet* worksheet)
2106 : wxAccessible(worksheet->GetTargetWindow()), m_parent(parent), m_worksheet(worksheet) {}
2107
2108 wxAccStatus GetName(int childId, wxString *name) override;
2109 wxAccStatus GetDescription(int WXUNUSED(childId), wxString *description) override;
2110 wxAccStatus GetParent(wxAccessible **parent) override;
2111 wxAccStatus GetChildCount(int *childCount) override;
2112 wxAccStatus GetChild(int childId, wxAccessible **child) override;
2113 wxAccStatus GetRole(int childId, wxAccRole *role) override;
2114 private:
2115 AccessibilityInfo* m_parent;
2116 Worksheet* m_worksheet;
2117 };
2118 CaretAccessibilityInfo* m_caretAccessible = nullptr;
2119
2126 class SelectionAccessibilityInfo : public wxAccessible {
2127 public:
2128 SelectionAccessibilityInfo(AccessibilityInfo* parent, Worksheet* worksheet)
2129 : wxAccessible(worksheet->GetTargetWindow()), m_parent(parent), m_worksheet(worksheet) {}
2130
2131 wxAccStatus GetName(int childId, wxString *name) override;
2132 wxAccStatus GetParent(wxAccessible **parent) override;
2133 wxAccStatus GetChildCount(int *childCount) override;
2134 wxAccStatus GetChild(int childId, wxAccessible **child) override;
2135 wxAccStatus GetRole(int childId, wxAccRole *role) override;
2136 wxAccStatus GetState(int childId, long *state) override;
2137 private:
2138 AccessibilityInfo* m_parent;
2139 Worksheet* m_worksheet;
2140 };
2141 SelectionAccessibilityInfo* m_selectionAccessible = nullptr;
2143 int SelectionChildId() const;
2144 public:
2146 static bool HasOutputSelection(const Worksheet *worksheet);
2147 };
2148#endif
2149 MaximaManual m_maximaManual;
2150 MaximaManual *GetMaximaManual() {return &m_maximaManual;}
2151protected:
2152 void FocusTextControl();
2162 wxBitmap m_memory;
2163 virtual wxSize DoGetBestClientSize() const override;
2164#if wxUSE_ACCESSIBILITY
2165 AccessibilityInfo *m_accessibilityInfo = nullptr;
2166#endif
2168 int m_pointer_x = -1;
2170 int m_pointer_y = -1;
2172 bool m_mouseMotionWas = false;
2174 bool m_pointerCmdDown = false;
2176 bool m_linkCursorShown = false;
2178 static wxString LinkToolTip(const wxString &link);
2180 void UpdateLinkCursor(bool overLink);
2184 bool m_inPopupMenu = false;
2185};
2186
2187wxDECLARE_EVENT(TOC_UPDATE_NEEDED_EVENT, wxCommandEvent);
2188
2189#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:135
void AddSymbol(wxString fun, autoCompletionType type=command)
Manually add an autocompletable symbol to our symbols lists.
Definition: Autocomplete.cpp:686
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:289
CellType GetType() const
Returns the type of this cell.
Definition: Cell.h:550
The configuration storage for the current worksheet.
Definition: Configuration.h:101
void ReadConfig()
Read the config from the wxConfig object.
Definition: Configuration.cpp:631
A list of editor cells containing error messages.
Definition: CellPointers.h:57
The document-model half of the cell-pointer registry.
Definition: CellPointers.h:53
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:96
const CellPtr< Cell > & GetSelectionEnd() const
The last cell of the currently selected range of cells, or null.
Definition: CellPointers.h:98
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:91
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:193
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:286
Definition: ImgCellBase.h:42
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:545
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:282
const CellPtr< EditorCell > & MouseSelectionStart() const
The EditorCell a mouse selection was started in, or null.
Definition: CellPointers.h:309
int IndexSearchStartedAt() const
The cursor position an incremental search was started at (-1 = none).
Definition: CellPointers.h:297
const CellPtr< EditorCell > & KeyboardSelectionStart() const
The EditorCell a keyboard selection was started in, or null.
Definition: CellPointers.h:318
const CellPtr< EditorCell > & SearchStart() const
The EditorCell an incremental search was started in, or null.
Definition: CellPointers.h:295
void SetScrollToCellScheduled(bool scheduled)
Schedule (or cancel) scrolling to CellToScrollTo().
Definition: CellPointers.h:292
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:228
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:1162
The canvas that contains the spreadsheet the whole program is about.
Definition: Worksheet.h:121
void OnContextMenuKey(wxContextMenuEvent &event)
Opens the right-click menu for the selection from the keyboard (GH #2382)
Definition: Worksheet.cpp:1378
static constexpr bool HasPrimarySelection()
Does this platform have a primary selection?
Definition: Worksheet.h:1427
bool IsActiveInLast() const
Is the editor active in the last cell of the worksheet?
Definition: Worksheet.h:1736
bool RenderClipboardContents()
Replace this worksheet's lazily rendered clipboard data by data that no longer needs the worksheet (G...
Definition: Worksheet.cpp:2922
GroupCell * ToggleFold(GroupCell *which)
Fold or unfold a cell.
Definition: Worksheet.h:1900
void OnTimer(wxTimerEvent &event)
Is executed if a timer associated with Worksheet has expired.
Definition: Worksheet.cpp:4280
void ClearSelection()
Clear the selection - make it empty, i.e. no selection.
Definition: Worksheet.h:1603
void RequestRedraw(GroupCell *start=nullptr)
Request the worksheet to be redrawn.
Definition: Worksheet.cpp:506
bool CanMergeSelection() const
Can we merge the selected cells into one?
Definition: Worksheet.h:1036
bool IsSelectionInWorkingGroup() const
Is the selection in the current working group?
Definition: Worksheet.h:1746
int GetLastCellsRecalculated() const
How many cells the last layout pass truly recalculated. See WorksheetLayout.
Definition: Worksheet.h:1223
void SetViewScrollRate(int rate) override
Set the scroll granularity (device pixels per scroll unit) on both axes.
Definition: Worksheet.h:131
ImgCellBase * GetSelectedImgCellBase() const
Returns the selected cell - or nullptr, if the selection isn't image nor animation.
Definition: Worksheet.h:1370
MatrCell * GetSelectedScrollingMatrix() const
The scrolling matrix the selection lies in, or nullptr (GH #2479)
Definition: Worksheet.cpp:1780
void KeepCursorStillOnScreen()
Keep the cursor where it is on screen while a cell's output changes.
Definition: Worksheet.cpp:1075
wxString RTFStart() const
The start of a RTF document.
Definition: Worksheet.cpp:7181
int m_pointer_x
The x position of the mouse pointer.
Definition: Worksheet.h:2168
void SetDefaultHCaret()
Set the HCaret to its default location, at the end of the document.
Definition: Worksheet.cpp:5959
bool CanDeleteRegion(GroupCell *start, const GroupCell *end) const
Is it possible to delete the cells between start and end?
Definition: Worksheet.cpp:2967
void AddSectionToEvaluationQueue(GroupCell *start)
Adds a chapter, a section or a subsection to the evaluation queue.
Definition: Worksheet.cpp:5056
void AddSymbols(const wxString &xml)
Add a xml-encoded list of symbols to the autocompletion list.
Definition: Worksheet.h:1995
virtual ~Worksheet()
The destructor.
Definition: Worksheet.cpp:559
void SelectOutputRect(GroupCell *group, wxPoint down, wxPoint up)
Select what a rectangle dragged across a cell's output covers.
Definition: Worksheet.cpp:2036
bool CutToClipboard()
Add the currently selected cells to the clipboard and delete them.
Definition: Worksheet.cpp:5631
void SelectOutputItem(const OutputNavigation::Item &item)
Select a node of the output tree, scroll to it and announce it.
Definition: Worksheet.cpp:2125
void GetViewPosition(int *x, int *y) const override
The view's position within its parent, in device pixels (wxWindow::GetPosition).
Definition: Worksheet.h:132
WorksheetDocument m_document
The view-independent document state (file, current question, ...) that Worksheet's document accessors...
Definition: Worksheet.h:2156
FindReplacePane * m_findPane
The dockable find-and-replace sidebar (GH #2249), set once by wxMaximaFrame at startup and never dest...
Definition: Worksheet.h:1024
std::optional< std::size_t > SelectedOutputResult() const
Which result of its cell's output is selected, if exactly one is.
Definition: Worksheet.cpp:2092
std::unique_ptr< wxDataObject > CreateCellsDataObject() const
Build the multi-format clipboard object for a whole-cell selection.
Definition: Worksheet.cpp:2782
GroupCell * GetInsertGroup() const
The group that the line's cells will belong to - used by InsertLine.
Definition: Worksheet.cpp:1012
void OnCharNoActive(wxKeyEvent &event)
Key pressed and no cell was active.
Definition: Worksheet.cpp:3796
bool QuestionPending() const
Does maxima wait for the answer of a question?
Definition: Worksheet.h:2028
void AddEntireDocumentToEvaluationQueue()
Schedule all cells in the document for evaluation.
Definition: Worksheet.cpp:5047
WorksheetLayout::ScrollAnchor GetScrollAnchor() const
Where the cursor is, as the layout engine's scroll compensation needs it.
Definition: Worksheet.cpp:1067
static wxString CellsToMathML(const Cell *cells)
A MathML document showing a list of cells, nicely indented.
Definition: Worksheet.cpp:2537
bool CopyCSV() const
Copy the selected matrix, or block of one, to the clipboard as CSV.
Definition: Worksheet.cpp:2602
GroupCell * FirstVisibleGC()
The first groupCell that is currently visible.
Definition: Worksheet.cpp:1652
static std::unique_ptr< wxDataObject > CreateIndependentDataObject(const ClipboardContents &contents)
The data RenderClipboardContents() puts on the clipboard.
Definition: Worksheet.cpp:2889
bool HasTextFormat(TextFormat::Format flag) const
Is this character format on where the cursor is? (For the toolbar.)
Definition: Worksheet.cpp:6035
bool NavigateOutput(int keyCode, bool shift)
Walk through the parts of the selected output with the keyboard.
Definition: Worksheet.cpp:2213
bool CanFormatText() const
Is the cursor in a cell whose text can be formatted?
Definition: Worksheet.cpp:6040
void SetAsyncOutputTarget(GroupCell *cell)
Routes output to one specific cell instead of the one being evaluated.
Definition: Worksheet.h:1155
void UpdateConfigurationClientSize()
Inform the configuration about the current client size.
Definition: Worksheet.h:1615
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:6458
void AddSymbols(wxXmlDocument xml)
Add a xml-encoded list of symbols to the autocompletion list.
Definition: Worksheet.h:1998
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:2069
bool ExportToHTML(const wxString &file)
Export the file to an html document.
Definition: Worksheet.cpp:4673
void OpenHCaret(const wxString &txt={})
Place the cursor into a new cell where the horizontal cursor is.
Definition: Worksheet.h:1764
void NotifyAdjustSizeNeeded() override
The scrollable size will need re-adjusting once cell positions settle.
Definition: Worksheet.h:142
void ApplyOverlayScrollbarsSetting()
Apply the configuration's OverlayScrollbars() choice to this window.
Definition: Worksheet.cpp:534
TextCell * GetSelectedTextCell() const
Returns the selected cell - or nullptr, if the selection isn't a text cell.
Definition: Worksheet.h:1378
void ScrollToError()
Unfold the cell that produced the error, if necessary and, if requested, scroll to it.
Definition: Worksheet.cpp:934
bool HCaretActive() const
Is the vertically-drawn cursor active?
Definition: Worksheet.h:1027
void OnEraseBackground(wxEraseEvent &WXUNUSED(event))
Cannot be static as it is called using a function pointer to an object.
Definition: Worksheet.h:679
void ClearDocument()
Empties the current document.
Definition: Worksheet.cpp:1207
wxString RTFEnd() const
The end of a RTF document.
Definition: Worksheet.cpp:7185
ViewCellPointers m_viewCellPointers
The transient view-state half of the cell-pointer registry (hover, selection anchors,...
Definition: Worksheet.h:2160
void UpdateTableOfContents()
Update the table of contents.
Definition: Worksheet.cpp:7584
void RemoveAllOutput()
Remove all output cells from the whole worksheet.
Definition: Worksheet.cpp:6059
Cell * GetSelectionEnd() const
Return the last of the currently selected cells.
Definition: Worksheet.h:1599
void QuestionPending(bool pending)
Does maxima currently wait for the answer of a question?
Definition: Worksheet.h:2035
void ClickNDrag(wxPoint down, wxPoint up)
Select the rectangle surrounded by down and up.
Definition: Worksheet.cpp:1972
FindReplacePane * GetActiveFindPane() const
Whichever find/replace UI is actually in use right now: the dockable sidebar (GH #2249) if Configurat...
Definition: Worksheet.cpp:6264
DocumentCellPointers & GetDocumentCellPointers()
The document-model half of the cell-pointer registry (owned by m_document).
Definition: Worksheet.h:889
const wxString & GetCurrentFile() const
The name of the currently-opened file.
Definition: Worksheet.h:988
void SetCurrentFile(const wxString &file)
Set the name of the currently-opened file.
Definition: Worksheet.h:990
RecentDocuments & UnsavedDocuments()
The list of unsaved (autosaved) documents offered for recovery.
Definition: Worksheet.h:146
static bool OpenLink(const wxString &url)
Opens a link from a text cell in the user's web browser (GH #2396).
Definition: Worksheet.cpp:1850
bool CopyHTML() const
Copy a self-contained HTML version (inline CSS, base64-embedded images – see WorksheetExport::Selecti...
Definition: Worksheet.cpp:4480
void DeleteCurrentCell()
Delete the currently active cell - or the cell above this one.
Definition: Worksheet.cpp:2952
AutoComplete & GetAutocomplete()
The storage for the autocompletion feature.
Definition: Worksheet.h:865
AnimationCell * GetSelectedAnimation() const
Returns the selected cell - or nullptr, if the selection isn't an animation.
Definition: Worksheet.h:1330
void Replace(const wxString &oldString, const wxString &newString, bool ignoreCase)
Replace the current occurrence of a string.
Definition: Worksheet.cpp:6424
bool CopyMatlab() const
Copy a Matlab representation of the current selection to the clipboard.
Definition: Worksheet.cpp:2663
bool CopyText() const
Copy a textual representation of the current selection to the clipboard.
Definition: Worksheet.cpp:2733
wxString GetLinkAt(wxPoint point)
The link drawn at a point in worksheet coordinates, or "".
Definition: Worksheet.cpp:1875
bool StepOutputResult(int keyCode)
Move between results with the Up or Down key while no editor is active.
Definition: Worksheet.cpp:2155
bool m_inPopupMenu
Is there an active popup menu?
Definition: Worksheet.h:2184
EvaluationQueue & GetEvaluationQueue()
The list of cells that have to be evaluated.
Definition: Worksheet.h:1888
void Animate(bool run=true) const
Animate the current slide show.
Definition: Worksheet.cpp:5936
static GroupCell * StartOfSectioningUnit(GroupCell *start)
Finds the start of the current chapter/section/...
Definition: Worksheet.cpp:3353
bool CopyRTF() const
Copy a rtf version of the current selection to the clipboard.
Definition: Worksheet.cpp:4425
void UpdateConfig()
Re-read the configuration.
Definition: Worksheet.h:970
int m_pointer_y
The y position of the mouse pointer.
Definition: Worksheet.h:2170
MatrixScrollbars & GetMatrixScrollbars()
The native scrollbars of matrices shown in a scrolling viewport.
Definition: Worksheet.h:853
bool Copy(bool astext=false) const
Copy the current selection to the clipboard.
Definition: Worksheet.cpp:2422
bool CopyAnimation() const
Copy the current animation to the clipboard.
Definition: Worksheet.cpp:4403
const wxString UnicodeToMaxima(wxString s) const
Make a few unicode characters interpretable by maxima.
Definition: Worksheet.h:1008
void StepAnimation(int change=1)
Set the slide of the currently selected animation or advance it by one step.
Definition: Worksheet.cpp:4254
GroupCell * Unfold(GroupCell *which)
Unfold a cell (see WorksheetDocument::Unfold())
Definition: Worksheet.h:1897
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:3765
void SetAnswer(const wxString &answer)
Handling questions from and answers for maxima.
Definition: Worksheet.cpp:3080
bool CanCopyCSV() const
Is the selection a matrix, or a block of one, that "Copy as CSV" can copy?
Definition: Worksheet.cpp:2579
wxString m_contextMenuLink
The link the last context menu was opened on, see GetContextMenuLink().
Definition: Worksheet.h:2182
ViewCellPointers & GetViewCellPointers()
The transient view-state half of the cell-pointer registry (owned here).
Definition: Worksheet.h:892
void OnChar(wxKeyEvent &event)
Key for a printable character pressed.
Definition: Worksheet.cpp:4140
bool ScrollSelectedMatrix(const wxMouseEvent &event)
Lets a mouse wheel event scroll the selected scrolling matrix (GH #2479)
Definition: Worksheet.cpp:1801
void SelectWithChar(int ccode)
Handle selecting text using the keyboard Is called when the all of the following is true:
Definition: Worksheet.cpp:3628
void AddSelectionToEvaluationQueue()
Schedule all cells in the selection to be evaluated.
Definition: Worksheet.cpp:5085
bool HasCellsSelected() const
Is at least one entire cell selected?
Definition: Worksheet.h:1279
bool ScrollAnchorVisible()
Is the cursor on screen?
Definition: Worksheet.cpp:1092
std::optional< Notification > & GetNotification()
The error notification message, if any.
Definition: Worksheet.h:801
void OnSetFocus(wxFocusEvent &event)
What to do if the worksheet is in the input focus.
Definition: Worksheet.cpp:5898
void SetNotification(const wxString &message, int flags=wxICON_INFORMATION)
Inform the user that something happened in a non-active window.
Definition: Worksheet.cpp:4129
bool IsSelected(CellType type) const
Does the selection start with a cell of the type "type".
Definition: Worksheet.h:1725
GroupCell * GetAsyncOutputTarget() const
The cell async output is currently being routed to, if any.
Definition: Worksheet.h:1157
void ScheduleScrollToCell(Cell *cell, bool scrollToTop=true)
Schedules scrolling to a given cell.
Definition: Worksheet.h:1685
int GetViewScrollUnitY() const override
The current vertical scroll position, in scroll units (not pixels).
Definition: Worksheet.h:127
GroupCell * InsertGroupCells(std::unique_ptr< GroupCell > &&cells, GroupCell *where, UndoActions *undoBuffer)
Insert group cells into the worksheet.
Definition: Worksheet.cpp:914
void AddDocumentTillHereToEvaluationQueue()
Schedule all cells stopping with the one the caret is in for evaluation.
Definition: Worksheet.cpp:5101
void OnComplete(wxCommandEvent &event)
Is called if an action from the autocomplete menu is selected.
Definition: Worksheet.cpp:6921
bool CanAnimate() const
Does it make sense to enable the "Play" button and the slider now?
Definition: Worksheet.h:1386
bool RecalculateIfNeeded(bool timeout=false, long timeSliceMs=50)
Actually recalculate the worksheet.
Definition: Worksheet.h:1194
bool m_mouseMotionWas
Was there a mouse motion we didn't react to until now?
Definition: Worksheet.h:2172
void SelectAll()
Select the whole document.
Definition: Worksheet.cpp:5821
void DeactivateHCaret()
Hides the horizontal cursor, e.g. in a worksheet nothing can be inserted into.
Definition: Worksheet.h:1029
void OnKillFocus(wxFocusEvent &event)
What to do if the worksheet looses the input focus.
Definition: Worksheet.cpp:5910
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:1029
void ClearNotification()
Clears the notification message from SetNotification.
Definition: Worksheet.cpp:4127
void OnPaint(wxPaintEvent &event)
Is called by wxWidgets when it wants to redraw the worksheet or a part of it.
Definition: Worksheet.cpp:605
void OnFollow()
Called when the "Scroll to currently evaluated" button is pressed.
Definition: Worksheet.cpp:7105
void PrepareDrawGC(wxDC &dc) const
All that has need to be done before drawing a GroupCell in a DC.
Definition: Worksheet.cpp:783
void OnCharInActive(wxKeyEvent &event)
Key pressed inside a cell.
Definition: Worksheet.cpp:3397
Cell * GetSelectionStart() const
Return the first of the currently selected cells.
Definition: Worksheet.h:1592
void FoldOccurred()
Call when a fold action was detected, to update the state in response to a fold occurring.
Definition: Worksheet.cpp:1296
void OnMouseCaptureLost(wxMouseCaptureLostEvent &event)
Is called if we loose the mouse connection whilst selecting text/cells.
Definition: Worksheet.cpp:7189
wxTimer & KeyboardInactiveTimer()
The timer that tells us when the keyboard is inactive so an autosave isn't disrupting.
Definition: Worksheet.h:1069
ClickType
An enum for all classes of items one can click on.
Definition: Worksheet.h:396
ImgCell * GetSelectedImgCell() const
Returns the selected cell - or nullptr, if the selection isn't an image.
Definition: Worksheet.h:1362
Cell * FindCellByUUID(const wxString &uuid)
Find a cell by its UUID.
Definition: Worksheet.cpp:5149
void EraseBackground(wxEraseEvent &event)
Is called if wxWidgets wants to erase the worksheet's background.
Definition: Worksheet.cpp:320
bool StepSelectedMatrixBlock(int keyCode)
Grow or shrink the selected block of a matrix's entries (GH #2370)
Definition: Worksheet.cpp:2346
bool CanDeleteSelection() const
Is it possible to delete the currently selected cells?
Definition: Worksheet.h:1321
ToolBar * m_mainToolBar
The toolbar of the main window: We need to access it and therefore have it defined here.
Definition: Worksheet.h:2011
bool CaretVisibleIs()
Is the caret (hcaret or vcaret) currently visible on the worksheet?
Definition: Worksheet.cpp:6360
EditorCell * GetActiveCell() const
Get the currently active EditorCell.
Definition: Worksheet.h:873
bool UpdateControlsNeeded()
Is an update of the worksheet controls needed?
Definition: Worksheet.h:151
bool CopyCells() const
Copy the selection to the clipboard as it would appear in a .wxm file.
Definition: Worksheet.cpp:2766
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:3095
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:6201
GroupCell * GetLastCell()
Returns the last cell of the worksheet.
Definition: Worksheet.h:1740
GroupCell * GetHCaret()
The cell the horizontal cursor is above. nullptr means at the start of the document.
Definition: Worksheet.cpp:5942
wxString ConvertSelectionToMathML() const
Convert the current selection to MathML.
Definition: Worksheet.cpp:2526
bool CanUndoInsideCell() const
Is it possible to issue an undo in the currently selected cell?
Definition: Worksheet.h:1782
void PasteFromClipboard(bool primary=false)
Paste into the worksheet.
Definition: Worksheet.cpp:5664
void SetHCaret(GroupCell *where)
Set the HCaret at the location of the given Cell.
Definition: Worksheet.cpp:5969
bool CanRedoInsideCell() const
Is it possible to issue an undo in the currently selected cell?
Definition: Worksheet.h:1801
bool GCContainsCurrentQuestion(const GroupCell *cell)
Does the GroupCell cell points to contain the question currently asked by maxima?
Definition: Worksheet.cpp:3325
const wxString & GetContextMenuLink() const
The link the last context menu was opened on, or an empty string.
Definition: Worksheet.h:671
bool WillAutoAnswer() const
Execute all collected scroll events in one go.
Definition: Worksheet.cpp:3088
void ToggleTextFormat(TextFormat::Format flag)
Switch a character format (bold, ...) of the active text cell on or off.
Definition: Worksheet.cpp:6018
bool IsEmpty() const
Is this worksheet empty?
Definition: Worksheet.h:769
void NumberSections() const
Renumber all sections.
Definition: Worksheet.cpp:1240
std::optional< OutputNavigation::Item > SelectedOutputItem() const
The selected part of an output, as a node of OutputNavigation's tree.
Definition: Worksheet.cpp:2112
void SetViewVirtualSize(int width, int height) override
Set the scrollable (virtual) area, in device pixels.
Definition: Worksheet.h:129
void OnKeyDown(wxKeyEvent &event)
A special key has been pressed.
Definition: Worksheet.cpp:3220
GroupCell * FindGroupCellByUUID(const wxString &uuid) const
Finds a GroupCell by its UUID, or nullptr if no cell has that UUID.
Definition: Worksheet.cpp:994
EditorCell * KeyboardSelectionStart() const
Tells us which cell the keyboard selection has started in.
Definition: Worksheet.h:876
void SetSelection(Cell *sel)
Select the cell sel.
Definition: Worksheet.h:1606
void AddCellToEvaluationQueue(GroupCell *gc)
Schedule this cell for evaluation.
Definition: Worksheet.cpp:5119
void SetCellStyle(GroupCell *group, GroupType style)
Change the style of a cell.
Definition: Worksheet.cpp:3009
bool Autocomplete(AutoComplete::autoCompletionType type=AutoComplete::command)
Definition: Worksheet.cpp:6666
wxString SelectionToCSV() const
The selected matrix, or selected block of one, as CSV (GH #2364)
Definition: Worksheet.cpp:2593
wxBitmap m_memory
A memory we can manually buffer the contents of the area that is to be redrawn in.
Definition: Worksheet.h:2162
void LoadSymbols()
Compile a list of known autocompletion symbols.
Definition: Worksheet.cpp:4702
void SelectGroupCell(GroupCell *cell)
Set this cell as the currently selected one.
Definition: Worksheet.cpp:7091
void ShowPoint(wxPoint point)
Scrolls to a point on the worksheet.
Definition: Worksheet.cpp:5582
void WindowActive(bool active)
Is this window active?
Definition: Worksheet.h:807
bool ExportToTeX(const wxString &file)
export to a LaTeX file
Definition: Worksheet.cpp:4695
void AdjustSize()
Adjust the virtual size and scrollbars; see WorksheetLayout::AdjustSize().
Definition: Worksheet.h:676
void ScrollViewToUnitY(int unitY) override
Scroll vertically to the given position, in scroll units.
Definition: Worksheet.h:134
void ShowHCaret()
Activates the horizontal cursor.
Definition: Worksheet.cpp:6001
bool SelectWholeCellsFromOutput(int ccode)
Shift+Up/Down with something inside a cell's output selected.
Definition: Worksheet.cpp:3725
TimerIDs
An enum of individual IDs for all timers this class handles.
Definition: Worksheet.h:406
static wxString LinkToolTip(const wxString &link)
The tooltip for the pointer being over link: its address and how to open it.
Definition: Worksheet.cpp:1859
void CodeCellVisibilityChanged()
To be called after enabling or disabling the visibility of code cells.
Definition: Worksheet.cpp:4683
void UpdateLinkCursor(bool overLink)
Shows the hand cursor while the pointer is over a link and Ctrl is held.
Definition: Worksheet.cpp:1867
void ScrollToCaret()
Request to scroll to the cursor as soon as wxMaxima is idle.
Definition: Worksheet.h:1672
bool OpenMatrixViewerAt(wxPoint position)
Opens a MatrixViewer if there is a partially shown matrix at this point.
Definition: Worksheet.cpp:4967
wxString LinkUnderPointer()
The link a text cell or the output draws under the mouse pointer, or "".
Definition: Worksheet.cpp:1886
void MarkRefreshAsDone()
Handle redrawing the worksheet or of parts of it.
Definition: Worksheet.h:923
bool CopyMathML() const
Copy the MathML representation of the current selection to the clipboard.
Definition: Worksheet.cpp:2636
bool CopyBitmap() const
Copy a bitmap of the current selection to the clipboard.
Definition: Worksheet.cpp:4397
bool CanCopyAsMathML() const
Would "Copy as MathML" of the current selection produce actual math?
Definition: Worksheet.cpp:2617
void GetViewClientSize(int *width, int *height) const override
The visible client area, in device pixels.
Definition: Worksheet.h:125
GroupCell * Fold(GroupCell *which)
Fold a cell (see WorksheetDocument::Fold())
Definition: Worksheet.h:1894
bool PointVisibleIs(wxPoint point)
Is the point currently visible on the worksheet?
Definition: Worksheet.cpp:5561
std::unique_ptr< Cell > CopySelection(bool asData=false) const
Copy the currently selected cells.
Definition: Worksheet.cpp:4593
bool EnterOutputFromInput()
Down at the end of a cell's input: select the output's first result.
Definition: Worksheet.cpp:2199
GroupCell * GetLastCellInWorksheet() const
Returns a pointer to the last cell of this worksheet.
Definition: Worksheet.cpp:1967
void ScrollToStart()
Scroll to the start of the worksheet.
Definition: Worksheet.h:1014
void NotifyRecalculation(GroupCell *start) override
Schedule a re-layout of the document starting at start (null = all).
Definition: Worksheet.h:139
void SetContextMenuLink(const wxString &link)
Remembers the link the context menu is being opened on.
Definition: Worksheet.h:673
void AddSymbol(const wxString &fun, AutoComplete::autoCompletionType type=AutoComplete::command)
Add a symbol to the autocompletion list.
Definition: Worksheet.h:1991
bool CanEdit() const
We can edit the input if the we have the whole input in selection!
Definition: Worksheet.h:1619
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:6294
bool SectioningMoveIn(GroupCell *parent)
Make this chapter/section/... a section/subsection/... changing its subheadings, too.
Definition: Worksheet.cpp:6958
wxBitmap ConvertSelectionToBitmap() const
Convert the current selection to a bitmap.
bool RedrawIfRequested()
Redraw the worksheet if RequestRedraw() has been called.
Definition: Worksheet.cpp:332
bool ExportToMAC(const wxString &file)
Export the file to a text file maxima's load command can read.
Definition: Worksheet.cpp:4862
wxString SelectionToSelfContainedHTML() const
What CopyHTML() puts on the clipboard, without touching the clipboard.
Definition: Worksheet.cpp:4462
void OnZoom(wxZoomGestureEvent &event)
Handle pinch-to-zoom-events using the gesture interface.
Definition: Worksheet.cpp:4243
bool m_linkCursorShown
Does the worksheet currently show the hand cursor for a link?
Definition: Worksheet.h:2176
void SetActiveCell(EditorCell *cell)
Mark an editor cell as the active one.
Definition: Worksheet.cpp:5477
FindReplaceDialog * m_findDialog
The find-and-replace-dialog.
Definition: Worksheet.h:1020
void DrawGroupCell(wxDC &dc, wxDC &adc, GroupCell &cell)
Draws a groupcell on the DC.
Definition: Worksheet.cpp:849
void QuestionAnswered()
Mark the current question from maxima as "answered"..
Definition: Worksheet.cpp:3329
void DeleteRegion(GroupCell *start, GroupCell *end, UndoActions *undoBuffer)
Definition: Worksheet.cpp:3044
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:2104
bool ScrollToCaretIfNeeded()
Scrolls to the cursor, if requested.
Definition: Worksheet.cpp:6394
void NotifyRedraw(GroupCell *start) override
Schedule a redraw of the document starting at start (null = all).
Definition: Worksheet.h:141
std::unique_ptr< GroupCell > CopyTree() const
Copies the worksheet's entire contents.
Definition: Worksheet.cpp:4393
GroupCell * EndOfSectioningUnit(GroupCell *start)
Finds the end of the current chapter/section/...
Definition: Worksheet.cpp:3370
std::vector< wxString > m_replacementsForCurrentWord
Suggestions for how the word that was right-clicked on could continue.
Definition: Worksheet.h:2077
int ExportSelectionOutputToDir(const wxString &dir, bool svg)
Write each selected group cell's output to an image file in a folder.
Definition: Worksheet.cpp:4538
void ForceRedraw()
Redraw the window now and mark any pending redraw request as "handled".
Definition: Worksheet.h:960
bool CopyTeX() const
Copy the TeX representation of the current selection to the clipboard.
Definition: Worksheet.cpp:2695
void AddRestToEvaluationQueue()
Add all cells below the cursor to the evaluation queue.
Definition: Worksheet.cpp:5065
bool m_pointerCmdDown
Was Ctrl (Cmd on macOS) held during the last mouse motion?
Definition: Worksheet.h:2174
void ScrollToCellIfNeeded()
Scrolls to the cell given by ScheduleScrollToCell; Is called once we have time to do so.
Definition: Worksheet.cpp:5171
static wxString CSVDelimiter()
What separates the values "Copy as CSV" writes.
Definition: Worksheet.cpp:2587
void DrawGroupCell_UsingBitmap(wxDC *dc, GroupCell *cell)
Draws a groupcell in a bitmap and then blits it onto the DC.
Definition: Worksheet.cpp:798
void GetMaxPoint(int *width, int *height)
Get the coordinates of the bottom right point of the worksheet.
Definition: Worksheet.h:529
void OnMouseWheel(wxMouseEvent &event)
Called if the mouse wheel sents events.
Definition: Worksheet.cpp:1686
void RequestRecalculation()
Schedule a recalculation of the whole worksheet.
Definition: Worksheet.h:1218
void CloseAutoCompletePopup()
Close the autocompletion pop-up if it is currently open.
Definition: Worksheet.h:772
bool SectioningMoveOut(GroupCell *parent)
Make this section/subsection/... a chapter/section/... changing its subheadings, too.
Definition: Worksheet.cpp:7000
bool FollowEvaluation() const
Query if we want to automatically scroll to the cell that is currently evaluated.
Definition: Worksheet.h:1817
void DestroyTree()
Clear the whole worksheet.
Definition: Worksheet.cpp:4384
wxString GetString(bool lb=false) const
Convert the current selection to a string.
Definition: Worksheet.cpp:2401
void NotifySavedStateChanged() override
The document's saved-state flipped; refresh the controls that show it.
Definition: Worksheet.h:143
int GetLastCellsVisited() const
How many cells the last layout pass visited. See WorksheetLayout.
Definition: Worksheet.h:1221
std::unique_ptr< wxDataObject > CreateSelectionDataObject() const
Build the multi-format clipboard object for a non-cell selection.
Definition: Worksheet.cpp:2451
GroupCell * GetWorkingGroup(bool resortToLast=false) const
Returns the cell maxima currently works on.
Definition: Worksheet.cpp:972
bool CopySVG() const
Copy a svg of the current selection to the clipboard.
Definition: Worksheet.cpp:4411
void Evaluate()
Trigger the evaluation of the current cell(s)
Definition: Worksheet.cpp:3211
void OnScrollChanged(wxScrollEvent &ev)
Called if the user is using the scrollbar for scrolling through the document.
Definition: Worksheet.cpp:6127
void OnDoubleClick(wxMouseEvent &event)
Is called on double click on a cell.
Definition: Worksheet.cpp:4938
void OnActivate(wxActivateEvent &event)
Is called if this element looses or gets the focus.
Definition: Worksheet.cpp:5961
void AddToEvaluationQueue(GroupCell *cell)
Adds a group cell to the evaluation queue marking its contents as "outdated".
Definition: Worksheet.cpp:5040
std::unique_ptr< MatrCell > CopySelectedMatrixBlock() const
The selected sub-matrix, as a new matrix, or null (GH #2345)
Definition: Worksheet.cpp:2388
void RequestRecalculation(Cell *start)
Schedule a recalculation of the worksheet starting with the cell start.
Definition: Worksheet.h:1207
void AnonymizeCodeCells()
Anonymize the code cells in the current selection for a bug report (GH #1339).
Definition: Worksheet.cpp:6542
Definition: CellPointers.h:35
Definition: WheelSteps.h:40
bool CanTreeRedo() const
Can we redo a tree operation?
Definition: Worksheet.cpp:5290
void TreeUndo_CellEntered()
The cursor has entered one cell => save the value to see if it has changed.
Definition: Worksheet.cpp:3000
void TreeUndo_AppendAction()
Add another action to this undo action.
Definition: Worksheet.h:322
bool TreeUndoTextChange(UndoActions *sourcelist, UndoActions *undoForThisOperation)
Undo a text change.
Definition: Worksheet.cpp:5382
bool TreeUndo()
Undo a tree operation.
Definition: Worksheet.h:349
void TreeUndo_ClearRedoActionList()
Clear the list of actions for which an undo can be undone.
Definition: Worksheet.h:316
bool CanTreeUndo() const
Can we undo a tree operation?
Definition: Worksheet.cpp:5286
void TreeUndo_CellLeft()
The cursor is about to leave the current cell => Store the change if the value has changed.
Definition: Worksheet.cpp:2985
void TreeUndo_ClearUndoActionList()
Clear the list of actions for which undo can undo.
Definition: Worksheet.h:319
bool TreeUndoCellAddition(UndoActions *sourcelist, UndoActions *undoForThisOperation)
Undo adding cells.
Definition: Worksheet.cpp:5318
bool TreeUndoCellDeletion(UndoActions *sourcelist, UndoActions *undoForThisOperation)
Undo a call deletion.
Definition: Worksheet.cpp:5305
bool TreeRedo()
Redo an undone tree operation.
Definition: Worksheet.h:353
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:2976
bool TreeUndoFold(UndoActions *sourcelist, UndoActions *undoForThisOperation)
Undo a fold or unfold (GH #266)
Definition: Worksheet.cpp:5353
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:156
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