Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
Inkscape::UI::Dialog::XmlTree Class Referencefinal

A dialog widget to view and edit the document xml. More...

#include <xml-tree.h>

Inheritance diagram for Inkscape::UI::Dialog::XmlTree:
Inkscape::UI::Dialog::DialogBase

Public Member Functions

 XmlTree ()
 
 ~XmlTree () final
 
void setSyntaxStyle (Inkscape::UI::Syntax::XMLStyles const &new_style)
 
- Public Member Functions inherited from Inkscape::UI::Dialog::DialogBase
 DialogBase (char const *prefs_path=nullptr, Glib::ustring dialog_type={})
 DialogBase constructor.
 
 DialogBase (DialogBase const &)=delete
 
DialogBaseoperator= (DialogBase const &)=delete
 
 ~DialogBase () override
 
virtual void update ()
 The update() method is essential to Gtk state management.
 
void setDesktop (SPDesktop *new_desktop)
 Called when the desktop might have changed for this dialog.
 
void on_map () override
 
Glib::ustring const & get_name () const
 
Glib::ustring const & getPrefsPath () const
 
Glib::ustring const & get_type () const
 
const Glib::ustring & get_icon () const
 
void blink ()
 Highlight notebook where dialog already exists.
 
virtual void focus_dialog ()
 
void defocus_dialog ()
 
bool getShowing ()
 
void fix_inner_scroll (Gtk::ScrolledWindow &scrollwin)
 
SPDesktopgetDesktop () const
 

Private Types

enum  DialogLayout : int { Auto = 0 , Horizontal , Vertical }
 

Private Member Functions

void unsetDocument ()
 
void documentReplaced () final
 
void selectionChanged (Selection *selection) final
 
void desktopReplaced () final
 Called when the desktop has certainly changed.
 
bool xml_tree_node_mutable (Inkscape::XML::Node *node)
 Is the selected tree node editable.
 
void set_tree_select (Inkscape::XML::Node *repr, bool edit=false)
 Select a node in the xml tree.
 
void propagate_tree_select (Inkscape::XML::Node *repr)
 Set the attribute list to match the selected node in the tree.
 
Inkscape::XML::Nodeget_dt_select ()
 Find the current desktop selection.
 
void set_dt_select (Inkscape::XML::Node *repr)
 Select the current desktop selection.
 
bool deferred_on_tree_select_row ()
 
void on_tree_select_row_enable (Inkscape::XML::Node *node)
 Enable widgets based on current selections.
 
void on_tree_unselect_row_disable ()
 
void on_tree_unselect_row_hide ()
 
void on_attr_unselect_row_disable ()
 
void onNameChanged ()
 
void onCreateNameChanged ()
 
void cmd_new_element_node ()
 Callbacks for toolbar buttons being pressed.
 
void cmd_new_text_node ()
 
void cmd_duplicate_node ()
 
void cmd_delete_node ()
 
void cmd_raise_node ()
 
void cmd_lower_node ()
 
void cmd_indent_node ()
 
void cmd_unindent_node ()
 
void _resized ()
 
bool in_dt_coordsys (SPObject const &item)
 Returns true iff item is suitable to be included in the selection, in particular whether it has a bounding box in the desktop coordinate system for rendering resize handles.
 
void rebuildTree ()
 
void stopNodeEditing (bool ok, Glib::ustring const &path, Glib::ustring name)
 
void startNodeEditing (Gtk::CellEditable *cell, Glib::ustring const &path)
 

Static Private Member Functions

static void _set_status_message (Inkscape::MessageType type, const gchar *message, GtkWidget *dialog)
 Callbacks for changes in desktop selection and current document.
 

Private Attributes

sigc::scoped_connection _tree_select_idle
 Callback for deferring the on_tree_select_row response in order to skip invalid intermediate selection states.
 
gint blocked = 0
 Flag to ensure only one operation is performed at once.
 
Inkscape::XML::Nodeselected_repr = nullptr
 Signal handlers.
 
Inkscape::UI::Widget::XmlTreeView_xml_treeview = nullptr
 
AttrDialogattributes
 
Gtk::Box * _attrbox
 
Glib::RefPtr< Gtk::Builder > _builder
 
UI::Widget::Bin _bin
 
Gtk::Entry * name_entry
 
Gtk::Button * create_button
 
Gtk::Paned & _paned
 
Gtk::Switch _attrswitch
 
Gtk::Label status
 
Gtk::Button & xml_element_new_button
 
Gtk::Button & xml_text_new_button
 
Gtk::Button & xml_node_delete_button
 
Gtk::Button & xml_node_duplicate_button
 
Gtk::Button & unindent_node_button
 
Gtk::Button & indent_node_button
 
Gtk::Button & raise_node_button
 
Gtk::Button & lower_node_button
 
DialogLayout _layout = Auto
 
Pref< Glib::ustring > _syntax_theme
 
Pref< bool > _mono_font
 
Inkscape::XML::Node_dummy = nullptr
 
Inkscape::XML::Node_node_parent = nullptr
 

Additional Inherited Members

- Protected Member Functions inherited from Inkscape::UI::Dialog::DialogBase
InkscapeApplicationgetApp () const
 
SPDocumentgetDocument () const
 
SelectiongetSelection () const
 
void setShowing (bool showing)
 function called from notebook dialog that performs an update of the dialog and sets the dialog showing state true
 
- Protected Attributes inherited from Inkscape::UI::Dialog::DialogBase
Glib::ustring _name
 
Glib::ustring const _prefs_path
 
Glib::ustring const _dialog_type
 

Detailed Description

A dialog widget to view and edit the document xml.

Definition at line 56 of file xml-tree.h.

Member Enumeration Documentation

◆ DialogLayout

Enumerator
Auto 
Horizontal 
Vertical 

Definition at line 174 of file xml-tree.h.

Constructor & Destructor Documentation

◆ XmlTree()

◆ ~XmlTree()

Inkscape::UI::Dialog::XmlTree::~XmlTree ( )
final

Definition at line 239 of file xml-tree.cpp.

References unsetDocument().

Member Function Documentation

◆ _resized()

void Inkscape::UI::Dialog::XmlTree::_resized ( )
private

Definition at line 252 of file xml-tree.cpp.

References _paned, Inkscape::Preferences::get(), and Inkscape::Preferences::setInt().

Referenced by XmlTree().

◆ _set_status_message()

void Inkscape::UI::Dialog::XmlTree::_set_status_message ( Inkscape::MessageType  type,
const gchar *  message,
GtkWidget *  dialog 
)
staticprivate

Callbacks for changes in desktop selection and current document.

Definition at line 397 of file xml-tree.cpp.

◆ cmd_delete_node()

◆ cmd_duplicate_node()

◆ cmd_indent_node()

◆ cmd_lower_node()

◆ cmd_new_element_node()

void Inkscape::UI::Dialog::XmlTree::cmd_new_element_node ( )
private

◆ cmd_new_text_node()

◆ cmd_raise_node()

◆ cmd_unindent_node()

◆ deferred_on_tree_select_row()

◆ desktopReplaced()

void Inkscape::UI::Dialog::XmlTree::desktopReplaced ( )
finalprivatevirtual

Called when the desktop has certainly changed.

It may have changed to nullptr when destructing the dialog, so the override should expect nullptr too.

Reimplemented from Inkscape::UI::Dialog::DialogBase.

Definition at line 788 of file xml-tree.cpp.

References attributes, Inkscape::UI::Dialog::DialogBase::getDesktop(), and Inkscape::UI::Dialog::DialogBase::setDesktop().

◆ documentReplaced()

◆ get_dt_select()

Inkscape::XML::Node * Inkscape::UI::Dialog::XmlTree::get_dt_select ( )
private

◆ in_dt_coordsys()

bool Inkscape::UI::Dialog::XmlTree::in_dt_coordsys ( SPObject const &  item)
private

Returns true iff item is suitable to be included in the selection, in particular whether it has a bounding box in the desktop coordinate system for rendering resize handles.

Descendents of <defs> nodes (markers etc.) return false, for example.

Definition at line 768 of file xml-tree.cpp.

References child, item, parent, and SPObject::parent.

Referenced by set_dt_select().

◆ on_attr_unselect_row_disable()

void Inkscape::UI::Dialog::XmlTree::on_attr_unselect_row_disable ( )
private

◆ on_tree_select_row_enable()

◆ on_tree_unselect_row_disable()

void Inkscape::UI::Dialog::XmlTree::on_tree_unselect_row_disable ( )
private

◆ on_tree_unselect_row_hide()

void Inkscape::UI::Dialog::XmlTree::on_tree_unselect_row_hide ( )
private

◆ onCreateNameChanged()

void Inkscape::UI::Dialog::XmlTree::onCreateNameChanged ( )
private

Definition at line 501 of file xml-tree.cpp.

References create_button, and name_entry.

◆ onNameChanged()

void Inkscape::UI::Dialog::XmlTree::onNameChanged ( )
private

◆ propagate_tree_select()

void Inkscape::UI::Dialog::XmlTree::propagate_tree_select ( Inkscape::XML::Node repr)
private

◆ rebuildTree()

◆ selectionChanged()

void Inkscape::UI::Dialog::XmlTree::selectionChanged ( Selection selection)
finalprivatevirtual

Reimplemented from Inkscape::UI::Dialog::DialogBase.

Definition at line 278 of file xml-tree.cpp.

References blocked, get_dt_select(), node, and set_tree_select().

◆ set_dt_select()

◆ set_tree_select()

◆ setSyntaxStyle()

void Inkscape::UI::Dialog::XmlTree::setSyntaxStyle ( Inkscape::UI::Syntax::XMLStyles const &  new_style)

Definition at line 795 of file xml-tree.cpp.

References _xml_treeview, and Inkscape::UI::Widget::XmlTreeView::set_style().

Referenced by XmlTree().

◆ startNodeEditing()

void Inkscape::UI::Dialog::XmlTree::startNodeEditing ( Gtk::CellEditable *  cell,
Glib::ustring const &  path 
)
private

Definition at line 528 of file xml-tree.cpp.

Referenced by XmlTree().

◆ stopNodeEditing()

◆ unsetDocument()

void Inkscape::UI::Dialog::XmlTree::unsetDocument ( )
private

Definition at line 258 of file xml-tree.cpp.

References _tree_select_idle.

Referenced by documentReplaced(), and ~XmlTree().

◆ xml_tree_node_mutable()

bool Inkscape::UI::Dialog::XmlTree::xml_tree_node_mutable ( Inkscape::XML::Node node)
private

Is the selected tree node editable.

Definition at line 464 of file xml-tree.cpp.

References Inkscape::XML::Node::name(), node, parent, and Inkscape::XML::Node::parent().

Referenced by on_tree_select_row_enable().

Member Data Documentation

◆ _attrbox

Gtk::Box* Inkscape::UI::Dialog::XmlTree::_attrbox
private

Definition at line 152 of file xml-tree.h.

◆ _attrswitch

Gtk::Switch Inkscape::UI::Dialog::XmlTree::_attrswitch
private

Definition at line 162 of file xml-tree.h.

◆ _bin

UI::Widget::Bin Inkscape::UI::Dialog::XmlTree::_bin
private

Definition at line 156 of file xml-tree.h.

Referenced by XmlTree().

◆ _builder

Glib::RefPtr<Gtk::Builder> Inkscape::UI::Dialog::XmlTree::_builder
private

Definition at line 155 of file xml-tree.h.

Referenced by XmlTree().

◆ _dummy

Inkscape::XML::Node* Inkscape::UI::Dialog::XmlTree::_dummy = nullptr
private

Definition at line 179 of file xml-tree.h.

Referenced by cmd_new_element_node(), and stopNodeEditing().

◆ _layout

DialogLayout Inkscape::UI::Dialog::XmlTree::_layout = Auto
private

Definition at line 175 of file xml-tree.h.

Referenced by XmlTree().

◆ _mono_font

Pref<bool> Inkscape::UI::Dialog::XmlTree::_mono_font
private

Definition at line 178 of file xml-tree.h.

Referenced by XmlTree().

◆ _node_parent

Inkscape::XML::Node* Inkscape::UI::Dialog::XmlTree::_node_parent = nullptr
private

Definition at line 180 of file xml-tree.h.

Referenced by cmd_new_element_node(), and stopNodeEditing().

◆ _paned

Gtk::Paned& Inkscape::UI::Dialog::XmlTree::_paned
private

Definition at line 159 of file xml-tree.h.

Referenced by _resized(), and XmlTree().

◆ _syntax_theme

Pref<Glib::ustring> Inkscape::UI::Dialog::XmlTree::_syntax_theme
private

Definition at line 177 of file xml-tree.h.

Referenced by XmlTree().

◆ _tree_select_idle

sigc::scoped_connection Inkscape::UI::Dialog::XmlTree::_tree_select_idle
private

Callback for deferring the on_tree_select_row response in order to skip invalid intermediate selection states.

In particular, gtk_tree_store_remove makes an undesired selection that we will immediately revert and don't want to an early response for.

Definition at line 101 of file xml-tree.h.

Referenced by unsetDocument(), and XmlTree().

◆ _xml_treeview

◆ attributes

AttrDialog* Inkscape::UI::Dialog::XmlTree::attributes
private

Definition at line 151 of file xml-tree.h.

Referenced by desktopReplaced(), propagate_tree_select(), and XmlTree().

◆ blocked

gint Inkscape::UI::Dialog::XmlTree::blocked = 0
private

Flag to ensure only one operation is performed at once.

Definition at line 142 of file xml-tree.h.

Referenced by selectionChanged(), set_dt_select(), and XmlTree().

◆ create_button

Gtk::Button* Inkscape::UI::Dialog::XmlTree::create_button
private

Definition at line 158 of file xml-tree.h.

Referenced by onCreateNameChanged().

◆ indent_node_button

Gtk::Button& Inkscape::UI::Dialog::XmlTree::indent_node_button
private

Definition at line 169 of file xml-tree.h.

Referenced by on_tree_select_row_enable(), on_tree_unselect_row_disable(), and XmlTree().

◆ lower_node_button

Gtk::Button& Inkscape::UI::Dialog::XmlTree::lower_node_button
private

Definition at line 171 of file xml-tree.h.

Referenced by on_tree_select_row_enable(), on_tree_unselect_row_disable(), and XmlTree().

◆ name_entry

Gtk::Entry* Inkscape::UI::Dialog::XmlTree::name_entry
private

Definition at line 157 of file xml-tree.h.

Referenced by onCreateNameChanged().

◆ raise_node_button

Gtk::Button& Inkscape::UI::Dialog::XmlTree::raise_node_button
private

Definition at line 170 of file xml-tree.h.

Referenced by on_tree_select_row_enable(), on_tree_unselect_row_disable(), and XmlTree().

◆ selected_repr

Inkscape::XML::Node* Inkscape::UI::Dialog::XmlTree::selected_repr = nullptr
private

◆ status

Gtk::Label Inkscape::UI::Dialog::XmlTree::status
private

Definition at line 163 of file xml-tree.h.

◆ unindent_node_button

Gtk::Button& Inkscape::UI::Dialog::XmlTree::unindent_node_button
private

Definition at line 168 of file xml-tree.h.

Referenced by on_tree_select_row_enable(), on_tree_unselect_row_disable(), and XmlTree().

◆ xml_element_new_button

Gtk::Button& Inkscape::UI::Dialog::XmlTree::xml_element_new_button
private

Definition at line 164 of file xml-tree.h.

Referenced by on_tree_select_row_enable(), on_tree_unselect_row_disable(), and XmlTree().

◆ xml_node_delete_button

Gtk::Button& Inkscape::UI::Dialog::XmlTree::xml_node_delete_button
private

Definition at line 166 of file xml-tree.h.

Referenced by on_tree_select_row_enable(), on_tree_unselect_row_disable(), and XmlTree().

◆ xml_node_duplicate_button

Gtk::Button& Inkscape::UI::Dialog::XmlTree::xml_node_duplicate_button
private

Definition at line 167 of file xml-tree.h.

Referenced by on_tree_select_row_enable(), on_tree_unselect_row_disable(), and XmlTree().

◆ xml_text_new_button

Gtk::Button& Inkscape::UI::Dialog::XmlTree::xml_text_new_button
private

Definition at line 165 of file xml-tree.h.

Referenced by on_tree_select_row_enable(), on_tree_unselect_row_disable(), and XmlTree().


The documentation for this class was generated from the following files: