Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
xml-tree.h
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-or-later
/*
6 * Authors: see git history
7 * Lauris Kaplinski, 2000
8 *
9 * Copyright (C) 2018 Authors
10 * Released under GNU GPL v2+, read the file 'COPYING' for more information.
11 */
12
13#ifndef INKSCAPE_UI_DIALOG_XML_TREE_H
14#define INKSCAPE_UI_DIALOG_XML_TREE_H
15
16#include <gtkmm/label.h>
17#include <gtkmm/switch.h>
18
19#include "attrdialog.h"
20#include "message.h"
21#include "preferences.h"
22
23#include "ui/widget/bin.h"
24
25namespace Gtk {
26class Box;
27class Builder;
28class Button;
29class Entry;
30class Paned;
31class TreeView;
32} // namespace Gtk
33
34class SPObject;
35struct SPXMLViewAttrList;
36struct SPXMLViewContent;
37struct SPXMLViewTree;
38
39namespace Inkscape {
40
41class MessageStack;
42class MessageContext;
43
44namespace XML { class Node; }
45
46namespace UI::Widget {
47class XmlTreeView;
48} // namespace UI::Widget
49
50namespace UI::Dialog {
51
56class XmlTree final : public DialogBase
57{
58public:
59 XmlTree();
60 ~XmlTree() final;
61
63
64private:
65 void unsetDocument();
66 void documentReplaced() final;
68 void desktopReplaced() final;
69
74
78 void set_tree_select(Inkscape::XML::Node *repr, bool edit = false);
79
84
89
94
101 sigc::scoped_connection _tree_select_idle;
103
111
113 void onCreateNameChanged();
114
118 static void _set_status_message(Inkscape::MessageType type, const gchar *message, GtkWidget *dialog);
119
124 void cmd_new_text_node();
125 void cmd_duplicate_node();
126 void cmd_delete_node();
127 void cmd_raise_node();
128 void cmd_lower_node();
129 void cmd_indent_node();
130 void cmd_unindent_node();
131
132 void _resized();
133 bool in_dt_coordsys(SPObject const &item);
134
135 void rebuildTree();
136 void stopNodeEditing(bool ok, Glib::ustring const &path, Glib::ustring name);
137 void startNodeEditing(Gtk::CellEditable *cell, Glib::ustring const &path);
138
142 gint blocked = 0;
143
148
149 /* XmlTree Widgets */
152 Gtk::Box *_attrbox;
153
154 /* XML Node Creation pop-up window */
155 Glib::RefPtr<Gtk::Builder> _builder;
157 Gtk::Entry *name_entry;
158 Gtk::Button *create_button;
159 Gtk::Paned& _paned;
160
161 // Gtk::Box node_box;
162 Gtk::Switch _attrswitch;
163 Gtk::Label status;
169 Gtk::Button& indent_node_button;
170 Gtk::Button& raise_node_button;
171 Gtk::Button& lower_node_button;
172
173 // Keep these options in sync with menu/actions @ share/ui/dialog-xml.glade!
176
181};
182
183} // namespace UI::Dialog
184
185} // namespace Inkscape
186
187#endif // INKSCAPE_UI_DIALOG_XML_TREE_H
188
189/*
190 Local Variables:
191 mode:c++
192 c-file-style:"stroustrup"
193 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
194 indent-tabs-mode:nil
195 fill-column:99
196 End:
197*/
198// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
A dialog for XML attributes based on Gtk TreeView.
Bin: widget that can hold one child, useful as a base class of custom widgets.
The set of selected SPObjects for a given document and layer model.
Definition selection.h:80
The AttrDialog class This dialog allows to add, delete and modify XML attributes created in the xml e...
Definition attrdialog.h:53
DialogBase is the base class for the dialog system.
Definition dialog-base.h:40
A dialog widget to view and edit the document xml.
Definition xml-tree.h:57
void cmd_new_element_node()
Callbacks for toolbar buttons being pressed.
Definition xml-tree.cpp:508
void desktopReplaced() final
Called when the desktop has certainly changed.
Definition xml-tree.cpp:788
Gtk::Button & raise_node_button
Definition xml-tree.h:170
static void _set_status_message(Inkscape::MessageType type, const gchar *message, GtkWidget *dialog)
Callbacks for changes in desktop selection and current document.
Definition xml-tree.cpp:397
Inkscape::XML::Node * selected_repr
Signal handlers.
Definition xml-tree.h:147
void set_tree_select(Inkscape::XML::Node *repr, bool edit=false)
Select a node in the xml tree.
Definition xml-tree.cpp:287
Gtk::Button & xml_node_duplicate_button
Definition xml-tree.h:167
Inkscape::XML::Node * _dummy
Definition xml-tree.h:179
Inkscape::XML::Node * get_dt_select()
Find the current desktop selection.
Definition xml-tree.cpp:315
Pref< Glib::ustring > _syntax_theme
Definition xml-tree.h:177
void selectionChanged(Selection *selection) final
Definition xml-tree.cpp:278
Gtk::Button & lower_node_button
Definition xml-tree.h:171
void set_dt_select(Inkscape::XML::Node *repr)
Select the current desktop selection.
Definition xml-tree.cpp:333
Inkscape::XML::Node * _node_parent
Definition xml-tree.h:180
Gtk::Button & unindent_node_button
Definition xml-tree.h:168
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 bou...
Definition xml-tree.cpp:768
void on_tree_select_row_enable(Inkscape::XML::Node *node)
Enable widgets based on current selections.
Definition xml-tree.cpp:404
void propagate_tree_select(Inkscape::XML::Node *repr)
Set the attribute list to match the selected node in the tree.
Definition xml-tree.cpp:301
gint blocked
Flag to ensure only one operation is performed at once.
Definition xml-tree.h:142
bool xml_tree_node_mutable(Inkscape::XML::Node *node)
Is the selected tree node editable.
Definition xml-tree.cpp:464
sigc::scoped_connection _tree_select_idle
Callback for deferring the on_tree_select_row response in order to skip invalid intermediate selectio...
Definition xml-tree.h:101
Gtk::Button & xml_node_delete_button
Definition xml-tree.h:166
Inkscape::UI::Widget::XmlTreeView * _xml_treeview
Definition xml-tree.h:150
void startNodeEditing(Gtk::CellEditable *cell, Glib::ustring const &path)
Definition xml-tree.cpp:528
void stopNodeEditing(bool ok, Glib::ustring const &path, Glib::ustring name)
Definition xml-tree.cpp:538
void setSyntaxStyle(Inkscape::UI::Syntax::XMLStyles const &new_style)
Definition xml-tree.cpp:795
Gtk::Button & indent_node_button
Definition xml-tree.h:169
Gtk::Button & xml_element_new_button
Definition xml-tree.h:164
Gtk::Button & xml_text_new_button
Definition xml-tree.h:165
Glib::RefPtr< Gtk::Builder > _builder
Definition xml-tree.h:155
The Bin is a widget that can hold a single child.
Definition bin.h:31
Interface for refcounted XML nodes.
Definition node.h:80
SPObject is an abstract base class of all of the document nodes at the SVG document level.
Definition sp-object.h:160
SPItem * item
Inkscape::XML::Node * node
Definition desktop.h:50
Helper class to stream background task notifications as a series of messages.
MessageType
A hint about the meaning of a message; is it an ordinary message, a message advising the user of some...
Definition message.h:25
Singleton class to access the preferences file in a convenient way.
Proxy object providing a "live value" interface.
The styles used for simple XML syntax highlighting.
Definition syntax.h:46
Glib::ustring name
Definition toolbars.cpp:55