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 "cells/TextCell.h"
58#include "EvaluationQueue.h"
60#include "Autocomplete.h"
61#include "AutocompletePopup.h"
63#include "ToolBar.h"
64#include <thread>
65
108class Worksheet : public wxScrolled<wxWindow>
109{
110public:
111 RecentDocuments m_unsavedDocuments;
113 bool UpdateControlsNeeded(){bool result = m_updateControls; m_updateControls = false; return result;}
114 void UpdateControlsNeeded(bool updateControlsNeeded){m_updateControls = updateControlsNeeded;}
115private:
117 wxString m_maximaDocDir;
119 bool m_updateControls = true;
121 bool m_scrollToCaret = false;
123 CellPointers m_cellPointers;
124 // The x position to scroll to
125 int m_newxPosition = -1;
126 // The y position to scroll to
127 int m_newyPosition = -1;
129 double m_zoomAtGestureStart = 1.0;
131 bool m_scrollToTopOfCell = false;
133 bool m_windowActive = true;
135 wxRegion m_regionToRefresh;
142 int m_scrollUnit = 10;
147 wxClientDC m_dc;
149 CellPtr<GroupCell> m_redrawStart;
151 bool m_fullRedrawRequested = false;
153
155 static wxDataFormat m_wxmFormat;
157 static wxDataFormat m_mathmlFormat;
159 static wxDataFormat m_mathmlFormat2;
161 static wxDataFormat m_rtfFormat;
163 static wxDataFormat m_rtfFormat2;
164
167 class MathMLDataObject : public wxCustomDataObject
168 {
169 public:
170 explicit MathMLDataObject(const wxString &data);
171
172 MathMLDataObject();
173
174 private:
175 wxCharBuffer m_databuf;
176 };
177
179 class wxmDataObject : public wxCustomDataObject
180 {
181 public:
182 explicit wxmDataObject(const wxString &data);
183
184 wxmDataObject();
185
186 private:
187 wxCharBuffer m_databuf;
188 };
189
190 class MathMLDataObject2 : public wxCustomDataObject
191 {
192 public:
193 explicit MathMLDataObject2(const wxString &data);
194
195 MathMLDataObject2();
196
197 private:
198 wxCharBuffer m_databuf;
199 };
200
203 class RtfDataObject : public wxCustomDataObject
204 {
205 public:
206 explicit RtfDataObject(const wxString &data);
207
208 RtfDataObject();
209
210 private:
211 wxCharBuffer m_databuf;
212 };
213
214 class RtfDataObject2 : public wxCustomDataObject
215 {
216 public:
217 explicit RtfDataObject2(const wxString &data);
218
219 RtfDataObject2();
220
221 private:
222 wxCharBuffer m_databuf;
223 };
224
226 bool m_hasFocus = true;
228 long m_lastTop = 0;
230 long m_lastBottom = 0;
255 class TreeUndoAction
256 {
257 public:
258 TreeUndoAction(GroupCell *start, const wxString &oldText) :
259 m_start(start), m_oldText(oldText)
260 {
261 wxASSERT_MSG(start, _("Bug: Trying to record a cell contents change for undo without a cell."));
262 }
263 TreeUndoAction(GroupCell *start, GroupCell *end) :
264 m_start(start), m_newCellsEnd(end)
265 {
266 wxASSERT_MSG(start, _("Bug: Trying to record a cell contents change for undo without a cell."));
267 }
268 TreeUndoAction(GroupCell *start, GroupCell *end, GroupCell *oldCells) :
269 m_start(start), m_newCellsEnd(end), m_oldCells(oldCells)
270 {
271 }
272
278 bool m_partOfAtomicAction = false;
279
284 GroupCell *const m_start = nullptr;
285
291 const wxString m_oldText;
292
299 GroupCell *const m_newCellsEnd = nullptr;
300
308 std::unique_ptr<GroupCell> m_oldCells;
309 };
310
312 using UndoActions = std::list<TreeUndoAction>;
313
315 UndoActions treeUndoActions;
316
318 UndoActions treeRedoActions;
319
321 wxString m_treeUndo_ActiveCellOldText;
322
324 void TreeUndo_ClearRedoActionList();
325
327 void TreeUndo_ClearUndoActionList();
328
330 static void TreeUndo_DiscardAction(UndoActions *actionList);
331
333 static void TreeUndo_AppendAction(UndoActions *actionList)
334 {
335 if(!actionList->empty())
336 actionList->front().m_partOfAtomicAction = true;
337 }
338
340 void TreeUndo_AppendAction(){TreeUndo_AppendAction(&treeUndoActions);}
341
346 CellPtr<GroupCell> TreeUndo_ActiveCell;
347
349 void TreeUndo_LimitUndoBuffer();
350
356 bool TreeUndo(UndoActions *sourcelist, UndoActions *undoForThisOperation);
357
361 bool TreeUndoTextChange(UndoActions *sourcelist, UndoActions *undoForThisOperation);
365 bool TreeUndoCellDeletion(UndoActions *sourcelist, UndoActions *undoForThisOperation);
369 bool TreeUndoCellAddition(UndoActions *sourcelist, UndoActions *undoForThisOperation);
370
372 bool TreeUndo()
373 { return TreeUndo(&treeUndoActions, &treeRedoActions); }
374
376 bool TreeRedo()
377 { return TreeUndo(&treeRedoActions, &treeUndoActions); }
378
380 bool CanTreeUndo() const;
381
383 bool CanTreeRedo() const;
384
387 void TreeUndo_CellEntered();
388
391 void TreeUndo_CellLeft();
392
401 void TreeUndo_MarkCellsAsAdded(GroupCell *start, GroupCell *end, UndoActions *undoBuffer);
402
403
409 void TreeUndo_MarkCellsAsAdded(GroupCell *parentOfStart, GroupCell *end);
411
412 bool m_scrolledAwayFromEvaluation = false;
413
418 wxString EscapeHTMLChars(wxString input);
419
421 wxString PrependNBSP(wxString input);
422
424 enum ClickType
425 {
426 CLICK_TYPE_NONE,
427 CLICK_TYPE_GROUP_SELECTION,
428 CLICK_TYPE_INPUT_SELECTION,
429 CLICK_TYPE_INPUT_LABEL_SELECTION,
430 CLICK_TYPE_OUTPUT_SELECTION
431 };
432
434 enum TimerIDs
435 {
436 TIMER_ID,
437 CARET_TIMER_ID,
438 DISPLAY_TIMEOUT_ID
439 };
440
442 static void AddLineToFile(wxTextFile &output, const wxString &s);
443
445 std::unique_ptr<Cell> CopySelection(bool asData = false) const;
446
455 std::unique_ptr<Cell> CopySelection(Cell *start, Cell *end, bool asData = false) const;
456
458 void GetMaxPoint(int *width, int *height);
459
461 void OnTimer(wxTimerEvent &event);
462
463#if wxCHECK_VERSION(3, 1, 1)
465 void OnZoom(wxZoomGestureEvent &event);
466#endif
467
468 void OnMouseExit(wxMouseEvent &event);
469
470 void OnMouseEnter(wxMouseEvent &event);
471
484 void OnPaint(wxPaintEvent &event);
486 void DrawGroupCell(wxDC &dc, wxDC &adc, GroupCell &cell);
494 void DrawGroupCell_UsingBitmap(wxDC *dc, GroupCell *cell);
495
497 void PrepareDrawGC(wxDC &dc) const;
498
499 void OnSize(wxSizeEvent &event);
500
501 void OnMouseRightDown(wxMouseEvent &event);
502
503 void OnSidebarKey(wxCommandEvent &event);
504
505 void OnMouseLeftUp(wxMouseEvent &event);
506
508 void OnMouseCaptureLost(wxMouseCaptureLostEvent &event);
509
510 void OnMouseLeftDown(wxMouseEvent &event);
511
512 void OnMouseLeftInGcCell(wxMouseEvent &event, GroupCell *clickedInGC);
513
514 void OnMouseLeftInGcLeft(wxMouseEvent &event, GroupCell *clickedInGC);
515
516 void OnMouseLeftInGc(wxMouseEvent &event, GroupCell *clickedInGC);
517
518 void OnMouseMotion(wxMouseEvent &event);
519
521 void OnDoubleClick(wxMouseEvent &event);
522
524 void OnCharInActive(wxKeyEvent &event);
525
527 void OnCharNoActive(wxKeyEvent &event);
528
530 void SelectEditable(EditorCell *editor, bool up);
531
538 void SelectWithChar(int ccode);
539
554 void ClickNDrag(wxPoint down, wxPoint up);
555
556 // Select all group cells inside the given rectangle;
557 void SelectGroupCells(wxPoint down, wxPoint up);
558
559public:
560 void AdjustSize();
561
563 void OnEraseBackground(wxEraseEvent& WXUNUSED(event))
564 {}
565
566 void CheckUnixCopy();
567
568 void OnMouseMiddleUp(wxMouseEvent &event);
569
570 static bool IsLesserGCType(int type, int comparedTo);
571
574
577
579 void OnComplete(wxCommandEvent &event);
580
585 void EraseBackground(wxEraseEvent &event);
586
589 wxPoint m_down;
590 wxPoint m_up;
591 wxPoint m_mousePoint;
597 bool m_hCaretActive = true;
615 bool m_leftDown = false;
618 bool m_mouseDrag = false;
619 bool m_mouseOutside = false;
621 mutable bool m_adjustWorksheetSizeNeeded = false;
624 int m_clickType = CLICK_TYPE_NONE;
625 CellPtr<GroupCell> m_clickInGC;
631 wxTimer m_timer;
635 bool m_saved = true;
636 std::vector<wxString> m_completions;
637 bool m_autocompleteTemplates = true;
638 AutocompletePopup *m_autocompletePopup;
639
640public:
642 bool IsEmpty() const
643 { return !m_tree || (!m_tree->GetNext() && m_tree->GetEditable()->GetValue().Length() <= 1); }
646 {
647 if(m_autocompletePopup != NULL)
648 m_autocompletePopup->Destroy();
649 }
650
656 void OnChar(wxKeyEvent &event);
657
662 void OnKeyDown(wxKeyEvent &event);
664 void SetCellStyle(GroupCell *group, GroupType style);
665
667 void NumberSections() const;
668
670 bool SectioningMoveIn(GroupCell *parent);
672 bool SectioningMoveOut(GroupCell *parent);
674 std::optional<Notification> m_notificationMessage;
676 void WindowActive(bool active){m_windowActive = active;}
678 void ClearNotification();
683 void SetNotification(const wxString &message, int flags = wxICON_INFORMATION);
684
686 void OnActivate(wxActivateEvent &event);
687private:
689 std::unique_ptr<GroupCell> m_tree;
691 mutable CellPtr<GroupCell> m_last;
692// std::vector<std::jthread> m_drawThreads;
693 static std::mutex m_drawDCLock;
696 Configuration *m_configuration = NULL;
697public:
698 void FocusFindDialogue()
699 {
700 if(m_findDialog)
701 m_findDialog->SetFocus();
702 }
705
706 Configuration *GetConfig() const { return m_configuration; }
707
709 EditorCell *GetActiveCell() const { return m_cellPointers.m_activeCell; }
710
713 { return m_cellPointers.m_cellKeyboardSelectionStartedIn; }
714
715 EditorCell *MouseSelectionStart() const
716 { return m_cellPointers.m_cellMouseSelectionStartedIn; }
717
718 EditorCell *SearchStart() const
719 { return m_cellPointers.m_cellSearchStartedIn; }
720
721 int IndexSearchStartedAt() const
722 { return m_cellPointers.m_indexSearchStartedAt; }
723
724 CellPointers &GetCellPointers() { return m_cellPointers; }
725
726 CellPointers::ErrorList &GetErrorList() { return m_cellPointers.m_errorList; }
727 TextCell *GetCurrentTextCell() const { return m_cellPointers.m_currentTextCell; }
728 void SetCurrentTextCell(TextCell *cell) { m_cellPointers.m_currentTextCell = cell; }
729 void SetWorkingGroup(GroupCell *group) { m_cellPointers.SetWorkingGroup(group); }
730
737
755 {
756 m_redrawStart = NULL;
757 m_fullRedrawRequested = false;
758 }
759
764 bool RedrawIfRequested();
765
778 void RequestRedraw(GroupCell *start = NULL);
788 void RequestRedraw(wxRect rect);
789
792 {
795 }
796
799
802 m_configuration->ReadConfig();
803 Recalculate();
804 Refresh();
805 }
806
809
814 const wxString UnicodeToMaxima(wxString s);
815
817 void ScrollToStart() { Scroll(0, 0); }
818
820 void ScrollToError();
821
824
826 bool HCaretActive() const { return m_hCaretActive; }
827
833 bool CanMergeSelection() const;
834
835 bool CanUndo() const;
836
837 bool CanRedo() const;
838
839 void Undo();
840
841 void Redo();
842
847 void TreeUndo_ClearBuffers();
848
858 Worksheet(wxWindow *parent, int id, Configuration *config,
859 wxPoint pos = wxDefaultPosition, wxSize size = wxDefaultSize,
860 bool reactToEvents = true);
861
863 virtual ~Worksheet();
864
867
869 void DestroyTree();
870
872 std::unique_ptr<GroupCell> CopyTree() const;
873
885 GroupCell *InsertGroupCells(std::unique_ptr<GroupCell> &&cells, GroupCell *where,
886 UndoActions *undoBuffer);
887
893 GroupCell *InsertGroupCells(std::unique_ptr<GroupCell> &&cells, GroupCell *where = NULL);
894
900 void InsertLine(std::unique_ptr<Cell> &&newCell, bool forceNewLine = false);
901
903 GroupCell *GetInsertGroup() const;
904
911 bool RecalculateIfNeeded(bool timeout = false);
912
914 void Recalculate(Cell *start);
915
916 void Recalculate() { Recalculate(GetTree()); }
917
922 void ClearDocument();
923
924 void ResetInputPrompts();
925
926 bool CanCopy() const
927 {
928 return m_cellPointers.m_selectionStart ||
929 (m_cellPointers.m_activeCell &&
930 m_cellPointers.m_activeCell->CanCopy());
931 }
932
933 bool CanPaste() const
934 { return m_cellPointers.m_activeCell || m_hCaretActive; }
935
936 bool CanCut() const
937 {
938 return (m_cellPointers.m_activeCell && m_cellPointers.m_activeCell->CanCopy()) ||
939 (m_cellPointers.m_selectionStart && m_cellPointers.m_selectionStart->GetType() == MC_TYPE_GROUP);
940 }
941
943 void SelectAll();
944
946 bool HasCellsSelected() const { return m_cellPointers.HasCellsSelected(); }
947
958 void DeleteRegion(
959 GroupCell *start,
960 GroupCell *end,
961 UndoActions *undoBuffer
962 );
963
970 void DeleteRegion(
971 GroupCell *start,
972 GroupCell *end
973 );
974
980 void DeleteSelection();
981
982 void TOCdnd(GroupCell *dndStart, GroupCell *dndEnd);
983
985 bool CanDeleteRegion(GroupCell *start, const GroupCell *end) const;
986
988 bool CanDeleteSelection() const;
989
994 void DeleteCurrentCell();
995
998 {
999 if(m_cellPointers.m_selectionStart != m_cellPointers.m_selectionEnd)
1000 return NULL;
1001 return dynamic_cast<AnimationCell *>(GetSelectionStart());
1002 }
1003
1006 {
1007 if(m_cellPointers.m_selectionStart != m_cellPointers.m_selectionEnd)
1008 return NULL;
1009 return dynamic_cast<ImgCell *>(GetSelectionStart());
1010 }
1011
1014 {
1015 if(m_cellPointers.m_selectionStart != m_cellPointers.m_selectionEnd)
1016 return NULL;
1017 return dynamic_cast<ImgCellBase *>(GetSelectionStart());
1018 }
1019
1022 {
1023 if(m_cellPointers.m_selectionStart != m_cellPointers.m_selectionEnd)
1024 return NULL;
1025 return dynamic_cast<TextCell *>(GetSelectionStart());
1026 }
1027
1029 bool CanAnimate() const
1030 {
1031 return m_cellPointers.m_selectionStart && m_cellPointers.m_selectionStart == m_cellPointers.m_selectionEnd &&
1032 (dynamic_cast<AnimationCell *>(GetSelectionStart()) != NULL);
1033 }
1034
1041 void Animate(bool run = true) const;
1042
1043 void DivideCell();
1044
1045 void MergeCells();
1046
1047 void SetLastQuestion(const wxString &lastQuestion){m_lastQuestion = lastQuestion;}
1048 wxString GetLastQuestion() const {return m_lastQuestion;}
1049
1051 bool CutToClipboard();
1052
1053 void PasteFromClipboard();
1054
1061 bool Copy(bool astext = false) const;
1062
1064 bool CopyCells() const;
1065
1067 bool CopyMatlab() const;
1068
1070 bool CopyText() const;
1071
1073 bool CopyTeX() const;
1074
1076 wxString ConvertSelectionToMathML() const;
1077
1080
1082 bool CopyMathML() const;
1083
1085 bool CopyBitmap() const;
1086
1088 bool CopyAnimation() const;
1089
1091 bool CopySVG() const;
1092
1093#if wxUSE_ENH_METAFILE
1095 bool CopyEMF() const;
1096#endif
1097
1099 bool CopyRTF() const;
1100
1101 wxSize CopyToFile(const wxString &file) const;
1102
1103 wxSize CopyToFile(const wxString &file, Cell *start, Cell *end, bool asData = false, double scale = 1) const;
1104
1105 void CalculateReorderedCellIndices(GroupCell *tree, int &cellIndex, std::vector<int> &cellMap);
1106
1111 bool ExportToHTML(const wxString &file);
1112
1117 void
1118 ExportToMAC(wxTextFile &output, GroupCell *tree, bool wxm, const std::vector<int> &cellMap, bool fixReorderedIndices);
1119
1121 bool ExportToMAC(const wxString &file);
1122
1124 wxString RTFStart() const;
1125
1127 wxString RTFEnd() const;
1128
1130 bool ExportToTeX(const wxString &file);
1131
1137 wxString GetString(bool lb = false) const;
1138
1139 GroupCell *GetTree() const { return m_tree.get(); }
1140 std::unique_ptr<GroupCell> *GetTreeAddress() { return &m_tree; }
1141
1147 { return m_cellPointers.m_selectionStart; }
1148
1154 { return m_cellPointers.m_selectionEnd; }
1155
1157 void ClearSelection() { SetSelection(nullptr, nullptr); }
1158
1160 void SetSelection(Cell *sel) { SetSelection(sel, sel); }
1161
1163 void SetSelection(Cell *start, Cell *end);
1164
1166 Cell *FindCellByUUID(const wxString &uuid);
1167
1170
1173 bool CanEdit();
1174
1175 bool ActivatePrevInput() { return ActivateInput(-1); }
1176 bool ActivateNextInput() { return ActivateInput(+1); }
1177 wxString GetStatusText() const {return m_statusText;}
1178 bool StatusTextChangedHas() {
1179 bool retval = (m_statusTextHas != m_statusTextHas_old) ||
1180 (m_statusText != m_statusText_old);
1181 m_statusText_old = m_statusText;
1182 m_statusTextHas_old = m_statusTextHas;
1183 return retval;
1184 }
1185 bool StatusTextHas() const {return m_statusTextHas;}
1186private:
1187 /* ! A timer that tells us to urgently update the display
1188
1189 Normally we prioritize tasks: If there are GUI actions to process we do so.
1190 If not we look if there is data from maxima to process. If not we
1191 If not we recalculate the worksheet element sizes and positions and if
1192 there still is no pressing task we update the display. This way we
1193 respond quickly to the most important inputs.
1194
1195 This timer, if expired, tells us that if we don't update the screen now
1196 maxima feels like not being responsive.
1197 */
1198 wxTimer m_displayTimeoutTimer;
1199
1200 template <class T_SRC, class T_DEST>
1201 inline std::unique_ptr<T_DEST> unique_cast(std::unique_ptr<T_SRC> &&src)
1202 {
1203 if (!src) return std::unique_ptr<T_DEST>();
1204
1205 T_DEST *dest_ptr = &dynamic_cast<T_DEST &>(*src.get());
1206
1207 (void) src.release();
1208 return std::unique_ptr<T_DEST>(dest_ptr);
1209 }
1210 wxString m_statusText;
1211 wxString m_statusText_old;
1212 bool m_statusTextHas = false;
1213 bool m_statusTextHas_old = false;
1214 void StatusText(const wxString &text){m_statusText = text; m_statusTextHas = true;}
1215 void UnsetStatusText(){m_statusTextHas = false;}
1216 bool ActivateInput(int direction);
1217
1218public:
1221 {
1222 m_cellPointers.m_scrollToCell = false;
1223 m_scrollToCaret = true;
1224 }
1225
1227 bool ScrollToCaretIfNeeded();
1228
1230 void ScrollToCellIfNeeded();
1231
1233 void ScheduleScrollToCell(Cell *cell, bool scrollToTop = true)
1234 {
1235 m_cellPointers.ScrollToCell(cell);
1236 m_scrollToTopOfCell = scrollToTop;
1237 m_scrollToCaret = false;
1238
1239 m_cellPointers.m_scrollToCell = true;
1240 }
1241
1243 bool PointVisibleIs(wxPoint point);
1244
1246 bool CaretVisibleIs();
1247
1250
1264 void ShowPoint(wxPoint point);
1265
1267 void OnSetFocus(wxFocusEvent &event);
1268
1270 void OnKillFocus(wxFocusEvent &event);
1271
1273 bool IsSelected(CellType type);
1274
1281 void StepAnimation(int change = 1);
1282
1284 bool IsActiveInLast() const
1285 { return m_cellPointers.m_activeCell && m_cellPointers.m_activeCell->GetGroup() == m_last; }
1286
1289 {
1290 return m_last;
1291 }
1292
1295
1296 void SetActiveCell(EditorCell *cell);
1297
1301 void SetDefaultHCaret();
1302
1307 void SetHCaret(GroupCell *where); // call with false, when manually refreshing
1310
1312 void OpenHCaret(const wxString &txt = {})
1313 {
1314 if(m_mainToolBar == NULL)
1315 OpenHCaret(txt, GC_TYPE_CODE);
1316 else
1318 }
1319
1321 void OpenHCaret(const wxString &txt, GroupType type);
1322
1324 void ShowHCaret();
1325
1330 bool CanUndoInsideCell() const;
1331
1332 void UndoInsideCell();
1333
1338 bool CanRedoInsideCell() const;
1339
1340 void RedoInsideCell();
1341
1351 void FollowEvaluation(bool followEvaluation);
1352
1354 bool FollowEvaluation() const
1355 { return m_followEvaluation; }
1356
1362 void ScrolledAwayFromEvaluation(bool ScrolledAway);
1363
1364 bool ScrolledAwayFromEvaluation() const
1365 { return m_scrolledAwayFromEvaluation; }
1366
1367 void SaveValue();
1368
1369 bool IsSaved() const
1370 { return m_saved; }
1371
1372 void SetSaved(bool saved)
1373 { if(m_saved != saved) m_updateControls = true; m_saved = saved;}
1374
1375 void OutputChanged()
1376 {
1377 if(m_currentFile.EndsWith(".wxmx"))
1378 m_saved = false;
1379 }
1380
1381 void RemoveAllOutput();
1382
1383 void RemoveAllOutput(GroupCell *cell);
1384 // methods related to evaluation queue
1385
1391 void Evaluate();
1392
1394 void AddToEvaluationQueue(GroupCell *cell);
1395
1396 void AddDocumentToEvaluationQueue();
1397
1400
1403
1406
1409
1412
1415
1418
1421
1422 void FoldOccurred();
1423
1424 // methods for folding
1427
1429
1430 void FoldAll();
1431
1432 void UnfoldAll();
1433
1434 // methods for zooming the document in and out
1435 void SetZoomFactor(double newzoom);
1436
1437 void CommentSelection();
1438
1443 void OnScrollChanged(wxScrollEvent &ev);
1444 void OnScrollEvent(wxScrollWinEvent &ev);
1449 void OnMouseWheel(wxMouseEvent &event);
1450
1456 bool FindIncremental(const wxString &str, bool down, bool ignoreCase, bool searchInInput = true, bool searchInOutput = true);
1457 bool FindIncremental_RegEx(const wxString &str, bool down, bool searchInInput = true, bool searchInOutput = true);
1458
1463 bool FindNext(const wxString &str, bool down, bool ignoreCase, bool searchInInput = true, bool searchInOutput = true, bool warn = true);
1464 bool FindNext_Regex(const wxString &str, const bool &down, bool searchInInput = true, bool searchInOutput = true, bool warn = true);
1465
1470 void Replace(const wxString &oldString, const wxString &newString, bool ignoreCase);
1471 void Replace_RegEx(const wxString &oldString, const wxString &newString);
1472
1477 int ReplaceAll(const wxString &oldString, const wxString &newString, bool ignoreCase, bool searchInInput = true, bool searchInOutput = true);
1478 int ReplaceAll_RegEx(const wxString &oldString, const wxString &newString, bool searchInInput = true, bool searchInOutput = true);
1479
1480 wxString GetInputAboveCaret();
1481
1482 wxString GetOutputAboveCaret();
1483
1485 void LoadSymbols();
1486
1487 bool Autocomplete(AutoComplete::autoCompletionType type = AutoComplete::command);
1488
1490 void AddSymbol(const wxString &fun, AutoComplete::autoCompletionType type = AutoComplete::command)
1491 { m_autocomplete.AddSymbol(fun, type); }
1492
1494 void AddSymbols(const wxString &xml)
1495 { m_autocomplete.AddSymbols(xml); }
1497 void AddSymbols(wxXmlDocument xml)
1498 { m_autocomplete.AddSymbols(xml); }
1499
1500 void SetActiveCellText(const wxString &text);
1501
1502 bool InsertText(const wxString &text);
1503
1504 void OpenNextOrCreateCell();
1505
1507 void OnFollow();
1508
1511
1513 void SelectGroupCell(GroupCell *cell);
1514
1519 void SetAnswer(const wxString &answer);
1521 void QuestionAnswered();
1522
1524 bool m_questionPrompt = false;
1525
1530 bool QuestionPending() const
1531 { return m_questionPrompt; }
1533
1537 void QuestionPending(bool pending)
1538 { m_questionPrompt = pending; }
1539
1540 void SetMaximaDocDir(const wxString &dir)
1541 {
1542 m_maximaDocDir = dir;
1543 }
1544
1546 bool GCContainsCurrentQuestion(const GroupCell *cell);
1547
1550 bool OpenQuestionCaret(const wxString &txt = {});
1551 void UpdateScrollPos();
1552
1558 GroupCell *GetWorkingGroup(bool resortToLast = false) const;
1560 void LoadHelpFileAnchors(const wxString &docdir, const wxString &maximaVersion)
1561 {m_maximaManual.LoadHelpFileAnchors(docdir, maximaVersion);}
1562 wxString GetHelpfileAnchorName(const wxString &keyword)
1563 {return m_maximaManual.GetHelpfileAnchorName(keyword);}
1564 wxString GetHelpfileURL(const wxString &keyword)
1565 {return m_maximaManual.GetHelpfileURL(keyword);}
1567 int GetCellIndex(Cell *cell) const;
1568
1570 std::vector<wxString> m_replacementsForCurrentWord;
1571#if wxUSE_ACCESSIBILITY
1572 int GetAccessibilityId(Cell *cell) const;
1573#endif
1574 //Simple iterator over a Maxima input string, skipping comments and strings
1576 {
1577 public:
1578 explicit SimpleMathConfigurationIterator(const wxString &ainput);
1579
1580 void operator++();
1581
1582 bool isValid() const
1583 { return pos < input.length(); }
1584
1585
1586 inline wxChar operator*() const
1587 { return input.at(pos); }
1588
1589 std::size_t pos;
1590
1595 const wxString &input;
1596 };
1597
1598#if wxUSE_ACCESSIBILITY
1599 class AccessibilityInfo: public wxAccessible
1600 {
1601 public:
1602 AccessibilityInfo(wxWindow *parent, Worksheet *worksheet);
1603 wxAccStatus GetChildCount (int *childCount);
1604 wxAccStatus GetChild (int childId, wxAccessible **child);
1605 wxAccStatus GetDefaultAction(int childId, wxString *actionName);
1606 wxAccStatus GetParent (wxAccessible ** parent);
1607 wxAccStatus GetFocus (int *childId, wxAccessible **child);
1608 wxAccStatus GetLocation (wxRect &rect, int elementId);
1609 wxAccStatus HitTest (const wxPoint &pt,
1610 int *childId, wxAccessible **childObject);
1611 wxAccStatus GetDescription(int childId, wxString *description);
1612 wxAccStatus GetRole(int childId, wxAccRole *role);
1613 private:
1614 wxWindow *m_parent = NULL;
1615 Worksheet *m_worksheet = NULL;
1616
1617 class CaretAccessibilityInfo : public wxAccessible {
1618 public:
1619 CaretAccessibilityInfo(AccessibilityInfo* parent, Worksheet* worksheet)
1620 : wxAccessible(worksheet->GetTargetWindow()), m_parent(parent), m_worksheet(worksheet) {}
1621
1622 wxAccStatus GetDescription(int WXUNUSED(childId), wxString *description) override;
1623 wxAccStatus GetParent(wxAccessible **parent) override;
1624 wxAccStatus GetChildCount(int *childCount) override;
1625 wxAccStatus GetChild(int childId, wxAccessible **child) override;
1626 wxAccStatus GetRole(int childId, wxAccRole *role) override;
1627 private:
1628 AccessibilityInfo* m_parent;
1629 Worksheet* m_worksheet;
1630 };
1631 CaretAccessibilityInfo* m_caretAccessible = nullptr;
1632 };
1633#endif
1634 MaximaManual m_maximaManual;
1635 MaximaManual *GetMaximaManual() {return &m_maximaManual;}
1636protected:
1637 void FocusTextControl();
1638 wxString m_lastQuestion;
1639 int m_virtualWidth_Last = -1;
1640 int m_virtualHeight_Last = -1;
1642 wxBitmap m_memory;
1643 virtual wxSize DoGetBestClientSize() const override;
1644#if wxUSE_ACCESSIBILITY
1645 AccessibilityInfo *m_accessibilityInfo = NULL;
1646#endif
1650 int m_pointer_x = -1;
1652 int m_pointer_y = -1;
1654 bool m_mouseMotionWas = false;
1656 bool m_inPopupMenu = false;
1657};
1658
1659inline Worksheet *Cell::GetWorksheet() const
1660{
1661 wxWindow *worksheet = m_configuration->GetWorkSheet();
1662 wxASSERT(worksheet != NULL);
1663 return static_cast<Worksheet*>(worksheet);
1664}
1665
1666wxDECLARE_EVENT(TOC_UPDATE_NEEDED_EVENT, wxCommandEvent);
1667
1668#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
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.
This file contains the definition of the class Unicodesidebar that allows to select arbitrary unicode...
The file that contains the "variables" sidepane.
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:194
CellPtr< EditorCell > m_activeCell
Which EditCell the blinking cursor is in?
Definition: CellPointers.h:103
CellPtr< EditorCell > m_cellKeyboardSelectionStartedIn
The EditorCell the keyboard selection has started in.
Definition: CellPointers.h:97
void SetWorkingGroup(GroupCell *group)
Sets the cell maxima currently works on. NULL if there isn't such a cell.
Definition: CellPointers.cpp:90
CellPtr< Cell > m_selectionStart
The first cell of the currently selected range of Cells.
Definition: CellPointers.h:147
int m_indexSearchStartedAt
Which cursor position incremental search has started at?
Definition: CellPointers.h:101
CellPtr< EditorCell > m_cellMouseSelectionStartedIn
The EditorCell the mouse selection has started in.
Definition: CellPointers.h:95
CellPtr< EditorCell > m_cellSearchStartedIn
The EditorCell the search was started in.
Definition: CellPointers.h:99
CellPtr< TextCell > m_currentTextCell
The textcell the text maxima is sending us was ending in.
Definition: CellPointers.h:111
CellPtr< Cell > m_selectionEnd
The last cell of the currently selected range of Cells.
Definition: CellPointers.h:168
A weak non-owning pointer that becomes null whenever the observed object is destroyed.
Definition: CellPtr.h:480
The base class all cell types the worksheet can consist of are derived from.
Definition: Cell.h:142
GroupCell * GetGroup() const
Returns the group cell this cell belongs to.
Definition: Cell.cpp:265
CellType GetType() const
Returns the type of this cell.
Definition: Cell.h:449
Configuration * m_configuration
A pointer to the configuration responsible for this worksheet.
Definition: Cell.h:1062
The configuration storage for the current worksheet.
Definition: Configuration.h:86
wxWindow * GetWorkSheet() const
Get the worksheet this configuration storage is valid for.
Definition: Configuration.h:895
void ReadConfig()
Read the config from the wxConfig object.
Definition: Configuration.cpp:769
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:286
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:525
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:539
Definition: Worksheet.h:1576
const wxString & input
reference to input string (must be a reference, so it can be modified)
Definition: Worksheet.h:1595
The canvas that contains the spreadsheet the whole program is about.
Definition: Worksheet.h:109
bool IsActiveInLast() const
Is the editor active in the last cell of the worksheet?
Definition: Worksheet.h:1284
GroupCell * ToggleFold(GroupCell *which)
Fold or unfold a cell.
Definition: Worksheet.cpp:1150
void ClearSelection()
Clear the selection - make it empty, i.e. no selection.
Definition: Worksheet.h:1157
const wxString UnicodeToMaxima(wxString s)
Make a few unicode characters interpretable by maxima.
Definition: Worksheet.cpp:5682
bool CanMergeSelection() const
Can we merge the selected cells into one?
Definition: Worksheet.cpp:6309
ImgCellBase * GetSelectedImgCellBase() const
Returns the selected cell - or NULL, if the selection isn't image nor animation.
Definition: Worksheet.h:1013
wxString RTFStart() const
The start of a RTF document.
Definition: Worksheet.cpp:8258
int m_pointer_x
The x position of the mouse pointer.
Definition: Worksheet.h:1650
void SetDefaultHCaret()
Set the HCaret to its default location, at the end of the document.
Definition: Worksheet.cpp:6915
bool CanDeleteRegion(GroupCell *start, const GroupCell *end) const
Is it possible to delete the cells between start and end?
Definition: Worksheet.cpp:2905
void AddSectionToEvaluationQueue(GroupCell *start)
Adds a chapter, a section or a subsection to the evaluation queue.
Definition: Worksheet.cpp:6045
void AddSymbols(const wxString &xml)
Add a xml-encoded list of symbols to the autocompletion list.
Definition: Worksheet.h:1494
void FoldAll()
Recursively folds the whole document.
Definition: Worksheet.cpp:1187
virtual ~Worksheet()
The destructor.
Definition: Worksheet.cpp:431
bool CutToClipboard()
Add the currently selected cells to the clipboard and delete them.
Definition: Worksheet.cpp:6611
GroupCell * GetInsertGroup() const
The group that the line's cells will belong to - used by InsertLine.
Definition: Worksheet.cpp:829
bool QuestionPending() const
Does maxima wait for the answer of a question?
Definition: Worksheet.h:1530
void AddEntireDocumentToEvaluationQueue()
Schedule all cells in the document for evaluation.
Definition: Worksheet.cpp:6036
GroupCell * FirstVisibleGC()
The first groupCell that is currently visible.
Definition: Worksheet.cpp:2302
void UpdateConfigurationClientSize()
Inform the configuration about the current client size.
Definition: Worksheet.cpp:3380
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:7711
void AddSymbols(wxXmlDocument xml)
Add a xml-encoded list of symbols to the autocompletion list.
Definition: Worksheet.h:1497
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:1560
bool ExportToHTML(const wxString &file)
Export the file to an html document.
Definition: Worksheet.cpp:4643
void OpenHCaret(const wxString &txt={})
Place the cursor into a new cell where the horizontal cursor is.
Definition: Worksheet.h:1312
TextCell * GetSelectedTextCell() const
Returns the selected cell - or NULL, if the selection isn't a text cell.
Definition: Worksheet.h:1021
void ScrollToError()
Unfold the cell that produced the error, if necessary and, if requested, scroll to it.
Definition: Worksheet.cpp:779
bool HCaretActive() const
Is the vertically-drawn cursor active?
Definition: Worksheet.h:826
void OnEraseBackground(wxEraseEvent &WXUNUSED(event))
Cannot be static as it is called using a function pointer to an object.
Definition: Worksheet.h:563
void ClearDocument()
Empties the current document.
Definition: Worksheet.cpp:1044
wxString RTFEnd() const
The end of a RTF document.
Definition: Worksheet.cpp:8310
void UnfoldAll()
Recursively unfolds the whole document.
Definition: Worksheet.cpp:1197
void UpdateTableOfContents()
Update the table of contents.
Definition: Worksheet.cpp:8595
Cell * GetSelectionEnd() const
Return the last of the currently selected cells.
Definition: Worksheet.h:1153
bool m_blinkDisplayCaret
true = blink the cursor
Definition: Worksheet.h:627
void QuestionPending(bool pending)
Does maxima currently wait for the answer of a question?
Definition: Worksheet.h:1537
void DeleteCurrentCell()
Delete the currently active cell - or the cell above this one.
Definition: Worksheet.cpp:2890
AnimationCell * GetSelectedAnimation() const
Returns the selected cell - or NULL, if the selection isn't an animation.
Definition: Worksheet.h:997
void Replace(const wxString &oldString, const wxString &newString, bool ignoreCase)
Replace the current occurrence of a string.
Definition: Worksheet.cpp:7677
bool CopyMatlab() const
Copy a Matlab representation of the current selection to the clipboard.
Definition: Worksheet.cpp:2712
bool CopyText() const
Copy a textual representation of the current selection to the clipboard.
Definition: Worksheet.cpp:2775
bool m_inPopupMenu
Is there an active popup menu?
Definition: Worksheet.h:1656
wxTimer m_keyboardInactiveTimer
The timer that tells us when the keyboard is inactive so an autosave isn't disrupting.
Definition: Worksheet.h:866
void Animate(bool run=true) const
Animate the current slide show.
Definition: Worksheet.cpp:6887
static GroupCell * StartOfSectioningUnit(GroupCell *start)
Finds the start of the current chapter/section/...
Definition: Worksheet.cpp:3343
bool CopyRTF() const
Copy a rtf version of the current selection to the clipboard.
Definition: Worksheet.cpp:4395
void UpdateConfig()
Re-read the configuration.
Definition: Worksheet.h:801
int m_pointer_y
The y position of the mouse pointer.
Definition: Worksheet.h:1652
bool Copy(bool astext=false) const
Copy the current selection to the clipboard.
Definition: Worksheet.cpp:2555
bool CopyAnimation() const
Copy the current animation to the clipboard.
Definition: Worksheet.cpp:4373
void StepAnimation(int change=1)
Set the slide of the currently selected animation or advance it by one step.
Definition: Worksheet.cpp:4224
void SetAnswer(const wxString &answer)
Handling questions from and answers for maxima.
Definition: Worksheet.cpp:3081
GroupCell * ToggleFoldAll(GroupCell *which)
Toggles the status of the fold for the given GroupCell and its children.
Definition: Worksheet.cpp:1171
void OnChar(wxKeyEvent &event)
Key for a printable character pressed.
Definition: Worksheet.cpp:4047
void AddSelectionToEvaluationQueue()
Schedule all cells in the selection to be evaluated.
Definition: Worksheet.cpp:6074
bool CanEdit()
We can edit the input if the we have the whole input in selection!
Definition: Worksheet.cpp:5926
bool HasCellsSelected() const
Is at least one entire cell selected?
Definition: Worksheet.h:946
void OnSetFocus(wxFocusEvent &event)
What to do if the worksheet is in the input focus.
Definition: Worksheet.cpp:6840
void SetNotification(const wxString &message, int flags=wxICON_INFORMATION)
Inform the user that something happened in a non-active window.
Definition: Worksheet.cpp:4025
void ScheduleScrollToCell(Cell *cell, bool scrollToTop=true)
Schedules scrolling to a given cell.
Definition: Worksheet.h:1233
GroupCell * InsertGroupCells(std::unique_ptr< GroupCell > &&cells, GroupCell *where, UndoActions *undoBuffer)
Insert group cells into the worksheet.
Definition: Worksheet.cpp:715
void AddDocumentTillHereToEvaluationQueue()
Schedule all cells stopping with the one the caret is in for evaluation.
Definition: Worksheet.cpp:6094
void OnComplete(wxCommandEvent &event)
Is called if an action from the autocomplete menu is selected.
Definition: Worksheet.cpp:8012
bool CanAnimate() const
Does it make sense to enable the "Play" button and the slider now?
Definition: Worksheet.h:1029
bool m_mouseMotionWas
Was there a mouse motion we didn't react to until now?
Definition: Worksheet.h:1654
void SelectAll()
Select the whole document.
Definition: Worksheet.cpp:6763
void OnKillFocus(wxFocusEvent &event)
What to do if the worksheet looses the input focus.
Definition: Worksheet.cpp:6852
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:838
void ClearNotification()
Clears the notification message from SetNotification.
Definition: Worksheet.cpp:4023
void OnFollow()
Called when the "Scroll to currently evaluated" button is pressed.
Definition: Worksheet.cpp:8192
bool m_hCaretActive
Is the active cursor the one represented by a horizontal line?
Definition: Worksheet.h:597
Cell * GetSelectionStart() const
Return the first of the currently selected cells.
Definition: Worksheet.h:1146
void FoldOccurred()
Call when a fold action was detected, to update the state in response to a fold occurring.
Definition: Worksheet.cpp:1138
ImgCell * GetSelectedImgCell() const
Returns the selected cell - or NULL, if the selection isn't an image.
Definition: Worksheet.h:1005
Cell * FindCellByUUID(const wxString &uuid)
Find a cell by its UUID.
Definition: Worksheet.cpp:6142
void EraseBackground(wxEraseEvent &event)
Is called if wxWidgets wants to erase the worksheet's background.
Definition: Worksheet.cpp:245
bool CanDeleteSelection() const
Is it possible to delete the currently selected cells?
Definition: Worksheet.cpp:2874
AutoComplete m_autocomplete
The storage for the autocompletion feature.
Definition: Worksheet.h:704
ToolBar * m_mainToolBar
The toolbar of the main window: We need to access it and therefore have it defined here.
Definition: Worksheet.h:1510
CellPtr< GroupCell > m_hCaretPositionEnd
The end of the selection when selecting group with the horizontally drawn cursor.
Definition: Worksheet.h:614
bool m_questionPrompt
true = the last reply from maxima was a question
Definition: Worksheet.h:1524
bool CaretVisibleIs()
Is the caret (hcaret or vcaret) currently visible on the worksheet?
Definition: Worksheet.cpp:7620
EditorCell * GetActiveCell() const
Get the currently active EditorCell.
Definition: Worksheet.h:709
bool UpdateControlsNeeded()
Is an update of the worksheet controls needed?
Definition: Worksheet.h:113
bool CopyCells() const
Copy the selection to the clipboard as it would appear in a .wxm file.
Definition: Worksheet.cpp:2804
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:3089
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:7104
GroupCell * GetLastCell()
Returns the last cell of the worksheet.
Definition: Worksheet.h:1288
GroupCell * GetHCaret()
The cell the horizontal cursor is above. NULL means at the start of the document.
Definition: Worksheet.cpp:6898
bool IsSelected(CellType type)
Does the selection start with a cell of the type "type".
Definition: Worksheet.cpp:6878
wxString ConvertSelectionToMathML() const
Convert the current selection to MathML.
Definition: Worksheet.cpp:2636
bool CanUndoInsideCell() const
Is it possible to issue an undo in the currently selected cell?
Definition: Worksheet.cpp:6964
bool RecalculateIfNeeded(bool timeout=false)
Actually recalculate the worksheet.
Definition: Worksheet.cpp:910
void SetHCaret(GroupCell *where)
Set the HCaret at the location of the given Cell.
Definition: Worksheet.cpp:6925
bool CanRedoInsideCell() const
Is it possible to issue an undo in the currently selected cell?
Definition: Worksheet.cpp:6978
bool GCContainsCurrentQuestion(const GroupCell *cell)
Does the GroupCell cell points to contain the question currently asked by maxima?
Definition: Worksheet.cpp:3315
bool IsEmpty() const
Is this worksheet empty?
Definition: Worksheet.h:642
void NumberSections() const
Renumber all sections.
Definition: Worksheet.cpp:1077
CellPtr< GroupCell > m_recalculateStart
Where to start recalculation. NULL = No recalculation needed.
Definition: Worksheet.h:1648
bool m_saved
True if no changes have to be saved.
Definition: Worksheet.h:635
void OnKeyDown(wxKeyEvent &event)
A special key has been pressed.
Definition: Worksheet.cpp:3210
EditorCell * KeyboardSelectionStart() const
Tells us which cell the keyboard selection has started in.
Definition: Worksheet.h:712
void ExportToMAC(wxTextFile &output, GroupCell *tree, bool wxm, const std::vector< int > &cellMap, bool fixReorderedIndices)
Export a region of the file to a .wxm or .mac file maxima's load command can read.
Definition: Worksheet.cpp:5806
void SetSelection(Cell *sel)
Select the cell sel.
Definition: Worksheet.h:1160
void AddCellToEvaluationQueue(GroupCell *gc)
Schedule this cell for evaluation.
Definition: Worksheet.cpp:6116
void SetCellStyle(GroupCell *group, GroupType style)
Change the style of a cell.
Definition: Worksheet.cpp:2994
bool Autocomplete(AutoComplete::autoCompletionType type=AutoComplete::command)
Definition: Worksheet.cpp:7771
wxBitmap m_memory
A memory we can manually buffer the contents of the area that is to be redrawn in.
Definition: Worksheet.h:1642
bool m_adjustWorksheetSizeNeeded
Request adjusting the worksheet size?
Definition: Worksheet.h:621
wxTimer m_caretTimer
The cursor blink rate. Also the timeout for redrawing the worksheet.
Definition: Worksheet.h:633
void LoadSymbols()
Compile a list of known autocompletion symbols.
Definition: Worksheet.cpp:5680
void SelectGroupCell(GroupCell *cell)
Set this cell as the currently selected one.
Definition: Worksheet.cpp:8178
void ShowPoint(wxPoint point)
Scrolls to a point on the worksheet.
Definition: Worksheet.cpp:6567
void WindowActive(bool active)
Is this window active?
Definition: Worksheet.h:676
bool ExportToTeX(const wxString &file)
export to a LaTeX file
Definition: Worksheet.cpp:5563
bool IsSelectionInWorkingGroup()
Is the selection in the current working group?
Definition: Worksheet.cpp:6893
void ShowHCaret()
Activates the horizontal cursor.
Definition: Worksheet.cpp:6957
void CodeCellVisibilityChanged()
To be called after enabling or disabling the visibility of code cells.
Definition: Worksheet.cpp:5551
void ScrollToCaret()
Request to scroll to the cursor as soon as wxMaxima is idle.
Definition: Worksheet.h:1220
bool m_hCaretBlinkVisible
Is the blinking vertically-drawn cursor currently visible?
Definition: Worksheet.h:629
void MarkRefreshAsDone()
Handle redrawing the worksheet or of parts of it.
Definition: Worksheet.h:754
bool CopyMathML() const
Copy the MathML representation of the current selection to the clipboard.
Definition: Worksheet.cpp:2685
bool CopyBitmap() const
Copy a bitmap of the current selection to the clipboard.
Definition: Worksheet.cpp:4366
bool PointVisibleIs(wxPoint point)
Is the point currently visible on the worksheet?
Definition: Worksheet.cpp:6546
GroupCell * GetLastCellInWorksheet() const
Returns a pointer to the last cell of this worksheet.
Definition: Worksheet.cpp:2440
void ScrollToStart()
Scroll to the start of the worksheet.
Definition: Worksheet.h:817
void Recalculate(Cell *start)
Schedule a recalculation of the worksheet starting with the cell start.
Definition: Worksheet.cpp:975
void AddSymbol(const wxString &fun, AutoComplete::autoCompletionType type=AutoComplete::command)
Add a symbol to the autocompletion list.
Definition: Worksheet.h:1490
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:7126
bool SectioningMoveIn(GroupCell *parent)
Make this chapter/section/... a section/subsection/... changing its subheadings, too.
Definition: Worksheet.cpp:8049
wxBitmap ConvertSelectionToBitmap() const
Convert the current selection to a bitmap.
std::optional< Notification > m_notificationMessage
A error notification message.
Definition: Worksheet.h:674
void RequestRedraw(GroupCell *start=NULL)
Request the worksheet to be redrawn.
Definition: Worksheet.cpp:403
int GetCellIndex(Cell *cell) const
Returns the index in (i...) or (o...)
Definition: Worksheet.cpp:4546
bool RedrawIfRequested()
Redraw the worksheet if RequestRedraw() has been called.
Definition: Worksheet.cpp:257
void UpdateScrollPos()
Execute all collected scroll events in one go.
Definition: Worksheet.cpp:3332
CellPtr< GroupCell > m_hCaretPosition
The group above the hcaret, NULL for the top of the document See EditorCell::GetActiveCell() for the ...
Definition: Worksheet.h:602
void SetActiveCell(EditorCell *cell)
Mark an editor cell as the active one.
Definition: Worksheet.cpp:6463
FindReplaceDialog * m_findDialog
The find-and-replace-dialog.
Definition: Worksheet.h:823
void QuestionAnswered()
Mark the current question from maxima as "answered"..
Definition: Worksheet.cpp:3319
void DeleteRegion(GroupCell *start, GroupCell *end, UndoActions *undoBuffer)
Definition: Worksheet.cpp:3018
bool ScrollToCaretIfNeeded()
Scrolls to the cursor, if requested.
Definition: Worksheet.cpp:7647
std::unique_ptr< GroupCell > CopyTree() const
Copies the worksheet's entire contents.
Definition: Worksheet.cpp:4362
GroupCell * EndOfSectioningUnit(GroupCell *start)
Finds the end of the current chapter/section/...
Definition: Worksheet.cpp:3360
std::vector< wxString > m_replacementsForCurrentWord
Suggestions for how the word that was right-clicked on could continue.
Definition: Worksheet.h:1570
EvaluationQueue m_evaluationQueue
The list of cells that have to be evaluated.
Definition: Worksheet.h:1420
void ForceRedraw()
Redraw the window now and mark any pending redraw request as "handled".
Definition: Worksheet.h:791
bool CopyTeX() const
Copy the TeX representation of the current selection to the clipboard.
Definition: Worksheet.cpp:2740
void AddRestToEvaluationQueue()
Add all cells below the cursor to the evaluation queue.
Definition: Worksheet.cpp:6054
void ScrollToCellIfNeeded()
Scrolls to the cell given by ScheduleScrollToCell; Is called once we have time to do so.
Definition: Worksheet.cpp:6164
wxTimer m_timer
Time step for autoscrolll when the mouse is outside the window.
Definition: Worksheet.h:631
void OnMouseWheel(wxMouseEvent &event)
Called if the mouse wheel sents events.
Definition: Worksheet.cpp:2336
void CloseAutoCompletePopup()
Close the autocompletion pop-up if it is currently open.
Definition: Worksheet.h:645
bool SectioningMoveOut(GroupCell *parent)
Make this section/subsection/... a chapter/section/... changing its subheadings, too.
Definition: Worksheet.cpp:8091
bool FollowEvaluation() const
Query if we want to automatically scroll to the cell that is currently evaluated.
Definition: Worksheet.h:1354
CellPtr< GroupCell > m_hCaretPositionStart
The start for the selection when selecting group with the horizontally drawn cursor.
Definition: Worksheet.h:608
void DestroyTree()
Clear the whole worksheet.
Definition: Worksheet.cpp:4353
wxString GetString(bool lb=false) const
Convert the current selection to a string.
Definition: Worksheet.cpp:2537
GroupCell * GetWorkingGroup(bool resortToLast=false) const
Returns the cell maxima currently works on.
Definition: Worksheet.cpp:807
bool m_followEvaluation
Do we want to automatically scroll to a cell as soon as it is being evaluated?
Definition: Worksheet.h:617
bool CopySVG() const
Copy a svg of the current selection to the clipboard.
Definition: Worksheet.cpp:4381
wxPoint m_leftDownPosition
The position the left mouse key was pressed at.
Definition: Worksheet.h:588
wxString m_currentFile
The name of the currently-opened file.
Definition: Worksheet.h:808
void Evaluate()
Trigger the evaluation of the current cell(s)
Definition: Worksheet.cpp:3201
void OnScrollChanged(wxScrollEvent &ev)
Called if the user is using the scrollbar for scrolling through the document.
Definition: Worksheet.cpp:7061
void OnActivate(wxActivateEvent &event)
Is called if this element looses or gets the focus.
Definition: Worksheet.cpp:6917
void AddToEvaluationQueue(GroupCell *cell)
Adds a group cell to the evaluation queue marking its contents as "outdated".
Definition: Worksheet.cpp:6022
Definition: CellPointers.h:32