From 0cb42f2ea44a9d5da0c3a3ff5cca6fa82511d81b Mon Sep 17 00:00:00 2001 From: kamalpreetgrewal Date: Fri, 19 Aug 2016 13:23:45 +0530 Subject: Pass remaining simple class selector tests (bzr r14949.1.74) --- src/ui/dialog/styledialog.cpp | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) (limited to 'src/ui/dialog/styledialog.cpp') diff --git a/src/ui/dialog/styledialog.cpp b/src/ui/dialog/styledialog.cpp index e9b00bf1c..878ab1926 100644 --- a/src/ui/dialog/styledialog.cpp +++ b/src/ui/dialog/styledialog.cpp @@ -671,11 +671,14 @@ void StyleDialog::_selAdd(Gtk::TreeModel::Row row) obj->setAttribute("class", key.erase(0,1)); } else { - obj->setAttribute("class", std::string - (obj->getRepr()-> - attribute("class")) - + " " + key - .erase(0,1)); + if (obj->getRepr()->attribute("class") != key + .erase(0,1)) { + obj->setAttribute("class", std::string + (obj->getRepr()-> + attribute("class")) + + " " + key + .erase(0,1)); + } } } } @@ -708,21 +711,23 @@ void StyleDialog::_selAdd(Gtk::TreeModel::Row row) REMOVE_SPACES(matchSelector); if (key == matchSelector) { REMOVE_SPACES((*it)._selector); - if ("#" + std::string(obj->getId()) != selectorName) { - inkSelector._selector = (*it)._selector; - inkSelector._selector.append(", #" + std::string(obj->getId())); - inkSelector._xmlContent = inkSelector._selector + "{" + value + "}\n"; - row[_mColumns._selectorLabel] = selectorName + ", " + - childrow[_mColumns._selectorLabel]; + if (selectorName[0] == '#') { + if ("#" + std::string(obj->getId()) != selectorName) { + inkSelector._selector = (*it)._selector; + inkSelector._selector.append(", #" + std::string(obj->getId())); + inkSelector._xmlContent = inkSelector._selector + "{" + value + "}\n"; + row[_mColumns._selectorLabel] = selectorName + ", " + + childrow[_mColumns._selectorLabel]; + } + } + else if (selectorName[0] == '.') { + inkSelector._xmlContent = (*it)._selector + "{" + value + "}\n"; } + it = _selectorVec.erase(it); it = _selectorVec.insert(it, inkSelector); } } - -// if (selectorName[0] == '.') { -// inkSelector._xmlContent = ""; -// } } if (_styleElementNode()) { _styleChild = _styleElementNode(); -- cgit v1.2.3