4#include <gtkmm/window.h>
5#include <gtkmm/applicationwindow.h>
7#include <gtkmm/progressbar.h>
8#include <gtkmm/spinner.h>
9#include <gtkmm/label.h>
11#include <gtkmm/button.h>
12#include <gtkmm/builder.h>
13#include <gtkmm/cssprovider.h>
15#include <glibmm/dispatcher.h>
16#include <giomm/settings.h>
17#include <giomm/actiongroup.h>
22#include "nlohmann/json.hpp"
48 virtual void add_cell(
const DTree&, DTree::iterator,
bool)
override;
114 virtual void load_from_string(
const std::string& notebook_contents)
override;
118 virtual void set_progress(
const std::string& msg,
int cur_step,
int total_steps)
override;
128 void on_outbox_copy(Glib::RefPtr<Gtk::Clipboard> refClipboard, DTree::iterator it);
261 std::string
save(
const std::string& fn)
const;
334#if GTKMM_MINOR_VERSION>=10
335 std::vector<Gtk::Revealer *> to_reveal;
int quit(void *)
Definition Server.cc:328
The Cadabra notebook application.
Definition Cadabra.hh:12
Base class which talks to the server and sends Action objects back to the DocumentThread.
Definition ComputeThread.hh:29
Definition DataCell.hh:116
DocumentThread(GUIBase *)
Definition DocumentThread.cc:26
ComputeThread * compute
Definition DocumentThread.hh:160
Abstract base class with methods that need to be implemented by any GUI.
Definition GUIBase.hh:16
void on_file_quit()
Definition NotebookWindow.cc:2566
virtual void load_from_string(const std::string ¬ebook_contents) override
Load a new notebook from a JSON string.
Definition NotebookWindow.cc:2278
void on_view_split()
Definition NotebookWindow.cc:2774
bool kernel_spinner_status
Definition NotebookWindow.hh:176
virtual void process_data() override
When the ComputeThread needs to modify the document, it stores an ActionBase object on the stack (see...
Definition NotebookWindow.cc:1145
virtual void set_compute_thread(ComputeThread *compute) override
Let the notebook know about the ComputeThread so that it can send cells for evaluation.
Definition NotebookWindow.cc:2880
bool cell_content_erase(int, int, DTree::iterator, int)
Definition NotebookWindow.cc:2045
Gtk::Box mainbox
Definition NotebookWindow.hh:152
void tex_run_async()
Definition NotebookWindow.cc:1197
std::unique_ptr< DiffViewer > diffviewer
Definition NotebookWindow.hh:163
bool on_copy_as_latex(const DTree::iterator it)
Definition NotebookWindow.cc:2152
Gtk::Label kernel_label
Definition NotebookWindow.hh:177
Glib::RefPtr< Gio::SimpleAction > action_fontsize
Definition NotebookWindow.hh:329
virtual void set_progress(const std::string &msg, int cur_step, int total_steps) override
Definition NotebookWindow.cc:1615
std::string progress_string
Definition NotebookWindow.hh:184
void on_tools_options()
Definition NotebookWindow.cc:3383
void on_file_export_html()
Definition NotebookWindow.cc:2403
virtual void on_connect() override
Network status is propagated from the ComputeThread to the GUI using the following methods.
Definition NotebookWindow.cc:1151
std::recursive_mutex tex_need_width_mutex
Definition NotebookWindow.hh:315
bool on_scroll_changed()
Definition NotebookWindow.cc:1935
NotebookWindow(Cadabra *, bool read_only=false, std::string geometry="", std::string title="")
Definition NotebookWindow.cc:50
void propagate_global_hide_flag()
Definition NotebookWindow.cc:3235
bool tex_running
Definition NotebookWindow.hh:317
double display_scale
Definition NotebookWindow.hh:69
Glib::RefPtr< Gtk::CssProvider > css_provider
Definition NotebookWindow.hh:308
void on_edit_copy(const Glib::VariantBase &)
Definition NotebookWindow.cc:2584
void compare_to_file()
Definition NotebookWindow.cc:3020
void on_scroll_size_allocate(Gtk::Allocation &)
Definition NotebookWindow.cc:1948
Glib::Dispatcher dispatch_update_status
Definition NotebookWindow.hh:187
virtual bool on_configure_event(GdkEventConfigure *cfg) override
Definition NotebookWindow.cc:1045
void on_crash_window_closed(int)
Definition NotebookWindow.cc:1300
void on_prefs_choose_colours()
Definition NotebookWindow.cc:3360
int status_col
Definition NotebookWindow.hh:186
void on_run_cell()
Definition NotebookWindow.cc:2795
void on_search_text_changed()
Search handling.
Definition NotebookWindow.cc:2699
int tex_need_width
Definition NotebookWindow.hh:318
int last_configure_width
Definition NotebookWindow.hh:312
void select_range(const DTree &, DTree::iterator, int start, int len)
Definition NotebookWindow.cc:1827
void process_todo_queue()
Todo deque processing logic.
Definition NotebookWindow.cc:1250
void on_edit_undo(const Glib::VariantBase &)
Definition NotebookWindow.cc:2574
void on_prefs_hide_input_cells(const Glib::VariantBase &vb)
Definition NotebookWindow.cc:3218
virtual void remove_cell(const DTree &, DTree::iterator) override
Remove a single cell together with all its child cells.
Definition NotebookWindow.cc:1648
double progress_frac
Definition NotebookWindow.hh:185
virtual size_t get_cursor_position(const DTree &, DTree::iterator) override
Retrieve the position of the cursor in the current cell.
Definition NotebookWindow.cc:1849
Gtk::Button tool_restart
Definition NotebookWindow.hh:149
Glib::RefPtr< Gio::SimpleActionGroup > actiongroup
Definition NotebookWindow.hh:143
void compare_git_latest()
Definition NotebookWindow.cc:3092
Glib::Dispatcher dispatcher
Definition NotebookWindow.hh:139
virtual bool on_unhandled_error(const std::exception &err) override
Definition NotebookWindow.cc:1089
void interactive_execute()
Definition NotebookWindow.cc:2086
void on_edit_find()
Definition NotebookWindow.cc:2691
Gtk::Box toolbar
Definition NotebookWindow.hh:147
std::string kernel_string
Definition NotebookWindow.hh:184
Glib::RefPtr< Gio::SimpleAction > action_undo
Definition NotebookWindow.hh:328
void handle_thread_tex_error()
Handle a TeX error which occurred on a threaded TeX run (activated by tex_run_async) and is stored in...
Definition NotebookWindow.cc:1082
bool read_only
Definition NotebookWindow.hh:198
DTree::iterator selected_cell
Definition NotebookWindow.hh:126
Gtk::Button tool_run
Definition NotebookWindow.hh:149
Glib::RefPtr< Gio::SimpleAction > action_paste
Definition NotebookWindow.hh:329
Gtk::Label status_label
Definition NotebookWindow.hh:177
Glib::RefPtr< Gio::SimpleAction > action_hide_input_cells
Definition NotebookWindow.hh:330
void on_edit_paste()
Definition NotebookWindow.cc:2596
void on_realize() override
Definition NotebookWindow.cc:80
Glib::RefPtr< Cadabra > cdbapp
Definition NotebookWindow.hh:131
void on_file_export_python()
Definition NotebookWindow.cc:2452
std::mutex status_mutex
Definition NotebookWindow.hh:183
Gtk::Label top_label
Definition NotebookWindow.hh:177
Gtk::SearchBar searchbar
Definition NotebookWindow.hh:153
void refresh_highlighting()
Definition NotebookWindow.cc:3489
std::string last_find_string
Definition NotebookWindow.hh:322
Gtk::ProgressBar progressbar
Definition NotebookWindow.hh:174
Gtk::CheckButton search_case_insensitive
Definition NotebookWindow.hh:156
void on_help_about()
Definition NotebookWindow.cc:2885
virtual void dim_output_cells(DTree::iterator it) override
Dim all output cells of the visual cells corresponding to the given document cell.
Definition NotebookWindow.cc:2058
void resize_codeinput_texview_all(int width)
Definition NotebookWindow.cc:987
Gtk::Label search_result
Definition NotebookWindow.hh:157
void on_edit_insert_below()
Definition NotebookWindow.cc:2653
void on_edit_insert_above()
Definition NotebookWindow.cc:2637
void on_prefs_use_defaults()
Definition NotebookWindow.cc:3367
std::string run_git_command(const std::string &args)
Definition NotebookWindow.cc:3047
void on_help() const
Definition NotebookWindow.cc:2847
Glib::Dispatcher dispatch_tex_error
Definition NotebookWindow.hh:187
void on_edit_split()
Definition NotebookWindow.cc:2736
virtual bool on_key_press_event(GdkEventKey *) override
Definition NotebookWindow.cc:1305
std::string clipboard_cdb
Definition NotebookWindow.hh:258
void on_help_register()
Definition NotebookWindow.cc:2916
void update_title()
Definition NotebookWindow.cc:1101
Gtk::Button tool_stop
Definition NotebookWindow.hh:149
std::vector< Glib::RefPtr< Gio::SimpleAction > > default_actions
Definition NotebookWindow.hh:133
std::unique_ptr< std::thread > tex_thread
Definition NotebookWindow.hh:316
void on_edit_delete()
Definition NotebookWindow.cc:2671
bool is_configured
Definition NotebookWindow.hh:324
void on_edit_redo(const Glib::VariantBase &)
Definition NotebookWindow.cc:2579
void on_clipboard_get(Gtk::SelectionData &, guint info)
Clipboard handling.
Definition NotebookWindow.cc:3583
Gtk::Paned dragbox
Definition NotebookWindow.hh:151
std::string clipboard_txt
Definition NotebookWindow.hh:258
void on_prefs_microtex(bool on)
Definition NotebookWindow.cc:3328
void on_prefs_highlight_syntax(bool on)
Definition NotebookWindow.cc:3296
Gtk::Box supermainbox
Definition NotebookWindow.hh:150
void on_file_save_as_jupyter()
Definition NotebookWindow.cc:2370
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.
Definition NotebookWindow.cc:1782
Glib::RefPtr< Gio::SimpleAction > action_copy
Definition NotebookWindow.hh:328
bool on_first_redraw()
Definition NotebookWindow.cc:2299
void set_stop_sensitive(bool)
Definition NotebookWindow.cc:1137
void on_clipboard_clear()
Definition NotebookWindow.cc:3596
void unselect_output_cell()
Definition NotebookWindow.cc:3508
std::string tex_error_string
Definition NotebookWindow.hh:319
void scroll_cell_into_view(DTree::iterator cell)
Definition NotebookWindow.cc:1870
void on_file_export_latex()
Definition NotebookWindow.cc:2424
void on_run_stop()
Definition NotebookWindow.cc:2825
double scale
Definition NotebookWindow.hh:68
void on_prefs_font_size(int num)
Definition NotebookWindow.cc:3260
std::pair< DTree::iterator, size_t > last_find_location
Definition NotebookWindow.hh:321
void select_git_path()
Functionality for the diff viewer.
Definition NotebookWindow.cc:3010
void on_text_scaling_factor_changed(const std::string &key)
Definition NotebookWindow.cc:2987
bool crash_window_hidden
Definition NotebookWindow.hh:279
std::vector< NotebookCanvas * > canvasses
Definition NotebookWindow.hh:167
virtual void on_disconnect(const std::string &) override
Definition NotebookWindow.cc:1168
bool cell_complete_request(DTree::iterator it, int pos, int i)
Definition NotebookWindow.cc:2093
void on_ignore_cell_on_import()
Definition NotebookWindow.cc:2754
void on_prefs_auto_close_latex(const Glib::VariantBase &vb)
Definition NotebookWindow.cc:3206
virtual void on_interactive_output(const nlohmann::json &msg) override
Definition NotebookWindow.cc:1610
void on_file_new()
Definition NotebookWindow.cc:2212
void refresh_after_tex_engine_run()
Refresh the display after a TeX engine run has completed.
Definition NotebookWindow.cc:1076
Glib::RefPtr< Gio::SimpleAction > action_redo
Definition NotebookWindow.hh:328
bool quit_safeguard(bool quit)
Definition NotebookWindow.cc:2528
virtual void on_network_error() override
Definition NotebookWindow.cc:1175
void on_outbox_copy(Glib::RefPtr< Gtk::Clipboard > refClipboard, DTree::iterator it)
Definition NotebookWindow.cc:3548
virtual bool on_delete_event(GdkEventAny *) override
Definition NotebookWindow.cc:934
TeXEngine engine
Definition NotebookWindow.hh:67
void on_edit_cell_is_python()
Definition NotebookWindow.cc:2743
Glib::RefPtr< Gio::SimpleAction > action_console
Definition NotebookWindow.hh:331
std::string save(const std::string &fn) const
Definition NotebookWindow.cc:2503
void on_kernel_restart()
Definition NotebookWindow.cc:2831
void on_prefs_set_cv(int vis)
Definition NotebookWindow.cc:944
Glib::RefPtr< Gtk::Builder > uimanager
Definition NotebookWindow.hh:144
void on_file_save()
Definition NotebookWindow.cc:2310
void scroll_current_cell_into_view()
Definition NotebookWindow.cc:1862
Gtk::Button tool_save_as
Definition NotebookWindow.hh:148
void on_run_runtocursor()
Definition NotebookWindow.cc:2808
Gtk::Button tool_run_to
Definition NotebookWindow.hh:149
void on_file_save_as()
Definition NotebookWindow.cc:2333
bool idle_handler()
Definition NotebookWindow.cc:3497
Gtk::Button tool_save
Definition NotebookWindow.hh:148
void compare_git_choose()
Definition NotebookWindow.cc:3124
void set_title_prefix(const std::string &)
Definition NotebookWindow.cc:1096
bool cell_got_focus(DTree::iterator, int)
Definition NotebookWindow.cc:2075
bool on_tex_error(const std::string &, DTree::iterator)
Definition NotebookWindow.cc:2159
Gtk::SearchEntry searchentry
Definition NotebookWindow.hh:155
bool modified
Definition NotebookWindow.hh:198
void update_status()
Definition NotebookWindow.cc:1631
Gtk::Dialog console_win
Definition NotebookWindow.hh:161
void on_edit_cell_is_latex()
Definition NotebookWindow.cc:2763
bool cell_toggle_visibility(DTree::iterator it, int)
Definition NotebookWindow.cc:1965
Glib::RefPtr< Gio::SimpleAction > action_highlight
Definition NotebookWindow.hh:329
void on_view_close(const Glib::VariantBase &)
Definition NotebookWindow.cc:2784
Console console
Definition NotebookWindow.hh:160
int status_line
Definition NotebookWindow.hh:186
Glib::RefPtr< Gio::SimpleAction > action_stop
Definition NotebookWindow.hh:331
void on_tools_clear_cache()
Definition NotebookWindow.cc:3471
Gtk::Box search_hbox
Definition NotebookWindow.hh:154
void compare_git_specific()
Definition NotebookWindow.cc:3179
bool handle_outbox_select(GdkEventButton *, DTree::iterator it)
Definition NotebookWindow.cc:3523
virtual void update_cell(const DTree &, DTree::iterator) override
The basic manipulations that a GUI needs to implement are adding, removing and updating (refreshing t...
Definition NotebookWindow.cc:1748
std::string name
Definition NotebookWindow.hh:197
void on_slider_changed(std::string variable, double value)
Definition NotebookWindow.cc:1942
void set_statusbar_message(const std::string &message="", int line=-1, int col=-1)
Definition NotebookWindow.cc:1126
bool cell_content_execute(DTree::iterator, bool shift_enter_pressed)
Definition NotebookWindow.cc:2112
virtual void add_cell(const DTree &, DTree::iterator, bool) override
Add a GUI cell corresponding to the document cell at the iterator.
Definition NotebookWindow.cc:1369
bool cell_content_changed(DTree::iterator it, int i)
Definition NotebookWindow.cc:2022
~NotebookWindow()
Definition NotebookWindow.cc:855
Glib::RefPtr< Gio::SimpleAction > action_microtex
Definition NotebookWindow.hh:331
Gtk::Button tool_open
Definition NotebookWindow.hh:148
std::string geometry_string
Definition NotebookWindow.hh:197
void compare_git(const std::string &commit_hash)
Definition NotebookWindow.cc:3074
void on_file_open()
Definition NotebookWindow.cc:2239
std::string status_string
Definition NotebookWindow.hh:184
virtual void on_kernel_runstatus(bool) override
Definition NotebookWindow.cc:1182
void on_file_export_html_segment()
Definition NotebookWindow.cc:2476
Glib::Dispatcher dispatch_refresh
Definition NotebookWindow.hh:187
Gtk::Spinner kernel_spinner
Definition NotebookWindow.hh:175
Glib::RefPtr< Gio::Settings > settings
Definition NotebookWindow.hh:309
virtual void hide_visual_cells(DTree::iterator it) override
Hide all visual cells (on all canvasses) corresponding to a given document cell.
Definition NotebookWindow.cc:2138
Gtk::Box statusbarbox
Definition NotebookWindow.hh:158
void on_file_close()
Definition NotebookWindow.cc:2225
Glib::RefPtr< Gio::SimpleAction > action_view_close
Definition NotebookWindow.hh:329
bool cell_content_insert(const std::string &, int, DTree::iterator, int)
Definition NotebookWindow.cc:2033
void load_css()
Definition NotebookWindow.cc:859
int current_canvas
Definition NotebookWindow.hh:168
Glib::RefPtr< Gio::SimpleAction > action_auto_close_latex
Definition NotebookWindow.hh:330
std::string title_prefix
Definition NotebookWindow.hh:197
void set_name(const std::string &)
Definition NotebookWindow.cc:2272
void resize_codeinput_texview(DTree::iterator, int width)
Definition NotebookWindow.cc:1000
Glib::RefPtr< Gio::SimpleAction > action_register
Definition NotebookWindow.hh:331
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...
Definition NotebookWindow.cc:1729
Gtk::Box topbox
Definition NotebookWindow.hh:146
TeXEngine is used to convert LaTeX strings into PNG images.
Definition TeXEngine.hh:23
Functions to handle the exchange properties of two or more symbols in a product.
Definition Adjform.cc:83