void Preferences::_setRawValue(Glib::ustring const &path, gchar const *value) { // create node and attribute keys Glib::ustring node_key, attr_key; _keySplit(path, node_key, attr_key); // set the attribute Inkscape::XML::Node *node = _getNode(node_key, true); node->setAttribute(attr_key.data(), value); }
SPCSSAttr *Preferences::_extractInheritedStyle(Entry const &v) { // This is the dirtiest extraction method. Generally we ignore whatever was in v._value // and just get the style using sp_repr_css_attr_inherited. To implement this in GConf, // we'll have to walk up the tree and call sp_repr_css_attr_add_from_string Glib::ustring node_key, attr_key; _keySplit(v._pref_path, node_key, attr_key); Inkscape::XML::Node *node = _getNode(node_key, false); return sp_repr_css_attr_inherited(node, attr_key.data()); }
/** * @brief Get the paths to all subdirectories of the specified path * @param path Preference path to query * @return A vector containing absolute paths to all subdirectories in the given path */ std::vector<Glib::ustring> Preferences::getAllDirs(Glib::ustring const &path) { std::vector<Glib::ustring> temp; Inkscape::XML::Node *node = _getNode(path, false); if (!node) return temp; for (Inkscape::XML::NodeSiblingIterator i = node->firstChild(); i; ++i) { temp.push_back(path + '/' + i->attribute("id")); } return temp; }
/** * @brief Get names of all entries in the specified path * @param path Preference path to query * @return A vector containing all entries in the given directory */ std::vector<Preferences::Entry> Preferences::getAllEntries(Glib::ustring const &path) { std::vector<Entry> temp; Inkscape::XML::Node *node = _getNode(path, false); if (!node) return temp; // argh - purge this Util::List nonsense from XML classes fast Inkscape::Util::List<Inkscape::XML::AttributeRecord const> alist = node->attributeList(); for (; alist; ++alist) temp.push_back( Entry(path + '/' + g_quark_to_string(alist->key), static_cast<void const*>(alist->value.pointer())) ); return temp; }
void Preferences::_getRawValue(Glib::ustring const &path, gchar const *&result) { // create node and attribute keys Glib::ustring node_key, attr_key; _keySplit(path, node_key, attr_key); // retrieve the attribute Inkscape::XML::Node *node = _getNode(node_key, false); if ( node == NULL ) { result = NULL; } else { gchar const *attr = node->attribute(attr_key.data()); if ( attr == NULL ) { result = NULL; } else { result = attr; } } }
/** * @brief Find the XML node to observe */ XML::Node *Preferences::_findObserverNode(Glib::ustring const &pref_path, Glib::ustring &node_key, Glib::ustring &attr_key, bool create) { // first assume that the last path element is an entry. _keySplit(pref_path, node_key, attr_key); // find the node corresponding to the "directory". Inkscape::XML::Node *node = _getNode(node_key, create), *child; for (child = node->firstChild(); child; child = child->next()) { // If there is a node with id corresponding to the attr key, // this means that the last part of the path is actually a key (folder). // Change values accordingly. if (attr_key == child->attribute("id")) { node = child; attr_key = ""; node_key = pref_path; break; } } return node; }
NodeType* BodyNodeSpecializedFor<SpecNode>::getNode(std::size_t index) { return _getNode(type<NodeType>(), index); }
NodeType* SkeletonSpecializedFor<SpecNode>::getNode( const std::string& name) { return _getNode(type<NodeType>(), name); }
NodeType* SkeletonSpecializedFor<SpecNode>::getNode( std::size_t treeIndex, std::size_t nodeIndex) { return _getNode(type<NodeType>(), treeIndex, nodeIndex); }
boolean MatrixCharlieplex::turnOff(uint16_t index) { return _setNode(_getNode(index), LOW); }
boolean MatrixCharlieplex::turnOn(uint16_t index) { return _setNode(_getNode(index), HIGH); }
boolean MatrixCharlieplex::turnOff(uint8_t row, uint8_t col) { return _setNode(_getNode(row, col), LOW); }
boolean MatrixCharlieplex::turnOn(uint8_t row, uint8_t col) { return _setNode(_getNode(row, col), HIGH); }