/* 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); }
LibraryEntryType * node_get_node_from_name (gchar * node_name, LibraryMenuType ** node_net) { node_get_node_from_name_state state; if (!node_name) return NULL; /* Have to force the netlist window created because we need the treeview | models constructed to do the search. */ ghid_netlist_window_create (gport); /* Now walk through node entries of each net in the net model looking for | the node_name. */ state.found = 0; state.node_name = node_name; gtk_tree_model_foreach (net_model, node_get_node_from_name_helper, &state); if (state.found) { if (node_net) *node_net = state.node_net; return state.ret_val; } return NULL; }
void ghid_netlist_window_show (GHidPort * out, gboolean raise) { ghid_netlist_window_create (out); gtk_widget_show_all (netlist_window); ghid_netlist_window_update (TRUE); if (raise) gtk_window_present(GTK_WINDOW(netlist_window)); }
show the window if it isn't already shown."; static gint GhidNetlistShow (int argc, char **argv, Coord x, Coord y) { ghid_netlist_window_create (gport); if (argc > 0) ghid_netlist_highlight_node(argv[0]); return 0; }
LibraryMenuType * ghid_get_net_from_node_name (gchar * node_name, gboolean enabled_only) { GtkTreePath *path; struct ggnfnn_task task; if (!node_name) return NULL; /* Have to force the netlist window created because we need the treeview | models constructed so we can find the LibraryMenuType pointer the | caller wants. */ if (!netlist_window) ghid_netlist_window_create (gport); while (gtk_events_pending ()) /* Make sure everything gets built */ gtk_main_iteration (); /* If no netlist is loaded the window doesn't appear. */ if (netlist_window == NULL) return NULL; task.enabled_only = enabled_only; task.node_name = node_name; task.found_net = NULL; /* Now walk through node entries of each net in the net model looking for | the node_name. */ gtk_tree_model_foreach (net_model, hunt_named_node, &task); /* We are asked to highlight the found net if enabled_only is TRUE. | Set holdoff TRUE since this is just a highlight and user is not | expecting normal select action to happen? Or should the node | treeview also get updated? Original PCB code just tries to highlight. */ if (task.found_net && enabled_only) { selection_holdoff = TRUE; path = gtk_tree_model_get_path (net_model, &task.iter); gtk_tree_view_scroll_to_cell (net_treeview, path, NULL, TRUE, 0.5, 0.5); gtk_tree_selection_select_path (gtk_tree_view_get_selection (net_treeview), path); selection_holdoff = FALSE; } return task.found_net; }
LibraryEntryType * node_get_node_from_name (gchar * node_name, LibraryMenuType ** node_net) { GtkTreeIter iter; LibraryMenuType *net; LibraryEntryType *node; gint j; if (!node_name) return NULL; /* Have to force the netlist window created because we need the treeview | models constructed to do the search. */ if (!netlist_window) ghid_netlist_window_create (gport); while (gtk_events_pending ()) /* Make sure everything gets built */ gtk_main_iteration (); /* Now walk through node entries of each net in the net model looking for | the node_name. */ if (gtk_tree_model_get_iter_first (net_model, &iter)) do { gtk_tree_model_get (net_model, &iter, NET_LIBRARY_COLUMN, &net, -1); /* Look for the node name in this net. */ for (j = net->EntryN, node = net->Entry; j; j--, node++) if (node->ListEntry && !strcmp (node_name, node->ListEntry)) { if (node_net) *node_net = net; return node; } } while (gtk_tree_model_iter_next (net_model, &iter)); return NULL; }