![]() |
Cadabra
Computer algebra system for field theory problems
|
Namespaces | |
| namespace | clipboard_detail |
Classes | |
| class | ContextMenu |
| A right-click context menu. More... | |
Typedefs | |
| using | ClickGesture = Gtk::GestureMultiPress |
| Gtk::GestureMultiPress was renamed Gtk::GestureClick in GTK4, and the way a controller is attached to a widget changed: gtkmm-3 passes the widget to create(), GTK4 uses Gtk::Widget::add_controller(). | |
Enumerations | |
| enum class | Expand { no , yes } |
GTK4 dissolved pack_start's three arguments into properties on the child: expand became set_h/vexpand, fill became the h/valign (FILL is the default, and no live call site used PACK_EXPAND_PADDING), and per-child padding became margins. More... | |
| enum class | AccessibleRole { math , text , push_button } |
| Accessible roles we actually use. More... | |
Functions | |
| Gtk::TextBuffer::iterator | insert_image (const Glib::RefPtr< Gtk::TextBuffer > &buffer, const Gtk::TextBuffer::iterator &pos, const Glib::RefPtr< Gdk::Pixbuf > &pixbuf) |
| GTK4 replaced Gtk::TextBuffer::insert_pixbuf() with insert_paintable(); a Gdk::Pixbuf has to be wrapped in a Gdk::Texture to become one. | |
| void | box_append (Gtk::Box &box, Gtk::Widget &child, Expand expand=Expand::no, int padding=0) |
| bool | has_modifier (Gdk::ModifierType state, Gdk::ModifierType modifier) |
| Glib::RefPtr< ClickGesture > | add_click_gesture (Gtk::Widget &widget) |
| void | clipboard_set (Gtk::Widget &widget, const std::string &text, const std::string &cadabra) |
Put text on the clipboard, plus cadabra under the private target if it is non-empty. | |
| void | clipboard_read (Gtk::Widget &widget, bool primary, const std::function< void(const std::string &)> &on_received) |
Read the clipboard and hand the result to on_received. | |
| template<typename T , typename U > | |
| Glib::RefPtr< T > | refptr_dynamic_cast (const Glib::RefPtr< U > &ptr) |
| glibmm-2.68 made Glib::RefPtr an alias for std::shared_ptr, which dropped the static RefPtr<T>::cast_dynamic(). | |
| void | window_centre_on_parent (Gtk::Window &window) |
| Gtk::Window::set_position() is removed in GTK4, where placement is left to the compositor. | |
| void | label_set_wrap (Gtk::Label &label, bool wrap=true) |
| Gtk::Label::set_line_wrap() is set_wrap() in GTK4. | |
| void | set_margin_all (Gtk::Widget &widget, int margin) |
| GTK4 has no single "margin" property, only the four sides. | |
| void | widget_size_allocate (Gtk::Widget &widget, const Gtk::Allocation &allocation) |
| GTK4 added a baseline argument to Gtk::Widget::size_allocate(). | |
| bool | translate_widget_coords (Gtk::Widget &src, Gtk::Widget &dest, double src_x, double src_y, double &dest_x, double &dest_y) |
Position of a point in src's coordinate space, expressed in dest's. | |
| int | dialog_run (Gtk::Dialog &dialog) |
| Show the about box and block until the user dismisses it. | |
| void | about_dialog_run (Gtk::AboutDialog &about) |
| void | about_dialog_set_logo (Gtk::AboutDialog &about, const Glib::RefPtr< Gdk::Pixbuf > &logo) |
| GTK4's Gtk::AboutDialog::set_logo() takes a Gdk::Paintable rather than a Gdk::Pixbuf. | |
| template<typename T > | |
| Glib::RefPtr< T > | refptr_for_instance (T *object) |
| Wrap a freshly-constructed Glib::Object subclass in a RefPtr. | |
| bool | css_load_from_data (const Glib::RefPtr< Gtk::CssProvider > &provider, const std::string &data) |
| Gtk::CssProvider::load_from_data() returns bool on gtkmm-3 but void on GTK4, where a parse failure is reported through ::parsing-error instead. | |
| unsigned int | box_child_count (Gtk::Box &box) |
| gtkmm-3's Gtk::Container API for inspecting and reordering children is gone in GTK4: there is no get_children(), and reorder_child(child, n) became reorder_child_after(child, sibling). | |
| void | box_reorder_child (Gtk::Box &box, Gtk::Widget &child, unsigned int index) |
Move child to absolute position index among box's children. | |
| void | scrolled_window_unset_child (Gtk::ScrolledWindow &sw) |
| Detaching a child. | |
| void | paned_unset_end (Gtk::Paned &paned) |
| void | show_now (Gtk::Widget &widget) |
| Gtk::Widget::show_now() is removed in GTK4; there is no way (nor need) to force a synchronous map. | |
| void | file_chooser_confirm_overwrite (Gtk::FileChooser &chooser) |
| GTK4 removed Gtk::FileChooser::set_do_overwrite_confirmation(): a save dialog there always confirms an overwrite. | |
| void | add_css_provider_for_default_display (const Glib::RefPtr< Gtk::CssProvider > &provider, guint priority) |
| Gdk::Screen is gone in GTK4; style providers attach to a Gdk::Display. | |
| Gdk::Rectangle | monitor_geometry (Gtk::Window &window) |
| The geometry of the monitor the window is on. | |
| void | set_dialog_type_hint (Gtk::Window &window) |
| Gtk::Window::set_type_hint() is removed in GTK4; the window manager is told what a dialog is via its transient-for and modal state instead. | |
| void | paned_set_start (Gtk::Paned &paned, Gtk::Widget &child, bool resize, bool shrink) |
| GTK4 replaced Gtk::Paned::pack1/pack2 with set_start_child/set_end_child plus separate resize/shrink setters. | |
| void | paned_set_end (Gtk::Paned &paned, Gtk::Widget &child, bool resize, bool shrink) |
| void | show_all (Gtk::Widget &widget) |
| GTK4 removed show_all(). | |
| template<typename Container > | |
| void | show_all_children (Container &container) |
| As above, but the gtkmm-3 form that shows the descendants without showing the widget itself. | |
| template<typename Parent > | |
| void | add_child (Parent &parent, Gtk::Widget &child) |
Put child inside parent. | |
| void | set_accessible_role (Gtk::Widget &w, AccessibleRole role) |
| void | set_accessible_name (Gtk::Widget &w, const Glib::ustring &name) |
Variables | |
| constexpr auto | APP_HANDLES_OPEN = Gio::APPLICATION_HANDLES_OPEN |
| Unscoped gtkmm-3 enumerators became scoped enum classes in gtkmm-4, so the spellings differ even though the values do not. | |
| constexpr auto | APP_HANDLES_COMMAND_LINE = Gio::APPLICATION_HANDLES_COMMAND_LINE |
| constexpr auto | APP_NON_UNIQUE = Gio::APPLICATION_NON_UNIQUE |
| constexpr auto | OPTION_TYPE_BOOL = Gio::Application::OptionType::OPTION_TYPE_BOOL |
| constexpr auto | OPTION_TYPE_INT = Gio::Application::OptionType::OPTION_TYPE_INT |
| constexpr auto | OPTION_TYPE_STRING = Gio::Application::OptionType::OPTION_TYPE_STRING |
| constexpr auto | ORIENT_HORIZONTAL = Gtk::ORIENTATION_HORIZONTAL |
| constexpr auto | ORIENT_VERTICAL = Gtk::ORIENTATION_VERTICAL |
| constexpr auto | ALIGN_FILL = Gtk::ALIGN_FILL |
| constexpr auto | ALIGN_START = Gtk::ALIGN_START |
| constexpr auto | ALIGN_END = Gtk::ALIGN_END |
| constexpr auto | ALIGN_CENTER = Gtk::ALIGN_CENTER |
| constexpr auto | POLICY_ALWAYS = Gtk::POLICY_ALWAYS |
| constexpr auto | POLICY_AUTOMATIC = Gtk::POLICY_AUTOMATIC |
| constexpr auto | POLICY_NEVER = Gtk::POLICY_NEVER |
| constexpr auto | SIZE_REQUEST_HEIGHT_FOR_WIDTH = Gtk::SizeRequestMode::SIZE_REQUEST_HEIGHT_FOR_WIDTH |
| constexpr auto | SIZE_REQUEST_WIDTH_FOR_HEIGHT = Gtk::SizeRequestMode::SIZE_REQUEST_WIDTH_FOR_HEIGHT |
| constexpr auto | TEXT_WINDOW_TEXT = Gtk::TEXT_WINDOW_TEXT |
| constexpr auto | WRAP_WORD_CHAR = Gtk::WRAP_WORD_CHAR |
| constexpr auto | WRAP_NONE = Gtk::WRAP_NONE |
| constexpr auto | COLORSPACE_RGB = Gdk::COLORSPACE_RGB |
| constexpr auto | STATE_FLAG_NORMAL = Gtk::STATE_FLAG_NORMAL |
| constexpr auto | STATE_FLAG_SELECTED = Gtk::STATE_FLAG_SELECTED |
| constexpr auto | RESPONSE_OK = Gtk::RESPONSE_OK |
| constexpr auto | RESPONSE_CANCEL = Gtk::RESPONSE_CANCEL |
| constexpr auto | RESPONSE_CLOSE = Gtk::RESPONSE_CLOSE |
| constexpr auto | RESPONSE_YES = Gtk::RESPONSE_YES |
| constexpr auto | RESPONSE_APPLY = Gtk::RESPONSE_APPLY |
| constexpr auto | MESSAGE_INFO = Gtk::MESSAGE_INFO |
| constexpr auto | MESSAGE_WARNING = Gtk::MESSAGE_WARNING |
| constexpr auto | MESSAGE_QUESTION = Gtk::MESSAGE_QUESTION |
| constexpr auto | MESSAGE_ERROR = Gtk::MESSAGE_ERROR |
| constexpr auto | BUTTONS_NONE = Gtk::BUTTONS_NONE |
| constexpr auto | BUTTONS_OK = Gtk::BUTTONS_OK |
| constexpr auto | BUTTONS_YES_NO = Gtk::BUTTONS_YES_NO |
| constexpr auto | FILE_CHOOSER_ACTION_OPEN = Gtk::FILE_CHOOSER_ACTION_OPEN |
| constexpr auto | FILE_CHOOSER_ACTION_SAVE = Gtk::FILE_CHOOSER_ACTION_SAVE |
| constexpr auto | LICENSE_GPL_3_0 = Gtk::License::LICENSE_GPL_3_0 |
| constexpr auto | PANGO_TAB_LEFT = Pango::TAB_LEFT |
| constexpr auto | PANGO_UNDERLINE_ERROR = Pango::Underline::UNDERLINE_ERROR |
| constexpr auto | MODIFIER_SHIFT = Gdk::SHIFT_MASK |
| Gdk::ModifierType became a scoped enum in GTK4, so both the enumerator spellings and the way a mask is tested differ. | |
| constexpr auto | MODIFIER_CONTROL = Gdk::CONTROL_MASK |
| constexpr auto | SEQ_CLAIMED = Gtk::EVENT_SEQUENCE_CLAIMED |
| const char * | CADABRA_CLIPBOARD_TARGET = "cadabra" |
| Clipboard. | |
| using cdb::ClickGesture = typedef Gtk::GestureMultiPress |
Gtk::GestureMultiPress was renamed Gtk::GestureClick in GTK4, and the way a controller is attached to a widget changed: gtkmm-3 passes the widget to create(), GTK4 uses Gtk::Widget::add_controller().
|
strong |
Accessible roles we actually use.
GTK4 removed ATK entirely; its replacement sets the role as a construct-time property, so there is no runtime equivalent and the GTK4 branch is a no-op. Kept as a helper rather than deleted so the intent stays visible and so it can be implemented properly (by choosing accessible-role at widget construction) later.
| Enumerator | |
|---|---|
| math | |
| text | |
| push_button | |
|
strong |
GTK4 dissolved pack_start's three arguments into properties on the child: expand became set_h/vexpand, fill became the h/valign (FILL is the default, and no live call site used PACK_EXPAND_PADDING), and per-child padding became margins.
These helpers speak GTK4 vocabulary and let the gtkmm-3 branch reproduce it. That branch sets both the pack option and the expand property, so it does not depend on whether gtkmm-3's GtkBox folds gtk_widget_compute_expand() into its own allocation.
The gtkmm-3 branch also shows the child, normalising gtkmm-3's "widgets start hidden" to GTK4's "widgets start visible". Anything that should stay hidden therefore needs an explicit set_visible(false) – which GTK4 would require anyway.
| Enumerator | |
|---|---|
| no | |
| yes | |
|
inline |
|
inline |
GTK4's Gtk::AboutDialog::set_logo() takes a Gdk::Paintable rather than a Gdk::Pixbuf.
|
inline |
Put child inside parent.
gtkmm-3 has Gtk::Container::add() for every container; GTK4 removed it in favour of append() on Gtk::Box and set_child() on the single-child containers, so the right call depends on the concrete parent type.
|
inline |
|
inline |
Gdk::Screen is gone in GTK4; style providers attach to a Gdk::Display.
|
inline |
|
inline |
gtkmm-3's Gtk::Container API for inspecting and reordering children is gone in GTK4: there is no get_children(), and reorder_child(child, n) became reorder_child_after(child, sibling).
|
inline |
Move child to absolute position index among box's children.
|
inline |
Read the clipboard and hand the result to on_received.
Prefers the private Cadabra target, falling back to plain text.
Always asynchronous. gtkmm-3 could read synchronously, but GTK4 cannot, so both paths defer; callers must not assume the callback has run by the time this returns.
|
inline |
Put text on the clipboard, plus cadabra under the private target if it is non-empty.
|
inline |
Gtk::CssProvider::load_from_data() returns bool on gtkmm-3 but void on GTK4, where a parse failure is reported through ::parsing-error instead.
|
inline |
Show the about box and block until the user dismisses it.
Show dialog modally, block until the user responds, and return the response id.
Gtk::AboutDialog derives from Gtk::Dialog on gtkmm-3 but from Gtk::Window on GTK4, so it has no ::response signal there and cannot go through dialog_run(). It still has to block, though: the callers construct the dialog on the stack, so returning immediately destroys it before it is ever presented and nothing appears at all. So we spin a nested main loop here too, quitting on ::hide.
set_hide_on_close() is what makes ::hide the signal to wait for. Without it a GTK4 window is destroyed when closed, which for a stack-allocated dialog would dispose the underlying GObject while the C++ wrapper is still alive.
GTK4 removed Gtk::Dialog::run(). The replacement below spins a nested main loop, which is exactly what gtkmm-3's run() does internally, so the two branches behave the same. Doing it this way keeps the ~32 call sites (and, importantly, NotebookWindow::quit_safeguard() and its five callers) in their current synchronous shape.
|
inline |
GTK4 removed Gtk::FileChooser::set_do_overwrite_confirmation(): a save dialog there always confirms an overwrite.
|
inline |
|
inline |
GTK4 replaced Gtk::TextBuffer::insert_pixbuf() with insert_paintable(); a Gdk::Pixbuf has to be wrapped in a Gdk::Texture to become one.
|
inline |
Gtk::Label::set_line_wrap() is set_wrap() in GTK4.
|
inline |
The geometry of the monitor the window is on.
gtkmm-3 looks this up from the window's Gdk::Window, GTK4 from its Gdk::Surface.
|
inline |
|
inline |
GTK4 replaced Gtk::Paned::pack1/pack2 with set_start_child/set_end_child plus separate resize/shrink setters.
|
inline |
|
inline |
glibmm-2.68 made Glib::RefPtr an alias for std::shared_ptr, which dropped the static RefPtr<T>::cast_dynamic().
|
inline |
Wrap a freshly-constructed Glib::Object subclass in a RefPtr.
glibmm-2.68 made Glib::RefPtr an alias for std::shared_ptr, so Glib::RefPtr<T>(new T()) is no longer merely old-fashioned but wrong: the object is already reference-counted by GObject, and the shared_ptr would add a second, independent count and double-free. glibmm-2.68 provides make_refptr_for_instance() for this; glibmm-2.4 does not have it, but there the plain constructor is correct.
|
inline |
Detaching a child.
gtkmm-3 has Gtk::Container::remove(); GTK4 dropped it for the single-child containers, where the child is a property instead.
|
inline |
|
inline |
|
inline |
Gtk::Window::set_type_hint() is removed in GTK4; the window manager is told what a dialog is via its transient-for and modal state instead.
|
inline |
GTK4 has no single "margin" property, only the four sides.
Both toolkits have the individual setters, so this needs no conditional.
|
inline |
GTK4 removed show_all().
There, widgets are visible by default and cdb::add_child/box_append show each child as it is added, so making the widget itself visible is all that remains. On gtkmm-3 this stays a literal show_all(), so behaviour is unchanged.
|
inline |
As above, but the gtkmm-3 form that shows the descendants without showing the widget itself.
Under GTK4 there is nothing to do: the children were shown as they were added.
|
inline |
Gtk::Widget::show_now() is removed in GTK4; there is no way (nor need) to force a synchronous map.
|
inline |
Position of a point in src's coordinate space, expressed in dest's.
Returns false if the two have no common ancestor, in which case nothing is stored.
Needed because get_allocation() does not mean the same thing in the two toolkits: gtkmm-3 reports a widget's position within the GdkWindow it draws on – which, inside a Gtk::ScrolledWindow, is the scrolled bin window, so allocations come out directly in document coordinates. GTK4 has no such windows and get_allocation() is relative to the immediate parent, so anything comparing a cell's position against a scroll adjustment has to translate explicitly. The signature also differs: gtkmm-3 takes and returns ints, GTK4 doubles.
|
inline |
GTK4 added a baseline argument to Gtk::Widget::size_allocate().
|
inline |
Gtk::Window::set_position() is removed in GTK4, where placement is left to the compositor.
(Gtk::Paned::set_position() is unrelated and fine.)
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
Unscoped gtkmm-3 enumerators became scoped enum classes in gtkmm-4, so the spellings differ even though the values do not.
Declared once here and used unqualified at the call sites.
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
inline |
Clipboard.
This is the one area with no common subset: gtkmm-3 has Gtk::Clipboard with X11 target atoms and synchronous reads, GTK4 has Gdk::Clipboard with mime types, Gdk::ContentProvider and asynchronous reads only. Both are hidden behind the two calls below.
Cadabra puts two things on the clipboard: the rendered text, and (when available) the cell's input form under a private "cadabra" name, so that pasting between Cadabra instances round-trips the input rather than the LaTeX. The same string is used as the gtkmm-3 target atom and the GTK4 mime type, which keeps a GTK3 and a GTK4 build interoperable.
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
Gdk::ModifierType became a scoped enum in GTK4, so both the enumerator spellings and the way a mask is tested differ.
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |