wxMaxima
Loading...
Searching...
No Matches
EditorCell.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) 2006-2015 Andrej Vodopivec <andrej.vodopivec@gmail.com>
4// (C) 2012 Doug Ilijev <doug.ilijev@gmail.com>
5// (C) 2014-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
24#ifndef EDITORCELL_H
25#define EDITORCELL_H
26
27#include "Cell.h"
28#include "FontAttribs.h"
29#include "MaximaTokenizer.h"
30#include <vector>
31#include <list>
32#include <unordered_map>
33
58class EditorCell final : public Cell
59{
60private:
61#if wxUSE_ACCESSIBILITY
62 wxAccStatus GetName (int childId, wxString *name) const override;
63 wxAccStatus GetDescription(int childId, wxString *description) const override;
64 wxAccStatus GetFocus (int *childId, Cell **child) const override;
65 wxAccStatus GetDefaultAction(int childId, wxString *actionName) const override;
66 wxAccStatus GetValue (int childId, wxString *strValue) const override;
67 wxAccStatus GetRole (int childId, wxAccRole *role) const override;
68 wxAccStatus GetState (int childId, long *state) const override;
69#endif
70
71public:
73 EditorCell(GroupCell *group, Configuration *config, wxString text = {});
74 EditorCell(GroupCell *group, const EditorCell &cell);
75 void UpdateSelectionString();
76 void SetSelection(size_t start, size_t end){m_selectionStart = start; m_selectionEnd = end; UpdateSelectionString();}
77 bool SelectionActive() const {return m_selectionStart != m_selectionEnd;}
78 void ClearSelection() {SelectionEnd(SelectionEnd());}
79 void SelectionStart(size_t start) {m_selectionStart = start; UpdateSelectionString();}
80 void SelectionEnd(size_t end) {m_selectionEnd = end; UpdateSelectionString();}
81 size_t SelectionStart() const {return std::min(m_selectionStart, m_text.Length());}
82 size_t SelectionEnd() const {return std::min(m_selectionEnd, m_text.Length());}
83 size_t SelectionLeft() const {return std::min(SelectionStart(), SelectionEnd());}
84 size_t SelectionRight() const {return std::max(SelectionStart(), SelectionEnd());}
85 size_t SelectionLength() const {return(SelectionEnd()-SelectionStart());}
86 void SelectionLength(size_t length) {SelectionEnd(SelectionStart() + length); UpdateSelectionString();}
87 void CursorMove(long long increment) {m_selectionEnd += increment;
88 m_selectionStart = m_selectionEnd; UpdateSelectionString();}
89 size_t CursorPosition() const {return std::min(m_selectionEnd, m_text.Length());}
90 void CursorPosition(size_t pos) {m_selectionStart = pos;
91 m_selectionEnd = pos; UpdateSelectionString();}
92 const CellTypeInfo &GetInfo() override;
93 std::unique_ptr<Cell> Copy(GroupCell *group) const override;
94
96 // cppcheck-suppress duplInheritedMember
97 EditorCell *GetPrevious() const { return dynamic_cast<EditorCell*>(Cell::GetPrevious()); }
99 // cppcheck-suppress duplInheritedMember
100 EditorCell *GetNext() const { return dynamic_cast<EditorCell*>(Cell::GetNext()); }
101
103 void InsertEscCommand(const wxString &txt) {
104 InsertText(InterpretEscapeString(txt));
105 }
106
108 wxString GetFullCommandUnderCursor();
109
111 void AddDrawParameter(wxString param);
112
114 void AutoAnswer(bool autoAnswer){m_autoAnswer = autoAnswer;}
115
120 void SearchStartedHere(size_t index) const;
122 void SearchStartedHere() const;
124 void MouseSelectionStartedHere() const;
126 void KeyboardSelectionStartedHere() const;
127
129 const auto &GetWordList() const { return m_wordList; }
130
137 static wxString TabExpand(const wxString &input_, size_t posInLine);
138
140 static wxString EscapeHTMLChars(wxString input);
141
143 static wxString PrependNBSP(wxString input);
144
145 void Recalculate(const AFontSize fontsize) const override;
146
148 void SetCurrentPoint(wxPoint point) const override;
149 virtual void Draw(wxDC *dc, wxDC *antialiassingDC) override;
150
152 wxString ToHTML() const;
153 wxString ToMatlab() const override;
161 wxString ToMatlab(bool dontLimitToSelection) const;
163 wxString ToRTF() const override;
164 wxString ToString() const override;
165 wxString ToString(bool dontLimitToSelection) const;
167 wxString ToTeX() const override;
169 wxString ToXML() const override;
170
172 const wxFont &GetFont() const {
174 }
176 void SetFont(wxDC *dc) const;
177
179 void SetForeground(wxDC *dc);
180
185 void SetValue(const wxString &text) override;
186
191 const wxString &GetValue() const override { return m_text; }
192
201 void StyleText() const;
203 void StyleTextCode() const;
204 void StyleTextTexts() const;
205
206 void Reset();
207
209 void ProcessEvent(wxKeyEvent &event) override;
210
218 bool ActivateCursor();
219
221 void DeactivateCursor();
222
224 size_t BeginningOfLine(size_t pos) const;
225
227 size_t EndOfLine(size_t pos);
228
230 bool AddEnding() override;
231
233 void PositionToXY(size_t position, size_t *x, size_t *y);
234
236 size_t XYToPosition(size_t x, size_t y);
237
239 wxPoint PositionToPoint(size_t pos) override;
240 wxPoint PositionToPoint() override {return PositionToPoint(CursorPosition());}
241
243 void SelectPointText(wxPoint point) override;
244
246 void SelectRectText(wxPoint one, wxPoint two) override;
247
249 wxString SelectWordUnderCaret(bool selectParens = true, bool toRight = true,
250 bool includeDoubleQuotes = false);
251
253 bool IsPointInSelection(wxPoint point);
254
255 bool CopyToClipboard() const override;
256
257 bool CutToClipboard() override;
258
259 void PasteFromClipboard(bool primary = false) override;
260
262 size_t GetSelectionStart() const
263 { return SelectionStart(); }
264
266 long GetSelectionEnd() const
267 { return SelectionEnd(); }
268
270 void SelectAll() override
271 {
272 SetSelection(0, m_text.Length());
273 }
274
276 bool AllSelected() const
277 {
278 return (SelectionStart() == 0) && (SelectionEnd() == m_text.Length());
279 }
280
283 {
284 ClearSelection();
285 }
286
287
288 bool CanCopy() const override
289 {
290 return SelectionActive();
291 }
292
293 bool FindMatchingQuotes();
294
295 void FindMatchingParens();
296
297 wxCoord GetLineWidth(size_t line, size_t pos);
298
301 bool IsDirty() const override
302 {
303 return m_isDirty;
304 }
305
307 void SwitchCaretDisplay() override
308 {
309 m_displayCaret = !m_displayCaret;
310 }
311
312 void SetFocus(bool focus) override
313 {
314 m_hasFocus = focus;
315 }
316
317 bool IsActive() const override;
318
320 bool CaretAtStart() const
321 { return CursorPosition() == 0; }
322
324 void CaretToStart();
325
327 bool CaretAtEnd() const
328 { return CursorPosition() == m_text.Length(); }
329
331 void CaretToEnd();
332
334 void CaretToPosition(size_t pos);
335
337 bool CanUndo() const {return m_history.CanUndo();}
338
340 void Undo();
341
343 bool CanRedo() const {return m_history.CanRedo();}
344
346 void Redo();
347
350 {
351 public:
352 enum Action : uintptr_t {
353 any = 0,
354 removeChar = 1,
355 addChar = 2
356 };
357
359 class HistoryEntry // 64 bytes
360 {
361 public:
362 HistoryEntry(){};
363 HistoryEntry(const wxString &text, long long selStart, long long selEnd) :
364 m_text(text), m_selStart(selStart), m_selEnd(selEnd) {}
365 long long SelectionStart() const {return m_selStart;}
366 long long SelectionEnd() const {return m_selEnd;}
367 wxString GetText() const {return m_text;}
368 private:
369 wxString m_text;
370 long long m_selStart = -1;
371 long long m_selEnd = -1;
372 };
373 bool AddState(HistoryEntry entry, Action action = any);
374 bool AddState(const wxString &text, long long selStart, long long selEnd, Action action = any);
375 bool Undo();
376 bool Redo();
377 bool CanUndo() const;
378 bool CanRedo() const;
379 void ClearUndoBuffer();
380 HistoryEntry GetState() const;
381 private:
382 std::vector<HistoryEntry> m_history;
384 size_t m_historyPosition = 0;
385 Action m_lastAction = any;
386 };
387
389 void SaveValue(History::Action action = History::Action::any);
390
397 wxString DivideAtCaret();
398
399 void CommentSelection();
400
402 bool ContainsChanges() const
403 { return m_containsChanges; }
404
406 void ContainsChanges(bool changes)
407 { m_containsChanges = m_containsChangesCheck = changes; }
408
409 bool CheckChanges();
410
413 size_t ReplaceAll(wxString oldString, const wxString &newString, bool ignoreCase);
414 size_t ReplaceAll_RegEx(const wxString &oldString, const wxString &newString);
415
426 bool FindNext(wxString str, const bool &down, const bool &ignoreCase);
427 bool FindNext_RegEx(wxString str, const bool &down);
428
429 bool IsSelectionChanged() const { return m_selectionChanged; }
430
431 void GetSelection(size_t *start, size_t *end) const
432 {
433 *start = SelectionStart();
434 *end = SelectionEnd();
435 }
436
449 bool ReplaceSelection(const wxString &oldStr, const wxString &newString,
450 bool keepSelected = false, bool ignoreCase = false,
451 bool replaceMaximaString = false);
452 bool ReplaceSelection_RegEx(const wxString &oldStr, const wxString &newString);
453
455 wxString GetSelectionString() const;
456
459
461 wxString GetWordUnderCaret();
462
464 wxString GetCurrentCommand() const;
465
467 void SetErrorIndex(size_t index){m_errorIndex = index; m_errorIndexSet = true;}
469 void ClearErrorIndex(){m_errorIndexSet = false;}
470
471 bool ErrorIndexSet() const {return m_errorIndexSet;}
472
473 void GotoError(){SetCaretPosition(m_errorIndex); ActivateCursor(); ClearErrorIndex();}
474
476 void ProcessNewline(bool keepCursorAtStartOfLine = true);
477
479 size_t GetCaretPosition() const
480 { return CursorPosition(); }
481
484
486 void SetCaretPosition(size_t pos){CursorPosition(pos);}
487
488 bool FindNextTemplate(bool left = false);
489
490 void InsertText(wxString text);
491
492 wxString TextInFrontOfSelection() const
493 {
494 return GetValue().Left(SelectionLeft());
495 }
496
499 {
500 SetSelection(m_lastSelectionStart, 0);
501 }
502
503 void SetType(CellType type) override;
504 void SetStyle(TextStyle style) override;
505
506 bool NeedsRecalculation(AFontSize fontSize) const override;
507
510 {
511 SetSelection(m_lastSelectionStart, m_text.Length());
512 }
513
515// const MaximaTokenizer::TokenList &GetDisplayedTokens() const;
517 const MaximaTokenizer::TokenList &GetAllTokens() const;
518
519private:
520 size_t m_selectionStart = 0;
521 size_t m_selectionEnd = 0;
522 size_t m_lastSelectionStart = 0;
533 class StyledText
534 {
535 private:
538 wxString m_text;
540 TextStyle m_style = TS_CODE_DEFAULT;
542 wxString m_indentChar;
544 mutable CachedInteger<wxCoord> m_width;
546 wxCoord m_indentPixels = 0;
548 bool m_styleThisText = false;
549 public:
551 StyledText(TextStyle style, const wxString &text)
552 : m_text(text), m_style(style), m_styleThisText(true) {}
553
555 explicit StyledText(const wxString &text, TextStyle style, wxCoord indentPixels = 0,
556 const wxString &indentChar = {})
557 : m_text(text), m_style(style), m_indentChar(indentChar), m_indentPixels(indentPixels) {}
558
559 void SetWidth(wxCoord width){m_width = width;}
560 void ResetSize(){m_width.Invalidate();}
561 wxCoord GetWidth() const {return m_width;}
562 bool SizeKnown() const {return m_width.IsValid();}
564 const wxString &GetText() const { return m_text; }
566 void SetText(const wxString &text) { m_text = text; }
568 void SetIndentation(wxCoord indentPixels, const wxString &indentString = {})
569 {
570 m_indentPixels = indentPixels;
571 m_indentChar = indentString;
572 }
574 wxCoord GetIndentPixels() const { return m_indentPixels; }
575 const wxString &GetIndentChar() const { return m_indentChar; }
578 TextStyle GetTextStyle() const { return m_style; }
579 // Has an individual text style been set for this text portion?
580 bool IsStyleSet() const { return m_styleThisText; }
581 };
582
583#if defined __WXOSX__
584 bool HandleCtrlCommand(wxKeyEvent &ev);
585#endif
586 bool HandleSpecialKey(wxKeyEvent &event);
587 bool HandleOrdinaryKey(wxKeyEvent &event);
588
589 void FontsChanged() const override
590 {
591 m_widths.clear();
592 }
593
600 void HandleSoftLineBreaks_Code(StyledText *&lastSpace, wxCoord &lineWidth, const wxString &token, size_t charInCell,
601 wxString &text, const size_t &lastSpacePos, wxCoord &indentationPixels) const;
602
608 size_t GetIndentDepth(wxString text, size_t positionOfCaret) const;
609
616 static wxString InterpretEscapeString(const wxString &txt);
617
619 void MarkSelection(wxDC *dc, size_t start, size_t end, TextStyle style);
620
622 wxSize GetTextSize(const wxString &text) const;
623
625 History m_history;
627 void SetState(const History::HistoryEntry &state);
629 std::vector<StyledText> &GetStyledText();
630
631//** Large fields
632//**
633 typedef std::unordered_map <wxString, wxSize, wxStringHash> StringHash;
635 mutable StringHash m_widths;
636
638 mutable std::vector<wxString> m_wordList;
639
641 mutable MaximaTokenizer::TokenList m_tokens;
643 mutable MaximaTokenizer::TokenList m_tokens_including_hidden;
644
647 mutable wxString m_text;
648 mutable std::vector<StyledText> m_styledText;
649
650//** 8/4 bytes
651//**
652 CellPointers *const m_cellPointers = GetCellPointers();
653
654//** 4 bytes
655//**
656 size_t m_errorIndex = 1;
657 mutable size_t m_numberOfLines = 1;
658 mutable wxCoord m_charHeight = 12;
659 long m_paren1 = -1, m_paren2 = -1;
660
661//** 2 bytes
662//**
663 AFontStyle m_fontStyle;
664 AFontWeight m_fontWeight;
665
666
668 mutable bool m_tokens_including_hidden_valid = false;
670 mutable bool m_tokens_valid = false;
671
672
673//** Bitfield objects (2 bytes)
674//**
675 void InitBitFields_EditorCell()
676 { // Keep the initialization order below same as the order
677 // of bit fields in this class!
678 m_autoAnswer = false;
679 m_containsChanges = false;
680 m_containsChangesCheck = false;
681 m_displayCaret = false;
682 m_hasFocus = false;
683 m_selectionChanged = false;
684 m_underlined = false;
685 m_errorIndexSet = false;
686 }
687
689 bool m_autoAnswer : 1 /* InitBitFields_EditorCell */;
691 mutable bool m_containsChanges : 1 /* InitBitFields_EditorCell */;
692 bool m_containsChangesCheck : 1 /* InitBitFields_EditorCell */;
693 bool m_displayCaret : 1 /* InitBitFields_EditorCell */;
694 bool m_hasFocus : 1 /* InitBitFields_EditorCell */;
695 bool m_errorIndexSet : 1 /* InitBitFields_EditorCell */;
697 bool m_selectionChanged : 1 /* InitBitFields_EditorCell */;
699 bool m_underlined : 1 /* InitBitFields_EditorCell */;
700 mutable bool m_isDirty = true /* InitBitFields_EditorCell */;
701};
702
703#endif // EDITORCELL_H
The definition of the base class of all cells the worksheet consists of.
CellType
The supported types of math cells.
Definition: Cell.h:64
This file declares the class Maximatokenizer.
TextStyle
All text styles known to wxMaxima.
Definition: TextStyle.h:231
A Type-Safe Fixed-Point Font Size.
Definition: FontAttribs.h:97
A cached integer value.
Definition: CachedValue.h:45
The storage for pointers to cells.
Definition: CellPointers.h:45
A class that carries information about the type of a cell.
Definition: Cell.h:93
The base class all cell types the worksheet can consist of are derived from.
Definition: Cell.h:142
Cell * GetNext() const
Get the next cell in the list.
Definition: Cell.h:738
Cell * GetPrevious() const
Returns a pointer to the previous cell in the current cell list.
Definition: Cell.h:735
wxCoord GetLineWidth() const
How many pixels is the current line of this list of cells wide?
Definition: Cell.cpp:397
Configuration * m_configuration
A pointer to the configuration responsible for this worksheet.
Definition: Cell.h:1066
virtual void SetCurrentPoint(wxPoint point) const
Pass 2: Arrangement.
Definition: Cell.cpp:493
AFontSize m_fontSize_Scaled
The font size is smaller in super- and subscripts.
Definition: Cell.h:1109
bool NeedsRecalculation() const
True, if something that affects the cell size has changed.
Definition: Cell.h:513
const TextStyle & GetTextStyle() const
Get the text style.
Definition: Cell.h:566
The configuration storage for the current worksheet.
Definition: Configuration.h:87
const Style * GetStyle(TextStyle textStyle) const
Get the text Style for a given text style identifier.
Definition: Configuration.h:934
How an entry to the undo history looks like.
Definition: EditorCell.h:360
The undo history of this cell.
Definition: EditorCell.h:350
This class defines what the user sees as input cell.
Definition: EditorCell.h:59
const MaximaTokenizer::TokenList & GetAllTokens() const
Get the list of commands, parenthesis, strings and whitespaces in a code cell.
Definition: EditorCell.cpp:3292
void SetValue(const wxString &text) override
Sets the text that is to be displayed.
Definition: EditorCell.cpp:3338
void SetCurrentPoint(wxPoint point) const override
Pass 2: Arrangement.
Definition: EditorCell.cpp:766
size_t ReplaceAll(wxString oldString, const wxString &newString, bool ignoreCase)
Replaces all occurrences of a given string.
Definition: EditorCell.cpp:3393
const wxFont & GetFont() const
Get the font that matches this cell's formatting.
Definition: EditorCell.h:172
void CaretToStart()
Move the cursor to the start of this cell.
Definition: EditorCell.cpp:3826
bool IsActive() const override
Is this editor cell focused?
Definition: EditorCell.cpp:2889
size_t XYToPosition(size_t x, size_t y)
Determines which index the char at the position "x chars left, y chars down" is at.
Definition: EditorCell.cpp:2307
std::unique_ptr< Cell > Copy(GroupCell *group) const override
Create a copy of this cell.
size_t GetSelectionStart() const
Get the character position the selection has been started with.
Definition: EditorCell.h:262
void ContainsChanges(bool changes)
Set the information if this cell needs to be re-evaluated by maxima.
Definition: EditorCell.h:406
wxString ToXML() const override
Convert the current cell to XML code for inclusion in a .wxmx file.
Definition: EditorCell.cpp:492
void DeactivateCursor()
Deactivate the blinking cursor in the EditorCell it is in.
Definition: EditorCell.cpp:2191
void StyleTextCode() const
Is Called by StyleText() if this is a code cell.
Definition: EditorCell.cpp:2954
void CaretToEnd()
Move the cursor to the end of this cell.
Definition: EditorCell.cpp:3820
size_t GetCaretPosition() const
Get the cursor's current position inside the cell.
Definition: EditorCell.h:479
bool CopyToClipboard() const override
Copy this cell's editable contents to the clipboard.
Definition: EditorCell.cpp:2648
wxString ToRTF() const override
Convert the current cell to RTF code.
Definition: EditorCell.cpp:304
void ClearErrorIndex()
Clears the index the error is at.
Definition: EditorCell.h:469
wxString DivideAtCaret()
DivideAtCaret Returns the string from caret to end and modifies the m_text so it contains only the st...
Definition: EditorCell.cpp:2514
wxString ToString() const override
Returns the cell's representation as a string.
Definition: EditorCell.cpp:252
size_t BeginningOfLine(size_t pos) const
Return the index of the 1st char of the line containing the letter pos.
Definition: EditorCell.cpp:1080
wxString GetCurrentCommand() const
Get the command the cursor is in the arguments for.
Definition: EditorCell.cpp:981
bool IsDirty() const override
true, if this cell's width has to be recalculated.
Definition: EditorCell.h:301
void ProcessEvent(wxKeyEvent &event) override
Decide what to do if the user pressed a key when this cell was selected.
Definition: EditorCell.cpp:1163
bool CanRedo() const
True, if a redo can be done for this cell.
Definition: EditorCell.h:343
wxString GetSelectionString() const
Convert the current selection to a string.
Definition: EditorCell.cpp:3730
static wxString TabExpand(const wxString &input_, size_t posInLine)
Expand all tabulators.
Definition: EditorCell.cpp:1046
long GetSelectionEnd() const
Get the character position the selection has been ended with.
Definition: EditorCell.h:266
void Redo()
Issu a redo command.
Definition: EditorCell.cpp:2908
void SetCaretPosition(size_t pos)
Set the cursor's current position inside the cell.
Definition: EditorCell.h:486
size_t EndOfLine(size_t pos)
Return the index of the last char of the line containing the letter #pos,.
Definition: EditorCell.cpp:1096
void SearchStartedHere() const
Remember that this is the cell the search was started in.
Definition: EditorCell.cpp:173
bool CaretAtStart() const
Is the cursor at the start of this cell?
Definition: EditorCell.h:320
void KeyboardSelectionStartedHere() const
Remember that this is the cell the keyboard selection was started in.
Definition: EditorCell.cpp:183
bool ReplaceSelection(const wxString &oldStr, const wxString &newString, bool keepSelected=false, bool ignoreCase=false, bool replaceMaximaString=false)
Replace the current selection with a string.
Definition: EditorCell.cpp:3636
void SwitchCaretDisplay() override
Toggles the visibility of the cursor which is used to make it blink.
Definition: EditorCell.h:307
wxString SelectWordUnderCaret(bool selectParens=true, bool toRight=true, bool includeDoubleQuotes=false)
Selects the word the cursor is currently at.
Definition: EditorCell.cpp:2614
wxString ToTeX() const override
Convert the current cell to LaTeX code.
Definition: EditorCell.cpp:361
const wxString & GetValue() const override
Returns the text contained in this cell.
Definition: EditorCell.h:191
void SelectAll() override
Select the whole text contained in this Cell.
Definition: EditorCell.h:270
void ReturnToSelectionFromBot()
Return to the selection after the cell has been left downwards.
Definition: EditorCell.h:509
bool CanCopy() const override
Select Can we copy the editable text of this cell?
Definition: EditorCell.h:288
void SelectNone()
Unselect everything.
Definition: EditorCell.h:282
bool FindMatchingQuotes()
For a given quotation mark ("), find a matching quote.
Definition: EditorCell.cpp:2087
void AddDrawParameter(wxString param)
Add a new parameter to a draw- or similar command including the comma, if needed.
Definition: EditorCell.cpp:90
void AutoAnswer(bool autoAnswer)
May this Editor Cell contain the answer to a question?
Definition: EditorCell.h:114
void StyleText() const
Converts m_text to a list of styled text snippets that will later be displayed by draw().
Definition: EditorCell.cpp:3311
wxString GetWordUnderCaret()
The word the cursor currently is at.
Definition: EditorCell.cpp:2575
const CellTypeInfo & GetInfo() override
Returns the information about this cell's type.
wxString GetFullCommandUnderCursor()
Get the whole maxima command that is currently under the cursor (including all arguments)
Definition: EditorCell.cpp:188
wxPoint PositionToPoint() override
Locates the cursor in the editable text of this cell.
Definition: EditorCell.h:240
void SelectRectText(wxPoint one, wxPoint two) override
Selects the text between the screen coordinates one and two.
Definition: EditorCell.cpp:2452
void SetErrorIndex(size_t index)
Sets the index the error is at.
Definition: EditorCell.h:467
bool AllSelected() const
Does the selection currently span the whole cell?
Definition: EditorCell.h:276
TextStyle GetSelectionStyle() const
Try to determine the selection's text style.
Definition: EditorCell.cpp:3734
void SaveValue(History::Action action=History::Action::any)
Save the current contents of this cell in the undo buffer.
Definition: EditorCell.cpp:2914
void PositionToXY(size_t position, size_t *x, size_t *y)
Determines which line and column the pos'th char is at.
Definition: EditorCell.cpp:2287
bool IsPointInSelection(wxPoint point)
Is the point point inside the currently selected text?
Definition: EditorCell.cpp:2463
void PasteFromClipboard(bool primary=false) override
Paste from the clipboard into this cell.
Definition: EditorCell.cpp:2730
void Undo()
Issue an undo command.
Definition: EditorCell.cpp:2893
void SetFont(wxDC *dc) const
Set the currently used font to the one that matches this cell's formatting.
Definition: EditorCell.cpp:956
wxString ToMatlab() const override
Convert this cell to its Matlab representation.
Definition: EditorCell.cpp:278
bool CutToClipboard() override
Cut this cell's editable contents to the clipboard.
Definition: EditorCell.cpp:2682
EditorCell * GetPrevious() const
Get the previous EditorCell in the list.
Definition: EditorCell.h:97
bool CanUndo() const
True, if there is undo information for this cell.
Definition: EditorCell.h:337
bool ActivateCursor()
Activate the blinking cursor in this cell.
Definition: EditorCell.cpp:2201
void SetStyle(TextStyle style) override
Sets the TextStyle of this cell.
Definition: EditorCell.cpp:951
void InsertEscCommand(const wxString &txt)
Insert the symbol that corresponds to the ESC command txt.
Definition: EditorCell.h:103
bool FindNext(wxString str, const bool &down, const bool &ignoreCase)
Finds the next occurrences of a string.
Definition: EditorCell.cpp:3472
void CaretToPosition(size_t pos)
Move the cursor to a certain position in the cell.
Definition: EditorCell.cpp:3832
bool ContainsChanges() const
Query if this cell needs to be re-evaluated by maxima.
Definition: EditorCell.h:402
EditorCell * GetNext() const
Get the next EditorCell in the list.
Definition: EditorCell.h:100
bool AddEnding() override
Adds a ";" to the end of the last command in this cell in case that it doesn't end in $ or ;.
Definition: EditorCell.cpp:2233
void SetForeground(wxDC *dc)
Sets the current color to this cell's foreground color.
Definition: EditorCell.cpp:977
bool CaretAtEnd() const
Is the cursor at the end of this cell?
Definition: EditorCell.h:327
void SelectPointText(wxPoint point) override
Sets the cursor to the screen coordinate point.
Definition: EditorCell.cpp:2351
virtual void Draw(wxDC *dc, wxDC *antialiassingDC) override
Pass 3 (Paint): Renders the cell using pre-calculated coordinates.
Definition: EditorCell.cpp:770
const auto & GetWordList() const
A list of words that might be applicable to the autocomplete function.
Definition: EditorCell.h:129
void Recalculate(const AFontSize fontsize) const override
Recalculate the size of the cell and the difference between top and center.
Definition: EditorCell.cpp:579
void MouseSelectionStartedHere() const
Remember that this is the cell the mouse selection was started in.
Definition: EditorCell.cpp:178
wxString ToHTML() const
Convert the current cell to HTML code.
Definition: EditorCell.cpp:654
void ProcessNewline(bool keepCursorAtStartOfLine=true)
Start a new line and optionally auto-indent it.
Definition: EditorCell.cpp:1334
void ConvertNumToUNicodeChar()
Convert a number to unicode chars.
Definition: EditorCell.cpp:535
static wxString PrependNBSP(wxString input)
Convert all but the first of a row of multiple spaces to non-breakable.
Definition: EditorCell.cpp:222
static wxString EscapeHTMLChars(wxString input)
Escape all chars that cannot be used in HTML otherwise.
Definition: EditorCell.cpp:78
void ReturnToSelectionFromTop()
Return to the selection after the cell has been left upwards.
Definition: EditorCell.h:498
void SetType(CellType type) override
Sets the text style according to the type.
Definition: EditorCell.cpp:946
A cell grouping input (and, if there is one, also the output) cell to a foldable item.
Definition: GroupCell.h:87
This class generates a pane containing the last commands that were issued.
Definition: History.h:56
const wxFont & GetFont(AFontSize fontSize) const
Returns the font associated with this style, but with the size fontSize.
Definition: TextStyle.cpp:355