Exemplo n.º 1
0
Arquivo: op.cpp Projeto: maxiang/CNTK
 OperatorSchemaSetter& OperatorSchemaSetter::FillUsing(std::function<void(OperatorSchemaSetter&)> populator)
 {
     if (populator) {
         populator(*this);
     }
     return *this;
 }
Exemplo n.º 2
0
void GraphTreeModel::refresh()
{
	// Instantiate a scenegraph walker and visit every node in the graph
	// The walker also clears the graph in its constructor
	GraphTreeModelPopulator populator(*this, _visibleNodesOnly);
	Node_traverseSubgraph(GlobalSceneGraph().root(), populator);
}
Exemplo n.º 3
0
FacePtrVector getSelectedFaces() {
	FacePtrVector vector;
	
	// Cycle through all selected faces and fill the vector 
	FaceVectorPopulator populator(vector);
	g_SelectedFaceInstances.foreach(populator);
	
	return vector;
}
Exemplo n.º 4
0
void GraphTreeModel::refresh()
{
    // Create a new model from scratch and populate it
    _model = new wxutil::TreeModel(_columns);

	// Instantiate a scenegraph walker and visit every node in the graph
	// The walker also clears the graph in its constructor
	GraphTreeModelPopulator populator(*this, _visibleNodesOnly);
	GlobalSceneGraph().root()->traverse(populator);

    // Now sort the model once we have all nodes in the tree
    _model->SortModelByColumn(_columns.name);
}
Exemplo n.º 5
0
// Create the Tree View
GtkWidget* ShaderSelector::createTreeView() {
	// Tree model
	GtkTreeStore* store = gtk_tree_store_new(N_COLUMNS,
											G_TYPE_STRING, // display name in tree
											G_TYPE_STRING, // full shader name
											GDK_TYPE_PIXBUF);

	// Instantiate the helper class that populates the tree according to the paths
	gtkutil::VFSTreePopulator populator(store);

	ShaderNameVisitor func(populator, _prefixes);
	GlobalShaderSystem().foreachShaderName(func);

	// Now visit the created GtkTreeIters to load the actual data into the tree
	DataInserter inserter;
	populator.forEachNode(inserter);

	// Tree view
	_treeView = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
	gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(_treeView), FALSE);
	g_object_unref(store); // tree view owns the reference now

	// Single visible column, containing the directory/shader name and the icon
	gtk_tree_view_append_column(GTK_TREE_VIEW(_treeView),
								gtkutil::IconTextColumn(_("Value"),
														NAME_COL,
														IMAGE_COL));

	// Set the tree store to sort on this column
	gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(store), NAME_COL, GTK_SORT_ASCENDING);

	// Use the TreeModel's full string search function
	gtk_tree_view_set_search_equal_func(GTK_TREE_VIEW(_treeView), gtkutil::TreeModel::equalFuncStringContains, NULL, NULL);

	// Get selection and connect the changed callback
	_selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(_treeView));
	g_signal_connect(G_OBJECT(_selection),
					"changed",
					G_CALLBACK(_onSelChange),
					this);

	// Pack into scrolled window and frame
	return gtkutil::ScrolledFrame(_treeView);
}
Exemplo n.º 6
0
void EClassTree::updatePropertyView(const std::string& eclassName) {
	// Clear the existing list
	gtk_list_store_clear(_propertyStore);
	
	IEntityClassPtr eclass = GlobalEntityClassManager().findClass(eclassName);
	if (eclass == NULL) {
		return;
	}
	
	class ListStorePopulator :
		public EntityClassAttributeVisitor
	{
		GtkListStore* _listStore;
	public:
		ListStorePopulator(GtkListStore* targetStore) :
			_listStore(targetStore)
		{}
		
		virtual void visit(const EntityClassAttribute& attr) {
			// Append the details to the treestore
			GtkTreeIter iter;
			gtk_list_store_append(_listStore, &iter);
			gtk_list_store_set(
				_listStore, &iter,
				PROPERTY_NAME_COLUMN, attr.name.c_str(),
				PROPERTY_VALUE_COLUMN, attr.value.c_str(),
				PROPERTY_TEXT_COLOUR_COLUMN, attr.inherited ? "#666666" : "black",
				PROPERTY_INHERITED_FLAG_COLUMN, attr.inherited ? "1" : "0",
				-1
			);
		}
	};
	
	ListStorePopulator populator(_propertyStore);
	eclass->forEachClassAttribute(populator, true);
}
Exemplo n.º 7
0
NodeIterator::NodeIterator(std::function<void(NodeIterator&)>&& populator)
  : impl { std::make_unique<Pimpl>() } {
  populator(*this);
}
Exemplo n.º 8
0
AttributeIterator::AttributeIterator(std::function<void(AttributeIterator&)>&& populator)
  : impl { std::make_unique<AttributeIterator::Pimpl>() } {
  populator(*this);
}