/* If code in PCB should change the netlist, call this to update | what's in the netlist window. */ void ghid_netlist_window_update (gboolean init_nodes) { GtkTreeModel *model; /* Make sure there is something to update */ ghid_netlist_window_create (gport); model = net_model; net_model = net_model_create (); gtk_tree_view_set_model (net_treeview, net_model); gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (net_model), NET_NAME_COLUMN, GTK_SORT_ASCENDING); if (model) { gtk_tree_store_clear (GTK_TREE_STORE (model)); g_object_unref (model); } selected_net = NULL; /* XXX Check if the select callback does this for us */ if (init_nodes) node_model_update ((&PCB->NetlistLib)->Menu); }
/* Called when the user clicks on a net in the left treeview. */ static void net_selection_changed_cb (GtkTreeSelection * selection, gpointer data) { GtkTreeIter iter; GtkTreeModel *model; LibraryMenuType *net; if (selection_holdoff) /* PCB is highlighting, user is not selecting */ return; if (!gtk_tree_selection_get_selected (selection, &model, &iter)) { selected_net = NULL; return; } /* Get a pointer, net, to the LibraryMenuType of the newly selected | netlist row, and create a new node model from the net entries | and insert that model into the node view. Delete old entry model. */ gtk_tree_model_get (model, &iter, NET_LIBRARY_COLUMN, &net, -1); node_model_update (net); selected_net = net; }
/* PCB LookupConnection code in find.c calls this if it wants a node | and its net highlighted. */ void ghid_netlist_highlight_node (gchar * node_name) { GtkTreePath *path; GtkTreeIter iter; LibraryMenuType *net; gchar *name; if (!node_name) return; if ((net = ghid_get_net_from_node_name (node_name, TRUE)) == NULL) return; /* We've found the net containing the node, so update the node treeview | to contain the nodes from the net. Then we have to find the node | in the new node model so we can highlight it. */ node_model_update (net); if (gtk_tree_model_get_iter_first (node_model, &iter)) do { gtk_tree_model_get (node_model, &iter, NODE_NAME_COLUMN, &name, -1); if (!strcmp (node_name, name)) { /* found it, so highlight it */ selection_holdoff = TRUE; selected_net = net; path = gtk_tree_model_get_path (node_model, &iter); gtk_tree_view_scroll_to_cell (node_treeview, path, NULL, TRUE, 0.5, 0.5); gtk_tree_selection_select_path (gtk_tree_view_get_selection (node_treeview), path); selection_holdoff = FALSE; } g_free (name); } while (gtk_tree_model_iter_next (node_model, &iter)); }
void ghid_netlist_nodes_update (LibraryMenuType * net) { node_model_update (net); }