Cadabra
Computer algebra system for field theory problems
|
A text cell editor widget with support for editing Python and LaTeX.
CodeInput is essentially a TextView with some additional i/o logic.
#include <CodeInput.hh>
Classes | |
class | exp_input_tv |
The actual text widget used by CodeInput. More... | |
Public Member Functions | |
CodeInput (DTree::iterator, Glib::RefPtr< Gtk::TextBuffer >, double scale, int font_step) | |
Initialise with existing TextBuffer and a pointer to the Datacell corresponding to this CodeInput widget. More... | |
CodeInput (DTree::iterator, const std::string &, double scale, int font_step) | |
Initialise with a new TextBuffer (to be created by CodeInput), filling it with the content of the given string. More... | |
void | set_font_size (int num) |
Set the font size, 0 being default, negative smaller, positive larger. More... | |
bool | handle_button_press (GdkEventButton *) |
Handle mouse buttons. More... | |
void | handle_insert (const Gtk::TextIter &pos, const Glib::ustring &text, int bytes) |
Handle an insert event, which can consist of one or more inserted characters. More... | |
void | handle_erase (const Gtk::TextIter &start, const Gtk::TextIter &end) |
Handle an erase event. More... | |
void | update_buffer () |
Ensure that the visual representation matches the DTree cell. More... | |
void | slice_cell (std::string &before, std::string &after) |
Return two strings corresponding to the text before and after the current cursor position. More... | |
Public Attributes | |
Glib::RefPtr< Gtk::TextBuffer > | buffer |
We cannot edit the content of the DataCell directly, because Gtk needs a Gtk::TextBuffer. More... | |
exp_input_tv | edit |
Private Member Functions | |
void | init (int font_step) |
CodeInput::CodeInput | ( | DTree::iterator | it, |
Glib::RefPtr< Gtk::TextBuffer > | tb, | ||
double | scale, | ||
int | font_step | ||
) |
Initialise with existing TextBuffer and a pointer to the Datacell corresponding to this CodeInput widget.
CodeInput is not allowed to modify this DataCell directly, but can read properties from it (e.g. in order to know when to display a 'busy' indicator). The scale parameter refers to hdpi scaling.
CodeInput::CodeInput | ( | DTree::iterator | it, |
const std::string & | txt, | ||
double | scale, | ||
int | font_step | ||
) |
Initialise with a new TextBuffer (to be created by CodeInput), filling it with the content of the given string.
bool CodeInput::handle_button_press | ( | GdkEventButton * | button | ) |
Handle mouse buttons.
void CodeInput::handle_erase | ( | const Gtk::TextIter & | start, |
const Gtk::TextIter & | end | ||
) |
Handle an erase event.
This function will just massage that data and then feed it through to the notebook window class by emitting a signal on content_erase (done like this to separate DTree modification from the widget).
void CodeInput::handle_insert | ( | const Gtk::TextIter & | pos, |
const Glib::ustring & | text, | ||
int | bytes | ||
) |
Handle an insert event, which can consist of one or more inserted characters.
This function will just massage that data and then feed it through to the notebook window class by emitting a signal on content_insert (done like this to separate DTree modification from the widget).
|
private |
void CodeInput::set_font_size | ( | int | num | ) |
Set the font size, 0 being default, negative smaller, positive larger.
void CodeInput::slice_cell | ( | std::string & | before, |
std::string & | after | ||
) |
Return two strings corresponding to the text before and after the current cursor position.
void CodeInput::update_buffer | ( | ) |
Ensure that the visual representation matches the DTree cell.
Glib::RefPtr<Gtk::TextBuffer> cadabra::CodeInput::buffer |
exp_input_tv cadabra::CodeInput::edit |