wxMaxima
Classes | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
Worksheet Class Reference

#include <Worksheet.h>

Inheritance diagram for Worksheet:
Inheritance graph
[legend]
Collaboration diagram for Worksheet:
Collaboration graph
[legend]

Classes

class  SimpleMathConfigurationIterator
 

Public Member Functions

 WX_DECLARE_STRING_HASH_MAP (wxString, HelpFileAnchors)
 
bool UpdateControlsNeeded ()
 Is an update of the worksheet controls needed?
 
wxString GetMaximaHelpFile ()
 
void SetMaximaVersion (wxString version)
 
wxString GetMaximaVersion ()
 
bool IsEmpty () const
 Is this worksheet empty?
 
void CloseAutoCompletePopup ()
 Close the autocompletion pop-up if it is currently open.
 
void OnChar (wxKeyEvent &event)
 
void OnKeyDown (wxKeyEvent &event)
 
void SetCellStyle (GroupCell *group, GroupType style)
 Change the style of a cell.
 
void NumberSections ()
 Renumber all sections.
 
bool SectioningMoveIn ()
 Make this chapter/section/... a section/subsection/... changing its subheadings, too.
 
bool SectioningMoveOut ()
 Make this section/subsection/... a chapter/section/... changing its subheadings, too.
 
void WindowActive (bool active)
 Is this window active?
 
void ClearNotification ()
 Clears the notification message from SetNotification.
 
void SetNotification (const wxString &message, int flags=wxICON_INFORMATION)
 
void OnActivate (wxActivateEvent &event)
 Is called if this element looses or gets the focus.
 
EditorCellGetActiveCell () const
 Get the currently active EditorCell.
 
EditorCellKeyboardSelectionStart () const
 Tells us which cell the keyboard selection has started in.
 
EditorCellMouseSelectionStart () const
 
EditorCellSearchStart () const
 
int IndexSearchStartedAt ()
 
CellPointersGetCellPointers ()
 
CellPointers::ErrorListGetErrorList ()
 
TextCellGetCurrentTextCell () const
 
void SetCurrentTextCell (TextCell *cell)
 
void SetWorkingGroup (GroupCell *group)
 
void UpdateTableOfContents ()
 
void QuestionPending (bool pending)
 
void SetMaximaDocDir (wxString dir)
 
bool GCContainsCurrentQuestion (GroupCell *cell)
 Does the GroupCell cell points to contain the question currently asked by maxima?
 
void OpenQuestionCaret (const wxString &txt={})
 
void UpdateScrollPos ()
 Execute all collected scroll events in one go.
 
GroupCellGetWorkingGroup (bool resortToLast=false) const
 
int GetCellIndex (Cell *cell) const
 Returns the index in (i...) or (o...)
 

Public Attributes

stx::optional< Notificationm_notificationMessage
 A error notification message.
 
Configurationm_configuration
 
AutoComplete m_autocomplete
 The storage for the autocompletion feature.
 
Worksheet *& m_observer
 The reference to a pointer that observes this object's lifetime.
 
Variablespanem_variablesPane
 The panel the user can display variable contents in.
 
HelpFileAnchors m_helpFileAnchors
 All anchors for keywords maxima's helpfile contains.
 
wxArrayString m_replacementsForCurrentWord
 Suggestions for how the word that was right-clicked on could continue.
 

Protected Member Functions

virtual wxSize DoGetBestClientSize () const
 
void UpdateConfigurationClientSize ()
 

Protected Attributes

wxString m_lastQuestion
 
int m_virtualWidth_Last
 
int m_virtualHeight_Last
 
wxBitmap m_memory
 A memory we can manually buffer the contents of the area that is to be redrawn in.
 
GroupCellm_recalculateStart
 Where to start recalculation. NULL = No recalculation needed.
 
int m_pointer_x
 The x position of the mouse pointer.
 
int m_pointer_y
 The y position of the mouse pointer.
 
bool m_mouseMotionWas
 Was there a mouse motion we didn't react to until now?
 
bool m_inPopupMenu = false
 Is there an active popup menu?
 
enum  PopIds {
  popid_comment_selection = wxID_HIGHEST + 500, popid_divide_cell, popid_copy_image, popid_copy_animation,
  popid_copy_svg, popid_copy_emf, popid_copy_rtf, popid_add_watch,
  popid_add_watch_label, popid_special_constant_percent, popid_changeasterisk, popid_hideasterisk,
  popid_delete, popid_simplify, popid_expand, popid_factor,
  popid_solve, popid_solve_num, popid_integrate, popid_diff,
  popid_subst, popid_plot2d, popid_plot3d, popid_float,
  popid_edit, popid_add_comment, popid_insert_input, popid_copy_matlab,
  popid_copy_tex, popid_copy_text, popid_copy_mathml, popid_labels_disable,
  popid_labels_user, popid_labels_useronly, popid_labels_autogenerated, popid_labelwidth,
  popid_labelwidth3, popid_labelwidth4, popid_labelwidth5, popid_labelwidth6,
  popid_labelwidth7, popid_labelwidth8, popid_labelwidth9, popid_labelwidth10,
  popid_digits_20, popid_digits_50, popid_digits_100, popid_digits_all,
  popid_digits_all_linebreak, popid_image, popid_change_image, popid_svg,
  popid_emf, popid_animation_save, popid_animation_start, popid_evaluate,
  popid_evaluate_section, popid_merge_cells, popid_insert_text, popid_insert_title,
  popid_insert_section, popid_insert_subsection, popid_insert_subsubsection, popid_insert_heading5,
  popid_insert_heading6, popid_auto_answer, popid_never_autoanswer, popid_popup_gnuplot,
  popid_fold, popid_unfold, popid_maxsizechooser, popid_resolutionchooser,
  popid_reloadimage, popid_suggestion1, popid_suggestion2, popid_suggestion3,
  popid_suggestion4, popid_suggestion5, popid_suggestion6, popid_suggestion7,
  popid_suggestion8, popid_suggestion9, popid_suggestion10, popid_hide_tooltipMarker,
  popid_hide_tooltipMarkerForThisMessage
}
 
std::unique_ptr< std::thread > m_helpfileanchorsThread
 The thread the help file anchors are compiled in.
 
wxString m_currentFile
 The name of the currently-opened file.
 
FindReplaceDialogm_findDialog
 The find-and-replace-dialog.
 
bool m_scheduleUpdateToc
 
wxTimer m_keyboardInactiveTimer
 The timer that tells us when the keyboard is inactive so an autosave isn't disrupting.
 
EvaluationQueue m_evaluationQueue
 The list of cells that have to be evaluated.
 
TableOfContentsm_tableOfContents
 The table of contents pane.
 
ToolBarm_mainToolBar
 The toolbar of the main window: We need to access it and therefore have it defined here.
 
bool m_questionPrompt
 true = the last reply from maxima was a question
 
void MarkRefreshAsDone ()
 Request the worksheet to be redrawn. More...
 
bool RedrawIfRequested ()
 
void RequestRedraw (GroupCell *start=NULL)
 
void RequestRedraw (wxRect rect)
 
void ForceRedraw ()
 Redraw the window now and mark any pending redraw request as "handled".
 
bool RedrawRequested () const
 Is a Redraw requested?
 
void CodeCellVisibilityChanged ()
 To be called after enabling or disabling the visibility of code cells.
 
void UpdateConfig ()
 Re-read the configuration.
 
wxString UnicodeToMaxima (wxString s)
 
void ScrollToStart ()
 Scroll to the start of the worksheet.
 
void ScrollToError ()
 Unfold the cell that produced the error, if necessary and, if requested, scroll to it.
 
bool HCaretActive () const
 Is the vertically-drawn cursor active?
 
bool CanMergeSelection () const
 
bool CanUndo () const
 
bool CanRedo () const
 
void Undo ()
 
void Redo ()
 
void TreeUndo_ClearBuffers ()
 
 Worksheet (wxWindow *parent, int id, Worksheet *&observer, wxPoint pos=wxDefaultPosition, wxSize size=wxDefaultSize)
 The constructor. More...
 
 ~Worksheet ()
 The destructor.
 
void DestroyTree ()
 Clear the whole worksheet.
 
std::unique_ptr< GroupCellCopyTree () const
 Copies the worksheet's entire contents.
 
GroupCellInsertGroupCells (std::unique_ptr< GroupCell > &&cells, GroupCell *where, UndoActions *undoBuffer)
 
GroupCellInsertGroupCells (std::unique_ptr< GroupCell > &&cells, GroupCell *where=NULL)
 
void InsertLine (std::unique_ptr< Cell > &&newCell, bool forceNewLine=false)
 
GroupCellGetInsertGroup () const
 The group that the line's cells will belong to - used by InsertLine.
 
bool RecalculateIfNeeded ()
 
void Recalculate (Cell *start)
 Schedule a recalculation of the worksheet starting with the cell start.
 
void Recalculate ()
 
void RecalculateForce ()
 Schedule a full recalculation of the worksheet.
 
void ClearDocument ()
 
void ResetInputPrompts ()
 
bool CanCopy (bool fromActive=false)
 
bool CanPaste ()
 
bool CanCut ()
 
void SelectAll ()
 Select the whole document.
 
bool HasCellsSelected () const
 Is at least one entire cell selected?
 
void DeleteRegion (GroupCell *start, GroupCell *end, UndoActions *undoBuffer)
 
void DeleteRegion (GroupCell *start, GroupCell *end)
 
void DeleteSelection ()
 
void TOCdnd ()
 
bool CanDeleteRegion (GroupCell *start, GroupCell *end) const
 Is it possible to delete the cells between start and end?
 
bool CanDeleteSelection () const
 Is it possible to delete the currently selected cells?
 
void DeleteCurrentCell ()
 
bool CanAnimate ()
 Does it make sense to enable the "Play" button and the slider now?
 
void Animate (bool run=true)
 Starts playing the animation of a cell generated with the with_slider_* commands. More...
 
void DivideCell ()
 
void MergeCells ()
 
void SetLastQuestion (const wxString &lastQuestion)
 
wxString GetLastQuestion ()
 
bool CutToClipboard ()
 Add the currently selected cells to the clipboard and delete them.
 
void PasteFromClipboard ()
 
bool Copy (bool astext=false)
 
bool CopyCells ()
 Copy the selection to the clipboard as it would appear in a .wxm file.
 
bool CopyMatlab ()
 Copy a Matlab representation of the current selection to the clipboard.
 
bool CopyText ()
 Copy a textual representation of the current selection to the clipboard.
 
bool CopyTeX ()
 Copy the TeX representation of the current selection to the clipboard.
 
wxString ConvertSelectionToMathML ()
 Convert the current selection to MathML.
 
wxBitmap ConvertSelectionToBitmap ()
 Convert the current selection to a bitmap.
 
bool CopyMathML ()
 Copy the MathML representation of the current selection to the clipboard.
 
bool CopyBitmap ()
 Copy a bitmap of the current selection to the clipboard.
 
bool CopyAnimation ()
 Copy the current animation to the clipboard.
 
bool CopySVG ()
 Copy a svg of the current selection to the clipboard.
 
bool CopyRTF ()
 Copy a rtf version of the current selection to the clipboard.
 
wxSize CopyToFile (const wxString &file)
 
wxSize CopyToFile (const wxString &file, Cell *start, Cell *end, bool asData=false, double scale=1)
 
void CalculateReorderedCellIndices (GroupCell *tree, int &cellIndex, std::vector< int > &cellMap)
 
bool ExportToHTML (const wxString &file)
 
void ExportToMAC (wxTextFile &output, GroupCell *tree, bool wxm, const std::vector< int > &cellMap, bool fixReorderedIndices)
 
bool ExportToMAC (const wxString &file)
 Export the file to a text file maxima's load command can read.
 
bool ExportToWXMX (const wxString &file, bool markAsSaved=true)
 
wxString RTFStart () const
 The start of a RTF document.
 
wxString RTFEnd () const
 The end of a RTF document.
 
bool ExportToTeX (const wxString &file)
 export to a LaTeX file More...
 
wxString GetString (bool lb=false)
 
GroupCellGetTree () const
 
std::unique_ptr< GroupCell > * GetTreeAddress ()
 
CellGetSelectionStart () const
 
CellGetSelectionEnd () const
 
void ClearSelection ()
 Clear the selection - make it empty, i.e. no selection.
 
void SetSelection (Cell *sel)
 Select the cell sel.
 
void SetSelection (Cell *start, Cell *end)
 Select the cell range start-end.
 
bool CanEdit ()
 
bool ActivatePrevInput ()
 
bool ActivateNextInput ()
 
wxString GetStatusText () const
 
bool StatusTextChangedHas ()
 
bool StatusTextHas ()
 
void ScrollToCaret ()
 Request to scroll to the cursor as soon as wxMaxima is idle.
 
bool ScrollToCaretIfNeeded ()
 Scrolls to the cursor, if requested.
 
void ScrollToCellIfNeeded ()
 Scrolls to the cell given by ScheduleScrollToCell; Is called once we have time to do so.
 
void ScheduleScrollToCell (Cell *cell, bool scrollToTop=true)
 Schedules scrolling to a given cell.
 
bool PointVisibleIs (wxPoint point)
 Is the point currently visible on the worksheet?
 
bool CaretVisibleIs ()
 Is the caret (hcaret or vcaret) currently visible on the worksheet?
 
GroupCellFirstVisibleGC ()
 The first groupCell that is currently visible.
 
void ShowPoint (wxPoint point)
 
void OnSetFocus (wxFocusEvent &event)
 What to do if the worksheet is in the input focus.
 
void OnKillFocus (wxFocusEvent &event)
 What to do if the worksheet looses the input focus.
 
bool IsSelected (CellType type)
 Does the selection start with a cell of the type "type". More...
 
void StepAnimation (int change=1)
 
bool IsActiveInLast ()
 Is the editor active in the last cell of the worksheet?
 
GroupCellGetLastCell ()
 Returns the last cell of the worksheet.
 
bool IsSelectionInWorkingGroup ()
 Is the selection in the current working group?
 
void SetActiveCell (EditorCell *cell, bool callRefresh=true)
 
void SetDefaultHCaret ()
 
void SetHCaret (GroupCell *where)
 
GroupCellGetHCaret ()
 The cell the horizontal cursor is above. NULL means at the start of the document.
 
void OpenHCaret (const wxString &txt={})
 Place the cursor into a new cell where the horizontal cursor is.
 
void OpenHCaret (const wxString &txt, GroupType type)
 Place the cursor into a new cell where the horizontal cursor is.
 
void ShowHCaret ()
 Activates the horizontal cursor.
 
bool CanUndoInsideCell () const
 
void UndoInsideCell ()
 
bool CanRedoInsideCell () const
 
void RedoInsideCell ()
 
void FollowEvaluation (bool followEvaluation)
 
bool FollowEvaluation () const
 Query if we want to automatically scroll to the cell that is currently evaluated.
 
void ScrolledAwayFromEvaluation (bool ScrolledAway)
 
bool ScrolledAwayFromEvaluation ()
 
void SaveValue ()
 
bool IsSaved ()
 
void SetSaved (bool saved)
 
void OutputChanged ()
 
void RemoveAllOutput ()
 
void RemoveAllOutput (GroupCell *cell)
 
void Evaluate ()
 
void AddToEvaluationQueue (GroupCell *cell)
 Adds a group cell to the evaluation queue marking its contents as "outdated".
 
void AddDocumentToEvaluationQueue ()
 
void AddEntireDocumentToEvaluationQueue ()
 Schedule all cells in the document for evaluation. More...
 
void AddDocumentTillHereToEvaluationQueue ()
 Schedule all cells stopping with the one the caret is in for evaluation.
 
void AddRestToEvaluationQueue ()
 Add all cells below the cursor to the evaluation queue.
 
void AddSectionToEvaluationQueue (GroupCell *start)
 Adds a chapter, a section or a subsection to the evaluation queue.
 
void AddSelectionToEvaluationQueue ()
 Schedule all cells in the selection to be evaluated.
 
void AddSelectionToEvaluationQueue (GroupCell *start, GroupCell *end)
 Schedule all cells in a region to be evaluated.
 
void AddCellToEvaluationQueue (GroupCell *gc)
 Schedule this cell for evaluation.
 
GroupCellUpdateMLast ()
 
void FoldOccurred ()
 
GroupCellToggleFold (GroupCell *which)
 Fold or unfold a cell. More...
 
GroupCellToggleFoldAll (GroupCell *which)
 
void FoldAll ()
 
void UnfoldAll ()
 
void SetZoomFactor (double newzoom, bool recalc=true)
 
void CommentSelection ()
 
void OnScrollChanged (wxScrollEvent &ev)
 
void OnThumbtrack (wxScrollWinEvent &ev)
 
void OnMouseWheel (wxMouseEvent &event)
 
bool FindIncremental (const wxString &str, bool down, bool ignoreCase)
 
bool FindNext (const wxString &str, bool down, bool ignoreCase, bool warn=true)
 
void Replace (const wxString &oldString, const wxString &newString, bool ignoreCase)
 
int ReplaceAll (const wxString &oldString, const wxString &newString, bool ignoreCase)
 
wxString GetInputAboveCaret ()
 
wxString GetOutputAboveCaret ()
 
void LoadSymbols ()
 
void CompileHelpFileAnchors ()
 Collect all keyword anchors in the help file. More...
 
bool LoadManualAnchorsFromCache ()
 Load the result from the last CompileHelpFileAnchors from the disk cache.
 
bool LoadManualAnchorsFromXML (wxXmlDocument xmlDocument, bool checkManualVersion=true)
 Load the help file anchors from an wxXmlDocument.
 
bool LoadBuiltInManualAnchors ()
 Load the help file anchors from the built-in list.
 
void SaveManualAnchorsToCache ()
 Save the list of help file anchors to the cache.
 
bool Autocomplete (AutoComplete::autoCompletionType type=AutoComplete::command)
 
void AddSymbol (const wxString &fun, AutoComplete::autoCompletionType type=AutoComplete::command)
 Add a symbol to the autocompletion list.
 
void AddSymbols (wxString xml)
 Add a xml-encoded list of symbols to the autocompletion list.
 
void SetActiveCellText (const wxString &text)
 
bool InsertText (const wxString &text)
 
void OpenNextOrCreateCell ()
 
void OnFollow ()
 Called when the "Scroll to currently evaluated" button is pressed.
 
void SelectGroupCell (GroupCell *cell)
 Set this cell as the currently selected one.
 
void SetAnswer (const wxString &answer)
 Remember the answer to the LastQuestion(). More...
 
void QuestionAnswered ()
 Mark the current question from maxima as "answered"..
 
bool QuestionPending ()
 

Detailed Description

The canvas that contains the spreadsheet the whole program is about.

This canvas contains all the math-, title-, image- input- ("editor-")- etc.- cells of the current session.

Most of the logic that handles that this canvas might be larger than the screen (and could even be larger than the computer's RAM would it have been handled as a big bitmap) is provided by wxWidgets:

The worksheet isn't immediately redrawn on a key press, a mouse click or on maxima outputting new data. Instead all such events are processed in order until wxMaxima has caught up with all the events (which causes wxWidgets to send a Idle event to the wxMaxima object) or until we reach a timeout. If the user manages to type faster than wxMaxima redraws the screen this allows us to skip a few redraws in order to process the keypresses as fast as the user types. Also this keeps us responsive even if maxima outputs data faster than wxMaxima can display it.

Member Enumeration Documentation

◆ PopIds

The ids for all popup menu items.

Enumerator
popid_comment_selection 

This first item of the enum and is assigned a high enough number that it won't collide with the numbers to be found in wxFrame::Event

Constructor & Destructor Documentation

◆ Worksheet()

Worksheet::Worksheet ( wxWindow *  parent,
int  id,
Worksheet *&  observer,
wxPoint  pos = wxDefaultPosition,
wxSize  size = wxDefaultSize 
)

The constructor.

This class represents the worksheet shown in the middle of the wxMaxima window.

Member Function Documentation

◆ AddEntireDocumentToEvaluationQueue()

void Worksheet::AddEntireDocumentToEvaluationQueue ( )

Schedule all cells in the document for evaluation.

Add the entire document, including hidden cells, to the evaluation queue.

◆ Animate()

void Worksheet::Animate ( bool  run = true)

Starts playing the animation of a cell generated with the with_slider_* commands.

Animate the current slide show

Parameters
run
  • false: Stop the animation
  • true: Run the animation

◆ Autocomplete()

bool Worksheet::Autocomplete ( AutoComplete::autoCompletionType  type = AutoComplete::command)

No completions - clear the selection and return false

If there is only one completion, use it

If there are more than one completions, popup a menu

◆ CanEdit()

bool Worksheet::CanEdit ( )

We can edit the input if the we have the whole input in selection!

◆ CanMergeSelection()

bool Worksheet::CanMergeSelection ( ) const

Can we merge the selected cells into one?

Todo:
Does it make sense to make to allow the text of sections and image cells with math cells?

◆ CanRedoInsideCell()

bool Worksheet::CanRedoInsideCell ( ) const

Is it possible to issue an undo in the currently selected cell?

Returns
false if no cell is selected or no redo can be executed.

◆ CanUndoInsideCell()

bool Worksheet::CanUndoInsideCell ( ) const

Is it possible to issue an undo in the currently selected cell?

Returns
false if no cell is selected or there is no further undo information

◆ ClearDocument()

void Worksheet::ClearDocument ( )

Empties the current document

Used before opening a new file or when the "new" button is pressed.

◆ CompileHelpFileAnchors()

void Worksheet::CompileHelpFileAnchors ( )

Collect all keyword anchors in the help file.

Tokens that end with "-1" aren't too useful, normally.

◆ Copy()

bool Worksheet::Copy ( bool  astext = false)

Copy the current selection to the clipboard

Parameters
astext
  • true: Copy the current selection as text
  • false: Copy the current selection as they would appear in a .wxm file

◆ DeleteCurrentCell()

void Worksheet::DeleteCurrentCell ( )

Delete the currently active cell - or the cell above this one.

Used for the "delete current cell" shortcut.

◆ DeleteRegion()

void Worksheet::DeleteRegion ( GroupCell start,
GroupCell end,
UndoActions *  undoBuffer 
)

Set the cursor to a sane place

◆ Evaluate()

void Worksheet::Evaluate ( )

Trigger the evaluation of the current cell(s)

Internally this function simulates a click on the "Cell/Evaluate Cell(s)" button.

◆ ExportToHTML()

bool Worksheet::ExportToHTML ( const wxString &  file)

Export the file to an html document

Todo:
Worksheet and text cell background work fine, but their names might be interchanged.

◆ ExportToMAC()

void Worksheet::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

Todo:
Slow: Iterates through a string using [] instead of using an iterator.

◆ ExportToTeX()

bool Worksheet::ExportToTeX ( const wxString &  file)

export to a LaTeX file

Export the file as TeX code

◆ ExportToWXMX()

bool Worksheet::ExportToWXMX ( const wxString &  file,
bool  markAsSaved = true 
)

export to xml compatible file

Parameters
fileThe file name
markAsSavedfalse means that this action doesn't clear the worksheet's "modified" status.

◆ FindIncremental()

bool Worksheet::FindIncremental ( const wxString &  str,
bool  down,
bool  ignoreCase 
)

Do an incremental search from the cursor or the point the last search started at

Used by the find dialog.

Todo:
Keep a list of positions the last few letters were found at?

◆ FindNext()

bool Worksheet::FindNext ( const wxString &  str,
bool  down,
bool  ignoreCase,
bool  warn = true 
)

Find the next occurrence of a string

Used by the find dialog.

◆ FoldAll()

void Worksheet::FoldAll ( )

Recursively folds the whole document.

◆ FoldOccurred()

void Worksheet::FoldOccurred ( )

Call when a fold action was detected, to update the state in response to a fold occurring.

◆ FollowEvaluation()

void Worksheet::FollowEvaluation ( bool  followEvaluation)

Do we want to follow the evaluation process?

Maxima can automagically scroll to the cell that is currently evaluated. If it does do so can be queried by FollowEvaluation(). Changing the behavior (for example because the user has scrolled away from the cell being evaluated and now clearly wants the cursor to stay where it is) can be achieved by FollowEvaluation(true) or FollowEvaluation(false).

◆ GetSelectionEnd()

Cell* Worksheet::GetSelectionEnd ( ) const
inline

Return the last of the currently selected cells.

NULL means: No cell is selected.

◆ GetSelectionStart()

Cell* Worksheet::GetSelectionStart ( ) const
inline

Return the first of the currently selected cells.

NULL means: No cell is selected.

◆ GetString()

wxString Worksheet::GetString ( bool  lb = false)

Convert the current selection to a string

Parameters
lb
  • true: Include linebreaks
  • false: Remove linebreaks from the converted string

◆ GetWorkingGroup()

GroupCell * Worksheet::GetWorkingGroup ( bool  resortToLast = false) const

Returns the cell maxima currently works on. NULL if there isn't such a cell.

Parameters
resortToLasttrue = if we already have set the cell maxima works on to NULL use the last cell maxima was known to work on.

◆ InsertGroupCells() [1/2]

GroupCell * Worksheet::InsertGroupCells ( std::unique_ptr< GroupCell > &&  cells,
GroupCell where,
UndoActions *  undoBuffer 
)

Insert group cells into the worksheet

Parameters
cellsThe list of cells that has to be inserted
whereThe cell the cells have to be inserted after. NULL means: Insert the cells at the beginning of the worksheet.
undoBufferThe buffer the undo information for this action has to be kept in. Might be
  • treeUndoActions for normal deletes,
  • treeRedoActions for deletions while executing an undo or
  • NULL for: Don't keep any copy of the cells.

◆ InsertGroupCells() [2/2]

GroupCell * Worksheet::InsertGroupCells ( std::unique_ptr< GroupCell > &&  cells,
GroupCell where = NULL 
)

Insert group cells into the worksheet

Parameters
cellsThe list of cells that has to be inserted
whereThe cell the cells have to be inserted after

◆ InsertLine()

void Worksheet::InsertLine ( std::unique_ptr< Cell > &&  newCell,
bool  forceNewLine = false 
)

Add a new line to the output cell of the working group.

If maxima isn't currently evaluating and therefore there is no working group the line is appended to m_last, instead.

◆ IsSelected()

bool Worksheet::IsSelected ( CellType  type)

Does the selection start with a cell of the type "type".

Is this cell selected?

◆ MarkRefreshAsDone()

void Worksheet::MarkRefreshAsDone ( )
inline

Request the worksheet to be redrawn.

Handle redrawing the worksheet or of parts of it

This functionality is important for scrolling, if we have changed anything that needs updating or if part of the screen memory containing a window was overwritten by a window that was in front of it and now needs to be redrawn for this reason.

We don't redraw the window immediately if this seems necessary but wait for the idle loop instead - which is called when all selected gui events have been processed. This allows us to handle events as fast as the user can type and (if the user types faster than we can display the text) enables us to update the display as often as the typing speed allows, but not more often.

◆ OnChar()

void Worksheet::OnChar ( wxKeyEvent &  event)

Key for a printable character pressed.

Can call OnCharInActive or OnCharNoActive, if appropriate. See OnKeyDown for non-printable characters like "up" or "right".

◆ OnKeyDown()

void Worksheet::OnKeyDown ( wxKeyEvent &  event)

A special key has been pressed

Printable characters are handled by OnChar instead.

◆ OnMouseWheel()

void Worksheet::OnMouseWheel ( wxMouseEvent &  event)

Called if the mouse wheel sents events

The virtual mouse wheel touchpads provide are handled by OnThumbtrack instead.

Step the slide show.

◆ OnScrollChanged()

void Worksheet::OnScrollChanged ( wxScrollEvent &  ev)

Called if the user is using the scrollbar for scrolling through the document

See also OnThumbtrack and OnMouseWheel

◆ OnThumbtrack()

void Worksheet::OnThumbtrack ( wxScrollWinEvent &  ev)

Called if the user uses the touchpad for scrolling

Why we need to override this signal is that on Linux and at least on wxGTK and wxWidgets 3.0+3.1 each single scroll step generates its own thumbtrack event that forces an immediate scroll of the worksheet including an immediate redraw. It therefore is possible for a user to queue hundreds of thumbtrack events per seconds while wxMaxima's framerate (and event processing speed) might be considerably lower than that.

OnThumbtrack is a try to merge all scroll events until the idle task redraws the worksheet.

See also OnMouseWheel and OnScrollChanged

Step the slide show.

◆ OpenQuestionCaret()

void Worksheet::OpenQuestionCaret ( const wxString &  txt = {})

Move the cursor to the question maxima currently asks and if needed add a cell for user input

◆ QuestionPending() [1/2]

bool Worksheet::QuestionPending ( )
inline

Does maxima wait for the answer of a question?

Return values
true= maxima waits for the answer of a question.

◆ QuestionPending() [2/2]

void Worksheet::QuestionPending ( bool  pending)
inline

Does maxima wait for the answer of a question?

◆ RedrawIfRequested()

bool Worksheet::RedrawIfRequested ( )

Redraw the worksheet if RequestRedraw() has been called.

Also handles setting tooltips and redrawing the brackets on mouse movements.

◆ Replace()

void Worksheet::Replace ( const wxString &  oldString,
const wxString &  newString,
bool  ignoreCase 
)

Replace the current occurrence of a string

Used by the find dialog.

◆ ReplaceAll()

int Worksheet::ReplaceAll ( const wxString &  oldString,
const wxString &  newString,
bool  ignoreCase 
)

Replace all occurrences of a string

Used by the find dialog.

◆ RequestRedraw() [1/2]

void Worksheet::RequestRedraw ( GroupCell start = NULL)

Request the worksheet to be redrawn

Parameters
startWhich cell do we need to start the redraw in? Subsequent calls to this function with different cells start the redraw at the upmost of the cells that were passed to it.

The actual redraw is done in the idle loop which means that as many redraw actions are merged as is necessary to allow wxMaxima to process things in real time.

Returns
true, if we did redraw a workscreet portion.

◆ RequestRedraw() [2/2]

void Worksheet::RequestRedraw ( wxRect  rect)

Request a part of the worksheet to be redrawn

Parameters
rectThe rectangle that is to be requested to be redrawn. If this function is called multiple times the rectangles are automatically merged.

The actual redraw is done in the idle loop which means that as many redraw actions are merged as is necessary to allow wxMaxima to process things in real time.

◆ ScrolledAwayFromEvaluation()

void Worksheet::ScrolledAwayFromEvaluation ( bool  ScrolledAway)

Set or get the "Scrolled away from evaluation" status

Sets FollowEvaluation() to false and enables the toolbar button to follow the evaluation process again.

◆ SetActiveCell()

void Worksheet::SetActiveCell ( EditorCell cell,
bool  callRefresh = true 
)

Mark an editor cell as the active one

◆ SetAnswer()

void Worksheet::SetAnswer ( const wxString &  answer)

Remember the answer to the LastQuestion().

Handling questions from and answers for maxima

◆ SetDefaultHCaret()

void Worksheet::SetDefaultHCaret ( )

Set the HCaret to its default location, at the end of the document.

◆ SetHCaret()

void Worksheet::SetHCaret ( GroupCell where)

Set the HCaret at the location of the given Cell.

Parameters
whereThe cell to place the cursor before.

◆ SetNotification()

void Worksheet::SetNotification ( const wxString &  message,
int  flags = wxICON_INFORMATION 
)

Inform the user that something happened in a non-active window

This command will be ignored if the wxMaxima window is currently active

◆ ShowPoint()

void Worksheet::ShowPoint ( wxPoint  point)

Scrolls to a point on the worksheet

Todo:
I have deactivated this assert for the release as it scares the users in a case we don't seem to have a problem. But we perhaps should try to find out why it is triggered.

Test case:

  • Create a code cell
  • Press the "hide all code cells" button.
  • click between 2 worksheet cells which makes the cursor appear as a horizontal line
  • press any letter.

◆ StepAnimation()

void Worksheet::StepAnimation ( int  change = 1)

Set the slide of the currently selected animation or advance it by one step

Parameters
change
  • >=0: The slide the animation has to be set to
  • <0: Advance the animation by one step.

◆ ToggleFold()

GroupCell * Worksheet::ToggleFold ( GroupCell which)

Fold or unfold a cell.

Toggles the status of the fold for the given GroupCell. If the cell is folded, it will be unfolded; otherwise it will be folded.

Parameters
whichThe GroupCell to fold or unfold.
Returns
A pointer to a GroupCell if the action succeeded; NULL otherwise.

◆ ToggleFoldAll()

GroupCell * Worksheet::ToggleFoldAll ( GroupCell which)

Toggles the status of the fold for the given GroupCell and its children. If the cell is folded, it will be recursively unfolded; otherwise it will be recursively folded.

Parameters
whichThe GroupCell to recursively fold or unfold.
Returns
A pointer to a GroupCell if the action succeeded; NULL otherwise.

◆ UnfoldAll()

void Worksheet::UnfoldAll ( )

Recursively unfolds the whole document.

◆ UnicodeToMaxima()

wxString Worksheet::UnicodeToMaxima ( wxString  s)

Make a few unicode characters interpretable by maxima.

Does convert the not equal sign to a '#' and similar.

◆ UpdateTableOfContents()

void Worksheet::UpdateTableOfContents ( )
inline

Update the table of contents

This function actually only schedules the update of the table-of-contents-tab. The actual update is done when wxMaxima is idle.

Member Data Documentation

◆ m_configuration

Configuration* Worksheet::m_configuration

The pointer to the currently active central settings storage

Whilst printing or exporting the worksheet a settings storage with the print settings might be active.

◆ m_scheduleUpdateToc

bool Worksheet::m_scheduleUpdateToc

True = schedule an update of the table of contents

used by UpdateTableOfContents() and the idle task.


The documentation for this class was generated from the following files: