diff options
| author | Jabiertxof <jabier.arraiza@marker.es> | 2019-08-29 16:38:32 +0000 |
|---|---|---|
| committer | Jabiertxof <jabier.arraiza@marker.es> | 2019-08-29 16:38:32 +0000 |
| commit | b515997d1b2af5271b18448f9fafd0600d3c5b16 (patch) | |
| tree | bfd40a59b993ad4518ded7b36bbf4358edb0c04b /src/ui | |
| parent | Improve CSS and Selectors dialog (diff) | |
| download | inkscape-b515997d1b2af5271b18448f9fafd0600d3c5b16.tar.gz inkscape-b515997d1b2af5271b18448f9fafd0600d3c5b16.zip | |
Fixes on UX inb CSS dialog
Diffstat (limited to 'src/ui')
| -rw-r--r-- | src/ui/dialog/selectorsdialog.cpp | 13 | ||||
| -rw-r--r-- | src/ui/dialog/selectorsdialog.h | 4 | ||||
| -rw-r--r-- | src/ui/dialog/styledialog.cpp | 13 | ||||
| -rw-r--r-- | src/ui/dialog/styledialog.h | 1 |
4 files changed, 14 insertions, 17 deletions
diff --git a/src/ui/dialog/selectorsdialog.cpp b/src/ui/dialog/selectorsdialog.cpp index f66876475..375d2d89b 100644 --- a/src/ui/dialog/selectorsdialog.cpp +++ b/src/ui/dialog/selectorsdialog.cpp @@ -25,8 +25,8 @@ #include "verbs.h" #include "xml/attribute-record.h" -#include "xml/sp-css-attr.h" #include "xml/node-observer.h" +#include "xml/sp-css-attr.h" #include <glibmm/i18n.h> #include <glibmm/regex.h> @@ -395,10 +395,7 @@ void SelectorsDialog::_panedresized(Gtk::Allocation allocation) _resized(); } -void SelectorsDialog::_panedrealized() -{ - _style_dialog->readStyleElement(); -} +void SelectorsDialog::_panedrealized() { _style_dialog->readStyleElement(); } void SelectorsDialog::_childresized() { @@ -877,10 +874,8 @@ void SelectorsDialog::_addToSelector(Gtk::TreeModel::Row row) sp_repr_css_attr_add_from_string(css, obj->getRepr()->attribute("style")); Glib::ustring selprops = row[_mColumns._colProperties]; sp_repr_css_attr_add_from_string(css_selector, selprops.c_str()); - for ( List<AttributeRecord const> iter = css_selector->attributeList() ; - iter ; ++iter ) - { - gchar const * key = g_quark_to_string(iter->key); + for (List<AttributeRecord const> iter = css_selector->attributeList(); iter; ++iter) { + gchar const *key = g_quark_to_string(iter->key); css->setAttribute(key, nullptr); } sp_repr_css_write_string(css, css_str); diff --git a/src/ui/dialog/selectorsdialog.h b/src/ui/dialog/selectorsdialog.h index d304ccfad..1039b1e4d 100644 --- a/src/ui/dialog/selectorsdialog.h +++ b/src/ui/dialog/selectorsdialog.h @@ -56,7 +56,7 @@ class SelectorsDialog : public Widget::Panel { SelectorsDialog(SelectorsDialog const &d) = delete; SelectorsDialog operator=(SelectorsDialog const &d) = delete; static SelectorsDialog &getInstance() { return *new SelectorsDialog(); } - + private: // Monitor <style> element for changes. class NodeObserver; @@ -155,7 +155,7 @@ class SelectorsDialog : public Widget::Panel { // Variables double _scroolpos; bool _scroollock; - bool _updating; // Prevent cyclic actions: read <-> write, select via dialog <-> via desktop + bool _updating; // Prevent cyclic actions: read <-> write, select via dialog <-> via desktop Inkscape::XML::Node *_textNode; // Track so we know when to add a NodeObserver. // Signals and handlers - External diff --git a/src/ui/dialog/styledialog.cpp b/src/ui/dialog/styledialog.cpp index 98d81bb7c..dadb2365e 100644 --- a/src/ui/dialog/styledialog.cpp +++ b/src/ui/dialog/styledialog.cpp @@ -1004,7 +1004,7 @@ void StyleDialog::_onPropDelete(Glib::ustring path, Glib::RefPtr<Gtk::TreeStore> if (row) { Glib::ustring selector = row[_mColumns._colSelector]; row[_mColumns._colName] = ""; - _deleted_pos = row[_mColumns._colSelectorPos]; + _deleted_pos = row[_mColumns._colSelectorPos]; store->erase(row); _deletion = true; _writeStyleElement(store, selector); @@ -1136,7 +1136,7 @@ void StyleDialog::_writeStyleElement(Glib::RefPtr<Gtk::TreeStore> store, Glib::u selectormatch = selectormatch + "[^}]*?}"; } selectormatch = selectormatch + ")([^}]*?})((.|\n)*)"; - + Inkscape::XML::Node *textNode = _getStyleTextNode(); std::regex e(selectormatch.c_str()); std::string content = (textNode->content() ? textNode->content() : ""); @@ -1336,7 +1336,8 @@ gboolean sp_styledialog_store_move_to_next(gpointer data) Gtk::TreeIter iter = *(selection->get_selected()); Gtk::TreeModel::Path model = (Gtk::TreeModel::Path)iter; if (model == styledialog->_current_path) { - styledialog->_current_css_tree->set_cursor(styledialog->_current_path, *styledialog->_current_value_col, true); + styledialog->_current_css_tree->set_cursor(styledialog->_current_path, *styledialog->_current_value_col, + true); } } return FALSE; @@ -1375,7 +1376,7 @@ void StyleDialog::_nameEdited(const Glib::ustring &path, const Glib::ustring &na Glib::ustring old_name = row[_mColumns._colName]; row[_mColumns._colName] = finalname; if (finalname.empty() && value.empty()) { - _deleted_pos = row[_mColumns._colSelectorPos]; + _deleted_pos = row[_mColumns._colSelectorPos]; store->erase(row); } gint col = 3; @@ -1435,13 +1436,13 @@ void StyleDialog::_valueEdited(const Glib::ustring &path, const Glib::ustring &v Glib::ustring selector = row[_mColumns._colSelector]; Glib::ustring name = row[_mColumns._colName]; if (name.empty() && finalvalue.empty()) { - _deleted_pos = row[_mColumns._colSelectorPos]; + _deleted_pos = row[_mColumns._colSelectorPos]; store->erase(row); } _writeStyleElement(store, selector); if (selector != "style_properties" && selector != "attributes") { std::vector<SPObject *> objs = _getObjVec(selector); - for (auto obj : objs){ + for (auto obj : objs) { Glib::ustring css_str = ""; SPCSSAttr *css = sp_repr_css_attr_new(); sp_repr_css_attr_add_from_string(css, obj->getRepr()->attribute("style")); diff --git a/src/ui/dialog/styledialog.h b/src/ui/dialog/styledialog.h index a5a559733..7630808a8 100644 --- a/src/ui/dialog/styledialog.h +++ b/src/ui/dialog/styledialog.h @@ -73,6 +73,7 @@ class StyleDialog : public Widget::Panel { bool _deletion; Glib::ustring fixCSSSelectors(Glib::ustring selector); void readStyleElement(); + private: // Monitor <style> element for changes. class NodeObserver; |
