diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/desktop.cpp | 2 | ||||
| -rw-r--r-- | src/ui/dialog/dialog-manager.cpp | 14 | ||||
| -rw-r--r-- | src/ui/dialog/selectorsdialog.cpp | 145 | ||||
| -rw-r--r-- | src/ui/dialog/selectorsdialog.h | 19 | ||||
| -rw-r--r-- | src/ui/dialog/styledialog.cpp | 6 | ||||
| -rw-r--r-- | src/ui/dialog/styledialog.h | 2 | ||||
| -rw-r--r-- | src/verbs.cpp | 5 |
7 files changed, 92 insertions, 101 deletions
diff --git a/src/desktop.cpp b/src/desktop.cpp index 9f7da4d6e..5219b9472 100644 --- a/src/desktop.cpp +++ b/src/desktop.cpp @@ -2024,7 +2024,7 @@ SPDesktop::show_dialogs() mapVerbPreference.insert(std::make_pair ("Symbols", "/dialogs/symbols") ); mapVerbPreference.insert(std::make_pair ("ObjectsPanel", "/dialogs/objects") ); mapVerbPreference.insert(std::make_pair ("Prototype", "/dialogs/prototype") ); - mapVerbPreference.insert(std::make_pair ("Selectors", "/dialogs/selectors") ); + mapVerbPreference.insert(std::make_pair("Selectors", "/dialogs/selectors")); for (std::map<Glib::ustring, Glib::ustring>::const_iterator iter = mapVerbPreference.begin(); iter != mapVerbPreference.end(); ++iter) { diff --git a/src/ui/dialog/dialog-manager.cpp b/src/ui/dialog/dialog-manager.cpp index 98e5cff98..a345e2a32 100644 --- a/src/ui/dialog/dialog-manager.cpp +++ b/src/ui/dialog/dialog-manager.cpp @@ -45,18 +45,18 @@ #include "ui/dialog/layers.h" #include "ui/dialog/icon-preview.h" //#include "ui/dialog/print-colors-preview-dialog.h" -#include "util/ege-appear-time-tracker.h" +#include "ui/dialog/clonetiler.h" +#include "ui/dialog/export.h" #include "ui/dialog/object-attributes.h" #include "ui/dialog/object-properties.h" -#include "ui/dialog/text-edit.h" -#include "ui/dialog/spellcheck.h" -#include "ui/dialog/export.h" -#include "ui/dialog/xml-tree.h" -#include "ui/dialog/clonetiler.h" -#include "ui/dialog/svg-fonts-dialog.h" #include "ui/dialog/objects.h" #include "ui/dialog/selectorsdialog.h" +#include "ui/dialog/spellcheck.h" #include "ui/dialog/styledialog.h" +#include "ui/dialog/svg-fonts-dialog.h" +#include "ui/dialog/text-edit.h" +#include "ui/dialog/xml-tree.h" +#include "util/ege-appear-time-tracker.h" namespace Inkscape { namespace UI { namespace Dialog { diff --git a/src/ui/dialog/selectorsdialog.cpp b/src/ui/dialog/selectorsdialog.cpp index 0d772384e..1f5f254a8 100644 --- a/src/ui/dialog/selectorsdialog.cpp +++ b/src/ui/dialog/selectorsdialog.cpp @@ -13,11 +13,11 @@ */ #include "selectorsdialog.h" -#include "verbs.h" -#include "selection.h" #include "attribute-rel-svg.h" -#include "inkscape.h" #include "document-undo.h" +#include "inkscape.h" +#include "selection.h" +#include "verbs.h" #include "ui/icon-loader.h" #include "ui/widget/iconrenderer.h" @@ -57,12 +57,12 @@ namespace Dialog { // Keeps a watch on style element class SelectorsDialog::NodeObserver : public Inkscape::XML::NodeObserver { -public: - NodeObserver(SelectorsDialog *selectorsdialog) - : _selectorsdialog(selectorsdialog) - { - g_debug("SelectorsDialog::NodeObserver: Constructor"); - }; + public: + NodeObserver(SelectorsDialog *selectorsdialog) + : _selectorsdialog(selectorsdialog) + { + g_debug("SelectorsDialog::NodeObserver: Constructor"); + }; void notifyContentChanged(Inkscape::XML::Node &node, Inkscape::Util::ptr_shared old_content, @@ -72,11 +72,10 @@ public: }; -void -SelectorsDialog::NodeObserver::notifyContentChanged( - Inkscape::XML::Node &/*node*/, - Inkscape::Util::ptr_shared /*old_content*/, - Inkscape::Util::ptr_shared /*new_content*/ ) { +void SelectorsDialog::NodeObserver::notifyContentChanged(Inkscape::XML::Node & /*node*/, + Inkscape::Util::ptr_shared /*old_content*/, + Inkscape::Util::ptr_shared /*new_content*/) +{ g_debug("SelectorsDialog::NodeObserver::notifyContentChanged"); _selectorsdialog->_updating = false; @@ -88,13 +87,13 @@ SelectorsDialog::NodeObserver::notifyContentChanged( // Keeps a watch for new/removed/changed nodes // (Must update objects that selectors match.) class SelectorsDialog::NodeWatcher : public Inkscape::XML::NodeObserver { -public: - NodeWatcher(SelectorsDialog *selectorsdialog, Inkscape::XML::Node *repr) - : _selectorsdialog(selectorsdialog) - , _repr(repr) - { - g_debug("SelectorsDialog::NodeWatcher: Constructor"); - }; + public: + NodeWatcher(SelectorsDialog *selectorsdialog, Inkscape::XML::Node *repr) + : _selectorsdialog(selectorsdialog) + , _repr(repr) + { + g_debug("SelectorsDialog::NodeWatcher: Constructor"); + }; void notifyChildAdded( Inkscape::XML::Node &/*node*/, Inkscape::XML::Node &child, @@ -137,10 +136,10 @@ public: Inkscape::XML::Node * _repr; // Need to track if document changes. }; -void -SelectorsDialog::_nodeAdded( Inkscape::XML::Node &node ) { +void SelectorsDialog::_nodeAdded(Inkscape::XML::Node &node) +{ - SelectorsDialog::NodeWatcher *w = new SelectorsDialog::NodeWatcher (this, &node); + SelectorsDialog::NodeWatcher *w = new SelectorsDialog::NodeWatcher(this, &node); node.addObserver (*w); _nodeWatchers.push_back(w); @@ -148,8 +147,8 @@ SelectorsDialog::_nodeAdded( Inkscape::XML::Node &node ) { _selectRow(); } -void -SelectorsDialog::_nodeRemoved( Inkscape::XML::Node &repr ) { +void SelectorsDialog::_nodeRemoved(Inkscape::XML::Node &repr) +{ for (auto it = _nodeWatchers.begin(); it != _nodeWatchers.end(); ++it) { if ( (*it)->_repr == &repr ) { @@ -163,26 +162,24 @@ SelectorsDialog::_nodeRemoved( Inkscape::XML::Node &repr ) { _selectRow(); } -void -SelectorsDialog::_nodeChanged( Inkscape::XML::Node &object ) { +void SelectorsDialog::_nodeChanged(Inkscape::XML::Node &object) +{ _readStyleElement(); _selectRow(); } -SelectorsDialog::TreeStore::TreeStore() -= default; +SelectorsDialog::TreeStore::TreeStore() = default; /** * Allow dragging only selectors. */ -bool -SelectorsDialog::TreeStore::row_draggable_vfunc(const Gtk::TreeModel::Path& path) const +bool SelectorsDialog::TreeStore::row_draggable_vfunc(const Gtk::TreeModel::Path &path) const { g_debug("SelectorsDialog::TreeStore::row_draggable_vfunc"); - auto unconstThis = const_cast<SelectorsDialog::TreeStore*>(this); + auto unconstThis = const_cast<SelectorsDialog::TreeStore *>(this); const_iterator iter = unconstThis->get_iter(path); if (iter) { Gtk::TreeModel::Row row = *iter; @@ -253,9 +250,8 @@ void SelectorsDialog::fixCSSSelectors(Glib::ustring &selector) /** * Allow dropping only in between other selectors. */ -bool -SelectorsDialog::TreeStore::row_drop_possible_vfunc(const Gtk::TreeModel::Path& dest, - const Gtk::SelectionData& selection_data) const +bool SelectorsDialog::TreeStore::row_drop_possible_vfunc(const Gtk::TreeModel::Path &dest, + const Gtk::SelectionData &selection_data) const { g_debug("SelectorsDialog::TreeStore::row_drop_possible_vfunc"); @@ -266,10 +262,10 @@ SelectorsDialog::TreeStore::row_drop_possible_vfunc(const Gtk::TreeModel::Path& // This is only here to handle updating style element after a drag and drop. -void -SelectorsDialog::TreeStore::on_row_deleted(const TreeModel::Path& path) +void SelectorsDialog::TreeStore::on_row_deleted(const TreeModel::Path &path) { - if (_selectorsdialog->_updating) return; // Don't write if we deleted row (other than from DND) + if (_selectorsdialog->_updating) + return; // Don't write if we deleted row (other than from DND) g_debug("on_row_deleted"); @@ -279,10 +275,10 @@ SelectorsDialog::TreeStore::on_row_deleted(const TreeModel::Path& path) Glib::RefPtr<SelectorsDialog::TreeStore> SelectorsDialog::TreeStore::create(SelectorsDialog *selectorsdialog) { - SelectorsDialog::TreeStore * store = new SelectorsDialog::TreeStore(); + SelectorsDialog::TreeStore *store = new SelectorsDialog::TreeStore(); store->_selectorsdialog = selectorsdialog; - store->set_column_types( store->_selectorsdialog->_mColumns ); - return Glib::RefPtr<SelectorsDialog::TreeStore>( store ); + store->set_column_types(store->_selectorsdialog->_mColumns); + return Glib::RefPtr<SelectorsDialog::TreeStore>(store); } /** @@ -291,11 +287,11 @@ Glib::RefPtr<SelectorsDialog::TreeStore> SelectorsDialog::TreeStore::create(Sele * adds selectors to treeview. _delSelector deletes the selector from the dialog. * Any addition/deletion of the selectors updates XML style element accordingly. */ -SelectorsDialog::SelectorsDialog() : - UI::Widget::Panel("/dialogs/selectors", SP_VERB_DIALOG_SELECTORS), - _updating(false), - _textNode(nullptr), - _desktopTracker() +SelectorsDialog::SelectorsDialog() + : UI::Widget::Panel("/dialogs/selectors", SP_VERB_DIALOG_SELECTORS) + , _updating(false) + , _textNode(nullptr) + , _desktopTracker() { g_debug("SelectorsDialog::SelectorsDialog"); // Tree @@ -318,13 +314,11 @@ SelectorsDialog::SelectorsDialog() : _treeView.set_expander_column(*(_treeView.get_column(1))); // Signal handlers - _treeView.signal_button_release_event().connect( // Needs to be release, not press. - sigc::mem_fun(*this, &SelectorsDialog::_handleButtonEvent), - false); + _treeView.signal_button_release_event().connect( // Needs to be release, not press. + sigc::mem_fun(*this, &SelectorsDialog::_handleButtonEvent), false); _treeView.signal_button_release_event().connect_notify( - sigc::mem_fun(*this, &SelectorsDialog::_buttonEventsSelectObjs), - false); + sigc::mem_fun(*this, &SelectorsDialog::_buttonEventsSelectObjs), false); _treeView.signal_row_expanded().connect(sigc::mem_fun(*this, &SelectorsDialog::_rowExpand)); @@ -333,12 +327,12 @@ SelectorsDialog::SelectorsDialog() : _showWidgets(); // Document & Desktop - _desktop_changed_connection = _desktopTracker.connectDesktopChanged( - sigc::mem_fun(*this, &SelectorsDialog::_handleDesktopChanged) ); + _desktop_changed_connection = + _desktopTracker.connectDesktopChanged(sigc::mem_fun(*this, &SelectorsDialog::_handleDesktopChanged)); _desktopTracker.connect(GTK_WIDGET(gobj())); - _document_replaced_connection = getDesktop()->connectDocumentReplaced( - sigc::mem_fun(this, &SelectorsDialog::_handleDocumentReplaced)); + _document_replaced_connection = + getDesktop()->connectDocumentReplaced(sigc::mem_fun(this, &SelectorsDialog::_handleDocumentReplaced)); _selection_changed_connection = getDesktop()->getSelection()->connectChanged( sigc::hide(sigc::mem_fun(this, &SelectorsDialog::_handleSelectionChanged))); @@ -356,8 +350,7 @@ SelectorsDialog::SelectorsDialog() : show_all(); } -void -SelectorsDialog::_showWidgets() +void SelectorsDialog::_showWidgets() { // Pack widgets Inkscape::Preferences *prefs = Inkscape::Preferences::get(); @@ -390,8 +383,7 @@ SelectorsDialog::_showWidgets() set_name("SelectorsAndStyleDialog"); } -void -SelectorsDialog::_toggleDirection() +void SelectorsDialog::_toggleDirection() { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); bool dir = !prefs->getBool("/dialogs/selectors/updown", true); @@ -416,7 +408,7 @@ SelectorsDialog::~SelectorsDialog() * Returns the style element's text node. If there is no style element, one is created. * Ditto for text node. */ -Inkscape::XML::Node* SelectorsDialog::_getStyleTextNode() +Inkscape::XML::Node *SelectorsDialog::_getStyleTextNode() { Inkscape::XML::Node *styleNode = nullptr; @@ -548,7 +540,8 @@ void SelectorsDialog::_readStyleElement() properties = tokens[i+1]; } else { std::cerr << "SelectorsDialog::_readStyleElement: Missing values " - "for last selector!" << std::endl; + "for last selector!" + << std::endl; } REMOVE_SPACES(properties); bool colExpand = false; @@ -632,7 +625,8 @@ void SelectorsDialog::_writeStyleElement() } -void SelectorsDialog::_addWatcherRecursive(Inkscape::XML::Node *node) { +void SelectorsDialog::_addWatcherRecursive(Inkscape::XML::Node *node) +{ g_debug("SelectorsDialog::_addWatcherRecursive()"); @@ -857,7 +851,7 @@ void SelectorsDialog::_removeFromSelector(Gtk::TreeModel::Row row) * @return This function returns a comma separated list of ids for objects in input vector. * It is used in creating an 'id' selector. It relies on objects having 'id's. */ -Glib::ustring SelectorsDialog::_getIdList(std::vector<SPObject*> sel) +Glib::ustring SelectorsDialog::_getIdList(std::vector<SPObject *> sel) { Glib::ustring str; for (auto& obj: sel) { @@ -875,7 +869,8 @@ Glib::ustring SelectorsDialog::_getIdList(std::vector<SPObject*> sel) * @return objVec: a vector of pointers to SPObject's the selector matches. * Return a vector of all objects that selector matches. */ -std::vector<SPObject *> SelectorsDialog::_getObjVec(Glib::ustring selector) { +std::vector<SPObject *> SelectorsDialog::_getObjVec(Glib::ustring selector) +{ g_debug("SelectorsDialog::_getObjVec: | %s |", selector.c_str()); std::vector<SPObject *> objVec; @@ -1238,8 +1233,7 @@ private: * Handle document replaced. (Happens when a default document is immediately replaced by another * document in a new window.) */ -void -SelectorsDialog::_handleDocumentReplaced(SPDesktop *desktop, SPDocument * /* document */) +void SelectorsDialog::_handleDocumentReplaced(SPDesktop *desktop, SPDocument * /* document */) { g_debug("SelectorsDialog::handleDocumentReplaced()"); @@ -1257,8 +1251,8 @@ SelectorsDialog::_handleDocumentReplaced(SPDesktop *desktop, SPDocument * /* doc /* * When a dialog is floating, it is connected to the active desktop. */ -void -SelectorsDialog::_handleDesktopChanged(SPDesktop* desktop) { +void SelectorsDialog::_handleDesktopChanged(SPDesktop *desktop) +{ g_debug("SelectorsDialog::handleDesktopReplaced()"); if (getDesktop() == desktop) { @@ -1274,8 +1268,8 @@ SelectorsDialog::_handleDesktopChanged(SPDesktop* desktop) { _selection_changed_connection = desktop->getSelection()->connectChanged( sigc::hide(sigc::mem_fun(this, &SelectorsDialog::_handleSelectionChanged))); - _document_replaced_connection = desktop->connectDocumentReplaced( - sigc::mem_fun(this, &SelectorsDialog::_handleDocumentReplaced)); + _document_replaced_connection = + desktop->connectDocumentReplaced(sigc::mem_fun(this, &SelectorsDialog::_handleDocumentReplaced)); _updateWatchers(); _readStyleElement(); @@ -1286,8 +1280,8 @@ SelectorsDialog::_handleDesktopChanged(SPDesktop* desktop) { /* * Handle a change in which objects are selected in a document. */ -void -SelectorsDialog::_handleSelectionChanged() { +void SelectorsDialog::_handleSelectionChanged() +{ g_debug("SelectorsDialog::_handleSelectionChanged()"); _treeView.get_selection()->set_mode(Gtk::SELECTION_MULTIPLE); _selectRow(); @@ -1300,7 +1294,7 @@ SelectorsDialog::_handleSelectionChanged() { * on a selector selects the matching objects on the desktop. A double click will * in addition open the CSS dialog. */ -void SelectorsDialog::_buttonEventsSelectObjs(GdkEventButton* event ) +void SelectorsDialog::_buttonEventsSelectObjs(GdkEventButton *event) { g_debug("SelectorsDialog::_buttonEventsSelectObjs"); _treeView.get_selection()->set_mode(Gtk::SELECTION_SINGLE); @@ -1369,8 +1363,7 @@ void SelectorsDialog::_selectRow() * @param tooltip * Set the style of '+' and '-' buttons at the bottom of dialog. */ -void SelectorsDialog::_styleButton(Gtk::Button& btn, char const* iconName, - char const* tooltip) +void SelectorsDialog::_styleButton(Gtk::Button &btn, char const *iconName, char const *tooltip) { GtkWidget *child = sp_get_icon_image(iconName, GTK_ICON_SIZE_SMALL_TOOLBAR); gtk_widget_show(child); diff --git a/src/ui/dialog/selectorsdialog.h b/src/ui/dialog/selectorsdialog.h index 9a1a4b497..a1aa187bb 100644 --- a/src/ui/dialog/selectorsdialog.h +++ b/src/ui/dialog/selectorsdialog.h @@ -15,6 +15,10 @@ #ifndef SELECTORSDIALOG_H #define SELECTORSDIALOG_H +#include "ui/dialog/desktop-tracker.h" +#include "ui/dialog/dialog-manager.h" +#include "ui/dialog/styledialog.h" +#include "ui/widget/panel.h" #include <gtkmm/dialog.h> #include <gtkmm/paned.h> #include <gtkmm/scrolledwindow.h> @@ -24,10 +28,6 @@ #include <gtkmm/treestore.h> #include <gtkmm/treeview.h> #include <ui/widget/panel.h> -#include "ui/dialog/dialog-manager.h" -#include "ui/dialog/styledialog.h" -#include "ui/dialog/desktop-tracker.h" -#include "ui/widget/panel.h" #include "xml/helper-observer.h" @@ -48,7 +48,7 @@ namespace Dialog { */ class SelectorsDialog : public Widget::Panel { -public: + public: ~SelectorsDialog() override; // No default constructor, noncopyable, nonassignable SelectorsDialog(); @@ -56,7 +56,8 @@ public: SelectorsDialog operator=(SelectorsDialog const &d) = delete; static SelectorsDialog &getInstance() { return *new SelectorsDialog(); } -private: + + private: // Monitor <style> element for changes. class NodeObserver; @@ -64,7 +65,7 @@ private: class NodeWatcher; enum SelectorType { CLASS, ID, TAG }; void fixCSSSelectors(Glib::ustring &selector); - std::vector<SelectorsDialog::NodeWatcher*> _nodeWatchers; + std::vector<SelectorsDialog::NodeWatcher *> _nodeWatchers; void _nodeAdded( Inkscape::XML::Node &repr ); void _nodeRemoved( Inkscape::XML::Node &repr ); void _nodeChanged( Inkscape::XML::Node &repr ); @@ -107,7 +108,7 @@ private: static Glib::RefPtr<SelectorsDialog::TreeStore> create(SelectorsDialog *styledialog); private: - SelectorsDialog *_selectorsdialog; + SelectorsDialog *_selectorsdialog; }; // TreeView @@ -117,7 +118,7 @@ private: // Widgets Gtk::Paned _paned; Gtk::Switch _direction; - Gtk::Box _button_box; + Gtk::Box _button_box; Gtk::Box _selectors_box; Gtk::ScrolledWindow _scrolled_window_style; Gtk::ScrolledWindow _scrolled_window_selectors; diff --git a/src/ui/dialog/styledialog.cpp b/src/ui/dialog/styledialog.cpp index 4ce8da925..a1cde20df 100644 --- a/src/ui/dialog/styledialog.cpp +++ b/src/ui/dialog/styledialog.cpp @@ -229,11 +229,7 @@ StyleDialog::StyleDialog() _readStyleElement(); } -void -StyleDialog::_vscrool() -{ - _scroolpos = vadj->get_value(); -} +void StyleDialog::_vscrool() { _scroolpos = vadj->get_value(); } /** * Class destructor diff --git a/src/ui/dialog/styledialog.h b/src/ui/dialog/styledialog.h index 6e9aa4a72..6a4844f1d 100644 --- a/src/ui/dialog/styledialog.h +++ b/src/ui/dialog/styledialog.h @@ -111,7 +111,7 @@ class StyleDialog : public Widget::Panel { // Widgets Gtk::ScrolledWindow _scrolledWindow; - Glib::RefPtr< Gtk::Adjustment > vadj; + Glib::RefPtr<Gtk::Adjustment> vadj; Gtk::Box _mainBox; Gtk::Box _styleBox; Gtk::Switch *_all_css; diff --git a/src/verbs.cpp b/src/verbs.cpp index 92d97aa8e..cf30f1dea 100644 --- a/src/verbs.cpp +++ b/src/verbs.cpp @@ -3107,8 +3107,9 @@ Verb *Verb::_base_verbs[] = { INKSCAPE_ICON("dialog-text-and-font")), new DialogVerb(SP_VERB_DIALOG_XML_EDITOR, "DialogXMLEditor", N_("_XML Editor..."), N_("View and edit the XML tree of the document"), INKSCAPE_ICON("dialog-xml-editor")), - new DialogVerb(SP_VERB_DIALOG_SELECTORS, "DialogSelectors", N_("_Selectors & CSS..."), N_("View and edit selections and CSS styles"), INKSCAPE_ICON("dialog-selectors")), - + new DialogVerb(SP_VERB_DIALOG_SELECTORS, "DialogSelectors", N_("_Selectors & CSS..."), + N_("View and edit selections and CSS styles"), INKSCAPE_ICON("dialog-selectors")), + new DialogVerb(SP_VERB_DIALOG_FIND, "DialogFind", N_("_Find/Replace..."), N_("Find objects in document"), INKSCAPE_ICON("edit-find")), new DialogVerb(SP_VERB_DIALOG_SPELLCHECK, "DialogSpellcheck", N_("Check Spellin_g..."), |
