diff options
| -rw-r--r-- | clang_format_diff | 1476 | ||||
| -rw-r--r-- | src/attributes.cpp | 3 | ||||
| -rw-r--r-- | src/attributes.h | 2 | ||||
| -rw-r--r-- | src/ui/dialog/styledialog.cpp | 30 | ||||
| -rw-r--r-- | src/ui/dialog/styledialog.h | 15 | ||||
| -rw-r--r-- | src/ui/widget/ink-flow-box.cpp | 6 |
6 files changed, 23 insertions, 1509 deletions
diff --git a/clang_format_diff b/clang_format_diff deleted file mode 100644 index 4999b6f40..000000000 --- a/clang_format_diff +++ /dev/null @@ -1,1476 +0,0 @@ ---- src/ui/dialog/styledialog.h (before formatting) -+++ src/ui/dialog/styledialog.h (after formatting) -@@ -15,18 +15,18 @@ - #ifndef STYLEDIALOG_H - #define STYLEDIALOG_H - --#include <ui/widget/panel.h> --#include <gtkmm/treeview.h> --#include <gtkmm/treestore.h> --#include <gtkmm/treemodelfilter.h> --#include <gtkmm/scrolledwindow.h> -+#include <glibmm/regex.h> -+#include <gtkmm/builder.h> - #include <gtkmm/dialog.h> --#include <gtkmm/treeselection.h> --#include <gtkmm/switch.h> - #include <gtkmm/eventbox.h> - #include <gtkmm/paned.h> --#include <glibmm/regex.h> --#include <gtkmm/builder.h> -+#include <gtkmm/scrolledwindow.h> -+#include <gtkmm/switch.h> -+#include <gtkmm/treemodelfilter.h> -+#include <gtkmm/treeselection.h> -+#include <gtkmm/treestore.h> -+#include <gtkmm/treeview.h> -+#include <ui/widget/panel.h> - - #include "ui/dialog/desktop-tracker.h" - -@@ -49,7 +49,7 @@ - */ - class StyleDialog : public Widget::Panel { - --public: -+ public: - ~StyleDialog() override; - // No default constructor, noncopyable, nonassignable - StyleDialog(); -@@ -57,6 +57,7 @@ - StyleDialog operator=(StyleDialog const &d) = delete; - - static StyleDialog &getInstance() { return *new StyleDialog(); } -+ - private: - // Monitor <style> element for changes. - class NodeObserver; -@@ -64,15 +65,16 @@ - class NodeWatcher; - Glib::RefPtr<Glib::Regex> r_props = Glib::Regex::create("\\s*;\\s*"); - Glib::RefPtr<Glib::Regex> r_pair = Glib::Regex::create("\\s*:\\s*"); -- std::vector<StyleDialog::NodeWatcher*> _nodeWatchers; -- void _nodeAdded( Inkscape::XML::Node &repr ); -- void _nodeRemoved( Inkscape::XML::Node &repr ); -- void _nodeChanged( Inkscape::XML::Node &repr ); -+ std::vector<StyleDialog::NodeWatcher *> _nodeWatchers; -+ void _nodeAdded(Inkscape::XML::Node &repr); -+ void _nodeRemoved(Inkscape::XML::Node &repr); -+ void _nodeChanged(Inkscape::XML::Node &repr); - /* void _stylesheetChanged( Inkscape::XML::Node &repr ); */ - // Data structure - class ModelColumns : public Gtk::TreeModel::ColumnRecord { -- public: -- ModelColumns() { -+ public: -+ ModelColumns() -+ { - add(_colActive); - add(_colName); - add(_colValue); -@@ -80,36 +82,37 @@ - add(_colSelector); - add(_colSelectorPos); - } -- Gtk::TreeModelColumn<bool> _colActive; // Active or inative property -- Gtk::TreeModelColumn<Glib::ustring> _colName; // Name of the property. -- Gtk::TreeModelColumn<Glib::ustring> _colValue; // Value of the property. -- Gtk::TreeModelColumn<bool> _colStrike; // Propery not used, overloaded -- Gtk::TreeModelColumn<Glib::ustring> _colSelector; // Style or matching object id. -- Gtk::TreeModelColumn<gint> _colSelectorPos; // Position of the selector to hadle dup selectors -- -+ Gtk::TreeModelColumn<bool> _colActive; // Active or inative property -+ Gtk::TreeModelColumn<Glib::ustring> _colName; // Name of the property. -+ Gtk::TreeModelColumn<Glib::ustring> _colValue; // Value of the property. -+ Gtk::TreeModelColumn<bool> _colStrike; // Propery not used, overloaded -+ Gtk::TreeModelColumn<Glib::ustring> _colSelector; // Style or matching object id. -+ Gtk::TreeModelColumn<gint> _colSelectorPos; // Position of the selector to hadle dup selectors - }; - ModelColumns _mColumns; - - // Widgets - Gtk::ScrolledWindow _scrolledWindow; -- Gtk::Box _mainBox; -- Gtk::Box _styleBox; -+ Gtk::Box _mainBox; -+ Gtk::Box _styleBox; - Gtk::Switch *_all_css; - // Reading and writing the style element. - Inkscape::XML::Node *_getStyleTextNode(); - void _readStyleElement(); -- Glib::RefPtr< Gtk::TreeModel > _selectTree(Glib::ustring selector); -+ Glib::RefPtr<Gtk::TreeModel> _selectTree(Glib::ustring selector); - void _writeStyleElement(Glib::RefPtr<Gtk::TreeStore> store, Glib::ustring selector); -- void _activeToggled(const Glib::ustring& path, Glib::RefPtr<Gtk::TreeStore> store); -- bool _addRow(GdkEventButton *evt, Glib::RefPtr<Gtk::TreeStore> store, Gtk::TreeView *css_tree, Glib::ustring selector, gint pos); -- void _nameEdited(const Glib::ustring& path, const Glib::ustring& name, Glib::RefPtr<Gtk::TreeStore> store, Gtk::TreeView *css_tree); -- void _valueEdited(const Glib::ustring& path, const Glib::ustring& value, Glib::RefPtr<Gtk::TreeStore> store); -+ void _activeToggled(const Glib::ustring &path, Glib::RefPtr<Gtk::TreeStore> store); -+ bool _addRow(GdkEventButton *evt, Glib::RefPtr<Gtk::TreeStore> store, Gtk::TreeView *css_tree, -+ Glib::ustring selector, gint pos); -+ void _nameEdited(const Glib::ustring &path, const Glib::ustring &name, Glib::RefPtr<Gtk::TreeStore> store, -+ Gtk::TreeView *css_tree); -+ void _valueEdited(const Glib::ustring &path, const Glib::ustring &value, Glib::RefPtr<Gtk::TreeStore> store); - void _onPropDelete(Glib::ustring path, Glib::RefPtr<Gtk::TreeStore> store); - void _reload(); - - // Update watchers - void _addWatcherRecursive(Inkscape::XML::Node *node); -- void _updateWatchers(); -+ void _updateWatchers(); - - // Manipulate Tree - std::vector<SPObject *> _getObjVec(Glib::ustring selector); -@@ -117,21 +120,21 @@ - - // Variables - Inkscape::XML::Node *_textNode; // Track so we know when to add a NodeObserver. -- bool _updating; // Prevent cyclic actions: read <-> write, select via dialog <-> via desktop -+ bool _updating; // Prevent cyclic actions: read <-> write, select via dialog <-> via desktop - - // Signals and handlers - External - sigc::connection _document_replaced_connection; - sigc::connection _desktop_changed_connection; - sigc::connection _selection_changed_connection; - -- void _handleDocumentReplaced(SPDesktop* desktop, SPDocument *document); -- void _handleDesktopChanged(SPDesktop* desktop); -+ void _handleDocumentReplaced(SPDesktop *desktop, SPDocument *document); -+ void _handleDesktopChanged(SPDesktop *desktop); - void _handleSelectionChanged(); - void _closeDialog(Gtk::Dialog *textDialogPtr); - DesktopTracker _desktopTracker; - }; - --} // namespace Dialogc -+} // namespace Dialog - } // namespace UI - } // namespace Inkscape - ---- src/ui/dialog/xml-tree.cpp (before formatting) -+++ src/ui/dialog/xml-tree.cpp (after formatting) -@@ -356,11 +356,11 @@ - repr->type() == Inkscape::XML::COMMENT_NODE)) - { - attributes->setRepr(repr); -- //styles->setRepr(repr); -+ // styles->setRepr(repr); - // selectors->setRepr(repr); - } else { - attributes->setRepr(nullptr); -- //styles->setRepr(nullptr); -+ // styles->setRepr(nullptr); - // selectors->setRepr(nullptr); - } - } ---- src/ui/dialog/xml-tree.h (before formatting) -+++ src/ui/dialog/xml-tree.h (after formatting) -@@ -27,10 +27,10 @@ - - #include "message.h" - -+#include "ui/dialog/attrdialog.h" -+#include "ui/dialog/desktop-tracker.h" - #include "ui/dialog/selectordialog.h" --#include "ui/dialog/attrdialog.h" - #include "ui/dialog/styledialog.h" --#include "ui/dialog/desktop-tracker.h" - - - class SPDesktop; ---- src/ui/dialog/styledialog.cpp (before formatting) -+++ src/ui/dialog/styledialog.cpp (after formatting) -@@ -13,24 +13,23 @@ - */ - - #include "styledialog.h" -+#include "attribute-rel-svg.h" - #include "attributes.h" --#include "verbs.h" --#include "selection.h" --#include "attribute-rel-svg.h" -+#include "document-undo.h" - #include "inkscape.h" --#include "document-undo.h" -+#include "io/resource.h" - #include "selection.h" - #include "style-internal.h" - #include "style.h" --#include "io/resource.h" - #include "ui/icon-loader.h" - #include "ui/widget/iconrenderer.h" -+#include "verbs.h" - - #include "xml/attribute-record.h" - #include "xml/node-observer.h" - -+#include <map> - #include <regex> --#include <map> - #include <utility> - - #include <glibmm/i18n.h> -@@ -46,7 +45,8 @@ - * This macro is used to remove spaces around selectors or any strings when - * parsing is done to update XML style element or row labels in this dialog. - */ --#define REMOVE_SPACES(x) x.erase(0, x.find_first_not_of(' ')); \ -+#define REMOVE_SPACES(x) \ -+ x.erase(0, x.find_first_not_of(' ')); \ - x.erase(x.find_last_not_of(' ') + 1); - - namespace Inkscape { -@@ -55,26 +55,24 @@ - - // Keeps a watch on style element - class StyleDialog::NodeObserver : public Inkscape::XML::NodeObserver { --public: -- NodeObserver(StyleDialog* styledialog) : -- _styledialog(styledialog) -+ public: -+ NodeObserver(StyleDialog *styledialog) -+ : _styledialog(styledialog) - { - g_debug("StyleDialog::NodeObserver: Constructor"); - }; - -- void notifyContentChanged(Inkscape::XML::Node &node, -- Inkscape::Util::ptr_shared old_content, -- Inkscape::Util::ptr_shared new_content) override; -- -- StyleDialog * _styledialog; -+ void notifyContentChanged(Inkscape::XML::Node &node, Inkscape::Util::ptr_shared old_content, -+ Inkscape::Util::ptr_shared new_content) override; -+ -+ StyleDialog *_styledialog; - }; - - --void --StyleDialog::NodeObserver::notifyContentChanged( -- Inkscape::XML::Node &/*node*/, -- Inkscape::Util::ptr_shared /*old_content*/, -- Inkscape::Util::ptr_shared /*new_content*/ ) { -+void StyleDialog::NodeObserver::notifyContentChanged(Inkscape::XML::Node & /*node*/, -+ Inkscape::Util::ptr_shared /*old_content*/, -+ Inkscape::Util::ptr_shared /*new_content*/) -+{ - - g_debug("StyleDialog::NodeObserver::notifyContentChanged"); - _styledialog->_updating = false; -@@ -85,61 +83,58 @@ - // Keeps a watch for new/removed/changed nodes - // (Must update objects that selectors match.) - class StyleDialog::NodeWatcher : public Inkscape::XML::NodeObserver { --public: -- NodeWatcher(StyleDialog* styledialog, Inkscape::XML::Node *repr) : -- _styledialog(styledialog), -- _repr(repr) -+ public: -+ NodeWatcher(StyleDialog *styledialog, Inkscape::XML::Node *repr) -+ : _styledialog(styledialog) -+ , _repr(repr) - { - g_debug("StyleDialog::NodeWatcher: Constructor"); - }; - -- void notifyChildAdded( Inkscape::XML::Node &/*node*/, -- Inkscape::XML::Node &child, -- Inkscape::XML::Node */*prev*/ ) override -+ void notifyChildAdded(Inkscape::XML::Node & /*node*/, Inkscape::XML::Node &child, -+ Inkscape::XML::Node * /*prev*/) override - { -- if ( _styledialog && _repr ) { -- _styledialog->_nodeAdded( child ); -- } -- } -- -- void notifyChildRemoved( Inkscape::XML::Node &/*node*/, -- Inkscape::XML::Node &child, -- Inkscape::XML::Node */*prev*/ ) override -+ if (_styledialog && _repr) { -+ _styledialog->_nodeAdded(child); -+ } -+ } -+ -+ void notifyChildRemoved(Inkscape::XML::Node & /*node*/, Inkscape::XML::Node &child, -+ Inkscape::XML::Node * /*prev*/) override - { -- if ( _styledialog && _repr ) { -- _styledialog->_nodeRemoved( child ); -- } -- } --/* void notifyContentChanged(Inkscape::XML::Node &node, -- Inkscape::Util::ptr_shared old_content, -- Inkscape::Util::ptr_shared new_content) override{ -- if ( _styledialog && _repr && _textNode == node) { -- _styledialog->_stylesheetChanged( node ); -- } -- }; -- */ -- void notifyAttributeChanged( Inkscape::XML::Node &node, -- GQuark qname, -- Util::ptr_shared /*old_value*/, -- Util::ptr_shared /*new_value*/ ) override { -- if ( _styledialog && _repr ) { -+ if (_styledialog && _repr) { -+ _styledialog->_nodeRemoved(child); -+ } -+ } -+ /* void notifyContentChanged(Inkscape::XML::Node &node, -+ Inkscape::Util::ptr_shared old_content, -+ Inkscape::Util::ptr_shared new_content) override{ -+ if ( _styledialog && _repr && _textNode == node) { -+ _styledialog->_stylesheetChanged( node ); -+ } -+ }; -+ */ -+ void notifyAttributeChanged(Inkscape::XML::Node &node, GQuark qname, Util::ptr_shared /*old_value*/, -+ Util::ptr_shared /*new_value*/) override -+ { -+ if (_styledialog && _repr) { - - // For the moment only care about attributes that are directly used in selectors. -- const gchar * cname = g_quark_to_string (qname); -+ const gchar *cname = g_quark_to_string(qname); - Glib::ustring name; - if (cname) { - name = cname; - } - -- if ( name == "id" || name == "class" || name == "style" ) { -- _styledialog->_nodeChanged( node ); -+ if (name == "id" || name == "class" || name == "style") { -+ _styledialog->_nodeChanged(node); - } - SPObject *obj = SP_ACTIVE_DOCUMENT->getObjectById(node.attribute("id")); - if (obj) { - for (auto iter : obj->style->properties()) { - if (iter->style_src != SP_STYLE_SRC_UNSET) { -- if( iter->name == name) { -- _styledialog->_nodeChanged( node ); -+ if (iter->name == name) { -+ _styledialog->_nodeChanged(node); - } - } - } -@@ -147,37 +142,34 @@ - } - } - -- StyleDialog * _styledialog; -- Inkscape::XML::Node * _repr; // Need to track if document changes. -+ StyleDialog *_styledialog; -+ Inkscape::XML::Node *_repr; // Need to track if document changes. - }; - --void --StyleDialog::_nodeAdded( Inkscape::XML::Node &node ) { -- -- StyleDialog::NodeWatcher *w = new StyleDialog::NodeWatcher (this, &node); -- node.addObserver (*w); -+void StyleDialog::_nodeAdded(Inkscape::XML::Node &node) -+{ -+ -+ StyleDialog::NodeWatcher *w = new StyleDialog::NodeWatcher(this, &node); -+ node.addObserver(*w); - _nodeWatchers.push_back(w); - - _readStyleElement(); - } - --void --StyleDialog::_nodeRemoved( Inkscape::XML::Node &repr ) { -+void StyleDialog::_nodeRemoved(Inkscape::XML::Node &repr) -+{ - - for (auto it = _nodeWatchers.begin(); it != _nodeWatchers.end(); ++it) { -- if ( (*it)->_repr == &repr ) { -- (*it)->_repr->removeObserver (**it); -- _nodeWatchers.erase( it ); -+ if ((*it)->_repr == &repr) { -+ (*it)->_repr->removeObserver(**it); -+ _nodeWatchers.erase(it); - break; - } - } - _readStyleElement(); - } - --void --StyleDialog::_nodeChanged( Inkscape::XML::Node &object ) { -- _readStyleElement(); --} -+void StyleDialog::_nodeChanged(Inkscape::XML::Node &object) { _readStyleElement(); } - - /* void - StyleDialog::_stylesheetChanged( Inkscape::XML::Node &repr ) { -@@ -191,11 +183,11 @@ - * adds selectors to treeview. _delSelector deletes the selector from the dialog. - * Any addition/deletion of the selectors updates XML style element accordingly. - */ --StyleDialog::StyleDialog() : -- UI::Widget::Panel("/dialogs/style", SP_VERB_DIALOG_STYLE), -- _updating(false), -- _textNode(nullptr), -- _desktopTracker() -+StyleDialog::StyleDialog() -+ : UI::Widget::Panel("/dialogs/style", SP_VERB_DIALOG_STYLE) -+ , _updating(false) -+ , _textNode(nullptr) -+ , _desktopTracker() - { - g_debug("StyleDialog::StyleDialog"); - // Pack widgets -@@ -204,8 +196,8 @@ - _styleBox.set_orientation(Gtk::ORIENTATION_VERTICAL); - _styleBox.set_valign(Gtk::ALIGN_START); - _scrolledWindow.add(_styleBox); -- Gtk::Box *alltoggler = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL)); -- Gtk::Label *infotoggler = Gtk::manage(new Gtk::Label(_("Edit Full Stylesheet"))); -+ Gtk::Box *alltoggler = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL)); -+ Gtk::Label *infotoggler = Gtk::manage(new Gtk::Label(_("Edit Full Stylesheet"))); - _all_css = Gtk::manage(new Gtk::Switch()); - _all_css->get_style_context()->add_class("switchclean"); - _all_css->set_margin_right(5); -@@ -218,13 +210,13 @@ - _mainBox.set_orientation(Gtk::ORIENTATION_VERTICAL); - _getContents()->pack_start(_mainBox, Gtk::PACK_EXPAND_WIDGET); - // Document & Desktop -- _desktop_changed_connection = _desktopTracker.connectDesktopChanged( -- sigc::mem_fun(*this, &StyleDialog::_handleDesktopChanged) ); -+ _desktop_changed_connection = -+ _desktopTracker.connectDesktopChanged(sigc::mem_fun(*this, &StyleDialog::_handleDesktopChanged)); - _desktopTracker.connect(GTK_WIDGET(gobj())); - -- _document_replaced_connection = getDesktop()->connectDocumentReplaced( -- sigc::mem_fun(this, &StyleDialog::_handleDocumentReplaced)); -- -+ _document_replaced_connection = -+ getDesktop()->connectDocumentReplaced(sigc::mem_fun(this, &StyleDialog::_handleDocumentReplaced)); -+ - _selection_changed_connection = getDesktop()->getSelection()->connectChanged( - sigc::hide(sigc::mem_fun(this, &StyleDialog::_handleSelectionChanged))); - // Add watchers -@@ -245,18 +237,14 @@ - _selection_changed_connection.disconnect(); - } - --void --StyleDialog::_reload() --{ -- _readStyleElement(); --} -+void StyleDialog::_reload() { _readStyleElement(); } - - /** - * @return Inkscape::XML::Node* pointing to a style element's text node. - * Returns the style element's text node. If there is no style element, one is created. - * Ditto for text node. - */ --Inkscape::XML::Node* StyleDialog::_getStyleTextNode() -+Inkscape::XML::Node *StyleDialog::_getStyleTextNode() - { - - Inkscape::XML::Node *styleNode = nullptr; -@@ -287,7 +275,7 @@ - if (styleNode == nullptr) { - // Style element not found, create one - styleNode = SP_ACTIVE_DOCUMENT->getReprDoc()->createElement("svg:style"); -- textNode = SP_ACTIVE_DOCUMENT->getReprDoc()->createTextNode(""); -+ textNode = SP_ACTIVE_DOCUMENT->getReprDoc()->createTextNode(""); - - styleNode->appendChild(textNode); - Inkscape::GC::release(textNode); -@@ -305,35 +293,33 @@ - return textNode; - } - --Glib::RefPtr< Gtk::TreeModel > StyleDialog::_selectTree(Glib::ustring selector) --{ -- Gtk::Label * selectorlabel; -- Glib::RefPtr< Gtk::TreeModel > model; -- for (auto fullstyle:_styleBox.get_children()){ -+Glib::RefPtr<Gtk::TreeModel> StyleDialog::_selectTree(Glib::ustring selector) -+{ -+ Gtk::Label *selectorlabel; -+ Glib::RefPtr<Gtk::TreeModel> model; -+ for (auto fullstyle : _styleBox.get_children()) { - Gtk::Box *style = dynamic_cast<Gtk::Box *>(fullstyle); -- for (auto stylepart:style->get_children()){ -+ for (auto stylepart : style->get_children()) { - switch (style->child_property_position(*stylepart)) { -- case 0: -- { -- Gtk::Box *selectorbox = dynamic_cast<Gtk::Box *>(stylepart); -- for (auto styleheader:selectorbox->get_children()){ -- if (!selectorbox->child_property_position(*styleheader)) { -- selectorlabel = dynamic_cast<Gtk::Label *>(styleheader); -- } -+ case 0: { -+ Gtk::Box *selectorbox = dynamic_cast<Gtk::Box *>(stylepart); -+ for (auto styleheader : selectorbox->get_children()) { -+ if (!selectorbox->child_property_position(*styleheader)) { -+ selectorlabel = dynamic_cast<Gtk::Label *>(styleheader); - } -- break; - } -- case 1: -- { -- Glib::ustring wdg_selector = selectorlabel->get_text(); -- if (wdg_selector == selector){ -- Gtk::TreeView* treeview = dynamic_cast<Gtk::TreeView *>(stylepart); -- if (treeview) { -- return treeview->get_model(); -- } -+ break; -+ } -+ case 1: { -+ Glib::ustring wdg_selector = selectorlabel->get_text(); -+ if (wdg_selector == selector) { -+ Gtk::TreeView *treeview = dynamic_cast<Gtk::TreeView *>(stylepart); -+ if (treeview) { -+ return treeview->get_model(); - } -- break; - } -+ break; -+ } - default: - break; - } -@@ -349,10 +335,11 @@ - { - g_debug("StyleDialog::_readStyleElement"); - -- if (_updating) return; // Don't read if we wrote style element. -+ if (_updating) -+ return; // Don't read if we wrote style element. - _updating = true; - -- Inkscape::XML::Node * textNode = _getStyleTextNode(); -+ Inkscape::XML::Node *textNode = _getStyleTextNode(); - if (textNode == nullptr) { - std::cerr << "StyleDialog::_readStyleElement: No text node!" << std::endl; - } -@@ -370,11 +357,8 @@ - size_t open = content.find("{", start + 1); - size_t close = content.find("}", start + 1); - size_t end = content.find("*/", close + 1); -- while(!breakme) { -- if (open == std::string::npos || -- close == std::string::npos || -- end == std::string::npos) -- { -+ while (!breakme) { -+ if (open == std::string::npos || close == std::string::npos || end == std::string::npos) { - breakme = true; - break; - } -@@ -383,10 +367,7 @@ - close = content.find("}", close + 1); - end = content.find("*/", close + 1); - size_t reopen = content.find("{", close + 1); -- if (open == std::string::npos || -- end == std::string::npos || -- end < reopen) -- { -+ if (open == std::string::npos || end == std::string::npos || end < reopen) { - if (end < reopen) { - content = content.erase(start, end - start + 2); - } else { -@@ -417,13 +398,13 @@ - - // If text node is empty, return (avoids problem with negative below). - -- for (auto child:_styleBox.get_children()) { -+ for (auto child : _styleBox.get_children()) { - _styleBox.remove(*child); - delete child; - } -- Inkscape::Selection* selection = getDesktop()->getSelection(); -+ Inkscape::Selection *selection = getDesktop()->getSelection(); - SPObject *obj = nullptr; -- if(selection->objects().size() == 1) { -+ if (selection->objects().size() == 1) { - obj = selection->objects().back(); - } - -@@ -448,28 +429,30 @@ - _builder->get_widget("CSSTree", css_tree); - Glib::RefPtr<Gtk::TreeStore> store = Gtk::TreeStore::create(_mColumns); - css_tree->set_model(store); -- // We need to handle comments on SPStyle to activate -+ // We need to handle comments on SPStyle to activate - /* Gtk::CellRendererToggle *active = Gtk::manage(new Gtk::CellRendererToggle); - int addCol = css_tree->append_column("", *active) - 1; - Gtk::TreeViewColumn *col = css_tree->get_column(addCol); - if (col) { - col->add_attribute(active->property_active(), _mColumns._colActive); - } */ -- -+ - css_selector_event_add->signal_button_release_event().connect( -- sigc::bind<Glib::RefPtr<Gtk::TreeStore>, Gtk::TreeView *, Glib::ustring, gint>( -- sigc::mem_fun(*this, &StyleDialog::_addRow), store, css_tree, "style_properties", selectorpos)); -- Inkscape::UI::Widget::IconRenderer * addRenderer = manage(new Inkscape::UI::Widget::IconRenderer()); -+ sigc::bind<Glib::RefPtr<Gtk::TreeStore>, Gtk::TreeView *, Glib::ustring, gint>( -+ sigc::mem_fun(*this, &StyleDialog::_addRow), store, css_tree, "style_properties", selectorpos)); -+ Inkscape::UI::Widget::IconRenderer *addRenderer = manage(new Inkscape::UI::Widget::IconRenderer()); - addRenderer->add_icon("edit-delete"); - int addCol = css_tree->append_column("Delete row", *addRenderer) - 1; - Gtk::TreeViewColumn *col = css_tree->get_column(addCol); - if (col) { -- addRenderer->signal_activated().connect(sigc::bind<Glib::RefPtr<Gtk::TreeStore> >(sigc::mem_fun(*this, &StyleDialog::_onPropDelete), store)); -+ addRenderer->signal_activated().connect( -+ sigc::bind<Glib::RefPtr<Gtk::TreeStore>>(sigc::mem_fun(*this, &StyleDialog::_onPropDelete), store)); - } - Gtk::CellRendererText *label = Gtk::manage(new Gtk::CellRendererText()); - label->property_placeholder_text() = _("property"); - label->property_editable() = true; -- label->signal_edited().connect(sigc::bind< Glib::RefPtr<Gtk::TreeStore>, Gtk::TreeView *>(sigc::mem_fun(*this, &StyleDialog::_nameEdited), store, css_tree)); -+ label->signal_edited().connect(sigc::bind<Glib::RefPtr<Gtk::TreeStore>, Gtk::TreeView *>( -+ sigc::mem_fun(*this, &StyleDialog::_nameEdited), store, css_tree)); - addCol = css_tree->append_column("CSS Property", *label) - 1; - col = css_tree->get_column(addCol); - if (col) { -@@ -478,7 +461,8 @@ - Gtk::CellRendererText *value = Gtk::manage(new Gtk::CellRendererText()); - value->property_placeholder_text() = _("value"); - value->property_editable() = true; -- value->signal_edited().connect(sigc::bind<Glib::RefPtr<Gtk::TreeStore> >(sigc::mem_fun(*this, &StyleDialog::_valueEdited), store)); -+ value->signal_edited().connect( -+ sigc::bind<Glib::RefPtr<Gtk::TreeStore>>(sigc::mem_fun(*this, &StyleDialog::_valueEdited), store)); - addCol = css_tree->append_column("CSS Value", *value) - 1; - col = css_tree->get_column(addCol); - if (col) { -@@ -488,7 +472,7 @@ - std::map<Glib::ustring, Glib::ustring> attr_prop; - if (obj || _all_css->get_active()) { - Gtk::TreeModel::Path path; -- if(!_all_css->get_active() && obj && obj->getRepr()->attribute("style")) { -+ if (!_all_css->get_active() && obj && obj->getRepr()->attribute("style")) { - Glib::ustring style = obj->getRepr()->attribute("style"); - attr_prop = parseStyle(style); - for (auto iter : obj->style->properties()) { -@@ -502,9 +486,9 @@ - row[_mColumns._colStrike] = false; - } - } -- _styleBox.pack_start(*css_selector_container, Gtk::PACK_EXPAND_WIDGET); -- } -- selectorpos ++; -+ _styleBox.pack_start(*css_selector_container, Gtk::PACK_EXPAND_WIDGET); -+ } -+ selectorpos++; - try { - _builder = Gtk::Builder::create_from_file(gladefile); - } catch (const Glib::Error &ex) { -@@ -520,27 +504,31 @@ - _builder->get_widget("CSSTree", css_tree); - css_tree->set_model(store); - css_selector_event_add->signal_button_release_event().connect( -- sigc::bind<Glib::RefPtr<Gtk::TreeStore>, Gtk::TreeView *, Glib::ustring, gint>( -- sigc::mem_fun(*this, &StyleDialog::_addRow), store, css_tree, "attributes", selectorpos)); -+ sigc::bind<Glib::RefPtr<Gtk::TreeStore>, Gtk::TreeView *, Glib::ustring, gint>( -+ sigc::mem_fun(*this, &StyleDialog::_addRow), store, css_tree, "attributes", selectorpos)); - bool hasattributes = false; -- if(!_all_css->get_active()) { -+ if (!_all_css->get_active()) { - for (auto iter : obj->style->properties()) { - if (iter->style_src != SP_STYLE_SRC_UNSET) { -- if( iter->name != "font" && iter->name != "d" && iter->name != "marker") { -+ if (iter->name != "font" && iter->name != "d" && iter->name != "marker") { - const gchar *attr = obj->getRepr()->attribute(iter->name.c_str()); - if (attr) { - if (!hasattributes) { -- Inkscape::UI::Widget::IconRenderer * addRenderer = manage(new Inkscape::UI::Widget::IconRenderer()); -+ Inkscape::UI::Widget::IconRenderer *addRenderer = -+ manage(new Inkscape::UI::Widget::IconRenderer()); - addRenderer->add_icon("edit-delete"); - int addCol = css_tree->append_column("Delete row", *addRenderer) - 1; - Gtk::TreeViewColumn *col = css_tree->get_column(addCol); - if (col) { -- addRenderer->signal_activated().connect(sigc::bind<Glib::RefPtr<Gtk::TreeStore> >(sigc::mem_fun(*this, &StyleDialog::_onPropDelete), store)); -+ addRenderer->signal_activated().connect(sigc::bind<Glib::RefPtr<Gtk::TreeStore>>( -+ sigc::mem_fun(*this, &StyleDialog::_onPropDelete), store)); - } - Gtk::CellRendererText *label = Gtk::manage(new Gtk::CellRendererText()); - label->property_placeholder_text() = _("property"); - label->property_editable() = true; -- label->signal_edited().connect(sigc::bind< Glib::RefPtr<Gtk::TreeStore>, Gtk::TreeView * >(sigc::mem_fun(*this, &StyleDialog::_nameEdited), store, css_tree)); -+ label->signal_edited().connect( -+ sigc::bind<Glib::RefPtr<Gtk::TreeStore>, Gtk::TreeView *>( -+ sigc::mem_fun(*this, &StyleDialog::_nameEdited), store, css_tree)); - addCol = css_tree->append_column("CSS Property", *label) - 1; - col = css_tree->get_column(addCol); - if (col) { -@@ -549,7 +537,8 @@ - Gtk::CellRendererText *value = Gtk::manage(new Gtk::CellRendererText()); - value->property_placeholder_text() = _("value"); - value->property_editable() = true; -- value->signal_edited().connect(sigc::bind<Glib::RefPtr<Gtk::TreeStore> >(sigc::mem_fun(*this, &StyleDialog::_valueEdited), store)); -+ value->signal_edited().connect(sigc::bind<Glib::RefPtr<Gtk::TreeStore>>( -+ sigc::mem_fun(*this, &StyleDialog::_valueEdited), store)); - addCol = css_tree->append_column("CSS Value", *value) - 1; - col = css_tree->get_column(addCol); - if (col) { -@@ -574,18 +563,18 @@ - } - } - if (!hasattributes) { -- for (auto widg:css_selector_container->get_children()) { -+ for (auto widg : css_selector_container->get_children()) { - delete widg; - } - } - _styleBox.pack_start(*css_selector_container, Gtk::PACK_EXPAND_WIDGET); - } -- selectorpos ++; -+ selectorpos++; - if (tokens.size() == 0) { - _updating = false; - return; - } -- for (unsigned i = 0; i < tokens.size()-1; i += 2) { -+ for (unsigned i = 0; i < tokens.size() - 1; i += 2) { - Glib::ustring selector = tokens[i]; - REMOVE_SPACES(selector); // Remove leading/trailing spaces - std::vector<Glib::ustring> tokensplus = Glib::Regex::split_simple("[,]+", selector); -@@ -593,27 +582,28 @@ - REMOVE_SPACES(tok); - } - // Get list of objects selector matches -- std::vector<SPObject *> objVec = _getObjVec( selector ); -+ std::vector<SPObject *> objVec = _getObjVec(selector); - if (!_all_css->get_active()) { - bool stop = true; -- for (auto objel:objVec) { -- if (objel->getId() == obj->getId()){ -+ for (auto objel : objVec) { -+ if (objel->getId() == obj->getId()) { - stop = false; - } - } - if (stop) { - _updating = false; -- selectorpos ++; -+ selectorpos++; - continue; - } - } - Glib::ustring properties; - // Check to make sure we do have a value to match selector. -- if ((i+1) < tokens.size()) { -- properties = tokens[i+1]; -+ if ((i + 1) < tokens.size()) { -+ properties = tokens[i + 1]; - } else { - std::cerr << "StyleDialog::_readStyleElement: Missing values " -- "for last selector!" << std::endl; -+ "for last selector!" -+ << std::endl; - } - Glib::RefPtr<Gtk::Builder> _builder; - try { -@@ -634,24 +624,27 @@ - _builder->get_widget("CSSTree", css_tree); - Glib::RefPtr<Gtk::TreeStore> store = Gtk::TreeStore::create(_mColumns); - css_tree->set_model(store); -- Inkscape::UI::Widget::IconRenderer * addRenderer = manage(new Inkscape::UI::Widget::IconRenderer()); -+ Inkscape::UI::Widget::IconRenderer *addRenderer = manage(new Inkscape::UI::Widget::IconRenderer()); - addRenderer->add_icon("edit-delete"); - int addCol = css_tree->append_column("Delete row", *addRenderer) - 1; - Gtk::TreeViewColumn *col = css_tree->get_column(addCol); - if (col) { -- addRenderer->signal_activated().connect(sigc::bind<Glib::RefPtr<Gtk::TreeStore> >(sigc::mem_fun(*this, &StyleDialog::_onPropDelete), store)); -- } -+ addRenderer->signal_activated().connect( -+ sigc::bind<Glib::RefPtr<Gtk::TreeStore>>(sigc::mem_fun(*this, &StyleDialog::_onPropDelete), store)); -+ } - Gtk::CellRendererToggle *active = Gtk::manage(new Gtk::CellRendererToggle); - addCol = css_tree->append_column("Active Property", *active) - 1; - col = css_tree->get_column(addCol); - if (col) { - col->add_attribute(active->property_active(), _mColumns._colActive); -- active->signal_toggled().connect(sigc::bind<Glib::RefPtr<Gtk::TreeStore> >(sigc::mem_fun(*this, &StyleDialog::_activeToggled), store)); -+ active->signal_toggled().connect(sigc::bind<Glib::RefPtr<Gtk::TreeStore>>( -+ sigc::mem_fun(*this, &StyleDialog::_activeToggled), store)); - } - Gtk::CellRendererText *label = Gtk::manage(new Gtk::CellRendererText()); - label->property_placeholder_text() = _("property"); - label->property_editable() = true; -- label->signal_edited().connect(sigc::bind< Glib::RefPtr<Gtk::TreeStore>, Gtk::TreeView * >(sigc::mem_fun(*this, &StyleDialog::_nameEdited), store, css_tree)); -+ label->signal_edited().connect(sigc::bind<Glib::RefPtr<Gtk::TreeStore>, Gtk::TreeView *>( -+ sigc::mem_fun(*this, &StyleDialog::_nameEdited), store, css_tree)); - addCol = css_tree->append_column("CSS Selector", *label) - 1; - col = css_tree->get_column(addCol); - if (col) { -@@ -659,7 +652,8 @@ - } - Gtk::CellRendererText *value = Gtk::manage(new Gtk::CellRendererText()); - value->property_editable() = true; -- value->signal_edited().connect(sigc::bind<Glib::RefPtr<Gtk::TreeStore> >(sigc::mem_fun(*this, &StyleDialog::_valueEdited), store)); -+ value->signal_edited().connect( -+ sigc::bind<Glib::RefPtr<Gtk::TreeStore>>(sigc::mem_fun(*this, &StyleDialog::_valueEdited), store)); - value->property_placeholder_text() = _("value"); - addCol = css_tree->append_column("CSS Value", *value) - 1; - col = css_tree->get_column(addCol); -@@ -669,20 +663,18 @@ - } - Glib::ustring style = properties; - Glib::ustring comments = ""; -- while(style.find("/*") != std::string::npos) { -+ while (style.find("/*") != std::string::npos) { - size_t beg = style.find("/*"); - size_t end = style.find("*/"); -- if (end != std::string::npos && -- beg != std::string::npos) -- { -+ if (end != std::string::npos && beg != std::string::npos) { - comments = comments.append(style, beg + 2, end - beg - 2); - style = style.erase(beg, end - beg + 2); - } - } - std::map<Glib::ustring, Glib::ustring> attr_prop_styleshet = parseStyle(style); - css_selector_event_add->signal_button_release_event().connect( -- sigc::bind<Glib::RefPtr<Gtk::TreeStore>, Gtk::TreeView *, Glib::ustring, gint>( -- sigc::mem_fun(*this, &StyleDialog::_addRow), store, css_tree, selector, selectorpos)); -+ sigc::bind<Glib::RefPtr<Gtk::TreeStore>, Gtk::TreeView *, Glib::ustring, gint>( -+ sigc::mem_fun(*this, &StyleDialog::_addRow), store, css_tree, selector, selectorpos)); - if (!_all_css->get_active()) { - for (auto iter : obj->style->properties()) { - if (iter->style_src != SP_STYLE_SRC_UNSET) { -@@ -713,7 +705,7 @@ - } - } - std::map<Glib::ustring, Glib::ustring> attr_prop_styleshet_comments = parseStyle(comments); -- -+ - for (auto iter : attr_prop_styleshet_comments) { - if (!attr_prop_styleshet.count(iter.first)) { - Gtk::TreeModel::Row row = *(store->append()); -@@ -726,7 +718,7 @@ - } - } - _styleBox.pack_start(*css_selector_container, Gtk::PACK_EXPAND_WIDGET); -- selectorpos ++; -+ selectorpos++; - } - } - _mainBox.show_all_children(); -@@ -743,14 +735,13 @@ - * @return true - * Delete the attribute from the style - */ --void --StyleDialog::_onPropDelete(Glib::ustring path, Glib::RefPtr<Gtk::TreeStore> store) -+void StyleDialog::_onPropDelete(Glib::ustring path, Glib::RefPtr<Gtk::TreeStore> store) - { - Gtk::TreeModel::Row row = *store->get_iter(path); - if (row) { -- _updating = true; //to avoid a crash on deleting an obsolete widget -+ _updating = true; // to avoid a crash on deleting an obsolete widget - Glib::ustring selector = row[_mColumns._colSelector]; -- row[_mColumns._colName] = ""; -+ row[_mColumns._colName] = ""; - store->erase(row); - _updating = false; - _writeStyleElement(store, selector); -@@ -763,8 +754,7 @@ - * Convert a style string into a vector map. This should be moved to style.cpp - * - */ --std::map<Glib::ustring, Glib::ustring> --StyleDialog::parseStyle(Glib::ustring style_string) -+std::map<Glib::ustring, Glib::ustring> StyleDialog::parseStyle(Glib::ustring style_string) - { - std::map<Glib::ustring, Glib::ustring> ret; - -@@ -794,7 +784,7 @@ - if (_updating) { - return; - } -- Inkscape::Selection* selection = getDesktop()->getSelection(); -+ Inkscape::Selection *selection = getDesktop()->getSelection(); - SPObject *obj = nullptr; - if (selection->objects().size() == 1) { - obj = selection->objects().back(); -@@ -806,37 +796,33 @@ - _updating = true; - gint selectorpos = 0; - std::string styleContent = ""; -- if (selector != "style_properties" && -- selector != "attributes") -- { -+ if (selector != "style_properties" && selector != "attributes") { - styleContent = "\n" + selector + " { \n"; - } -- for (auto& row: store->children()) { -+ for (auto &row : store->children()) { - selector = row[_mColumns._colSelector]; - selectorpos = row[_mColumns._colSelectorPos]; -- Glib::ustring opencomment =""; -- Glib::ustring closecomment = "" ; -- if (selector != "style_properties" && -- selector != "attributes") { -+ Glib::ustring opencomment = ""; -+ Glib::ustring closecomment = ""; -+ if (selector != "style_properties" && selector != "attributes") { - opencomment = row[_mColumns._colActive] ? " " : " /*"; -- closecomment = row[_mColumns._colActive] ? "\n" : "*/\n" ; -- } -- Glib::ustring name = row[_mColumns._colName]; -+ closecomment = row[_mColumns._colActive] ? "\n" : "*/\n"; -+ } -+ Glib::ustring name = row[_mColumns._colName]; - Glib::ustring value = row[_mColumns._colValue]; -- if (!(name.empty() && value.empty())){ -+ if (!(name.empty() && value.empty())) { - styleContent = styleContent + opencomment + name + ":" + value + ";" + closecomment; - } - } -- if (selector != "style_properties" && -- selector != "attributes" ) { -+ if (selector != "style_properties" && selector != "attributes") { - styleContent = styleContent + "}"; - } - if (selector == "style_properties") { -- obj->getRepr()->setAttribute("style",styleContent, false); -+ obj->getRepr()->setAttribute("style", styleContent, false); - } else if (selector == "attributes") { - for (auto iter : obj->style->properties()) { - if (iter->style_src != SP_STYLE_SRC_UNSET) { -- if( iter->name != "font" && iter->name != "d" && iter->name != "marker") { -+ if (iter->name != "font" && iter->name != "d" && iter->name != "marker") { - const gchar *attr = obj->getRepr()->attribute(iter->name.c_str()); - if (attr) { - obj->getRepr()->setAttribute(iter->name.c_str(), nullptr); -@@ -844,14 +830,14 @@ - } - } - } -- for (auto& row: store->children()) { -- Glib::ustring name = row[_mColumns._colName]; -- Glib::ustring value = row[_mColumns._colValue]; -- if (!(name.empty() && value.empty())){ -+ for (auto &row : store->children()) { -+ Glib::ustring name = row[_mColumns._colName]; -+ Glib::ustring value = row[_mColumns._colValue]; -+ if (!(name.empty() && value.empty())) { - obj->getRepr()->setAttribute(name.c_str(), value); - } - } -- } else if (!selector.empty()) { //styleshet -+ } else if (!selector.empty()) { // styleshet - // We could test if styleContent is empty and then delete the style node here but there is no - // harm in keeping it around ... - SP_ACTIVE_DOCUMENT->setStyleSheet(nullptr); -@@ -862,10 +848,10 @@ - } - selectormatch = selectormatch + ")([^}]*?})((.|\n)*)"; - Inkscape::XML::Node *textNode = _getStyleTextNode(); -- std::regex e (selectormatch.c_str()); -+ std::regex e(selectormatch.c_str()); - std::string content = (textNode->content() ? textNode->content() : ""); - std::string result; -- std::regex_replace (std::back_inserter(result), content.begin(), content.end(), e, "$1" + styleContent + "$3"); -+ std::regex_replace(std::back_inserter(result), content.begin(), content.end(), e, "$1" + styleContent + "$3"); - textNode->setContent(result.c_str()); - } - _readStyleElement(); -@@ -875,19 +861,21 @@ - g_debug("StyleDialog::_writeStyleElement(): | %s |", styleContent.c_str()); - } - --bool StyleDialog::_addRow(GdkEventButton *evt, Glib::RefPtr<Gtk::TreeStore> store, Gtk::TreeView *css_tree, Glib::ustring selector, gint pos) { -- if(evt->type == GDK_BUTTON_RELEASE && evt->button == 1) { -+bool StyleDialog::_addRow(GdkEventButton *evt, Glib::RefPtr<Gtk::TreeStore> store, Gtk::TreeView *css_tree, -+ Glib::ustring selector, gint pos) -+{ -+ if (evt->type == GDK_BUTTON_RELEASE && evt->button == 1) { - Gtk::TreeIter iter = store->append(); - Gtk::TreeModel::Path path = (Gtk::TreeModel::Path)iter; - Gtk::TreeModel::Row row = *(iter); - row[_mColumns._colSelector] = selector; - row[_mColumns._colSelectorPos] = pos; - row[_mColumns._colActive] = true; -- row[_mColumns._colName] = ""; -+ row[_mColumns._colName] = ""; - row[_mColumns._colValue] = ""; - row[_mColumns._colStrike] = false; - gint col = 2; -- if (pos < 2 ){ -+ if (pos < 2) { - col = 1; - } - css_tree->set_cursor(path, *(css_tree->get_column(col)), true); -@@ -903,12 +891,13 @@ - * @return - * Called when the name is edited in the TreeView editable column - */ --void StyleDialog::_nameEdited (const Glib::ustring& path, const Glib::ustring& name, Glib::RefPtr<Gtk::TreeStore> store, Gtk::TreeView *css_tree) -+void StyleDialog::_nameEdited(const Glib::ustring &path, const Glib::ustring &name, Glib::RefPtr<Gtk::TreeStore> store, -+ Gtk::TreeView *css_tree) - { - Gtk::TreeModel::Row row = *store->get_iter(path); - Gtk::TreeModel::Path pathel = (Gtk::TreeModel::Path)*store->get_iter(path); - -- if(row) { -+ if (row) { - gint pos = row[_mColumns._colSelectorPos]; - bool write = false; - if (row[_mColumns._colName] != name && row[_mColumns._colValue] != "") { -@@ -917,11 +906,11 @@ - Glib::ustring value = row[_mColumns._colValue]; - Glib::ustring selector = row[_mColumns._colSelector]; - row[_mColumns._colName] = name; -- if(name.empty() && value.empty()) { -+ if (name.empty() && value.empty()) { - store->erase(row); - } - gint col = 3; -- if (pos < 2 ){ -+ if (pos < 2) { - col = 2; - } - if (write) { -@@ -940,31 +929,33 @@ - * @return - * Called when the value is edited in the TreeView editable column - */ --void StyleDialog::_valueEdited(const Glib::ustring& path, const Glib::ustring& value, Glib::RefPtr<Gtk::TreeStore> store) -+void StyleDialog::_valueEdited(const Glib::ustring &path, const Glib::ustring &value, -+ Glib::RefPtr<Gtk::TreeStore> store) - { - Gtk::TreeModel::Row row = *store->get_iter(path); -- if(row) { -+ if (row) { - row[_mColumns._colValue] = value; - Glib::ustring selector = row[_mColumns._colSelector]; - Glib::ustring name = row[_mColumns._colName]; -- if(name.empty() && value.empty()) { -+ if (name.empty() && value.empty()) { - store->erase(row); - } - _writeStyleElement(store, selector); - } - } - --void StyleDialog::_activeToggled(const Glib::ustring& path, Glib::RefPtr<Gtk::TreeStore> store) -+void StyleDialog::_activeToggled(const Glib::ustring &path, Glib::RefPtr<Gtk::TreeStore> store) - { - Gtk::TreeModel::Row row = *store->get_iter(path); -- if(row) { -+ if (row) { - row[_mColumns._colActive] = !row[_mColumns._colActive]; - Glib::ustring selector = row[_mColumns._colSelector]; - _writeStyleElement(store, selector); - } - } - --void StyleDialog::_addWatcherRecursive(Inkscape::XML::Node *node) { -+void StyleDialog::_addWatcherRecursive(Inkscape::XML::Node *node) -+{ - - g_debug("StyleDialog::_addWatcherRecursive()"); - -@@ -1007,12 +998,13 @@ - * @return objVec: a vector of pointers to SPObject's the selector matches. - * Return a vector of all objects that selector matches. - */ --std::vector<SPObject *> StyleDialog::_getObjVec(Glib::ustring selector) { -- -- std::vector<SPObject *> objVec = SP_ACTIVE_DOCUMENT->getObjectsBySelector( selector ); -+std::vector<SPObject *> StyleDialog::_getObjVec(Glib::ustring selector) -+{ -+ -+ std::vector<SPObject *> objVec = SP_ACTIVE_DOCUMENT->getObjectsBySelector(selector); - - g_debug("StyleDialog::_getObjVec: | %s |", selector.c_str()); -- for (auto& obj: objVec) { -+ for (auto &obj : objVec) { - g_debug(" %s", obj->getId() ? obj->getId() : "null"); - } - -@@ -1026,15 +1018,14 @@ - * Handle document replaced. (Happens when a default document is immediately replaced by another - * document in a new window.) - */ --void --StyleDialog::_handleDocumentReplaced(SPDesktop *desktop, SPDocument * /* document */) -+void StyleDialog::_handleDocumentReplaced(SPDesktop *desktop, SPDocument * /* document */) - { - g_debug("StyleDialog::handleDocumentReplaced()"); - - _selection_changed_connection.disconnect(); - -- _selection_changed_connection = desktop->getSelection()->connectChanged( -- sigc::hide(sigc::mem_fun(this, &StyleDialog::_handleSelectionChanged))); -+ _selection_changed_connection = -+ desktop->getSelection()->connectChanged(sigc::hide(sigc::mem_fun(this, &StyleDialog::_handleSelectionChanged))); - - _updateWatchers(); - _readStyleElement(); -@@ -1044,8 +1035,8 @@ - /* - * When a dialog is floating, it is connected to the active desktop. - */ --void --StyleDialog::_handleDesktopChanged(SPDesktop* desktop) { -+void StyleDialog::_handleDesktopChanged(SPDesktop *desktop) -+{ - g_debug("StyleDialog::handleDesktopReplaced()"); - - if (getDesktop() == desktop) { -@@ -1057,12 +1048,12 @@ - _selection_changed_connection.disconnect(); - _document_replaced_connection.disconnect(); - -- setDesktop( desktop ); -- -- _selection_changed_connection = desktop->getSelection()->connectChanged( -- sigc::hide(sigc::mem_fun(this, &StyleDialog::_handleSelectionChanged))); -- _document_replaced_connection = desktop->connectDocumentReplaced( -- sigc::mem_fun(this, &StyleDialog::_handleDocumentReplaced)); -+ setDesktop(desktop); -+ -+ _selection_changed_connection = -+ desktop->getSelection()->connectChanged(sigc::hide(sigc::mem_fun(this, &StyleDialog::_handleSelectionChanged))); -+ _document_replaced_connection = -+ desktop->connectDocumentReplaced(sigc::mem_fun(this, &StyleDialog::_handleDocumentReplaced)); - - _updateWatchers(); - _readStyleElement(); -@@ -1072,8 +1063,8 @@ - /* - * Handle a change in which objects are selected in a document. - */ --void --StyleDialog::_handleSelectionChanged() { -+void StyleDialog::_handleSelectionChanged() -+{ - g_debug("StyleDialog::_handleSelectionChanged()"); - _readStyleElement(); - } ---- src/ui/dialog/selectordialog.h (before formatting) -+++ src/ui/dialog/selectordialog.h (after formatting) -@@ -15,14 +15,14 @@ - #ifndef SELECTORDIALOG_H - #define SELECTORDIALOG_H - -+#include <gtkmm/dialog.h> -+#include <gtkmm/paned.h> -+#include <gtkmm/scrolledwindow.h> -+#include <gtkmm/treemodelfilter.h> -+#include <gtkmm/treeselection.h> -+#include <gtkmm/treestore.h> -+#include <gtkmm/treeview.h> - #include <ui/widget/panel.h> --#include <gtkmm/treeview.h> --#include <gtkmm/treestore.h> --#include <gtkmm/treemodelfilter.h> --#include <gtkmm/scrolledwindow.h> --#include <gtkmm/dialog.h> --#include <gtkmm/treeselection.h> --#include <gtkmm/paned.h> - - #include "ui/dialog/desktop-tracker.h" - -@@ -81,7 +81,7 @@ - Gtk::TreeModelColumn<gint> _colType; // Selector row or child object row. - Gtk::TreeModelColumn<std::vector<SPObject *> > _colObj; // List of matching objects. - Gtk::TreeModelColumn<Glib::ustring> _colProperties; // List of properties. -- Gtk::TreeModelColumn<bool> _colVisible; // Make visible or not. -+ Gtk::TreeModelColumn<bool> _colVisible; // Make visible or not. - }; - ModelColumns _mColumns; - -@@ -100,7 +100,7 @@ - void on_row_deleted(const TreeModel::Path& path) override; - - public: -- static Glib::RefPtr<SelectorDialog::TreeStore> create(SelectorDialog *styledialog); -+ static Glib::RefPtr<SelectorDialog::TreeStore> create(SelectorDialog *styledialog); - - private: - SelectorDialog *_selectordialog; ---- src/ui/icon-loader.cpp (before formatting) -+++ src/ui/icon-loader.cpp (after formatting) -@@ -62,7 +62,7 @@ - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - if (prefs->getBool("/theme/symbolicIcons", false)) { - Gtk::IconInfo iconinfo = icon_theme->lookup_icon(icon_name + Glib::ustring("-symbolic"), size, Gtk::ICON_LOOKUP_FORCE_SIZE); -- if (iconinfo) { -+ if (iconinfo) { - bool was_simbolic = false; - _icon_pixbuf = iconinfo.load_symbolic(SP_ACTIVE_DESKTOP->getToplevel()->get_style_context(), was_simbolic); - } else { ---- src/ui/dialog/selectordialog.cpp (before formatting) -+++ src/ui/dialog/selectordialog.cpp (after formatting) -@@ -52,17 +52,17 @@ - // Keeps a watch on style element - class SelectorDialog::NodeObserver : public Inkscape::XML::NodeObserver { - public: -- NodeObserver(SelectorDialog* selectordialog) : -- _selectordialog(selectordialog) -- { -- g_debug("SelectorDialog::NodeObserver: Constructor"); -+ NodeObserver(SelectorDialog *selectordialog) -+ : _selectordialog(selectordialog) -+ { -+ g_debug("SelectorDialog::NodeObserver: Constructor"); - }; - - void notifyContentChanged(Inkscape::XML::Node &node, - Inkscape::Util::ptr_shared old_content, - Inkscape::Util::ptr_shared new_content) override; - -- SelectorDialog * _selectordialog; -+ SelectorDialog *_selectordialog; - }; - - -@@ -83,19 +83,19 @@ - // (Must update objects that selectors match.) - class SelectorDialog::NodeWatcher : public Inkscape::XML::NodeObserver { - public: -- NodeWatcher(SelectorDialog* selectordialog, Inkscape::XML::Node *repr) : -- _selectordialog(selectordialog), -- _repr(repr) -- { -- g_debug("SelectorDialog::NodeWatcher: Constructor"); -+ NodeWatcher(SelectorDialog *selectordialog, Inkscape::XML::Node *repr) -+ : _selectordialog(selectordialog) -+ , _repr(repr) -+ { -+ g_debug("SelectorDialog::NodeWatcher: Constructor"); - }; - - void notifyChildAdded( Inkscape::XML::Node &/*node*/, - Inkscape::XML::Node &child, - Inkscape::XML::Node */*prev*/ ) override - { -- if ( _selectordialog && _repr ) { -- _selectordialog->_nodeAdded( child ); -+ if (_selectordialog && _repr) { -+ _selectordialog->_nodeAdded(child); - } - } - -@@ -103,8 +103,8 @@ - Inkscape::XML::Node &child, - Inkscape::XML::Node */*prev*/ ) override - { -- if ( _selectordialog && _repr ) { -- _selectordialog->_nodeRemoved( child ); -+ if (_selectordialog && _repr) { -+ _selectordialog->_nodeRemoved(child); - } - } - -@@ -112,7 +112,7 @@ - GQuark qname, - Util::ptr_shared /*old_value*/, - Util::ptr_shared /*new_value*/ ) override { -- if ( _selectordialog && _repr ) { -+ if (_selectordialog && _repr) { - - // For the moment only care about attributes that are directly used in selectors. - const gchar * cname = g_quark_to_string (qname ); -@@ -122,12 +122,12 @@ - } - - if ( name == "id" || name == "class" ) { -- _selectordialog->_nodeChanged( node ); -- } -- } -- } -- -- SelectorDialog * _selectordialog; -+ _selectordialog->_nodeChanged(node); -+ } -+ } -+ } -+ -+ SelectorDialog *_selectordialog; - Inkscape::XML::Node * _repr; // Need to track if document changes. - }; - -@@ -243,7 +243,7 @@ - addRenderer->add_icon("edit-delete"); - addRenderer->add_icon("list-add"); - addRenderer->add_icon("object-locked"); -- -+ - _store = TreeStore::create(this); - _treeView.set_model(_store); - -@@ -407,10 +407,10 @@ - content.erase(std::remove(content.begin(), content.end(), '\n'), content.end()); - - // Remove comments (/* xxx */) --/* while(content.find("/*") != std::string::npos) { -- size_t start = content.find("/*"); -- content.erase(start, (content.find("*\/", start) - start) +2); -- } */ -+ /* while(content.find("/*") != std::string::npos) { -+ size_t start = content.find("/*"); -+ content.erase(start, (content.find("*\/", start) - start) +2); -+ } */ - - // First split into selector/value chunks. - // An attempt to use Glib::Regex failed. A C++11 version worked but -@@ -453,7 +453,7 @@ - for (auto tok : tokensplus) { - REMOVE_SPACES(tok); - if (SPAttributeRelSVG::isSVGElement(tok) || tok.find(" ") != -1 || tok[0] == '>' || tok[0] == '+' || -- tok[0] == '~' || tok[0] == '*' || tok.erase(0, 1).find(".") != -1) { -+ tok[0] == '~' || tok[0] == '*' || tok.erase(0, 1).find(".") != -1) { - colType = UNHANDLED; - } - } -@@ -488,14 +488,15 @@ - Gtk::TreeModel::Row childrow = *(_store->append(row->children())); - childrow[_mColumns._colSelector] = "#" + Glib::ustring(obj->getId()); - childrow[_mColumns._colExpand] = false; -- childrow[_mColumns._colType] = colType == UNHANDLED ? UNHANDLED : OBJECT;; -+ childrow[_mColumns._colType] = colType == UNHANDLED ? UNHANDLED : OBJECT; -+ ; - childrow[_mColumns._colObj] = std::vector<SPObject *>(1, obj); - childrow[_mColumns._colProperties] = ""; // Unused -- childrow[_mColumns._colVisible] = true; // Unused -- } --} -- -- -+ childrow[_mColumns._colVisible] = true; // Unused -+ } -+ } -+ -+ - _updating = false; - } - -@@ -624,7 +625,7 @@ - childrow[_mColumns._colType] = OBJECT; - childrow[_mColumns._colObj] = std::vector<SPObject *>(1, obj); - childrow[_mColumns._colProperties] = ""; // Unused -- childrow[_mColumns._colVisible] = true; // Unused -+ childrow[_mColumns._colVisible] = true; // Unused - } - } - } -@@ -665,7 +666,7 @@ - childrow[_mColumns._colType] = OBJECT; - childrow[_mColumns._colObj] = std::vector<SPObject *>(1, obj); - childrow[_mColumns._colProperties] = ""; // Unused -- childrow[_mColumns._colVisible] = true; // Unused -+ childrow[_mColumns._colVisible] = true; // Unused - } - } - } -@@ -986,7 +987,7 @@ - textLabelPtr->show(); - } else { - invalid = false; -- } -+ } - } - delete textDialogPtr; - // ==== Handle response ==== -@@ -1209,13 +1210,13 @@ - { - g_debug("SelectorDialog::_selectRow: updating: %s", (_updating ? "true" : "false")); - del->hide(); -- std::vector< Gtk::TreeModel::Path > selectedrows = _treeView.get_selection()->get_selected_rows(); -- if(selectedrows.size() == 1) { -+ std::vector<Gtk::TreeModel::Path> selectedrows = _treeView.get_selection()->get_selected_rows(); -+ if (selectedrows.size() == 1) { - Gtk::TreeModel::Row row = *_store->get_iter(selectedrows[0]); -- if (!row->parent() && row->children().size() < 2 ) { -+ if (!row->parent() && row->children().size() < 2) { - del->show(); - } -- } else if(selectedrows.size() == 0) { -+ } else if (selectedrows.size() == 0) { - del->show(); - } - if (_updating || !getDesktop()) return; // Avoid updating if we have set row via dialog. -@@ -1231,7 +1232,7 @@ - if (!selection->isEmpty()) { - obj = selection->objects().back(); - } -- -+ - for (auto row : children) { - std::vector<SPObject *> objVec = row[_mColumns._colObj]; - if (obj) { ---- src/ui/dialog/attrdialog.cpp (before formatting) -+++ src/ui/dialog/attrdialog.cpp (after formatting) -@@ -18,9 +18,9 @@ - - #include "message-context.h" - #include "message-stack.h" -+#include "style.h" - #include "ui/icon-loader.h" - #include "ui/widget/iconrenderer.h" --#include "style.h" - - #include "xml/node-event-vector.h" - #include "xml/attribute-record.h" -@@ -383,7 +383,7 @@ - if (obj) { - for (auto iter : obj->style->properties()) { - if (iter->style_src != SP_STYLE_SRC_UNSET) { -- if( iter->name == name) { -+ if (iter->name == name) { - obj->style->readFromObject(obj); - obj->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG); - } -@@ -413,7 +413,7 @@ - row[_attrColumns._attributeValue] = value; - } - reloadStyles(name); -- -+ - this->setUndo(_("Change attribute value")); - } - } ---- src/style.cpp (before formatting) -+++ src/style.cpp (after formatting) -@@ -721,8 +721,8 @@ - } - - // return if is seted property --bool --SPStyle::isSet(SPAttributeEnum id) { -+bool SPStyle::isSet(SPAttributeEnum id) -+{ - bool set = false; - switch (id) { - case SP_PROP_CLIP_PATH: -@@ -730,7 +730,8 @@ - case SP_PROP_MASK: - return set; - case SP_PROP_FILTER: -- if( !filter.inherit ) set = filter.set; -+ if (!filter.inherit) -+ set = filter.set; - return set; - case SP_PROP_COLOR_INTERPOLATION: - // We read it but issue warning -@@ -912,11 +913,11 @@ - gchar *const str_value = reinterpret_cast<gchar *>(str_value_unsigned); - - // Add "!important" rule if necessary as this is not handled by cr_term_to_string(). -- gchar const * important = decl->important ? " !important" : ""; -+ gchar const *important = decl->important ? " !important" : ""; - Inkscape::CSSOStringStream os; - os << str_value << important; - -- readIfUnset( prop_idx, os.str().c_str(), source ); -+ readIfUnset(prop_idx, os.str().c_str(), source); - g_free(str_value); - } - } diff --git a/src/attributes.cpp b/src/attributes.cpp index 575e40b5c..3fa8c0fff 100644 --- a/src/attributes.cpp +++ b/src/attributes.cpp @@ -604,8 +604,7 @@ sp_attribute_name(SPAttributeEnum id) return props[id].name; } -std::vector<Glib::ustring> -sp_attribute_name_list(bool cssattr, bool attr) +std::vector<Glib::ustring> sp_attribute_name_list(bool cssattr, bool attr) { std::vector<Glib::ustring> result; static AttributeLookupImpl const _instance; diff --git a/src/attributes.h b/src/attributes.h index f49d8d2f9..7a49e2808 100644 --- a/src/attributes.h +++ b/src/attributes.h @@ -14,8 +14,8 @@ * * Released under GNU GPL v2+, read the file 'COPYING' for more information. */ -#include <vector> #include <glibmm/value.h> +#include <vector> /** * True iff k is a property in SVG, i.e. something that can be written either in a style attribute diff --git a/src/ui/dialog/styledialog.cpp b/src/ui/dialog/styledialog.cpp index 7bb58cef9..23dfcf407 100644 --- a/src/ui/dialog/styledialog.cpp +++ b/src/ui/dialog/styledialog.cpp @@ -21,11 +21,10 @@ #include "selection.h" #include "style-internal.h" #include "style.h" +#include "svg/svg-color.h" #include "ui/icon-loader.h" #include "ui/widget/iconrenderer.h" #include "verbs.h" -#include "svg/svg-color.h" -#include "attributes.h" #include "xml/attribute-record.h" #include "xml/node-observer.h" @@ -210,16 +209,16 @@ StyleDialog::StyleDialog() Glib::RefPtr<Gtk::ListStore> completionModel = Gtk::ListStore::create(_mCSSData); _entry_completion = Gtk::EntryCompletion::create(); _entry_completion->set_model(completionModel); - _entry_completion->set_text_column (_mCSSData._colCSSData); + _entry_completion->set_text_column(_mCSSData._colCSSData); _entry_completion->set_minimum_key_length(1); _entry_completion->set_popup_completion(true); - for (auto prop : sp_attribute_name_list(true)){ + for (auto prop : sp_attribute_name_list(true)) { Gtk::TreeModel::Row row = *(completionModel->append()); row[_mCSSData._colCSSData] = prop; } _mainBox.set_orientation(Gtk::ORIENTATION_VERTICAL); - _getContents()->pack_start(_mainBox, Gtk::PACK_EXPAND_WIDGET); + _getContents()->pack_start(_mainBox, Gtk::PACK_EXPAND_WIDGET); _all_css->get_style_context()->add_class("stylesheettoggler"); // Document & Desktop _desktop_changed_connection = @@ -476,7 +475,8 @@ void StyleDialog::_readStyleElement() value->property_editable() = true; value->signal_edited().connect( sigc::bind<Glib::RefPtr<Gtk::TreeStore>>(sigc::mem_fun(*this, &StyleDialog::_valueEdited), store)); - //value->signal_editing_started().connect( sigc::bind<Glib::RefPtr<Gtk::TreeStore> >(sigc::mem_fun(*this, &StyleDialog::_startValueEdit), store)); + // value->signal_editing_started().connect( sigc::bind<Glib::RefPtr<Gtk::TreeStore> >(sigc::mem_fun(*this, + // &StyleDialog::_startValueEdit), store)); addCol = css_tree->append_column("CSS Value", *value) - 1; col = css_tree->get_column(addCol); if (col) { @@ -623,11 +623,8 @@ void StyleDialog::_readStyleElement() r1 = sp_svg_read_color(value.c_str(), r1); guint32 r2 = 0; // if there's no color, return black r2 = sp_svg_read_color(iter->get_value().c_str(), r2); - if (attr_prop.count(iter->name) || - (value != iter->get_value() && - (r1 & 0xff == 0 || - r1 != r2))) - { + if (attr_prop.count(iter->name) || + (value != iter->get_value() && (r1 & 0xff == 0 || r1 != r2))) { row[_mColumns._colStrike] = true; } else { row[_mColumns._colStrike] = false; @@ -872,7 +869,7 @@ void StyleDialog::_writeStyleElement(Glib::RefPtr<Gtk::TreeStore> store, Glib::u iter->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG); } } else { - SPObject * obj = document->getObjectById(selectorname); + SPObject *obj = document->getObjectById(selectorname); obj->style->readFromObject(obj); obj->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG); } @@ -929,14 +926,13 @@ bool StyleDialog::_addRow(GdkEventButton *evt, Glib::RefPtr<Gtk::TreeStore> stor return false; } -void -StyleDialog::_startNameEdit(Gtk::CellEditable* cell, const Glib::ustring& path) +void StyleDialog::_startNameEdit(Gtk::CellEditable *cell, const Glib::ustring &path) { Gtk::Entry *entry = dynamic_cast<Gtk::Entry *>(cell); entry->set_completion(_entry_completion); } -/* void +/* void StyleDialog::_setAutocompletion(Gtk::Entry *entry, SPStyleEnum const cssenum[]) { Glib::RefPtr<Gtk::ListStore> completionModel = Gtk::ListStore::create(_mCSSData); @@ -944,7 +940,7 @@ StyleDialog::_setAutocompletion(Gtk::Entry *entry, SPStyleEnum const cssenum[]) entry_completion->set_text_column (_mCSSData._colCSSData); entry_completion->set_minimum_key_length(0); entry_completion->set_popup_completion(true); - + gint counter = 0; const char * key = cssenum[counter].key; while (key) { @@ -955,7 +951,7 @@ StyleDialog::_setAutocompletion(Gtk::Entry *entry, SPStyleEnum const cssenum[]) } } -void +void StyleDialog::_startValueEdit(Gtk::CellEditable* cell, const Glib::ustring& path, Glib::RefPtr<Gtk::TreeStore> store) { Gtk::TreeModel::Row row = *store->get_iter(path); diff --git a/src/ui/dialog/styledialog.h b/src/ui/dialog/styledialog.h index 99a0a8ece..7b1a7cde5 100644 --- a/src/ui/dialog/styledialog.h +++ b/src/ui/dialog/styledialog.h @@ -18,19 +18,19 @@ #include "style-enums.h" #include <glibmm/regex.h> #include <gtkmm/builder.h> -#include <gtkmm/cellrenderercombo.h> #include <gtkmm/celleditable.h> +#include <gtkmm/cellrenderercombo.h> +#include <gtkmm/dialog.h> #include <gtkmm/entry.h> #include <gtkmm/entrycompletion.h> -#include <gtkmm/dialog.h> #include <gtkmm/eventbox.h> +#include <gtkmm/liststore.h> #include <gtkmm/paned.h> #include <gtkmm/scrolledwindow.h> #include <gtkmm/switch.h> #include <gtkmm/treemodelfilter.h> #include <gtkmm/treeselection.h> #include <gtkmm/treestore.h> -#include <gtkmm/liststore.h> #include <gtkmm/treeview.h> #include <ui/widget/panel.h> @@ -99,11 +99,8 @@ class StyleDialog : public Widget::Panel { class CSSData : public Gtk::TreeModel::ColumnRecord { public: - CSSData() - { - add(_colCSSData); - } - Gtk::TreeModelColumn<Glib::ustring> _colCSSData; // Name of the property. + CSSData() { add(_colCSSData); } + Gtk::TreeModelColumn<Glib::ustring> _colCSSData; // Name of the property. }; CSSData _mCSSData; @@ -128,7 +125,7 @@ class StyleDialog : public Widget::Panel { void _nameEdited(const Glib::ustring &path, const Glib::ustring &name, Glib::RefPtr<Gtk::TreeStore> store, Gtk::TreeView *css_tree); void _valueEdited(const Glib::ustring &path, const Glib::ustring &value, Glib::RefPtr<Gtk::TreeStore> store); - void _startNameEdit(Gtk::CellEditable* cell, const Glib::ustring& path); + 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[]); diff --git a/src/ui/widget/ink-flow-box.cpp b/src/ui/widget/ink-flow-box.cpp index 728d720a3..8485dd932 100644 --- a/src/ui/widget/ink-flow-box.cpp +++ b/src/ui/widget/ink-flow-box.cpp @@ -30,10 +30,8 @@ InkFlowBox::InkFlowBox(const gchar *name) tbutton->set_always_show_image(true); _flowbox.set_selection_mode(Gtk::SelectionMode::SELECTION_NONE); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - prefs->setBool(Glib::ustring("/dialogs/") + get_name() + - Glib::ustring("/flowbox/lock"), false); - tbutton->set_active(prefs->getBool(Glib::ustring("/dialogs/") + get_name() + - Glib::ustring("/flowbox/lock"), true)); + prefs->setBool(Glib::ustring("/dialogs/") + get_name() + Glib::ustring("/flowbox/lock"), false); + tbutton->set_active(prefs->getBool(Glib::ustring("/dialogs/") + get_name() + Glib::ustring("/flowbox/lock"), true)); Glib::ustring iconname = "object-unlocked"; if (tbutton->get_active()) { iconname = "object-locked"; |
