wxMaxima
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 "stx/optional.hpp"
34 #include "precomp.h"
35 #include <wx/wx.h>
36 #include <wx/xml/xml.h>
37 #include <wx/aui/aui.h>
38 #include <wx/textfile.h>
39 #include <wx/fdrepdlg.h>
40 #include <wx/dc.h>
41 #include <thread>
42 #include <list>
43 #include "CellPointers.h"
44 #include "VariablesPane.h"
45 #include "Notification.h"
46 #include "Cell.h"
47 #include "EditorCell.h"
48 #include "GroupCell.h"
49 #include "TextCell.h"
50 #include "EvaluationQueue.h"
51 #include "FindReplaceDialog.h"
52 #include "Autocomplete.h"
53 #include "AutocompletePopup.h"
54 #include "TableOfContents.h"
55 #include "UnicodeSidebar.h"
56 #include "ToolBar.h"
57 
86 class Worksheet : public wxScrolled<wxWindow>
87 {
88 public:
89  WX_DECLARE_STRING_HASH_MAP(wxString, HelpFileAnchors);
91  bool UpdateControlsNeeded(){bool result = m_updateControls; m_updateControls = false; return result;}
92 private:
93  wxString m_maximaVersion;
95  wxString m_maximaDocDir;
97  bool m_updateControls = true;
99  bool m_scrollToCaret;
101  CellPointers m_cellPointers;
102  // The x position to scroll to
103  int m_newxPosition;
104  // The y position to scroll to
105  int m_newyPosition;
106  // false = collect scroll events without redrawing for every single one
107  bool m_dontSkipScrollEvent;
109  double m_zoomAtGestureStart;
111  bool m_scrollToTopOfCell;
113  bool m_windowActive;
115  Configuration m_configurationTopInstance;
117  wxRegion m_rectToRefresh;
124  int m_scrollUnit;
129  wxClientDC m_dc;
131  GroupCell *m_redrawStart;
133  bool m_redrawRequested;
135 
137  static wxDataFormat m_wxmFormat;
139  static wxDataFormat m_mathmlFormat;
141  static wxDataFormat m_mathmlFormat2;
143  static wxDataFormat m_rtfFormat;
145  static wxDataFormat m_rtfFormat2;
146 
149  class MathMLDataObject : public wxCustomDataObject
150  {
151  public:
152  explicit MathMLDataObject(const wxString &data);
153 
154  MathMLDataObject();
155 
156  private:
157  wxCharBuffer m_databuf;
158  };
159 
161  class wxmDataObject : public wxCustomDataObject
162  {
163  public:
164  explicit wxmDataObject(wxString data);
165 
166  wxmDataObject();
167 
168  private:
169  wxCharBuffer m_databuf;
170  };
171 
172  class MathMLDataObject2 : public wxCustomDataObject
173  {
174  public:
175  explicit MathMLDataObject2(wxString data);
176 
177  MathMLDataObject2();
178 
179  private:
180  wxCharBuffer m_databuf;
181  };
182 
185  class RtfDataObject : public wxCustomDataObject
186  {
187  public:
188  explicit RtfDataObject(wxString data);
189 
190  RtfDataObject();
191 
192  private:
193  wxCharBuffer m_databuf;
194  };
195 
196  class RtfDataObject2 : public wxCustomDataObject
197  {
198  public:
199  explicit RtfDataObject2(wxString data);
200 
201  RtfDataObject2();
202 
203  private:
204  wxCharBuffer m_databuf;
205  };
206 
208  bool m_hasFocus;
210  long m_lastTop;
212  long m_lastBottom;
237  class TreeUndoAction
238  {
239  public:
240  TreeUndoAction(GroupCell *start, const wxString &oldText) :
241  m_start(start), m_oldText(oldText)
242  {
243  wxASSERT_MSG(start, _("Bug: Trying to record a cell contents change for undo without a cell."));
244  }
245  TreeUndoAction(GroupCell *start, GroupCell *end) :
246  m_start(start), m_newCellsEnd(end)
247  {
248  wxASSERT_MSG(start, _("Bug: Trying to record a cell contents change for undo without a cell."));
249  }
250  TreeUndoAction(GroupCell *start, GroupCell *end, GroupCell *oldCells) :
251  m_start(start), m_newCellsEnd(end), m_oldCells(oldCells)
252  {
253  }
254 
260  bool m_partOfAtomicAction = false;
261 
266  GroupCell *const m_start = nullptr;
267 
273  const wxString m_oldText;
274 
281  GroupCell *const m_newCellsEnd = nullptr;
282 
290  std::unique_ptr<GroupCell> m_oldCells;
291  };
292 
294  using UndoActions = std::list<TreeUndoAction>;
295 
297  UndoActions treeUndoActions;
298 
300  UndoActions treeRedoActions;
301 
303  wxString m_treeUndo_ActiveCellOldText;
304 
306  void TreeUndo_ClearRedoActionList();
307 
309  void TreeUndo_ClearUndoActionList();
310 
312  void TreeUndo_DiscardAction(UndoActions *actionList);
313 
315  void TreeUndo_AppendAction(UndoActions *actionList)
316  {
317  if(!actionList->empty())
318  actionList->front().m_partOfAtomicAction = true;
319  }
320 
322  void TreeUndo_AppendAction(){TreeUndo_AppendAction(&treeUndoActions);}
323 
328  GroupCell *TreeUndo_ActiveCell;
329 
331  void TreeUndo_LimitUndoBuffer();
332 
338  bool TreeUndo(UndoActions *sourcelist, UndoActions *undoForThisOperation);
339 
343  bool TreeUndoTextChange(UndoActions *sourcelist, UndoActions *undoForThisOperation);
347  bool TreeUndoCellDeletion(UndoActions *sourcelist, UndoActions *undoForThisOperation);
351  bool TreeUndoCellAddition(UndoActions *sourcelist, UndoActions *undoForThisOperation);
352 
354  bool TreeUndo()
355  { return TreeUndo(&treeUndoActions, &treeRedoActions); }
356 
358  bool TreeRedo()
359  { return TreeUndo(&treeRedoActions, &treeUndoActions); }
360 
362  bool CanTreeUndo() const;
363 
365  bool CanTreeRedo() const;
366 
369  void TreeUndo_CellEntered();
370 
373  void TreeUndo_CellLeft();
374 
383  void TreeUndo_MarkCellsAsAdded(GroupCell *start, GroupCell *end, UndoActions *undoBuffer);
384 
385 
391  void TreeUndo_MarkCellsAsAdded(GroupCell *parentOfStart, GroupCell *end);
393 
394  bool m_scrolledAwayFromEvaluation;
395 
397  EditorCell *m_answerCell;
398 
403  wxString EscapeHTMLChars(wxString input);
404 
406  wxString PrependNBSP(wxString input);
407 
409  enum ClickType
410  {
411  CLICK_TYPE_NONE,
412  CLICK_TYPE_GROUP_SELECTION,
413  CLICK_TYPE_INPUT_SELECTION,
414  CLICK_TYPE_INPUT_LABEL_SELECTION,
415  CLICK_TYPE_OUTPUT_SELECTION
416  };
417 
419  enum TimerIDs
420  {
421  TIMER_ID,
422  CARET_TIMER_ID
423  };
424 
426  void AddLineToFile(wxTextFile &output, const wxString &s);
427 
429  std::unique_ptr<Cell> CopySelection(bool asData = false) const;
430 
439  std::unique_ptr<Cell> CopySelection(Cell *start, Cell *end, bool asData = false) const;
440 
442  void GetMaxPoint(int *width, int *height);
443 
445  void OnTimer(wxTimerEvent &event);
446 
451  bool m_autoSaveIntervalExpired;
452 
453  #if wxCHECK_VERSION(3,1,1)
454  void OnZoom(wxZoomGestureEvent &event);
456  #endif
457 
458  void OnMouseExit(wxMouseEvent &event);
459 
460  void OnMouseEnter(wxMouseEvent &event);
461 
467  void OnPaint(wxPaintEvent &event);
468 
469  void OnSize(wxSizeEvent &event);
470 
471  void OnMouseRightDown(wxMouseEvent &event);
472 
473  void OnSidebarKey(wxCommandEvent &event);
474 
475  void OnMouseLeftUp(wxMouseEvent &event);
476 
478  void OnMouseCaptureLost(wxMouseCaptureLostEvent &event);
479 
480  void OnMouseLeftDown(wxMouseEvent &event);
481 
482  void OnMouseLeftInGcCell(wxMouseEvent &event, GroupCell *clickedInGc);
483 
484  void OnMouseLeftInGcLeft(wxMouseEvent &event, GroupCell *clickedInGC);
485 
486  void OnMouseLeftInGc(wxMouseEvent &event, GroupCell *clickedInGC);
487 
488  void OnMouseMotion(wxMouseEvent &event);
489 
491  void OnDoubleClick(wxMouseEvent &event);
492 
494  void OnCharInActive(wxKeyEvent &event);
495 
497  void OnCharNoActive(wxKeyEvent &event);
498 
500  void SelectEditable(EditorCell *editor, bool up);
501 
508  void SelectWithChar(int ccode);
509 
524  void ClickNDrag(wxPoint down, wxPoint up);
525 
526  // Select all group cells inside the given rectangle;
527  void SelectGroupCells(wxPoint down, wxPoint up);
528 
529  void AdjustSize();
530 
531  void OnEraseBackground(wxEraseEvent& WXUNUSED(event))
532  {}
533 
534  void CheckUnixCopy();
535 
536  void OnMouseMiddleUp(wxMouseEvent &event);
537 
538  bool IsLesserGCType(int type, int comparedTo);
539 
541  GroupCell *StartOfSectioningUnit(GroupCell *start);
542 
544  GroupCell *EndOfSectioningUnit(GroupCell *start);
545 
547  void OnComplete(wxCommandEvent &event);
548 
553  void EraseBackground(wxEraseEvent &event);
554 
556  wxPoint m_leftDownPosition;
557  wxPoint m_down;
558  wxPoint m_up;
559  wxPoint m_mousePoint;
565  bool m_hCaretActive;
570  GroupCell *m_hCaretPosition;
576  GroupCell *m_hCaretPositionStart;
582  GroupCell *m_hCaretPositionEnd;
583  bool m_leftDown;
585  bool m_followEvaluation;
586  bool m_mouseDrag;
587  bool m_mouseOutside;
589  std::unique_ptr<GroupCell> m_tree;
590  GroupCell *m_last;
591  int m_clickType;
592  int m_clickType_selectionStart;
593  GroupCell *m_clickInGC;
595  bool m_blinkDisplayCaret;
597  bool m_hCaretBlinkVisible;
599  wxTimer m_timer;
601  wxTimer m_caretTimer;
603  bool m_saved;
604  wxArrayString m_completions;
605  bool m_autocompleteTemplates;
606  AutocompletePopup *m_autocompletePopup;
607 
608 public:
609  wxString GetMaximaHelpFile();
610  void SetMaximaVersion(wxString version){m_maximaVersion = version;}
611  wxString GetMaximaVersion(){return m_maximaVersion;}
613  bool IsEmpty() const
614  { return !m_tree || (!m_tree->GetNext() && m_tree->GetEditable()->GetValue().Length()<=1); }
617  {
618  if(m_autocompletePopup != NULL)
619  m_autocompletePopup->Destroy();
620  }
621 
627  void OnChar(wxKeyEvent &event);
628 
633  void OnKeyDown(wxKeyEvent &event);
635  void SetCellStyle(GroupCell *group, GroupType style);
636 
638  void NumberSections();
639 
641  bool SectioningMoveIn();
643  bool SectioningMoveOut();
645  stx::optional<Notification> m_notificationMessage;
647  void WindowActive(bool active){m_windowActive = active;}
649  void ClearNotification();
654  void SetNotification(const wxString &message, int flags = wxICON_INFORMATION);
655 
657  void OnActivate(wxActivateEvent &event);
666 
668  EditorCell *GetActiveCell() const { return m_cellPointers.m_activeCell; }
669 
672  { return m_cellPointers.m_cellKeyboardSelectionStartedIn; }
673 
674  EditorCell *MouseSelectionStart() const
675  { return m_cellPointers.m_cellMouseSelectionStartedIn; }
676 
677  EditorCell *SearchStart() const
678  { return m_cellPointers.m_cellSearchStartedIn; }
679 
680  int IndexSearchStartedAt()
681  { return m_cellPointers.m_indexSearchStartedAt; }
682 
683  CellPointers &GetCellPointers() { return m_cellPointers; }
684 
685  CellPointers::ErrorList &GetErrorList() { return m_cellPointers.m_errorList; }
686  TextCell *GetCurrentTextCell() const { return m_cellPointers.m_currentTextCell; }
687  void SetCurrentTextCell(TextCell *cell) { m_cellPointers.m_currentTextCell = cell; }
688  void SetWorkingGroup(GroupCell *group) { m_cellPointers.SetWorkingGroup(group); }
689 
692 
699 
715  void MarkRefreshAsDone()
717  {
718  m_redrawStart = NULL;
719  m_redrawRequested = false;
720  }
721 
726  bool RedrawIfRequested();
727 
740  void RequestRedraw(GroupCell *start = NULL);
750  void RequestRedraw(wxRect rect);
751 
753  void ForceRedraw()
754  {
755  RequestRedraw();
757  }
758 
760  bool RedrawRequested() const
761  { return m_redrawRequested || m_mouseMotionWas || m_rectToRefresh.IsEmpty(); }
762 
765 
767  void UpdateConfig() { m_configuration->ReadConfig(); }
768 
770  std::unique_ptr<std::thread> m_helpfileanchorsThread;
771 
773  wxString m_currentFile;
774 
779  wxString UnicodeToMaxima(wxString s);
780 
782  void ScrollToStart() { Scroll(0, 0); }
783 
785  void ScrollToError();
786 
789 
795 
797  bool HCaretActive() const { return m_hCaretActive; }
798 
804  bool CanMergeSelection() const;
805 
806  bool CanUndo() const { return CanTreeUndo() || CanUndoInsideCell(); }
807 
808  bool CanRedo() const { return CanTreeRedo() || CanRedoInsideCell(); }
809 
810  void Undo();
811 
812  void Redo();
813 
818  void TreeUndo_ClearBuffers();
819 
822  enum PopIds
823  {
828  popid_comment_selection = wxID_HIGHEST + 500,
829  popid_divide_cell,
830  popid_copy_image,
831  popid_copy_animation,
832  popid_copy_svg,
833  popid_copy_emf,
834  popid_copy_rtf,
835  popid_add_watch,
836  popid_add_watch_label,
837  popid_special_constant_percent,
838  popid_changeasterisk,
839  popid_hideasterisk,
840  popid_delete,
841  popid_simplify,
842  popid_expand,
843  popid_factor,
844  popid_solve,
845  popid_solve_num,
846  popid_integrate,
847  popid_diff,
848  popid_subst,
849  popid_plot2d,
850  popid_plot3d,
851  popid_float,
852  popid_edit,
853  popid_add_comment,
854  popid_insert_input,
855  popid_copy_matlab,
856  popid_copy_tex,
857  popid_copy_text,
858  popid_copy_mathml,
859  popid_labels_disable,
860  popid_labels_user,
861  popid_labels_useronly,
862  popid_labels_autogenerated,
863  popid_labelwidth,
864  popid_labelwidth3,
865  popid_labelwidth4,
866  popid_labelwidth5,
867  popid_labelwidth6,
868  popid_labelwidth7,
869  popid_labelwidth8,
870  popid_labelwidth9,
871  popid_labelwidth10,
872  popid_digits_20,
873  popid_digits_50,
874  popid_digits_100,
875  popid_digits_all,
876  popid_digits_all_linebreak,
877  popid_image,
878  popid_change_image,
879  popid_svg,
880  popid_emf,
881  popid_animation_save,
882  popid_animation_start,
883  popid_evaluate,
884  popid_evaluate_section,
885  popid_merge_cells,
886  popid_insert_text,
887  popid_insert_title,
888  popid_insert_section,
889  popid_insert_subsection,
890  popid_insert_subsubsection,
891  popid_insert_heading5,
892  popid_insert_heading6,
893  popid_auto_answer,
894  popid_never_autoanswer,
895  popid_popup_gnuplot,
896  popid_fold,
897  popid_unfold,
898  popid_maxsizechooser,
899  popid_resolutionchooser,
900  popid_reloadimage,
901  popid_suggestion1,
902  popid_suggestion2,
903  popid_suggestion3,
904  popid_suggestion4,
905  popid_suggestion5,
906  popid_suggestion6,
907  popid_suggestion7,
908  popid_suggestion8,
909  popid_suggestion9,
910  popid_suggestion10,
911  popid_hide_tooltipMarker,
912  popid_hide_tooltipMarkerForThisMessage
913  };
914 
916  Worksheet(wxWindow *parent, int id, Worksheet *&observer,
917  wxPoint pos = wxDefaultPosition, wxSize size = wxDefaultSize);
918 
920  ~Worksheet();
921 
924 
926  void DestroyTree();
927 
929  std::unique_ptr<GroupCell> CopyTree() const;
930 
942  GroupCell *InsertGroupCells(std::unique_ptr<GroupCell> &&cells, GroupCell *where,
943  UndoActions *undoBuffer);
944 
950  GroupCell *InsertGroupCells(std::unique_ptr<GroupCell> &&cells, GroupCell *where = NULL);
951 
957  void InsertLine(std::unique_ptr<Cell> &&newCell, bool forceNewLine = false);
958 
960  GroupCell *GetInsertGroup() const;
961 
962  // Actually recalculate the worksheet.
963  bool RecalculateIfNeeded();
964 
966  void Recalculate(Cell *start);
967 
968  void Recalculate() { Recalculate(GetTree()); }
969 
971  void RecalculateForce();
972 
977  void ClearDocument();
978 
979  void ResetInputPrompts();
980 
981  bool CanCopy(bool fromActive = false)
982  {
983  return m_cellPointers.m_selectionStart ||
984  (fromActive && m_cellPointers.m_activeCell &&
985  m_cellPointers.m_activeCell->CanCopy());
986  }
987 
988  bool CanPaste()
989  { return m_cellPointers.m_activeCell || m_hCaretActive; }
990 
991  bool CanCut()
992  {
993  return (m_cellPointers.m_activeCell && m_cellPointers.m_activeCell->CanCopy()) ||
994  (m_cellPointers.m_selectionStart && m_cellPointers.m_selectionStart->GetType() == MC_TYPE_GROUP);
995  }
996 
998  void SelectAll();
999 
1001  bool HasCellsSelected() const { return m_cellPointers.HasCellsSelected(); }
1002 
1013  void DeleteRegion(
1014  GroupCell *start,
1015  GroupCell *end,
1016  UndoActions *undoBuffer
1017  );
1018 
1025  void DeleteRegion(
1026  GroupCell *start,
1027  GroupCell *end
1028  );
1029 
1035  void DeleteSelection();
1036 
1037  void TOCdnd();
1038 
1040  bool CanDeleteRegion(GroupCell *start, GroupCell *end) const;
1041 
1043  bool CanDeleteSelection() const;
1044 
1049  void DeleteCurrentCell();
1050 
1052  bool CanAnimate()
1053  {
1054  return m_cellPointers.m_selectionStart && m_cellPointers.m_selectionStart == m_cellPointers.m_selectionEnd &&
1055  m_cellPointers.m_selectionStart->GetType() == MC_TYPE_SLIDE;
1056  }
1057 
1064  void Animate(bool run = true);
1065 
1066  void DivideCell();
1067 
1068  void MergeCells();
1069 
1070  void SetLastQuestion(const wxString &lastQuestion){m_lastQuestion = lastQuestion;}
1071  wxString GetLastQuestion(){return m_lastQuestion;}
1072 
1074  bool CutToClipboard();
1075 
1076  void PasteFromClipboard();
1077 
1084  bool Copy(bool astext = false);
1085 
1087  bool CopyCells();
1088 
1090  bool CopyMatlab();
1091 
1093  bool CopyText();
1094 
1096  bool CopyTeX();
1097 
1099  wxString ConvertSelectionToMathML();
1100 
1102  wxBitmap ConvertSelectionToBitmap();
1103 
1105  bool CopyMathML();
1106 
1108  bool CopyBitmap();
1109 
1111  bool CopyAnimation();
1112 
1114  bool CopySVG();
1115 
1116 #if wxUSE_ENH_METAFILE
1117  bool CopyEMF();
1119 #endif
1120 
1122  bool CopyRTF();
1123 
1124  wxSize CopyToFile(const wxString &file);
1125 
1126  wxSize CopyToFile(const wxString &file, Cell *start, Cell *end, bool asData = false, double scale = 1);
1127 
1128  void CalculateReorderedCellIndices(GroupCell *tree, int &cellIndex, std::vector<int> &cellMap);
1129 
1134  bool ExportToHTML(const wxString &file);
1135 
1140  void
1141  ExportToMAC(wxTextFile &output, GroupCell *tree, bool wxm, const std::vector<int> &cellMap, bool fixReorderedIndices);
1142 
1144  bool ExportToMAC(const wxString &file);
1145 
1151  bool ExportToWXMX(const wxString &file, bool markAsSaved = true);
1152 
1154  wxString RTFStart() const;
1155 
1157  wxString RTFEnd() const;
1158 
1160  bool ExportToTeX(const wxString &file);
1161 
1167  wxString GetString(bool lb = false);
1168 
1169  GroupCell *GetTree() const { return m_tree.get(); }
1170  std::unique_ptr<GroupCell> *GetTreeAddress() { return &m_tree; }
1171 
1177  { return m_cellPointers.m_selectionStart; }
1178 
1184  { return m_cellPointers.m_selectionEnd; }
1185 
1187  void ClearSelection() { SetSelection(nullptr, nullptr); }
1188 
1190  void SetSelection(Cell *sel) { SetSelection(sel, sel); }
1191 
1193  void SetSelection(Cell *start, Cell *end);
1194 
1197  bool CanEdit();
1198 
1199  bool ActivatePrevInput() { return ActivateInput(-1); }
1200  bool ActivateNextInput() { return ActivateInput(+1); }
1201  wxString GetStatusText() const{return m_statusText;}
1202  bool StatusTextChangedHas(){
1203  bool retval = (m_statusTextHas != m_statusTextHas_old) ||
1204  (m_statusText != m_statusText_old);
1205  m_statusText_old = m_statusText;
1206  m_statusTextHas_old = m_statusTextHas;
1207  return retval;
1208  }
1209  bool StatusTextHas(){return m_statusTextHas;}
1210 private:
1211  template <class T_SRC, class T_DEST>
1212  inline std::unique_ptr<T_DEST> unique_cast(std::unique_ptr<T_SRC> &&src)
1213  {
1214  if (!src) return std::unique_ptr<T_DEST>();
1215 
1216  T_DEST *dest_ptr = &dynamic_cast<T_DEST &>(*src.get());
1217 
1218  src.release();
1219  return std::move(std::unique_ptr<T_DEST>(dest_ptr));
1220  }
1221  wxString m_statusText;
1222  wxString m_statusText_old;
1223  bool m_statusTextHas = false;
1224  bool m_statusTextHas_old = false;
1225  void StatusText(wxString text){m_statusText = text;m_statusTextHas = true;}
1226  void UnsetStatusText(){m_statusTextHas = false;}
1227  bool ActivateInput(int direction);
1228 
1229 public:
1232  {
1233  m_cellPointers.m_scrollToCell = false;
1234  m_scrollToCaret = true;
1235  }
1236 
1238  bool ScrollToCaretIfNeeded();
1239 
1241  void ScrollToCellIfNeeded();
1242 
1244  void ScheduleScrollToCell(Cell *cell, bool scrollToTop = true)
1245  {
1246  m_cellPointers.ScrollToCell(cell);
1247  m_scrollToTopOfCell = scrollToTop;
1248  m_scrollToCaret = false;
1249 
1250  m_cellPointers.m_scrollToCell = true;
1251  }
1252 
1254  bool PointVisibleIs(wxPoint point);
1255 
1257  bool CaretVisibleIs();
1258 
1261 
1275  void ShowPoint(wxPoint point);
1276 
1278  void OnSetFocus(wxFocusEvent &event);
1279 
1281  void OnKillFocus(wxFocusEvent &event);
1282 
1284  bool IsSelected(CellType type);
1285 
1292  void StepAnimation(int change = 1);
1293 
1296  { return m_cellPointers.m_activeCell && m_cellPointers.m_activeCell->GetGroup() == m_last; }
1297 
1300  {
1301  return m_last;
1302  }
1303 
1306 
1307  void SetActiveCell(EditorCell *cell, bool callRefresh = true);
1308 
1312  void SetDefaultHCaret();
1313 
1318  void SetHCaret(GroupCell *where); // call with false, when manually refreshing
1320  GroupCell *GetHCaret();
1321 
1323  void OpenHCaret(const wxString &txt = {})
1324  {
1325  if(m_mainToolBar == NULL)
1326  OpenHCaret(txt, GC_TYPE_CODE);
1327  else
1329  }
1330 
1332  void OpenHCaret(const wxString &txt, GroupType type);
1333 
1335  void ShowHCaret();
1336 
1341  bool CanUndoInsideCell() const;
1342 
1343  void UndoInsideCell();
1344 
1349  bool CanRedoInsideCell() const;
1350 
1351  void RedoInsideCell();
1352 
1362  void FollowEvaluation(bool followEvaluation);
1363 
1365  bool FollowEvaluation() const
1366  { return m_followEvaluation; }
1367 
1373  void ScrolledAwayFromEvaluation(bool ScrolledAway);
1374 
1375  bool ScrolledAwayFromEvaluation()
1376  { return m_scrolledAwayFromEvaluation; }
1377 
1378  void SaveValue();
1379 
1380  bool IsSaved()
1381  { return m_saved; }
1382 
1383  void SetSaved(bool saved)
1384  { if(m_saved != saved) m_updateControls = true;m_saved = saved;}
1385 
1386  void OutputChanged()
1387  {
1388  if(m_currentFile.EndsWith(".wxmx"))
1389  m_saved = false;
1390  }
1391 
1392  void RemoveAllOutput();
1393 
1394  void RemoveAllOutput(GroupCell *cell);
1395  // methods related to evaluation queue
1396 
1402  void Evaluate();
1403 
1405  void AddToEvaluationQueue(GroupCell *cell);
1406 
1407  void AddDocumentToEvaluationQueue();
1408 
1411 
1414 
1416  void AddRestToEvaluationQueue();
1417 
1420 
1423 
1426 
1429 
1432 
1433  // methods for folding
1434  GroupCell *UpdateMLast();
1435 
1436  void FoldOccurred();
1437 
1439  GroupCell *ToggleFold(GroupCell *which);
1440 
1442 
1443  void FoldAll();
1444 
1445  void UnfoldAll();
1446 
1447  // methods for zooming the document in and out
1448  void SetZoomFactor(double newzoom, bool recalc = true);
1449 
1450  void CommentSelection();
1451 
1456  void OnScrollChanged(wxScrollEvent &ev);
1472  void OnThumbtrack(wxScrollWinEvent &ev);
1477  void OnMouseWheel(wxMouseEvent &event);
1478 
1484  bool FindIncremental(const wxString &str, bool down, bool ignoreCase);
1485 
1490  bool FindNext(const wxString &str, bool down, bool ignoreCase, bool warn = true);
1491 
1496  void Replace(const wxString &oldString, const wxString &newString, bool ignoreCase);
1497 
1502  int ReplaceAll(const wxString &oldString, const wxString &newString, bool ignoreCase);
1503 
1504  wxString GetInputAboveCaret();
1505 
1506  wxString GetOutputAboveCaret();
1507 
1508  void LoadSymbols();
1510  void CompileHelpFileAnchors();
1514  bool LoadManualAnchorsFromXML(wxXmlDocument xmlDocument, bool checkManualVersion = true);
1516  bool LoadBuiltInManualAnchors();
1518  void SaveManualAnchorsToCache();
1519 
1520  bool Autocomplete(AutoComplete::autoCompletionType type = AutoComplete::command);
1521 
1523  void AddSymbol(const wxString &fun, AutoComplete::autoCompletionType type = AutoComplete::command)
1524  { m_autocomplete.AddSymbol(fun, type); }
1525 
1527  void AddSymbols(wxString xml)
1528  { m_autocomplete.AddSymbols(xml); }
1529 
1530  void SetActiveCellText(const wxString &text);
1531 
1532  bool InsertText(const wxString &text);
1533 
1534  void OpenNextOrCreateCell();
1535 
1538 
1540  void OnFollow();
1541 
1544 
1546  void SelectGroupCell(GroupCell *cell);
1547 
1551  void SetAnswer(const wxString &answer);
1554  void QuestionAnswered();
1555 
1558 
1564  { return m_questionPrompt; }
1566 
1570  void QuestionPending(bool pending)
1571  { m_questionPrompt = pending; }
1572 
1573  void SetMaximaDocDir(wxString dir)
1574  {
1575  m_maximaDocDir = dir;
1576  }
1577 
1580 
1583  void OpenQuestionCaret(const wxString &txt = {});
1585  void UpdateScrollPos();
1586 
1592  GroupCell *GetWorkingGroup(bool resortToLast = false) const;
1593 
1596 
1598  int GetCellIndex(Cell *cell) const;
1599 
1601  HelpFileAnchors m_helpFileAnchors;
1604  //Simple iterator over a Maxima input string, skipping comments and strings
1606  {
1607  public:
1608  explicit SimpleMathConfigurationIterator(const wxString &ainput);
1609 
1610  void operator++();
1611 
1612  bool isValid() const
1613  { return pos < input.length(); }
1614 
1615 
1616  inline wxChar operator*() const
1617  { return input[pos]; }
1618 
1619  unsigned int pos;
1620 
1625  const wxString &input;
1626  };
1627 
1628 #if wxUSE_ACCESSIBILITY
1629  class AccessibilityInfo: public wxAccessible
1630  {
1631  public:
1632  AccessibilityInfo(wxWindow *parent, Worksheet *worksheet);
1633  wxAccStatus GetChildCount (int *childCount);
1634  wxAccStatus GetChild (int childId, wxAccessible **child);
1635  wxAccStatus GetDefaultAction(int childId, wxString *actionName);
1636  wxAccStatus GetParent (wxAccessible ** parent);
1637 // wxAccStatus GetFocus (int *childId, wxAccessible **child);
1638  wxAccStatus GetLocation (wxRect &rect, int elementId);
1639  wxAccStatus HitTest (const wxPoint &pt,
1640  int *childId, wxAccessible **childObject);
1641  wxAccStatus GetDescription(int childId, wxString *description);
1642  private:
1643  wxWindow *m_parent;
1644  Worksheet *m_worksheet;
1645  };
1646 #endif
1647 protected:
1648  wxString m_lastQuestion;
1649  int m_virtualWidth_Last;
1650  int m_virtualHeight_Last;
1652  wxBitmap m_memory;
1653  virtual wxSize DoGetBestClientSize() const;
1654 #if wxUSE_ACCESSIBILITY
1655  AccessibilityInfo *m_accessibilityInfo;
1656 #endif
1657  void UpdateConfigurationClientSize();
1667  bool m_inPopupMenu = false;
1668 };
1669 
1670 inline Worksheet *Cell::GetWorksheet() const
1671 {
1672  wxWindow *worksheet = (*m_configuration)->GetWorkSheet();
1673  wxASSERT(worksheet != NULL);
1674  return static_cast<Worksheet*>(worksheet);
1675 }
1676 
1677 inline void Configuration::SetWorkSheet(wxWindow *workSheet)
1678 { m_workSheet = dynamic_cast<Worksheet*>(workSheet); }
1679 
1680 #endif // WORKSHEET_H
CellPointers::m_cellMouseSelectionStartedIn
CellPtr< EditorCell > m_cellMouseSelectionStartedIn
The EditorCell the mouse selection has started in.
Definition: CellPointers.h:95
Worksheet::SetSelection
void SetSelection(Cell *sel)
Select the cell sel.
Definition: Worksheet.h:1190
Worksheet::FoldAll
void FoldAll()
Definition: Worksheet.cpp:1244
Worksheet::PopIds
PopIds
Definition: Worksheet.h:822
Worksheet::m_replacementsForCurrentWord
wxArrayString m_replacementsForCurrentWord
Suggestions for how the word that was right-clicked on could continue.
Definition: Worksheet.h:1603
CellPointers::m_scrollToCell
bool m_scrollToCell
Is scrolling to a cell scheduled?
Definition: CellPointers.h:194
Worksheet::FindNext
bool FindNext(const wxString &str, bool down, bool ignoreCase, bool warn=true)
Definition: Worksheet.cpp:8022
ToolBar.h
Worksheet::ExportToWXMX
bool ExportToWXMX(const wxString &file, bool markAsSaved=true)
Definition: Worksheet.cpp:6359
Worksheet::m_questionPrompt
bool m_questionPrompt
true = the last reply from maxima was a question
Definition: Worksheet.h:1557
Notification.h
ToolBar
Definition: ToolBar.h:39
AutoComplete::AddSymbol
void AddSymbol(wxString fun, autoCompletionType type=command)
Manually add an autocompletable symbol to our symbols lists.
Definition: Autocomplete.cpp:517
Cell.h
Worksheet::DeleteRegion
void DeleteRegion(GroupCell *start, GroupCell *end, UndoActions *undoBuffer)
Definition: Worksheet.cpp:2971
Worksheet::m_variablesPane
Variablespane * m_variablesPane
The panel the user can display variable contents in.
Definition: Worksheet.h:1595
Worksheet::GetString
wxString GetString(bool lb=false)
Definition: Worksheet.cpp:2437
Worksheet::Replace
void Replace(const wxString &oldString, const wxString &newString, bool ignoreCase)
Definition: Worksheet.cpp:8189
Worksheet::GetActiveCell
EditorCell * GetActiveCell() const
Get the currently active EditorCell.
Definition: Worksheet.h:668
Worksheet::m_configuration
Configuration * m_configuration
Definition: Worksheet.h:663
Worksheet::ScrollToStart
void ScrollToStart()
Scroll to the start of the worksheet.
Definition: Worksheet.h:782
MC_TYPE_GROUP
@ MC_TYPE_GROUP
A group cells that bundles several individual cells together.
Definition: Cell.h:82
Worksheet::InsertLine
void InsertLine(std::unique_ptr< Cell > &&newCell, bool forceNewLine=false)
Definition: Worksheet.cpp:871
TextCell
Definition: TextCell.h:36
Worksheet::ClearDocument
void ClearDocument()
Definition: Worksheet.cpp:1095
Worksheet::RequestRedraw
void RequestRedraw(GroupCell *start=NULL)
Definition: Worksheet.cpp:385
EvaluationQueue.h
Worksheet::m_helpFileAnchors
HelpFileAnchors m_helpFileAnchors
All anchors for keywords maxima's helpfile contains.
Definition: Worksheet.h:1601
Worksheet::AddSymbol
void AddSymbol(const wxString &fun, AutoComplete::autoCompletionType type=AutoComplete::command)
Add a symbol to the autocompletion list.
Definition: Worksheet.h:1523
Worksheet::SetCellStyle
void SetCellStyle(GroupCell *group, GroupType style)
Change the style of a cell.
Definition: Worksheet.cpp:2945
CellPointers::m_activeCell
CellPtr< EditorCell > m_activeCell
Which EditCell the blinking cursor is in?
Definition: CellPointers.h:103
Worksheet::m_memory
wxBitmap m_memory
A memory we can manually buffer the contents of the area that is to be redrawn in.
Definition: Worksheet.h:1652
GroupCell.h
Worksheet::Copy
bool Copy(bool astext=false)
Definition: Worksheet.cpp:2457
Worksheet::QuestionPending
void QuestionPending(bool pending)
Definition: Worksheet.h:1570
AutocompletePopup.h
Worksheet::UpdateTableOfContents
void UpdateTableOfContents()
Definition: Worksheet.h:698
Autocomplete.h
Worksheet::CopyBitmap
bool CopyBitmap()
Copy a bitmap of the current selection to the clipboard.
Definition: Worksheet.cpp:4520
Worksheet::GetWorkingGroup
GroupCell * GetWorkingGroup(bool resortToLast=false) const
Definition: Worksheet.cpp:838
Worksheet::CloseAutoCompletePopup
void CloseAutoCompletePopup()
Close the autocompletion pop-up if it is currently open.
Definition: Worksheet.h:616
Worksheet::GCContainsCurrentQuestion
bool GCContainsCurrentQuestion(GroupCell *cell)
Does the GroupCell cell points to contain the question currently asked by maxima?
Definition: Worksheet.cpp:3310
TableOfContents
Definition: TableOfContents.h:50
Worksheet::CanMergeSelection
bool CanMergeSelection() const
Definition: Worksheet.cpp:7110
Worksheet::m_helpfileanchorsThread
std::unique_ptr< std::thread > m_helpfileanchorsThread
The thread the help file anchors are compiled in.
Definition: Worksheet.h:770
Worksheet::SectioningMoveIn
bool SectioningMoveIn()
Make this chapter/section/... a section/subsection/... changing its subheadings, too.
Definition: Worksheet.cpp:8493
EvaluationQueue
A simple FIFO queue with manual removal of elements.
Definition: EvaluationQueue.h:41
Worksheet::AddSymbols
void AddSymbols(wxString xml)
Add a xml-encoded list of symbols to the autocompletion list.
Definition: Worksheet.h:1527
Worksheet::UpdateConfig
void UpdateConfig()
Re-read the configuration.
Definition: Worksheet.h:767
Worksheet::SetNotification
void SetNotification(const wxString &message, int flags=wxICON_INFORMATION)
Definition: Worksheet.cpp:4149
Worksheet::OnScrollChanged
void OnScrollChanged(wxScrollEvent &ev)
Definition: Worksheet.cpp:7937
Worksheet::CanDeleteSelection
bool CanDeleteSelection() const
Is it possible to delete the currently selected cells?
Definition: Worksheet.cpp:2803
Worksheet::ForceRedraw
void ForceRedraw()
Redraw the window now and mark any pending redraw request as "handled".
Definition: Worksheet.h:753
Worksheet::m_recalculateStart
GroupCell * m_recalculateStart
Where to start recalculation. NULL = No recalculation needed.
Definition: Worksheet.h:1659
Worksheet::ShowHCaret
void ShowHCaret()
Activates the horizontal cursor.
Definition: Worksheet.cpp:7812
Worksheet::m_tableOfContents
TableOfContents * m_tableOfContents
The table of contents pane.
Definition: Worksheet.h:1537
Worksheet::SetHCaret
void SetHCaret(GroupCell *where)
Definition: Worksheet.cpp:7777
Worksheet::DestroyTree
void DestroyTree()
Clear the whole worksheet.
Definition: Worksheet.cpp:4505
Worksheet::FollowEvaluation
bool FollowEvaluation() const
Query if we want to automatically scroll to the cell that is currently evaluated.
Definition: Worksheet.h:1365
Worksheet::QuestionAnswered
void QuestionAnswered()
Mark the current question from maxima as "answered"..
Definition: Worksheet.cpp:3315
Worksheet::CutToClipboard
bool CutToClipboard()
Add the currently selected cells to the clipboard and delete them.
Definition: Worksheet.cpp:7423
Worksheet::CanEdit
bool CanEdit()
Definition: Worksheet.cpp:6710
Worksheet::ReplaceAll
int ReplaceAll(const wxString &oldString, const wxString &newString, bool ignoreCase)
Definition: Worksheet.cpp:8207
Worksheet::m_keyboardInactiveTimer
wxTimer m_keyboardInactiveTimer
The timer that tells us when the keyboard is inactive so an autosave isn't disrupting.
Definition: Worksheet.h:923
Worksheet::CopyAnimation
bool CopyAnimation()
Copy the current animation to the clipboard.
Definition: Worksheet.cpp:4529
Worksheet::m_currentFile
wxString m_currentFile
The name of the currently-opened file.
Definition: Worksheet.h:773
Worksheet::FindIncremental
bool FindIncremental(const wxString &str, bool down, bool ignoreCase)
Definition: Worksheet.cpp:8011
CellPointers::m_indexSearchStartedAt
int m_indexSearchStartedAt
Which cursor position incremental search has started at?
Definition: CellPointers.h:101
Worksheet::RTFStart
wxString RTFStart() const
The start of a RTF document.
Definition: Worksheet.cpp:8741
Worksheet::RedrawIfRequested
bool RedrawIfRequested()
Definition: Worksheet.cpp:244
Worksheet::RecalculateForce
void RecalculateForce()
Schedule a full recalculation of the worksheet.
Definition: Worksheet.cpp:1082
Worksheet::ToggleFold
GroupCell * ToggleFold(GroupCell *which)
Fold or unfold a cell.
Definition: Worksheet.cpp:1205
Worksheet::m_findDialog
FindReplaceDialog * m_findDialog
The find-and-replace-dialog.
Definition: Worksheet.h:788
Worksheet::popid_comment_selection
@ popid_comment_selection
Definition: Worksheet.h:828
Worksheet::m_pointer_x
int m_pointer_x
The x position of the mouse pointer.
Definition: Worksheet.h:1661
Worksheet::AddToEvaluationQueue
void AddToEvaluationQueue(GroupCell *cell)
Adds a group cell to the evaluation queue marking its contents as "outdated".
Definition: Worksheet.cpp:6811
Variablespane
Definition: VariablesPane.h:40
Worksheet::GetSelectionStart
Cell * GetSelectionStart() const
Definition: Worksheet.h:1176
Worksheet::AddSelectionToEvaluationQueue
void AddSelectionToEvaluationQueue()
Schedule all cells in the selection to be evaluated.
Definition: Worksheet.cpp:6870
Worksheet::Animate
void Animate(bool run=true)
Starts playing the animation of a cell generated with the with_slider_* commands.
Definition: Worksheet.cpp:7731
Worksheet::GetCellIndex
int GetCellIndex(Cell *cell) const
Returns the index in (i...) or (o...)
Definition: Worksheet.cpp:4698
Worksheet::m_observer
Worksheet *& m_observer
The reference to a pointer that observes this object's lifetime.
Definition: Worksheet.h:691
Worksheet::ExportToHTML
bool ExportToHTML(const wxString &file)
Definition: Worksheet.cpp:4799
Worksheet::ScheduleScrollToCell
void ScheduleScrollToCell(Cell *cell, bool scrollToTop=true)
Schedules scrolling to a given cell.
Definition: Worksheet.h:1244
Worksheet::SelectAll
void SelectAll()
Select the whole document.
Definition: Worksheet.cpp:7595
Worksheet::CopyMatlab
bool CopyMatlab()
Copy a Matlab representation of the current selection to the clipboard.
Definition: Worksheet.cpp:2627
Worksheet::ScrollToCaret
void ScrollToCaret()
Request to scroll to the cursor as soon as wxMaxima is idle.
Definition: Worksheet.h:1231
Worksheet::Evaluate
void Evaluate()
Definition: Worksheet.cpp:3173
Worksheet::CompileHelpFileAnchors
void CompileHelpFileAnchors()
Collect all keyword anchors in the help file.
Definition: Worksheet.cpp:5918
Worksheet::RTFEnd
wxString RTFEnd() const
The end of a RTF document.
Definition: Worksheet.cpp:8785
Worksheet::AddCellToEvaluationQueue
void AddCellToEvaluationQueue(GroupCell *gc)
Schedule this cell for evaluation.
Definition: Worksheet.cpp:6914
Worksheet::FirstVisibleGC
GroupCell * FirstVisibleGC()
The first groupCell that is currently visible.
Definition: Worksheet.cpp:2162
Worksheet::AddDocumentTillHereToEvaluationQueue
void AddDocumentTillHereToEvaluationQueue()
Schedule all cells stopping with the one the caret is in for evaluation.
Definition: Worksheet.cpp:6891
Worksheet::SetDefaultHCaret
void SetDefaultHCaret()
Definition: Worksheet.cpp:7766
UnicodeSidebar.h
Worksheet::AddRestToEvaluationQueue
void AddRestToEvaluationQueue()
Add all cells below the cursor to the evaluation queue.
Definition: Worksheet.cpp:6849
CellPointers::m_selectionStart
CellPtr< Cell > m_selectionStart
Definition: CellPointers.h:147
AutoComplete::AddSymbols
void AddSymbols(wxString xml)
Interprets the XML autocompletable symbol list maxima can send us.
Definition: Autocomplete.cpp:63
GroupType
GroupType
All types a GroupCell can be of.
Definition: GroupCell.h:38
MC_TYPE_SLIDE
@ MC_TYPE_SLIDE
An animation created by the with_slider_* maxima commands.
Definition: Cell.h:81
Worksheet::m_mouseMotionWas
bool m_mouseMotionWas
Was there a mouse motion we didn't react to until now?
Definition: Worksheet.h:1665
Worksheet::MarkRefreshAsDone
void MarkRefreshAsDone()
Request the worksheet to be redrawn.
Definition: Worksheet.h:716
Worksheet::SimpleMathConfigurationIterator
Definition: Worksheet.h:1605
Worksheet::UpdateScrollPos
void UpdateScrollPos()
Execute all collected scroll events in one go.
Definition: Worksheet.cpp:3331
Worksheet::CopyText
bool CopyText()
Copy a textual representation of the current selection to the clipboard.
Definition: Worksheet.cpp:2695
Worksheet::CodeCellVisibilityChanged
void CodeCellVisibilityChanged()
To be called after enabling or disabling the visibility of code cells.
Definition: Worksheet.cpp:5719
Worksheet::RedrawRequested
bool RedrawRequested() const
Is a Redraw requested?
Definition: Worksheet.h:760
Worksheet::OnFollow
void OnFollow()
Called when the "Scroll to currently evaluated" button is pressed.
Definition: Worksheet.cpp:8661
Cell::GetType
CellType GetType() const
Definition: Cell.h:364
Worksheet::OnKillFocus
void OnKillFocus(wxFocusEvent &event)
What to do if the worksheet looses the input focus.
Definition: Worksheet.cpp:7691
Worksheet::LoadBuiltInManualAnchors
bool LoadBuiltInManualAnchors()
Load the help file anchors from the built-in list.
Definition: Worksheet.cpp:5880
CellPointers::m_selectionEnd
CellPtr< Cell > m_selectionEnd
Definition: CellPointers.h:168
Cell
Definition: Cell.h:139
Worksheet::FoldOccurred
void FoldOccurred()
Definition: Worksheet.cpp:1191
Worksheet::IsSelectionInWorkingGroup
bool IsSelectionInWorkingGroup()
Is the selection in the current working group?
Definition: Worksheet.cpp:7740
Worksheet::Worksheet
Worksheet(wxWindow *parent, int id, Worksheet *&observer, wxPoint pos=wxDefaultPosition, wxSize size=wxDefaultSize)
The constructor.
Definition: Worksheet.cpp:78
Worksheet::ExportToMAC
void ExportToMAC(wxTextFile &output, GroupCell *tree, bool wxm, const std::vector< int > &cellMap, bool fixReorderedIndices)
Definition: Worksheet.cpp:6223
Worksheet::CanRedoInsideCell
bool CanRedoInsideCell() const
Definition: Worksheet.cpp:7837
Worksheet::UpdateControlsNeeded
bool UpdateControlsNeeded()
Is an update of the worksheet controls needed?
Definition: Worksheet.h:91
Worksheet::InsertGroupCells
GroupCell * InsertGroupCells(std::unique_ptr< GroupCell > &&cells, GroupCell *where, UndoActions *undoBuffer)
Definition: Worksheet.cpp:719
Worksheet::SaveManualAnchorsToCache
void SaveManualAnchorsToCache()
Save the list of help file anchors to the cache.
Definition: Worksheet.cpp:6003
Worksheet::SimpleMathConfigurationIterator::input
const wxString & input
Definition: Worksheet.h:1625
EditorCell
Definition: EditorCell.h:57
CellPointers
Definition: CellPointers.h:44
Cell::GetGroup
GroupCell * GetGroup() const
Returns the group cell this cell belongs to.
Definition: Cell.cpp:212
CellPointers::m_currentTextCell
CellPtr< TextCell > m_currentTextCell
The textcell the text maxima is sending us was ending in.
Definition: CellPointers.h:111
Worksheet::OnMouseWheel
void OnMouseWheel(wxMouseEvent &event)
Definition: Worksheet.cpp:2202
Worksheet::GetSelectionEnd
Cell * GetSelectionEnd() const
Definition: Worksheet.h:1183
Worksheet::GetHCaret
GroupCell * GetHCaret()
The cell the horizontal cursor is above. NULL means at the start of the document.
Definition: Worksheet.cpp:7748
Worksheet::CopyMathML
bool CopyMathML()
Copy the MathML representation of the current selection to the clipboard.
Definition: Worksheet.cpp:2599
Worksheet::SectioningMoveOut
bool SectioningMoveOut()
Make this section/subsection/... a chapter/section/... changing its subheadings, too.
Definition: Worksheet.cpp:8538
Worksheet::ShowPoint
void ShowPoint(wxPoint point)
Definition: Worksheet.cpp:7369
Worksheet::DeleteCurrentCell
void DeleteCurrentCell()
Definition: Worksheet.cpp:2825
Worksheet::~Worksheet
~Worksheet()
The destructor.
Definition: Worksheet.cpp:418
CellType
CellType
Definition: Cell.h:63
Worksheet::CanDeleteRegion
bool CanDeleteRegion(GroupCell *start, GroupCell *end) const
Is it possible to delete the cells between start and end?
Definition: Worksheet.cpp:2842
Worksheet::ScrollToCellIfNeeded
void ScrollToCellIfNeeded()
Scrolls to the cell given by ScheduleScrollToCell; Is called once we have time to do so.
Definition: Worksheet.cpp:6948
Worksheet::AddEntireDocumentToEvaluationQueue
void AddEntireDocumentToEvaluationQueue()
Schedule all cells in the document for evaluation.
Definition: Worksheet.cpp:6828
Worksheet::HCaretActive
bool HCaretActive() const
Is the vertically-drawn cursor active?
Definition: Worksheet.h:797
FindReplaceDialog
Definition: FindReplaceDialog.h:40
Worksheet::ScrollToCaretIfNeeded
bool ScrollToCaretIfNeeded()
Scrolls to the cursor, if requested.
Definition: Worksheet.cpp:8155
Worksheet::CopyCells
bool CopyCells()
Copy the selection to the clipboard as it would appear in a .wxm file.
Definition: Worksheet.cpp:2726
Worksheet::WindowActive
void WindowActive(bool active)
Is this window active?
Definition: Worksheet.h:647
Worksheet::OnThumbtrack
void OnThumbtrack(wxScrollWinEvent &ev)
Definition: Worksheet.cpp:7949
Worksheet::ScrollToError
void ScrollToError()
Unfold the cell that produced the error, if necessary and, if requested, scroll to it.
Definition: Worksheet.cpp:806
Configuration::SetWorkSheet
void SetWorkSheet(wxWindow *workSheet)
Set the worksheet this configuration storage is valid for.
Definition: Worksheet.h:1677
CellPointers::m_cellSearchStartedIn
CellPtr< EditorCell > m_cellSearchStartedIn
The EditorCell the search was started in.
Definition: CellPointers.h:99
FindReplaceDialog.h
Worksheet::NumberSections
void NumberSections()
Renumber all sections.
Definition: Worksheet.cpp:1130
Worksheet::OnActivate
void OnActivate(wxActivateEvent &event)
Is called if this element looses or gets the focus.
Definition: Worksheet.cpp:7771
Worksheet::OpenQuestionCaret
void OpenQuestionCaret(const wxString &txt={})
Definition: Worksheet.cpp:3050
Worksheet::ClearSelection
void ClearSelection()
Clear the selection - make it empty, i.e. no selection.
Definition: Worksheet.h:1187
Worksheet::SelectGroupCell
void SelectGroupCell(GroupCell *cell)
Set this cell as the currently selected one.
Definition: Worksheet.cpp:8643
Worksheet::CopyTeX
bool CopyTeX()
Copy the TeX representation of the current selection to the clipboard.
Definition: Worksheet.cpp:2657
Worksheet::m_inPopupMenu
bool m_inPopupMenu
Is there an active popup menu?
Definition: Worksheet.h:1667
Worksheet::OnChar
void OnChar(wxKeyEvent &event)
Definition: Worksheet.cpp:4172
AutoComplete
Definition: Autocomplete.h:53
AutoComplete::autoCompletionType
autoCompletionType
All types of things we can autocomplete.
Definition: Autocomplete.h:61
Worksheet::m_scheduleUpdateToc
bool m_scheduleUpdateToc
Definition: Worksheet.h:794
Worksheet::StepAnimation
void StepAnimation(int change=1)
Definition: Worksheet.cpp:4362
Configuration
Definition: Configuration.h:83
Worksheet::OpenHCaret
void OpenHCaret(const wxString &txt={})
Place the cursor into a new cell where the horizontal cursor is.
Definition: Worksheet.h:1323
Worksheet::PointVisibleIs
bool PointVisibleIs(wxPoint point)
Is the point currently visible on the worksheet?
Definition: Worksheet.cpp:7348
Worksheet::SetAnswer
void SetAnswer(const wxString &answer)
Remember the answer to the LastQuestion().
Definition: Worksheet.cpp:3038
VariablesPane.h
Worksheet::CaretVisibleIs
bool CaretVisibleIs()
Is the caret (hcaret or vcaret) currently visible on the worksheet?
Definition: Worksheet.cpp:8121
Worksheet::m_notificationMessage
stx::optional< Notification > m_notificationMessage
A error notification message.
Definition: Worksheet.h:645
Worksheet::IsActiveInLast
bool IsActiveInLast()
Is the editor active in the last cell of the worksheet?
Definition: Worksheet.h:1295
Worksheet::ExportToTeX
bool ExportToTeX(const wxString &file)
export to a LaTeX file
Definition: Worksheet.cpp:5733
Worksheet::GetInsertGroup
GroupCell * GetInsertGroup() const
The group that the line's cells will belong to - used by InsertLine.
Definition: Worksheet.cpp:861
Worksheet::UnfoldAll
void UnfoldAll()
Definition: Worksheet.cpp:1256
Worksheet::LoadManualAnchorsFromCache
bool LoadManualAnchorsFromCache()
Load the result from the last CompileHelpFileAnchors from the disk cache.
Definition: Worksheet.cpp:5892
Worksheet
Definition: Worksheet.h:86
Worksheet::m_pointer_y
int m_pointer_y
The y position of the mouse pointer.
Definition: Worksheet.h:1663
Worksheet::LoadManualAnchorsFromXML
bool LoadManualAnchorsFromXML(wxXmlDocument xmlDocument, bool checkManualVersion=true)
Load the help file anchors from an wxXmlDocument.
Definition: Worksheet.cpp:6076
Worksheet::KeyboardSelectionStart
EditorCell * KeyboardSelectionStart() const
Tells us which cell the keyboard selection has started in.
Definition: Worksheet.h:671
Worksheet::OnSetFocus
void OnSetFocus(wxFocusEvent &event)
What to do if the worksheet is in the input focus.
Definition: Worksheet.cpp:7679
Worksheet::ConvertSelectionToMathML
wxString ConvertSelectionToMathML()
Convert the current selection to MathML.
Definition: Worksheet.cpp:2545
AutocompletePopup
Definition: AutocompletePopup.h:48
Worksheet::Recalculate
void Recalculate(Cell *start)
Schedule a recalculation of the worksheet starting with the cell start.
Definition: Worksheet.cpp:990
Worksheet::SetActiveCell
void SetActiveCell(EditorCell *cell, bool callRefresh=true)
Definition: Worksheet.cpp:7262
EditorCell.h
GroupCell
Definition: GroupCell.h:68
Worksheet::CopySVG
bool CopySVG()
Copy a svg of the current selection to the clipboard.
Definition: Worksheet.cpp:4538
CellPointers::m_cellKeyboardSelectionStartedIn
CellPtr< EditorCell > m_cellKeyboardSelectionStartedIn
The EditorCell the keyboard selection has started in.
Definition: CellPointers.h:97
Worksheet::Autocomplete
bool Autocomplete(AutoComplete::autoCompletionType type=AutoComplete::command)
Definition: Worksheet.cpp:8241
CellPointers::SetWorkingGroup
void SetWorkingGroup(GroupCell *group)
Sets the cell maxima currently works on. NULL if there isn't such a cell.
Definition: CellPointers.cpp:93
Worksheet::CanUndoInsideCell
bool CanUndoInsideCell() const
Definition: Worksheet.cpp:7820
Worksheet::m_mainToolBar
ToolBar * m_mainToolBar
The toolbar of the main window: We need to access it and therefore have it defined here.
Definition: Worksheet.h:1543
Worksheet::ToggleFoldAll
GroupCell * ToggleFoldAll(GroupCell *which)
Definition: Worksheet.cpp:1228
CellPointers::ErrorList
A list of editor cells containing error messages.
Definition: CellPointers.h:69
Worksheet::IsEmpty
bool IsEmpty() const
Is this worksheet empty?
Definition: Worksheet.h:613
Worksheet::AddSectionToEvaluationQueue
void AddSectionToEvaluationQueue(GroupCell *start)
Adds a chapter, a section or a subsection to the evaluation queue.
Definition: Worksheet.cpp:6839
Worksheet::GetLastCell
GroupCell * GetLastCell()
Returns the last cell of the worksheet.
Definition: Worksheet.h:1299
Worksheet::CopyTree
std::unique_ptr< GroupCell > CopyTree() const
Copies the worksheet's entire contents.
Definition: Worksheet.cpp:4515
Worksheet::ConvertSelectionToBitmap
wxBitmap ConvertSelectionToBitmap()
Convert the current selection to a bitmap.
Worksheet::m_autocomplete
AutoComplete m_autocomplete
The storage for the autocompletion feature.
Definition: Worksheet.h:665
Worksheet::IsSelected
bool IsSelected(CellType type)
Does the selection start with a cell of the type "type".
Definition: Worksheet.cpp:7721
Worksheet::HasCellsSelected
bool HasCellsSelected() const
Is at least one entire cell selected?
Definition: Worksheet.h:1001
Worksheet::UnicodeToMaxima
wxString UnicodeToMaxima(wxString s)
Definition: Worksheet.cpp:6163
Worksheet::CopyRTF
bool CopyRTF()
Copy a rtf version of the current selection to the clipboard.
Definition: Worksheet.cpp:4556
wxScrolled
Definition: CellPointers.h:32
Worksheet::CanAnimate
bool CanAnimate()
Does it make sense to enable the "Play" button and the slider now?
Definition: Worksheet.h:1052
ToolBar::GetCellType
GroupType GetCellType()
Get the cell style for new cells.
Definition: ToolBar.cpp:495
TableOfContents.h
Worksheet::m_evaluationQueue
EvaluationQueue m_evaluationQueue
The list of cells that have to be evaluated.
Definition: Worksheet.h:1431
Worksheet::QuestionPending
bool QuestionPending()
Definition: Worksheet.h:1563
Worksheet::ClearNotification
void ClearNotification()
Clears the notification message from SetNotification.
Definition: Worksheet.cpp:4144
Worksheet::OnKeyDown
void OnKeyDown(wxKeyEvent &event)
Definition: Worksheet.cpp:3182
CellPointers::m_errorList
ErrorList m_errorList
The list of cells maxima has complained about errors in.
Definition: CellPointers.h:93