Cadabra
Computer algebra system for field theory problems
|
Each notebook has one main window which controls it.
It has a menu bar, a status pane and one or more panels that represent a view on the document.
#include <NotebookWindow.hh>
Classes | |
class | Prefs |
Public Member Functions | |
NotebookWindow (Cadabra *, bool read_only=false) | |
~NotebookWindow () | |
virtual void | add_cell (const DTree &, DTree::iterator, bool) override |
Add a GUI cell corresponding to the document cell at the iterator. More... | |
virtual void | remove_cell (const DTree &, DTree::iterator) override |
Remove a single cell. More... | |
virtual void | remove_all_cells () override |
Remove all GUI cells from the display (used as a quick way to clear all before loading a new document). More... | |
virtual void | update_cell (const DTree &, DTree::iterator) override |
The basic manipulations that a GUI needs to implement are adding, removing and updating (refreshing the display of) a cell. More... | |
virtual void | position_cursor (const DTree &, DTree::iterator, int pos) override |
Position the cursor in the current canvas in the widget corresponding to the indicated cell. More... | |
virtual size_t | get_cursor_position (const DTree &, DTree::iterator) override |
Retrieve the position of the cursor in the current cell. More... | |
virtual void | on_connect () override |
Network status is propagated from the ComputeThread to the. More... | |
virtual void | on_disconnect (const std::string &) override |
virtual void | on_network_error () override |
virtual void | on_kernel_runstatus (bool) override |
virtual void | process_data () override |
When the ComputeThread needs to modify the document, it stores an ActionBase object on the stack (see the DocumenThread class) and then wakes up the GUI thread signalling it to process this action. More... | |
bool | on_vscroll_changed (Gtk::ScrollType, double) |
bool | on_scroll (GdkEventScroll *) |
void | on_scroll_size_allocate (Gtk::Allocation &) |
void | scroll_current_cell_into_view () |
void | set_name (const std::string &) |
void | set_title_prefix (const std::string &) |
void | load_file (const std::string ¬ebook_contents) |
Public Member Functions inherited from cadabra::DocumentThread | |
DocumentThread (GUIBase *) | |
DocumentThread (const DocumentThread &)=delete | |
It is not possible to copy-construct a DocumentThread as it holds on to resources which are not easily copied (such as GUI elements). More... | |
void | set_compute_thread (ComputeThread *) |
Let the notebook know about the ComputeThread so that it can send cells for evaluation. More... | |
void | build_visual_representation () |
Ensure that the gui has an up-to-date representation of the dtree. More... | |
void | queue_action (std::shared_ptr< ActionBase >) |
All changes to the document should be made by submitting ActionBase derived objects to the 'queue_action' function, so that an undo stack can be kept. More... | |
void | new_document () |
Setup an empty new document with a single Python input cell. More... | |
void | load_from_string (const std::string &) |
Load a new notebook from a JSON string. More... | |
void | undo () |
One undo step. More... | |
bool | is_registered () const |
Determine if a user has been registered with the Cadabra log server. More... | |
void | set_user_details (const std::string &name, const std::string &email, const std::string &affiliation) |
Set user details which will be sent to the Cadabra log server. More... | |
Public Attributes | |
TeXEngine | engine |
double | scale |
Public Attributes inherited from cadabra::DocumentThread | |
friend | ActionBase |
friend | ActionAddCell |
friend | ActionPositionCursor |
friend | ActionRemoveCell |
friend | ActionSplitCell |
friend | ActionSetRunStatus |
friend | ActionInsertText |
friend | ActionEraseText |
Protected Member Functions | |
virtual bool | on_key_press_event (GdkEventKey *) override |
virtual bool | on_delete_event (GdkEventAny *) override |
virtual bool | on_configure_event (GdkEventConfigure *cfg) override |
bool | handle_outbox_select (GdkEventButton *, DTree::iterator it) |
void | unselect_output_cell () |
void | on_outbox_copy (Glib::RefPtr< Gtk::Clipboard > refClipboard, DTree::iterator it) |
Protected Member Functions inherited from cadabra::DocumentThread | |
void | process_action_queue () |
Process the action queue. More... | |
bool | help_type_and_topic (const std::string &before, const std::string &after, help_t &help_type, std::string &help_topic) const |
Protected Attributes | |
DTree::iterator | current_cell |
DTree::iterator | selected_cell |
Protected Attributes inherited from cadabra::DocumentThread | |
GUIBase * | gui |
ComputeThread * | compute |
DTree | doc |
The actual document tree. More... | |
std::mutex | stack_mutex |
The action undo/redo/todo stacks and logic to execute. More... | |
ActionStack | undo_stack |
ActionStack | redo_stack |
std::queue< std::shared_ptr < ActionBase > > | pending_actions |
bool | disable_stacks |
bool | registered |
Configuration options read from ~/.config/cadabra.conf. More... | |
Private Member Functions | |
void | update_title () |
void | set_stop_sensitive (bool) |
void | on_file_new () |
void | on_file_open () |
void | on_file_close () |
void | on_file_save () |
void | on_file_save_as () |
void | on_file_export_html () |
void | on_file_export_html_segment () |
void | on_file_export_latex () |
void | on_file_export_python () |
void | on_file_quit () |
bool | quit_safeguard (bool quit) |
void | on_edit_undo () |
void | on_edit_copy () |
void | on_edit_paste () |
void | on_edit_insert_above () |
void | on_edit_insert_below () |
void | on_edit_delete () |
void | on_edit_split () |
void | on_edit_cell_is_latex () |
void | on_edit_cell_is_python () |
void | on_view_split () |
void | on_view_close () |
void | on_run_cell () |
void | on_run_runall () |
void | on_run_runtocursor () |
void | on_run_stop () |
void | on_prefs_font_size (int num) |
void | on_help_about () |
void | on_help () const |
void | on_kernel_restart () |
void | on_clipboard_get (Gtk::SelectionData &, guint info) |
Clipboard handling. More... | |
void | on_clipboard_clear () |
std::string | save (const std::string &fn) const |
void | process_todo_queue () |
void | on_crash_window_closed (int) |
bool | cell_got_focus (DTree::iterator, int) |
bool | cell_toggle_visibility (DTree::iterator it, int) |
bool | cell_content_insert (const std::string &, int, DTree::iterator, int) |
bool | cell_content_erase (int, int, DTree::iterator, int) |
bool | cell_content_execute (DTree::iterator, int, bool shift_enter_pressed) |
bool | cell_content_changed (const std::string &content, DTree::iterator it, int canvas_number) |
void | dim_output_cells (DTree::iterator it) |
bool | on_tex_error (const std::string &, DTree::iterator) |
void | setup_css_provider () |
void | on_text_scaling_factor_changed (const std::string &key) |
bool | idle_handler () |
Private Attributes | |
Cadabra * | cdbapp |
Glib::Dispatcher | dispatcher |
Glib::RefPtr< Gtk::ActionGroup > | actiongroup |
Glib::RefPtr< Gtk::UIManager > | uimanager |
Gtk::VBox | topbox |
Gtk::HBox | supermainbox |
Gtk::VBox | mainbox |
Gtk::HBox | statusbarbox |
std::vector< NotebookCanvas * > | canvasses |
int | current_canvas |
Gtk::ProgressBar | progressbar |
Gtk::Spinner | kernel_spinner |
bool | kernel_spinner_status |
Gtk::Label | status_label |
Gtk::Label | kernel_label |
std::mutex | status_mutex |
std::string | status_string |
std::string | kernel_string |
std::string | name |
std::string | title_prefix |
bool | modified |
bool | read_only |
Glib::RefPtr< Gtk::Action > | action_copy |
Glib::RefPtr< Gtk::Action > | action_paste |
std::string | clipboard_txt |
std::string | clipboard_cdb |
bool | crash_window_hidden |
Glib::RefPtr< Gtk::CssProvider > | css_provider |
Glib::RefPtr< Gio::Settings > | settings |
int | last_configure_width |
DTree::iterator | follow_cell |
Prefs | prefs |
bool | is_configured |
Additional Inherited Members | |
Protected Types inherited from cadabra::DocumentThread | |
enum | help_t { help_t::algorithm, help_t::property, help_t::latex, help_t::none } |
Help system. More... | |
typedef std::stack < std::shared_ptr< ActionBase > > | ActionStack |
NotebookWindow::NotebookWindow | ( | Cadabra * | c, |
bool | read_only = false |
||
) |
NotebookWindow::~NotebookWindow | ( | ) |
|
overridevirtual |
Add a GUI cell corresponding to the document cell at the iterator.
The GUI needs to figure out from the location of this cell in the DTree where to insert the cell in the visual display. If the 'visible' flag is false, hide the cell from view independent of whether its hidden flag is set (this is only used when constructing a document on load time and we do not want to show cells until they have all been added to the document).
Implements cadabra::GUIBase.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
overridevirtual |
Retrieve the position of the cursor in the current cell.
Implements cadabra::GUIBase.
|
protected |
|
private |
void NotebookWindow::load_file | ( | const std::string & | notebook_contents | ) |
|
private |
|
private |
Clipboard handling.
|
overrideprotectedvirtual |
|
overridevirtual |
Network status is propagated from the ComputeThread to the.
GUI using the following methods. These get called on the compute thread (as opposed to the functions above, which get called on the gui thread).
Implements cadabra::GUIBase.
|
private |
|
overrideprotectedvirtual |
|
overridevirtual |
Implements cadabra::GUIBase.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
overridevirtual |
Implements cadabra::GUIBase.
|
overrideprotectedvirtual |
|
overridevirtual |
Implements cadabra::GUIBase.
|
protected |
|
private |
|
private |
|
private |
|
private |
|
private |
bool NotebookWindow::on_scroll | ( | GdkEventScroll * | s | ) |
void NotebookWindow::on_scroll_size_allocate | ( | Gtk::Allocation & | scroll_alloc | ) |
|
private |
|
private |
|
private |
|
private |
bool NotebookWindow::on_vscroll_changed | ( | Gtk::ScrollType | st, |
double | v | ||
) |
|
overridevirtual |
Position the cursor in the current canvas in the widget corresponding to the indicated cell.
Implements cadabra::GUIBase.
|
overridevirtual |
When the ComputeThread needs to modify the document, it stores an ActionBase object on the stack (see the DocumenThread class) and then wakes up the GUI thread signalling it to process this action.
The following member should wake up the GUI thread and make it enter the processing part.
Implements cadabra::GUIBase.
|
private |
|
private |
|
overridevirtual |
Remove all GUI cells from the display (used as a quick way to clear all before loading a new document).
Implements cadabra::GUIBase.
|
overridevirtual |
Remove a single cell.
Implements cadabra::GUIBase.
|
private |
void NotebookWindow::scroll_current_cell_into_view | ( | ) |
void NotebookWindow::set_name | ( | const std::string & | n | ) |
|
private |
void NotebookWindow::set_title_prefix | ( | const std::string & | pf | ) |
|
private |
|
protected |
|
overridevirtual |
The basic manipulations that a GUI needs to implement are adding, removing and updating (refreshing the display of) a cell.
The code in DocumentThread will call these to make the GUI update its display. Called on the document thread.
Implements cadabra::GUIBase.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
protected |
|
private |
TeXEngine cadabra::NotebookWindow::engine |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
double cadabra::NotebookWindow::scale |
|
protected |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |