Inkscape
Vector Graphics Editor
|
The StyleDialog class A list of CSS selectors will show up in this dialog. More...
#include <styledialog.h>
Classes | |
class | CSSData |
class | ModelColumns |
Public Member Functions | |
StyleDialog () | |
Constructor A treeview and a set of two buttons are added to the dialog. | |
~StyleDialog () final | |
void | documentReplaced () final |
Handle document replaced. | |
void | selectionChanged (Selection *selection) final |
void | setCurrentSelector (Glib::ustring current_selector) |
void | readStyleElement () |
Fill the Gtk::TreeStore from the svg:style element. | |
![]() | |
DialogBase (char const *prefs_path=nullptr, Glib::ustring dialog_type={}) | |
DialogBase constructor. | |
DialogBase (DialogBase const &)=delete | |
DialogBase & | operator= (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) |
SPDesktop * | getDesktop () const |
Public Attributes | |
Gtk::TreeView * | _current_css_tree |
Gtk::TreeViewColumn * | _current_value_col |
Gtk::TreeModel::Path | _current_path |
bool | _deletion {false} |
Private Types | |
using | AttrProp = std::map< Glib::ustring, Glib::ustring > |
Private Member Functions | |
void | _nodeAdded (Inkscape::XML::Node &repr) |
void | _nodeRemoved (Inkscape::XML::Node &repr) |
void | _nodeChanged (Inkscape::XML::Node &repr) |
void | removeObservers () |
Inkscape::XML::Node * | _getStyleTextNode (bool create_if_missing=false) |
void | _writeStyleElement (Glib::RefPtr< Gtk::TreeStore > const &store, Glib::ustring selector, Glib::ustring const &new_selector={}) |
Update the content of the style element as selectors (or objects) are added/removed. | |
void | _activeToggled (const Glib::ustring &path, Glib::RefPtr< Gtk::TreeStore > const &store) |
void | _addRow (Glib::RefPtr< Gtk::TreeStore > const &store, Gtk::TreeView *css_tree, Glib::ustring const &selector, int pos) |
void | _onPropDelete (Glib::ustring const &path, Glib::RefPtr< Gtk::TreeStore > const &store) |
StyleDialog::_onPropDelete. | |
void | _nameEdited (const Glib::ustring &path, const Glib::ustring &name, Glib::RefPtr< Gtk::TreeStore > store, Gtk::TreeView *css_tree) |
StyleDialog::nameEdited. | |
void | _addTreeViewHandlers (Gtk::TreeView &treeview) |
void | _setEditingEntry (Gtk::Entry *entry, Glib::ustring endChars) |
void | _onTreeViewKeyReleased (unsigned keyval, unsigned keycode, Gdk::ModifierType state) |
void | _onTreeViewFocusLeave () |
void | _onLinkObj (Glib::ustring const &path, Glib::RefPtr< Gtk::TreeStore > const &store) |
void | _valueEdited (const Glib::ustring &path, const Glib::ustring &value, Glib::RefPtr< Gtk::TreeStore > store) |
StyleDialog::valueEdited. | |
void | _startNameEdit (Gtk::CellEditable *cell, const Glib::ustring &path) |
void | _startValueEdit (Gtk::CellEditable *cell, const Glib::ustring &path, Glib::RefPtr< Gtk::TreeStore > store) |
void | _setAutocompletion (Gtk::Entry *entry, SPStyleEnum const cssenum[]) |
void | _setAutocompletion (Gtk::Entry *entry, Glib::ustring name) |
bool | _on_foreach_iter (const Gtk::TreeModel::iterator &iter) |
void | _reload () |
void | _vscroll () |
std::vector< SPObject * > | _getObjVec (Glib::ustring selector) |
AttrProp | parseStyle (Glib::ustring style_string) |
StyleDialog::parseStyle. | |
void | _addOwnerStyle (Glib::ustring name, Glib::ustring selector) |
void | _closeDialog (Gtk::Dialog *textDialogPtr) |
Private Attributes | |
ModelColumns | _mColumns |
CSSData | _mCSSData |
unsigned | _deleted_pos {0} |
Gtk::ScrolledWindow | _scrolledWindow |
Glib::RefPtr< Gtk::Adjustment > | _vadj |
Gtk::Box | _mainBox |
Gtk::Box | _styleBox |
Gtk::Entry * | _editingEntry = nullptr |
bool | _scrollock |
double | _scrollpos {0} |
Glib::ustring | _current_selector |
std::unique_ptr< XML::NodeObserver > const | m_nodewatcher |
std::unique_ptr< XML::NodeObserver > const | m_styletextwatcher |
AttrProp | _owner_style |
Inkscape::XML::Node * | m_root {nullptr} |
Inkscape::XML::Node * | _textNode {nullptr} |
bool | _updating {false} |
Additional Inherited Members | |
![]() | |
InkscapeApplication * | getApp () const |
SPDocument * | getDocument () const |
Selection * | getSelection () const |
void | setShowing (bool showing) |
function called from notebook dialog that performs an update of the dialog and sets the dialog showing state true | |
![]() | |
Glib::ustring | _name |
Glib::ustring const | _prefs_path |
Glib::ustring const | _dialog_type |
The StyleDialog class A list of CSS selectors will show up in this dialog.
This dialog allows one to add and delete selectors. Elements can be added to and removed from the selectors in the dialog. Selection of any selector row selects the matching objects in the drawing and vice-versa. (Only simple selectors supported for now.)
This class must keep two things in sync:
Definition at line 63 of file styledialog.h.
|
private |
Definition at line 80 of file styledialog.h.
Inkscape::UI::Dialog::StyleDialog::StyleDialog | ( | ) |
Constructor A treeview and a set of two buttons are added to the dialog.
_addSelector adds selectors to treeview. _delSelector deletes the selector from the dialog. Any addition/deletion of the selectors updates XML style element accordingly.
Definition at line 210 of file styledialog.cpp.
References _mainBox, _scrolledWindow, _styleBox, _vadj, _vscroll(), Inkscape::UI::expand_widget, and Inkscape::UI::pack_start().
|
final |
Definition at line 234 of file styledialog.cpp.
References removeObservers().
|
private |
Definition at line 1305 of file styledialog.cpp.
References Inkscape::UI::Dialog::StyleDialog::ModelColumns::_colActive, Inkscape::UI::Dialog::StyleDialog::ModelColumns::_colSelector, _mColumns, _scrollock, _writeStyleElement(), and store.
Referenced by readStyleElement().
|
private |
Definition at line 872 of file styledialog.cpp.
References _owner_style, and name.
Referenced by readStyleElement().
|
private |
Definition at line 1035 of file styledialog.cpp.
References Inkscape::UI::Dialog::StyleDialog::ModelColumns::_colActive, Inkscape::UI::Dialog::StyleDialog::ModelColumns::_colSelector, Inkscape::UI::Dialog::StyleDialog::ModelColumns::_colSelectorPos, _mColumns, and store.
Referenced by readStyleElement().
|
private |
Definition at line 1318 of file styledialog.cpp.
References _onTreeViewFocusLeave(), _onTreeViewKeyReleased(), and key.
Referenced by readStyleElement().
|
private |
Definition at line 1399 of file styledialog.cpp.
|
private |
selector | a valid CSS selector string. |
Definition at line 1390 of file styledialog.cpp.
References Inkscape::UI::Dialog::DialogBase::getDocument(), and SPDocument::getObjectsBySelector().
Referenced by _valueEdited(), and readStyleElement().
|
private |
Definition at line 256 of file styledialog.cpp.
References _textNode, Inkscape::XML::Node::addObserver(), Inkscape::UI::Dialog::get_first_style_text_node(), m_root, m_styletextwatcher, and Inkscape::XML::Node::removeObserver().
Referenced by _writeStyleElement(), and readStyleElement().
|
private |
StyleDialog::nameEdited.
event | Called when the name is edited in the TreeView editable column |
Definition at line 1208 of file styledialog.cpp.
References Inkscape::UI::Dialog::StyleDialog::ModelColumns::_colName, Inkscape::UI::Dialog::StyleDialog::ModelColumns::_colSelector, Inkscape::UI::Dialog::StyleDialog::ModelColumns::_colSelectorPos, Inkscape::UI::Dialog::StyleDialog::ModelColumns::_colValue, _current_css_tree, _current_path, _current_value_col, _deleted_pos, _mColumns, _scrollock, _writeStyleElement(), name, Inkscape::UI::Dialog::sp_styledialog_store_move_to_next(), and store.
Referenced by readStyleElement().
|
private |
Definition at line 175 of file styledialog.cpp.
References Inkscape::UI::Dialog::DialogBase::getShowing(), and readStyleElement().
|
private |
Definition at line 195 of file styledialog.cpp.
References Inkscape::UI::Dialog::DialogBase::getShowing(), and readStyleElement().
|
private |
Definition at line 183 of file styledialog.cpp.
References _textNode, Inkscape::UI::Dialog::DialogBase::getShowing(), and readStyleElement().
|
private |
Definition at line 815 of file styledialog.cpp.
References Inkscape::UI::Dialog::StyleDialog::ModelColumns::_colName, Inkscape::UI::Dialog::StyleDialog::ModelColumns::_colOwner, Inkscape::UI::Dialog::StyleDialog::ModelColumns::_colStrike, _mColumns, and _owner_style.
Referenced by readStyleElement().
|
private |
Definition at line 834 of file styledialog.cpp.
References Inkscape::UI::Dialog::StyleDialog::ModelColumns::_colHref, Inkscape::UI::Dialog::StyleDialog::ModelColumns::_colLinked, _mColumns, Inkscape::ObjectSet::clear(), Inkscape::UI::Dialog::DialogBase::getDocument(), Inkscape::UI::Dialog::DialogBase::getSelection(), Inkscape::UI::Dialog::DialogBase::selection, Inkscape::Selection::set(), SPDocument::setXMLDialogSelectedObject(), and store.
Referenced by readStyleElement().
|
private |
event |
Definition at line 856 of file styledialog.cpp.
References Inkscape::UI::Dialog::StyleDialog::ModelColumns::_colName, Inkscape::UI::Dialog::StyleDialog::ModelColumns::_colSelector, Inkscape::UI::Dialog::StyleDialog::ModelColumns::_colSelectorPos, _deleted_pos, _deletion, _mColumns, _writeStyleElement(), and store.
Referenced by readStyleElement().
|
private |
Definition at line 1373 of file styledialog.cpp.
References _editingEntry.
Referenced by _addTreeViewHandlers().
|
private |
Definition at line 1361 of file styledialog.cpp.
References _editingEntry.
Referenced by _addTreeViewHandlers().
|
private |
Definition at line 249 of file styledialog.cpp.
References readStyleElement().
|
private |
Definition at line 1075 of file styledialog.cpp.
References Inkscape::UI::Dialog::StyleDialog::CSSData::_colCSSData, _mCSSData, and name.
|
private |
Definition at line 1053 of file styledialog.cpp.
References Inkscape::UI::Dialog::StyleDialog::CSSData::_colCSSData, _mCSSData, counter, key, and SPStyleEnum::key.
Referenced by _startValueEdit().
|
private |
Definition at line 1335 of file styledialog.cpp.
References _editingEntry, and _setEditingEntry().
Referenced by _setEditingEntry(), _startNameEdit(), and _startValueEdit().
|
private |
Definition at line 1164 of file styledialog.cpp.
References Inkscape::UI::Dialog::StyleDialog::CSSData::_colCSSData, _mCSSData, _scrollock, _setEditingEntry(), and sp_attribute_name_list().
Referenced by readStyleElement().
|
private |
Definition at line 1103 of file styledialog.cpp.
References Inkscape::UI::Dialog::StyleDialog::ModelColumns::_colName, _mColumns, _scrollock, _setAutocompletion(), _setEditingEntry(), enum_baseline_shift, enum_clip_rule, enum_color_interpolation, enum_color_rendering, enum_direction, enum_display, enum_fill_rule, enum_font_stretch, enum_font_style, enum_font_variant, enum_font_variant_position, enum_font_weight, enum_overflow, enum_shape_rendering, enum_stroke_linecap, enum_stroke_linejoin, enum_text_align, enum_text_anchor, enum_text_transform, enum_visibility, enum_white_space, name, and store.
Referenced by readStyleElement().
|
private |
StyleDialog::valueEdited.
event |
Definition at line 1262 of file styledialog.cpp.
References Inkscape::UI::Dialog::StyleDialog::ModelColumns::_colName, Inkscape::UI::Dialog::StyleDialog::ModelColumns::_colSelector, Inkscape::UI::Dialog::StyleDialog::ModelColumns::_colSelectorPos, Inkscape::UI::Dialog::StyleDialog::ModelColumns::_colValue, _deleted_pos, _getObjVec(), _mColumns, _scrollock, _writeStyleElement(), css, name, sp_repr_css_attr_add_from_string(), sp_repr_css_attr_new(), sp_repr_css_write_string(), and store.
Referenced by readStyleElement().
|
private |
Definition at line 239 of file styledialog.cpp.
References _scrollock, _scrollpos, and _vadj.
Referenced by StyleDialog().
|
private |
Update the content of the style element as selectors (or objects) are added/removed.
Definition at line 918 of file styledialog.cpp.
References Inkscape::UI::Dialog::StyleDialog::ModelColumns::_colActive, Inkscape::UI::Dialog::StyleDialog::ModelColumns::_colName, Inkscape::UI::Dialog::StyleDialog::ModelColumns::_colSelector, Inkscape::UI::Dialog::StyleDialog::ModelColumns::_colSelectorPos, Inkscape::UI::Dialog::StyleDialog::ModelColumns::_colValue, _deleted_pos, _getStyleTextNode(), _mColumns, _scrollock, _updating, Inkscape::append(), Inkscape::XML::Node::attribute(), Inkscape::XML::Node::content(), D, Inkscape::DocumentUndo::done(), FONT, Inkscape::UI::Dialog::DialogBase::getDocument(), SPDocument::getObjectsBySelector(), SPObject::getRepr(), Inkscape::UI::Dialog::DialogBase::getSelection(), SPDocument::getXMLDialogSelectedObject(), key, MARKER, name, Inkscape::ObjectSet::objects(), SPStyle::properties(), readStyleElement(), Inkscape::XML::Node::removeAttribute(), result, Inkscape::UI::Dialog::DialogBase::selection, Inkscape::XML::Node::setAttribute(), Inkscape::XML::Node::setContent(), store, and SPObject::style.
Referenced by _activeToggled(), _nameEdited(), _onPropDelete(), and _valueEdited().
|
finalvirtual |
Handle document replaced.
(Happens when a default document is immediately replaced by another document in a new window.)
Reimplemented from Inkscape::UI::Dialog::DialogBase.
Definition at line 1418 of file styledialog.cpp.
References Inkscape::XML::Node::addSubtreeObserver(), Inkscape::UI::Dialog::DialogBase::document, Inkscape::UI::Dialog::DialogBase::getDocument(), SPDocument::getReprRoot(), m_nodewatcher, m_root, readStyleElement(), and removeObservers().
|
private |
Convert a style string into a vector map. This should be moved to style.cpp
Definition at line 888 of file styledialog.cpp.
References props, and Inkscape::Util::trim().
Referenced by readStyleElement().
void Inkscape::UI::Dialog::StyleDialog::readStyleElement | ( | ) |
Fill the Gtk::TreeStore from the svg:style element.
Definition at line 299 of file styledialog.cpp.
References _activeToggled(), _addOwnerStyle(), _addRow(), _addTreeViewHandlers(), Inkscape::UI::Dialog::StyleDialog::ModelColumns::_colActive, Inkscape::UI::Dialog::StyleDialog::ModelColumns::_colHref, Inkscape::UI::Dialog::StyleDialog::ModelColumns::_colLinked, Inkscape::UI::Dialog::StyleDialog::ModelColumns::_colName, Inkscape::UI::Dialog::StyleDialog::ModelColumns::_colOwner, Inkscape::UI::Dialog::StyleDialog::ModelColumns::_colSelector, Inkscape::UI::Dialog::StyleDialog::ModelColumns::_colSelectorPos, Inkscape::UI::Dialog::StyleDialog::ModelColumns::_colStrike, Inkscape::UI::Dialog::StyleDialog::ModelColumns::_colValue, _current_selector, _deletion, _getObjVec(), _getStyleTextNode(), _mColumns, _nameEdited(), _on_foreach_iter(), _onLinkObj(), _onPropDelete(), _owner_style, _scrollock, _startNameEdit(), _startValueEdit(), _styleBox, _updating, _valueEdited(), Inkscape::XML::Node::attribute(), builder, Inkscape::XML::Node::content(), Inkscape::UI::create_builder(), D, Inkscape::UI::Dialog::DialogBase::document, Inkscape::UI::end, Inkscape::UI::expand_widget, FONT, Inkscape::UI::get_children(), Inkscape::UI::Dialog::DialogBase::getDocument(), SPDocument::getObjectById(), SPObject::getRepr(), Inkscape::UI::Dialog::DialogBase::getSelection(), SPDocument::getXMLDialogSelectedObject(), Inkscape::UI::Dialog::is_url(), key, label, MARKER, name, node, Inkscape::ObjectSet::objects(), Inkscape::UI::pack_start(), parseStyle(), SPStyle::properties(), SPStyle::readFromObject(), Inkscape::UI::remove_all_children(), SPObject::requestDisplayUpdate(), Inkscape::UI::Dialog::DialogBase::selection, Inkscape::UI::start, store, SPObject::style, Inkscape::Util::trim(), and UNSET.
Referenced by _nodeAdded(), _nodeChanged(), _nodeRemoved(), _reload(), _writeStyleElement(), documentReplaced(), selectionChanged(), and setCurrentSelector().
|
private |
Definition at line 1402 of file styledialog.cpp.
References _textNode, m_nodewatcher, m_root, m_styletextwatcher, Inkscape::XML::Node::removeObserver(), and Inkscape::XML::Node::removeSubtreeObserver().
Referenced by documentReplaced(), and ~StyleDialog().
|
finalvirtual |
Reimplemented from Inkscape::UI::Dialog::DialogBase.
Definition at line 1431 of file styledialog.cpp.
References _scrollpos, _vadj, Inkscape::UI::Dialog::DialogBase::getDesktop(), and readStyleElement().
void Inkscape::UI::Dialog::StyleDialog::setCurrentSelector | ( | Glib::ustring | current_selector | ) |
Definition at line 277 of file styledialog.cpp.
References _current_selector, and readStyleElement().
Gtk::TreeView* Inkscape::UI::Dialog::StyleDialog::_current_css_tree |
Definition at line 73 of file styledialog.h.
Referenced by _nameEdited(), and Inkscape::UI::Dialog::sp_styledialog_store_move_to_next().
Gtk::TreeModel::Path Inkscape::UI::Dialog::StyleDialog::_current_path |
Definition at line 75 of file styledialog.h.
Referenced by _nameEdited(), and Inkscape::UI::Dialog::sp_styledialog_store_move_to_next().
|
private |
Definition at line 170 of file styledialog.h.
Referenced by readStyleElement(), and setCurrentSelector().
Gtk::TreeViewColumn* Inkscape::UI::Dialog::StyleDialog::_current_value_col |
Definition at line 74 of file styledialog.h.
Referenced by _nameEdited(), and Inkscape::UI::Dialog::sp_styledialog_store_move_to_next().
|
private |
Definition at line 125 of file styledialog.h.
Referenced by _nameEdited(), _onPropDelete(), _valueEdited(), and _writeStyleElement().
bool Inkscape::UI::Dialog::StyleDialog::_deletion {false} |
Definition at line 76 of file styledialog.h.
Referenced by _onPropDelete(), and readStyleElement().
|
private |
Definition at line 150 of file styledialog.h.
Referenced by _onTreeViewFocusLeave(), _onTreeViewKeyReleased(), and _setEditingEntry().
|
private |
Definition at line 130 of file styledialog.h.
Referenced by StyleDialog().
|
private |
Definition at line 116 of file styledialog.h.
Referenced by _activeToggled(), _addRow(), _nameEdited(), _on_foreach_iter(), _onLinkObj(), _onPropDelete(), _startValueEdit(), _valueEdited(), _writeStyleElement(), and readStyleElement().
|
private |
Definition at line 123 of file styledialog.h.
Referenced by _setAutocompletion(), _setAutocompletion(), and _startNameEdit().
|
private |
Definition at line 179 of file styledialog.h.
Referenced by _addOwnerStyle(), _on_foreach_iter(), and readStyleElement().
|
private |
Definition at line 128 of file styledialog.h.
Referenced by StyleDialog().
|
private |
Definition at line 168 of file styledialog.h.
Referenced by _activeToggled(), _nameEdited(), _startNameEdit(), _startValueEdit(), _valueEdited(), _vscroll(), _writeStyleElement(), and readStyleElement().
|
private |
Definition at line 169 of file styledialog.h.
Referenced by _vscroll(), and selectionChanged().
|
private |
Definition at line 131 of file styledialog.h.
Referenced by readStyleElement(), and StyleDialog().
|
private |
Definition at line 184 of file styledialog.h.
Referenced by _getStyleTextNode(), _nodeRemoved(), and removeObservers().
|
private |
Definition at line 185 of file styledialog.h.
Referenced by _writeStyleElement(), and readStyleElement().
|
private |
Definition at line 129 of file styledialog.h.
Referenced by _vscroll(), selectionChanged(), and StyleDialog().
|
private |
Definition at line 173 of file styledialog.h.
Referenced by documentReplaced(), and removeObservers().
|
private |
Definition at line 183 of file styledialog.h.
Referenced by _getStyleTextNode(), documentReplaced(), and removeObservers().
|
private |
Definition at line 174 of file styledialog.h.
Referenced by _getStyleTextNode(), and removeObservers().