summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorkamalpreetgrewal <grewalkamal005@gmail.com>2016-07-13 16:52:20 +0000
committerkamalpreetgrewal <grewalkamal005@gmail.com>2016-07-13 16:52:20 +0000
commit593e73c62fd16032ddd1ec85f21fb32ae543d753 (patch)
treec6571c0df2db8f969cb5bf7a634f25cfa9118d3f /src
parentReplace s1 with matchSelector (diff)
downloadinkscape-593e73c62fd16032ddd1ec85f21fb32ae543d753.tar.gz
inkscape-593e73c62fd16032ddd1ec85f21fb32ae543d753.zip
Correct deletion of child rows when parent selector is deleted
(bzr r14949.1.49)
Diffstat (limited to 'src')
-rw-r--r--src/ui/dialog/styledialog.cpp31
1 files changed, 27 insertions, 4 deletions
diff --git a/src/ui/dialog/styledialog.cpp b/src/ui/dialog/styledialog.cpp
index 4c4cb03aa..bf731466f 100644
--- a/src/ui/dialog/styledialog.cpp
+++ b/src/ui/dialog/styledialog.cpp
@@ -327,8 +327,25 @@ void StyleDialog::_delSelector()
for (Gtk::TreeModel::Children::iterator child = row.children().begin();
child != row.children().end(); ++child) {
Gtk::TreeModel::Row childrow = *child;
- if (key == childrow[_mColumns._selectorLabel]) {
- _selectorVec.erase(it);
+ std::string childSel, childKey;
+ std::vector<_selectorVecType>::iterator i;
+ for (i = _selectorVec.begin(); i != _selectorVec.end();) {
+ childSel = (*i).second;
+ REMOVE_SPACES(childSel);
+ if (!childSel.empty()) {
+ childKey = strtok(strdup(childSel.c_str()), "{");
+ REMOVE_SPACES(childKey);
+ }
+ Glib::ustring selectedChildRowLabel =
+ childrow[_mColumns._selectorLabel];
+ std::string matchChildSelector = selectedChildRowLabel;
+ REMOVE_SPACES(matchChildSelector);
+ if (childKey == matchChildSelector) {
+ i = _selectorVec.erase(i);
+ }
+ else {
+ ++i;
+ }
}
}
}
@@ -568,8 +585,14 @@ bool StyleDialog::_handleButtonEvent(GdkEventButton *event)
std::string(obj->getId());
childrow[_mColumns._colAddRemove] = false;
childrow[_mColumns._colObj] = _desktop->selection->list();
- childStyle = "#" + std::string(obj->getId()) + "{" +
- std::string(obj->getAttribute("style")) + "}\n";
+ if (obj->getAttribute("style") != NULL) {
+ childStyle = "#" + std::string(obj->getId()) + "{" +
+ std::string(obj->getAttribute("style")) + "}\n";
+ }
+ else {
+ childStyle = "#" + std::string(obj->getId())
+ + "{" + "}\n";
+ }
Glib::ustring key = row[_mColumns._selectorLabel];
if (strcmp(key.substr(0,1).c_str(), ".") == 0) {
if (!obj->getRepr()->attribute("class")) {