示例#1
0
bool
CanvasTreeStore::find_first_value_node(const synfig::ValueNode::Handle& value_node, Gtk::TreeIter& iter)
{
	// maybe replace the ValueNode_Const or ValueNode_Animated with the contained ValueNode_Bone
	// todo: do we need to do this in find_next_value_node, and find_*_value_desc too?
	synfig::ValueNode::Handle node(expandable_bone_parent(value_node));

	iter=children().begin();
	while(iter && node!=(ValueNode::Handle)(*iter)[model.value_node])
	{
		if(!iter->children().empty())
		{
			Gtk::TreeIter iter2(iter->children().begin());
			//! \todo confirm that the && should be done before the ||
			if((iter2 && node==(ValueNode::Handle)(*iter2)[model.value_node]) || find_next_value_node(node, iter2))
			{
				iter=iter2;
				return true;
			}
		}
		Gtk::TreeIter iter2(++iter);
		if(!iter2)
			iter==iter->parent();
		else
			iter=iter2;
	}
	return (bool)iter && node==(ValueNode::Handle)(*iter)[model.value_node];
}
示例#2
0
bool
CanvasTreeStore::find_next_value_node(const synfig::ValueNode::Handle& value_node, Gtk::TreeIter& iter)
{
	if(!iter) return find_first_value_node(value_node,iter);

	if(iter) do {
		if(!iter->children().empty())
		{
			Gtk::TreeIter iter2(iter->children().begin());
			//! \todo confirm that the && should be done before the ||
			if((iter2 && value_node==(ValueNode::Handle)(*iter2)[model.value_node]) || find_next_value_node(value_node, iter2))
			{
				iter=iter2;
				return true;
			}
		}
		Gtk::TreeIter iter2(++iter);
		if(!iter2)
		{
			iter==iter->parent();
			if(iter)++iter;
		}
		else
			iter=iter2;
	} while(iter && value_node!=(ValueNode::Handle)(*iter)[model.value_node]);
	return (bool)iter && value_node==(ValueNode::Handle)(*iter)[model.value_node];
}
示例#3
0
bool
CanvasTreeStore::find_first_value_desc(const synfigapp::ValueDesc& value_desc, Gtk::TreeIter& iter)
{
	iter=children().begin();
	while(iter && value_desc!=(*iter)[model.value_desc])
	{
		if(!iter->children().empty())
		{
			Gtk::TreeIter iter2(iter->children().begin());
			//! \todo confirm that the && should be done before the ||
			if((iter2 && value_desc==(*iter2)[model.value_desc]) || find_next_value_desc(value_desc, iter2))
			{
				iter=iter2;
				return true;
			}
		}
		Gtk::TreeIter iter2(++iter);
		if(!iter2)
			iter==iter->parent();
		else
			iter=iter2;
	}
	return (bool)iter && value_desc==(*iter)[model.value_desc];
}
示例#4
0
void GrpBuffer::fill_tree_branch(Gtk::TreeIter node, GrpHierarchy groups)
{
  for(GrpHierarchy::iter i = groups.begin();
      i != groups.end(); i++)
    {
      Gtk::TreeIter it;
      it = data->append(node->children());
      (*it)[columns->name] = i->second.name;
      (*it)[columns->subscribed] = false;
      (*it)[columns->font] = "normal";
      if (i->second.name.empty()) {
	(*it)[columns->internal] = true;
	(*it)[columns->caption] = i->first;
      } else {
	(*it)[columns->internal] = false;
	(*it)[columns->caption] = i->second.name;
      }

      if (i->second.has_child())
	fill_tree_branch(it, i->second);
    }
}
示例#5
0
Gtk::TreeIter AddinsTreeModel::append(const gnote::AddinInfo & module_info,
                                      const sharp::DynamicModule *module)
{
    gnote::AddinCategory category = module_info.category();
    Gtk::TreeIter iter = children().begin();
    while(iter != children().end()) {
        gnote::AddinCategory row_value;
        iter->get_value(3, row_value);
        if(row_value == category)
            break;
        else ++iter;
    }
    if(iter == children().end()) {
        iter = Gtk::TreeStore::append();
        iter->set_value(0, get_addin_category_name(category));
        iter->set_value(3, category);
    }
    iter = Gtk::TreeStore::append(iter->children());
    iter->set_value(0, std::string(module_info.name()));
    iter->set_value(1, std::string(module_info.version()));
    iter->set_value(2, module);
    iter->set_value(4, module_info.id());
    return iter;
}