static int LesstifNetlistShow (int argc, char **argv, Coord x, Coord y) { if (build_netlist_dialog ()) return 0; if (argc == 1) { LibraryMenuTypePtr net; net = netnode_to_netname(argv[0]); if (net) { XmString item; int vis = 0; /* Select net first, 'True' causes pick_net() to be invoked */ item = XmStringCreatePCB (net->Name); XmListSelectItem (netlist_list, item, True); XmListSetItem (netlist_list, item); XmStringFree (item); /* Now the netnode_list has the right contents */ item = XmStringCreatePCB (argv[0]); XmListSelectItem (netnode_list, item, False); /* * Only force the item to the top if there are enough to scroll. * A bug (?) in lesstif will cause the window to get ever wider * if an XmList that doesn't require a scrollbar is forced to * have one (when the top item is not the first item). */ n = 0; stdarg (XmNvisibleItemCount, &vis); XtGetValues (netnode_list, args, n); if (n_netnode_strings > vis) { XmListSetItem (netnode_list, item); } XmStringFree (item); } else { /* Try the argument as a netname */ net = netname_to_netname(argv[0]); if (net) { XmString item; item = XmStringCreatePCB (net->Name); XmListSetItem (netlist_list, item); XmListSelectItem (netlist_list, item, True); XmStringFree (item); } } } return 0; }
static void Reset(Widget w) { int status; Widget list_w = XtNameToWidget(XtParent(w),"*interpreters"); static struct descriptor_d cli = {0, DTYPE_T, CLASS_D, 0}; static DESCRIPTOR(initial, "_I=0"); static DESCRIPTOR(clis, "(clis()[_I++]//\"\\0\")"); XtPointer user_data; int nid; String selections; String selection; int ctx = 0; int first = 1; XtVaGetValues(list_w, XmNuserData, &user_data, NULL); nid = (intptr_t)user_data; XmListDeselectAllItems(list_w); XmListDeleteAllItems(list_w); TdiExecute(&initial,&cli MDS_END_ARG); while ((status=TdiExecute(&clis, &cli MDS_END_ARG)&1 && cli.length > 0 && strlen(cli.pointer) > 0)) { XmString item; item = XmStringCreateSimple(cli.pointer); if (!XmListItemExists(list_w,item)) XmListAddItem(list_w,item,0); XmStringFree(item); } selections = XmdsGetNidText(nid); for (selection=strtok(selections,"\n");selection;selection=strtok(0,"\n")) { XmString item = XmStringCreateSimple(selection); XmListSelectItem(list_w, item, 0); if (first) { first = 0; XmListSetItem(list_w, item); } XmStringFree(item); } XtFree(selections); return; }