4a234f089be336a40604bf7002b3811dc3dad308
kent
  Mon Aug 9 14:58:47 2010 -0700
Adding a trackHash parameter to a bunch of metadata routines so that they could find the track associated with a table.  Fixing clipping bug in hgTracks.c for multiWig labels when in non-overlay mode due to a special case that seems to be obsolete (did fair bit of testing to make sure it's not used.)
diff --git src/hg/hgTables/hgTables.c src/hg/hgTables/hgTables.c
index 622e342..f5ccac3 100644
--- src/hg/hgTables/hgTables.c
+++ src/hg/hgTables/hgTables.c
@@ -52,6 +52,7 @@
 struct grp *fullGroupList;	/* List of all groups. */
 struct grp *curGroup;	/* Currently selected group. */
 struct trackDb *fullTrackList;	/* List of all tracks in database. */
+struct hash *fullTrackHash;     /* Hash of all tracks in fullTrackList keyed by ->track field. */
 struct trackDb *curTrack;	/* Currently selected track. */
 char *curTable;		/* Currently selected table. */
 struct joiner *allJoiner;	/* Info on how to join tables. */
@@ -1722,10 +1723,21 @@
 
 char *excludeVars[] = {"Submit", "submit", NULL};
 
+static struct hash *hashTrackList(struct trackDb *tdbList)
+/* Return hash full of trackDb's from list, keyed by tdb->track */
+{
+struct hash *hash = hashNew(0);
+struct trackDb *tdb;
+for (tdb = tdbList; tdb != NULL; tdb = tdb->next)
+    hashAdd(hash, tdb->track, tdb);
+return hash;
+}
+
 void initGroupsTracksTables()
 /* Get list of groups that actually have something in them. */
 {
 fullTrackList = getFullTrackList();
+fullTrackHash = hashTrackList(fullTrackList);
 curTrack = findSelectedTrack(fullTrackList, NULL, hgtaTrack);
 fullGroupList = makeGroupList(fullTrackList, allowAllTables());
 curGroup = findSelectedGroup(fullGroupList, hgtaGroup);