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 <wx/wx.h>
39#include <wx/xml/xml.h>
40#include <wx/aui/aui.h>
41#include <wx/textfile.h>
42#include <wx/fdrepdlg.h>
43#include <wx/dc.h>
44#include <vector>
45#include <utility>
46#include <memory>
47#include <list>
48#include "CellPointers.h"
50#include "Notification.h"
51#include "cells/Cell.h"
52#include "cells/EditorCell.h"
53#include "cells/ImgCell.h"
54#include "cells/ImgCellBase.h"
55#include "cells/AnimationCell.h"
56#include "cells/GroupCell.h"
57#include "TreeUndoManager.h"
58#include "WorksheetCursor.h"
59#include "WorksheetSearch.h"
60#include "WorksheetLayout.h"
61#include "cells/TextCell.h"
62#include "EvaluationQueue.h"
64#include "Autocomplete.h"
65#include "AutocompletePopup.h"
67#include "ToolBar.h"
68#include <thread>
69
112class Worksheet : public wxScrolled<wxWindow>, public WorksheetView
113{
114public:
115 // WorksheetView: the narrow window surface the layout pipeline
116 // (WorksheetLayout) drives; each forwards to the wxScrolled base.
117 void GetViewClientSize(int *width, int *height) const override
118 { GetClientSize(width, height); }
119 int GetViewScrollUnitY() const override
120 { int x, y; GetViewStart(&x, &y); return y; }
121 void SetViewVirtualSize(int width, int height) override
122 { SetVirtualSize(width, height); }
123 void SetViewScrollRate(int rate) override { SetScrollRate(rate, rate); }
124 void GetViewPosition(int *x, int *y) const override
125 { const wxPoint p = GetPosition(); *x = p.x; *y = p.y; }
126
128 RecentDocuments &UnsavedDocuments() { return m_unsavedDocuments; }
129private:
130 RecentDocuments m_unsavedDocuments;
131public:
133 bool UpdateControlsNeeded(){bool result = m_updateControls; m_updateControls = false; return result;}
134 void UpdateControlsNeeded(bool updateControlsNeeded){m_updateControls = updateControlsNeeded;}
135private:
137 wxString m_maximaDocDir;
139 bool m_updateControls = true;
141 bool m_scrollToCaret = false;
143 CellPointers m_cellPointers;
144 // The x position to scroll to
145 int m_newxPosition = -1;
146 // The y position to scroll to
147 int m_newyPosition = -1;
149 double m_zoomAtGestureStart = 1.0;
151 bool m_scrollToTopOfCell = false;
153 bool m_windowActive = true;
155 wxRegion m_regionToRefresh;
160 wxClientDC m_dc;
162 CellPtr<GroupCell> m_redrawStart;
164 bool m_fullRedrawRequested = false;
166
168 static wxDataFormat m_wxmFormat;
170 static wxDataFormat m_mathmlFormat;
172 static wxDataFormat m_mathmlFormat2;
174 static wxDataFormat m_rtfFormat;
176 static wxDataFormat m_rtfFormat2;
177
180 class MathMLDataObject : public wxCustomDataObject
181 {
182 public:
183 explicit MathMLDataObject(const wxString &data);
184
185 MathMLDataObject();
186
187 private:
188 wxCharBuffer m_databuf;
189 };
190
192 class wxmDataObject : public wxCustomDataObject
193 {
194 public:
195 explicit wxmDataObject(const wxString &data);
196
197 wxmDataObject();
198
199 private:
200 wxCharBuffer m_databuf;
201 };
202
203 class MathMLDataObject2 : public wxCustomDataObject
204 {
205 public:
206 explicit MathMLDataObject2(const wxString &data);
207
208 MathMLDataObject2();
209
210 private:
211 wxCharBuffer m_databuf;
212 };
213
216 class RtfDataObject : public wxCustomDataObject
217 {
218 public:
219 explicit RtfDataObject(const wxString &data);
220
221 RtfDataObject();
222
223 private:
224 wxCharBuffer m_databuf;
225 };
226
227 class RtfDataObject2 : public wxCustomDataObject
228 {
229 public:
230 explicit RtfDataObject2(const wxString &data);
231
232 RtfDataObject2();
233
234 private:
235 wxCharBuffer m_databuf;
236 };
237
239 bool m_hasFocus = true;
241 long m_lastTop = 0;
243 long m_lastBottom = 0;
265 // TreeUndoAction/UndoActions live in TreeUndoAction.h and the undo/redo
266 // state (the two stacks + the active-cell snapshot) is owned by the
267 // TreeUndoManager below; only the tree surgery of applying an action
268 // remains a Worksheet responsibility.
269
270private:
272 TreeUndoManager m_treeUndo;
273
274public:
277
280
282 void TreeUndo_AppendAction() { m_treeUndo.AppendAction(); }
283
286
292 bool TreeUndo(UndoActions *sourcelist, UndoActions *undoForThisOperation);
293
297 bool TreeUndoTextChange(UndoActions *sourcelist, UndoActions *undoForThisOperation);
301 bool TreeUndoCellDeletion(UndoActions *sourcelist, UndoActions *undoForThisOperation);
305 bool TreeUndoCellAddition(UndoActions *sourcelist, UndoActions *undoForThisOperation);
306
308 bool TreeUndo()
309 { return TreeUndo(&m_treeUndo.UndoStack(), &m_treeUndo.RedoStack()); }
310
312 bool TreeRedo()
313 { return TreeUndo(&m_treeUndo.RedoStack(), &m_treeUndo.UndoStack()); }
314
316 bool CanTreeUndo() const;
317
319 bool CanTreeRedo() const;
320
324
327 void TreeUndo_CellLeft();
328
337 void TreeUndo_MarkCellsAsAdded(GroupCell *start, GroupCell *end, UndoActions *undoBuffer);
338
339
345 void TreeUndo_MarkCellsAsAdded(GroupCell *parentOfStart, GroupCell *end);
347
348private:
349 bool m_scrolledAwayFromEvaluation = false;
350public:
351
354 {
355 CLICK_TYPE_NONE,
356 CLICK_TYPE_GROUP_SELECTION,
357 CLICK_TYPE_INPUT_SELECTION,
358 CLICK_TYPE_INPUT_LABEL_SELECTION,
359 CLICK_TYPE_OUTPUT_SELECTION
360 };
361
364 {
365 TIMER_ID,
366 CARET_TIMER_ID,
367 DISPLAY_TIMEOUT_ID
368 };
369
371 std::unique_ptr<Cell> CopySelection(bool asData = false) const;
372
381 std::unique_ptr<Cell> CopySelection(Cell *start, Cell *end, bool asData = false) const;
382
384 void GetMaxPoint(int *width, int *height) { m_layout.GetMaxPoint(width, height); }
385
387 void OnTimer(wxTimerEvent &event);
388
389#if wxCHECK_VERSION(3, 1, 1)
391 void OnZoom(wxZoomGestureEvent &event);
392#endif
393
394 void OnMouseExit(wxMouseEvent &event);
395
396 void OnMouseEnter(wxMouseEvent &event);
397
410 void OnPaint(wxPaintEvent &event);
412 void DrawGroupCell(wxDC &dc, wxDC &adc, GroupCell &cell);
420 void DrawGroupCell_UsingBitmap(wxDC *dc, GroupCell *cell);
421
423 void PrepareDrawGC(wxDC &dc) const;
424
425 void OnSize(wxSizeEvent &event);
426
427 void OnMouseRightDown(wxMouseEvent &event);
428
429 void OnSidebarKey(wxCommandEvent &event);
430
431 void OnMouseLeftUp(wxMouseEvent &event);
432
434 void OnMouseCaptureLost(wxMouseCaptureLostEvent &event);
435
436 void OnMouseLeftDown(wxMouseEvent &event);
437
438 void OnMouseLeftInGcCell(wxMouseEvent &event, GroupCell *clickedInGC);
439
440 void OnMouseLeftInGcLeft(wxMouseEvent &event, GroupCell *clickedInGC);
441
442 void OnMouseLeftInGc(wxMouseEvent &event, GroupCell *clickedInGC);
443
444 void OnMouseMotion(wxMouseEvent &event);
445
447 void OnDoubleClick(wxMouseEvent &event);
448
450 void OnCharInActive(wxKeyEvent &event);
451
453 void OnCharNoActive(wxKeyEvent &event);
454
456 void SelectEditable(EditorCell *editor, bool up);
457
464 void SelectWithChar(int ccode);
465
480 void ClickNDrag(wxPoint down, wxPoint up);
481
482 // Select all group cells inside the given rectangle;
483 void SelectGroupCells(wxPoint down, wxPoint up);
484
485public:
487 void AdjustSize() { m_layout.AdjustSize(); }
488
490 void OnEraseBackground(wxEraseEvent& WXUNUSED(event))
491 {}
492
493 void CheckUnixCopy();
494
495 void OnMouseMiddleUp(wxMouseEvent &event);
496
497 static bool IsLesserGCType(int type, int comparedTo);
498
501
504
506 void OnComplete(wxCommandEvent &event);
507
512 void EraseBackground(wxEraseEvent &event);
513
514private:
516 wxPoint m_leftDownPosition;
517 wxPoint m_down;
518 wxPoint m_up;
519 wxPoint m_mousePoint;
527 WorksheetCursor m_hCaret;
528 bool m_leftDown = false;
530 bool m_followEvaluation = true;
531 bool m_mouseDrag = false;
532 bool m_mouseOutside = false;
533
534public:
537private:
538 int m_clickType = CLICK_TYPE_NONE;
539 CellPtr<GroupCell> m_clickInGC;
541 bool m_blinkDisplayCaret = true;
543 bool m_hCaretBlinkVisible = true;
545 wxTimer m_timer;
547 wxTimer m_caretTimer;
549 bool m_saved = true;
550 std::vector<wxString> m_completions;
551 bool m_autocompleteTemplates = true;
552 AutocompletePopup *m_autocompletePopup;
553
554public:
556 bool IsEmpty() const
557 { return !m_tree || (!m_tree->GetNext() && m_tree->GetEditable()->GetValue().Length() <= 1); }
560 {
561 if(m_autocompletePopup != NULL)
562 m_autocompletePopup->Destroy();
563 }
564
570 void OnChar(wxKeyEvent &event);
571
576 void OnKeyDown(wxKeyEvent &event);
578 void SetCellStyle(GroupCell *group, GroupType style);
579
581 void NumberSections() const;
582
584 bool SectioningMoveIn(GroupCell *parent);
586 bool SectioningMoveOut(GroupCell *parent);
588 std::optional<Notification> &GetNotification() { return m_notificationMessage; }
589private:
591 std::optional<Notification> m_notificationMessage;
592public:
594 void WindowActive(bool active){m_windowActive = active;}
596 void ClearNotification();
601 void SetNotification(const wxString &message, int flags = wxICON_INFORMATION);
602
604 void OnActivate(wxActivateEvent &event);
605private:
607 std::unique_ptr<GroupCell> m_tree;
609 mutable CellPtr<GroupCell> m_last;
610// std::vector<std::jthread> m_drawThreads;
611 static std::mutex m_drawDCLock;
614 Configuration *m_configuration = NULL;
621 WorksheetLayout m_layout;
622public:
623 void FocusFindDialogue()
624 {
625 if(m_findDialog)
626 m_findDialog->SetFocus();
627 }
629 AutoComplete &GetAutocomplete() { return m_autocomplete; }
630private:
631 AutoComplete m_autocomplete;
632public:
633
634 Configuration *GetConfig() const { return m_configuration; }
635
637 EditorCell *GetActiveCell() const { return m_cellPointers.m_activeCell; }
638
641 { return m_cellPointers.m_cellKeyboardSelectionStartedIn; }
642
643 EditorCell *MouseSelectionStart() const
644 { return m_cellPointers.m_cellMouseSelectionStartedIn; }
645
646 EditorCell *SearchStart() const
647 { return m_cellPointers.m_cellSearchStartedIn; }
648
649 int IndexSearchStartedAt() const
650 { return m_cellPointers.m_indexSearchStartedAt; }
651
652 CellPointers &GetCellPointers() { return m_cellPointers; }
653
654 CellPointers::ErrorList &GetErrorList() { return m_cellPointers.m_errorList; }
655 TextCell *GetCurrentTextCell() const { return m_cellPointers.m_currentTextCell; }
656 void SetCurrentTextCell(TextCell *cell) { m_cellPointers.m_currentTextCell = cell; }
657 void SetWorkingGroup(GroupCell *group) { m_cellPointers.SetWorkingGroup(group); }
658
665
683 {
684 m_redrawStart = NULL;
685 m_fullRedrawRequested = false;
686 }
687
692 bool RedrawIfRequested();
693
706 void RequestRedraw(GroupCell *start = NULL);
716 void RequestRedraw(wxRect rect);
717
720 {
723 }
724
727
730 m_configuration->ReadConfig();
732 Refresh();
733 }
734
736 const wxString &GetCurrentFile() const { return m_currentFile; }
738 void SetCurrentFile(const wxString &file) { m_currentFile = file; }
739private:
740 wxString m_currentFile;
741public:
742
747 const wxString UnicodeToMaxima(wxString s);
748
750 void ScrollToStart() { Scroll(0, 0); }
751
753 void ScrollToError();
754
757
759 bool HCaretActive() const { return m_hCaret.IsActive(); }
760
766 bool CanMergeSelection() const;
767
768 bool CanUndo() const;
769
770 bool CanRedo() const;
771
772 void Undo();
773
774 void Redo();
775
780 void TreeUndo_ClearBuffers();
781
791 Worksheet(wxWindow *parent, int id, Configuration *config,
792 wxPoint pos = wxDefaultPosition, wxSize size = wxDefaultSize,
793 bool reactToEvents = true);
794
796 virtual ~Worksheet();
797
799 wxTimer &KeyboardInactiveTimer() { return m_keyboardInactiveTimer; }
800private:
801 wxTimer m_keyboardInactiveTimer;
802public:
803
805 void DestroyTree();
806
808 std::unique_ptr<GroupCell> CopyTree() const;
809
821 GroupCell *InsertGroupCells(std::unique_ptr<GroupCell> &&cells, GroupCell *where,
822 UndoActions *undoBuffer);
823
829 GroupCell *InsertGroupCells(std::unique_ptr<GroupCell> &&cells, GroupCell *where = NULL);
830
836 void InsertLine(std::unique_ptr<Cell> &&newCell, bool forceNewLine = false);
837
839 GroupCell *GetInsertGroup() const;
840
856 bool RecalculateIfNeeded(bool timeout = false, long timeSliceMs = 50)
857 { return m_layout.RecalculateIfNeeded(timeout, timeSliceMs); }
858
869 void RequestRecalculation(Cell *start) { m_layout.RequestRecalculation(start); }
870
873
878 void ClearDocument();
879
880 void ResetInputPrompts();
881
882 bool CanCopy() const
883 {
884 return m_cellPointers.m_selectionStart ||
885 (m_cellPointers.m_activeCell &&
886 m_cellPointers.m_activeCell->CanCopy());
887 }
888
889 bool CanPaste() const
890 { return m_cellPointers.m_activeCell || m_hCaret.IsActive(); }
891
892 bool CanCut() const
893 {
894 return (m_cellPointers.m_activeCell && m_cellPointers.m_activeCell->CanCopy()) ||
895 (m_cellPointers.m_selectionStart && m_cellPointers.m_selectionStart->GetType() == MC_TYPE_GROUP);
896 }
897
899 void SelectAll();
900
902 bool HasCellsSelected() const { return m_cellPointers.HasCellsSelected(); }
903
914 void DeleteRegion(
915 GroupCell *start,
916 GroupCell *end,
917 UndoActions *undoBuffer
918 );
919
926 void DeleteRegion(
927 GroupCell *start,
928 GroupCell *end
929 );
930
936 void DeleteSelection();
937
938 void TOCdnd(GroupCell *dndStart, GroupCell *dndEnd);
939
941 bool CanDeleteRegion(GroupCell *start, const GroupCell *end) const;
942
944 bool CanDeleteSelection() const;
945
950 void DeleteCurrentCell();
951
954 {
955 if(m_cellPointers.m_selectionStart != m_cellPointers.m_selectionEnd)
956 return NULL;
957 return dynamic_cast<AnimationCell *>(GetSelectionStart());
958 }
959
962 {
963 if(m_cellPointers.m_selectionStart != m_cellPointers.m_selectionEnd)
964 return NULL;
965 return dynamic_cast<ImgCell *>(GetSelectionStart());
966 }
967
970 {
971 if(m_cellPointers.m_selectionStart != m_cellPointers.m_selectionEnd)
972 return NULL;
973 return dynamic_cast<ImgCellBase *>(GetSelectionStart());
974 }
975
978 {
979 if(m_cellPointers.m_selectionStart != m_cellPointers.m_selectionEnd)
980 return NULL;
981 return dynamic_cast<TextCell *>(GetSelectionStart());
982 }
983
985 bool CanAnimate() const
986 {
987 return m_cellPointers.m_selectionStart && m_cellPointers.m_selectionStart == m_cellPointers.m_selectionEnd &&
988 (dynamic_cast<AnimationCell *>(GetSelectionStart()) != NULL);
989 }
990
997 void Animate(bool run = true) const;
998
999 void DivideCell();
1000
1001 void MergeCells();
1002
1003 void SetLastQuestion(const wxString &lastQuestion){m_lastQuestion = lastQuestion;}
1004 wxString GetLastQuestion() const {return m_lastQuestion;}
1005
1007 bool CutToClipboard();
1008
1009 void PasteFromClipboard();
1010
1017 bool Copy(bool astext = false) const;
1018
1020 bool CopyCells() const;
1021
1023 bool CopyMatlab() const;
1024
1026 bool CopyText() const;
1027
1029 bool CopyTeX() const;
1030
1032 wxString ConvertSelectionToMathML() const;
1033
1036
1038 bool CopyMathML() const;
1039
1041 bool CopyBitmap() const;
1042
1044 bool CopyAnimation() const;
1045
1047 bool CopySVG() const;
1048
1049#if wxUSE_ENH_METAFILE
1051 bool CopyEMF() const;
1052#endif
1053
1055 bool CopyRTF() const;
1056
1057 wxSize CopyToFile(const wxString &file) const;
1058
1059 wxSize CopyToFile(const wxString &file, Cell *start, Cell *end, bool asData = false, double scale = 1) const;
1060
1065 bool ExportToHTML(const wxString &file);
1066
1068 bool ExportToMAC(const wxString &file);
1069
1071 wxString RTFStart() const;
1072
1074 wxString RTFEnd() const;
1075
1077 bool ExportToTeX(const wxString &file);
1078
1084 wxString GetString(bool lb = false) const;
1085
1086 GroupCell *GetTree() const { return m_tree.get(); }
1087 std::unique_ptr<GroupCell> *GetTreeAddress() { return &m_tree; }
1088
1094 { return m_cellPointers.m_selectionStart; }
1095
1101 { return m_cellPointers.m_selectionEnd; }
1102
1104 void ClearSelection() { SetSelection(nullptr, nullptr); }
1105
1107 void SetSelection(Cell *sel) { SetSelection(sel, sel); }
1108
1110 void SetSelection(Cell *start, Cell *end);
1111
1113 Cell *FindCellByUUID(const wxString &uuid);
1114
1117
1120 bool CanEdit();
1121
1122 bool ActivatePrevInput() { return ActivateInput(-1); }
1123 bool ActivateNextInput() { return ActivateInput(+1); }
1124 wxString GetStatusText() const {return m_statusText;}
1125 bool StatusTextChangedHas() {
1126 bool retval = (m_statusTextHas != m_statusTextHas_old) ||
1127 (m_statusText != m_statusText_old);
1128 m_statusText_old = m_statusText;
1129 m_statusTextHas_old = m_statusTextHas;
1130 return retval;
1131 }
1132 bool StatusTextHas() const {return m_statusTextHas;}
1133private:
1134 /* ! A timer that tells us to urgently update the display
1135
1136 Normally we prioritize tasks: If there are GUI actions to process we do so.
1137 If not we look if there is data from maxima to process. If not we
1138 If not we recalculate the worksheet element sizes and positions and if
1139 there still is no pressing task we update the display. This way we
1140 respond quickly to the most important inputs.
1141
1142 This timer, if expired, tells us that if we don't update the screen now
1143 maxima feels like not being responsive.
1144 */
1145 wxTimer m_displayTimeoutTimer;
1146
1147 template <class T_SRC, class T_DEST>
1148 inline std::unique_ptr<T_DEST> unique_cast(std::unique_ptr<T_SRC> &&src)
1149 {
1150 if (!src) return std::unique_ptr<T_DEST>();
1151
1152 T_DEST *dest_ptr = &dynamic_cast<T_DEST &>(*src.get());
1153
1154 (void) src.release();
1155 return std::unique_ptr<T_DEST>(dest_ptr);
1156 }
1157 wxString m_statusText;
1158 wxString m_statusText_old;
1159 bool m_statusTextHas = false;
1160 bool m_statusTextHas_old = false;
1161 void StatusText(const wxString &text){m_statusText = text; m_statusTextHas = true;}
1162 void UnsetStatusText(){m_statusTextHas = false;}
1163 bool ActivateInput(int direction);
1164
1165public:
1168 {
1169 m_cellPointers.m_scrollToCell = false;
1170 m_scrollToCaret = true;
1171 }
1172
1174 bool ScrollToCaretIfNeeded();
1175
1177 void ScrollToCellIfNeeded();
1178
1180 void ScheduleScrollToCell(Cell *cell, bool scrollToTop = true)
1181 {
1182 m_cellPointers.ScrollToCell(cell);
1183 m_scrollToTopOfCell = scrollToTop;
1184 m_scrollToCaret = false;
1185
1186 m_cellPointers.m_scrollToCell = true;
1187 }
1188
1190 bool PointVisibleIs(wxPoint point);
1191
1193 bool CaretVisibleIs();
1194
1197
1211 void ShowPoint(wxPoint point);
1212
1214 void OnSetFocus(wxFocusEvent &event);
1215
1217 void OnKillFocus(wxFocusEvent &event);
1218
1220 bool IsSelected(CellType type);
1221
1228 void StepAnimation(int change = 1);
1229
1231 bool IsActiveInLast() const
1232 { return m_cellPointers.m_activeCell && m_cellPointers.m_activeCell->GetGroup() == GetLastCellInWorksheet(); }
1233
1236 {
1237 return GetLastCellInWorksheet();
1238 }
1239
1242
1243 void SetActiveCell(EditorCell *cell);
1244
1248 void SetDefaultHCaret();
1249
1254 void SetHCaret(GroupCell *where); // call with false, when manually refreshing
1257
1259 void OpenHCaret(const wxString &txt = {})
1260 {
1261 if(m_mainToolBar == NULL)
1262 OpenHCaret(txt, GC_TYPE_CODE);
1263 else
1265 }
1266
1268 void OpenHCaret(const wxString &txt, GroupType type);
1269
1271 void ShowHCaret();
1272
1277 bool CanUndoInsideCell() const;
1278
1279 void UndoInsideCell();
1280
1285 bool CanRedoInsideCell() const;
1286
1287 void RedoInsideCell();
1288
1298 void FollowEvaluation(bool followEvaluation);
1299
1301 bool FollowEvaluation() const
1302 { return m_followEvaluation; }
1303
1309 void ScrolledAwayFromEvaluation(bool ScrolledAway);
1310
1311 bool ScrolledAwayFromEvaluation() const
1312 { return m_scrolledAwayFromEvaluation; }
1313
1314 void SaveValue();
1315
1316 bool IsSaved() const
1317 { return m_saved; }
1318
1319 void SetSaved(bool saved)
1320 { if(m_saved != saved) m_updateControls = true; m_saved = saved;}
1321
1322 void OutputChanged()
1323 {
1324 if(m_currentFile.EndsWith(".wxmx"))
1325 m_saved = false;
1326 }
1327
1328 void RemoveAllOutput();
1329
1330 void RemoveAllOutput(GroupCell *cell);
1331 // methods related to evaluation queue
1332
1338 void Evaluate();
1339
1341 void AddToEvaluationQueue(GroupCell *cell);
1342
1343 void AddDocumentToEvaluationQueue();
1344
1347
1350
1353
1356
1359
1362
1365
1367 EvaluationQueue &GetEvaluationQueue() { return m_evaluationQueue; }
1368private:
1369 EvaluationQueue m_evaluationQueue;
1370public:
1371
1372 void FoldOccurred();
1373
1374 // methods for folding
1377
1379
1380 void FoldAll();
1381
1382 void UnfoldAll();
1383
1384 // methods for zooming the document in and out
1385 void SetZoomFactor(double newzoom);
1386
1387 void CommentSelection();
1388
1393 void OnScrollChanged(wxScrollEvent &ev);
1394 void OnScrollEvent(wxScrollWinEvent &ev);
1395 void CheckIfActiveCellScrolledOut();
1400 void OnMouseWheel(wxMouseEvent &event);
1401
1407 bool FindIncremental(const wxString &str, bool down, bool ignoreCase, bool searchInInput = true, bool searchInOutput = true);
1408 bool FindIncremental_RegEx(const wxString &str, bool down, bool searchInInput = true, bool searchInOutput = true);
1409
1410private:
1414 WorksheetSearch::SearchStart FindStart(bool down);
1420 bool ApplyFindResult(const WorksheetSearch::SearchTarget &target, bool warn);
1421public:
1428 bool FindNext(const wxString &str, bool down, bool ignoreCase, bool searchInInput = true, bool searchInOutput = true, bool warn = true);
1429 bool FindNext_Regex(const wxString &str, const bool &down, bool searchInInput = true, bool searchInOutput = true, bool warn = true);
1430
1435 void Replace(const wxString &oldString, const wxString &newString, bool ignoreCase);
1436 void Replace_RegEx(const wxString &oldString, const wxString &newString);
1437
1442 int ReplaceAll(const wxString &oldString, const wxString &newString, bool ignoreCase, bool searchInInput = true, bool searchInOutput = true);
1443 int ReplaceAll_RegEx(const wxString &oldString, const wxString &newString, bool searchInInput = true, bool searchInOutput = true);
1444
1445 wxString GetInputAboveCaret();
1446
1447 wxString GetOutputAboveCaret();
1448
1450 void LoadSymbols();
1451
1452 bool Autocomplete(AutoComplete::autoCompletionType type = AutoComplete::command);
1453
1455 void AddSymbol(const wxString &fun, AutoComplete::autoCompletionType type = AutoComplete::command)
1456 { m_autocomplete.AddSymbol(fun, type); }
1457
1459 void AddSymbols(const wxString &xml)
1460 { m_autocomplete.AddSymbols(xml); }
1462 void AddSymbols(wxXmlDocument xml)
1463 { m_autocomplete.AddSymbols(xml); }
1464
1465 void SetActiveCellText(const wxString &text);
1466
1467 bool InsertText(const wxString &text);
1468
1469 void OpenNextOrCreateCell();
1470
1472 void OnFollow();
1473
1476
1478 void SelectGroupCell(GroupCell *cell);
1479
1484 void SetAnswer(const wxString &answer);
1486 void QuestionAnswered();
1487
1488private:
1490 bool m_questionPrompt = false;
1491public:
1492
1497 bool QuestionPending() const
1498 { return m_questionPrompt; }
1500
1504 void QuestionPending(bool pending)
1505 { m_questionPrompt = pending; }
1506
1507 void SetMaximaDocDir(const wxString &dir)
1508 {
1509 m_maximaDocDir = dir;
1510 }
1511 const wxString &GetMaximaDocDir() const { return m_maximaDocDir; }
1512
1514 bool GCContainsCurrentQuestion(const GroupCell *cell);
1515
1518 bool OpenQuestionCaret(const wxString &txt = {});
1519 void UpdateScrollPos();
1520
1526 GroupCell *GetWorkingGroup(bool resortToLast = false) const;
1528 void LoadHelpFileAnchors(const wxString &docdir, const wxString &maximaVersion)
1529 {m_maximaManual.LoadHelpFileAnchors(docdir, maximaVersion);}
1530 wxString GetHelpfileAnchorName(const wxString &keyword)
1531 {return m_maximaManual.GetHelpfileAnchorName(keyword);}
1532 wxString GetHelpfileURL(const wxString &keyword)
1533 {return m_maximaManual.GetHelpfileURL(keyword);}
1534
1536 std::vector<wxString> m_replacementsForCurrentWord;
1537#if wxUSE_ACCESSIBILITY
1538 int GetAccessibilityId(Cell *cell) const;
1539#endif
1540
1541#if wxUSE_ACCESSIBILITY
1542 class AccessibilityInfo: public wxAccessible
1543 {
1544 public:
1545 AccessibilityInfo(wxWindow *parent, Worksheet *worksheet);
1546 wxAccStatus GetName (int childId, wxString *name);
1547 wxAccStatus GetChildCount (int *childCount);
1548 wxAccStatus GetChild (int childId, wxAccessible **child);
1549 wxAccStatus GetDefaultAction(int childId, wxString *actionName);
1550 wxAccStatus GetParent (wxAccessible ** parent);
1551 wxAccStatus GetFocus (int *childId, wxAccessible **child);
1552 wxAccStatus GetLocation (wxRect &rect, int elementId);
1553 wxAccStatus HitTest (const wxPoint &pt,
1554 int *childId, wxAccessible **childObject);
1555 wxAccStatus GetDescription(int childId, wxString *description);
1556 wxAccStatus GetRole(int childId, wxAccRole *role);
1557 wxAccStatus GetState(int childId, long *state);
1558 private:
1559 wxWindow *m_parent = NULL;
1560 Worksheet *m_worksheet = NULL;
1561
1562 class CaretAccessibilityInfo : public wxAccessible {
1563 public:
1564 CaretAccessibilityInfo(AccessibilityInfo* parent, Worksheet* worksheet)
1565 : wxAccessible(worksheet->GetTargetWindow()), m_parent(parent), m_worksheet(worksheet) {}
1566
1567 wxAccStatus GetName(int childId, wxString *name) override;
1568 wxAccStatus GetDescription(int WXUNUSED(childId), wxString *description) override;
1569 wxAccStatus GetParent(wxAccessible **parent) override;
1570 wxAccStatus GetChildCount(int *childCount) override;
1571 wxAccStatus GetChild(int childId, wxAccessible **child) override;
1572 wxAccStatus GetRole(int childId, wxAccRole *role) override;
1573 private:
1574 AccessibilityInfo* m_parent;
1575 Worksheet* m_worksheet;
1576 };
1577 CaretAccessibilityInfo* m_caretAccessible = nullptr;
1578 };
1579#endif
1580 MaximaManual m_maximaManual;
1581 MaximaManual *GetMaximaManual() {return &m_maximaManual;}
1582protected:
1583 void FocusTextControl();
1584 wxString m_lastQuestion;
1586 wxBitmap m_memory;
1587 virtual wxSize DoGetBestClientSize() const override;
1588#if wxUSE_ACCESSIBILITY
1589 AccessibilityInfo *m_accessibilityInfo = NULL;
1590#endif
1592 int m_pointer_x = -1;
1594 int m_pointer_y = -1;
1596 bool m_mouseMotionWas = false;
1598 bool m_inPopupMenu = false;
1599};
1600
1601wxDECLARE_EVENT(TOC_UPDATE_NEEDED_EVENT, wxCommandEvent);
1602
1603#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:63
@ MC_TYPE_GROUP
A group cells that bundles several individual cells together.
Definition: Cell.h:81
This file contains the definition of the class EditorCell.
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:42
This file declares the class MaximaManual.
This file defines the class Notification.
The definition of the class RecentDocuments that provides a recent files mechanism that is extensible...
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:120
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.
The worksheet's "between the cells" cursor (the horizontally drawn caret).
The worksheet's layout engine: scheduling, the recalculation walk and the virtual-size update,...
The worksheet's search engine.
Definition: AnimationCell.h:46
Definition: Autocomplete.h:61
autoCompletionType
All types of things we can autocomplete.
Definition: Autocomplete.h:68
void AddSymbols(wxString xml)
Interprets the XML autocompletable symbol list maxima can send us.
Definition: Autocomplete.cpp:135
void AddSymbol(wxString fun, autoCompletionType type=command)
Manually add an autocompletable symbol to our symbols lists.
Definition: Autocomplete.cpp:647
Definition: AutocompletePopup.h:47
A list of editor cells containing error messages.
Definition: CellPointers.h:70
The storage for pointers to cells.
Definition: CellPointers.h:45
ErrorList m_errorList
The list of cells maxima has complained about errors in.
Definition: CellPointers.h:93
bool m_scrollToCell
Is scrolling to a cell scheduled?
Definition: CellPointers.h:199
CellPtr< EditorCell > m_activeCell
Which EditCell the blinking cursor is in?
Definition: CellPointers.h:103
CellPtr< EditorCell > m_cellKeyboardSelectionStartedIn
The EditorCell the keyboard selection has started in.
Definition: CellPointers.h:97
void SetWorkingGroup(GroupCell *group)
Sets the cell maxima currently works on. NULL if there isn't such a cell.
Definition: CellPointers.cpp:90
CellPtr< Cell > m_selectionStart
The first cell of the currently selected range of Cells.
Definition: CellPointers.h:147
int m_indexSearchStartedAt
Which cursor position incremental search has started at?
Definition: CellPointers.h:101
CellPtr< EditorCell > m_cellMouseSelectionStartedIn
The EditorCell the mouse selection has started in.
Definition: CellPointers.h:95
CellPtr< EditorCell > m_cellSearchStartedIn
The EditorCell the search was started in.
Definition: CellPointers.h:99
CellPtr< TextCell > m_currentTextCell
The textcell the text maxima is sending us was ending in.
Definition: CellPointers.h:111
CellPtr< Cell > m_selectionEnd
The last cell of the currently selected range of Cells.
Definition: CellPointers.h:168
A weak non-owning pointer that becomes null whenever the observed object is destroyed.
Definition: CellPtr.h:511
The base class all cell types the worksheet can consist of are derived from.
Definition: Cell.h:141
GroupCell * GetGroup() const
Returns the group cell this cell belongs to.
Definition: Cell.cpp:282
CellType GetType() const
Returns the type of this cell.
Definition: Cell.h:452
The configuration storage for the current worksheet.
Definition: Configuration.h:97
void ReadConfig()
Read the config from the wxConfig object.
Definition: Configuration.cpp:581
This class defines what the user sees as input cell.
Definition: EditorCell.h:59
bool CanCopy() const override
Select Can we copy the editable text of this cell?
Definition: EditorCell.h:345
A simple FIFO queue with manual removal of elements.
Definition: EvaluationQueue.h:43
The find+replace dialog.
Definition: FindReplaceDialog.h:42
A cell grouping input (and, if there is one, also the output) cell to a foldable item.
Definition: GroupCell.h:87
Definition: ImgCellBase.h:42
Definition: ImgCell.h:35
Definition: MaximaManual.h:59
void LoadHelpFileAnchors(const wxString &docdir, const wxString &maximaVersion)
Search maxima's help file for command and variable names.
Definition: MaximaManual.cpp:538
A class that maintains a list of recent documents.
Definition: RecentDocuments.h:42
A Text cell.
Definition: TextCell.h:38
Definition: ToolBar.h:41
GroupType GetCellType()
Get the cell style for new cells.
Definition: ToolBar.cpp:698
Owns the cell-tree undo/redo stacks and the active-cell snapshot.
Definition: TreeUndoManager.h:51
void ClearUndoActionList()
Clear the list of actions that can be undone.
Definition: TreeUndoManager.h:94
UndoActions & UndoStack()
The list of tree actions that can be undone.
Definition: TreeUndoManager.h:54
UndoActions & RedoStack()
The list of undone tree actions that can be redone.
Definition: TreeUndoManager.h:58
void ClearRedoActionList()
Clear the list of actions that can be redone.
Definition: TreeUndoManager.h:87
static void AppendAction(UndoActions *actionList)
Mark the newest action of the list as part of the following atomic action.
Definition: TreeUndoManager.h:77
The between-the-cells cursor: active flag, position, selection anchors.
Definition: WorksheetCursor.h:49
bool IsActive() const
Is this (rather than the in-cell text cursor) the active cursor?
Definition: WorksheetCursor.h:52
The layout/recalculation engine of a worksheet.
Definition: WorksheetLayout.h:54
void RequestRecalculation(Cell *start)
Schedule a recalculation of the worksheet starting with the cell start.
Definition: WorksheetLayout.cpp:136
void GetMaxPoint(int *width, int *height)
Get the coordinates of the bottom right point of the worksheet.
Definition: WorksheetLayout.cpp:178
void UpdateConfigurationClientSize()
Inform the configuration about the view's current client size.
Definition: WorksheetLayout.cpp:165
void AdjustSize()
Adjust the virtual size and scrollbars to the document's extent.
Definition: WorksheetLayout.cpp:224
bool RecalculateIfNeeded(bool timeout=false, long timeSliceMs=50)
Perform the scheduled recalculation, if one is pending.
Definition: WorksheetLayout.cpp:41
The narrow view surface the worksheet's layout pipeline needs.
Definition: WorksheetSizeMath.h:172
The canvas that contains the spreadsheet the whole program is about.
Definition: Worksheet.h:113
bool IsActiveInLast() const
Is the editor active in the last cell of the worksheet?
Definition: Worksheet.h:1231
GroupCell * ToggleFold(GroupCell *which)
Fold or unfold a cell.
Definition: Worksheet.cpp:1111
void OnTimer(wxTimerEvent &event)
Is executed if a timer associated with Worksheet has expired.
Definition: Worksheet.cpp:3363
void ClearSelection()
Clear the selection - make it empty, i.e. no selection.
Definition: Worksheet.h:1104
const wxString UnicodeToMaxima(wxString s)
Make a few unicode characters interpretable by maxima.
Definition: Worksheet.cpp:3652
bool CanMergeSelection() const
Can we merge the selected cells into one?
Definition: Worksheet.cpp:4242
void SetViewScrollRate(int rate) override
Set the scroll granularity (device pixels per scroll unit) on both axes.
Definition: Worksheet.h:123
ImgCellBase * GetSelectedImgCellBase() const
Returns the selected cell - or NULL, if the selection isn't image nor animation.
Definition: Worksheet.h:969
wxString RTFStart() const
The start of a RTF document.
Definition: Worksheet.cpp:5888
int m_pointer_x
The x position of the mouse pointer.
Definition: Worksheet.h:1592
void SetDefaultHCaret()
Set the HCaret to its default location, at the end of the document.
Definition: Worksheet.cpp:4873
bool CanDeleteRegion(GroupCell *start, const GroupCell *end) const
Is it possible to delete the cells between start and end?
Definition: Worksheet.cpp:2085
void AddSectionToEvaluationQueue(GroupCell *start)
Adds a chapter, a section or a subsection to the evaluation queue.
Definition: Worksheet.cpp:3971
void AddSymbols(const wxString &xml)
Add a xml-encoded list of symbols to the autocompletion list.
Definition: Worksheet.h:1459
void FoldAll()
Recursively folds the whole document.
Definition: Worksheet.cpp:1148
virtual ~Worksheet()
The destructor.
Definition: Worksheet.cpp:447
bool CutToClipboard()
Add the currently selected cells to the clipboard and delete them.
Definition: Worksheet.cpp:4561
void GetViewPosition(int *x, int *y) const override
The view's position within its parent, in device pixels (wxWindow::GetPosition).
Definition: Worksheet.h:124
GroupCell * GetInsertGroup() const
The group that the line's cells will belong to - used by InsertLine.
Definition: Worksheet.cpp:876
void OnCharNoActive(wxKeyEvent &event)
Key pressed and no cell was active.
Definition: Worksheet.cpp:2886
bool QuestionPending() const
Does maxima wait for the answer of a question?
Definition: Worksheet.h:1497
void AddEntireDocumentToEvaluationQueue()
Schedule all cells in the document for evaluation.
Definition: Worksheet.cpp:3962
GroupCell * FirstVisibleGC()
The first groupCell that is currently visible.
Definition: Worksheet.cpp:1474
void UpdateConfigurationClientSize()
Inform the configuration about the current client size.
Definition: Worksheet.h:1116
int ReplaceAll(const wxString &oldString, const wxString &newString, bool ignoreCase, bool searchInInput=true, bool searchInOutput=true)
Replace all occurrences of a string.
Definition: Worksheet.cpp:5337
void AddSymbols(wxXmlDocument xml)
Add a xml-encoded list of symbols to the autocompletion list.
Definition: Worksheet.h:1462
void LoadHelpFileAnchors(const wxString &docdir, const wxString &maximaVersion)
Tries to parse maxima's manual in order to find out which anchors it contains.
Definition: Worksheet.h:1528
bool ExportToHTML(const wxString &file)
Export the file to an html document.
Definition: Worksheet.cpp:3622
void OpenHCaret(const wxString &txt={})
Place the cursor into a new cell where the horizontal cursor is.
Definition: Worksheet.h:1259
TextCell * GetSelectedTextCell() const
Returns the selected cell - or NULL, if the selection isn't a text cell.
Definition: Worksheet.h:977
void ScrollToError()
Unfold the cell that produced the error, if necessary and, if requested, scroll to it.
Definition: Worksheet.cpp:826
bool HCaretActive() const
Is the vertically-drawn cursor active?
Definition: Worksheet.h:759
void OnEraseBackground(wxEraseEvent &WXUNUSED(event))
Cannot be static as it is called using a function pointer to an object.
Definition: Worksheet.h:490
void ClearDocument()
Empties the current document.
Definition: Worksheet.cpp:1005
wxString RTFEnd() const
The end of a RTF document.
Definition: Worksheet.cpp:5892
void UnfoldAll()
Recursively unfolds the whole document.
Definition: Worksheet.cpp:1158
void UpdateTableOfContents()
Update the table of contents.
Definition: Worksheet.cpp:6217
Cell * GetSelectionEnd() const
Return the last of the currently selected cells.
Definition: Worksheet.h:1100
void QuestionPending(bool pending)
Does maxima currently wait for the answer of a question?
Definition: Worksheet.h:1504
void ClickNDrag(wxPoint down, wxPoint up)
Select the rectangle surrounded by down and up.
Definition: Worksheet.cpp:1630
const wxString & GetCurrentFile() const
The name of the currently-opened file.
Definition: Worksheet.h:736
void SetCurrentFile(const wxString &file)
Set the name of the currently-opened file.
Definition: Worksheet.h:738
RecentDocuments & UnsavedDocuments()
The list of unsaved (autosaved) documents offered for recovery.
Definition: Worksheet.h:128
void DeleteCurrentCell()
Delete the currently active cell - or the cell above this one.
Definition: Worksheet.cpp:2070
AutoComplete & GetAutocomplete()
The storage for the autocompletion feature.
Definition: Worksheet.h:629
AnimationCell * GetSelectedAnimation() const
Returns the selected cell - or NULL, if the selection isn't an animation.
Definition: Worksheet.h:953
void Replace(const wxString &oldString, const wxString &newString, bool ignoreCase)
Replace the current occurrence of a string.
Definition: Worksheet.cpp:5303
bool CopyMatlab() const
Copy a Matlab representation of the current selection to the clipboard.
Definition: Worksheet.cpp:1892
bool CopyText() const
Copy a textual representation of the current selection to the clipboard.
Definition: Worksheet.cpp:1955
bool m_inPopupMenu
Is there an active popup menu?
Definition: Worksheet.h:1598
EvaluationQueue & GetEvaluationQueue()
The list of cells that have to be evaluated.
Definition: Worksheet.h:1367
void Animate(bool run=true) const
Animate the current slide show.
Definition: Worksheet.cpp:4845
static GroupCell * StartOfSectioningUnit(GroupCell *start)
Finds the start of the current chapter/section/...
Definition: Worksheet.cpp:2501
bool CopyRTF() const
Copy a rtf version of the current selection to the clipboard.
Definition: Worksheet.cpp:3509
void UpdateConfig()
Re-read the configuration.
Definition: Worksheet.h:729
int m_pointer_y
The y position of the mouse pointer.
Definition: Worksheet.h:1594
bool Copy(bool astext=false) const
Copy the current selection to the clipboard.
Definition: Worksheet.cpp:1735
bool CopyAnimation() const
Copy the current animation to the clipboard.
Definition: Worksheet.cpp:3487
void StepAnimation(int change=1)
Set the slide of the currently selected animation or advance it by one step.
Definition: Worksheet.cpp:3337
void SelectEditable(EditorCell *editor, bool up)
Is called when a hCursor is active and we have a WXK_UP/WXK_DOWN event.
Definition: Worksheet.cpp:2855
void SetAnswer(const wxString &answer)
Handling questions from and answers for maxima.
Definition: Worksheet.cpp:2235
GroupCell * ToggleFoldAll(GroupCell *which)
Toggles the status of the fold for the given GroupCell and its children.
Definition: Worksheet.cpp:1132
void OnChar(wxKeyEvent &event)
Key for a printable character pressed.
Definition: Worksheet.cpp:3221
void SelectWithChar(int ccode)
Handle selecting text using the keyboard Is called when the all of the following is true:
Definition: Worksheet.cpp:2770
void AddSelectionToEvaluationQueue()
Schedule all cells in the selection to be evaluated.
Definition: Worksheet.cpp:4000
bool CanEdit()
We can edit the input if the we have the whole input in selection!
Definition: Worksheet.cpp:3852
bool HasCellsSelected() const
Is at least one entire cell selected?
Definition: Worksheet.h:902
std::optional< Notification > & GetNotification()
The error notification message, if any.
Definition: Worksheet.h:588
void OnSetFocus(wxFocusEvent &event)
What to do if the worksheet is in the input focus.
Definition: Worksheet.cpp:4798
void SetNotification(const wxString &message, int flags=wxICON_INFORMATION)
Inform the user that something happened in a non-active window.
Definition: Worksheet.cpp:3199
void ScheduleScrollToCell(Cell *cell, bool scrollToTop=true)
Schedules scrolling to a given cell.
Definition: Worksheet.h:1180
int GetViewScrollUnitY() const override
The current vertical scroll position, in scroll units (not pixels).
Definition: Worksheet.h:119
GroupCell * InsertGroupCells(std::unique_ptr< GroupCell > &&cells, GroupCell *where, UndoActions *undoBuffer)
Insert group cells into the worksheet.
Definition: Worksheet.cpp:756
void AddDocumentTillHereToEvaluationQueue()
Schedule all cells stopping with the one the caret is in for evaluation.
Definition: Worksheet.cpp:4020
void OnComplete(wxCommandEvent &event)
Is called if an action from the autocomplete menu is selected.
Definition: Worksheet.cpp:5638
bool CanAnimate() const
Does it make sense to enable the "Play" button and the slider now?
Definition: Worksheet.h:985
bool RecalculateIfNeeded(bool timeout=false, long timeSliceMs=50)
Actually recalculate the worksheet.
Definition: Worksheet.h:856
bool m_mouseMotionWas
Was there a mouse motion we didn't react to until now?
Definition: Worksheet.h:1596
void SelectAll()
Select the whole document.
Definition: Worksheet.cpp:4721
void OnKillFocus(wxFocusEvent &event)
What to do if the worksheet looses the input focus.
Definition: Worksheet.cpp:4810
void InsertLine(std::unique_ptr< Cell > &&newCell, bool forceNewLine=false)
Add a new line to the output cell of the working group.
Definition: Worksheet.cpp:885
void ClearNotification()
Clears the notification message from SetNotification.
Definition: Worksheet.cpp:3197
void OnPaint(wxPaintEvent &event)
Is called by wxWidgets when it wants to redraw the worksheet or a part of it.
Definition: Worksheet.cpp:481
void OnFollow()
Called when the "Scroll to currently evaluated" button is pressed.
Definition: Worksheet.cpp:5822
void PrepareDrawGC(wxDC &dc) const
All that has need to be done before drawing a GroupCell in a DC.
Definition: Worksheet.cpp:632
void OnCharInActive(wxKeyEvent &event)
Key pressed inside a cell.
Definition: Worksheet.cpp:2545
Cell * GetSelectionStart() const
Return the first of the currently selected cells.
Definition: Worksheet.h:1093
void FoldOccurred()
Call when a fold action was detected, to update the state in response to a fold occurring.
Definition: Worksheet.cpp:1099
void OnMouseCaptureLost(wxMouseCaptureLostEvent &event)
Is called if we loose the mouse connection whilst selecting text/cells.
Definition: Worksheet.cpp:5896
wxTimer & KeyboardInactiveTimer()
The timer that tells us when the keyboard is inactive so an autosave isn't disrupting.
Definition: Worksheet.h:799
ClickType
An enum for all classes of items one can click on.
Definition: Worksheet.h:354
ImgCell * GetSelectedImgCell() const
Returns the selected cell - or NULL, if the selection isn't an image.
Definition: Worksheet.h:961
Cell * FindCellByUUID(const wxString &uuid)
Find a cell by its UUID.
Definition: Worksheet.cpp:4072
void EraseBackground(wxEraseEvent &event)
Is called if wxWidgets wants to erase the worksheet's background.
Definition: Worksheet.cpp:250
bool CanDeleteSelection() const
Is it possible to delete the currently selected cells?
Definition: Worksheet.cpp:2054
ToolBar * m_mainToolBar
The toolbar of the main window: We need to access it and therefore have it defined here.
Definition: Worksheet.h:1475
bool CaretVisibleIs()
Is the caret (hcaret or vcaret) currently visible on the worksheet?
Definition: Worksheet.cpp:5246
EditorCell * GetActiveCell() const
Get the currently active EditorCell.
Definition: Worksheet.h:637
bool UpdateControlsNeeded()
Is an update of the worksheet controls needed?
Definition: Worksheet.h:133
bool CopyCells() const
Copy the selection to the clipboard as it would appear in a .wxm file.
Definition: Worksheet.cpp:1984
bool OpenQuestionCaret(const wxString &txt={})
Move the cursor to the question maxima currently asks and if needed add a cell for user input.
Definition: Worksheet.cpp:2243
bool FindIncremental(const wxString &str, bool down, bool ignoreCase, bool searchInInput=true, bool searchInOutput=true)
Do an incremental search from the cursor or the point the last search started at.
Definition: Worksheet.cpp:5093
GroupCell * GetLastCell()
Returns the last cell of the worksheet.
Definition: Worksheet.h:1235
GroupCell * GetHCaret()
The cell the horizontal cursor is above. NULL means at the start of the document.
Definition: Worksheet.cpp:4856
bool IsSelected(CellType type)
Does the selection start with a cell of the type "type".
Definition: Worksheet.cpp:4836
wxString ConvertSelectionToMathML() const
Convert the current selection to MathML.
Definition: Worksheet.cpp:1816
bool CanUndoInsideCell() const
Is it possible to issue an undo in the currently selected cell?
Definition: Worksheet.cpp:4922
void SetHCaret(GroupCell *where)
Set the HCaret at the location of the given Cell.
Definition: Worksheet.cpp:4883
bool CanRedoInsideCell() const
Is it possible to issue an undo in the currently selected cell?
Definition: Worksheet.cpp:4936
bool GCContainsCurrentQuestion(const GroupCell *cell)
Does the GroupCell cell points to contain the question currently asked by maxima?
Definition: Worksheet.cpp:2473
bool IsEmpty() const
Is this worksheet empty?
Definition: Worksheet.h:556
void NumberSections() const
Renumber all sections.
Definition: Worksheet.cpp:1038
void SetViewVirtualSize(int width, int height) override
Set the scrollable (virtual) area, in device pixels.
Definition: Worksheet.h:121
void OnKeyDown(wxKeyEvent &event)
A special key has been pressed.
Definition: Worksheet.cpp:2368
EditorCell * KeyboardSelectionStart() const
Tells us which cell the keyboard selection has started in.
Definition: Worksheet.h:640
void SetSelection(Cell *sel)
Select the cell sel.
Definition: Worksheet.h:1107
void AddCellToEvaluationQueue(GroupCell *gc)
Schedule this cell for evaluation.
Definition: Worksheet.cpp:4042
void SetCellStyle(GroupCell *group, GroupType style)
Change the style of a cell.
Definition: Worksheet.cpp:2142
bool Autocomplete(AutoComplete::autoCompletionType type=AutoComplete::command)
Definition: Worksheet.cpp:5397
wxBitmap m_memory
A memory we can manually buffer the contents of the area that is to be redrawn in.
Definition: Worksheet.h:1586
void LoadSymbols()
Compile a list of known autocompletion symbols.
Definition: Worksheet.cpp:3650
void SelectGroupCell(GroupCell *cell)
Set this cell as the currently selected one.
Definition: Worksheet.cpp:5808
void ShowPoint(wxPoint point)
Scrolls to a point on the worksheet.
Definition: Worksheet.cpp:4516
void WindowActive(bool active)
Is this window active?
Definition: Worksheet.h:594
bool ExportToTeX(const wxString &file)
export to a LaTeX file
Definition: Worksheet.cpp:3644
bool IsSelectionInWorkingGroup()
Is the selection in the current working group?
Definition: Worksheet.cpp:4851
void AdjustSize()
Adjust the virtual size and scrollbars; see WorksheetLayout::AdjustSize().
Definition: Worksheet.h:487
void ShowHCaret()
Activates the horizontal cursor.
Definition: Worksheet.cpp:4915
TimerIDs
An enum of individual IDs for all timers this class handles.
Definition: Worksheet.h:364
void CodeCellVisibilityChanged()
To be called after enabling or disabling the visibility of code cells.
Definition: Worksheet.cpp:3632
void ScrollToCaret()
Request to scroll to the cursor as soon as wxMaxima is idle.
Definition: Worksheet.h:1167
void MarkRefreshAsDone()
Handle redrawing the worksheet or of parts of it.
Definition: Worksheet.h:682
bool CopyMathML() const
Copy the MathML representation of the current selection to the clipboard.
Definition: Worksheet.cpp:1865
bool CopyBitmap() const
Copy a bitmap of the current selection to the clipboard.
Definition: Worksheet.cpp:3480
void GetViewClientSize(int *width, int *height) const override
The visible client area, in device pixels.
Definition: Worksheet.h:117
bool PointVisibleIs(wxPoint point)
Is the point currently visible on the worksheet?
Definition: Worksheet.cpp:4495
std::unique_ptr< Cell > CopySelection(bool asData=false) const
Copy the currently selected cells.
Definition: Worksheet.cpp:3559
GroupCell * GetLastCellInWorksheet() const
Returns a pointer to the last cell of this worksheet.
Definition: Worksheet.cpp:1620
void ScrollToStart()
Scroll to the start of the worksheet.
Definition: Worksheet.h:750
void AddSymbol(const wxString &fun, AutoComplete::autoCompletionType type=AutoComplete::command)
Add a symbol to the autocompletion list.
Definition: Worksheet.h:1455
bool FindNext(const wxString &str, bool down, bool ignoreCase, bool searchInInput=true, bool searchInOutput=true, bool warn=true)
Find the next occurrence of a string.
Definition: Worksheet.cpp:5180
bool SectioningMoveIn(GroupCell *parent)
Make this chapter/section/... a section/subsection/... changing its subheadings, too.
Definition: Worksheet.cpp:5675
wxBitmap ConvertSelectionToBitmap() const
Convert the current selection to a bitmap.
void RequestRedraw(GroupCell *start=NULL)
Request the worksheet to be redrawn.
Definition: Worksheet.cpp:419
bool RedrawIfRequested()
Redraw the worksheet if RequestRedraw() has been called.
Definition: Worksheet.cpp:262
bool ExportToMAC(const wxString &file)
Export the file to a text file maxima's load command can read.
Definition: Worksheet.cpp:3776
void UpdateScrollPos()
Execute all collected scroll events in one go.
Definition: Worksheet.cpp:2490
void SetActiveCell(EditorCell *cell)
Mark an editor cell as the active one.
Definition: Worksheet.cpp:4411
FindReplaceDialog * m_findDialog
The find-and-replace-dialog.
Definition: Worksheet.h:756
void DrawGroupCell(wxDC &dc, wxDC &adc, GroupCell &cell)
Draws a groupcell on the DC.
Definition: Worksheet.cpp:698
void QuestionAnswered()
Mark the current question from maxima as "answered"..
Definition: Worksheet.cpp:2477
void DeleteRegion(GroupCell *start, GroupCell *end, UndoActions *undoBuffer)
Definition: Worksheet.cpp:2172
bool ScrollToCaretIfNeeded()
Scrolls to the cursor, if requested.
Definition: Worksheet.cpp:5273
std::unique_ptr< GroupCell > CopyTree() const
Copies the worksheet's entire contents.
Definition: Worksheet.cpp:3476
GroupCell * EndOfSectioningUnit(GroupCell *start)
Finds the end of the current chapter/section/...
Definition: Worksheet.cpp:2518
std::vector< wxString > m_replacementsForCurrentWord
Suggestions for how the word that was right-clicked on could continue.
Definition: Worksheet.h:1536
void ForceRedraw()
Redraw the window now and mark any pending redraw request as "handled".
Definition: Worksheet.h:719
bool CopyTeX() const
Copy the TeX representation of the current selection to the clipboard.
Definition: Worksheet.cpp:1920
void AddRestToEvaluationQueue()
Add all cells below the cursor to the evaluation queue.
Definition: Worksheet.cpp:3980
void ScrollToCellIfNeeded()
Scrolls to the cell given by ScheduleScrollToCell; Is called once we have time to do so.
Definition: Worksheet.cpp:4094
void DrawGroupCell_UsingBitmap(wxDC *dc, GroupCell *cell)
Draws a groupcell in a bitmap and then blits it onto the DC.
Definition: Worksheet.cpp:647
void GetMaxPoint(int *width, int *height)
Get the coordinates of the bottom right point of the worksheet.
Definition: Worksheet.h:384
void OnMouseWheel(wxMouseEvent &event)
Called if the mouse wheel sents events.
Definition: Worksheet.cpp:1508
void RequestRecalculation()
Schedule a recalculation of the whole worksheet. See RequestRecalculation(Cell*).
Definition: Worksheet.h:872
void CloseAutoCompletePopup()
Close the autocompletion pop-up if it is currently open.
Definition: Worksheet.h:559
bool SectioningMoveOut(GroupCell *parent)
Make this section/subsection/... a chapter/section/... changing its subheadings, too.
Definition: Worksheet.cpp:5717
bool FollowEvaluation() const
Query if we want to automatically scroll to the cell that is currently evaluated.
Definition: Worksheet.h:1301
void DestroyTree()
Clear the whole worksheet.
Definition: Worksheet.cpp:3467
wxString GetString(bool lb=false) const
Convert the current selection to a string.
Definition: Worksheet.cpp:1717
GroupCell * GetWorkingGroup(bool resortToLast=false) const
Returns the cell maxima currently works on.
Definition: Worksheet.cpp:854
bool CopySVG() const
Copy a svg of the current selection to the clipboard.
Definition: Worksheet.cpp:3495
void Evaluate()
Trigger the evaluation of the current cell(s)
Definition: Worksheet.cpp:2359
void OnScrollChanged(wxScrollEvent &ev)
Called if the user is using the scrollbar for scrolling through the document.
Definition: Worksheet.cpp:5019
void OnDoubleClick(wxMouseEvent &event)
Is called on double click on a cell.
Definition: Worksheet.cpp:3870
void OnActivate(wxActivateEvent &event)
Is called if this element looses or gets the focus.
Definition: Worksheet.cpp:4875
void AddToEvaluationQueue(GroupCell *cell)
Adds a group cell to the evaluation queue marking its contents as "outdated".
Definition: Worksheet.cpp:3948
void RequestRecalculation(Cell *start)
Schedule a recalculation of the worksheet starting with the cell start.
Definition: Worksheet.h:869
Definition: CellPointers.h:32
void TreeUndo_LimitUndoBuffer()
Drop actions from the back of the undo list until it is within the undo limit.
Definition: Worksheet.cpp:4197
bool CanTreeRedo() const
Can we redo a tree operation?
Definition: Worksheet.cpp:4216
void TreeUndo_CellEntered()
The cursor has entered one cell => save the value to see if it has changed.
Definition: Worksheet.cpp:2133
void TreeUndo_AppendAction()
Add another action to this undo action.
Definition: Worksheet.h:282
bool TreeUndoTextChange(UndoActions *sourcelist, UndoActions *undoForThisOperation)
Undo a text change.
Definition: Worksheet.cpp:4298
bool TreeUndo()
Undo a tree operation.
Definition: Worksheet.h:308
void TreeUndo_ClearRedoActionList()
Clear the list of actions for which an undo can be undone.
Definition: Worksheet.h:276
bool CanTreeUndo() const
Can we undo a tree operation?
Definition: Worksheet.cpp:4201
void TreeUndo_CellLeft()
The cursor is about to leave the current cell => Store the change if the value has changed.
Definition: Worksheet.cpp:2117
void TreeUndo_ClearUndoActionList()
Clear the list of actions for which undo can undo.
Definition: Worksheet.h:279
bool TreeUndoCellAddition(UndoActions *sourcelist, UndoActions *undoForThisOperation)
Undo adding cells.
Definition: Worksheet.cpp:4268
bool TreeUndoCellDeletion(UndoActions *sourcelist, UndoActions *undoForThisOperation)
Undo a call deletion.
Definition: Worksheet.cpp:4255
bool TreeRedo()
Redo an undone tree operation.
Definition: Worksheet.h:312
void TreeUndo_MarkCellsAsAdded(GroupCell *start, GroupCell *end, UndoActions *undoBuffer)
Remember that these cells were just added so this addition can be undone.
Definition: Worksheet.cpp:2107
Where a search starts: a group plus what the cursor is doing there.
Definition: WorksheetSearch.h:113
A search match: the group it is in and the matching part.
Definition: WorksheetSearch.h:97