![]() |
wxMaxima
|
#include <EditorCell.h>
Public Member Functions | |
EditorCell (GroupCell *group, Configuration **config, const wxString &text={}) | |
The constructor. | |
EditorCell (GroupCell *group, const EditorCell &cell) | |
const CellTypeInfo & | GetInfo () override |
Returns the information about this cell's type. | |
std::unique_ptr< Cell > | Copy (GroupCell *group) const override |
EditorCell * | GetPrevious () const |
Get the previous EditorCell in the list. | |
EditorCell * | GetNext () const |
Get the next EditorCell in the list. | |
void | InsertEscCommand (const wxString &txt) |
Insert the symbol that corresponds to the ESC command txt. | |
wxString | GetFullCommandUnderCursor () |
Get the whole maxima command that is currently under the cursor (including all arguments) | |
void | AddDrawParameter (wxString param) |
Add a new parameter to a draw- or similar command including the comma, if needed. | |
void | AutoAnswer (bool autoAnswer) |
May this Editor Cell contain the answer to a question? | |
void | SearchStartedHere (int index) const |
void | SearchStartedHere () const |
Remember that this is the cell the search was started in. | |
void | MouseSelectionStartedHere () const |
Remember that this is the cell the mouse selection was started in. | |
void | KeyboardSelectionStartedHere () const |
Remember that this is the cell the keyboard selection was started in. | |
const auto & | GetWordList () const |
A list of words that might be applicable to the autocomplete function. | |
void | Recalculate (AFontSize fontsize) override |
virtual void | Draw (wxPoint point) override |
wxString | ToHTML () const |
Convert the current cell to HTML code. | |
wxString | ToMatlab () const override |
Convert this cell to its Matlab representation. | |
wxString | ToMatlab (bool dontLimitToSelection) const |
Convert the current cell to Matlab code. More... | |
wxString | ToRTF () const override |
Convert the current cell to RTF code. | |
wxString | ToString () const override |
Returns the cell's representation as a string. | |
wxString | ToString (bool dontLimitToSelection) const |
wxString | ToTeX () const override |
Convert the current cell to LaTeX code. | |
wxString | ToXML () const override |
Convert the current cell to XML code for inclusion in a .wxmx file. | |
void | SetFont () |
Set the currently used font to the one that matches this cell's formatting. | |
void | SetForeground () |
Sets the current color to this cell's foreground color. | |
void | SetValue (const wxString &text) override |
const wxString & | GetValue () const override |
void | StyleText () |
void | StyleTextCode () |
void | StyleTextTexts () |
void | Reset () |
void | ProcessEvent (wxKeyEvent &event) override |
Decide what to do if the user pressed a key when this cell was selected. | |
void | ActivateCursor () |
void | DeactivateCursor () |
Deactivate the blinking cursor in the EditorCell it is in. | |
size_t | BeginningOfLine (long pos) const |
Return the index of the 1st char of the line containing the letter pos. | |
size_t | EndOfLine (long pos) |
Return the index of the last char of the line containing the letter #pos,. | |
bool | AddEnding () override |
Adds a ";" to the end of the last command in this cell in case that it doesn't end in $ or ;. | |
void | PositionToXY (int position, unsigned int *x, unsigned int *y) |
Determines which line and column the pos'th char is at. | |
int | XYToPosition (int x, int y) |
Determines which index the char at the position "x chars left, y chars down" is at. | |
wxPoint | PositionToPoint (int pos=-1) override |
The screen coordinates of the cursor. | |
void | SelectPointText (wxPoint point) override |
Sets the cursor to the screen coordinate point. | |
void | SelectRectText (wxPoint one, wxPoint two) override |
Selects the text between the screen coordinates one and two. | |
wxString | SelectWordUnderCaret (bool selectParens=true, bool toRight=true, bool includeDoubleQuotes=false) |
Selects the word the cursor is currently at. | |
bool | IsPointInSelection (wxPoint point) |
Is the point point inside the currently selected text? | |
bool | CopyToClipboard () const override |
bool | CutToClipboard () override |
void | PasteFromClipboard (bool primary=false) override |
int | GetSelectionStart () const |
Get the character position the selection has been started with. | |
int | GetSelectionEnd () const |
Get the character position the selection has been ended with. | |
void | SelectAll () override |
Select the whole text contained in this Cell. | |
bool | AllSelected () const |
Does the selection currently span the whole cell? | |
void | SelectNone () |
Unselect everything. | |
bool | SelectionActive () const |
Is there any text selected right now? | |
bool | CanCopy () const override |
bool | FindMatchingQuotes () |
void | FindMatchingParens () |
int | GetLineWidth (unsigned int line, int pos) |
bool | IsDirty () const override |
true, if this cell's width has to be recalculated. | |
void | SwitchCaretDisplay () override |
Toggles the visibility of the cursor which is used to make it blink. | |
void | SetFocus (bool focus) override |
void | SetFirstLineOnly (bool show=true) |
bool | IsActive () const override |
bool | CaretAtStart () const |
Is the cursor at the start of this cell? | |
void | CaretToStart () |
Move the cursor to the start of this cell. | |
bool | CaretAtEnd () const |
Is the cursor at the end of this cell? | |
void | CaretToEnd () |
Move the cursor to the end of this cell. | |
void | CaretToPosition (int pos) |
Move the cursor to a certain position in the cell. | |
bool | CanUndo () const |
True, if there is undo information for this cell. | |
void | Undo () |
Issue an undo command. | |
bool | CanRedo () const |
True, if a redo can be done for this cell. | |
void | Redo () |
Issu a redo command. | |
void | SaveValue () |
Save the current contents of this cell in the undo buffer. | |
wxString | DivideAtCaret () |
void | CommentSelection () |
void | ClearUndo () |
bool | ContainsChanges () const |
Query if this cell needs to be re-evaluated by maxima. | |
void | ContainsChanges (bool changes) |
Set the information if this cell needs to be re-evaluated by maxima. | |
bool | CheckChanges () |
int | ReplaceAll (wxString oldString, const wxString &newString, bool ignoreCase) |
bool | FindNext (wxString str, const bool &down, const bool &ignoreCase) |
bool | IsSelectionChanged () const |
void | SetSelection (int start, int end) |
void | GetSelection (int *start, int *end) const |
bool | ReplaceSelection (const wxString &oldStr, const wxString &newString, bool keepSelected=false, bool ignoreCase=false, bool replaceMaximaString=false) |
wxString | GetSelectionString () const |
Convert the current selection to a string. | |
wxString | GetWordUnderCaret () |
The word the cursor currently is at. | |
wxString | GetCurrentCommand () |
Get the command the cursor is in the arguments for. | |
void | ClearSelection () |
Unselect everything. | |
void | SetErrorIndex (int index) |
Sets the index the error is at. | |
bool | ErrorIndexSet () const |
void | GotoError () |
void | ProcessNewline (bool keepCursorAtStartOfLine=true) |
Start a new line and optionally auto-indent it. | |
int | GetCaretPosition () const |
Get the cursor's current position inside the cell. | |
void | ConvertNumToUNicodeChar () |
Convert a number to unicode chars. | |
void | SetCaretPosition (int pos) |
Set the cursor's current position inside the cell. | |
bool | FindNextTemplate (bool left=false) |
void | InsertText (wxString text) |
wxString | TextInFrontOfSelection () const |
void | ReturnToSelectionFromTop () |
Return to the selection after the cell has been left upwards. | |
void | SetType (CellType type) override |
Sets the text style according to the type. | |
void | SetStyle (TextStyle style) override |
Sets the TextStyle of this cell. | |
bool | NeedsRecalculation (AFontSize fontSize) const override |
True, if something that affects the cell size has changed. | |
void | ReturnToSelectionFromBot () |
Return to the selection after the cell has been left downwards. | |
const MaximaTokenizer::TokenList & | GetTokens () const |
Get the list of commands, parenthesis, strings and whitespaces in a code cell. | |
![]() | |
Cell (GroupCell *group, Configuration **config) | |
int | Scale_Px (double px) const |
AFontSize | Scale_Px (AFontSize size) const |
virtual const wxString & | GetToolTip (wxPoint point) const |
virtual | ~Cell () |
Delete this list of cells. | |
int | CellsInListRecursive () const |
How many cells does this cell contain? More... | |
wxRect | CropToUpdateRegion (wxRect rect) const |
The part of the rectangle rect that is in the region that is currently drawn. | |
bool | InUpdateRegion () const |
Is this cell inside the region that is currently drawn? | |
bool | SoftLineBreak (bool breakLine=true) |
Do we want this cell to start with a linebreak? | |
bool | BreakLineHere () const |
Are we allowed to break a line here? | |
bool | HasHardLineBreak () const |
Does this cell begin with a manual linebreak? | |
virtual bool | BreakUp () |
bool | ContainsRect (const wxRect &sm, bool all=true) const |
bool | ContainsPoint (wxPoint point) const |
virtual void | ClearCache () |
void | ClearCacheList () |
void | SetConfigurationList (Configuration **config) |
virtual void | SetConfiguration (Configuration **config) |
Configuration * | GetConfiguration () |
void | Draw () |
void | DrawList (wxPoint point) |
void | DrawList () |
virtual void | DrawBoundingBox (wxDC &WXUNUSED(dc), bool all=false) |
bool | DrawThisCell (wxPoint point) |
bool | DrawThisCell () |
void | ForceBreakLine (bool force=true) |
int | GetHeight () const |
int | GetWidth () const |
int | GetCenter () const |
bool | HasValidSize () const |
Is the size valid and not pending a recalculation? | |
bool | HasStaleSize () const |
Is the size valid, whether a recalculation is pending or not? | |
bool | HasValidPosition () const |
Is the position valid? | |
int | GetDrop () const |
CellType | GetType () const |
int | GetMaxDrop () const |
int | GetCenterList () const |
int | GetHeightList () const |
int | GetFullWidth () const |
How many pixels is this list of cells wide, if we don't break it into lines? | |
int | GetLineWidth () const |
int | GetCurrentX () const |
int | GetCurrentY () const |
virtual wxRect | GetRect (bool all=false) const |
virtual wxString | GetDiffPart () const |
void | RecalculateList (AFontSize fontsize) |
void | FontsChangedList () |
Tell a whole list of cells that their fonts have changed. | |
void | ClearNeedsToRecalculateWidths () |
void | ResetData () |
Mark all cached size information as "to be calculated". More... | |
void | ResetDataList () |
void | ResetSize () |
Mark the cached height and width information as "to be calculated". | |
void | ResetCellListSizes () |
Mark the line and cell list widths and heights as "to be calculated". | |
void | ResetCellListSizesList () |
Mark the line and cell list widths and heights as "to be calculated". | |
void | SetZeroSize () |
void | ResetSizeList () |
Mark the cached height information of the whole list of cells as "to be calculated". | |
void | SetBigSkip (bool skip) |
bool | HasBigSkip () const |
TextStyle | GetStyle () const |
void | SetPen (double lineWidth=1.0) const |
Sets the drawing pen to the cell's default foreground color. | |
void | SetBrush () const |
Sets the fill brush to the cell's default foreground color. | |
wxColour | GetForegroundColor () const |
void | SetHighlight (bool highlight) |
Mark this cell as highlighted (e.G. being in a maxima box) | |
bool | GetHighlight () const |
Is this cell highlighted (e.G. inside a maxima box) | |
virtual void | SetExponentFlag () |
virtual void | SetValue (const wxString &WXUNUSED(text)) |
Cell * | first () const |
Get the first cell in this list of cells. | |
Cell * | last () const |
Get the last cell in this list of cells. | |
Range | GetCellsInRect (const wxRect &rect) const |
Range | GetListCellsInRect (const wxRect &rect) const |
virtual Range | GetInnerCellsInRect (const wxRect &rect) const |
Select the cells inside this cell described by the rectangle rect. | |
virtual bool | IsOperator () const |
Is this cell an operator? | |
bool | IsCompound () const |
Do we have an operator in this line - draw () in frac... | |
virtual bool | IsShortNum () const |
GroupCell * | GetGroup () const |
Returns the group cell this cell belongs to. | |
virtual wxString | ListToString () const |
Returns the list's representation as a string. | |
wxString | VariablesAndFunctionsList () const |
virtual wxString | ListToMatlab () const |
Convert this list to its LaTeX representation. | |
virtual wxString | ListToTeX () const |
Convert this list to its LaTeX representation. | |
virtual wxString | ListToXML () const |
Convert this list to a representation fit for saving in a .wxmx file. | |
virtual wxString | ListToMathML (bool startofline=false) const |
Convert this list to a MathML representation. | |
virtual wxString | ListToOMML (bool startofline=false) const |
Convert this list to an OMML representation. | |
virtual wxString | ListToRTF (bool startofline=false) const |
Convert this list to an RTF representation. | |
virtual wxString | ToOMML () const |
virtual wxString | ToMathML () const |
Convert this cell to a representation fit for saving in a .wxmx file. | |
virtual void | Unbreak () |
virtual void | UnbreakList () |
Cell * | GetPrevious () const |
Cell * | GetNext () const |
Get the next cell in the list. | |
Cell * | GetNextToDraw () const |
virtual void | SetNextToDraw (Cell *next) |
template<typename T , typename Del , typename std::enable_if< std::is_base_of< Cell, T >::value, bool >::type = true> | |
void | SetNextToDraw (const std::unique_ptr< T, Del > &ptr) |
bool | IsComment () const |
bool | IsHidden () const |
virtual void | Hide (bool hide=true) |
bool | IsEditable (bool input=false) const |
virtual bool | CanPopOut () const |
Can this cell be popped out interactively in gnuplot? | |
virtual wxString | GnuplotSource () const |
virtual void | ProcessEvent (wxKeyEvent &WXUNUSED(event)) |
Processes a key event. | |
virtual wxPoint | PositionToPoint (int WXUNUSED(pos)=-1) |
virtual void | SetFocus (bool WXUNUSED(focus)) |
void | SetForeground () |
Sets the foreground color. | |
bool | IsMath () const |
Is this cell possibly output of maxima? | |
virtual int | GetImageBorderWidth () const |
0 for ordinary cells, 1 for slide shows and diagrams displayed with a 1-pixel border | |
void | CopyCommonData (const Cell &cell) |
Copy common data (used when copying a cell) | |
std::unique_ptr< Cell > | CopyList (GroupCell *group) const |
Return a copy of the list of cells beginning with this one. | |
void | ClearToolTip () |
Remove this cell's tooltip. | |
void | SetToolTip (wxString &&toolTip) |
Set the tooltip to a given temporary string - the cell will move from it. | |
void | SetToolTip (const wxString *tooltip) |
void | AddToolTip (const wxString &tip) |
Add another tooltip to this cell. | |
virtual void | SetCurrentPoint (wxPoint point) |
Tells this cell where it is placed on the worksheet. | |
void | SetCurrentPoint (int x, int y) |
Tells this cell where it is placed on the worksheet. | |
wxPoint | GetCurrentPoint () const |
Where is this cell placed on the worksheet? | |
bool | IsBrokenIntoLines () const |
bool | GetSuppressMultiplicationDot () const |
void | SetSuppressMultiplicationDot (bool val) |
bool | GetHidableMultSign () const |
Whether this is a hidable multiplication sign. | |
void | SetHidableMultSign (bool val) |
virtual void | SetAltCopyText (const wxString &text) |
virtual const wxString & | GetAltCopyText () const |
Get the text set using SetAltCopyText - may be empty. | |
const wxString & | GetLocalToolTip () const |
![]() | |
bool | IsNull () const |
bool | HasControlBlock () const |
bool | HasOneCellPtr () const |
Static Public Member Functions | |
static wxString | TabExpand (const wxString &input, long posInLine) |
static wxString | EscapeHTMLChars (wxString input) |
Escape all chars that cannot be used in HTML otherwise. | |
static wxString | PrependNBSP (wxString input) |
Convert all but the first of a row of multiple spaces to non-breakable. | |
![]() | |
static wxString | OMML2RTF (wxXmlNode *node) |
Converts an OMML tag to the corresponding RTF snippet. | |
static wxString | OMML2RTF (wxString ommltext) |
Converts OMML math to RTF math. | |
static wxString | RTFescape (wxString, bool MarkDown=false) |
Escape a string for RTF. | |
static wxString | XMLescape (wxString) |
Escape a string for XML. | |
static std::unique_ptr< Cell > | CopyList (GroupCell *group, const Cell *cell) |
Return a copy of the given list of cells. | |
static std::unique_ptr< Cell > | MakeVisiblyInvalidCell (GroupCell *group, Configuration **config) |
![]() | |
static size_t | GetLiveInstanceCount () |
static size_t | GetLiveControlBlockInstanceCount () |
Additional Inherited Members | |
![]() | |
void | BreakUpAndMark () |
Break up the internal cells of this cell, and mark it as broken up. | |
std::unique_ptr< Cell > | MakeVisiblyInvalidCell () const |
virtual int | GetInnerCellCount () const |
The number of inner cells - for use by the iterators. | |
virtual Cell * | GetInnerCell (int index) const |
Worksheet * | GetWorksheet () const |
CellPointers * | GetCellPointers () const |
void | InvalidateMaxDrop () |
![]() | |
wxPoint | m_currentPoint {-1, -1} |
CellPtr< GroupCell > | m_group |
CellPtr< Cell > | m_nextToDraw |
Configuration ** | m_configuration |
const wxString * | m_toolTip |
int | m_height = -1 |
The height of this cell. | |
int | m_width = -1 |
The width of this cell; is recalculated by RecalculateHeight. | |
int | m_center = -1 |
AFontSize | m_fontSize_Scaled = {} |
The font size is smaller in super- and subscripts. | |
CellType | m_type = MC_TYPE_DEFAULT |
TextStyle | m_textStyle = TS_DEFAULT |
This class defines what the user sees as input cell
This class handles input cells including:
Since Unicode doesn't provide us with a "soft linebreak" letter we use \r
as a marker that this line has to be broken here if we don't want it to extend beyond the right margin of the screen.
In a few places we use wxString::const_iterator instead of accessing individual letters within the string using the [] operator. This might look overly complicated. But in UTF-8 all non-standard-ASCII-characters use more than one byte making iterating over every single char of the string the only way of determining which address char n is at. An iterator is the only way of not having to determine the address of every single char independently.
void EditorCell::ActivateCursor | ( | ) |
Activate the blinking cursor in this cell
Automatically calls DeactivateCursor on an eventual cell the cursor currently is in. Normally Mathctrl::SetActiveCell() is used in order to get this function called.
wxString EditorCell::DivideAtCaret | ( | ) |
DivideAtCaret Returns the string from caret to end and modifies the m_text so it contains only the string from beginning to caret Used for 'Divide Cell', called from MathCtrl
|
overridevirtual |
Draw this cell
point | The x and y position this cell is drawn at: All top-level cells get their position during recalculation. But for the cells within them the position needs a second step after determining the dimension of the contents of the top-level cell. |
Example: The position of the denominator of a fraction can only be determined after the height of denominator and numerator are known.
Draw this cell to dc
To make this work each derived class must draw the content of the cell and then call MathCall::Draw(...).
Reimplemented from Cell.
bool EditorCell::FindMatchingQuotes | ( | ) |
For a given quotation mark ("), find a matching quote. Since there are no nested quotes, an odd-numbered, non-escaped quote is an opening quote, and an even-numbered non-escaped quote is a closing quote.
bool EditorCell::FindNext | ( | wxString | str, |
const bool & | down, | ||
const bool & | ignoreCase | ||
) |
Finds the next occurrences of a string
str | The string to search for |
down |
|
ignoreCase |
|
|
inlineoverridevirtual |
Returns the text contained in this cell
Naturally all soft line breaks are converted back to spaces beforehand.
Reimplemented from Cell.
|
overridevirtual |
Recalculate the size of the cell and the difference between top and center
Must set: m_height, m_width, m_center.
fontsize | In exponents, super- and subscripts the font size is reduced. This cell therefore needs to know which font size it has to be drawn at. |
Reimplemented from Cell.
int EditorCell::ReplaceAll | ( | wxString | oldString, |
const wxString & | newString, | ||
bool | ignoreCase | ||
) |
Replaces all occurrences of a given string
bool EditorCell::ReplaceSelection | ( | const wxString & | oldStr, |
const wxString & | newString, | ||
bool | keepSelected = false , |
||
bool | ignoreCase = false , |
||
bool | replaceMaximaString = false |
||
) |
Replace the current selection with a string
oldStr | The old string in the selection. If this string doesn't match the selection this function doesn't replace it. |
newString | The new string oldStr has to be replaced by |
keepSelected |
|
ignoreCase | true = ignore the case of the string to replace |
replaceMaximaString | true = replace strings including the double quotes. |
void EditorCell::SearchStartedHere | ( | int | index | ) | const |
Remember that this is the cell the search was started in.
index | The index of the character the search was started at. |
|
override |
Sets the text that is to be displayed.
Automatically calls StyleText().
void EditorCell::StyleText | ( | ) |
Converts m_text to a list of styled text snippets that will later be displayed by draw().
This function also generates a wordlist for this EditorCell so Autocompletion can learn about variable names contained in lists or cells that still haven't been evaluated.
For cells containing text instead of code this function adds a \r
as a marker that this line is to be broken here until the window's width changes.
void EditorCell::StyleTextCode | ( | ) |
Is Called by StyleText() if this is a code cell
|
static |
Expand all tabulators.
input | The string the tabulators should be expanded in |
posInLine | The number of characters that come before the input in the same line |
wxString EditorCell::ToMatlab | ( | bool | dontLimitToSelection | ) | const |
Convert the current cell to Matlab code.
Convert the current cell to a string
dontLimitToSelection |
|